2 /************************************************************************/
4 /************************************************************************/
5 /* Copyright (c) 2002-2010 */
6 /* Inclusive Design Institute */
9 /* This program is free software. You can redistribute it and/or */
10 /* modify it under the terms of the GNU General Public License */
11 /* as published by the Free Software Foundation. */
12 /************************************************************************/
15 define('AT_INCLUDE_PATH', '../../../include/');
16 require(AT_INCLUDE_PATH.'vitals.inc.php');
17 admin_authenticate(AT_ADMIN_PRIV_MODULES);
19 require(AT_INCLUDE_PATH.'../mods/_core/modules/classes/ModuleParser.class.php');
20 require_once(AT_INCLUDE_PATH.'../mods/_core/file_manager/filemanager.inc.php');
22 // module content folder
23 $module_content_folder = AT_CONTENT_DIR . "module/";
25 if (isset($_GET["mod"])) $mod = str_replace(array('.','..'), '', $_GET['mod']);
26 else if (isset($_POST["mod"])) $mod = $_POST["mod"];
28 if (isset($_GET["new"])) $new = $_GET["new"];
29 else if (isset($_POST["new"])) $new = $_POST["new"];
31 if (isset($_GET["permission_granted"])) $permission_granted = $_GET["permission_granted"];
32 else if (isset($_POST["permission_granted"])) $permission_granted = $_POST["permission_granted"];
34 if (isset($_POST['submit_no']))
36 clr_dir('../../../mods/'.$_POST['mod']);
38 // if write permission on the mods folder has been granted, re-direct to the page of removing permission,
39 // otherwise, back to start page.
40 if ($_POST['permission_granted']==1)
41 header('Location: '.AT_BASE_HREF.'mods/_core/modules/module_install_step_3.php?cancelled=1');
44 $msg->addFeedback('CANCELLED');
45 header('Location: '.AT_BASE_HREF.'mods/_core/modules/install_modules.php');
50 else if (isset($_POST['submit_yes']))
53 $module = $moduleFactory->getModule($_POST['mod']);
57 if ($msg->containsErrors())
59 header('Location: '.AT_BASE_HREF.'mods/_core/modules/module_install_step_2.php?mod='.$addslashes($mod).SEP.'new=1'.SEP.'permission_granted='.$permission_granted);
63 if ($_POST['permission_granted']==1)
65 header('Location: '.AT_BASE_HREF.'mods/_core/modules/module_install_step_3.php?installed=1');
69 $msg->addFeedback('MOD_INSTALLED');
70 header('Location: '.AT_BASE_HREF.'mods/_core/modules/index.php');
74 } else if (isset($_GET['submit'])) {
77 if (isset($_GET['enabled']) && $_GET['enabled']) { $args .= 'enabled=1'; }
78 if (isset($_GET['disabled']) && $_GET['disabled']) { $args .= SEP.'disabled=1'; }
79 if (isset($_GET['missing']) && $_GET['missing']) { $args .= SEP.'missing=1'; }
80 if (isset($_GET['core']) && $_GET['core']) { $args .= SEP.'core=1'; }
81 if (isset($_GET['standard']) && $_GET['standard']) { $args .= SEP.'standard=1'; }
82 if (isset($_GET['extra']) && $_GET['extra']) { $args .= SEP.'extra=1'; }
84 header('Location: index.php?'. $args);
88 // copy module from content folder into mods folder
89 if (isset($mod) && !isset($_GET['mod_in']))
91 copys($module_content_folder.$mod, '../../../mods/'.$mod);
94 require(AT_INCLUDE_PATH.'header.inc.php');
96 $moduleParser = new ModuleParser();
98 if (!file_exists('../../../mods/'.$mod.'/module.xml')) {
100 <form method="get" action="<?php echo $_SERVER['PHP_SELF']; ?>">
101 <input type="hidden" name="mod" value="<?php echo $mod; ?>" />
102 <input type="hidden" name="new" value="<?php echo $new; ?>" />
103 <input type="hidden" name="permission_granted" value="<?php echo $permission_granted; ?>" />
104 <div class="input-form">
106 <h3><?php echo $mod; ?></h3>
110 <?php echo _AT('missing_info'); ?>
113 <div class="row buttons">
114 <input type="submit" name="submit" value="<?php echo _AT('back'); ?>" />
115 <?php if (isset($new) && $new): ?>
116 <input type="submit" name="install" value="<?php echo _AT('install'); ?>" />
123 require(AT_INCLUDE_PATH.'footer.inc.php');
127 $readme = get_readme('../../../mods/'.$mod);
129 $moduleParser->parse(file_get_contents('../../../mods/'.$mod.'/module.xml'));
131 $module = $moduleFactory->getModule($mod);
133 $properties = $module->getProperties(array('maintainers', 'url', 'date', 'license', 'state', 'notes', 'version'));
135 <form method="get" action="<?php echo $_SERVER['PHP_SELF']; ?>">
136 <input type="hidden" name="mod" value="<?php echo $mod; ?>" />
137 <input type="hidden" name="new" value="<?php echo $new; ?>" />
138 <input type="hidden" name="permission_granted" value="<?php echo $permission_granted; ?>" />
140 <input type="hidden" name="enabled" value="<?php echo (int) isset($_GET['enabled']); ?>" />
141 <input type="hidden" name="disabled" value="<?php echo (int) isset($_GET['disabled']); ?>" />
142 <input type="hidden" name="core" value="<?php echo (int) isset($_GET['core']); ?>" />
143 <input type="hidden" name="standard" value="<?php echo (int) isset($_GET['standard']); ?>" />
144 <input type="hidden" name="extra" value="<?php echo (int) isset($_GET['extra']); ?>" />
145 <input type="hidden" name="missing" value="<?php echo (int) isset($_GET['missing']); ?>" />
147 <div class="input-form">
149 <h3><?php echo $module->getName(); ?></h3>
153 <?php echo _AT('description'); ?><br />
154 <?php echo nl2br($module->getDescription($_SESSION['lang'])); if ($readme <> '') echo '<br /><a href="#" onclick="ATutor.poptastic(\''.AT_BASE_HREF.'mods/'.$mod.'/'.$readme.'\');return false;">'._AT('view_readme').'</a>'; ?>
158 <?php echo _AT('maintainers'); ?><br />
159 <ul class="horizontal">
160 <?php foreach ($properties['maintainers'] as $maintainer): ?>
161 <li><?php echo $maintainer['name'] .' <'.$maintainer['email'].'>'; ?></li>
167 <?php echo _AT('url'); ?><br />
168 <?php echo $properties['url']; ?>
172 <?php echo _AT('version'); ?><br />
173 <?php echo $properties['version']; ?>
177 <?php echo _AT('date'); ?><br />
178 <?php echo $properties['date']; ?>
182 <?php echo _AT('license'); ?><br />
183 <?php echo $properties['license']; ?>
187 <?php echo _AT('state'); ?><br />
188 <?php echo $properties['state']; ?>
192 <?php echo _AT('notes'); ?><br />
193 <?php echo nl2br($properties['notes']); ?>
196 <?php if (is_array($module->_pages)): ?>
198 <?php if (!isset($_GET['files'])): ?>
199 <a href="<?php echo htmlspecialchars($_SERVER['REQUEST_URI'], ENT_QUOTES).SEP; ?>files#files"><?php echo _AT('files'); ?></a><br />
201 <?php $module_pages = array_keys($module->_pages); ?>
202 <?php natsort($module_pages); ?>
203 <a name="files"></a><?php echo _AT('files'); ?><br />
204 <ul style="margin-top: 0px;">
205 <?php foreach ($module_pages as $key): ?>
206 <?php if (defined($key)) : continue; endif; ?>
207 <li><kbd><?php echo $key; ?></kbd></li>
214 <?php if (!isset($new)): ?>
215 <div class="row buttons">
216 <input type="submit" name="submit" value="<?php echo _AT('back'); ?>" />
221 <?php if (isset($new)): ?>
223 $hidden_vars['mod'] = $mod;
224 $hidden_vars['new'] = '1';
225 $hidden_vars['permission_granted'] = $permission_granted;
227 $msg->addConfirm(array('ADD_MODULE', $mod), $hidden_vars);
228 $msg->printConfirm();
232 <?php require(AT_INCLUDE_PATH.'footer.inc.php'); ?>