Completed
Push — master ( f8c7e1...7855c2 )
by Alexey
06:00
created
system/modules/Access/Access.php 1 patch
Braces   +6 added lines, -4 removed lines patch added patch discarded remove patch
@@ -15,8 +15,9 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
     }
Please login to merge, or discard this patch.
system/modules/Callbacks/appControllers/content/index.php 2 patches
Indentation   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -1,12 +1,12 @@
 block discarded – undo
1 1
 <div class = 'callbacks'>
2 2
   <h1>Отзывы</h1>
3 3
   <?php
4
-  $callbacks = Callbacks\Callback::getList(['where' => ['view', '1'], 'order' => ['weight', 'asc']]);
5
-  foreach ($callbacks as $callback) {
6
-      echo "<h3>{$callback->name}<div class = 'time'>{$callback->date_create}</div></h3>";
7
-      echo "<p>" . nl2br($callback->text) . "</p>";
8
-  }
9
-  ?>
4
+    $callbacks = Callbacks\Callback::getList(['where' => ['view', '1'], 'order' => ['weight', 'asc']]);
5
+    foreach ($callbacks as $callback) {
6
+        echo "<h3>{$callback->name}<div class = 'time'>{$callback->date_create}</div></h3>";
7
+        echo "<p>" . nl2br($callback->text) . "</p>";
8
+    }
9
+    ?>
10 10
 </div>
11 11
 <h3>Можете и вы в свободной форме оставить свой отзыв</h3>
12 12
 <?php
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -4,7 +4,7 @@
 block discarded – undo
4 4
   $callbacks = Callbacks\Callback::getList(['where' => ['view', '1'], 'order' => ['weight', 'asc']]);
5 5
   foreach ($callbacks as $callback) {
6 6
       echo "<h3>{$callback->name}<div class = 'time'>{$callback->date_create}</div></h3>";
7
-      echo "<p>" . nl2br($callback->text) . "</p>";
7
+      echo "<p>".nl2br($callback->text)."</p>";
8 8
   }
9 9
   ?>
10 10
 </div>
Please login to merge, or discard this patch.
system/modules/Dashboard/appAdminControllers/content/siteConfig.php 2 patches
Indentation   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -17,9 +17,9 @@
 block discarded – undo
17 17
     <input class ="form-control" type = 'text' name = 'site_description' value = '<?php if (!empty(\App::$primary->config['site']['description'])) echo \App::$primary->config['site']['description']; ?>' />
18 18
   </div>
19 19
   <?php
20
-  $form = new Ui\Form();
21
-  $form->input('image', 'site_logo', 'Лого сайта', ['value' => !empty(\App::$primary->config['site']['site_logo']) ? \App::$primary->config['site']['site_logo'] : '']);
22
-  ?>
20
+    $form = new Ui\Form();
21
+    $form->input('image', 'site_logo', 'Лого сайта', ['value' => !empty(\App::$primary->config['site']['site_logo']) ? \App::$primary->config['site']['site_logo'] : '']);
22
+    ?>
23 23
   <h2>Дополнительные мета теги</h2>
24 24
   <div class ="form-group">
25 25
     <button type = 'button' class = 'btn btn-primary ' onclick = 'addMeta()'>Добавить <i class = 'glyphicon glyphicon-plus'></i></button>
Please login to merge, or discard this patch.
Braces   +24 added lines, -6 removed lines patch added patch discarded remove patch
@@ -2,27 +2,45 @@
 block discarded – undo
2 2
 <form action = '' method = 'POST' enctype="multipart/form-data">
3 3
   <div class ="form-group">
4 4
     <label>Название сайта</label>
5
-    <input class ="form-control" type = 'text' name = 'site_name' value = '<?php if (!empty(\App::$primary->config['site']['name'])) echo \App::$primary->config['site']['name']; ?>' />
5
+    <input class ="form-control" type = 'text' name = 'site_name' value = '<?php if (!empty(\App::$primary->config['site']['name'])) {
6
+    echo \App::$primary->config['site']['name'];
7
+}
8
+?>' />
6 9
   </div>
7 10
   <div class ="form-group">
8 11
     <label>Название компании</label>
9
-    <input class ="form-control" type = 'text' name = 'company_name' value = '<?php if (!empty(\App::$primary->config['site']['company_name'])) echo \App::$primary->config['site']['company_name']; ?>' />
12
+    <input class ="form-control" type = 'text' name = 'company_name' value = '<?php if (!empty(\App::$primary->config['site']['company_name'])) {
13
+    echo \App::$primary->config['site']['company_name'];
14
+}
15
+?>' />
10 16
   </div>
11 17
   <div class ="form-group">
12 18
     <label>Основной домен</label>
13
-    <input class ="form-control" type = 'text' name = 'site_domain' value = '<?php if (!empty(\App::$primary->config['site']['domain'])) echo \App::$primary->config['site']['domain']; ?>' />
19
+    <input class ="form-control" type = 'text' name = 'site_domain' value = '<?php if (!empty(\App::$primary->config['site']['domain'])) {
20
+    echo \App::$primary->config['site']['domain'];
21
+}
22
+?>' />
14 23
   </div>
15 24
   <div class ="form-group">
16 25
     <label>Контактный email</label>
17
-    <input class ="form-control" type = 'text' name = 'site_email' value = '<?php if (!empty(\App::$primary->config['site']['email'])) echo \App::$primary->config['site']['email']; ?>' />
26
+    <input class ="form-control" type = 'text' name = 'site_email' value = '<?php if (!empty(\App::$primary->config['site']['email'])) {
27
+    echo \App::$primary->config['site']['email'];
28
+}
29
+?>' />
18 30
   </div>
19 31
   <div class ="form-group">
20 32
     <label>Ключевые слова</label>
21
-    <input class ="form-control" type = 'text' name = 'site_keywords' value = '<?php if (!empty(\App::$primary->config['site']['keywords'])) echo \App::$primary->config['site']['keywords']; ?>' />
33
+    <input class ="form-control" type = 'text' name = 'site_keywords' value = '<?php if (!empty(\App::$primary->config['site']['keywords'])) {
34
+    echo \App::$primary->config['site']['keywords'];
35
+}
36
+?>' />
22 37
   </div>
23 38
   <div class ="form-group">
24 39
     <label>Краткое описание сайта</label>
25
-    <input class ="form-control" type = 'text' name = 'site_description' value = '<?php if (!empty(\App::$primary->config['site']['description'])) echo \App::$primary->config['site']['description']; ?>' />
40
+    <input class ="form-control" type = 'text' name = 'site_description' value = '<?php if (!empty(\App::$primary->config['site']['description'])) {
41
+    echo \App::$primary->config['site']['description'];
42
+}
43
+?>' />
26 44
   </div>
27 45
   <?php
28 46
   $form = new Ui\Form();
Please login to merge, or discard this patch.
system/modules/Db/Db.php 2 patches
Braces   +3 added lines, -2 removed lines patch added patch discarded remove patch
@@ -16,8 +16,9 @@
 block discarded – undo
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 {
Please login to merge, or discard this patch.
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -23,16 +23,16 @@  discard block
 block discarded – undo
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
 block discarded – undo
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;
Please login to merge, or discard this patch.
system/modules/Ecommerce/appAdminControllers/content/configure.php 2 patches
Indentation   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -3,14 +3,14 @@  discard block
 block discarded – undo
3 3
 <ul class="nav nav-tabs" role="tablist">
4 4
   <li role="presentation" class="active"><a href="#home" aria-controls="home" role="tab" data-toggle="tab">Настройки</a></li>
5 5
   <?php
6
-  $dataManagers = [];
7
-  foreach ($managers as $manager) {
8
-      $dataManager = new Ui\DataManager($manager);
9
-      $dataManagers[$manager] = $dataManager;
10
-      $code = 'tab_' . str_replace('\\', '_', $manager);
11
-      echo "<li role='presentation'><a href='#{$code}' aria-controls='{$code}' role='tab' data-toggle='tab'>{$dataManager->name}</a></li>";
12
-  }
13
-  ?>
6
+    $dataManagers = [];
7
+    foreach ($managers as $manager) {
8
+        $dataManager = new Ui\DataManager($manager);
9
+        $dataManagers[$manager] = $dataManager;
10
+        $code = 'tab_' . str_replace('\\', '_', $manager);
11
+        echo "<li role='presentation'><a href='#{$code}' aria-controls='{$code}' role='tab' data-toggle='tab'>{$dataManager->name}</a></li>";
12
+    }
13
+    ?>
14 14
 </ul>
15 15
 <div class="tab-content">
16 16
   <div role="tabpanel" class="tab-pane fade in active" id="home">
@@ -52,17 +52,17 @@  discard block
 block discarded – undo
52 52
     </script>
53 53
   </div>
54 54
   <?php
55
-  foreach ($dataManagers as $manager => $dataManager) {
56
-      $code = 'tab_' . str_replace('\\', '_', $manager);
57
-      ?>
55
+    foreach ($dataManagers as $manager => $dataManager) {
56
+        $code = 'tab_' . str_replace('\\', '_', $manager);
57
+        ?>
58 58
       <div role="tabpanel" class="tab-pane fade" id="<?= $code; ?>">
59 59
         <?php
60 60
         $dataManager->draw();
61 61
         ?>
62 62
       </div>
63 63
       <?php
64
-  }
65
-  ?>
64
+    }
65
+    ?>
66 66
 </div>
67 67
 
68 68
 
Please login to merge, or discard this patch.
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -7,7 +7,7 @@  discard block
 block discarded – undo
7 7
   foreach ($managers as $manager) {
8 8
       $dataManager = new Ui\DataManager($manager);
9 9
       $dataManagers[$manager] = $dataManager;
10
-      $code = 'tab_' . str_replace('\\', '_', $manager);
10
+      $code = 'tab_'.str_replace('\\', '_', $manager);
11 11
       echo "<li role='presentation'><a href='#{$code}' aria-controls='{$code}' role='tab' data-toggle='tab'>{$dataManager->name}</a></li>";
12 12
   }
13 13
   ?>
@@ -54,7 +54,7 @@  discard block
 block discarded – undo
54 54
   </div>
55 55
   <?php
56 56
   foreach ($dataManagers as $manager => $dataManager) {
57
-      $code = 'tab_' . str_replace('\\', '_', $manager);
57
+      $code = 'tab_'.str_replace('\\', '_', $manager);
58 58
       ?>
59 59
       <div role="tabpanel" class="tab-pane fade" id="<?= $code; ?>">
60 60
         <?php
Please login to merge, or discard this patch.
system/modules/Ecommerce/appControllers/content/buyCard.php 1 patch
Indentation   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -50,12 +50,12 @@
 block discarded – undo
50 50
                       <td>
51 51
                         <ul>
52 52
                           <?php
53
-                          foreach ($card->levels as $level) {
54
-                              ?>
53
+                            foreach ($card->levels as $level) {
54
+                                ?>
55 55
                               <li><?= $level->name; ?> - <?= $level->discount->name; ?></li>
56 56
                               <?php
57
-                          }
58
-                          ?>
57
+                            }
58
+                            ?>
59 59
                         </ul>
60 60
                       </td>
61 61
                       <td>
Please login to merge, or discard this patch.
system/modules/Ecommerce/models/Item/Offer/Price.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -39,7 +39,7 @@
 block discarded – undo
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
     ]];
Please login to merge, or discard this patch.
system/modules/Ecommerce/widgets/cart/history.php 2 patches
Indentation   +71 added lines, -71 removed lines patch added patch discarded remove patch
@@ -19,87 +19,87 @@  discard block
 block discarded – undo
19 19
     </thead>
20 20
     <tbody>
21 21
       <?php
22
-      foreach ($carts as $cart) {
23
-          $sums = [];
24
-          foreach ($cart->cartItems as $cartItem) {
25
-              $currency_id = $cartItem->price && $cartItem->price->currency ? $cartItem->price->currency->id : (!empty(\App::$cur->ecommerce->config['defaultCurrency']) ? \App::$cur->ecommerce->config['defaultCurrency'] : 0);
26
-              if (empty($sums[$currency_id])) {
27
-                  $sums[$currency_id] = $cartItem->final_price * $cartItem->count;
28
-              } else {
29
-                  $sums[$currency_id] += $cartItem->final_price * $cartItem->count;
30
-              }
31
-          }
32
-          if ($cart->delivery && $cart->delivery->price) {
33
-              $currency_id = $cart->delivery->currency_id;
34
-              if (empty($sums[$currency_id])) {
35
-                  $sums[$currency_id] = $cart->delivery->price;
36
-              } else {
37
-                  $sums[$currency_id] += $cart->delivery->price;
38
-              }
39
-          }
40
-          foreach ($cart->extras as $extra) {
41
-              $currency_id = $extra->currency ? $extra->currency->id : \App::$cur->ecommerce->config['defaultCurrency'];
42
-              if (empty($sums[$currency_id])) {
43
-                  $sums[$currency_id] = $extra->price * $extra->count;
44
-              } else {
45
-                  $sums[$currency_id] += $extra->price * $extra->count;
46
-              }
47
-          }
48
-          ?>
22
+        foreach ($carts as $cart) {
23
+            $sums = [];
24
+            foreach ($cart->cartItems as $cartItem) {
25
+                $currency_id = $cartItem->price && $cartItem->price->currency ? $cartItem->price->currency->id : (!empty(\App::$cur->ecommerce->config['defaultCurrency']) ? \App::$cur->ecommerce->config['defaultCurrency'] : 0);
26
+                if (empty($sums[$currency_id])) {
27
+                    $sums[$currency_id] = $cartItem->final_price * $cartItem->count;
28
+                } else {
29
+                    $sums[$currency_id] += $cartItem->final_price * $cartItem->count;
30
+                }
31
+            }
32
+            if ($cart->delivery && $cart->delivery->price) {
33
+                $currency_id = $cart->delivery->currency_id;
34
+                if (empty($sums[$currency_id])) {
35
+                    $sums[$currency_id] = $cart->delivery->price;
36
+                } else {
37
+                    $sums[$currency_id] += $cart->delivery->price;
38
+                }
39
+            }
40
+            foreach ($cart->extras as $extra) {
41
+                $currency_id = $extra->currency ? $extra->currency->id : \App::$cur->ecommerce->config['defaultCurrency'];
42
+                if (empty($sums[$currency_id])) {
43
+                    $sums[$currency_id] = $extra->price * $extra->count;
44
+                } else {
45
+                    $sums[$currency_id] += $extra->price * $extra->count;
46
+                }
47
+            }
48
+            ?>
49 49
           <tr>
50 50
             <td class="text-right">#<?= $cart->id; ?></td>
51 51
             <td class="text-left"><?= $cart->status ? $cart->status->name : 'Наполняется'; ?></td>
52 52
             <td class="text-right"><?= count($cart->cartItems); ?></td>
53 53
             <td class="text-right"><?php
54
-              if ($sums) {
55
-                  foreach ($sums as $currency_id => $sum) {
56
-                      if (!$sum) {
57
-                          continue;
58
-                      }
59
-                      echo number_format($sum, 2, '.', ' ');
60
-                      if (App::$cur->money) {
61
-                          $currency = Money\Currency::get($currency_id);
62
-                          if ($currency) {
63
-                              echo '&nbsp;' . $currency->acronym();
64
-                          } else {
65
-                              echo '&nbsp;р.';
66
-                          }
67
-                      } else {
68
-                          echo '&nbsp;р.';
69
-                      }
70
-                      echo '<br />';
71
-                  }
72
-              }
73
-              ?></td>
54
+                if ($sums) {
55
+                    foreach ($sums as $currency_id => $sum) {
56
+                        if (!$sum) {
57
+                            continue;
58
+                        }
59
+                        echo number_format($sum, 2, '.', ' ');
60
+                        if (App::$cur->money) {
61
+                            $currency = Money\Currency::get($currency_id);
62
+                            if ($currency) {
63
+                                echo '&nbsp;' . $currency->acronym();
64
+                            } else {
65
+                                echo '&nbsp;р.';
66
+                            }
67
+                        } else {
68
+                            echo '&nbsp;р.';
69
+                        }
70
+                        echo '<br />';
71
+                    }
72
+                }
73
+                ?></td>
74 74
             <td class="text-left"><?= $cart->complete_data; ?></td>
75 75
             <td><?php
76
-              if ($cart->payed) {
77
-                  echo 'Оплачено';
78
-              } elseif (!App::$cur->money) {
79
-                  echo 'Не оплачено';
80
-              } else {
81
-                  $handlers = App::$cur->ecommerce->getSnippets('payTypeHandler');
82
-                  $redirect = ['/ecommerce/cart/success'];
83
-                  if ($cart->payType && !empty($handlers[$cart->payType->handler]['handler'])) {
84
-                      $newRedirect = $handlers[$cart->payType->handler]['handler']($cart);
85
-                  }
86
-                  if (!empty($newRedirect[0])) {
87
-                      echo '<a class="btn btn-warning btn-sm" href = "' . $newRedirect[0] . '">Оплатить</a>';
88
-                  } else {
89
-                      echo 'Не оплачено';
90
-                  }
91
-              }
92
-              ?></td>
76
+                if ($cart->payed) {
77
+                    echo 'Оплачено';
78
+                } elseif (!App::$cur->money) {
79
+                    echo 'Не оплачено';
80
+                } else {
81
+                    $handlers = App::$cur->ecommerce->getSnippets('payTypeHandler');
82
+                    $redirect = ['/ecommerce/cart/success'];
83
+                    if ($cart->payType && !empty($handlers[$cart->payType->handler]['handler'])) {
84
+                        $newRedirect = $handlers[$cart->payType->handler]['handler']($cart);
85
+                    }
86
+                    if (!empty($newRedirect[0])) {
87
+                        echo '<a class="btn btn-warning btn-sm" href = "' . $newRedirect[0] . '">Оплатить</a>';
88
+                    } else {
89
+                        echo 'Не оплачено';
90
+                    }
91
+                }
92
+                ?></td>
93 93
             <td class="text-right">
94 94
               <?php
95
-              if ($cart->cart_status_id < 2) {
96
-                  ?>
95
+                if ($cart->cart_status_id < 2) {
96
+                    ?>
97 97
                   <a title="Продолжить покупки" href="/ecommerce/cart/continue/<?= $cart->id; ?>" data-toggle="tooltip" title="" class="btn btn-success btn-sm"><i class="glyphicon glyphicon-chevron-right"></i></a>
98 98
                   <a title="Удалить заказ" onclick="return confirm('Вы уверены?')" href="/ecommerce/cart/delete/<?= $cart->id; ?>" data-toggle="tooltip" title="" class="btn btn-danger btn-sm"><i class="glyphicon glyphicon-trash"></i></a>
99 99
                   <?php
100
-              }
101
-              if ($cart->cart_status_id >= 2) {
102
-                  ?>
100
+                }
101
+                if ($cart->cart_status_id >= 2) {
102
+                    ?>
103 103
                   <a title="Просмотр" href="/ecommerce/cart/orderDetail/<?= $cart->id; ?>" data-toggle="tooltip" title="" class="btn btn-info btn-sm"><i class="glyphicon glyphicon-eye-open"></i></a>
104 104
                   <a title="Заказать повторно" href="/ecommerce/cart/refill/<?= $cart->id; ?>" data-toggle="tooltip" title="" class="btn btn-primary btn-sm"><i class="glyphicon glyphicon-refresh"></i></a>
105 105
                     <?php
@@ -108,8 +108,8 @@  discard block
 block discarded – undo
108 108
             </td>
109 109
           </tr>
110 110
           <?php
111
-      }
112
-      ?>
111
+        }
112
+        ?>
113 113
     </tbody>
114 114
   </table>
115 115
 </div>
Please login to merge, or discard this patch.
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -61,7 +61,7 @@  discard block
 block discarded – undo
61 61
                       if (App::$cur->money) {
62 62
                           $currency = Money\Currency::get($currency_id);
63 63
                           if ($currency) {
64
-                              echo '&nbsp;' . $currency->acronym();
64
+                              echo '&nbsp;'.$currency->acronym();
65 65
                           } else {
66 66
                               echo '&nbsp;р.';
67 67
                           }
@@ -85,7 +85,7 @@  discard block
 block discarded – undo
85 85
                       $newRedirect = $handlers[$cart->payType->handler]['handler']($cart);
86 86
                   }
87 87
                   if (!empty($newRedirect[0])) {
88
-                      echo '<a class="btn btn-warning btn-sm" href = "' . $newRedirect[0] . '">Оплатить</a>';
88
+                      echo '<a class="btn btn-warning btn-sm" href = "'.$newRedirect[0].'">Оплатить</a>';
89 89
                   } else {
90 90
                       echo 'Не оплачено';
91 91
                   }
Please login to merge, or discard this patch.
system/modules/Files/Files.php 2 patches
Braces   +24 added lines, -16 removed lines patch added patch discarded remove patch
@@ -22,16 +22,19 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 
Please login to merge, or discard this patch.
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -46,13 +46,13 @@  discard block
 block discarded – undo
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
 block discarded – undo
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'];
Please login to merge, or discard this patch.