コード例 #1
0
ファイル: page.php プロジェクト: Junec/core
 /**
  * 模板渲染
  * 
  * @param string $template 模板文件
  * @return htmlcode
  */
 public function fetch($template = '')
 {
     $hashkey = core_debug::info('compile template: ' . $template);
     $html = $this->getRender()->fetch($template);
     core_debug::upTime($hashkey);
     return $html;
 }
コード例 #2
0
ファイル: lib_payment.php プロジェクト: optiva/xGlide
 public function __construct()
 {
     $this->_properties = array_keys(get_object_vars($this));
     if (array_pop($this->_properties) != '_properties') {
         core_debug::i()->add('500', 'Core Error', '_properties is not last item in array');
     }
 }
コード例 #3
0
ファイル: core_debug.php プロジェクト: optiva/xGlide
 public static function i()
 {
     if (self::$instance === null) {
         $c = __CLASS__;
         self::$instance = new $c();
     }
     return self::$instance;
 }
コード例 #4
0
ファイル: filesystem.php プロジェクト: Junec/core
 public function __construct($params = array())
 {
     if (!isset($params['cache_dir']) || !$this->getInstance()->isDir($params['cache_dir'])) {
         $this->savepath = core::getConfig('cache_filesystem_dir');
     } else {
         $this->savepath = $params['cache_dir'];
     }
     core_debug::info('set filesystem dir: ' . $this->getSavePath());
 }
コード例 #5
0
ファイル: event.php プロジェクト: vgalitsky/git_trade
 public function grabEventsFromEmailAction()
 {
     //echo phpinfo();
     $m = new manage_model_event();
     $m->emailGrab();
     core_debug::dump($m);
     core_debug::dump(imap_errors());
     die('at ctrl');
 }
コード例 #6
0
ファイル: widget.php プロジェクト: Junec/core
 public function display($params = array())
 {
     $loadWidgetHashkey = core_debug::info('load widget: ' . get_class($this));
     $params = $this->params($params);
     $compileWidgetHashkey = core_debug::info('compile widget: ' . $this->tpl());
     $this->render->display($this->tpl());
     core_debug::upTime($loadWidgetHashkey);
     core_debug::upTime($compileWidgetHashkey);
 }
コード例 #7
0
ファイル: redis.php プロジェクト: Junec/core
 public function __construct($params = array())
 {
     $host = $params['host'];
     $port = !empty($params['port']) ? $params['port'] : 6379;
     if ($host != '') {
         core_debug::info('add redis server: ' . $host . ":" . $port);
         $this->getInstance()->connect($host, $port);
     } else {
         throw new Exception('can\'t load cache_redis_host, please check it.');
     }
 }
コード例 #8
0
ファイル: log.php プロジェクト: vgalitsky/moze
 static function log($message, $logfile = 'core.log')
 {
     if (!is_string($message)) {
         $message = core_debug::dump($message, false);
     }
     $message = date('[m-d-Y H:i:s]:') . $message;
     $fpath = app::getConfig('dir/sd') . DS . self::LOG_DIR . DS . $logfile;
     core_fs::createDirIfNotExists(dirname($fpath));
     $fh = fopen($fpath, 'a+');
     fputs($fh, $message . "\n");
     fclose($fh);
     return $message;
 }
コード例 #9
0
ファイル: index.php プロジェクト: vgalitsky/git_trade
 public function rndAction()
 {
     for ($i = 0; $i < 100; $i++) {
         $lt = rand(1, 10);
         $lng = rand(1, 10);
         $a = rand(1, 3);
         $u = rand(24, 27);
         $c = rand(1, 4);
         $e = new manage_model_event();
         $data = array('lat' => 49.26 + $lt / 10, 'long' => 27.69 + $lng / 10, 'user_id' => $u, 'activity_id' => $a, 'city_id' => $c, 'date' => strtotime(rand(1, 29) . '.' . rand(1, 7) . '.' . '2015'), 'marker_color' => '#efefef');
         $e->setData($data);
         core_debug::dump($e);
         $e->save();
     }
 }
コード例 #10
0
ファイル: memcached.php プロジェクト: Junec/core
 public function __construct($params = array())
 {
     $hosts = array();
     if ($params['host'] != '') {
         $config = explode(',', $params['host']);
         foreach ($config as $v) {
             $v = trim($v);
             $tmp = explode(':', $v);
             $hosts[] = array($tmp[0], $tmp[1]);
             core_debug::info('add memcached server: ' . $v);
         }
         $this->getInstance()->addServers($hosts);
     } else {
         throw new Exception('can\'t load cache_memcache_host, please check it.');
     }
 }
コード例 #11
0
ファイル: store_default.php プロジェクト: optiva/xGlide
 function read($query = false, $query_column = false, $query_order = false, $query_dir = false, $query_start = false, $query_limit = false)
 {
     $int_time_start = lib_datetime_microtime();
     parent::read($query, $query_column, $query_order, $query_dir, $query_start, $query_limit);
     $array_data['results'] = count($this->array_result);
     if (count($this->array_result) > 0) {
         for ($i = 0; $i < count($this->array_result); $i++) {
             try {
                 $array_data['nodes'][] = new model_forum_categories($this->array_result[$i]);
             } catch (Exception $e) {
                 core_debug::i()->add('500', $e->getMessage(), '');
             }
         }
     }
     $array_data['elapsed'] = lib_datetime_microtime() - $int_time_start;
     return $array_data;
 }
コード例 #12
0
ファイル: curl.php プロジェクト: Junec/core
 /**
  * 发起请求
  * 
  * @param string $url 请求地址
  * @param array $method 请求方式
  * @param array $params 请求参数
  * @return void
  */
 private function _request($url = '', $method = 'POST', $params = array())
 {
     $hashkey = core_debug::info("curl {$method} request: {$url} , requesting ...");
     curl_setopt($this->client, CURLOPT_CONNECTTIMEOUT, 20);
     curl_setopt($this->client, CURLOPT_URL, $url);
     curl_setopt($this->client, CURLOPT_RETURNTRANSFER, 1);
     curl_setopt($this->client, CURLOPT_CONNECTTIMEOUT, $this->getTimeout());
     curl_setopt($this->client, CURLOPT_TIMEOUT, $this->getTimeout());
     if ($method == 'POST') {
         curl_setopt($this->client, CURLOPT_POST, count($params));
         curl_setopt($this->client, CURLOPT_POSTFIELDS, $params);
     }
     $this->response = curl_exec($this->client);
     curl_close($this->client);
     if ($this->response === false) {
         $debugInfo = "curl {$method} request: {$url} , timeout(" . $this->getTimeout() . " Seconds).";
     } else {
         $debugInfo = "curl {$method} request: {$url} , ok.";
     }
     core_debug::info($debugInfo, $hashkey);
     return $this->response;
 }
コード例 #13
0
ファイル: core_auth.php プロジェクト: optiva/xGlide
 public final function connect()
 {
     if (core_settings::i()->get('CONFIG_SETTINGS_AUTH') == 2) {
         if ($_SERVER['REMOTE_ADDR'] == core_settings::i()->get('CONFIG_AUTH_NTLM_IP') && strpos($_SERVER['HTTP_USER_AGENT'], 'MSIE')) {
             if (!$this->connect_ntlm()) {
                 if ($this->http_auth_complete) {
                     // Only display a 403 if the NTLM is complete.
                     core_debug::i()->add('403', 'Cannot find user in Database: ', '');
                 } else {
                     exit;
                 }
             }
         } else {
             if (!$this->connect_ldap()) {
                 header('HTTP/1.0 401 Unauthorized');
                 header('WWW-Authenticate: Basic realm="iTrafford Login"');
                 exit('Unauthorized <a href="/">Retry</a>');
             }
         }
     }
     if (core_settings::i()->get('CONFIG_SETTINGS_AUTH') == 1) {
         $this->connect_db();
     }
 }
コード例 #14
0
ファイル: core_paper.php プロジェクト: optiva/xGlide
 /**
  * Prints the Paper buffer to the screen 
  */
 public function display()
 {
     try {
         header('Content-Type: ' . $this->mime . '; charset=' . strtoupper($this->encoding) . '');
         header('Expires: ' . date('D, d M Y H:i:s ', time() + core_settings::i()->get('CONFIG_PAPER_EXPIRES')) . 'GMT');
         $handle = fopen($this->template, "r");
         $contents = fread($handle, filesize($this->template));
         fclose($handle);
         $find = array_keys($this->data);
         $replace = array_values($this->data);
         $xhtml = str_replace($find, $replace, $contents);
         print $xhtml;
     } catch (Exception $e) {
         core_debug::i()->add('500', $e->getMessage(), '');
     }
 }
コード例 #15
0
        global $Plugins;
        switch ($this->OutputType) {
            case "XML":
                break;
            case "HTML":
                $text = _("Plugin Summary");
                $V .= "<H2>{$text}</H2>";
                foreach ($Plugins as $key => $val) {
                    $V .= "{$key} : {$val->Name} (state={$val->State})<br>\n";
                }
                $text = _("Plugin State Details");
                $V .= "<H2>{$text}</H2>";
                $V .= "<pre>";
                $V .= print_r($Plugins, 1);
                $V .= "</pre>";
                break;
            case "Text":
                print_r($Plugins);
                break;
            default:
                break;
        }
        if (!$this->OutputToStdout) {
            return $V;
        }
        print "{$V}";
        return;
    }
}
$NewPlugin = new core_debug();
$NewPlugin->Initialize();
コード例 #16
0
ファイル: core_database.php プロジェクト: optiva/xGlide
 public function columns($table)
 {
     if (core_settings::i()->get('CONFIG_SETTINGS_DEBUG')) {
         $starttime = lib_datetime_microtime();
     }
     $store = array();
     $object_result = core_database::i()->query("\n\t\t\t\tselect * from `" . core_database::i()->real_escape_string($table) . "` LIMIT 1;\n\t\t\t");
     $object_fields = $object_result->fetch_fields();
     for ($i = 0; $i < count($object_fields); $i++) {
         $store[] = $object_fields[$i]->name;
     }
     if (core_settings::i()->get('CONFIG_SETTINGS_DEBUG')) {
         $endtime = lib_datetime_microtime();
         core_debug::i()->add('query', $query, round($endtime - $starttime, 6));
     }
     return $store;
 }
コード例 #17
0
ファイル: event.php プロジェクト: vgalitsky/git_trade
 /**
  * F*****G SHIT FUNCTION . SORRY FOR THS F**K
  * @param $csv
  * @param $orig
  * @return array
  * @throws Exception
  */
 protected function _pareseEmailBodyCsv($csv, $orig)
 {
     //$orig = $this->_prepareCsvString($csv);
     $csv = $this->_prepareCsvString($orig);
     $array = explode(';', $csv);
     if (!is_array($array) || !isset($array[0]) || !isset($array[1]) || !isset($array[2]) || !isset($array[3]) || !isset($array[4])) {
         $csv = $this->tryEncodeUtf8($orig);
         $csv = $this->_prepareCsvString($csv);
         core_debug::dump($csv);
         $array = str_getcsv($csv, ';');
     }
     if (!is_array($array) || !isset($array[0]) || !isset($array[1]) || !isset($array[2]) || !isset($array[3]) || !isset($array[4])) {
         $csv = $this->tryEncodebase64($orig);
         $csv = $this->_prepareCsvString($csv);
         core_debug::dump($csv);
         $array = str_getcsv($csv, ';');
     }
     if (!is_array($array) || !isset($array[0]) || !isset($array[1]) || !isset($array[2]) || !isset($array[3]) || !isset($array[4])) {
         throw new Exception('Error while parsing email body');
     }
     $lat = $array[1];
     $long = $array[2];
     $user_id = $this->_getUserByImei($array[0]);
     $user = new manage_model_user();
     $user->load($user_id);
     $city_name = core_google_geo::findCityName($lat, $long);
     if (!$city_name) {
         $city_id = $user->getData('city_id');
     } else {
         $city_id = $this->_getCityIdByName($city_name);
     }
     $data = array('imei' => $array[0], 'user_id' => $user_id, 'lat' => $lat, 'long' => $long, 'date' => $array[3] / 1000, 'activity_id' => $array[4], 'city_id' => $city_id);
     core_log::log($data, self::$grabtime . '.event.imap.log');
     return $data;
 }
コード例 #18
0
ファイル: core.php プロジェクト: optiva/xGlide
        }
    } else {
        // Can't find the presenter at all.
        // Show a 404
        core_debug::i()->add('404', 'File not found: ', __DIR__ . '/../../application/presenters/presenter_' . core_requests::i()->get('presenter') . '.php');
    }
}
// </editor-fold>
// <editor-fold defaultstate="collapsed" desc="DISPLAY RESULTS">
core_paper::i()->add($presenter->data);
core_paper::i()->template = core_requests::i()->get('presenter') . '.html';
core_paper::i()->display();
// </editor-fold>
// <editor-fold defaultstate="collapsed" desc="DEBUGGING + LOGGING">
if (core_settings::i()->get('CONFIG_SETTINGS_DEBUG')) {
    // Only display the debug data in xml or html files
    if (core_paper::i()->mime == 'text/html' && core_paper::i()->mime == 'text/xml') {
        print "<!--[\n\n";
        if (isset($_SESSION)) {
            print session_id() . "\n\n";
            print_r($_SESSION);
            print "\n\n";
        }
        print_r(core_debug::i()->get());
        print "\n]-->";
    }
}
if (core_settings::i()->get('CONFIG_SETTINGS_LOGFILE')) {
    core_logging::i()->write();
}
// </editor-fold>
コード例 #19
0
ファイル: core.php プロジェクト: Junec/core
 /**
  * 设置参数信息
  * 
  * @return void
  */
 private static function setBoot()
 {
     $pathinfo = self::instance('core_url')->getPathInfo();
     $queryString = self::instance('core_router')->parse($pathinfo);
     $get = self::instance('core_url')->getQueryParams($queryString);
     $controller = $get[self::$config['mvc_controller']];
     $action = $get[self::$config['mvc_action']];
     if ($controller == '') {
         $controller = self::$config['default_controller'];
     }
     if ($action == '') {
         $action = self::$config['default_action'];
     }
     self::$boot[self::$config['mvc_controller']] = $controller;
     self::$boot[self::$config['mvc_action']] = $action;
     self::$boot['pathinfo'] = $pathinfo;
     core_debug::info('path info: ' . $pathinfo);
     core_debug::info('query string: ' . $queryString);
 }
コード例 #20
0
ファイル: abstract_presenter.php プロジェクト: optiva/xGlide
 /**
  * Sets $request_method
  * Throws an error if not GET, POST, PUT or DELETE
  * 
  * @param string $method 
  */
 private function set_request_method($method)
 {
     if ($method == "GET" || $method == "POST" || $method == "PUT" || $method == "DELETE") {
         $this->request_method = $method;
     } else {
         core_debug::i()->add('500', $e->getMessage(), '');
     }
 }
コード例 #21
0
ファイル: abstract_store.php プロジェクト: optiva/xGlide
 /**
  * Delete record prototype
  */
 public function delete()
 {
     // <editor-fold defaultstate="collapsed" desc="BUILD QUERY">
     $pad = '                       ';
     $str_ident = '##' . get_called_class() . ' ' . __FUNCTION__ . '()' . " \n";
     $obj_data->sanitize();
     $str_update = 'DELETE FROM ' . static::$db_table . " \n";
     if (array_key_exists($query_column, static::$db_columns)) {
         $str_where = 'WHERE `' . core_database::i()->real_escape_string($query_column) . '` = "' . core_database::i()->real_escape_string($query) . '"' . " \n";
     } else {
         core_debug::i()->add('500', 'Unknown db_column', '"' . $query_column . '"');
     }
     // </editor-fold>
     // <editor-fold defaultstate="collapsed" desc="QUERY DATABASE">
     try {
         $this->array_result = core_database::i()->debug_query($str_update . $pad . $str_set . $pad . $str_where);
     } catch (Exception $e) {
         core_debug::i()->add('500', $e->getMessage(), '');
     }
     // </editor-fold>
 }