Exemplo n.º 1
0
/**
 * spConfigReady   快速将用户配置覆盖到框架默认配置
 * 
 * @param preconfig    默认配置
 * @param useconfig    用户配置
 */
function spConfigReady($preconfig, $useconfig = null)
{
    $nowconfig = $preconfig;
    if (is_array($useconfig)) {
        foreach ($useconfig as $key => $val) {
            if (is_array($useconfig[$key])) {
                @($nowconfig[$key] = is_array($nowconfig[$key]) ? spConfigReady($nowconfig[$key], $useconfig[$key]) : $useconfig[$key]);
            } else {
                @($nowconfig[$key] = $val);
            }
        }
    }
    return $nowconfig;
}
Exemplo n.º 2
0
 /**
  * 替换数据,根据条件替换存在的记录,如记录不存在,则将条件与替换数据相加并新增一条记录。
  * 
  * @param conditions    数组形式,查找条件,请注意,仅能使用数组作为该条件!
  * @param row    数组形式,修改的数据
  */
 public function replace($conditions, $row)
 {
     if ($this->find($conditions)) {
         return $this->update($conditions, $row);
     } else {
         if (!is_array($conditions)) {
             spError('replace方法的条件务必是数组形式!');
         }
         $rows = spConfigReady($conditions, $row);
         return $this->create($rows);
     }
 }
Exemplo n.º 3
0
} else {
    $ary_info = explode("/", $path_info);
    $path_info = $ary_info[0] . "/";
}
define("PATH_INFOS", $path_info);
// 定义系统路径
if (!defined('SP_PATH')) {
    define('SP_PATH', dirname(__FILE__) . '/kernel');
}
if (!defined('APP_PATH')) {
    define('APP_PATH', dirname(__FILE__) . '/app');
}
// 载入核心函数库
require SP_PATH . "/Functions.php";
// 载入配置文件
$GLOBALS['G_SP'] = spConfigReady(require ROOTPATH . "config/config.php");
// 根据配置文件进行一些全局变量的定义
if ('debug' == $GLOBALS['G_SP']['mode']) {
    define("SP_DEBUG", TRUE);
    // 当前正在调试模式下
} else {
    define("SP_DEBUG", FALSE);
    // 当前正在部署模式下
}
// 如果是调试模式,打开警告输出
if (SP_DEBUG) {
    if (substr(PHP_VERSION, 0, 3) == "5.3") {
        error_reporting(E_ALL & ~E_NOTICE & ~E_WARNING & ~E_DEPRECATED);
    } else {
        error_reporting(E_ALL & ~E_NOTICE & ~E_WARNING);
    }
Exemplo n.º 4
0
/**
 * spCore
 *
 * SpeedPHP应用框架的系统执行程序
 */
// 定义系统路径
if (!defined('SP_PATH')) {
    define('SP_PATH', dirname(__FILE__) . '/SpeedPHP');
}
if (!defined('APP_PATH')) {
    define('APP_PATH', dirname(__FILE__) . '/app');
}
// 载入核心函数库
require SP_PATH . "/spFunctions.php";
// 载入配置文件
$GLOBALS['G_SP'] = spConfigReady(require SP_PATH . "/spConfig.php", $spConfig);
// 根据配置文件进行一些全局变量的定义
if ('debug' == $GLOBALS['G_SP']['mode']) {
    define("SP_DEBUG", TRUE);
    // 当前正在调试模式下
} else {
    define("SP_DEBUG", FALSE);
    // 当前正在部署模式下
}
// 如果是调试模式,打开警告输出
if (SP_DEBUG) {
    if (substr(PHP_VERSION, 0, 3) == "5.3") {
        error_reporting(E_ALL & ~E_NOTICE & ~E_WARNING & ~E_DEPRECATED);
    } else {
        error_reporting(E_ALL & ~E_NOTICE & ~E_WARNING);
    }
Exemplo n.º 5
0
<?php

if (substr(PHP_VERSION, 0, 1) != '5') {
    exit("本系统运行环境要求PHP版本5及以上!");
}
if (!defined('APP_PATH') || !defined('KXJ_PATH')) {
    exit('Access Denied');
}
require KXJ_PATH . "/Functions.php";
//  ready 配置参数
$GLOBALS['G_DY'] = spConfigReady(require KXJ_PATH . "/inc.php", $kxjConfig);
if ('debug' == $GLOBALS['G_DY']['mode']) {
    define("SP_DEBUG", TRUE);
} else {
    define("SP_DEBUG", FALSE);
}
//  设置是否开启PHP错误提示
if (SP_DEBUG) {
    if (substr(PHP_VERSION, 0, 3) == "5.3") {
        error_reporting(E_ALL & ~E_NOTICE & ~E_WARNING & ~E_DEPRECATED);
    } else {
        error_reporting(E_ALL & ~E_NOTICE & ~E_WARNING);
    }
} else {
    error_reporting(0);
}
@set_magic_quotes_runtime(0);
//  该函数自PHP5.3起已经废弃
import($GLOBALS['G_DY']["sp_core_path"] . "/syController.php", FALSE, TRUE);
import($GLOBALS['G_DY']["sp_core_path"] . "/syModel.php", FALSE, TRUE);
import($GLOBALS['G_DY']["sp_core_path"] . "/syView.php", FALSE, TRUE);