remove old readme
[atutor.git] / docs / mods / _core / languages / language_add.php
1 <?php
2 /************************************************************************/
3 /* ATutor                                                                                                                               */
4 /************************************************************************/
5 /* Copyright (c) 2002-2010                                              */
6 /* Inclusive Design Institute                                           */
7 /* http://atutor.ca                                                     */
8 /* This program is free software. You can redistribute it and/or        */
9 /* modify it under the terms of the GNU General Public License          */
10 /* as published by the Free Software Foundation.                        */
11 /************************************************************************/
12 // $Id$
13
14 define('AT_INCLUDE_PATH', '../../../include/');
15 require(AT_INCLUDE_PATH.'vitals.inc.php');
16 admin_authenticate(AT_ADMIN_PRIV_LANGUAGES);
17 if (!AT_DEVEL_TRANSLATE) { exit; }
18
19 if (isset($_POST['cancel'])) {
20         $msg->addFeedback('CANCELLED');
21         header('Location: language.php');
22         exit;
23 } else if (isset($_POST['submit'])) {
24         require_once(AT_INCLUDE_PATH . '../mods/_core/languages/classes/LanguageEditor.class.php'); 
25         
26         if ($languageManager->exists($_POST['code'], $_POST['locale'])) {
27                 $msg->addError('LANG_EXISTS');
28         } else {
29                 $state = LanguageEditor::addLanguage($_POST, $db);
30         }
31
32         if (!$msg->containsErrors() && $state !== FALSE) {
33                 $msg->addFeedback('LANG_ADDED');
34                 header('Location: language.php');
35                 exit;
36         } 
37 }
38
39 require(AT_INCLUDE_PATH.'header.inc.php');
40 $savant->display('admin/system_preferences/language_add.tmpl.php');
41 require(AT_INCLUDE_PATH.'footer.inc.php');  ?>