MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. */ /** * @copyright The XUUPS Project http://sourceforge.net/projects/xuups/ * @license http://www.fsf.org/copyleft/gpl.html GNU public license * @package Admin * @subpackage Action * @since 1.0 * @author trabis <*****@*****.**> * @author The SmartFactory <www.smartfactory.ca> * @version $Id$ */ include_once dirname(__FILE__) . '/admin_header.php'; $itemid = PublisherRequest::getInt('itemid'); $op = $itemid > 0 || isset($_POST['editor']) ? 'mod' : ''; $op = PublisherRequest::getString('op', $op); if (isset($_POST['additem'])) { $op = 'additem'; } else { if (isset($_POST['del'])) { $op = 'del'; } } // Where shall we start ? $submittedstartitem = PublisherRequest::getInt('submittedstartitem'); $publishedstartitem = PublisherRequest::getInt('publishedstartitem'); $offlinestartitem = PublisherRequest::getInt('offlinestartitem'); $rejectedstartitem = PublisherRequest::getInt('rejectedstartitem'); switch ($op) { case "clone": if ($itemid == 0) {
$xoopsConfig["module_cache"][$module_id] = 0; $xoopsOption["template_main"] = 'publisher_search.html'; include XOOPS_ROOT_PATH . '/header.php'; $module_info_search = $publisher->getModule()->getInfo("search"); include_once PUBLISHER_ROOT_PATH . "/" . $module_info_search["file"]; $limit = 10; //$publisher->getConfig('idxcat_perpage'); $uid = 0; $queries = array(); $andor = PublisherRequest::getString('andor'); $start = PublisherRequest::getInt('start'); $category = PublisherRequest::getArray('category'); $username = PublisherRequest::getString('uname'); $searchin = PublisherRequest::getArray('searchin'); $sortby = PublisherRequest::getString('sortby'); $term = PublisherRequest::getString('term'); if (empty($category) || is_array($category) && in_array("all", $category)) { $category = array(); } else { $category = !is_array($category) ? explode(",", $category) : $category; $category = array_map("intval", $category); } $andor = in_array(strtoupper($andor), array("OR", "AND", "EXACT")) ? strtoupper($andor) : "OR"; $sortby = in_array(strtolower($sortby), array("itemid", "datesub", "title", "categoryid")) ? strtolower($sortby) : "itemid"; if (!(empty($_POST["submit"]) && empty($term))) { $next_search["category"] = implode(",", $category); $next_search["andor"] = $andor; $next_search["term"] = $term; $query = trim($term); if ($andor != "EXACT") { $ignored_queries = array();
/** * The name says it all */ public function setVarsFromRequest() { //Required fields if (isset($_REQUEST['categoryid'])) { $this->setVar('categoryid', PublisherRequest::getInt('categoryid')); } if (isset($_REQUEST['title'])) { $this->setVar('title', PublisherRequest::getString('title')); } if (isset($_REQUEST['body'])) { $this->setVar('body', PublisherRequest::getText('body')); } //Not required fields if (isset($_REQUEST['summary'])) { $this->setVar('summary', PublisherRequest::getText('summary')); } if (isset($_REQUEST['subtitle'])) { $this->setVar('subtitle', PublisherRequest::getString('subtitle')); } if (isset($_REQUEST['item_tag'])) { $this->setVar('item_tag', PublisherRequest::getString('item_tag')); } if (isset($_REQUEST['image_featured'])) { $image_item = PublisherRequest::getArray('image_item'); $image_featured = PublisherRequest::getString('image_featured'); //Todo: get a better image class for xoops! //Image hack $image_item_ids = array(); global $xoopsDB; $sql = 'SELECT image_id, image_name FROM ' . $xoopsDB->prefix('image'); $result = $xoopsDB->query($sql, 0, 0); while ($myrow = $xoopsDB->fetchArray($result)) { $image_name = $myrow['image_name']; $id = $myrow['image_id']; if ($image_name == $image_featured) { $this->setVar('image', $id); } if (in_array($image_name, $image_item)) { $image_item_ids[] = $id; } } $this->setVar('images', implode('|', $image_item_ids)); } if (isset($_REQUEST['uid'])) { $this->setVar('uid', PublisherRequest::getInt('uid')); } elseif ($this->isnew()) { $this->setVar('uid', is_object($GLOBALS['xoopsUser']) ? $GLOBALS['xoopsUser']->uid() : 0); } if (isset($_REQUEST['author_alias'])) { $this->setVar('author_alias', PublisherRequest::getString('author_alias')); if ($this->getVar('autor_alias') != '') { $this->setVar('uid', 0); } } if (isset($_REQUEST['datesub'])) { $this->setVar('datesub', strtotime($_REQUEST['datesub']['date']) + $_REQUEST['datesub']['time']); } elseif ($this->isnew()) { $this->setVar('datesub', time()); } if (isset($_REQUEST['item_short_url'])) { $this->setVar('short_url', PublisherRequest::getString('item_short_url')); } if (isset($_REQUEST['item_meta_keywords'])) { $this->setVar('meta_keywords', PublisherRequest::getString('item_meta_keywords')); } if (isset($_REQUEST['item_meta_description'])) { $this->setVar('meta_description', PublisherRequest::getString('item_meta_description')); } if (isset($_REQUEST['weight'])) { $this->setVar('weight', PublisherRequest::getInt('weight')); } if (isset($_REQUEST['allowcomments'])) { $this->setVar('cancomment', PublisherRequest::getInt('allowcomments')); } elseif ($this->isnew()) { $this->setVar('cancoment', $this->publisher->getConfig('submit_allowcomments')); } if (isset($_REQUEST['status'])) { $this->setVar('status', PublisherRequest::getInt('status')); } elseif ($this->isnew()) { $this->setVar('status', $this->publisher->getConfig('submit_status')); } if (isset($_REQUEST['dohtml'])) { $this->setVar('dohtml', PublisherRequest::getInt('dohtml')); } elseif ($this->isnew()) { $this->setVar('dohtml', $this->publisher->getConfig('submit_dohtml')); } if (isset($_REQUEST['dosmiley'])) { $this->setVar('dosmiley', PublisherRequest::getInt('dosmiley')); } elseif ($this->isnew()) { $this->setVar('dosmiley', $this->publisher->getConfig('submit_dosmiley')); } if (isset($_REQUEST['doxcode'])) { $this->setVar('doxcode', PublisherRequest::getInt('doxcode')); } elseif ($this->isnew()) { $this->setVar('doxcode', $this->publisher->getConfig('submit_doxcode')); } if (isset($_REQUEST['doimage'])) { $this->setVar('doimage', PublisherRequest::getInt('doimage')); } elseif ($this->isnew()) { $this->setVar('doimage', $this->publisher->getConfig('submit_doimage')); } if (isset($_REQUEST['dolinebreak'])) { $this->setVar('dobr', PublisherRequest::getInt('dolinebreak')); } elseif ($this->isnew()) { $this->setVar('dobr', $this->publisher->getConfig('submit_dobr')); } if (isset($_REQUEST['notify'])) { $this->setVar('notifypub', PublisherRequest::getInt('notify')); } }
// FILES UPLOAD FORM $files_form = $fileObj->getForm(); $files_form->display(); break; case "modify": $fileid = isset($_POST['fileid']) ? intval($_POST['fileid']) : 0; // Creating the file object if ($fileid != 0) { $fileObj = $publisher->getHandler('file')->get($fileid); } else { redirect_header("index.php", 1, _NOPERM); exit; } // Putting the values in the file object $fileObj->setVar('name', PublisherRequest::getString('name')); $fileObj->setVar('description', PublisherRequest::getString('description')); $fileObj->setVar('status', PublisherRequest::getInt('file_status')); // attach file if any if (isset($_FILES['item_upload_file']) && $_FILES['item_upload_file']['name'] != "") { $oldfile = $fileObj->getFilePath(); // Get available mimetypes for file uploading $allowed_mimetypes = $publisher->getHandler('mimetype')->getArrayByType(); // TODO : display the available mimetypes to the user $errors = array(); if ($publisher->getConfig('perm_upload') && is_uploaded_file($_FILES['item_upload_file']['tmp_name'])) { if ($fileObj->checkUpload('item_upload_file', $allowed_mimetypes, $errors)) { if ($fileObj->storeUpload('item_upload_file', $allowed_mimetypes, $errors)) { unlink($oldfile); } } }