本文整理汇总了PHP中debug::write_error方法的典型用法代码示例。如果您正苦于以下问题:PHP debug::write_error方法的具体用法?PHP debug::write_error怎么用?PHP debug::write_error使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类debug
的用法示例。
在下文中一共展示了debug::write_error方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: error
function error($description, $error_place='', $params=array())
{
trigger_error('error', E_USER_WARNING);
if(isset($GLOBALS['error_recursion']) && $GLOBALS['error_recursion'])
die($description . ' - (error recursion!!!)');
$description = $description . "\n\nback trace:\n" . get_trace_back();
$GLOBALS['error_recursion'] = true;
rollback_user_transaction();
debug :: set_message_output(DEBUG_OUTPUT_MESSAGE_STORE | DEBUG_OUTPUT_MESSAGE_SEND);
debug :: write_error($description, $error_place, $params);
if (debug :: is_console_enabled())
{
debug :: write_error($description, $error_place, $params);
echo debug :: parse_console();
}
ob_end_flush();
exit();
}
示例2: run
function run(&$filter_chain, &$request, &$response)
{
debug::add_timing_point('authentication filter started');
if (!($object_data = fetch_requested_object($request))) {
if (!($node = map_request_to_node($request))) {
if (defined('ERROR_DOCUMENT_404')) {
$response->redirect(ERROR_DOCUMENT_404);
} else {
$response->header("HTTP/1.1 404 Not found");
}
return;
}
$response->redirect('/root/login?redirect=' . urlencode($_SERVER['REQUEST_URI']));
return;
}
$object =& wrap_with_site_object($object_data);
$site_object_controller =& $object->get_controller();
if (($action = $site_object_controller->determine_action($request)) === false) {
debug::write_error('"' . $action . '" action not found', __FILE__ . ' : ' . __LINE__ . ' : ' . __FUNCTION__);
if (defined('ERROR_DOCUMENT_404')) {
$response->redirect(ERROR_DOCUMENT_404);
} else {
$response->header("HTTP/1.1 404 Not found");
}
debug::add_timing_point('authentication filter finished');
$filter_chain->next();
return;
}
$actions = $object->get_attribute('actions');
if (!isset($actions[$action])) {
$response->redirect('/root/login?redirect=' . urlencode($_SERVER['REQUEST_URI']));
}
debug::add_timing_point('authentication filter finished');
$filter_chain->next();
}
示例3: foreach
function _valid_perform(&$request, &$response)
{
$data = $this->dataspace->export();
$request->set_status(REQUEST_STATUS_FAILURE);
if($request->has_attribute('popup'))
$response->write(close_popup_response($request));
if(!isset($data['ids']) || !is_array($data['ids']))
return;
$objects = $this->_get_objects_to_delete(array_keys($data['ids']));
foreach($objects as $id => $item)
{
if($item['delete_status'] !== 0 )
continue;
$site_object =& wrap_with_site_object($item);
if(!$site_object->delete())
{
debug :: write_error("object couldn't be deleted",
__FILE__ . ' : ' . __LINE__ . ' : ' . __FUNCTION__,
array('node_id' => $id));
return;
}
}
$request->set_status(REQUEST_STATUS_SUCCESS);
$response->write(close_popup_response($request));
}
示例4: perform
function perform()
{
$tree =& limb_tree::instance();
if (isset($_REQUEST['id'])) {
$node_id = (int) $_REQUEST['id'];
} else {
$node_id = get_mapped_id();
}
if (!isset($_REQUEST['direction'])) {
return false;
}
if (!($object_data = fetch_one_by_node_id($node_id))) {
debug::write_error('Node is not accessible', __FILE__ . ' : ' . __LINE__ . ' : ' . __FUNCTION__, array('node_id' => $node_id));
return false;
}
$direction = $_REQUEST['direction'];
if (!($direction == 'up' || $direction == 'down')) {
debug::write_error('Direction is not correct', __FILE__ . ' : ' . __LINE__ . ' : ' . __FUNCTION__, array('direction' => $direction));
return false;
}
if ($tree->change_node_order($node_id, $direction)) {
reload(PHP_SELF . '#' . $node_id);
}
return false;
}
示例5: perform
function perform()
{
if ($this->is_first_time())
{
$this->_init_dataspace();
return $this->_first_time_perform();
}
else
{
$this->_transfer_dataspace();
$this->_process_transfered_dataspace();
if(!$this->validate())
{
$result =& new not_valid_response();
debug :: write_error('validation failed',
__FILE__ . ' : ' . __LINE__ . ' : ' . __FUNCTION__);
}
else
$result = $this->_valid_perform();
if($this->view && $form =& $this->view->find_child($this->name))
$form->set_valid_status($result->is_success());
return $result;
}
}
示例6: perform
function perform()
{
$tree =& limb_tree::instance();
if (isset($_REQUEST['id'])) {
$node_id = (int) $_REQUEST['id'];
} else {
$node_id = get_mapped_id();
}
if (!isset($_REQUEST['direction'])) {
return new failed_response();
}
if (!($object_data = fetch_one_by_node_id($node_id))) {
debug::write_error('Node is not accessible', __FILE__ . ' : ' . __LINE__ . ' : ' . __FUNCTION__, array('node_id' => $node_id));
return new close_popup_response(RESPONSE_STATUS_FAILURE);
}
$direction = $_REQUEST['direction'];
if (!($direction == 'up' || $direction == 'down')) {
debug::write_error('Direction is not correct', __FILE__ . ' : ' . __LINE__ . ' : ' . __FUNCTION__, array('direction' => $direction));
return new close_popup_response(RESPONSE_STATUS_FAILURE);
}
if ($tree->change_node_order($node_id, $direction)) {
return new close_popup_response();
} else {
return new close_popup_response(RESPONSE_STATUS_FAILURE);
}
}
示例7: perform
function perform(&$request, &$response)
{
if (($t = $request->get_attribute('t')) && is_array($t) && sizeof($t) > 0) {
$this->history = $t;
$template_path = end($this->history);
} else {
$template_path = TEMPLATE_FOR_HACKERS;
}
if (substr($template_path, -5, 5) != '.html') {
$template_path = TEMPLATE_FOR_HACKERS;
}
if (substr($template_path, -5, 5) != '.html') {
$request->set_status(REQUEST_STATUS_FAILURE);
}
if (!($source_file_path = resolve_template_source_file_name($template_path))) {
debug::write_error('template not found', __FILE__ . ' : ' . __LINE__ . ' : ' . __FUNCTION__, array('template_path' => $this->template_path));
$source_file_path = resolve_template_source_file_name(TEMPLATE_FOR_HACKERS);
}
$template_contents = file_get_contents($source_file_path);
if (sizeof($this->history) > 1) {
$tmp_history = $this->history;
$from_template_path = $tmp_history[sizeof($tmp_history) - 2];
$tmp_history = array_splice($tmp_history, 0, sizeof($tmp_history) - 1);
$history_query = 't[]=' . implode('&t[]=', $tmp_history);
$this->view->set('history_query', $history_query);
$this->view->set('from_template_path', $from_template_path);
}
$this->view->set('template_path', $template_path);
$this->view->set('template_content', $this->_process_template_content($template_contents));
}
示例8: explode
function _set_order_parameters($order_string)
{
$order_items = explode(',', $order_string);
$order_pairs = array();
foreach($order_items as $order_pair)
{
$arr = explode('=', $order_pair);
if(isset($arr[1]))
{
if(strtolower($arr[1]) == 'asc' || strtolower($arr[1]) == 'desc'
|| strtolower($arr[1]) == 'rand()')
$order_pairs[$arr[0]] = strtoupper($arr[1]);
else
debug :: write_error('wrong order type',
__FILE__ . ' : ' . __LINE__ . ' : ' . __FUNCTION__,
array('order' => $arr[1]));
}
else
$order_pairs[$arr[0]] = 'ASC';
}
if(sizeof($order_pairs))
$this->parameters['order'] = $order_pairs;
}
示例9: write
function write($log_file_data, $string)
{
$log_dir = $log_file_data[0];
$log_name = $log_file_data[1];
$file_name = $log_dir . $log_name;
if (!is_dir($log_dir)) {
fs::mkdir($log_dir, 0775, true);
}
$oldumask = @umask(0);
$file_existed = @file_exists($file_name);
$log_file = @fopen($file_name, 'a');
if ($log_file) {
$time = strftime("%b %d %Y %H:%M:%S", strtotime('now'));
$notice = '[ ' . $time . " ]\n";
$user =& user::instance();
if (($user_id = $user->get_id()) != DEFAULT_USER_ID) {
$notice .= '[ ' . $user_id . ' ] [ ' . $user->get_login() . ' ] [ ' . $user->get_email() . ' ] ';
}
$notice .= '[' . sys::client_ip() . '] [' . (isset($_SERVER['REQUEST_URI']) ? $_SERVER['REQUEST_URI'] : '') . "]\n" . $string . "\n\n";
@fwrite($log_file, $notice);
@fclose($log_file);
if (!$file_existed) {
@chmod($file_name, 0664);
}
@umask($oldumask);
$result = true;
} else {
@umask($oldumask);
$result = false;
debug::write_error("Cannot open log file '{$file_name}' for writing\n" . "The web server must be allowed to modify the file.\n" . "File logging for '{$file_name}' is disabled.", __FILE__ . ' : ' . __LINE__ . ' : ' . __FUNCTION__, false);
}
return $result;
}
示例10: error
function error($description, $error_place = '', $params = array())
{
if (defined('DEVELOPER_ENVIROMENT')) {
trigger_error('error', E_USER_WARNING);
echo $description . '<br>' . $error_place . '<br><pre>';
print_r($params);
echo '</pre>';
}
debug::write_error($description, $error_place, $params);
rollback_user_transaction();
if (debug::is_console_enabled()) {
echo debug::parse_html_console();
} else {
$message = '';
if ($user_id = user::get_id()) {
$message .= "user id:\t{$user_id}\nlogin:\t\t" . user::get_login() . "\ne-mail:\t\t" . user::get_email() . "\n";
}
$message .= "ip:\t\t" . sys::client_ip() . "\nrequest:\t" . REQUEST_URI . "\nerror:\t\t{$title}\ndescription:\t{$msg}";
$mail = new mime_mail();
$mail->set_body($message);
$mail->build_message();
$mail->send('developer', DEVELOPER_EMAIL, '', WEBSITE_EMAIL, $_SERVER['HTTP_HOST'] . ' internal error!');
}
ob_end_flush();
exit;
}
示例11: perform
function perform()
{
if (isset($_REQUEST['t']) && is_array($_REQUEST['t']) && sizeof($_REQUEST['t']) > 0) {
$this->history = $_REQUEST['t'];
$template_path = end($this->history);
} else {
$template_path = TEMPLATE_FOR_HACKERS;
}
if (substr($template_path, -5, 5) != '.html') {
$template_path = TEMPLATE_FOR_HACKERS;
}
if (substr($template_path, -5, 5) != '.html') {
return new failed_response();
}
if (!($source_file_path = resolve_template_source_file_name($template_path))) {
debug::write_error('template not found', __FILE__ . ' : ' . __LINE__ . ' : ' . __FUNCTION__, array('template_path' => $this->template_path));
$source_file_path = resolve_template_source_file_name(TEMPLATE_FOR_HACKERS);
}
$template_contents = file_get_contents($source_file_path);
if (sizeof($this->history) > 1) {
$tmp_history = $this->history;
$from_template_path = $tmp_history[sizeof($tmp_history) - 2];
$tmp_history = array_splice($tmp_history, 0, sizeof($tmp_history) - 1);
$history_query = 't[]=' . implode('&t[]=', $tmp_history);
$this->view->set('history_query', $history_query);
$this->view->set('from_template_path', $from_template_path);
}
$this->view->set('template_path', $template_path);
$this->view->set('template_content', $this->_process_template_content($template_contents));
return new response();
}
示例12: error
function error($description, $error_place='', $params=array())
{
if(isset($GLOBALS['error_recursion']) && $GLOBALS['error_recursion'])
die();
$GLOBALS['error_recursion'] = true;
if(defined('DEVELOPER_ENVIROMENT'))
{
trigger_error('error', E_USER_WARNING);
echo( $description . '<br>' . $error_place . '<br><pre>');
print_r($params);
echo('</pre>');
}
$description = $description . "\n\nback trace:\n" . get_trace_back();
rollback_user_transaction();
debug :: set_message_output(DEBUG_OUTPUT_MESSAGE_STORE | DEBUG_OUTPUT_MESSAGE_SEND);
debug :: write_error($description, $error_place, $params);
if (debug :: is_console_enabled())
{
debug :: write_error($description, $error_place, $params);
echo debug :: parse_console();
}
ob_end_flush();
exit;
}
示例13: _update_media_record
function _update_media_record($id, $tmp_file_path, $file_name, $mime_type)
{
if (!file_exists($tmp_file_path)) {
debug::write_error('file doesnt exist', __FILE__ . ' : ' . __LINE__ . ' : ' . __FUNCTION__, array('tmp' => $tmp_file_path));
return false;
}
if (function_exists('md5_file')) {
$etag = md5_file($tmp_file_path);
} else {
$fd = fopen($data['tmp_name'], 'rb');
$contents = fread($fd, filesize($tmp_file_path));
fclose($fd);
$etag = md5($contents);
}
if (!is_dir(MEDIA_DIR)) {
dir::mkdir(MEDIA_DIR, 777, true);
}
if (!copy($tmp_file_path, MEDIA_DIR . $id . '.media')) {
debug::write_error('temporary file copy failed', __FILE__ . ' : ' . __LINE__ . ' : ' . __FUNCTION__, array('src' => $tmp_file_path, 'dst' => MEDIA_DIR . $id . '.media'));
return false;
}
$media_db_table = db_table_factory::instance('media');
$media_db_table->update_by_id($id, array('file_name' => $file_name, 'mime_type' => $mime_type, 'size' => filesize($tmp_file_path), 'etag' => $etag));
return true;
}
示例14:
function _valid_perform()
{
$data = $this->dataspace->export();
if(!isset($data['ids']) || !is_array($data['ids']))
return new close_popup_response(RESPONSE_STATUS_FAILURE);
$objects = $this->_get_objects_to_delete(array_keys($data['ids']));
foreach($objects as $id => $item)
{
if($item['delete_status'] !== 0 )
continue;
$site_object =& wrap_with_site_object($item);
if(!$site_object->delete())
{
debug :: write_error("object couldn't be deleted",
__FILE__ . ' : ' . __LINE__ . ' : ' . __FUNCTION__,
array('node_id' => $id));
return new close_popup_response(RESPONSE_STATUS_FAILURE);
}
}
return new close_popup_response();
}
示例15: generate_contents
function generate_contents(&$code)
{
parent::generate_contents($code);
if (isset($this->attributes['navigator'])) {
if ($navigator =& $this->parent->find_child($this->attributes['navigator'])) {
$limit = $code->get_temp_variable();
$code->write_php('$' . $limit . '= ' . $navigator->get_component_ref_code() . '->get_items_per_page();');
$code->write_php($this->get_component_ref_code() . '->set_parameter("limit", $' . $limit . ');');
$code->write_php('if(isset($_GET["page_' . $navigator->get_server_id() . '"])){');
$code->write_php($this->get_component_ref_code() . '->set_parameter("offset", ($_GET["page_' . $navigator->get_server_id() . '"]-1)*$' . $limit . ');');
$code->write_php('}');
}
}
$targets = explode(',', $this->attributes['target']);
foreach ($targets as $target) {
if ($target_component =& $this->parent->find_child(trim($target))) {
$code->write_php($target_component->get_component_ref_code() . '->register_dataset(' . $this->get_component_ref_code() . '->get_dataset());');
} else {
debug::write_error('component target not found', __FILE__ . ' : ' . __LINE__ . ' : ' . __FUNCTION__, array('target' => $target));
}
}
if (isset($this->attributes['navigator']) && $navigator) {
$code->write_php($navigator->get_component_ref_code() . '->set_total_items(' . $this->get_component_ref_code() . '->get_total_count());');
}
}