@@ -264,7 +264,7 @@ |
||
264 | 264 | throw new \Exception('data must be set for LDAPGroup'); |
265 | 265 | } |
266 | 266 | $filter = new \Data\Filter("cn eq $name"); |
267 | - $group = $data->read($data->group_base, $filter); |
|
267 | + $group = $data->read($data->group_base, $filter); |
|
268 | 268 | if($group === false || !isset($group[0])) |
269 | 269 | { |
270 | 270 | return false; |
@@ -179,7 +179,10 @@ |
||
179 | 179 | $count = count($groups); |
180 | 180 | for($i = 0; $i < $count; $i++) |
181 | 181 | { |
182 | - if($groups[$i] === false || $groups[$i] === null) continue; |
|
182 | + if($groups[$i] === false || $groups[$i] === null) |
|
183 | + { |
|
184 | + continue; |
|
185 | + } |
|
183 | 186 | array_push($data, new LDAPGroup($groups[$i])); |
184 | 187 | } |
185 | 188 | $users = $this->server->read($this->server->user_base, $userFilter, false, $select); |
@@ -241,7 +241,7 @@ |
||
241 | 241 | $obj['userPassword'] = $this->generateLDAPPass($password); |
242 | 242 | if(isset($this->ldap_obj->uniqueidentifier)) |
243 | 243 | { |
244 | - $obj['uniqueIdentifier'] = null; |
|
244 | + $obj['uniqueIdentifier'] = null; |
|
245 | 245 | } |
246 | 246 | //Make sure we are bound in write mode |
247 | 247 | $auth = \AuthProvider::getInstance(); |
@@ -44,7 +44,10 @@ |
||
44 | 44 | { |
45 | 45 | $dn = explode(',', $array[$i]); |
46 | 46 | $res = $this->isInGroupNamed(substr($dn[0], 3)); |
47 | - if($res) return $res; |
|
47 | + if($res) |
|
48 | + { |
|
49 | + return $res; |
|
50 | + } |
|
48 | 51 | } |
49 | 52 | } |
50 | 53 | return $res; |
@@ -116,26 +116,26 @@ |
||
116 | 116 | |
117 | 117 | private function getDataTable($name, $pending=false) |
118 | 118 | { |
119 | - if(isset($this->dataTables[$name]) && isset($this->dataTables[$name][$pending])) |
|
120 | - { |
|
121 | - return $this->dataTables[$name][$pending]; |
|
122 | - } |
|
123 | - $dataSet = $this->dataSet; |
|
124 | - if($pending) |
|
125 | - { |
|
126 | - $dataSet = $this->pendingDataSet; |
|
127 | - } |
|
128 | - if($dataSet === null) |
|
129 | - { |
|
130 | - throw new \Exception('Unable to obtain dataset for SQL Authentication!'); |
|
131 | - } |
|
132 | - $dataTable = $dataSet[$name]; |
|
133 | - if(!isset($this->dataTables[$name])) |
|
134 | - { |
|
135 | - $this->dataTables[$name] = array(); |
|
136 | - } |
|
137 | - $this->dataTables[$name][$pending] = $dataTable; |
|
138 | - return $dataTable; |
|
119 | + if(isset($this->dataTables[$name]) && isset($this->dataTables[$name][$pending])) |
|
120 | + { |
|
121 | + return $this->dataTables[$name][$pending]; |
|
122 | + } |
|
123 | + $dataSet = $this->dataSet; |
|
124 | + if($pending) |
|
125 | + { |
|
126 | + $dataSet = $this->pendingDataSet; |
|
127 | + } |
|
128 | + if($dataSet === null) |
|
129 | + { |
|
130 | + throw new \Exception('Unable to obtain dataset for SQL Authentication!'); |
|
131 | + } |
|
132 | + $dataTable = $dataSet[$name]; |
|
133 | + if(!isset($this->dataTables[$name])) |
|
134 | + { |
|
135 | + $this->dataTables[$name] = array(); |
|
136 | + } |
|
137 | + $this->dataTables[$name][$pending] = $dataTable; |
|
138 | + return $dataTable; |
|
139 | 139 | } |
140 | 140 | |
141 | 141 | private function getPendingUserDataTable() |
@@ -1,7 +1,7 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | namespace Auth; |
3 | 3 | |
4 | -if(!function_exists('password_hash') || !function_exists('password_verify')) |
|
4 | +if(!function_exists('password_hash') || !function_exists('password_verify')) |
|
5 | 5 | { |
6 | 6 | define('PASSWORD_BCRYPT', 1); |
7 | 7 | define('PASSWORD_DEFAULT', PASSWORD_BCRYPT); |
@@ -149,7 +149,10 @@ discard block |
||
149 | 149 | |
150 | 150 | public function login($username, $password) |
151 | 151 | { |
152 | - if($this->current === false) return false; |
|
152 | + if($this->current === false) |
|
153 | + { |
|
154 | + return false; |
|
155 | + } |
|
153 | 156 | $userDataTable = $this->getDataTable('user'); |
154 | 157 | $filter = new \Data\Filter("uid eq '$username'"); |
155 | 158 | $users = $userDataTable->read($filter); |
@@ -239,9 +242,15 @@ discard block |
||
239 | 242 | |
240 | 243 | public function getPendingUserCount() |
241 | 244 | { |
242 | - if($this->pending === false) return 0; |
|
245 | + if($this->pending === false) |
|
246 | + { |
|
247 | + return 0; |
|
248 | + } |
|
243 | 249 | $dataTable = $this->getPendingUserDataTable(); |
244 | - if($dataTable === null) return 0; |
|
250 | + if($dataTable === null) |
|
251 | + { |
|
252 | + return 0; |
|
253 | + } |
|
245 | 254 | return $dataTable->count(); |
246 | 255 | } |
247 | 256 | |
@@ -277,9 +286,11 @@ discard block |
||
277 | 286 | } |
278 | 287 | |
279 | 288 | public function getPendingUsersByFilter($filter, $select=false, $top=false, $skip=false, $orderby=false) |
280 | - |
|
281 | 289 | { |
282 | - if($this->pending === false) return false; |
|
290 | + if($this->pending === false) |
|
291 | + { |
|
292 | + return false; |
|
293 | + } |
|
283 | 294 | if($filter !== false && !$filter->contains('hash')) |
284 | 295 | { |
285 | 296 | return $this->searchPendingUsers($filter, $select, $top, $skip, $orderby); |
@@ -300,7 +311,10 @@ discard block |
||
300 | 311 | |
301 | 312 | public function createPendingUser($user) |
302 | 313 | { |
303 | - if($this->pending === false) return false; |
|
314 | + if($this->pending === false) |
|
315 | + { |
|
316 | + return false; |
|
317 | + } |
|
304 | 318 | $userDataTable = $this->getPendingUserDataTable(); |
305 | 319 | if(isset($user->password2)) |
306 | 320 | { |
@@ -66,7 +66,7 @@ |
||
66 | 66 | $ret = $auth->activatePendingUser($user); |
67 | 67 | if($ret === false) |
68 | 68 | { |
69 | - throw new \Exception('Unable to create user! '.$res); |
|
69 | + throw new \Exception('Unable to create user! '.$res); |
|
70 | 70 | } |
71 | 71 | return self::SUCCESS; |
72 | 72 | } |
@@ -2,20 +2,20 @@ discard block |
||
2 | 2 | namespace Auth; |
3 | 3 | require_once('/var/www/common/libs/google/src/Google/autoload.php'); |
4 | 4 | |
5 | -class GoogleAuthenticator extends Authenticator |
|
6 | -{ |
|
5 | +class GoogleAuthenticator extends Authenticator |
|
6 | +{ |
|
7 | 7 | protected $client; |
8 | 8 | protected $token = null; |
9 | 9 | |
10 | - public function __construct($params) |
|
11 | - { |
|
10 | + public function __construct($params) |
|
11 | + { |
|
12 | 12 | parent::__construct($params); |
13 | - if(!isset($params['client_secrets_path'])) |
|
14 | - { |
|
13 | + if(!isset($params['client_secrets_path'])) |
|
14 | + { |
|
15 | 15 | throw new \Exception('Missing required parameter client_secrets_path!'); |
16 | 16 | } |
17 | - if(!isset($params['redirect_url'])) |
|
18 | - { |
|
17 | + if(!isset($params['redirect_url'])) |
|
18 | + { |
|
19 | 19 | $params['redirect_url'] = 'https://'.$_SERVER['HTTP_HOST'].'/oauth2callback.php?src=google'; |
20 | 20 | } |
21 | 21 | $this->token = \FlipSession::getVar('GoogleToken', null); |
@@ -25,60 +25,64 @@ discard block |
||
25 | 25 | $this->client->setRedirectUri($params['redirect_url']); |
26 | 26 | } |
27 | 27 | |
28 | - public function getSupplementLink() |
|
29 | - { |
|
28 | + public function getSupplementLink() |
|
29 | + { |
|
30 | 30 | $authUrl = $this->client->createAuthUrl(); |
31 | 31 | return '<a href="'.filter_var($authUrl, FILTER_SANITIZE_URL).'"><img src="/img/common/google_sign_in.png" style="width: 2em;"/></a>'; |
32 | 32 | } |
33 | 33 | |
34 | - public function authenticate($code, &$currentUser = false) |
|
35 | - { |
|
34 | + public function authenticate($code, &$currentUser = false) |
|
35 | + { |
|
36 | 36 | $googleUser = false; |
37 | - try{ |
|
37 | + try |
|
38 | + { |
|
38 | 39 | $this->client->authenticate($code); |
39 | 40 | $this->token = $this->client->getAccessToken(); |
40 | 41 | \FlipSession::setVar('GoogleToken', $this->token); |
41 | 42 | $oauth2Service = new \Google_Service_Oauth2($this->client); |
42 | 43 | $googleUser = $oauth2Service->userinfo->get(); |
43 | - } catch(\Exception $ex) { |
|
44 | + } |
|
45 | + catch(\Exception $ex) |
|
46 | + { |
|
44 | 47 | return self::LOGIN_FAILED; |
45 | 48 | } |
46 | 49 | |
47 | 50 | $auth = \AuthProvider::getInstance(); |
48 | 51 | $localUsers = $auth->getUsersByFilter(new \Data\Filter('mail eq '.$googleUser->email)); |
49 | - if($localUsers !== false && isset($localUsers[0])) |
|
50 | - { |
|
51 | - if($localUsers[0]->canLoginWith('google.com')) |
|
52 | - { |
|
52 | + if($localUsers !== false && isset($localUsers[0])) |
|
53 | + { |
|
54 | + if($localUsers[0]->canLoginWith('google.com')) |
|
55 | + { |
|
53 | 56 | $auth->impersonateUser($localUsers[0]); |
54 | 57 | return self::SUCCESS; |
55 | 58 | } |
56 | 59 | $currentUser = $localUsers[0]; |
57 | 60 | return self::ALREADY_PRESENT; |
58 | - } |
|
59 | - else |
|
60 | - { |
|
61 | + } |
|
62 | + else |
|
63 | + { |
|
61 | 64 | $user = new PendingUser(); |
62 | 65 | $user->setEmail($googleUser->email); |
63 | 66 | $user->setGivenName($googleUser->givenName); |
64 | 67 | $user->setLastName($googleUser->familyName); |
65 | 68 | $user->addLoginProvider('google.com'); |
66 | 69 | $ret = $auth->activatePendingUser($user); |
67 | - if($ret === false) |
|
68 | - { |
|
70 | + if($ret === false) |
|
71 | + { |
|
69 | 72 | throw new \Exception('Unable to create user! '.$res); |
70 | 73 | } |
71 | 74 | return self::SUCCESS; |
72 | 75 | } |
73 | 76 | } |
74 | 77 | |
75 | - public function getUser($data = false) |
|
76 | - { |
|
77 | - if($data === false) |
|
78 | - { |
|
78 | + public function getUser($data = false) |
|
79 | + { |
|
80 | + if($data === false) |
|
81 | + { |
|
79 | 82 | $data = $this->token; |
80 | 83 | } |
81 | - try { |
|
84 | + try |
|
85 | + { |
|
82 | 86 | $this->client->setAccessToken($data); |
83 | 87 | $oauth2Service = new \Google_Service_Oauth2($this->client); |
84 | 88 | $googleUser = $oauth2Service->userinfo->get(); |
@@ -89,8 +93,9 @@ discard block |
||
89 | 93 | $profileUser['displayName'] = $googleUser->name; |
90 | 94 | $profileUser['jpegPhoto'] = base64_encode(file_get_contents($googleUser->picture)); |
91 | 95 | return $profileUser; |
92 | - } catch(\Exception $e) |
|
93 | - { |
|
96 | + } |
|
97 | + catch(\Exception $e) |
|
98 | + { |
|
94 | 99 | return false; |
95 | 100 | } |
96 | 101 | } |
@@ -65,7 +65,7 @@ |
||
65 | 65 | $collections = $this->db->getCollectionNames(); |
66 | 66 | if(in_array($name, $collections)) |
67 | 67 | { |
68 | - return true; |
|
68 | + return true; |
|
69 | 69 | } |
70 | 70 | return false; |
71 | 71 | } |
@@ -65,11 +65,11 @@ discard block |
||
65 | 65 | $ret = $this->dataset->read($this->tablename, $where, 'COUNT(*)'); |
66 | 66 | if($ret === false || !isset($ret[0]) || !isset($ret[0]['COUNT(*)'])) |
67 | 67 | { |
68 | - return false; |
|
68 | + return false; |
|
69 | 69 | } |
70 | 70 | else |
71 | 71 | { |
72 | - return $ret[0]['COUNT(*)']; |
|
72 | + return $ret[0]['COUNT(*)']; |
|
73 | 73 | } |
74 | 74 | } |
75 | 75 | |
@@ -93,8 +93,8 @@ discard block |
||
93 | 93 | |
94 | 94 | function update($filter, $data) |
95 | 95 | { |
96 | - $where = $filter->to_sql_string(); |
|
97 | - return $this->dataset->update($this->tablename, $where, $data); |
|
96 | + $where = $filter->to_sql_string(); |
|
97 | + return $this->dataset->update($this->tablename, $where, $data); |
|
98 | 98 | } |
99 | 99 | |
100 | 100 | function create($data) |
@@ -59,239 +59,239 @@ |
||
59 | 59 | |
60 | 60 | global $jsArray; |
61 | 61 | $jsArray = array( |
62 | - JS_JQUERY => array( |
|
63 | - 'no' => array( |
|
64 | - 'no' => '/js/common/jquery.js', |
|
65 | - 'min' => '/js/common/jquery.min.js' |
|
66 | - ), |
|
67 | - 'cdn' => array( |
|
68 | - 'no' => '//ajax.googleapis.com/ajax/libs/jquery/2.1.4/jquery.js', |
|
69 | - 'min' => '//ajax.googleapis.com/ajax/libs/jquery/2.1.4/jquery.min.js' |
|
70 | - ) |
|
71 | - ), |
|
72 | - JS_JQUERY_UI => array( |
|
73 | - 'no' => array( |
|
74 | - 'no' => '/js/common/jquery-ui.js', |
|
75 | - 'min' => '/js/common/jquery-ui.min.js' |
|
76 | - ), |
|
77 | - 'cdn' => array( |
|
78 | - 'no' => '//ajax.googleapis.com/ajax/libs/jqueryui/1.11.4/jquery-ui.js', |
|
79 | - 'min' => '//ajax.googleapis.com/ajax/libs/jqueryui/1.11.4/jquery-ui.min.js' |
|
80 | - ) |
|
81 | - ), |
|
82 | - JS_BOOTSTRAP => array( |
|
83 | - 'no' => array( |
|
84 | - 'no' => '/js/common/bootstrap.js', |
|
85 | - 'min' => '/js/common/bootstrap.min.js' |
|
86 | - ), |
|
87 | - 'cdn' => array( |
|
88 | - 'no' => '//maxcdn.bootstrapcdn.com/bootstrap/3.3.6/js/bootstrap.js', |
|
89 | - 'min' => '//maxcdn.bootstrapcdn.com/bootstrap/3.3.6/js/bootstrap.min.js' |
|
90 | - ) |
|
91 | - ), |
|
92 | - JQUERY_VALIDATE => array( |
|
93 | - 'no' => array( |
|
94 | - 'no' => '/js/common/jquery.validate.js', |
|
95 | - 'min' => '/js/common/jquery.validate.min.js' |
|
96 | - ), |
|
97 | - 'cdn' => array( |
|
98 | - 'no' => '//ajax.aspnetcdn.com/ajax/jquery.validate/1.13.1/jquery.validate.js', |
|
99 | - 'min' => '//ajax.aspnetcdn.com/ajax/jquery.validate/1.13.1/jquery.validate.min.js' |
|
100 | - ) |
|
101 | - ), |
|
102 | - JQUERY_TOUCH => array( |
|
103 | - 'no' => array( |
|
104 | - 'no' => '/js/common/jquery.ui.touch-punch.min.js', |
|
105 | - 'min' => '/js/common/jquery.ui.touch-punch.min.js' |
|
106 | - ), |
|
107 | - 'cdn' => array( |
|
108 | - 'no' => '//cdnjs.cloudflare.com/ajax/libs/jqueryui-touch-punch/0.2.3/jquery.ui.touch-punch.min.js', |
|
109 | - 'min' => '//cdnjs.cloudflare.com/ajax/libs/jqueryui-touch-punch/0.2.3/jquery.ui.touch-punch.min.js' |
|
110 | - ) |
|
111 | - ), |
|
112 | - JS_TINYNAV => array( |
|
113 | - 'no' => array( |
|
114 | - 'no' => '/js/common/tinynav.js', |
|
115 | - 'min' => '/js/common/tinynav.min.js' |
|
116 | - ), |
|
117 | - 'cdn' => array( |
|
118 | - 'no' => '//cdnjs.cloudflare.com/ajax/libs/TinyNav.js/1.2.0/tinynav.js', |
|
119 | - 'min' => '//cdnjs.cloudflare.com/ajax/libs/TinyNav.js/1.2.0/tinynav.min.js' |
|
120 | - ) |
|
121 | - ), |
|
122 | - JS_BOOTSTRAP_FH => array( |
|
123 | - 'no' => array( |
|
124 | - 'no' => '/js/common/bootstrap-formhelpers.js', |
|
125 | - 'min' => '/js/common/bootstrap-formhelpers.min.js' |
|
126 | - ), |
|
127 | - 'cdn' => array( |
|
128 | - 'no' => '//cdnjs.cloudflare.com/ajax/libs/bootstrap-formhelpers/2.3.0/js/bootstrap-formhelpers.js', |
|
129 | - 'min' => '//cdnjs.cloudflare.com/ajax/libs/bootstrap-formhelpers/2.3.0/js/bootstrap-formhelpers.min.js' |
|
130 | - ) |
|
131 | - ), |
|
132 | - JS_BOOTSTRAP_SW => array( |
|
133 | - 'no' => array( |
|
134 | - 'no' => '/js/common/bootstrap-switch.js', |
|
135 | - 'min' => '/js/common/bootstrap-switch.min.js' |
|
136 | - ), |
|
137 | - 'cdn' => array( |
|
138 | - 'no' => '//cdnjs.cloudflare.com/ajax/libs/bootstrap-switch/3.3.2/js/bootstrap-switch.js', |
|
139 | - 'min' => '//cdnjs.cloudflare.com/ajax/libs/bootstrap-switch/3.3.2/js/bootstrap-switch.min.js' |
|
140 | - ) |
|
141 | - ), |
|
142 | - JS_DATATABLE => array( |
|
143 | - 'no' => array( |
|
144 | - 'no' => '/js/common/jquery.dataTables.js', |
|
145 | - 'min' => '/js/common/jquery.dataTables.min.js' |
|
146 | - ), |
|
147 | - 'cdn' => array( |
|
148 | - 'no' => '//cdn.datatables.net/1.10.7/js/jquery.dataTables.js', |
|
149 | - 'min' => '//cdn.datatables.net/1.10.7/js/jquery.dataTables.min.js' |
|
150 | - ) |
|
151 | - ), |
|
152 | - JS_CHART => array( |
|
153 | - 'no' => array( |
|
154 | - 'no' => '/js/common/Chart.js', |
|
155 | - 'min' => '/js/common/Chart.min.js' |
|
156 | - ), |
|
157 | - 'cdn' => array( |
|
158 | - 'no' => '//cdnjs.cloudflare.com/ajax/libs/Chart.js/1.0.2/Chart.js', |
|
159 | - 'min' => '//cdnjs.cloudflare.com/ajax/libs/Chart.js/1.0.2/Chart.min.js' |
|
160 | - ) |
|
161 | - ), |
|
162 | - JS_METISMENU => array( |
|
163 | - 'no' => array( |
|
164 | - 'no' => '/js/common/metisMenu.js', |
|
165 | - 'min' => '/js/common/metisMenu.min.js' |
|
166 | - ), |
|
167 | - 'cdn' => array( |
|
168 | - 'no' => '//cdnjs.cloudflare.com/ajax/libs/metisMenu/2.0.2/metisMenu.js', |
|
169 | - 'min' => '//cdnjs.cloudflare.com/ajax/libs/metisMenu/2.0.2/metisMenu.min.js' |
|
170 | - ) |
|
171 | - ), |
|
172 | - JS_BOOTBOX => array( |
|
173 | - 'no' => array( |
|
174 | - 'no' => '/js/common/bootbox.js', |
|
175 | - 'min' => '/js/common/bootbox.min.js' |
|
176 | - ), |
|
177 | - 'cdn' => array( |
|
178 | - 'no' => '//cdnjs.cloudflare.com/ajax/libs/bootbox.js/4.3.0/bootbox.js', |
|
179 | - 'min' => '//cdnjs.cloudflare.com/ajax/libs/bootbox.js/4.3.0/bootbox.min.js' |
|
180 | - ) |
|
181 | - ), |
|
182 | - JS_DATATABLE_ODATA => array( |
|
183 | - 'no' => array( |
|
184 | - 'no' => '/js/common/jquery.dataTables.odata.js', |
|
185 | - 'min' => '/js/common/jquery.dataTables.odata.js', |
|
186 | - ), |
|
187 | - 'cdn' => array( |
|
188 | - 'no' => '/js/common/jquery.dataTables.odata.js', |
|
189 | - 'min' => '/js/common/jquery.dataTables.odata.js', |
|
190 | - ) |
|
191 | - ), |
|
192 | - JS_CRYPTO_MD5_JS => array( |
|
193 | - 'no' => array( |
|
194 | - 'no' => '/js/common/md5.js', |
|
195 | - 'min' => '/js/common/md5.js', |
|
196 | - ), |
|
197 | - 'cdn' => array( |
|
198 | - 'no' => '//cdnjs.cloudflare.com/ajax/libs/crypto-js/3.1.2/rollups/md5.js', |
|
199 | - 'min' => '//cdnjs.cloudflare.com/ajax/libs/crypto-js/3.1.2/rollups/md5.js', |
|
200 | - ) |
|
201 | - ), |
|
202 | - JS_JCROP => array( |
|
203 | - 'no' => array( |
|
204 | - 'no' => '/js/common/jquery.Jcrop.min.js', |
|
205 | - 'min' => '/js/common/jquery.Jcrop.min.js' |
|
206 | - ), |
|
207 | - 'cdn' => array( |
|
208 | - 'no' => '//cdnjs.cloudflare.com/ajax/libs/jquery-jcrop/0.9.12/js/jquery.Jcrop.min.js', |
|
209 | - 'min' => '//cdnjs.cloudflare.com/ajax/libs/jquery-jcrop/0.9.12/js/jquery.Jcrop.min.js' |
|
210 | - ) |
|
211 | - ), |
|
212 | - JS_TYPEAHEAD => array( |
|
213 | - 'no' => array( |
|
214 | - 'no' => '/js/common/typeahead.bundle.js', |
|
215 | - 'min' => '/js/common/typeahead.bundle.min.js' |
|
216 | - ), |
|
217 | - 'cdn' => array( |
|
218 | - 'no' => '//cdnjs.cloudflare.com/ajax/libs/typeahead.js/0.11.1/typeahead.bundle.js', |
|
219 | - 'min' => '//cdnjs.cloudflare.com/ajax/libs/typeahead.js/0.11.1/typeahead.bundle.min.js' |
|
220 | - ) |
|
221 | - ), |
|
222 | - JS_FLIPSIDE => array( |
|
223 | - 'no' => array( |
|
224 | - 'no' => '/js/common/flipside.js', |
|
225 | - 'min' => '/js/common/flipside.min.js' |
|
226 | - ), |
|
227 | - 'cdn' => array( |
|
228 | - 'no' => '/js/common/flipside.js', |
|
229 | - 'min' => '/js/common/flipside.min.js' |
|
230 | - ) |
|
231 | - ), |
|
232 | - JS_LOGIN => array( |
|
233 | - 'no' => array( |
|
234 | - 'no' => '/js/common/login.js', |
|
235 | - 'min' => '/js/common/login.min.js' |
|
236 | - ), |
|
237 | - 'cdn' => array( |
|
238 | - 'no' => '/js/common/login.js', |
|
239 | - 'min' => '/js/common/login.min.js' |
|
240 | - ) |
|
241 | - ) |
|
62 | + JS_JQUERY => array( |
|
63 | + 'no' => array( |
|
64 | + 'no' => '/js/common/jquery.js', |
|
65 | + 'min' => '/js/common/jquery.min.js' |
|
66 | + ), |
|
67 | + 'cdn' => array( |
|
68 | + 'no' => '//ajax.googleapis.com/ajax/libs/jquery/2.1.4/jquery.js', |
|
69 | + 'min' => '//ajax.googleapis.com/ajax/libs/jquery/2.1.4/jquery.min.js' |
|
70 | + ) |
|
71 | + ), |
|
72 | + JS_JQUERY_UI => array( |
|
73 | + 'no' => array( |
|
74 | + 'no' => '/js/common/jquery-ui.js', |
|
75 | + 'min' => '/js/common/jquery-ui.min.js' |
|
76 | + ), |
|
77 | + 'cdn' => array( |
|
78 | + 'no' => '//ajax.googleapis.com/ajax/libs/jqueryui/1.11.4/jquery-ui.js', |
|
79 | + 'min' => '//ajax.googleapis.com/ajax/libs/jqueryui/1.11.4/jquery-ui.min.js' |
|
80 | + ) |
|
81 | + ), |
|
82 | + JS_BOOTSTRAP => array( |
|
83 | + 'no' => array( |
|
84 | + 'no' => '/js/common/bootstrap.js', |
|
85 | + 'min' => '/js/common/bootstrap.min.js' |
|
86 | + ), |
|
87 | + 'cdn' => array( |
|
88 | + 'no' => '//maxcdn.bootstrapcdn.com/bootstrap/3.3.6/js/bootstrap.js', |
|
89 | + 'min' => '//maxcdn.bootstrapcdn.com/bootstrap/3.3.6/js/bootstrap.min.js' |
|
90 | + ) |
|
91 | + ), |
|
92 | + JQUERY_VALIDATE => array( |
|
93 | + 'no' => array( |
|
94 | + 'no' => '/js/common/jquery.validate.js', |
|
95 | + 'min' => '/js/common/jquery.validate.min.js' |
|
96 | + ), |
|
97 | + 'cdn' => array( |
|
98 | + 'no' => '//ajax.aspnetcdn.com/ajax/jquery.validate/1.13.1/jquery.validate.js', |
|
99 | + 'min' => '//ajax.aspnetcdn.com/ajax/jquery.validate/1.13.1/jquery.validate.min.js' |
|
100 | + ) |
|
101 | + ), |
|
102 | + JQUERY_TOUCH => array( |
|
103 | + 'no' => array( |
|
104 | + 'no' => '/js/common/jquery.ui.touch-punch.min.js', |
|
105 | + 'min' => '/js/common/jquery.ui.touch-punch.min.js' |
|
106 | + ), |
|
107 | + 'cdn' => array( |
|
108 | + 'no' => '//cdnjs.cloudflare.com/ajax/libs/jqueryui-touch-punch/0.2.3/jquery.ui.touch-punch.min.js', |
|
109 | + 'min' => '//cdnjs.cloudflare.com/ajax/libs/jqueryui-touch-punch/0.2.3/jquery.ui.touch-punch.min.js' |
|
110 | + ) |
|
111 | + ), |
|
112 | + JS_TINYNAV => array( |
|
113 | + 'no' => array( |
|
114 | + 'no' => '/js/common/tinynav.js', |
|
115 | + 'min' => '/js/common/tinynav.min.js' |
|
116 | + ), |
|
117 | + 'cdn' => array( |
|
118 | + 'no' => '//cdnjs.cloudflare.com/ajax/libs/TinyNav.js/1.2.0/tinynav.js', |
|
119 | + 'min' => '//cdnjs.cloudflare.com/ajax/libs/TinyNav.js/1.2.0/tinynav.min.js' |
|
120 | + ) |
|
121 | + ), |
|
122 | + JS_BOOTSTRAP_FH => array( |
|
123 | + 'no' => array( |
|
124 | + 'no' => '/js/common/bootstrap-formhelpers.js', |
|
125 | + 'min' => '/js/common/bootstrap-formhelpers.min.js' |
|
126 | + ), |
|
127 | + 'cdn' => array( |
|
128 | + 'no' => '//cdnjs.cloudflare.com/ajax/libs/bootstrap-formhelpers/2.3.0/js/bootstrap-formhelpers.js', |
|
129 | + 'min' => '//cdnjs.cloudflare.com/ajax/libs/bootstrap-formhelpers/2.3.0/js/bootstrap-formhelpers.min.js' |
|
130 | + ) |
|
131 | + ), |
|
132 | + JS_BOOTSTRAP_SW => array( |
|
133 | + 'no' => array( |
|
134 | + 'no' => '/js/common/bootstrap-switch.js', |
|
135 | + 'min' => '/js/common/bootstrap-switch.min.js' |
|
136 | + ), |
|
137 | + 'cdn' => array( |
|
138 | + 'no' => '//cdnjs.cloudflare.com/ajax/libs/bootstrap-switch/3.3.2/js/bootstrap-switch.js', |
|
139 | + 'min' => '//cdnjs.cloudflare.com/ajax/libs/bootstrap-switch/3.3.2/js/bootstrap-switch.min.js' |
|
140 | + ) |
|
141 | + ), |
|
142 | + JS_DATATABLE => array( |
|
143 | + 'no' => array( |
|
144 | + 'no' => '/js/common/jquery.dataTables.js', |
|
145 | + 'min' => '/js/common/jquery.dataTables.min.js' |
|
146 | + ), |
|
147 | + 'cdn' => array( |
|
148 | + 'no' => '//cdn.datatables.net/1.10.7/js/jquery.dataTables.js', |
|
149 | + 'min' => '//cdn.datatables.net/1.10.7/js/jquery.dataTables.min.js' |
|
150 | + ) |
|
151 | + ), |
|
152 | + JS_CHART => array( |
|
153 | + 'no' => array( |
|
154 | + 'no' => '/js/common/Chart.js', |
|
155 | + 'min' => '/js/common/Chart.min.js' |
|
156 | + ), |
|
157 | + 'cdn' => array( |
|
158 | + 'no' => '//cdnjs.cloudflare.com/ajax/libs/Chart.js/1.0.2/Chart.js', |
|
159 | + 'min' => '//cdnjs.cloudflare.com/ajax/libs/Chart.js/1.0.2/Chart.min.js' |
|
160 | + ) |
|
161 | + ), |
|
162 | + JS_METISMENU => array( |
|
163 | + 'no' => array( |
|
164 | + 'no' => '/js/common/metisMenu.js', |
|
165 | + 'min' => '/js/common/metisMenu.min.js' |
|
166 | + ), |
|
167 | + 'cdn' => array( |
|
168 | + 'no' => '//cdnjs.cloudflare.com/ajax/libs/metisMenu/2.0.2/metisMenu.js', |
|
169 | + 'min' => '//cdnjs.cloudflare.com/ajax/libs/metisMenu/2.0.2/metisMenu.min.js' |
|
170 | + ) |
|
171 | + ), |
|
172 | + JS_BOOTBOX => array( |
|
173 | + 'no' => array( |
|
174 | + 'no' => '/js/common/bootbox.js', |
|
175 | + 'min' => '/js/common/bootbox.min.js' |
|
176 | + ), |
|
177 | + 'cdn' => array( |
|
178 | + 'no' => '//cdnjs.cloudflare.com/ajax/libs/bootbox.js/4.3.0/bootbox.js', |
|
179 | + 'min' => '//cdnjs.cloudflare.com/ajax/libs/bootbox.js/4.3.0/bootbox.min.js' |
|
180 | + ) |
|
181 | + ), |
|
182 | + JS_DATATABLE_ODATA => array( |
|
183 | + 'no' => array( |
|
184 | + 'no' => '/js/common/jquery.dataTables.odata.js', |
|
185 | + 'min' => '/js/common/jquery.dataTables.odata.js', |
|
186 | + ), |
|
187 | + 'cdn' => array( |
|
188 | + 'no' => '/js/common/jquery.dataTables.odata.js', |
|
189 | + 'min' => '/js/common/jquery.dataTables.odata.js', |
|
190 | + ) |
|
191 | + ), |
|
192 | + JS_CRYPTO_MD5_JS => array( |
|
193 | + 'no' => array( |
|
194 | + 'no' => '/js/common/md5.js', |
|
195 | + 'min' => '/js/common/md5.js', |
|
196 | + ), |
|
197 | + 'cdn' => array( |
|
198 | + 'no' => '//cdnjs.cloudflare.com/ajax/libs/crypto-js/3.1.2/rollups/md5.js', |
|
199 | + 'min' => '//cdnjs.cloudflare.com/ajax/libs/crypto-js/3.1.2/rollups/md5.js', |
|
200 | + ) |
|
201 | + ), |
|
202 | + JS_JCROP => array( |
|
203 | + 'no' => array( |
|
204 | + 'no' => '/js/common/jquery.Jcrop.min.js', |
|
205 | + 'min' => '/js/common/jquery.Jcrop.min.js' |
|
206 | + ), |
|
207 | + 'cdn' => array( |
|
208 | + 'no' => '//cdnjs.cloudflare.com/ajax/libs/jquery-jcrop/0.9.12/js/jquery.Jcrop.min.js', |
|
209 | + 'min' => '//cdnjs.cloudflare.com/ajax/libs/jquery-jcrop/0.9.12/js/jquery.Jcrop.min.js' |
|
210 | + ) |
|
211 | + ), |
|
212 | + JS_TYPEAHEAD => array( |
|
213 | + 'no' => array( |
|
214 | + 'no' => '/js/common/typeahead.bundle.js', |
|
215 | + 'min' => '/js/common/typeahead.bundle.min.js' |
|
216 | + ), |
|
217 | + 'cdn' => array( |
|
218 | + 'no' => '//cdnjs.cloudflare.com/ajax/libs/typeahead.js/0.11.1/typeahead.bundle.js', |
|
219 | + 'min' => '//cdnjs.cloudflare.com/ajax/libs/typeahead.js/0.11.1/typeahead.bundle.min.js' |
|
220 | + ) |
|
221 | + ), |
|
222 | + JS_FLIPSIDE => array( |
|
223 | + 'no' => array( |
|
224 | + 'no' => '/js/common/flipside.js', |
|
225 | + 'min' => '/js/common/flipside.min.js' |
|
226 | + ), |
|
227 | + 'cdn' => array( |
|
228 | + 'no' => '/js/common/flipside.js', |
|
229 | + 'min' => '/js/common/flipside.min.js' |
|
230 | + ) |
|
231 | + ), |
|
232 | + JS_LOGIN => array( |
|
233 | + 'no' => array( |
|
234 | + 'no' => '/js/common/login.js', |
|
235 | + 'min' => '/js/common/login.min.js' |
|
236 | + ), |
|
237 | + 'cdn' => array( |
|
238 | + 'no' => '/js/common/login.js', |
|
239 | + 'min' => '/js/common/login.min.js' |
|
240 | + ) |
|
241 | + ) |
|
242 | 242 | ); |
243 | 243 | |
244 | 244 | global $cssArray; |
245 | 245 | $cssArray = array( |
246 | 246 | CSS_JQUERY_UI => array( |
247 | 247 | 'no' => array( |
248 | - 'no' => '/css/common/jquery-ui.css', |
|
249 | - 'min' => '/css/common/jquery-ui.min.css' |
|
250 | - ), |
|
251 | - 'cdn' => array( |
|
252 | - 'no' => '//ajax.googleapis.com/ajax/libs/jqueryui/1.11.4/themes/smoothness/jquery-ui.css', |
|
253 | - 'min' => '//ajax.googleapis.com/ajax/libs/jqueryui/1.11.4/themes/smoothness/jquery-ui.min.css' |
|
254 | - ) |
|
248 | + 'no' => '/css/common/jquery-ui.css', |
|
249 | + 'min' => '/css/common/jquery-ui.min.css' |
|
250 | + ), |
|
251 | + 'cdn' => array( |
|
252 | + 'no' => '//ajax.googleapis.com/ajax/libs/jqueryui/1.11.4/themes/smoothness/jquery-ui.css', |
|
253 | + 'min' => '//ajax.googleapis.com/ajax/libs/jqueryui/1.11.4/themes/smoothness/jquery-ui.min.css' |
|
254 | + ) |
|
255 | 255 | ), |
256 | 256 | CSS_BOOTSTRAP => array( |
257 | - 'no' => array( |
|
258 | - 'no' => '/css/common/bootstrap.css', |
|
259 | - 'min' => '/css/common/bootstrap.min.css' |
|
260 | - ), |
|
261 | - 'cdn' => array( |
|
262 | - 'no' => '//maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.css', |
|
263 | - 'min' => '//maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css' |
|
264 | - ) |
|
257 | + 'no' => array( |
|
258 | + 'no' => '/css/common/bootstrap.css', |
|
259 | + 'min' => '/css/common/bootstrap.min.css' |
|
260 | + ), |
|
261 | + 'cdn' => array( |
|
262 | + 'no' => '//maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.css', |
|
263 | + 'min' => '//maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css' |
|
264 | + ) |
|
265 | 265 | ), |
266 | 266 | CSS_BOOTSTRAP_FH => array( |
267 | 267 | 'no' => array( |
268 | - 'no' => '/css/common/bootstrap-formhelpers.css', |
|
269 | - 'min' => '/css/common/bootstrap-formhelpers.min.css' |
|
270 | - ), |
|
271 | - 'cdn' => array( |
|
272 | - 'no' => '//cdnjs.cloudflare.com/ajax/libs/bootstrap-formhelpers/2.3.0/css/bootstrap-formhelpers.css', |
|
273 | - 'min' => '//cdnjs.cloudflare.com/ajax/libs/bootstrap-formhelpers/2.3.0/css/bootstrap-formhelpers.min.css' |
|
274 | - ) |
|
268 | + 'no' => '/css/common/bootstrap-formhelpers.css', |
|
269 | + 'min' => '/css/common/bootstrap-formhelpers.min.css' |
|
270 | + ), |
|
271 | + 'cdn' => array( |
|
272 | + 'no' => '//cdnjs.cloudflare.com/ajax/libs/bootstrap-formhelpers/2.3.0/css/bootstrap-formhelpers.css', |
|
273 | + 'min' => '//cdnjs.cloudflare.com/ajax/libs/bootstrap-formhelpers/2.3.0/css/bootstrap-formhelpers.min.css' |
|
274 | + ) |
|
275 | 275 | ), |
276 | 276 | CSS_BOOTSTRAP_SW => array( |
277 | - 'no' => array( |
|
278 | - 'no' => '/css/common/bootstrap-switch.css', |
|
279 | - 'min' => '/css/common/bootstrap-switch.min.css' |
|
280 | - ), |
|
281 | - 'cdn' => array( |
|
282 | - 'no' => '//cdnjs.cloudflare.com/ajax/libs/bootstrap-switch/3.3.2/css/bootstrap3/bootstrap-switch.css', |
|
283 | - 'min' => '//cdnjs.cloudflare.com/ajax/libs/bootstrap-switch/3.3.2/css/bootstrap3/bootstrap-switch.min.css' |
|
284 | - ) |
|
277 | + 'no' => array( |
|
278 | + 'no' => '/css/common/bootstrap-switch.css', |
|
279 | + 'min' => '/css/common/bootstrap-switch.min.css' |
|
280 | + ), |
|
281 | + 'cdn' => array( |
|
282 | + 'no' => '//cdnjs.cloudflare.com/ajax/libs/bootstrap-switch/3.3.2/css/bootstrap3/bootstrap-switch.css', |
|
283 | + 'min' => '//cdnjs.cloudflare.com/ajax/libs/bootstrap-switch/3.3.2/css/bootstrap3/bootstrap-switch.min.css' |
|
284 | + ) |
|
285 | 285 | ), |
286 | 286 | CSS_DATATABLE => array( |
287 | 287 | 'no' => array( |
288 | - 'no' => '/css/common/jquery.dataTables.css', |
|
289 | - 'min' => '/css/common/jquery.dataTables.min.css' |
|
290 | - ), |
|
291 | - 'cdn' => array( |
|
292 | - 'no' => '//cdn.datatables.net/1.10.7/css/jquery.dataTables.css', |
|
293 | - 'min' => '//cdn.datatables.net/1.10.7/css/jquery.dataTables.min.css' |
|
294 | - ) |
|
288 | + 'no' => '/css/common/jquery.dataTables.css', |
|
289 | + 'min' => '/css/common/jquery.dataTables.min.css' |
|
290 | + ), |
|
291 | + 'cdn' => array( |
|
292 | + 'no' => '//cdn.datatables.net/1.10.7/css/jquery.dataTables.css', |
|
293 | + 'min' => '//cdn.datatables.net/1.10.7/css/jquery.dataTables.min.css' |
|
294 | + ) |
|
295 | 295 | ), |
296 | 296 | CSS_JCROP => array( |
297 | 297 | 'no' => array( |
@@ -423,7 +423,10 @@ |
||
423 | 423 | */ |
424 | 424 | private function setupVars() |
425 | 425 | { |
426 | - if($this->minified !== null && $this->cdn !== null) return; |
|
426 | + if($this->minified !== null && $this->cdn !== null) |
|
427 | + { |
|
428 | + return; |
|
429 | + } |
|
427 | 430 | $this->minified = 'min'; |
428 | 431 | $this->cdn = 'cdn'; |
429 | 432 | if(isset(FlipsideSettings::$global)) |
@@ -204,7 +204,7 @@ |
||
204 | 204 | |
205 | 205 | static function deleteSessionById($sid) |
206 | 206 | { |
207 | - return unlink(ini_get('session.save_path').'/sess_'.$sid); |
|
207 | + return unlink(ini_get('session.save_path').'/sess_'.$sid); |
|
208 | 208 | } |
209 | 209 | } |
210 | 210 | /* vim: set tabstop=4 shiftwidth=4 expandtab: */ |
@@ -1,6 +1,8 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | require_once('Autoload.php'); |
3 | -if(!isset($_SESSION) && php_sapi_name() !== 'cli') { session_start(); } |
|
3 | +if(!isset($_SESSION) && php_sapi_name() !== 'cli') |
|
4 | +{ |
|
5 | +session_start(); } |
|
4 | 6 | if(!isset($_SESSION['ip_address']) && isset($_SERVER['REMOTE_ADDR'])) |
5 | 7 | { |
6 | 8 | $_SESSION['ip_address'] = $_SERVER['REMOTE_ADDR']; |
@@ -156,7 +158,10 @@ discard block |
||
156 | 158 | $pos = strpos($sessionData, "|", $offset); |
157 | 159 | $len = $pos - $offset; |
158 | 160 | $name = substr($sessionData, $offset, $len); |
159 | - if($name === false) break; |
|
161 | + if($name === false) |
|
162 | + { |
|
163 | + break; |
|
164 | + } |
|
160 | 165 | $offset += $len+1; |
161 | 166 | $data = @unserialize(substr($sessionData, $offset)); |
162 | 167 | $res[$name] = $data; |
@@ -247,15 +247,15 @@ |
||
247 | 247 | */ |
248 | 248 | protected function printIeCompatability($prefix='') |
249 | 249 | { |
250 | - //IE 8 doesn't support HTML 5. Install the shim... |
|
251 | - if($this->getBrowserMajorVer() < 9) |
|
252 | - { |
|
253 | - echo $prefix.'<script src="js/html5.js"></script>'; |
|
254 | - echo "\n"; |
|
255 | - } |
|
256 | - //Tell the browser not to use compatability mode... |
|
257 | - echo $prefix.'<meta http-equiv="X-UA-Compatible" content="IE=edge"/>'; |
|
258 | - echo "\n"; |
|
250 | + //IE 8 doesn't support HTML 5. Install the shim... |
|
251 | + if($this->getBrowserMajorVer() < 9) |
|
252 | + { |
|
253 | + echo $prefix.'<script src="js/html5.js"></script>'; |
|
254 | + echo "\n"; |
|
255 | + } |
|
256 | + //Tell the browser not to use compatability mode... |
|
257 | + echo $prefix.'<meta http-equiv="X-UA-Compatible" content="IE=edge"/>'; |
|
258 | + echo "\n"; |
|
259 | 259 | } |
260 | 260 | |
261 | 261 | /** |