示例#1
0
 /**
  * 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'));
     }
 }
示例#2
0
    exit;
}
$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);