/**
  * @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);
         }
     }
 }
Esempio n. 2
0
 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);
 }
 /**
  * @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;
 }
Esempio n. 4
0
 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);
 }
Esempio n. 5
0
 /**
  * Get available preloads information and set them to go!
  *
  * @return void
  */
 function setPreloads()
 {
     //$modules_list = XoopsLists::getDirListAsArray(XOOPS_ROOT_PATH . "/modules/");
     if ($modules_list = XoopsCache::read('system_modules_active')) {
         $i = 0;
         foreach ($modules_list as $module) {
             if (is_dir($dir = XOOPS_ROOT_PATH . "/modules/{$module}/preloads/")) {
                 $file_list = XoopsLists::getFileListAsArray($dir);
                 foreach ($file_list as $file) {
                     if (preg_match('/(\\.php)$/i', $file)) {
                         $file = substr($file, 0, -4);
                         $this->_preloads[$i]['module'] = $module;
                         $this->_preloads[$i]['file'] = $file;
                         $i++;
                     }
                 }
             }
         }
     }
 }
Esempio n. 6
0
/**
 * @package     smarty xoopsplugin
 * 
 * @author	    Hu Zhenghui <*****@*****.**>
 *  
 * how to use
 * The following code inserted in the template
 *  
 * @param module string module dirname
 * @param file  string block funciton file
 * @param show_func string show block function
 * @param options= string show block function's option
 * @param cachetime int  cachetime Unit for seconds 
 * @param user mix Generate cache solution

<{freeBlkTpl id=1}>
    <link rel="stylesheet" href="<{$xoops_url}>/modules/tag/templates/style.css" />
    <div class="tag-cloud" style="line-height: 150%; padding: 5px;">
    <{foreach item=tag from=$block.tags}>
    	<span class="tag-level-<{$tag.level}>" style="font-size: <{$tag.font}>%; display: inline; padding-right: 5px;">
    		<a href="<{$xoops_url}>/modules/<{$block.tag_dirname}>/view.tag.php<{$smarty.const.URL_DELIMITER}><{$tag.id}>/" title="<{$tag.term}>"><{$tag.term}></a>
    	</span>
    <{/foreach}>
    </div>
<{/freeBlkTpl}>
*/
function smarty_block_freeBlkTpl($params, $content, &$smarty, &$repeat)
{
    static $old_block;
    if (empty($content)) {
        $old_block = $smarty->get_template_vars('block');
        if (!isset($params['id'])) {
            return;
        }
        $block_id = intval($params['id']);
        static $block_objs;
        $blockObj = $GLOBALS['xoopsTpl']->_tpl_vars['ezblocks'][$block_id];
        // ezsky hack
        if (empty($blockObj)) {
            return false;
        }
        $xoopsLogger =& XoopsLogger::instance();
        $template =& $GLOBALS['xoopsTpl'];
        xoops_load("cache");
        $cache_key = 'xoBlkTpl_' . md5(var_export($params, true));
        $bcachetime = intval($blockObj->getVar('bcachetime'));
        if (!$bcachetime || !($bresult = XoopsCache::read($cache_key))) {
            $xoopsLogger->addBlock($blockObj->getVar('name'));
            if (!($bresult = $blockObj->buildBlock())) {
                return;
            }
            if (isset($bcachetime)) {
                XoopsCache::write($cache_key, $bresult, $bcachetime);
            }
        } else {
            $xoopsLogger->addBlock($blockObj->getVar('name'), true, $bcachetime);
        }
        $old_block = $smarty->get_template_vars('block');
        $smarty->assign('block', $bresult);
    } else {
        echo $content;
        $smarty->assign('block', $old_block);
    }
}
Esempio n. 7
0
 /**
  * Return the settings for current cache engine
  *
  * @param string $engine Name of the engine
  * @return array list of settings for this engine
  * @access public
  */
 function settings($engine = null)
 {
     $_this =& XoopsCache::getInstance();
     if (!$engine && isset($_this->configs[$_this->name]['engine'])) {
         $engine = $_this->configs[$_this->name]['engine'];
     }
     if (isset($_this->engine[$engine]) && !is_null($_this->engine[$engine])) {
         return $_this->engine[$engine]->settings();
     }
     return array();
 }
Esempio n. 8
0
 /**
  * XoopsEditorHandler::getList()
  *
  * @param mixed $noHtml
  *
  * @return array
  */
 function getList($noHtml = false)
 {
     /*
         Do NOT use this method statically, please use
         $editor_handler = XoopsEditorHandler::getInstance();
         $result = array_flip($editor_handler->getList());
     */
     if (!isset($this->root_path)) {
         $this->root_path = XOOPS_ROOT_PATH . '/class/xoopseditor';
         $GLOBALS['xoopsLogger']->addDeprecated(__CLASS__ . '::' . __FUNCTION__ . '() should not be called statically.');
     }
     xoops_load('XoopsCache');
     $list = XoopsCache::read('editorlist');
     if (empty($list)) {
         $list = array();
         $order = array();
         xoops_load('XoopsLists');
         $_list = XoopsLists::getDirListAsArray($this->root_path . '/');
         foreach ($_list as $item) {
             if (file_exists($file = $this->root_path . '/' . $item . '/language/' . $GLOBALS['xoopsConfig']['language'] . '.php')) {
                 include_once $file;
             } else {
                 if (file_exists($file = $this->root_path . '/' . $item . '/language/english.php')) {
                     include_once $file;
                 }
             }
             if (file_exists($file = $this->root_path . '/' . $item . '/editor_registry.php')) {
                 include $file;
                 if (empty($config['order'])) {
                     continue;
                 }
                 $order[] = $config['order'];
                 $list[$item] = array('title' => $config['title'], 'nohtml' => $config['nohtml']);
             }
         }
         array_multisort($order, $list);
         XoopsCache::write('editorlist', $list);
     }
     $editors = array_keys($list);
     if (!empty($this->allowed_editors)) {
         $editors = array_intersect($editors, $this->allowed_editors);
     }
     $_list = array();
     foreach ($editors as $name) {
         if (!empty($noHtml) && empty($list[$name]['nohtml'])) {
             continue;
         }
         $_list[$name] = $list[$name]['title'];
     }
     return $_list;
 }
Esempio n. 9
0
ob_start();
$output_function($destination_image, null, $quality);
$imageData = ob_get_contents();
ob_end_clean();
// Update $image_created_time
$imageCreatedTime = time();
// Clean up the memory
imagedestroy($sourceImage);
imagedestroy($destination_image);
/*
 * Write the just edited image into the Xoops cache
 */
$cached_image['edited_image_filename'] = $edited_image_filename;
$cached_image['image_data'] = $imageData;
$cached_image['cached_time'] = $imageCreatedTime;
XoopsCache::write($edited_image_filename, $cached_image);
/*
 * Send the edited image to the browser
 */
// See if the browser already has the image
$last_modified_string = gmdate('D, d M Y H:i:s', $imageCreatedTime) . ' GMT';
$etag = md5($imageData);
doConditionalGet($etag, $last_modified_string);
header('HTTP/1.1 200 OK');
// if image is cacheable
if (!isset($_GET['nocache']) && !isset($_GET['nobrowsercache'])) {
    header('Last-Modified: ' . gmdate('D, d M Y H:i:s', $imageCreatedTime) . 'GMT');
    header('Cache-control: max-age=31536000');
    header('Expires: ' . gmdate('D, d M Y H:i:s', time() + 31536000) . 'GMT');
} else {
    // "Kill" the browser cache
Esempio n. 10
0
/**
 * xoops_setActiveModules()
 *
 * Write active modules to cache file
 *
 * @return array
 */
function xoops_setActiveModules()
{
    xoops_load('XoopsCache');
    $module_handler =& xoops_gethandler('module');
    $modules_obj = $module_handler->getObjects(new Criteria('isactive', 1));
    $modules_active = array();
    foreach (array_keys($modules_obj) as $key) {
        $modules_active[] = $modules_obj[$key]->getVar('dirname');
    }
    unset($modules_obj);
    XoopsCache::write('system_modules_active', $modules_active);
    return $modules_active;
}
Esempio n. 11
0
 /**
  * load all local filters for the object
  * 
  * Filter distribution:
  * In each module folder there is a folder "filter" containing filter files with, 
  * filename: [name_of_target_class][.][function/action_name][.php];
  * function name: [dirname][_][name_of_target_class][_][function/action_name];
  * parameter: the target object
  *
  * @param   string     $method    function or action name
  * @access  public
  */
 function loadFilters($method)
 {
     $this->_loadFilters();
     xoops_load("cache");
     $class = get_class($this);
     if (!($modules_active = XoopsCache::read("system_modules_active"))) {
         $module_handler =& xoops_gethandler('module');
         $modules_obj = $module_handler->getObjects(new Criteria('isactive', 1));
         $modules_active = array();
         foreach (array_keys($modules_obj) as $key) {
             $modules_active[] = $modules_obj[$key]->getVar("dirname");
         }
         unset($modules_obj);
         XoopsCache::write("system_modules_active", $modules_active);
     }
     foreach ($modules_active as $dirname) {
         if (!@(include_once XOOPS_ROOT_PATH . "/modules/{$dirname}/filter/{$class}.{$method}.php")) {
             continue;
         }
         if (function_exists("{$dirname}_{$class}_{$method}")) {
             call_user_func_array("{$dirname}_{$class}_{$method}", array(&$this));
         }
     }
 }
Esempio n. 12
0
 /**
  * xos_logos_PageBuilder::buildBlock()
  *
  * @param mixed $xobject
  * @param mixed $template
  * @return
  */
 function buildBlock($xobject, &$template)
 {
     // The lame type workaround will change
     // bid is added temporarily as workaround for specific block manipulation
     $block = array('id' => $xobject->getVar('bid'), 'module' => $xobject->getVar('dirname'), 'title' => $xobject->getVar('title'), 'weight' => $xobject->getVar('weight'), 'lastmod' => $xobject->getVar('last_modified'));
     $bcachetime = intval($xobject->getVar('bcachetime'));
     if (empty($bcachetime)) {
         $template->caching = 0;
     } else {
         $template->caching = 2;
         $template->cache_lifetime = $bcachetime;
     }
     $template->setCompileId($xobject->getVar('dirname', 'n'));
     $tplName = ($tplName = $xobject->getVar('template')) ? "db:{$tplName}" : 'db:system_block_dummy.html';
     $cacheid = $this->generateCacheId('blk_' . $xobject->getVar('bid'));
     $xoopsLogger =& XoopsLogger::getInstance();
     if (!$bcachetime || !$template->is_cached($tplName, $cacheid)) {
         //Get theme metas
         if ($this->theme && $bcachetime) {
             foreach ($this->theme->metas as $type => $value) {
                 $old[$type] = $this->theme->metas[$type];
             }
         }
         //build block
         $xoopsLogger->addBlock($xobject->getVar('name'));
         if ($bresult = $xobject->buildBlock()) {
             $template->assign('block', $bresult);
             $block['content'] = $template->fetch($tplName, $cacheid);
         } else {
             $block = false;
         }
         //check if theme added new metas
         if ($this->theme && $bcachetime) {
             $metas = array();
             foreach ($this->theme->metas as $type => $value) {
                 $dif = array_diff_assoc($this->theme->metas[$type], $old[$type]);
                 if (count($dif)) {
                     $metas[$type] = $dif;
                 }
             }
             if (count($metas)) {
                 xoops_load('xoopscache');
                 $cache =& XoopsCache::getInstance();
                 $cache->write($cacheid, $metas);
             }
         }
     } else {
         $xoopsLogger->addBlock($xobject->getVar('name'), true, $bcachetime);
         $block['content'] = $template->fetch($tplName, $cacheid);
     }
     //add block cached metas
     if ($this->theme && $bcachetime) {
         xoops_load('xoopscache');
         $cache =& XoopsCache::getInstance();
         if ($metas = $cache->read($cacheid)) {
             foreach ($metas as $type => $value) {
                 $this->theme->metas[$type] = array_merge($this->theme->metas[$type], $metas[$type]);
             }
         }
     }
     $template->setCompileId();
     return $block;
 }
Esempio n. 13
0
             $rss2parser = new XoopsXmlRss2Parser($rssdata);
             if (false != $rss2parser->parse()) {
                 $_items = $rss2parser->getItems();
                 $count = count($_items);
                 for ($i = 0; $i < $count; $i++) {
                     $_items[$i]['title'] = XoopsLocal::convert_encoding($_items[$i]['title'], _CHARSET, 'UTF-8');
                     $_items[$i]['description'] = XoopsLocal::convert_encoding($_items[$i]['description'], _CHARSET, 'UTF-8');
                     $items[strval(strtotime($_items[$i]['pubdate'])) . "-" . strval(++$cnt)] = $_items[$i];
                 }
             } else {
                 echo $rss2parser->getErrors();
             }
         }
     }
     krsort($items);
     XoopsCache::write($rssfile, $items, 86400);
 }
 if ($items != '') {
     $ret = '<table class="outer width100">';
     foreach (array_keys($items) as $i) {
         $ret .= '<tr class="head"><td><a href="' . htmlspecialchars($items[$i]['link']) . '" rel="external">';
         $ret .= htmlspecialchars($items[$i]['title']) . '</a> (' . htmlspecialchars($items[$i]['pubdate']) . ')</td></tr>';
         if ($items[$i]['description'] != "") {
             $ret .= '<tr><td class="odd">' . $items[$i]['description'];
             if (!empty($items[$i]['guid'])) {
                 $ret .= '&nbsp;&nbsp;<a href="' . htmlspecialchars($items[$i]['guid']) . '" rel="external" title="">' . _MORE . '</a>';
             }
             $ret .= '</td></tr>';
         } else {
             if ($items[$i]['guid'] != "") {
                 $ret .= '<tr><td class="even aligntop"></td><td colspan="2" class="odd"><a href="' . htmlspecialchars($items[$i]['guid']) . '" rel="external">' . _MORE . '</a></td></tr>';
Esempio n. 14
0
function mark_for_lock($function_file, $username, $password)
{
    xoops_load('cache');
    $userip = xoops_getUserIP();
    $result = array();
    if ($result = XoopsCache::read('lock_' . $function_file . '_' . $username)) {
        $result[] = $userip;
        XoopsCache::delete('lock_' . $function_file . '_' . $username);
        XoopsCache::write('lock_' . $function_file . '_' . $username, $result, $GLOBALS['cache_seconds']);
        return array('ErrNum' => 9, "ErrDesc" => 'No Permission for plug-in');
    } else {
        $result[] = $userip;
        XoopsCache::delete('lock_' . $function_file . '_' . $username);
        XoopsCache::write('lock_' . $function_file . '_' . $username, $result, $GLOBALS['cache_seconds']);
        return array('ErrNum' => 9, "ErrDesc" => 'No Permission for plug-in');
    }
}
Esempio n. 15
0
 /**
  * @access  private
  *
  */
 function generateMenu()
 {
     $module_handler =& xoops_gethandler('module');
     $criteria = new CriteriaCompo();
     $criteria->add(new Criteria('hasadmin', 1));
     $criteria->add(new Criteria('isactive', 1));
     $criteria->setSort('mid');
     $mods = $module_handler->getObjects($criteria);
     $modules = array();
     foreach ($mods as $mod) {
         $mid = $mod->getVar('mid');
         $module_name = $mod->getVar('name');
         $module_dirname = $mod->getVar('dirname', 'n');
         $menus = array();
         if ($adminmenu = $mod->getAdminMenu()) {
             foreach ($adminmenu as $menuitem) {
                 $menuitem['target'] = @trim($menuitem['target']);
                 $menuitem['title'] = @trim($menuitem['title']);
                 $menuitem['link'] = @trim($menuitem['link']);
                 $menus[] = array("title" => $menuitem['title'], "target" => empty($menuitem['target']) ? "" : ($menuitem['target'] == "new" || $menuitem['target'] == "_blank" ? " rel='external'" : " target='" . $menuitem['target'] . "'"), "link" => empty($menuitem['link']) ? "#" : (!empty($menuitem['absolute']) ? $menuitem['link'] : XOOPS_URL . "/modules/" . $module_dirname . "/" . $menuitem['link']));
             }
         }
         if ($mod->getVar('hasnotification') || is_array($mod->getInfo('config')) || is_array($mod->getInfo('comments'))) {
             $menus[] = array('link' => XOOPS_URL . "/modules/system/admin.php?fct=preferences&amp;op=showmod&amp;mod=" . $mid, 'title' => _PREFERENCES, 'target' => "");
         }
         $module_menu = "";
         if (count($menus) > 0) {
             $module_menu .= "<div><strong>" . _MD_CPANEL_QUICKLINKS . "</strong><ul>";
             foreach ($menus as $menuitem) {
                 $module_menu .= "<li><a href='{$menuitem['link']}' title='{$menuitem['title']}'{$menuitem['target']}>" . $menuitem['title'] . "</a></li>";
             }
             $module_menu .= "</ul></div>";
         }
         $module_img = "<img class='admin_layer_img' src='" . XOOPS_URL . "/modules/" . $module_dirname . "/" . $mod->getInfo('image') . "' alt='' />";
         $module_desc = "<div>" . "<a href='javascript: xoopsToggleDisplay(\"mb-{$mid}-desc\")' title='" . _DESCRIPTION . "'>" . $module_img . " <span id='mb-{$mid}-desc-label'>&raquo;</span></a>" . "</div>" . "<div id='mb-{$mid}-desc' style='display: none;'>" . "<strong>" . _AUTHOR . "</strong><br />" . $mod->getInfo('author') . "<br /><strong>" . _VERSION . "</strong> - " . round($mod->getVar('version') / 100, 2) . "<br /><strong>" . _DESCRIPTION . "</strong><br />" . $mod->getInfo('description') . "</div>";
         $modules[$mid] = array("name" => $module_name, "dirname" => $module_dirname, "content" => "<div class='module-menu-content'>" . $module_menu . "<br />" . $module_desc . "</div>");
     }
     xoops_load('XoopsCache');
     XoopsCache::write("adminmenu_" . __CLASS__, $modules);
 }
Esempio n. 16
0
 /**
  * Constructor
  *
  * @param string $caption          form element caption
  * @param string $name             form element name
  * @param bool   $includeAnonymous Include user "anonymous"?
  * @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 int    $size             Number or rows. "1" makes a drop-down-list.
  * @param bool   $multiple         Allow multiple selections?
  */
 public function __construct($caption, $name, $includeAnonymous = false, $value = null, $size = 1, $multiple = false)
 {
     /**
      * @var mixed array|false - cache any result for this session.
      *            Some modules use multiple copies of this element on a single page, so this call will
      *            be made multiple times. This is only used when $value is null.
      * @todo this should be replaced with better interface, with autocomplete style search
      * and user specific MRU cache
      */
     static $queryCache = false;
     /**
      * @var int - limit to this many rows
      */
     $limit = 200;
     /**
      * @var string - cache time to live - will be interpreted by strtotime()
      */
     $cachettl = '+5 minutes';
     /**
      * @var string - cache key
      */
     $cachekey = 'formselectuser';
     $select_element = new XoopsFormSelect('', $name, $value, $size, $multiple);
     if ($includeAnonymous) {
         $select_element->addOption(0, $GLOBALS['xoopsConfig']['anonymous']);
     }
     $member_handler = xoops_getHandler('member');
     $value = is_array($value) ? $value : (empty($value) ? array() : array($value));
     $selectedUsers = array();
     if (count($value) > 0) {
         // fetch the set of uids in $value
         $criteria = new Criteria('uid', '(' . implode(',', $value) . ')', 'IN');
         $criteria->setSort('uname');
         $criteria->setOrder('ASC');
         $selectedUsers = $member_handler->getUserList($criteria);
     }
     // get the full selection list
     // we will always cache this version to reduce expense
     if (empty($queryCache)) {
         XoopsLoad::load('XoopsCache');
         $queryCache = XoopsCache::read($cachekey);
         if ($queryCache === false) {
             $criteria = new CriteriaCompo();
             if ($limit <= $member_handler->getUserCount()) {
                 // if we have more than $limit users, we will select who to show based on last_login
                 $criteria->setLimit($limit);
                 $criteria->setSort('last_login');
                 $criteria->setOrder('DESC');
             } else {
                 $criteria->setSort('uname');
                 $criteria->setOrder('ASC');
             }
             $queryCache = $member_handler->getUserList($criteria);
             asort($queryCache);
             XoopsCache::write($cachekey, $queryCache, $cachettl);
             // won't do anything different if write fails
         }
     }
     // merge with selected
     $users = $selectedUsers + $queryCache;
     $select_element->addOptionArray($users);
     if ($limit > count($users)) {
         parent::__construct($caption, '', $name);
         $this->addElement($select_element);
         return null;
     }
     xoops_loadLanguage('findusers');
     $js_addusers = "<script type='text/javascript'>\n            function addusers(opts)\n            {\n                var num = opts.substring(0, opts.indexOf(':'));\n                opts = opts.substring(opts.indexOf(':')+1, opts.length);\n                var sel = xoopsGetElementById('" . $name . "');\n                var arr = new Array(num);\n                for (var n=0; n < num; n++) {\n                    var nm = opts.substring(0, opts.indexOf(':'));\n                    opts = opts.substring(opts.indexOf(':')+1, opts.length);\n                    var val = opts.substring(0, opts.indexOf(':'));\n                    opts = opts.substring(opts.indexOf(':')+1, opts.length);\n                    var txt = opts.substring(0, nm - val.length);\n                    opts = opts.substring(nm - val.length, opts.length);\n                    var added = false;\n                    for (var k = 0; k < sel.options.length; k++) {\n                        if (sel.options[k].value == val) {\n                            added = true;\n                            break;\n                        }\n                    }\n                    if (added == false) {\n                        sel.options[k] = new Option(txt, val);\n                        sel.options[k].selected = true;\n                    }\n                }\n\n                return true;\n            }\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));
     parent::__construct($caption, '<br><br>', $name);
     $this->addElement($select_element);
     $this->addElement($action_tray);
 }
Esempio n. 17
0
function &catalog_template_lookup_blocks($index_by_page = false)
{
    include_once XOOPS_ROOT_PATH . "/class/xoopslists.php";
    $files = XoopsLists::getHtmlListAsArray(XOOPS_ROOT_PATH . "/modules/" . "catalog" . "/templates/blocks/");
    $list = array();
    foreach ($files as $file => $name) {
        if (preg_match("/^" . 'blocks_' . "catalog" . "_([^_]*)(_(.*))?\\.(html|xotpl)\$/i", $name, $matches)) {
            if (empty($matches[1])) {
                continue;
            }
            if (empty($matches[3])) {
                $matches[3] = "default";
            }
            if (empty($index_by_page)) {
                $list[] = array("file" => $name, "description" => $matches[3]);
            } else {
                $list[$matches[1]][$matches[3]] = $name;
            }
        }
    }
    $cache_file = empty($index_by_page) ? "template-list" : "template-page";
    xoops_load("cache");
    $key = "catalog" . "_{$cache_file}";
    XoopsCache::write($key, $list);
    return $list;
}
Esempio n. 18
0
 /**
  * Render the page
  *
  * The theme engine builds pages from 2 templates: canvas and content.
  *
  * A module can call this method directly and specify what templates the theme engine must use.
  * If render() hasn't been called before, the theme defaults will be used for the canvas and
  * page template (and xoopsOption['template_main'] for the content).
  *
  * @param string $canvasTpl  The canvas template, if different from the theme default
  * @param string $pageTpl    The page template, if different from the theme default (unsupported, 2.3+ only)
  * @param string $contentTpl The content template
  * @param array  $vars       Template variables to send to the template engine
  *
  * @return bool
  */
 public function render($canvasTpl = null, $pageTpl = null, $contentTpl = null, $vars = array())
 {
     if ($this->renderCount) {
         return false;
     }
     $xoopsLogger = XoopsLogger::getInstance();
     $xoopsLogger->startTime('Page rendering');
     xoops_load('xoopscache');
     $cache = XoopsCache::getInstance();
     //Get meta information for cached pages
     if ($this->contentCacheLifetime && $this->contentCacheId && ($content = $cache->read($this->contentCacheId))) {
         //we need to merge metas set by blocks ) with the module cached meta
         $this->htmlHeadStrings = array_merge($this->htmlHeadStrings, $content['htmlHeadStrings']);
         foreach ($content['metas'] as $type => $value) {
             $this->metas[$type] = array_merge($this->metas[$type], $content['metas'][$type]);
         }
         $GLOBALS['xoopsOption']['xoops_pagetitle'] = $content['xoops_pagetitle'];
         $GLOBALS['xoopsOption']['xoops_module_header'] = $content['header'];
     }
     if (!empty($GLOBALS['xoopsOption']['xoops_pagetitle'])) {
         $this->template->assign('xoops_pagetitle', $GLOBALS['xoopsOption']['xoops_pagetitle']);
     }
     $header = empty($GLOBALS['xoopsOption']['xoops_module_header']) ? $this->template->get_template_vars('xoops_module_header') : $GLOBALS['xoopsOption']['xoops_module_header'];
     //save meta information of cached pages
     if ($this->contentCacheLifetime && $this->contentCacheId && !$contentTpl) {
         $content['htmlHeadStrings'] = $this->htmlHeadStrings;
         $content['metas'] = $this->metas;
         $content['xoops_pagetitle'] =& $this->template->get_template_vars('xoops_pagetitle');
         $content['header'] = $header;
         $cache->write($this->contentCacheId, $content);
     }
     //  @internal : Lame fix to ensure the metas specified in the xoops config page don't appear twice
     $old = array('robots', 'keywords', 'description', 'rating', 'author', 'copyright');
     foreach ($this->metas['meta'] as $name => $value) {
         if (in_array($name, $old)) {
             $this->template->assign("xoops_meta_{$name}", htmlspecialchars($value, ENT_QUOTES));
             unset($this->metas['meta'][$name]);
         }
     }
     // We assume no overlap between $GLOBALS['xoopsOption']['xoops_module_header'] and $this->template->get_template_vars( 'xoops_module_header' ) ?
     $this->template->assign('xoops_module_header', $this->renderMetas(null, true) . "\n" . $header);
     if ($canvasTpl) {
         $this->canvasTemplate = $canvasTpl;
     }
     if ($contentTpl) {
         $this->contentTemplate = $contentTpl;
     }
     if (!empty($vars)) {
         $this->template->assign($vars);
     }
     if ($this->contentTemplate) {
         $this->content = $this->template->fetch($this->contentTemplate, $this->contentCacheId);
     }
     if ($this->bufferOutput) {
         $this->content .= ob_get_contents();
         ob_end_clean();
     }
     $this->template->assign_by_ref('xoops_contents', $this->content);
     // Do not cache the main (theme.html) template output
     $this->template->caching = 0;
     //mb -------------------------
     //        $this->template->display($this->path . '/' . $this->canvasTemplate);
     if (file_exists($this->path . '/' . $this->canvasTemplate)) {
         $this->template->display($this->path . '/' . $this->canvasTemplate);
     } else {
         $this->template->display($this->path . '/theme.tpl');
     }
     //mb -------------------------
     $this->renderCount++;
     $xoopsLogger->stopTime('Page rendering');
     return true;
 }
                    }
                    mkdirSecure(XOOPS_VAR_PATH . DIRECTORY_SEPARATOR . basename(__DIR__));
                    mkdirSecure($path = XOOPS_VAR_PATH . DIRECTORY_SEPARATOR . basename(__DIR__) . DIRECTORY_SEPARATOR . 'harvest');
                    if (file_exists($ffile = XOOPS_VAR_PATH . DIRECTORY_SEPARATOR . basename(__DIR__) . DIRECTORY_SEPARATOR . "harvest.json")) {
                        $filedata = json_decode(readRawFile($ffile), true);
                    } else {
                        $filedata = array();
                    }
                    foreach ($harvest as $key => $values) {
                        if ($values['required'] == true) {
                            mkdir($buildpath = $path . DIRECTORY_SEPARATOR . $values['session'], 0777, true);
                            foreach ($values['thememap'] as $key => $file) {
                                mkdir($buildpath . DIRECTORY_SEPARATOR . $file['path'], 0777, true);
                                copyfile($GLOBALS['xoops']->path($file['path'] . DIRECTORY_SEPARATOR . $file['file']), $buildpath . DIRECTORY_SEPARATOR . $file['path'] . DIRECTORY_SEPARATOR . $file['file']);
                            }
                            $filedata[$values['session']] = array('harvest' => $values, 'peer' => $peers['harvest'][$key]);
                        }
                    }
                    if (!empty($filedata)) {
                        writeRawFile($ffile, json_encode($filedata));
                    } else {
                        unlink($ffile);
                    }
                } else {
                    XoopsCache::write(basename(dirname(dirname(__DIR__))) . '.theme' . $theme . '.old', $thememap, 3600 * 24 * 31 * 4);
                }
            }
        }
    }
}
return true;
Esempio n. 20
0
$xoopsTpl->assign('items_width', $xoopsModuleConfig['picturewidth']);
// get bread
xoops_load("cache");
if (!($menu = XoopsCache::read('config_menu_categories'))) {
    $menu = $cat_handler->getAll(null, null, false);
    $menu = XoopsCache::write('config_menu_categories', $menu);
}
//$menu = $cat_handler->getAll(null, null, false);
$beand = array_reverse($cat_handler->getBread($menu, $cat_id), true);
if (!empty($beand)) {
    foreach ($beand as $k => $v) {
        if ($k != $cat_id) {
            $xoBreadcrumbs[] = array("title" => $v, 'link' => XOOPS_URL . '/modules/catalog/itemlist.php?cat_id=' . $k);
        } else {
            $xoBreadcrumbs[] = array("title" => $v);
        }
        $tree_open[$k] = $k;
    }
    $xoopsTpl->assign('tree_open', $tree_open);
}
xoops_load("cache");
if (!($categories = XoopsCache::read('config_categories'))) {
    $categories =& $cat_handler->getTrees($pid = 0, $prefix = "--");
    $categories = XoopsCache::write('config_categories', $categories);
}
foreach ($categories as $id => $cat) {
    $cat_options[$id] = $cat["prefix"] . $cat["cat_name"];
}
$xoopsTpl->assign('cat_options', $cat_options);
$xoopsTpl->assign('cat_id', $cat_id);
include 'footer.php';
Esempio n. 21
0
/**
 * @param  bool $index_by_page
 * @return array
 */
function &about_template_lookup($index_by_page = false)
{
    include_once XOOPS_ROOT_PATH . '/class/xoopslists.php';
    $files = XoopsLists::getHtmlListAsArray(XOOPS_ROOT_PATH . '/modules/' . $GLOBALS['artdirname'] . '/templates/');
    $list = array();
    foreach ($files as $file => $name) {
        // The valid file name must be: art_article_mytpl.html OR art_category-1_your-trial.html
        if (preg_match('/^' . $GLOBALS['artdirname'] . "_([^_]*)(_(.*))?\\.(tpl|xotpl)\$/i", $name, $matches)) {
            if (empty($matches[1])) {
                continue;
            }
            if (empty($matches[3])) {
                $matches[3] = 'default';
            }
            if (empty($index_by_page)) {
                $list[] = array('file' => $name, 'description' => $matches[3]);
            } else {
                $list[$matches[1]][$matches[3]] = $name;
            }
        }
    }
    $cache_file = empty($index_by_page) ? 'template-list' : 'template-page';
    xoops_load('xoopscache');
    $key = $GLOBALS['artdirname'] . "_{$cache_file}";
    XoopsCache::write($key, $list);
    //load_functions("cache");
    //mod_createCacheFile($list, $cache_file, $GLOBALS["artdirname"]);
    return $list;
}
Esempio n. 22
0
             $catbrand_obj->setVar('brand_name', $brand_name);
             $catbrand_handler->insert($catbrand_obj);
             unset($catbrand_obj);
         }
         redirect_header('admin.category.php', 3, _AM_CATALOG_ACTIVSUCCESS);
     } else {
         redirect_header('admin.category.php', 3, _AM_CATALOG_ACTIVEERROR);
     }
     break;
 case 'delete':
     xoops_load("cache");
     if (XoopsCache::read('config_categories')) {
         XoopsCache::delete('config_categories');
     }
     if (XoopsCache::read('config_menu_categories')) {
         XoopsCache::delete('config_menu_categories');
     }
     $category_obj =& $category_handler->get($cat_id);
     if (isset($_REQUEST['ok']) && $_REQUEST['ok'] == 1) {
         if (!$GLOBALS['xoopsSecurity']->check()) {
             redirect_header('admin.category.php', 3, implode(',', $GLOBALS['xoopsSecurity']->getErrors()));
         }
         $category_image = $category_obj->getVar('cat_image');
         $logo_dir = XOOPS_ROOT_PATH . "/uploads/";
         $criteria = new CriteriaCompo();
         $criteria->add(new Criteria('cat_pid', $cat_id));
         $criteria1 = new CriteriaCompo();
         $criteria1->add(new Criteria('cat_id', $cat_id), 'OR');
         $criteria1->add(new Criteria('cat_pid', $cat_id), 'OR');
         if ($category_handler->getCount($criteria) > 0 || $item_handler->getCount($criteria1) > 0) {
             redirect_header('admin.category.php', 3, _AM_CATALOG_DELETECATTIPS);
Esempio n. 23
0
 /**
  * load all local filters for the object
  *
  * Filter distribution:
  * In each module folder there is a folder "filter" containing filter files with,
  * filename: [name_of_target_class][.][function/action_name][.php];
  * function name: [dirname][_][name_of_target_class][_][function/action_name];
  * parameter: the target object
  *
  * @param string $method function or action name
  * @access public
  */
 function loadFilters($method)
 {
     $this->_loadFilters();
     xoops_load('XoopsCache');
     $class = get_class($this);
     if (!($modules_active = XoopsCache::read('system_modules_active'))) {
         $module_handler =& xoops_gethandler('module');
         $modules_obj = $module_handler->getObjects(new Criteria('isactive', 1));
         $modules_active = array();
         foreach (array_keys($modules_obj) as $key) {
             $modules_active[] = $modules_obj[$key]->getVar('dirname');
         }
         unset($modules_obj);
         XoopsCache::write('system_modules_active', $modules_active);
     }
     foreach ($modules_active as $dirname) {
         if (file_exists($file = XOOPS_ROOT_PATH . '/modules/' . $dirname . '/filter/' . $class . '.' . $method . '.php')) {
             include_once $file;
             if (function_exists($class . '_' . $method)) {
                 call_user_func_array($dirname . '_' . $class . '_' . $method, array(&$this));
             }
         }
     }
 }
Esempio n. 24
0
 /**
  * Clear config caches
  *
  * @param   mixed       $module     ID or dirname of a module
  * @param   int         $category   ID of a category
  *
  * @return  boolean     True on success, false on failure
  */
 public function flush($module = 0, $category = 0)
 {
     xoops_load("cache");
     $dirname = "";
     $mid = 0;
     if (is_int($module)) {
         $mid = intval($module);
         if (empty($mid)) {
             $dirname = "system";
         } else {
             if ($module_obj = xoops_getHandler("module")->get($mid)) {
                 $dirname = $module_obj->getVar("dirname");
             }
         }
     } else {
         $dirname = $module;
         if ("system" == $dirname) {
             $mid = 0;
         } else {
             if ($module_obj = xoops_getHandler("module")->getByDirname($dirname)) {
                 $mid = $module_obj->getVar("mid");
             }
         }
     }
     $key = "config_{$mid}_{$category}";
     XoopsCache::delete($key);
     $key = "config_{$dirname}_{$category}";
     XoopsCache::delete($key);
     return true;
 }
                    $filedata = array();
                }
                foreach ($harvest as $key => $values) {
                    if ($values['required'] == true) {
                        mkdir($buildpath = $path . DIRECTORY_SEPARATOR . $values['session'], 0777, true);
                        foreach ($values['modmap'] as $key => $file) {
                            mkdir($buildpath . DIRECTORY_SEPARATOR . $file['path'], 0777, true);
                            copyfile($GLOBALS['xoops']->path($file['path'] . DIRECTORY_SEPARATOR . $file['file']), $buildpath . DIRECTORY_SEPARATOR . $file['path'] . DIRECTORY_SEPARATOR . $file['file']);
                        }
                        foreach ($values['libmap'] as $key => $file) {
                            mkdir($buildpath . DIRECTORY_SEPARATOR . 'xoops_lib' . DIRECTORY_SEPARATOR . $file['path'], 0777, true);
                            copyfile(XOOPS_PATH . $file['path'] . DIRECTORY_SEPARATOR . $file['file'], $buildpath . DIRECTORY_SEPARATOR . 'xoops_lib' . DIRECTORY_SEPARATOR . $file['path'] . DIRECTORY_SEPARATOR . $file['file']);
                        }
                        $filedata[$values['session']] = array('harvest' => $values, 'peer' => $peers['harvest'][$key]);
                    }
                }
                if (!empty($filedata)) {
                    writeRawFile($ffile, json_encode($filedata));
                } else {
                    unlink($ffile);
                }
            } else {
                XoopsCache::write(basename(dirname(dirname(__DIR__))) . '.module' . $module . '.old', $modmap, 3600 * 24 * 31 * 4);
                if ($libmap = XoopsCache::read(basename(dirname(dirname(__DIR__))) . '.xoopslib' . $module . '.delays')) {
                    XoopsCache::write(basename(dirname(dirname(__DIR__))) . '.xoopslib' . $module . '.old', $libmap, 3600 * 24 * 31 * 4);
                }
            }
        }
    }
}
return true;
Esempio n. 26
0
 function getList($name, $extension = "")
 {
     $items = array();
     xoops_load('XoopsCache');
     if ($items = XoopsCache::read("captcha_captcha_{$name}")) {
         return $items;
     }
     require_once XOOPS_ROOT_PATH . "/class/xoopslists.php";
     $file_path = $this->config["rootpath"] . "/{$name}";
     $files = XoopsLists::getFileListAsArray($file_path);
     foreach ($files as $item) {
         if (empty($extension) || preg_match("/(\\.{$extension})\$/i", $item)) {
             $items[] = $item;
         }
     }
     XoopsCache::write("captcha_captcha_{$name}", $items);
     return $items;
 }
Esempio n. 27
0
function &art_template_lookup($index_by_page = false)
{
    include_once XOOPS_ROOT_PATH . "/class/xoopslists.php";
    $files = XoopsLists::getHtmlListAsArray(XOOPS_ROOT_PATH . "/modules/" . $GLOBALS["artdirname"] . "/templates/");
    $list = array();
    foreach ($files as $file => $name) {
        // The valid file name must be: art_article_mytpl.html OR art_category-1_your-trial.html
        if (preg_match("/^" . $GLOBALS["ART_VAR_PREFIX"] . "_([^_]*)(_(.*))?\\.(html|xotpl)\$/i", $name, $matches)) {
            if (empty($matches[1])) {
                continue;
            }
            if (empty($matches[3])) {
                $matches[3] = "default";
            }
            if (empty($index_by_page)) {
                $list[] = array("file" => $name, "description" => $matches[3]);
            } else {
                $list[$matches[1]][$matches[3]] = $name;
            }
        }
    }
    $cache_file = empty($index_by_page) ? "template-list" : "template-page";
    xoops_load("cache");
    $key = $GLOBALS["artdirname"] . "_{$cache_file}";
    XoopsCache::write($key, $list);
    //load_functions("cache");
    //mod_createCacheFile($list, $cache_file, $GLOBALS["artdirname"]);
    return $list;
}
Esempio n. 28
0
 /**
  * clear config cache of a module
  *
  *
  * @param    string $dirname module dirname
  * @return    bool
  */
 function mod_clearConfig($dirname = '')
 {
     if (empty($dirname)) {
         return false;
     }
     xoops_load('XoopsCache');
     return XoopsCache::delete("{$dirname}_config");
 }
Esempio n. 29
0
 /**
  * load all local filters for the object
  *
  * Filter distribution:
  * In each module folder there is a folder "filter" containing filter files with,
  * filename: [name_of_target_class][.][function/action_name][.php];
  * function name: [dirname][_][name_of_target_class][_][function/action_name];
  * parameter: the target object
  *
  * @param string $method function or action name
  *
  * @deprecated \XoopsObject::loadFilters is deprecated since XOOPS 2.5.8 and will be removed in the next major release
  */
 public function loadFilters($method)
 {
     $trace = debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS, 1);
     trigger_error("XoopsObject::loadFilters() is deprecated, called from {$trace[0]['file']} line {$trace[0]['line']},");
     $this->_loadFilters();
     xoops_load('XoopsCache');
     $class = get_class($this);
     if (!($modules_active = XoopsCache::read('system_modules_active'))) {
         $module_handler = xoops_getHandler('module');
         $modules_obj = $module_handler->getObjects(new Criteria('isactive', 1));
         $modules_active = array();
         foreach (array_keys($modules_obj) as $key) {
             $modules_active[] = $modules_obj[$key]->getVar('dirname');
         }
         unset($modules_obj);
         XoopsCache::write('system_modules_active', $modules_active);
     }
     foreach ($modules_active as $dirname) {
         if (file_exists($file = XOOPS_ROOT_PATH . '/modules/' . $dirname . '/filter/' . $class . '.' . $method . '.php')) {
             include_once $file;
             if (function_exists($class . '_' . $method)) {
                 call_user_func_array($dirname . '_' . $class . '_' . $method, array(&$this));
             }
         }
     }
 }
            if ($ext == "curl") {
                return $ext;
            }
        }
        return 'json';
    }
}
if (is_object($GLOBALS['xoopsUser'])) {
    $modulehandler =& xoops_gethandler('module');
    $confighandler =& xoops_gethandler('config');
    $xoModule = $modulehandler->getByDirname('spiders');
    $xoConfig = $confighandler->getConfigList($xoModule->getVar('mid'), false);
    if (in_array($xoConfig['bot_group'], $GLOBALS['xoopsUser']->getGroups())) {
        if ($xoConfig['xortify_shareme'] == true) {
            xoops_load('cache');
            if (!($result = XoopsCache::read('spider_uid%%' . $GLOBALS['xoopsUser']->getVar('uid') . '%%' . $xoConfig['bot_group']))) {
                // Connect to API
                $api = spiders_apimethod();
                include_once $GLOBALS['xoops']->path('/modules/spiders/class/' . $api . '.php');
                $func = strtoupper($api) . 'SpidersExchange';
                $exchange = new $func();
                //Recieve From API
                $result = $exchange->getSEOLinks();
                XoopsCache::write('spider_uid%%' . $GLOBALS['xoopsUser']->getVar('uid') . '%%' . $xoConfig['bot_group'], $result, 1200);
            }
            $GLOBALS['spiderTpl'] = new XoopsTpl();
            $GLOBALS['spiderTpl']->assign('spiderseo', $result);
            $GLOBALS['spiderTpl']->display('db:spiders_footer_seo.html');
        }
    }
}