@@ -217,7 +217,7 @@ |
||
| 217 | 217 | * |
| 218 | 218 | * @return array|false |
| 219 | 219 | */ |
| 220 | - protected static function &get_block_by_index ($index) { |
|
| 220 | + protected static function &get_block_by_index($index) { |
|
| 221 | 221 | foreach (Config::instance()->components['blocks'] as &$block) { |
| 222 | 222 | if ($block['index'] == $index) { |
| 223 | 223 | return $block; |
@@ -111,7 +111,7 @@ |
||
| 111 | 111 | 'value', |
| 112 | 112 | 'id' |
| 113 | 113 | ); |
| 114 | - $data['users'] = array_column( |
|
| 114 | + $data['users'] = array_column( |
|
| 115 | 115 | $User->db()->qfa( |
| 116 | 116 | [ |
| 117 | 117 | "SELECT |
@@ -88,7 +88,7 @@ |
||
| 88 | 88 | <FilesMatch "\.css$"> |
| 89 | 89 | Header set Content-Type text/css |
| 90 | 90 | </FilesMatch> |
| 91 | -HTACCESS |
|
| 91 | +htaccess |
|
| 92 | 92 | ); |
| 93 | 93 | } |
| 94 | 94 | foreach ($files as $file) { |
@@ -146,7 +146,7 @@ |
||
| 146 | 146 | Header set Content-Type application/octet-stream |
| 147 | 147 | </ifModule> |
| 148 | 148 | |
| 149 | -HTACCESS; |
|
| 149 | +htaccess; |
|
| 150 | 150 | if (is_dir(STORAGE.'/Composer/vendor/bower-asset')) { |
| 151 | 151 | file_put_contents(STORAGE.'/Composer/vendor/bower-asset/.htaccess', $htaccess_contents); |
| 152 | 152 | } |
@@ -38,7 +38,7 @@ discard block |
||
| 38 | 38 | $module_data = Config::instance()->module('Photo_gallery'); |
| 39 | 39 | if (!$module_data->directory_created) { |
| 40 | 40 | $this->storage()->mkdir('Photo_gallery'); |
| 41 | - $module_data->directory_created = 1; |
|
| 41 | + $module_data->directory_created = 1; |
|
| 42 | 42 | } |
| 43 | 43 | } |
| 44 | 44 | /** |
@@ -69,12 +69,12 @@ discard block |
||
| 69 | 69 | function get ($id) { |
| 70 | 70 | if (is_array($id)) { |
| 71 | 71 | foreach ($id as &$i) { |
| 72 | - $i = $this->get($i); |
|
| 72 | + $i = $this->get($i); |
|
| 73 | 73 | } |
| 74 | 74 | return $id; |
| 75 | 75 | } |
| 76 | - $L = Language::instance(); |
|
| 77 | - $id = (int)$id; |
|
| 76 | + $L = Language::instance(); |
|
| 77 | + $id = (int)$id; |
|
| 78 | 78 | return $this->cache->get("images/$id/$L->clang", function () use ($id) { |
| 79 | 79 | $data = $this->db()->qf( |
| 80 | 80 | "SELECT |
@@ -92,8 +92,8 @@ discard block |
||
| 92 | 92 | $id |
| 93 | 93 | ); |
| 94 | 94 | if ($data) { |
| 95 | - $data['title'] = $this->ml_process($data['title']); |
|
| 96 | - $data['description'] = $this->ml_process($data['description']); |
|
| 95 | + $data['title'] = $this->ml_process($data['title']); |
|
| 96 | + $data['description'] = $this->ml_process($data['description']); |
|
| 97 | 97 | } |
| 98 | 98 | return $data; |
| 99 | 99 | }); |
@@ -115,7 +115,7 @@ discard block |
||
| 115 | 115 | if (!filter_var($original, FILTER_VALIDATE_URL)) { |
| 116 | 116 | return false; |
| 117 | 117 | } |
| 118 | - $gallery = (int)$gallery; |
|
| 118 | + $gallery = (int)$gallery; |
|
| 119 | 119 | if ($this->db_prime()->q( |
| 120 | 120 | "INSERT INTO `[prefix]photo_gallery_images` |
| 121 | 121 | ( |
@@ -136,7 +136,7 @@ discard block |
||
| 136 | 136 | time(), |
| 137 | 137 | $original |
| 138 | 138 | )) { |
| 139 | - $id = $this->db_prime()->id(); |
|
| 139 | + $id = $this->db_prime()->id(); |
|
| 140 | 140 | if ($this->set($id, $title, $description)) { |
| 141 | 141 | Event::instance()->fire( |
| 142 | 142 | 'System/upload_files/add_tag', |
@@ -145,10 +145,10 @@ discard block |
||
| 145 | 145 | 'url' => $original |
| 146 | 146 | ] |
| 147 | 147 | ); |
| 148 | - $hash = md5(random_bytes(1000)); |
|
| 149 | - $tmp_file = TEMP.'/'.User::instance()->id."_$hash"; |
|
| 148 | + $hash = md5(random_bytes(1000)); |
|
| 149 | + $tmp_file = TEMP.'/'.User::instance()->id."_$hash"; |
|
| 150 | 150 | try { |
| 151 | - $SimpleImage = new SimpleImage($original); |
|
| 151 | + $SimpleImage = new SimpleImage($original); |
|
| 152 | 152 | $SimpleImage->thumbnail(256)->save($tmp_file = "$tmp_file.".$SimpleImage->get_original_info()['format']); |
| 153 | 153 | unset($SimpleImage); |
| 154 | 154 | } catch (Exception $e) { |
@@ -156,7 +156,7 @@ discard block |
||
| 156 | 156 | trigger_error($e->getMessage(), E_USER_WARNING); |
| 157 | 157 | return false; |
| 158 | 158 | } |
| 159 | - $storage = $this->storage(); |
|
| 159 | + $storage = $this->storage(); |
|
| 160 | 160 | if (!$storage->file_exists("Photo_gallery/$gallery")) { |
| 161 | 161 | $storage->mkdir("Photo_gallery/$gallery"); |
| 162 | 162 | } |
@@ -198,10 +198,10 @@ discard block |
||
| 198 | 198 | * @return bool |
| 199 | 199 | */ |
| 200 | 200 | function set ($id, $title, $description) { |
| 201 | - $User = User::instance(); |
|
| 202 | - $id = (int)$id; |
|
| 203 | - $title = xap(trim($title)); |
|
| 204 | - $description = xap(trim($description)); |
|
| 201 | + $User = User::instance(); |
|
| 202 | + $id = (int)$id; |
|
| 203 | + $title = xap(trim($title)); |
|
| 204 | + $description = xap(trim($description)); |
|
| 205 | 205 | if ($this->db_prime()->q( |
| 206 | 206 | "UPDATE `[prefix]photo_gallery_images` |
| 207 | 207 | SET |
@@ -233,8 +233,8 @@ discard block |
||
| 233 | 233 | * @return bool |
| 234 | 234 | */ |
| 235 | 235 | function del ($id) { |
| 236 | - $id = (int)$id; |
|
| 237 | - $data = $this->get($id); |
|
| 236 | + $id = (int)$id; |
|
| 237 | + $data = $this->get($id); |
|
| 238 | 238 | if ($this->db_prime()->q( |
| 239 | 239 | "DELETE FROM `[prefix]photo_gallery_images` |
| 240 | 240 | WHERE `id` = $id |
@@ -251,7 +251,7 @@ discard block |
||
| 251 | 251 | if ($data['preview']) { |
| 252 | 252 | $this->storage()->unlink($this->storage()->source_by_url($data['preview'])); |
| 253 | 253 | } |
| 254 | - $Cache = $this->cache; |
|
| 254 | + $Cache = $this->cache; |
|
| 255 | 255 | unset( |
| 256 | 256 | $Cache->{"images/$id"}, |
| 257 | 257 | $Cache->{"galleries/$data[gallery]"} |
@@ -298,12 +298,12 @@ discard block |
||
| 298 | 298 | function get_gallery ($id) { |
| 299 | 299 | if (is_array($id)) { |
| 300 | 300 | foreach ($id as &$i) { |
| 301 | - $i = $this->get_gallery($i); |
|
| 301 | + $i = $this->get_gallery($i); |
|
| 302 | 302 | } |
| 303 | 303 | return $id; |
| 304 | 304 | } |
| 305 | - $L = Language::instance(); |
|
| 306 | - $id = (int)$id; |
|
| 305 | + $L = Language::instance(); |
|
| 306 | + $id = (int)$id; |
|
| 307 | 307 | return $this->cache->get("galleries/$id/$L->clang", function () use ($id) { |
| 308 | 308 | if ($data = $this->db()->qf( |
| 309 | 309 | "SELECT |
@@ -323,17 +323,17 @@ discard block |
||
| 323 | 323 | LIMIT 1", |
| 324 | 324 | $id |
| 325 | 325 | )) { |
| 326 | - $data['title'] = $this->ml_process($data['title']); |
|
| 327 | - $data['path'] = $this->ml_process($data['path']); |
|
| 328 | - $data['description'] = $this->ml_process($data['description']); |
|
| 329 | - $order = $data['preview_image'] == 'first' ? 'ASC' : 'DESC'; |
|
| 330 | - $data['preview'] = $this->db()->qfs( |
|
| 326 | + $data['title'] = $this->ml_process($data['title']); |
|
| 327 | + $data['path'] = $this->ml_process($data['path']); |
|
| 328 | + $data['description'] = $this->ml_process($data['description']); |
|
| 329 | + $order = $data['preview_image'] == 'first' ? 'ASC' : 'DESC'; |
|
| 330 | + $data['preview'] = $this->db()->qfs( |
|
| 331 | 331 | "SELECT `preview` |
| 332 | 332 | FROM `[prefix]photo_gallery_images` |
| 333 | 333 | WHERE `gallery` = $data[id] |
| 334 | 334 | ORDER BY `id` $order" |
| 335 | 335 | ) ?: ''; |
| 336 | - $data['images'] = $this->db()->qfas( |
|
| 336 | + $data['images'] = $this->db()->qfas( |
|
| 337 | 337 | "SELECT `id` |
| 338 | 338 | FROM `[prefix]photo_gallery_images` |
| 339 | 339 | WHERE `gallery` = $data[id] |
@@ -362,7 +362,7 @@ discard block |
||
| 362 | 362 | ('%s')", |
| 363 | 363 | (int)(bool)$active |
| 364 | 364 | )) { |
| 365 | - $id = $this->db_prime()->id(); |
|
| 365 | + $id = $this->db_prime()->id(); |
|
| 366 | 366 | $this->set_gallery($id, $title, $path, $description, $active, $preview_image); |
| 367 | 367 | return $id; |
| 368 | 368 | } |
@@ -381,10 +381,10 @@ discard block |
||
| 381 | 381 | * @return bool |
| 382 | 382 | */ |
| 383 | 383 | function set_gallery ($id, $title, $path, $description, $active, $preview_image) { |
| 384 | - $path = path($path ?: $title); |
|
| 385 | - $title = xap(trim($title)); |
|
| 386 | - $description = xap(trim($description)); |
|
| 387 | - $id = (int)$id; |
|
| 384 | + $path = path($path ?: $title); |
|
| 385 | + $title = xap(trim($title)); |
|
| 386 | + $description = xap(trim($description)); |
|
| 387 | + $id = (int)$id; |
|
| 388 | 388 | if ($this->db_prime()->q( |
| 389 | 389 | "UPDATE `[prefix]photo_gallery_galleries` |
| 390 | 390 | SET |
@@ -402,7 +402,7 @@ discard block |
||
| 402 | 402 | $preview_image, |
| 403 | 403 | $id |
| 404 | 404 | )) { |
| 405 | - $Cache = $this->cache; |
|
| 405 | + $Cache = $this->cache; |
|
| 406 | 406 | unset( |
| 407 | 407 | $Cache->{"galleries/$id"}, |
| 408 | 408 | $Cache->{'galleries/list'} |
@@ -420,7 +420,7 @@ discard block |
||
| 420 | 420 | * @return bool |
| 421 | 421 | */ |
| 422 | 422 | function del_gallery ($id) { |
| 423 | - $id = (int)$id; |
|
| 423 | + $id = (int)$id; |
|
| 424 | 424 | if (!$this->db_prime()->q( |
| 425 | 425 | "DELETE FROM `[prefix]photo_gallery_galleries` |
| 426 | 426 | WHERE `id` = '%s' |
@@ -432,12 +432,12 @@ discard block |
||
| 432 | 432 | $this->ml_del('Photo_gallery/galleries/title', $id); |
| 433 | 433 | $this->ml_del('Photo_gallery/galleries/path', $id); |
| 434 | 434 | $this->ml_del('Photo_gallery/galleries/description', $id); |
| 435 | - $Cache = $this->cache; |
|
| 435 | + $Cache = $this->cache; |
|
| 436 | 436 | unset( |
| 437 | 437 | $Cache->{"galleries/$id"}, |
| 438 | 438 | $Cache->{'galleries/list'} |
| 439 | 439 | ); |
| 440 | - $images = $this->db()->qfas( |
|
| 440 | + $images = $this->db()->qfas( |
|
| 441 | 441 | "SELECT `id` |
| 442 | 442 | FROM `[prefix]photo_gallery_images` |
| 443 | 443 | WHERE `gallery` = '%s'", |
@@ -25,8 +25,7 @@ |
||
| 25 | 25 | ). |
| 26 | 26 | h::label($L->gallery_title). |
| 27 | 27 | h::{'input[is=cs-input-text][name=add[title]]'}(). |
| 28 | - ($Config->core['simple_admin_mode'] ? '' : |
|
| 29 | - h::label(h::info('photo_gallery_gallery_path')). |
|
| 28 | + ($Config->core['simple_admin_mode'] ? '' : h::label(h::info('photo_gallery_gallery_path')). |
|
| 30 | 29 | h::{'input[is=cs-input-text][name=add[path]]'}() |
| 31 | 30 | ). |
| 32 | 31 | h::label($L->gallery_description). |
@@ -25,8 +25,7 @@ |
||
| 25 | 25 | ). |
| 26 | 26 | h::label($L->gallery_title). |
| 27 | 27 | h::{'input[is=cs-input-text][name=add[title]]'}(). |
| 28 | - ($Config->core['simple_admin_mode'] ? '' : |
|
| 29 | - h::label(h::info('photo_gallery_gallery_path')). |
|
| 28 | + ($Config->core['simple_admin_mode'] ? '' : h::label(h::info('photo_gallery_gallery_path')). |
|
| 30 | 29 | h::{'input[is=cs-input-text][name=add[path]]'}() |
| 31 | 30 | ). |
| 32 | 31 | h::label($L->gallery_description). |
@@ -184,40 +184,40 @@ |
||
| 184 | 184 | return; |
| 185 | 185 | } |
| 186 | 186 | switch ($_GET['response_type']) { |
| 187 | - case 'code': |
|
| 188 | - $Response->redirect( |
|
| 189 | - http_build_url( |
|
| 190 | - $redirect_uri, |
|
| 191 | - [ |
|
| 192 | - 'code' => $code, |
|
| 193 | - 'state' => isset($_GET['state']) ? $_GET['state'] : false |
|
| 194 | - ] |
|
| 195 | - ), |
|
| 196 | - 302 |
|
| 197 | - ); |
|
| 198 | - $Page->Content = ''; |
|
| 199 | - return; |
|
| 200 | - case 'token': |
|
| 201 | - $token_data = $OAuth2->get_code($code, $client['id'], $client['secret'], $redirect_uri); |
|
| 202 | - if ($token_data) { |
|
| 203 | - unset($token_data['refresh_token']); |
|
| 204 | - $url = http_build_url( |
|
| 205 | - $redirect_uri, |
|
| 206 | - array_merge( |
|
| 207 | - $token_data, |
|
| 187 | + case 'code': |
|
| 188 | + $Response->redirect( |
|
| 189 | + http_build_url( |
|
| 190 | + $redirect_uri, |
|
| 208 | 191 | [ |
| 192 | + 'code' => $code, |
|
| 209 | 193 | 'state' => isset($_GET['state']) ? $_GET['state'] : false |
| 210 | 194 | ] |
| 211 | - ) |
|
| 195 | + ), |
|
| 196 | + 302 |
|
| 212 | 197 | ); |
| 213 | - $url = implode('#', explode('?', $url, 2)); |
|
| 214 | - $Response->redirect($url, 302); |
|
| 215 | 198 | $Page->Content = ''; |
| 216 | 199 | return; |
| 217 | - } else { |
|
| 218 | - error_redirect('server_error', "Server can't get token data, try later"); |
|
| 219 | - return; |
|
| 220 | - } |
|
| 221 | - default: |
|
| 222 | - error_redirect('unsupported_response_type', 'Specified response_type is not supported, only "token" or "code" types available'); |
|
| 200 | + case 'token': |
|
| 201 | + $token_data = $OAuth2->get_code($code, $client['id'], $client['secret'], $redirect_uri); |
|
| 202 | + if ($token_data) { |
|
| 203 | + unset($token_data['refresh_token']); |
|
| 204 | + $url = http_build_url( |
|
| 205 | + $redirect_uri, |
|
| 206 | + array_merge( |
|
| 207 | + $token_data, |
|
| 208 | + [ |
|
| 209 | + 'state' => isset($_GET['state']) ? $_GET['state'] : false |
|
| 210 | + ] |
|
| 211 | + ) |
|
| 212 | + ); |
|
| 213 | + $url = implode('#', explode('?', $url, 2)); |
|
| 214 | + $Response->redirect($url, 302); |
|
| 215 | + $Page->Content = ''; |
|
| 216 | + return; |
|
| 217 | + } else { |
|
| 218 | + error_redirect('server_error', "Server can't get token data, try later"); |
|
| 219 | + return; |
|
| 220 | + } |
|
| 221 | + default: |
|
| 222 | + error_redirect('unsupported_response_type', 'Specified response_type is not supported, only "token" or "code" types available'); |
|
| 223 | 223 | } |
@@ -18,8 +18,8 @@ |
||
| 18 | 18 | ->header('cache-control', 'no-store') |
| 19 | 19 | ->header('pragma', 'no-cache'); |
| 20 | 20 | /** |
| 21 | - * Errors processing |
|
| 22 | - */ |
|
| 21 | + * Errors processing |
|
| 22 | + */ |
|
| 23 | 23 | if (!isset($_POST['grant_type'])) { |
| 24 | 24 | $e = new ExitException( |
| 25 | 25 | [ |