当前位置: 首页>>代码示例>>PHP>>正文


PHP gpFiles::SaveData方法代码示例

本文整理汇总了PHP中gpFiles::SaveData方法的典型用法代码示例。如果您正苦于以下问题:PHP gpFiles::SaveData方法的具体用法?PHP gpFiles::SaveData怎么用?PHP gpFiles::SaveData使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在gpFiles的用法示例。


在下文中一共展示了gpFiles::SaveData方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: SaveAddonData

 function SaveAddonData()
 {
     if (!isset($this->dataFile)) {
         trigger_error('dataFile not set');
         return;
     }
     $addonData = array();
     while (count($this->addonHistory) > 30) {
         array_shift($this->addonHistory);
     }
     $addonData['history'] = $this->addonHistory;
     $addonData['reviews'] = $this->addonReviews;
     return gpFiles::SaveData($this->dataFile, 'addonData', $addonData);
 }
开发者ID:VTAMAGNO,项目名称:gpEasy-CMS,代码行数:14,代码来源:admin_addons_tool.php

示例2: Upgrade_234

 /**
  * 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 (gpFiles::Exists($menu_file)) {
                 $menu = gpOutput::GetMenuArray($key);
                 $menu = $this->FixMenu($menu, $special_indexes);
                 gpFiles::SaveData($menu_file, 'menu', $menu);
             }
         }
     }
 }
开发者ID:VTAMAGNO,项目名称:gpEasy-CMS,代码行数:45,代码来源:upgrade.php

示例3: AddRedirect

 /**
  * Add instructions for a 301 or 302 redirect
  *
  */
 function AddRedirect($source, $target)
 {
     global $dataDir;
     $datafile = $dataDir . '/data/_site/error_data.php';
     $error_data = gpFiles::Get('_site/error_data');
     if (!$error_data) {
         $error_data = array();
     }
     $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::SaveData($datafile, 'error_data', $error_data);
     }
 }
开发者ID:VTAMAGNO,项目名称:gpEasy-CMS,代码行数:28,代码来源:admin_missing.php

示例4: GenerateFile

 /**
  * Generate a file with all of the combined content
  *
  */
 static function GenerateFile($files, $type)
 {
     global $dataDir;
     //get etag
     $modified = $content_length = 0;
     $full_paths = array();
     foreach ($files as $file) {
         $full_path = gp_combine::CheckFile($file);
         if ($full_path === false) {
             continue;
         }
         gp_combine::FileStat_Static($full_path, $modified, $content_length);
         $full_paths[$file] = $full_path;
     }
     //check css imports
     if ($type == 'css') {
         $had_imported = false;
         $import_data = array();
         $imported_file = $dataDir . '/data/_cache/import_info.php';
         if (file_exists($imported_file)) {
             include_once $imported_file;
         }
         foreach ($full_paths as $file => $full_path) {
             if (!isset($import_data[$full_path])) {
                 continue;
             }
             $had_imported = true;
             foreach ($import_data[$full_path] as $imported_full) {
                 gp_combine::FileStat_Static($imported_full, $modified, $content_length);
             }
             unset($import_data[$full_path]);
         }
     }
     //check to see if file exists
     $etag = common::GenEtag(json_encode($files), $modified, $content_length);
     $cache_relative = '/data/_cache/combined_' . $etag . '.' . $type;
     $cache_file = $dataDir . $cache_relative;
     if (file_exists($cache_file)) {
         // change modified time to extend cache
         if (time() - filemtime($cache_file) > 604800) {
             touch($cache_file);
         }
         return $cache_relative;
     }
     //create file
     if ($type == 'js') {
         ob_start();
         common::jsStart();
         foreach ($full_paths as $full_path) {
             readfile($full_path);
             echo ";\n";
         }
         $combined_content = ob_get_clean();
     } else {
         $imports = $combined_content = '';
         $new_imported = array();
         foreach ($full_paths as $file => $full_path) {
             $temp = new gp_combine_css($file);
             $combined_content .= "\n/* " . $file . " */\n";
             $combined_content .= $temp->content;
             $imports .= $temp->imports;
             if (count($temp->imported)) {
                 $new_imported[$full_path] = $temp->imported;
             }
         }
         $combined_content = $imports . $combined_content;
         //save imported data
         if (count($new_imported) || $had_imported) {
             if (count($new_imported)) {
                 $import_data = $new_imported + $import_data;
             }
             gpFiles::SaveData($imported_file, 'import_data', $import_data);
         }
     }
     if (!gpFiles::Save($cache_file, $combined_content)) {
         return false;
     }
     includeFile('admin/admin_tools.php');
     admin_tools::CleanCache();
     return $cache_relative;
 }
开发者ID:AndFer22,项目名称:Typesetter,代码行数:85,代码来源:combine.php

示例5: connect

 /**
  * 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;
     $connect_args = gpFiles::Get('_updates/connect', 'connect_args');
     if (!$connect_args || !isset($connect_args['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;
     }
     $connection_file = $dataDir . '/data/_updates/connect.php';
     if (!gpFiles::SaveData($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;
 }
开发者ID:GedionChang,项目名称:gpEasy-CMS,代码行数:59,代码来源:FileSystem.php

示例6: MoveToTrash_File

 /**
  * Copy the php file in _pages to _trash for $title
  *
  */
 static function MoveToTrash_File($title, $index, &$trash_data)
 {
     global $dataDir, $gp_titles, $config;
     //get the file data
     $source_file = gpFiles::PageFile($title);
     $source_dir = dirname($source_file);
     $trash_file = $source_dir . '/deleted.php';
     $file_sections = gpFiles::Get($source_file, 'file_sections');
     //create trash info file
     $trash_info = $gp_titles[$index];
     $trash_info['title'] = $title;
     $trash_info['time'] = time();
     if (!gpFiles::SaveData($trash_file, 'deleted', $trash_info)) {
         return false;
     }
     //update image information
     if (count($file_sections)) {
         includeFile('image.php');
         gp_resized::SetIndex();
         foreach ($file_sections as $section_data) {
             if (isset($section_data['resized_imgs'])) {
                 gp_edit::ResizedImageUse($section_data['resized_imgs'], array());
             }
         }
     }
     return true;
 }
开发者ID:VTAMAGNO,项目名称:gpEasy-CMS,代码行数:31,代码来源:admin_trash.php

示例7: SaveConfig

 /**
  * Save the gpEasy configuration
  * @return bool
  *
  */
 static function SaveConfig()
 {
     global $config, $dataDir;
     if (!is_array($config)) {
         return false;
     }
     if (!isset($config['gpuniq'])) {
         $config['gpuniq'] = common::RandomString(20);
     }
     return gpFiles::SaveData($dataDir . '/data/_site/config.php', 'config', $config);
 }
开发者ID:Bomberus,项目名称:gpEasy-CMS,代码行数:16,代码来源:admin_tools.php

示例8: SaveConfig

 /**
  * Save the configuration file
  *
  */
 function SaveConfig()
 {
     return gpFiles::SaveData($this->config_file, 'cke_config', $this->cke_config);
 }
开发者ID:Knuzen,项目名称:gpEasy-CMS,代码行数:8,代码来源:admin_ckeditor.php

示例9: NewTitle

 /**
  * Save the content for a new page in /data/_pages/<title>
  * @since 1.8a1
  *
  */
 public static function NewTitle($title, $section_content = false, $type = 'text')
 {
     // get the file for the title
     if (empty($title)) {
         return false;
     }
     $file = gpFiles::PageFile($title);
     if (!$file) {
         return false;
     }
     // organize section data
     $file_sections = array();
     if (is_array($section_content) && isset($section_content['type'])) {
         $file_sections[0] = $section_content;
     } elseif (is_array($section_content)) {
         $file_sections = $section_content;
     } else {
         $file_sections[0] = array('type' => $type, 'content' => $section_content);
     }
     // add meta data
     $meta_data = array('file_number' => gpFiles::NewFileNumber(), 'file_type' => $type);
     return gpFiles::SaveData($file, 'file_sections', $file_sections, $meta_data);
 }
开发者ID:VTAMAGNO,项目名称:gpEasy-CMS,代码行数:28,代码来源:Files.php

示例10: SaveConfig

 function SaveConfig()
 {
     global $langmessage;
     if (isset($_POST['search_hidden'])) {
         $search_config['search_hidden'] = true;
     } else {
         $search_config['search_hidden'] = false;
     }
     if (gpFiles::SaveData($this->config_file, 'search_config', $search_config)) {
         msg($langmessage['SAVED']);
         $this->search_config = $search_config;
         return true;
     }
     msg($langmessage['OOPS']);
     $this->Config($_POST);
     return false;
 }
开发者ID:VTAMAGNO,项目名称:gpEasy-CMS,代码行数:17,代码来源:special_search.php

示例11: SaveData

 function SaveData()
 {
     return gpFiles::SaveData($this->datafile, 'error_data', $this->error_data);
 }
开发者ID:barbrick,项目名称:gpEasy-CMS,代码行数:4,代码来源:special_missing.php

示例12: PublishDraft

 /**
  * Make the working draft the live file
  *
  */
 public function PublishDraft()
 {
     global $langmessage;
     if (!$this->draft_exists) {
         msg($langmessage['OOPS'] . ' (Not a draft)');
         return false;
     }
     if (!gpFiles::SaveData($this->file, 'file_sections', $this->file_sections, $this->draft_meta)) {
         msg($langmessage['OOPS'] . ' (Draft not published)');
         return false;
     }
     unlink($this->draft_file);
     $this->ResetFileTypes();
     $this->draft_exists = false;
     msg($langmessage['SAVED']);
 }
开发者ID:jozefkrz,项目名称:gpEasy-CMS,代码行数:20,代码来源:editing_page.php

示例13: SaveClasses

 /**
  * Save the posted data
  *
  */
 function SaveClasses()
 {
     global $langmessage;
     $classes = array();
     foreach ($_POST['class_names'] as $i => $class_names) {
         $class_names = trim($class_names);
         if (empty($class_names)) {
             continue;
         }
         $classes[] = array('names' => $class_names, 'desc' => $_POST['class_desc'][$i]);
     }
     if (gpFiles::SaveData('_config/classes', 'classes', $classes)) {
         msg($langmessage['SAVED']);
     } else {
         msg($langmessage['OOPS'] . ' (Not Saved)');
     }
 }
开发者ID:VTAMAGNO,项目名称:gpEasy-CMS,代码行数:21,代码来源:admin_classes.php

示例14: SendPassword

 function SendPassword()
 {
     global $langmessage, $gp_mailer, $config;
     includeFile('tool/email_mailer.php');
     $users = gpFiles::Get('_site/users');
     $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);
     $pass_hash = gpsession::PassAlgo($userinfo);
     $users[$username]['newpass'] = common::hash($newpass, $pass_hash);
     if (!gpFiles::SaveData('_site/users', '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', $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;
 }
开发者ID:VTAMAGNO,项目名称:gpEasy-CMS,代码行数:40,代码来源:admin_login.php

示例15: NewTitle

 /**
  * Save the content for a new page in /data/_pages/<title>
  * @since 1.8a1
  *
  */
 static function NewTitle($title, $section_content = false, $type = 'text')
 {
     if (empty($title)) {
         return false;
     }
     $file = gpFiles::PageFile($title);
     if (!$file) {
         return false;
     }
     $file_sections = array();
     if (is_array($section_content)) {
         $file_sections[0] = $section_content;
     } else {
         $file_sections[0] = array('type' => $type, 'content' => $section_content);
     }
     $meta_data = array('file_number' => gpFiles::NewFileNumber(), 'file_type' => $type);
     return gpFiles::SaveData($file, 'file_sections', $file_sections, $meta_data);
 }
开发者ID:GedionChang,项目名称:gpEasy-CMS,代码行数:23,代码来源:common.php


注:本文中的gpFiles::SaveData方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。