PHP Classes

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

Recommend this page to a friend!
  Classes of James Brows   PHP Bulletin Board   upload/plugins/bulletinboard/api_libs/bb_add_comment_on_profile_page.php   Download  
File: upload/plugins/bulletinboard/api_libs/bb_add_comment_on_profile_page.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,729 bytes
 

Contents

Class file image Download
<?php

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

  
$content=strip_tags_blacklist(addslashes(getPost('content')),['iframe']);
  
$target_user_id=addslashes(getPost('target_user_id'));
  
$target_username=addslashes(getPost('target_username'));
  
$captcha_answer=trim(addslashes(getPost('captcha_answer','')));
   if(!isset(
$content[2]))
   {
       return
'Content not allow blank';
   }

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

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

  
   if((int)
Configs::$_['bb_enable_captcha_when_send_wall_message']==1)
   {
       if(
strlen($captcha_answer)==0)
       {
           return
'You must type captcha characters!';
       }
   }


   
$insertData=array(
       
'message_id'=>newID(22),
       
'author_id'=>Configs::$_['user_data']['user_id'],
       
'wall_user_id'=>$target_user_id,
       
'content'=>$content,
    );

   
$queryStr=arrayToInsertStr('bb_user_wall_comment_data',$insertData);
   
$db=new Database();

   
   
// Captcha process
   
if((int)Configs::$_['bb_enable_captcha_when_send_wall_message']==1)
    {
       
$result=$db->query("select answer from bb_captcha_session_data where session_id='".Configs::$_['visitor_data']['session_id']."'");

        if(
$captcha_answer!=$result[0]['answer'])
        {
            return
'Your captcha answer is wrong!';
        }
    }

   
$db->nonquery($queryStr);

   
saveActivities('bb_user_wall_comment_add','Add comment on '.$target_username,$username);

// EmailSystem::prepare_send_newuser($insertData);

   
return 'OK';
}