/**
  * 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');
 }
 /**
  * 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));
 }
$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>";
            }
        }
        $content .= "</ul>";
    } else {
        $content = "<div class='x2-note confirmMsg'>" . NO_INSTALLED_EXTENSION . "</div>";
    }
Exemple #4
0
     break;
 case 'install':
     $module = $system->cleanVars($_POST, 'dirname', '', 'string');
     // 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_INSTALL);
     $admin_page->renderBreadcrumb();
     $ret = array();
     $system_module = new SystemModule();
     $ret = $system_module->install($module);
     if ($ret) {
         $xoops->tpl()->assign('install', 1);
         $xoops->tpl()->assign('module', $ret);
         $xoops->tpl()->assign('from_title', SystemLocale::MODULES_ADMINISTRATION);
         $xoops->tpl()->assign('from_link', $system->adminVersion('modulesadmin', 'adminpath'));
         $xoops->tpl()->assign('title', XoopsLocale::A_INSTALL);
         $xoops->tpl()->assign('log', $system_module->trace);
     } else {
         print_r($system_module->error);
         //print_r($system_module->trace);
     }
     $folder = array(1, 2, 3);
     $system->cleanCache($folder);
     //Set active modules in cache folder
     $xoops->setActiveModules();
$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'];
    $error = array();
    if (empty($siteconfig['adminname'])) {