-
Notifications
You must be signed in to change notification settings - Fork 0
/
lib.php
111 lines (95 loc) · 3.65 KB
/
lib.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
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
<?php
// This script and data application were generated by AppGini 5.50
// Download AppGini for free from http://bigprof.com/appgini/download/
error_reporting(E_ERROR | E_WARNING | E_PARSE);
if(!defined('datalist_db_encoding')) define('datalist_db_encoding', 'iso-8859-1');
if(!defined('maxSortBy')) define('maxSortBy', 4);
if(!defined('empty_lookup_value')) define('empty_lookup_value', '{empty_value}');
if(function_exists('date_default_timezone_set')) @date_default_timezone_set('America/New_York');
if(function_exists('set_magic_quotes_runtime')) @set_magic_quotes_runtime(0);
$GLOBALS['filter_operators'] = array(
'equal-to' => '<=>',
'not-equal-to' => '!=',
'greater-than' => '>',
'greater-than-or-equal-to' => '>=',
'less-than' => '<',
'less-than-or-equal-to' => '<=',
'like' => 'like',
'not-like' => 'not like',
'is-empty' => 'isEmpty',
'is-not-empty' => 'isNotEmpty'
);
$currDir = dirname(__FILE__);
include("$currDir/settings-manager.php");
detect_config();
migrate_config();
include("$currDir/config.php");
include("$currDir/db.php");
include("$currDir/ci_input.php");
include("$currDir/datalist.php");
include("$currDir/incCommon.php");
include("$currDir/admin/incFunctions.php");
ob_start();
/* trim $_POST, $_GET, $_REQUEST */
if(count($_POST)) $_POST = array_trim($_POST);
if(count($_GET)) $_GET = array_trim($_GET);
if(count($_REQUEST)) $_REQUEST = array_trim($_REQUEST);
// include nav menu links and hook functions
@include("$currDir/hooks/links-navmenu.php");
@include("$currDir/hooks/__global.php");
// check sessions config
$noPathCheck = true;
$arrPath = explode(';', ini_get('session.save_path'));
$save_path = $arrPath[count($arrPath)-1];
if(!$noPathCheck && !is_dir($save_path)){
?>
<center>
<div class="alert alert-danger">
Your site is not configured to support sessions correctly. Please edit your php.ini file and change the value of <i>session.save_path</i> to a valid path.
</div>
</center>
<?php
exit;
}
if(session_id()){ session_write_close(); }
$configured_save_handler = @ini_get('session.save_handler');
if($configured_save_handler != 'memcache' && $configured_save_handler != 'memcached')
@ini_set('session.save_handler', 'files');
@ini_set('session.serialize_handler', 'php');
@ini_set('session.use_cookies', '1');
@ini_set('session.use_only_cookies', '1');
@header('Cache-Control: no-cache, no-store, must-revalidate'); // HTTP 1.1.
@header('Pragma: no-cache'); // HTTP 1.0.
@header('Expires: 0'); // Proxies.
@session_name('Northwind');
session_start();
// check if membership system exists
setupMembership();
// silently apply db changes, if any
@include_once("$currDir/updateDB.php");
// do we have a login request?
logInMember();
// convert expanded sorting variables, if provided, to SortField and SortDirection
$postedOrderBy = array();
for($i = 0; $i < maxSortBy; $i++){
if(isset($_REQUEST["OrderByField$i"])){
$sd = ($_REQUEST["OrderDir$i"] == 'desc' ? 'desc' : 'asc');
if($sfi = intval($_REQUEST["OrderByField$i"])){
$postedOrderBy[] = array($sfi => $sd);
}
}
}
if(count($postedOrderBy)){
$_REQUEST['SortField'] = '';
$_REQUEST['SortDirection'] = '';
foreach($postedOrderBy as $obi){
$sfi = ''; $sd = '';
foreach($obi as $sfi => $sd);
$_REQUEST['SortField'] .= "$sfi $sd,";
}
$_REQUEST['SortField'] = substr($_REQUEST['SortField'], 0, -2 - strlen($sd));
$_REQUEST['SortDirection'] = $sd;
}elseif($_REQUEST['apply_sorting']){
/* no sorting and came from filters page .. so clear sorting */
$_REQUEST['SortField'] = $_REQUEST['SortDirection'] = '';
}