File indexing completed on 2024-12-22 05:33:23

0001 <?php
0002 
0003 /*
0004  *   TRT GFX 3.0.1 (beta build) BackToSlash
0005  * 
0006  *   support: happy.snizzo@gmail.com
0007  *   website: http://trt-gfx.googlecode.com
0008  *   credits: Claudio Desideri
0009  *   
0010  *   This software is released under the MIT License.
0011  *   http://opensource.org/licenses/mit-license.php
0012  */ 
0013 
0014 class OCSFan {
0015   
0016   public function __construct(){
0017     //
0018   }
0019   
0020   public function add($content){
0021     $person = OCSUser::id();
0022     EDatabase::q("INSERT INTO ocs_fan (person,content) VALUES ($person,$content)");
0023     
0024     //part needed for activity
0025     $con = new OCSContent();
0026     $con->load($content);
0027     OCSActivity::add(OCSUser::id(), 9, OCSUser::login()." is now fan of ".$con->name);
0028   }
0029   
0030   public function remove($content){
0031     $person = OCSUser::id();
0032     EDatabase::q("DELETE FROM ocs_fan WHERE person=$person and content=$content");
0033     
0034     //part needed for activity
0035         $con = new OCSContent();
0036         $con->load($content);
0037         OCSActivity::add(OCSUser::id(), 10, OCSUser::login()." is no longer fan of ".$con->name);
0038   }
0039   
0040   public function isfan($content){
0041     $fant = new EModel("ocs_fan");
0042     
0043     $person = OCSUser::id();
0044     $r = $fant->find("*", "where person=$person and content=$content");
0045     if(!empty($r)){
0046       return true;
0047     } else {
0048       return false;
0049     }
0050   }
0051   
0052 }
0053 
0054 ?>