PHP Classes

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

Recommend this page to a friend!
  Classes of James Brows   PHP Bulletin Board   upload/plugins/bulletinboard/api_libs/bb_add_thread_ads.php   Download  
File: upload/plugins/bulletinboard/api_libs/bb_add_thread_ads.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: 3 years ago
Size: 1,559 bytes
 

Contents

Class file image Download
<?php

function bb_add_thread_ads()
{
   
  
$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'));
  
$forum_id=addslashes(getPost('forum_id'));
  
$start_date=addslashes(getPost('start_date'));
  
$end_date=addslashes(getPost('end_date'));

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

   if(!isset(
$start_date[2]))
   {
       return
'Start date not allow is blank!';
   }

   if(!isset(
$end_date[2]))
   {
       return
'End date not allow is blank!';
   }

  
$db=new Database();

  
$latestOrder=$db->query("select ifnull(MAX(sort_order),'0') as sort_order from bb_ads_thread_data ");

  
$newOrder=(int)$latestOrder[0]['sort_order']+1;

  
$useID=rand(10,20);

  
$ads_id=newID($useID);

  
$insertData=array(
      
'ads_id'=>$ads_id,
      
'thread_id'=>$thread_id,
      
'forum_id'=>$forum_id,
      
'start_date'=>$start_date,
      
'end_date'=>$end_date,
      
'method'=>'thread',
      
'status'=>'1',
      
'sort_order'=>$newOrder,
      
'user_id'=>Configs::$_['user_data']['user_id'],
   );

  
$queryStr=arrayToInsertStr('bb_ads_thread_data',$insertData);
  
  
$db->nonquery($queryStr);

  
BB_Forum::clear_ads_threads($forum_id);

   return
'Done';
}