-
Notifications
You must be signed in to change notification settings - Fork 17
/
config.php
52 lines (50 loc) · 1.64 KB
/
config.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
<?php // Global Variables are now stored in config.ini
$cfg=parse_ini_file('config.ini');
$FreeSpaceWarn=(integer)$cfg['FreeSpaceWarn'];
$Fortune=(bool)$cfg['Fortune'];
$ExtraScanners=(bool)$cfg['ExtraScanners'];
$CheckForUpdates=(bool)$cfg['CheckForUpdates'];
$RequireLogin=(bool)$cfg['RequireLogin'];
$SessionDuration=(integer)$cfg['SessionDuration'];
$Theme=(string)$cfg['Theme'];
$DarkPicker=(bool)$cfg['DarkPicker'];
$RulerIncrement=(double)$cfg['RulerIncrement'];
$TimeZone=(string)$cfg['TimeZone'];
$Printer=(integer)$cfg['Printer'];
$ReplacePrinter=(bool)$cfg['ReplacePrinter'];
$BusterPrintBug=(int)$cfg['BusterPrintBug'];
$HomePage=(string)$cfg['HomePage'];
$ShowRawFormat=(bool)$cfg['ShowRawFormat'];
$RawScanFormat=(integer)$cfg['RawScanFormat'];
$NAME=(string)$cfg['NAME'];
$VER=(string)$cfg['VER'];
$SAE_VER=(string)$cfg['SAE_VER'];
// Login Stuff
$Auth=true;
if($RequireLogin){
if(!isset($_COOKIE['Authenticated']))
$Auth=false;
else if(time()>intval($_COOKIE['Authenticated'])+$SessionDuration)// NOT FOR USE ON 32BIT OS IN 2038 http://en.wikipedia.org/wiki/Year_2038_problem
$Auth=false;
}
// A few functions I need even on error pages
function html($X){
return htmlspecialchars($X);
}
function url($X){
return rawurlencode($X);
}
function js($X){
return str_replace("\n",'\\n',addslashes($X));
}
function InsertHeader($title) { # Spit out HTML header
$page=$GLOBALS['PAGE'];
$GLOBALS['DarkPicker']=$DarkPicker=isset($_COOKIE['darkPicker'])?$_COOKIE['darkPicker']=='true':$GLOBALS['DarkPicker'];
include "res/inc/header.php";
return $path;
}
function Footer($path) { # Spit out HTML footer
$title=$GLOBALS['PAGE'];
include "res/inc/footer.php";
}
?>