Пример #1
0
 function ValidateData()
 {
     $errors = parent::ValidateData();
     if ($errors === FALSE) {
         $errors = array();
     }
     $gCms = cmsms();
     $contentops =& $gCms->GetContentOperations();
     $page = $this->GetPropertyValue('page');
     if ($page == '-1') {
         $errors[] = lang('nofieldgiven', array(lang('page')));
         $result = false;
     } else {
         $destobj =& $contentops->LoadContentFromID($page);
         if (!is_object($destobj)) {
             $errors[] = lang('destinationnotfound');
             $result = false;
         } else {
             if ($destobj->Type() == 'pagelink') {
                 $errors[] = lang('pagelink_circular');
                 $result = false;
             } else {
                 if ($destobj->Alias() == $this->mAlias) {
                     $errors[] = lang('pagelink_circular');
                     $result = false;
                 }
             }
         }
     }
     return count($errors) > 0 ? $errors : FALSE;
 }
Пример #2
0
 function ValidateData()
 {
     $errors = parent::ValidateData();
     if ($errors === FALSE) {
         $errors = array();
     }
     if ($this->GetPropertyValue('url') == '') {
         $errors[] = lang('nofieldgiven', array(lang('url')));
         $result = false;
     }
     return count($errors) > 0 ? $errors : FALSE;
 }
Пример #3
0
 function ValidateData()
 {
     $res = parent::ValidateData();
     if (is_array($res) && $this->mId < 1) {
         // some error occurred..
         // reset the menu text
         // and the alias
         $this->mName = '';
         $this->mMenuText = '';
     }
     $this->mTemplateId = -1;
     return $res;
 }
Пример #4
0
 function ValidateData()
 {
     $this->mName = CMS_CONTENT_HIDDEN_NAME;
     return parent::ValidateData();
 }
Пример #5
0
 /**
  * Validate the user's entries in the content add/edit form
  *
  * @return mixed either an array of validation error strings, or false to indicate no errors
  */
 function ValidateData()
 {
     $errors = parent::ValidateData();
     $gCms = cmsms();
     if ($errors === FALSE) {
         $errors = array();
     }
     if ($this->mTemplateId <= 0) {
         $errors[] = lang('nofieldgiven', array(lang('template')));
         $result = false;
     }
     if ($this->GetPropertyValue('content_en') == '') {
         $errors[] = lang('nofieldgiven', array(lang('content')));
         $result = false;
     }
     $res = $this->parse_content_blocks();
     if ($res === FALSE) {
         $errors[] = lang('error_parsing_content_blocks');
         $result = false;
     }
     $have_content_en = FALSE;
     foreach ($this->_contentBlocks as $blockName => $blockInfo) {
         if ($blockInfo['id'] == 'content_en') {
             $have_content_en = TRUE;
         }
         if (isset($blockInfo['type']) && $blockInfo['type'] == 'module') {
             $module = cms_utils::get_module($blockInfo['module']);
             if (!is_object($module)) {
                 continue;
             }
             if (!$module->HasCapability('contentblocks')) {
                 continue;
             }
             $value = $this->GetPropertyValue($blockInfo['id']);
             $tmp = $module->ValidateContentBlockValue($blockName, $value, $blockInfo['params']);
             if (!empty($tmp)) {
                 $errors[] = $tmp;
                 $result = false;
             }
         }
     }
     if (!$have_content_en) {
         $errors[] = lang('error_no_default_content_block');
         $result = false;
     }
     return count($errors) > 0 ? $errors : FALSE;
 }