| | 170 | function friend_requests(){ |
| | 171 | $user = $this->loginRequired(); |
| | 172 | if($user->privateFlag == false){ |
| | 173 | Header::redirect(Rhaco::url('home')); |
| | 174 | } |
| | 175 | $parser = $this->read(new StandBy(), new C(Q::eq(StandBy::columnRequestId(), $user->getId()), Q::fact())); |
| | 176 | $parser->setTemplate(Rhaco::constant('THEME').'/friend_requests.html'); |
| | 177 | $parser->setVariable('user', $user); |
| | 178 | $parser->setVariable('following', $this->_getFollowing($user)); |
| | 179 | return $parser; |
| | 180 | } |
| | 181 | function acceptRequest($id){ |
| | 182 | $user = $this->loginRequired(); |
| | 183 | $request = $this->dbUtil->get(new StandBy($id)); |
| | 184 | if(Variable::istype('TableObjectBase', $request) && $request->requestId == $user->id){ |
| | 185 | $request->accept($this->dbUtil); |
| | 186 | } |
| | 187 | Header::redirect(Rhaco::url('friend_requests')); |
| | 188 | } |
| | 189 | function denyRequest($id){ |
| | 190 | $user = $this->loginRequired(); |
| | 191 | $request = $this->dbUtil->get(new StandBy($id)); |
| | 192 | if(Variable::istype('TableObjectBase', $request) && $request->requestId == $user->id){ |
| | 193 | $request->deny($this->dbUtil); |
| | 194 | } |
| | 195 | Header::redirect(Rhaco::url('friend_requests')); |
| | 196 | } |
| | 197 | |