2 /****************************************************************/
4 /****************************************************************/
5 /* Copyright (c) 2002-2007 by Greg Gay & Joel Kronenberg */
6 /* Adaptive Technology Resource Centre / University of Toronto */
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 /****************************************************************/
15 define('AT_INCLUDE_PATH', '../include/');
16 require(AT_INCLUDE_PATH.'vitals.inc.php');
17 admin_authenticate(AT_ADMIN_PRIV_LANGUAGES);
19 require(AT_INCLUDE_PATH.'classes/pclzip.lib.php');
20 require_once(AT_INCLUDE_PATH.'classes/Language/LanguageEditor.class.php');
21 require_once(AT_INCLUDE_PATH.'classes/Language/LanguagesParser.class.php');
23 /* to avoid timing out on large files */
26 $_SESSION['done'] = 1;
28 if (isset($_POST['submit_import'])) {
29 require_once(AT_INCLUDE_PATH.'classes/Language/RemoteLanguageManager.class.php');
30 $remoteLanguageManager =& new RemoteLanguageManager();
31 $remoteLanguageManager->import($_POST['language']);
33 header('Location: language_import.php');
35 } else if (isset($_POST['submit']) && (!is_uploaded_file($_FILES['file']['tmp_name']) || !$_FILES['file']['size'])) {
36 $msg->addError('LANG_IMPORT_FAILED');
37 } else if (isset($_POST['submit']) && !$_FILES['file']['name']) {
38 $msg->addError('IMPORTFILE_EMPTY');
39 } else if (isset($_POST['submit']) && is_uploaded_file($_FILES['file']['tmp_name'])) {
40 $languageManager->import($_FILES['file']['tmp_name']);
42 header('Location: language_import.php');
47 <?php require(AT_INCLUDE_PATH.'header.inc.php'); ?>
49 <form name="form1" method="post" action="admin/language_import.php" enctype="multipart/form-data" onsubmit="openWindow('<?php echo AT_BASE_HREF; ?>tools/prog.php');">
50 <div class="input-form">
52 <p><?php echo _AT('import_lang_howto'); ?></p>
56 <label for="file"><?php echo _AT('import_a_new_lang'); ?></label><br />
57 <input type="file" name="file" id="file" />
60 <div class="row buttons">
61 <input type="submit" name="submit" value="<?php echo _AT('import'); ?>" />
67 <form name="form1" method="post" action="admin/language_import.php">
68 <div class="input-form">
70 <?php echo _AT('import_remote_language'); ?>
75 require_once(AT_INCLUDE_PATH.'classes/Language/RemoteLanguageManager.class.php');
76 $remoteLanguageManager =& new RemoteLanguageManager();
77 if ($remoteLanguageManager->getNumLanguages()) {
79 foreach ($remoteLanguageManager->getAvailableLanguages() as $codes){
80 $language = current($codes);
81 if (!$languageManager->exists($language->getCode()) && ($language->getStatus() == AT_LANG_STATUS_PUBLISHED)) {
83 echo '<select name="language">';
86 echo '<option value="'.$language->getCode().'">'.$language->getEnglishName().' - '.$language->getNativeName().'</option>';
90 echo '</select></div>';
91 echo '<div class="row buttons"><input type="submit" name="submit_import" value="' . _AT('import') . '" class="button" /></div>';
93 echo _AT('none_found');
97 echo _AT('cannot_find_remote_languages');
105 <?php require(AT_INCLUDE_PATH.'footer.inc.php'); ?>