Exemplo n.º 1
0
function b_user_topusers_show($options)
{
    $block = array();
    $criteria = new CriteriaCompo(new Criteria('level', 0, '>'));
    $limit = (!empty($options[0])) ? $options[0] : 10;
    $size = count($options);
    for ( $i = 2; $i < $size; $i++) {
        $criteria->add(new Criteria('rank', $options[$i], '<>'));
    }
    $criteria->setOrder('DESC');
    $criteria->setSort('posts');
    $criteria->setLimit($limit);
    $member_handler =& xoops_gethandler('member');
    $topposters =& $member_handler->getUsers($criteria);
    $count = count($topposters);
    for ($i = 0; $i < $count; $i++) {
        $block['users'][$i]['rank'] = $i+1;
        if ( $options[1] == 1 ) {
            $block['users'][$i]['avatar'] = $topposters[$i]->getVar('user_avatar') != 'blank.gif' ? XOOPS_UPLOAD_URL.'/'.$topposters[$i]->getVar('user_avatar') : '';
        } else {
            $block['users'][$i]['avatar'] = '';
        }
        $block['users'][$i]['id'] = $topposters[$i]->getVar('uid');
        $block['users'][$i]['name'] = $topposters[$i]->getVar('uname');
        $block['users'][$i]['posts'] = $topposters[$i]->getVar('posts');
    }
    return $block;
}
Exemplo n.º 2
0
function showcaseComponentsShow($options)
{
    include XOOPS_ROOT_PATH . "/modules/spotlight/components/showcase/config.php";
    $sp_handler =& xoops_getmodulehandler('spotlight', 'spotlight');
    $page_handler =& xoops_getmodulehandler('page', 'spotlight');
    // spotlight object
    $sp_obj = $sp_handler->get($options[0]);
    if (!is_object($sp_obj) || empty($options[0])) {
        trigger_error("spotlight is not object ", E_USER_WARNING);
    } else {
        //spotlight name
        $block['sp_name'] = $sp_obj->getVar('sp_name');
        // page list
        $criteria = new CriteriaCompo();
        $criteria->add(new Criteria('sp_id', $options[0]));
        $criteria->setLimit($config['limit']);
        $criteria->setSort($config['sort']);
        $criteria->setOrder('ASC');
        $pages = $page_handler->getAll($criteria, array('page_id', 'page_title', 'page_link', 'page_image', 'page_desc', 'published'), false);
        $myts = MyTextSanitizer::getInstance();
        foreach ($pages as $k => $v) {
            $block['news'][$k] = $v;
            $block['news'][$k]['images'] = XOOPS_UPLOAD_URL . '/spotlight/image_' . $v['page_image'];
            $block['news'][$k]['thumbs'] = XOOPS_UPLOAD_URL . '/spotlight/thumb_' . $v['page_image'];
            $page_desc = strip_tags($myts->undoHtmlSpecialChars(strip_tags($v['page_desc'])));
            $block['news'][$k]['page_desc'] = xoops_substr($page_desc, '', $config['page_desc_substr']);
            $block['news'][$k]['page_title'] = xoops_substr($v['page_title'], '', $config['page_title_substr']);
            $block['news'][$k]['published'] = formatTimestamp($v['published'], $config['timeformat']);
        }
        // component name
        $block['component'] = $sp_obj->getVar('component_name');
        return $block;
    }
}
Exemplo n.º 3
0
function flash3ComponentsShow($options)
{
    global $xoopsModuleConfig;
    include_once dirname(__FILE__) . "/config.php";
    $sp_handler =& xoops_getmodulehandler('spotlight', 'spotlight');
    $page_handler =& xoops_getmodulehandler('page', 'spotlight');
    // spotlight object
    $sp_obj = $sp_handler->get($options[0]);
    if (!is_object($sp_obj) || empty($options[0])) {
        trigger_error("spotlight is not object ", E_USER_WARNING);
    } else {
        //spotlight name
        $block['sp_name'] = $sp_obj->getVar('sp_name');
    }
    $criteria = new CriteriaCompo();
    $criteria->add(new Criteria('sp_id', $options[0]));
    $criteria->setLimit(5);
    $criteria->setSort('page_order');
    $criteria->setOrder('ASC');
    $pages = $page_handler->getAll($criteria, array('page_id', 'page_title', 'page_link', 'page_image', 'page_desc'), false);
    foreach ($pages as $k => $v) {
        $block['title'][] = $v['page_title'];
        $block['url'][] = $v['page_link'];
        $block['images'][] = XOOPS_UPLOAD_URL . '/spotlight/' . 'thumb_' . $v['page_image'];
    }
    $block['catid'] = $options[0];
    $block['catname'] = $block['sp_name'];
    $block['type'] = 3;
    $block['title'] = implode('|', $block['title']);
    $block['url'] = implode('|', $block['url']);
    $block['images'] = implode('|', $block['images']);
    $block['component'] = $sp_obj->getVar('component_name');
    // xoops_result($block);
    return $block;
}
Exemplo n.º 4
0
/**
 * @param $options
 * @return array
 */
function alumni_show($options)
{
    $block = array();
    $myts = MyTextSanitizer::getInstance();
    $xoops = Xoops::getInstance();
    $helper = $xoops->getModuleHelper('alumni');
    $module_id = $helper->getModule()->getVar('mid');
    $listingHandler = $helper->getHandler('listing');
    $groups = $xoops->getUserGroups();
    $alumni_ids = $xoops->getHandlerGroupPermission()->getItemIds('alumni_view', $groups, $module_id);
    $all_ids = implode(', ', $alumni_ids);
    $criteria = new CriteriaCompo();
    $criteria->add(new Criteria('valid', 1, '='));
    $criteria->add(new Criteria('cid', '(' . $all_ids . ')', 'IN'));
    $criteria->setLimit($options[1]);
    $criteria->setSort('date');
    $criteria->setOrder('DESC');
    $block_listings = $listingHandler->getall($criteria);
    foreach (array_keys($block_listings) as $i) {
        $name = $block_listings[$i]->getVar('name');
        $mname = $block_listings[$i]->getVar('mname');
        $lname = $block_listings[$i]->getVar('lname');
        $school = $block_listings[$i]->getVar('school');
        $year = $block_listings[$i]->getVar('year');
        $view = $block_listings[$i]->getVar('view');
        $a_item = array();
        $a_item['school'] = $school;
        $a_item['link'] = '<a href="' . XOOPS_URL . "/modules/alumni/listing.php?lid=" . addslashes($block_listings[$i]->getVar('lid')) . "\"><b>{$year}&nbsp;-&nbsp;{$name} {$mname} {$lname}</b><br /></a>";
        $block['items'][] = $a_item;
    }
    $block['lang_title'] = AlumniLocale::BLOCKS_ITEM;
    $block['lang_date'] = AlumniLocale::BLOCKS_DATE;
    $block['link'] = "<a href=\"" . XOOPS_URL . "/modules/alumni/index.php\"><b>" . AlumniLocale::BLOCKS_ALL_LISTINGS . "</b></a></div>";
    return $block;
}
Exemplo n.º 5
0
/**
 * xoopsfaq_search()
 *
 * @param mixed $queryarray
 * @param mixed $andor
 * @param mixed $limit
 * @param mixed $offset
 * @param mixed $userid
 * @return
 */
function xoopsfaq_search($queryarray, $andor, $limit, $offset, $userid)
{
    global $xoopsDB;
    $ret = array();
    if ($userid != 0) {
        return $ret;
    }
    $xfDir = basename(dirname(dirname(__FILE__)));
    $xfContentsHandler =& xoops_getmodulehandler('contents', $xfDir);
    $contentFields = array('contents_id', 'contents_cid', 'contents_title', 'contents_contents', 'contents_publish');
    $criteria = new CriteriaCompo();
    $criteria->add(new Criteria('contents_active', 1, '='));
    $criteria->setSort('contents_id');
    $criteria->setOrder('DESC');
    $criteria->setLimit(intval($limit));
    $criteria->setStart(intval($offset));
    if (is_array($queryarray) && !empty($queryarray)) {
        $criteria->add(new Criteria('contents_title', "%{$queryarray[0]}%", 'LIKE'));
        $criteria->add(new Criteria('contents_contents', "%{$queryarray[0]}%", 'LIKE'), 'OR');
        array_shift($queryarray);
        //get rid of first element
        foreach ($queryarray as $query) {
            $criteria->add(new Criteria('contents_title', "%{$query}%", 'LIKE'), $andor);
            $criteria->add(new Criteria('contents_contents', "%{$query}%", 'LIKE'), 'OR');
        }
    }
    $contentArray = $xfContentsHandler->getAll($criteria, $contentFields, false);
    foreach ($contentArray as $content) {
        $ret[] = array('image' => 'images/question2.gif', 'link' => "index.php?cat_id=" . $content['contents_cid'] . "#" . $content['contents_id'], 'title' => $content['contents_title'], 'time' => $content['contents_publish']);
    }
    unset($contentArray);
    return $ret;
}
Exemplo n.º 6
0
function ifocusComponentsShow($options)
{
    include_once XOOPS_ROOT_PATH . "/modules/spotlight/components/ifocus/config.php";
    $sp_handler =& xoops_getmodulehandler('spotlight', 'spotlight');
    $page_handler =& xoops_getmodulehandler('page', 'spotlight');
    // spotlight object
    $sp_obj = $sp_handler->get($options[0]);
    if (!is_object($sp_obj) || empty($options[0])) {
        trigger_error("spotlight is not object ", E_USER_WARNING);
    } else {
        //spotlight name
        $block['sp_name'] = $sp_obj->getVar('sp_name');
        // page list
        $criteria = new CriteriaCompo();
        $criteria->add(new Criteria('sp_id', $options[0]));
        $criteria->setLimit($config['limit']);
        $criteria->setSort($config['sort']);
        $criteria->setOrder('ASC');
        $pages = $page_handler->getAll($criteria, array('page_id', 'page_title', 'page_link', 'page_image', 'page_desc'), false);
        foreach ($pages as $k => $v) {
            $block['news'][$k] = $v;
            $block['news'][$k]['images'] = XOOPS_UPLOAD_URL . '/spotlight/image_' . $v['page_image'];
            $block['news'][$k]['thumbs'] = XOOPS_UPLOAD_URL . '/spotlight/thumb_' . $v['page_image'];
        }
        // component name
        $block['component'] = $sp_obj->getVar('component_name');
        return $block;
    }
}
Exemplo n.º 7
0
 /**
  * Constructor
  *
  * @param    string    $caption
  * @param    string    $name
  * @param    mixed    $value            Pre-selected value (or array of them).
  *                                    For an item with massive members, such as "Registered Users", "$value" should be used to store selected temporary users only instead of all members of that item
  * @param    bool    $include_anon    Include user "anonymous"?
  * @param    int        $size            Number or rows. "1" makes a drop-down-list.
  * @param    bool    $multiple       Allow multiple selections?
  */
 function __construct($caption, $name, $include_anon = false, $value = null, $size = 1, $multiple = false)
 {
     $limit = 200;
     $select_element = new Xmf_Form_Element_Select("", $name, $value, $size, $multiple);
     if ($include_anon) {
         $select_element->addOption(0, $GLOBALS["xoopsConfig"]['anonymous']);
     }
     $member_handler =& xoops_gethandler('member');
     $user_count = $member_handler->getUserCount();
     $value = is_array($value) ? $value : (empty($value) ? array() : array($value));
     if ($user_count > $limit && count($value) > 0) {
         $criteria = new CriteriaCompo(new Criteria("uid", "(" . implode(",", $value) . ")", "IN"));
     } else {
         $criteria = new CriteriaCompo();
         $criteria->setLimit($limit);
     }
     $criteria->setSort('uname');
     $criteria->setOrder('ASC');
     $users = $member_handler->getUserList($criteria);
     $select_element->addOptionArray($users);
     if ($user_count <= $limit) {
         parent::__construct($caption, "", $name);
         $this->addElement($select_element);
         return;
     }
     xoops_loadLanguage("findusers");
     $js_addusers = "<script type=\"text/javascript\">\r\n            function addusers(opts){\r\n                var num = opts.substring(0, opts.indexOf(\":\"));\r\n                opts = opts.substring(opts.indexOf(\":\")+1, opts.length);\r\n                var sel = xoopsGetElementById(\"" . $name . ($multiple ? "[]" : "") . "\");\r\n                var arr = new Array(num);\r\n                for (var n=0; n < num; n++) {\r\n                    var nm = opts.substring(0, opts.indexOf(\":\"));\r\n                    opts = opts.substring(opts.indexOf(\":\")+1, opts.length);\r\n                    var val = opts.substring(0, opts.indexOf(\":\"));\r\n                    opts = opts.substring(opts.indexOf(\":\")+1, opts.length);\r\n                    var txt = opts.substring(0, nm - val.length);\r\n                    opts = opts.substring(nm - val.length, opts.length);\r\n                    var added = false;\r\n                    for (var k = 0; k < sel.options.length; k++) {\r\n                        if(sel.options[k].value == val){\r\n                            added = true;\r\n                            break;\r\n                        }\r\n                    }\r\n                    if (added == false) {\r\n                        sel.options[k] = new Option(txt, val);\r\n                        sel.options[k].selected = true;\r\n                    }\r\n                }\r\n                return true;\r\n            }\r\n            </script>";
     $token = $GLOBALS['xoopsSecurity']->createToken();
     $action_tray = new Xmf_Form_Element_Tray("", " | ");
     $action_tray->addElement(new Xmf_Form_Element_Label('', "<a href='#' onclick='var sel = xoopsGetElementById(\"" . $name . ($multiple ? "[]" : "") . "\");for (var i = sel.options.length-1; i >= 0; i--) {if (!sel.options[i].selected) {sel.options[i] = null;}}; return false;'>" . _MA_USER_REMOVE . "</a>"));
     $action_tray->addElement(new Xmf_Form_Element_Label('', "<a href='#' onclick='openWithSelfMain(\"" . XOOPS_URL . "/include/findusers.php?target={$name}&amp;multiple={$multiple}&amp;token={$token}\", \"userselect\", 800, 600, null); return false;' >" . _MA_USER_MORE . "</a>" . $js_addusers));
     parent::__construct($caption, "<br /><br />", $name);
     $this->addElement($select_element);
     $this->addElement($action_tray);
 }
Exemplo n.º 8
0
 /**
  * Constructor
  *
  * @param string $caption
  * @param string $name
  * @param mixed $value Pre-selected value (or array of them).
  *                                                 For an item with massive members, such as "Registered Users", "$value" should be used to store selected temporary users only instead of all members of that item
  * @param bool $include_anon Include user "anonymous"?
  * @param int $size Number or rows. "1" makes a drop-down-list.
  * @param bool $multiple Allow multiple selections?
  */
 function XoopsFormSelectUser($caption, $name, $include_anon = false, $value = null, $size = 1, $multiple = false)
 {
     $limit = 200;
     $select_element = new XoopsFormSelect('', $name, $value, $size, $multiple);
     if ($include_anon) {
         $select_element->addOption(0, $GLOBALS['xoopsConfig']['anonymous']);
     }
     $member_handler =& xoops_gethandler('member');
     $user_count = $member_handler->getUserCount();
     $value = is_array($value) ? $value : (empty($value) ? array() : array($value));
     if ($user_count > $limit && count($value) > 0) {
         $criteria = new CriteriaCompo(new Criteria('uid', '(' . implode(',', $value) . ')', 'IN'));
     } else {
         $criteria = new CriteriaCompo();
         $criteria->setLimit($limit);
     }
     $criteria->setSort('uname');
     $criteria->setOrder('ASC');
     $users = $member_handler->getUserList($criteria);
     $select_element->addOptionArray($users);
     if ($user_count <= $limit) {
         $this->XoopsFormElementTray($caption, "", $name);
         $this->addElement($select_element);
         return;
     }
     xoops_loadLanguage('findusers');
     $js_addusers = "<script type='text/javascript'>\r\n            function addusers(opts){\r\n                var num = opts.substring(0, opts.indexOf(':'));\r\n                opts = opts.substring(opts.indexOf(':')+1, opts.length);\r\n                var sel = xoopsGetElementById('" . $name . "');\r\n                var arr = new Array(num);\r\n                for (var n=0; n < num; n++) {\r\n                    var nm = opts.substring(0, opts.indexOf(':'));\r\n                    opts = opts.substring(opts.indexOf(':')+1, opts.length);\r\n                    var val = opts.substring(0, opts.indexOf(':'));\r\n                    opts = opts.substring(opts.indexOf(':')+1, opts.length);\r\n                    var txt = opts.substring(0, nm - val.length);\r\n                    opts = opts.substring(nm - val.length, opts.length);\r\n                    var added = false;\r\n                    for (var k = 0; k < sel.options.length; k++) {\r\n                        if(sel.options[k].value == val){\r\n                            added = true;\r\n                            break;\r\n                        }\r\n                    }\r\n                    if (added == false) {\r\n                        sel.options[k] = new Option(txt, val);\r\n                        sel.options[k].selected = true;\r\n                    }\r\n                }\r\n                return true;\r\n            }\r\n            </script>";
     $token = $GLOBALS['xoopsSecurity']->createToken();
     $action_tray = new XoopsFormElementTray("", " | ");
     $action_tray->addElement(new XoopsFormLabel('', '<a href="#" onclick="var sel = xoopsGetElementById(\'' . $name . '\');for (var i = sel.options.length-1; i >= 0; i--) {if (!sel.options[i].selected) {sel.options[i] = null;}}; return false;">' . _MA_USER_REMOVE . "</a>"));
     $action_tray->addElement(new XoopsFormLabel('', '<a href="#" onclick="openWithSelfMain(\'' . XOOPS_URL . '/include/findusers.php?target=' . $name . '&amp;multiple=' . $multiple . '&amp;token=' . $token . '\', \'userselect\', 800, 600, null); return false;" >' . _MA_USER_MORE . "</a>" . $js_addusers));
     $this->XoopsFormElementTray($caption, '<br /><br />', $name);
     $this->addElement($select_element);
     $this->addElement($action_tray);
 }
Exemplo n.º 9
0
 /**
  * Get subscriber from user ID and newsletter ID
  *
  * @param int $uid
  * @param int $newsletterid
  * @return SmartmailSubscriber|false
  */
 function getByUser($uid, $newsletterid)
 {
     $criteria = new CriteriaCompo(new Criteria('uid', intval($uid)));
     $criteria->add(new Criteria('newsletterid', intval($newsletterid)));
     $criteria->setLimit(1);
     $ret = $this->getObjects($criteria);
     return isset($ret[0]) ? $ret[0] : false;
 }
Exemplo n.º 10
0
 /**
  * @得到列表
  * @method:
  * @license http://www.blags.org/
  * @created:2010年05月23日 14时59分
  * @copyright 1997-2010 The Martin Group
  * @author Martin <*****@*****.**> 
  * */
 function &getHotelServiceTypes($limit = 0, $start = 0, $sort = 'service_type_id', $order = 'ASC', $id_as_key = true)
 {
     $criteria = new CriteriaCompo();
     $criteria->setSort($sort);
     $criteria->setOrder($order);
     $criteria->setStart($start);
     $criteria->setLimit($limit);
     return $this->getObjects($criteria, $id_as_key);
 }
Exemplo n.º 11
0
 public function countRelated($start = 0, $limit = 0, $sort = 'related_name', $order = 'ASC')
 {
     $criteria = new CriteriaCompo();
     $criteria->setSort($sort);
     $criteria->setOrder($order);
     $criteria->setStart($start);
     $criteria->setLimit($limit);
     return parent::getCount();
 }
Exemplo n.º 12
0
 function setContent($isreturn = false)
 {
     global $jieqiTpl;
     global $jieqiConfigs;
     jieqi_getconfigs('article', 'configs');
     $article_static_url = empty($jieqiConfigs['article']['staticurl']) ? $GLOBALS['jieqiModules']['article']['url'] : $jieqiConfigs['article']['staticurl'];
     $article_dynamic_url = empty($jieqiConfigs['article']['dynamicurl']) ? $GLOBALS['jieqiModules']['article']['url'] : $jieqiConfigs['article']['dynamicurl'];
     $jieqiTpl->assign('article_static_url', $article_static_url);
     $jieqiTpl->assign('article_dynamic_url', $article_dynamic_url);
     jieqi_includedb();
     $query = JieqiQueryHandler::getInstance('JieqiQueryHandler');
     $criteria = new CriteriaCompo();
     $criteria->setFields("r.*,a.articlename");
     $criteria->setTables(jieqi_dbprefix('article_reviews') . " AS r LEFT JOIN " . jieqi_dbprefix('article_article') . " AS a ON r.ownerid=a.articleid");
     if ($this->exevars['istop'] == 1) {
         $criteria->add(new Criteria('r.istop', '1'));
     } elseif ($this->exevars['istop'] == 2) {
         $criteria->add(new Criteria('r.istop', '0'));
     }
     if ($this->exevars['isgood'] == 1) {
         $criteria->add(new Criteria('r.isgood', '1'));
     } elseif ($this->exevars['isgood'] == 2) {
         $criteria->add(new Criteria('r.isgood', '0'));
     }
     $criteria->setSort('r.topicid');
     $criteria->setOrder('DESC');
     $criteria->setLimit($this->exevars['listnum']);
     $criteria->setStart(0);
     $query->queryObjects($criteria);
     $reviewrows = array();
     $i = 0;
     while ($v = $query->getObject()) {
         $reviewrows[$i]['reviewtitle'] = jieqi_htmlstr(str_replace(array("\r", "\n"), array('', ' '), $v->getVar('title', 'n')));
         $reviewrows[$i]['ownerid'] = $v->getVar('ownerid');
         $reviewrows[$i]['articlename'] = $v->getVar('articlename');
         $reviewrows[$i]['topicid'] = $v->getVar('topicid');
         $reviewrows[$i]['url_review'] = $article_dynamic_url . '/reviews.php?aid=' . $v->getVar('ownerid');
         $reviewrows[$i]['poster'] = $v->getVar('poster');
         $reviewrows[$i]['posterid'] = $v->getVar('posterid');
         $reviewrows[$i]['postdate'] = date('m-d H:i', $v->getVar('posttime'));
         $reviewrows[$i]['posttime'] = $v->getVar('posttime');
         $reviewrows[$i]['replytime'] = $v->getVar('replytime');
         $reviewrows[$i]['views'] = $v->getVar('views');
         $reviewrows[$i]['replies'] = $v->getVar('replies');
         $reviewrows[$i]['islock'] = $v->getVar('islock');
         $reviewrows[$i]['istop'] = $v->getVar('istop');
         $reviewrows[$i]['isgood'] = $v->getVar('isgood');
         $reviewrows[$i]['topictype'] = $v->getVar('topictype');
         $reviewrows[$i]['url_articleinfo'] = jieqi_geturl('article', 'article', $v->getVar('ownerid'), 'info');
         $reviewrows[$i]['url_articleindex'] = jieqi_geturl('article', 'article', $v->getVar('ownerid'), 'index');
         $reviewrows[$i]['url_articleread'] = $reviewrows[$i]['url_articleindex'];
         $i++;
     }
     $jieqiTpl->assign_by_ref('reviewrows', $reviewrows);
     $jieqiTpl->assign('url_more', $article_dynamic_url . '/reviewslist.php');
 }
Exemplo n.º 13
0
    public function search($queries, $andor, $limit, $start, $userid)
    {
        $xoops = Xoops::getInstance();
        $alumni = Alumni::getInstance();
        $myts = MyTextSanitizer::getInstance();
        $by_cat = Request::getInt('by_cat', '');
        $andor = Request::getWord('andor', 'AND');
        $queries = array();
        $query = Request::getString('query', '');
        $start = Request::getInt('start', '0');
        $helper = $xoops->getModuleHelper('alumni');
        $module_id = $helper->getModule()->getVar('mid');
        $listingHandler = $helper->getHandler('listing');
        $groups = $xoops->getUserGroups();
        $alumni_ids = $xoops->getHandlerGroupperm()->getItemIds('alumni_view', $groups, $module_id);
        $all_ids = implode(', ', $alumni_ids);
        $criteria = new CriteriaCompo();
        $criteria->add(new Criteria('valid', 1, '='));
        //  $criteria->add(new Criteria('date', time(), '<='));
        $criteria->add(new Criteria('cid', '(' . $all_ids . ')', 'IN'));
        if ($userid != 0) {
            $criteria->add(new Criteria('usid', $userid, '='));
        }
        if ($by_cat) {
            $criteria->add(new Criteria('cid', $by_cat, '='));
        }
        $queries = array($query);
        $queries = implode('+', $queries);
        $count = 0;
        $i = 0;
        $criteria->add(new Criteria('name', '%' . $queries . '%', 'LIKE'), 'AND');
        $criteria->add(new Criteria('mname', '%' . $queries . '%', 'LIKE'), 'OR');
        $criteria->add(new Criteria('lname', '%' . $queries . '%', 'LIKE'), 'OR');
        $criteria->add(new Criteria('school', '%' . $queries . '%', 'LIKE'), 'OR');
        $criteria->add(new Criteria('year', '%' . $queries . '%', 'LIKE'), 'OR');
        $criteria->setLimit($limit);
        $criteria->setSort('date');
        $criteria->setOrder('DESC');
        $criteria->setStart($start);
        $numrows = $listingHandler->getCount();
        $this_search = $listingHandler->getall($criteria);
        $ret = array();
        $k = 0;
        foreach ($this_search as $obj) {
            $ret[$k]['image'] = 'images/cat/default.gif';
            $ret[$k]['link'] = 'listing.php?lid=' . $obj->getVar('lid') . '';
            $ret[$k]['title'] = $obj->getVar('name') . ' ' . $obj->getVar('mname') . ' ' . $obj->getVar('lname') . '   ---   ' . $obj->getVar('school') . '
		---   ' . $obj->getVar('year');
            $ret[$k]['time'] = $obj->getVar('date');
            $ret[$k]['uid'] = $obj->getVar('usid');
            $k++;
        }
        return $ret;
    }
Exemplo n.º 14
0
 function pruneShouts($limit)
 {
     $criteria = new CriteriaCompo();
     $criteria->setSort('id');
     $criteria->setOrder('DESC');
     $criteria->setStart(0);
     $criteria->setLimit($limit);
     $objs = $this->getList($criteria, true);
     unset($criteria);
     $criteria = new Criteria('id', '(' . implode(',', array_keys($objs)) . ')', 'NOT IN');
     return $this->deleteAll($criteria);
 }
Exemplo n.º 15
0
 public function getAllPid(oledrion_parameters $parameters)
 {
     $parameters = $parameters->extend(new oledrion_parameters(array('start' => 0, 'limit' => 0, 'sort' => 'location_id', 'order' => 'ASC')));
     $critere = new CriteriaCompo();
     $critere->add(new Criteria('location_type', 'parent'));
     $critere->setLimit($parameters['limit']);
     $critere->setStart($parameters['start']);
     $critere->setSort($parameters['sort']);
     $critere->setOrder($parameters['order']);
     $pid = array();
     $pid = $this->getObjects($critere);
     return $pid;
 }
Exemplo n.º 16
0
/**
 * @param $options
 * @return array
 */
function b_presenter_slides_show($options)
{
    include_once XOOPS_ROOT_PATH . '/modules/presenter/class/slides.php';
    $myts =& MyTextSanitizer::getInstance();
    $slides = array();
    $type_block = $options[0];
    $nb_slides = $options[1];
    $lenght_title = $options[2];
    $slidesHandler =& xoops_getModuleHandler('slides', 'presenter');
    $criteria = new CriteriaCompo();
    array_shift($options);
    array_shift($options);
    array_shift($options);
    if ($type_block) {
        $criteria->add(new Criteria('slides_id', 0, '!='));
        $criteria->setSort('slides_id');
        $criteria->setOrder('ASC');
    }
    $criteria->setLimit($nb_slides);
    $slides_arr = $slidesHandler->getAll($criteria);
    foreach (array_keys($slides_arr) as $i) {
        $slides[$i]['slides_id'] = $slides_arr[$i]->getVar('slides_id');
        $slides[$i]['slides_cid'] = $slides_arr[$i]->getVar('slides_cid');
        $slides[$i]['slides_uid'] = $slides_arr[$i]->getVar('slides_uid');
        $slides[$i]['slides_title'] = $slides_arr[$i]->getVar('slides_title');
        $slides[$i]['slides_content'] = $slides_arr[$i]->getVar('slides_content');
        $slides[$i]['css_id'] = $slides_arr[$i]->getVar('css_id');
        $slides[$i]['css_class'] = $slides_arr[$i]->getVar('css_class');
        $slides[$i]['slides_transition_x'] = $slides_arr[$i]->getVar('slides_transition_x');
        $slides[$i]['slides_transition_y'] = $slides_arr[$i]->getVar('slides_transition_y');
        $slides[$i]['slides_transition_z'] = $slides_arr[$i]->getVar('slides_transition_z');
        $slides[$i]['slides_rotation_x'] = $slides_arr[$i]->getVar('slides_rotation_x');
        $slides[$i]['slides_rotation_y'] = $slides_arr[$i]->getVar('slides_rotation_y');
        $slides[$i]['slides_rotation_z'] = $slides_arr[$i]->getVar('slides_rotation_z');
        $slides[$i]['slides_scale_x'] = $slides_arr[$i]->getVar('slides_scale_x');
        $slides[$i]['slides_scale_y'] = $slides_arr[$i]->getVar('slides_scale_y');
        $slides[$i]['slides_scale_z'] = $slides_arr[$i]->getVar('slides_scale_z');
        $slides[$i]['slides_created'] = $slides_arr[$i]->getVar('slides_created');
        $slides[$i]['slides_published'] = $slides_arr[$i]->getVar('slides_published');
        $slides[$i]['slides_position'] = $slides_arr[$i]->getVar('slides_position');
        $slides[$i]['slides_online'] = $slides_arr[$i]->getVar('slides_online');
        $slides[$i]['slides_type'] = $slides_arr[$i]->getVar('slides_type');
        $slides[$i]['slides_notes'] = $slides_arr[$i]->getVar('slides_notes');
        $slides[$i]['slides_mp3'] = $slides_arr[$i]->getVar('slides_mp3');
        $slides[$i]['slides_time'] = $slides_arr[$i]->getVar('slides_time');
        $slides[$i]['slides_status'] = $slides_arr[$i]->getVar('slides_status');
        $slides[$i]['slides_waiting'] = $slides_arr[$i]->getVar('slides_waiting');
        $slides[$i]['slides_online'] = $slides_arr[$i]->getVar('slides_online');
    }
    return $slides;
}
Exemplo n.º 17
0
function b_xhelp_open_show($options)
{
    global $xoopsUser;
    $max_char_in_title = $options[0];
    if ($xoopsUser) {
        $uid = $xoopsUser->getVar('uid');
        // Get uid
        $block = array();
        $hTickets =& xhelpGetHandler('ticket');
        // Get ticket handler
        $hStaff =& xhelpGetHandler('staff');
        if ($isStaff =& $hStaff->isStaff($xoopsUser->getVar('uid'))) {
            $crit = new CriteriaCompo(new Criteria('ownership', $uid));
            $crit->add(new Criteria('status', 2, '<'));
            $crit->setOrder('DESC');
            $crit->setSort('priority, posted');
            $crit->setLimit(5);
            $tickets =& $hTickets->getObjects($crit);
            foreach ($tickets as $ticket) {
                $overdue = false;
                if ($ticket->isOverdue()) {
                    $overdue = true;
                }
                $block['ticket'][] = array('id' => $ticket->getVar('id'), 'uid' => $ticket->getVar('uid'), 'subject' => $ticket->getVar('subject'), 'truncSubject' => xoops_substr($ticket->getVar('subject'), 0, $max_char_in_title), 'description' => $ticket->getVar('description'), 'priority' => $ticket->getVar('priority'), 'status' => $ticket->getVar('status'), 'posted' => $ticket->posted(), 'closedBy' => $ticket->getVar('closedBy'), 'totalTimeSpent' => $ticket->getVar('totalTimeSpent'), 'userinfo' => XOOPS_URL . '/userinfo.php?uid=' . $ticket->getVar('uid'), 'url' => XOOPS_URL . '/modules/xhelp/ticket.php?id=' . $ticket->getVar('id'), 'overdue' => $overdue);
            }
            $block['isStaff'] = true;
            $block['viewAll'] = XOOPS_URL . '/modules/xhelp/index.php?op=staffViewAll';
            $block['viewAllText'] = _MB_XHELP_TEXT_VIEW_ALL_OPEN;
            $block['priorityText'] = _MB_XHELP_TEXT_PRIORITY;
            $block['noTickets'] = _MB_XHELP_TEXT_NO_TICKETS;
        } else {
            $crit = new CriteriaCompo(new Criteria('uid', $uid));
            $crit->add(new Criteria('status', 2, '<'));
            $crit->setOrder('DESC');
            $crit->setSort('priority, posted');
            $crit->setLimit(5);
            $tickets =& $hTickets->getObjects($crit);
            $hDepartments =& xhelpGetHandler('department');
            foreach ($tickets as $ticket) {
                //$department =& $hDepartments->get($ticket->getVar('department'));
                $block['ticket'][] = array('id' => $ticket->getVar('id'), 'uid' => $ticket->getVar('uid'), 'subject' => $ticket->getVar('subject'), 'truncSubject' => xoops_substr($ticket->getVar('subject'), 0, $max_char_in_title), 'description' => $ticket->getVar('description'), 'priority' => $ticket->getVar('priority'), 'status' => $ticket->getVar('status'), 'posted' => $ticket->posted(), 'closedBy' => $ticket->getVar('closedBy'), 'totalTimeSpent' => $ticket->getVar('totalTimeSpent'), 'userinfo' => XOOPS_URL . '/userinfo.php?uid=' . $ticket->getVar('uid'), 'url' => XOOPS_URL . '/modules/xhelp/ticket.php?id=' . $ticket->getVar('id'));
            }
        }
        $block['numTickets'] = count($tickets);
        $block['noTickets'] = _MB_XHELP_TEXT_NO_TICKETS;
        unset($tickets);
        $block['picPath'] = XOOPS_URL . '/modules/xhelp/images/';
        return $block;
    }
}
Exemplo n.º 18
0
function subscribers_sendEmails()
{
    global $xoopsConfig;
    $thisConfigs =& subscribers_getModuleConfig();
    $emailsperpack = intval($thisConfigs['emailsperpack']);
    $timebpacks = intval($thisConfigs['timebpacks']);
    $fromname = trim($thisConfigs['fromname']);
    $fromemail = trim($thisConfigs['fromemail']);
    $fromname = $fromname != '' ? $fromname : $xoopsConfig['sitename'];
    $fromemail = $fromemail != '' ? $fromemail : $xoopsConfig['adminmail'];
    $now = time();
    $last = subscribers_getLastTime();
    if ($now - $last <= $timebpacks) {
        return false;
    }
    $this_handler =& xoops_getModuleHandler('waiting', 'subscribers');
    $criteria = new CriteriaCompo();
    $criteria->setSort('wt_priority DESC, wt_created');
    $criteria->setOrder('ASC');
    $criteria->setLimit($emailsperpack);
    $objs = $this_handler->getObjects($criteria);
    $count = count($objs);
    unset($criteria);
    if ($count == 0) {
        return false;
    }
    include_once XOOPS_ROOT_PATH . '/kernel/user.php';
    $obj_delete = array();
    foreach ($objs as $obj) {
        $xoopsMailer =& xoops_getMailer();
        $xoopsMailer->multimailer->ContentType = "text/html";
        $xoopsMailer->setTemplateDir(XOOPS_ROOT_PATH . '/modules/subscribers/language/' . $xoopsConfig['language'] . '/mail_template/');
        $xoopsMailer->setTemplate('content.tpl');
        $xoopsMailer->setFromName($fromname);
        $xoopsMailer->setFromEmail($fromemail);
        $xoopsMailer->useMail();
        $xoopsMailer->setToEmails(array($obj->getVar('wt_toemail', 'n')));
        $xoopsMailer->setSubject($obj->getVar('wt_subject'), 'n');
        $xoopsMailer->assign('CONTENT', $obj->getVar('wt_body'));
        $key = md5($obj->getVar('wt_toemail', 'n') . XOOPS_ROOT_PATH);
        $xoopsMailer->assign("UNSUBSCRIBE_URL", XOOPS_URL . '/modules/subscribers/unsubscribe.php?email=' . $obj->getVar('wt_toemail', 'n') . '&key=' . $key);
        $xoopsMailer->send(false);
        unset($xoopsMailer);
        $obj_delete[] = $obj->getVar('wt_id');
    }
    $criteria = new Criteria('wt_id', '(' . implode(',', $obj_delete) . ')', 'IN');
    $this_handler->deleteAll($criteria, true);
    subscribers_setLastTime($now);
    return true;
}
function billboard_slides_show()
{
    include_once ICMS_ROOT_PATH . '/modules/billboard/include/common.php';
    $billboard_slide_handler = icms_getModuleHandler('slide', 'billboard');
    $billboard_config = icms_getModuleConfig('billboard');
    $criteria = new CriteriaCompo();
    $criteria->setStart(0);
    $criteria->setLimit(10);
    $criteria->setSort('slide_order');
    $criteria->setOrder('ASC');
    $block = array();
    $block['slides'] = $billboard_slide_handler->getObjects($criteria, true, false);
    $block['config'] = $billboard_config;
    return $block;
}
Exemplo n.º 20
0
function user_index($start = 0)
{
    global $xoopsTpl, $xoopsUser, $xoopsConfig, $limit;
    $myts =& MyTextSanitizer::getInstance();
    include_once XOOPS_ROOT_PATH . '/class/xoopsformloader.php';
    $this_handler =& xoops_getModuleHandler('user', 'subscribers');
    $module_handler =& xoops_getHandler('module');
    $query = isset($_POST['query']) ? $_POST['query'] : null;
    $xoopsTpl->assign('query', $query);
    $criteria = null;
    if (!is_null($query)) {
        $criteria = new Criteria('user_email', $myts->addSlashes($query) . '%', 'LIKE');
    }
    $count = $this_handler->getCount($criteria);
    $xoopsTpl->assign('count', $count);
    $mHandler =& xoops_getHandler('member');
    $users_count = $mHandler->getUserCount(new Criteria('level', 0, '>'));
    $xoopsTpl->assign('users_count', $users_count);
    $xoopsTpl->assign('total_count', $users_count + $count);
    $criteria = new CriteriaCompo($criteria);
    $criteria->setSort('user_id');
    $criteria->setOrder('DESC');
    $criteria->setStart($start);
    $criteria->setLimit($limit);
    $objs = $this_handler->getObjects($criteria);
    unset($criteria);
    if ($count > 0) {
        if ($count > $limit) {
            include_once XOOPS_ROOT_PATH . '/class/pagenav.php';
            $nav = new XoopsPageNav($count, $limit, $start, 'start', 'op=list');
            $xoopsTpl->assign('pag', '<div style="float:left; padding-top:2px;" align="center">' . $nav->renderNav() . '</div>');
        } else {
            $xoopsTpl->assign('pag', '');
        }
    } else {
        $xoopsTpl->assign('pag', '');
    }
    include_once XOOPS_ROOT_PATH . '/class/xoopslists.php';
    $countries = XoopsLists::getCountryList();
    foreach ($objs as $obj) {
        $objArray = $obj->toArray();
        $objArray['user_country'] = $countries[$objArray['user_country']];
        $xoopsTpl->append('objs', $objArray);
        unset($objArray);
    }
    $xoopsTpl->assign('add_form', user_form());
    return $xoopsTpl->fetch(XOOPS_ROOT_PATH . '/modules/subscribers/templates/static/subscribers_admin_user.html');
}
 function getByItemId($module_id, $item_id, $order = null, $status = null, $limit = null, $start = 0)
 {
     $criteria = new CriteriaCompo(new Criteria('com_modid', $module_id));
     $criteria->add(new Criteria('com_itemid', $item_id));
     if (isset($status)) {
         $criteria->add(new Criteria('com_status', $status));
     }
     if (isset($order)) {
         $criteria->setOrder($order);
     }
     if (isset($limit)) {
         $criteria->setLimit($limit);
         $criteria->setStart($start);
     }
     return $this->getObjects($criteria);
 }
Exemplo n.º 22
0
 public function getDelivery($ld_delivery, $ld_location)
 {
     $ret = array();
     $critere = new CriteriaCompo();
     $critere->add(new Criteria('ld_delivery', $ld_delivery));
     $critere->add(new Criteria('ld_location', $ld_location));
     $critere->setLimit(1);
     $obj = $this->getObjects($critere);
     if ($obj) {
         foreach ($obj as $root) {
             $tab = array();
             $ret = $root->toArray();
         }
     }
     return $ret;
 }
Exemplo n.º 23
0
function b_marquee_catads($limit, $dateformat, $itemssize)
{
    global $xoopsModule, $xoopsModuleConfig, $xoopsDB;
    include_once XOOPS_ROOT_PATH . '/modules/catads/class/cat.php';
    $block = array();
    if (empty($xoopsModule) || $xoopsModule->getVar('dirname') != 'catads') {
        $module_handler =& xoops_gethandler('module');
        $module =& $module_handler->getByDirname('catads');
        $config_handler =& xoops_gethandler('config');
        $config =& $config_handler->getConfigsByCat(0, $module->getVar('mid'));
    } else {
        $module =& $xoopsModule;
        $config =& $xoopsModuleConfig;
    }
    //echo '<br />ok';
    $ads_hnd =& xoops_getmodulehandler('ads', 'catads');
    $criteria = new CriteriaCompo(new Criteria('waiting', '0'));
    $criteria->add(new Criteria('published', time(), '<'));
    $criteria->add(new Criteria('expired', time(), '>'));
    $criteria->setSort('published');
    $criteria->setOrder('DESC');
    $criteria->setLimit($options[0]);
    $nbads = $ads_hnd->getCount($criteria);
    $a_item = array();
    $cat_buffer = array();
    if ($nbads > 0) {
        $ads = $ads_hnd->getObjects($criteria);
        $ts =& MyTextSanitizer::getInstance();
        foreach ($ads as $oneads) {
            if ($itemssize > 0) {
                $title = xoops_substr($oneads->getVar('ads_title'), 0, $itemssize);
            } else {
                $title = $oneads->getVar('ads_title');
            }
            if (!isset($cat_buffer[$oneads->getVar('cat_id')])) {
                $tmpcat = new AdsCategory($oneads->getVar('cat_id'));
                $cat_buffer[$oneads->getVar('cat_id')] = $tmpcat->title();
                $cat_title = $tmpcat->title();
            } else {
                $cat_title = $cat_buffer[$oneads->getVar('cat_id')];
            }
            $block[] = array('date' => formatTimestamp($oneads->getVar('published'), $dateformat), 'category' => '', 'author' => XoopsUser::getUnameFromId($oneads->getVar('uid')), 'title' => $title, 'link' => "<a href='" . XOOPS_URL . '/modules/catads/adsitem.php?ads_id=' . $oneads->getVar('ads_id') . "'>" . $title . '</a>');
            unset($a_item);
        }
    }
    return $block;
}
Exemplo n.º 24
0
function press_block_news_show($options)
{
    global $GLOBALS;
    $criteria = new CriteriaCompo();
    if (!empty($options[0])) {
        $criteria->add(new Criteria("cat_id", $options[0]));
    }
    $criteria->setLimit($options[1]);
    $criteria->setSort("topic_date");
    $criteria->setOrder("DESC");
    $field = array("topic_id", "subject", "topic_date");
    $topic_handler = xoops_getmodulehandler("topics", "press");
    $topics = $topic_handler->getAll($criteria, $field, false, true);
    foreach ($topics as $k => $v) {
        $topics[$k]['topic_date'] = formatTimestamp($v['topic_date'], "m.d");
    }
    $block = $topics;
    return $block;
}
Exemplo n.º 25
0
function defacer_index($start = 0, $limit = 0)
{
    global $xoopsTpl;
    $defacer =& DefacerDefacer::getInstance();
    $grouplist_handler =& xoops_gethandler('group');
    $grouplist = $grouplist_handler->getObjects(null, true);
    foreach (array_keys($grouplist) as $i) {
        $groups[$i] = $grouplist[$i]->getVar('name');
    }
    $xoopsTpl->assign('groups', $groups);
    $count = $defacer->getHandler('permission')->getCount();
    $xoopsTpl->assign('count', $count);
    $criteria = new CriteriaCompo();
    $criteria->setStart($start);
    $criteria->setLimit($limit);
    $objs = $defacer->getHandler('permission')->getObjects($criteria);
    if ($count > $limit) {
        include_once XOOPS_ROOT_PATH . '/class/pagenav.php';
        $nav = new XoopsPageNav($count, $limit, $start, 'start', 'op=list');
        $xoopsTpl->assign('pagenav', '<div style="float:left; padding-top:2px;" align="center">' . $nav->renderNav() . '</div>');
    }
    foreach ($objs as $obj) {
        $item = $obj->getValues();
        $page = $defacer->getHandler('page')->get($obj->getVar('permission_id'));
        $item['module'] = $page->getVar('name');
        $item['permission_title'] = $page->getVar('page_title');
        $item['permission_url'] = $page->getVar('page_url');
        $item['permission_status'] = $page->getVar('page_status');
        if (substr($page->getVar('page_url'), -1) == '*') {
            $item['permission_vurl'] = 0;
        } else {
            if ($page->getVar('page_moduleid') == 1) {
                $item['permission_vurl'] = XOOPS_URL . '/' . $page->getVar('page_url');
            } else {
                $item['permission_vurl'] = XOOPS_URL . '/modules/' . $page->getVar('dirname') . '/' . $page->getVar('page_url');
            }
        }
        $xoopsTpl->append('items', $item);
    }
    $xoopsTpl->assign('form', defacer_form());
    return $xoopsTpl->fetch('db:defacer_admin_permission.html');
}
Exemplo n.º 26
0
function resources_resource_show($options)
{
    $category_handler =& xoops_getmodulehandler('category', 'resources');
    $resources_handler =& xoops_getmodulehandler('resources', 'resources');
    $cat_name = '';
    $criteria = new CriteriaCompo();
    if (!empty($options[0])) {
        $criteria->add(new Criteria('cat_id', $options[0]), 'AND');
        $cat_obj = $category_handler->get($options[0]);
        $cat_name = $cat_obj->getVar('cat_name');
    }
    $criteria->add(new Criteria('res_status', 1));
    $criteria->setSort($options[1]);
    $criteria->setOrder('ASC');
    $criteria->setLimit($options[2]);
    $resources = $resources_handler->getAll($criteria, null, false);
    $block = $resources;
    //  xoops_result($block);
    return $block;
}
Exemplo n.º 27
0
 function setContent($isreturn = false)
 {
     global $jieqiTpl;
     include_once JIEQI_ROOT_PATH . '/class/userlink.php';
     $userlink_handler =& JieqiUserlinkHandler::getInstance('JieqiUserlinkHandler');
     $criteria = new CriteriaCompo();
     $criteria->add(new Criteria('userid', $this->blockvars['cacheid']));
     if ($this->exevars['istop'] == 1) {
         $criteria->add(new Criteria('toptime', 0, '>'));
     } elseif ($this->exevars['istop'] == 2) {
         $criteria->add(new Criteria('toptime', 0));
     }
     $criteria->setSort($this->exevars['field']);
     if ($this->exevars['asc'] == 1) {
         $criteria->setOrder('ASC');
     } else {
         $criteria->setOrder('DESC');
     }
     $criteria->setLimit($this->exevars['listnum']);
     $criteria->setStart(0);
     $userlink_handler->queryObjects($criteria);
     $linkrows = array();
     $k = 0;
     while ($v = $userlink_handler->getObject()) {
         $linkrows[$k]['ulid'] = $v->getVar('ulid');
         $linkrows[$k]['ultitle'] = $v->getVar('ultitle');
         $linkrows[$k]['ulurl'] = $v->getVar('ulurl');
         $linkrows[$k]['ulinfo'] = $v->getVar('ulinfo');
         $linkrows[$k]['userid'] = $v->getVar('userid');
         $linkrows[$k]['username'] = $v->getVar('username');
         $linkrows[$k]['score'] = $v->getVar('score');
         $linkrows[$k]['weight'] = $v->getVar('weight');
         $linkrows[$k]['toptime'] = $v->getVar('toptime');
         $linkrows[$k]['addtime'] = $v->getVar('addtime');
         $linkrows[$k]['allvisit'] = $v->getVar('allvisit');
         $k++;
     }
     $jieqiTpl->assign_by_ref('linkrows', $linkrows);
     $jieqiTpl->assign('ownerid', $this->blockvars['cacheid']);
     $jieqiTpl->assign('url_more', JIEQI_URL . '/userlink.php?uid=' . $this->blockvars['cacheid']);
 }
Exemplo n.º 28
0
/**
 * Links
 *
 * You may not change or alter any portion of this comment or credits
 * of supporting developers from this source code or any supporting source code 
 * which is considered copyrighted (c) material of the original comment or credit authors.
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
 *
 * @copyright      The XOOPS Co.Ltd. http://www.xoops.com.cn
 * @license        http://www.fsf.org/copyleft/gpl.html GNU public license
 * @package        links
 * @since          1.0.0
 * @author         Mengjue Shao <*****@*****.**>
 * @author         Susheng Yang <*****@*****.**>    
 * @version        $Id: blocks.php 1 2010-1-22 ezsky$
 */
function links_block_show($options)
{
    include_once XOOPS_ROOT_PATH . '/modules/links/include/functions.php';
    $cat_handler =& xoops_getmodulehandler('category', 'links');
    $link_handler =& xoops_getmodulehandler('links', 'links');
    $module_handler =& xoops_gethandler('module');
    $config_handler =& xoops_gethandler('config');
    $module = $module_handler->getByDirname('links');
    $xoopsModuleConfig = $config_handler->getConfigList($module->getVar('mid'));
    $cat_name = '';
    $criteria = new CriteriaCompo();
    if (!empty($options[0])) {
        $criteria->add(new Criteria('cat_id', $options[0]), 'AND');
        $cat_obj = $cat_handler->get($options[0]);
        $cat_name = $cat_obj->getVar('cat_name');
    }
    $criteria->add(new Criteria('link_status', 1));
    $criteria->setSort($options[1]);
    if ($options[1] == 'link_order') {
        $criteria->setOrder('ASC');
    } else {
        $criteria->setOrder('DESC');
    }
    $criteria->setLimit($options[2]);
    $links = $link_handler->getAll($criteria, array('link_id', 'link_title', 'cat_id', 'link_url', 'link_image', 'link_dir'), false, false);
    foreach ($links as $k => $v) {
        $links[$k]['link_title'] = cut_str($v['link_title'], $options[3], 0, 'utf8');
        if (!empty($xoopsModuleConfig['logo'])) {
            $links[$k]['link_image'] = XOOPS_URL . $xoopsModuleConfig['logo_dir'] . $v['link_image'];
        } else {
            $links[$k]['link_image'] = $v['link_dir'];
        }
    }
    $display['cat_name'] = $cat_name;
    $display['display_cat'] = $options[4];
    $display['display'] = $options[5];
    $display['links'] = $links;
    $display['display_css'] = XOOPS_URL . '/modules/links/templates/style.css';
    $block = array('display' => $display);
    return $block;
}
Exemplo n.º 29
0
function b_legacy_comments_show($options)
{
    $block = array();
    include_once XOOPS_ROOT_PATH . '/include/comment_constants.php';
    $comment_handler =& xoops_gethandler('comment');
    $criteria = new CriteriaCompo(new Criteria('com_status', XOOPS_COMMENT_ACTIVE));
    $criteria->setLimit(intval($options[0]));
    $criteria->setSort('com_created');
    $criteria->setOrder('DESC');
    $comments =& $comment_handler->getObjects($criteria, true);
    $member_handler =& xoops_gethandler('member');
    $module_handler =& xoops_gethandler('module');
    $modules =& $module_handler->getObjects(new Criteria('hascomments', 1), true);
    $comment_config = array();
    foreach (array_keys($comments) as $i) {
        $mid = $comments[$i]->getVar('com_modid');
        $com['module'] = '<a href="' . XOOPS_URL . '/modules/' . $modules[$mid]->getVar('dirname') . '/">' . $modules[$mid]->getVar('name') . '</a>';
        if (!isset($comment_config[$mid])) {
            $comment_config[$mid] = $modules[$mid]->getInfo('comments');
        }
        $com['id'] = $i;
        $com['title'] = '<a href="' . XOOPS_URL . '/modules/' . $modules[$mid]->getVar('dirname') . '/' . $comment_config[$mid]['pageName'] . '?' . $comment_config[$mid]['itemName'] . '=' . $comments[$i]->getVar('com_itemid') . '&amp;com_id=' . $i . '&amp;com_rootid=' . $comments[$i]->getVar('com_rootid') . '&amp;' . htmlspecialchars($comments[$i]->getVar('com_exparams')) . '#comment' . $i . '">' . $comments[$i]->getVar('com_title') . '</a>';
        $com['icon'] = $comments[$i]->getVar('com_icon');
        $com['icon'] = $com['icon'] != '' ? $com['icon'] : 'icon1.gif';
        $com['time'] = $comments[$i]->getVar('com_created');
        if ($comments[$i]->getVar('com_uid') > 0) {
            $poster =& $member_handler->getUser($comments[$i]->getVar('com_uid'));
            if (is_object($poster)) {
                $com['poster'] = '<a href="' . XOOPS_URL . '/userinfo.php?uid=' . $comments[$i]->getVar('com_uid') . '">' . $poster->getVar('uname') . '</a>';
            } else {
                $com['poster'] = $GLOBALS['xoopsConfig']['anonymous'];
            }
        } else {
            $com['poster'] = $GLOBALS['xoopsConfig']['anonymous'];
        }
        $block['comments'][] =& $com;
        unset($com);
    }
    return $block;
}
Exemplo n.º 30
0
function b_user_newusers_show($options)
{
    $block = array();
    $criteria = new CriteriaCompo(new Criteria('level', 0, '>'));
    $limit = (!empty($options[0])) ? $options[0] : 10;
    $criteria->setOrder('DESC');
    $criteria->setSort('user_regdate');
    $criteria->setLimit($limit);
    $member_handler =& xoops_gethandler('member');
    $newmembers =& $member_handler->getUsers($criteria);
    $count = count($newmembers);
    for ($i = 0; $i < $count; $i++) {
        if ( $options[1] == 1 ) {
            $block['users'][$i]['avatar'] = $newmembers[$i]->getVar('user_avatar') != 'blank.gif' ? XOOPS_UPLOAD_URL.'/'.$newmembers[$i]->getVar('user_avatar') : '';
        } else {
            $block['users'][$i]['avatar'] = '';
        }
        $block['users'][$i]['id'] = $newmembers[$i]->getVar('uid');
        $block['users'][$i]['name'] = $newmembers[$i]->getVar('uname');
        $block['users'][$i]['joindate'] = $newmembers[$i]->getVar('user_regdate');
    }
    return $block;
}