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; }
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); }
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); }
/** * Shows the figures for a Document */ function rd_widget_figures() { global $res, $rmc_config; $ret['title'] = __('Document Figures', 'docs'); $count = 0; $figures = RDFunctions::figures($res->id(), &$count, '', 0, 6); $nav = new RMPageNav($count, 6, 1, 3); $nav->target_url('javascript:;" onclick="docsAjax.getFigures(' . $res->id() . ',6,{PAGE_NUM},\'rd-wd-figures\')'); RMTemplate::get()->add_script('../include/js/scripts.php?file=ajax.js'); ob_start(); ?> <div id="rd-wd-figures"> <ul> <?php if (count($figures) <= 0) { _e('There are not exists figures for this Document yet!', 'docs'); } foreach ($figures as $fig) { ?> <li><a href="javascript:;" onclick="docsAjax.insertIntoEditor('[figure:<?php echo $fig['id']; ?> ]','<?php echo $rmc_config['editor_type']; ?> ');"><?php echo $fig['title']; ?> </a></li> <?php } ?> </ul> <?php $nav->display(false); ?> </div> <?php $ret['content'] = ob_get_clean(); return $ret; }
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; }