protected function execute(InputInterface $input, OutputInterface $output) { $module = $input->getArgument('module'); $output->writeln(sprintf('Uninstalling %s', $module)); $xoops = \Xoops::getInstance(); if (false === $xoops->getModuleByDirname($module)) { $output->writeln(sprintf('<error>%s is not an installed module!</error>', $module)); return; } $xoops->setTpl(new \XoopsTpl()); \XoopsLoad::load('module', 'system'); $sysmod = new \SystemModule(); $result = $sysmod->uninstall($module); foreach ($sysmod->trace as $message) { if (is_array($message)) { foreach ($message as $subMessage) { if (!is_array($subMessage)) { $output->writeln(strip_tags($subMessage)); } } } else { $output->writeln(strip_tags($message)); } } if ($result === false) { $output->writeln(sprintf('<error>Uninstall of %s failed!</error>', $module)); } else { $output->writeln(sprintf('<info>Uninstall of %s completed.</info>', $module)); } $xoops->cache()->delete('system'); }
/** * execute the command * * @param InputInterface $input input handler * @param OutputInterface $output output handler * @return void */ protected function execute(InputInterface $input, OutputInterface $output) { $xoops = \Xoops::getInstance(); $module = $input->getArgument('module'); if (false === \XoopsLoad::fileExists($xoops->path("modules/{$module}/xoops_version.php"))) { $output->writeln(sprintf('<error>No module named %s found!</error>', $module)); return; } $output->writeln(sprintf('Installing %s', $module)); if (false !== $xoops->getModuleByDirname($module)) { $output->writeln(sprintf('<error>%s module is already installed!</error>', $module)); return; } $xoops->setTpl(new XoopsTpl()); \XoopsLoad::load('module', 'system'); $sysmod = new \SystemModule(); $result = $sysmod->install($module); foreach ($sysmod->trace as $message) { if (is_array($message)) { foreach ($message as $subMessage) { if (!is_array($subMessage)) { $output->writeln(strip_tags($subMessage)); } } } else { $output->writeln(strip_tags($message)); } } if ($result === false) { $output->writeln(sprintf('<error>Install of %s failed!</error>', $module)); } else { $output->writeln(sprintf('<info>Install of %s completed.</info>', $module)); } $xoops->cache()->delete('system'); }
protected function _getGuestSystemModules() { if (is_null($this->_systemModules)) { $this->_systemModules = SystemModule::model()->with(array('guestSystemModules' => array('joinType' => 'INNER JOIN')))->findAll(array('condition' => 'type="user"', 'order' => 'position DESC')); } return $this->_systemModules; }
function b_system_main_edit($options) { $xoops = Xoops::getInstance(); $system = System::getInstance(); $system_module = new SystemModule(); $admin_page = new \Xoops\Module\Admin(); // Define Stylesheet $xoops->theme()->addStylesheet('media/xoops/css/icons.css'); $xoops->theme()->addStylesheet('modules/system/css/admin.css'); // Define scripts $xoops->theme()->addScript('media/jquery/plugins/jquery.jeditable.js'); $xoops->theme()->addScript('modules/system/js/module.js'); $admin_page->addTips(SystemLocale::MENU_TIPS); $admin_page->renderTips(); $list = $system_module->getModuleList(); $xoops->tpl()->assign('modules_list', $list); return $xoops->tpl()->fetch('admin:system/system_modules_menu.tpl'); }
/** * execute the command * * @param InputInterface $input input handler * @param OutputInterface $output output handler * @return void */ protected function execute(InputInterface $input, OutputInterface $output) { // install the 'system' module $xoops = \Xoops::getInstance(); $module = 'system'; $output->writeln(sprintf('Installing %s', $module)); if (false !== $xoops->getModuleByDirname($module)) { $output->writeln(sprintf('<error>%s module is alreay installed!</error>', $module)); return; } $xoops->setTpl(new \XoopsTpl()); \XoopsLoad::load('module', 'system'); $sysmod = new \SystemModule(); $result = $sysmod->install($module); foreach ($sysmod->trace as $message) { if (is_array($message)) { foreach ($message as $subMessage) { if (!is_array($subMessage)) { $output->writeln(strip_tags($subMessage)); } } } else { $output->writeln(strip_tags($message)); } } if ($result === false) { $output->writeln(sprintf('<error>Install of %s module failed!</error>', $module)); } else { $output->writeln(sprintf('<info>Install of %s module completed.</info>', $module)); } $xoops->cache()->delete('system'); // add an admin user $adminname = 'admin'; $adminpass = password_hash($adminname, PASSWORD_DEFAULT); // user: admin pass: admin $regdate = time(); $result = $xoops->db()->insertPrefix('system_user', array('uname' => $adminname, 'email' => 'nobody@localhost', 'user_regdate' => $regdate, 'user_viewemail' => 1, 'pass' => $adminpass, 'rank' => 7, 'level' => 5, 'last_login' => $regdate)); $output->writeln(sprintf('<info>Inserted %d user.</info>', $result)); }
function header() { $xoops = Xoops::getInstance(); $xoops->loadLocale('system'); $xoops->theme()->addBaseStylesheetAssets('@jqueryuicss'); $xoops->theme()->addStylesheet('media/xoops/css/moduladmin.css'); $xoops->theme()->addStylesheet(\XoopsBaseConfig::get('adminthemes-url') . '/default/css/style.css'); $xoops->theme()->addBaseScriptAssets('@jquery'); // bootstrap has to come before jquery.ui or dialog close buttons are blank $xoops->theme()->addBaseScriptAssets('@bootstrap'); $xoops->theme()->addBaseScriptAssets('@jqueryui'); $xoops->theme()->addBaseScriptAssets('@jgrowl'); // ddsmoothmenu $xoops->theme()->addScript(\XoopsBaseConfig::get('adminthemes-url') . '/default/js/ddsmoothmenu.js'); $xoops->theme()->addScript(\XoopsBaseConfig::get('adminthemes-url') . '/default/js/tooltip.js'); $quick = array(); $quick[] = array('title' => SystemLocale::CONTROL_PANEL, 'link' => \XoopsBaseConfig::get('url') . '/admin.php'); $quick[] = array('title' => XoopsLocale::HOME_PAGE, 'link' => \XoopsBaseConfig::get('url')); $quick[] = array('title' => DefaultThemeLocale::XOOPS_NEWS, 'link' => \XoopsBaseConfig::get('url') . '/admin.php?xoopsorgnews=1'); $quick[] = array('title' => 'separator'); $quick[] = array('title' => XoopsLocale::A_LOGOUT, 'link' => \XoopsBaseConfig::get('url') . '/user.php?op=logout'); $xoops->tpl()->assign('quick_menu', $quick); XoopsLoad::load('module', 'system'); XoopsLoad::load('extension', 'system'); $system_module = new SystemModule(); $system_extension = new SystemExtension(); $adminmenu = null; include __DIR__ . '/menu.php'; if (!$xoops->isModule() || 'system' == $xoops->module->getVar('dirname', 'n')) { $modpath = \XoopsBaseConfig::get('url') . '/admin.php'; $modname = DefaultThemeLocale::SYSTEM_OPTIONS; $modid = 1; $moddir = 'system'; $mod_options = $adminmenu; foreach (array_keys($mod_options) as $item) { $mod_options[$item]['link'] = empty($mod_options[$item]['absolute']) ? \XoopsBaseConfig::get('url') . '/modules/' . $moddir . '/' . $mod_options[$item]['link'] : $mod_options[$item]['link']; $mod_options[$item]['icon'] = empty($mod_options[$item]['icon']) ? '' : \XoopsBaseConfig::get('adminthemes-url') . '/default/' . $mod_options[$item]['icon']; unset($mod_options[$item]['icon_small']); } } else { $moddir = $xoops->module->getVar('dirname', 'n'); $modpath = \XoopsBaseConfig::get('url') . '/modules/' . $moddir; $modname = $xoops->module->getVar('name'); $modid = $xoops->module->getVar('mid'); $mod_options = $xoops->module->getAdminMenu(); foreach (array_keys($mod_options) as $item) { $mod_options[$item]['link'] = empty($mod_options[$item]['absolute']) ? \XoopsBaseConfig::get('url') . "/modules/{$moddir}/" . $mod_options[$item]['link'] : $mod_options[$item]['link']; if (XoopsLoad::fileExists($xoops->path("/media/xoops/images/icons/32/" . $mod_options[$item]['icon']))) { $mod_options[$item]['icon'] = $xoops->url("/media/xoops/images/icons/32/" . $mod_options[$item]['icon']); } else { $mod_options[$item]['icon'] = $xoops->url("/modules/" . $xoops->module->dirname() . "/icons/32/" . $mod_options[$item]['icon']); } } } $xoops->tpl()->assign('mod_options', $mod_options); $xoops->tpl()->assign('modpath', $modpath); $xoops->tpl()->assign('modname', $modname); $xoops->tpl()->assign('modid', $modid); $xoops->tpl()->assign('moddir', $moddir); // Modules list $module_list = $system_module->getModuleList(); $xoops->tpl()->assign('module_menu', $module_list); unset($module_list); // Extensions list $extension_list = $system_extension->getExtensionList(); $xoops->tpl()->assign('extension_menu', $extension_list); unset($extension_list); $extension_mod = $system_extension->getExtension($moddir); $xoops->tpl()->assign('extension_mod', $extension_mod); // add preferences menu $menu = array(); $OPT = array(); $menu[] = array('link' => \XoopsBaseConfig::get('url') . '/modules/system/admin.php?fct=preferences', 'title' => XoopsLocale::PREFERENCES, 'absolute' => 1, 'url' => \XoopsBaseConfig::get('url') . '/modules/system/', 'options' => $OPT); $menu[] = array('title' => 'separator'); // Module adminmenu if ($xoops->isModule() && $xoops->module->getVar('dirname') != 'system') { if ($xoops->module->getInfo('system_menu')) { //$xoops->theme()->addStylesheet('modules/system/css/menu.css'); $xoops->module->loadAdminMenu(); // Get menu tab handler /* @var $menu_handler SystemMenuHandler */ $menu_handler = $xoops->getModuleHandler('menu', 'system'); // Define top navigation $menu_handler->addMenuTop(\XoopsBaseConfig::get('url') . "/modules/system/admin.php?fct=preferences&op=showmod&mod=" . $xoops->module->getVar('mid', 'e'), XoopsLocale::PREFERENCES); if ($xoops->module->getInfo('extension')) { $menu_handler->addMenuTop(\XoopsBaseConfig::get('url') . "/modules/system/admin.php?fct=extensions&op=update&module=" . $xoops->module->getVar('dirname', 'e'), XoopsLocale::A_UPDATE); } else { $menu_handler->addMenuTop(\XoopsBaseConfig::get('url') . "/modules/system/admin.php?fct=modulesadmin&op=update&module=" . $xoops->module->getVar('dirname', 'e'), XoopsLocale::A_UPDATE); } if ($xoops->module->getInfo('blocks')) { $menu_handler->addMenuTop(\XoopsBaseConfig::get('url') . "/modules/system/admin.php?fct=blocksadmin&op=list&filter=1&selgen=" . $xoops->module->getVar('mid', 'e') . "&selmod=-2&selgrp=-1&selvis=-1", XoopsLocale::BLOCKS); } if ($xoops->module->getInfo('hasMain')) { $menu_handler->addMenuTop(\XoopsBaseConfig::get('url') . "/modules/" . $xoops->module->getVar('dirname', 'e') . "/", SystemLocale::GO_TO_MODULE); } // Define main tab navigation $i = 0; $current = $i; foreach ($xoops->module->adminmenu as $menu) { if (stripos($_SERVER['REQUEST_URI'], $menu['link']) !== false) { $current = $i; } $menu_handler->addMenuTabs($xoops->url('modules/' . $xoops->module->getVar('dirname') . '/' . $menu['link']), $menu['title']); ++$i; } if ($xoops->module->getInfo('help')) { if (stripos($_SERVER['REQUEST_URI'], 'admin/' . $xoops->module->getInfo('help')) !== false) { $current = $i; } $menu_handler->addMenuTabs('../../system/help.php?mid=' . $xoops->module->getVar('mid', 's') . '&' . $xoops->module->getInfo('help'), XoopsLocale::HELP); } // Display navigation tabs $xoops->tpl()->assign('xo_system_menu', $menu_handler->render($current, false)); } } }
$mid = $system->cleanVars($_POST, 'mid', 0, 'int'); $module_handler = $xoops->getHandlerModule(); $block_handler = $xoops->getHandlerBlock(); $module = $module_handler->getById($mid); // Call Header $xoops->header('admin:system/system_modules_logger.tpl'); // Define Stylesheet $xoops->theme()->addStylesheet('modules/system/css/admin.css'); // Define Breadcrumb and tips $admin_page = new \Xoops\Module\Admin(); $admin_page->addBreadcrumbLink(SystemLocale::CONTROL_PANEL, \XoopsBaseConfig::get('url') . '/admin.php', true); $admin_page->addBreadcrumbLink(SystemLocale::MODULES_ADMINISTRATION, $system->adminVersion('modulesadmin', 'adminpath')); $admin_page->addBreadcrumbLink(XoopsLocale::A_UPDATE); $admin_page->renderBreadcrumb(); $ret = array(); $system_module = new SystemModule(); $ret = $system_module->update($module->getVar('dirname')); $xoops->tpl()->assign('module', $ret); if ($ret) { $xoops->tpl()->assign('install', 1); $xoops->tpl()->assign('from_title', SystemLocale::MODULES_ADMINISTRATION); $xoops->tpl()->assign('from_link', $system->adminVersion('modulesadmin', 'adminpath')); $xoops->tpl()->assign('title', XoopsLocale::A_UPDATE); $xoops->tpl()->assign('log', $system_module->trace); } $folder = array(1, 2, 3); $system->cleanCache($folder); //Set active modules in cache folder $xoops->setActiveModules(); // Call Footer $xoops->footer();
* @author Andricq Nicolas (AKA MusS) * @version $Id$ */ $xoopsOption['checkadmin'] = true; $xoopsOption['hascommon'] = true; require_once __DIR__ . '/include/common.inc.php'; $xoops = Xoops::getInstance(); /* @var $wizard XoopsInstallWizard */ $wizard = $_SESSION['wizard']; $pageHasForm = true; if ($_SERVER['REQUEST_METHOD'] === 'POST') { $xoops->loadLocale('system'); include_once XOOPS_ROOT_PATH . "/modules/system/class/module.php"; include_once XOOPS_ROOT_PATH . "/modules/system/class/system.php"; $system = System::getInstance(); $system_module = new SystemModule(); $msgs = array(); foreach ($_REQUEST['modules'] as $dirname => $installmod) { if ($installmod) { $msgs[] = $system_module->install($dirname); } } $pageHasForm = false; if (count($msgs) > 0) { $content = "<div class='x2-note successMsg'>" . INSTALLED_EXTENSION . "</div><ul class='log'>"; foreach ($msgs as $msg) { if ($msg instanceof XoopsModule) { $tempvar = $msg->modinfo['name']; $content .= "<dt>{$tempvar}</dt>"; } }
} else { $content = "<div class='x2-note confirmMsg'>" . NO_INSTALLED_MODULES . "</div>"; } //Reset module lists in cache folder $xoops->cache()->delete('system/modules'); $xoops->setActiveModules(); } else { if (!$xoops->getConfig('locale')) { $xoops->setConfig('locale', $_COOKIE['xo_install_lang']); } $xoops->loadLocale('system'); include_once XOOPS_ROOT_PATH . "/modules/system/class/module.php"; include_once XOOPS_ROOT_PATH . "/modules/system/class/system.php"; $system = System::getInstance(); // Get installed modules $system_module = new SystemModule(); $dirlist = $system_module->getInstalledModules(); $toinstal = 0; $javascript = ""; $content = "<ul class='log'><li style='background: none;'>"; $content .= "<table class='module'>\n"; /* @var $module XoopsModule */ foreach ($dirlist as $module) { clearstatcache(); $value = 0; $style = ""; if (in_array($module->getInfo('dirname'), $wizard->configs['modules'])) { $value = 1; $style = " style='background-color:#E6EFC2;'"; } $form = new Xoops\Form\ThemeForm('', 'modules', 'index.php', 'post');
$xoops = Xoops::getInstance(); // setup legacy db support $GLOBALS['xoopsDB'] = \XoopsDatabaseFactory::getDatabaseConnection(true); //Set active modules in cache folder, delete caches if existing //$xoops->setActiveModules(); $modules_active = array(); $xoops->cache()->write('system/modules/active', $modules_active); $root = dirname(__DIR__); $language = $wizard->language; $xoops->setConfig('locale', $language); $xoops->loadLocale(); $xoops->loadLocale('system'); // Install system module include_once $root . "/modules/system/class/module.php"; include_once $root . "/modules/system/class/system.php"; $system_module = new SystemModule(); $system = System::getInstance(); $status = $system_module->install('system', true); if (!$status) { $_SESSION['error'] = $system_module->error; //$sql = $xoops->db()->getConfiguration()->getSQLLogger()->queries; } $pageHasForm = true; $pageHasHelp = false; $siteconfig = $_SESSION['siteconfig']; $error = $_SESSION['error']; if ($_SERVER['REQUEST_METHOD'] == 'POST') { $siteconfig['adminname'] = $_POST['adminname']; $siteconfig['adminmail'] = $_POST['adminmail']; $siteconfig['adminpass'] = $_POST['adminpass']; $siteconfig['adminpass2'] = $_POST['adminpass2'];