]> git.sur5r.net Git - contagged/commitdiff
reverted deafult modifier, added shortcut for manual escaping
authorAndreas Gohr <gohr@cosmocode.de>
Mon, 18 Jun 2007 13:30:37 +0000 (15:30 +0200)
committerAndreas Gohr <gohr@cosmocode.de>
Mon, 18 Jun 2007 13:30:37 +0000 (15:30 +0200)
Even the Smarty guys discourage the use of the deafualt_modifier. In fact
variable escaping in smarty is a big mess :-/

darcs-hash:20070618133037-6e07b-f20040f5b58fe85d440ecf399f941152a347e1ef.gz

init.php
templates/entry_edit.tpl
templates/entry_show.tpl
templates/list.tpl
templates/list_entry.tpl

index 657a1c6b37453f03f4eb25dd95e032c4e1887290..3130292d46b87b9ba9b202ee21a77ff2a8eff155 100644 (file)
--- a/init.php
+++ b/init.php
@@ -39,5 +39,4 @@
   $smarty->use_sub_dirs  = 0;
   $smarty->template_dir  = './templates';
   $smarty->force_compile = $conf['smartycompile'];
-  $smarty->default_modifiers = 'escape:"htmlall":"UTF-8"';
 ?>
index 00453cafd4bb2d5fb33298c07efc38b49a479a76..8dad65bc98f053de2be6b3869cba8e19821f2eee 100644 (file)
@@ -2,14 +2,14 @@
 
 <h1>
   {if $entry.type != ''}
-  <img src="pix/{$entry.type}.png" border="0" width="22" height="22" align="middle" title="{$entry.type}">
+  <img src="pix/{$entry.type|h}.png" border="0" width="22" height="22" align="middle" title="{$entry.type|h}">
   {/if}
-  {$entry.givenname} {$entry.name}
+  {$entry.givenname|h} {$entry.name|h}
 </h1>
 
 <form action="entry.php" method="post" enctype="multipart/form-data" accept-charset="utf-8">
 <input type="hidden" name="MAX_FILE_SIZE" value="2000000" />
-<input type="hidden" name="dn" value="{$entry.dn}" />
+<input type="hidden" name="dn" value="{$entry.dn|h}" />
 <input type="hidden" name="save" value="1" />
 
 <table width="100%">
 {* always required ... if $fields.name *}
         <tr>
           <td align="right" valign="top" nowrap="nowrap">{$lang.name}:</td>
-          <td><input type="text" class="input" name="entry[name]" value="{$entry.name}" id="firstfield"></td>
+          <td><input type="text" class="input" name="entry[name]" value="{$entry.name|h}" id="firstfield"></td>
         </tr>
 {* /if *}
 {if $fields.givenname}
         <tr>
           <td align="right" valign="top" nowrap="nowrap">{$lang.givenname}:</td>
-          <td><input type="text" class="input" name="entry[givenname]" value="{$entry.givenname}"></td>
+          <td><input type="text" class="input" name="entry[givenname]" value="{$entry.givenname|h}"></td>
         </tr>
 {/if}
 {if $fields.title}
         <tr>
           <td align="right" valign="top" nowrap="nowrap">{$lang.title}:</td>
-          <td><input type="text" class="input" name="entry[title]" value="{$entry.title}"></td>
+          <td><input type="text" class="input" name="entry[title]" value="{$entry.title|h}"></td>
         </tr>
 {/if}
       </table>
         <tr>
           <td align="right" valign="top" nowrap="nowrap">{$lang.organization}:</td>
           <td>
-            <input type="text" class="input ac" name="entry[organization]" value="{$entry.organization}">
+            <input type="text" class="input ac" name="entry[organization]" value="{$entry.organization|h}">
           </td>
         </tr>
 {/if}
 {if $fields.office}
         <tr>
           <td align="right" valign="top" nowrap="nowrap">{$lang.office}:</td>
-          <td><input type="text" class="input" name="entry[office]" value="{$entry.office}"></td>
+          <td><input type="text" class="input" name="entry[office]" value="{$entry.office|h}"></td>
         </tr>
 {/if}
 {if $fields.street}
         <tr>
           <td align="right" valign="top" nowrap="nowrap">{$lang.street}:</td>
-          <td><input type="text" class="input ac" name="entry[street]" value="{$entry.street}"></td>
+          <td><input type="text" class="input ac" name="entry[street]" value="{$entry.street|h}"></td>
         </tr>
 {/if}
 {if $fields.zip}
         <tr>
           <td align="right" valign="top" nowrap="nowrap">{$lang.zip}:</td>
-          <td><input type="text" class="input" name="entry[zip]" value="{$entry.zip}"></td>
+          <td><input type="text" class="input" name="entry[zip]" value="{$entry.zip|h}"></td>
         </tr>
 {/if}
 {if $fields.location}
         <tr>
           <td align="right" valign="top" nowrap="nowrap">{$lang.location}:</td>
-          <td><input type="text" class="input ac" name="entry[location]" value="{$entry.location}"></td>
+          <td><input type="text" class="input ac" name="entry[location]" value="{$entry.location|h}"></td>
         </tr>
 {/if}
 {if $fields.state}
         <tr>
           <td align="right" valign="top" nowrap="nowrap">{$lang.state}:</td>
-          <td><input type="text" class="input ac" name="entry[state]" value="{$entry.state}"></td>
+          <td><input type="text" class="input ac" name="entry[state]" value="{$entry.state|h}"></td>
         </tr>
 {/if}
 {if $fields.country}
         <tr>
           <td align="right" valign="top">{$lang.country}:</td>
           <td>
-            <input type="text" class="input ac" name="entry[country]" value="{$entry.country}"><br>
+            <input type="text" class="input ac" name="entry[country]" value="{$entry.country|h}"><br>
           </td>
         </tr>
 {/if}
 {if $fields.phone}
         <tr>
           <td align="right" valign="top" nowrap="nowrap">{$lang.phone}:</td>
-          <td><input type="text" class="input" name="entry[phone]" value="{$entry.phone}"></td>
+          <td><input type="text" class="input" name="entry[phone]" value="{$entry.phone|h}"></td>
         </tr>
 {/if}
 {if $fields.switchboard}
         <tr>
           <td align="right" valign="top" nowrap="nowrap">{$lang.switchboard}:</td>
-          <td><input type="text" class="input" name="entry[switchboard]" value="{$entry.switchboard}"></td>
+          <td><input type="text" class="input" name="entry[switchboard]" value="{$entry.switchboard|h}"></td>
         </tr>
 {/if}
 {if $fields.fax}
         <tr>
           <td align="right" valign="top" nowrap="nowrap">{$lang.fax}:</td>
-          <td><input type="text" class="input" name="entry[fax]" value="{$entry.fax}"></td>
+          <td><input type="text" class="input" name="entry[fax]" value="{$entry.fax|h}"></td>
         </tr>
 {/if}
 {if $fields.pager}
         <tr>
           <td align="right" valign="top" nowrap="nowrap">{$lang.pager}:</td>
-          <td><input type="text" class="input" name="entry[pager]" value="{$entry.pager}"></td>
+          <td><input type="text" class="input" name="entry[pager]" value="{$entry.pager|h}"></td>
         </tr>
 {/if}
 {if $fields.manager}
 {if $fields.position}
         <tr>
           <td align="right" valign="top">{$lang.position}:</td>
-          <td><input type="text" class="input ac" name="entry[position]" value="{$entry.position}"></td>
+          <td><input type="text" class="input ac" name="entry[position]" value="{$entry.position|h}"></td>
         </tr>
 {/if}
 {if $fields.department}
         <tr>
           <td align="right" valign="top">{$lang.department}:</td>
-          <td><input type="text" class="input ac" name="entry[department]" value="{$entry.department}"></td>
+          <td><input type="text" class="input ac" name="entry[department]" value="{$entry.department|h}"></td>
         </tr>
 {/if}
 
 {if $fields.homestreet}
         <tr>
           <td align="right" valign="top" nowrap="nowrap">{$lang.homestreet}:</td>
-          <td><textarea name="entry[homestreet]" class="input" rows="2" cols="30">{$entry.homestreet}</textarea></td>
+          <td><textarea name="entry[homestreet]" class="input" rows="2" cols="30">{$entry.homestreet|h}</textarea></td>
         </tr>
 {/if}
 {if $fields.homephone}
         <tr>
           <td align="right" valign="top" nowrap="nowrap">{$lang.homephone}:</td>
-          <td><input type="text" class="input" name="entry[homephone]" value="{$entry.homephone}"></td>
+          <td><input type="text" class="input" name="entry[homephone]" value="{$entry.homephone|h}"></td>
         </tr>
 {/if}
 {if $fields.mobile}
         <tr>
           <td align="right" valign="top" nowrap="nowrap">{$lang.mobile}:</td>
-          <td><input type="text" class="input" name="entry[mobile]" value="{$entry.mobile}"></td>
+          <td><input type="text" class="input" name="entry[mobile]" value="{$entry.mobile|h}"></td>
         </tr>
 {/if}
 {if $fields.url}
         <tr>
           <td align="right" valign="top" nowrap="nowrap">{$lang.url}:</td>
-          <td><input type="text" class="input ac" name="entry[url]" value="{$entry.url}"></td>
+          <td><input type="text" class="input ac" name="entry[url]" value="{$entry.url|h}"></td>
         </tr>
 {/if}
 {if $fields.photo}
 {if $fields.birthday}
         <tr>
           <td align="right" valign="top">{$lang.birthday}:<br><span class="hint">({$lang.msg_dateformat})</span></td>
-          <td><input type="text" class="input" name="entry[birthday]" value="{$entry.birthday}" maxlength="10"></td>
+          <td><input type="text" class="input" name="entry[birthday]" value="{$entry.birthday|h}" maxlength="10"></td>
         </tr>
 {/if}
 {if $fields.anniversary}
         <tr>
           <td align="right" valign="top" nowrap="nowrap">{$lang.anniversary}:<br><span class="hint">({$lang.msg_dateformat})</span></td>
-          <td><input type="text" class="input" name="entry[anniversary]" value="{$entry.anniversary}" maxlength="10"></td>
+          <td><input type="text" class="input" name="entry[anniversary]" value="{$entry.anniversary|h}" maxlength="10"></td>
         </tr>
 {/if}
 {if $fields.spouse}
         <tr>
           <td align="right" valign="top" nowrap="nowrap">{$lang.spouse}:</td>
-          <td><input type="text" class="input" name="entry[spouse]" value="{$entry.spouse}"></td>
+          <td><input type="text" class="input" name="entry[spouse]" value="{$entry.spouse|h}"></td>
         </tr>
 {/if}
 
           <td colspan="2"><b>{$lang.communication}</b></td>
         </tr>
 {if $fields._mail}
-        {foreach from=$entry.mail item=mail}
+        {foreach from=$entry.mail|smarty:nodefaults item=mail}
         <tr>
           <td align="right" valign="top" nowrap="nowrap">{$lang.mail} {counter}:</td>
           <td><input type="text" class="input" name="entry[mail][]" value="{$mail}"></td>
 {if $fields.instantmessenger}
         <tr>
           <td align="right" valign="top">{$lang.instantmessenger}:</td>
-          <td><input type="text" class="input" name="entry[instantmessenger]" value="{$entry.instantmessenger}"></td>
+          <td><input type="text" class="input" name="entry[instantmessenger]" value="{$entry.instantmessenger|h}"></td>
         </tr>
 {/if}
 {if $fields.ipphone}
         <tr>
           <td align="right" valign="top">{$lang.ipphone}:</td>
-          <td><input type="text" class="input" name="entry[ipphone]" value="{$entry.ipphone}"></td>
+          <td><input type="text" class="input" name="entry[ipphone]" value="{$entry.ipphone|h}"></td>
         </tr>
 {/if}
 
         <tr>
           <td align="right" valign="top" nowrap="nowrap">{$lang.marker}:<br><span class="hint">({$lang.msg_tagsep})</span></td>
           <td>
-            <textarea class="input" name="entry[markers]" id="tageditlookup">{$entry.markers}</textarea>
+            <textarea class="input" name="entry[markers]" id="tageditlookup">{$entry.markers|h}</textarea>
           </td>
         </tr>
 {/if}
 {if $fields.note}
         <tr>
           <td align="right" valign="top">{$lang.note}:</td>
-          <td align="right"><textarea class="input" rows="6" cols="30" name="entry[note]" class="note">{$entry.note}</textarea></td>
+          <td align="right"><textarea class="input" rows="6" cols="30" name="entry[note]" class="note">{$entry.note|h}</textarea></td>
         </tr>
 {/if}
 
         <tr>
           <td align="right" valign="top">{$lang.certificate}:</td>
           <td>
-            <textarea name="entry[certificate]" class="input" rows="6" cols="28" onClick="this.form.elements['entry[certificate]'].select();">{$entry.certificate}</textarea>
+            <textarea name="entry[certificate]" class="input" rows="6" cols="28" onClick="this.form.elements['entry[certificate]'].select();">{$entry.certificate|h}</textarea>
             <br><input type="button" name="clearCert" value="Clear" onClick="if (confirm('Are you sure?')) this.form.elements['entry[certificate]'].value='';">
           </td>
         </tr>
 {if $fields.domain}
         <tr>
           <td align="right" valign="top">{$lang.domain}:</td>
-          <td><input type="text" class="input" name="entry[domain]" value="{$entry.domain}"></td>
+          <td><input type="text" class="input" name="entry[domain]" value="{$entry.domain|h}"></td>
         </tr>
 {/if}
 {if $fields.timezone}
         <tr>
           <td align="right" valign="top">{$lang.timezone}:</td>
           <td>
-            <input type="text" class="inputbr" name="entry[timezone]" value="{$entry.timezone}"><br>
+            <input type="text" class="inputbr" name="entry[timezone]" value="{$entry.timezone|h}"><br>
           </td>
         </tr>
 {/if}
index 3f0c5f22dfdc619475b0c8755e1e7cf66bc30987..fa794bdc2f69a0ef814cadc169718383067e2b0f 100644 (file)
@@ -1,14 +1,14 @@
 {include file="header.tpl"}
 
 {if $entry.photo != ''}
-  <a href="img.php?dn={$entry.dn|escape:url}&amp;.jpg" rel="imagebox" title="{$entry.givenname} {$entry.name}"><img src="img.php?dn={$entry.dn|escape:url}" align="right" class="photo" width="130" /></a>
+  <a href="img.php?dn={$entry.dn|escape:url}&amp;.jpg" rel="imagebox" title="{$entry.givenname|h} {$entry.name|h}"><img src="img.php?dn={$entry.dn|escape:url}" align="right" class="photo" width="130" /></a>
 {/if}
 <h1>
-  <img src="pix/{$entry.type}.png" border="0" width="22" height="22" align="middle" title="{$entry.type}" />
-  {$entry.givenname} {$entry.name}
+  <img src="pix/{$entry.type|h}.png" border="0" width="22" height="22" align="middle" title="{$entry.type|h}" />
+  {$entry.givenname|h} {$entry.name|h}
 </h1>
 
-<table width="100%" {if $user}ondblclick="window.location.href='entry.php?dn={$entry.dn|escape:url}&mode=edit'"{/if}>
+<table width="100%" {if $user}ondblclick="window.location.href='entry.php?dn={$entry.dn|escape:url}&mode=edit'"{/if|h}>
   <tr>
     <td valign="top" width="50%">
       <b>{$lang.business}</b>
         <table>
           <tr>
             <td colspan="2">
-              {$entry.title} {$entry.givenname} {$entry.name}<br>
+              {$entry.title|h} {$entry.givenname|h} {$entry.name|h}<br>
 {if $entry.organization}
-              <a href="index.php?org={$entry.organization|escape:url}">{$entry.organization}</a><br>
+              <a href="index.php?org={$entry.organization|escape:url}">{$entry.organization|h}</a><br>
 {/if}
 {if $entry.office}
-              {$entry.office}<br>
+              {$entry.office|h}<br>
 {/if}
 {if $entry.street}
-              {$entry.street}<br>
+              {$entry.street|h}<br>
 {/if}
 {if $entry.location}
-              {$entry.zip} {$entry.location}<br>
+              {$entry.zip} {$entry.location|h}<br>
 {/if}
 {if $entry.state}
-              {$entry.state}
+              {$entry.state|h}
 {/if}
 {if $entry.country}
-              {$entry.country}
+              {$entry.country|h}
 {/if}
               <br><br>
             </td>
 {if $entry.phone}
           <tr>
             <td align="right">{$lang.phone}:</td>
-            <td>{$entry.phone}</td>
+            <td>{$entry.phone|h}</td>
           </tr>
 {/if}
 {if $entry.switchboard}
           <tr>
             <td align="right">{$lang.switchboard}:</td>
-            <td>{$entry.switchboard}</td>
+            <td>{$entry.switchboard|h}</td>
           </tr>
 {/if}
 {if $entry.fax}
           <tr>
             <td align="right">{$lang.fax}:</td>
-            <td>{$entry.fax}</td>
+            <td>{$entry.fax|h}</td>
           </tr>
 {/if}
 {if $entry.pager}
           <tr>
             <td align="right">{$lang.pager}:</td>
-            <td>{$entry.pager}</td>
+            <td>{$entry.pager|h}</td>
           </tr>
 {/if}
 {if $managername}
 {if $entry.position}
           <tr>
             <td align="right">{$lang.position}:</td>
-            <td>{$entry.position}</td>
+            <td>{$entry.position|h}</td>
           </tr>
 {/if}
 {if $entry.department}
           <tr>
             <td align="right">{$lang.department}:</td>
-            <td>{$entry.department}</td>
+            <td>{$entry.department|h}</td>
           </tr>
 {/if}
 
         <table>
           <tr>
             <td colspan="2">
-              {$entry.title} {$entry.givenname} {$entry.name}<br>
+              {$entry.title} {$entry.givenname} {$entry.name|h}<br>
 {if $entry.homestreet}
-              {$entry.homestreet|nl2br}<br><br>
+              {$entry.homestreet|h|nl2br}<br><br>
 {/if}
             </td>
           </tr>
 {if $entry.homephone}
           <tr>
             <td align="right">{$lang.homephone}:</td>
-            <td>{$entry.homephone}</td>
+            <td>{$entry.homephone|h}</td>
           </tr>
 {/if}
 {if $entry.mobile}
           <tr>
             <td align="right">{$lang.mobile}:</td>
-            <td>{$entry.mobile}</td>
+            <td>{$entry.mobile|h}</td>
           </tr>
 {/if}
 {if $entry.url}
           <tr>
             <td align="right">{$lang.url}:</td>
-            <td><a href="{$entry.url}" target="_blank">{$entry.url}</a></td>
+            <td><a href="{$entry.url}" target="_blank">{$entry.url|h}</a></td>
           </tr>
 {/if}
 {if $entry.birthday}
           <tr>
             <td align="right">{$lang.birthday}:</td>
-            <td>{$entry.birthday}</td>
+            <td>{$entry.birthday|h}</td>
           </tr>
 {/if}
 {if $entry.anniversary}
           <tr>
             <td align="right">{$lang.anniversary}:</td>
-            <td>{$entry.anniversary|date_format:$conf.dateformat}</td>
+            <td>{$entry.anniversary|date_format:$conf.dateformat|h}</td>
           </tr>
 {/if}
 {if $entry.spouse}
           <tr>
             <td align="right">{$lang.spouse}:</td>
-            <td>{$entry.spouse}</td>
+            <td>{$entry.spouse|h}</td>
           </tr>
 {/if}
 
             <td valign="top" align="right">{$lang.mail}:</td>
             <td>
               {foreach from=$entry.mail item=mail}
-                <a href="mailto:{$mail}">{$mail}</a><br>
+                <a href="mailto:{$mail|escape:url}">{$mail|h}</a><br>
               {/foreach}
             </td>
           </tr>
 {if $entry.instantmessenger}
           <tr>
             <td align="right">{$lang.instantmessenger}:</td>
-            <td>{$entry.instantmessenger}</td>
+            <td>{$entry.instantmessenger|h}</td>
           </tr>
 {/if}
 {if $entry.ipphone}
           <tr>
             <td align="right">{$lang.ipphone}:</td>
-            <td>{$entry.ipphone}</td>
+            <td>{$entry.ipphone|h}</td>
           </tr>
 {/if}
 
             <td id="tedit_insert">
               <span id="tedit_out">
                 {foreach from=$entry.marker item=marker}
-                  <a href="index.php?marker={$marker|escape:url}" class="tag">{$marker}</a> 
+                  <a href="index.php?marker={$marker|escape:url}" class="tag">{$marker|h}</a> 
                 {/foreach}
               </span>
               {if $user}
          <tr>
            <td align="right">{$lang.certificate}:</td>
            <td><form>
-              <textarea rows=3 cols=28 name='certificate' onClick='this.form.certificate.select();'>{$entry.certificate}</textarea>
+              <textarea rows=3 cols=28 name='certificate' onClick='this.form.certificate.select();'>{$entry.certificate|h}</textarea>
             </form></td>
           </tr>
 {/if}
 {if $entry.domain}
           <tr>
             <td align="right">{$lang.domain}:</td>
-            <td>{$entry.domain}</td>
+            <td>{$entry.domain|h}</td>
           </tr>
 {/if}
 {if $entry.timezone}
           <tr>
             <td align="right">{$lang.timezone}:</td>
-            <td>{$entry.timezone}</td>
+            <td>{$entry.timezone|h}</td>
           </tr>
 {/if}
         </table>
index 99acd01c3260fb436ad6728360983c50eef71be4..f1e28ad1e9dc05bb75623d71a9cfeb8409f2455f 100644 (file)
@@ -4,7 +4,7 @@
   {if $conf.userlogreq == 1 && $user == ''}
     <tr>
       <td align="center">
-      {* include un truc *} {$lang.msg_login}
+      {$lang.msg_login}
       </td>
     </tr>
   {else}
index a6d7d55c1c1b03cc23466fde359a80d55c2e0930..29e64a03f962517e7e57539d1e245baad27e599e 100644 (file)
@@ -1,23 +1,23 @@
 {if $entry.type}
 <tr>
   <td class="result" width="25">
-    <img src="pix/{$entry.type}.png" border="0" width="16" height="16" align="middle" title="{$entry.type}">
+    <img src="pix/{$entry.type|h}.png" border="0" width="16" height="16" align="middle" title="{$entry.type|h}">
   </td>
   <td class="result">
-    <b><a href="entry.php?dn={$entry.dn|escape:url}">{$entry.name}, {$entry.givenname}</a></b>
+    <b><a href="entry.php?dn={$entry.dn|escape:url}">{$entry.name|h}, {$entry.givenname|h}</a></b>
   </td>
   <td class="result">
-    <a href="index.php?org={$entry.organization|escape:url}">{$entry.organization}</a>&nbsp;
+    <a href="index.php?org={$entry.organization|escape:url}">{$entry.organization|h}</a>&nbsp;
   </td>
   <td class="result">
-    {$entry.phone}&nbsp;
+    {$entry.phone|h}&nbsp;
   </td>
   <td class="result">
-    <a href="mailto:{$entry.mail[0]}">{$entry.mail[0]}</a>&nbsp;
+    <a href="mailto:{$entry.mail[0]|h}">{$entry.mail[0]|h}</a>&nbsp;
   </td>
   <td class="result" width="16">
     {if $entry.photo}
-      <a href="img.php?dn={$entry.dn|escape:url}&amp;.jpg" rel="imagebox" target="_blank" title="{$entry.givenname|escape} {$entry.name|escape}"><img src="pix/image.png" border="0" width="16" height="16" align="middle" title="{$lang.photo}"></a>
+      <a href="img.php?dn={$entry.dn|escape:url}&amp;.jpg" rel="imagebox" target="_blank" title="{$entry.givenname|escape} {$entry.name|escape}"><img src="pix/image.png" border="0" width="16" height="16" align="middle" title="{$lang.photo|h}"></a>
     {else}
       &nbsp;
     {/if}