Passed
Push — master ( 492cc7...e5a5fc )
by Michael
45s queued 11s
created
admin/admin_votedata.php 1 patch
Indentation   +64 added lines, -64 removed lines patch added patch discarded remove patch
@@ -36,56 +36,56 @@  discard block
 block discarded – undo
36 36
 $op = $op = Request::getCmd('op', Request::getCmd('op', '', 'POST'), 'GET'); //!empty($_GET['op'])? $_GET['op'] : (!empty($_POST['op'])?$_POST['op']:"");
37 37
 
38 38
 switch ($op) {
39
-    case 'delvotes':
40
-        $rid      = Request::getInt('rid', 0, 'GET');
41
-        $topic_id = Request::getInt('topic_id', 0, 'GET');
42
-        $sql      = $GLOBALS['xoopsDB']->queryF('DELETE FROM ' . $GLOBALS['xoopsDB']->prefix('newbb_votedata') . " WHERE ratingid = $rid");
43
-        $GLOBALS['xoopsDB']->query($sql);
39
+	case 'delvotes':
40
+		$rid      = Request::getInt('rid', 0, 'GET');
41
+		$topic_id = Request::getInt('topic_id', 0, 'GET');
42
+		$sql      = $GLOBALS['xoopsDB']->queryF('DELETE FROM ' . $GLOBALS['xoopsDB']->prefix('newbb_votedata') . " WHERE ratingid = $rid");
43
+		$GLOBALS['xoopsDB']->query($sql);
44 44
 
45
-        $query       = 'SELECT rating FROM ' . $GLOBALS['xoopsDB']->prefix('newbb_votedata') . ' WHERE topic_id = ' . $topic_id . ' ';
46
-        $voteresult  = $GLOBALS['xoopsDB']->query($query);
47
-        $votesDB     = $GLOBALS['xoopsDB']->getRowsNum($voteresult);
48
-        $totalrating = 0;
49
-        while (false !== (list($rating) = $GLOBALS['xoopsDB']->fetchRow($voteresult))) {
50
-            $totalrating += $rating;
51
-        }
52
-        $finalrating = $totalrating / $votesDB;
53
-        $finalrating = number_format($finalrating, 4);
54
-        $sql         = sprintf('UPDATE `%s` SET rating = %u, votes = %u WHERE topic_id = %u', $GLOBALS['xoopsDB']->prefix('newbb_topics'), $finalrating, $votesDB, $topic_id);
55
-        $GLOBALS['xoopsDB']->queryF($sql);
45
+		$query       = 'SELECT rating FROM ' . $GLOBALS['xoopsDB']->prefix('newbb_votedata') . ' WHERE topic_id = ' . $topic_id . ' ';
46
+		$voteresult  = $GLOBALS['xoopsDB']->query($query);
47
+		$votesDB     = $GLOBALS['xoopsDB']->getRowsNum($voteresult);
48
+		$totalrating = 0;
49
+		while (false !== (list($rating) = $GLOBALS['xoopsDB']->fetchRow($voteresult))) {
50
+			$totalrating += $rating;
51
+		}
52
+		$finalrating = $totalrating / $votesDB;
53
+		$finalrating = number_format($finalrating, 4);
54
+		$sql         = sprintf('UPDATE `%s` SET rating = %u, votes = %u WHERE topic_id = %u', $GLOBALS['xoopsDB']->prefix('newbb_topics'), $finalrating, $votesDB, $topic_id);
55
+		$GLOBALS['xoopsDB']->queryF($sql);
56 56
 
57
-        redirect_header('admin_votedata.php', 1, _AM_NEWBB_VOTEDELETED);
58
-        break;
57
+		redirect_header('admin_votedata.php', 1, _AM_NEWBB_VOTEDELETED);
58
+		break;
59 59
 
60
-    case 'main':
61
-    default:
62
-        $start         = Request::getInt('start', 0, 'POST');
63
-        $useravgrating = '0';
64
-        $uservotes     = '0';
60
+	case 'main':
61
+	default:
62
+		$start         = Request::getInt('start', 0, 'POST');
63
+		$useravgrating = '0';
64
+		$uservotes     = '0';
65 65
 
66
-        $sql     = 'SELECT * FROM ' . $GLOBALS['xoopsDB']->prefix('newbb_votedata') . ' ORDER BY ratingtimestamp DESC';
67
-        $results = $GLOBALS['xoopsDB']->query($sql, 20, $start);
68
-        $votes   = $GLOBALS['xoopsDB']->getRowsNum($results);
66
+		$sql     = 'SELECT * FROM ' . $GLOBALS['xoopsDB']->prefix('newbb_votedata') . ' ORDER BY ratingtimestamp DESC';
67
+		$results = $GLOBALS['xoopsDB']->query($sql, 20, $start);
68
+		$votes   = $GLOBALS['xoopsDB']->getRowsNum($results);
69 69
 
70
-        $sql           = 'SELECT rating FROM ' . $GLOBALS['xoopsDB']->prefix('newbb_votedata') . ' ';
71
-        $result2       = $GLOBALS['xoopsDB']->query($sql, 20, $start);
72
-        $uservotes     = $GLOBALS['xoopsDB']->getRowsNum($result2);
73
-        $useravgrating = 0;
70
+		$sql           = 'SELECT rating FROM ' . $GLOBALS['xoopsDB']->prefix('newbb_votedata') . ' ';
71
+		$result2       = $GLOBALS['xoopsDB']->query($sql, 20, $start);
72
+		$uservotes     = $GLOBALS['xoopsDB']->getRowsNum($result2);
73
+		$useravgrating = 0;
74 74
 
75
-        while (false !== (list($rating2) = $GLOBALS['xoopsDB']->fetchRow($result2))) {
76
-            //            $useravgrating = $useravgrating + $rating2;
77
-            $useravgrating += $rating2;
78
-        }
79
-        if ($useravgrating > 0) {
80
-            //            $useravgrating = $useravgrating / $uservotes;
81
-            $useravgrating /= $uservotes;
82
-            $useravgrating = number_format($useravgrating, 2);
83
-        }
75
+		while (false !== (list($rating2) = $GLOBALS['xoopsDB']->fetchRow($result2))) {
76
+			//            $useravgrating = $useravgrating + $rating2;
77
+			$useravgrating += $rating2;
78
+		}
79
+		if ($useravgrating > 0) {
80
+			//            $useravgrating = $useravgrating / $uservotes;
81
+			$useravgrating /= $uservotes;
82
+			$useravgrating = number_format($useravgrating, 2);
83
+		}
84 84
 
85
-        xoops_cp_header();
86
-        $adminObject->displayNavigation(basename(__FILE__));
85
+		xoops_cp_header();
86
+		$adminObject->displayNavigation(basename(__FILE__));
87 87
 
88
-        echo "<div style='padding: 8px;'>\n
88
+		echo "<div style='padding: 8px;'>\n
89 89
         <div><strong>" . _AM_NEWBB_VOTE_USERAVG . ": </strong>$useravgrating</div>\n
90 90
         <div><strong>" . _AM_NEWBB_VOTE_TOTALRATE . ": </strong>$uservotes</div>\n
91 91
         <div style='padding: 8px;'>\n
@@ -103,16 +103,16 @@  discard block
 block discarded – undo
103 103
         <th align='center'>" . _AM_NEWBB_VOTE_DATE . "</th>\n
104 104
         <th align='center'>" . _AM_NEWBB_ACTION . "</th></tr>\n";
105 105
 
106
-        if (0 == $votes) {
107
-            echo "<tr><td align='center' colspan='7' class='head'>" . _AM_NEWBB_VOTE_NOVOTES . '</td></tr>';
108
-        }
109
-        while (false !== (list($ratingid, $topic_id, $ratinguser, $rating, $ratinghostname, $ratingtimestamp) = $GLOBALS['xoopsDB']->fetchRow($results))) {
110
-            $sql        = 'SELECT topic_title FROM ' . $GLOBALS['xoopsDB']->prefix('newbb_topics') . ' WHERE topic_id=' . $topic_id . ' ';
111
-            $down_array = $GLOBALS['xoopsDB']->fetchArray($GLOBALS['xoopsDB']->query($sql));
106
+		if (0 == $votes) {
107
+			echo "<tr><td align='center' colspan='7' class='head'>" . _AM_NEWBB_VOTE_NOVOTES . '</td></tr>';
108
+		}
109
+		while (false !== (list($ratingid, $topic_id, $ratinguser, $rating, $ratinghostname, $ratingtimestamp) = $GLOBALS['xoopsDB']->fetchRow($results))) {
110
+			$sql        = 'SELECT topic_title FROM ' . $GLOBALS['xoopsDB']->prefix('newbb_topics') . ' WHERE topic_id=' . $topic_id . ' ';
111
+			$down_array = $GLOBALS['xoopsDB']->fetchArray($GLOBALS['xoopsDB']->query($sql));
112 112
 
113
-            $formatted_date = formatTimestamp($ratingtimestamp, _DATESTRING);
114
-            $ratinguname    = newbbGetUnameFromId($ratinguser, $GLOBALS['xoopsModuleConfig']['show_realname']);
115
-            echo "
113
+			$formatted_date = formatTimestamp($ratingtimestamp, _DATESTRING);
114
+			$ratinguname    = newbbGetUnameFromId($ratinguser, $GLOBALS['xoopsModuleConfig']['show_realname']);
115
+			echo "
116 116
         <tr>\n
117 117
         <td class='head' align='center'>$ratingid</td>\n
118 118
         <td class='even' align='center'>$ratinguname</td>\n
@@ -122,18 +122,18 @@  discard block
 block discarded – undo
122 122
         <td class='even' align='center'>$formatted_date</td>\n
123 123
         <td class='even' align='center'><strong><a href='admin_votedata.php?op=delvotes&amp;topic_id=$topic_id&amp;rid=$ratingid'>" . newbbDisplayImage('p_delete', _DELETE) . "</a></strong></td>\n
124 124
         </tr>\n";
125
-        }
126
-        echo '</table>';
127
-        echo '</td></tr></table>';
128
-        //Include page navigation
129
-        require_once $GLOBALS['xoops']->path('class/pagenav.php');
130
-        $page    = ($votes > 10) ? _AM_NEWBB_INDEX_PAGE : '';
131
-        $pagenav = new \XoopsPageNav($page, 20, $start, 'start');
132
-        echo '<div align="right" style="padding: 8px;">' . $page . '' . $pagenav->renderImageNav(4) . '</div>';
133
-        echo '<fieldset>';
134
-        echo '<legend>&nbsp;' . _MI_NEWBB_ADMENU_VOTE . '&nbsp;</legend>';
135
-        echo _AM_NEWBB_HELP_VOTE_TAB;
136
-        echo '</fieldset>';
137
-        break;
125
+		}
126
+		echo '</table>';
127
+		echo '</td></tr></table>';
128
+		//Include page navigation
129
+		require_once $GLOBALS['xoops']->path('class/pagenav.php');
130
+		$page    = ($votes > 10) ? _AM_NEWBB_INDEX_PAGE : '';
131
+		$pagenav = new \XoopsPageNav($page, 20, $start, 'start');
132
+		echo '<div align="right" style="padding: 8px;">' . $page . '' . $pagenav->renderImageNav(4) . '</div>';
133
+		echo '<fieldset>';
134
+		echo '<legend>&nbsp;' . _MI_NEWBB_ADMENU_VOTE . '&nbsp;</legend>';
135
+		echo _AM_NEWBB_HELP_VOTE_TAB;
136
+		echo '</fieldset>';
137
+		break;
138 138
 }
139 139
 require_once __DIR__ . '/admin_footer.php';
Please login to merge, or discard this patch.
admin/admin_header.php 1 patch
Indentation   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -51,8 +51,8 @@
 block discarded – undo
51 51
 $myts = \MyTextSanitizer::getInstance();
52 52
 
53 53
 if (!isset($GLOBALS['xoopsTpl']) || !($GLOBALS['xoopsTpl'] instanceof XoopsTpl)) {
54
-    require_once $GLOBALS['xoops']->path('class/template.php');
55
-    $xoopsTpl = new \XoopsTpl();
54
+	require_once $GLOBALS['xoops']->path('class/template.php');
55
+	$xoopsTpl = new \XoopsTpl();
56 56
 }
57 57
 
58 58
 $pathIcon16    = Xmf\Module\Admin::iconUrl('', 16);
Please login to merge, or discard this patch.
admin/admin_permissions.php 1 patch
Indentation   +225 added lines, -225 removed lines patch added patch discarded remove patch
@@ -35,7 +35,7 @@  discard block
 block discarded – undo
35 35
 require_once __DIR__ . '/admin_header.php';
36 36
 require_once $GLOBALS['xoops']->path('class/xoopsformloader.php');
37 37
 if (!class_exists('XoopsGroupPermForm')) {
38
-    require_once $GLOBALS['xoops']->path('class/xoopsform/grouppermform.php');
38
+	require_once $GLOBALS['xoops']->path('class/xoopsform/grouppermform.php');
39 39
 }
40 40
 
41 41
 /**
@@ -60,247 +60,247 @@  discard block
 block discarded – undo
60 60
 $perms            = $newbbpermHandler->getValidForumPerms();
61 61
 
62 62
 switch ($action) {
63
-    case 'template':
64
-        xoops_cp_header();
65
-        $adminObject->displayNavigation(basename(__FILE__));
66
-        echo "<legend style='font-weight: bold; color: #900;'>" . _AM_NEWBB_PERM_ACTION . '</legend>';
67
-        $opform    = new \XoopsSimpleForm(_AM_NEWBB_PERM_ACTION_HELP_TEMPLAT, 'actionform', 'admin_permissions.php', 'get');
68
-        $op_select = new \XoopsFormSelect('', 'action');
69
-        $op_select->setExtra('onchange="document.forms.actionform.submit()"');
70
-        $op_select->addOptionArray([
71
-                                       'no'       => _SELECT,
72
-                                       'template' => _AM_NEWBB_PERM_TEMPLATE,
73
-                                       'apply'    => _AM_NEWBB_PERM_TEMPLATEAPP,
74
-                                       'default'  => _AM_NEWBB_PERM_SETBYGROUP
75
-                                   ]);
76
-        $opform->addElement($op_select);
77
-        $opform->display();
63
+	case 'template':
64
+		xoops_cp_header();
65
+		$adminObject->displayNavigation(basename(__FILE__));
66
+		echo "<legend style='font-weight: bold; color: #900;'>" . _AM_NEWBB_PERM_ACTION . '</legend>';
67
+		$opform    = new \XoopsSimpleForm(_AM_NEWBB_PERM_ACTION_HELP_TEMPLAT, 'actionform', 'admin_permissions.php', 'get');
68
+		$op_select = new \XoopsFormSelect('', 'action');
69
+		$op_select->setExtra('onchange="document.forms.actionform.submit()"');
70
+		$op_select->addOptionArray([
71
+									   'no'       => _SELECT,
72
+									   'template' => _AM_NEWBB_PERM_TEMPLATE,
73
+									   'apply'    => _AM_NEWBB_PERM_TEMPLATEAPP,
74
+									   'default'  => _AM_NEWBB_PERM_SETBYGROUP
75
+								   ]);
76
+		$opform->addElement($op_select);
77
+		$opform->display();
78 78
 
79
-        $memberHandler = xoops_getHandler('member');
80
-        $glist         = $memberHandler->getGroupList();
81
-        $elements      = [];
82
-        $perm_template = $newbbpermHandler->getTemplate();
83
-        foreach (array_keys($glist) as $i) {
84
-            $selected   = !empty($perm_template[$i]) ? array_keys($perm_template[$i]) : [];
85
-            $ret_ele    = '<tr align="left" valign="top"><td class="head">' . $glist[$i] . '</td>';
86
-            $ret_ele    .= '<td class="even">';
87
-            $ret_ele    .= '<table class="outer"><tr><td class="odd"><table><tr>';
88
-            $ii         = 0;
89
-            $option_ids = [];
90
-            foreach ($perms as $perm) {
91
-                ++$ii;
92
-                if (0 == $ii % 5) {
93
-                    $ret_ele .= '</tr><tr>';
94
-                }
95
-                $checked      = in_array('forum_' . $perm, $selected) ? ' checked' : '';
96
-                $option_id    = $perm . '_' . $i;
97
-                $option_ids[] = $option_id;
98
-                $ret_ele      .= '<td><input name="perms[' . $i . '][' . 'forum_' . $perm . ']" id="' . $option_id . '" onclick="" value="1" type="checkbox"' . $checked . '>' . constant('_AM_NEWBB_CAN_' . strtoupper($perm)) . '<br></td>';
99
-            }
100
-            $ret_ele    .= '</tr></table></td><td class="even">';
101
-            $ret_ele    .= _ALL . ' <input id="checkall[' . $i . ']" type="checkbox" value="" onclick="var optionids = new Array(' . implode(', ', $option_ids) . '); xoopsCheckAllElements(optionids, \'checkall[' . $i . ']\')" />';
102
-            $ret_ele    .= '</td></tr></table>';
103
-            $ret_ele    .= '</td></tr>';
104
-            $elements[] = $ret_ele;
105
-        }
106
-        $tray = new \XoopsFormElementTray('');
107
-        $tray->addElement(new \XoopsFormHidden('action', 'template_save'));
108
-        $tray->addElement(new \XoopsFormButton('', 'submit', _SUBMIT, 'submit'));
109
-        $tray->addElement(new \XoopsFormButton('', 'reset', _CANCEL, 'reset'));
110
-        $ret = '<br><strong>' . _AM_NEWBB_PERM_TEMPLATE . '</strong><br>' . _AM_NEWBB_PERM_TEMPLATE_DESC . '<br>';
111
-        $ret .= "<form name='template' id='template' method='post'>\n<table width='100%' class='outer' cellspacing='1'>\n";
112
-        $ret .= implode("\n", $elements);
113
-        $ret .= '<tr align="left" valign="top"><td class="head"></td><td class="even" style="text-align:center;">';
114
-        $ret .= $tray->render();
115
-        $ret .= '</td></tr>';
116
-        $ret .= '</table></form>';
117
-        echo $ret;
118
-        require_once __DIR__ . '/admin_footer.php';
119
-        break;
79
+		$memberHandler = xoops_getHandler('member');
80
+		$glist         = $memberHandler->getGroupList();
81
+		$elements      = [];
82
+		$perm_template = $newbbpermHandler->getTemplate();
83
+		foreach (array_keys($glist) as $i) {
84
+			$selected   = !empty($perm_template[$i]) ? array_keys($perm_template[$i]) : [];
85
+			$ret_ele    = '<tr align="left" valign="top"><td class="head">' . $glist[$i] . '</td>';
86
+			$ret_ele    .= '<td class="even">';
87
+			$ret_ele    .= '<table class="outer"><tr><td class="odd"><table><tr>';
88
+			$ii         = 0;
89
+			$option_ids = [];
90
+			foreach ($perms as $perm) {
91
+				++$ii;
92
+				if (0 == $ii % 5) {
93
+					$ret_ele .= '</tr><tr>';
94
+				}
95
+				$checked      = in_array('forum_' . $perm, $selected) ? ' checked' : '';
96
+				$option_id    = $perm . '_' . $i;
97
+				$option_ids[] = $option_id;
98
+				$ret_ele      .= '<td><input name="perms[' . $i . '][' . 'forum_' . $perm . ']" id="' . $option_id . '" onclick="" value="1" type="checkbox"' . $checked . '>' . constant('_AM_NEWBB_CAN_' . strtoupper($perm)) . '<br></td>';
99
+			}
100
+			$ret_ele    .= '</tr></table></td><td class="even">';
101
+			$ret_ele    .= _ALL . ' <input id="checkall[' . $i . ']" type="checkbox" value="" onclick="var optionids = new Array(' . implode(', ', $option_ids) . '); xoopsCheckAllElements(optionids, \'checkall[' . $i . ']\')" />';
102
+			$ret_ele    .= '</td></tr></table>';
103
+			$ret_ele    .= '</td></tr>';
104
+			$elements[] = $ret_ele;
105
+		}
106
+		$tray = new \XoopsFormElementTray('');
107
+		$tray->addElement(new \XoopsFormHidden('action', 'template_save'));
108
+		$tray->addElement(new \XoopsFormButton('', 'submit', _SUBMIT, 'submit'));
109
+		$tray->addElement(new \XoopsFormButton('', 'reset', _CANCEL, 'reset'));
110
+		$ret = '<br><strong>' . _AM_NEWBB_PERM_TEMPLATE . '</strong><br>' . _AM_NEWBB_PERM_TEMPLATE_DESC . '<br>';
111
+		$ret .= "<form name='template' id='template' method='post'>\n<table width='100%' class='outer' cellspacing='1'>\n";
112
+		$ret .= implode("\n", $elements);
113
+		$ret .= '<tr align="left" valign="top"><td class="head"></td><td class="even" style="text-align:center;">';
114
+		$ret .= $tray->render();
115
+		$ret .= '</td></tr>';
116
+		$ret .= '</table></form>';
117
+		echo $ret;
118
+		require_once __DIR__ . '/admin_footer.php';
119
+		break;
120 120
 
121
-    case 'template_save':
122
-        //        $res = $newbbpermHandler->setTemplate($_POST['perms'], $groupid = 0);
123
-        $res = $newbbpermHandler->setTemplate(Request::getArray('perms', '', 'POST'), $groupid = 0);
124
-        if ($res) {
125
-            redirect_header('admin_permissions.php', 2, _AM_NEWBB_PERM_TEMPLATE_CREATED);
126
-        } else {
127
-            redirect_header('admin_permissions.php?action=template', 2, _AM_NEWBB_PERM_TEMPLATE_ERROR);
128
-        }
129
-        break;
130
-    //        exit();
121
+	case 'template_save':
122
+		//        $res = $newbbpermHandler->setTemplate($_POST['perms'], $groupid = 0);
123
+		$res = $newbbpermHandler->setTemplate(Request::getArray('perms', '', 'POST'), $groupid = 0);
124
+		if ($res) {
125
+			redirect_header('admin_permissions.php', 2, _AM_NEWBB_PERM_TEMPLATE_CREATED);
126
+		} else {
127
+			redirect_header('admin_permissions.php?action=template', 2, _AM_NEWBB_PERM_TEMPLATE_ERROR);
128
+		}
129
+		break;
130
+	//        exit();
131 131
 
132
-    case 'apply':
133
-        $perm_template = $newbbpermHandler->getTemplate();
134
-        if (null === $perm_template) {
135
-            redirect_header('admin_permissions.php?action=template', 2, _AM_NEWBB_PERM_TEMPLATE);
136
-        }
137
-        xoops_cp_header();
138
-        $adminObject->displayNavigation(basename(__FILE__));
139
-        echo "<legend style='font-weight: bold; color: #900;'>" . _AM_NEWBB_PERM_ACTION . '</legend>';
140
-        $opform    = new \XoopsSimpleForm(_AM_NEWBB_PERM_ACTION_HELP_APPLY, 'actionform', 'admin_permissions.php', 'get');
141
-        $op_select = new \XoopsFormSelect('', 'action');
142
-        $op_select->setExtra('onchange="document.forms.actionform.submit()"');
143
-        $op_select->addOptionArray([
144
-                                       'no'       => _SELECT,
145
-                                       'template' => _AM_NEWBB_PERM_TEMPLATE,
146
-                                       'apply'    => _AM_NEWBB_PERM_TEMPLATEAPP
147
-                                   ]);
148
-        $opform->addElement($op_select);
149
-        $opform->display();
132
+	case 'apply':
133
+		$perm_template = $newbbpermHandler->getTemplate();
134
+		if (null === $perm_template) {
135
+			redirect_header('admin_permissions.php?action=template', 2, _AM_NEWBB_PERM_TEMPLATE);
136
+		}
137
+		xoops_cp_header();
138
+		$adminObject->displayNavigation(basename(__FILE__));
139
+		echo "<legend style='font-weight: bold; color: #900;'>" . _AM_NEWBB_PERM_ACTION . '</legend>';
140
+		$opform    = new \XoopsSimpleForm(_AM_NEWBB_PERM_ACTION_HELP_APPLY, 'actionform', 'admin_permissions.php', 'get');
141
+		$op_select = new \XoopsFormSelect('', 'action');
142
+		$op_select->setExtra('onchange="document.forms.actionform.submit()"');
143
+		$op_select->addOptionArray([
144
+									   'no'       => _SELECT,
145
+									   'template' => _AM_NEWBB_PERM_TEMPLATE,
146
+									   'apply'    => _AM_NEWBB_PERM_TEMPLATEAPP
147
+								   ]);
148
+		$opform->addElement($op_select);
149
+		$opform->display();
150 150
 
151
-        /** @var Newbb\CategoryHandler $categoryHandler */
152
-        $categoryHandler  = Newbb\Helper::getInstance()->getHandler('Category');
153
-        $criteriaCategory = new \CriteriaCompo(new \Criteria('1', 1));
154
-        $criteriaCategory->setSort('cat_order');
155
-        $categories = $categoryHandler->getList($criteriaCategory);
151
+		/** @var Newbb\CategoryHandler $categoryHandler */
152
+		$categoryHandler  = Newbb\Helper::getInstance()->getHandler('Category');
153
+		$criteriaCategory = new \CriteriaCompo(new \Criteria('1', 1));
154
+		$criteriaCategory->setSort('cat_order');
155
+		$categories = $categoryHandler->getList($criteriaCategory);
156 156
 
157
-        /** @var Newbb\ForumHandler $forumHandler */
158
-        $forumHandler = Newbb\Helper::getInstance()->getHandler('Forum');
159
-        $forums       = $forumHandler->getTree(array_keys($categories), 0, 'all');
160
-        foreach (array_keys($forums) as $c) {
161
-            $fm_options[-1 * $c - 1000] = ' ';
162
-            $fm_options[-1 * $c]        = '[' . $categories[$c] . ']';
163
-            foreach (array_keys($forums[$c]) as $f) {
164
-                $fm_options[$f] = $forums[$c][$f]['prefix'] . $forums[$c][$f]['forum_name'];
165
-            }
166
-        }
167
-        unset($forums, $categories);
157
+		/** @var Newbb\ForumHandler $forumHandler */
158
+		$forumHandler = Newbb\Helper::getInstance()->getHandler('Forum');
159
+		$forums       = $forumHandler->getTree(array_keys($categories), 0, 'all');
160
+		foreach (array_keys($forums) as $c) {
161
+			$fm_options[-1 * $c - 1000] = ' ';
162
+			$fm_options[-1 * $c]        = '[' . $categories[$c] . ']';
163
+			foreach (array_keys($forums[$c]) as $f) {
164
+				$fm_options[$f] = $forums[$c][$f]['prefix'] . $forums[$c][$f]['forum_name'];
165
+			}
166
+		}
167
+		unset($forums, $categories);
168 168
 
169
-        $fmform    = new \XoopsThemeForm(_AM_NEWBB_PERM_TEMPLATEAPP, 'fmform', 'admin_permissions.php', 'post', true);
170
-        $fm_select = new \XoopsFormSelect(_AM_NEWBB_PERM_FORUMS, 'forums', null, 10, true);
171
-        $fm_select->addOptionArray($fm_options);
172
-        $fmform->addElement($fm_select);
173
-        $tray = new \XoopsFormElementTray('');
174
-        $tray->addElement(new \XoopsFormHidden('action', 'apply_save'));
175
-        $tray->addElement(new \XoopsFormButton('', 'submit', _SUBMIT, 'submit'));
176
-        $tray->addElement(new \XoopsFormButton('', 'reset', _CANCEL, 'reset'));
177
-        $fmform->addElement($tray);
178
-        $fmform->display();
179
-        require_once __DIR__ . '/admin_footer.php';
180
-        break;
169
+		$fmform    = new \XoopsThemeForm(_AM_NEWBB_PERM_TEMPLATEAPP, 'fmform', 'admin_permissions.php', 'post', true);
170
+		$fm_select = new \XoopsFormSelect(_AM_NEWBB_PERM_FORUMS, 'forums', null, 10, true);
171
+		$fm_select->addOptionArray($fm_options);
172
+		$fmform->addElement($fm_select);
173
+		$tray = new \XoopsFormElementTray('');
174
+		$tray->addElement(new \XoopsFormHidden('action', 'apply_save'));
175
+		$tray->addElement(new \XoopsFormButton('', 'submit', _SUBMIT, 'submit'));
176
+		$tray->addElement(new \XoopsFormButton('', 'reset', _CANCEL, 'reset'));
177
+		$fmform->addElement($tray);
178
+		$fmform->display();
179
+		require_once __DIR__ . '/admin_footer.php';
180
+		break;
181 181
 
182
-    case 'apply_save':
183
-        if (!Request::getArray('forums', '', 'POST')) {
184
-            break;
185
-        }
186
-        foreach (Request::getArray('forums', '', 'POST') as $forum) {
187
-            if ($forum < 1) {
188
-                continue;
189
-            }
190
-            $newbbpermHandler->applyTemplate($forum, $module_id);
191
-        }
192
-        $cacheHelper = Newbb\Utility::cleanCache();
193
-        //$cacheHelper->delete('permission');
194
-        redirect_header('admin_permissions.php', 2, _AM_NEWBB_PERM_TEMPLATE_APPLIED);
195
-        break;
182
+	case 'apply_save':
183
+		if (!Request::getArray('forums', '', 'POST')) {
184
+			break;
185
+		}
186
+		foreach (Request::getArray('forums', '', 'POST') as $forum) {
187
+			if ($forum < 1) {
188
+				continue;
189
+			}
190
+			$newbbpermHandler->applyTemplate($forum, $module_id);
191
+		}
192
+		$cacheHelper = Newbb\Utility::cleanCache();
193
+		//$cacheHelper->delete('permission');
194
+		redirect_header('admin_permissions.php', 2, _AM_NEWBB_PERM_TEMPLATE_APPLIED);
195
+		break;
196 196
 
197
-    default:
198
-        xoops_cp_header();
197
+	default:
198
+		xoops_cp_header();
199 199
 
200
-        $categoryHandler  = Newbb\Helper::getInstance()->getHandler('Category');
201
-        $criteriaCategory = new \CriteriaCompo(new \Criteria('1', 1));
202
-        $criteriaCategory->setSort('cat_order');
203
-        $categories = $categoryHandler->getList($criteriaCategory);
200
+		$categoryHandler  = Newbb\Helper::getInstance()->getHandler('Category');
201
+		$criteriaCategory = new \CriteriaCompo(new \Criteria('1', 1));
202
+		$criteriaCategory->setSort('cat_order');
203
+		$categories = $categoryHandler->getList($criteriaCategory);
204 204
 
205
-        if (0 === count($categories)) {
206
-            redirect_header('admin_cat_manager.php', 2, _AM_NEWBB_CREATENEWCATEGORY);
207
-        }
205
+		if (0 === count($categories)) {
206
+			redirect_header('admin_cat_manager.php', 2, _AM_NEWBB_CREATENEWCATEGORY);
207
+		}
208 208
 
209
-        $forumHandler = Newbb\Helper::getInstance()->getHandler('Forum');
210
-        $forums       = $forumHandler->getTree(array_keys($categories), 0, 'all');
209
+		$forumHandler = Newbb\Helper::getInstance()->getHandler('Forum');
210
+		$forums       = $forumHandler->getTree(array_keys($categories), 0, 'all');
211 211
 
212
-        if (0 === count($forums)) {
213
-            redirect_header('admin_forum_manager.php', 2, _AM_NEWBB_CREATENEWFORUM);
214
-        }
212
+		if (0 === count($forums)) {
213
+			redirect_header('admin_forum_manager.php', 2, _AM_NEWBB_CREATENEWFORUM);
214
+		}
215 215
 
216
-        $adminObject->displayNavigation(basename(__FILE__));
217
-        echo "<legend style='font-weight: bold; color: #900;'>" . _AM_NEWBB_PERM_ACTION . '</legend>';
218
-        $opform    = new \XoopsSimpleForm(_AM_NEWBB_PERM_ACTION_HELP, 'actionform', 'admin_permissions.php', 'get');
219
-        $op_select = new \XoopsFormSelect('', 'action');
220
-        $op_select->setExtra('onchange="document.forms.actionform.submit()"');
221
-        $op_select->addOptionArray([
222
-                                       'no'       => _SELECT,
223
-                                       'template' => _AM_NEWBB_PERM_TEMPLATE,
224
-                                       'apply'    => _AM_NEWBB_PERM_TEMPLATEAPP,
225
-                                       'default'  => _AM_NEWBB_PERM_SETBYGROUP
226
-                                   ]);
227
-        $opform->addElement($op_select);
228
-        $opform->display();
216
+		$adminObject->displayNavigation(basename(__FILE__));
217
+		echo "<legend style='font-weight: bold; color: #900;'>" . _AM_NEWBB_PERM_ACTION . '</legend>';
218
+		$opform    = new \XoopsSimpleForm(_AM_NEWBB_PERM_ACTION_HELP, 'actionform', 'admin_permissions.php', 'get');
219
+		$op_select = new \XoopsFormSelect('', 'action');
220
+		$op_select->setExtra('onchange="document.forms.actionform.submit()"');
221
+		$op_select->addOptionArray([
222
+									   'no'       => _SELECT,
223
+									   'template' => _AM_NEWBB_PERM_TEMPLATE,
224
+									   'apply'    => _AM_NEWBB_PERM_TEMPLATEAPP,
225
+									   'default'  => _AM_NEWBB_PERM_SETBYGROUP
226
+								   ]);
227
+		$opform->addElement($op_select);
228
+		$opform->display();
229 229
 
230
-        $op_options = ['category' => _AM_NEWBB_CAT_ACCESS];
231
-        $fm_options = [
232
-            'category' => [
233
-                'title'     => _AM_NEWBB_CAT_ACCESS,
234
-                'item'      => 'category_access',
235
-                'desc'      => '',
236
-                'anonymous' => true
237
-            ]
238
-        ];
239
-        foreach ($perms as $perm) {
240
-            $op_options[$perm] = constant('_AM_NEWBB_CAN_' . strtoupper($perm));
241
-            $fm_options[$perm] = [
242
-                'title'     => constant('_AM_NEWBB_CAN_' . strtoupper($perm)),
243
-                'item'      => 'forum_' . $perm,
244
-                'desc'      => '',
245
-                'anonymous' => true
246
-            ];
247
-        }
230
+		$op_options = ['category' => _AM_NEWBB_CAT_ACCESS];
231
+		$fm_options = [
232
+			'category' => [
233
+				'title'     => _AM_NEWBB_CAT_ACCESS,
234
+				'item'      => 'category_access',
235
+				'desc'      => '',
236
+				'anonymous' => true
237
+			]
238
+		];
239
+		foreach ($perms as $perm) {
240
+			$op_options[$perm] = constant('_AM_NEWBB_CAN_' . strtoupper($perm));
241
+			$fm_options[$perm] = [
242
+				'title'     => constant('_AM_NEWBB_CAN_' . strtoupper($perm)),
243
+				'item'      => 'forum_' . $perm,
244
+				'desc'      => '',
245
+				'anonymous' => true
246
+			];
247
+		}
248 248
 
249
-        $op_keys = array_keys($op_options);
250
-        $op      = strtolower(Request::getCmd('op', Request::getCmd('op', '', 'COOKIE'), 'GET'));
251
-        if (empty($op)) {
252
-            $op = $op_keys[0];
253
-            setcookie('op', isset($op_keys[1]) ? $op_keys[1] : '');
254
-        } elseif (false !== ($key = array_search($op, $op_keys))) {
255
-            setcookie('op', isset($op_keys[$key + 1]) ? $op_keys[$key + 1] : '');
256
-        }
249
+		$op_keys = array_keys($op_options);
250
+		$op      = strtolower(Request::getCmd('op', Request::getCmd('op', '', 'COOKIE'), 'GET'));
251
+		if (empty($op)) {
252
+			$op = $op_keys[0];
253
+			setcookie('op', isset($op_keys[1]) ? $op_keys[1] : '');
254
+		} elseif (false !== ($key = array_search($op, $op_keys))) {
255
+			setcookie('op', isset($op_keys[$key + 1]) ? $op_keys[$key + 1] : '');
256
+		}
257 257
 
258
-        $opform    = new \XoopsSimpleForm('', 'opform', 'admin_permissions.php', 'get');
259
-        $op_select = new \XoopsFormSelect('', 'op', $op);
260
-        $op_select->setExtra('onchange="document.forms.opform.submit()"');
261
-        $op_select->addOptionArray($op_options);
262
-        $opform->addElement($op_select);
263
-        $opform->display();
258
+		$opform    = new \XoopsSimpleForm('', 'opform', 'admin_permissions.php', 'get');
259
+		$op_select = new \XoopsFormSelect('', 'op', $op);
260
+		$op_select->setExtra('onchange="document.forms.opform.submit()"');
261
+		$op_select->addOptionArray($op_options);
262
+		$opform->addElement($op_select);
263
+		$opform->display();
264 264
 
265
-        $perm_desc = '';
265
+		$perm_desc = '';
266 266
 
267
-        $form = new Newbb\GroupPermForm($fm_options[$op]['title'], $module_id, $fm_options[$op]['item'], $fm_options[$op]['desc'], 'admin/admin_permissions.php', $fm_options[$op]['anonymous']);
267
+		$form = new Newbb\GroupPermForm($fm_options[$op]['title'], $module_id, $fm_options[$op]['item'], $fm_options[$op]['desc'], 'admin/admin_permissions.php', $fm_options[$op]['anonymous']);
268 268
 
269
-        $categoryHandler  = Newbb\Helper::getInstance()->getHandler('Category');
270
-        $criteriaCategory = new \CriteriaCompo(new \Criteria('1', 1));
271
-        $criteriaCategory->setSort('cat_order');
272
-        $categories = $categoryHandler->getList($criteriaCategory);
273
-        if ('category' === $op) {
274
-            foreach (array_keys($categories) as $key) {
275
-                $form->addItem($key, $categories[$key]);
276
-            }
277
-            unset($categories);
278
-        } else {
279
-            $forumHandler = Newbb\Helper::getInstance()->getHandler('Forum');
280
-            $forums       = $forumHandler->getTree(array_keys($categories), 0, 'all');
281
-            if (count($forums) > 0) {
282
-                foreach (array_keys($forums) as $c) {
283
-                    $key_c = -1 * $c;
284
-                    $form->addItem($key_c, '<strong>[' . $categories[$c] . ']</strong>');
285
-                    foreach (array_keys($forums[$c]) as $f) {
286
-                        $pid = $forums[$c][$f]['parent_forum'] ?: $key_c;
287
-                        $form->addItem($f, $forums[$c][$f]['prefix'] . $forums[$c][$f]['forum_name'], $pid);
288
-                    }
289
-                }
290
-            }
291
-            unset($forums, $categories);
292
-        }
293
-        $form->display();
294
-        echo '<fieldset>';
295
-        echo '<legend>&nbsp;' . _MI_NEWBB_ADMENU_PERMISSION . '&nbsp;</legend>';
296
-        echo _AM_NEWBB_HELP_PERMISSION_TAB;
297
-        echo '</fieldset>';
298
-        // Since we can not control the permission update, a trick is used here
299
-        /** var Newbb\PermissionHandler $permissionHandler */
300
-        $permissionHandler = Newbb\Helper::getInstance()->getHandler('Permission');
301
-        $permissionHandler->createPermData();
302
-        $cacheHelper = Newbb\Utility::cleanCache();
303
-        //$cacheHelper->delete('permission');
304
-        require_once __DIR__ . '/admin_footer.php';
305
-        break;
269
+		$categoryHandler  = Newbb\Helper::getInstance()->getHandler('Category');
270
+		$criteriaCategory = new \CriteriaCompo(new \Criteria('1', 1));
271
+		$criteriaCategory->setSort('cat_order');
272
+		$categories = $categoryHandler->getList($criteriaCategory);
273
+		if ('category' === $op) {
274
+			foreach (array_keys($categories) as $key) {
275
+				$form->addItem($key, $categories[$key]);
276
+			}
277
+			unset($categories);
278
+		} else {
279
+			$forumHandler = Newbb\Helper::getInstance()->getHandler('Forum');
280
+			$forums       = $forumHandler->getTree(array_keys($categories), 0, 'all');
281
+			if (count($forums) > 0) {
282
+				foreach (array_keys($forums) as $c) {
283
+					$key_c = -1 * $c;
284
+					$form->addItem($key_c, '<strong>[' . $categories[$c] . ']</strong>');
285
+					foreach (array_keys($forums[$c]) as $f) {
286
+						$pid = $forums[$c][$f]['parent_forum'] ?: $key_c;
287
+						$form->addItem($f, $forums[$c][$f]['prefix'] . $forums[$c][$f]['forum_name'], $pid);
288
+					}
289
+				}
290
+			}
291
+			unset($forums, $categories);
292
+		}
293
+		$form->display();
294
+		echo '<fieldset>';
295
+		echo '<legend>&nbsp;' . _MI_NEWBB_ADMENU_PERMISSION . '&nbsp;</legend>';
296
+		echo _AM_NEWBB_HELP_PERMISSION_TAB;
297
+		echo '</fieldset>';
298
+		// Since we can not control the permission update, a trick is used here
299
+		/** var Newbb\PermissionHandler $permissionHandler */
300
+		$permissionHandler = Newbb\Helper::getInstance()->getHandler('Permission');
301
+		$permissionHandler->createPermData();
302
+		$cacheHelper = Newbb\Utility::cleanCache();
303
+		//$cacheHelper->delete('permission');
304
+		require_once __DIR__ . '/admin_footer.php';
305
+		break;
306 306
 }
Please login to merge, or discard this patch.
admin/admin_forum_reorder.php 1 patch
Indentation   +72 added lines, -72 removed lines patch added patch discarded remove patch
@@ -39,84 +39,84 @@
 block discarded – undo
39 39
 $forum      = Request::getArray('forum', null, 'POST');
40 40
 
41 41
 if (Request::getString('submit', '', 'POST')) {
42
-    $catOrdersCount = count($cat_orders);
43
-    for ($i = 0; $i < $catOrdersCount; ++$i) {
44
-        $sql = 'update ' . $GLOBALS['xoopsDB']->prefix('newbb_categories') . ' set cat_order = ' . $cat_orders[$i] . " WHERE cat_id=$cat[$i]";
45
-        if (!$result = $GLOBALS['xoopsDB']->query($sql)) {
46
-            redirect_header('admin_forum_reorder.php', 1, _AM_NEWBB_FORUM_ERROR);
47
-        }
48
-    }
49
-    $ordersCount = count($orders);
50
-    for ($i = 0; $i < $ordersCount; ++$i) {
51
-        $sql = 'update ' . $GLOBALS['xoopsDB']->prefix('newbb_forums') . ' set forum_order = ' . $orders[$i] . ' WHERE forum_id=' . $forum[$i];
52
-        if (!$result = $GLOBALS['xoopsDB']->query($sql)) {
53
-            redirect_header('admin_forum_reorder.php', 1, _AM_NEWBB_FORUM_ERROR);
54
-        }
55
-    }
56
-    redirect_header('admin_forum_reorder.php', 1, _AM_NEWBB_BOARDREORDER);
42
+	$catOrdersCount = count($cat_orders);
43
+	for ($i = 0; $i < $catOrdersCount; ++$i) {
44
+		$sql = 'update ' . $GLOBALS['xoopsDB']->prefix('newbb_categories') . ' set cat_order = ' . $cat_orders[$i] . " WHERE cat_id=$cat[$i]";
45
+		if (!$result = $GLOBALS['xoopsDB']->query($sql)) {
46
+			redirect_header('admin_forum_reorder.php', 1, _AM_NEWBB_FORUM_ERROR);
47
+		}
48
+	}
49
+	$ordersCount = count($orders);
50
+	for ($i = 0; $i < $ordersCount; ++$i) {
51
+		$sql = 'update ' . $GLOBALS['xoopsDB']->prefix('newbb_forums') . ' set forum_order = ' . $orders[$i] . ' WHERE forum_id=' . $forum[$i];
52
+		if (!$result = $GLOBALS['xoopsDB']->query($sql)) {
53
+			redirect_header('admin_forum_reorder.php', 1, _AM_NEWBB_FORUM_ERROR);
54
+		}
55
+	}
56
+	redirect_header('admin_forum_reorder.php', 1, _AM_NEWBB_BOARDREORDER);
57 57
 } else {
58
-    require_once $GLOBALS['xoops']->path('class/xoopsformloader.php');
59
-    $orders     = [];
60
-    $cat_orders = [];
61
-    $forum      = [];
62
-    $cat        = [];
58
+	require_once $GLOBALS['xoops']->path('class/xoopsformloader.php');
59
+	$orders     = [];
60
+	$cat_orders = [];
61
+	$forum      = [];
62
+	$cat        = [];
63 63
 
64
-    xoops_cp_header();
64
+	xoops_cp_header();
65 65
 
66
-    $adminObject->displayNavigation(basename(__FILE__));
66
+	$adminObject->displayNavigation(basename(__FILE__));
67 67
 
68
-    echo "<table width='100%' border='0' cellspacing='1' class='outer'>" . "<tr><td class='odd'>";
69
-    $tform = new \XoopsThemeForm(_AM_NEWBB_SETFORUMORDER, '', '');
70
-    $tform->display();
71
-    echo "<form name='reorder' method='post'>";
72
-    echo "<table border='0' width='100%' cellpadding='2' cellspacing='1' class='outer'>";
73
-    echo '<tr>';
74
-    echo "<td class='head' align='left' width='60%'><strong>" . _AM_NEWBB_REORDERTITLE . '</strong></td>';
75
-    echo "<td class='head' align='center'><strong>" . _AM_NEWBB_REORDERWEIGHT . '</strong></td>';
76
-    echo '</tr>';
68
+	echo "<table width='100%' border='0' cellspacing='1' class='outer'>" . "<tr><td class='odd'>";
69
+	$tform = new \XoopsThemeForm(_AM_NEWBB_SETFORUMORDER, '', '');
70
+	$tform->display();
71
+	echo "<form name='reorder' method='post'>";
72
+	echo "<table border='0' width='100%' cellpadding='2' cellspacing='1' class='outer'>";
73
+	echo '<tr>';
74
+	echo "<td class='head' align='left' width='60%'><strong>" . _AM_NEWBB_REORDERTITLE . '</strong></td>';
75
+	echo "<td class='head' align='center'><strong>" . _AM_NEWBB_REORDERWEIGHT . '</strong></td>';
76
+	echo '</tr>';
77 77
 
78
-    //    /** @var Newbb\ForumHandler $forumHandler */
79
-    //    $forumHandler     = Newbb\Helper::getInstance()->getHandler('Forum');
80
-    //    /** @var Newbb\CategoryHandler $categoryHandler */
81
-    //    $categoryHandler  = Newbb\Helper::getInstance()->getHandler('Category');
82
-    $criteriaCategory = new \CriteriaCompo(new \Criteria('1', 1));
83
-    $criteriaCategory->setSort('cat_order');
84
-    $categories = $categoryHandler->getAll($criteriaCategory, ['cat_id', 'cat_order', 'cat_title']);
85
-    $forums     = $forumHandler->getTree(array_keys($categories), 0, 'all', '&nbsp;&nbsp;&nbsp;&nbsp;');
86
-    foreach (array_keys($categories) as $c) {
87
-        echo '<tr>';
88
-        echo "<td align='left' nowrap='nowrap' class='head' >" . $categories[$c]->getVar('cat_title') . '</td>';
89
-        echo "<td align='right' class='head'>";
90
-        echo "<input type='text' name='cat_orders[]' value='" . $categories[$c]->getVar('cat_order') . "' size='5' maxlength='5' />";
91
-        echo "<input type='hidden' name='cat[]' value='" . $c . "' />";
92
-        echo '</td>';
93
-        echo '</tr>';
78
+	//    /** @var Newbb\ForumHandler $forumHandler */
79
+	//    $forumHandler     = Newbb\Helper::getInstance()->getHandler('Forum');
80
+	//    /** @var Newbb\CategoryHandler $categoryHandler */
81
+	//    $categoryHandler  = Newbb\Helper::getInstance()->getHandler('Category');
82
+	$criteriaCategory = new \CriteriaCompo(new \Criteria('1', 1));
83
+	$criteriaCategory->setSort('cat_order');
84
+	$categories = $categoryHandler->getAll($criteriaCategory, ['cat_id', 'cat_order', 'cat_title']);
85
+	$forums     = $forumHandler->getTree(array_keys($categories), 0, 'all', '&nbsp;&nbsp;&nbsp;&nbsp;');
86
+	foreach (array_keys($categories) as $c) {
87
+		echo '<tr>';
88
+		echo "<td align='left' nowrap='nowrap' class='head' >" . $categories[$c]->getVar('cat_title') . '</td>';
89
+		echo "<td align='right' class='head'>";
90
+		echo "<input type='text' name='cat_orders[]' value='" . $categories[$c]->getVar('cat_order') . "' size='5' maxlength='5' />";
91
+		echo "<input type='hidden' name='cat[]' value='" . $c . "' />";
92
+		echo '</td>';
93
+		echo '</tr>';
94 94
 
95
-        if (!isset($forums[$c])) {
96
-            continue;
97
-        }
98
-        $i = 0;
99
-        foreach ($forums[$c] as $key => $forum) {
100
-            echo '<tr>';
101
-            $class = ((++$i) % 2) ? 'odd' : 'even';
102
-            echo "<td align='left' nowrap='nowrap' class='" . $class . "'>" . $forum['prefix'] . $forum['forum_name'] . '</td>';
103
-            echo "<td align='left' class='" . $class . "'>";
104
-            echo $forum['prefix'] . "<input type='text' name='orders[]' value='" . $forum['forum_order'] . "' size='5' maxlength='5' />";
105
-            echo "<input type='hidden' name='forum[]' value='" . $key . "' />";
106
-            echo '</td>';
107
-            echo '</tr>';
108
-        }
109
-    }
110
-    echo "<tr><td class='even' align='center' colspan='6'>";
95
+		if (!isset($forums[$c])) {
96
+			continue;
97
+		}
98
+		$i = 0;
99
+		foreach ($forums[$c] as $key => $forum) {
100
+			echo '<tr>';
101
+			$class = ((++$i) % 2) ? 'odd' : 'even';
102
+			echo "<td align='left' nowrap='nowrap' class='" . $class . "'>" . $forum['prefix'] . $forum['forum_name'] . '</td>';
103
+			echo "<td align='left' class='" . $class . "'>";
104
+			echo $forum['prefix'] . "<input type='text' name='orders[]' value='" . $forum['forum_order'] . "' size='5' maxlength='5' />";
105
+			echo "<input type='hidden' name='forum[]' value='" . $key . "' />";
106
+			echo '</td>';
107
+			echo '</tr>';
108
+		}
109
+	}
110
+	echo "<tr><td class='even' align='center' colspan='6'>";
111 111
 
112
-    echo "<input type='submit' name='submit' value='" . _SUBMIT . "' />";
113
-    echo '</td></tr>';
114
-    echo '</table>';
115
-    echo '</form>';
116
-    echo '</td></tr></table>';
117
-    echo '<fieldset>';
118
-    echo '<legend>&nbsp;' . _MI_NEWBB_ADMENU_ORDER . '&nbsp;</legend>';
119
-    echo _AM_NEWBB_HELP_ORDER_TAB;
120
-    echo '</fieldset>';
112
+	echo "<input type='submit' name='submit' value='" . _SUBMIT . "' />";
113
+	echo '</td></tr>';
114
+	echo '</table>';
115
+	echo '</form>';
116
+	echo '</td></tr></table>';
117
+	echo '<fieldset>';
118
+	echo '<legend>&nbsp;' . _MI_NEWBB_ADMENU_ORDER . '&nbsp;</legend>';
119
+	echo _AM_NEWBB_HELP_ORDER_TAB;
120
+	echo '</fieldset>';
121 121
 }
122 122
 require_once __DIR__ . '/admin_footer.php';
Please login to merge, or discard this patch.
admin/admin_forum_manager.php 1 patch
Indentation   +241 added lines, -241 removed lines patch added patch discarded remove patch
@@ -48,269 +48,269 @@
 block discarded – undo
48 48
 ///** @var Newbb\ForumHandler $forumHandler */
49 49
 //$forumHandler = Newbb\Helper::getInstance()->getHandler('Forum');
50 50
 switch ($op) {
51
-    case 'moveforum':
52
-        //if (!$newXoopsModuleGui) loadModuleAdminMenu(2, "");
51
+	case 'moveforum':
52
+		//if (!$newXoopsModuleGui) loadModuleAdminMenu(2, "");
53 53
 
54
-        if (Request::getInt('dest_forum', 0, 'POST')) {
55
-            $dest = Request::getInt('dest_forum', 0, 'POST');
56
-            if ($dest > 0) {
57
-                $pid        = $dest;
58
-                $forum_dest = $forumHandler->get($pid);
59
-                $cid        = $forum_dest->getVar('cat_id');
60
-                unset($forum_dest);
61
-            } else {
62
-                $cid = abs($dest);
63
-                $pid = 0;
64
-            }
65
-            $forumObject = $forumHandler->get($forum_id);
66
-            $forumObject->setVar('cat_id', $cid);
67
-            $forumObject->setVar('parent_forum', $pid);
68
-            $forumHandler->insert($forumObject);
69
-            if ($forumHandler->insert($forumObject)) {
70
-                if ($cid !== $forumObject->getVar('cat_id') && $subforums = newbbGetSubForum($forum_id)) {
71
-                    $forums = array_map('intval', array_values($subforums));
72
-                    $forumHandler->updateAll('cat_id', $cid, new \Criteria('forum_id', '(' . implode(', ', $forums) . ')', 'IN'));
73
-                }
54
+		if (Request::getInt('dest_forum', 0, 'POST')) {
55
+			$dest = Request::getInt('dest_forum', 0, 'POST');
56
+			if ($dest > 0) {
57
+				$pid        = $dest;
58
+				$forum_dest = $forumHandler->get($pid);
59
+				$cid        = $forum_dest->getVar('cat_id');
60
+				unset($forum_dest);
61
+			} else {
62
+				$cid = abs($dest);
63
+				$pid = 0;
64
+			}
65
+			$forumObject = $forumHandler->get($forum_id);
66
+			$forumObject->setVar('cat_id', $cid);
67
+			$forumObject->setVar('parent_forum', $pid);
68
+			$forumHandler->insert($forumObject);
69
+			if ($forumHandler->insert($forumObject)) {
70
+				if ($cid !== $forumObject->getVar('cat_id') && $subforums = newbbGetSubForum($forum_id)) {
71
+					$forums = array_map('intval', array_values($subforums));
72
+					$forumHandler->updateAll('cat_id', $cid, new \Criteria('forum_id', '(' . implode(', ', $forums) . ')', 'IN'));
73
+				}
74 74
 
75
-                //$cacheHelper->delete('forum');
76
-                redirect_header('admin_forum_manager.php?op=manage', 2, _AM_NEWBB_MSG_FORUM_MOVED);
77
-            } else {
78
-                redirect_header('admin_forum_manager.php?op=manage', 2, _AM_NEWBB_MSG_ERR_FORUM_MOVED);
79
-            }
80
-        } else {
81
-            $box = '<select name="dest_forum">';
82
-            $box .= '<option value=0 selected>' . _SELECT . '</option>';
83
-            $box .= newbbForumSelectBox($forum_id, 'all', true, true);
84
-            $box .= '</select>';
75
+				//$cacheHelper->delete('forum');
76
+				redirect_header('admin_forum_manager.php?op=manage', 2, _AM_NEWBB_MSG_FORUM_MOVED);
77
+			} else {
78
+				redirect_header('admin_forum_manager.php?op=manage', 2, _AM_NEWBB_MSG_ERR_FORUM_MOVED);
79
+			}
80
+		} else {
81
+			$box = '<select name="dest_forum">';
82
+			$box .= '<option value=0 selected>' . _SELECT . '</option>';
83
+			$box .= newbbForumSelectBox($forum_id, 'all', true, true);
84
+			$box .= '</select>';
85 85
 
86
-            echo "<table width='100%' border='0' cellspacing='1' class='outer'>" . "<tr><td class='odd'>";
87
-            echo '<form action="./admin_forum_manager.php" method="post" name="forummove" id="forummove">';
88
-            echo '<input type="hidden" name="op" value="moveforum" />';
89
-            echo '<input type="hidden" name="forum" value=' . $forum_id . ' />';
90
-            echo '<table border="0" cellpadding="1" cellspacing="0" align="center" valign="top" width="95%"><tr>';
91
-            echo '<td class="bg2" align="center"><strong>' . _AM_NEWBB_MOVETHISFORUM . '</strong></td>';
92
-            echo '</tr>';
93
-            echo '<tr><td class="bg1" align="center">' . $box . '</td></tr>';
94
-            echo '<tr><td align="center"><input type="submit" name="save" value=' . _GO . ' class="button" /></td></tr>';
95
-            echo '</table></form>';
96
-            echo '</td></tr></table>';
97
-        }
98
-        break;
86
+			echo "<table width='100%' border='0' cellspacing='1' class='outer'>" . "<tr><td class='odd'>";
87
+			echo '<form action="./admin_forum_manager.php" method="post" name="forummove" id="forummove">';
88
+			echo '<input type="hidden" name="op" value="moveforum" />';
89
+			echo '<input type="hidden" name="forum" value=' . $forum_id . ' />';
90
+			echo '<table border="0" cellpadding="1" cellspacing="0" align="center" valign="top" width="95%"><tr>';
91
+			echo '<td class="bg2" align="center"><strong>' . _AM_NEWBB_MOVETHISFORUM . '</strong></td>';
92
+			echo '</tr>';
93
+			echo '<tr><td class="bg1" align="center">' . $box . '</td></tr>';
94
+			echo '<tr><td align="center"><input type="submit" name="save" value=' . _GO . ' class="button" /></td></tr>';
95
+			echo '</table></form>';
96
+			echo '</td></tr></table>';
97
+		}
98
+		break;
99 99
 
100
-    case 'mergeforum':
101
-        //if (!$newXoopsModuleGui) loadModuleAdminMenu(2, "");
100
+	case 'mergeforum':
101
+		//if (!$newXoopsModuleGui) loadModuleAdminMenu(2, "");
102 102
 
103
-        if (Request::getString('dest_forum', '', 'POST')) {
104
-            $forum_dest = $forumHandler->get(Request::getString('dest_forum', '', 'POST'));
105
-            if (is_object($forum_dest)) {
106
-                $cid         = $forum_dest->getVar('cat_id');
107
-                $sql         = '    UPDATE ' . $GLOBALS['xoopsDB']->prefix('newbb_posts') . '    SET forum_id=' . Request::getInt('dest_forum', 0, 'POST') . "    WHERE forum_id=$forum_id";
108
-                $result_post = $GLOBALS['xoopsDB']->queryF($sql);
103
+		if (Request::getString('dest_forum', '', 'POST')) {
104
+			$forum_dest = $forumHandler->get(Request::getString('dest_forum', '', 'POST'));
105
+			if (is_object($forum_dest)) {
106
+				$cid         = $forum_dest->getVar('cat_id');
107
+				$sql         = '    UPDATE ' . $GLOBALS['xoopsDB']->prefix('newbb_posts') . '    SET forum_id=' . Request::getInt('dest_forum', 0, 'POST') . "    WHERE forum_id=$forum_id";
108
+				$result_post = $GLOBALS['xoopsDB']->queryF($sql);
109 109
 
110
-                $sql          = '    UPDATE ' . $GLOBALS['xoopsDB']->prefix('newbb_topics') . '    SET forum_id=' . Request::getInt('dest_forum', 0, 'POST') . "    WHERE forum_id=$forum_id";
111
-                $result_topic = $GLOBALS['xoopsDB']->queryF($sql);
110
+				$sql          = '    UPDATE ' . $GLOBALS['xoopsDB']->prefix('newbb_topics') . '    SET forum_id=' . Request::getInt('dest_forum', 0, 'POST') . "    WHERE forum_id=$forum_id";
111
+				$result_topic = $GLOBALS['xoopsDB']->queryF($sql);
112 112
 
113
-                $forumObject = $forumHandler->get($forum_id);
114
-                $forumHandler->updateAll('parent_forum', Request::getInt('dest_forum', 0, 'POST'), new \Criteria('parent_forum', $forum_id));
115
-                if ($cid !== $forumObject->getVar('cat_id') && $subforums = newbbGetSubForum($forum_id)) {
116
-                    $forums = array_map('intval', array_values($subforums));
117
-                    $forumHandler->updateAll('cat_id', $cid, new \Criteria('forum_id', '(' . implode(', ', $forums) . ')', 'IN'));
118
-                }
113
+				$forumObject = $forumHandler->get($forum_id);
114
+				$forumHandler->updateAll('parent_forum', Request::getInt('dest_forum', 0, 'POST'), new \Criteria('parent_forum', $forum_id));
115
+				if ($cid !== $forumObject->getVar('cat_id') && $subforums = newbbGetSubForum($forum_id)) {
116
+					$forums = array_map('intval', array_values($subforums));
117
+					$forumHandler->updateAll('cat_id', $cid, new \Criteria('forum_id', '(' . implode(', ', $forums) . ')', 'IN'));
118
+				}
119 119
 
120
-                $forumHandler->delete($forumObject);
120
+				$forumHandler->delete($forumObject);
121 121
 
122
-                $forumHandler->synchronization($forum_dest);
123
-                unset($forum_dest);
124
-                $cacheHelper->delete('forum');
122
+				$forumHandler->synchronization($forum_dest);
123
+				unset($forum_dest);
124
+				$cacheHelper->delete('forum');
125 125
 
126
-                redirect_header('admin_forum_manager.php?op=manage', 2, _AM_NEWBB_MSG_FORUM_MERGED);
127
-            } else {
128
-                redirect_header('admin_forum_manager.php?op=manage', 2, _AM_NEWBB_MSG_ERR_FORUM_MOVED);
129
-            }
130
-        } else {
131
-            $box = '<select name="dest_forum">';
132
-            $box .= '<option value=0 selected>' . _SELECT . '</option>';
133
-            $box .= newbbForumSelectBox($forum_id, 'all');
134
-            $box .= '</select>';
135
-            echo "<table width='100%' border='0' cellspacing='1' class='outer'>" . "<tr><td class='odd'>";
136
-            echo '<form action="' . xoops_getenv('PHP_SELF') . '" method="post" name="forummove" id="forummove">';
137
-            echo '<input type="hidden" name="op" value="mergeforum" />';
138
-            echo '<input type="hidden" name="forum" value=' . $forum_id . ' />';
139
-            echo '<table border="0" cellpadding="1" cellspacing="0" align="center" valign="top" width="95%"><tr>';
140
-            echo '<td class="bg2" align="center"><strong>' . _AM_NEWBB_MERGETHISFORUM . '</strong></td>';
141
-            echo '</tr>';
142
-            echo '<tr><td class="bg1" align="center">' . _AM_NEWBB_MERGETO_FORUM . '</td></tr>';
143
-            echo '<tr><td class="bg1" align="center">' . $box . '</td></tr>';
144
-            echo '<tr><td align="center"><input type="submit" name="save" value=' . _GO . ' class="button" /></td></tr>';
145
-            echo '</form></table>';
146
-            echo '</td></tr></table>';
147
-        }
148
-        break;
126
+				redirect_header('admin_forum_manager.php?op=manage', 2, _AM_NEWBB_MSG_FORUM_MERGED);
127
+			} else {
128
+				redirect_header('admin_forum_manager.php?op=manage', 2, _AM_NEWBB_MSG_ERR_FORUM_MOVED);
129
+			}
130
+		} else {
131
+			$box = '<select name="dest_forum">';
132
+			$box .= '<option value=0 selected>' . _SELECT . '</option>';
133
+			$box .= newbbForumSelectBox($forum_id, 'all');
134
+			$box .= '</select>';
135
+			echo "<table width='100%' border='0' cellspacing='1' class='outer'>" . "<tr><td class='odd'>";
136
+			echo '<form action="' . xoops_getenv('PHP_SELF') . '" method="post" name="forummove" id="forummove">';
137
+			echo '<input type="hidden" name="op" value="mergeforum" />';
138
+			echo '<input type="hidden" name="forum" value=' . $forum_id . ' />';
139
+			echo '<table border="0" cellpadding="1" cellspacing="0" align="center" valign="top" width="95%"><tr>';
140
+			echo '<td class="bg2" align="center"><strong>' . _AM_NEWBB_MERGETHISFORUM . '</strong></td>';
141
+			echo '</tr>';
142
+			echo '<tr><td class="bg1" align="center">' . _AM_NEWBB_MERGETO_FORUM . '</td></tr>';
143
+			echo '<tr><td class="bg1" align="center">' . $box . '</td></tr>';
144
+			echo '<tr><td align="center"><input type="submit" name="save" value=' . _GO . ' class="button" /></td></tr>';
145
+			echo '</form></table>';
146
+			echo '</td></tr></table>';
147
+		}
148
+		break;
149 149
 
150
-    case 'save':
150
+	case 'save':
151 151
 
152
-        if ($forum_id) {
153
-            $forumObject = $forumHandler->get($forum_id);
154
-            $message     = _AM_NEWBB_FORUMUPDATE;
155
-        } else {
156
-            $forumObject = $forumHandler->create();
157
-            $message     = _AM_NEWBB_FORUMCREATED;
158
-        }
152
+		if ($forum_id) {
153
+			$forumObject = $forumHandler->get($forum_id);
154
+			$message     = _AM_NEWBB_FORUMUPDATE;
155
+		} else {
156
+			$forumObject = $forumHandler->create();
157
+			$message     = _AM_NEWBB_FORUMCREATED;
158
+		}
159 159
 
160
-        $forumObject->setVar('forum_name', Request::getString('forum_name', '', 'POST'));
161
-        $forumObject->setVar('forum_desc', Request::getString('forum_desc', '', 'POST'));
162
-        $forumObject->setVar('forum_order', Request::getInt('forum_order', 0, 'POST'));
163
-        $forumObject->setVar('forum_moderator', Request::getArray('forum_moderator', [], 'POST'));
164
-        $forumObject->setVar('parent_forum', Request::getInt('parent_forum', 0, 'POST'));
165
-        $forumObject->setVar('attach_maxkb', Request::getInt('attach_maxkb', 0, 'POST'));
166
-        $forumObject->setVar('attach_ext', Request::getString('attach_ext', '', 'POST'));
167
-        $forumObject->setVar('hot_threshold', Request::getInt('hot_threshold', 0, 'POST'));
168
-        if (Request::getInt('parent_forum', 0, 'POST')) {
169
-            $parentObject    = $forumHandler->get(Request::getInt('parent_forum', 0, 'POST'), ['cat_id']);
170
-            $_POST['cat_id'] = $parentObject->getVar('cat_id');
171
-        }
172
-        $forumObject->setVar('cat_id', Request::getInt('cat_id', 0, 'POST'));
160
+		$forumObject->setVar('forum_name', Request::getString('forum_name', '', 'POST'));
161
+		$forumObject->setVar('forum_desc', Request::getString('forum_desc', '', 'POST'));
162
+		$forumObject->setVar('forum_order', Request::getInt('forum_order', 0, 'POST'));
163
+		$forumObject->setVar('forum_moderator', Request::getArray('forum_moderator', [], 'POST'));
164
+		$forumObject->setVar('parent_forum', Request::getInt('parent_forum', 0, 'POST'));
165
+		$forumObject->setVar('attach_maxkb', Request::getInt('attach_maxkb', 0, 'POST'));
166
+		$forumObject->setVar('attach_ext', Request::getString('attach_ext', '', 'POST'));
167
+		$forumObject->setVar('hot_threshold', Request::getInt('hot_threshold', 0, 'POST'));
168
+		if (Request::getInt('parent_forum', 0, 'POST')) {
169
+			$parentObject    = $forumHandler->get(Request::getInt('parent_forum', 0, 'POST'), ['cat_id']);
170
+			$_POST['cat_id'] = $parentObject->getVar('cat_id');
171
+		}
172
+		$forumObject->setVar('cat_id', Request::getInt('cat_id', 0, 'POST'));
173 173
 
174
-        if ($forumHandler->insert($forumObject)) {
175
-            //$cacheHelper->delete('forum');
176
-            if (Request::getInt('perm_template', 0, 'POST')) {
177
-                //                /** var Newbb\PermissionHandler $permHandler */
178
-                //                $permHandler = Newbb\Helper::getInstance()->getHandler('Permission');
179
-                $perm_template = $permHandler->getTemplate();
180
-                /** @var \XoopsMemberHandler $memberHandler */
181
-                $memberHandler = xoops_getHandler('member');
182
-                $glist         = $memberHandler->getGroupList();
183
-                $perms         = $permHandler->getValidForumPerms(true);
184
-                foreach (array_keys($glist) as $group) {
185
-                    foreach ($perms as $perm) {
186
-                        $ids = $permHandler->getItemIds($perm, $group, $xoopsModule->getVar('mid'));
187
-                        if (!in_array($forumObject->getVar('forum_id'), $ids)) {
188
-                            if (empty($perm_template[$group][$perm])) {
189
-                                $permHandler->deleteRight($perm, $forumObject->getVar('forum_id'), $group, $xoopsModule->getVar('mid'));
190
-                            } else {
191
-                                $permHandler->addRight($perm, $forumObject->getVar('forum_id'), $group, $xoopsModule->getVar('mid'));
192
-                            }
193
-                        }
194
-                    }
195
-                }
196
-            }
197
-            redirect_header('admin_forum_manager.php', 2, $message);
198
-        } else {
199
-            redirect_header('admin_forum_manager.php?op=mod&amp;forum=' . $forumObject->getVar('forum_id') . '', 2, _AM_NEWBB_FORUM_ERROR);
200
-        }
201
-        break;
174
+		if ($forumHandler->insert($forumObject)) {
175
+			//$cacheHelper->delete('forum');
176
+			if (Request::getInt('perm_template', 0, 'POST')) {
177
+				//                /** var Newbb\PermissionHandler $permHandler */
178
+				//                $permHandler = Newbb\Helper::getInstance()->getHandler('Permission');
179
+				$perm_template = $permHandler->getTemplate();
180
+				/** @var \XoopsMemberHandler $memberHandler */
181
+				$memberHandler = xoops_getHandler('member');
182
+				$glist         = $memberHandler->getGroupList();
183
+				$perms         = $permHandler->getValidForumPerms(true);
184
+				foreach (array_keys($glist) as $group) {
185
+					foreach ($perms as $perm) {
186
+						$ids = $permHandler->getItemIds($perm, $group, $xoopsModule->getVar('mid'));
187
+						if (!in_array($forumObject->getVar('forum_id'), $ids)) {
188
+							if (empty($perm_template[$group][$perm])) {
189
+								$permHandler->deleteRight($perm, $forumObject->getVar('forum_id'), $group, $xoopsModule->getVar('mid'));
190
+							} else {
191
+								$permHandler->addRight($perm, $forumObject->getVar('forum_id'), $group, $xoopsModule->getVar('mid'));
192
+							}
193
+						}
194
+					}
195
+				}
196
+			}
197
+			redirect_header('admin_forum_manager.php', 2, $message);
198
+		} else {
199
+			redirect_header('admin_forum_manager.php?op=mod&amp;forum=' . $forumObject->getVar('forum_id') . '', 2, _AM_NEWBB_FORUM_ERROR);
200
+		}
201
+		break;
202 202
 
203
-    case 'mod':
204
-        $forumObject = $forumHandler->get($forum_id);
205
-        require_once $GLOBALS['xoops']->path('modules/' . $xoopsModule->getVar('dirname') . '/include/form.forum.php');
206
-        break;
203
+	case 'mod':
204
+		$forumObject = $forumHandler->get($forum_id);
205
+		require_once $GLOBALS['xoops']->path('modules/' . $xoopsModule->getVar('dirname') . '/include/form.forum.php');
206
+		break;
207 207
 
208
-    case 'del':
209
-        if (1 !== Request::getInt('confirm', 0, 'POST')) {
210
-            xoops_confirm(['op' => 'del', 'forum' => Request::getInt('forum', 0, 'GET'), 'confirm' => 1], 'admin_forum_manager.php', _AM_NEWBB_TWDAFAP);
211
-            break;
212
-        } else {
213
-            $forumObject = $forumHandler->get(Request::getInt('forum', 0, 'POST'));
214
-            $forumHandler->delete($forumObject);
215
-            //$cacheHelper->delete('forum');
216
-            redirect_header('admin_forum_manager.php?op=manage', 1, _AM_NEWBB_FORUMREMOVED);
217
-        }
218
-        break;
208
+	case 'del':
209
+		if (1 !== Request::getInt('confirm', 0, 'POST')) {
210
+			xoops_confirm(['op' => 'del', 'forum' => Request::getInt('forum', 0, 'GET'), 'confirm' => 1], 'admin_forum_manager.php', _AM_NEWBB_TWDAFAP);
211
+			break;
212
+		} else {
213
+			$forumObject = $forumHandler->get(Request::getInt('forum', 0, 'POST'));
214
+			$forumHandler->delete($forumObject);
215
+			//$cacheHelper->delete('forum');
216
+			redirect_header('admin_forum_manager.php?op=manage', 1, _AM_NEWBB_FORUMREMOVED);
217
+		}
218
+		break;
219 219
 
220
-    case 'addforum':
221
-        echo '<br>';
222
-        $parent_forum = Request::getInt('forum', 0, 'GET');
223
-        $cat_id       = Request::getInt('cat_id', 0, 'GET');
224
-        if (!$parent_forum && !$cat_id) {
225
-            break;
226
-        }
227
-        $forumObject = $forumHandler->create();
228
-        $forumObject->setVar('parent_forum', $parent_forum);
229
-        $forumObject->setVar('cat_id', $cat_id);
230
-        require_once $GLOBALS['xoops']->path('modules/' . $xoopsModule->getVar('dirname') . '/include/form.forum.php');
231
-        break;
220
+	case 'addforum':
221
+		echo '<br>';
222
+		$parent_forum = Request::getInt('forum', 0, 'GET');
223
+		$cat_id       = Request::getInt('cat_id', 0, 'GET');
224
+		if (!$parent_forum && !$cat_id) {
225
+			break;
226
+		}
227
+		$forumObject = $forumHandler->create();
228
+		$forumObject->setVar('parent_forum', $parent_forum);
229
+		$forumObject->setVar('cat_id', $cat_id);
230
+		require_once $GLOBALS['xoops']->path('modules/' . $xoopsModule->getVar('dirname') . '/include/form.forum.php');
231
+		break;
232 232
 
233
-    default:
233
+	default:
234 234
 
235
-        //        /** @var Newbb\CategoryHandler $categoryHandler */
236
-        //        $categoryHandler  = Newbb\Helper::getInstance()->getHandler('Category');
237
-        $criteriaCategory = new \CriteriaCompo(new \Criteria('1', 1));
238
-        $criteriaCategory->setSort('cat_order');
239
-        $categories = $categoryHandler->getList($criteriaCategory);
240
-        if (0 === count($categories)) {
241
-            redirect_header('admin_cat_manager.php', 2, _AM_NEWBB_CREATENEWCATEGORY);
242
-        }
235
+		//        /** @var Newbb\CategoryHandler $categoryHandler */
236
+		//        $categoryHandler  = Newbb\Helper::getInstance()->getHandler('Category');
237
+		$criteriaCategory = new \CriteriaCompo(new \Criteria('1', 1));
238
+		$criteriaCategory->setSort('cat_order');
239
+		$categories = $categoryHandler->getList($criteriaCategory);
240
+		if (0 === count($categories)) {
241
+			redirect_header('admin_cat_manager.php', 2, _AM_NEWBB_CREATENEWCATEGORY);
242
+		}
243 243
 
244
-        $echo = $adminObject->displayNavigation(basename(__FILE__));
245
-        $echo .= "<table width='100%' border='0' cellspacing='1' class='outer'>" . "<tr><td class='odd'>";
246
-        $echo .= "<table border='0' cellpadding='4' cellspacing='1' width='100%' class='outer'>";
247
-        $echo .= "<tr align='center'>";
248
-        $echo .= "<th class='bg3' colspan='2'>" . _AM_NEWBB_NAME . '</th>';
249
-        $echo .= "<th class='bg3'>" . _AM_NEWBB_EDIT . '</th>';
250
-        $echo .= "<th class='bg3'>" . _AM_NEWBB_DELETE . '</th>';
251
-        $echo .= "<th class='bg3'>" . _AM_NEWBB_ADD . '</th>';
252
-        $echo .= "<th class='bg3'>" . _AM_NEWBB_MOVE . '</th>';
253
-        $echo .= "<th class='bg3'>" . _AM_NEWBB_MERGE . '</th>';
254
-        $echo .= '</tr>';
244
+		$echo = $adminObject->displayNavigation(basename(__FILE__));
245
+		$echo .= "<table width='100%' border='0' cellspacing='1' class='outer'>" . "<tr><td class='odd'>";
246
+		$echo .= "<table border='0' cellpadding='4' cellspacing='1' width='100%' class='outer'>";
247
+		$echo .= "<tr align='center'>";
248
+		$echo .= "<th class='bg3' colspan='2'>" . _AM_NEWBB_NAME . '</th>';
249
+		$echo .= "<th class='bg3'>" . _AM_NEWBB_EDIT . '</th>';
250
+		$echo .= "<th class='bg3'>" . _AM_NEWBB_DELETE . '</th>';
251
+		$echo .= "<th class='bg3'>" . _AM_NEWBB_ADD . '</th>';
252
+		$echo .= "<th class='bg3'>" . _AM_NEWBB_MOVE . '</th>';
253
+		$echo .= "<th class='bg3'>" . _AM_NEWBB_MERGE . '</th>';
254
+		$echo .= '</tr>';
255 255
 
256
-        //        $categoryHandler  = Newbb\Helper::getInstance()->getHandler('Category');
257
-        $criteriaCategory = new \CriteriaCompo(new \Criteria('1', 1));
258
-        $criteriaCategory->setSort('cat_order');
259
-        $categories = $categoryHandler->getList($criteriaCategory);
260
-        $forums     = $forumHandler->getTree(array_keys($categories), 0, 'all');
261
-        foreach (array_keys($categories) as $c) {
262
-            $category       = $categories[$c];
263
-            $cat_id         = $c;
264
-            $cat_link       = '<a href="' . XOOPS_URL . '/modules/' . $xoopsModule->getVar('dirname', 'n') . '/index.php?viewcat=' . $cat_id . '">' . $category . '</a>';
265
-            $cat_edit_link  = '<a href="admin_cat_manager.php?op=mod&amp;cat_id=' . $cat_id . '">' . newbbDisplayImage('admin_edit', _EDIT) . '</a>';
266
-            $cat_del_link   = '<a href="admin_cat_manager.php?op=del&amp;cat_id=' . $cat_id . '">' . newbbDisplayImage('admin_delete', _DELETE) . '</a>';
267
-            $forum_add_link = '<a href="admin_forum_manager.php?op=addforum&amp;cat_id=' . $cat_id . '">' . newbbDisplayImage('new_forum') . '</a>';
268
-            $echo           .= "<tr class='even' align='left'>";
269
-            $echo           .= "<td width='100%' colspan='2'><strong>" . $cat_link . '</strong></td>';
270
-            $echo           .= "<td align='center'>" . $cat_edit_link . '</td>';
271
-            $echo           .= "<td align='center'>" . $cat_del_link . '</td>';
272
-            $echo           .= "<td align='center'>" . $forum_add_link . '</td>';
273
-            $echo           .= '<td></td>';
274
-            $echo           .= '<td></td>';
275
-            $echo           .= '</tr>';
276
-            if (!isset($forums[$c])) {
277
-                continue;
278
-            }
279
-            $i = 0;
280
-            foreach (array_keys($forums[$c]) as $f) {
281
-                $forum        = $forums[$c][$f];
282
-                $f_link       = $forum['prefix'] . '<a href="' . XOOPS_URL . '/modules/' . $xoopsModule->getVar('dirname', 'n') . '/viewforum.php?forum=' . $f . '">' . $forum['forum_name'] . '</a>';
283
-                $f_edit_link  = '<a href="admin_forum_manager.php?op=mod&amp;forum=' . $f . '">' . newbbDisplayImage('admin_edit', _AM_NEWBB_EDIT) . '</a>';
284
-                $f_del_link   = '<a href="admin_forum_manager.php?op=del&amp;forum=' . $f . '">' . newbbDisplayImage('admin_delete', _AM_NEWBB_DELETE) . '</a>';
285
-                $sf_add_link  = '<a href="admin_forum_manager.php?op=addforum&amp;cat_id=' . $c . '&forum=' . $f . '">' . newbbDisplayImage('new_forum', _AM_NEWBB_CREATEFORUM) . '</a>';
286
-                $f_move_link  = '<a href="admin_forum_manager.php?op=moveforum&amp;forum=' . $f . '">' . newbbDisplayImage('admin_move', _AM_NEWBB_MOVE) . '</a>';
287
-                $f_merge_link = '<a href="admin_forum_manager.php?op=mergeforum&amp;forum=' . $f . '">' . newbbDisplayImage('admin_merge', _AM_NEWBB_MERGE) . '</a>';
256
+		//        $categoryHandler  = Newbb\Helper::getInstance()->getHandler('Category');
257
+		$criteriaCategory = new \CriteriaCompo(new \Criteria('1', 1));
258
+		$criteriaCategory->setSort('cat_order');
259
+		$categories = $categoryHandler->getList($criteriaCategory);
260
+		$forums     = $forumHandler->getTree(array_keys($categories), 0, 'all');
261
+		foreach (array_keys($categories) as $c) {
262
+			$category       = $categories[$c];
263
+			$cat_id         = $c;
264
+			$cat_link       = '<a href="' . XOOPS_URL . '/modules/' . $xoopsModule->getVar('dirname', 'n') . '/index.php?viewcat=' . $cat_id . '">' . $category . '</a>';
265
+			$cat_edit_link  = '<a href="admin_cat_manager.php?op=mod&amp;cat_id=' . $cat_id . '">' . newbbDisplayImage('admin_edit', _EDIT) . '</a>';
266
+			$cat_del_link   = '<a href="admin_cat_manager.php?op=del&amp;cat_id=' . $cat_id . '">' . newbbDisplayImage('admin_delete', _DELETE) . '</a>';
267
+			$forum_add_link = '<a href="admin_forum_manager.php?op=addforum&amp;cat_id=' . $cat_id . '">' . newbbDisplayImage('new_forum') . '</a>';
268
+			$echo           .= "<tr class='even' align='left'>";
269
+			$echo           .= "<td width='100%' colspan='2'><strong>" . $cat_link . '</strong></td>';
270
+			$echo           .= "<td align='center'>" . $cat_edit_link . '</td>';
271
+			$echo           .= "<td align='center'>" . $cat_del_link . '</td>';
272
+			$echo           .= "<td align='center'>" . $forum_add_link . '</td>';
273
+			$echo           .= '<td></td>';
274
+			$echo           .= '<td></td>';
275
+			$echo           .= '</tr>';
276
+			if (!isset($forums[$c])) {
277
+				continue;
278
+			}
279
+			$i = 0;
280
+			foreach (array_keys($forums[$c]) as $f) {
281
+				$forum        = $forums[$c][$f];
282
+				$f_link       = $forum['prefix'] . '<a href="' . XOOPS_URL . '/modules/' . $xoopsModule->getVar('dirname', 'n') . '/viewforum.php?forum=' . $f . '">' . $forum['forum_name'] . '</a>';
283
+				$f_edit_link  = '<a href="admin_forum_manager.php?op=mod&amp;forum=' . $f . '">' . newbbDisplayImage('admin_edit', _AM_NEWBB_EDIT) . '</a>';
284
+				$f_del_link   = '<a href="admin_forum_manager.php?op=del&amp;forum=' . $f . '">' . newbbDisplayImage('admin_delete', _AM_NEWBB_DELETE) . '</a>';
285
+				$sf_add_link  = '<a href="admin_forum_manager.php?op=addforum&amp;cat_id=' . $c . '&forum=' . $f . '">' . newbbDisplayImage('new_forum', _AM_NEWBB_CREATEFORUM) . '</a>';
286
+				$f_move_link  = '<a href="admin_forum_manager.php?op=moveforum&amp;forum=' . $f . '">' . newbbDisplayImage('admin_move', _AM_NEWBB_MOVE) . '</a>';
287
+				$f_merge_link = '<a href="admin_forum_manager.php?op=mergeforum&amp;forum=' . $f . '">' . newbbDisplayImage('admin_merge', _AM_NEWBB_MERGE) . '</a>';
288 288
 
289
-                $class = (($i++) % 2) ? 'odd' : 'even';
290
-                $echo  .= "<tr class='" . $class . "' align='left'><td></td>";
291
-                $echo  .= '<td><strong>' . $f_link . '</strong></td>';
292
-                $echo  .= "<td align='center'>" . $f_edit_link . '</td>';
293
-                $echo  .= "<td align='center'>" . $f_del_link . '</td>';
294
-                $echo  .= "<td align='center'>" . $sf_add_link . '</td>';
295
-                $echo  .= "<td align='center'>" . $f_move_link . '</td>';
296
-                $echo  .= "<td align='center'>" . $f_merge_link . '</td>';
297
-                $echo  .= '</tr>';
298
-            }
299
-        }
300
-        unset($forums, $categories);
289
+				$class = (($i++) % 2) ? 'odd' : 'even';
290
+				$echo  .= "<tr class='" . $class . "' align='left'><td></td>";
291
+				$echo  .= '<td><strong>' . $f_link . '</strong></td>';
292
+				$echo  .= "<td align='center'>" . $f_edit_link . '</td>';
293
+				$echo  .= "<td align='center'>" . $f_del_link . '</td>';
294
+				$echo  .= "<td align='center'>" . $sf_add_link . '</td>';
295
+				$echo  .= "<td align='center'>" . $f_move_link . '</td>';
296
+				$echo  .= "<td align='center'>" . $f_merge_link . '</td>';
297
+				$echo  .= '</tr>';
298
+			}
299
+		}
300
+		unset($forums, $categories);
301 301
 
302
-        echo $echo;
303
-        echo '</table>';
304
-        echo '</td></tr></table>';
305
-        echo '<fieldset>';
306
-        echo '<legend>&nbsp;' . _MI_NEWBB_ADMENU_FORUM . '&nbsp;</legend>';
307
-        echo _AM_NEWBB_HELP_FORUM_TAB;
308
-        echo '<br>' . newbbDisplayImage('admin_edit', _EDIT) . '&nbsp;-&nbsp;' . _EDIT;
309
-        echo '<br>' . newbbDisplayImage('admin_delete', _DELETE) . '&nbsp;-&nbsp;' . _DELETE;
310
-        echo '<br>' . newbbDisplayImage('new_forum', _AM_NEWBB_CREATEFORUM) . '&nbsp;-&nbsp;' . _AM_NEWBB_CREATEFORUM;
311
-        echo '<br>' . newbbDisplayImage('admin_move', _AM_NEWBB_MOVE) . '&nbsp;-&nbsp;' . _AM_NEWBB_MOVE;
312
-        echo '<br>' . newbbDisplayImage('admin_merge', _AM_NEWBB_MERGE) . '&nbsp;-&nbsp;' . _AM_NEWBB_MERGE;
313
-        echo '</fieldset>';
314
-        break;
302
+		echo $echo;
303
+		echo '</table>';
304
+		echo '</td></tr></table>';
305
+		echo '<fieldset>';
306
+		echo '<legend>&nbsp;' . _MI_NEWBB_ADMENU_FORUM . '&nbsp;</legend>';
307
+		echo _AM_NEWBB_HELP_FORUM_TAB;
308
+		echo '<br>' . newbbDisplayImage('admin_edit', _EDIT) . '&nbsp;-&nbsp;' . _EDIT;
309
+		echo '<br>' . newbbDisplayImage('admin_delete', _DELETE) . '&nbsp;-&nbsp;' . _DELETE;
310
+		echo '<br>' . newbbDisplayImage('new_forum', _AM_NEWBB_CREATEFORUM) . '&nbsp;-&nbsp;' . _AM_NEWBB_CREATEFORUM;
311
+		echo '<br>' . newbbDisplayImage('admin_move', _AM_NEWBB_MOVE) . '&nbsp;-&nbsp;' . _AM_NEWBB_MOVE;
312
+		echo '<br>' . newbbDisplayImage('admin_merge', _AM_NEWBB_MERGE) . '&nbsp;-&nbsp;' . _AM_NEWBB_MERGE;
313
+		echo '</fieldset>';
314
+		break;
315 315
 }
316 316
 require_once __DIR__ . '/admin_footer.php';
Please login to merge, or discard this patch.
admin/admin_synchronization.php 1 patch
Indentation   +75 added lines, -75 removed lines patch added patch discarded remove patch
@@ -22,83 +22,83 @@
 block discarded – undo
22 22
 $start = Request::getInt('start', 0, 'GET'); //(int)( @$_GET['start'] );
23 23
 
24 24
 switch (Request::getString('type', '', 'GET')) {// @$_GET['type'])
25
-    // irmtfan rewrite forum sync
26
-    case 'forum':
27
-        $result = newbbSynchronization('forum');
28
-        if (!empty($result)) {
29
-            redirect_header('admin_synchronization.php', 2, _AM_NEWBB_SYNC_TYPE_FORUM . '<br>' . _AM_NEWBB_DATABASEUPDATED);
30
-        }
31
-        break;
32
-    // irmtfan rewrite topic sync
33
-    case 'topic':
34
-        $limit = Request::getInt('limit', 1000, 'POST'); //empty($_GET['limit']) ? 1000 : (int)($_GET['limit']);
35
-        //        /** @var Newbb\TopicHandler $topicHandler */
36
-        //        $topicHandler = Newbb\Helper::getInstance()->getHandler('Topic');
37
-        $criteria = new \Criteria('approved', 1);
38
-        if ($start >= ($count = $topicHandler->getCount($criteria))) {
39
-            break;
40
-        }
41
-        $criteria->setStart($start);
42
-        $criteria->setLimit($limit);
43
-        $topicObjs = $topicHandler->getAll($criteria);
44
-        foreach ($topicObjs as $tObj) {
45
-            $topicHandler->synchronization($tObj);
46
-        }
47
-        $result = newbbSynchronization('topic');
48
-        redirect_header('admin_synchronization.php?type=topic&amp;start=' . ($start + $limit) . "&amp;limit={$limit}", 2, _AM_NEWBB_SYNCHING . " {$count}: {$start} - " . ($start + $limit));
49
-        break;
50
-    // irmtfan rewrite post sync
51
-    case 'post':
52
-        $result = newbbSynchronization('post');
53
-        if (!empty($result)) {
54
-            redirect_header('admin_synchronization.php', 2, _AM_NEWBB_SYNC_TYPE_POST . '<br>' . _AM_NEWBB_DATABASEUPDATED);
55
-        }
56
-        break;
57
-    // irmtfan - user is not in recon functions - only here
58
-    case 'user':
59
-        $limit = Request::getInt('limit', 1000, 'GET'); //empty($_GET['limit']) ? 1000 : (int)($_GET['limit']);
60
-        /** @var \XoopsUserHandler $userHandler */
61
-        $userHandler = xoops_getHandler('user');
62
-        if ($start >= ($count = $userHandler->getCount())) {
63
-            break;
64
-        }
65
-        $sql    = '    SELECT uid' . '    FROM ' . $GLOBALS['xoopsDB']->prefix('users');
66
-        $result = $GLOBALS['xoopsDB']->query($sql, $limit, $start);
67
-        while (false !== (list($uid) = $GLOBALS['xoopsDB']->fetchRow($result))) {
68
-            // irmtfan approved=1 AND
69
-            $sql = '    SELECT count(*)' . '    FROM ' . $GLOBALS['xoopsDB']->prefix('newbb_topics') . "    WHERE topic_poster = {$uid}";
70
-            $ret = $GLOBALS['xoopsDB']->query($sql);
71
-            list($topics) = $GLOBALS['xoopsDB']->fetchRow($ret);
72
-            // irmtfan approved=1 AND
73
-            $sql = '    SELECT count(*)' . '    FROM ' . $GLOBALS['xoopsDB']->prefix('newbb_topics') . "    WHERE topic_digest > 0 AND topic_poster = {$uid}";
74
-            $ret = $GLOBALS['xoopsDB']->query($sql);
75
-            list($digests) = $GLOBALS['xoopsDB']->fetchRow($ret);
76
-            // irmtfan approved=1 AND
77
-            $sql = '    SELECT count(*), MAX(post_time)' . '    FROM ' . $GLOBALS['xoopsDB']->prefix('newbb_posts') . "    WHERE uid = {$uid}";
78
-            $ret = $GLOBALS['xoopsDB']->query($sql);
79
-            list($posts, $lastpost) = $GLOBALS['xoopsDB']->fetchRow($ret);
25
+	// irmtfan rewrite forum sync
26
+	case 'forum':
27
+		$result = newbbSynchronization('forum');
28
+		if (!empty($result)) {
29
+			redirect_header('admin_synchronization.php', 2, _AM_NEWBB_SYNC_TYPE_FORUM . '<br>' . _AM_NEWBB_DATABASEUPDATED);
30
+		}
31
+		break;
32
+	// irmtfan rewrite topic sync
33
+	case 'topic':
34
+		$limit = Request::getInt('limit', 1000, 'POST'); //empty($_GET['limit']) ? 1000 : (int)($_GET['limit']);
35
+		//        /** @var Newbb\TopicHandler $topicHandler */
36
+		//        $topicHandler = Newbb\Helper::getInstance()->getHandler('Topic');
37
+		$criteria = new \Criteria('approved', 1);
38
+		if ($start >= ($count = $topicHandler->getCount($criteria))) {
39
+			break;
40
+		}
41
+		$criteria->setStart($start);
42
+		$criteria->setLimit($limit);
43
+		$topicObjs = $topicHandler->getAll($criteria);
44
+		foreach ($topicObjs as $tObj) {
45
+			$topicHandler->synchronization($tObj);
46
+		}
47
+		$result = newbbSynchronization('topic');
48
+		redirect_header('admin_synchronization.php?type=topic&amp;start=' . ($start + $limit) . "&amp;limit={$limit}", 2, _AM_NEWBB_SYNCHING . " {$count}: {$start} - " . ($start + $limit));
49
+		break;
50
+	// irmtfan rewrite post sync
51
+	case 'post':
52
+		$result = newbbSynchronization('post');
53
+		if (!empty($result)) {
54
+			redirect_header('admin_synchronization.php', 2, _AM_NEWBB_SYNC_TYPE_POST . '<br>' . _AM_NEWBB_DATABASEUPDATED);
55
+		}
56
+		break;
57
+	// irmtfan - user is not in recon functions - only here
58
+	case 'user':
59
+		$limit = Request::getInt('limit', 1000, 'GET'); //empty($_GET['limit']) ? 1000 : (int)($_GET['limit']);
60
+		/** @var \XoopsUserHandler $userHandler */
61
+		$userHandler = xoops_getHandler('user');
62
+		if ($start >= ($count = $userHandler->getCount())) {
63
+			break;
64
+		}
65
+		$sql    = '    SELECT uid' . '    FROM ' . $GLOBALS['xoopsDB']->prefix('users');
66
+		$result = $GLOBALS['xoopsDB']->query($sql, $limit, $start);
67
+		while (false !== (list($uid) = $GLOBALS['xoopsDB']->fetchRow($result))) {
68
+			// irmtfan approved=1 AND
69
+			$sql = '    SELECT count(*)' . '    FROM ' . $GLOBALS['xoopsDB']->prefix('newbb_topics') . "    WHERE topic_poster = {$uid}";
70
+			$ret = $GLOBALS['xoopsDB']->query($sql);
71
+			list($topics) = $GLOBALS['xoopsDB']->fetchRow($ret);
72
+			// irmtfan approved=1 AND
73
+			$sql = '    SELECT count(*)' . '    FROM ' . $GLOBALS['xoopsDB']->prefix('newbb_topics') . "    WHERE topic_digest > 0 AND topic_poster = {$uid}";
74
+			$ret = $GLOBALS['xoopsDB']->query($sql);
75
+			list($digests) = $GLOBALS['xoopsDB']->fetchRow($ret);
76
+			// irmtfan approved=1 AND
77
+			$sql = '    SELECT count(*), MAX(post_time)' . '    FROM ' . $GLOBALS['xoopsDB']->prefix('newbb_posts') . "    WHERE uid = {$uid}";
78
+			$ret = $GLOBALS['xoopsDB']->query($sql);
79
+			list($posts, $lastpost) = $GLOBALS['xoopsDB']->fetchRow($ret);
80 80
 
81
-            $GLOBALS['xoopsDB']->queryF('    REPLACE INTO ' . $GLOBALS['xoopsDB']->prefix('newbb_user_stats') . "    SET uid = '{$uid}', user_topics = '{$topics}', user_posts = '{$posts}', user_digests = '{$digests}', user_lastpost = '{$lastpost}'");
82
-        }
81
+			$GLOBALS['xoopsDB']->queryF('    REPLACE INTO ' . $GLOBALS['xoopsDB']->prefix('newbb_user_stats') . "    SET uid = '{$uid}', user_topics = '{$topics}', user_posts = '{$posts}', user_digests = '{$digests}', user_lastpost = '{$lastpost}'");
82
+		}
83 83
 
84
-        redirect_header('admin_synchronization.php?type=user&amp;start=' . ($start + $limit) . "&amp;limit={$limit}", 2, _AM_NEWBB_SYNCHING . " {$count}: {$start} - " . ($start + $limit));
85
-        break;
86
-    // irmtfan rewrite stats reset
87
-    case 'stats':
88
-        $result = newbbSynchronization('stats');
89
-        break;
90
-    // START irmtfan add read sync
91
-    case 'read':
92
-        $result = newbbSynchronization(['readtopic', 'readforum']);
93
-        if (!empty($result)) {
94
-            redirect_header('admin_synchronization.php', 2, _AM_NEWBB_SYNC_TYPE_READ . '<br>' . _AM_NEWBB_DATABASEUPDATED);
95
-        }
96
-        exit();
97
-    // END irmtfan add read sync
98
-    case 'misc':
99
-    default:
100
-        newbbSynchronization();
101
-        break;
84
+		redirect_header('admin_synchronization.php?type=user&amp;start=' . ($start + $limit) . "&amp;limit={$limit}", 2, _AM_NEWBB_SYNCHING . " {$count}: {$start} - " . ($start + $limit));
85
+		break;
86
+	// irmtfan rewrite stats reset
87
+	case 'stats':
88
+		$result = newbbSynchronization('stats');
89
+		break;
90
+	// START irmtfan add read sync
91
+	case 'read':
92
+		$result = newbbSynchronization(['readtopic', 'readforum']);
93
+		if (!empty($result)) {
94
+			redirect_header('admin_synchronization.php', 2, _AM_NEWBB_SYNC_TYPE_READ . '<br>' . _AM_NEWBB_DATABASEUPDATED);
95
+		}
96
+		exit();
97
+	// END irmtfan add read sync
98
+	case 'misc':
99
+	default:
100
+		newbbSynchronization();
101
+		break;
102 102
 }
103 103
 
104 104
 // <legend style="font-weight: bold; color: #900;">' . _AM_NEWBB_SYNCFORUM . '</legend>';
Please login to merge, or discard this patch.
admin/admin_footer.php 1 patch
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -20,7 +20,7 @@
 block discarded – undo
20 20
 global $pathIcon32;
21 21
 
22 22
 if (!class_exists('\Xoops', false)) {
23
-    echo "<div class='adminfooter'>\n" . "  <div style='text-align: center;'>\n" . "    <a href='https://xoops.org' rel='external'><img src='{$pathIcon32}/xoopsmicrobutton.gif' alt='XOOPS' title='XOOPS'></a>\n" . "  </div>\n" . '  ' . _AM_MODULEADMIN_ADMIN_FOOTER . "\n" . "</div>\n";
23
+	echo "<div class='adminfooter'>\n" . "  <div style='text-align: center;'>\n" . "    <a href='https://xoops.org' rel='external'><img src='{$pathIcon32}/xoopsmicrobutton.gif' alt='XOOPS' title='XOOPS'></a>\n" . "  </div>\n" . '  ' . _AM_MODULEADMIN_ADMIN_FOOTER . "\n" . "</div>\n";
24 24
 }
25 25
 
26 26
 xoops_cp_footer();
Please login to merge, or discard this patch.
admin/admin_forum_prune.php 1 patch
Indentation   +173 added lines, -173 removed lines patch added patch discarded remove patch
@@ -39,156 +39,156 @@  discard block
 block discarded – undo
39 39
 echo "<table width='100%' border='0' cellspacing='1' class='outer'>" . "<tr><td class='odd'>";
40 40
 
41 41
 if (Request::hasVar('submit', 'POST')) {
42
-    $post_list       = null;
43
-    $topic_list      = null;
44
-    $topics_number   = 0;
45
-    $posts_number    = 0;
46
-    $selected_forums = '';
47
-    // irmtfan fix if it is array
48
-    $temp = Request::getArray('forums', null, 'POST');
49
-    if (!$temp || !$temp[0]) {
50
-        redirect_header('admin_forum_prune.php', 1, _AM_NEWBB_PRUNE_FORUMSELERROR);
51
-    } elseif (is_array(Request::getArray('forums', '', 'POST'))) {
52
-        $selected_forums = implode(',', Request::getArray('forums', null, 'POST'));
53
-    } else {
54
-        $selected_forums = Request::getArray('forums', null, 'POST');
55
-    }
42
+	$post_list       = null;
43
+	$topic_list      = null;
44
+	$topics_number   = 0;
45
+	$posts_number    = 0;
46
+	$selected_forums = '';
47
+	// irmtfan fix if it is array
48
+	$temp = Request::getArray('forums', null, 'POST');
49
+	if (!$temp || !$temp[0]) {
50
+		redirect_header('admin_forum_prune.php', 1, _AM_NEWBB_PRUNE_FORUMSELERROR);
51
+	} elseif (is_array(Request::getArray('forums', '', 'POST'))) {
52
+		$selected_forums = implode(',', Request::getArray('forums', null, 'POST'));
53
+	} else {
54
+		$selected_forums = Request::getArray('forums', null, 'POST');
55
+	}
56 56
 
57
-    $prune_days  = Request::getInt('days', 0, 'POST');
58
-    $prune_ddays = time() - $prune_days;
59
-    $archive     = Request::getInt('archive', 0, 'POST');
60
-    $sticky      = Request::getInt('sticky', 0, 'POST');
61
-    $digest      = Request::getInt('digest', 0, 'POST');
62
-    $lock        = Request::getInt('lock', 0, 'POST');
63
-    $hot         = Request::getInt('hot', 0, 'POST');
64
-    $store       = Request::getInt('store', null, 'POST');
57
+	$prune_days  = Request::getInt('days', 0, 'POST');
58
+	$prune_ddays = time() - $prune_days;
59
+	$archive     = Request::getInt('archive', 0, 'POST');
60
+	$sticky      = Request::getInt('sticky', 0, 'POST');
61
+	$digest      = Request::getInt('digest', 0, 'POST');
62
+	$lock        = Request::getInt('lock', 0, 'POST');
63
+	$hot         = Request::getInt('hot', 0, 'POST');
64
+	$store       = Request::getInt('store', null, 'POST');
65 65
 
66
-    $sql = 'SELECT t.topic_id FROM ' . $GLOBALS['xoopsDB']->prefix('newbb_topics') . ' t, ' . $GLOBALS['xoopsDB']->prefix('newbb_posts') . '  p
66
+	$sql = 'SELECT t.topic_id FROM ' . $GLOBALS['xoopsDB']->prefix('newbb_topics') . ' t, ' . $GLOBALS['xoopsDB']->prefix('newbb_posts') . '  p
67 67
                     WHERE t.forum_id IN (' . $selected_forums . ')
68 68
                     AND p.post_id =t.topic_last_post_id ';
69 69
 
70
-    if ($sticky) {
71
-        $sql .= ' AND t.topic_sticky <> 1 ';
72
-    }
73
-    if ($digest) {
74
-        $sql .= ' AND t.topic_digest <> 1 ';
75
-    }
76
-    if ($lock) {
77
-        $sql .= ' AND t.topic_status <> 1 ';
78
-    }
79
-    if (0 !== $hot) {
80
-        $sql .= ' AND t.topic_replies < ' . $hot . ' ';
81
-    }
70
+	if ($sticky) {
71
+		$sql .= ' AND t.topic_sticky <> 1 ';
72
+	}
73
+	if ($digest) {
74
+		$sql .= ' AND t.topic_digest <> 1 ';
75
+	}
76
+	if ($lock) {
77
+		$sql .= ' AND t.topic_status <> 1 ';
78
+	}
79
+	if (0 !== $hot) {
80
+		$sql .= ' AND t.topic_replies < ' . $hot . ' ';
81
+	}
82 82
 
83
-    $sql .= ' AND p.post_time<= ' . $prune_ddays . ' ';
84
-    // Ok now we have the sql query completed, go for topic_id's and posts_id's
85
-    $topics = [];
86
-    if (!$result = $GLOBALS['xoopsDB']->query($sql)) {
87
-        return _MD_NEWBB_ERROR;
88
-    }
89
-    // Dave_L code
90
-    while (false !== ($row = $GLOBALS['xoopsDB']->fetchArray($result))) {
91
-        $topics[] = $row['topic_id'];
92
-    }
93
-    $topics_number = count($topics);
94
-    $topic_list    = implode(',', $topics);
95
-    $post_list     = '';
83
+	$sql .= ' AND p.post_time<= ' . $prune_ddays . ' ';
84
+	// Ok now we have the sql query completed, go for topic_id's and posts_id's
85
+	$topics = [];
86
+	if (!$result = $GLOBALS['xoopsDB']->query($sql)) {
87
+		return _MD_NEWBB_ERROR;
88
+	}
89
+	// Dave_L code
90
+	while (false !== ($row = $GLOBALS['xoopsDB']->fetchArray($result))) {
91
+		$topics[] = $row['topic_id'];
92
+	}
93
+	$topics_number = count($topics);
94
+	$topic_list    = implode(',', $topics);
95
+	$post_list     = '';
96 96
 
97
-    if ('' !== $topic_list) {
98
-        $sql = 'SELECT post_id FROM ' . $GLOBALS['xoopsDB']->prefix('newbb_posts') . ' WHERE topic_id IN (' . $topic_list . ')';
97
+	if ('' !== $topic_list) {
98
+		$sql = 'SELECT post_id FROM ' . $GLOBALS['xoopsDB']->prefix('newbb_posts') . ' WHERE topic_id IN (' . $topic_list . ')';
99 99
 
100
-        $posts = [];
101
-        if (!$result = $GLOBALS['xoopsDB']->query($sql)) {
102
-            return _MD_NEWBB_ERROR;
103
-        }
104
-        // Dave_L code
105
-        while (false !== ($row = $GLOBALS['xoopsDB']->fetchArray($result))) {
106
-            $posts[] = $row['post_id'];
107
-        }
108
-        $posts_number = count($posts);
109
-        $post_list    = implode(',', $posts);
110
-    }
111
-    // OKZ Now we have al posts id and topics id
112
-    if ('' !== $post_list) {
113
-        // COPY POSTS TO OTHER FORUM
114
-        if (null !== $store) {
115
-            $sql = 'UPDATE ' . $GLOBALS['xoopsDB']->prefix('newbb_posts') . " SET forum_id=$store WHERE topic_id IN ($topic_list)";
116
-            if (!$result = $GLOBALS['xoopsDB']->query($sql)) {
117
-                return _MD_NEWBB_ERROR;
118
-            }
100
+		$posts = [];
101
+		if (!$result = $GLOBALS['xoopsDB']->query($sql)) {
102
+			return _MD_NEWBB_ERROR;
103
+		}
104
+		// Dave_L code
105
+		while (false !== ($row = $GLOBALS['xoopsDB']->fetchArray($result))) {
106
+			$posts[] = $row['post_id'];
107
+		}
108
+		$posts_number = count($posts);
109
+		$post_list    = implode(',', $posts);
110
+	}
111
+	// OKZ Now we have al posts id and topics id
112
+	if ('' !== $post_list) {
113
+		// COPY POSTS TO OTHER FORUM
114
+		if (null !== $store) {
115
+			$sql = 'UPDATE ' . $GLOBALS['xoopsDB']->prefix('newbb_posts') . " SET forum_id=$store WHERE topic_id IN ($topic_list)";
116
+			if (!$result = $GLOBALS['xoopsDB']->query($sql)) {
117
+				return _MD_NEWBB_ERROR;
118
+			}
119 119
 
120
-            $sql = 'UPDATE ' . $GLOBALS['xoopsDB']->prefix('newbb_topics') . " SET forum_id=$store WHERE topic_id IN ($topic_list)";
121
-            if (!$result = $GLOBALS['xoopsDB']->query($sql)) {
122
-                return _MD_NEWBB_ERROR;
123
-            }
124
-        } else {
125
-            // ARCHIVING POSTS
126
-            if (1 == $archive) {
127
-                $result = $GLOBALS['xoopsDB']->query('SELECT p.topic_id, p.post_id, t.post_text FROM ' . $GLOBALS['xoopsDB']->prefix('newbb_posts') . ' p, ' . $GLOBALS['xoopsDB']->prefix('newbb_posts_text') . " t WHERE p.post_id IN ($post_list) AND p.post_id=t.post_id");
128
-                while (false !== (list($topic_id, $post_id, $post_text) = $GLOBALS['xoopsDB']->fetchRow($result))) {
129
-                    $sql = $GLOBALS['xoopsDB']->query('INSERT INTO ' . $GLOBALS['xoopsDB']->prefix('newbb_archive') . " (topic_id, post_id, post_text) VALUES ($topic_id, $post_id, $post_text)");
130
-                }
131
-            }
132
-            // DELETE POSTS
133
-            $sql = 'DELETE FROM ' . $GLOBALS['xoopsDB']->prefix('newbb_posts') . " WHERE topic_id IN ($topic_list)";
134
-            if (!$result = $GLOBALS['xoopsDB']->query($sql)) {
135
-                return _MD_NEWBB_ERROR;
136
-            }
137
-            // DELETE TOPICS
138
-            $sql = 'DELETE FROM ' . $GLOBALS['xoopsDB']->prefix('newbb_topics') . " WHERE topic_id IN ($topic_list)";
139
-            if (!$result = $GLOBALS['xoopsDB']->query($sql)) {
140
-                return _MD_NEWBB_ERROR;
141
-            }
142
-            // DELETE POSTS_TEXT
143
-            $sql = 'DELETE FROM ' . $GLOBALS['xoopsDB']->prefix('newbb_posts_text') . " WHERE post_id IN ($post_list)";
144
-            if (!$result = $GLOBALS['xoopsDB']->query($sql)) {
145
-                return _MD_NEWBB_ERROR;
146
-            }
147
-            // SYNC FORUMS AFTER DELETE
148
-            //            /** @var Newbb\ForumHandler $forumHandler */
149
-            //            $forumHandler = Newbb\Helper::getInstance()->getHandler('Forum');
150
-            $forumHandler->synchronization();
151
-            // I THINK POSTS AND TOPICS HAVE BEEN DESTROYED :LOL:
152
-        }
153
-    }
120
+			$sql = 'UPDATE ' . $GLOBALS['xoopsDB']->prefix('newbb_topics') . " SET forum_id=$store WHERE topic_id IN ($topic_list)";
121
+			if (!$result = $GLOBALS['xoopsDB']->query($sql)) {
122
+				return _MD_NEWBB_ERROR;
123
+			}
124
+		} else {
125
+			// ARCHIVING POSTS
126
+			if (1 == $archive) {
127
+				$result = $GLOBALS['xoopsDB']->query('SELECT p.topic_id, p.post_id, t.post_text FROM ' . $GLOBALS['xoopsDB']->prefix('newbb_posts') . ' p, ' . $GLOBALS['xoopsDB']->prefix('newbb_posts_text') . " t WHERE p.post_id IN ($post_list) AND p.post_id=t.post_id");
128
+				while (false !== (list($topic_id, $post_id, $post_text) = $GLOBALS['xoopsDB']->fetchRow($result))) {
129
+					$sql = $GLOBALS['xoopsDB']->query('INSERT INTO ' . $GLOBALS['xoopsDB']->prefix('newbb_archive') . " (topic_id, post_id, post_text) VALUES ($topic_id, $post_id, $post_text)");
130
+				}
131
+			}
132
+			// DELETE POSTS
133
+			$sql = 'DELETE FROM ' . $GLOBALS['xoopsDB']->prefix('newbb_posts') . " WHERE topic_id IN ($topic_list)";
134
+			if (!$result = $GLOBALS['xoopsDB']->query($sql)) {
135
+				return _MD_NEWBB_ERROR;
136
+			}
137
+			// DELETE TOPICS
138
+			$sql = 'DELETE FROM ' . $GLOBALS['xoopsDB']->prefix('newbb_topics') . " WHERE topic_id IN ($topic_list)";
139
+			if (!$result = $GLOBALS['xoopsDB']->query($sql)) {
140
+				return _MD_NEWBB_ERROR;
141
+			}
142
+			// DELETE POSTS_TEXT
143
+			$sql = 'DELETE FROM ' . $GLOBALS['xoopsDB']->prefix('newbb_posts_text') . " WHERE post_id IN ($post_list)";
144
+			if (!$result = $GLOBALS['xoopsDB']->query($sql)) {
145
+				return _MD_NEWBB_ERROR;
146
+			}
147
+			// SYNC FORUMS AFTER DELETE
148
+			//            /** @var Newbb\ForumHandler $forumHandler */
149
+			//            $forumHandler = Newbb\Helper::getInstance()->getHandler('Forum');
150
+			$forumHandler->synchronization();
151
+			// I THINK POSTS AND TOPICS HAVE BEEN DESTROYED :LOL:
152
+		}
153
+	}
154 154
 
155
-    $tform = new \XoopsThemeForm(_AM_NEWBB_PRUNE_RESULTS_TITLE, 'prune_results', xoops_getenv('PHP_SELF'));
156
-    $tform->addElement(new \XoopsFormLabel(_AM_NEWBB_PRUNE_RESULTS_FORUMS, $selected_forums));
157
-    $tform->addElement(new \XoopsFormLabel(_AM_NEWBB_PRUNE_RESULTS_TOPICS, $topics_number));
158
-    $tform->addElement(new \XoopsFormLabel(_AM_NEWBB_PRUNE_RESULTS_POSTS, $posts_number));
159
-    $tform->display();
155
+	$tform = new \XoopsThemeForm(_AM_NEWBB_PRUNE_RESULTS_TITLE, 'prune_results', xoops_getenv('PHP_SELF'));
156
+	$tform->addElement(new \XoopsFormLabel(_AM_NEWBB_PRUNE_RESULTS_FORUMS, $selected_forums));
157
+	$tform->addElement(new \XoopsFormLabel(_AM_NEWBB_PRUNE_RESULTS_TOPICS, $topics_number));
158
+	$tform->addElement(new \XoopsFormLabel(_AM_NEWBB_PRUNE_RESULTS_POSTS, $posts_number));
159
+	$tform->display();
160 160
 } else {
161
-    $sform = new \XoopsThemeForm(_AM_NEWBB_PRUNE_TITLE, 'prune', xoops_getenv('PHP_SELF'));
162
-    $sform->setExtra('enctype="multipart/form-data"');
161
+	$sform = new \XoopsThemeForm(_AM_NEWBB_PRUNE_TITLE, 'prune', xoops_getenv('PHP_SELF'));
162
+	$sform->setExtra('enctype="multipart/form-data"');
163 163
 
164
-    /* Let User select the number of days
164
+	/* Let User select the number of days
165 165
     $sform->addElement( new \XoopsFormText(_AM_NEWBB_PRUNE_DAYS , 'days', 5, 10,100 ), true );
166 166
     */
167
-    // $sql="SELECT p.topic_id, p.post_id t.post_text FROM ".$GLOBALS['xoopsDB']->prefix("newbb_posts")." p, ".$GLOBALS['xoopsDB']->prefix("newbb_posts_text")." t WHERE p.post_id IN ($post_list) AND p.post_id=t.post_id";
168
-    // $result = $GLOBALS['xoopsDB']->query();
169
-    // Days selected by selbox (better error control :lol:)
170
-    $days = new \XoopsFormSelect(_AM_NEWBB_PRUNE_DAYS, 'days', null, 1, false);
171
-    $days->addOptionArray([
172
-                              604800   => _AM_NEWBB_PRUNE_WEEK,
173
-                              1209600  => _AM_NEWBB_PRUNE_2WEEKS,
174
-                              2592000  => _AM_NEWBB_PRUNE_MONTH,
175
-                              5184000  => _AM_NEWBB_PRUNE_2MONTH,
176
-                              10368000 => _AM_NEWBB_PRUNE_4MONTH,
177
-                              31536000 => _AM_NEWBB_PRUNE_YEAR,
178
-                              63072000 => _AM_NEWBB_PRUNE_2YEARS
179
-                          ]);
180
-    $sform->addElement($days);
181
-    // START irmtfan remove hardcode db access
182
-    require_once $GLOBALS['xoops']->path('modules/' . $xoopsModule->getVar('dirname') . '/footer.php'); // to include js files
183
-    require_once dirname(__DIR__) . '/include/functions.forum.php';
184
-    $forumSelMulti  = "<select name=\"forums[]\" multiple=\"multiple\" onfocus = \"validate('forums[]','select', false,true)\">";// disable all categories
185
-    $forumSelSingle = "<select name=\"store\" onfocus = \"validate('store','select', false,true)\">"; // disable all categories
186
-    $forumSelBox    = '<option value = 0 >-- ' . _AM_NEWBB_PERM_FORUMS . ' --</option>';
187
-    $forumSelBox    .= newbbForumSelectBox(null, 'access', false); //$accessForums = nothing, $permission = "access", $delimitorCategory = false
188
-    $forumSelBox    .= '</select>';
189
-    $forumEle       = new \XoopsFormLabel(_AM_NEWBB_PRUNE_FORUMS, $forumSelMulti . $forumSelBox);
190
-    $storeEle       = new \XoopsFormLabel(_AM_NEWBB_PRUNE_STORE, $forumSelSingle . $forumSelBox);
191
-    /* irmtfan remove hardcode
167
+	// $sql="SELECT p.topic_id, p.post_id t.post_text FROM ".$GLOBALS['xoopsDB']->prefix("newbb_posts")." p, ".$GLOBALS['xoopsDB']->prefix("newbb_posts_text")." t WHERE p.post_id IN ($post_list) AND p.post_id=t.post_id";
168
+	// $result = $GLOBALS['xoopsDB']->query();
169
+	// Days selected by selbox (better error control :lol:)
170
+	$days = new \XoopsFormSelect(_AM_NEWBB_PRUNE_DAYS, 'days', null, 1, false);
171
+	$days->addOptionArray([
172
+							  604800   => _AM_NEWBB_PRUNE_WEEK,
173
+							  1209600  => _AM_NEWBB_PRUNE_2WEEKS,
174
+							  2592000  => _AM_NEWBB_PRUNE_MONTH,
175
+							  5184000  => _AM_NEWBB_PRUNE_2MONTH,
176
+							  10368000 => _AM_NEWBB_PRUNE_4MONTH,
177
+							  31536000 => _AM_NEWBB_PRUNE_YEAR,
178
+							  63072000 => _AM_NEWBB_PRUNE_2YEARS
179
+						  ]);
180
+	$sform->addElement($days);
181
+	// START irmtfan remove hardcode db access
182
+	require_once $GLOBALS['xoops']->path('modules/' . $xoopsModule->getVar('dirname') . '/footer.php'); // to include js files
183
+	require_once dirname(__DIR__) . '/include/functions.forum.php';
184
+	$forumSelMulti  = "<select name=\"forums[]\" multiple=\"multiple\" onfocus = \"validate('forums[]','select', false,true)\">";// disable all categories
185
+	$forumSelSingle = "<select name=\"store\" onfocus = \"validate('store','select', false,true)\">"; // disable all categories
186
+	$forumSelBox    = '<option value = 0 >-- ' . _AM_NEWBB_PERM_FORUMS . ' --</option>';
187
+	$forumSelBox    .= newbbForumSelectBox(null, 'access', false); //$accessForums = nothing, $permission = "access", $delimitorCategory = false
188
+	$forumSelBox    .= '</select>';
189
+	$forumEle       = new \XoopsFormLabel(_AM_NEWBB_PRUNE_FORUMS, $forumSelMulti . $forumSelBox);
190
+	$storeEle       = new \XoopsFormLabel(_AM_NEWBB_PRUNE_STORE, $forumSelSingle . $forumSelBox);
191
+	/* irmtfan remove hardcode
192 192
     $checkbox = new \XoopsFormCheckBox(_AM_NEWBB_PRUNE_FORUMS, 'forums');
193 193
     $radiobox = new \XoopsFormRadio(_AM_NEWBB_PRUNE_STORE, 'store');
194 194
     // PUAJJ I HATE IT, please tidy up
@@ -206,52 +206,52 @@  discard block
 block discarded – undo
206 206
         echo "DB ERROR";
207 207
     }
208 208
     */
209
-    // END irmtfan remove hardcode db access
209
+	// END irmtfan remove hardcode db access
210 210
 
211
-    $sform->addElement(/*$checkbox*/
212
-        $forumEle); // irmtfan
211
+	$sform->addElement(/*$checkbox*/
212
+		$forumEle); // irmtfan
213 213
 
214
-    $sticky_confirmation = new \XoopsFormRadio(_AM_NEWBB_PRUNE_STICKY, 'sticky', 1);
215
-    $sticky_confirmation->addOption(1, _AM_NEWBB_PRUNE_YES);
216
-    $sticky_confirmation->addOption(0, _AM_NEWBB_PRUNE_NO);
217
-    $sform->addElement($sticky_confirmation);
214
+	$sticky_confirmation = new \XoopsFormRadio(_AM_NEWBB_PRUNE_STICKY, 'sticky', 1);
215
+	$sticky_confirmation->addOption(1, _AM_NEWBB_PRUNE_YES);
216
+	$sticky_confirmation->addOption(0, _AM_NEWBB_PRUNE_NO);
217
+	$sform->addElement($sticky_confirmation);
218 218
 
219
-    $digest_confirmation = new \XoopsFormRadio(_AM_NEWBB_PRUNE_DIGEST, 'digest', 1);
220
-    $digest_confirmation->addOption(1, _AM_NEWBB_PRUNE_YES);
221
-    $digest_confirmation->addOption(0, _AM_NEWBB_PRUNE_NO);
222
-    $sform->addElement($digest_confirmation);
219
+	$digest_confirmation = new \XoopsFormRadio(_AM_NEWBB_PRUNE_DIGEST, 'digest', 1);
220
+	$digest_confirmation->addOption(1, _AM_NEWBB_PRUNE_YES);
221
+	$digest_confirmation->addOption(0, _AM_NEWBB_PRUNE_NO);
222
+	$sform->addElement($digest_confirmation);
223 223
 
224
-    $lock_confirmation = new \XoopsFormRadio(_AM_NEWBB_PRUNE_LOCK, 'lock', 0);
225
-    $lock_confirmation->addOption(1, _AM_NEWBB_PRUNE_YES);
226
-    $lock_confirmation->addOption(0, _AM_NEWBB_PRUNE_NO);
227
-    $sform->addElement($lock_confirmation);
224
+	$lock_confirmation = new \XoopsFormRadio(_AM_NEWBB_PRUNE_LOCK, 'lock', 0);
225
+	$lock_confirmation->addOption(1, _AM_NEWBB_PRUNE_YES);
226
+	$lock_confirmation->addOption(0, _AM_NEWBB_PRUNE_NO);
227
+	$sform->addElement($lock_confirmation);
228 228
 
229
-    $hot_confirmation = new \XoopsFormSelect(_AM_NEWBB_PRUNE_HOT, 'hot', null, 1, false);
230
-    $hot_confirmation->addOptionArray([
231
-                                          '0'  => 0,
232
-                                          '5'  => 5,
233
-                                          '10' => 10,
234
-                                          '15' => 15,
235
-                                          '20' => 20,
236
-                                          '25' => 25,
237
-                                          '30' => 30
238
-                                      ]);
239
-    $sform->addElement($hot_confirmation);
229
+	$hot_confirmation = new \XoopsFormSelect(_AM_NEWBB_PRUNE_HOT, 'hot', null, 1, false);
230
+	$hot_confirmation->addOptionArray([
231
+										  '0'  => 0,
232
+										  '5'  => 5,
233
+										  '10' => 10,
234
+										  '15' => 15,
235
+										  '20' => 20,
236
+										  '25' => 25,
237
+										  '30' => 30
238
+									  ]);
239
+	$sform->addElement($hot_confirmation);
240 240
 
241
-    $sform->addElement(/*$radiobox*/
242
-        $storeEle); // irmtfan
241
+	$sform->addElement(/*$radiobox*/
242
+		$storeEle); // irmtfan
243 243
 
244
-    $archive_confirmation = new \XoopsFormRadio(_AM_NEWBB_PRUNE_ARCHIVE, 'archive', 1);
245
-    $archive_confirmation->addOption(1, _AM_NEWBB_PRUNE_YES);
246
-    $archive_confirmation->addOption(0, _AM_NEWBB_PRUNE_NO);
247
-    $sform->addElement($archive_confirmation);
244
+	$archive_confirmation = new \XoopsFormRadio(_AM_NEWBB_PRUNE_ARCHIVE, 'archive', 1);
245
+	$archive_confirmation->addOption(1, _AM_NEWBB_PRUNE_YES);
246
+	$archive_confirmation->addOption(0, _AM_NEWBB_PRUNE_NO);
247
+	$sform->addElement($archive_confirmation);
248 248
 
249
-    $button_tray = new \XoopsFormElementTray('', '');
250
-    $button_tray->addElement(new \XoopsFormButton('', 'submit', _AM_NEWBB_PRUNE_SUBMIT, 'submit'));
251
-    $button_tray->addElement(new \XoopsFormButton('', 'reset', _AM_NEWBB_PRUNE_RESET, 'reset'));
252
-    $sform->addElement($button_tray);
249
+	$button_tray = new \XoopsFormElementTray('', '');
250
+	$button_tray->addElement(new \XoopsFormButton('', 'submit', _AM_NEWBB_PRUNE_SUBMIT, 'submit'));
251
+	$button_tray->addElement(new \XoopsFormButton('', 'reset', _AM_NEWBB_PRUNE_RESET, 'reset'));
252
+	$sform->addElement($button_tray);
253 253
 
254
-    $sform->display();
254
+	$sform->display();
255 255
 }
256 256
 
257 257
 echo '</td></tr></table>';
Please login to merge, or discard this patch.
admin/admin_cat_manager.php 1 patch
Indentation   +146 added lines, -146 removed lines patch added patch discarded remove patch
@@ -49,7 +49,7 @@  discard block
 block discarded – undo
49 49
  */
50 50
 function newCategory()
51 51
 {
52
-    editCategory();
52
+	editCategory();
53 53
 }
54 54
 
55 55
 /**
@@ -60,154 +60,154 @@  discard block
 block discarded – undo
60 60
  */
61 61
 function editCategory(\XoopsObject $categoryObject = null)
62 62
 {
63
-    global $xoopsModule;
64
-    $categoryHandler = Newbb\Helper::getInstance()->getHandler('Category');
65
-    if (null === $categoryObject) {
66
-        $categoryObject = $categoryHandler->create();
67
-    }
68
-    $groups_cat_access = null;
69
-    require_once $GLOBALS['xoops']->path('class/xoopsformloader.php');
70
-
71
-    if (!$categoryObject->isNew()) {
72
-        $sform = new \XoopsThemeForm(_AM_NEWBB_EDITCATEGORY . ' ' . $categoryObject->getVar('cat_title'), 'op', xoops_getenv('PHP_SELF'));
73
-    } else {
74
-        $sform = new \XoopsThemeForm(_AM_NEWBB_CREATENEWCATEGORY, 'op', xoops_getenv('PHP_SELF'));
75
-        $categoryObject->setVar('cat_title', '');
76
-        $categoryObject->setVar('cat_image', '');
77
-        $categoryObject->setVar('cat_description', '');
78
-        $categoryObject->setVar('cat_order', 0);
79
-        $categoryObject->setVar('cat_url', 'https://xoops.org/modules/newbb/ newBB Support');
80
-    }
81
-
82
-    $sform->addElement(new \XoopsFormText(_AM_NEWBB_SETCATEGORYORDER, 'cat_order', 5, 10, $categoryObject->getVar('cat_order')), false);
83
-    $sform->addElement(new \XoopsFormText(_AM_NEWBB_CATEGORY, 'title', 50, 80, $categoryObject->getVar('cat_title', 'E')), true);
84
-    $sform->addElement(new \XoopsFormDhtmlTextArea(_AM_NEWBB_CATEGORYDESC, 'cat_description', $categoryObject->getVar('cat_description', 'E'), 10, 60), false);
85
-
86
-    $imgdir      = '/modules/' . $xoopsModule->getVar('dirname') . '/assets/images/category';
87
-    $cat_image   = $categoryObject->getVar('cat_image');
88
-    $cat_image   = empty($cat_image) ? 'blank.gif' : $cat_image;
89
-    $graph_array = \XoopsLists::getImgListAsArray(XOOPS_ROOT_PATH . $imgdir . '/');
90
-    array_unshift($graph_array, _NONE);
91
-    $cat_image_select = new \XoopsFormSelect('', 'cat_image', $categoryObject->getVar('cat_image'));
92
-    $cat_image_select->addOptionArray($graph_array);
93
-    $cat_image_select->setExtra("onchange=\"showImgSelected('img', 'cat_image', '/" . $imgdir . "/', '', '" . XOOPS_URL . "')\"");
94
-    $cat_image_tray = new \XoopsFormElementTray(_AM_NEWBB_IMAGE, '&nbsp;');
95
-    $cat_image_tray->addElement($cat_image_select);
96
-    $cat_image_tray->addElement(new \XoopsFormLabel('', "<br><img src='" . XOOPS_URL . $imgdir . '/' . $cat_image . " 'name='img' id='img' alt='' />"));
97
-    $sform->addElement($cat_image_tray);
98
-
99
-    $sform->addElement(new \XoopsFormText(_AM_NEWBB_SPONSORLINK, 'cat_url', 50, 80, $categoryObject->getVar('cat_url', 'E')), false);
100
-    $sform->addElement(new \XoopsFormHidden('cat_id', $categoryObject->getVar('cat_id')));
101
-
102
-    $button_tray = new \XoopsFormElementTray('', '');
103
-    $button_tray->addElement(new \XoopsFormHidden('op', 'save'));
104
-
105
-    $butt_save = new \XoopsFormButton('', '', _SUBMIT, 'submit');
106
-    $butt_save->setExtra('onclick="this.form.elements.op.value=\'save\'"');
107
-    $button_tray->addElement($butt_save);
108
-    if ($categoryObject->getVar('cat_id')) {
109
-        $butt_delete = new \XoopsFormButton('', '', _CANCEL, 'submit');
110
-        $butt_delete->setExtra('onclick="this.form.elements.op.value=\'default\'"');
111
-        $button_tray->addElement($butt_delete);
112
-    }
113
-    $sform->addElement($button_tray);
114
-    $sform->display();
63
+	global $xoopsModule;
64
+	$categoryHandler = Newbb\Helper::getInstance()->getHandler('Category');
65
+	if (null === $categoryObject) {
66
+		$categoryObject = $categoryHandler->create();
67
+	}
68
+	$groups_cat_access = null;
69
+	require_once $GLOBALS['xoops']->path('class/xoopsformloader.php');
70
+
71
+	if (!$categoryObject->isNew()) {
72
+		$sform = new \XoopsThemeForm(_AM_NEWBB_EDITCATEGORY . ' ' . $categoryObject->getVar('cat_title'), 'op', xoops_getenv('PHP_SELF'));
73
+	} else {
74
+		$sform = new \XoopsThemeForm(_AM_NEWBB_CREATENEWCATEGORY, 'op', xoops_getenv('PHP_SELF'));
75
+		$categoryObject->setVar('cat_title', '');
76
+		$categoryObject->setVar('cat_image', '');
77
+		$categoryObject->setVar('cat_description', '');
78
+		$categoryObject->setVar('cat_order', 0);
79
+		$categoryObject->setVar('cat_url', 'https://xoops.org/modules/newbb/ newBB Support');
80
+	}
81
+
82
+	$sform->addElement(new \XoopsFormText(_AM_NEWBB_SETCATEGORYORDER, 'cat_order', 5, 10, $categoryObject->getVar('cat_order')), false);
83
+	$sform->addElement(new \XoopsFormText(_AM_NEWBB_CATEGORY, 'title', 50, 80, $categoryObject->getVar('cat_title', 'E')), true);
84
+	$sform->addElement(new \XoopsFormDhtmlTextArea(_AM_NEWBB_CATEGORYDESC, 'cat_description', $categoryObject->getVar('cat_description', 'E'), 10, 60), false);
85
+
86
+	$imgdir      = '/modules/' . $xoopsModule->getVar('dirname') . '/assets/images/category';
87
+	$cat_image   = $categoryObject->getVar('cat_image');
88
+	$cat_image   = empty($cat_image) ? 'blank.gif' : $cat_image;
89
+	$graph_array = \XoopsLists::getImgListAsArray(XOOPS_ROOT_PATH . $imgdir . '/');
90
+	array_unshift($graph_array, _NONE);
91
+	$cat_image_select = new \XoopsFormSelect('', 'cat_image', $categoryObject->getVar('cat_image'));
92
+	$cat_image_select->addOptionArray($graph_array);
93
+	$cat_image_select->setExtra("onchange=\"showImgSelected('img', 'cat_image', '/" . $imgdir . "/', '', '" . XOOPS_URL . "')\"");
94
+	$cat_image_tray = new \XoopsFormElementTray(_AM_NEWBB_IMAGE, '&nbsp;');
95
+	$cat_image_tray->addElement($cat_image_select);
96
+	$cat_image_tray->addElement(new \XoopsFormLabel('', "<br><img src='" . XOOPS_URL . $imgdir . '/' . $cat_image . " 'name='img' id='img' alt='' />"));
97
+	$sform->addElement($cat_image_tray);
98
+
99
+	$sform->addElement(new \XoopsFormText(_AM_NEWBB_SPONSORLINK, 'cat_url', 50, 80, $categoryObject->getVar('cat_url', 'E')), false);
100
+	$sform->addElement(new \XoopsFormHidden('cat_id', $categoryObject->getVar('cat_id')));
101
+
102
+	$button_tray = new \XoopsFormElementTray('', '');
103
+	$button_tray->addElement(new \XoopsFormHidden('op', 'save'));
104
+
105
+	$butt_save = new \XoopsFormButton('', '', _SUBMIT, 'submit');
106
+	$butt_save->setExtra('onclick="this.form.elements.op.value=\'save\'"');
107
+	$button_tray->addElement($butt_save);
108
+	if ($categoryObject->getVar('cat_id')) {
109
+		$butt_delete = new \XoopsFormButton('', '', _CANCEL, 'submit');
110
+		$butt_delete->setExtra('onclick="this.form.elements.op.value=\'default\'"');
111
+		$button_tray->addElement($butt_delete);
112
+	}
113
+	$sform->addElement($button_tray);
114
+	$sform->display();
115 115
 }
116 116
 
117 117
 switch ($op) {
118
-    case 'mod':
119
-        $categoryObject = ($cat_id > 0) ? $categoryHandler->get($cat_id) : $categoryHandler->create();
120
-        //        if (!$newXoopsModuleGui) {
121
-        //            //loadModuleAdminMenu(1, ( $cat_id > 0) ? _AM_NEWBB_EDITCATEGORY . $categoryObject->getVar('cat_title') : _AM_NEWBB_CREATENEWCATEGORY);
122
-        //            echo "<legend style='font-weight: bold; color: #900;'>" . _AM_NEWBB_EDITCATEGORY . '</legend>';
123
-        //        } else {
124
-        $adminObject->displayNavigation(basename(__FILE__));
125
-        //        }
126
-        echo '<br>';
127
-        editCategory($categoryObject);
128
-        break;
129
-
130
-    case 'del':
131
-        if (!Request::getBool('confirm', '', 'POST')) {
132
-            xoops_confirm(['op' => 'del', 'cat_id' => Request::getInt('cat_id', 0, 'GET'), 'confirm' => 1], 'admin_cat_manager.php', _AM_NEWBB_WAYSYWTDTTAL);
133
-            break;
134
-        } else {
135
-            $categoryObject = $categoryHandler->create(false);
136
-            $categoryObject->setVar('cat_id', Request::getInt('cat_id', 0, 'POST'));
137
-            $categoryHandler->delete($categoryObject);
138
-
139
-            redirect_header('admin_cat_manager.php', 2, _AM_NEWBB_CATEGORYDELETED);
140
-        }
141
-        break;
142
-
143
-    case 'save':
144
-        $cacheHelper = new \Xmf\Module\Helper\Cache('newbb');
145
-        $cacheHelper->delete('permission_category');
146
-        if ($cat_id) {
147
-            $categoryObject = $categoryHandler->get($cat_id);
148
-            $message        = _AM_NEWBB_CATEGORYUPDATED;
149
-        } else {
150
-            $categoryObject = $categoryHandler->create();
151
-            $message        = _AM_NEWBB_CATEGORYCREATED;
152
-        }
153
-
154
-        $categoryObject->setVar('cat_title', Request::getString('title', '', 'POST'));
155
-        $categoryObject->setVar('cat_image', Request::getString('cat_image', '', 'POST'));
156
-        $categoryObject->setVar('cat_order', Request::getInt('cat_order', 0, 'POST'));
157
-        $categoryObject->setVar('cat_description', Request::getText('cat_description', '', 'POST'));
158
-        $categoryObject->setVar('cat_url', Request::getString('cat_url', '', 'POST'));
159
-
160
-        $cat_isNew = $categoryObject->isNew();
161
-        if (!$categoryHandler->insert($categoryObject)) {
162
-            $message = _AM_NEWBB_DATABASEERROR;
163
-        }
164
-        if (($cat_id = $categoryObject->getVar('cat_id')) && $cat_isNew) {
165
-            $categoryHandler->applyPermissionTemplate($categoryObject);
166
-        }
167
-        redirect_header('admin_cat_manager.php', 2, $message);
168
-        break;
169
-
170
-    default:
171
-        if (!$categories = $categoryHandler->getByPermission('all')) {
172
-            $adminObject->addItemButton(_AM_NEWBB_CREATENEWCATEGORY, 'admin_cat_manager.php?op=mod', $icon = 'add');
173
-            $adminObject->displayButton('left');
174
-
175
-            echo '<br>';
176
-            newCategory();
177
-            break;
178
-        }
179
-        $adminObject->displayNavigation(basename(__FILE__));
180
-        $adminObject->addItemButton(_AM_NEWBB_CREATENEWCATEGORY, 'admin_cat_manager.php?op=mod', $icon = 'add');
181
-        $adminObject->displayButton('left');
182
-
183
-        echo "<table width='100%' border='0' cellspacing='1' class='outer'>" . "<tr><td class='odd'>";
184
-        echo "<table border='0' cellpadding='4' cellspacing='1' width='100%' class='outer'>";
185
-        echo "<tr align='center'>";
186
-        echo "<th align='left' class='bg3'>" . _AM_NEWBB_CATEGORY1 . '</th>';
187
-        echo "<th class='bg3' width='10%'>" . _AM_NEWBB_EDIT . '</th>';
188
-        echo "<th class='bg3' width='10%'>" . _AM_NEWBB_DELETE . '</th>';
189
-        echo '</tr>';
190
-
191
-        foreach ($categories as $key => $onecat) {
192
-            $cat_edit_link  = '<a href="admin_cat_manager.php?op=mod&cat_id=' . $onecat->getVar('cat_id') . '">' . newbbDisplayImage('admin_edit', _EDIT) . '</a>';
193
-            $cat_del_link   = '<a href="admin_cat_manager.php?op=del&cat_id=' . $onecat->getVar('cat_id') . '">' . newbbDisplayImage('admin_delete', _DELETE) . '</a>';
194
-            $cat_title_link = '<a href="' . XOOPS_URL . '/modules/' . $xoopsModule->getVar('dirname') . '/index.php?cat=' . $onecat->getVar('cat_id') . '">' . $onecat->getVar('cat_title') . '</a>';
195
-
196
-            echo "<tr class='odd' align='left'>";
197
-            echo '<td>' . $cat_title_link . '</td>';
198
-            echo "<td align='center'>" . $cat_edit_link . '</td>';
199
-            echo "<td align='center'>" . $cat_del_link . '</td>';
200
-            echo '</tr>';
201
-        }
202
-        echo '</table>';
203
-        echo '</td></tr></table>';
204
-        echo '<fieldset>';
205
-        echo '<legend>&nbsp;' . _MI_NEWBB_ADMENU_CATEGORY . '&nbsp;</legend>';
206
-        echo _AM_NEWBB_HELP_CATEGORY_TAB;
207
-        echo '<br>' . newbbDisplayImage('admin_edit', _EDIT) . '&nbsp;-&nbsp;' . _EDIT;
208
-        echo '<br>' . newbbDisplayImage('admin_delete', _DELETE) . '&nbsp;-&nbsp;' . _DELETE;
209
-        echo '</fieldset>';
210
-        break;
118
+	case 'mod':
119
+		$categoryObject = ($cat_id > 0) ? $categoryHandler->get($cat_id) : $categoryHandler->create();
120
+		//        if (!$newXoopsModuleGui) {
121
+		//            //loadModuleAdminMenu(1, ( $cat_id > 0) ? _AM_NEWBB_EDITCATEGORY . $categoryObject->getVar('cat_title') : _AM_NEWBB_CREATENEWCATEGORY);
122
+		//            echo "<legend style='font-weight: bold; color: #900;'>" . _AM_NEWBB_EDITCATEGORY . '</legend>';
123
+		//        } else {
124
+		$adminObject->displayNavigation(basename(__FILE__));
125
+		//        }
126
+		echo '<br>';
127
+		editCategory($categoryObject);
128
+		break;
129
+
130
+	case 'del':
131
+		if (!Request::getBool('confirm', '', 'POST')) {
132
+			xoops_confirm(['op' => 'del', 'cat_id' => Request::getInt('cat_id', 0, 'GET'), 'confirm' => 1], 'admin_cat_manager.php', _AM_NEWBB_WAYSYWTDTTAL);
133
+			break;
134
+		} else {
135
+			$categoryObject = $categoryHandler->create(false);
136
+			$categoryObject->setVar('cat_id', Request::getInt('cat_id', 0, 'POST'));
137
+			$categoryHandler->delete($categoryObject);
138
+
139
+			redirect_header('admin_cat_manager.php', 2, _AM_NEWBB_CATEGORYDELETED);
140
+		}
141
+		break;
142
+
143
+	case 'save':
144
+		$cacheHelper = new \Xmf\Module\Helper\Cache('newbb');
145
+		$cacheHelper->delete('permission_category');
146
+		if ($cat_id) {
147
+			$categoryObject = $categoryHandler->get($cat_id);
148
+			$message        = _AM_NEWBB_CATEGORYUPDATED;
149
+		} else {
150
+			$categoryObject = $categoryHandler->create();
151
+			$message        = _AM_NEWBB_CATEGORYCREATED;
152
+		}
153
+
154
+		$categoryObject->setVar('cat_title', Request::getString('title', '', 'POST'));
155
+		$categoryObject->setVar('cat_image', Request::getString('cat_image', '', 'POST'));
156
+		$categoryObject->setVar('cat_order', Request::getInt('cat_order', 0, 'POST'));
157
+		$categoryObject->setVar('cat_description', Request::getText('cat_description', '', 'POST'));
158
+		$categoryObject->setVar('cat_url', Request::getString('cat_url', '', 'POST'));
159
+
160
+		$cat_isNew = $categoryObject->isNew();
161
+		if (!$categoryHandler->insert($categoryObject)) {
162
+			$message = _AM_NEWBB_DATABASEERROR;
163
+		}
164
+		if (($cat_id = $categoryObject->getVar('cat_id')) && $cat_isNew) {
165
+			$categoryHandler->applyPermissionTemplate($categoryObject);
166
+		}
167
+		redirect_header('admin_cat_manager.php', 2, $message);
168
+		break;
169
+
170
+	default:
171
+		if (!$categories = $categoryHandler->getByPermission('all')) {
172
+			$adminObject->addItemButton(_AM_NEWBB_CREATENEWCATEGORY, 'admin_cat_manager.php?op=mod', $icon = 'add');
173
+			$adminObject->displayButton('left');
174
+
175
+			echo '<br>';
176
+			newCategory();
177
+			break;
178
+		}
179
+		$adminObject->displayNavigation(basename(__FILE__));
180
+		$adminObject->addItemButton(_AM_NEWBB_CREATENEWCATEGORY, 'admin_cat_manager.php?op=mod', $icon = 'add');
181
+		$adminObject->displayButton('left');
182
+
183
+		echo "<table width='100%' border='0' cellspacing='1' class='outer'>" . "<tr><td class='odd'>";
184
+		echo "<table border='0' cellpadding='4' cellspacing='1' width='100%' class='outer'>";
185
+		echo "<tr align='center'>";
186
+		echo "<th align='left' class='bg3'>" . _AM_NEWBB_CATEGORY1 . '</th>';
187
+		echo "<th class='bg3' width='10%'>" . _AM_NEWBB_EDIT . '</th>';
188
+		echo "<th class='bg3' width='10%'>" . _AM_NEWBB_DELETE . '</th>';
189
+		echo '</tr>';
190
+
191
+		foreach ($categories as $key => $onecat) {
192
+			$cat_edit_link  = '<a href="admin_cat_manager.php?op=mod&cat_id=' . $onecat->getVar('cat_id') . '">' . newbbDisplayImage('admin_edit', _EDIT) . '</a>';
193
+			$cat_del_link   = '<a href="admin_cat_manager.php?op=del&cat_id=' . $onecat->getVar('cat_id') . '">' . newbbDisplayImage('admin_delete', _DELETE) . '</a>';
194
+			$cat_title_link = '<a href="' . XOOPS_URL . '/modules/' . $xoopsModule->getVar('dirname') . '/index.php?cat=' . $onecat->getVar('cat_id') . '">' . $onecat->getVar('cat_title') . '</a>';
195
+
196
+			echo "<tr class='odd' align='left'>";
197
+			echo '<td>' . $cat_title_link . '</td>';
198
+			echo "<td align='center'>" . $cat_edit_link . '</td>';
199
+			echo "<td align='center'>" . $cat_del_link . '</td>';
200
+			echo '</tr>';
201
+		}
202
+		echo '</table>';
203
+		echo '</td></tr></table>';
204
+		echo '<fieldset>';
205
+		echo '<legend>&nbsp;' . _MI_NEWBB_ADMENU_CATEGORY . '&nbsp;</legend>';
206
+		echo _AM_NEWBB_HELP_CATEGORY_TAB;
207
+		echo '<br>' . newbbDisplayImage('admin_edit', _EDIT) . '&nbsp;-&nbsp;' . _EDIT;
208
+		echo '<br>' . newbbDisplayImage('admin_delete', _DELETE) . '&nbsp;-&nbsp;' . _DELETE;
209
+		echo '</fieldset>';
210
+		break;
211 211
 }
212 212
 
213 213
 $cacheHelper = Newbb\Utility::cleanCache();
Please login to merge, or discard this patch.