Commit 8e876d99f42d9f4edc378200d60afc7ffe4de393
1 parent
7fc58982
KTS-2178
"cross site scripting" Implemented. Reviewed By: Kevin Fourie git-svn-id: https://kt-dms.svn.sourceforge.net/svnroot/kt-dms/trunk@7006 c91229c3-7414-0410-bfa2-8a42b809f60b
Showing
1 changed file
with
19 additions
and
8 deletions
plugins/rssplugin/KTrss.inc.php
| @@ -186,7 +186,7 @@ class KTrss{ | @@ -186,7 +186,7 @@ class KTrss{ | ||
| 186 | if ($aDocumentList) { | 186 | if ($aDocumentList) { |
| 187 | foreach($aDocumentList as $documentElement){ | 187 | foreach($aDocumentList as $documentElement){ |
| 188 | $document_id = $documentElement['id']; | 188 | $document_id = $documentElement['id']; |
| 189 | - $aDocumentTransactions = array_merge($aDocumentTransactions, KTrss::getDocumentTransactions($document_id)); | 189 | + $aDocumentTransactions = kt_array_merge($aDocumentTransactions, KTrss::getDocumentTransactions($document_id)); |
| 190 | } | 190 | } |
| 191 | } | 191 | } |
| 192 | if ($aDocumentTransactions){ | 192 | if ($aDocumentTransactions){ |
| @@ -220,8 +220,8 @@ class KTrss{ | @@ -220,8 +220,8 @@ class KTrss{ | ||
| 220 | // get information for folder | 220 | // get information for folder |
| 221 | function getOneFolder($iFolderId){ | 221 | function getOneFolder($iFolderId){ |
| 222 | $aFData = KTrss::getFolderData($iFolderId); | 222 | $aFData = KTrss::getFolderData($iFolderId); |
| 223 | - $aFTransactions = array_merge(KTrss::getChildrenFolderTransactions($iFolderId), KTrss::getFolderTransactions($iFolderId)); | ||
| 224 | - $aFTransactions = array_merge($aFTransactions, KTrss::getChildrenDocumentTransactions($iFolderId)); | 223 | + $aFTransactions = kt_array_merge(KTrss::getChildrenFolderTransactions($iFolderId), KTrss::getFolderTransactions($iFolderId)); |
| 224 | + $aFTransactions = kt_array_merge($aFTransactions, KTrss::getChildrenDocumentTransactions($iFolderId)); | ||
| 225 | 225 | ||
| 226 | $code = 'if (strtotime($a[datetime]) == strtotime($b[datetime])){ | 226 | $code = 'if (strtotime($a[datetime]) == strtotime($b[datetime])){ |
| 227 | return 0; | 227 | return 0; |
| @@ -255,6 +255,17 @@ class KTrss{ | @@ -255,6 +255,17 @@ class KTrss{ | ||
| 255 | } | 255 | } |
| 256 | } | 256 | } |
| 257 | 257 | ||
| 258 | + function rss_sanitize($str, $do_amp=true) | ||
| 259 | + { | ||
| 260 | + | ||
| 261 | + $result = str_replace("\\\"","\"",str_replace('\\\'','\'',htmlentities($str,ENT_NOQUOTES, 'UTF-8'))); | ||
| 262 | + if ($do_amp) | ||
| 263 | + { | ||
| 264 | + $result = str_replace('&','&',$result); | ||
| 265 | + } | ||
| 266 | + return $result; | ||
| 267 | + } | ||
| 268 | + | ||
| 258 | // Takes in an array as a parameter and returns rss2.0 compatible xml | 269 | // Takes in an array as a parameter and returns rss2.0 compatible xml |
| 259 | function arrayToXML($aItems){ | 270 | function arrayToXML($aItems){ |
| 260 | // Build path to host | 271 | // Build path to host |
| @@ -282,7 +293,7 @@ class KTrss{ | @@ -282,7 +293,7 @@ class KTrss{ | ||
| 282 | $sTypeSelect = 'document.transactionhistory&fDocumentId'; | 293 | $sTypeSelect = 'document.transactionhistory&fDocumentId'; |
| 283 | } | 294 | } |
| 284 | $feed .= "<item>\n" . | 295 | $feed .= "<item>\n" . |
| 285 | - "<title>".htmlentities($aItems[0][0][name],ENT_QUOTES, 'UTF-8')."</title>\n" . | 296 | + "<title>".KTrss::rss_sanitize($aItems[0][0][name],false)."</title>\n" . |
| 286 | "<link>".$hostPath."action.php?kt_path_info=ktcore.actions.".$sTypeSelect."=".$aItems[0][0]['id']."</link>\n" . | 297 | "<link>".$hostPath."action.php?kt_path_info=ktcore.actions.".$sTypeSelect."=".$aItems[0][0]['id']."</link>\n" . |
| 287 | "<description>\n" . | 298 | "<description>\n" . |
| 288 | "<table border='0' width='90%'>\n". | 299 | "<table border='0' width='90%'>\n". |
| @@ -298,7 +309,7 @@ class KTrss{ | @@ -298,7 +309,7 @@ class KTrss{ | ||
| 298 | "<hr>\n". | 309 | "<hr>\n". |
| 299 | "<table width='95%'>\n". | 310 | "<table width='95%'>\n". |
| 300 | "<tr>\n". | 311 | "<tr>\n". |
| 301 | - "<td>Filename: ".str_replace('&','&',htmlentities($aItems[0][0][filename],ENT_QUOTES, 'UTF-8'))."</td>\n". | 312 | + "<td>Filename: ".KTrss::rss_sanitize($aItems[0][0][filename] )."</td>\n". |
| 302 | "<td>\n". | 313 | "<td>\n". |
| 303 | "</tr>\n". | 314 | "</tr>\n". |
| 304 | "<tr>\n". | 315 | "<tr>\n". |
| @@ -326,11 +337,11 @@ class KTrss{ | @@ -326,11 +337,11 @@ class KTrss{ | ||
| 326 | foreach($aItems[1] as $item){ | 337 | foreach($aItems[1] as $item){ |
| 327 | $feed .= "<tr>\n". | 338 | $feed .= "<tr>\n". |
| 328 | "<td>".$item[type]." name:</td>\n". | 339 | "<td>".$item[type]." name:</td>\n". |
| 329 | - "<td>".str_replace('&','&',htmlentities($item[name],ENT_QUOTES, 'UTF-8'))."</td>\n". | 340 | + "<td>".KTrss::rss_sanitize($item[name] )."</td>\n". |
| 330 | "</tr>\n". | 341 | "</tr>\n". |
| 331 | "<tr>\n". | 342 | "<tr>\n". |
| 332 | "<td>Path:</td>\n". | 343 | "<td>Path:</td>\n". |
| 333 | - "<td>".str_replace('&','&',htmlentities($item[fullpath],ENT_QUOTES, 'UTF-8'))."</td>\n". | 344 | + "<td>".KTrss::rss_sanitize($item[fullpath] )."</td>\n". |
| 334 | "</tr>\n". | 345 | "</tr>\n". |
| 335 | "<tr>\n". | 346 | "<tr>\n". |
| 336 | "<td>Transaction:</td>\n". | 347 | "<td>Transaction:</td>\n". |
| @@ -338,7 +349,7 @@ class KTrss{ | @@ -338,7 +349,7 @@ class KTrss{ | ||
| 338 | "</tr>\n". | 349 | "</tr>\n". |
| 339 | "<tr>\n". | 350 | "<tr>\n". |
| 340 | "<td>Comment:</td>\n". | 351 | "<td>Comment:</td>\n". |
| 341 | - "<td>".str_replace('&','&',htmlentities($item[comment],ENT_QUOTES, 'UTF-8'))."</td>\n". | 352 | + "<td>".KTrss::rss_sanitize($item[comment] )."</td>\n". |
| 342 | "</tr>\n". | 353 | "</tr>\n". |
| 343 | "<tr>\n";if($item[version]){ | 354 | "<tr>\n";if($item[version]){ |
| 344 | $feed .= "<td>Version:</td>\n". | 355 | $feed .= "<td>Version:</td>\n". |