/** * Get blocks */ public static function construct_blocks() { global $xoopsConfig, $xoopsModule, $xoopsUser, $xoopsOption; $sides = array(); foreach (self::block_positions(1) as $id => $row) { $sides[$id] = $row['tag']; $blocks[$row['tag']] = array(); } $startMod = $xoopsConfig['startpage'] == '--' ? 'system' : $xoopsConfig['startpage']; if (@is_object($xoopsModule)) { list($mid, $dirname) = array($xoopsModule->getVar('mid'), $xoopsModule->getVar('dirname')); $isStart = substr($_SERVER['PHP_SELF'], -9) == 'index.php' && $xoopsConfig['startpage'] == $dirname; } else { $sys = RMModules::load_module('system'); list($mid, $dirname) = array($sys->getVar('mid'), 'system'); $isStart = !@empty($GLOBALS['xoopsOption']['show_cblock']); } $groups = @is_object($xoopsUser) ? $xoopsUser->getGroups() : array(XOOPS_GROUP_ANONYMOUS); $subpage = isset($xoopsOption['module_subpage']) ? $xoopsOption['module_subpage'] : ''; $barray = array(); // Array of retrieved blocks $barray = self::get_blocks($groups, $mid, $isStart, XOOPS_BLOCK_VISIBLE, '', 1, $subpage, array_keys($sides)); foreach ($barray as $block) { if (!isset($sides[$block->getVar('canvas')])) { continue; } $side = $sides[$block->getVar('canvas')]; if ($content = self::buildBlock($block)) { $blocks[$side][$content['id']] = $content; } } unset($side, $sides, $content, $subpage, $barray, $groups, $startMod); return is_array($blocks) ? $blocks : array(); }
public function eventRmcommonGetFeedsList($feeds) { load_mod_locale('bxpress'); include_once XOOPS_ROOT_PATH . '/modules/bxpress/class/bxfunctions.class.php'; include_once XOOPS_ROOT_PATH . '/modules/bxpress/class/bxforum.class.php'; $module = RMModules::load_module('bxpress'); $config = RMSettings::module_settings('bxpress'); $url = XOOPS_URL . '/' . ($config->urlmode ? $config->htbase : 'modules/bxpress') . '/'; $bxFunc = new bXFunctions(); $data = array('title' => $module->name(), 'url' => $url, 'module' => 'bxpress'); $options[] = array('title' => __('All Recent Messages', 'bxpress'), 'params' => 'show=all', 'description' => __('Show all recent messages', 'bxpress')); $forums = $bxFunc->forumList('', false); $table = '<table cellpadding="2" cellspacing="2" width="100%"><tr class="even">'; $count = 0; foreach ($forums as $forum) { if ($count >= 3) { $count = 0; $table .= '</tr><tr class="' . tpl_cycle("odd,even") . '">'; } $table .= '<td width="33%"><a href="' . XOOPS_URL . '/backend.php?action=showfeed&mod=bxpress&show=forum&forum=' . $forum['id'] . '">' . $forum['title'] . '</a></td>'; $count++; } $table .= '</tr></table>'; $options[] = array('title' => __('Posts by forum', 'bxpress'), 'description' => __('Select a forum to see the messages posted recently.', 'bxpress') . ' <a href="javascript:;" onclick="$(\'#bxforums-feed\').slideToggle(\'slow\');">Show Forums</a> <div id="bxforums-feed" style="padding: 10px; display: none;">' . $table . '</div>'); unset($forums); $feed = array('data' => $data, 'options' => $options); $feeds[] = $feed; return $feeds; }
protected function construct_module($module) { global $xoopsModule; if ($xoopsModule && $xoopsModule->getVar('dirname') == $module) { $moduleObject = $xoopsModule; } else { $moduleObject = RMModules::load_module($module); } if (!is_a($moduleObject, 'XoopsModule')) { throw new RMException(sprintf(__('The module "%s" does not exists!', 'rmcommon'), $module)); } // Initialize properties $this->module_data = array('settings' => RMSettings::module_settings($module), 'path' => XOOPS_ROOT_PATH . '/modules/' . $module, 'real_url' => XOOPS_URL . '/modules/' . $module, 'data' => (object) $moduleObject->getInfo(), 'directory' => $module, 'controller' => '', 'action' => '', 'default_controller' => '', 'default_action' => '', 'parameters' => array()); $this->module = $moduleObject; if (defined('XOOPS_CPFUNC_LOADED')) { $this->module_data['menu'] = $moduleObject->getAdminMenu(); } $this->module_data['url'] = $this->url; }
function get_modules_list() { $db = XoopsDatabaseFactory::getDatabaseConnection(); $sql = 'SELECT * FROM ' . $db->prefix('modules') . " ORDER BY mid, weight"; $result = $db->query($sql); $installed_mods = array(); while ($row = $db->fetchArray($result)) { $mod = new XoopsModule(); $mod->assignVars($row); $module_icon = $mod->getInfo('icon48') != '' ? XOOPS_URL . '/modules/' . $mod->getVar('dirname') . '/' . $mod->getInfo('icon48') : ''; $module_logo = XOOPS_URL . '/modules/' . $mod->getVar('dirname') . '/' . $mod->getInfo('image'); if ($mod->hasconfig()) { $config_link = $mod->getInfo('rmnative') ? XOOPS_URL . '/modules/rmcommon/settings.php?action=configure&mod=' . $mod->mid() : XOOPS_URL . '/modules/system/admin.php?fct=preferences&op=showmod&mod=' . $mod->mid(); } $this_module = array('name' => $mod->getVar('name'), 'dirname' => $mod->getVar('dirname'), 'real_name' => $mod->getInfo('name'), 'version' => is_array($mod->getInfo('rmversion')) ? RMModules::format_module_version($mod->getInfo('rmversion')) : $mod->getVar('version') / 100, 'icon' => $module_icon, 'logo' => $module_logo, 'admin' => $mod->getVar('hasadmin') ? XOOPS_URL . '/modules/' . $mod->getVar('dirname') . '/' . $mod->getInfo('adminindex') : '', 'main' => RMUris::anchor($mod->getVar('dirname')), 'updated' => RMTimeFormatter::get()->format($mod->getVar('last_update'), __('%d% %T% %Y%', 'rmcommon')), 'config' => isset($config_link) ? $config_link : '', 'description' => $mod->getInfo('description')); $installed_mods[] = (object) $this_module; } return $installed_mods; }
Theme URI: http://www.redmexico.com.mx Version: 1.0 Author: Eduardo Cortés Author URI: http://www.eduardocortes.mx */ load_theme_locale('helium', '', true); global $xoopsUser, $xoopsSecurity, $cuIcons, $cuServices; define('HELIUM_PATH', RMCPATH . '/themes/helium'); 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;
<div class="cu-box welcome-box"> <div class="panel-body"> <div class="media"> <div class="media-left"> <?php echo $cuIcons->getIcon('svg-rmcommon-rmcommon', ['class' => 'media-object rmcommon-logo']); ?> </div> <div class="media-body"> <h1 class="media-heading"> Welcome to Common Utilities </h1> <p class="lead"> Thanks for using <strong><?php echo RMModules::get_module_version('rmcommon'); ?> </strong>. This version has a lot of improvements and new features to make your work more productive and pleasing. </p> </div> </div> </div> </div> <div class="color-bar"> <ul> <li class="bg-red"></li> <li class="bg-pink"></li> <li class="bg-purple"></li> <li class="bg-deep-purple"></li>
/** * Get the menu for a specified module */ public function moduleMenu($m) { global $xoopsModule, $xoopsUser; if (!is_a($xoopsModule, 'XoopsModule')) { $mod = RMModules::load_module($m); } else { if ($xoopsModule->dirname() == $m) { $mod = $xoopsModule; } else { $mod = RMModules::load_module($m); } } if (!is_a($mod, 'XoopsModule')) { return false; } // Check user if (!is_a($xoopsUser, 'XoopsUser')) { return false; } if (!$xoopsUser->isAdmin($mod->mid())) { return false; } $amenu = $mod->getAdminMenu(); $amenu = RMEvents::get()->run_event($mod->dirname() . '.module.menu', $amenu); if (empty($amenu)) { return false; } $return_menu = array(); foreach ($amenu as $menu) { $tempMenu = array('title' => $menu['title'], 'link' => $menu['link'], 'icon' => array_key_exists('icon', $menu) ? $menu['icon'] : '', 'location' => isset($menu['location']) ? $menu['location'] : '', 'options' => isset($menu['options']) ? self::moduleSubmenu($menu['options'], $mod) : ($m == 'system' && $menu['title'] == _AM_SYSTEM_PREF ? self::systemPreferences() : null)); if (array_key_exists('rewrite', $menu)) { $tempMenu['rewrite'] = $menu['rewrite']; } $return_menu[] = $tempMenu; } unset($tempMenu); if ($mod->hasconfig()) { $return_menu[] = array('title' => __('Options', 'rmcommon'), 'link' => $mod->getInfo('rmnative') ? XOOPS_URL . '/modules/rmcommon/settings.php?mod=' . $mod->mid() . '&popup=1&action=configure' : XOOPS_URL . '/modules/system/admin.php?fct=preferences&op=showmod&mod=' . $mod->mid(), 'icon' => 'svg-rmcommon-wrench', 'type' => 1, 'location' => 'cu-settings', 'attr' => array('data-action' => 'load-remote-dialog')); } return $return_menu; }
?> <div class="box-content"> <?php echo $widget['content']; ?> </div> </div> <?php } ?> </div> </div> <?php } else { ?> <?php echo $content; ?> <?php } ?> <div id="he-footer"> <?php echo sprintf(__('Powered by %s and %s', 'rmcommon'), '<strong><a href="http://rmcommon.com" target="_blank">' . RMModules::get_module_version('rmcommon') . '</a></strong>', '<a href="http://xoops.org" target="_blank">' . XOOPS_VERSION . '</a>'); ?> . </div> </div> </div>
public function element_data() { $module = RMModules::load_module('bxpress'); include_once XOOPS_ROOT_PATH . '/modules/bxpress/class/bxfunctions.class.php'; $ret = array('name' => $module->getVar('name'), 'link' => bXFunctions::url()); return $ret; }
function rmc_bkcomments_show($options) { $db = XoopsDatabaseFactory::getDatabaseConnection(); $sql = "SELECT * FROM " . $db->prefix("mod_rmcommon_comments") . " ORDER BY id_com DESC"; $limit = $options[0] > 0 ? $options[0] : 10; $sql .= " LIMIT 0,{$limit}"; $result = $db->query($sql); $comments = array(); $ucache = array(); $ecache = array(); $mods = array(); while ($row = $db->fetchArray($result)) { $com = new RMComment(); $com->assignVars($row); if ($options[3]) { // 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 = 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 = 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); $item_url = $controller->get_item_url($row['params'], $com); } else { $item = __('Unknow', 'rmcommon'); $item_url = ''; } if (isset($mods[$row['id_obj']])) { $mod = $mods[$row['id_obj']]; } else { $m = RMModules::load_module($row['id_obj']); $mod = $m->getVar('name'); $mods[$row['id_obj']] = $mod; } $comments[] = array('id' => $row['id_com'], 'text' => TextCleaner::truncate(TextCleaner::getInstance()->clean_disabled_tags(TextCleaner::getInstance()->popuplinks(TextCleaner::getInstance()->nofollow($com->getVar('content')))), 50), 'poster' => isset($poster) ? $poster : null, 'posted' => formatTimestamp($com->getVar('posted'), 'l'), 'item' => $item, 'item_url' => $item_url, 'module' => $row['id_obj'], 'status' => $com->getVar('status'), 'module' => $mod); } $comments = RMEvents::get()->run_event('rmcommon.loading.block.comments', $comments); $block['comments'] = $comments; $block['show_module'] = $options[1]; $block['show_name'] = $options[2]; $block['show_user'] = $options[3]; $block['show_date'] = $options[4]; $num = $options[2] + $options[3] + $options[4]; $block['data_width'] = floor(100 / $num); RMTemplate::get()->add_style('bk_comments.css', 'rmcommon'); return $block; }
/** * This function allows to insert a new block in database */ function insert_block() { global $xoopsSecurity; $mod = RMHttpRequest::post('module', 'string', ''); $id = RMHttpRequest::post('block', 'string', ''); $token = RMHttpRequest::post('XOOPS_TOKEN_REQUEST', 'string', ''); $canvas = RMHttpRequest::post('canvas', 'integer', 0); if (!$xoopsSecurity->check()) { response(__('Sorry, you are not allowed to view this page', 'rmcommon'), array(), 1, 0); } if ($mod == '' || $id == '') { response(__('The block specified seems to be invalid. Please try again.', 'rmcommon'), array(), 1, 0); } $module = RMModules::load_module($mod); if (!$module) { response(__('The specified module does not exists!', 'rmcommon'), array(), 1, 0); } $module->loadInfoAsVar($mod); $blocks = $module->getInfo('blocks'); $ms = $module->name() . '<br />'; $found = false; foreach ($blocks as $bk) { $str = isset($bk['show_func']) ? $bk['show_func'] : ''; $str .= isset($bk['edit_func']) ? $bk['edit_func'] : ''; $str .= isset($bk['dir']) ? $bk['dir'] : $mod; $idb = md5($str); if ($idb == $id) { $found = true; break; } } if (!$found) { response(__('The specified block does not exists, please verify your selection.', 'rmcommon'), array(), 1, 1); } $block = new RMInternalBlock(); if ($canvas <= 0) { $db = XoopsDatabaseFactory::getDatabaseConnection(); // Get a default side $sql = "SELECT id_position FROM " . $db->prefix("mod_rmcommon_blocks_positions") . " ORDER BY id_position LIMIT 0, 1"; $result = $db->query($sql); if ($result) { list($canvas) = $db->fetchRow($result); } else { $canvas = ''; } } $block->setReadGroups(array(0)); $block->setVar('name', $bk['name']); $block->setVar('element', $mod); $block->setVar('element_type', $bk['type'] == '' ? 'module' : ($bk['type'] == 'theme' || $bk['type'] == 'plugin' ? $bk['type'] : 'module')); $block->setVar('canvas', $canvas); $block->setVar('visible', 0); $block->setVar('type', $bk['type']); $block->setVar('isactive', 1); $block->setVar('dirname', isset($bk['dirname']) ? $bk['dirname'] : $mod); $block->setVar('file', $bk['file']); $block->setVar('show_func', $bk['show_func']); $block->setVar('edit_func', $bk['edit_func']); $block->setVar('description', $bk['description']); $block->setVar('widget', $id); $block->setVar('options', is_array($bk['options']) ? serialize($bk['options']) : serialize(explode("|", $bk['options']))); $block->setVar('template', $bk['template']); $block->sections(array(0)); if (!$block->save()) { response(__('Block could not be created. Please try again!', 'rmcommon'), array('error' => $block->errors()), 1, 1); } RMEvents::get()->run_event('rmcommon.block.added', $block); $pos = RMBlocksFunctions::block_positions(); $ret = array('id' => $block->id(), 'title' => $block->getVar('name'), 'module' => $block->getVar('element'), 'description' => $block->getVar('description'), 'canvas' => $pos[$canvas], 'weight' => $block->getVar('weight'), 'visible' => $block->getVar('visible')); response(sprintf(__('Block "%s" was added successfully! Please configure it.', 'rmcommon'), $block->getVar('name')), array('block' => $ret), 0, 1); die; }
} ?> </div> </div> <!-- End content //--> <!-- Footer --> <div class="container xo-footer"> <hr> <footer class="row"> <div class="col-md-6 col-lg-6"> <?php echo sprintf(__('Powered by %s.', 'rmcommon'), '<a href="http://www.xoops.org">' . XOOPS_VERSION . '</a>'); ?> <?php echo sprintf(__('Reloaded by %s.', 'rmcommon'), '<a href="http://www.xoopsmexico.net">' . RMModules::get_module_version('rmcommon', true) . '</a>'); ?> </div> <div class="col-md-6 col-lg-6 xo-foot-links"> <ul> <li><a href="http://www.xoops.org">XOOPS</a></li> <li><a href="http://www.xoopsmexico.net">Xoops Mexico</a></li> <li><a href="http://www.redmexico.com.mx">Red Mexico</a></li> </ul> </div> </footer> <hr> </div> <!-- End footer //--> <?php
/** * Return the feed options to show in RSS Center */ public function eventRmcommonGetFeedsList($feeds) { global $cuSettings; include_once XOOPS_ROOT_PATH . '/modules/mywords/class/mwfunctions.php'; load_mod_locale('mywords'); $module = RMModules::load_module('mywords'); $config = RMSettings::module_settings('mywords'); $data = array('title' => $module->name(), 'url' => XOOPS_URL . $config->basepath, 'module' => 'mywords'); $options[] = array('title' => __('All Recent Posts', 'mywords'), 'params' => 'show=all', 'description' => __('Show all recent posts', 'mywords')); $categories = array(); MWFunctions::categos_list($categories); $table = '<table cellpadding="2" cellspacing="2" width="100%"><tr class="even">'; $count = 0; $base_link = $cuSettings->permalinks ? XOOPS_URL . '/rss/' : XOOPS_URL . '/backend.php'; foreach ($categories as $cat) { if ($count >= 3) { $count = 0; $table .= '</tr><tr class="' . tpl_cycle("odd,even") . '">'; } $table .= '<td width="33%"><a href="' . $base_link . '?action=showfeed&mod=mywords&show=cat&cat=' . $cat['id_cat'] . '">' . $cat['name'] . '</a></td>'; $count++; } $table .= '</tr></table>'; $options[] = array('title' => __('Posts by category', 'mywords'), 'description' => __('Select a category to see the posts published recently.', 'mywords') . ' <a href="javascript:;" onclick="$(\'#categories-feed\').slideToggle(\'slow\');">Show Categories</a> <div id="categories-feed" style="padding: 10px; display: none;">' . $table . '</div>'); unset($categories); $tags = MWFunctions::get_tags("*", '', '', 99); $table = '<table cellpadding="2" cellspacing="2" width="100%"><tr class="even">'; $count = 0; foreach ($tags as $tag) { if ($count >= 3) { $count = 0; $table .= '</tr><tr class="' . tpl_cycle("odd,even") . '">'; } $table .= '<td width="33%"><a href="' . $base_link . '?action=showfeed&mod=mywords&show=tag&tag=' . $tag['id_tag'] . '">' . $tag['tag'] . '</a></td>'; $count++; } $table .= '</tr></table>'; $options[] = array('title' => __('Show posts by tag', 'mywords'), 'description' => __('Select a tag to see the posts published recently.', 'mywords') . ' <a href="javascript:;" onclick="$(\'#tags-feed\').slideToggle(\'slow\');">Show Tags</a> <div id="tags-feed" style="padding: 10px; display: none;">' . $table . '</div>'); unset($tags); $db = XoopsDatabaseFactory::getDatabaseConnection(); $sql = "SELECT * FROM " . $db->prefix("mod_mywords_editors") . " ORDER BY name"; $result = $db->query($sql); $editors = array(); while ($row = $db->fetchArray($result)) { $editors[] = $row; } asort($editors); $table = '<table cellpadding="2" cellspacing="2" width="100%"><tr class="even">'; $count = 0; foreach ($editors as $ed) { if ($count >= 3) { $count = 0; $table .= '</tr><tr class="' . tpl_cycle("odd,even") . '">'; } $table .= '<td width="33%"><a href="' . $base_link . '?action=showfeed&mod=mywords&show=author&author=' . $ed['id_editor'] . '">' . $ed['name'] . '</a></td>'; $count++; } $table .= '</tr></table>'; $options[] = array('title' => __('Show posts by author', 'mywords'), 'description' => __('Select an author to see the posts published recently.', 'mywords') . ' <a href="javascript:;" onclick="$(\'#editor-feed\').slideToggle(\'slow\');">Show Authors</a> <div id="editor-feed" style="padding: 10px; display: none;">' . $table . '</div>'); unset($editors); unset($table); RMTemplate::get()->add_jquery(); $feed = array('data' => $data, 'options' => $options); $feeds[] = $feed; return $feeds; }
<img class="module-icon" src="../<?php echo $module->getInfo('dirname'); ?> /<?php echo $module->getInfo('icon48') != '' ? $module->getInfo('icon48') : $module->getInfo('image'); ?> " alt="<?php echo $module->getInfo('name'); ?> "> <strong><?php echo $module->getInfo('name'); ?> </strong> <small><?php echo is_array($module->getInfo('rmversion')) ? RMModules::format_module_version($module->getInfo('rmversion')) : $module->getInfo('version'); ?> </small><br /> <span class="help-block"><small><?php echo $module->getInfo('description'); ?> </small></span> <a href="modules.php?action=install&dir=<?php echo $module->getInfo('dirname'); ?> " class="btn btn-warning btn-sm"><?php _e('Install', 'rmcommon'); ?> </a> </li> <?php
/** * See RMModules::get_modules_list * @deprecated */ public function get_modules_list($active = -1) { trigger_error(sprintf(__('Method %s is deprecated. Use %s::%s instead.', 'rmcommon'), __METHOD__, 'RMModules', 'get_modules_list')); $status = 'all'; if ($active == 0) { $status = 'inactive'; } elseif ($active == 1) { $status = 'active'; } return RMModules::get_modules_list($status); }
/** * Save module settings */ function save_module_settings() { global $xoopsSecurity, $xoopsDB; $mod = RMHttpRequest::post('mod', 'string', ''); $via_ajax = RMHttpRequest::post('via_ajax', 'integer', 0); if ($via_ajax) { $ajax = new AjaxResponse(); $ajax->prepare_ajax_response(); } if ($mod == '') { RMUris::redirect_with_message(__('A module has not been specified!', 'rmcommon'), 'settings.php', RMMSG_ERROR); } //echo RMHttpRequest::request('CUTOKEN_REQUEST', 'string', '') . ' ' . print_r($_SESSION['CUTOKEN_SESSION'], true); die(); if (!$xoopsSecurity->check(true, false, $via_ajax ? 'CUTOKEN' : 'XOOPS_TOKEN')) { if ($via_ajax) { $ajax->ajax_response(__('Session token expired. Please try again.', 'rmcommon'), 1, 0); } else { RMUris::redirect_with_message(__('Session token expired. Please try again.', 'rmcommon'), 'settings.php', RMMSG_WARN); } } $module = RMModules::load_module($mod); if (!$module) { if ($via_ajax) { $ajax->ajax_response(__('The specified module does not exists.', 'rmcommon'), 1, 1); } else { RMUris::redirect_with_message(__('The specified module does not exists.', 'rmcommon'), 'settings.php', RMMSG_ERROR); } } $current_settings = (array) RMSettings::module_settings($module->getVar('dirname')); $new_settings = RMHttpRequest::post(ucfirst($module->getVar('dirname')), 'array', array()); $configs = $module->getInfo('config'); $fields = array(); // Container for all fields and values foreach ($configs as $option) { $id = $option['name']; $field = new stdClass(); $field->id = $id; $field->value = isset($values->{$id}) ? $values->{$id} : $option['default']; $field->caption = defined($option['title']) ? constant($option['title']) : $option['title']; $field->description = defined($option['description']) ? constant($option['description']) : $option['description']; $field->field = $option['formtype']; $field->type = $option['valuetype']; $field->options = isset($option['options']) ? $option['options'] : null; $category = isset($option['category']) ? $option['category'] : 'all'; $fields[$id] = $field; } /** * This keys already exists in database */ $to_save = array_intersect_key($new_settings, $current_settings); /** * This settings will be added to database beacause don't exists in table */ $to_add = array_diff_key($new_settings, $current_settings); /** * This keys has been removed from xoops_version.php file and then * must be removed from table */ $to_delete = array_diff_key($current_settings, $new_settings); $errors = ''; // Errors ocurred while saving /** * First for all, remove unused items */ $keys = array_keys($to_delete); if (!empty($keys)) { $sql = "DELETE FROM " . $xoopsDB->prefix("config") . " WHERE conf_modid = " . $module->mid() . " AND (conf_name = '" . implode("' OR conf_name='", $keys) . "')"; if (!$xoopsDB->queryF($sql)) { $errors .= $xoopsDB->error() . '<br>'; } } /** * Save existing items */ if (!empty($to_save)) { foreach ($to_save as $name => $value) { $item = new Rmcommon_Config_Item($name, $module->mid()); if (isset($fields[$name])) { $item->setVar('conf_valuetype', $fields[$name]->type); $item->setVar('conf_title', $fields[$name]->caption); $item->setVar('conf_desc', $fields[$name]->description); $item->setVar('conf_formtype', $fields[$name]->field); } $item->set_value($value, $item->getVar('conf_valuetype')); $item->save(); } } /** * Add new items */ if (!empty($to_add)) { foreach ($to_add as $name => $value) { $item = new Rmcommon_Config_Item($name, $module->mid()); if (isset($fields[$name])) { $item->setVar('conf_modid', $module->mid()); $item->setVar('conf_name', $name); $item->setVar('conf_valuetype', $fields[$name]->type); $item->setVar('conf_title', $fields[$name]->caption); $item->setVar('conf_desc', $fields[$name]->description); $item->setVar('conf_formtype', $fields[$name]->field); } $item->set_value($value, $item->getVar('conf_valuetype')); $item->save(); } } /** * Notify to system events */ RMEvents::get()->trigger('rmcommon.saved.settings', $module->dirname(), $to_save, $to_add, $to_delete); if ($module->getInfo('hasAdmin')) { $goto = XOOPS_URL . '/modules/' . $module->getVar('dirname') . '/' . $module->getInfo('adminindex'); } else { $goto = 'settings.php'; } if ($via_ajax) { $ajax->ajax_response(__('Settings saved successfully!', 'rmcommon'), 0, 1, array('closeWindow' => '#cu-settings-form', 'notify' => array('icon' => 'svg-rmcommon-ok-circle', 'type' => 'alert-success'))); } else { RMUris::redirect_with_message(__('Settings saved successfully!', 'rmcommon'), $goto, RMMSG_SUCCESS, 'fa fa-check'); } }
<td><a href="<?php echo XOOPS_URL; ?> /modules/mywords/admin/tags.php"><?php _e('Tags', 'mywords'); ?> </a></td> </tr> </table><br /> </div> <div class="box-footer"> <?php _e('Current version:', 'mywords'); ?> <strong><?php echo RMModules::format_module_version($xoopsModule->getInfo('rmversion')); ?> </strong> </div> </div> <!-- / End quick overview --> </div> <div class="size-1" data-dashboard="item"> <!-- Drafts --> <div class="cu-box"> <div class="box-header"> <span class="fa fa-caret-up box-handler"></span> <h3 class="box-title"><?php _e('Recent Drafts', 'admin_mywords');
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; }
/** * is module or plugin installed? * @paramn string Directory name of module or plugin * @param string type can be 'module' or 'plugin' * @return bool */ public function installed($dirname, $type) { $rmf = new RMFunctions(); if ($type == 'plugin') { return $rmf->plugin_installed($dirname); } else { $mod = RMModules::load_module($dirname); if ($mod->isNew()) { return false; } else { return true; } } }
/** * Format a module version. * Use RMModules::format_module_version() instead * @deprecated * @param $version * @param bool $name * @return string */ public function format_version($version, $name = false) { trigger_error(sprintf(__('Method %s is deprecated. Use %s::%s instead.', 'rmcommon'), __METHOD__, 'RMModules', 'format_module_version'), E_USER_DEPRECATED); return RMModules::format_module_version($version, $name); }
public static function read_permissions($directory, $group) { global $xoopsDB; if ($directory == '') { return false; } $module = RMModules::load_module($directory); if (!$module) { return false; } // Permissions on DB $sql = "SELECT * FROM " . $xoopsDB->prefix("mod_rmcommon_permissions") . " WHERE\n `group` = {$group} AND element='{$directory}'"; $result = $xoopsDB->query($sql); $permissions = new stdClass(); while ($row = $xoopsDB->fetchArray($result)) { $permissions->{$row}['key'] = 1; } return $permissions; }
$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/twop6/images/modules/'.$mod->dirname().'.png'; $modules[] = array('id' => $mod->getVar('mid'), 'name' => $mod->getVar('name'), 'realname' => $mod->getInfo('name'), 'version' => $mod->getInfo('rmnative') ? RMModules::format_module_version($mod->getInfo('rmversion')) : $mod->getInfo('version'), 'description' => $mod->getInfo('description'), 'image' => XOOPS_URL . '/modules/' . $mod->getVar('dirname') . '/' . $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'; foreach ($modules as $mod) { ?> <a rel="tooltip" href="<?php echo $mod['admin_link']; ?> " title="<?php echo $mod['name']; ?> "> <img src="<?php echo $mod['image'];
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(); }
?> <?php echo $module->getInfo('name'); ?> <?php } ?> </td> </tr> <tr class="odd"> <td><strong><?php _e('Version:', 'rmcommon'); ?> </strong> <td><?php echo $module->getInfo('rmnative') ? RMModules::format_module_version($module->getInfo('rmversion')) : $module->getInfo('version'); ?> </td> </tr> <tr class="even"> <td><strong><?php _e('Author:', 'rmcommon'); ?> </strong></td> <td colspan="2"> <?php if ($module->getInfo('authorurl')) { ?> <a href="<?php echo $module->getInfo('authorurl'); ?>
function show_rm_blocks() { global $xoopsModule, $xoopsConfig, $wid_globals, $xoopsSecurity, $rmc_config, $rmTpl; define('RMCSUBLOCATION', 'blocks'); $db = XoopsDatabaseFactory::getDatabaseConnection(); $modules = RMModules::get_modules_list('active'); $from = rmc_server_var($_GET, 'from', ''); // ** API Event ** // Allows other methods to add o modify the list of available widgets $modules = RMEvents::get()->run_event('rmcommon.blocks.modules', $modules); // Cargamos los grupos $sql = "SELECT groupid, name FROM " . $db->prefix("groups") . " ORDER BY name"; $result = $db->query($sql); $groups = array(); while ($row = $db->fetchArray($result)) { $groups[] = array('id' => $row['groupid'], 'name' => $row['name']); } // Cargamos las posiciones de bloques $bpos = RMBlocksFunctions::block_positions(); $sql = createSQL(); $result = $db->query($sql); $blocks = array(); $used_blocks = array(); while ($row = $db->fetchArray($result)) { $mod = RMModules::load_module($row['element']); if (!$mod) { continue; } $used_blocks[$row['canvas']][] = array('id' => $row['bid'], 'title' => $row['name'], 'module' => array('id' => $mod->mid(), 'dir' => $mod->dirname(), 'name' => $mod->name(), 'icon' => RMModules::icon($mod->dirname(), 16)), 'canvas' => isset($bpos[$row['canvas']]) ? $bpos[$row['canvas']] : array(), 'weight' => $row['weight'], 'visible' => $row['visible'], 'active' => $row['isactive'], 'type' => $row['type'], 'options' => $row['edit_func'] != '' ? 1 : 0, 'description' => $row['description']); } // ** API ** // Event for manege the used widgets list $used_blocks = RMEvents::get()->run_event('rmcommon.used.blocks.list', $used_blocks); $positions = array(); foreach ($bpos as $row) { $positions[] = array('id' => $row['id_position'], 'name' => $row['name'], 'tag' => $row['tag'], 'active' => $row['active']); } $positions = RMEvents::get()->run_event('rmcommon.block.positions.list', $positions); RMTemplate::get()->add_script('jquery.nestable.js', 'rmcommon', array('directory' => 'include')); RMBreadCrumb::get()->add_crumb(__('Blocks Management', 'rmcommon')); $rmTpl->assign('xoops_pagetitle', __('Blocks Management', 'rmcommon')); RMTemplate::get()->add_style('blocks.css', 'rmcommon'); RMTemplate::get()->add_script('blocks.js', 'rmcommon'); RMTemplate::get()->add_script('jkmenu.js', 'rmcommon'); RMTemplate::get()->add_style('forms.css', 'rmcommon'); RMTemplate::get()->add_script('jquery-ui.min.js', 'rmcommon', array('directory' => 'include')); if (!$rmc_config['blocks_enable']) { showMessage(__('Internal blocks manager is currenlty disabled!', 'rmcommon'), RMMSG_WARN); } RMTemplate::get()->add_script('jquery.checkboxes.js', 'rmcommon'); //include RMCPATH . '/js/cu-js-language.php'; xoops_cp_header(); // Available Widgets $blocks = RMBlocksFunctions::get_available_list($modules); foreach ($blocks as $id => $block) { if (empty($block['blocks'])) { continue; } foreach ($block['blocks'] as $bid => $val) { $str = isset($val['show_func']) ? $val['show_func'] : ''; $str .= isset($val['edit_func']) ? $val['edit_func'] : ''; $str .= isset($val['dir']) ? $val['dir'] : $id; $val['id'] = md5($str); $blocks[$id]['blocks'][$bid] = $val; } } // Position $the_position = isset($_GET['pos']) ? intval($_GET['pos']) : ''; // Parameters $mid = rmc_server_var($_GET, 'mid', 0); $subpage = isset($_GET['subpage']) ? $_GET['subpage'] : ''; $group = isset($_GET['group']) ? intval($_GET['group']) : 0; $visible = rmc_server_var($_GET, 'visible', -1); $pid = rmc_server_var($_GET, 'pos', 0); include RMTemplate::get()->get_template("rmc-blocks.php", 'module', 'rmcommon'); xoops_cp_footer(); }
function render() { $module_handler =& xoops_gethandler('module'); $criteria = new CriteriaCompo(new Criteria('hasmain', 1)); $criteria->add(new Criteria('isactive', 1)); if ($this->subpages) { $criteria->add(new Criteria('dirname', 'system'), 'OR'); } $modules = array(); $modules[-1] = __('All', 'rmcommon'); if (is_array($this->inserted)) { $modules = $this->inserted; } foreach ($module_handler->getList($criteria, $this->dirnames) as $k => $v) { $modules[$k] = $v; } if ($this->type) { // Add js script RMTemplate::get()->add_script('modules_field.js', 'rmcommon', array('directory' => 'include')); $pagesOptions = array(); $rtn = '<div class="modules-field" id="modules-field-' . $this->getName() . '"> <div> <h4>' . __('Available Modules', 'rmcommon') . '</h4> <ul>'; $i = 1; foreach ($modules as $k => $v) { $app = RMModules::load_module($k); $rtn .= "<li>"; $name = $this->multi ? $this->getName() . "[{$k}]" : $this->getName(); if ($this->multi) { $rtn .= "<input type='checkbox' value='{$k}'" . ($k == 0 ? "\n\t\t\t data-checkbox='module-item'" : " data-oncheck='module-item'") . "\n\t\t\t name='" . $name . "'\n\t\t\t id='" . $this->id() . "-{$k}'" . (is_array($this->selected) ? in_array($k, $this->selected) ? " checked='checked'" : '' : '') . ($k != -1 ? " data-checkbox='module-item-" . $k . "'" : '') . "> "; if ($this->subpages) { $rtn .= '<a href="#">' . $v . '</a>'; } else { $rtn .= $v; } } else { $rtn .= "<input type='radio' value='{$k}' name='" . $this->getName() . "' id='" . $this->id() . "-{$k}'" . (!empty($this->selected) ? $k == $this->selected ? " checked='checked'" : '' : '') . " /> {$v}"; } /** * Mostramos las subpáginas */ if ($this->subpages && $k > 0) { if ($app->dirname() == 'system') { $subpages = array('home-page' => __('Home Page', 'rmcommon'), 'user' => __('User page', 'dtransport'), 'profile' => __('User profile page', 'rmcommon'), 'register' => __('Users registration', 'rmcommon'), 'edit-user' => __('Edit user', 'rmcommon'), 'readpm' => __('Read PM', 'rmcommon'), 'pm' => __('Private messages', 'rmcomon')); } else { $subpages = $app->getInfo('subpages'); } if (!empty($subpages)) { $selected = $this->selectedSubPages; $cr = 0; $rtns = "<ul class=\"subpages-container subpages-" . $k . "\" data-module=\"" . $k . "\">"; $j = 2; $cr = 2; if (!is_array($subpages)) { $subpages = array(); } foreach ($subpages as $page => $caption) { $rtns .= "<li><input type='checkbox' data-oncheck='module-item-" . $k . "' name='" . $name . "[subpages][{$page}]' id='subpages[{$k}][{$page}]' value='{$page}'" . (is_array($subpages) && @in_array($page, $selected[$k]) ? " checked='checked'" : '') . " /> {$caption}</li>"; $j++; $cr++; } $rtns .= '</ul>'; $pagesOptions[] = $rtns; $rtns = ''; } } $rtn .= "</li>"; $i++; } $rtn .= "</ul>\n\t\t </div>"; if ($this->subpages) { $rtn .= '<div><h4>' . __('Inner Pages', 'rmcommon') . '</h4>'; foreach ($pagesOptions as $page) { $rtn .= $page; } $rtn .= '</div>'; } $rtn .= "</div>"; } else { if ($this->multi) { $name = $this->getName() . "[{$k}]"; $rtn = "<select name='" . $name . "' id='" . $this->id() . "' size='{$this->cols}' multiple='multiple'>"; foreach ($modules as $k => $v) { $rtn .= "<option value='{$k}'" . (is_array($this->selected) ? in_array($k, $this->selected) ? " selected='selected'" : '' : '') . ">{$v}</option>"; } $rtn .= "</select>"; } else { $rtn = "<select name='" . $this->getName() . "' id='" . $this->getName() . "'>"; foreach ($modules as $k => $v) { $rtn .= "<option value='{$k}'" . (!empty($this->selected) ? $k == $this->selected ? " selected='selected'" : '' : '') . ">{$v}</option>"; } $rtn .= "</select>"; } } return $rtn; }
?> </a> <?php } ?> </span> </td> <td> <span class="descriptions"><?php echo $plugin->get_info('description'); ?> </span> </td> <td align="center"> <strong><?php echo is_array($plugin->get_info('version')) ? RMModules::format_module_version($plugin->get_info('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
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); }
/** * Get the module icon */ public function moduleIcon($module, $size = '16') { global $xoopsModule; $available = array('mylinks' => 'fa fa-link', 'news' => 'xicon-consulting', 'extgallery' => 'xicon-picture', 'date' => 'xicon-date', 'fmcontent' => 'xicon-library', 'marquee' => 'xicon-advertising', 'mastop_go2' => 'xicon-cloud', 'moduleinstaller' => 'xicon-download', 'pm' => 'xicon-comment', 'profile' => 'xicon-profile', 'protector' => 'xicon-shield', 'tag' => 'xicon-tag', 'xforms' => 'xicon-form', 'xlanguage' => 'xicon-comment', 'xoopsfaq' => 'xicon-faq', 'xoopspartners' => 'xicon-me', 'system' => 'xicon-gear'); if (!is_a($xoopsModule, 'XoopsModule')) { return false; } if ($xoopsModule->dirname() != $module) { $mod = RMModules::load_module($module); } else { $mod = $xoopsModule; } if (isset($available[$mod->dirname()])) { return '<i class="xo-icon ' . $available[$mod->dirname()] . '"></i> '; } $icon = $mod->getInfo('icon' . $size); $path = XOOPS_ROOT_PATH . '/modules/' . $mod->dirname() . '/' . $icon; if (!is_file($path)) { $path = TWOP6_PATH . '/images/modules/' . $mod->dirname() . '-' . $size . '.png'; if (!is_file($path)) { $path = TWOP6_PATH . '/images/module.png'; } } $icon = str_replace(XOOPS_ROOT_PATH, XOOPS_URL, $path); return '<i class="xo-icon" style="background-image: url(' . $icon . ');"></i> '; }
<?php /** * $Id$ * -------------------------------------------------------------- * Common Utilities * Author: Eduardo Cortes * Email: i.bitcero@gmail.com * License: GPL 2.0 * URI: http://www.redmexico.com.mx */ require dirname(dirname(dirname(dirname(__FILE__)))) . '/include/cp_header.php'; $ajax = new Rmcommon_Ajax(); $ajax->prepare_ajax_response(); $dirname = RMHttpRequest::get('module', 'string', ''); if ($dirname == '') { $ajax->ajax_response(__('Please specify a valid module dirname!', 'rmcommon'), 1, 0); } $module = RMModules::load_module($dirname); if (!$module) { $ajax->ajax_response(__('Specified module is not installed!', 'rmcommon'), 1, 0); } $url = $module->getInfo('updateurl'); $url .= false === strpos($url, '?') ? '?' : '&'; $url .= 'action=data&id=' . $module->dirname(); echo file_get_contents($url);