Changeset 24c91ed in github
- Timestamp:
- May 20, 2010 4:04:25 AM (3 years ago)
- Branches:
- master, HEAD, courier-fix, dev-browser-capabilities, pdo, release-0.6, release-0.7, release-0.8
- Children:
- dc9d750
- Parents:
- 021ef41
- Location:
- program
- Files:
-
- 1 deleted
- 2 edited
- 1 moved
-
include/bugs.inc (deleted)
-
include/iniset.php (modified) (1 diff)
-
include/main.inc (modified) (2 diffs)
-
steps/utils/error.inc (moved) (moved from program/steps/error.inc) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
program/include/iniset.php
r2eb7943 r24c91ed 124 124 125 125 // include global functions 126 require_once 'include/bugs.inc';127 126 require_once 'include/main.inc'; 128 127 require_once 'include/rcube_shared.inc'; -
program/include/main.inc
r0f3764e r24c91ed 1619 1619 { 1620 1620 private $base_url; 1621 1621 1622 1622 public function __construct($base) 1623 1623 { 1624 1624 $this->base_url = $base; 1625 1625 } 1626 1626 1627 1627 public function callback($matches) 1628 1628 { … … 1631 1631 } 1632 1632 1633 /** 1634 * Throw system error and show error page 1635 * 1636 * @param array Named parameters 1637 * - code: Error code (required) 1638 * - type: Error type [php|db|imap|javascript] (required) 1639 * - message: Error message 1640 * - file: File where error occured 1641 * - line: Line where error occured 1642 * @param boolean True to log the error 1643 * @param boolean Terminate script execution 1644 */ 1645 function raise_error($arg=array(), $log=false, $terminate=false) 1646 { 1647 global $__page_content, $CONFIG, $OUTPUT, $ERROR_CODE, $ERROR_MESSAGE; 1648 1649 // report bug (if not incompatible browser) 1650 if ($log && $arg['type'] && $arg['message']) 1651 log_bug($arg); 1652 1653 // display error page and terminate script 1654 if ($terminate) { 1655 $ERROR_CODE = $arg['code']; 1656 $ERROR_MESSAGE = $arg['message']; 1657 include('program/steps/utils/error.inc'); 1658 exit; 1659 } 1660 } 1661 1662 1663 /** 1664 * Report error according to configured debug_level 1665 * 1666 * @param array Named parameters 1667 * @see raise_error() 1668 */ 1669 function log_bug($arg_arr) 1670 { 1671 global $CONFIG; 1672 $program = strtoupper($arg_arr['type']); 1673 1674 // write error to local log file 1675 if ($CONFIG['debug_level'] & 1) { 1676 $post_query = ($_SERVER['REQUEST_METHOD'] == 'POST' ? '?_task='.urlencode($_POST['_task']).'&_action='.urlencode($_POST['_action']) : ''); 1677 $log_entry = sprintf("%s Error: %s%s (%s %s)", 1678 $program, 1679 $arg_arr['message'], 1680 $arg_arr['file'] ? sprintf(' in %s on line %d', $arg_arr['file'], $arg_arr['line']) : '', 1681 $_SERVER['REQUEST_METHOD'], 1682 $_SERVER['REQUEST_URI'] . $post_query); 1683 1684 if (!write_log('errors', $log_entry)) { 1685 // send error to PHPs error handler if write_log didn't succeed 1686 trigger_error($arg_arr['message']); 1687 } 1688 } 1689 1690 // resport the bug to the global bug reporting system 1691 if ($CONFIG['debug_level'] & 2) { 1692 // TODO: Send error via HTTP 1693 } 1694 1695 // show error if debug_mode is on 1696 if ($CONFIG['debug_level'] & 4) { 1697 print "<b>$program Error"; 1698 1699 if (!empty($arg_arr['file']) && !empty($arg_arr['line'])) 1700 print " in $arg_arr[file] ($arg_arr[line])"; 1701 1702 print ':</b> '; 1703 print nl2br($arg_arr['message']); 1704 print '<br />'; 1705 flush(); 1706 } 1707 } 1708 1633 1709 ?> -
program/steps/utils/error.inc
rac4882f r24c91ed 3 3 /* 4 4 +-----------------------------------------------------------------------+ 5 | program/steps/ error.inc|5 | program/steps/utils/error.inc | 6 6 | | 7 7 | This file is part of the RoundCube Webmail client | 8 | Copyright (C) 2005-20 09, RoundCube Dev. - Switzerland |8 | Copyright (C) 2005-2010, RoundCube Dev. - Switzerland | 9 9 | Licensed under the GNU GPL | 10 10 | | … … 47 47 "Please contact your server-administrator."; 48 48 } 49 49 50 50 // failed request (wrong step in URL) 51 51 else if ($ERROR_CODE==404) {
Note: See TracChangeset
for help on using the changeset viewer.
