Commit 036a0a609204e7ce7cce7d361d5928b8e62175a8
1 parent
586eec0d
KTC-177
"RSS feed appears wrong when launched from the 'Actions on this folder' when the folder has the internationalisation string as its name or the name of any of its subfolders." Fixed. Added headers before displaying the feed. Cleaned up the htmlentities in the feed. Committed By: Megan Watson Reviewed By: Jonathan Byrne git-svn-id: https://kt-dms.svn.sourceforge.net/svnroot/kt-dms/trunk@8059 c91229c3-7414-0410-bfa2-8a42b809f60b
Showing
2 changed files
with
231 additions
and
191 deletions
plugins/rssplugin/KTrss.inc.php
| ... | ... | @@ -336,111 +336,145 @@ class KTrss{ |
| 336 | 336 | $sSuffix = ''; |
| 337 | 337 | } |
| 338 | 338 | $hostPath = "http" . ($default->sslEnabled ? "s" : "") . "://".$_SERVER['HTTP_HOST']."/".$sSuffix; |
| 339 | - $feed = "<?xml version=\"1.0\"?>\n"; | |
| 340 | - $feed .= "<rss version=\"2.0\">\n". | |
| 341 | - "<channel>\n" . | |
| 342 | - "<title>".APP_NAME." RSS</title>\n" . | |
| 343 | - "<copyright>(c) 2007 The Jam Warehouse Software (Pty) Ltd. All Rights Reserved</copyright>\n" . | |
| 344 | - "<link>".$hostPath."</link>\n" . | |
| 345 | - "<description>KT-RSS</description>\n" . | |
| 346 | - "<image>\n". | |
| 347 | - "<title>".APP_NAME." RSS</title>\n". | |
| 348 | - "<width>140</width>\n". | |
| 349 | - "<height>28</height>". | |
| 350 | - "<link>".$hostPath."knowledgeTree/</link>\n". | |
| 351 | - "<url>".$hostPath."resources/graphics/ktlogo_rss.png</url>\n". | |
| 352 | - "</image>\n"; | |
| 353 | - foreach($aItems as $aItems){ | |
| 354 | - if($aItems[0][itemType] == 'folder'){ | |
| 355 | - $sTypeSelect = 'folder.transactions&fFolderId'; | |
| 356 | - }elseif($aItems[0][itemType] == 'document'){ | |
| 357 | - $sTypeSelect = 'document.transactionhistory&fDocumentId'; | |
| 339 | + | |
| 340 | + $head = "<?xml version=\"1.0\"?>\n | |
| 341 | + <rss version=\"2.0\">\n | |
| 342 | + <channel>\n | |
| 343 | + <title>".APP_NAME." RSS</title>\n | |
| 344 | + <copyright>(c) 2007 The Jam Warehouse Software (Pty) Ltd. All Rights Reserved</copyright>\n | |
| 345 | + <link>".$hostPath."</link>\n | |
| 346 | + <description>KT-RSS</description>\n | |
| 347 | + <image>\n | |
| 348 | + <title>".APP_NAME." RSS</title>\n | |
| 349 | + <width>140</width>\n | |
| 350 | + <height>28</height> | |
| 351 | + <link>".$hostPath."knowledgeTree/</link>\n | |
| 352 | + <url>".$hostPath."resources/graphics/ktlogo_rss.png</url>\n | |
| 353 | + </image>\n"; | |
| 354 | + | |
| 355 | + | |
| 356 | + $feed = ''; | |
| 357 | + foreach($aItems as $aItem){ | |
| 358 | + | |
| 359 | + $aItemHead = $aItem[0][0]; | |
| 360 | + $aItemList = $aItem[1]; | |
| 361 | + | |
| 362 | + if($aItem[0][itemType] == 'folder'){ | |
| 363 | + $sTypeSelect = 'folder.transactions&fFolderId'; | |
| 364 | + }elseif($aItem[0][itemType] == 'document'){ | |
| 365 | + $sTypeSelect = 'document.transactionhistory&fDocumentId'; | |
| 358 | 366 | } |
| 359 | - $feed .= "<item>\n" . | |
| 360 | - "<title>".htmlentities(KTrss::rss_sanitize($aItems[0][0][name],false), ENT_QUOTES, 'UTF-8')."</title>\n" . | |
| 361 | - "<link>".$hostPath."action.php?kt_path_info=ktcore.actions.".$sTypeSelect."=".$aItems[0][0]['id']."</link>\n" . | |
| 362 | - "<description>\n" . | |
| 363 | - "<table border='0' width='90%'>\n". | |
| 364 | - "<tr>\n". | |
| 365 | - "<td width='5%' height='16px'>" . | |
| 366 | - "<a href='".$hostPath."action.php?kt_path_info=ktcore.actions.".$sTypeSelect."=".$aItems[0][0][id]."' ><img src='".$aItems[0][mimeTypeIcon]."' align='left' height='16px' width='16px' alt='' border='0' /></a>" . | |
| 367 | - "</td>\n". | |
| 368 | - "<td align='left'> ".$aItems[0][mimeTypeFName]."</td>\n". | |
| 369 | - "</tr>\n". | |
| 370 | - "<tr>\n". | |
| 371 | - "<td colspan='2'>\n". | |
| 372 | - ucfirst($aItems[0]['itemType'])." Information (ID: ".$aItems[0][0][id].")</>\n". | |
| 373 | - "<hr>\n". | |
| 374 | - "<table width='95%'>\n". | |
| 375 | - "<tr>\n". | |
| 376 | - "<td>Filename: ".KTrss::rss_sanitize($aItems[0][0][filename])."</td>\n". | |
| 377 | - "<td>\n". | |
| 378 | - "</tr>\n". | |
| 379 | - "<tr>\n". | |
| 380 | - "<td>Author: ".$aItems[0][0][author]."</td>\n". | |
| 381 | - "<td>\n". | |
| 382 | - "</tr>\n". | |
| 383 | - "<tr>\n". | |
| 384 | - "<td>Owner: ";if($aItems[0][0][owner]){$feed .= $aItems[0][0][owner];}else{$feed .= "None";} | |
| 385 | - $feed .= "</td>\n". | |
| 386 | - "<td></td>\n". | |
| 387 | - "</tr>\n". | |
| 388 | - "<tr>\n";if($aItems[0][0][type]){ | |
| 389 | - $feed .= "<td>Document type: ".$aItems[0][0][type]."</td>\n". | |
| 390 | - "<td></td>\n";} | |
| 391 | - $feed .= "</tr>\n". | |
| 392 | - "<tr>\n". | |
| 393 | - "<td>Workflow status: ";if($aItems[0][0][workflow_status]){$feed .= $aItems[0][0][workflow_status];}else{$feed .= "No Workflow";} | |
| 394 | - $feed .= "</td>\n". | |
| 395 | - "<td></td>\n". | |
| 396 | - "</tr>\n". | |
| 397 | - "</table><br>\n". | |
| 398 | - "Transaction Summary (Last 4)\n". | |
| 399 | - "<hr>\n". | |
| 400 | - "<table width='100%'>\n"; | |
| 401 | - foreach($aItems[1] as $item){ | |
| 402 | - $feed .= "<tr>\n". | |
| 403 | - "<td>".$item[type]." name:</td>\n". | |
| 404 | - "<td>".KTrss::rss_sanitize($item[name] )."</td>\n". | |
| 405 | - "</tr>\n". | |
| 406 | - "<tr>\n". | |
| 407 | - "<td>Path:</td>\n". | |
| 408 | - "<td>".KTrss::rss_sanitize($item[fullpath] )."</td>\n". | |
| 409 | - "</tr>\n". | |
| 410 | - "<tr>\n". | |
| 411 | - "<td>Transaction:</td>\n". | |
| 412 | - "<td>".$item[transaction_name]."</td>\n". | |
| 413 | - "</tr>\n". | |
| 414 | - "<tr>\n". | |
| 415 | - "<td>Comment:</td>\n". | |
| 416 | - "<td>".KTrss::rss_sanitize($item[comment] )."</td>\n". | |
| 417 | - "</tr>\n". | |
| 418 | - "<tr>\n";if($item[version]){ | |
| 419 | - $feed .= "<td>Version:</td>\n". | |
| 420 | - "<td>".$item[version]."</td>\n";} | |
| 421 | - $feed .= "</tr>\n". | |
| 422 | - "<tr>\n". | |
| 423 | - "<td>Date:</td>\n". | |
| 424 | - "<td>".$item[datetime]."</td>\n". | |
| 425 | - "</tr>\n". | |
| 426 | - "<tr>\n". | |
| 427 | - "<td>User:</td>\n". | |
| 428 | - "<td>".$item[user_name]."</td>\n". | |
| 429 | - "</tr>\n". | |
| 430 | - "<tr>\n". | |
| 431 | - "<td colspan='2'><hr width='100' align='left'></td>\n". | |
| 432 | - "</tr>\n";} | |
| 433 | - $feed .= "</table>\n". | |
| 434 | - "</td>\n". | |
| 435 | - "</tr>\n". | |
| 436 | - "</table>". | |
| 437 | - "</description>\n". | |
| 438 | - "</item>\n"; | |
| 367 | + | |
| 368 | + | |
| 369 | + if($aItem[0][0][owner]){ | |
| 370 | + $owner = $aItem[0][0][owner]; | |
| 371 | + }else{ | |
| 372 | + $owner = _kt('None'); | |
| 373 | + } | |
| 374 | + | |
| 375 | + $type = ''; | |
| 376 | + if($aItem[0][0][type]){ | |
| 377 | + $type = '<tr><td>Document type: '.$aItem[0][0][type]."</td>\n<td></td></tr>\n"; | |
| 378 | + } | |
| 379 | + | |
| 380 | + if($aItem[0][0][workflow_status]){ | |
| 381 | + $workflow = $aItem[0][0][workflow_status]; | |
| 382 | + }else{ | |
| 383 | + $workflow = _kt('No Workflow'); | |
| 384 | + } | |
| 385 | + | |
| 386 | + $xmlItemHead = "<item>\n | |
| 387 | + <title>".htmlentities($aItem[0][0][name], ENT_QUOTES, 'UTF-8')."</title>\n | |
| 388 | + <link>".$hostPath."action.php?kt_path_info=ktcore.actions.".htmlentities($sTypeSelect, ENT_QUOTES, 'UTF-8')."=".$aItem[0][0]['id']."</link>\n | |
| 389 | + <description>\n"; | |
| 390 | + | |
| 391 | + $htmlItem = "<table border='0' width='90%'>\n | |
| 392 | + <tr>\n | |
| 393 | + <td width='5%' height='16px'> | |
| 394 | + <a href='".$hostPath."action.php?kt_path_info=ktcore.actions.".$sTypeSelect."=".$aItem[0][0][id]."' > | |
| 395 | + <img src='".$aItem[0][mimeTypeIcon]."' align='left' height='16px' width='16px' alt='' border='0' /></a> | |
| 396 | + </td>\n | |
| 397 | + <td align='left'> ".$aItem[0][mimeTypeFName]."</td>\n | |
| 398 | + </tr>\n | |
| 399 | + <tr>\n | |
| 400 | + <td colspan='2'>\n | |
| 401 | + ".ucfirst($aItem[0]['itemType'])." Information (ID: ".$aItem[0][0][id].")</>\n | |
| 402 | + <hr>\n | |
| 403 | + | |
| 404 | + <table width='95%'>\n | |
| 405 | + <tr>\n | |
| 406 | + <td>"._kt('Filename').": ".$aItem[0][0][filename]."</td>\n | |
| 407 | + </tr>\n | |
| 408 | + <tr>\n | |
| 409 | + <td>"._kt('Author').": ".$aItem[0][0][author]."</td>\n | |
| 410 | + </tr>\n | |
| 411 | + <tr>\n | |
| 412 | + <td>"._kt('Owner').": ".$owner."</td>\n | |
| 413 | + <td></td>\n | |
| 414 | + </tr>\n | |
| 415 | + ".$type."\n | |
| 416 | + <tr>\n | |
| 417 | + <td>"._kt('Workflow status').": ".$workflow."</td>\n | |
| 418 | + <td></td>\n | |
| 419 | + </tr>\n | |
| 420 | + </table><br>\n | |
| 421 | + | |
| 422 | + "._kt('Transaction Summary (Last 4)')."\n | |
| 423 | + <hr>\n | |
| 424 | + | |
| 425 | + <table width='100%'>\n"; | |
| 426 | + | |
| 427 | + foreach($aItem[1] as $item){ | |
| 428 | + $htmlItem .= "<tr>\n | |
| 429 | + <td>".$item[type]." name:</td>\n | |
| 430 | + <td>".$item[name]."</td>\n | |
| 431 | + </tr>\n | |
| 432 | + <tr>\n | |
| 433 | + <td>Path:</td>\n | |
| 434 | + <td>".$item[fullpath]."</td>\n | |
| 435 | + </tr>\n | |
| 436 | + <tr>\n | |
| 437 | + <td>Transaction:</td>\n | |
| 438 | + <td>".$item[transaction_name]."</td>\n | |
| 439 | + </tr>\n | |
| 440 | + <tr>\n | |
| 441 | + <td>Comment:</td>\n | |
| 442 | + <td>".$item[comment]."</td>\n | |
| 443 | + </tr>\n | |
| 444 | + <tr>\n"; | |
| 445 | + | |
| 446 | + if($item[version]){ | |
| 447 | + $htmlItem .= "<td>Version:</td>\n | |
| 448 | + <td>".$item[version]."</td>\n"; | |
| 449 | + } | |
| 450 | + $htmlItem .= "</tr>\n | |
| 451 | + <tr>\n | |
| 452 | + <td>Date:</td>\n | |
| 453 | + <td>".$item[datetime]."</td>\n | |
| 454 | + </tr>\n | |
| 455 | + <tr>\n | |
| 456 | + <td>User:</td>\n | |
| 457 | + <td>".$item[user_name]."</td>\n | |
| 458 | + </tr>\n | |
| 459 | + <tr>\n | |
| 460 | + <td colspan='2'><hr width='100' align='left'></td>\n | |
| 461 | + </tr>\n"; | |
| 462 | + } | |
| 463 | + $htmlItem .= "</table>\n | |
| 464 | + </td>\n | |
| 465 | + </tr>\n | |
| 466 | + </table>"; | |
| 467 | + | |
| 468 | + $xmlItemFooter = "</description>\n</item>\n"; | |
| 469 | + | |
| 470 | + // Use htmlentities to allow html tags in the xml. | |
| 471 | + $htmlItem = htmlentities($htmlItem, ENT_QUOTES, 'UTF-8'); | |
| 472 | + | |
| 473 | + $feed .= $xmlItemHead.$htmlItem.$xmlItemFooter; | |
| 439 | 474 | } |
| 440 | - $feed .= "</channel>\n" . | |
| 441 | - "</rss>\n"; | |
| 475 | + $footer = "</channel>\n</rss>\n"; | |
| 442 | 476 | |
| 443 | - return $feed; | |
| 477 | + return $head.$feed.$footer; | |
| 444 | 478 | } |
| 445 | 479 | |
| 446 | 480 | // Takes in an array as a parameter and returns rss2.0 compatible xml |
| ... | ... | @@ -449,26 +483,28 @@ class KTrss{ |
| 449 | 483 | $aPath = explode('/', trim($_SERVER['PHP_SELF'])); |
| 450 | 484 | global $default; |
| 451 | 485 | $hostPath = "http" . ($default->sslEnabled ? "s" : "") . "://".$_SERVER['HTTP_HOST']."/".$aPath[1]."/"; |
| 452 | - $feed = "<?xml version=\"1.0\"?>\n"; | |
| 453 | - $feed .= "<rss version=\"2.0\">\n". | |
| 454 | - "<channel>\n" . | |
| 455 | - "<title>".APP_NAME." RSS</title>\n" . | |
| 456 | - "<copyright>(c) 2007 The Jam Warehouse Software (Pty) Ltd. All Rights Reserved</copyright>\n" . | |
| 457 | - "<link>".$hostPath."</link>\n" . | |
| 458 | - "<description>KT-RSS</description>\n" . | |
| 459 | - "<image>\n". | |
| 460 | - "<title>".APP_NAME." RSS</title>\n". | |
| 461 | - "<width>140</width>\n". | |
| 462 | - "<height>28</height>". | |
| 463 | - "<link>".$hostPath."knowledgeTree/</link>\n". | |
| 464 | - "<url>".$hostPath."resources/graphics/ktlogo_rss.png</url>\n". | |
| 465 | - "</image>\n"; | |
| 466 | - $feed .= "<item>\n". | |
| 467 | - "<title>Feed load error</title>\n" . | |
| 468 | - "<description>".$sError."</description>\n". | |
| 469 | - "</item>\n"; | |
| 470 | - $feed .= "</channel>\n" . | |
| 471 | - "</rss>\n"; | |
| 486 | + $feed = "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n | |
| 487 | + <rss version=\"2.0\">\n | |
| 488 | + | |
| 489 | + <channel>\n | |
| 490 | + <title>".APP_NAME." RSS</title>\n | |
| 491 | + <copyright>(c) 2007 The Jam Warehouse Software (Pty) Ltd. All Rights Reserved</copyright>\n | |
| 492 | + <link>{$hostPath}</link>\n | |
| 493 | + <description>KT-RSS</description>\n | |
| 494 | + <image>\n | |
| 495 | + <title>".APP_NAME." RSS</title>\n | |
| 496 | + <width>140</width>\n | |
| 497 | + <height>28</height> | |
| 498 | + <link>{$hostPath}knowledgeTree/</link>\n | |
| 499 | + <url>{$hostPath}resources/graphics/ktlogo_rss.png</url>\n | |
| 500 | + </image>\n | |
| 501 | + <item>\n | |
| 502 | + <title>Feed load error</title>\n | |
| 503 | + <description>".$sError."</description>\n | |
| 504 | + </item>\n | |
| 505 | + </channel>\n | |
| 506 | + | |
| 507 | + </rss>\n"; | |
| 472 | 508 | |
| 473 | 509 | return $feed; |
| 474 | 510 | } | ... | ... |
rss.php
| ... | ... | @@ -5,32 +5,32 @@ |
| 5 | 5 | * KnowledgeTree Open Source Edition |
| 6 | 6 | * Document Management Made Simple |
| 7 | 7 | * Copyright (C) 2004 - 2008 The Jam Warehouse Software (Pty) Limited |
| 8 | - * | |
| 8 | + * | |
| 9 | 9 | * This program is free software; you can redistribute it and/or modify it under |
| 10 | 10 | * the terms of the GNU General Public License version 3 as published by the |
| 11 | 11 | * Free Software Foundation. |
| 12 | - * | |
| 12 | + * | |
| 13 | 13 | * This program is distributed in the hope that it will be useful, but WITHOUT |
| 14 | 14 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS |
| 15 | 15 | * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more |
| 16 | 16 | * details. |
| 17 | - * | |
| 17 | + * | |
| 18 | 18 | * You should have received a copy of the GNU General Public License |
| 19 | 19 | * along with this program. If not, see <http://www.gnu.org/licenses/>. |
| 20 | - * | |
| 20 | + * | |
| 21 | 21 | * You can contact The Jam Warehouse Software (Pty) Limited, Unit 1, Tramber Place, |
| 22 | 22 | * Blake Street, Observatory, 7925 South Africa. or email info@knowledgetree.com. |
| 23 | - * | |
| 23 | + * | |
| 24 | 24 | * The interactive user interfaces in modified source and object code versions |
| 25 | 25 | * of this program must display Appropriate Legal Notices, as required under |
| 26 | 26 | * Section 5 of the GNU General Public License version 3. |
| 27 | - * | |
| 27 | + * | |
| 28 | 28 | * In accordance with Section 7(b) of the GNU General Public License version 3, |
| 29 | 29 | * these Appropriate Legal Notices must retain the display of the "Powered by |
| 30 | - * KnowledgeTree" logo and retain the original copyright notice. If the display of the | |
| 30 | + * KnowledgeTree" logo and retain the original copyright notice. If the display of the | |
| 31 | 31 | * logo is not reasonably feasible for technical reasons, the Appropriate Legal Notices |
| 32 | - * must display the words "Powered by KnowledgeTree" and retain the original | |
| 33 | - * copyright notice. | |
| 32 | + * must display the words "Powered by KnowledgeTree" and retain the original | |
| 33 | + * copyright notice. | |
| 34 | 34 | * Contributor( s): ______________________________________ |
| 35 | 35 | */ |
| 36 | 36 | |
| ... | ... | @@ -66,75 +66,79 @@ if ( !empty( $altinfo) && !isset( $_SERVER['PHP_AUTH_USER'])) { |
| 66 | 66 | } |
| 67 | 67 | |
| 68 | 68 | if (!validateUser($_SERVER['PHP_AUTH_USER'], $_SERVER['PHP_AUTH_PW'])) { |
| 69 | - header('WWW-Authenticate: Basic realm="KnowledgeTree DMS"'); | |
| 70 | - header('HTTP/1.0 401 Unauthorized'); | |
| 71 | - echo 'This RSS feed requires authentication. Please enter your username and password.'; | |
| 72 | - exit; | |
| 69 | + header('WWW-Authenticate: Basic realm="KnowledgeTree DMS"'); | |
| 70 | + header('HTTP/1.0 401 Unauthorized'); | |
| 71 | + echo 'This RSS feed requires authentication. Please enter your username and password.'; | |
| 72 | + exit; | |
| 73 | 73 | } else { |
| 74 | - $user = DBAuthenticator::getUser($_SERVER['PHP_AUTH_USER'], array('id'=>'id',)); | |
| 75 | - $id = $user[$_SERVER['PHP_AUTH_USER']]['id']; | |
| 74 | + $user = DBAuthenticator::getUser($_SERVER['PHP_AUTH_USER'], array('id'=>'id',)); | |
| 75 | + $id = $user[$_SERVER['PHP_AUTH_USER']]['id']; | |
| 76 | 76 | |
| 77 | + header('Content-Type: application/rss+xml; charset=utf-8;'); | |
| 78 | + header('Content-Disposition: inline; filename="rss.xml"'); | |
| 79 | + header('Expires: Mon, 26 Jul 1997 05:00:00 GMT'); | |
| 80 | + header('Last-Modified: ' . gmdate('D, d M Y H:i:s') . ' GMT'); | |
| 77 | 81 | |
| 78 | - if(KTUtil::arrayGet($_REQUEST, 'docId')){ // if a docId parameter is passed | |
| 79 | - // get document id from http request object | |
| 80 | - $iDocumentId = KTUtil::arrayGet($_REQUEST, 'docId'); | |
| 82 | + if(KTUtil::arrayGet($_REQUEST, 'docId')){ // if a docId parameter is passed | |
| 83 | + // get document id from http request object | |
| 84 | + $iDocumentId = KTUtil::arrayGet($_REQUEST, 'docId'); | |
| 81 | 85 | |
| 82 | - if(KTrss::validateDocumentPermissions($id, $iDocumentId)){ // if document passes validation check | |
| 83 | - // get document info | |
| 84 | - $aDocumentInfo[] = KTrss::getOneDocument($iDocumentId, $id); | |
| 86 | + if(KTrss::validateDocumentPermissions($id, $iDocumentId)){ // if document passes validation check | |
| 87 | + // get document info | |
| 88 | + $aDocumentInfo[] = KTrss::getOneDocument($iDocumentId, $id); | |
| 85 | 89 | |
| 86 | - if($aDocumentInfo){ | |
| 87 | - // create rss xml for document | |
| 88 | - $documentFeed = KTrss::arrayToXML($aDocumentInfo); | |
| 89 | - }else{ | |
| 90 | - // create rss xml for the error | |
| 91 | - $error = KTrss::errorToXML(_kt('This document has returned a empty response')); | |
| 92 | - } | |
| 93 | - }else{ | |
| 94 | - // create rss xml for error | |
| 95 | - $error = KTrss::errorToXML(_kt('You are either not authorised to view details on this document or it does not exist.' . | |
| 96 | - ' Please visit http://' .$_SERVER['HTTP_HOST'].'/'.$GLOBALS['KTRootUrl'].'/ to browse for a valid document.')); | |
| 97 | - } | |
| 98 | - if(isset($error)){ // if an error exist, output...else out the result | |
| 99 | - echo $error; | |
| 100 | - }else{ | |
| 101 | - echo $documentFeed; | |
| 102 | - } | |
| 103 | - }elseif(KTUtil::arrayGet($_REQUEST, 'folderId')){ // if a folderId parameter is passed | |
| 104 | - // get folder id from http request object | |
| 105 | - $iFolderId = KTUtil::arrayGet($_REQUEST, 'folderId'); | |
| 90 | + if($aDocumentInfo){ | |
| 91 | + // create rss xml for document | |
| 92 | + $documentFeed = KTrss::arrayToXML($aDocumentInfo); | |
| 93 | + }else{ | |
| 94 | + // create rss xml for the error | |
| 95 | + $error = KTrss::errorToXML(_kt('This document has returned a empty response')); | |
| 96 | + } | |
| 97 | + }else{ | |
| 98 | + // create rss xml for error | |
| 99 | + $error = KTrss::errorToXML(_kt('You are either not authorised to view details on this document or it does not exist.' . | |
| 100 | + ' Please visit http://' .$_SERVER['HTTP_HOST'].'/'.$GLOBALS['KTRootUrl'].'/ to browse for a valid document.')); | |
| 101 | + } | |
| 102 | + if(isset($error)){ // if an error exist, output...else out the result | |
| 103 | + echo $error; | |
| 104 | + }else{ | |
| 105 | + echo $documentFeed; | |
| 106 | + } | |
| 107 | + }elseif(KTUtil::arrayGet($_REQUEST, 'folderId')){ // if a folderId parameter is passed | |
| 108 | + // get folder id from http request object | |
| 109 | + $iFolderId = KTUtil::arrayGet($_REQUEST, 'folderId'); | |
| 106 | 110 | |
| 107 | - if(KTrss::validateFolderPermissions($id, $iFolderId)){ // if folder passes validation check | |
| 108 | - // get folder info | |
| 109 | - $aFolderInfo[] = KTrss::getOneFolder($iFolderId); | |
| 111 | + if(KTrss::validateFolderPermissions($id, $iFolderId)){ // if folder passes validation check | |
| 112 | + // get folder info | |
| 113 | + $aFolderInfo[] = KTrss::getOneFolder($iFolderId); | |
| 110 | 114 | |
| 111 | - if($aFolderInfo){ | |
| 112 | - // create rss xml for folder | |
| 113 | - $folderFeed = KTrss::arrayToXML($aFolderInfo); | |
| 114 | - }else{ | |
| 115 | - // create rss xml for error | |
| 116 | - $error = KTrss::errorToXML(_kt('This document has returned a empty response')); | |
| 117 | - } | |
| 118 | - }else{ | |
| 119 | - // create rss xml for error | |
| 120 | - $error = KTrss::errorToXML(_kt('You are either not authorised to view details on this folder or it does not exist.' . | |
| 121 | - ' Please visit http://' .$_SERVER['HTTP_HOST'].'/'.$GLOBALS['KTRootUrl'].'/ to browse for a valid folder.')); | |
| 122 | - } | |
| 123 | - if(isset($error)){ // if an error exist, output...else out the result | |
| 124 | - echo $error; | |
| 125 | - }else{ | |
| 126 | - echo $folderFeed; | |
| 127 | - } | |
| 128 | - }else{ // else do normal rss parsing | |
| 129 | - // get full list of subscribed documents and folders | |
| 130 | - $aFullList = kt_array_merge(KTrss::getDocuments($id), KTrss::getFolders($id)); | |
| 131 | - $internalFeed = KTrss::arrayToXML($aFullList); | |
| 132 | - echo $internalFeed; | |
| 133 | - } | |
| 115 | + if($aFolderInfo){ | |
| 116 | + // create rss xml for folder | |
| 117 | + $folderFeed = KTrss::arrayToXML($aFolderInfo); | |
| 118 | + }else{ | |
| 119 | + // create rss xml for error | |
| 120 | + $error = KTrss::errorToXML(_kt('This document has returned a empty response')); | |
| 121 | + } | |
| 122 | + }else{ | |
| 123 | + // create rss xml for error | |
| 124 | + $error = KTrss::errorToXML(_kt('You are either not authorised to view details on this folder or it does not exist.' . | |
| 125 | + ' Please visit http://' .$_SERVER['HTTP_HOST'].'/'.$GLOBALS['KTRootUrl'].'/ to browse for a valid folder.')); | |
| 126 | + } | |
| 127 | + if(isset($error)){ // if an error exist, output...else out the result | |
| 128 | + echo $error; | |
| 129 | + }else{ | |
| 130 | + echo $folderFeed; | |
| 131 | + } | |
| 132 | + }else{ // else do normal rss parsing | |
| 133 | + // get full list of subscribed documents and folders | |
| 134 | + $aFullList = kt_array_merge(KTrss::getDocuments($id), KTrss::getFolders($id)); | |
| 135 | + $internalFeed = KTrss::arrayToXML($aFullList); | |
| 136 | + echo $internalFeed; | |
| 137 | + } | |
| 134 | 138 | } |
| 135 | 139 | |
| 136 | 140 | // Validate user credentials |
| 137 | 141 | function validateUser($username, $password){ |
| 138 | - return DBAuthenticator::checkPassword($username, $password); | |
| 142 | + return DBAuthenticator::checkPassword($username, $password); | |
| 139 | 143 | } |
| 140 | 144 | -?> |
| 145 | +?> | |
| 141 | 146 | \ No newline at end of file | ... | ... |