/** * @see Page::show() */ public function show() { parent::show(); $photos = $this->photoList->getObjects(); // get photos if (count($photos)) { header('Content-type: text/xml'); echo "<?xml version=\"1.0\" encoding=\"" . CHARSET . "\"?>\n<photos>\n"; foreach ($photos as $photo) { echo "\t<photo>\n"; echo "\t\t<path><![CDATA[" . StringUtil::escapeCDATA(PAGE_URL . '/' . $photo->getPhoto(self::convertSize(INLINE_IMAGE_MAX_WIDTH))) . "]]></path>\n"; echo "\t\t<title><![CDATA[" . StringUtil::escapeCDATA($photo->title) . "]]></title>\n"; echo "\t\t<link><![CDATA[" . PAGE_URL . "/index.php?page=UserGalleryPhoto&photoID=" . $photo->photoID . "]]></link>\n"; echo "\t\t<thumbnail><![CDATA[" . StringUtil::escapeCDATA(PAGE_URL . '/' . $photo->getPhoto('quadratic')) . "]]></thumbnail>\n"; echo "\t</photo>\n"; } echo '</photos>'; } exit; }
/** * @see EventListener::execute() */ public function execute($eventObj, $className, $eventName) { //check if user is logged in if (WCF::getUser()->userID == 0) { return; } if ($eventName == "readData") { $this->albumList = new UserGalleryAlbumList(); $this->albumList->sqlConditions .= 'user_gallery_album.ownerID = ' . WCF::getUser()->userID; $this->albumList->sqlConditions .= " AND user_gallery_album.isPrivate = 0"; $this->albumList->sqlOrderBy = 'user_gallery_album.showOrder ASC'; $this->albumList->readObjects(); $this->photoList = new UserGalleryPhotoList(); $this->photoList->sqlConditions .= 'user_gallery.ownerID = ' . WCF::getUser()->userID; $this->photoList->sqlConditions .= ' AND user_gallery.albumID = 0'; $this->photoList->readObjects(); } else { if ($eventName == "show") { WCF::getTPL()->assign(array('convertedSize' => UserGalleryPhotosXMLListPage::convertSize(INLINE_IMAGE_MAX_WIDTH), 'albums' => $this->albumList->getObjects(), 'uncategorized' => $this->photoList->getObjects())); WCF::getTPL()->append(array('additionalTabs' => '<li id="userGalleryTab"><a onclick="tabbedPane.openTab(\'userGallery\');"><span>' . WCF::getLanguage()->get('wcf.user.gallery') . '</span></a></li>', 'additionalSubTabs' => WCF::getTPL()->fetch('messageFormGallery'))); } } }