Localization: remove search-group and move strings to main

Profiler: implemented frontpage (?profiler)
Announcements: parse for STATIC_URL and HOST_URL
This commit is contained in:
Sarjuuk
2014-07-24 20:37:30 +02:00
parent 6acee41e3d
commit 48527b0b68
15 changed files with 172 additions and 53 deletions

View File

@@ -346,6 +346,7 @@ class User
// existing chars on realm(s) // existing chars on realm(s)
$characters = array( $characters = array(
array( array(
'id' => $character['id'],
'name' => $character['name'], 'name' => $character['name'],
'realmname' => $character['realm'][1], 'realmname' => $character['realm'][1],
'region' => $character['region'][0], 'region' => $character['region'][0],

View File

@@ -8,9 +8,6 @@ class Lang
public static $mail; public static $mail;
public static $game; public static $game;
public static $search;
public static $profiler;
public static $achievement; public static $achievement;
public static $class; public static $class;
public static $currency; public static $currency;

View File

@@ -105,6 +105,11 @@ $lang = array(
// profiler // profiler
'realm' => "Realm", 'realm' => "Realm",
'region' => "Region", 'region' => "Region",
'viewCharacter' => "Charakter anzeigen",
'_cpHead' => "Charakter-Profiler",
'_cpHint' => "Der <b>Charakter-Profiler</b> gibt Euch die Möglichkeit, Euren Charakter zu editieren, bessere Ausrüstung zu finden, Eure Gearscore zu überprüfen, und mehr!",
'_cpHelp' => "Um loszulegen, folgt einfach den untenstehenden Schritten. Falls Ihr mehr Informationen benötigt, schaut auf unserer ausführlichen <a href=\"?help=profiler\">Hilfeseite</a> nach.",
'_cpFooter' => "Falls Ihr eine genauere Suche möchtet, probiert unsere <a href=\"?profiles\">erweiterten Suchoptionen</a>. Ihr könnt außerdem ein <a href=\"?profile&amp;new\">neues individuelles Profil</a> erstellen.",
// help // help
'help' => "Hilfe", 'help' => "Hilfe",
@@ -113,17 +118,17 @@ $lang = array(
"Talentrechner", "Gegenstandsvergleich", "Profiler" "Talentrechner", "Gegenstandsvergleich", "Profiler"
), ),
// formating // search
'colon' => ': ',
'dateFmtShort' => "d.m.Y",
'dateFmtLong' => "d.m.Y \u\m H:i"
),
'search' => array(
'search' => "Suche", 'search' => "Suche",
'foundResult' => "Suchergebnisse für", 'foundResult' => "Suchergebnisse für",
'noResult' => "Keine Ergebnisse für", 'noResult' => "Keine Ergebnisse für",
'tryAgain' => "Bitte versucht es mit anderen Suchbegriffen oder überprüft deren Schreibweise.", 'tryAgain' => "Bitte versucht es mit anderen Suchbegriffen oder überprüft deren Schreibweise.",
'ignoredTerms' => "Die folgenden Wörter wurden in Eurer Suche ignoriert: %s" 'ignoredTerms' => "Die folgenden Wörter wurden in Eurer Suche ignoriert: %s",
// formating
'colon' => ': ',
'dateFmtShort' => "d.m.Y",
'dateFmtLong' => "d.m.Y \u\m H:i"
), ),
'game' => array( 'game' => array(
'achievement' => "Erfolg", 'achievement' => "Erfolg",

View File

@@ -100,6 +100,11 @@ $lang = array(
// profiler // profiler
'realm' => "Realm", 'realm' => "Realm",
'region' => "Region", 'region' => "Region",
'viewCharacter' => "View Character",
'_cpHead' => "Character Profiler",
'_cpHint' => "The <b>Character Profiler</b> lets you edit your character, find gear upgrades, check your gearscore and more!",
'_cpHelp' => "To get started, just follow the steps below. If you'd like more information, check out our extensive <a href=\"?help=profiler\">help page</a>.",
'_cpFooter' => "If you want a more refined search try out our <a href=\"?profiles\">advanced search</a> options. You can also create a <a href=\"?profile&amp;new\">new custom profile</a>.",
// help // help
'help' => "Help", 'help' => "Help",
@@ -108,17 +113,17 @@ $lang = array(
"Talent Calculator", "Item Comparison", "Profiler" "Talent Calculator", "Item Comparison", "Profiler"
), ),
// formating // search
'colon' => ': ',
'dateFmtShort' => "Y/m/d",
'dateFmtLong' => "Y/m/d \a\\t H:i"
),
'search' => array(
'search' => "Search", 'search' => "Search",
'foundResult' => "Search Results for", 'foundResult' => "Search Results for",
'noResult' => "No Results for", 'noResult' => "No Results for",
'tryAgain' => "Please try some different keywords or check your spelling.", 'tryAgain' => "Please try some different keywords or check your spelling.",
'ignoredTerms' => "The following words were ignored in your search: %s" 'ignoredTerms' => "The following words were ignored in your search: %s",
// formating
'colon' => ': ',
'dateFmtShort' => "Y/m/d",
'dateFmtLong' => "Y/m/d \a\\t H:i"
), ),
'game' => array( 'game' => array(
'achievement' => "achievement", 'achievement' => "achievement",

View File

@@ -105,6 +105,11 @@ $lang = array(
// profiler // profiler
'realm' => "Reino", 'realm' => "Reino",
'region' => "Región", 'region' => "Región",
'viewCharacter' => "View Character",
'_cpHead' => "Perfiles de Personaje",
'_cpHint' => "l <b>Gestor de perfiles</b> te permite editar tu personaje, encontrar mejoras de equipo, comprobar tu gearscore, ¡y más!",
'_cpHelp' => "Para comenzar, sigue los pasos abajo indicados. Si quieres más información, revisa nuestra amplia <a href=\"?help=profiler\">página de ayuda</a>.",
'_cpFooter' => "Si quieres una búsqueda más refinada, prueba con nuestras opciones de <a href=\"?profiles\">búsqueda avanzada</a>. También puedes crear un <a href=\"?profile&amp;new\">perfil nuevo personalizado</a>.",
// help // help
'help' => "Ayuda", 'help' => "Ayuda",
@@ -113,17 +118,17 @@ $lang = array(
"Calculadora de talentos", "Comparación de objetos", "Perfiles" "Calculadora de talentos", "Comparación de objetos", "Perfiles"
), ),
// formating // search
'colon' => ': ',
'dateFmtShort' => "d/m/Y",
'dateFmtLong' => "d/m/Y \a \l\a\s H:i"
),
'search' => array(
'search' => "Búsqueda", 'search' => "Búsqueda",
'foundResult' => "Resultados de busqueda para", 'foundResult' => "Resultados de busqueda para",
'noResult' => "Ningún resultado para", 'noResult' => "Ningún resultado para",
'tryAgain' => "Por favor, introduzca otras palabras claves o verifique el término ingresado.", 'tryAgain' => "Por favor, introduzca otras palabras claves o verifique el término ingresado.",
'ignoredTerms' => "Las siguientes palabras fueron ignoradas en tu búsqueda: %s" 'ignoredTerms' => "Las siguientes palabras fueron ignoradas en tu búsqueda: %s",
// formating
'colon' => ': ',
'dateFmtShort' => "d/m/Y",
'dateFmtLong' => "d/m/Y \a \l\a\s H:i"
), ),
'game' => array( 'game' => array(
'achievement' => "logro", 'achievement' => "logro",

View File

@@ -105,6 +105,11 @@ $lang = array(
// profiler // profiler
'realm' => "Royaume", 'realm' => "Royaume",
'region' => "Région", 'region' => "Région",
'viewCharacter' => "Voir Personnage",
'_cpHead' => "Profiler de Personnage",
'_cpHint' => "Le <b>Profiler de Personnage</b> vous permets de modifier votre personnage, trouver des améliorations d'équipement, vérifier votre score d'équipement et plus!",
'_cpHelp' => "Pour débuter, suivez simplement les étapes ci-dessous. Si vous voulez plus d'information, lisez notre <a href=\"?help=profiler\">page d'aide</a> détaillée.",
'_cpFooter' => "Si vous voulez une recherche plus raffinée, essayez nos options de <a href=\"?profiles\">recherche avancée</a>. Vous pouvez aussi créer un <a href=\"?profile&amp;new\">nouveau profile personnalisé</a>.",
// help // help
'help' => "Aide", 'help' => "Aide",
@@ -113,17 +118,17 @@ $lang = array(
"Calculateur de talents", "Comparaison d'objets", "Profiler" "Calculateur de talents", "Comparaison d'objets", "Profiler"
), ),
// formating // search
'colon' => ' : ',
'dateFmtShort' => "Y-m-d",
'dateFmtLong' => "Y-m-d à H:i"
),
'search' => array(
'search' => "Recherche", 'search' => "Recherche",
'foundResult' => "Résultats de recherche pour", 'foundResult' => "Résultats de recherche pour",
'noResult' => "Aucun résultat pour malordawsne", 'noResult' => "Aucun résultat pour malordawsne",
'tryAgain' => "Veuillez essayer d'autres mots ou vérifiez l'orthographe des termes de recherche.", 'tryAgain' => "Veuillez essayer d'autres mots ou vérifiez l'orthographe des termes de recherche.",
'ignoredTerms' => "Les mots suivants ont été ignorés dans votre recherches : %s" 'ignoredTerms' => "Les mots suivants ont été ignorés dans votre recherches : %s",
// formating
'colon' => ' : ',
'dateFmtShort' => "Y-m-d",
'dateFmtLong' => "Y-m-d à H:i"
), ),
'game' => array ( 'game' => array (
'achievement' => "haut fait", 'achievement' => "haut fait",

View File

@@ -21,7 +21,7 @@ $lang = array(
'link' => "Ссылка", 'link' => "Ссылка",
'signIn' => "Вход / Регистрация", 'signIn' => "Вход / Регистрация",
'jsError' => "Для работы этого сайта необходим JavaScript.", 'jsError' => "Для работы этого сайта необходим JavaScript.",
'searchButton' => "Искать", 'searchButton' => "Поиск",
'language' => "Язык", 'language' => "Язык",
'feedback' => "Отзыв", 'feedback' => "Отзыв",
'numSQL' => "Количество MySQL запросов", 'numSQL' => "Количество MySQL запросов",
@@ -105,6 +105,11 @@ $lang = array(
// profiler // profiler
'realm' => "Игровой мир", 'realm' => "Игровой мир",
'region' => "Регион", 'region' => "Регион",
'viewCharacter' => "Открыть персонажа",
'_cpHead' => "Профили персонажей",
'_cpHint' => "<b>Профили персонажей</b> позволяет вам редактировать своего персонажа, находить улучшения предметов и многое другое!",
'_cpHelp' => "Чтобы начать использовать профили персонажей, следуйте инструкциям ниже. Если вам потребуется помощь, вы можете обратиться к <a href=\"?help=profiler\">справке</a>.",
'_cpFooter' => "Если вам нужен более точный поиск, вы можете использовать <a href=\"?profiles\">дополнительные опции</a>. Также, вы можете создать <a href=\"?profile&amp;new\">новый собственный профиль</a>.",
// help // help
'help' => "Справка", 'help' => "Справка",
@@ -113,17 +118,17 @@ $lang = array(
"Расчёт талантов", "Сравнение предметов", "Профили персонажей" "Расчёт талантов", "Сравнение предметов", "Профили персонажей"
), ),
// formating // search
'colon' => ": ",
'dateFmtShort' => "Y-m-d",
'dateFmtLong' => "Y-m-d в H:i"
),
'search' => array(
'search' => "Поиск", 'search' => "Поиск",
'foundResult' => "Результаты поиска для", 'foundResult' => "Результаты поиска для",
'noResult' => "Ничего не найдено для", 'noResult' => "Ничего не найдено для",
'tryAgain' => "Пожалуйста, попробуйте другие ключевые слова или проверьте правильность запроса.", 'tryAgain' => "Пожалуйста, попробуйте другие ключевые слова или проверьте правильность запроса.",
'ignoredTerms' => "[Следующие слова были проигнорированы в вашему запросу]: %s" 'ignoredTerms' => "[Следующие слова были проигнорированы в вашему запросу]: %s",
// formating
'colon' => ": ",
'dateFmtShort' => "Y-m-d",
'dateFmtLong' => "Y-m-d в H:i"
), ),
'game' => array( 'game' => array(
'achievement' => "достижение", 'achievement' => "достижение",

View File

@@ -288,7 +288,7 @@ class GenericPage
'mode' => 1, 'mode' => 1,
'status' => 1, 'status' => 1,
'name' => 'internal error', 'name' => 'internal error',
'style' => 'padding-left: 40px; background-image: url(static/images/announcements/warn-small.png); background-size: 15px 15px; background-position: 12px center; border: dashed 2px #C03030;', 'style' => 'padding-left: 40px; background-image: url('.STATIC_URL.'/images/announcements/warn-small.png); background-size: 15px 15px; background-position: 12px center; border: dashed 2px #C03030;',
'text' => '[span id=inputbox-error]'.implode("[br]", $_).'[/span]', 'text' => '[span id=inputbox-error]'.implode("[br]", $_).'[/span]',
); );
} }
@@ -301,7 +301,13 @@ class GenericPage
{ {
if ($t = Util::localizedString($v, 'text')) if ($t = Util::localizedString($v, 'text'))
{ {
$ann[$k]['text'] = $t; $replace = array(
'HOST_URL' => HOST_URL,
'STATIC_URL' => STATIC_URL
);
$ann[$k]['text'] = strtr($t, $replace);
$ann[$k]['style'] = strtr($ann[$k]['style'], $replace);
$this->announcements[] = $ann[$k]; $this->announcements[] = $ann[$k];
} }
} }

View File

@@ -37,8 +37,9 @@ class ProfilePage extends GenericPage
if (count($_) == 1 && intVal($_[0])) if (count($_) == 1 && intVal($_[0]))
{ {
if ($_ = DB::Aowow()->selectCell('SELECT 2161862')) // some query to validate existence of char // todo: some query to validate existence of char
$this->profileId = $_; if ($foo = DB::Aowow()->selectCell('SELECT 2161862'))
$this->profileId = $foo;
else else
$this->notFound(Util::ucFirst(Lang::$game['profile'])); $this->notFound(Util::ucFirst(Lang::$game['profile']));
@@ -47,7 +48,8 @@ class ProfilePage extends GenericPage
} }
else if (count($_) == 3) else if (count($_) == 3)
{ {
if ($foo = DB::Aowow()->selectCell('SELECT 2161862')) // some query to validate existence of char // todo: some query to validate existence of char
if ($foo = DB::Aowow()->selectCell('SELECT 2161862'))
$this->profileId = $foo; $this->profileId = $foo;
else else
$this->notFound(Util::ucFirst(Lang::$game['profile'])); $this->notFound(Util::ucFirst(Lang::$game['profile']));

29
pages/profiler.php Normal file
View File

@@ -0,0 +1,29 @@
<?php
if (!defined('AOWOW_REVISION'))
die('illegal access');
class ProfilerPage extends GenericPage
{
protected $path = [1, 5];
protected $tabId = 1;
protected $tpl = 'profiler';
protected $gDataKey = true;
protected $js = ['profile_all.js', 'profile.js'];
protected $css = [['path' => 'Profiler.css']];
protected function generateContent()
{
$this->addJS('?data=realms&locale='.User::$localeId.'&t='.$_SESSION['dataKey']);
}
protected function generatePath() { }
protected function generateTitle()
{
array_unshift($this->title, Util::ucFirst(Lang::$main['_cpHead']));
}
}
?>

View File

@@ -179,7 +179,7 @@ class SearchPage extends GenericPage
protected function generateTitle() protected function generateTitle()
{ {
array_unshift($this->title, $this->search, Lang::$search['search']); array_unshift($this->title, $this->search, Lang::$main['search']);
} }
protected function generatePath() { } protected function generatePath() { }

View File

@@ -586,7 +586,7 @@ var PageTemplate = new function()
locale.description, locale.description,
g_host + '?locale=' + locale.id, // sarjuuk: edited for unsupported subdomains # linkBefore + locale.domain + linkAfter g_host + '?locale=' + locale.id, // sarjuuk: edited for unsupported subdomains # linkBefore + locale.domain + linkAfter
null, // more custom null, // more custom
{rel: linkBefore + linkAfter + " domain=" + locale.domain} // also custom {rel: location.href + " domain=" + locale.domain} // also custom
]; ];
if(locale.id == localeId) if(locale.id == localeId)

View File

@@ -638,7 +638,7 @@ function pr_DirectLookup(form, browse)
if(browse) if(browse)
{ {
if(region.val() || server.val() || name.val()) if(region.val() || server.val() || name.val())
location.href = '/profiles' + (region.val() ? '=' + region.val() + (server.val() ? '.' + g_urlize(server.val(), false, true) : '') : '') + (name.val() ? '?filter=na=' + name.val() + ';ex=on' : ''); location.href = '?profiles' + (region.val() ? '=' + region.val() + (server.val() ? '.' + g_urlize(server.val(), false, true) : '') : '') + (name.val() ? '?filter=na=' + name.val() + ';ex=on' : '');
return false; return false;
} }
@@ -673,7 +673,7 @@ function pr_DirectLookup(form, browse)
if(region.val() && server.val()) if(region.val() && server.val())
usePath = false; usePath = false;
location.href = (usePath ? menuItem[2].replace('profiles', 'profile') : '/profile=' + region.val() + '.' + g_urlize(server.val(), false, true)) + '.' + g_cleanCharacterName(name.val()); location.href = (usePath ? menuItem[2].replace('profiles', 'profile') : '?profile=' + region.val() + '.' + g_urlize(server.val(), false, true)) + '.' + g_cleanCharacterName(name.val());
return false; return false;
} }

View File

@@ -0,0 +1,59 @@
<?php $this->brick('header'); ?>
<div class="main" id="main">
<div class="main-precontents" id="main-precontents"></div>
<div class="main-contents" id="main-contents">
<?php
$this->brick('announcement');
$this->brick('pageTemplate');
?>
<div class="text">
<h1><?php echo Lang::$main['_cpHead']; ?></h1>
<p><?php echo Lang::$main['_cpHint']; ?></p>
<div class="pad"></div>
<p><?php echo Lang::$main['_cpHelp']; ?></p>
<div class="profiler-home">
<div>
<h2><?php echo Util::ucFirst(Lang::$main['name']).Lang::$main['colon']; ?></h2>
<input type="text" name="na" value="" />
</div>
<div>
<h2><?php echo Lang::$main['region'].Lang::$main['colon']; ?></h2>
<input type="radio" name="rg" value="us" id="rg-1" checked="checked" /><label for="rg-1" class="profiler-button profiler-option-left selected"><em><i>US &amp; Oceanic</i></em></label>
<input type="radio" name="rg" value="eu" id="rg-2" /><label for="rg-2" class="profiler-button profiler-option-right"><em><i>Europe</i></em></label>
</div>
<div>
<h2><?php echo Lang::$main['realm'].Lang::$main['colon']; ?></h2>
<input type="text" name="sv" autocomplete="off" />
<div class="profiler-autocomplete"></div>
</div>
<div class="profiler-buttons">
<a href="javascript:;" class="profiler-button" id="profiler-lookup"><em><?php echo Lang::$main['viewCharacter']; ?></em></a>
<a href="javascript:;" class="profiler-button" id="profiler-search"><em><?php echo Lang::$main['searchButton']; ?></em></a>
</div>
</div>
<div class="clear pad3"></div>
<p><?php echo Lang::$main['_cpFooter']; ?></p>
</div>
<script type="text/javascript">//<![CDATA[
pr_initProfilerHome();
//]]></script>
<div class="clear"></div>
</div><!-- main-contents -->
</div><!-- main -->
<?php $this->brick('footer'); ?>

View File

@@ -14,9 +14,9 @@ $this->brick('pageTemplate');
<a href="<?php echo Util::$wowheadLink; ?>" class="button-red"><em><b><i>Wowhead</i></b><span>Wowhead</span></em></a> <a href="<?php echo Util::$wowheadLink; ?>" class="button-red"><em><b><i>Wowhead</i></b><span>Wowhead</span></em></a>
<?php <?php
if ($this->lvTabs): if ($this->lvTabs):
echo ' <h1>'.Lang::$search['foundResult'].' <i>'.Util::htmlEscape($this->search).'</i>'; echo ' <h1>'.Lang::$main['foundResult'].' <i>'.Util::htmlEscape($this->search).'</i>';
if ($this->invalid): if ($this->invalid):
echo '<span class="sub">'.sprintf(Lang::$search['ignoredTerms'], implode(', ', $this->invalid)).'</span>'; echo '<span class="sub">'.sprintf(Lang::$main['ignoredTerms'], implode(', ', $this->invalid)).'</span>';
endif; endif;
echo "</h1>\n"; echo "</h1>\n";
?> ?>
@@ -25,16 +25,16 @@ if ($this->lvTabs):
$this->brick('lvTabs'); $this->brick('lvTabs');
else: else:
echo ' <h1>'.Lang::$search['noResult'].' <i>'.Util::htmlEscape($this->search).'</i>'; echo ' <h1>'.Lang::$main['noResult'].' <i>'.Util::htmlEscape($this->search).'</i>';
if ($this->invalid): if ($this->invalid):
echo '<span class="sub">'.sprintf(Lang::$search['ignoredTerms'], implode(', ', $this->invalid)).'</span>'; echo '<span class="sub">'.sprintf(Lang::$main['ignoredTerms'], implode(', ', $this->invalid)).'</span>';
endif; endif;
echo "</h1>\n"; echo "</h1>\n";
?> ?>
<div class="search-noresults"></div> <div class="search-noresults"></div>
<?php <?php
echo ' '.Lang::$search['tryAgain']."\n"; echo ' '.Lang::$main['tryAgain']."\n";
endif; endif;
?> ?>
<div class="clear"></div> <div class="clear"></div>