function execute(&$controller, &$xoopsUser) { if (xoops_getrequest('_form_control_cancel') != null) { return USER_FRAME_VIEW_CANCEL; } $isNew = $this->mObject->isNew(); $ret = parent::execute($controller, $xoopsUser); if ($ret == USER_FRAME_VIEW_SUCCESS && $isNew) { $handler =& xoops_getmodulehandler('users_search'); $uidArr = $handler->getUids($this->mFilter->getCriteria(0, 0)); $handler =& xoops_getmodulehandler('mailjob_link'); foreach ($uidArr as $uid) { $obj =& $handler->create(); $obj->set('mailjob_id', $this->mObject->get('mailjob_id')); $obj->set('uid', $uid); $handler->insert($obj); } } return $ret; }
function &getMainThemeObject() { // [TODO] // Because get() of the virtual handler is heavy, we have to consider // the new solution about this process. // $handler =& xoops_getmodulehandler('theme', 'legacy'); $theme =& $handler->get($this->mController->mRoot->mContext->getThemeName()); if (is_object($theme)) { return $theme; } //----------- // Fail safe //----------- $root =& XCube_Root::getSingleton(); foreach ($root->mContext->mXoopsConfig['theme_set_allowed'] as $theme) { $theme =& $handler->get($theme); if (is_object($theme)) { $root->mContext->setThemeName($theme->get('dirname')); return $theme; } } $objs =& $handler->getObjects(); if (count($objs) > 0) { return $objs[0]; } $theme = null; return $theme; }
public function execute() { if ($this->root->mContext->mRequest->getRequest('inout') == 'in') { $this->inout = 'inbox'; $this->setUrl('index.php?action=index'); } else { $this->inout = 'outbox'; $this->setUrl('index.php?action=send'); } $delid = $this->root->mContext->mRequest->getRequest('delmsg'); if (!is_array($delid) || count($delid) == 0) { $this->setErr(_MD_MESSAGE_DELETEMSG2); return; } $modHand = xoops_getmodulehandler($this->inout); foreach ($delid as $boxid) { $modObj = $modHand->get(intval($boxid)); if (!is_object($modObj)) { $this->setErr(_MD_MESSAGE_ACTIONMSG1); return; } if ($modObj->get('uid') != $this->root->mContext->mXoopsUser->get('uid')) { $this->setErr(_MD_MESSAGE_ACTIONMSG2); return; } if ($modHand->delete($modObj)) { $this->setErr(_MD_MESSAGE_ACTIONMSG3); } else { $this->setErr(_MD_MESSAGE_ACTIONMSG4); return; } } }
/** * @public */ function prepare() { $handler =& xoops_getmodulehandler('definitions'); $this->mDef = $handler->getFields4DataEdit(); // // Set form properties // $this->mFormProperties['uid'] = new XCube_IntProperty('uid'); foreach (array_keys($this->mDef) as $key) { $className = $this->mDef[$key]->mFieldType->getFormPropertyClass(); $this->mFormProperties[$this->mDef[$key]->get('field_name')] = new $className($this->mDef[$key]->get('field_name')); //validation checks $validationArr = array(); $this->mFieldProperties[$this->mDef[$key]->get('field_name')] = new XCube_FieldProperty($this); //required check if ($this->mDef[$key]->get('required') == 1) { $validationArr[] = 'required'; $this->mFieldProperties[$this->mDef[$key]->get('field_name')]->addMessage('required', _MD_PROFILE_ERROR_REQUIRED, $this->mDef[$key]->get('label')); } //validation check switch ($this->mDef[$key]->get('validation')) { case 'email': $validationArr[] = 'email'; $this->mFieldProperties[$this->mDef[$key]->get('field_name')]->addMessage($this->mDef[$key]->get('field_name'), _MD_PROFILE_ERROR_EMAIL); break; } $this->mFieldProperties[$this->mDef[$key]->get('field_name')]->setDependsByArray($validationArr); } // // Set field properties // $this->mFieldProperties['uid'] = new XCube_FieldProperty($this); $this->mFieldProperties['uid']->setDependsByArray(array('required')); $this->mFieldProperties['uid']->addMessage('required', _MD_PROFILE_ERROR_REQUIRED, _MD_PROFILE_LANG_UID); }
function b_legacy_themes_show($options) { global $xoopsConfig; if (count($xoopsConfig['theme_set_allowed']) == 0) { return null; } $block = array(); if (xoops_getenv('REQUEST_METHOD') == 'POST') { $block['isEnableChanger'] = 0; return $block; } $block['isEnableChanger'] = 1; $theme_options = array(); $handler =& xoops_getmodulehandler('theme', 'legacy'); foreach ($xoopsConfig['theme_set_allowed'] as $name) { $theme =& $handler->get($name); if ($theme != null) { $theme_option['name'] = $name; $theme_option['screenshot'] = $theme->getShow('screenshot'); $theme_option['screenshotUrl'] = XOOPS_THEME_URL . "/" . $name . "/" . $theme->getShow('screenshot'); if ($name == $xoopsConfig['theme_set']) { $theme_option['selected'] = 'selected="selected"'; $block['theme_selected_screenshot'] = $theme->getShow('screenshot'); } else { $theme_option['selected'] = ''; } $theme_options[] = $theme_option; } } $block['count'] = count($xoopsConfig['theme_set_allowed']); $block['mode'] = $options[0]; $block['width'] = $options[1]; $block['theme_options'] = $theme_options; return $block; }
function getDefaultView(&$controller, &$xoopsUser) { $id = xoops_getrequest('tpl_id'); $handler =& xoops_getmodulehandler('tplfile'); $this->mObject =& $handler->get($id); return $this->mObject != null ? LEGACYRENDER_FRAME_VIEW_SUCCESS : LEGACYRENDER_FRAME_VIEW_ERROR; }
function smartsection_search($queryarray, $andor, $limit, $offset, $userid) { include_once XOOPS_ROOT_PATH . '/modules/smartsection/include/functions.php'; $ret = array(); if (!isset($smartsection_item_handler)) { $smartsection_item_handler = xoops_getmodulehandler('item', 'smartsection'); } if ($queryarray == '' || count($queryarray) == 0) { $keywords = ''; $hightlight_key = ''; } else { $keywords = implode('+', $queryarray); $hightlight_key = "&keywords=" . $keywords; } $itemsObj =& $smartsection_item_handler->getItemsFromSearch($queryarray, $andor, $limit, $offset, $userid); $withCategoryPath = smartsection_getConfig('catpath_search'); foreach ($itemsObj as $result) { $item['image'] = "images/item_icon.gif"; $item['link'] = "item.php?itemid=" . $result['id'] . $hightlight_key; if ($withCategoryPath) { $item['title'] = $result['categoryPath'] . $result['title']; } else { $item['title'] = "" . $result['title']; } $item['time'] = $result['datesub']; $item['uid'] = $result['uid']; $ret[] = $item; unset($item); } return $ret; }
function executeViewIndex(&$controller, &$xoopsUser, &$render) { $render->setTemplateName("legacy_image_list.html"); foreach (array_keys($this->mObjects) as $key) { $this->mObjects[$key]->loadImagecategory(); } $render->setAttribute("objects", $this->mObjects); $render->setAttribute("pageNavi", $this->mFilter->mNavi); $render->setAttribute('imgcatId', $this->mImgcatId); $handler =& xoops_getmodulehandler('imagecategory', 'legacy'); if (is_object($xoopsUser)) { $groups = $xoopsUser->getGroups(); } else { $groups = array(XOOPS_GROUP_ANONYMOUS); } $categoryArr =& $handler->getObjectsWithReadPerm($groups, 1); $render->setAttribute('categoryArr', $categoryArr); // // If current category object exists, check the permission of uploading. // $hasUploadPerm = null; if ($this->mCategory != null) { $hasUploadPerm = $this->mCategory->hasUploadPerm($groups); } $render->setAttribute('hasUploadPerm', $hasUploadPerm); $render->setAttribute("category", $this->mCategory); //echo xoops_getrequest('target');die(); $render->setAttribute('target', htmlspecialchars(xoops_getrequest('target'), ENT_QUOTES)); }
function about_block_page_edit($options) { @(include dirname(dirname(__FILE__)) . "/xoops_version.php"); $page_handler =& xoops_getmodulehandler('page', 'about'); $criteria = new CriteriaCompo(); $criteria->add(new Criteria('page_status', 1), 'AND'); $criteria->add(new Criteria('page_type', 1)); $criteria->setSort('page_order'); $criteria->setOrder('ASC'); $fields = array("page_id", "page_title", "page_image"); $pages = $page_handler->getAll($criteria, $fields, false); $page_title = ''; foreach ($pages as $k => $v) { $page_title = '<a href="' . XOOPS_URL . '/modules/' . $modversion['dirname'] . '/index.php?page_id=' . $k . '" target="_blank">' . $v['page_title'] . '</a>'; $options_page[$k] = empty($v['page_image']) ? $page_title : $page_title . '<img src="' . XOOPS_URL . '/modules/' . $modversion['dirname'] . '/images/picture.png' . '" />'; } include_once dirname(dirname(__FILE__)) . '/include/xoopsformloader.php'; $form = new XoopsBlockForm(); $page_select = new XoopsFormRadio(_MI_ABOUT_BLOCKPAGE, 'options[0]', $options[0], '<br />'); $page_select->addOptionArray($options_page); $form->addElement($page_select); $form->addElement(new XoopsFormText(_MI_ABOUT_TEXT_LENGTH, 'options[1]', 5, 5, $options[1])); $form->addElement(new XoopsFormText(_MI_ABOUT_VIEW_MORELINKTEXT, 'options[2]', 30, 50, $options[2])); $form->addElement(new XoopsFormRadioYN(_MI_ABOUT_DOTITLEIMAGE, 'options[3]', $options[3])); return $form->render(); }
function newbb_forumSelectBox($value = null, $permission = "access", $delimitor_category = true) { $category_handler =& xoops_getmodulehandler('category', 'newbb'); $categories = $category_handler->getByPermission($permission, array("cat_id", "cat_order", "cat_title"), false); require_once XOOPS_ROOT_PATH . '/Frameworks/art/functions.cache.php'; if ($permission == "all" || !($forums = mod_loadCacheFile_byGroup("forumselect"))) { $forum_handler =& xoops_getmodulehandler('forum', 'newbb'); $forums = $forum_handler->getTree(array_keys($categories), 0, $permission); if (empty($permission) || $permission == "access") { mod_createCacheFile_byGroup($forums, "forumselect"); } } $value = is_array($value) ? $value : array($value); $box = ""; if (count($forums) > 0) { foreach (array_keys($categories) as $key) { if (empty($forums[$key])) { continue; } if ($delimitor_category) { $box .= "<option value=0> </option>"; } $box .= "<option value='" . -1 * $key . "'>[" . $categories[$key]['cat_title'] . "]</option>"; foreach ($forums[$key] as $f => $forum) { $box .= "<option value='{$f}' " . (in_array($f, $value, true) ? " selected='selected' " : "") . ">" . $forum['prefix'] . $forum['forum_name'] . "</option>"; } } } else { $box .= "<option value=0>" . _MD_NOFORUMINDB . "</option>"; } unset($forums, $categories); return $box; }
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; } }
function nw_tag_synchronization($mid) { global $xoopsDB; $item_handler_keyName = 'storyid'; $item_handler_table = $xoopsDB->prefix('nw_stories'); $link_handler =& xoops_getmodulehandler("link", "tag"); $where = "($item_handler_table.published > 0 AND $item_handler_table.published <= ".time().") AND ($item_handler_table.expired = 0 OR $item_handler_table.expired > ".time().')'; /* clear tag-item links */ if($link_handler->mysql_major_version() >= 4): $sql = " DELETE FROM {$link_handler->table}". " WHERE ". " tag_modid = {$mid}". " AND ". " ( tag_itemid NOT IN ". " ( SELECT DISTINCT {$item_handler_keyName} ". " FROM {$item_handler_table} ". " WHERE $where". " ) ". " )"; else: $sql = " DELETE {$link_handler->table} FROM {$link_handler->table}". " LEFT JOIN {$item_handler_table} AS aa ON {$link_handler->table}.tag_itemid = aa.{$item_handler_keyName} ". " WHERE ". " tag_modid = {$mid}". " AND ". " ( aa.{$item_handler_keyName} IS NULL". " OR $where". " )"; endif; if (!$result = $link_handler->db->queryF($sql)) { //xoops_error($link_handler->db->error()); } }
function art_synchronization($type = "") { switch ($type) { case "article": case "topic": case "category": $type = array($type); $clean = array($type); break; default: $type = null; $clean = array("category", "topic", "article", "text", "rate", "spotlight", "pingback", "trackback"); break; } foreach ($clean as $item) { $handler =& xoops_getmodulehandler($item, $GLOBALS["artdirname"]); $handler->cleanOrphan(); unset($handler); } /* if(empty($type) || in_array("category", $type)): $category_handler =& xoops_getmodulehandler("category", $GLOBALS["artdirname"]); $category_handler->setLastArticleIds(); $category_handler->updateTrack(); endif; */ if (empty($type) || in_array("article", $type)) { $article_handler =& xoops_getmodulehandler("article", $GLOBALS["artdirname"]); $artConfig = art_load_config(); $article_handler->cleanExpires($artConfig["article_expire"] * 24 * 3600); } return true; }
function b_subscription_show($options) { global $xoopsUser; $smartmail_newsletter_handler = xoops_getmodulehandler('newsletter', 'smartmail'); $smartmail_subscriber_handler = xoops_getmodulehandler('subscriber', 'smartmail'); $groups = $xoopsUser ? $xoopsUser->getGroups() : array(XOOPS_GROUP_ANONYMOUS); $allowedNewsletters = $smartmail_newsletter_handler->getAllowedList($groups); if (is_object($xoopsUser)) { $subcribedNewsletters = $smartmail_subscriber_handler->getNewsletterListByUser($xoopsUser->getVar('uid')); $ret['subscribedNewsletters'] = $subcribedNewsletters; // remove the subcribed newsletters to the allowedNewletters array $newAllowedNewsletters = array(); foreach ($allowedNewsletters as $key => $value) { if (!isset($subcribedNewsletters[$key])) { $newAllowedNewsletters[$key] = $value; } } $ret['newsletters'] = $newAllowedNewsletters; } else { $ret['newsletters'] = $allowedNewsletters; } if (!$ret['newsletters'] && !$ret['subscribedNewsletters']) { return false; } $ret['subscription_action'] = 'default'; return $ret; }
public function execute() { $root = XCube_Root::getSingleton(); $root->mLanguageManager->loadModinfoMessageCatalog(basename(dirname(dirname(__FILE__)))); $root->mLanguageManager->loadModuleMessageCatalog(basename(dirname(dirname(__FILE__)))); $render = $this->getRenderTarget(); $render->setTemplateName($this->_mBlock->get('template')); $render->setAttribute('mid', $this->_mBlock->get('mid')); $render->setAttribute('bid', $this->_mBlock->get('bid')); $service = $root->mServiceManager->getService('privateMessage'); $uid = $root->mContext->mXoopsUser->get('uid'); if ($service != null) { $client = $root->mServiceManager->createClient($service); $render->setAttribute('block', $client->call('getCountUnreadPM', array('uid' => $uid))); } if ($root->mServiceManager->getService('UserSearch') != null) { $render->setAttribute('UserSearch', true); } $modHand = xoops_getmodulehandler('inbox', 'message'); $render->setAttribute('incount', $modHand->getInboxCount($uid)); $modHand = xoops_getmodulehandler('outbox', 'message'); $render->setAttribute('outcount', $modHand->getOutboxCount($uid)); $render->setAttribute('message_url', XOOPS_URL . '/modules/message/index.php'); $renderSystem = $root->getRenderSystem($this->getRenderSystemName()); $renderSystem->renderBlock($render); }
/** * Loads roles of the specific module with $module, and set loaded roles to * the current principal. * @static * @param XoopsModule $module */ function loadRolesByModule(&$module) { static $cache; $root =& XCube_Root::getSingleton(); $context =& $root->mContext; if ($module == null) { return; } if (isset($cache[$module->get('mid')])) { return; } $groups = is_object($context->mXoopsUser) ? $context->mXoopsUser->getGroups() : array(XOOPS_GROUP_ANONYMOUS); $handler =& xoops_gethandler('groupperm'); if ($handler->checkRight('module_read', $module->get('mid'), $groups)) { $context->mUser->addRole('Module.' . $module->get('dirname') . '.Visitor'); } if (is_object($context->mXoopsUser) && $handler->checkRight('module_admin', $module->get('mid'), $groups)) { $context->mUser->addRole('Module.' . $module->get('dirname') . '.Admin'); } $handler =& xoops_getmodulehandler('group_permission', 'legacy'); $roleArr = $handler->getRolesByModule($module->get('mid'), $groups); foreach ($roleArr as $role) { $context->mUser->addRole('Module.' . $module->get('dirname') . '.' . $role); } $cache[$module->get('mid')] = true; }
function _doExecute() { if ($this->mActionForm->mFormFile != null) { if (!$this->mActionForm->mFormFile->saveAs(XOOPS_UPLOAD_PATH)) { return false; } if ($this->mActionForm->mOldFileName != null && $this->mActionForm->mOldFileName != "blank.gif") { @unlink(XOOPS_UPLOAD_PATH . "/" . $this->mActionForm->mOldFileName); // // Change user_avatar of all users who are setting this avatar. // if (!$this->mObject->isNew()) { $linkHandler =& xoops_getmodulehandler('avatar_user_link'); $criteria =new Criteria('avatar_id', $this->mObject->get('avatar_id')); $linkArr =& $linkHandler->getObjects($criteria); $userHandler =& xoops_gethandler('user'); foreach ($linkArr as $link) { $user =& $userHandler->get($link->get('user_id')); if (is_object($user)) { $user->set('user_avatar', $this->mObject->get('avatar_file')); $userHandler->insert($user); } unset($user); } } } } return parent::_doExecute(); }
function brandForm($action = false) { global $xoopsModuleConfig; if ($action === false) { $action = $_SERVER['REQUEST_URI']; } include_once XOOPS_ROOT_PATH . "/class/xoopsformloader.php"; $country_handler = xoops_getmodulehandler('country', 'catalog'); $title = $this->isNew() ? _AM_CATALOG_ADDBRAND : _AM_CATALOG_UPDATEBRAND; $form = new XoopsThemeForm($title, 'form', $action, 'post', true); $form->setExtra('enctype="multipart/form-data"'); $form->addElement(new XoopsFormText(_AM_CATALOG_BRANDNAME, 'brand_name', 60, 255, $this->getVar('brand_name')), true); $countys =& $country_handler->getList(); $county_select = new XoopsFormSelect(_AM_CATALOG_CHOICECOUNTRY, "country_id", $this->getVar("country_id")); $county_select->addOption('', _AM_CATALOG_CHOICE); $county_select->addOptionArray($countys); $form->addElement($county_select); $configs = array('editor' => 'fckeditor', 'width' => '100%', 'height' => '150px', 'value' => $this->getVar('brand_description')); $form->addElement(new XoopsFormEditor(_AM_CATALOG_BRANDDESC, 'brand_description', $configs, $nohtml = false, $OnFailure = "")); if ($this->isNew()) { $form->addElement(new XoopsFormHidden('brand_published', time())); } $form->addElement(new XoopsFormHidden('brand_id', $this->getVar('brand_id'))); $form->addElement(new XoopsFormHidden('ac', 'save')); $form->addElement(new XoopsFormButton('', 'submit', _SUBMIT, 'submit')); return $form; }
function _doExecute() { $linkHandler =& xoops_getmodulehandler('avatar_user_link'); $criteria = new Criteria('avatar_id', $this->mObject->get('avatar_id')); $linkArr =& $linkHandler->getObjects($criteria); if ($this->mObjectHandler->delete($this->mObject)) { // // Clear all user who set the avatar deleted with blank.gif // if (count($linkArr) > 0) { $userHandler =& xoops_gethandler('user'); foreach ($linkArr as $link) { $user =& $userHandler->get($link->get('user_id')); if (is_object($user)) { $user->set('user_avatar', 'blank.gif'); $userHandler->insert($user); } unset($user); } } return true; } else { return false; } }
function convertToUtf8(&$xmlfile) { $encoding = $this->_hl->getVar('headline_encoding'); // auto detection if (empty($encoding)) { $top_of_xml = substr($xmlfile, 0, 255); preg_match("/^<\\?xml .* encoding=['\"]?([0-9a-z_-]+)/i", $top_of_xml, $regs); if (empty($regs)) { $encoding = 'utf-8'; } else { $encoding = strtolower($regs[1]); } $this->_hl->setVar('headline_encoding', $encoding); $headline_handler =& xoops_getmodulehandler('headline', $this->_mydirname); $headline_handler->insert($this->_hl); } switch (strtolower($encoding)) { case 'iso-8859-1': $xmlfile = utf8_encode($xmlfile); break; case 'windows-1251': $xmlfile = iconv("WINDOWS-1251", "UTF-8", $xmlfile); break; case 'utf-8': default: break; } return $xmlfile; }
/** * prepare * * @param XCube_PageNavigator &$navi * @param XoopsObjectGenericHandler &$handler * * @return void **/ public function prepare(/*** XCube_PageNavigator ***/ &$navi,/*** XoopsObjectGenericHandler ***/ &$handler) { $this->mFields = xoops_getmodulehandler('definitions', 'profile')->getFields4DataShow(Legacy_Utils::getUid()); $this->_addSortKeys(); parent::prepare($navi,$handler); }
/** * Constructor * * @param string $caption Caption * @param string $name "name" attribute * @param mixed $value Pre-selected value (or array of them). * Legal are all 2-letter country codes (in capitals). * @param int $size Number or rows. "1" makes a drop-down-list * @param string $handler Handler to use to get the list * @param string $module Dirname of module - defaults to current module */ function XoopsFormSelectList($caption, $name, $value = null, $size = 1, $handler, $module = null) { $multiple = $size > 1; $this->XoopsFormSelect($caption, $name, $value, $size, $multiple); $handler =& xoops_getmodulehandler($handler, $module); $this->addOptionArray($handler->getList()); }
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; } }
function resources_com_update($rec_id, $count) { $res_handler =& xoops_getmodulehandler('resources', 'resources'); $res_obj =& $res_handler->get($rec_id); $res_obj->setVar("res_comments", $count, true); return $res_handler->insert($res_obj, true); }
/** * Mylinks Random Term Block * * Xoops Mylinks - a links module * * 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 Project http://sourceforge.net/projects/xoops/ * @license:: http://www.fsf.org/copyleft/gpl.html GNU public license * @package:: mylinks * @subpackage:: blocks * @author:: hsalazar * @author:: zyspec (owners@zyspec) * @version:: $Id$ * @since:: File available since Release 3.11 */ function b_mylinks_random_show() { global $xoopsDB, $xoopsConfig, $xoopsModule, $xoopsModuleConfig, $xoopsUser; $mylinksDir = basename(dirname(dirname(__FILE__))); xoops_load('mylinksUtility', $mylinksDir); $myts =& MyTextSanitizer::getInstance(); $block = array(); $result = $xoopsDB->query("SELECT l.lid, l.cid, l.title, l.url, l.logourl, l.status, l.date, l.hits, l.rating, l.votes, l.comments, t.description FROM " . $xoopsDB->prefix("mylinks_links") . " l, " . $xoopsDB->prefix("mylinks_text") . " t WHERE l.lid=t.lid AND status>0 ORDER BY RAND() LIMIT 0,1"); if ($result) { list($lid, $cid, $ltitle, $url, $logourl, $status, $time, $hits, $rating, $votes, $comments, $description) = $xoopsDB->fetchRow($result); $link = $myts->displayTarea(ucfirst($ltitle)); $description = $myts->displayTarea(mb_substr($description, 0, 100)) . "..."; $mylinksCatHandler = xoops_getmodulehandler('category', $mylinksDir); $catObj = $mylinksCatHandler->get($cid); if (is_object($catObj) && !empty($catObj)) { $categoryName = $catObj->getVar('title'); $categoryName = $myts->displayTarea($categoryName); } else { $cid = 0; $categoryName = ''; } $block['title'] = _MB_MYLINKS_RANDOMTITLE; $block['content'] = "<div style=\"font-size: 12px; font-weight: bold; background-color: #ccc; padding: 4px; margin: 0;\"><a href=\"" . XOOPS_URL . "/modules/{$mylinksDir}/category.php?cid={$cid}\">{$categoryName}</a></div>"; $block['content'] .= "<div style=\"padding: 4px 0 0 0; color: #456;\"><h5 style=\"margin: 0;\"><a href=\"" . XOOPS_URL . "/modules/{$mylinksDir}/entry.php?lid={$lid}\">{$link}</a></h5><div>{$description}</div>"; unset($catObj, $mylinksCatHandler); $block['content'] .= "<div style=\"text-align: right; font-size: x-small;\"><a href=\"" . XOOPS_URL . "/modules/{$mylinksDir}/index.php\">" . _MB_MYLINKS_SEEMORE . "</a></div>"; } return $block; }
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; }
function executeViewInput(&$controller, &$xoopsUser, &$render) { // // Lazy load // $this->mObject->loadUser(); $this->mObject->loadModule(); $this->mObject->loadStatus(); // // Load children and load their module and commentater. // $handler =& xoops_getmodulehandler('comment'); $criteria = new Criteria('com_pid', $this->mObject->get('com_id')); $children =& $handler->getObjects($criteria); if (count($children) > 0) { foreach (array_keys($children) as $key) { $children[$key]->loadModule(); $children[$key]->loadUser(); } } $render->setTemplateName("comment_delete.html"); $render->setAttribute('actionForm', $this->mActionForm); $render->setAttribute('object', $this->mObject); $render->setAttribute('children', $children); }
/** * 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; }
function mytabs_blockShow($pageid, $tabid, $placement = '', $remove = '') { $block = array(); $visblocks = array(); $blocks_handler = xoops_getmodulehandler('pageblock', 'mytabs'); $blocks = $blocks_handler->getBlocks($pageid, $tabid, $placement, $remove); $groups = $GLOBALS['xoopsUser'] ? $GLOBALS['xoopsUser']->getGroups() : array(XOOPS_GROUP_ANONYMOUS); foreach (array_keys($blocks) as $key) { foreach ($blocks[$key] as $thisblock) { if ($thisblock->isVisible() && array_intersect($thisblock->getVar('groups'), $groups)) { $visblocks[] = $thisblock; } } } $count = count($visblocks); for ($i = 0; $i < $count; $i++) { $logger_name = $visblocks[$i]->getVar('title') . "(" . $visblocks[$i]->getVar('pageblockid') . ")"; $GLOBALS['xoopsLogger']->startTime($logger_name); $thisblock = $visblocks[$i]->render($GLOBALS['xoopsTpl'], $tabid . '_' . $visblocks[$i]->getVar('pageblockid')); if ($thisblock != false) { if (strlen($thisblock['title']) > 0) { if ($thisblock['title'][0] == '-') { $thisblock['title'] = ''; } } $block[] = $thisblock; } $GLOBALS['xoopsLogger']->stopTime($logger_name); } return $block; }
function getValidItems($mid, $id = 0) { static $suspension = array(); $full_items = array(); if (empty($mid)) { return $full_items; } require_once XOOPS_ROOT_PATH . "/modules/newbb/include/functions.user.php"; $uid = is_object($GLOBALS["xoopsUser"]) ? $GLOBALS["xoopsUser"]->getVar("uid") : 0; $ip = newbb_getIP(true); if (!empty($GLOBALS["xoopsModuleConfig"]['enable_usermoderate']) && !isset($suspension[$uid][$id]) && !newbb_isAdmin($id)) { $moderate_handler =& xoops_getmodulehandler('moderate', 'newbb'); if ($moderate_handler->verifyUser($uid, "", $id)) { $suspension[$uid][$ip][$id] = 1; } else { $suspension[$uid][$ip][$id] = 0; } } $items = $this->getValidPerms(); foreach ($items as $item) { /* skip access for suspended users */ //if ( !empty($suspension[$uid][$ip][$id]) && in_array($item, array("post", "reply", "edit", "delete", "addpoll", "vote", "attach", "noapprove", "type")) ) continue; if (!empty($suspension[$uid][$ip][$id])) { continue; } $full_items[] = "'forum_{$item}'"; } return $full_items; }