コード例 #1
0
ファイル: Find.php プロジェクト: mickrip/fwoot-core
 static function in($cat, $file, $debug = false)
 {
     // Looking for a potential error.
     Debug::clear();
     if (!$file) {
         throw new \Exception("Looking for Empty File? (category = {$cat})");
     }
     if (!isset(self::$path[$cat])) {
         throw new \Exception("Category {$cat} not found");
     }
     $path_list = self::$path[$cat];
     foreach ($path_list as $path) {
         $db = "Looking for: " . $path . $file;
         Debug::add($path . DS . $file);
         if ($debug) {
             echo "Looking for: " . $path . $file . "<br/>";
         }
         if (file_exists($path . DS . $file)) {
             if ($debug) {
                 echo "FOUND: " . $path . DS . $file . "<br/>";
             }
             return $path . DS . $file;
         }
     }
     return false;
 }
コード例 #2
0
 /**
  * 链接memcache,保存实例化的memcache
  */
 private function connect()
 {
     if ($this->mem) {
         return $this;
     } else {
         return $this->mem = memcache_connect($this->config['memcached_host'], $this->config['memcached_port']) or Debug::add('memcached连接失败');
     }
 }
コード例 #3
0
ファイル: MysqliDriver.class.php プロジェクト: pgfeng/GFPHP
 function connect()
 {
     $mysqli = mysqli_connect(Config::database('host') . ':' . Config::database('port'), Config::database('user'), Config::database('pass'), Config::database('name'));
     if ($mysqli->connect_error) {
         Debug::add('连接数据库失败:<font color=red>' . $mysqli->connect_error . '</font>');
         exit('连接数据库失败:<font color=red>' . $mysqli->connect_error . '</font>');
     } else {
         $this->mysqli = $mysqli;
         $this->exec('set names ' . Config::database('charset'));
         return true;
     }
 }
コード例 #4
0
ファイル: Cache.class.php プロジェクト: pgfeng/GFPHP
 public static function flush($space = false)
 {
     if ($space == false) {
         $space = self::$cache->config['default_space'];
     }
     $res = self::$cache->flush($space);
     if ($res) {
         Debug::add('缓存空间' . $space . '删除成功!', 0);
     } else {
         Debug::add('缓存空间' . $space . '删除失败!', 0);
     }
     return $res;
 }
コード例 #5
0
 public static function flush($space = false)
 {
     if ($space == false) {
         $space = self::$cache->config['default_space'];
     }
     $res = self::$cache->flush($space);
     if ($res) {
         Debug::add('Cache:Space' . $space . ' delete success.', 0);
     } else {
         Debug::add('Cache:Space' . $space . ' delete failed.', 0);
     }
     return $res;
 }
コード例 #6
0
ファイル: mysql.class.php プロジェクト: pgfeng/GFPHP
 function connect()
 {
     $con = @mysql_connect(Config::database('host') . ':' . Config::database('port'), Config::database('user'), Config::database('pass'));
     if ($con) {
         $r = mysql_select_db(Config::database('name'), $con) or Debug::add('连接数据库失败:<font color=red>' . mysql_error() . '</font>');
         if ($r === true) {
             $this->con = $con;
             $this->exec('set names ' . Config::database('charset'));
             return true;
         }
     } else {
         Debug::add('连接Mysql服务器失败:,' . mysql_error());
     }
     return false;
 }
コード例 #7
0
ファイル: PdoDriver.class.php プロジェクト: pgfeng/GFPHP
 public function connect()
 {
     try {
         $this->db = new pdo(config::database('DSN'), Config::database('user'), Config::database('pass'));
         $this->db->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
     } catch (PDOException $e) {
         Debug::add('<font color="red">' . $e->getMessage() . '</font>');
     }
     if (!$this->db) {
         return false;
     } else {
         $this->exec('set names ' . Config::database('charset'));
         return true;
     }
 }
コード例 #8
0
ファイル: Initialize.php プロジェクト: pgfeng/GFPHP
<?php

if (!defined('__ROOT__')) {
    exit('Sorry,Please from entry!');
}
/**
 * init 入口引入文件
 * 项目自动初始化文件
 * 创建时间:2014-08-08 14:56 PGF
 */
Loader::core('Debug');
//加载DEBUG类
Debug::start();
//程序开始
Loader::func('Base');
//加载基础全局函数
Loader::core('Cache');
//加载缓存处理类
Cache::init();
//初始化缓存类
//向日志中添加已经加载的Loader
Debug::add(__ROOT__ . Config::config('core_dir') . '/bases/' . 'Loader.class.php', 1);
Loader::core('Router');
//加载Router
Router::run();
//Router运行
Debug::stop();
//程序结束
//====================    END Initialize.php      ========================//
コード例 #9
0
ファイル: Db.class.php プロジェクト: pgfeng/ssy.9icode.club
 public final function query($sql = false)
 {
     if (!$sql) {
         $this->compile();
     }
     $sql = $sql ? $sql : $this->sql;
     //print_r($this);
     //echo Config::database('table_pre').Config::cache('table');
     if (Config::database('cache') && preg_match('/^SELECT/i', $sql) && (Config::database('table_pre') . Config::cache('table') != $this->table || Config::cache('driver') != 'dbCache')) {
         //echo '开启缓存';
         if (!Cache::is_cache(md5($sql), Config::database('cache_dir') . '/' . $this->section['table'])) {
             $data = $this->_query($sql);
             $cdata = '<?php exit;/*' . serialize($data) . '*/';
             Cache::set(md5($sql), $cdata, Config::database('cache_dir') . '/' . $this->section['table']);
             //Cache::$cache->writeCache($sql,$data,(Config::database('cache_dir').'/'.$this->section['table']));
             Debug::add('DB:Update Cache ' . $sql, 2);
         } else {
             //$data=Cache::$cache->readCache($sql,(Config::database('cache_dir').'/'.$this->section['table']));
             $data = unserialize(substr(Cache::get(md5($sql), Config::database('cache_dir') . '/' . $this->section['table']), 13, -2));
             //exit();
             Debug::add('DB:Read Cache' . $sql, 2);
         }
         $this->_reset();
         if ($data == null) {
             //防止直接返回Null
             $data = array();
         }
         return $data;
     } else {
         Debug::add($sql, 2);
         $this->_reset();
         $data = $this->_query($sql);
         if ($data == null) {
             //防止直接返回Null
             $data = array();
         }
         return $data;
     }
 }
コード例 #10
0
ファイル: index.php プロジェクト: simonmeggle/histou
if ($perfDataSize < 4) {
    if ($perfDataSize == 1) {
        returnData(Debug::errorMarkdownDashboard('#Influxdb Error: ' . $perfData[0] . ' Query: ' . INFLUX_QUERY), 1);
    } else {
        returnData(Debug::errorMarkdownDashboard('#Host / Service not found in Influxdb'), 1);
    }
}
// load templates
$templates = Folder::loadFolders(array(CUSTOM_TEMPLATE_FOLDER, DEFAULT_TEMPLATE_FOLDER));
Rule::setCheck($perfData['host'], $perfData['service'], $perfData['command'], array_keys($perfData['perfLabel']));
usort($templates, 'Template::compare');
$valid = $templates[0]->isValid();
foreach ($templates as $template) {
    Debug::add($template);
}
Debug::add("Is the first template valid: " . Debug::printBoolean($valid));
if ($valid) {
    $template = $templates[0];
} else {
    $template = Template::findDefaultTemplate($templates, 'default.php');
}
if (isset($template) && !empty($template)) {
    returnData($template->getTemplate($perfData), 0, 'OK');
} else {
    returnData(Debug::errorMarkdownDashboard('#No template found!'), 1);
}
/**
This function will print its input and exit with the given returncode.
@param object $data       This object will be converted to json.
@param int    $returnCode The returncode the programm will exit.
@return null.
コード例 #11
0
 public function product_index($p_product_id)
 {
     Debug::add("LimeLight->product_index()");
     if (is_array($p_product_id)) {
         $productCsv = implode(",", $p_product_id);
     } else {
         $productCsv = $p_product_id;
     }
     $qty_prods = count($p_product_id);
     Debug::add(array("product_id" => $productCsv));
     $result = $this->api('product_index', array("product_id" => $productCsv));
     if (!empty($result)) {
         foreach ($result as $field_name => $field_val) {
             $field_name = urldecode($field_name);
             $field_val = explode(',', $field_val);
             if (count($field_val) >= $qty_prods) {
                 for ($j = 0; $j < $qty_prods; $j++) {
                     if ($field_name == 'response_code') {
                         $res_arr[$p_product_id[$j]][$field_name] = urldecode($field_val[$j]);
                         $res_arr[$p_product_id[$j]]['product_id'] = $p_product_id[$j];
                     } else {
                         // The response_code is always first in the result from LimeLight so it should
                         // exist.  If they change the order of their first field then this will break!
                         if ($res_arr[$p_product_id[$j]]['response_code'] == '100') {
                             // Only record product information on valid product results.
                             $res_arr[$p_product_id[$j]][$field_name] = urldecode($field_val[$j]);
                         }
                     }
                 }
             }
         }
     }
     // temp hack
     Debug::add("Overriding product data with our product data - start");
     // we need to override/add product data from our own data to fill in missing fields such as quantity
     if (is_array($res_arr)) {
         foreach ($res_arr as $productId => $product) {
             $data = ProductLL::getProduct($productId);
             if (is_array($data)) {
                 $res_arr[$productId] += $data;
             }
         }
     }
     Debug::add("Overriding product data with our product data - end");
     Debug::add($res_arr);
     return $res_arr;
 }
コード例 #12
0
 public static function load($file)
 {
     if (file_exists($file)) {
         $re = (require $file);
         Debug::add($file, '1');
         return $re;
     }
     Debug::add('Loader:' . $file . ' not found.');
     return false;
 }
コード例 #13
0
ファイル: debug.layer.php プロジェクト: jankuca/escms
 public static function catchError($errno, $errstr, $errfile, $errline)
 {
     Debug::add(new ErrorException($errstr, 0, $errno, $errfile, $errline));
 }
コード例 #14
0
ファイル: Loader.class.php プロジェクト: pgfeng/GFPHP
 public static function load($file)
 {
     if (file_exists($file)) {
         $re = (require $file);
         Debug::add($file, '1');
         return $re;
     }
     Debug::add('<font color="red">' . $file . '不存在!</font>');
     return false;
 }
コード例 #15
0
 /**
  * Handles an Query Error: A QueryExcpetion will be thrown.
  *
  * @see QueryException
  * @throws QueryException
  * @param string Last Query
  **/
 protected function queryError($query)
 {
     $e = new QueryException($this->error(), $this->errno());
     $e->setQuery($query);
     $e->setLine(__LINE__);
     $e->setFile(__FILE__);
     // Try to get better results for line and file.
     if (function_exists('debug_backtrace') == true) {
         $backtraceInfo = debug_backtrace();
         // 0 is class.mysql.php, 1 is the calling code...
         if (isset($backtraceInfo[1]) == true) {
             $e->setLine($backtraceInfo[1]['line']);
             $e->setFile($backtraceInfo[1]['file']);
         }
     }
     $this->debug->add($e);
     throw $e;
 }
コード例 #16
0
ファイル: Controller.class.php プロジェクト: pgfeng/GFPHP
 public function __call($a, $b)
 {
     Debug::add("方法{$a}不存在!");
 }