start($update);
$acl = new auth('admin', $userdata);
//
// End session management
//
//
// Configure style, language, etc.
//
$session->configure($userdata);
// -----------------------------
// Functions
//
function page_header($sub_title, $meta = '', $table_html = true)
{
global $board_config, $db, $lang, $phpEx, $gzip_compress;
global $HTTP_SERVER_VARS;
define('HEADER_INC', true);
//
// gzip_compression
//
$gzip_compress = false;
if ( $board_config['gzip_compress'] )
{
$phpver = phpversion();
if ( $phpver >= '4.0.4pl1' && strstr($HTTP_SERVER_VARS['HTTP_USER_AGENT'], 'compatible') )
{
if ( extension_loaded('zlib') )
{
ob_start('ob_gzhandler');
}
}
else if ( $phpver > '4.0' )
{
if ( strstr($HTTP_SERVER_VARS['HTTP_ACCEPT_ENCODING'], 'gzip') )
{
if ( extension_loaded('zlib') )
{
$gzip_compress = true;
ob_start();
ob_implicit_flush(0);
header("Content-Encoding: gzip");
}
}
}
}
header("Content-type: text/html; charset=" . $lang['ENCODING']);
?>
sql_close();
//
// Compress buffered output if required
// and send to browser
//
if ( $gzip_compress )
{
//
// Borrowed from php.net!
//
$gzip_contents = ob_get_contents();
ob_end_clean();
$gzip_size = strlen($gzip_contents);
$gzip_crc = crc32($gzip_contents);
$gzip_contents = gzcompress($gzip_contents, 9);
$gzip_contents = substr($gzip_contents, 0, strlen($gzip_contents) - 4);
echo "\x1f\x8b\x08\x00\x00\x00\x00\x00";
echo $gzip_contents;
echo pack("V", $gzip_crc);
echo pack("V", $gzip_size);
}
exit;
}
function page_message($title, $message, $show_header)
{
global $phpEx, $SID, $lang;
if ( $show_header )
{
?>
sql_query($sql);
return;
}
function view_log($mode, &$log, &$log_count, $limit = 0, $offset = 0, $forum_id = 0, $limit_days = 0, $sort_by = 'l.log_time DESC')
{
global $db, $lang, $phpEx, $SID;
$table_sql = ( $mode == 'admin' ) ? LOG_ADMIN_TABLE : LOG_MOD_TABLE;
$forum_sql = ( $mode == 'mod' && $forum_id ) ? "AND l.forum_id = $forum_id" : '';
$limit_sql = ( $limit ) ? ( ( $offset ) ? "LIMIT $offset, $limit" : "LIMIT $limit" ) : '';
$sql = "SELECT l.log_id, l.user_id, l.log_ip, l.log_time, l.log_operation, l.log_data, u.username
FROM $table_sql l, " . USERS_TABLE . " u
WHERE u.user_id = l.user_id
AND l.log_time >= $limit_days
$forum_sql
ORDER BY $sort_by
$limit_sql";
$result = $db->sql_query($sql);
$log = array();
if ( $row = $db->sql_fetchrow($result) )
{
$i = 0;
do
{
$log[$i]['id'] = $row['log_id'];
$log[$i]['username'] = '' . $row['username'] . '';
$log[$i]['ip'] = $row['log_ip'];
$log[$i]['time'] = $row['log_time'];
$log[$i]['action'] = ( !empty($lang[$row['log_operation']]) ) ? $lang[$row['log_operation']] : ucfirst(str_replace('_', ' ', $row['log_operation']));
if ( !empty($row['log_data']) )
{
$log_data_ary = unserialize(stripslashes($row['log_data']));
foreach ( $log_data_ary as $log_data )
{
$log[$i]['action'] = preg_replace('#%s#', $log_data, $log[$i]['action'], 1);
}
}
$i++;
}
while ( $row = $db->sql_fetchrow($result) );
}
$db->sql_freeresult($result);
$sql = "SELECT COUNT(*) AS total_entries
FROM $table_sql l
WHERE l.log_time >= $limit_days
$forum_sql";
$result = $db->sql_query($sql);
$row = $db->sql_fetchrow($result);
$db->sql_freeresult($result);
$log_count = $row['total_entries'];
return;
}
//
// End Functions
// -----------------------------
?>