]> git.wh0rd.org - tt-rss.git/commitdiff
remove error_reporting() hacks; set default error reporting level in functions.php
authorAndrew Dolgov <fox@madoka.volgo-balt.ru>
Wed, 10 Nov 2010 10:14:44 +0000 (13:14 +0300)
committerAndrew Dolgov <fox@madoka.volgo-balt.ru>
Wed, 10 Nov 2010 10:14:44 +0000 (13:14 +0300)
backend.php
db-updater.php
digest.php
functions.php
localized_js.php
opml.php
prefs.php
register.php
tt-rss.php
update.php
update_daemon2.php

index 34f9c3b253956304edd6bb35f9d96e2379dcbdfa..8b1454ad74e2c84c6ff3debaaf7591649f040eb4 100644 (file)
@@ -1,6 +1,4 @@
 <?php
-       error_reporting(E_ERROR | E_WARNING | E_PARSE);
-
        /* remove ill effects of magic quotes */
 
        if (get_magic_quotes_gpc()) {
                $_REQUEST = array_map('stripslashes_deep', $_REQUEST);
        }
 
+       require_once "functions.php";
        require_once "sessions.php";
        require_once "modules/backend-rpc.php";
-
-/*     if ($_REQUEST["debug"]) {
-               define('DEFAULT_ERROR_LEVEL', E_ALL);
-       } else {
-               define('DEFAULT_ERROR_LEVEL', E_ERROR | E_WARNING | E_PARSE);
-       }
-       
-       error_reporting(DEFAULT_ERROR_LEVEL); */
-
        require_once "sanity_check.php";
        require_once "config.php";
-       
        require_once "db.php";
        require_once "db-prefs.php";
-       require_once "functions.php";
 
        no_cache_incantation();
 
index 76e3088567128eb19375742248f1cc347515b354..09c16955b3454622ca720e0959ad064487885075 100644 (file)
@@ -1,10 +1,7 @@
 <?php
-       error_reporting(E_ERROR | E_WARNING | E_PARSE);
-
+       require_once "functions.php";
        require_once "sessions.php";
-       
        require_once "sanity_check.php";
-       require_once "functions.php";
        require_once "config.php";
        require_once "db.php";
        
index d2bbfedb7a95fc39ca2a045db2a5b6280f4ba1f4..0d49342177efa05c09e931a3b1c73b88c2955fd3 100644 (file)
@@ -1,6 +1,4 @@
 <?php
-       error_reporting(E_ERROR | E_WARNING | E_PARSE);
-
        require_once "functions.php"; 
        require_once "sessions.php";
        require_once "sanity_check.php";
index 0448b6876f5980312c79363fd61ca54ab5b95ca2..73fd93682dafefd7632227aee85d32cd12245bcc 100644 (file)
@@ -1,10 +1,7 @@
 <?php
 
        date_default_timezone_set('UTC');
-
-       if ($_REQUEST["debug"]) {
-               define('DEFAULT_ERROR_LEVEL', E_ALL);
-       }
+       error_reporting(E_ALL & ~E_NOTICE);
 
        require_once 'config.php';
 
                        curl_setopt($ch, CURLOPT_BINARYTRANSFER, true);
                        curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
 
-                       $contents = curl_exec($ch);
+                       $contents = @curl_exec($ch);
                        if ($contents === false) {
                                curl_close($ch);
                                return false;
 
                        return $contents;
                } else {
-                       return file_get_contents($url);
+                       return @file_get_contents($url);
                }
 
        }
 
 #              print "FAVICON [$site_url]: $favicon_url\n";
 
-               error_reporting(0);
-
                $icon_file = ICONS_DIR . "/$feed.ico";
 
                if ($favicon_url && !file_exists($icon_file)) {
                                }
                        }
                }
-
-               error_reporting(DEFAULT_ERROR_LEVEL);
-
        }
 
        function update_rss_feed($link, $feed, $ignore_daemon = false) {
                        _debug("update_rss_feed: fetching [$fetch_url]...");
                }
 
-               if (!defined('DAEMON_EXTENDED_DEBUG') && !$_REQUEST['xdebug']) {
-                       error_reporting(0);
-               }
-
                $obj_id = md5("FDATA:$use_simplepie:$fetch_url");
 
                if ($memcache && $obj = $memcache->get($obj_id)) {
                } else {
 
                        if (!$use_simplepie) {
-                               $rss = fetch_rss($fetch_url);
+                               $rss = @fetch_rss($fetch_url);
                        } else {
                                if (!is_dir(SIMPLEPIE_CACHE_DIR)) {
                                        mkdir(SIMPLEPIE_CACHE_DIR);
 
                if (defined('DAEMON_EXTENDED_DEBUG') || $_REQUEST['xdebug']) {
                        _debug("update_rss_feed: fetch done, parsing...");
-               } else {
-                       error_reporting (DEFAULT_ERROR_LEVEL);
                }
 
                $feed = db_escape_string($feed);
                                                $dupcheck_qpart = "";
                                        }
 
-//                                     error_reporting(0);
-
                                        /* Collect article tags here so we could filter by them: */
 
                                        $article_filters = get_article_filters($filters, $entry_title, 
                                                continue;
                                        }
 
-//                                     error_reporting (DEFAULT_ERROR_LEVEL);
-
                                        $score = calculate_article_score($article_filters);
 
                                        if (defined('DAEMON_EXTENDED_DEBUG') || $_REQUEST['xdebug']) {
 
        function sanity_check($link) {
 
-               error_reporting(0);
-
                $error_code = 0;
                $schema_version = get_schema_version($link);
 
                        $error_code = 12;
                }
 
-               error_reporting (DEFAULT_ERROR_LEVEL);
-
                if ($error_code != 0) {
                        print_error_xml($error_code);
                        return false;
 
        function file_is_locked($filename) {
                if (function_exists('flock')) {
-                       error_reporting(0);
-                       $fp = fopen(LOCK_DIRECTORY . "/$filename", "r");
-                       error_reporting(DEFAULT_ERROR_LEVEL);
+                       $fp = @fopen(LOCK_DIRECTORY . "/$filename", "r");
                        if ($fp) {
                                if (flock($fp, LOCK_EX | LOCK_NB)) {
                                        flock($fp, LOCK_UN);
 
                        if (time() - $_SESSION["daemon_stamp_check"] > 30) {
 
-                               $stamp = (int) file_get_contents(LOCK_DIRECTORY . "/update_daemon.stamp");
+                               $stamp = (int) @file_get_contents(LOCK_DIRECTORY . "/update_daemon.stamp");
 
                                if ($stamp) {
                                        $stamp_delta = time() - $stamp;
                if (CHECK_FOR_NEW_VERSION && $_SESSION["access_level"] >= 10) {
                        
                        if ($_SESSION["last_version_check"] + 86400 + rand(-1000, 1000) < time()) {
-                               $new_version_details = check_for_update($link);
+                               $new_version_details = @check_for_update($link);
 
                                print "<param key=\"new_version_available\" value=\"".
                                        sprintf("%d", $new_version_details != ""). "\"/>";
                        return;
                }
 
-               error_reporting(0);
                if (DEFAULT_UPDATE_METHOD == "1") {
                        $rss = new SimplePie();
                        $rss->set_useragent(SIMPLEPIE_USERAGENT . MAGPIE_USER_AGENT_EXT);
-//                     $rss->set_timeout(MAGPIE_FETCH_TIME_OUT);
                        $rss->set_feed_url($fetch_url);
                        $rss->set_output_encoding('UTF-8');
                        $rss->init();
                } else {
                        $rss = fetch_rss($releases_feed);
                }
-               error_reporting (DEFAULT_ERROR_LEVEL);
 
                if ($rss) {
 
 
                        $lnum = $limit*$offset;
 
-                       error_reporting (DEFAULT_ERROR_LEVEL);
-       
                        $num_unread = 0;
                        $cur_feed_title = '';
 
                $url     = fix_url($url);
                $baseUrl = substr($url, 0, strrpos($url, '/') + 1);
 
+               libxml_use_internal_errors(true);
+
                $doc = new DOMDocument();
                $doc->loadHTMLFile($url);
                $xpath = new DOMXPath($doc);
index 0d66da575d6d8b610f91a36df4994a437faeb390..08eec1affda61182d9633c2ddcc4109fb2274585 100644 (file)
@@ -1,5 +1,4 @@
 <?php
-       error_reporting(E_ERROR | E_WARNING | E_PARSE);
        define('DISABLE_SESSIONS', true);
 
        require "functions.php";
index 98f4a95aa2f0c7c59f316d3c6dcef2acfa9ee076..296f43bed1693901328a9ef267daf4bf42e7582e 100644 (file)
--- a/opml.php
+++ b/opml.php
@@ -1,9 +1,7 @@
 <?php
-       error_reporting(E_ERROR | E_WARNING | E_PARSE);
-
+       require_once "functions.php";
        require_once "sessions.php";
        require_once "sanity_check.php";
-       require_once "functions.php";
        require_once "config.php";
        require_once "db.php";
        require_once "db-prefs.php";
index c6d2605b995b2d9d0c082367bbad3a6d49acf213..5cedb4f6fd104ee069ffcaed51fe54a0ff6d9689 100644 (file)
--- a/prefs.php
+++ b/prefs.php
@@ -1,6 +1,4 @@
 <?php
-       error_reporting(E_ERROR | E_WARNING | E_PARSE);
-
        require_once "functions.php"; 
        require_once "sessions.php";
        require_once "sanity_check.php";
index 9969d83ba8e2c369d3d83c91d80f0fa349d7cb9c..bd80a4df30eeb921615ea47e5f7313367b3ebab2 100644 (file)
@@ -4,14 +4,11 @@
        // 1) templates/register_notice.txt - displayed above the registration form
        // 2) register_expire_do.php - contains user expiration queries when necessary
 
-       error_reporting(E_ERROR | E_WARNING | E_PARSE);
-
        $action = $_REQUEST["action"];
 
+       require_once "functions.php";
        require_once "sessions.php";
-       
        require_once "sanity_check.php";
-       require_once "functions.php";
        require_once "config.php";
        require_once "db.php";
        
index 5375309ce25457ea4fe921be52fa290e1c313117..1452bd297b0207118ad5be688a41f3e8df9584ad 100644 (file)
@@ -1,6 +1,4 @@
 <?php
-       error_reporting(E_ERROR | E_WARNING | E_PARSE);
-
        require_once "functions.php"; 
        require_once "sessions.php";
        require_once "sanity_check.php";
index 50b9fc412e950fe65942d35714d04f6e51e7d9ed..64b5795fa39f699c6ea78cd4efe77cd73952108c 100755 (executable)
@@ -1,18 +1,15 @@
 #!/usr/bin/php
 <?php
-       define('DEFAULT_ERROR_LEVEL', E_ERROR | E_WARNING | E_PARSE);
        define('DISABLE_SESSIONS', true);
 
        if (!defined('PHP_EXECUTABLE'))
                define('PHP_EXECUTABLE', '/usr/bin/php');
 
-       error_reporting(DEFAULT_ERROR_LEVEL);
-
+       require_once "functions.php";
        require_once "sanity_check.php";
        require_once "config.php";
        require_once "db.php";
        require_once "db-prefs.php";
-       require_once "functions.php";
 
        $op = $argv[1];
 
index d7141c87815a0d8a784b0e099502363dbb7fcdcd..5ffc4f549934528fcb1c9ae13ddf312325a981a5 100755 (executable)
@@ -3,9 +3,6 @@
        // This is an experimental multiprocess update daemon.
        // Some configurable variable may be found below.
 
-       // define('DEFAULT_ERROR_LEVEL', E_ALL);
-       define('DEFAULT_ERROR_LEVEL', E_ERROR | E_WARNING | E_PARSE);
-
        declare(ticks = 1);
 
        define('DISABLE_SESSIONS', true);
@@ -38,8 +35,6 @@
        require_once "functions.php";
        require_once "lib/magpierss/rss_fetch.inc";
 
-       error_reporting(DEFAULT_ERROR_LEVEL);
-
        $children = array();
        $ctimes = array();