Ejemplo n.º 1
0
 private function onApprove($lid, $approve)
 {
     if (false === ($link = GWF_Links::getByID($lid))) {
         return $this->module->error('err_link');
     }
     if (!$link->isInModeration()) {
         return $this->module->error('err_approved');
     }
     if ($link->getToken() !== Common::getGet('token')) {
         return $this->module->error('err_token');
     }
     if ($approve) {
         if (false !== ($error = $link->insertTags($this->module))) {
             return $error;
         }
         if (false === $link->saveOption(GWF_Links::IN_MODERATION, false)) {
             return GWF_HTML::err('ERR_DATABASE', array(__FILE__, __LINE__));
         }
         if (false === $link->setVotesEnabled(true)) {
             return GWF_HTML::err('ERR_DATABASE', array(__FILE__, __LINE__));
         }
     } else {
         if (false !== ($error = $link->deleteLink($this->module))) {
             return $error;
         }
     }
     return $this->module->message($approve ? 'msg_approved' : 'msg_deleted');
 }
Ejemplo n.º 2
0
 private function sanitize()
 {
     if (false === ($this->link = GWF_Links::getByID(Common::getGet('lid')))) {
         return $this->module->error('err_link');
     }
     if (false === $this->link->mayEdit(GWF_Session::getUser())) {
         return $this->module->error('err_edit_perm');
     }
     return false;
 }
Ejemplo n.º 3
0
 public function execute()
 {
     if (false === ($link = GWF_Links::getByID(Common::getGet('lid')))) {
         return $this->module->error('err_link');
     }
     if (!$link->mayView(GWF_Session::getUser())) {
         return $this->module->error('err_view_perm');
     }
     if (false === $link->increase('link_clicks', 1)) {
         return GWF_HTML::err('ERR_DATABASE', array(__FILE__, __LINE__));
     }
     if (false === $link->onCalcPopularity()) {
         return GWF_HTML::err('ERR_DATABASE', array(__FILE__, __LINE__));
     }
     //		$link->markRead(GWF_Session::getUser());
     return $this->module->message('msg_counted_visit');
     //		header('Location: '.$link->getVar('link_href'));
     //		return $this->module->message('msg_redirecting', array($link->display('link_href')));
 }
Ejemplo n.º 4
0
 public function execute()
 {
     if (false === ($link = GWF_Links::getByID(Common::getGet('lid')))) {
         return $this->module->error('err_link');
     }
     if (!$link->mayView(GWF_Session::getUser())) {
         return $this->module->error('err_view_perm');
     }
     if ('favorite' === Common::getGet('my')) {
         $fav = true;
     } elseif ('favorite' === Common::getGet('no')) {
         $fav = false;
     } else {
         return GWF_HTML::err('ERR_GENERAL', array(__FILE__, __LINE__));
     }
     if (false === GWF_LinksFavorite::mark(GWF_Session::getUser(), $link, $fav)) {
         return GWF_HTML::err('ERR_DATABASE', array(__FILE__, __LINE__));
     }
     $msg = $fav ? 'msg_fav_yes' : 'msg_fav_no';
     return $this->module->message($msg);
 }
Ejemplo n.º 5
0
 private function sendModMail(GWF_Links $link)
 {
     $link = GWF_Links::getByID($link->getID());
     $mail = new GWF_Mail();
     $mail->setSender(GWF_BOT_EMAIL);
     $mail->setReceiver(GWF_ADMIN_EMAIL);
     $mail->setSubject($this->module->lang('mail_subj'));
     $href = $link->getVar('link_href');
     $descr = $link->display('link_descr');
     $descr2 = $link->display('link_descr2');
     $anchor = GWF_HTML::anchor($href, $href);
     $approve = Common::getAbsoluteURL($link->hrefModApprove());
     $approve = GWF_HTML::anchor($approve, $approve);
     $delete = Common::getAbsoluteURL($link->hrefModDelete());
     $delete = GWF_HTML::anchor($delete, $delete);
     $mail->setBody($this->module->lang('mail_body', array($descr, $descr2, $anchor, $approve, $delete)));
     $mail->sendAsHTML(GWF_STAFF_EMAILS);
 }