Пример #1
0
 private function read_conf_file($conf_file_path)
 {
     hd_silence_warnings();
     $lines = file($conf_file_path, FILE_IGNORE_NEW_LINES | FILE_SKIP_EMPTY_LINES);
     hd_restore_warnings();
     if ($lines === false) {
         hd_print("Configuration file '{$conf_file_path}' does not exist.");
         return false;
     }
     hd_print("Reading configuration from '{$conf_file_path}'...");
     for ($i = 0; $i < count($lines); ++$i) {
         if (preg_match('/^ *(\\S+) *= *(\\S+)$/', $lines[$i], $matches) != 1) {
             hd_print("Warning: line " . ($i + 1) . ": unknown format. " . "Data: '" . $lines[$i] . "'.");
             continue;
         }
         $this->data[$matches[1]] = $matches[2];
     }
     return true;
 }
Пример #2
0
    hd_error_handler($err['type'], $err['message'], $err['file'], $err['line']);
}
///////////////////////////////////////////////////////////////////////////
set_error_handler('hd_error_handler');
register_shutdown_function('hd_shutdown_handler');
///////////////////////////////////////////////////////////////////////////
function hd_error_silencer($severity, $msg, $filename, $linenum)
{
}
///////////////////////////////////////////////////////////////////////////
function hd_silence_warnings()
{
    error_reporting(0);
    set_error_handler("hd_error_silencer");
}
///////////////////////////////////////////////////////////////////////////
function hd_restore_warnings()
{
    restore_error_handler();
    error_reporting(E_STRICT | E_ALL);
}
///////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////
// Use timezone from the environment (TZ).
// This is a workaround for known issue since 5.3.0.
hd_silence_warnings();
ini_set('date.timezone', date_default_timezone_get());
hd_restore_warnings();
///////////////////////////////////////////////////////////////////////////
set_time_limit(0);
///////////////////////////////////////////////////////////////////////////