summaryrefslogtreecommitdiff
path: root/view_file.php
diff options
context:
space:
mode:
authorspiderr <spider@viovio.com>2012-03-21 09:58:49 -0400
committerspiderr <spider@viovio.com>2012-03-21 09:58:49 -0400
commit5e75700ddf86aa603147ed3ad60c9a7d82db7963 (patch)
treeda3429450bdab7a7cda295792171eed0a26c67de /view_file.php
parentd9b234c9a6fd62b7bcbca7368d84ba5e05da6328 (diff)
downloadliberty-5e75700ddf86aa603147ed3ad60c9a7d82db7963.tar.gz
liberty-5e75700ddf86aa603147ed3ad60c9a7d82db7963.tar.bz2
liberty-5e75700ddf86aa603147ed3ad60c9a7d82db7963.zip
filesize( $pFileHash[source_file] check in liberty_magickwand_resize_image; ensure valid getLibertyObject returned; whitespace cleanup
Diffstat (limited to 'view_file.php')
-rw-r--r--view_file.php57
1 files changed, 30 insertions, 27 deletions
diff --git a/view_file.php b/view_file.php
index 39bf5a2..20d1869 100644
--- a/view_file.php
+++ b/view_file.php
@@ -22,39 +22,42 @@ if( @!BitBase::verifyId( $_REQUEST['attachment_id'] ) || !( $attachment = Libert
}
// first we need to check the permissions of the content the attachment belongs to since they inherit them
-$gContent = LibertyBase::getLibertyObject( $attachment['content_id'] );
-$gContent->verifyViewPermission();
+if( $gContent = LibertyBase::getLibertyObject( $attachment['content_id'] ) ) {
+ $gContent->verifyViewPermission();
-if( !empty( $_REQUEST['plugin_submit'] )) {
- // now that we have data for a plugin, we'll simply feed it back to the update function of that plugin
- $data = !empty( $_REQUEST['plugin'][$attachment['attachment_id']][$attachment['attachment_plugin_guid']] ) ? $_REQUEST['plugin'][$attachment['attachment_id']][$attachment['attachment_plugin_guid']] : array();
- if( $gContent->updateAttachmentParams( $attachment['attachment_id'], $attachment['attachment_plugin_guid'], $data )) {
- $feedback['success'] = tra( "The data was successfully updated." );
- } else {
- $feedback['error'] = $gContent->mErrors;
+ if( !empty( $_REQUEST['plugin_submit'] )) {
+ // now that we have data for a plugin, we'll simply feed it back to the update function of that plugin
+ $data = !empty( $_REQUEST['plugin'][$attachment['attachment_id']][$attachment['attachment_plugin_guid']] ) ? $_REQUEST['plugin'][$attachment['attachment_id']][$attachment['attachment_plugin_guid']] : array();
+ if( $gContent->updateAttachmentParams( $attachment['attachment_id'], $attachment['attachment_plugin_guid'], $data )) {
+ $feedback['success'] = tra( "The data was successfully updated." );
+ } else {
+ $feedback['error'] = $gContent->mErrors;
+ }
+ // reload the attachment
+ $attachment = LibertyMime::getAttachment( $_REQUEST['attachment_id'] );
}
- // reload the attachment
- $attachment = LibertyMime::getAttachment( $_REQUEST['attachment_id'] );
-}
-// attachment usage filter stuff is hardcoded for now - ugly as hell but we'll survive it as long as there's no demand for more of these.
-if( $gLibertySystem->isPluginActive( 'filterattachment' )) {
- $gBitSmarty->assign( 'usage', attachment_filter_get_usage( $attachment['attachment_id'] ));
-}
+ // attachment usage filter stuff is hardcoded for now - ugly as hell but we'll survive it as long as there's no demand for more of these.
+ if( $gLibertySystem->isPluginActive( 'filterattachment' )) {
+ $gBitSmarty->assign( 'usage', attachment_filter_get_usage( $attachment['attachment_id'] ));
+ }
-if( empty( $_REQUEST['size'] )) {
- $_REQUEST['size'] = 'large';
-}
+ if( empty( $_REQUEST['size'] )) {
+ $_REQUEST['size'] = 'large';
+ }
-$attachment['original'] = ( $gContent->isOwner( $attachment ) || $gBitSystem->isFeatureActive( 'liberty_original_image' ));
+ $attachment['original'] = ( $gContent->isOwner( $attachment ) || $gBitSystem->isFeatureActive( 'liberty_original_image' ));
-$gBitSmarty->assign( 'attachment', $attachment );
-$gBitSmarty->assign( 'gContent', $gContent );
-$gBitSmarty->assign( 'feedback', $feedback );
+ $gBitSmarty->assign( 'attachment', $attachment );
+ $gBitSmarty->assign( 'gContent', $gContent );
+ $gBitSmarty->assign( 'feedback', $feedback );
-// what template are we going to use to display this attachment
-$gBitSmarty->assign( 'view_template', $gLibertySystem->getMimeTemplate( 'view', $attachment['attachment_plugin_guid'] ));
-$gBitSmarty->assign( 'edit_template', $gLibertySystem->getMimeTemplate( 'edit', $attachment['attachment_plugin_guid'] ));
+ // what template are we going to use to display this attachment
+ $gBitSmarty->assign( 'view_template', $gLibertySystem->getMimeTemplate( 'view', $attachment['attachment_plugin_guid'] ));
+ $gBitSmarty->assign( 'edit_template', $gLibertySystem->getMimeTemplate( 'edit', $attachment['attachment_plugin_guid'] ));
-$gBitSystem->display( 'bitpackage:liberty/mime_view.tpl', tra( "View File" ), array( 'display_mode' => 'display' ));
+ $gBitSystem->display( 'bitpackage:liberty/mime_view.tpl', tra( "View File" ), array( 'display_mode' => 'display' ));
+} else {
+ $gBitSystem->fatalError( 'Not Found', NULL, NULL, HttpStatusCodes::HTTP_NOT_FOUND );
+}
?>