@@ -31,7 +31,7 @@ discard block |
||
31 | 31 | $blog_id = Request::getInt('blog', Request::getInt('blog', 0, 'POST'), 'GET'); //(int)(isset($_GET['blog']) ? $_GET['blog'] : (isset($_POST['blog']) ? $_POST['blog'] : 0)); |
32 | 32 | |
33 | 33 | if (!is_object($xoopsUser) || empty($blog_id)) { |
34 | - redirect_header('javascript:history.go(-1);', 1, planet_constant('MD_INVALID')); |
|
34 | + redirect_header('javascript:history.go(-1);', 1, planet_constant('MD_INVALID')); |
|
35 | 35 | } |
36 | 36 | |
37 | 37 | $bookmarkHandler = xoops_getModuleHandler('bookmark', $GLOBALS['moddirname']); |
@@ -39,14 +39,14 @@ discard block |
||
39 | 39 | $criteria = new CriteriaCompo(new Criteria('blog_id', $blog_id)); |
40 | 40 | $criteria->add(new Criteria('bm_uid', $uid)); |
41 | 41 | if ($count = $bookmarkHandler->getCount($criteria)) { |
42 | - $message = planet_constant('MD_ALREADYBOOKMARKED'); |
|
43 | - redirect_header(XOOPS_URL . '/modules/' . $GLOBALS['moddirname'] . '/index.php' . URL_DELIMITER . 'u' . $uid, 2, $message); |
|
42 | + $message = planet_constant('MD_ALREADYBOOKMARKED'); |
|
43 | + redirect_header(XOOPS_URL . '/modules/' . $GLOBALS['moddirname'] . '/index.php' . URL_DELIMITER . 'u' . $uid, 2, $message); |
|
44 | 44 | } |
45 | 45 | $bookmark_obj = $bookmarkHandler->create(); |
46 | 46 | $bookmark_obj->setVar('blog_id', $blog_id); |
47 | 47 | $bookmark_obj->setVar('bm_uid', $uid); |
48 | 48 | if (!$bookmark_id = $bookmarkHandler->insert($bookmark_obj, true)) { |
49 | - redirect_header(XOOPS_URL . '/modules/' . $GLOBALS['moddirname'] . '/index.php' . URL_DELIMITER . 'b' . $blog_id, 2, planet_constant('MD_NOTSAVED')); |
|
49 | + redirect_header(XOOPS_URL . '/modules/' . $GLOBALS['moddirname'] . '/index.php' . URL_DELIMITER . 'b' . $blog_id, 2, planet_constant('MD_NOTSAVED')); |
|
50 | 50 | } |
51 | 51 | $blogHandler = xoops_getModuleHandler('blog', $GLOBALS['moddirname']); |
52 | 52 | $blog_obj = $blogHandler->get($blog_id); |
@@ -26,7 +26,7 @@ discard block |
||
26 | 26 | // ------------------------------------------------------------------------ // |
27 | 27 | use Xmf\Request; |
28 | 28 | |
29 | -include __DIR__ . '/header.php'; |
|
29 | +include __DIR__.'/header.php'; |
|
30 | 30 | |
31 | 31 | $blog_id = Request::getInt('blog', Request::getInt('blog', 0, 'POST'), 'GET'); //(int)(isset($_GET['blog']) ? $_GET['blog'] : (isset($_POST['blog']) ? $_POST['blog'] : 0)); |
32 | 32 | |
@@ -40,19 +40,19 @@ discard block |
||
40 | 40 | $criteria->add(new Criteria('bm_uid', $uid)); |
41 | 41 | if ($count = $bookmarkHandler->getCount($criteria)) { |
42 | 42 | $message = planet_constant('MD_ALREADYBOOKMARKED'); |
43 | - redirect_header(XOOPS_URL . '/modules/' . $GLOBALS['moddirname'] . '/index.php' . URL_DELIMITER . 'u' . $uid, 2, $message); |
|
43 | + redirect_header(XOOPS_URL.'/modules/'.$GLOBALS['moddirname'].'/index.php'.URL_DELIMITER.'u'.$uid, 2, $message); |
|
44 | 44 | } |
45 | 45 | $bookmark_obj = $bookmarkHandler->create(); |
46 | 46 | $bookmark_obj->setVar('blog_id', $blog_id); |
47 | 47 | $bookmark_obj->setVar('bm_uid', $uid); |
48 | 48 | if (!$bookmark_id = $bookmarkHandler->insert($bookmark_obj, true)) { |
49 | - redirect_header(XOOPS_URL . '/modules/' . $GLOBALS['moddirname'] . '/index.php' . URL_DELIMITER . 'b' . $blog_id, 2, planet_constant('MD_NOTSAVED')); |
|
49 | + redirect_header(XOOPS_URL.'/modules/'.$GLOBALS['moddirname'].'/index.php'.URL_DELIMITER.'b'.$blog_id, 2, planet_constant('MD_NOTSAVED')); |
|
50 | 50 | } |
51 | 51 | $blogHandler = xoops_getModuleHandler('blog', $GLOBALS['moddirname']); |
52 | 52 | $blog_obj = $blogHandler->get($blog_id); |
53 | -$marks = $blog_obj->getVar('blog_marks') + 1; |
|
54 | -$blog_obj->setVar('blog_marks', $blog_obj->getVar('blog_marks') + 1); |
|
53 | +$marks = $blog_obj->getVar('blog_marks')+1; |
|
54 | +$blog_obj->setVar('blog_marks', $blog_obj->getVar('blog_marks')+1); |
|
55 | 55 | $blogHandler->insert($blog_obj, true); |
56 | 56 | $message = planet_constant('MD_ACTIONDONE'); |
57 | -redirect_header(XOOPS_URL . '/modules/' . $GLOBALS['moddirname'] . '/index.php' . URL_DELIMITER . 'b' . $blog_id, 2, $message); |
|
58 | -include __DIR__ . '/footer.php'; |
|
57 | +redirect_header(XOOPS_URL.'/modules/'.$GLOBALS['moddirname'].'/index.php'.URL_DELIMITER.'b'.$blog_id, 2, $message); |
|
58 | +include __DIR__.'/footer.php'; |
@@ -32,7 +32,7 @@ discard block |
||
32 | 32 | $configHandler = xoops_getHandler('config'); |
33 | 33 | $xoopsConfigSearch = $configHandler->getConfigsByCat(XOOPS_CONF_SEARCH); |
34 | 34 | if (empty($xoopsConfigSearch['enable_search'])) { |
35 | - redirect_header(XOOPS_URL . '/modules/' . $GLOBALS['moddirname'] . '/index.php', 2, planet_constant('MD_NOACCESS')); |
|
35 | + redirect_header(XOOPS_URL . '/modules/' . $GLOBALS['moddirname'] . '/index.php', 2, planet_constant('MD_NOACCESS')); |
|
36 | 36 | } |
37 | 37 | |
38 | 38 | $xoopsConfig['module_cache'][$xoopsModule->getVar('mid')] = 0; |
@@ -50,90 +50,90 @@ discard block |
||
50 | 50 | $blog = Request::getInt('blog', Request::getInt('blog', 0, 'GET'), 'POST');//(int)(isset($_POST['blog']) ? $_POST['blog'] : (isset($_GET['blog']) ? $_GET['blog'] : null)); |
51 | 51 | $uid = Request::getInt('uid', Request::getInt('uid', 0, 'GET'), 'POST');//(int)(isset($_POST['uid']) ? $_POST['uid'] : (isset($_GET['uid']) ? $_GET['uid'] : null)); |
52 | 52 | $searchin = Request::getArray('searchin', 0 !== count(Request::getArray('searchin', array(), 'GET')) ? explode('|', Request::getArray('searchin', array(), 'GET')) : array(), |
53 | - 'POST'); //isset($_POST['searchin']) ? $_POST['searchin'] : (isset($_GET['searchin']) ? explode('|', $_GET['searchin']) : array()); |
|
53 | + 'POST'); //isset($_POST['searchin']) ? $_POST['searchin'] : (isset($_GET['searchin']) ? explode('|', $_GET['searchin']) : array()); |
|
54 | 54 | $sortby = Request::getString('sortby', Request::getString('sortby', null, 'GET'), 'POST');//isset($_POST['sortby']) ? $_POST['sortby'] : (isset($_GET['sortby']) ? $_GET['sortby'] : null); |
55 | 55 | $term = Request::getString('term', Request::getString('term', '', 'GET'), 'POST');//isset($_POST['term']) ? $_POST['term'] : (isset($_GET['term']) ? $_GET['term'] : ''); |
56 | 56 | |
57 | 57 | $andor = in_array(strtoupper($andor), array('OR', 'AND', 'EXACT')) ? strtoupper($andor) : 'OR'; |
58 | 58 | $sortby = in_array(strtolower($sortby), array( |
59 | - 'a.art_id desc', |
|
60 | - 'a.art_time desc', |
|
61 | - 'a.art_title', |
|
62 | - 'a.blog_id', |
|
63 | - 'b.blog_id', |
|
64 | - 'b.blog_feed', |
|
65 | - 'b.blog_title', |
|
66 | - 'b.blog_time' |
|
59 | + 'a.art_id desc', |
|
60 | + 'a.art_time desc', |
|
61 | + 'a.art_title', |
|
62 | + 'a.blog_id', |
|
63 | + 'b.blog_id', |
|
64 | + 'b.blog_feed', |
|
65 | + 'b.blog_title', |
|
66 | + 'b.blog_time' |
|
67 | 67 | )) ? strtolower($sortby) : ''; |
68 | 68 | |
69 | 69 | if (!(empty(Request::getString('submit', '', 'POST')) && empty(Request::getString('term', '', 'GET')))) { |
70 | - $next_search['category'] = $category; |
|
71 | - $next_search['blog'] = $blog; |
|
72 | - $next_search['uid'] = $uid; |
|
73 | - $next_search['andor'] = $andor; |
|
70 | + $next_search['category'] = $category; |
|
71 | + $next_search['blog'] = $blog; |
|
72 | + $next_search['uid'] = $uid; |
|
73 | + $next_search['andor'] = $andor; |
|
74 | 74 | |
75 | - $next_search['term'] = $term; |
|
76 | - $query = trim($term); |
|
75 | + $next_search['term'] = $term; |
|
76 | + $query = trim($term); |
|
77 | 77 | |
78 | - if ($andor !== 'EXACT') { |
|
79 | - $ignored_queries = array(); // holds kewords that are shorter than allowed minmum length |
|
80 | - $temp_queries = preg_split("/[\s,]+/", $query); |
|
81 | - foreach ($temp_queries as $q) { |
|
82 | - $q = trim($q); |
|
83 | - if (strlen($q) >= $xoopsConfigSearch['keyword_min']) { |
|
84 | - $queries[] = $myts->addSlashes($q); |
|
85 | - } else { |
|
86 | - $ignored_queries[] = $myts->addSlashes($q); |
|
87 | - } |
|
88 | - } |
|
89 | - if (count($queries) == 0) { |
|
90 | - redirect_header(XOOPS_URL . '/modules/' . $GLOBALS['moddirname'] . '/search.php', 2, sprintf(_SR_KEYTOOSHORT, $xoopsConfigSearch['keyword_min'])); |
|
91 | - } |
|
92 | - } else { |
|
93 | - if (strlen($query) < $xoopsConfigSearch['keyword_min']) { |
|
94 | - redirect_header(XOOPS_URL . '/modules/' . $GLOBALS['moddirname'] . '/search.php', 2, sprintf(_SR_KEYTOOSHORT, $xoopsConfigSearch['keyword_min'])); |
|
95 | - } |
|
96 | - $queries = array($myts->addSlashes($query)); |
|
97 | - } |
|
78 | + if ($andor !== 'EXACT') { |
|
79 | + $ignored_queries = array(); // holds kewords that are shorter than allowed minmum length |
|
80 | + $temp_queries = preg_split("/[\s,]+/", $query); |
|
81 | + foreach ($temp_queries as $q) { |
|
82 | + $q = trim($q); |
|
83 | + if (strlen($q) >= $xoopsConfigSearch['keyword_min']) { |
|
84 | + $queries[] = $myts->addSlashes($q); |
|
85 | + } else { |
|
86 | + $ignored_queries[] = $myts->addSlashes($q); |
|
87 | + } |
|
88 | + } |
|
89 | + if (count($queries) == 0) { |
|
90 | + redirect_header(XOOPS_URL . '/modules/' . $GLOBALS['moddirname'] . '/search.php', 2, sprintf(_SR_KEYTOOSHORT, $xoopsConfigSearch['keyword_min'])); |
|
91 | + } |
|
92 | + } else { |
|
93 | + if (strlen($query) < $xoopsConfigSearch['keyword_min']) { |
|
94 | + redirect_header(XOOPS_URL . '/modules/' . $GLOBALS['moddirname'] . '/search.php', 2, sprintf(_SR_KEYTOOSHORT, $xoopsConfigSearch['keyword_min'])); |
|
95 | + } |
|
96 | + $queries = array($myts->addSlashes($query)); |
|
97 | + } |
|
98 | 98 | |
99 | - $next_search['sortby'] = $sortby; |
|
100 | - $next_search['searchin'] = implode('|', $searchin); |
|
99 | + $next_search['sortby'] = $sortby; |
|
100 | + $next_search['searchin'] = implode('|', $searchin); |
|
101 | 101 | |
102 | - /* To be added: year-month |
|
102 | + /* To be added: year-month |
|
103 | 103 | * see view.archive.php |
104 | 104 | */ |
105 | - if (!empty($time)) { |
|
106 | - $extra = ''; |
|
107 | - } else { |
|
108 | - $extra = ''; |
|
109 | - } |
|
105 | + if (!empty($time)) { |
|
106 | + $extra = ''; |
|
107 | + } else { |
|
108 | + $extra = ''; |
|
109 | + } |
|
110 | 110 | |
111 | - $results = planet_search($queries, $andor, $limit, $start, $uid, $category, $blog, $sortby, $searchin, $extra); |
|
111 | + $results = planet_search($queries, $andor, $limit, $start, $uid, $category, $blog, $sortby, $searchin, $extra); |
|
112 | 112 | |
113 | - /* |
|
113 | + /* |
|
114 | 114 | if ( count($results) < 1 ) { |
115 | 115 | redirect_header("javascript:history.go(-1);", 2, _SR_NOMATCH); |
116 | 116 | } else |
117 | 117 | */ |
118 | - { |
|
119 | - $xoopsTpl->assign('results', $results); |
|
118 | + { |
|
119 | + $xoopsTpl->assign('results', $results); |
|
120 | 120 | |
121 | - if (count($next_search) > 0) { |
|
122 | - $items = array(); |
|
123 | - foreach ($next_search as $para => $val) { |
|
124 | - if (!empty($val)) { |
|
125 | - $items[] = "$para=$val"; |
|
126 | - } |
|
127 | - } |
|
128 | - if (count($items) > 0) { |
|
129 | - $paras = implode('&', $items); |
|
130 | - } |
|
131 | - unset($next_search); |
|
132 | - unset($items); |
|
133 | - } |
|
134 | - $search_url = XOOPS_URL . '/modules/' . $GLOBALS['moddirname'] . '/search.php?' . $paras; |
|
121 | + if (count($next_search) > 0) { |
|
122 | + $items = array(); |
|
123 | + foreach ($next_search as $para => $val) { |
|
124 | + if (!empty($val)) { |
|
125 | + $items[] = "$para=$val"; |
|
126 | + } |
|
127 | + } |
|
128 | + if (count($items) > 0) { |
|
129 | + $paras = implode('&', $items); |
|
130 | + } |
|
131 | + unset($next_search); |
|
132 | + unset($items); |
|
133 | + } |
|
134 | + $search_url = XOOPS_URL . '/modules/' . $GLOBALS['moddirname'] . '/search.php?' . $paras; |
|
135 | 135 | |
136 | - /* |
|
136 | + /* |
|
137 | 137 | $next_results =& planet_search($queries, $andor, 1, $start + $limit, $uid, $category, $sortby, $searchin, $extra); |
138 | 138 | $next_count = count($next_results); |
139 | 139 | $has_next = false; |
@@ -142,41 +142,41 @@ discard block |
||
142 | 142 | } |
143 | 143 | if (false != $has_next) |
144 | 144 | */ |
145 | - if (count($results)) { |
|
146 | - $next = $start + $limit; |
|
147 | - $queries = implode(',', $queries); |
|
148 | - $search_url_next = $search_url . "&start=$next"; |
|
149 | - $search_next = "<a href=\"" . htmlspecialchars($search_url_next) . "\">" . _SR_NEXT . '</a>'; |
|
150 | - $xoopsTpl->assign('search_next', $search_next); |
|
151 | - } |
|
152 | - if ($start > 0) { |
|
153 | - $prev = $start - $limit; |
|
154 | - $search_url_prev = $search_url . "&start=$prev"; |
|
155 | - $search_prev = "<a href=\"" . htmlspecialchars($search_url_prev) . "\">" . _SR_PREVIOUS . '</a>'; |
|
156 | - $xoopsTpl->assign('search_prev', $search_prev); |
|
157 | - } |
|
158 | - } |
|
145 | + if (count($results)) { |
|
146 | + $next = $start + $limit; |
|
147 | + $queries = implode(',', $queries); |
|
148 | + $search_url_next = $search_url . "&start=$next"; |
|
149 | + $search_next = "<a href=\"" . htmlspecialchars($search_url_next) . "\">" . _SR_NEXT . '</a>'; |
|
150 | + $xoopsTpl->assign('search_next', $search_next); |
|
151 | + } |
|
152 | + if ($start > 0) { |
|
153 | + $prev = $start - $limit; |
|
154 | + $search_url_prev = $search_url . "&start=$prev"; |
|
155 | + $search_prev = "<a href=\"" . htmlspecialchars($search_url_prev) . "\">" . _SR_PREVIOUS . '</a>'; |
|
156 | + $xoopsTpl->assign('search_prev', $search_prev); |
|
157 | + } |
|
158 | + } |
|
159 | 159 | |
160 | - unset($results); |
|
161 | - $search_info = _SR_KEYWORDS . ': ' . $myts->htmlSpecialChars($term); |
|
162 | - $xoopsTpl->assign('search_info', $search_info); |
|
160 | + unset($results); |
|
161 | + $search_info = _SR_KEYWORDS . ': ' . $myts->htmlSpecialChars($term); |
|
162 | + $xoopsTpl->assign('search_info', $search_info); |
|
163 | 163 | } |
164 | 164 | |
165 | 165 | /* type */ |
166 | 166 | $type_select = "<select name=\"andor\">"; |
167 | 167 | $type_select .= "<option value=\"OR\""; |
168 | 168 | if ('OR' === $andor) { |
169 | - $type_select .= " selected=\"selected\""; |
|
169 | + $type_select .= " selected=\"selected\""; |
|
170 | 170 | } |
171 | 171 | $type_select .= '>' . _SR_ANY . '</option>'; |
172 | 172 | $type_select .= "<option value=\"AND\""; |
173 | 173 | if ('AND' === $andor) { |
174 | - $type_select .= " selected=\"selected\""; |
|
174 | + $type_select .= " selected=\"selected\""; |
|
175 | 175 | } |
176 | 176 | $type_select .= '>' . _SR_ALL . '</option>'; |
177 | 177 | $type_select .= "<option value=\"EXACT\""; |
178 | 178 | if ('exact' === $andor) { |
179 | - $type_select .= " selected=\"selected\""; |
|
179 | + $type_select .= " selected=\"selected\""; |
|
180 | 180 | } |
181 | 181 | $type_select .= '>' . _SR_EXACT . '</option>'; |
182 | 182 | $type_select .= '</select>'; |
@@ -185,32 +185,32 @@ discard block |
||
185 | 185 | $searchin_select = ''; |
186 | 186 | $searchin_select .= "<input type=\"checkbox\" name=\"searchin[]\" value=\"title\""; |
187 | 187 | if (in_array('title', $searchin)) { |
188 | - $searchin_select .= ' checked'; |
|
188 | + $searchin_select .= ' checked'; |
|
189 | 189 | } |
190 | 190 | $searchin_select .= '>' . planet_constant('MD_TITLE') . ' '; |
191 | 191 | $searchin_select .= "<input type=\"checkbox\" name=\"searchin[]\" value=\"text\""; |
192 | 192 | if (in_array('text', $searchin)) { |
193 | - $searchin_select .= ' checked'; |
|
193 | + $searchin_select .= ' checked'; |
|
194 | 194 | } |
195 | 195 | $searchin_select .= '>' . planet_constant('MD_BODY') . ' || '; |
196 | 196 | $searchin_select .= "<input type=\"checkbox\" name=\"searchin[]\" value=\"blog\""; |
197 | 197 | if (in_array('blog', $searchin)) { |
198 | - $searchin_select .= ' checked'; |
|
198 | + $searchin_select .= ' checked'; |
|
199 | 199 | } |
200 | 200 | $searchin_select .= '>' . planet_constant('MD_BLOG') . ' '; |
201 | 201 | $searchin_select .= "<input type=\"checkbox\" name=\"searchin[]\" value=\"feed\""; |
202 | 202 | if (in_array('feed', $searchin)) { |
203 | - $searchin_select .= ' checked'; |
|
203 | + $searchin_select .= ' checked'; |
|
204 | 204 | } |
205 | 205 | $searchin_select .= '>' . planet_constant('MD_FEED') . ' '; |
206 | 206 | $searchin_select .= "<input type=\"checkbox\" name=\"searchin[]\" value=\"desc\""; |
207 | 207 | if (in_array('desc', $searchin)) { |
208 | - $searchin_select .= ' checked'; |
|
208 | + $searchin_select .= ' checked'; |
|
209 | 209 | } |
210 | 210 | $searchin_select .= '>' . planet_constant('MD_DESC') . ' '; |
211 | 211 | $searchin_select .= "<input type=\"checkbox\" name=\"searchin[]\" value=\"all\""; |
212 | 212 | if (empty($searchin)) { |
213 | - $searchin_select .= ' checked'; |
|
213 | + $searchin_select .= ' checked'; |
|
214 | 214 | } |
215 | 215 | $searchin_select .= '>' . _ALL . ' '; |
216 | 216 | |
@@ -218,28 +218,28 @@ discard block |
||
218 | 218 | $sortby_select = "<select name=\"sortby\">"; |
219 | 219 | $sortby_select .= "<option value=\"\""; |
220 | 220 | if (empty($sortby)) { |
221 | - $sortby_select .= " selected=\"selected\""; |
|
221 | + $sortby_select .= " selected=\"selected\""; |
|
222 | 222 | } |
223 | 223 | $sortby_select .= '>' . _NONE . '</option>'; |
224 | 224 | $sortby_select .= "<option value=\"a.art_time\""; |
225 | 225 | if ('a.art_time' === $sortby) { |
226 | - $sortby_select .= " selected=\"selected\""; |
|
226 | + $sortby_select .= " selected=\"selected\""; |
|
227 | 227 | } |
228 | 228 | $sortby_select .= '>' . planet_constant('MD_TIME') . '</option>'; |
229 | 229 | $sortby_select .= "<option value=\"a.art_title\""; |
230 | 230 | if ('a.art_title' === $sortby) { |
231 | - $sortby_select .= " selected=\"selected\""; |
|
231 | + $sortby_select .= " selected=\"selected\""; |
|
232 | 232 | } |
233 | 233 | $sortby_select .= '>' . planet_constant('MD_TITLE') . '</option>'; |
234 | 234 | $sortby_select .= "<option value=\"\"> ---- </option>"; |
235 | 235 | $sortby_select .= "<option value=\"a.blog_title\""; |
236 | 236 | if ('a.blog_title' === $sortby) { |
237 | - $sortby_select .= " selected=\"selected\""; |
|
237 | + $sortby_select .= " selected=\"selected\""; |
|
238 | 238 | } |
239 | 239 | $sortby_select .= '>' . planet_constant('MD_BLOG') . '</option>'; |
240 | 240 | $sortby_select .= "<option value=\"a.blog_time\""; |
241 | 241 | if ('b.blog_time' === $sortby) { |
242 | - $sortby_select .= " selected=\"selected\""; |
|
242 | + $sortby_select .= " selected=\"selected\""; |
|
243 | 243 | } |
244 | 244 | $sortby_select .= '>' . planet_constant('MD_UPDATE') . '</option>'; |
245 | 245 | $sortby_select .= '</select>'; |
@@ -256,7 +256,7 @@ discard block |
||
256 | 256 | $xoopsTpl->assign('uid', $uid); |
257 | 257 | |
258 | 258 | if ($xoopsConfigSearch['keyword_min'] > 0) { |
259 | - $xoopsTpl->assign('search_rule', sprintf(_SR_KEYIGNORE, $xoopsConfigSearch['keyword_min'])); |
|
259 | + $xoopsTpl->assign('search_rule', sprintf(_SR_KEYIGNORE, $xoopsConfigSearch['keyword_min'])); |
|
260 | 260 | } |
261 | 261 | |
262 | 262 | include XOOPS_ROOT_PATH . '/footer.php'; |
@@ -27,32 +27,32 @@ discard block |
||
27 | 27 | use Xmf\Request; |
28 | 28 | |
29 | 29 | $xoopsOption['pagetype'] = 'search'; |
30 | -include __DIR__ . '/header.php'; |
|
30 | +include __DIR__.'/header.php'; |
|
31 | 31 | $xoopsModule->loadLanguage('main'); |
32 | 32 | $configHandler = xoops_getHandler('config'); |
33 | 33 | $xoopsConfigSearch = $configHandler->getConfigsByCat(XOOPS_CONF_SEARCH); |
34 | 34 | if (empty($xoopsConfigSearch['enable_search'])) { |
35 | - redirect_header(XOOPS_URL . '/modules/' . $GLOBALS['moddirname'] . '/index.php', 2, planet_constant('MD_NOACCESS')); |
|
35 | + redirect_header(XOOPS_URL.'/modules/'.$GLOBALS['moddirname'].'/index.php', 2, planet_constant('MD_NOACCESS')); |
|
36 | 36 | } |
37 | 37 | |
38 | 38 | $xoopsConfig['module_cache'][$xoopsModule->getVar('mid')] = 0; |
39 | 39 | $xoopsOption['template_main'] = PlanetUtility::planetGetTemplate('search'); |
40 | -include XOOPS_ROOT_PATH . '/header.php'; |
|
41 | -include XOOPS_ROOT_PATH . '/modules/' . $xoopsModule->getVar('dirname') . '/include/vars.php'; |
|
40 | +include XOOPS_ROOT_PATH.'/header.php'; |
|
41 | +include XOOPS_ROOT_PATH.'/modules/'.$xoopsModule->getVar('dirname').'/include/vars.php'; |
|
42 | 42 | |
43 | -require_once XOOPS_ROOT_PATH . '/modules/' . $GLOBALS['moddirname'] . '/include/search.inc.php'; |
|
43 | +require_once XOOPS_ROOT_PATH.'/modules/'.$GLOBALS['moddirname'].'/include/search.inc.php'; |
|
44 | 44 | $limit = $xoopsModuleConfig['articles_perpage']; |
45 | 45 | |
46 | 46 | $queries = array(); |
47 | -$andor = Request::getString('andor', Request::getString('andor', '', 'GET'), 'POST');//isset($_POST['andor']) ? $_POST['andor'] : (isset($_GET['andor']) ? $_GET['andor'] : ''); |
|
48 | -$start = Request::getInt('start', 0, 'GET');//isset($_GET['start']) ? $_GET['start'] : 0; |
|
47 | +$andor = Request::getString('andor', Request::getString('andor', '', 'GET'), 'POST'); //isset($_POST['andor']) ? $_POST['andor'] : (isset($_GET['andor']) ? $_GET['andor'] : ''); |
|
48 | +$start = Request::getInt('start', 0, 'GET'); //isset($_GET['start']) ? $_GET['start'] : 0; |
|
49 | 49 | $category = Request::getInt('category', Request::getInt('category', 0, 'GET'), 'POST'); //(int)(isset($_POST['category']) ? $_POST['category'] : (isset($_GET['category']) ? $_GET['category'] : null)); |
50 | -$blog = Request::getInt('blog', Request::getInt('blog', 0, 'GET'), 'POST');//(int)(isset($_POST['blog']) ? $_POST['blog'] : (isset($_GET['blog']) ? $_GET['blog'] : null)); |
|
51 | -$uid = Request::getInt('uid', Request::getInt('uid', 0, 'GET'), 'POST');//(int)(isset($_POST['uid']) ? $_POST['uid'] : (isset($_GET['uid']) ? $_GET['uid'] : null)); |
|
50 | +$blog = Request::getInt('blog', Request::getInt('blog', 0, 'GET'), 'POST'); //(int)(isset($_POST['blog']) ? $_POST['blog'] : (isset($_GET['blog']) ? $_GET['blog'] : null)); |
|
51 | +$uid = Request::getInt('uid', Request::getInt('uid', 0, 'GET'), 'POST'); //(int)(isset($_POST['uid']) ? $_POST['uid'] : (isset($_GET['uid']) ? $_GET['uid'] : null)); |
|
52 | 52 | $searchin = Request::getArray('searchin', 0 !== count(Request::getArray('searchin', array(), 'GET')) ? explode('|', Request::getArray('searchin', array(), 'GET')) : array(), |
53 | 53 | 'POST'); //isset($_POST['searchin']) ? $_POST['searchin'] : (isset($_GET['searchin']) ? explode('|', $_GET['searchin']) : array()); |
54 | -$sortby = Request::getString('sortby', Request::getString('sortby', null, 'GET'), 'POST');//isset($_POST['sortby']) ? $_POST['sortby'] : (isset($_GET['sortby']) ? $_GET['sortby'] : null); |
|
55 | -$term = Request::getString('term', Request::getString('term', '', 'GET'), 'POST');//isset($_POST['term']) ? $_POST['term'] : (isset($_GET['term']) ? $_GET['term'] : ''); |
|
54 | +$sortby = Request::getString('sortby', Request::getString('sortby', null, 'GET'), 'POST'); //isset($_POST['sortby']) ? $_POST['sortby'] : (isset($_GET['sortby']) ? $_GET['sortby'] : null); |
|
55 | +$term = Request::getString('term', Request::getString('term', '', 'GET'), 'POST'); //isset($_POST['term']) ? $_POST['term'] : (isset($_GET['term']) ? $_GET['term'] : ''); |
|
56 | 56 | |
57 | 57 | $andor = in_array(strtoupper($andor), array('OR', 'AND', 'EXACT')) ? strtoupper($andor) : 'OR'; |
58 | 58 | $sortby = in_array(strtolower($sortby), array( |
@@ -80,18 +80,18 @@ discard block |
||
80 | 80 | $temp_queries = preg_split("/[\s,]+/", $query); |
81 | 81 | foreach ($temp_queries as $q) { |
82 | 82 | $q = trim($q); |
83 | - if (strlen($q) >= $xoopsConfigSearch['keyword_min']) { |
|
83 | + if (strlen($q)>=$xoopsConfigSearch['keyword_min']) { |
|
84 | 84 | $queries[] = $myts->addSlashes($q); |
85 | - } else { |
|
85 | + }else { |
|
86 | 86 | $ignored_queries[] = $myts->addSlashes($q); |
87 | 87 | } |
88 | 88 | } |
89 | 89 | if (count($queries) == 0) { |
90 | - redirect_header(XOOPS_URL . '/modules/' . $GLOBALS['moddirname'] . '/search.php', 2, sprintf(_SR_KEYTOOSHORT, $xoopsConfigSearch['keyword_min'])); |
|
90 | + redirect_header(XOOPS_URL.'/modules/'.$GLOBALS['moddirname'].'/search.php', 2, sprintf(_SR_KEYTOOSHORT, $xoopsConfigSearch['keyword_min'])); |
|
91 | 91 | } |
92 | - } else { |
|
93 | - if (strlen($query) < $xoopsConfigSearch['keyword_min']) { |
|
94 | - redirect_header(XOOPS_URL . '/modules/' . $GLOBALS['moddirname'] . '/search.php', 2, sprintf(_SR_KEYTOOSHORT, $xoopsConfigSearch['keyword_min'])); |
|
92 | + }else { |
|
93 | + if (strlen($query)<$xoopsConfigSearch['keyword_min']) { |
|
94 | + redirect_header(XOOPS_URL.'/modules/'.$GLOBALS['moddirname'].'/search.php', 2, sprintf(_SR_KEYTOOSHORT, $xoopsConfigSearch['keyword_min'])); |
|
95 | 95 | } |
96 | 96 | $queries = array($myts->addSlashes($query)); |
97 | 97 | } |
@@ -104,7 +104,7 @@ discard block |
||
104 | 104 | */ |
105 | 105 | if (!empty($time)) { |
106 | 106 | $extra = ''; |
107 | - } else { |
|
107 | + }else { |
|
108 | 108 | $extra = ''; |
109 | 109 | } |
110 | 110 | |
@@ -118,20 +118,20 @@ discard block |
||
118 | 118 | { |
119 | 119 | $xoopsTpl->assign('results', $results); |
120 | 120 | |
121 | - if (count($next_search) > 0) { |
|
121 | + if (count($next_search)>0) { |
|
122 | 122 | $items = array(); |
123 | 123 | foreach ($next_search as $para => $val) { |
124 | 124 | if (!empty($val)) { |
125 | 125 | $items[] = "$para=$val"; |
126 | 126 | } |
127 | 127 | } |
128 | - if (count($items) > 0) { |
|
128 | + if (count($items)>0) { |
|
129 | 129 | $paras = implode('&', $items); |
130 | 130 | } |
131 | 131 | unset($next_search); |
132 | 132 | unset($items); |
133 | 133 | } |
134 | - $search_url = XOOPS_URL . '/modules/' . $GLOBALS['moddirname'] . '/search.php?' . $paras; |
|
134 | + $search_url = XOOPS_URL.'/modules/'.$GLOBALS['moddirname'].'/search.php?'.$paras; |
|
135 | 135 | |
136 | 136 | /* |
137 | 137 | $next_results =& planet_search($queries, $andor, 1, $start + $limit, $uid, $category, $sortby, $searchin, $extra); |
@@ -143,22 +143,22 @@ discard block |
||
143 | 143 | if (false != $has_next) |
144 | 144 | */ |
145 | 145 | if (count($results)) { |
146 | - $next = $start + $limit; |
|
146 | + $next = $start+$limit; |
|
147 | 147 | $queries = implode(',', $queries); |
148 | - $search_url_next = $search_url . "&start=$next"; |
|
149 | - $search_next = "<a href=\"" . htmlspecialchars($search_url_next) . "\">" . _SR_NEXT . '</a>'; |
|
148 | + $search_url_next = $search_url."&start=$next"; |
|
149 | + $search_next = "<a href=\"".htmlspecialchars($search_url_next)."\">"._SR_NEXT.'</a>'; |
|
150 | 150 | $xoopsTpl->assign('search_next', $search_next); |
151 | 151 | } |
152 | - if ($start > 0) { |
|
153 | - $prev = $start - $limit; |
|
154 | - $search_url_prev = $search_url . "&start=$prev"; |
|
155 | - $search_prev = "<a href=\"" . htmlspecialchars($search_url_prev) . "\">" . _SR_PREVIOUS . '</a>'; |
|
152 | + if ($start>0) { |
|
153 | + $prev = $start-$limit; |
|
154 | + $search_url_prev = $search_url."&start=$prev"; |
|
155 | + $search_prev = "<a href=\"".htmlspecialchars($search_url_prev)."\">"._SR_PREVIOUS.'</a>'; |
|
156 | 156 | $xoopsTpl->assign('search_prev', $search_prev); |
157 | 157 | } |
158 | 158 | } |
159 | 159 | |
160 | 160 | unset($results); |
161 | - $search_info = _SR_KEYWORDS . ': ' . $myts->htmlSpecialChars($term); |
|
161 | + $search_info = _SR_KEYWORDS.': '.$myts->htmlSpecialChars($term); |
|
162 | 162 | $xoopsTpl->assign('search_info', $search_info); |
163 | 163 | } |
164 | 164 | |
@@ -168,17 +168,17 @@ discard block |
||
168 | 168 | if ('OR' === $andor) { |
169 | 169 | $type_select .= " selected=\"selected\""; |
170 | 170 | } |
171 | -$type_select .= '>' . _SR_ANY . '</option>'; |
|
171 | +$type_select .= '>'._SR_ANY.'</option>'; |
|
172 | 172 | $type_select .= "<option value=\"AND\""; |
173 | 173 | if ('AND' === $andor) { |
174 | 174 | $type_select .= " selected=\"selected\""; |
175 | 175 | } |
176 | -$type_select .= '>' . _SR_ALL . '</option>'; |
|
176 | +$type_select .= '>'._SR_ALL.'</option>'; |
|
177 | 177 | $type_select .= "<option value=\"EXACT\""; |
178 | 178 | if ('exact' === $andor) { |
179 | 179 | $type_select .= " selected=\"selected\""; |
180 | 180 | } |
181 | -$type_select .= '>' . _SR_EXACT . '</option>'; |
|
181 | +$type_select .= '>'._SR_EXACT.'</option>'; |
|
182 | 182 | $type_select .= '</select>'; |
183 | 183 | |
184 | 184 | /* scope */ |
@@ -187,32 +187,32 @@ discard block |
||
187 | 187 | if (in_array('title', $searchin)) { |
188 | 188 | $searchin_select .= ' checked'; |
189 | 189 | } |
190 | -$searchin_select .= '>' . planet_constant('MD_TITLE') . ' '; |
|
190 | +$searchin_select .= '>'.planet_constant('MD_TITLE').' '; |
|
191 | 191 | $searchin_select .= "<input type=\"checkbox\" name=\"searchin[]\" value=\"text\""; |
192 | 192 | if (in_array('text', $searchin)) { |
193 | 193 | $searchin_select .= ' checked'; |
194 | 194 | } |
195 | -$searchin_select .= '>' . planet_constant('MD_BODY') . ' || '; |
|
195 | +$searchin_select .= '>'.planet_constant('MD_BODY').' || '; |
|
196 | 196 | $searchin_select .= "<input type=\"checkbox\" name=\"searchin[]\" value=\"blog\""; |
197 | 197 | if (in_array('blog', $searchin)) { |
198 | 198 | $searchin_select .= ' checked'; |
199 | 199 | } |
200 | -$searchin_select .= '>' . planet_constant('MD_BLOG') . ' '; |
|
200 | +$searchin_select .= '>'.planet_constant('MD_BLOG').' '; |
|
201 | 201 | $searchin_select .= "<input type=\"checkbox\" name=\"searchin[]\" value=\"feed\""; |
202 | 202 | if (in_array('feed', $searchin)) { |
203 | 203 | $searchin_select .= ' checked'; |
204 | 204 | } |
205 | -$searchin_select .= '>' . planet_constant('MD_FEED') . ' '; |
|
205 | +$searchin_select .= '>'.planet_constant('MD_FEED').' '; |
|
206 | 206 | $searchin_select .= "<input type=\"checkbox\" name=\"searchin[]\" value=\"desc\""; |
207 | 207 | if (in_array('desc', $searchin)) { |
208 | 208 | $searchin_select .= ' checked'; |
209 | 209 | } |
210 | -$searchin_select .= '>' . planet_constant('MD_DESC') . ' '; |
|
210 | +$searchin_select .= '>'.planet_constant('MD_DESC').' '; |
|
211 | 211 | $searchin_select .= "<input type=\"checkbox\" name=\"searchin[]\" value=\"all\""; |
212 | 212 | if (empty($searchin)) { |
213 | 213 | $searchin_select .= ' checked'; |
214 | 214 | } |
215 | -$searchin_select .= '>' . _ALL . ' '; |
|
215 | +$searchin_select .= '>'._ALL.' '; |
|
216 | 216 | |
217 | 217 | /* sortby */ |
218 | 218 | $sortby_select = "<select name=\"sortby\">"; |
@@ -220,28 +220,28 @@ discard block |
||
220 | 220 | if (empty($sortby)) { |
221 | 221 | $sortby_select .= " selected=\"selected\""; |
222 | 222 | } |
223 | -$sortby_select .= '>' . _NONE . '</option>'; |
|
223 | +$sortby_select .= '>'._NONE.'</option>'; |
|
224 | 224 | $sortby_select .= "<option value=\"a.art_time\""; |
225 | 225 | if ('a.art_time' === $sortby) { |
226 | 226 | $sortby_select .= " selected=\"selected\""; |
227 | 227 | } |
228 | -$sortby_select .= '>' . planet_constant('MD_TIME') . '</option>'; |
|
228 | +$sortby_select .= '>'.planet_constant('MD_TIME').'</option>'; |
|
229 | 229 | $sortby_select .= "<option value=\"a.art_title\""; |
230 | 230 | if ('a.art_title' === $sortby) { |
231 | 231 | $sortby_select .= " selected=\"selected\""; |
232 | 232 | } |
233 | -$sortby_select .= '>' . planet_constant('MD_TITLE') . '</option>'; |
|
233 | +$sortby_select .= '>'.planet_constant('MD_TITLE').'</option>'; |
|
234 | 234 | $sortby_select .= "<option value=\"\"> ---- </option>"; |
235 | 235 | $sortby_select .= "<option value=\"a.blog_title\""; |
236 | 236 | if ('a.blog_title' === $sortby) { |
237 | 237 | $sortby_select .= " selected=\"selected\""; |
238 | 238 | } |
239 | -$sortby_select .= '>' . planet_constant('MD_BLOG') . '</option>'; |
|
239 | +$sortby_select .= '>'.planet_constant('MD_BLOG').'</option>'; |
|
240 | 240 | $sortby_select .= "<option value=\"a.blog_time\""; |
241 | 241 | if ('b.blog_time' === $sortby) { |
242 | 242 | $sortby_select .= " selected=\"selected\""; |
243 | 243 | } |
244 | -$sortby_select .= '>' . planet_constant('MD_UPDATE') . '</option>'; |
|
244 | +$sortby_select .= '>'.planet_constant('MD_UPDATE').'</option>'; |
|
245 | 245 | $sortby_select .= '</select>'; |
246 | 246 | |
247 | 247 | $xoopsTpl->assign('type_select', $type_select); |
@@ -255,8 +255,8 @@ discard block |
||
255 | 255 | $xoopsTpl->assign('blog', $blog); |
256 | 256 | $xoopsTpl->assign('uid', $uid); |
257 | 257 | |
258 | -if ($xoopsConfigSearch['keyword_min'] > 0) { |
|
258 | +if ($xoopsConfigSearch['keyword_min']>0) { |
|
259 | 259 | $xoopsTpl->assign('search_rule', sprintf(_SR_KEYIGNORE, $xoopsConfigSearch['keyword_min'])); |
260 | 260 | } |
261 | 261 | |
262 | -include XOOPS_ROOT_PATH . '/footer.php'; |
|
262 | +include XOOPS_ROOT_PATH.'/footer.php'; |
@@ -32,51 +32,51 @@ |
||
32 | 32 | include __DIR__ . '/header.php'; |
33 | 33 | global $pdf_data; |
34 | 34 | if (!empty($_POST['pdf_data'])) { |
35 | - $pdf_data = unserialize(base64_decode(Request::getText('pdf_data', '', 'POST'))); |
|
35 | + $pdf_data = unserialize(base64_decode(Request::getText('pdf_data', '', 'POST'))); |
|
36 | 36 | } elseif (!empty($pdf_data)) { |
37 | 37 | } else { |
38 | - error_reporting(0); |
|
39 | - include __DIR__ . '/header.php'; |
|
40 | - error_reporting(0); |
|
38 | + error_reporting(0); |
|
39 | + include __DIR__ . '/header.php'; |
|
40 | + error_reporting(0); |
|
41 | 41 | |
42 | - if (PlanetUtility::planetParseArguments($args_num, $args, $args_str)) { |
|
43 | - $args['article'] = @$args_num[0]; |
|
44 | - } |
|
42 | + if (PlanetUtility::planetParseArguments($args_num, $args, $args_str)) { |
|
43 | + $args['article'] = @$args_num[0]; |
|
44 | + } |
|
45 | 45 | |
46 | - $article_id = (int)(empty($_GET['article']) ? @$args['article'] : $_GET['article']); |
|
46 | + $article_id = (int)(empty($_GET['article']) ? @$args['article'] : $_GET['article']); |
|
47 | 47 | |
48 | - $articleHandler = xoops_getModuleHandler('article', $GLOBALS['moddirname']); |
|
49 | - $article_obj = $articleHandler->get($article_id); |
|
48 | + $articleHandler = xoops_getModuleHandler('article', $GLOBALS['moddirname']); |
|
49 | + $article_obj = $articleHandler->get($article_id); |
|
50 | 50 | |
51 | - $article_data = array(); |
|
51 | + $article_data = array(); |
|
52 | 52 | |
53 | - // title |
|
54 | - $article_data['title'] = $article_obj->getVar('art_title'); |
|
53 | + // title |
|
54 | + $article_data['title'] = $article_obj->getVar('art_title'); |
|
55 | 55 | |
56 | - $article_data['author'] = $article_obj->getVar('art_author'); |
|
56 | + $article_data['author'] = $article_obj->getVar('art_author'); |
|
57 | 57 | |
58 | - // source |
|
59 | - $article_data['source'] = $article_obj->getVar('art_link'); |
|
58 | + // source |
|
59 | + $article_data['source'] = $article_obj->getVar('art_link'); |
|
60 | 60 | |
61 | - // publish time |
|
62 | - $article_data['time'] = $article_obj->getTime(); |
|
61 | + // publish time |
|
62 | + $article_data['time'] = $article_obj->getTime(); |
|
63 | 63 | |
64 | - // summary |
|
65 | - $article_data['summary'] = $article_obj->getSummary(); |
|
64 | + // summary |
|
65 | + $article_data['summary'] = $article_obj->getSummary(); |
|
66 | 66 | |
67 | - // text of page |
|
68 | - $article_data['text'] = $article_obj->getVar('art_content'); |
|
67 | + // text of page |
|
68 | + $article_data['text'] = $article_obj->getVar('art_content'); |
|
69 | 69 | |
70 | - // Build the pdf_data array |
|
71 | - $pdf_data['title'] = $article_data['title']; |
|
72 | - $pdf_data['author'] = $article_data['author']; |
|
73 | - $pdf_data['date'] = $article_data['time']; |
|
74 | - $pdf_data['content'] = ''; |
|
75 | - if ($article_data['summary']) { |
|
76 | - $pdf_data['content'] .= planet_constant('MD_SUMMARY') . ': ' . $article_data['summary'] . '<br><br>'; |
|
77 | - } |
|
78 | - $pdf_data['content'] .= $article_data['text'] . '<br>'; |
|
79 | - $pdf_data['url'] = XOOPS_URL . '/modules/' . $GLOBALS['artdirname'] . '/view.article.php' . URL_DELIMITER . $article_obj->getVar('art_id'); |
|
70 | + // Build the pdf_data array |
|
71 | + $pdf_data['title'] = $article_data['title']; |
|
72 | + $pdf_data['author'] = $article_data['author']; |
|
73 | + $pdf_data['date'] = $article_data['time']; |
|
74 | + $pdf_data['content'] = ''; |
|
75 | + if ($article_data['summary']) { |
|
76 | + $pdf_data['content'] .= planet_constant('MD_SUMMARY') . ': ' . $article_data['summary'] . '<br><br>'; |
|
77 | + } |
|
78 | + $pdf_data['content'] .= $article_data['text'] . '<br>'; |
|
79 | + $pdf_data['url'] = XOOPS_URL . '/modules/' . $GLOBALS['artdirname'] . '/view.article.php' . URL_DELIMITER . $article_obj->getVar('art_id'); |
|
80 | 80 | } |
81 | 81 | $pdf_data['filename'] = preg_replace("/[^0-9a-z\-_\.]/i", '', $pdf_data['title']); |
82 | 82 |
@@ -29,21 +29,21 @@ discard block |
||
29 | 29 | |
30 | 30 | use Xmf\Request; |
31 | 31 | |
32 | -include __DIR__ . '/header.php'; |
|
32 | +include __DIR__.'/header.php'; |
|
33 | 33 | global $pdf_data; |
34 | 34 | if (!empty($_POST['pdf_data'])) { |
35 | 35 | $pdf_data = unserialize(base64_decode(Request::getText('pdf_data', '', 'POST'))); |
36 | 36 | } elseif (!empty($pdf_data)) { |
37 | -} else { |
|
37 | +}else { |
|
38 | 38 | error_reporting(0); |
39 | - include __DIR__ . '/header.php'; |
|
39 | + include __DIR__.'/header.php'; |
|
40 | 40 | error_reporting(0); |
41 | 41 | |
42 | 42 | if (PlanetUtility::planetParseArguments($args_num, $args, $args_str)) { |
43 | 43 | $args['article'] = @$args_num[0]; |
44 | 44 | } |
45 | 45 | |
46 | - $article_id = (int)(empty($_GET['article']) ? @$args['article'] : $_GET['article']); |
|
46 | + $article_id = (int) (empty($_GET['article']) ? @$args['article'] : $_GET['article']); |
|
47 | 47 | |
48 | 48 | $articleHandler = xoops_getModuleHandler('article', $GLOBALS['moddirname']); |
49 | 49 | $article_obj = $articleHandler->get($article_id); |
@@ -73,14 +73,14 @@ discard block |
||
73 | 73 | $pdf_data['date'] = $article_data['time']; |
74 | 74 | $pdf_data['content'] = ''; |
75 | 75 | if ($article_data['summary']) { |
76 | - $pdf_data['content'] .= planet_constant('MD_SUMMARY') . ': ' . $article_data['summary'] . '<br><br>'; |
|
76 | + $pdf_data['content'] .= planet_constant('MD_SUMMARY').': '.$article_data['summary'].'<br><br>'; |
|
77 | 77 | } |
78 | - $pdf_data['content'] .= $article_data['text'] . '<br>'; |
|
79 | - $pdf_data['url'] = XOOPS_URL . '/modules/' . $GLOBALS['artdirname'] . '/view.article.php' . URL_DELIMITER . $article_obj->getVar('art_id'); |
|
78 | + $pdf_data['content'] .= $article_data['text'].'<br>'; |
|
79 | + $pdf_data['url'] = XOOPS_URL.'/modules/'.$GLOBALS['artdirname'].'/view.article.php'.URL_DELIMITER.$article_obj->getVar('art_id'); |
|
80 | 80 | } |
81 | 81 | $pdf_data['filename'] = preg_replace("/[^0-9a-z\-_\.]/i", '', $pdf_data['title']); |
82 | 82 | |
83 | -include XOOPS_ROOT_PATH . '/Frameworks/fpdf/init.php'; |
|
83 | +include XOOPS_ROOT_PATH.'/Frameworks/fpdf/init.php'; |
|
84 | 84 | error_reporting(0); |
85 | 85 | ob_end_clean(); |
86 | 86 |
@@ -18,6 +18,6 @@ |
||
18 | 18 | */ |
19 | 19 | |
20 | 20 | $pathIcon32 = \Xmf\Module\Admin::iconUrl('', 32); |
21 | -echo "<div class='adminfooter'>\n" . " <div style='text-align: center;'>\n" . " <a href='https://xoops.org' rel='external'><img src='{$pathIcon32}/xoopsmicrobutton.gif' alt='XOOPS' title='XOOPS'></a>\n" . " </div>\n" . ' ' . _AM_MODULEADMIN_ADMIN_FOOTER . "\n" . '</div>'; |
|
21 | +echo "<div class='adminfooter'>\n"." <div style='text-align: center;'>\n"." <a href='https://xoops.org' rel='external'><img src='{$pathIcon32}/xoopsmicrobutton.gif' alt='XOOPS' title='XOOPS'></a>\n"." </div>\n".' '._AM_MODULEADMIN_ADMIN_FOOTER."\n".'</div>'; |
|
22 | 22 | |
23 | 23 | xoops_cp_footer(); |
@@ -30,7 +30,7 @@ discard block |
||
30 | 30 | |
31 | 31 | if (false !== ($moduleHelper = Xmf\Module\Helper::getHelper($moduleDirName))) { |
32 | 32 | } else { |
33 | - $moduleHelper = Xmf\Module\Helper::getHelper('system'); |
|
33 | + $moduleHelper = Xmf\Module\Helper::getHelper('system'); |
|
34 | 34 | } |
35 | 35 | $adminObject = \Xmf\Module\Admin::getInstance(); |
36 | 36 | |
@@ -46,8 +46,8 @@ discard block |
||
46 | 46 | $myts = MyTextSanitizer::getInstance(); |
47 | 47 | |
48 | 48 | if (!isset($GLOBALS['xoopsTpl']) || !($GLOBALS['xoopsTpl'] instanceof XoopsTpl)) { |
49 | - require_once $GLOBALS['xoops']->path('class/template.php'); |
|
50 | - $xoopsTpl = new XoopsTpl(); |
|
49 | + require_once $GLOBALS['xoops']->path('class/template.php'); |
|
50 | + $xoopsTpl = new XoopsTpl(); |
|
51 | 51 | } |
52 | 52 | |
53 | 53 | require XOOPS_ROOT_PATH . '/modules/' . $xoopsModule->getVar('dirname') . '/include/vars.php'; |
@@ -18,10 +18,10 @@ discard block |
||
18 | 18 | */ |
19 | 19 | |
20 | 20 | $path = dirname(dirname(dirname(__DIR__))); |
21 | -require_once $path . '/mainfile.php'; |
|
22 | -require_once $path . '/include/cp_functions.php'; |
|
23 | -require_once $path . '/include/cp_header.php'; |
|
24 | -require_once __DIR__ . '/../class/utility.php'; |
|
21 | +require_once $path.'/mainfile.php'; |
|
22 | +require_once $path.'/include/cp_functions.php'; |
|
23 | +require_once $path.'/include/cp_header.php'; |
|
24 | +require_once __DIR__.'/../class/utility.php'; |
|
25 | 25 | |
26 | 26 | //require_once __DIR__ . '/../class/utility.php'; |
27 | 27 | //require_once __DIR__ . '/../include/common.php'; |
@@ -29,7 +29,7 @@ discard block |
||
29 | 29 | $moduleDirName = basename(dirname(__DIR__)); |
30 | 30 | |
31 | 31 | if (false !== ($moduleHelper = Xmf\Module\Helper::getHelper($moduleDirName))) { |
32 | -} else { |
|
32 | +}else { |
|
33 | 33 | $moduleHelper = Xmf\Module\Helper::getHelper('system'); |
34 | 34 | } |
35 | 35 | $adminObject = \Xmf\Module\Admin::getInstance(); |
@@ -50,8 +50,8 @@ discard block |
||
50 | 50 | $xoopsTpl = new XoopsTpl(); |
51 | 51 | } |
52 | 52 | |
53 | -require XOOPS_ROOT_PATH . '/modules/' . $xoopsModule->getVar('dirname') . '/include/vars.php'; |
|
53 | +require XOOPS_ROOT_PATH.'/modules/'.$xoopsModule->getVar('dirname').'/include/vars.php'; |
|
54 | 54 | //require_once XOOPS_ROOT_PATH . '/modules/' . $xoopsModule->getVar('dirname') . '/include/functions.php'; |
55 | -require_once XOOPS_ROOT_PATH . '/Frameworks/art/functions.admin.php'; |
|
55 | +require_once XOOPS_ROOT_PATH.'/Frameworks/art/functions.admin.php'; |
|
56 | 56 | |
57 | 57 | planet_define_url_delimiter(); |
@@ -41,18 +41,18 @@ discard block |
||
41 | 41 | |
42 | 42 | $articleHandler = xoops_getModuleHandler('article', $GLOBALS['moddirname']); |
43 | 43 | if (!empty($xoopsModuleConfig['article_expire'])) { |
44 | - $criteria = new Criteria('art_time', time() - $xoopsModuleConfig['article_expire'] * 60 * 60 * 24, '<'); |
|
45 | - if (!empty($_GET['purge'])) { |
|
46 | - $crit = new CriteriaCompo($criteria); |
|
47 | - $crit->add(new Criteria('art_comments', 0)); |
|
48 | - $article_expires = $articleHandler->getObjects($criteria); |
|
49 | - foreach ($article_expires as $id => $article_obj) { |
|
50 | - $articleHandler->delete($article_obj); |
|
51 | - } |
|
52 | - } |
|
53 | - $article_count_expire = $articleHandler->getCount($criteria); |
|
44 | + $criteria = new Criteria('art_time', time() - $xoopsModuleConfig['article_expire'] * 60 * 60 * 24, '<'); |
|
45 | + if (!empty($_GET['purge'])) { |
|
46 | + $crit = new CriteriaCompo($criteria); |
|
47 | + $crit->add(new Criteria('art_comments', 0)); |
|
48 | + $article_expires = $articleHandler->getObjects($criteria); |
|
49 | + foreach ($article_expires as $id => $article_obj) { |
|
50 | + $articleHandler->delete($article_obj); |
|
51 | + } |
|
52 | + } |
|
53 | + $article_count_expire = $articleHandler->getCount($criteria); |
|
54 | 54 | } else { |
55 | - $article_count_expire = 0; |
|
55 | + $article_count_expire = 0; |
|
56 | 56 | } |
57 | 57 | $article_count = $articleHandler->getCount(); |
58 | 58 | |
@@ -61,8 +61,8 @@ discard block |
||
61 | 61 | echo "<br clear=\"all\">" . planet_constant('AM_COUNT') . ': ' . $article_count; |
62 | 62 | echo "<br clear=\"all\">"; |
63 | 63 | if ($article_count_expire > 0) { |
64 | - echo "<br clear=\"all\"><a href=\"" . XOOPS_URL . '/modules/' . $GLOBALS['moddirname'] . "/admin/admin.article.php?purge=1\" >" . planet_constant('AM_EXPIRED') . ': ' . $article_count_expire . '</a>'; |
|
65 | - echo "<br clear=\"all\">"; |
|
64 | + echo "<br clear=\"all\"><a href=\"" . XOOPS_URL . '/modules/' . $GLOBALS['moddirname'] . "/admin/admin.article.php?purge=1\" >" . planet_constant('AM_EXPIRED') . ': ' . $article_count_expire . '</a>'; |
|
65 | + echo "<br clear=\"all\">"; |
|
66 | 66 | } |
67 | 67 | echo '</div>'; |
68 | 68 | echo "</fieldset><br clear=\"all\">"; |
@@ -24,7 +24,7 @@ discard block |
||
24 | 24 | // URL: https://xoops.org // |
25 | 25 | // Project: Article Project // |
26 | 26 | // ------------------------------------------------------------------------ // |
27 | -require_once __DIR__ . '/admin_header.php'; |
|
27 | +require_once __DIR__.'/admin_header.php'; |
|
28 | 28 | |
29 | 29 | xoops_cp_header(); |
30 | 30 | $adminObject = \Xmf\Module\Admin::getInstance(); |
@@ -36,12 +36,12 @@ discard block |
||
36 | 36 | * This is a tricky fix for incomplete solution of module cone |
37 | 37 | * it is expected to have a better solution in article 1.0 |
38 | 38 | */ |
39 | -require XOOPS_ROOT_PATH . '/modules/' . $xoopsModule->getVar('dirname') . '/include/vars.php'; |
|
39 | +require XOOPS_ROOT_PATH.'/modules/'.$xoopsModule->getVar('dirname').'/include/vars.php'; |
|
40 | 40 | //planet_adminmenu(3); |
41 | 41 | |
42 | 42 | $articleHandler = xoops_getModuleHandler('article', $GLOBALS['moddirname']); |
43 | 43 | if (!empty($xoopsModuleConfig['article_expire'])) { |
44 | - $criteria = new Criteria('art_time', time() - $xoopsModuleConfig['article_expire'] * 60 * 60 * 24, '<'); |
|
44 | + $criteria = new Criteria('art_time', time()-$xoopsModuleConfig['article_expire']*60*60*24, '<'); |
|
45 | 45 | if (!empty($_GET['purge'])) { |
46 | 46 | $crit = new CriteriaCompo($criteria); |
47 | 47 | $crit->add(new Criteria('art_comments', 0)); |
@@ -51,17 +51,17 @@ discard block |
||
51 | 51 | } |
52 | 52 | } |
53 | 53 | $article_count_expire = $articleHandler->getCount($criteria); |
54 | -} else { |
|
54 | +}else { |
|
55 | 55 | $article_count_expire = 0; |
56 | 56 | } |
57 | 57 | $article_count = $articleHandler->getCount(); |
58 | 58 | |
59 | -echo "<fieldset><legend style=\"font-weight: bold; color: #900;\">" . planet_constant('AM_ARTICLES') . '</legend>'; |
|
59 | +echo "<fieldset><legend style=\"font-weight: bold; color: #900;\">".planet_constant('AM_ARTICLES').'</legend>'; |
|
60 | 60 | echo "<div style=\"padding: 8px;\">"; |
61 | -echo "<br clear=\"all\">" . planet_constant('AM_COUNT') . ': ' . $article_count; |
|
61 | +echo "<br clear=\"all\">".planet_constant('AM_COUNT').': '.$article_count; |
|
62 | 62 | echo "<br clear=\"all\">"; |
63 | -if ($article_count_expire > 0) { |
|
64 | - echo "<br clear=\"all\"><a href=\"" . XOOPS_URL . '/modules/' . $GLOBALS['moddirname'] . "/admin/admin.article.php?purge=1\" >" . planet_constant('AM_EXPIRED') . ': ' . $article_count_expire . '</a>'; |
|
63 | +if ($article_count_expire>0) { |
|
64 | + echo "<br clear=\"all\"><a href=\"".XOOPS_URL.'/modules/'.$GLOBALS['moddirname']."/admin/admin.article.php?purge=1\" >".planet_constant('AM_EXPIRED').': '.$article_count_expire.'</a>'; |
|
65 | 65 | echo "<br clear=\"all\">"; |
66 | 66 | } |
67 | 67 | echo '</div>'; |
@@ -52,344 +52,344 @@ |
||
52 | 52 | $categoryHandler = xoops_getModuleHandler('category', $GLOBALS['moddirname']); |
53 | 53 | |
54 | 54 | if ('save' === $op && !empty(Request::getString('fetch', '', 'POST'))) { |
55 | - $op = 'edit'; |
|
55 | + $op = 'edit'; |
|
56 | 56 | } |
57 | 57 | |
58 | 58 | switch ($op) { |
59 | - /* save a single blog */ |
|
60 | - case 'save': |
|
61 | - |
|
62 | - if ($blog_id) { |
|
63 | - $blog_obj = $blogHandler->get($blog_id); |
|
64 | - } else { |
|
65 | - if ($blog_exists = $blogHandler->getCount(new Criteria('blog_feed', Request::getString('blog_feed', '', 'POST')))) { |
|
66 | - redirect_header('admin.blog.php', 2, planet_constant('AM_BLOGEXISTS')); |
|
67 | - } |
|
68 | - $blog_obj = $blogHandler->create(); |
|
69 | - $blog_obj->setVar('blog_submitter', $xoopsUser->getVar('uid')); |
|
70 | - } |
|
71 | - |
|
72 | - $blog_obj->setVar('blog_title', Request::getString('blog_title', '', 'POST')); //$_POST['blog_title']); |
|
73 | - $blog_obj->setVar('blog_desc', Request::getString('blog_desc', '', 'POST')); //$_POST['blog_desc']); |
|
74 | - $blog_obj->setVar('blog_image', Request::getString('blog_image', '', 'POST')); //$_POST['blog_image']); |
|
75 | - $blog_obj->setVar('blog_feed', Request::getString('blog_feed', '', 'POST')); //$_POST['blog_feed']); |
|
76 | - $blog_obj->setVar('blog_link', Request::getString('blog_link', '', 'POST')); //$_POST['blog_link']); |
|
77 | - $blog_obj->setVar('blog_language', Request::getString('blog_language', '', 'POST')); //$_POST['blog_language']); |
|
78 | - $blog_obj->setVar('blog_charset', Request::getString('blog_charset', '', 'POST')); //$_POST['blog_charset']); |
|
79 | - $blog_obj->setVar('blog_trackback', Request::getString('blog_trackback', '', 'POST')); //$_POST['blog_trackback']); |
|
80 | - $blog_obj->setVar('blog_status', Request::getInt('blog_status', 0, 'POST')); //$_POST['blog_status']); |
|
81 | - |
|
82 | - if (!$blogHandler->insert($blog_obj)) { |
|
83 | - } elseif (!empty(Request::getArray('categories', array(), 'POST'))) { |
|
84 | - $blog_id = $blog_obj->getVar('blog_id'); |
|
85 | - if (in_array(0, Request::getArray('categories', array(), 'POST'))) { |
|
86 | - $_POST['categories'] = array(); |
|
87 | - } |
|
88 | - $blogHandler->setCategories($blog_id, Request::getArray('categories', array(), 'POST')); |
|
89 | - } |
|
90 | - $message = planet_constant('AM_DBUPDATED'); |
|
91 | - redirect_header('admin.blog.php', 2, $message); |
|
92 | - |
|
93 | - /* fetch and add a list of blogs to a category */ |
|
94 | - case 'add': |
|
95 | - $links = PlanetUtility::planetParseLinks(Request::getArray('links', array(), 'POST')); |
|
96 | - $blogs = array(); |
|
97 | - foreach ($links as $link) { |
|
98 | - if ($blog_exist = $blogHandler->getCount(new Criteria('blog_feed', $link['url']))) { |
|
99 | - continue; |
|
100 | - } |
|
101 | - $blog_obj = $blogHandler->fetch($link['url']); |
|
102 | - if (!empty($link['title'])) { |
|
103 | - $blog_obj->setVar('blog_title', $link['title']); |
|
104 | - } |
|
105 | - $blogHandler->insert($blog_obj); |
|
106 | - $blogs[] = $blog_obj->getVar('blog_id'); |
|
107 | - unset($blog_obj); |
|
108 | - } |
|
109 | - if (!empty(Request::getArray('categories', array(), 'POST'))) { |
|
110 | - $categoryHandler = xoops_getModuleHandler('category', $GLOBALS['moddirname']); |
|
111 | - foreach (Request::getArray('categories', array(), 'POST') as $cat_id) { |
|
112 | - $categoryHandler->addBlogs($cat_id, $blogs); |
|
113 | - } |
|
114 | - } |
|
115 | - $message = planet_constant('AM_DBUPDATED'); |
|
116 | - redirect_header('admin.blog.php', 2, $message); |
|
117 | - |
|
118 | - /* update a list of blogs */ |
|
119 | - case 'update': |
|
120 | - foreach ($blog_id as $bid) { |
|
121 | - $blog_obj = $blogHandler->fetch($bid); |
|
122 | - if (!$blogHandler->insert($blog_obj)) { |
|
123 | - } |
|
124 | - unset($blog_obj); |
|
125 | - } |
|
126 | - $message = planet_constant('AM_DBUPDATED'); |
|
127 | - redirect_header('admin.blog.php?category=' . $category_id . '&start=' . $start, 2, $message); |
|
128 | - |
|
129 | - /* add a list of blogs to a category */ |
|
130 | - case 'register': |
|
131 | - if (!empty(Request::getArray('category_dest', array(), 'POST'))) { |
|
132 | - if (!is_array($blog_id)) { |
|
133 | - $blog_id = array($blog_id); |
|
134 | - } |
|
135 | - $categoryHandler = xoops_getModuleHandler('category', $GLOBALS['moddirname']); |
|
136 | - $categoryHandler->addBlogs(Request::getArray('category_dest', array(), 'POST'), $blog_id); |
|
137 | - } |
|
138 | - $message = planet_constant('AM_DBUPDATED'); |
|
139 | - redirect_header('admin.blog.php?category=' . Request::getArray('category_dest', array(), 'POST') . '&start=' . $start, 2, $message); |
|
140 | - |
|
141 | - /* remove a list of blogs from a category */ |
|
142 | - case 'remove': |
|
143 | - if (!is_array($blog_id)) { |
|
144 | - $blog_id = array($blog_id); |
|
145 | - } |
|
146 | - if (!empty($category_id)) { |
|
147 | - $categoryHandler = xoops_getModuleHandler('category', $GLOBALS['moddirname']); |
|
148 | - $categoryHandler->removeBlogs($category_id, $blog_id); |
|
149 | - } |
|
150 | - $message = planet_constant('AM_DBUPDATED'); |
|
151 | - redirect_header('admin.blog.php?category=' . $category_id . '&start=' . $start, 2, $message); |
|
152 | - |
|
153 | - /* delete a single blog or a list blogs */ |
|
154 | - case 'del': |
|
155 | - if (!is_array($blog_id)) { |
|
156 | - $blog_id = array($blog_id); |
|
157 | - } |
|
158 | - foreach ($blog_id as $bid) { |
|
159 | - $blog_obj = $blogHandler->get($bid); |
|
160 | - if (!$blogHandler->delete($blog_obj, true)) { |
|
161 | - } |
|
162 | - unset($blog_obj); |
|
163 | - } |
|
164 | - $message = planet_constant('AM_DBUPDATED'); |
|
165 | - redirect_header('admin.blog.php?category=' . $category_id . '&start=' . $start, 2, $message); |
|
166 | - |
|
167 | - /* empty a single blog or a list blogs */ |
|
168 | - case 'empty': |
|
169 | - if (!is_array($blog_id)) { |
|
170 | - $blog_id = array($blog_id); |
|
171 | - } |
|
172 | - foreach ($blog_id as $bid) { |
|
173 | - $blog_obj = $blogHandler->get($bid); |
|
174 | - if (!$blogHandler->do_empty($blog_obj)) { |
|
175 | - } |
|
176 | - } |
|
177 | - $message = planet_constant('AM_DBUPDATED'); |
|
178 | - redirect_header('admin.blog.php?category=' . $category_id . '&start=' . $start, 2, $message); |
|
179 | - |
|
180 | - /* approve a single blog or a list blogs */ |
|
181 | - case 'approve': |
|
182 | - if (!is_array($blog_id)) { |
|
183 | - $blog_id = array($blog_id); |
|
184 | - } |
|
185 | - $criteria = new Criteria('blog_id', '(' . implode(',', $blog_id) . ')', 'IN'); |
|
186 | - $blogHandler->updateAll('blog_status', 1, $criteria, true); |
|
187 | - $message = planet_constant('AM_DBUPDATED'); |
|
188 | - redirect_header('admin.blog.php?category=' . $category_id . '&start=' . $start, 2, $message); |
|
189 | - |
|
190 | - /* mark a single blog or a list blogs as featured */ |
|
191 | - case 'feature': |
|
192 | - if (!is_array($blog_id)) { |
|
193 | - $blog_id = array($blog_id); |
|
194 | - } |
|
195 | - $criteria = new Criteria('blog_id', '(' . implode(',', $blog_id) . ')', 'IN'); |
|
196 | - $blogHandler->updateAll('blog_status', 2, $criteria, true); |
|
197 | - $message = planet_constant('AM_DBUPDATED'); |
|
198 | - redirect_header('admin.blog.php?category=' . $category_id . '&start=' . $start, 2, $message); |
|
199 | - |
|
200 | - /* edit a single blog */ |
|
201 | - case 'edit': |
|
202 | - if (!empty(Request::getString('fetch', '', 'POST'))) { |
|
203 | - $blog_obj = $blogHandler->fetch(Request::getString('blog_feed', '', 'POST')); |
|
204 | - $blog_obj->setVar('blog_id', $blog_id); |
|
205 | - } else { |
|
206 | - $blog_obj = $blogHandler->get($blog_id); |
|
207 | - } |
|
208 | - $categories = Request::getArray('categories', array(), 'POST'); |
|
209 | - if (empty($categories) && $blog_id > 0) { |
|
210 | - $crit = new Criteria('bc.blog_id', $blog_id); |
|
211 | - $categories = array_keys($categoryHandler->getByBlog($crit)); |
|
212 | - } |
|
213 | - if (empty($categories)) { |
|
214 | - $categories = array(0 => _NONE); |
|
215 | - } |
|
216 | - |
|
217 | - echo "<fieldset><legend style='font-weight: bold; color: #900;'>" . _EDIT . '</legend>'; |
|
218 | - echo '<br>'; |
|
219 | - if (empty($blog_id) && $blog_obj->getVar('blog_feed')) { |
|
220 | - $criteria = new Criteria('blog_feed', $blog_obj->getVar('blog_feed')); |
|
221 | - $blogs_obj = $blogHandler->getList($criteria); |
|
222 | - if (count($blogs_obj) > 0) { |
|
223 | - echo "<div class=\"errorMsg\">" . planet_constant('AM_BLOGEXISTS'); |
|
224 | - foreach (array_keys($blogs_obj) as $bid) { |
|
225 | - echo "<br><a href=\"" . XOOPS_URL . '/modules/' . $GLOBALS['moddirname'] . '/index.php' . URL_DELIMITER . 'b' . $bid . "\" target=\"_blank\">" . $blogs_obj[$bid] . '</a>'; |
|
226 | - } |
|
227 | - echo '</div>'; |
|
228 | - } |
|
229 | - unset($blogs_obj, $criteria); |
|
230 | - } |
|
231 | - include XOOPS_ROOT_PATH . '/modules/' . $GLOBALS['moddirname'] . '/include/form.blog.php'; |
|
232 | - echo '</fieldset>'; |
|
233 | - break; |
|
234 | - |
|
235 | - default: |
|
236 | - |
|
237 | - $crit = new Criteria('1', 1); |
|
238 | - $crit->setSort('cat_order'); |
|
239 | - $crit->setOrder('ASC'); |
|
240 | - $categories = $categoryHandler->getList($crit); |
|
241 | - |
|
242 | - // Display category option form |
|
243 | - $opform = new XoopsSimpleForm('', 'opform', 'admin.blog.php', 'get'); |
|
244 | - $op_select = new XoopsFormSelect('', 'category', $category_id); |
|
245 | - $op_select->setExtra('onchange="document.forms.opform.submit()"'); |
|
246 | - $options = array( |
|
247 | - '0' => _ALL, |
|
248 | - '-1' => planet_constant('MD_ACTIVE'), |
|
249 | - '-2' => planet_constant('MD_FEATURED'), |
|
250 | - '-3' => planet_constant('MD_PENDING') |
|
251 | - ); |
|
252 | - foreach (array_keys($categories) as $key) { |
|
253 | - $options[$key] = $categories[$key]; |
|
254 | - } |
|
255 | - $op_select->addOptionArray($options); |
|
256 | - $opform->addElement($op_select); |
|
257 | - $opform->display(); |
|
258 | - |
|
259 | - if ($category_id > 0) { |
|
260 | - $criteria = new CriteriaCompo(new Criteria('b.blog_status', 0, '>')); |
|
261 | - $criteria->add(new Criteria('bc.cat_id', $category_id)); |
|
262 | - $blog_count = $blogHandler->getCountByCategory($criteria); |
|
263 | - $criteria->setStart($start); |
|
264 | - $criteria->setLimit($xoopsModuleConfig['list_perpage']); |
|
265 | - $blog_objs = $blogHandler->getByCategory($criteria); |
|
266 | - } else { |
|
267 | - /* All active blogs */ |
|
268 | - if ($category_id == 0) { |
|
269 | - $criteria = new Criteria('1', 1); |
|
270 | - $criteria->setStart($start); |
|
271 | - $criteria->setLimit($xoopsModuleConfig['list_perpage']); |
|
272 | - /* Active blogs */ |
|
273 | - } elseif ($category_id == -1) { |
|
274 | - $criteria = new Criteria('blog_status', 1); |
|
275 | - $criteria->setStart($start); |
|
276 | - $criteria->setLimit($xoopsModuleConfig['list_perpage']); |
|
277 | - /* Featured blogs */ |
|
278 | - } elseif ($category_id == -2) { |
|
279 | - $criteria = new Criteria('blog_status', 2); |
|
280 | - $criteria->setStart($start); |
|
281 | - $criteria->setLimit($xoopsModuleConfig['list_perpage']); |
|
282 | - /* Pending blogs */ |
|
283 | - } else { |
|
284 | - $criteria = new Criteria('blog_status', 0); |
|
285 | - $criteria->setStart($start); |
|
286 | - $criteria->setLimit($xoopsModuleConfig['list_perpage']); |
|
287 | - } |
|
288 | - $blog_count = $blogHandler->getCount($criteria); |
|
289 | - $blog_objs = $blogHandler->getAll($criteria); |
|
290 | - } |
|
291 | - |
|
292 | - echo "<fieldset><legend style='font-weight: bold; color: #900;'>" . planet_constant('AM_LIST') . '</legend>'; |
|
293 | - echo "<br style=\"clear:both\">"; |
|
294 | - |
|
295 | - echo "<form name='list' id='list' method='post' action='" . xoops_getenv('PHP_SELF') . "'>"; |
|
296 | - echo "<table border='0' cellpadding='4' cellspacing='1' width='100%' class='outer'>"; |
|
297 | - echo "<tr align='center'>"; |
|
298 | - echo "<th class='bg3' width='5%'><input name='blog_check' id='blog_check' value='1' type='checkbox' onclick=\"xoopsCheckAll('list', 'blog_check');\"></td>"; |
|
299 | - echo "<th class='bg3'>" . planet_constant('AM_TITLE') . '</td>'; |
|
300 | - echo "<th class='bg3' width='5%'>" . planet_constant('AM_STATUS') . '</td>'; |
|
301 | - echo "<th class='bg3' width='40%'>" . planet_constant('AM_FEED') . '</td>'; |
|
302 | - // echo "<th class='bg3' width='5%'>" . _EDIT . "</td>"; |
|
303 | - // echo "<th class='bg3' width='5%'>" . _DELETE . "</td>"; |
|
304 | - echo "<th class='bg3' width='10%'>" . planet_constant('AM_ACTIONS') . '</td>'; |
|
305 | - echo '</tr>'; |
|
306 | - |
|
307 | - $status = array( |
|
308 | - '0' => planet_constant('MD_PENDING'), |
|
309 | - '1' => planet_constant('MD_ACTIVE'), |
|
310 | - '2' => planet_constant('MD_FEATURED') |
|
311 | - ); |
|
312 | - foreach (array_keys($blog_objs) as $bid) { |
|
313 | - echo "<tr class='odd' align='left'>"; |
|
314 | - echo "<td align='center'><input name='blog[]' value='" . $bid . "' type='checkbox'></td>"; |
|
315 | - echo "<td><a href='" . XOOPS_URL . '/modules/' . $GLOBALS['moddirname'] . '/index.php' . URL_DELIMITER . 'b' . $bid . "'>" . $blog_objs[$bid]->getVar('blog_title') . '</a></td>'; |
|
316 | - echo "<td align='center'>" . $status[$blog_objs[$bid]->getVar('blog_status')] . '</td>'; |
|
317 | - echo '<td>' . $blog_objs[$bid]->getVar('blog_feed') . '</td>'; |
|
318 | - echo "<td align='center'><a href='admin.blog.php?op=edit&blog=" . $bid . "' title='" . _EDIT . "'><img src='" . $pathIcon16 . "/edit.png '" . "alt='" . _EDIT . " title='" . _EDIT . " </a> |
|
59 | + /* save a single blog */ |
|
60 | + case 'save': |
|
61 | + |
|
62 | + if ($blog_id) { |
|
63 | + $blog_obj = $blogHandler->get($blog_id); |
|
64 | + } else { |
|
65 | + if ($blog_exists = $blogHandler->getCount(new Criteria('blog_feed', Request::getString('blog_feed', '', 'POST')))) { |
|
66 | + redirect_header('admin.blog.php', 2, planet_constant('AM_BLOGEXISTS')); |
|
67 | + } |
|
68 | + $blog_obj = $blogHandler->create(); |
|
69 | + $blog_obj->setVar('blog_submitter', $xoopsUser->getVar('uid')); |
|
70 | + } |
|
71 | + |
|
72 | + $blog_obj->setVar('blog_title', Request::getString('blog_title', '', 'POST')); //$_POST['blog_title']); |
|
73 | + $blog_obj->setVar('blog_desc', Request::getString('blog_desc', '', 'POST')); //$_POST['blog_desc']); |
|
74 | + $blog_obj->setVar('blog_image', Request::getString('blog_image', '', 'POST')); //$_POST['blog_image']); |
|
75 | + $blog_obj->setVar('blog_feed', Request::getString('blog_feed', '', 'POST')); //$_POST['blog_feed']); |
|
76 | + $blog_obj->setVar('blog_link', Request::getString('blog_link', '', 'POST')); //$_POST['blog_link']); |
|
77 | + $blog_obj->setVar('blog_language', Request::getString('blog_language', '', 'POST')); //$_POST['blog_language']); |
|
78 | + $blog_obj->setVar('blog_charset', Request::getString('blog_charset', '', 'POST')); //$_POST['blog_charset']); |
|
79 | + $blog_obj->setVar('blog_trackback', Request::getString('blog_trackback', '', 'POST')); //$_POST['blog_trackback']); |
|
80 | + $blog_obj->setVar('blog_status', Request::getInt('blog_status', 0, 'POST')); //$_POST['blog_status']); |
|
81 | + |
|
82 | + if (!$blogHandler->insert($blog_obj)) { |
|
83 | + } elseif (!empty(Request::getArray('categories', array(), 'POST'))) { |
|
84 | + $blog_id = $blog_obj->getVar('blog_id'); |
|
85 | + if (in_array(0, Request::getArray('categories', array(), 'POST'))) { |
|
86 | + $_POST['categories'] = array(); |
|
87 | + } |
|
88 | + $blogHandler->setCategories($blog_id, Request::getArray('categories', array(), 'POST')); |
|
89 | + } |
|
90 | + $message = planet_constant('AM_DBUPDATED'); |
|
91 | + redirect_header('admin.blog.php', 2, $message); |
|
92 | + |
|
93 | + /* fetch and add a list of blogs to a category */ |
|
94 | + case 'add': |
|
95 | + $links = PlanetUtility::planetParseLinks(Request::getArray('links', array(), 'POST')); |
|
96 | + $blogs = array(); |
|
97 | + foreach ($links as $link) { |
|
98 | + if ($blog_exist = $blogHandler->getCount(new Criteria('blog_feed', $link['url']))) { |
|
99 | + continue; |
|
100 | + } |
|
101 | + $blog_obj = $blogHandler->fetch($link['url']); |
|
102 | + if (!empty($link['title'])) { |
|
103 | + $blog_obj->setVar('blog_title', $link['title']); |
|
104 | + } |
|
105 | + $blogHandler->insert($blog_obj); |
|
106 | + $blogs[] = $blog_obj->getVar('blog_id'); |
|
107 | + unset($blog_obj); |
|
108 | + } |
|
109 | + if (!empty(Request::getArray('categories', array(), 'POST'))) { |
|
110 | + $categoryHandler = xoops_getModuleHandler('category', $GLOBALS['moddirname']); |
|
111 | + foreach (Request::getArray('categories', array(), 'POST') as $cat_id) { |
|
112 | + $categoryHandler->addBlogs($cat_id, $blogs); |
|
113 | + } |
|
114 | + } |
|
115 | + $message = planet_constant('AM_DBUPDATED'); |
|
116 | + redirect_header('admin.blog.php', 2, $message); |
|
117 | + |
|
118 | + /* update a list of blogs */ |
|
119 | + case 'update': |
|
120 | + foreach ($blog_id as $bid) { |
|
121 | + $blog_obj = $blogHandler->fetch($bid); |
|
122 | + if (!$blogHandler->insert($blog_obj)) { |
|
123 | + } |
|
124 | + unset($blog_obj); |
|
125 | + } |
|
126 | + $message = planet_constant('AM_DBUPDATED'); |
|
127 | + redirect_header('admin.blog.php?category=' . $category_id . '&start=' . $start, 2, $message); |
|
128 | + |
|
129 | + /* add a list of blogs to a category */ |
|
130 | + case 'register': |
|
131 | + if (!empty(Request::getArray('category_dest', array(), 'POST'))) { |
|
132 | + if (!is_array($blog_id)) { |
|
133 | + $blog_id = array($blog_id); |
|
134 | + } |
|
135 | + $categoryHandler = xoops_getModuleHandler('category', $GLOBALS['moddirname']); |
|
136 | + $categoryHandler->addBlogs(Request::getArray('category_dest', array(), 'POST'), $blog_id); |
|
137 | + } |
|
138 | + $message = planet_constant('AM_DBUPDATED'); |
|
139 | + redirect_header('admin.blog.php?category=' . Request::getArray('category_dest', array(), 'POST') . '&start=' . $start, 2, $message); |
|
140 | + |
|
141 | + /* remove a list of blogs from a category */ |
|
142 | + case 'remove': |
|
143 | + if (!is_array($blog_id)) { |
|
144 | + $blog_id = array($blog_id); |
|
145 | + } |
|
146 | + if (!empty($category_id)) { |
|
147 | + $categoryHandler = xoops_getModuleHandler('category', $GLOBALS['moddirname']); |
|
148 | + $categoryHandler->removeBlogs($category_id, $blog_id); |
|
149 | + } |
|
150 | + $message = planet_constant('AM_DBUPDATED'); |
|
151 | + redirect_header('admin.blog.php?category=' . $category_id . '&start=' . $start, 2, $message); |
|
152 | + |
|
153 | + /* delete a single blog or a list blogs */ |
|
154 | + case 'del': |
|
155 | + if (!is_array($blog_id)) { |
|
156 | + $blog_id = array($blog_id); |
|
157 | + } |
|
158 | + foreach ($blog_id as $bid) { |
|
159 | + $blog_obj = $blogHandler->get($bid); |
|
160 | + if (!$blogHandler->delete($blog_obj, true)) { |
|
161 | + } |
|
162 | + unset($blog_obj); |
|
163 | + } |
|
164 | + $message = planet_constant('AM_DBUPDATED'); |
|
165 | + redirect_header('admin.blog.php?category=' . $category_id . '&start=' . $start, 2, $message); |
|
166 | + |
|
167 | + /* empty a single blog or a list blogs */ |
|
168 | + case 'empty': |
|
169 | + if (!is_array($blog_id)) { |
|
170 | + $blog_id = array($blog_id); |
|
171 | + } |
|
172 | + foreach ($blog_id as $bid) { |
|
173 | + $blog_obj = $blogHandler->get($bid); |
|
174 | + if (!$blogHandler->do_empty($blog_obj)) { |
|
175 | + } |
|
176 | + } |
|
177 | + $message = planet_constant('AM_DBUPDATED'); |
|
178 | + redirect_header('admin.blog.php?category=' . $category_id . '&start=' . $start, 2, $message); |
|
179 | + |
|
180 | + /* approve a single blog or a list blogs */ |
|
181 | + case 'approve': |
|
182 | + if (!is_array($blog_id)) { |
|
183 | + $blog_id = array($blog_id); |
|
184 | + } |
|
185 | + $criteria = new Criteria('blog_id', '(' . implode(',', $blog_id) . ')', 'IN'); |
|
186 | + $blogHandler->updateAll('blog_status', 1, $criteria, true); |
|
187 | + $message = planet_constant('AM_DBUPDATED'); |
|
188 | + redirect_header('admin.blog.php?category=' . $category_id . '&start=' . $start, 2, $message); |
|
189 | + |
|
190 | + /* mark a single blog or a list blogs as featured */ |
|
191 | + case 'feature': |
|
192 | + if (!is_array($blog_id)) { |
|
193 | + $blog_id = array($blog_id); |
|
194 | + } |
|
195 | + $criteria = new Criteria('blog_id', '(' . implode(',', $blog_id) . ')', 'IN'); |
|
196 | + $blogHandler->updateAll('blog_status', 2, $criteria, true); |
|
197 | + $message = planet_constant('AM_DBUPDATED'); |
|
198 | + redirect_header('admin.blog.php?category=' . $category_id . '&start=' . $start, 2, $message); |
|
199 | + |
|
200 | + /* edit a single blog */ |
|
201 | + case 'edit': |
|
202 | + if (!empty(Request::getString('fetch', '', 'POST'))) { |
|
203 | + $blog_obj = $blogHandler->fetch(Request::getString('blog_feed', '', 'POST')); |
|
204 | + $blog_obj->setVar('blog_id', $blog_id); |
|
205 | + } else { |
|
206 | + $blog_obj = $blogHandler->get($blog_id); |
|
207 | + } |
|
208 | + $categories = Request::getArray('categories', array(), 'POST'); |
|
209 | + if (empty($categories) && $blog_id > 0) { |
|
210 | + $crit = new Criteria('bc.blog_id', $blog_id); |
|
211 | + $categories = array_keys($categoryHandler->getByBlog($crit)); |
|
212 | + } |
|
213 | + if (empty($categories)) { |
|
214 | + $categories = array(0 => _NONE); |
|
215 | + } |
|
216 | + |
|
217 | + echo "<fieldset><legend style='font-weight: bold; color: #900;'>" . _EDIT . '</legend>'; |
|
218 | + echo '<br>'; |
|
219 | + if (empty($blog_id) && $blog_obj->getVar('blog_feed')) { |
|
220 | + $criteria = new Criteria('blog_feed', $blog_obj->getVar('blog_feed')); |
|
221 | + $blogs_obj = $blogHandler->getList($criteria); |
|
222 | + if (count($blogs_obj) > 0) { |
|
223 | + echo "<div class=\"errorMsg\">" . planet_constant('AM_BLOGEXISTS'); |
|
224 | + foreach (array_keys($blogs_obj) as $bid) { |
|
225 | + echo "<br><a href=\"" . XOOPS_URL . '/modules/' . $GLOBALS['moddirname'] . '/index.php' . URL_DELIMITER . 'b' . $bid . "\" target=\"_blank\">" . $blogs_obj[$bid] . '</a>'; |
|
226 | + } |
|
227 | + echo '</div>'; |
|
228 | + } |
|
229 | + unset($blogs_obj, $criteria); |
|
230 | + } |
|
231 | + include XOOPS_ROOT_PATH . '/modules/' . $GLOBALS['moddirname'] . '/include/form.blog.php'; |
|
232 | + echo '</fieldset>'; |
|
233 | + break; |
|
234 | + |
|
235 | + default: |
|
236 | + |
|
237 | + $crit = new Criteria('1', 1); |
|
238 | + $crit->setSort('cat_order'); |
|
239 | + $crit->setOrder('ASC'); |
|
240 | + $categories = $categoryHandler->getList($crit); |
|
241 | + |
|
242 | + // Display category option form |
|
243 | + $opform = new XoopsSimpleForm('', 'opform', 'admin.blog.php', 'get'); |
|
244 | + $op_select = new XoopsFormSelect('', 'category', $category_id); |
|
245 | + $op_select->setExtra('onchange="document.forms.opform.submit()"'); |
|
246 | + $options = array( |
|
247 | + '0' => _ALL, |
|
248 | + '-1' => planet_constant('MD_ACTIVE'), |
|
249 | + '-2' => planet_constant('MD_FEATURED'), |
|
250 | + '-3' => planet_constant('MD_PENDING') |
|
251 | + ); |
|
252 | + foreach (array_keys($categories) as $key) { |
|
253 | + $options[$key] = $categories[$key]; |
|
254 | + } |
|
255 | + $op_select->addOptionArray($options); |
|
256 | + $opform->addElement($op_select); |
|
257 | + $opform->display(); |
|
258 | + |
|
259 | + if ($category_id > 0) { |
|
260 | + $criteria = new CriteriaCompo(new Criteria('b.blog_status', 0, '>')); |
|
261 | + $criteria->add(new Criteria('bc.cat_id', $category_id)); |
|
262 | + $blog_count = $blogHandler->getCountByCategory($criteria); |
|
263 | + $criteria->setStart($start); |
|
264 | + $criteria->setLimit($xoopsModuleConfig['list_perpage']); |
|
265 | + $blog_objs = $blogHandler->getByCategory($criteria); |
|
266 | + } else { |
|
267 | + /* All active blogs */ |
|
268 | + if ($category_id == 0) { |
|
269 | + $criteria = new Criteria('1', 1); |
|
270 | + $criteria->setStart($start); |
|
271 | + $criteria->setLimit($xoopsModuleConfig['list_perpage']); |
|
272 | + /* Active blogs */ |
|
273 | + } elseif ($category_id == -1) { |
|
274 | + $criteria = new Criteria('blog_status', 1); |
|
275 | + $criteria->setStart($start); |
|
276 | + $criteria->setLimit($xoopsModuleConfig['list_perpage']); |
|
277 | + /* Featured blogs */ |
|
278 | + } elseif ($category_id == -2) { |
|
279 | + $criteria = new Criteria('blog_status', 2); |
|
280 | + $criteria->setStart($start); |
|
281 | + $criteria->setLimit($xoopsModuleConfig['list_perpage']); |
|
282 | + /* Pending blogs */ |
|
283 | + } else { |
|
284 | + $criteria = new Criteria('blog_status', 0); |
|
285 | + $criteria->setStart($start); |
|
286 | + $criteria->setLimit($xoopsModuleConfig['list_perpage']); |
|
287 | + } |
|
288 | + $blog_count = $blogHandler->getCount($criteria); |
|
289 | + $blog_objs = $blogHandler->getAll($criteria); |
|
290 | + } |
|
291 | + |
|
292 | + echo "<fieldset><legend style='font-weight: bold; color: #900;'>" . planet_constant('AM_LIST') . '</legend>'; |
|
293 | + echo "<br style=\"clear:both\">"; |
|
294 | + |
|
295 | + echo "<form name='list' id='list' method='post' action='" . xoops_getenv('PHP_SELF') . "'>"; |
|
296 | + echo "<table border='0' cellpadding='4' cellspacing='1' width='100%' class='outer'>"; |
|
297 | + echo "<tr align='center'>"; |
|
298 | + echo "<th class='bg3' width='5%'><input name='blog_check' id='blog_check' value='1' type='checkbox' onclick=\"xoopsCheckAll('list', 'blog_check');\"></td>"; |
|
299 | + echo "<th class='bg3'>" . planet_constant('AM_TITLE') . '</td>'; |
|
300 | + echo "<th class='bg3' width='5%'>" . planet_constant('AM_STATUS') . '</td>'; |
|
301 | + echo "<th class='bg3' width='40%'>" . planet_constant('AM_FEED') . '</td>'; |
|
302 | + // echo "<th class='bg3' width='5%'>" . _EDIT . "</td>"; |
|
303 | + // echo "<th class='bg3' width='5%'>" . _DELETE . "</td>"; |
|
304 | + echo "<th class='bg3' width='10%'>" . planet_constant('AM_ACTIONS') . '</td>'; |
|
305 | + echo '</tr>'; |
|
306 | + |
|
307 | + $status = array( |
|
308 | + '0' => planet_constant('MD_PENDING'), |
|
309 | + '1' => planet_constant('MD_ACTIVE'), |
|
310 | + '2' => planet_constant('MD_FEATURED') |
|
311 | + ); |
|
312 | + foreach (array_keys($blog_objs) as $bid) { |
|
313 | + echo "<tr class='odd' align='left'>"; |
|
314 | + echo "<td align='center'><input name='blog[]' value='" . $bid . "' type='checkbox'></td>"; |
|
315 | + echo "<td><a href='" . XOOPS_URL . '/modules/' . $GLOBALS['moddirname'] . '/index.php' . URL_DELIMITER . 'b' . $bid . "'>" . $blog_objs[$bid]->getVar('blog_title') . '</a></td>'; |
|
316 | + echo "<td align='center'>" . $status[$blog_objs[$bid]->getVar('blog_status')] . '</td>'; |
|
317 | + echo '<td>' . $blog_objs[$bid]->getVar('blog_feed') . '</td>'; |
|
318 | + echo "<td align='center'><a href='admin.blog.php?op=edit&blog=" . $bid . "' title='" . _EDIT . "'><img src='" . $pathIcon16 . "/edit.png '" . "alt='" . _EDIT . " title='" . _EDIT . " </a> |
|
319 | 319 | <a href='admin.blog.php?op=del&blog=" . $bid . "' title='" . _DELETE . "'><img src='" . $pathIcon16 . "/delete.png '" . " alt='" . _EDIT . " title='" . _DELETE . " </a> |
320 | 320 | <a href='admin.blog.php?op=empty&blog=" . $bid . "' title='" . planet_constant('MD_EMPTY_BLOG') . "'><img src='" . $pathIcon16 . "/empty.png '" . " alt='" . _EDIT . " title='" . planet_constant('MD_EMPTY_BLOG') . '</a></td>'; |
321 | 321 | |
322 | - echo '</tr>'; |
|
323 | - } |
|
324 | - echo "<tr class='even' align='center'>"; |
|
325 | - echo "<td colspan='7'>"; |
|
326 | - echo "<select name='op' onChange='if (this.options[this.selectedIndex].value==\"register\") {setVisible(\"catdiv\");} else {setHidden(\"catdiv\");}'>"; |
|
327 | - echo "<option value=''>" . _SELECT . '</option>'; |
|
328 | - echo "<option value='del'>" . _DELETE . '</option>'; |
|
329 | - echo "<option value='empty'>" . planet_constant('MD_EMPTY_BLOG') . '</option>'; |
|
330 | - echo "<option value='register'>" . planet_constant('AM_REGISTER') . '</option>'; |
|
331 | - if ($category_id > 0) { |
|
332 | - echo "<option value='remove'>" . planet_constant('AM_REMOVE') . '</option>'; |
|
333 | - } |
|
334 | - echo "<option value='approve'>" . planet_constant('AM_APPROVE') . '</option>'; |
|
335 | - echo "<option value='feature'>" . planet_constant('AM_FEATURE') . '</option>'; |
|
336 | - echo "<option value='update'>" . planet_constant('AM_UPDATE') . '</option>'; |
|
337 | - |
|
338 | - echo "<option value='pending'>" . planet_constant('AM_PENDING') . '</option>'; |
|
339 | - echo "<option value='active'>" . planet_constant('AM_ACTIVE') . '</option>'; |
|
340 | - |
|
341 | - echo '</select>'; |
|
342 | - echo "<div id='catdiv' style='visibility:hidden;display:inline;'>"; |
|
343 | - echo "<select name='category_dest'>"; |
|
344 | - echo "<option value=''>" . _SELECT . '</option>'; |
|
345 | - foreach ($categories as $cid => $name) { |
|
346 | - echo "<option value='" . $cid . "'>" . $name . '</option>'; |
|
347 | - } |
|
348 | - echo '</select>'; |
|
349 | - echo '</div>'; |
|
350 | - echo "<input name='start' value='" . $start . "' type='hidden'>"; |
|
351 | - echo "<input name='category' value='" . $category_id . "' type='hidden'>"; |
|
352 | - echo "<input name='submit' value='" . _SUBMIT . "' type='submit'>"; |
|
353 | - echo "<input name='' value='" . _CANCEL . "' type='reset'>"; |
|
354 | - echo '</td>'; |
|
355 | - echo '</tr>'; |
|
356 | - if ($blog_count > $xoopsModuleConfig['list_perpage']) { |
|
357 | - include XOOPS_ROOT_PATH . '/class/pagenav.php'; |
|
358 | - $nav = new XoopsPageNav($blog_count, $xoopsModuleConfig['list_perpage'], $start, 'start', 'category=' . $category_id); |
|
359 | - $pagenav = $nav->renderNav(4); |
|
360 | - echo "<tr align='right'><td colspan='6'>" . $pagenav . '</td></tr>'; |
|
361 | - } |
|
362 | - echo '</table></form>'; |
|
363 | - echo "</fieldset><br style='clear:both;'>"; |
|
364 | - |
|
365 | - if (empty($start) && empty($category_id)) { |
|
366 | - $form = new XoopsThemeForm(_ADD, 'edit', xoops_getenv('PHP_SELF'), 'post', true); |
|
367 | - $form->addElement(new XoopsFormText(planet_constant('AM_FEED'), 'blog_feed', 50, 255), true); |
|
368 | - $form->addElement(new XoopsFormHidden('op', 'edit')); |
|
369 | - $button_tray = new XoopsFormElementTray('', ''); |
|
370 | - $butt_save = new XoopsFormButton('', 'fetch', _SUBMIT, 'submit'); |
|
371 | - $button_tray->addElement($butt_save); |
|
372 | - $butt_cancel = new XoopsFormButton('', '', _CANCEL, 'reset'); |
|
373 | - $button_tray->addElement($butt_cancel); |
|
374 | - $form->addElement($button_tray); |
|
375 | - |
|
376 | - $form_add = new XoopsThemeForm(_ADD, 'add', xoops_getenv('PHP_SELF'), 'post', true); |
|
377 | - $form_add->addElement(new XoopsFormTextArea(planet_constant('AM_FEED'), 'links')); |
|
378 | - $form_add->addElement(new XoopsFormHidden('op', 'add')); |
|
379 | - $button_tray = new XoopsFormElementTray('', ''); |
|
380 | - $butt_save = new XoopsFormButton('', 'submit', _SUBMIT, 'submit'); |
|
381 | - $button_tray->addElement($butt_save); |
|
382 | - $butt_cancel = new XoopsFormButton('', '', _CANCEL, 'reset'); |
|
383 | - $button_tray->addElement($butt_cancel); |
|
384 | - $form_add->addElement($button_tray); |
|
385 | - |
|
386 | - echo "<fieldset><legend style='font-weight: bold; color: #900;'>" . _ADD . '</legend>'; |
|
387 | - echo '<br>'; |
|
388 | - $form->display(); |
|
389 | - $form_add->display(); |
|
390 | - echo '</fieldset>'; |
|
391 | - } |
|
392 | - break; |
|
322 | + echo '</tr>'; |
|
323 | + } |
|
324 | + echo "<tr class='even' align='center'>"; |
|
325 | + echo "<td colspan='7'>"; |
|
326 | + echo "<select name='op' onChange='if (this.options[this.selectedIndex].value==\"register\") {setVisible(\"catdiv\");} else {setHidden(\"catdiv\");}'>"; |
|
327 | + echo "<option value=''>" . _SELECT . '</option>'; |
|
328 | + echo "<option value='del'>" . _DELETE . '</option>'; |
|
329 | + echo "<option value='empty'>" . planet_constant('MD_EMPTY_BLOG') . '</option>'; |
|
330 | + echo "<option value='register'>" . planet_constant('AM_REGISTER') . '</option>'; |
|
331 | + if ($category_id > 0) { |
|
332 | + echo "<option value='remove'>" . planet_constant('AM_REMOVE') . '</option>'; |
|
333 | + } |
|
334 | + echo "<option value='approve'>" . planet_constant('AM_APPROVE') . '</option>'; |
|
335 | + echo "<option value='feature'>" . planet_constant('AM_FEATURE') . '</option>'; |
|
336 | + echo "<option value='update'>" . planet_constant('AM_UPDATE') . '</option>'; |
|
337 | + |
|
338 | + echo "<option value='pending'>" . planet_constant('AM_PENDING') . '</option>'; |
|
339 | + echo "<option value='active'>" . planet_constant('AM_ACTIVE') . '</option>'; |
|
340 | + |
|
341 | + echo '</select>'; |
|
342 | + echo "<div id='catdiv' style='visibility:hidden;display:inline;'>"; |
|
343 | + echo "<select name='category_dest'>"; |
|
344 | + echo "<option value=''>" . _SELECT . '</option>'; |
|
345 | + foreach ($categories as $cid => $name) { |
|
346 | + echo "<option value='" . $cid . "'>" . $name . '</option>'; |
|
347 | + } |
|
348 | + echo '</select>'; |
|
349 | + echo '</div>'; |
|
350 | + echo "<input name='start' value='" . $start . "' type='hidden'>"; |
|
351 | + echo "<input name='category' value='" . $category_id . "' type='hidden'>"; |
|
352 | + echo "<input name='submit' value='" . _SUBMIT . "' type='submit'>"; |
|
353 | + echo "<input name='' value='" . _CANCEL . "' type='reset'>"; |
|
354 | + echo '</td>'; |
|
355 | + echo '</tr>'; |
|
356 | + if ($blog_count > $xoopsModuleConfig['list_perpage']) { |
|
357 | + include XOOPS_ROOT_PATH . '/class/pagenav.php'; |
|
358 | + $nav = new XoopsPageNav($blog_count, $xoopsModuleConfig['list_perpage'], $start, 'start', 'category=' . $category_id); |
|
359 | + $pagenav = $nav->renderNav(4); |
|
360 | + echo "<tr align='right'><td colspan='6'>" . $pagenav . '</td></tr>'; |
|
361 | + } |
|
362 | + echo '</table></form>'; |
|
363 | + echo "</fieldset><br style='clear:both;'>"; |
|
364 | + |
|
365 | + if (empty($start) && empty($category_id)) { |
|
366 | + $form = new XoopsThemeForm(_ADD, 'edit', xoops_getenv('PHP_SELF'), 'post', true); |
|
367 | + $form->addElement(new XoopsFormText(planet_constant('AM_FEED'), 'blog_feed', 50, 255), true); |
|
368 | + $form->addElement(new XoopsFormHidden('op', 'edit')); |
|
369 | + $button_tray = new XoopsFormElementTray('', ''); |
|
370 | + $butt_save = new XoopsFormButton('', 'fetch', _SUBMIT, 'submit'); |
|
371 | + $button_tray->addElement($butt_save); |
|
372 | + $butt_cancel = new XoopsFormButton('', '', _CANCEL, 'reset'); |
|
373 | + $button_tray->addElement($butt_cancel); |
|
374 | + $form->addElement($button_tray); |
|
375 | + |
|
376 | + $form_add = new XoopsThemeForm(_ADD, 'add', xoops_getenv('PHP_SELF'), 'post', true); |
|
377 | + $form_add->addElement(new XoopsFormTextArea(planet_constant('AM_FEED'), 'links')); |
|
378 | + $form_add->addElement(new XoopsFormHidden('op', 'add')); |
|
379 | + $button_tray = new XoopsFormElementTray('', ''); |
|
380 | + $butt_save = new XoopsFormButton('', 'submit', _SUBMIT, 'submit'); |
|
381 | + $button_tray->addElement($butt_save); |
|
382 | + $butt_cancel = new XoopsFormButton('', '', _CANCEL, 'reset'); |
|
383 | + $button_tray->addElement($butt_cancel); |
|
384 | + $form_add->addElement($button_tray); |
|
385 | + |
|
386 | + echo "<fieldset><legend style='font-weight: bold; color: #900;'>" . _ADD . '</legend>'; |
|
387 | + echo '<br>'; |
|
388 | + $form->display(); |
|
389 | + $form_add->display(); |
|
390 | + echo '</fieldset>'; |
|
391 | + } |
|
392 | + break; |
|
393 | 393 | } |
394 | 394 | |
395 | 395 | xoops_cp_footer(); |
@@ -57,339 +57,339 @@ |
||
57 | 57 | |
58 | 58 | switch ($op) { |
59 | 59 | /* save a single blog */ |
60 | - case 'save': |
|
61 | - |
|
62 | - if ($blog_id) { |
|
63 | - $blog_obj = $blogHandler->get($blog_id); |
|
64 | - } else { |
|
65 | - if ($blog_exists = $blogHandler->getCount(new Criteria('blog_feed', Request::getString('blog_feed', '', 'POST')))) { |
|
66 | - redirect_header('admin.blog.php', 2, planet_constant('AM_BLOGEXISTS')); |
|
67 | - } |
|
68 | - $blog_obj = $blogHandler->create(); |
|
69 | - $blog_obj->setVar('blog_submitter', $xoopsUser->getVar('uid')); |
|
70 | - } |
|
71 | - |
|
72 | - $blog_obj->setVar('blog_title', Request::getString('blog_title', '', 'POST')); //$_POST['blog_title']); |
|
73 | - $blog_obj->setVar('blog_desc', Request::getString('blog_desc', '', 'POST')); //$_POST['blog_desc']); |
|
74 | - $blog_obj->setVar('blog_image', Request::getString('blog_image', '', 'POST')); //$_POST['blog_image']); |
|
75 | - $blog_obj->setVar('blog_feed', Request::getString('blog_feed', '', 'POST')); //$_POST['blog_feed']); |
|
76 | - $blog_obj->setVar('blog_link', Request::getString('blog_link', '', 'POST')); //$_POST['blog_link']); |
|
77 | - $blog_obj->setVar('blog_language', Request::getString('blog_language', '', 'POST')); //$_POST['blog_language']); |
|
78 | - $blog_obj->setVar('blog_charset', Request::getString('blog_charset', '', 'POST')); //$_POST['blog_charset']); |
|
79 | - $blog_obj->setVar('blog_trackback', Request::getString('blog_trackback', '', 'POST')); //$_POST['blog_trackback']); |
|
80 | - $blog_obj->setVar('blog_status', Request::getInt('blog_status', 0, 'POST')); //$_POST['blog_status']); |
|
81 | - |
|
82 | - if (!$blogHandler->insert($blog_obj)) { |
|
83 | - } elseif (!empty(Request::getArray('categories', array(), 'POST'))) { |
|
84 | - $blog_id = $blog_obj->getVar('blog_id'); |
|
85 | - if (in_array(0, Request::getArray('categories', array(), 'POST'))) { |
|
86 | - $_POST['categories'] = array(); |
|
87 | - } |
|
88 | - $blogHandler->setCategories($blog_id, Request::getArray('categories', array(), 'POST')); |
|
89 | - } |
|
90 | - $message = planet_constant('AM_DBUPDATED'); |
|
91 | - redirect_header('admin.blog.php', 2, $message); |
|
92 | - |
|
93 | - /* fetch and add a list of blogs to a category */ |
|
94 | - case 'add': |
|
95 | - $links = PlanetUtility::planetParseLinks(Request::getArray('links', array(), 'POST')); |
|
96 | - $blogs = array(); |
|
97 | - foreach ($links as $link) { |
|
98 | - if ($blog_exist = $blogHandler->getCount(new Criteria('blog_feed', $link['url']))) { |
|
99 | - continue; |
|
100 | - } |
|
101 | - $blog_obj = $blogHandler->fetch($link['url']); |
|
102 | - if (!empty($link['title'])) { |
|
103 | - $blog_obj->setVar('blog_title', $link['title']); |
|
104 | - } |
|
105 | - $blogHandler->insert($blog_obj); |
|
106 | - $blogs[] = $blog_obj->getVar('blog_id'); |
|
107 | - unset($blog_obj); |
|
108 | - } |
|
109 | - if (!empty(Request::getArray('categories', array(), 'POST'))) { |
|
110 | - $categoryHandler = xoops_getModuleHandler('category', $GLOBALS['moddirname']); |
|
111 | - foreach (Request::getArray('categories', array(), 'POST') as $cat_id) { |
|
112 | - $categoryHandler->addBlogs($cat_id, $blogs); |
|
113 | - } |
|
114 | - } |
|
115 | - $message = planet_constant('AM_DBUPDATED'); |
|
116 | - redirect_header('admin.blog.php', 2, $message); |
|
117 | - |
|
118 | - /* update a list of blogs */ |
|
119 | - case 'update': |
|
120 | - foreach ($blog_id as $bid) { |
|
121 | - $blog_obj = $blogHandler->fetch($bid); |
|
122 | - if (!$blogHandler->insert($blog_obj)) { |
|
123 | - } |
|
124 | - unset($blog_obj); |
|
125 | - } |
|
126 | - $message = planet_constant('AM_DBUPDATED'); |
|
127 | - redirect_header('admin.blog.php?category=' . $category_id . '&start=' . $start, 2, $message); |
|
128 | - |
|
129 | - /* add a list of blogs to a category */ |
|
130 | - case 'register': |
|
131 | - if (!empty(Request::getArray('category_dest', array(), 'POST'))) { |
|
132 | - if (!is_array($blog_id)) { |
|
133 | - $blog_id = array($blog_id); |
|
134 | - } |
|
135 | - $categoryHandler = xoops_getModuleHandler('category', $GLOBALS['moddirname']); |
|
136 | - $categoryHandler->addBlogs(Request::getArray('category_dest', array(), 'POST'), $blog_id); |
|
137 | - } |
|
138 | - $message = planet_constant('AM_DBUPDATED'); |
|
139 | - redirect_header('admin.blog.php?category=' . Request::getArray('category_dest', array(), 'POST') . '&start=' . $start, 2, $message); |
|
140 | - |
|
141 | - /* remove a list of blogs from a category */ |
|
142 | - case 'remove': |
|
143 | - if (!is_array($blog_id)) { |
|
144 | - $blog_id = array($blog_id); |
|
145 | - } |
|
146 | - if (!empty($category_id)) { |
|
147 | - $categoryHandler = xoops_getModuleHandler('category', $GLOBALS['moddirname']); |
|
148 | - $categoryHandler->removeBlogs($category_id, $blog_id); |
|
149 | - } |
|
150 | - $message = planet_constant('AM_DBUPDATED'); |
|
151 | - redirect_header('admin.blog.php?category=' . $category_id . '&start=' . $start, 2, $message); |
|
152 | - |
|
153 | - /* delete a single blog or a list blogs */ |
|
154 | - case 'del': |
|
155 | - if (!is_array($blog_id)) { |
|
156 | - $blog_id = array($blog_id); |
|
157 | - } |
|
158 | - foreach ($blog_id as $bid) { |
|
159 | - $blog_obj = $blogHandler->get($bid); |
|
160 | - if (!$blogHandler->delete($blog_obj, true)) { |
|
161 | - } |
|
162 | - unset($blog_obj); |
|
163 | - } |
|
164 | - $message = planet_constant('AM_DBUPDATED'); |
|
165 | - redirect_header('admin.blog.php?category=' . $category_id . '&start=' . $start, 2, $message); |
|
166 | - |
|
167 | - /* empty a single blog or a list blogs */ |
|
168 | - case 'empty': |
|
169 | - if (!is_array($blog_id)) { |
|
170 | - $blog_id = array($blog_id); |
|
171 | - } |
|
172 | - foreach ($blog_id as $bid) { |
|
173 | - $blog_obj = $blogHandler->get($bid); |
|
174 | - if (!$blogHandler->do_empty($blog_obj)) { |
|
175 | - } |
|
176 | - } |
|
177 | - $message = planet_constant('AM_DBUPDATED'); |
|
178 | - redirect_header('admin.blog.php?category=' . $category_id . '&start=' . $start, 2, $message); |
|
179 | - |
|
180 | - /* approve a single blog or a list blogs */ |
|
181 | - case 'approve': |
|
182 | - if (!is_array($blog_id)) { |
|
183 | - $blog_id = array($blog_id); |
|
184 | - } |
|
185 | - $criteria = new Criteria('blog_id', '(' . implode(',', $blog_id) . ')', 'IN'); |
|
186 | - $blogHandler->updateAll('blog_status', 1, $criteria, true); |
|
187 | - $message = planet_constant('AM_DBUPDATED'); |
|
188 | - redirect_header('admin.blog.php?category=' . $category_id . '&start=' . $start, 2, $message); |
|
189 | - |
|
190 | - /* mark a single blog or a list blogs as featured */ |
|
191 | - case 'feature': |
|
192 | - if (!is_array($blog_id)) { |
|
193 | - $blog_id = array($blog_id); |
|
194 | - } |
|
195 | - $criteria = new Criteria('blog_id', '(' . implode(',', $blog_id) . ')', 'IN'); |
|
196 | - $blogHandler->updateAll('blog_status', 2, $criteria, true); |
|
197 | - $message = planet_constant('AM_DBUPDATED'); |
|
198 | - redirect_header('admin.blog.php?category=' . $category_id . '&start=' . $start, 2, $message); |
|
199 | - |
|
200 | - /* edit a single blog */ |
|
201 | - case 'edit': |
|
202 | - if (!empty(Request::getString('fetch', '', 'POST'))) { |
|
203 | - $blog_obj = $blogHandler->fetch(Request::getString('blog_feed', '', 'POST')); |
|
204 | - $blog_obj->setVar('blog_id', $blog_id); |
|
205 | - } else { |
|
206 | - $blog_obj = $blogHandler->get($blog_id); |
|
207 | - } |
|
208 | - $categories = Request::getArray('categories', array(), 'POST'); |
|
209 | - if (empty($categories) && $blog_id > 0) { |
|
210 | - $crit = new Criteria('bc.blog_id', $blog_id); |
|
211 | - $categories = array_keys($categoryHandler->getByBlog($crit)); |
|
212 | - } |
|
213 | - if (empty($categories)) { |
|
214 | - $categories = array(0 => _NONE); |
|
215 | - } |
|
216 | - |
|
217 | - echo "<fieldset><legend style='font-weight: bold; color: #900;'>" . _EDIT . '</legend>'; |
|
218 | - echo '<br>'; |
|
219 | - if (empty($blog_id) && $blog_obj->getVar('blog_feed')) { |
|
220 | - $criteria = new Criteria('blog_feed', $blog_obj->getVar('blog_feed')); |
|
221 | - $blogs_obj = $blogHandler->getList($criteria); |
|
222 | - if (count($blogs_obj) > 0) { |
|
223 | - echo "<div class=\"errorMsg\">" . planet_constant('AM_BLOGEXISTS'); |
|
224 | - foreach (array_keys($blogs_obj) as $bid) { |
|
225 | - echo "<br><a href=\"" . XOOPS_URL . '/modules/' . $GLOBALS['moddirname'] . '/index.php' . URL_DELIMITER . 'b' . $bid . "\" target=\"_blank\">" . $blogs_obj[$bid] . '</a>'; |
|
226 | - } |
|
227 | - echo '</div>'; |
|
228 | - } |
|
229 | - unset($blogs_obj, $criteria); |
|
230 | - } |
|
231 | - include XOOPS_ROOT_PATH . '/modules/' . $GLOBALS['moddirname'] . '/include/form.blog.php'; |
|
232 | - echo '</fieldset>'; |
|
233 | - break; |
|
234 | - |
|
235 | - default: |
|
236 | - |
|
237 | - $crit = new Criteria('1', 1); |
|
238 | - $crit->setSort('cat_order'); |
|
239 | - $crit->setOrder('ASC'); |
|
240 | - $categories = $categoryHandler->getList($crit); |
|
241 | - |
|
242 | - // Display category option form |
|
243 | - $opform = new XoopsSimpleForm('', 'opform', 'admin.blog.php', 'get'); |
|
244 | - $op_select = new XoopsFormSelect('', 'category', $category_id); |
|
245 | - $op_select->setExtra('onchange="document.forms.opform.submit()"'); |
|
246 | - $options = array( |
|
247 | - '0' => _ALL, |
|
248 | - '-1' => planet_constant('MD_ACTIVE'), |
|
249 | - '-2' => planet_constant('MD_FEATURED'), |
|
250 | - '-3' => planet_constant('MD_PENDING') |
|
251 | - ); |
|
252 | - foreach (array_keys($categories) as $key) { |
|
253 | - $options[$key] = $categories[$key]; |
|
254 | - } |
|
255 | - $op_select->addOptionArray($options); |
|
256 | - $opform->addElement($op_select); |
|
257 | - $opform->display(); |
|
258 | - |
|
259 | - if ($category_id > 0) { |
|
260 | - $criteria = new CriteriaCompo(new Criteria('b.blog_status', 0, '>')); |
|
261 | - $criteria->add(new Criteria('bc.cat_id', $category_id)); |
|
262 | - $blog_count = $blogHandler->getCountByCategory($criteria); |
|
263 | - $criteria->setStart($start); |
|
264 | - $criteria->setLimit($xoopsModuleConfig['list_perpage']); |
|
265 | - $blog_objs = $blogHandler->getByCategory($criteria); |
|
266 | - } else { |
|
267 | - /* All active blogs */ |
|
268 | - if ($category_id == 0) { |
|
269 | - $criteria = new Criteria('1', 1); |
|
270 | - $criteria->setStart($start); |
|
271 | - $criteria->setLimit($xoopsModuleConfig['list_perpage']); |
|
272 | - /* Active blogs */ |
|
273 | - } elseif ($category_id == -1) { |
|
274 | - $criteria = new Criteria('blog_status', 1); |
|
275 | - $criteria->setStart($start); |
|
276 | - $criteria->setLimit($xoopsModuleConfig['list_perpage']); |
|
277 | - /* Featured blogs */ |
|
278 | - } elseif ($category_id == -2) { |
|
279 | - $criteria = new Criteria('blog_status', 2); |
|
280 | - $criteria->setStart($start); |
|
281 | - $criteria->setLimit($xoopsModuleConfig['list_perpage']); |
|
282 | - /* Pending blogs */ |
|
283 | - } else { |
|
284 | - $criteria = new Criteria('blog_status', 0); |
|
285 | - $criteria->setStart($start); |
|
286 | - $criteria->setLimit($xoopsModuleConfig['list_perpage']); |
|
287 | - } |
|
288 | - $blog_count = $blogHandler->getCount($criteria); |
|
289 | - $blog_objs = $blogHandler->getAll($criteria); |
|
290 | - } |
|
291 | - |
|
292 | - echo "<fieldset><legend style='font-weight: bold; color: #900;'>" . planet_constant('AM_LIST') . '</legend>'; |
|
293 | - echo "<br style=\"clear:both\">"; |
|
294 | - |
|
295 | - echo "<form name='list' id='list' method='post' action='" . xoops_getenv('PHP_SELF') . "'>"; |
|
296 | - echo "<table border='0' cellpadding='4' cellspacing='1' width='100%' class='outer'>"; |
|
297 | - echo "<tr align='center'>"; |
|
298 | - echo "<th class='bg3' width='5%'><input name='blog_check' id='blog_check' value='1' type='checkbox' onclick=\"xoopsCheckAll('list', 'blog_check');\"></td>"; |
|
299 | - echo "<th class='bg3'>" . planet_constant('AM_TITLE') . '</td>'; |
|
300 | - echo "<th class='bg3' width='5%'>" . planet_constant('AM_STATUS') . '</td>'; |
|
301 | - echo "<th class='bg3' width='40%'>" . planet_constant('AM_FEED') . '</td>'; |
|
302 | - // echo "<th class='bg3' width='5%'>" . _EDIT . "</td>"; |
|
303 | - // echo "<th class='bg3' width='5%'>" . _DELETE . "</td>"; |
|
304 | - echo "<th class='bg3' width='10%'>" . planet_constant('AM_ACTIONS') . '</td>'; |
|
305 | - echo '</tr>'; |
|
306 | - |
|
307 | - $status = array( |
|
308 | - '0' => planet_constant('MD_PENDING'), |
|
309 | - '1' => planet_constant('MD_ACTIVE'), |
|
310 | - '2' => planet_constant('MD_FEATURED') |
|
311 | - ); |
|
312 | - foreach (array_keys($blog_objs) as $bid) { |
|
313 | - echo "<tr class='odd' align='left'>"; |
|
314 | - echo "<td align='center'><input name='blog[]' value='" . $bid . "' type='checkbox'></td>"; |
|
315 | - echo "<td><a href='" . XOOPS_URL . '/modules/' . $GLOBALS['moddirname'] . '/index.php' . URL_DELIMITER . 'b' . $bid . "'>" . $blog_objs[$bid]->getVar('blog_title') . '</a></td>'; |
|
316 | - echo "<td align='center'>" . $status[$blog_objs[$bid]->getVar('blog_status')] . '</td>'; |
|
317 | - echo '<td>' . $blog_objs[$bid]->getVar('blog_feed') . '</td>'; |
|
318 | - echo "<td align='center'><a href='admin.blog.php?op=edit&blog=" . $bid . "' title='" . _EDIT . "'><img src='" . $pathIcon16 . "/edit.png '" . "alt='" . _EDIT . " title='" . _EDIT . " </a> |
|
60 | + case 'save': |
|
61 | + |
|
62 | + if ($blog_id) { |
|
63 | + $blog_obj = $blogHandler->get($blog_id); |
|
64 | + } else { |
|
65 | + if ($blog_exists = $blogHandler->getCount(new Criteria('blog_feed', Request::getString('blog_feed', '', 'POST')))) { |
|
66 | + redirect_header('admin.blog.php', 2, planet_constant('AM_BLOGEXISTS')); |
|
67 | + } |
|
68 | + $blog_obj = $blogHandler->create(); |
|
69 | + $blog_obj->setVar('blog_submitter', $xoopsUser->getVar('uid')); |
|
70 | + } |
|
71 | + |
|
72 | + $blog_obj->setVar('blog_title', Request::getString('blog_title', '', 'POST')); //$_POST['blog_title']); |
|
73 | + $blog_obj->setVar('blog_desc', Request::getString('blog_desc', '', 'POST')); //$_POST['blog_desc']); |
|
74 | + $blog_obj->setVar('blog_image', Request::getString('blog_image', '', 'POST')); //$_POST['blog_image']); |
|
75 | + $blog_obj->setVar('blog_feed', Request::getString('blog_feed', '', 'POST')); //$_POST['blog_feed']); |
|
76 | + $blog_obj->setVar('blog_link', Request::getString('blog_link', '', 'POST')); //$_POST['blog_link']); |
|
77 | + $blog_obj->setVar('blog_language', Request::getString('blog_language', '', 'POST')); //$_POST['blog_language']); |
|
78 | + $blog_obj->setVar('blog_charset', Request::getString('blog_charset', '', 'POST')); //$_POST['blog_charset']); |
|
79 | + $blog_obj->setVar('blog_trackback', Request::getString('blog_trackback', '', 'POST')); //$_POST['blog_trackback']); |
|
80 | + $blog_obj->setVar('blog_status', Request::getInt('blog_status', 0, 'POST')); //$_POST['blog_status']); |
|
81 | + |
|
82 | + if (!$blogHandler->insert($blog_obj)) { |
|
83 | + } elseif (!empty(Request::getArray('categories', array(), 'POST'))) { |
|
84 | + $blog_id = $blog_obj->getVar('blog_id'); |
|
85 | + if (in_array(0, Request::getArray('categories', array(), 'POST'))) { |
|
86 | + $_POST['categories'] = array(); |
|
87 | + } |
|
88 | + $blogHandler->setCategories($blog_id, Request::getArray('categories', array(), 'POST')); |
|
89 | + } |
|
90 | + $message = planet_constant('AM_DBUPDATED'); |
|
91 | + redirect_header('admin.blog.php', 2, $message); |
|
92 | + |
|
93 | + /* fetch and add a list of blogs to a category */ |
|
94 | + case 'add': |
|
95 | + $links = PlanetUtility::planetParseLinks(Request::getArray('links', array(), 'POST')); |
|
96 | + $blogs = array(); |
|
97 | + foreach ($links as $link) { |
|
98 | + if ($blog_exist = $blogHandler->getCount(new Criteria('blog_feed', $link['url']))) { |
|
99 | + continue; |
|
100 | + } |
|
101 | + $blog_obj = $blogHandler->fetch($link['url']); |
|
102 | + if (!empty($link['title'])) { |
|
103 | + $blog_obj->setVar('blog_title', $link['title']); |
|
104 | + } |
|
105 | + $blogHandler->insert($blog_obj); |
|
106 | + $blogs[] = $blog_obj->getVar('blog_id'); |
|
107 | + unset($blog_obj); |
|
108 | + } |
|
109 | + if (!empty(Request::getArray('categories', array(), 'POST'))) { |
|
110 | + $categoryHandler = xoops_getModuleHandler('category', $GLOBALS['moddirname']); |
|
111 | + foreach (Request::getArray('categories', array(), 'POST') as $cat_id) { |
|
112 | + $categoryHandler->addBlogs($cat_id, $blogs); |
|
113 | + } |
|
114 | + } |
|
115 | + $message = planet_constant('AM_DBUPDATED'); |
|
116 | + redirect_header('admin.blog.php', 2, $message); |
|
117 | + |
|
118 | + /* update a list of blogs */ |
|
119 | + case 'update': |
|
120 | + foreach ($blog_id as $bid) { |
|
121 | + $blog_obj = $blogHandler->fetch($bid); |
|
122 | + if (!$blogHandler->insert($blog_obj)) { |
|
123 | + } |
|
124 | + unset($blog_obj); |
|
125 | + } |
|
126 | + $message = planet_constant('AM_DBUPDATED'); |
|
127 | + redirect_header('admin.blog.php?category=' . $category_id . '&start=' . $start, 2, $message); |
|
128 | + |
|
129 | + /* add a list of blogs to a category */ |
|
130 | + case 'register': |
|
131 | + if (!empty(Request::getArray('category_dest', array(), 'POST'))) { |
|
132 | + if (!is_array($blog_id)) { |
|
133 | + $blog_id = array($blog_id); |
|
134 | + } |
|
135 | + $categoryHandler = xoops_getModuleHandler('category', $GLOBALS['moddirname']); |
|
136 | + $categoryHandler->addBlogs(Request::getArray('category_dest', array(), 'POST'), $blog_id); |
|
137 | + } |
|
138 | + $message = planet_constant('AM_DBUPDATED'); |
|
139 | + redirect_header('admin.blog.php?category=' . Request::getArray('category_dest', array(), 'POST') . '&start=' . $start, 2, $message); |
|
140 | + |
|
141 | + /* remove a list of blogs from a category */ |
|
142 | + case 'remove': |
|
143 | + if (!is_array($blog_id)) { |
|
144 | + $blog_id = array($blog_id); |
|
145 | + } |
|
146 | + if (!empty($category_id)) { |
|
147 | + $categoryHandler = xoops_getModuleHandler('category', $GLOBALS['moddirname']); |
|
148 | + $categoryHandler->removeBlogs($category_id, $blog_id); |
|
149 | + } |
|
150 | + $message = planet_constant('AM_DBUPDATED'); |
|
151 | + redirect_header('admin.blog.php?category=' . $category_id . '&start=' . $start, 2, $message); |
|
152 | + |
|
153 | + /* delete a single blog or a list blogs */ |
|
154 | + case 'del': |
|
155 | + if (!is_array($blog_id)) { |
|
156 | + $blog_id = array($blog_id); |
|
157 | + } |
|
158 | + foreach ($blog_id as $bid) { |
|
159 | + $blog_obj = $blogHandler->get($bid); |
|
160 | + if (!$blogHandler->delete($blog_obj, true)) { |
|
161 | + } |
|
162 | + unset($blog_obj); |
|
163 | + } |
|
164 | + $message = planet_constant('AM_DBUPDATED'); |
|
165 | + redirect_header('admin.blog.php?category=' . $category_id . '&start=' . $start, 2, $message); |
|
166 | + |
|
167 | + /* empty a single blog or a list blogs */ |
|
168 | + case 'empty': |
|
169 | + if (!is_array($blog_id)) { |
|
170 | + $blog_id = array($blog_id); |
|
171 | + } |
|
172 | + foreach ($blog_id as $bid) { |
|
173 | + $blog_obj = $blogHandler->get($bid); |
|
174 | + if (!$blogHandler->do_empty($blog_obj)) { |
|
175 | + } |
|
176 | + } |
|
177 | + $message = planet_constant('AM_DBUPDATED'); |
|
178 | + redirect_header('admin.blog.php?category=' . $category_id . '&start=' . $start, 2, $message); |
|
179 | + |
|
180 | + /* approve a single blog or a list blogs */ |
|
181 | + case 'approve': |
|
182 | + if (!is_array($blog_id)) { |
|
183 | + $blog_id = array($blog_id); |
|
184 | + } |
|
185 | + $criteria = new Criteria('blog_id', '(' . implode(',', $blog_id) . ')', 'IN'); |
|
186 | + $blogHandler->updateAll('blog_status', 1, $criteria, true); |
|
187 | + $message = planet_constant('AM_DBUPDATED'); |
|
188 | + redirect_header('admin.blog.php?category=' . $category_id . '&start=' . $start, 2, $message); |
|
189 | + |
|
190 | + /* mark a single blog or a list blogs as featured */ |
|
191 | + case 'feature': |
|
192 | + if (!is_array($blog_id)) { |
|
193 | + $blog_id = array($blog_id); |
|
194 | + } |
|
195 | + $criteria = new Criteria('blog_id', '(' . implode(',', $blog_id) . ')', 'IN'); |
|
196 | + $blogHandler->updateAll('blog_status', 2, $criteria, true); |
|
197 | + $message = planet_constant('AM_DBUPDATED'); |
|
198 | + redirect_header('admin.blog.php?category=' . $category_id . '&start=' . $start, 2, $message); |
|
199 | + |
|
200 | + /* edit a single blog */ |
|
201 | + case 'edit': |
|
202 | + if (!empty(Request::getString('fetch', '', 'POST'))) { |
|
203 | + $blog_obj = $blogHandler->fetch(Request::getString('blog_feed', '', 'POST')); |
|
204 | + $blog_obj->setVar('blog_id', $blog_id); |
|
205 | + } else { |
|
206 | + $blog_obj = $blogHandler->get($blog_id); |
|
207 | + } |
|
208 | + $categories = Request::getArray('categories', array(), 'POST'); |
|
209 | + if (empty($categories) && $blog_id > 0) { |
|
210 | + $crit = new Criteria('bc.blog_id', $blog_id); |
|
211 | + $categories = array_keys($categoryHandler->getByBlog($crit)); |
|
212 | + } |
|
213 | + if (empty($categories)) { |
|
214 | + $categories = array(0 => _NONE); |
|
215 | + } |
|
216 | + |
|
217 | + echo "<fieldset><legend style='font-weight: bold; color: #900;'>" . _EDIT . '</legend>'; |
|
218 | + echo '<br>'; |
|
219 | + if (empty($blog_id) && $blog_obj->getVar('blog_feed')) { |
|
220 | + $criteria = new Criteria('blog_feed', $blog_obj->getVar('blog_feed')); |
|
221 | + $blogs_obj = $blogHandler->getList($criteria); |
|
222 | + if (count($blogs_obj) > 0) { |
|
223 | + echo "<div class=\"errorMsg\">" . planet_constant('AM_BLOGEXISTS'); |
|
224 | + foreach (array_keys($blogs_obj) as $bid) { |
|
225 | + echo "<br><a href=\"" . XOOPS_URL . '/modules/' . $GLOBALS['moddirname'] . '/index.php' . URL_DELIMITER . 'b' . $bid . "\" target=\"_blank\">" . $blogs_obj[$bid] . '</a>'; |
|
226 | + } |
|
227 | + echo '</div>'; |
|
228 | + } |
|
229 | + unset($blogs_obj, $criteria); |
|
230 | + } |
|
231 | + include XOOPS_ROOT_PATH . '/modules/' . $GLOBALS['moddirname'] . '/include/form.blog.php'; |
|
232 | + echo '</fieldset>'; |
|
233 | + break; |
|
234 | + |
|
235 | + default: |
|
236 | + |
|
237 | + $crit = new Criteria('1', 1); |
|
238 | + $crit->setSort('cat_order'); |
|
239 | + $crit->setOrder('ASC'); |
|
240 | + $categories = $categoryHandler->getList($crit); |
|
241 | + |
|
242 | + // Display category option form |
|
243 | + $opform = new XoopsSimpleForm('', 'opform', 'admin.blog.php', 'get'); |
|
244 | + $op_select = new XoopsFormSelect('', 'category', $category_id); |
|
245 | + $op_select->setExtra('onchange="document.forms.opform.submit()"'); |
|
246 | + $options = array( |
|
247 | + '0' => _ALL, |
|
248 | + '-1' => planet_constant('MD_ACTIVE'), |
|
249 | + '-2' => planet_constant('MD_FEATURED'), |
|
250 | + '-3' => planet_constant('MD_PENDING') |
|
251 | + ); |
|
252 | + foreach (array_keys($categories) as $key) { |
|
253 | + $options[$key] = $categories[$key]; |
|
254 | + } |
|
255 | + $op_select->addOptionArray($options); |
|
256 | + $opform->addElement($op_select); |
|
257 | + $opform->display(); |
|
258 | + |
|
259 | + if ($category_id > 0) { |
|
260 | + $criteria = new CriteriaCompo(new Criteria('b.blog_status', 0, '>')); |
|
261 | + $criteria->add(new Criteria('bc.cat_id', $category_id)); |
|
262 | + $blog_count = $blogHandler->getCountByCategory($criteria); |
|
263 | + $criteria->setStart($start); |
|
264 | + $criteria->setLimit($xoopsModuleConfig['list_perpage']); |
|
265 | + $blog_objs = $blogHandler->getByCategory($criteria); |
|
266 | + } else { |
|
267 | + /* All active blogs */ |
|
268 | + if ($category_id == 0) { |
|
269 | + $criteria = new Criteria('1', 1); |
|
270 | + $criteria->setStart($start); |
|
271 | + $criteria->setLimit($xoopsModuleConfig['list_perpage']); |
|
272 | + /* Active blogs */ |
|
273 | + } elseif ($category_id == -1) { |
|
274 | + $criteria = new Criteria('blog_status', 1); |
|
275 | + $criteria->setStart($start); |
|
276 | + $criteria->setLimit($xoopsModuleConfig['list_perpage']); |
|
277 | + /* Featured blogs */ |
|
278 | + } elseif ($category_id == -2) { |
|
279 | + $criteria = new Criteria('blog_status', 2); |
|
280 | + $criteria->setStart($start); |
|
281 | + $criteria->setLimit($xoopsModuleConfig['list_perpage']); |
|
282 | + /* Pending blogs */ |
|
283 | + } else { |
|
284 | + $criteria = new Criteria('blog_status', 0); |
|
285 | + $criteria->setStart($start); |
|
286 | + $criteria->setLimit($xoopsModuleConfig['list_perpage']); |
|
287 | + } |
|
288 | + $blog_count = $blogHandler->getCount($criteria); |
|
289 | + $blog_objs = $blogHandler->getAll($criteria); |
|
290 | + } |
|
291 | + |
|
292 | + echo "<fieldset><legend style='font-weight: bold; color: #900;'>" . planet_constant('AM_LIST') . '</legend>'; |
|
293 | + echo "<br style=\"clear:both\">"; |
|
294 | + |
|
295 | + echo "<form name='list' id='list' method='post' action='" . xoops_getenv('PHP_SELF') . "'>"; |
|
296 | + echo "<table border='0' cellpadding='4' cellspacing='1' width='100%' class='outer'>"; |
|
297 | + echo "<tr align='center'>"; |
|
298 | + echo "<th class='bg3' width='5%'><input name='blog_check' id='blog_check' value='1' type='checkbox' onclick=\"xoopsCheckAll('list', 'blog_check');\"></td>"; |
|
299 | + echo "<th class='bg3'>" . planet_constant('AM_TITLE') . '</td>'; |
|
300 | + echo "<th class='bg3' width='5%'>" . planet_constant('AM_STATUS') . '</td>'; |
|
301 | + echo "<th class='bg3' width='40%'>" . planet_constant('AM_FEED') . '</td>'; |
|
302 | + // echo "<th class='bg3' width='5%'>" . _EDIT . "</td>"; |
|
303 | + // echo "<th class='bg3' width='5%'>" . _DELETE . "</td>"; |
|
304 | + echo "<th class='bg3' width='10%'>" . planet_constant('AM_ACTIONS') . '</td>'; |
|
305 | + echo '</tr>'; |
|
306 | + |
|
307 | + $status = array( |
|
308 | + '0' => planet_constant('MD_PENDING'), |
|
309 | + '1' => planet_constant('MD_ACTIVE'), |
|
310 | + '2' => planet_constant('MD_FEATURED') |
|
311 | + ); |
|
312 | + foreach (array_keys($blog_objs) as $bid) { |
|
313 | + echo "<tr class='odd' align='left'>"; |
|
314 | + echo "<td align='center'><input name='blog[]' value='" . $bid . "' type='checkbox'></td>"; |
|
315 | + echo "<td><a href='" . XOOPS_URL . '/modules/' . $GLOBALS['moddirname'] . '/index.php' . URL_DELIMITER . 'b' . $bid . "'>" . $blog_objs[$bid]->getVar('blog_title') . '</a></td>'; |
|
316 | + echo "<td align='center'>" . $status[$blog_objs[$bid]->getVar('blog_status')] . '</td>'; |
|
317 | + echo '<td>' . $blog_objs[$bid]->getVar('blog_feed') . '</td>'; |
|
318 | + echo "<td align='center'><a href='admin.blog.php?op=edit&blog=" . $bid . "' title='" . _EDIT . "'><img src='" . $pathIcon16 . "/edit.png '" . "alt='" . _EDIT . " title='" . _EDIT . " </a> |
|
319 | 319 | <a href='admin.blog.php?op=del&blog=" . $bid . "' title='" . _DELETE . "'><img src='" . $pathIcon16 . "/delete.png '" . " alt='" . _EDIT . " title='" . _DELETE . " </a> |
320 | 320 | <a href='admin.blog.php?op=empty&blog=" . $bid . "' title='" . planet_constant('MD_EMPTY_BLOG') . "'><img src='" . $pathIcon16 . "/empty.png '" . " alt='" . _EDIT . " title='" . planet_constant('MD_EMPTY_BLOG') . '</a></td>'; |
321 | 321 | |
322 | - echo '</tr>'; |
|
323 | - } |
|
324 | - echo "<tr class='even' align='center'>"; |
|
325 | - echo "<td colspan='7'>"; |
|
326 | - echo "<select name='op' onChange='if (this.options[this.selectedIndex].value==\"register\") {setVisible(\"catdiv\");} else {setHidden(\"catdiv\");}'>"; |
|
327 | - echo "<option value=''>" . _SELECT . '</option>'; |
|
328 | - echo "<option value='del'>" . _DELETE . '</option>'; |
|
329 | - echo "<option value='empty'>" . planet_constant('MD_EMPTY_BLOG') . '</option>'; |
|
330 | - echo "<option value='register'>" . planet_constant('AM_REGISTER') . '</option>'; |
|
331 | - if ($category_id > 0) { |
|
332 | - echo "<option value='remove'>" . planet_constant('AM_REMOVE') . '</option>'; |
|
333 | - } |
|
334 | - echo "<option value='approve'>" . planet_constant('AM_APPROVE') . '</option>'; |
|
335 | - echo "<option value='feature'>" . planet_constant('AM_FEATURE') . '</option>'; |
|
336 | - echo "<option value='update'>" . planet_constant('AM_UPDATE') . '</option>'; |
|
337 | - |
|
338 | - echo "<option value='pending'>" . planet_constant('AM_PENDING') . '</option>'; |
|
339 | - echo "<option value='active'>" . planet_constant('AM_ACTIVE') . '</option>'; |
|
340 | - |
|
341 | - echo '</select>'; |
|
342 | - echo "<div id='catdiv' style='visibility:hidden;display:inline;'>"; |
|
343 | - echo "<select name='category_dest'>"; |
|
344 | - echo "<option value=''>" . _SELECT . '</option>'; |
|
345 | - foreach ($categories as $cid => $name) { |
|
346 | - echo "<option value='" . $cid . "'>" . $name . '</option>'; |
|
347 | - } |
|
348 | - echo '</select>'; |
|
349 | - echo '</div>'; |
|
350 | - echo "<input name='start' value='" . $start . "' type='hidden'>"; |
|
351 | - echo "<input name='category' value='" . $category_id . "' type='hidden'>"; |
|
352 | - echo "<input name='submit' value='" . _SUBMIT . "' type='submit'>"; |
|
353 | - echo "<input name='' value='" . _CANCEL . "' type='reset'>"; |
|
354 | - echo '</td>'; |
|
355 | - echo '</tr>'; |
|
356 | - if ($blog_count > $xoopsModuleConfig['list_perpage']) { |
|
357 | - include XOOPS_ROOT_PATH . '/class/pagenav.php'; |
|
358 | - $nav = new XoopsPageNav($blog_count, $xoopsModuleConfig['list_perpage'], $start, 'start', 'category=' . $category_id); |
|
359 | - $pagenav = $nav->renderNav(4); |
|
360 | - echo "<tr align='right'><td colspan='6'>" . $pagenav . '</td></tr>'; |
|
361 | - } |
|
362 | - echo '</table></form>'; |
|
363 | - echo "</fieldset><br style='clear:both;'>"; |
|
364 | - |
|
365 | - if (empty($start) && empty($category_id)) { |
|
366 | - $form = new XoopsThemeForm(_ADD, 'edit', xoops_getenv('PHP_SELF'), 'post', true); |
|
367 | - $form->addElement(new XoopsFormText(planet_constant('AM_FEED'), 'blog_feed', 50, 255), true); |
|
368 | - $form->addElement(new XoopsFormHidden('op', 'edit')); |
|
369 | - $button_tray = new XoopsFormElementTray('', ''); |
|
370 | - $butt_save = new XoopsFormButton('', 'fetch', _SUBMIT, 'submit'); |
|
371 | - $button_tray->addElement($butt_save); |
|
372 | - $butt_cancel = new XoopsFormButton('', '', _CANCEL, 'reset'); |
|
373 | - $button_tray->addElement($butt_cancel); |
|
374 | - $form->addElement($button_tray); |
|
375 | - |
|
376 | - $form_add = new XoopsThemeForm(_ADD, 'add', xoops_getenv('PHP_SELF'), 'post', true); |
|
377 | - $form_add->addElement(new XoopsFormTextArea(planet_constant('AM_FEED'), 'links')); |
|
378 | - $form_add->addElement(new XoopsFormHidden('op', 'add')); |
|
379 | - $button_tray = new XoopsFormElementTray('', ''); |
|
380 | - $butt_save = new XoopsFormButton('', 'submit', _SUBMIT, 'submit'); |
|
381 | - $button_tray->addElement($butt_save); |
|
382 | - $butt_cancel = new XoopsFormButton('', '', _CANCEL, 'reset'); |
|
383 | - $button_tray->addElement($butt_cancel); |
|
384 | - $form_add->addElement($button_tray); |
|
385 | - |
|
386 | - echo "<fieldset><legend style='font-weight: bold; color: #900;'>" . _ADD . '</legend>'; |
|
387 | - echo '<br>'; |
|
388 | - $form->display(); |
|
389 | - $form_add->display(); |
|
390 | - echo '</fieldset>'; |
|
391 | - } |
|
392 | - break; |
|
322 | + echo '</tr>'; |
|
323 | + } |
|
324 | + echo "<tr class='even' align='center'>"; |
|
325 | + echo "<td colspan='7'>"; |
|
326 | + echo "<select name='op' onChange='if (this.options[this.selectedIndex].value==\"register\") {setVisible(\"catdiv\");} else {setHidden(\"catdiv\");}'>"; |
|
327 | + echo "<option value=''>" . _SELECT . '</option>'; |
|
328 | + echo "<option value='del'>" . _DELETE . '</option>'; |
|
329 | + echo "<option value='empty'>" . planet_constant('MD_EMPTY_BLOG') . '</option>'; |
|
330 | + echo "<option value='register'>" . planet_constant('AM_REGISTER') . '</option>'; |
|
331 | + if ($category_id > 0) { |
|
332 | + echo "<option value='remove'>" . planet_constant('AM_REMOVE') . '</option>'; |
|
333 | + } |
|
334 | + echo "<option value='approve'>" . planet_constant('AM_APPROVE') . '</option>'; |
|
335 | + echo "<option value='feature'>" . planet_constant('AM_FEATURE') . '</option>'; |
|
336 | + echo "<option value='update'>" . planet_constant('AM_UPDATE') . '</option>'; |
|
337 | + |
|
338 | + echo "<option value='pending'>" . planet_constant('AM_PENDING') . '</option>'; |
|
339 | + echo "<option value='active'>" . planet_constant('AM_ACTIVE') . '</option>'; |
|
340 | + |
|
341 | + echo '</select>'; |
|
342 | + echo "<div id='catdiv' style='visibility:hidden;display:inline;'>"; |
|
343 | + echo "<select name='category_dest'>"; |
|
344 | + echo "<option value=''>" . _SELECT . '</option>'; |
|
345 | + foreach ($categories as $cid => $name) { |
|
346 | + echo "<option value='" . $cid . "'>" . $name . '</option>'; |
|
347 | + } |
|
348 | + echo '</select>'; |
|
349 | + echo '</div>'; |
|
350 | + echo "<input name='start' value='" . $start . "' type='hidden'>"; |
|
351 | + echo "<input name='category' value='" . $category_id . "' type='hidden'>"; |
|
352 | + echo "<input name='submit' value='" . _SUBMIT . "' type='submit'>"; |
|
353 | + echo "<input name='' value='" . _CANCEL . "' type='reset'>"; |
|
354 | + echo '</td>'; |
|
355 | + echo '</tr>'; |
|
356 | + if ($blog_count > $xoopsModuleConfig['list_perpage']) { |
|
357 | + include XOOPS_ROOT_PATH . '/class/pagenav.php'; |
|
358 | + $nav = new XoopsPageNav($blog_count, $xoopsModuleConfig['list_perpage'], $start, 'start', 'category=' . $category_id); |
|
359 | + $pagenav = $nav->renderNav(4); |
|
360 | + echo "<tr align='right'><td colspan='6'>" . $pagenav . '</td></tr>'; |
|
361 | + } |
|
362 | + echo '</table></form>'; |
|
363 | + echo "</fieldset><br style='clear:both;'>"; |
|
364 | + |
|
365 | + if (empty($start) && empty($category_id)) { |
|
366 | + $form = new XoopsThemeForm(_ADD, 'edit', xoops_getenv('PHP_SELF'), 'post', true); |
|
367 | + $form->addElement(new XoopsFormText(planet_constant('AM_FEED'), 'blog_feed', 50, 255), true); |
|
368 | + $form->addElement(new XoopsFormHidden('op', 'edit')); |
|
369 | + $button_tray = new XoopsFormElementTray('', ''); |
|
370 | + $butt_save = new XoopsFormButton('', 'fetch', _SUBMIT, 'submit'); |
|
371 | + $button_tray->addElement($butt_save); |
|
372 | + $butt_cancel = new XoopsFormButton('', '', _CANCEL, 'reset'); |
|
373 | + $button_tray->addElement($butt_cancel); |
|
374 | + $form->addElement($button_tray); |
|
375 | + |
|
376 | + $form_add = new XoopsThemeForm(_ADD, 'add', xoops_getenv('PHP_SELF'), 'post', true); |
|
377 | + $form_add->addElement(new XoopsFormTextArea(planet_constant('AM_FEED'), 'links')); |
|
378 | + $form_add->addElement(new XoopsFormHidden('op', 'add')); |
|
379 | + $button_tray = new XoopsFormElementTray('', ''); |
|
380 | + $butt_save = new XoopsFormButton('', 'submit', _SUBMIT, 'submit'); |
|
381 | + $button_tray->addElement($butt_save); |
|
382 | + $butt_cancel = new XoopsFormButton('', '', _CANCEL, 'reset'); |
|
383 | + $button_tray->addElement($butt_cancel); |
|
384 | + $form_add->addElement($button_tray); |
|
385 | + |
|
386 | + echo "<fieldset><legend style='font-weight: bold; color: #900;'>" . _ADD . '</legend>'; |
|
387 | + echo '<br>'; |
|
388 | + $form->display(); |
|
389 | + $form_add->display(); |
|
390 | + echo '</fieldset>'; |
|
391 | + } |
|
392 | + break; |
|
393 | 393 | } |
394 | 394 | |
395 | 395 | xoops_cp_footer(); |
@@ -26,8 +26,8 @@ discard block |
||
26 | 26 | // ------------------------------------------------------------------------ // |
27 | 27 | use Xmf\Request; |
28 | 28 | |
29 | -require_once __DIR__ . '/admin_header.php'; |
|
30 | -require_once XOOPS_ROOT_PATH . '/class/xoopsformloader.php'; |
|
29 | +require_once __DIR__.'/admin_header.php'; |
|
30 | +require_once XOOPS_ROOT_PATH.'/class/xoopsformloader.php'; |
|
31 | 31 | |
32 | 32 | xoops_cp_header(); |
33 | 33 | $adminObject = \Xmf\Module\Admin::getInstance(); |
@@ -39,14 +39,14 @@ discard block |
||
39 | 39 | * This is a tricky fix for incomplete solution of module cone |
40 | 40 | * it is expected to have a better solution in article 1.0 |
41 | 41 | */ |
42 | -require XOOPS_ROOT_PATH . '/modules/' . $xoopsModule->getVar('dirname') . '/include/vars.php'; |
|
42 | +require XOOPS_ROOT_PATH.'/modules/'.$xoopsModule->getVar('dirname').'/include/vars.php'; |
|
43 | 43 | //planet_adminmenu(2); |
44 | 44 | |
45 | -$op = Request::getString('op', Request::getString('op', '', 'POST'), 'GET');//!empty($_POST['op']) ? $_POST['op'] : (!empty($_GET['op']) ? $_GET['op'] : ''); |
|
46 | -$blog_id = Request::getArray('blog', Request::getArray('blog', array(), 'POST'), 'GET');//!empty($_POST['blog']) ? $_POST['blog'] : (!empty($_GET['blog']) ? $_GET['blog'] : 0); |
|
47 | -$blog_id = is_array($blog_id) ? array_map('intval', $blog_id) : (int)$blog_id; |
|
48 | -$category_id = Request::getInt('category', Request::getInt('category', 0, 'POST'), 'GET');//(int)(!empty($_POST['category']) ? $_POST['category'] : (!empty($_GET['category']) ? $_GET['category'] : 0)); |
|
49 | -$start = Request::getInt('start', Request::getInt('start', 0, 'POST'), 'GET');//(int)(!empty($_POST['start']) ? $_POST['start'] : (!empty($_GET['start']) ? $_GET['start'] : 0)); |
|
45 | +$op = Request::getString('op', Request::getString('op', '', 'POST'), 'GET'); //!empty($_POST['op']) ? $_POST['op'] : (!empty($_GET['op']) ? $_GET['op'] : ''); |
|
46 | +$blog_id = Request::getArray('blog', Request::getArray('blog', array(), 'POST'), 'GET'); //!empty($_POST['blog']) ? $_POST['blog'] : (!empty($_GET['blog']) ? $_GET['blog'] : 0); |
|
47 | +$blog_id = is_array($blog_id) ? array_map('intval', $blog_id) : (int) $blog_id; |
|
48 | +$category_id = Request::getInt('category', Request::getInt('category', 0, 'POST'), 'GET'); //(int)(!empty($_POST['category']) ? $_POST['category'] : (!empty($_GET['category']) ? $_GET['category'] : 0)); |
|
49 | +$start = Request::getInt('start', Request::getInt('start', 0, 'POST'), 'GET'); //(int)(!empty($_POST['start']) ? $_POST['start'] : (!empty($_GET['start']) ? $_GET['start'] : 0)); |
|
50 | 50 | |
51 | 51 | $blogHandler = xoops_getModuleHandler('blog', $GLOBALS['moddirname']); |
52 | 52 | $categoryHandler = xoops_getModuleHandler('category', $GLOBALS['moddirname']); |
@@ -61,7 +61,7 @@ discard block |
||
61 | 61 | |
62 | 62 | if ($blog_id) { |
63 | 63 | $blog_obj = $blogHandler->get($blog_id); |
64 | - } else { |
|
64 | + }else { |
|
65 | 65 | if ($blog_exists = $blogHandler->getCount(new Criteria('blog_feed', Request::getString('blog_feed', '', 'POST')))) { |
66 | 66 | redirect_header('admin.blog.php', 2, planet_constant('AM_BLOGEXISTS')); |
67 | 67 | } |
@@ -124,7 +124,7 @@ discard block |
||
124 | 124 | unset($blog_obj); |
125 | 125 | } |
126 | 126 | $message = planet_constant('AM_DBUPDATED'); |
127 | - redirect_header('admin.blog.php?category=' . $category_id . '&start=' . $start, 2, $message); |
|
127 | + redirect_header('admin.blog.php?category='.$category_id.'&start='.$start, 2, $message); |
|
128 | 128 | |
129 | 129 | /* add a list of blogs to a category */ |
130 | 130 | case 'register': |
@@ -136,7 +136,7 @@ discard block |
||
136 | 136 | $categoryHandler->addBlogs(Request::getArray('category_dest', array(), 'POST'), $blog_id); |
137 | 137 | } |
138 | 138 | $message = planet_constant('AM_DBUPDATED'); |
139 | - redirect_header('admin.blog.php?category=' . Request::getArray('category_dest', array(), 'POST') . '&start=' . $start, 2, $message); |
|
139 | + redirect_header('admin.blog.php?category='.Request::getArray('category_dest', array(), 'POST').'&start='.$start, 2, $message); |
|
140 | 140 | |
141 | 141 | /* remove a list of blogs from a category */ |
142 | 142 | case 'remove': |
@@ -148,7 +148,7 @@ discard block |
||
148 | 148 | $categoryHandler->removeBlogs($category_id, $blog_id); |
149 | 149 | } |
150 | 150 | $message = planet_constant('AM_DBUPDATED'); |
151 | - redirect_header('admin.blog.php?category=' . $category_id . '&start=' . $start, 2, $message); |
|
151 | + redirect_header('admin.blog.php?category='.$category_id.'&start='.$start, 2, $message); |
|
152 | 152 | |
153 | 153 | /* delete a single blog or a list blogs */ |
154 | 154 | case 'del': |
@@ -162,7 +162,7 @@ discard block |
||
162 | 162 | unset($blog_obj); |
163 | 163 | } |
164 | 164 | $message = planet_constant('AM_DBUPDATED'); |
165 | - redirect_header('admin.blog.php?category=' . $category_id . '&start=' . $start, 2, $message); |
|
165 | + redirect_header('admin.blog.php?category='.$category_id.'&start='.$start, 2, $message); |
|
166 | 166 | |
167 | 167 | /* empty a single blog or a list blogs */ |
168 | 168 | case 'empty': |
@@ -175,38 +175,38 @@ discard block |
||
175 | 175 | } |
176 | 176 | } |
177 | 177 | $message = planet_constant('AM_DBUPDATED'); |
178 | - redirect_header('admin.blog.php?category=' . $category_id . '&start=' . $start, 2, $message); |
|
178 | + redirect_header('admin.blog.php?category='.$category_id.'&start='.$start, 2, $message); |
|
179 | 179 | |
180 | 180 | /* approve a single blog or a list blogs */ |
181 | 181 | case 'approve': |
182 | 182 | if (!is_array($blog_id)) { |
183 | 183 | $blog_id = array($blog_id); |
184 | 184 | } |
185 | - $criteria = new Criteria('blog_id', '(' . implode(',', $blog_id) . ')', 'IN'); |
|
185 | + $criteria = new Criteria('blog_id', '('.implode(',', $blog_id).')', 'IN'); |
|
186 | 186 | $blogHandler->updateAll('blog_status', 1, $criteria, true); |
187 | 187 | $message = planet_constant('AM_DBUPDATED'); |
188 | - redirect_header('admin.blog.php?category=' . $category_id . '&start=' . $start, 2, $message); |
|
188 | + redirect_header('admin.blog.php?category='.$category_id.'&start='.$start, 2, $message); |
|
189 | 189 | |
190 | 190 | /* mark a single blog or a list blogs as featured */ |
191 | 191 | case 'feature': |
192 | 192 | if (!is_array($blog_id)) { |
193 | 193 | $blog_id = array($blog_id); |
194 | 194 | } |
195 | - $criteria = new Criteria('blog_id', '(' . implode(',', $blog_id) . ')', 'IN'); |
|
195 | + $criteria = new Criteria('blog_id', '('.implode(',', $blog_id).')', 'IN'); |
|
196 | 196 | $blogHandler->updateAll('blog_status', 2, $criteria, true); |
197 | 197 | $message = planet_constant('AM_DBUPDATED'); |
198 | - redirect_header('admin.blog.php?category=' . $category_id . '&start=' . $start, 2, $message); |
|
198 | + redirect_header('admin.blog.php?category='.$category_id.'&start='.$start, 2, $message); |
|
199 | 199 | |
200 | 200 | /* edit a single blog */ |
201 | 201 | case 'edit': |
202 | 202 | if (!empty(Request::getString('fetch', '', 'POST'))) { |
203 | 203 | $blog_obj = $blogHandler->fetch(Request::getString('blog_feed', '', 'POST')); |
204 | 204 | $blog_obj->setVar('blog_id', $blog_id); |
205 | - } else { |
|
205 | + }else { |
|
206 | 206 | $blog_obj = $blogHandler->get($blog_id); |
207 | 207 | } |
208 | 208 | $categories = Request::getArray('categories', array(), 'POST'); |
209 | - if (empty($categories) && $blog_id > 0) { |
|
209 | + if (empty($categories) && $blog_id>0) { |
|
210 | 210 | $crit = new Criteria('bc.blog_id', $blog_id); |
211 | 211 | $categories = array_keys($categoryHandler->getByBlog($crit)); |
212 | 212 | } |
@@ -214,21 +214,21 @@ discard block |
||
214 | 214 | $categories = array(0 => _NONE); |
215 | 215 | } |
216 | 216 | |
217 | - echo "<fieldset><legend style='font-weight: bold; color: #900;'>" . _EDIT . '</legend>'; |
|
217 | + echo "<fieldset><legend style='font-weight: bold; color: #900;'>"._EDIT.'</legend>'; |
|
218 | 218 | echo '<br>'; |
219 | 219 | if (empty($blog_id) && $blog_obj->getVar('blog_feed')) { |
220 | 220 | $criteria = new Criteria('blog_feed', $blog_obj->getVar('blog_feed')); |
221 | 221 | $blogs_obj = $blogHandler->getList($criteria); |
222 | - if (count($blogs_obj) > 0) { |
|
223 | - echo "<div class=\"errorMsg\">" . planet_constant('AM_BLOGEXISTS'); |
|
222 | + if (count($blogs_obj)>0) { |
|
223 | + echo "<div class=\"errorMsg\">".planet_constant('AM_BLOGEXISTS'); |
|
224 | 224 | foreach (array_keys($blogs_obj) as $bid) { |
225 | - echo "<br><a href=\"" . XOOPS_URL . '/modules/' . $GLOBALS['moddirname'] . '/index.php' . URL_DELIMITER . 'b' . $bid . "\" target=\"_blank\">" . $blogs_obj[$bid] . '</a>'; |
|
225 | + echo "<br><a href=\"".XOOPS_URL.'/modules/'.$GLOBALS['moddirname'].'/index.php'.URL_DELIMITER.'b'.$bid."\" target=\"_blank\">".$blogs_obj[$bid].'</a>'; |
|
226 | 226 | } |
227 | 227 | echo '</div>'; |
228 | 228 | } |
229 | 229 | unset($blogs_obj, $criteria); |
230 | 230 | } |
231 | - include XOOPS_ROOT_PATH . '/modules/' . $GLOBALS['moddirname'] . '/include/form.blog.php'; |
|
231 | + include XOOPS_ROOT_PATH.'/modules/'.$GLOBALS['moddirname'].'/include/form.blog.php'; |
|
232 | 232 | echo '</fieldset>'; |
233 | 233 | break; |
234 | 234 | |
@@ -256,14 +256,14 @@ discard block |
||
256 | 256 | $opform->addElement($op_select); |
257 | 257 | $opform->display(); |
258 | 258 | |
259 | - if ($category_id > 0) { |
|
259 | + if ($category_id>0) { |
|
260 | 260 | $criteria = new CriteriaCompo(new Criteria('b.blog_status', 0, '>')); |
261 | 261 | $criteria->add(new Criteria('bc.cat_id', $category_id)); |
262 | 262 | $blog_count = $blogHandler->getCountByCategory($criteria); |
263 | 263 | $criteria->setStart($start); |
264 | 264 | $criteria->setLimit($xoopsModuleConfig['list_perpage']); |
265 | 265 | $blog_objs = $blogHandler->getByCategory($criteria); |
266 | - } else { |
|
266 | + }else { |
|
267 | 267 | /* All active blogs */ |
268 | 268 | if ($category_id == 0) { |
269 | 269 | $criteria = new Criteria('1', 1); |
@@ -280,7 +280,7 @@ discard block |
||
280 | 280 | $criteria->setStart($start); |
281 | 281 | $criteria->setLimit($xoopsModuleConfig['list_perpage']); |
282 | 282 | /* Pending blogs */ |
283 | - } else { |
|
283 | + }else { |
|
284 | 284 | $criteria = new Criteria('blog_status', 0); |
285 | 285 | $criteria->setStart($start); |
286 | 286 | $criteria->setLimit($xoopsModuleConfig['list_perpage']); |
@@ -289,19 +289,19 @@ discard block |
||
289 | 289 | $blog_objs = $blogHandler->getAll($criteria); |
290 | 290 | } |
291 | 291 | |
292 | - echo "<fieldset><legend style='font-weight: bold; color: #900;'>" . planet_constant('AM_LIST') . '</legend>'; |
|
292 | + echo "<fieldset><legend style='font-weight: bold; color: #900;'>".planet_constant('AM_LIST').'</legend>'; |
|
293 | 293 | echo "<br style=\"clear:both\">"; |
294 | 294 | |
295 | - echo "<form name='list' id='list' method='post' action='" . xoops_getenv('PHP_SELF') . "'>"; |
|
295 | + echo "<form name='list' id='list' method='post' action='".xoops_getenv('PHP_SELF')."'>"; |
|
296 | 296 | echo "<table border='0' cellpadding='4' cellspacing='1' width='100%' class='outer'>"; |
297 | 297 | echo "<tr align='center'>"; |
298 | 298 | echo "<th class='bg3' width='5%'><input name='blog_check' id='blog_check' value='1' type='checkbox' onclick=\"xoopsCheckAll('list', 'blog_check');\"></td>"; |
299 | - echo "<th class='bg3'>" . planet_constant('AM_TITLE') . '</td>'; |
|
300 | - echo "<th class='bg3' width='5%'>" . planet_constant('AM_STATUS') . '</td>'; |
|
301 | - echo "<th class='bg3' width='40%'>" . planet_constant('AM_FEED') . '</td>'; |
|
299 | + echo "<th class='bg3'>".planet_constant('AM_TITLE').'</td>'; |
|
300 | + echo "<th class='bg3' width='5%'>".planet_constant('AM_STATUS').'</td>'; |
|
301 | + echo "<th class='bg3' width='40%'>".planet_constant('AM_FEED').'</td>'; |
|
302 | 302 | // echo "<th class='bg3' width='5%'>" . _EDIT . "</td>"; |
303 | 303 | // echo "<th class='bg3' width='5%'>" . _DELETE . "</td>"; |
304 | - echo "<th class='bg3' width='10%'>" . planet_constant('AM_ACTIONS') . '</td>'; |
|
304 | + echo "<th class='bg3' width='10%'>".planet_constant('AM_ACTIONS').'</td>'; |
|
305 | 305 | echo '</tr>'; |
306 | 306 | |
307 | 307 | $status = array( |
@@ -311,53 +311,53 @@ discard block |
||
311 | 311 | ); |
312 | 312 | foreach (array_keys($blog_objs) as $bid) { |
313 | 313 | echo "<tr class='odd' align='left'>"; |
314 | - echo "<td align='center'><input name='blog[]' value='" . $bid . "' type='checkbox'></td>"; |
|
315 | - echo "<td><a href='" . XOOPS_URL . '/modules/' . $GLOBALS['moddirname'] . '/index.php' . URL_DELIMITER . 'b' . $bid . "'>" . $blog_objs[$bid]->getVar('blog_title') . '</a></td>'; |
|
316 | - echo "<td align='center'>" . $status[$blog_objs[$bid]->getVar('blog_status')] . '</td>'; |
|
317 | - echo '<td>' . $blog_objs[$bid]->getVar('blog_feed') . '</td>'; |
|
318 | - echo "<td align='center'><a href='admin.blog.php?op=edit&blog=" . $bid . "' title='" . _EDIT . "'><img src='" . $pathIcon16 . "/edit.png '" . "alt='" . _EDIT . " title='" . _EDIT . " </a> |
|
319 | - <a href='admin.blog.php?op=del&blog=" . $bid . "' title='" . _DELETE . "'><img src='" . $pathIcon16 . "/delete.png '" . " alt='" . _EDIT . " title='" . _DELETE . " </a> |
|
320 | - <a href='admin.blog.php?op=empty&blog=" . $bid . "' title='" . planet_constant('MD_EMPTY_BLOG') . "'><img src='" . $pathIcon16 . "/empty.png '" . " alt='" . _EDIT . " title='" . planet_constant('MD_EMPTY_BLOG') . '</a></td>'; |
|
314 | + echo "<td align='center'><input name='blog[]' value='".$bid."' type='checkbox'></td>"; |
|
315 | + echo "<td><a href='".XOOPS_URL.'/modules/'.$GLOBALS['moddirname'].'/index.php'.URL_DELIMITER.'b'.$bid."'>".$blog_objs[$bid]->getVar('blog_title').'</a></td>'; |
|
316 | + echo "<td align='center'>".$status[$blog_objs[$bid]->getVar('blog_status')].'</td>'; |
|
317 | + echo '<td>'.$blog_objs[$bid]->getVar('blog_feed').'</td>'; |
|
318 | + echo "<td align='center'><a href='admin.blog.php?op=edit&blog=".$bid."' title='"._EDIT."'><img src='".$pathIcon16."/edit.png '"."alt='"._EDIT." title='"._EDIT." </a> |
|
319 | + <a href='admin.blog.php?op=del&blog=" . $bid."' title='"._DELETE."'><img src='".$pathIcon16."/delete.png '"." alt='"._EDIT." title='"._DELETE." </a> |
|
320 | + <a href='admin.blog.php?op=empty&blog=" . $bid."' title='".planet_constant('MD_EMPTY_BLOG')."'><img src='".$pathIcon16."/empty.png '"." alt='"._EDIT." title='".planet_constant('MD_EMPTY_BLOG').'</a></td>'; |
|
321 | 321 | |
322 | 322 | echo '</tr>'; |
323 | 323 | } |
324 | 324 | echo "<tr class='even' align='center'>"; |
325 | 325 | echo "<td colspan='7'>"; |
326 | 326 | echo "<select name='op' onChange='if (this.options[this.selectedIndex].value==\"register\") {setVisible(\"catdiv\");} else {setHidden(\"catdiv\");}'>"; |
327 | - echo "<option value=''>" . _SELECT . '</option>'; |
|
328 | - echo "<option value='del'>" . _DELETE . '</option>'; |
|
329 | - echo "<option value='empty'>" . planet_constant('MD_EMPTY_BLOG') . '</option>'; |
|
330 | - echo "<option value='register'>" . planet_constant('AM_REGISTER') . '</option>'; |
|
331 | - if ($category_id > 0) { |
|
332 | - echo "<option value='remove'>" . planet_constant('AM_REMOVE') . '</option>'; |
|
327 | + echo "<option value=''>"._SELECT.'</option>'; |
|
328 | + echo "<option value='del'>"._DELETE.'</option>'; |
|
329 | + echo "<option value='empty'>".planet_constant('MD_EMPTY_BLOG').'</option>'; |
|
330 | + echo "<option value='register'>".planet_constant('AM_REGISTER').'</option>'; |
|
331 | + if ($category_id>0) { |
|
332 | + echo "<option value='remove'>".planet_constant('AM_REMOVE').'</option>'; |
|
333 | 333 | } |
334 | - echo "<option value='approve'>" . planet_constant('AM_APPROVE') . '</option>'; |
|
335 | - echo "<option value='feature'>" . planet_constant('AM_FEATURE') . '</option>'; |
|
336 | - echo "<option value='update'>" . planet_constant('AM_UPDATE') . '</option>'; |
|
334 | + echo "<option value='approve'>".planet_constant('AM_APPROVE').'</option>'; |
|
335 | + echo "<option value='feature'>".planet_constant('AM_FEATURE').'</option>'; |
|
336 | + echo "<option value='update'>".planet_constant('AM_UPDATE').'</option>'; |
|
337 | 337 | |
338 | - echo "<option value='pending'>" . planet_constant('AM_PENDING') . '</option>'; |
|
339 | - echo "<option value='active'>" . planet_constant('AM_ACTIVE') . '</option>'; |
|
338 | + echo "<option value='pending'>".planet_constant('AM_PENDING').'</option>'; |
|
339 | + echo "<option value='active'>".planet_constant('AM_ACTIVE').'</option>'; |
|
340 | 340 | |
341 | 341 | echo '</select>'; |
342 | 342 | echo "<div id='catdiv' style='visibility:hidden;display:inline;'>"; |
343 | 343 | echo "<select name='category_dest'>"; |
344 | - echo "<option value=''>" . _SELECT . '</option>'; |
|
344 | + echo "<option value=''>"._SELECT.'</option>'; |
|
345 | 345 | foreach ($categories as $cid => $name) { |
346 | - echo "<option value='" . $cid . "'>" . $name . '</option>'; |
|
346 | + echo "<option value='".$cid."'>".$name.'</option>'; |
|
347 | 347 | } |
348 | 348 | echo '</select>'; |
349 | 349 | echo '</div>'; |
350 | - echo "<input name='start' value='" . $start . "' type='hidden'>"; |
|
351 | - echo "<input name='category' value='" . $category_id . "' type='hidden'>"; |
|
352 | - echo "<input name='submit' value='" . _SUBMIT . "' type='submit'>"; |
|
353 | - echo "<input name='' value='" . _CANCEL . "' type='reset'>"; |
|
350 | + echo "<input name='start' value='".$start."' type='hidden'>"; |
|
351 | + echo "<input name='category' value='".$category_id."' type='hidden'>"; |
|
352 | + echo "<input name='submit' value='"._SUBMIT."' type='submit'>"; |
|
353 | + echo "<input name='' value='"._CANCEL."' type='reset'>"; |
|
354 | 354 | echo '</td>'; |
355 | 355 | echo '</tr>'; |
356 | - if ($blog_count > $xoopsModuleConfig['list_perpage']) { |
|
357 | - include XOOPS_ROOT_PATH . '/class/pagenav.php'; |
|
358 | - $nav = new XoopsPageNav($blog_count, $xoopsModuleConfig['list_perpage'], $start, 'start', 'category=' . $category_id); |
|
356 | + if ($blog_count>$xoopsModuleConfig['list_perpage']) { |
|
357 | + include XOOPS_ROOT_PATH.'/class/pagenav.php'; |
|
358 | + $nav = new XoopsPageNav($blog_count, $xoopsModuleConfig['list_perpage'], $start, 'start', 'category='.$category_id); |
|
359 | 359 | $pagenav = $nav->renderNav(4); |
360 | - echo "<tr align='right'><td colspan='6'>" . $pagenav . '</td></tr>'; |
|
360 | + echo "<tr align='right'><td colspan='6'>".$pagenav.'</td></tr>'; |
|
361 | 361 | } |
362 | 362 | echo '</table></form>'; |
363 | 363 | echo "</fieldset><br style='clear:both;'>"; |
@@ -383,7 +383,7 @@ discard block |
||
383 | 383 | $button_tray->addElement($butt_cancel); |
384 | 384 | $form_add->addElement($button_tray); |
385 | 385 | |
386 | - echo "<fieldset><legend style='font-weight: bold; color: #900;'>" . _ADD . '</legend>'; |
|
386 | + echo "<fieldset><legend style='font-weight: bold; color: #900;'>"._ADD.'</legend>'; |
|
387 | 387 | echo '<br>'; |
388 | 388 | $form->display(); |
389 | 389 | $form_add->display(); |
@@ -105,7 +105,7 @@ |
||
105 | 105 | echo '</text><br>'; |
106 | 106 | echo '<label>' . planet_constant('AM_TOTAL_BLOGS') . ':</label><text>' . $blog_count; |
107 | 107 | if ($blog_count_pending > 0) { |
108 | - echo " (<font color=\"red\">" . $blog_count_pending . '</font>)'; |
|
108 | + echo " (<font color=\"red\">" . $blog_count_pending . '</font>)'; |
|
109 | 109 | } |
110 | 110 | echo '</text><br>'; |
111 | 111 | echo '<label>' . planet_constant('AM_TOTAL_ARTICLES') . ':</label><text>' . $article_count; |
@@ -24,7 +24,7 @@ discard block |
||
24 | 24 | // URL: https://xoops.org // |
25 | 25 | // Project: Article Project // |
26 | 26 | // ------------------------------------------------------------------------ // |
27 | -require_once __DIR__ . '/admin_header.php'; |
|
27 | +require_once __DIR__.'/admin_header.php'; |
|
28 | 28 | |
29 | 29 | xoops_cp_header(); |
30 | 30 | $adminObject = \Xmf\Module\Admin::getInstance(); |
@@ -50,12 +50,12 @@ discard block |
||
50 | 50 | </style> |
51 | 51 | "; |
52 | 52 | |
53 | -echo "<fieldset><legend style='font-weight: bold; color: #900;'>" . planet_constant('AM_PREFERENCES') . '</legend>'; |
|
53 | +echo "<fieldset><legend style='font-weight: bold; color: #900;'>".planet_constant('AM_PREFERENCES').'</legend>'; |
|
54 | 54 | echo "<div style='padding: 8px;'>"; |
55 | -echo '<label>' . '<strong>PHP Version:</strong>' . ':</label><text>' . PHP_VERSION . '</text><br>'; |
|
55 | +echo '<label>'.'<strong>PHP Version:</strong>'.':</label><text>'.PHP_VERSION.'</text><br>'; |
|
56 | 56 | //echo '<label>' . '<strong>MySQL Version:</strong>' . ':</label><text>' . mysqli_get_server_info() . '</text><br>'; |
57 | -echo '<label>' . '<strong>XOOPS Version:</strong>' . ':</label><text>' . XOOPS_VERSION . '</text><br>'; |
|
58 | -echo '<label>' . '<strong>Module Version:</strong>' . ':</label><text>' . $xoopsModule->getInfo('version') . '</text><br>'; |
|
57 | +echo '<label>'.'<strong>XOOPS Version:</strong>'.':</label><text>'.XOOPS_VERSION.'</text><br>'; |
|
58 | +echo '<label>'.'<strong>Module Version:</strong>'.':</label><text>'.$xoopsModule->getInfo('version').'</text><br>'; |
|
59 | 59 | echo '</div>'; |
60 | 60 | echo "<div style='padding: 8px;'>"; |
61 | 61 | //echo '<label>' . planet_constant('AM_SAFEMODE') . ':</label><text>'; |
@@ -67,31 +67,31 @@ discard block |
||
67 | 67 | //echo '<label>' . planet_constant('AM_MAGICQUOTESGPC') . ':</label><text>'; |
68 | 68 | //echo ini_get('magic_quotes_gpc') ? planet_constant('AM_ON') : planet_constant('AM_OFF'); |
69 | 69 | //echo '</text><br>'; |
70 | -echo '<label>' . planet_constant('AM_MAXPOSTSIZE') . ':</label><text>' . ini_get('post_max_size'); |
|
70 | +echo '<label>'.planet_constant('AM_MAXPOSTSIZE').':</label><text>'.ini_get('post_max_size'); |
|
71 | 71 | echo '</text><br>'; |
72 | -echo '<label>' . planet_constant('AM_MAXINPUTTIME') . ':</label><text>' . ini_get('max_input_time'); |
|
72 | +echo '<label>'.planet_constant('AM_MAXINPUTTIME').':</label><text>'.ini_get('max_input_time'); |
|
73 | 73 | echo '</text><br>'; |
74 | -echo '<label>' . planet_constant('AM_OUTPUTBUFFERING') . ':</label><text>' . ini_get('output_buffering'); |
|
74 | +echo '<label>'.planet_constant('AM_OUTPUTBUFFERING').':</label><text>'.ini_get('output_buffering'); |
|
75 | 75 | echo '</text><br>'; |
76 | -echo '<label>' . planet_constant('AM_XML_EXTENSION') . ':</label><text>'; |
|
76 | +echo '<label>'.planet_constant('AM_XML_EXTENSION').':</label><text>'; |
|
77 | 77 | echo extension_loaded('xml') ? planet_constant('AM_ON') : planet_constant('AM_OFF'); |
78 | 78 | echo '</text><br>'; |
79 | -echo '<label>' . planet_constant('AM_MB_EXTENSION') . ':</label><text>'; |
|
79 | +echo '<label>'.planet_constant('AM_MB_EXTENSION').':</label><text>'; |
|
80 | 80 | echo extension_loaded('mbstring') ? planet_constant('AM_ON') : planet_constant('AM_OFF'); |
81 | 81 | echo '</text><br>'; |
82 | -echo '<label>' . planet_constant('AM_CURL') . ':</label><text>'; |
|
82 | +echo '<label>'.planet_constant('AM_CURL').':</label><text>'; |
|
83 | 83 | echo function_exists('curl_init') ? planet_constant('AM_ON') : planet_constant('AM_OFF'); |
84 | 84 | echo '</text><br>'; |
85 | -echo '<label>' . planet_constant('AM_FSOCKOPEN') . ':</label><text>'; |
|
85 | +echo '<label>'.planet_constant('AM_FSOCKOPEN').':</label><text>'; |
|
86 | 86 | echo function_exists('fsockopen') ? planet_constant('AM_ON') : planet_constant('AM_OFF'); |
87 | 87 | echo '</text><br>'; |
88 | -echo '<label>' . planet_constant('AM_URLFOPEN') . ':</label><text>'; |
|
88 | +echo '<label>'.planet_constant('AM_URLFOPEN').':</label><text>'; |
|
89 | 89 | echo ini_get('allow_url_fopen') ? planet_constant('AM_ON') : planet_constant('AM_OFF'); |
90 | 90 | echo '</text><br>'; |
91 | 91 | echo '</div>'; |
92 | 92 | echo '</fieldset>'; |
93 | 93 | |
94 | -echo "<fieldset><legend style='font-weight: bold; color: #900;'>" . planet_constant('AM_STATS') . '</legend>'; |
|
94 | +echo "<fieldset><legend style='font-weight: bold; color: #900;'>".planet_constant('AM_STATS').'</legend>'; |
|
95 | 95 | echo "<div style='padding: 8px;'>"; |
96 | 96 | $categoryHandler = xoops_getModuleHandler('category', $GLOBALS['moddirname']); |
97 | 97 | $category_count = $categoryHandler->getCount(); |
@@ -101,14 +101,14 @@ discard block |
||
101 | 101 | $article_count = $articleHandler->getCount(); |
102 | 102 | $criteria = new Criteria('blog_status', 0); |
103 | 103 | $blog_count_pending = $blogHandler->getCount($criteria); |
104 | -echo '<label>' . planet_constant('AM_TOTAL_CATEGORIES') . ':</label><text>' . $category_count; |
|
104 | +echo '<label>'.planet_constant('AM_TOTAL_CATEGORIES').':</label><text>'.$category_count; |
|
105 | 105 | echo '</text><br>'; |
106 | -echo '<label>' . planet_constant('AM_TOTAL_BLOGS') . ':</label><text>' . $blog_count; |
|
107 | -if ($blog_count_pending > 0) { |
|
108 | - echo " (<font color=\"red\">" . $blog_count_pending . '</font>)'; |
|
106 | +echo '<label>'.planet_constant('AM_TOTAL_BLOGS').':</label><text>'.$blog_count; |
|
107 | +if ($blog_count_pending>0) { |
|
108 | + echo " (<font color=\"red\">".$blog_count_pending.'</font>)'; |
|
109 | 109 | } |
110 | 110 | echo '</text><br>'; |
111 | -echo '<label>' . planet_constant('AM_TOTAL_ARTICLES') . ':</label><text>' . $article_count; |
|
111 | +echo '<label>'.planet_constant('AM_TOTAL_ARTICLES').':</label><text>'.$article_count; |
|
112 | 112 | echo '</text><br>'; |
113 | 113 | echo '</div>'; |
114 | 114 | echo '</fieldset>'; |
@@ -25,11 +25,11 @@ |
||
25 | 25 | // Project: Article Project // |
26 | 26 | // ------------------------------------------------------------------------ // |
27 | 27 | |
28 | -require_once __DIR__ . '/../../../include/cp_header.php'; |
|
29 | -require XOOPS_ROOT_PATH . '/modules/' . $xoopsModule->getVar('dirname') . '/include/vars.php'; |
|
28 | +require_once __DIR__.'/../../../include/cp_header.php'; |
|
29 | +require XOOPS_ROOT_PATH.'/modules/'.$xoopsModule->getVar('dirname').'/include/vars.php'; |
|
30 | 30 | //require_once XOOPS_ROOT_PATH . '/modules/' . $xoopsModule->getVar('dirname') . '/include/functions.php'; |
31 | -require_once XOOPS_ROOT_PATH . '/Frameworks/art/functions.admin.php'; |
|
32 | -require_once __DIR__ . '/../class/utility.php'; |
|
31 | +require_once XOOPS_ROOT_PATH.'/Frameworks/art/functions.admin.php'; |
|
32 | +require_once __DIR__.'/../class/utility.php'; |
|
33 | 33 | $moduleDirName = basename(dirname(__DIR__)); |
34 | 34 | // include the default language file for the admin interface |
35 | 35 | xoops_loadLanguage('main', $moduleDirName); |