Commit 3807c0863ff09af3a34101710dcc96c584e9d9a2

Authored by kevin_fourie
1 parent 98518d46

KTC-230

"ZendGuard 5.0.0 array_multisort bug is breaking encoding."
Fixed. Used two sorts instead of multisort.

Committed By: Kevin Fourie
Reviewed By: Conrad Vermeulen



git-svn-id: https://kt-dms.svn.sourceforge.net/svnroot/kt-dms/trunk@7132 c91229c3-7414-0410-bfa2-8a42b809f60b
Showing 1 changed file with 26 additions and 26 deletions
lib/session/SiteMap.inc
@@ -8,7 +8,7 @@ @@ -8,7 +8,7 @@
8 * License Version 1.1.2 ("License"); You may not use this file except in 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 9 * compliance with the License. You may obtain a copy of the License at
10 * http://www.knowledgetree.com/KPL 10 * http://www.knowledgetree.com/KPL
11 - * 11 + *
12 * Software distributed under the License is distributed on an "AS IS" 12 * Software distributed under the License is distributed on an "AS IS"
13 * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. 13 * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied.
14 * See the License for the specific language governing rights and 14 * See the License for the specific language governing rights and
@@ -19,9 +19,9 @@ @@ -19,9 +19,9 @@
19 * (ii) the KnowledgeTree copyright notice 19 * (ii) the KnowledgeTree copyright notice
20 * in the same form as they appear in the distribution. See the License for 20 * in the same form as they appear in the distribution. See the License for
21 * requirements. 21 * requirements.
22 - * 22 + *
23 * The Original Code is: KnowledgeTree Open Source 23 * The Original Code is: KnowledgeTree Open Source
24 - * 24 + *
25 * The Initial Developer of the Original Code is The Jam Warehouse Software 25 * The Initial Developer of the Original Code is The Jam Warehouse Software
26 * (Pty) Ltd, trading as KnowledgeTree. 26 * (Pty) Ltd, trading as KnowledgeTree.
27 * Portions created by The Jam Warehouse Software (Pty) Ltd are Copyright 27 * Portions created by The Jam Warehouse Software (Pty) Ltd are Copyright
@@ -50,12 +50,12 @@ class SiteMap { @@ -50,12 +50,12 @@ class SiteMap {
50 * Whether to use the database to store the sitemap or not 50 * Whether to use the database to store the sitemap or not
51 */ 51 */
52 var $bUseDB; 52 var $bUseDB;
53 - 53 +
54 /** 54 /**
55 * Whether to the user accessing the page is a Sysadmin 55 * Whether to the user accessing the page is a Sysadmin
56 */ 56 */
57 var $isSysAdmin; 57 var $isSysAdmin;
58 - 58 +
59 /** 59 /**
60 * * Whether to the user accessing the page is a Unitadmin 60 * * Whether to the user accessing the page is a Unitadmin
61 */ 61 */
@@ -78,7 +78,7 @@ class SiteMap { @@ -78,7 +78,7 @@ class SiteMap {
78 /** 78 /**
79 * Sets the database flag 79 * Sets the database flag
80 * 80 *
81 - * @param boolean whether to use the database to store the sitemap or not 81 + * @param boolean whether to use the database to store the sitemap or not
82 */ 82 */
83 function setUseDB($bUseDB) { 83 function setUseDB($bUseDB) {
84 $this->bUseDB = $bUseDB; 84 $this->bUseDB = $bUseDB;
@@ -111,12 +111,12 @@ class SiteMap { @@ -111,12 +111,12 @@ class SiteMap {
111 "order" => $iOrder); 111 "order" => $iOrder);
112 } 112 }
113 } 113 }
114 - 114 +
115 function addSectionColour($sSectionName, $sHtmlElement, $sColour) { 115 function addSectionColour($sSectionName, $sHtmlElement, $sColour) {
116 - $this->aSectionColours[$sSectionName][$sHtmlElement] = $sColour; 116 + $this->aSectionColours[$sSectionName][$sHtmlElement] = $sColour;
117 } 117 }
118 -  
119 - function getSectionColour($sSectionName, $sHtmlElement) { 118 +
  119 + function getSectionColour($sSectionName, $sHtmlElement) {
120 return $this->aSectionColours[$sSectionName][$sHtmlElement]; 120 return $this->aSectionColours[$sSectionName][$sHtmlElement];
121 } 121 }
122 122
@@ -127,7 +127,7 @@ class SiteMap { @@ -127,7 +127,7 @@ class SiteMap {
127 * @param string the corresponding page for this action 127 * @param string the corresponding page for this action
128 * @param string the section this page falls under 128 * @param string the section this page falls under
129 * @param int the minimum access needed to access this page 129 * @param int the minimum access needed to access this page
130 - * @param string description of the page for link presentation 130 + * @param string description of the page for link presentation
131 */ 131 */
132 function addDefaultPage($sAction, $sPage, $sSectionName, $sRequiredAccess, $sLinkText, $bEnabled = true, $iOrder = 0) { 132 function addDefaultPage($sAction, $sPage, $sSectionName, $sRequiredAccess, $sLinkText, $bEnabled = true, $iOrder = 0) {
133 if (!$this->bUseDB) { 133 if (!$this->bUseDB) {
@@ -153,7 +153,7 @@ class SiteMap { @@ -153,7 +153,7 @@ class SiteMap {
153 /** 153 /**
154 * Returns controller links for a section. 154 * Returns controller links for a section.
155 * Checks whether to use the db or not and calls the appropriate method 155 * Checks whether to use the db or not and calls the appropriate method
156 - * 156 + *
157 * @param string the section to return links for 157 * @param string the section to return links for
158 */ 158 */
159 function getSectionLinks($sSectionName, $bSortLinks = true) { 159 function getSectionLinks($sSectionName, $bSortLinks = true) {
@@ -195,7 +195,7 @@ class SiteMap { @@ -195,7 +195,7 @@ class SiteMap {
195 if (strlen($sql->f("link_text")) > 0) { 195 if (strlen($sql->f("link_text")) > 0) {
196 $results["descriptions"][] = $sql->f("link_text"); 196 $results["descriptions"][] = $sql->f("link_text");
197 // if fFolderID is set and fFolderID is in the page string 197 // if fFolderID is set and fFolderID is in the page string
198 - // append folderID to the controller link 198 + // append folderID to the controller link
199 $results["links"][] = isset($iFolderID) ? generateControllerLink($sql->f("action"), "fFolderID=$iFolderID") : generateControllerLink($sql->f("action"), ""); 199 $results["links"][] = isset($iFolderID) ? generateControllerLink($sql->f("action"), "fFolderID=$iFolderID") : generateControllerLink($sql->f("action"), "");
200 } 200 }
201 } 201 }
@@ -244,11 +244,11 @@ class SiteMap { @@ -244,11 +244,11 @@ class SiteMap {
244 ($pages[$action]["enabled"]) && (!$pages[$action]["default"])) { 244 ($pages[$action]["enabled"]) && (!$pages[$action]["default"])) {
245 if (!$bSortLinks) { 245 if (!$bSortLinks) {
246 $results["descriptions"][$pages[$action]["order"]] = $pages[$action]["description"]; 246 $results["descriptions"][$pages[$action]["order"]] = $pages[$action]["description"];
247 - 247 +
248 $results["links"][$pages[$action]["order"]] = isset($iFolderID) ? generateControllerLink($action, "fFolderID=$iFolderID") : generateControllerLink($action, ""); 248 $results["links"][$pages[$action]["order"]] = isset($iFolderID) ? generateControllerLink($action, "fFolderID=$iFolderID") : generateControllerLink($action, "");
249 } else { 249 } else {
250 $results["descriptions"][] = $pages[$action]["description"]; 250 $results["descriptions"][] = $pages[$action]["description"];
251 - 251 +
252 $results["links"][] = isset($iFolderID) ? generateControllerLink($action, "fFolderID=$iFolderID") : generateControllerLink($action, ""); 252 $results["links"][] = isset($iFolderID) ? generateControllerLink($action, "fFolderID=$iFolderID") : generateControllerLink($action, "");
253 } 253 }
254 } 254 }
@@ -258,9 +258,9 @@ class SiteMap { @@ -258,9 +258,9 @@ class SiteMap {
258 // now check if we have anything in the results array before returning it 258 // now check if we have anything in the results array before returning it
259 if (count($results) > 0) { 259 if (count($results) > 0) {
260 if ($bSortLinks) { 260 if ($bSortLinks) {
261 - // alpha sort the results  
262 - array_multisort ($results["descriptions"], SORT_ASC,  
263 - $results["links"], SORT_ASC); 261 + // alpha sort the results
  262 + sort($results["descriptions"], SORT_ASC);
  263 + sort($results["links"], SORT_ASC);
264 reset ($results); 264 reset ($results);
265 } 265 }
266 return $results; 266 return $results;
@@ -272,7 +272,7 @@ class SiteMap { @@ -272,7 +272,7 @@ class SiteMap {
272 return false; 272 return false;
273 } 273 }
274 } 274 }
275 - 275 +
276 /** 276 /**
277 * Returns the link text for a page 277 * Returns the link text for a page
278 * 278 *
@@ -298,12 +298,12 @@ class SiteMap { @@ -298,12 +298,12 @@ class SiteMap {
298 } 298 }
299 } 299 }
300 } 300 }
301 - } 301 + }
302 } 302 }
303 - 303 +
304 /** 304 /**
305 * Returns the page mapped to the (action, groupName) pair. 305 * Returns the page mapped to the (action, groupName) pair.
306 - * Checks whether to use the db or not and calls the appropriate method 306 + * Checks whether to use the db or not and calls the appropriate method
307 * 307 *
308 * @param string the action to lookup pages for 308 * @param string the action to lookup pages for
309 * @return string the page to redirect to, or false if the user doesn't have access to the page 309 * @return string the page to redirect to, or false if the user doesn't have access to the page
@@ -383,7 +383,7 @@ class SiteMap { @@ -383,7 +383,7 @@ class SiteMap {
383 383
384 /** 384 /**
385 * Returns the section name of the supplied page 385 * Returns the section name of the supplied page
386 - * Checks whether to use the db or not and calls the appropriate method 386 + * Checks whether to use the db or not and calls the appropriate method
387 * 387 *
388 * @param string the page to lookup the section for 388 * @param string the page to lookup the section for
389 */ 389 */
@@ -443,7 +443,7 @@ class SiteMap { @@ -443,7 +443,7 @@ class SiteMap {
443 443
444 /** 444 /**
445 * Returns the default action for the supplied section 445 * Returns the default action for the supplied section
446 - * Checks whether to use the db or not and calls the appropriate method 446 + * Checks whether to use the db or not and calls the appropriate method
447 * 447 *
448 * @param string the section name to return the default action for 448 * @param string the section name to return the default action for
449 * @return string the controller action for the default page for this section 449 * @return string the controller action for the default page for this section
@@ -629,7 +629,7 @@ class SiteMap { @@ -629,7 +629,7 @@ class SiteMap {
629 $aFieldValue = array( 629 $aFieldValue = array(
630 'name' => $section, 630 'name' => $section,
631 ); 631 );
632 - $id =& DBUtil::autoInsert($default->site_sections_table, $aFieldValues); 632 + $id = DBUtil::autoInsert($default->site_sections_table, $aFieldValues);
633 633
634 // $default->log->debug("Sitemap::syncWithDB insert=$sSectionSql"); 634 // $default->log->debug("Sitemap::syncWithDB insert=$sSectionSql");
635 635
@@ -653,7 +653,7 @@ class SiteMap { @@ -653,7 +653,7 @@ class SiteMap {
653 is_default => $page["default"], 653 is_default => $page["default"],
654 is_enabled => $page["enabled"], 654 is_enabled => $page["enabled"],
655 ); 655 );
656 - $id =& DBUtil::autoInsert($default->sitemap_table, $aFieldValues); 656 + $id = DBUtil::autoInsert($default->sitemap_table, $aFieldValues);
657 if (PEAR::isError($id)) { 657 if (PEAR::isError($id)) {
658 $default->log->debug("Sitemap::syncWithDB sitemap insert failed ($sSiteMapSql)"); 658 $default->log->debug("Sitemap::syncWithDB sitemap insert failed ($sSiteMapSql)");
659 } else { 659 } else {