Jump to content

Download: (SOS31) Avoid Deleting of Attachments v1.0.0


Adriano Faria

Recommended Posts

File Name: (SOS31) Avoid Deleting of Attachments v1.0.0
File Submitter: Adriano Faria
File Submitted: 09 Nov 2010
File Updated: 10 Nov 2010
File Category: Hooks and Plugins

This hook will protected your board's information by avoiding that users delete their attachments! Only SUPERMODERATORS and ADMINISTRATORS can remove attachments from now on.

Compatibility:

  • IP.Board 3.1.3+


Click here to download this file
Link to comment
  • 8 months later...
  • 4 weeks later...

Hi Adriano ..

I need this mod and I have try to compile my first hook... I have try to extend another class :

public_core_attach_attach.attachmentUploadRemove()



Remove an upload



public



Returns:


void




In this way :


class dfx32_attachremoval extends public_core_attach_attach

{

protected $registry;

protected $DB;

protected $memberData;

protected $settings;


public function __construct()

{

    	/* Make registry objects */

  $this->registry   =  ipsRegistry::instance();

  $this->DB     	=  $this->registry->DB();

  $this->memberData =& $this->registry->member()->fetchMemberData();

  $this->settings   =& $this->registry->fetchSettings();

}

/**

  * Remove an upload

  *

  * @return @e void

  */

public function attachmentUploadRemove()

{

  /* INIT */

  $attach_post_key  	= trim( IPSText::alphanumericalClean( $this->request['attach_post_key'] ) );

  $attach_rel_module	= trim( IPSText::alphanumericalClean( $this->request['attach_rel_module'] ) );

  $attach_rel_id    	= intval( $this->request['attach_rel_id'] );

  $attach_id        	= intval( $this->request['attach_id'] );


  /* Setup Module */

  $this->class_attach->type        	= $attach_rel_module;

  $this->class_attach->attach_post_key = $attach_post_key;

  $this->class_attach->attach_rel_id   = $attach_rel_id;

  $this->class_attach->attach_id   	= $attach_id;

  $this->class_attach->init();


  /* Remove the attachment */


  if ($this->memberData['g_is_supmod']) $removed = $this->class_attach->removeAttachment();


  /* Show the form */

  if( $removed )

  {

   $this->ajax->returnHtml( $this->attachmentUploadShow( 'attach_removed', 0 ) );

  }

  else

  {

   $this->ajax->returnHtml( $this->attachmentUploadShow( 'remove_failed', 1 ) );

  }

}

}



If I manually edit the attach.php work... but whit hook not work.. where I worng?

Regard

Link to comment

Archived

This topic is now archived and is closed to further replies.

  • Recently Browsing   0 members

    • No registered users viewing this page.
  • Upcoming Events

    No upcoming events found
×
×
  • Create New...