Completed
Push — master ( 9d10c2...bf46e5 )
by Lars
05:14
created
src/Intraface/modules/webshop/Basket.php 1 patch
Spacing   +44 added lines, -44 removed lines patch added patch discarded remove patch
@@ -56,13 +56,13 @@  discard block
 block discarded – undo
56 56
         }
57 57
 
58 58
         $this->webshop = $webshop;
59
-        $this->sql_extra = " session_id = '" . safeToDb($session_id) . "'";
59
+        $this->sql_extra = " session_id = '".safeToDb($session_id)."'";
60 60
 
61 61
         // rydder op i databasen efter fx to timer
62 62
         $clean_up_after = 2; // timer
63 63
 
64 64
         $db = new DB_Sql;
65
-        $db->query("DELETE FROM basket WHERE DATE_ADD(date_changed, INTERVAL " . $clean_up_after . " HOUR) < NOW()");
65
+        $db->query("DELETE FROM basket WHERE DATE_ADD(date_changed, INTERVAL ".$clean_up_after." HOUR) < NOW()");
66 66
     }
67 67
 
68 68
     /**
@@ -128,27 +128,27 @@  discard block
 block discarded – undo
128 128
         }
129 129
 
130 130
         $db->query("SELECT id, quantity FROM basket WHERE product_id = $product_id
131
-                AND product_detail_id = " . $product_detail_id . "
132
-                AND basketevaluation_product = " . $basketevaluation . "
133
-                AND " . $this->sql_extra. "
131
+                AND product_detail_id = ".$product_detail_id."
132
+                AND basketevaluation_product = " . $basketevaluation."
133
+                AND " . $this->sql_extra."
134 134
                 AND intranet_id = " . $this->webshop->kernel->intranet->get('id'));
135 135
 
136 136
         if ($db->nextRecord()) {
137 137
             if ($quantity == 0) {
138 138
                 $db->query("DELETE FROM basket
139
-                    WHERE id = ".$db->f('id') . "
140
-                        AND basketevaluation_product = " . $basketevaluation . "
141
-                        AND " . $this->sql_extra . "
139
+                    WHERE id = ".$db->f('id')."
140
+                        AND basketevaluation_product = " . $basketevaluation."
141
+                        AND " . $this->sql_extra."
142 142
                         AND intranet_id = " . $this->webshop->kernel->intranet->get("id"));
143 143
             } else {
144 144
                 $db->query("UPDATE basket SET
145 145
                     quantity = $quantity,
146 146
                     date_changed = NOW(),
147 147
                     text = '".$text."'
148
-                    WHERE id = ".$db->f('id') . "
149
-                        AND basketevaluation_product = " . $basketevaluation . "
148
+                    WHERE id = ".$db->f('id')."
149
+                        AND basketevaluation_product = " . $basketevaluation."
150 150
 
151
-                        AND " . $this->sql_extra . "
151
+                        AND " . $this->sql_extra."
152 152
                         AND intranet_id = " . $this->webshop->kernel->intranet->get('id'));
153 153
             }
154 154
             return true;
@@ -158,10 +158,10 @@  discard block
 block discarded – undo
158 158
                         quantity = $quantity,
159 159
                         date_changed = NOW(),
160 160
                         text = '".$text."',
161
-                        basketevaluation_product = " . $basketevaluation . ",
161
+                        basketevaluation_product = " . $basketevaluation.",
162 162
                         product_id = $product_id,
163 163
                         product_detail_id = ".$product_detail_id.",
164
-                        intranet_id = " . $this->webshop->kernel->intranet->get('id') . ",
164
+                        intranet_id = " . $this->webshop->kernel->intranet->get('id').",
165 165
                         " . $this->sql_extra);
166 166
             return true;
167 167
         }
@@ -186,10 +186,10 @@  discard block
 block discarded – undo
186 186
         settype($input['email'], 'string');
187 187
         settype($input['phone'], 'string');
188 188
 
189
-        $sql = "name = \"".safeToDb($input['name'])."\"," .
190
-            "contactperson = \"".safeToDb($input['contactperson'])."\", " .
191
-            "address = \"".safeToDb($input['address'])."\", " .
192
-            "postcode = \"".safeToDb($input['postcode'])."\", " .
189
+        $sql = "name = \"".safeToDb($input['name'])."\",".
190
+            "contactperson = \"".safeToDb($input['contactperson'])."\", ".
191
+            "address = \"".safeToDb($input['address'])."\", ".
192
+            "postcode = \"".safeToDb($input['postcode'])."\", ".
193 193
             "city = \"".safeToDb($input['city'])."\", ".
194 194
             "country = \"".safeToDb($input['country'])."\", ".
195 195
             "cvr = \"".safeToDb($input['cvr'])."\", ".
@@ -251,13 +251,13 @@  discard block
 block discarded – undo
251 251
     public function saveToDb($sql) {
252 252
 
253 253
         $db = new DB_Sql;
254
-        $db->query("SELECT id FROM basket_details WHERE " . $this->sql_extra. "
254
+        $db->query("SELECT id FROM basket_details WHERE ".$this->sql_extra."
255 255
                 AND intranet_id = " . $this->webshop->kernel->intranet->get('id'));
256 256
         if ($db->nextRecord()) {
257 257
             $db->query("UPDATE basket_details SET ".$sql.",
258 258
                 date_changed = NOW()
259
-                WHERE id = ".$db->f('id') . "
260
-                    AND " . $this->sql_extra . "
259
+                WHERE id = ".$db->f('id')."
260
+                    AND " . $this->sql_extra."
261 261
                     AND intranet_id = " . $this->webshop->kernel->intranet->get('id'));
262 262
             return true;
263 263
         } else {
@@ -265,7 +265,7 @@  discard block
 block discarded – undo
265 265
                     SET ".$sql.",
266 266
                         date_changed = NOW(),
267 267
                            date_created = NOW(),
268
-                        intranet_id = " . $this->webshop->kernel->intranet->get('id') . ",
268
+                        intranet_id = " . $this->webshop->kernel->intranet->get('id').",
269 269
                         " . $this->sql_extra);
270 270
 
271 271
             return true;
@@ -284,7 +284,7 @@  discard block
 block discarded – undo
284 284
         $db = new DB_Sql;
285 285
         $db->query("SELECT *
286 286
             FROM basket_details
287
-            WHERE " . $this->sql_extra . "
287
+            WHERE " . $this->sql_extra."
288 288
                 AND intranet_id = " . $this->webshop->kernel->intranet->get('id'));
289 289
         if (!$db->nextRecord()) {
290 290
             return array();
@@ -313,7 +313,7 @@  discard block
 block discarded – undo
313 313
         $db = new DB_Sql;
314 314
         $db->query("SELECT customer_coupon
315 315
             FROM basket_details
316
-            WHERE " . $this->sql_extra . "
316
+            WHERE " . $this->sql_extra."
317 317
                 AND intranet_id = " . $this->webshop->kernel->intranet->get('id'));
318 318
         if (!$db->nextRecord()) {
319 319
             return array();
@@ -334,7 +334,7 @@  discard block
 block discarded – undo
334 334
         $db = new DB_Sql;
335 335
         $db->query("SELECT customer_ean
336 336
             FROM basket_details
337
-            WHERE " . $this->sql_extra . "
337
+            WHERE " . $this->sql_extra."
338 338
                 AND intranet_id = " . $this->webshop->kernel->intranet->get('id'));
339 339
         if (!$db->nextRecord()) {
340 340
             return array();
@@ -355,7 +355,7 @@  discard block
 block discarded – undo
355 355
         $db = new DB_Sql;
356 356
         $db->query("SELECT customer_comment
357 357
             FROM basket_details
358
-            WHERE " . $this->sql_extra . "
358
+            WHERE " . $this->sql_extra."
359 359
                 AND intranet_id = " . $this->webshop->kernel->intranet->get('id'));
360 360
         if (!$db->nextRecord()) {
361 361
             return array();
@@ -378,9 +378,9 @@  discard block
 block discarded – undo
378 378
         $db = new DB_Sql;
379 379
         $db->query("SELECT *
380 380
             FROM basket
381
-            WHERE " . $this->sql_extra . "
382
-                AND product_id = " . $product_id . "
383
-                AND intranet_id = " . $this->webshop->kernel->intranet->get('id') . "
381
+            WHERE " . $this->sql_extra."
382
+                AND product_id = " . $product_id."
383
+                AND intranet_id = " . $this->webshop->kernel->intranet->get('id')."
384 384
       AND quantity > 0 LIMIT 1");
385 385
 
386 386
         if (!$db->nextRecord()) {
@@ -400,14 +400,14 @@  discard block
 block discarded – undo
400 400
         $price = 0;
401 401
 
402 402
         $db = new DB_Sql;
403
-        $db->query("SELECT product_id, quantity FROM basket WHERE " . $this->sql_extra);
403
+        $db->query("SELECT product_id, quantity FROM basket WHERE ".$this->sql_extra);
404 404
 
405 405
         while ($db->nextRecord()) {
406 406
             $product = new Product($this->webshop->kernel, $db->f("product_id"));
407 407
             if ($type == 'exclusive_vat') {
408
-                $price += $product->get('price') * $db->f("quantity");
408
+                $price += $product->get('price')*$db->f("quantity");
409 409
             } else {
410
-                $price += $product->get('price_incl_vat') * $db->f("quantity");
410
+                $price += $product->get('price_incl_vat')*$db->f("quantity");
411 411
             }
412 412
         }
413 413
 
@@ -431,9 +431,9 @@  discard block
 block discarded – undo
431 431
                 ON product.id = basket.product_id
432 432
             INNER JOIN product_detail
433 433
                 ON product.id = product_detail.product_id
434
-            WHERE " . $this->sql_extra . "
434
+            WHERE " . $this->sql_extra."
435 435
                 AND product_detail.active = 1
436
-                AND basket.intranet_id = " . $this->webshop->kernel->intranet->get("id") . "
436
+                AND basket.intranet_id = " . $this->webshop->kernel->intranet->get("id")."
437 437
                 AND basket.quantity > 0
438 438
             ");
439 439
 
@@ -441,7 +441,7 @@  discard block
 block discarded – undo
441 441
         $weight = 0;
442 442
 
443 443
         while ($db->nextRecord()) {
444
-            $weight += $db->f('weight') * $db->f('quantity');
444
+            $weight += $db->f('weight')*$db->f('quantity');
445 445
         }
446 446
 
447 447
         return $weight;
@@ -470,9 +470,9 @@  discard block
 block discarded – undo
470 470
                 ON product.id = basket.product_id
471 471
             INNER JOIN product_detail
472 472
                 ON product.id = product_detail.product_id
473
-            WHERE " . $this->sql_extra . "
473
+            WHERE " . $this->sql_extra."
474 474
                 AND product_detail.active = 1
475
-                AND basket.intranet_id = " . $this->webshop->kernel->intranet->get("id") . "
475
+                AND basket.intranet_id = " . $this->webshop->kernel->intranet->get("id")."
476 476
             ORDER BY product_detail.vat DESC, basket.basketevaluation_product");
477 477
 
478 478
         $i = 0;
@@ -493,8 +493,8 @@  discard block
 block discarded – undo
493 493
 
494 494
             // basket specific
495 495
             $items[$i]['quantity'] = $db->f('quantity');
496
-            $items[$i]['totalprice'] = $db->f('quantity') * $items[$i]['price'];
497
-            $items[$i]['totalprice_incl_vat'] = $db->f('quantity') * $items[$i]['price_incl_vat'];
496
+            $items[$i]['totalprice'] = $db->f('quantity')*$items[$i]['price'];
497
+            $items[$i]['totalprice_incl_vat'] = $db->f('quantity')*$items[$i]['price_incl_vat'];
498 498
 
499 499
             $i++;
500 500
         }
@@ -511,10 +511,10 @@  discard block
 block discarded – undo
511 511
     public function removeEvaluationProducts()
512 512
     {
513 513
         $db = new DB_Sql;
514
-        $db->query("DELETE FROM basket " .
515
-                "WHERE basketevaluation_product = 1 " .
516
-                    "AND " . $this->sql_extra . " " .
517
-                    "AND intranet_id = " . $this->webshop->kernel->intranet->get("id"));
514
+        $db->query("DELETE FROM basket ".
515
+                "WHERE basketevaluation_product = 1 ".
516
+                    "AND ".$this->sql_extra." ".
517
+                    "AND intranet_id = ".$this->webshop->kernel->intranet->get("id"));
518 518
         return true;
519 519
 
520 520
     }
@@ -527,8 +527,8 @@  discard block
 block discarded – undo
527 527
     public function reset()
528 528
     {
529 529
         $db = new DB_Sql;
530
-        $db->query("UPDATE basket SET session_id = '' WHERE " . $this->sql_extra . " AND intranet_id = " . $this->webshop->kernel->intranet->get("id"));
531
-        $db->query("UPDATE basket_details SET session_id = '' WHERE " . $this->sql_extra . " AND intranet_id = " . $this->webshop->kernel->intranet->get("id"));
530
+        $db->query("UPDATE basket SET session_id = '' WHERE ".$this->sql_extra." AND intranet_id = ".$this->webshop->kernel->intranet->get("id"));
531
+        $db->query("UPDATE basket_details SET session_id = '' WHERE ".$this->sql_extra." AND intranet_id = ".$this->webshop->kernel->intranet->get("id"));
532 532
 
533 533
         return true;
534 534
     }
Please login to merge, or discard this patch.
src/Intraface/modules/filemanager/TemporaryFile.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -23,7 +23,7 @@  discard block
 block discarded – undo
23 23
     /**
24 24
      * @var string $file_path
25 25
      */
26
-    private $file_path ;
26
+    private $file_path;
27 27
     
28 28
     /**
29 29
      * @var string $file_dir
@@ -114,7 +114,7 @@  discard block
 block discarded – undo
114 114
         if (strlen($file_name) > 50) {
115 115
             $extension = strrchr($file_name, '.');
116 116
             if ($extension !== false && (strlen($extension) == 4 || strlen($extension) == 5)) {
117
-                $file_name = substr($file_name, 0, 50-strlen($extension)).$extension;
117
+                $file_name = substr($file_name, 0, 50 - strlen($extension)).$extension;
118 118
             }
119 119
             else {
120 120
                 $file_name = substr($file_name, 0, 50);
Please login to merge, or discard this patch.
src/Intraface/modules/filemanager/ImageRandomizer.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -91,7 +91,7 @@
 block discarded – undo
91 91
     public function getRandomImage()
92 92
     {
93 93
         require_once 'Intraface/modules/filemanager/FileHandler.php';
94
-        $key = rand(0, count($this->file_list)-1);
94
+        $key = rand(0, count($this->file_list) - 1);
95 95
         $filehandler = new FileHandler($this->file_manager->getKernel(), $this->file_list[$key]);
96 96
         return $filehandler;
97 97
     }
Please login to merge, or discard this patch.
src/Intraface/modules/filemanager/InstanceManager.php 1 patch
Spacing   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -156,9 +156,9 @@  discard block
 block discarded – undo
156 156
             return false;
157 157
         }
158 158
         
159
-        $sql = 'name = '.$this->db->quote($input['name'], 'text').', ' .
160
-                'max_width = '.$this->db->quote($input['max_width'], 'integer').', ' .
161
-                'max_height = '.$this->db->quote($input['max_height'], 'integer').', ' .
159
+        $sql = 'name = '.$this->db->quote($input['name'], 'text').', '.
160
+                'max_width = '.$this->db->quote($input['max_width'], 'integer').', '.
161
+                'max_height = '.$this->db->quote($input['max_height'], 'integer').', '.
162 162
                 'resize_type_key = '.$this->db->quote($resize_type_key);
163 163
         
164 164
         if ($this->type_key == 0 || $this->get('origin') == 'standard') {
@@ -169,9 +169,9 @@  discard block
 block discarded – undo
169 169
                 $type_key = $this->type_key;
170 170
             }
171 171
             
172
-            $result = $this->db->exec('INSERT INTO file_handler_instance_type SET ' .
173
-                    'intranet_id = '.$this->db->quote($this->intranet_id, 'integer').', ' .
174
-                    'type_key = '.$this->db->quote($type_key, 'integer').', ' .
172
+            $result = $this->db->exec('INSERT INTO file_handler_instance_type SET '.
173
+                    'intranet_id = '.$this->db->quote($this->intranet_id, 'integer').', '.
174
+                    'type_key = '.$this->db->quote($type_key, 'integer').', '.
175 175
                     'active = 1, '.$sql);
176 176
             if (PEAR::isError($result)) {
177 177
                 throw new Exception('Error in exec: '.$result->getUserInfo());
@@ -185,8 +185,8 @@  discard block
 block discarded – undo
185 185
             return $this->type_key;
186 186
         }
187 187
         else {
188
-            $result = $this->db->exec('UPDATE file_handler_instance_type SET '.$sql.' ' .
189
-                    'WHERE intranet_id = '.$this->db->quote($this->intranet_id, 'integer').' ' .
188
+            $result = $this->db->exec('UPDATE file_handler_instance_type SET '.$sql.' '.
189
+                    'WHERE intranet_id = '.$this->db->quote($this->intranet_id, 'integer').' '.
190 190
                             'AND type_key = '.$this->db->quote($this->type_key, 'integer'));
191 191
             if (PEAR::isError($result)) {
192 192
                 throw new Exception('Error in exec: '.$result->getUserInfo());
@@ -238,10 +238,10 @@  discard block
 block discarded – undo
238 238
             }
239 239
         }
240 240
         
241
-        $result = $this->db->query('SELECT type_key FROM file_handler_instance_type WHERE ' .
242
-                'intranet_id = '.$this->db->quote($this->intranet_id, 'integer').' AND ' .
243
-                'name = '.$this->db->quote($name, 'text').' AND ' .
244
-                'type_key != '.$this->db->quote((int)$type_key, 'integer').' AND ' .
241
+        $result = $this->db->query('SELECT type_key FROM file_handler_instance_type WHERE '.
242
+                'intranet_id = '.$this->db->quote($this->intranet_id, 'integer').' AND '.
243
+                'name = '.$this->db->quote($name, 'text').' AND '.
244
+                'type_key != '.$this->db->quote((int)$type_key, 'integer').' AND '.
245 245
                 'active = 1');
246 246
         if (PEAR::isError($result)) {
247 247
             throw new Exception('Error in query: '.$result->getUserInfo());
@@ -264,7 +264,7 @@  discard block
 block discarded – undo
264 264
     private function getNextFreeTypeKey() 
265 265
     {
266 266
         // We do not active = 1, then it is possible to recreate deleted items without messing everything up.
267
-        $result = $this->db->query('SELECT MAX(type_key) AS max_key FROM file_handler_instance_type WHERE ' .
267
+        $result = $this->db->query('SELECT MAX(type_key) AS max_key FROM file_handler_instance_type WHERE '.
268 268
                 'intranet_id = '.$this->db->quote($this->intranet_id, 'integer'));
269 269
         if (PEAR::isError($result)) {
270 270
             throw new Exception('Error in query: '.$result->getUserInfo());
Please login to merge, or discard this patch.
src/Intraface/modules/email/Controller/Index.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -62,7 +62,7 @@
 block discarded – undo
62 62
         	'email_shared' => $email_shared
63 63
         );
64 64
 
65
-        $tpl = $this->template->create(dirname(__FILE__) . '/templates/index');
65
+        $tpl = $this->template->create(dirname(__FILE__).'/templates/index');
66 66
         return $tpl->render($this, $data);
67 67
     }
68 68
 
Please login to merge, or discard this patch.
src/Intraface/modules/intranetmaintenance/IntranetMaintenance.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -288,7 +288,7 @@  discard block
 block discarded – undo
288 288
         $intranet = array();
289 289
         $db = $this->dbquery->getRecordset('DISTINCT(intranet.id), intranet.name');
290 290
         while ($db->nextRecord()) {
291
-            $intranet[$i]['id'] =   $db->f('id');
291
+            $intranet[$i]['id'] = $db->f('id');
292 292
             $intranet[$i]['name'] = $db->f('name');
293 293
             $i++;
294 294
         }
@@ -316,7 +316,7 @@  discard block
 block discarded – undo
316 316
      */
317 317
     function setContact($contact_id)
318 318
     {
319
-        $this->db->query("UPDATE intranet SET contact_id = ".intval($contact_id)." WHERE id = " . intval($this->id));
319
+        $this->db->query("UPDATE intranet SET contact_id = ".intval($contact_id)." WHERE id = ".intval($this->id));
320 320
         return true;
321 321
     }
322 322
 
@@ -333,7 +333,7 @@  discard block
 block discarded – undo
333 333
 
334 334
     private function identifierIsUnique($identifier)
335 335
     {
336
-        $result = $this->db->query("SELECT identifier FROM intranet WHERE identifier = ".$this->db->quote($identifier, 'text')." AND id <> " . intval($this->id));
336
+        $result = $this->db->query("SELECT identifier FROM intranet WHERE identifier = ".$this->db->quote($identifier, 'text')." AND id <> ".intval($this->id));
337 337
         if ($result->numRows() > 1) {
338 338
             return false;
339 339
         }
Please login to merge, or discard this patch.
src/Intraface/modules/intranetmaintenance/Controller/Intranet/Index.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -29,7 +29,7 @@  discard block
 block discarded – undo
29 29
             'intranet_maintenance' => $this->getIntranetmaintenance()
30 30
         );
31 31
 
32
-        $smarty = $this->template->create(dirname(__FILE__) . '/../templates/intranet/index');
32
+        $smarty = $this->template->create(dirname(__FILE__).'/../templates/intranet/index');
33 33
         return $smarty->render($this, $data);
34 34
     }
35 35
 
@@ -40,7 +40,7 @@  discard block
 block discarded – undo
40 40
         $modul = $this->getKernel()->module("intranetmaintenance");
41 41
         $translation = $this->getKernel()->getTranslation('intranetmaintenance');
42 42
 
43
-        $smarty = $this->template->create(dirname(__FILE__) . '/../templates/intranet/edit');
43
+        $smarty = $this->template->create(dirname(__FILE__).'/../templates/intranet/edit');
44 44
         return $smarty->render($this);
45 45
     }
46 46
 
Please login to merge, or discard this patch.
src/Intraface/modules/intranetmaintenance/Controller/Index.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -22,7 +22,7 @@
 block discarded – undo
22 22
 
23 23
     function renderHtml()
24 24
     {
25
-        $smarty = $this->template->create(dirname(__FILE__) . '/templates/index');
25
+        $smarty = $this->template->create(dirname(__FILE__).'/templates/index');
26 26
         return $smarty->render($this);
27 27
     }
28 28
 
Please login to merge, or discard this patch.
src/Intraface/modules/intranetmaintenance/Controller/Modules.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -15,7 +15,7 @@
 block discarded – undo
15 15
     {
16 16
         $module = $this->getModule();
17 17
 
18
-        $smarty = $this->template->create(dirname(__FILE__) . '/templates/modules');
18
+        $smarty = $this->template->create(dirname(__FILE__).'/templates/modules');
19 19
         return $smarty->render($this);
20 20
     }
21 21
 
Please login to merge, or discard this patch.