remove old readme
[atutor.git] / docs / mods / _core / modules / module_install_step_1.php
1 <?php
2 /************************************************************************/
3 /* ATutor                                                               */
4 /************************************************************************/
5 /* Copyright (c) 2002-2010                                              */
6 /* Inclusive Design Institute                                           */
7 /* http://atutor.ca                                                     */
8 /*                                                                      */
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 /************************************************************************/
13 // $Id: 
14
15 define('AT_INCLUDE_PATH', '../../../include/');
16 require(AT_INCLUDE_PATH.'vitals.inc.php');
17 admin_authenticate(AT_ADMIN_PRIV_MODULES);
18
19 $module_folder = '../../../mods/';
20
21 if (isset($_GET["mod"])) $mod = $_GET["mod"];
22 else if (isset($_POST["mod"])) $mod = $_POST["mod"];
23
24 if (isset($_GET["new"])) $new = $_GET["new"];
25 else if (isset($_POST["new"])) $new = $_POST["new"];
26
27 if (isset($_POST['submit_no'])) {
28         $msg->addFeedback('CANCELLED');
29         header('Location: '.AT_BASE_HREF.'mods/_core/modules/install_modules.php');
30         exit;
31
32 else if (is_writable($module_folder) || (is_writable($module_folder) && isset($_POST['submit_yes']))) 
33 {
34         header('Location: '.AT_BASE_HREF.'mods/_core/modules/module_install_step_2.php?mod='.$mod.SEP.'new='.$new.SEP.'permission_granted='.$_POST["permission_granted"]);
35         exit;
36 }
37
38 if (!is_writable($module_folder))
39 {
40         unset($hidden_vars);
41         $hidden_vars['mod'] = $mod;
42         $hidden_vars['new'] = $new;
43         $hidden_vars['permission_granted'] = 1;
44
45         require(AT_INCLUDE_PATH.'header.inc.php'); 
46         
47         $msg->addConfirm(array('GRANT_WRITE_PERMISSION', realpath($module_folder)), $hidden_vars, _AT("continue"), _AT("cancel"));
48         $msg->printConfirm();
49         
50         require(AT_INCLUDE_PATH.'footer.inc.php'); 
51 }
52
53 ?>