Exemple #1
0
$users_id = empty($cs_get['id']) ? 0 : $cs_get['id'];
$nick_temp = cs_sql_select(__FILE__, 'users', 'users_nick', 'users_id = ' . $users_id);
if (isset($_GET['agree'])) {
    $nick = $nick_temp['users_nick'];
    $chars = 'abcdefghijklmnopqrstuvwxyz0123456789';
    $chars_count = strlen($chars) - 1;
    $mail = '';
    $given = 1;
    while (!empty($given)) {
        for ($i = 0; $i < 40; $i++) {
            $rand = rand(0, $chars_count);
            $mail .= $chars[$rand];
        }
        $given = cs_sql_count(__FILE__, 'users', "users_email = '" . $mail . "'");
    }
    $array_data = array('access_id' => 0, 'users_nick' => $nick, 'users_pwd' => '', 'users_name' => '', 'users_surname' => '', 'users_sex' => '', 'users_age' => '', 'users_height' => 0, 'users_lang' => '', 'users_country' => "fam", 'users_postalcode' => '', 'users_place' => '', 'users_adress' => '', 'users_icq' => 0, 'users_jabber' => '', 'users_skype' => '', 'users_email' => $mail, 'users_url' => '', 'users_phone' => '', 'users_mobile' => '', 'users_laston' => 0, 'users_picture' => '', 'users_avatar' => '', 'users_signature' => '', 'users_info' => '', 'users_regkey' => '', 'users_register' => 0, 'users_delete' => 1);
    $array_keys = array_keys($array_data);
    $array_values = array_values($array_data);
    cs_sql_update(__FILE__, 'users', $array_keys, $array_values, $users_id);
    cs_sql_delete(__FILE__, 'members', $users_id, 'users_id');
    cs_cache_clear();
    cs_redirect($cs_lang['del_true'], 'users');
}
if (isset($_GET['cancel'])) {
    cs_redirect($cs_lang['del_false'], 'users');
} else {
    $data['head']['body'] = sprintf($cs_lang['rly_rmv_user'], $nick_temp['users_nick']);
    $data['url']['agree'] = cs_url('users', 'remove', 'id=' . $users_id . '&amp;agree');
    $data['url']['cancel'] = cs_url('users', 'remove', 'id=' . $users_id . '&amp;cancel');
    echo cs_subtemplate(__FILE__, $data, 'users', 'remove');
}
Exemple #2
0
function cs_init($predefined)
{
    @error_reporting(E_ALL | E_STRICT);
    @set_error_handler("php_error");
    @ini_set('short_open_tag', 'off');
    @ini_set('arg_separator.output', '&amp;');
    @ini_set('session.use_trans_sid', '0');
    @ini_set('session.use_cookies', '1');
    @ini_set('session.use_only_cookies', '1');
    @ini_set('display_errors', 'on');
    $phpversion = phpversion();
    if (version_compare($phpversion, '5.1', '>=')) {
        @date_default_timezone_set('Europe/Berlin');
    }
    global $account, $com_lang, $cs_db, $cs_logs, $cs_main, $cs_micro, $cs_template;
    $cs_micro = explode(' ', microtime());
    # starting parsetime
    $cs_logs = array('php_errors' => '', 'errors' => '', 'sql' => '', 'queries' => 0, 'warnings' => 1, 'dir' => 'uploads/logs');
    $cs_main['cellspacing'] = 1;
    $cs_main['def_lang'] = empty($cs_main['def_lang']) ? 'English' : $cs_main['def_lang'];
    $cs_main['def_theme'] = empty($cs_main['def_theme']) ? 'base' : $cs_main['def_theme'];
    $cs_main['xsrf_protection'] = true;
    $cs_main['zlib'] = true;
    require_once 'system/core/servervars.php';
    $cs_main['ajaxrequest'] = isset($_REQUEST['xhr']) ? true : false;
    require_once 'system/core/tools.php';
    require_once 'system/core/abcode.php';
    require_once 'system/core/templates.php';
    require_once 'system/core/gd.php';
    require_once 'system/core/cachegen.php';
    $cs_main['cache_mode'] = 'file';
    if (version_compare($phpversion, '5.0', '<')) {
        require_once 'mods/clansphere/fallback.php';
    }
    if ($cs_main['php_self']['basename'] == 'install.php') {
        $account = array('users_id' => 0, 'access_clansphere' => 0, 'access_errors' => 2, 'access_install' => 5);
    } else {
        file_exists('setup.php') ? require_once 'setup.php' : die(cs_error_internal('setup', '<a href="' . $cs_main['php_self']['dirname'] . 'install.php">Installation</a>'));
    }
    if (!in_array($cs_main['cache_mode'], array('file', 'none')) and !extension_loaded($cs_main['cache_mode'])) {
        $cs_main['cache_mode'] = 'file';
    }
    require_once 'system/cache/' . $cs_main['cache_mode'] . '.php';
    if (empty($cs_main['charset'])) {
        $cs_main['charset'] = 'UTF-8';
        die(cs_error_internal(0, 'No charset information found in setup.php'));
    }
    # backfall if json extension is not available
    if (!extension_loaded('json')) {
        require_once 'system/output/json.php';
    }
    require_once 'system/output/xhtml_10.php';
    # add old xhtml functions if needed
    if (!empty($cs_main['xhtml_old'])) {
        require_once 'system/output/xhtml_10_old.php';
    }
    if (!empty($predefined['init_sql'])) {
        require_once 'system/database/' . $cs_db['type'] . '.php';
        $cs_db['con'] = cs_sql_connect($cs_db);
        unset($cs_db['pwd'], $cs_db['user']);
        $cs_options = cs_sql_option(__FILE__, 'clansphere');
        $cs_options['unicode'] = extension_loaded('unicode') ? 1 : 0;
        if (!isset($cs_options['cache_unicode']) or $cs_options['cache_unicode'] != $cs_options['unicode']) {
            cs_cache_clear();
        }
    } else {
        $cs_options = array();
    }
    $cs_main = array_merge($cs_main, $cs_options, $predefined);
    if (empty($cs_main['def_path'])) {
        $cs_main['def_path'] = getcwd();
    }
    # process mod and action data
    $cs_main = cs_content_prepare($cs_main);
    if (!empty($predefined['init_sql'])) {
        require_once 'system/core/account.php';
        $cs_main['def_theme'] = empty($account['users_theme']) ? $cs_main['def_theme'] : $account['users_theme'];
    }
    # determine users language
    $account['users_lang'] = cs_content_lang();
    if (!empty($predefined['init_sql'])) {
        # check for deprecated runstartup behavior
        if (!empty($cs_main['runstartup'])) {
            cs_tasks('system/runstartup');
        }
        # fetch startup files
        $startup = cs_cache_load('startup');
        # fallback to create startup files overview
        if ($startup == false) {
            $startup = cs_cache_dirs('mods', $account['users_lang'], 1);
        }
        # execute startup files
        if (is_array($startup)) {
            foreach ($startup as $mod) {
                $file = $cs_main['def_path'] . '/mods/' . $mod . '/startup.php';
                file_exists($file) ? include_once $file : cs_error($file, 'cs_init - Startup file not found');
            }
        }
    }
    # search for possible mod and action errors
    $cs_main = cs_content_check($cs_main);
    $cs_main['template'] = empty($cs_main['def_tpl']) ? 'clansphere' : $cs_main['def_tpl'];
    $cs_template = cs_template_info($cs_main['template']);
    if (!empty($_GET['template']) and preg_match("=^[_a-z0-9-]+\$=i", $_GET['template'])) {
        $cs_main['template'] = $_GET['template'];
    }
    if (!empty($predefined['init_tpl'])) {
        if ($cs_main['ajaxrequest'] === true) {
            echo cs_ajaxwrap();
        } else {
            echo cs_template($cs_micro, $cs_main['tpl_file']);
        }
    }
}