示例#1
0
function Dwoo_Plugin_format_date(Dwoo $dwoo, $date = false, $long = false)
{
    if (!$date) {
        return '';
    }
    return CAT_Helper_DateTime::getDate($date, $long);
}
示例#2
0
 /**
  * check given timezone
  * the timezone string must match a value in the table
  *
  * @access public
  * @param  string  $tz
  * @return boolean
  **/
 public static function checkTZ($tz)
 {
     $timezone_table = CAT_Helper_DateTime::getTimezones();
     if (in_array($tz, $timezone_table)) {
         return true;
     }
     return false;
 }
示例#3
0
function Dwoo_Plugin_last_modified(Dwoo $dwoo, $page_id = false)
{
    if (is_numeric($page_id)) {
        $sql = "SELECT `modified_when` FROM `:prefix:pages` WHERE `page_id` = :id";
        $t = CAT_Helper_Page::getInstance()->db()->query($sql, array('id' => intval($page_id)))->fetchColumn();
    } else {
        $sql = "SELECT `modified_when` FROM `:prefix:pages` WHERE `visibility`='public' OR `visibility`='hidden' ORDER BY `modified_when` DESC LIMIT 0,1";
        $t = CAT_Helper_Page::getInstance()->db()->query($sql)->fetchColumn();
    }
    return CAT_Helper_DateTime::getDate($t);
}
示例#4
0
/**
 * Return the formatted date and time strings for the
 * "last modified by ... on ..." output in the search results
 *   
 * @param integer $page_modified_when - unix timestamp
 * @return array with date and time
 */
function get_page_modified($page_modified_when)
{
    global $lang;
    if ($page_modified_when > 0) {
        $date = CAT_Helper_DateTime::getDate($page_modified_when);
        $time = CAT_Helper_DateTime::getTime($page_modified_when);
    } else {
        $date = $lang->translate('- unknown date -');
        $time = $lang->translate('- unknown time -');
    }
    return array($date, $time);
}
示例#5
0
/**
 *
 **/
function saveDatetime($backend)
{
    $settings = array();
    $old_settings = getSettingsTable();
    $val = CAT_Helper_Validate::getInstance();
    // language must be 2 upercase letters only
    $default_language = strtoupper($val->sanitizePost('default_language'));
    $settings['default_language'] = $backend->lang()->checkLang($default_language) ? $default_language : $old_settings['default_language'];
    // check date format
    $settings['cat_default_date_format'] = CAT_Helper_DateTime::checkDateformat($val->sanitizePost('default_date_format')) ? $val->sanitizePost('default_date_format') : $old_settings['cat_default_date_format'];
    // check time format
    $settings['cat_default_time_format'] = CAT_Helper_DateTime::checkTimeformat($val->sanitizePost('default_time_format')) ? $val->sanitizePost('default_time_format') : $old_settings['cat_default_time_format'];
    // check timezone string
    $settings['default_timezone_string'] = CAT_Helper_DateTime::checkTZ($val->sanitizePost('default_timezone_string')) ? $val->sanitizePost('default_timezone_string') : $old_settings['default_timezone_string'];
    // check charset
    $CHARSETS = $backend->lang()->getCharsets();
    $char_set = $val->sanitizePost('default_charset');
    $settings['default_charset'] = array_key_exists($char_set, $CHARSETS) ? $char_set : $old_settings['default_charset'];
    saveSettings($settings);
}
示例#6
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']);
示例#7
0
 case 'security':
     $admin =& $backend;
     require_once CAT_PATH . '/framework/CAT/Helper/Captcha/WB/captcha.php';
     $captcha = getCaptchaTypes($backend);
     $tpl_data = array_merge($tpl_data, $captcha);
     $tpl_data['useable_captchas'] = $useable_captchas;
     $tpl_data['ttf_image'] = CAT_URL . '/framework/CAT/Helper/Captcha/WB/captchas/ttf_image.png';
     $tpl_data['calc_image'] = CAT_URL . '/framework/CAT/Helper/Captcha/WB/captchas/calc_image.png';
     $tpl_data['calc_ttf_image'] = CAT_URL . '/framework/CAT/Helper/Captcha/WB/captchas/calc_ttf_image.png';
     $tpl_data['old_image'] = CAT_URL . '/framework/CAT/Helper/Captcha/WB/captchas/old_image.png';
     $tpl_data['calc_text'] = CAT_URL . '/framework/CAT/Helper/Captcha/WB/captchas/calc_text.png';
     $tpl_data['text'] = CAT_URL . '/framework/CAT/Helper/Captcha/WB/captchas/text.png';
     break;
 case 'sysinfo':
     // format installation date and time
     $tpl_data['values']['installation_time'] = CAT_Helper_DateTime::getDateTime(INSTALLATION_TIME);
     // get page statistics
     $pg = CAT_Helper_Page::getPagesByVisibility();
     foreach (array_keys($pg) as $key) {
         $tpl_data['values']['pages_count'][] = array('visibility' => $key, 'count' => count($pg[$key]));
     }
     break;
 case 'headers':
     $files = CAT_Helper_Page::getExtraHeaderFiles(0);
     $tpl_data['use_core'] = isset($files['use_core']) ? $files['use_core'] : NULL;
     $tpl_data['use_ui'] = isset($files['use_ui']) ? $files['use_ui'] : NULL;
     $tpl_data['page_js'] = isset($files['js']) ? $files['js'] : '';
     $tpl_data['page_css'] = isset($files['css']) ? $files['css'] : '';
     $tpl_data['jquery_plugins'] = CAT_Helper_Directory::getInstance()->maxRecursionDepth(0)->scanDirectory(CAT_PATH . '/modules/lib_jquery/plugins', false, false, CAT_PATH . '/modules/lib_jquery/plugins/');
     $tpl_data['js_files'] = CAT_Helper_Directory::getInstance()->maxRecursionDepth(5)->setSuffixFilter(array('js'))->scanDirectory(CAT_PATH . '/modules/lib_jquery/plugins', true, true, CAT_PATH . '/modules/lib_jquery/plugins');
     $tpl_data['css_files'] = CAT_Helper_Directory::getInstance()->maxRecursionDepth(5)->setSuffixFilter(array('css'))->scanDirectory(CAT_PATH . '/modules/lib_jquery/plugins', true, true, CAT_PATH . '/modules/lib_jquery/plugins');
示例#8
0
 public function get_timezone_string()
 {
     return CAT_Helper_DateTime::getTimezone();
 }
示例#9
0
 $tpl_data['blocks'][$bcnt]['current_block_id'] = $section['block'];
 $tpl_data['blocks'][$bcnt]['current_block_name'] = $parser->get_template_block_name($current_template, $section['block']) . ' (' . $backend->lang()->translate('Block number') . ': ' . $section['block'] . ')';
 $tpl_data['blocks'][$bcnt]['section_id'] = $section['section_id'];
 $tpl_data['blocks'][$bcnt]['module'] = $section['module'];
 $tpl_data['blocks'][$bcnt]['name'] = $section['name'];
 $tpl_data['blocks'][$bcnt]['date_day_from'] = $section['publ_start'] > 0 ? date('d', $section['publ_start']) : '';
 $tpl_data['blocks'][$bcnt]['date_month_from'] = $section['publ_start'] > 0 ? date('m', $section['publ_start']) : '';
 $tpl_data['blocks'][$bcnt]['date_year_from'] = $section['publ_start'] > 0 ? date('Y', $section['publ_start']) : '';
 $tpl_data['blocks'][$bcnt]['date_hour_from'] = $section['publ_start'] > 0 ? date('H', $section['publ_start']) : '';
 $tpl_data['blocks'][$bcnt]['date_minute_from'] = $section['publ_start'] > 0 ? date('i', $section['publ_start']) : '';
 $tpl_data['blocks'][$bcnt]['date_day_to'] = $section['publ_start'] > 0 ? date('d', $section['publ_end']) : '';
 $tpl_data['blocks'][$bcnt]['date_month_to'] = $section['publ_start'] > 0 ? date('m', $section['publ_end']) : '';
 $tpl_data['blocks'][$bcnt]['date_year_to'] = $section['publ_start'] > 0 ? date('Y', $section['publ_end']) : '';
 $tpl_data['blocks'][$bcnt]['date_hour_to'] = $section['publ_start'] > 0 ? date('H', $section['publ_end']) : '';
 $tpl_data['blocks'][$bcnt]['date_minute_to'] = $section['publ_start'] > 0 ? date('i', $section['publ_end']) : '';
 $tpl_data['blocks'][$bcnt]['modified_when'] = $section['modified_when'] ? CAT_Helper_DateTime::getDateTime($section['modified_when']) : '';
 $tpl_data['blocks'][$bcnt]['modified_by'] = $section['modified_by'] ? (CAT_Users::get_user_details($section['modified_by'], 'display_name') ? CAT_Users::get_user_details($section['modified_by'], 'display_name') : '') . ' (' . CAT_Users::get_user_details($section['modified_by'], 'username') . ')' : '';
 // load language file (if any)
 $langfile = CAT_Helper_Directory::sanitizePath(CAT_PATH . '/modules/' . $module . '/languages/' . LANGUAGE . '.php');
 if (file_exists($langfile)) {
     if (!$backend->lang()->checkFile($langfile, 'LANG', true)) {
         // old fashioned language file
         include $langfile;
     } else {
         // modern language file
         $backend->lang()->addFile(LANGUAGE . '.php', CAT_Helper_Directory::sanitizePath(CAT_PATH . '/modules/' . $module . '/languages'));
     }
 }
 // ======================================================
 // ! Include the module and add it to the output buffer
 // ======================================================
示例#10
0
// ! Get display name of person who last modified the page
// =========================================================
$user = $users->get_user_details($results_array['modified_by']);
// =================================
// ! Add permissions to $data_dwoo
// =================================
$permission['pages'] = $users->checkPermission('Pages', 'pages') ? true : false;
$permission['pages_add'] = $users->checkPermission('Pages', 'pages_add') ? true : false;
$permission['pages_add_l0'] = $users->checkPermission('Pages', 'pages_add_l0') ? true : false;
$permission['pages_modify'] = $users->checkPermission('Pages', 'pages_modify') ? true : false;
$permission['pages_delete'] = $users->checkPermission('Pages', 'pages_delete') ? true : false;
$permission['pages_settings'] = $users->checkPermission('Pages', 'pages_settings') ? true : false;
$permission['pages_intro'] = $users->checkPermission('Pages', 'pages_intro') != true || INTRO_PAGE != 'enabled' ? false : true;
// list of all pages for dropdown, sorted by parent->child
$pages = CAT_Helper_ListBuilder::sort(CAT_Helper_Page::getPages(CAT_Backend::isBackend()), 0);
// =============================================
// ! Add result_array to the template variable
// =============================================
$ajax = array('description' => $results_array['description'], 'keywords' => $results_array['keywords'], 'language' => $results_array['language'], 'level' => $results_array['level'], 'menu' => $results_array['menu'], 'menu_title' => htmlspecialchars_decode($results_array['menu_title'], ENT_QUOTES), 'modified_when' => $results_array['modified_when'] != 0 ? CAT_Helper_DateTime::getDate($results_array['modified_when']) : 'Unknown', 'page_id' => $results_array['page_id'], 'page_title' => htmlspecialchars_decode($results_array['page_title'], ENT_QUOTES), 'parent' => $results_array['parent'], 'searching' => $results_array['searching'] == 0 ? false : true, 'short_link' => substr($results_array['link'], strripos($results_array['link'], '/') + 1), 'target' => $results_array['target'], 'template' => $results_array['template'], 'visibility' => $results_array['visibility'], 'display_name' => $user['display_name'], 'username' => $user['username'], 'DISPLAY_MENU_LIST' => MULTIPLE_MENUS != false ? true : false, 'DISPLAY_LANGUAGE_LIST' => PAGE_LANGUAGES != false ? true : false, 'DISPLAY_SEARCHING' => SEARCH != false ? true : false, 'admin_groups' => explode(',', str_replace('_', '', $results_array['admin_groups'])), 'viewing_groups' => explode(',', str_replace('_', '', $results_array['viewing_groups'])), 'parent_list' => $pages, 'PAGE_EXTENSION' => $backend->db()->query("SELECT `value` FROM `:prefix:settings` WHERE name = 'page_extension'")->fetchColumn());
$ajax['variants'] = array();
$info = CAT_Helper_Addons::checkInfo(CAT_PATH . '/templates/' . CAT_Helper_Page::getPageTemplate($results_array['page_id']));
if (isset($info['module_variants']) && is_array($info['module_variants']) && count($info['module_variants'])) {
    $ajax['variants'] = $info['module_variants'];
    array_unshift($ajax['variants'], '');
}
$ajax['template_variant'] = CAT_Helper_Page::getPageSettings($results_array['page_id'], 'internal', 'template_variant');
// ====================
// ! Return values
// ====================
print json_encode($ajax);
exit;
示例#11
0
        $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);
    }
}
// =================================
// ! Include the WB functions file
// =================================
include_once CAT_PATH . '/framework/functions.php';
$dirh = CAT_Helper_Directory::getInstance();
$user = CAT_Users::getInstance();
$val = CAT_Helper_Validate::getInstance();
$date = CAT_Helper_DateTime::getInstance();
// check viewing permissions
if ($val->sanitizePost('load_url') == '' || $user->checkPermission('media', 'media_view', false) !== true) {
    header('Location: ' . CAT_ADMIN_URL);
    exit;
}
$load_file = urldecode($val->sanitizePost('load_url'));
$load_url = $val->sanitizePost('folder_path') . '/' . $load_file;
$load_path = CAT_PATH . '/' . $load_url;
$ajax = array('initial_folder' => $dirh->sanitizePath($load_url), 'MEDIA_DIRECTORY' => MEDIA_DIRECTORY);
$allowed_img_types = array('jpg', 'jpeg', 'png', 'gif', 'tif');
if (is_dir($load_path) || is_dir(utf8_decode($load_path))) {
    $ajax['is_folder'] = true;
    $ajax['is_writable'] = is_writable($load_path);
    // ========================================
    // ! Get contents for the intitial folder
示例#12
0
/**
 * global settings
 **/
function show_step_globals($step)
{
    global $lang, $parser, $installer_uri, $config, $dirh;
    global $timezone_table;
    write2log('> [show_step_globals()]');
    // get timezones
    include dirname(__FILE__) . '/../framework/CAT/Helper/DateTime.php';
    $timezone_table = CAT_Helper_DateTime::getInstance()->getTimezones();
    $lang_dir = dirname(__FILE__) . "/../languages/";
    $lang_files = $dirh->setRecursion(false)->setSkipFiles(array('index'))->getPHPFiles($lang_dir, $lang_dir);
    $dirh->setRecursion(true);
    // reset
    // get language name
    foreach ($lang_files as $temp_file) {
        $str = file($lang_dir . $temp_file);
        $language_name = "";
        foreach ($str as $line) {
            if (strpos($line, "language_name") != false) {
                eval($line);
                break;
            }
        }
        $lang_short = pathinfo($temp_file, PATHINFO_FILENAME);
        $langs[$lang_short] = $language_name;
    }
    ksort($langs);
    if (!isset($config['default_language'])) {
        $config['default_language'] = $lang->getLang();
    }
    // generate a GUID prefix
    if (!isset($config['guid_prefix'])) {
        // VERY simple algorithm, no need for something more creative
        $config['guid_prefix'] = implode('', array_rand(array_flip(array_merge(range('a', 'z'), range('A', 'Z'), range('0', '9'))), 4));
    }
    // operating system
    // --> FrankH: Detect OS
    $ctrue = " checked='checked'";
    $cfalse = "";
    if (substr(php_uname('s'), 0, 7) == "Windows") {
        $osw = $ctrue;
        $osl = $cfalse;
        $startstyle = "none";
    } else {
        $osw = $cfalse;
        $osl = $ctrue;
        $startstyle = "block";
    }
    // <-- FrankH: Detect OS
    $output = $parser->get('globals.tpl', array('installer_cat_url' => dirname($installer_uri) . '/', 'installer_guid_prefix' => $config['installer_guid_prefix'], 'timezones' => $timezone_table, 'installer_default_timezone_string' => $config['default_timezone_string'], 'languages' => $langs, 'installer_default_language' => $config['default_language'], 'editors' => findWYSIWYG(), 'installer_default_wysiwyg' => $config['default_wysiwyg'], 'installer_ssl' => isset($config['ssl']) ? $config['ssl'] : sslCheck(), 'installer_guid_prefix' => $config['guid_prefix'], 'is_linux' => $osl, 'is_windows' => $osw, 'errors' => $step['errors'], 'ssl_available' => isset($config['ssl_available']) ? $config['ssl_available'] : sslCheck()));
    write2log('< [show_step_globals()]');
    return array(true, $output);
}
示例#13
0
 /**
  * prints the top of the backend page
  *
  * @access public
  * @return void
  **/
 public static function print_banner()
 {
     global $page_id, $parser;
     $results_array = CAT_Helper_Page::properties($page_id);
     $user = CAT_Users::get_user_details($results_array['modified_by']);
     $tpl_data = array();
     foreach ($results_array as $key => $value) {
         $tpl_data[strtoupper($key)] = $value;
     }
     $tpl_data['MODIFIED_BY'] = $user['display_name'];
     $tpl_data['MODIFIED_BY_USERNAME'] = $user['username'];
     $tpl_data['MODIFIED_WHEN'] = $results_array['modified_when'] != 0 ? $modified_ts = CAT_Helper_DateTime::getDateTime($results_array['modified_when']) : false;
     $tpl_data['PAGE_HEADER'] = self::getInstance('')->lang()->translate('Modify page');
     $tpl_data['CUR_TAB'] = 'modify';
     $tpl_data['PAGE_LINK'] = CAT_Helper_Page::getLink($results_array['page_id']);
     $parser->output('backend_pages_header', $tpl_data);
     $parser->output('backend_pages_banner', $tpl_data);
 }
示例#14
0
}
$backend = CAT_Backend::getInstance('Pages', 'pages_settings');
$page = CAT_Helper_Page::getPage($page_id);
$user = CAT_Users::get_user_details($page['modified_by']);
$files = CAT_Helper_Page::getExtraHeaderFiles($page_id);
// ==================================
// ! Add globals to the template data
// ==================================
$tpl_data['CUR_TAB'] = 'headers';
$tpl_data['PAGE_HEADER'] = $backend->lang()->translate('Modify header files');
$tpl_data['PAGE_ID'] = $page_id;
$tpl_data['PAGE_LINK'] = CAT_Helper_Page::getLink($page['link']);
$tpl_data['PAGE_TITLE'] = $page['page_title'];
$tpl_data['MODIFIED_BY'] = $user['display_name'];
$tpl_data['MODIFIED_BY_USERNAME'] = $user['username'];
$tpl_data['MODIFIED_WHEN'] = $page['modified_when'] != 0 ? CAT_Helper_DateTime::getDateTime($page['modified_when']) : false;
$tpl_data['page_js'] = isset($files['js']) ? $files['js'] : '';
$tpl_data['page_css'] = isset($files['css']) ? $files['css'] : '';
$tpl_data['use_core'] = isset($files['use_core']) ? $files['use_core'] : NULL;
$tpl_data['use_ui'] = isset($files['use_ui']) ? $files['use_ui'] : NULL;
$tpl_data['jquery_plugins'] = CAT_Helper_Directory::getInstance()->maxRecursionDepth(0)->scanDirectory(CAT_PATH . '/modules/lib_jquery/plugins', false, false, CAT_PATH . '/modules/lib_jquery/plugins/');
$tpl_data['js_files'] = CAT_Helper_Directory::getInstance()->maxRecursionDepth(5)->setSuffixFilter(array('js'))->scanDirectory(CAT_PATH . '/modules/lib_jquery/plugins', true, true, CAT_PATH . '/modules/lib_jquery/plugins');
$tpl_data['css_files'] = CAT_Helper_Directory::getInstance()->maxRecursionDepth(5)->setSuffixFilter(array('css'))->scanDirectory(CAT_PATH . '/modules/lib_jquery/plugins', true, true, CAT_PATH . '/modules/lib_jquery/plugins');
$backend->print_header();
// ====================
// ! Parse output tpl
// ====================
$parser->output('backend_pages_headerfiles', $tpl_data);
// ======================
// ! Print admin footer
// ======================
示例#15
0
    $client = new Zend\Http\Client($current['source'], array('timeout' => $current['timeout'], 'adapter' => 'Zend\\Http\\Client\\Adapter\\Proxy', 'proxy_host' => $current['proxy_host'], 'proxy_port' => $current['proxy_port']));
    $client->setHeaders(array('Pragma' => 'no-cache', 'Cache-Control' => 'no-cache'));
    try {
        $response = $client->send();
        if ($response->getStatusCode() != '200') {
            $error = "Unable to load source " . "(using Proxy: " . (isset($current['proxy_host']) && $current['proxy_host'] != '' ? 'yes' : 'no') . ")<br />" . "Status: " . $response->getStatus() . " - " . $response->getMessage() . ($debug ? "<br />" . var_dump($client->getLastRequest()) : NULL) . "<br />";
            $version = 'unknown';
        } else {
            $version = $response->getBody();
        }
    } catch (Exception $e) {
        $error = "Unable to load source " . "(using Proxy: " . (isset($current['proxy_host']) && $current['proxy_host'] != '' ? 'yes' : 'no') . ")<br />" . $e->getMessage() . "<br />";
        $version = 'unknown';
    }
    if ($version && $version != 'unknown') {
        if (CAT_Helper_Addons::getInstance()->versionCompare($version, CAT_VERSION, '>')) {
            $newer = true;
        }
    }
    $fh = @fopen(CAT_Helper_Directory::sanitizePath(dirname(__FILE__) . '/../data/.last'), 'w');
    if (is_resource($fh)) {
        fputs($fh, time() . '|' . $version);
        fclose($fh);
    }
} else {
    $version = isset($last_version) && $last_version != '' ? $last_version : $version;
}
global $parser;
$parser->setPath(dirname(__FILE__) . '/../templates/default');
$parser->output('widget.tpl', array('error' => $error, 'version' => $version, 'newer' => $newer, 'last' => CAT_Helper_DateTime::getInstance()->getDate($last) . ' ' . CAT_Helper_DateTime::getInstance()->getTime($last), 'CAT_VERSION' => CAT_VERSION, 'uri' => $_SERVER['SCRIPT_NAME'], 'missing_mailer_libs' => count(CAT_Helper_Addons::getLibraries('mail')), 'missing_wysiwyg' => count(CAT_Helper_Addons::get_addons(NULL, 'module', 'wysiwyg'))));
示例#16
0
}
// Load Language file
if (!defined('LANGUAGE_LOADED')) {
    if (!file_exists(CAT_PATH . '/languages/' . LANGUAGE . '.php')) {
        exit('Error loading language file ' . LANGUAGE . ', please check configuration');
    } else {
        require_once CAT_PATH . '/languages/' . LANGUAGE . '.php';
    }
}
//**************************************************************************
// set timezone and date/time formats
//**************************************************************************
$timezone_string = isset($_SESSION['TIMEZONE_STRING']) ? $_SESSION['TIMEZONE_STRING'] : DEFAULT_TIMEZONE_STRING;
date_default_timezone_set($timezone_string);
CAT_Registry::register('CAT_TIME_FORMAT', CAT_Helper_DateTime::getDefaultTimeFormat(), true);
CAT_Registry::register('CAT_DATE_FORMAT', CAT_Helper_DateTime::getDefaultDateFormatShort(), true);
//**************************************************************************
// Disable magic_quotes_runtime
//**************************************************************************
if (version_compare(PHP_VERSION, '5.3.0', '<')) {
    set_magic_quotes_runtime(0);
}
//**************************************************************************
// Set theme
//**************************************************************************
CAT_Registry::register('CAT_THEME_URL', CAT_URL . '/templates/' . DEFAULT_THEME, true);
CAT_Registry::register('CAT_THEME_PATH', CAT_PATH . '/templates/' . DEFAULT_THEME, true);
//**************************************************************************
// set the search library
//**************************************************************************
if (!defined('CAT_INSTALL_PROCESS')) {
示例#17
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);
示例#18
0
        break;
    case 'administration':
        $type_name = $backend->lang()->translate('Administration');
        break;
    case 'snippet':
        $type_name = $backend->lang()->translate('Code-Snippet');
        break;
    case 'library':
        $type_name = $backend->lang()->translate('Library');
        break;
    default:
        $type_name = $backend->lang()->translate('Unknown');
}
$addon['function'] = $type_name;
// Check if the module is installable or upgradeable
$addon['INSTALL'] = file_exists(CAT_PATH . '/' . $addon['type'] . 's/' . $addon['directory'] . '/install.php') ? true : false;
$addon['UPGRADE'] = file_exists(CAT_PATH . '/' . $addon['type'] . 's/' . $addon['directory'] . '/upgrade.php') ? true : false;
// add some more details
$addon = array_merge($addon, array('installed' => $addon['installed'] != '' ? CAT_Helper_DateTime::getDate($addon['installed']) : NULL, 'upgraded' => $addon['upgraded'] != '' ? CAT_Helper_DateTime::getDate($addon['upgraded']) : NULL, 'is_installed' => CAT_Helper_Addons::isModuleInstalled($addon['directory'], NULL, $addon['type']), 'is_removable' => $addon['removable'] == 'N' ? false : true, 'link' => $link));
$tpl_data['token_name'] = $GLOBALS['csrf']['input-name'];
$tpl_data['token'] = csrf_get_tokens();
$result = true;
$message = NULL;
$output = $parser->get('backend_addons_index_details', array_merge($tpl_data, array('addon' => $addon)));
if (!$output || $output == '') {
    $result = false;
    $message = 'Unable to load settings sub page';
}
$ajax = array('message' => $message, 'success' => $result, 'content' => $output);
print json_encode($ajax);
exit;