Exemplo n.º 1
0
 function render()
 {
     global $main;
     $main->requireJSResource("plugins/rssplugin/js/update.js");
     $oTemplating =& KTTemplating::getSingleton();
     $oTemplate = $oTemplating->loadTemplate('RSSPlugin/dashlet');
     $iUId = $this->oUser->getId();
     // Get internal Feed
     $aInternalRSS = KTrss::getInternalFeed($iUId);
     // Get count of all items in feed
     $iCountItems = count($aInternalRSS[items]);
     // Get listing of external feeds
     $aExternalFeedsList = KTrss::getExternalFeedsList($iUId);
     // Create action for external feed management to be linked to inside of dashlet
     $action = array("name" => _kt("Manage External RSS Feeds"), "url" => $this->oPlugin->getPagePath('managerssfeeds'));
     // Prepare template data
     $aTemplateData = array('context' => $this, 'internalrss' => $aInternalRSS, 'itemcount' => $iCountItems, 'feedlist' => $aExternalFeedsList, 'user' => $iUId, 'action' => $action);
     return $oTemplate->render($aTemplateData);
 }
Exemplo n.º 2
0
 * Contributor( s): ______________________________________
 *
 */
require_once '../../config/dmsDefaults.php';
require_once KT_DIR . '/plugins/rssplugin/rss2array.inc.php';
require_once KT_DIR . '/plugins/rssplugin/KTrss.inc.php';
$feed = $_GET["feed"];
$user = $_GET["user"];
// URL must start with http:// - change it if it starts with feed://
if (preg_match("/^feed:\\/\\/([^\\/]+)(.*)\$/", $feed, $matches)) {
    $feed = preg_replace("/^feed:\\/\\//", "http://", $feed);
}
// Check if the feed matches a url
if (!preg_match("/^http[s]?:\\/\\/([^\\/]+)(.*)\$/", $feed, $matches)) {
    // If not, it is an internal feed
    $aRSSArray = KTrss::getInternalFeed($user);
} else {
    // If it is a url, it is an external feed
    // However, sometimes internal documents get added as external feeds
    // Check that the url isn't an internal one.
    global $default;
    $rootUrl = $default->rootUrl;
    $bSSL = $default->sslEnabled;
    $sProtocol = $bSSL ? 'https' : 'http';
    $sBaseUrl = $sProtocol . '://' . $_SERVER['HTTP_HOST'] . $rootUrl;
    $sInternal = $sBaseUrl . '/rss.php';
    if (!(strpos($feed, $sInternal) === FALSE)) {
        // Feed is internal
        $aRSSArray = KTrss::getExternalInternalFeed($feed, $user);
    } else {
        $aRSSArray = rss2array($feed);