Passed
Branch master (565d4a)
by Michael
15:11 queued 01:11
created
preloads/autoloader.php 2 patches
Indentation   +19 added lines, -19 removed lines patch added patch discarded remove patch
@@ -4,29 +4,29 @@
 block discarded – undo
4 4
  * @see http://www.php-fig.org/psr/psr-4/examples/
5 5
  */
6 6
 spl_autoload_register(function ($class) {
7
-    // project-specific namespace prefix
8
-    $prefix = 'XoopsModules\\' . ucfirst(basename(dirname(__DIR__)));
7
+	// project-specific namespace prefix
8
+	$prefix = 'XoopsModules\\' . ucfirst(basename(dirname(__DIR__)));
9 9
 
10
-    // base directory for the namespace prefix
11
-    $base_dir =  dirname(__DIR__) . '/class/';
10
+	// base directory for the namespace prefix
11
+	$base_dir =  dirname(__DIR__) . '/class/';
12 12
 
13
-    // does the class use the namespace prefix?
14
-    $len = strlen($prefix);
13
+	// does the class use the namespace prefix?
14
+	$len = strlen($prefix);
15 15
 
16
-    if (0 !== strncmp($prefix, $class, $len)) {
17
-        return;
18
-    }
16
+	if (0 !== strncmp($prefix, $class, $len)) {
17
+		return;
18
+	}
19 19
 
20
-    // get the relative class name
21
-    $relativeClass = substr($class, $len);
20
+	// get the relative class name
21
+	$relativeClass = substr($class, $len);
22 22
 
23
-    // replace the namespace prefix with the base directory, replace namespace
24
-    // separators with directory separators in the relative class name, append
25
-    // with .php
26
-    $file = $base_dir . str_replace('\\', '/', $relativeClass) . '.php';
23
+	// replace the namespace prefix with the base directory, replace namespace
24
+	// separators with directory separators in the relative class name, append
25
+	// with .php
26
+	$file = $base_dir . str_replace('\\', '/', $relativeClass) . '.php';
27 27
 
28
-    // if the file exists, require it
29
-    if (file_exists($file)) {
30
-        require_once $file;
31
-    }
28
+	// if the file exists, require it
29
+	if (file_exists($file)) {
30
+		require_once $file;
31
+	}
32 32
 });
Please login to merge, or discard this patch.
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -3,12 +3,12 @@  discard block
 block discarded – undo
3 3
 /**
4 4
  * @see http://www.php-fig.org/psr/psr-4/examples/
5 5
  */
6
-spl_autoload_register(function ($class) {
6
+spl_autoload_register(function($class) {
7 7
     // project-specific namespace prefix
8
-    $prefix = 'XoopsModules\\' . ucfirst(basename(dirname(__DIR__)));
8
+    $prefix = 'XoopsModules\\'.ucfirst(basename(dirname(__DIR__)));
9 9
 
10 10
     // base directory for the namespace prefix
11
-    $base_dir =  dirname(__DIR__) . '/class/';
11
+    $base_dir = dirname(__DIR__).'/class/';
12 12
 
13 13
     // does the class use the namespace prefix?
14 14
     $len = strlen($prefix);
@@ -23,7 +23,7 @@  discard block
 block discarded – undo
23 23
     // replace the namespace prefix with the base directory, replace namespace
24 24
     // separators with directory separators in the relative class name, append
25 25
     // with .php
26
-    $file = $base_dir . str_replace('\\', '/', $relativeClass) . '.php';
26
+    $file = $base_dir.str_replace('\\', '/', $relativeClass).'.php';
27 27
 
28 28
     // if the file exists, require it
29 29
     if (file_exists($file)) {
Please login to merge, or discard this patch.
preloads/core.php 2 patches
Indentation   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -22,12 +22,12 @@
 block discarded – undo
22 22
  */
23 23
 class NewbbCorePreload extends \XoopsPreloadItem
24 24
 {
25
-    // to add PSR-4 autoloader
26
-    /**
27
-     * @param $args
28
-     */
29
-    public static function eventCoreIncludeCommonEnd($args)
30
-    {
31
-        require_once __DIR__   . '/autoloader.php';
32
-    }
25
+	// to add PSR-4 autoloader
26
+	/**
27
+	 * @param $args
28
+	 */
29
+	public static function eventCoreIncludeCommonEnd($args)
30
+	{
31
+		require_once __DIR__   . '/autoloader.php';
32
+	}
33 33
 }
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -28,6 +28,6 @@
 block discarded – undo
28 28
      */
29 29
     public static function eventCoreIncludeCommonEnd($args)
30 30
     {
31
-        require_once __DIR__   . '/autoloader.php';
31
+        require_once __DIR__.'/autoloader.php';
32 32
     }
33 33
 }
Please login to merge, or discard this patch.
admin/admin_report.php 2 patches
Indentation   +133 added lines, -133 removed lines patch added patch discarded remove patch
@@ -47,146 +47,146 @@
 block discarded – undo
47 47
 xoops_cp_header();
48 48
 
49 49
 switch ($op) {
50
-    case 'save':
51
-        $report_ids = Request::getArray('report_id', '', 'POST');
52
-        //        $report_ids = Request::getInt('report_id', 0, 'POST'); //$_POST['report_id'];
53
-        // irmtfan add error redirect header
54
-        if (0 === count($report_ids)) {
55
-            redirect_header("admin_report.php?item={$item}" . (empty($start) ? '' : "&start={$start}"), 1, _AM_NEWBB_REPORTNOTSELECT);
56
-        }
57
-        $report_memos = Request::getArray('report_memo', [], 'POST'); // isset($_POST['report_memo']) ? $_POST['report_memo'] : array();
58
-        foreach ($report_ids as $rid => $value) {
59
-            if (!$value) {
60
-                continue;
61
-            }
62
-            $reportObject = $reportHandler->get($rid);
63
-            $reportObject->setVar('report_result', 1);
64
-            $reportObject->setVar('report_memo', $report_memos[$rid]);
65
-            $reportHandler->insert($reportObject);
66
-        }
67
-        // irmtfan add message
68
-        redirect_header("admin_report.php?item={$item}" . (empty($start) ? '' : "&start={$start}"), 1, _AM_NEWBB_REPORTSAVE);
69
-        break;
50
+	case 'save':
51
+		$report_ids = Request::getArray('report_id', '', 'POST');
52
+		//        $report_ids = Request::getInt('report_id', 0, 'POST'); //$_POST['report_id'];
53
+		// irmtfan add error redirect header
54
+		if (0 === count($report_ids)) {
55
+			redirect_header("admin_report.php?item={$item}" . (empty($start) ? '' : "&start={$start}"), 1, _AM_NEWBB_REPORTNOTSELECT);
56
+		}
57
+		$report_memos = Request::getArray('report_memo', [], 'POST'); // isset($_POST['report_memo']) ? $_POST['report_memo'] : array();
58
+		foreach ($report_ids as $rid => $value) {
59
+			if (!$value) {
60
+				continue;
61
+			}
62
+			$reportObject = $reportHandler->get($rid);
63
+			$reportObject->setVar('report_result', 1);
64
+			$reportObject->setVar('report_memo', $report_memos[$rid]);
65
+			$reportHandler->insert($reportObject);
66
+		}
67
+		// irmtfan add message
68
+		redirect_header("admin_report.php?item={$item}" . (empty($start) ? '' : "&start={$start}"), 1, _AM_NEWBB_REPORTSAVE);
69
+		break;
70 70
 
71
-    case 'delete':
72
-        $report_ids = Request::getArray('report_id', [], 'POST');// $_POST['report_id'];
73
-        // irmtfan add error redirect header
74
-        if (0 === count($report_ids)) {
75
-            redirect_header("admin_report.php?item={$item}" . (empty($start) ? '' : "&start={$start}"), 1, _AM_NEWBB_REPORTNOTSELECT);
76
-        }
77
-        foreach ($report_ids as $rid => $value) {
78
-            if (!$value) {
79
-                continue;
80
-            }
81
-            if ($reportObject = $reportHandler->get($rid)) {
82
-                $reportHandler->delete($reportObject);
83
-            }
84
-        }
85
-        // irmtfan add message
86
-        redirect_header("admin_report.php?item={$item}" . (empty($start) ? '' : "&start={$start}"), 1, _AM_NEWBB_REPORTDELETE);
87
-        break;
71
+	case 'delete':
72
+		$report_ids = Request::getArray('report_id', [], 'POST');// $_POST['report_id'];
73
+		// irmtfan add error redirect header
74
+		if (0 === count($report_ids)) {
75
+			redirect_header("admin_report.php?item={$item}" . (empty($start) ? '' : "&start={$start}"), 1, _AM_NEWBB_REPORTNOTSELECT);
76
+		}
77
+		foreach ($report_ids as $rid => $value) {
78
+			if (!$value) {
79
+				continue;
80
+			}
81
+			if ($reportObject = $reportHandler->get($rid)) {
82
+				$reportHandler->delete($reportObject);
83
+			}
84
+		}
85
+		// irmtfan add message
86
+		redirect_header("admin_report.php?item={$item}" . (empty($start) ? '' : "&start={$start}"), 1, _AM_NEWBB_REPORTDELETE);
87
+		break;
88 88
 
89
-    case 'default':
90
-    default:
91
-        require_once $GLOBALS['xoops']->path('class/xoopsformloader.php');
92
-        require_once  dirname(__DIR__) . '/include/functions.user.php';
89
+	case 'default':
90
+	default:
91
+		require_once $GLOBALS['xoops']->path('class/xoopsformloader.php');
92
+		require_once  dirname(__DIR__) . '/include/functions.user.php';
93 93
 
94
-        if ('processed' !== $item) {
95
-            $process_result = 0;
96
-            $item_other     = 'admin_report.php?item=processed';
97
-            $title_other    = _AM_NEWBB_PROCESSEDREPORT;
98
-            $extra          = _AM_NEWBB_REPORTEXTRA;
99
-        } else {
100
-            $process_result = 1;
101
-            $item_other     = 'admin_report.php?item=process';
102
-            $title_other    = _AM_NEWBB_PROCESSREPORT;
103
-            $extra          = _DELETE;
104
-        }
94
+		if ('processed' !== $item) {
95
+			$process_result = 0;
96
+			$item_other     = 'admin_report.php?item=processed';
97
+			$title_other    = _AM_NEWBB_PROCESSEDREPORT;
98
+			$extra          = _AM_NEWBB_REPORTEXTRA;
99
+		} else {
100
+			$process_result = 1;
101
+			$item_other     = 'admin_report.php?item=process';
102
+			$title_other    = _AM_NEWBB_PROCESSREPORT;
103
+			$extra          = _DELETE;
104
+		}
105 105
 
106
-        $limit = 10;
106
+		$limit = 10;
107 107
 
108
-        $adminObject->displayNavigation(basename(__FILE__));
108
+		$adminObject->displayNavigation(basename(__FILE__));
109 109
 
110
-        //if (!$newXoopsModuleGui) loadModuleAdminMenu(6,_AM_NEWBB_REPORTADMIN);
111
-        //    else $adminObject->displayNavigation(basename(__FILE__));
112
-        $adminObject->addItemButton($title_other, $item_other, $icon = 'add');
113
-        $adminObject->displayButton('left');
114
-        echo _AM_NEWBB_REPORTADMIN_HELP;
115
-        echo "<table width='100%' border='0' cellspacing='1' class='outer'>" . "<tr><td class='odd'>";
116
-        echo '<form action="' . xoops_getenv('PHP_SELF') . '" method="post">';
117
-        echo "<table border='0' cellpadding='4' cellspacing='1' width='100%' class='outer'>";
118
-        echo "<tr align='center'>";
119
-        echo "<th class='bg3' width='80%'>" . _AM_NEWBB_REPORTTITLE . '</th>';
120
-        echo "<th class='bg3' width='10%'>" . $extra . '</th>';
121
-        echo '</tr>';
110
+		//if (!$newXoopsModuleGui) loadModuleAdminMenu(6,_AM_NEWBB_REPORTADMIN);
111
+		//    else $adminObject->displayNavigation(basename(__FILE__));
112
+		$adminObject->addItemButton($title_other, $item_other, $icon = 'add');
113
+		$adminObject->displayButton('left');
114
+		echo _AM_NEWBB_REPORTADMIN_HELP;
115
+		echo "<table width='100%' border='0' cellspacing='1' class='outer'>" . "<tr><td class='odd'>";
116
+		echo '<form action="' . xoops_getenv('PHP_SELF') . '" method="post">';
117
+		echo "<table border='0' cellpadding='4' cellspacing='1' width='100%' class='outer'>";
118
+		echo "<tr align='center'>";
119
+		echo "<th class='bg3' width='80%'>" . _AM_NEWBB_REPORTTITLE . '</th>';
120
+		echo "<th class='bg3' width='10%'>" . $extra . '</th>';
121
+		echo '</tr>';
122 122
 
123
-        $reports = $reportHandler->getAllReports('report_id', 'ASC', $limit, $start, $process_result);
124
-        foreach ($reports as $report) {
125
-            $post_link = '<a href="'
126
-                         . XOOPS_URL
127
-                         . '/modules/'
128
-                         . $xoopsModule->getVar('dirname')
129
-                         . '/viewtopic.php?post_id='
130
-                         . $report['post_id']
131
-                         . '&amp;topic_id='
132
-                         . $report['topic_id']
133
-                         . '&amp;forum='
134
-                         . $report['forum_id']
135
-                         . '&amp;viewmode=thread" target="checkreport">'
136
-                         . $myts->htmlSpecialChars($report['subject'])
137
-                         . '</a>';
138
-            $checkbox  = '<input type="checkbox" name="report_id[' . $report['report_id'] . ']" value="1" checked />';
139
-            if ('processed' !== $item) {
140
-                $memo = '<input type="text" name="report_memo[' . $report['report_id'] . ']" maxlength="255" size="80" />';
141
-            } else {
142
-                $memo = $myts->htmlSpecialChars($report['report_memo']);
143
-            }
144
-            echo "<tr class='odd' align='left'>";
145
-            echo '<td>' . _AM_NEWBB_REPORTPOST . ': ' . $post_link . '</td>';
146
-            echo "<td align='center'>" . $report['report_id'] . '</td>';
147
-            echo '</tr>';
148
-            echo "<tr class='odd' align='left'>";
149
-            echo '<td>' . _AM_NEWBB_REPORTTEXT . ': ' . $myts->htmlSpecialChars($report['report_text']) . '</td>';
150
-            $uid           = (int)$report['reporter_uid'];
151
-            $reporter_name = newbbGetUnameFromId($uid, $GLOBALS['xoopsModuleConfig']['show_realname']);
152
-            $reporter      = !empty($uid) ? "<a href='" . XOOPS_URL . '/userinfo.php?uid=' . $uid . "'>" . $reporter_name . '</a><br>' : '';
153
-            echo "<td align='center'>" . $reporter . $report['reporter_ip'] . '</td>';
154
-            echo '</tr>';
155
-            echo "<tr class='odd' align='left'>";
156
-            echo '<td>' . _AM_NEWBB_REPORTMEMO . ': ' . $memo . '</td>';
157
-            echo "<td align='center' >" . $checkbox . '</td>';
158
-            echo '</tr>';
159
-            echo "<tr colspan='2'><td height='2'></td></tr>";
160
-        }
161
-        $buttons = '';
162
-        if ('processed' !== $item) {
163
-            $submit  = new \XoopsFormButton('', 'submit', _SUBMIT, 'submit');
164
-            $buttons .= $submit->render() . ' ';
165
-        }
166
-        $delete  = new \XoopsFormButton('', 'delete', _DELETE, 'submit');
167
-        $buttons .= $delete->render() . ' ';
168
-        $cancel  = new \XoopsFormButton('', 'cancel', _CANCEL, 'reset');
169
-        $buttons .= $cancel->render();
170
-        echo "<tr colspan='2'><td align='center'>{$buttons}</td></tr>";
171
-        $hidden = new \XoopsFormHidden('start', $start);
172
-        echo $hidden->render();
173
-        $hidden = new \XoopsFormHidden('item', $item);
174
-        echo $hidden->render() . '</form>';
123
+		$reports = $reportHandler->getAllReports('report_id', 'ASC', $limit, $start, $process_result);
124
+		foreach ($reports as $report) {
125
+			$post_link = '<a href="'
126
+						 . XOOPS_URL
127
+						 . '/modules/'
128
+						 . $xoopsModule->getVar('dirname')
129
+						 . '/viewtopic.php?post_id='
130
+						 . $report['post_id']
131
+						 . '&amp;topic_id='
132
+						 . $report['topic_id']
133
+						 . '&amp;forum='
134
+						 . $report['forum_id']
135
+						 . '&amp;viewmode=thread" target="checkreport">'
136
+						 . $myts->htmlSpecialChars($report['subject'])
137
+						 . '</a>';
138
+			$checkbox  = '<input type="checkbox" name="report_id[' . $report['report_id'] . ']" value="1" checked />';
139
+			if ('processed' !== $item) {
140
+				$memo = '<input type="text" name="report_memo[' . $report['report_id'] . ']" maxlength="255" size="80" />';
141
+			} else {
142
+				$memo = $myts->htmlSpecialChars($report['report_memo']);
143
+			}
144
+			echo "<tr class='odd' align='left'>";
145
+			echo '<td>' . _AM_NEWBB_REPORTPOST . ': ' . $post_link . '</td>';
146
+			echo "<td align='center'>" . $report['report_id'] . '</td>';
147
+			echo '</tr>';
148
+			echo "<tr class='odd' align='left'>";
149
+			echo '<td>' . _AM_NEWBB_REPORTTEXT . ': ' . $myts->htmlSpecialChars($report['report_text']) . '</td>';
150
+			$uid           = (int)$report['reporter_uid'];
151
+			$reporter_name = newbbGetUnameFromId($uid, $GLOBALS['xoopsModuleConfig']['show_realname']);
152
+			$reporter      = !empty($uid) ? "<a href='" . XOOPS_URL . '/userinfo.php?uid=' . $uid . "'>" . $reporter_name . '</a><br>' : '';
153
+			echo "<td align='center'>" . $reporter . $report['reporter_ip'] . '</td>';
154
+			echo '</tr>';
155
+			echo "<tr class='odd' align='left'>";
156
+			echo '<td>' . _AM_NEWBB_REPORTMEMO . ': ' . $memo . '</td>';
157
+			echo "<td align='center' >" . $checkbox . '</td>';
158
+			echo '</tr>';
159
+			echo "<tr colspan='2'><td height='2'></td></tr>";
160
+		}
161
+		$buttons = '';
162
+		if ('processed' !== $item) {
163
+			$submit  = new \XoopsFormButton('', 'submit', _SUBMIT, 'submit');
164
+			$buttons .= $submit->render() . ' ';
165
+		}
166
+		$delete  = new \XoopsFormButton('', 'delete', _DELETE, 'submit');
167
+		$buttons .= $delete->render() . ' ';
168
+		$cancel  = new \XoopsFormButton('', 'cancel', _CANCEL, 'reset');
169
+		$buttons .= $cancel->render();
170
+		echo "<tr colspan='2'><td align='center'>{$buttons}</td></tr>";
171
+		$hidden = new \XoopsFormHidden('start', $start);
172
+		echo $hidden->render();
173
+		$hidden = new \XoopsFormHidden('item', $item);
174
+		echo $hidden->render() . '</form>';
175 175
 
176
-        echo '</table>';
177
-        echo '</td></tr></table>';
178
-        $nav = new \XoopsPageNav(
179
-            $reportHandler->getCount(new \Criteria('report_result', $process_result)),
180
-            $limit,
181
-            $start,
182
-            'start',
183
-            'item=' . $item
184
-        );
185
-        echo $nav->renderNav(4);
186
-        echo '<fieldset>';
187
-        echo '<legend>&nbsp;' . _MI_NEWBB_ADMENU_REPORT . '&nbsp;</legend>';
188
-        echo _AM_NEWBB_HELP_REPORT_TAB;
189
-        echo '</fieldset>';
190
-        break;
176
+		echo '</table>';
177
+		echo '</td></tr></table>';
178
+		$nav = new \XoopsPageNav(
179
+			$reportHandler->getCount(new \Criteria('report_result', $process_result)),
180
+			$limit,
181
+			$start,
182
+			'start',
183
+			'item=' . $item
184
+		);
185
+		echo $nav->renderNav(4);
186
+		echo '<fieldset>';
187
+		echo '<legend>&nbsp;' . _MI_NEWBB_ADMENU_REPORT . '&nbsp;</legend>';
188
+		echo _AM_NEWBB_HELP_REPORT_TAB;
189
+		echo '</fieldset>';
190
+		break;
191 191
 }
192 192
 require_once __DIR__ . '/admin_footer.php';
Please login to merge, or discard this patch.
Spacing   +27 added lines, -27 removed lines patch added patch discarded remove patch
@@ -31,7 +31,7 @@  discard block
 block discarded – undo
31 31
 
32 32
 use Xmf\Request;
33 33
 
34
-require_once __DIR__ . '/admin_header.php';
34
+require_once __DIR__.'/admin_header.php';
35 35
 require_once $GLOBALS['xoops']->path('class/pagenav.php');
36 36
 
37 37
 $op    = Request::getCmd('op', 'default');
@@ -52,7 +52,7 @@  discard block
 block discarded – undo
52 52
         //        $report_ids = Request::getInt('report_id', 0, 'POST'); //$_POST['report_id'];
53 53
         // irmtfan add error redirect header
54 54
         if (0 === count($report_ids)) {
55
-            redirect_header("admin_report.php?item={$item}" . (empty($start) ? '' : "&start={$start}"), 1, _AM_NEWBB_REPORTNOTSELECT);
55
+            redirect_header("admin_report.php?item={$item}".(empty($start) ? '' : "&start={$start}"), 1, _AM_NEWBB_REPORTNOTSELECT);
56 56
         }
57 57
         $report_memos = Request::getArray('report_memo', [], 'POST'); // isset($_POST['report_memo']) ? $_POST['report_memo'] : array();
58 58
         foreach ($report_ids as $rid => $value) {
@@ -65,14 +65,14 @@  discard block
 block discarded – undo
65 65
             $reportHandler->insert($reportObject);
66 66
         }
67 67
         // irmtfan add message
68
-        redirect_header("admin_report.php?item={$item}" . (empty($start) ? '' : "&start={$start}"), 1, _AM_NEWBB_REPORTSAVE);
68
+        redirect_header("admin_report.php?item={$item}".(empty($start) ? '' : "&start={$start}"), 1, _AM_NEWBB_REPORTSAVE);
69 69
         break;
70 70
 
71 71
     case 'delete':
72
-        $report_ids = Request::getArray('report_id', [], 'POST');// $_POST['report_id'];
72
+        $report_ids = Request::getArray('report_id', [], 'POST'); // $_POST['report_id'];
73 73
         // irmtfan add error redirect header
74 74
         if (0 === count($report_ids)) {
75
-            redirect_header("admin_report.php?item={$item}" . (empty($start) ? '' : "&start={$start}"), 1, _AM_NEWBB_REPORTNOTSELECT);
75
+            redirect_header("admin_report.php?item={$item}".(empty($start) ? '' : "&start={$start}"), 1, _AM_NEWBB_REPORTNOTSELECT);
76 76
         }
77 77
         foreach ($report_ids as $rid => $value) {
78 78
             if (!$value) {
@@ -83,13 +83,13 @@  discard block
 block discarded – undo
83 83
             }
84 84
         }
85 85
         // irmtfan add message
86
-        redirect_header("admin_report.php?item={$item}" . (empty($start) ? '' : "&start={$start}"), 1, _AM_NEWBB_REPORTDELETE);
86
+        redirect_header("admin_report.php?item={$item}".(empty($start) ? '' : "&start={$start}"), 1, _AM_NEWBB_REPORTDELETE);
87 87
         break;
88 88
 
89 89
     case 'default':
90 90
     default:
91 91
         require_once $GLOBALS['xoops']->path('class/xoopsformloader.php');
92
-        require_once  dirname(__DIR__) . '/include/functions.user.php';
92
+        require_once  dirname(__DIR__).'/include/functions.user.php';
93 93
 
94 94
         if ('processed' !== $item) {
95 95
             $process_result = 0;
@@ -112,12 +112,12 @@  discard block
 block discarded – undo
112 112
         $adminObject->addItemButton($title_other, $item_other, $icon = 'add');
113 113
         $adminObject->displayButton('left');
114 114
         echo _AM_NEWBB_REPORTADMIN_HELP;
115
-        echo "<table width='100%' border='0' cellspacing='1' class='outer'>" . "<tr><td class='odd'>";
116
-        echo '<form action="' . xoops_getenv('PHP_SELF') . '" method="post">';
115
+        echo "<table width='100%' border='0' cellspacing='1' class='outer'>"."<tr><td class='odd'>";
116
+        echo '<form action="'.xoops_getenv('PHP_SELF').'" method="post">';
117 117
         echo "<table border='0' cellpadding='4' cellspacing='1' width='100%' class='outer'>";
118 118
         echo "<tr align='center'>";
119
-        echo "<th class='bg3' width='80%'>" . _AM_NEWBB_REPORTTITLE . '</th>';
120
-        echo "<th class='bg3' width='10%'>" . $extra . '</th>';
119
+        echo "<th class='bg3' width='80%'>"._AM_NEWBB_REPORTTITLE.'</th>';
120
+        echo "<th class='bg3' width='10%'>".$extra.'</th>';
121 121
         echo '</tr>';
122 122
 
123 123
         $reports = $reportHandler->getAllReports('report_id', 'ASC', $limit, $start, $process_result);
@@ -135,43 +135,43 @@  discard block
 block discarded – undo
135 135
                          . '&amp;viewmode=thread" target="checkreport">'
136 136
                          . $myts->htmlSpecialChars($report['subject'])
137 137
                          . '</a>';
138
-            $checkbox  = '<input type="checkbox" name="report_id[' . $report['report_id'] . ']" value="1" checked />';
138
+            $checkbox = '<input type="checkbox" name="report_id['.$report['report_id'].']" value="1" checked />';
139 139
             if ('processed' !== $item) {
140
-                $memo = '<input type="text" name="report_memo[' . $report['report_id'] . ']" maxlength="255" size="80" />';
140
+                $memo = '<input type="text" name="report_memo['.$report['report_id'].']" maxlength="255" size="80" />';
141 141
             } else {
142 142
                 $memo = $myts->htmlSpecialChars($report['report_memo']);
143 143
             }
144 144
             echo "<tr class='odd' align='left'>";
145
-            echo '<td>' . _AM_NEWBB_REPORTPOST . ': ' . $post_link . '</td>';
146
-            echo "<td align='center'>" . $report['report_id'] . '</td>';
145
+            echo '<td>'._AM_NEWBB_REPORTPOST.': '.$post_link.'</td>';
146
+            echo "<td align='center'>".$report['report_id'].'</td>';
147 147
             echo '</tr>';
148 148
             echo "<tr class='odd' align='left'>";
149
-            echo '<td>' . _AM_NEWBB_REPORTTEXT . ': ' . $myts->htmlSpecialChars($report['report_text']) . '</td>';
149
+            echo '<td>'._AM_NEWBB_REPORTTEXT.': '.$myts->htmlSpecialChars($report['report_text']).'</td>';
150 150
             $uid           = (int)$report['reporter_uid'];
151 151
             $reporter_name = newbbGetUnameFromId($uid, $GLOBALS['xoopsModuleConfig']['show_realname']);
152
-            $reporter      = !empty($uid) ? "<a href='" . XOOPS_URL . '/userinfo.php?uid=' . $uid . "'>" . $reporter_name . '</a><br>' : '';
153
-            echo "<td align='center'>" . $reporter . $report['reporter_ip'] . '</td>';
152
+            $reporter      = !empty($uid) ? "<a href='".XOOPS_URL.'/userinfo.php?uid='.$uid."'>".$reporter_name.'</a><br>' : '';
153
+            echo "<td align='center'>".$reporter.$report['reporter_ip'].'</td>';
154 154
             echo '</tr>';
155 155
             echo "<tr class='odd' align='left'>";
156
-            echo '<td>' . _AM_NEWBB_REPORTMEMO . ': ' . $memo . '</td>';
157
-            echo "<td align='center' >" . $checkbox . '</td>';
156
+            echo '<td>'._AM_NEWBB_REPORTMEMO.': '.$memo.'</td>';
157
+            echo "<td align='center' >".$checkbox.'</td>';
158 158
             echo '</tr>';
159 159
             echo "<tr colspan='2'><td height='2'></td></tr>";
160 160
         }
161 161
         $buttons = '';
162 162
         if ('processed' !== $item) {
163
-            $submit  = new \XoopsFormButton('', 'submit', _SUBMIT, 'submit');
164
-            $buttons .= $submit->render() . ' ';
163
+            $submit = new \XoopsFormButton('', 'submit', _SUBMIT, 'submit');
164
+            $buttons .= $submit->render().' ';
165 165
         }
166 166
         $delete  = new \XoopsFormButton('', 'delete', _DELETE, 'submit');
167
-        $buttons .= $delete->render() . ' ';
167
+        $buttons .= $delete->render().' ';
168 168
         $cancel  = new \XoopsFormButton('', 'cancel', _CANCEL, 'reset');
169 169
         $buttons .= $cancel->render();
170 170
         echo "<tr colspan='2'><td align='center'>{$buttons}</td></tr>";
171 171
         $hidden = new \XoopsFormHidden('start', $start);
172 172
         echo $hidden->render();
173 173
         $hidden = new \XoopsFormHidden('item', $item);
174
-        echo $hidden->render() . '</form>';
174
+        echo $hidden->render().'</form>';
175 175
 
176 176
         echo '</table>';
177 177
         echo '</td></tr></table>';
@@ -180,13 +180,13 @@  discard block
 block discarded – undo
180 180
             $limit,
181 181
             $start,
182 182
             'start',
183
-            'item=' . $item
183
+            'item='.$item
184 184
         );
185 185
         echo $nav->renderNav(4);
186 186
         echo '<fieldset>';
187
-        echo '<legend>&nbsp;' . _MI_NEWBB_ADMENU_REPORT . '&nbsp;</legend>';
187
+        echo '<legend>&nbsp;'._MI_NEWBB_ADMENU_REPORT.'&nbsp;</legend>';
188 188
         echo _AM_NEWBB_HELP_REPORT_TAB;
189 189
         echo '</fieldset>';
190 190
         break;
191 191
 }
192
-require_once __DIR__ . '/admin_footer.php';
192
+require_once __DIR__.'/admin_footer.php';
Please login to merge, or discard this patch.
admin/index.php 2 patches
Indentation   +61 added lines, -61 removed lines patch added patch discarded remove patch
@@ -49,10 +49,10 @@  discard block
 block discarded – undo
49 49
  */
50 50
 function newbb_admin_mkdir($target, $mode = 0777)
51 51
 {
52
-    $target = str_replace('..', '', $target);
52
+	$target = str_replace('..', '', $target);
53 53
 
54
-    // http://www.php.net/manual/en/function.mkdir.php
55
-    return is_dir($target) || (newbb_admin_mkdir(dirname($target), $mode) && mkdir($target, $mode));
54
+	// http://www.php.net/manual/en/function.mkdir.php
55
+	return is_dir($target) || (newbb_admin_mkdir(dirname($target), $mode) && mkdir($target, $mode));
56 56
 }
57 57
 
58 58
 /**
@@ -62,9 +62,9 @@  discard block
 block discarded – undo
62 62
  */
63 63
 function newbb_admin_chmod($target, $mode = 0777)
64 64
 {
65
-    $target = str_replace('..', '', $target);
65
+	$target = str_replace('..', '', $target);
66 66
 
67
-    return @chmod($target, $mode);
67
+	return @chmod($target, $mode);
68 68
 }
69 69
 
70 70
 /**
@@ -72,32 +72,32 @@  discard block
 block discarded – undo
72 72
  */
73 73
 function newbb_getImageLibs()
74 74
 {
75
-    $imageLibs = [];
76
-    unset($output, $status);
77
-    if (1 == $GLOBALS['xoopsModuleConfig']['image_lib'] || 0 == $GLOBALS['xoopsModuleConfig']['image_lib']) {
78
-        $path = empty($GLOBALS['xoopsModuleConfig']['path_magick']) ? '' : $GLOBALS['xoopsModuleConfig']['path_magick'] . '/';
79
-        @exec($path . 'convert -version', $output, $status);
80
-        if (empty($status) && !empty($output) && preg_match("/imagemagick[ \t]+([0-9\.]+)/i", $output[0], $matches)) {
81
-            $imageLibs['imagemagick'] = $matches[0];
82
-        }
83
-
84
-        unset($output, $status);
85
-    }
86
-    if (2 == $GLOBALS['xoopsModuleConfig']['image_lib'] || 0 == $GLOBALS['xoopsModuleConfig']['image_lib']) {
87
-        $path = empty($GLOBALS['xoopsModuleConfig']['path_netpbm']) ? '' : $GLOBALS['xoopsModuleConfig']['path_netpbm'] . '/';
88
-        @exec($path . 'jpegtopnm -version 2>&1', $output, $status);
89
-        if (empty($status) && !empty($output) && preg_match("/netpbm[ \t]+([0-9\.]+)/i", $output[0], $matches)) {
90
-            $imageLibs['netpbm'] = $matches[0];
91
-        }
92
-        unset($output, $status);
93
-    }
94
-
95
-    if (function_exists('gd_info')) {
96
-        $tmpInfo         = gd_info();
97
-        $imageLibs['gd'] = $tmpInfo['GD Version'];
98
-    }
99
-
100
-    return $imageLibs;
75
+	$imageLibs = [];
76
+	unset($output, $status);
77
+	if (1 == $GLOBALS['xoopsModuleConfig']['image_lib'] || 0 == $GLOBALS['xoopsModuleConfig']['image_lib']) {
78
+		$path = empty($GLOBALS['xoopsModuleConfig']['path_magick']) ? '' : $GLOBALS['xoopsModuleConfig']['path_magick'] . '/';
79
+		@exec($path . 'convert -version', $output, $status);
80
+		if (empty($status) && !empty($output) && preg_match("/imagemagick[ \t]+([0-9\.]+)/i", $output[0], $matches)) {
81
+			$imageLibs['imagemagick'] = $matches[0];
82
+		}
83
+
84
+		unset($output, $status);
85
+	}
86
+	if (2 == $GLOBALS['xoopsModuleConfig']['image_lib'] || 0 == $GLOBALS['xoopsModuleConfig']['image_lib']) {
87
+		$path = empty($GLOBALS['xoopsModuleConfig']['path_netpbm']) ? '' : $GLOBALS['xoopsModuleConfig']['path_netpbm'] . '/';
88
+		@exec($path . 'jpegtopnm -version 2>&1', $output, $status);
89
+		if (empty($status) && !empty($output) && preg_match("/netpbm[ \t]+([0-9\.]+)/i", $output[0], $matches)) {
90
+			$imageLibs['netpbm'] = $matches[0];
91
+		}
92
+		unset($output, $status);
93
+	}
94
+
95
+	if (function_exists('gd_info')) {
96
+		$tmpInfo         = gd_info();
97
+		$imageLibs['gd'] = $tmpInfo['GD Version'];
98
+	}
99
+
100
+	return $imageLibs;
101 101
 }
102 102
 
103 103
 xoops_cp_header();
@@ -113,7 +113,7 @@  discard block
 block discarded – undo
113 113
 //XOOPS_POLL
114 114
 $xoopspoll = $moduleHandler->getByDirname($GLOBALS['xoopsModuleConfig']['poll_module']);
115 115
 if (is_object($xoopspoll)) {
116
-    $isOK = $xoopspoll->getVar('isactive');
116
+	$isOK = $xoopspoll->getVar('isactive');
117 117
 }
118 118
 // END irmtfan add a poll_module config
119 119
 
@@ -121,19 +121,19 @@  discard block
 block discarded – undo
121 121
 $postmaxsize_iniphp = return_bytes(@ini_get('post_max_size'));
122 122
 $uploadlimit        = _AM_NEWBB_MEMLIMITTOLARGE;
123 123
 if ($postmaxsize_iniphp < $memlimit_iniphp) {
124
-    $uploadlimit = sprintf(_AM_NEWBB_MEMLIMITOK, return_bytes($postmaxsize_iniphp, true));
124
+	$uploadlimit = sprintf(_AM_NEWBB_MEMLIMITOK, return_bytes($postmaxsize_iniphp, true));
125 125
 }
126 126
 
127 127
 $adminObject->addInfoBox(_AM_NEWBB_PREFERENCES);
128 128
 // START irmtfan better poll module display link and version - check if xoops poll module is available
129 129
 if ($isOK) {
130
-    $pollLink = _AM_NEWBB_AVAILABLE . ': ';
131
-    $pollLink .= '<a href="' . XOOPS_URL . '/modules/' . $xoopspoll->getVar('dirname') . '/admin/index.php"';
132
-    $pollLink .= ' alt="' . $xoopspoll->getVar('name') . ' ' . _VERSION . ' (' . $xoopspoll->getInfo('version') . ') "';
133
-    $pollLink .= ' title="' . $xoopspoll->getVar('name') . ' ' . _VERSION . ' (' . $xoopspoll->getInfo('version') . ') "';
134
-    $pollLink .= '>' . '(' . $xoopspoll->getVar('name') . ')</a>';
130
+	$pollLink = _AM_NEWBB_AVAILABLE . ': ';
131
+	$pollLink .= '<a href="' . XOOPS_URL . '/modules/' . $xoopspoll->getVar('dirname') . '/admin/index.php"';
132
+	$pollLink .= ' alt="' . $xoopspoll->getVar('name') . ' ' . _VERSION . ' (' . $xoopspoll->getInfo('version') . ') "';
133
+	$pollLink .= ' title="' . $xoopspoll->getVar('name') . ' ' . _VERSION . ' (' . $xoopspoll->getInfo('version') . ') "';
134
+	$pollLink .= '>' . '(' . $xoopspoll->getVar('name') . ')</a>';
135 135
 } else {
136
-    $pollLink = _AM_NEWBB_NOTAVAILABLE;
136
+	$pollLink = _AM_NEWBB_NOTAVAILABLE;
137 137
 }
138 138
 $adminObject->addInfoBoxLine(sprintf(_AM_NEWBB_POLLMODULE . ': %s', $pollLink));
139 139
 // END irmtfan better poll module display link and version - check if xoops poll module is available
@@ -153,8 +153,8 @@  discard block
 block discarded – undo
153 153
 $adminObject->addInfoBoxLine(sprintf(_AM_NEWBB_REPORT_PROCESSED . ': %s', $reportHandler->getCount(new \Criteria('report_result', 1))));
154 154
 
155 155
 foreach (array_keys($GLOBALS['uploadFolders']) as $i) {
156
-    Newbb\Utility::prepareFolder($uploadFolders[$i]);
157
-    $adminObject->addConfigBoxLine($uploadFolders[$i], 'folder');
156
+	Newbb\Utility::prepareFolder($uploadFolders[$i]);
157
+	$adminObject->addConfigBoxLine($uploadFolders[$i], 'folder');
158 158
 }
159 159
 
160 160
 $adminObject->displayNavigation(basename(__FILE__));
@@ -174,24 +174,24 @@  discard block
 block discarded – undo
174 174
  */
175 175
 function return_bytes($sizeAsString, $b = false)
176 176
 {
177
-    if (false === $b) {
178
-        switch (substr($sizeAsString, -1)) {
179
-            case 'M':
180
-            case 'm':
181
-                return (int)$sizeAsString * 1048576;
182
-            case 'K':
183
-            case 'k':
184
-                return (int)$sizeAsString * 1024;
185
-            case 'G':
186
-            case 'g':
187
-                return (int)$sizeAsString * 1073741824;
188
-            default:
189
-                return $sizeAsString;
190
-        }
191
-    } else {
192
-        $base   = log($sizeAsString) / log(1024);
193
-        $suffix = ['', 'KB', 'MB', 'GB', 'TB'];
194
-
195
-        return round(1024 ** ($base - floor($base))) . ' ' . $suffix[(int)floor($base)];
196
-    }
177
+	if (false === $b) {
178
+		switch (substr($sizeAsString, -1)) {
179
+			case 'M':
180
+			case 'm':
181
+				return (int)$sizeAsString * 1048576;
182
+			case 'K':
183
+			case 'k':
184
+				return (int)$sizeAsString * 1024;
185
+			case 'G':
186
+			case 'g':
187
+				return (int)$sizeAsString * 1073741824;
188
+			default:
189
+				return $sizeAsString;
190
+		}
191
+	} else {
192
+		$base   = log($sizeAsString) / log(1024);
193
+		$suffix = ['', 'KB', 'MB', 'GB', 'TB'];
194
+
195
+		return round(1024 ** ($base - floor($base))) . ' ' . $suffix[(int)floor($base)];
196
+	}
197 197
 }
Please login to merge, or discard this patch.
Spacing   +26 added lines, -26 removed lines patch added patch discarded remove patch
@@ -31,12 +31,12 @@  discard block
 block discarded – undo
31 31
 
32 32
 use XoopsModules\Newbb;
33 33
 
34
-require_once __DIR__ . '/admin_header.php';
34
+require_once __DIR__.'/admin_header.php';
35 35
 //require_once  dirname(__DIR__) . '/class/Utility.php';
36
-require_once  dirname(__DIR__) . '/include/functions.stats.php';
36
+require_once  dirname(__DIR__).'/include/functions.stats.php';
37 37
 
38
-$attach_path = $GLOBALS['xoops']->path($GLOBALS['xoopsModuleConfig']['dir_attachments'] . '/');
39
-$thumb_path  = $attach_path . 'thumbs/';
38
+$attach_path = $GLOBALS['xoops']->path($GLOBALS['xoopsModuleConfig']['dir_attachments'].'/');
39
+$thumb_path  = $attach_path.'thumbs/';
40 40
 $folder      = [$attach_path, $thumb_path];
41 41
 
42 42
 /** @var Xmf\Module\Admin $adminObject */
@@ -75,8 +75,8 @@  discard block
 block discarded – undo
75 75
     $imageLibs = [];
76 76
     unset($output, $status);
77 77
     if (1 == $GLOBALS['xoopsModuleConfig']['image_lib'] || 0 == $GLOBALS['xoopsModuleConfig']['image_lib']) {
78
-        $path = empty($GLOBALS['xoopsModuleConfig']['path_magick']) ? '' : $GLOBALS['xoopsModuleConfig']['path_magick'] . '/';
79
-        @exec($path . 'convert -version', $output, $status);
78
+        $path = empty($GLOBALS['xoopsModuleConfig']['path_magick']) ? '' : $GLOBALS['xoopsModuleConfig']['path_magick'].'/';
79
+        @exec($path.'convert -version', $output, $status);
80 80
         if (empty($status) && !empty($output) && preg_match("/imagemagick[ \t]+([0-9\.]+)/i", $output[0], $matches)) {
81 81
             $imageLibs['imagemagick'] = $matches[0];
82 82
         }
@@ -84,8 +84,8 @@  discard block
 block discarded – undo
84 84
         unset($output, $status);
85 85
     }
86 86
     if (2 == $GLOBALS['xoopsModuleConfig']['image_lib'] || 0 == $GLOBALS['xoopsModuleConfig']['image_lib']) {
87
-        $path = empty($GLOBALS['xoopsModuleConfig']['path_netpbm']) ? '' : $GLOBALS['xoopsModuleConfig']['path_netpbm'] . '/';
88
-        @exec($path . 'jpegtopnm -version 2>&1', $output, $status);
87
+        $path = empty($GLOBALS['xoopsModuleConfig']['path_netpbm']) ? '' : $GLOBALS['xoopsModuleConfig']['path_netpbm'].'/';
88
+        @exec($path.'jpegtopnm -version 2>&1', $output, $status);
89 89
         if (empty($status) && !empty($output) && preg_match("/netpbm[ \t]+([0-9\.]+)/i", $output[0], $matches)) {
90 90
             $imageLibs['netpbm'] = $matches[0];
91 91
         }
@@ -127,30 +127,30 @@  discard block
 block discarded – undo
127 127
 $adminObject->addInfoBox(_AM_NEWBB_PREFERENCES);
128 128
 // START irmtfan better poll module display link and version - check if xoops poll module is available
129 129
 if ($isOK) {
130
-    $pollLink = _AM_NEWBB_AVAILABLE . ': ';
131
-    $pollLink .= '<a href="' . XOOPS_URL . '/modules/' . $xoopspoll->getVar('dirname') . '/admin/index.php"';
132
-    $pollLink .= ' alt="' . $xoopspoll->getVar('name') . ' ' . _VERSION . ' (' . $xoopspoll->getInfo('version') . ') "';
133
-    $pollLink .= ' title="' . $xoopspoll->getVar('name') . ' ' . _VERSION . ' (' . $xoopspoll->getInfo('version') . ') "';
134
-    $pollLink .= '>' . '(' . $xoopspoll->getVar('name') . ')</a>';
130
+    $pollLink = _AM_NEWBB_AVAILABLE.': ';
131
+    $pollLink .= '<a href="'.XOOPS_URL.'/modules/'.$xoopspoll->getVar('dirname').'/admin/index.php"';
132
+    $pollLink .= ' alt="'.$xoopspoll->getVar('name').' '._VERSION.' ('.$xoopspoll->getInfo('version').') "';
133
+    $pollLink .= ' title="'.$xoopspoll->getVar('name').' '._VERSION.' ('.$xoopspoll->getInfo('version').') "';
134
+    $pollLink .= '>'.'('.$xoopspoll->getVar('name').')</a>';
135 135
 } else {
136 136
     $pollLink = _AM_NEWBB_NOTAVAILABLE;
137 137
 }
138
-$adminObject->addInfoBoxLine(sprintf(_AM_NEWBB_POLLMODULE . ': %s', $pollLink));
138
+$adminObject->addInfoBoxLine(sprintf(_AM_NEWBB_POLLMODULE.': %s', $pollLink));
139 139
 // END irmtfan better poll module display link and version - check if xoops poll module is available
140
-$adminObject->addInfoBoxLine(sprintf(_AM_NEWBB_IMAGEMAGICK . ' %s', array_key_exists('imagemagick', $imageLibs) ? _AM_NEWBB_AUTODETECTED . $imageLibs['imagemagick'] : _AM_NEWBB_NOTAVAILABLE));
141
-$adminObject->addInfoBoxLine(sprintf('NetPBM' . ': %s', array_key_exists('netpbm', $imageLibs) ? _AM_NEWBB_AUTODETECTED . $imageLibs['netpbm'] : _AM_NEWBB_NOTAVAILABLE));
142
-$adminObject->addInfoBoxLine(sprintf(_AM_NEWBB_GDLIB . ' %s', array_key_exists('gd', $imageLibs) ? _AM_NEWBB_AUTODETECTED . $imageLibs['gd'] : _AM_NEWBB_NOTAVAILABLE));
143
-$adminObject->addInfoBoxLine(sprintf(_AM_NEWBB_UPLOAD . ' %s', $uploadlimit));
144
-$adminObject->addInfoBoxLine(sprintf(_AM_NEWBB_INDEX_PDF_PAGE . '', ''));
140
+$adminObject->addInfoBoxLine(sprintf(_AM_NEWBB_IMAGEMAGICK.' %s', array_key_exists('imagemagick', $imageLibs) ? _AM_NEWBB_AUTODETECTED . $imageLibs['imagemagick'] : _AM_NEWBB_NOTAVAILABLE));
141
+$adminObject->addInfoBoxLine(sprintf('NetPBM'.': %s', array_key_exists('netpbm', $imageLibs) ? _AM_NEWBB_AUTODETECTED . $imageLibs['netpbm'] : _AM_NEWBB_NOTAVAILABLE));
142
+$adminObject->addInfoBoxLine(sprintf(_AM_NEWBB_GDLIB.' %s', array_key_exists('gd', $imageLibs) ? _AM_NEWBB_AUTODETECTED . $imageLibs['gd'] : _AM_NEWBB_NOTAVAILABLE));
143
+$adminObject->addInfoBoxLine(sprintf(_AM_NEWBB_UPLOAD.' %s', $uploadlimit));
144
+$adminObject->addInfoBoxLine(sprintf(_AM_NEWBB_INDEX_PDF_PAGE.'', ''));
145 145
 
146 146
 $adminObject->addInfoBox(_AM_NEWBB_BOARDSUMMARY);
147
-$adminObject->addInfoBoxLine(sprintf(_AM_NEWBB_TOTALTOPICS . ': %s', getTotalTopics()));
148
-$adminObject->addInfoBoxLine(sprintf(_AM_NEWBB_TOTALPOSTS . ': %s', getTotalPosts()));
149
-$adminObject->addInfoBoxLine(sprintf(_AM_NEWBB_TOTALVIEWS . ': %s', getTotalViews()));
147
+$adminObject->addInfoBoxLine(sprintf(_AM_NEWBB_TOTALTOPICS.': %s', getTotalTopics()));
148
+$adminObject->addInfoBoxLine(sprintf(_AM_NEWBB_TOTALPOSTS.': %s', getTotalPosts()));
149
+$adminObject->addInfoBoxLine(sprintf(_AM_NEWBB_TOTALVIEWS.': %s', getTotalViews()));
150 150
 
151 151
 $adminObject->addInfoBox(_AM_NEWBB_REPORT);
152
-$adminObject->addInfoBoxLine(sprintf(_AM_NEWBB_REPORT_PENDING . ': %s', $reportHandler->getCount(new \Criteria('report_result', 0))));
153
-$adminObject->addInfoBoxLine(sprintf(_AM_NEWBB_REPORT_PROCESSED . ': %s', $reportHandler->getCount(new \Criteria('report_result', 1))));
152
+$adminObject->addInfoBoxLine(sprintf(_AM_NEWBB_REPORT_PENDING.': %s', $reportHandler->getCount(new \Criteria('report_result', 0))));
153
+$adminObject->addInfoBoxLine(sprintf(_AM_NEWBB_REPORT_PROCESSED.': %s', $reportHandler->getCount(new \Criteria('report_result', 1))));
154 154
 
155 155
 foreach (array_keys($GLOBALS['uploadFolders']) as $i) {
156 156
     Newbb\Utility::prepareFolder($uploadFolders[$i]);
@@ -160,7 +160,7 @@  discard block
 block discarded – undo
160 160
 $adminObject->displayNavigation(basename(__FILE__));
161 161
 $adminObject->displayIndex();
162 162
 
163
-require_once __DIR__ . '/admin_footer.php';
163
+require_once __DIR__.'/admin_footer.php';
164 164
 
165 165
 $cacheHelper = Newbb\Utility::cleanCache();
166 166
 //$cacheHelper = new \Xmf\Module\Helper\Cache('newbb');
@@ -192,6 +192,6 @@  discard block
 block discarded – undo
192 192
         $base   = log($sizeAsString) / log(1024);
193 193
         $suffix = ['', 'KB', 'MB', 'GB', 'TB'];
194 194
 
195
-        return round(1024 ** ($base - floor($base))) . ' ' . $suffix[(int)floor($base)];
195
+        return round(1024 ** ($base - floor($base))).' '.$suffix[(int)floor($base)];
196 196
     }
197 197
 }
Please login to merge, or discard this patch.
admin/admin_header.php 2 patches
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.
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -33,15 +33,15 @@
 block discarded – undo
33 33
 use XoopsModules\Newbb;
34 34
 
35 35
 //require_once $GLOBALS['xoops']->path('include/cp_header.php');
36
-require_once dirname(dirname(dirname(__DIR__))) . '/include/cp_header.php';
37
-require_once $GLOBALS['xoops']->path('modules/' . $xoopsModule->getVar('dirname') . '/include/vars.php');
38
-require_once $GLOBALS['xoops']->path('modules/' . $xoopsModule->getVar('dirname') . '/include/functions.user.php');
39
-require_once $GLOBALS['xoops']->path('modules/' . $xoopsModule->getVar('dirname') . '/include/functions.render.php');
36
+require_once dirname(dirname(dirname(__DIR__))).'/include/cp_header.php';
37
+require_once $GLOBALS['xoops']->path('modules/'.$xoopsModule->getVar('dirname').'/include/vars.php');
38
+require_once $GLOBALS['xoops']->path('modules/'.$xoopsModule->getVar('dirname').'/include/functions.user.php');
39
+require_once $GLOBALS['xoops']->path('modules/'.$xoopsModule->getVar('dirname').'/include/functions.render.php');
40 40
 //require_once $GLOBALS['xoops']->path('Frameworks/art/functions.php');
41 41
 //require_once $GLOBALS['xoops']->path('Frameworks/art/functions.admin.php');
42 42
 
43
-require_once dirname(__DIR__) . '/include/config.php';
44
-require_once dirname(__DIR__) . '/include/common.php';
43
+require_once dirname(__DIR__).'/include/config.php';
44
+require_once dirname(__DIR__).'/include/common.php';
45 45
 
46 46
 /** @var Newbb\Helper $helper */
47 47
 $helper = Newbb\Helper::getInstance();
Please login to merge, or discard this patch.
admin/admin_forum_manager.php 2 patches
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.
Spacing   +59 added lines, -59 removed lines patch added patch discarded remove patch
@@ -32,11 +32,11 @@  discard block
 block discarded – undo
32 32
 use Xmf\Request;
33 33
 use XoopsModules\Newbb;
34 34
 
35
-require_once __DIR__ . '/admin_header.php';
35
+require_once __DIR__.'/admin_header.php';
36 36
 require_once $GLOBALS['xoops']->path('class/xoopstree.php');
37 37
 require_once $GLOBALS['xoops']->path('class/pagenav.php');
38
-require_once  dirname(__DIR__) . '/include/functions.forum.php';
39
-require_once  dirname(__DIR__) . '/include/functions.render.php';
38
+require_once  dirname(__DIR__).'/include/functions.forum.php';
39
+require_once  dirname(__DIR__).'/include/functions.render.php';
40 40
 
41 41
 $cacheHelper = Newbb\Utility::cleanCache();
42 42
 
@@ -69,7 +69,7 @@  discard block
 block discarded – undo
69 69
             if ($forumHandler->insert($forumObject)) {
70 70
                 if ($cid !== $forumObject->getVar('cat_id') && $subforums = newbbGetSubForum($forum_id)) {
71 71
                     $forums = array_map('intval', array_values($subforums));
72
-                    $forumHandler->updateAll('cat_id', $cid, new \Criteria('forum_id', '(' . implode(', ', $forums) . ')', 'IN'));
72
+                    $forumHandler->updateAll('cat_id', $cid, new \Criteria('forum_id', '('.implode(', ', $forums).')', 'IN'));
73 73
                 }
74 74
 
75 75
                 //$cacheHelper->delete('forum');
@@ -79,19 +79,19 @@  discard block
 block discarded – undo
79 79
             }
80 80
         } else {
81 81
             $box = '<select name="dest_forum">';
82
-            $box .= '<option value=0 selected>' . _SELECT . '</option>';
82
+            $box .= '<option value=0 selected>'._SELECT.'</option>';
83 83
             $box .= newbbForumSelectBox($forum_id, 'all', true, true);
84 84
             $box .= '</select>';
85 85
 
86
-            echo "<table width='100%' border='0' cellspacing='1' class='outer'>" . "<tr><td class='odd'>";
86
+            echo "<table width='100%' border='0' cellspacing='1' class='outer'>"."<tr><td class='odd'>";
87 87
             echo '<form action="./admin_forum_manager.php" method="post" name="forummove" id="forummove">';
88 88
             echo '<input type="hidden" name="op" value="moveforum" />';
89
-            echo '<input type="hidden" name="forum" value=' . $forum_id . ' />';
89
+            echo '<input type="hidden" name="forum" value='.$forum_id.' />';
90 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>';
91
+            echo '<td class="bg2" align="center"><strong>'._AM_NEWBB_MOVETHISFORUM.'</strong></td>';
92 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>';
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 95
             echo '</table></form>';
96 96
             echo '</td></tr></table>';
97 97
         }
@@ -104,17 +104,17 @@  discard block
 block discarded – undo
104 104
             $forum_dest = $forumHandler->get(Request::getString('dest_forum', '', 'POST'));
105 105
             if (is_object($forum_dest)) {
106 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";
107
+                $sql         = '    UPDATE '.$GLOBALS['xoopsDB']->prefix('newbb_posts').'    SET forum_id='.Request::getInt('dest_forum', 0, 'POST')."    WHERE forum_id=$forum_id";
108 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";
110
+                $sql          = '    UPDATE '.$GLOBALS['xoopsDB']->prefix('newbb_topics').'    SET forum_id='.Request::getInt('dest_forum', 0, 'POST')."    WHERE forum_id=$forum_id";
111 111
                 $result_topic = $GLOBALS['xoopsDB']->queryF($sql);
112 112
 
113 113
                 $forumObject = $forumHandler->get($forum_id);
114 114
                 $forumHandler->updateAll('parent_forum', Request::getInt('dest_forum', 0, 'POST'), new \Criteria('parent_forum', $forum_id));
115 115
                 if ($cid !== $forumObject->getVar('cat_id') && $subforums = newbbGetSubForum($forum_id)) {
116 116
                     $forums = array_map('intval', array_values($subforums));
117
-                    $forumHandler->updateAll('cat_id', $cid, new \Criteria('forum_id', '(' . implode(', ', $forums) . ')', 'IN'));
117
+                    $forumHandler->updateAll('cat_id', $cid, new \Criteria('forum_id', '('.implode(', ', $forums).')', 'IN'));
118 118
                 }
119 119
 
120 120
                 $forumHandler->delete($forumObject);
@@ -129,19 +129,19 @@  discard block
 block discarded – undo
129 129
             }
130 130
         } else {
131 131
             $box = '<select name="dest_forum">';
132
-            $box .= '<option value=0 selected>' . _SELECT . '</option>';
132
+            $box .= '<option value=0 selected>'._SELECT.'</option>';
133 133
             $box .= newbbForumSelectBox($forum_id, 'all');
134 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">';
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 137
             echo '<input type="hidden" name="op" value="mergeforum" />';
138
-            echo '<input type="hidden" name="forum" value=' . $forum_id . ' />';
138
+            echo '<input type="hidden" name="forum" value='.$forum_id.' />';
139 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>';
140
+            echo '<td class="bg2" align="center"><strong>'._AM_NEWBB_MERGETHISFORUM.'</strong></td>';
141 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>';
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 145
             echo '</form></table>';
146 146
             echo '</td></tr></table>';
147 147
         }
@@ -196,13 +196,13 @@  discard block
 block discarded – undo
196 196
             }
197 197
             redirect_header('admin_forum_manager.php', 2, $message);
198 198
         } else {
199
-            redirect_header('admin_forum_manager.php?op=mod&amp;forum=' . $forumObject->getVar('forum_id') . '', 2, _AM_NEWBB_FORUM_ERROR);
199
+            redirect_header('admin_forum_manager.php?op=mod&amp;forum='.$forumObject->getVar('forum_id').'', 2, _AM_NEWBB_FORUM_ERROR);
200 200
         }
201 201
         break;
202 202
 
203 203
     case 'mod':
204 204
         $forumObject = $forumHandler->get($forum_id);
205
-        require_once $GLOBALS['xoops']->path('modules/' . $xoopsModule->getVar('dirname') . '/include/form.forum.php');
205
+        require_once $GLOBALS['xoops']->path('modules/'.$xoopsModule->getVar('dirname').'/include/form.forum.php');
206 206
         break;
207 207
 
208 208
     case 'del':
@@ -227,7 +227,7 @@  discard block
 block discarded – undo
227 227
         $forumObject = $forumHandler->create();
228 228
         $forumObject->setVar('parent_forum', $parent_forum);
229 229
         $forumObject->setVar('cat_id', $cat_id);
230
-        require_once $GLOBALS['xoops']->path('modules/' . $xoopsModule->getVar('dirname') . '/include/form.forum.php');
230
+        require_once $GLOBALS['xoops']->path('modules/'.$xoopsModule->getVar('dirname').'/include/form.forum.php');
231 231
         break;
232 232
 
233 233
     default:
@@ -242,15 +242,15 @@  discard block
 block discarded – undo
242 242
         }
243 243
 
244 244
         $echo = $adminObject->displayNavigation(basename(__FILE__));
245
-        $echo .= "<table width='100%' border='0' cellspacing='1' class='outer'>" . "<tr><td class='odd'>";
245
+        $echo .= "<table width='100%' border='0' cellspacing='1' class='outer'>"."<tr><td class='odd'>";
246 246
         $echo .= "<table border='0' cellpadding='4' cellspacing='1' width='100%' class='outer'>";
247 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>';
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 254
         $echo .= '</tr>';
255 255
 
256 256
         //        $categoryHandler  = Newbb\Helper::getInstance()->getHandler('Category');
@@ -261,15 +261,15 @@  discard block
 block discarded – undo
261 261
         foreach (array_keys($categories) as $c) {
262 262
             $category       = $categories[$c];
263 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>';
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 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>';
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 273
             $echo           .= '<td></td>';
274 274
             $echo           .= '<td></td>';
275 275
             $echo           .= '</tr>';
@@ -279,21 +279,21 @@  discard block
 block discarded – undo
279 279
             $i = 0;
280 280
             foreach (array_keys($forums[$c]) as $f) {
281 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>';
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 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>';
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 297
                 $echo  .= '</tr>';
298 298
             }
299 299
         }
@@ -303,14 +303,14 @@  discard block
 block discarded – undo
303 303
         echo '</table>';
304 304
         echo '</td></tr></table>';
305 305
         echo '<fieldset>';
306
-        echo '<legend>&nbsp;' . _MI_NEWBB_ADMENU_FORUM . '&nbsp;</legend>';
306
+        echo '<legend>&nbsp;'._MI_NEWBB_ADMENU_FORUM.'&nbsp;</legend>';
307 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;
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 313
         echo '</fieldset>';
314 314
         break;
315 315
 }
316
-require_once __DIR__ . '/admin_footer.php';
316
+require_once __DIR__.'/admin_footer.php';
Please login to merge, or discard this patch.
admin/admin_synchronization.php 2 patches
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.
Spacing   +31 added lines, -31 removed lines patch added patch discarded remove patch
@@ -12,9 +12,9 @@  discard block
 block discarded – undo
12 12
 use Xmf\Request;
13 13
 
14 14
 // irmtfan - TODO - should be changed completly with Newbb new function newbbSynchronization
15
-require_once __DIR__ . '/admin_header.php';
15
+require_once __DIR__.'/admin_header.php';
16 16
 xoops_cp_header();
17
-require_once  dirname(__DIR__) . '/include/functions.recon.php';
17
+require_once  dirname(__DIR__).'/include/functions.recon.php';
18 18
 $form = '';
19 19
 $form .= $adminObject->displayNavigation(basename(__FILE__));
20 20
 
@@ -26,7 +26,7 @@  discard block
 block discarded – undo
26 26
     case 'forum':
27 27
         $result = newbbSynchronization('forum');
28 28
         if (!empty($result)) {
29
-            redirect_header('admin_synchronization.php', 2, _AM_NEWBB_SYNC_TYPE_FORUM . '<br>' . _AM_NEWBB_DATABASEUPDATED);
29
+            redirect_header('admin_synchronization.php', 2, _AM_NEWBB_SYNC_TYPE_FORUM.'<br>'._AM_NEWBB_DATABASEUPDATED);
30 30
         }
31 31
         break;
32 32
     // irmtfan rewrite topic sync
@@ -45,13 +45,13 @@  discard block
 block discarded – undo
45 45
             $topicHandler->synchronization($tObj);
46 46
         }
47 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));
48
+        redirect_header('admin_synchronization.php?type=topic&amp;start='.($start + $limit)."&amp;limit={$limit}", 2, _AM_NEWBB_SYNCHING." {$count}: {$start} - ".($start + $limit));
49 49
         break;
50 50
     // irmtfan rewrite post sync
51 51
     case 'post':
52 52
         $result = newbbSynchronization('post');
53 53
         if (!empty($result)) {
54
-            redirect_header('admin_synchronization.php', 2, _AM_NEWBB_SYNC_TYPE_POST . '<br>' . _AM_NEWBB_DATABASEUPDATED);
54
+            redirect_header('admin_synchronization.php', 2, _AM_NEWBB_SYNC_TYPE_POST.'<br>'._AM_NEWBB_DATABASEUPDATED);
55 55
         }
56 56
         break;
57 57
     // irmtfan - user is not in recon functions - only here
@@ -62,26 +62,26 @@  discard block
 block discarded – undo
62 62
         if ($start >= ($count = $userHandler->getCount())) {
63 63
             break;
64 64
         }
65
-        $sql    = '    SELECT uid' . '    FROM ' . $GLOBALS['xoopsDB']->prefix('users');
65
+        $sql    = '    SELECT uid'.'    FROM '.$GLOBALS['xoopsDB']->prefix('users');
66 66
         $result = $GLOBALS['xoopsDB']->query($sql, $limit, $start);
67 67
         while (false !== (list($uid) = $GLOBALS['xoopsDB']->fetchRow($result))) {
68 68
             // irmtfan approved=1 AND
69
-            $sql = '    SELECT count(*)' . '    FROM ' . $GLOBALS['xoopsDB']->prefix('newbb_topics') . "    WHERE topic_poster = {$uid}";
69
+            $sql = '    SELECT count(*)'.'    FROM '.$GLOBALS['xoopsDB']->prefix('newbb_topics')."    WHERE topic_poster = {$uid}";
70 70
             $ret = $GLOBALS['xoopsDB']->query($sql);
71 71
             list($topics) = $GLOBALS['xoopsDB']->fetchRow($ret);
72 72
             // irmtfan approved=1 AND
73
-            $sql = '    SELECT count(*)' . '    FROM ' . $GLOBALS['xoopsDB']->prefix('newbb_topics') . "    WHERE topic_digest > 0 AND topic_poster = {$uid}";
73
+            $sql = '    SELECT count(*)'.'    FROM '.$GLOBALS['xoopsDB']->prefix('newbb_topics')."    WHERE topic_digest > 0 AND topic_poster = {$uid}";
74 74
             $ret = $GLOBALS['xoopsDB']->query($sql);
75 75
             list($digests) = $GLOBALS['xoopsDB']->fetchRow($ret);
76 76
             // irmtfan approved=1 AND
77
-            $sql = '    SELECT count(*), MAX(post_time)' . '    FROM ' . $GLOBALS['xoopsDB']->prefix('newbb_posts') . "    WHERE uid = {$uid}";
77
+            $sql = '    SELECT count(*), MAX(post_time)'.'    FROM '.$GLOBALS['xoopsDB']->prefix('newbb_posts')."    WHERE uid = {$uid}";
78 78
             $ret = $GLOBALS['xoopsDB']->query($sql);
79 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}'");
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 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));
84
+        redirect_header('admin_synchronization.php?type=user&amp;start='.($start + $limit)."&amp;limit={$limit}", 2, _AM_NEWBB_SYNCHING." {$count}: {$start} - ".($start + $limit));
85 85
         break;
86 86
     // irmtfan rewrite stats reset
87 87
     case 'stats':
@@ -91,7 +91,7 @@  discard block
 block discarded – undo
91 91
     case 'read':
92 92
         $result = newbbSynchronization(['readtopic', 'readforum']);
93 93
         if (!empty($result)) {
94
-            redirect_header('admin_synchronization.php', 2, _AM_NEWBB_SYNC_TYPE_READ . '<br>' . _AM_NEWBB_DATABASEUPDATED);
94
+            redirect_header('admin_synchronization.php', 2, _AM_NEWBB_SYNC_TYPE_READ.'<br>'._AM_NEWBB_DATABASEUPDATED);
95 95
         }
96 96
         exit();
97 97
     // END irmtfan add read sync
@@ -105,70 +105,70 @@  discard block
 block discarded – undo
105 105
 
106 106
 $form .= '<form action="admin_synchronization.php" method="get">';
107 107
 $form .= '<div style="padding: 10px 2px;">';
108
-$form .= '<h2>' . _AM_NEWBB_SYNC_TYPE_FORUM . '</h2>';
108
+$form .= '<h2>'._AM_NEWBB_SYNC_TYPE_FORUM.'</h2>';
109 109
 $form .= '<input type="hidden" name="type" value="forum">';
110 110
 // $form .= _AM_NEWBB_SYNC_ITEMS.'<input type="text" name="limit" value="20">'; // irmtfan remove
111
-$form .= '<input type="submit" name="submit" value=' . _SUBMIT . ' />';
111
+$form .= '<input type="submit" name="submit" value='._SUBMIT.' />';
112 112
 $form .= '</div>';
113 113
 $form .= '</form>';
114 114
 
115 115
 $form .= '<form action="admin_synchronization.php" method="get">';
116 116
 $form .= '<div style="padding: 10px 2px;">';
117
-$form .= '<h2>' . _AM_NEWBB_SYNC_TYPE_TOPIC . '</h2>';
117
+$form .= '<h2>'._AM_NEWBB_SYNC_TYPE_TOPIC.'</h2>';
118 118
 $form .= '<input type="hidden" name="type" value="topic">';
119
-$form .= _AM_NEWBB_SYNC_ITEMS . '<input type="text" name="limit" value="1000">';
120
-$form .= '<input type="submit" name="submit" value=' . _SUBMIT . ' />';
119
+$form .= _AM_NEWBB_SYNC_ITEMS.'<input type="text" name="limit" value="1000">';
120
+$form .= '<input type="submit" name="submit" value='._SUBMIT.' />';
121 121
 $form .= '</div>';
122 122
 $form .= '</form>';
123 123
 
124 124
 $form .= '<form action="admin_synchronization.php" method="get">';
125 125
 $form .= '<div style="padding: 10px 2px;">';
126
-$form .= '<h2>' . _AM_NEWBB_SYNC_TYPE_POST . '</h2>';
126
+$form .= '<h2>'._AM_NEWBB_SYNC_TYPE_POST.'</h2>';
127 127
 $form .= '<input type="hidden" name="type" value="post">';
128 128
 // $form .= _AM_NEWBB_SYNC_ITEMS.'<input type="text" name="limit" value="1000">'; // irmtfan remove
129
-$form .= '<input type="submit" name="submit" value=' . _SUBMIT . ' />';
129
+$form .= '<input type="submit" name="submit" value='._SUBMIT.' />';
130 130
 $form .= '</div>';
131 131
 $form .= '</form>';
132 132
 
133 133
 $form .= '<form action="admin_synchronization.php" method="get">';
134 134
 $form .= '<div style="padding: 10px 2px;">';
135
-$form .= '<h2>' . _AM_NEWBB_SYNC_TYPE_USER . '</h2>';
135
+$form .= '<h2>'._AM_NEWBB_SYNC_TYPE_USER.'</h2>';
136 136
 $form .= '<input type="hidden" name="type" value="user">';
137
-$form .= _AM_NEWBB_SYNC_ITEMS . '<input type="text" name="limit" value="1000">';
138
-$form .= '<input type="submit" name="submit" value=' . _SUBMIT . ' />';
137
+$form .= _AM_NEWBB_SYNC_ITEMS.'<input type="text" name="limit" value="1000">';
138
+$form .= '<input type="submit" name="submit" value='._SUBMIT.' />';
139 139
 $form .= '</div>';
140 140
 $form .= '</form>';
141 141
 // START irmtfan add read sync
142 142
 $form .= '<form action="admin_synchronization.php" method="get">';
143 143
 $form .= '<div style="padding: 10px 2px;">';
144
-$form .= '<h2>' . _AM_NEWBB_SYNC_TYPE_READ . '</h2>';
144
+$form .= '<h2>'._AM_NEWBB_SYNC_TYPE_READ.'</h2>';
145 145
 $form .= '<input type="hidden" name="type" value="read">';
146
-$form .= '<input type="submit" name="submit" value=' . _SUBMIT . ' />';
146
+$form .= '<input type="submit" name="submit" value='._SUBMIT.' />';
147 147
 $form .= '</div>';
148 148
 $form .= '</form>';
149 149
 // END irmtfan add read sync
150 150
 
151 151
 $form .= '<form action="admin_synchronization.php" method="get">';
152 152
 $form .= '<div style="padding: 10px 2px;">';
153
-$form .= '<h2>' . _AM_NEWBB_SYNC_TYPE_STATS . '</h2>';
153
+$form .= '<h2>'._AM_NEWBB_SYNC_TYPE_STATS.'</h2>';
154 154
 $form .= '<input type="hidden" name="type" value="stats">';
155 155
 //$form .= _AM_NEWBB_SYNC_ITEMS.'<input type="text" name="limit" value="1000">';
156
-$form .= '<input type="submit" name="submit" value=' . _SUBMIT . ' />';
156
+$form .= '<input type="submit" name="submit" value='._SUBMIT.' />';
157 157
 $form .= '</div>';
158 158
 $form .= '</form>';
159 159
 
160 160
 $form .= '<form action="admin_synchronization.php" method="get">';
161 161
 $form .= '<div style="padding: 10px 2px;">';
162
-$form .= '<h2>' . _AM_NEWBB_SYNC_TYPE_MISC . '</h2>';
162
+$form .= '<h2>'._AM_NEWBB_SYNC_TYPE_MISC.'</h2>';
163 163
 $form .= '<input type="hidden" name="type" value="misc">';
164
-$form .= '<input type="submit" name="submit" value=' . _SUBMIT . ' />';
164
+$form .= '<input type="submit" name="submit" value='._SUBMIT.' />';
165 165
 $form .= '</div>';
166 166
 $form .= '</form>';
167
-echo "<table width='100%' border='0' cellspacing='1' class='outer'>" . "<tr><td class='odd'>";
167
+echo "<table width='100%' border='0' cellspacing='1' class='outer'>"."<tr><td class='odd'>";
168 168
 echo $form;
169 169
 echo '</td></tr></table>';
170 170
 echo '<fieldset>';
171
-echo '<legend>&nbsp;' . _MI_NEWBB_ADMENU_SYNC . '&nbsp;</legend>';
171
+echo '<legend>&nbsp;'._MI_NEWBB_ADMENU_SYNC.'&nbsp;</legend>';
172 172
 echo _AM_NEWBB_HELP_SYNC_TAB;
173 173
 echo '</fieldset>';
174
-require_once __DIR__ . '/admin_footer.php';
174
+require_once __DIR__.'/admin_footer.php';
Please login to merge, or discard this patch.
admin/admin_forum_prune.php 2 patches
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.
Spacing   +22 added lines, -22 removed lines patch added patch discarded remove patch
@@ -27,7 +27,7 @@  discard block
 block discarded – undo
27 27
 
28 28
 use Xmf\Request;
29 29
 
30
-require_once __DIR__ . '/admin_header.php';
30
+require_once __DIR__.'/admin_header.php';
31 31
 require_once $GLOBALS['xoops']->path('class/xoopsformloader.php');
32 32
 
33 33
 xoops_cp_header();
@@ -36,7 +36,7 @@  discard block
 block discarded – undo
36 36
 //if (!$newXoopsModuleGui) loadModuleAdminMenu(5, _AM_NEWBB_PRUNE_TITLE);
37 37
 //    else $adminObject->displayNavigation(basename(__FILE__));
38 38
 
39
-echo "<table width='100%' border='0' cellspacing='1' class='outer'>" . "<tr><td class='odd'>";
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 42
     $post_list       = null;
@@ -63,8 +63,8 @@  discard block
 block discarded – undo
63 63
     $hot         = Request::getInt('hot', 0, 'POST');
64 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
67
-                    WHERE t.forum_id IN (' . $selected_forums . ')
66
+    $sql = 'SELECT t.topic_id FROM '.$GLOBALS['xoopsDB']->prefix('newbb_topics').' t, '.$GLOBALS['xoopsDB']->prefix('newbb_posts').'  p
67
+                    WHERE t.forum_id IN (' . $selected_forums.')
68 68
                     AND p.post_id =t.topic_last_post_id ';
69 69
 
70 70
     if ($sticky) {
@@ -77,10 +77,10 @@  discard block
 block discarded – undo
77 77
         $sql .= ' AND t.topic_status <> 1 ';
78 78
     }
79 79
     if (0 !== $hot) {
80
-        $sql .= ' AND t.topic_replies < ' . $hot . ' ';
80
+        $sql .= ' AND t.topic_replies < '.$hot.' ';
81 81
     }
82 82
 
83
-    $sql .= ' AND p.post_time<= ' . $prune_ddays . ' ';
83
+    $sql .= ' AND p.post_time<= '.$prune_ddays.' ';
84 84
     // Ok now we have the sql query completed, go for topic_id's and posts_id's
85 85
     $topics = [];
86 86
     if (!$result = $GLOBALS['xoopsDB']->query($sql)) {
@@ -95,7 +95,7 @@  discard block
 block discarded – undo
95 95
     $post_list     = '';
96 96
 
97 97
     if ('' !== $topic_list) {
98
-        $sql = 'SELECT post_id FROM ' . $GLOBALS['xoopsDB']->prefix('newbb_posts') . ' WHERE topic_id IN (' . $topic_list . ')';
98
+        $sql = 'SELECT post_id FROM '.$GLOBALS['xoopsDB']->prefix('newbb_posts').' WHERE topic_id IN ('.$topic_list.')';
99 99
 
100 100
         $posts = [];
101 101
         if (!$result = $GLOBALS['xoopsDB']->query($sql)) {
@@ -112,35 +112,35 @@  discard block
 block discarded – undo
112 112
     if ('' !== $post_list) {
113 113
         // COPY POSTS TO OTHER FORUM
114 114
         if (null !== $store) {
115
-            $sql = 'UPDATE ' . $GLOBALS['xoopsDB']->prefix('newbb_posts') . " SET forum_id=$store WHERE topic_id IN ($topic_list)";
115
+            $sql = 'UPDATE '.$GLOBALS['xoopsDB']->prefix('newbb_posts')." SET forum_id=$store WHERE topic_id IN ($topic_list)";
116 116
             if (!$result = $GLOBALS['xoopsDB']->query($sql)) {
117 117
                 return _MD_NEWBB_ERROR;
118 118
             }
119 119
 
120
-            $sql = 'UPDATE ' . $GLOBALS['xoopsDB']->prefix('newbb_topics') . " SET forum_id=$store WHERE topic_id IN ($topic_list)";
120
+            $sql = 'UPDATE '.$GLOBALS['xoopsDB']->prefix('newbb_topics')." SET forum_id=$store WHERE topic_id IN ($topic_list)";
121 121
             if (!$result = $GLOBALS['xoopsDB']->query($sql)) {
122 122
                 return _MD_NEWBB_ERROR;
123 123
             }
124 124
         } else {
125 125
             // ARCHIVING POSTS
126 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");
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 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)");
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 130
                 }
131 131
             }
132 132
             // DELETE POSTS
133
-            $sql = 'DELETE FROM ' . $GLOBALS['xoopsDB']->prefix('newbb_posts') . " WHERE topic_id IN ($topic_list)";
133
+            $sql = 'DELETE FROM '.$GLOBALS['xoopsDB']->prefix('newbb_posts')." WHERE topic_id IN ($topic_list)";
134 134
             if (!$result = $GLOBALS['xoopsDB']->query($sql)) {
135 135
                 return _MD_NEWBB_ERROR;
136 136
             }
137 137
             // DELETE TOPICS
138
-            $sql = 'DELETE FROM ' . $GLOBALS['xoopsDB']->prefix('newbb_topics') . " WHERE topic_id IN ($topic_list)";
138
+            $sql = 'DELETE FROM '.$GLOBALS['xoopsDB']->prefix('newbb_topics')." WHERE topic_id IN ($topic_list)";
139 139
             if (!$result = $GLOBALS['xoopsDB']->query($sql)) {
140 140
                 return _MD_NEWBB_ERROR;
141 141
             }
142 142
             // DELETE POSTS_TEXT
143
-            $sql = 'DELETE FROM ' . $GLOBALS['xoopsDB']->prefix('newbb_posts_text') . " WHERE post_id IN ($post_list)";
143
+            $sql = 'DELETE FROM '.$GLOBALS['xoopsDB']->prefix('newbb_posts_text')." WHERE post_id IN ($post_list)";
144 144
             if (!$result = $GLOBALS['xoopsDB']->query($sql)) {
145 145
                 return _MD_NEWBB_ERROR;
146 146
             }
@@ -179,15 +179,15 @@  discard block
 block discarded – undo
179 179
                           ]);
180 180
     $sform->addElement($days);
181 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
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 185
     $forumSelSingle = "<select name=\"store\" onfocus = \"validate('store','select', false,true)\">"; // disable all categories
186
-    $forumSelBox    = '<option value = 0 >-- ' . _AM_NEWBB_PERM_FORUMS . ' --</option>';
186
+    $forumSelBox    = '<option value = 0 >-- '._AM_NEWBB_PERM_FORUMS.' --</option>';
187 187
     $forumSelBox    .= newbbForumSelectBox(null, 'access', false); //$accessForums = nothing, $permission = "access", $delimitorCategory = false
188 188
     $forumSelBox    .= '</select>';
189
-    $forumEle       = new \XoopsFormLabel(_AM_NEWBB_PRUNE_FORUMS, $forumSelMulti . $forumSelBox);
190
-    $storeEle       = new \XoopsFormLabel(_AM_NEWBB_PRUNE_STORE, $forumSelSingle . $forumSelBox);
189
+    $forumEle       = new \XoopsFormLabel(_AM_NEWBB_PRUNE_FORUMS, $forumSelMulti.$forumSelBox);
190
+    $storeEle       = new \XoopsFormLabel(_AM_NEWBB_PRUNE_STORE, $forumSelSingle.$forumSelBox);
191 191
     /* irmtfan remove hardcode
192 192
     $checkbox = new \XoopsFormCheckBox(_AM_NEWBB_PRUNE_FORUMS, 'forums');
193 193
     $radiobox = new \XoopsFormRadio(_AM_NEWBB_PRUNE_STORE, 'store');
@@ -256,7 +256,7 @@  discard block
 block discarded – undo
256 256
 
257 257
 echo '</td></tr></table>';
258 258
 echo '<fieldset>';
259
-echo '<legend>&nbsp;' . _MI_NEWBB_ADMENU_PRUNE . '&nbsp;</legend>';
259
+echo '<legend>&nbsp;'._MI_NEWBB_ADMENU_PRUNE.'&nbsp;</legend>';
260 260
 echo _AM_NEWBB_HELP_PRUNE_TAB;
261 261
 echo '</fieldset>';
262
-require_once __DIR__ . '/admin_footer.php';
262
+require_once __DIR__.'/admin_footer.php';
Please login to merge, or discard this patch.
admin/admin_cat_manager.php 3 patches
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.
Switch Indentation   +93 added lines, -93 removed lines patch added patch discarded remove patch
@@ -115,99 +115,99 @@
 block discarded – undo
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.
Spacing   +21 added lines, -21 removed lines patch added patch discarded remove patch
@@ -32,8 +32,8 @@  discard block
 block discarded – undo
32 32
 use Xmf\Request;
33 33
 use XoopsModules\Newbb;
34 34
 
35
-require_once __DIR__ . '/admin_header.php';
36
-require_once  dirname(__DIR__) . '/include/functions.render.php';
35
+require_once __DIR__.'/admin_header.php';
36
+require_once  dirname(__DIR__).'/include/functions.render.php';
37 37
 
38 38
 xoops_cp_header();
39 39
 
@@ -69,7 +69,7 @@  discard block
 block discarded – undo
69 69
     require_once $GLOBALS['xoops']->path('class/xoopsformloader.php');
70 70
 
71 71
     if (!$categoryObject->isNew()) {
72
-        $sform = new \XoopsThemeForm(_AM_NEWBB_EDITCATEGORY . ' ' . $categoryObject->getVar('cat_title'), 'op', xoops_getenv('PHP_SELF'));
72
+        $sform = new \XoopsThemeForm(_AM_NEWBB_EDITCATEGORY.' '.$categoryObject->getVar('cat_title'), 'op', xoops_getenv('PHP_SELF'));
73 73
     } else {
74 74
         $sform = new \XoopsThemeForm(_AM_NEWBB_CREATENEWCATEGORY, 'op', xoops_getenv('PHP_SELF'));
75 75
         $categoryObject->setVar('cat_title', '');
@@ -83,17 +83,17 @@  discard block
 block discarded – undo
83 83
     $sform->addElement(new \XoopsFormText(_AM_NEWBB_CATEGORY, 'title', 50, 80, $categoryObject->getVar('cat_title', 'E')), true);
84 84
     $sform->addElement(new \XoopsFormDhtmlTextArea(_AM_NEWBB_CATEGORYDESC, 'cat_description', $categoryObject->getVar('cat_description', 'E'), 10, 60), false);
85 85
 
86
-    $imgdir      = '/modules/' . $xoopsModule->getVar('dirname') . '/assets/images/category';
86
+    $imgdir      = '/modules/'.$xoopsModule->getVar('dirname').'/assets/images/category';
87 87
     $cat_image   = $categoryObject->getVar('cat_image');
88 88
     $cat_image   = empty($cat_image) ? 'blank.gif' : $cat_image;
89
-    $graph_array = \XoopsLists::getImgListAsArray(XOOPS_ROOT_PATH . $imgdir . '/');
89
+    $graph_array = \XoopsLists::getImgListAsArray(XOOPS_ROOT_PATH.$imgdir.'/');
90 90
     array_unshift($graph_array, _NONE);
91 91
     $cat_image_select = new \XoopsFormSelect('', 'cat_image', $categoryObject->getVar('cat_image'));
92 92
     $cat_image_select->addOptionArray($graph_array);
93
-    $cat_image_select->setExtra("onchange=\"showImgSelected('img', 'cat_image', '/" . $imgdir . "/', '', '" . XOOPS_URL . "')\"");
93
+    $cat_image_select->setExtra("onchange=\"showImgSelected('img', 'cat_image', '/".$imgdir."/', '', '".XOOPS_URL."')\"");
94 94
     $cat_image_tray = new \XoopsFormElementTray(_AM_NEWBB_IMAGE, '&nbsp;');
95 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='' />"));
96
+    $cat_image_tray->addElement(new \XoopsFormLabel('', "<br><img src='".XOOPS_URL.$imgdir.'/'.$cat_image." 'name='img' id='img' alt='' />"));
97 97
     $sform->addElement($cat_image_tray);
98 98
 
99 99
     $sform->addElement(new \XoopsFormText(_AM_NEWBB_SPONSORLINK, 'cat_url', 50, 80, $categoryObject->getVar('cat_url', 'E')), false);
@@ -180,32 +180,32 @@  discard block
 block discarded – undo
180 180
         $adminObject->addItemButton(_AM_NEWBB_CREATENEWCATEGORY, 'admin_cat_manager.php?op=mod', $icon = 'add');
181 181
         $adminObject->displayButton('left');
182 182
 
183
-        echo "<table width='100%' border='0' cellspacing='1' class='outer'>" . "<tr><td class='odd'>";
183
+        echo "<table width='100%' border='0' cellspacing='1' class='outer'>"."<tr><td class='odd'>";
184 184
         echo "<table border='0' cellpadding='4' cellspacing='1' width='100%' class='outer'>";
185 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>';
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 189
         echo '</tr>';
190 190
 
191 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>';
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 195
 
196 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>';
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 200
             echo '</tr>';
201 201
         }
202 202
         echo '</table>';
203 203
         echo '</td></tr></table>';
204 204
         echo '<fieldset>';
205
-        echo '<legend>&nbsp;' . _MI_NEWBB_ADMENU_CATEGORY . '&nbsp;</legend>';
205
+        echo '<legend>&nbsp;'._MI_NEWBB_ADMENU_CATEGORY.'&nbsp;</legend>';
206 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;
207
+        echo '<br>'.newbbDisplayImage('admin_edit', _EDIT).'&nbsp;-&nbsp;'._EDIT;
208
+        echo '<br>'.newbbDisplayImage('admin_delete', _DELETE).'&nbsp;-&nbsp;'._DELETE;
209 209
         echo '</fieldset>';
210 210
         break;
211 211
 }
@@ -213,4 +213,4 @@  discard block
 block discarded – undo
213 213
 $cacheHelper = Newbb\Utility::cleanCache();
214 214
 //$cacheHelper->delete('permission_category');
215 215
 
216
-require_once __DIR__ . '/admin_footer.php';
216
+require_once __DIR__.'/admin_footer.php';
Please login to merge, or discard this patch.