本文整理汇总了PHP中writeConfig函数的典型用法代码示例。如果您正苦于以下问题:PHP writeConfig函数的具体用法?PHP writeConfig怎么用?PHP writeConfig使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了writeConfig函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: initialize
function initialize()
{
$line = array();
$merchantArray = array();
$handle = @fopen('./litle_SDK_config.ini', "w");
if ($handle) {
print "Welcome to Litle PHP_SDK" . PHP_EOL;
print "Please input your user name: ";
$line['user'] = trim(fgets(STDIN));
print "Please input your password: ";
$line['password'] = trim(fgets(STDIN));
print "Please input your merchantId: ";
$line['currency_merchant_map ']['DEFAULT'] = trim(fgets(STDIN));
print "Please choose Litle url from the following list (example: 'cert') or directly input another URL: \nsandbox => https://www.testlitle.com/sandbox/communicator/online \ncert => https://cert.litle.com/vap/communicator/online \nprecert => https://precert.litle.com/vap/communicator/online \nproduction1 => https://payments.litle.com/vap/communicator/online \nproduction2 => https://payments2.litle.com/vap/communicator/online" . PHP_EOL;
$url = urlMapper(trim(fgets(STDIN)));
$line['url'] = $url;
print "Please input the proxy, if no proxy hit enter key: ";
$line['proxy'] = trim(fgets(STDIN));
writeConfig($line, $handle);
fwrite($handle, "version = 8.10" . PHP_EOL);
fwrite($handle, "timeout = 65" . PHP_EOL);
fwrite($handle, "reportGroup = planets" . PHP_EOL);
}
fclose($handle);
print "The Litle configuration file has been generated, the file is located in the lib directory" . PHP_EOL;
}
开发者ID:nengineer,项目名称:litle-cakePHP-integration,代码行数:26,代码来源:Setup.php
示例2: mergeDeprecatedConfig
/**
* Milestone 0.9 - shaarli/Shaarli#41: options.php is not supported anymore.
* ==> if user is loggedIn, merge its content with config.php, then delete options.php.
*
* @param array $config contains all configuration fields.
* @param bool $isLoggedIn true if user is logged in.
*
* @return void
*/
function mergeDeprecatedConfig($config, $isLoggedIn)
{
$config_file = $config['config']['CONFIG_FILE'];
if (is_file($config['config']['DATADIR'] . '/options.php') && $isLoggedIn) {
include $config['config']['DATADIR'] . '/options.php';
// Load GLOBALS into config
foreach ($GLOBALS as $key => $value) {
$config[$key] = $value;
}
$config['config']['CONFIG_FILE'] = $config_file;
writeConfig($config, $isLoggedIn);
unlink($config['config']['DATADIR'] . '/options.php');
}
}
开发者ID:ErwanLeroux,项目名称:Shaarli,代码行数:23,代码来源:Config.php
示例3: initialize
function initialize()
{
$line = array();
$merchantArray = array();
$handle = @fopen('./litle_SDK_config.ini', "w");
if ($handle) {
print "Welcome to Litle PHP_SDK" . PHP_EOL;
print "Please input your user name: ";
$line['user'] = trim(fgets(STDIN));
print "Please input your password: ";
$line['password'] = trim(fgets(STDIN));
print "Please input your merchantId: ";
$line['currency_merchant_map ']['DEFAULT'] = trim(fgets(STDIN));
print "Please choose Litle url from the following list (example: 'sandbox') or directly input another URL: \nsandbox => https://www.testlitle.com/sandbox/communicator/online \npostlive => https://postlive.litle.com/vap/communicator/online \ntransact-postlive => https://transact-postlive.litle.com/vap/communicator/online \nproduction => https://payments.litle.com/vap/communicator/online \nproduction-transact => https://transact.litle.com/vap/communicator/online \nprelive => https://prelive.litle.com/vap/communicator/online \ntransact-prelive => https://transact-prelive.litle.com/vap/communicator/online" . PHP_EOL;
$url = UrlMapper::getUrl(trim(fgets(STDIN)));
$line['url'] = $url;
print "Please input the proxy, if no proxy hit enter key: ";
$line['proxy'] = trim(fgets(STDIN));
print "Batch processing saves files to disk. \n";
print "Please input a directory to save these files. If you are not using batch processing, you may hit enter. ";
$dir = trim(fgets(STDIN));
$line['batch_requests_path'] = $dir;
$line['litle_requests_path'] = $dir;
print "Please input your SFTP username. If you are not using SFTP, you may hit enter. ";
$line['sftp_username'] = trim(fgets(STDIN));
print "Please input your SFTP password. If you are not using SFTP, you may hit enter. ";
$line['sftp_password'] = trim(fgets(STDIN));
print "Please input the URL for batch processing. If you are not using batch processing, you may hit enter. ";
$line['batch_url'] = trim(fgets(STDIN));
print "Please input the port for stream batch delivery. If you are not using stream batch delivery, you may hit enter. ";
$line['tcp_port'] = trim(fgets(STDIN));
print "Please input the timeout (in seconds) for stream batch delivery. If you are not using stream batch delivery, you may hit enter. ";
$line['tcp_timeout'] = trim(fgets(STDIN));
# ssl should be usd by default
$line['tcp_ssl'] = '1';
$line['print_xml'] = '0';
writeConfig($line, $handle);
fwrite($handle, "timeout = 65" . PHP_EOL);
fwrite($handle, "reportGroup = Default Report Group" . PHP_EOL);
}
fclose($handle);
print "The Litle configuration file has been generated, the file is located in the lib directory" . PHP_EOL;
}
开发者ID:huynp,项目名称:Critical,代码行数:43,代码来源:Setup.php
示例4: install
//.........这里部分代码省略.........
$conf['settings']['region']['date_format'] = $config['region']['date_format'];
$conf['settings']['region']['timezone'] = $config['region']['timezone'];
## Create Manifest directory structure
#
$install_log->pushToLog("WRITING: Creating 'manifest' folder (/manifest)", E_NOTICE, true, true);
if (!GeneralExtended::realiseDirectory($kDOCROOT . '/manifest', $conf['settings']['directory']['write_mode'])) {
define('_INSTALL_ERRORS_', "Could not create 'manifest' directory. Check permission on the root folder.");
$install_log->pushToLog("ERROR: Creation of 'manifest' folder failed.", E_ERROR, true, true);
installResult($Page, $install_log, $start);
return;
}
$install_log->pushToLog("WRITING: Creating 'logs' folder (/manifest/logs)", E_NOTICE, true, true);
if (!GeneralExtended::realiseDirectory($kDOCROOT . '/manifest/logs', $conf['settings']['directory']['write_mode'])) {
define('_INSTALL_ERRORS_', "Could not create 'logs' directory. Check permission on /manifest.");
$install_log->pushToLog("ERROR: Creation of 'logs' folder failed.", E_ERROR, true, true);
installResult($Page, $install_log, $start);
return;
}
$install_log->pushToLog("WRITING: Creating 'cache' folder (/manifest/cache)", E_NOTICE, true, true);
if (!GeneralExtended::realiseDirectory($kDOCROOT . '/manifest/cache', $conf['settings']['directory']['write_mode'])) {
define('_INSTALL_ERRORS_', "Could not create 'cache' directory. Check permission on /manifest.");
$install_log->pushToLog("ERROR: Creation of 'cache' folder failed.", E_ERROR, true, true);
installResult($Page, $install_log, $start);
return;
}
$install_log->pushToLog("WRITING: Creating 'tmp' folder (/manifest/tmp)", E_NOTICE, true, true);
if (!GeneralExtended::realiseDirectory($kDOCROOT . '/manifest/tmp', $conf['settings']['directory']['write_mode'])) {
define('_INSTALL_ERRORS_', "Could not create 'tmp' directory. Check permission on /manifest.");
$install_log->pushToLog("ERROR: Creation of 'tmp' folder failed.", E_ERROR, true, true);
installResult($Page, $install_log, $start);
return;
}
$install_log->pushToLog("WRITING: Configuration File", E_NOTICE, true, true);
if (!writeConfig($kDOCROOT . '/manifest/', $conf, $conf['settings']['file']['write_mode'])) {
define('_INSTALL_ERRORS_', "Could not write config file. Check permission on /manifest.");
$install_log->pushToLog("ERROR: Writing Configuration File Failed", E_ERROR, true, true);
installResult($Page, $install_log, $start);
}
$rewrite_base = trim(dirname($_SERVER['PHP_SELF']), '/');
if (strlen($rewrite_base) > 0) {
$rewrite_base .= '/';
}
$htaccess = '
### Symphony 2.0.x ###
Options +FollowSymlinks
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteBase /' . $rewrite_base . '
### DO NOT APPLY RULES WHEN REQUESTING "favicon.ico"
RewriteCond %{REQUEST_FILENAME} favicon.ico [NC]
RewriteRule .* - [S=14]
### IMAGE RULES
RewriteRule ^image\\/(.+\\.(jpg|gif|jpeg|png|bmp))$ extensions/jit_image_manipulation/lib/image.php?param=$1 [L,NC]
### CHECK FOR TRAILING SLASH - Will ignore files
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_URI} !/$
RewriteCond %{REQUEST_URI} !(.*)/$
RewriteRule ^(.*)$ $1/ [L,R=301]
### ADMIN REWRITE
RewriteRule ^symphony\\/?$ index.php?mode=administration&%{QUERY_STRING} [NC,L]
开发者ID:bauhouse,项目名称:sym-calendar,代码行数:67,代码来源:include.install.php
示例5: html_header
}
html_header();
if ($error != '') {
html_error();
} else {
if (isset($config['admin_username'])) {
setTmpConfig('step', STEP_FINALISE);
}
}
html_admin();
html_footer();
break;
case STEP_FINALISE:
// Finally check if everything is set up properly and tell the user so
// write real config file
writeConfig();
$page_title = $language['title_finished'];
html_header();
if ($error != '') {
html_error();
}
html_finish();
html_footer();
// delete temp config + created test images!!
$files_to_remove = array('albums/combined_generated.jpg', 'albums/giftest_generated.gif', 'albums/giftest_generated.jpg', 'albums/jpgtest_generated.jpg', 'albums/pngtest_generated.jpg', 'albums/pngtest_generated.png', 'albums/scaled_generated.jpg', 'albums/texttest_generated.jpg', 'include/config.tmp.php');
foreach ($files_to_remove as $file) {
if (is_file($file)) {
unlink($file);
}
}
break;
开发者ID:JoseCOCA,项目名称:baudprint,代码行数:31,代码来源:install.php
示例6: validateInput
function validateInput()
{
global $db, $html;
// do a check by step
if ($_REQUEST['step'] == '2') {
$db_details = $db->testConnection($_REQUEST['database_server'], $_REQUEST['database_name'], $_REQUEST['database_user'], $_REQUEST['database_password']);
if (!$db_details) {
echo $html['Error']['Database_Details'];
exit;
}
}
// update the config file if all is well
writeConfig();
}
开发者ID:CoryZ40,项目名称:templateblocks,代码行数:14,代码来源:index.php
示例7: testMergeDeprecatedConfigNoFile
/**
* Test mergeDeprecatedConfig while being logged in without options file.
*/
public function testMergeDeprecatedConfigNoFile()
{
writeConfig(self::$_configFields, true);
mergeDeprecatedConfig(self::$_configFields, true);
include self::$_configFields['config']['CONFIG_FILE'];
$this->assertEquals(self::$_configFields['login'], $GLOBALS['login']);
}
开发者ID:Eragos,项目名称:Shaarli,代码行数:10,代码来源:ConfigTest.php
示例8: install
function install()
{
global $core;
// On free.fr host, make sure the /sessions directory exists, otherwise login will not work.
if (endsWith($_SERVER['SERVER_NAME'], '.free.fr') && !is_dir($_SERVER['DOCUMENT_ROOT'] . '/sessions')) {
mkdir($_SERVER['DOCUMENT_ROOT'] . '/sessions', 0705);
}
if ($core->auth->sessionExists() && !empty($_POST['setlogin'])) {
$tz = 'UTC';
if (!empty($_POST['continent']) && !empty($_POST['city'])) {
if (isTZvalid($_POST['continent'], $_POST['city'])) {
$tz = $_POST['continent'] . '/' . $_POST['city'];
}
}
$GLOBALS['timezone'] = $tz;
// Everything is ok, let's create config file.
$GLOBALS['login'] = $core->auth->userID();
$GLOBALS['salt'] = sha1(uniqid('', true) . '_' . mt_rand());
// Salt renders rainbow-tables attacks useless.
$GLOBALS['hash'] = sha1($core->auth->userToken() . $GLOBALS['login'] . $GLOBALS['salt']);
$GLOBALS['title'] = empty($_POST['title']) ? 'Shared links on ' . htmlspecialchars(indexUrl()) : $_POST['title'];
writeConfig();
echo '<script language="JavaScript">alert("Shaarli is now configured !");document.location=\'\';</script>';
exit;
}
// Display config form:
list($timezone_form, $timezone_js) = templateTZform();
$timezone_html = '';
if ($timezone_form != '') {
$timezone_html = '<tr><td valign="top"><b>Timezone:</b></td><td>' . $timezone_form . '</td></tr>';
}
$PAGE = new pageBuilder();
$PAGE->assign('login_html', $core->auth->userID());
$PAGE->assign('timezone_html', $timezone_html);
$PAGE->assign('timezone_js', $timezone_js);
$PAGE->renderPage('install');
exit;
}
开发者ID:archcidburnziso,项目名称:Bilboplanet,代码行数:38,代码来源:index.php
示例9: performProcess
function performProcess()
{
global $blogPath;
echo '<p>Starting the process ... </p>';
readConfig();
writeConfig();
loadPosts();
echo '<p><strong>CONGRATULATIONS !! Your Pritlog installation has been updated to the 0.811</strong></p>';
echo '<p><a href="' . $blogPath . '">Home page</a></p>';
translationInfo();
}
开发者ID:hardkap,项目名称:pritlog,代码行数:11,代码来源:update.php
示例10: install
function install()
{
// On free.fr host, make sure the /sessions directory exists, otherwise login will not work.
if (endsWith($_SERVER['HTTP_HOST'], '.free.fr') && !is_dir($_SERVER['DOCUMENT_ROOT'] . '/sessions')) {
mkdir($_SERVER['DOCUMENT_ROOT'] . '/sessions', 0705);
}
// This part makes sure sessions works correctly.
// (Because on some hosts, session.save_path may not be set correctly,
// or we may not have write access to it.)
if (isset($_GET['test_session']) && (!isset($_SESSION) || !isset($_SESSION['session_tested']) || $_SESSION['session_tested'] != 'Working')) {
// Step 2: Check if data in session is correct.
echo '<pre>Sessions do not seem to work correctly on your server.<br>';
echo 'Make sure the variable session.save_path is set correctly in your php config, and that you have write access to it.<br>';
echo 'It currently points to ' . session_save_path() . '<br>';
echo 'Check that the hostname used to access Shaarli contains a dot. On some browsers, accessing your server via a hostname like \'localhost\' or any custom hostname without a dot causes cookie storage to fail. We recommend accessing your server via it\'s IP address or Fully Qualified Domain Name.<br>';
echo '<br><a href="?">Click to try again.</a></pre>';
die;
}
if (!isset($_SESSION['session_tested'])) {
// Step 1 : Try to store data in session and reload page.
$_SESSION['session_tested'] = 'Working';
// Try to set a variable in session.
header('Location: ' . index_url($_SERVER) . '?test_session');
// Redirect to check stored data.
}
if (isset($_GET['test_session'])) {
// Step 3: Sessions are OK. Remove test parameter from URL.
header('Location: ' . index_url($_SERVER));
}
if (!empty($_POST['setlogin']) && !empty($_POST['setpassword'])) {
$tz = 'UTC';
if (!empty($_POST['continent']) && !empty($_POST['city'])) {
if (isTimeZoneValid($_POST['continent'], $_POST['city'])) {
$tz = $_POST['continent'] . '/' . $_POST['city'];
}
}
$GLOBALS['timezone'] = $tz;
// Everything is ok, let's create config file.
$GLOBALS['login'] = $_POST['setlogin'];
$GLOBALS['salt'] = sha1(uniqid('', true) . '_' . mt_rand());
// Salt renders rainbow-tables attacks useless.
$GLOBALS['hash'] = sha1($_POST['setpassword'] . $GLOBALS['login'] . $GLOBALS['salt']);
$GLOBALS['title'] = empty($_POST['title']) ? 'Shared links on ' . escape(index_url($_SERVER)) : $_POST['title'];
$GLOBALS['config']['ENABLE_UPDATECHECK'] = !empty($_POST['updateCheck']);
try {
writeConfig($GLOBALS, isLoggedIn());
} catch (Exception $e) {
error_log('ERROR while writing config file after installation.' . PHP_EOL . $e->getMessage());
// TODO: do not handle exceptions/errors in JS.
echo '<script>alert("' . $e->getMessage() . '");document.location=\'?\';</script>';
exit;
}
echo '<script>alert("Shaarli is now configured. Please enter your login/password and start shaaring your links!");document.location=\'?do=login\';</script>';
exit;
}
// Display config form:
list($timezone_form, $timezone_js) = generateTimeZoneForm();
$timezone_html = '';
if ($timezone_form != '') {
$timezone_html = '<tr><td><b>Timezone:</b></td><td>' . $timezone_form . '</td></tr>';
}
$PAGE = new pageBuilder();
$PAGE->assign('timezone_html', $timezone_html);
$PAGE->assign('timezone_js', $timezone_js);
$PAGE->renderPage('install');
exit;
}
开发者ID:birdofpray70,项目名称:Shaarli,代码行数:67,代码来源:index.php
示例11: updateMethodMergeDeprecatedConfigFile
/**
* Move deprecated options.php to config.php.
*
* Milestone 0.9 (old versioning) - shaarli/Shaarli#41:
* options.php is not supported anymore.
*/
public function updateMethodMergeDeprecatedConfigFile()
{
$config_file = $this->config['config']['CONFIG_FILE'];
if (is_file($this->config['config']['DATADIR'] . '/options.php')) {
include $this->config['config']['DATADIR'] . '/options.php';
// Load GLOBALS into config
foreach ($GLOBALS as $key => $value) {
$this->config[$key] = $value;
}
$this->config['config']['CONFIG_FILE'] = $config_file;
writeConfig($this->config, $this->isLoggedIn);
unlink($this->config['config']['DATADIR'] . '/options.php');
}
return true;
}
开发者ID:toneiv,项目名称:Shaarli,代码行数:21,代码来源:Updater.php
示例12: install
//.........这里部分代码省略.........
$conf['settings']['commenting']['nuke-spam'] = 'on';
$conf['settings']['commenting']['ip-blacklist'] = '';
## Create Manifest directory structure
#
$install_log->pushToLog("WRITING: Creating 'manifest' folder (/manifest)", SYM_LOG_NOTICE, true, true);
if (!GeneralExtended::realiseDirectory($kDOCROOT . '/manifest', $conf['settings']['directory']['write_mode'])) {
define("_INSTALL_ERRORS_", "Could not create 'manifest' directory. Check permission on the root folder.");
$install_log->pushToLog("ERROR: Creation of 'manifest' folder failed.", SYM_LOG_ERROR, true, true);
installResult($Page, $install_log, $start);
return;
}
$install_log->pushToLog("WRITING: Creating 'logs' folder (/manifest/logs)", SYM_LOG_NOTICE, true, true);
if (!GeneralExtended::realiseDirectory($kDOCROOT . '/manifest/logs', $conf['settings']['directory']['write_mode'])) {
define("_INSTALL_ERRORS_", "Could not create 'logs' directory. Check permission on /manifest.");
$install_log->pushToLog("ERROR: Creation of 'logs' folder failed.", SYM_LOG_ERROR, true, true);
installResult($Page, $install_log, $start);
return;
}
$install_log->pushToLog("WRITING: Creating 'cache' folder (/manifest/cache)", SYM_LOG_NOTICE, true, true);
if (!GeneralExtended::realiseDirectory($kDOCROOT . '/manifest/cache', $conf['settings']['directory']['write_mode'])) {
define("_INSTALL_ERRORS_", "Could not create 'cache' directory. Check permission on /manifest.");
$install_log->pushToLog("ERROR: Creation of 'cache' folder failed.", SYM_LOG_ERROR, true, true);
installResult($Page, $install_log, $start);
return;
}
$install_log->pushToLog("WRITING: Creating 'tmp' folder (/manifest/tmp)", SYM_LOG_NOTICE, true, true);
if (!GeneralExtended::realiseDirectory($kDOCROOT . '/manifest/tmp', $conf['settings']['directory']['write_mode'])) {
define("_INSTALL_ERRORS_", "Could not create 'tmp' directory. Check permission on /manifest.");
$install_log->pushToLog("ERROR: Creation of 'tmp' folder failed.", SYM_LOG_ERROR, true, true);
installResult($Page, $install_log, $start);
return;
}
$install_log->pushToLog("WRITING: Configuration File", SYM_LOG_NOTICE, true, true);
if (!writeConfig($kDOCROOT . "/manifest/", $conf, $conf['settings']['file']['write_mode'])) {
define("_INSTALL_ERRORS_", "Could not write config file. Check permission on /manifest.");
$install_log->pushToLog("ERROR: Writing Configuration File Failed", SYM_LOG_ERROR, true, true);
installResult($Page, $install_log, $start);
}
$rewrite_base = dirname($_SERVER['PHP_SELF']);
$rewrite_base = trim($rewrite_base, '/');
if ($rewrite_base != "") {
$rewrite_base .= '/';
}
$htaccess = '
### Symphony 1.7 - Do not edit ###
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteBase /' . $rewrite_base . '
### DO NOT APPLY RULES WHEN REQUESTING "favicon.ico"
RewriteCond %{REQUEST_FILENAME} favicon.ico [NC]
RewriteRule .* - [S=14]
### IMAGE RULES
RewriteRule ^image/([0-9]+)\\/([0-9]+)\\/(0|1)\\/([a-fA-f0-9]{1,6})\\/external/([\\W\\w]+)\\.(jpg|gif|jpeg|png|bmp)$ /' . $rewrite_base . 'symphony/image.php?width=$1&height=$2&crop=$3&bg=$4&_f=$5.$6&external=true [L]
RewriteRule ^image/external/([\\W\\w]+)\\.(jpg|gif|jpeg|png|bmp)$ /' . $rewrite_base . 'symphony/image.php?width=0&height=0&crop=0&bg=0&_f=$1.$2&external=true [L]
RewriteRule ^image/([0-9]+)\\/([0-9]+)\\/(0|1)\\/([a-fA-f0-9]{1,6})\\/external/(.*)\\.(jpg|gif|jpeg|png|bmp)$ /' . $rewrite_base . 'symphony/image.php?width=$1&height=$2&crop=$3&bg=$4&_f=$5.$6&external=true [L]
RewriteRule ^image/external/(.*)\\.(jpg|gif|jpeg|png|bmp)$ /' . $rewrite_base . 'symphony/image.php?width=0&height=0&crop=0&bg=0&_f=$1.$2&external=true [L]
RewriteRule ^image/([0-9]+)\\/([0-9]+)\\/(0|1)\\/([a-fA-f0-9]{1,6})\\/([\\W\\w]+)\\.(jpg|gif|jpeg|png|bmp)$ /' . $rewrite_base . 'symphony/image.php?width=$1&height=$2&crop=$3&bg=$4&_f=$5.$6 [L]
RewriteRule ^image/([\\W\\w]+)\\.(jpg|gif|jpeg|png|bmp)$ /' . $rewrite_base . 'symphony/image.php?width=0&height=0&crop=0&bg=0&_f=$1.$2 [L]
RewriteRule ^image/([0-9]+)\\/([0-9]+)\\/(0|1)\\/([a-fA-f0-9]{1,6})\\/(.*)\\.(jpg|gif|jpeg|png|bmp)$ /' . $rewrite_base . 'symphony/image.php?width=$1&height=$2&crop=$3&bg=$4&_f=$5.$6 [L]
RewriteRule ^image/(.*)\\.(jpg|gif|jpeg|png|bmp)$ /' . $rewrite_base . 'symphony/image.php?width=0&height=0&crop=0&bg=0&_f=$1.$2 [L]
开发者ID:symphonycms,项目名称:symphony-1.7,代码行数:67,代码来源:install.php
示例13: sprintf
$trigger = sprintf("%s\t%s", $fnName, implode(' ', $fnPieces));
if (!empty($fnPieces)) {
$contents = $fnName;
foreach ($fnPieces as $n => $p) {
$contents .= sprintf(' ${%d:%s}', $n + 1, $p);
}
$config['completions'][] = array('trigger' => $trigger, 'contents' => $contents);
} else {
$config['completions'][] = $fnName;
}
}
}
function addApi(&$config)
{
$root = getNamespaces();
foreach ($root as $ns => $href) {
$fns = getNamespaceFunctions($ns, $href);
addNamespaceFunctionsToConfig($config, $ns, $fns);
}
}
function writeConfig($config, $filename)
{
$file = fopen($filename, 'w');
fwrite($file, json_encode($config));
fclose($file);
}
$config = array('scope' => 'source.clojure source.symbol.clojure', 'completions' => array());
addUseful($config);
addApi($config);
writeConfig($config, 'riemann.sublime-completions');
开发者ID:jarretth,项目名称:sublime-riemann-autocomplete,代码行数:30,代码来源:generate.php
示例14: install
function install()
{
// On free.fr host, make sure the /sessions directory exists, otherwise login will not work.
if (endsWith($_SERVER['HTTP_HOST'], '.free.fr') && !is_dir($_SERVER['DOCUMENT_ROOT'] . '/sessions')) {
mkdir($_SERVER['DOCUMENT_ROOT'] . '/sessions', 0705);
}
// This part makes sure sessions works correctly.
// (Because on some hosts, session.save_path may not be set correctly,
// or we may not have write access to it.)
if (isset($_GET['test_session']) && (!isset($_SESSION) || !isset($_SESSION['session_tested']) || $_SESSION['session_tested'] != 'Working')) {
// Step 2: Check if data in session is correct.
echo '<pre>Sessions do not seem to work correctly on your server.<br>';
echo 'Make sure the variable session.save_path is set correctly in your php config, and that you have write access to it.<br>';
echo 'It currently points to ' . session_save_path() . '<br><br><a href="?">Click to try again.</a></pre>';
die;
}
if (!isset($_SESSION['session_tested'])) {
// Step 1 : Try to store data in session and reload page.
$_SESSION['session_tested'] = 'Working';
// Try to set a variable in session.
header('Location: ' . indexUrl() . '?test_session');
// Redirect to check stored data.
}
if (isset($_GET['test_session'])) {
// Step 3: Sessions are ok. Remove test parameter from URL.
header('Location: ' . indexUrl());
}
if (!empty($_POST['setlogin']) && !empty($_POST['setpassword'])) {
$tz = 'UTC';
if (!empty($_POST['continent']) && !empty($_POST['city'])) {
if (isTZvalid($_POST['continent'], $_POST['city'])) {
$tz = $_POST['continent'] . '/' . $_POST['city'];
}
}
$GLOBALS['timezone'] = $tz;
// Everything is ok, let's create config file.
$GLOBALS['login'] = $_POST['setlogin'];
$GLOBALS['salt'] = sha1(uniqid('', true) . '_' . mt_rand());
// Salt renders rainbow-tables attacks useless.
$GLOBALS['hash'] = sha1($_POST['setpassword'] . $GLOBALS['login'] . $GLOBALS['salt']);
$GLOBALS['title'] = empty($_POST['title']) ? 'Shared links on ' . htmlspecialchars(indexUrl()) : $_POST['title'];
writeConfig();
echo '<script language="JavaScript">alert("Shaarli is now configured. Please enter your login/password and start shaaring your links !");document.location=\'?do=login\';</script>';
exit;
}
// Display config form:
list($timezone_form, $timezone_js) = templateTZform();
$timezone_html = '';
if ($timezone_form != '') {
$timezone_html = '<tr><td valign="top"><b>Timezone:</b></td><td>' . $timezone_form . '</td></tr>';
}
$PAGE = new pageBuilder();
$PAGE->assign('timezone_html', $timezone_html);
$PAGE->assign('timezone_js', $timezone_js);
$PAGE->renderPage('install');
exit;
}
开发者ID:l3dlp-forks,项目名称:Shaarli,代码行数:57,代码来源:index.php
示例15:
echo "<FONT COLOR=RED><B>Problems creating required tables were detected.</B> Please use the following error output to report a bug to http://sourceforge.net/tracker/?group_id=120663&atid=687790.<BR><BR>";
for ($i = 0, $totalerr = count($sqlerror); $i < $totalerr; $i++) {
echo "<B>Error " . $sqlerror[$i]["name"] . "</B>: " . $sqlerror[$i]["error"] . "<BR>";
}
echo "<BR> Please copy the above information into a new bugreport.<BR><BR></FONT>";
}
/*
* If requested, attempt to write a configuration file.
*/
if (isset($_POST["write_conf"]) ? strcmp($_POST["write_conf"], "checked") == 0 ? true : false : false) {
/*
* Hm, decide which username and password to put in the config file
*/
$cfgusername = $_POST["install_type"] == DB_USER_TABLES ? $_POST["newusername"] : $_POST["username"];
$cfgpassword = $_POST["install_type"] == DB_USER_TABLES ? $_POST["newpassword"] : $_POST["password"];
if (writeConfig($_POST["db_loc"], $cfgusername, $cfgpassword, $_POST["db_name"])) {
echo "<B><FONT COLOR=BLUE>config.php written.</FONT></B><BR><BR>";
} else {
echo "<B><FONT COLOR=RED>Can't create config.php, more than likely write permission denied.</FONT></B><BR><BR>";
}
} else {
echo "This script did NOT attempt to write a configuration file to the server. You will need to rename config_sample.php to config.php manually.<BR><BR>";
}
if ($tablescreated == count($query_list)) {
echo "<B><FONT COLOR=BLUE>Installation appears to have completed. Delete install.php and/or upgrade.php from your web server. Refer to the INSTALL for the rest of the installation procedure.</FONT></B>";
} else {
echo "<B><FONT COLOR=RED>Installation appears to have had errors. Please check and try again, if needed.</FONT></B>";
}
} else {
echo "<BR><FONT COLOR=RED><B>Some fields were not filled out.</B></FONT> Correct the errors and try again.";
}
开发者ID:pombredanne,项目名称:BittorrentDigitalPreservation,代码行数:31,代码来源:install.php
示例16: writeConfig
$dblink_temp->loadModule('Manager');
$dblink_temp->createDatabase($dbname);
if (MDB2::isError($dblink_temp)) {
echo "<p class=\"error\">Error when creating the database. Make sure you have the privileges to create a database and that a database with the same name doesn't exist.</p>";
$errorCreatingDB = true;
}
}
}
if (!$errorCreatingDB) {
// test database connection information
$conn_dsn = "{$dbtype}://{$dbuname}:{$dbpass}@{$dbhost}{$dbportStr}/{$dbname}";
$dblink = MDB2::connect($conn_dsn);
if (MDB2::isError($dblink)) {
echo "<p class=\"error\">A connection cannot be established with the database.</p>";
} else {
writeConfig($table_prefix, $dbhost, $dbport, $dbuname, $dbpass, $dbname, $dbtype);
$from_install = true;
include '../conn.php';
include '../includes/user.php';
$user = new User();
// Load the right shema structure
switch ($dbtype) {
case "mysqli":
case "mysql":
$structure = "mysql";
break;
case "pgsql":
$structure = "pgsql";
break;
}
// Create the tables from the sql file (with the script from phpBB)
开发者ID:noikiy,项目名称:owaspbwa,代码行数:31,代码来源:install.inc.php
示例17: int
$table = '`tbl_entries_data_' . $id . '`';
$frontend->Database->query('ALTER TABLE ' . $table . ' CHANGE `author_id` `author_id` int(11) unsigned NULL');
}
} catch (Exception $ex) {
}
}
if (version_compare($existing_version, '2.2.2 Beta 1', '<')) {
// Rename old variations of the query_caching configuration setting
if (isset($settings['database']['disable_query_caching'])) {
$settings['database']['query_caching'] = $settings['database']['disable_query_caching'] == "no" ? "on" : "off";
unset($settings['database']['disable_query_caching']);
}
// Add Session GC collection as a configuration parameter
$settings['symphony']['session_gc_divisor'] = '10';
// Save the manifest changes
writeConfig(DOCROOT . '/manifest', $settings, $settings['file']['write_mode']);
}
if (version_compare($existing_version, '2.2.2 Beta 2', '<')) {
try {
// Change Textareas to be MEDIUMTEXT columns
$textarea_tables = $frontend->Database->fetchCol("field_id", "SELECT `field_id` FROM `tbl_fields_textarea`");
foreach ($textarea_tables as $field) {
$frontend->Database->query(sprintf("ALTER TABLE `tbl_entries_data_%d` CHANGE `value` `value` MEDIUMTEXT, CHANGE `value_formatted` `value_formatted` MEDIUMTEXT", $field));
$frontend->Database->query(sprintf('OPTIMIZE TABLE `tbl_entries_data_%d`', $field));
}
} catch (Exception $ex) {
}
}
$sbl_version = $frontend->Database->fetchVar('version', 0, "SELECT `version` FROM `tbl_extensions` WHERE `name` = 'selectbox_link_field' LIMIT 1");
$code = sprintf($shell, ' <h1>Update Symphony <em>Version ' . kVERSION . '</em><em><a href="' . kCHANGELOG . '">change log</a></em></h1>
<h2>Update Complete</h2>
开发者ID:psychoticmeow,项目名称:symphony-2,代码行数:31,代码来源:update.php
示例18: adminPageAdvancedSubmit
//.........这里部分代码省略.........
}
if (isset($_POST['metaKeywords']) && trim($_POST['metaKeywords']) != "") {
$config['metaKeywords'] = $_POST['metaKeywords'];
}
if (isset($_POST['commentsMaxLength']) && trim($_POST['commentsMaxLength']) != "") {
$config['commentsMaxLength'] = $_POST['commentsMaxLength'];
}
if (isset($_POST['commentsForbiddenAuthors']) && trim($_POST['commentsForbiddenAuthors']) != "") {
$config['commentsForbiddenAuthors'] = $_POST['commentsForbiddenAuthors'];
}
if (isset($_POST['statsDontLog']) && trim($_POST['statsDontLog']) != "") {
$config['statsDontLog'] = $_POST['statsDontLog'];
}
if (isset($_POST['entriesOnRSS']) && trim($_POST['entriesOnRSS']) != "") {
$config['entriesOnRSS'] = $_POST['entriesOnRSS'];
}
if (isset($_POST['entriesPerPage']) && trim($_POST['entriesPerPage']) != "") {
$config['entriesPerPage'] = $_POST['entriesPerPage'];
}
if (isset($_POST['menuEntriesLimit']) && trim($_POST['menuEntriesLimit']) != "") {
$config['menuEntriesLimit'] = $_POST['menuEntriesLimit'];
}
if (isset($_POST['timeoutDuration']) && trim($_POST['timeoutDuration']) != "") {
$config['timeoutDuration'] = $_POST['timeoutDuration'];
}
if (isset($_POST['limitLogins']) && trim($_POST['limitLogins']) != "") {
$config['limitLogins'] = $_POST['limitLogins'];
}
if ($_POST['sendMailComments'] == 1) {
$config['sendMailWithNewComment'] = 1;
} else {
$config['sendMailWithNewComment'] = 0;
}
if ($_POST['commentsSecurityCode'] == 1) {
$config['commentsSecurityCode'] = 1;
} else {
$config['commentsSecurityCode'] = 0;
}
if ($_POST['authorEditPost'] == 1) {
$config['authorEditPost'] = 1;
} else {
$config['authorEditPost'] = 0;
}
if ($_POST['authorDeleteComment'] == 1) {
$config['authorDeleteComment'] = 1;
} else {
$config['authorDeleteComment'] = 0;
}
if ($_POST['showCategoryCloud'] == 1) {
$config['showCategoryCloud'] = 1;
} else {
$config['showCategoryCloud'] = 0;
}
if ($_POST['allowRegistration'] == 1) {
$config['allowRegistration'] = 1;
} else {
$config['allowRegistration'] = 0;
}
if ($_POST['sendRegistMail'] == 1) {
$config['sendRegistMail'] = 1;
} else {
$config['sendRegistMail'] = 0;
}
if ($_POST['commentModerate'] == 1) {
$config['commentModerate'] = 1;
} else {
$config['commentModerate'] = 0;
}
if ($_POST['cleanUrl'] == 1) {
$config['cleanUrl'] = 1;
} else {
$config['cleanUrl'] = 0;
}
if (isset($_POST['menuLinks'])) {
$config['menuLinks'] = $config['menuLinksOrig'] = str_replace("\r\n", ";", $_POST['menuLinks']);
}
if (isset($_POST['ipBan'])) {
$ipBanArray = explode("\r\n", $_POST['ipBan']);
@sqlite_query($config['db'], "DELETE FROM ipban");
foreach ($ipBanArray as $ipBan) {
$ipBan = trim($ipBan);
sqlite_query($config['db'], "INSERT INTO ipban (ip) VALUES ('{$ipBan}')");
}
}
if (isset($_POST['blogLanguage'])) {
$config['blogLanguage'] = $_POST['blogLanguage'];
}
if (isset($_POST['theme'])) {
$config['theme'] = $_POST['theme'];
}
if (isset($_POST['privacy'])) {
$config['privacy'] = $_POST['privacy'];
}
setConfigDefaults();
writeConfig(false);
return true;
} else {
return $lang['errorPasswordIncorrect'];
}
}
开发者ID:hardkap,项目名称:pritlog,代码行数:101,代码来源:index.php
|
请发表评论