source: subversion/sites/namefinder/util/preamble.php @ 4135

Last change on this file since 4135 was 4135, checked in by david, 12 years ago

namefinder utilities, including crating namefinder's index

File size: 1.4 KB
Line 
1<?php
2
3/* Every html request includes this file, to give access to everything else */
4
5include_once ('.config.php'); // => $config
6set_include_path (get_include_path().':'.$config['includephp']);
7
8if (! function_exists('mb_strlen')) {
9  include_once('mb.php');
10}
11
12include_once('classysql/classysql.php');
13$db =& new y_db($config);
14
15// $db->log("VISITING {$_SERVER['REQUEST_URI']} from {$ra} {$rh} user {$rn}");
16
17// set up custom error handling
18function eh($errno, $errstr, $errfile, $errline) {
19  if ($errno != 2048 && error_reporting() != 0) {
20    global $state, $db, $me, $config;
21    $id = session_id(); if (empty($id)) { $id = 'all'; }
22    $emailsent = ' (email NOT sent)';
23
24    if (! empty($config['webmaster'])) {
25      $logname = "{$config['cataloguehomepage']}/log.html?logname=" . urlencode($db->logname);
26      mail ($config['webmaster'], "{$config['cataloguehomepage']} internal error", 
27            "Internal error detected:\nsee log {$logname}\n",
28            "From: {$config['webmaster']}\r\n");
29      $emailsent = ' (email sent)';
30    }
31    $loglink = '';
32    if (isset($me) && $me->privileged('debug')) {
33      echo "<div style='margin-left: 100px; margin-top: 100px;'><a href='log.html'>log file &raquo;</a></div>";
34    }
35    $db->oops("{$errno} {$errstr}{$emailsent}");
36  }
37}
38// set_error_handler('eh');
39
40function jumpto($page='index.html') {
41  header("Location: {$page}");
42  exit();
43}
44
45?>
Note: See TracBrowser for help on using the repository browser.