/** * Perform various section editing commands * */ function SectionEdit($cmd) { global $page, $langmessage; if (empty($_REQUEST['file'])) { message($langmessage['OOPS']); return false; } $page->ajaxReplace = array(); $file = gp_edit::CleanTitle($_REQUEST['file']); $data = gpOutput::ExtraContent($file, $file_stats); $page->file_sections = array($data); //hack so the SaveSection filter works $page->file_stats = $file_stats; if (!gp_edit::SectionEdit($cmd, $data, 0, '', $file_stats)) { return; } //save the new content $file_full = $this->folder . '/' . $file . '.php'; if (!gpFiles::SaveData($file_full, 'extra_content', $data)) { message($langmessage['OOPS']); $this->EditExtra(); return false; } $page->ajaxReplace[] = array('ck_saved', '', ''); message($langmessage['SAVED']); $this->areas[$file] = $file; $this->EditExtra(); return true; }
/** * Perform various section editing commands * */ function SectionEdit($cmd) { global $page, $langmessage; $section_num = $_REQUEST['section']; if (!is_numeric($section_num) || !isset($this->file_sections[$section_num])) { echo 'false;'; return false; } $page->ajaxReplace = array(); $check_before = serialize($this); $check_before = sha1($check_before) . md5($check_before); if (!gp_edit::SectionEdit($cmd, $this->file_sections[$section_num], $section_num, $this->title, $this->file_stats)) { return; } //save if the file was changed $check_after = serialize($this); $check_after = sha1($check_after) . md5($check_after); if ($check_before != $check_after && !$this->SaveThis()) { message($langmessage['OOPS'] . '(3)'); return false; } $page->ajaxReplace[] = array('ck_saved', '', ''); message($langmessage['SAVED']); //update gallery information switch ($this->file_sections[$section_num]['type']) { case 'gallery': $this->GalleryEdited(); break; } return true; }