Completed
Branch master (6ed6e7)
by Lars
07:57
created
src/Intraface/modules/webshop/Basket.php 2 patches
Doc Comments   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -40,7 +40,7 @@  discard block
 block discarded – undo
40 40
      *
41 41
      * Konstrukt�ren s�rger ogs� for at rydde op i Kurven.
42 42
      *
43
-     * @param object $webshop    The webshop object
43
+     * @param Webshop $webshop    The webshop object
44 44
      * @param string $session_id A session id
45 45
      *
46 46
      * @return void
@@ -87,7 +87,7 @@  discard block
 block discarded – undo
87 87
      * @param integer $product_id Product to remove
88 88
      * @param integer $quantity   How many should be removed
89 89
      *
90
-     * @return boelean
90
+     * @return boolean
91 91
      */
92 92
     public function remove($product_id, $quantity = 1)
93 93
     {
Please login to merge, or discard this 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/webshop/FeaturedProducts.php 2 patches
Doc Comments   +2 added lines, -3 removed lines patch added patch discarded remove patch
@@ -15,7 +15,7 @@  discard block
 block discarded – undo
15 15
     private $intranet;
16 16
 
17 17
     /**
18
-     * @param object $intranet Headline
18
+     * @param Intraface_Intranet $intranet Headline
19 19
      * @param object $db       Databaseobject
20 20
      *
21 21
      * @return integer
@@ -27,10 +27,9 @@  discard block
 block discarded – undo
27 27
     }
28 28
 
29 29
     /**
30
-     * @param string $headline Headline
31 30
      * @param object $keyword  Keyword object
32 31
      *
33
-     * @return integer
32
+     * @return boolean
34 33
      */
35 34
     function add($description, $keyword)
36 35
     {
Please login to merge, or discard this patch.
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -34,7 +34,7 @@  discard block
 block discarded – undo
34 34
      */
35 35
     function add($description, $keyword)
36 36
     {
37
-        $result = $this->db->query('SELECT id FROM shop_featuredproducts WHERE intranet_id = ' . $this->db->quote($this->intranet->getId(), 'integer') . ' AND keyword_id  = ' . $this->db->quote($keyword->getId(), 'integer'));
37
+        $result = $this->db->query('SELECT id FROM shop_featuredproducts WHERE intranet_id = '.$this->db->quote($this->intranet->getId(), 'integer').' AND keyword_id  = '.$this->db->quote($keyword->getId(), 'integer'));
38 38
         if (PEAR::isError($result)) {
39 39
             throw new Exception($result->getUserInfo());
40 40
         }
@@ -61,7 +61,7 @@  discard block
 block discarded – undo
61 61
      */
62 62
     function delete($id)
63 63
     {
64
-        $result = $this->db->query('DELETE FROM shop_featuredproducts WHERE intranet_id = ' . $this->db->quote($this->intranet->getId(), 'integer') . ' AND id  = ' . $this->db->quote($id, 'integer'));
64
+        $result = $this->db->query('DELETE FROM shop_featuredproducts WHERE intranet_id = '.$this->db->quote($this->intranet->getId(), 'integer').' AND id  = '.$this->db->quote($id, 'integer'));
65 65
         if (PEAR::isError($result)) {
66 66
             throw new Exception($result->getUserInfo());
67 67
         }
@@ -70,7 +70,7 @@  discard block
 block discarded – undo
70 70
 
71 71
     function getAll()
72 72
     {
73
-        $result = $this->db->query('SELECT * FROM shop_featuredproducts WHERE intranet_id = ' . $this->db->quote($this->intranet->getId(), 'integer'));
73
+        $result = $this->db->query('SELECT * FROM shop_featuredproducts WHERE intranet_id = '.$this->db->quote($this->intranet->getId(), 'integer'));
74 74
         if (PEAR::isError($result)) {
75 75
             throw new Exception($result->getUserInfo());
76 76
         }
Please login to merge, or discard this patch.
src/Intraface/modules/webshop/Webshop.php 3 patches
Doc Comments   +3 added lines, -4 removed lines patch added patch discarded remove patch
@@ -53,7 +53,7 @@  discard block
 block discarded – undo
53 53
     /**
54 54
      * Construktor
55 55
      *
56
-     * @param object $kernel     Kernel object
56
+     * @param Intraface_Kernel $kernel     Kernel object
57 57
      * @param string $session_id Unikt session id
58 58
      *
59 59
      * @return void
@@ -79,7 +79,7 @@  discard block
 block discarded – undo
79 79
     /**
80 80
      * Convenience method to create the basket
81 81
      *
82
-     * @return object
82
+     * @return Basket
83 83
      */
84 84
     private function createBasket()
85 85
     {
@@ -321,9 +321,8 @@  discard block
 block discarded – undo
321 321
      * @param integer $order_id
322 322
      * @param integer $transaction_number
323 323
      * @param integer $transaction_status
324
-     * @param float   $transaction_amount
325 324
      *
326
-     * @return boolean
325
+     * @return integer
327 326
      */
328 327
     public function addOnlinePayment($order_id, $transaction_number, $transaction_status, $amount)
329 328
     {
Please login to merge, or discard this patch.
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -184,12 +184,12 @@  discard block
 block discarded – undo
184 184
 
185 185
         if (isset($input['customer_coupon']) && $input['customer_coupon'] != '') {
186 186
             if ($value['message'] != '') $value['message'] .= "\n\n";
187
-            $value['message'] .= "Kundekupon:". $input['customer_coupon'];
187
+            $value['message'] .= "Kundekupon:".$input['customer_coupon'];
188 188
         }
189 189
 
190 190
         if (isset($input['customer_comment']) && $input['customer_comment'] != '') {
191 191
             if ($value['message'] != '') $value['message'] .= "\n\n";
192
-            $value['message'] .= "Kommentar:\n". $input['customer_comment'];
192
+            $value['message'] .= "Kommentar:\n".$input['customer_comment'];
193 193
         }
194 194
 
195 195
 
@@ -297,8 +297,8 @@  discard block
 block discarded – undo
297 297
         $email = new Email($this->kernel);
298 298
 
299 299
         if (!$email->save(array('contact_id' => $this->contact->get('id'),
300
-                                'subject' => 'Bekræftelse på bestilling #' . $order_id,
301
-                                'body' => $this->kernel->setting->get('intranet', 'webshop.confirmation_text') . "\n" . $this->contact->getLoginUrl() . "\n\nVenlig hilsen\n" . $this->kernel->intranet->address->get('name'),
300
+                                'subject' => 'Bekræftelse på bestilling #'.$order_id,
301
+                                'body' => $this->kernel->setting->get('intranet', 'webshop.confirmation_text')."\n".$this->contact->getLoginUrl()."\n\nVenlig hilsen\n".$this->kernel->intranet->address->get('name'),
302 302
                                 'from_email' => $this->kernel->intranet->address->get('email'),
303 303
                                 'from_name' => $this->kernel->intranet->address->get('name'),
304 304
                                 'type_id' => 12, // webshop
@@ -366,7 +366,7 @@  discard block
 block discarded – undo
366 366
      */
367 367
     public function getReceiptText()
368 368
     {
369
-        return array('receipt_text' => $this->kernel->setting->get('intranet','webshop.webshop_receipt'));
369
+        return array('receipt_text' => $this->kernel->setting->get('intranet', 'webshop.webshop_receipt'));
370 370
     }
371 371
 
372 372
     /**
Please login to merge, or discard this patch.
Braces   +6 added lines, -2 removed lines patch added patch discarded remove patch
@@ -183,12 +183,16 @@
 block discarded – undo
183 183
         $value['message'] = $input['message'];
184 184
 
185 185
         if (isset($input['customer_coupon']) && $input['customer_coupon'] != '') {
186
-            if ($value['message'] != '') $value['message'] .= "\n\n";
186
+            if ($value['message'] != '') {
187
+                $value['message'] .= "\n\n";
188
+            }
187 189
             $value['message'] .= "Kundekupon:". $input['customer_coupon'];
188 190
         }
189 191
 
190 192
         if (isset($input['customer_comment']) && $input['customer_comment'] != '') {
191
-            if ($value['message'] != '') $value['message'] .= "\n\n";
193
+            if ($value['message'] != '') {
194
+                $value['message'] .= "\n\n";
195
+            }
192 196
             $value['message'] .= "Kommentar:\n". $input['customer_comment'];
193 197
         }
194 198
 
Please login to merge, or discard this patch.
src/Intraface/Pdf.php 3 patches
Doc Comments   +2 added lines, -1 removed lines patch added patch discarded remove patch
@@ -137,7 +137,7 @@  discard block
 block discarded – undo
137 137
      *
138 138
      * @param string $headerImg The filepath for the header image
139 139
      *
140
-     * @return void
140
+     * @return false|null
141 141
      */
142 142
     public function addHeader($headerImg = '')
143 143
     {
@@ -191,6 +191,7 @@  discard block
 block discarded – undo
191 191
      * write the document to a file
192 192
      *
193 193
      * @param string $data The data to write
194
+     * @param string $filnavn
194 195
      *
195 196
      * @return void
196 197
      */
Please login to merge, or discard this patch.
Indentation   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -42,11 +42,11 @@  discard block
 block discarded – undo
42 42
         // Notice that the placement of the characters are different in the two tables. Placement is correct in the first.
43 43
         
44 44
         $diff = array(230 => 'ae',
45
-                      198 => 'AE',
46
-                      248 => 'oslash',
47
-                      216 => 'Oslash',
48
-                      229 => 'aring',
49
-                      197 => 'Aring');
45
+                        198 => 'AE',
46
+                        248 => 'oslash',
47
+                        216 => 'Oslash',
48
+                        229 => 'aring',
49
+                        197 => 'Aring');
50 50
 
51 51
         parent::selectFont('Helvetica.afm', array('differences' => $diff));
52 52
 
@@ -162,7 +162,7 @@  discard block
 block discarded – undo
162 162
         $this->setY(0);
163 163
     }
164 164
 
165
-   /**
165
+    /**
166 166
      * create a round rectangle
167 167
      *
168 168
      * @param integer $x      The starting x point
@@ -187,7 +187,7 @@  discard block
 block discarded – undo
187 187
         parent::partEllipse($x+$width-$round, $y+$round, 270, 360, $round);
188 188
     }
189 189
 
190
-   /**
190
+    /**
191 191
      * write the document to a file
192 192
      *
193 193
      * @param string $data The data to write
Please login to merge, or discard this patch.
Spacing   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -104,7 +104,7 @@  discard block
 block discarded – undo
104 104
         if (is_int($value)) {
105 105
             $this->value['x'] = $this->get('margin_left') + $value;
106 106
         } elseif (is_string($value) && substr($value, 0, 1) == "+") {
107
-            $this->value['x'] +=  intval(substr($value, 1));
107
+            $this->value['x'] += intval(substr($value, 1));
108 108
         } elseif (is_string($value) && substr($value, 0, 1) == "-") {
109 109
             $this->value['x'] -= intval(substr($value, 1));
110 110
         } else {
@@ -148,12 +148,12 @@  discard block
 block discarded – undo
148 148
         $header = parent::openObject();
149 149
         $size = getImageSize($headerImg); // array(0 => width, 1 => height)
150 150
 
151
-        $height = $this->get('header_height');;
152
-        $width = $size[0] * ($height/$size[1]);
151
+        $height = $this->get('header_height'); ;
152
+        $width = $size[0]*($height/$size[1]);
153 153
 
154 154
         if ($width > $this->get('content_width')) {
155 155
             $width = $this->get('content_width');
156
-            $height = $size[1] * ($width/$size[0]);
156
+            $height = $size[1]*($width/$size[0]);
157 157
         }
158 158
         parent::addJpegFromFile($headerImg, $this->get('right_margin_position') - $width, $this->page_height - $this->get('header_margin_top') - $height, $width, $height); // , ($this->value["page_width"] - $this->value["margin_left"])/10
159 159
         parent::closeObject();
@@ -176,15 +176,15 @@  discard block
 block discarded – undo
176 176
     public function roundRectangle($x, $y, $width, $height, $round)
177 177
     {
178 178
         parent::setLineStyle(1);
179
-        parent::line($x, $y+$round, $x, $y+$height-$round);
180
-        parent::line($x+$round, $y+$height, $x+$width-$round, $y+$height);
181
-        parent::line($x+$width, $y+$height-$round, $x+$width, $y+$round-1);
182
-        parent::line($x+$width-$round, $y, $x+$round, $y);
183
-
184
-        parent::partEllipse($x+$round, $y+$round,180, 270, $round);
185
-        parent::partEllipse($x+$round, $y+$height-$round, 90, 180, $round);
186
-        parent::partEllipse($x+$width-$round, $y+$height-$round, 0, 90, $round);
187
-        parent::partEllipse($x+$width-$round, $y+$round, 270, 360, $round);
179
+        parent::line($x, $y + $round, $x, $y + $height - $round);
180
+        parent::line($x + $round, $y + $height, $x + $width - $round, $y + $height);
181
+        parent::line($x + $width, $y + $height - $round, $x + $width, $y + $round - 1);
182
+        parent::line($x + $width - $round, $y, $x + $round, $y);
183
+
184
+        parent::partEllipse($x + $round, $y + $round, 180, 270, $round);
185
+        parent::partEllipse($x + $round, $y + $height - $round, 90, 180, $round);
186
+        parent::partEllipse($x + $width - $round, $y + $height - $round, 0, 90, $round);
187
+        parent::partEllipse($x + $width - $round, $y + $round, 270, 360, $round);
188 188
     }
189 189
 
190 190
    /**
Please login to merge, or discard this patch.
src/Intraface/Shared.php 1 patch
Doc Comments   +4 added lines patch added patch discarded remove patch
@@ -59,6 +59,9 @@  discard block
 block discarded – undo
59 59
         return $this->controlpanel_files;
60 60
     }
61 61
 
62
+    /**
63
+     * @param string $file
64
+     */
62 65
     function addPreloadFile($file)
63 66
     {
64 67
         $this->preload_file[] = $file;
@@ -81,6 +84,7 @@  discard block
 block discarded – undo
81 84
 
82 85
     /**
83 86
      * @todo why is this not using getPath()
87
+     * @param string $file
84 88
      */
85 89
     function includeSettingFile($file)
86 90
     {
Please login to merge, or discard this patch.
src/Intraface/shared/email/Email.php 2 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -351,7 +351,7 @@
 block discarded – undo
351 351
      * @param integer $file_id  Id of file in the file system
352 352
      * @param string  $filename Which filename to use
353 353
      *
354
-     * @return boolean
354
+     * @return integer
355 355
      */
356 356
     function attachFile($file_id, $filename)
357 357
     {
Please login to merge, or discard this patch.
Spacing   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -81,7 +81,7 @@  discard block
 block discarded – undo
81 81
 
82 82
         $db = new DB_Sql;
83 83
         $db->query('SET NAMES utf8'); /* To be removed when everything is in utf-8 */
84
-        $sql = "SELECT id, email.date_sent, DATE_FORMAT(date_sent, '%d-%m-%Y') as date_sent_dk, subject, from_name, from_email, user_id, body, status, contact_id, contact_person_id, type_id, belong_to_id, status, bcc_to_user FROM email WHERE intranet_id = ".$this->kernel->intranet->get('id')." AND id = " . $this->id;
84
+        $sql = "SELECT id, email.date_sent, DATE_FORMAT(date_sent, '%d-%m-%Y') as date_sent_dk, subject, from_name, from_email, user_id, body, status, contact_id, contact_person_id, type_id, belong_to_id, status, bcc_to_user FROM email WHERE intranet_id = ".$this->kernel->intranet->get('id')." AND id = ".$this->id;
85 85
         $db->query($sql);
86 86
         if (!$db->nextRecord()) {
87 87
             return false;
@@ -174,12 +174,12 @@  discard block
 block discarded – undo
174 174
         if ($this->id == 0) {
175 175
             $sql_type = "INSERT INTO ";
176 176
             $sql_end = ", date_created = NOW(),
177
-                belong_to_id = ".(int)$var['belong_to'] . ",
178
-                type_id = ".(int)$var['type_id'] . ",
177
+                belong_to_id = ".(int)$var['belong_to'].",
178
+                type_id = ".(int)$var['type_id'].",
179 179
                 contact_id=".$var['contact_id'];
180 180
         } else {
181 181
             $sql_type = "UPDATE ";
182
-            $sql_end = " WHERE id = " . $this->id;
182
+            $sql_end = " WHERE id = ".$this->id;
183 183
         }
184 184
 
185 185
         if (!empty($var['date_deadline'])) {
@@ -191,7 +191,7 @@  discard block
 block discarded – undo
191 191
         // gemme userid hvis vi er inde i systemet
192 192
         if (is_object($this->kernel->user) AND $this->kernel->user->get('id') > 0) {
193 193
             //$db->query("UPDATE email SET user_id = ".$this->kernel->user->get('id')." WHERE id = " . $this->id);
194
-            $sql_extra = ', user_id = ' . $db->quote($this->kernel->user->get('id'), 'integer');
194
+            $sql_extra = ', user_id = '.$db->quote($this->kernel->user->get('id'), 'integer');
195 195
         }
196 196
 
197 197
         if (!isset($var['contact_person_id'])) {
@@ -203,11 +203,11 @@  discard block
 block discarded – undo
203 203
         }
204 204
 
205 205
         // status 1 = draft
206
-        $sql = $sql_type . " email SET
206
+        $sql = $sql_type." email SET
207 207
             contact_person_id = ".(int)$var['contact_person_id'].",
208 208
             bcc_to_user = ".(int)$var['bcc_to_user'].",
209 209
             date_updated = NOW(),
210
-            intranet_id = " . $this->kernel->intranet->get('id') . ",
210
+            intranet_id = " . $this->kernel->intranet->get('id').",
211 211
             subject = '".$var['subject']."',
212 212
             body = '".$var['body']."',
213 213
             date_deadline = ".$date_deadline.",
@@ -245,7 +245,7 @@  discard block
 block discarded – undo
245 245
     function saveErrorMsg($error)
246 246
     {
247 247
         $db = new DB_Sql;
248
-        $db->query("UPDATE email SET error_msg = '".$error."' WHERE id = " . $this->id);
248
+        $db->query("UPDATE email SET error_msg = '".$error."' WHERE id = ".$this->id);
249 249
         return true;
250 250
     }
251 251
 
@@ -260,7 +260,7 @@  discard block
 block discarded – undo
260 260
             return false;
261 261
         }
262 262
         $db = new DB_Sql;
263
-        $db->query("UPDATE email SET status = 3, date_sent = NOW() WHERE id = " . $this->id);
263
+        $db->query("UPDATE email SET status = 3, date_sent = NOW() WHERE id = ".$this->id);
264 264
         return true;
265 265
     }
266 266
 
@@ -291,7 +291,7 @@  discard block
 block discarded – undo
291 291
 
292 292
         $db = new DB_Sql;
293 293
         // Putter e-mailen i outboxen (status = 2)
294
-        $db->query("UPDATE email SET status = 2 WHERE intranet_id = ".$this->kernel->intranet->get('id')." AND id = " . $this->id);
294
+        $db->query("UPDATE email SET status = 2 WHERE intranet_id = ".$this->kernel->intranet->get('id')." AND id = ".$this->id);
295 295
         return true;
296 296
     }
297 297
 
@@ -299,7 +299,7 @@  discard block
 block discarded – undo
299 299
     {
300 300
         $contact = $this->getContact();
301 301
         if ($this->get('contact_id') == 0 OR !is_object($contact)) {
302
-            $this->error->set('Der kunne ikke sendes e-mail til email #' . $this->get('id') . ' fordi der ikke var nogen kunde sat');
302
+            $this->error->set('Der kunne ikke sendes e-mail til email #'.$this->get('id').' fordi der ikke var nogen kunde sat');
303 303
             return false;
304 304
         }
305 305
 
@@ -383,7 +383,7 @@  discard block
 block discarded – undo
383 383
     {
384 384
         $db = new DB_Sql;
385 385
         $db->query("SELECT file_id, filename FROM email_attachment
386
-            WHERE intranet_id = " .$this->kernel->intranet->get('id') . " AND email_id = " . $this->id);
386
+            WHERE intranet_id = " .$this->kernel->intranet->get('id')." AND email_id = ".$this->id);
387 387
         $file = array();
388 388
         $i = 0;
389 389
         while ($db->nextRecord()) {
@@ -415,7 +415,7 @@  discard block
 block discarded – undo
415 415
             return false;
416 416
         }
417 417
         $db = new DB_Sql;
418
-        $db->query("DELETE FROM email WHERE id = " . $this->id . " AND intranet_id = " . $this->kernel->intranet->get('id'));
418
+        $db->query("DELETE FROM email WHERE id = ".$this->id." AND intranet_id = ".$this->kernel->intranet->get('id'));
419 419
         return true;
420 420
     }
421 421
 
Please login to merge, or discard this patch.
src/Intraface/shared/keyword/Keyword.php 3 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -273,7 +273,7 @@
 block discarded – undo
273 273
     /**
274 274
      * Adds keyword to object
275 275
      *
276
-     * @param integer $keyword_id
276
+     * @param integer $keyword
277 277
      *
278 278
      * @return boolean
279 279
      */
Please login to merge, or discard this patch.
Spacing   +19 added lines, -19 removed lines patch added patch discarded remove patch
@@ -63,7 +63,7 @@  discard block
 block discarded – undo
63 63
         $condition['keyword.type'] = $this->type;
64 64
 
65 65
         foreach ($condition as $column => $value) {
66
-            $c[] = $column . " = '" . $value . "'";
66
+            $c[] = $column." = '".$value."'";
67 67
         }
68 68
 
69 69
         $db = new DB_Sql;
@@ -127,7 +127,7 @@  discard block
 block discarded – undo
127 127
         $condition['active'] = 1;
128 128
 
129 129
         foreach ($condition as $column => $value) {
130
-            $c[] = $column . " = '" . $value . "'";
130
+            $c[] = $column." = '".$value."'";
131 131
         }
132 132
 
133 133
         $db = new DB_Sql;
@@ -148,11 +148,11 @@  discard block
 block discarded – undo
148 148
             $condition['type'] = $this->type;
149 149
 
150 150
             foreach ($condition as $column => $value) {
151
-                $c[] = $column . " = '" . $value . "'";
151
+                $c[] = $column." = '".$value."'";
152 152
             }
153 153
 
154 154
             $sql_type = 'UPDATE ';
155
-            $sql_end = ' WHERE ' . implode(' AND ', $c);
155
+            $sql_end = ' WHERE '.implode(' AND ', $c);
156 156
 
157 157
         } else {
158 158
             $c = array();
@@ -161,14 +161,14 @@  discard block
 block discarded – undo
161 161
             $condition['type'] = $this->type;
162 162
 
163 163
             foreach ($condition as $column => $value) {
164
-                $c[] = $column . " = '" . $value . "'";
164
+                $c[] = $column." = '".$value."'";
165 165
             }
166 166
 
167 167
             $sql_type = "INSERT INTO ";
168
-            $sql_end = ", " . implode(', ', $c);
168
+            $sql_end = ", ".implode(', ', $c);
169 169
         }
170 170
 
171
-        $sql = $sql_type . "keyword SET keyword = '".$var['keyword']."'" . $sql_end;
171
+        $sql = $sql_type."keyword SET keyword = '".$var['keyword']."'".$sql_end;
172 172
         $db->query($sql);
173 173
 
174 174
         if ($this->id == 0) {
@@ -193,7 +193,7 @@  discard block
 block discarded – undo
193 193
         $condition['id'] = $this->id;
194 194
         $condition['type'] = $this->type;
195 195
         foreach ($condition as $column => $value) {
196
-            $c[] = $column . " = '" . $value . "'";
196
+            $c[] = $column." = '".$value."'";
197 197
         }
198 198
 
199 199
         $db = new DB_Sql;
@@ -216,11 +216,11 @@  discard block
 block discarded – undo
216 216
         $condition['keyword.type'] = $this->type;
217 217
         $condition['keyword.active'] = 1;
218 218
         foreach ($condition as $column => $value) {
219
-            $c[] = $column . " = '" . $value . "'";
219
+            $c[] = $column." = '".$value."'";
220 220
         }
221 221
 
222 222
         $sql = "SELECT * FROM keyword
223
-            WHERE " . implode(' AND ', $c) . "
223
+            WHERE " . implode(' AND ', $c)."
224 224
             ORDER BY keyword ASC";
225 225
         $db = new DB_Sql;
226 226
         $db->query($sql);
@@ -284,7 +284,7 @@  discard block
 block discarded – undo
284 284
         $condition['keyword_x_object.belong_to'] = $this->getBelongToId();
285 285
 
286 286
         foreach ($condition as $column => $value) {
287
-            $c[] = $column . " = '" . $value . "'";
287
+            $c[] = $column." = '".$value."'";
288 288
         }
289 289
 
290 290
         $sql = "SELECT * FROM keyword_x_object
@@ -335,7 +335,7 @@  discard block
 block discarded – undo
335 335
         $condition['keyword.active'] = 1;
336 336
 
337 337
         foreach ($condition as $column => $value) {
338
-            $c[] = $column . " = '" . $value . "'";
338
+            $c[] = $column." = '".$value."'";
339 339
         }
340 340
 
341 341
         $db = new DB_Sql;
@@ -343,7 +343,7 @@  discard block
 block discarded – undo
343 343
             FROM keyword_x_object x
344 344
             INNER JOIN keyword keyword
345 345
                 ON x.keyword_id = keyword.id
346
-            WHERE " . implode(' AND ', $c) . "
346
+            WHERE " . implode(' AND ', $c)."
347 347
             ORDER BY keyword ASC");
348 348
 
349 349
         $i = 0;
@@ -376,7 +376,7 @@  discard block
 block discarded – undo
376 376
         $condition['keyword_x_object.belong_to'] = $this->getBelongToId();
377 377
 
378 378
         foreach ($condition as $column => $value) {
379
-            $c[] = $column . " = '" . $value . "'";
379
+            $c[] = $column." = '".$value."'";
380 380
         }
381 381
 
382 382
         $db = new DB_Sql;
@@ -384,7 +384,7 @@  discard block
 block discarded – undo
384 384
                 FROM keyword_x_object
385 385
                 INNER JOIN keyword
386 386
                     ON keyword_x_object.keyword_id = keyword.id
387
-                WHERE " . implode(' AND ', $c) . " AND keyword.keyword != ''
387
+                WHERE " . implode(' AND ', $c)." AND keyword.keyword != ''
388 388
                 ORDER BY keyword.keyword";
389 389
         $db->query($sql);
390 390
 
@@ -416,7 +416,7 @@  discard block
 block discarded – undo
416 416
         $condition['keyword_x_object.belong_to'] = $this->getBelongToId();
417 417
 
418 418
         foreach ($condition as $column => $value) {
419
-            $c[] = $column . " = '" . $value . "'";
419
+            $c[] = $column." = '".$value."'";
420 420
         }
421 421
 
422 422
 
@@ -494,7 +494,7 @@  discard block
 block discarded – undo
494 494
      *
495 495
      * @return array with keywords
496 496
      */
497
-    public static function quotesplit($s, $splitter=',')
497
+    public static function quotesplit($s, $splitter = ',')
498 498
     {
499 499
         //First step is to split it up into the bits that are surrounded by quotes and the bits that aren't. Adding the delimiter to the ends simplifies the logic further down
500 500
         $getstrings = explode('\"', $splitter.$s.$splitter);
@@ -504,7 +504,7 @@  discard block
 block discarded – undo
504 504
         $result = array();
505 505
 
506 506
         while (list($arg, $val) = each($getstrings)) {
507
-            if ($instring==1) {
507
+            if ($instring == 1) {
508 508
                 //Add the whole string, untouched to the result array.
509 509
                 if (!empty($val)) {
510 510
                     $result[] = $val;
@@ -513,7 +513,7 @@  discard block
 block discarded – undo
513 513
             } else {
514 514
                 //Break up the string according to the delimiter character
515 515
                 //Each string has extraneous delimiters around it (inc the ones we added above), so they need to be stripped off
516
-                $temparray = explode($splitter, substr($val, $delimlen, strlen($val)-$delimlen-$delimlen ) );
516
+                $temparray = explode($splitter, substr($val, $delimlen, strlen($val) - $delimlen - $delimlen));
517 517
 
518 518
                 while (list($iarg, $ival) = each($temparray)) {
519 519
                     if (!empty($ival)) $result[] = trim($ival);
Please login to merge, or discard this patch.
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -516,7 +516,9 @@
 block discarded – undo
516 516
                 $temparray = explode($splitter, substr($val, $delimlen, strlen($val)-$delimlen-$delimlen ) );
517 517
 
518 518
                 while (list($iarg, $ival) = each($temparray)) {
519
-                    if (!empty($ival)) $result[] = trim($ival);
519
+                    if (!empty($ival)) {
520
+                        $result[] = trim($ival);
521
+                    }
520 522
                 }
521 523
                 $instring = 1;
522 524
             }
Please login to merge, or discard this patch.
src/Intraface/User.php 3 patches
Doc Comments   +4 added lines, -3 removed lines patch added patch discarded remove patch
@@ -104,7 +104,7 @@  discard block
 block discarded – undo
104 104
     /**
105 105
      * Load
106 106
      *
107
-     * @return void
107
+     * @return integer
108 108
      */
109 109
     protected function load()
110 110
     {
@@ -256,7 +256,7 @@  discard block
 block discarded – undo
256 256
      * @param integer $module
257 257
      * @param integer $intranet_id
258 258
      *
259
-     * @return integer
259
+     * @return boolean
260 260
      */
261 261
     public function hasModuleAccess($module, $intranet_id = 0)
262 262
     {
@@ -459,6 +459,7 @@  discard block
 block discarded – undo
459 459
     /**
460 460
      * Sets active intranet_id
461 461
      *
462
+     * @param integer $id
462 463
      * @return boolean
463 464
      */
464 465
     public function setActiveIntranetId($id)
@@ -500,7 +501,7 @@  discard block
 block discarded – undo
500 501
      *
501 502
      * @param array $input
502 503
      *
503
-     * @return boolean
504
+     * @return boolean|null
504 505
      */
505 506
     protected function validate(&$input)
506 507
     {
Please login to merge, or discard this patch.
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -200,7 +200,7 @@
 block discarded – undo
200 200
         if (!empty($this->modules[$module])) {
201 201
             return $module_id = $this->modules[$module];
202 202
         } else {
203
-           throw new Exception('user says unknown module ' . $module);
203
+            throw new Exception('user says unknown module ' . $module);
204 204
         }
205 205
     }
206 206
 
Please login to merge, or discard this patch.
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -85,7 +85,7 @@  discard block
 block discarded – undo
85 85
         $this->error       = $this->getError();
86 86
 
87 87
         if (PEAR::isError($this->db)) {
88
-            throw new Exception($this->db->getMessage() . $this->db->getUserInfo());
88
+            throw new Exception($this->db->getMessage().$this->db->getUserInfo());
89 89
         }
90 90
 
91 91
         if ($this->id > 0) {
@@ -108,7 +108,7 @@  discard block
 block discarded – undo
108 108
      */
109 109
     protected function load()
110 110
     {
111
-        $result = $this->db->query("SELECT id, email, disabled FROM user WHERE id = " . $this->db->quote($this->id, 'integer'));
111
+        $result = $this->db->query("SELECT id, email, disabled FROM user WHERE id = ".$this->db->quote($this->id, 'integer'));
112 112
 
113 113
         if (PEAR::isError($result)) {
114 114
             throw new Exception($result->getUserInfo());
@@ -200,7 +200,7 @@  discard block
 block discarded – undo
200 200
         if (!empty($this->modules[$module])) {
201 201
             return $module_id = $this->modules[$module];
202 202
         } else {
203
-           throw new Exception('user says unknown module ' . $module);
203
+           throw new Exception('user says unknown module '.$module);
204 204
         }
205 205
     }
206 206
 
@@ -260,7 +260,7 @@  discard block
 block discarded – undo
260 260
      */
261 261
     public function hasModuleAccess($module, $intranet_id = 0)
262 262
     {
263
-        $filename = PATH_INCLUDE_MODULE . $module . '/Main' . ucfirst($module) . '.php';
263
+        $filename = PATH_INCLUDE_MODULE.$module.'/Main'.ucfirst($module).'.php';
264 264
         if (file_exists($filename)) {
265 265
             require_once $filename;
266 266
             $module_class = 'Main'.ucfirst($module);
@@ -465,7 +465,7 @@  discard block
 block discarded – undo
465 465
     {
466 466
         $id = intval($id);
467 467
         if ($this->hasIntranetAccess($id)) {
468
-            $this->db->exec("UPDATE user SET active_intranet_id = ". $this->db->quote($id, 'integer')." WHERE id = ". $this->db->quote($this->get('id'), 'integer'));
468
+            $this->db->exec("UPDATE user SET active_intranet_id = ".$this->db->quote($id, 'integer')." WHERE id = ".$this->db->quote($this->get('id'), 'integer'));
469 469
             return $id;
470 470
         }
471 471
         return false;
@@ -569,7 +569,7 @@  discard block
 block discarded – undo
569 569
         $row = $result->fetchRow(MDB2_FETCHMODE_ASSOC);
570 570
         $new_password = Intraface_Kernel::randomKey(8);
571 571
 
572
-        $db->exec("UPDATE user SET password = '".md5($new_password)."' WHERE id =" . $row['id']);
572
+        $db->exec("UPDATE user SET password = '".md5($new_password)."' WHERE id =".$row['id']);
573 573
 
574 574
         return $new_password;
575 575
     }
@@ -580,7 +580,7 @@  discard block
 block discarded – undo
580 580
             return false;
581 581
         }
582 582
 
583
-        $result = $this->db->query("SELECT * FROM user WHERE password = '".safeToDb(md5($old_password))."' AND id = " . $this->get('id'));
583
+        $result = $this->db->query("SELECT * FROM user WHERE password = '".safeToDb(md5($old_password))."' AND id = ".$this->get('id'));
584 584
         if ($result->numRows() < 1) {
585 585
             $this->error->set('error in old password');
586 586
         }
@@ -596,7 +596,7 @@  discard block
 block discarded – undo
596 596
             return false;
597 597
         }
598 598
 
599
-        $this->db->query("UPDATE user SET password = '".safeToDb(md5($new_password))."' WHERE id = " . $this->get('id'));
599
+        $this->db->query("UPDATE user SET password = '".safeToDb(md5($new_password))."' WHERE id = ".$this->get('id'));
600 600
 
601 601
         return true;
602 602
 
Please login to merge, or discard this patch.
src/Intraface/Weblogin.php 2 patches
Doc Comments   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -25,8 +25,8 @@
 block discarded – undo
25 25
     /**
26 26
      * Constructor
27 27
      *
28
-     * @param $session_id Session id
29
-     * @param $intranet   Intranet
28
+     * @param string $session_id Session id
29
+     * @param Intraface_Intranet $intranet   Intranet
30 30
      *
31 31
      * @return void
32 32
      */
Please login to merge, or discard this patch.
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -53,7 +53,7 @@
 block discarded – undo
53 53
 
54 54
     function hasModuleAccess($modulename)
55 55
     {
56
-		return $this->intranet->hasModuleAccess($modulename);
56
+        return $this->intranet->hasModuleAccess($modulename);
57 57
     }
58 58
 
59 59
     function hasIntranetAccess($intranet_id)
Please login to merge, or discard this patch.