diff options
| author | modela bitweaver <spiderr@bitweaver.org> | 2021-02-02 01:17:09 -0500 |
|---|---|---|
| committer | modela bitweaver <spiderr@bitweaver.org> | 2021-02-02 01:17:09 -0500 |
| commit | 4abf677ae556f0cf7e08d377df1e0ffb9041267a (patch) | |
| tree | 92023c1799a04fe82398beb9436d4e67f7688658 /includes/edit_storage_inc.php | |
| parent | 8ad7ef38d30923bb0b8cb5bce381dc4ce87052a4 (diff) | |
| download | liberty-4abf677ae556f0cf7e08d377df1e0ffb9041267a.tar.gz liberty-4abf677ae556f0cf7e08d377df1e0ffb9041267a.tar.bz2 liberty-4abf677ae556f0cf7e08d377df1e0ffb9041267a.zip | |
move _inc and _lib to includes/ and use PKG_INCLUDE_PATH constants
Diffstat (limited to 'includes/edit_storage_inc.php')
| -rw-r--r-- | includes/edit_storage_inc.php | 55 |
1 files changed, 55 insertions, 0 deletions
diff --git a/includes/edit_storage_inc.php b/includes/edit_storage_inc.php new file mode 100644 index 0000000..3d40b0f --- /dev/null +++ b/includes/edit_storage_inc.php @@ -0,0 +1,55 @@ +<?php +/** + * @version $Header$ + * + * edit_storage_inc + * @author spider <spider@steelsun.com> + * @package liberty + * @subpackage functions + */ +global $gBitSmarty, $gContent, $gBitUser, $gBitSystem, $gBitThemes, $gLibertySystem; + +// if we have active plugins with an upload function, we call them: +foreach( $gLibertySystem->getPluginFunctions( 'upload_function' ) as $guid => $func ) { + $func( $gContent ); +} + +// set up base arguments +$getArgs = explode( '&', $_SERVER['QUERY_STRING'] ); +$attachmentBaseArgs = ''; +foreach( $getArgs as $arg ) { + $parts = explode( '=', $arg ); + if( $parts[0] != 'deleteAttachment' ) { + $attachmentBaseArgs .= $arg."&"; + } +} +$gBitSmarty->assign( 'attachmentBaseArgs', $attachmentBaseArgs ); + +// delete attachment if requested +if( !empty( $_REQUEST['deleteAttachment'] )) { + + // $gContent is empty when we're editing our personal webpage + // this is a brutish hack but it seems to work without adverse effeects + if( empty( $gContent )) { + $gContent = $gBitUser; + } + + $attachmentId = $_REQUEST['deleteAttachment']; + $attachmentInfo = $gContent->getAttachment( $attachmentId ); + + // the second part of this check seems odd (never used?) to me, but I'll leave it in for now - spiderr 10/17/2007 + if( $gContent->hasAdminPermission() || ( $gContent->isOwner( $attachmentInfo ) && $gBitUser->hasPermission( 'p_liberty_delete_attachment' ))) { + $gContent->expungeAttachment( $attachmentId ); + } + + // in case we have deleted attachments + // seems like there should be a better way to do this -- maybe original assign should have been by reference? + $gBitSmarty->clearAssign( 'gContent' ); + $gBitSmarty->assign( 'gContent', $gContent ); +} + +// make sure js is being loaded +if( $gBitSystem->getConfig( 'liberty_attachment_style' ) == 'ajax' ) { + $gBitThemes->loadJavascript( LIBERTY_PKG_PATH.'scripts/LibertyAttachment.js', TRUE ); +} +?> |
