@@ -24,7 +24,7 @@ |
||
| 24 | 24 | $html = "<{$tag}"; |
| 25 | 25 | if ($attributes && is_array($attributes)) { |
| 26 | 26 | foreach ($attributes as $key => $value) { |
| 27 | - $html .=" {$key} = '"; |
|
| 27 | + $html .= " {$key} = '"; |
|
| 28 | 28 | if (!is_array($value)) { |
| 29 | 29 | $html .= addcslashes($value, "'"); |
| 30 | 30 | } else { |
@@ -79,10 +79,12 @@ discard block |
||
| 79 | 79 | if (!empty($log['status'])) { |
| 80 | 80 | echo "<tr class = '{$log['status']}'><td>{$log['name']}</td><td>{$log['status']}</td></tr>"; |
| 81 | 81 | } else { |
| 82 | - if (empty($log['end'])) |
|
| 83 | - $log['end'] = microtime(true); |
|
| 84 | - if (empty($log['start'])) |
|
| 85 | - $log['start'] = microtime(true); |
|
| 82 | + if (empty($log['end'])) { |
|
| 83 | + $log['end'] = microtime(true); |
|
| 84 | + } |
|
| 85 | + if (empty($log['start'])) { |
|
| 86 | + $log['start'] = microtime(true); |
|
| 87 | + } |
|
| 86 | 88 | echo "<tr><td>{$log['name']}</td><td" . (round(($log['end'] - $log['start']), 5) > 0.1 ? ' class ="danger"' : '') . ">" . round(($log['end'] - $log['start']), 5) . "</td></tr>"; |
| 87 | 89 | } |
| 88 | 90 | } |
@@ -93,12 +95,13 @@ discard block |
||
| 93 | 95 | function convertSize($size) |
| 94 | 96 | { |
| 95 | 97 | |
| 96 | - if ($size < 1024) |
|
| 97 | - return $size . "B"; |
|
| 98 | - elseif ($size < 1048576) |
|
| 99 | - return round($size / 1024, 2) . "KB"; |
|
| 100 | - else |
|
| 101 | - return round($size / 1048576, 2) . "MB"; |
|
| 98 | + if ($size < 1024) { |
|
| 99 | + return $size . "B"; |
|
| 100 | + } elseif ($size < 1048576) { |
|
| 101 | + return round($size / 1024, 2) . "KB"; |
|
| 102 | + } else { |
|
| 103 | + return round($size / 1048576, 2) . "MB"; |
|
| 104 | + } |
|
| 102 | 105 | } |
| 103 | 106 | |
| 104 | 107 | function __destruct() |
@@ -83,22 +83,22 @@ |
||
| 83 | 83 | $log['end'] = microtime(true); |
| 84 | 84 | if (empty($log['start'])) |
| 85 | 85 | $log['start'] = microtime(true); |
| 86 | - echo "<tr><td>{$log['name']}</td><td" . (round(($log['end'] - $log['start']), 5) > 0.1 ? ' class ="danger"' : '') . ">" . round(($log['end'] - $log['start']), 5) . "</td></tr>"; |
|
| 86 | + echo "<tr><td>{$log['name']}</td><td".(round(($log['end'] - $log['start']), 5) > 0.1 ? ' class ="danger"' : '').">".round(($log['end'] - $log['start']), 5)."</td></tr>"; |
|
| 87 | 87 | } |
| 88 | 88 | } |
| 89 | - echo '<tr><th>Summary</th><th>' . round(( microtime(true) - $this->startTime), 5) . '</th></tr>'; |
|
| 90 | - echo '<tr><th>Memory</th><th>' . $this->convertSize(memory_get_peak_usage()) . ' of ' . ini_get('memory_limit') . '</th></tr></table></div>'; |
|
| 89 | + echo '<tr><th>Summary</th><th>'.round((microtime(true) - $this->startTime), 5).'</th></tr>'; |
|
| 90 | + echo '<tr><th>Memory</th><th>'.$this->convertSize(memory_get_peak_usage()).' of '.ini_get('memory_limit').'</th></tr></table></div>'; |
|
| 91 | 91 | } |
| 92 | 92 | |
| 93 | 93 | public function convertSize($size) |
| 94 | 94 | { |
| 95 | 95 | |
| 96 | 96 | if ($size < 1024) |
| 97 | - return $size . "B"; |
|
| 97 | + return $size."B"; |
|
| 98 | 98 | elseif ($size < 1048576) |
| 99 | - return round($size / 1024, 2) . "KB"; |
|
| 99 | + return round($size / 1024, 2)."KB"; |
|
| 100 | 100 | else |
| 101 | - return round($size / 1048576, 2) . "MB"; |
|
| 101 | + return round($size / 1048576, 2)."MB"; |
|
| 102 | 102 | } |
| 103 | 103 | |
| 104 | 104 | public function __destruct() |
@@ -22,7 +22,7 @@ |
||
| 22 | 22 | if (!empty($_SESSION['_INJI_MSG'])) { |
| 23 | 23 | foreach ($_SESSION['_INJI_MSG'] as $key => $msg) { |
| 24 | 24 | if ($msg['text'] == $text) { |
| 25 | - $msg['count'] ++; |
|
| 25 | + $msg['count']++; |
|
| 26 | 26 | return true; |
| 27 | 27 | } |
| 28 | 28 | } |
@@ -52,8 +52,9 @@ |
||
| 52 | 52 | */ |
| 53 | 53 | static function get($clean = false) |
| 54 | 54 | { |
| 55 | - if (empty($_SESSION['_INJI_MSG'])) |
|
| 56 | - return []; |
|
| 55 | + if (empty($_SESSION['_INJI_MSG'])) { |
|
| 56 | + return []; |
|
| 57 | + } |
|
| 57 | 58 | $msgs = $_SESSION['_INJI_MSG']; |
| 58 | 59 | if ($clean) { |
| 59 | 60 | $_SESSION['_INJI_MSG'] = []; |
@@ -58,8 +58,9 @@ discard block |
||
| 58 | 58 | */ |
| 59 | 59 | static function createDir($path) |
| 60 | 60 | { |
| 61 | - if (file_exists($path)) |
|
| 62 | - return true; |
|
| 61 | + if (file_exists($path)) { |
|
| 62 | + return true; |
|
| 63 | + } |
|
| 63 | 64 | |
| 64 | 65 | $path = explode('/', $path); |
| 65 | 66 | $cur = ''; |
@@ -101,10 +102,11 @@ discard block |
||
| 101 | 102 | $imagecreatefromX = "imagecreatefrom{$img_type}"; |
| 102 | 103 | $src_res = $imagecreatefromX($img_path); |
| 103 | 104 | |
| 104 | - if ($img_width / $max_width > $img_height / $max_height) |
|
| 105 | - $separator = $img_width / $max_width; |
|
| 106 | - else |
|
| 107 | - $separator = $img_height / $max_height; |
|
| 105 | + if ($img_width / $max_width > $img_height / $max_height) { |
|
| 106 | + $separator = $img_width / $max_width; |
|
| 107 | + } else { |
|
| 108 | + $separator = $img_height / $max_height; |
|
| 109 | + } |
|
| 108 | 110 | |
| 109 | 111 | if ($crop === true || $crop == 'q') { |
| 110 | 112 | if ($img_width > $img_height) { |
@@ -38,7 +38,7 @@ discard block |
||
| 38 | 38 | public static function uriParse($uri) |
| 39 | 39 | { |
| 40 | 40 | $answerPos = strpos($uri, '?'); |
| 41 | - $params = array_slice(explode('/', substr($uri, 0, $answerPos ? $answerPos : strlen($uri) )), 1); |
|
| 41 | + $params = array_slice(explode('/', substr($uri, 0, $answerPos ? $answerPos : strlen($uri))), 1); |
|
| 42 | 42 | |
| 43 | 43 | foreach ($params as $key => $param) { |
| 44 | 44 | if ($param != '') { |
@@ -64,7 +64,7 @@ discard block |
||
| 64 | 64 | $path = explode('/', $path); |
| 65 | 65 | $cur = ''; |
| 66 | 66 | foreach ($path as $item) { |
| 67 | - $cur .= $item . '/'; |
|
| 67 | + $cur .= $item.'/'; |
|
| 68 | 68 | if (!file_exists($cur)) { |
| 69 | 69 | mkdir($cur); |
| 70 | 70 | } |
@@ -85,7 +85,7 @@ discard block |
||
| 85 | 85 | public static function resizeImage($img_path, $max_width = 1000, $max_height = 1000, $crop = false, $pos = 'center') |
| 86 | 86 | { |
| 87 | 87 | ini_set("gd.jpeg_ignore_warning", 1); |
| 88 | - list( $img_width, $img_height, $img_type, $img_tag ) = getimagesize($img_path); |
|
| 88 | + list($img_width, $img_height, $img_type, $img_tag) = getimagesize($img_path); |
|
| 89 | 89 | switch ($img_type) { |
| 90 | 90 | case 1: |
| 91 | 91 | $img_type = 'gif'; |
@@ -108,14 +108,14 @@ discard block |
||
| 108 | 108 | |
| 109 | 109 | if ($crop === true || $crop == 'q') { |
| 110 | 110 | if ($img_width > $img_height) { |
| 111 | - $imgX = floor(( $img_width - $img_height ) / 2); |
|
| 111 | + $imgX = floor(($img_width - $img_height) / 2); |
|
| 112 | 112 | $imgY = 0; |
| 113 | 113 | $img_width = $img_height; |
| 114 | 114 | $new_width = $max_width; |
| 115 | 115 | $new_height = $max_height; |
| 116 | 116 | } else { |
| 117 | 117 | $imgX = 0; |
| 118 | - $imgY = floor(( $img_height - $img_width ) / 2); |
|
| 118 | + $imgY = floor(($img_height - $img_width) / 2); |
|
| 119 | 119 | $img_height = $img_width; |
| 120 | 120 | $new_width = $max_width; |
| 121 | 121 | $new_height = $max_height; |
@@ -136,7 +136,7 @@ discard block |
||
| 136 | 136 | $new_width = $max_width; |
| 137 | 137 | $new_height = $max_height; |
| 138 | 138 | //Находим начальные координаты (центрируем новое изображение) |
| 139 | - $imgX = (int) (($ow / 2) - ($img_width / 2) ); |
|
| 139 | + $imgX = (int) (($ow / 2) - ($img_width / 2)); |
|
| 140 | 140 | if ($pos == 'center') { |
| 141 | 141 | $imgY = (int) (($oh / 2) - ($img_height / 2)); |
| 142 | 142 | } else { |
@@ -206,7 +206,7 @@ discard block |
||
| 206 | 206 | if (!headers_sent()) { |
| 207 | 207 | header("Location: {$href}"); |
| 208 | 208 | } else { |
| 209 | - echo '\'"><script>window.location="' . $href . '";</script>'; |
|
| 209 | + echo '\'"><script>window.location="'.$href.'";</script>'; |
|
| 210 | 210 | } |
| 211 | 211 | exit("Перенаправление на: <a href = '{$href}'>{$href}</a>"); |
| 212 | 212 | } |
@@ -266,7 +266,7 @@ discard block |
||
| 266 | 266 | $pathArray = $cleanPathArray; |
| 267 | 267 | $cleanPathArray = []; |
| 268 | 268 | } while ($changes); |
| 269 | - return (strpos($path, '/') === 0 ? '/' : '') . implode('/', $pathArray); |
|
| 269 | + return (strpos($path, '/') === 0 ? '/' : '').implode('/', $pathArray); |
|
| 270 | 270 | } |
| 271 | 271 | |
| 272 | 272 | /** |
@@ -287,7 +287,7 @@ discard block |
||
| 287 | 287 | if (empty($month[$mm - 1])) { |
| 288 | 288 | return 'Не указано'; |
| 289 | 289 | } |
| 290 | - return ($dd > 0 ? $dd . " " : '') . $month[$mm - 1] . " " . $yy . " " . $hours; |
|
| 290 | + return ($dd > 0 ? $dd." " : '').$month[$mm - 1]." ".$yy." ".$hours; |
|
| 291 | 291 | } |
| 292 | 292 | |
| 293 | 293 | /** |
@@ -369,10 +369,10 @@ discard block |
||
| 369 | 369 | if (in_array($file, ['.', '..'])) { |
| 370 | 370 | continue; |
| 371 | 371 | } |
| 372 | - if (is_dir($from . '/' . $file)) { |
|
| 373 | - self::copyFiles($from . '/' . $file, $to . '/' . $file); |
|
| 372 | + if (is_dir($from.'/'.$file)) { |
|
| 373 | + self::copyFiles($from.'/'.$file, $to.'/'.$file); |
|
| 374 | 374 | } else { |
| 375 | - copy($from . '/' . $file, $to . '/' . $file); |
|
| 375 | + copy($from.'/'.$file, $to.'/'.$file); |
|
| 376 | 376 | } |
| 377 | 377 | } |
| 378 | 378 | } |
@@ -15,8 +15,9 @@ discard block |
||
| 15 | 15 | if (!$app) { |
| 16 | 16 | $app = $this->app->type; |
| 17 | 17 | } |
| 18 | - if (!empty($this->config['access']['accessTree'][$app]['deniedUrl'])) |
|
| 19 | - return $this->config['access']['accessTree'][$app]['deniedUrl']; |
|
| 18 | + if (!empty($this->config['access']['accessTree'][$app]['deniedUrl'])) { |
|
| 19 | + return $this->config['access']['accessTree'][$app]['deniedUrl']; |
|
| 20 | + } |
|
| 20 | 21 | |
| 21 | 22 | return '/'; |
| 22 | 23 | } |
@@ -50,8 +51,9 @@ discard block |
||
| 50 | 51 | return true; |
| 51 | 52 | } |
| 52 | 53 | |
| 53 | - if ((!$user->group_id && !empty($access)) || ($user->group_id && !empty($access) && !in_array($user->group_id, $access))) |
|
| 54 | - return false; |
|
| 54 | + if ((!$user->group_id && !empty($access)) || ($user->group_id && !empty($access) && !in_array($user->group_id, $access))) { |
|
| 55 | + return false; |
|
| 56 | + } |
|
| 55 | 57 | |
| 56 | 58 | return true; |
| 57 | 59 | } |
@@ -16,8 +16,9 @@ |
||
| 16 | 16 | $param = isset($this->config['default']) ? $this->config['default'] : 'local'; |
| 17 | 17 | } |
| 18 | 18 | if (!is_array($param)) { |
| 19 | - if (!($dbOption = Db\Options::get($param, 'connect_alias', ['array' => true]))) |
|
| 20 | - return false; |
|
| 19 | + if (!($dbOption = Db\Options::get($param, 'connect_alias', ['array' => true]))) { |
|
| 20 | + return false; |
|
| 21 | + } |
|
| 21 | 22 | |
| 22 | 23 | $db = $dbOption; |
| 23 | 24 | } else { |
@@ -23,16 +23,16 @@ discard block |
||
| 23 | 23 | } else { |
| 24 | 24 | $db = $param; |
| 25 | 25 | } |
| 26 | - $className = 'Db\\' . $db['driver']; |
|
| 26 | + $className = 'Db\\'.$db['driver']; |
|
| 27 | 27 | $this->connection = new $className(); |
| 28 | 28 | $this->connection->init($db); |
| 29 | 29 | $this->connection->dbInstance = $this; |
| 30 | 30 | $this->connect = $this->connection->connect; |
| 31 | 31 | $this->dbConfig = $db; |
| 32 | 32 | |
| 33 | - $this->className = 'Db\\' . $this->dbConfig['driver']; |
|
| 34 | - $this->QueryClassName = 'Db\\' . $this->dbConfig['driver'] . '\\Query'; |
|
| 35 | - $this->ResultClassName = 'Db\\' . $this->dbConfig['driver'] . '\\Result'; |
|
| 33 | + $this->className = 'Db\\'.$this->dbConfig['driver']; |
|
| 34 | + $this->QueryClassName = 'Db\\'.$this->dbConfig['driver'].'\\Query'; |
|
| 35 | + $this->ResultClassName = 'Db\\'.$this->dbConfig['driver'].'\\Result'; |
|
| 36 | 36 | } |
| 37 | 37 | |
| 38 | 38 | public function __call($name, $params) |
@@ -55,7 +55,7 @@ discard block |
||
| 55 | 55 | |
| 56 | 56 | public function newQuery() |
| 57 | 57 | { |
| 58 | - if($this->QueryClassName) { |
|
| 58 | + if ($this->QueryClassName) { |
|
| 59 | 59 | return new $this->QueryClassName($this->connection); |
| 60 | 60 | } |
| 61 | 61 | return false; |
@@ -30,14 +30,18 @@ |
||
| 30 | 30 | public function init($connect_options) |
| 31 | 31 | { |
| 32 | 32 | extract($connect_options); |
| 33 | - if (isset($db_name)) |
|
| 34 | - $this->db_name = $db_name; |
|
| 35 | - if (isset($encoding)) |
|
| 36 | - $this->encoding = $encoding; |
|
| 37 | - if (isset($table_prefix)) |
|
| 38 | - $this->table_prefix = $table_prefix; |
|
| 39 | - if (isset($noConnectAbort)) |
|
| 40 | - $this->noConnectAbort = $noConnectAbort; |
|
| 33 | + if (isset($db_name)) { |
|
| 34 | + $this->db_name = $db_name; |
|
| 35 | + } |
|
| 36 | + if (isset($encoding)) { |
|
| 37 | + $this->encoding = $encoding; |
|
| 38 | + } |
|
| 39 | + if (isset($table_prefix)) { |
|
| 40 | + $this->table_prefix = $table_prefix; |
|
| 41 | + } |
|
| 42 | + if (isset($noConnectAbort)) { |
|
| 43 | + $this->noConnectAbort = $noConnectAbort; |
|
| 44 | + } |
|
| 41 | 45 | |
| 42 | 46 | $dsn = "mysql:host=$host;port=$port;dbname=$db_name;charset=$encoding"; |
| 43 | 47 | $dt = new \DateTime(); |
@@ -13,11 +13,11 @@ discard block |
||
| 13 | 13 | |
| 14 | 14 | class Mysql extends \Object |
| 15 | 15 | { |
| 16 | - public $config = []; // настройки подключения выбраной базы |
|
| 17 | - public $connect = FALSE; // ярлык соединения с MySQL |
|
| 18 | - public $encoding = 'utf-8'; // установленная кодировка |
|
| 19 | - public $db_name = 'test'; // выбраная в данный момент база |
|
| 20 | - public $table_prefix = 'inji_'; // префикс названий таблиц |
|
| 16 | + public $config = []; // настройки подключения выбраной базы |
|
| 17 | + public $connect = FALSE; // ярлык соединения с MySQL |
|
| 18 | + public $encoding = 'utf-8'; // установленная кодировка |
|
| 19 | + public $db_name = 'test'; // выбраная в данный момент база |
|
| 20 | + public $table_prefix = 'inji_'; // префикс названий таблиц |
|
| 21 | 21 | public $pdo = NULL; |
| 22 | 22 | public $lastQuery = ''; |
| 23 | 23 | public $last_error = ''; |
@@ -71,7 +71,7 @@ discard block |
||
| 71 | 71 | $this->table_prefix = ''; |
| 72 | 72 | |
| 73 | 73 | $query->where('TABLE_SCHEMA', $old_db); |
| 74 | - $query->where('TABLE_NAME', $old_prefix . $table_name); |
|
| 74 | + $query->where('TABLE_NAME', $old_prefix.$table_name); |
|
| 75 | 75 | $result = $query->select('COLUMNS'); |
| 76 | 76 | $this->db_name = $old_db; |
| 77 | 77 | $this->table_prefix = $old_prefix; |
@@ -39,7 +39,7 @@ |
||
| 39 | 39 | static $forms = [ |
| 40 | 40 | 'manager' => [ |
| 41 | 41 | 'map' => [ |
| 42 | - ['price', 'currency_id',], |
|
| 42 | + ['price', 'currency_id', ], |
|
| 43 | 43 | ['item_offer_price_type_id', 'item_offer_id'] |
| 44 | 44 | ] |
| 45 | 45 | ]]; |
@@ -22,16 +22,19 @@ discard block |
||
| 22 | 22 | |
| 23 | 23 | $sitePath = App::$primary->path; |
| 24 | 24 | |
| 25 | - if (!is_uploaded_file($file['tmp_name'])) |
|
| 26 | - return 0; |
|
| 25 | + if (!is_uploaded_file($file['tmp_name'])) { |
|
| 26 | + return 0; |
|
| 27 | + } |
|
| 27 | 28 | |
| 28 | 29 | $fileinfo = pathinfo($file['name']); |
| 29 | - if (empty($fileinfo['extension'])) |
|
| 30 | - return 0; |
|
| 30 | + if (empty($fileinfo['extension'])) { |
|
| 31 | + return 0; |
|
| 32 | + } |
|
| 31 | 33 | |
| 32 | 34 | $type = Files\Type::get($fileinfo['extension'], 'ext'); |
| 33 | - if (!$type) |
|
| 34 | - return 0; |
|
| 35 | + if (!$type) { |
|
| 36 | + return 0; |
|
| 37 | + } |
|
| 35 | 38 | |
| 36 | 39 | if (!empty($options['accept_group']) && $options['accept_group'] != $type->group) { |
| 37 | 40 | return 0; |
@@ -47,13 +50,15 @@ discard block |
||
| 47 | 50 | } |
| 48 | 51 | $fileObject->name = $fileinfo['filename']; |
| 49 | 52 | $fileObject->path = $type->type_dir . date('Y-m-d') . '/' . microtime(true) . '.' . $fileinfo['extension']; |
| 50 | - if ($fileObject->id && file_exists($sitePath . $fileObject->path)) |
|
| 51 | - unlink($sitePath . $fileObject->path); |
|
| 53 | + if ($fileObject->id && file_exists($sitePath . $fileObject->path)) { |
|
| 54 | + unlink($sitePath . $fileObject->path); |
|
| 55 | + } |
|
| 52 | 56 | |
| 53 | 57 | Tools::createDir($sitePath . $type->type_dir . date('Y-m-d') . '/'); |
| 54 | 58 | |
| 55 | - if (!move_uploaded_file($file['tmp_name'], $sitePath . $fileObject->path)) |
|
| 56 | - return false; |
|
| 59 | + if (!move_uploaded_file($file['tmp_name'], $sitePath . $fileObject->path)) { |
|
| 60 | + return false; |
|
| 61 | + } |
|
| 57 | 62 | |
| 58 | 63 | $fileObject->type_id = $type->pk(); |
| 59 | 64 | $fileObject->original_name = $file['name']; |
@@ -76,12 +81,14 @@ discard block |
||
| 76 | 81 | $sitePath = App::$primary->path; |
| 77 | 82 | |
| 78 | 83 | $fileinfo = pathinfo($url); |
| 79 | - if (empty($fileinfo['extension'])) |
|
| 80 | - return 0; |
|
| 84 | + if (empty($fileinfo['extension'])) { |
|
| 85 | + return 0; |
|
| 86 | + } |
|
| 81 | 87 | |
| 82 | 88 | $type = Files\Type::get($fileinfo['extension'], 'ext'); |
| 83 | - if (!$type) |
|
| 84 | - return 0; |
|
| 89 | + if (!$type) { |
|
| 90 | + return 0; |
|
| 91 | + } |
|
| 85 | 92 | |
| 86 | 93 | if (!empty($options['accept_group']) && $options['accept_group'] != $type->group) { |
| 87 | 94 | return 0; |
@@ -97,8 +104,9 @@ discard block |
||
| 97 | 104 | } |
| 98 | 105 | $fileObject->name = $fileinfo['filename']; |
| 99 | 106 | $fileObject->path = $type->type_dir . date('Y-m-d') . '/' . microtime(true) . '.' . $fileinfo['extension']; |
| 100 | - if ($fileObject->id && file_exists($sitePath . $fileObject->path)) |
|
| 101 | - unlink($sitePath . $fileObject->path); |
|
| 107 | + if ($fileObject->id && file_exists($sitePath . $fileObject->path)) { |
|
| 108 | + unlink($sitePath . $fileObject->path); |
|
| 109 | + } |
|
| 102 | 110 | |
| 103 | 111 | Tools::createDir($sitePath . $type->type_dir . date('Y-m-d') . '/'); |
| 104 | 112 | |
@@ -46,13 +46,13 @@ discard block |
||
| 46 | 46 | } |
| 47 | 47 | } |
| 48 | 48 | $fileObject->name = $fileinfo['filename']; |
| 49 | - $fileObject->path = $type->type_dir . date('Y-m-d') . '/' . microtime(true) . '.' . $fileinfo['extension']; |
|
| 50 | - if ($fileObject->id && file_exists($sitePath . $fileObject->path)) |
|
| 51 | - unlink($sitePath . $fileObject->path); |
|
| 49 | + $fileObject->path = $type->type_dir.date('Y-m-d').'/'.microtime(true).'.'.$fileinfo['extension']; |
|
| 50 | + if ($fileObject->id && file_exists($sitePath.$fileObject->path)) |
|
| 51 | + unlink($sitePath.$fileObject->path); |
|
| 52 | 52 | |
| 53 | - Tools::createDir($sitePath . $type->type_dir . date('Y-m-d') . '/'); |
|
| 53 | + Tools::createDir($sitePath.$type->type_dir.date('Y-m-d').'/'); |
|
| 54 | 54 | |
| 55 | - if (!move_uploaded_file($file['tmp_name'], $sitePath . $fileObject->path)) |
|
| 55 | + if (!move_uploaded_file($file['tmp_name'], $sitePath.$fileObject->path)) |
|
| 56 | 56 | return false; |
| 57 | 57 | |
| 58 | 58 | $fileObject->type_id = $type->pk(); |
@@ -96,17 +96,17 @@ discard block |
||
| 96 | 96 | } |
| 97 | 97 | } |
| 98 | 98 | $fileObject->name = $fileinfo['filename']; |
| 99 | - $fileObject->path = $type->type_dir . date('Y-m-d') . '/' . microtime(true) . '.' . $fileinfo['extension']; |
|
| 100 | - if ($fileObject->id && file_exists($sitePath . $fileObject->path)) |
|
| 101 | - unlink($sitePath . $fileObject->path); |
|
| 99 | + $fileObject->path = $type->type_dir.date('Y-m-d').'/'.microtime(true).'.'.$fileinfo['extension']; |
|
| 100 | + if ($fileObject->id && file_exists($sitePath.$fileObject->path)) |
|
| 101 | + unlink($sitePath.$fileObject->path); |
|
| 102 | 102 | |
| 103 | - Tools::createDir($sitePath . $type->type_dir . date('Y-m-d') . '/'); |
|
| 103 | + Tools::createDir($sitePath.$type->type_dir.date('Y-m-d').'/'); |
|
| 104 | 104 | |
| 105 | 105 | $file = @file_get_contents($url); |
| 106 | 106 | if ($file === false) { |
| 107 | 107 | return 0; |
| 108 | 108 | } |
| 109 | - file_put_contents($sitePath . $fileObject->path, $file); |
|
| 109 | + file_put_contents($sitePath.$fileObject->path, $file); |
|
| 110 | 110 | |
| 111 | 111 | $fileObject->type_id = $type->pk(); |
| 112 | 112 | $fileObject->original_name = $fileinfo['basename']; |