Exemple #1
0
function show_modules_list()
{
    global $xoopsSecurity;
    $installed_modules = array();
    $limit = rmc_server_var($_SESSION, 'mods_limit', 4);
    include_once XOOPS_ROOT_PATH . '/kernel/module.php';
    $db = XoopsDatabaseFactory::getDatabaseConnection();
    $sql = "SELECT * FROM " . $db->prefix("modules") . " ORDER BY `name`";
    $result = $db->query($sql);
    $installed_dirs = array();
    while ($row = $db->fetchArray($result)) {
        $mod = new XoopsModule();
        $mod->assignVars($row);
        $installed_dirs[] = $mod->dirname();
        if (file_exists(XOOPS_ROOT_PATH . '/modules/' . $mod->getVar('dirname') . '/class/' . strtolower($mod->getVar('dirname') . 'controller') . '.php')) {
            include_once XOOPS_ROOT_PATH . '/modules/' . $mod->getVar('dirname') . '/class/' . strtolower($mod->getVar('dirname') . 'controller') . '.php';
            $class = ucfirst($mod->getVar('dirname')) . 'Controller';
            $class = new $class();
            if (method_exists($class, 'get_main_link')) {
                $main_link = $class->get_main_link();
            } else {
                if ($mod->getVar('hasmain')) {
                    $main_link = XOOPS_URL . '/modules/' . $mod->dirname();
                } else {
                    $main_link = "#";
                }
            }
        } else {
            if ($mod->getVar('hasmain')) {
                $main_link = XOOPS_URL . '/modules/' . $mod->dirname();
            } else {
                $main_link = "#";
            }
        }
        // Admin section
        $admin_link = $mod->getVar('hasadmin') ? XOOPS_URL . '/modules/' . $mod->dirname() . '/' . $mod->getInfo('adminindex') : '';
        $modules[] = array('id' => $mod->getVar('mid'), 'name' => $mod->getVar('name'), 'realname' => $mod->getInfo('name'), 'version' => $mod->getInfo('rmnative') ? RMUtilities::format_version($mod->getInfo('rmversion')) : $mod->getInfo('version'), 'description' => $mod->getInfo('description'), 'icon' => XOOPS_URL . '/modules/' . $mod->getVar('dirname') . '/' . ($mod->getInfo('icon48') ? $mod->getInfo('icon48') : $mod->getInfo('image')), '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'), 'help' => $mod->getInfo('help'));
    }
    // Event for installed modules
    $modules = RMEvents::get()->run_event('rmcommon.installed.modules', $modules, $installed_dirs);
    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);
        }
    }
    // Event for available modules
    $available_mods = RMEvents::get()->run_event('rmcommon.available.modules', $available_mods);
    $GLOBALS['available_mods'] = $available_mods;
    RMFunctions::create_toolbar();
    RMTemplate::get()->assign('xoops_pagetitle', __('Modules Management', 'rmcommon'));
    RMTemplate::get()->add_style('modules.css', 'rmcommon');
    RMTemplate::get()->add_local_script('modules.js', 'rmcommon', 'include');
    RMTemplate::get()->set_help('http://www.redmexico.com.mx/docs/common-utilities/uso-de-common-utilities/standalone/1/#administrador-de-modulos');
    xoops_cp_header();
    include RMTemplate::get()->get_template('rmc_modules.php', 'module', 'rmcommon');
    xoops_cp_footer();
}
Exemple #2
0
require dirname(dirname(dirname(dirname(dirname(dirname(__FILE__)))))) . '/mainfile.php';
$xoopsLogger->renderingEnabled = false;
$xoopsLogger->activated = false;
/*if (!$xoopsSecurity->check()) {
    die('Session token expired');
}*/
$installed_modules = array();
include_once XOOPS_ROOT_PATH . '/kernel/module.php';
$db = XoopsDatabaseFactory::getDatabaseConnection();
$sql = "SELECT * FROM " . $db->prefix("modules") . " WHERE isactive='1' ORDER BY `name`";
$result = $db->query($sql);
$installed_dirs = array();
while ($row = $db->fetchArray($result)) {
    $mod = new XoopsModule();
    $mod->assignVars($row);
    $installed_dirs[] = $mod->dirname();
    if (file_exists(XOOPS_ROOT_PATH . '/modules/' . $mod->getVar('dirname') . '/class/' . strtolower($mod->getVar('dirname') . 'controller') . '.php')) {
        include_once XOOPS_ROOT_PATH . '/modules/' . $mod->getVar('dirname') . '/class/' . strtolower($mod->getVar('dirname') . 'controller') . '.php';
        $class = ucfirst($mod->getVar('dirname')) . 'Controller';
        $class = new $class();
        if (method_exists($class, 'get_main_link')) {
            $main_link = $class->get_main_link();
        } else {
            if ($mod->getVar('hasmain')) {
                $main_link = XOOPS_URL . '/modules/' . $mod->dirname();
            } else {
                $main_link = "#";
            }
        }
    } else {
        if ($mod->getVar('hasmain')) {
Exemple #3
0
$xoopsLogger->renderingEnabled = false;
$xoopsLogger->activated = false;

if(!$xoopsSecurity->check()){
    die('Session token expired');    
}*/
$installed_modules = array();
include_once XOOPS_ROOT_PATH . '/kernel/module.php';
$db = XoopsDatabaseFactory::getDatabaseConnection();
$sql = "SELECT * FROM " . $db->prefix("modules") . " WHERE isactive='1' ORDER BY `name`";
$result = $db->query($sql);
$installed_dirs = array();
while ($row = $db->fetchArray($result)) {
    $mod = new XoopsModule();
    $mod->assignVars($row);
    $installed_dirs[] = $mod->dirname();
    if (file_exists(XOOPS_ROOT_PATH . '/modules/' . $mod->getVar('dirname') . '/class/' . strtolower($mod->getVar('dirname') . 'controller') . '.php')) {
        include_once XOOPS_ROOT_PATH . '/modules/' . $mod->getVar('dirname') . '/class/' . strtolower($mod->getVar('dirname') . 'controller') . '.php';
        $class = ucfirst($mod->getVar('dirname')) . 'Controller';
        $class = new $class();
        if (method_exists($class, 'get_main_link')) {
            $main_link = $class->get_main_link();
        } else {
            if ($mod->getVar('hasmain')) {
                $main_link = XOOPS_URL . '/modules/' . $mod->dirname();
            } else {
                $main_link = "#";
            }
        }
    } else {
        if ($mod->getVar('hasmain')) {
Exemple #4
0
$urls = array();
$modNames = array();
/**
 * Load existing modules and fetch data to request remote server information
 */
while ($row = $xoopsDB->fetchArray($result)) {
    $mod = new XoopsModule();
    $mod->assignVars($row);
    $info = $mod->getInfo();
    if (!isset($info['rmversion'])) {
        continue;
    }
    if (!isset($info['updateurl'])) {
        continue;
    }
    $modNames[$mod->dirname()] = $info['name'];
    $v = $info['rmversion'];
    if (isset($v['major'])) {
        $version = $v['major'] . '.' . $v['minor'] . '.' . $v['revision'] . '.' . $v['stage'];
    } else {
        $version = $v['number'] . '.' . $v['revision'] / 10 . '.' . $v['status'];
    }
    $urls[$mod->dirname()] = $info['updateurl'] . (strpos($info['updateurl'], '?') === false ? '?' : '&') . 'action=check&id=' . $mod->dirname() . '&version=' . $version;
}
/**
 * Load remote information and fetch it
 * for each module
 */
$total = 0;
$upds = array();
foreach ($urls as $dir => $url) {