XOOPS 2.5.6  Final
 All Classes Namespaces Files Functions Variables Pages
page_moduleinstaller.php
Go to the documentation of this file.
1 <?php
18 $xoopsOption['checkadmin'] = true;
19 $xoopsOption['hascommon'] = true;
20 require_once './include/common.inc.php';
21 defined('XOOPS_INSTALL') or die('XOOPS Installation wizard die');
22 
23 if (!@include_once "../language/{$wizard->language}/global.php") {
24  include_once "../language/english/global.php";
25 }
26 if (!@include_once "../modules/system/language/{$wizard->language}/admin/modulesadmin.php") {
27  include_once "../modules/system/language/english/admin/modulesadmin.php";
28 }
29 require_once '../class/xoopsformloader.php';
30 require_once '../class/xoopslists.php';
31 
32 $pageHasForm = true;
33 $pageHasHelp = false;
34 
35 if ($_SERVER['REQUEST_METHOD'] == 'POST') {
36  include_once '../class/xoopsblock.php';
37  include_once '../kernel/module.php';
38  include_once '../include/cp_functions.php';
39  include_once '../include/version.php';
40  include_once './include/modulesadmin.php';
41 
42  $config_handler =& xoops_gethandler('config');
43  $xoopsConfig =& $config_handler->getConfigsByCat(XOOPS_CONF);
44 
45  $msgs = array();
46  foreach ($_REQUEST['modules'] as $dirname => $installmod) {
47  if ($installmod) {
48  $msgs[] =& xoops_module_install($dirname);
49  }
50  }
51 
52  $pageHasForm = false;
53 
54  if (count($msgs) > 0) {
55  $content = "<div class='x2-note successMsg'>" . INSTALLED_MODULES . "</div><ul class='log'>";
56  foreach ($msgs as $msg) {
57  $content .= "<dt>{$msg}</dt>";
58  }
59  $content .= "</ul>";
60  } else {
61  $content = "<div class='x2-note confirmMsg'>" . NO_INSTALLED_MODULES . "</div>";
62  }
63 
64  // Flush cache files for cpanel GUIs
65  xoops_load("cpanel", "system");
66  XoopsSystemCpanel::flush();
67 
68  //Set active modules in cache folder
69  xoops_setActiveModules();
70 } else {
71  if (!isset($GLOBALS['xoopsConfig']['language'])) {
72  $GLOBALS['xoopsConfig']['language'] = $_COOKIE['xo_install_lang'];
73  }
74 
75  // Get installed modules
76  $module_handler =& xoops_gethandler('module');
77  $installed_mods =& $module_handler->getObjects();
78  $listed_mods = array();
79  foreach ($installed_mods as $module) {
80  $listed_mods[] = $module->getVar('dirname');
81  }
82 
83  include_once '../class/xoopslists.php';
84  $dirlist = XoopsLists::getModulesList();
85  $toinstal = 0;
86 
87  $javascript = "";
88  $content = "<ul class='log'><li>";
89  $content .= "<table class='module'>\n";
90  foreach ($dirlist as $file) {
91  clearstatcache();
92  if (!in_array($file, $listed_mods)) {
93  $value = 0;
94  $style = "";
95  if (in_array($file, $wizard->configs['modules'])) {
96  $value = 1;
97  $style = " style='background-color:#E6EFC2;'";
98  }
99 
100  $file = trim($file);
101  $module =& $module_handler->create();
102  if (!$module->loadInfo($file, false)) {
103  continue;
104  }
105 
106  $form = new XoopsThemeForm('', 'modules', 'index.php', 'post');
107  $moduleYN = new XoopsFormRadioYN('', 'modules['. $module->getInfo('dirname') . ']', $value, _YES, _NO);
108  $moduleYN->setExtra( "onclick='selectModule(\"" . $file . "\", this)'" );
109  $form->addElement($moduleYN);
110 
111  $content .= "<tr id='" . $file . "'" . $style . ">\n";
112  $content .= " <td class='img' ><img src='" . XOOPS_URL . "/modules/" . $module->getInfo('dirname') . "/" . $module->getInfo('image') . "' alt='" . $module->getInfo('name') . "'/></td>\n";
113  $content .= " <td>";
114  $content .= " " . $module->getInfo('name') . "&nbsp;" . number_format( round($module->getInfo('version'), 2), 2) . "&nbsp;(" . $module->getInfo('dirname') . ")";
115  $content .= " <br />" . $module->getInfo('description');
116  $content .= " </td>\n";
117  $content .= " <td class='yesno'>";
118  $content .= $moduleYN->render() ;
119  $content .= " </td></tr>\n";
120  $toinstal++;
121  }
122  }
123  $content .= "</table>";
124  $content .= "</li></ul><script type='text/javascript'>" . $javascript . "</script>";
125  if ($toinstal == 0) {
126  $pageHasForm = false;
127  $content = "<div class='x2-note confirmMsg'>" . NO_MODULES_FOUND . "</div>";
128  }
129 }
130 
131 include './include/install_tpl.php';
132 ?>