Differences From Artifact [d94d33cf54]:

To Artifact [cb4312684b]:


88
89
90
91
92
93
94
95










96
97
98
99
100
101
102
        ? $_SERVER['HTTP_HOST'] 
        : (isset($_SERVER['SERVER_NAME']) ? $_SERVER['SERVER_NAME'] : 'localhost');
    define('WWW_URL', 'http' . (!empty($_SERVER['HTTPS']) ? 's' : '') . '://' . $host . WWW_URI);
}

ini_set('error_log', GARRADIN_DATA_ROOT . '/error.log');
ini_set('log_errors', true);
ini_set('display_errors', defined('DEV') ? true : false);











/*
 * Gestion des erreurs et exceptions
 */

class UserException extends \LogicException
{







|
>
>
>
>
>
>
>
>
>
>







88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
        ? $_SERVER['HTTP_HOST'] 
        : (isset($_SERVER['SERVER_NAME']) ? $_SERVER['SERVER_NAME'] : 'localhost');
    define('WWW_URL', 'http' . (!empty($_SERVER['HTTPS']) ? 's' : '') . '://' . $host . WWW_URI);
}

ini_set('error_log', GARRADIN_DATA_ROOT . '/error.log');
ini_set('log_errors', true);
ini_set('display_errors', true);
ini_set('html_errors', false);
ini_set('error_prepend_string', '<!DOCTYPE html><style type="text/css">body { font-family: sans-serif; } h3 { color: darkred; } 
    pre { text-shadow: 2px 2px 5px black; color: darkgreen; font-size: 2em; float: left; margin: 0 1em 0 0; padding: 1em; background: #cfc; border-radius: 50px; }</style>
    <pre> \__/<br /> (xx)<br />//||\\\\</pre>
    <h1>Erreur fatale</h1>
    <p>Une erreur fatale s\'est produite à l\'exécution de Garradin. Pour rapporter ce bug
    merci d\'inclure le message ci-dessous :</p>
    <h3>');
ini_set('error_append_string', '</h3><hr />
    <p><a href="http://dev.kd2.org/garradin/Rapporter%20un%20bug">Comment rapporter un bug</a></p>');

/*
 * Gestion des erreurs et exceptions
 */

class UserException extends \LogicException
{
120
121
122
123
124
125
126


127
128
129
130
131
132
133
134
135




136

137


138

139










140
141
142
143
144
145
146
            $tpl->display('error.tpl');
            exit;
        }
        catch (Exception $e)
        {
        }
    }



    $error = "Exception of type ".get_class($e)." happened !\n\n".
        $e->getCode()." - ".$e->getMessage()."\n\nIn: ".
        $e->getFile() . ":" . $e->getLine()."\n\n";

    if (!empty($_SERVER['HTTP_HOST']))
        $error .= 'http://'.$_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI']."\n\n";

    $error .= $e->getTraceAsString();




    //$error .= print_r($_SERVER, true);




    echo '<pre>';

    echo $error;










    exit;
}

set_error_handler('Garradin\exception_error_handler');
set_exception_handler('Garradin\exception_handler');

/**







>
>



|

|



>
>
>
>
|
>
|
>
>
|
>
|
>
>
>
>
>
>
>
>
>
>







130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
            $tpl->display('error.tpl');
            exit;
        }
        catch (Exception $e)
        {
        }
    }

    $file = str_replace(GARRADIN_ROOT, '', $e->getFile());

    $error = "Exception of type ".get_class($e)." happened !\n\n".
        $e->getCode()." - ".$e->getMessage()."\n\nIn: ".
        $file . ":" . $e->getLine()."\n\n";

    if (!empty($_SERVER['HTTP_HOST']) && !empty($_SERVER['REQUEST_URI']))
        $error .= 'http://'.$_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI']."\n\n";

    $error .= $e->getTraceAsString();
    $error .= "\n-------------\n";
    $error .= 'Garradin version: ' . garradin_version() . "\n";
    $error .= 'Garradin manifest: ' . garradin_manifest() . "\n";
    $error .= 'PHP version: ' . phpversion() . "\n";

    foreach ($_SERVER as $key=>$value)
    {
        $error .= $key . ': ' . $value . "\n";
    }
    
    $error = str_replace("\r", '', $error);
    
    echo '<!DOCTYPE html><style type="text/css">body { font-family: sans-serif; } h3 { color: darkred; }
    pre { text-shadow: 2px 2px 5px black; color: darkgreen; font-size: 2em; float: left; margin: 0 1em 0 0; padding: 1em; background: #cfc; border-radius: 50px; }</style>
    <pre> \__/<br /> (xx)<br />//||\\\\</pre>
    <h1>Erreur d\'exécution</h1>
    <p>Une erreur s\'est produite à l\'exécution de Garradin. Pour rapporter ce bug
    merci d\'inclure le message suivant :</p>
    <textarea cols="70" rows="'.substr_count($error, "\n").'">'.htmlspecialchars($error, ENT_QUOTES, 'UTF-8').'</textarea>
    <hr />
    <p><a href="http://dev.kd2.org/garradin/Rapporter%20un%20bug">Comment rapporter un bug</a></p>';

    exit;
}

set_error_handler('Garradin\exception_error_handler');
set_exception_handler('Garradin\exception_handler');

/**