コード例 #1
0
ファイル: recentpictures.php プロジェクト: shifter/ospap2
<?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
ファイル: albums.php プロジェクト: shifter/ospap2
 if ($objAlbum->get('mime', DEFAULT_MIME, true) == '') {
     $objAlbum->set('mime', DEFAULT_MIME);
 }
 /* The template that looks after the edit page. */
 $objEditTemplate = new clsTemplate('editalbum');
 $objEditTemplate->setText('HIDDEN', $objAlbum->getHiddenField('id'));
 $objEditTemplate->setText('HIDDEN', $objAlbumGuest->getHiddenField('id'));
 $objEditTemplate->setText('HIDDEN', $objAlbumMember->getHiddenField('id'));
 $objEditTemplate->setText('HIDDEN', $objAlbumGroup->getHiddenField('id'));
 $objEditTemplate->setText('HIDDEN', $objAlbum->getHiddenField('album_id'));
 $objEditTemplate->setText('HIDDEN', "<input type='hidden' name='action' value='albums'>");
 $objEditTemplate->setText('HIDDEN', "<input type='hidden' name='subaction' value='save'>");
 $objEditTemplate->setText('MAXWIDTH', MAX_X);
 $objEditTemplate->setText('MAXHEIGHT', MAX_Y);
 $objEditTemplate->setText('NAME', $objAlbum->getTextField('name', new clsParameters('SIZE', 40)));
 $objEditTemplate->setText('PARENT', $objParent->isNew() ? "n/a" : $objParent->get('name'));
 $objEditTemplate->setText('GROUP', $objAlbum->getCombo('group_id', clsDB::getOptionsFromList(clsGroup::getGroups($objUser), 'name', 'id', "No group.")));
 $objEditTemplate->setText('CAPTION', $objAlbum->getTextArea('caption', 4, 45));
 $objEditTemplate->setText('EXPORTKEY', $objAlbum->getTextField('export_tag', new clsParameters('SIZE', 4)));
 $objEditTemplate->setText('WIDTH', $objAlbum->getTextField('max_width', new clsParameters('SIZE', 3)));
 $objEditTemplate->setText('HEIGHT', $objAlbum->getTextField('max_height', new clsParameters('SIZE', 3)));
 $objEditTemplate->setText('MIME', $objAlbum->getTextField('mime'));
 $strGroup = '';
 $strGroup .= "View pictures? " . $objAlbumGroup->getCombo('allow_view', $arrOptions) . "<br>";
 $strGroup .= "Rate pictures? " . $objAlbumGroup->getCombo('allow_rate', $arrOptions) . "<br>";
 $strGroup .= "Post pictures? " . $objAlbumGroup->getCombo('allow_post_picture', $arrOptions) . "<br>";
 $strGroup .= "Post comments? " . $objAlbumGroup->getCombo('allow_post_comment', $arrOptions) . "<br>";
 $strGroup .= "Delete pictures? " . $objAlbumGroup->getCombo('allow_delete_picture', $arrOptions) . "<br>";
 $strGroup .= "Create sub-albums?" . $objAlbumGroup->getCombo('allow_create_subalbum', $arrOptions) . "<br>";
 $objEditTemplate->setText('GROUPPERMISSIONS', $strGroup);
 $strMember = '';
コード例 #3
0
ファイル: clsGroup.php プロジェクト: shifter/ospap2
 public static function getAlbumsByGroup($objUser, $objGroup)
 {
     $arrAlbums = clsDB::selectQueryObjects('album', "SELECT *\n                                        FROM `<<tbl><album>>`\n                                            LEFT JOIN\n                                                (\n                                                    SELECT `<<foreign><picture><album>>`, MAX(`<<picture><date>>`) AS `<<album><last_updated>>`\n                                                    FROM `<<tbl><picture>>`\n                                                        WHERE `<<isdel><picture>>`='0'\n                                                            AND `<<picture><confirmed>>`='1'\n                                                    GROUP BY `<<foreign><picture><album>>`\n                                                ) AS a\n                                                ON `<<album><id>>` = `<<foreign><picture><album>>`\n                                        WHERE `<<isdel><album>>`='0'\n                                            AND `<<foreign><album><group>>`='" . $objGroup->get('id') . "'\n                                        ORDER BY `<<album><last_updated>>` DESC ");
     $arrRet = array();
     foreach ($arrAlbums as $objAlbum) {
         $objAlbum = new clsAlbum($objAlbum->get('id'));
         if ($objAlbum->canView($objUser)) {
             $arrRet[] = $objAlbum;
         }
     }
     return $arrRet;
 }
コード例 #4
0
ファイル: picture.php プロジェクト: shifter/ospap2
    }
}
if ($strSubAction == 'edit') {
    if (!$objPicture->canEdit($objUser)) {
        throw new Exception('exception_accessdenied');
    }
    $objTemplate->setText('PAGETITLE', "Editing " . $objPicture->get('title'));
    $objEditTemplate = new clsTemplate('editpicture');
    $objEditTemplate->setText('HIDDEN', "<input type='hidden' name='action'    value='picture'>");
    $objEditTemplate->setText('HIDDEN', "<input type='hidden' name='subaction' value='save'>");
    $objEditTemplate->setText('HIDDEN', $objPicture->getHiddenField('id'));
    $objEditTemplate->setText('ID', $objPicture->get('id'));
    $objEditTemplate->setText('WIDTH', $objPicture->get('width'));
    $objEditTemplate->setText('HEIGHT', $objPicture->get('height'));
    $objEditTemplate->setText('IMAGE', $objPicture->getHtmlThumbnail(250, 250));
    $objEditTemplate->setText('ALBUM', $objAlbum->get('name'));
    $objEditTemplate->setText('TITLE', $objPicture->getTextField('title'));
    $objEditTemplate->setText('CAPTION', $objPicture->getTextArea('caption', 4, 45));
    $objEditTemplate->setText('CONFIRMED', $objPicture->getCheckNoJavascript('confirmed'));
    $objEditTemplate->setText('SUBMIT', $objPicture->getSubmit('Save'));
    print $objEditTemplate->get();
}
if ($strSubAction == 'save') {
    if (!$objPicture->canEdit($objUser)) {
        throw new Exception('exception_accessdenied');
    }
    $objPicture->getFromRequest(array('id', 'title', 'caption', 'confirmed'));
    $objPicture->save();
    header("Location: index.php?action=picture&" . $objPicture->getIDPair());
}
if ($strSubAction == 'vote') {
コード例 #5
0
ファイル: clsAlbum.php プロジェクト: shifter/ospap2
 /** Get recently updated albums for a particular user. */
 public static function getRecentAlbums($objUser, $num)
 {
     if (!is_numeric($num)) {
         throw new exception('exception_internalerror');
     }
     $arrAlbums = clsDB::selectQueryObjects('album', "\n\t\t\t\t\t\t\t\t\t\tSELECT `<<tbl><album>>`.*, `<<picture><confirmed>>`, MAX(`<<picture><date>>`) AS `<<album><last_updated>>`\n\t\t\t\t\t\t\t\t\t\tFROM `<<tbl><album>>`\n\t\t\t\t\t\t\t\t\t\t\tJOIN `<<tbl><picture>>` ON `<<foreign><picture><album>>`=`<<album><id>>`\n\t\t\t\t\t\t\t\t\t\t\tWHERE `<<isdel><album>>`='0'\n\t\t\t\t\t\t\t\t\t\t\t\tAND `<<isdel><picture>>`='0'\n\t\t\t\t\t\t\t\t\t\t\t\tAND `<<picture><confirmed>>`='1'\n\t\t\t\t\t\t\t\t\t\tGROUP BY `<<album><id>>`\n\t\t\t\t\t\t\t\t\t\tORDER BY `<<album><last_updated>>` DESC\n\t\t");
     $arrRet = array();
     foreach ($arrAlbums as $objAlbum) {
         if (sizeof($arrRet) == $num) {
             return $arrRet;
         }
         $objAlbum = new clsAlbum($objAlbum->get('id'));
         if ($objAlbum->canView($objUser)) {
             $arrRet[] = $objAlbum;
         }
     }
     return $arrRet;
 }
コード例 #6
0
ファイル: recentalbums.php プロジェクト: shifter/ospap2
<?php

require_once 'cls/clsAlbum.php';
print "<span class='recentheader'>Recently Updated Albums</span>";
$arrAlbums = clsAlbum::getRecentAlbums($objUser, 5);
foreach ($arrAlbums as $objAlbum) {
    $objAlbum = new clsAlbum($objAlbum->get('id'));
    print "<p><a href='index.php?action=albums&" . $objAlbum->getIDPair() . "' class='recentlink'>" . $objAlbum->get('name') . "</a> <span class='recentdate'>(" . $objAlbum->getUsername() . ")</span> " . $objAlbum->getNewIcon($objUser) . "<br>";
    print "<span class='recentdate'>(" . $objAlbum->getLastUpdated() . ")</span></p>";
}
コード例 #7
0
ファイル: upload.php プロジェクト: shifter/ospap2
\t\t\tfor(i = 0; i < num; i++)
\t\t\t\taddRow(tbody_id);
\t\t}
EOF
);
if ($strSubAction == '') {
    $objAlbum = new clsAlbum();
    $objAlbum->getFromRequest(array('id'));
    $objAlbum->load();
    if (!$objAlbum->canPostPicture($objUser)) {
        throw new Exception('exception_accessdenied');
    }
    if ($objAlbum->isNew()) {
        $objTemplate->setText('PAGETITLE', "Uploading images");
    } else {
        $objTemplate->setText('PAGETITLE', "Uploading images to '" . $objAlbum->get('name') . "'");
    }
    $objMiniMenu->add('Pending Uploads', 'index.php?action=upload&subaction=preview');
    $objBreadcrumbs->add('Albums', 'index.php?action=albums');
    $objAlbum->addBreadcrumbs($objBreadcrumbs);
    $objBreadcrumbs->add('Upload', 'index.php?action=upload');
    ?>
		<form action='<?php 
    echo $_SERVER['PHP_SELF'];
    ?>
' method='POST' enctype='multipart/form-data'>
			<table width='100%'>
				<tr>
					<td align='right' width='100%'>
						Add <input type='text' size='3' id='numtoadd' value='5'> files...  <input type='button' onClick='addRows("files", $("numtoadd").value); $("addrows2").style.display="table-row";' value='Go!'>
					</td>