changed git call from https to git readonly
[atutor.git] / mods / ccnet / ccnet.php
1 <?php\r
2 /*\r
3 This is the ATutor CCNet admin module page. It allows an admin user\r
4 to set or edit  the URL for the CCNet installation for ATutor, and\r
5 it includes the launcher, which opens CCNet in a new window\r
6 \r
7 */\r
8 define('AT_INCLUDE_PATH', '../../include/');\r
9 require (AT_INCLUDE_PATH.'vitals.inc.php');\r
10 \r
11 \r
12 if (isset($_POST['submit'])) {\r
13         $_POST['uri'] = trim($_POST['uri']);\r
14 \r
15         if (!$_POST['uri']){\r
16                 $msg->addError('CCNETURL_ADD_EMPTY');\r
17         }\r
18                         \r
19         if (!$msg->containsErrors()) {\r
20                 $_POST['uri'] = $addslashes($_POST['uri']);\r
21                 $sql = "REPLACE INTO ".TABLE_PREFIX."config VALUES ('ccnet', '$_POST[uri]')";\r
22                 mysql_query($sql, $db);\r
23                 $msg->addFeedback('CCNETURL_ADD_SAVED');\r
24 \r
25                 header('Location: '.$_SERVER['PHP_SELF']);\r
26                 exit;\r
27         }\r
28 }\r
29 \r
30 require (AT_INCLUDE_PATH.'header.inc.php');\r
31 \r
32 ?>\r
33 \r
34 <?php if ($_config['ccnet']): ?>\r
35         <div class="input-form">\r
36                 <div class="row">\r
37                         <p><?php echo _AT('ccnet_text');  ?></p>\r
38                 </div>\r
39                 <div class="row buttons">\r
40                         <form action="" method="get">\r
41                                 <input type="submit" value="<?php echo _AT('ccnet_open'); ?>" onclick="window.open('<?php echo $_config['ccnet']; ?>','mywindow','width=800,height=600,scrollbars=yes, resizable=yes', 'false'); return false;" />\r
42                         </form>\r
43                 </div>\r
44         </div>\r
45 <?php else: ?>\r
46         <div class="input-form">\r
47                 <div class="row">\r
48                         <p><?php echo _AT('ccnet_missing_url');  ?></p>\r
49                 </div>\r
50         </div>\r
51 <?php endif; ?>\r
52 \r
53 <form action="<?php  $_SERVER['PHP_SELF']; ?>" method="post">\r
54         <div class="input-form">\r
55                 <div class="row">\r
56                         <p><label for="uri"><?php echo _AT('ccnet_location'); ?></label></p>\r
57         \r
58                         <input type="text" name="uri" value="<?php echo $_config['ccnet']; ?>" id="uri" size="80" style="min-width: 95%;" />\r
59                 </div>\r
60 \r
61                 <div class="row buttons">\r
62                         <input type="submit" name="submit" value="<?php echo _AT('save'); ?>"  />\r
63                 </div>\r
64         </div>\r
65 </form>\r
66 \r
67 <?php  require (AT_INCLUDE_PATH.'footer.inc.php'); ?>