Example #1
0
    // find JS files
    $js = CAT_Helper_Directory::getInstance()->maxRecursionDepth(5)->setSuffixFilter(array('js'))->scanDirectory(CAT_PATH . '/modules/lib_jquery/plugins/' . $plugin, true, true, CAT_PATH . '/modules/lib_jquery/plugins/' . $plugin);
    // find CSS files
    $css = CAT_Helper_Directory::getInstance()->maxRecursionDepth(5)->setSuffixFilter(array('css'))->scanDirectory(CAT_PATH . '/modules/lib_jquery/plugins/' . $plugin, true, true, CAT_PATH . '/modules/lib_jquery/plugins/' . $plugin);
    foreach ($js as $file) {
        CAT_Helper_Page::adminDelHeaderComponent('js', '/modules/lib_jquery/plugins/' . $plugin . $file, $page_id);
    }
    foreach ($css as $file) {
        CAT_Helper_Page::adminDelHeaderComponent('css', '/modules/lib_jquery/plugins/' . $plugin . $file, $page_id);
    }
    print json_encode(array('success' => true, 'message' => 'ok'));
    exit;
} elseif ($val->sanitizePost('order') != '') {
    if (is_array($val->sanitizePost('order'))) {
        $type = $val->sanitizePost('type');
        $q = sprintf('UPDATE `%spages_headers` SET `page_%s_files` = \'%s\' WHERE `page_id`="%d"', CAT_TABLE_PREFIX, $type, serialize($val->sanitizePost('order')), $page_id);
        $database->query($q);
        print json_encode(array('success' => $database->is_error() ? false : true, 'message' => $database->is_error() ? $database->get_error() : 'Success'));
        exit;
    }
} elseif ($val->sanitizePost('save') != '') {
    $data = CAT_Helper_Page::getExtraHeaderFiles($page_id);
    if (count($data)) {
        $q = 'UPDATE `:prefix:pages_headers` SET `use_core`=:use_core, `use_ui`=:use_ui WHERE `page_id`=:page_id';
    } else {
        $q = 'INSERT INTO `:prefix:pages_headers` ( `page_id`, `use_core`, `use_ui` ) VALUES ( :page_id, :use_core, :use_ui )';
    }
    $database->query($q, array('use_core' => $val->sanitizePost('use_core') == 'true' ? 'Y' : 'N', 'use_ui' => $val->sanitizePost('use_ui') == 'true' ? 'Y' : 'N', 'page_id' => $page_id));
    print json_encode(array('success' => $database->is_error() ? false : true, 'message' => $database->is_error() ? $database->get_error() : 'Success'));
    exit;
}
Example #2
0
        $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');
        break;
}
$result = true;
$message = NULL;
$output = $parser->get($tpl, $tpl_data);
if (!$output || $output == '') {
    $result = false;
    $message = 'Unable to load settings sub page';
Example #3
0
/**
 * this only saves the jQuery core and UI settings, as the plugins are saved
 * at once via AJAX
 **/
function saveHeaderfiles($backend)
{
    $data = CAT_Helper_Page::getExtraHeaderFiles(0);
    if (CAT_Helper_Validate::sanitizePost('use_core') == 'on') {
        $use_core = 'Y';
    } else {
        $use_core = 'N';
    }
    if (CAT_Helper_Validate::sanitizePost('use_ui') == 'on') {
        $use_ui = 'Y';
    } else {
        $use_ui = 'N';
    }
    if (count($data)) {
        $query = 'UPDATE `:prefix:pages_headers` SET `use_core`=:value1, `use_ui`=:value2 WHERE `page_id`=:page_id';
    } else {
        $query = 'INSERT INTO `:prefix:pages_headers` ( `page_id`, `use_core`, `use_ui` ) VALUES ( :page_id, :value1, :value2 )';
    }
    CAT_Helper_Page::getInstance(1)->db()->query($query, array('page_id' => 0, 'value1' => $use_core, 'value2' => $use_ui));
}
Example #4
0
 /**
  *
  *
  *
  *
  **/
 public static function getFrontendHeaders()
 {
     global $page_id;
     // -----------------------------------------------------------------
     // -----                  frontend theme                       -----
     // -----------------------------------------------------------------
     $tpl = CAT_Registry::get('TEMPLATE');
     $file = CAT_Helper_Directory::sanitizePath(CAT_PATH . '/templates/' . $tpl . '/headers.inc.php');
     self::$instance->log()->logDebug(sprintf('searching for file [%s]', $file));
     if (file_exists($file)) {
         self::$instance->log()->logDebug(sprintf('adding items for frontend template [%s]', $tpl));
         self::_load_headers_inc($file, 'frontend', 'templates/' . $tpl);
     } else {
         self::$instance->log()->logDebug('no headers.inc.php');
     }
     // add template path to CSS search path (frontend only)
     array_push(CAT_Helper_Page::$css_search_path, '/templates/' . $tpl, '/templates/' . $tpl . '/css', '/templates/' . $tpl . '/templates/default', '/templates/' . $tpl . '/templates/default/css', CAT_Registry::get('PAGES_DIRECTORY') . '/css/', '/modules/' . CAT_Registry::get('SEARCH_LIBRARY') . '/templates/custom/', '/modules/' . CAT_Registry::get('SEARCH_LIBRARY') . '/templates/default/');
     // Javascript search path
     array_push(CAT_Helper_Page::$js_search_path, '/templates/' . $tpl, '/templates/' . $tpl . '/js', '/templates/' . $tpl . '/templates/default', '/templates/' . $tpl . '/templates/default/js', CAT_Registry::get('PAGES_DIRECTORY') . '/js/');
     // -----------------------------------------------------------------
     // -----             get extra header files                    -----
     // -----------------------------------------------------------------
     $global_files = CAT_Helper_Page::getExtraHeaderFiles(0);
     $page_files = CAT_Helper_Page::getExtraHeaderFiles($page_id);
     $all_files = array_merge($global_files, $page_files);
     if (isset($all_files['css']) && is_array($all_files['css'])) {
         foreach ($all_files['css'] as $file) {
             self::addCSS($file);
         }
     }
     if (isset($all_files['js']) && is_array($all_files['js'])) {
         foreach ($all_files['js'] as $file) {
             self::addJS($file);
         }
     }
     // -----------------------------------------------------------------
     // -----                  sections (modules)                   -----
     // -----------------------------------------------------------------
     self::_load_sections('frontend');
     // -----------------------------------------------------------------
     // -----                  scan for css files                   -----
     // -----------------------------------------------------------------
     self::_load_css('frontend');
     // -----------------------------------------------------------------
     // -----                  scan for js files                    -----
     // -----------------------------------------------------------------
     self::_load_js('frontend');
     // called from backend?
     if (CAT_Helper_Validate::get('_REQUEST', 'preview') && CAT_Users::is_authenticated()) {
         $file = CAT_PATH . '/templates/' . DEFAULT_THEME . '/css/visibility.css';
         if (file_exists($file)) {
             CAT_Helper_Page::$css[] = array('media' => 'screen,projection', 'file' => '/templates/' . DEFAULT_THEME . '/css/visibility.css');
         }
         $file = CAT_PATH . '/templates/' . DEFAULT_THEME . '/js/visibility.js';
         if (file_exists($file)) {
             global $page_id;
             CAT_Helper_Page::$js[] = '<script type="text/javascript">' . "\n" . '    var visibility = \'' . self::getInstance(1)->lang()->translate(self::properties($page_id, 'visibility')) . '\';' . "\n" . '    var visibility_text = \'' . self::getInstance(1)->lang()->translate('Visibility of this page') . '\';' . "\n" . '    var visibility_title = \'' . self::getInstance(1)->lang()->translate('Black Cat CMS Page Preview') . '\';' . "\n" . '</script>' . "\n" . '<script type="text/javascript" src="' . CAT_Helper_Validate::sanitize_url(CAT_URL . '/templates/' . DEFAULT_THEME . '/js/visibility.js') . '"></script>' . "\n";
         }
     }
     $droplets_config = CAT_Helper_Droplet::getDropletsForHeader($page_id);
     // return the results
     return self::getMeta($droplets_config) . self::getCSS('frontend') . ($droplets_config['css'] ? "<!-- dropletsExtension -->\n" . $droplets_config['css'] . "\n<!-- /dropletsExtension -->\n" : NULL) . self::getJQuery('header') . self::getJavaScripts('header') . ($droplets_config['js'] ? "<!-- dropletsExtension -->\n" . $droplets_config['js'] . "\n<!-- /dropletsExtension -->\n" : NULL);
 }