/** * Create a new extra content section * */ public function NewSection() { global $langmessage, $gpAdmin; $title = \gp\tool\Editing::CleanTitle($_REQUEST['new_title']); if (empty($title)) { message($langmessage['OOPS'] . ' (Invalid Title)'); return false; } $file = $this->folder . '/' . $title . '/page.php'; $section = \gp\tool\Editing::DefaultContent($_POST['type']); $section['created'] = time(); $section['created_by'] = $gpAdmin['username']; $sections = array($section); if (!\gp\tool\Files::SaveData($file, 'file_sections', $sections)) { message($langmessage['OOPS'] . ' (Not Saved)'); return false; } message($langmessage['SAVED']); $this->areas[$title] = $title; }
/** * @deprecated 3.0 * Use \gp\tool\Editing::CleanTitle() instead * Used by Simple_Blog1 */ public static function CleanTitle($title, $spaces = '_') { trigger_error('Deprecated Function'); return \gp\tool\Editing::CleanTitle($title, $spaces); }
/** * Check the posted name of a menu * */ public function AltMenu_NewName() { global $langmessage; $menu_name = \gp\tool\Editing::CleanTitle($_POST['menu_name'], ' '); if (empty($menu_name)) { msg($langmessage['OOPS'] . ' (Empty Name)'); return false; } if (array_search($menu_name, $this->avail_menus) !== false) { msg($langmessage['OOPS'] . ' (Name Exists)'); return false; } return $menu_name; }
/** * Return the name of the cleansed extra area name, create file if it doesn't already exist * */ public function NewExtraArea() { global $langmessage, $dataDir; $title = \gp\tool\Editing::CleanTitle($_REQUEST['extra_area']); if (empty($title)) { message($langmessage['OOPS']); return false; } $data = \gp\tool\Editing::DefaultContent($_POST['type']); $file = $dataDir . '/data/_extra/' . $title . '.php'; if (\gp\tool\Files::Exists($file)) { return $title; } if (!\gp\tool\Files::SaveData($file, 'extra_content', $data)) { message($langmessage['OOPS']); return false; } return $title; }