function load_modules_page() { global $xoopsLogger, $xoopsSecurity; error_reporting(0); $xoopsLogger->activated = false; if (!$xoopsSecurity->check(true, rmc_server_var($_POST, 'token', ''))) { echo __("Sorry, you don't have access to this page", 'rmcommon'); echo "<br /><a href='javascript:;' onclick='location.reload();'>" . __('Click here to refresh', 'rmcommon') . "</a>"; die; } $db = XoopsDatabaseFactory::getDatabaseConnection(); $sql = "SELECT * FROM " . $db->prefix("modules") . " ORDER BY `name`"; $result = $db->query($sql); $installed_dirs = array(); while ($row = $db->fetchArray($result)) { $installed_dirs[] = $row['dirname']; } require_once XOOPS_ROOT_PATH . "/class/xoopslists.php"; $dirlist = XoopsLists::getModulesList(); $available_mods = array(); $module_handler = xoops_gethandler('module'); foreach ($dirlist as $file) { clearstatcache(); $file = trim($file); if (!in_array($file, $installed_dirs)) { $module =& $module_handler->create(); if (!$module->loadInfo($file, false)) { continue; } $available_mods[] = $module; unset($module); } } unset($dirlist); unset($module_handler); $limit = 10; $tpages = ceil(count($available_mods) / $limit); $page = rmc_server_var($_POST, 'page', 1); if ($page > $tpages) { $page = 1; } $start = ($page <= 0 ? 0 : $page - 1) * $limit; $nav = new RMPageNav(count($available_mods), $limit, $page, 3); $nav->target_url('javascript:;" onclick="load_page({PAGE_NUM});'); // Event for available modules $available_mods = RMEvents::get()->run_event('rmcommon.available.modules', $available_mods); $end = $page * $limit; if ($end > count($available_mods)) { $end = count($available_mods); } ob_start(); ?> <div class="rmc_widget_content_reduced rmc_modules_widget"> <img id="img-load" src="images/loading.gif" style="display: none; margin: 15px auto;" /> <div id="mods-widget-container"> <?php for ($i = $start; $i < $end; $i++) { ?> <?php $mod = $available_mods[$i]; ?> <div class="<?php echo tpl_cycle("even,odd"); ?> "> <a href="modules.php?action=install&dir=<?php echo $mod->getInfo('dirname'); ?> " class="rmc_mod_img" style="background: url(<?php echo XOOPS_URL; ?> /modules/<?php echo $mod->getInfo('dirname'); ?> /<?php echo $mod->getInfo('image'); ?> ) no-repeat center;"><span> </span></a> <strong><a href="modules.php?action=install&dir=<?php echo $mod->getInfo('dirname'); ?> "><?php echo $mod->getInfo('name'); ?> </a></strong> <span class="rmc_available_options"> <a href="modules.php?action=install&dir=<?php echo $mod->getInfo('dirname'); ?> "><?php _e('Install', 'rmcommon'); ?> </a> | <a href="javascript:;" onclick="show_module_info('<?php echo $mod->getInfo('dirname'); ?> ');"><?php _e('More info', 'rmcommon'); ?> </a> </span> <span class="rmc_mod_info" id="mod-<?php echo $mod->getInfo('dirname'); ?> "> <?php _e('Version:', 'rmcommon'); ?> <?php if ($mod->getInfo('rmnative')) { ?> <?php echo RMUtilities::format_version($mod->getInfo('rmversion')); ?> <?php } else { ?> <?php echo $mod->getInfo('version'); ?> <?php } ?> <br /> <?php _e('Author:', 'rmcommon'); ?> <?php echo substr(strip_tags($mod->getInfo('author')), 0, 12); ?> </span> </div> <input type="hidden" id="token" value="<?php echo $xoopsSecurity->createToken(); ?> " /> <?php } ?> <?php $nav->display(false); ?> </div> </div> <?php $ret = ob_get_clean(); echo $ret; }
$mod->assignVars($row); $installed_dirs[] = $mod->dirname(); if (file_exists(XOOPS_ROOT_PATH . '/modules/' . $mod->getVar('dirname') . '/class/' . strtolower($mod->getVar('dirname') . 'controller') . '.php')) { include_once XOOPS_ROOT_PATH . '/modules/' . $mod->getVar('dirname') . '/class/' . strtolower($mod->getVar('dirname') . 'controller') . '.php'; $class = ucfirst($mod->getVar('dirname')) . 'Controller'; $class = new $class(); if (method_exists($class, 'get_main_link')) { $main_link = $class->get_main_link(); } else { if ($mod->getVar('hasmain')) { $main_link = XOOPS_URL . '/modules/' . $mod->dirname(); } else { $main_link = "#"; } } } else { if ($mod->getVar('hasmain')) { $main_link = XOOPS_URL . '/modules/' . $mod->dirname(); } else { $main_link = "#"; } } // Admin section $admin_link = $mod->getVar('hasadmin') ? XOOPS_URL . '/modules/' . $mod->dirname() . '/' . $mod->getInfo('adminindex') : ''; $deficon = XOOPS_ROOT_PATH . '/modules/rmcommon/themes/designia/images/modules/' . $mod->dirname() . '.png'; $modules[] = array('id' => $mod->getVar('mid'), 'name' => $mod->getVar('name'), 'realname' => $mod->getInfo('name'), 'version' => $mod->getInfo('rmnative') ? RMUtilities::format_version($mod->getInfo('rmversion')) : $mod->getInfo('version'), 'description' => $mod->getInfo('description'), 'image' => is_file($deficon) ? str_replace(XOOPS_ROOT_PATH, XOOPS_URL, $deficon) : XOOPS_URL . '/modules/' . $mod->getVar('dirname') . '/' . ($mod->getInfo('icon32') ? $mod->getInfo('icon32') : $mod->getInfo('image')), 'link' => $main_link, 'admin_link' => $admin_link, 'updated' => formatTimestamp($mod->getVar('last_update'), 's'), 'author' => $mod->getInfo('author'), 'author_mail' => $mod->getInfo('authormail'), 'author_web' => $mod->getInfo('authorweb'), 'author_url' => $mod->getInfo('authorurl'), 'license' => $mod->getInfo('license'), 'dirname' => $mod->getInfo('dirname'), 'active' => $mod->getVar('isactive')); } // Event for installed modules $modules = RMEvents::get()->run_event('rmcommon.installed.modules', $modules, $installed_dirs); //include dirname(dirname(__FILE__)).'/include/modules.php'; //die();
function rmc_available_mods() { global $available_mods, $xoopsSecurity; $ret['title'] = __('Available Modules', 'rmcommon'); $ret['icon'] = RMCURL . '/images/modules.png'; $limit = 10; $tpages = ceil(count($available_mods) / $limit); $nav = new RMPageNav(count($available_mods), $limit, 1, 3); $nav->target_url('javascript:;" onclick="load_page({PAGE_NUM});'); ob_start(); $i = 0; ?> <div class="rmc_widget_content_reduced rmc_modules_widget"> <img id="img-load" src="images/loading.gif" style="display: none; margin: 15px auto;" /> <div id="mods-widget-container"> <?php foreach ($available_mods as $mod) { ?> <?php if ($i == $limit) { break; } ?> <div class="<?php echo tpl_cycle("even,odd"); ?> "> <a href="modules.php?action=install&dir=<?php echo $mod->getInfo('dirname'); ?> " class="rmc_mod_img" style="background: url(<?php echo XOOPS_URL; ?> /modules/<?php echo $mod->getInfo('dirname'); ?> /<?php echo $mod->getInfo('image'); ?> ) no-repeat center;"><span> </span></a> <strong><a href="modules.php?action=install&dir=<?php echo $mod->getInfo('dirname'); ?> "><?php echo $mod->getInfo('name'); ?> </a></strong> <span class="rmc_available_options"> <a href="modules.php?action=install&dir=<?php echo $mod->getInfo('dirname'); ?> "><?php _e('Install', 'rmcommon'); ?> </a> | <a href="javascript:;" onclick="show_module_info('<?php echo $mod->getInfo('dirname'); ?> ');"><?php _e('More info', 'rmcommon'); ?> </a> </span> <span class="rmc_mod_info" id="mod-<?php echo $mod->getInfo('dirname'); ?> "> <?php _e('Version:', 'rmcommon'); ?> <?php if ($mod->getInfo('rmnative')) { ?> <?php echo RMUtilities::format_version($mod->getInfo('rmversion')); ?> <?php } else { ?> <?php echo $mod->getInfo('version'); ?> <?php } ?> <br /> <?php _e('Author:', 'rmcommon'); ?> <?php echo substr(strip_tags($mod->getInfo('author')), 0, 12); ?> </span> </div> <?php $i++; } ?> <?php $nav->display(false); ?> </div> </div> <input type="hidden" id="token" value="<?php echo $xoopsSecurity->createToken(); ?> " /> <?php $ret['content'] = ob_get_clean(); return $ret; //print_r($available_mods); }
<td><strong><?php _e('Name:', 'rmcommon'); ?> </strong></td> <td><?php echo $module->getInfo('name'); ?> </td> </tr> <tr class="odd"> <td><strong><?php _e('Version:', 'rmcommon'); ?> </strong> <td><?php echo $module->getInfo('rmnative') ? RMUtilities::format_version($module->getInfo('rmversion')) : $module->getInfo('version'); ?> </td> </tr> <tr class="even"> <td><strong><?php _e('Author:', 'rmcommon'); ?> </strong></td> <td> <?php if ($module->getInfo('rmnative')) { ?> <a href="mailto:<?php echo $module->getInfo('authormail'); ?>