function editLanguageForm() { $langID = (int) $_GET['editLanguageID']; $resLang = mysql_query('SELECT `Name`, `Flag` FROM `LocalizationLanguages` WHERE `ID` = ' . $langID); if (mysql_num_rows($resLang) <= 0) { return PopupPageTemplate('Edit Language', messageTemplate('<font color="red">Error: language does not exist.</font>')); } function updateLanguage($langID) { $langID = (int) $langID; $newLanguageName = get_magic_quotes_gpc() ? $_POST['LanguageName'] : addslashes($_POST['LanguageName']); $sNewFlag = htmlspecialchars_adv($_POST['Flag']); if (strlen($newLanguageName) <= 0) { return '<font color="red">Error: language name not specified.</font>'; } mysql_query("UPDATE `LocalizationLanguages` SET `Name`='{$newLanguageName}', `Flag` = '{$sNewFlag}' WHERE `ID` = {$langID}"); if (mysql_affected_rows() > 0) { return 'Language has been successfully updated.'; } return '<font color="red">Error: language could not be updated.</font>'; } if (isset($_POST['UpdateLanguage'])) { return PopupPageTemplate('Edit Language', messageTemplate(updateLanguage($langID))); } $arrLang = mysql_fetch_assoc($resLang); ob_start(); $isLangDefault = getParam('lang_default') == $arrLang['Name']; ?> <form action="<?php echo $_SERVER['PHP_SELF']; ?> ?view=editLanguage&editLanguageID=<?php echo $langID; ?> " method="post"> <table> <tr> <td>Language name:</td> <td><input name="LanguageName" type="text" value="<?php echo htmlspecialchars($arrLang['Name']); ?> " <?php echo getParam('lang_default') == $arrLang['Name'] ? 'disabled' : ''; ?> /></td> </tr> <tr> <td>Flag:</td> <td><?php echo showLangIcons($arrLang['Flag']); ?> </td> </tr> </table> <br /> <center><input type="submit" name="UpdateLanguage" value="Save Changes" /></center> </form> <?php $contents = ob_get_contents(); ob_end_clean(); return PopupPageTemplate('Edit Language', $contents); }
exec("hostapd_cli -p /var/run/hostapd-phy0 karma_del_ssid " . $_POST[ssidBW]); $message = "\"" . $_POST[ssidBW] . "\" " . $strings["config-message-removed"] . "<br /><br />"; } } if (isset($_POST[macBW])) { if (isset($_POST[addMAC])) { exec("hostapd_cli -p /var/run/hostapd-phy0 karma_add_black_mac " . $_POST[macBW]); $message = "\"" . $_POST[macBW] . "\" " . $strings["config-message-added"] . "<br /><br />"; } if (isset($_POST[removeMAC])) { exec("hostapd_cli -p /var/run/hostapd-phy0 karma_add_white_mac " . $_POST[macBW]); $message = "\"" . $_POST[macBW] . "\" " . $strings["config-message-removed"] . "<br /><br />"; } } if (isset($_POST[language])) { updateLanguage($_POST[language]); $languageFile = "includes/languages/" . $_POST[language] . "-" . $version . ".php"; if (file_exists($languageFile)) { require $languageFile; } else { require "includes/languages/english-" . $version . ".php"; } $languageMessage = "<font color=lime>" . $strings["config-language-message"] . " {$_POST['language']}.</font><br />"; $languageMessage2 = "<font color=lime><script type='text/javascript'>setTimeout(\"window.location='index.php?config'\", 1300);</script>" . $strings["config-language-message2"] . "<br /><br />"; } if (isset($_GET[updateLanguages])) { $connection = @file_get_contents("http://cloud.wifipineapple.com/ip.php"); if (trim($connection) != "") { exec("wget -O /tmp/languages.tar.gz \"http://cloud.wifipineapple.com/?downloads&languages={$version}\""); exec("tar -C /tmp/ -zxvf /tmp/languages.tar.gz"); exec("cp /tmp/downloads/* /pineapple/includes/languages/");
function editLanguageForm() { $langID = (int) $_GET['editLanguageID']; $resLang = db_res('SELECT `Name`, `Flag`, `Title` FROM `LocalizationLanguages` WHERE `ID` = ' . $langID); if (!mysql_num_rows($resLang)) { return PopupPageTemplate('Edit Language', messageTemplate('<font color="red">Error: language does not exist.</font>')); } function updateLanguage($langID) { $langID = (int) $langID; $newLanguageName = process_db_input($_POST['LanguageName']); $sNewFlag = process_db_input($_POST['Flag']); $newLanguageTitle = process_db_input($_POST['LanguageTitle']); if (!strlen($newLanguageName)) { return '<font color="red">Error: language name not specified.</font>'; } $sQuery = "\r\n\t\t\tUPDATE `LocalizationLanguages` SET\r\n\t\t\t\t`Name`='{$newLanguageName}',\r\n\t\t\t\t`Title`='{$newLanguageTitle}',\r\n\t\t\t\t`Flag` = '{$sNewFlag}'\r\n\t\t\tWHERE `ID` = {$langID}"; db_res($sQuery); if (mysql_affected_rows()) { return 'Language has been successfully updated.'; } return '<font color="red">Error: language could not be updated.</font>'; } if (isset($_POST['UpdateLanguage'])) { return PopupPageTemplate('Edit Language', messageTemplate(updateLanguage($langID))); } $arrLang = mysql_fetch_assoc($resLang); ob_start(); $isLangDefault = getParam('lang_default') == $arrLang['Name']; ?> <form action="<?php echo $_SERVER['PHP_SELF']; ?> ?view=editLanguage&editLanguageID=<?php echo $langID; ?> " method="post"> <table> <tr> <td>Language title:</td> <td> <input name="LanguageTitle" type="text" value="<?php echo htmlspecialchars($arrLang['Title']); ?> " /> </td> </tr> <tr> <td>Language code:</td> <td> <input name="LanguageName" type="text" value="<?php echo htmlspecialchars($arrLang['Name']); ?> " <?php echo getParam('lang_default') == $arrLang['Name'] ? 'disabled' : ''; ?> /> </td> </tr> <tr> <td>Flag:</td> <td><?php echo showLangIcons($arrLang['Flag']); ?> </td> </tr> </table> <br /> <center><input type="submit" name="UpdateLanguage" value="Save Changes" /></center> </form> <?php return PopupPageTemplate('Edit Language', ob_get_clean()); }
$language = $_POST['language']; $languageErr = ""; } if (empty($_POST["level"])) { $levelErr = "Level is required"; } else { $level = $_POST['level']; $levelErr = ""; /*if ($level<1 || $level>100) { $levelErr = "Level must be a value between 1 and 100"; }*/ } } if ($languageErr == "" && $levelErr == "") { if (languageExists($_SESSION["loggedIn"], $language)) { updateLanguage($_SESSION["loggedIn"], $level, $language); } else { addLanguage($_SESSION["loggedIn"], $level, $language); } echo "You have updated your " . $language . " level to be " . $level . "! <br>"; } ?> </div> </div> </div> <style> .error {color: #FF0000;} </style> </header> </div>
function processLanguage($action, $id, $name, $description, $status) { if ($action == 'showoption') { $languageOpt = languageOption($id); echo $languageOpt; return; } if ($action == 'show' || $action == 'add') { $languageDetail = showLanguage($action, $id); echo json_encode(array('form' => $languageDetail)); return; } $show_id = updateLanguage($action, $id, $name, $description, $status); if ($action == 'update' || $action == 'addnew') { $languageDetail = showLanguage('show', $show_id); $languageOpt = languageOption($show_id); $rt = array('form' => $languageDetail, 'Opt' => $languageOpt, 'msg' => 'Language added/updated'); echo json_encode($rt); return; } if ($action == 'delete') { if (isset($show_id)) { $rt['msg'] = $show_id; echo json_encode($rt); return; } $languageOpt = languageOption(0); $rt = array('form' => '', 'Opt' => $languageOpt, 'msg' => 'Language deleted'); echo json_encode($rt); return; } }
require 'lib/recursivetokenizer.php'; if (!isset($argv[1])) { die("Usage: generatetranslation.php <langName>|all\n"); } if ($argv[1] == "all") { if ($handle = opendir('../lib/lang/')) { while (false !== ($entry = readdir($handle))) { if (preg_match("/^(.*)_lang\\.php\$/", $entry, $matches)) { $lang = $matches[1]; updateLanguage($lang); } } closedir($handle); } } else { updateLanguage($argv[1]); } print "Done!\n"; function updateLanguage($lang) { global $messages, $languagePack; echo $lang, "... "; ob_start(); $messages = array(); $languagePack = array(); $langFile = "../lib/lang/" . $lang . "_lang.php"; if (file_exists($langFile)) { include $langFile; } echo "<?php\n\$languagePack = array(\n"; recurse('find_strings');