Exemplo n.º 1
0
 public function execute()
 {
     # Permissions
     if (false === ($gb = GWF_Guestbook::getByID(Common::getGet('gbid')))) {
         return $this->module->error('err_gb');
     }
     if (false === $gb->canModerate(GWF_Session::getUser())) {
         return GWF_HTML::err('ERR_NO_PERMISSION');
     }
     # Toggle Moderation Flag
     if (false !== ($state = Common::getGet('set_moderation'))) {
         return $this->onSetModeration($gb, Common::getGet('gbmid', 0), $state > 0);
     }
     # Toggle Public Flag
     if (false !== ($state = Common::getGet('set_public'))) {
         return $this->onSetPublic($gb, Common::getGet('gbmid', 0), $state > 0);
     }
     # Edit Guestbook
     if (false !== Common::getPost('edit')) {
         return $this->onEdit($gb) . $this->templateEditGB($gb);
     }
     # Edit Single Entry
     if (false !== Common::getPost('edit_entry')) {
         return $this->onEditEntry($gb, Common::getGet('gbmid', 0), false);
     }
     if (false !== Common::getPost('del_entry')) {
         return $this->onEditEntry($gb, Common::getGet('gbmid', 0), true);
     }
     if (false !== Common::getGet('edit_entry')) {
         return $this->templateEditEntry($gb, Common::getGet('gbmid', 0));
     }
     return $this->templateEditGB($gb);
 }
Exemplo n.º 2
0
 public function execute()
 {
     if (false === ($gb = GWF_Guestbook::getByID(Common::getGet('gbid')))) {
         return $this->module->error('err_gb');
     }
     if (!$gb->canSign(GWF_Session::getUser(), $this->module->cfgAllowGuest())) {
         return GWF_HTML::err('ERR_NO_PERMISSION');
     }
     # In Reply To
     if (false !== ($msgid = Common::getGet('msgid'))) {
         if (false === ($gbe = GWF_GuestbookMSG::getByID($msgid))) {
             return GWF_HTML::err('ERR_DATABASE', array(__FILE__, __LINE__));
         }
         if ($gbe->getVar('gbm_gbid') !== $gb->getID()) {
             return GWF_HTML::err('ERR_NO_PERMISSION');
         }
         if (false !== Common::getPost('sign')) {
             return $this->onSign($gb, $gbe);
         }
         return $this->templateReply($gb, $gbe);
     }
     if (false !== Common::getPost('sign')) {
         return $this->onSign($gb);
     }
     return $this->templateSign($gb);
 }
Exemplo n.º 3
0
 public function execute()
 {
     if (false === ($gb = GWF_Guestbook::getByID(Common::getGet('gb')))) {
         return $this->module->error('err_gb');
     }
     if (false === $gb->canModerate(GWF_Session::getUser())) {
         return GWF_HTML::err('ERR_NO_PERMISSION');
     }
     return $this->templateModerate();
 }
Exemplo n.º 4
0
 private static function onInstallDefaultGB(Module_Guestbook $module, $dropTable)
 {
     if (false !== ($gb = GWF_Guestbook::getByID(1))) {
         return '';
     }
     $gb = new GWF_Guestbook(array('gb_id' => 1, 'gb_uid' => 0, 'gb_title' => $module->lang('default_title'), 'gb_descr' => $module->lang('default_descr'), 'gb_date' => GWF_Time::getDate(GWF_Date::LEN_SECOND), 'gb_options' => GWF_Guestbook::DEFAULT_OPTIONS));
     if (false === $gb->insert()) {
         return GWF_HTML::err('ERR_DATABASE', array(__FILE__, __LINE__));
     }
     return '';
 }
Exemplo n.º 5
0
 public function execute()
 {
     # Get GB
     if (false === ($gb = GWF_Guestbook::getByID(Common::getGet('gbid')))) {
         return $this->module->error('err_gb');
     }
     # SEO
     GWF_Website::setPageTitle($gb->displayTitle());
     GWF_Website::setMetaTags($gb->displayDescr());
     # Permission
     if (!$gb->canView(GWF_Session::getUser())) {
         return GWF_HTML::err('ERR_NO_PERMISSION');
     }
     return $this->templateShow($gb);
 }
Exemplo n.º 6
0
 public function execute()
 {
     if (false === ($gb = GWF_Guestbook::getByID(Common::getGetString('gbid')))) {
         return $this->module->error('err_gb');
     }
     if (false === ($gbm = GWF_GuestbookMSG::getByID(Common::getGetString('gbmid')))) {
         return $this->module->error('err_gbm');
     }
     if ($gbm->getHashcode() !== Common::getGetString('gbmtoken')) {
         return GWF_HTML::err('ERR_NO_PERMISSION');
     }
     if (isset($_GET['set_moderation'])) {
         return $this->toggleModeration($gb, $gbm, Common::getGetString('set_moderation'));
     }
     return GWF_HTML::err('ERR_GENERAL', array(__FILE__, __LINE__));
 }