[phpBB Debug] PHP Warning: in file [ROOT]/includes/crs/crs_misc_functions.php on line 37: mime_content_type(): Empty filename or path Zen Cart 源代码 seo.install.php
<?php
/*
+----------------------------------------------------------------------+
| Ultimate SEO URLs For Zen Cart, version 2.100 |
+----------------------------------------------------------------------+
| |
| Derrived from Ultimate SEO URLs v2.1 for osCommerce by Chemo |
| |
| Portions Copyright 2005, Joshua Dechant |
| |
| Portions Copyright 2005, Bobby Easland |
| |
| Portions Copyright 2003 The zen-cart developers |
| |
+----------------------------------------------------------------------+
| This source file is subject to version 2.0 of the GPL license, |
| that is bundled with this package in the file LICENSE, and is |
| available through the world-wide-web at the following url: |
| http://www.zen-cart.com/license/2_0.txt. |
| If you did not receive a copy of the zen-cart license and are unable |
| to obtain it through the world-wide-web, please send a note to |
| license@zen-cart.com so we can mail you a copy immediately. |
+----------------------------------------------------------------------+
*/
class SEO_URL_INSTALLER{
var $default_config;
var $db;
var $attributes;
function SEO_URL_INSTALLER() {
$this->attributes = array();
/**
* Initializer - if there are settings not defined the default config will be used and database settings installed.
* @author Bobby Easland
* @version 1.1
*/
function init() {
foreach( $this->default_config as $key => $value ){
$container[] = defined($key) ? 'true' : 'false';
} # end foreach
$this->attributes['IS_DEFINED'] = in_array('false', $container) ? false : true;
switch(true){
case ( !$this->attributes['IS_DEFINED'] ):
$this->eval_defaults();
$sql = "SELECT configuration_key, configuration_value
FROM " . TABLE_CONFIGURATION . "
WHERE configuration_key LIKE '%SEO%'";
$result = $this->db->Execute($sql);
$num_rows = $result->RecordCount();
$this->attributes['IS_INSTALLED'] = (sizeof($container) == $num_rows) ? true : false;
if ( !$this->attributes['IS_INSTALLED'] ){
$this->install_settings();
}
break;
default:
$this->attributes['IS_INSTALLED'] = true;
break;
} # end switch
} # end function
/**
* This function evaluates the default settings into defined constants
* @author Bobby Easland
* @version 1.0
*/
function eval_defaults(){
foreach( $this->default_config as $key => $value ){
define($key, $value['DEFAULT']);
} # end foreach
} # end function
/**
* This function removes the database settings (configuration and cache)
* @author Bobby Easland
* @version 1.0
*/
function uninstall_settings(){
$this->db->Execute("DELETE FROM `".TABLE_CONFIGURATION_GROUP."` WHERE `configuration_group_title` LIKE '%SEO%'");
$this->db->Execute("DELETE FROM `".TABLE_CONFIGURATION."` WHERE `configuration_key` LIKE '%SEO%'");
/* START SEO-1.5-COMPATIBILITY
*
* Patched for compatibility with Zen Cart 1.5
* @author Andrew Ballanger
*/
$this->db->Execute("DELETE FROM `".TABLE_ADMIN_PAGES."` WHERE `page_key`='configUltimateSEO'");
// END SEO-1.5-COMPATIBILITY
// Version 2.200 is a branch off version 2.110 and does not use the same
// keys to add the admin pages as version 2.150.
// If the key used by version 2.150 is present remove the old key to
// avoid potential issues later down the road.
$this->db->Execute("DELETE FROM `".TABLE_ADMIN_PAGES."` WHERE `page_key`='UltimateSEO'");
$this->db->Execute("DROP TABLE IF EXISTS " . TABLE_SEO_CACHE);
} # end function
/**
* This function installs the database settings
* @author Bobby Easland
* @version 1.0
*/
function install_settings(){
$this->uninstall_settings();
$sort_order_query = "SELECT MAX(sort_order) as max_sort FROM `".TABLE_CONFIGURATION_GROUP."`";
$next_sort = $this->db->Execute($sort_order_query);
$next_sort = $next_sort->fields['max_sort'] + 1;
$insert_group = "INSERT INTO `".TABLE_CONFIGURATION_GROUP."` VALUES (NULL, '网址优化', '网址优化模块的选项', '".$next_sort."', '1')";
$this->db->Execute($insert_group);
$group_id = $this->db->insert_ID();
/* START SEO-1.5-COMPATIBILITY
*
* Patched for compatibility with Zen Cart 1.5
* @author Andrew Ballanger
*/
$page_sort_query = "SELECT MAX(sort_order) as max_sort FROM `". TABLE_ADMIN_PAGES ."` WHERE menu_key='configuration'";
$page_sort = $this->db->Execute($page_sort_query);
$page_sort = $page_sort->fields['max_sort'] + 1;
$insert_page = "INSERT INTO `" . TABLE_ADMIN_PAGES . "` VALUES ('configUltimateSEO', 'BOX_CONFIGURATION_ULTIMATE_SEO', 'FILENAME_CONFIGURATION', 'gID=" . $group_id . "', 'configuration', 'Y', '" . $page_sort . "')";
$this->db->Execute($insert_page);
// END SEO-1.5-COMPATIBILITY