Commit c561c6b562030ec76dc74c876ccb1a165347bc46

Authored by kevin_fourie
1 parent c507e462

KTS-2076

"Character encoding issue with document titles"
Fixed this issue. Working on other encoding issues.

Committed By: Kevin
Reviewed By: Conrad

git-svn-id: https://kt-dms.svn.sourceforge.net/svnroot/kt-dms/STABLE/trunk@6730 c91229c3-7414-0410-bfa2-8a42b809f60b
Showing 33 changed files with 166 additions and 131 deletions
lib/documentmanagement/documentmetadataversion.inc.php
... ... @@ -95,8 +95,8 @@ class KTDocumentMetadataVersion extends KTEntity {
95 95 function setContentVersion($iNewValue) { $this->iContentVersion = $iNewValue; }
96 96 function getDocumentTypeId() { return $this->iDocumentTypeId; }
97 97 function setDocumentTypeId($iNewValue) { $this->iDocumentTypeId = $iNewValue; }
98   - function getName() { return $this->sName; }
99   - function setName($sNewValue) { $this->sName = $sNewValue; }
  98 + function getName() { return sanitizeForSQLtoHTML($this->sName); }
  99 + function setName($sNewValue) { $this->sName = sanitizeForSQL($sNewValue); }
100 100 function getDescription() { return $this->sDescription; }
101 101 function setDescription($sNewValue) { $this->sDescription = $sNewValue; }
102 102 function getStatusId() { return $this->iStatusId; }
... ...
lib/sanitize.inc deleted
1   -<?php
2   -/**
3   - * $Id$
4   - *
5   - * This page is meant to provide functions to prevent XSS cracks.
6   - *
7   - * The contents of this file are subject to the KnowledgeTree Public
8   - * License Version 1.1.2 ("License"); You may not use this file except in
9   - * compliance with the License. You may obtain a copy of the License at
10   - * http://www.knowledgetree.com/KPL
11   - *
12   - * Software distributed under the License is distributed on an "AS IS"
13   - * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied.
14   - * See the License for the specific language governing rights and
15   - * limitations under the License.
16   - *
17   - * All copies of the Covered Code must include on each user interface screen:
18   - * (i) the "Powered by KnowledgeTree" logo and
19   - * (ii) the KnowledgeTree copyright notice
20   - * in the same form as they appear in the distribution. See the License for
21   - * requirements.
22   - *
23   - * The Original Code is: KnowledgeTree Open Source
24   - *
25   - * The Initial Developer of the Original Code is The Jam Warehouse Software
26   - * (Pty) Ltd, trading as KnowledgeTree.
27   - * Portions created by The Jam Warehouse Software (Pty) Ltd are Copyright
28   - * (C) 2007 The Jam Warehouse Software (Pty) Ltd;
29   - * All Rights Reserved.
30   - * Contributor( s): ______________________________________
31   - */
32   -
33   -/**
34   - * Accepts a web encoded string and outputs a "clean" string.
35   - */
36   -
37   -function sanitize($string) {
38   - // This should be set if you've read the INSTALL instructions.
39   - // Better to be safe though.
40   - if (get_magic_quotes_gpc()) {
41   - $string = strip_tags(urldecode(trim($string)));
42   - } else {
43   - $string = addslashes(strip_tags(urldecode(trim($string))));
44   - }
45   -
46   - // This might be a little too aggressive
47   - //$pattern = "([^[:alpha:]|^_\.\ \:-])";
48   - // Allow numeric characters
49   - $pattern = "([^[:alnum:]|^_\.\ \:-])";
50   - return ereg_replace($pattern, '', $string);
51   -}
52   -
53   -?>
lib/util/sanitize.inc
... ... @@ -52,11 +52,12 @@ function sanitize($string) {
52 52  
53 53 function sanitizeForSQL($string, $min='', $max='') {
54 54  
  55 + $string = trim($string);
  56 + if(get_magic_quotes_gpc()) $string = stripslashes($string);
  57 +
55 58 $len = strlen($string);
56 59 if((($min != '') && ($len < $min)) || (($max != '') && ($len > $max))) return false;
57 60  
58   - if(get_magic_quotes_gpc()) $string = stripslashes($string);
59   -
60 61 if(function_exists("mysql_real_escape_string")) {
61 62 return mysql_real_escape_string($string);
62 63 } else {
... ... @@ -64,38 +65,54 @@ function sanitizeForSQL($string, $min=&#39;&#39;, $max=&#39;&#39;) {
64 65 }
65 66 }
66 67  
  68 +function sanitizeForSQLtoHTML($string, $min='', $max='') {
  69 +
  70 + return stripslashes(trim($string));
  71 +
  72 +}
  73 +
67 74 function sanitizeForHTML($string, $min='', $max='')
68 75 {
  76 + $string = trim($string);
  77 + if(get_magic_quotes_gpc()) $string = stripslashes($string);
  78 +
69 79 $len = strlen($string);
70 80 if((($min != '') && ($len < $min)) || (($max != '') && ($len > $max))) return false;
71 81  
72   - $pattern[0] = '/\&/';
73   - $pattern[1] = '/</';
74   - $pattern[2] = "/>/";
75   - $pattern[3] = '/\n/';
76   - $pattern[4] = '/"/';
77   - $pattern[5] = "/'/";
78   - $pattern[6] = "/%/";
79   - $pattern[7] = '/\( /';
80   - $pattern[8] = '/\)/';
81   - $pattern[9] = '/\+/';
82   - $pattern[10] = '/-/';
83   - $replacement[0] = '&amp;';
84   - $replacement[1] = '&lt;';
85   - $replacement[2] = '&gt;';
86   - $replacement[3] = '<br>';
87   - $replacement[4] = '&quot;';
88   - $replacement[5] = '&#39;';
89   - $replacement[6] = '&#37;';
90   - $replacement[7] = '&#40;';
91   - $replacement[8] = '&#41;';
92   - $replacement[9] = '&#43;';
93   - $replacement[10] = '&#45;';
94   - return preg_replace( $pattern, $replacement, $string);
  82 + if(function_exists("htmlspecialchars")) {
  83 + return htmlspecialchars($string);
  84 + } else {
  85 + $pattern[0] = '/\&/';
  86 + $pattern[1] = '/</';
  87 + $pattern[2] = "/>/";
  88 + $pattern[3] = '/\n/';
  89 + $pattern[4] = '/"/';
  90 + $pattern[5] = "/'/";
  91 + $pattern[6] = "/%/";
  92 + $pattern[7] = '/\( /';
  93 + $pattern[8] = '/\)/';
  94 + $pattern[9] = '/\+/';
  95 + $pattern[10] = '/-/';
  96 + $replacement[0] = '&amp;';
  97 + $replacement[1] = '&lt;';
  98 + $replacement[2] = '&gt;';
  99 + $replacement[3] = '<br>';
  100 + $replacement[4] = '&quot;';
  101 + $replacement[5] = '&#39;';
  102 + $replacement[6] = '&#37;';
  103 + $replacement[7] = '&#40;';
  104 + $replacement[8] = '&#41;';
  105 + $replacement[9] = '&#43;';
  106 + $replacement[10] = '&#45;';
  107 + return preg_replace( $pattern, $replacement, $string);
  108 + }
95 109 }
96 110  
97 111 function sanitizeForSYSTEM($string, $min='', $max='')
98 112 {
  113 + $string = trim($string);
  114 + if(get_magic_quotes_gpc()) $string = stripslashes($string);
  115 +
99 116 $len = strlen($string);
100 117 if((($min != '') && ($len < $min)) || (($max != '') && ($len > $max))) return false;
101 118  
... ...
plugins/ktcore/document/edit.php
... ... @@ -96,7 +96,7 @@ class KTDocumentEditAction extends KTDocumentAction {
96 96 'description' => sprintf(_kt("The document title is used as the main name of a document throughout %s&trade;."), APP_NAME),
97 97 'name' => 'document_title',
98 98 'required' => true,
99   - 'value' => $this->oDocument->getName(),
  99 + 'value' => sanitizeForHTML($this->oDocument->getName()),
100 100 )),
101 101 );
102 102 $validators = array(
... ... @@ -191,7 +191,8 @@ class KTDocumentEditAction extends KTDocumentAction {
191 191 if ($this->oDocument->getDocumentTypeId() != $doctypeid) {
192 192 $this->oDocument->setDocumentTypeId($doctypeid);
193 193 }
194   - $this->oDocument->setName(sanitize($data['document_title']));
  194 + $this->oDocument->setName(($data['document_title']));
  195 +
195 196 $res = $this->oDocument->update();
196 197 if (PEAR::isError($res)) {
197 198 $oForm->handleError(sprintf(_kt("Unexpected failure to update document title: %s"), $res->getMessage()));
... ...
templates/kt3/document/view.smarty
1 1 <h2>{$document->getName()}</h2>
2 2  
3   -
4 3 {capture assign=version}
5 4 {$document->getMajorVersionNumber()}.{$document->getMinorVersionNumber()}
6 5 {/capture}
... ...
templates/kt3/fieldsets/simple_versioned.smarty
... ... @@ -13,10 +13,10 @@
13 13 <tr class="{cycle values=even,odd} {if $smarty.foreach.fields.first}first{/if}">
14 14 <th>{$aFieldPair.field->getName()}</th>
15 15 <td class="current {if ($aFieldPair.current_value != $aFieldPair.previous_value)}different{/if}">
16   - {if ($aFieldPair.current_value !== null)}{$aFieldPair.current_value|escape:"htmlall"}
  16 + {if ($aFieldPair.current_value !== null)}{$aFieldPair.current_value}
17 17 {else}<span class="descriptiveText">{i18n}no value in this version{/i18n}</span>{/if}</td>
18 18 <td class="previous {if ($aFieldPair.current_value != $aFieldPair.previous_value)}different{/if}">
19   - {if ($aFieldPair.previous_value !== null)}{$aFieldPair.previous_value|escape:"htmlall"}
  19 + {if ($aFieldPair.previous_value !== null)}{$aFieldPair.previous_value}
20 20 {else}<span class="descriptiveText">{i18n}no value in this version{/i18n}</span>{/if}</td>
21 21 </tr>
22 22 {/foreach}
... ...
templates/kt3/standard_page.smarty
... ... @@ -132,9 +132,9 @@
132 132 {if ($page->breadcrumbs !== false)}
133 133 {foreach item=aCrumb from=$page->breadcrumbs name=bc}
134 134 {if ($aCrumb.url) }
135   - <a href="{$aCrumb.url}">{$aCrumb.label|escape}</a>
  135 + <a href="{$aCrumb.url}">{$aCrumb.label}</a>
136 136 {else}
137   - <span>{$aCrumb.label|escape|truncate:40:"...":true}</span>
  137 + <span>{$aCrumb.label|mb_truncate:40:"...":true}</span>
138 138 {/if}
139 139 {if (!$smarty.foreach.bc.last)}
140 140 &raquo;
... ...
templates/ktcore/action/checkout_final.smarty
... ... @@ -3,7 +3,7 @@
3 3 {$context->oPage->requireJSResource("thirdpartyjs/MochiKit/Iter.js")}
4 4 {$context->oPage->requireJSResource("thirdpartyjs/MochiKit/DOM.js")}
5 5  
6   -{capture assign=sLocation}action=checkout_final&fDocumentId={$context->oDocument->getId()}&reason={$reason|escape}{/capture}
  6 +{capture assign=sLocation}action=checkout_final&fDocumentId={$context->oDocument->getId()}&reason={$reason}{/capture}
7 7  
8 8 {capture assign=sJavascript}
9 9 function doCheckout () {ldelim}
... ...
templates/ktcore/document/cleanup.smarty
... ... @@ -28,7 +28,7 @@ which you should investigate.{/i18n}&lt;/p&gt;
28 28 <p>{i18n}The following files are present in the repository, but do not exist in the database.{/i18n}:</p>
29 29 <ul>
30 30 {foreach from=$aFilesToRemove item=sFile}
31   -<li>{$sFile|escape}</li>
  31 +<li>{$sFile}</li>
32 32 {/foreach}
33 33 </ul>
34 34 {/if}
... ...
templates/ktcore/document/cleanup_script.smarty
... ... @@ -29,7 +29,7 @@
29 29 {i18n}The following files are present in the repository, but do not exist in the database.{/i18n}:
30 30  
31 31 {foreach from=$aFilesToRemove item=sFile}
32   - {$sFile|escape}
  32 + {$sFile}
33 33 {/foreach}
34 34  
35 35 {/if}
... ...
templates/ktcore/document/edit.smarty
... ... @@ -11,7 +11,7 @@
11 11  
12 12 {$context->oPage->requireCSSResource('resources/css/kt-treewidget.css')}
13 13  
14   -<h2>{i18n}Editing{/i18n}: {$document->getName()}</h2>
  14 +<h2>{i18n}Editing{/i18n}: {$document->getName()|wordwrap:40:"<br />\n":true}</h2>
15 15  
16 16 {capture assign=link}{addQS}action=selectType&fDocumentId={$document->getId()}{/addQS}{/capture}
17 17 <p class="descriptiveText">{i18n arg_link=$link arg_name=$type_name}Change the <strong><a href="#link#">document type</a></strong>. The current type is "#name#"{/i18n}</p>
... ...
templates/ktcore/document/view.smarty
1   -<h2><img src="{if $config->get("ui/morphEnabled") == '1'}{$rootUrl}/skins/kts_{$config->get("ui/morphTo")}/title_bullet.png{else}{$rootUrl}/resources/graphics/title_bullet.png{/if}"/>{$document->getName()|escape|wordwrap:40:"\n":true}</h2>
  1 +<h2><img src="{if $config->get("ui/morphEnabled") == '1'}{$rootUrl}/skins/kts_{$config->get("ui/morphTo")}/title_bullet.png{else}{$rootUrl}/resources/graphics/title_bullet.png{/if}"/>{$document->getName()|mb_wordwrap:40:"<br />\n":true}</h2>
2 2  
3 3 {if ($document->getIsCheckedOut() == 1)}
4 4 {capture assign=checkout_user}<strong>{$sCheckoutUser}</strong>{/capture}
... ...
templates/ktcore/documenttypes/edit.smarty
... ... @@ -3,7 +3,7 @@
3 3 <form method="POST" action="{$smarty.server.PHP_SELF}">
4 4 <input type="hidden" name="action" value="editobject">
5 5 <input type="hidden" name="fDocumentTypeId" value="{$oDocumentType->getId()}">
6   -<input type="textbox" name="name" value="{$oDocumentType->getName()|escape}">
  6 +<input type="textbox" name="name" value="{$oDocumentType->getName()}">
7 7 <input type="submit" name="submit" value="{i18n}Change{/i18n}" />
8 8 </form>
9 9  
... ...
templates/ktcore/fields/edit.smarty
1   -<h2>{i18n}Fieldset{/i18n}: {$oFieldset->getName()|escape}</h2>
  1 +<h2>{i18n}Fieldset{/i18n}: {$oFieldset->getName()}</h2>
2 2  
3 3  
4 4 <form action="{$smarty.server.PHP_SELF}" method="POST">
... ... @@ -9,11 +9,11 @@
9 9 <table class="prettysw" cellpadding="0" cellspacing="0">
10 10 <tr>
11 11 <th>{i18n}Name{/i18n}</th>
12   - <td><input type="textbox" name="name" value="{$oFieldset->getName()|escape}" /></td>
  12 + <td><input type="textbox" name="name" value="{$oFieldset->getName()}" /></td>
13 13 </tr>
14 14 <tr>
15 15 <th>{i18n}Namespace{/i18n}</th>
16   - <td><input type="textbox" name="namespace" value="{$oFieldset->getNamespace()|escape}" /></td>
  16 + <td><input type="textbox" name="namespace" value="{$oFieldset->getNamespace()}" /></td>
17 17 </tr>
18 18 </table>
19 19 <input type="submit" name="submit" value="{i18n}Change{/i18n}" />
... ... @@ -30,7 +30,7 @@
30 30 {foreach from=$oFieldset->getFields() item=oField}
31 31 <li><label><input type="checkbox"
32 32 name="fieldsetids[]"
33   -value="{$oField->getId()}" />{$oField->getName()|escape}</label></li>
  33 +value="{$oField->getId()}" />{$oField->getName()}</label></li>
34 34 {/foreach}
35 35 </ul>
36 36 <input type="submit" name="submit" value="{i18n}Remove fields{/i18n}" />
... ...
templates/ktcore/login.smarty
... ... @@ -21,7 +21,7 @@
21 21 <form action="{$smarty.server.PHP_SELF}" method="POST" name="login">
22 22 <input type="hidden" name="action" value="login" />
23 23 <input type="hidden" name="cookieverify" value="{$cookietest}" />
24   - <input type="hidden" name="redirect" value="{$redirect|escape}" />
  24 + <input type="hidden" name="redirect" value="{$redirect}" />
25 25 {if $config->get("ui/mainLogo") != ''}
26 26 <img src="{$config->get("ui/mainLogo")}" alt="{$config->get("ui/mainLogoTitle")}" class="logoimage"/><br />
27 27 {else}
... ...
templates/ktcore/manage_help_item.smarty
... ... @@ -13,9 +13,9 @@ tinyMCE.init({
13 13 <input type="hidden" name="id" value="{$help->getId()}">
14 14 <input type="hidden" name="action" value="updateReplacement">
15 15 <h2>{i18n}Title{/i18n}</h2>
16   -<input type="text" name="title" value="{$help->getTitle()|escape}" />
  16 +<input type="text" name="title" value="{$help->getTitle()}" />
17 17 <h2>{i18n}Help content{/i18n}</h2>
18   -<textarea cols="60" rows="20" name="description">{$help->getDescription()|escape}</textarea>
  18 +<textarea cols="60" rows="20" name="description">{$help->getDescription()}</textarea>
19 19 <br />
20 20 <input type="submit" name="submit" value="{i18n}Update{/i18n}" />
21 21 </form>
... ...
templates/ktcore/metadata/admin/basic_overview.smarty
... ... @@ -18,7 +18,7 @@ of related information.{/i18n}&lt;/p&gt;
18 18 {foreach from=$fields item=oField}
19 19 <tr>
20 20 <td class="title">
21   - {$oField->getName()|escape}
  21 + {$oField->getName()}
22 22 </td>
23 23 <td class="centered">
24 24 <a href="{addQS context=$context}fieldset_action=managefield&fFieldId={$oField->getId()}{/addQS}" class="ktAction ktEdit">{i18n}edit{/i18n}</a>
... ...
templates/ktcore/metadata/admin/manage_lookups.smarty
... ... @@ -37,7 +37,7 @@ that are possible for a given lookup:{/i18n}&lt;/p&gt;
37 37 {foreach from=$lookups item=oLookup}
38 38 <tr>
39 39 <td><input type="checkbox" name="metadata[]" value="{$oLookup->getId()}" /></td>
40   - <td>{$oLookup->getName()|escape}</td>
  40 + <td>{$oLookup->getName()}</td>
41 41 <td class="centered">{if (!$oLookup->getDisabled())}<span class="ktAction ktAllowed">{i18n}Yes{/i18n}</span>{else}<span class="ktAction ktDenied">{i18n}No{/i18n}</span>{/if}</td>
42 42 <td class="centered">{if ($oLookup->getIsStuck())}<span>{i18n}Yes{/i18n}</span>{else}&nbsp;{/if}</td>
43 43 </tr>
... ...
templates/ktcore/metadata/chooseFromMetadataLookup.smarty
... ... @@ -3,7 +3,7 @@
3 3 {assign var="aLookups" value=$aFieldInfo.values}
4 4  
5 5 <div class="field ">
6   - <label for="condi-field-{$iFieldId}">{$oField->getName()|escape}</label>
  6 + <label for="condi-field-{$iFieldId}">{$oField->getName()}</label>
7 7 <p class="descriptiveText">FIXME</p>
8 8 <p class="errorMessage"></p>
9 9  
... ...
templates/ktcore/metadata/conditional/ajax_complex_get_behaviour_list.smarty
1 1 <behaviourList>
2 2 {foreach from=$aBehaviours item=oBehaviour}
3   - <behaviour value="{$oBehaviour->getId()}" label="{$oBehaviour->getName()|escape}" />
  3 + <behaviour value="{$oBehaviour->getId()}" label="{$oBehaviour->getName()}" />
4 4 {/foreach}
5 5 </behaviourList>
... ...
templates/ktcore/metadata/conditional/conditional_admin_overview.smarty
... ... @@ -71,7 +71,7 @@ ordering!{/i18n}&lt;/p&gt;
71 71 {foreach from=$fields item=oField}
72 72 <tr>
73 73 <td class="title">
74   - {$oField->getName()|escape}
  74 + {$oField->getName()}
75 75 </td>
76 76 <td>
77 77 <a href="{addQS context=$context}fieldset_action=managefield&fFieldId={$oField->getId()}{/addQS}" class="ktAction ktEdit">{i18n}edit{/i18n}</a>
... ...
templates/ktcore/metadata/conditional/editsimple.smarty
... ... @@ -96,7 +96,7 @@ refresh the page.{/i18n}&lt;/p&gt;
96 96 <div class="lookup_items">
97 97 <select class="item_list" size="5">
98 98 {foreach from=$oField->getEnabledValues() item=oMetaData}
99   - <option value="{$oMetaData->getId()}">{$oMetaData->getName()|escape}</option>
  99 + <option value="{$oMetaData->getId()}">{$oMetaData->getName()}</option>
100 100 {/foreach}
101 101 </select>
102 102  
... ...
templates/ktcore/metadata/conditional/manageConditional.smarty
... ... @@ -27,7 +27,7 @@ the issues identified below.{/i18n}&lt;/span&gt;
27 27 {if $sIncomplete}
28 28 <div class="ktErrorMessage">
29 29 <span>{i18n}This error prevents this fieldset from being set
30   -to complete{/i18n}: {$sIncomplete|escape}</span>
  30 +to complete{/i18n}: {$sIncomplete}</span>
31 31 </div>
32 32 {/if}
33 33 {/if}
... ... @@ -127,9 +127,9 @@ $this-&gt;assign(&quot;oParentField&quot;, DocumentField::get($this-&gt;_tpl_vars[&#39;aRow&#39;][&#39;paren
127 127 $this->assign("oChildField", DocumentField::get($this->_tpl_vars['aRow']['child_field_id']));
128 128 {/php}
129 129 <li>
130   - {$oParentField->getName()|escape}
  130 + {$oParentField->getName()}
131 131 <span class="descriptiveText">{i18n}controls the values available in{/i18n}</span>
132   - {$oChildField->getName()|escape}
  132 + {$oChildField->getName()}
133 133 </li>
134 134 {/foreach}
135 135 </ul>
... ...
templates/ktcore/metadata/conditional/manage_ordering.smarty
... ... @@ -12,9 +12,9 @@ $this-&gt;assign(&quot;oParentField&quot;, DocumentField::get($this-&gt;_tpl_vars[&#39;aRow&#39;][&#39;paren
12 12 $this->assign("oChildField", DocumentField::get($this->_tpl_vars['aRow']['child_field_id']));
13 13 {/php}
14 14 <li>
15   - {$oParentField->getName()|escape}
  15 + {$oParentField->getName()}
16 16 <span class="descriptiveText">{i18n}controls the values available in{/i18n}</span>
17   - {$oChildField->getName()|escape}
  17 + {$oChildField->getName()}
18 18 </li>
19 19 {/foreach}
20 20 </ul>
... ...
templates/ktcore/metadata/edit.smarty
1   -<h2>{i18n}Fieldset{/i18n}: {$oFieldset->getName()|escape}</h2>
  1 +<h2>{i18n}Fieldset{/i18n}: {$oFieldset->getName()}</h2>
2 2  
3 3 <h3>{i18n}Fieldset properties{/i18n}</h3>
4 4 <form action="{$smarty.server.PHP_SELF}" method="POST">
... ... @@ -7,11 +7,11 @@
7 7 <table class="prettysw" cellpadding="0" cellspacing="0">
8 8 <tr>
9 9 <th>{i18n}Name{/i18n}</th>
10   - <td><input type="textbox" name="name" value="{$oFieldset->getName()|escape}"></td>
  10 + <td><input type="textbox" name="name" value="{$oFieldset->getName()}"></td>
11 11 </tr>
12 12 <tr>
13 13 <th>{i18n}Namespace{/i18n}</th>
14   - <td><input type="textbox" name="namespace" value="{$oFieldset->getNamespace()|escape}"></td>
  14 + <td><input type="textbox" name="namespace" value="{$oFieldset->getNamespace()}"></td>
15 15 </tr>
16 16 </table>
17 17 <input type="submit" name="submit" value="{i18n}Change{/i18n}" />
... ... @@ -27,7 +27,7 @@
27 27 {foreach from=$oFieldset->getFields() item=oField}
28 28 <li><label><input type="checkbox"
29 29 name="fieldsetids[]"
30   -value="{$oField->getId()}">{$oField->getName()|escape}</label></li>
  30 +value="{$oField->getId()}">{$oField->getName()}</label></li>
31 31 {/foreach}
32 32 </ul>
33 33 <input type="submit" name="submit" value="{i18n}Remove fields{/i18n}" />
... ...
templates/ktcore/metadata/editField.smarty
1   -<h2>{i18n}Edit Field{/i18n}: {$oField->getName()|escape}</h2>
  1 +<h2>{i18n}Edit Field{/i18n}: {$oField->getName()}</h2>
2 2  
3 3 <form action="{$smarty.server.PHP_SELF}" method="POST">
4 4 <fieldset>
... ... @@ -9,15 +9,15 @@
9 9 <table class="prettysw" cellpadding="0" cellspacing="0">
10 10 <tr>
11 11 <th>{i18n}Name{/i18n}</th>
12   - <td><input type="textbox" name="name" value="{$oField->getName()|escape}"></td>
  12 + <td><input type="textbox" name="name" value="{$oField->getName()}"></td>
13 13 </tr>
14 14 <tr>
15 15 <th>{i18n}Description{/i18n}</th>
16   - <td><textarea name="description">{$oField->getDescription()|escape}</textarea></td>
  16 + <td><textarea name="description">{$oField->getDescription()}</textarea></td>
17 17 </tr>
18 18 <tr>
19 19 <th>{i18n}Type{/i18n}</th>
20   - <td>{$oField->getType()|escape}</td>
  20 + <td>{$oField->getType()}</td>
21 21 </tr>
22 22 <tr>
23 23 <th>{i18n}Required{/i18n}</th>
... ... @@ -71,7 +71,7 @@
71 71 <ul>
72 72 {foreach from=$aEnabledMetadata item=oMetaData}
73 73 <li><label><input type="checkbox" name="metadata[]"
74   -value="{$oMetaData->getId()}">{$oMetaData->getName()|escape}
  74 +value="{$oMetaData->getId()}">{$oMetaData->getName()}
75 75 { if $oMetaData->getIsStuck() }
76 76 <span class="helpText">({i18n}stuck, will never be disabled when synchronising
77 77 from another source{/i18n})</span>
... ... @@ -98,7 +98,7 @@ from another source{/i18n})&lt;/span&gt;
98 98 <ul>
99 99 {foreach from=$aDisabledMetadata item=oMetaData}
100 100 <li><label><input type="checkbox" name="metadata[]"
101   -value="{$oMetaData->getId()}">{$oMetaData->getName()|escape}
  101 +value="{$oMetaData->getId()}">{$oMetaData->getName()}
102 102 { if $oMetaData->getIsStuck() }
103 103 <span class="helpText">({i18n}stuck, will never be enabled when synchronising
104 104 from another source{/i18n})</span>
... ...
templates/ktcore/metadata/editFieldset.smarty
1   -<h2>{i18n}Fieldset{/i18n}: {$oFieldset->getName()|escape}</h2>
  1 +<h2>{i18n}Fieldset{/i18n}: {$oFieldset->getName()}</h2>
2 2  
3 3 {if $sIncomplete}
4 4 <div class="ktErrorMessage">
5 5 <span><strong>{i18n}Incomplete{/i18n}: </strong>{i18n}This conditional fieldset cannot be used{/i18n}: <br />
6   -{$sIncomplete|escape}</span>
  6 +{$sIncomplete}</span>
7 7 </div>
8 8 {/if}
9 9  
... ... @@ -66,7 +66,7 @@ field can depend on the user&#39;s selections for the others.{/i18n}
66 66 {if $sIncomplete}
67 67 <div class="ktError">
68 68 <p>{i18n}This error prevents this fieldset from being set
69   -to complete{/i18n}: {$sIncomplete|escape}</p>
  69 +to complete{/i18n}: {$sIncomplete}</p>
70 70 </div> <br />
71 71 {/if}
72 72  
... ... @@ -145,7 +145,7 @@ to complete{/i18n}: {$sIncomplete|escape}&lt;/p&gt;
145 145 <tr>
146 146 <td><input type="checkbox" name="fields[]" value="{$oField->getId()}" /></td>
147 147 <td class="title">
148   -{$oField->getName()|escape}
  148 +{$oField->getName()}
149 149 </td>
150 150 <td>
151 151 <a href="{addQS}action=editField&fFieldId={$oField->getId()}&fFieldsetId={$oFieldset->getId()}{/addQS}" class="ktAction ktEdit">{i18n}edit{/i18n}</a>
... ...
templates/ktcore/workflow/editState.smarty
... ... @@ -20,7 +20,7 @@ td.false { background-color: #ffaaaa; text-align: centre }
20 20 {/literal}{/capture}
21 21 {$context->oPage->requireCSSStandalone($sCSS)}
22 22  
23   -<h2>{i18n}State{/i18n}: {$oState->getName()|escape}</h2>
  23 +<h2>{i18n}State{/i18n}: {$oState->getName()}</h2>
24 24  
25 25 <p class="descriptiveText">{i18n}As documents move through their lifecycle, they
26 26 are placed in certain <strong>states</strong>. For example, an invoice
... ... @@ -106,7 +106,7 @@ with a specific &lt;strong&gt;role&lt;/strong&gt; (e.g. Manager) or part of a specific group
106 106 <li><a
107 107 href="{addQS}action=editTransition&fWorkflowId={$oWorkflow->getId()}&fTransitionId={$oTransition->getId()}{/addQS}"
108 108 title="Transition
109   -{$oTransition->getId()}">{$oTransition->getName()|escape}</a></li>
  109 +{$oTransition->getId()}">{$oTransition->getName()}</a></li>
110 110 {/foreach}
111 111 </ul>
112 112  
... ...
templates/ktcore/workflow/editTransition.smarty
1   -<h2>{i18n}Transition{/i18n}: {$oTransition->getName()|escape}</h2>
  1 +<h2>{i18n}Transition{/i18n}: {$oTransition->getName()}</h2>
2 2  
3 3  
4 4 <form action="{$smarty.server.PHP_SELF}" method="POST">
... ...
templates/ktcore/workflow/editWorkflow.smarty
1 1 {$context->oPage->requireCSSResource('resources/css/workflow-admin.css')}
2 2  
3   -<h2>{i18n}Workflow Overview{/i18n}: {$oWorkflow->getName()|escape}</h2>
  3 +<h2>{i18n}Workflow Overview{/i18n}: {$oWorkflow->getName()}</h2>
4 4  
5 5 <form action="{$smarty.server.PHP_SELF}" method="POST">
6 6 <fieldset>
... ...
templates/ktstandard/disclaimers/manage_disclaimers_item.smarty
... ... @@ -14,7 +14,7 @@ tinyMCE.init({
14 14 <input type="hidden" name="action" value="update">
15 15 <input type="hidden" name="title" value="{$help->getTitle()}">
16 16  
17   -<h2>{$help->getTitle()|escape}</h2>
18   -<textarea cols="60" rows="20" name="description">{$help->getDescription()|escape}</textarea>
  17 +<h2>{$help->getTitle()}</h2>
  18 +<textarea cols="60" rows="20" name="description">{$help->getDescription()}</textarea>
19 19 <input type="submit" name="submit" value="{i18n}Update{/i18n}" />
20 20 </form>
... ...
thirdparty/Smarty/plugins/modifier.mb_truncate.php 0 → 100644
  1 +<?php
  2 +/**
  3 + * Smarty plugin
  4 + * @package Smarty
  5 + * @subpackage plugins
  6 + */
  7 +
  8 +
  9 +/**
  10 + * Smarty mb_truncate modifier plugin
  11 + *
  12 + * Type: modifier<br>
  13 + * Name: mb_truncate<br>
  14 + * Purpose: Truncate a multibyte string to a certain length if necessary,
  15 + * optionally splitting in the middle of a word, and
  16 + * appending the $etc string.
  17 + * @param string
  18 + * @param integer
  19 + * @param string
  20 + * @param boolean
  21 + * @return string
  22 + */
  23 +function smarty_modifier_mb_truncate($string, $length = 80, $etc = '...',
  24 + $break_words = false)
  25 +{
  26 + if ($length == 0)
  27 + return '';
  28 +
  29 + if (mb_strlen($string) > $length) {
  30 + $length -= mb_strlen($etc);
  31 + if (!$break_words)
  32 + $string = preg_replace('/\s+?(\S+)?$/', '', mb_substr($string, 0, $length+1));
  33 +
  34 + return mb_substr($string, 0, $length).$etc;
  35 + } else
  36 + return $string;
  37 +}
  38 +?>
0 39 \ No newline at end of file
... ...
thirdparty/Smarty/plugins/modifier.mb_wordwrap.php 0 → 100644
  1 +<?php
  2 +/**
  3 + * Smarty plugin
  4 + * @package Smarty
  5 + * @subpackage plugins
  6 + */
  7 +
  8 +
  9 +/**
  10 + * Smarty mb_wordwrap modifier plugin
  11 + *
  12 + * Type: modifier<br>
  13 + * Name: mb_wordwrap<br>
  14 + * Purpose: wrap a multibyte string of text at a given length
  15 + * @param string
  16 + * @param integer
  17 + * @param string
  18 + * @param boolean
  19 + * @return string
  20 + */
  21 +function smarty_modifier_mb_wordwrap($string,$length=80,$break="\n",$cut=false)
  22 +{
  23 +
  24 + $newString = "";
  25 + $index = 0;
  26 + while(mb_strlen($newString) < mb_strlen($string)){
  27 + $newString .= mb_strcut($string, $index, $length, "UTF8") . $break;
  28 + $index += $length;
  29 + }
  30 + return $newString;
  31 +
  32 +}
  33 +?>
0 34 \ No newline at end of file
... ...