예제 #1
0
 /**
  * Creates a feed object from the URL parameters fetched only
  *
  */
 function __construct($options = NULL)
 {
     global $_zp_gallery, $_zp_current_admin_obj, $_zp_loggedin;
     if (empty($options)) {
         self::feed404();
     }
     $this->feedtype = $options['rss'];
     parent::__construct($options);
     if (isset($options['token'])) {
         //	The link camed from a logged in user, see if it is valid
         $link = $options;
         unset($link['token']);
         $token = Zenphoto_Authority::passwordHash(serialize($link), '');
         if ($token == $options['token']) {
             $adminobj = Zenphoto_Authority::getAnAdmin(array('`id`=' => (int) $link['user']));
             if ($adminobj) {
                 $_zp_current_admin_obj = $adminobj;
                 $_zp_loggedin = $_zp_current_admin_obj->getRights();
             }
         }
     }
     // general feed setup
     $channeltitlemode = getOption('RSS_title');
     $this->host = html_encode($_SERVER["HTTP_HOST"]);
     //channeltitle general
     switch ($channeltitlemode) {
         case 'gallery':
             $this->channel_title = $_zp_gallery->getBareTitle($this->locale);
             break;
         case 'website':
             $this->channel_title = getBare($_zp_gallery->getWebsiteTitle($this->locale));
             break;
         case 'both':
             $website_title = $_zp_gallery->getWebsiteTitle($this->locale);
             $this->channel_title = $_zp_gallery->getBareTitle($this->locale);
             if (!empty($website_title)) {
                 $this->channel_title = $website_title . ' - ' . $this->channel_title;
             }
             break;
     }
     // individual feedtype setup
     switch ($this->feedtype) {
         case 'gallery':
             if (!getOption('RSS_album_image')) {
                 self::feed404();
             }
             $albumname = $this->getChannelTitleExtra();
             if ($this->albumfolder) {
                 $alb = newAlbum($this->albumfolder, true, true);
                 if ($alb->exists) {
                     $albumtitle = $alb->getTitle();
                     if ($this->mode == 'albums' || $this->collection) {
                         $albumname = ' - ' . html_encode($albumtitle) . $this->getChannelTitleExtra();
                     }
                 } else {
                     self::feed404();
                 }
             } else {
                 $albumtitle = '';
             }
             $albumname = $this->getChannelTitleExtra();
             $this->channel_title = html_encode($this->channel_title . ' ' . getBare($albumname));
             $this->imagesize = $this->getImageSize();
             require_once SERVERPATH . '/' . ZENFOLDER . '/' . PLUGIN_FOLDER . '/image_album_statistics.php';
             break;
         case 'news':
             //Zenpage News RSS
             if (!getOption('RSS_articles')) {
                 self::feed404();
             }
             $titleappendix = gettext(' (Latest news)');
             switch ($this->newsoption) {
                 case 'withalbums':
                 case 'withalbums_mtime':
                 case 'withalbums_publishdate':
                 case 'withalbums_latestupdated':
                     $titleappendix = gettext(' (Latest news and albums)');
                     break;
                 case 'withimages':
                 case 'withimages_mtime':
                 case 'withimages_publishdate':
                     $titleappendix = gettext(' (Latest news and images)');
                     break;
                 default:
                     switch ($this->sortorder) {
                         case 'popular':
                             $titleappendix = gettext(' (Most popular news)');
                             break;
                         case 'mostrated':
                             $titleappendix = gettext(' (Most rated news)');
                             break;
                         case 'toprated':
                             $titleappendix = gettext(' (Top rated news)');
                             break;
                         case 'random':
                             $titleappendix = gettext(' (Random news)');
                             break;
                     }
                     break;
             }
             $this->channel_title = html_encode($this->channel_title . $this->cattitle . $titleappendix);
             $this->imagesize = $this->getImageSize();
             $this->itemnumber = getOption("RSS_zenpage_items");
             // # of Items displayed on the feed
             require_once SERVERPATH . '/' . ZENFOLDER . '/' . PLUGIN_FOLDER . '/image_album_statistics.php';
             require_once SERVERPATH . '/' . ZENFOLDER . '/' . PLUGIN_FOLDER . '/zenpage/zenpage-template-functions.php';
             break;
         case 'pages':
             //Zenpage News RSS
             if (!getOption('RSS_pages')) {
                 self::feed404();
             }
             switch ($this->sortorder) {
                 case 'popular':
                     $titleappendix = gettext(' (Most popular pages)');
                     break;
                 case 'mostrated':
                     $titleappendix = gettext(' (Most rated pages)');
                     break;
                 case 'toprated':
                     $titleappendix = gettext(' (Top rated pages)');
                     break;
                 case 'random':
                     $titleappendix = gettext(' (Random pages)');
                     break;
                 default:
                     $titleappendix = gettext(' (Latest pages)');
                     break;
             }
             $this->channel_title = html_encode($this->channel_title . $titleappendix);
             require_once SERVERPATH . '/' . ZENFOLDER . '/' . PLUGIN_FOLDER . '/zenpage/zenpage-template-functions.php';
             break;
         case 'comments':
             //Comments RSS
             if (!getOption('RSS_comments')) {
                 self::feed404();
             }
             if ($this->id) {
                 switch ($this->commentfeedtype) {
                     case 'album':
                         $table = 'albums';
                         break;
                     case 'image':
                         $table = 'images';
                         break;
                     case 'news':
                         $table = 'news';
                         break;
                     case 'page':
                         $table = 'pages';
                         break;
                     default:
                         self::feed404();
                         break;
                 }
                 $this->itemobj = getItemByID($table, $this->id);
                 if ($this->itemobj) {
                     $title = ' - ' . $this->itemobj->getTitle();
                 } else {
                     self::feed404();
                 }
             } else {
                 $this->itemobj = NULL;
                 $title = NULL;
             }
             $this->channel_title = html_encode($this->channel_title . $title . gettext(' (latest comments)'));
             if (extensionEnabled('zenpage')) {
                 require_once SERVERPATH . '/' . ZENFOLDER . '/' . PLUGIN_FOLDER . '/zenpage/zenpage-template-functions.php';
             }
             break;
         case 'null':
             //we just want the class instantiated
             return;
     }
     $this->feeditems = $this->getitems();
 }
예제 #2
0
 /**
  * Creates a feed object from the URL parameters fetched only
  *
  */
 function __construct($options = NULL)
 {
     global $_zp_gallery, $_zp_current_admin_obj, $_zp_loggedin;
     if (empty($options)) {
         self::feed404();
     }
     $this->feedtype = $options['external'];
     $this->key = @$options['accesskey'];
     parent::__construct($options);
     if ($this->key) {
         $result = query_single_row('SELECT * FROM ' . prefix('plugin_storage') . ' WHERE `type`="externalFeed" AND `data`=' . db_quote($this->key));
         if (!$result) {
             $this->key = NULL;
         }
     }
     if (!$this->key && $this->feedtype != 'site_closed') {
         self::feed404();
     }
     // general feed setup
     $channeltitlemode = getOption('externalFeed_title');
     $this->host = html_encode($_SERVER["HTTP_HOST"]);
     //channeltitle general
     switch ($channeltitlemode) {
         case 'gallery':
             $this->channel_title = $_zp_gallery->getBareTitle($this->locale);
             break;
         case 'website':
             $this->channel_title = getBare($_zp_gallery->getWebsiteTitle($this->locale));
             break;
         case 'both':
             $website_title = $_zp_gallery->getWebsiteTitle($this->locale);
             $this->channel_title = $_zp_gallery->getBareTitle($this->locale);
             if (!empty($website_title)) {
                 $this->channel_title = $website_title . ' - ' . $this->channel_title;
             }
             break;
     }
     // individual feedtype setup
     switch ($this->feedtype) {
         case 'gallery':
             if (!getOption('externalFeed_album_image')) {
                 self::feed404();
             }
             $albumname = $this->getChannelTitleExtra();
             if ($this->albumfolder) {
                 $alb = newAlbum($this->albumfolder, true, true);
                 if ($alb->exists) {
                     $albumtitle = $alb->getTitle();
                     if ($this->mode == 'albums' || $this->collection) {
                         $albumname = ' - ' . html_encode($albumtitle) . $this->getChannelTitleExtra();
                     }
                 } else {
                     self::feed404();
                 }
             } else {
                 $albumtitle = '';
             }
             $albumname = $this->getChannelTitleExtra();
             $this->channel_title = html_encode($this->channel_title . ' ' . getBare($albumname));
             $this->imagesize = $this->getImageSize();
             require_once SERVERPATH . '/' . ZENFOLDER . '/' . PLUGIN_FOLDER . '/image_album_statistics.php';
             break;
         case 'news':
             //Zenpage News
             if (!getOption('externalFeed_articles')) {
                 self::feed404();
             }
             $titleappendix = gettext(' (Latest news)');
             switch ($this->sortorder) {
                 case 'popular':
                     $titleappendix = gettext(' (Most popular news)');
                     break;
                 case 'mostrated':
                     $titleappendix = gettext(' (Most rated news)');
                     break;
                 case 'toprated':
                     $titleappendix = gettext(' (Top rated news)');
                     break;
                 case 'random':
                     $titleappendix = gettext(' (Random news)');
                     break;
             }
             $this->channel_title = html_encode($this->channel_title . $this->cattitle . $titleappendix);
             $this->imagesize = $this->getImageSize();
             $this->itemnumber = getOption("externalFeed_zenpage_items");
             // # of Items displayed on the feed
             require_once SERVERPATH . '/' . ZENFOLDER . '/' . PLUGIN_FOLDER . '/image_album_statistics.php';
             require_once SERVERPATH . '/' . ZENFOLDER . '/' . PLUGIN_FOLDER . '/zenpage/zenpage-template-functions.php';
             break;
         case 'pages':
             //Zenpage News
             if (!getOption('externalFeed_pages')) {
                 self::feed404();
             }
             switch ($this->sortorder) {
                 case 'popular':
                     $titleappendix = gettext(' (Most popular pages)');
                     break;
                 case 'mostrated':
                     $titleappendix = gettext(' (Most rated pages)');
                     break;
                 case 'toprated':
                     $titleappendix = gettext(' (Top rated pages)');
                     break;
                 case 'random':
                     $titleappendix = gettext(' (Random pages)');
                     break;
                 default:
                     $titleappendix = gettext(' (Latest pages)');
                     break;
             }
             $this->channel_title = html_encode($this->channel_title . $titleappendix);
             require_once SERVERPATH . '/' . ZENFOLDER . '/' . PLUGIN_FOLDER . '/zenpage/zenpage-template-functions.php';
             break;
         case 'comments':
             //Comments
             if (!getOption('externalFeed_comments')) {
                 self::feed404();
             }
             if ($this->id) {
                 switch ($this->commentfeedtype) {
                     case 'album':
                         $table = 'albums';
                         break;
                     case 'image':
                         $table = 'images';
                         break;
                     case 'news':
                         $table = 'news';
                         break;
                     case 'page':
                         $table = 'pages';
                         break;
                     default:
                         self::feed404();
                         break;
                 }
                 $this->itemobj = getItemByID($table, $this->id);
                 if ($this->itemobj) {
                     $title = ' - ' . $this->itemobj->getTitle();
                 } else {
                     self::feed404();
                 }
             } else {
                 $this->itemobj = NULL;
                 $title = NULL;
             }
             $this->channel_title = html_encode($this->channel_title . $title . gettext(' (latest comments)'));
             if (extensionEnabled('zenpage')) {
                 require_once SERVERPATH . '/' . ZENFOLDER . '/' . PLUGIN_FOLDER . '/zenpage/zenpage-template-functions.php';
             }
             break;
         case 'null':
             //we just want the class instantiated
             return;
     }
     $this->feeditems = $this->getitems();
 }
예제 #3
0
 public function __construct(\SimpleXMLElement $xmlObj, array $feedIds = array(), $userId = 0, array $categories = array())
 {
     parent::__construct($xmlObj, $feedIds, $userId, $categories);
     $this->xmlObj->registerXPathNamespace('atom', 'http://www.w3.org/2005/Atom');
 }