?> "><?php _e('Visit Web site', 'rmcommon'); ?> </a> </span> </td> <td> <span class="descriptions"><?php echo $plugin->get_info('description'); ?> </span> </td> <td align="center"> <strong><?php echo RMFormat::version($plugin->get_info('version')); ?> </strong> </td> <td align="center"> <?php if ($plugin->get_info('web') != '') { ?> <strong><a href="<?php echo $plugin->get_info('web'); ?> "><?php echo $plugin->get_info('author'); ?> </a></strong> <?php
/** * Format a given array with version information for a module. * * @param array $version Array with version values * @param bool $name Include module name in return string * @return string */ public static function format_module_version($version, $name = false) { return RMFormat::version($version, $name); }
function rmc_available_mods() { global $available_mods, $xoopsSecurity; $ret['title'] = __('Available Modules', 'rmcommon'); $ret['icon'] = RMCURL . '/images/modules.png'; $limit = 7; $tpages = ceil(count($available_mods) / $limit); $nav = new RMPageNav(count($available_mods), $limit, 1, 3); $nav->target_url('#" 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"> <ul class="list-unstyled"> <?php foreach ($available_mods as $mod) { ?> <?php if ($i == $limit) { break; } ?> <li> <div class="the-logo"> <?php if ($mod->getInfo('url') != '') { ?> <a href="modules.php?action=install&dir=<?php echo $mod->getInfo('dirname'); ?> "> <img src="<?php echo XOOPS_URL; ?> /modules/<?php echo $mod->getInfo('dirname'); ?> /<?php echo $mod->getInfo('image'); ?> " alt="<?php echo $mod->getInfo('dirname'); ?> "> </a> <?php } else { ?> <img src="<?php echo XOOPS_URL; ?> /modules/<?php echo $mod->getInfo('dirname'); ?> /<?php echo $mod->getInfo('image'); ?> " alt="<?php echo $mod->getInfo('dirname'); ?> "> <?php } ?> </div> <div class="the-info"> <ul> <li class="name"> <strong><a href="modules.php?action=install&dir=<?php echo $mod->getInfo('dirname'); ?> "><?php echo $mod->getInfo('name'); ?> </a></strong> <small><?php echo $mod->getInfo('rmversion') ? RMFormat::version($mod->getInfo('rmversion')) : $mod->getInfo('version'); ?> </small> </li> <li class="install"> <a href="modules.php?action=install&dir=<?php echo $mod->getInfo('dirname'); ?> "> <span class="fa fa-cog"></span> <span class="hidden-md"><?php _e('Install', 'rmcommon'); ?> </span> </a> </li> <li class="info"> <a href="javascript:;" onclick="show_module_info('<?php echo $mod->getInfo('dirname'); ?> ');"> <span class="fa fa-info-circle"></span> <span class="hidden-md"><?php _e('Info', 'rmcommon'); ?> </span> </a> </li> </ul> </div> <div class="rmc_mod_info" id="mod-<?php echo $mod->getInfo('dirname'); ?> "> <div class="header"> <div class="logo"> <img src="<?php echo XOOPS_URL; ?> /modules/<?php echo $mod->getInfo('dirname'); ?> /<?php echo $mod->getInfo('image'); ?> " alt="<?php echo $mod->getInfo('dirname'); ?> "> </div> <div class="name"> <h4><?php echo $mod->getInfo('name'); ?> </h4> <span class="help-block"> <?php echo $mod->getInfo('description'); ?> </span> </div> </div> <table class="table"> <tr> <td><?php _e('Version:', 'rmcommon'); ?> </td> <td> <?php if ($mod->getInfo('rmnative')) { ?> <strong><?php echo RMModules::format_module_version($mod->getInfo('rmversion')); ?> </strong> <?php } else { ?> <strong><?php echo $mod->getInfo('version'); ?> </strong> <?php } ?> </td> </tr> <tr> <td> <?php _e('Author:', 'rmcommon'); ?> </td> <td> <strong><?php echo strip_tags($mod->getInfo('author')); ?> </strong> </td> </tr> <tr> <td> <?php _e('Web site:', 'rmcommon'); ?> </td> <td> <a target="_blank" href="<?php echo $mod->getInfo('authorurl'); ?> "><?php echo $mod->getInfo('authorweb'); ?> </a> </td> </tr> <tr> <td><?php _e('Updatable:', 'rmcommon'); ?> </td> <td> <?php if ($mod->getInfo('updateurl') != '') { ?> <span class="fa fa-check"></span> <?php } else { ?> <span class="fa fa-times text-danger"></span> <?php } ?> </td> </tr> <tr> <td><?php _e('License:', 'rmcommon'); ?> </td> <td> <?php echo $mod->getInfo('license'); ?> </td> </tr> <tr> <td><?php _e('XOOPS Official:', 'rmcommon'); ?> </td> <td> <?php if ($mod->getInfo('official')) { ?> <span class="fa fa-check"></span> <?php } else { ?> <span class="fa fa-times text-danger"></span> <?php } ?> </td> </tr> <tr> <td><?php _e('C.U. Native:', 'rmcommon'); ?> </td> <td> <?php if ($mod->getInfo('rmnative')) { ?> <span class="fa fa-check"></span> <?php } else { ?> <span class="fa fa-times text-danger"></span> <?php } ?> </td> </tr> <tr> <td><?php _e('Directory:', 'rmcommon'); ?> </td> <td> <strong><?php echo $mod->getInfo('dirname'); ?> </strong> </td> </tr> <tr> <td><?php _e('Released:', 'rmcommon'); ?> </td> <td> <?php if ($mod->getInfo('releasedate') != '') { ?> <?php $time = strtotime($mod->getInfo('releasedate')); echo formatTimestamp($time, 's'); ?> <?php } ?> </td> </tr> <?php if ($mod->getInfo('help') != '' && $mod->getInfo('rmnative')) { ?> <tr> <td> </td> <td> <strong><a href="<?php echo $mod->getInfo('help'); ?> " target="_blank"><?php _e('Get Help', 'rmcommon'); ?> </a></strong> </td> </tr> <?php } ?> <tr> <td colspan="2" class="contact-options text-center"> <?php if ($mod->getInfo('authormail')) { ?> <?php if ($mod->getInfo('authormail') != '') { ?> <a target="_blank" href="mailto:<?php echo $mod->getInfo('authormail'); ?> "><span class="fa fa-envelope"></span></a> <?php } ?> <?php } ?> <?php if ($mod->getInfo('social')) { ?> <?php foreach ($mod->getInfo('social') as $social) { ?> <a target="_blank" href="<?php echo $social['url']; ?> "><span class="<?php echo parse_social_icons($social['type']); ?> "></span></a> <?php } ?> <?php } ?> </td> </tr> <tr> <td colspan="2" class="text-center"> <a href="modules.php?action=install&dir=<?php echo $mod->getInfo('dirname'); ?> " class="btn btn-success btn-sm"><?php _e('Install', 'rmcommon'); ?> </a> <a href="#" onclick="closeInfo();" class="btn btn-warning btn-sm"><?php _e('Close', 'rmcommon'); ?> </a> </td> </tr> </table> </div> </li> <?php $i++; } ?> </ul> <?php $nav->display(false); ?> <input type="hidden" id="token" value="<?php echo $xoopsSecurity->createToken(); ?> " /> </div> </div> <?php $ret['content'] = ob_get_clean(); return $ret; //print_r($available_mods); }
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 = 7; $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(); ?> <ul class="list-unstyled"> <?php for ($i = $start; $i < $end; $i++) { ?> <?php $mod = $available_mods[$i]; ?> <li> <div class="the-logo"> <?php if ($mod->getInfo('url') != '') { ?> <a href="modules.php?action=install&dir=<?php echo $mod->getInfo('dirname'); ?> "> <img src="<?php echo XOOPS_URL; ?> /modules/<?php echo $mod->getInfo('dirname'); ?> /<?php echo $mod->getInfo('image'); ?> " alt="<?php echo $mod->getInfo('dirname'); ?> "> </a> <?php } else { ?> <img src="<?php echo XOOPS_URL; ?> /modules/<?php echo $mod->getInfo('dirname'); ?> /<?php echo $mod->getInfo('image'); ?> " alt="<?php echo $mod->getInfo('dirname'); ?> "> <?php } ?> </div> <div class="the-info"> <ul> <li class="name"> <strong><a href="modules.php?action=install&dir=<?php echo $mod->getInfo('dirname'); ?> "><?php echo $mod->getInfo('name'); ?> </a></strong> <small><?php echo $mod->getInfo('rmversion') ? RMFormat::version($mod->getInfo('rmversion')) : $mod->getInfo('version'); ?> </small> </li> <li class="install"> <a href="modules.php?action=install&dir=<?php echo $mod->getInfo('dirname'); ?> "> <span class="fa fa-cog"></span> <?php _e('Install', 'rmcommon'); ?> </a> </li> <li class="info"> <a href="javascript:;" onclick="show_module_info('<?php echo $mod->getInfo('dirname'); ?> ');"> <span class="fa fa-info-circle"></span> <?php _e('Info', 'rmcommon'); ?> </a> </li> </ul> </div> <div class="rmc_mod_info" id="mod-<?php echo $mod->getInfo('dirname'); ?> "> <div class="header"> <div class="logo"> <img src="<?php echo XOOPS_URL; ?> /modules/<?php echo $mod->getInfo('dirname'); ?> /<?php echo $mod->getInfo('image'); ?> " alt="<?php echo $mod->getInfo('dirname'); ?> "> </div> <div class="name"> <h4><?php echo $mod->getInfo('name'); ?> </h4> <span class="help-block"> <?php echo $mod->getInfo('description'); ?> </span> </div> </div> <table class="table"> <tr> <td><?php _e('Version:', 'rmcommon'); ?> </td> <td> <?php if ($mod->getInfo('rmnative')) { ?> <strong><?php echo RMModules::format_module_version($mod->getInfo('rmversion')); ?> </strong> <?php } else { ?> <strong><?php echo $mod->getInfo('version'); ?> </strong> <?php } ?> </td> </tr> <tr> <td> <?php _e('Author:', 'rmcommon'); ?> </td> <td> <strong><?php echo strip_tags($mod->getInfo('author')); ?> </strong> </td> </tr> <tr> <td> <?php _e('Web site:', 'rmcommon'); ?> </td> <td> <a target="_blank" href="<?php echo $mod->getInfo('authorurl'); ?> "><?php echo $mod->getInfo('authorweb'); ?> </a> </td> </tr> <tr> <td><?php _e('Updatable:', 'rmcommon'); ?> </td> <td> <?php if ($mod->getInfo('updateurl') != '') { ?> <span class="fa fa-check"></span> <?php } else { ?> <span class="fa fa-times text-danger"></span> <?php } ?> </td> </tr> <tr> <td><?php _e('License:', 'rmcommon'); ?> </td> <td> <?php echo $mod->getInfo('license'); ?> </td> </tr> <tr> <td><?php _e('XOOPS Official:', 'rmcommon'); ?> </td> <td> <?php if ($mod->getInfo('official')) { ?> <span class="fa fa-check"></span> <?php } else { ?> <span class="fa fa-times text-danger"></span> <?php } ?> </td> </tr> <tr> <td><?php _e('C.U. Native:', 'rmcommon'); ?> </td> <td> <?php if ($mod->getInfo('rmnative')) { ?> <span class="fa fa-check"></span> <?php } else { ?> <span class="fa fa-times text-danger"></span> <?php } ?> </td> </tr> <tr> <td><?php _e('Directory:', 'rmcommon'); ?> </td> <td> <strong><?php echo $mod->getInfo('dirname'); ?> </strong> </td> </tr> <tr> <td><?php _e('Released:', 'rmcommon'); ?> </td> <td> <?php if ($mod->getInfo('releasedate') != '') { ?> <?php $time = strtotime($mod->getInfo('releasedate')); echo formatTimestamp($time, 's'); ?> <?php } ?> </td> </tr> <?php if ($mod->getInfo('help') != '' && $mod->getInfo('rmnative')) { ?> <tr> <td> </td> <td> <strong><a href="<?php echo $mod->getInfo('help'); ?> " target="_blank"><?php _e('Get Help', 'rmcommon'); ?> </a></strong> </td> </tr> <?php } ?> <tr> <td colspan="2" class="contact-options text-center"> <?php if ($mod->getInfo('authormail')) { ?> <?php if ($mod->getInfo('authormail') != '') { ?> <a target="_blank" href="mailto:<?php echo $mod->getInfo('authormail'); ?> "><span class="fa fa-envelope"></span></a> <?php } ?> <?php } ?> <?php if ($mod->getInfo('social')) { ?> <?php foreach ($mod->getInfo('social') as $social) { ?> <a target="_blank" href="<?php echo $social['url']; ?> "><span class="fa fa-<?php echo $social['type']; ?> -square"></span></a> <?php } ?> <?php } ?> </td> </tr> <tr> <td colspan="2" class="text-center"> <a href="modules.php?action=install&dir=<?php echo $mod->getInfo('dirname'); ?> " class="btn btn-success btn-sm"><?php _e('Install', 'rmcommon'); ?> </a> <a href="#" onclick="closeInfo();" class="btn btn-warning btn-sm"><?php _e('Close', 'rmcommon'); ?> </a> </td> </tr> </table> </div> </li> <?php } ?> </ul> <?php $nav->display(false); ?> <input type="hidden" id="token" value="<?php echo $xoopsSecurity->createToken(); ?> " /> <?php $ret = ob_get_clean(); echo $ret; }