Passed
Push — master ( 33c64b...8d1135 )
by Michael
03:38
created

include/functions.rpc.php (1 issue)

Severity
1
<?php
2
/**
3
 * NewBB 5.0x,  the forum module for XOOPS project
4
 *
5
 * @copyright      XOOPS Project (https://xoops.org)
6
 * @license        GNU GPL 2 or later (http://www.gnu.org/licenses/gpl-2.0.html)
7
 * @author         Taiwen Jiang (phppp or D.J.) <[email protected]>
8
 * @since          4.00
9
 * @package        module::newbb
10
 */
11
12
// defined('XOOPS_ROOT_PATH') || die('Restricted access');
13
14
defined('NEWBB_FUNCTIONS_INI') || require __DIR__ . '/functions.ini.php';
15
define('NEWBB_FUNCTIONS_RPC_LOADED', true);
16
17
if (!defined('NEWBB_FUNCTIONS_RPC')) {
18
    define('NEWBB_FUNCTIONS_RPC', 1);
19
20
    /**
21
     * Function to respond to a trackback
22
     * @param int    $error
23
     * @param string $error_message
24
     */
25
    function newbbTrackbackResponse($error = 0, $error_message = '')
26
    {
27
        $moduleConfig = newbbLoadConfig();
28
29
        if (!empty($moduleConfig['rss_utf8'])) {
30
            $charset       = 'utf-8';
31
            $error_message = xoops_utf8_encode($error_message);
32
        } else {
33
            $charset = _CHARSET;
34
        }
35
        header('Content-Type: text/xml; charset="' . $charset . '"');
36
        if ($error) {
37
            echo '<?xml version="1.0" encoding="' . $charset . '"?' . ">\n";
38
            echo '<response>\n';
39
            echo '<error>1</error>\n';
40
            echo '<message>$error_message</message>\n';
41
            echo '</response>';
42
            exit();
0 ignored issues
show
Using exit here is not recommended.

In general, usage of exit should be done with care and only when running in a scripting context like a CLI script.

Loading history...
43
        }
44
        echo '<?xml version="1.0" encoding="' . $charset . '"?' . ">\n";
45
        echo '<response>\n';
46
        echo '<error>0</error>\n';
47
        echo '</response>';
48
    }
49
}
50