From b6981768ee02da8f56e8943efaa4fe755f71ca9f Mon Sep 17 00:00:00 2001 From: Zach Prezkuta Date: Thu, 27 Dec 2012 09:38:42 -0700 Subject: [PATCH] remove more dashes in templates --- mod/admin.php | 10 ++++++++++ mod/events.php | 11 +++++++++++ view/admin_users.tpl | 2 +- view/event.tpl | 2 +- view/events.tpl | 2 +- view/smarty3/admin_users.tpl | 2 +- view/smarty3/event.tpl | 2 +- view/smarty3/events.tpl | 2 +- view/theme/diabook/admin_users.tpl | 2 +- view/theme/diabook/smarty3/admin_users.tpl | 2 +- 10 files changed, 29 insertions(+), 8 deletions(-) diff --git a/mod/admin.php b/mod/admin.php index 0381fcf4c..89363541c 100644 --- a/mod/admin.php +++ b/mod/admin.php @@ -710,6 +710,16 @@ function admin_page_users(&$a){ $users = array_map("_setup_users", $users); + // Get rid of dashes in key names, Smarty3 can't handle them + foreach($users as $key => $user) { + $new_user = array(); + foreach($user as $k => $v) { + $k = str_replace('-','_',$k); + $new_user[$k] = $v; + } + $users[$key] = $new_user; + } + $t = get_markup_template("admin_users.tpl"); $o = replace_macros($t, array( // strings // diff --git a/mod/events.php b/mod/events.php index 527e1ec3f..61f16b50f 100755 --- a/mod/events.php +++ b/mod/events.php @@ -341,6 +341,17 @@ function events_content(&$a) { // $tpl = get_markup_template("events.tpl"); // } } + + // Get rid of dashes in key names, Smarty3 can't handle them + foreach($events as $key => $event) { + $event_item = array(); + foreach($event['item'] as $k => $v) { + $k = str_replace('-','_',$k); + $event_item[$k] = $v; + } + $events[$key]['item'] = $event_item; + } + $o = replace_macros($tpl, array( '$baseurl' => $a->get_baseurl(), '$tabs' => $tabs, diff --git a/view/admin_users.tpl b/view/admin_users.tpl index c9ab0e3f7..781d538bb 100644 --- a/view/admin_users.tpl +++ b/view/admin_users.tpl @@ -70,7 +70,7 @@ $u.register_date $u.login_date $u.lastitem_date - $u.page-flags {{ if $u.is_admin }}($siteadmin){{ endif }} + $u.page_flags {{ if $u.is_admin }}($siteadmin){{ endif }} {{ if $u.is_admin }}   diff --git a/view/event.tpl b/view/event.tpl index ac9f889ec..1f71289b3 100644 --- a/view/event.tpl +++ b/view/event.tpl @@ -1,7 +1,7 @@ {{ for $events as $event }}
- {{ if $event.item.author-name }}$event.item.author-name{{ endif }} + {{ if $event.item.author_name }}$event.item.author_name{{ endif }} $event.html {{ if $event.item.plink }}{{ endif }} {{ if $event.edit }}{{ endif }} diff --git a/view/events.tpl b/view/events.tpl index 5a9787de3..be7dc2fb2 100644 --- a/view/events.tpl +++ b/view/events.tpl @@ -14,7 +14,7 @@ $tabs {{ for $events as $event }}
{{ if $event.is_first }}
$event.d
{{ endif }} - {{ if $event.item.author-name }}$event.item.author-name{{ endif }} + {{ if $event.item.author_name }}$event.item.author_name{{ endif }} $event.html {{ if $event.item.plink }}{{ endif }} {{ if $event.edit }}{{ endif }} diff --git a/view/smarty3/admin_users.tpl b/view/smarty3/admin_users.tpl index 987ab4bcc..5658fc7e5 100644 --- a/view/smarty3/admin_users.tpl +++ b/view/smarty3/admin_users.tpl @@ -70,7 +70,7 @@ {{$u.register_date}} {{$u.login_date}} {{$u.lastitem_date}} - {{$u.page-flags}} {{if $u.is_admin}}({{$siteadmin}}){{/if}} + {{$u.page_flags}} {{if $u.is_admin}}({{$siteadmin}}){{/if}} {{if $u.is_admin}}   diff --git a/view/smarty3/event.tpl b/view/smarty3/event.tpl index c8570cef2..2a0868d25 100644 --- a/view/smarty3/event.tpl +++ b/view/smarty3/event.tpl @@ -1,7 +1,7 @@ {{foreach $events as $event}}
- {{if $event.item.author-name}}{{$event.item.author-name}}{{/if}} + {{if $event.item.author_name}}{{$event.item.author_name}}{{/if}} {{$event.html}} {{if $event.item.plink}}{{/if}} {{if $event.edit}}{{/if}} diff --git a/view/smarty3/events.tpl b/view/smarty3/events.tpl index 0d20b0a72..50a8cf3a8 100644 --- a/view/smarty3/events.tpl +++ b/view/smarty3/events.tpl @@ -14,7 +14,7 @@ {{foreach $events as $event}}
{{if $event.is_first}}
{{$event.d}}
{{/if}} - {{if $event.item.author-name}}{{$event.item.author-name}}{{/if}} + {{if $event.item.author_name}}{{$event.item.author_name}}{{/if}} {{$event.html}} {{if $event.item.plink}}{{/if}} {{if $event.edit}}{{/if}} diff --git a/view/theme/diabook/admin_users.tpl b/view/theme/diabook/admin_users.tpl index 8aabb51ec..609fd5ad2 100644 --- a/view/theme/diabook/admin_users.tpl +++ b/view/theme/diabook/admin_users.tpl @@ -69,7 +69,7 @@ $u.register_date $u.login_date $u.lastitem_date - $u.page-flags + $u.page_flags diff --git a/view/theme/diabook/smarty3/admin_users.tpl b/view/theme/diabook/smarty3/admin_users.tpl index 67a079a08..1bc1949b8 100644 --- a/view/theme/diabook/smarty3/admin_users.tpl +++ b/view/theme/diabook/smarty3/admin_users.tpl @@ -69,7 +69,7 @@ {{$u.register_date}} {{$u.login_date}} {{$u.lastitem_date}} - {{$u.page-flags}} + {{$u.page_flags}}