@@ -1,10 +1,10 @@ |
||
| 1 | 1 | <?php |
| 2 | 2 | /** |
| 3 | - * @package CleverStyle CMS |
|
| 4 | - * @author Nazar Mokrynskyi <[email protected]> |
|
| 5 | - * @copyright Copyright (c) 2013-2016, Nazar Mokrynskyi |
|
| 6 | - * @license MIT License, see license.txt |
|
| 7 | - */ |
|
| 3 | + * @package CleverStyle CMS |
|
| 4 | + * @author Nazar Mokrynskyi <[email protected]> |
|
| 5 | + * @copyright Copyright (c) 2013-2016, Nazar Mokrynskyi |
|
| 6 | + * @license MIT License, see license.txt |
|
| 7 | + */ |
|
| 8 | 8 | namespace cs\CRUD; |
| 9 | 9 | use |
| 10 | 10 | cs\Event, |
@@ -40,7 +40,7 @@ |
||
| 40 | 40 | * |
| 41 | 41 | * @var array |
| 42 | 42 | */ |
| 43 | - public $level = [ |
|
| 43 | + public $level = [ |
|
| 44 | 44 | 'Head' => 0, |
| 45 | 45 | 'pre_Body' => 1, |
| 46 | 46 | 'Left' => 3, |
@@ -1,10 +1,10 @@ |
||
| 1 | 1 | <?php |
| 2 | 2 | /** |
| 3 | - * @package CleverStyle CMS |
|
| 4 | - * @author Nazar Mokrynskyi <[email protected]> |
|
| 5 | - * @copyright Copyright (c) 2013-2016, Nazar Mokrynskyi |
|
| 6 | - * @license MIT License, see license.txt |
|
| 7 | - */ |
|
| 3 | + * @package CleverStyle CMS |
|
| 4 | + * @author Nazar Mokrynskyi <[email protected]> |
|
| 5 | + * @copyright Copyright (c) 2013-2016, Nazar Mokrynskyi |
|
| 6 | + * @license MIT License, see license.txt |
|
| 7 | + */ |
|
| 8 | 8 | namespace cs\CRUD; |
| 9 | 9 | use |
| 10 | 10 | cs\Event, |
@@ -1,11 +1,11 @@ |
||
| 1 | 1 | <?php |
| 2 | 2 | /** |
| 3 | - * @package Photo gallery |
|
| 4 | - * @category modules |
|
| 5 | - * @author Nazar Mokrynskyi <[email protected]> |
|
| 6 | - * @copyright Copyright (c) 2013-2016, Nazar Mokrynskyi |
|
| 7 | - * @license MIT License, see license.txt |
|
| 8 | - */ |
|
| 3 | + * @package Photo gallery |
|
| 4 | + * @category modules |
|
| 5 | + * @author Nazar Mokrynskyi <[email protected]> |
|
| 6 | + * @copyright Copyright (c) 2013-2016, Nazar Mokrynskyi |
|
| 7 | + * @license MIT License, see license.txt |
|
| 8 | + */ |
|
| 9 | 9 | namespace cs\modules\Photo_gallery; |
| 10 | 10 | use |
| 11 | 11 | cs\ExitException, |
@@ -37,7 +37,7 @@ discard block |
||
| 37 | 37 | $module_data = Config::instance()->module('Photo_gallery'); |
| 38 | 38 | if (!$module_data->directory_created) { |
| 39 | 39 | $this->storage()->mkdir('Photo_gallery'); |
| 40 | - $module_data->directory_created = 1; |
|
| 40 | + $module_data->directory_created = 1; |
|
| 41 | 41 | } |
| 42 | 42 | } |
| 43 | 43 | /** |
@@ -68,12 +68,12 @@ discard block |
||
| 68 | 68 | function get ($id) { |
| 69 | 69 | if (is_array($id)) { |
| 70 | 70 | foreach ($id as &$i) { |
| 71 | - $i = $this->get($i); |
|
| 71 | + $i = $this->get($i); |
|
| 72 | 72 | } |
| 73 | 73 | return $id; |
| 74 | 74 | } |
| 75 | - $L = Language::instance(); |
|
| 76 | - $id = (int)$id; |
|
| 75 | + $L = Language::instance(); |
|
| 76 | + $id = (int)$id; |
|
| 77 | 77 | return $this->cache->get("images/$id/$L->clang", function () use ($id) { |
| 78 | 78 | $data = $this->db()->qf([ |
| 79 | 79 | "SELECT |
@@ -91,8 +91,8 @@ discard block |
||
| 91 | 91 | $id |
| 92 | 92 | ]); |
| 93 | 93 | if ($data) { |
| 94 | - $data['title'] = $this->ml_process($data['title']); |
|
| 95 | - $data['description'] = $this->ml_process($data['description']); |
|
| 94 | + $data['title'] = $this->ml_process($data['title']); |
|
| 95 | + $data['description'] = $this->ml_process($data['description']); |
|
| 96 | 96 | } |
| 97 | 97 | return $data; |
| 98 | 98 | }); |
@@ -114,7 +114,7 @@ discard block |
||
| 114 | 114 | if (!filter_var($original, FILTER_VALIDATE_URL)) { |
| 115 | 115 | return false; |
| 116 | 116 | } |
| 117 | - $gallery = (int)$gallery; |
|
| 117 | + $gallery = (int)$gallery; |
|
| 118 | 118 | if ($this->db_prime()->q( |
| 119 | 119 | "INSERT INTO `[prefix]photo_gallery_images` |
| 120 | 120 | ( |
@@ -135,7 +135,7 @@ discard block |
||
| 135 | 135 | time(), |
| 136 | 136 | $original |
| 137 | 137 | )) { |
| 138 | - $id = $this->db_prime()->id(); |
|
| 138 | + $id = $this->db_prime()->id(); |
|
| 139 | 139 | if ($this->set($id, $title, $description)) { |
| 140 | 140 | Event::instance()->fire( |
| 141 | 141 | 'System/upload_files/add_tag', |
@@ -144,10 +144,10 @@ discard block |
||
| 144 | 144 | 'url' => $original |
| 145 | 145 | ] |
| 146 | 146 | ); |
| 147 | - $hash = md5(random_bytes(1000)); |
|
| 148 | - $tmp_file = TEMP.'/'.User::instance()->id."_$hash"; |
|
| 147 | + $hash = md5(random_bytes(1000)); |
|
| 148 | + $tmp_file = TEMP.'/'.User::instance()->id."_$hash"; |
|
| 149 | 149 | try { |
| 150 | - $SimpleImage = new SimpleImage($original); |
|
| 150 | + $SimpleImage = new SimpleImage($original); |
|
| 151 | 151 | $SimpleImage->thumbnail(256)->save($tmp_file = "$tmp_file.".$SimpleImage->get_original_info()['format']); |
| 152 | 152 | unset($SimpleImage); |
| 153 | 153 | } catch (Exception $e) { |
@@ -155,7 +155,7 @@ discard block |
||
| 155 | 155 | trigger_error($e->getMessage(), E_USER_WARNING); |
| 156 | 156 | return false; |
| 157 | 157 | } |
| 158 | - $storage = $this->storage(); |
|
| 158 | + $storage = $this->storage(); |
|
| 159 | 159 | if (!$storage->file_exists("Photo_gallery/$gallery")) { |
| 160 | 160 | $storage->mkdir("Photo_gallery/$gallery"); |
| 161 | 161 | } |
@@ -197,10 +197,10 @@ discard block |
||
| 197 | 197 | * @return bool |
| 198 | 198 | */ |
| 199 | 199 | function set ($id, $title, $description) { |
| 200 | - $User = User::instance(); |
|
| 201 | - $id = (int)$id; |
|
| 202 | - $title = xap(trim($title)); |
|
| 203 | - $description = xap(trim($description)); |
|
| 200 | + $User = User::instance(); |
|
| 201 | + $id = (int)$id; |
|
| 202 | + $title = xap(trim($title)); |
|
| 203 | + $description = xap(trim($description)); |
|
| 204 | 204 | if ($this->db_prime()->q( |
| 205 | 205 | "UPDATE `[prefix]photo_gallery_images` |
| 206 | 206 | SET |
@@ -232,8 +232,8 @@ discard block |
||
| 232 | 232 | * @return bool |
| 233 | 233 | */ |
| 234 | 234 | function del ($id) { |
| 235 | - $id = (int)$id; |
|
| 236 | - $data = $this->get($id); |
|
| 235 | + $id = (int)$id; |
|
| 236 | + $data = $this->get($id); |
|
| 237 | 237 | if ($this->db_prime()->q( |
| 238 | 238 | "DELETE FROM `[prefix]photo_gallery_images` |
| 239 | 239 | WHERE `id` = $id |
@@ -250,7 +250,7 @@ discard block |
||
| 250 | 250 | if ($data['preview']) { |
| 251 | 251 | $this->storage()->unlink($this->storage()->source_by_url($data['preview'])); |
| 252 | 252 | } |
| 253 | - $Cache = $this->cache; |
|
| 253 | + $Cache = $this->cache; |
|
| 254 | 254 | unset( |
| 255 | 255 | $Cache->{"images/$id"}, |
| 256 | 256 | $Cache->{"galleries/$data[gallery]"} |
@@ -297,12 +297,12 @@ discard block |
||
| 297 | 297 | function get_gallery ($id) { |
| 298 | 298 | if (is_array($id)) { |
| 299 | 299 | foreach ($id as &$i) { |
| 300 | - $i = $this->get_gallery($i); |
|
| 300 | + $i = $this->get_gallery($i); |
|
| 301 | 301 | } |
| 302 | 302 | return $id; |
| 303 | 303 | } |
| 304 | - $L = Language::instance(); |
|
| 305 | - $id = (int)$id; |
|
| 304 | + $L = Language::instance(); |
|
| 305 | + $id = (int)$id; |
|
| 306 | 306 | return $this->cache->get("galleries/$id/$L->clang", function () use ($id) { |
| 307 | 307 | if ($data = $this->db()->qf([ |
| 308 | 308 | "SELECT |
@@ -322,17 +322,17 @@ discard block |
||
| 322 | 322 | LIMIT 1", |
| 323 | 323 | $id |
| 324 | 324 | ])) { |
| 325 | - $data['title'] = $this->ml_process($data['title']); |
|
| 326 | - $data['path'] = $this->ml_process($data['path']); |
|
| 327 | - $data['description'] = $this->ml_process($data['description']); |
|
| 328 | - $order = $data['preview_image'] == 'first' ? 'ASC' : 'DESC'; |
|
| 329 | - $data['preview'] = $this->db()->qfs( |
|
| 325 | + $data['title'] = $this->ml_process($data['title']); |
|
| 326 | + $data['path'] = $this->ml_process($data['path']); |
|
| 327 | + $data['description'] = $this->ml_process($data['description']); |
|
| 328 | + $order = $data['preview_image'] == 'first' ? 'ASC' : 'DESC'; |
|
| 329 | + $data['preview'] = $this->db()->qfs( |
|
| 330 | 330 | "SELECT `preview` |
| 331 | 331 | FROM `[prefix]photo_gallery_images` |
| 332 | 332 | WHERE `gallery` = $data[id] |
| 333 | 333 | ORDER BY `id` $order" |
| 334 | 334 | ) ?: ''; |
| 335 | - $data['images'] = $this->db()->qfas( |
|
| 335 | + $data['images'] = $this->db()->qfas( |
|
| 336 | 336 | "SELECT `id` |
| 337 | 337 | FROM `[prefix]photo_gallery_images` |
| 338 | 338 | WHERE `gallery` = $data[id] |
@@ -361,7 +361,7 @@ discard block |
||
| 361 | 361 | ('%s')", |
| 362 | 362 | (int)(bool)$active |
| 363 | 363 | )) { |
| 364 | - $id = $this->db_prime()->id(); |
|
| 364 | + $id = $this->db_prime()->id(); |
|
| 365 | 365 | $this->set_gallery($id, $title, $path, $description, $active, $preview_image); |
| 366 | 366 | return $id; |
| 367 | 367 | } |
@@ -380,10 +380,10 @@ discard block |
||
| 380 | 380 | * @return bool |
| 381 | 381 | */ |
| 382 | 382 | function set_gallery ($id, $title, $path, $description, $active, $preview_image) { |
| 383 | - $path = path($path ?: $title); |
|
| 384 | - $title = xap(trim($title)); |
|
| 385 | - $description = xap(trim($description)); |
|
| 386 | - $id = (int)$id; |
|
| 383 | + $path = path($path ?: $title); |
|
| 384 | + $title = xap(trim($title)); |
|
| 385 | + $description = xap(trim($description)); |
|
| 386 | + $id = (int)$id; |
|
| 387 | 387 | if ($this->db_prime()->q( |
| 388 | 388 | "UPDATE `[prefix]photo_gallery_galleries` |
| 389 | 389 | SET |
@@ -401,7 +401,7 @@ discard block |
||
| 401 | 401 | $preview_image, |
| 402 | 402 | $id |
| 403 | 403 | )) { |
| 404 | - $Cache = $this->cache; |
|
| 404 | + $Cache = $this->cache; |
|
| 405 | 405 | unset( |
| 406 | 406 | $Cache->{"galleries/$id"}, |
| 407 | 407 | $Cache->{'galleries/list'} |
@@ -419,7 +419,7 @@ discard block |
||
| 419 | 419 | * @return bool |
| 420 | 420 | */ |
| 421 | 421 | function del_gallery ($id) { |
| 422 | - $id = (int)$id; |
|
| 422 | + $id = (int)$id; |
|
| 423 | 423 | if (!$this->db_prime()->q( |
| 424 | 424 | "DELETE FROM `[prefix]photo_gallery_galleries` |
| 425 | 425 | WHERE `id` = '%s' |
@@ -431,12 +431,12 @@ discard block |
||
| 431 | 431 | $this->ml_del('Photo_gallery/galleries/title', $id); |
| 432 | 432 | $this->ml_del('Photo_gallery/galleries/path', $id); |
| 433 | 433 | $this->ml_del('Photo_gallery/galleries/description', $id); |
| 434 | - $Cache = $this->cache; |
|
| 434 | + $Cache = $this->cache; |
|
| 435 | 435 | unset( |
| 436 | 436 | $Cache->{"galleries/$id"}, |
| 437 | 437 | $Cache->{'galleries/list'} |
| 438 | 438 | ); |
| 439 | - $images = $this->db()->qfas([ |
|
| 439 | + $images = $this->db()->qfas([ |
|
| 440 | 440 | "SELECT `id` |
| 441 | 441 | FROM `[prefix]photo_gallery_images` |
| 442 | 442 | WHERE `gallery` = '%s'", |
@@ -1,11 +1,11 @@ |
||
| 1 | 1 | <?php |
| 2 | 2 | /** |
| 3 | - * @package Photo gallery |
|
| 4 | - * @category modules |
|
| 5 | - * @author Nazar Mokrynskyi <[email protected]> |
|
| 6 | - * @copyright Copyright (c) 2013-2016, Nazar Mokrynskyi |
|
| 7 | - * @license MIT License, see license.txt |
|
| 8 | - */ |
|
| 3 | + * @package Photo gallery |
|
| 4 | + * @category modules |
|
| 5 | + * @author Nazar Mokrynskyi <[email protected]> |
|
| 6 | + * @copyright Copyright (c) 2013-2016, Nazar Mokrynskyi |
|
| 7 | + * @license MIT License, see license.txt |
|
| 8 | + */ |
|
| 9 | 9 | namespace cs\modules\Photo_gallery; |
| 10 | 10 | use |
| 11 | 11 | cs\ExitException, |
@@ -1,11 +1,11 @@ |
||
| 1 | 1 | <?php |
| 2 | 2 | /** |
| 3 | - * @package Content |
|
| 4 | - * @category modules |
|
| 5 | - * @author Nazar Mokrynskyi <[email protected]> |
|
| 6 | - * @copyright Copyright (c) 2014-2016, Nazar Mokrynskyi |
|
| 7 | - * @license MIT License, see license.txt |
|
| 8 | - */ |
|
| 3 | + * @package Content |
|
| 4 | + * @category modules |
|
| 5 | + * @author Nazar Mokrynskyi <[email protected]> |
|
| 6 | + * @copyright Copyright (c) 2014-2016, Nazar Mokrynskyi |
|
| 7 | + * @license MIT License, see license.txt |
|
| 8 | + */ |
|
| 9 | 9 | namespace cs\modules\Content; |
| 10 | 10 | use |
| 11 | 11 | cs\ExitException, |
@@ -1,11 +1,11 @@ |
||
| 1 | 1 | <?php |
| 2 | 2 | /** |
| 3 | - * @package Polls |
|
| 4 | - * @category modules |
|
| 5 | - * @author Nazar Mokrynskyi <[email protected]> |
|
| 6 | - * @copyright Copyright (c) 2014-2016, Nazar Mokrynskyi |
|
| 7 | - * @license MIT License, see license.txt |
|
| 8 | - */ |
|
| 3 | + * @package Polls |
|
| 4 | + * @category modules |
|
| 5 | + * @author Nazar Mokrynskyi <[email protected]> |
|
| 6 | + * @copyright Copyright (c) 2014-2016, Nazar Mokrynskyi |
|
| 7 | + * @license MIT License, see license.txt |
|
| 8 | + */ |
|
| 9 | 9 | namespace cs\modules\Polls; |
| 10 | 10 | |
| 11 | 11 | use |