Пример #1
0
/**
 * Options page, values of <select> option
 *
 * @param string $name The name of config name, ex: config.lang
 * @param string $default_value The default value of a select input
 * @return string|bool
 */
function option_select_values($name, $default_value = '')
{
    global $plugin, $lang;
    $values = '';
    switch ($name) {
        case 'time_zone':
            $zones = time_zones();
            foreach ($zones as $z => $t) {
                $values .= '<option ' . ($default_value == $t ? 'selected="selected" ' : '') . 'value="' . $t . '">' . $z . '</option>' . "\n";
            }
            break;
        case 'language':
            if ($dh = @opendir(PATH . 'languages')) {
                while (($file = readdir($dh)) !== false) {
                    if (strpos($file, '.') === false && $file != '..' && $file != '.') {
                        $values .= '<option ' . ($default_value == $file ? 'selected="selected"' : '') . ' value="' . $file . '">' . $file . '</option>' . "\n";
                    }
                }
                @closedir($dh);
            }
            break;
        case 'user_system':
            #fix previous choice in old kleeja
            if (in_array($default_value, array('2', '3', '4'))) {
                $default_value = str_replace(array('2', '3', '4'), array('phpbb', 'vb', 'mysmartbb'), $default_value);
            }
            $values .= '<option value="1"' . ($default_value == '1' ? ' selected="selected"' : '') . '>' . $lang['NORMAL'] . '</option>' . "\n";
            if ($dh = @opendir(PATH . 'includes/auth_integration')) {
                while (($file = readdir($dh)) !== false) {
                    if (strpos($file, '.php') !== false) {
                        $file = trim(str_replace('.php', '', $file));
                        $values .= '<option value="' . $file . '"' . ($default_value == $file ? ' selected="selected"' : '') . '>' . $file . '</option>' . "\n";
                    }
                }
                @closedir($dh);
            }
            break;
        case 'decode':
            $decode_types = array(0 => $lang['NO_CHANGE'], 1 => $lang['CHANGE_TIME'], 2 => $lang['CHANGE_MD5']);
            ($hook = $plugin->run_hook('option_select_values_decode_types_func')) ? eval($hook) : null;
            //run hook
            foreach ($decode_types as $d => $l) {
                $values .= '<option ' . ($default_value == $d ? 'selected="selected" ' : '') . 'value="' . $d . '">' . $l . '</option>' . "\n";
            }
            break;
        case 'id_form':
            $id_form_types = array('id' => $lang['IDF'], 'filename' => $lang['IDFF'], 'direct' => $lang['IDFD']);
            ($hook = $plugin->run_hook('option_select_values_decode_types_func')) ? eval($hook) : null;
            //run hook
            foreach ($id_form_types as $d => $l) {
                $values .= '<option ' . ($default_value == $d ? 'selected="selected" ' : '') . 'value="' . $d . '">' . $l . '</option>' . "\n";
            }
            break;
    }
    ($hook = $plugin->run_hook('option_select_values_func')) ? eval($hook) : null;
    //run hook
    return $values;
}
Пример #2
0
// All datetime data is stored in the UTC
$default_tz = date_default_timezone_set('UTC');
if (isset($_POST['action']) && !empty($_POST['action'])) {
    $action = $_POST['action'];
    switch ($action) {
        case 'register':
            register();
            break;
        case 'profile':
            profile();
            break;
        case 'save':
            save();
            break;
        case 'time_zones':
            time_zones();
            break;
        case 'login':
            login();
            break;
        case 'logout':
            logout();
            break;
    }
}
// Registration
function register()
{
    global $conn;
    $sql = "SELECT id, username, email \r\n\t\t\tFROM users\r\n\t\t\tWHERE username='******'username'] . "' OR email='" . $_POST['email'] . "'";
    $result = $conn->query($sql);
Пример #3
0
    $query['WHERE'] = "type = '" . $SQL->escape($current_smt) . "' OR type = ''";
} else {
    if ($current_smt == 'all') {
        $query['WHERE'] = "type <> 'groups' OR type = ''";
    }
}
$result = $SQL->build($query);
$thumbs_are = get_config('thmb_dims');
while ($row = $SQL->fetch_array($result)) {
    #make new lovely array !!
    $con[$row['name']] = $row['value'];
    if ($row['name'] == 'thumbs_imgs') {
        list($thmb_dim_w, $thmb_dim_h) = array_map('trim', @explode('*', $thumbs_are));
    } else {
        if ($row['name'] == 'time_zone') {
            $zones = time_zones();
            foreach ($zones as $z => $t) {
                $time_zones .= '<option ' . ($con['time_zone'] == $t ? 'selected="selected"' : '') . ' value="' . $t . '">' . $z . '</option>' . "\n";
            }
        } else {
            if ($row['name'] == 'language') {
                //get languages
                if ($dh = @opendir(PATH . 'lang')) {
                    while (($file = readdir($dh)) !== false) {
                        if (strpos($file, '.') === false && $file != '..' && $file != '.') {
                            $lngfiles .= '<option ' . ($con['language'] == $file ? 'selected="selected"' : '') . ' value="' . $file . '">' . $file . '</option>' . "\n";
                        }
                    }
                    @closedir($dh);
                }
            } else {