Changeset 24c91ed in github


Ignore:
Timestamp:
May 20, 2010 4:04:25 AM (3 years ago)
Author:
alecpl <alec@…>
Branches:
master, HEAD, courier-fix, dev-browser-capabilities, pdo, release-0.6, release-0.7, release-0.8
Children:
dc9d750
Parents:
021ef41
Message:
  • Moved error.inc to /utils
  • Removed bugs.inc (content copied into main.inc)
Location:
program
Files:
1 deleted
2 edited
1 moved

Legend:

Unmodified
Added
Removed
  • program/include/iniset.php

    r2eb7943 r24c91ed  
    124124 
    125125// include global functions 
    126 require_once 'include/bugs.inc'; 
    127126require_once 'include/main.inc'; 
    128127require_once 'include/rcube_shared.inc'; 
  • program/include/main.inc

    r0f3764e r24c91ed  
    16191619{ 
    16201620  private $base_url; 
    1621    
     1621 
    16221622  public function __construct($base) 
    16231623  { 
    16241624    $this->base_url = $base; 
    16251625  } 
    1626    
     1626 
    16271627  public function callback($matches) 
    16281628  { 
     
    16311631} 
    16321632 
     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 */ 
     1645function 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 */ 
     1669function 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>&nbsp;'; 
     1703        print nl2br($arg_arr['message']); 
     1704        print '<br />'; 
     1705        flush(); 
     1706    } 
     1707} 
     1708 
    16331709?> 
  • program/steps/utils/error.inc

    rac4882f r24c91ed  
    33/* 
    44 +-----------------------------------------------------------------------+ 
    5  | program/steps/error.inc                                               | 
     5 | program/steps/utils/error.inc                                         | 
    66 |                                                                       | 
    77 | This file is part of the RoundCube Webmail client                     | 
    8  | Copyright (C) 2005-2009, RoundCube Dev. - Switzerland                 | 
     8 | Copyright (C) 2005-2010, RoundCube Dev. - Switzerland                 | 
    99 | Licensed under the GNU GPL                                            | 
    1010 |                                                                       | 
     
    4747                   "Please contact your server-administrator."; 
    4848} 
    49    
     49 
    5050// failed request (wrong step in URL) 
    5151else if ($ERROR_CODE==404) { 
Note: See TracChangeset for help on using the changeset viewer.