Beispiel #1
0
 public static function wizard_message($key, $param = NULL)
 {
     return GWF_Error::message(self::$gwfil->lang('wizard'), self::$gwfil->lang($key, $param), false, true) . PHP_EOL;
 }
Beispiel #2
0
 private function onEdit()
 {
     $form = $this->formEdit();
     if (false !== ($error = $form->validate($this->module))) {
         return $error;
     }
     $page = $this->page;
     $gstring = $this->buildGroupString();
     $tags = ',' . trim(trim($form->getVar('tags')), ',') . ',';
     $data = array();
     if ($page->getVar('page_url') !== ($url = $form->getVar('url'))) {
         $data['page_url'] = $url;
     }
     if ($page->getVar('page_title') !== ($title = $form->getVar('title'))) {
         $data['page_title'] = $title;
     }
     if ($page->getVar('page_meta_tags') !== $tags) {
         $data['page_meta_tags'] = $tags;
     }
     if ($page->getVar('page_meta_desc') !== ($descr = $form->getVar('descr'))) {
         $data['page_meta_desc'] = $descr;
     }
     if ($page->getVar('page_content') !== ($content = $form->getVar('content'))) {
         $data['page_content'] = $content;
     }
     if ($this->is_author) {
         if ($page->getVar('page_inline_css') !== ($css = $form->getVar('inline_css'))) {
             $data['page_inline_css'] = $css;
         }
     }
     $content_changed = count($data) > 0;
     if ($content_changed) {
         $time = time();
         $data['page_time'] = $time;
         $data['page_date'] = GWF_Time::getDate(GWF_Time::LEN_SECOND, $time);
         if (false === $page->saveVars($data)) {
             return GWF_HTML::err('ERR_DATABASE', array(__FILE__, __LINE__));
         }
     }
     if (isset($_POST['home_page']) && $this->is_author) {
         $this->module->setHomePage($page->getOtherID());
     }
     if ($this->is_author) {
         if (false === $this->setAuthorOptions($page)) {
             return GWF_HTML::err('ERR_DATABASE', array(__FILE__, __LINE__));
         }
     }
     if ($this->is_oowner) {
         if (false === $this->setRootOptions($page, $gstring)) {
             return GWF_HTML::err('ERR_DATABASE', array(__FILE__, __LINE__));
         }
         if ($gstring !== $page->getVar('page_groups')) {
             if (false === GWF_PageGID::updateGIDs($page, $gstring)) {
                 return GWF_HTML::err('ERR_DATABASE', array(__FILE__, __LINE__));
             }
         }
     }
     if ($this->is_owner) {
         if (false === $this->setOwnerOptions($page)) {
             return GWF_HTML::err('ERR_DATABASE', array(__FILE__, __LINE__));
         }
     }
     if (false === GWF_PageTags::updateTags($page, $tags, $page->getVar('page_lang'))) {
         return GWF_HTML::err('ERR_DATABASE', array(__FILE__, __LINE__));
     }
     if (false === $this->module->writeHTA()) {
         return GWF_HTML::err('ERR_GENERAL', array(__FILE__, __LINE__));
     }
     # No content change
     if (!$content_changed) {
         return $this->module->message('msg_edited', array(GWF_WEB_ROOT . $page->display('page_url'), $page->display('page_title')));
     }
     # Content changed!
     echo GWF_Error::message('PageBuilder', 'Content changed!');
     # If author mode we directly push
     if ($this->is_author) {
         if (false === GWF_PageHistory::push($page)) {
             return GWF_HTML::err('ERR_DATABASE', array(__FILE__, __LINE__));
         }
         return $this->module->message('msg_edited', array(GWF_WEB_ROOT . $page->getVar('page_url'), $page->getVar('page_title')));
     }
     # Else we gonna send moderation mails
     if (false === $page->saveOption(GWF_Page::LOCKED, true)) {
         return GWF_HTML::err('ERR_DATABASE', array(__FILE__, __LINE__));
     }
     $this->module->sendModMails($page);
     return $this->module->message('msg_edit_locked');
 }