function SaveAddonData() { $addonData = array(); while (count($this->addonHistory) > 30) { array_shift($this->addonHistory); } $addonData['history'] = $this->addonHistory; $addonData['reviews'] = $this->addonReviews; return gpFiles::SaveArray($this->dataFile, 'addonData', $addonData); }
private function saveSettings() { global $langmessage; $this->updateSetting('wysiwygDelay'); $this->updateBooleanSetting('wysiwygEnabled'); $this->updateBooleanSetting('markupEscaped'); $this->updateBooleanSetting('breaksEnabled'); $this->updateBooleanSetting('urlsLinked'); if (gpFiles::SaveArray($this->conf, 'settings', $this->settings)) { message($langmessage['SAVED']); return; } message($langmessage['OOPS']); $this->settings = $_POST; }
function SaveConfig() { global $langmessage; $format = htmlspecialchars($_POST['date_format']); if (@date($format)) { $this->config['date_format'] = $format; } $this->config['commenter_website'] = (string) $_POST['commenter_website']; if (isset($_POST['comment_captcha'])) { $this->config['comment_captcha'] = true; } else { $this->config['comment_captcha'] = false; } if (!gpFiles::SaveArray($this->config_file, 'config', $this->config)) { message($langmessage['OOPS']); return false; } message($langmessage['SAVED']); return true; }
/** * Update the gp_index, gp_titles and menus so that special pages can be renamed * */ function Upgrade_234() { global $gp_index, $gp_titles, $gp_menu, $config, $dataDir; includeFile('tool/gpOutput.php'); $special_indexes = array(); $new_index = array(); $new_titles = array(); foreach ($gp_index as $title => $index) { $info = $gp_titles[$index]; $type = common::SpecialOrAdmin($title); if ($type == 'special') { $special_indexes[$index] = strtolower($title); $index = strtolower($title); $info['type'] = 'special'; //some older versions didn't maintain this value well } $new_index[$title] = $index; $new_titles[$index] = $info; } $gp_titles = $new_titles; $gp_index = $new_index; //update gp_menu $gp_menu = $this->FixMenu($gp_menu, $special_indexes); //save pages if (!admin_tools::SavePagesPHP()) { return; } $config['gpversion'] = '2.3.4'; admin_tools::SaveConfig(); //update alt menus if (isset($config['menus']) && is_array($config['menus'])) { foreach ($config['menus'] as $key => $value) { $menu_file = $dataDir . '/data/_menus/' . $key . '.php'; if (file_exists($menu_file)) { $menu = gpOutput::GetMenuArray($key); $menu = $this->FixMenu($menu, $special_indexes); gpFiles::SaveArray($menu_file, 'menu', $menu); } } } }
function AddRedirect($source, $target) { global $dataDir; $error_data = array(); $datafile = $dataDir . '/data/_site/error_data.php'; if (file_exists($datafile)) { require $datafile; } $changed = false; //remove redirects from the $target if (isset($error_data['redirects'][$target])) { unset($error_data['redirects'][$target]); $changed = true; } //redirect already exists for $source if (!isset($error_data['redirects'][$source])) { $error_data['redirects'][$source]['target'] = $target; $error_data['redirects'][$source]['code'] = '301'; $changed = true; } if ($changed) { gpFiles::SaveArray($datafile, 'error_data', $error_data); } }
/** * Save the current configuration * If successful, reset the lists and titles variables */ function SaveConfig() { if (!gpFiles::SaveArray($this->config_file, 'config', $this->config)) { return false; } $this->lists = $this->config['lists']; $this->titles = $this->config['titles']; if (count($this->config['langs'])) { $this->langs = $this->config['langs']; } return true; }
/** * Connect to ftp server using either Post or saved values * Connection values will not be kept in $config in case they're being used for a system revert which will replace the config.php file * Also handle moving ftp connection values from $config to a sep * * @return bool true if connected, error message otherwise */ function connect() { global $config, $dataDir, $langmessage; $save_values = false; $args = false; //get connection values $connect_args = array(); $connection_file = $dataDir . '/data/_updates/connect.php'; if (file_exists($connection_file)) { include $connection_file; } if (!isset($connection_file['ftp_user']) && isset($config['ftp_user'])) { $connect_args['ftp_user'] = $config['ftp_user']; $connect_args['ftp_server'] = $config['ftp_server']; $connect_args['ftp_pass'] = $config['ftp_pass']; $connect_args['ftp_root'] = $config['ftp_root']; $save_values = true; } if (isset($_POST['ftp_pass'])) { $connect_args = $_POST; $save_values = true; } $connect_args = $this->get_connect_vars($connect_args); $connected = $this->connect_handler($connect_args); if ($connected !== true) { return $connected; } //get the ftp_root if (empty($connect_args['ftp_root']) || $save_values) { $this->ftp_root = $this->get_base_dir(); if (!$this->ftp_root) { return $langmessage['couldnt_connect'] . ' (Couldn\'t find root)'; } $connect_args['ftp_root'] = $this->ftp_root; $save_values = true; } else { $this->ftp_root = $connect_args['ftp_root']; } //save ftp info if (!$save_values) { return $connected; } if (!gpFiles::SaveArray($connection_file, 'connect_args', $connect_args)) { return $connected; } /* * Remove from $config if it's not a safe mode installation */ if (!isset($config['useftp']) && isset($config['ftp_user'])) { unset($config['ftp_user']); unset($config['ftp_server']); unset($config['ftp_pass']); unset($config['ftp_root']); admin_tools::SaveConfig(); } return $connected; }
/** * Delete a blog post * @return bool * */ public static function Delete() { global $langmessage; $post_id = $_POST['del_id']; $posts = false; //post in single file or collection $post_file = self::PostFilePath($post_id); if (!file_exists($post_file)) { $posts = self::GetPostFile($post_id, $post_file); if ($posts === false) { message($langmessage['OOPS']); return false; } if (!isset($posts[$post_id])) { message($langmessage['OOPS']); return false; } unset($posts[$post_id]); //don't use array_splice here because it will reset the numeric keys } //now delete post also from categories: self::DeletePostFromCategories($post_id); //reset the index string $new_index = SimpleBlogCommon::$data['str_index']; $new_index = preg_replace('#"\\d+>' . $post_id . '"#', '"', $new_index); preg_match_all('#(?:"\\d+>)([^">]*)#', $new_index, $matches); SimpleBlogCommon::$data['str_index'] = SimpleBlogCommon::AStrFromArray($matches[1]); //remove post from other index strings SimpleBlogCommon::AStrRm('drafts', $post_id); SimpleBlogCommon::AStrRm('comments_closed', $post_id); SimpleBlogCommon::AStrRm('titles', $post_id); SimpleBlogCommon::AStrRm('post_times', $post_id); if (!SimpleBlogCommon::SaveIndex()) { message($langmessage['OOPS']); return false; } //save data file or remove the file if ($posts) { if (!gpFiles::SaveArray($post_file, 'posts', $posts)) { message($langmessage['OOPS']); return false; } } elseif (!unlink($post_file)) { message($langmessage['OOPS']); return false; } //delete the comments $commentDataFile = self::$data_dir . '/comments/' . $post_id . '.txt'; if (file_exists($commentDataFile)) { unlink($commentDataFile); SimpleBlogCommon::ClearCommentCache(); } SimpleBlogCommon::GenStaticContent(); message($langmessage['file_deleted']); return true; }
function SaveData() { global $langmessage, $addonPathData; if (!isset($_REQUEST['index'])) { return $langmessage['OOPS'] . ' - nothing to save!'; } $index = $_REQUEST['index']; $configFile = $addonPathData . '/ec_pagedata.php'; $pagedata = self::LoadData(); if ($_REQUEST) { if (array_key_exists("datafilter", $_REQUEST)) { $_REQUEST["datafilter"] = array_diff($_REQUEST["datafilter"], array('')); $pagedata[$index]['datafilter'] = implode(",", $_REQUEST["datafilter"]); } else { $pagedata[$index]['datafilter'] = ""; } } $pagedata[$index]['image_url'] = urlencode($_REQUEST['custom_img']); //save added opts $temp = new Catalog_Easy(); $temp->getConfig(); if (isset($temp->addon_name) and $temp->addon_name != "") { foreach ($temp->addon_name as $name) { $name = str_replace(' ', '_', $name); if (array_key_exists($name, $_REQUEST)) { $pagedata[$index][$name] = $_REQUEST[$name]; } } } if (gpFiles::SaveArray($configFile, 'pagedata', $pagedata)) { return $langmessage['SAVED']; } else { return $langmessage['OOPS']; } }
/** * Save the current configuration * If successful, reset the lists and titles variables */ public function SaveConfig($refresh_msg = false) { global $langmessage; if (!gpFiles::SaveArray($this->config_file, 'config', $this->config)) { message($langmessage['OOPS']); return false; } $this->lists = $this->config['lists']; $this->titles = $this->config['titles']; if (count($this->config['langs'])) { $this->langs = $this->config['langs']; } if ($refresh_msg) { message($langmessage['SAVED'] . ' ' . $langmessage['REFRESH']); } else { message($langmessage['SAVED']); } return true; }
function SendPassword() { global $langmessage, $dataDir, $gp_mailer; includeFile('tool/email_mailer.php'); include $dataDir . '/data/_site/users.php'; $username = $_POST['username']; if (!isset($users[$username])) { message($langmessage['OOPS']); return false; } $userinfo = $users[$username]; if (empty($userinfo['email'])) { message($langmessage['no_email_provided']); return false; } $passwordChars = str_repeat('abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ', 3); $newpass = str_shuffle($passwordChars); $newpass = substr($newpass, 0, 8); $users[$username]['newpass'] = common::hash(trim($newpass)); if (!gpFiles::SaveArray($dataDir . '/data/_site/users.php', 'users', $users)) { message($langmessage['OOPS']); return false; } if (isset($_SERVER['HTTP_HOST'])) { $server = $_SERVER['HTTP_HOST']; } else { $server = $_SERVER['SERVER_NAME']; } $link = common::AbsoluteLink('Admin_Main', $langmessage['login']); $message = sprintf($langmessage['passwordremindertext'], $server, $link, $username, $newpass); if ($gp_mailer->SendEmail($userinfo['email'], $langmessage['new_password'], $message)) { list($namepart, $sitepart) = explode('@', $userinfo['email']); $showemail = substr($namepart, 0, 3) . '...@' . $sitepart; message(sprintf($langmessage['password_sent'], $username, $showemail)); return true; } message($langmessage['OOPS'] . ' (Email not sent)'); return false; }
/** * Perform regular tasks * Once an hour only when admin is logged in * */ function Cron() { global $dataDir; $file_stats = $cron_info = array(); $time_file = $dataDir . '/data/_site/cron_info.php'; if (file_exists($time_file)) { require $time_file; } $file_stats += array('modified' => 0); if (time() - $file_stats['modified'] < 3600) { return; } gpsession::CleanTemp(); gpFiles::SaveArray($time_file, 'cron_info', $cron_info); }
function SaveThis() { if (!is_array($this->meta_data) || !is_array($this->file_sections)) { return false; } //file count if (!isset($this->meta_data['file_number'])) { $this->meta_data['file_number'] = gpFiles::NewFileNumber(); } return gpFiles::SaveArray($this->file, 'meta_data', $this->meta_data, 'file_sections', $this->file_sections); }
function SaveSiteData() { $check = $this->CheckSum($this->siteData); if ($check === $this->checksum) { return true; } unset($this->siteData['destination']); //no longer used unset($this->siteData['useftp']); //no longer used return gpFiles::SaveArray($this->dataFile, 'siteData', $this->siteData); }
/** * Save the content for a new page in /data/_pages/<title> * @since 1.8a1 * */ function NewTitle($title, $section_content = false, $type = 'text') { if (empty($title)) { return false; } $file = gpFiles::PageFile($title); if (!$file) { return false; } $file_sections = array(); $file_sections[0] = array('type' => $type, 'content' => $section_content); $meta_data = array('file_number' => gpFiles::NewFileNumber(), 'file_type' => $type); return gpFiles::SaveArray($file, 'meta_data', $meta_data, 'file_sections', $file_sections); }
function SaveDataStatic(&$update_data) { global $dataDir; $file = $dataDir . '/data/_updates/updates.php'; gpFiles::SaveArray($file, 'update_data', $update_data); }
/** * Save an inline edit * */ function SaveInline() { global $page, $langmessage; $page->ajaxReplace = array(); $post_index = $this->post_id; $posts = $this->GetPostFile($post_index, $post_file); if ($posts === false) { message($langmessage['OOPS']); return; } $content =& $_POST['gpcontent']; gpFiles::cleanText($content); $posts[$post_index]['content'] = $content; //save to data file if (!gpFiles::SaveArray($post_file, 'posts', $posts)) { message($langmessage['OOPS']); return false; } $page->ajaxReplace[] = array('ck_saved', '', ''); message($langmessage['SAVED']); return true; }
function SaveCSSData() { if (!$this->css_data_changed) { return; } gpFiles::SaveArray($this->css_data_file, 'css_data', $this->css_data); }
function SaveData() { return gpFiles::SaveArray($this->datafile, 'error_data', $this->error_data); }
/** * Save the gpEasy configuration * @return bool * */ function SaveConfig() { global $config, $dataDir; if (!is_array($config)) { return false; } if (!isset($config['gpuniq'])) { $config['gpuniq'] = common::RandomString(20); } return gpFiles::SaveArray($dataDir . '/data/_site/config.php', 'config', $config); }
function SaveUserFile($refresh = true) { global $langmessage, $dataDir; if (!gpFiles::SaveArray($dataDir . '/data/_site/users.php', 'users', $this->users)) { message($langmessage['OOPS']); return false; } if ($refresh && isset($_GET['gpreq']) && $_GET['gpreq'] == 'json') { message($langmessage['SAVED'] . ' ' . $langmessage['REFRESH']); } else { message($langmessage['SAVED']); } return true; }
function Install_DataFiles_New($destination = false, $config, $base_install = true) { global $langmessage; if ($destination === false) { $destination = $GLOBALS['dataDir']; } //set config variables //$config = array(); //because of ftp values $gpLayouts = array(); $gpLayouts['default']['theme'] = 'Light_Texture/Blue'; $gpLayouts['default']['color'] = '#93c47d'; $gpLayouts['default']['label'] = $langmessage['default']; $config['toemail'] = $_POST['email']; $config['gpLayout'] = 'default'; $config['title'] = Install_Tools::Install_Title(); $config['keywords'] = 'gpEasy CMS, Easy CMS, Content Management, PHP, Free CMS, Website builder, Open Source'; $config['desc'] = 'A new gpEasy CMS installation. You can change your site\'s description in the configuration.'; $config['timeoffset'] = '0'; $config['langeditor'] = 'inherit'; $config['dateformat'] = '%m/%d/%y - %I:%M %p'; $config['gpversion'] = $GLOBALS['gpversion']; $config['shahash'] = function_exists('sha1'); if (!isset($config['gpuniq'])) { $config['gpuniq'] = common::RandomString(20); } $config['combinecss'] = Install_Tools::BooleanValue('combinecss', true); $config['combinejs'] = Install_Tools::BooleanValue('combinejs', true); $config['etag_headers'] = Install_Tools::BooleanValue('etag_headers', true); //directories gpFiles::CheckDir($destination . '/data/_uploaded/image'); gpFiles::CheckDir($destination . '/data/_uploaded/media'); gpFiles::CheckDir($destination . '/data/_uploaded/file'); gpFiles::CheckDir($destination . '/data/_uploaded/flash'); gpFiles::CheckDir($destination . '/data/_sessions'); $content = '<h2>Welcome!</h2> <p>Welcome to your new gpEasy powered website. Now that gpEasy is installed, you can start editing the content and customising your site.</p> <h3>Getting Started</h3> <p>You are currently viewing the default home page of your website. Here\'s a quick description of how to edit this page.</p> <ol> <li>First make sure you're ' . Install_Tools::Install_Link_Content('Admin_Main', 'logged in', 'file=Home') . '.</li> <li>Then, to edit this page, click the "Edit" link that appears when you move your mouse over the content.</li> <li>Make your edits, click "Save" and you're done!</li> </ol> <h3>More Options</h3> <ul> <li>Adding, renaming, deleting and organising your pages can all be done in the ' . Install_Tools::Install_Link_Content('Admin_Menu', 'Page Manager') . '.</li> <li>Choose from a ' . Install_Tools::Install_Link_Content('Admin_Theme_Content', 'variety of themes') . ' to give your site a custom look.</li> <li>Then, you can ' . Install_Tools::Install_Link_Content('Admin_Theme_Content', 'add, remove and rearrange', 'cmd=editlayout') . ' the content of your site without editing the html.</li> <li>Take a look at the Administrator Toolbar to access all the features of gpEasy.</li> </ul> <h3>Online Resources</h3> <p>gpEasy.com has a number of resources to help you do even more with gpEasy.</p> <ul> <li>Find more community developed <a href="http://gpeasy.com/Special_Addon_Themes" title="gpEasy CMS Themes">themes</a> and <a href="http://gpeasy.com/Special_Addon_Plugins" title="gpEasy CMS Plugin">plugins</a> to enhance your site.</li> <li>Get help in the <a href="http://gpeasy.com/Special_Forum" title="gpEasy CMS Forum">gpEasy forum</a>.</li> <li>Show off your <a href="http://gpeasy.com/Special_Powered_by" title="Sites Using gpEasy CMS">gpEasy powered site</a> or list your <a href="http://gpeasy.com/Special_Service_Provider" title="Businesses Using gpEasy CMS">gpEasy related business</a>.</li> </ul>'; gpFiles::NewTitle('Home', $content); gpFiles::NewTitle('Help_Videos', "<h1>Help Videos</h1>\n\t\t<p>Video tutorials are often a fast and easy way to learn new things quickly.\n\t\tSo far, we only have one in Deutsch (German) made by <a href=\"http://gpeasy.com/Special_Service_Provider?id=57\" title=\"IT Ricther on gpEasy.com\">IT Richter</a>.\n\t\tIf you make a video tutorial for gpEasy, <a href=\"http://gpeasy.com/Contact\">let us know</a>, and we'll make sure it's included in our list.\n\t\t</p>\n\t\t<p>And as always, to edit this page, just click the \"Edit\" button while logged in.</p>\n\t\t<h2>Deutsch</h2>\n\t\t<p><iframe width=\"560\" height=\"315\" src=\"http://www.youtube.com/embed/04cNgR1EiFY\" frameborder=\"0\" allowfullscreen></iframe></p>\n\t\t"); gpFiles::NewTitle('Child_Page', '<h1>A Child Page</h1><p>This was created as a subpage of your <em>Help Videos</em> . You can easily change the arrangement of all your pages using the ' . Install_Tools::Install_Link_Content('Admin_Menu', 'Page Manager') . '.</p>'); gpFiles::NewTitle('About', '<h1>About gpEasy CMS</h1><p><a href="http://gpEasy.com" title="gpEasy.com">gp|Easy</a> is a complete Content Management System (CMS) that can help you create rich and flexible web sites with a simple and easy to use interface.</p> <h2>gpEasy CMS How To</h2> <p>Learn how to <a href="http://docs.gpeasy.com/Main/Admin" title="gpEasy File Management">manage your files</a>, <a href="http://docs.gpeasy.com/Main/Creating%20Galleries" title="Creating Galleries in gpEasy CMS">create galleries</a> and more in the <a href="http://docs.gpeasy.org/index.php/" title="gpEasy CMS Documentation">gpEasy Documentation</a>. </p> <h2>gpEasy CMS Features</h2> <ul> <li>True WYSIWYG (Using CKEditor)</li> <li>Galleries (Using ColorBox)</li> <li>SEO Friendly Links</li> <li>Free and Open Source (GPL)</li> <li>Runs on PHP</li> <li>File Upload Manager</li> <li>Drag \'n Drop Theme Content</li> <li>Deleted File Trash Can</li> <li>Multiple User Administration</li> <li>Flat File Storage</li> <li>Fast Page Loading</li> <li>Fast and Easy Installation</li> <li>reCaptcha for Contact Form</li> <li>HTML Tidy (when available)</li> </ul> <h2>If You Like gpEasy...</h2> <p>If you like gpEasy, then you might also like:</p> <ul> <li><a href="http://phpeasymin.com" title="Minimize JavaScript and CSS files easily">phpEasyMin.com</a> - Minimize multiple JavaScript and CSS files in one sweep.</li> </ul>'); //Side_Menu $file = $destination . '/data/_extra/Side_Menu.php'; $content = '<h3>Join the gpEasy Community</h3> <p>Visit gpEasy.com to access the many <a href="http://gpeasy.com/Special_Resources" title="gpEasy Community Resources">available resources</a> to help you get the most out of our CMS.</p> <ul> <li><a href="http://gpeasy.com/Special_Addon_Themes" title="gpEasy CMS Themes">Download Themes</a></li> <li><a href="http://gpeasy.com/Special_Addon_Plugins" title="gpEasy CMS Plugin">Download Plugins</a></li> <li><a href="http://gpeasy.com/Special_Forum" title="gpEasy CMS Forum">Get Help in the Forum</a></li> <li><a href="http://gpeasy.com/Special_Powered_by" title="Sites using gpEasy CMS">Show off Your Site</a></li> <li><a href="http://gpeasy.com/Special_Resources" title="gpEasy Community Resources">And Much More...</a></li> </ul> <p class="sm">(Edit this content by clicking "Edit", it's that easy!)</p>'; gpFiles::SaveFile($file, $content); //Header $file = $destination . '/data/_extra/Header.php'; $contents = '<h1>' . Install_Tools::Install_Link('', $config['title']) . '</h1>'; $contents .= '<h4>' . 'The Fast and Easy CMS' . '</h4>'; gpFiles::SaveFile($file, $contents); //Footer $file = $destination . '/data/_extra/Footer.php'; $content = '<h3><a href="http://gpeasy.com/Our_CMS" title="Features of Our CMS">gpEasy CMS Features</a></h3> <p>Easy to use True WYSIWYG Editing.</p> <p>Flat-file data storage and advanced resource management for fast websites.</p> <p>Community driven development</p> <p><a href="http://gpeasy.com/Our_CMS" title="Features of Our CMS">And More...</a></p> <p>If you like gpEasy, then you might also like <a href="http://phpeasymin.com" title="Minimize JavaScript and CSS files easily">phpEasyMin.com</a></p> '; gpFiles::SaveFile($file, $content); //contact html $file = $destination . '/data/_extra/Contact.php'; gpFiles::SaveFile($file, '<h2>Contact Us</h2><p>Use the form below to contact us, and be sure to enter a valid email address if you want to hear back from us.</p>'); // gp_index $new_index = array(); $new_index['Home'] = 'a'; $new_index['Help_Videos'] = 'b'; $new_index['Child_Page'] = 'c'; $new_index['About'] = 'd'; $new_index['Contact'] = 'special_contact'; $new_index['Site_Map'] = 'special_site_map'; $new_index['Galleries'] = 'special_galleries'; $new_index['Missing'] = 'special_missing'; // gpmenu $new_menu = array(); $new_menu['a'] = array('level' => 0); $new_menu['b'] = array('level' => 0); $new_menu['c'] = array('level' => 1); $new_menu['d'] = array('level' => 0); $new_menu['special_contact'] = array('level' => 1); // links $new_titles = array(); $new_titles['a']['label'] = 'Home'; $new_titles['a']['type'] = 'text'; $new_titles['b']['label'] = 'Help Videos'; $new_titles['b']['type'] = 'text'; $new_titles['c']['label'] = 'Child Page'; $new_titles['c']['type'] = 'text'; $new_titles['d']['label'] = 'About'; $new_titles['d']['type'] = 'text'; $new_titles['special_contact']['lang_index'] = 'contact'; $new_titles['special_contact']['type'] = 'special'; $new_titles['special_site_map']['lang_index'] = 'site_map'; $new_titles['special_site_map']['type'] = 'special'; $new_titles['special_galleries']['lang_index'] = 'galleries'; $new_titles['special_galleries']['type'] = 'special'; $new_titles['special_missing']['label'] = 'Missing'; $new_titles['special_missing']['type'] = 'special'; $pages = array(); $pages['gp_index'] = $new_index; $pages['gp_menu'] = $new_menu; $pages['gp_titles'] = $new_titles; $pages['gpLayouts'] = $gpLayouts; echo '<li>'; if (!gpFiles::SaveArray($destination . '/data/_site/pages.php', 'pages', $pages)) { echo '<span class="failed">'; //echo 'Could not save pages.php'; echo sprintf($langmessage['COULD_NOT_SAVE'], 'pages.php'); echo '</span>'; echo '</li>'; return false; } echo '<span class="passed">'; //echo 'Pages.php saved.'; echo sprintf($langmessage['_SAVED'], 'pages.php'); echo '</span>'; echo '</li>'; //users echo '<li>'; $user_info = array(); $user_info['password'] = sha1(trim($_POST['password'])); $user_info['granted'] = 'all'; $user_info['editing'] = 'all'; $user_info['email'] = $_POST['email']; $users = array(); $username = $_POST['username']; //log user in here to finish user_info if ($base_install) { includeFile('tool/sessions.php'); define('gp_session_cookie', common::SessionCookie($config['gpuniq'])); gpsession::create($user_info, $username); } $users[$username] = $user_info; if (!gpFiles::SaveArray($destination . '/data/_site/users.php', 'users', $users)) { echo '<span class="failed">'; echo sprintf($langmessage['COULD_NOT_SAVE'], 'users.php'); echo '</span>'; echo '</li>'; return false; } echo '<span class="passed">'; echo sprintf($langmessage['_SAVED'], 'users.php'); echo '</span>'; echo '</li>'; //save config //not using SaveConfig() because $config is not global here echo '<li>'; if (!gpFiles::SaveArray($destination . '/data/_site/config.php', 'config', $config)) { echo '<span class="failed">'; echo sprintf($langmessage['COULD_NOT_SAVE'], 'config.php'); echo '</span>'; echo '</li>'; return false; } echo '<span class="passed">'; echo sprintf($langmessage['_SAVED'], 'config.php'); echo '</span>'; echo '</li>'; if ($base_install) { Install_Tools::InstallHtaccess($destination, $config); } return true; }
/** * Update an archive when a blog entry is edited -- called from SaveNew() and SaveEdit() * */ function update_post_in_archives($post_index, $array) { $this->load_blog_archives(); $ym = date('Ym', $array['time']); //year&month $this->archives[$ym][$post_index] = $array['title']; krsort($this->archives[$ym]); krsort($this->archives); gpFiles::SaveArray($this->archives_file, 'archives', $this->archives); //save archives }
/** * Get usage information about a image * */ function SaveUsage($index, $data) { global $dataDir; $data_file = $dataDir . '/data/_resized/' . $index . '/data.php'; return gpFiles::SaveArray($data_file, 'usage', $data); }
function AltMenu_Create() { global $config, $langmessage, $dataDir; $menu_name = $this->AltMenu_NewName(); if (!$menu_name) { return; } $new_menu = $this->AltMenu_New(); //get next index $index = 0; if (isset($config['menus']) && is_array($config['menus'])) { foreach ($config['menus'] as $id => $label) { $id = substr($id, 1); $index = max($index, $id); } } $index++; $id = 'm' . $index; $menu_file = $dataDir . '/data/_menus/' . $id . '.php'; if (!gpFiles::SaveArray($menu_file, 'menu', $new_menu)) { message($langmessage['OOPS']); return false; } $config['menus'][$id] = $menu_name; if (!admin_tools::SaveConfig()) { message($langmessage['OOPS']); } else { $this->avail_menus[$id] = $menu_name; $this->curr_menu_id = $id; } }
function SaveIndex() { return gpFiles::SaveArray($this->index_file, 'index', $this->index); }
function SaveConfig() { global $langmessage; if (isset($_POST['search_hidden'])) { $search_config['search_hidden'] = true; } else { $search_config['search_hidden'] = false; } if (isset($_POST['search_blog'])) { $search_config['search_blog'] = true; } else { $search_config['search_blog'] = false; } if (gpFiles::SaveArray($this->config_file, 'search_config', $search_config)) { message($langmessage['SAVED']); $this->search_config = $search_config; return true; } message($langmessage['OOPS']); $this->Config($_POST); return false; }
function SaveIndex($galleries) { global $dataDir; includeFile('admin/admin_tools.php'); $file = $dataDir . '/data/_site/galleries.php'; return gpFiles::SaveArray($file, 'galleries', $galleries); }
function SaveConfig() { return gpFiles::SaveArray($this->config_file, 'config', $this->config); }
function SaveTrashTitles($trash_titles) { global $dataDir; $index_file = $dataDir . '/data/_site/trash.php'; uksort($trash_titles, 'strnatcasecmp'); return gpFiles::SaveArray($index_file, 'trash_titles', $trash_titles); }