Beispiel #1
0
 */
require 'includes/application_top.php';
require DIR_WS_MODULES . 'prod_cat_header_code.php';
$action = isset($_GET['action']) ? $_GET['action'] : '';
if (isset($_GET['page'])) {
    $_GET['page'] = (int) $_GET['page'];
}
if (isset($_GET['product_type'])) {
    $_GET['product_type'] = (int) $_GET['product_type'];
}
if (isset($_GET['cID'])) {
    $_GET['cID'] = (int) $_GET['cID'];
}
// If the action will affect the cache entries
if (preg_match("/(insert|update|setflag)/i", $action)) {
    usu_reset_cache_data('true');
}
if (!isset($_SESSION['categories_products_sort_order'])) {
    $_SESSION['categories_products_sort_order'] = CATEGORIES_PRODUCTS_SORT_ORDER;
}
if (!isset($_GET['reset_categories_products_sort_order'])) {
    $reset_categories_products_sort_order = $_SESSION['categories_products_sort_order'];
}
if (zen_not_null($action)) {
    switch ($action) {
        case 'set_categories_products_sort_order':
            $_SESSION['categories_products_sort_order'] = $_GET['reset_categories_products_sort_order'];
            $action = '';
            zen_redirect(zen_href_link(FILENAME_CATEGORIES, 'cPath=' . $_GET['cPath'] . ((isset($_GET['pID']) and !empty($_GET['pID'])) ? '&pID=' . $_GET['pID'] : '') . ((isset($_GET['page']) and !empty($_GET['page'])) ? '&page=' . $_GET['page'] : '')));
            break;
        case 'set_editor':
Beispiel #2
0
function usu_check_cache_options($action)
{
    $temp = explode('-', $action);
    if (sizeof($temp) < 2) {
        $temp[] = 'global';
    }
    $temp[1] = strtoupper($temp[1]);
    switch ($temp[0]) {
        case 'enable':
            $action = 'true';
            if (SEO_USE_CACHE_GLOBAL == 'false' && $temp[1] != 'GLOBAL') {
                zen_db_perform(TABLE_CONFIGURATION, array('configuration_value' => $action), 'update', '`configuration_key`=\'SEO_USE_CACHE_GLOBAL\'');
                echo '<div><span class="alert">' . sprintf(SEO_CONFIG_ADJUSTED, constant('SEO_USE_CACHE_' . $temp[1] . '_TITLE'), SEO_USE_CACHE_GLOBAL_TITLE, $action) . '</span></div>';
            }
            zen_db_perform(TABLE_CONFIGURATION, array('configuration_value' => $action), 'update', '`configuration_key`=\'SEO_USE_CACHE_' . $temp[1] . '\'');
            usu_reset_cache_data('true');
            break;
        case 'disable':
            $action = 'false';
            zen_db_perform(TABLE_CONFIGURATION, array('configuration_value' => $action), 'update', '`configuration_key`=\'SEO_USE_CACHE_' . $temp[1] . '\'');
            usu_reset_cache_data('true');
            break;
        default:
    }
    return $action;
}
Beispiel #3
0
/**
 * Checks the value of the various URL cache options. If the value has been
 * changed, the value will be updated in the database and the URL cache reset.
 *
 * @param string $value the current value for the URL cache option
 * @return string the value to display for the URL cache option
 */
function usu_check_cache_options($value)
{
    $temp = explode('-', $value);
    if (sizeof($temp) < 2) {
        $temp[] = 'global';
    }
    $temp[1] = strtoupper($temp[1]);
    switch ($temp[0]) {
        case 'enable':
            $value = 'true';
            if (USU_CACHE_GLOBAL == 'false' && $temp[1] != 'GLOBAL') {
                zen_db_perform(TABLE_CONFIGURATION, array('configuration_value' => $value), 'update', '`configuration_key`=\'USU_CACHE_GLOBAL\'');
                echo '<div><span class="alert">' . sprintf(USU_PLUGIN_WARNING_CONFIG_ADJUSTED, usu_get_configuration_title('USU_CACHE_' . $temp[1]), usu_get_configuration_title('USU_CACHE_GLOBAL')) . '</span></div>';
                unset($text, $option_text);
            }
            zen_db_perform(TABLE_CONFIGURATION, array('configuration_value' => $value), 'update', '`configuration_key`=\'USU_CACHE_' . $temp[1] . '\'');
            usu_reset_cache_data('true');
            break;
        case 'disable':
            $value = 'false';
            if ($temp[1] == 'GLOBAL') {
                echo '<div><span class="alert">' . USU_PLUGIN_WARNING_GLOBAL_DISABLED . '</span></div>';
            }
            zen_db_perform(TABLE_CONFIGURATION, array('configuration_value' => $value), 'update', '`configuration_key`=\'USU_CACHE_' . $temp[1] . '\'');
            usu_reset_cache_data('true');
            break;
        default:
    }
    return $value;
}
Beispiel #4
0
function ultimate_seo_install($version)
{
    global $db, $messageStack;
    $failed = false;
    // Check to make sure all new files have been uploaded.
    // These are not intended to be perfect checks, just a quick 'hey you'.
    $files = array(DIR_FS_ADMIN . DIR_WS_INCLUDES . 'extra_datafiles/seo.php', DIR_FS_ADMIN . DIR_WS_FUNCTIONS . 'extra_functions/seo.php', DIR_FS_ADMIN . DIR_WS_LANGUAGES . 'english/extra_definitions/seo.php', DIR_FS_CATALOG . DIR_WS_INCLUDES . 'extra_datafiles/seo.php', DIR_FS_CATALOG . DIR_WS_INCLUDES . 'auto_loaders/config.seo.php', DIR_FS_CATALOG . DIR_WS_INCLUDES . 'init_includes/init_seo_config.php', DIR_FS_CATALOG . DIR_WS_CLASSES . 'seo.url.php');
    foreach ($files as $file) {
        if (!file_exists($file)) {
            $messageStack->add(sprintf(SEO_INSTALL_ERROR_FILE_NOT_FOUND, $file), 'error');
            $failed = true;
        }
    }
    // Attempt a database upgrade before doing anything else.
    ultimate_seo_upgrade($version);
    // Now check the required tables if not already present
    $check = $db->Execute('SELECT TABLE_NAME FROM INFORMATION_SCHEMA.TABLES ' . 'WHERE TABLE_SCHEMA = \'' . DB_DATABASE . '\' ' . 'AND TABLE_NAME = \'' . TABLE_SEO_CACHE . '\'');
    if ($check->EOF) {
        $db->Execute('CREATE TABLE `' . TABLE_SEO_CACHE . '` ( ' . '`cache_id` VARCHAR(32) NOT NULL default \'\', ' . '`cache_language_id` TINYINT(1) NOT NULL default \'0\', ' . '`cache_name` VARCHAR(255) NOT NULL default \'\', ' . '`cache_data` MEDIUMTEXT NOT NULL, ' . '`cache_global` TINYINT(1) NOT NULL default \'1\', ' . '`cache_gzip` TINYINT(1) NOT NULL default \'1\', ' . '`cache_method` VARCHAR(20) NOT NULL default \'RETURN\', ' . '`cache_date` DATETIME NOT NULL default \'0000-00-00 00:00:00\', ' . '`cache_expires` DATETIME NOT NULL default \'0000-00-00 00:00:00\', ' . 'PRIMARY KEY (`cache_id`,`cache_language_id`), ' . 'KEY `cache_id` (`cache_id`), ' . 'KEY `cache_language_id` (`cache_language_id`), ' . 'KEY `cache_global` (`cache_global`) ' . ') ENGINE=MyISAM');
    }
    // Now check the configuration group
    $group_id = 0;
    $check = $db->Execute('SELECT `configuration_group_id` FROM `' . TABLE_CONFIGURATION_GROUP . '` ' . 'WHERE `configuration_group_title` = \'' . SEO_CONFIGURATION_GROUP_TITLE . '\'');
    if ($check->EOF) {
        $max_sort = $db->Execute('SELECT MAX(sort_order) AS `max_sort` FROM `' . TABLE_CONFIGURATION_GROUP . '`');
        if (!$max_sort->EOF) {
            $max_sort = $max_sort->fields['max_sort'] + 1;
            // Create configuration group
            $db->Execute('INSERT INTO `' . TABLE_CONFIGURATION_GROUP . '` ' . 'VALUES (\'\', \'' . SEO_CONFIGURATION_GROUP_TITLE . '\', ' . '\'' . SEO_CONFIGURATION_GROUP_DESCRIPTION . '\', \'' . $max_sort . '\', \'1\')');
            $group_id = (int) $db->insert_ID();
        } else {
            $messageStack->add(sprintf(SEO_INSTALL_ERROR_SORT_ORDER, TABLE_CONFIGURATION_GROUP), 'error');
            $failed = true;
        }
    } else {
        $group_id = (int) $check->fields['configuration_group_id'];
    }
    // Install (or update) any needed configuration items
    if ($group_id != 0) {
        $sql_data_array = array('configuration_group_id' => $group_id, 'sort_order' => 0, 'last_modified' => 'null', 'date_added' => 'now()');
        foreach (ultimate_seo_default_settings($version) as $key => $data) {
            $check = $db->Execute('SELECT `configuration_id` FROM `' . TABLE_CONFIGURATION . '` ' . 'WHERE `configuration_key`=\'' . $key . '\'');
            if ($check->EOF) {
                $data['configuration_key'] = $key;
                $data['configuration_title'] = constant($key . '_TITLE');
                $data['configuration_description'] = constant($key . '_DESCRIPTION');
                zen_db_perform(TABLE_CONFIGURATION, array_merge($sql_data_array, $data));
            } else {
                unset($data['configuration_value']);
                ultimate_seo_upgrade_option($key, array_merge($data, array('sort_order' => $sql_data_array['sort_order'])));
            }
            $sql_data_array['sort_order']++;
        }
        // Update the version stored in the database for this plugin
        $sql_data_array = array('last_modified' => 'now()', 'configuration_value' => $version, 'set_function' => 'zen_cfg_select_option(array(\\\'' . $version . '\\\'),');
        zen_db_perform(TABLE_CONFIGURATION, $sql_data_array, 'update', '`configuration_key`=\'USU_VERSION\'');
        unset($sql_data_array);
        // Reset the cache to deal with any stale entries
        usu_reset_cache_data('true');
    }
    unset($defaults);
    // Add support for admin profiles
    if (function_exists('zen_register_admin_page')) {
        if (!zen_page_key_exists('configUltimateSEO')) {
            $max_sort = $db->Execute('SELECT MAX(sort_order) AS `max_sort` FROM `' . TABLE_ADMIN_PAGES . '` WHERE `menu_key`=\'configuration\'');
            if (!$max_sort->EOF) {
                $max_sort = $max_sort->fields['max_sort'] + 1;
                // Register the administrative page
                zen_register_admin_page('configUltimateSEO', 'SEO_CONFIGURATION_GROUP_TITLE', 'FILENAME_CONFIGURATION', 'gID=' . $group_id, 'configuration', 'Y', $max_sort);
            } else {
                $messageStack->add(sprintf(SEO_INSTALL_ERROR_SORT_ORDER, TABLE_ADMIN_PAGES), 'error');
                $failed = true;
            }
        }
    }
    return $failed;
}