2001-03-10 11:07:52 +00:00
< ? php
2000-12-23 23:25:28 +00:00
2001-02-18 15:14:56 +00:00
function conf_init () {
2001-02-04 22:09:38 +00:00
global $HTTP_HOST , $REQUEST_URI ;
2001-03-10 18:38:47 +00:00
$file = strtolower ( strtr ( $HTTP_HOST . " " . substr ( $REQUEST_URI , 0 , strrpos ( $REQUEST_URI , " / " )), " /: " , " .. " ));
2001-02-04 22:09:38 +00:00
while ( $file && ! file_exists ( " includes/ $file .conf " )) {
$file = substr ( $file , 0 , strrpos ( $file , " . " ));
}
return $file ;
}
2001-04-06 14:14:16 +00:00
function watchdog ( $type , $message ) {
global $user , $watchdog , $PHP_SELF ;
$link = ( $mod ) ? $mod : substr ( strrchr ( $PHP_SELF , " / " ), 1 , strrchr ( $PHP_SELF , " / " ) - 4 );
db_query ( " INSERT INTO watchdog (user, type, link, message, location, hostname, timestamp) VALUES (' $user->id ', ' " . check_input ( $type ) . " ', ' " . check_input ( $link ) . " ', ' " . check_input ( $message ) . " ', ' " . check_input ( getenv ( " REQUEST_URI " )) . " ', ' " . check_input ( getenv ( " REMOTE_ADDR " )) . " ', ' " . time () . " ') " );
}
function throttle ( $type , $rate ) {
if ( ! ( user_access ( $user , " watchdog " ) || user_access ( $user , " comment " ) || user_access ( $user , " node " ))) {
if ( $throttle = db_fetch_object ( db_query ( " SELECT * FROM watchdog WHERE type = ' $type ' AND hostname = ' " . getenv ( " REMOTE_ADDR " ) . " ' AND " . time () . " - timestamp < $rate " ))) {
watchdog ( " warning " , " throttle: ' " . getenv ( " REMOTE_ADDR " ) . " ' exceeded submission rate - $throttle->type " );
header ( " Location: error.php?op=throttle " );
exit ();
}
else {
watchdog ( $type , " throttle control " );
}
}
}
2001-02-18 15:14:56 +00:00
$conf = conf_init ();
2001-02-04 22:09:38 +00:00
include_once " includes/ $conf .conf " ;
2000-12-23 23:25:28 +00:00
include_once " includes/database.inc " ;
2001-04-05 20:33:36 +00:00
include_once " includes/variable.inc " ;
2000-12-23 23:25:28 +00:00
include_once " includes/function.inc " ;
2001-03-18 08:44:01 +00:00
include_once " includes/comment.inc " ;
2001-02-10 11:59:06 +00:00
include_once " includes/module.inc " ;
2001-02-17 12:59:24 +00:00
include_once " includes/locale.inc " ;
include_once " includes/search.inc " ;
2000-12-23 23:25:28 +00:00
include_once " includes/theme.inc " ;
include_once " includes/user.inc " ;
2001-03-24 17:04:11 +00:00
include_once " includes/node.inc " ;
2000-12-23 23:25:28 +00:00
2001-02-18 15:14:56 +00:00
user_init ();
$locale = locale_init ();
2001-04-05 20:33:36 +00:00
$conf = variable_init ();
2001-02-18 15:14:56 +00:00
$theme = theme_init ();
2000-12-23 23:25:28 +00:00
2000-12-30 11:58:14 +00:00
?>