Beispiel #1
0
 public function deleteBlog($blogid)
 {
     if (isset($this->authIdentity)) {
         $userid = $this->authIdentity->userid;
         $affected_rows = $this->delete("blogid='{$blogid}' and userid='{$userid}'");
         if ($affected_rows == 1) {
             $activityModel = new Application_Model_Activity($this->_db);
             $activityModel->delete("userid='{$userid}' and contentid='{$blogid}' and contenttype='blog' and title='write blog'");
             return array("status" => "Admire removed");
         } else {
             return array("status" => "you dont have permission to delete this Admire");
         }
     } else {
         return array("status", "please give the valid information");
     }
 }
Beispiel #2
0
 public function unVotestature($statureid)
 {
     if (isset($this->authIdentity)) {
         $result = $this->find($statureid);
         $result = $result[0];
         $vote = unserialize($result['vote']);
         $vote = array_diff($vote, array($this->authIdentity->userid));
         $vote = array_unique($vote);
         $update_data = array('vote' => serialize($vote));
         $this->update($update_data, "statureid='{$statureid}'");
         $activityModel = new Application_Model_Activity($this->_db);
         $activityModel->delete(array('userid=?' => $this->authIdentity->userid, 'contenttype=?' => 'stature', 'title=?' => 'voted on', 'contentid=?' => $statureid));
     }
 }
Beispiel #3
0
 public function userUnvote($userid)
 {
     if (isset($this->authIdentity)) {
         $sql = $this->_db->select()->from('friends_vote')->where('userid=?', $userid);
         $result = $this->_db->fetchRow($sql);
         $votes = unserialize($result['vote']);
         if (in_array($this->authIdentity->userid, $votes)) {
             $votes = array_diff($votes, array($this->authIdentity->userid));
             $svote = array_diff($this->authIdentity->vote, array($userid));
             $suserid = $this->authIdentity->userid;
             $this->_db->update('friends_vote', array('vote' => serialize($votes)), array('userid=?' => $userid));
             $this->_db->update('friends_vote', array('voted' => serialize($svote)), array('userid=?' => $suserid));
             $activityModel = new Application_Model_Activity($this->_db);
             $suserid = $this->authIdentity->userid;
             $activityModel->delete(array('userid=?' => $suserid, 'contentid=?' => $userid, 'contenttype=?' => 'user', 'title=?' => 'voted on'));
         }
     }
 }
Beispiel #4
0
 public function deleteScribbles($postid)
 {
     if (isset($this->authIdentity)) {
         $result = $this->find($postid);
         if ($result->count() > 0) {
             $result = $result[0];
             if ($this->authIdentity->userid == $result['suserid'] || $this->authIdentity->userid == $result['ruserid']) {
                 $this->delete(array('statusid=?' => $postid));
                 $activityModel = new Application_Model_Activity($this->_db);
                 $activityModel->delete(array('contenttype=?' => 'post', 'contentid=?' => $postid));
             }
         }
     }
 }
Beispiel #5
0
 public function deleteVideoComment($commentid)
 {
     if (isset($this->authIdentity)) {
         $sql = $this->_db->select()->from('video_comments')->joinLeft($this->_name, 'video_comments.videoid=video.videoid', 'ruserid as video_userid')->where('commentid=?', $commentid);
         $result = $this->_db->fetchRow($sql);
         $userid = $this->authIdentity->userid;
         if ($result['userid'] == $userid || $result['video_userid'] == $userid) {
             $this->_db->delete('video_comments', "commentid='{$commentid}'");
             $userid = $this->authIdentity->userid;
             $videoid = $result['videoid'];
             $activityModel = new Application_Model_Activity($this->_db);
             $activityModel->delete("userid='{$userid}' and contentid='{$videoid}' and contenttype='video' and title='commented on'");
             $update_data = array('commentcount' => new Zend_Db_Expr('commentcount-1'));
             $this->update($update_data, array('videoid=?' => $videoid));
         }
     }
 }