Ejemplo n.º 1
0
if ($sid != $user->data['session_id']) {
    $result_ar = array('result' => AJAX_ERROR, 'error_msg' => 'Invalid session_id');
    AJAX_headers();
    AJAX_message_die($result_ar);
}
// Get mode
$mode = request_var('mode', '');
$plugin = request_var('plugin', '', true);
$json = request_var('json', 0);
$json = !empty($plugin) ? true : $json;
$term = request_var('term', '', true);
$search = request_var('search', 0);
$username = request_var('username', '', true);
$email = request_var('email', '', true);
// Send AJAX headers - this is to prevent browsers from caching possible error pages
AJAX_headers($json);
if (!empty($plugin)) {
    $plugin_name = $plugin;
    if (empty($config['plugins'][$plugin_name]['enabled']) || empty($config['plugins'][$plugin_name]['dir']) || !file_exists(IP_ROOT_PATH . PLUGINS_PATH . $config['plugins'][$plugin_name]['dir'] . 'common.' . PHP_EXT) || !file_exists(IP_ROOT_PATH . PLUGINS_PATH . $config['plugins'][$plugin_name]['dir'] . 'includes/class_ajax.' . PHP_EXT)) {
        $result_ar = array('id' => 0, 'value' => 'ERROR');
        AJAX_message_die($result_ar, $json);
    }
    include IP_ROOT_PATH . PLUGINS_PATH . $config['plugins'][$plugin_name]['dir'] . 'common.' . PHP_EXT;
    include IP_ROOT_PATH . PLUGINS_PATH . $config['plugins'][$plugin_name]['dir'] . 'includes/class_ajax.' . PHP_EXT;
    $class_ajax = new class_ajax();
    $class_ajax->mode = $mode;
    $class_ajax->json = $json;
    $class_ajax->term = $term;
    $class_ajax->ajax();
}
if ($mode == 'checkusername_post') {
Ejemplo n.º 2
0
// Start session management
$user->session_begin();
$auth->acl($user->data);
$user->setup();
// End session management
include IP_ROOT_PATH . 'includes/class_form.' . PHP_EXT;
$class_form = new class_form();
include_once IP_ROOT_PATH . 'includes/functions_selects.' . PHP_EXT;
include_once IP_ROOT_PATH . 'includes/functions_post.' . PHP_EXT;
include_once IP_ROOT_PATH . 'includes/bbcode.' . PHP_EXT;
// Define constant to keep page_header.php from sending headers
define('AJAX_HEADERS', true);
$useragent = isset($_SERVER['HTTP_USER_AGENT']) ? $_SERVER['HTTP_USER_AGENT'] : getenv('HTTP_USER_AGENT');
$encoding_charset = !empty($lang['ENCODING']) ? $lang['ENCODING'] : 'UTF-8';
// Send AJAX headers - this is to prevent browsers from caching possible error pages
AJAX_headers();
header('Content-Type: text/html; charset=' . $encoding_charset);
$mode_array = array('block_config');
$mode = request_var('mode', '');
$mode = in_array($mode, $mode_array) ? $mode : false;
$action_array = array('edit');
$action = request_var('action', '');
$action = in_array($action, $action_array) ? $action : false;
$b_id = isset($_GET['b_id']) ? intval($_GET['b_id']) : (isset($_POST['b_id']) ? intval($_POST['b_id']) : false);
$b_id = $b_id < 0 ? false : $b_id;
$blocks_dir = IP_ROOT_PATH . 'blocks/';
$blockfile = isset($_GET['blockfile']) ? $_GET['blockfile'] : (isset($_POST['blockfile']) ? $_POST['blockfile'] : false);
if ($blockfile == '') {
    // BBCBMG - BEGIN
    include IP_ROOT_PATH . 'includes/bbcb_mg.' . PHP_EXT;
    $template->assign_var_from_handle('BBCB_MG', 'bbcb_mg');
Ejemplo n.º 3
0
function AJAX_message_die($data_ar, $json = false)
{
    global $template, $db, $cache, $config;
    if (!headers_sent()) {
        AJAX_headers($json);
    }
    if (!empty($json)) {
        echo json_encode($data_ar);
    } else {
        $template->set_filenames(array('ajax_result' => 'ajax_result.tpl'));
        foreach ($data_ar as $key => $value) {
            if ($value !== '') {
                $value = utf8_encode(htmlspecialchars($value));
                // Get special characters in posts back ;)
                $value = preg_replace('#&amp;\\#(\\d{1,4});#i', '&#\\1;', $value);
                $template->assign_block_vars('tag', array('TAGNAME' => $key, 'VALUE' => $value));
            }
        }
        $template->pparse('ajax_result');
    }
    garbage_collection();
    exit_handler();
    exit;
}