public function handleUpgradeFrom($version)
 {
     $success = true;
     switch ($version) {
         case '4.0.2':
             // 4.0.3 and 4.0.4 left this set to 4.0.2
         // 4.0.3 and 4.0.4 left this set to 4.0.2
         case '4.1':
         case '4.1.1':
             // Remove the obsolete "Shipping Tax" configuration option
             $this->removeConfigurationOption('SHIPPING_TAX');
             // We changed a definition related to the edit orders admin page
             if (function_exists('zen_deregister_admin_pages') && zen_page_key_exists('editOrders')) {
                 zen_deregister_admin_pages('editOrders');
             }
             if (function_exists('zen_deregister_admin_pages') && zen_page_key_exists('configEditOrders')) {
                 zen_deregister_admin_pages('configEditOrders');
             }
             break;
         default:
             break;
     }
     return $success;
 }
Example #2
0
<?php

/**
 * Bohase - Premium Zencart Template
 *
 * @package Boahse Admin File
 * @author PerfectusThemes
 * @author website www.perfectusinc.com
 * @copyright Copyright 2015-2016 Perfectus Inc.
 * @license http://www.gnu.org/copyleft/gpl.html   GNU Public License V2.0
 * @version $Id: template_settings.php 1.0
 */
if (!defined('IS_ADMIN_FLAG')) {
    die('Illegal Access');
}
if (function_exists('zen_register_admin_page')) {
    if (!zen_page_key_exists('template_settings')) {
        // Add Color menu to Tools menu
        zen_register_admin_page('template_settings', 'BOX_TOOLS_TEMPLATE_SETTINGS', 'FILENAME_TEMPLATE_SETTINGS', '', 'tools', 'Y', 21);
    }
}
<?php

// Bug fix in installer name adding config admin page
$zc150 = PROJECT_VERSION_MAJOR > 1 || PROJECT_VERSION_MAJOR == 1 && substr(PROJECT_VERSION_MINOR, 0, 3) >= 5;
if ($zc150) {
    // continue Zen Cart 1.5.0
    $admin_page = 'configCouponImportTool';
    // delete configuration menu
    $db->Execute("DELETE FROM " . TABLE_ADMIN_PAGES . " WHERE page_key = '" . $admin_page . "' LIMIT 1;");
    // add configuration menu
    if (!zen_page_key_exists($admin_page)) {
        if ((int) $configuration_group_id > 0) {
            zen_register_admin_page($admin_page, 'BOX_CONFIGURATION_COUPON_IMPORT_TOOLS', 'FILENAME_CONFIGURATION', 'gID=' . $configuration_group_id, 'configuration', 'Y', $configuration_group_id);
            $messageStack->add('Enabled Coupon Import Tool Configuration Menu.', 'success');
        }
    }
}
// -----
// Initialization script for the Best-Sellers Reloaded plugin.  Modified from the previous install.sql by lat9 (Vinos de Frutas Tropicales).
// Copyright (c) 2014-2015, Vinos de Frutas Tropicales
//
if (!defined('IS_ADMIN_FLAG')) {
    die('Illegal Access');
}
$configurationGroupTitle = 'Best Sellers';
$configuration = $db->Execute("SELECT configuration_group_id FROM " . TABLE_CONFIGURATION_GROUP . " WHERE configuration_group_title = '{$configurationGroupTitle}' LIMIT 1");
if ($configuration->EOF) {
    $db->Execute("INSERT INTO " . TABLE_CONFIGURATION_GROUP . " (configuration_group_title, configuration_group_description, sort_order, visible) VALUES ('{$configurationGroupTitle}', 'Best-Seller Settings', '1', '1');");
    $cgi = $db->Insert_ID();
    $db->Execute("UPDATE " . TABLE_CONFIGURATION_GROUP . " SET sort_order = {$cgi} WHERE configuration_group_id = {$cgi};");
} else {
    $cgi = $configuration->fields['configuration_group_id'];
}
// -----
// Set the various configuration items, if Best Sellers wasn't previously installed.
//
if (!defined('SHOW_PRODUCT_INFO_MAIN_BEST_SELLERS')) {
    $db->Execute("INSERT INTO " . TABLE_CONFIGURATION . " ( configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, use_function, set_function ) VALUES ( 'Show Best Sellers - Main Page', 'SHOW_PRODUCT_INFO_MAIN_BEST_SELLERS', '0', 'Show the <em>Best Sellers</em> on the main page? Set to <em>0</em> to disable or set the sort order for the display.', {$cgi}, 5, NULL , NULL)");
    $db->Execute("INSERT INTO " . TABLE_CONFIGURATION . " ( configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, use_function, set_function ) VALUES ( 'Show Best Sellers - Main Page w/ Categories', 'SHOW_PRODUCT_INFO_CATEGORY_BEST_SELLERS', '0', 'Show the <em>Best Sellers</em> on the categories\\' listings? Set to <em>0</em> to disable or set the sort order for the display.', {$cgi}, 10, NULL , NULL)");
    $db->Execute("INSERT INTO " . TABLE_CONFIGURATION . " ( configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, use_function, set_function ) VALUES ( 'Maximum Display of Best Sellers', 'MAX_DISPLAY_SEARCH_RESULTS_BEST_SELLERS', '9', 'The maximum number of best sellers to list in an enabled center-box.', {$cgi}, 15, NULL , NULL)");
    $db->Execute("INSERT INTO " . TABLE_CONFIGURATION . " ( configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, use_function, set_function ) VALUES ( 'Best Sellers - Columns per Row', 'SHOW_PRODUCT_INFO_COLUMNS_BEST_SELLERS', '3', 'The number of columns to display in an enabled center-box.', {$cgi}, 20, NULL, 'zen_cfg_select_option(array(\\'1\\', \\'2\\', \\'3\\', \\'4\\', \\'5\\', \\'6\\', \\'7\\', \\'8\\', \\'9\\', \\'10\\', \\'11\\', \\'12\\'),')");
    $db->Execute("INSERT INTO " . TABLE_CONFIGURATION . " ( configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, use_function, set_function ) VALUES ( 'Best Sellers - Image Width', 'IMAGE_BEST_SELLERS_LISTING_WIDTH', '100', 'The width of the <em>Best Sellers</em> images.', {$cgi}, 25, NULL , NULL)");
    $db->Execute("INSERT INTO " . TABLE_CONFIGURATION . " ( configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, use_function, set_function ) VALUES ( 'Best Sellers - Image Height', 'IMAGE_BEST_SELLERS_LISTING_HEIGHT', '80', 'The height of the <em>Best Sellers</em> images.', {$cgi}, 30, NULL, NULL)");
    $db->Execute("INSERT INTO " . TABLE_CONFIGURATION . " ( configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, use_function, set_function ) VALUES ( 'Best Sellers - Show Out-of-Stock?', 'BEST_SELLERS_RELOADED_SHOW_OUT_OF_STOCK', 'false', 'Show out-of-stock products in the <em>Best Sellers</em> centerbox?', {$cgi}, 35, NULL, 'zen_cfg_select_option(array(\\'true\\', \\'false\\'),')");
}
if (function_exists('zen_page_key_exists') && !zen_page_key_exists('configBestSellers')) {
    zen_register_admin_page('configBestSellers', 'BOX_CONFIGURATION_BEST_SELLERS_RELOADED', 'FILENAME_CONFIGURATION', "gID={$cgi}", 'configuration', 'Y', $cgi);
}
Example #5
0
<?php

/*
 $Id: reg_backup_mysql.php, v 1.4 2011/11/24  $																    
                                                     
  By PRO-Webs.net 12.9.2011
                                                      
  Powered by Zen-Cart (www.zen-cart.com)              
  Portions Copyright (c) 2006 The Zen Cart Team       
                                                      
  Released under the GNU General Public License       
  available at www.zen-cart.com/license/2_0.txt       
  or see "license.txt" in the downloaded zip          

  DESCRIPTION: Add Export Orders to Tools Menu
*/
if (!defined('IS_ADMIN_FLAG')) {
    die('Illegal Access');
}
if (function_exists('zen_register_admin_page')) {
    if (!zen_page_key_exists('todopago')) {
        zen_register_admin_page('todopago', 'BOX_TOOLS_TODOPAGO', 'FILENAME_TODOPAGO', '', 'tools', 'Y', 17);
    }
}
Example #6
0
<?php

// For Admin Pages
$zc150 = PROJECT_VERSION_MAJOR > 1 || PROJECT_VERSION_MAJOR == 1 && substr(PROJECT_VERSION_MINOR, 0, 3) >= 5;
if ($zc150) {
    // continue Zen Cart 1.5.0
    // delete configuration menu
    $db->Execute("DELETE FROM " . TABLE_ADMIN_PAGES . " WHERE page_key = 'config_product_tare_groups' LIMIT 1;");
    // add configuration menu
    if (!zen_page_key_exists('catalogTareGroupsBulk')) {
        zen_register_admin_page('catalogTareGroupsBulk', 'BOX_PRODUCT_TARE_GROUPS_BULK', 'FILENAME_TARE_GROUPS_BULK', '', 'catalog', 'Y', $configuration_group_id);
        $messageStack->add('Enabled Product Tare Groups Bulk Add Menu Item.', 'success');
    }
}
<?php

/**
 * Add entry to Tools menu
 */
if (!defined('IS_ADMIN_FLAG')) {
    die('Illegal Access');
}
if (function_exists('zen_register_admin_page')) {
    if (!zen_page_key_exists('emailArchive')) {
        zen_register_admin_page('emailArchive', 'BOX_TOOLS_EMAIL_ARCHIVE_MANAGER', 'FILENAME_EMAIL_HISTORY', '', 'tools', 'Y', 20);
    }
}
<?php

// use $configuration_group_id where needed
$db->Execute("INSERT INTO " . TABLE_CONFIGURATION . " (configuration_group_id, sort_order, configuration_key, configuration_title, configuration_value, configuration_description, set_function) VALUES (" . (int) $configuration_group_id . ", 1, 'HIPCHAT_ERROR_ENABLE', 'Enabel Module', 'false', 'Should this module be used', 'zen_cfg_select_option(array(\\'true\\', \\'false\\'),');");
$db->Execute("INSERT INTO " . TABLE_CONFIGURATION . " (configuration_group_id, sort_order, configuration_key, configuration_title, configuration_value, configuration_description) VALUES (" . (int) $configuration_group_id . ", 2, 'HIPCHAT_TOKEN', 'HipChat API Auth Token', '', 'This is the token that you will need to get form hipchat');");
$db->Execute("INSERT INTO " . TABLE_CONFIGURATION . " (configuration_group_id, sort_order, configuration_key, configuration_title, configuration_value, configuration_description, set_function) VALUES (" . (int) $configuration_group_id . ", 6, 'HIPCHAT_MESSAGE_FORMAT', 'Message Format', 'text', 'This is the format of message that should be sent, either TEXT or HTML', 'zen_cfg_select_option(array(\\'text\\', \\'html\\'),');");
$db->Execute("INSERT INTO " . TABLE_CONFIGURATION . " (configuration_group_id, sort_order, configuration_key, configuration_title, configuration_value, configuration_description) VALUES (" . (int) $configuration_group_id . ", 4, 'HIPCHAT_NOTIFY_ROOM', 'Notify the room?', '1', 'Should it notify the room, when it sends the message (true = 1)');");
$db->Execute("INSERT INTO " . TABLE_CONFIGURATION . " (configuration_group_id, sort_order, configuration_key, configuration_title, configuration_value, configuration_description) VALUES (" . (int) $configuration_group_id . ", 9, 'HIPCHAT_MESSAGE_COLOR', 'Color of the message', 'red', 'Background color for message. One of yellow, red, green, purple, gray, or random.');");
$db->Execute("INSERT INTO " . TABLE_CONFIGURATION . " (configuration_group_id, sort_order, configuration_key, configuration_title, configuration_value, configuration_description) VALUES (" . (int) $configuration_group_id . ", 2, 'HIPCHAT_ROOM_ID', 'Room ID to post the message to', '', 'This is either the name of the room, but more dependable is to use the room id (it also called API ID)');");
$db->Execute("INSERT INTO " . TABLE_CONFIGURATION . " (configuration_group_id, sort_order, configuration_key, configuration_title, configuration_value, configuration_description) VALUES (" . (int) $configuration_group_id . ", 3, 'HIPCHAT_ERROR_FROM', 'From name on Error messages', 'Error Log', 'This the name that it will appear the message came from');");
$db->Execute("INSERT INTO " . TABLE_CONFIGURATION . " (configuration_group_id, sort_order, configuration_key, configuration_title, configuration_value, configuration_description) VALUES (" . (int) $configuration_group_id . ", 7, 'HIPCHAT_MAX_LENGTH', 'Maximum length of message', '1000', 'This is the maximum length of the message, HipChat max is 10,000 but that is really long.');");
$db->Execute("INSERT INTO " . TABLE_CONFIGURATION . " (configuration_group_id, sort_order, configuration_key, configuration_title, configuration_value, configuration_description) VALUES (" . (int) $configuration_group_id . ", 8, 'HIPCHAT_ERROR_PREFIX', 'Prefix on Error Message', '', 'This will be added the the start of the message, this is useful for when you want to notify a person, like @user');");
$db->Execute("INSERT INTO " . TABLE_CONFIGURATION . " (configuration_group_id, sort_order, configuration_key, configuration_title, configuration_value, configuration_description) VALUES (" . (int) $configuration_group_id . ", 9, 'HIPCHAT_LAST_MESSAGE', 'Last Time Message Sent', '', 'This is the last timestamp a message was sent, set this to zero to send one on the next pageload reguardless');");
$db->Execute("INSERT INTO " . TABLE_CONFIGURATION . " (configuration_group_id, sort_order, configuration_key, configuration_title, configuration_value, configuration_description) VALUES (" . (int) $configuration_group_id . ", 5, 'HIPCHAT_LIMIT_MESSAGE', 'Limit of Message', '300', 'Change how often messages are sent, setting this at 300 will limit the number of messages to no sooner then every 5 minutes');");
$db->Execute("INSERT INTO " . TABLE_CONFIGURATION . " (configuration_group_id, sort_order, configuration_key, configuration_title, configuration_value, configuration_description, set_function) VALUES (" . (int) $configuration_group_id . ", 3, 'HIPCHAT_API_FORMAT', 'Format to send Notify', 'json', 'Desired response format: json or xml. (default: json)', 'zen_cfg_select_option(array(\\'json\\', \\'xml\\'),');");
// For Admin Pages
$zc150 = PROJECT_VERSION_MAJOR > 1 || PROJECT_VERSION_MAJOR == 1 && substr(PROJECT_VERSION_MINOR, 0, 3) >= 5;
if ($zc150) {
    // continue Zen Cart 1.5.0
    // delete configuration menu
    $db->Execute("DELETE FROM " . TABLE_ADMIN_PAGES . " WHERE page_key = 'configHipchat' LIMIT 1;");
    // add configuration menu
    if (!zen_page_key_exists('configHipchat')) {
        if ((int) $configuration_group_id > 0) {
            zen_register_admin_page('configHipchat', 'BOX_HIPCHAT_NOTIFICATION', 'FILENAME_CONFIGURATION', 'gID=' . $configuration_group_id, 'configuration', 'Y', $configuration_group_id);
            $messageStack->add('Enabled HipChat Notification Configuration Menu.', 'success');
        }
    }
}
<?php

// $Id: reg_easypopulate_4.php, v4.0.21 06-01-2012 chadderuski $
// NOTE: This is for registering the mod in zencart 1.5+ only
if (!defined('IS_ADMIN_FLAG')) {
    die('Illegal Access');
}
if (function_exists('zen_register_admin_page')) {
    if (!zen_page_key_exists('easypopulate_4')) {
        // Add easypopulate_4 to Tools menu
        zen_register_admin_page('easypopulate_4', 'BOX_TOOLS_EASYPOPULATE_4', 'FILENAME_EASYPOPULATE_4', '', 'tools', 'Y', 97);
    }
}
Example #10
0
    $db->Execute($sql);
    $sql = "INSERT INTO " . DB_PREFIX . "configuration VALUES (NULL, 'show a small loading graphic','DPU_SHOW_LOADING_IMAGE', 'true', 'true to show a small loading graphic so the user knows something is happening', '" . $dpu_configuration_id . "', 60, NULL, now(), NULL, 'zen_cfg_select_option(array(''true'', ''false''),')";
    $db->Execute($sql);
    $sql = "INSERT INTO " . DB_PREFIX . "configuration VALUES (NULL, 'Show currency symbols','DPU_SHOW_CURRENCY_SYMBOLS', 'true', '', '" . $dpu_configuration_id . "', 70, NULL, now(), NULL, 'zen_cfg_select_option(array(''true'', ''false''),')";
    $db->Execute($sql);
    $sql = "INSERT INTO " . DB_PREFIX . "configuration VALUES (NULL, 'Show product quantity','DPU_SHOW_QUANTITY', 'false', '', '" . $dpu_configuration_id . "', 80, NULL, now(), NULL, 'zen_cfg_select_option(array(''true'', ''false''),')";
    $db->Execute($sql);
    $sql = "INSERT INTO " . DB_PREFIX . "configuration VALUES (NULL, 'Where to display the second price','DPU_SECOND_PRICE', 'cartAdd', '', '" . $dpu_configuration_id . "', 90, NULL, now(), NULL, NULL)";
    $db->Execute($sql);
} else {
    $messageStack->add('Database Error: Unable to access configuration_group_id in table' . TABLE_CONFIGURATION_GROUP, 'error');
    $failed = true;
}
// Add support for admin profiles to edit configuration and orders
if (function_exists('zen_register_admin_page')) {
    if (!zen_page_key_exists('configDynamicPriceUpdater')) {
        // Get the sort order
        $page_sort_query = "SELECT MAX(sort_order) as max_sort FROM `" . TABLE_ADMIN_PAGES . "` WHERE menu_key='configuration'";
        $page_sort = $db->Execute($page_sort_query);
        $page_sort = $page_sort->fields['max_sort'] + 1;
        // Register the administrative pages
        zen_register_admin_page('configDynamicPriceUpdater', 'BOX_CONFIGURATION_DYNAMIC_PRICE_UPDATER', 'FILENAME_CONFIGURATION', 'gID=' . $dpu_configuration_id, 'configuration', 'Y', $page_sort);
    }
}
if (file_exists(DIR_FS_ADMIN . DIR_WS_INCLUDES . 'auto_loaders/config.dpu.php')) {
    if (!unlink(DIR_FS_ADMIN . DIR_WS_INCLUDES . 'auto_loaders/config.dpu.php')) {
        $messageStack->add('The auto-loader file ' . DIR_FS_ADMIN . 'includes/auto_loaders/config.dpu.php has not been deleted. For this module to work you must delete the ' . DIR_FS_ADMIN . 'includes/auto_loaders/config.dpu.php file manually.  Before you post on the Zen Cart forum to ask, YES you are REALLY supposed to follow these instructions and delete the ' . DIR_FS_ADMIN . 'includes/auto_loaders/config.dpu.php file.', 'error');
        $failed = true;
    }
}
if (!$failed) {
Example #11
0
function ultimate_seo_uninstall()
{
    global $db, $messageStack;
    $failed = false;
    zen_db_perform(TABLE_CONFIGURATION, array('configuration_value' => 'false'), 'update', '`configuration_key`=\'SEO_ENABLED\'');
    $db->Execute('DELETE FROM `' . TABLE_CONFIGURATION_GROUP . '` ' . 'WHERE `configuration_group_title` = \'' . SEO_CONFIGURATION_GROUP_TITLE . '\'');
    $check = $db->Execute('SELECT `configuration_group_title` FROM `' . TABLE_CONFIGURATION_GROUP . '` ' . 'WHERE `configuration_group_title` = \'' . SEO_CONFIGURATION_GROUP_TITLE . '\'');
    if (!$check->EOF) {
        $messageStack->add(sprintf(SEO_UNINSTALL_ERROR_DELETE, 'configuration group: ' . SEO_CONFIGURATION_GROUP_TITLE, TABLE_CONFIGURATION_GROUP), 'error');
        $failed = true;
    }
    $db->Execute('DELETE FROM `' . TABLE_CONFIGURATION_GROUP . '` ' . 'WHERE `configuration_group_title` = \'SEO URLs\'');
    $check = $db->Execute('SELECT `configuration_group_title` FROM `' . TABLE_CONFIGURATION_GROUP . '` ' . 'WHERE `configuration_group_title` = \'SEO URLs\'');
    if (!$check->EOF) {
        $messageStack->add(sprintf(SEO_UNINSTALL_ERROR_DELETE, 'configuration group: ' . SEO_CONFIGURATION_GROUP_TITLE, 'SEO URLs'), 'error');
        $failed = true;
    }
    foreach (ultimate_seo_default_settings() as $option => $value) {
        if (defined($option)) {
            $db->Execute('DELETE FROM `' . TABLE_CONFIGURATION . '` ' . 'WHERE `configuration_key`=\'' . $option . '\'');
            $check = $db->Execute('SELECT `configuration_id` FROM `' . TABLE_CONFIGURATION . '` ' . 'WHERE `configuration_key` = \'' . $option . '\'');
            if (!$check->EOF) {
                $messageStack->add(sprintf(SEO_UNINSTALL_ERROR_DELETE, 'configuration option: ' . $option, TABLE_CONFIGURATION), 'error');
                $failed = true;
            }
        }
    }
    $db->Execute('DROP TABLE IF EXISTS ' . TABLE_SEO_CACHE);
    $check = $db->Execute('SELECT TABLE_NAME FROM INFORMATION_SCHEMA.TABLES ' . 'WHERE TABLE_SCHEMA = \'' . DB_DATABASE . '\' ' . 'AND TABLE_NAME = \'' . TABLE_SEO_CACHE . '\'');
    if (!$check->EOF) {
        $messageStack->add(sprintf(SEO_UNINSTALL_ERROR_TABLE, TABLE_SEO_CACHE), 'error');
        $failed = true;
    }
    if (function_exists('zen_deregister_admin_pages')) {
        if (zen_page_key_exists('configUltimateSEO')) {
            zen_deregister_admin_pages('configUltimateSEO');
        }
        if (zen_page_key_exists('UltimateSEO')) {
            zen_deregister_admin_pages('UltimateSEO');
        }
        if (zen_page_key_exists('configUltimateSEO') || zen_page_key_exists('UltimateSEO')) {
            $messageStack->add(SEO_UNINSTALL_ERROR_ADMIN_PAGES);
            $failed = true;
        }
    }
    return $failed;
}
Example #12
0
<?php

/**
 * Slideshow creator
 *
 * @package slideshow
 * @author Vassilios Barzokas <*****@*****.**> 
 * @author website www.vbarzokas.com
 * @copyright Copyright 2011 Vassilios Barzokas
 * @license http://www.gnu.org/copyleft/gpl.html   GNU Public License V2.0
 * @version $Id: slideshow.php 1.1 2012-01-22 11:50:04Z $
 */
if (!defined('IS_ADMIN_FLAG')) {
    die('Illegal Access');
}
if (function_exists('zen_register_admin_page')) {
    if (!zen_page_key_exists('slideshow')) {
        // Add slideshow to Tools menu
        zen_register_admin_page('slideshow', 'BOX_TOOLS_SLIDESHOW', 'FILENAME_SLIDESHOW', '', 'tools', 'Y', 17);
    }
}
<?php

/**
 *
 * Bitcoin Payment Module
 * 
 * @package paymentMethod
 *
 *  Author: Jalder (https://github.com/jalder/Zen-Cart-Bitcoin-Payment-Module/)
 *  Moddified by:  MasterX1582 (https://github.com/MasterX1582/Zen-Cart-Bitcoin-Payment-Module/)
 *  Donations: 1JBKYhNvF1B8eLEcCUq3jw8wvrzDCPCGiB
 *
 **/
if (!defined('IS_ADMIN_FLAG')) {
    die('Illegal Access');
}
//----
// If the installation supports admin-page registration (i.e. v1.5.0 and later), then
// register the New Tools tool into the admin menu structure.
//
if (function_exists('zen_register_admin_page')) {
    if (!zen_page_key_exists('reportsBitcoinPayment')) {
        zen_register_admin_page('reportsBitcoinPayment', 'BOX_REPORTS_PAYMENT_BITCOIN', 'FILENAME_PAYMENT_BITCOIN', '', 'reports', 'Y', 20);
    }
}
Example #14
0
 public function handleUpgradeFrom($version)
 {
     global $db, $messageStack;
     $success = true;
     $default = $this->getDefaultConfiguration();
     // Handle the upgrades. This can be quite complex.
     switch ($version) {
         case '2.150':
             if (defined('SEO_REMOVE_ALL_SPEC_CHARS')) {
                 $data = $default['REMOVE_CHARS'];
                 $data['configuration_key'] = 'USU_REMOVE_CHARS';
                 $data['configuration_value'] = SEO_REMOVE_ALL_SPEC_CHARS == 'true' ? 'non-alphanumerical' : 'punctuation';
                 $this->updateConfigurationOption('SEO_REMOVE_ALL_SPEC_CHARS', $data);
             }
             if (defined('SEO_ADD_PRODUCT_CAT')) {
                 $data = $default['FORMAT'];
                 $data['configuration_key'] = 'USU_FORMAT';
                 $data['configuration_value'] = SEO_ADD_PRODUCT_CAT == 'true' ? 'parent' : 'original';
                 if (defined('SEO_ADD_CAT_PARENT') && SEO_ADD_CAT_PARENT == 'true') {
                     $data['configuration_value'] = 'original';
                 }
                 $this->updateConfigurationOption('SEO_ADD_PRODUCT_CAT', $data);
             }
             if (defined('SEO_ADD_CAT_PARENT')) {
                 $data = $default['CATEGORY_DIR'];
                 $data['configuration_key'] = 'USU_CATEGORY_DIR';
                 $data['configuration_value'] = SEO_ADD_CAT_PARENT == 'false' ? 'off' : 'full';
                 $this->updateConfigurationOption('SEO_ADD_CAT_PARENT', $data);
             }
             if (defined('SEO_ADD_CPATH_TO_PRODUCT_URLS')) {
                 $data = $default['CPATH'];
                 $data['configuration_key'] = 'USU_CPATH';
                 $data['configuration_value'] = SEO_ADD_CPATH_TO_PRODUCT_URLS == 'false' ? 'off' : 'auto';
                 $this->updateConfigurationOption('SEO_ADD_CPATH_TO_PRODUCT_URLS', $data);
             }
             // Remove older options which are no longer used
             $old_options = array('USE_SEO_CACHE_ARTICLES', 'USE_SEO_CACHE_INFO_PAGES', 'SEO_URLS_USE_W3C_VALID');
             foreach ($old_options as $option) {
                 if (defined($option)) {
                     $this->removeConfigurationOption($option);
                 }
             }
             // Zen Cart 1.5.x specific changes
             if (function_exists('zen_deregister_admin_pages') && zen_page_key_exists('UltimateSEO')) {
                 zen_deregister_admin_pages('UltimateSEO');
                 if (zen_page_key_exists('UltimateSEO')) {
                     $messageStack->add(SEO_UNINSTALL_ERROR_ADMIN_PAGES);
                     $success = false;
                 }
             }
             // Update the configuration title if it exists
             $check = $db->Execute('SELECT `configuration_group_id` FROM `' . TABLE_CONFIGURATION_GROUP . '` ' . 'WHERE `configuration_group_title` = \'SEO URLs\'');
             if (!$check->EOF) {
                 zen_db_perform(TABLE_CONFIGURATION_GROUP, array('configuration_group_title' => $this->getUniqueName()), 'update', '`configuration_group_id`=\'' . $check->fields['configuration_group_id'] . '\'');
             }
         case '2.210':
             // Enforce full and parent are not compatible
             if (defined('SEO_URL_CATEGORY_DIR') && defined('SEO_URL_FORMAT') && SEO_URL_CATEGORY_DIR == 'full' && SEO_URL_FORMAT == 'parent') {
                 $data = $default['FORMAT'];
                 $data['configuration_value'] = 'original';
                 $this->updateConfigurationOption('USU_FORMAT', $data);
             }
         case '2.211':
             // Remove older option which is no longer used (if present)
             if (defined('SEO_REMOVE_ALL_SPEC_CHARS')) {
                 $this->removeConfigurationOption('SEO_REMOVE_ALL_SPEC_CHARS');
             }
             if (defined('SEO_URLS_REMOVE_CHARS')) {
                 $data = $default['REMOVE_CHARS'];
                 $data['configuration_key'] = 'USU_REMOVE_CHARS';
                 $data['configuration_value'] = SEO_URLS_REMOVE_CHARS == 'alphanumerical' ? 'non-alphanumerical' : 'punctuation';
                 $this->updateConfigurationOption('SEO_URLS_REMOVE_CHARS', $data);
             }
         case '2.212':
             // All the settings changed names after this version.
             // We will need to handle all the changes to not lose settings.
             if (defined('SEO_ENABLED')) {
                 $data = $default['ENABLED'];
                 $data['configuration_key'] = 'USU_ENABLED';
                 unset($data['configuration_value']);
                 $this->updateConfigurationOption('SEO_ENABLED', $data);
             }
             if (defined('SEO_URL_CPATH')) {
                 $data = $default['CPATH'];
                 $data['configuration_key'] = 'USU_CPATH';
                 unset($data['configuration_value']);
                 $this->updateConfigurationOption('SEO_URL_CPATH', $data);
             }
             if (defined('SEO_URL_END')) {
                 $data = $default['END'];
                 $data['configuration_key'] = 'USU_END';
                 unset($data['configuration_value']);
                 $this->updateConfigurationOption('SEO_URL_END', $data);
             }
             if (defined('SEO_URL_FORMAT')) {
                 $data = $default['FORMAT'];
                 $data['configuration_key'] = 'USU_FORMAT';
                 unset($data['configuration_value']);
                 $this->updateConfigurationOption('SEO_URL_FORMAT', $data);
             }
             if (defined('SEO_URL_CATEGORY_DIR')) {
                 $data = $default['CATEGORY_DIR'];
                 $data['configuration_key'] = 'USU_CATEGORY_DIR';
                 unset($data['configuration_value']);
                 $this->updateConfigurationOption('SEO_URL_CATEGORY_DIR', $data);
             }
             if (defined('SEO_URLS_REMOVE_CHARS')) {
                 $data = $default['REMOVE_CHARS'];
                 $data['configuration_key'] = 'USU_REMOVE_CHARS';
                 unset($data['configuration_value']);
                 $this->updateConfigurationOption('SEO_URLS_REMOVE_CHARS', $data);
             }
             $pcre = '';
             if (defined('SEO_URLS_FILTER_CHARS')) {
                 if (zen_not_null(SEO_URLS_FILTER_CHARS)) {
                     $pcre = SEO_URLS_FILTER_CHARS . ',';
                 }
                 $this->removeConfigurationOption('SEO_URLS_FILTER_CHARS');
             }
             if (defined('SEO_URLS_FILTER_PCRE')) {
                 $data = $default['FILTER_PCRE'];
                 $data['configuration_key'] = 'USU_FILTER_PCRE';
                 $data['configuration_value'] = $pcre . SEO_URLS_FILTER_PCRE;
                 $this->updateConfigurationOption('SEO_URLS_FILTER_PCRE', $data);
             }
             if (defined('SEO_URLS_FILTER_SHORT_WORDS')) {
                 $data = $default['FILTER_SHORT_WORDS'];
                 $data['configuration_key'] = 'USU_FILTER_SHORT_WORDS';
                 unset($data['configuration_value']);
                 $this->updateConfigurationOption('SEO_URLS_FILTER_SHORT_WORDS', $data);
             }
             if (defined('SEO_URLS_ONLY_IN')) {
                 $data = $default['FILTER_PAGES'];
                 $data['configuration_key'] = 'USU_FILTER_PAGES';
                 unset($data['configuration_value']);
                 $this->updateConfigurationOption('SEO_URLS_ONLY_IN', $data);
             }
             if (defined('SEO_REWRITE_TYPE')) {
                 $data = $default['ENGINE'];
                 $data['configuration_key'] = 'USU_ENGINE';
                 $this->updateConfigurationOption('SEO_REWRITE_TYPE', $data);
             }
             if (defined('SEO_USE_REDIRECT')) {
                 $data = $default['REDIRECT'];
                 $data['configuration_key'] = 'USU_REDIRECT';
                 unset($data['configuration_value']);
                 $this->updateConfigurationOption('SEO_USE_REDIRECT', $data);
             }
             if (defined('SEO_USE_CACHE_GLOBAL')) {
                 $data = $default['CACHE_GLOBAL'];
                 $data['configuration_key'] = 'USU_CACHE_GLOBAL';
                 unset($data['configuration_value']);
                 $this->updateConfigurationOption('SEO_USE_CACHE_GLOBAL', $data);
             }
             if (defined('SEO_USE_CACHE_PRODUCTS')) {
                 $data = $default['CACHE_PRODUCTS'];
                 $data['configuration_key'] = 'USU_CACHE_PRODUCTS';
                 unset($data['configuration_value']);
                 $this->updateConfigurationOption('SEO_USE_CACHE_PRODUCTS', $data);
             }
             if (defined('SEO_USE_CACHE_CATEGORIES')) {
                 $data = $default['CACHE_CATEGORIES'];
                 $data['configuration_key'] = 'USU_CACHE_CATEGORIES';
                 unset($data['configuration_value']);
                 $this->updateConfigurationOption('SEO_USE_CACHE_CATEGORIES', $data);
             }
             if (defined('SEO_USE_CACHE_MANUFACTURERS')) {
                 $data = $default['CACHE_MANUFACTURERS'];
                 $data['configuration_key'] = 'USU_CACHE_MANUFACTURERS';
                 unset($data['configuration_value']);
                 $this->updateConfigurationOption('SEO_USE_CACHE_MANUFACTURERS', $data);
             }
             if (defined('SEO_USE_CACHE_EZ_PAGES')) {
                 $data = $default['CACHE_EZ_PAGES'];
                 $data['configuration_key'] = 'USU_CACHE_EZ_PAGES';
                 unset($data['configuration_value']);
                 $this->updateConfigurationOption('SEO_USE_CACHE_EZ_PAGES', $data);
             }
             if (defined('SEO_URLS_CACHE_RESET')) {
                 $data = $default['CACHE_RESET'];
                 $data['configuration_key'] = 'USU_CACHE_RESET';
                 unset($data['configuration_value']);
                 $this->updateConfigurationOption('SEO_URLS_CACHE_RESET', $data);
             }
             // Zen Cart 1.5.x specific changes
             if (function_exists('zen_deregister_admin_pages') && zen_page_key_exists('configUltimateSEO')) {
                 zen_deregister_admin_pages('configUltimateSEO');
                 if (zen_page_key_exists('configUltimateSEO')) {
                     $messageStack->add(SEO_UNINSTALL_ERROR_ADMIN_PAGES);
                     $success = false;
                 }
             }
             // Update the configuration title if an old one exists
             $check = $db->Execute('SELECT `configuration_group_id` FROM `' . TABLE_CONFIGURATION_GROUP . '` ' . 'WHERE `configuration_group_title` = \'Ultimate SEO\'');
             if (!$check->EOF) {
                 zen_db_perform(TABLE_CONFIGURATION_GROUP, array('configuration_group_title' => $this->getUniqueName()), 'update', '`configuration_group_id`=\'' . $check->fields['configuration_group_id'] . '\'');
             }
             // Remove old versions of the cache
             if ($this->dbTableExists(DB_PREFIX . 'seo_cache')) {
                 $db->Execute('DROP TABLE `' . DB_PREFIX . 'seo_cache`');
             }
         default:
             // Remove beta versions of the cache
             if (version_compare($version, '2.215', '<') && $this->dbTableExists(TABLE_USU_CACHE)) {
                 $db->Execute('DROP TABLE `' . TABLE_USU_CACHE . '`');
             }
     }
     return $success;
 }
                }
                break;
            default:
                $st_version = '1.2';
                // break all the loops
                break 2;
        }
    }
} else {
    // begin update to version 1.1
    // do a new install
    if (file_exists(DIR_WS_INCLUDES . 'installers/supertracker/new_install.php')) {
        include_once DIR_WS_INCLUDES . 'installers/supertracker/new_install.php';
        $messageStack->add('Added Supertracker Configuration', 'success');
    } else {
        $messageStack->add('New installation file missing, please make sure you have uploaded all files in the package.', 'error');
    }
}
if ($zc150) {
    // continue Zen Cart 1.5.0
    // add configuration menu
    if (!zen_page_key_exists('configSuperTracker')) {
        $configuration = $db->Execute("SELECT configuration_group_id FROM " . TABLE_CONFIGURATION . " WHERE configuration_key = 'SUPERTRACKER_MODULE_VERSION' LIMIT 1;");
        $configuration_group_id = $configuration->fields['configuration_group_id'];
        if ((int) $configuration_group_id > 0) {
            zen_register_admin_page('configSuperTracker', 'BOX_CONFIGURATION_SUPERTRACKER', 'FILENAME_CONFIGURATION', 'gID=' . $configuration_group_id, 'configuration', 'Y', $configuration_group_id);
            zen_register_admin_page('reportsSuperTracker', 'BOX_REPORTS_SUPERTRACKER', 'FILENAME_SUPERTRACKER', '', 'reports', 'Y', $configuration_group_id);
            $messageStack->add('Enabled Supertracker Configuration menu.', 'success');
        }
    }
}
Example #16
0
<?php

/*
 $Id: reg_backup_mysql.php, v 1.4 2011/11/24  $																    
                                                     
  By PRO-Webs.net 12.9.2011
                                                      
  Powered by Zen-Cart (www.zen-cart.com)              
  Portions Copyright (c) 2006 The Zen Cart Team       
                                                      
  Released under the GNU General Public License       
  available at www.zen-cart.com/license/2_0.txt       
  or see "license.txt" in the downloaded zip          

  DESCRIPTION: Add Backup SQL to Tools Mneu
*/
if (!defined('IS_ADMIN_FLAG')) {
    die('Illegal Access');
}
if (function_exists('zen_register_admin_page')) {
    if (!zen_page_key_exists('backup_mysql')) {
        // Add backup_mysql to Tools menu
        zen_register_admin_page('backup_mysql', 'BOX_TOOLS_BACKUP_MYSQL', 'FILENAME_BACKUP_MYSQL', '', 'tools', 'Y', 17);
    }
}
 * @version GIT: $Id: Author: DrByte  Tue Jul 17 11:18:56 2012 -0400 Modified in v1.5.1 $
 */
require 'includes/application_top.php';
// initialise form values
$page_key = $language_key = $main_page = $page_params = $menu_key = $checked = '';
$sort_order = 0;
// check if we are receiving form content and if so validate and process it
if (isset($_POST) && !empty($_POST)) {
    $error = FALSE;
    if (isset($_POST['page_key'])) {
        $page_key = zen_db_prepare_input($_POST['page_key']);
    }
    if (empty($page_key)) {
        $error = TRUE;
        $messageStack->add(ERROR_PAGE_KEY_NOT_ENTERED, 'error');
    } elseif (zen_page_key_exists($page_key)) {
        $error = TRUE;
        $messageStack->add(ERROR_PAGE_KEY_ALREADY_EXISTS, 'error');
    }
    if (isset($_POST['language_key'])) {
        $language_key = zen_db_prepare_input($_POST['language_key']);
    }
    if (empty($page_key)) {
        $error = TRUE;
        $messageStack->add(ERROR_LANGUAGE_KEY_NOT_ENTERED, 'error');
    } elseif (!defined($language_key)) {
        $error = TRUE;
        $messageStack->add(ERROR_LANGUAGE_KEY_HAS_NOT_BEEN_DEFINED, 'error');
    }
    if (isset($_POST['main_page'])) {
        $main_page = zen_db_prepare_input($_POST['main_page']);
Example #18
0
    $db->Execute("INSERT INTO " . TABLE_CONFIGURATION . " ( configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added, use_function, set_function ) VALUES ( 'Split File: Record Count', 'DBIO_SPLIT_RECORD_COUNT', '2000', 'Sometimes, splitting a .csv file into multiple, smaller files can help if your server is timing out on an <em>import</em> operation or if an exported .csv is too large to download in a single chunk.  Enter the number of records (default: 2000) at which to split these files using the <em>Database I/O Manager</em>.', {$cgi}, 25, now(), NULL, NULL)");
    $db->Execute("INSERT INTO " . TABLE_CONFIGURATION . " ( configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added, use_function, set_function ) VALUES ( 'Default File Sort Order', 'DBIO_FILE_SORT_DEFAULT', '3d', 'Choose the default sort-order that the <em>Database I/O Manager</em> uses when displaying the I/O files it has discovered, one of:<br /><br /><b>1a</b>: File Name, ascending<br /><b>1d</b>: File Name, descending<br /><b>2a</b>: File Size, ascending<br /><b>2d</b>: File Size, descending<br /><b>3a</b>: File Date, ascending<br /><b>3d</b>: File Date, descending (default)', {$cgi}, 26, now(), NULL, 'zen_cfg_select_option(array(\\'1a\\', \\'1d\\', \\'2a\\', \\'2d\\', \\'3a\\', \\'3d\\'),')");
    $db->Execute("INSERT INTO " . TABLE_CONFIGURATION . " ( configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added, use_function, set_function ) VALUES ( 'Enable Debug?', 'DBIO_DEBUG', 'false', 'Identify whether (true) or not (false, the default) the DbIo debug is to be enabled.  When enabled, <b>all</b> I/O status is written to a <em>dbio-*.log</em> file in your store\\'s /YOUR_ADMIN/dbio/logs folder.', {$cgi}, 600, now(), NULL, 'zen_cfg_select_option(array(\\'true\\', \\'false\\'),')");
    $db->Execute("INSERT INTO " . TABLE_CONFIGURATION . " ( configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added, use_function, set_function ) VALUES ( 'Debug Date Format', 'DBIO_DEBUG_DATE_FORMAT', 'Y-m-d H:i:s', 'Enter the formatting string used to timestamp all DbIo log entries.', {$cgi}, 601, now(), NULL, NULL)");
    define('DBIO_MODULE_VERSION', $version_release_date);
}
// -----
// Update the configuration table to reflect the current version, if it's not already set.
//
if (DBIO_MODULE_VERSION != $version_release_date) {
    $db->Execute("UPDATE " . TABLE_CONFIGURATION . " SET configuration_value = '" . $version_release_date . "' WHERE configuration_key = 'DBIO_MODULE_VERSION' LIMIT 1");
}
// ----
// Create the database tables for the I/O processing.
//
$sql = "CREATE TABLE IF NOT EXISTS " . TABLE_DBIO_STATS . " (\n    dbio_stats_id int(11) NOT NULL auto_increment,\n    report_name varchar(255) NOT NULL default '',\n    action varchar(128) NOT NULL default '',\n    record_count int(11) NOT NULL default '0',\n    errors int(11) NOT NULL default '0',\n    warnings int(11) NOT NULL default '0',  \n    inserts int(11) NOT NULL default '0',  \n    updates int(11) NOT NULL default '0',\n    parse_time float NOT NULL default '0',\n    memory_usage int(11) NOT NULL default '0',\n    memory_peak_usage int(11) NOT NULL default '0',\n    date_added datetime NOT NULL default '0001-01-01 00:00:00',\n    PRIMARY KEY  (dbio_stats_id)\n) ENGINE=MyISAM";
$db->Execute($sql);
if (!$sniffer->field_exists(TABLE_DBIO_STATS, 'report_name')) {
    $db->Execute("ALTER TABLE " . TABLE_DBIO_STATS . " ADD report_name varchar(255) NOT NULL default '' AFTER dbio_stats_id");
}
// -----
// Register the admin-level pages for use.
//
if (function_exists('zen_page_key_exists')) {
    if (!zen_page_key_exists('toolsDbIo')) {
        zen_register_admin_page('toolsDbIo', 'BOX_TOOLS_DBIO', 'FILENAME_DBIO_MANAGER', '', 'tools', 'Y', init_dbio_next_sort('tools'));
    }
    if (!zen_page_key_exists('configDbIo')) {
        zen_register_admin_page('configDbIo', 'BOX_CONFIGURATION_DBIO', 'FILENAME_CONFIGURATION', "gID={$cgi}", 'configuration', 'Y', init_dbio_next_sort('configuration'));
    }
}
Example #19
0
<?php

$db->Execute("REPLACE INTO " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, last_modified, date_added, use_function, set_function) VALUES\n('Fast and Easy Checkout', 'FEC_STATUS', 'false', 'Activate Fast and Easy Checkout? (note: Easy Sign-up and Login must be disabled separately)', " . $configuration_group_id . ", 10, NOW(), NOW(), NULL, 'zen_cfg_select_option(array(\\'true\\', \\'false\\'),'),\n('One Page Checkout', 'FEC_ONE_PAGE', 'true', 'Activate One Page Checkout?<br />Default = false (includes checkout_confirmation page)', " . $configuration_group_id . ", 11, NOW(), NOW(), NULL, 'zen_cfg_select_option(array(\\'true\\', \\'false\\'),'),\n('Checkout Confirmation Alternate Text', 'FEC_CHECKOUT_CONFIRMATION_TEXT', 'Your order is being processed, please wait...', 'Alternate text to be displayed on Checkout Confirmation page:', " . $configuration_group_id . ", 12, NOW(), NOW(), NULL, NULL),\n('Display Checkout in Split Column', 'FEC_SPLIT_CHECKOUT', 'true', 'Display the checkout page in a split column format?', " . $configuration_group_id . ", 13, NOW(), NOW(), NULL, 'zen_cfg_select_option(array(\\'true\\', \\'false\\'),'),\n('Activate Drop Down List', 'FEC_DROP_DOWN', 'false', 'Activate drop down list to appear on checkout page?', " . $configuration_group_id . ", 14, NOW(), NOW(), NULL, 'zen_cfg_select_option(array(\\'true\\', \\'false\\'),'),\n('Gift Wrapping Module Switch', 'FEC_GIFT_WRAPPING_SWITCH', 'false', 'If the gift wrapping module is installed, set to true to activate', " . $configuration_group_id . ", 15, NOW(), NOW(), NULL, 'zen_cfg_select_option(array(\\'true\\', \\'false\\'),'),\n('Activate Gift Message Field', 'FEC_GIFT_MESSAGE', 'false', 'Activate gift message field to appear on checkout page?', " . $configuration_group_id . ", 16, NOW(), NOW(), NULL, 'zen_cfg_select_option(array(\\'true\\', \\'false\\'),'),\n('Drop Down List Options', 'FEC_DROP_DOWN_LIST', 'Option 1,Option 2,Option 3,Option 4,Option 5', 'Enter each option separated by commas:', " . $configuration_group_id . ", 17, NOW(), NOW(), NULL, NULL),\n('Activate Checkbox Field', 'FEC_CHECKBOX', 'false', 'Activate checkbox field to appear on checkout page?', " . $configuration_group_id . ", 18, NOW(), NOW(), NULL, 'zen_cfg_select_option(array(\\'true\\', \\'false\\'),'),\n\n('Easy Sign-Up and Login', 'FEC_EASY_SIGNUP_STATUS', 'false', 'Activate Easy Sign-Up and Login?', " . $configuration_group_id . ", 20, NOW(), NOW(), NULL, 'zen_cfg_select_option(array(\\'true\\', \\'false\\'),'),\n('Display Order Total', 'FEC_ORDER_TOTAL', 'false', 'Display the Order Total sidebox on login?', " . $configuration_group_id . ", 21, NOW(), NOW(), NULL, 'zen_cfg_select_option(array(\\'true\\', \\'false\\'),'),\n('Display Confidence Box', 'FEC_CONFIDENCE', 'false', 'Display the \"Shop With Confidence\" sidebox on login?', " . $configuration_group_id . ", 22, NOW(), NOW(), NULL, 'zen_cfg_select_option(array(\\'true\\', \\'false\\'),'),\n('COWOA Position', 'FEC_NOACCOUNT_POSITION', 'side', 'Display the COWOA fieldset above the registration form (top) or beneath the login (side)?', " . $configuration_group_id . ", 23, NOW(), NOW(), NULL, 'zen_cfg_select_option(array(\\'top\\', \\'side\\'),'),\n('Confirm Email', 'FEC_CONFIRM_EMAIL', 'false', 'Require user to enter email twice for confirmation?', " . $configuration_group_id . ", 24, NOW(), NOW(), NULL, 'zen_cfg_select_option(array(\\'true\\', \\'false\\'),'),\n('Shipping Address', 'FEC_SHIPPING_ADDRESS', 'true', 'Display the shipping address form on the login and COWOA pages?', " . $configuration_group_id . ", 25, NOW(), NOW(), NULL, 'zen_cfg_select_option(array(\\'true\\', \\'false\\'),'),\n('Copy Billing', 'FEC_COPYBILLING', 'true', 'If the shipping address form is enabled, should the copy billing address checkbox be checked by default?', " . $configuration_group_id . ", 26, NOW(), NOW(), NULL, 'zen_cfg_select_option(array(\\'true\\', \\'false\\'),'),\n('Master Password', 'FEC_MASTER_PASSWORD', 'false', 'Allow login to customer account using master password? (Must be using ZenCart v1.5.0 or higher)', " . $configuration_group_id . ", 27, NOW(), NOW(), NULL, 'zen_cfg_select_option(array(\\'true\\', \\'false\\'),'),\n\n('Checkout Without Account', 'FEC_NOACCOUNT_SWITCH', 'true', 'Activate Checkout Without an Account?', " . $configuration_group_id . ", 30, NOW(), NOW(), NULL, 'zen_cfg_select_option(array(\\'true\\', \\'false\\'),'),\n('Checkout Without Account Only', 'FEC_NOACCOUNT_ONLY_SWITCH', 'false', 'Disable regular login/registration and force Checkout Without an Account?', " . $configuration_group_id . ", 31, NOW(), NOW(), NULL, 'zen_cfg_select_option(array(\\'true\\', \\'false\\'),'),\n('Combine COWOA Accounts', 'FEC_NOACCOUNT_COMBINE', 'false', 'Combine COWOA accounts so that COWOA customers can access their orders and other account features (note this will only work on future registrations)?', " . $configuration_group_id . ", 31, NOW(), NOW(), NULL, 'zen_cfg_select_option(array(\\'true\\', \\'false\\'),'),\n('Hide Email Options For No Account', 'FEC_NOACCOUNT_HIDEEMAIL', 'true', 'Hide \"HTML/TEXT-Only\" for checkout without account?', " . $configuration_group_id . ", 32, NOW(), NOW(), NULL, 'zen_cfg_select_option(array(\\'true\\', \\'false\\'),'),\n('Automatic LogOff for No Account', 'FEC_NOACCOUNT_LOGOFF', 'true', 'Automatically logoff customers without accounts?', " . $configuration_group_id . ", 33, NOW(), NOW(), NULL, 'zen_cfg_select_option(array(\\'true\\', \\'false\\'),'),\n('Free/Virtual Checkout', 'FEC_FREE_VIRTUAL_CHECKOUT', 'false', 'Only require name and email address for products that are both free and virtual?', " . $configuration_group_id . ", 34, NOW(), NOW(), NULL, 'zen_cfg_select_option(array(\\'true\\', \\'false\\'),');");
global $sniffer;
if (!$sniffer->field_exists(TABLE_CUSTOMERS, 'COWOA_account')) {
    $db->Execute("ALTER TABLE " . TABLE_CUSTOMERS . " ADD COWOA_account tinyint(1) NOT NULL default 0;");
}
if (!$sniffer->field_exists(TABLE_ORDERS, 'COWOA_order')) {
    $db->Execute("ALTER TABLE " . TABLE_ORDERS . " ADD COWOA_order tinyint(1) NOT NULL default 0;");
}
$db->Execute("INSERT IGNORE INTO " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added) VALUES ('Telephone Number', 'ACCOUNT_TELEPHONE', 'true', 'Display telephone number field during account creation and with account information', '5', '8', 'zen_cfg_select_option(array(\\'true\\', \\'false\\'), ', now());");
$db->Execute("INSERT IGNORE INTO " . TABLE_QUERY_BUILDER . " (query_id, query_category, query_name, query_description, query_string) VALUES ('', 'email,newsletters', 'Permanent Account Holders Only', 'Send email only to permanent account holders ', 'select customers_email_address, customers_firstname, customers_lastname from TABLE_CUSTOMERS where COWOA_account != 1 order by customers_lastname, customers_firstname, customers_email_address');");
$zc150 = PROJECT_VERSION_MAJOR > 1 || PROJECT_VERSION_MAJOR == 1 && substr(PROJECT_VERSION_MINOR, 0, 3) >= 5;
if ($zc150) {
    // continue Zen Cart 1.5.0
    // delete configuration menu
    $db->Execute("DELETE FROM " . TABLE_ADMIN_PAGES . " WHERE page_key = 'configFastandEasyCheckout' LIMIT 1;");
    // add configuration menu
    if (!zen_page_key_exists('configFastandEasyCheckout')) {
        if ((int) $configuration_group_id > 0) {
            zen_register_admin_page('configFastandEasyCheckout', 'BOX_CONFIGURATION_FEC', 'FILENAME_CONFIGURATION', 'gID=' . $configuration_group_id, 'configuration', 'Y', $configuration_group_id);
            $messageStack->add('Enabled Fast and Easy Checkout Configuration menu.', 'success');
        }
    }
}
Example #20
0
<?php

// use $configuration_group_id where needed
// For Admin Pages
$zc150 = PROJECT_VERSION_MAJOR > 1 || PROJECT_VERSION_MAJOR == 1 && substr(PROJECT_VERSION_MINOR, 0, 3) >= 5;
if ($zc150) {
    // continue Zen Cart 1.5.0
    // delete configuration menu
    $db->Execute("DELETE FROM " . TABLE_ADMIN_PAGES . " WHERE page_key = 'config_product_tare_groups' LIMIT 1;");
    // add configuration menu
    if (!zen_page_key_exists('config_product_tare_groups')) {
        zen_register_admin_page('config_product_tare_groups', 'BOX_PRODUCT_TARE_GROUPS', 'FILENAME_CONFIGURATION', 'gID=' . $configuration_group_id, 'configuration', 'Y', $configuration_group_id);
        $messageStack->add('Enabled Product Tare Groups Configuration Menu.', 'success');
    }
}
$generic_description = "Enter the desired tare as percent and or lbs for this group.<br>Example: 10% + 1lb 10:1<br>10% + 0lbs 10:0<br>0% + 5lbs 0:5<br>0% + 0lbs 0:0<br>";
// add configuration group
$db->Execute("INSERT INTO " . TABLE_CONFIGURATION . "  (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, last_modified, date_added)  VALUES \n          ('Product Tare Group 1', 'PRODUCT_TARE_GROUP_1', '0:2', '" . $generic_description . "'," . $configuration_group_id . ", '15', NOW(), NOW()),\n          ('Product Tare Group 2', 'PRODUCT_TARE_GROUP_2', '0:4', '" . $generic_description . "'," . $configuration_group_id . ", '20', NOW(), NOW()),\n          ('Product Tare Group 3', 'PRODUCT_TARE_GROUP_3', '0:6', '" . $generic_description . "'," . $configuration_group_id . ", '30', NOW(), NOW()),\n          ('Product Tare Group 4', 'PRODUCT_TARE_GROUP_4', '0:8', '" . $generic_description . "'," . $configuration_group_id . ", '40', NOW(), NOW()),\n          ('Product Tare Group 5', 'PRODUCT_TARE_GROUP_5', '0:10', '" . $generic_description . "'," . $configuration_group_id . ", '50', NOW(), NOW())\n          ");
<?php

if (!defined('IS_ADMIN_FLAG')) {
    die('Illegal Access');
}
if (function_exists('zen_register_admin_page')) {
    if (!zen_page_key_exists('Quick Updates')) {
        zen_register_admin_page('Quick Updates', 'BOX_CATALOG_QUICK_UPDATES', 'FILENAME_QUICK_UPDATES', '', 'catalog', 'Y', 103);
    }
}
Example #22
0
<?php

// create table for back in stock
$db->Execute("CREATE TABLE IF NOT EXISTS " . TABLE_BACK_IN_STOCK . " (\n\t`bis_id` int(11) NOT NULL AUTO_INCREMENT,\n\t`product_id` int(11) NOT NULL default '0',\n        `variant` int(11) NOT NULL default '0',\n\t`sub_date` int(11) NOT NULL default '0',\n        `purch_date` int(11) NOT NULL default '0',\n        `name` varchar(96) NOT NULL,\n        `email` varchar(96) NOT NULL,\n\t`active_til_purch` int(11) NOT NULL DEFAULT '1',\n        `sub_active` int(11) NOT NULL DEFAULT '1',\n        `spam` int(11) NOT NULL DEFAULT '0',\n\t`last_sent` int(11) NOT NULL default '0',\n\tPRIMARY KEY ( `bis_id` ));");
$db->Execute("INSERT INTO " . TABLE_CONFIGURATION . " (configuration_group_id, configuration_key, configuration_title, configuration_value, configuration_description, set_function) VALUES (" . (int) $configuration_group_id . ", 'BACK_IN_STOCK_ENABLE', 'Enabel Module', 'false', 'Should this module be used', 'zen_cfg_select_option(array(\\'true\\', \\'false\\'),');");
$db->Execute("INSERT INTO " . TABLE_CONFIGURATION . " (configuration_group_id, configuration_key, configuration_title, configuration_value, configuration_description) VALUES (" . (int) $configuration_group_id . ", 'BACK_IN_STOCK_LINK', 'Back In Stock Link', 'Email me when back in stock', 'this is the words that someone would click on. HINT - You could also put a img tag here too!');");
$db->Execute("INSERT INTO " . TABLE_CONFIGURATION . " (configuration_group_id, configuration_key, configuration_title, configuration_value, configuration_description) VALUES (" . (int) $configuration_group_id . ", 'BACK_IN_STOCK_POPUP_HEADING', 'Heading for Popup', 'Sorry we ran out!', 'This heading is in the popup');");
$db->Execute("INSERT INTO " . TABLE_CONFIGURATION . " (configuration_group_id, configuration_key, configuration_title, configuration_value, configuration_description) VALUES (" . (int) $configuration_group_id . ", 'BACK_IN_STOCK_POPUP_SUBHEADING', 'Sub Heading for Popup', 'Fill out this form and we will let you know when it comes back in stock', 'This Sub heading is in the popup');");
$db->Execute("INSERT INTO " . TABLE_CONFIGURATION . " (configuration_group_id, configuration_key, configuration_title, configuration_value, configuration_description) VALUES (" . (int) $configuration_group_id . ", 'BACK_IN_STOCK_SEND_TEXT', 'Text of buton', 'Notify Me!', 'This is the text on the button');");
$db->Execute("INSERT INTO " . TABLE_CONFIGURATION . " (configuration_group_id, configuration_key, configuration_title, configuration_value, configuration_description, set_function) VALUES (" . (int) $configuration_group_id . ", 'BACK_IN_STOCK_SHOW_PRODUCT_INFO', 'Show Product Name and Image', 'true', 'Show product name and image on the fancy box on the product_info page', 'zen_cfg_select_option(array(\\'true\\', \\'false\\'),');");
$db->Execute("INSERT INTO " . TABLE_CONFIGURATION . " (configuration_group_id, configuration_key, configuration_title, configuration_value, configuration_description, set_function) VALUES (" . (int) $configuration_group_id . ", 'BACK_IN_STOCK_ACTIVE_TIL_PURCH', 'Notifications are Active Till They Purchase', 'false', 'This is useful if you want to sent your customers multipule reminders, until they Buy or Die', 'zen_cfg_select_option(array(\\'true\\', \\'false\\'),');");
$db->Execute("INSERT INTO " . TABLE_CONFIGURATION . " (configuration_group_id, configuration_key, configuration_title, configuration_value, configuration_description) VALUES (" . (int) $configuration_group_id . ", 'BACK_IN_STOCK_DAYS_WAITING', 'Days of Lag', '5', 'This is the number of days until you should send them again, this is an almost must if leaving Active Till Purch Active, you can also set zero to be notified everytime the cron is run but this will more then likely make you customer want to unsubscribre');");
if (version_compare(PROJECT_VERSION_MAJOR . "." . PROJECT_VERSION_MINOR, "1.5.0") >= 0) {
    // continue Zen Cart 1.5.0
    // add to configuration menus
    if (function_exists('zen_page_key_exists') && function_exists('zen_register_admin_page') && !zen_page_key_exists('configBackInStock')) {
        zen_register_admin_page('configBackInStock', 'BOX_BACK_IN_STOCK', 'FILENAME_CONFIGURATION', 'gID=' . (int) $configuration_group_id, 'configuration', 'Y', 999);
        $messageStack->add('Enabled Back In Stock Configuration menu.', 'success');
    }
    // add to tools menu
    if (function_exists('zen_page_key_exists') && function_exists('zen_register_admin_page') && !zen_page_key_exists('toolsBackInStock')) {
        zen_register_admin_page('toolsBackInStock', 'BOX_BACK_IN_STOCK_TOOLS', 'FILENAME_BACK_IN_STOCK', '', 'tools', 'Y', 999);
        $messageStack->add('Enabled Back In Stock Tools menu.', 'success');
    }
}
<?php

$zc150 = PROJECT_VERSION_MAJOR > 1 || PROJECT_VERSION_MAJOR == 1 && substr(PROJECT_VERSION_MINOR, 0, 3) >= 5;
if ($zc150) {
    // continue Zen Cart 1.5.0
    // add configuration menu
    if (!zen_page_key_exists('toolsCouponImportTool')) {
        zen_register_admin_page('toolsCouponImportTool', 'BOX_COUPON_IMPORT_TOOL', 'FILENAME_COUPON_IMPORT_TOOL', '', 'tools', 'Y', '99');
        $messageStack->add('Enabled Coupon Import Tool on Tools menu.', 'success');
    }
}
 /**
  * Processes any changes to the admin pages required by this plugin.
  *
  * Subclasses should generally not override this method.
  * @param boolean $install true if installing / upgrading, false otherwise.
  * @param array $pages an array containing the admin page(s).
  *
  *		The following array keys are understood (+ indicates always required):
  *		+	page_key = The internal unique key for the page in the database.
  *				If more than one page is desired, this can be used as a key
  *				pointing to an array containg the corresponding keys below.
  *
  *				EX: array('configPluginPage1' => array(
  *						'language_key' => 'BOX_CONFIGURATION_PLUGIN_PAGE1'
  *						)
  *				);
  *
  *		+	language_key = The name displayed in the admin menu for the page.
  *				This should be the name of a constant defined in a language file.
  *
  *			main_page = The name of a constant defined to represent the name
  *				of the admin file loaded to display the page. If not defined
  *				'FILENAME_CONFIGURATION' is used.
  *
  *			page_params = Any paramaters to send to the page. If the main page
  *				is 'FILENAME_CONFIGURATION' the paramaters will be overwritten
  *				with the correct paramaters.
  *
  *			menu_key = The name of the menu where this page should be attached.
  *				This key is required unless main_page is 'FILENAME_CONFIGURATION'
  *				or 'FILENAME_MODULES'.
  *
  *			display_on_menu = Indicates if this page should be displayed in
  *				the admin menu. 'Y' for yes, 'N' otherwise. If not specified
  *				this defaults to 'N' unless the main page is
  *				'FILENAME_CONFIGURATION' (defaults to 'Y').
  *
  *			sort_order = The preffered location of the page in the menu. This
  *				should be a non negative number. The lower the number, the
  *				higher up in the menu the page will appear. If two pages on
  *				the same menu have the same sort_order, they are listed in
  *				the order they were added Zen Cart. If not specified, the
  *				maximum sort_order used on the menu is determined and a number
  *				one larger is used.
  *
  * @return boolean true if the changes succeed, false otherwise.
  */
 protected function processAdminPages($install = true, $pages = null)
 {
     global $db, $messageStack;
     if ($pages === null || !is_array($pages)) {
         $pages = $this->getAdminPages();
     }
     if (array_key_exists('page_key', $pages)) {
         $page_key = $pages['page_key'];
         unset($pages['page_key']);
         $pages = array($page_key => $pages);
         unset($page_key);
     }
     $success = true;
     foreach ($pages as $key => $page) {
         // Validate core keys exist
         if (!zen_not_null($key) || !array_key_exists('language_key', $page)) {
             $messageStack->add(sprintf(PLUGIN_INTERNAL_FORMAT_ADMIN_PAGE_KEY, $this->getUniqueName()), 'error');
             return false;
         }
         // Configure defaults
         if (!array_key_exists('main_page', $page)) {
             $page['main_page'] = 'FILENAME_CONFIGURATION';
         }
         switch ($page['main_page']) {
             case 'FILENAME_CONFIGURATION':
                 // Always overwrite with the correct data
                 $page['page_params'] = 'gID=' . $this->getConfigurationGroupId();
                 break;
             default:
                 if (!array_key_exists('page_params', $page)) {
                     $page['page_params'] = '';
                 }
         }
         if (!array_key_exists('menu_key', $page)) {
             switch ($page['main_page']) {
                 case 'FILENAME_CONFIGURATION':
                     $page['menu_key'] = 'configuration';
                     break;
                 case 'FILENAME_MODULES':
                     $page['menu_key'] = 'modules';
                     break;
                 default:
                     $messageStack->add(sprintf(PLUGIN_INTERNAL_FORMAT_ADMIN_PAGE_MENU_KEY, $this->getUniqueName()), 'error');
                     return false;
             }
         }
         // Process / Verify the Admin Page
         if ($install) {
             if (!zen_page_key_exists($key)) {
                 // Validate the menu_key exists in the database.
                 $check = $db->Execute('SELECT `menu_key` FROM `' . TABLE_ADMIN_MENUS . '` ' . 'WHERE `menu_key` = \'' . zen_db_prepare_input($page['menu_key']) . '\'');
                 if ($check->EOF) {
                     $std_menu_keys = array('configuration', 'catalog', 'modules', 'customers', 'taxes', 'localization', 'reports', 'tools', 'gv', 'access', 'extras');
                     $messageStack->add(sprintf(in_array($page['menu_key'], $std_menu_keys) ? PLUGIN_INTERNAL_FORMAT_ADMIN_PAGE_MENU_KEY_BROKEN : PLUGIN_INTERNAL_FORMAT_ADMIN_PAGE_MENU_KEY_MISSING, $this->getUniqueName(), $page['menu_key']), 'error');
                     return false;
                 }
                 if (!array_key_exists('display_on_menu', $page)) {
                     if ($page['main_page'] == 'FILENAME_CONFIGURATION') {
                         $page['display_on_menu'] = 'Y';
                     } else {
                         $page['display_on_menu'] = 'N';
                     }
                 }
                 if (!array_key_exists('sort_order', $page)) {
                     $page_sort = $db->Execute('SELECT MAX(sort_order) as max_sort FROM `' . TABLE_ADMIN_PAGES . '` ' . 'WHERE `menu_key`=\'' . zen_db_prepare_input($page['menu_key']) . '\'');
                     if (!$page_sort->EOF) {
                         $page['sort_order'] = (int) $page_sort->fields['max_sort'] + 1;
                     } else {
                         $messageStack->add(sprintf(PLUGIN_INSTALL_ERROR_SORT_ORDER, TABLE_ADMIN_PAGES), 'warning');
                         $page['sort_order'] = 0;
                     }
                     unset($page_sort);
                 }
                 if ((int) $page['sort_order'] < 0) {
                     $page['sort_order'] = 0;
                 }
                 zen_register_admin_page($key, $page['language_key'], $page['main_page'], $page['page_params'], $page['menu_key'], $page['display_on_menu'], $page['sort_order']);
                 if (!zen_page_key_exists($key)) {
                     $success = false;
                 }
             }
         } else {
             if (zen_page_key_exists($key)) {
                 zen_deregister_admin_pages($key);
                 if (zen_page_key_exists($key)) {
                     $success = false;
                 }
             }
         }
     }
     return $success;
 }
Example #25
0
<?php

if (!defined('IS_ADMIN_FLAG')) {
    die('Illegal Access');
}
if (function_exists('zen_register_admin_page')) {
    if (!zen_page_key_exists('mailbeez_admin')) {
        // Add the link to MailBeez
        zen_register_admin_page('mailbeez_admin', 'BOX_MAILBEEZ_MENUE', 'FILENAME_MAILBEEZ', '', 'tools', 'Y', 40);
    }
}