@@ -25,7 +25,7 @@ |
||
| 25 | 25 | use |
| 26 | 26 | CRUD, |
| 27 | 27 | Singleton; |
| 28 | - protected $data_model = [ |
|
| 28 | + protected $data_model = [ |
|
| 29 | 29 | 'id' => 'int:0', |
| 30 | 30 | 'user' => 'int:0', |
| 31 | 31 | 'date' => 'int:0', |
@@ -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'", |
@@ -75,7 +75,7 @@ |
||
| 75 | 75 | php build.php -M core -m Plupload,Static_pages |
| 76 | 76 | php build.php -M core -p TinyMCE -t DarkEnergy -s custom |
| 77 | 77 | php build.php -M module -m Plupload,Static_pages |
| 78 | -HELP; |
|
| 78 | +help; |
|
| 79 | 79 | } elseif ($mode == 'core') { |
| 80 | 80 | echo $Builder->core($modules, $plugins, $themes, $suffix)."\n"; |
| 81 | 81 | } else { |
@@ -75,7 +75,7 @@ |
||
| 75 | 75 | php build.php -M core -m Plupload,Static_pages |
| 76 | 76 | php build.php -M core -p TinyMCE -t DarkEnergy -s custom |
| 77 | 77 | php build.php -M module -m Plupload,Static_pages |
| 78 | -HELP; |
|
| 78 | +help; |
|
| 79 | 79 | } elseif ($mode == 'core') { |
| 80 | 80 | echo $Builder->core($modules, $plugins, $themes, $suffix)."\n"; |
| 81 | 81 | } else { |
@@ -75,7 +75,7 @@ |
||
| 75 | 75 | php build.php -M core -m Plupload,Static_pages |
| 76 | 76 | php build.php -M core -p TinyMCE -t DarkEnergy -s custom |
| 77 | 77 | php build.php -M module -m Plupload,Static_pages |
| 78 | -HELP; |
|
| 78 | +help; |
|
| 79 | 79 | } elseif ($mode == 'core') { |
| 80 | 80 | echo $Builder->core($modules, $plugins, $themes, $suffix)."\n"; |
| 81 | 81 | } else { |
@@ -10,16 +10,16 @@ |
||
| 10 | 10 | ArrayAccess, |
| 11 | 11 | SimpleXMLElement; |
| 12 | 12 | /** |
| 13 | - * False_class is used for chained calling, when some method may return false. |
|
| 14 | - * |
|
| 15 | - * Usage of class is simple, just return his instance instead of real boolean <i>false</i>. |
|
| 16 | - * On every call of any method or getting of any property or getting any element of array instance of the this class will be returned. |
|
| 17 | - * Access to anything of this class instance will be casted to boolean <i>false</i> |
|
| 18 | - * |
|
| 19 | - * Inherits SimpleXMLElement in order to be casted from object to boolean as <i>false</i> |
|
| 20 | - * |
|
| 21 | - * @property string $error |
|
| 22 | - */ |
|
| 13 | + * False_class is used for chained calling, when some method may return false. |
|
| 14 | + * |
|
| 15 | + * Usage of class is simple, just return his instance instead of real boolean <i>false</i>. |
|
| 16 | + * On every call of any method or getting of any property or getting any element of array instance of the this class will be returned. |
|
| 17 | + * Access to anything of this class instance will be casted to boolean <i>false</i> |
|
| 18 | + * |
|
| 19 | + * Inherits SimpleXMLElement in order to be casted from object to boolean as <i>false</i> |
|
| 20 | + * |
|
| 21 | + * @property string $error |
|
| 22 | + */ |
|
| 23 | 23 | class False_class extends SimpleXMLElement implements ArrayAccess { |
| 24 | 24 | /** |
| 25 | 25 | * Use this method to obtain correct instance |
@@ -13,12 +13,12 @@ |
||
| 13 | 13 | cs\plugins\Tags\Tags as Tags_trait, |
| 14 | 14 | cs\Singleton; |
| 15 | 15 | /** |
| 16 | - * Tags trait |
|
| 17 | - * |
|
| 18 | - * Provides methods for working with tags for faster development |
|
| 19 | - * |
|
| 20 | - * @method static $this instance($check = false) |
|
| 21 | - */ |
|
| 16 | + * Tags trait |
|
| 17 | + * |
|
| 18 | + * Provides methods for working with tags for faster development |
|
| 19 | + * |
|
| 20 | + * @method static $this instance($check = false) |
|
| 21 | + */ |
|
| 22 | 22 | class Tags { |
| 23 | 23 | use |
| 24 | 24 | Tags_trait, |
@@ -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 | [ |
@@ -13,8 +13,8 @@ |
||
| 13 | 13 | React\EventLoop\Factory as Loop_factory, |
| 14 | 14 | cs\Config; |
| 15 | 15 | /** |
| 16 | - * @return bool |
|
| 17 | - */ |
|
| 16 | + * @return bool |
|
| 17 | + */ |
|
| 18 | 18 | function is_server_running () { |
| 19 | 19 | $connected = false; |
| 20 | 20 | $servers = Pool::instance()->get_all(); |