liberty
[ class tree: liberty ] [ index: liberty ] [ all elements ]

Source for file edit_storage_inc.php

Documentation is available at edit_storage_inc.php

  1. <?php
  2. /**
  3.  * @version  $Header$
  4.  *
  5.  *  edit_storage_inc
  6.  * @author   spider <spider@steelsun.com>
  7.  * @package  liberty
  8.  * @subpackage functions
  9.  */
  10. global $gBitSmarty, $gContent, $gBitUser, $gBitSystem, $gBitThemes, $gLibertySystem;
  11.  
  12. // if we have active plugins with an upload function, we call them:
  13. foreach( $gLibertySystem->getPluginFunctions( 'upload_function' ) as $guid => $func ) {
  14.     $func( $gContent );
  15. }
  16.  
  17. // set up base arguments
  18. $getArgs = explode( '&', $_SERVER['QUERY_STRING'] );
  19. $attachmentBaseArgs = '';
  20. foreach( $getArgs as $arg ) {
  21.     $parts = explode( '=', $arg );
  22.     if( $parts[0] != 'deleteAttachment' ) {
  23.         $attachmentBaseArgs .= $arg."&amp;";
  24.     }
  25. }
  26. $gBitSmarty->assign( 'attachmentBaseArgs', $attachmentBaseArgs );
  27.  
  28. // delete attachment if requested
  29. if( !empty( $_REQUEST['deleteAttachment'] )) {
  30.  
  31.     // $gContent is empty when we're editing our personal webpage
  32.     // this is a brutish hack but it seems to work without adverse effeects
  33.     if( empty( $gContent )) {
  34.         $gContent = $gBitUser;
  35.     }
  36.  
  37.     $attachmentId = $_REQUEST['deleteAttachment'];
  38.     $attachmentInfo = $gContent->getAttachment( $attachmentId );
  39.  
  40.     // the second part of this check seems odd (never used?) to me, but I'll leave it in for now - spiderr 10/17/2007
  41.     if( $gContent->hasAdminPermission() || ( $gContent->isOwner( $attachmentInfo ) && $gBitUser->hasPermission( 'p_liberty_delete_attachment' ))) {
  42.         $gContent->expungeAttachment( $attachmentId );
  43.     }
  44.  
  45.     // in case we have deleted attachments
  46.     // seems like there should be a better way to do this -- maybe original assign should have been by reference?
  47.     $gBitSmarty->clear_assign( 'gContent' );
  48.     $gBitSmarty->assign( 'gContent', $gContent );
  49. }
  50.  
  51. // make sure js is being loaded
  52. if( $gBitSystem->getConfig( 'liberty_attachment_style' ) == 'ajax' ) {
  53.     $gBitThemes->loadJavascript( LIBERTY_PKG_PATH.'scripts/LibertyAttachment.js', TRUE );
  54. }
  55. ?>

Documentation generated on Wed, 29 Jul 2015 13:56:27 +0000 by phpDocumentor 1.5.0-lsces