Пример #1
0
 /**
  * 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);
 }
Пример #2
0
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;
    }
}
Пример #3
0
<?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();
Пример #4
0
<?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();
Пример #5
0
 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;
     }
 }
//   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();
Пример #7
0
//   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[]', ''));
Пример #8
0
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;
}
Пример #9
0
<?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();
Пример #10
0
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!"}';
    }
Пример #11
0
<?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();
Пример #12
0
 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;
 }
Пример #13
0
                        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));
}
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']);
}
Пример #15
0
<?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 {
Пример #16
0
function save_config($type = 'ini')
{
    global $INI;
    $q = array('db' => $INI['db'], 'memcache' => $INI['memcache']);
    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;
}
Пример #17
0
function build_installer($step)
{
    switch ($step) {
        case 0:
            return <<<HTML
<div class="message">
                <h2>Welcome to Tower21 WebComiX Manager</h2>
                <p>The following pages are designed to assist you in setting up your server to run this application. The application will assist you and your users in managing WebComiX and related projects.</p>
                <div align=center><button onclick="window.location='http://www.tower21studios.com'">Cancel</button> <button onclick="window.location='./app.php?action=install&step=1'">Get Started</button></div>
</div>
HTML;
            break;
        case 1:
            $types = pdo_drivers();
            @($host = getenv("IP"));
            @($uname = getenv("C9_USER"));
            $drivers = null;
            foreach ($types as $driver) {
                $drivers .= "<option>{$driver}</option>\n";
            }
            return <<<HTML
<form action="./app.php?action=install&step=2" method="post"><div class="form">
<h2>Set-up DataConnect</h2>
<p>This page is designed to help you set-up DataConnect to connect to the database software on your server. Please fill out the form below. Fields marked with and astrix '<span class="required">*</span>' are required.</p>
<table width="100%" border=0 cellspacing=1 cellpadding=1>
<tr>
<th colspan=2>Server</th>
</tr>
<tr>
<td align=right>Server Type<span class="required">*</span>:</td><td align=left><select required="required" name="database[driver]">{$drivers}</select></td>
</tr>
<tr>
<td align=right>Hostname/Address<span class="required">*</span>:</td><td align=left><input type="text" required="required" name="database[host]" value="{$host}"/></td>
</tr>
<tr>
<td align="right">Port:</td><td align="left"><input type="number" name="database[port]"></td>
</tr>
<tr>
<th colspan="2">Schema</th>
</tr>
<tr>
<td align="right">Database Name<span class="required">*</span>:</td><td align="left"><input type="text" required="required" name="schema[name]"/></td>
</tr>
<tr>
<td align="right">User<span class="required">*</span>:</td><td align="left"><input type="text" required=required name="schema[username]" value="{$uname}"/></td>
</tr>
<tr>
<td align="right">Password:</td><td align="left"><input type="password" name="schema[password]"/></td>
</tr>
<tr>
<td align="right">Table Prefix:</td><td align="left"><input type="text" name="schema[tableprefix]"/></td>
</tr>
<tr>
<td align="right"><button onclick="history.back()">Previous</button></td><td align="left"><button type="submit">Continue</button></td>
</tr>
</div></form>
HTML;
            break;
        case 2:
            if (!empty($_POST['database'])) {
                if (is_writable(dirname(__FILE__) . "/dataconnect/")) {
                    if (write_ini_file($_POST, dirname(__FILE__) . "/dataconnect/connect.ini")) {
                        header("Location:./app.php?action=install&step=2");
                    }
                }
            } else {
                return <<<HTML
<div class="message">
<h2>Create Database Tables</h2>
<p>With DataConnect set up you are now ready to create the tables that the WebComiX Manager requires in order to function. This may take a few moments.</p>
<div align=center><button onclick="history.back()">Previous</button> <button onclick="window.location='./app.php?action=install&step=3'">Continue</button></div>
</div>
HTML;
            }
            break;
        case 3:
            if (set_tables()) {
                $wcmroot = dirname($_SERVER['SCRIPT_FILENAME']);
                $wcmuri = $_SERVER['SERVER_NAME'] . dirname($_SERVER['REQUEST_URI']);
                return <<<HTML
<form action="./app.php?action=install&step=4" method="post"><div class="form">
<h2>Populate Tables</h2>
<p>Now that the database tables have been created we are ready to populate them with their default data, however, we need to know what some of that data should be. Fill out the form below to help us.</p>
<table width=100% border=0 cellspacing=1 cellpadding=1>
 <tr>
  <th colspan=2>Application Settings</th>
 </tr>
 <tr>
  <td align="right">Base URI:</td><td align="left"><input type="text" name="settings[base_uri]" title="The root location this application is run from including domain/ip address and root application folder" value="{$wcmuri}"></td>
 </tr>
 <tr>
  <td align="right">Server Root:</td><td align="left"><input type="text" name="settings[base_dir]" title="The actual folder the application is stored in on the server. Setting this prevents the application from guessing where it is, but could pose a security risk." value="{$wcmroot}"/></td>
 </tr>
 <tr>
  <td align="right">Projects Folder:</td><td align="left"><input type="text" name="settings[project_dir]" title="Root folder where files (PDF, Graphics, etc.) are stored for user projects relative to the server root." value="{$wcmroot}/projects"/></td>
 </tr>
 <tr>
  <td align="right">Allow Guest Views:</td><td align="left"><span title="Can users view ad-supported content without registering?"><input type="radio" name="settings[guest_views]" value="y" id="guest_y"><label for="guest_y">Yes</label><input type="radio" name="settings[guest_views]" value="n" id="guest_n"><label for="guest_n">No</label></span></td>
 </tr>
 <tr>
  <td align="right">Open Registration:</td><td align="left"><span title="Can users register themselves, or can they only be registered by admins i.e. by invitation?"><input type="radio" name="settings[open_registration]" value="y" id="or_y"><label for="or_y">Yes</label><input type="radio" name="settings[open_registration]" value="n" id="or_n"><label for="or_n">No</label></span></td>
 </tr>
 <tr>
  <th colspan=2>Default User Settings</th>
 </tr>
 <tr>
  <td align="right">Name:</td><td align="left"><input type="hidden" name="guest[name]" value="guest"><input type="text" name="null[name]" disabled=disabled value="[user specified]"></td>
 </tr>
 <tr>
  <td align="right">Level:</td><td align="lect"><input type="hidden" name="guest[level]" value=5><input type="text" name="null[level]" disabled=disabled value="Free User"></td>
 </tr>
 <tr>
  <td align="right">Date Format:</td><td align="left"><input type="text" name="guest[date_format]" value="m/d/Y"></td>
 </tr>
 <tr>
  <td align="right"># of Rows on an index page:</td><td align="left"><input type="number" name="guest[rows_per_page]" size=3 maxlength=2 value="6"></td>
 </tr>
 <tr>
  <td align="right"># Total items on an index page:</td><td align="left"><input type="number" name="guest[items_per_page]" size=4 maxlength=3 value="24"></td>
 </tr>
 <tr>
  <th colspan=2>Register Your User</th>
 </tr>
 <tr>
  <td align="right">User Name:</td><td align="left"><input type="text" name="admin[name]"></td>
 </tr>
 <tr>
  <td align="right">Password:</td><td align="left"><input type="password" name="admin[pass1]"></td>
 </tr>
 <tr>
  <td align="right">Confirm Password:</td><td align="left"><input type="password" name="admin[pass2]"></td>
 </tr>
 <tr>
  <td align="right">E-Mail:</td><td align="left"><input type="email" name="admin[email]"></td>
 </tr>
 <tr>
  <td colspan=2 align="center"><button type="submint">Save Settings</button></td>
 </tr>
 </table>
</div></form>
HTML;
            } else {
                echo "Failed!";
            }
            break;
        case 4:
            if (put_defaults($_POST['admin'], $_POST['guest'], $_POST['settings'])) {
                return <<<HTML
<div class="message">
<h2>Set-up Complete!</h2>
<p>Your server environment is now set up an ready to run this application!</p>
<div align="center"><button onclick="window.location='./?section=app&action=login'">Login</button> <button onclick="window.location='./'">Go to Main Index</button></div>
</div>
HTML;
            }
    }
}
Пример #18
0
<?php

////////////////////////////////////////////////////////////////////////////////
//   Copyright (C) ReloadCMS Development Team                                 //
//   http://reloadcms.com                                                     //
//   This product released under GNU General Public License v2                //
////////////////////////////////////////////////////////////////////////////////
if (!empty($_POST['nconfig']) && write_ini_file($_POST['nconfig'], CONFIG_PATH . 'search.ini')) {
    rcms_showAdminMessage(__('Configuration updated'));
}
$system->config = parse_ini_file(CONFIG_PATH . 'search.ini');
$config =& $system->config;
// Interface generation
$frm = new InputForm('', 'post', __('Submit'));
$frm->addbreak(__('Search engine configuration'));
$frm->addrow(__('Allow guests use searching'), $frm->checkbox('nconfig[guest]', '1', '', @$config['guest']));
$frm->addrow(__('Allow chose search source'), $frm->checkbox('nconfig[chose]', '1', '', @$config['chose']));
$frm->addrow(__('Check access level before search in article'), $frm->checkbox('nconfig[access]', '1', '', @$config['access']));
$frm->addrow(__('Min length'), $frm->text_box("nconfig[min]", @$config['min']));
$frm->addrow(__('Max length'), $frm->text_box("nconfig[max]", @$config['max']));
$frm->addrow(__('Output block length'), $frm->text_box("nconfig[block]", @$config['block']));
$frm->addrow(__('Editbox width'), $frm->text_box("nconfig[width]", @$config['width']));
$frm->show();
Пример #19
0
     }
     break;
     //---------------------------------------------------------
     // Query = changepwd
 //---------------------------------------------------------
 // Query = changepwd
 case "changepwd":
     if (!isset($_POST['password'])) {
         $display = "changePasswordPage";
     } elseif (empty($_POST['password'])) {
         $error[] = "The administration password cannot be empty. Go back to the <a href=\"admin.php?changepwd\">Change Password</a> page.";
         $display = "errorPage";
     } else {
         $_SESSION['settings']['Admin.Password'] = hash("sha256", $_POST['password']);
         // Persist the password into the settings file
         write_ini_file($_SESSION['settings'], GIMMETHEFILE_SETTINGS);
         $display = "passwordChangedPage";
     }
     break;
     //---------------------------------------------------------
     // Query = home
 //---------------------------------------------------------
 // Query = home
 case "home":
     $display = "homePage";
     break;
     //---------------------------------------------------------
     // Query = logout
 //---------------------------------------------------------
 // Query = logout
 case "logout":
Пример #20
0
$path = $path . "/" . session_id();
if (!file_exists($path)) {
    mkdir($path);
}
$Product = $row[strtolower("Product")];
$path1 = "{$path}/{$Product}.License";
$path2 = "{$path}/{$Product}.Signature";
?>
<!DOCTYPE HTML><html>
<head>
<meta charset="UTF-8">
<title>授权生成</title>
</head>
<body>
<?php 
if (write_ini_file(json_decode($content2, true), $path1, true)) {
    $LicensePath = $path1;
    echo "生成授权文件成功<br/>";
    $cmd = "cscript.exe {$VbsPath} \"{$LicensePath}\"";
    $ret = exec($cmd);
    //echo $ret;
    if ("OK" == $ret) {
        echo "编码转换成功<br/>";
    } else {
        echo "编码转换失败<br/>";
        return;
    }
    echo "<a href={$path1}>下载License文件,请鼠标右键->链接另存为</a><br/>";
    $PrivateKeyPath = "{$PrivateKeyDir}\\{$Product}\\{$Product}.PrivateKey";
    $cmd = "{$ExePath} --License \"{$LicensePath}\" --PrivateKey \"{$PrivateKeyPath}\" ";
    $ret = exec($cmd);
                        unset($user_new_data[$data['name']]);
                    }
                } else {
                    echo " * Player was not online: vote NOT claimed.\n";
                    unset($user_new_data[$data['name']]);
                }
            }
        }
    }
}
# Re-Merge the user data back into the original,
foreach ($user_new_data as $player => $data) {
    $user_data[$player] = $data;
}
# and write it back to the dat file
write_ini_file($user_data, $dat_file, true);
# Fin.
echo "==== MULTI-TIER VOTE REWARDS -- END: " . date('l jS \\of F Y h:i:s A') . " ====\n\n";
//
// SUPPORTING FUNCTIONS
//
// Get Player Faction ID
function get_faction_id($player)
{
    list($output, $exitval) = starnet_cmd('/player_info ' . $player);
    $faction_id = 0;
    foreach ($output as $line) {
        if (preg_match('/FACTION/', $line)) {
            $items = preg_split('/=/', $line);
            $tmp_array = preg_split('/=/', $items[1]);
            $faction_id = preg_replace('/,.+/', '', $tmp_array[0]);
Пример #22
0
			ON DUPLICATE KEY UPDATE
				login = :login,
				psw = :psw,
				key_api_test = :key_api_test, 
				key_api_prod = :key_api_prod, 
				gender = :gender, 
				first_name = :first_name,
				last_name = :last_name,
				society = :society,
				address = :address,
				zip = :zip,
				city = :city,
				phone = :phone,
				mail = :mail,
				dde = :dde,
				fde = :fde
				');
        $req->execute(array("login" => $login, "psw" => $psw, "key_api_test" => $key_api_test, "key_api_prod" => $key_api_prod, "gender" => $gender, "first_name" => $first_name, "last_name" => $last_name, "society" => $society, "address" => $address, "zip" => $zip, "city" => $city, "phone" => $phone, "mail" => $mail, "dde" => $dde, "fde" => $fde));
        //ADD CONFIG API TO INI FILE
        $sampleData = array('CONFIG' => array('login' => $login, 'password' => $psw, 'api_key' => $key_api_test));
        write_ini_file($sampleData, '../../class/utils/config.ini', true);
        //OUTPUT
        echo 'Vos informations ont bien été enregistrées';
    } else {
        //OUTPUT ERROR
        echo json_encode($error);
    }
} else {
    //OUTPUT ERROR
    echo json_encode($error);
}
Пример #23
0
/////////////////////////////////////////API///////////////////////////////////////////////
rcms_loadAdminLib('sitemap');
//$directory = 'http://'.$_SERVER['HTTP_HOST'] . dirname($_SERVER['SCRIPT_NAME'] . basename($_SERVER['SCRIPT_NAME']));
$directory = 'http://' . $_SERVER['HTTP_HOST'] . '/';
$priority = array('0.1' => '0.1', '0.2' => '0.2', '0.3' => '0.3', '0.4' => '0.4', '0.5' => '0.5', '0.6' => '0.6', '0.7' => '0.7', '0.8' => '0.8', '0.9' => '0.9', '1' => '1');
$changefreq = array('always' => 'always', 'hourly' => 'hourly', 'daily' => 'daily', 'weekly' => 'weekly', 'monthly' => 'monthly', 'yearly' => 'yearly', 'never' => 'never');
if (!empty($_POST['names']) && is_array($_POST['names'])) {
    $names = $_POST['changefreq'];
    foreach ($names as $name => $value) {
        if (in_array($name, $_POST['names'])) {
            $config[$name]['changefreq'] = $_POST['changefreq'][$name];
            $config[$name]['priority'] = $_POST['priority'][$name];
        }
    }
    if (write_ini_file($config, CONFIG_PATH . 'sitemap.ini', true)) {
        rcms_showAdminMessage(__('Configuration updated'));
    }
}
$config = @parse_ini_file(CONFIG_PATH . 'sitemap.ini', true);
/////////////////////////////////////Initialization/////////////////////////////////////////
if (!empty($_POST['create']) && !empty($_POST['filename'])) {
    $frm = new InputForm('', 'post', '&lt;&lt;&lt; ' . __('Back'));
    $frm->show();
    $sitemap = new SitemapGenerator($directory);
    $time = explode(" ", microtime());
    $time = $time[1];
    if (isset($_POST['sitemap_dat'])) {
        file_write_contents(DF_PATH . 'sitemap.dat', $_POST['sitemap_dat']);
    }
    //save new urls
// Update minichat configuration                                              //
////////////////////////////////////////////////////////////////////////////////
if (!empty($_POST['minichat_config'])) {
    if (empty($_POST['minichat_config']['allow_guests_view'])) {
        $_POST['minichat_config']['allow_guests_view'] = '0';
    }
    if (empty($_POST['minichat_config']['allow_guests_post'])) {
        $_POST['minichat_config']['allow_guests_post'] = '0';
    }
    if (empty($_POST['minichat_config']['allow_guests_enter_name'])) {
        $_POST['minichat_config']['allow_guests_enter_name'] = '0';
    }
    if (empty($_POST['minichat_config']['max_db_size'])) {
        $_POST['minichat_config']['max_db_size'] = $_POST['minichat_config']['messages_to_show'];
    }
    write_ini_file($_POST['minichat_config'], CONFIG_PATH . 'minichat.ini');
    rcms_showAdminMessage($lang['admincp']['minichat']['config']['updated']);
}
////////////////////////////////////////////////////////////////////////////////
// Interface generation                                                       //
////////////////////////////////////////////////////////////////////////////////
$minichat_config = parse_ini_file(CONFIG_PATH . "minichat.ini");
$frm = new InputForm("", "post", $lang['general']['submit']);
$frm->addbreak($lang['admincp']['minichat']['config']['full']);
$frm->addrow($lang['admincp']['minichat']['config']['msgperpage'], $frm->text_box('minichat_config[messages_to_show]', $minichat_config['messages_to_show'], 4));
$frm->addrow($lang['admincp']['minichat']['config']['maxmsglen'], $frm->text_box('minichat_config[max_message_len]', $minichat_config['max_message_len'], 4));
$frm->addrow($lang['admincp']['minichat']['config']['maxwrdlen'], $frm->text_box('minichat_config[max_word_len]', $minichat_config['max_word_len'], 4));
$frm->addrow($lang['admincp']['minichat']['config']['allgstview'], $frm->checkbox('minichat_config[allow_guests_view]', '1', '', $minichat_config['allow_guests_view']));
$frm->addrow($lang['admincp']['minichat']['config']['allgstpost'], $frm->checkbox('minichat_config[allow_guests_post]', '1', '', $minichat_config['allow_guests_post']));
$frm->addrow($lang['admincp']['minichat']['config']['allgstname'], $frm->checkbox('minichat_config[allow_guests_enter_name]', '1', '', $minichat_config['allow_guests_enter_name']));
$frm->addrow($lang['minichat']['maxbasesize'], $frm->text_box('minichat_config[max_db_size]', @$minichat_config['max_db_size']));
Пример #25
0
<?php

////////////////////////////////////////////////////////////////////////////////
//   Copyright (C) 2004 ReloadCMS Development Team                            //
//   http://reloadcms.sf.net                                                  //
//                                                                            //
//   This program is distributed in the hope that it will be useful,          //
//   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['nconfig'])) {
    write_ini_file($_POST['nconfig'], CONFIG_PATH . 'config.ini');
}
if (isset($_POST['meta_tags'])) {
    file_write_contents(DATA_PATH . "meta_tags.html", $_POST['meta_tags']);
}
if (isset($_POST['top'])) {
    file_write_contents(DATA_PATH . "top.html", $_POST['top']);
}
if (isset($_POST["welcome_mesg"])) {
    file_write_contents(DATA_PATH . 'intro.html', $_POST["welcome_mesg"]);
}
$system->loadConfiguration();
$config =& $system->config;
// Interface generation
$frm = new InputForm("", "post", $lang['general']['submit']);
$frm->addbreak($lang['admincp']['general']['config']['full']);
$frm->addrow($lang['admincp']['general']['config']['sitename'], $frm->text_box("nconfig[title]", $config['title'], 40));
$frm->addrow($lang['admincp']['general']['config']['siteurl'], $frm->text_box("nconfig[site_url]", $config['site_url'], 40));
Пример #26
0
<?php

////////////////////////////////////////////////////////////////////////////////
//   Copyright (C) ReloadCMS Development Team                                 //
//   http://reloadcms.com                                                     //
//   This product released under GNU General Public License v2                //
////////////////////////////////////////////////////////////////////////////////
if (!empty($_POST['forum_config']) && write_ini_file($_POST['forum_config'], CONFIG_PATH . 'forum.ini')) {
    rcms_showAdminMessage(__('Configuration updated'));
}
$forum_config = parse_ini_file(CONFIG_PATH . 'forum.ini');
// Interface generation
$frm = new InputForm('', 'post', __('Submit'));
$frm->addbreak(__('Forum'));
$frm->addrow(__('Length limit for topic title'), $frm->text_box('forum_config[max_topic_title]', @$forum_config['max_topic_title'], 5));
$frm->addrow(__('Length limit for topic text'), $frm->text_box('forum_config[max_topic_len]', @$forum_config['max_topic_len'], 5));
$frm->addrow(__('Length limit for post text'), $frm->text_box('forum_config[max_message_len]', @$forum_config['max_message_len'], 5));
$frm->show();
Пример #27
0
                    $content .= $key2 . " = \"" . $elem . "\"\n";
                }
            }
        }
    }
    if (!($handle = fopen($path, 'w'))) {
        return false;
    }
    if (!fwrite($handle, $content)) {
        return false;
    }
    fclose($handle);
    return true;
}
//读ini文件
function readini($name)
{
    if (file_exists(SEM_PATH . 'init/' . $name)) {
        $data = parse_ini_file(SEM_PATH . 'init/' . $name, true);
        if ($data) {
            return $data;
        }
    } else {
        return false;
    }
}
//用法
//
$sampleData = array('first' => array('first-1' => 1, 'first-2' => 2, 'first-3' => 3, 'first-4' => 4, 'first-5' => 5), 'second' => array('second-1' => 1, 'second-2' => 2, 'second-3' => 3, 'second-4' => 4, 'second-5' => 5));
write_ini_file($sampleData, './data.ini', true);
Пример #28
0
 /**
  * Generate the default configuration file from template and user inputs
  *
  * @param $entries
  * @throws GenericException
  */
 private function generate_config($entries)
 {
     try {
         if (file_exists($this->project . '/config.ini')) {
             return;
         }
         // Add runtime section
         $entries['runtime']['token_lifespan'] = 600;
         $entries['runtime']['default_layout'] = 'layout';
         // Write as ini config
         $result = write_ini_file($entries, $this->project . '/config.ini', true);
         if ($result === false) {
             throw new Exception('Cannot write config file');
         }
         chmod($this->project . '/config.ini', 0777);
     } catch (\Exception $e) {
         throw new GenericException($e->getMessage(), $e->getCode(), $e);
     }
 }
Пример #29
0
function checksock()
{
    /* Accept incoming requests and handle them as child processes */
    $client = @socket_accept($GLOBALS['sock']);
    //echo "Client " .$client ."\n";
    if (!$client === false) {
        // Read the input from the client &#8211; 1024 bytes
        //$input = socket_read($client, 1024);
        $status = @socket_get_status($client);
        $input = @socket_read($client, 2048);
        // Strip all white spaces from input
        echo "RAW " . $input . "\n";
        if ($input == '') {
            break;
        }
        //$output = ereg_replace("[ \t\n\r]","",$input).chr(0);
        //$output = ereg_replace("[ \t\n\r]","",$input);
        $output = explode(" ", $input);
        switch (strtolower($output[0])) {
            case 'white':
                $response = "Turn on white\n\n";
                socket_write($client, $response);
                socket_close($client);
                break;
            case '-get':
                if (isset($output[1])) {
                    switch (strtolower($output[1])) {
                        case 'sd':
                            $response = "Strobe Duration " . $GLOBALS['strobedelay'] . "\n";
                            socket_write($client, $response, strlen($response));
                            socket_close($client);
                            break;
                    }
                } else {
                    $response = shwhelp();
                    socket_write($client, $response, strlen($response));
                    socket_close($client);
                }
                break;
            case '-yard':
            case '-y':
                if (isset($output[1])) {
                    yardlight($output[1]);
                } else {
                    $response = "Missing power number 0-10\n";
                    socket_write($client, $response);
                    socket_close($client);
                }
                break;
            case '-color':
            case '-c':
                echo "In Color Case\n";
                echo "OUTPUT 1 " . $output[1] . "\n";
                if (isset($output[1])) {
                    echo "COLOR SET\n";
                    $colorv = explode(",", $output[1]);
                    echo "SIZE COLORV " . sizeof($colorv);
                    if (sizeof($colorv) == 3) {
                        $GLOBALS['rl'] = $colorv[0];
                        $GLOBALS['gl'] = $colorv[1];
                        $GLOBALS['bl'] = $colorv[2];
                        changecolor($colorv[0], $colorv[1], $colorv[2]);
                        $response = "Color R" . $GLOBALS['rl'] . " G" . $GLOBALS['gl'] . " B" . $GLOBALS['bl'] . "\n";
                        socket_write($client, $response);
                        socket_close($client);
                    }
                }
                break;
            case '-setcolor':
                echo "In SetColor Case\n";
                if (isset($output[1])) {
                    $colorv = explode(",", $output[1]);
                    if (sizeof($colorv) == 3) {
                        $response = "Color Set to\n";
                        $response .= "R " . $colorv[0] . " G " . $colorv[1] . " B " . $colorv[2];
                        socket_write($client, $response);
                        socket_close($client);
                        readini($GLOBALS['inifile']);
                        $GLOBALS['rl'] = $colorv[0];
                        $GLOBALS['gl'] = $colorv[1];
                        $GLOBALS['bl'] = $colorv[2];
                        $GLOBALS['ini_array']['color']['r'] = $GLOBALS['rl'];
                        $GLOBALS['ini_array']['color']['g'] = $GLOBALS['gl'];
                        $GLOBALS['ini_array']['color']['b'] = $GLOBALS['bl'];
                        $result = write_ini_file($GLOBALS['ini_array'], $GLOBALS['inifile']);
                    }
                }
                break;
            case '-red':
                $GLOBALS['rl'] = 10;
                $GLOBALS['gl'] = 0;
                $GLOBALS['bl'] = 0;
                changecolor($GLOBALS['rl'], $GLOBALS['gl'], $GLOBALS['bl']);
                break;
            case 'test':
                $response = "Testing\n\n";
                socket_write($client, $response);
                socket_close($client);
                looptest();
                break;
            case "-s":
                socket_write($client, listscene());
                socket_close($client);
                break;
            case "-snd":
                socket_write($client, listsound());
                socket_close($client);
                break;
            case "-sl":
                if (isset($output[1])) {
                    socket_write($client, showscene($output[1]));
                } else {
                    socket_write($client, "Need Scene ");
                }
                socket_close($client);
                break;
            case "-run":
                if (isset($output[1])) {
                    socket_write($client, runscene($output[1]));
                    socket_close($client);
                }
                break;
            case '-p':
            case '-P':
                //try to fork or background process
                if (isset($output[1])) {
                    /*socket_write($client, $output[1]);
                      socket_close($client);
                      return;*/
                    $c = getcwd() . '/bp.php ' . $output[1] . ' >bp.txt 2>&1 & echo $!';
                    //socket_write($client, $c);
                    $GLOBALS['runpid'] = system($c);
                    $status = system('ps aux | grep -i ' . $GLOBALS['runpid']);
                    //echo $status;
                    socket_write($client, $GLOBALS['runpid']);
                } else {
                    socket_write($client, "Scene Number Required");
                }
                socket_close($client);
                break;
            case '-pk':
                if (isset($output[1])) {
                    $status = system('sudo kill ' . $output[1]);
                    socket_write($client, $status);
                    socket_close($client);
                }
                break;
            case '-ps':
                if (isset($GLOBALS['runpid'])) {
                    $status = system('ps aux | grep -i ' . $GLOBALS['runpid'] . ' | grep -v grep');
                    socket_write($client, "PID STATUS " . $GLOBALS['runpid'] . " " . $status . " end");
                } else {
                    socket_write($client, "PID NOT SET");
                }
                socket_close($client);
                break;
            case '-reset':
                //we should try a reset process to get all the relays back to of
                break;
            case 'kill':
                $response = "Killing\n\n";
                socket_write($client, $response);
                socket_close($client);
                socket_close($GLOBALS['sock']);
                exit;
                break;
            case "--help":
            case "-help":
            case "--h":
            case "-h":
                $response = shwhelp();
                socket_write($client, $response, strlen($response));
                socket_close($client);
                break;
            default:
                $response = "default\n\n";
                socket_write($client, $response);
                socket_close($client);
                break;
        }
    }
    // Display output back to client
    //socket_write($client, $response);
    // Close the client (child) socket
    //socket_close($client);
}
Пример #30
0
<?php

////////////////////////////////////////////////////////////////////////////////
//   Copyright (C) ReloadCMS Development Team                                 //
//   http://reloadcms.com                                                     //
//   This product released under GNU General Public License v2                //
////////////////////////////////////////////////////////////////////////////////
if (!empty($_POST['nconfig']) && write_ini_file($_POST['nconfig'], CONFIG_PATH . 'avatars.ini')) {
    rcms_showAdminMessage(__('Configuration updated'));
}
$system->config = parse_ini_file(CONFIG_PATH . 'avatars.ini');
$config =& $system->config;
// Interface generation
$frm = new InputForm('', 'post', __('Submit'));
$frm->addbreak(__('Avatars configuration'));
$frm->addrow(__('Max height'), $frm->text_box("nconfig[avatars_h]", @$config['avatars_h']));
$frm->addrow(__('Max width'), $frm->text_box("nconfig[avatars_w]", @$config['avatars_w']));
$frm->addrow(__('Max size'), $frm->text_box("nconfig[avatars_size]", @$config['avatars_size']));
$frm->show();