Completed
Pull Request — master (#26)
by Lars
14:13
created
src/Intraface/modules/shop/Basket.php 1 patch
Spacing   +41 added lines, -41 removed lines patch added patch discarded remove patch
@@ -69,16 +69,16 @@  discard block
 block discarded – undo
69 69
         $this->resetItemCache();
70 70
 
71 71
         $this->conditions = array(
72
-            'session_id = ' . $this->db->quote($this->session_id, 'text'),
73
-            'shop_id = ' . $this->db->quote($this->webshop->getId(), 'integer'),
74
-            'intranet_id = ' . $this->db->quote($this->intranet->getId(), 'integer'));
72
+            'session_id = '.$this->db->quote($this->session_id, 'text'),
73
+            'shop_id = '.$this->db->quote($this->webshop->getId(), 'integer'),
74
+            'intranet_id = '.$this->db->quote($this->intranet->getId(), 'integer'));
75 75
 
76 76
         $this->cleanUp();
77 77
     }
78 78
 
79 79
     private function cleanUp()
80 80
     {
81
-        return $this->db->query("DELETE FROM basket WHERE DATE_ADD(date_changed, INTERVAL " . $this->db->quote(self::CLEAN_UP_AFTER, 'integer') . " HOUR) < NOW()");
81
+        return $this->db->query("DELETE FROM basket WHERE DATE_ADD(date_changed, INTERVAL ".$this->db->quote(self::CLEAN_UP_AFTER, 'integer')." HOUR) < NOW()");
82 82
     }
83 83
 
84 84
     /**
@@ -165,23 +165,23 @@  discard block
 block discarded – undo
165 165
                 FROM basket
166 166
                 WHERE product_id = ".$product_id."
167 167
                     AND product_variation_id = ".$product_variation_id."
168
-                    AND product_detail_id = " . $product_detail_id . "
169
-                    AND basketevaluation_product = " . $basketevaluation . "
168
+                    AND product_detail_id = " . $product_detail_id."
169
+                    AND basketevaluation_product = " . $basketevaluation."
170 170
                     AND " . $sql_extra);
171 171
 
172 172
         if ($db->nextRecord()) {
173 173
             if ($quantity == 0) {
174 174
                 $db->query("DELETE FROM basket
175
-                    WHERE id = ".$db->f('id') . "
176
-                        AND basketevaluation_product = " . $basketevaluation . "
175
+                    WHERE id = ".$db->f('id')."
176
+                        AND basketevaluation_product = " . $basketevaluation."
177 177
                         AND " . $sql_extra);
178 178
             } else {
179 179
                 $db->query("UPDATE basket SET
180 180
                     quantity = $quantity,
181 181
                     date_changed = NOW(),
182 182
                     text = '".$text."'
183
-                    WHERE id = ".$db->f('id') . "
184
-                        AND basketevaluation_product = " . $basketevaluation . "
183
+                    WHERE id = ".$db->f('id')."
184
+                        AND basketevaluation_product = " . $basketevaluation."
185 185
                         AND " . $sql_extra);
186 186
             }
187 187
             return true;
@@ -192,7 +192,7 @@  discard block
 block discarded – undo
192 192
                         quantity = $quantity,
193 193
                         date_changed = NOW(),
194 194
                         text = '".$text."',
195
-                        basketevaluation_product = " . $basketevaluation . ",
195
+                        basketevaluation_product = " . $basketevaluation.",
196 196
                         product_id = ".$product_id.",
197 197
                         product_variation_id = ".$product_variation_id.",
198 198
                         product_detail_id = ".$product_detail_id.",
@@ -220,10 +220,10 @@  discard block
 block discarded – undo
220 220
         settype($input['email'], 'string');
221 221
         settype($input['phone'], 'string');
222 222
 
223
-        $sql = "name = \"".safeToDb($input['name'])."\"," .
224
-            "contactperson = \"".safeToDb($input['contactperson'])."\", " .
225
-            "address = \"".safeToDb($input['address'])."\", " .
226
-            "postcode = \"".safeToDb($input['postcode'])."\", " .
223
+        $sql = "name = \"".safeToDb($input['name'])."\",".
224
+            "contactperson = \"".safeToDb($input['contactperson'])."\", ".
225
+            "address = \"".safeToDb($input['address'])."\", ".
226
+            "postcode = \"".safeToDb($input['postcode'])."\", ".
227 227
             "city = \"".safeToDb($input['city'])."\", ".
228 228
             "country = \"".safeToDb($input['country'])."\", ".
229 229
             "cvr = \"".safeToDb($input['cvr'])."\", ".
@@ -305,13 +305,13 @@  discard block
 block discarded – undo
305 305
         $sql_extra = implode(" AND ", $this->conditions);
306 306
 
307 307
         $db = new DB_Sql;
308
-        $db->query("SELECT id FROM basket_details WHERE " . $sql_extra. "
308
+        $db->query("SELECT id FROM basket_details WHERE ".$sql_extra."
309 309
                 AND intranet_id = " . $this->intranet->getId());
310 310
         if ($db->nextRecord()) {
311 311
             $db->query("UPDATE basket_details SET ".$sql.",
312 312
                 date_changed = NOW()
313
-                WHERE id = ".$db->f('id') . "
314
-                    AND " . $sql_extra . "
313
+                WHERE id = ".$db->f('id')."
314
+                    AND " . $sql_extra."
315 315
                     AND intranet_id = " . $this->intranet->getId());
316 316
             return true;
317 317
         } else {
@@ -339,7 +339,7 @@  discard block
 block discarded – undo
339 339
         $db = new DB_Sql;
340 340
         $db->query("SELECT *
341 341
             FROM basket_details
342
-            WHERE " . $sql_extra . "
342
+            WHERE " . $sql_extra."
343 343
                 AND intranet_id = " . $this->intranet->getId());
344 344
         if (!$db->nextRecord()) {
345 345
             return array();
@@ -369,7 +369,7 @@  discard block
 block discarded – undo
369 369
         $db = new DB_Sql;
370 370
         $db->query("SELECT customer_coupon
371 371
             FROM basket_details
372
-            WHERE " . $sql_extra . "
372
+            WHERE " . $sql_extra."
373 373
                 AND intranet_id = " . $this->intranet->getId());
374 374
         if (!$db->nextRecord()) {
375 375
             return array();
@@ -391,7 +391,7 @@  discard block
 block discarded – undo
391 391
         $db = new DB_Sql;
392 392
         $db->query("SELECT customer_ean
393 393
             FROM basket_details
394
-            WHERE " . $sql_extra . "
394
+            WHERE " . $sql_extra."
395 395
                 AND intranet_id = " . $this->intranet->getId());
396 396
         if (!$db->nextRecord()) {
397 397
             return array();
@@ -413,7 +413,7 @@  discard block
 block discarded – undo
413 413
         $db = new DB_Sql;
414 414
         $db->query("SELECT customer_comment
415 415
             FROM basket_details
416
-            WHERE " . $sql_extra . "
416
+            WHERE " . $sql_extra."
417 417
                 AND intranet_id = " . $this->intranet->getId());
418 418
         if (!$db->nextRecord()) {
419 419
             return array();
@@ -435,7 +435,7 @@  discard block
 block discarded – undo
435 435
         $db = new DB_Sql;
436 436
         $db->query("SELECT payment_method_key
437 437
             FROM basket_details
438
-            WHERE " . $sql_extra . "
438
+            WHERE " . $sql_extra."
439 439
                 AND intranet_id = " . $this->intranet->getId());
440 440
         if (!$db->nextRecord() || $db->f('payment_method_key') == 0) {
441 441
             return array();
@@ -460,10 +460,10 @@  discard block
 block discarded – undo
460 460
         $db = new DB_Sql;
461 461
         $db->query("SELECT *
462 462
             FROM basket
463
-            WHERE " . $sql_extra . "
464
-                AND product_id = " . $product_id . "
463
+            WHERE " . $sql_extra."
464
+                AND product_id = " . $product_id."
465 465
                 AND product_variation_id = ".$product_variation_id."
466
-                AND intranet_id = " . $this->intranet->getId() . "
466
+                AND intranet_id = " . $this->intranet->getId()."
467 467
       AND quantity > 0 LIMIT 1");
468 468
 
469 469
         if (!$db->nextRecord()) {
@@ -574,9 +574,9 @@  discard block
 block discarded – undo
574 574
                 ON product.id = basket.product_id
575 575
             INNER JOIN product_detail
576 576
                 ON product.id = product_detail.product_id
577
-            WHERE " . $sql_extra . "
577
+            WHERE " . $sql_extra."
578 578
                 AND product_detail.active = 1
579
-                AND basket.intranet_id = " . $this->intranet->getId() . "
579
+                AND basket.intranet_id = " . $this->intranet->getId()."
580 580
             ORDER BY product_detail.vat DESC, basket.basketevaluation_product");
581 581
 
582 582
         $i = 0;
@@ -627,16 +627,16 @@  discard block
 block discarded – undo
627 627
 
628 628
             // basket specific
629 629
             $items[$i]['quantity'] = $db->f('quantity');
630
-            $items[$i]['totalweight'] = $items[$i]['weight'] * $db->f('quantity');
631
-            $items[$i]['totalprice'] = $db->f('quantity') * $items[$i]['price'];
632
-            $items[$i]['totalprice_incl_vat'] = $db->f('quantity') * $items[$i]['price_incl_vat'];
630
+            $items[$i]['totalweight'] = $items[$i]['weight']*$db->f('quantity');
631
+            $items[$i]['totalprice'] = $db->f('quantity')*$items[$i]['price'];
632
+            $items[$i]['totalprice_incl_vat'] = $db->f('quantity')*$items[$i]['price_incl_vat'];
633 633
 
634
-            $items[$i]['currency']['DKK']['totalprice'] = $db->f('quantity') * $items[$i]['currency']['DKK']['price'];
635
-            $items[$i]['currency']['DKK']['totalprice_incl_vat'] = $db->f('quantity') * $items[$i]['currency']['DKK']['price_incl_vat'];
634
+            $items[$i]['currency']['DKK']['totalprice'] = $db->f('quantity')*$items[$i]['currency']['DKK']['price'];
635
+            $items[$i]['currency']['DKK']['totalprice_incl_vat'] = $db->f('quantity')*$items[$i]['currency']['DKK']['price_incl_vat'];
636 636
             if (is_object($currencies) && $currencies->count() > 0) {
637 637
                 foreach ($currencies as $currency) {
638
-                    $items[$i]['currency'][$currency->getType()->getIsoCode()]['totalprice'] = $db->f('quantity') * $items[$i]['currency'][$currency->getType()->getIsoCode()]['price'];
639
-                    $items[$i]['currency'][$currency->getType()->getIsoCode()]['totalprice_incl_vat'] = $db->f('quantity') * $items[$i]['currency'][$currency->getType()->getIsoCode()]['price_incl_vat'];
638
+                    $items[$i]['currency'][$currency->getType()->getIsoCode()]['totalprice'] = $db->f('quantity')*$items[$i]['currency'][$currency->getType()->getIsoCode()]['price'];
639
+                    $items[$i]['currency'][$currency->getType()->getIsoCode()]['totalprice_incl_vat'] = $db->f('quantity')*$items[$i]['currency'][$currency->getType()->getIsoCode()]['price_incl_vat'];
640 640
                 }
641 641
             }
642 642
 
@@ -665,10 +665,10 @@  discard block
 block discarded – undo
665 665
     {
666 666
         $sql_extra = implode(" AND ", $this->conditions);
667 667
         $db = new DB_Sql;
668
-        $db->query("DELETE FROM basket " .
669
-                "WHERE basketevaluation_product = 1 " .
670
-                    "AND " . $sql_extra . " " .
671
-                    "AND intranet_id = " . $this->intranet->getId());
668
+        $db->query("DELETE FROM basket ".
669
+                "WHERE basketevaluation_product = 1 ".
670
+                    "AND ".$sql_extra." ".
671
+                    "AND intranet_id = ".$this->intranet->getId());
672 672
 
673 673
         $this->resetItemCache();
674 674
 
@@ -687,8 +687,8 @@  discard block
 block discarded – undo
687 687
 
688 688
         $sql_extra = implode(" AND ", $this->conditions);
689 689
         $db = new DB_Sql;
690
-        $db->query("UPDATE basket SET session_id = '' WHERE " . $sql_extra . " AND intranet_id = " . $this->intranet->getId());
691
-        $db->query("UPDATE basket_details SET session_id = '' WHERE " . $sql_extra . " AND intranet_id = " . $this->intranet->getId());
690
+        $db->query("UPDATE basket SET session_id = '' WHERE ".$sql_extra." AND intranet_id = ".$this->intranet->getId());
691
+        $db->query("UPDATE basket_details SET session_id = '' WHERE ".$sql_extra." AND intranet_id = ".$this->intranet->getId());
692 692
 
693 693
         return true;
694 694
     }
Please login to merge, or discard this patch.
src/Intraface/modules/shop/Controller/tpl/categories.tpl.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -32,7 +32,7 @@
 block discarded – undo
32 32
             # If there is subcategories to the category
33 33
             if (is_array($category['categories']) && count($category['categories']) > 0) {
34 34
                 # We make the items for the next level the sub categories of this category
35
-                $level_categories[$level+1] = $category['categories'];
35
+                $level_categories[$level + 1] = $category['categories'];
36 36
 
37 37
                 # We move to next level
38 38
                 $level++;
Please login to merge, or discard this patch.
src/Intraface/modules/shop/Controller/Index.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -27,7 +27,7 @@  discard block
 block discarded – undo
27 27
         if (!is_null($options)) {
28 28
             $config = HTMLPurifier_Config::createDefault();
29 29
             foreach ($options as $option) {
30
-                $config->set($option[0] . '.' . $option[1], $option[2]);
30
+                $config->set($option[0].'.'.$option[1], $option[2]);
31 31
             }
32 32
         }
33 33
         $this->_htmlPurifier = new HTMLPurifier($config);
@@ -45,7 +45,7 @@  discard block
 block discarded – undo
45 45
     {
46 46
         $options = array(
47 47
             array('Cache', 'SerializerPath',
48
-                PATH_CACHE . '/htmlpurifier'
48
+                PATH_CACHE.'/htmlpurifier'
49 49
             ),
50 50
             //array('HTML', 'Doctype', 'XHTML 1.0 Strict'),
51 51
             array('HTML', 'Allowed',
@@ -149,12 +149,12 @@  discard block
 block discarded – undo
149 149
         $shops = Doctrine::getTable('Intraface_modules_shop_Shop')->findByIntranetId($this->getKernel()->intranet->getId());
150 150
 
151 151
         if (count($shops) == 0) {
152
-            $tpl = $this->template->create(dirname(__FILE__) . '/tpl/empty-table');
152
+            $tpl = $this->template->create(dirname(__FILE__).'/tpl/empty-table');
153 153
             return $tpl->render($this, array('message' => 'No shops has been created yet.'));
154 154
         }
155 155
 
156 156
         $data = array('shops' => $shops);
157
-        $tpl = $this->template->create(dirname(__FILE__) . '/tpl/shops');
157
+        $tpl = $this->template->create(dirname(__FILE__).'/tpl/shops');
158 158
         return $tpl->render($this, $data);
159 159
     }
160 160
 
@@ -192,7 +192,7 @@  discard block
 block discarded – undo
192 192
             'settings' => $settings,
193 193
             'currencies' => $currencies,
194 194
             'languages' => $langs);
195
-        $tpl = $this->template->create(dirname(__FILE__) . '/tpl/edit');
195
+        $tpl = $this->template->create(dirname(__FILE__).'/tpl/edit');
196 196
         return $tpl->render($this, $data);
197 197
     }
198 198
 
@@ -242,7 +242,7 @@  discard block
 block discarded – undo
242 242
 
243 243
     function wrapHtml($content)
244 244
     {
245
-        $tpl = $this->template->create(dirname(__FILE__) . '/tpl/content');
245
+        $tpl = $this->template->create(dirname(__FILE__).'/tpl/content');
246 246
         return $tpl->render($this, array('content' => $content));
247 247
     }
248 248
 
Please login to merge, or discard this patch.
src/Intraface/modules/cms/Page.php 1 patch
Spacing   +21 added lines, -21 removed lines patch added patch discarded remove patch
@@ -80,7 +80,7 @@  discard block
 block discarded – undo
80 80
         }
81 81
 
82 82
         $this->id         = (int)$id;
83
-        $this->cmssite    =  $cmssite;
83
+        $this->cmssite    = $cmssite;
84 84
         $this->navigation = new CMS_Navigation($this);
85 85
         $this->template   = new CMS_Template($this->cmssite);
86 86
         $this->kernel     = $this->cmssite->kernel;
@@ -120,7 +120,7 @@  discard block
 block discarded – undo
120 120
         if ($this->dbquery) {
121 121
             return $this->dbquery;
122 122
         }
123
-        return ($this->dbquery = new Intraface_DBQuery($this->kernel, 'cms_page', 'cms_page.intranet_id = '.$this->kernel->intranet->get('id').' AND cms_page.active = 1 AND site_id = ' . $this->cmssite->get('id')));
123
+        return ($this->dbquery = new Intraface_DBQuery($this->kernel, 'cms_page', 'cms_page.intranet_id = '.$this->kernel->intranet->get('id').' AND cms_page.active = 1 AND site_id = '.$this->cmssite->get('id')));
124 124
     }
125 125
 
126 126
     /**
@@ -212,7 +212,7 @@  discard block
 block discarded – undo
212 212
         $validator->isNumeric($var['allow_comments'], 'error in comments - allowed values are 0 and 1');
213 213
         $validator->isNumeric($var['hidden'], 'error in hidden - allowed values are 0 and 1');
214 214
 
215
-        if (!Validate::string($var['identifier'], array('format' => VALIDATE_ALPHA . VALIDATE_NUM . '-_'))) {
215
+        if (!Validate::string($var['identifier'], array('format' => VALIDATE_ALPHA.VALIDATE_NUM.'-_'))) {
216 216
             $this->error->set('error in unique page address. allowed values are a-z 1-9 _ -');
217 217
         }
218 218
         if (!$this->isIdentifierAvailable($var['identifier'])) {
@@ -228,7 +228,7 @@  discard block
 block discarded – undo
228 228
     function isIdentifierAvailable($identifier)
229 229
     {
230 230
         $db = new DB_Sql;
231
-        $db->query("SELECT * FROM cms_page WHERE site_id = " . $this->cmssite->get('id') . " AND identifier = '".$identifier."' AND active = 1 AND id != " . (int)$this->get('id'));
231
+        $db->query("SELECT * FROM cms_page WHERE site_id = ".$this->cmssite->get('id')." AND identifier = '".$identifier."' AND active = 1 AND id != ".(int)$this->get('id'));
232 232
         return ($db->numRows() == 0);
233 233
     }
234 234
 
@@ -268,7 +268,7 @@  discard block
 block discarded – undo
268 268
         }
269 269
 
270 270
         if (empty($var['identifier'])) {
271
-            $var['identifier'] = md5(date('d-m-Y H:i:s') . $type_key . serialize($var));
271
+            $var['identifier'] = md5(date('d-m-Y H:i:s').$type_key.serialize($var));
272 272
         }
273 273
 
274 274
         settype($var['date_expire'], 'string');
@@ -282,7 +282,7 @@  discard block
 block discarded – undo
282 282
             $sql_end = ", date_created = NOW()";
283 283
         } else {
284 284
             $sql_type = "UPDATE ";
285
-            $sql_end = ", date_updated = NOW() WHERE id = " . $this->id;
285
+            $sql_end = ", date_updated = NOW() WHERE id = ".$this->id;
286 286
         }
287 287
 
288 288
         $sql_extra = '';
@@ -295,11 +295,11 @@  discard block
 block discarded – undo
295 295
         }
296 296
 
297 297
         // if the page is to updated
298
-        $sql = $sql_type . " cms_page SET
298
+        $sql = $sql_type." cms_page SET
299 299
             intranet_id = '".$this->kernel->intranet->get('id')."',
300 300
             user_id = '".$this->kernel->user->get('id')."',
301
-            title = '" .$var['title']. "',
302
-            keywords = '" .$var['keywords']. "',
301
+            title = '" .$var['title']."',
302
+            keywords = '" .$var['keywords']."',
303 303
             description = '".$var['description']."',
304 304
             date_publish = ".$sql_publish.",
305 305
             allow_comments = ".$var['allow_comments'].",
@@ -311,7 +311,7 @@  discard block
 block discarded – undo
311 311
             site_id = '".(int)$this->cmssite->get('id')."',
312 312
             template_id = ".$var['template_id'].",
313 313
             pic_id = ".intval($var['pic_id']).",
314
-            identifier = '".$var['identifier']."'" . $sql_end;
314
+            identifier = '".$var['identifier']."'".$sql_end;
315 315
         // password = '".$var['password']."',
316 316
         $db = new DB_Sql;
317 317
         $db->query($sql);
@@ -326,11 +326,11 @@  discard block
 block discarded – undo
326 326
 
327 327
 
328 328
         //position
329
-        $db->query("SELECT position FROM cms_page WHERE id = " . $this->id);
329
+        $db->query("SELECT position FROM cms_page WHERE id = ".$this->id);
330 330
         if ($db->nextRecord()) {
331 331
             if ($db->f('position') == 0 and count($this->getList($this->value['type']) > 0)) {
332 332
                 $next_pos = $this->getPosition(MDB2::singleton(DB_DSN))->getMaxPosition() + 1;
333
-                $db->query("UPDATE cms_page SET position = " . $next_pos . " WHERE id = " . $this->id);
333
+                $db->query("UPDATE cms_page SET position = ".$next_pos." WHERE id = ".$this->id);
334 334
             }
335 335
         }
336 336
 
@@ -367,7 +367,7 @@  discard block
 block discarded – undo
367 367
             $sql_publish = " AND date_publish < NOW() AND status_key > 0";
368 368
         }
369 369
 
370
-        $sql = "SELECT *, DATE_FORMAT(date_publish, '%d-%m-%Y') AS date_publish_dk FROM cms_page WHERE intranet_id = ".$this->cmssite->kernel->intranet->get('id')." AND id = " .$this->id . $sql_expire . $sql_publish;
370
+        $sql = "SELECT *, DATE_FORMAT(date_publish, '%d-%m-%Y') AS date_publish_dk FROM cms_page WHERE intranet_id = ".$this->cmssite->kernel->intranet->get('id')." AND id = ".$this->id.$sql_expire.$sql_publish;
371 371
 
372 372
         $db = new DB_Sql();
373 373
         $db->query($sql);
@@ -386,8 +386,8 @@  discard block
 block discarded – undo
386 386
         if (empty($this->value['identifier'])) {
387 387
             $this->value['identifier'] = $db->f('id');
388 388
         }
389
-        $this->value['url'] =  $this->cmssite->get('url') . $this->value['identifier'] . '/';
390
-        $this->value['url_self'] =  $this->value['identifier'] . '/';
389
+        $this->value['url'] = $this->cmssite->get('url').$this->value['identifier'].'/';
390
+        $this->value['url_self'] = $this->value['identifier'].'/';
391 391
 
392 392
         $this->value['child_of_id'] = $db->f('child_of_id');
393 393
         $this->value['name'] = $db->f('title'); //  bruges til keywords - m�ske skulle vi have et felt ogs�, s� title var webrelateret?
@@ -464,7 +464,7 @@  discard block
 block discarded – undo
464 464
 
465 465
         foreach ($template_sections as $template_section) {
466 466
             $db = new DB_Sql;
467
-            $db->query("SELECT id FROM cms_section WHERE intranet_id = ".$this->kernel->intranet->get('id')." AND page_id = ".$this->get('id')." AND site_id = ".$this->cmssite->get('id')." AND template_section_id = " . $template_section['id']);
467
+            $db->query("SELECT id FROM cms_section WHERE intranet_id = ".$this->kernel->intranet->get('id')." AND page_id = ".$this->get('id')." AND site_id = ".$this->cmssite->get('id')." AND template_section_id = ".$template_section['id']);
468 468
 
469 469
             // opretter de sektioner der ikke er oprettet p� siden
470 470
             if (!$db->nextRecord()) {
@@ -480,7 +480,7 @@  discard block
 block discarded – undo
480 480
         $db = new DB_Sql;
481 481
         $db->query("SELECT cms_section.id FROM cms_section INNER JOIN cms_template_section ON cms_section.template_section_id = cms_template_section.id
482 482
             WHERE cms_section.intranet_id = ".$this->kernel->intranet->get('id')."
483
-                AND cms_section.page_id = " . $this->id . " ORDER BY cms_template_section.position ASC");
483
+                AND cms_section.page_id = " . $this->id." ORDER BY cms_template_section.position ASC");
484 484
         $i = 0;
485 485
         $section = array();
486 486
         while ($db->nextRecord()) {
@@ -755,7 +755,7 @@  discard block
 block discarded – undo
755 755
             return false;
756 756
         }
757 757
         $db = new DB_Sql;
758
-        $db->query("UPDATE cms_page SET status_key = " . array_search($status, $this->status) . " WHERE id = " . $this->id . " AND intranet_id = " . $this->cmssite->kernel->intranet->get('id'));
758
+        $db->query("UPDATE cms_page SET status_key = ".array_search($status, $this->status)." WHERE id = ".$this->id." AND intranet_id = ".$this->cmssite->kernel->intranet->get('id'));
759 759
         $this->value['status_key'] = array_search($status, $this->status);
760 760
         return true;
761 761
     }
@@ -799,7 +799,7 @@  discard block
 block discarded – undo
799 799
         // @todo: BUT it can be a mess and the position of the pages is not corrected
800 800
         $db->query('UPDATE cms_page SET child_of_id = '.intval($this->get('child_of_id')).' WHERE child_of_id = '.intval($this->id));
801 801
 
802
-        $sql = "UPDATE cms_page SET active = 0 WHERE id=" . $this->id . " AND site_id = ".$this->cmssite->get('id');
802
+        $sql = "UPDATE cms_page SET active = 0 WHERE id=".$this->id." AND site_id = ".$this->cmssite->get('id');
803 803
         $db->query($sql);
804 804
         $this->value['active'] = 0;
805 805
         $this->load();
@@ -858,7 +858,7 @@  discard block
 block discarded – undo
858 858
     function publish()
859 859
     {
860 860
         $db = new DB_Sql;
861
-        $db->query("UPDATE cms_page SET status_key = " . array_search('published', $this->status) . " WHERE id = " . $this->id . " AND intranet_id = " . $this->cmssite->kernel->intranet->get('id'));
861
+        $db->query("UPDATE cms_page SET status_key = ".array_search('published', $this->status)." WHERE id = ".$this->id." AND intranet_id = ".$this->cmssite->kernel->intranet->get('id'));
862 862
         $this->value['status_key'] = 1;
863 863
         $this->load();
864 864
         return true;
@@ -867,7 +867,7 @@  discard block
 block discarded – undo
867 867
     function unpublish()
868 868
     {
869 869
         $db = new DB_Sql;
870
-        $db->query("UPDATE cms_page SET status_key = " . array_search('draft', $this->status) . " WHERE id = " . $this->id . " AND intranet_id = " . $this->cmssite->kernel->intranet->get('id'));
870
+        $db->query("UPDATE cms_page SET status_key = ".array_search('draft', $this->status)." WHERE id = ".$this->id." AND intranet_id = ".$this->cmssite->kernel->intranet->get('id'));
871 871
         $this->value['status_key'] = 0;
872 872
         $this->load();
873 873
         return true;
Please login to merge, or discard this patch.
src/Intraface/modules/cms/Stylesheet.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -10,7 +10,7 @@
 block discarded – undo
10 10
     function __construct($cmssite)
11 11
     {
12 12
         if (!is_object($cmssite) or strtolower(get_class($cmssite)) != 'cms_site') {
13
-            throw new Exception('CMS_Stylesheet::__construct needs CMS_Site - got ' . get_class($cmssite));
13
+            throw new Exception('CMS_Stylesheet::__construct needs CMS_Site - got '.get_class($cmssite));
14 14
         }
15 15
         $this->cmssite = $cmssite;
16 16
         $this->error = new Intraface_Error;
Please login to merge, or discard this patch.
src/Intraface/modules/cms/Section.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -30,7 +30,7 @@  discard block
 block discarded – undo
30 30
         $this->db = MDB2::singleton(DB_DSN);
31 31
         $this->cmspage = $cmspage;
32 32
         $this->kernel = $cmspage->kernel;
33
-        $this->id = (int) $id;
33
+        $this->id = (int)$id;
34 34
         //$template_class = 'CMS_Template_' . $this->value['type'];
35 35
 
36 36
         $this->error = new Intraface_Error();
@@ -184,16 +184,16 @@  discard block
 block discarded – undo
184 184
         if ($this->id == 0) {
185 185
             $sql_type = "INSERT INTO ";
186 186
             $sql_end = ", date_created = NOW(),
187
-                type_key = ".$var['type_key'] . ",
187
+                type_key = ".$var['type_key'].",
188 188
                 template_section_id = ".$var['template_section_id'];
189 189
         } else {
190 190
             $sql_type = "UPDATE ";
191
-            $sql_end = " WHERE id = " . $this->id;
191
+            $sql_end = " WHERE id = ".$this->id;
192 192
         }
193
-        $sql = $sql_type . " cms_section SET
193
+        $sql = $sql_type." cms_section SET
194 194
                 intranet_id = ".$this->cmspage->kernel->intranet->get('id').",
195
-                page_id=". (int)$this->cmspage->get('id') . ",
196
-                site_id=". (int)$this->cmspage->cmssite->get('id') . ",
195
+                page_id=". (int)$this->cmspage->get('id').",
196
+                site_id=". (int)$this->cmspage->cmssite->get('id').",
197 197
                 date_updated = NOW()
198 198
             " . $sql_end;
199 199
 
Please login to merge, or discard this patch.
src/Intraface/modules/cms/Template.php 1 patch
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -67,7 +67,7 @@  discard block
 block discarded – undo
67 67
 
68 68
     function getPosition($db)
69 69
     {
70
-        return new Ilib_Position($db, 'cms_template', $this->id, 'site_id = ' . $this->cmssite->get('id'), 'id', 'position');
70
+        return new Ilib_Position($db, 'cms_template', $this->id, 'site_id = '.$this->cmssite->get('id'), 'id', 'position');
71 71
     }
72 72
 
73 73
     /**
@@ -78,7 +78,7 @@  discard block
 block discarded – undo
78 78
         switch ($type) {
79 79
             case 'id':
80 80
                 $db = new DB_Sql;
81
-                $db->query("SELECT site_id, id FROM cms_template WHERE id = " . $id . " AND intranet_id = " . $kernel->intranet->get('id'));
81
+                $db->query("SELECT site_id, id FROM cms_template WHERE id = ".$id." AND intranet_id = ".$kernel->intranet->get('id'));
82 82
                 if (!$db->nextRecord()) {
83 83
                     return false;
84 84
                 }
@@ -97,7 +97,7 @@  discard block
 block discarded – undo
97 97
     function load()
98 98
     {
99 99
         $db = new DB_Sql;
100
-        $db->query("SELECT id, name, site_id, identifier, for_page_type FROM cms_template WHERE intranet_id = " . $this->cmssite->kernel->intranet->get('id') . " AND id = " . $this->id);
100
+        $db->query("SELECT id, name, site_id, identifier, for_page_type FROM cms_template WHERE intranet_id = ".$this->cmssite->kernel->intranet->get('id')." AND id = ".$this->id);
101 101
 
102 102
         if (!$db->nextRecord()) {
103 103
             return 0;
@@ -146,12 +146,12 @@  discard block
 block discarded – undo
146 146
         $db = new DB_Sql;
147 147
         if ($this->id > 0) {
148 148
             $sql_type = "UPDATE ";
149
-            $sql_end = " WHERE id = " . $this->id;
149
+            $sql_end = " WHERE id = ".$this->id;
150 150
         } else {
151 151
             $sql_type = "INSERT INTO ";
152 152
             $sql_end = ", date_created = NOW()";
153 153
         }
154
-        $db->query($sql_type . " cms_template SET
154
+        $db->query($sql_type." cms_template SET
155 155
             name = '".safeToDb($var['name'])."',
156 156
             date_updated = NOW(),
157 157
             intranet_id = ".safeToDb($this->cmssite->kernel->intranet->get('id')).",
@@ -179,7 +179,7 @@  discard block
 block discarded – undo
179 179
             $sql_extra = '';
180 180
         }
181 181
 
182
-        $db->query("SELECT id, name, identifier, for_page_type FROM cms_template WHERE ".$sql_extra." intranet_id = " . $this->cmssite->kernel->intranet->get('id') . " AND site_id = " . $this->cmssite->get('id') . " AND active = 1 ORDER BY name");
182
+        $db->query("SELECT id, name, identifier, for_page_type FROM cms_template WHERE ".$sql_extra." intranet_id = ".$this->cmssite->kernel->intranet->get('id')." AND site_id = ".$this->cmssite->get('id')." AND active = 1 ORDER BY name");
183 183
         $i = 0;
184 184
         $templates = array();
185 185
         while ($db->nextRecord()) {
@@ -212,14 +212,14 @@  discard block
 block discarded – undo
212 212
     function delete()
213 213
     {
214 214
         $db = new DB_Sql;
215
-        $db->query("UPDATE cms_template SET active = 0 WHERE id = " . $this->id);
215
+        $db->query("UPDATE cms_template SET active = 0 WHERE id = ".$this->id);
216 216
         return true;
217 217
     }
218 218
 
219 219
     function isIdentifierUnique($identifier)
220 220
     {
221 221
         $db = new DB_Sql;
222
-        $db->query("SELECT id FROM cms_template WHERE site_id = " . $this->cmssite->get('id') . " AND identifier = '".$identifier."' AND active = 1 AND id != " . $this->id);
222
+        $db->query("SELECT id FROM cms_template WHERE site_id = ".$this->cmssite->get('id')." AND identifier = '".$identifier."' AND active = 1 AND id != ".$this->id);
223 223
         if ($db->numRows() == 0) {
224 224
             return true;
225 225
         } else {
Please login to merge, or discard this patch.
src/Intraface/modules/cms/Parameter.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -79,7 +79,7 @@  discard block
 block discarded – undo
79 79
     public function save($parameter, $value)
80 80
     {
81 81
         if ($this->object->get('id') == 0) {
82
-            throw new Exception('Parameter::save() object cannot be 0 - problems in ' . get_class($this->object));
82
+            throw new Exception('Parameter::save() object cannot be 0 - problems in '.get_class($this->object));
83 83
         }
84 84
 
85 85
         # mangler noget validering - skal sikkert kunne s�ttes fra elementet?
@@ -91,13 +91,13 @@  discard block
 block discarded – undo
91 91
 
92 92
         // hvis parameteren tidligere er oprettet opdateres den!
93 93
         if (!empty($old_parameter)) {
94
-            $db->query("UPDATE cms_parameter SET value='".$value."' WHERE type_key = ".$this->type_key." AND intranet_id = ".$this->object->kernel->intranet->get('id')." AND belong_to_id=". $this->object->get('id') . " AND parameter='".$parameter."'");
94
+            $db->query("UPDATE cms_parameter SET value='".$value."' WHERE type_key = ".$this->type_key." AND intranet_id = ".$this->object->kernel->intranet->get('id')." AND belong_to_id=".$this->object->get('id')." AND parameter='".$parameter."'");
95 95
         } elseif (!empty($value) and empty($old_parameter)) {
96 96
             // hvis parameteren ikke findes oprettes den
97 97
             $db->query("INSERT INTO cms_parameter SET type_key=".$this->type_key.", belong_to_id = '".$this->object->get('id')."', parameter='".$parameter."', value='".$value."', intranet_id = ".$this->object->kernel->intranet->get('id'));
98 98
         } elseif (empty($value) and !empty($old_parameter)) {
99 99
             // hvis parametervvalue er tom skal den gamle parameter slettes
100
-            $db->query("DELETE FROM cms_parameter WHERE belong_to_id = '".$this->object->get('id')."' AND parameter='".$parameter."' AND intranet_id = ".$this->object->kernel->intranet->get('id') . " AND type_key =" .$this->type_key);
100
+            $db->query("DELETE FROM cms_parameter WHERE belong_to_id = '".$this->object->get('id')."' AND parameter='".$parameter."' AND intranet_id = ".$this->object->kernel->intranet->get('id')." AND type_key =".$this->type_key);
101 101
         }
102 102
 
103 103
         $this->load();
@@ -114,11 +114,11 @@  discard block
 block discarded – undo
114 114
     private function load()
115 115
     {
116 116
         if ($this->object->get('id') == 0) {
117
-            throw new Exception('Parameter::save() object cannot be 0 - problems with ' . get_class($this->object));
117
+            throw new Exception('Parameter::save() object cannot be 0 - problems with '.get_class($this->object));
118 118
         }
119 119
 
120 120
         $db = new DB_Sql;
121
-        $sql = "SELECT parameter, value FROM cms_parameter WHERE intranet_id = ".$this->object->kernel->intranet->get('id')." AND belong_to_id = " . $this->object->get('id') . " AND type_key = " . $this->type_key; //  . " AND parameter = '"  .$parameter . "'"
121
+        $sql = "SELECT parameter, value FROM cms_parameter WHERE intranet_id = ".$this->object->kernel->intranet->get('id')." AND belong_to_id = ".$this->object->get('id')." AND type_key = ".$this->type_key; //  . " AND parameter = '"  .$parameter . "'"
122 122
         $db->query($sql);
123 123
 
124 124
         while ($db->nextRecord()) {
Please login to merge, or discard this patch.
src/Intraface/modules/cms/Element.php 1 patch
Spacing   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -41,9 +41,9 @@  discard block
 block discarded – undo
41 41
      */
42 42
     function __construct($section, $id = 0)
43 43
     {
44
-        $this->value['identify_as'] = 'cms_element';  // bruges af parameter
44
+        $this->value['identify_as'] = 'cms_element'; // bruges af parameter
45 45
 
46
-        $this->id        = (int) $id;
46
+        $this->id        = (int)$id;
47 47
         $this->kernel    = $section->kernel;
48 48
         $this->section   = $section;
49 49
         $this->error     = new Intraface_Error;
@@ -63,7 +63,7 @@  discard block
 block discarded – undo
63 63
 
64 64
     function getPosition(DB_Sql $db)
65 65
     {
66
-        return new Ilib_Position($db, "cms_element", $this->id, "section_id=".$this->section->get('id')." AND active = 1 AND intranet_id = " . $this->kernel->intranet->get('id'), "position", "id");
66
+        return new Ilib_Position($db, "cms_element", $this->id, "section_id=".$this->section->get('id')." AND active = 1 AND intranet_id = ".$this->kernel->intranet->get('id'), "position", "id");
67 67
     }
68 68
 
69 69
     /**
@@ -125,7 +125,7 @@  discard block
 block discarded – undo
125 125
         }
126 126
 
127 127
         $db = new DB_Sql;
128
-        $db->query("SELECT id, section_id, date_expire, date_publish, type_key, position FROM cms_element WHERE intranet_id = ".$this->section->kernel->intranet->get('id')." AND id = " . $this->id);
128
+        $db->query("SELECT id, section_id, date_expire, date_publish, type_key, position FROM cms_element WHERE intranet_id = ".$this->section->kernel->intranet->get('id')." AND id = ".$this->id);
129 129
         if (!$db->nextRecord()) {
130 130
             return 0;
131 131
         }
@@ -147,7 +147,7 @@  discard block
 block discarded – undo
147 147
         $this->value['extra_class'] = '';
148 148
 
149 149
         if ($this->get('elm_width')) {
150
-            $this->value['extra_style'] .= 'width: ' . $this->get('elm_width') . ';';
150
+            $this->value['extra_style'] .= 'width: '.$this->get('elm_width').';';
151 151
         }
152 152
 
153 153
         if ($this->get('elm_properties') == 'float') {
@@ -161,7 +161,7 @@  discard block
 block discarded – undo
161 161
             $this->value['extra_style'] .= ' clear: both;';
162 162
         }
163 163
         if ($this->get('elm_adjust')) {
164
-            $this->value['extra_class'] .= ' cms-align-' . $this->get('elm_adjust');
164
+            $this->value['extra_class'] .= ' cms-align-'.$this->get('elm_adjust');
165 165
         }
166 166
 
167 167
         if ($this->get('elm_box') == 'box') {
@@ -237,11 +237,11 @@  discard block
 block discarded – undo
237 237
             $sql_end = ", date_created = NOW()";
238 238
         } else {
239 239
             $sql_type = "UPDATE ";
240
-            $sql_end = " WHERE id = " . $this->id;
240
+            $sql_end = " WHERE id = ".$this->id;
241 241
         }
242
-        $sql = $sql_type . " cms_element SET
242
+        $sql = $sql_type." cms_element SET
243 243
                 intranet_id = ".$this->section->kernel->intranet->get('id').",
244
-                section_id=". (int)$this->section->get('id') . ",
244
+                section_id=". (int)$this->section->get('id').",
245 245
                 type_key = ".safeToDb($this->value['type_key']).",
246 246
                 date_changed = NOW(),
247 247
                 date_publish = ".$date_publish.",
@@ -254,7 +254,7 @@  discard block
 block discarded – undo
254 254
             $this->id = $db->insertedId();
255 255
 
256 256
             $next_pos = $this->getPosition($db)->getMaxPosition() + 1;
257
-            $db->query("UPDATE cms_element SET position = " . $next_pos . " WHERE id = " . $this->id);
257
+            $db->query("UPDATE cms_element SET position = ".$next_pos." WHERE id = ".$this->id);
258 258
         }
259 259
 
260 260
         $this->load();
@@ -290,7 +290,7 @@  discard block
 block discarded – undo
290 290
     public function delete()
291 291
     {
292 292
         $db = new DB_Sql;
293
-        $db->query("UPDATE cms_element SET active = 0 WHERE id = " . $this->id);
293
+        $db->query("UPDATE cms_element SET active = 0 WHERE id = ".$this->id);
294 294
         return true;
295 295
     }
296 296
 
@@ -302,7 +302,7 @@  discard block
 block discarded – undo
302 302
     public function undelete()
303 303
     {
304 304
         $db = new DB_Sql;
305
-        $db->query("UPDATE cms_element SET active = 1 WHERE id = " . $this->id);
305
+        $db->query("UPDATE cms_element SET active = 1 WHERE id = ".$this->id);
306 306
         return true;
307 307
     }
308 308
 
Please login to merge, or discard this patch.