forked from lane711/excida
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdefaults.php
More file actions
170 lines (148 loc) · 4.66 KB
/
defaults.php
File metadata and controls
170 lines (148 loc) · 4.66 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
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
<?php
// Output buffering to allow for header() redirects, etc. throughout the script, among other things
ob_start();
// Specify default timezone
date_default_timezone_set( @date_default_timezone_get() );
// Prevent scripts from being accessed in unauthorized ways
if ( !defined( 'PMR' ) || ( defined( 'PMR' ) && PMR != true ) )
{
die( 'You cannot access this file directly.' );
}
// Install/docs dir check
// if ( $page != 'install' )
// {
// if ( file_exists( PATH . '/docs/version' ) || file_exists( PATH . '/install/index.php' ) )
// {
// die( 'You must remove the /install and /docs directories before proceeding.' );
// }
// }
// Include all necessary function/class files
include PATH . '/includes/functions.php';
include PATH . '/includes/functions/db.php';
include PATH . '/includes/functions/sessions.php';
include PATH . '/includes/functions/zip.php';
include PATH . '/includes/functions/packages.php';
include PATH . '/includes/phpmailer/class.phpmailer.php';
include PATH . '/includes/functions/template.php';
include PATH . '/includes/functions/captcha.php';
include PATH . '/includes/functions/favorites.php';
include PATH . '/includes/functions/filter.php';
include PATH . '/includes/functions/form.php';
include PATH . '/includes/functions/images.php';
include PATH . '/includes/functions/ratings.php';
include PATH . '/includes/functions/system.php';
include PATH . '/includes/functions/auth.php';
include PATH . '/includes/functions/simpleGMapAPI.php';
// We use this object throughout the script for any map-based functionality
$map = new simpleGMapAPI();
// Initialise a new user session or start an existing one
$session = new Session();
// Allow Back button in IE
header( 'Cache-control: private' );
// Start a new sql connection
$db = new Dbaccess();
if ( !$db->connect( DB_HOST, DB_USERNAME, DB_PASSWORD, DB_NAME ) )
{
if ( mysql_error() == '' )
{
$database_incorrect = 'Database name is incorrect or doesn\'t exist';
}
else
{
$database_incorrect = '';
}
die( 'Initialization Error' . mysql_error() . $database_incorrect );
}
// Get all configuration data as set in the administration panel
$confClause = " site_id=0";
if($session->fetch('u_site_id')!=""){
$confClause= " site_id=".$session->fetch('u_site_id');
}
$sql = "SELECT name, val FROM " . CONFIGURATION_TABLE . " WHERE ".$confClause;
$q = $db->query( $sql ) or die( 'Continue Installation: Database tables do not exist. Please run the installer to complete the installation process: <a href="' . URL . '/install/index.php">' . URL . '/install/index.php</a>' );
$conf = array();
while ( $conf_array = $db->fetcharray( $q ) )
{
$conf[$conf_array['name']] = $conf_array['val'];
}
// Template selection
// First priority is a user trying to change it
if ( isset( $_POST['option_template'] ) )
{
$session->set( 'intemplate', $_POST["option_template"] );
$cookie_template = $_POST["option_template"];
}
// Also check if they are passing it via an HTTP request
elseif ( isset( $_GET['template'] ) )
{
$session->set( 'intemplate', $_GET["template"] );
$cookie_template = $_GET["template"];
}
// Check if they previously set a template
elseif ( isset( $_SESSION['intemplate'] ) )
{
$cookie_template = $_SESSION['intemplate'];
}
// Default template as set in admin
else
{
if ( !empty( $conf['template'] ) )
{
$session->set( 'intemplate', $conf['template'] );
$cookie_template = $conf['template'];
}
else
{
$session->set( 'intemplate', 'default' );
$cookie_template = 'responsive';
}
}
// Language selection
// First priority is a user trying to change it
if ( isset( $_POST['option_language'] ) )
{
$session->set( 'language', $_POST["option_language"] );
$cookie_language = $_POST["option_language"];
}
// Also check if they are passing it via an HTTP request
elseif ( isset( $_GET['lang'] ) )
{
$session->set( 'language', $_GET["lang"] );
$cookie_language = $_GET["lang"];
}
// Check if they previously set a template
elseif ( isset( $_SESSION['language'] ) )
{
$cookie_language = $_SESSION['language'];
}
// Default language as set in admin
else
{
if ( !empty( $conf['language'] ) )
{
$session->set( 'language', $conf['language'] );
$cookie_language = $conf['language'];
}
else
{
$session->set( 'language', 'english' );
$cookie_language = 'english';
}
}
// Include language file containging in $cookie_language
$lang = array();
if ( file_exists( PATH . '/languages/' . $cookie_language . '.lng.php' ) )
{
include PATH . '/languages/' . $cookie_language . '.lng.php';
}
else
{
include PATH . '/languages/english.lng.php';
}
include PATH . '/languages/settings.php';
// General clean up
// Clean the Favorite Listings Cookie
favoriteListingsClean();
// Clean the Visited Listings Cookie
visitedListingsClean();
?>