/** * @return void */ public function getDump() { $xoops = Xoops::getInstance(); $maintenance = new Maintenance(); parent::__construct('', "form_dump", "dump.php", 'post', true); $dump_tray = new Xoops\Form\ElementTray(_AM_MAINTENANCE_DUMP_TABLES_OR_MODULES, ''); $select_tables1 = new Xoops\Form\Select('', "dump_tables", '', 7, true); $select_tables1->addOptionArray($maintenance->displayTables(true)); $dump_tray->addElement($select_tables1, false); $ele = new Xoops\Form\Select(' ' . _AM_MAINTENANCE_OR . ' ', 'dump_modules', '', 7, true); $module_list = XoopsLists::getModulesList(); $module_handler = $xoops->getHandlerModule(); foreach ($module_list as $file) { if (XoopsLoad::fileExists(\XoopsBaseConfig::get('root-path') . '/modules/' . $file . '/xoops_version.php')) { clearstatcache(); $file = trim($file); $module = $module_handler->create(); $module->loadInfo($file); if ($module->getInfo('tables') && $xoops->isActiveModule($file)) { $ele->addOption($module->getInfo('dirname'), $module->getInfo('name')); } unset($module); } } $dump_tray->addElement($ele); $this->addElement($dump_tray); $this->addElement(new Xoops\Form\RadioYesNo(_AM_MAINTENANCE_DUMP_DROP, 'drop', 1)); $this->addElement(new Xoops\Form\Hidden("op", "dump_save")); $this->addElement(new Xoops\Form\Button("", "dump_save", XoopsLocale::A_SUBMIT, "submit")); }
/** * @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); } } }
/** * Constructor */ public function __construct() { // Get main instance $xoops = Xoops::getInstance(); $module_handler = $xoops->getHandlerModule(); $this->modulesList = XoopsLists::getModulesList(); $modules = $module_handler->getObjectsArray(); /* @var $module XoopsModule */ foreach ($modules as $module) { $this->modulesDirnames[] = $module->getInfo('dirname'); } }
function show_dashboard() { global $xoopsModule; //RMFunctions::create_toolbar(); $db = XoopsDatabaseFactory::getDatabaseConnection(); $sql = 'SELECT * FROM ' . $db->prefix('modules'); $result = $db->query($sql); $installed_mods = array(); while ($row = $db->fetchArray($result)) { $installed_mods[] = $row['dirname']; } require_once XOOPS_ROOT_PATH . "/class/xoopslists.php"; $dirlist = XoopsLists::getModulesList(); $available_mods = array(); $module_handler =& xoops_gethandler('module'); $i = 0; foreach ($dirlist as $file) { if ($i > 5) { break; } clearstatcache(); $file = trim($file); if (!in_array($file, $installed_mods)) { $module =& $module_handler->create(); if (!$module->loadInfo($file, false)) { continue; } $available_mods[] = $module; } $i++; } $donateButton = '<form id="paypal-form" name="_xclick" action="https://www.paypal.com/fr/cgi-bin/webscr" method="post"> <input type="hidden" name="cmd" value="_xclick"> <input type="hidden" name="business" value="*****@*****.**"> <input type="hidden" name="item_name" value="Common Utilities Support"> <input type="hidden" name="amount" value=0> <input type="hidden" name="currency_code" value="USD"> <img src="https://www.paypal.com/en_US/i/btn/btn_donate_LG.gif" onclick="$(\'#paypal-form\').submit()" alt="PayPal - The safer, easier way to pay online!" /> </form>'; $installed_modules = get_modules_list(); xoops_cp_header(); RMTemplate::get()->add_style('dashboard.css', 'rmcommon'); RMTemplate::get()->add_script('dashboard.js', 'rmcommon', array('footer' => 1)); RMTemplate::get()->add_style('pagenav.css', 'rmcommon'); RMTemplate::get()->add_help(__('Dashboard Help', 'rmcommon'), 'http://www.xoopsmexico.net/docs/common-utilities/uso-de-common-utilities/standalone/1/#dashboard'); include RMTemplate::get()->get_template('rmc-dashboard.php', 'module', 'rmcommon'); xoops_cp_footer(); }
function show_dashboard() { global $xoopsModule; RMFunctions::create_toolbar(); $db = Database::getInstance(); $sql = 'SELECT * FROM ' . $db->prefix('modules'); $result = $db->query($sql); $installed_mods = array(); while ($row = $db->fetchArray($result)) { $installed_mods[] = $row['dirname']; } require_once XOOPS_ROOT_PATH . "/class/xoopslists.php"; $dirlist = XoopsLists::getModulesList(); $available_mods = array(); $module_handler =& xoops_gethandler('module'); $i = 0; foreach ($dirlist as $file) { if ($i > 5) { break; } clearstatcache(); $file = trim($file); if (!in_array($file, $installed_mods)) { $module =& $module_handler->create(); if (!$module->loadInfo($file, false)) { continue; } $available_mods[] = $module; } $i++; } xoops_cp_header(); RMTemplate::get()->add_style('dashboard.css', 'rmcommon'); RMTemplate::get()->add_script(RMCURL . '/include/js/dashboard.js'); RMTemplate::get()->add_style('pagenav.css', 'rmcommon'); RMTemplate::get()->set_help('http://redmexico.com.mx/docs/common-utilities'); include RMTemplate::get()->get_template('rmc_dashboard.php', 'module', 'rmcommon'); xoops_cp_footer(); }
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 xoops_module_list() { xoops_cp_header(); $myts =& MyTextSanitizer::getInstance(); echo "\n <h4>" . _MD_AM_MODADMIN . "</h4>\n <form action='admin.php' method='post' name='moduleadmin' id='moduleadmin'>\n <table class='outer' width='100%' cellpadding='4' cellspacing='1'>\n <tr align='center'><th>" . _MD_AM_MODULE . "</th>\n <th>" . _MD_AM_VERSION . "</th>\n <th>" . _MD_AM_LASTUP . "</th>\n <th>" . _MD_AM_ACTIVE . "</th>\n <th>" . _MD_AM_ORDER . "<br /><small>" . _MD_AM_ORDER0 . "</small></th>\n <th>" . _MD_AM_ACTION . "</th></tr>\n "; $module_handler =& xoops_gethandler('module'); $installed_mods = $module_handler->getObjects(); $listed_mods = array(); $count = 0; foreach ($installed_mods as $module) { if ($count % 2 == 0) { $class = 'even'; } else { $class = 'odd'; } $count++; echo "<tr class='{$class}' align='center' valign='middle'>\n"; echo "<td valign='bottom'>"; if ($module->getVar('hasadmin') == 1 && $module->getVar('isactive') == 1) { echo '<a href="' . XOOPS_URL . '/modules/' . $module->getVar('dirname') . '/' . $module->getInfo('adminindex') . '"> <img src="' . XOOPS_URL . '/modules/' . $module->getVar('dirname') . '/' . $module->getInfo('image') . '" alt="' . $module->getVar('name', 'E') . '" border="0" /></a> <br /><input type="text" name="newname[' . $module->getVar('mid') . ']" value="' . $module->getVar('name', 'E') . '" maxlength="150" size="20" />'; } else { echo '<img src="' . XOOPS_URL . '/modules/' . $module->getVar('dirname') . '/' . $module->getInfo('image') . '" alt="' . $module->getVar('name', 'E') . '" border="0" /><br /> <input type="text" name="newname[' . $module->getVar('mid') . ']" value="' . $module->getVar('name', 'E') . '" maxlength="150" size="20" />'; } echo '<input type="hidden" name="oldname[' . $module->getVar('mid') . ']" value="' . $module->getVar('name') . '" /></td>'; echo "<td align='center'>" . round($module->getVar('version') / 100, 2) . "</td><td align='center'>" . formatTimestamp($module->getVar('last_update'), 'm') . "<br />"; if ($module->getVar('dirname') != 'system' && $module->getVar('isactive') == 1) { echo '</td><td><input type="checkbox" name="newstatus[' . $module->getVar('mid') . ']" value="1" checked="checked" /><input type="hidden" name="oldstatus[' . $module->getVar('mid') . ']" value="1" />'; $extra = '<a href="' . XOOPS_URL . '/modules/system/admin.php?fct=modulesadmin&op=update&module=' . $module->getVar('dirname') . '"><img src="' . XOOPS_URL . '/modules/system/images/update.gif" alt="' . _MD_AM_UPDATE . '" /></a>'; } elseif ($module->getVar('dirname') != 'system') { echo '</td><td><input type="checkbox" name="newstatus[' . $module->getVar('mid') . ']" value="1" /><input type="hidden" name="oldstatus[' . $module->getVar('mid') . ']" value="0" />'; $extra = '<a href="' . XOOPS_URL . '/modules/system/admin.php?fct=modulesadmin&op=update&module=' . $module->getVar('dirname') . '"><img src="' . XOOPS_URL . '/modules/system/images/update.gif" alt="' . _MD_AM_UPDATE . '" /></a> <a href="' . XOOPS_URL . '/modules/system/admin.php?fct=modulesadmin&op=uninstall&module=' . $module->getVar('dirname') . '"><img src="' . XOOPS_URL . '/modules/system/images/uninstall.gif" alt="' . _MD_AM_UNINSTALL . '" /></a>'; } else { echo '</td><td><input type="checkbox" name="newstatus[' . $module->getVar('mid') . ']" value="1" checked="checked" /><input type="hidden" name="oldstatus[' . $module->getVar('mid') . ']" value="1" />'; $extra = '<a href="' . XOOPS_URL . '/modules/system/admin.php?fct=modulesadmin&op=update&module=' . $module->getVar('dirname') . '"><img src="' . XOOPS_URL . '/modules/system/images/update.gif" alt="' . _MD_AM_UPDATE . '" /></a>'; } echo "</td><td>"; if ($module->getVar('hasmain') == 1) { echo '<input type="hidden" name="oldweight[' . $module->getVar('mid') . ']" value="' . $module->getVar('weight') . '" /><input type="text" name="weight[' . $module->getVar('mid') . ']" size="3" maxlength="5" value="' . $module->getVar('weight') . '" />'; } else { echo '<input type="hidden" name="oldweight[' . $module->getVar('mid') . ']" value="0" /><input type="hidden" name="weight[' . $module->getVar('mid') . ']" value="0" />'; } echo "\n </td>\n <td>" . $extra . " <a href='javascript:openWithSelfMain(\"" . XOOPS_URL . "/modules/system/admin.php?fct=version&mid=" . $module->getVar('mid') . "\",\"Info\",300,230);'>"; echo '<img src="' . XOOPS_URL . '/modules/system/images/info.gif" alt="' . _INFO . '" /></a><input type="hidden" name="module[]" value="' . $module->getVar('mid') . '" /></td> </tr> '; $listed_mods[] = $module->getVar('dirname'); } echo "<tr class='foot'><td colspan='6' align='center'><input type='hidden' name='fct' value='modulesadmin' />\n <input type='hidden' name='op' value='confirm' />\n <input type='submit' name='submit' value='" . _MD_AM_SUBMIT . "' />\n </td></tr></table>\n </form>\n <br />\n <table width='100%' border='0' class='outer' cellpadding='4' cellspacing='1'>\n <tr align='center'><th>" . _MD_AM_MODULE . "</th><th>" . _MD_AM_VERSION . "</th><th>" . _MD_AM_ACTION . "</th></tr>\n "; require_once XOOPS_ROOT_PATH . "/class/xoopslists.php"; $dirlist = XoopsLists::getModulesList(); $count = 0; foreach ($dirlist as $file) { clearstatcache(); $file = trim($file); if (!in_array($file, $listed_mods)) { $module =& $module_handler->create(); if (!$module->loadInfo($file, false)) { continue; } if ($count % 2 == 0) { $class = 'even'; } else { $class = 'odd'; } echo '<tr class="' . $class . '" align="center" valign="middle"> <td align="center" valign="bottom"><img src="' . XOOPS_URL . '/modules/' . $module->getInfo('dirname') . '/' . $module->getInfo('image') . '" alt="' . $myts->htmlspecialchars($module->getInfo('name'), ENT_QUOTES, _CHARSET, false) . '" border="0" /><br /><br />' . $myts->htmlspecialchars($module->getInfo('name'), ENT_QUOTES, _CHARSET, false) . '</td> <td align="center">' . round($module->getInfo('version'), 2) . '</td> <td> <a href="' . XOOPS_URL . '/modules/system/admin.php?fct=modulesadmin&op=install&module=' . $module->getInfo('dirname') . '"><img src="' . XOOPS_URL . '/modules/system/images/install.gif" alt="' . _MD_AM_INSTALL . '" /></a>'; echo " <a href='javascript:openWithSelfMain(\"" . XOOPS_URL . "/modules/system/admin.php?fct=version&mid=" . $module->getInfo('dirname') . "\",\"Info\",300,230);'>"; echo '<img src="' . XOOPS_URL . '/modules/system/images/info.gif" alt="' . _INFO . '" /></a></td></tr> '; unset($module); $count++; } } echo "</table>"; xoops_cp_footer(); }
function show_dashboard() { global $xoopsModule, $cuSettings, $cuIcons; //RMFunctions::create_toolbar(); $db = XoopsDatabaseFactory::getDatabaseConnection(); $sql = 'SELECT * FROM ' . $db->prefix('modules'); $result = $db->query($sql); $installed_mods = array(); while ($row = $db->fetchArray($result)) { $installed_mods[] = $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_mods)) { $module =& $module_handler->create(); if (!$module->loadInfo($file, false)) { continue; } $available_mods[] = $module; } } $installed_modules = get_modules_list(); // Modules counter $counterModules = new Common\Widgets\Counter(['id' => 'counter-modules', 'color' => 'red', 'icon' => 'svg-rmcommon-module', 'class' => 'animated bounceIn']); $counterModules->addCell(__('Modules', 'rmcommon'), count($available_mods) + count($installed_modules)); $counterModules->addCell(__('Installed', 'rmcommon'), count($installed_modules)); $counterModules->addCell(__('Available', 'rmcommon'), count($available_mods)); // Users counter $sql = "SELECT COUNT(*) FROM " . $db->prefix("users") . " WHERE level > 0"; list($active) = $db->fetchRow($db->query($sql)); $sql = "SELECT COUNT(*) FROM " . $db->prefix("users") . " WHERE level <= 0"; list($inactive) = $db->fetchRow($db->query($sql)); $counterUsers = new Common\Widgets\Counter(['id' => 'counter-users', 'color' => 'blue', 'icon' => 'svg-rmcommon-users2', 'class' => 'animated bounceIn']); $total = $active + $inactive; $counterUsers->addCell(__('Users', 'rmcommon'), $total); $counterUsers->addCell(__('Active', 'rmcommon'), $active); $counterUsers->addCell(__('Inactive', 'rmcommon'), $inactive); $ratio = $active / ($active + $inactive); if ($ratio < 1) { $ratio = number_format($ratio, 2); } $counterUsers->addCell(__('Ratio', 'rmcommon'), $ratio * 100 . '%'); // Comments counter $counterComments = new Common\Widgets\Counter(['id' => 'counter-comments', 'color' => 'green', 'icon' => 'svg-rmcommon-comments', 'class' => 'animated bounceIn']); list($approved) = $db->fetchRow($db->query("SELECT COUNT(*) FROM " . $db->prefix("mod_rmcommon_comments") . " WHERE status = 'approved'")); list($waiting) = $db->fetchRow($db->query("SELECT COUNT(*) FROM " . $db->prefix("mod_rmcommon_comments") . " WHERE status != 'approved'")); $counterComments->addCell(__('Comments', 'rmcommon'), $approved > 0 || $waiting > 0 ? $approved + $waiting : '0'); $counterComments->addCell(__('Approved', 'rmcommon'), $approved); $counterComments->addCell(__('Waiting', 'rmcommon'), $waiting); $ratio = $approved / ($approved + $waiting); if ($ratio < 1) { $ratio = number_format($ratio, 2); } $counterComments->addCell(__('Ratio', 'rmcommon'), $ratio * 100 . '%'); $counterSystem = new Common\Widgets\Counter(['id' => 'counter-system', 'color' => 'deep-orange', 'icon' => 'svg-rmcommon-rmcommon', 'class' => 'animated bounceIn']); $counterSystem->addCell(__('Current Version', 'rmcommon'), RMModules::get_module_version('rmcommon', false)); $counterSystem->addCell('XOOPS', str_replace('XOOPS ', '', XOOPS_VERSION)); $version = explode('-', phpversion()); $counterSystem->addCell('PHP', $version[0]); unset($version); if (method_exists($db, 'getServerVersion')) { $version = explode("-", $db->getServerVersion()); } else { $version = '--'; } $counterSystem->addCell('MySQL', $version[0]); // Management Tools $managementTools[] = (object) ['caption' => __('Modules', 'rmcommon'), 'link' => 'modules.php', 'icon' => 'svg-rmcommon-module', 'color' => 'pink']; $managementTools[] = (object) ['caption' => __('Blocks', 'rmcommon'), 'link' => 'blocks.php', 'icon' => 'svg-rmcommon-blocks', 'color' => 'blue']; $managementTools[] = (object) ['caption' => __('Users', 'rmcommon'), 'link' => 'users.php', 'icon' => 'svg-rmcommon-user2', 'color' => 'deep-orange']; $managementTools[] = (object) ['caption' => __('Groups', 'rmcommon'), 'link' => 'groups.php', 'icon' => 'svg-rmcommon-users2', 'color' => 'green']; $managementTools[] = (object) ['caption' => __('Images', 'rmcommon'), 'link' => 'images.php', 'icon' => 'svg-rmcommon-images', 'color' => 'purple']; $managementTools[] = (object) ['caption' => __('Comments', 'rmcommon'), 'link' => 'comments.php', 'icon' => 'svg-rmcommon-comments', 'color' => 'red']; $managementTools[] = (object) ['caption' => __('Plugins', 'rmcommon'), 'link' => 'plugins.php', 'icon' => 'svg-rmcommon-plug', 'color' => 'orange']; $managementTools[] = (object) ['caption' => __('Updates', 'rmcommon'), 'link' => 'updates.php', 'icon' => 'svg-rmcommon-update', 'color' => 'teal']; $managementTools[] = (object) ['caption' => __('Preferences', 'rmcommon'), 'link' => 'settings.php?action=configure&mod=rmcommon', 'icon' => 'svg-rmcommon-wrench', 'color' => 'light-blue']; $managementTools = RMEvents::get()->trigger('rmcommon.get.system.tools', $managementTools); // Load recent comments $sql = "SELECT * FROM " . $db->prefix("mod_rmcommon_comments") . " ORDER BY `posted` DESC LIMIT 0, 5"; $result = $db->query($sql); $comments = []; while ($row = $db->fetchArray($result)) { $com = new RMComment(); $com->assignVars($row); // Editor data if (!isset($ecache[$com->getVar('user')])) { $ecache[$com->getVar('user')] = new RMCommentUser($com->getVar('user')); } $editor = $ecache[$com->getVar('user')]; if ($editor->getVar('xuid') > 0) { if (!isset($ucache[$editor->getVar('xuid')])) { $ucache[$editor->getVar('xuid')] = new XoopsUser($editor->getVar('xuid')); } $user = $ucache[$editor->getVar('xuid')]; $poster = (object) array('id' => $user->getVar('uid'), 'name' => $user->getVar('uname'), 'email' => $user->getVar('email'), 'posts' => $user->getVar('posts'), 'avatar' => $user->getVar('image') != '' && $user->getVar('image') != 'blank.gif' ? XOOPS_UPLOAD_URL . '/' . $user->getVar('image') : RMCURL . '/images/avatar.gif', 'rank' => $user->rank()); } else { $poster = (object) array('id' => 0, 'name' => $editor->getVar('name'), 'email' => $editor->getVar('email'), 'posts' => 0, 'avatar' => RMCURL . '/images/avatar.gif', 'rank' => ''); } // Get item $cpath = XOOPS_ROOT_PATH . '/modules/' . $row['id_obj'] . '/class/' . $row['id_obj'] . 'controller.php'; if (is_file($cpath)) { if (!class_exists(ucfirst($row['id_obj']) . 'Controller')) { include_once $cpath; } $class = ucfirst($row['id_obj']) . 'Controller'; $controller = new $class(); $item = $controller->get_item($row['params'], $com); if (method_exists($controller, 'get_item_url')) { $item_url = $controller->get_item_url($row['params'], $com); } } else { $item = __('Unknow', 'rmcommon'); $item_url = ''; } $text = TextCleaner::getInstance()->clean_disabled_tags(TextCleaner::getInstance()->popuplinks(TextCleaner::getInstance()->nofollow(TextCleaner::getInstance()->truncate($com->getVar('content'), 100)))); $comments[] = (object) array('id' => $row['id_com'], 'text' => $text, 'poster' => $poster, 'date' => formatTimestamp($com->getVar('posted'), 'l'), 'ip' => $com->getVar('ip'), 'item' => $item, 'item_url' => $item_url, 'module' => $row['id_obj'], 'status' => $com->getVar('status')); } // Get dashboard widgets $dashboardPanels = []; $dashboardPanels = RMEvents::get()->trigger('rmcommon.dashboard.panels', $dashboardPanels); RMTemplate::getInstance()->add_body_class('dashboard'); xoops_cp_header(); //RMTemplate::get()->add_style('dashboard.min.css', 'rmcommon'); RMTemplate::get()->add_style('pagenav.css', 'rmcommon'); RMTemplate::get()->add_help(__('Dashboard Help', 'rmcommon'), 'http://www.xoopsmexico.net/docs/common-utilities/uso-de-common-utilities/standalone/1/#dashboard'); include RMTemplate::get()->path('rmc-dashboard.php', 'module', 'rmcommon'); xoops_cp_footer(); }
$xoTheme->addScript('browse.php?modules/system/js/admin.js'); // Define Breadcrumb and tips $xoBreadCrumb->addLink(_AM_SYSTEM_MODULES_ADMIN, system_adminVersion('modulesadmin', 'adminpath')); $xoBreadCrumb->addLink(_AM_SYSTEM_MODULES_TOINSTALL); $xoBreadCrumb->addHelp(system_adminVersion('modulesadmin', 'help') . '#install'); $xoBreadCrumb->addTips(_AM_SYSTEM_MODULES_TIPS); $xoBreadCrumb->render(); // Get Module Handler $module_handler =& xoops_gethandler('module'); // Get all installed modules $installed_mods = $module_handler->getObjects(); foreach ($installed_mods as $module) { $install_mods[] = $module->getInfo('dirname'); } // Get module to install $dirlist = XoopsLists::getModulesList(); $toinstall_mods = array(); $i = 0; foreach ($dirlist as $file) { if (file_exists(XOOPS_ROOT_PATH . '/modules/' . $file . '/xoops_version.php')) { clearstatcache(); $file = trim($file); if (!in_array($file, $install_mods)) { $module =& $module_handler->create(); $module->loadInfo($file); $toinstall_mods[$i]['name'] = $module->getInfo('name'); $toinstall_mods[$i]['dirname'] = $module->getInfo('dirname'); $toinstall_mods[$i]['image'] = $module->getInfo('image'); $toinstall_mods[$i]['version'] = round($module->getInfo('version'), 2); $toinstall_mods[$i]['author'] = $module->getInfo('author'); $toinstall_mods[$i]['credits'] = $module->getInfo('credits');
require_once dirname(dirname(dirname(__DIR__))) . DIRECTORY_SEPARATOR . 'mainfile.php'; require_once dirname(__DIR__) . DIRECTORY_SEPARATOR . 'common.php'; 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"); $module_handler = xoops_gethandler('module'); if ($resourcesConfigsList['harvester']) { foreach (XoopsLists::getModulesList() as $module) { if ($modmap = XoopsCache::read(basename(dirname(dirname(__DIR__))) . '.module' . $module . '.delays')) { if (!XoopsCache::read(basename(dirname(dirname(__DIR__))) . '.module' . $module)) { if ($monthmap = XoopsCache::read(basename(dirname(dirname(__DIR__))) . '.module' . $module . '.old')) { foreach ($monthmap as $key => $values) { if (isset($modmap[$key]) && $modmap[$key]['is'] == 'file') { unset($modmap[$key]); } elseif (isset($modmap[$key]) && $modmap[$key]['is'] == 'folder') { unset($modmap[$key]); } } if (count($modmap) > 0) { $modmap = getMapFingering($modmap, $module, 'module'); } else { $modmap = array(); }
define('HELIUM_URL', RMCURL . '/themes/helium'); include_once HELIUM_PATH . '/class/HeliumHelper.class.php'; $xoFunc = new HeliumHelper(); // Common Utilities module menu $mod = RMModules::load_module('rmcommon'); $rmcommon_menu = array('name' => $mod->getVar('name'), 'directory' => $mod->getVar('dirname'), 'menu' => $xoFunc->moduleMenu('rmcommon'), 'native' => $mod->getInfo('rmnative'), 'rewrite' => $mod->getInfo('rewrite')); // System module menu $mod = RMModules::load_module('system'); $system_menu = array('name' => $mod->getVar('name'), 'directory' => $mod->getVar('dirname'), 'menu' => $xoFunc->moduleMenu('system'), 'native' => $mod->getInfo('rmnative'), 'rewrite' => $mod->getInfo('rewrite')); // Current Module Menu $currentModule = array('name' => $xoopsModule->getVar('name'), 'directory' => $xoopsModule->getVar('dirname'), 'menu' => $xoFunc->moduleMenu($xoopsModule->getVar('dirname')), 'native' => $xoopsModule->getInfo('rmnative'), 'rewrite' => $xoopsModule->getInfo('rewrite')); $currentModule = (object) $currentModule; /** * Load modules and their menus */ $modulesList = \XoopsLists::getModulesList(); $activeModules = array(); foreach ($modulesList as $item) { if ($item == 'rmcommon' || $item == 'system' || $item == $xoopsModule->getVar('dirname')) { continue; } if (false == ($module = \XoopsModule::getByDirName($item))) { continue; } if (!$module->getVar('isactive')) { continue; } $activeModules[] = (object) array('name' => $module->getVar('name'), 'directory' => $module->getVar('dirname'), 'menu' => $module->getAdminMenu(), 'native' => $module->getInfo('rmnative'), 'rewrite' => $module->getInfo('rewrite'), 'icon' => false === $module->getInfo('icon') ? XOOPS_URL . '/modules/' . $module->getInfo('dirname') . '/' . $module->getInfo('image') : $module->getInfo('icon')); } // Other Menus $other_menu = RMEvents::get()->run_event('helium.other.menu');
/** * Create the files to store the modules list */ static function build_modules_cache() { $modules = XoopsLists::getModulesList(); print_r($modules); }
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; }
// title $title = _AM_XOONIPS_POLICY_ITEM_COMMENT_TITLE; $description = _AM_XOONIPS_POLICY_ITEM_COMMENT_DESC; // breadcrumbs $breadcrumbs = array(array('type' => 'top', 'label' => _AM_XOONIPS_TITLE, 'url' => $xoonips_admin['admin_url'] . '/'), array('type' => 'link', 'label' => _AM_XOONIPS_POLICY_TITLE, 'url' => $xoonips_admin['myfile_url']), array('type' => 'link', 'label' => _AM_XOONIPS_POLICY_ITEM_TITLE, 'url' => $xoonips_admin['myfile_url'] . '?page=item'), array('type' => 'label', 'label' => $title, 'url' => '')); // token ticket require_once '../class/base/gtickets.php'; $ticket_area = 'xoonips_admin_policy_item_comment'; $token_ticket = $xoopsGTicket->getTicketHtml(__LINE__, 1800, $ticket_area); // get configs $config_keys = array('item_comment_dirname' => 's', 'item_comment_forum_id' => 'i'); $config_values = xoonips_admin_get_configs($config_keys, 'e'); // get d3forum module list include XOOPS_ROOT_PATH . '/class/xoopslists.php'; $module_handler =& xoops_gethandler('module'); $mod_dirnames =& XoopsLists::getModulesList(); $d3forum_not_found = true; $d3forums = array(); // set empty d3forum module name $selected = $config_values['item_comment_dirname'] == ''; if ($selected) { $d3forum_not_found = false; } $d3forums[] = array('dirname' => '', 'label' => '----------', 'selected' => $selected); foreach ($mod_dirnames as $mod_dirname) { $trustdir_php = XOOPS_ROOT_PATH . '/modules/' . $mod_dirname . '/mytrustdirname.php'; if (file_exists($trustdir_php)) { include $trustdir_php; if ($mytrustdirname == 'd3forum') { $module =& $module_handler->getByDirname($mod_dirname); if (is_object($module) && $module->getVar('isactive', 'n') == 1) {