source: subversion/sites/namefinder/www/preamble.php @ 17445

Last change on this file since 17445 was 8132, checked in by david, 11 years ago

namefinder version 2 - incremental updates; word indexes

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
12error_reporting(0);
13
14include_once('classysql/classysql.php');
15$db =& new y_db($config);
16
17// $db->log("VISITING {$_SERVER['REQUEST_URI']} from {$ra} {$rh} user {$rn}");
18
19// set up custom error handling
20function eh($errno, $errstr, $errfile, $errline) {
21  if ($errno != 2048 && error_reporting() != 0) {
22    global $state, $db, $me, $config;
23    $id = session_id(); if (empty($id)) { $id = 'all'; }
24    $emailsent = ' (email NOT sent)';
25
26    if (! empty($config['webmaster'])) {
27      $logname = "{$config['cataloguehomepage']}/log.html?logname=" . urlencode($db->logname);
28      mail ($config['webmaster'], "{$config['cataloguehomepage']} internal error", 
29            "Internal error detected:\nsee log {$logname}\n",
30            "From: {$config['webmaster']}\r\n");
31      $emailsent = ' (email sent)';
32    }
33    $loglink = '';
34    if (isset($me) && $me->privileged('debug')) {
35      echo "<div style='margin-left: 100px; margin-top: 100px;'><a href='log.html'>log file &raquo;</a></div>";
36    }
37    $db->oops("{$errno} {$errstr}{$emailsent}");
38  }
39}
40// set_error_handler('eh');
41
42function jumpto($page='index.html') {
43  header("Location: {$page}");
44  exit();
45}
46
47?>
Note: See TracBrowser for help on using the repository browser.