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


PHP admin_tools::SaveConfig方法代码示例

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


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

示例1: SaveConfig

 function SaveConfig()
 {
     global $config, $langmessage;
     $possible = $this->variables;
     foreach ($possible as $key => $curr_possible) {
         if ($curr_possible == 'boolean') {
             if (isset($_POST[$key]) && $_POST[$key] == 'true') {
                 $config[$key] = true;
             } else {
                 $config[$key] = false;
             }
         } elseif ($curr_possible == 'integer') {
             if (isset($_POST[$key]) && is_numeric($_POST[$key])) {
                 $config[$key] = $_POST[$key];
             }
         } elseif (isset($_POST[$key])) {
             $config[$key] = $_POST[$key];
         }
     }
     $config['history_limit'] = min($config['history_limit'], gp_backup_limit);
     if (!admin_tools::SaveConfig()) {
         message($langmessage['OOPS']);
         return false;
     }
     if (isset($_GET['gpreq']) && $_GET['gpreq'] == 'json') {
         message($langmessage['SAVED'] . ' ' . $langmessage['REFRESH']);
     } else {
         message($langmessage['SAVED']);
     }
 }
开发者ID:VTAMAGNO,项目名称:gpEasy-CMS,代码行数:30,代码来源:admin_configuration.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: SaveText

 function SaveText()
 {
     global $config, $langmessage, $page;
     if (!isset($_POST['key'])) {
         message($langmessage['OOPS'] . ' (0)');
         return;
     }
     if (!isset($_POST['value'])) {
         message($langmessage['OOPS'] . ' (1)');
         return;
     }
     $default = $key = $_POST['key'];
     if (isset($langmessage[$key])) {
         $default = $langmessage[$key];
     }
     $config['customlang'][$key] = $value = htmlspecialchars($_POST['value']);
     if ($value === $default || htmlspecialchars($default) == $value) {
         unset($config['customlang'][$key]);
     }
     if (admin_tools::SaveConfig()) {
         message($langmessage['SAVED']);
     } else {
         message($langmessage['OOPS'] . ' (s1)');
     }
     $this->ReturnHeader();
 }
开发者ID:VTAMAGNO,项目名称:gpEasy-CMS,代码行数:26,代码来源:admin_theme_content.php

示例4: RemoteBrowse

 /**
  * Get addon data from gpEasy.com and display to user
  *
  */
 function RemoteBrowse()
 {
     global $langmessage, $config, $dataDir, $gpversion;
     //search options
     if (isset($_GET['search_option'])) {
         $save = true;
         switch ($_GET['search_option']) {
             case 'version':
                 unset($config['search_version']);
                 break;
             case 'noversion':
                 $config['search_version'] = false;
                 break;
             default:
                 $save = false;
                 break;
         }
         if ($save) {
             admin_tools::SaveConfig();
         }
     }
     //make a list of installed addon id's
     $this->installed_ids = array();
     if (isset($config['addons']) && is_array($config['addons'])) {
         foreach ($config['addons'] as $addon_info) {
             if (isset($addon_info['id'])) {
                 $this->installed_ids[] = $addon_info['id'];
             }
         }
     }
     includeFile('tool/RemoteGet.php');
     $orderby = array();
     $orderby['rating_score'] = $langmessage['Highest Rated'];
     $orderby['downloads'] = $langmessage['Most Downloaded'];
     $orderby['modified'] = $langmessage['Recently Updated'];
     $orderby['created'] = $langmessage['Newest'];
     $_GET += array('q' => '');
     $this->searchPage = 0;
     if (isset($_REQUEST['page']) && ctype_digit($_REQUEST['page'])) {
         $this->searchPage = $_REQUEST['page'];
     }
     $this->searchQuery = 'cmd=remote';
     //version specific search
     $search_version = false;
     if (!isset($config['search_version']) || $config['search_version']) {
         $this->searchQuery .= '&ug=' . rawurlencode($gpversion);
         $search_version = true;
     }
     if (!empty($_GET['q'])) {
         $this->searchQuery .= '&q=' . rawurlencode($_GET['q']);
     }
     if (isset($_GET['order']) && isset($orderby[$_GET['order']])) {
         $this->searchOrder = $_GET['order'];
         $this->searchQuery .= '&order=' . rawurlencode($_GET['order']);
     } else {
         reset($orderby);
         $this->searchOrder = key($orderby);
     }
     $slug = 'Special_Addon_Plugins';
     if ($this->config_index == 'themes') {
         $slug = 'Special_Addon_Themes';
     }
     $src = $GLOBALS['addonBrowsePath'] . '/' . $slug . '?' . $this->searchQuery . '&page=' . $this->searchPage;
     //check cache
     $cache_file = $dataDir . '/data/_remote/' . sha1($src) . '.txt';
     $use_cache = false;
     if (file_exists($cache_file) && filemtime($cache_file) + 26100 > time()) {
         $result = file_get_contents($cache_file);
         $use_cache = true;
     } else {
         $result = gpRemoteGet::Get_Successful($src);
     }
     if (!$result) {
         echo '<p>' . $langmessage['Sorry, data not fetched'] . ' (f1)</p>';
         return;
     }
     if (strpos($result, 'a:') !== 0) {
         echo '<p>' . $langmessage['Sorry, data not fetched'] . ' (f2)</p>';
         return;
     }
     $data = unserialize($result);
     if (count($data) == 0) {
         echo '<p>' . $langmessage['Sorry, data not fetched'] . ' (f3)</p>';
         return;
     }
     //save the cache
     if (!$use_cache) {
         gpFiles::Save($cache_file, $result);
     }
     $this->searchMax = $data['max'];
     if (isset($data['per_page']) && $data['per_page']) {
         $this->searchPerPage = $data['per_page'];
     } else {
         $this->searchPerPage = count($data['rows']);
     }
     $this->searchOffset = $this->searchPage * $this->searchPerPage;
//.........这里部分代码省略.........
开发者ID:rizub4u,项目名称:gpEasy-CMS,代码行数:101,代码来源:admin_addon_install.php

示例5: SaveAllConfig

 /**
  * Save config.php and pages.php
  *
  */
 static function SaveAllConfig()
 {
     if (!admin_tools::SaveConfig()) {
         return false;
     }
     if (!admin_tools::SavePagesPHP()) {
         return false;
     }
     return true;
 }
开发者ID:Bomberus,项目名称:gpEasy-CMS,代码行数:14,代码来源:admin_tools.php

示例6: GadgetVisibility

 function GadgetVisibility($addon, $cmd)
 {
     global $config, $langmessage;
     $gadget = $_GET['gadget'];
     if (!isset($config['gadgets']) || !is_array($config['gadgets']) || !isset($config['gadgets'][$gadget])) {
         message($langmessage['OOPS']);
         return;
     }
     $gadgetInfo =& $config['gadgets'][$gadget];
     switch ($cmd) {
         case 'enable':
             unset($gadgetInfo['disabled']);
             break;
         case 'disable':
             $gadgetInfo['disabled'] = true;
             break;
     }
     if (!admin_tools::SaveConfig()) {
         message($langmessage['OOPS']);
     }
 }
开发者ID:rizub4u,项目名称:gpEasy-CMS,代码行数:21,代码来源:admin_addons.php

示例7: AltMenu_Remove

 function AltMenu_Remove()
 {
     global $langmessage, $config, $dataDir;
     $menu_id =& $_POST['id'];
     if (!$this->IsAltMenu($menu_id)) {
         message($langmessage['OOPS']);
         return;
     }
     $menu_file = $dataDir . '/data/_menus/' . $menu_id . '.php';
     unset($config['menus'][$menu_id]);
     unset($this->avail_menus[$menu_id]);
     if (!admin_tools::SaveConfig()) {
         message($langmessage['OOPS']);
     }
     message($langmessage['SAVED']);
     //delete menu file
     $menu_file = $dataDir . '/data/_menus/' . $menu_id . '.php';
     if (file_exists($menu_file)) {
         unlink($menu_file);
     }
 }
开发者ID:rizub4u,项目名称:gpEasy-CMS,代码行数:21,代码来源:admin_menu_new.php

示例8: RemoteBrowse

 /**
  * Get addon data from gpEasy.com and display to user
  *
  */
 function RemoteBrowse()
 {
     global $langmessage, $config, $dataDir;
     //search options
     if (isset($_GET['search_option'])) {
         $save = true;
         switch ($_GET['search_option']) {
             case 'version':
                 unset($config['search_version']);
                 break;
             case 'noversion':
                 $config['search_version'] = false;
                 break;
             default:
                 $save = false;
                 break;
         }
         if ($save) {
             admin_tools::SaveConfig();
         }
     }
     //make a list of installed addon id's
     $this->installed_ids = array();
     if (isset($config['addons']) && is_array($config['addons'])) {
         foreach ($config['addons'] as $addon_info) {
             if (isset($addon_info['id'])) {
                 $this->installed_ids[] = $addon_info['id'];
             }
         }
     }
     includeFile('tool/RemoteGet.php');
     //search settings
     $this->searchUrl = $this->path_remote;
     $this->searchOrderOptions['rating_score'] = $langmessage['Highest Rated'];
     $this->searchOrderOptions['downloads'] = $langmessage['Most Downloaded'];
     $this->searchOrderOptions['modified'] = $langmessage['Recently Updated'];
     $this->searchOrderOptions['created'] = $langmessage['Newest'];
     $_GET += array('q' => '');
     if (isset($_REQUEST['page']) && ctype_digit($_REQUEST['page'])) {
         $this->searchPage = $_REQUEST['page'];
     }
     //version specific search
     $search_version = false;
     if (!isset($config['search_version']) || $config['search_version']) {
         $this->searchQuery .= '&ug=' . rawurlencode(gpversion);
         $search_version = true;
     }
     if (!empty($_GET['q'])) {
         $this->searchQuery .= '&q=' . rawurlencode($_GET['q']);
     }
     $this->SearchOrder();
     $slug = 'Plugins';
     if ($this->config_index == 'themes') {
         $slug = 'Themes';
     }
     $src = addon_browse_path . '/' . $slug . '?cmd=remote&format=json&' . $this->searchQuery . '&page=' . $this->searchPage;
     // format=json added 4.6b3
     //check cache
     $cache_file = $dataDir . '/data/_remote/' . sha1($src) . '.txt';
     $use_cache = false;
     if (file_exists($cache_file) && filemtime($cache_file) + 26100 > time()) {
         $result = file_get_contents($cache_file);
         $use_cache = true;
     } else {
         $result = gpRemoteGet::Get_Successful($src);
     }
     //no response
     if (!$result) {
         if ($use_cache) {
             unlink($cache_file);
         }
         echo '<p>' . gpRemoteGet::Debug('Sorry, data not fetched') . '</p>';
         return;
     }
     //serialized or json (serialized data may be cached)
     if (strpos($result, 'a:') === 0) {
         $data = unserialize($result);
     } elseif (strpos($result, '{') === 0) {
         $data = json_decode($result, true);
     } else {
         if ($use_cache) {
             unlink($cache_file);
         }
         $debug = array();
         $debug['Two'] = substr($result, 0, 2);
         $debug['Twotr'] = substr(trim($result), 0, 2);
         echo '<p>' . gpRemoteGet::Debug('Sorry, data not fetched', $debug) . '</p>';
         return;
     }
     //not unserialized?
     if (!is_array($data) || count($data) == 0) {
         if ($use_cache) {
             unlink($cache_file);
         }
         echo '<p>' . $langmessage['Sorry, data not fetched'] . ' (F3)</p>';
         return;
//.........这里部分代码省略.........
开发者ID:jozefkrz,项目名称:gpEasy-CMS,代码行数:101,代码来源:admin_addon_install.php

示例9: NewFileNumber

 public static function NewFileNumber()
 {
     global $config;
     includeFile('admin/admin_tools.php');
     if (!isset($config['file_count'])) {
         $config['file_count'] = 0;
     }
     $config['file_count']++;
     admin_tools::SaveConfig();
     return $config['file_count'];
 }
开发者ID:VTAMAGNO,项目名称:gpEasy-CMS,代码行数:11,代码来源:Files.php

示例10: HomepageSave

 /**
  * Save the posted page as the homepage
  *
  */
 function HomepageSave()
 {
     global $langmessage, $config, $gp_index, $gp_titles, $page;
     $homepage = $_POST['homepage'];
     $homepage_key = false;
     if (isset($gp_index[$homepage])) {
         $homepage_key = $gp_index[$homepage];
     } else {
         foreach ($gp_titles as $index => $title) {
             if ($title['label'] === $homepage) {
                 $homepage_key = $index;
                 break;
             }
         }
         if (!$homepage_key) {
             message($langmessage['OOPS']);
             return;
         }
     }
     $config['homepath_key'] = $homepage_key;
     $config['homepath'] = common::IndexToTitle($config['homepath_key']);
     if (!admin_tools::SaveConfig()) {
         message($langmessage['OOPS']);
         return;
     }
     //update the display
     ob_start();
     $this->HomepageDisplay();
     $content = ob_get_clean();
     $page->ajaxReplace[] = array('inner', '.homepage_setting', $content);
 }
开发者ID:GedionChang,项目名称:gpEasy-CMS,代码行数:35,代码来源:admin_menu_new.php

示例11: GadgetVisibility

 function GadgetVisibility($cmd)
 {
     global $config, $langmessage, $page;
     $page->ajaxReplace = array();
     $gadget = $_GET['gadget'];
     if (!isset($config['gadgets']) || !is_array($config['gadgets']) || !isset($config['gadgets'][$gadget])) {
         message($langmessage['OOPS'] . ' (Invalid Gadget)');
         return;
     }
     $gadgetInfo =& $config['gadgets'][$gadget];
     switch ($cmd) {
         case 'enable':
             unset($gadgetInfo['disabled']);
             break;
         case 'disable':
             $gadgetInfo['disabled'] = true;
             break;
     }
     if (!admin_tools::SaveConfig()) {
         message($langmessage['OOPS'] . ' (Not Saved)');
         return;
     }
     $link = $this->GadgetLink($gadget);
     $page->ajaxReplace[] = array('replace', '.gadget_link_' . $gadget, $link);
 }
开发者ID:VTAMAGNO,项目名称:gpEasy-CMS,代码行数:25,代码来源:admin_addons.php

示例12: 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

示例13: UnpackAndReplace

 /**
  * Replace the /include, /themes and /addons folders
  * Start by creating the new folders with the new content
  * Then replace the existing directories with the new directories
  *
  */
 function UnpackAndReplace()
 {
     global $langmessage, $config, $gp_filesystem, $dataDir;
     if ($gp_filesystem->connect() !== true) {
         $this->msg($langmessage['OOPS'] . ': (not connected)');
         return false;
     }
     if (!$this->UnpackAndSort($this->core_package['file'])) {
         return false;
     }
     $this->msg('Files Sorted');
     $config['updating_message'] = $langmessage['sorry_currently_updating'];
     if (!admin_tools::SaveConfig()) {
         $this->msg($langmessage['error_updating_settings']);
         return false;
     }
     $replaced = $gp_filesystem->ReplaceDirs($this->replace_dirs, $this->extra_dirs);
     if ($replaced !== true) {
         $this->msg($langmessage['error_unpacking'] . ' ' . $replaced);
         $this->RemoveUpdateMessage();
         return false;
     }
     $this->msg($langmessage['copied_new_files']);
     $this->RemoveUpdateMessage();
     return true;
 }
开发者ID:barbrick,项目名称:gpEasy-CMS,代码行数:32,代码来源:update.php

示例14: SaveFTPInformation

 function SaveFTPInformation()
 {
     global $config, $langmessage;
     $_POST += array('ftp_server' => '', 'ftp_user' => '', 'ftp_pass' => '');
     //try to connect and login if ftp_server is not empty
     if (!empty($_POST['ftp_server'])) {
         $conn_id = @ftp_connect($_POST['ftp_server'], 21, 6);
         if (!$conn_id) {
             message('Oops, could not connect using ftp_connect() for server <i>' . htmlspecialchars($_POST['ftp_server']) . '</i>');
             return false;
         }
         ob_start();
         $login_result = @ftp_login($conn_id, $_POST['ftp_user'], $_POST['ftp_pass']);
         if (!$login_result) {
             message('Oops, could not login using ftp_login() for server <i>' . $_POST['ftp_server'] . '</i> and user <i>' . $_POST['ftp_user'] . '</i>');
             @ftp_close($conn_id);
             ob_end_clean();
             return false;
         }
         @ftp_close($conn_id);
         ob_end_clean();
     }
     $config['ftp_user'] = $_POST['ftp_user'];
     $config['ftp_server'] = $_POST['ftp_server'];
     $config['ftp_pass'] = $_POST['ftp_pass'];
     if (!admin_tools::SaveConfig()) {
         message('Oops, there was an error saving your ftp information.');
         return false;
     }
     return true;
 }
开发者ID:rizub4u,项目名称:gpEasy-CMS,代码行数:31,代码来源:SetupSite.php

示例15: SaveFinderData

function SaveFinderData($data)
{
    global $config;
    $config['finder_data'] = $data;
    admin_tools::SaveConfig();
}
开发者ID:VTAMAGNO,项目名称:gpEasy-CMS,代码行数:6,代码来源:connector.php


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