function startElement($parser, $name, $attributes) { if ($name == 'languages') { // strip off the initial 'languages' $this->element_path = array(); } else { parent::startElement($this->parser, $name, $attributes); } }
public static function getInstance($language, $lang_dir) { if (strlen($language) < 1) { trigger_error("No language passed to getInstance", 512); } if (strlen($lang_dir) < 1) { trigger_error("No language dir passed to getInstance", 512); } else { if (LanguageParser::$language == $language) { return $this->instance; } elseif (LanguageParser::$lang_dir == $lang_dir) { return $this->instance; } else { LanguageParser::$instance = new LanguageParser($language, $lang_dir); return LanguageParser::$instance; } } }
function import($filename) { global $languageManager, $msg; require_once AT_INCLUDE_PATH . 'classes/pclzip.lib.php'; require_once AT_INCLUDE_PATH . '../mods/_core/languages/classes/LanguagesParser.class.php'; $import_path = AT_CONTENT_DIR . 'import/'; $archive = new PclZip($filename); if ($archive->extract(PCLZIP_OPT_PATH, $import_path) == 0) { exit('Error : ' . $archive->errorInfo(true)); } $language_xml = @file_get_contents($import_path . 'language.xml'); $languageParser = new LanguageParser(); $languageParser->parse($language_xml); $languageEditor = $languageParser->getLanguageEditor(0); if ($languageEditor->getAtutorVersion() != VERSION && (!defined('AT_DEVEL_TRANSLATE') || !AT_DEVEL_TRANSLATE)) { $msg->addError('LANG_WRONG_VERSION'); } if ($languageEditor->getStatus() != AT_LANG_STATUS_PUBLISHED && $languageEditor->getStatus() != AT_LANG_STATUS_COMPLETE && (!defined('AT_DEVEL_TRANSLATE') || !AT_DEVEL_TRANSLATE)) { $msg->addError('LANG_NOT_COMPLETE'); } if ($languageManager->exists($languageEditor->getCode())) { $msg->addError('LANG_EXISTS'); } if (!$msg->containsErrors()) { $languageEditor->import($import_path . 'language_text.sql'); $msg->addFeedback('IMPORT_LANG_SUCCESS'); } // remove the files: @unlink($import_path . 'language.xml'); @unlink($import_path . 'language_text.sql'); @unlink($import_path . 'readme.txt'); @unlink($filename); }
// Created by Mark Scholten // This file is called index.php and is the start for everything, it includes everything that is required // Start session session_start(); // Debugging, can be enabled here or disabled ini_set("show_errors", "off"); error_reporting(E_ALL); ini_set('display_errors', 0); // Enable check to see if things where included (a small security feature) $index = 1; // Includes some basic files used by many parts of the scripts require_once "function.php"; require_once "config.php"; require_once 'LanguageParser.php'; $lang = LanguageParser::getInstance(addslashes(htmlentities(strtolower(lang_get_value_defaultlang()))), addslashes(htmlentities(strtolower($lang_dir)))); $html = ''; // Check if someone is logged in if (check_is_loggedin() == FALSE) { if (isset($_POST) && !empty($_POST) && isset($_POST['login']) && !empty($_POST['login'])) { if (login_do_action_checkcredentials() == TRUE) { login_do_action_createsession(); } else { echo login_create_loginscreen(); exit; } } else { echo login_create_loginscreen(); exit; } }
public function import_from_path($import_path, $ignore_version = false) { require_once AC_INCLUDE_PATH . 'classes/Language/LanguageParser.class.php'; global $languageManager, $msg; $language_xml = @file_get_contents($import_path . 'language.xml'); $languageParser = new LanguageParser(); $languageParser->parse($language_xml); $languageEditor = $languageParser->getLanguageEditor(0); $import_version = $languageEditor->getACheckerVersion(); if ($import_version != VERSION && !$ignore_version) { return array('version' => $import_version, "import_path" => $import_path); } if ($languageManager->exists($languageEditor->getCode())) { $msg->addError('LANG_EXISTS'); } if (!$msg->containsErrors()) { $languageEditor->import($import_path . 'language_text.sql'); $msg->addFeedback('IMPORT_LANG_SUCCESS'); } $this->cleanup_language_files($import_path); return true; }
function import($filename) { require_once TR_INCLUDE_PATH . 'lib/pclzip.lib.php'; require_once TR_INCLUDE_PATH . 'classes/Language/LanguageParser.class.php'; require_once TR_INCLUDE_PATH . 'classes/DAO/LanguagesDAO.class.php'; global $languageManager, $msg; $import_path = TR_CONTENT_DIR . 'import/'; $archive = new PclZip($filename); if ($archive->extract(PCLZIP_OPT_PATH, $import_path) == 0) { exit('Error : ' . $archive->errorInfo(true)); } $language_xml = @file_get_contents($import_path . 'language.xml'); $languageParser = new LanguageParser(); $languageParser->parse($language_xml); $languageEditor =& $languageParser->getLanguageEditor(0); $lang_code = $languageEditor->getCode(); if ($languageManager->exists($lang_code)) { $msg->addError('LANG_EXISTS'); } if (!$msg->containsErrors()) { $languageEditor->import($import_path . 'language_text.sql'); $languagesDAO = new LanguagesDAO(); $languagesDAO->UpdateField($lang_code, "status", TR_STATUS_ENABLED); $msg->addFeedback('IMPORT_LANG_SUCCESS'); $version_in_pack = $languageEditor->getTransformableVersion(); if ($version_in_pack != VERSION) { $msg->addFEEDBACK(array('LANG_MISMATCH_VERSION', $version_in_pack, VERSION)); } } // remove the files: @unlink($import_path . 'language.xml'); @unlink($import_path . 'language_text.sql'); @unlink($import_path . 'readme.txt'); @unlink($filename); }