Completed
Push — master ( c004c3...65a58d )
by Michael
04:32
created
smartfaq/answer.php 1 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.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/blocksadmin.inc.php 1 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/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 1 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.
smartfaq/admin/answer.php 1 patch
Braces   +6 added lines, -2 removed lines patch added patch discarded remove patch
@@ -12,8 +12,12 @@
 block discarded – undo
12 12
 $op = '';
13 13
 
14 14
 // Getting the operation we are doing
15
-if (isset($_GET['op'])) $op = $_GET['op'];
16
-if (isset($_POST['op'])) $op = $_POST['op'];
15
+if (isset($_GET['op'])) {
16
+    $op = $_GET['op'];
17
+}
18
+if (isset($_POST['op'])) {
19
+    $op = $_POST['op'];
20
+}
17 21
 
18 22
 // Creating the answer handler object
19 23
 $answer_handler =& sf_gethandler('answer');
Please login to merge, or discard this patch.
smartfaq/admin/faq.php 1 patch
Braces   +6 added lines, -2 removed lines patch added patch discarded remove patch
@@ -19,8 +19,12 @@
 block discarded – undo
19 19
 $answer_handler =& sf_gethandler('answer');
20 20
 
21 21
 $op = '';
22
-if (isset($_GET['op'])) $op = $_GET['op'];
23
-if (isset($_POST['op'])) $op = $_POST['op'];
22
+if (isset($_GET['op'])) {
23
+    $op = $_GET['op'];
24
+}
25
+if (isset($_POST['op'])) {
26
+    $op = $_POST['op'];
27
+}
24 28
 
25 29
 // Where shall we start?
26 30
 $startfaq = isset($_GET['startfaq'])? intval($_GET['startfaq']) : 0;
Please login to merge, or discard this patch.
smartfaq/admin/admin.php 1 patch
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -36,7 +36,9 @@
 block discarded – undo
36 36
 if (isset($HTTP_GET_VARS['fct'])) {
37 37
     $fct = trim($HTTP_GET_VARS['fct']);
38 38
 }
39
-if (empty($fct)) $fct = 'preferences' ;
39
+if (empty($fct)) {
40
+    $fct = 'preferences' ;
41
+}
40 42
 include dirname(dirname(dirname(__DIR__))) . '/mainfile.php';
41 43
 include XOOPS_ROOT_PATH."/include/cp_functions.php";
42 44
 
Please login to merge, or discard this patch.
smartfaq/admin/question.php 1 patch
Braces   +6 added lines, -2 removed lines patch added patch discarded remove patch
@@ -16,8 +16,12 @@
 block discarded – undo
16 16
 $category_handler =& sf_gethandler('category');
17 17
 
18 18
 $op = '';
19
-if (isset($_GET['op'])) $op = $_GET['op'];
20
-if (isset($_POST['op'])) $op = $_POST['op'];
19
+if (isset($_GET['op'])) {
20
+    $op = $_GET['op'];
21
+}
22
+if (isset($_POST['op'])) {
23
+    $op = $_POST['op'];
24
+}
21 25
 
22 26
 // Where shall we start?
23 27
 $startfaq = isset($_GET['startfaq'])? intval($_GET['startfaq']) : 0;
Please login to merge, or discard this patch.