Completed
Push — master ( c004c3...65a58d )
by Michael
04:32
created
smartfaq/answer.php 2 patches
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -184,7 +184,7 @@
 block discarded – undo
184 184
     }
185 185
 
186 186
     //redirect_header("javascript:history.go(-1)", 3, $redirect_msg);
187
-     redirect_header("index.php", 3, $redirect_msg);
187
+        redirect_header("index.php", 3, $redirect_msg);
188 188
     exit;
189 189
 
190 190
     break;
Please login to merge, or discard this patch.
Braces   +6 added lines, -2 removed lines patch added patch discarded remove patch
@@ -20,8 +20,12 @@
 block discarded – undo
20 20
 $op = 'form';
21 21
 
22 22
 // Getting the operation we are doing
23
-if (isset($_GET['op'])) $op = $_GET['op'];
24
-if (isset($_POST['op'])) $op = $_POST['op'];
23
+if (isset($_GET['op'])) {
24
+    $op = $_GET['op'];
25
+}
26
+if (isset($_POST['op'])) {
27
+    $op = $_POST['op'];
28
+}
25 29
 
26 30
 // Getting the faqid
27 31
 $faqid = isset($_GET['faqid'])? intval($_GET['faqid']) : 0;
Please login to merge, or discard this patch.
smartfaq/include/functions.php 1 patch
Indentation   +2 added lines, -3 removed lines patch added patch discarded remove patch
@@ -287,8 +287,7 @@  discard block
 block discarded – undo
287 287
 * @param array $groups : group with granted permission
288 288
 * @param integer $itemID : faqid on which we are setting permissions
289 289
 * @return boolean : TRUE if the no errors occured
290
-
291
-*/
290
+ */
292 291
 function sf_saveItemPermissions($groups, $itemID)
293 292
 {
294 293
     $result = true;
@@ -536,7 +535,7 @@  discard block
 block discarded – undo
536 535
 function sf_collapsableBar($tablename = '', $iconname = '')
537 536
 {
538 537
 
539
-   ?>
538
+    ?>
540 539
     <script type="text/javascript"><!--
541 540
     function goto_URL(object)
542 541
     {
Please login to merge, or discard this patch.
smartfaq/include/answer.inc.php 1 patch
Indentation   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -24,19 +24,19 @@
 block discarded – undo
24 24
 //$form->addElement(new XoopsFormDhtmlTextArea(_MD_SF_ANSWER_FAQ, 'answer', '', 15, 60), true);
25 25
 
26 26
 $editorTray = new XoopsFormElementTray(_MD_SF_ANSWER_FAQ, '<br />');
27
-   if (class_exists('XoopsFormEditor')) {
28
-           $options['name'] = 'answer';
29
-           $options['value'] = '';
30
-           $options['rows'] = 5;
31
-           $options['cols'] = '100%';
32
-           $options['width'] = '100%';
33
-           $options['height'] = '200px';
34
-       $answerEditor  = new XoopsFormEditor('', $xoopsModuleConfig['form_editorOptionsUser'], $options, $nohtml = false, $onfailure = 'textarea');
35
-           $editorTray->addElement($answerEditor,true );
36
-       } else {
37
-       $answerEditor  = new XoopsFormDhtmlTextArea(_MD_SF_ANSWER_FAQ, 'answer', '', '100%', '100%');
38
-       $editorTray->addElement($answerEditor, true );
39
-   }
27
+    if (class_exists('XoopsFormEditor')) {
28
+            $options['name'] = 'answer';
29
+            $options['value'] = '';
30
+            $options['rows'] = 5;
31
+            $options['cols'] = '100%';
32
+            $options['width'] = '100%';
33
+            $options['height'] = '200px';
34
+        $answerEditor  = new XoopsFormEditor('', $xoopsModuleConfig['form_editorOptionsUser'], $options, $nohtml = false, $onfailure = 'textarea');
35
+            $editorTray->addElement($answerEditor,true );
36
+        } else {
37
+        $answerEditor  = new XoopsFormDhtmlTextArea(_MD_SF_ANSWER_FAQ, 'answer', '', '100%', '100%');
38
+        $editorTray->addElement($answerEditor, true );
39
+    }
40 40
 $form->addElement($editorTray);
41 41
 
42 42
 // NOTIFY ON PUBLISH
Please login to merge, or discard this patch.
smartfaq/include/functions.render.php 1 patch
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -123,7 +123,9 @@
 block discarded – undo
123 123
     global $xoTheme, $xoopsConfig;
124 124
     static $icon_handler;
125 125
 
126
-    if (isset($icon_handler)) return $icon_handler;
126
+    if (isset($icon_handler)) {
127
+        return $icon_handler;
128
+    }
127 129
 
128 130
     if (!class_exists("NewbbIconHandler")) {
129 131
         require_once dirname(__DIR__)."/class/icon.php";
Please login to merge, or discard this patch.
smartfaq/include/onupdate.inc.php 1 patch
Indentation   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -24,7 +24,7 @@  discard block
 block discarded – undo
24 24
     }
25 25
 
26 26
     // Changing categoryid type to int(11)
27
-       $table->addAlteredField('categoryid', "int(11) NOT NULL default '0'", false);
27
+        $table->addAlteredField('categoryid', "int(11) NOT NULL default '0'", false);
28 28
 
29 29
     if (!$dbupdater->updateTable($table)) {
30 30
         /**
@@ -36,10 +36,10 @@  discard block
 block discarded – undo
36 36
     // Editing smartfaq_categories table
37 37
     $table = new SmartDbTable('smartfaq_categories');
38 38
     // Changing categoryid type to int(11)
39
-       $table->addAlteredField('categoryid', "int(11) NOT NULL default '0'", false);
39
+        $table->addAlteredField('categoryid', "int(11) NOT NULL default '0'", false);
40 40
 
41 41
     // Changing parentid type to int(11)
42
-       $table->addAlteredField('parentid', "int(11) NOT NULL default '0'", false);
42
+        $table->addAlteredField('parentid', "int(11) NOT NULL default '0'", false);
43 43
 
44 44
     if (!$dbupdater->updateTable($table)) {
45 45
         /**
@@ -51,10 +51,10 @@  discard block
 block discarded – undo
51 51
     // Editing smartfaq_answers table
52 52
     $table = new SmartDbTable('smartfaq_answers');
53 53
     // Changing categoryid type to int(11)
54
-       $table->addAlteredField('answerid', "int(11) NOT NULL default '0'", false);
54
+        $table->addAlteredField('answerid', "int(11) NOT NULL default '0'", false);
55 55
 
56 56
     // Changing parentid type to int(11)
57
-       $table->addAlteredField('faqid', "int(11) NOT NULL default '0'", false);
57
+        $table->addAlteredField('faqid', "int(11) NOT NULL default '0'", false);
58 58
 
59 59
     if (!$dbupdater->updateTable($table)) {
60 60
         /**
Please login to merge, or discard this patch.
smartfaq/include/blocksadmin.inc.php 2 patches
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -48,7 +48,7 @@
 block discarded – undo
48 48
 if ( isset($HTTP_POST_VARS) ) {
49 49
     foreach ($HTTP_POST_VARS as $k => $v) {
50 50
         $$k = $v;
51
-      }
51
+        }
52 52
 }
53 53
 
54 54
 if ( isset($HTTP_GET_VARS['op']) ) {
Please login to merge, or discard this patch.
Braces   +4 added lines, -1 removed lines patch added patch discarded remove patch
@@ -191,7 +191,10 @@
 block discarded – undo
191 191
         }
192 192
         $myblock = new XoopsBlock($bid);
193 193
         // $myblock->setVar('side', $bside); GIJ -
194
-        if ( $bside >= 0 ) $myblock->setVar('side', $bside); // GIJ +
194
+        if ( $bside >= 0 ) {
195
+            $myblock->setVar('side', $bside);
196
+        }
197
+        // GIJ +
195 198
         $myblock->setVar('weight', $bweight);
196 199
         $myblock->setVar('visible', $bvisible);
197 200
         $myblock->setVar('title', $btitle);
Please login to merge, or discard this patch.
smartfaq/include/submit.inc.php 1 patch
Indentation   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -37,20 +37,20 @@
 block discarded – undo
37 37
 //$form->addElement($answer_text, true);
38 38
 
39 39
 $editorTray = new XoopsFormElementTray(_MD_SF_ANSWER_FAQ, '<br />');
40
-   if (class_exists('XoopsFormEditor')) {
41
-           $options['name'] = 'answer';
42
-           $options['value'] = $answerObj->answer();
43
-           $options['rows'] = 5;
44
-           $options['cols'] = '100%';
45
-           $options['width'] = '100%';
46
-           $options['height'] = '200px';
47
-       $answerEditor  = new XoopsFormEditor('', $xoopsModuleConfig['form_editorOptionsUser'], $options, $nohtml = false, $onfailure = 'textarea');
48
-           $editorTray->addElement($answerEditor);
49
-       } else {
50
-       $answerEditor  = new XoopsFormDhtmlTextArea('', 'answer', $faqObj->question(), '100%', '100%');
51
-       $answerEditor->setDescription(_MD_SF_ANSWER_FAQ_DSC);
52
-       $editorTray->addElement($answerEditor);
53
-   }
40
+    if (class_exists('XoopsFormEditor')) {
41
+            $options['name'] = 'answer';
42
+            $options['value'] = $answerObj->answer();
43
+            $options['rows'] = 5;
44
+            $options['cols'] = '100%';
45
+            $options['width'] = '100%';
46
+            $options['height'] = '200px';
47
+        $answerEditor  = new XoopsFormEditor('', $xoopsModuleConfig['form_editorOptionsUser'], $options, $nohtml = false, $onfailure = 'textarea');
48
+            $editorTray->addElement($answerEditor);
49
+        } else {
50
+        $answerEditor  = new XoopsFormDhtmlTextArea('', 'answer', $faqObj->question(), '100%', '100%');
51
+        $answerEditor->setDescription(_MD_SF_ANSWER_FAQ_DSC);
52
+        $editorTray->addElement($answerEditor);
53
+    }
54 54
 
55 55
 $form->addElement($editorTray);
56 56
 
Please login to merge, or discard this patch.
smartfaq/include/functions.image.php 1 patch
Braces   +24 added lines, -9 removed lines patch added patch discarded remove patch
@@ -80,7 +80,9 @@  discard block
 block discarded – undo
80 80
         $attachmentImage .= '</a>';
81 81
     } elseif (file_exists($image)) {
82 82
         $attachmentImage = '<img src="'.$image_url.'" alt="'.$source.' '.$img_info.'" />';
83
-    } else $attachmentImage = '';
83
+    } else {
84
+        $attachmentImage = '';
85
+    }
84 86
 
85 87
     return $attachmentImage;
86 88
 }
@@ -152,17 +154,27 @@  discard block
 block discarded – undo
152 154
     $type = $imginfo[2];
153 155
     $supported_types = array();
154 156
 
155
-    if (!extension_loaded('gd')) return false;
156
-    if (function_exists('imagegif')) $supported_types[] = 1;
157
-    if (function_exists('imagejpeg'))$supported_types[] = 2;
158
-    if (function_exists('imagepng')) $supported_types[] = 3;
157
+    if (!extension_loaded('gd')) {
158
+        return false;
159
+    }
160
+    if (function_exists('imagegif')) {
161
+        $supported_types[] = 1;
162
+    }
163
+    if (function_exists('imagejpeg')) {
164
+        $supported_types[] = 2;
165
+    }
166
+    if (function_exists('imagepng')) {
167
+        $supported_types[] = 3;
168
+    }
159 169
 
160 170
     $imageCreateFunction = (function_exists('imagecreatetruecolor'))? "imagecreatetruecolor" : "imagecreate";
161 171
 
162 172
     if (in_array($type, $supported_types) ) {
163 173
         switch ($type) {
164 174
             case 1 :
165
-                if (!function_exists('imagecreatefromgif')) return false;
175
+                if (!function_exists('imagecreatefromgif')) {
176
+                    return false;
177
+                }
166 178
                 $im = imagecreatefromgif ($src_file);
167 179
                 $new_im = imagecreate($newWidth, $newHeight);
168 180
                 imagecopyresized($new_im, $im, 0, 0, 0, 0, $newWidth, $newHeight, $imginfo[0], $imginfo[1]);
@@ -189,8 +201,11 @@  discard block
 block discarded – undo
189 201
         }
190 202
     }
191 203
 
192
-    if (file_exists($new_file))    return true;
193
-    else return false;
194
-}
204
+    if (file_exists($new_file)) {
205
+        return true;
206
+    } else {
207
+        return false;
208
+    }
209
+    }
195 210
 
196 211
 endif;
Please login to merge, or discard this patch.
smartfaq/class/answer.php 2 patches
Indentation   +73 added lines, -73 removed lines patch added patch discarded remove patch
@@ -23,8 +23,8 @@  discard block
 block discarded – undo
23 23
 {
24 24
     var $attachment_array = array();
25 25
     /**
26
-    * constructor
27
-    */
26
+     * constructor
27
+     */
28 28
     function __construct ($id = null)
29 29
     {
30 30
         $this->db =& XoopsDatabaseFactory::getDatabaseConnection();
@@ -184,7 +184,7 @@  discard block
 block discarded – undo
184 184
                 }
185 185
                 $post_attachment .= '<br />';
186 186
             }
187
-       }
187
+        }
188 188
 
189 189
         return $post_attachment;
190 190
     }
@@ -240,7 +240,7 @@  discard block
 block discarded – undo
240 240
 
241 241
     function notLoaded()
242 242
     {
243
-       return ($this->getVar('answerid')== -1);
243
+        return ($this->getVar('answerid')== -1);
244 244
     }
245 245
 
246 246
     function sendNotifications($notifications=array())
@@ -294,11 +294,11 @@  discard block
 block discarded – undo
294 294
 {
295 295
 
296 296
     /**
297
-    * create a new answer
298
-    *
299
-    * @param bool $isNew flag the new objects as "new"?
300
-    * @return object sfAnswer
301
-    */
297
+     * create a new answer
298
+     *
299
+     * @param bool $isNew flag the new objects as "new"?
300
+     * @return object sfAnswer
301
+     */
302 302
     function &create($isNew = true)
303 303
     {
304 304
         $answer = new sfAnswer();
@@ -310,11 +310,11 @@  discard block
 block discarded – undo
310 310
     }
311 311
 
312 312
     /**
313
-    * retrieve an answer
314
-    *
315
-    * @param int $id answerid of the answer
316
-    * @return mixed reference to the {@link sfAnswer} object, FALSE if failed
317
-    */
313
+     * retrieve an answer
314
+     *
315
+     * @param int $id answerid of the answer
316
+     * @return mixed reference to the {@link sfAnswer} object, FALSE if failed
317
+     */
318 318
     function &get($id)
319 319
     {
320 320
         if (intval($id) > 0) {
@@ -336,12 +336,12 @@  discard block
 block discarded – undo
336 336
     }
337 337
 
338 338
     /**
339
-    * insert a new answer in the database
340
-    *
341
-    * @param object $answer reference to the {@link sfAnswer} object
342
-    * @param bool $force
343
-    * @return bool FALSE if failed, TRUE if already present and unchanged or successful
344
-    */
339
+     * insert a new answer in the database
340
+     *
341
+     * @param object $answer reference to the {@link sfAnswer} object
342
+     * @param bool $force
343
+     * @return bool FALSE if failed, TRUE if already present and unchanged or successful
344
+     */
345 345
     function insert(&$answerObj, $force = false)
346 346
     {
347 347
         if (strtolower(get_class($answerObj)) != 'sfanswer') {
@@ -384,12 +384,12 @@  discard block
 block discarded – undo
384 384
     }
385 385
 
386 386
     /**
387
-    * delete an answer from the database
388
-    *
389
-    * @param object $answer reference to the answer to delete
390
-    * @param bool $force
391
-    * @return bool FALSE if failed.
392
-    */
387
+     * delete an answer from the database
388
+     *
389
+     * @param object $answer reference to the answer to delete
390
+     * @param bool $force
391
+     * @return bool FALSE if failed.
392
+     */
393 393
     function delete(&$answer, $force = false)
394 394
     {
395 395
         if (strtolower(get_class($answer)) != 'sfanswer') {
@@ -412,12 +412,12 @@  discard block
 block discarded – undo
412 412
     }
413 413
 
414 414
     /**
415
-    * delete an answer from the database
416
-    *
417
-    * @param object $answer reference to the answer to delete
418
-    * @param bool $force
419
-    * @return bool FALSE if failed.
420
-    */
415
+     * delete an answer from the database
416
+     *
417
+     * @param object $answer reference to the answer to delete
418
+     * @param bool $force
419
+     * @return bool FALSE if failed.
420
+     */
421 421
     function deleteFaqAnswers(&$faqObj)
422 422
     {
423 423
         if (strtolower(get_class($faqObj)) != 'sffaq') {
@@ -435,12 +435,12 @@  discard block
 block discarded – undo
435 435
     }
436 436
 
437 437
     /**
438
-    * retrieve answers from the database
439
-    *
440
-    * @param object $criteria {@link CriteriaElement} conditions to be met
441
-    * @param bool $id_as_key use the answerid as key for the array?
442
-    * @return array array of {@link sfAnswer} objects
443
-    */
438
+     * retrieve answers from the database
439
+     *
440
+     * @param object $criteria {@link CriteriaElement} conditions to be met
441
+     * @param bool $id_as_key use the answerid as key for the array?
442
+     * @return array array of {@link sfAnswer} objects
443
+     */
444 444
     function &getObjects($criteria = null, $id_as_key = false)
445 445
     {
446 446
         $ret = array();
@@ -474,12 +474,12 @@  discard block
 block discarded – undo
474 474
     }
475 475
 
476 476
     /**
477
-    * retrieve 1 official answer (for now SmartFAQ only allow 1 official answer...)
478
-    *
479
-    * @param object $criteria {@link CriteriaElement} conditions to be met
480
-    * @param int $faqid
481
-    * @return mixed reference to the {@link sfAnswer} object, FALSE if failed
482
-    */
477
+     * retrieve 1 official answer (for now SmartFAQ only allow 1 official answer...)
478
+     *
479
+     * @param object $criteria {@link CriteriaElement} conditions to be met
480
+     * @param int $faqid
481
+     * @return mixed reference to the {@link sfAnswer} object, FALSE if failed
482
+     */
483 483
     function &getOfficialAnswer($faqid=0)
484 484
     {
485 485
         $theaAnswers =& $this->getAllAnswers($faqid, _SF_AN_STATUS_APPROVED, 1, 0);
@@ -493,12 +493,12 @@  discard block
 block discarded – undo
493 493
     }
494 494
 
495 495
     /**
496
-    * retrieve all answers
497
-    *
498
-    * @param object $criteria {@link CriteriaElement} conditions to be met
499
-    * @param int $faqid
500
-    * @return array array of {@link sfAnswer} objects
501
-    */
496
+     * retrieve all answers
497
+     *
498
+     * @param object $criteria {@link CriteriaElement} conditions to be met
499
+     * @param int $faqid
500
+     * @return array array of {@link sfAnswer} objects
501
+     */
502 502
     function &getAllAnswers($faqid=0, $status = -1, $limit = 0, $start = 0, $sort = 'datesub', $order = 'DESC')
503 503
     {
504 504
         $hasStatusCriteria = false;
@@ -531,11 +531,11 @@  discard block
 block discarded – undo
531 531
     }
532 532
 
533 533
     /**
534
-    * count answers matching a condition
535
-    *
536
-    * @param object $criteria {@link CriteriaElement} to match
537
-    * @return int count of answers
538
-    */
534
+     * count answers matching a condition
535
+     *
536
+     * @param object $criteria {@link CriteriaElement} to match
537
+     * @return int count of answers
538
+     */
539 539
     function getCount($criteria = null)
540 540
     {
541 541
         $sql = 'SELECT COUNT(*) FROM '.$this->db->prefix('smartfaq_answers');
@@ -552,11 +552,11 @@  discard block
 block discarded – undo
552 552
     }
553 553
 
554 554
     /**
555
-    * count answers matching a condition and group by faq ID
556
-    *
557
-    * @param object $criteria {@link CriteriaElement} to match
558
-    * @return array
559
-    */
555
+     * count answers matching a condition and group by faq ID
556
+     *
557
+     * @param object $criteria {@link CriteriaElement} to match
558
+     * @return array
559
+     */
560 560
     function getCountByFAQ($criteria = null)
561 561
     {
562 562
         $sql = 'SELECT faqid, COUNT(*) FROM '.$this->db->prefix('smartfaq_answers');
@@ -580,11 +580,11 @@  discard block
 block discarded – undo
580 580
     }
581 581
 
582 582
     /**
583
-    * delete answers matching a set of conditions
584
-    *
585
-    * @param object $criteria {@link CriteriaElement}
586
-    * @return bool FALSE if deletion failed
587
-    */
583
+     * delete answers matching a set of conditions
584
+     *
585
+     * @param object $criteria {@link CriteriaElement}
586
+     * @return bool FALSE if deletion failed
587
+     */
588 588
     function deleteAll($criteria = null)
589 589
     {
590 590
         $sql = 'DELETE FROM '.$this->db->prefix('smartfaq_answers');
@@ -599,14 +599,14 @@  discard block
 block discarded – undo
599 599
     }
600 600
 
601 601
     /**
602
-    * Change a value for answers with a certain criteria
603
-    *
604
-    * @param   string  $fieldname  Name of the field
605
-    * @param   string  $fieldvalue Value to write
606
-    * @param   object  $criteria   {@link CriteriaElement}
607
-    *
608
-    * @return  bool
609
-    **/
602
+     * Change a value for answers with a certain criteria
603
+     *
604
+     * @param   string  $fieldname  Name of the field
605
+     * @param   string  $fieldvalue Value to write
606
+     * @param   object  $criteria   {@link CriteriaElement}
607
+     *
608
+     * @return  bool
609
+     **/
610 610
     function updateAll($fieldname, $fieldvalue, $criteria = null)
611 611
     {
612 612
         $set_clause = is_numeric($fieldvalue)? $fieldname.' = '.$fieldvalue : $fieldname.' = '.$this->db->quoteString($fieldvalue);
Please login to merge, or discard this patch.
Braces   +31 added lines, -13 removed lines patch added patch discarded remove patch
@@ -62,17 +62,24 @@  discard block
 block discarded – undo
62 62
     // attachment functions    TODO: there should be a file/attachment management class
63 63
     function getAttachment()
64 64
     {
65
-        if (count($this->attachment_array)) return $this->attachment_array;
65
+        if (count($this->attachment_array)) {
66
+            return $this->attachment_array;
67
+        }
66 68
         $attachment = $this->getVar('attachment');
67
-        if (empty($attachment)) $this->attachment_array = null;
68
-        else $this->attachment_array = @unserialize(base64_decode($attachment));
69
+        if (empty($attachment)) {
70
+            $this->attachment_array = null;
71
+        } else {
72
+            $this->attachment_array = @unserialize(base64_decode($attachment));
73
+        }
69 74
 
70 75
         return $this->attachment_array;
71 76
     }
72 77
 
73 78
     function incrementDownload($attach_key)
74 79
     {
75
-        if (!$attach_key) return false;
80
+        if (!$attach_key) {
81
+            return false;
82
+        }
76 83
         $this->attachment_array[strval($attach_key)]['num_download'] ++;
77 84
 
78 85
         return $this->attachment_array[strval($attach_key)]['num_download'];
@@ -80,9 +87,11 @@  discard block
 block discarded – undo
80 87
 
81 88
     function saveAttachment()
82 89
     {
83
-        if (is_array($this->attachment_array) && count($this->attachment_array) > 0)
84
-            $attachment_save = base64_encode(serialize($this->attachment_array));
85
-        else $attachment_save = '';
90
+        if (is_array($this->attachment_array) && count($this->attachment_array) > 0) {
91
+                    $attachment_save = base64_encode(serialize($this->attachment_array));
92
+        } else {
93
+            $attachment_save = '';
94
+        }
86 95
         $this->setVar('attachment', $attachment_save);
87 96
         $sql = "UPDATE " . $GLOBALS["xoopsDB"]->prefix("smartfaq_answers") . " SET attachment=" . $GLOBALS["xoopsDB"]->quoteString($attachment_save) . " WHERE post_id = " . $this->getVar('answerid');
88 97
         if (!$result = $GLOBALS["xoopsDB"]->queryF($sql)) {
@@ -98,11 +107,18 @@  discard block
 block discarded – undo
98 107
         global $xoopsModuleConfig;
99 108
 
100 109
         $attach_old = $this->getAttachment();
101
-        if (!is_array($attach_old) || count($attach_old) < 1) return true;
110
+        if (!is_array($attach_old) || count($attach_old) < 1) {
111
+            return true;
112
+        }
102 113
         $this->attachment_array = array();
103 114
 
104
-        if ($attach_array === null) $attach_array = array_keys($attach_old); // to delete all!
105
-        if (!is_array($attach_array)) $attach_array = array($attach_array);
115
+        if ($attach_array === null) {
116
+            $attach_array = array_keys($attach_old);
117
+        }
118
+        // to delete all!
119
+        if (!is_array($attach_array)) {
120
+            $attach_array = array($attach_array);
121
+        }
106 122
 
107 123
         foreach ($attach_old as $key => $attach) {
108 124
             if (in_array($key, $attach_array)) {
@@ -112,9 +128,11 @@  discard block
 block discarded – undo
112 128
             }
113 129
             $this->attachment_array[$key] = $attach;
114 130
         }
115
-        if (is_array($this->attachment_array) && count($this->attachment_array) > 0)
116
-            $attachment_save = base64_encode(serialize($this->attachment_array));
117
-        else $attachment_save = '';
131
+        if (is_array($this->attachment_array) && count($this->attachment_array) > 0) {
132
+                    $attachment_save = base64_encode(serialize($this->attachment_array));
133
+        } else {
134
+            $attachment_save = '';
135
+        }
118 136
         $this->setVar('attachment', $attachment_save);
119 137
 
120 138
         return true;
Please login to merge, or discard this patch.