Пример #1
0
 public function remove($content)
 {
     $person = OCSUser::id();
     EDatabase::q("DELETE FROM ocs_fan WHERE person={$person} and content={$content}");
     //part needed for activity
     $con = new OCSContent();
     $con->load($content);
     OCSActivity::add(OCSUser::id(), 10, OCSUser::login() . " is no longer fan of " . $con->name);
 }
Пример #2
0
 public static function approve_invitation($touser)
 {
     $idfrom = OCSUser::id();
     $datafrom = OCSUser::server_get_user_info($idfrom);
     $loginfrom = $datafrom[0]["login"];
     $info = OCSUser::server_get_user_info($touser);
     $id = $info[0]["id"];
     //creating new table object
     $ocs_friendinvitation = new EModel("ocs_friendinvitation");
     //if($ocs_friendinvitation->is_there("touser","(fromuser=$idfrom and touser=$id) or (touser=$idfrom and fromuser=$id)"))
     if ($ocs_friendinvitation->is_there("touser", "(touser={$idfrom} and fromuser={$id})")) {
         EDatabase::q("DELETE FROM ocs_friendinvitation WHERE (fromuser={$id} AND touser={$idfrom}) OR (touser={$id} AND fromuser={$idfrom}) LIMIT 2");
         EDatabase::q("INSERT IGNORE INTO ocs_friendship (id1,id2) VALUES ({$idfrom},{$id})");
         EDatabase::q("INSERT IGNORE INTO ocs_friendship (id1,id2) VALUES ({$id},{$idfrom})");
         //adding activity messages
         OCSActivity::add($idfrom, 2, OCSUser::login() . " became friend with {$touser}.");
         OCSActivity::add($id, 2, "{$touser} became friend with " . OCSUser::login() . ".");
     }
 }
Пример #3
0
 public function updated()
 {
     OCSActivity::add(OCSUser::id(), 6, OCSUser::login() . " updated " . $this->name);
 }
Пример #4
0
 /**	 
  * submit a activity
  * @param string $format
  * @param string $message
  * @return string xml/json
  */
 private function activityput($format, $message)
 {
     $user = $this->checkpassword();
     $this->checktrafficlimit($user);
     if ($user != '') {
         if (trim($message) != '') {
             OCSActivity::add(OCSUser::id(), 1, $message);
             echo $this->generatexml($format, 'ok', 100, '');
         } else {
             echo $this->generatexml($format, 'failed', 101, 'empty message');
         }
     } else {
         echo $this->generatexml($format, 'failed', 102, 'user not found');
     }
 }