From 55c14eee5cdb9ddb806f14a9b2509e5e02c03206 Mon Sep 17 00:00:00 2001 From: Sarjuuk Date: Thu, 11 Jul 2013 22:43:53 +0200 Subject: [PATCH] misc: - fixed caching, by escaping control chars - rough support for shortened urls .. kinda - achievements shows icons for required items again; also can get name for quest --- .htaccess | 9 +++++---- includes/utilities.php | 4 ++-- pages/achievement.php | 2 +- template/achievement.tpl | 33 +++++++++++++++------------------ 4 files changed, 23 insertions(+), 25 deletions(-) diff --git a/.htaccess b/.htaccess index 0c923768..de110ba1 100644 --- a/.htaccess +++ b/.htaccess @@ -17,13 +17,14 @@ AddDefaultCharset utf8 CharsetRecodeMultipartForms Off - php_value default_charset UTF-8 - + php_value default_charset UTF-8 RewriteEngine on # Mapper-Helper: If you cant provide maps for all locales, redirect the browser - RewriteRule ^images/maps/(frfr|dede|eses|ruru)/(.*)$ images/maps/enus/$2 [NC] + RewriteRule ^images/maps/(frfr|dede|eses|ruru)/(.*)$ images/maps/enus/$2 [NC] # accept flattened urls | NYI - need more work :x -# RewriteRule ^([a-z0-9]+)=([^?&/=]*)(.*)$ index.php?$1=$2&$3 [NC] + RewriteRule ^([a-z0-9\-]+)$ ?$1 [NC] # /items => ?items + RewriteRule ^([a-z0-9\-]+)=([^?&]*)$ ?$1=$2 [NC] # /items=4.1 => ?items=4.1 + RewriteRule ^([a-z0-9\-]+)=([^?&]*)[&?](.*)$ ?$1=$2&$3 [NC] # /items=4.1?filter=sl=7 => ?items=4.1&filter=sl=7 diff --git a/includes/utilities.php b/includes/utilities.php index 9816ecb1..ca84c903 100644 --- a/includes/utilities.php +++ b/includes/utilities.php @@ -836,7 +836,7 @@ class SmartyAoWoW extends Smarty $file = $this->cache_dir.'data/'.$key; $cacheData = time()." ".AOWOW_REVISION."\n"; - $cacheData .= serialize($data); + $cacheData .= serialize(str_replace(["\n", "\t"], ['\n', '\t'], $data)); if ($filter) $cacheData .= "\n".serialize($filter); @@ -861,7 +861,7 @@ class SmartyAoWoW extends Smarty if ($expireTime <= time() || $rev < AOWOW_REVISION) return false; - $data = unserialize($cache[1]); + $data = str_replace(['\n', '\t'], ["\n", "\t"], unserialize($cache[1])); if (isset($cache[2])) $filter = unserialize($cache[2]); diff --git a/pages/achievement.php b/pages/achievement.php index 44c509d6..09b63145 100644 --- a/pages/achievement.php +++ b/pages/achievement.php @@ -261,7 +261,7 @@ if (!$smarty->loadCache($cacheKeyPage, $pageData)) break; // link to quest case ACHIEVEMENT_CRITERIA_TYPE_COMPLETE_QUEST: - $crtName = Quest::getName($obj); + $crtName = QuestList::getName($obj); $tmp['link'] = array( 'href' => '?quest='.$obj, 'text' => $crtName ? $crtName : $crtName, diff --git a/template/achievement.tpl b/template/achievement.tpl index 1247c6b9..8dc2b1da 100644 --- a/template/achievement.tpl +++ b/template/achievement.tpl @@ -23,9 +23,9 @@
@@ -34,7 +34,7 @@ {$lang.series}
- {section name=i loop=$lvData.page.series} +{section name=i loop=$lvData.page.series} - {/section} +{/section}
{$smarty.section.i.index+1}. @@ -45,7 +45,7 @@ {/if}
@@ -78,7 +78,7 @@
{strip} - {foreach from=$lvData.page.criteria item=cr name=criteria} +{foreach from=$lvData.page.criteria item=cr name=criteria} {* for reference and standard entries *} @@ -101,19 +101,16 @@
{/if} - {/foreach} +{/foreach} {/strip}
- {strip} - {/strip} -
@@ -122,13 +119,13 @@

{$lang.rewards}

{$lang.itemReward} - {foreach from=$lvData.page.itemReward item=i name=item key=id} +{foreach from=$lvData.page.itemReward item=i name=item key=id} - {/foreach} +{/foreach}
{$i.name}
@@ -138,9 +135,9 @@ {if $lvData.page.titleReward}

{$lang.gains}

{/if}