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


PHP write_ini_file函数代码示例

本文整理汇总了PHP中write_ini_file函数的典型用法代码示例。如果您正苦于以下问题:PHP write_ini_file函数的具体用法?PHP write_ini_file怎么用?PHP write_ini_file使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


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

示例1: set

 /**
  * Write or update a configuration string
  * 
  * @param string $prefix
  * @param string $key
  * @param string $value
  */
 public function set($prefix, $key, $value)
 {
     $prefix = strtolower($prefix);
     $key = strtolower($key);
     $this->settings[$prefix][$key] = $value;
     write_ini_file($this->settings, $this->path, true);
 }
开发者ID:youmy001,项目名称:apine-framework,代码行数:14,代码来源:Config.php

示例2: SetPage

function SetPage($PageName, $Data)
{
    if (file_exists("page/{$PageName}/config.ini")) {
        $Config["general"]["filename"] = $Data["filename"];
        $Config["general"]["title"] = $Data["title"];
        $Config["general"]["type"] = $Data["type"];
        $Config["general"]["author"] = $Data["author"];
        $Config["general"]["date"] = $Data["date"];
        $Config["general"]["time"] = $Data["time"];
        $Config["general"]["tag"] = $Data["tag"];
        $Config["general"]["priority"] = $Data["priority"];
        write_ini_file($Config, "page/{$PageName}/config.ini");
        return 1;
    } else {
        return 0;
    }
}
开发者ID:atnanasi,项目名称:staylog,代码行数:17,代码来源:stayfunc.php

示例3: InputForm

<?php

////////////////////////////////////////////////////////////////////////////////
//   Copyright (C) ReloadCMS Development Team                                 //
//   http://reloadcms.com                                                     //
//   This product released under GNU General Public License v2                //
////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////
// Update comments configuration                                              //
////////////////////////////////////////////////////////////////////////////////
if (!empty($_POST['config']) && is_array($_POST['config'])) {
    if (write_ini_file($_POST['config'], CONFIG_PATH . 'comments.ini')) {
        rcms_showAdminMessage(__('Configuration updated'));
    } else {
        rcms_showAdminMessage(__('Error occurred'));
    }
}
////////////////////////////////////////////////////////////////////////////////
// Interface generation                                                       //
////////////////////////////////////////////////////////////////////////////////
$config = parse_ini_file(CONFIG_PATH . 'comments.ini');
$frm = new InputForm('', 'post', __('Submit'));
$frm->addbreak(__('Comments configuration'));
$frm->addrow(__('Maximum message length'), $frm->text_box('config[max_message_len]', $config['max_message_len'], 5));
$frm->addrow(__('Maximum word length'), $frm->text_box('config[max_word_len]', $config['max_word_len'], 4));
$frm->addrow(__('Maximum size of database (in messages)'), $frm->text_box('config[max_db_size]', $config['max_db_size'], 5));
$frm->addbreak(__('Configuration') . ' bbcodes');
$frm->addrow(__('Enable nl2br and bbCodes') . __(' (except images)'), $frm->checkbox('config[bbcodes]', '1', '', @$config['bbcodes'], 4));
$frm->addrow(__('Enable all') . ' bbcodes', $frm->checkbox('config[links]', '1', '', @$config['links'], 4));
$frm->show();
开发者ID:Parashutik,项目名称:ReloadCMS,代码行数:30,代码来源:comments.php

示例4: foreach

<?php

////////////////////////////////////////////////////////////////////////////////
//   Copyright (C) ReloadCMS Development Team                                 //
//   http://reloadcms.com                                                     //
//   This product released under GNU General Public License v2                //
////////////////////////////////////////////////////////////////////////////////
if (!empty($_POST['save'])) {
    foreach ($system->disable_feeds as $dkey => $dvalue) {
        if (!empty($_POST['rss_disable'][$dkey])) {
            $system->disable_feeds[$dkey] = 1;
        } else {
            $system->disable_feeds[$dkey] = 0;
        }
    }
    write_ini_file($system->disable_feeds, CONFIG_PATH . 'rss_disable.ini');
    rcms_showAdminMessage(__('Configuration updated'));
}
// Interface generation
$frm = new InputForm('', 'post', __('Save'));
//RSS configuration
$frm->addbreak(__('RSS Feeds list'));
foreach ($system->disable_feeds as $key => $value) {
    $frm->addrow(__('Disable') . ' ' . __('RSS feed'), $frm->checkbox('rss_disable[' . $key . ']', '1', $key, $system->disable_feeds[$key]));
}
$frm->hidden('save', '1');
$frm->show();
开发者ID:Parashutik,项目名称:ReloadCMS,代码行数:27,代码来源:rss.php

示例5: deleteComment

 function deleteComment($cat_id, $art_id, $comment)
 {
     $cat_id = (int) $cat_id;
     $art_id = (int) $art_id;
     if (empty($this->container)) {
         $this->last_error = __('No section selected!');
         return false;
     }
     if ($this->container !== '#root' && $this->container !== '#hidden') {
         if (!($category = $this->getCategory($cat_id))) {
             return false;
         }
         $art_prefix = ARTICLES_PATH . $this->container . '/' . $cat_id . '/' . $art_id . '/';
     } else {
         $art_prefix = ARTICLES_PATH . $this->container . '/' . $art_id . '/';
     }
     if ($data = @unserialize(@file_get_contents($art_prefix . 'comments'))) {
         if (isset($data[$comment])) {
             rcms_remove_index($comment, $data, true);
             @file_write_contents($art_prefix . 'comments', serialize($data));
             $article_data = rcms_parse_ini_file($art_prefix . 'define');
             $article_data['comcount']--;
             @write_ini_file($article_data, $art_prefix . 'define');
         }
         if ($this->container !== '#root' && $this->container !== '#hidden') {
             $this->index[$cat_id][$art_id]['ccnt']--;
         } else {
             $this->index[$art_id]['ccnt']--;
         }
         $res = $this->saveIndex();
         return $res;
     } else {
         return false;
     }
 }
开发者ID:l1ght13aby,项目名称:Ubilling,代码行数:35,代码来源:api.articles.php

示例6: rcms_showAdminMessage

//   but WITHOUT ANY WARRANTY, without even the implied warranty of           //
//   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.                     //
//                                                                            //
//   This product released under GNU General Public License v2                //
////////////////////////////////////////////////////////////////////////////////
if (!empty($_POST['urls']) && !empty($_POST['names']) && is_array($_POST['urls']) && is_array($_POST['names'])) {
    if (count($_POST['urls']) !== count($_POST['names'])) {
        rcms_showAdminMessage($lang['general']['navigation_error']);
    } else {
        $result = array();
        $cnt = count($_POST['urls']);
        for ($i = 0; $i < $cnt; $i++) {
            if (!empty($_POST['urls'][$i])) {
                $result[$i]['url'] = @$_POST['urls'][$i];
                $result[$i]['name'] = $_POST['names'][$i];
            }
        }
        write_ini_file($result, CONFIG_PATH . 'navigation.ini', true) or rcms_showAdminMessage($lang['general']['navigation_error']);
    }
}
$links = parse_ini_file(CONFIG_PATH . 'navigation.ini', true);
// Interface generation
$frm = new InputForm("", "post", $lang['general']['submit']);
$frm->addbreak($lang['admincp']['general']['navigation']['title']);
$frm->addrow($lang['general']['url'], $lang['general']['title']);
foreach ($links as $link) {
    $frm->addrow($frm->text_box('urls[]', $link['url']), $frm->text_box('names[]', $link['name']));
}
$frm->addrow($frm->text_box('urls[]', ''), $frm->text_box('names[]', ''));
$frm->addmessage($lang['general']['navigation_desc']);
$frm->show();
开发者ID:BackupTheBerlios,项目名称:reloadcms-svn,代码行数:31,代码来源:general.nav.php

示例7: rcms_showAdminMessage

//   but WITHOUT ANY WARRANTY, without even the implied warranty of           //
//   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.                     //
//                                                                            //
//   This product released under GNU General Public License v2                //
////////////////////////////////////////////////////////////////////////////////
if (!empty($_POST['field_id']) && !empty($_POST['field_name'])) {
    if (sizeof($_POST['field_id']) != sizeof($_POST['field_id'])) {
        rcms_showAdminMessage(__('Cannot save configuration'));
    } else {
        $cnt = sizeof($_POST['field_id']);
        for ($i = 0; $i < $cnt; $i++) {
            if (!empty($_POST['field_id'][$i])) {
                $result[$_POST['field_id'][$i]] = $_POST['field_name'][$i];
            }
        }
        if (write_ini_file($result, CONFIG_PATH . 'users.fields.ini')) {
            rcms_showAdminMessage(__('Configuration updated'));
            $system->data['apf'] = $result;
        } else {
            rcms_showAdminMessage(__('Cannot save configuration'));
        }
    }
}
// Interface generation
$frm = new InputForm('', 'post', __('Submit'));
$frm->addbreak(__('Manage additional fields'));
$frm->addrow(__('ID'), __('Title'));
foreach ($system->data['apf'] as $field_id => $field_name) {
    $frm->addrow($frm->text_box('field_id[]', $field_id), $frm->text_box('field_name[]', $field_name));
}
$frm->addrow($frm->text_box('field_id[]', ''), $frm->text_box('field_name[]', ''));
开发者ID:l1ght13aby,项目名称:Ubilling,代码行数:31,代码来源:fields.php

示例8: save_config

function save_config($type = 'ini')
{
    global $INI;
    $q = ZSystem::GetSaveINI($INI);
    if (strtoupper($type) == 'INI') {
        if (!is_writeable(SYS_INIFILE)) {
            return false;
        }
        return write_ini_file($q, SYS_INIFILE);
    }
    if (strtoupper($type) == 'PHP') {
        if (!is_writeable(SYS_PHPFILE)) {
            return false;
        }
        return write_php_file($q, SYS_PHPFILE);
    }
    return false;
}
开发者ID:yunsite,项目名称:hhzuitu,代码行数:18,代码来源:common.php

示例9: array

<?php

////////////////////////////////////////////////////////////////////////////////
//   Copyright (C) ReloadCMS Development Team                                 //
//   http://reloadcms.com                                                     //
//   This product released under GNU General Public License v2                //
////////////////////////////////////////////////////////////////////////////////
if (isset($_POST['disable'])) {
    if (!is_array($_POST['disable'])) {
        $_POST['disable'] = array();
    }
    if (write_ini_file($_POST['disable'], CONFIG_PATH . 'disable.ini')) {
        rcms_showAdminMessage(__('Configuration updated'));
    } else {
        rcms_showAdminMessage(__('Error occurred'));
    }
}
$system->initialiseModules(true);
if (!($disabled = @parse_ini_file(CONFIG_PATH . 'disable.ini'))) {
    $disabled = array();
}
// Interface generation
$frm = new InputForm('', 'post', __('Submit'));
$frm->addbreak(__('Modules management'));
$frm->hidden('disable', '');
foreach ($system->modules as $type => $modules) {
    foreach ($modules as $module => $moduledata) {
        $frm->addrow(__('Module') . ': ' . $moduledata['title'] . '<br/><b>' . $moduledata['copyright'] . '</b>', $frm->checkbox('disable[' . $module . ']', '1', __('Disable'), !empty($disabled[$module])));
    }
}
$frm->show();
开发者ID:Parashutik,项目名称:ReloadCMS,代码行数:31,代码来源:module_dis.php

示例10: PDO

if (!empty($clientkey) && !empty($masterkey) && !empty($mysql_hostname) && !empty($mysql_username) && !empty($mysql_password) && !empty($mysql_database)) {
    try {
        $testDb = new PDO('mysql:host=' . $mysql_hostname . ';dbname=' . $mysql_database . ';charset=utf8', $mysql_username, $mysql_password);
    } catch (PDOException $e) {
        die('{"error":"Wrong MySQL Information!"}');
    }
    $config = parse_ini_file('../config.ini.php', false);
    $config["mysql_hostname"] = $mysql_hostname;
    $config["mysql_username"] = $mysql_username;
    $config["mysql_password"] = $mysql_password;
    $config["mysql_database"] = $mysql_database;
    $config["mysql_charset"] = "utf8";
    $config["database_fields"] = "configity_fields";
    $config["configity_clientkey"] = $clientkey;
    $config["configity_masterkey"] = $masterkey;
    $result = write_ini_file($config, '../config.ini.php', false);
    if ($result) {
        //Config updated successfully
        require '../configity-manager.php';
        $configity_fields_table = file_get_contents("configity_fields.sql");
        $callbackResult = $database->ExecuteSQL($configity_fields_table);
        if ($callbackResult) {
            //Fields database successfully added
            echo '{"success":"Install successful"}';
        } else {
            echo '{"error":"Error, server couldnt add the fields table!"}';
        }
    } else {
        //Server error, didn't update the config file
        echo '{"error":"Server error! Didnt install!"}';
    }
开发者ID:kevinjpetersen,项目名称:configity-server,代码行数:31,代码来源:install.php

示例11: InputForm

<?php

////////////////////////////////////////////////////////////////////////////////
//   Copyright (C) ReloadCMS Development Team                                 //
//   http://reloadcms.com                                                     //
//   This product released under GNU General Public License v2                //
////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////
// Update guestbook configuration                                              //
////////////////////////////////////////////////////////////////////////////////
if (!empty($_POST['config']) && is_array($_POST['config'])) {
    if (write_ini_file($_POST['config'], CONFIG_PATH . 'guestbook.ini')) {
        rcms_showAdminMessage(__('Configuration updated'));
    } else {
        rcms_showAdminMessage(__('Error occurred'));
    }
}
////////////////////////////////////////////////////////////////////////////////
// Interface generation                                                       //
////////////////////////////////////////////////////////////////////////////////
$config = parse_ini_file(CONFIG_PATH . 'guestbook.ini');
$frm = new InputForm('', 'post', __('Submit'));
$frm->addbreak(__('Guest book configuration'));
$frm->addrow(__('Maximum message length'), $frm->text_box('config[max_message_len]', $config['max_message_len'], 5));
$frm->addrow(__('Maximum word length'), $frm->text_box('config[max_word_len]', $config['max_word_len'], 4));
$frm->addrow(__('Maximum size of database (in messages)'), $frm->text_box('config[max_db_size]', $config['max_db_size'], 5));
$frm->addbreak(__('Configuration') . ' bbcodes');
$frm->addrow(__('Enable nl2br and bbCodes') . __(' (except images)'), $frm->checkbox('config[bbcodes]', '1', '', @$config['bbcodes'], 4));
$frm->addrow(__('Enable all') . ' bbcodes', $frm->checkbox('config[links]', '1', '', @$config['links'], 4));
$frm->show();
开发者ID:Parashutik,项目名称:ReloadCMS,代码行数:30,代码来源:guestbook.php

示例12: registerUser

 function registerUser($username, $nickname, $password, $confirm, $email, $userdata)
 {
     $username = basename($username);
     $nickname = empty($nickname) ? $username : mb_substr(trim($nickname), 0, 50);
     if (preg_match("/[^(\\w)|(\\x7F-\\xFF)|(\\-)]/", $nickname)) {
         $this->results['registration'] = __('Invalid nickname');
         return false;
     }
     if (empty($username) || preg_replace("/[\\d\\w]+/i", '', $username) != '' || mb_strlen($username) > 50 || $username == 'guest') {
         $this->results['registration'] = __('Invalid username');
         return false;
     }
     if ($this->is_user($username)) {
         $this->results['registration'] = __('User with this username already exists');
         return false;
     }
     if (!user_check_nick_in_cache($username, $nickname, $cache)) {
         $this->results['registration'] = __('User with this nickname already exists');
         return false;
     }
     if (empty($email) || !rcms_is_valid_email($email)) {
         $this->results['registration'] = __('Invalid e-mail address');
         return false;
     }
     if (!user_check_email_in_cache($username, $email, $cache)) {
         $this->results['registration'] = __('This e-mail address already registered');
         return false;
     }
     if (!empty($this->config['regconf'])) {
         $password = $confirm = rcms_random_string(8);
     }
     if (empty($password) || empty($confirm) || $password != $confirm) {
         $this->results['registration'] = __('Password doesnot match it\'s confirmation');
         return false;
     }
     // If our user is first - we must set him an admin rights
     if ($this->is_empty_users()) {
         $_userdata['admin'] = '*';
         $arr_conf = parse_ini_file(CONFIG_PATH . 'config.ini');
         $arr_conf['admin_email'] = $email;
         write_ini_file($arr_conf, CONFIG_PATH . 'config.ini');
     } else {
         $_userdata['admin'] = ' ';
     }
     // Also we must set a md5 hash of user's password to userdata
     $_userdata['password'] = md5($password);
     $_userdata['nickname'] = $nickname;
     $_userdata['username'] = $username;
     $_userdata['email'] = $email;
     // Parse some system fields
     $userdata['hideemail'] = empty($userdata['hideemail']) ? '0' : '1';
     $userdata['tz'] = (double) @$userdata['tz'];
     foreach ($this->profile_fields as $field => $acc) {
         if ($acc <= USERS_ALLOW_SET || $acc == USERS_ALLOW_CHANGE) {
             if (!isset($userdata[$field])) {
                 $userdata[$field] = $this->profile_defaults[$field];
             } else {
                 $_userdata[$field] = strip_tags(trim($userdata[$field]));
             }
         }
     }
     foreach ($this->data['apf'] as $field => $desc) {
         $_userdata[$field] = strip_tags(trim($userdata[$field]));
     }
     if (!$this->save_user($username, $_userdata)) {
         $this->results['registration'] = __('Cannot save profile');
         return false;
     }
     user_register_in_cache($username, $nickname, $email, $cache);
     if (!empty($this->config['regconf'])) {
         $site_url = parse_url($this->url);
         rcms_send_mail($email, 'no_reply@' . $site_url['host'], __('Password'), $this->config['encoding'], __('Your password at') . ' ' . $site_url['host'], __('Your username at') . ' ' . $site_url['host'] . ': ' . $username . "\r\n" . __('Your password at') . ' ' . $site_url['host'] . ': ' . $password);
     }
     $this->results['registration'] = __('Registration complete. You can now login with your username and password.');
     rcms_log_put(__('Notification'), $this->user['username'], 'Registered account ' . $username);
     return true;
 }
开发者ID:Parashutik,项目名称:ReloadCMS,代码行数:77,代码来源:user-classes.php

示例13: str_replace

                        break;
                    case 'combobox':
                        $setting[$key]['value'] = $_POST[$key];
                        break;
                    case 'scandir':
                        $setting[$key]['value'] = $_POST[$key];
                        break;
                    default:
                        $e4ver = str_replace('"', "'", $_POST[$key]);
                        if (trim($setting[$key]['regular'])) {
                            if (preg_match($setting[$key]['regular'], $_POST[$key])) {
                                $setting[$key]['value'] = $e4ver;
                            } else {
                                $text .= $setting[$key]['rule'] . '<br>';
                            }
                        } else {
                            $setting[$key]['value'] = $e4ver;
                        }
                }
            }
            if ($text) {
                form("label", $text . '<br><a href="' . href(THIS, 2) . '">Назад</a>');
            } else {
                write_ini_file($setting, $adj);
                header("location:" . href(THIS, 1));
            }
        }
    }
} else {
    hrml(error(403));
}
开发者ID:cheevauva,项目名称:trash,代码行数:31,代码来源:index.php

示例14: Save_Config_Settings

function Save_Config_Settings()
{
    $config_settings_file_path = "config/config_settings.php";
    $config_database_file_path = "config/config_database.php";
    return write_ini_file($config_settings_file_path, $GLOBALS['config_settings']);
}
开发者ID:babbottscott,项目名称:X-Ray-Detective,代码行数:6,代码来源:core_config_handler.php

示例15: array

<?php

//获取用户提交的东西后
//试着下载
//print_r(parse_ini_file("TdxApi.License",true));
$sampleData = array('License' => array('ExpireDate' => $_POST['ExpireDate'], 'Trial' => $_POST['Trial'], 'MachineID' => $_POST['MachineID']), 'User' => array('Account' => $_POST['Account'], 'UserName' => $_POST['UserName']));
write_ini_file($sampleData, 'TdxApi.License', true);
echo exec('License.exe --License "TdxApi.License" --PrivateKey "TdxApi.PrivateKey"');
//打包两个文件
//exec();
function write_ini_file($assoc_arr, $path, $has_sections = FALSE)
{
    $content = "";
    if ($has_sections) {
        foreach ($assoc_arr as $key => $elem) {
            $content .= "[" . $key . "]\n";
            foreach ($elem as $key2 => $elem2) {
                if (is_array($elem2)) {
                    for ($i = 0; $i < count($elem2); $i++) {
                        $content .= $key2 . "[] = \"" . $elem2[$i] . "\"\n";
                    }
                } else {
                    if ($elem2 == "") {
                        $content .= $key2 . " = \n";
                    } else {
                        $content .= $key2 . " = \"" . $elem2 . "\"\n";
                    }
                }
            }
        }
    } else {
开发者ID:Strongc,项目名称:XAPI2,代码行数:31,代码来源:test.php


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