XOOPS  2.6.0
page_moduleinstaller.php
Go to the documentation of this file.
1 <?php
2 /*
3  You may not change or alter any portion of this comment or credits
4  of supporting developers from this source code or any supporting source code
5  which is considered copyrighted (c) material of the original comment or credit authors.
6 
7  This program is distributed in the hope that it will be useful,
8  but WITHOUT ANY WARRANTY; without even the implied warranty of
9  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
10 */
11 
25 $xoopsOption['checkadmin'] = true;
26 $xoopsOption['hascommon'] = true;
27 
28 require_once __DIR__ . '/include/common.inc.php';
29 
31 
32 /* @var $wizard XoopsInstallWizard */
33 $wizard = $_SESSION['wizard'];
34 $pageHasForm = true;
35 
36 if ($_SERVER['REQUEST_METHOD'] == 'POST') {
37  $xoops->loadLocale('system');
38  include_once XOOPS_ROOT_PATH . "/modules/system/class/module.php";
39  include_once XOOPS_ROOT_PATH . "/modules/system/class/system.php";
40 
43 
44  $msgs = array();
45  foreach ($_REQUEST['modules'] as $dirname => $installmod) {
46  if ($installmod) {
47  $msgs[] = $system_module->install($dirname);
48  }
49  }
50 
51  $pageHasForm = false;
52 
53  if (count($msgs) > 0) {
54  $content = "<div class='x2-note successMsg'>" . INSTALLED_MODULES . "</div><ul class='log'>";
55  foreach ($msgs as $msg) {
56  $tempvar = $msg->modinfo['name'];
57  $content .= "<dt>{$tempvar}</dt>";
58  }
59  $content .= "</ul>";
60  } else {
61  $content = "<div class='x2-note confirmMsg'>" . NO_INSTALLED_MODULES . "</div>";
62  }
63 
64  //Reset module lists in cache folder
65  $xoops->cache()->delete('system/modules');
66  $xoops->setActiveModules();
67 } else {
68  if (!$xoops->getConfig('locale')) {
69  $xoops->setConfig('locale', $_COOKIE['xo_install_lang']);
70  }
71  $xoops->loadLocale('system');
72 
73  include_once XOOPS_ROOT_PATH . "/modules/system/class/module.php";
74  include_once XOOPS_ROOT_PATH . "/modules/system/class/system.php";
75 
77  // Get installed modules
79 
80  $dirlist = $system_module->getInstalledModules();
81  $toinstal = 0;
82 
84  $content = "<ul class='log'><li style='background: none;'>";
85  $content .= "<table class='module'>\n";
86  /* @var $module XoopsModule */
87  foreach ($dirlist as $module) {
88  clearstatcache();
89  $value = 0;
90  $style = "";
91  if (in_array($module->getInfo('dirname'), $wizard->configs['modules'])) {
92  $value = 1;
93  $style = " style='background-color:#E6EFC2;'";
94  }
95  $form = new Xoops\Form\ThemeForm('', 'modules', 'index.php', 'post');
96  $moduleYN = new Xoops\Form\RadioYesNo('', 'modules[' . $module->getInfo('dirname') . ']', $value, XoopsLocale::YES, XoopsLocale::NO);
97  $moduleYN->setExtra("onclick='selectModule(\"" . $module->getInfo('dirname') . "\", this)'");
98  $form->addElement($moduleYN);
99 
100  $content .= "<tr id='" . $module->getInfo('dirname') . "'" . $style . ">\n";
101  $content .= " <td class='img' ><img src='" . XOOPS_URL . "/modules/" . $module->getInfo('dirname') . "/" . $module->getInfo('image') . "' alt='" . $module->getInfo('name') . "'/></td>\n";
102  $content .= " <td>";
103  $content .= " " . $module->getInfo('name') . "&nbsp;" . number_format(round($module->getInfo('version'), 2), 2) . "&nbsp;(" . $module->getInfo('dirname') . ")";
104  $content .= " <br />" . $module->getInfo('description');
105  $content .= " </td>\n";
106  $content .= " <td class='yesno'>";
107  $content .= $moduleYN->render();
108  $content .= " </td></tr>\n";
109  ++$toinstal;
110  }
111  $content .= "</table>";
112  $content .= "</li></ul><script type='text/javascript'>" . $javascript . "</script>";
113  if ($toinstal == 0) {
114  $pageHasForm = false;
115  $content = "<div class='x2-note confirmMsg'>" . NO_MODULES_FOUND . "</div>";
116  }
117 }
118 
119 $_SESSION['pageHasHelp'] = false;
120 $_SESSION['pageHasForm'] = $pageHasForm;
121 $_SESSION['content'] = $content;
122 include XOOPS_INSTALL_PATH . '/include/install_tpl.php';
$tempvar
Definition: page_theme.php:58
const NO_MODULES_FOUND
Definition: install.php:199
const INSTALLED_MODULES
Definition: install.php:198
static getInstance()
Definition: system.php:46
if($toinstal==0) $_SESSION['pageHasHelp']
static getInstance()
Definition: Xoops.php:160
$_SERVER['REQUEST_URI']
$form
Definition: xoops_code.php:21
$xoopsOption['checkadmin']
const XOOPS_INSTALL_PATH
Definition: common.inc.php:33
$module
Definition: main.php:52
if(!is_object($module)||!$module->getVar('isactive')) $msg
Definition: groupperm.php:38
$dirname
Definition: backend.php:38
setExtra($extra, $replace=false)
Definition: Element.php:522
const NO_INSTALLED_MODULES
Definition: install.php:200