This project does not seem to handle request data directly as such no vulnerable execution paths were found.
include
, or for example
via PHP's auto-loading mechanism.
1 | <?php |
||
2 | /** |
||
3 | * Module: Soapbox |
||
4 | * Author: hsalazar |
||
5 | * Licence: GNU |
||
6 | */ |
||
7 | |||
8 | use Xmf\Request; |
||
9 | use XoopsModules\Soapbox; |
||
10 | |||
11 | // ---------- General Stuff ---------- // |
||
12 | require_once __DIR__ . '/admin_header.php'; |
||
13 | $adminObject = \Xmf\Module\Admin::getInstance(); |
||
14 | |||
15 | $op = ''; |
||
16 | if (\Xmf\Request::hasVar('op', 'GET')) { |
||
17 | $op = trim(strip_tags($myts->stripSlashesGPC($_GET['op']))); |
||
18 | } |
||
19 | if (\Xmf\Request::hasVar('op', 'POST')) { |
||
20 | $op = trim(strip_tags($myts->stripSlashesGPC($_POST['op']))); |
||
21 | } |
||
22 | |||
23 | //------------------------------------- |
||
24 | /** @var \XoopsModules\Soapbox\EntrydataHandler $entrydataHandler */ |
||
25 | $entrydataHandler = new \XoopsModules\Soapbox\EntrydataHandler(); |
||
26 | |||
27 | // -- Edit function -- // |
||
28 | /** |
||
29 | * @param string $articleID |
||
30 | */ |
||
31 | function editarticle($articleID = '') |
||
32 | { |
||
33 | global $indexAdmin; |
||
34 | global $xoopsUser, $xoopsConfig, $xoopsModule, $xoopsLogger, $xoopsOption, $xoopsUserIsAdmin; |
||
35 | /** @var Soapbox\Helper $helper */ |
||
36 | $helper = Soapbox\Helper::getInstance(); |
||
37 | |||
38 | $xoopsDB = \XoopsDatabaseFactory::getDatabaseConnection(); |
||
39 | $myts = \MyTextSanitizer::getInstance(); |
||
40 | |||
41 | if (file_exists(XOOPS_ROOT_PATH . '/language/' . $xoopsConfig['language'] . '/calendar.php')) { |
||
42 | require_once XOOPS_ROOT_PATH . '/language/' . $xoopsConfig['language'] . '/calendar.php'; |
||
43 | } else { |
||
44 | require_once XOOPS_ROOT_PATH . '/language/english/calendar.php'; |
||
45 | } |
||
46 | require_once XOOPS_ROOT_PATH . '/class/xoopsformloader.php'; |
||
47 | |||
48 | //------------------------------------- |
||
49 | /** @var \XoopsModules\Soapbox\EntrydataHandler $entrydataHandler */ |
||
50 | $entrydataHandler = new \XoopsModules\Soapbox\EntrydataHandler(); |
||
51 | |||
52 | if (!$articleID) { |
||
53 | redirect_header('index.php', 1, _AM_SOAPBOX_NOARTS); |
||
54 | } |
||
55 | //get entry object |
||
56 | $_entryob = $entrydataHandler->getArticle($articleID); |
||
57 | if (!is_object($_entryob)) { |
||
58 | redirect_header('index.php', 1, _AM_SOAPBOX_NOARTTOEDIT); |
||
0 ignored issues
–
show
Bug
introduced
by
![]() |
|||
59 | } |
||
60 | //get vars mode E |
||
61 | $entry_vars = $_entryob->getVars(); |
||
62 | foreach ($entry_vars as $k => $v) { |
||
63 | $e_articles[$k] = $_entryob->getVar($k, 'E'); |
||
64 | } |
||
65 | //xoops_cp_header(); |
||
66 | //$adminObject->displayNavigation(basename(__FILE__)); |
||
67 | |||
68 | // Module menu |
||
69 | //adminMenu(3, _AM_SOAPBOX_SUBMITS." > '". $_entryob->getVar('headline') ."'"); |
||
70 | |||
71 | // echo "<h3 style='color: #2F5376; '>" . _AM_SOAPBOX_SUBMITSMNGMT . "</h3>"; |
||
72 | $sform = new \XoopsThemeForm(_AM_SOAPBOX_AUTHART . ': ' . $_entryob->getVar('headline'), 'op', xoops_getenv('PHP_SELF'), 'post', true); |
||
73 | |||
74 | $sform->setExtra('enctype="multipart/form-data"'); |
||
75 | |||
76 | //get category object |
||
77 | $_categoryob = $entrydataHandler->getColumn($e_articles['columnID']); |
||
78 | if (is_object($_categoryob)) { |
||
79 | $sform->addElement(new \XoopsFormLabel(_AM_SOAPBOX_COLNAME, $_categoryob->getVar('name'))); |
||
80 | $sform->addElement(new \XoopsFormHidden('columnID', $e_articles['columnID'])); |
||
81 | } else { |
||
82 | $_can_editcategoryobArray = $entrydataHandler->getColumns(null, true); |
||
83 | //---------------------------- |
||
84 | $collist = []; |
||
85 | foreach ($_can_editcategoryobArray as $key => $_can_edit_categoryob) { |
||
86 | $collist[$key] = $_can_edit_categoryob->getVar('name'); |
||
87 | } |
||
88 | $col_select = new \XoopsFormSelect('', 'columnID', (int)$e_articles['columnID']); |
||
89 | $col_select->addOptionArray($collist); |
||
90 | $col_select_tray = new \XoopsFormElementTray(_AM_SOAPBOX_COLNAME, '<br>'); |
||
91 | $col_select_tray->addElement($col_select); |
||
92 | $sform->addElement($col_select_tray); |
||
93 | } |
||
94 | |||
95 | if (isset($headline)) { |
||
96 | $headline = $myts->htmlSpecialChars(stripslashes($headline)); |
||
97 | } |
||
98 | |||
99 | // HEADLINE, LEAD, BODYTEXT |
||
100 | // This part is common to edit/add |
||
101 | $sform->addElement(new \XoopsFormText(_AM_SOAPBOX_ARTHEADLINE, 'headline', 50, 50, $e_articles['headline']), true); |
||
102 | |||
103 | // LEAD |
||
104 | // $sform -> addElement( new \XoopsFormTextArea( _AM_SOAPBOX_ARTLEAD, 'lead', $lead, 5, 60 ) ); |
||
105 | // $editor_lead=soapbox_getWysiwygForm($helper->getConfig('editorUser') , _AM_SOAPBOX_ARTLEAD , 'lead' , $e_articles['lead'] , '100%', '200px'); |
||
106 | // $sform->addElement($editor_lead,true); |
||
107 | |||
108 | $editor_lead = new \XoopsFormElementTray(_AM_SOAPBOX_ARTLEAD, '<br>'); |
||
109 | if (class_exists('XoopsFormEditor')) { |
||
110 | $options['name'] = 'lead'; |
||
111 | $options['value'] = $e_articles['lead']; |
||
112 | $options['rows'] = 5; |
||
113 | $options['cols'] = '100%'; |
||
114 | $options['width'] = '100%'; |
||
115 | $options['height'] = '200px'; |
||
116 | $formmnote = new \XoopsFormEditor('', $helper->getConfig('editorUser'), $options, $nohtml = false, $onfailure = 'textarea'); |
||
117 | $editor_lead->addElement($formmnote); |
||
118 | } else { |
||
119 | $formmnote = new \XoopsFormDhtmlTextArea('', 'formmnote', $item->getVar('formmnote', 'e'), '100%', '100%'); |
||
120 | $editor_lead->addElement($formmnote); |
||
121 | } |
||
122 | $sform->addElement($editor_lead, false); |
||
123 | |||
124 | // TEASER |
||
125 | $sform->addElement(new \XoopsFormTextArea(_AM_SOAPBOX_ARTTEASER, 'teaser', $e_articles['teaser'], 10, 120)); |
||
126 | // $editor_teaser=soapbox_getWysiwygForm($helper->getConfig('editorUser') , _AM_SOAPBOX_ARTTEASER ,'teaser', $teaser , '100%', '120px'); |
||
127 | // $sform->addElement($editor_teaser,true); |
||
128 | // |
||
129 | $autoteaser_radio = new \XoopsFormRadioYN(_AM_SOAPBOX_AUTOTEASER, 'autoteaser', 0, ' ' . _AM_SOAPBOX_YES . '', ' ' . _AM_SOAPBOX_NO . ''); |
||
130 | $sform->addElement($autoteaser_radio); |
||
131 | $sform->addElement(new \XoopsFormText(_AM_SOAPBOX_AUTOTEASERAMOUNT, 'teaseramount', 4, 4, 100)); |
||
132 | |||
133 | // BODY |
||
134 | //HACK by domifara for Wysiwyg |
||
135 | // if (null !== ($helper->getConfig('editorUser')) ) { |
||
136 | // $editor=soapbox_getWysiwygForm($helper->getConfig('editorUser') , _AM_SOAPBOX_ARTBODY, 'bodytext', $e_articles['bodytext'], '100%', '400px'); |
||
137 | // $sform->addElement($editor,true); |
||
138 | // } else { |
||
139 | // $sform -> addElement( new \XoopsFormDhtmlTextArea( _AM_SOAPBOX_ARTBODY, 'bodytext', $e_articles['bodytext'], 20, 120 ) ); |
||
140 | // } |
||
141 | |||
142 | $optionsTrayNote = new \XoopsFormElementTray(_AM_SOAPBOX_ARTBODY, '<br>'); |
||
143 | if (class_exists('XoopsFormEditor')) { |
||
144 | $options['name'] = 'bodytext'; |
||
145 | $options['value'] = $e_articles['bodytext']; |
||
146 | $options['rows'] = 5; |
||
147 | $options['cols'] = '100%'; |
||
148 | $options['width'] = '100%'; |
||
149 | $options['height'] = '400px'; |
||
150 | $bodynote = new \XoopsFormEditor('', $helper->getConfig('editorUser'), $options, $nohtml = false, $onfailure = 'textarea'); |
||
151 | $optionsTrayNote->addElement($bodynote); |
||
152 | } else { |
||
153 | $bodynote = new \XoopsFormDhtmlTextArea('', 'formmnote', $item->getVar('formmnote', 'e'), '100%', '100%'); |
||
154 | $optionsTrayNote->addElement($bodynote); |
||
155 | } |
||
156 | $sform->addElement($optionsTrayNote, false); |
||
157 | |||
158 | // IMAGE |
||
159 | // The article CAN have its own image :) |
||
160 | // First, if the article's image doesn't exist, set its value to the blank file |
||
161 | |||
162 | if (empty($e_articles['artimage']) |
||
163 | || !file_exists(XOOPS_ROOT_PATH . '/' . $myts->htmlSpecialChars($helper->getConfig('sbuploaddir')) . '/' . $e_articles['artimage'])) { |
||
164 | $artimage = 'blank.png'; |
||
165 | } |
||
166 | |||
167 | // Code to create the image selector |
||
168 | $graph_array = \XoopsLists::getImgListAsArray(XOOPS_ROOT_PATH . '/' . $myts->htmlSpecialChars($helper->getConfig('sbuploaddir'))); |
||
169 | $artimage_select = new \XoopsFormSelect('', 'artimage', $e_articles['artimage']); |
||
170 | $artimage_select->addOptionArray($graph_array); |
||
171 | $artimage_select->setExtra("onchange='showImgSelected(\"image5\", \"artimage\", \"" . $myts->htmlSpecialChars($helper->getConfig('sbuploaddir')) . '", "", "' . XOOPS_URL . "\")'"); |
||
172 | $artimage_tray = new \XoopsFormElementTray(_AM_SOAPBOX_SELECT_IMG, ' '); |
||
173 | $artimage_tray->addElement($artimage_select); |
||
174 | $artimage_tray->addElement(new \XoopsFormLabel('', "<br><br><img src='" . XOOPS_URL . '/' . $myts->htmlSpecialChars($helper->getConfig('sbuploaddir')) . '/' . $e_articles['artimage'] . "' name='image5' id='image5' alt=''>")); |
||
175 | $sform->addElement($artimage_tray); |
||
176 | |||
177 | // Code to call the file browser to select an image to upload |
||
178 | $sform->addElement(new \XoopsFormFile(_AM_SOAPBOX_UPLOADIMAGE, 'cimage', (int)$helper->getConfig('maxfilesize')), false); |
||
179 | |||
180 | // WEIGHT |
||
181 | $sform->addElement(new \XoopsFormText(_AM_SOAPBOX_WEIGHT, 'weight', 4, 4, $e_articles['weight'])); |
||
182 | //---------- |
||
183 | // datesub |
||
184 | //---------- |
||
185 | $datesub_caption = $myts->htmlSpecialChars(formatTimestamp($e_articles['datesub'], $helper->getConfig('dateformat')) . '=>'); |
||
186 | $datesub_tray = new \XoopsFormDateTime(_AM_SOAPBOX_POSTED . '<br>' . $datesub_caption, 'datesub', 15, time()); |
||
187 | // you don't want to change datesub |
||
188 | $datesubnochage_checkbox = new \XoopsFormCheckBox(_AM_SOAPBOX_DATESUBNOCHANGE, 'datesubnochage', 0); |
||
189 | $datesubnochage_checkbox->addOption(1, _AM_SOAPBOX_YES); |
||
190 | $datesub_tray->addElement($datesubnochage_checkbox); |
||
191 | $sform->addElement($datesub_tray); |
||
192 | //----------- |
||
193 | |||
194 | // COMMENTS |
||
195 | if (isset($GLOBALS['xoopsModuleConfig']['globaldisplaycomments']) |
||
196 | && 1 === $GLOBALS['xoopsModuleConfig']['globaldisplaycomments']) { |
||
197 | // COMMENTS |
||
198 | // Code to allow comments |
||
199 | $addcommentable_radio = new \XoopsFormRadioYN(_AM_SOAPBOX_ALLOWCOMMENTS, 'commentable', $e_articles['commentable'], ' ' . _AM_SOAPBOX_YES . '', ' ' . _AM_SOAPBOX_NO . ''); |
||
200 | $sform->addElement($addcommentable_radio); |
||
201 | } |
||
202 | |||
203 | // OFFLINE |
||
204 | // Code to take article offline, for maintenance purposes |
||
205 | $offline_radio = new \XoopsFormRadioYN(_AM_SOAPBOX_SWITCHOFFLINE, 'offline', $e_articles['offline'], ' ' . _AM_SOAPBOX_YES . '', ' ' . _AM_SOAPBOX_NO . ''); |
||
206 | $sform->addElement($offline_radio); |
||
207 | |||
208 | // ARTICLE IN BLOCK |
||
209 | // Code to put article in block |
||
210 | $block_radio = new \XoopsFormRadioYN(_AM_SOAPBOX_BLOCK, 'block', $e_articles['block'], ' ' . _AM_SOAPBOX_YES . '', ' ' . _AM_SOAPBOX_NO . ''); |
||
211 | $sform->addElement($block_radio); |
||
212 | |||
213 | // notification public |
||
214 | $notifypub_radio = new \XoopsFormRadioYN(_AM_SOAPBOX_NOTIFY, 'notifypub', $e_articles['notifypub'], ' ' . _AM_SOAPBOX_YES . '', ' ' . _AM_SOAPBOX_NO . ''); |
||
215 | $sform->addElement($notifypub_radio); |
||
216 | |||
217 | // VARIOUS OPTIONS |
||
218 | //---------- |
||
219 | $options_tray = new \XoopsFormElementTray(_AM_SOAPBOX_OPTIONS, '<br>'); |
||
220 | |||
221 | $html_checkbox = new \XoopsFormCheckBox('', 'html', $e_articles['html']); |
||
222 | $html_checkbox->addOption(1, _AM_SOAPBOX_DOHTML); |
||
223 | $options_tray->addElement($html_checkbox); |
||
224 | |||
225 | $smiley_checkbox = new \XoopsFormCheckBox('', 'smiley', $e_articles['smiley']); |
||
226 | $smiley_checkbox->addOption(1, _AM_SOAPBOX_DOSMILEY); |
||
227 | $options_tray->addElement($smiley_checkbox); |
||
228 | |||
229 | $xcodes_checkbox = new \XoopsFormCheckBox('', 'xcodes', $e_articles['xcodes']); |
||
230 | $xcodes_checkbox->addOption(1, _AM_SOAPBOX_DOXCODE); |
||
231 | $options_tray->addElement($xcodes_checkbox); |
||
232 | |||
233 | $breaks_checkbox = new \XoopsFormCheckBox('', 'breaks', $e_articles['breaks']); |
||
234 | $breaks_checkbox->addOption(1, _AM_SOAPBOX_BREAKS); |
||
235 | $options_tray->addElement($breaks_checkbox); |
||
236 | |||
237 | $sform->addElement($options_tray); |
||
238 | //---------- |
||
239 | |||
240 | $sform->addElement(new \XoopsFormHidden('articleID', $e_articles['articleID'])); |
||
241 | |||
242 | $buttonTray = new \XoopsFormElementTray('', ''); |
||
243 | $hidden = new \XoopsFormHidden('op', 'authart'); |
||
244 | $buttonTray->addElement($hidden); |
||
245 | |||
246 | $butt_save = new \XoopsFormButton('', '', _AM_SOAPBOX_AUTHORIZE, 'submit'); |
||
247 | $butt_save->setExtra('onclick="this.form.elements.op.value=\'authart\'"'); |
||
248 | $buttonTray->addElement($butt_save); |
||
249 | |||
250 | $butt_cancel = new \XoopsFormButton('', '', _AM_SOAPBOX_CANCEL, 'button'); |
||
251 | $butt_cancel->setExtra('onclick="history.go(-1)"'); |
||
252 | $buttonTray->addElement($butt_cancel); |
||
253 | |||
254 | $sform->addElement($buttonTray); |
||
255 | //----------- |
||
256 | // $xoopsGTicket->addTicketXoopsFormElement($sform, __LINE__); |
||
257 | //----------- |
||
258 | $sform->display(); |
||
259 | unset($hidden); |
||
260 | } |
||
261 | |||
262 | /* -- Available operations -- */ |
||
263 | switch ($op) { |
||
264 | case 'mod': |
||
265 | require_once XOOPS_ROOT_PATH . '/class/xoopslists.php'; |
||
266 | require_once XOOPS_ROOT_PATH . '/class/xoopsformloader.php'; |
||
267 | xoops_cp_header(); |
||
268 | $adminObject->displayNavigation(basename(__FILE__)); |
||
269 | $articleID = Request::getInt('articleID', Request::getInt('articleID', 0, 'GET'), 'POST'); // (isset($_POST['articleID'])) ? (int)($_POST['articleID']) : (int)($_GET['articleID']); |
||
270 | editarticle($articleID); |
||
271 | Soapbox\Utility::showSubmissions(); |
||
272 | break; |
||
273 | case 'authart': |
||
274 | //------------------------- |
||
275 | if (!$GLOBALS['xoopsSecurity']->check()) { |
||
276 | redirect_header(XOOPS_URL . '/', 3, $GLOBALS['xoopsSecurity']->getErrors()); |
||
277 | } |
||
278 | //------------------------- |
||
279 | //articleID check |
||
280 | if (Request::hasVar('articleID', 'POST')) { |
||
281 | redirect_header('index.php', 1, _AM_SOAPBOX_ARTNOTCREATED); |
||
282 | } else { |
||
283 | $articleID = Request::getInt('articleID', 0, 'POST'); |
||
284 | } |
||
285 | //articleID check |
||
286 | if (Request::hasVar('columnID', 'POST')) { |
||
287 | redirect_header('index.php', 1, _AM_SOAPBOX_ARTNOTCREATED); |
||
288 | } else { |
||
289 | $columnID = Request::getInt('columnID', 0, 'POST'); |
||
290 | } |
||
291 | |||
292 | //get category object |
||
293 | $_categoryob = $entrydataHandler->getColumn($columnID); |
||
294 | if (!is_object($_categoryob)) { |
||
295 | redirect_header('index.php', 1, _AM_SOAPBOX_NEEDONECOLUMN); |
||
296 | } |
||
297 | |||
298 | $_entryob = $entrydataHandler->getArticle($articleID); |
||
299 | //new data or edit |
||
300 | if (!is_object($_entryob)) { |
||
301 | redirect_header('index.php', 1, _AM_SOAPBOX_ARTAUTHORIZED); |
||
302 | } |
||
303 | |||
304 | if (Request::hasVar('articleID', 'POST')) { |
||
305 | $_entryob->setVar('articleID', $articleID); |
||
306 | } |
||
307 | |||
308 | if (Request::hasVar('columnID', 'POST')) { |
||
309 | $_entryob->setVar('columnID', $columnID); |
||
310 | } |
||
311 | |||
312 | if (Request::hasVar('weight', 'POST')) { |
||
313 | $_entryob->setVar('weight', Request::getInt('weight', 0, 'POST')); |
||
314 | } |
||
315 | |||
316 | if (Request::hasVar('commentable', 'POST')) { |
||
317 | $_entryob->setVar('commentable', Request::getInt('commentable', 0, 'POST')); |
||
318 | } |
||
319 | |||
320 | if (Request::hasVar('block', 'POST')) { |
||
321 | $_entryob->setVar('block', Request::getInt('block', 0, 'POST')); |
||
322 | } |
||
323 | |||
324 | if (Request::hasVar('offline', 'POST')) { |
||
325 | $_entryob->setVar('offline', Request::getInt('offline', 0, 'POST')); |
||
326 | } |
||
327 | |||
328 | if (Request::hasVar('notifypub', 'POST')) { |
||
329 | $_entryob->setVar('notifypub', Request::getInt('notifypub', 0, 'POST')); |
||
330 | } |
||
331 | |||
332 | //datesub |
||
333 | |||
334 | $datesubnochage = Request::getInt('datesubnochage', 0, 'POST'); |
||
335 | |||
336 | // $datesub_date_sl = isset($_POST['datesub']) ? (int)strtotime($_POST['datesub']['date']) : 0; |
||
337 | // $datesub_time_sl = isset($_POST['datesub']) ? (int)$_POST['datesub']['time'] : 0; |
||
338 | // $datesub = isset($_POST['datesub']) ? $datesub_date_sl + $datesub_time_sl : 0; |
||
339 | $temp = Request::getArray('datesub', null, 'POST'); // get a clean array |
||
340 | $datesub = null !== $temp ? strtotime($temp['date']) + $temp['time'] : 0; // put the pieces back together |
||
341 | |||
342 | if (!$datesub || $_entryob->_isNew) { |
||
343 | $_entryob->setVar('datesub', time()); |
||
344 | } else { |
||
345 | if (!$datesubnochage) { |
||
346 | $_entryob->setVar('datesub', $datesub); |
||
347 | } |
||
348 | } |
||
349 | |||
350 | if (Request::hasVar('html', 'POST')) { |
||
351 | $_entryob->setVar('html', Request::getInt('html', 0, 'POST')); |
||
352 | } |
||
353 | |||
354 | if (Request::hasVar('smiley', 'POST')) { |
||
355 | $_entryob->setVar('smiley', Request::getInt('smiley', 0, 'POST')); |
||
356 | } |
||
357 | |||
358 | if (Request::hasVar('xcodes', 'POST')) { |
||
359 | $_entryob->setVar('xcodes', Request::getInt('xcodes', 0, 'POST')); |
||
360 | } |
||
361 | if (Request::hasVar('breaks', 'POST')) { |
||
362 | $_entryob->setVar('breaks', Request::getInt('breaks', 0, 'POST')); |
||
363 | } |
||
364 | if (Request::hasVar('artimage', 'POST')) { |
||
365 | $_entryob->setVar('artimage', Request::getInt('artimage', 0, 'POST')); |
||
366 | } |
||
367 | |||
368 | if (Request::hasVar('headline', 'POST')) { |
||
369 | $_entryob->setVar('headline', Request::getString('headline', '', 'POST')); |
||
370 | } |
||
371 | if (Request::hasVar('lead', 'POST')) { |
||
372 | $_entryob->setVar('lead', Request::getText('lead', '', 'POST')); |
||
373 | } |
||
374 | if (Request::hasVar('bodytext', 'POST')) { |
||
375 | $_entryob->setVar('bodytext', Request::getText('bodytext', '', 'POST')); |
||
376 | } |
||
377 | if (Request::hasVar('votes', 'POST')) { |
||
378 | $_entryob->setVar('votes', Request::getInt('votes', 0, 'POST')); |
||
379 | } |
||
380 | |||
381 | if (Request::hasVar('rating', 'POST')) { |
||
382 | $_entryob->setVar('rating', Request::getInt('rating', 0, 'POST')); |
||
383 | } |
||
384 | if (Request::hasVar('teaser', 'POST')) { |
||
385 | $_entryob->setVar('teaser', Request::getInt('teaser', 0, 'POST')); |
||
386 | } |
||
387 | |||
388 | $autoteaser = Request::getInt('autoteaser', 0, 'POST'); |
||
389 | $charlength = Request::getInt('teaseramount', 0, 'POST'); |
||
390 | if ($autoteaser && $charlength) { |
||
391 | $_entryob->setVar('teaser', xoops_substr($_entryob->getVar('bodytext', 'none'), 0, $charlength)); |
||
392 | } |
||
393 | |||
394 | $_entryob->setVar('submit', 0); |
||
395 | // Save to database |
||
396 | if (!$entrydataHandler->insertArticle($_entryob)) { |
||
397 | redirect_header('index.php', 1, _AM_SOAPBOX_ARTNOTUPDATED); |
||
398 | } else { |
||
399 | // Notify of to admin only for approve |
||
400 | $entrydataHandler->newArticleTriggerEvent($_entryob, 'approve'); |
||
401 | redirect_header('index.php', 1, _AM_SOAPBOX_ARTAUTHORIZED); |
||
402 | } |
||
403 | break; |
||
404 | case 'del': |
||
405 | |||
406 | $confirm = Request::getInt('confirm', 0, 'POST'); |
||
407 | |||
408 | // confirmed, so delete |
||
409 | if (1 === $confirm) { |
||
410 | //------------------------- |
||
411 | if (!$GLOBALS['xoopsSecurity']->check()) { |
||
412 | redirect_header(XOOPS_URL . '/', 3, $GLOBALS['xoopsSecurity']->getErrors()); |
||
413 | } |
||
414 | //------------------------- |
||
415 | //articleID check |
||
416 | if (!Request::hasVar('articleID', 'POST')) { |
||
417 | redirect_header('index.php', 1, _NOPERM); |
||
418 | } else { |
||
419 | $articleID = Request::getInt('articleID', 0, 'POST'); |
||
420 | } |
||
421 | |||
422 | $_entryob = $entrydataHandler->getArticle($articleID); |
||
423 | if (!is_object($_entryob)) { |
||
424 | redirect_header('index.php', 1, _NOPERM); |
||
425 | } |
||
426 | //------------- |
||
427 | if (!$entrydataHandler->deleteArticle($_entryob)) { |
||
428 | trigger_error('ERROR:not deleted from database'); |
||
429 | exit(); |
||
430 | } |
||
431 | $headline = $myts->htmlSpecialChars($_entryob->getVar('headline')); |
||
432 | redirect_header('index.php', 1, sprintf(_AM_SOAPBOX_ARTISDELETED, $headline)); |
||
433 | } else { |
||
434 | $articleID = Request::getInt('articleID', Request::getInt('articleID', 0, 'GET'), 'POST'); |
||
435 | $_entryob = $entrydataHandler->getArticle($articleID); |
||
436 | if (!is_object($_entryob)) { |
||
437 | redirect_header('index.php', 1, _NOPERM); |
||
438 | } |
||
439 | $headline = $myts->htmlSpecialChars($_entryob->getVar('headline')); |
||
440 | xoops_cp_header(); |
||
441 | $adminObject->displayNavigation(basename(__FILE__)); |
||
442 | xoops_confirm([ |
||
443 | 'op' => 'del', |
||
444 | 'articleID' => $articleID, |
||
445 | 'confirm' => 1, |
||
446 | 'headline' => $headline, |
||
447 | ], 'article.php', _AM_SOAPBOX_DELETETHISARTICLE . '<br><br>' . $headline, _AM_SOAPBOX_DELETE); |
||
448 | require_once __DIR__ . '/admin_footer.php'; |
||
449 | } |
||
450 | exit(); |
||
451 | break; |
||
452 | case 'default': |
||
453 | default: |
||
454 | |||
455 | xoops_cp_header(); |
||
456 | //adminMenu(3, _AM_SOAPBOX_SUBMITS); |
||
457 | $adminObject->displayNavigation(basename(__FILE__)); |
||
458 | echo '<br>'; |
||
459 | Soapbox\Utility::showSubmissions(); |
||
460 | require_once __DIR__ . '/admin_footer.php'; |
||
461 | exit(); |
||
462 | break; |
||
463 | } |
||
464 | require_once __DIR__ . '/admin_footer.php'; |
||
465 |