コード例 #1
0
ファイル: LangManager.php プロジェクト: Gritch69/XG-Project
 public static function getInstance()
 {
     if (empty(self::$instance)) {
         self::$instance = new LangManager();
     }
     return self::$instance;
 }
コード例 #2
0
ファイル: RunnableTest.php プロジェクト: Gritch69/XG-Project
 public function __construct($debug = false)
 {
     if (empty(self::$reslist)) {
         self::includeVars('XG');
     }
     if (!LangManager::getInstance()->implementationExist()) {
         LangManager::getInstance()->setImplementation(new LangImplementation('XG'));
     }
     $attackers = $this->getAttachers();
     $defenders = $this->getDefenders();
     $memory1 = memory_get_usage();
     $micro1 = microtime();
     $engine = new Battle($attackers, $defenders);
     $startBattle = DebugManager::runDebugged(array($engine, 'startBattle'), array('RunnableTest', 'myErrorHandler'), array('RunnableTest', 'save'));
     $startBattle($debug);
     $micro1 = microtime() - $micro1;
     $memory1 = memory_get_usage() - $memory1;
     $this->report = $engine->getReport();
     $this->time = round(1000 * $micro1, 2);
     $this->memory = round($memory1 / 1000);
     echo $this;
 }
コード例 #3
0
ファイル: WebTest.php プロジェクト: athk/XG-Proyect-v3.x.x
        $playerGroupObj->addPlayer($playerObj);
        return $playerGroupObj;
    }
}
if (isset($_GET['vars'])) {
    $selectedVar = $_GET['vars'];
} elseif (isset($_POST['vars'])) {
    $selectedVar = $_POST['vars'];
} else {
    $selectedVar = 'XG';
}
WebTest::includeVars($selectedVar);
if ($selectedVar == 'XG') {
    LangManager::getInstance()->setImplementation(new XGLangImplementation());
} else {
    LangManager::getInstance()->setImplementation(new MoonsLangImplementation());
}
if (isset($_GET['good'])) {
    session_start();
    if (!isset($_SESSION['vote'])) {
        $_SESSION['vote'] = true;
        $count = file_get_contents('good.txt');
        $count++;
        file_put_contents('good.txt', $count);
    }
    session_write_close();
} elseif (isset($_GET['bad'])) {
    session_start();
    if (!isset($_SESSION['vote'])) {
        $_SESSION['vote'] = true;
        $count = file_get_contents('bad.txt');
コード例 #4
0
ファイル: url.php プロジェクト: eriveltonguedes/atlas_ivs
            exit;
        } else {
            $ltemp = array_shift($gets);
        }
    } else {
        $ltemp = "pt";
        //Caso não tenha pego nenhuma referência de linguagem, na url, o padrão será pt
    }
}
include_once '../config/langs/lang_' . $ltemp . '.php';
//Inclui o arquivo com as variáveis da linguagem atual
$_SESSION["lang"] = $ltemp;
//Salva na variável $_SESSSION, que será usada em todo o sistema, a linguage
include_once '../config/langs/LangManager.php';
//Instancia um objeto da classe LangManager que será a responsável por retornar as strings de internacionalização
$lang_mng = new LangManager($lang_var);
//==========================================================================
$pag = @$gets[0];
if (sizeof($gets) > 1) {
    $pagNext = $gets[1];
} else {
    $pagNext = "";
}
if (sizeof($gets) > 2) {
    $pagNext2 = $gets[2];
} else {
    $pagNext2 = "";
}
if (!empty($pagNext2)) {
    $title = $lang_mng->getString($pagNext2 . "_title_tag");
} else {
コード例 #5
0
foreach ($displayed_sites as $site_index => $current_website) {
    $websitename = Project::getWebsiteName($current_website);
    $website_data_source = Project::getWebsiteDataType($current_website);
    if ($website_data_source == 'lang') {
        $table_headers = "<th>Filename</th><th>URL</th><th>Status</th><th>Translations</th><th>Strings</th><th>Words</th>";
    } else {
        $table_headers = "<th>Filename</th>\n<th>Status</th>\n\n";
    }
    $html_output .= "\n\t<h2 id='{$websitename}'><a href='#{$websitename}'>{$websitename}</a></h2>\n";
    $html_output .= "\t<table class='listpages'>\n        <thead>\n            <tr>{$table_headers}</tr>\n        </thead>\n        <tbody>\n";
    // Totals to display in the table footer
    $total_strings = $total_words = $total_files = 0;
    foreach (Project::getWebsiteFiles($current_website) as $current_filename) {
        if ($website_data_source == 'lang') {
            $reference_locale = Project::getReferenceLocale($current_website);
            $reference_data = LangManager::loadSource($current_website, $reference_locale, $current_filename);
            $get_words = function ($item) {
                return str_word_count(strip_tags($item));
            };
            $nb_words = array_sum(array_map($get_words, $reference_data['strings']));
            $nb_strings = count($reference_data['strings']);
            $total_strings += $nb_strings;
            $total_words += $nb_words;
            $total_files++;
            $html_output .= "<tr>\n";
            // Check if the file is obsolete for all locales
            if (Project::isObsoleteFile($current_website, $current_filename, 'all')) {
                $html_output .= "  <td class='obsolete' title='Obsolete file'>{$current_filename}</td>\n";
            } else {
                $html_output .= "  <td>{$current_filename}</td>\n";
            }
コード例 #6
0
     $supported_locales = Project::getSupportedLocales($current_website, $current_filename, $langfiles_subsets);
     foreach ($supported_locales as $current_locale) {
         if ($current_locale == $reference_locale) {
             // Ignore reference language
             continue;
         }
         if (!file_exists(Project::getLocalFilePath($current_website, $current_locale, $current_filename))) {
             // If the .lang file does not exist, just skip the locale for this file
             continue;
         }
         if (Project::isObsoleteFile($current_website, $current_filename, $current_locale)) {
             // If the .lang file is obsolete, skip it
             continue;
         }
         $locale_analysis = LangManager::analyzeLangFile($current_website, $current_locale, $current_filename, $reference_data);
         $todo = count($locale_analysis['Identical']) + count($locale_analysis['Missing']) + LangManager::countErrors($locale_analysis['errors']);
         $activation_status = $locale_analysis['activated'] ? 'yes' : 'no';
         if ($todo == 0 && $activation_status == 'no') {
             $svn_path = 'http://viewvc.svn.mozilla.org/vc/projects/mozilla.com/trunk/locales/' . $current_locale . '/' . $current_filename;
             $table_rows .= "  <tr>\n";
             $table_rows .= '    <td><a href="./?locale=' . $current_locale . '" title="See full status of this locale">' . $current_locale . "</a></td>\n";
             $table_rows .= '    <td><a href="' . $svn_path . '" target="_blank" title="Open this file on SVN">' . $current_filename . "</a></td>\n";
             $table_rows .= '    <td>' . count($locale_analysis['Identical']) . "</td>\n";
             $table_rows .= '    <td>' . count($locale_analysis['Translated']) . "</td>\n";
             $table_rows .= '    <td>' . count($locale_analysis['Missing']) . "</td>\n";
             $table_rows .= '    <td>' . count($locale_analysis['Obsolete']) . "</td>\n";
             $table_rows .= '    <td>' . $activation_status . "</td>\n";
             $table_rows .= "  </tr>\n";
         }
     }
 }
コード例 #7
0
 public function traduz($lang_key)
 {
     $lang_var = null;
     $ltemp = $this->lang;
     include_once '../../../../config/config_gerais.php';
     include_once '../../../../config/config_path.php';
     include_once '../../../../config/langs/LangManager.php';
     include_once '../../../../config/langs/lang_' . $ltemp . '.php';
     include_once '../../../../config/langs/LangManager.php';
     $lang_mng = new LangManager($lang_var);
     return $lang_mng->getString($lang_key);
 }
コード例 #8
0
 public static function setLang($lang)
 {
     self::$lang = $lang;
 }
コード例 #9
0
ファイル: attack.php プロジェクト: saiikup/XG-Proyect-v3.x.x
 /**
  * attackMission
  *
  * @param array $fleet_row Fleet row
  *
  * @return void
  */
 public function attackMission($fleet_row)
 {
     // null == use default handlers
     $errorHandler = null;
     $exceptionHandler = null;
     $target_planet = parent::$db->query_fetch("SELECT *\n            FROM " . PLANETS . " AS p\n            INNER JOIN " . BUILDINGS . " AS b ON b.building_planet_id = p.`planet_id`\n            INNER JOIN " . SHIPS . " AS s ON s.ship_planet_id = p.`planet_id`\n            INNER JOIN " . DEFENSES . " AS d ON d.defense_planet_id = p.`planet_id`\n            WHERE `planet_galaxy` = " . (int) $fleet_row['fleet_end_galaxy'] . " AND\n                `planet_system` = " . (int) $fleet_row['fleet_end_system'] . " AND\n                `planet_type` = " . (int) $fleet_row['fleet_end_type'] . " AND\n                `planet_planet` = " . (int) $fleet_row['fleet_end_planet'] . ";");
     if ($fleet_row['fleet_mess'] == 0 && $fleet_row['fleet_start_time'] <= time()) {
         $base = dirname(dirname(__DIR__)) . DIRECTORY_SEPARATOR;
         // require several stuff
         require $base . 'libraries' . DIRECTORY_SEPARATOR . 'battle_engine' . DIRECTORY_SEPARATOR . 'utils' . DIRECTORY_SEPARATOR . 'includer.php';
         // require language implementation
         require $base . 'libraries' . DIRECTORY_SEPARATOR . 'missions' . DIRECTORY_SEPARATOR . 'attackLang.php';
         // set language for the reports
         LangManager::getInstance()->setImplementation(new AttackLang($this->_lang));
         if ($fleet_row['fleet_group'] > 0) {
             parent::$db->query("DELETE FROM `" . ACS_FLEETS . "`\n                    WHERE `acs_fleet_id` = '" . (int) $fleet_row['fleet_group'] . "'");
             parent::$db->query("UPDATE `" . FLEETS . "` SET\n                    `fleet_mess` = '1'\n                    WHERE `fleet_group` = '" . $fleet_row['fleet_group'] . "'");
         } else {
             parent::return_fleet($fleet_row['fleet_id']);
         }
         $targetUser = parent::$db->query_fetch("SELECT u.*,\n                    r.*,\n                    pr.*\n                FROM " . USERS . " AS u\n                    INNER JOIN " . RESEARCH . " AS r ON r.research_user_id = u.user_id\n                    INNER JOIN " . PREMIUM . " AS pr ON pr.premium_user_id = u.user_id\n                WHERE u.user_id = '" . intval($target_planet['planet_user_id']) . "';");
         $target_userID = $targetUser['user_id'];
         UpdateResourcesLib::updateResource($targetUser, $target_planet, time());
         //----------------------- prepare players for battle ----------------------
         // attackers fleet sum
         $attackers = new PlayerGroup();
         // If we have a ACS attack
         if ($fleet_row['fleet_group'] != 0) {
             $fleets = parent::$db->query_fetch("SELECT * FROM `" . FLEETS . "` WHERE `fleet_group` = '" . $fleet_row['fleet_group'] . "';");
             $attackers = $this->getPlayerGroupFromQuery($fleets);
         } else {
             $attackers = $this->getPlayerGroup($fleet_row);
         }
         // defenders fleet sum
         $def = parent::$db->query("SELECT * FROM `" . FLEETS . "` \n                WHERE `fleet_end_galaxy` = '" . $fleet_row['fleet_end_galaxy'] . "' AND \n                    `fleet_end_system` = '" . $fleet_row['fleet_end_system'] . "' AND \n                    `fleet_end_type` = '" . $fleet_row['fleet_end_type'] . "' AND \n                    `fleet_end_planet` = '" . $fleet_row['fleet_end_planet'] . "' AND\n                    `fleet_start_time` < '" . time() . "' AND \n                    `fleet_end_stay` >= '" . time() . "';");
         $defenders = $this->getPlayerGroupFromQuery($def, $targetUser);
         //defenses sum
         $homeFleet = new HomeFleet(0);
         for ($i = self::DEFENSE_MIN_ID; $i < self::DEFENSE_MAX_ID; $i++) {
             if (isset($this->_resource[$i]) && isset($target_planet[$this->_resource[$i]])) {
                 if ($target_planet[$this->_resource[$i]] != 0) {
                     $homeFleet->addShipType($this->getShipType($i, $target_planet[$this->_resource[$i]]));
                 }
             }
         }
         for ($i = self::SHIP_MIN_ID; $i < self::SHIP_MAX_ID; $i++) {
             if (isset($this->_resource[$i]) && isset($target_planet[$this->_resource[$i]])) {
                 if ($target_planet[$this->_resource[$i]] != 0) {
                     $homeFleet->addShipType($this->getShipType($i, $target_planet[$this->_resource[$i]]));
                 }
             }
         }
         if (!$defenders->existPlayer($target_userID)) {
             $player = new Player($target_userID, array($homeFleet));
             $player->setTech($targetUser['research_weapons_technology'], $targetUser['research_shielding_technology'], $targetUser['research_armour_technology']);
             $player->setName($targetUser['user_name']);
             $defenders->addPlayer($player);
         } else {
             $defenders->getPlayer($target_userID)->addDefense($homeFleet);
         }
         //-------------------------------------------------------------------------
         //------------------------------ battle -----------------------------------
         $battle = new Battle($attackers, $defenders);
         $startBattle = DebugManager::runDebugged(array($battle, 'startBattle'), $errorHandler, $exceptionHandler);
         $startBattle();
         //-------------------------------------------------------------------------
         //-------------------------- after battle stuff ---------------------------
         $report = $battle->getReport();
         $steal = $this->updateAttackers($report->getPresentationAttackersFleetOnRound('START'), $report->getAfterBattleAttackers(), $target_planet);
         $report->setSteal($steal);
         $this->updateDefenders($report->getPresentationDefendersFleetOnRound('START'), $report->getAfterBattleDefenders(), $target_planet, $steal);
         $this->updateDebris($fleet_row, $report);
         $this->updateMoon($fleet_row, $report, '', $target_userID, $target_planet);
         $this->sendMessage($fleet_row, $report);
     } elseif ($fleet_row['fleet_end_time'] <= time()) {
         $message = sprintf($this->_lang['sys_fleet_won'], $target_planet['planet_name'], Fleets_Lib::target_link($fleet_row, ''), Format_Lib::pretty_number($fleet_row['fleet_resource_metal']), $this->_lang['Metal'], Format_Lib::pretty_number($fleet_row['fleet_resource_crystal']), $this->_lang['Crystal'], Format_Lib::pretty_number($fleet_row['fleet_resource_deuterium']), $this->_lang['Deuterium']);
         Functions_Lib::send_message($fleet_row['fleet_owner'], '', $fleet_row['fleet_end_time'], 1, $this->_lang['sys_mess_tower'], $this->_lang['sys_mess_fleetback'], $message);
         parent::restore_fleet($fleet_row);
         parent::remove_fleet($fleet_row['fleet_id']);
     }
 }
コード例 #10
0
ファイル: WebTest.php プロジェクト: Gritch69/XG-Project
            die("<meta http-equiv=\"refresh\" content=2;\"WebTest.php\">There should be at least an attacker and defender");
        }
        $playerGroupObj = new PlayerGroup();
        $playerGroupObj->addPlayer($playerObj);
        return $playerGroupObj;
    }
}
if (isset($_GET['vars'])) {
    $selectedVar = $_GET['vars'];
} elseif (isset($_POST['vars'])) {
    $selectedVar = $_POST['vars'];
} else {
    $selectedVar = 'XG';
}
WebTest::includeVars($selectedVar);
LangManager::getInstance()->setImplementation(new LangImplementation($selectedVar));
if (isset($_GET['good'])) {
    session_start();
    if (!isset($_SESSION['vote'])) {
        $_SESSION['vote'] = true;
        $count = file_get_contents('good.txt');
        $count++;
        file_put_contents('good.txt', $count);
    }
    session_write_close();
} elseif (isset($_GET['bad'])) {
    session_start();
    if (!isset($_SESSION['vote'])) {
        $_SESSION['vote'] = true;
        $count = file_get_contents('bad.txt');
        $count++;
コード例 #11
0
             $todo_files .= "    <ul>\n";
             foreach ($locale_analysis['Missing'] as $missing_string) {
                 $todo_files .= "      <li>" . htmlspecialchars(Utils::cleanString($missing_string)) . "</li>\n";
             }
             $todo_files .= "    </ul>\n";
         }
         if (LangManager::countErrors($locale_analysis['errors'])) {
             if (LangManager::countErrors($locale_analysis['errors'], 'python')) {
                 $todo_files .= "\n    <h3>Errors in variables in the sentence:</h3>\n";
                 $todo_files .= "    <ul>\n";
                 foreach ($locale_analysis['errors']['python'] as $stringid => $python_error) {
                     $todo_files .= "              <table class='python'>\n                        <tr>\n                          <th>Check the following variables: <strong style='color:red'>{$python_error['var']}</strong></th>\n                        </tr>\n                        <tr>\n                          <td>" . Utils::highlightPythonVar($stringid) . "</td>\n                        </tr>\n                        <tr>\n                          <td>" . Utils::highlightPythonVar($python_error['text']) . "</td>\n                        </tr>\n                      </table>\n";
                 }
                 $todo_files .= "    </ul>\n";
             }
             if (LangManager::countErrors($locale_analysis['errors'], 'length')) {
                 $todo_files .= "\n    <h3>Some strings are longer than allowed:</h3>\n";
                 $todo_files .= "    <ul>\n";
                 foreach ($locale_analysis['errors']['length'] as $stringid => $length_error) {
                     $todo_files .= "<li>" . htmlspecialchars($length_error['text']) . "<br/><em>Currently {$length_error['current']} characters long (maximum allowed {$length_error['limit']})</em></li>";
                 }
                 $todo_files .= "    </ul>\n";
             }
         }
         $todo_files .= "  </div>\n";
         if (count($locale_analysis['Identical']) > 0) {
             $todo_files .= "  <div class='tip'>\n" . "    <p><strong>Tip:</strong> if it is normal that a string is identical\n" . "     to the English one for your language, just add <code>{ok}</code>\n" . "     to your string and it will no longer be listed as \"identical\"\n" . "     Example: </p><blockquote>;Plugins<br/>Plugins {ok}</blockquote>\n" . "  </div>\n";
         }
     }
 }
 if ($done_files != '') {
コード例 #12
0
ファイル: header.php プロジェクト: eriveltonguedes/atlas_ivs
?>
assets/js/styleRadioCheckbox.js" type="text/javascript"></script>

        <script	src="system/modules/seletor-espacialidade/view/js/search-component.js"></script>
        <script type="text/javascript" src="<?php 
echo $path_dir;
?>
config/langs/LangManager.js"></script>
        <script type="text/javascript" src="<?php 
echo $path_dir;
?>
assets/js/app.js"></script>

        <?php 
include_once '../config/langs/LangManager.php';
$lang_mng = new LangManager($lang_var);
?>

        <script type="text/javascript">
            var global_pvt_lang_object = <?php 
echo json_encode($lang_var);
?>
;
            var lang_mng = new LangManager();
        </script>

        <!-- tags seo facebook -->
        <?php 
$meta_title = isset($meta_title) ? $meta_title : isset($meta_title2) ? $meta_title2 : '';
$geral_title = $lang_mng->getString("geral_title");
if (!isset($title)) {