From b6981768ee02da8f56e8943efaa4fe755f71ca9f Mon Sep 17 00:00:00 2001 From: Zach Prezkuta <fermion@gmx.com> 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 0381fcf4cc..89363541ca 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 527e1ec3fd..61f16b50fc 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 c9ab0e3f73..781d538bb7 100644 --- a/view/admin_users.tpl +++ b/view/admin_users.tpl @@ -70,7 +70,7 @@ <td class='register_date'>$u.register_date</td> <td class='login_date'>$u.login_date</td> <td class='lastitem_date'>$u.lastitem_date</td> - <td class='login_date'>$u.page-flags {{ if $u.is_admin }}($siteadmin){{ endif }}</td> + <td class='login_date'>$u.page_flags {{ if $u.is_admin }}($siteadmin){{ endif }}</td> <td class="checkbox"> {{ if $u.is_admin }} diff --git a/view/event.tpl b/view/event.tpl index ac9f889ecf..1f71289b3a 100644 --- a/view/event.tpl +++ b/view/event.tpl @@ -1,7 +1,7 @@ {{ for $events as $event }} <div class="event"> - {{ if $event.item.author-name }}<a href="$event.item.author-link" ><img src="$event.item.author-avatar" height="32" width="32" />$event.item.author-name</a>{{ endif }} + {{ if $event.item.author_name }}<a href="$event.item.author_link" ><img src="$event.item.author_avatar" height="32" width="32" />$event.item.author_name</a>{{ endif }} $event.html {{ if $event.item.plink }}<a href="$event.plink.0" title="$event.plink.1" target="external-link" class="plink-event-link icon s22 remote-link"></a>{{ endif }} {{ if $event.edit }}<a href="$event.edit.0" title="$event.edit.1" class="edit-event-link icon s22 pencil"></a>{{ endif }} diff --git a/view/events.tpl b/view/events.tpl index 5a9787de36..be7dc2fb2d 100644 --- a/view/events.tpl +++ b/view/events.tpl @@ -14,7 +14,7 @@ $tabs {{ for $events as $event }} <div class="event"> {{ if $event.is_first }}<hr /><a name="link-$event.j" ><div class="event-list-date">$event.d</div></a>{{ endif }} - {{ if $event.item.author-name }}<a href="$event.item.author-link" ><img src="$event.item.author-avatar" height="32" width="32" />$event.item.author-name</a>{{ endif }} + {{ if $event.item.author_name }}<a href="$event.item.author_link" ><img src="$event.item.author_avatar" height="32" width="32" />$event.item.author_name</a>{{ endif }} $event.html {{ if $event.item.plink }}<a href="$event.plink.0" title="$event.plink.1" target="external-link" class="plink-event-link icon s22 remote-link"></a>{{ endif }} {{ if $event.edit }}<a href="$event.edit.0" title="$event.edit.1" class="edit-event-link icon s22 pencil"></a>{{ endif }} diff --git a/view/smarty3/admin_users.tpl b/view/smarty3/admin_users.tpl index 987ab4bccf..5658fc7e54 100644 --- a/view/smarty3/admin_users.tpl +++ b/view/smarty3/admin_users.tpl @@ -70,7 +70,7 @@ <td class='register_date'>{{$u.register_date}}</td> <td class='login_date'>{{$u.login_date}}</td> <td class='lastitem_date'>{{$u.lastitem_date}}</td> - <td class='login_date'>{{$u.page-flags}} {{if $u.is_admin}}({{$siteadmin}}){{/if}}</td> + <td class='login_date'>{{$u.page_flags}} {{if $u.is_admin}}({{$siteadmin}}){{/if}}</td> <td class="checkbox"> {{if $u.is_admin}} diff --git a/view/smarty3/event.tpl b/view/smarty3/event.tpl index c8570cef29..2a0868d25e 100644 --- a/view/smarty3/event.tpl +++ b/view/smarty3/event.tpl @@ -1,7 +1,7 @@ {{foreach $events as $event}} <div class="event"> - {{if $event.item.author-name}}<a href="{{$event.item.author-link}}" ><img src="{{$event.item.author-avatar}}" height="32" width="32" />{{$event.item.author-name}}</a>{{/if}} + {{if $event.item.author_name}}<a href="{{$event.item.author_link}}" ><img src="{{$event.item.author_avatar}}" height="32" width="32" />{{$event.item.author_name}}</a>{{/if}} {{$event.html}} {{if $event.item.plink}}<a href="{{$event.plink.0}}" title="{{$event.plink.1}}" target="external-link" class="plink-event-link icon s22 remote-link"></a>{{/if}} {{if $event.edit}}<a href="{{$event.edit.0}}" title="{{$event.edit.1}}" class="edit-event-link icon s22 pencil"></a>{{/if}} diff --git a/view/smarty3/events.tpl b/view/smarty3/events.tpl index 0d20b0a72c..50a8cf3a86 100644 --- a/view/smarty3/events.tpl +++ b/view/smarty3/events.tpl @@ -14,7 +14,7 @@ {{foreach $events as $event}} <div class="event"> {{if $event.is_first}}<hr /><a name="link-{{$event.j}}" ><div class="event-list-date">{{$event.d}}</div></a>{{/if}} - {{if $event.item.author-name}}<a href="{{$event.item.author-link}}" ><img src="{{$event.item.author-avatar}}" height="32" width="32" />{{$event.item.author-name}}</a>{{/if}} + {{if $event.item.author_name}}<a href="{{$event.item.author_link}}" ><img src="{{$event.item.author_avatar}}" height="32" width="32" />{{$event.item.author_name}}</a>{{/if}} {{$event.html}} {{if $event.item.plink}}<a href="{{$event.plink.0}}" title="{{$event.plink.1}}" target="external-link" class="plink-event-link icon s22 remote-link"></a>{{/if}} {{if $event.edit}}<a href="{{$event.edit.0}}" title="{{$event.edit.1}}" class="edit-event-link icon s22 pencil"></a>{{/if}} diff --git a/view/theme/diabook/admin_users.tpl b/view/theme/diabook/admin_users.tpl index 8aabb51ec9..609fd5ad2a 100644 --- a/view/theme/diabook/admin_users.tpl +++ b/view/theme/diabook/admin_users.tpl @@ -69,7 +69,7 @@ <td class='register_date'>$u.register_date</td> <td class='login_date'>$u.login_date</td> <td class='lastitem_date'>$u.lastitem_date</td> - <td class='login_date'>$u.page-flags</td> + <td class='login_date'>$u.page_flags</td> <td class="checkbox"><input type="checkbox" class="users_ckbx" id="id_user_$u.uid" name="user[]" value="$u.uid"/></td> <td class="tools" style="width:60px;"> <a href="$baseurl/admin/users/block/$u.uid?t=$form_security_token" title='{{ if $u.blocked }}$unblock{{ else }}$block{{ endif }}'><span class='icon block {{ if $u.blocked==0 }}dim{{ endif }}'></span></a> diff --git a/view/theme/diabook/smarty3/admin_users.tpl b/view/theme/diabook/smarty3/admin_users.tpl index 67a079a08f..1bc1949b8b 100644 --- a/view/theme/diabook/smarty3/admin_users.tpl +++ b/view/theme/diabook/smarty3/admin_users.tpl @@ -69,7 +69,7 @@ <td class='register_date'>{{$u.register_date}}</td> <td class='login_date'>{{$u.login_date}}</td> <td class='lastitem_date'>{{$u.lastitem_date}}</td> - <td class='login_date'>{{$u.page-flags}}</td> + <td class='login_date'>{{$u.page_flags}}</td> <td class="checkbox"><input type="checkbox" class="users_ckbx" id="id_user_{{$u.uid}}" name="user[]" value="{{$u.uid}}"/></td> <td class="tools" style="width:60px;"> <a href="{{$baseurl}}/admin/users/block/{{$u.uid}}?t={{$form_security_token}}" title='{{if $u.blocked}}{{$unblock}}{{else}}{{$block}}{{/if}}'><span class='icon block {{if $u.blocked==0}}dim{{/if}}'></span></a>