Completed
Push — master ( c004c3...65a58d )
by Michael
04:32
created
smartfaq/include/search.inc.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -14,13 +14,13 @@
 block discarded – undo
14 14
 
15 15
     $ret = array();
16 16
 
17
-    $faq_handler =& sf_gethandler('faq');
17
+    $faq_handler = & sf_gethandler('faq');
18 18
 
19
-    $faqsObj =& $faq_handler->getFaqsFromSearch($queryarray, $andor, $limit, $offset, $userid);
19
+    $faqsObj = & $faq_handler->getFaqsFromSearch($queryarray, $andor, $limit, $offset, $userid);
20 20
 
21 21
     for ($i = 0; $i < count($faqsObj); ++$i) {
22 22
         $ret[$i]['image'] = "assets/images/smartfaq.gif";
23
-        $ret[$i]['link'] = "faq.php?faqid=" . $faqsObj[$i]->faqid();
23
+        $ret[$i]['link'] = "faq.php?faqid=".$faqsObj[$i]->faqid();
24 24
         $ret[$i]['title'] = $faqsObj[$i]->question(50);
25 25
         $ret[$i]['time'] = $faqsObj[$i]->getVar('datesub');
26 26
         $ret[$i]['uid'] = $faqsObj[$i]->uid();
Please login to merge, or discard this patch.
smartfaq/include/functions.image.php 2 patches
Spacing   +18 added lines, -18 removed lines patch added patch discarded remove patch
@@ -47,25 +47,25 @@  discard block
 block discarded – undo
47 47
     $image_url = $img_url.'/'.$source;
48 48
 
49 49
     $imginfo = @getimagesize($image);
50
-    $img_info = ( count($imginfo)>0 ) ? $imginfo[0]."X".$imginfo[1].' px':"";
50
+    $img_info = (count($imginfo) > 0) ? $imginfo[0]."X".$imginfo[1].' px' : "";
51 51
 
52 52
     if ($xoopsModuleConfig['max_image_width'] > 0 && $xoopsModuleConfig['max_image_height'] > 0) {
53 53
         if ($imginfo[0] > $xoopsModuleConfig['max_image_width'] || $imginfo[1] > $xoopsModuleConfig['max_image_height']) {
54 54
             //if (!file_exists($thumb_path.'/'.$source) && $imginfo[0] > $xoopsModuleConfig['max_img_width']) {
55
-            if (!file_exists($thumb_path.'/'.$source) ) {
55
+            if (!file_exists($thumb_path.'/'.$source)) {
56 56
                 sf_createThumbnail($source, $xoopsModuleConfig['max_image_width']);
57 57
             }
58 58
         }
59 59
 
60 60
         if ($imginfo[0] > $xoopsModuleConfig['max_image_width'] || $imginfo[1] > $xoopsModuleConfig['max_image_height']) {
61 61
             $pseudo_width = $xoopsModuleConfig['max_image_width'];
62
-            $pseudo_height = $xoopsModuleConfig['max_image_width']*($imginfo[1]/$imginfo[0]);
62
+            $pseudo_height = $xoopsModuleConfig['max_image_width'] * ($imginfo[1] / $imginfo[0]);
63 63
             $pseudo_size = "width='".$pseudo_width."px' height='".$pseudo_height."px'";
64 64
         }
65 65
         // irmtfan to fix Undefined variable: pseudo_height
66 66
         if (!empty($pseudo_height) && $xoopsModuleConfig['max_image_height'] > 0 && $pseudo_height > $xoopsModuleConfig['max_image_height']) {
67 67
             $pseudo_height = $xoopsModuleConfig['max_image_height'];
68
-            $pseudo_width = $xoopsModuleConfig['max_image_height'] * ($imginfo[0]/$imginfo[1]);
68
+            $pseudo_width = $xoopsModuleConfig['max_image_height'] * ($imginfo[0] / $imginfo[1]);
69 69
             $pseudo_size = "width='".$pseudo_width."px' height='".$pseudo_height."px'";
70 70
         }
71 71
     }
@@ -112,20 +112,20 @@  discard block
 block discarded – undo
112 112
         return false;
113 113
     }
114 114
 
115
-    $newWidth = (int) (min($imginfo[0],$thumb_width));
115
+    $newWidth = (int) (min($imginfo[0], $thumb_width));
116 116
     $newHeight = (int) ($imginfo[1] * $newWidth / $imginfo[0]);
117 117
 
118 118
     if ($xoopsModuleConfig['image_lib'] == 1 or $xoopsModuleConfig['image_lib'] == 0) {
119
-        if (preg_match("#[A-Z]:|\\\\#Ai",__FILE__)) {
119
+        if (preg_match("#[A-Z]:|\\\\#Ai", __FILE__)) {
120 120
             $cur_dir = __DIR__;
121 121
             $src_file_im = '"'.$cur_dir.'\\'.strtr($src_file, '/', '\\').'"';
122 122
             $new_file_im = '"'.$cur_dir.'\\'.strtr($new_file, '/', '\\').'"';
123 123
         } else {
124
-            $src_file_im =   @escapeshellarg($src_file);
125
-            $new_file_im =   @escapeshellarg($new_file);
124
+            $src_file_im = @escapeshellarg($src_file);
125
+            $new_file_im = @escapeshellarg($new_file);
126 126
         }
127
-        $path = empty($xoopsModuleConfig['path_magick'])?"":$xoopsModuleConfig['path_magick']."/";
128
-        $magick_command = $path . 'convert -quality 85 -antialias -sample ' . $newWidth . 'x' . $newHeight . ' ' . $src_file_im . ' +profile "*" ' . str_replace('\\', '/', $new_file_im) . '';
127
+        $path = empty($xoopsModuleConfig['path_magick']) ? "" : $xoopsModuleConfig['path_magick']."/";
128
+        $magick_command = $path.'convert -quality 85 -antialias -sample '.$newWidth.'x'.$newHeight.' '.$src_file_im.' +profile "*" '.str_replace('\\', '/', $new_file_im).'';
129 129
 
130 130
         @passthru($magick_command);
131 131
         if (file_exists($new_file)) {
@@ -134,13 +134,13 @@  discard block
 block discarded – undo
134 134
     }
135 135
 
136 136
     if ($xoopsModuleConfig['image_lib'] == 2 or $xoopsModuleConfig['image_lib'] == 0) {
137
-        $path = empty($xoopsModuleConfig['path_netpbm'])?"":$xoopsModuleConfig['path_netpbm']."/";
137
+        $path = empty($xoopsModuleConfig['path_netpbm']) ? "" : $xoopsModuleConfig['path_netpbm']."/";
138 138
         if (eregi("\.png", $source)) {
139
-            $cmd = $path . "pngtopnm $src_file | ".$path . "pnmscale -xysize $newWidth $newHeight | ".$path . "pnmtopng > $new_file" ;
139
+            $cmd = $path."pngtopnm $src_file | ".$path."pnmscale -xysize $newWidth $newHeight | ".$path."pnmtopng > $new_file";
140 140
         } elseif (eregi("\.(jpg|jpeg)", $source)) {
141
-            $cmd = $path . "jpegtopnm $src_file | ".$path . "pnmscale -xysize $newWidth $newHeight | ".$path . "ppmtojpeg -quality=90 > $new_file" ;
141
+            $cmd = $path."jpegtopnm $src_file | ".$path."pnmscale -xysize $newWidth $newHeight | ".$path."ppmtojpeg -quality=90 > $new_file";
142 142
         } elseif (eregi("\.gif", $source)) {
143
-            $cmd = $path . "giftopnm $src_file | ".$path . "pnmscale -xysize $newWidth $newHeight | ppmquant 256 | ".$path . "ppmtogif > $new_file" ;
143
+            $cmd = $path."giftopnm $src_file | ".$path."pnmscale -xysize $newWidth $newHeight | ppmquant 256 | ".$path."ppmtogif > $new_file";
144 144
         }
145 145
 
146 146
         @exec($cmd, $output, $retval);
@@ -157,16 +157,16 @@  discard block
 block discarded – undo
157 157
     if (function_exists('imagejpeg'))$supported_types[] = 2;
158 158
     if (function_exists('imagepng')) $supported_types[] = 3;
159 159
 
160
-    $imageCreateFunction = (function_exists('imagecreatetruecolor'))? "imagecreatetruecolor" : "imagecreate";
160
+    $imageCreateFunction = (function_exists('imagecreatetruecolor')) ? "imagecreatetruecolor" : "imagecreate";
161 161
 
162
-    if (in_array($type, $supported_types) ) {
162
+    if (in_array($type, $supported_types)) {
163 163
         switch ($type) {
164 164
             case 1 :
165 165
                 if (!function_exists('imagecreatefromgif')) return false;
166
-                $im = imagecreatefromgif ($src_file);
166
+                $im = imagecreatefromgif($src_file);
167 167
                 $new_im = imagecreate($newWidth, $newHeight);
168 168
                 imagecopyresized($new_im, $im, 0, 0, 0, 0, $newWidth, $newHeight, $imginfo[0], $imginfo[1]);
169
-                imagegif ($new_im, $new_file);
169
+                imagegif($new_im, $new_file);
170 170
                 imagedestroy($im);
171 171
                 imagedestroy($new_im);
172 172
                 break;
Please login to merge, or discard this 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/include/comment_functions.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -10,7 +10,7 @@
 block discarded – undo
10 10
 function smartfaq_com_update($faq_id, $total_num)
11 11
 {
12 12
     $db = &XoopsDatabaseFactory::getDatabaseConnection();
13
-    $sql = 'UPDATE ' . $db->prefix('smartfaq_faq') . ' SET comments = ' . $total_num . ' WHERE faqid = ' . $faq_id;
13
+    $sql = 'UPDATE '.$db->prefix('smartfaq_faq').' SET comments = '.$total_num.' WHERE faqid = '.$faq_id;
14 14
     $db->query($sql);
15 15
 }
16 16
 
Please login to merge, or discard this patch.
smartfaq/header.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -7,9 +7,9 @@
 block discarded – undo
7 7
 * Licence: GNU
8 8
 */
9 9
 
10
-include dirname(dirname(__DIR__)) . '/mainfile.php';
10
+include dirname(dirname(__DIR__)).'/mainfile.php';
11 11
 
12
-include_once XOOPS_ROOT_PATH . "/modules/smartfaq/include/functions.php";
12
+include_once XOOPS_ROOT_PATH."/modules/smartfaq/include/functions.php";
13 13
 include_once XOOPS_ROOT_PATH.'/modules/smartfaq/class/category.php';
14 14
 include_once XOOPS_ROOT_PATH.'/modules/smartfaq/class/faq.php';
15 15
 include_once XOOPS_ROOT_PATH.'/modules/smartfaq/class/answer.php';
Please login to merge, or discard this patch.
smartfaq/comment_reply.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -7,5 +7,5 @@
 block discarded – undo
7 7
 * Licence: GNU
8 8
 */
9 9
 
10
-include dirname(dirname(__DIR__)) . '/mainfile.php';
11
-include_once XOOPS_ROOT_PATH . '/include/comment_reply.php';
10
+include dirname(dirname(__DIR__)).'/mainfile.php';
11
+include_once XOOPS_ROOT_PATH.'/include/comment_reply.php';
Please login to merge, or discard this patch.
smartfaq/comment_post.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -7,5 +7,5 @@
 block discarded – undo
7 7
 * Licence: GNU
8 8
 */
9 9
 
10
-include dirname(dirname(__DIR__)) . '/mainfile.php';
11
-include_once XOOPS_ROOT_PATH . '/include/comment_post.php';
10
+include dirname(dirname(__DIR__)).'/mainfile.php';
11
+include_once XOOPS_ROOT_PATH.'/include/comment_post.php';
Please login to merge, or discard this patch.
smartfaq/comment_edit.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -7,5 +7,5 @@
 block discarded – undo
7 7
 * Licence: GNU
8 8
 */
9 9
 
10
-include dirname(dirname(__DIR__)) . '/mainfile.php';
11
-include_once XOOPS_ROOT_PATH . '/include/comment_edit.php';
10
+include dirname(dirname(__DIR__)).'/mainfile.php';
11
+include_once XOOPS_ROOT_PATH.'/include/comment_edit.php';
Please login to merge, or discard this patch.
smartfaq/notification_update.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -7,5 +7,5 @@
 block discarded – undo
7 7
 * Licence: GNU
8 8
 */
9 9
 
10
-include dirname(dirname(__DIR__)) . '/mainfile.php';
11
-include XOOPS_ROOT_PATH . '/include/notification_update.php';
10
+include dirname(dirname(__DIR__)).'/mainfile.php';
11
+include XOOPS_ROOT_PATH.'/include/notification_update.php';
Please login to merge, or discard this patch.
smartfaq/category.php 1 patch
Spacing   +22 added lines, -22 removed lines patch added patch discarded remove patch
@@ -7,12 +7,12 @@  discard block
 block discarded – undo
7 7
 * Licence: GNU
8 8
 */
9 9
 
10
-include_once __DIR__ . '/header.php';
10
+include_once __DIR__.'/header.php';
11 11
 
12 12
 $categoryid = isset($_GET['categoryid']) ? intval($_GET['categoryid']) : 0;
13 13
 
14 14
 // Creating the category handler object
15
-$category_handler =& sf_gethandler('category');
15
+$category_handler = & sf_gethandler('category');
16 16
 
17 17
 // Creating the category object for the selected category
18 18
 $categoryObj = new sfCategory($categoryid);
@@ -36,14 +36,14 @@  discard block
 block discarded – undo
36 36
 }
37 37
 $xoopsOption['template_main'] = 'smartfaq_category.tpl';
38 38
 
39
-include_once(XOOPS_ROOT_PATH . "/header.php");
40
-include_once __DIR__ . '/footer.php';
39
+include_once(XOOPS_ROOT_PATH."/header.php");
40
+include_once __DIR__.'/footer.php';
41 41
 
42 42
 // At which record shall we start
43 43
 $start = isset($_GET['start']) ? intval($_GET['start']) : 0;
44 44
 
45 45
 // Creating the faq handler object
46
-$faq_handler =& sf_gethandler('faq');
46
+$faq_handler = & sf_gethandler('faq');
47 47
 
48 48
 // creating the FAQ objects that belong to the selected category
49 49
 if ($xoopsModuleConfig['orderbydate'] == 1) {
@@ -84,10 +84,10 @@  discard block
 block discarded – undo
84 84
     $subcat_keys = array_keys($subcatsObj);
85 85
     foreach ($subcat_keys as $i) {
86 86
         $subcat_id = $subcatsObj[$i]->getVar('categoryid');
87
-        if (isset($totalQnas[$subcat_id]) && $totalQnas[$subcat_id] > 0 ) {
87
+        if (isset($totalQnas[$subcat_id]) && $totalQnas[$subcat_id] > 0) {
88 88
             if (isset($last_qnaObj[$subcat_id])) {
89 89
                 $subcatsObj[$i]->setVar('last_faqid', $last_qnaObj[$subcat_id]->getVar('faqid'));
90
-                $subcatsObj[$i]->setVar('last_question_link', "<a href='faq.php?faqid=" . $last_qnaObj[$subcat_id]->getVar('faqid') . "'>" . $last_qnaObj[$subcat_id]->question($lastfaqsize) . "</a>");
90
+                $subcatsObj[$i]->setVar('last_question_link', "<a href='faq.php?faqid=".$last_qnaObj[$subcat_id]->getVar('faqid')."'>".$last_qnaObj[$subcat_id]->question($lastfaqsize)."</a>");
91 91
             }
92 92
         }
93 93
         $subcatsObj[$i]->setVar('faqcount', $totalQnas[$subcat_id]);
@@ -98,15 +98,15 @@  discard block
 block discarded – undo
98 98
     $xoopsTpl->assign('subcats', $subcats);
99 99
 }
100 100
 $thiscategory_faqcount = isset($totalQnas[$categoryid]) ? $totalQnas[$categoryid] : 0;
101
-$category['total'] = $thiscategory_faqcount + $total_faqs;
101
+$category['total'] = $thiscategory_faqcount+$total_faqs;
102 102
 
103
-if (count($faqsObj)>0) {
103
+if (count($faqsObj) > 0) {
104 104
     $userids = array();
105 105
     foreach ($faqsObj as $key => $thisfaq) {
106 106
         $faqids[] = $thisfaq->getVar('faqid');
107 107
         $userids[$thisfaq->uid()] = 1;
108 108
     }
109
-    $answer_handler =& sf_gethandler('answer');
109
+    $answer_handler = & sf_gethandler('answer');
110 110
     $allanswers = $answer_handler->getLastPublishedByFaq($faqids);
111 111
 
112 112
     foreach ($allanswers as $key => $thisanswer) {
@@ -120,7 +120,7 @@  discard block
 block discarded – undo
120 120
         $faq = $faqsObj[$i]->toArray(null, $categoryObj);
121 121
 
122 122
         // Creating the answer object
123
-        $answerObj =& $allanswers[$faqsObj[$i]->faqid()];
123
+        $answerObj = & $allanswers[$faqsObj[$i]->faqid()];
124 124
 
125 125
         $answerObj->setVar('dohtml', $faqsObj[$i]->getVar('html'));
126 126
         $answerObj->setVar('doxcode', $faqsObj[$i]->getVar('xcodes'));
@@ -140,14 +140,14 @@  discard block
 block discarded – undo
140 140
 
141 141
     if (isset($last_qnaObj) && $last_qnaObj) {
142 142
         $category['last_faqid'] = $last_qnaObj[$categoryObj->getVar('categoryid')]->getVar('faqid');
143
-        $category['last_question_link'] = "<a href='faq.php?faqid=" . $last_qnaObj[$categoryObj->getVar('categoryid')]->getVar('faqid') . "'>" . $last_qnaObj[$categoryObj->getVar('categoryid')]->question($lastfaqsize) . "</a>";
143
+        $category['last_question_link'] = "<a href='faq.php?faqid=".$last_qnaObj[$categoryObj->getVar('categoryid')]->getVar('faqid')."'>".$last_qnaObj[$categoryObj->getVar('categoryid')]->question($lastfaqsize)."</a>";
144 144
     }
145 145
 }
146 146
 
147 147
 $xoopsTpl->assign('whereInSection', $myts->displayTarea($xoopsModule->getVar('name')));
148 148
 $xoopsTpl->assign('displaylastfaqs', true);
149 149
 $xoopsTpl->assign('display_categoryname', true);
150
-$xoopsTpl->assign('displayFull', $xoopsModuleConfig['displaytype']=='full');
150
+$xoopsTpl->assign('displayFull', $xoopsModuleConfig['displaytype'] == 'full');
151 151
 
152 152
 // Language constants
153 153
 $xoopsTpl->assign('lang_index_faqs', _MD_SF_SMARTFAQS);
@@ -165,26 +165,26 @@  discard block
 block discarded – undo
165 165
 $xoopsTpl->assign('lang_comments', _MD_SF_COMMENTS);
166 166
 
167 167
 // The Navigation Bar
168
-include_once XOOPS_ROOT_PATH . '/class/pagenav.php';
169
-$pagenav = new XoopsPageNav($thiscategory_faqcount, $xoopsModuleConfig['indexperpage'], $start, 'start', 'categoryid=' . $categoryObj->getVar('categoryid'));
168
+include_once XOOPS_ROOT_PATH.'/class/pagenav.php';
169
+$pagenav = new XoopsPageNav($thiscategory_faqcount, $xoopsModuleConfig['indexperpage'], $start, 'start', 'categoryid='.$categoryObj->getVar('categoryid'));
170 170
 if ($xoopsModuleConfig['useimagenavpage'] == 1) {
171
-    $xoopsTpl->assign('navbar', '<div style="text-align:right;">' . $pagenav->renderImageNav() . '</div>');
171
+    $xoopsTpl->assign('navbar', '<div style="text-align:right;">'.$pagenav->renderImageNav().'</div>');
172 172
 } else {
173
-    $xoopsTpl->assign('navbar', '<div style="text-align:right;">' . $pagenav->renderNav() . '</div>');
173
+    $xoopsTpl->assign('navbar', '<div style="text-align:right;">'.$pagenav->renderNav().'</div>');
174 174
 }
175 175
 
176 176
 $xoopsTpl->assign('category', $category);
177 177
 
178 178
 // Page Title Hack by marcan
179 179
 $module_name = $myts->htmlSpecialChars($xoopsModule->getVar('name'));
180
-$xoopsTpl->assign('xoops_pagetitle', $module_name . ' - ' . $category['name']);
180
+$xoopsTpl->assign('xoops_pagetitle', $module_name.' - '.$category['name']);
181 181
 // End Page Title Hack by marcan
182 182
 
183 183
 //code to include smartie
184
-if (file_exists(XOOPS_ROOT_PATH . '/modules/smarttie/smarttie_links.php')) {
185
-    include_once XOOPS_ROOT_PATH . '/modules/smarttie/smarttie_links.php';
186
-        $xoopsTpl->assign('smarttie',1);
184
+if (file_exists(XOOPS_ROOT_PATH.'/modules/smarttie/smarttie_links.php')) {
185
+    include_once XOOPS_ROOT_PATH.'/modules/smarttie/smarttie_links.php';
186
+        $xoopsTpl->assign('smarttie', 1);
187 187
 }
188 188
 //end code for smarttie
189 189
 
190
-include_once(XOOPS_ROOT_PATH . "/footer.php");
190
+include_once(XOOPS_ROOT_PATH."/footer.php");
Please login to merge, or discard this patch.