2 /************************************************************************/
4 /************************************************************************/
5 /* Copyright (c) 2002-2008 by Greg Gay, Joel Kronenberg & Heidi Hazelton*/
6 /* Adaptive Technology Resource Centre / University of Toronto */
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_ADMIN);
19 require(AT_INCLUDE_PATH.'classes/Module/ModuleParser.class.php');
22 if (isset($_POST['submit_no'])) {
23 $msg->addFeedback('CANCELLED');
24 header('Location: '.AT_BASE_HREF.'admin/modules/add_new.php');
26 } else if (isset($_POST['mod']) && isset($_POST['submit_yes'])) {
27 $module = $moduleFactory->getModule($_POST['mod']);
31 if ($msg->containsErrors()) {
32 header('Location: '.AT_BASE_HREF.'admin/modules/details.php?mod='.$addslashes($_POST['mod']).SEP.'new=1');
34 $msg->addFeedback('MOD_INSTALLED');
35 header('Location: '.AT_BASE_HREF.'admin/modules/index.php');
38 } else if (isset($_GET['submit'])) {
41 if (isset($_GET['enabled']) && $_GET['enabled']) { $args .= 'enabled=1'; }
42 if (isset($_GET['disabled']) && $_GET['disabled']) { $args .= SEP.'disabled=1'; }
43 if (isset($_GET['missing']) && $_GET['missing']) { $args .= SEP.'missing=1'; }
44 if (isset($_GET['core']) && $_GET['core']) { $args .= SEP.'core=1'; }
45 if (isset($_GET['standard']) && $_GET['standard']) { $args .= SEP.'standard=1'; }
46 if (isset($_GET['extra']) && $_GET['extra']) { $args .= SEP.'extra=1'; }
48 header('Location: index.php?'. $args);
52 require(AT_INCLUDE_PATH.'header.inc.php');
54 $moduleParser = new ModuleParser();
56 $_REQUEST['mod'] = str_replace(array('.','..'), '', $_REQUEST['mod']);
58 if (!file_exists('../../mods/'.$_GET['mod'].'/module.xml')) {
60 <form method="get" action="<?php echo $_SERVER['PHP_SELF']; ?>">
61 <input type="hidden" name="mod" value="<?php echo $_GET['mod']; ?>" />
62 <input type="hidden" name="new" value="<?php echo $_GET['new']; ?>" />
63 <div class="input-form">
65 <h3><?php echo $_GET['mod']; ?></h3>
69 <?php echo _AT('missing_info'); ?>
72 <div class="row buttons">
73 <input type="submit" name="submit" value="<?php echo _AT('back'); ?>" />
74 <?php if (isset($_GET['new']) && $_GET['new']): ?>
75 <input type="submit" name="install" value="<?php echo _AT('install'); ?>" />
82 require(AT_INCLUDE_PATH.'footer.inc.php');
86 $moduleParser->parse(file_get_contents('../../mods/'.$_GET['mod'].'/module.xml'));
88 $module = $moduleFactory->getModule($_GET['mod']);
90 $properties = $module->getProperties(array('maintainers', 'url', 'date', 'license', 'state', 'notes', 'version'));
92 <form method="get" action="<?php echo $_SERVER['PHP_SELF']; ?>">
93 <input type="hidden" name="mod" value="<?php echo $_GET['mod']; ?>" />
94 <input type="hidden" name="new" value="<?php echo $_GET['new']; ?>" />
96 <input type="hidden" name="enabled" value="<?php echo (int) isset($_GET['enabled']); ?>" />
97 <input type="hidden" name="disabled" value="<?php echo (int) isset($_GET['disabled']); ?>" />
98 <input type="hidden" name="core" value="<?php echo (int) isset($_GET['core']); ?>" />
99 <input type="hidden" name="standard" value="<?php echo (int) isset($_GET['standard']); ?>" />
100 <input type="hidden" name="extra" value="<?php echo (int) isset($_GET['extra']); ?>" />
101 <input type="hidden" name="missing" value="<?php echo (int) isset($_GET['missing']); ?>" />
103 <div class="input-form">
105 <h3><?php echo $module->getName(); ?></h3>
109 <?php echo _AT('description'); ?><br />
110 <?php echo nl2br($module->getDescription($_SESSION['lang'])); ?>
114 <?php echo _AT('maintainers'); ?><br />
115 <ul class="horizontal">
116 <?php foreach ($properties['maintainers'] as $maintainer): ?>
117 <li><?php echo $maintainer['name'] .' <'.$maintainer['email'].'>'; ?></li>
123 <?php echo _AT('url'); ?><br />
124 <?php echo $properties['url']; ?>
128 <?php echo _AT('version'); ?><br />
129 <?php echo $properties['version']; ?>
133 <?php echo _AT('date'); ?><br />
134 <?php echo $properties['date']; ?>
138 <?php echo _AT('license'); ?><br />
139 <?php echo $properties['license']; ?>
143 <?php echo _AT('state'); ?><br />
144 <?php echo $properties['state']; ?>
148 <?php echo _AT('notes'); ?><br />
149 <?php echo nl2br($properties['notes']); ?>
152 <?php if (is_array($module->_pages)): ?>
154 <?php if (!isset($_GET['files'])): ?>
155 <a href="<?php echo htmlspecialchars($_SERVER['REQUEST_URI'], ENT_QUOTES).SEP; ?>files#files"><?php echo _AT('files'); ?></a><br />
157 <?php $module_pages = array_keys($module->_pages); ?>
158 <?php natsort($module_pages); ?>
159 <a name="files"></a><?php echo _AT('files'); ?><br />
160 <ul style="margin-top: 0px;">
161 <?php foreach ($module_pages as $key): ?>
162 <?php if (defined($key)) : continue; endif; ?>
163 <li><kbd><?php echo $key; ?></kbd></li>
170 <?php if (!isset($_REQUEST['new'])): ?>
171 <div class="row buttons">
172 <input type="submit" name="submit" value="<?php echo _AT('back'); ?>" />
177 <?php if (isset($_REQUEST['new'])): ?>
179 $hidden_vars['mod'] = $_REQUEST['mod'];
180 $hidden_vars['new'] = '1';
181 $msg->addConfirm(array('ADD_MODULE', $_REQUEST['mod']), $hidden_vars);
182 $msg->printConfirm();
186 <?php require(AT_INCLUDE_PATH.'footer.inc.php'); ?>