function LoadTemplateFile($filename) { $txt = ''; if (is_file($filename)) { debug_info(4, 'LoadFile', $filename); $txt = join('', file($filename)); } else { echo "ERROR!!! Not found file {$filename}!!!<BR>"; } return $txt; }
* * @package evocore */ if (!defined('EVO_MAIN_INIT')) { die('Please, do not access this page directly.'); } // Note: if you have a really really good reason to bypass this, uncomment the following line: // return; header('HTTP/1.0 410 Gone'); header('Content-Type: text/html; charset=iso-8859-1'); // no translation ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <title>410 Gone</title> </head> <body> <h1>410 Gone</h1> <p><?php echo $app_name; ?> does no longer publish referer statistics publicly in order not to attract spam robots.</p> <?php debug_info(); ?> </body> </html> <?php exit; // Note: this is NOT a crash. There should be no dying here!
/** * Shutdown function: save HIT and update session! * * This is registered in _main.inc.php with register_shutdown_function() * This is called by PHP at the end of the script. * * NOTE: before PHP 4.1 nothing can be echoed here any more, but the minimum PHP requirement for b2evo is PHP 4.3 */ function shutdown() { /** * @var Hit */ global $Hit; /** * @var Session */ global $Session; global $Settings; global $Debuglog; global $Timer; global $shutdown_count_item_views; // Try forking a background process and let the parent return as fast as possbile. if (is_callable('pcntl_fork') && function_exists('posix_kill') && defined('STDIN')) { if ($pid = pcntl_fork()) { return; } // Parent function shutdown_kill() { posix_kill(posix_getpid(), SIGHUP); } if (ob_get_level()) { // Discard the output buffer and close ob_end_clean(); } fclose(STDIN); // Close all of the standard fclose(STDOUT); // file descriptors as we fclose(STDERR); // are running as a daemon. register_shutdown_function('shutdown_kill'); if (posix_setsid() < 0) { return; } if ($pid = pcntl_fork()) { return; } // Parent // Now running as a daemon. This process will even survive // an apachectl stop. } $Timer->resume('shutdown'); // echo '*** SHUTDOWN FUNC KICKING IN ***'; // fp> do we need special processing if we are in CLI mode? probably earlier actually // if( ! $is_cli ) // Note: it might be useful at some point to do special processing if the script has been aborted or has timed out // connection_aborted() // connection_status() if (!empty($shutdown_count_item_views)) { // Increment view counts for Items: $ItemCache =& get_ItemCache(); foreach ($shutdown_count_item_views as $item_ID) { // asimo> Inserted the $item_ID != 0 check, because another way comes unexpected error on preview page if (!empty($item_ID) && ($Item = $ItemCache->get_by_ID($item_ID, false))) { $Item->count_view(array('allow_multiple_counts_per_page' => false)); } } } // Save the current HIT: $Hit->log(); // Update the SESSION: $Session->dbsave(); // Get updates here instead of slowing down normal display of the dashboard load_funcs('dashboard/model/_dashboard.funcs.php'); b2evonet_get_updates(); // Auto pruning of old HITS, old SESSIONS and potentially MORE analytics data: if ($Settings->get('auto_prune_stats_mode') == 'page') { // Autopruning is requested load_class('sessions/model/_hitlist.class.php', 'Hitlist'); Hitlist::dbprune(); // will prune once per day, according to Settings } // Calling debug_info() here will produce complete data but it will be after </html> hence invalid. // Then again, it's for debug only, so it shouldn't matter that much. debug_info(); // Update the SESSION again, at the very end: // (e.g. "Debuglogs" may have been removed in debug_info()) $Session->dbsave(); $Timer->pause('shutdown'); }
function copy_dir($source, $destination, $child = 1) { //用法: // copy_dir("feiy","feiy2",1):拷贝feiy下的文件到 feiy2,包括子目录 // copy_dir("feiy","feiy2",0):拷贝feiy下的文件到 feiy2,不包括子目录 //参数说明: // $source:源目录名 // $destination:目的目录名 // $child:复制时,是不是包含的子目录 if (!is_dir($source)) { debug_info("Error:the {$source} is not a direction!"); return false; } if (!is_dir($destination)) { mkdir($destination, 0777); } $handle = dir($source); while ($entry = $handle->read()) { if ($entry != "." && $entry != "..") { if (is_dir($source . "/" . $entry)) { if ($child) { copy_dir($source . "/" . $entry, $destination . "/" . $entry, $child); } } else { copy($source . "/" . $entry, $destination . "/" . $entry); } } } return true; }
function __call($function_name, $arg) { $function_name = strtolower($function_name); if (strpos($function_name, 'find_by_') == 0) { $fieldname = str_replace('find_by_', '', $function_name); if (array_key_exists($fieldname, $this->fields)) { if (count($arg) >= 2) { if (array_key_exists('conditions', $arg[1])) { $arg[1]["conditions"] .= " and " . $fieldname . "='" . $arg[0] . "'"; } else { $arg[1]["conditions"] = $fieldname . "='" . $arg[0] . "'"; } } else { $arg[1]["conditions"] = $fieldname . "='" . $arg[0] . "'"; } return $this->find('all', $arg[1]); } } else { debug_info(lang_string('I_FUNCTION', 'function') . $function_name . lang_string('E_NOT_EISTS', 'not exists!')); } }
function handle($field_name = 'file', $filter = '') { if ($_SERVER['REQUEST_METHOD'] != 'POST') { return; } $field_name = empty($field_name) ? $this->field_name : $field_name; if ($this->save_dir[0] == '/') { $this->save_dir = ROOT_DIR_NONE . $this->save_dir; } if (is_dir($this->save_dir) === false) { mkdir($this->save_dir); } if (!array_key_exists($field_name, $_FILES)) { if (function_exists(debug_info)) { debug_info('fail to handle upload file'); } return false; } $this->file_count = count($_FILES[$field_name]['name']); if (!is_array($_FILES[$field_name]['name'])) { //only upload one file if ($_FILES[$field_name]['error'] != UPLOAD_ERR_OK) { alert('fail to upload file!' . $_FILES[$field_name]['error']); return false; } if ($_FILES[$field_name]['size'] > $this->max_file_size & $this->max_file_size > 0) { alert('fail to upload file!out of max size range'); return false; } $path_info = pathinfo($_FILES[$field_name]['name']); $extension = $path_info['extension']; if (!empty($filter)) { global ${$filter}; if (!in_array(strtolower($extension), ${$filter})) { alert('unknow file type'); return false; } } $ret = rand_str() . '.' . $extension; $save_name = $this->save_dir . $ret; $tmp_name = $_FILES[$field_name]['tmp_name']; if (move_uploaded_file($tmp_name, $save_name)) { return $ret; } else { debug_info('上传失败', 'js'); return false; } } else { $result = array(); foreach ($_FILES[$field_name]['error'] as $k => $v) { if ($v != UPLOAD_ERR_OK) { $result[] = array('result' => false, 'name' => '', 'reason' => $v); continue; } else { if ($_FILES[$field_name]['size'][$k] > $this->max_file_size & $this->max_file_size > 0) { $result[] = array('result' => false, 'name' => '', 'reason' => 'out of max size range'); continue; } $path_info = pathinfo($_FILES[$field_name]['name'][$k]); $extension = $path_info['extension']; if (!empty($filter)) { global ${$filter}; if (!in_array(strtolower($extension), ${$filter})) { debug_info('unknow file type'); return false; } } $ret = rand_str() . '.' . $extension; $save_name = $this->save_dir . $ret; $tmp_name = $_FILES[$field_name]['tmp_name'][$k]; if (move_uploaded_file($tmp_name, $save_name)) { $result[] = array('result' => true, 'name' => $ret, 'reason' => 'success'); } else { $result[] = array('result' => false, 'name' => '', 'reason' => 'fail to move_uploaded_file'); } } } return $result; } }
die('请先登录!'); } $id = $user->id; $created_at = date("Y-m-d H:i:s"); $path_info = pathinfo($_FILES['src'][name]); $yuan_pic = $_FILES['src'][tmp_name]; $extension = strtolower($path_info['extension']); $save_name = rand_str() . '.' . $extensio; $save = ROOT_DIR_NONE . "/upload/" . $save_name; $save_e = "/upload/" . $save_name; if (move_uploaded_file($yuan_pic, $save)) { $sql = "insert into eachbb_member.member_avatar(u_id,photo,create_at,status)values({$id},'{$save_e}','{$created_at}',0);"; if ($db->execute($sql)) { create_thumb('big', $save_e, 300, 300); create_thumb('normal', $save_e, 165, 165); create_thumb('small', $save_e, 98, 98); alert("上传成功!"); if ($_SESSION['page_from'] == 'baby') { redirect('/baby/index.php'); } else { redirect('/yard/info.php'); } } else { alert("上传失败!"); } } else { debug_info('fail to upload file:' . $yuan_pic, 'js'); } ?> </body> </html>
private function _debug_info($msg) { global $debug_tag; if ($debug_tag === true) { if (function_exists('debug_info')) { debug_info($msg); } } }
public function get_debug_info($id) { $this->open_stream(); $client = $this->session->all_client; return debug_info($client, $id); }
/** * Outputs Bad request Error message. When in debug mode it also prints a backtrace. * * This should be used when a bad user input is detected? * * @param string Message to output */ function bad_request_die($additional_info = '') { global $debug, $baseurl; // Attempt to output an error header (will not work if the output buffer has already flushed once): // This should help preventing indexing robots from indexing the error :P if (!headers_sent()) { global $io_charset; header('Content-type: text/html; charset=' . $io_charset); // it's ok, if a previous header would be replaced; header('HTTP/1.0 400 Bad Request'); } echo '<div style="background-color: #fdd; padding: 1ex; margin-bottom: 1ex;">'; echo '<h3 style="color:#f00;">' . T_('Bad Request!') . '</h3>'; echo '<p>' . T_('The parameters of your request are invalid.') . '</p>'; echo '<p>' . T_('If you have obtained this error by clicking on a link INSIDE of this site, please report the bad link to the administrator.') . '</p>'; echo '<p><a href="' . $baseurl . '">' . T_('Go back to home page') . '</a></p>'; echo '</div>'; if (!empty($additional_info)) { echo '<div style="background-color: #ddd; padding: 1ex; margin-bottom: 1ex;">'; echo '<h3>' . T_('Additional information about this error:') . '</h3>'; echo $additional_info; echo '</div>'; } if ($debug) { echo debug_get_backtrace(); debug_info(); } // Attempt to keep the html valid (but it doesn't really matter anyway) die('</body></html>'); }