function SystemClockSettings()
{
    $session =& $_SESSION['SystemClockSettings'];
    $smarty = smarty_init(dirname(__FILE__) . '/templates');
    $Message = isset($_REQUEST['msg']) ? $_REQUEST['msg'] : "";
    if (!empty($_REQUEST['submit'])) {
        $Settings = formdata_from_post();
        $Settings['Current_TimeZone'] = $Settings['TimeZones'][0];
        $Settings['DisableNTP'] = $Settings['DisableNTPLast'];
        $Errors = formdata_validate($Settings, $variables);
        if (count($Errors) == 0) {
            $Message = 'SAVED_SYSTEMCLOCK_SETTINGS';
            formdata_save($Settings);
        }
        $OldSettings = formdata_from_db();
        foreach ($OldSettings as $variable => $value) {
            if (!isset($Settings[$variable])) {
                $Settings[$variable] = $value;
            }
        }
    } else {
        $Settings = formdata_from_db();
    }
    $TimeZones = get_timezone_list();
    $smarty->assign('Errors', $Errors);
    $smarty->assign('Message', $Message);
    $smarty->assign('Settings', $Settings);
    $smarty->assign('TimeZones', $TimeZones);
    $smarty->assign('CurrentTime', date("F j, Y, g:i a"));
    return $smarty->fetch('SystemClockSettings.tpl');
}
/**
 * Get a list of timezones.
 *
 * @param  ?string		Current timezone to select (NULL: server default)
 * @return tempcode		List of timezones
 */
function nice_get_timezone_list($timezone = NULL)
{
    if (is_null($timezone)) {
        $timezone = get_site_timezone();
    }
    $timezone_list = new ocp_tempcode();
    foreach (get_timezone_list() as $_timezone => $timezone_nice) {
        $timezone_list->attach(do_template('OCF_AUTO_TIME_ZONE_ENTRY', array('HOUR' => date('H', tz_time(time(), $_timezone)), 'DW' => date('w', tz_time(time(), $_timezone)), 'NAME' => $_timezone, 'SELECTED' => $timezone == $_timezone, 'CLASS' => '', 'TEXT' => $timezone_nice)));
    }
    return $timezone_list;
}
示例#3
0
function config_form()
{
    global $phpc_script, $phpc_user_tz, $phpc_user_lang, $phpc_token;
    $tz_input = create_multi_select('timezone', get_timezone_list(), $phpc_user_tz);
    $languages = array("" => __("Default"));
    foreach (get_languages() as $lang) {
        $languages[$lang] = $lang;
    }
    $lang_input = create_select('language', $languages, $phpc_user_lang);
    $form = tag('form', attributes("action=\"{$phpc_script}\"", 'method="post"'), tag('table', attributes("class=\"phpc-container\""), tag('caption', __('Settings')), tag('tfoot', tag('tr', tag('td', attributes('colspan="2"'), create_hidden('phpc_token', $phpc_token), create_hidden('action', 'settings'), create_hidden('phpc_submit', 'settings'), create_submit(__('Submit'))))), tag('tbody', tag('tr', tag('th', __('Timezone')), tag('td', $tz_input)), tag('tr', tag('th', __('Language')), tag('td', $lang_input)))));
    return tag('div', attrs('id="phpc-config"'), $form);
}
示例#4
0
function config_form()
{
    global $phpc_script, $phpc_user_tz, $phpc_user_lang, $phpc_token, $phpcdb, $phpc_user;
    $tz_input = create_multi_select('timezone', get_timezone_list(), $phpc_user_tz);
    $languages = array("" => __("Default"));
    foreach (get_languages() as $lang) {
        $languages[$lang] = $lang;
    }
    $lang_input = create_select('language', $languages, $phpc_user_lang);
    $calendars = array("" => __("None"));
    foreach ($phpcdb->get_calendars() as $calendar) {
        $calendars[$calendar->get_cid()] = $calendar->get_title();
    }
    $default_input = create_select('default_cid', $calendars, $phpc_user->get_default_cid());
    $table = tag('table', attrs('class="phpc-form"'));
    if (is_user()) {
        $table->add(tag('tr', tag('th', __('Default Calendar')), tag('td', $default_input)));
    }
    $table->add(tag('tr', tag('th', __('Timezone')), tag('td', $tz_input)));
    $table->add(tag('tr', tag('th', __('Language')), tag('td', $lang_input)));
    $form = tag('form', attributes("action=\"{$phpc_script}\"", 'method="post"'), tag('div', attrs('class="phpc-sub-title"'), __('Settings')), $table, create_hidden('phpc_token', $phpc_token), create_hidden('action', 'user_settings_submit'), create_submit(__('Submit')));
    return tag('div', attrs('id="phpc-config"'), $form);
}
示例#5
0
 public function testTimezoneList()
 {
     $timezones = get_timezone_list();
     $this->assertInternalType('array', $timezones);
 }
示例#6
0
// @NOTE: if the user doesn't have permission to view users
// it should be log out
// see: https://github.com/directus/directus/issues/1268
if (!$users) {
    AuthProvider::logout();
    $_SESSION['error_message'] = 'Your user doesn\'t have permission to log in';
    header('Location: ' . DIRECTUS_PATH . 'login.php');
    exit;
}
$currentUserInfo = getCurrentUserInfo($users);
// Cache buster
$git = __DIR__ . '/.git';
$cacheBuster = Directus\Util\Git::getCloneHash($git);
$tableSchema = TableSchema::getAllSchemas($currentUserInfo['group']['id'], $cacheBuster);
// $tabPrivileges = getTabPrivileges(($currentUserInfo['group']['id']));
$groupId = $currentUserInfo['group']['id'];
$groups = getGroups();
$currentUserGroup = [];
if (isset($groups['rows']) && count($groups['rows'] > 0)) {
    foreach ($groups['rows'] as $group) {
        if ($group['id'] === $groupId) {
            $currentUserGroup = $group;
            break;
        }
    }
}
$statusMapping = ['active_num' => STATUS_ACTIVE_NUM, 'deleted_num' => STATUS_DELETED_NUM, 'status_name' => STATUS_COLUMN_NAME];
$statusMapping['mapping'] = $config['statusMapping'];
$data = ['cacheBuster' => $cacheBuster, 'nonces' => getNonces(), 'storage_adapters' => getStorageAdapters(), 'path' => DIRECTUS_PATH, 'page' => '#tables', 'tables' => parseTables($tableSchema), 'preferences' => parsePreferences($tableSchema), 'users' => $users, 'groups' => $groups, 'settings' => getSettings(), 'active_files' => getActiveFiles(), 'authenticatedUser' => $authenticatedUser, 'extensions' => getExtensions($currentUserGroup), 'privileges' => getPrivileges($groupId), 'ui' => getUI(), 'locale' => get_user_locale(), 'localesAvailable' => parseLocalesAvailable(get_locales_available()), 'phrases' => get_phrases(get_user_locale()), 'timezone' => get_user_timezone(), 'timezones' => get_timezone_list(), 'listViews' => getListViews(), 'messages' => getInbox(), 'user_notifications' => getLoginNotification(), 'bookmarks' => getBookmarks(), 'extendedUserColumns' => getExtendedUserColumns($tableSchema), 'statusMapping' => $statusMapping];
$templateVars = ['cacheBuster' => $cacheBuster, 'data' => json_encode($data), 'path' => DIRECTUS_PATH, 'locale' => get_user_locale(), 'dir' => 'ltr', 'customFooterHTML' => getCusomFooterHTML(), 'cssFilePath' => getCSSFilePath()];
echo template(file_get_contents('main.html'), $templateVars);
示例#7
0
文件: index.php 项目: rhertzog/lcs
    if (!$singleDbForm) {
        echo '<div class="row">' . "\n" . '<div class="rowTitle">' . "\n" . '<label for="dbStatsForm"><span class="required">*</span> ' . get_lang('Tracking database') . '</label>' . "\n" . '</div>' . "\n" . '<div class="rowField">' . "\n" . '<input type="text"  size="30" id="dbStatsForm" name="dbStatsForm" value="' . claro_htmlspecialchars($dbStatsForm) . '" />' . "\n" . '<span class="example">' . get_lang('e.g.') . ' ' . $dbStatsForm . '</span>' . "\n" . '</div>' . "\n" . '</div>' . "\n\n" . '<div class="row">' . "\n" . '<div class="rowTitle">' . "\n" . '<label for="statsTblPrefixForm">' . get_lang('Prefix for tracking tables') . '</label>' . "\n" . '</div>' . "\n" . '<div class="rowField">' . "\n" . '<input type="text"  size="5" id="statsTblPrefixForm" name="statsTblPrefixForm" value="' . claro_htmlspecialchars($statsTblPrefixForm) . '" />' . "\n" . '<span class="example">' . get_lang('e.g.') . ' ' . $statsTblPrefixForm . '</span>' . "\n" . '</div>' . "\n" . '</div>' . "\n\n" . '<blockquote><small>' . "\n" . get_lang('Tracking tables are stored by default into the main Claroline database.') . '<br />' . get_lang('However, you can record tracking data into a separate database or set a specific prefix for tracking tables.') . "\n" . '</small></blockquote>' . "\n";
    }
    echo '<div class="row">' . "\n" . '<div class="rowTitle">' . "\n" . '<label for="dbPrefixForm">' . ($singleDbForm ? get_lang('Prefix for course tables') : get_lang('Prefix for course databases')) . '</label>' . "\n" . '</div>' . "\n" . '<div class="rowField">' . "\n" . '<input type="text"  size="30" id="dbPrefixForm" name="dbPrefixForm" value="' . claro_htmlspecialchars($dbPrefixForm) . '" />' . "\n" . '<span class="example">' . get_lang('e.g.') . ' ' . $dbPrefixForm . '</span>' . "\n" . '</div>' . "\n" . '</div>' . "\n\n";
    if (!$singleDbForm) {
        echo '<blockquote>' . "\n" . '<small>' . "\n" . '<strong>' . "\n" . get_lang('A database will be created for each course.') . "\n" . '</strong>' . "\n" . '<br />' . "\n" . get_lang('You can choose the prefix that will be used for these databases') . "\n" . '</small>' . "\n" . '</blockquote>' . "\n";
    }
    echo '</fieldset>' . "\n\n" . '<small>' . get_lang('%requiredMark required field', array('%requiredMark' => '<span class="required">*</span>')) . '</small>' . "\n";
} elseif (DISP_ADMINISTRATOR_SETTING == $display) {
    echo '<input type="hidden" name="fromPanel" value="' . $display . '" />' . "\n" . '<h2>' . "\n" . get_lang('Step %step of %nb_step : %step_name', array('%step' => array_search(DISP_ADMINISTRATOR_SETTING, $panelSequence) + 1, '%nb_step' => count($panelSequence), '%step_name' => $panelTitle[DISP_ADMINISTRATOR_SETTING])) . '</h2>' . "\n";
    if (is_array($missing_admin_data) || is_array($error_in_admin_data)) {
        echo '<div class="claroDialogBox boxError">' . "\n" . '<p>' . "\n" . '<strong>' . get_lang('Error') . '</strong> : ' . get_lang('Please enter missing information') . '</p>' . "\n" . '<p>' . "\n" . (is_array($missing_admin_data) ? 'Fill in ' . implode(', ', $missing_admin_data) . '<br />' : '') . (is_array($error_in_admin_data) ? 'Check ' . implode(', ', $error_in_admin_data) : '') . '</p>' . "\n" . '</div>' . "\n";
    }
    echo '<fieldset>' . "\n" . '<legend>' . get_lang('Administrator details') . '</legend>' . "\n" . '<div class="row">' . "\n" . '<div class="rowTitle">' . "\n" . '<label for="loginForm"><span class="required">*</span> ' . get_lang('Login') . '</label>' . "\n" . '</div>' . "\n" . '<div class="rowField">' . "\n" . '<input type="text" size="30" id="loginForm" name="loginForm" value="' . claro_htmlspecialchars($loginForm) . '" />' . "\n" . '<span class="example">' . get_lang('e.g.') . ' jdoe</span>' . "\n" . '</div>' . "\n" . '</div>' . "\n\n" . '<div class="row">' . "\n" . '<div class="rowTitle">' . "\n" . '<label for="passForm"><span class="required">*</span> ' . get_lang('Password') . '</label>' . "\n" . '</div>' . "\n" . '<div class="rowField">' . "\n" . '<input type="text" size="30" id="passForm" name="passForm" value="' . claro_htmlspecialchars($passForm) . '" />' . "\n" . '<span class="example">' . get_lang('e.g.') . generate_passwd(8) . '</span>' . "\n" . '</div>' . "\n" . '</div>' . "\n\n" . '<div class="row">' . "\n" . '<div class="rowTitle">' . "\n" . '<label for="adminEmailForm"><span class="required">*</span> ' . get_lang('Email') . '</label>' . "\n" . '</div>' . "\n" . '<div class="rowField">' . "\n" . '<input type="text" size="30" id="adminEmailForm" name="adminEmailForm" value="' . claro_htmlspecialchars($adminEmailForm) . '" />' . "\n" . '<span class="example">' . get_lang('e.g.') . ' jdoe@mydomain.net</span>' . "\n" . '</div>' . "\n" . '</div>' . "\n\n" . '<div class="row">' . "\n" . '<div class="rowTitle">' . "\n" . '<label for="adminNameForm"><span class="required">*</span> ' . get_lang('Last name') . '</label>' . "\n" . '</div>' . "\n" . '<div class="rowField">' . "\n" . '<input type="text" size="30" id="adminNameForm" name="adminNameForm" value="' . claro_htmlspecialchars($adminNameForm) . '" />' . "\n" . '<span class="example">' . get_lang('e.g.') . ' Doe</span>' . "\n" . '</div>' . "\n" . '</div>' . "\n\n" . '<div class="row">' . "\n" . '<div class="rowTitle">' . "\n" . '<label for="adminSurnameForm"><span class="required">*</span> ' . get_lang('First name') . '</label>' . "\n" . '</div>' . "\n" . '<div class="rowField">' . "\n" . '<input type="text" size="30" id="adminSurnameForm" name="adminSurnameForm" value="' . claro_htmlspecialchars($adminSurnameForm) . '" />' . "\n" . '<span class="example">' . get_lang('e.g.') . ' John</span>' . "\n" . '</div>' . "\n" . '</div>' . "\n\n" . '</fieldset>' . "\n" . '<small>' . get_lang('%requiredMark required field', array('%requiredMark' => '<span class="required">*</span>')) . '</small>' . "\n";
} elseif (DISP_PLATFORM_SETTING == $display) {
    echo '<input type="hidden" name="fromPanel" value="' . $display . '" />' . "\n" . '<h2>' . "\n" . get_lang('Step %step of %nb_step : %step_name', array('%step' => array_search(DISP_PLATFORM_SETTING, $panelSequence) + 1, '%nb_step' => count($panelSequence), '%step_name' => $panelTitle[DISP_PLATFORM_SETTING])) . '</h2>' . "\n" . $msg_missing_platform_data . "\n" . '<fieldset>' . "\n" . '<legend>' . get_lang('Campus') . '</legend>' . "\n" . '<div class="row">' . "\n" . '<div class="rowTitle">' . "\n" . '<label for="campusForm"><span class="required">*</span> ' . get_lang('Name') . '</label>' . "\n" . '</div>' . "\n" . '<div class="rowField">' . "\n" . '<input type="text" size="30" id="campusForm" name="campusForm" value="' . claro_htmlspecialchars($campusForm) . '" />' . "\n" . '</div>' . "\n" . '</div>' . "\n\n" . '<div class="row">' . "\n" . '<div class="rowTitle">' . "\n" . '<label for="urlForm"><span class="required">*</span> ' . get_lang('Absolute URL') . '</label>' . "\n" . '</div>' . "\n" . '<div class="rowField">' . "\n" . '<input type="text" size="30" id="urlForm" name="urlForm" value="' . claro_htmlspecialchars($urlForm) . '" />' . "\n" . '</div>' . "\n" . '</div>' . "\n\n" . '<div class="row">' . "\n" . '<div class="rowTitle">' . "\n" . '<label for="courseRepositoryForm">' . get_lang('Path to courses repository (relative to the URL above)') . '</label>' . "\n" . '</div>' . "\n" . '<div class="rowField">' . "\n" . '<input type="text" size="30" id="courseRepositoryForm" name="courseRepositoryForm" value="' . claro_htmlspecialchars($courseRepositoryForm) . '" />' . "\n" . '</div>' . "\n" . '</div>' . "\n\n" . '<div class="row">' . "\n" . '<div class="rowTitle">' . "\n" . '<label for="languageForm"><span class="required">*</span> ' . get_lang('Main language') . '</label>' . "\n" . '</div>' . "\n" . '<div class="rowField">' . "\n" . claro_html_form_select('languageForm', $language_list, $languageForm, array('id' => 'languageForm')) . "\n" . '</div>' . "\n" . '</div>' . "\n\n" . '<div class="row">' . "\n" . '<div class="rowTitle">' . "\n" . '<label for="clmain_serverTimezone"><span class="required">*</span> ' . get_lang('Server timezone') . '</label>' . "\n" . '</div>' . "\n" . '<div class="rowField">' . "\n" . claro_html_form_select('clmain_serverTimezone', get_timezone_list(), $clmain_serverTimezone, array('id' => 'clmain_serverTimezone')) . "\n" . '</div>' . "\n" . '</div>' . "\n\n" . '</fieldset>' . "\n\n" . '<fieldset>' . "\n" . '<legend>' . get_lang('User') . '</legend>' . "\n" . '<div class="row">' . "\n" . '<div class="rowTitle">' . "\n" . '<span class="required">*</span> ' . "\n" . get_lang('Self-registration') . "\n" . '</div>' . "\n" . '<div class="rowField">' . "\n" . '<input type="radio" id="allowSelfReg_1" name="allowSelfReg" value="1" ' . ($allowSelfReg ? 'checked' : '') . ' />' . "\n" . '<label for="allowSelfReg_1">' . get_lang('Enabled') . '</label>' . "\n" . '<br />' . "\n" . '<input type="radio" id="allowSelfReg_0" name="allowSelfReg" value="0" ' . ($allowSelfReg ? '' : 'checked') . ' />' . "\n" . '<label for="allowSelfReg_0">' . get_lang('Disabled') . '</label>' . "\n" . '</div>' . "\n" . '</div>' . "\n\n" . '<div class="row">' . "\n" . '<div class="rowTitle">' . "\n" . '<span class="required">*</span> ' . "\n" . get_lang('Password storage') . "\n" . '</div>' . "\n" . '<div class="rowField">' . "\n" . '<input type="radio" name="encryptPassForm" id="encryptPassForm_0" value="0"  ' . ($encryptPassForm ? '' : 'checked') . ' />' . "\n" . '<label for="encryptPassForm_0">' . get_lang('Clear text') . '</label>' . "\n" . '<br />' . "\n" . '<input type="radio" name="encryptPassForm" id="encryptPassForm_1" value="1" ' . ($encryptPassForm ? 'checked' : '') . ' />' . "\n" . '<label for="encryptPassForm_1">' . get_lang('Encrypted') . '</label>' . "\n" . '</div>' . "\n" . '</div>' . "\n\n" . '</fieldset>' . "\n" . '<small>' . get_lang('%requiredMark required field', array('%requiredMark' => '<span class="required">*</span>')) . '</small>' . "\n";
} elseif (DISP_ADMINISTRATIVE_SETTING == $display) {
    echo '<input type="hidden" name="fromPanel" value="' . $display . '" /><h2>' . get_lang('Step %step of %nb_step : %step_name', array('%step' => array_search(DISP_ADMINISTRATIVE_SETTING, $panelSequence) + 1, '%nb_step' => count($panelSequence), '%step_name' => $panelTitle[DISP_ADMINISTRATIVE_SETTING])) . '</h2>' . "\n" . $msg_missing_administrative_data . '<fieldset>' . "\n" . '<legend>' . get_lang('Related organization') . '</legend>' . "\n" . '<div class="row">' . "\n" . '<div class="rowTitle">' . "\n" . '<label for="institutionForm">' . get_lang('Institution name') . '</label>' . "\n" . '</div>' . "\n" . '<div class="rowField">' . "\n" . '<input type="text" size="30" id="institutionForm" name="institutionForm" value="' . claro_htmlspecialchars($institutionForm) . '" />' . "\n" . '</div>' . "\n" . '</div>' . "\n\n" . '<div class="row">' . "\n" . '<div class="rowTitle">' . "\n" . '<label for="institutionUrlForm">' . get_lang('Institution URL') . '</label>' . "\n" . '</div>' . "\n" . '<div class="rowField">' . "\n" . '<input type="text" size="30" id="institutionUrlForm" name="institutionUrlForm" value="' . claro_htmlspecialchars($institutionUrlForm) . '" />' . "\n" . '</div>' . "\n" . '</div>' . "\n\n" . '</fieldset>' . "\n\n" . '<fieldset>' . "\n" . '<legend>' . get_lang('Campus contact') . '</legend>' . "\n" . '<div class="row">' . "\n" . '<div class="rowTitle">' . "\n" . '<label for="contactNameForm"><span class="required">*</span> ' . get_lang('Contact name') . '</label>' . "\n" . '</div>' . "\n" . '<div class="rowField">' . "\n" . '<input type="text" size="30" id="contactNameForm" name="contactNameForm" value="' . claro_htmlspecialchars($contactNameForm) . '"/>' . "\n" . '</div>' . "\n" . '</div>' . "\n\n" . '<div class="row">' . "\n" . '<div class="rowTitle">' . "\n" . '<label for="contactEmailForm"><span class="required">*</span> ' . get_lang('Contact email') . '</label>' . "\n" . '</div>' . "\n" . '<div class="rowField">' . "\n" . '<input type="text" size="30" id="contactEmailForm" name="contactEmailForm" value="' . claro_htmlspecialchars($contactEmailForm) . '"/>' . "\n" . '</div>' . "\n" . '</div>' . "\n\n" . '<div class="row">' . "\n" . '<div class="rowTitle">' . "\n" . '<label for="contactPhoneForm">' . get_lang('Contact phone') . '</label>' . "\n" . '</div>' . "\n" . '<div class="rowField">' . "\n" . '<input type="text" size="30" id="contactPhoneForm" name="contactPhoneForm" value="' . claro_htmlspecialchars($contactPhoneForm) . '" />' . "\n" . '</div>' . "\n" . '</div>' . "\n\n" . '</fieldset>' . "\n" . '<small>' . get_lang('%requiredMark required field', array('%requiredMark' => '<span class="required">*</span>')) . '</small>' . "\n";
} elseif (DISP_LAST_CHECK_BEFORE_INSTALL == $display) {
    $pathForm = str_replace("\\\\", "/", $pathForm);
    //echo "pathForm $pathForm";
    echo '<input type="hidden" name="fromPanel" value="' . $display . '" />' . "\n" . '<h2>' . get_lang('Step %step of %nb_step : %step_name', array('%step' => array_search(DISP_LAST_CHECK_BEFORE_INSTALL, $panelSequence) + 1, '%nb_step' => count($panelSequence), '%step_name' => $panelTitle[DISP_LAST_CHECK_BEFORE_INSTALL])) . '</h2>' . "\n" . '<p>' . "\n" . get_lang('Please check the values you entered.') . '<br />' . "\n" . get_lang('Print this page to keep your administrator password and other settings.') . "\n" . '</p>' . "\n" . '<fieldset>' . "\n" . '<legend>' . $panelTitle[DISP_DB_CONNECT_SETTING] . '</legend>' . "\n" . '<table class="checkList">' . "\n\n" . '<tr class="checkSubTitle">' . '<th colspan="2">' . get_lang('Mysql connection parameters') . '</th>' . '</tr>' . "\n" . '<tr class="check">' . "\n" . '<td class="checkTitle">' . "\n" . get_lang('Database host') . ' : ' . "\n" . '</td>' . "\n" . '<td class="checkValue">' . "\n" . claro_htmlspecialchars($dbHostForm) . '</td>' . "\n" . '</tr>' . "\n\n" . '<tr class="check">' . "\n" . '<td class="checkTitle">' . "\n" . get_lang('Database username') . ' : ' . "\n" . '</td>' . "\n" . '<td class="checkValue">' . "\n" . claro_htmlspecialchars($dbUsernameForm) . '</td>' . "\n" . '</tr>' . "\n\n" . '<tr class="check">' . "\n" . '<td class="checkTitle">' . "\n" . get_lang('Database password') . ' : ' . "\n" . '</td>' . "\n" . '<td class="checkValue">' . "\n" . claro_htmlspecialchars(empty($dbPassForm) ? '--empty--' : $dbPassForm) . '</td>' . "\n" . '</tr>' . "\n\n" . '</table>' . "\n\n" . '<table class="checkList">' . "\n\n" . '<tr class="checkSubTitle">' . '<th colspan="2">' . get_lang('Database usage') . '</th>' . '<tr>' . "\n" . '<tr class="check">' . "\n" . '<td class="checkTitle">' . "\n" . get_lang('Database mode') . ' : ' . "\n" . '</td>' . "\n" . '<td class="checkValue">' . "\n" . ($singleDbForm ? get_lang('Single') : get_lang('Multi')) . '</td>' . "\n" . '</tr>' . "\n\n" . '</table>' . "\n\n" . '</fieldset>' . "\n" . '<fieldset>' . "\n" . '<legend>' . $panelTitle[DISP_DB_NAMES_SETTING] . '</legend>' . "\n" . '<table class="checkList">' . "\n\n" . '<tr class="check">' . "\n" . '<td class="checkTitle">' . "\n" . get_lang('Main database') . ' : ' . "\n" . '</td>' . "\n" . '<td class="checkValue">' . "\n" . claro_htmlspecialchars($dbNameForm) . '</td>' . "\n" . '</tr>' . "\n\n" . '<tr class="check">' . "\n" . '<td class="checkTitle">' . "\n" . get_lang('Tracking database') . ' : ' . "\n" . '</td>' . "\n" . '<td class="checkValue">' . "\n" . claro_htmlspecialchars($dbStatsForm) . '</td>' . "\n" . '</tr>' . "\n\n" . '</table>' . "\n\n" . '<table class="checkList">' . "\n\n" . '<tr class="checkSubTitle">' . '<th colspan="2">' . get_lang('Table prefixes') . '</th>' . '<tr>' . "\n";
    if ('' != $mainTblPrefixForm) {
        echo '<tr class="check">' . "\n" . '<td class="checkTitle">' . "\n" . get_lang('Main tables') . ' : ' . "\n" . '</td>' . "\n" . '<td class="checkValue">' . "\n" . claro_htmlspecialchars($mainTblPrefixForm) . '</td>' . "\n" . '</tr>' . "\n\n";
    }
    if ('' != $statsTblPrefixForm) {
        echo '<tr class="check">' . "\n" . '<td class="checkTitle">' . "\n" . get_lang('Tracking tables') . ' : ' . "\n" . '</td>' . "\n" . '<td class="checkValue">' . "\n" . claro_htmlspecialchars($statsTblPrefixForm) . '</td>' . "\n" . '</tr>' . "\n\n";
    }
    if ('' != $dbPrefixForm) {
        echo '<tr class="check">' . "\n" . '<td class="checkTitle">' . "\n" . get_lang('Course databases') . ' : ' . "\n" . '</td>' . "\n" . '<td class="checkValue">' . "\n" . claro_htmlspecialchars($dbPrefixForm) . '</td>' . "\n" . '</tr>' . "\n\n";
    }
示例#8
0
	        </div>
	        
	        <label for="timezone"><?php 
echo _('Select your timezone');
?>
</label>
    		<select id="timezone" name="timezone">
			  <option value="<?php 
echo get_user_data('timezone');
?>
"><?php 
echo get_user_data('timezone');
?>
</option> 
			  <?php 
get_timezone_list();
?>
			</select>
			
			<br/><br/>
			
			<label for="language"><?php 
echo _('Select your language');
?>
</label>
    		<select id="language" name="language">
			  <option value="<?php 
echo get_user_data('language');
?>
"><?php 
echo get_user_data('language');
示例#9
0
 /**
  * The UI to edit a configuration page.
  *
  * @return tempcode		The UI
  */
 function config_category()
 {
     require_javascript('javascript_validation');
     /*$GLOBALS['HELPER_PANEL_PIC']='pagepics/config';
     		$GLOBALS['HELPER_PANEL_TUTORIAL']='tut_adv_configuration';*/
     $page = get_param('id');
     $title = get_page_title(do_lang_tempcode('CONFIG_CATEGORY_' . $page), false);
     $post_url = build_url(array('page' => '_SELF', 'type' => 'set', 'id' => $page, 'redirect' => get_param('redirect', NULL)), '_SELF');
     $category_description = do_lang_tempcode('CONFIG_CATEGORY_DESCRIPTION__' . $page);
     $rows = $GLOBALS['SITE_DB']->query_select('config', array('*'), array('the_page' => $page));
     // Addin special ones
     if ($page == 'SITE') {
         $rows[] = array('the_name' => 'timezone', 'human_name' => 'TIME_ZONE', 'config_value' => '', 'the_type' => 'special', 'eval' => '', 'the_page' => 'SITE', 'section' => 'GENERAL', 'explanation' => '', 'shared_hosting_restricted' => 0);
     }
     /*global $M_SORT_KEY;	This is a lame sort - it doesn't preserve internal order
     		$M_SORT_KEY='section';
     		usort($rows,'multi_sort');*/
     // Better sort
     $all_known_groups = array();
     foreach ($rows as $myrow) {
         $_group = do_lang($myrow['section'], NULL, NULL, NULL, NULL, false);
         if (is_null($_group)) {
             $_group = $myrow['section'];
         }
         $_group = strtolower(trim(preg_replace('#(&.*;)|[^\\w\\d\\s]#U', '', $_group)));
         if (array_key_exists($_group, $all_known_groups) && $all_known_groups[$_group] != $myrow['section']) {
             $_group = 'std_' . $myrow['section'];
         }
         // If cat names translate to same things or are in non-latin characters like Cyrillic
         $all_known_groups[$_group] = $myrow['section'];
     }
     $old_rows = $rows;
     $rows = array();
     ksort($all_known_groups);
     foreach ($all_known_groups as $group_codename) {
         foreach ($old_rows as $myrow) {
             if ($myrow['section'] == $group_codename) {
                 $rows[] = $myrow;
             }
         }
     }
     // Move advanced group options to the end
     $rows2 = array();
     foreach ($rows as $i => $row) {
         if ($row['section'] == 'ADVANCED') {
             $rows2[] = $row;
             unset($rows[$i]);
         }
     }
     $rows = array_merge($rows, $rows2);
     // UI hooks
     $ui_hooks = find_all_hooks('modules', 'admin_config');
     $upload_max_filesize = ini_get('upload_max_filesize') == '0' ? do_lang('NA') : clean_file_size(php_return_bytes(ini_get('upload_max_filesize')));
     $post_max_size = ini_get('post_max_size') == '0' ? do_lang('NA') : clean_file_size(php_return_bytes(ini_get('post_max_size')));
     $groups = new ocp_tempcode();
     require_code('form_templates');
     $current_group = '';
     $out = '';
     $_groups = array();
     foreach ($rows as $myrow) {
         if ($myrow['eval'] != '' && $myrow['the_name'] != 'detect_lang_forum') {
             if (defined('HIPHOP_PHP')) {
                 require_code('hooks/systems/config_default/' . $myrow['the_name']);
                 $hook = object_factory('Hook_config_default_' . $myrow['the_name']);
                 if (is_null($hook->get_default())) {
                     continue;
                 }
             } else {
                 $GLOBALS['REQUIRE_LANG_LOOP'] = 10;
                 // LEGACY Workaround for corrupt webhost installers
                 if (is_null(@eval($myrow['eval'] . ';'))) {
                     continue;
                 }
                 // @'d in case default is corrupt, don't want it to give errors forever
                 $GLOBALS['REQUIRE_LANG_LOOP'] = 0;
                 // LEGACY
             }
         }
         $_group = do_lang($myrow['section'], NULL, NULL, NULL, NULL, false);
         $name = do_lang($myrow['human_name'], NULL, NULL, NULL, NULL, false);
         $_group_tempcode = is_null($_group) ? make_string_tempcode($myrow['section']) : do_lang_tempcode($myrow['section']);
         $name_tempcode = is_null($name) ? make_string_tempcode($myrow['human_name']) : do_lang_tempcode($myrow['human_name']);
         if (get_forum_type() == 'ocf' && $myrow['explanation'] == 'CONFIG_OPTION_forum_in_portal') {
             $exp_string = $myrow['explanation'] . '__ocf';
         } else {
             $exp_string = $myrow['explanation'];
         }
         $_explanation = do_lang($exp_string, NULL, NULL, NULL, NULL, false);
         if (is_null($_explanation)) {
             $_explanation = do_lang('CONFIG_GROUP_DEFAULT_DESCRIP_' . $myrow['section'], NULL, NULL, NULL, NULL, false);
             if (is_null($_explanation)) {
                 $explanation = new ocp_tempcode();
             } else {
                 $explanation = do_lang_tempcode('CONFIG_GROUP_DEFAULT_DESCRIP_' . $myrow['section']);
             }
         } else {
             $explanation = do_lang_tempcode($exp_string);
         }
         if ($myrow['shared_hosting_restricted'] == 1 && !is_null($GLOBALS['CURRENT_SHARE_USER'])) {
             continue;
         }
         if ($myrow['section'] != $current_group && $current_group != '') {
             $_current_group = do_lang_tempcode($current_group);
             $_group_description = do_lang('CONFIG_GROUP_DESCRIP_' . $current_group, escape_html($post_max_size), escape_html($upload_max_filesize), NULL, NULL, false);
             if (is_null($_group_description)) {
                 $group_description = new ocp_tempcode();
             } else {
                 $group_description = do_lang_tempcode('CONFIG_GROUP_DESCRIP_' . $current_group, escape_html($post_max_size), escape_html($upload_max_filesize));
             }
             $group = do_template('CONFIG_GROUP', array('_GUID' => 'af4c31daa1bc39714ab83b11bd6d3e51', 'GROUP_DESCRIPTION' => $group_description, 'GROUP_NAME' => $current_group, 'GROUP' => $out, 'CURRENT_GROUP' => $_current_group));
             $groups->attach($group->evaluate());
             $out = '';
         }
         $_groups[$myrow['section']] = $_group_tempcode;
         switch ($myrow['the_type']) {
             case 'special':
                 switch ($myrow['the_name']) {
                     case 'timezone':
                         $list = '';
                         $timezone = get_site_timezone();
                         foreach (get_timezone_list() as $_timezone => $timezone_nice) {
                             $list .= static_evaluate_tempcode(form_input_list_entry($_timezone, $_timezone == $timezone, $timezone_nice));
                         }
                         $out .= static_evaluate_tempcode(form_input_list(do_lang_tempcode('TIME_ZONE'), do_lang_tempcode('DESCRIPTION_TIMEZONE_SITE'), 'timezone', make_string_tempcode($list)));
                         break;
                     default:
                         require_code('hooks/modules/admin_config/' . filter_naughty_harsh($myrow['the_name']));
                         $hook_ob = object_factory('Hook_admin_config_' . filter_naughty_harsh($myrow['the_name']));
                         $out .= static_evaluate_tempcode($hook_ob->run($myrow));
                         break;
                 }
                 break;
             case 'integer':
                 $out .= static_evaluate_tempcode(form_input_integer($name_tempcode, $explanation, $myrow['the_name'], intval(get_option($myrow['the_name'])), false));
                 break;
             case 'line':
                 if (strpos($myrow['the_name'], 'colour') !== false && substr(get_option($myrow['the_name']), 0, 1) == '#') {
                     $out .= static_evaluate_tempcode(form_input_colour($name_tempcode, $explanation, $myrow['the_name'], get_option($myrow['the_name']), false, NULL, true));
                 } elseif ($myrow['the_name'] == 'currency') {
                     $list = '';
                     require_code('currency');
                     $currencies = array_keys(get_currency_map());
                     foreach ($currencies as $currency) {
                         $list .= static_evaluate_tempcode(form_input_list_entry($currency, $currency == get_option($myrow['the_name'])));
                     }
                     $out .= static_evaluate_tempcode(form_input_list($name_tempcode, $explanation, $myrow['the_name'], make_string_tempcode($list)));
                 } elseif ($myrow['the_name'] == 'payment_gateway') {
                     $list = '';
                     $all_via = find_all_hooks('systems', 'ecommerce_via');
                     foreach (array_keys($all_via) as $via) {
                         $list .= static_evaluate_tempcode(form_input_list_entry($via, $via == get_option($myrow['the_name'])));
                     }
                     $out .= static_evaluate_tempcode(form_input_list($name_tempcode, $explanation, $myrow['the_name'], make_string_tempcode($list)));
                 } else {
                     /*if (strpos($myrow['the_name'],'password')!==false)  password fields can't take defaults
                     			$out.=static_evaluate_tempcode(form_input_password($name_tempcode,$explanation,$myrow['the_name'],get_option($myrow['the_name']),false));
                     		else
                     			*/
                     $out .= static_evaluate_tempcode(form_input_line($name_tempcode, $explanation, $myrow['the_name'], get_option($myrow['the_name']), false));
                 }
                 break;
             case 'list':
                 $list = '';
                 $_value = get_option($myrow['the_name']);
                 $values = explode('|', $myrow['c_data']);
                 foreach ($values as $value) {
                     $_option_text = do_lang('CONFIG_OPTION_' . $myrow['the_name'] . '_VALUE_' . $value, NULL, NULL, NULL, NULL, false);
                     if (!is_null($_option_text)) {
                         $option_text = do_lang_tempcode('CONFIG_OPTION_' . $myrow['the_name'] . '_VALUE_' . $value);
                     } else {
                         $option_text = make_string_tempcode($value);
                     }
                     $list .= static_evaluate_tempcode(form_input_list_entry($value, $_value == $value, $option_text));
                 }
                 $out .= static_evaluate_tempcode(form_input_list($name_tempcode, $explanation, $myrow['the_name'], make_string_tempcode($list), NULL, false, false));
                 break;
             case 'transline':
                 $out .= static_evaluate_tempcode(form_input_line($name_tempcode, $explanation, $myrow['the_name'], get_option($myrow['the_name']), false));
                 break;
             case 'text':
                 $out .= static_evaluate_tempcode(form_input_text($name_tempcode, $explanation, $myrow['the_name'], get_option($myrow['the_name']), false, NULL, true));
                 break;
             case 'transtext':
                 $out .= static_evaluate_tempcode(form_input_text($name_tempcode, $explanation, $myrow['the_name'], get_option($myrow['the_name']), false, NULL, true));
                 break;
             case 'float':
                 $out .= static_evaluate_tempcode(form_input_float($name_tempcode, $explanation, $myrow['the_name'], floatval(get_option($myrow['the_name'])), false));
                 break;
             case 'tick':
                 $out .= static_evaluate_tempcode(form_input_tick($name_tempcode, $explanation, $myrow['the_name'], get_option($myrow['the_name']) == '1'));
                 break;
             case 'date':
                 $out .= static_evaluate_tempcode(form_input_date($name_tempcode, $explanation, $myrow['the_name'], false, false, false, intval(get_option($myrow['the_name'])), 40, intval(date('Y')) - 20, NULL, false));
                 break;
             case 'forum':
             case '?forum':
                 if (get_forum_type() == 'ocf' && addon_installed('ocf_forum')) {
                     $current_setting = get_option($myrow['the_name']);
                     if (!is_numeric($current_setting)) {
                         $_current_setting = $GLOBALS['FORUM_DB']->query_value_null_ok('f_forums', 'id', array('f_name' => $current_setting));
                         if (is_null($_current_setting)) {
                             if ($myrow['the_type'] == '?forum') {
                                 $current_setting = NULL;
                             } else {
                                 $current_setting = strval(db_get_first_id());
                                 attach_message(do_lang_tempcode('FORUM_CURRENTLY_UNSET', $name_tempcode), 'notice');
                             }
                         } else {
                             $current_setting = strval($_current_setting);
                         }
                     }
                     $out .= static_evaluate_tempcode(form_input_tree_list($name_tempcode, $explanation, $myrow['the_name'], NULL, 'choose_forum', array(), false, $current_setting));
                 } else {
                     $out .= static_evaluate_tempcode(form_input_line($name_tempcode, $explanation, $myrow['the_name'], get_option($myrow['the_name']), false));
                 }
                 break;
             case 'category':
                 if (get_forum_type() == 'ocf') {
                     $tmp_value = $GLOBALS['FORUM_DB']->query_value_null_ok('f_categories', 'id', array('c_title' => get_option($myrow['the_name'])));
                     require_code('ocf_forums2');
                     $_list = ocf_nice_get_categories(NULL, $tmp_value);
                     $out .= static_evaluate_tempcode(form_input_list($name_tempcode, $explanation, $myrow['the_name'], $_list));
                 } else {
                     $out .= static_evaluate_tempcode(form_input_line($name_tempcode, $explanation, $myrow['the_name'], get_option($myrow['the_name']), false));
                 }
                 break;
             case 'usergroup':
                 if (get_forum_type() == 'ocf') {
                     $tmp_value = $GLOBALS['FORUM_DB']->query_value_null_ok('f_groups g LEFT JOIN ' . $GLOBALS['FORUM_DB']->get_table_prefix() . 'translate t ON t.id=g.g_name', 'g.id', array('text_original' => get_option($myrow['the_name'])));
                     require_code('ocf_groups');
                     $_list = ocf_nice_get_usergroups($tmp_value);
                     $out .= static_evaluate_tempcode(form_input_list($name_tempcode, $explanation, $myrow['the_name'], $_list));
                 } else {
                     $out .= static_evaluate_tempcode(form_input_line($name_tempcode, $explanation, $myrow['the_name'], get_option($myrow['the_name']), false));
                 }
                 break;
         }
         $current_group = $myrow['section'];
     }
     if ($out != '') {
         $_group_description = do_lang('CONFIG_GROUP_DESCRIP_' . $current_group, escape_html($post_max_size), escape_html($upload_max_filesize), NULL, NULL, false);
         if (is_null($_group_description)) {
             $group_description = new ocp_tempcode();
         } else {
             $group_description = do_lang_tempcode('CONFIG_GROUP_DESCRIP_' . $current_group, escape_html($post_max_size), escape_html($upload_max_filesize));
         }
         $group = do_template('CONFIG_GROUP', array('_GUID' => '84c0db86002a33a383a7c2e195dd3913', 'GROUP_DESCRIPTION' => $group_description, 'GROUP_NAME' => $current_group, 'GROUP' => $out, 'CURRENT_GROUP' => $_group_tempcode));
         $groups->attach($group->evaluate());
     }
     list($warning_details, $ping_url) = handle_conflict_resolution();
     breadcrumb_set_parents(array(array('_SELF:_SELF:misc', do_lang_tempcode('CONFIGURATION'))));
     breadcrumb_set_self(do_lang_tempcode('CONFIG_CATEGORY_' . $page));
     return do_template('CONFIG_CATEGORY_SCREEN', array('_GUID' => 'd01b28b71c38bbb52b6aaf877c7f7b0e', 'CATEGORY_DESCRIPTION' => $category_description, '_GROUPS' => $_groups, 'PING_URL' => $ping_url, 'WARNING_DETAILS' => $warning_details, 'TITLE' => $title, 'URL' => $post_url, 'GROUPS' => $groups, 'SUBMIT_NAME' => do_lang_tempcode('SAVE')));
 }
 function setting()
 {
     if (!has_supported_gd()) {
         $checked = 'checked="checked"';
         $disabled = 'disabled="true"';
     } else {
         $checked = '';
         $disabled = '';
     }
     $show_timezone = PHP_VERSION >= '5.1' ? 'yes' : 'no';
     $ui = !empty($_POST['user_interface']) ? $_POST['user_interface'] : "seevia";
     $ucapi = !empty($_POST['ucapi']) ? $_POST['ucapi'] : "seevia";
     $ucfounderpw = !empty($_POST['ucfounderpw']) ? $_POST['ucfounderpw'] : "seevia";
     $this->set('ucapi', $ucapi);
     $this->set('ucfounderpw', $ucfounderpw);
     $this->set('installer_lang', $this->installer_lang);
     $this->set('checked', $checked);
     $this->set('disabled', $disabled);
     $this->set('show_timezone', $show_timezone);
     $this->set('local_timezone', get_local_timezone());
     $this->set('timezones', get_timezone_list($this->installer_lang));
     $this->set('userinterface', $ui);
 }
示例#11
0
文件: index.php 项目: noikiy/mdwp
    else
    {
        $checked = '';
        $disabled = '';
    }

    $show_timezone = PHP_VERSION >= '5.1' ? 'yes' : 'no';
    $smarty->assign('ucapi', $_POST['ucapi']);
    $smarty->assign('ucfounderpw', $_POST['ucfounderpw']);
    $smarty->assign('installer_lang', $installer_lang);
    $smarty->assign('checked', $checked);
    $smarty->assign('disabled', $disabled);
    $smarty->assign('goods_types', $goods_types);
    $smarty->assign('show_timezone', $show_timezone);
    $smarty->assign('local_timezone', get_local_timezone());
    $smarty->assign('timezones', get_timezone_list($installer_lang));
    $smarty->assign('userinterface', empty($_GET['ui'])?'ecshop':$_GET['ui']);
    $smarty->display('setting.php');

    break;

case 'get_db_list' :
    $db_host    = isset($_POST['db_host']) ? trim($_POST['db_host']) : '';
    $db_port    = isset($_POST['db_port']) ? trim($_POST['db_port']) : '';
    $db_user    = isset($_POST['db_user']) ? trim($_POST['db_user']) : '';
    $db_pass    = isset($_POST['db_pass']) ? trim($_POST['db_pass']) : '';

    include_once(ROOT_PATH . 'includes/cls_json.php');
    $json = new JSON();

    $databases  = get_db_list($db_host, $db_port, $db_user, $db_pass);
示例#12
0
 } else {
     include_once ROOT_PATH . 'install/data/inc_goods_type_zh_cn.php';
 }
 $goods_types = array();
 foreach ($attributes as $key => $val) {
     $goods_types[$key] = $_LANG[$key];
 }
 if (!has_supported_gd()) {
     $checked = 'checked="checked"';
     $disabled = 'disabled="true"';
 } else {
     $checked = '';
     $disabled = '';
 }
 $show_timezone = PHP_VERSION >= '5.1' ? 'yes' : 'no';
 $timezones = get_timezone_list($installer_lang);
 $_SESSION['setting_ui']['ucapi'] = $_POST['ucapi'];
 $_SESSION['setting_ui']['ucfounderpw'] = $_POST['ucfounderpw'];
 $_SESSION['setting_ui']['installer_lang'] = $installer_lang;
 $_SESSION['setting_ui']['checked'] = $checked;
 $_SESSION['setting_ui']['disabled'] = $disabled;
 $_SESSION['setting_ui']['goods_types'] = $goods_types;
 $_SESSION['setting_ui']['show_timezone'] = $show_timezone;
 $_SESSION['setting_ui']['local_timezone'] = get_local_timezone();
 $_SESSION['setting_ui']['timezones'] = $timezones;
 $_SESSION['setting_ui']['userinterface'] = empty($_GET['ui']) ? 'ecshop' : $_GET['ui'];
 $smarty->assign('ucapi', $_POST['ucapi']);
 $smarty->assign('ucfounderpw', $_POST['ucfounderpw']);
 $smarty->assign('installer_lang', $installer_lang);
 $smarty->assign('checked', $checked);
 $smarty->assign('disabled', $disabled);
示例#13
0
 /**
  * Get the form fields for an event input form.
  *
  * @param  ?AUTO_LINK		The event type (NULL: default)
  * @param  ?integer			The year the event starts at (NULL: default)
  * @param  ?integer			The month the event starts at (NULL: default)
  * @param  ?integer			The day the event starts at (NULL: default)
  * @param  ?integer			The hour the event starts at (NULL: default)
  * @param  ?integer			The minute the event starts at (NULL: default)
  * @param  SHORT_TEXT		The title of the event
  * @param  LONG_TEXT			The full text describing the event
  * @param  SHORT_TEXT		The recurrence code
  * @param  ?integer			The number of recurrences (NULL: none/infinite)
  * @param  BINARY				Whether to segregate the comment-topics/rating/trackbacks per-recurrence
  * @param  BINARY				Whether it is a public event
  * @param  integer			The priority
  * @range  1 5
  * @param  ?integer			The year the event ends at (NULL: not a multi day event)
  * @param  ?integer			The month the event ends at (NULL: not a multi day event)
  * @param  ?integer			The day the event ends at (NULL: not a multi day event)
  * @param  ?integer			The hour the event ends at (NULL: not a multi day event)
  * @param  ?integer			The minute the event ends at (NULL: not a multi day event)
  * @param  ?ID_TEXT			The timezone for the event (NULL: current user's timezone)
  * @param  BINARY				Whether the time should be presented in the viewer's own timezone
  * @param  BINARY				Whether the event is validated
  * @param  ?BINARY			Whether rating is allowed (NULL: decide statistically, based on existing choices)
  * @param  ?SHORT_INTEGER	Whether comments are allowed (0=no, 1=yes, 2=review style) (NULL: decide statistically, based on existing choices)
  * @param  ?BINARY			Whether trackbacks are allowed (NULL: decide statistically, based on existing choices)
  * @param  LONG_TEXT			Notes
  * @return array				A tuple of: (fields, hidden-fields, delete-fields, edit-text, whether all delete fields are specified, posting form text, more fields)
  */
 function get_form_fields($type = NULL, $start_year = NULL, $start_month = NULL, $start_day = NULL, $start_hour = NULL, $start_minute = NULL, $title = '', $content = '', $recurrence = 'none', $recurrences = NULL, $seg_recurrences = 0, $is_public = 1, $priority = 3, $end_year = NULL, $end_month = NULL, $end_day = NULL, $end_hour = NULL, $end_minute = NULL, $timezone = NULL, $do_timezone_conv = 0, $validated = 1, $allow_rating = NULL, $allow_comments = NULL, $allow_trackbacks = NULL, $notes = '')
 {
     list($allow_rating, $allow_comments, $allow_trackbacks) = $this->choose_feedback_fields_statistically($allow_rating, $allow_comments, $allow_trackbacks);
     unset($content);
     if (is_null($timezone) || $timezone == '') {
         $timezone = get_users_timezone();
     }
     require_code('form_templates');
     if (is_null($type)) {
         global $NON_CANONICAL_PARAMS;
         $NON_CANONICAL_PARAMS[] = 'date';
         $NON_CANONICAL_PARAMS[] = 'e_type';
         $NON_CANONICAL_PARAMS[] = 'validated';
         $date = get_param('date', '');
         $start_hour = NULL;
         $start_minute = NULL;
         if ($date != '') {
             $date2 = explode(' ', $date);
             $exploded = explode('-', $date2[0]);
             //if (count($exploded)!=3) warn_exit(do_lang_tempcode('INTERNAL_ERROR'));
             $start_year = intval($exploded[0]);
             $start_month = intval($exploded[1]);
             $start_day = intval($exploded[2]);
             if (array_key_exists(1, $date2)) {
                 $exploded = explode(':', $date2[1]);
                 //if (count($exploded)!=2) warn_exit(do_lang_tempcode('INTERNAL_ERROR'));
                 $start_hour = intval($exploded[0]);
                 $start_minute = intval($exploded[1]);
             }
         } else {
             list($start_year, $start_month, $start_day) = array(NULL, NULL, NULL);
         }
         $type = get_param_integer('e_type', -1);
         if ($type == -1) {
             $type = NULL;
         }
         $adding = true;
     } else {
         $adding = false;
     }
     if (is_null($type)) {
         $type = db_get_first_id() + 1;
     }
     if (is_null($start_month)) {
         $start_year = intval(date('Y'));
         $start_month = intval(date('m'));
         $start_day = intval(date('d'));
         $start_hour = NULL;
         $start_minute = NULL;
     }
     if ((is_null($end_year) || is_null($end_month) || is_null($end_day)) && $adding) {
         $end_year = NULL;
         //$start_year;
         $end_month = NULL;
         //$start_month;
         $end_day = NULL;
         //$start_day;
         $end_hour = NULL;
         $end_minute = NULL;
     }
     $fields = new ocp_tempcode();
     $hidden = new ocp_tempcode();
     $fields->attach(form_input_line(do_lang_tempcode('TITLE'), do_lang_tempcode('DESCRIPTION_TITLE'), 'title', $title, true));
     //$fields->attach(form_input_text_comcode(do_lang_tempcode('EVENT_TEXT'),do_lang_tempcode('DESCRIPTION_EVENT_TEXT'),'content',$content,false));
     // Type
     $type_list = nice_get_event_types($type);
     $fields->attach(form_input_list(do_lang_tempcode('TYPE'), do_lang_tempcode('DESCRIPTION_EVENT_TYPE'), 'type', $type_list));
     // Dates
     $fields->attach(form_input_tick(do_lang_tempcode('ALL_DAY_EVENT'), do_lang_tempcode('DESCRIPTION_ALL_DAY_EVENT'), 'all_day_event', is_null($start_hour)));
     $fields->attach(form_input_date(do_lang_tempcode('DATE_TIME'), '', 'start', false, false, true, array(is_null($start_minute) ? find_timezone_start_minute_in_utc($timezone, $start_year, $start_month, $start_day) : $start_minute, is_null($start_hour) ? find_timezone_start_hour_in_utc($timezone, $start_year, $start_month, $start_day) : $start_hour, $start_month, $start_day, $start_year), 120, intval(date('Y')) - 100, NULL, NULL, true, $timezone, get_param('date', '') == ''));
     $fields->attach(form_input_date(do_lang_tempcode('END_DATE_AND_TIME'), do_lang_tempcode('DESCRIPTION_END_DATE_AND_TIME'), 'end', true, is_null($end_year), true, array(is_null($end_minute) ? find_timezone_end_minute_in_utc($timezone, $end_year, $end_month, $end_day) : $end_minute, is_null($end_hour) ? find_timezone_end_hour_in_utc($timezone, $end_year, $end_month, $end_day) : $end_hour, $end_month, $end_day, $end_year), 120, intval(date('Y')) - 100, NULL, NULL, true, $timezone));
     if ($validated == 0) {
         $validated = get_param_integer('validated', 0);
     }
     if (has_some_cat_specific_permission(get_member(), 'bypass_validation_' . $this->permissions_require . 'range_content', NULL, $this->permissions_cat_require)) {
         if (addon_installed('unvalidated')) {
             $fields->attach(form_input_tick(do_lang_tempcode('VALIDATED'), do_lang_tempcode('DESCRIPTION_VALIDATED'), 'validated', $validated == 1));
         }
     }
     $fields2 = new ocp_tempcode();
     $fields2->attach(do_template('FORM_SCREEN_FIELD_SPACER', array('SECTION_HIDDEN' => true, 'TITLE' => do_lang_tempcode('ADVANCED'))));
     // More date stuff
     $list = '';
     foreach (get_timezone_list() as $_timezone => $timezone_nice) {
         $list .= static_evaluate_tempcode(form_input_list_entry($_timezone, $_timezone == $timezone, $timezone_nice));
     }
     $fields2->attach(form_input_list(do_lang_tempcode('EVENT_TIMEZONE'), do_lang_tempcode('DESCRIPTION_EVENT_TIMEZONE'), 'timezone', make_string_tempcode($list)));
     $fields2->attach(form_input_tick(do_lang_tempcode('DO_TIMEZONE_CONV'), do_lang_tempcode('DESCRIPTION_DO_TIMEZONE_CONV'), 'do_timezone_conv', $do_timezone_conv == 1));
     if (has_specific_permission(get_member(), 'add_public_events')) {
         $fields2->attach(form_input_tick(do_lang_tempcode('IS_PUBLIC'), do_lang_tempcode('DESCRIPTION_IS_PUBLIC'), 'is_public', $is_public == 1));
     }
     // Priority
     $priority_list = new ocp_tempcode();
     $priority_list->attach(form_input_list_entry('1', $priority == 1, do_lang_tempcode('PRIORITY_1')));
     $priority_list->attach(form_input_list_entry('2', $priority == 2, do_lang_tempcode('PRIORITY_2')));
     $priority_list->attach(form_input_list_entry('3', $priority == 3, do_lang_tempcode('PRIORITY_3')));
     $priority_list->attach(form_input_list_entry('4', $priority == 4, do_lang_tempcode('PRIORITY_4')));
     $priority_list->attach(form_input_list_entry('5', $priority == 5, do_lang_tempcode('PRIORITY_5')));
     $fields2->attach(form_input_list(do_lang_tempcode('PRIORITY'), '', 'priority', $priority_list));
     // Recurrence
     $fields2->attach(do_template('FORM_SCREEN_FIELD_SPACER', array('SECTION_HIDDEN' => true, 'TITLE' => do_lang_tempcode('RECURRENCE'))));
     if (strpos($recurrence, ' ') === false) {
         $recurrence_main = $recurrence;
         $recurrence_pattern = '';
     } else {
         list($recurrence_main, $recurrence_pattern) = explode(' ', $recurrence);
     }
     $radios = form_input_radio_entry('recurrence', 'none', true, do_lang_tempcode('NA_EM'));
     $radios->attach(form_input_radio_entry('recurrence', 'daily', $recurrence_main == 'daily', do_lang_tempcode('DAILY')));
     $radios->attach(form_input_radio_entry('recurrence', 'weekly', $recurrence_main == 'weekly', do_lang_tempcode('WEEKLY')));
     $radios->attach(form_input_radio_entry('recurrence', 'monthly', $recurrence_main == 'monthly', do_lang_tempcode('MONTHLY')));
     $radios->attach(form_input_radio_entry('recurrence', 'yearly', $recurrence_main == 'yearly', do_lang_tempcode('YEARLY')));
     $fields2->attach(form_input_radio(do_lang_tempcode('RECURRENCE'), do_lang_tempcode('DESCRIPTION_RECURRENCE'), 'recurrence', $radios));
     // xth_dotw_of_monthly
     $fields2->attach(form_input_line(do_lang_tempcode('RECURRENCE_PATTERN'), do_lang_tempcode('DESCRIPTION_RECURRENCE_PATTERN'), 'recurrence_pattern', $recurrence_pattern, false));
     $fields2->attach(form_input_integer(do_lang_tempcode('RECURRENCES'), do_lang_tempcode('DESCRIPTION_RECURRENCES'), 'recurrences', $recurrences, false));
     $fields2->attach(form_input_tick(do_lang_tempcode('SEG_RECURRENCES'), do_lang_tempcode('DESCRIPTION_SEG_RECURRENCES'), 'seg_recurrences', $seg_recurrences == 1));
     if ($adding && cron_installed()) {
         $fields2->attach(do_template('FORM_SCREEN_FIELD_SPACER', array('SECTION_HIDDEN' => true, 'TITLE' => do_lang_tempcode('REMINDERS'))));
         $fields2->attach(form_input_tick(do_lang_tempcode('SIGN_UP_REMINDER'), do_lang_tempcode('DESCRIPTION_SIGN_UP_REMINDER'), 'sign_up_reminder', true));
         if (has_specific_permission(get_member(), 'add_public_events')) {
             $usergroup_list = $GLOBALS['FORUM_DRIVER']->get_usergroup_list(true);
             if (get_forum_type() == 'ocf') {
                 unset($usergroup_list[db_get_first_id()]);
             }
             $t_usergroup_list = new ocp_tempcode();
             foreach ($usergroup_list as $id => $name) {
                 $t_usergroup_list->attach(form_input_list_entry(strval($id), false, $name));
             }
             $fields2->attach(form_input_all_and_not(do_lang_tempcode('SIGN_UP_REMINDER_GROUPS'), do_lang_tempcode('DESCRIPTION_SIGN_UP_REMINDER_GROUPS'), 'sign_up_reminder_groups', $t_usergroup_list));
         }
         $fields2->attach(form_input_float(do_lang_tempcode('REMINDER_TIME'), do_lang_tempcode('DESCRIPTION_REMINDER_TIME'), 'hours_before', 1.0, true));
     }
     require_code('feedback2');
     $fields2->attach(feedback_fields($allow_rating == 1, $allow_comments == 1, $allow_trackbacks == 1, false, $notes, $allow_comments == 2));
     $fields2->attach(get_syndication_option_fields());
     return array($fields, $hidden, NULL, NULL, true, NULL, $fields2);
 }
示例#14
0
function init_config_options()
{
    $languages = array("" => __("Default"));
    foreach (get_languages() as $language) {
        $languages[$language] = $language;
    }
    // name, text, type, value(s)
    return array(array('week_start', __('Week Start'), PHPC_DROPDOWN, array(0 => __('Sunday'), 1 => __('Monday'), 6 => __('Saturday')), 0), array('hours_24', __('24 Hour Time'), PHPC_CHECK), array('title', __('Calendar Title'), PHPC_TEXT), array('subject_max', __('Maximum Subject Length'), PHPC_TEXT, 50), array('events_max', __('Events Display Daily Maximum'), PHPC_TEXT, 8), array('anon_permission', __('Public Permissions'), PHPC_DROPDOWN, array(__('Cannot read nor write events'), __('Can read but not write events'), __('Can create but not modify events'), __('Can create and modify events'))), array('timezone', __('Default Timezone'), PHPC_MULTI_DROPDOWN, get_timezone_list()), array('language', __('Default Language'), PHPC_DROPDOWN, $languages), array('date_format', __('Date Format'), PHPC_DROPDOWN, get_date_format_list()), array('theme', __('Theme'), PHPC_DROPDOWN, get_theme_list()));
}
示例#15
0
 /**
  * View an event.
  *
  * @return tempcode		The UI
  */
 function view_event()
 {
     check_specific_permission('view_calendar');
     global $NON_CANONICAL_PARAMS;
     $NON_CANONICAL_PARAMS[] = 'back';
     $id = get_param_integer('id');
     $filter = $this->get_filter();
     $GLOBALS['FEED_URL'] = find_script('backend') . '?mode=calendar&filter=' . implode(',', $this->get_and_filter());
     $rows = $GLOBALS['SITE_DB']->query_select('calendar_events e LEFT JOIN ' . $GLOBALS['SITE_DB']->get_table_prefix() . 'calendar_types t ON t.id=e.e_type', array('*'), array('e.id' => $id), '', 1);
     if (!array_key_exists(0, $rows)) {
         warn_exit(do_lang_tempcode('MISSING_RESOURCE'));
     }
     $event = $rows[0];
     if ($event['e_is_public'] == 0) {
         enforce_personal_access($event['e_submitter'], 'view_personal_events');
     }
     if (!has_category_access(get_member(), 'calendar', strval($event['e_type']))) {
         access_denied('CATEGORY_ACCESS');
     }
     // Validation
     $warning_details = new ocp_tempcode();
     if ($event['validated'] == 0 && $event['e_is_public'] == 1) {
         if (!has_specific_permission(get_member(), 'jump_to_unvalidated')) {
             access_denied('SPECIFIC_PERMISSION', 'jump_to_unvalidated');
         }
         $warning_details->attach(do_template('WARNING_TABLE', array('_GUID' => '332faacba974e648a67e5e91ffd3d8e5', 'WARNING' => do_lang_tempcode(get_param_integer('redirected', 0) == 1 ? 'UNVALIDATED_TEXT_NON_DIRECT' : 'UNVALIDATED_TEXT'))));
     }
     if (addon_installed('awards')) {
         require_code('awards');
         $awards = find_awards_for('event', strval($id));
     } else {
         $awards = array();
     }
     $_title = get_translated_text($event['e_title']);
     $title_to_use = do_lang_tempcode('CALENDAR_EVENT_VCAL', escape_html($_title));
     $title_to_use_2 = do_lang('CALENDAR_EVENT', $_title);
     $title = get_page_title($title_to_use, false, NULL, NULL, $awards);
     seo_meta_load_for('event', strval($id), $title_to_use_2);
     $content = $event['e_type'] == db_get_first_id() ? make_string_tempcode(get_translated_text($event['e_content'])) : get_translated_tempcode($event['e_content']);
     $type = get_translated_text($event['t_title']);
     $subscribed = new ocp_tempcode();
     if (has_specific_permission(get_member(), 'view_event_subscriptions') && cron_installed()) {
         $subscriptions = $GLOBALS['SITE_DB']->query_select('calendar_reminders', array('DISTINCT n_member_id'), array('e_id' => $id), '', 100);
         if (count($subscriptions) < 100) {
             foreach ($subscriptions as $subscription) {
                 $username = $GLOBALS['FORUM_DRIVER']->get_username($subscription['n_member_id']);
                 if (!is_null($username)) {
                     $member_url = $GLOBALS['FORUM_DRIVER']->member_profile_url($subscription['n_member_id'], false, true);
                     $subscribed->attach(do_template('CALENDAR_SCREEN_SUBSCRIPTION', array('_GUID' => 'c756b8b3f0c57494fd46a94e9abce029', 'MEMBER_URL' => $member_url, 'USERNAME' => $username)));
                 }
             }
         }
     }
     $__first_date = mktime($event['e_start_hour'], $event['e_start_minute'], 0, $event['e_start_month'], $event['e_start_day'], $event['e_start_year']);
     $_first_date = cal_utctime_to_usertime($__first_date, $event['e_timezone'], $event['e_do_timezone_conv'] == 1);
     $first_date = date('Y-m-d', $_first_date);
     $date = get_param('date', $first_date);
     // It's year 10,000 compliant when it comes to year display ;).
     $back_type = get_param('back', 'day');
     $map = array_merge($filter, array('page' => '_SELF', 'type' => 'misc', 'view' => $back_type, 'id' => $date));
     if (get_param_integer('member_id', get_member()) != get_member()) {
         $map['member_id'] = get_param_integer('member_id');
     }
     $back_url = build_url($map, '_SELF');
     list($rating_details, $comment_details, $trackback_details) = embed_feedback_systems('events', strval($id) . ($event['e_seg_recurrences'] == 1 ? '_' . $date : ''), $event['allow_rating'], $event['allow_comments'], $event['allow_trackbacks'], get_option('is_on_strong_forum_tie') == '0' || $event['e_is_public'] == 1 ? 1 : 0, $event['e_submitter'], build_url(array('page' => '_SELF', 'type' => 'view', 'id' => $id), '_SELF', NULL, false, false, true), $_title, get_value('comment_forum__calendar'));
     $_subscriptions = new ocp_tempcode();
     if (is_guest() || !cron_installed()) {
         $subscribe_url = new ocp_tempcode();
     } else {
         $subscriptions = $GLOBALS['SITE_DB']->query_select('calendar_reminders', array('id', 'n_seconds_before'), array('e_id' => $id, 'n_member_id' => get_member()));
         foreach ($subscriptions as $subscription) {
             $time = display_time_period(intval($subscription['n_seconds_before']));
             $unsubscribe_url = build_url(array('page' => '_SELF', 'type' => 'unsubscribe_event', 'id' => $id, 'reminder_id' => $subscription['id']), '_SELF');
             $_subscriptions->attach(do_template('CALENDAR_SCREEN_PERSONAL_SUBSCRIPTION', array('_GUID' => 'cc36c75ea516abfab1c65328c0e290fc', 'UNSUBSCRIBE_URL' => $unsubscribe_url, 'TIME' => $time)));
         }
         $subscribe_url = build_url(array('page' => '_SELF', 'type' => 'subscribe_event', 'id' => $id), '_SELF');
     }
     if (has_actual_page_access(NULL, 'cms_calendar', NULL, NULL) && has_edit_permission($event['e_is_public'] == 0 ? 'low' : 'mid', get_member(), $event['e_submitter'], 'cms_calendar', array('calendar', $event['e_type']))) {
         $edit_url = build_url(array('page' => 'cms_calendar', 'type' => '_ed', 'id' => $id), get_module_zone('cms_calendar'));
     } else {
         $edit_url = new ocp_tempcode();
     }
     if ($event['e_seg_recurrences'] == 0) {
         $NON_CANONICAL_PARAMS[] = 'day';
         $NON_CANONICAL_PARAMS[] = 'date';
     }
     $day = get_param('day', '');
     if ($day != '') {
         $explode = explode('-', $day);
         if (count($explode) == 3) {
             if (is_null($event['e_start_hour'])) {
                 if (is_null($event['e_end_year']) || is_null($event['e_end_month']) || is_null($event['e_end_day'])) {
                     $event['e_end_day'] = $event['e_start_day'];
                     $event['e_end_month'] = $event['e_start_month'];
                     $event['e_end_year'] = $event['e_start_year'];
                 }
             }
             if (!is_null($event['e_end_year']) && !is_null($event['e_end_month']) && !is_null($event['e_end_day'])) {
                 $event['e_end_year'] += intval($explode[0]) - $event['e_start_year'];
                 $event['e_end_month'] += intval($explode[1]) - $event['e_start_month'];
                 $event['e_end_day'] += intval($explode[2]) - $event['e_start_day'];
             }
             $event['e_start_year'] = intval($explode[0]);
             $event['e_start_month'] = intval($explode[1]);
             $event['e_start_day'] = intval($explode[2]);
         }
     }
     $time_raw = cal_get_start_utctime_for_event($event['e_timezone'], $event['e_start_year'], $event['e_start_month'], $event['e_start_day'], $event['e_start_hour'], $event['e_start_minute'], $event['e_do_timezone_conv'] == 1);
     $from = cal_utctime_to_usertime($time_raw, $event['e_timezone'], $event['e_do_timezone_conv'] == 1);
     $day_formatted = locale_filter(date(do_lang('calendar_date'), $from));
     if (!is_null($event['e_end_year']) && !is_null($event['e_end_month']) && !is_null($event['e_end_day'])) {
         $to_raw = cal_get_end_utctime_for_event($event['e_timezone'], $event['e_end_year'], $event['e_end_month'], $event['e_end_day'], $event['e_end_hour'], $event['e_end_minute'], $event['e_do_timezone_conv'] == 1);
         $to = cal_utctime_to_usertime($to_raw, $event['e_timezone'], $event['e_do_timezone_conv'] == 1);
         $to_day_formatted = locale_filter(date(do_lang('calendar_date'), $to));
         $time2 = date_range($from, $to, !is_null($event['e_start_hour']));
     } else {
         $to_raw = NULL;
         $time2 = is_null($event['e_start_hour']) ? '' : locale_filter(my_strftime(do_lang('calendar_minute'), $from));
         $to = NULL;
         $to_day_formatted = NULL;
     }
     $priority = $event['e_priority'];
     $is_public = $event['e_is_public'] == 1 ? do_lang_tempcode('YES') : do_lang_tempcode('NO');
     $recurrence = do_lang_tempcode('NA_EM');
     if ($event['e_recurrence'] != 'none' && $event['e_recurrence'] != '') {
         $l_code = explode(' ', strtoupper($event['e_recurrence']));
         $recurrence = do_lang_tempcode($l_code[0]);
         if (!is_null($event['e_recurrences'])) {
             $recurrence = do_lang_tempcode('RECURRENCE_ITERATION', $recurrence, make_string_tempcode(integer_format($event['e_recurrences'])));
         }
     } elseif ($day == '') {
         $day = $first_date;
     }
     $priority_lang = do_lang_tempcode('PRIORITY_' . strval($priority));
     // Views
     if (get_db_type() != 'xml') {
         $event['e_views']++;
         $GLOBALS['SITE_DB']->query_update('calendar_events', array('e_views' => $event['e_views']), array('id' => $id), '', 1, NULL, false, true);
     }
     breadcrumb_set_parents(array(array($back_url, do_lang_tempcode('CALENDAR'))));
     $GLOBALS['META_DATA'] += array('created' => date('Y-m-d', $event['e_add_date']), 'creator' => $GLOBALS['FORUM_DRIVER']->get_username($event['e_submitter']), 'publisher' => '', 'modified' => is_null($event['e_edit_date']) ? '' : date('Y-m-d', $event['e_edit_date']), 'type' => 'Calendar event', 'title' => get_translated_text($event['e_title']), 'identifier' => '_SEARCH:calendar:view:' . strval($id), 'description' => get_translated_text($event['e_content']), 'image' => find_theme_image('bigicons/calendar'));
     $map = array('TITLE' => $title, '_TITLE' => get_translated_text($event['e_title']), 'ID' => strval($id), 'TAGS' => get_loaded_tags('calendar'), 'WARNING_DETAILS' => $warning_details, 'SUBMITTER' => strval($event['e_submitter']), 'ADD_DATE' => get_timezoned_date($event['e_add_date']), 'ADD_DATE_RAW' => strval($event['e_add_date']), 'EDIT_DATE_RAW' => is_null($event['e_edit_date']) ? '' : strval($event['e_edit_date']), 'VIEWS' => integer_format($event['e_views']), 'LOGO' => $event['t_logo'], 'DAY' => $day_formatted, 'TO_DAY' => $to_day_formatted, 'RECURRENCE' => $recurrence, 'IS_PUBLIC' => $is_public, 'PRIORITY' => strval($priority), 'PRIORITY_LANG' => $priority_lang, 'TYPE' => $type, 'TIME' => $time2, 'TIME_RAW' => strval($time_raw), 'TIME_VCAL' => date('Y-m-d', $time_raw) . ' ' . date('H:i:s', $time_raw), 'TO_TIME_VCAL' => is_null($to_raw) ? NULL : date('Y-m-d', $to_raw) . ' ' . date('H:i:s', $to_raw), 'EDIT_URL' => $edit_url, 'SUBSCRIPTIONS' => $_subscriptions, 'SUBSCRIBE_URL' => $subscribe_url, 'BACK_URL' => $back_url, 'CONTENT' => $content, 'SUBSCRIBED' => $subscribed, 'RATING_DETAILS' => $rating_details, 'TRACKBACK_DETAILS' => $trackback_details, 'COMMENT_DETAILS' => $comment_details, '_GUID' => '602e6f86f586ef0a24efed950eafd426');
     if ($event['e_do_timezone_conv'] == 0) {
         $timezone_map = get_timezone_list();
         $map['TIMEZONE'] = $timezone_map[$event['e_timezone']];
     }
     return do_template('CALENDAR_SCREEN', $map);
 }
示例#16
0
/**
 * Remove an item from the general cache (most commonly used for blocks).
 *
 * @param  ID_TEXT		The type of what we are cacheing (e.g. block name)
 * @param  ?array			A map of identifiying characteristics (NULL: no identifying characteristics, decache all)
 */
function decache($cached_for, $identifier = NULL)
{
    if (running_script('stress_test_loader')) {
        return;
    }
    if (get_page_name() == 'admin_import') {
        return;
    }
    // NB: If we use persistant cache we still need to decache from DB, in case we're switching between for whatever reason. Or maybe some users use persistant cache and others don't. Or maybe some nodes do and others don't.
    if ($GLOBALS['MEM_CACHE'] !== NULL) {
        persistant_cache_delete(array('CACHE', $cached_for));
    }
    $where = db_string_equal_to('cached_for', $cached_for);
    if ($identifier !== NULL) {
        $where .= ' AND (';
        $done_first = false;
        // For combinations of implied parameters
        $bot_statuses = array(true, false);
        $timezones = array_keys(get_timezone_list());
        foreach ($bot_statuses as $bot_status) {
            foreach ($timezones as $timezone) {
                $_cache_identifier = $identifier;
                $_cache_identifier[] = $timezone;
                $_cache_identifier[] = $bot_status;
                global $TEMPCODE_SETGET;
                $_cache_identifier[] = isset($TEMPCODE_SETGET['in_panel']) ? $TEMPCODE_SETGET['in_panel'] : '0';
                $_cache_identifier[] = isset($TEMPCODE_SETGET['interlock']) ? $TEMPCODE_SETGET['interlock'] : '0';
                if ($done_first) {
                    $where .= ' OR ';
                }
                $where .= db_string_equal_to('identifier', md5(serialize($_cache_identifier)));
                $done_first = true;
            }
        }
        // And finally for no implied parameters (raw API usage)
        $_cache_identifier = $identifier;
        if ($done_first) {
            $where .= ' OR ';
        }
        $where .= db_string_equal_to('identifier', md5(serialize($_cache_identifier)));
        $done_first = true;
        $where .= ')';
    }
    $GLOBALS['SITE_DB']->query('DELETE FROM ' . get_table_prefix() . 'cache WHERE ' . $where);
}
示例#17
0
/**
 * Turn a boring timezone name into the pretty shortened list of ones Microsoft uses and others now use too.
 *
 * @param  string			Boring name
 * @return string			Nice name
 */
function make_nice_timezone_name($in)
{
    $list = get_timezone_list();
    if (array_key_exists($in, $list)) {
        return $list[$in];
    }
    return $in;
}