예제 #1
0
파일: Moderate.php 프로젝트: sinfocol/gwf3
 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);
 }
예제 #2
0
파일: Sign.php 프로젝트: sinfocol/gwf3
 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);
 }
예제 #3
0
파일: EditGB.php 프로젝트: sinfocol/gwf3
 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();
 }
예제 #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 '';
 }
예제 #5
0
파일: Show.php 프로젝트: sinfocol/gwf3
 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);
 }
예제 #6
0
파일: Unlock.php 프로젝트: sinfocol/gwf3
 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__));
 }