Example #1
0
 public function execute()
 {
     if (false === ($this->user = GWF_Session::getUser())) {
         return GWF_HTML::err('ERR_LOGIN_REQUIRED');
     }
     $this->module->includeClass('WC_Warbox');
     $this->module->includeClass('WC_Warflag');
     $this->module->includeClass('WC_SiteAdmin');
     $this->module->includeClass('WC_SiteCats');
     $this->module->includeClass('sites/warbox/WCSite_WARBOX');
     if (false === ($this->warbox = WC_Warbox::getByID(Common::getGetString('wbid')))) {
         return WC_HTML::error('err_warbox');
     }
     if (!$this->warbox->hasEditPermission($this->user)) {
         return GWF_HTML::err('ERR_NO_PERMISSION');
     }
     if (isset($_GET['edit'])) {
         if (false === ($this->flag = WC_Warflag::getByID(Common::getGetString('edit')))) {
             return GWF_HTML::err('ERR_DATABASE', array(__FILE__, __LINE__));
         }
         if (isset($_POST['edit'])) {
             return $this->onEdit();
         } else {
             return $this->templateEdit();
         }
     }
     if (isset($_POST['add'])) {
         return $this->onAdd();
     }
     if (isset($_GET['add'])) {
         return $this->templateAdd();
     }
     if (isset($_POST['import'])) {
         return $this->onCSVImport();
     }
     if (isset($_GET['export'])) {
         return $this->onCSVExport();
     }
     if (isset($_GET['up'])) {
         return $this->onUp() . $this->templateOverview();
     } elseif (isset($_GET['down'])) {
         return $this->onDown() . $this->templateOverview();
     }
     return $this->templateOverview();
 }