-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathWarehouse.php
More file actions
118 lines (108 loc) · 4.02 KB
/
Warehouse.php
File metadata and controls
118 lines (108 loc) · 4.02 KB
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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
<?php
//if(WAREHOUSE_PHP==0)
if(!defined('WAREHOUSE_PHP'))
{
define("WAREHOUSE_PHP",1);
$RosarioVersion = '1.4.14';
if (!file_exists ('config.inc.php'))
die ('config.inc.php not found. Please read the configuration guide.');
require_once('config.inc.php');
require_once('database.inc.php');
//modif Francois: remove IgnoreFiles
// Load functions.
/*if($handle = opendir('functions'))
{
if(!is_array($IgnoreFiles))
$IgnoreFiles=Array();
while (false !== ($file = readdir($handle)))
{
// if filename isn't '.' '..' or in the Ignore list... load it.
if($file!='.' && $file!='..' && !in_array($file,$IgnoreFiles))
require_once('functions/'.$file);
}
}*/
$functions = scandir('functions/');
foreach ($functions as $function)
{
//filter PHP files
if ( mb_strrchr($function, '.') == '.php' )
require_once('functions/'.$function);
}
// Start Session.
session_name('RosarioSIS');
if ($_SERVER['SCRIPT_NAME']!='/index.php')
session_set_cookie_params(0,dirname($_SERVER['SCRIPT_NAME']).'/'); //,'',$false,$true);
session_start();
if(!$_SESSION['STAFF_ID'] && !$_SESSION['STUDENT_ID'] && mb_strpos($_SERVER['PHP_SELF'],'index.php')===false)
{
header('Location: index.php');
exit;
}
// Internationalization
if (!empty($_GET['locale']))
$_SESSION['locale'] = $_GET['locale'];
if (empty($_SESSION['locale']))
$_SESSION['locale'] = $RosarioLocales[0]; //english
$locale = $_SESSION['locale'];
putenv('LC_ALL='.$locale);
setlocale(LC_ALL, $locale);
setlocale(LC_NUMERIC, 'english','en_US', 'en_US.utf8'); //modif Francois: numeric separator "."
bindtextdomain('rosariosis', $LocalePath); //binds the messages domain to the locale folder
bind_textdomain_codeset('rosariosis','UTF-8'); //ensures text returned is utf-8, quite often this is iso-8859-1 by default
textdomain('rosariosis'); //sets the domain name, this means gettext will be looking for a file called rosariosis.mo
mb_internal_encoding('UTF-8'); //modif Francois: multibyte strings
function Warehouse($mode)
{ global $_ROSARIO,$locale;
switch($mode)
{
case 'header':
//modif Francois: fix bug Internet Explorer Quirks Mode, add DOCTYPE
?>
<!DOCTYPE html>
<HTML lang="<?php echo mb_substr($locale,0,2); ?>" <?php echo (mb_substr($locale,0,2)=='he' || mb_substr($locale,0,2)=='ar'?' dir="RTL"':''); ?>>
<HEAD><TITLE><?php echo ParseMLField(Config('TITLE')); ?></TITLE>
<meta charset="UTF-8" />
<?php if(basename($_SERVER['PHP_SELF'])!='index.php'): ?>
<noscript><META http-equiv="REFRESH" content="0; url=index.php?modfunc=logout&reason=javascript" /></noscript>
<script type="text/javascript" src="assets/js/tipmessage/main15.js"></script>
<?php endif; ?>
<?php if(basename($_SERVER['PHP_SELF'])=='index.php'): ?>
<?php endif; ?>
<link rel="stylesheet" type="text/css" href="assets/themes/<?php echo Preferences('THEME'); ?>/stylesheet.css" />
<?php
break;
case "footer":
//modif Francois: Javascript load optimization
?>
<BR />
<script type="text/javascript" src="assets/js/warehouse.js" defer></script>
<?php
//modif Francois: load calendar Javascript only if required
if (isset($_ROSARIO['PrepareDate'])): ?>
<link rel="stylesheet" type="text/css" media="all" href="assets/js/jscalendar/calendar-blue.css" />
<script type="text/javascript" src="assets/js/jscalendar/calendar.js"></script>
<script type="text/javascript" src="assets/js/jscalendar/lang/calendar-<?php echo mb_substr($locale, 0, 2); ?>.js"></script>
<script type="text/javascript" src="assets/js/jscalendar/calendar-setup.js"></script>
<?php
for($i=1;$i<=$_ROSARIO['PrepareDate'];$i++)
{
?>
<script type="text/javascript">
Calendar.setup({
monthField : "monthSelect<?php echo $i; ?>",
dayField : "daySelect<?php echo $i; ?>",
yearField : "yearSelect<?php echo $i; ?>",
ifFormat : "%d-%b-%y",
button : "trigger<?php echo $i; ?>",
align : "Tl",
singleClick : true
});
</script>
<?php }
endif;
echo '</BODY></HTML>';
break;
}
}
}
?>