Completed
Push — master ( 48b96e...454ebd )
by Michael
02:08
created
blocks/faqs_random_diduno.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -9,7 +9,7 @@
 block discarded – undo
9 9
 
10 10
 function b_faqs_random_diduno_show()
11 11
 {
12
-    require_once XOOPS_ROOT_PATH . '/modules/smartfaq/include/functions.php';
12
+    require_once XOOPS_ROOT_PATH.'/modules/smartfaq/include/functions.php';
13 13
 
14 14
     $block = [];
15 15
 
Please login to merge, or discard this patch.
blocks/faqs_context.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -11,7 +11,7 @@  discard block
 block discarded – undo
11 11
 
12 12
 function b_faqs_context_show($options)
13 13
 {
14
-    require_once XOOPS_ROOT_PATH . '/modules/smartfaq/include/functions.php';
14
+    require_once XOOPS_ROOT_PATH.'/modules/smartfaq/include/functions.php';
15 15
 
16 16
     $block = [];
17 17
 
@@ -48,8 +48,8 @@  discard block
 block discarded – undo
48 48
  */
49 49
 function b_faqs_context_edit($options)
50 50
 {
51
-    $form = '' . _MB_SF_DISP . ' ';
52
-    $form .= "<input type='text' name='options[]' value='" . $options[0] . "'>&nbsp;" . _MB_SF_FAQS . '';
51
+    $form = ''._MB_SF_DISP.'&nbsp;';
52
+    $form .= "<input type='text' name='options[]' value='".$options[0]."'>&nbsp;"._MB_SF_FAQS.'';
53 53
 
54 54
     return $form;
55 55
 }
Please login to merge, or discard this patch.
blocks/faqs_random_faq.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -9,7 +9,7 @@
 block discarded – undo
9 9
 
10 10
 function b_faqs_random_faq_show()
11 11
 {
12
-    require_once XOOPS_ROOT_PATH . '/modules/smartfaq/include/functions.php';
12
+    require_once XOOPS_ROOT_PATH.'/modules/smartfaq/include/functions.php';
13 13
 
14 14
     $block = [];
15 15
 
Please login to merge, or discard this patch.
admin/category.php 3 patches
Indentation   +17 added lines, -17 removed lines patch added patch discarded remove patch
@@ -46,18 +46,18 @@  discard block
 block discarded – undo
46 46
 
47 47
     echo '<tr>';
48 48
     echo "<td class='even' align='lefet'>"
49
-         . $spaces
50
-         . "<a href='"
51
-         . XOOPS_URL
52
-         . '/modules/'
53
-         . $xoopsModule->dirname()
54
-         . '/category.php?categoryid='
55
-         . $categoryObj->categoryid()
56
-         . "'><img src='"
57
-         . XOOPS_URL
58
-         . "/modules/smartfaq/assets/images/icon/subcat.gif' alt=''>&nbsp;"
59
-         . $categoryObj->name()
60
-         . '</a></td>';
49
+            . $spaces
50
+            . "<a href='"
51
+            . XOOPS_URL
52
+            . '/modules/'
53
+            . $xoopsModule->dirname()
54
+            . '/category.php?categoryid='
55
+            . $categoryObj->categoryid()
56
+            . "'><img src='"
57
+            . XOOPS_URL
58
+            . "/modules/smartfaq/assets/images/icon/subcat.gif' alt=''>&nbsp;"
59
+            . $categoryObj->name()
60
+            . '</a></td>';
61 61
     echo "<td class='even' align='left'>" . $description . '</td>';
62 62
     echo "<td class='even' align='center'>" . $categoryObj->weight() . '</td>';
63 63
     echo "<td class='even' align='center'> $modify $delete </td>";
@@ -314,11 +314,11 @@  discard block
 block discarded – undo
314 314
             $categoryid = isset($_GET['categoryid']) ? (int)$_GET['categoryid'] : 0;
315 315
             xoops_cp_header();
316 316
             xoops_confirm([
317
-                              'op'         => 'del',
318
-                              'categoryid' => $categoryObj->categoryid(),
319
-                              'confirm'    => 1,
320
-                              'name'       => $categoryObj->name()
321
-                          ], 'category.php', _AM_SF_DELETECOL . " '" . $categoryObj->name() . "'. <br> <br>" . _AM_SF_DELETE_CAT_CONFIRM, _AM_SF_DELETE);
317
+                                'op'         => 'del',
318
+                                'categoryid' => $categoryObj->categoryid(),
319
+                                'confirm'    => 1,
320
+                                'name'       => $categoryObj->name()
321
+                            ], 'category.php', _AM_SF_DELETECOL . " '" . $categoryObj->name() . "'. <br> <br>" . _AM_SF_DELETE_CAT_CONFIRM, _AM_SF_DELETE);
322 322
             xoops_cp_footer();
323 323
         }
324 324
         exit();
Please login to merge, or discard this patch.
Switch Indentation   +120 added lines, -120 removed lines patch added patch discarded remove patch
@@ -227,149 +227,149 @@
 block discarded – undo
227 227
 }
228 228
 
229 229
 switch ($op) {
230
-    case 'mod':
231
-        $categoryid  = isset($_GET['categoryid']) ? (int)$_GET['categoryid'] : 0;
232
-        $destList    = isset($_POST['destList']) ? $_POST['destList'] : '';
233
-        $adminObject = \Xmf\Module\Admin::getInstance();
234
-        xoops_cp_header();
235
-
236
-        $adminObject->displayNavigation(basename(__FILE__));
237
-        editcat(true, $categoryid);
238
-        break;
230
+        case 'mod':
231
+            $categoryid  = isset($_GET['categoryid']) ? (int)$_GET['categoryid'] : 0;
232
+            $destList    = isset($_POST['destList']) ? $_POST['destList'] : '';
233
+            $adminObject = \Xmf\Module\Admin::getInstance();
234
+            xoops_cp_header();
239 235
 
240
-    case 'addcategory':
241
-        global $_POST, $xoopsUser, $xoopsUser, $xoopsConfig, $xoopsDB, $xoopsModule, $xoopsModuleConfig, $modify, $myts, $categoryid;
236
+            $adminObject->displayNavigation(basename(__FILE__));
237
+            editcat(true, $categoryid);
238
+            break;
242 239
 
243
-        $categoryid = isset($_POST['categoryid']) ? (int)$_POST['categoryid'] : 0;
240
+        case 'addcategory':
241
+            global $_POST, $xoopsUser, $xoopsUser, $xoopsConfig, $xoopsDB, $xoopsModule, $xoopsModuleConfig, $modify, $myts, $categoryid;
244 242
 
245
-        if (0 != $categoryid) {
246
-            $categoryObj = new sfCategory($categoryid);
247
-        } else {
248
-            $categoryObj = $categoryHandler->create();
249
-        }
243
+            $categoryid = isset($_POST['categoryid']) ? (int)$_POST['categoryid'] : 0;
250 244
 
251
-        //if (isset($_POST['allmods'])) $allmods = $_POST['allmods'];
252
-        //if (isset($_POST['moderators'])) $moderators = $_POST['moderators'];
245
+            if (0 != $categoryid) {
246
+                $categoryObj = new sfCategory($categoryid);
247
+            } else {
248
+                $categoryObj = $categoryHandler->create();
249
+            }
253 250
 
254
-        $categoryObj->setVar('parentid', isset($_POST['parentid']) ? (int)$_POST['parentid'] : 0);
255
-        $applyall = isset($_POST['applyall']) ? (int)$_POST['applyall'] : 0;
256
-        $categoryObj->setVar('weight', isset($_POST['weight']) ? (int)$_POST['weight'] : 1);
251
+            //if (isset($_POST['allmods'])) $allmods = $_POST['allmods'];
252
+            //if (isset($_POST['moderators'])) $moderators = $_POST['moderators'];
257 253
 
258
-        // Groups and permissions
259
-        if (isset($_POST['groups_read'])) {
260
-            $categoryObj->setGroups_read($_POST['groups_read']);
261
-        } else {
262
-            $categoryObj->setGroups_read();
263
-        }
264
-        //  $groups_admin = isset($_POST['groups_admin'])? $_POST['groups_admin'] : array();
265
-        //  $mod_perms = isset($_POST['mod_perms'])? $_POST['mod_perms'] : array();
266
-
267
-        $categoryObj->setVar('name', $_POST['name']);
268
-
269
-        $categoryObj->setVar('description', $_POST['description']);
270
-        if ($categoryObj->isNew()) {
271
-            $redirect_msg = _AM_SF_CATCREATED;
272
-            $redirect_to  = 'category.php?op=mod';
273
-        } else {
274
-            $redirect_msg = _AM_SF_COLMODIFIED;
275
-            $redirect_to  = 'category.php';
276
-        }
254
+            $categoryObj->setVar('parentid', isset($_POST['parentid']) ? (int)$_POST['parentid'] : 0);
255
+            $applyall = isset($_POST['applyall']) ? (int)$_POST['applyall'] : 0;
256
+            $categoryObj->setVar('weight', isset($_POST['weight']) ? (int)$_POST['weight'] : 1);
277 257
 
278
-        if (!$categoryObj->store()) {
279
-            redirect_header('javascript:history.go(-1)', 3, _AM_SF_CATEGORY_SAVE_ERROR . sf_formatErrors($categoryObj->getErrors()));
280
-        }
281
-        // TODO : put this function in the category class
282
-        sf_saveCategory_Permissions($categoryObj->getGroups_read(), $categoryObj->categoryid(), 'category_read');
283
-        //sf_saveCategory_Permissions($groups_admin, $categoriesObj->categoryid(), 'category_admin');
258
+            // Groups and permissions
259
+            if (isset($_POST['groups_read'])) {
260
+                $categoryObj->setGroups_read($_POST['groups_read']);
261
+            } else {
262
+                $categoryObj->setGroups_read();
263
+            }
264
+            //  $groups_admin = isset($_POST['groups_admin'])? $_POST['groups_admin'] : array();
265
+            //  $mod_perms = isset($_POST['mod_perms'])? $_POST['mod_perms'] : array();
266
+
267
+            $categoryObj->setVar('name', $_POST['name']);
268
+
269
+            $categoryObj->setVar('description', $_POST['description']);
270
+            if ($categoryObj->isNew()) {
271
+                $redirect_msg = _AM_SF_CATCREATED;
272
+                $redirect_to  = 'category.php?op=mod';
273
+            } else {
274
+                $redirect_msg = _AM_SF_COLMODIFIED;
275
+                $redirect_to  = 'category.php';
276
+            }
284 277
 
285
-        if ($applyall) {
278
+            if (!$categoryObj->store()) {
279
+                redirect_header('javascript:history.go(-1)', 3, _AM_SF_CATEGORY_SAVE_ERROR . sf_formatErrors($categoryObj->getErrors()));
280
+            }
286 281
             // TODO : put this function in the category class
287
-            sf_overrideFaqsPermissions($categoryObj->getGroups_read(), $categoryObj->categoryid());
288
-        }
282
+            sf_saveCategory_Permissions($categoryObj->getGroups_read(), $categoryObj->categoryid(), 'category_read');
283
+            //sf_saveCategory_Permissions($groups_admin, $categoriesObj->categoryid(), 'category_admin');
289 284
 
290
-        redirect_header($redirect_to, 2, $redirect_msg);
291
-        break;
285
+            if ($applyall) {
286
+                // TODO : put this function in the category class
287
+                sf_overrideFaqsPermissions($categoryObj->getGroups_read(), $categoryObj->categoryid());
288
+            }
292 289
 
293
-    case 'del':
294
-        global $xoopsUser, $xoopsUser, $xoopsConfig, $xoopsDB, $_GET;
290
+            redirect_header($redirect_to, 2, $redirect_msg);
291
+            break;
295 292
 
296
-        $module_id    = $xoopsModule->getVar('mid');
297
-        $gpermHandler = xoops_getHandler('groupperm');
293
+        case 'del':
294
+            global $xoopsUser, $xoopsUser, $xoopsConfig, $xoopsDB, $_GET;
298 295
 
299
-        $categoryid = isset($_POST['categoryid']) ? (int)$_POST['categoryid'] : 0;
300
-        $categoryid = isset($_GET['categoryid']) ? (int)$_GET['categoryid'] : $categoryid;
296
+            $module_id    = $xoopsModule->getVar('mid');
297
+            $gpermHandler = xoops_getHandler('groupperm');
301 298
 
302
-        $categoryObj = new sfCategory($categoryid);
299
+            $categoryid = isset($_POST['categoryid']) ? (int)$_POST['categoryid'] : 0;
300
+            $categoryid = isset($_GET['categoryid']) ? (int)$_GET['categoryid'] : $categoryid;
303 301
 
304
-        $confirm = isset($_POST['confirm']) ? $_POST['confirm'] : 0;
305
-        $name    = isset($_POST['name']) ? $_POST['name'] : '';
302
+            $categoryObj = new sfCategory($categoryid);
306 303
 
307
-        if ($confirm) {
308
-            if (!$categoryHandler->delete($categoryObj)) {
309
-                redirect_header('category.php', 1, _AM_SF_DELETE_CAT_ERROR);
304
+            $confirm = isset($_POST['confirm']) ? $_POST['confirm'] : 0;
305
+            $name    = isset($_POST['name']) ? $_POST['name'] : '';
306
+
307
+            if ($confirm) {
308
+                if (!$categoryHandler->delete($categoryObj)) {
309
+                    redirect_header('category.php', 1, _AM_SF_DELETE_CAT_ERROR);
310
+                }
311
+                redirect_header('category.php', 1, sprintf(_AM_SF_COLISDELETED, $name));
312
+            } else {
313
+                // no confirm: show deletion condition
314
+                $categoryid = isset($_GET['categoryid']) ? (int)$_GET['categoryid'] : 0;
315
+                xoops_cp_header();
316
+                xoops_confirm([
317
+                                  'op'         => 'del',
318
+                                  'categoryid' => $categoryObj->categoryid(),
319
+                                  'confirm'    => 1,
320
+                                  'name'       => $categoryObj->name()
321
+                              ], 'category.php', _AM_SF_DELETECOL . " '" . $categoryObj->name() . "'. <br> <br>" . _AM_SF_DELETE_CAT_CONFIRM, _AM_SF_DELETE);
322
+                xoops_cp_footer();
310 323
             }
311
-            redirect_header('category.php', 1, sprintf(_AM_SF_COLISDELETED, $name));
312
-        } else {
313
-            // no confirm: show deletion condition
314
-            $categoryid = isset($_GET['categoryid']) ? (int)$_GET['categoryid'] : 0;
324
+            exit();
325
+            break;
326
+
327
+        case 'cancel':
328
+            redirect_header('category.php', 1, sprintf(_AM_SF_BACK2IDX, ''));
329
+            break;
330
+        case 'default':
331
+        default:
332
+            $adminObject = \Xmf\Module\Admin::getInstance();
315 333
             xoops_cp_header();
316
-            xoops_confirm([
317
-                              'op'         => 'del',
318
-                              'categoryid' => $categoryObj->categoryid(),
319
-                              'confirm'    => 1,
320
-                              'name'       => $categoryObj->name()
321
-                          ], 'category.php', _AM_SF_DELETECOL . " '" . $categoryObj->name() . "'. <br> <br>" . _AM_SF_DELETE_CAT_CONFIRM, _AM_SF_DELETE);
322
-            xoops_cp_footer();
323
-        }
324
-        exit();
325
-        break;
326
-
327
-    case 'cancel':
328
-        redirect_header('category.php', 1, sprintf(_AM_SF_BACK2IDX, ''));
329
-        break;
330
-    case 'default':
331
-    default:
332
-        $adminObject = \Xmf\Module\Admin::getInstance();
333
-        xoops_cp_header();
334
-
335
-        $adminObject->displayNavigation(basename(__FILE__));
336
-        echo "<br>\n";
337 334
 
338
-        // Creating the objects for top categories
339
-        $categoriesObj = $categoryHandler->getCategories($xoopsModuleConfig['perpage'], $startcategory, 0);
340
-
341
-        sf_collapsableBar('toptable', 'toptableicon');
342
-        echo "<img id='toptableicon' src=" . XOOPS_URL . '/modules/' . $xoopsModule->dirname() . "/assets/images/icon/close12.gif alt=''></a>&nbsp;" . _AM_SF_CATEGORIES_TITLE . '</h3>';
343
-        echo "<div id='toptable'>";
344
-        echo '<span style="color: #567; margin: 3px 0 12px 0; font-size: small; display: block; ">' . _AM_SF_CATEGORIES_DSC . '</span>';
345
-
346
-        echo "<table width='100%' cellspacing=1 cellpadding=3 border=0 class = outer>";
347
-        echo '<tr>';
348
-        echo "<th width='35%' class='bg3' align='left'><b>" . _AM_SF_ARTCOLNAME . '</b></td>';
349
-        echo "<th class='bg3' align='left'><b>" . _AM_SF_DESCRIP . '</b></td>';
350
-        echo "<th class='bg3' width='65' align='center'><b>" . _AM_SF_WEIGHT . '</b></td>';
351
-        echo "<th width='60' class='bg3' align='center'><b>" . _AM_SF_ACTION . '</b></td>';
352
-        echo '</tr>';
353
-        $totalCategories = $categoryHandler->getCategoriesCount(0);
354
-        if (count($categoriesObj) > 0) {
355
-            foreach ($categoriesObj as $key => $thiscat) {
356
-                displayCategory($thiscat);
357
-            }
358
-        } else {
335
+            $adminObject->displayNavigation(basename(__FILE__));
336
+            echo "<br>\n";
337
+
338
+            // Creating the objects for top categories
339
+            $categoriesObj = $categoryHandler->getCategories($xoopsModuleConfig['perpage'], $startcategory, 0);
340
+
341
+            sf_collapsableBar('toptable', 'toptableicon');
342
+            echo "<img id='toptableicon' src=" . XOOPS_URL . '/modules/' . $xoopsModule->dirname() . "/assets/images/icon/close12.gif alt=''></a>&nbsp;" . _AM_SF_CATEGORIES_TITLE . '</h3>';
343
+            echo "<div id='toptable'>";
344
+            echo '<span style="color: #567; margin: 3px 0 12px 0; font-size: small; display: block; ">' . _AM_SF_CATEGORIES_DSC . '</span>';
345
+
346
+            echo "<table width='100%' cellspacing=1 cellpadding=3 border=0 class = outer>";
359 347
             echo '<tr>';
360
-            echo "<td class='head' align='center' colspan= '7'>" . _AM_SF_NOCAT . '</td>';
348
+            echo "<th width='35%' class='bg3' align='left'><b>" . _AM_SF_ARTCOLNAME . '</b></td>';
349
+            echo "<th class='bg3' align='left'><b>" . _AM_SF_DESCRIP . '</b></td>';
350
+            echo "<th class='bg3' width='65' align='center'><b>" . _AM_SF_WEIGHT . '</b></td>';
351
+            echo "<th width='60' class='bg3' align='center'><b>" . _AM_SF_ACTION . '</b></td>';
361 352
             echo '</tr>';
362
-            $categoryid = '0';
363
-        }
364
-        echo "</table>\n";
365
-        require_once XOOPS_ROOT_PATH . '/class/pagenav.php';
366
-        $pagenav = new XoopsPageNav($totalCategories, $xoopsModuleConfig['perpage'], $startcategory, 'startcategory');
367
-        echo '<div style="text-align:right;">' . $pagenav->renderNav() . '</div>';
368
-        echo '</div>';
353
+            $totalCategories = $categoryHandler->getCategoriesCount(0);
354
+            if (count($categoriesObj) > 0) {
355
+                foreach ($categoriesObj as $key => $thiscat) {
356
+                    displayCategory($thiscat);
357
+                }
358
+            } else {
359
+                echo '<tr>';
360
+                echo "<td class='head' align='center' colspan= '7'>" . _AM_SF_NOCAT . '</td>';
361
+                echo '</tr>';
362
+                $categoryid = '0';
363
+            }
364
+            echo "</table>\n";
365
+            require_once XOOPS_ROOT_PATH . '/class/pagenav.php';
366
+            $pagenav = new XoopsPageNav($totalCategories, $xoopsModuleConfig['perpage'], $startcategory, 'startcategory');
367
+            echo '<div style="text-align:right;">' . $pagenav->renderNav() . '</div>';
368
+            echo '</div>';
369 369
 
370
-        editcat(false);
370
+            editcat(false);
371 371
 
372
-        break;
372
+            break;
373 373
 }
374 374
 
375 375
 require_once __DIR__ . '/admin_footer.php';
Please login to merge, or discard this patch.
Spacing   +33 added lines, -33 removed lines patch added patch discarded remove patch
@@ -6,7 +6,7 @@  discard block
 block discarded – undo
6 6
  * Licence: GNU
7 7
  */
8 8
 
9
-require_once __DIR__ . '/admin_header.php';
9
+require_once __DIR__.'/admin_header.php';
10 10
 
11 11
 // Creating the category handler object
12 12
 $categoryHandler = sf_gethandler('category');
@@ -21,7 +21,7 @@  discard block
 block discarded – undo
21 21
 }
22 22
 
23 23
 // Where do we start?
24
-$startcategory = isset($_GET['startcategory']) ? (int)$_GET['startcategory'] : 0;
24
+$startcategory = isset($_GET['startcategory']) ? (int) $_GET['startcategory'] : 0;
25 25
 
26 26
 /**
27 27
  * @param XoopsObject $categoryObj
@@ -33,11 +33,11 @@  discard block
 block discarded – undo
33 33
     $description = $categoryObj->description();
34 34
     if (!XOOPS_USE_MULTIBYTES) {
35 35
         if (strlen($description) >= 100) {
36
-            $description = substr($description, 0, 100 - 1) . '...';
36
+            $description = substr($description, 0, 100-1).'...';
37 37
         }
38 38
     }
39
-    $modify = "<a href='category.php?op=mod&categoryid=" . $categoryObj->categoryid() . "'><img src='" . $pathIcon16 . '/edit.png' . "' title='" . _AM_SF_EDITCOL . "' alt='" . _AM_SF_EDITCOL . "'></a>";
40
-    $delete = "<a href='category.php?op=del&categoryid=" . $categoryObj->categoryid() . "'><img src='" . $pathIcon16 . '/delete.png' . "' title='" . _AM_SF_DELETECOL . "' alt='" . _AM_SF_DELETECOL . "'></a>";
39
+    $modify = "<a href='category.php?op=mod&categoryid=".$categoryObj->categoryid()."'><img src='".$pathIcon16.'/edit.png'."' title='"._AM_SF_EDITCOL."' alt='"._AM_SF_EDITCOL."'></a>";
40
+    $delete = "<a href='category.php?op=del&categoryid=".$categoryObj->categoryid()."'><img src='".$pathIcon16.'/delete.png'."' title='"._AM_SF_DELETECOL."' alt='"._AM_SF_DELETECOL."'></a>";
41 41
 
42 42
     $spaces = '';
43 43
     for ($j = 0; $j < $level; ++$j) {
@@ -58,8 +58,8 @@  discard block
 block discarded – undo
58 58
          . "/modules/smartfaq/assets/images/icon/subcat.gif' alt=''>&nbsp;"
59 59
          . $categoryObj->name()
60 60
          . '</a></td>';
61
-    echo "<td class='even' align='left'>" . $description . '</td>';
62
-    echo "<td class='even' align='center'>" . $categoryObj->weight() . '</td>';
61
+    echo "<td class='even' align='left'>".$description.'</td>';
62
+    echo "<td class='even' align='center'>".$categoryObj->weight().'</td>';
63 63
     echo "<td class='even' align='center'> $modify $delete </td>";
64 64
     echo '</tr>';
65 65
     $subCategoriesObj = $categoryHandler->getCategories(0, 0, $categoryObj->categoryid());
@@ -80,9 +80,9 @@  discard block
 block discarded – undo
80 80
 {
81 81
     //$moderators = array(); // just to define the variable
82 82
     //$allmods = array();
83
-    $startfaq = isset($_GET['startfaq']) ? (int)$_GET['startfaq'] : 0;
83
+    $startfaq = isset($_GET['startfaq']) ? (int) $_GET['startfaq'] : 0;
84 84
     global $categoryHandler, $xoopsUser, $xoopsUser, $myts, $xoopsConfig, $xoopsDB, $modify, $xoopsModuleConfig, $xoopsModule, $_GET;
85
-    require_once XOOPS_ROOT_PATH . '/class/xoopsformloader.php';
85
+    require_once XOOPS_ROOT_PATH.'/class/xoopsformloader.php';
86 86
 
87 87
     // Creating the faq handler object
88 88
     $faqHandler = sf_gethandler('faq');
@@ -104,13 +104,13 @@  discard block
 block discarded – undo
104 104
             redirect_header('category.php', 1, _AM_SF_NOCOLTOEDIT);
105 105
         }
106 106
         sf_collapsableBar('bottomtable', 'bottomtableicon');
107
-        echo "<img id='bottomtableicon' src=" . XOOPS_URL . '/modules/' . $xoopsModule->dirname() . "/assets/images/icon/close12.gif alt=''></a>&nbsp;" . _AM_SF_EDITCOL . '</h3>';
107
+        echo "<img id='bottomtableicon' src=".XOOPS_URL.'/modules/'.$xoopsModule->dirname()."/assets/images/icon/close12.gif alt=''></a>&nbsp;"._AM_SF_EDITCOL.'</h3>';
108 108
         echo "<div id='bottomtable'>";
109 109
     } else {
110 110
         $categoryObj = $categoryHandler->create();
111 111
         echo "<br>\n";
112 112
         sf_collapsableBar('bottomtable', 'bottomtableicon');
113
-        echo "<img id='bottomtableicon' src=" . XOOPS_URL . '/modules/' . $xoopsModule->dirname() . "/assets/images/icon/close12.gif alt=''></a>&nbsp;" . _AM_SF_CATEGORY_CREATE . '</h3>';
113
+        echo "<img id='bottomtableicon' src=".XOOPS_URL.'/modules/'.$xoopsModule->dirname()."/assets/images/icon/close12.gif alt=''></a>&nbsp;"._AM_SF_CATEGORY_CREATE.'</h3>';
114 114
         echo "<div id='bottomtable'>";
115 115
     }
116 116
     // Start category form
@@ -155,7 +155,7 @@  discard block
 block discarded – undo
155 155
     }
156 156
     $sform->addElement($groups_read_checkbox);
157 157
     // Apply permissions on all faqs
158
-    $addapplyall_radio = new XoopsFormRadioYN(_AM_SF_PERMISSIONS_APPLY_ON_FAQS, 'applyall', 0, ' ' . _AM_SF_YES . '', ' ' . _AM_SF_NO . '');
158
+    $addapplyall_radio = new XoopsFormRadioYN(_AM_SF_PERMISSIONS_APPLY_ON_FAQS, 'applyall', 0, ' '._AM_SF_YES.'', ' '._AM_SF_NO.'');
159 159
     $sform->addElement($addapplyall_radio);
160 160
     // MODERATORS
161 161
     //$moderators_tray = new XoopsFormElementTray(_AM_SF_MODERATORS_DEF, '');
@@ -220,7 +220,7 @@  discard block
 block discarded – undo
220 220
     echo '</div>';
221 221
 
222 222
     if ($categoryid) {
223
-        require_once XOOPS_ROOT_PATH . '/modules/smartfaq/include/displayfaqs.php';
223
+        require_once XOOPS_ROOT_PATH.'/modules/smartfaq/include/displayfaqs.php';
224 224
     }
225 225
 
226 226
     unset($hidden);
@@ -228,7 +228,7 @@  discard block
 block discarded – undo
228 228
 
229 229
 switch ($op) {
230 230
     case 'mod':
231
-        $categoryid  = isset($_GET['categoryid']) ? (int)$_GET['categoryid'] : 0;
231
+        $categoryid  = isset($_GET['categoryid']) ? (int) $_GET['categoryid'] : 0;
232 232
         $destList    = isset($_POST['destList']) ? $_POST['destList'] : '';
233 233
         $adminObject = \Xmf\Module\Admin::getInstance();
234 234
         xoops_cp_header();
@@ -240,7 +240,7 @@  discard block
 block discarded – undo
240 240
     case 'addcategory':
241 241
         global $_POST, $xoopsUser, $xoopsUser, $xoopsConfig, $xoopsDB, $xoopsModule, $xoopsModuleConfig, $modify, $myts, $categoryid;
242 242
 
243
-        $categoryid = isset($_POST['categoryid']) ? (int)$_POST['categoryid'] : 0;
243
+        $categoryid = isset($_POST['categoryid']) ? (int) $_POST['categoryid'] : 0;
244 244
 
245 245
         if (0 != $categoryid) {
246 246
             $categoryObj = new sfCategory($categoryid);
@@ -251,9 +251,9 @@  discard block
 block discarded – undo
251 251
         //if (isset($_POST['allmods'])) $allmods = $_POST['allmods'];
252 252
         //if (isset($_POST['moderators'])) $moderators = $_POST['moderators'];
253 253
 
254
-        $categoryObj->setVar('parentid', isset($_POST['parentid']) ? (int)$_POST['parentid'] : 0);
255
-        $applyall = isset($_POST['applyall']) ? (int)$_POST['applyall'] : 0;
256
-        $categoryObj->setVar('weight', isset($_POST['weight']) ? (int)$_POST['weight'] : 1);
254
+        $categoryObj->setVar('parentid', isset($_POST['parentid']) ? (int) $_POST['parentid'] : 0);
255
+        $applyall = isset($_POST['applyall']) ? (int) $_POST['applyall'] : 0;
256
+        $categoryObj->setVar('weight', isset($_POST['weight']) ? (int) $_POST['weight'] : 1);
257 257
 
258 258
         // Groups and permissions
259 259
         if (isset($_POST['groups_read'])) {
@@ -276,7 +276,7 @@  discard block
 block discarded – undo
276 276
         }
277 277
 
278 278
         if (!$categoryObj->store()) {
279
-            redirect_header('javascript:history.go(-1)', 3, _AM_SF_CATEGORY_SAVE_ERROR . sf_formatErrors($categoryObj->getErrors()));
279
+            redirect_header('javascript:history.go(-1)', 3, _AM_SF_CATEGORY_SAVE_ERROR.sf_formatErrors($categoryObj->getErrors()));
280 280
         }
281 281
         // TODO : put this function in the category class
282 282
         sf_saveCategory_Permissions($categoryObj->getGroups_read(), $categoryObj->categoryid(), 'category_read');
@@ -296,8 +296,8 @@  discard block
 block discarded – undo
296 296
         $module_id    = $xoopsModule->getVar('mid');
297 297
         $gpermHandler = xoops_getHandler('groupperm');
298 298
 
299
-        $categoryid = isset($_POST['categoryid']) ? (int)$_POST['categoryid'] : 0;
300
-        $categoryid = isset($_GET['categoryid']) ? (int)$_GET['categoryid'] : $categoryid;
299
+        $categoryid = isset($_POST['categoryid']) ? (int) $_POST['categoryid'] : 0;
300
+        $categoryid = isset($_GET['categoryid']) ? (int) $_GET['categoryid'] : $categoryid;
301 301
 
302 302
         $categoryObj = new sfCategory($categoryid);
303 303
 
@@ -311,14 +311,14 @@  discard block
 block discarded – undo
311 311
             redirect_header('category.php', 1, sprintf(_AM_SF_COLISDELETED, $name));
312 312
         } else {
313 313
             // no confirm: show deletion condition
314
-            $categoryid = isset($_GET['categoryid']) ? (int)$_GET['categoryid'] : 0;
314
+            $categoryid = isset($_GET['categoryid']) ? (int) $_GET['categoryid'] : 0;
315 315
             xoops_cp_header();
316 316
             xoops_confirm([
317 317
                               'op'         => 'del',
318 318
                               'categoryid' => $categoryObj->categoryid(),
319 319
                               'confirm'    => 1,
320 320
                               'name'       => $categoryObj->name()
321
-                          ], 'category.php', _AM_SF_DELETECOL . " '" . $categoryObj->name() . "'. <br> <br>" . _AM_SF_DELETE_CAT_CONFIRM, _AM_SF_DELETE);
321
+                          ], 'category.php', _AM_SF_DELETECOL." '".$categoryObj->name()."'. <br> <br>"._AM_SF_DELETE_CAT_CONFIRM, _AM_SF_DELETE);
322 322
             xoops_cp_footer();
323 323
         }
324 324
         exit();
@@ -339,16 +339,16 @@  discard block
 block discarded – undo
339 339
         $categoriesObj = $categoryHandler->getCategories($xoopsModuleConfig['perpage'], $startcategory, 0);
340 340
 
341 341
         sf_collapsableBar('toptable', 'toptableicon');
342
-        echo "<img id='toptableicon' src=" . XOOPS_URL . '/modules/' . $xoopsModule->dirname() . "/assets/images/icon/close12.gif alt=''></a>&nbsp;" . _AM_SF_CATEGORIES_TITLE . '</h3>';
342
+        echo "<img id='toptableicon' src=".XOOPS_URL.'/modules/'.$xoopsModule->dirname()."/assets/images/icon/close12.gif alt=''></a>&nbsp;"._AM_SF_CATEGORIES_TITLE.'</h3>';
343 343
         echo "<div id='toptable'>";
344
-        echo '<span style="color: #567; margin: 3px 0 12px 0; font-size: small; display: block; ">' . _AM_SF_CATEGORIES_DSC . '</span>';
344
+        echo '<span style="color: #567; margin: 3px 0 12px 0; font-size: small; display: block; ">'._AM_SF_CATEGORIES_DSC.'</span>';
345 345
 
346 346
         echo "<table width='100%' cellspacing=1 cellpadding=3 border=0 class = outer>";
347 347
         echo '<tr>';
348
-        echo "<th width='35%' class='bg3' align='left'><b>" . _AM_SF_ARTCOLNAME . '</b></td>';
349
-        echo "<th class='bg3' align='left'><b>" . _AM_SF_DESCRIP . '</b></td>';
350
-        echo "<th class='bg3' width='65' align='center'><b>" . _AM_SF_WEIGHT . '</b></td>';
351
-        echo "<th width='60' class='bg3' align='center'><b>" . _AM_SF_ACTION . '</b></td>';
348
+        echo "<th width='35%' class='bg3' align='left'><b>"._AM_SF_ARTCOLNAME.'</b></td>';
349
+        echo "<th class='bg3' align='left'><b>"._AM_SF_DESCRIP.'</b></td>';
350
+        echo "<th class='bg3' width='65' align='center'><b>"._AM_SF_WEIGHT.'</b></td>';
351
+        echo "<th width='60' class='bg3' align='center'><b>"._AM_SF_ACTION.'</b></td>';
352 352
         echo '</tr>';
353 353
         $totalCategories = $categoryHandler->getCategoriesCount(0);
354 354
         if (count($categoriesObj) > 0) {
@@ -357,14 +357,14 @@  discard block
 block discarded – undo
357 357
             }
358 358
         } else {
359 359
             echo '<tr>';
360
-            echo "<td class='head' align='center' colspan= '7'>" . _AM_SF_NOCAT . '</td>';
360
+            echo "<td class='head' align='center' colspan= '7'>"._AM_SF_NOCAT.'</td>';
361 361
             echo '</tr>';
362 362
             $categoryid = '0';
363 363
         }
364 364
         echo "</table>\n";
365
-        require_once XOOPS_ROOT_PATH . '/class/pagenav.php';
365
+        require_once XOOPS_ROOT_PATH.'/class/pagenav.php';
366 366
         $pagenav = new XoopsPageNav($totalCategories, $xoopsModuleConfig['perpage'], $startcategory, 'startcategory');
367
-        echo '<div style="text-align:right;">' . $pagenav->renderNav() . '</div>';
367
+        echo '<div style="text-align:right;">'.$pagenav->renderNav().'</div>';
368 368
         echo '</div>';
369 369
 
370 370
         editcat(false);
@@ -372,4 +372,4 @@  discard block
 block discarded – undo
372 372
         break;
373 373
 }
374 374
 
375
-require_once __DIR__ . '/admin_footer.php';
375
+require_once __DIR__.'/admin_footer.php';
Please login to merge, or discard this patch.
print.php 1 patch
Spacing   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -6,9 +6,9 @@  discard block
 block discarded – undo
6 6
  * Licence: GNU
7 7
  */
8 8
 
9
-require_once __DIR__ . '/header.php';
9
+require_once __DIR__.'/header.php';
10 10
 
11
-$faqid = isset($_GET['faqid']) ? (int)$_GET['faqid'] : 0;
11
+$faqid = isset($_GET['faqid']) ? (int) $_GET['faqid'] : 0;
12 12
 
13 13
 if (0 == $faqid) {
14 14
     redirect_header('javascript:history.go(-1)', 1, _MD_SF_NOFAQSELECTED);
@@ -43,23 +43,23 @@  discard block
 block discarded – undo
43 43
 
44 44
 echo "<!DOCTYPE HTML PUBLIC '-//W3C//DTD HTML 4.01 Transitional//EN'>\n";
45 45
 echo "<html>\n<head>\n";
46
-echo '<title>' . _MD_SF_FAQCOMEFROM . ' ' . $xoopsConfig['sitename'] . "</title>\n";
47
-echo "<meta http-equiv='Content-Type' content='text/html; charset=" . _CHARSET . "'>\n";
48
-echo "<meta name='AUTHOR' content='" . $xoopsConfig['sitename'] . "'>\n";
49
-echo "<meta name='COPYRIGHT' content='Copyright (c) 2001 by " . $xoopsConfig['sitename'] . "'>\n";
50
-echo "<meta name='DESCRIPTION' content='" . $xoopsConfig['slogan'] . "'>\n";
51
-echo "<meta name='GENERATOR' content='" . XOOPS_VERSION . "'>\n\n\n";
46
+echo '<title>'._MD_SF_FAQCOMEFROM.' '.$xoopsConfig['sitename']."</title>\n";
47
+echo "<meta http-equiv='Content-Type' content='text/html; charset="._CHARSET."'>\n";
48
+echo "<meta name='AUTHOR' content='".$xoopsConfig['sitename']."'>\n";
49
+echo "<meta name='COPYRIGHT' content='Copyright (c) 2001 by ".$xoopsConfig['sitename']."'>\n";
50
+echo "<meta name='DESCRIPTION' content='".$xoopsConfig['slogan']."'>\n";
51
+echo "<meta name='GENERATOR' content='".XOOPS_VERSION."'>\n\n\n";
52 52
 
53 53
 echo "<body bgcolor='#ffffff' text='#000000' onload='window.print()'>
54 54
      <div style='width: 650px; border: 1px solid #000; padding: 20px;'>
55
-     <div style='text-align: center; display: block; margin: 0 0 6px 0;'><img src='" . XOOPS_URL . "/modules/smartfaq/assets/images/logo_module.png' border='0' alt=''><h2 style='margin: 0;'>" . $faqObj->question() . "</h2></div>
56
-     <div align='center'>" . $who_where . "</div>
55
+     <div style='text-align: center; display: block; margin: 0 0 6px 0;'><img src='" . XOOPS_URL."/modules/smartfaq/assets/images/logo_module.png' border='0' alt=''><h2 style='margin: 0;'>".$faqObj->question()."</h2></div>
56
+     <div align='center'>" . $who_where."</div>
57 57
                 <div style='text-align: center; display: block; padding-bottom: 12px; margin: 0 0 6px 0; border-bottom: 2px solid #ccc;'></div>
58 58
                 <div></div>
59
-                <b><p>" . $faqObj->question() . '</p></b>
60
-                <p>' . $answerObj->answer() . "</p>
59
+                <b><p>" . $faqObj->question().'</p></b>
60
+                <p>' . $answerObj->answer()."</p>
61 61
                 <div style='padding-top: 12px; border-top: 2px solid #ccc;'></div>
62
-                <p>" . $comeFrom . '</p>
62
+                <p>" . $comeFrom.'</p>
63 63
             </div>
64 64
     <br>';
65 65
 
Please login to merge, or discard this patch.
submit.php 2 patches
Switch Indentation   +134 added lines, -134 removed lines patch added patch discarded remove patch
@@ -46,153 +46,153 @@  discard block
 block discarded – undo
46 46
 }
47 47
 
48 48
 switch ($op) {
49
-    case 'preview':
49
+        case 'preview':
50 50
 
51
-        global $xoopsUser, $xoopsConfig, $xoopsModule, $xoopsModuleConfig, $xoopsDB;
51
+            global $xoopsUser, $xoopsConfig, $xoopsModule, $xoopsModuleConfig, $xoopsDB;
52 52
 
53
-        $faqObj      = $faqHandler->create();
54
-        $answerObj   = $answerHandler->create();
55
-        $categoryObj = $categoryHandler->get($_POST['categoryid']);
53
+            $faqObj      = $faqHandler->create();
54
+            $answerObj   = $answerHandler->create();
55
+            $categoryObj = $categoryHandler->get($_POST['categoryid']);
56 56
 
57
-        if (!$xoopsUser) {
58
-            if (1 == $xoopsModuleConfig['anonpost']) {
59
-                $uid = 0;
57
+            if (!$xoopsUser) {
58
+                if (1 == $xoopsModuleConfig['anonpost']) {
59
+                    $uid = 0;
60
+                } else {
61
+                    redirect_header('index.php', 3, _NOPERM);
62
+                }
60 63
             } else {
61
-                redirect_header('index.php', 3, _NOPERM);
64
+                $uid = $xoopsUser->uid();
62 65
             }
63
-        } else {
64
-            $uid = $xoopsUser->uid();
65
-        }
66 66
 
67
-        $notifypub = isset($_POST['notifypub']) ? $_POST['notifypub'] : 0;
67
+            $notifypub = isset($_POST['notifypub']) ? $_POST['notifypub'] : 0;
68 68
 
69
-        // Putting the values about the FAQ in the FAQ object
70
-        $faqObj->setVar('categoryid', $_POST['categoryid']);
71
-        $faqObj->setVar('uid', $uid);
72
-        $faqObj->setVar('question', $_POST['question']);
73
-        $faqObj->setVar('howdoi', $_POST['howdoi']);
74
-        $faqObj->setVar('diduno', $_POST['diduno']);
75
-        $faqObj->setVar('datesub', time());
69
+            // Putting the values about the FAQ in the FAQ object
70
+            $faqObj->setVar('categoryid', $_POST['categoryid']);
71
+            $faqObj->setVar('uid', $uid);
72
+            $faqObj->setVar('question', $_POST['question']);
73
+            $faqObj->setVar('howdoi', $_POST['howdoi']);
74
+            $faqObj->setVar('diduno', $_POST['diduno']);
75
+            $faqObj->setVar('datesub', time());
76 76
 
77
-        // Putting the values in the answer object
78
-        $answerObj->setVar('status', _SF_AN_STATUS_APPROVED);
79
-        $answerObj->setVar('faqid', $faqObj->faqid());
80
-        $answerObj->setVar('answer', $_POST['answer']);
81
-        $answerObj->setVar('uid', $uid);
77
+            // Putting the values in the answer object
78
+            $answerObj->setVar('status', _SF_AN_STATUS_APPROVED);
79
+            $answerObj->setVar('faqid', $faqObj->faqid());
80
+            $answerObj->setVar('answer', $_POST['answer']);
81
+            $answerObj->setVar('uid', $uid);
82 82
 
83
-        global $xoopsUser, $myts;
83
+            global $xoopsUser, $myts;
84 84
 
85
-        $GLOBALS['xoopsOption']['template_main'] = 'smartfaq_submit.tpl';
86
-        require_once XOOPS_ROOT_PATH . '/header.php';
87
-        require_once __DIR__ . '/footer.php';
85
+            $GLOBALS['xoopsOption']['template_main'] = 'smartfaq_submit.tpl';
86
+            require_once XOOPS_ROOT_PATH . '/header.php';
87
+            require_once __DIR__ . '/footer.php';
88 88
 
89
-        $name = $xoopsUser ? ucwords($xoopsUser->getVar('uname')) : 'Anonymous';
89
+            $name = $xoopsUser ? ucwords($xoopsUser->getVar('uname')) : 'Anonymous';
90 90
 
91
-        $moduleName          =& $myts->displayTarea($xoopsModule->getVar('name'));
92
-        $faq                 = $faqObj->toArray(null, $categoryObj, false);
93
-        $faq['categoryPath'] = $categoryObj->getCategoryPath(true);
94
-        $faq['answer']       = $answerObj->answer();
95
-        $faq['who_when']     = $faqObj->getWhoAndWhen();
91
+            $moduleName          =& $myts->displayTarea($xoopsModule->getVar('name'));
92
+            $faq                 = $faqObj->toArray(null, $categoryObj, false);
93
+            $faq['categoryPath'] = $categoryObj->getCategoryPath(true);
94
+            $faq['answer']       = $answerObj->answer();
95
+            $faq['who_when']     = $faqObj->getWhoAndWhen();
96 96
 
97
-        $faq['comments'] = -1;
98
-        $xoopsTpl->assign('faq', $faq);
99
-        $xoopsTpl->assign('op', 'preview');
100
-        $xoopsTpl->assign('whereInSection', $moduleName);
101
-        $xoopsTpl->assign('lang_submit', _MD_SF_SUB_SNEWNAME);
97
+            $faq['comments'] = -1;
98
+            $xoopsTpl->assign('faq', $faq);
99
+            $xoopsTpl->assign('op', 'preview');
100
+            $xoopsTpl->assign('whereInSection', $moduleName);
101
+            $xoopsTpl->assign('lang_submit', _MD_SF_SUB_SNEWNAME);
102 102
 
103
-        $xoopsTpl->assign('lang_intro_title', sprintf(_MD_SF_SUB_SNEWNAME, ucwords($xoopsModule->name())));
104
-        $xoopsTpl->assign('lang_intro_text', _MD_SF_GOODDAY . "<b>$name</b>, " . _MD_SF_SUB_INTRO);
103
+            $xoopsTpl->assign('lang_intro_title', sprintf(_MD_SF_SUB_SNEWNAME, ucwords($xoopsModule->name())));
104
+            $xoopsTpl->assign('lang_intro_text', _MD_SF_GOODDAY . "<b>$name</b>, " . _MD_SF_SUB_INTRO);
105 105
 
106
-        require_once __DIR__ . '/include/submit.inc.php';
106
+            require_once __DIR__ . '/include/submit.inc.php';
107 107
 
108
-        require_once XOOPS_ROOT_PATH . '/footer.php';
108
+            require_once XOOPS_ROOT_PATH . '/footer.php';
109 109
 
110
-        exit();
111
-        break;
110
+            exit();
111
+            break;
112 112
 
113
-    case 'post':
113
+        case 'post':
114 114
 
115
-        global $xoopsUser, $xoopsConfig, $xoopsModule, $xoopsModuleConfig, $xoopsDB;
115
+            global $xoopsUser, $xoopsConfig, $xoopsModule, $xoopsModuleConfig, $xoopsDB;
116 116
 
117
-        $newFaqObj    = $faqHandler->create();
118
-        $newAnswerObj = $answerHandler->create();
117
+            $newFaqObj    = $faqHandler->create();
118
+            $newAnswerObj = $answerHandler->create();
119 119
 
120
-        if (!$xoopsUser) {
121
-            if (1 == $xoopsModuleConfig['anonpost']) {
122
-                $uid = 0;
120
+            if (!$xoopsUser) {
121
+                if (1 == $xoopsModuleConfig['anonpost']) {
122
+                    $uid = 0;
123
+                } else {
124
+                    redirect_header('index.php', 3, _NOPERM);
125
+                }
123 126
             } else {
124
-                redirect_header('index.php', 3, _NOPERM);
127
+                $uid = $xoopsUser->uid();
125 128
             }
126
-        } else {
127
-            $uid = $xoopsUser->uid();
128
-        }
129
-
130
-        $notifypub = isset($_POST['notifypub']) ? $_POST['notifypub'] : 0;
131
-
132
-        // Putting the values about the FAQ in the FAQ object
133
-        $newFaqObj->setVar('categoryid', $_POST['categoryid']);
134
-        $newFaqObj->setVar('uid', $uid);
135
-        $newFaqObj->setVar('question', $_POST['question']);
136
-        $newFaqObj->setVar('howdoi', $_POST['howdoi']);
137
-        $newFaqObj->setVar('diduno', $_POST['diduno']);
138
-        $newFaqObj->setVar('notifypub', $notifypub);
139
-        //$newFaqObj->setVar('modulelink', $_POST['modulelink']);
140
-        //$newFaqObj->setVar('contextpage', $_POST['contextpage']);
141 129
 
142
-        // Setting the status of the FAQ
143
-
144
-        // if user is admin, FAQ are automatically published
145
-        $isAdmin = sf_userIsAdmin();
146
-        if ($isAdmin) {
147
-            $newFaqObj->setVar('status', _SF_STATUS_PUBLISHED);
148
-        } elseif (1 == $xoopsModuleConfig['autoapprove_submitted_faq']) {
149
-            $newFaqObj->setVar('status', _SF_STATUS_PUBLISHED);
150
-        } else {
151
-            $newFaqObj->setVar('status', _SF_STATUS_SUBMITTED);
152
-        }
130
+            $notifypub = isset($_POST['notifypub']) ? $_POST['notifypub'] : 0;
131
+
132
+            // Putting the values about the FAQ in the FAQ object
133
+            $newFaqObj->setVar('categoryid', $_POST['categoryid']);
134
+            $newFaqObj->setVar('uid', $uid);
135
+            $newFaqObj->setVar('question', $_POST['question']);
136
+            $newFaqObj->setVar('howdoi', $_POST['howdoi']);
137
+            $newFaqObj->setVar('diduno', $_POST['diduno']);
138
+            $newFaqObj->setVar('notifypub', $notifypub);
139
+            //$newFaqObj->setVar('modulelink', $_POST['modulelink']);
140
+            //$newFaqObj->setVar('contextpage', $_POST['contextpage']);
141
+
142
+            // Setting the status of the FAQ
143
+
144
+            // if user is admin, FAQ are automatically published
145
+            $isAdmin = sf_userIsAdmin();
146
+            if ($isAdmin) {
147
+                $newFaqObj->setVar('status', _SF_STATUS_PUBLISHED);
148
+            } elseif (1 == $xoopsModuleConfig['autoapprove_submitted_faq']) {
149
+                $newFaqObj->setVar('status', _SF_STATUS_PUBLISHED);
150
+            } else {
151
+                $newFaqObj->setVar('status', _SF_STATUS_SUBMITTED);
152
+            }
153 153
 
154
-        // Storing the FAQ object in the database
155
-        if (!$newFaqObj->store()) {
156
-            redirect_header('javascript:history.go(-1)', 2, _MD_SF_SUBMIT_ERROR);
157
-        }
154
+            // Storing the FAQ object in the database
155
+            if (!$newFaqObj->store()) {
156
+                redirect_header('javascript:history.go(-1)', 2, _MD_SF_SUBMIT_ERROR);
157
+            }
158 158
 
159
-        // Putting the values in the answer object
160
-        $newAnswerObj->setVar('status', _SF_AN_STATUS_APPROVED);
161
-        $newAnswerObj->setVar('faqid', $newFaqObj->faqid());
162
-        $newAnswerObj->setVar('answer', $_POST['answer']);
163
-        $newAnswerObj->setVar('uid', $uid);
164
-
165
-        //====================================================================================
166
-        //TODO post Attachment
167
-        $attachments_tmp = [];
168
-        if (!empty($_POST['attachments_tmp'])) {
169
-            $attachments_tmp = unserialize(base64_decode($_POST['attachments_tmp']));
170
-            if (isset($_POST['delete_tmp']) && count($_POST['delete_tmp'])) {
171
-                foreach ($_POST['delete_tmp'] as $key) {
172
-                    unlink(XOOPS_ROOT_PATH . '/' . $xoopsModuleConfig['dir_attachments'] . '/' . $attachments_tmp[$key][0]);
173
-                    unset($attachments_tmp[$key]);
159
+            // Putting the values in the answer object
160
+            $newAnswerObj->setVar('status', _SF_AN_STATUS_APPROVED);
161
+            $newAnswerObj->setVar('faqid', $newFaqObj->faqid());
162
+            $newAnswerObj->setVar('answer', $_POST['answer']);
163
+            $newAnswerObj->setVar('uid', $uid);
164
+
165
+            //====================================================================================
166
+            //TODO post Attachment
167
+            $attachments_tmp = [];
168
+            if (!empty($_POST['attachments_tmp'])) {
169
+                $attachments_tmp = unserialize(base64_decode($_POST['attachments_tmp']));
170
+                if (isset($_POST['delete_tmp']) && count($_POST['delete_tmp'])) {
171
+                    foreach ($_POST['delete_tmp'] as $key) {
172
+                        unlink(XOOPS_ROOT_PATH . '/' . $xoopsModuleConfig['dir_attachments'] . '/' . $attachments_tmp[$key][0]);
173
+                        unset($attachments_tmp[$key]);
174
+                    }
174 175
                 }
175 176
             }
176
-        }
177
-        if (count($attachments_tmp)) {
178
-            foreach ($attachments_tmp as $key => $attach) {
179
-                if (rename(XOOPS_CACHE_PATH . '/' . $attachments_tmp[$key][0], XOOPS_ROOT_PATH . '/' . $xoopsModuleConfig['dir_attachments'] . '/' . $attachments_tmp[$key][0])) {
180
-                    $post_obj->setAttachment($attach[0], $attach[1], $attach[2]);
177
+            if (count($attachments_tmp)) {
178
+                foreach ($attachments_tmp as $key => $attach) {
179
+                    if (rename(XOOPS_CACHE_PATH . '/' . $attachments_tmp[$key][0], XOOPS_ROOT_PATH . '/' . $xoopsModuleConfig['dir_attachments'] . '/' . $attachments_tmp[$key][0])) {
180
+                        $post_obj->setAttachment($attach[0], $attach[1], $attach[2]);
181
+                    }
181 182
                 }
182 183
             }
183
-        }
184
-        $error_upload = '';
184
+            $error_upload = '';
185 185
 
186
-        if (isset($_FILES['userfile']['name']) && '' != $_FILES['userfile']['name']
187
-            && $topicHandler->getPermission($forum_obj, $topic_status, 'attach')) {
188
-            require_once XOOPS_ROOT_PATH . '/modules/' . $xoopsModule->getVar('dirname', 'n') . '/class/uploader.php';
189
-            $maxfilesize = $forum_obj->getVar('attach_maxkb') * 1024;
190
-            $uploaddir   = XOOPS_CACHE_PATH;
186
+            if (isset($_FILES['userfile']['name']) && '' != $_FILES['userfile']['name']
187
+                && $topicHandler->getPermission($forum_obj, $topic_status, 'attach')) {
188
+                require_once XOOPS_ROOT_PATH . '/modules/' . $xoopsModule->getVar('dirname', 'n') . '/class/uploader.php';
189
+                $maxfilesize = $forum_obj->getVar('attach_maxkb') * 1024;
190
+                $uploaddir   = XOOPS_CACHE_PATH;
191 191
 
192
-            $uploader = new sfUploader($uploaddir, $newAnswerObj->getVar('attach_ext'), (int)$maxfilesize, (int)$xoopsModuleConfig['max_img_width'], (int)$xoopsModuleConfig['max_img_height']);
192
+                $uploader = new sfUploader($uploaddir, $newAnswerObj->getVar('attach_ext'), (int)$maxfilesize, (int)$xoopsModuleConfig['max_img_width'], (int)$xoopsModuleConfig['max_img_height']);
193 193
 
194
-            if ($_FILES['userfile']['error'] > 0) {
195
-                switch ($_FILES['userfile']['error']) {
194
+                if ($_FILES['userfile']['error'] > 0) {
195
+                    switch ($_FILES['userfile']['error']) {
196 196
                     case 1:
197 197
                         $error_message[] = _MD_NEWBB_MAXUPLOADFILEINI;
198 198
                         break;
@@ -202,7 +202,7 @@  discard block
 block discarded – undo
202 202
                     default:
203 203
                         $error_message[] = _MD_NEWBB_UPLOAD_ERRNODEF;
204 204
                         break;
205
-                }
205
+                    }
206 206
             } else {
207 207
                 $uploader->setCheckMediaTypeByExt();
208 208
 
@@ -265,30 +265,30 @@  discard block
 block discarded – undo
265 265
         redirect_header('index.php', 2, $redirect_msg);
266 266
         break;
267 267
 
268
-    case 'form':
269
-    default:
268
+        case 'form':
269
+        default:
270 270
 
271
-        global $xoopsUser, $myts;
271
+            global $xoopsUser, $myts;
272 272
 
273
-        $faqObj      = $faqHandler->create();
274
-        $answerObj   = $answerHandler->create();
275
-        $categoryObj = $categoryHandler->create();
273
+            $faqObj      = $faqHandler->create();
274
+            $answerObj   = $answerHandler->create();
275
+            $categoryObj = $categoryHandler->create();
276 276
 
277
-        $GLOBALS['xoopsOption']['template_main'] = 'smartfaq_submit.html';
278
-        require_once XOOPS_ROOT_PATH . '/header.php';
279
-        require_once __DIR__ . '/footer.php';
277
+            $GLOBALS['xoopsOption']['template_main'] = 'smartfaq_submit.html';
278
+            require_once XOOPS_ROOT_PATH . '/header.php';
279
+            require_once __DIR__ . '/footer.php';
280 280
 
281
-        $name       = $xoopsUser ? ucwords($xoopsUser->getVar('uname')) : 'Anonymous';
282
-        $notifypub  = 1;
283
-        $moduleName =& $myts->displayTarea($xoopsModule->getVar('name'));
284
-        $xoopsTpl->assign('whereInSection', $moduleName);
285
-        $xoopsTpl->assign('lang_submit', _MD_SF_SUB_SNEWNAME);
281
+            $name       = $xoopsUser ? ucwords($xoopsUser->getVar('uname')) : 'Anonymous';
282
+            $notifypub  = 1;
283
+            $moduleName =& $myts->displayTarea($xoopsModule->getVar('name'));
284
+            $xoopsTpl->assign('whereInSection', $moduleName);
285
+            $xoopsTpl->assign('lang_submit', _MD_SF_SUB_SNEWNAME);
286 286
 
287
-        $xoopsTpl->assign('lang_intro_title', sprintf(_MD_SF_SUB_SNEWNAME, ucwords($xoopsModule->name())));
288
-        $xoopsTpl->assign('lang_intro_text', _MD_SF_GOODDAY . "<b>$name</b>, " . _MD_SF_SUB_INTRO);
287
+            $xoopsTpl->assign('lang_intro_title', sprintf(_MD_SF_SUB_SNEWNAME, ucwords($xoopsModule->name())));
288
+            $xoopsTpl->assign('lang_intro_text', _MD_SF_GOODDAY . "<b>$name</b>, " . _MD_SF_SUB_INTRO);
289 289
 
290
-        require_once __DIR__ . '/include/submit.inc.php';
290
+            require_once __DIR__ . '/include/submit.inc.php';
291 291
 
292
-        require_once XOOPS_ROOT_PATH . '/footer.php';
293
-        break;
292
+            require_once XOOPS_ROOT_PATH . '/footer.php';
293
+            break;
294 294
 }
Please login to merge, or discard this patch.
Spacing   +22 added lines, -22 removed lines patch added patch discarded remove patch
@@ -6,7 +6,7 @@  discard block
 block discarded – undo
6 6
  * Licence: GNU
7 7
  */
8 8
 
9
-require_once __DIR__ . '/header.php';
9
+require_once __DIR__.'/header.php';
10 10
 
11 11
 global $xoopsUser, $xoopsConfig, $xoopsModuleConfig, $xoopsModule;
12 12
 
@@ -83,12 +83,12 @@  discard block
 block discarded – undo
83 83
         global $xoopsUser, $myts;
84 84
 
85 85
         $GLOBALS['xoopsOption']['template_main'] = 'smartfaq_submit.tpl';
86
-        require_once XOOPS_ROOT_PATH . '/header.php';
87
-        require_once __DIR__ . '/footer.php';
86
+        require_once XOOPS_ROOT_PATH.'/header.php';
87
+        require_once __DIR__.'/footer.php';
88 88
 
89 89
         $name = $xoopsUser ? ucwords($xoopsUser->getVar('uname')) : 'Anonymous';
90 90
 
91
-        $moduleName          =& $myts->displayTarea($xoopsModule->getVar('name'));
91
+        $moduleName          = & $myts->displayTarea($xoopsModule->getVar('name'));
92 92
         $faq                 = $faqObj->toArray(null, $categoryObj, false);
93 93
         $faq['categoryPath'] = $categoryObj->getCategoryPath(true);
94 94
         $faq['answer']       = $answerObj->answer();
@@ -101,11 +101,11 @@  discard block
 block discarded – undo
101 101
         $xoopsTpl->assign('lang_submit', _MD_SF_SUB_SNEWNAME);
102 102
 
103 103
         $xoopsTpl->assign('lang_intro_title', sprintf(_MD_SF_SUB_SNEWNAME, ucwords($xoopsModule->name())));
104
-        $xoopsTpl->assign('lang_intro_text', _MD_SF_GOODDAY . "<b>$name</b>, " . _MD_SF_SUB_INTRO);
104
+        $xoopsTpl->assign('lang_intro_text', _MD_SF_GOODDAY."<b>$name</b>, "._MD_SF_SUB_INTRO);
105 105
 
106
-        require_once __DIR__ . '/include/submit.inc.php';
106
+        require_once __DIR__.'/include/submit.inc.php';
107 107
 
108
-        require_once XOOPS_ROOT_PATH . '/footer.php';
108
+        require_once XOOPS_ROOT_PATH.'/footer.php';
109 109
 
110 110
         exit();
111 111
         break;
@@ -169,14 +169,14 @@  discard block
 block discarded – undo
169 169
             $attachments_tmp = unserialize(base64_decode($_POST['attachments_tmp']));
170 170
             if (isset($_POST['delete_tmp']) && count($_POST['delete_tmp'])) {
171 171
                 foreach ($_POST['delete_tmp'] as $key) {
172
-                    unlink(XOOPS_ROOT_PATH . '/' . $xoopsModuleConfig['dir_attachments'] . '/' . $attachments_tmp[$key][0]);
172
+                    unlink(XOOPS_ROOT_PATH.'/'.$xoopsModuleConfig['dir_attachments'].'/'.$attachments_tmp[$key][0]);
173 173
                     unset($attachments_tmp[$key]);
174 174
                 }
175 175
             }
176 176
         }
177 177
         if (count($attachments_tmp)) {
178 178
             foreach ($attachments_tmp as $key => $attach) {
179
-                if (rename(XOOPS_CACHE_PATH . '/' . $attachments_tmp[$key][0], XOOPS_ROOT_PATH . '/' . $xoopsModuleConfig['dir_attachments'] . '/' . $attachments_tmp[$key][0])) {
179
+                if (rename(XOOPS_CACHE_PATH.'/'.$attachments_tmp[$key][0], XOOPS_ROOT_PATH.'/'.$xoopsModuleConfig['dir_attachments'].'/'.$attachments_tmp[$key][0])) {
180 180
                     $post_obj->setAttachment($attach[0], $attach[1], $attach[2]);
181 181
                 }
182 182
             }
@@ -185,11 +185,11 @@  discard block
 block discarded – undo
185 185
 
186 186
         if (isset($_FILES['userfile']['name']) && '' != $_FILES['userfile']['name']
187 187
             && $topicHandler->getPermission($forum_obj, $topic_status, 'attach')) {
188
-            require_once XOOPS_ROOT_PATH . '/modules/' . $xoopsModule->getVar('dirname', 'n') . '/class/uploader.php';
188
+            require_once XOOPS_ROOT_PATH.'/modules/'.$xoopsModule->getVar('dirname', 'n').'/class/uploader.php';
189 189
             $maxfilesize = $forum_obj->getVar('attach_maxkb') * 1024;
190 190
             $uploaddir   = XOOPS_CACHE_PATH;
191 191
 
192
-            $uploader = new sfUploader($uploaddir, $newAnswerObj->getVar('attach_ext'), (int)$maxfilesize, (int)$xoopsModuleConfig['max_img_width'], (int)$xoopsModuleConfig['max_img_height']);
192
+            $uploader = new sfUploader($uploaddir, $newAnswerObj->getVar('attach_ext'), (int) $maxfilesize, (int) $xoopsModuleConfig['max_img_width'], (int) $xoopsModuleConfig['max_img_height']);
193 193
 
194 194
             if ($_FILES['userfile']['error'] > 0) {
195 195
                 switch ($_FILES['userfile']['error']) {
@@ -207,19 +207,19 @@  discard block
 block discarded – undo
207 207
                 $uploader->setCheckMediaTypeByExt();
208 208
 
209 209
                 if ($uploader->fetchMedia($_POST['xoops_upload_file'][0])) {
210
-                    $prefix = is_object($xoopsUser) ? (string)$xoopsUser->uid() . '_' : 'newbb_';
210
+                    $prefix = is_object($xoopsUser) ? (string) $xoopsUser->uid().'_' : 'newbb_';
211 211
                     $uploader->setPrefix($prefix);
212 212
                     if (!$uploader->upload()) {
213
-                        $error_message[] = $error_upload =& $uploader->getErrors();
213
+                        $error_message[] = $error_upload = & $uploader->getErrors();
214 214
                     } else {
215 215
                         if (is_file($uploader->getSavedDestination())) {
216
-                            if (rename(XOOPS_CACHE_PATH . '/' . $uploader->getSavedFileName(), XOOPS_ROOT_PATH . '/' . $xoopsModuleConfig['dir_attachments'] . '/' . $uploader->getSavedFileName())) {
216
+                            if (rename(XOOPS_CACHE_PATH.'/'.$uploader->getSavedFileName(), XOOPS_ROOT_PATH.'/'.$xoopsModuleConfig['dir_attachments'].'/'.$uploader->getSavedFileName())) {
217 217
                                 $post_obj->setAttachment($uploader->getSavedFileName(), $uploader->getMediaName(), $uploader->getMediaType());
218 218
                             }
219 219
                         }
220 220
                     }
221 221
                 } else {
222
-                    $error_message[] = $error_upload =& $uploader->getErrors();
222
+                    $error_message[] = $error_upload = & $uploader->getErrors();
223 223
                 }
224 224
             }
225 225
         }
@@ -252,7 +252,7 @@  discard block
 block discarded – undo
252 252
         } else {
253 253
             // Subscribe the user to On Published notification, if requested
254 254
             if (1 == $notifypub) {
255
-                require_once XOOPS_ROOT_PATH . '/include/notification_constants.php';
255
+                require_once XOOPS_ROOT_PATH.'/include/notification_constants.php';
256 256
                 $notificationHandler = xoops_getHandler('notification');
257 257
                 $notificationHandler->subscribe('faq', $newFaqObj->faqid(), 'approved', XOOPS_NOTIFICATION_MODE_SENDONCETHENDELETE);
258 258
             }
@@ -275,20 +275,20 @@  discard block
 block discarded – undo
275 275
         $categoryObj = $categoryHandler->create();
276 276
 
277 277
         $GLOBALS['xoopsOption']['template_main'] = 'smartfaq_submit.html';
278
-        require_once XOOPS_ROOT_PATH . '/header.php';
279
-        require_once __DIR__ . '/footer.php';
278
+        require_once XOOPS_ROOT_PATH.'/header.php';
279
+        require_once __DIR__.'/footer.php';
280 280
 
281 281
         $name       = $xoopsUser ? ucwords($xoopsUser->getVar('uname')) : 'Anonymous';
282 282
         $notifypub  = 1;
283
-        $moduleName =& $myts->displayTarea($xoopsModule->getVar('name'));
283
+        $moduleName = & $myts->displayTarea($xoopsModule->getVar('name'));
284 284
         $xoopsTpl->assign('whereInSection', $moduleName);
285 285
         $xoopsTpl->assign('lang_submit', _MD_SF_SUB_SNEWNAME);
286 286
 
287 287
         $xoopsTpl->assign('lang_intro_title', sprintf(_MD_SF_SUB_SNEWNAME, ucwords($xoopsModule->name())));
288
-        $xoopsTpl->assign('lang_intro_text', _MD_SF_GOODDAY . "<b>$name</b>, " . _MD_SF_SUB_INTRO);
288
+        $xoopsTpl->assign('lang_intro_text', _MD_SF_GOODDAY."<b>$name</b>, "._MD_SF_SUB_INTRO);
289 289
 
290
-        require_once __DIR__ . '/include/submit.inc.php';
290
+        require_once __DIR__.'/include/submit.inc.php';
291 291
 
292
-        require_once XOOPS_ROOT_PATH . '/footer.php';
292
+        require_once XOOPS_ROOT_PATH.'/footer.php';
293 293
         break;
294 294
 }
Please login to merge, or discard this patch.
include/functions.render.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -11,7 +11,7 @@  discard block
 block discarded – undo
11 11
 
12 12
 // defined('XOOPS_ROOT_PATH') || exit('Restricted access.');
13 13
 
14
-defined('NEWBB_FUNCTIONS_INI') || include __DIR__ . '/functions.ini.php';
14
+defined('NEWBB_FUNCTIONS_INI') || include __DIR__.'/functions.ini.php';
15 15
 define('NEWBB_FUNCTIONS_RENDER_LOADED', true);
16 16
 
17 17
 if (!defined('NEWBB_FUNCTIONS_RENDER')):
@@ -56,16 +56,16 @@  discard block
 block discarded – undo
56 56
             // decode xcode
57 57
             if (0 != $image) {
58 58
                 // image allowed
59
-                $text =& $myts->xoopsCodeDecode($text);
59
+                $text = & $myts->xoopsCodeDecode($text);
60 60
             } else {
61 61
                 // image not allowed
62
-                $text =& $myts->xoopsCodeDecode($text, 0);
62
+                $text = & $myts->xoopsCodeDecode($text, 0);
63 63
             }
64 64
         }
65 65
         if (0 != $br) {
66
-            $text =& $myts->nl2Br($text);
66
+            $text = & $myts->nl2Br($text);
67 67
         }
68
-        $text = $myts->codeConv($text, $xcode, $image);    // Ryuji_edit(2003-11-18)
68
+        $text = $myts->codeConv($text, $xcode, $image); // Ryuji_edit(2003-11-18)
69 69
 
70 70
         return $text;
71 71
     }
@@ -95,7 +95,7 @@  discard block
 block discarded – undo
95 95
     {
96 96
         $button = "<input type='button' name='{$button}' {$extra} value='{$alt}' onclick='window.location.href={$link}'>";
97 97
         if (empty($asImage)) {
98
-            $button = "<a href='{$link}' title='{$alt}' {$extra}>" . sf_displayImage($button, $alt, true) . '</a>';
98
+            $button = "<a href='{$link}' title='{$alt}' {$extra}>".sf_displayImage($button, $alt, true).'</a>';
99 99
         }
100 100
 
101 101
         return $button;
@@ -147,7 +147,7 @@  discard block
 block discarded – undo
147 147
         }
148 148
 
149 149
         if (!class_exists('NewbbIconHandler')) {
150
-            require_once __DIR__ . '/../class/icon.php';
150
+            require_once __DIR__.'/../class/icon.php';
151 151
         }
152 152
 
153 153
         $iconHandler           = NewbbIconHandler::getInstance();
Please login to merge, or discard this patch.
include/functions.image.php 1 patch
Spacing   +31 added lines, -31 removed lines patch added patch discarded remove patch
@@ -28,24 +28,24 @@  discard block
 block discarded – undo
28 28
     {
29 29
         global $xoopsModuleConfig;
30 30
 
31
-        $img_path   = XOOPS_ROOT_PATH . '/' . $xoopsModuleConfig['dir_attachments'];
32
-        $img_url    = XOOPS_URL . '/' . $xoopsModuleConfig['dir_attachments'];
33
-        $thumb_path = $img_path . '/thumbs';
34
-        $thumb_url  = $img_url . '/thumbs';
31
+        $img_path   = XOOPS_ROOT_PATH.'/'.$xoopsModuleConfig['dir_attachments'];
32
+        $img_url    = XOOPS_URL.'/'.$xoopsModuleConfig['dir_attachments'];
33
+        $thumb_path = $img_path.'/thumbs';
34
+        $thumb_url  = $img_url.'/thumbs';
35 35
 
36
-        $thumb     = $thumb_path . '/' . $source;
37
-        $image     = $img_path . '/' . $source;
38
-        $thumb_url = $thumb_url . '/' . $source;
39
-        $image_url = $img_url . '/' . $source;
36
+        $thumb     = $thumb_path.'/'.$source;
37
+        $image     = $img_path.'/'.$source;
38
+        $thumb_url = $thumb_url.'/'.$source;
39
+        $image_url = $img_url.'/'.$source;
40 40
 
41 41
         $imginfo  = @getimagesize($image);
42
-        $img_info = (count($imginfo) > 0) ? $imginfo[0] . 'X' . $imginfo[1] . ' px' : '';
42
+        $img_info = (count($imginfo) > 0) ? $imginfo[0].'X'.$imginfo[1].' px' : '';
43 43
 
44 44
         if ($xoopsModuleConfig['max_image_width'] > 0 && $xoopsModuleConfig['max_image_height'] > 0) {
45 45
             if ($imginfo[0] > $xoopsModuleConfig['max_image_width']
46 46
                 || $imginfo[1] > $xoopsModuleConfig['max_image_height']) {
47 47
                 //if (!file_exists($thumb_path.'/'.$source) && $imginfo[0] > $xoopsModuleConfig['max_img_width']) {
48
-                if (!file_exists($thumb_path . '/' . $source)) {
48
+                if (!file_exists($thumb_path.'/'.$source)) {
49 49
                     sf_createThumbnail($source, $xoopsModuleConfig['max_image_width']);
50 50
                 }
51 51
             }
@@ -54,27 +54,27 @@  discard block
 block discarded – undo
54 54
                 || $imginfo[1] > $xoopsModuleConfig['max_image_height']) {
55 55
                 $pseudo_width  = $xoopsModuleConfig['max_image_width'];
56 56
                 $pseudo_height = $xoopsModuleConfig['max_image_width'] * ($imginfo[1] / $imginfo[0]);
57
-                $pseudo_size   = "width='" . $pseudo_width . "px' height='" . $pseudo_height . "px'";
57
+                $pseudo_size   = "width='".$pseudo_width."px' height='".$pseudo_height."px'";
58 58
             }
59 59
             // irmtfan to fix Undefined variable: pseudo_height
60 60
             if (!empty($pseudo_height) && $xoopsModuleConfig['max_image_height'] > 0
61 61
                 && $pseudo_height > $xoopsModuleConfig['max_image_height']) {
62 62
                 $pseudo_height = $xoopsModuleConfig['max_image_height'];
63 63
                 $pseudo_width  = $xoopsModuleConfig['max_image_height'] * ($imginfo[0] / $imginfo[1]);
64
-                $pseudo_size   = "width='" . $pseudo_width . "px' height='" . $pseudo_height . "px'";
64
+                $pseudo_size   = "width='".$pseudo_width."px' height='".$pseudo_height."px'";
65 65
             }
66 66
         }
67 67
 
68 68
         if (file_exists($thumb)) {
69
-            $attachmentImage = '<a href="' . $image_url . '" title="' . $source . ' ' . $img_info . '" target="_blank">';
70
-            $attachmentImage .= '<img src="' . $thumb_url . '" alt="' . $source . ' ' . $img_info . '">';
69
+            $attachmentImage = '<a href="'.$image_url.'" title="'.$source.' '.$img_info.'" target="_blank">';
70
+            $attachmentImage .= '<img src="'.$thumb_url.'" alt="'.$source.' '.$img_info.'">';
71 71
             $attachmentImage .= '</a>';
72 72
         } elseif (!empty($pseudo_size)) {
73
-            $attachmentImage = '<a href="' . $image_url . '" title="' . $source . ' ' . $img_info . '" target="_blank">';
74
-            $attachmentImage .= '<img src="' . $image_url . '" ' . $pseudo_size . ' alt="' . $source . ' ' . $img_info . '">';
73
+            $attachmentImage = '<a href="'.$image_url.'" title="'.$source.' '.$img_info.'" target="_blank">';
74
+            $attachmentImage .= '<img src="'.$image_url.'" '.$pseudo_size.' alt="'.$source.' '.$img_info.'">';
75 75
             $attachmentImage .= '</a>';
76 76
         } elseif (file_exists($image)) {
77
-            $attachmentImage = '<img src="' . $image_url . '" alt="' . $source . ' ' . $img_info . '">';
77
+            $attachmentImage = '<img src="'.$image_url.'" alt="'.$source.' '.$img_info.'">';
78 78
         } else {
79 79
             $attachmentImage = '';
80 80
         }
@@ -91,10 +91,10 @@  discard block
 block discarded – undo
91 91
     {
92 92
         global $xoopsModuleConfig;
93 93
 
94
-        $img_path   = XOOPS_ROOT_PATH . '/' . $xoopsModuleConfig['dir_attachments'];
95
-        $thumb_path = $img_path . '/thumbs';
96
-        $src_file   = $img_path . '/' . $source;
97
-        $new_file   = $thumb_path . '/' . $source;
94
+        $img_path   = XOOPS_ROOT_PATH.'/'.$xoopsModuleConfig['dir_attachments'];
95
+        $thumb_path = $img_path.'/thumbs';
96
+        $src_file   = $img_path.'/'.$source;
97
+        $new_file   = $thumb_path.'/'.$source;
98 98
         //$imageLibs = sf_getImageLibs();
99 99
 
100 100
         if (!filesize($src_file) || !is_readable($src_file)) {
@@ -114,20 +114,20 @@  discard block
 block discarded – undo
114 114
             return false;
115 115
         }
116 116
 
117
-        $newWidth  = (int)min($imginfo[0], $thumb_width);
118
-        $newHeight = (int)($imginfo[1] * $newWidth / $imginfo[0]);
117
+        $newWidth  = (int) min($imginfo[0], $thumb_width);
118
+        $newHeight = (int) ($imginfo[1] * $newWidth / $imginfo[0]);
119 119
 
120 120
         if (1 == $xoopsModuleConfig['image_lib'] or 0 == $xoopsModuleConfig['image_lib']) {
121 121
             if (preg_match("#[A-Z]:|\\\\#Ai", __FILE__)) {
122 122
                 $cur_dir     = __DIR__;
123
-                $src_file_im = '"' . $cur_dir . '\\' . strtr($src_file, '/', '\\') . '"';
124
-                $new_file_im = '"' . $cur_dir . '\\' . strtr($new_file, '/', '\\') . '"';
123
+                $src_file_im = '"'.$cur_dir.'\\'.strtr($src_file, '/', '\\').'"';
124
+                $new_file_im = '"'.$cur_dir.'\\'.strtr($new_file, '/', '\\').'"';
125 125
             } else {
126 126
                 $src_file_im = @escapeshellarg($src_file);
127 127
                 $new_file_im = @escapeshellarg($new_file);
128 128
             }
129
-            $path           = empty($xoopsModuleConfig['path_magick']) ? '' : $xoopsModuleConfig['path_magick'] . '/';
130
-            $magick_command = $path . 'convert -quality 85 -antialias -sample ' . $newWidth . 'x' . $newHeight . ' ' . $src_file_im . ' +profile "*" ' . str_replace('\\', '/', $new_file_im) . '';
129
+            $path           = empty($xoopsModuleConfig['path_magick']) ? '' : $xoopsModuleConfig['path_magick'].'/';
130
+            $magick_command = $path.'convert -quality 85 -antialias -sample '.$newWidth.'x'.$newHeight.' '.$src_file_im.' +profile "*" '.str_replace('\\', '/', $new_file_im).'';
131 131
 
132 132
             @passthru($magick_command);
133 133
             if (file_exists($new_file)) {
@@ -136,13 +136,13 @@  discard block
 block discarded – undo
136 136
         }
137 137
 
138 138
         if (2 == $xoopsModuleConfig['image_lib'] or 0 == $xoopsModuleConfig['image_lib']) {
139
-            $path = empty($xoopsModuleConfig['path_netpbm']) ? '' : $xoopsModuleConfig['path_netpbm'] . '/';
139
+            $path = empty($xoopsModuleConfig['path_netpbm']) ? '' : $xoopsModuleConfig['path_netpbm'].'/';
140 140
             if (preg_match("/\.png/i", $source)) {
141
-                $cmd = $path . "pngtopnm $src_file | " . $path . "pnmscale -xysize $newWidth $newHeight | " . $path . "pnmtopng > $new_file";
141
+                $cmd = $path."pngtopnm $src_file | ".$path."pnmscale -xysize $newWidth $newHeight | ".$path."pnmtopng > $new_file";
142 142
             } elseif (preg_match("/\.(jpg|jpeg)/i", $source)) {
143
-                $cmd = $path . "jpegtopnm $src_file | " . $path . "pnmscale -xysize $newWidth $newHeight | " . $path . "ppmtojpeg -quality=90 > $new_file";
143
+                $cmd = $path."jpegtopnm $src_file | ".$path."pnmscale -xysize $newWidth $newHeight | ".$path."ppmtojpeg -quality=90 > $new_file";
144 144
             } elseif (preg_match("/\.gif/i", $source)) {
145
-                $cmd = $path . "giftopnm $src_file | " . $path . "pnmscale -xysize $newWidth $newHeight | ppmquant 256 | " . $path . "ppmtogif > $new_file";
145
+                $cmd = $path."giftopnm $src_file | ".$path."pnmscale -xysize $newWidth $newHeight | ppmquant 256 | ".$path."ppmtogif > $new_file";
146 146
             }
147 147
 
148 148
             @exec($cmd, $output, $retval);
Please login to merge, or discard this patch.
include/submit.inc.php 1 patch
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -9,11 +9,11 @@  discard block
 block discarded – undo
9 9
 
10 10
 global $_POST, $xoopsDB;
11 11
 
12
-require_once XOOPS_ROOT_PATH . '/class/xoopstree.php';
13
-require_once XOOPS_ROOT_PATH . '/class/xoopslists.php';
14
-require_once XOOPS_ROOT_PATH . '/class/xoopsformloader.php';
12
+require_once XOOPS_ROOT_PATH.'/class/xoopstree.php';
13
+require_once XOOPS_ROOT_PATH.'/class/xoopslists.php';
14
+require_once XOOPS_ROOT_PATH.'/class/xoopsformloader.php';
15 15
 
16
-require_once __DIR__ . '/functions.php';
16
+require_once __DIR__.'/functions.php';
17 17
 
18 18
 $mytree = new XoopsTree($xoopsDB->prefix('smartfaq_categories'), 'categoryid', 'parentid');
19 19
 $form   = new XoopsThemeForm(_MD_SF_SUB_SMNAME, 'form', xoops_getenv('PHP_SELF'), 'post', true);
@@ -70,18 +70,18 @@  discard block
 block discarded – undo
70 70
 //    $upload_tray->addElement(new XoopsFormFile('', 'userfile', ($forum_obj->getVar('attach_maxkb') * 1024)));
71 71
 $upload_tray->addElement(new XoopsFormFile('', 'userfile', $xoopsModuleConfig['max_image_size'] * 1024));
72 72
 $upload_tray->addElement(new XoopsFormButton('', 'contents_upload', _MD_SF_UPLOAD, 'submit'));
73
-$upload_tray->addElement(new XoopsFormLabel('<br><br>' . _MD_SF_MAX_FILESIZE . ':', $xoopsModuleConfig['max_image_size'] . 'Kb; '));
73
+$upload_tray->addElement(new XoopsFormLabel('<br><br>'._MD_SF_MAX_FILESIZE.':', $xoopsModuleConfig['max_image_size'].'Kb; '));
74 74
 $extensions = trim(str_replace('|', ' ', $xoopsModuleConfig['attach_ext']));
75 75
 $extensions = (empty($extensions) || '*' === $extensions) ? _ALL : $extensions;
76
-$upload_tray->addElement(new XoopsFormLabel(_MD_SF_ALLOWED_EXTENSIONS . ':', $extensions));
77
-$upload_tray->addElement(new XoopsFormLabel('<br>' . sprintf(_MD_SF_MAXPIC, $xoopsModuleConfig['max_img_height'], $xoopsModuleConfig['max_img_width'])));
76
+$upload_tray->addElement(new XoopsFormLabel(_MD_SF_ALLOWED_EXTENSIONS.':', $extensions));
77
+$upload_tray->addElement(new XoopsFormLabel('<br>'.sprintf(_MD_SF_MAXPIC, $xoopsModuleConfig['max_img_height'], $xoopsModuleConfig['max_img_width'])));
78 78
 $form->addElement($upload_tray);
79 79
 //}
80 80
 
81 81
 if (!empty($attachments) && is_array($attachments) && count($attachments)) {
82 82
     $delete_attach_checkbox = new XoopsFormCheckBox(_MD_SF_ATTACHED_FILES, 'delete_attach[]');
83 83
     foreach ($attachments as $key => $attachment) {
84
-        $attach = ' ' . _DELETE . ' <a href=' . XOOPS_URL . '/' . $xoopsModuleConfig['dir_attachments'] . '/' . $attachment['name_saved'] . ' rel="external">' . $attachment['name_display'] . '</a><br>';
84
+        $attach = ' '._DELETE.' <a href='.XOOPS_URL.'/'.$xoopsModuleConfig['dir_attachments'].'/'.$attachment['name_saved'].' rel="external">'.$attachment['name_display'].'</a><br>';
85 85
         $delete_attach_checkbox->addOption($key, $attach);
86 86
     }
87 87
     $form->addElement($delete_attach_checkbox);
@@ -92,7 +92,7 @@  discard block
 block discarded – undo
92 92
     $delete_attach_checkbox = new XoopsFormCheckBox(_MD_REMOVE, 'delete_tmp[]');
93 93
     $url_prefix             = str_replace(XOOPS_ROOT_PATH, XOOPS_URL, XOOPS_CACHE_PATH);
94 94
     foreach ($attachments_tmp as $key => $attachment) {
95
-        $attach = ' <a href="' . $url_prefix . '/' . $attachment[0] . '" rel="external">' . $attachment[1] . '</a><br>';
95
+        $attach = ' <a href="'.$url_prefix.'/'.$attachment[0].'" rel="external">'.$attachment[1].'</a><br>';
96 96
         $delete_attach_checkbox->addOption($key, $attach);
97 97
     }
98 98
     $form->addElement($delete_attach_checkbox);
Please login to merge, or discard this patch.