示例#1
0
} else {
    $root = "../";
    $level = 1;
    while ($level < 10 && !file_exists($root . '/framework/class.secure.php')) {
        $root .= "../";
        $level += 1;
    }
    if (file_exists($root . '/framework/class.secure.php')) {
        include $root . '/framework/class.secure.php';
    } else {
        trigger_error(sprintf("[ <b>%s</b> ] Can't include class.secure.php!", $_SERVER['SCRIPT_NAME']), E_USER_ERROR);
    }
}
// Define that this file is loaded
if (!defined('TIME_FORMATS_LOADED')) {
    define('TIME_FORMATS_LOADED', true);
}
// Create array
$TIME_FORMATS = CAT_Helper_DateTime::getTimeFormats();
// Get the current time (in the users timezone if required)
$actual_time = time();
// Add "System Default" to list (if we need to)
if (isset($user_time) and $user_time == true) {
    if (isset($TEXT['SYSTEM_DEFAULT'])) {
        $TIME_FORMATS['system_default'] = date(DEFAULT_TIME_FORMAT, $actual_time) . ' (' . $TEXT['SYSTEM_DEFAULT'] . ')';
    } else {
        $TIME_FORMATS['system_default'] = date(DEFAULT_TIME_FORMAT, $actual_time) . ' (System Default)';
    }
}
// Reverse array so "System Default" is at the top
$TIME_FORMATS = array_reverse($TIME_FORMATS, true);
示例#2
0
            }
        } else {
            $_SESSION['USE_DEFAULT_TIME_FORMAT'] = true;
            unset($_SESSION['CAT_TIME_FORMAT']);
        }
        if ($_SESSION['CAT_DATE_FORMAT'] != '') {
            if (isset($_SESSION['USE_DEFAULT_DATE_FORMAT'])) {
                unset($_SESSION['USE_DEFAULT_DATE_FORMAT']);
            }
        } else {
            $_SESSION['USE_DEFAULT_DATE_FORMAT'] = true;
            unset($_SESSION['CAT_DATE_FORMAT']);
        }
    }
    if (count($errors) > 0) {
        $message = implode("<br />", $errors);
    } else {
        $message = $user->lang()->translate('Details saved successfully') . "!<br /><br />";
        $show_form = false;
    }
}
unset($submit_ok);
// get available languages, mark currently used
$languages = CAT_Helper_Addons::get_addons(isset($language) && $language !== LANGUAGE ? $language : LANGUAGE, 'language');
global $parser;
$parser->setPath(CAT_PATH . '/templates/' . DEFAULT_TEMPLATE . '/templates/' . CAT_Registry::get('DEFAULT_THEME_VARIANT'));
// if there's a template for this in the current frontend template
$parser->setFallbackPath(dirname(__FILE__) . '/templates/default');
// fallback to default dir
$parser->output('account_preferences_form', array('show_form' => $show_form, 'languages' => $languages, 'timezones' => CAT_Helper_DateTime::getTimezones(), 'current_tz' => CAT_Helper_DateTime::getTimezone(), 'date_formats' => CAT_Helper_DateTime::getDateFormats(), 'current_df' => CAT_Helper_DateTime::getDefaultDateFormatShort(), 'time_formats' => CAT_Helper_DateTime::getTimeFormats(), 'current_tf' => CAT_Helper_DateTime::getDefaultTimeFormat(), 'PREFERENCES_URL' => PREFERENCES_URL, 'USER_ID' => $user->get_user_id(), 'DISPLAY_NAME' => $user->get_display_name(), 'GET_EMAIL' => $user->get_email(), 'RESULT_MESSAGE' => $message, 'AUTH_MIN_LOGIN_LENGTH' => AUTH_MIN_LOGIN_LENGTH));
unset($_SESSION['result_message']);
示例#3
0
/**
 *
 **/
function getTimeformats()
{
    $TIME_FORMATS = CAT_Helper_DateTime::getTimeFormats();
    $counter = 0;
    $data = array();
    foreach ($TIME_FORMATS as $format => $title) {
        $format = str_replace('|', ' ', $format);
        // Add's white-spaces (not able to be stored in array key)
        $data[$counter] = array('NAME' => $title, 'VALUE' => $format != 'system_default' ? $format : '', 'SELECTED' => CAT_DEFAULT_TIME_FORMAT == $format ? true : false);
        $counter++;
    }
    return $data;
}
示例#4
0
 public static function checkTimeformat($time_format)
 {
     $time_format_key = str_replace(' ', '|', $time_format);
     $time_formats = CAT_Helper_DateTime::getTimeFormats();
     return array_key_exists($time_format_key, $time_formats);
 }