Index: index.php
===================================================================
--- index.php	(revision 21659)
+++ index.php	(working copy)
@@ -27,7 +27,7 @@
 if ( version_compare( phpversion(), '5.1' ) < 0 )
 {
     print( "<h1>Unsupported PHP version " . phpversion() . "</h1>" );
-    print( "<p>eZ Publish 4.x does not run with PHP 4.</p>".
+    print( "<p>eZ Publish 4.x requires at least PHP 5.1.</p>".
            "<p>For more information about supported software please visit ".
            "<a href=\"http://ez.no/download/ez_publish\" >eZ Publish download page</a></p>" );
     exit;
@@ -120,11 +120,11 @@
         $ini->variableMulti( 'DebugSettings',
                              array( 'DebugOutput', 'DebugByIP', 'DebugLogOnly', 'DebugByUser', 'DebugIPList', 'AlwaysLog', 'DebugUserIDList' ),
                              array( 'enabled', 'enabled', 'disabled', 'enabled' ) );
-    $logMap = array( 'notice' => eZDebug::LEVEL_NOTICE,
-                     'warning' => eZDebug::LEVEL_WARNING,
-                     'error' => eZDebug::LEVEL_ERROR,
-                     'debug' => eZDebug::LEVEL_DEBUG,
-                     'strict' => eZDebug::LEVEL_STRICT );
+    $logMap = array( 'notice' => 1, // eZDebug::LEVEL_NOTICE
+                     'warning' => 2, // eZDebug::LEVEL_WARNING
+                     'error' => 3, // eZDebug::LEVEL_ERROR
+                     'debug' => 5, // eZDebug::LEVEL_DEBUG
+                     'strict' => 6 ); // eZDebug::LEVEL_STRICT
     $settings['always-log'] = array();
     foreach ( $logMap as $name => $level )
     {
@@ -308,7 +308,7 @@
 
     // Try to fetch the module object
     $module = eZModule::exists( $module_name );
-    if ( !( $module instanceof eZModule ) )
+    if ( !is_object( $module ) || get_class( $module ) != 'eZModule' )
     {
         return false;
     }
@@ -338,7 +338,7 @@
 ////include_once( "lib/ezutils/classes/ezsys.php" );
 
 
-eZDebug::setHandleType( eZDebug::HANDLE_FROM_PHP );
+eZDebug::setHandleType( 1 ); // eZDebug::HANDLE_FROM_PHP
 
 $GLOBALS['eZGlobalRequestURI'] = eZSys::serverVariable( 'REQUEST_URI' );
 
@@ -453,9 +453,11 @@
     }
 
     if ( !$db->isConnected() )
+    {
         $warningList[] = array( 'error' => array( 'type' => 'kernel',
-                                                  'number' => eZError::KERNEL_NO_DB_CONNECTION ),
+                                                  'number' => 50 ), // eZError::KERNEL_NO_DB_CONNECTION
                                 'text' => 'No database connection could be made, the system might not behave properly.' );
+    }
 }
 
 // Initialize with locale settings
@@ -610,7 +612,7 @@
 
     if ( !$displayMissingModule &&
          $moduleCheck['result'] &&
-         $module instanceof eZModule )
+         get_class( $module ) == 'eZModule' )
     {
         // Run the module/function
         eZDebug::addTimingPoint( "Module start '" . $module->attribute( 'name' ) . "'" );
@@ -685,7 +687,7 @@
                 if ( $requireUserLogin )
                 {
                     $module = eZModule::exists( 'user' );
-                    if ( $module instanceof eZModule )
+                    if ( is_object( $module ) && get_class( $module ) == 'eZModule' )
                     {
                         $moduleResult = $module->run( 'login', array(),
                                                        array( 'SiteAccessAllowed' => false,
@@ -702,7 +704,7 @@
         {
             if ( $objectHasMovedError == true )
             {
-                $moduleResult = $module->handleError( eZError::KERNEL_MOVED, 'kernel', array( 'new_location' => $objectHasMovedURI ) );
+                $moduleResult = $module->handleError( 4 /* eZError::KERNEL_MOVED */, 'kernel', array( 'new_location' => $objectHasMovedURI ) );
             }
             else if ( !$moduleAccessAllowed )
             {
@@ -713,9 +715,9 @@
                 }
 
                 if ( isset( $accessList ) )
-                    $moduleResult = $module->handleError( eZError::KERNEL_ACCESS_DENIED, 'kernel', array( 'AccessList' => $accessList ) );
+                    $moduleResult = $module->handleError( 1 /* eZError::KERNEL_ACCESS_DENIED */, 'kernel', array( 'AccessList' => $accessList ) );
                 else
-                    $moduleResult = $module->handleError( eZError::KERNEL_ACCESS_DENIED, 'kernel' );
+                    $moduleResult = $module->handleError( 1 /* eZError::KERNEL_ACCESS_DENIED */, 'kernel' );
 
                 if ( isset( $defaultNavigationPart ) )
                 {
@@ -736,10 +738,10 @@
 
                 $moduleResult = $module->run( $function_name, $params, false, $userParameters );
 
-                if ( $module->exitStatus() == eZModule::STATUS_FAILED and
+                if ( $module->exitStatus() == 2 /* eZModule::STATUS_FAILED */ and
                      $moduleResult == null )
-                    $moduleResult = $module->handleError( eZError::KERNEL_MODULE_VIEW_NOT_FOUND, 'kernel', array( 'module' => $module_name,
-                                                                                                                   'view' => $function_name ) );
+                    $moduleResult = $module->handleError( 21 /* eZError::KERNEL_MODULE_VIEW_NOT_FOUND */, 'kernel', array( 'module' => $module_name,
+                                                                                                                           'view' => $function_name ) );
             }
         }
     }
@@ -748,7 +750,7 @@
         eZDebug::writeError( "Undefined module: $module_name", "index" );
         $module = new eZModule( "", "", $module_name );
         $GLOBALS['eZRequestedModule'] = $module;
-        $moduleResult = $module->handleError( eZError::KERNEL_MODULE_NOT_FOUND, 'kernel', array( 'module' => $module_name ) );
+        $moduleResult = $module->handleError( 20 /* eZError::KERNEL_MODULE_NOT_FOUND */, 'kernel', array( 'module' => $module_name ) );
     }
     else
     {
@@ -758,10 +760,10 @@
             eZDebug::writeError( "Module '" . $moduleCheck['module'] . "' is disabled", "index" );
         $module = new eZModule( "", "", $moduleCheck['module'] );
         $GLOBALS['eZRequestedModule'] = $module;
-        $moduleResult = $module->handleError( eZError::KERNEL_MODULE_DISABLED, 'kernel', array( 'check' => $moduleCheck ) );
+        $moduleResult = $module->handleError( 22 /* eZError::KERNEL_MODULE_DISABLED */, 'kernel', array( 'check' => $moduleCheck ) );
     }
     $moduleRunRequired = false;
-    if ( $module->exitStatus() == eZModule::STATUS_RERUN )
+    if ( $module->exitStatus() == 4 /* eZModule::STATUS_RERUN */ )
     {
         if ( isset( $moduleResult['rerun_uri'] ) )
         {
@@ -802,7 +804,7 @@
     setcookie( 'is_logged_in', false, 0, $cookiePath );
 }
 
-if ( $module->exitStatus() == eZModule::STATUS_REDIRECT )
+if ( $module->exitStatus() == 3 /* eZModule::STATUS_REDIRECT */ )
 {
     $GLOBALS['eZRedirection'] = true;
     $ini = eZINI::instance();
@@ -966,7 +968,7 @@
 // Store the last URI for access history for login redirection
 // Only if database is connected and only if there was no error or no redirects happen
 if ( is_object( $db ) and $db->isConnected() and
-     $module->exitStatus() == eZModule::STATUS_OK )
+     $module->exitStatus() == 1 /* eZModule::STATUS_OK */ )
 {
     $currentURI = $completeRequestedURI;
     if ( strlen( $currentURI ) > 0 and $currentURI[0] != '/' )
