当前位置: 首页>>代码示例>>PHP>>正文


PHP format_microtime函数代码示例

本文整理汇总了PHP中format_microtime函数的典型用法代码示例。如果您正苦于以下问题:PHP format_microtime函数的具体用法?PHP format_microtime怎么用?PHP format_microtime使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了format_microtime函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: search

 function search($search, $limit = 10, $page = 0)
 {
     global $roster;
     $first = $page * $limit;
     $sql = "SELECT `member_id`, `name`, `server`, `region`, `guild_id`, `class`, `level`, `note`, `guild_rank`,`guild_title`, `zone`, `last_online`" . " FROM `" . $roster->db->table('members') . "`" . " WHERE (`member_id` LIKE '%{$search}%'" . " OR `name` LIKE '%" . ucfirst($search) . "%'" . " OR `name` LIKE '%" . $search . "%'" . " OR `server` LIKE '%{$search}%'" . " OR `region` LIKE '%{$search}%'" . " OR `guild_id` LIKE '%{$search}%'" . " OR `class` LIKE '%{$search}%'" . " OR `level` LIKE '%{$search}%'" . " OR `note` LIKE '%{$search}%'" . " OR `guild_rank` LIKE '%{$search}%'" . " OR `guild_title` LIKE '%{$search}%'" . " OR `zone` LIKE '%{$search}%')" . " GROUP BY `member_id`" . ($limit > 0 ? " LIMIT {$first}," . $limit : '') . ';';
     // calculating the search time
     $this->start_search = format_microtime();
     $result = $roster->db->query($sql);
     $this->stop_search = format_microtime();
     $this->time_search = $this->stop_search - $this->start_search;
     $nrows = $roster->db->num_rows($result);
     $crows = 0;
     $x = $limit > $nrows ? $nrows : ($limit > 0 ? $limit : $nrows);
     if ($nrows > 0) {
         while ($x > 0) {
             list($member_id, $name, $server, $region, $guild_id, $class, $level, $note, $guild_rank, $guild_title, $zone, $last_online) = $roster->db->fetch($result);
             $item['title'] = $name;
             $item['date'] = $last_online;
             $item['html'] = '<td class="SearchRowCell">' . $level . '</td><td class="SearchRowCell">' . $class . '</td><td class="SearchRowCell"><a href="' . makelink("char-info&amp;a=c:{$member_id}") . '"><strong>' . $name . '</strong></a></td><td class="SearchRowCellRight">' . $guild_title . '</td>';
             $this->add_result($item);
             unset($item);
             $x--;
         }
     }
     $roster->db->free_result($result);
 }
开发者ID:reddragon010,项目名称:wowroster-rge,代码行数:26,代码来源:search.inc.php

示例2: search

 function search($search, $limit = 10, $page = 0)
 {
     global $roster;
     $first = $page * $limit;
     $search_zone = $this->zone == '' ? '' : "`q`.`zone` = '" . $this->zone . "' AND";
     $search_level = $this->levelid == '' ? '' : "`q`.`quest_level` = '" . $this->levelid . "' AND";
     $sql = "SELECT `q`.`quest_name`, `q`.`quest_level`, `q`.`quest_tag`, `q`.`zone`, `p`.`region`, `p`.`server`" . " FROM `" . $roster->db->table('quests') . "` AS q" . " LEFT JOIN `" . $roster->db->table('players') . "` AS p USING (`member_id`)" . " WHERE {$search_zone} {$search_level} `q`.`quest_name` LIKE '%{$search}%'" . " GROUP BY `quest_name`" . ($limit > 0 ? " LIMIT {$first}," . $limit : '') . ';';
     //calculating the search time
     $this->start_search = format_microtime();
     $result = $roster->db->query($sql);
     $this->stop_search = format_microtime();
     $this->time_search = $this->stop_search - $this->start_search;
     $nrows = $roster->db->num_rows($result);
     $x = $limit > $nrows ? $nrows : ($limit > 0 ? $limit : $nrows);
     if ($nrows > 0) {
         while ($x > 0) {
             list($quest_name, $quest_level, $quest_tag, $zone, $region, $server) = $roster->db->fetch($result);
             $item['title'] = $quest_name;
             $item['html'] = '<td class="SearchRowCell">' . $quest_level . '</td>' . '<td class="SearchRowCell"><a href="' . makelink('realm-questlist&amp;a=r:' . $region . '-' . urlencode($server) . '&amp;questid=' . urlencode($quest_name)) . '"><strong>' . $quest_name . '</strong></a></td>' . '<td class="SearchRowCellRight">' . $zone . '</td>';
             $this->add_result($item);
             unset($item);
             $x--;
         }
     }
     $roster->db->free_result($result);
 }
开发者ID:reddragon010,项目名称:wowroster-rge,代码行数:26,代码来源:search.inc.php

示例3: search

 function search($search, $limit = 10, $page = 0)
 {
     global $roster;
     $first = $page * $limit;
     $sql = "SELECT `players`.`name`, `players`.`member_id`, `players`.`server`, `players`.`region`, `recipes`.*" . " FROM `" . $roster->db->table('recipes') . "` AS recipes,`" . $roster->db->table('players') . "` AS players" . " WHERE `recipes`.`member_id` = `players`.`member_id`" . " AND (`recipes`.`recipe_name` LIKE '%{$search}%' OR `recipes`.`recipe_tooltip` LIKE '%{$search}%')" . ($this->minlvl != '' ? " AND `recipes`.`level` >= '{$this->minlvl}'" : '') . ($this->maxlvl != '' ? " AND `recipes`.`level` <= '{$this->maxlvl}'" : '') . $this->quality_sql . " ORDER BY `recipes`.`recipe_name` ASC, `recipes`.`recipe_type` ASC" . ($limit > 0 ? " LIMIT {$first}," . $limit : '') . ';';
     //calculating the search time
     $this->start_search = format_microtime();
     $result = $roster->db->query($sql);
     $this->stop_search = format_microtime();
     $this->time_search = $this->stop_search - $this->start_search;
     $nrows = $roster->db->num_rows($result);
     $x = $limit > $nrows ? $nrows : ($limit > 0 ? $limit : $nrows);
     if ($nrows > 0 && $limit > 0) {
         while ($x > 0) {
             $row = $roster->db->fetch($result);
             $icon = new recipe($row);
             $item['html'] = '<td class="SearchRowCell">' . $icon->out(true) . '</td>' . '<td class="SearchRowCell">' . $icon->data['level'] . '</td>' . '<td class="SearchRowCell"><span style="color:#' . $icon->data['item_color'] . '">[' . $icon->data['recipe_name'] . ']</span></td>' . '<td class="SearchRowCell">' . $icon->data['skill_name'] . '<br />' . $icon->data['recipe_type'] . '</td>' . '<td class="SearchRowCell">' . str_replace('<br>', '<br />', $icon->data['reagents']) . '</td>' . '<td class="SearchRowCellRight"><a href="' . makelink('char-info-recipes&amp;a=c:' . $row['member_id'] . '#' . strtolower(str_replace(' ', '', $icon->data['skill_name']))) . '"><strong>' . $row['name'] . '</strong></a></td>';
             $this->add_result($item);
             unset($item);
             $x--;
         }
     } else {
         $this->result_count = $nrows;
     }
     $roster->db->free_result($result);
 }
开发者ID:Sajaki,项目名称:wowroster_dev,代码行数:26,代码来源:professions.php

示例4: consume

 /**
  * Consumes the resource by method and returns the results of the request.
  *
  * @param string $method Request method
  * @param array $params Parameters
  * @throws ResourceException If request method is not allowed
  * @return array Request data
  */
 public function consume($method, $params = array())
 {
     global $roster;
     $makecache = false;
     $msg = '';
     if (!in_array($method, $this->methods_allowed)) {
         $roster->set_message('The selected api action is not allowed', 'Method not allowed.', 'error');
         //throw new ResourceException('Method not allowed.', 405);
     }
     // new prity url builder ... much better then befor...
     $ui = API_URI;
     //sprintf(self::API_URI, $this->region);
     // new cache system see hwo old teh file is only live update files more then X days/hours old
     $this->querytime = format_microtime();
     $roster->db->query_count++;
     $url = $this->url->BuildUrl($ui, $method, $params['server'], $params['name'], $params);
     if ($method == 'auction') {
         $data = $this->Curl->makeRequest($url, $params['type'], $params, $url, $method);
         if ($this->Curl->errno !== CURLE_OK) {
             throw new ResourceException($this->Curl->error, $this->Curl->errno);
         }
         $auction = json_decode($data['response'], true);
         $url = $auction['files'][0]['url'];
     }
     $data = $this->Curl->makeRequest($url, null, $params, $url, $method);
     if ($this->Curl->errno !== CURLE_OK) {
         //throw new ResourceException($this->Curl->error, $this->Curl->errno);
         $roster->set_message("The selected api action is not allowed <br/>\n\r [" . $this->Curl->errno . '] : ' . $this->Curl->error . '', 'Curl has Failed!', 'error');
     }
     $errornum = empty($data['response_headers']['http_code']) ? $data['response_headers']['http_code'] : '_911_';
     //Battle.net returned a HTTP error code
     $x = json_decode($data['response'], true);
     //$makecache
     if (isset($x['reason'])) {
         $this->seterrors(array('type' => $method, 'msg' => $x['reason']));
         $msg = $this->transhttpciode($data['response_headers']['http_code']);
         $roster->set_message(' ' . $method . ': ' . $msg . ' : ' . $x['reason'] . '<br>' . $url . ' ', 'Api call fail!', 'error');
         //$roster->set_message( ' '.$method.': '.$x['reason'].' ', 'Api call fail!', 'error' );
         $this->query['result'] = false;
         // over ride cache and set to false no data or no url no file lol
     }
     $roster->api2->cache->api_track($method, $url, $this->Curl->http_code, $this->Curl->content_type);
     $this->usage = array('type' => $method, 'url' => $url, 'responce_code' => $this->Curl->http_code, 'content_type' => $this->Curl->content_type, 'locale' => $this->region);
     if (method_exists($roster->api2->cache, 'insert' . $method) && is_callable(array($roster->api2->cache, 'insert' . $method))) {
         call_user_func(array($roster->api2->cache, 'insert' . $method), $result, $this->usage, $params);
     }
     //print_r($data['response_headers']);
     $data = json_decode($data['response'], true);
     $info = $data;
     //$this->utf8_array_decode($data);
     return $info;
 }
开发者ID:Sajaki,项目名称:wowroster_dev,代码行数:60,代码来源:Resource.php

示例5: _debug

 /**
  * helper function for debugging
  *
  * @param string $string
  * @return string date
  */
 function _debug($level = 0, $ret = false, $info = false, $status = false)
 {
     global $roster, $addon;
     if ($level > $addon['config']['ApiSync_debuglevel']) {
         return;
     }
     $timestamp = round(format_microtime() - APISYNC_STARTTIME, 4);
     if (version_compare(phpversion(), '4.3.0', '>=')) {
         $tmp = debug_backtrace();
         $trace = $tmp[1];
     }
     $array = array('time' => $timestamp, 'file' => isset($trace['file']) ? str_replace($addon['dir'], '', $trace['file']) : 'ApiSync.class.php', 'line' => isset($trace['line']) ? $trace['line'] : '', 'function' => isset($trace['function']) ? $trace['function'] : '', 'class' => isset($trace['class']) ? $trace['class'] : '', 'args' => $addon['config']['ApiSync_debugdata'] != 0 && isset($trace['args']) && !is_object($trace['args']) ? $trace['args'] : '', 'ret' => $addon['config']['ApiSync_debugdata'] != 0 && isset($ret) && !is_object($ret) ? $ret : '', 'info' => isset($info) ? $info : '', 'status' => isset($status) ? $status : '');
     if (!($level > $addon['config']['ApiSync_debuglevel'])) {
         $this->debugmessages[] = $array;
     }
     if ($level == 0) {
         $this->errormessages[] = $array;
     }
 }
开发者ID:Sajaki,项目名称:addons,代码行数:25,代码来源:ApiSyncbase.class.php

示例6: search

 function search($search, $limit = 10, $page = 0)
 {
     global $roster;
     $first = $page * $limit;
     $sql = "SELECT `news`.`news_id`, `news`.`author`, `news`.`title`, `news`.`content`, `news`.`html`, " . "DATE_FORMAT(  DATE_ADD(`news`.`date`, INTERVAL " . $roster->config['localtimeoffset'] . " HOUR ), '" . $roster->locale->act['timeformat'] . "' ) AS 'date_format', " . "COUNT(`comments`.`comment_id`) comm_count " . "FROM `" . $roster->db->table('news', 'news') . "` news " . "LEFT JOIN `" . $roster->db->table('comments', 'news') . "` comments USING (`news_id`) " . "WHERE `news`.`news_id` LIKE '%{$search}%' " . "OR `news`.`author` LIKE '%{$search}%' " . "OR `news`.`date` LIKE '%{$search}%' " . "OR `news`.`title` LIKE '%{$search}%' " . "OR `news`.`content` LIKE '%{$search}%' " . "GROUP BY `news`.`news_id` " . ($limit > 0 ? " LIMIT {$first}," . $limit : '') . ';';
     //calculating the search time
     $this->start_search = format_microtime();
     $result = $roster->db->query($sql);
     $this->stop_search = format_microtime();
     $this->time_search = $this->stop_search - $this->start_search;
     $nrows = $roster->db->num_rows($result);
     $x = $limit > $nrows ? $nrows : ($limit > 0 ? $limit : $nrows);
     if ($nrows > 0) {
         while ($x > 0) {
             list($news_id, $author, $title, $content, $html, $date, $comments) = $roster->db->fetch($result);
             $item['author'] = $author;
             $item['date'] = $date;
             $item['title'] = $title;
             $item['url'] = makelink('util-news-comment&amp;id=' . $news_id);
             if ($html == '1' && $this->data['config']['news_html'] >= 0) {
                 $content = $content;
             } else {
                 $content = htmlentities($content);
             }
             $content = nl2br($content);
             $array = explode(' ', $content, 101);
             if (isset($array[100])) {
                 unset($array[100]);
                 $item['more_text'] = true;
             } else {
                 $item['more_text'] = false;
             }
             $item['short_text'] = implode(' ', $array);
             $item['footer'] = ($comments == 0 ? 'No' : $comments) . ' comment' . ($comments == 1 ? '' : 's');
             $this->add_result($item);
             unset($item);
             $x--;
         }
     }
     $roster->db->free_result($result);
 }
开发者ID:reddragon010,项目名称:wowroster-rge,代码行数:41,代码来源:search.inc.php

示例7: parseFiles

 /**
  * Parses the files and put it in $uploadData
  *
  * @return string $output | Output messages
  */
 function parseFiles()
 {
     global $roster;
     if (!is_array($_FILES)) {
         return '<span class="red">Upload failed: No files present</span>' . "<br />\n";
     }
     require_once ROSTER_LIB . 'luaparser.php';
     $output = $roster->locale->act['parsing_files'] . "<br />\n<ul>";
     foreach ($_FILES as $file) {
         if (!empty($file['name']) && $this->upload_error_check($file)) {
             $filename = explode('.', $file['name']);
             $filebase = strtolower($filename[0]);
             if (in_array($filebase, $this->files)) {
                 // Get start of parse time
                 $parse_starttime = format_microtime();
                 $luahandler = new lua();
                 $data = $luahandler->luatophp($file['tmp_name'], isset($this->blinds[$filebase]) ? $this->blinds[$filebase] : array());
                 // Calculate parse time
                 $parse_totaltime = round(format_microtime() - $parse_starttime, 2);
                 if ($data) {
                     $output .= '<li>' . sprintf($roster->locale->act['parsed_time'], $filename[0], $parse_totaltime) . "</li>\n";
                     $this->uploadData[$filebase] = $data;
                 } else {
                     $output .= '<li>' . sprintf($roster->locale->act['error_parsed_time'], $filebase, $parse_totaltime) . "</li>\n";
                     $output .= $luahandler->error() != '' ? '<li>' . $luahandler->error() . "</li>\n" : '';
                 }
                 unset($luahandler);
             } else {
                 $output .= '<li>' . sprintf($roster->locale->act['upload_not_accept'], $file['name']) . "</li>\n";
             }
         } else {
             $output .= '<li>' . sprintf($roster->locale->act['error_parsed_time'], $file['name'], '0') . "</li>\n";
         }
     }
     $output .= "</ul><br />\n";
     return $output;
 }
开发者ID:Sajaki,项目名称:wowroster,代码行数:42,代码来源:update.lib.php

示例8: search

 function search($search, $limit = 10, $page = 0)
 {
     global $roster;
     include_once $this->data['inc_dir'] . 'vault_item.php';
     // Get all the vault page names first
     $sql = "SELECT `guild_id`, `item_slot`, `item_name`, `item_texture` FROM `" . $roster->db->table('addons_vault_items') . "` WHERE `item_parent` = 'vault';";
     $result = $roster->db->query($sql);
     $x = $roster->db->num_rows($result);
     $tab_name = array();
     while ($x > 0) {
         $row = $roster->db->fetch($result);
         $tab_name[$row['guild_id']][$row['item_slot']] = array('name' => $row['item_name'], 'icon' => $row['item_texture']);
         $x--;
     }
     $roster->db->free_result($result);
     // Search the items
     $first = $page * $limit;
     $sql = "SELECT *, SUM(item_quantity) AS total_quantity" . " FROM `" . $roster->db->table('addons_vault_items') . "`" . " WHERE (`item_parent` LIKE 'Tab%') AND (`item_name` LIKE '%{$search}%' OR `item_tooltip` LIKE '%{$search}%')" . ($this->minlvl != '' ? " AND `level` >= '{$this->minlvl}'" : '') . ($this->maxlvl != '' ? " AND `level` <= '{$this->maxlvl}'" : '') . $this->quality_sql . " GROUP BY `item_name`" . ($limit > 0 ? " LIMIT {$first}," . $limit : '') . ';';
     // calculating the search time
     $this->start_search = format_microtime();
     $result = $roster->db->query($sql);
     $this->stop_search = format_microtime();
     $this->time_search = $this->stop_search - $this->start_search;
     $nrows = $roster->db->num_rows($result);
     $x = $limit > $nrows ? $nrows : ($limit > 0 ? $limit : $nrows);
     if ($nrows > 0 && $limit > 0) {
         while ($x > 0) {
             $row = $roster->db->fetch($result);
             $row['item_quantity'] = $row['total_quantity'];
             // Totals quantity, found on all pages
             $icon = new VaultItem($row, false);
             $item['html'] = '<td class="SearchRowCell">' . $icon->out(true) . '</td>' . '<td class="SearchRowCell">' . $icon->requires_level . '</td>' . '<td class="SearchRowCell"><span style="color:#' . $icon->color . '">[' . $icon->name . ']</span></td>' . '<td class="SearchRowCellRight"><a href="' . makelink('guild-vault&amp;a=g:' . $row['guild_id']) . '">' . '<span class="item-sm">' . '<img src="' . $roster->config['interface_url'] . 'Interface/Icons/' . $tab_name[$row['guild_id']][$row['item_parent']]['icon'] . '.' . $roster->config['img_suffix'] . '" alt="" />' . '<span class="mask none"></span></span>&nbsp;' . $tab_name[$row['guild_id']][$row['item_parent']]['name'] . '</a></td>';
             $this->add_result($item);
             unset($item);
             $x--;
         }
     } else {
         $this->result_count = $nrows;
     }
     $roster->db->free_result($result);
 }
开发者ID:Sajaki,项目名称:wowroster_dev,代码行数:41,代码来源:search.inc.php

示例9: consume

 /**
  * Consumes the resource by method and returns the results of the request.
  *
  * @param string $method Request method
  * @param array $params Parameters
  * @throws ResourceException If request method is not allowed
  * @return array Request data
  */
 public function consume($method, $params = array())
 {
     global $roster;
     $makecache = false;
     $msg = '';
     if (!in_array($method, $this->methods_allowed)) {
         $roster->set_message('The selected api action is not allowed', 'Method not allowed.', 'error');
         //throw new ResourceException('Method not allowed.', 405);
     }
     // new prity url builder ... much better then befor...
     $ui = API_URI;
     //sprintf(self::API_URI, $this->region);
     // new cache system see hwo old teh file is only live update files more then X days/hours old
     $this->querytime = format_microtime();
     $this->query_count++;
     $url = $this->url->BuildUrl($ui, $method, $params['server'], $params['name'], $params);
     if (isset($_GET['debug'])) {
         echo '--[ ' . $url . ' ]--<br>';
     }
     $data = $this->Curl->makeRequest($url, null, $params, $url, $method);
     if ($this->Curl->errno !== CURLE_OK) {
         //throw new ResourceException($this->Curl->error, $this->Curl->errno);
         $roster->set_message("The selected api action is not allowed <br/>\n\r [" . $this->Curl->errno . '] : ' . $this->Curl->error . '', 'Curl has Failed!', 'error');
     }
     $roster->db->queries['api/' . $method][$this->query_count]['query'] = $url;
     $roster->db->queries['api/' . $method][$this->query_count]['time'] = round(format_microtime() - $this->querytime, 4);
     $roster->db->queries['api/' . $method][$this->query_count]['line'] = '94';
     $roster->db->queries['api/' . $method][$this->query_count]['error'] = empty($data['response_headers']['http_code']) ? $data['response_headers']['http_code'] : '';
     // update the tracker...
     $q = "SELECT * FROM `" . $roster->db->table('api_usage') . "` WHERE `date`='" . date("Y-m-d") . "' AND `type` = '" . $method . "'";
     $y = $roster->db->query($q);
     $row = $roster->db->fetch($y);
     if (!isset($row['total'])) {
         $query = 'INSERT INTO `' . $roster->db->table('api_usage') . '` VALUES ';
         $query .= "('','" . $method . "','" . date("Y-m-d") . "','+1'); ";
     } else {
         $query = "Update `" . $roster->db->table('api_usage') . "` SET `total`='" . ($row['total'] + 1) . "' WHERE `type` = '" . $method . "' AND `date` = '" . date("Y-m-d") . "'";
     }
     $ret = $roster->db->query($query);
     //Battle.net returned a HTTP error code
     $x = json_decode($data['response'], true);
     if (isset($data['response_headers']) && $data['response_headers']['http_code'] != '200') {
         $msg = $this->transhttpciode($data['response_headers']['http_code']);
         $roster->set_message(' ' . $method . ': ' . $msg . ' : ' . $x['reason'] . '<br>' . $url . ' ', 'Api call fail!', 'error');
         // update the tracker...
         /* this is not in the main roster install as of yet
         			$errornum = empty($data['response_headers']['http_code']) ? $data['response_headers']['http_code'] : '';
         			$q = "SELECT * FROM `" . $roster->db->table('api_error') . "` WHERE `error_info` = '".$params['name']."' AND `type` = '".$method."'";
         			$y = $roster->db->query($q);
         			$row = $roster->db->fetch($y);
         			if (!isset($row['total']))
         			{
         				$query = 'INSERT INTO `' . $roster->db->table('api_error') . '` VALUES ';
         				$query .= "('','".$method."','".$msg."','".$params['name']."','+1'); ";
         			}
         			else
         			{
         				$query = "Update `" . $roster->db->table('api_error') . "` SET `total`='".($row['total']+1)."' WHERE `type` = '".$method."' AND `error_info` = '".$params['name']."'";
         			}
         			$ret = $roster->db->query($query);
         			*/
         //throw new HttpException(json_decode($data['response'], true), $data['response_headers']['http_code']);
         //$this->seterrors(array('type'=>$method,'msg'=>''.$msg.'<br>'.$url.''));
         //$this->query['result'] = false; // over ride cache and set to false no data or no url no file lol
     }
     //$makecache
     if (isset($x['reason'])) {
         $this->seterrors(array('type' => $method, 'msg' => $x['reason']));
         $msg = $this->transhttpciode($data['response_headers']['http_code']);
         $roster->set_message(' ' . $method . ': ' . $msg . ' : ' . $x['reason'] . '<br>' . $url . ' ', 'Api call fail!', 'error');
         //$roster->set_message( ' '.$method.': '.$x['reason'].' ', 'Api call fail!', 'error' );
         $this->query['result'] = false;
         // over ride cache and set to false no data or no url no file lol
     }
     //print_r($data['response_headers']);
     $data = json_decode($data['response'], true);
     $info = $data;
     //$this->utf8_array_decode($data);
     return $info;
 }
开发者ID:Sajaki,项目名称:wowroster,代码行数:88,代码来源:Resource.php

示例10: query

 /**
  * Basic query function
  *
  * @param $query Query string
  * @return mixed Query ID / Error string / Bool
  */
 function query($query)
 {
     // Remove pre-existing query resources
     unset($this->query_id);
     //$query = preg_replace('/;.*$/', '', $query);
     $this->querytime = format_microtime();
     if ($query != '') {
         $this->query_count++;
         $this->query_id = @mysql_query($query, $this->link_id);
     }
     if (!empty($this->query_id)) {
         if ($this->log_level > 0) {
             $this->_log($query);
         }
         unset($this->record[$this->query_id]);
         unset($this->record_set[$this->query_id]);
         return $this->query_id;
     } elseif ($this->error_die) {
         // I think we should use this method for dying
         die(__FILE__ . ': line[' . __LINE__ . ']<br />Database Error "' . $query . '"<br />MySQL said:<br />' . $this->error());
         //die_quietly($this->error(), 'Database Error',__FILE__,__LINE__,$query);
     } else {
         $this->_log($query);
         trigger_error('Database error. See query log for details', E_USER_NOTICE);
         return false;
     }
 }
开发者ID:Sajaki,项目名称:wowroster_dev,代码行数:33,代码来源:mysql.php

示例11: query

 /**
  * Basic query function
  *
  * @param $query Query string
  * @return mixed Query ID / Error string / Bool
  */
 function query($query)
 {
     global $roster;
     // Remove pre-existing query resources
     unset($this->query_id);
     //$query = preg_replace('/;.*$/', '', $query);
     $this->querytime = format_microtime();
     if ($query != '') {
         $this->query_count++;
         $this->query_id = @mysql_query($query, $this->link_id);
     }
     if (!empty($this->query_id)) {
         if ($this->log_level > 0) {
             $this->_log($query);
         }
         unset($this->record[$this->query_id]);
         unset($this->record_set[$this->query_id]);
         return $this->query_id;
     } elseif ($this->error_die) {
         die_quietly($this->error(), 'Database Error', __FILE__, __LINE__, $query);
     } else {
         $this->_log($query);
         trigger_error('Database error. See query log for details', E_USER_NOTICE);
         return false;
     }
 }
开发者ID:reddragon010,项目名称:wowroster-rge,代码行数:32,代码来源:mysql.php

示例12: point_info

 /**
  * Информация о ресурсах потребляемых на каком-то участке кода
  * @param string $key Имя метки
  * @param bool $store Необходимо ли сохранить информацию о метке в памяти
  * @param bool $clear Нужно ли выполнить сброс меток
  */
 function point_info($key, $store = false, $clear = false)
 {
     static $marks = array();
     $out = array();
     if (is_scalar($key) && !empty($key)) {
         if ($store) {
             $marks[$key] = array('time' => microtime(true), 'memory' => memory_get_usage());
             $out = array('memory' => format_bytes($marks[$key]['memory']), 'time' => format_microtime($marks[$key]['time']));
         } else {
             $out = get_key($marks, $key, array('time' => get_key($_SERVER, 'REQUEST_TIME_FLOAT', 0), 'memory' => 0), 'is_array');
             $out['time'] = format_microtime(microtime(true) - $out['time']);
             $out['memory'] = format_bytes(memory_get_usage() - $out['memory']);
         }
     }
     if ($clear) {
         $marks = array();
     }
     return $out;
 }
开发者ID:agelxnash,项目名称:functions,代码行数:25,代码来源:debug.functions.php

示例13: query

 /**
  * Basic query function
  *
  * @param $query Query string
  * @return mixed Query ID / Error string / Bool
  */
 function query($query)
 {
     // Remove pre-existing query resources
     unset($this->query_id);
     //$query = preg_replace('/;.*$/', '', $query);
     $this->querytime = format_microtime();
     try {
         if ($query != '') {
             $this->query_count++;
             //$this->query_id = $this->link_id->query($query);//, $this->link_id);
             //print_r($this->query_id);echo ' ~<br>';
             $this->query_id = $this->link_id->prepare($query);
             //print_r($res);echo ' ~~<br>';
             $this->query_id->execute();
             //print_r($this->query_id);echo ' ~~~<br>';
         }
         if (!empty($this->query_id)) {
             if ($this->log_level > 0) {
                 $this->_log($query);
             }
             unset($this->record[spl_object_hash($this->query_id)]);
             unset($this->record_set[spl_object_hash($this->query_id)]);
             return $this->query_id;
         }
     } catch (PDOException $e) {
         $err = "The statement failed.<br />";
         $err .= "getCode: " . $e->getCode() . "<br />";
         $err .= "getMessage: " . $e->getMessage() . "<br />";
         $this->queries[$this->file][$this->query_count]['error'] = $e->getMessage();
         //die(__FILE__ . ': line[' . __LINE__ . ']<br />Database Error "' . $query . '"<br />PDO said:<br />' .  $err . ' <br />' . $this->_backtrace());
     }
     /*
     if( $query != '' )
     {
     	$this->query_count++;
     	$this->query_id = $this->link_id->query($query);//, $this->link_id);
     	//print_r($this->query_id);
     }
     
     if( !empty($this->query_id) )
     {
     	if( $this->log_level > 0 )
     	{
     		$this->_log($query);
     	}
     	unset($this->record[spl_object_hash($this->query_id)]);
     	unset($this->record_set[spl_object_hash($this->query_id)]);
     	return $this->query_id;
     }
     else
     */
     if ($this->error_die) {
         // I think we should use this method for dying
         die(__FILE__ . ': line[' . __LINE__ . ']<br />Database Error "' . $query . '"<br />PDO said:<br />' . $this->errno());
         //die_quietly($this->error(), 'Database Error',__FILE__,__LINE__,$query);
     } else {
         $this->_log($query);
         trigger_error('Database error. See query log for details', E_USER_NOTICE);
         return false;
     }
 }
开发者ID:Sajaki,项目名称:wowroster_dev,代码行数:67,代码来源:pdo.php

示例14: exit

<?php

/**
 * WoWRoster.net WoWRoster
 *
 * Contants and defines file for ArmorySync
 *
 * LICENSE: Licensed under the Creative Commons
 *          "Attribution-NonCommercial-ShareAlike 2.5" license
 *
 * @copyright  2002-2007 WoWRoster.net
 * @license    http://creativecommons.org/licenses/by-nc-sa/2.5   Creative Commons "Attribution-NonCommercial-ShareAlike 2.5"
 * @version    SVN: $Id$
 * @link       http://www.wowroster.net
 * @since      File available since Release 2.6.0
 * @package    ArmorySync
*/
if (!defined('IN_ROSTER')) {
    exit('Detected invalid access to this file!');
}
define('ARMORYSYNC_STARTTIME', isset($_POST['ARMORYSYNC_STARTTIME']) ? $_POST['ARMORYSYNC_STARTTIME'] : format_microtime());
define('ARMORYSYNC_CACHE', ROSTER_CACHEDIR);
define('ARMORYSYNC_VERSION', '1.0');
define('ARMORYSYNC_REQUIRED_ROSTER_VERSION', '2.1.9.2400');
开发者ID:Sajaki,项目名称:addons,代码行数:24,代码来源:constants.php

示例15: exit

 *
 * LICENSE: Licensed under the Creative Commons
 *          "Attribution-NonCommercial-ShareAlike 2.5" license
 *
 * @copyright  2002-2008 WoWRoster.net
 * @license    http://creativecommons.org/licenses/by-nc-sa/2.5   Creative Commons "Attribution-NonCommercial-ShareAlike 2.5"
 * @version    SVN: $Id: footer.php 1791 2008-06-15 16:59:24Z Zanix $
 * @link       http://www.wowroster.net
 * @since      File available since Release 1.6.0
 * @package    WoWRoster
 */
if (!defined('IN_ROSTER')) {
    exit('Detected invalid access to this file!');
}
define('ROSTER_FOOTER_INC', true);
$totaltime = round(format_microtime() - ROSTER_STARTTIME, 2);
$error_report = $roster->error->stop();
// Assign template vars
$roster->tpl->assign_vars(array('S_PROCESSTIME' => $roster->config['processtime'], 'S_DEBUG_MODE' => $roster->config['debug_mode'] && is_array($error_report), 'S_SQL_WIN' => $roster->config['sql_window'], 'S_DESCRIBE' => $roster->config['sql_window'] == 2, 'PROCESSTIME' => $totaltime, 'QUERYCOUNT' => $roster->db->query_count, 'ROSTER_PATH' => ROSTER_PATH, 'ROSTER_BODY' => (!empty($roster->config['roster_bg']) ? ' style="background-image:url(' . $roster->config['roster_bg'] . ');"' : '') . (!empty($roster->output['body_attr']) ? ' ' . $roster->output['body_attr'] : ''), 'ROSTER_ONLOAD' => !empty($roster->output['body_onload']) ? $roster->output['body_onload'] : '', 'WEBSITE_ADDRESS' => $roster->config['website_address'], 'HEADER_LOGO' => $roster->config['logo'], 'IMG_URL' => $roster->config['img_url'], 'INTERFACE_URL' => $roster->config['interface_url'], 'ROSTER_VERSION' => $roster->config['version'], 'ROSTER_CREDITS' => sprintf($roster->locale->act['roster_credits'], makelink('credits'))));
if ($roster->config['debug_mode']) {
    if (is_array($error_report)) {
        foreach ($error_report as $file => $errors) {
            $roster->tpl->assign_block_vars('php_debug', array('FILE' => substr($file, strlen(ROSTER_BASE))));
            foreach ($errors as $error) {
                $roster->tpl->assign_block_vars('php_debug.row', array('ROW_CLASS' => $roster->switch_row_class(), 'ERROR' => $error));
            }
        }
    }
}
if ($roster->config['sql_window']) {
    if (count($roster->db->queries) > 0) {
开发者ID:reddragon010,项目名称:wowroster-rge,代码行数:31,代码来源:footer.php


注:本文中的format_microtime函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。