Merge branch 'master' of ssh://git.pk910.de:16110/PHP-P10
[PHP-P10.git] / main.php
index 8361b2833a1bdb4c74b62b003b8d8d907d559ffe..35a257b8171ecd64d67867fdd8c751524281372d 100644 (file)
--- a/main.php
+++ b/main.php
@@ -6,7 +6,7 @@
  * it under the terms of the GNU General Public License as published by *
  * the Free Software Foundation, either version 3 of the License, or    *
  * (at your option) any later version.                                  *
- *                                                                      * 
+ *                                                                      *
  * This program is distributed in the hope that it will be useful,      *
  * but WITHOUT ANY WARRANTY; without even the implied warranty of       *
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the        *
@@ -16,7 +16,7 @@
  * along with this program. If not, see <http://www.gnu.org/licenses/>. *
  *                                                                      *
  ************************************************************************
- * 
+ *
  *  main.php
  *
  * initial php file
@@ -36,6 +36,31 @@ if(function_exists("pcntl_signal")) {
        pcntl_signal(SIGTERM, 'shutdown');
 }
 
+function myErrorHandler($errorcode, $errortext, $errorfile, $errorline)
+{
+    switch ($errorcode) {
+    case E_USER_ERROR:
+        echo $errorcode.': '.$errortext.' in '.$errorfile.' Line '.$errorline;
+        break;
+
+    case E_USER_WARNING:
+        echo $errorcode.': '.$errortext.' in '.$errorfile.' Line '.$errorline;
+        break;
+
+    case E_USER_NOTICE:
+        echo $errorcode.': '.$errortext.' in '.$errorfile.' Line '.$errorline;
+        break;
+        
+    default:
+        echo $errorcode.': '.$errortext.' in '.$errorfile.' Line '.$errorline;
+        break;
+    }
+    
+    return true;
+}
+
+$error_handler = set_error_handler("myErrorHandler");
+
 //basicly here is nothing, yet :D
 $uplink = new Uplink();
 require_once("config.inc.php");
@@ -63,7 +88,7 @@ while(true) {
        $botloader->loop();
        timer_loop();
        if(function_exists("pcntl_signal_dispatch"))
-               pcntl_signal_dispatch();
+       pcntl_signal_dispatch();
 }
 
 ?>
\ No newline at end of file