removed mods directory from the ATutor codebase
[atutor.git] / mods / mahara / index_admin.php
diff --git a/mods/mahara/index_admin.php b/mods/mahara/index_admin.php
deleted file mode 100644 (file)
index 96113e2..0000000
+++ /dev/null
@@ -1,162 +0,0 @@
-<?php\r
-/*\r
-    This is the main page for the ATutor+Mahara module accessed by ATutor admins.\r
-    It checks if the current admin is registered with Mahara by checking\r
-    ATutor's 'mahara' table.  If registered, an iframe is created to display\r
-    the Mahara page ('mahara_login.php', a login script to the page also gets called).\r
-    If not registered, 'new_account_admin.php' is called which automatically sets up an\r
-    admin account with Mahara and saves the user information in ATutor's mahara table.\r
-    The page then automatically gets refreshed.\r
-\r
-    by: Boon-Hau Teh\r
-*/\r
-\r
-\r
-define('AT_INCLUDE_PATH', '../../include/');\r
-require (AT_INCLUDE_PATH.'vitals.inc.php');\r
-\r
-ob_start();  // we need this to be able to set cookies\r
-\r
-admin_authenticate(AT_ADMIN_PRIV_MAHARA);\r
-\r
-\r
- /**\r
- * Adds an ending slash to the given path, and differentiates\r
- * between windows and unix paths (keeps orginal slashes)\r
- * @access  public\r
- * @param   $string The path to some directory.\r
- * @return  Returns the path in proper format with a trailing slash.\r
- * @author  Boon-Hau Teh\r
- */\r
-function add_ending_slash($path){\r
-    // Check if last character is a slash\r
-    //$last_char = substr($path, strlen($path)-1, 1);\r
-    $last_char = $path[strlen($path)-1];\r
-    if ($last_char != '/' && $last_char != '\\') {\r
-        // determine if windows or unix\r
-        $path .= (substr_count($path, '\\') > 0) ? '\\\\' : '/'; \r
-    }\r
-    return $path;\r
-}\r
-\r
-\r
-\r
-\r
-if (isset($_POST['uri'])) {\r
-       $mahara_path = add_ending_slash(trim($_POST['uri']));\r
-       if (!$mahara_path){\r
-               $msg->addError('MAHARA_MINURL_ADD_EMPTY');\r
-       }\r
-                       \r
-       if (!$msg->containsErrors()) {\r
-        // If Magic Quotes are not on, then add necessary slashes\r
-        if (!get_magic_quotes_gpc())\r
-            $mahara_path = addslashes($mahara_path);\r
-\r
-        $sql = "REPLACE INTO ".TABLE_PREFIX."config VALUES ('mahara', '$mahara_path')";\r
-        mysql_query($sql, $db);\r
-               $msg->addFeedback('MAHARA_MINURL_ADD_SAVED');\r
-\r
-               header('Location: '.$_SERVER['PHP_SELF']);\r
-               exit;\r
-       }\r
-}\r
-\r
-if (isset($_config['mahara'])) {\r
-    if (!file_exists($_config['mahara'].'config.php'))\r
-        $msg->addError ("MAHARA_ERROR_PATH");\r
-}\r
-\r
-require (AT_INCLUDE_PATH.'header.inc.php');\r
-\r
-?>\r
-\r
-<form action="<?php  $_SERVER['PHP_SELF']; ?>" method="post">\r
-       <div class="input-form">\r
-               <div class="row">\r
-                       <p><label for="uri"><?php echo _AT('mahara_location'); ?></label></p>\r
-       \r
-                       <input type="text" name="uri" value="<?php echo $_config['mahara']; ?>" id="uri" size="80" style="min-width: 95%;" />\r
-               </div>\r
-\r
-               <div class="row buttons">\r
-                       <input type="submit" name="submit" value="<?php echo _AT('save'); ?>"  />\r
-               </div>\r
-       </div>\r
-</form>\r
-\r
-\r
-<?php\r
-\r
-// Show iframe to Mahara if path is correct and user has access to admin site in Mahara\r
-\r
-// First check if path is correct\r
-if (isset($_config['mahara'])) {\r
-    @include ($_config['mahara'].'config.php');\r
-    if (isset($cfg)) {\r
-\r
-        // Now check for existing account on Mahara and if it's admin\r
-\r
-        // Read login info for Mahara\r
-        $sql    = "SELECT username, SHA1(password) FROM ".TABLE_PREFIX."mahara WHERE at_login='".$_SESSION['login']."'";\r
-        $result = mysql_query($sql, $db);\r
-\r
-        if (!($row = @mysql_fetch_array($result))) {\r
-            define('new_admin_account', 1);\r
-\r
-            // if not configured with ATutor, automatically register for account now\r
-            require('new_account_admin.php');\r
-\r
-            // refresh the page\r
-            header('Location: index_admin.php');\r
-\r
-        } else {\r
-            $username = $row[0];\r
-            $password = $row[1];\r
-\r
-            // Login\r
-            ?>\r
-\r
-            <?php\r
-            ATutor.setcookie("ATutor_Mahara[at_login]", $_SESSION['login'], time()+1200); \r
-            ATutor.setcookie("ATutor_Mahara[username]", $username, time()+1200); \r
-            ATutor.setcookie("ATutor_Mahara[password]", $password, time()+1200); \r
-\r
-\r
-            if (function_exists('url_rewrite')) {   // if "pretty url" feature supported (from ATutor 1.6.1)\r
-                $url = url_rewrite('mods/mahara/mahara_login.php', AT_PRETTY_URL_IS_HEADER);  // to be directly called in an iframe\r
-                $url_cookie_forward = url_rewrite('mods/mahara/cookie.php', AT_PRETTY_URL_IS_HEADER);  // to be used in a new window and redirect to mahara_login.php\r
-            } else {\r
-                $url = AT_BASE_HREF.'mods/mahara/mahara_login.php';\r
-                $url_cookie_forward = AT_BASE_HREF.'mods/mahara/cookie.php';\r
-            }\r
-\r
-            ?>\r
-                <script language='javascript' type='text/javascript'>\r
-                function iFrameHeight() {\r
-                  var h = 0;\r
-                    if ( !document.all ) {\r
-                        h = document.getElementById('ATutorMahara').contentDocument.height;\r
-                        document.getElementById('ATutorMahara').style.height = h + 60 + 'px';\r
-                    } else if( document.all ) {\r
-                        h = document.frames('ATutorMahara').document.body.scrollHeight;\r
-                        document.all.ATutorMahara.style.height = h + 20 + 'px';\r
-                    }\r
-                }\r
-                </script>\r
-                <iframe onload='iFrameHeight()' id='ATutorMahara' name='ATutorMahara'\r
-                  src='<?=$url?>' width='100%' height='500' scrolling='auto' align='top' frameborder='0'>\r
-                </iframe>\r
-        <?php\r
-        }\r
-\r
-\r
-    }\r
-}\r
-\r
-\r
-require (AT_INCLUDE_PATH.'footer.inc.php');\r
-\r
-ob_end_flush();\r
-\r
-?>\r