[cvs] commit: chora annotate.php cvs.php diff.php history.php chora/docsCHANGES chora/lib Chora.php

Jon Parise jon@horde.org
Wed, 21 Aug 2002 08:26:14 -0400


On Tue, Aug 20, 2002 at 09:04:06PM -0700, Anil Madhavapeddy wrote:

> avsm        2002/08/20 21:04:06 PDT
> 
>   Modified files:
>     .                    annotate.php cvs.php diff.php history.php 
>     docs                 CHANGES 
>     lib                  Chora.php 
>   Log:
>   - have a prettier error page by using Horde::Notification
>   - if we get a 404/3 error, then reset the last_file preference
>   - check the stored CVSROOT in prefs and make sure it exists before
>     using it
   
>From your changes to Chora.php:

+    /* If we hit a 40x, then don't store the bad file in the preference */
+    if (preg_match('|40[43]|', $errcode) && is_object($prefs)) {
+        $prefs->setValue('last_file', '');
+        $prefs->store();
+    }

This made me wonder why $errcode is being passed around as a string
(i.e. "404 Not Found").  Perhaps we could just pass the numeric code
to fatal(), which could could in turn use a static mapping to build
the complete Status: header?

e.g.

function fatal($errcode, $errmsg)
{
    static $_errtext = array(
        403 => 'Forbidden',
        404 => 'Not Found'
    );

    header("Status: $errcode $_errtext[$errcode]");
    ...
}

-- 
Jon Parise (jon@horde.org) :: The Horde Project (http://horde.org/)