PHP Classes

File: upload/plugins/bulletinboard/api_libs/bb_delete_attach_files.php

Recommend this page to a friend!
  Classes of James Brows   PHP Bulletin Board   upload/plugins/bulletinboard/api_libs/bb_delete_attach_files.php   Download  
File: upload/plugins/bulletinboard/api_libs/bb_delete_attach_files.php
Role: Example script
Content type: text/plain
Description: Example script
Class: PHP Bulletin Board
Manage and post messages in multi-user forums
Author: By
Last change:
Date: 2 years ago
Size: 1,452 bytes
 

Contents

Class file image Download
<?php

function bb_delete_attach_files()
{
   
  
$username=isset(Configs::$_['user_data']['user_id'])?Configs::$_['user_data']['user_id']:'';

// useClass('EmailSystem');

    // try {
    // isValidAccessAPI();
    // } catch (\Exception $e) {
    // echo responseData($e->getMessage(),'yes');return false;
    // }
    // Check default post status of user group
  
$status='1';

  
$thread_id=addslashes(getPost('thread_id'));
  
$file_id=addslashes(getPost('file_id'));

   if(!isset(
$thread_id[2]))
   {
       return
'Thread url not allow is blank!';
   }

   if(!isset(
$file_id[2]))
   {
       return
'File not valid!';
   }

  
$db=new Database();

  
$loadData=$db->query("select * from bb_threads_data where thread_id='".$thread_id."' AND user_id='".Configs::$_['user_data']['user_id']."'");

   if(
count($loadData) > 0)
   {
       
$loadFileData=$db->query("select * from bb_thread_attach_files_data where file_id='".$file_id."' AND post_id='".$thread_id."'");

        if(
count($loadFileData) > 0)
        {
            if(
file_exists(ROOT_PATH.$loadFileData[0]['file_path']))
            {
               
unlink(ROOT_PATH.$loadFileData[0]['file_path']);
            }
           
           
$db->nonquery("delete from bb_thread_attach_files_data where file_id='".$file_id."' AND post_id='".$thread_id."'");
        }
       
   }
   else
   {
        return
'You can not delete this file!';
   }

   return
'Done';
}