Example #1
0
<?php

require_once 'cls/clsAlbum.php';
require_once 'cls/clsComment.php';
require_once 'cls/clsPicture.php';
$objComment = new clsComment();
$objComment->getFromRequest();
$objComment->load();
$objPicture = new clsPicture();
$objPicture->getFromRequest();
$objPicture->load();
$objAlbum = new clsAlbum($objPicture->get('album_id'));
if ($strSubAction == 'edit') {
    if ($objComment->isNew() && !$objAlbum->canPostComment($objUser)) {
        throw new Exception('exception_accessdenied');
    }
    if (!$objComment->canEdit($objUser)) {
        throw new Exception('exception_accessdenied');
    }
    $objAlbum->addBreadcrumbs($objBreadcrumbs);
    $objBreadcrumbs->add($objPicture->get('name'), 'index.php?action=picture&' . $objPicture->getIDPair());
    $objBreadcrumbs->add('Post comment', 'comment.php?action=edit&' . $objPicture->getIDPair() . '&' . $objComment->getIDPair());
    $objCommentTemplate = new clsTemplate('editcomment');
    $objCommentTemplate->setText('HIDDEN', $objComment->getHiddenField('id'));
    $objCommentTemplate->setText('HIDDEN', $objPicture->getHiddenField('id'));
    $objCommentTemplate->setText('HIDDEN', "<input type='hidden' name='action' value='comment'>");
    $objCommentTemplate->setText('HIDDEN', "<input type='hidden' name='subaction' value='save'>");
    if ($objUser) {
        $objCommentTemplate->setText('NAME', '<strong>' . $objUser->get('username') . '</strong>');
    } else {
        $objCommentTemplate->setText('NAME', $objComment->getTextField('username'));
Example #2
0
require_once 'cls/clsDB.php';
require_once 'cls/clsPicture.php';
require_once 'cls/clsSetting.php';
require_once 'cls/clsThumbnail.php';
require_once 'cls/clsUser.php';
require_once 'include/messages.php';
session_start();
clsSetting::load_settings();
try {
    if (!isset($_SESSION['objUser'])) {
        $objUser = clsUser::getCookie();
    } else {
        $objUser = $_SESSION['objUser'];
    }
    $objPicture = new clsPicture();
    $objPicture->getFromRequest(array('id'));
    $objPicture->load();
    if ($objPicture->isnew()) {
        throw new Exception('exception_invalidrequest');
    }
    $objAlbum = new clsAlbum($objPicture->get('album_id'));
    if (!$objAlbum->canView($objUser)) {
        throw new Exception('exception_invalidrequest');
    }
    if (isset($_REQUEST['tn']) || isset($_REQUEST['action']) && $_REQUEST['action'] == 'tn') {
        $intWidth = isset($_REQUEST['w']) ? $_REQUEST['w'] : -1;
        $intHeight = isset($_REQUEST['h']) ? $_REQUEST['h'] : -1;
        if (!is_numeric($intWidth) || $intWidth < 0 || $intWidth > MAX_X) {
            throw new Exception('exception_invalidrequest');
        }
        if (!is_numeric($intHeight) || $intHeight < 0 || $intHeight > MAX_Y) {