Completed
Branch master (6ed6e7)
by Lars
07:57
created
src/Intraface/modules/accounting/YearEnd.php 2 patches
Doc Comments   +11 added lines patch added patch discarded remove patch
@@ -73,6 +73,9 @@  discard block
 block discarded – undo
73 73
         return true;
74 74
     }
75 75
 
76
+    /**
77
+     * @param string $action
78
+     */
76 79
     function setStated($action, $voucher_id)
77 80
     {
78 81
         $db = new DB_Sql;
@@ -106,6 +109,7 @@  discard block
 block discarded – undo
106 109
      * credit-konto
107 110
      * amount
108 111
      *
112
+     * @param string $action
109 113
      */
110 114
     function saveStatedAction($action, $voucher_id, $debet_account_id, $credit_account_id, $amount)
111 115
     {
@@ -121,6 +125,9 @@  discard block
 block discarded – undo
121 125
         return true;
122 126
     }
123 127
 
128
+    /**
129
+     * @param string $action
130
+     */
124 131
     function getStatedActions($action)
125 132
     {
126 133
         $db = new DB_Sql;
@@ -154,6 +161,7 @@  discard block
 block discarded – undo
154 161
      * bør vel egentlig ikke være muligt! Måske kan man forestille sig, at den så bare
155 162
      * gemmer videre og at den ved get lægger tallene i amount sammen?
156 163
      *
164
+     * @param string $type
157 165
      */
158 166
     function saveStatement($type)
159 167
     {
@@ -199,6 +207,9 @@  discard block
 block discarded – undo
199 207
         return new Account($this->year, $id);
200 208
     }
201 209
 
210
+    /**
211
+     * @param string $type
212
+     */
202 213
     function getStatement($type)
203 214
     {
204 215
 
Please login to merge, or discard this patch.
Spacing   +19 added lines, -19 removed lines patch added patch discarded remove patch
@@ -44,7 +44,7 @@  discard block
 block discarded – undo
44 44
     private function load()
45 45
     {
46 46
         $db = new DB_Sql;
47
-        $db->query("SELECT * FROM accounting_year_end WHERE year_id = " . $this->year->get('id') . " AND intranet_id =" . $this->year->kernel->intranet->get('id'));
47
+        $db->query("SELECT * FROM accounting_year_end WHERE year_id = ".$this->year->get('id')." AND intranet_id =".$this->year->kernel->intranet->get('id'));
48 48
         if (!$db->nextRecord()) {
49 49
             return 0;
50 50
         }
@@ -62,14 +62,14 @@  discard block
 block discarded – undo
62 62
             return false;
63 63
         }
64 64
         $db = new DB_Sql;
65
-        $db->query("INSERT INTO accounting_year_end SET date_created=NOW(), year_id = " . $this->year->get('id') . ", intranet_id =" .$this->year->kernel->intranet->get('id'));
65
+        $db->query("INSERT INTO accounting_year_end SET date_created=NOW(), year_id = ".$this->year->get('id').", intranet_id =".$this->year->kernel->intranet->get('id'));
66 66
         return true;
67 67
     }
68 68
 
69 69
     function setStep($step)
70 70
     {
71 71
         $db = new DB_Sql;
72
-        $db->query("UPDATE accounting_year_end SET date_updated=NOW(), step_key = " . (int)$step . " WHERE year_id = " . $this->year->get('id'));
72
+        $db->query("UPDATE accounting_year_end SET date_updated=NOW(), step_key = ".(int)$step." WHERE year_id = ".$this->year->get('id'));
73 73
         return true;
74 74
     }
75 75
 
@@ -80,12 +80,12 @@  discard block
 block discarded – undo
80 80
         switch ($action) {
81 81
             // bruges i forbindelse med nulstilling af resultatkontoen
82 82
             case 'operating_reset':
83
-                $db->query("UPDATE accounting_year_end SET date_updated=NOW(), operating_reset_voucher_id = " . (int)$voucher_id . " WHERE year_id = " . $this->year->get('id'));
83
+                $db->query("UPDATE accounting_year_end SET date_updated=NOW(), operating_reset_voucher_id = ".(int)$voucher_id." WHERE year_id = ".$this->year->get('id'));
84 84
                 return true;
85 85
                 break;
86 86
             // bruges i forbindelse med overførelse af kapitalkontoen
87 87
             case 'result_account_reset':
88
-                $db->query("UPDATE accounting_year_end SET date_updated=NOW(), result_account_reset_voucher_id = " . (int)$voucher_id . " WHERE year_id = " . $this->year->get('id'));
88
+                $db->query("UPDATE accounting_year_end SET date_updated=NOW(), result_account_reset_voucher_id = ".(int)$voucher_id." WHERE year_id = ".$this->year->get('id'));
89 89
                 return true;
90 90
                 break;
91 91
 
@@ -117,14 +117,14 @@  discard block
 block discarded – undo
117 117
     function deleteStatedAction($id)
118 118
     {
119 119
         $db = new DB_Sql;
120
-        $db->query("DELETE FROM accounting_year_end_action WHERE id = " . (int)$id);
120
+        $db->query("DELETE FROM accounting_year_end_action WHERE id = ".(int)$id);
121 121
         return true;
122 122
     }
123 123
 
124 124
     function getStatedActions($action)
125 125
     {
126 126
         $db = new DB_Sql;
127
-        $db->query("SELECT * FROM accounting_year_end_action WHERE year_id = " . $this->year->get('id') . " AND type_key = ".array_search($action, $this->actions)." AND intranet_id = " . $this->year->kernel->intranet->get('id'));
127
+        $db->query("SELECT * FROM accounting_year_end_action WHERE year_id = ".$this->year->get('id')." AND type_key = ".array_search($action, $this->actions)." AND intranet_id = ".$this->year->kernel->intranet->get('id'));
128 128
         $actions = array();
129 129
         $i = 0;
130 130
         while ($db->nextRecord()) {
@@ -143,7 +143,7 @@  discard block
 block discarded – undo
143 143
     function flushStatement($type)
144 144
     {
145 145
         $db = new DB_Sql;
146
-        $db->query("DELETE FROM accounting_year_end_statement WHERE intranet_id = ".$this->year->kernel->intranet->get('id')." AND year_id = " . $this->year->get('id') . " AND type_key = " . array_search($type, $this->types));
146
+        $db->query("DELETE FROM accounting_year_end_statement WHERE intranet_id = ".$this->year->kernel->intranet->get('id')." AND year_id = ".$this->year->get('id')." AND type_key = ".array_search($type, $this->types));
147 147
         return true;
148 148
     }
149 149
 
@@ -180,7 +180,7 @@  discard block
 block discarded – undo
180 180
         $db = new DB_Sql;
181 181
         $db2 = new DB_Sql;
182 182
 
183
-        $db->query("SELECT id FROM accounting_account WHERE year_id = " .$this->year->get('id'). " AND intranet_id = " . $this->year->kernel->intranet->get('id') . " AND number >= " . $account_start->get('number') . " AND number <= " . $account_end->get('number') . " ORDER BY number ASC");
183
+        $db->query("SELECT id FROM accounting_account WHERE year_id = ".$this->year->get('id')." AND intranet_id = ".$this->year->kernel->intranet->get('id')." AND number >= ".$account_start->get('number')." AND number <= ".$account_end->get('number')." ORDER BY number ASC");
184 184
 
185 185
         while ($db->nextRecord()) {
186 186
             $account = new Account($this->year, $db->f('id'));
@@ -188,7 +188,7 @@  discard block
 block discarded – undo
188 188
 
189 189
             // vi vender sgu lige fortegnet, så udgifter får negativt fortegn
190 190
             // og indtægter positivt fortegn
191
-            $db2->query("INSERT INTO accounting_year_end_statement SET type_key = ".array_search($type, $this->types).", intranet_id = ".$this->year->kernel->intranet->get('id').", year_id = ".$this->year->get('id').", account_id = " . $account->get('id') . ", amount = '".-1 * $account->get('saldo')."'");
191
+            $db2->query("INSERT INTO accounting_year_end_statement SET type_key = ".array_search($type, $this->types).", intranet_id = ".$this->year->kernel->intranet->get('id').", year_id = ".$this->year->get('id').", account_id = ".$account->get('id').", amount = '".-1*$account->get('saldo')."'");
192 192
         }
193 193
 
194 194
         return true;
@@ -236,7 +236,7 @@  discard block
 block discarded – undo
236 236
      */
237 237
     function resetOperatingAccounts($type = 'do')
238 238
     {
239
-        switch($type) {
239
+        switch ($type) {
240 240
             case 'do':
241 241
                 break;
242 242
             case 'reverse':
@@ -292,7 +292,7 @@  discard block
 block discarded – undo
292 292
                         'debet_account_number' => $debet_account->get('number'),
293 293
                         'credit_account_number' => $credit_account->get('number'),
294 294
                         'amount' => amountToForm($a['amount']),
295
-                        'text' => 'Modpostering: ' . $debet_account->get('name') . ' og ' . $credit_account->get('name'),
295
+                        'text' => 'Modpostering: '.$debet_account->get('name').' og '.$credit_account->get('name'),
296 296
                         'vat_off' => 1
297 297
 
298 298
                     );
@@ -315,7 +315,7 @@  discard block
 block discarded – undo
315 315
                 ));
316 316
 
317 317
                 $accounts = $account->getList('operating', true);
318
-                if (!is_array($accounts) OR count($accounts) == 0){
318
+                if (!is_array($accounts) OR count($accounts) == 0) {
319 319
                     $this->error->set('Du kan ikke nulstille nogle konti der ikke findes');
320 320
                     return false;
321 321
                 }
@@ -332,7 +332,7 @@  discard block
 block discarded – undo
332 332
                             'debet_account_number' => $result_account->get('number'),
333 333
                             'credit_account_number' => $account->get('number'),
334 334
                             'amount' => amountToForm(abs($account->get('saldo'))), // amountToFrom necessary to get the correct format for daybook
335
-                            'text' => $account->get('name') . ' til resultatkontoen',
335
+                            'text' => $account->get('name').' til resultatkontoen',
336 336
                             'vat_off' => 1
337 337
 
338 338
                         );
@@ -344,7 +344,7 @@  discard block
 block discarded – undo
344 344
                             'debet_account_number' => $account->get('number'),
345 345
                             'credit_account_number' => $result_account->get('number'),
346 346
                             'amount' => amountToForm(abs($account->get('saldo'))), // amountToFrom necessary to get the correct format for daybook
347
-                            'text' => $account->get('name') . ' til resultatkontoen',
347
+                            'text' => $account->get('name').' til resultatkontoen',
348 348
                             'vat_off' => 1
349 349
                         );
350 350
                         $debet_account = $account;
@@ -367,7 +367,7 @@  discard block
 block discarded – undo
367 367
 
368 368
     function resetYearResult($type = 'do')
369 369
     {
370
-        switch($type) {
370
+        switch ($type) {
371 371
             case 'do':
372 372
                 // her sker ikke noget
373 373
                 break;
@@ -428,7 +428,7 @@  discard block
 block discarded – undo
428 428
                         'debet_account_number' => $debet_account->get('number'),
429 429
                         'credit_account_number' => $credit_account->get('number'),
430 430
                         'amount' => amountToForm($a['amount']),
431
-                        'text' => 'Modpostering: ' . $debet_account->get('name') . ' og ' . $credit_account->get('name'),
431
+                        'text' => 'Modpostering: '.$debet_account->get('name').' og '.$credit_account->get('name'),
432 432
                         'vat_off' => 1
433 433
 
434 434
                     );
@@ -464,7 +464,7 @@  discard block
 block discarded – undo
464 464
                         'debet_account_number' => $result_account->get('number'),
465 465
                         'credit_account_number' => $capital_account->get('number'),
466 466
                         'amount' => abs(amountToForm($result_account->get('saldo'))), // amountToFrom necessary to get the correct format for daybook
467
-                        'text' => $result_account->get('name') . ' nulstilles',
467
+                        'text' => $result_account->get('name').' nulstilles',
468 468
                         'vat_off' => 1
469 469
 
470 470
                     );
@@ -476,7 +476,7 @@  discard block
 block discarded – undo
476 476
                         'debet_account_number' => $capital_account->get('number'),
477 477
                         'credit_account_number' => $result_account->get('number'),
478 478
                         'amount' => abs(amountToForm($result_account->get('saldo'))), // amountToFrom necessary to get the correct format for daybook
479
-                        'text' => $result_account->get('name') . ' nulstilles',
479
+                        'text' => $result_account->get('name').' nulstilles',
480 480
                         'vat_off' => 1
481 481
                     );
482 482
                     $debet_account = $capital_account;
Please login to merge, or discard this patch.
src/Intraface/modules/administration/UserAdministration.php 1 patch
Doc Comments   +3 added lines patch added patch discarded remove patch
@@ -14,6 +14,9 @@
 block discarded – undo
14 14
  */
15 15
 class UserAdministration extends Intraface_User
16 16
 {
17
+    /**
18
+     * @param integer $id
19
+     */
17 20
     function __construct($kernel, $id)
18 21
     {
19 22
         parent::__construct($id);
Please login to merge, or discard this patch.
src/Intraface/modules/cms/Controller/Templates.php 3 patches
Doc Comments   +3 added lines patch added patch discarded remove patch
@@ -17,6 +17,9 @@
 block discarded – undo
17 17
         }
18 18
     }
19 19
 
20
+    /**
21
+     * @return integer
22
+     */
20 23
     function getSiteId()
21 24
     {
22 25
          return $this->context->name();
Please login to merge, or discard this patch.
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -19,7 +19,7 @@
 block discarded – undo
19 19
 
20 20
     function getSiteId()
21 21
     {
22
-         return $this->context->name();
22
+            return $this->context->name();
23 23
     }
24 24
 
25 25
     function renderHtml()
Please login to merge, or discard this patch.
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -37,7 +37,7 @@  discard block
 block discarded – undo
37 37
             'templates' => $templates
38 38
         );
39 39
 
40
-        $tpl = $this->template->create(dirname(__FILE__) . '/templates/templates');
40
+        $tpl = $this->template->create(dirname(__FILE__).'/templates/templates');
41 41
         return $tpl->render($this, $data);
42 42
     }
43 43
 
@@ -54,7 +54,7 @@  discard block
 block discarded – undo
54 54
             'translation' => $this->getKernel()->getTranslation()
55 55
         );
56 56
 
57
-        $tpl = $this->template->create(dirname(__FILE__) . '/templates/template-edit');
57
+        $tpl = $this->template->create(dirname(__FILE__).'/templates/template-edit');
58 58
         return $tpl->render($this, $data);
59 59
     }
60 60
 
Please login to merge, or discard this patch.
src/Intraface/modules/cms/Element.php 3 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -69,7 +69,7 @@
 block discarded – undo
69 69
     /**
70 70
      * Creates a parameter
71 71
      *
72
-     * @return object
72
+     * @return CMS_Parameter
73 73
      */
74 74
     function createParameter()
75 75
     {
Please login to merge, or discard this patch.
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -281,7 +281,7 @@
 block discarded – undo
281 281
         $this->save_element($var);
282 282
 
283 283
         return $this->id;
284
-  }
284
+    }
285 285
 
286 286
     /**
287 287
      * Deactivates an element
Please login to merge, or discard this 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') {
@@ -162,7 +162,7 @@  discard block
 block discarded – undo
162 162
 
163 163
         }
164 164
         if ($this->get('elm_adjust')) {
165
-            $this->value['extra_class'] .= ' cms-align-' . $this->get('elm_adjust');
165
+            $this->value['extra_class'] .= ' cms-align-'.$this->get('elm_adjust');
166 166
         }
167 167
 
168 168
         if ($this->get('elm_box') == 'box') {
@@ -238,11 +238,11 @@  discard block
 block discarded – undo
238 238
             $sql_end = ", date_created = NOW()";
239 239
         } else {
240 240
             $sql_type = "UPDATE ";
241
-            $sql_end = " WHERE id = " . $this->id;
241
+            $sql_end = " WHERE id = ".$this->id;
242 242
         }
243
-        $sql = $sql_type . " cms_element SET
243
+        $sql = $sql_type." cms_element SET
244 244
                 intranet_id = ".$this->section->kernel->intranet->get('id').",
245
-                section_id=". (int)$this->section->get('id') . ",
245
+                section_id=". (int)$this->section->get('id').",
246 246
                 type_key = ".safeToDb($this->value['type_key']).",
247 247
                 date_changed = NOW(),
248 248
                 date_publish = ".$date_publish.",
@@ -255,7 +255,7 @@  discard block
 block discarded – undo
255 255
             $this->id = $db->insertedId();
256 256
 
257 257
             $next_pos = $this->getPosition($db)->getMaxPosition() + 1;
258
-            $db->query("UPDATE cms_element SET position = " . $next_pos . " WHERE id = " . $this->id);
258
+            $db->query("UPDATE cms_element SET position = ".$next_pos." WHERE id = ".$this->id);
259 259
         }
260 260
 
261 261
         $this->load();
@@ -291,7 +291,7 @@  discard block
 block discarded – undo
291 291
     public function delete()
292 292
     {
293 293
         $db = new DB_Sql;
294
-        $db->query("UPDATE cms_element SET active = 0 WHERE id = " . $this->id);
294
+        $db->query("UPDATE cms_element SET active = 0 WHERE id = ".$this->id);
295 295
         return true;
296 296
     }
297 297
 
@@ -303,7 +303,7 @@  discard block
 block discarded – undo
303 303
     public function undelete()
304 304
     {
305 305
         $db = new DB_Sql;
306
-        $db->query("UPDATE cms_element SET active = 1 WHERE id = " . $this->id);
306
+        $db->query("UPDATE cms_element SET active = 1 WHERE id = ".$this->id);
307 307
         return true;
308 308
     }
309 309
 
Please login to merge, or discard this patch.
src/Intraface/modules/cms/ElementGateway.php 2 patches
Doc Comments   +9 added lines patch added patch discarded remove patch
@@ -11,6 +11,9 @@  discard block
 block discarded – undo
11 11
         $this->kernel = $kernel;
12 12
     }
13 13
 
14
+    /**
15
+     * @param string $type
16
+     */
14 17
     function findBySectionAndType($section, $type)
15 18
     {
16 19
         $class = $this->class_prefix . ucfirst($type);
@@ -37,6 +40,9 @@  discard block
 block discarded – undo
37 40
         return new $class(CMS_Section::factory($this->kernel, 'id', $this->db->f('section_id')), $this->db->f('id'));
38 41
     }
39 42
 
43
+    /**
44
+     * @param string $id
45
+     */
40 46
     function findByKernelAndId($kernel, $id)
41 47
     {
42 48
         $cms_module = $kernel->getModule('cms');
@@ -53,6 +59,9 @@  discard block
 block discarded – undo
53 59
         return new $class(CMS_Section::factory($kernel, 'id', $this->db->f('section_id')), $this->db->f('id'));
54 60
     }
55 61
 
62
+    /**
63
+     * @param string $id
64
+     */
56 65
     function findBySectionAndId($section, $id)
57 66
     {
58 67
         // FIXME - jeg tror den her kan skabe en del
Please login to merge, or discard this patch.
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -13,7 +13,7 @@  discard block
 block discarded – undo
13 13
 
14 14
     function findBySectionAndType($section, $type)
15 15
     {
16
-        $class = $this->class_prefix . ucfirst($type);
16
+        $class = $this->class_prefix.ucfirst($type);
17 17
 
18 18
         if (!class_exists($class)) {
19 19
             throw new Exception('Class does not exist');
@@ -26,11 +26,11 @@  discard block
 block discarded – undo
26 26
         $cms_module = $this->kernel->getModule('cms');
27 27
         $element_types = $cms_module->getSetting('element_types');
28 28
 
29
-        $this->db->query("SELECT id, section_id, type_key FROM cms_element WHERE id = " . $id . " AND intranet_id = " . $this->kernel->intranet->get('id'));
29
+        $this->db->query("SELECT id, section_id, type_key FROM cms_element WHERE id = ".$id." AND intranet_id = ".$this->kernel->intranet->get('id'));
30 30
         if (!$this->db->nextRecord()) {
31 31
             return false;
32 32
         }
33
-        $class = $this->class_prefix . ucfirst($element_types[$this->db->f('type_key')]);
33
+        $class = $this->class_prefix.ucfirst($element_types[$this->db->f('type_key')]);
34 34
         if (!class_exists($class)) {
35 35
             return false;
36 36
         }
@@ -42,11 +42,11 @@  discard block
 block discarded – undo
42 42
         $cms_module = $kernel->getModule('cms');
43 43
         $element_types = $cms_module->getSetting('element_types');
44 44
 
45
-        $this->db->query("SELECT id, section_id, type_key FROM cms_element WHERE id = " . $id . " AND intranet_id = " . $kernel->intranet->get('id'));
45
+        $this->db->query("SELECT id, section_id, type_key FROM cms_element WHERE id = ".$id." AND intranet_id = ".$kernel->intranet->get('id'));
46 46
         if (!$this->db->nextRecord()) {
47 47
             return false;
48 48
         }
49
-        $class = $this->class_prefix . ucfirst($element_types[$this->db->f('type_key')]);
49
+        $class = $this->class_prefix.ucfirst($element_types[$this->db->f('type_key')]);
50 50
         if (!class_exists($class)) {
51 51
             return false;
52 52
         }
@@ -61,12 +61,12 @@  discard block
 block discarded – undo
61 61
         $cms_module = $section->kernel->getModule('cms');
62 62
         $element_types = $cms_module->getSetting('element_types');
63 63
 
64
-        $this->db->query("SELECT id, section_id, type_key FROM cms_element WHERE id = " . $id . " AND intranet_id = " . $section->kernel->intranet->get('id'));
64
+        $this->db->query("SELECT id, section_id, type_key FROM cms_element WHERE id = ".$id." AND intranet_id = ".$section->kernel->intranet->get('id'));
65 65
         if (!$this->db->nextRecord()) {
66 66
             return false;
67 67
         }
68 68
 
69
-        $class = $this->class_prefix . ucfirst($element_types[$this->db->f('type_key')]);
69
+        $class = $this->class_prefix.ucfirst($element_types[$this->db->f('type_key')]);
70 70
         if (!class_exists($class)) {
71 71
             return false;
72 72
         }
Please login to merge, or discard this patch.
src/Intraface/modules/cms/HTML_Parser.php 2 patches
Doc Comments   +3 added lines patch added patch discarded remove patch
@@ -21,6 +21,9 @@
 block discarded – undo
21 21
         $this->translation = $translation;
22 22
     }
23 23
 
24
+    /**
25
+     * @param string $phrase
26
+     */
24 27
     function t($phrase)
25 28
     {
26 29
         return utf8_encode($this->translation->get($phrase));
Please login to merge, or discard this patch.
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -58,7 +58,7 @@  discard block
 block discarded – undo
58 58
                 $element['extra_style'] = ' style="'.$element['extra_style'].'"';
59 59
             }
60 60
 
61
-            $function =  'parse'.$element['type'] . 'Element';
61
+            $function = 'parse'.$element['type'].'Element';
62 62
             $output = $this->$function($element);
63 63
 
64 64
             $display .= '<div id="element-'.$element['id'].'"'.$element['extra_class'].$element['extra_style'].'>';
@@ -76,9 +76,9 @@  discard block
 block discarded – undo
76 76
             } else {
77 77
                 $display .= '		<li><a href="'.url(null).'?action=move&amp;element_id='.$element['id'].'&amp;id='.$element['section_id'].'">'.$this->t('move').'</a></li>';
78 78
             }
79
-            $display .= '		<li><a class="confirm" href="' . url(null) . '?delete='.$element['id'].'">'.$this->t('delete').'</a></li>';
80
-            $display .=	'	</ul>';
81
-            $display .= '<div>' . 			$output . '</div>';
79
+            $display .= '		<li><a class="confirm" href="'.url(null).'?delete='.$element['id'].'">'.$this->t('delete').'</a></li>';
80
+            $display .= '	</ul>';
81
+            $display .= '<div>'.$output.'</div>';
82 82
             $display .= '</div>';
83 83
         }
84 84
         return $display;
Please login to merge, or discard this patch.
src/Intraface/modules/cms/Navigation.php 1 patch
Doc Comments   +3 added lines patch added patch discarded remove patch
@@ -10,6 +10,9 @@
 block discarded – undo
10 10
     private $cmspage;
11 11
     public $value;
12 12
 
13
+    /**
14
+     * @param CMS_Page $cmspage
15
+     */
13 16
     function __construct($cmspage)
14 17
     {
15 18
         $this->cmspage = $cmspage;
Please login to merge, or discard this patch.
src/Intraface/modules/cms/Page.php 3 patches
Doc Comments   +6 added lines, -3 removed lines patch added patch discarded remove patch
@@ -137,13 +137,16 @@  discard block
 block discarded – undo
137 137
     /**
138 138
      * returns Template object
139 139
      *
140
-     * @return object Template
140
+     * @return CMS_Template Template
141 141
      */
142 142
     public function getTemplate()
143 143
     {
144 144
         return $this->template;
145 145
     }
146 146
 
147
+    /**
148
+     * @param string $type
149
+     */
147 150
     function factory($kernel, $type, $value)
148 151
     {
149 152
         $gateway = new Intraface_modules_cms_PageGateway($kernel, new DB_Sql);
@@ -818,7 +821,7 @@  discard block
 block discarded – undo
818 821
     /**
819 822
      * Returns the possible page types
820 823
      *
821
-     * @return array possible page types
824
+     * @return string[] possible page types
822 825
      */
823 826
     public function getTypes()
824 827
     {
@@ -828,7 +831,7 @@  discard block
 block discarded – undo
828 831
     /**
829 832
      * Returns the possible page types but with a binary index
830 833
      *
831
-     * @return array possible page types with binary index
834
+     * @return string[] possible page types with binary index
832 835
      */
833 836
     static public function getTypesWithBinaryIndex()
834 837
     {
Please login to merge, or discard this patch.
Indentation   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -76,7 +76,7 @@  discard block
 block discarded – undo
76 76
     public function __construct($cmssite, $id = 0)
77 77
     {
78 78
         if (!is_object($cmssite)) {
79
-             throw new Exception('CMS_Page::__construct needs CMS_Site');
79
+                throw new Exception('CMS_Page::__construct needs CMS_Site');
80 80
         }
81 81
 
82 82
         $this->id         = (int)$id;
@@ -527,7 +527,7 @@  discard block
 block discarded – undo
527 527
 
528 528
         return $display;
529 529
     }
530
-    */
530
+     */
531 531
     function getComments()
532 532
     {
533 533
         if (!$this->kernel->intranet->hasModuleAccess('contact')) {
@@ -787,7 +787,7 @@  discard block
 block discarded – undo
787 787
     {
788 788
         $db = new DB_Sql();
789 789
         $db2 = new DB_Sql;
790
-          // egentlig skuille denne m�ske v�re rekursiv?
790
+            // egentlig skuille denne m�ske v�re rekursiv?
791 791
 
792 792
         /*
793 793
         // I am not quite sure what this one is suppossed to do - see the next one instead.
Please login to merge, or discard this patch.
Spacing   +22 added lines, -22 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?
@@ -425,7 +425,7 @@  discard block
 block discarded – undo
425 425
             $page_tree[$i]['id'] = $this->get('id');
426 426
 
427 427
             $child_of_id = $this->get('child_of_id');
428
-            while($child_of_id != 0) {
428
+            while ($child_of_id != 0) {
429 429
                 $i++;
430 430
 
431 431
                 $db->query("SELECT child_of_id, navigation_name, title, id, identifier FROM cms_page WHERE intranet_id = ".$this->kernel->intranet->get('id')." AND active = 1 AND type_key = ".$this->get('type_key')." AND id = ".$child_of_id);
@@ -465,7 +465,7 @@  discard block
 block discarded – undo
465 465
 
466 466
         foreach ($template_sections as $template_section) {
467 467
             $db = new DB_Sql;
468
-            $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
+            $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']);
469 469
 
470 470
             // opretter de sektioner der ikke er oprettet p� siden
471 471
             if (!$db->nextRecord()) {
@@ -482,7 +482,7 @@  discard block
 block discarded – undo
482 482
         $db = new DB_Sql;
483 483
         $db->query("SELECT cms_section.id FROM cms_section INNER JOIN cms_template_section ON cms_section.template_section_id = cms_template_section.id
484 484
             WHERE cms_section.intranet_id = ".$this->kernel->intranet->get('id')."
485
-                AND cms_section.page_id = " . $this->id . " ORDER BY cms_template_section.position ASC");
485
+                AND cms_section.page_id = " . $this->id." ORDER BY cms_template_section.position ASC");
486 486
         $i = 0;
487 487
         $section = array();
488 488
         while ($db->nextRecord()) {
@@ -758,7 +758,7 @@  discard block
 block discarded – undo
758 758
             return false;
759 759
         }
760 760
         $db = new DB_Sql;
761
-        $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'));
761
+        $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'));
762 762
         $this->value['status_key'] = array_search($status, $this->status);
763 763
         return true;
764 764
     }
@@ -802,7 +802,7 @@  discard block
 block discarded – undo
802 802
         // @todo: BUT it can be a mess and the position of the pages is not corrected
803 803
         $db->query('UPDATE cms_page SET child_of_id = '.intval($this->get('child_of_id')).' WHERE child_of_id = '.intval($this->id));
804 804
 
805
-        $sql = "UPDATE cms_page SET active = 0 WHERE id=" . $this->id . " AND site_id = ".$this->cmssite->get('id');
805
+        $sql = "UPDATE cms_page SET active = 0 WHERE id=".$this->id." AND site_id = ".$this->cmssite->get('id');
806 806
         $db->query($sql);
807 807
         $this->value['active'] = 0;
808 808
         $this->load();
@@ -861,7 +861,7 @@  discard block
 block discarded – undo
861 861
     function publish()
862 862
     {
863 863
         $db = new DB_Sql;
864
-        $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'));
864
+        $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'));
865 865
         $this->value['status_key'] = 1;
866 866
         $this->load();
867 867
         return true;
@@ -870,7 +870,7 @@  discard block
 block discarded – undo
870 870
     function unpublish()
871 871
     {
872 872
         $db = new DB_Sql;
873
-        $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'));
873
+        $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'));
874 874
         $this->value['status_key'] = 0;
875 875
         $this->load();
876 876
         return true;
Please login to merge, or discard this patch.
src/Intraface/modules/cms/PageGateway.php 2 patches
Doc Comments   +5 added lines, -2 removed lines patch added patch discarded remove patch
@@ -25,7 +25,7 @@  discard block
 block discarded – undo
25 25
     /**
26 26
      * Returns the possible page types
27 27
      *
28
-     * @return array possible page types
28
+     * @return string[] possible page types
29 29
      */
30 30
     public function getTypes()
31 31
     {
@@ -59,6 +59,9 @@  discard block
 block discarded – undo
59 59
         return $object;
60 60
     }
61 61
 
62
+    /**
63
+     * @param string $identifier
64
+     */
62 65
     function findBySiteIdAndIdentifier($site_id, $identifier)
63 66
     {
64 67
         $identifier = strip_tags($identifier);
@@ -282,7 +285,7 @@  discard block
 block discarded – undo
282 285
     /**
283 286
      * Returns the possible page types but with a binary index
284 287
      *
285
-     * @return array possible page types with binary index
288
+     * @return string[] possible page types with binary index
286 289
      */
287 290
     static public function getTypesWithBinaryIndex()
288 291
     {
Please login to merge, or discard this patch.
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -40,7 +40,7 @@  discard block
 block discarded – undo
40 40
         if ($this->dbquery) {
41 41
             return $this->dbquery;
42 42
         }
43
-        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')));
43
+        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')));
44 44
     }
45 45
 
46 46
     function setDBQuery($dbquery)
@@ -50,7 +50,7 @@  discard block
 block discarded – undo
50 50
 
51 51
     function findById($id)
52 52
     {
53
-        $this->db->query("SELECT id, site_id FROM cms_page WHERE id = " . (int)$id . " AND intranet_id = " . $this->kernel->intranet->get('id'));
53
+        $this->db->query("SELECT id, site_id FROM cms_page WHERE id = ".(int)$id." AND intranet_id = ".$this->kernel->intranet->get('id'));
54 54
         if (!$this->db->nextRecord()) {
55 55
             return false;
56 56
         }
@@ -64,13 +64,13 @@  discard block
 block discarded – undo
64 64
         $identifier = strip_tags($identifier);
65 65
 
66 66
         if (!empty($identifier)) {
67
-            $this->db->query("SELECT site_id, id FROM cms_page WHERE identifier = '" . $identifier . "' AND intranet_id = " . $this->kernel->intranet->get('id') . " AND active = 1 AND site_id = " . $site_id);
67
+            $this->db->query("SELECT site_id, id FROM cms_page WHERE identifier = '".$identifier."' AND intranet_id = ".$this->kernel->intranet->get('id')." AND active = 1 AND site_id = ".$site_id);
68 68
         } else {
69 69
             // @todo choose the default page - vi skal lige have noget med publish og expire date her ogs�
70
-            $this->db->query("SELECT site_id, id FROM cms_page WHERE intranet_id = " . $this->kernel->intranet->get('id') . " AND active = 1 AND status_key = 1 AND site_id = " . $site_id . " ORDER BY position ASC LIMIT 1");
70
+            $this->db->query("SELECT site_id, id FROM cms_page WHERE intranet_id = ".$this->kernel->intranet->get('id')." AND active = 1 AND status_key = 1 AND site_id = ".$site_id." ORDER BY position ASC LIMIT 1");
71 71
         }
72 72
         if (!$this->db->nextRecord()) {
73
-            $this->db->query("SELECT site_id, id FROM cms_page WHERE id = " . (int)$identifier . " AND intranet_id = " . $this->kernel->intranet->get('id') . " AND active = 1 AND site_id = " . $site_id);
73
+            $this->db->query("SELECT site_id, id FROM cms_page WHERE id = ".(int)$identifier." AND intranet_id = ".$this->kernel->intranet->get('id')." AND active = 1 AND site_id = ".$site_id);
74 74
             if (!$this->db->nextRecord()) {
75 75
                 return false;
76 76
             }
@@ -146,7 +146,7 @@  discard block
 block discarded – undo
146 146
 
147 147
         // Benyttes til undersider.
148 148
         $dbquery_original = clone $this->getDBQuery();
149
-        $dbquery_original->storeResult('','', 'toplevel'); // sikre at der ikke bliver gemt ved undermenuer.
149
+        $dbquery_original->storeResult('', '', 'toplevel'); // sikre at der ikke bliver gemt ved undermenuer.
150 150
 
151 151
 
152 152
         $keywords = $this->getDBQuery()->getKeyword();
@@ -175,8 +175,8 @@  discard block
 block discarded – undo
175 175
 
176 176
         $cmspage[0] = $this->getDBQuery()->getRecordset("cms_page.id, title, identifier, status_key, navigation_name, date_publish, child_of_id, pic_id, description, DATE_FORMAT(date_publish, '%d-%m-%Y') AS date_publish_dk", '', false); //
177 177
 
178
-        while(TRUE) {
179
-            while($cmspage[$n]->nextRecord()) {
178
+        while (TRUE) {
179
+            while ($cmspage[$n]->nextRecord()) {
180 180
 
181 181
                 $pages[$i]['id'] = $cmspage[$n]->f('id');
182 182
 
@@ -214,8 +214,8 @@  discard block
 block discarded – undo
214 214
                 // til google sitemaps
215 215
                 // sp�rgsm�let er om vi ikke skal starte et objekt op for hver pages
216 216
 
217
-                $pages[$i]['url'] = $this->cmssite->get('url') . $pages[$i]['identifier'] . '/';
218
-                $pages[$i]['url_self'] = $pages[$i]['identifier'] . '/';
217
+                $pages[$i]['url'] = $this->cmssite->get('url').$pages[$i]['identifier'].'/';
218
+                $pages[$i]['url_self'] = $pages[$i]['identifier'].'/';
219 219
                 $pages[$i]['changefreq'] = 'weekly';
220 220
                 $pages[$i]['priority'] = 0.5;
221 221
 
Please login to merge, or discard this patch.