fbab1fbfcbae5e8b8be1c32a241eea6d3ee21b8e
[atutor.git] / mods / merlot / index_admin.php
1 <?php\r
2 /****************************************************************/\r
3 /* ATutor                                                                                                               */\r
4 /****************************************************************/\r
5 /* Copyright (c) 2002-2006 by Greg Gay & Joel Kronenberg        */\r
6 /* Adaptive Technology Resource Centre / University of Toronto  */\r
7 /* http://atutor.ca                                                                                             */\r
8 /*                                                              */\r
9 /* This program is free software. You can redistribute it and/or*/\r
10 /* modify it under the terms of the GNU General Public License  */\r
11 /* as published by the Free Software Foundation.                                */\r
12 /****************************************************************/\r
13 // $Id: merlot.php 6614 2006-09-27 19:32:29Z greg $\r
14 \r
15 \r
16 define('AT_INCLUDE_PATH', '../../include/');\r
17 require (AT_INCLUDE_PATH.'vitals.inc.php');\r
18 admin_authenticate(AT_ADMIN_PRIV_MERLOT);\r
19 \r
20 \r
21 if($_POST['submit']){\r
22         $_POST['merlot_location'] = trim($_POST['merlot_location']);\r
23         $_POST['merlot_key'] = trim($_POST['merlot_key']);\r
24 \r
25         if (!$_POST['merlot_location']){\r
26                 $msg->addError('MERLOTURL_ADD_EMPTY');\r
27         }\r
28 \r
29         if (!$_POST['merlot_key']){\r
30                 $msg->addError('MERLOTKEY_ADD_EMPTY');\r
31         }               \r
32 \r
33         if (!$msg->containsErrors()) {\r
34                 $_POST['merlot_location'] = $addslashes($_POST['merlot_location']);\r
35                 $sql = "REPLACE INTO ".TABLE_PREFIX."config VALUES ('merlot_location', '$_POST[merlot_location]')";\r
36                 mysql_query($sql, $db);\r
37 \r
38                 $_POST['merlot_key'] = $addslashes($_POST['merlot_key']);\r
39                 $sql = "REPLACE INTO ".TABLE_PREFIX."config VALUES ('merlot_key', '$_POST[merlot_key]')";\r
40                 mysql_query($sql, $db);\r
41                 \r
42                 $msg->addFeedback('MERLOT_CONFIG_SAVED');\r
43         \r
44                 header('Location: '.$_SERVER['PHP_SELF']);\r
45                 exit;\r
46         }\r
47 }\r
48 require (AT_INCLUDE_PATH.'header.inc.php');\r
49 ?>\r
50     <div class="input-form">\r
51         <div class="row">\r
52             <p><?php echo _AT('merlot_config');  ?></p>\r
53         </div>\r
54     </div>\r
55 <form action="<?php  $_SERVER['PHP_SELF']; ?>" method="post">\r
56     <div class="input-form">\r
57         <div class="row">\r
58                 <p><label for="uri"><?php echo _AT('merlot_location'); ?></label></p>\r
59                 <input type="text" name="merlot_location" value="<?php echo $_config['merlot_location']; ?>" id="uri" size="80" style="min-width: 95%;" />\r
60              \r
61                 <p><label for="key"><?php echo _AT('merlot_key'); ?></label></p>\r
62                  <input type="text" name="merlot_key" value="<?php echo $_config['merlot_key']; ?>" id="key" size="80" style="min-width: 95%;" />\r
63         </div>\r
64 \r
65         <div class="row buttons">\r
66             <input type="submit" name="submit" value="<?php echo _AT('merlot_save'); ?>"  />\r
67         </div>\r
68     </div>\r
69 </form> \r
70 \r
71 <?php require (AT_INCLUDE_PATH.'footer.inc.php'); ?>