@@ -40,7 +40,7 @@ discard block |
||
40 | 40 | * |
41 | 41 | */ |
42 | 42 | |
43 | -require_once __DIR__ . '/header.php'; |
|
43 | +require_once __DIR__.'/header.php'; |
|
44 | 44 | |
45 | 45 | error_reporting(0); |
46 | 46 | $xoopsLogger->activated = false; |
@@ -65,9 +65,9 @@ discard block |
||
65 | 65 | $topic_id = $post->getVar('topic_id'); |
66 | 66 | $post_data = $postHandler->getPostForPrint($post); |
67 | 67 | $isPost = 1; |
68 | - $post_data['url'] = XOOPS_URL . '/modules/newbb/viewtopic.php?post_id=' . $post_id; |
|
68 | + $post_data['url'] = XOOPS_URL.'/modules/newbb/viewtopic.php?post_id='.$post_id; |
|
69 | 69 | if (!empty($GLOBALS['xoopsModuleConfig']['do_rewrite'])) { |
70 | - $post_data['url'] = seo_urls('<a href="' . $post_data['url'] . '"></a>'); |
|
70 | + $post_data['url'] = seo_urls('<a href="'.$post_data['url'].'"></a>'); |
|
71 | 71 | $post_data['url'] = str_replace('<a href="', '', $post_data['url']); |
72 | 72 | $post_data['url'] = str_replace('"></a>', '', $post_data['url']); |
73 | 73 | } |
@@ -113,7 +113,7 @@ discard block |
||
113 | 113 | echo "</head><body style='background-color:#ffffff; color:#000000;' onload='window.print()'> |
114 | 114 | <div style='width: 750px; border: 1px solid #000; padding: 20px;'> |
115 | 115 | <div style='text-align: center; display: block; margin: 0 0 6px 0;'> |
116 | - <img src='" . XOOPS_URL . "/modules/newbb/assets/images/xoopsbb_slogo.png' border='0' alt='' /> |
|
116 | + <img src='" . XOOPS_URL."/modules/newbb/assets/images/xoopsbb_slogo.png' border='0' alt='' /> |
|
117 | 117 | <br><br> "; |
118 | 118 | |
119 | 119 | $postsArray = $topicHandler->getAllPosts($topicObject); |
@@ -122,25 +122,25 @@ discard block |
||
122 | 122 | continue; |
123 | 123 | } |
124 | 124 | $post_data = $postHandler->getPostForPrint($post); |
125 | - echo "<h2 style='margin: 0;'>" . $post_data['subject'] . "</h2> |
|
126 | - <div align='center'>" . _POSTEDBY . ' ' . $post_data['author'] . ' ' . _ON . ' ' . formatTimestamp($post_data['date']) . "</div> |
|
125 | + echo "<h2 style='margin: 0;'>".$post_data['subject']."</h2> |
|
126 | + <div align='center'>" . _POSTEDBY.' '.$post_data['author'].' '._ON.' '.formatTimestamp($post_data['date'])."</div> |
|
127 | 127 | <div style='text-align: center; display: block; padding-bottom: 12px; margin: 0 0 6px 0; border-bottom: 2px solid #ccc;'></div> |
128 | - <div>" . $post_data['text'] . "</div> |
|
128 | + <div>" . $post_data['text']."</div> |
|
129 | 129 | <div style='padding-top: 12px; border-top: 2px solid #ccc;'></div><br>"; |
130 | 130 | } |
131 | - echo '<p>' . _MD_NEWBB_COMEFROM . ' ' . XOOPS_URL . '/newbb/viewtopic.php?forum=' . $forum_id . '&topic_id=' . $topic_id . '</p>'; |
|
131 | + echo '<p>'._MD_NEWBB_COMEFROM.' '.XOOPS_URL.'/newbb/viewtopic.php?forum='.$forum_id.'&topic_id='.$topic_id.'</p>'; |
|
132 | 132 | echo '</div></div>'; |
133 | 133 | echo '</body></html>'; |
134 | 134 | } else { |
135 | 135 | echo "</head><body style='background-color:#ffffff; color:#000000;' onload='window.print()'> |
136 | 136 | <div style='width: 750px; border: 1px solid #000; padding: 20px;'> |
137 | 137 | <div style='text-align: center; display: block; margin: 0 0 6px 0;'> |
138 | - <h2 style='margin: 0;'>" . $post_data['subject'] . "</h2></div> |
|
139 | - <div align='center'>" . _POSTEDBY . ' ' . $post_data['author'] . ' ' . _ON . ' ' . formatTimestamp($post_data['date']) . "</div> |
|
138 | + <h2 style='margin: 0;'>" . $post_data['subject']."</h2></div> |
|
139 | + <div align='center'>" . _POSTEDBY.' '.$post_data['author'].' '._ON.' '.formatTimestamp($post_data['date'])."</div> |
|
140 | 140 | <div style='text-align: center; display: block; padding-bottom: 12px; margin: 0 0 6px 0; border-bottom: 2px solid #ccc;'></div> |
141 | - <div>" . $post_data['text'] . "</div> |
|
141 | + <div>" . $post_data['text']."</div> |
|
142 | 142 | <div style='padding-top: 12px; border-top: 2px solid #ccc;'></div> |
143 | - <p>" . _MD_NEWBB_COMEFROM . ' ' . $post_data['url'] . '</p> |
|
143 | + <p>" . _MD_NEWBB_COMEFROM.' '.$post_data['url'].'</p> |
|
144 | 144 | </div> |
145 | 145 | <br><br></body></html>'; |
146 | 146 | } |
@@ -46,93 +46,93 @@ |
||
46 | 46 | $xoopsLogger->activated = false; |
47 | 47 | |
48 | 48 | if (!Request::getString('post_data', '', 'POST')) { |
49 | - $forum = Request::getInt('forum', 0, 'GET'); |
|
50 | - $topic_id = Request::getInt('topic_id', 0, 'GET'); |
|
51 | - $post_id = Request::getInt('post_id', 0, 'GET'); |
|
49 | + $forum = Request::getInt('forum', 0, 'GET'); |
|
50 | + $topic_id = Request::getInt('topic_id', 0, 'GET'); |
|
51 | + $post_id = Request::getInt('post_id', 0, 'GET'); |
|
52 | 52 | |
53 | - if (0 === $post_id && 0 === $topic_id) { |
|
54 | - exit(_MD_NEWBB_ERRORTOPIC); |
|
55 | - } |
|
53 | + if (0 === $post_id && 0 === $topic_id) { |
|
54 | + exit(_MD_NEWBB_ERRORTOPIC); |
|
55 | + } |
|
56 | 56 | |
57 | - if (0 !== $post_id) { |
|
58 | - // /** @var Newbb\PostHandler $postHandler */ |
|
59 | - // $postHandler = Newbb\Helper::getInstance()->getHandler('Post'); |
|
60 | - /** @var Newbb\Post $post */ |
|
61 | - $post = $postHandler->get($post_id); |
|
62 | - if (!$approved = $post->getVar('approved')) { |
|
63 | - exit(_MD_NEWBB_NORIGHTTOVIEW); |
|
64 | - } |
|
65 | - $topic_id = $post->getVar('topic_id'); |
|
66 | - $post_data = $postHandler->getPostForPrint($post); |
|
67 | - $isPost = 1; |
|
68 | - $post_data['url'] = XOOPS_URL . '/modules/newbb/viewtopic.php?post_id=' . $post_id; |
|
69 | - if (!empty($GLOBALS['xoopsModuleConfig']['do_rewrite'])) { |
|
70 | - $post_data['url'] = seo_urls('<a href="' . $post_data['url'] . '"></a>'); |
|
71 | - $post_data['url'] = str_replace('<a href="', '', $post_data['url']); |
|
72 | - $post_data['url'] = str_replace('"></a>', '', $post_data['url']); |
|
73 | - } |
|
74 | - } |
|
57 | + if (0 !== $post_id) { |
|
58 | + // /** @var Newbb\PostHandler $postHandler */ |
|
59 | + // $postHandler = Newbb\Helper::getInstance()->getHandler('Post'); |
|
60 | + /** @var Newbb\Post $post */ |
|
61 | + $post = $postHandler->get($post_id); |
|
62 | + if (!$approved = $post->getVar('approved')) { |
|
63 | + exit(_MD_NEWBB_NORIGHTTOVIEW); |
|
64 | + } |
|
65 | + $topic_id = $post->getVar('topic_id'); |
|
66 | + $post_data = $postHandler->getPostForPrint($post); |
|
67 | + $isPost = 1; |
|
68 | + $post_data['url'] = XOOPS_URL . '/modules/newbb/viewtopic.php?post_id=' . $post_id; |
|
69 | + if (!empty($GLOBALS['xoopsModuleConfig']['do_rewrite'])) { |
|
70 | + $post_data['url'] = seo_urls('<a href="' . $post_data['url'] . '"></a>'); |
|
71 | + $post_data['url'] = str_replace('<a href="', '', $post_data['url']); |
|
72 | + $post_data['url'] = str_replace('"></a>', '', $post_data['url']); |
|
73 | + } |
|
74 | + } |
|
75 | 75 | |
76 | - // /** @var Newbb\TopicHandler $topicHandler */ |
|
77 | - // $topicHandler = Newbb\Helper::getInstance()->getHandler('Topic'); |
|
78 | - $topicObject = $topicHandler->get($topic_id); |
|
79 | - $topic_id = $topicObject->getVar('topic_id'); |
|
80 | - $forum = $topicObject->getVar('forum_id'); |
|
81 | - if (!$approved = $topicObject->getVar('approved')) { |
|
82 | - exit(_MD_NEWBB_NORIGHTTOVIEW); |
|
83 | - } |
|
76 | + // /** @var Newbb\TopicHandler $topicHandler */ |
|
77 | + // $topicHandler = Newbb\Helper::getInstance()->getHandler('Topic'); |
|
78 | + $topicObject = $topicHandler->get($topic_id); |
|
79 | + $topic_id = $topicObject->getVar('topic_id'); |
|
80 | + $forum = $topicObject->getVar('forum_id'); |
|
81 | + if (!$approved = $topicObject->getVar('approved')) { |
|
82 | + exit(_MD_NEWBB_NORIGHTTOVIEW); |
|
83 | + } |
|
84 | 84 | |
85 | - $isAdmin = newbbIsAdmin($forumObject); |
|
86 | - if (!$isAdmin && $topicObject->getVar('approved') < 0) { |
|
87 | - exit(_MD_NEWBB_NORIGHTTOVIEW); |
|
88 | - } |
|
85 | + $isAdmin = newbbIsAdmin($forumObject); |
|
86 | + if (!$isAdmin && $topicObject->getVar('approved') < 0) { |
|
87 | + exit(_MD_NEWBB_NORIGHTTOVIEW); |
|
88 | + } |
|
89 | 89 | |
90 | - // /** @var Newbb\ForumHandler $forumHandler */ |
|
91 | - // $forumHandler = Newbb\Helper::getInstance()->getHandler('Forum'); |
|
92 | - $forum = $topicObject->getVar('forum_id'); |
|
93 | - $forumObject = $forumHandler->get($forum); |
|
94 | - if (!$forumHandler->getPermission($forumObject)) { |
|
95 | - exit(_MD_NEWBB_NORIGHTTOVIEW); |
|
96 | - } |
|
90 | + // /** @var Newbb\ForumHandler $forumHandler */ |
|
91 | + // $forumHandler = Newbb\Helper::getInstance()->getHandler('Forum'); |
|
92 | + $forum = $topicObject->getVar('forum_id'); |
|
93 | + $forumObject = $forumHandler->get($forum); |
|
94 | + if (!$forumHandler->getPermission($forumObject)) { |
|
95 | + exit(_MD_NEWBB_NORIGHTTOVIEW); |
|
96 | + } |
|
97 | 97 | |
98 | - if (!$topicHandler->getPermission($forumObject, $topicObject->getVar('topic_status'), 'view')) { |
|
99 | - exit(_MD_NEWBB_NORIGHTTOVIEW); |
|
100 | - } |
|
101 | - // irmtfan add print permission |
|
102 | - if (!$topicHandler->getPermission($forumObject, $topicObject->getVar('topic_status'), 'print')) { |
|
103 | - exit(_MD_NEWBB_NORIGHTTOPRINT); |
|
104 | - } |
|
98 | + if (!$topicHandler->getPermission($forumObject, $topicObject->getVar('topic_status'), 'view')) { |
|
99 | + exit(_MD_NEWBB_NORIGHTTOVIEW); |
|
100 | + } |
|
101 | + // irmtfan add print permission |
|
102 | + if (!$topicHandler->getPermission($forumObject, $topicObject->getVar('topic_status'), 'print')) { |
|
103 | + exit(_MD_NEWBB_NORIGHTTOPRINT); |
|
104 | + } |
|
105 | 105 | } else { |
106 | - $post_data = unserialize(base64_decode(Request::getString('post_data', '', 'POST'))); |
|
107 | - $isPost = 1; |
|
106 | + $post_data = unserialize(base64_decode(Request::getString('post_data', '', 'POST'))); |
|
107 | + $isPost = 1; |
|
108 | 108 | } |
109 | 109 | |
110 | 110 | xoops_header(false); |
111 | 111 | |
112 | 112 | if (empty($isPost)) { |
113 | - echo "</head><body style='background-color:#ffffff; color:#000000;' onload='window.print()'> |
|
113 | + echo "</head><body style='background-color:#ffffff; color:#000000;' onload='window.print()'> |
|
114 | 114 | <div style='width: 750px; border: 1px solid #000; padding: 20px;'> |
115 | 115 | <div style='text-align: center; display: block; margin: 0 0 6px 0;'> |
116 | 116 | <img src='" . XOOPS_URL . "/modules/newbb/assets/images/xoopsbb_slogo.png' border='0' alt='' /> |
117 | 117 | <br><br> "; |
118 | 118 | |
119 | - $postsArray = $topicHandler->getAllPosts($topicObject); |
|
120 | - foreach ($postsArray as $post) { |
|
121 | - if (!$post->getVar('approved')) { |
|
122 | - continue; |
|
123 | - } |
|
124 | - $post_data = $postHandler->getPostForPrint($post); |
|
125 | - echo "<h2 style='margin: 0;'>" . $post_data['subject'] . "</h2> |
|
119 | + $postsArray = $topicHandler->getAllPosts($topicObject); |
|
120 | + foreach ($postsArray as $post) { |
|
121 | + if (!$post->getVar('approved')) { |
|
122 | + continue; |
|
123 | + } |
|
124 | + $post_data = $postHandler->getPostForPrint($post); |
|
125 | + echo "<h2 style='margin: 0;'>" . $post_data['subject'] . "</h2> |
|
126 | 126 | <div align='center'>" . _POSTEDBY . ' ' . $post_data['author'] . ' ' . _ON . ' ' . formatTimestamp($post_data['date']) . "</div> |
127 | 127 | <div style='text-align: center; display: block; padding-bottom: 12px; margin: 0 0 6px 0; border-bottom: 2px solid #ccc;'></div> |
128 | 128 | <div>" . $post_data['text'] . "</div> |
129 | 129 | <div style='padding-top: 12px; border-top: 2px solid #ccc;'></div><br>"; |
130 | - } |
|
131 | - echo '<p>' . _MD_NEWBB_COMEFROM . ' ' . XOOPS_URL . '/newbb/viewtopic.php?forum=' . $forum_id . '&topic_id=' . $topic_id . '</p>'; |
|
132 | - echo '</div></div>'; |
|
133 | - echo '</body></html>'; |
|
130 | + } |
|
131 | + echo '<p>' . _MD_NEWBB_COMEFROM . ' ' . XOOPS_URL . '/newbb/viewtopic.php?forum=' . $forum_id . '&topic_id=' . $topic_id . '</p>'; |
|
132 | + echo '</div></div>'; |
|
133 | + echo '</body></html>'; |
|
134 | 134 | } else { |
135 | - echo "</head><body style='background-color:#ffffff; color:#000000;' onload='window.print()'> |
|
135 | + echo "</head><body style='background-color:#ffffff; color:#000000;' onload='window.print()'> |
|
136 | 136 | <div style='width: 750px; border: 1px solid #000; padding: 20px;'> |
137 | 137 | <div style='text-align: center; display: block; margin: 0 0 6px 0;'> |
138 | 138 | <h2 style='margin: 0;'>" . $post_data['subject'] . "</h2></div> |
@@ -16,7 +16,7 @@ discard block |
||
16 | 16 | define('XOOPS_XMLRPC', 1); |
17 | 17 | } |
18 | 18 | ob_start(); |
19 | -require_once __DIR__ . '/header.php'; |
|
19 | +require_once __DIR__.'/header.php'; |
|
20 | 20 | if (0 == $GLOBALS['xoopsModuleConfig']['email_digest']) { |
21 | 21 | echo '<br>Not set'; |
22 | 22 | |
@@ -25,6 +25,6 @@ discard block |
||
25 | 25 | /** @var Newbb\DigestHandler $digestHandler */ |
26 | 26 | $digestHandler = Newbb\Helper::getInstance()->getHandler('Digest'); |
27 | 27 | $msg = $digestHandler->process(); |
28 | -$msg .= ob_get_contents(); |
|
28 | +$msg .= ob_get_contents(); |
|
29 | 29 | ob_end_clean(); |
30 | -echo '<br>' . $msg; |
|
30 | +echo '<br>'.$msg; |
@@ -13,14 +13,14 @@ |
||
13 | 13 | |
14 | 14 | // Why the skip-DB-security check defined only for XMLRPC? We also need it!!! ~_* |
15 | 15 | if (!defined('XOOPS_XMLRPC')) { |
16 | - define('XOOPS_XMLRPC', 1); |
|
16 | + define('XOOPS_XMLRPC', 1); |
|
17 | 17 | } |
18 | 18 | ob_start(); |
19 | 19 | require_once __DIR__ . '/header.php'; |
20 | 20 | if (0 == $GLOBALS['xoopsModuleConfig']['email_digest']) { |
21 | - echo '<br>Not set'; |
|
21 | + echo '<br>Not set'; |
|
22 | 22 | |
23 | - return false; |
|
23 | + return false; |
|
24 | 24 | } |
25 | 25 | /** @var Newbb\DigestHandler $digestHandler */ |
26 | 26 | $digestHandler = Newbb\Helper::getInstance()->getHandler('Digest'); |
@@ -31,7 +31,7 @@ discard block |
||
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 | |
36 | 36 | $op = $op = Request::getCmd('op', Request::getCmd('op', '', 'POST'), 'GET'); //!empty($_GET['op'])? $_GET['op'] : (!empty($_POST['op'])?$_POST['op']:""); |
37 | 37 | |
@@ -39,10 +39,10 @@ discard block |
||
39 | 39 | case 'delvotes': |
40 | 40 | $rid = Request::getInt('rid', 0, 'GET'); |
41 | 41 | $topic_id = Request::getInt('topic_id', 0, 'GET'); |
42 | - $sql = $GLOBALS['xoopsDB']->queryF('DELETE FROM ' . $GLOBALS['xoopsDB']->prefix('newbb_votedata') . " WHERE ratingid = $rid"); |
|
42 | + $sql = $GLOBALS['xoopsDB']->queryF('DELETE FROM '.$GLOBALS['xoopsDB']->prefix('newbb_votedata')." WHERE ratingid = $rid"); |
|
43 | 43 | $GLOBALS['xoopsDB']->query($sql); |
44 | 44 | |
45 | - $query = 'SELECT rating FROM ' . $GLOBALS['xoopsDB']->prefix('newbb_votedata') . ' WHERE topic_id = ' . $topic_id . ' '; |
|
45 | + $query = 'SELECT rating FROM '.$GLOBALS['xoopsDB']->prefix('newbb_votedata').' WHERE topic_id = '.$topic_id.' '; |
|
46 | 46 | $voteresult = $GLOBALS['xoopsDB']->query($query); |
47 | 47 | $votesDB = $GLOBALS['xoopsDB']->getRowsNum($voteresult); |
48 | 48 | $totalrating = 0; |
@@ -63,11 +63,11 @@ discard block |
||
63 | 63 | $useravgrating = '0'; |
64 | 64 | $uservotes = '0'; |
65 | 65 | |
66 | - $sql = 'SELECT * FROM ' . $GLOBALS['xoopsDB']->prefix('newbb_votedata') . ' ORDER BY ratingtimestamp DESC'; |
|
66 | + $sql = 'SELECT * FROM '.$GLOBALS['xoopsDB']->prefix('newbb_votedata').' ORDER BY ratingtimestamp DESC'; |
|
67 | 67 | $results = $GLOBALS['xoopsDB']->query($sql, 20, $start); |
68 | 68 | $votes = $GLOBALS['xoopsDB']->getRowsNum($results); |
69 | 69 | |
70 | - $sql = 'SELECT rating FROM ' . $GLOBALS['xoopsDB']->prefix('newbb_votedata') . ' '; |
|
70 | + $sql = 'SELECT rating FROM '.$GLOBALS['xoopsDB']->prefix('newbb_votedata').' '; |
|
71 | 71 | $result2 = $GLOBALS['xoopsDB']->query($sql, 20, $start); |
72 | 72 | $uservotes = $GLOBALS['xoopsDB']->getRowsNum($result2); |
73 | 73 | $useravgrating = 0; |
@@ -86,28 +86,28 @@ discard block |
||
86 | 86 | $adminObject->displayNavigation(basename(__FILE__)); |
87 | 87 | |
88 | 88 | echo "<div style='padding: 8px;'>\n |
89 | - <div><strong>" . _AM_NEWBB_VOTE_USERAVG . ": </strong>$useravgrating</div>\n |
|
90 | - <div><strong>" . _AM_NEWBB_VOTE_TOTALRATE . ": </strong>$uservotes</div>\n |
|
89 | + <div><strong>" . _AM_NEWBB_VOTE_USERAVG.": </strong>$useravgrating</div>\n |
|
90 | + <div><strong>"._AM_NEWBB_VOTE_TOTALRATE.": </strong>$uservotes</div>\n |
|
91 | 91 | <div style='padding: 8px;'>\n |
92 | - <ul><li> " . _AM_NEWBB_VOTE_DELETEDSC . "</li></ul> |
|
92 | + <ul><li> "._AM_NEWBB_VOTE_DELETEDSC."</li></ul> |
|
93 | 93 | <div>\n |
94 | 94 | <br>\n |
95 | 95 | <table width='100%' border='0' cellspacing='1' class='outer'>" . "<tr><td class='odd'> |
96 | 96 | <table width='100%' cellspacing='1' cellpadding='2' class='outer'>\n |
97 | 97 | <tr>\n |
98 | - <th align='center'>" . _AM_NEWBB_VOTE_ID . "</th>\n |
|
99 | - <th align='center'>" . _AM_NEWBB_VOTE_USER . "</th>\n |
|
100 | - <th align='center'>" . _AM_NEWBB_VOTE_IP . "</th>\n |
|
101 | - <th align='center'>" . _AM_NEWBB_VOTE_FILETITLE . "</th>\n |
|
102 | - <th align='center'>" . _AM_NEWBB_VOTE_RATING . "</th>\n |
|
103 | - <th align='center'>" . _AM_NEWBB_VOTE_DATE . "</th>\n |
|
104 | - <th align='center'>" . _AM_NEWBB_ACTION . "</th></tr>\n"; |
|
98 | + <th align='center'>" . _AM_NEWBB_VOTE_ID."</th>\n |
|
99 | + <th align='center'>" . _AM_NEWBB_VOTE_USER."</th>\n |
|
100 | + <th align='center'>" . _AM_NEWBB_VOTE_IP."</th>\n |
|
101 | + <th align='center'>" . _AM_NEWBB_VOTE_FILETITLE."</th>\n |
|
102 | + <th align='center'>" . _AM_NEWBB_VOTE_RATING."</th>\n |
|
103 | + <th align='center'>" . _AM_NEWBB_VOTE_DATE."</th>\n |
|
104 | + <th align='center'>" . _AM_NEWBB_ACTION."</th></tr>\n"; |
|
105 | 105 | |
106 | 106 | if (0 == $votes) { |
107 | - echo "<tr><td align='center' colspan='7' class='head'>" . _AM_NEWBB_VOTE_NOVOTES . '</td></tr>'; |
|
107 | + echo "<tr><td align='center' colspan='7' class='head'>"._AM_NEWBB_VOTE_NOVOTES.'</td></tr>'; |
|
108 | 108 | } |
109 | 109 | while (false !== (list($ratingid, $topic_id, $ratinguser, $rating, $ratinghostname, $ratingtimestamp) = $GLOBALS['xoopsDB']->fetchRow($results))) { |
110 | - $sql = 'SELECT topic_title FROM ' . $GLOBALS['xoopsDB']->prefix('newbb_topics') . ' WHERE topic_id=' . $topic_id . ' '; |
|
110 | + $sql = 'SELECT topic_title FROM '.$GLOBALS['xoopsDB']->prefix('newbb_topics').' WHERE topic_id='.$topic_id.' '; |
|
111 | 111 | $down_array = $GLOBALS['xoopsDB']->fetchArray($GLOBALS['xoopsDB']->query($sql)); |
112 | 112 | |
113 | 113 | $formatted_date = formatTimestamp($ratingtimestamp, _DATESTRING); |
@@ -117,10 +117,10 @@ discard block |
||
117 | 117 | <td class='head' align='center'>$ratingid</td>\n |
118 | 118 | <td class='even' align='center'>$ratinguname</td>\n |
119 | 119 | <td class='even' align='center' >$ratinghostname</td>\n |
120 | - <td class='even' align='left'><a href='" . XOOPS_URL . '/modules/newbb/viewtopic.php?topic_id=' . $topic_id . "' target='topic'>" . $myts->htmlSpecialChars($down_array['topic_title']) . "</a></td>\n |
|
120 | + <td class='even' align='left'><a href='".XOOPS_URL.'/modules/newbb/viewtopic.php?topic_id='.$topic_id."' target='topic'>".$myts->htmlSpecialChars($down_array['topic_title'])."</a></td>\n |
|
121 | 121 | <td class='even' align='center'>$rating</td>\n |
122 | 122 | <td class='even' align='center'>$formatted_date</td>\n |
123 | - <td class='even' align='center'><strong><a href='admin_votedata.php?op=delvotes&topic_id=$topic_id&rid=$ratingid'>" . newbbDisplayImage('p_delete', _DELETE) . "</a></strong></td>\n |
|
123 | + <td class='even' align='center'><strong><a href='admin_votedata.php?op=delvotes&topic_id=$topic_id&rid=$ratingid'>".newbbDisplayImage('p_delete', _DELETE)."</a></strong></td>\n |
|
124 | 124 | </tr>\n"; |
125 | 125 | } |
126 | 126 | echo '</table>'; |
@@ -129,11 +129,11 @@ discard block |
||
129 | 129 | require_once $GLOBALS['xoops']->path('class/pagenav.php'); |
130 | 130 | $page = ($votes > 10) ? _AM_NEWBB_INDEX_PAGE : ''; |
131 | 131 | $pagenav = new \XoopsPageNav($page, 20, $start, 'start'); |
132 | - echo '<div align="right" style="padding: 8px;">' . $page . '' . $pagenav->renderImageNav(4) . '</div>'; |
|
132 | + echo '<div align="right" style="padding: 8px;">'.$page.''.$pagenav->renderImageNav(4).'</div>'; |
|
133 | 133 | echo '<fieldset>'; |
134 | - echo '<legend> ' . _MI_NEWBB_ADMENU_VOTE . ' </legend>'; |
|
134 | + echo '<legend> '._MI_NEWBB_ADMENU_VOTE.' </legend>'; |
|
135 | 135 | echo _AM_NEWBB_HELP_VOTE_TAB; |
136 | 136 | echo '</fieldset>'; |
137 | 137 | break; |
138 | 138 | } |
139 | -require_once __DIR__ . '/admin_footer.php'; |
|
139 | +require_once __DIR__.'/admin_footer.php'; |
@@ -36,56 +36,56 @@ discard block |
||
36 | 36 | $op = $op = Request::getCmd('op', Request::getCmd('op', '', 'POST'), 'GET'); //!empty($_GET['op'])? $_GET['op'] : (!empty($_POST['op'])?$_POST['op']:""); |
37 | 37 | |
38 | 38 | switch ($op) { |
39 | - case 'delvotes': |
|
40 | - $rid = Request::getInt('rid', 0, 'GET'); |
|
41 | - $topic_id = Request::getInt('topic_id', 0, 'GET'); |
|
42 | - $sql = $GLOBALS['xoopsDB']->queryF('DELETE FROM ' . $GLOBALS['xoopsDB']->prefix('newbb_votedata') . " WHERE ratingid = $rid"); |
|
43 | - $GLOBALS['xoopsDB']->query($sql); |
|
39 | + case 'delvotes': |
|
40 | + $rid = Request::getInt('rid', 0, 'GET'); |
|
41 | + $topic_id = Request::getInt('topic_id', 0, 'GET'); |
|
42 | + $sql = $GLOBALS['xoopsDB']->queryF('DELETE FROM ' . $GLOBALS['xoopsDB']->prefix('newbb_votedata') . " WHERE ratingid = $rid"); |
|
43 | + $GLOBALS['xoopsDB']->query($sql); |
|
44 | 44 | |
45 | - $query = 'SELECT rating FROM ' . $GLOBALS['xoopsDB']->prefix('newbb_votedata') . ' WHERE topic_id = ' . $topic_id . ' '; |
|
46 | - $voteresult = $GLOBALS['xoopsDB']->query($query); |
|
47 | - $votesDB = $GLOBALS['xoopsDB']->getRowsNum($voteresult); |
|
48 | - $totalrating = 0; |
|
49 | - while (false !== (list($rating) = $GLOBALS['xoopsDB']->fetchRow($voteresult))) { |
|
50 | - $totalrating += $rating; |
|
51 | - } |
|
52 | - $finalrating = $totalrating / $votesDB; |
|
53 | - $finalrating = number_format($finalrating, 4); |
|
54 | - $sql = sprintf('UPDATE `%s` SET rating = %u, votes = %u WHERE topic_id = %u', $GLOBALS['xoopsDB']->prefix('newbb_topics'), $finalrating, $votesDB, $topic_id); |
|
55 | - $GLOBALS['xoopsDB']->queryF($sql); |
|
45 | + $query = 'SELECT rating FROM ' . $GLOBALS['xoopsDB']->prefix('newbb_votedata') . ' WHERE topic_id = ' . $topic_id . ' '; |
|
46 | + $voteresult = $GLOBALS['xoopsDB']->query($query); |
|
47 | + $votesDB = $GLOBALS['xoopsDB']->getRowsNum($voteresult); |
|
48 | + $totalrating = 0; |
|
49 | + while (false !== (list($rating) = $GLOBALS['xoopsDB']->fetchRow($voteresult))) { |
|
50 | + $totalrating += $rating; |
|
51 | + } |
|
52 | + $finalrating = $totalrating / $votesDB; |
|
53 | + $finalrating = number_format($finalrating, 4); |
|
54 | + $sql = sprintf('UPDATE `%s` SET rating = %u, votes = %u WHERE topic_id = %u', $GLOBALS['xoopsDB']->prefix('newbb_topics'), $finalrating, $votesDB, $topic_id); |
|
55 | + $GLOBALS['xoopsDB']->queryF($sql); |
|
56 | 56 | |
57 | - redirect_header('admin_votedata.php', 1, _AM_NEWBB_VOTEDELETED); |
|
58 | - break; |
|
57 | + redirect_header('admin_votedata.php', 1, _AM_NEWBB_VOTEDELETED); |
|
58 | + break; |
|
59 | 59 | |
60 | - case 'main': |
|
61 | - default: |
|
62 | - $start = Request::getInt('start', 0, 'POST'); |
|
63 | - $useravgrating = '0'; |
|
64 | - $uservotes = '0'; |
|
60 | + case 'main': |
|
61 | + default: |
|
62 | + $start = Request::getInt('start', 0, 'POST'); |
|
63 | + $useravgrating = '0'; |
|
64 | + $uservotes = '0'; |
|
65 | 65 | |
66 | - $sql = 'SELECT * FROM ' . $GLOBALS['xoopsDB']->prefix('newbb_votedata') . ' ORDER BY ratingtimestamp DESC'; |
|
67 | - $results = $GLOBALS['xoopsDB']->query($sql, 20, $start); |
|
68 | - $votes = $GLOBALS['xoopsDB']->getRowsNum($results); |
|
66 | + $sql = 'SELECT * FROM ' . $GLOBALS['xoopsDB']->prefix('newbb_votedata') . ' ORDER BY ratingtimestamp DESC'; |
|
67 | + $results = $GLOBALS['xoopsDB']->query($sql, 20, $start); |
|
68 | + $votes = $GLOBALS['xoopsDB']->getRowsNum($results); |
|
69 | 69 | |
70 | - $sql = 'SELECT rating FROM ' . $GLOBALS['xoopsDB']->prefix('newbb_votedata') . ' '; |
|
71 | - $result2 = $GLOBALS['xoopsDB']->query($sql, 20, $start); |
|
72 | - $uservotes = $GLOBALS['xoopsDB']->getRowsNum($result2); |
|
73 | - $useravgrating = 0; |
|
70 | + $sql = 'SELECT rating FROM ' . $GLOBALS['xoopsDB']->prefix('newbb_votedata') . ' '; |
|
71 | + $result2 = $GLOBALS['xoopsDB']->query($sql, 20, $start); |
|
72 | + $uservotes = $GLOBALS['xoopsDB']->getRowsNum($result2); |
|
73 | + $useravgrating = 0; |
|
74 | 74 | |
75 | - while (false !== (list($rating2) = $GLOBALS['xoopsDB']->fetchRow($result2))) { |
|
76 | - // $useravgrating = $useravgrating + $rating2; |
|
77 | - $useravgrating += $rating2; |
|
78 | - } |
|
79 | - if ($useravgrating > 0) { |
|
80 | - // $useravgrating = $useravgrating / $uservotes; |
|
81 | - $useravgrating /= $uservotes; |
|
82 | - $useravgrating = number_format($useravgrating, 2); |
|
83 | - } |
|
75 | + while (false !== (list($rating2) = $GLOBALS['xoopsDB']->fetchRow($result2))) { |
|
76 | + // $useravgrating = $useravgrating + $rating2; |
|
77 | + $useravgrating += $rating2; |
|
78 | + } |
|
79 | + if ($useravgrating > 0) { |
|
80 | + // $useravgrating = $useravgrating / $uservotes; |
|
81 | + $useravgrating /= $uservotes; |
|
82 | + $useravgrating = number_format($useravgrating, 2); |
|
83 | + } |
|
84 | 84 | |
85 | - xoops_cp_header(); |
|
86 | - $adminObject->displayNavigation(basename(__FILE__)); |
|
85 | + xoops_cp_header(); |
|
86 | + $adminObject->displayNavigation(basename(__FILE__)); |
|
87 | 87 | |
88 | - echo "<div style='padding: 8px;'>\n |
|
88 | + echo "<div style='padding: 8px;'>\n |
|
89 | 89 | <div><strong>" . _AM_NEWBB_VOTE_USERAVG . ": </strong>$useravgrating</div>\n |
90 | 90 | <div><strong>" . _AM_NEWBB_VOTE_TOTALRATE . ": </strong>$uservotes</div>\n |
91 | 91 | <div style='padding: 8px;'>\n |
@@ -103,16 +103,16 @@ discard block |
||
103 | 103 | <th align='center'>" . _AM_NEWBB_VOTE_DATE . "</th>\n |
104 | 104 | <th align='center'>" . _AM_NEWBB_ACTION . "</th></tr>\n"; |
105 | 105 | |
106 | - if (0 == $votes) { |
|
107 | - echo "<tr><td align='center' colspan='7' class='head'>" . _AM_NEWBB_VOTE_NOVOTES . '</td></tr>'; |
|
108 | - } |
|
109 | - while (false !== (list($ratingid, $topic_id, $ratinguser, $rating, $ratinghostname, $ratingtimestamp) = $GLOBALS['xoopsDB']->fetchRow($results))) { |
|
110 | - $sql = 'SELECT topic_title FROM ' . $GLOBALS['xoopsDB']->prefix('newbb_topics') . ' WHERE topic_id=' . $topic_id . ' '; |
|
111 | - $down_array = $GLOBALS['xoopsDB']->fetchArray($GLOBALS['xoopsDB']->query($sql)); |
|
106 | + if (0 == $votes) { |
|
107 | + echo "<tr><td align='center' colspan='7' class='head'>" . _AM_NEWBB_VOTE_NOVOTES . '</td></tr>'; |
|
108 | + } |
|
109 | + while (false !== (list($ratingid, $topic_id, $ratinguser, $rating, $ratinghostname, $ratingtimestamp) = $GLOBALS['xoopsDB']->fetchRow($results))) { |
|
110 | + $sql = 'SELECT topic_title FROM ' . $GLOBALS['xoopsDB']->prefix('newbb_topics') . ' WHERE topic_id=' . $topic_id . ' '; |
|
111 | + $down_array = $GLOBALS['xoopsDB']->fetchArray($GLOBALS['xoopsDB']->query($sql)); |
|
112 | 112 | |
113 | - $formatted_date = formatTimestamp($ratingtimestamp, _DATESTRING); |
|
114 | - $ratinguname = newbbGetUnameFromId($ratinguser, $GLOBALS['xoopsModuleConfig']['show_realname']); |
|
115 | - echo " |
|
113 | + $formatted_date = formatTimestamp($ratingtimestamp, _DATESTRING); |
|
114 | + $ratinguname = newbbGetUnameFromId($ratinguser, $GLOBALS['xoopsModuleConfig']['show_realname']); |
|
115 | + echo " |
|
116 | 116 | <tr>\n |
117 | 117 | <td class='head' align='center'>$ratingid</td>\n |
118 | 118 | <td class='even' align='center'>$ratinguname</td>\n |
@@ -122,18 +122,18 @@ discard block |
||
122 | 122 | <td class='even' align='center'>$formatted_date</td>\n |
123 | 123 | <td class='even' align='center'><strong><a href='admin_votedata.php?op=delvotes&topic_id=$topic_id&rid=$ratingid'>" . newbbDisplayImage('p_delete', _DELETE) . "</a></strong></td>\n |
124 | 124 | </tr>\n"; |
125 | - } |
|
126 | - echo '</table>'; |
|
127 | - echo '</td></tr></table>'; |
|
128 | - //Include page navigation |
|
129 | - require_once $GLOBALS['xoops']->path('class/pagenav.php'); |
|
130 | - $page = ($votes > 10) ? _AM_NEWBB_INDEX_PAGE : ''; |
|
131 | - $pagenav = new \XoopsPageNav($page, 20, $start, 'start'); |
|
132 | - echo '<div align="right" style="padding: 8px;">' . $page . '' . $pagenav->renderImageNav(4) . '</div>'; |
|
133 | - echo '<fieldset>'; |
|
134 | - echo '<legend> ' . _MI_NEWBB_ADMENU_VOTE . ' </legend>'; |
|
135 | - echo _AM_NEWBB_HELP_VOTE_TAB; |
|
136 | - echo '</fieldset>'; |
|
137 | - break; |
|
125 | + } |
|
126 | + echo '</table>'; |
|
127 | + echo '</td></tr></table>'; |
|
128 | + //Include page navigation |
|
129 | + require_once $GLOBALS['xoops']->path('class/pagenav.php'); |
|
130 | + $page = ($votes > 10) ? _AM_NEWBB_INDEX_PAGE : ''; |
|
131 | + $pagenav = new \XoopsPageNav($page, 20, $start, 'start'); |
|
132 | + echo '<div align="right" style="padding: 8px;">' . $page . '' . $pagenav->renderImageNav(4) . '</div>'; |
|
133 | + echo '<fieldset>'; |
|
134 | + echo '<legend> ' . _MI_NEWBB_ADMENU_VOTE . ' </legend>'; |
|
135 | + echo _AM_NEWBB_HELP_VOTE_TAB; |
|
136 | + echo '</fieldset>'; |
|
137 | + break; |
|
138 | 138 | } |
139 | 139 | require_once __DIR__ . '/admin_footer.php'; |
@@ -29,11 +29,11 @@ |
||
29 | 29 | // Project: XOOPS Project // |
30 | 30 | // ------------------------------------------------------------------------- // |
31 | 31 | |
32 | -require_once __DIR__ . '/admin_header.php'; |
|
32 | +require_once __DIR__.'/admin_header.php'; |
|
33 | 33 | xoops_cp_header(); |
34 | 34 | |
35 | 35 | $adminObject->displayNavigation(basename(__FILE__)); |
36 | 36 | \Xmf\Module\Admin::setPaypal('PBQZ7D6LT6UBC'); |
37 | 37 | $adminObject->displayAbout(false); |
38 | 38 | |
39 | -require_once __DIR__ . '/admin_footer.php'; |
|
39 | +require_once __DIR__.'/admin_footer.php'; |
@@ -31,7 +31,7 @@ discard block |
||
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', Request::getCmd('op', 'default', 'POST'), 'GET'); // !empty($_GET['op'])? $_GET['op'] : (!empty($_POST['op'])?$_POST['op']:"default"); |
@@ -87,16 +87,16 @@ discard block |
||
87 | 87 | |
88 | 88 | //if (!$newXoopsModuleGui) loadModuleAdminMenu(7,_AM_NEWBB_DIGESTADMIN); |
89 | 89 | // else $adminObject->displayNavigation(basename(__FILE__)); |
90 | - echo '<ul><li>' . _AM_NEWBB_DIGEST_HELP_1 . '</li>'; |
|
91 | - echo '<li>' . _AM_NEWBB_DIGEST_HELP_2 . '</li>'; |
|
92 | - echo '<li>' . _AM_NEWBB_DIGEST_HELP_3 . '</li>'; |
|
93 | - echo '<li>' . _AM_NEWBB_DIGEST_HELP_4 . '</li></ul>'; |
|
94 | - echo "<table width='100%' border='0' cellspacing='1' class='outer'>" . "<tr><td class='odd'>"; |
|
95 | - echo '<form action="' . xoops_getenv('PHP_SELF') . '" method="post">'; |
|
90 | + echo '<ul><li>'._AM_NEWBB_DIGEST_HELP_1.'</li>'; |
|
91 | + echo '<li>'._AM_NEWBB_DIGEST_HELP_2.'</li>'; |
|
92 | + echo '<li>'._AM_NEWBB_DIGEST_HELP_3.'</li>'; |
|
93 | + echo '<li>'._AM_NEWBB_DIGEST_HELP_4.'</li></ul>'; |
|
94 | + echo "<table width='100%' border='0' cellspacing='1' class='outer'>"."<tr><td class='odd'>"; |
|
95 | + echo '<form action="'.xoops_getenv('PHP_SELF').'" method="post">'; |
|
96 | 96 | echo "<table border='0' cellpadding='4' cellspacing='1' width='100%' class='outer'>"; |
97 | 97 | echo "<tr align='center'>"; |
98 | - echo "<th class='bg3' width='2%'>" . _DELETE . '</th>'; |
|
99 | - echo "<th class='bg3'>" . _AM_NEWBB_DIGESTCONTENT . '</th>'; |
|
98 | + echo "<th class='bg3' width='2%'>"._DELETE.'</th>'; |
|
99 | + echo "<th class='bg3'>"._AM_NEWBB_DIGESTCONTENT.'</th>'; |
|
100 | 100 | echo '</tr>'; |
101 | 101 | |
102 | 102 | $digests = []; |
@@ -105,22 +105,22 @@ discard block |
||
105 | 105 | $digests = $digestHandler->getAllDigests($start, $limit); |
106 | 106 | foreach ($digests as $digest) { |
107 | 107 | echo "<tr class='odd' align='left'>"; |
108 | - echo "<td align='center' ><input type='checkbox' name='digest_id[" . $digest['digest_id'] . "]' value='1' /></td>"; |
|
109 | - echo '<td><strong>#' . $digest['digest_id'] . ' @ ' . formatTimestamp($digest['digest_time']) . '</strong><br>' . str_replace("\n", '<br>', $digest['digest_content']) . '</td>'; |
|
108 | + echo "<td align='center' ><input type='checkbox' name='digest_id[".$digest['digest_id']."]' value='1' /></td>"; |
|
109 | + echo '<td><strong>#'.$digest['digest_id'].' @ '.formatTimestamp($digest['digest_time']).'</strong><br>'.str_replace("\n", '<br>', $digest['digest_content']).'</td>'; |
|
110 | 110 | echo '</tr>'; |
111 | 111 | echo "<tr colspan='2'><td height='2'></td></tr>"; |
112 | 112 | } |
113 | 113 | $submit = new \XoopsFormButton('', 'submit', _SUBMIT, 'submit'); |
114 | - echo "<tr><td colspan='2' align='center'>" . $submit->render() . '</td></tr>'; |
|
114 | + echo "<tr><td colspan='2' align='center'>".$submit->render().'</td></tr>'; |
|
115 | 115 | $hidden = new \XoopsFormHidden('op', 'delete'); |
116 | 116 | echo $hidden->render(); |
117 | 117 | $hidden = new \XoopsFormHidden('item', $item); |
118 | - echo $hidden->render() . '</form>'; |
|
118 | + echo $hidden->render().'</form>'; |
|
119 | 119 | |
120 | 120 | echo '</table>'; |
121 | 121 | echo '</td></tr></table>'; |
122 | 122 | echo '<fieldset>'; |
123 | - echo '<legend> ' . _AM_NEWBB_PREFERENCES . ' - ' . _MI_NEWBB_ADMENU_DIGEST . ' </legend>'; |
|
123 | + echo '<legend> '._AM_NEWBB_PREFERENCES.' - '._MI_NEWBB_ADMENU_DIGEST.' </legend>'; |
|
124 | 124 | echo _AM_NEWBB_DIGEST_HELP_AUTO_DIGEST; |
125 | 125 | echo '</fieldset>'; |
126 | 126 | $nav = new \XoopsPageNav($digestHandler->getDigestCount(), $limit, $start, 'start'); |
@@ -128,4 +128,4 @@ discard block |
||
128 | 128 | |
129 | 129 | break; |
130 | 130 | } |
131 | -require_once __DIR__ . '/admin_footer.php'; |
|
131 | +require_once __DIR__.'/admin_footer.php'; |
@@ -42,90 +42,90 @@ |
||
42 | 42 | |
43 | 43 | xoops_cp_header(); |
44 | 44 | switch ($op) { |
45 | - case 'delete': |
|
46 | - $digest_ids = Request::getArray('digest_id', [], 'POST'); |
|
47 | - // /** @var Newbb\DigestHandler $digestHandler */ |
|
48 | - // $digestHandler = Newbb\Helper::getInstance()->getHandler('Digest'); |
|
49 | - foreach ($digest_ids as $did => $value) { |
|
50 | - $digest = $digestHandler->get($did); |
|
51 | - $digestHandler->delete($digest); |
|
52 | - } |
|
53 | - redirect_header('admin_digest.php', 1); |
|
54 | - break; |
|
45 | + case 'delete': |
|
46 | + $digest_ids = Request::getArray('digest_id', [], 'POST'); |
|
47 | + // /** @var Newbb\DigestHandler $digestHandler */ |
|
48 | + // $digestHandler = Newbb\Helper::getInstance()->getHandler('Digest'); |
|
49 | + foreach ($digest_ids as $did => $value) { |
|
50 | + $digest = $digestHandler->get($did); |
|
51 | + $digestHandler->delete($digest); |
|
52 | + } |
|
53 | + redirect_header('admin_digest.php', 1); |
|
54 | + break; |
|
55 | 55 | |
56 | - case 'digest': |
|
57 | - xoops_confirm(['op' => 'digestconfirmed'], 'admin_digest.php', _AM_NEWBB_DIGEST_CONFIRM); |
|
58 | - break; |
|
59 | - case 'digestconfirmed': |
|
60 | - $message = ''; |
|
61 | - if ('POST' === Request::getMethod()) { |
|
62 | - // $digestHandler = Newbb\Helper::getInstance()->getHandler('Digest'); |
|
56 | + case 'digest': |
|
57 | + xoops_confirm(['op' => 'digestconfirmed'], 'admin_digest.php', _AM_NEWBB_DIGEST_CONFIRM); |
|
58 | + break; |
|
59 | + case 'digestconfirmed': |
|
60 | + $message = ''; |
|
61 | + if ('POST' === Request::getMethod()) { |
|
62 | + // $digestHandler = Newbb\Helper::getInstance()->getHandler('Digest'); |
|
63 | 63 | |
64 | - switch ($digestHandler->process(true)) { |
|
65 | - case 0: |
|
66 | - $message = _AM_NEWBB_DIGEST_SENT; |
|
67 | - break; |
|
68 | - case 4: |
|
69 | - $message = _AM_NEWBB_DIGEST_NOT_SENT; |
|
70 | - break; |
|
71 | - default: |
|
72 | - $message = _AM_NEWBB_DIGEST_FAILED; |
|
73 | - break; |
|
74 | - } |
|
75 | - } |
|
76 | - redirect_header('admin_digest.php', 1, $message); |
|
77 | - break; |
|
64 | + switch ($digestHandler->process(true)) { |
|
65 | + case 0: |
|
66 | + $message = _AM_NEWBB_DIGEST_SENT; |
|
67 | + break; |
|
68 | + case 4: |
|
69 | + $message = _AM_NEWBB_DIGEST_NOT_SENT; |
|
70 | + break; |
|
71 | + default: |
|
72 | + $message = _AM_NEWBB_DIGEST_FAILED; |
|
73 | + break; |
|
74 | + } |
|
75 | + } |
|
76 | + redirect_header('admin_digest.php', 1, $message); |
|
77 | + break; |
|
78 | 78 | |
79 | - default: |
|
80 | - require_once $GLOBALS['xoops']->path('class/xoopsformloader.php'); |
|
79 | + default: |
|
80 | + require_once $GLOBALS['xoops']->path('class/xoopsformloader.php'); |
|
81 | 81 | |
82 | - $limit = 5; |
|
83 | - $adminObject->displayNavigation(basename(__FILE__)); |
|
82 | + $limit = 5; |
|
83 | + $adminObject->displayNavigation(basename(__FILE__)); |
|
84 | 84 | |
85 | - $adminObject->addItemButton(_AM_NEWBB_DIGEST, 'admin_digest.php?op=digest', $icon = 'add'); |
|
86 | - $adminObject->displayButton('left'); |
|
85 | + $adminObject->addItemButton(_AM_NEWBB_DIGEST, 'admin_digest.php?op=digest', $icon = 'add'); |
|
86 | + $adminObject->displayButton('left'); |
|
87 | 87 | |
88 | - //if (!$newXoopsModuleGui) loadModuleAdminMenu(7,_AM_NEWBB_DIGESTADMIN); |
|
89 | - // else $adminObject->displayNavigation(basename(__FILE__)); |
|
90 | - echo '<ul><li>' . _AM_NEWBB_DIGEST_HELP_1 . '</li>'; |
|
91 | - echo '<li>' . _AM_NEWBB_DIGEST_HELP_2 . '</li>'; |
|
92 | - echo '<li>' . _AM_NEWBB_DIGEST_HELP_3 . '</li>'; |
|
93 | - echo '<li>' . _AM_NEWBB_DIGEST_HELP_4 . '</li></ul>'; |
|
94 | - echo "<table width='100%' border='0' cellspacing='1' class='outer'>" . "<tr><td class='odd'>"; |
|
95 | - echo '<form action="' . xoops_getenv('PHP_SELF') . '" method="post">'; |
|
96 | - echo "<table border='0' cellpadding='4' cellspacing='1' width='100%' class='outer'>"; |
|
97 | - echo "<tr align='center'>"; |
|
98 | - echo "<th class='bg3' width='2%'>" . _DELETE . '</th>'; |
|
99 | - echo "<th class='bg3'>" . _AM_NEWBB_DIGESTCONTENT . '</th>'; |
|
100 | - echo '</tr>'; |
|
88 | + //if (!$newXoopsModuleGui) loadModuleAdminMenu(7,_AM_NEWBB_DIGESTADMIN); |
|
89 | + // else $adminObject->displayNavigation(basename(__FILE__)); |
|
90 | + echo '<ul><li>' . _AM_NEWBB_DIGEST_HELP_1 . '</li>'; |
|
91 | + echo '<li>' . _AM_NEWBB_DIGEST_HELP_2 . '</li>'; |
|
92 | + echo '<li>' . _AM_NEWBB_DIGEST_HELP_3 . '</li>'; |
|
93 | + echo '<li>' . _AM_NEWBB_DIGEST_HELP_4 . '</li></ul>'; |
|
94 | + echo "<table width='100%' border='0' cellspacing='1' class='outer'>" . "<tr><td class='odd'>"; |
|
95 | + echo '<form action="' . xoops_getenv('PHP_SELF') . '" method="post">'; |
|
96 | + echo "<table border='0' cellpadding='4' cellspacing='1' width='100%' class='outer'>"; |
|
97 | + echo "<tr align='center'>"; |
|
98 | + echo "<th class='bg3' width='2%'>" . _DELETE . '</th>'; |
|
99 | + echo "<th class='bg3'>" . _AM_NEWBB_DIGESTCONTENT . '</th>'; |
|
100 | + echo '</tr>'; |
|
101 | 101 | |
102 | - $digests = []; |
|
103 | - // /** @var Newbb\DigestHandler $digestHandler */ |
|
104 | - // $digestHandler = Newbb\Helper::getInstance()->getHandler('Digest'); |
|
105 | - $digests = $digestHandler->getAllDigests($start, $limit); |
|
106 | - foreach ($digests as $digest) { |
|
107 | - echo "<tr class='odd' align='left'>"; |
|
108 | - echo "<td align='center' ><input type='checkbox' name='digest_id[" . $digest['digest_id'] . "]' value='1' /></td>"; |
|
109 | - echo '<td><strong>#' . $digest['digest_id'] . ' @ ' . formatTimestamp($digest['digest_time']) . '</strong><br>' . str_replace("\n", '<br>', $digest['digest_content']) . '</td>'; |
|
110 | - echo '</tr>'; |
|
111 | - echo "<tr colspan='2'><td height='2'></td></tr>"; |
|
112 | - } |
|
113 | - $submit = new \XoopsFormButton('', 'submit', _SUBMIT, 'submit'); |
|
114 | - echo "<tr><td colspan='2' align='center'>" . $submit->render() . '</td></tr>'; |
|
115 | - $hidden = new \XoopsFormHidden('op', 'delete'); |
|
116 | - echo $hidden->render(); |
|
117 | - $hidden = new \XoopsFormHidden('item', $item); |
|
118 | - echo $hidden->render() . '</form>'; |
|
102 | + $digests = []; |
|
103 | + // /** @var Newbb\DigestHandler $digestHandler */ |
|
104 | + // $digestHandler = Newbb\Helper::getInstance()->getHandler('Digest'); |
|
105 | + $digests = $digestHandler->getAllDigests($start, $limit); |
|
106 | + foreach ($digests as $digest) { |
|
107 | + echo "<tr class='odd' align='left'>"; |
|
108 | + echo "<td align='center' ><input type='checkbox' name='digest_id[" . $digest['digest_id'] . "]' value='1' /></td>"; |
|
109 | + echo '<td><strong>#' . $digest['digest_id'] . ' @ ' . formatTimestamp($digest['digest_time']) . '</strong><br>' . str_replace("\n", '<br>', $digest['digest_content']) . '</td>'; |
|
110 | + echo '</tr>'; |
|
111 | + echo "<tr colspan='2'><td height='2'></td></tr>"; |
|
112 | + } |
|
113 | + $submit = new \XoopsFormButton('', 'submit', _SUBMIT, 'submit'); |
|
114 | + echo "<tr><td colspan='2' align='center'>" . $submit->render() . '</td></tr>'; |
|
115 | + $hidden = new \XoopsFormHidden('op', 'delete'); |
|
116 | + echo $hidden->render(); |
|
117 | + $hidden = new \XoopsFormHidden('item', $item); |
|
118 | + echo $hidden->render() . '</form>'; |
|
119 | 119 | |
120 | - echo '</table>'; |
|
121 | - echo '</td></tr></table>'; |
|
122 | - echo '<fieldset>'; |
|
123 | - echo '<legend> ' . _AM_NEWBB_PREFERENCES . ' - ' . _MI_NEWBB_ADMENU_DIGEST . ' </legend>'; |
|
124 | - echo _AM_NEWBB_DIGEST_HELP_AUTO_DIGEST; |
|
125 | - echo '</fieldset>'; |
|
126 | - $nav = new \XoopsPageNav($digestHandler->getDigestCount(), $limit, $start, 'start'); |
|
127 | - echo $nav->renderNav(4); |
|
120 | + echo '</table>'; |
|
121 | + echo '</td></tr></table>'; |
|
122 | + echo '<fieldset>'; |
|
123 | + echo '<legend> ' . _AM_NEWBB_PREFERENCES . ' - ' . _MI_NEWBB_ADMENU_DIGEST . ' </legend>'; |
|
124 | + echo _AM_NEWBB_DIGEST_HELP_AUTO_DIGEST; |
|
125 | + echo '</fieldset>'; |
|
126 | + $nav = new \XoopsPageNav($digestHandler->getDigestCount(), $limit, $start, 'start'); |
|
127 | + echo $nav->renderNav(4); |
|
128 | 128 | |
129 | - break; |
|
129 | + break; |
|
130 | 130 | } |
131 | 131 | require_once __DIR__ . '/admin_footer.php'; |
@@ -31,7 +31,7 @@ discard block |
||
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 | |
36 | 36 | $cat_orders = Request::getArray('cat_orders', null, 'POST'); |
37 | 37 | $orders = Request::getArray('orders', null, 'POST'); |
@@ -41,14 +41,14 @@ discard block |
||
41 | 41 | if (Request::getString('submit', '', 'POST')) { |
42 | 42 | $catOrdersCount = count($cat_orders); |
43 | 43 | for ($i = 0; $i < $catOrdersCount; ++$i) { |
44 | - $sql = 'update ' . $GLOBALS['xoopsDB']->prefix('newbb_categories') . ' set cat_order = ' . $cat_orders[$i] . " WHERE cat_id=$cat[$i]"; |
|
44 | + $sql = 'update '.$GLOBALS['xoopsDB']->prefix('newbb_categories').' set cat_order = '.$cat_orders[$i]." WHERE cat_id=$cat[$i]"; |
|
45 | 45 | if (!$result = $GLOBALS['xoopsDB']->query($sql)) { |
46 | 46 | redirect_header('admin_forum_reorder.php', 1, _AM_NEWBB_FORUM_ERROR); |
47 | 47 | } |
48 | 48 | } |
49 | 49 | $ordersCount = count($orders); |
50 | 50 | for ($i = 0; $i < $ordersCount; ++$i) { |
51 | - $sql = 'update ' . $GLOBALS['xoopsDB']->prefix('newbb_forums') . ' set forum_order = ' . $orders[$i] . ' WHERE forum_id=' . $forum[$i]; |
|
51 | + $sql = 'update '.$GLOBALS['xoopsDB']->prefix('newbb_forums').' set forum_order = '.$orders[$i].' WHERE forum_id='.$forum[$i]; |
|
52 | 52 | if (!$result = $GLOBALS['xoopsDB']->query($sql)) { |
53 | 53 | redirect_header('admin_forum_reorder.php', 1, _AM_NEWBB_FORUM_ERROR); |
54 | 54 | } |
@@ -65,14 +65,14 @@ discard block |
||
65 | 65 | |
66 | 66 | $adminObject->displayNavigation(basename(__FILE__)); |
67 | 67 | |
68 | - echo "<table width='100%' border='0' cellspacing='1' class='outer'>" . "<tr><td class='odd'>"; |
|
68 | + echo "<table width='100%' border='0' cellspacing='1' class='outer'>"."<tr><td class='odd'>"; |
|
69 | 69 | $tform = new \XoopsThemeForm(_AM_NEWBB_SETFORUMORDER, '', ''); |
70 | 70 | $tform->display(); |
71 | 71 | echo "<form name='reorder' method='post'>"; |
72 | 72 | echo "<table border='0' width='100%' cellpadding='2' cellspacing='1' class='outer'>"; |
73 | 73 | echo '<tr>'; |
74 | - echo "<td class='head' align='left' width='60%'><strong>" . _AM_NEWBB_REORDERTITLE . '</strong></td>'; |
|
75 | - echo "<td class='head' align='center'><strong>" . _AM_NEWBB_REORDERWEIGHT . '</strong></td>'; |
|
74 | + echo "<td class='head' align='left' width='60%'><strong>"._AM_NEWBB_REORDERTITLE.'</strong></td>'; |
|
75 | + echo "<td class='head' align='center'><strong>"._AM_NEWBB_REORDERWEIGHT.'</strong></td>'; |
|
76 | 76 | echo '</tr>'; |
77 | 77 | |
78 | 78 | // /** @var Newbb\ForumHandler $forumHandler */ |
@@ -85,10 +85,10 @@ discard block |
||
85 | 85 | $forums = $forumHandler->getTree(array_keys($categories), 0, 'all', ' '); |
86 | 86 | foreach (array_keys($categories) as $c) { |
87 | 87 | echo '<tr>'; |
88 | - echo "<td align='left' nowrap='nowrap' class='head' >" . $categories[$c]->getVar('cat_title') . '</td>'; |
|
88 | + echo "<td align='left' nowrap='nowrap' class='head' >".$categories[$c]->getVar('cat_title').'</td>'; |
|
89 | 89 | echo "<td align='right' class='head'>"; |
90 | - echo "<input type='text' name='cat_orders[]' value='" . $categories[$c]->getVar('cat_order') . "' size='5' maxlength='5' />"; |
|
91 | - echo "<input type='hidden' name='cat[]' value='" . $c . "' />"; |
|
90 | + echo "<input type='text' name='cat_orders[]' value='".$categories[$c]->getVar('cat_order')."' size='5' maxlength='5' />"; |
|
91 | + echo "<input type='hidden' name='cat[]' value='".$c."' />"; |
|
92 | 92 | echo '</td>'; |
93 | 93 | echo '</tr>'; |
94 | 94 | |
@@ -99,24 +99,24 @@ discard block |
||
99 | 99 | foreach ($forums[$c] as $key => $forum) { |
100 | 100 | echo '<tr>'; |
101 | 101 | $class = ((++$i) % 2) ? 'odd' : 'even'; |
102 | - echo "<td align='left' nowrap='nowrap' class='" . $class . "'>" . $forum['prefix'] . $forum['forum_name'] . '</td>'; |
|
103 | - echo "<td align='left' class='" . $class . "'>"; |
|
104 | - echo $forum['prefix'] . "<input type='text' name='orders[]' value='" . $forum['forum_order'] . "' size='5' maxlength='5' />"; |
|
105 | - echo "<input type='hidden' name='forum[]' value='" . $key . "' />"; |
|
102 | + echo "<td align='left' nowrap='nowrap' class='".$class."'>".$forum['prefix'].$forum['forum_name'].'</td>'; |
|
103 | + echo "<td align='left' class='".$class."'>"; |
|
104 | + echo $forum['prefix']."<input type='text' name='orders[]' value='".$forum['forum_order']."' size='5' maxlength='5' />"; |
|
105 | + echo "<input type='hidden' name='forum[]' value='".$key."' />"; |
|
106 | 106 | echo '</td>'; |
107 | 107 | echo '</tr>'; |
108 | 108 | } |
109 | 109 | } |
110 | 110 | echo "<tr><td class='even' align='center' colspan='6'>"; |
111 | 111 | |
112 | - echo "<input type='submit' name='submit' value='" . _SUBMIT . "' />"; |
|
112 | + echo "<input type='submit' name='submit' value='"._SUBMIT."' />"; |
|
113 | 113 | echo '</td></tr>'; |
114 | 114 | echo '</table>'; |
115 | 115 | echo '</form>'; |
116 | 116 | echo '</td></tr></table>'; |
117 | 117 | echo '<fieldset>'; |
118 | - echo '<legend> ' . _MI_NEWBB_ADMENU_ORDER . ' </legend>'; |
|
118 | + echo '<legend> '._MI_NEWBB_ADMENU_ORDER.' </legend>'; |
|
119 | 119 | echo _AM_NEWBB_HELP_ORDER_TAB; |
120 | 120 | echo '</fieldset>'; |
121 | 121 | } |
122 | -require_once __DIR__ . '/admin_footer.php'; |
|
122 | +require_once __DIR__.'/admin_footer.php'; |
@@ -39,84 +39,84 @@ |
||
39 | 39 | $forum = Request::getArray('forum', null, 'POST'); |
40 | 40 | |
41 | 41 | if (Request::getString('submit', '', 'POST')) { |
42 | - $catOrdersCount = count($cat_orders); |
|
43 | - for ($i = 0; $i < $catOrdersCount; ++$i) { |
|
44 | - $sql = 'update ' . $GLOBALS['xoopsDB']->prefix('newbb_categories') . ' set cat_order = ' . $cat_orders[$i] . " WHERE cat_id=$cat[$i]"; |
|
45 | - if (!$result = $GLOBALS['xoopsDB']->query($sql)) { |
|
46 | - redirect_header('admin_forum_reorder.php', 1, _AM_NEWBB_FORUM_ERROR); |
|
47 | - } |
|
48 | - } |
|
49 | - $ordersCount = count($orders); |
|
50 | - for ($i = 0; $i < $ordersCount; ++$i) { |
|
51 | - $sql = 'update ' . $GLOBALS['xoopsDB']->prefix('newbb_forums') . ' set forum_order = ' . $orders[$i] . ' WHERE forum_id=' . $forum[$i]; |
|
52 | - if (!$result = $GLOBALS['xoopsDB']->query($sql)) { |
|
53 | - redirect_header('admin_forum_reorder.php', 1, _AM_NEWBB_FORUM_ERROR); |
|
54 | - } |
|
55 | - } |
|
56 | - redirect_header('admin_forum_reorder.php', 1, _AM_NEWBB_BOARDREORDER); |
|
42 | + $catOrdersCount = count($cat_orders); |
|
43 | + for ($i = 0; $i < $catOrdersCount; ++$i) { |
|
44 | + $sql = 'update ' . $GLOBALS['xoopsDB']->prefix('newbb_categories') . ' set cat_order = ' . $cat_orders[$i] . " WHERE cat_id=$cat[$i]"; |
|
45 | + if (!$result = $GLOBALS['xoopsDB']->query($sql)) { |
|
46 | + redirect_header('admin_forum_reorder.php', 1, _AM_NEWBB_FORUM_ERROR); |
|
47 | + } |
|
48 | + } |
|
49 | + $ordersCount = count($orders); |
|
50 | + for ($i = 0; $i < $ordersCount; ++$i) { |
|
51 | + $sql = 'update ' . $GLOBALS['xoopsDB']->prefix('newbb_forums') . ' set forum_order = ' . $orders[$i] . ' WHERE forum_id=' . $forum[$i]; |
|
52 | + if (!$result = $GLOBALS['xoopsDB']->query($sql)) { |
|
53 | + redirect_header('admin_forum_reorder.php', 1, _AM_NEWBB_FORUM_ERROR); |
|
54 | + } |
|
55 | + } |
|
56 | + redirect_header('admin_forum_reorder.php', 1, _AM_NEWBB_BOARDREORDER); |
|
57 | 57 | } else { |
58 | - require_once $GLOBALS['xoops']->path('class/xoopsformloader.php'); |
|
59 | - $orders = []; |
|
60 | - $cat_orders = []; |
|
61 | - $forum = []; |
|
62 | - $cat = []; |
|
58 | + require_once $GLOBALS['xoops']->path('class/xoopsformloader.php'); |
|
59 | + $orders = []; |
|
60 | + $cat_orders = []; |
|
61 | + $forum = []; |
|
62 | + $cat = []; |
|
63 | 63 | |
64 | - xoops_cp_header(); |
|
64 | + xoops_cp_header(); |
|
65 | 65 | |
66 | - $adminObject->displayNavigation(basename(__FILE__)); |
|
66 | + $adminObject->displayNavigation(basename(__FILE__)); |
|
67 | 67 | |
68 | - echo "<table width='100%' border='0' cellspacing='1' class='outer'>" . "<tr><td class='odd'>"; |
|
69 | - $tform = new \XoopsThemeForm(_AM_NEWBB_SETFORUMORDER, '', ''); |
|
70 | - $tform->display(); |
|
71 | - echo "<form name='reorder' method='post'>"; |
|
72 | - echo "<table border='0' width='100%' cellpadding='2' cellspacing='1' class='outer'>"; |
|
73 | - echo '<tr>'; |
|
74 | - echo "<td class='head' align='left' width='60%'><strong>" . _AM_NEWBB_REORDERTITLE . '</strong></td>'; |
|
75 | - echo "<td class='head' align='center'><strong>" . _AM_NEWBB_REORDERWEIGHT . '</strong></td>'; |
|
76 | - echo '</tr>'; |
|
68 | + echo "<table width='100%' border='0' cellspacing='1' class='outer'>" . "<tr><td class='odd'>"; |
|
69 | + $tform = new \XoopsThemeForm(_AM_NEWBB_SETFORUMORDER, '', ''); |
|
70 | + $tform->display(); |
|
71 | + echo "<form name='reorder' method='post'>"; |
|
72 | + echo "<table border='0' width='100%' cellpadding='2' cellspacing='1' class='outer'>"; |
|
73 | + echo '<tr>'; |
|
74 | + echo "<td class='head' align='left' width='60%'><strong>" . _AM_NEWBB_REORDERTITLE . '</strong></td>'; |
|
75 | + echo "<td class='head' align='center'><strong>" . _AM_NEWBB_REORDERWEIGHT . '</strong></td>'; |
|
76 | + echo '</tr>'; |
|
77 | 77 | |
78 | - // /** @var Newbb\ForumHandler $forumHandler */ |
|
79 | - // $forumHandler = Newbb\Helper::getInstance()->getHandler('Forum'); |
|
80 | - // /** @var Newbb\CategoryHandler $categoryHandler */ |
|
81 | - // $categoryHandler = Newbb\Helper::getInstance()->getHandler('Category'); |
|
82 | - $criteriaCategory = new \CriteriaCompo(new \Criteria('1', 1)); |
|
83 | - $criteriaCategory->setSort('cat_order'); |
|
84 | - $categories = $categoryHandler->getAll($criteriaCategory, ['cat_id', 'cat_order', 'cat_title']); |
|
85 | - $forums = $forumHandler->getTree(array_keys($categories), 0, 'all', ' '); |
|
86 | - foreach (array_keys($categories) as $c) { |
|
87 | - echo '<tr>'; |
|
88 | - echo "<td align='left' nowrap='nowrap' class='head' >" . $categories[$c]->getVar('cat_title') . '</td>'; |
|
89 | - echo "<td align='right' class='head'>"; |
|
90 | - echo "<input type='text' name='cat_orders[]' value='" . $categories[$c]->getVar('cat_order') . "' size='5' maxlength='5' />"; |
|
91 | - echo "<input type='hidden' name='cat[]' value='" . $c . "' />"; |
|
92 | - echo '</td>'; |
|
93 | - echo '</tr>'; |
|
78 | + // /** @var Newbb\ForumHandler $forumHandler */ |
|
79 | + // $forumHandler = Newbb\Helper::getInstance()->getHandler('Forum'); |
|
80 | + // /** @var Newbb\CategoryHandler $categoryHandler */ |
|
81 | + // $categoryHandler = Newbb\Helper::getInstance()->getHandler('Category'); |
|
82 | + $criteriaCategory = new \CriteriaCompo(new \Criteria('1', 1)); |
|
83 | + $criteriaCategory->setSort('cat_order'); |
|
84 | + $categories = $categoryHandler->getAll($criteriaCategory, ['cat_id', 'cat_order', 'cat_title']); |
|
85 | + $forums = $forumHandler->getTree(array_keys($categories), 0, 'all', ' '); |
|
86 | + foreach (array_keys($categories) as $c) { |
|
87 | + echo '<tr>'; |
|
88 | + echo "<td align='left' nowrap='nowrap' class='head' >" . $categories[$c]->getVar('cat_title') . '</td>'; |
|
89 | + echo "<td align='right' class='head'>"; |
|
90 | + echo "<input type='text' name='cat_orders[]' value='" . $categories[$c]->getVar('cat_order') . "' size='5' maxlength='5' />"; |
|
91 | + echo "<input type='hidden' name='cat[]' value='" . $c . "' />"; |
|
92 | + echo '</td>'; |
|
93 | + echo '</tr>'; |
|
94 | 94 | |
95 | - if (!isset($forums[$c])) { |
|
96 | - continue; |
|
97 | - } |
|
98 | - $i = 0; |
|
99 | - foreach ($forums[$c] as $key => $forum) { |
|
100 | - echo '<tr>'; |
|
101 | - $class = ((++$i) % 2) ? 'odd' : 'even'; |
|
102 | - echo "<td align='left' nowrap='nowrap' class='" . $class . "'>" . $forum['prefix'] . $forum['forum_name'] . '</td>'; |
|
103 | - echo "<td align='left' class='" . $class . "'>"; |
|
104 | - echo $forum['prefix'] . "<input type='text' name='orders[]' value='" . $forum['forum_order'] . "' size='5' maxlength='5' />"; |
|
105 | - echo "<input type='hidden' name='forum[]' value='" . $key . "' />"; |
|
106 | - echo '</td>'; |
|
107 | - echo '</tr>'; |
|
108 | - } |
|
109 | - } |
|
110 | - echo "<tr><td class='even' align='center' colspan='6'>"; |
|
95 | + if (!isset($forums[$c])) { |
|
96 | + continue; |
|
97 | + } |
|
98 | + $i = 0; |
|
99 | + foreach ($forums[$c] as $key => $forum) { |
|
100 | + echo '<tr>'; |
|
101 | + $class = ((++$i) % 2) ? 'odd' : 'even'; |
|
102 | + echo "<td align='left' nowrap='nowrap' class='" . $class . "'>" . $forum['prefix'] . $forum['forum_name'] . '</td>'; |
|
103 | + echo "<td align='left' class='" . $class . "'>"; |
|
104 | + echo $forum['prefix'] . "<input type='text' name='orders[]' value='" . $forum['forum_order'] . "' size='5' maxlength='5' />"; |
|
105 | + echo "<input type='hidden' name='forum[]' value='" . $key . "' />"; |
|
106 | + echo '</td>'; |
|
107 | + echo '</tr>'; |
|
108 | + } |
|
109 | + } |
|
110 | + echo "<tr><td class='even' align='center' colspan='6'>"; |
|
111 | 111 | |
112 | - echo "<input type='submit' name='submit' value='" . _SUBMIT . "' />"; |
|
113 | - echo '</td></tr>'; |
|
114 | - echo '</table>'; |
|
115 | - echo '</form>'; |
|
116 | - echo '</td></tr></table>'; |
|
117 | - echo '<fieldset>'; |
|
118 | - echo '<legend> ' . _MI_NEWBB_ADMENU_ORDER . ' </legend>'; |
|
119 | - echo _AM_NEWBB_HELP_ORDER_TAB; |
|
120 | - echo '</fieldset>'; |
|
112 | + echo "<input type='submit' name='submit' value='" . _SUBMIT . "' />"; |
|
113 | + echo '</td></tr>'; |
|
114 | + echo '</table>'; |
|
115 | + echo '</form>'; |
|
116 | + echo '</td></tr></table>'; |
|
117 | + echo '<fieldset>'; |
|
118 | + echo '<legend> ' . _MI_NEWBB_ADMENU_ORDER . ' </legend>'; |
|
119 | + echo _AM_NEWBB_HELP_ORDER_TAB; |
|
120 | + echo '</fieldset>'; |
|
121 | 121 | } |
122 | 122 | require_once __DIR__ . '/admin_footer.php'; |
@@ -31,7 +31,7 @@ discard block |
||
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 | xoops_cp_header(); |
36 | 36 | require_once $GLOBALS['xoops']->path('class/xoopsformloader.php'); |
37 | 37 | $adminObject->displayNavigation(basename(__FILE__)); |
@@ -40,8 +40,8 @@ discard block |
||
40 | 40 | ///** @var Newbb\ForumHandler $forumHandler */ |
41 | 41 | //$forumHandler = Newbb\Helper::getInstance()->getHandler('Forum'); |
42 | 42 | if (Request::getString('submit', '', 'POST')) { |
43 | - $fgroups = Request::getArray('group', '', 'POST');// !empty($_POST['group']) ? $_POST['group'] : ''; |
|
44 | - $fforum = Request::getInt('forenid', 0, 'POST');// (int)($_POST['forenid']); |
|
43 | + $fgroups = Request::getArray('group', '', 'POST'); // !empty($_POST['group']) ? $_POST['group'] : ''; |
|
44 | + $fforum = Request::getInt('forenid', 0, 'POST'); // (int)($_POST['forenid']); |
|
45 | 45 | $fuser = []; |
46 | 46 | if (0 !== $fforum) { |
47 | 47 | if ('' !== $fgroups) { |
@@ -56,14 +56,14 @@ discard block |
||
56 | 56 | } |
57 | 57 | } |
58 | 58 | if (-1 == $fforum) { // alle Foren |
59 | - $sql = 'UPDATE ' . $GLOBALS['xoopsDB']->prefix('newbb_forums') . " SET forum_moderator='" . serialize($fuser) . "'"; |
|
59 | + $sql = 'UPDATE '.$GLOBALS['xoopsDB']->prefix('newbb_forums')." SET forum_moderator='".serialize($fuser)."'"; |
|
60 | 60 | } else { |
61 | - $sql = 'UPDATE ' . $GLOBALS['xoopsDB']->prefix('newbb_forums') . " SET forum_moderator='" . serialize($fuser) . "' WHERE forum_id =" . $fforum; |
|
61 | + $sql = 'UPDATE '.$GLOBALS['xoopsDB']->prefix('newbb_forums')." SET forum_moderator='".serialize($fuser)."' WHERE forum_id =".$fforum; |
|
62 | 62 | } |
63 | 63 | if (is_array($fuser) && $GLOBALS['xoopsDB']->queryF($sql)) { |
64 | 64 | $mess = _AM_NEWBB_GROUPMOD_ADDMOD; |
65 | 65 | } else { |
66 | - $mess = _AM_NEWBB_GROUPMOD_ERRMOD . '<br><small>( ' . $sql . ' )</small>'; |
|
66 | + $mess = _AM_NEWBB_GROUPMOD_ERRMOD.'<br><small>( '.$sql.' )</small>'; |
|
67 | 67 | } |
68 | 68 | redirect_header('admin_groupmod.php', 1, $mess); |
69 | 69 | // echo '<div class="confirmMsg">' . $mess . '</div><br><br>'; |
@@ -71,7 +71,7 @@ discard block |
||
71 | 71 | } |
72 | 72 | |
73 | 73 | echo _AM_NEWBB_GROUPMOD_TITLEDESC; |
74 | -echo "<br><br><table width='100%' border='0' cellspacing='1' class='outer'>" . "<tr><td class='odd'>"; |
|
74 | +echo "<br><br><table width='100%' border='0' cellspacing='1' class='outer'>"."<tr><td class='odd'>"; |
|
75 | 75 | echo "<form name='reorder' method='post'>"; |
76 | 76 | ///** @var Newbb\CategoryHandler $categoryHandler */ |
77 | 77 | //$categoryHandler = Newbb\Helper::getInstance()->getHandler('Category'); |
@@ -80,14 +80,14 @@ discard block |
||
80 | 80 | $categories = $categoryHandler->getAll($criteriaCategory, ['cat_id', 'cat_order', 'cat_title']); |
81 | 81 | $forums = $forumHandler->getTree(array_keys($categories), 0, 'all', ' '); |
82 | 82 | echo '<select name="forenid">'; |
83 | -echo '<option value="-1">-- ' . _AM_NEWBB_GROUPMOD_ALLFORUMS . ' --</option>'; |
|
83 | +echo '<option value="-1">-- '._AM_NEWBB_GROUPMOD_ALLFORUMS.' --</option>'; |
|
84 | 84 | foreach (array_keys($categories) as $c) { |
85 | 85 | if (!isset($forums[$c])) { |
86 | 86 | continue; |
87 | 87 | } |
88 | 88 | $i = 0; |
89 | 89 | foreach ($forums[$c] as $key => $forum) { |
90 | - echo '<option value="' . $forum['forum_id'] . '"> ' . $categories[$c]->getVar('cat_title') . '::' . $forum['forum_name'] . '</option>'; |
|
90 | + echo '<option value="'.$forum['forum_id'].'"> '.$categories[$c]->getVar('cat_title').'::'.$forum['forum_name'].'</option>'; |
|
91 | 91 | } |
92 | 92 | } |
93 | 93 | echo '</select>'; |
@@ -95,14 +95,14 @@ discard block |
||
95 | 95 | |
96 | 96 | $groups = $memberHandler->getGroups(); |
97 | 97 | foreach ($groups as $value) { |
98 | - echo '<input type="checkbox" name="group[]" value="' . $value->getVar('groupid') . '" /> ' . $value->getVar('name') . '<br>'; |
|
98 | + echo '<input type="checkbox" name="group[]" value="'.$value->getVar('groupid').'" /> '.$value->getVar('name').'<br>'; |
|
99 | 99 | } |
100 | 100 | echo "</td><tr><tr><td class='odd' style='text-align:center;'>"; |
101 | -echo '<input type="submit" value="' . _SUBMIT . '" name="submit" />'; |
|
101 | +echo '<input type="submit" value="'._SUBMIT.'" name="submit" />'; |
|
102 | 102 | echo '</td></tr></table>'; |
103 | 103 | echo '</form>'; |
104 | 104 | echo '<fieldset>'; |
105 | -echo '<legend> ' . _MI_NEWBB_ADMENU_GROUPMOD . ' </legend>'; |
|
105 | +echo '<legend> '._MI_NEWBB_ADMENU_GROUPMOD.' </legend>'; |
|
106 | 106 | echo _AM_NEWBB_HELP_GROUPMOD_TAB; |
107 | 107 | echo '</fieldset>'; |
108 | -require_once __DIR__ . '/admin_footer.php'; |
|
108 | +require_once __DIR__.'/admin_footer.php'; |
@@ -40,34 +40,34 @@ discard block |
||
40 | 40 | ///** @var Newbb\ForumHandler $forumHandler */ |
41 | 41 | //$forumHandler = Newbb\Helper::getInstance()->getHandler('Forum'); |
42 | 42 | if (Request::getString('submit', '', 'POST')) { |
43 | - $fgroups = Request::getArray('group', '', 'POST');// !empty($_POST['group']) ? $_POST['group'] : ''; |
|
44 | - $fforum = Request::getInt('forenid', 0, 'POST');// (int)($_POST['forenid']); |
|
45 | - $fuser = []; |
|
46 | - if (0 !== $fforum) { |
|
47 | - if ('' !== $fgroups) { |
|
48 | - $gg = []; |
|
49 | - foreach ($fgroups as $k) { |
|
50 | - $gg = $memberHandler->getUsersByGroup($k, false); |
|
51 | - foreach ($gg as $f) { |
|
52 | - if (!in_array($f, $fuser)) { |
|
53 | - $fuser[] = $f; |
|
54 | - } |
|
55 | - } |
|
56 | - } |
|
57 | - } |
|
58 | - if (-1 == $fforum) { // alle Foren |
|
59 | - $sql = 'UPDATE ' . $GLOBALS['xoopsDB']->prefix('newbb_forums') . " SET forum_moderator='" . serialize($fuser) . "'"; |
|
60 | - } else { |
|
61 | - $sql = 'UPDATE ' . $GLOBALS['xoopsDB']->prefix('newbb_forums') . " SET forum_moderator='" . serialize($fuser) . "' WHERE forum_id =" . $fforum; |
|
62 | - } |
|
63 | - if (is_array($fuser) && $GLOBALS['xoopsDB']->queryF($sql)) { |
|
64 | - $mess = _AM_NEWBB_GROUPMOD_ADDMOD; |
|
65 | - } else { |
|
66 | - $mess = _AM_NEWBB_GROUPMOD_ERRMOD . '<br><small>( ' . $sql . ' )</small>'; |
|
67 | - } |
|
68 | - redirect_header('admin_groupmod.php', 1, $mess); |
|
69 | - // echo '<div class="confirmMsg">' . $mess . '</div><br><br>'; |
|
70 | - } |
|
43 | + $fgroups = Request::getArray('group', '', 'POST');// !empty($_POST['group']) ? $_POST['group'] : ''; |
|
44 | + $fforum = Request::getInt('forenid', 0, 'POST');// (int)($_POST['forenid']); |
|
45 | + $fuser = []; |
|
46 | + if (0 !== $fforum) { |
|
47 | + if ('' !== $fgroups) { |
|
48 | + $gg = []; |
|
49 | + foreach ($fgroups as $k) { |
|
50 | + $gg = $memberHandler->getUsersByGroup($k, false); |
|
51 | + foreach ($gg as $f) { |
|
52 | + if (!in_array($f, $fuser)) { |
|
53 | + $fuser[] = $f; |
|
54 | + } |
|
55 | + } |
|
56 | + } |
|
57 | + } |
|
58 | + if (-1 == $fforum) { // alle Foren |
|
59 | + $sql = 'UPDATE ' . $GLOBALS['xoopsDB']->prefix('newbb_forums') . " SET forum_moderator='" . serialize($fuser) . "'"; |
|
60 | + } else { |
|
61 | + $sql = 'UPDATE ' . $GLOBALS['xoopsDB']->prefix('newbb_forums') . " SET forum_moderator='" . serialize($fuser) . "' WHERE forum_id =" . $fforum; |
|
62 | + } |
|
63 | + if (is_array($fuser) && $GLOBALS['xoopsDB']->queryF($sql)) { |
|
64 | + $mess = _AM_NEWBB_GROUPMOD_ADDMOD; |
|
65 | + } else { |
|
66 | + $mess = _AM_NEWBB_GROUPMOD_ERRMOD . '<br><small>( ' . $sql . ' )</small>'; |
|
67 | + } |
|
68 | + redirect_header('admin_groupmod.php', 1, $mess); |
|
69 | + // echo '<div class="confirmMsg">' . $mess . '</div><br><br>'; |
|
70 | + } |
|
71 | 71 | } |
72 | 72 | |
73 | 73 | echo _AM_NEWBB_GROUPMOD_TITLEDESC; |
@@ -82,20 +82,20 @@ discard block |
||
82 | 82 | echo '<select name="forenid">'; |
83 | 83 | echo '<option value="-1">-- ' . _AM_NEWBB_GROUPMOD_ALLFORUMS . ' --</option>'; |
84 | 84 | foreach (array_keys($categories) as $c) { |
85 | - if (!isset($forums[$c])) { |
|
86 | - continue; |
|
87 | - } |
|
88 | - $i = 0; |
|
89 | - foreach ($forums[$c] as $key => $forum) { |
|
90 | - echo '<option value="' . $forum['forum_id'] . '"> ' . $categories[$c]->getVar('cat_title') . '::' . $forum['forum_name'] . '</option>'; |
|
91 | - } |
|
85 | + if (!isset($forums[$c])) { |
|
86 | + continue; |
|
87 | + } |
|
88 | + $i = 0; |
|
89 | + foreach ($forums[$c] as $key => $forum) { |
|
90 | + echo '<option value="' . $forum['forum_id'] . '"> ' . $categories[$c]->getVar('cat_title') . '::' . $forum['forum_name'] . '</option>'; |
|
91 | + } |
|
92 | 92 | } |
93 | 93 | echo '</select>'; |
94 | 94 | echo "</td><tr><tr><td class='even'>"; |
95 | 95 | |
96 | 96 | $groups = $memberHandler->getGroups(); |
97 | 97 | foreach ($groups as $value) { |
98 | - echo '<input type="checkbox" name="group[]" value="' . $value->getVar('groupid') . '" /> ' . $value->getVar('name') . '<br>'; |
|
98 | + echo '<input type="checkbox" name="group[]" value="' . $value->getVar('groupid') . '" /> ' . $value->getVar('name') . '<br>'; |
|
99 | 99 | } |
100 | 100 | echo "</td><tr><tr><td class='odd' style='text-align:center;'>"; |
101 | 101 | echo '<input type="submit" value="' . _SUBMIT . '" name="submit" />'; |
@@ -32,7 +32,7 @@ discard block |
||
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 | xoops_cp_header(); |
37 | 37 | |
38 | 38 | $adminObject->displayNavigation(basename(__FILE__)); |
@@ -70,7 +70,7 @@ discard block |
||
70 | 70 | if (!empty($queue)) { |
71 | 71 | echo "<pre>\n"; |
72 | 72 | foreach ($queue as $line) { |
73 | - echo $line . ";\n"; |
|
73 | + echo $line.";\n"; |
|
74 | 74 | } |
75 | 75 | echo "</pre>\n"; |
76 | 76 | } |
@@ -92,4 +92,4 @@ discard block |
||
92 | 92 | |
93 | 93 | echo "<div>$message</div>"; |
94 | 94 | |
95 | -require_once __DIR__ . '/admin_footer.php'; |
|
95 | +require_once __DIR__.'/admin_footer.php'; |
@@ -65,29 +65,29 @@ |
||
65 | 65 | $message = ''; |
66 | 66 | |
67 | 67 | switch ($op) { |
68 | - case 'show': |
|
69 | - $queue = $newbbMigrate->getSynchronizeDDL(); |
|
70 | - if (!empty($queue)) { |
|
71 | - echo "<pre>\n"; |
|
72 | - foreach ($queue as $line) { |
|
73 | - echo $line . ";\n"; |
|
74 | - } |
|
75 | - echo "</pre>\n"; |
|
76 | - } |
|
77 | - break; |
|
78 | - case 'migrate': |
|
79 | - $newbbMigrate->synchronizeSchema(); |
|
80 | - $message = 'Database migrated to current schema.'; |
|
81 | - break; |
|
82 | - case 'schema': |
|
83 | - xoops_confirm(['op' => 'confirmwrite'], 'migrate.php', 'Warning! This is intended for developers only. Confirm write schema file from current database.', 'Confirm'); |
|
84 | - break; |
|
85 | - case 'confirmwrite': |
|
86 | - if ($GLOBALS['xoopsSecurity']->check()) { |
|
87 | - $newbbMigrate->saveCurrentSchema(); |
|
88 | - $message = 'Current schema file written'; |
|
89 | - } |
|
90 | - break; |
|
68 | + case 'show': |
|
69 | + $queue = $newbbMigrate->getSynchronizeDDL(); |
|
70 | + if (!empty($queue)) { |
|
71 | + echo "<pre>\n"; |
|
72 | + foreach ($queue as $line) { |
|
73 | + echo $line . ";\n"; |
|
74 | + } |
|
75 | + echo "</pre>\n"; |
|
76 | + } |
|
77 | + break; |
|
78 | + case 'migrate': |
|
79 | + $newbbMigrate->synchronizeSchema(); |
|
80 | + $message = 'Database migrated to current schema.'; |
|
81 | + break; |
|
82 | + case 'schema': |
|
83 | + xoops_confirm(['op' => 'confirmwrite'], 'migrate.php', 'Warning! This is intended for developers only. Confirm write schema file from current database.', 'Confirm'); |
|
84 | + break; |
|
85 | + case 'confirmwrite': |
|
86 | + if ($GLOBALS['xoopsSecurity']->check()) { |
|
87 | + $newbbMigrate->saveCurrentSchema(); |
|
88 | + $message = 'Current schema file written'; |
|
89 | + } |
|
90 | + break; |
|
91 | 91 | } |
92 | 92 | |
93 | 93 | echo "<div>$message</div>"; |
@@ -12,7 +12,7 @@ discard block |
||
12 | 12 | |
13 | 13 | use Xmf\Request; |
14 | 14 | |
15 | -require_once __DIR__ . '/admin_header.php'; |
|
15 | +require_once __DIR__.'/admin_header.php'; |
|
16 | 16 | xoops_cp_header(); |
17 | 17 | echo '<br>'; |
18 | 18 | require_once $GLOBALS['xoops']->path('class/xoopsformloader.php'); |
@@ -85,7 +85,7 @@ discard block |
||
85 | 85 | } |
86 | 86 | } |
87 | 87 | if (count($type_del) > 0) { |
88 | - $type_list = $typeHandler->getList(new \Criteria('type_id', '(' . implode(', ', $type_del) . ')', 'IN')); |
|
88 | + $type_list = $typeHandler->getList(new \Criteria('type_id', '('.implode(', ', $type_del).')', 'IN')); |
|
89 | 89 | xoops_confirm(['op' => 'delete', 'type_del' => serialize($type_del)], xoops_getenv('PHP_SELF'), sprintf(_AM_NEWBB_TODEL_TYPE, implode(', ', array_values($type_list))), '', false); |
90 | 90 | } else { |
91 | 91 | redirect_header(xoops_getenv('PHP_SELF'), 2, _MD_NEWBB_DBUPDATED); |
@@ -115,14 +115,14 @@ discard block |
||
115 | 115 | $adminObject->addItemButton(_AM_NEWBB_TYPE_TEMPLATE_APPLY, 'admin_type_manager.php?op=apply', $icon = 'add'); |
116 | 116 | $adminObject->addItemButton(_AM_NEWBB_TYPE_FORUM, 'admin_type_manager.php?op=forum', $icon = 'add'); |
117 | 117 | $adminObject->displayButton('left'); |
118 | - echo '<legend style="font-weight: bold; color: #900;">' . _AM_NEWBB_TYPE_ORDER_DESC . '</legend>'; |
|
119 | - echo "<table width='100%' border='0' cellspacing='1' class='outer'>" . "<tr><td class='odd'>"; |
|
120 | - echo "<form name='template' method='post' action='" . xoops_getenv('PHP_SELF') . "'>"; |
|
118 | + echo '<legend style="font-weight: bold; color: #900;">'._AM_NEWBB_TYPE_ORDER_DESC.'</legend>'; |
|
119 | + echo "<table width='100%' border='0' cellspacing='1' class='outer'>"."<tr><td class='odd'>"; |
|
120 | + echo "<form name='template' method='post' action='".xoops_getenv('PHP_SELF')."'>"; |
|
121 | 121 | echo "<table border='0' cellpadding='4' cellspacing='1' width='100%' class='outer'>"; |
122 | 122 | echo "<tr align='center'>"; |
123 | - echo "<th class='bg3' width='20%'>" . _AM_NEWBB_TYPE_ORDER . '</th>'; |
|
124 | - echo "<th class='bg3' width='20%'>" . _AM_NEWBB_TYPE_NAME . '</th>'; |
|
125 | - echo "<th class='bg3'>" . _AM_NEWBB_TYPE_DESCRIPTION . '</th>'; |
|
123 | + echo "<th class='bg3' width='20%'>"._AM_NEWBB_TYPE_ORDER.'</th>'; |
|
124 | + echo "<th class='bg3' width='20%'>"._AM_NEWBB_TYPE_NAME.'</th>'; |
|
125 | + echo "<th class='bg3'>"._AM_NEWBB_TYPE_DESCRIPTION.'</th>'; |
|
126 | 126 | echo '</tr>'; |
127 | 127 | |
128 | 128 | if ($templates = $cacheHelper->read('type_template')) { |
@@ -133,9 +133,9 @@ discard block |
||
133 | 133 | } |
134 | 134 | $typeObject = $typesObject[$key]; |
135 | 135 | echo "<tr class='even' align='left'>"; |
136 | - echo "<td><input type='text' name='type_order[{$key}]' value='" . $order . "' size='10' /></td>"; |
|
137 | - echo "<td><em style='color:" . $typeObject->getVar('type_color') . ";'>" . $typeObject->getVar('type_name') . '</em></td>'; |
|
138 | - echo '<td>' . $typeObject->getVar('type_description') . '</td>'; |
|
136 | + echo "<td><input type='text' name='type_order[{$key}]' value='".$order."' size='10' /></td>"; |
|
137 | + echo "<td><em style='color:".$typeObject->getVar('type_color').";'>".$typeObject->getVar('type_name').'</em></td>'; |
|
138 | + echo '<td>'.$typeObject->getVar('type_description').'</td>'; |
|
139 | 139 | echo '</tr>'; |
140 | 140 | unset($typesObject[$key]); |
141 | 141 | } |
@@ -144,15 +144,15 @@ discard block |
||
144 | 144 | foreach ($typesObject as $key => $typeObject) { |
145 | 145 | echo "<tr class='odd' align='left'>"; |
146 | 146 | echo "<td><input type='text' name='type_order[{$key}]' value='0' size='10' /></td>"; |
147 | - echo "<td><em style='color:" . $typeObject->getVar('type_color') . ";'>" . $typeObject->getVar('type_name') . '</em></td>'; |
|
148 | - echo '<td>' . $typeObject->getVar('type_description') . '</td>'; |
|
147 | + echo "<td><em style='color:".$typeObject->getVar('type_color').";'>".$typeObject->getVar('type_name').'</em></td>'; |
|
148 | + echo '<td>'.$typeObject->getVar('type_description').'</td>'; |
|
149 | 149 | echo '</tr>'; |
150 | 150 | } |
151 | 151 | |
152 | 152 | echo "<tr><td colspan='3' style='text-align:center;'>"; |
153 | 153 | echo "<input type='hidden' name='op' value='save_template' />"; |
154 | - echo "<input type='submit' name='submit' value='" . _SUBMIT . "' /> "; |
|
155 | - echo "<input type='reset' value='" . _CANCEL . "' />"; |
|
154 | + echo "<input type='submit' name='submit' value='"._SUBMIT."' /> "; |
|
155 | + echo "<input type='reset' value='"._CANCEL."' />"; |
|
156 | 156 | echo '</td></tr></table>'; |
157 | 157 | echo '</form>'; |
158 | 158 | echo '</td></tr></table>'; |
@@ -161,12 +161,12 @@ discard block |
||
161 | 161 | case 'save_template': |
162 | 162 | $templates = array_flip(array_filter(Request::getArray('type_order', [], 'POST'))); |
163 | 163 | $cacheHelper->write('type_template', $templates); |
164 | - redirect_header(xoops_getenv('PHP_SELF') . '?op=template', 2, _MD_NEWBB_DBUPDATED); |
|
164 | + redirect_header(xoops_getenv('PHP_SELF').'?op=template', 2, _MD_NEWBB_DBUPDATED); |
|
165 | 165 | break; |
166 | 166 | |
167 | 167 | case 'apply': |
168 | 168 | if (!$templates = $cacheHelper->read('type_template')) { |
169 | - redirect_header(xoops_getenv('PHP_SELF') . '?op=template', 2, _AM_NEWBB_TYPE_TEMPLATE_ERR); |
|
169 | + redirect_header(xoops_getenv('PHP_SELF').'?op=template', 2, _AM_NEWBB_TYPE_TEMPLATE_ERR); |
|
170 | 170 | } |
171 | 171 | |
172 | 172 | // $categoryHandler = Newbb\Helper::getInstance()->getHandler('Category'); |
@@ -176,9 +176,9 @@ discard block |
||
176 | 176 | // $forumHandler = Newbb\Helper::getInstance()->getHandler('Forum'); |
177 | 177 | $forums = $forumHandler->getTree(array_keys($categories), 0, 'all'); |
178 | 178 | foreach (array_keys($forums) as $c) { |
179 | - $fm_options[-1 * $c] = '[' . $categories[$c] . ']'; |
|
179 | + $fm_options[-1 * $c] = '['.$categories[$c].']'; |
|
180 | 180 | foreach (array_keys($forums[$c]) as $f) { |
181 | - $fm_options[$f] = $forums[$c][$f]['prefix'] . $forums[$c][$f]['forum_name']; |
|
181 | + $fm_options[$f] = $forums[$c][$f]['prefix'].$forums[$c][$f]['forum_name']; |
|
182 | 182 | } |
183 | 183 | } |
184 | 184 | unset($forums, $categories); |
@@ -199,15 +199,15 @@ discard block |
||
199 | 199 | $adminObject->addItemButton(_AM_NEWBB_TYPE_FORUM, 'admin_type_manager.php?op=forum', $icon = 'add'); |
200 | 200 | $adminObject->displayButton('left'); |
201 | 201 | |
202 | - echo "<table width='100%' border='0' cellspacing='1' class='outer'>" . "<tr><td class='odd'>"; |
|
202 | + echo "<table width='100%' border='0' cellspacing='1' class='outer'>"."<tr><td class='odd'>"; |
|
203 | 203 | echo "<table border='0' cellpadding='4' cellspacing='1' width='100%' class='outer'>"; |
204 | 204 | echo "<tr align='center'>"; |
205 | - echo "<th class='bg3' width='20%'>" . _AM_NEWBB_TYPE_NAME . '</th>'; |
|
206 | - echo "<th class='bg3' width='20%'>" . _AM_NEWBB_TYPE_ORDER . '</th>'; |
|
207 | - echo "<th class='bg3'>" . _AM_NEWBB_TYPE_DESCRIPTION . '</th>'; |
|
205 | + echo "<th class='bg3' width='20%'>"._AM_NEWBB_TYPE_NAME.'</th>'; |
|
206 | + echo "<th class='bg3' width='20%'>"._AM_NEWBB_TYPE_ORDER.'</th>'; |
|
207 | + echo "<th class='bg3'>"._AM_NEWBB_TYPE_DESCRIPTION.'</th>'; |
|
208 | 208 | echo '</tr>'; |
209 | 209 | |
210 | - $typesObject = $typeHandler->getAll(new \Criteria('type_id', '(' . implode(', ', array_values($templates)) . ')', 'IN')); |
|
210 | + $typesObject = $typeHandler->getAll(new \Criteria('type_id', '('.implode(', ', array_values($templates)).')', 'IN')); |
|
211 | 211 | arsort($templates); |
212 | 212 | foreach ($templates as $order => $key) { |
213 | 213 | if (!isset($typesObject[$key])) { |
@@ -215,9 +215,9 @@ discard block |
||
215 | 215 | } |
216 | 216 | $typeObject = $typesObject[$key]; |
217 | 217 | echo "<tr class='even' align='left'>"; |
218 | - echo "<td><em style='color:" . $typeObject->getVar('type_color') . ";'>" . $typeObject->getVar('type_name') . '</em></td>'; |
|
219 | - echo '<td>' . $order . '</td>'; |
|
220 | - echo '<td>' . $typeObject->getVar('type_description') . '</td>'; |
|
218 | + echo "<td><em style='color:".$typeObject->getVar('type_color').";'>".$typeObject->getVar('type_name').'</em></td>'; |
|
219 | + echo '<td>'.$order.'</td>'; |
|
220 | + echo '<td>'.$typeObject->getVar('type_description').'</td>'; |
|
221 | 221 | echo '</tr>'; |
222 | 222 | unset($typesObject[$key]); |
223 | 223 | } |
@@ -229,7 +229,7 @@ discard block |
||
229 | 229 | |
230 | 230 | case 'save_apply': |
231 | 231 | if (!$templates = $cacheHelper->read('type_template')) { |
232 | - redirect_header(xoops_getenv('PHP_SELF') . '?op=template', 2, _AM_NEWBB_TYPE_TEMPLATE); |
|
232 | + redirect_header(xoops_getenv('PHP_SELF').'?op=template', 2, _AM_NEWBB_TYPE_TEMPLATE); |
|
233 | 233 | } |
234 | 234 | foreach (Request::getArray('forums', [], 'POST') as $forum) { |
235 | 235 | if ($forum < 1) { |
@@ -255,9 +255,9 @@ discard block |
||
255 | 255 | } |
256 | 256 | |
257 | 257 | foreach (array_keys($forums) as $c) { |
258 | - $fm_options[-1 * $c] = '[' . $categories[$c] . ']'; |
|
258 | + $fm_options[-1 * $c] = '['.$categories[$c].']'; |
|
259 | 259 | foreach (array_keys($forums[$c]) as $f) { |
260 | - $fm_options[$f] = $forums[$c][$f]['prefix'] . $forums[$c][$f]['forum_name']; |
|
260 | + $fm_options[$f] = $forums[$c][$f]['prefix'].$forums[$c][$f]['forum_name']; |
|
261 | 261 | } |
262 | 262 | } |
263 | 263 | unset($forums, $categories); |
@@ -282,12 +282,12 @@ discard block |
||
282 | 282 | |
283 | 283 | case 'edit_forum': |
284 | 284 | if (!Request::getInt('forum', 0, 'POST') || Request::getInt('forum', 0, 'POST') < 1) { |
285 | - redirect_header(xoops_getenv('PHP_SELF') . '?op=forum', 2, _AM_NEWBB_TYPE_FORUM_ERR); |
|
285 | + redirect_header(xoops_getenv('PHP_SELF').'?op=forum', 2, _AM_NEWBB_TYPE_FORUM_ERR); |
|
286 | 286 | } |
287 | 287 | |
288 | 288 | // $forumHandler = Newbb\Helper::getInstance()->getHandler('Forum'); |
289 | 289 | if (!$forumObject = $forumHandler->get(Request::getInt('forum', 0, 'POST'))) { |
290 | - redirect_header(xoops_getenv('PHP_SELF') . '?op=forum', 2, _AM_NEWBB_TYPE_FORUM_ERR); |
|
290 | + redirect_header(xoops_getenv('PHP_SELF').'?op=forum', 2, _AM_NEWBB_TYPE_FORUM_ERR); |
|
291 | 291 | } |
292 | 292 | |
293 | 293 | $typesObject = $typeHandler->getAll(); |
@@ -299,14 +299,14 @@ discard block |
||
299 | 299 | $adminObject->addItemButton(_AM_NEWBB_TYPE_TEMPLATE, 'admin_type_manager.php?op=template', $icon = 'add'); |
300 | 300 | $adminObject->addItemButton(_AM_NEWBB_TYPE_FORUM, 'admin_type_manager.php?op=forum', $icon = 'add'); |
301 | 301 | $adminObject->displayButton('left'); |
302 | - echo '<legend style="font-weight: bold; color: #900;">' . _AM_NEWBB_TYPE_ORDER_DESC . '</legend>'; |
|
303 | - echo "<table width='100%' border='0' cellspacing='1' class='outer'>" . "<tr><td class='odd'>"; |
|
304 | - echo "<form name='template' method='post' action='" . xoops_getenv('PHP_SELF') . "'>"; |
|
302 | + echo '<legend style="font-weight: bold; color: #900;">'._AM_NEWBB_TYPE_ORDER_DESC.'</legend>'; |
|
303 | + echo "<table width='100%' border='0' cellspacing='1' class='outer'>"."<tr><td class='odd'>"; |
|
304 | + echo "<form name='template' method='post' action='".xoops_getenv('PHP_SELF')."'>"; |
|
305 | 305 | echo "<table border='0' cellpadding='4' cellspacing='1' width='100%' class='outer'>"; |
306 | 306 | echo "<tr align='center'>"; |
307 | - echo "<th class='bg3' width='20%'>" . _AM_NEWBB_TYPE_ORDER . '</th>'; |
|
308 | - echo "<th class='bg3' width='20%'>" . _AM_NEWBB_TYPE_NAME . '</th>'; |
|
309 | - echo "<th class='bg3'>" . _AM_NEWBB_TYPE_DESCRIPTION . '</th>'; |
|
307 | + echo "<th class='bg3' width='20%'>"._AM_NEWBB_TYPE_ORDER.'</th>'; |
|
308 | + echo "<th class='bg3' width='20%'>"._AM_NEWBB_TYPE_NAME.'</th>'; |
|
309 | + echo "<th class='bg3'>"._AM_NEWBB_TYPE_DESCRIPTION.'</th>'; |
|
310 | 310 | echo '</tr>'; |
311 | 311 | |
312 | 312 | $types = $typeHandler->getByForum(Request::getInt('forum', 0, 'POST')); |
@@ -321,9 +321,9 @@ discard block |
||
321 | 321 | } |
322 | 322 | $typeObject = $typesObject[$type['type_id']]; |
323 | 323 | echo "<tr class='even' align='left'>"; |
324 | - echo "<td><input type='text' name='type_order[" . $type['type_id'] . "]' value='" . $type['type_order'] . "' size='10' /></td>"; |
|
325 | - echo "<td><em style='color:" . $typeObject->getVar('type_color') . ";'>" . $typeObject->getVar('type_name') . '</em></td>'; |
|
326 | - echo '<td>' . $typeObject->getVar('type_description') . '</td>'; |
|
324 | + echo "<td><input type='text' name='type_order[".$type['type_id']."]' value='".$type['type_order']."' size='10' /></td>"; |
|
325 | + echo "<td><em style='color:".$typeObject->getVar('type_color').";'>".$typeObject->getVar('type_name').'</em></td>'; |
|
326 | + echo '<td>'.$typeObject->getVar('type_description').'</td>'; |
|
327 | 327 | echo '</tr>'; |
328 | 328 | unset($typesObject[$type['type_id']]); |
329 | 329 | } |
@@ -331,17 +331,17 @@ discard block |
||
331 | 331 | foreach ($typesObject as $key => $typeObject) { |
332 | 332 | echo "<tr class='odd' align='left'>"; |
333 | 333 | echo "<td><input type='text' name='type_order[{$key}]' value='0' size='10' /></td>"; |
334 | - echo "<td><em style='color:" . $typeObject->getVar('type_color') . ";'>" . $typeObject->getVar('type_name') . '</em></td>'; |
|
335 | - echo '<td>' . $typeObject->getVar('type_description') . '</td>'; |
|
334 | + echo "<td><em style='color:".$typeObject->getVar('type_color').";'>".$typeObject->getVar('type_name').'</em></td>'; |
|
335 | + echo '<td>'.$typeObject->getVar('type_description').'</td>'; |
|
336 | 336 | echo '</tr>'; |
337 | 337 | } |
338 | 338 | |
339 | 339 | echo "<tr><td colspan='3' style='text-align:center;'>"; |
340 | - echo '<legend style="font-weight: bold; color: #900;">' . _AM_NEWBB_TYPE_EDITFORUM_DESC . '</legend>'; |
|
341 | - echo "<input type='hidden' name='forum' value='" . Request::getInt('forum', 0, 'POST') . "' />"; |
|
340 | + echo '<legend style="font-weight: bold; color: #900;">'._AM_NEWBB_TYPE_EDITFORUM_DESC.'</legend>'; |
|
341 | + echo "<input type='hidden' name='forum' value='".Request::getInt('forum', 0, 'POST')."' />"; |
|
342 | 342 | echo "<input type='hidden' name='op' value='save_forum' />"; |
343 | - echo "<input type='submit' name='submit' value='" . _SUBMIT . "' /> "; |
|
344 | - echo "<input type='reset' value='" . _CANCEL . "' />"; |
|
343 | + echo "<input type='submit' name='submit' value='"._SUBMIT."' /> "; |
|
344 | + echo "<input type='reset' value='"._CANCEL."' />"; |
|
345 | 345 | echo '</td></tr></table>'; |
346 | 346 | echo '</form>'; |
347 | 347 | echo '</td></tr></table>'; |
@@ -349,10 +349,10 @@ discard block |
||
349 | 349 | |
350 | 350 | case 'save_forum': |
351 | 351 | if (!Request::getInt('forum', 0, 'POST') || Request::getInt('forum', 0, 'POST') < 1) { |
352 | - redirect_header(xoops_getenv('PHP_SELF') . '?op=forum', 2, _AM_NEWBB_TYPE_FORUM); |
|
352 | + redirect_header(xoops_getenv('PHP_SELF').'?op=forum', 2, _AM_NEWBB_TYPE_FORUM); |
|
353 | 353 | } |
354 | 354 | $typeHandler->updateByForum(Request::getInt('forum', 0, 'POST'), Request::getArray('type_order', null, 'POST')); |
355 | - redirect_header(xoops_getenv('PHP_SELF') . '?op=forum', 2, _MD_NEWBB_DBUPDATED); |
|
355 | + redirect_header(xoops_getenv('PHP_SELF').'?op=forum', 2, _MD_NEWBB_DBUPDATED); |
|
356 | 356 | break; |
357 | 357 | |
358 | 358 | case 'add': |
@@ -372,16 +372,16 @@ discard block |
||
372 | 372 | $adminObject->displayButton('left'); |
373 | 373 | } |
374 | 374 | echo _AM_NEWBB_TYPE_HELP; |
375 | - echo "<table width='100%' border='0' cellspacing='1' class='outer'>" . "<tr><td class='odd'>"; |
|
376 | - echo "<form name='list' method='post' action='" . xoops_getenv('PHP_SELF') . "'>"; |
|
375 | + echo "<table width='100%' border='0' cellspacing='1' class='outer'>"."<tr><td class='odd'>"; |
|
376 | + echo "<form name='list' method='post' action='".xoops_getenv('PHP_SELF')."'>"; |
|
377 | 377 | echo "<table border='0' cellpadding='4' cellspacing='1' width='100%' class='outer'>"; |
378 | 378 | echo "<tr align='center'>"; |
379 | 379 | if ('add' !== $op) { |
380 | - echo "<th class='bg3' width='5%'>" . _DELETE . '</th>'; |
|
380 | + echo "<th class='bg3' width='5%'>"._DELETE.'</th>'; |
|
381 | 381 | } |
382 | - echo "<th align='left' class='bg3' width='20%'>" . _AM_NEWBB_TYPE_NAME . '</th>'; |
|
383 | - echo "<th class='bg3' width='15%'>" . _AM_NEWBB_TYPE_COLOR . '</th>'; |
|
384 | - echo "<th align='left' class='bg3'>" . _AM_NEWBB_TYPE_DESCRIPTION . '</th>'; |
|
382 | + echo "<th align='left' class='bg3' width='20%'>"._AM_NEWBB_TYPE_NAME.'</th>'; |
|
383 | + echo "<th class='bg3' width='15%'>"._AM_NEWBB_TYPE_COLOR.'</th>'; |
|
384 | + echo "<th align='left' class='bg3'>"._AM_NEWBB_TYPE_DESCRIPTION.'</th>'; |
|
385 | 385 | echo '</tr>'; |
386 | 386 | |
387 | 387 | $isColorpicker = require_once $GLOBALS['xoops']->path('class/xoopsform/formcolorpicker.php'); |
@@ -390,14 +390,14 @@ discard block |
||
390 | 390 | foreach ($typesObject as $key => $typeObject) { |
391 | 391 | echo "<tr class='odd' align='left'>"; |
392 | 392 | echo "<td><input type='checkbox' name='type_del[{$key}]' /></td>"; |
393 | - echo "<td><input type='text' name='type_name[{$key}]' value='" . $typeObject->getVar('type_name') . "' size='10' /></td>"; |
|
393 | + echo "<td><input type='text' name='type_name[{$key}]' value='".$typeObject->getVar('type_name')."' size='10' /></td>"; |
|
394 | 394 | if ($isColorpicker) { |
395 | 395 | $form_colorpicker = new \XoopsFormColorPicker('', "type_color[{$key}]", $typeObject->getVar('type_color')); |
396 | - echo '<td>' . $form_colorpicker->render() . '</td>'; |
|
396 | + echo '<td>'.$form_colorpicker->render().'</td>'; |
|
397 | 397 | } else { |
398 | - echo "<td><input type='text' name='type_color[{$key}]' value='" . $typeObject->getVar('type_color') . "' size='10' /></td>"; |
|
398 | + echo "<td><input type='text' name='type_color[{$key}]' value='".$typeObject->getVar('type_color')."' size='10' /></td>"; |
|
399 | 399 | } |
400 | - echo "<td><input type='text' name='type_description[{$key}]' value='" . $typeObject->getVar('type_description') . "' size='30' /></td>"; |
|
400 | + echo "<td><input type='text' name='type_description[{$key}]' value='".$typeObject->getVar('type_description')."' size='30' /></td>"; |
|
401 | 401 | echo '</tr>'; |
402 | 402 | } |
403 | 403 | echo "<tr><td colspan='4' style='text-align:center;'>"; |
@@ -410,7 +410,7 @@ discard block |
||
410 | 410 | echo "<td><input type='text' name='type_name[{$i}]' value='' size='10' /></td>"; |
411 | 411 | if ($isColorpicker) { |
412 | 412 | $form_colorpicker = new \XoopsFormColorPicker('', "type_color[{$i}]", ''); |
413 | - echo '<td>' . $form_colorpicker->render() . '</td>'; |
|
413 | + echo '<td>'.$form_colorpicker->render().'</td>'; |
|
414 | 414 | } else { |
415 | 415 | echo "<td><input type='text' name='type_color[{$i}]' value='' size='10' /></td>"; |
416 | 416 | } |
@@ -421,16 +421,16 @@ discard block |
||
421 | 421 | echo "<input type='hidden' name='isnew' value='1' />"; |
422 | 422 | } |
423 | 423 | echo "<input type='hidden' name='op' value='save_type' />"; |
424 | - echo "<input type='submit' name='submit' value='" . _SUBMIT . "' /> "; |
|
425 | - echo "<input type='reset' value='" . _CANCEL . "' />"; |
|
424 | + echo "<input type='submit' name='submit' value='"._SUBMIT."' /> "; |
|
425 | + echo "<input type='reset' value='"._CANCEL."' />"; |
|
426 | 426 | echo '</td></tr></table>'; |
427 | 427 | echo '</form>'; |
428 | 428 | echo '</td></tr></table>'; |
429 | 429 | echo '<fieldset>'; |
430 | - echo '<legend> ' . _MI_NEWBB_ADMENU_TYPE . ' </legend>'; |
|
430 | + echo '<legend> '._MI_NEWBB_ADMENU_TYPE.' </legend>'; |
|
431 | 431 | echo _AM_NEWBB_HELP_TYPE_TAB; |
432 | 432 | echo '</fieldset>'; |
433 | 433 | break; |
434 | 434 | } |
435 | 435 | |
436 | -require_once __DIR__ . '/admin_footer.php'; |
|
436 | +require_once __DIR__.'/admin_footer.php'; |
@@ -32,19 +32,19 @@ discard block |
||
32 | 32 | */ |
33 | 33 | $op = Request::getCmd('op', ''); |
34 | 34 | $validOps = [ |
35 | - 'save_type', |
|
36 | - 'delete', |
|
37 | - 'template', |
|
38 | - 'save_template', |
|
39 | - 'apply', |
|
40 | - 'save_apply', |
|
41 | - 'forum', |
|
42 | - 'edit_forum', |
|
43 | - 'save_forum', |
|
44 | - 'add' |
|
35 | + 'save_type', |
|
36 | + 'delete', |
|
37 | + 'template', |
|
38 | + 'save_template', |
|
39 | + 'apply', |
|
40 | + 'save_apply', |
|
41 | + 'forum', |
|
42 | + 'edit_forum', |
|
43 | + 'save_forum', |
|
44 | + 'add' |
|
45 | 45 | ]; |
46 | 46 | if (!in_array($op, $validOps, true)) { |
47 | - $op = ''; |
|
47 | + $op = ''; |
|
48 | 48 | } |
49 | 49 | |
50 | 50 | ///** @var Newbb\TypeHandler $typeHandler */ |
@@ -52,385 +52,385 @@ discard block |
||
52 | 52 | $cacheHelper = new \Xmf\Module\Helper\Cache('newbb'); |
53 | 53 | |
54 | 54 | switch ($op) { |
55 | - case 'save_type': |
|
56 | - $type_names0 = $_POST['type_name']; |
|
57 | - $type_names = Request::getArray('type_name', null, 'POST'); |
|
58 | - $type_del = []; |
|
59 | - foreach (array_keys($type_names) as $key) { |
|
60 | - if (Request::getBool('isnew', '', 'POST')) { |
|
61 | - $typeObject = $typeHandler->create(); |
|
62 | - } elseif (!$typeObject = $typeHandler->get($key)) { |
|
63 | - continue; |
|
64 | - } |
|
65 | - |
|
66 | - // if (Request::getArray("type_del[$key]", '', 'POST')) { |
|
67 | - $temp = Request::getArray('type_del', '', 'POST'); |
|
68 | - if ($temp[$key]) { |
|
69 | - $type_del[] = $key; |
|
70 | - continue; |
|
71 | - } else { |
|
72 | - foreach (['type_name', 'type_color', 'type_description'] as $var) { |
|
73 | - // if ($typeObject->getVar($var) != @$_POST[$var][$key]) { |
|
74 | - // $typeObject->setVar($var, @$_POST[$var][$key]); |
|
75 | - // } |
|
76 | - $temp = Request::getArray($var, '', 'POST'); |
|
77 | - if ($typeObject->getVar($var) != $temp[$key]) { |
|
78 | - $typeObject->setVar($var, $temp[$key]); |
|
79 | - } |
|
80 | - |
|
81 | - // $typeObject->setVar($var, Request::getArray($var, '', 'POST')[$key]); |
|
82 | - } |
|
83 | - $typeHandler->insert($typeObject); |
|
84 | - unset($typeObject); |
|
85 | - } |
|
86 | - } |
|
87 | - if (count($type_del) > 0) { |
|
88 | - $type_list = $typeHandler->getList(new \Criteria('type_id', '(' . implode(', ', $type_del) . ')', 'IN')); |
|
89 | - xoops_confirm(['op' => 'delete', 'type_del' => serialize($type_del)], xoops_getenv('PHP_SELF'), sprintf(_AM_NEWBB_TODEL_TYPE, implode(', ', array_values($type_list))), '', false); |
|
90 | - } else { |
|
91 | - redirect_header(xoops_getenv('PHP_SELF'), 2, _MD_NEWBB_DBUPDATED); |
|
92 | - } |
|
93 | - break; |
|
94 | - |
|
95 | - case 'delete': |
|
96 | - $type_dels = @unserialize(Request::getString('type_del', '', 'POST')); |
|
97 | - foreach ($type_dels as $key) { |
|
98 | - if (!$typeObject = $typeHandler->get($key)) { |
|
99 | - continue; |
|
100 | - } |
|
101 | - $typeHandler->delete($typeObject); |
|
102 | - unset($typeObject); |
|
103 | - } |
|
104 | - redirect_header(xoops_getenv('PHP_SELF'), 2, _MD_NEWBB_DBUPDATED); |
|
105 | - break; |
|
106 | - |
|
107 | - case 'template': |
|
108 | - $typesObject = $typeHandler->getAll(); |
|
109 | - if (0 === count($typesObject)) { |
|
110 | - redirect_header(xoops_getenv('PHP_SELF'), 2, _AM_NEWBB_TYPE_ADD_ERR); |
|
111 | - } |
|
112 | - |
|
113 | - $adminObject->addItemButton(_AM_NEWBB_TYPE_ADD, 'admin_type_manager.php?op=add', $icon = 'add'); |
|
114 | - $adminObject->addItemButton(_AM_NEWBB_TYPE_TEMPLATE, 'admin_type_manager.php?op=template', $icon = 'add'); |
|
115 | - $adminObject->addItemButton(_AM_NEWBB_TYPE_TEMPLATE_APPLY, 'admin_type_manager.php?op=apply', $icon = 'add'); |
|
116 | - $adminObject->addItemButton(_AM_NEWBB_TYPE_FORUM, 'admin_type_manager.php?op=forum', $icon = 'add'); |
|
117 | - $adminObject->displayButton('left'); |
|
118 | - echo '<legend style="font-weight: bold; color: #900;">' . _AM_NEWBB_TYPE_ORDER_DESC . '</legend>'; |
|
119 | - echo "<table width='100%' border='0' cellspacing='1' class='outer'>" . "<tr><td class='odd'>"; |
|
120 | - echo "<form name='template' method='post' action='" . xoops_getenv('PHP_SELF') . "'>"; |
|
121 | - echo "<table border='0' cellpadding='4' cellspacing='1' width='100%' class='outer'>"; |
|
122 | - echo "<tr align='center'>"; |
|
123 | - echo "<th class='bg3' width='20%'>" . _AM_NEWBB_TYPE_ORDER . '</th>'; |
|
124 | - echo "<th class='bg3' width='20%'>" . _AM_NEWBB_TYPE_NAME . '</th>'; |
|
125 | - echo "<th class='bg3'>" . _AM_NEWBB_TYPE_DESCRIPTION . '</th>'; |
|
126 | - echo '</tr>'; |
|
127 | - |
|
128 | - if ($templates = $cacheHelper->read('type_template')) { |
|
129 | - arsort($templates); |
|
130 | - foreach ($templates as $order => $key) { |
|
131 | - if (!isset($typesObject[$key])) { |
|
132 | - continue; |
|
133 | - } |
|
134 | - $typeObject = $typesObject[$key]; |
|
135 | - echo "<tr class='even' align='left'>"; |
|
136 | - echo "<td><input type='text' name='type_order[{$key}]' value='" . $order . "' size='10' /></td>"; |
|
137 | - echo "<td><em style='color:" . $typeObject->getVar('type_color') . ";'>" . $typeObject->getVar('type_name') . '</em></td>'; |
|
138 | - echo '<td>' . $typeObject->getVar('type_description') . '</td>'; |
|
139 | - echo '</tr>'; |
|
140 | - unset($typesObject[$key]); |
|
141 | - } |
|
142 | - echo "<tr><td colspan='3' height='5px'></td></tr>"; |
|
143 | - } |
|
144 | - foreach ($typesObject as $key => $typeObject) { |
|
145 | - echo "<tr class='odd' align='left'>"; |
|
146 | - echo "<td><input type='text' name='type_order[{$key}]' value='0' size='10' /></td>"; |
|
147 | - echo "<td><em style='color:" . $typeObject->getVar('type_color') . ";'>" . $typeObject->getVar('type_name') . '</em></td>'; |
|
148 | - echo '<td>' . $typeObject->getVar('type_description') . '</td>'; |
|
149 | - echo '</tr>'; |
|
150 | - } |
|
151 | - |
|
152 | - echo "<tr><td colspan='3' style='text-align:center;'>"; |
|
153 | - echo "<input type='hidden' name='op' value='save_template' />"; |
|
154 | - echo "<input type='submit' name='submit' value='" . _SUBMIT . "' /> "; |
|
155 | - echo "<input type='reset' value='" . _CANCEL . "' />"; |
|
156 | - echo '</td></tr></table>'; |
|
157 | - echo '</form>'; |
|
158 | - echo '</td></tr></table>'; |
|
159 | - break; |
|
160 | - |
|
161 | - case 'save_template': |
|
162 | - $templates = array_flip(array_filter(Request::getArray('type_order', [], 'POST'))); |
|
163 | - $cacheHelper->write('type_template', $templates); |
|
164 | - redirect_header(xoops_getenv('PHP_SELF') . '?op=template', 2, _MD_NEWBB_DBUPDATED); |
|
165 | - break; |
|
166 | - |
|
167 | - case 'apply': |
|
168 | - if (!$templates = $cacheHelper->read('type_template')) { |
|
169 | - redirect_header(xoops_getenv('PHP_SELF') . '?op=template', 2, _AM_NEWBB_TYPE_TEMPLATE_ERR); |
|
170 | - } |
|
171 | - |
|
172 | - // $categoryHandler = Newbb\Helper::getInstance()->getHandler('Category'); |
|
173 | - $criteriaCategory = new \CriteriaCompo(new \Criteria('1', 1)); |
|
174 | - $criteriaCategory->setSort('cat_order'); |
|
175 | - $categories = $categoryHandler->getList($criteriaCategory); |
|
176 | - // $forumHandler = Newbb\Helper::getInstance()->getHandler('Forum'); |
|
177 | - $forums = $forumHandler->getTree(array_keys($categories), 0, 'all'); |
|
178 | - foreach (array_keys($forums) as $c) { |
|
179 | - $fm_options[-1 * $c] = '[' . $categories[$c] . ']'; |
|
180 | - foreach (array_keys($forums[$c]) as $f) { |
|
181 | - $fm_options[$f] = $forums[$c][$f]['prefix'] . $forums[$c][$f]['forum_name']; |
|
182 | - } |
|
183 | - } |
|
184 | - unset($forums, $categories); |
|
185 | - $fmform = new \XoopsThemeForm(_AM_NEWBB_TYPE_TEMPLATE_APPLY, 'fmform', xoops_getenv('PHP_SELF'), 'post', true); |
|
186 | - $fm_select = new \XoopsFormSelect(_AM_NEWBB_PERM_FORUMS, 'forums', null, 10, true); |
|
187 | - $fm_select->addOptionArray($fm_options); |
|
188 | - $fmform->addElement($fm_select); |
|
189 | - $tray = new \XoopsFormElementTray(''); |
|
190 | - $tray->addElement(new \XoopsFormHidden('op', 'save_apply')); |
|
191 | - $tray->addElement(new \XoopsFormButton('', 'submit', _SUBMIT, 'submit')); |
|
192 | - $tray->addElement(new \XoopsFormButton('', 'reset', _CANCEL, 'reset')); |
|
193 | - $fmform->addElement($tray); |
|
194 | - |
|
195 | - //loadModuleAdminMenu(11, _AM_NEWBB_TYPE_TEMPLATE_APPLY); |
|
196 | - $adminObject->addItemButton(_AM_NEWBB_TYPE_ADD, 'admin_type_manager.php?op=add', $icon = 'add'); |
|
197 | - $adminObject->addItemButton(_AM_NEWBB_TYPE_TEMPLATE, 'admin_type_manager.php?op=template', $icon = 'add'); |
|
198 | - $adminObject->addItemButton(_AM_NEWBB_TYPE_TEMPLATE_APPLY, 'admin_type_manager.php?op=apply', $icon = 'add'); |
|
199 | - $adminObject->addItemButton(_AM_NEWBB_TYPE_FORUM, 'admin_type_manager.php?op=forum', $icon = 'add'); |
|
200 | - $adminObject->displayButton('left'); |
|
201 | - |
|
202 | - echo "<table width='100%' border='0' cellspacing='1' class='outer'>" . "<tr><td class='odd'>"; |
|
203 | - echo "<table border='0' cellpadding='4' cellspacing='1' width='100%' class='outer'>"; |
|
204 | - echo "<tr align='center'>"; |
|
205 | - echo "<th class='bg3' width='20%'>" . _AM_NEWBB_TYPE_NAME . '</th>'; |
|
206 | - echo "<th class='bg3' width='20%'>" . _AM_NEWBB_TYPE_ORDER . '</th>'; |
|
207 | - echo "<th class='bg3'>" . _AM_NEWBB_TYPE_DESCRIPTION . '</th>'; |
|
208 | - echo '</tr>'; |
|
209 | - |
|
210 | - $typesObject = $typeHandler->getAll(new \Criteria('type_id', '(' . implode(', ', array_values($templates)) . ')', 'IN')); |
|
211 | - arsort($templates); |
|
212 | - foreach ($templates as $order => $key) { |
|
213 | - if (!isset($typesObject[$key])) { |
|
214 | - continue; |
|
215 | - } |
|
216 | - $typeObject = $typesObject[$key]; |
|
217 | - echo "<tr class='even' align='left'>"; |
|
218 | - echo "<td><em style='color:" . $typeObject->getVar('type_color') . ";'>" . $typeObject->getVar('type_name') . '</em></td>'; |
|
219 | - echo '<td>' . $order . '</td>'; |
|
220 | - echo '<td>' . $typeObject->getVar('type_description') . '</td>'; |
|
221 | - echo '</tr>'; |
|
222 | - unset($typesObject[$key]); |
|
223 | - } |
|
224 | - echo '</table>'; |
|
225 | - echo '</td></tr></table>'; |
|
226 | - echo '<br>'; |
|
227 | - $fmform->display(); |
|
228 | - break; |
|
229 | - |
|
230 | - case 'save_apply': |
|
231 | - if (!$templates = $cacheHelper->read('type_template')) { |
|
232 | - redirect_header(xoops_getenv('PHP_SELF') . '?op=template', 2, _AM_NEWBB_TYPE_TEMPLATE); |
|
233 | - } |
|
234 | - foreach (Request::getArray('forums', [], 'POST') as $forum) { |
|
235 | - if ($forum < 1) { |
|
236 | - continue; |
|
237 | - } |
|
238 | - $typeHandler->updateByForum($forum, array_flip($templates)); |
|
239 | - } |
|
240 | - redirect_header(xoops_getenv('PHP_SELF'), 2, _MD_NEWBB_DBUPDATED); |
|
241 | - break; |
|
242 | - |
|
243 | - case 'forum': |
|
244 | - // $categoryHandler = Newbb\Helper::getInstance()->getHandler('Category'); |
|
245 | - $criteriaCategory = new \CriteriaCompo(new \Criteria('1', 1)); |
|
246 | - $criteriaCategory->setSort('cat_order'); |
|
247 | - $categories = $categoryHandler->getList($criteriaCategory); |
|
248 | - if (empty($categories)) { |
|
249 | - redirect_header('admin_cat_manager.php', 2, _AM_NEWBB_CREATENEWCATEGORY); |
|
250 | - } |
|
251 | - // $forumHandler = Newbb\Helper::getInstance()->getHandler('Forum'); |
|
252 | - $forums = $forumHandler->getTree(array_keys($categories)); |
|
253 | - if (empty($forums)) { |
|
254 | - redirect_header('admin_forum_manager.php', 2, _AM_NEWBB_CREATENEWFORUM); |
|
255 | - } |
|
256 | - |
|
257 | - foreach (array_keys($forums) as $c) { |
|
258 | - $fm_options[-1 * $c] = '[' . $categories[$c] . ']'; |
|
259 | - foreach (array_keys($forums[$c]) as $f) { |
|
260 | - $fm_options[$f] = $forums[$c][$f]['prefix'] . $forums[$c][$f]['forum_name']; |
|
261 | - } |
|
262 | - } |
|
263 | - unset($forums, $categories); |
|
264 | - $fmform = new \XoopsThemeForm(_AM_NEWBB_TYPE_FORUM, 'fmform', xoops_getenv('PHP_SELF'), 'post', true); |
|
265 | - $fm_select = new \XoopsFormSelect(_AM_NEWBB_PERM_FORUMS, 'forum', null, 5, false); |
|
266 | - $fm_select->addOptionArray($fm_options); |
|
267 | - $fmform->addElement($fm_select); |
|
268 | - $tray = new \XoopsFormElementTray(''); |
|
269 | - $tray->addElement(new \XoopsFormHidden('op', 'edit_forum')); |
|
270 | - $tray->addElement(new \XoopsFormButton('', 'submit', _SUBMIT, 'submit')); |
|
271 | - $tray->addElement(new \XoopsFormButton('', 'reset', _CANCEL, 'reset')); |
|
272 | - $fmform->addElement($tray); |
|
273 | - |
|
274 | - //loadModuleAdminMenu(11, _AM_NEWBB_TYPE_FORUM); |
|
275 | - $adminObject->addItemButton(_AM_NEWBB_TYPE_ADD, 'admin_type_manager.php?op=add', $icon = 'add'); |
|
276 | - $adminObject->addItemButton(_AM_NEWBB_TYPE_TEMPLATE, 'admin_type_manager.php?op=template', $icon = 'add'); |
|
277 | - $adminObject->addItemButton(_AM_NEWBB_TYPE_FORUM, 'admin_type_manager.php?op=forum', $icon = 'add'); |
|
278 | - $adminObject->displayButton('left'); |
|
279 | - |
|
280 | - $fmform->display(); |
|
281 | - break; |
|
282 | - |
|
283 | - case 'edit_forum': |
|
284 | - if (!Request::getInt('forum', 0, 'POST') || Request::getInt('forum', 0, 'POST') < 1) { |
|
285 | - redirect_header(xoops_getenv('PHP_SELF') . '?op=forum', 2, _AM_NEWBB_TYPE_FORUM_ERR); |
|
286 | - } |
|
287 | - |
|
288 | - // $forumHandler = Newbb\Helper::getInstance()->getHandler('Forum'); |
|
289 | - if (!$forumObject = $forumHandler->get(Request::getInt('forum', 0, 'POST'))) { |
|
290 | - redirect_header(xoops_getenv('PHP_SELF') . '?op=forum', 2, _AM_NEWBB_TYPE_FORUM_ERR); |
|
291 | - } |
|
292 | - |
|
293 | - $typesObject = $typeHandler->getAll(); |
|
294 | - if (0 === count($typesObject)) { |
|
295 | - redirect_header(xoops_getenv('PHP_SELF'), 2, _AM_NEWBB_TYPE_ADD_ERR); |
|
296 | - } |
|
297 | - |
|
298 | - $adminObject->addItemButton(_AM_NEWBB_TYPE_ADD, 'admin_type_manager.php?op=add', $icon = 'add'); |
|
299 | - $adminObject->addItemButton(_AM_NEWBB_TYPE_TEMPLATE, 'admin_type_manager.php?op=template', $icon = 'add'); |
|
300 | - $adminObject->addItemButton(_AM_NEWBB_TYPE_FORUM, 'admin_type_manager.php?op=forum', $icon = 'add'); |
|
301 | - $adminObject->displayButton('left'); |
|
302 | - echo '<legend style="font-weight: bold; color: #900;">' . _AM_NEWBB_TYPE_ORDER_DESC . '</legend>'; |
|
303 | - echo "<table width='100%' border='0' cellspacing='1' class='outer'>" . "<tr><td class='odd'>"; |
|
304 | - echo "<form name='template' method='post' action='" . xoops_getenv('PHP_SELF') . "'>"; |
|
305 | - echo "<table border='0' cellpadding='4' cellspacing='1' width='100%' class='outer'>"; |
|
306 | - echo "<tr align='center'>"; |
|
307 | - echo "<th class='bg3' width='20%'>" . _AM_NEWBB_TYPE_ORDER . '</th>'; |
|
308 | - echo "<th class='bg3' width='20%'>" . _AM_NEWBB_TYPE_NAME . '</th>'; |
|
309 | - echo "<th class='bg3'>" . _AM_NEWBB_TYPE_DESCRIPTION . '</th>'; |
|
310 | - echo '</tr>'; |
|
311 | - |
|
312 | - $types = $typeHandler->getByForum(Request::getInt('forum', 0, 'POST')); |
|
313 | - $types_order = []; |
|
314 | - foreach ($types as $key => $type) { |
|
315 | - $types_order[] = $type['type_order']; |
|
316 | - } |
|
317 | - array_multisort($types_order, $types); |
|
318 | - foreach ($types as $key => $type) { |
|
319 | - if (!isset($typesObject[$type['type_id']])) { |
|
320 | - continue; |
|
321 | - } |
|
322 | - $typeObject = $typesObject[$type['type_id']]; |
|
323 | - echo "<tr class='even' align='left'>"; |
|
324 | - echo "<td><input type='text' name='type_order[" . $type['type_id'] . "]' value='" . $type['type_order'] . "' size='10' /></td>"; |
|
325 | - echo "<td><em style='color:" . $typeObject->getVar('type_color') . ";'>" . $typeObject->getVar('type_name') . '</em></td>'; |
|
326 | - echo '<td>' . $typeObject->getVar('type_description') . '</td>'; |
|
327 | - echo '</tr>'; |
|
328 | - unset($typesObject[$type['type_id']]); |
|
329 | - } |
|
330 | - echo "<tr><td colspan='3' height='5px'></td></tr>"; |
|
331 | - foreach ($typesObject as $key => $typeObject) { |
|
332 | - echo "<tr class='odd' align='left'>"; |
|
333 | - echo "<td><input type='text' name='type_order[{$key}]' value='0' size='10' /></td>"; |
|
334 | - echo "<td><em style='color:" . $typeObject->getVar('type_color') . ";'>" . $typeObject->getVar('type_name') . '</em></td>'; |
|
335 | - echo '<td>' . $typeObject->getVar('type_description') . '</td>'; |
|
336 | - echo '</tr>'; |
|
337 | - } |
|
338 | - |
|
339 | - echo "<tr><td colspan='3' style='text-align:center;'>"; |
|
340 | - echo '<legend style="font-weight: bold; color: #900;">' . _AM_NEWBB_TYPE_EDITFORUM_DESC . '</legend>'; |
|
341 | - echo "<input type='hidden' name='forum' value='" . Request::getInt('forum', 0, 'POST') . "' />"; |
|
342 | - echo "<input type='hidden' name='op' value='save_forum' />"; |
|
343 | - echo "<input type='submit' name='submit' value='" . _SUBMIT . "' /> "; |
|
344 | - echo "<input type='reset' value='" . _CANCEL . "' />"; |
|
345 | - echo '</td></tr></table>'; |
|
346 | - echo '</form>'; |
|
347 | - echo '</td></tr></table>'; |
|
348 | - break; |
|
349 | - |
|
350 | - case 'save_forum': |
|
351 | - if (!Request::getInt('forum', 0, 'POST') || Request::getInt('forum', 0, 'POST') < 1) { |
|
352 | - redirect_header(xoops_getenv('PHP_SELF') . '?op=forum', 2, _AM_NEWBB_TYPE_FORUM); |
|
353 | - } |
|
354 | - $typeHandler->updateByForum(Request::getInt('forum', 0, 'POST'), Request::getArray('type_order', null, 'POST')); |
|
355 | - redirect_header(xoops_getenv('PHP_SELF') . '?op=forum', 2, _MD_NEWBB_DBUPDATED); |
|
356 | - break; |
|
357 | - |
|
358 | - case 'add': |
|
359 | - default: |
|
360 | - $typesObject = $typeHandler->getAll(); |
|
361 | - if (0 === count($typesObject)) { |
|
362 | - $op = 'add'; |
|
363 | - $title = _AM_NEWBB_TYPE_ADD; |
|
364 | - } else { |
|
365 | - $title = _AM_NEWBB_TYPE_LIST; |
|
366 | - } |
|
367 | - |
|
368 | - if ('add' !== $op) { |
|
369 | - $adminObject->addItemButton(_AM_NEWBB_TYPE_ADD, 'admin_type_manager.php?op=add', $icon = 'add'); |
|
370 | - $adminObject->addItemButton(_AM_NEWBB_TYPE_TEMPLATE, 'admin_type_manager.php?op=template', $icon = 'add'); |
|
371 | - $adminObject->addItemButton(_AM_NEWBB_TYPE_FORUM, 'admin_type_manager.php?op=forum', $icon = 'add'); |
|
372 | - $adminObject->displayButton('left'); |
|
373 | - } |
|
374 | - echo _AM_NEWBB_TYPE_HELP; |
|
375 | - echo "<table width='100%' border='0' cellspacing='1' class='outer'>" . "<tr><td class='odd'>"; |
|
376 | - echo "<form name='list' method='post' action='" . xoops_getenv('PHP_SELF') . "'>"; |
|
377 | - echo "<table border='0' cellpadding='4' cellspacing='1' width='100%' class='outer'>"; |
|
378 | - echo "<tr align='center'>"; |
|
379 | - if ('add' !== $op) { |
|
380 | - echo "<th class='bg3' width='5%'>" . _DELETE . '</th>'; |
|
381 | - } |
|
382 | - echo "<th align='left' class='bg3' width='20%'>" . _AM_NEWBB_TYPE_NAME . '</th>'; |
|
383 | - echo "<th class='bg3' width='15%'>" . _AM_NEWBB_TYPE_COLOR . '</th>'; |
|
384 | - echo "<th align='left' class='bg3'>" . _AM_NEWBB_TYPE_DESCRIPTION . '</th>'; |
|
385 | - echo '</tr>'; |
|
386 | - |
|
387 | - $isColorpicker = require_once $GLOBALS['xoops']->path('class/xoopsform/formcolorpicker.php'); |
|
388 | - |
|
389 | - if ('add' !== $op) { |
|
390 | - foreach ($typesObject as $key => $typeObject) { |
|
391 | - echo "<tr class='odd' align='left'>"; |
|
392 | - echo "<td><input type='checkbox' name='type_del[{$key}]' /></td>"; |
|
393 | - echo "<td><input type='text' name='type_name[{$key}]' value='" . $typeObject->getVar('type_name') . "' size='10' /></td>"; |
|
394 | - if ($isColorpicker) { |
|
395 | - $form_colorpicker = new \XoopsFormColorPicker('', "type_color[{$key}]", $typeObject->getVar('type_color')); |
|
396 | - echo '<td>' . $form_colorpicker->render() . '</td>'; |
|
397 | - } else { |
|
398 | - echo "<td><input type='text' name='type_color[{$key}]' value='" . $typeObject->getVar('type_color') . "' size='10' /></td>"; |
|
399 | - } |
|
400 | - echo "<td><input type='text' name='type_description[{$key}]' value='" . $typeObject->getVar('type_description') . "' size='30' /></td>"; |
|
401 | - echo '</tr>'; |
|
402 | - } |
|
403 | - echo "<tr><td colspan='4' style='text-align:center;'>"; |
|
404 | - } else { |
|
405 | - $adminObject->addItemButton(_AM_NEWBB_TYPE_TEMPLATE, 'admin_type_manager.php?op=template', $icon = 'add'); |
|
406 | - $adminObject->addItemButton(_AM_NEWBB_TYPE_FORUM, 'admin_type_manager.php?op=forum', $icon = 'add'); |
|
407 | - $adminObject->displayButton('left'); |
|
408 | - for ($i = 0; $i < 10; ++$i) { |
|
409 | - echo "<tr class='odd' align='left'>"; |
|
410 | - echo "<td><input type='text' name='type_name[{$i}]' value='' size='10' /></td>"; |
|
411 | - if ($isColorpicker) { |
|
412 | - $form_colorpicker = new \XoopsFormColorPicker('', "type_color[{$i}]", ''); |
|
413 | - echo '<td>' . $form_colorpicker->render() . '</td>'; |
|
414 | - } else { |
|
415 | - echo "<td><input type='text' name='type_color[{$i}]' value='' size='10' /></td>"; |
|
416 | - } |
|
417 | - echo "<td><input type='text' name='type_description[{$i}]' value='' size='40' /></td>"; |
|
418 | - echo '</tr>'; |
|
419 | - } |
|
420 | - echo "<tr><td colspan='3' style='text-align:center;'>"; |
|
421 | - echo "<input type='hidden' name='isnew' value='1' />"; |
|
422 | - } |
|
423 | - echo "<input type='hidden' name='op' value='save_type' />"; |
|
424 | - echo "<input type='submit' name='submit' value='" . _SUBMIT . "' /> "; |
|
425 | - echo "<input type='reset' value='" . _CANCEL . "' />"; |
|
426 | - echo '</td></tr></table>'; |
|
427 | - echo '</form>'; |
|
428 | - echo '</td></tr></table>'; |
|
429 | - echo '<fieldset>'; |
|
430 | - echo '<legend> ' . _MI_NEWBB_ADMENU_TYPE . ' </legend>'; |
|
431 | - echo _AM_NEWBB_HELP_TYPE_TAB; |
|
432 | - echo '</fieldset>'; |
|
433 | - break; |
|
55 | + case 'save_type': |
|
56 | + $type_names0 = $_POST['type_name']; |
|
57 | + $type_names = Request::getArray('type_name', null, 'POST'); |
|
58 | + $type_del = []; |
|
59 | + foreach (array_keys($type_names) as $key) { |
|
60 | + if (Request::getBool('isnew', '', 'POST')) { |
|
61 | + $typeObject = $typeHandler->create(); |
|
62 | + } elseif (!$typeObject = $typeHandler->get($key)) { |
|
63 | + continue; |
|
64 | + } |
|
65 | + |
|
66 | + // if (Request::getArray("type_del[$key]", '', 'POST')) { |
|
67 | + $temp = Request::getArray('type_del', '', 'POST'); |
|
68 | + if ($temp[$key]) { |
|
69 | + $type_del[] = $key; |
|
70 | + continue; |
|
71 | + } else { |
|
72 | + foreach (['type_name', 'type_color', 'type_description'] as $var) { |
|
73 | + // if ($typeObject->getVar($var) != @$_POST[$var][$key]) { |
|
74 | + // $typeObject->setVar($var, @$_POST[$var][$key]); |
|
75 | + // } |
|
76 | + $temp = Request::getArray($var, '', 'POST'); |
|
77 | + if ($typeObject->getVar($var) != $temp[$key]) { |
|
78 | + $typeObject->setVar($var, $temp[$key]); |
|
79 | + } |
|
80 | + |
|
81 | + // $typeObject->setVar($var, Request::getArray($var, '', 'POST')[$key]); |
|
82 | + } |
|
83 | + $typeHandler->insert($typeObject); |
|
84 | + unset($typeObject); |
|
85 | + } |
|
86 | + } |
|
87 | + if (count($type_del) > 0) { |
|
88 | + $type_list = $typeHandler->getList(new \Criteria('type_id', '(' . implode(', ', $type_del) . ')', 'IN')); |
|
89 | + xoops_confirm(['op' => 'delete', 'type_del' => serialize($type_del)], xoops_getenv('PHP_SELF'), sprintf(_AM_NEWBB_TODEL_TYPE, implode(', ', array_values($type_list))), '', false); |
|
90 | + } else { |
|
91 | + redirect_header(xoops_getenv('PHP_SELF'), 2, _MD_NEWBB_DBUPDATED); |
|
92 | + } |
|
93 | + break; |
|
94 | + |
|
95 | + case 'delete': |
|
96 | + $type_dels = @unserialize(Request::getString('type_del', '', 'POST')); |
|
97 | + foreach ($type_dels as $key) { |
|
98 | + if (!$typeObject = $typeHandler->get($key)) { |
|
99 | + continue; |
|
100 | + } |
|
101 | + $typeHandler->delete($typeObject); |
|
102 | + unset($typeObject); |
|
103 | + } |
|
104 | + redirect_header(xoops_getenv('PHP_SELF'), 2, _MD_NEWBB_DBUPDATED); |
|
105 | + break; |
|
106 | + |
|
107 | + case 'template': |
|
108 | + $typesObject = $typeHandler->getAll(); |
|
109 | + if (0 === count($typesObject)) { |
|
110 | + redirect_header(xoops_getenv('PHP_SELF'), 2, _AM_NEWBB_TYPE_ADD_ERR); |
|
111 | + } |
|
112 | + |
|
113 | + $adminObject->addItemButton(_AM_NEWBB_TYPE_ADD, 'admin_type_manager.php?op=add', $icon = 'add'); |
|
114 | + $adminObject->addItemButton(_AM_NEWBB_TYPE_TEMPLATE, 'admin_type_manager.php?op=template', $icon = 'add'); |
|
115 | + $adminObject->addItemButton(_AM_NEWBB_TYPE_TEMPLATE_APPLY, 'admin_type_manager.php?op=apply', $icon = 'add'); |
|
116 | + $adminObject->addItemButton(_AM_NEWBB_TYPE_FORUM, 'admin_type_manager.php?op=forum', $icon = 'add'); |
|
117 | + $adminObject->displayButton('left'); |
|
118 | + echo '<legend style="font-weight: bold; color: #900;">' . _AM_NEWBB_TYPE_ORDER_DESC . '</legend>'; |
|
119 | + echo "<table width='100%' border='0' cellspacing='1' class='outer'>" . "<tr><td class='odd'>"; |
|
120 | + echo "<form name='template' method='post' action='" . xoops_getenv('PHP_SELF') . "'>"; |
|
121 | + echo "<table border='0' cellpadding='4' cellspacing='1' width='100%' class='outer'>"; |
|
122 | + echo "<tr align='center'>"; |
|
123 | + echo "<th class='bg3' width='20%'>" . _AM_NEWBB_TYPE_ORDER . '</th>'; |
|
124 | + echo "<th class='bg3' width='20%'>" . _AM_NEWBB_TYPE_NAME . '</th>'; |
|
125 | + echo "<th class='bg3'>" . _AM_NEWBB_TYPE_DESCRIPTION . '</th>'; |
|
126 | + echo '</tr>'; |
|
127 | + |
|
128 | + if ($templates = $cacheHelper->read('type_template')) { |
|
129 | + arsort($templates); |
|
130 | + foreach ($templates as $order => $key) { |
|
131 | + if (!isset($typesObject[$key])) { |
|
132 | + continue; |
|
133 | + } |
|
134 | + $typeObject = $typesObject[$key]; |
|
135 | + echo "<tr class='even' align='left'>"; |
|
136 | + echo "<td><input type='text' name='type_order[{$key}]' value='" . $order . "' size='10' /></td>"; |
|
137 | + echo "<td><em style='color:" . $typeObject->getVar('type_color') . ";'>" . $typeObject->getVar('type_name') . '</em></td>'; |
|
138 | + echo '<td>' . $typeObject->getVar('type_description') . '</td>'; |
|
139 | + echo '</tr>'; |
|
140 | + unset($typesObject[$key]); |
|
141 | + } |
|
142 | + echo "<tr><td colspan='3' height='5px'></td></tr>"; |
|
143 | + } |
|
144 | + foreach ($typesObject as $key => $typeObject) { |
|
145 | + echo "<tr class='odd' align='left'>"; |
|
146 | + echo "<td><input type='text' name='type_order[{$key}]' value='0' size='10' /></td>"; |
|
147 | + echo "<td><em style='color:" . $typeObject->getVar('type_color') . ";'>" . $typeObject->getVar('type_name') . '</em></td>'; |
|
148 | + echo '<td>' . $typeObject->getVar('type_description') . '</td>'; |
|
149 | + echo '</tr>'; |
|
150 | + } |
|
151 | + |
|
152 | + echo "<tr><td colspan='3' style='text-align:center;'>"; |
|
153 | + echo "<input type='hidden' name='op' value='save_template' />"; |
|
154 | + echo "<input type='submit' name='submit' value='" . _SUBMIT . "' /> "; |
|
155 | + echo "<input type='reset' value='" . _CANCEL . "' />"; |
|
156 | + echo '</td></tr></table>'; |
|
157 | + echo '</form>'; |
|
158 | + echo '</td></tr></table>'; |
|
159 | + break; |
|
160 | + |
|
161 | + case 'save_template': |
|
162 | + $templates = array_flip(array_filter(Request::getArray('type_order', [], 'POST'))); |
|
163 | + $cacheHelper->write('type_template', $templates); |
|
164 | + redirect_header(xoops_getenv('PHP_SELF') . '?op=template', 2, _MD_NEWBB_DBUPDATED); |
|
165 | + break; |
|
166 | + |
|
167 | + case 'apply': |
|
168 | + if (!$templates = $cacheHelper->read('type_template')) { |
|
169 | + redirect_header(xoops_getenv('PHP_SELF') . '?op=template', 2, _AM_NEWBB_TYPE_TEMPLATE_ERR); |
|
170 | + } |
|
171 | + |
|
172 | + // $categoryHandler = Newbb\Helper::getInstance()->getHandler('Category'); |
|
173 | + $criteriaCategory = new \CriteriaCompo(new \Criteria('1', 1)); |
|
174 | + $criteriaCategory->setSort('cat_order'); |
|
175 | + $categories = $categoryHandler->getList($criteriaCategory); |
|
176 | + // $forumHandler = Newbb\Helper::getInstance()->getHandler('Forum'); |
|
177 | + $forums = $forumHandler->getTree(array_keys($categories), 0, 'all'); |
|
178 | + foreach (array_keys($forums) as $c) { |
|
179 | + $fm_options[-1 * $c] = '[' . $categories[$c] . ']'; |
|
180 | + foreach (array_keys($forums[$c]) as $f) { |
|
181 | + $fm_options[$f] = $forums[$c][$f]['prefix'] . $forums[$c][$f]['forum_name']; |
|
182 | + } |
|
183 | + } |
|
184 | + unset($forums, $categories); |
|
185 | + $fmform = new \XoopsThemeForm(_AM_NEWBB_TYPE_TEMPLATE_APPLY, 'fmform', xoops_getenv('PHP_SELF'), 'post', true); |
|
186 | + $fm_select = new \XoopsFormSelect(_AM_NEWBB_PERM_FORUMS, 'forums', null, 10, true); |
|
187 | + $fm_select->addOptionArray($fm_options); |
|
188 | + $fmform->addElement($fm_select); |
|
189 | + $tray = new \XoopsFormElementTray(''); |
|
190 | + $tray->addElement(new \XoopsFormHidden('op', 'save_apply')); |
|
191 | + $tray->addElement(new \XoopsFormButton('', 'submit', _SUBMIT, 'submit')); |
|
192 | + $tray->addElement(new \XoopsFormButton('', 'reset', _CANCEL, 'reset')); |
|
193 | + $fmform->addElement($tray); |
|
194 | + |
|
195 | + //loadModuleAdminMenu(11, _AM_NEWBB_TYPE_TEMPLATE_APPLY); |
|
196 | + $adminObject->addItemButton(_AM_NEWBB_TYPE_ADD, 'admin_type_manager.php?op=add', $icon = 'add'); |
|
197 | + $adminObject->addItemButton(_AM_NEWBB_TYPE_TEMPLATE, 'admin_type_manager.php?op=template', $icon = 'add'); |
|
198 | + $adminObject->addItemButton(_AM_NEWBB_TYPE_TEMPLATE_APPLY, 'admin_type_manager.php?op=apply', $icon = 'add'); |
|
199 | + $adminObject->addItemButton(_AM_NEWBB_TYPE_FORUM, 'admin_type_manager.php?op=forum', $icon = 'add'); |
|
200 | + $adminObject->displayButton('left'); |
|
201 | + |
|
202 | + echo "<table width='100%' border='0' cellspacing='1' class='outer'>" . "<tr><td class='odd'>"; |
|
203 | + echo "<table border='0' cellpadding='4' cellspacing='1' width='100%' class='outer'>"; |
|
204 | + echo "<tr align='center'>"; |
|
205 | + echo "<th class='bg3' width='20%'>" . _AM_NEWBB_TYPE_NAME . '</th>'; |
|
206 | + echo "<th class='bg3' width='20%'>" . _AM_NEWBB_TYPE_ORDER . '</th>'; |
|
207 | + echo "<th class='bg3'>" . _AM_NEWBB_TYPE_DESCRIPTION . '</th>'; |
|
208 | + echo '</tr>'; |
|
209 | + |
|
210 | + $typesObject = $typeHandler->getAll(new \Criteria('type_id', '(' . implode(', ', array_values($templates)) . ')', 'IN')); |
|
211 | + arsort($templates); |
|
212 | + foreach ($templates as $order => $key) { |
|
213 | + if (!isset($typesObject[$key])) { |
|
214 | + continue; |
|
215 | + } |
|
216 | + $typeObject = $typesObject[$key]; |
|
217 | + echo "<tr class='even' align='left'>"; |
|
218 | + echo "<td><em style='color:" . $typeObject->getVar('type_color') . ";'>" . $typeObject->getVar('type_name') . '</em></td>'; |
|
219 | + echo '<td>' . $order . '</td>'; |
|
220 | + echo '<td>' . $typeObject->getVar('type_description') . '</td>'; |
|
221 | + echo '</tr>'; |
|
222 | + unset($typesObject[$key]); |
|
223 | + } |
|
224 | + echo '</table>'; |
|
225 | + echo '</td></tr></table>'; |
|
226 | + echo '<br>'; |
|
227 | + $fmform->display(); |
|
228 | + break; |
|
229 | + |
|
230 | + case 'save_apply': |
|
231 | + if (!$templates = $cacheHelper->read('type_template')) { |
|
232 | + redirect_header(xoops_getenv('PHP_SELF') . '?op=template', 2, _AM_NEWBB_TYPE_TEMPLATE); |
|
233 | + } |
|
234 | + foreach (Request::getArray('forums', [], 'POST') as $forum) { |
|
235 | + if ($forum < 1) { |
|
236 | + continue; |
|
237 | + } |
|
238 | + $typeHandler->updateByForum($forum, array_flip($templates)); |
|
239 | + } |
|
240 | + redirect_header(xoops_getenv('PHP_SELF'), 2, _MD_NEWBB_DBUPDATED); |
|
241 | + break; |
|
242 | + |
|
243 | + case 'forum': |
|
244 | + // $categoryHandler = Newbb\Helper::getInstance()->getHandler('Category'); |
|
245 | + $criteriaCategory = new \CriteriaCompo(new \Criteria('1', 1)); |
|
246 | + $criteriaCategory->setSort('cat_order'); |
|
247 | + $categories = $categoryHandler->getList($criteriaCategory); |
|
248 | + if (empty($categories)) { |
|
249 | + redirect_header('admin_cat_manager.php', 2, _AM_NEWBB_CREATENEWCATEGORY); |
|
250 | + } |
|
251 | + // $forumHandler = Newbb\Helper::getInstance()->getHandler('Forum'); |
|
252 | + $forums = $forumHandler->getTree(array_keys($categories)); |
|
253 | + if (empty($forums)) { |
|
254 | + redirect_header('admin_forum_manager.php', 2, _AM_NEWBB_CREATENEWFORUM); |
|
255 | + } |
|
256 | + |
|
257 | + foreach (array_keys($forums) as $c) { |
|
258 | + $fm_options[-1 * $c] = '[' . $categories[$c] . ']'; |
|
259 | + foreach (array_keys($forums[$c]) as $f) { |
|
260 | + $fm_options[$f] = $forums[$c][$f]['prefix'] . $forums[$c][$f]['forum_name']; |
|
261 | + } |
|
262 | + } |
|
263 | + unset($forums, $categories); |
|
264 | + $fmform = new \XoopsThemeForm(_AM_NEWBB_TYPE_FORUM, 'fmform', xoops_getenv('PHP_SELF'), 'post', true); |
|
265 | + $fm_select = new \XoopsFormSelect(_AM_NEWBB_PERM_FORUMS, 'forum', null, 5, false); |
|
266 | + $fm_select->addOptionArray($fm_options); |
|
267 | + $fmform->addElement($fm_select); |
|
268 | + $tray = new \XoopsFormElementTray(''); |
|
269 | + $tray->addElement(new \XoopsFormHidden('op', 'edit_forum')); |
|
270 | + $tray->addElement(new \XoopsFormButton('', 'submit', _SUBMIT, 'submit')); |
|
271 | + $tray->addElement(new \XoopsFormButton('', 'reset', _CANCEL, 'reset')); |
|
272 | + $fmform->addElement($tray); |
|
273 | + |
|
274 | + //loadModuleAdminMenu(11, _AM_NEWBB_TYPE_FORUM); |
|
275 | + $adminObject->addItemButton(_AM_NEWBB_TYPE_ADD, 'admin_type_manager.php?op=add', $icon = 'add'); |
|
276 | + $adminObject->addItemButton(_AM_NEWBB_TYPE_TEMPLATE, 'admin_type_manager.php?op=template', $icon = 'add'); |
|
277 | + $adminObject->addItemButton(_AM_NEWBB_TYPE_FORUM, 'admin_type_manager.php?op=forum', $icon = 'add'); |
|
278 | + $adminObject->displayButton('left'); |
|
279 | + |
|
280 | + $fmform->display(); |
|
281 | + break; |
|
282 | + |
|
283 | + case 'edit_forum': |
|
284 | + if (!Request::getInt('forum', 0, 'POST') || Request::getInt('forum', 0, 'POST') < 1) { |
|
285 | + redirect_header(xoops_getenv('PHP_SELF') . '?op=forum', 2, _AM_NEWBB_TYPE_FORUM_ERR); |
|
286 | + } |
|
287 | + |
|
288 | + // $forumHandler = Newbb\Helper::getInstance()->getHandler('Forum'); |
|
289 | + if (!$forumObject = $forumHandler->get(Request::getInt('forum', 0, 'POST'))) { |
|
290 | + redirect_header(xoops_getenv('PHP_SELF') . '?op=forum', 2, _AM_NEWBB_TYPE_FORUM_ERR); |
|
291 | + } |
|
292 | + |
|
293 | + $typesObject = $typeHandler->getAll(); |
|
294 | + if (0 === count($typesObject)) { |
|
295 | + redirect_header(xoops_getenv('PHP_SELF'), 2, _AM_NEWBB_TYPE_ADD_ERR); |
|
296 | + } |
|
297 | + |
|
298 | + $adminObject->addItemButton(_AM_NEWBB_TYPE_ADD, 'admin_type_manager.php?op=add', $icon = 'add'); |
|
299 | + $adminObject->addItemButton(_AM_NEWBB_TYPE_TEMPLATE, 'admin_type_manager.php?op=template', $icon = 'add'); |
|
300 | + $adminObject->addItemButton(_AM_NEWBB_TYPE_FORUM, 'admin_type_manager.php?op=forum', $icon = 'add'); |
|
301 | + $adminObject->displayButton('left'); |
|
302 | + echo '<legend style="font-weight: bold; color: #900;">' . _AM_NEWBB_TYPE_ORDER_DESC . '</legend>'; |
|
303 | + echo "<table width='100%' border='0' cellspacing='1' class='outer'>" . "<tr><td class='odd'>"; |
|
304 | + echo "<form name='template' method='post' action='" . xoops_getenv('PHP_SELF') . "'>"; |
|
305 | + echo "<table border='0' cellpadding='4' cellspacing='1' width='100%' class='outer'>"; |
|
306 | + echo "<tr align='center'>"; |
|
307 | + echo "<th class='bg3' width='20%'>" . _AM_NEWBB_TYPE_ORDER . '</th>'; |
|
308 | + echo "<th class='bg3' width='20%'>" . _AM_NEWBB_TYPE_NAME . '</th>'; |
|
309 | + echo "<th class='bg3'>" . _AM_NEWBB_TYPE_DESCRIPTION . '</th>'; |
|
310 | + echo '</tr>'; |
|
311 | + |
|
312 | + $types = $typeHandler->getByForum(Request::getInt('forum', 0, 'POST')); |
|
313 | + $types_order = []; |
|
314 | + foreach ($types as $key => $type) { |
|
315 | + $types_order[] = $type['type_order']; |
|
316 | + } |
|
317 | + array_multisort($types_order, $types); |
|
318 | + foreach ($types as $key => $type) { |
|
319 | + if (!isset($typesObject[$type['type_id']])) { |
|
320 | + continue; |
|
321 | + } |
|
322 | + $typeObject = $typesObject[$type['type_id']]; |
|
323 | + echo "<tr class='even' align='left'>"; |
|
324 | + echo "<td><input type='text' name='type_order[" . $type['type_id'] . "]' value='" . $type['type_order'] . "' size='10' /></td>"; |
|
325 | + echo "<td><em style='color:" . $typeObject->getVar('type_color') . ";'>" . $typeObject->getVar('type_name') . '</em></td>'; |
|
326 | + echo '<td>' . $typeObject->getVar('type_description') . '</td>'; |
|
327 | + echo '</tr>'; |
|
328 | + unset($typesObject[$type['type_id']]); |
|
329 | + } |
|
330 | + echo "<tr><td colspan='3' height='5px'></td></tr>"; |
|
331 | + foreach ($typesObject as $key => $typeObject) { |
|
332 | + echo "<tr class='odd' align='left'>"; |
|
333 | + echo "<td><input type='text' name='type_order[{$key}]' value='0' size='10' /></td>"; |
|
334 | + echo "<td><em style='color:" . $typeObject->getVar('type_color') . ";'>" . $typeObject->getVar('type_name') . '</em></td>'; |
|
335 | + echo '<td>' . $typeObject->getVar('type_description') . '</td>'; |
|
336 | + echo '</tr>'; |
|
337 | + } |
|
338 | + |
|
339 | + echo "<tr><td colspan='3' style='text-align:center;'>"; |
|
340 | + echo '<legend style="font-weight: bold; color: #900;">' . _AM_NEWBB_TYPE_EDITFORUM_DESC . '</legend>'; |
|
341 | + echo "<input type='hidden' name='forum' value='" . Request::getInt('forum', 0, 'POST') . "' />"; |
|
342 | + echo "<input type='hidden' name='op' value='save_forum' />"; |
|
343 | + echo "<input type='submit' name='submit' value='" . _SUBMIT . "' /> "; |
|
344 | + echo "<input type='reset' value='" . _CANCEL . "' />"; |
|
345 | + echo '</td></tr></table>'; |
|
346 | + echo '</form>'; |
|
347 | + echo '</td></tr></table>'; |
|
348 | + break; |
|
349 | + |
|
350 | + case 'save_forum': |
|
351 | + if (!Request::getInt('forum', 0, 'POST') || Request::getInt('forum', 0, 'POST') < 1) { |
|
352 | + redirect_header(xoops_getenv('PHP_SELF') . '?op=forum', 2, _AM_NEWBB_TYPE_FORUM); |
|
353 | + } |
|
354 | + $typeHandler->updateByForum(Request::getInt('forum', 0, 'POST'), Request::getArray('type_order', null, 'POST')); |
|
355 | + redirect_header(xoops_getenv('PHP_SELF') . '?op=forum', 2, _MD_NEWBB_DBUPDATED); |
|
356 | + break; |
|
357 | + |
|
358 | + case 'add': |
|
359 | + default: |
|
360 | + $typesObject = $typeHandler->getAll(); |
|
361 | + if (0 === count($typesObject)) { |
|
362 | + $op = 'add'; |
|
363 | + $title = _AM_NEWBB_TYPE_ADD; |
|
364 | + } else { |
|
365 | + $title = _AM_NEWBB_TYPE_LIST; |
|
366 | + } |
|
367 | + |
|
368 | + if ('add' !== $op) { |
|
369 | + $adminObject->addItemButton(_AM_NEWBB_TYPE_ADD, 'admin_type_manager.php?op=add', $icon = 'add'); |
|
370 | + $adminObject->addItemButton(_AM_NEWBB_TYPE_TEMPLATE, 'admin_type_manager.php?op=template', $icon = 'add'); |
|
371 | + $adminObject->addItemButton(_AM_NEWBB_TYPE_FORUM, 'admin_type_manager.php?op=forum', $icon = 'add'); |
|
372 | + $adminObject->displayButton('left'); |
|
373 | + } |
|
374 | + echo _AM_NEWBB_TYPE_HELP; |
|
375 | + echo "<table width='100%' border='0' cellspacing='1' class='outer'>" . "<tr><td class='odd'>"; |
|
376 | + echo "<form name='list' method='post' action='" . xoops_getenv('PHP_SELF') . "'>"; |
|
377 | + echo "<table border='0' cellpadding='4' cellspacing='1' width='100%' class='outer'>"; |
|
378 | + echo "<tr align='center'>"; |
|
379 | + if ('add' !== $op) { |
|
380 | + echo "<th class='bg3' width='5%'>" . _DELETE . '</th>'; |
|
381 | + } |
|
382 | + echo "<th align='left' class='bg3' width='20%'>" . _AM_NEWBB_TYPE_NAME . '</th>'; |
|
383 | + echo "<th class='bg3' width='15%'>" . _AM_NEWBB_TYPE_COLOR . '</th>'; |
|
384 | + echo "<th align='left' class='bg3'>" . _AM_NEWBB_TYPE_DESCRIPTION . '</th>'; |
|
385 | + echo '</tr>'; |
|
386 | + |
|
387 | + $isColorpicker = require_once $GLOBALS['xoops']->path('class/xoopsform/formcolorpicker.php'); |
|
388 | + |
|
389 | + if ('add' !== $op) { |
|
390 | + foreach ($typesObject as $key => $typeObject) { |
|
391 | + echo "<tr class='odd' align='left'>"; |
|
392 | + echo "<td><input type='checkbox' name='type_del[{$key}]' /></td>"; |
|
393 | + echo "<td><input type='text' name='type_name[{$key}]' value='" . $typeObject->getVar('type_name') . "' size='10' /></td>"; |
|
394 | + if ($isColorpicker) { |
|
395 | + $form_colorpicker = new \XoopsFormColorPicker('', "type_color[{$key}]", $typeObject->getVar('type_color')); |
|
396 | + echo '<td>' . $form_colorpicker->render() . '</td>'; |
|
397 | + } else { |
|
398 | + echo "<td><input type='text' name='type_color[{$key}]' value='" . $typeObject->getVar('type_color') . "' size='10' /></td>"; |
|
399 | + } |
|
400 | + echo "<td><input type='text' name='type_description[{$key}]' value='" . $typeObject->getVar('type_description') . "' size='30' /></td>"; |
|
401 | + echo '</tr>'; |
|
402 | + } |
|
403 | + echo "<tr><td colspan='4' style='text-align:center;'>"; |
|
404 | + } else { |
|
405 | + $adminObject->addItemButton(_AM_NEWBB_TYPE_TEMPLATE, 'admin_type_manager.php?op=template', $icon = 'add'); |
|
406 | + $adminObject->addItemButton(_AM_NEWBB_TYPE_FORUM, 'admin_type_manager.php?op=forum', $icon = 'add'); |
|
407 | + $adminObject->displayButton('left'); |
|
408 | + for ($i = 0; $i < 10; ++$i) { |
|
409 | + echo "<tr class='odd' align='left'>"; |
|
410 | + echo "<td><input type='text' name='type_name[{$i}]' value='' size='10' /></td>"; |
|
411 | + if ($isColorpicker) { |
|
412 | + $form_colorpicker = new \XoopsFormColorPicker('', "type_color[{$i}]", ''); |
|
413 | + echo '<td>' . $form_colorpicker->render() . '</td>'; |
|
414 | + } else { |
|
415 | + echo "<td><input type='text' name='type_color[{$i}]' value='' size='10' /></td>"; |
|
416 | + } |
|
417 | + echo "<td><input type='text' name='type_description[{$i}]' value='' size='40' /></td>"; |
|
418 | + echo '</tr>'; |
|
419 | + } |
|
420 | + echo "<tr><td colspan='3' style='text-align:center;'>"; |
|
421 | + echo "<input type='hidden' name='isnew' value='1' />"; |
|
422 | + } |
|
423 | + echo "<input type='hidden' name='op' value='save_type' />"; |
|
424 | + echo "<input type='submit' name='submit' value='" . _SUBMIT . "' /> "; |
|
425 | + echo "<input type='reset' value='" . _CANCEL . "' />"; |
|
426 | + echo '</td></tr></table>'; |
|
427 | + echo '</form>'; |
|
428 | + echo '</td></tr></table>'; |
|
429 | + echo '<fieldset>'; |
|
430 | + echo '<legend> ' . _MI_NEWBB_ADMENU_TYPE . ' </legend>'; |
|
431 | + echo _AM_NEWBB_HELP_TYPE_TAB; |
|
432 | + echo '</fieldset>'; |
|
433 | + break; |
|
434 | 434 | } |
435 | 435 | |
436 | 436 | require_once __DIR__ . '/admin_footer.php'; |