Пример #1
0
<?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>";
}
Пример #2
0
    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&amp;" . $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";
} catch (Exception $e) {
    $_SESSION['e'] = $e;
    header("Location: index.php?action=exception&message=" . $e->getMessage());
}
Пример #3
0
    } 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);
                }
            }
        }
    }
}
Пример #4
0
    }
    /* Make sure that users can only edit their own pictures. */
    $objPicture->delete();
    $objPicture->save();
    header("Location: index.php?action=upload&subaction=preview");
}
if ($strSubAction == 'preview') {
    $objTemplate->setText('PAGETITLE', "Pending Pictures");
    $objBreadcrumbs->add('Upload', 'index.php?action=upload');
    $objBreadcrumbs->add('Pending', 'index.php?action=upload&subaction=preview');
    $arrPictures = clsPicture::getPending($objUser);
    print "You have <strong>" . sizeof($arrPictures) . "</strong> pictures waiting for attention" . ($objUser ? "" : " (note: unsaved images from all guests will appear here)") . ":<br><br>";
    foreach ($arrPictures as $objPicture) {
        $objPicture = new clsPicture($objPicture->get('id'));
        $objAlbum = new clsAlbum($objPicture->get('album_id'));
        $objTemplate = new clsTemplate('preview');
        $objTemplate->setText('HIDDEN', $objPicture->getHiddenField('id'));
        $objTemplate->setText('ALBUM', $objPicture->getCombo('album_id', clsDB::getOptionsFromList($objAlbum->getPostableAlbums($objUser), 'name', 'id', "Select an album")));
        $objTemplate->setText('ID', $objPicture->get('id'));
        $objTemplate->setText('IMAGE', $objPicture->getHtmlThumbnail(250, 250));
        /* TODO: Customizable? */
        $objTemplate->setText('NAME', $objPicture->get('original_name'));
        $objTemplate->setText('WIDTH', $objPicture->get('width'));
        $objTemplate->setText('HEIGHT', $objPicture->get('height'));
        $objTemplate->setText('SAVEDELETE', $objPicture->getCombo('subaction', array('confirm' => 'Keep', 'delete' => 'Don\'t keep'), null, true));
        $objTemplate->setText('TITLE', $objPicture->getTextField('title'));
        $objTemplate->setText('CAPTION', $objPicture->getTextArea('caption'));
        $objTemplate->setText('SUBMIT', $objPicture->getSubmit('Save'));
        print $objTemplate->get();
    }
}