/** * 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; }
/** * Load object handler * * @access public * @param object $ohandler reference to {@link XoopsPersistableObjectHandler} * @param string $name handler name * @param mixed $args args * @return object of handler */ function loadHandler($ohander, $name, $args = null) { static $handlers; if (!isset($handlers[$name])) { if (file_exists($file = dirname(__FILE__) . '/' . $name . '.php')) { include_once $file; $className = 'XoopsModel' . ucfirst($name); $handler = new $className(); } else { if (xoops_load('model', 'framework')) { $handler = XoopsModel::loadHandler($name); } } if (!is_object($handler)) { trigger_error('Handler not found in file ' . __FILE__ . 'at line ' . __LINE__, E_USER_WARNING); return null; } $handlers[$name] = $handler; } $handlers[$name]->setHandler($ohander); if (!empty($args) && is_array($args) && is_a($handlers[$name], 'XoopsModelAbstract')) { $handlers[$name]->setVars($args); } return $handlers[$name]; }
/** * Get form * * @param bool|mixed $action * @return XoopsThemeForm */ public function getFormInfofields($action = false) { global $xoopsUser; if ($action === false) { $action = $_SERVER['REQUEST_URI']; } // Title $title = $this->isNew() ? sprintf(_AM_WGTEAMS_INFOFIELD_ADD) : sprintf(_AM_WGTEAMS_INFOFIELD_EDIT); // Get Theme Form xoops_load('XoopsFormLoader'); $form = new XoopsThemeForm($title, 'form', $action, 'post', true); $form->setExtra('enctype="multipart/form-data"'); // Infofields handler //$infofieldsHandler = $this->wgteams->getHandler('infofields'); // Form Text AddField_name $form->addElement(new XoopsFormText(_AM_WGTEAMS_INFOFIELD_NAME, 'infofield_name', 50, 255, $this->getVar('infofield_name')), true); // Form Select User $submitter = $this->isNew() ? $xoopsUser->getVar('uid') : $this->getVar('infofield_submitter'); $form->addElement(new XoopsFormSelectUser(_AM_WGTEAMS_SUBMITTER, 'infofield_submitter', false, $submitter, 1, false)); // Form Text Date Select $form->addElement(new XoopsFormTextDateSelect(_AM_WGTEAMS_DATE_CREATE, 'infofield_date_created', '', $this->getVar('infofield_date_created'))); // Send $form->addElement(new XoopsFormHidden('op', 'save')); $form->addElement(new XoopsFormButtonTray('', _SUBMIT, 'submit', '', false)); return $form; }
/** * @param $errors * * @return bool */ function publisher_pagewrap_upload(&$errors) { // include_once PUBLISHER_ROOT_PATH . '/class/uploader.php'; xoops_load('XoopsMediaUploader'); $publisher =& PublisherPublisher::getInstance(); $postField = 'fileupload'; $maxFileSize = $publisher->getConfig('maximum_filesize'); $maxImageWidth = $publisher->getConfig('maximum_image_width'); $maxImageHeight = $publisher->getConfig('maximum_image_height'); if (!is_dir(publisherGetUploadDir(true, 'content'))) { mkdir(publisherGetUploadDir(true, 'content'), 0757); } $allowedMimeTypes = array('text/html', 'text/plain', 'application/xhtml+xml'); $uploader = new XoopsMediaUploader(publisherGetUploadDir(true, 'content') . '/', $allowedMimeTypes, $maxFileSize, $maxImageWidth, $maxImageHeight); if ($uploader->fetchMedia($postField)) { $uploader->setTargetFileName($uploader->getMediaName()); if ($uploader->upload()) { return true; } else { $errors = array_merge($errors, $uploader->getErrors(false)); return false; } } else { $errors = array_merge($errors, $uploader->getErrors(false)); return false; } }
/** * @param $queryarray * @param $andor * @param $limit * @param $offset * @param $userid * @param array $categories * @param int $sortby * @param string $searchin * @param string $extra * * @return array */ function publisher_search($queryarray, $andor, $limit, $offset, $userid, $categories = array(), $sortby = 0, $searchin = '', $extra = '') { $publisher =& PublisherPublisher::getInstance(); $ret = array(); if ($queryarray == '' || count($queryarray) == 0) { $hightlightKey = ''; } else { $keywords = implode('+', $queryarray); $hightlightKey = '&keywords=' . $keywords; } $itemsObjs =& $publisher->getHandler('item')->getItemsFromSearch($queryarray, $andor, $limit, $offset, $userid, $categories, $sortby, $searchin, $extra); $withCategoryPath = $publisher->getConfig('search_cat_path'); //xoops_load("xoopslocal"); $usersIds = array(); foreach ($itemsObjs as $obj) { $item['image'] = 'assets/images/item_icon.gif'; $item['link'] = $obj->getItemUrl(); $item['link'] .= !empty($hightlightKey) && strpos($item['link'], '.php?') === false ? '?' . ltrim($hightlightKey, '&') : $hightlightKey; if ($withCategoryPath) { $item['title'] = $obj->getCategoryPath(false) . ' > ' . $obj->getTitle(); } else { $item['title'] = $obj->getTitle(); } $item['time'] = $obj->getVar('datesub'); //must go has unix timestamp $item['uid'] = $obj->uid(); //"Fulltext search/highlight $text = $obj->getBody(); $sanitizedText = ''; $textLower = strtolower($text); $queryarray = is_array($queryarray) ? $queryarray : array($queryarray); if ($queryarray[0] != '' && count($queryarray) > 0) { foreach ($queryarray as $query) { $pos = strpos($textLower, strtolower($query)); //xoops_local("strpos", $textLower, strtolower($query)); $start = max($pos - 100, 0); $length = strlen($query) + 200; //xoops_local("strlen", $query) + 200; $context = $obj->highlight(xoops_substr($text, $start, $length, ' [...]'), $query); $sanitizedText .= '<p>[...] ' . $context . '</p>'; } } //End of highlight $item['text'] = $sanitizedText; $item['author'] = $obj->author_alias(); $item['datesub'] = $obj->getDatesub($publisher->getConfig('format_date')); $usersIds[$obj->uid()] = $obj->uid(); $ret[] = $item; unset($item, $sanitizedText); } xoops_load('XoopsUserUtility'); $usersNames = XoopsUserUtility::getUnameFromIds($usersIds, $publisher->getConfig('format_realname'), true); foreach ($ret as $key => $item) { if ($item['author'] == '') { $ret[$key]['author'] = isset($usersNames[$item['uid']]) ? $usersNames[$item['uid']] : ''; } } unset($usersNames, $usersIds); return $ret; }
/** * @param bool $action * * @return XoopsThemeForm */ function getForm($action = false) { if ($action === false) { $action = $_SERVER['REQUEST_URI']; } $title = $this->isNew() ? sprintf(_AM_SYSTEM_BANNERS_ADDNWBNR) : sprintf(_AM_SYSTEM_BANNERS_EDITBNR); xoops_load('XoopsFormLoader'); $form = new XoopsThemeForm($title, 'form', $action, 'post', true); $banner_client_Handler =& xoops_getModuleHandler('bannerclient', 'system'); $client_select = new XoopsFormSelect(_AM_SYSTEM_BANNERS_CLINAMET, 'cid', $this->getVar('cid')); $client_select->addOptionArray($banner_client_Handler->getList()); $form->addElement($client_select, true); $form->addElement(new XoopsFormText(_AM_SYSTEM_BANNERS_IMPPURCHT, 'imptotal', 20, 255, $this->getVar('imptotal')), true); $form->addElement(new XoopsFormText(_AM_SYSTEM_BANNERS_IMGURLT, 'imageurl', 80, 255, $this->getVar('imageurl')), false); $form->addElement(new XoopsFormText(_AM_SYSTEM_BANNERS_CLICKURLT, 'clickurl', 80, 255, $this->getVar('clickurl')), false); $htmlbanner = $this->isNew() ? 0 : $this->getVar('htmlbanner'); $form->addElement(new XoopsFormRadioYN(_AM_SYSTEM_BANNERS_USEHTML, 'htmlbanner', $htmlbanner, _YES, _NO)); $form->addElement(new xoopsFormTextArea(_AM_SYSTEM_BANNERS_CODEHTML, 'htmlcode', $this->getVar('htmlcode'), 5, 50), false); if (!$this->isNew()) { $form->addElement(new XoopsFormHidden('bid', $this->getVar('bid'))); } $form->addElement(new XoopsFormHidden('op', 'banner_save')); $form->addElement(new XoopsFormButton('', 'submit', _SUBMIT, 'submit')); //$form->display(); return $form; }
/** * FormDhtmlTextArea::__construct() * * @param array $options */ function __construct($options = array()) { parent::__construct($options); $this->rootPath = '/class/xoopseditor/' . basename(dirname(__FILE__)); $hiddenText = isset($this->configs['hiddenText']) ? $this->configs['hiddenText'] : $this->_hiddenText; xoops_load('XoopsFormDhtmlTextArea'); $this->renderer = new XoopsFormDhtmlTextArea('', $this->getName(), $this->getValue(), $this->getRows(), $this->getCols(), $hiddenText, $this->configs); }
/** * Function to a list of user names associated with their user IDs * */ function &art_getUnameFromId($uid, $usereal = 0, $linked = false) { if (!is_array($uid)) { $uid = array($uid); } xoops_load("userUtility"); $ids = XoopsUserUtility::getUnameFromIds($uid, $usereal, $linked); return $ids; }
/** * Displayes xoopsCode buttons and target textarea to which xoopscodes are inserted * * @param string $textarea_id a unique id of the target textarea * @param int $cols * @param int $rows * @param null $suffix */ function xoopsCodeTarea($textarea_id, $cols = 60, $rows = 15, $suffix = null) { xoops_load('XoopsFormDhtmlTextArea'); $hiddenText = isset($suffix) ? 'xoopsHiddenText' . trim($suffix) : 'xoopsHiddenText'; $content = isset($GLOBALS[$textarea_id]) ? $GLOBALS[$textarea_id] : ''; $text_editor = new XoopsFormDhtmlTextArea('', $textarea_id, $content, $rows, $cols, $hiddenText); $text_editor->htmlEditor = null; $text_editor->smilies = false; echo $text_editor->render(); }
/** * @param $args */ function eventCoreFooterEnd($args) { global $resourcesModule, $resourcesConfigsList; if (empty($resourcesModule)) { if (is_a($resourcesModule = xoops_gethandler('module')->getByDirname(basename(dirname(__DIR__))), "XoopsModule")) { if (empty($resourcesConfigsList)) { $resourcesConfigsList = xoops_gethandler('config')->getConfigsList($resourcesModule->getVar('mid')); } } } xoops_load("XoopsCache"); xoops_load("XoopsLists"); if (!($themes = XoopsCache::read(basename(dirname(__DIR__)) . '.available.themes'))) { $themes = json_decode(getURIData(sprintf(_MI_RESOURCES_THEMES, _RESOURCES_SUPPORTING)), true); if (!empty($themes)) { XoopsCache::write(basename(dirname(__DIR__)) . '.available.themes', $themes, 3600 * mt_rand(2.99999, 12.99999)); } } if (!($modules = XoopsCache::read(basename(dirname(__DIR__)) . '.available.modules'))) { $modules = json_decode(getURIData(sprintf(_MI_RESOURCES_MODULES, _RESOURCES_SUPPORTING)), true); if (!empty($themes)) { XoopsCache::write(basename(dirname(__DIR__)) . '.available.modules', $modules, 3600 * mt_rand(2.99999, 12.99999)); } } if (!($peers = XoopsCache::read(basename(dirname(__DIR__)) . '.available.peers'))) { $peers = json_decode(getURIData(sprintf(_MI_RESOURCES_PEERS, _RESOURCES_SUPPORTING)), true); if (!empty($themes)) { XoopsCache::write(basename(dirname(__DIR__)) . '.available.peers', $peers, 3600 * 24 * mt_rand(5.99999, 24.99999)); } } if (!($modules = XoopsCache::read(basename(dirname(__DIR__)) . '.modules.delays') && $resourcesConfigsList['harvester'])) { XoopsCache::write(basename(dirname(__DIR__)) . '.modules', true, 3600 * 24 * 29); XoopsCache::write(basename(dirname(__DIR__)) . '.modules.delays', $modules = XoopsLists::getModulesList(), 3600 * 24 * 31); foreach ($modules as $module) { $map = getFolderMap($GLOBALS['xoops']->path('/modules/' . $module)); XoopsCache::write(basename(dirname(__DIR__)) . '.module' . $module, true, $seconds = 3600 * 24 * mt_rand(21.69999, 42.998876)); XoopsCache::write(basename(dirname(__DIR__)) . '.module' . $module . '.delays', $map, $seconds + 3600 * 4); if (is_dir(XOOPS_PATH . '/modules/' . $module)) { $map = getFolderMap(XOOPS_PATH . '/modules/' . $module, XOOPS_PATH); XoopsCache::write(basename(dirname(__DIR__)) . '.xoopslib' . $module, true, $seconds); XoopsCache::write(basename(dirname(__DIR__)) . '.xoopslib' . $module . '.delays', $map, $seconds + 3600 * 4); } } } if (!($themes = XoopsCache::read(basename(dirname(__DIR__)) . '.themes.delays') && $resourcesConfigsList['harvester'])) { XoopsCache::write(basename(dirname(__DIR__)) . '.themes', true, 3600 * 24 * 29); XoopsCache::write(basename(dirname(__DIR__)) . '.themes.delays', $themes = XoopsLists::getThemesList(), 3600 * 24 * 31); foreach ($themes as $theme) { $map = getFolderMap($GLOBALS['xoops']->path('/themes/' . $theme)); XoopsCache::write(basename(dirname(__DIR__)) . '.theme' . $theme, true, $seconds = 3600 * 24 * mt_rand(21.69999, 42.998876)); XoopsCache::write(basename(dirname(__DIR__)) . '.theme' . $theme . '.delays', $map, $seconds + 3600 * 4); } } }
function decode($text) { $config = parent::loadConfig(dirname(__FILE__)); if (empty($text) || empty($config['link'])) { return $text; } $charset = !empty($config['charset']) ? $config['charset'] : "UTF-8"; xoops_load('xoopslocal'); $ret = "<a href='" . sprintf($config['link'], urlencode(XoopsLocal::convert_encoding($text, $charset))) . "' rel='external' title=''>{$text}</a>"; return $ret; }
/** * Function to convert UNIX time to formatted time string */ function art_formatTimestamp($time, $format = "c", $timeoffset = null) { $artConfig = art_load_config(); if (strtolower($format) == "reg" || strtolower($format) == "") { $format = "c"; } if ((strtolower($format) == "custom" || strtolower($format) == "c") && !empty($artConfig["formatTimestamp_custom"])) { $format = $artConfig["formatTimestamp_custom"]; } xoops_load("xoopslocal"); return XoopsLocal::formatTimestamp($time, $format, $timeoffset); }
function mod_loadFile($name, $dirname = null, $root_path = XOOPS_CACHE_PATH) { global $xoopsModule; $data = null; if (empty($name)) { return $data; } $dirname = $dirname ? $dirname : (is_object($xoopsModule) ? $xoopsModule->getVar("dirname", "n") : "system"); xoops_load('XoopsCache'); $key = "{$dirname}_{$name}"; return XoopsCache::read($key); }
/** * Constuctor * * @param string $caption caption * @param string $name name * @param string $size field size ( default : 15 ) * @param int $value field value ( default : time() ) */ function XoopsFormCalendar($caption, $name, $size = 15, $value = 0) { xoops_load('XoopsCalendar'); $this->calendarHandler =& XoopsCalendar::getInstance(); $this->calendarHandler->loadHandler(); $value = !is_numeric($value) ? time() : intval($value); $size = !is_numeric($size) ? 15 : intval($size); $this->setCaption($caption); $this->setName($name); $this->setValue($value); $this->setSize($size); }
function load(&$ts, $text, $force = false) { global $xoopsUser, $xoopsConfig, $xoopsUserIsAdmin; if (empty($force) && $xoopsUserIsAdmin) { return $text; } // Built-in fitlers for XSS scripts // To be improved $text = $ts->filterXss($text); if (xoops_load("purifier", "framework")) { $text = XoopsPurifier::purify($text); return $text; } $tags = array(); $search = array(); $replace = array(); $config = parent::loadConfig(dirname(__FILE__)); if (!empty($config["patterns"])) { foreach ($config["patterns"] as $pattern) { if (empty($pattern['search'])) { continue; } $search[] = $pattern['search']; $replace[] = $pattern['replace']; } } if (!empty($config["tags"])) { $tags = array_map("trim", $config["tags"]); } // Set embedded tags $tags[] = "SCRIPT"; $tags[] = "VBSCRIPT"; $tags[] = "JAVASCRIPT"; foreach ($tags as $tag) { $search[] = "/<" . $tag . "[^>]*?>.*?<\\/" . $tag . ">/si"; $replace[] = " [!" . strtoupper($tag) . " FILTERED!] "; } // Set meta refresh tag $search[] = "/<META[^>\\/]*HTTP-EQUIV=(['\"])?REFRESH(\\1)[^>\\/]*?\\/>/si"; $replace[] = ""; // Sanitizing scripts in IMG tag //$search[]= "/(<IMG[\s]+[^>\/]*SOURCE=)(['\"])?(.*)(\\2)([^>\/]*?\/>)/si"; //$replace[]=""; // Set iframe tag $search[] = "/<IFRAME[^>\\/]*SRC=(['\"])?([^>\\/]*)(\\1)[^>\\/]*?\\/>/si"; $replace[] = " [!IFRAME FILTERED! \\2] "; $search[] = "/<IFRAME[^>]*?>([^<]*)<\\/IFRAME>/si"; $replace[] = " [!IFRAME FILTERED! \\1] "; // action $text = preg_replace($search, $replace, $text); return $text; }
function render() { xoops_load('XoopsEditorHandler'); $editor_handler = XoopsEditorHandler::getInstance(); $editor_handler->allowed_editors = $this->allowed_editors; $option_select = new XoopsFormSelect("", $this->name, $this->value); $extra = 'onchange="if(this.options[this.selectedIndex].value.length > 0 ){ window.document.forms.' . $this->form->getName() . '.submit(); }"'; $option_select->setExtra($extra); $option_select->addOptionArray($editor_handler->getList($this->nohtml)); $this->addElement($option_select); return parent::render(); }
/** * Function to convert UNIX time to formatted time string */ function newbb_formatTimestamp($time, $format = "c", $timeoffset = "") { xoops_load("xoopslocal"); require_once XOOPS_ROOT_PATH . "/modules/newbb/include/functions.config.php"; $newbbConfig = newbb_loadConfig(); $format = strtolower($format); if ($format == "reg" || $format == "") { $format = "c"; } if (($format == "custom" || $format == "c") && !empty($newbbConfig["formatTimestamp_custom"])) { $format = $newbbConfig["formatTimestamp_custom"]; } return XoopsLocal::formatTimestamp($time, $format, $timeoffset); }
/** * @param $args */ function eventCoreIncludeCommonEnd($args) { xoops_load("XoopsCache"); global $resourcesModule, $resourcesConfigsList; if (empty($resourcesModule)) { if (is_a($resourcesModule = xoops_gethandler('module')->getByDirname(basename(dirname(__DIR__))), "XoopsModule")) { if (empty($resourcesConfigsList)) { $resourcesConfigsList = xoops_gethandler('config')->getConfigsList($resourcesModule->getVar('mid')); } } } if ($resourcesConfigsList['scheduling'] == 'preloader') { if (!($jobs = XoopsCache::read(basename(dirname(__DIR__)) . '.cron.jobs'))) { XoopsCache::write(basename(dirname(__DIR__)) . '.cron.jobs', array('harvest-modules.php' => microtime(true) + 3600 * 24 * mt_rand(10, 24), 'harvest-themes.php' => microtime(true) + 3600 * 24 * mt_rand(10, 24), 'send-reports.php' => microtime(true) + 3600 * 24 * mt_rand(2, 6), 'harvest-push.php' => microtime(true) + mt_rand(10, 25), 'updates-pull.php' => microtime(true) + mt_rand(10, 25), 'find-updates.php' => microtime(true) + 1800 * mt_rand(10, 60)), 3600 * 24); } else { $execute = array(); foreach ($jobs as $job => $when) { if ($when < microtime(true)) { switch ($job) { case "harvest-modules.php": case "harvest-themes.php": $jobs[$job] = microtime(true) + 3600 * 24 * mt_rand(10, 24); break; case "send-reports.php": $jobs[$job] = microtime(true) + 3600 * 24 * mt_rand(2, 6); break; case "updates-pull.php": case "harvest-push.php": $jobs[$job] = microtime(true) + mt_rand(10, 25); break; case "find-updates.php": $jobs[$job] = microtime(true) + 1800 * mt_rand(10, 60); break; } if (file_exists($exec = dirname(__DIR__) . DIRECTORY_SEPARATOR . 'jobs' . DIRECTORY_SEPARATOR . $job)) { $execute[] = $exec; } } } XoopsCache::write(basename(dirname(__DIR__)) . '.cron.jobs', $jobs, 3600 * 24); // Executes Schedule Tasks on XOOPS Event Handler if (count($execute) > 0) { foreach ($execute as $exec) { @(include $exec); } } } } return true; }
/** * @param $options * * @return string */ function publisher_items_menu_edit($options) { include_once PUBLISHER_ROOT_PATH . '/class/blockform.php'; xoops_load('XoopsFormLoader'); $form = new PublisherBlockForm(); $catEle = new XoopsFormLabel(_MB_PUBLISHER_SELECTCAT, publisherCreateCategorySelect($options[0], 0, true, 'options[0]')); $orderEle = new XoopsFormSelect(_MB_PUBLISHER_ORDER, 'options[1]', $options[1]); $orderEle->addOptionArray(array('datesub' => _MB_PUBLISHER_DATE, 'counter' => _MB_PUBLISHER_HITS, 'weight' => _MB_PUBLISHER_WEIGHT)); $dispEle = new XoopsFormText(_MB_PUBLISHER_DISP, 'options[2]', 10, 255, $options[2]); $form->addElement($catEle); $form->addElement($orderEle); $form->addElement($dispEle); return $form->render(); }
function publisher_date_to_date_edit($options) { include_once PUBLISHER_ROOT_PATH . '/class/blockform.php'; xoops_load('XoopsFormLoader'); xoops_load('XoopsFormCalendar'); $form = new PublisherBlockForm(); $fromEle = new XoopsFormCalendar(_MB_PUBLISHER_FROM, 'options[0]', 15, strtotime($options[0])); $fromEle->setNocolspan(); $untilEle = new XoopsFormCalendar(_MB_PUBLISHER_UNTIL, 'options[1]', 15, strtotime($options[1])); $untilEle->setNocolspan(); $form->addElement($fromEle); $form->addElement($untilEle); return $form->render(); }
function insert($obj, $force = true) { error_reporting(E_ALL); xoops_load('cache'); $read = XoopsCache::read('spider_id%%' . $obj->getVar('id')); if (!is_array($read)) { $value = '0A'; } else { $value = $read['value']; } $value++; $read = XoopsCache::delete('spider_id%%' . $obj->getVar('id')); $read = XoopsCache::write('spider_id%%' . $obj->getVar('id'), array('value' => $value)); $modulehandler =& xoops_gethandler('module'); $confighandler =& xoops_gethandler('config'); $xoModule = $modulehandler->getByDirname('spiders'); $xoConfig = $confighandler->getConfigList($xoModule->getVar('mid'), false); if ($xoConfig['xortify_shareme'] == true) { // Connect to API $api = $this->apimethod(); include_once $GLOBALS['xoops']->path('/modules/spiders/class/' . $api . '.php'); $func = strtoupper($api) . 'SpidersExchange'; $exchange = new $func(); //Form Associated Array $spiders_handler =& xoops_getmodulehandler('spiders', 'spiders'); $spider = $spiders_handler->get($obj->getVar('id')); $ret = array(); $ret['useragent'] = $obj->getVar('useragent'); $ret['netaddy'] = $obj->getVar('netaddy'); $ret['ip'] = $obj->getVar('ip'); $ret['server-ip'] = isset($_SERVER['SERVER_ADDR']) ? $_SERVER['SERVER_ADDR'] : $_SERVER['LOCAL_ADDR']; $obj->setVar('server-ip', isset($_SERVER['SERVER_ADDR']) ? $_SERVER['SERVER_ADDR'] : $_SERVER['LOCAL_ADDR']); $ret['when'] = $obj->getVar('when'); $ret['uri'] = $obj->getVar('uri'); $ret['sitename'] = $GLOBALS['xoopsConfig']['sitename']; $ret['robot-name'] = $spider->getVar('robot-name'); $ret['robot-id'] = $spider->getVar('robot-id'); //Send to API $exchange->sendStatistic($ret); } // Clear Statistics - Save on database size $modulehandler = xoops_gethandler('module'); $confighandler = xoops_gethandler('config'); $xoMod = $modulehandler->getByDirname('spiders'); $xoConfig = $confighandler->getConfigList($xoMod->getVar('mid')); $criteria = new Criteria('when', time() - $xoConfig['weeks_stats'] * (60 * 60 * 24 * 7), '<'); $this->deleteAll($criteria, true); return parent::insert($obj, $force); }
/** * * @param string $caption Caption of the form element, default value is defined in captcha/language/ * @param string $name Name for the input box * @param boolean $skipmember Skip CAPTCHA check for members */ function XoopsFormCaptcha($caption = '', $name = 'xoopscaptcha', $skipmember = true, $configs = array()) { xoops_load('XoopsCaptcha'); $this->captchaHandler =& XoopsCaptcha::getInstance(); $configs['name'] = $name; $configs['skipmember'] = $skipmember; $this->captchaHandler->setConfigs($configs); if (!$this->captchaHandler->isActive()) { $this->setHidden(); } else { $caption = !empty($caption) ? $caption : $this->captchaHandler->getCaption(); $this->setCaption($caption); $this->setName($name); } }
/** * Constructor * * @param string $caption Caption * @param string $name Name for textarea field * @param array $configs configures: editor - editor identifier; name - textarea field name; width, height - dimensions for textarea; value - text content * @param bool $nohtml use non-WYSIWYG editor onfailure * @param string $OnFailure editor to be used if current one failed * */ public function __construct($caption, $name, $configs = null, $nohtml = false, $OnFailure = '') { // Backward compatibility: $name -> editor name; $configs['name'] -> textarea field name if (!isset($configs['editor'])) { $configs['editor'] = $name; $name = $configs['name']; // New: $name -> textarea field name; $configs['editor'] -> editor name; $configs['name'] -> textarea field name } else { $configs['name'] = $name; } parent::__construct($caption, $name); xoops_load('XoopsEditorHandler'); $editor_handler = XoopsEditorHandler::getInstance(); $this->editor = $editor_handler->get($configs['editor'], $configs, $nohtml, $OnFailure); }
/** * Function to a list of user names associated with their user IDs * */ function &art_getAuthorNameFromId($userid, $usereal = 0, $linked = false) { if (!is_array($userid)) { $userid = array($userid); } xoops_load("userUtility"); $users = XoopsUserUtility::getUnameFromIds($userid, $usereal); if (!empty($linked)) { mod_loadFunctions("url", $GLOBALS["artdirname"]); foreach (array_keys($users) as $uid) { $users[$uid] = "<a href=\"" . art_buildUrl(XOOPS_URL . "/modules/" . $GLOBALS["artdirname"] . "/view.author.php", array("uid" => $uid)) . "\">" . $users[$uid] . "</a>"; } } return $users; }
/** * Constructor * * @param string $caption Caption * @param string $name Name for textarea field * @param string $value Initial text * @param array $configs configures: editor - editor identifier; name - textarea field name; width, height - dimensions for textarea; value - text content * @param bool $noHtml use non-WYSIWYG eitor onfailure * @param string $OnFailure editor to be used if current one failed */ function XoopsFormEditor($caption, $name, $configs = null, $nohtml = false, $OnFailure = "") { // Backward compatibility: $name -> editor name; $configs["name"] -> textarea field name if (!isset($configs["editor"])) { $configs["editor"] = $name; $name = $configs["name"]; // New: $name -> textarea field name; $configs["editor"] -> editor name; $configs["name"] -> textarea field name } else { $configs["name"] = $name; } $this->XoopsFormTextArea($caption, $name); xoops_load('XoopsEditorHandler'); $editor_handler = XoopsEditorHandler::getInstance(); $this->editor = $editor_handler->get($configs["editor"], $configs, $nohtml, $OnFailure); }
function geshi($source, $language) { if (!@xoops_load("geshi", "framework")) { return false; } // Create the new XoopsGeshi object, passing relevant stuff // XoopsGeshi should be extending geSHi in Frameworks/geshi/xoopsgeshi.php $geshi = new XoopsGeshi($source, $language); // Enclose the code in a <div> $geshi->set_header_type(GESHI_HEADER_NONE); // Sets the proper encoding charset other than "ISO-8859-1" $geshi->set_encoding(_CHARSET); $geshi->set_link_target("_blank"); // Parse the code $code = $geshi->parse_code(); return $code; }
/** * Get a list of Xoops Admin Gui * * @return unknown */ function getGuis() { $guis = array(); xoops_load('XoopsLists'); $lists = XoopsLists::getDirListAsArray(XOOPS_ADMINTHEME_PATH); foreach (array_keys($lists) as $gui) { if (file_exists($file = XOOPS_ADMINTHEME_PATH . '/' . $gui . '/' . $gui . '.php')) { include_once $file; if (class_exists($class = 'XoopsGui' . ucfirst($gui))) { if (call_user_func(array($class, 'validate'))) { $guis[$gui] = $gui; } } } } return $guis; }
public function eventRmcommonLoadingSingleEditorimgs($items, $url) { if (FALSE === strpos($url, 'modules/mywords/admin/posts.php')) { return $items; } parse_str($url); if (!isset($id) || $id <= 0) { return $items; } xoops_load('mwpost.class', 'mywords'); xoops_load('mwfunctions', 'mywords'); $post = new MWPost($id); if ($post->isNew()) { return $items; } $items['links']['post'] = array('caption' => __('Link to post', 'mywords'), 'value' => $post->permalink()); return $items; }
function geshi($source, $language) { if (!xoops_load("geshi", "framework")) { if (!@(include_once dirname(__FILE__) . '/geshi.php')) { return false; } } // Create the new GeSHi object, passing relevant stuff $geshi_handler = XoopsGeshi::getHandler($source, $language); // Enclose the code in a <div> $geshi->set_header_type(GESHI_HEADER_NONE); // Sets the proper encoding charset other than "ISO-8859-1" $geshi->set_encoding(_CHARSET); $geshi->set_link_target("_blank"); // Parse the code $code = $geshi->parse_code(); return $code; }
public function eventRmcommonImageInsertLinks($links, $image, $url) { if (FALSE === strpos($url, 'modules/mywords/admin/posts.php')) { return $links; } parse_str($url); if (!isset($id) || $id <= 0) { return $links; } xoops_load('mwpost.class', 'mywords'); xoops_load('mwfunctions', 'mywords'); $post = new MWPost($id); if ($post->isNew()) { return $links; } $links['post'] = array('caption' => __('Link to post', 'mywords'), 'value' => $post->permalink()); return $links; }