XOOPS  2.6.0
page_extensioninstaller.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 
20 $xoopsOption['checkadmin'] = true;
21 $xoopsOption['hascommon'] = true;
22 
23 require_once __DIR__ . '/include/common.inc.php';
24 
26 
27 /* @var $wizard XoopsInstallWizard */
28 $wizard = $_SESSION['wizard'];
29 $pageHasForm = true;
30 
31 if ($_SERVER['REQUEST_METHOD'] == 'POST') {
32  $xoops->loadLocale('system');
33  include_once XOOPS_ROOT_PATH . "/modules/system/class/module.php";
34  include_once XOOPS_ROOT_PATH . "/modules/system/class/system.php";
35 
37 
39 
40  $msgs = array();
41  foreach ($_REQUEST['modules'] as $dirname => $installmod) {
42  if ($installmod) {
43  $msgs[] = $system_module->install($dirname);
44  }
45  }
46 
47  $pageHasForm = false;
48 
49  if (count($msgs) > 0) {
50  $content = "<div class='x2-note successMsg'>" . INSTALLED_EXTENSION . "</div><ul class='log'>";
51  foreach ($msgs as $msg) {
52  if ($msg instanceof XoopsModule) {
53  $tempvar = $msg->modinfo['name'];
54  $content .= "<dt>{$tempvar}</dt>";
55  }
56  }
57  $content .= "</ul>";
58  } else {
59  $content = "<div class='x2-note confirmMsg'>" . NO_INSTALLED_EXTENSION . "</div>";
60  }
61 
62  //Reset module lists in cache folder
63  $xoops->cache()->delete('system/modules');
64  $xoops->setActiveModules();
65 } else {
66  if (!$xoops->getConfig('locale')) {
67  $xoops->setConfig('locale', $_COOKIE['xo_install_lang']);
68  }
69  $xoops->loadLocale('system');
70  include_once XOOPS_ROOT_PATH . "/modules/system/class/module.php";
71  include_once XOOPS_ROOT_PATH . "/modules/system/class/extension.php";
72  include_once XOOPS_ROOT_PATH . "/modules/system/class/system.php";
73 
75 
76  // Get installed modules
78 
79  $dirlist = $system_module->getInstalledExtensions();
80  $toinstal = 0;
81 
83  $content = "<ul class='log'><li style='background: none;'>";
84  $content .= "<table class='module'>\n";
85  /* @var $ext XoopsModule */
86  foreach ($dirlist as $ext) {
87  clearstatcache();
88  $value = 0;
89  $style = "";
90 
91  if (in_array($ext->getInfo('dirname'), $wizard->configs['ext'])) {
92  $value = 1;
93  $style = " style='background-color:#E6EFC2;'";
94  }
95 
96  $form = new Xoops\Form\ThemeForm('', 'modules', 'index.php', 'post');
97  $moduleYN = new Xoops\Form\RadioYesNo('', 'modules[' . $ext->getInfo('dirname') . ']', $value, XoopsLocale::YES, XoopsLocale::NO);
98  $moduleYN->setExtra("onclick='selectModule(\"" . $ext->getInfo('dirname') . "\", this)'");
99  $form->addElement($moduleYN);
100 
101  $content .= "<tr id='" . $ext->getInfo('dirname') . "'" . $style . ">\n";
102  $content .= " <td class='img' ><img src='" . XOOPS_URL . "/modules/" . $ext->getInfo('dirname') . "/" . $ext->getInfo('image') . "' alt='" . $ext->getInfo('name') . "'/></td>\n";
103  $content .= " <td>";
104  $content .= " " . $ext->getInfo('name') . "&nbsp;" . number_format(round($ext->getInfo('version'), 2), 2) . "&nbsp;(" . $ext->getInfo('dirname') . ")";
105  $content .= " <br />" . $ext->getInfo('description');
106  $content .= " </td>\n";
107  $content .= " <td class='yesno'>";
108  $content .= $moduleYN->render();
109  $content .= " </td></tr>\n";
110  ++$toinstal;
111  }
112  $content .= "</table>";
113  $content .= "</li></ul><script type='text/javascript'>" . $javascript . "</script>";
114  if ($toinstal == 0) {
115  $pageHasForm = false;
116  $content = "<div class='x2-note confirmMsg'>" . NO_EXTENSION_FOUND . "</div>";
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
static getInstance()
Definition: system.php:46
static getInstance()
Definition: Xoops.php:160
$_SERVER['REQUEST_URI']
const INSTALLED_EXTENSION
Definition: install.php:202
$form
Definition: xoops_code.php:21
const XOOPS_INSTALL_PATH
Definition: common.inc.php:33
const NO_EXTENSION_FOUND
Definition: install.php:203
$ext
Definition: browse.php:87
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
if($toinstal==0) $_SESSION['pageHasHelp']
const NO_INSTALLED_EXTENSION
Definition: install.php:204
$xoopsOption['checkadmin']