<?php require_once 'cls/clsAlbum.php'; require_once 'cls/clsPicture.php'; print "<span class='recentheader'>New Pictures</span>"; $arrPictures = clsPicture::getRecentPictures($objUser, 5); foreach ($arrPictures as $objPicture) { $objPicture = new clsPicture($objPicture->get('id')); $objAlbum = new clsAlbum($objPicture->get('album_id')); print "<p>"; print $objPicture->getHtmlThumbnail(100, 100) . "<br>"; print "<a href='index.php?action=picture&" . $objPicture->getIDPair() . "' class='recentlink'>" . $objPicture->get('title') . "</a> <span class='recentdate'>in</span> <a href='index.php?action=albums&" . $objAlbum->getIDPair() . "' class='recentlink'>" . $objAlbum->get('name') . "</a><br>"; print "<span class='recentdate'>" . $objPicture->getUsername() . "<br>"; print time_to_text(strtotime($objPicture->get('date'))) . "</span>"; print "</p>"; }
} if (!$objPicture->get('confirmed')) { header("Location: index.php?action=upload&subaction=preview"); die; } /* Check for access. */ $objAlbum = new clsAlbum($objPicture->get('album_id')); if (!$objAlbum->canView($objUser)) { throw new Exception('exception_accessdenied'); } $objAlbum->addBreadcrumbs($objBreadcrumbs); // $strMiniMenu = "<li><a href='index.php?action=picture&subaction=edit&" . $objPicture->getIDPair() . "'>Create Album</a></li>"; // $objTemplate->setText('MINIMENU', "<ul>$strMiniMenu</ul>"); if ($strSubAction == '') { $objTemplate->setText('PAGETITLE', "Viewing " . $objPicture->get('title')); $objBreadcrumbs->add($objPicture->get('title'), "index.php?action=picture&" . $objPicture->getIDPair()); if ($objPicture->canEdit($objUser)) { $objMiniMenu->add('Edit', 'index.php?action=picture&subaction=edit&' . $objPicture->getIDPair()); } if ($objAlbum->canDeletePicture($objUser)) { $objMiniMenu->add('Delete', 'index.php?action=picture&subaction=delete&' . $objPicture->getIDPair()); } $objMiniMenu->add('Link to this', 'index.php?action=picture&subaction=link&' . $objPicture->getIDPair()); /* Mark this picture as viewed. */ $objPicture->setViewed($objUser); $objPictureTemplate = new clsTemplate('picture'); if ($objPrevPicture) { $objPictureTemplate->setText('PREV', "<a href='index.php?action=picture&" . $objPrevPicture->getIDPair() . "'>Previous<br>" . $objPrevPicture->getHtmlThumbnail(64, 64) . "</a>"); } else { $objPictureTemplate->setText('PREV', "<span class='disabled'>At the start</span>"); }
} else { if ($strSubAction == 'delete') { if (!$objComment->canDelete($objUser)) { throw new Exception('exception_accessdenied'); } $objComment->delete(); $objComment->save(); header("Location: index.php?action=picture&" . $objPicture->getIDPair()); } else { if ($strSubAction = 'viewnew') { if (!$objUser) { throw new Exception('exception_accessdenied'); } $arrComments = clsComment::getNewComments($objUser); foreach ($arrComments as $objComment) { $objComment = new clsComment($objComment->get('id')); $objPicture = new clsPicture($objComment->get('picture_id')); $objCommentTemplate = new clsTemplate('newcomment'); $objCommentTemplate->setText('IMAGE', "<a href='index.php?action=picture&" . $objPicture->getIDPair() . "'>" . $objPicture->getHtmlThumbnail(128, 128) . "</a>"); $objCommentTemplate->setText('TITLE', $objComment->get('title') . ' ' . $objComment->getNewIcon($objUser)); $objCommentTemplate->setText('USERNAME', $objComment->getUsername()); $objCommentTemplate->setText('DATE', time_to_text(strtotime($objComment->get('date')))); $objCommentTemplate->setText('TEXT', bbcode_format($objComment->get('text'))); print $objCommentTemplate->get(); /* Mark the comment as viewed */ $objComment->setViewed($objUser); } } } } }
require_once 'cls/clsUser.php'; session_start(); clsSetting::load_settings(); try { if (!isset($_SESSION['objUser'])) { $objUser = clsUser::getCookie(); } else { $objUser = $_SESSION['objUser']; } header("Content-type: application/xhtml+xml"); $arrPictures = clsPicture::getRecentPictures($objUser, 10); $url = "http://" . $_SERVER['HTTP_HOST'] . "/" . preg_replace("/\\/[a-zA-Z0-9.]*\$/", "/index.php", $_SERVER['PHP_SELF']); print "<?xml version='1.0' encoding='UTF-8'?>\n<!-- generator='OSPAP2' -->\n<rss version='2.0'\n\txmlns:content='http://purl.org/rss/1.0/modules/content/'\n\txmlns:wfw='http://wellformedweb.org/CommentAPI/'\n\txmlns:dc='http://purl.org/dc/elements/1.1/'\n\t>\n\n<channel>\n\t<title>" . SITE_NAME . "</title>\n\t<link>{$url}</link>\n\t<description>" . SITE_DESCRIPTION . "</description>\n\t<generator>http://www.javaop.com/~ron/ospap2</generator>\n\t<language>en</language>\n"; foreach ($arrPictures as $objPicture) { $objPicture = new clsPicture($objPicture->get('id')); $link = "http://" . $_SERVER['HTTP_HOST'] . "/" . preg_replace("/\\/[a-zA-Z0-9.]*\$/", "/index.php?action=picture&" . $objPicture->getIDPair(), $_SERVER['PHP_SELF']); print "\t<item>\n"; print "\t\t<title>" . $objPicture->get('title') . "</title>\n"; print "\t\t<link>{$link}</link>\n"; print "\t\t<comments>{$link}</comments>\n"; print "\t\t<pubDate>" . date("D M j Y G:i:s T", strtotime($objPicture->get('date'))) . "</pubDate>\n"; print "\t\t<dc:creator>" . $objPicture->getFrom('user', 'username') . "</dc:creator>\n"; print "\t\t<category><![CDATA[" . $objPicture->getFrom('album', 'name') . "]]></category>\n"; print "\t\t<guid isPermaLink=\"true\">{$link}</guid>\n"; print "\t\t<description><![CDATA[" . cut_text($objPicture->get('caption'), 200) . "<br><br>" . $objPicture->getHtmlThumbnail(150, 150) . "]]></description>\n"; print "\t\t<content:encoded><![CDATA[" . $objPicture->get('caption') . "<br><br>" . $objPicture->getHtml() . "]]></content:encoded>\n"; print "\t\t<wfw:commentRss>" . $_SERVER['PHP_SELF'] . "</wfw:commentRss>\n"; print "\t</item>\n"; } print "</channel>\n"; print "</rss>\n";