本文整理汇总了PHP中SaveConfig函数的典型用法代码示例。如果您正苦于以下问题:PHP SaveConfig函数的具体用法?PHP SaveConfig怎么用?PHP SaveConfig使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了SaveConfig函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getConfig
$organisation_name = getConfig('organisation_name');
$domain = getConfig("domain");
$website = getConfig("website");
if (empty($domain)) {
$domain = $_SERVER['SERVER_NAME'];
}
if (empty($website)) {
$website = $_SERVER['SERVER_NAME'];
}
if (empty($organisation_name)) {
$organisation_name = $_SERVER['SERVER_NAME'];
}
$xormask = getConfig('xormask');
if (empty($xormask)) {
$xormask = md5(uniqid(rand(), true));
SaveConfig("xormask", $xormask, 0, 1);
}
define('XORmask', $xormask);
if (empty($_SESSION['csrf_token'])) {
$_SESSION['csrf_token'] = substr(md5(uniqid(mt_rand(), true)), rand(0, 32), rand(0, 32));
}
if (isset($_SESSION['lastactivity'])) {
$_SESSION['session_age'] = time() - $_SESSION['lastactivity'];
}
$_SESSION['lastactivity'] = time();
$GLOBALS["img_tick"] = '<span class="yes">Yes</span>';
$GLOBALS["img_cross"] = '<span class="no">No</span>';
$GLOBALS["img_view"] = '<span class="view">View</span>';
$GLOBALS['img_busy'] = '<img src="images/busy.gif" with="34" height="34" border="0" alt="Please wait" id="busyimage" />';
# if keys need expanding with 0-s
$checkboxgroup_storesize = 1;
示例2: foreach
}
$info = $default_config[$id];
$haserror = 0;
if (is_array($_POST['values'])) {
foreach ($_POST['values'] as $id => $value) {
if (isset($default_config[$id])) {
$info = $default_config[$id];
if ($id == 'website' || $id == 'domain') {
$value = str_replace('[DOMAIN]', '', $value);
$value = str_replace('[WEBSITE]', '', $value);
}
if (empty($value) && !$info['allowempty']) {
# Error($info['description']. ' ' . $GLOBALS['I18N']->get('cannot be empty'));
$haserror = $info['description'] . ' ' . $GLOBALS['I18N']->get('cannot be empty');
} else {
$haserror = SaveConfig($id, $value);
}
}
}
if (!$haserror) {
print '<div class="actionresult">' . s('Changes saved') . '</div>';
unset($id);
} else {
print '<div class="actionresult error">' . $haserror . '<br/>' . s('Changes not saved') . '</div>';
unset($id);
}
# Redirect("configure");
# exit;
}
$item = $_REQUEST['save'];
$item = str_replace('item_', '', $item);
示例3: usersMenus
include_once('ressources/class.users.menus.inc');
include_once('ressources/class.artica.inc');
include_once('ressources/class.mysql.inc');
include_once('ressources/class.ini.inc');
include_once('ressources/class.cyrus.inc');
include_once('ressources/class.cron.inc');
$users=new usersMenus();
if(!$users->AsPostfixAdministrator){
$tpl=new templates();
$error=$tpl->javascript_parse_text("{ERROR_NO_PRIVS}");
echo "alert('$error')";
die();
}
if(isset($_GET["EnableZarafaIndexer"])){SaveConfig();exit;}
popup();
function popup(){
$tpl=new templates();
$page=CurrentPageName();
$sock=new sockets();
$EnableZarafaIndexer=$sock->GET_INFO("EnableZarafaIndexer");
$ZarafaIndexerInterval=$sock->GET_INFO("ZarafaIndexerInterval");
$ZarafaIndexerThreads=$sock->GET_INFO("ZarafaIndexerThreads");
if(!is_numeric($ZarafaIndexerInterval)){$ZarafaIndexerInterval=60;}
示例4: SaveConfig
SaveConfig('pagefooter', $defaultfooter, 1);
Sql_Query(sprintf('update %s set data = "%s" where name = "footer" and data = "%s"', $tables['subscribepage_data'], sql_escape($defaultfooter), addslashes($currentPF)));
}
}
}
## #17328 - remove list categories with quotes
Sql_Query(sprintf("update %s set category = replace(category,\"\\\\'\",\" \")", $tables['list']));
## longblobs are better at mixing character encoding. We don't know the encoding of anything we may want to store in cache
## before converting, it's quickest to clear the cache
clearPageCache();
Sql_Query(sprintf('alter table %s change column content content longblob', $tables['urlcache']));
# mark the database to be our current version
if ($success) {
SaveConfig('version', VERSION, 0);
# mark now to be the last time we checked for an update
SaveConfig('updatelastcheck', date('Y-m-d H:i:s', time()), 0, true);
## also clear any possible value for "updateavailable"
Sql_Query(sprintf('delete from %s where item = "updateavailable"', $tables['config']));
Info(s('Success'), 1);
upgradePlugins(array_keys($GLOBALS['plugins']));
print subscribeToAnnouncementsForm();
## check for old click track data
$num = Sql_Fetch_Row_Query(sprintf('select count(*) from %s', $GLOBALS['tables']['linktrack']));
if ($num[0] > 0) {
print '<p class="information">' . $GLOBALS['I18N']->get('The clicktracking system has changed') . '</p>';
printf($GLOBALS['I18N']->get('You have %s entries in the old statistics table'), $num[0]) . ' ';
print ' ' . PageLinkButton('convertstats', $GLOBALS['I18N']->get('Convert Old data to new'));
}
if ($GLOBALS['commandline']) {
output($GLOBALS['I18N']->get('Upgrade successful'));
}
示例5: Sql_Query
$owner = $_POST["owner"];
if (!$owner) {
$owner = $_SESSION['logindetails']['id'];
}
if ($id) {
Sql_Query(sprintf('update %s set title = "%s",owner = %d where id = %d', $tables["subscribepage"], $title, $owner, $id));
} else {
Sql_Query(sprintf('insert into %s (title,owner) values("%s",%d)', $tables["subscribepage"], $title, $owner));
$id = Sql_Insert_id();
}
Sql_Query(sprintf('delete from %s where id = %d', $tables["subscribepage_data"], $id));
foreach (array("title", "intro", "header", "footer", "thankyoupage", "button", "htmlchoice", "emaildoubleentry") as $item) {
Sql_Query(sprintf('insert into %s (name,id,data) values("%s",%d,"%s")', $tables["subscribepage_data"], $item, $id, $_POST[$item]));
}
foreach (array("subscribesubject", "subscribemessage", "confirmationsubject", "confirmationmessage") as $item) {
SaveConfig("{$item}:{$id}", stripslashes($_POST[$item]), 0);
}
Sql_Query(sprintf('delete from %s where id = %d and name like "attribute___"', $tables["subscribepage_data"], $id));
if (is_array($attr_use)) {
$cnt = 0;
$attributes = "";
while (list($att, $val) = each($attr_use)) {
$default = $attr_default[$att];
$order = $attr_listorder[$att];
$required = $attr_required[$att];
Sql_Query(sprintf('insert into %s (id,name,data) values(%d,"attribute%03d","%s")', $tables["subscribepage_data"], $id, $att, $att . '###' . $default . '###' . $order . '###' . $required));
$cnt++;
$attributes .= $att . '+';
}
}
Sql_Query(sprintf('replace into %s (id,name,data) values(%d,"attributes","%s")', $tables["subscribepage_data"], $id, $attributes));
示例6: ob_start
ob_start();
include dirname(__FILE__) . '/actions/processqueue.php';
return;
}
# once and for all get rid of those questions why they do not receive any emails :-)
if (TEST) {
print Info('<strong>' . $GLOBALS['I18N']->get('Running in testmode, no emails will be sent. Check your config file.'), 1) . '</strong>';
}
print '<noscript>
<div class="error">' . s('This page requires Javascript to be enabled.') . '</div>
</noscript>';
if (isset($_GET['pqchoice'])) {
if ($_GET['pqchoice'] == 'local') {
SaveConfig('pqchoice', 'local', 0);
} elseif ($_GET['pqchoice'] == 'reset') {
SaveConfig('pqchoice', '', 0);
}
}
if (SHOW_PQCHOICE) {
$pqChoice = getConfig('pqchoice');
} else {
$pqChoice = 'local';
}
if (empty($pqChoice)) {
print '<h3>' . s('To send your queue, you can now use the phpList.com service') . '</h3>';
print '<strong>The options are:</strong>';
print '<h4>1. Use the service from phpList.com</h4>
<p>The service has a free trial and low cost.</p>
<p><strong>Advantage</strong>: No need to keep your computer switched on and your browser open. <strong>Sending will happen automatically</strong>.</p>
<p><strong>Disadvantage</strong>: We can\'t think of any.</p>
<a href="./?page=hostedprocessqueuesetup" class="button">' . s('Set up using the service') . '</a>
示例7: time
$now = time();
foreach ($cronJobs as $cronJob) {
$cronID = $cronJob['plugin'] . '|' . $cronJob['page'];
$lastrun = getConfig(md5($cronID));
if (empty($lastrun) || $now - $lastrun > $cronJob['frequency'] * 60) {
cl_output('Need to run ' . $cronJob['plugin'] . ' - ' . $cronJob['page']);
$cronJob['page'] = basename($cronJob['page'], '.php');
$cmd_result = '';
if (isset($GLOBALS['plugins'][$cronJob['plugin']]) && is_file($GLOBALS['plugins'][$cronJob['plugin']]->coderoot . $cronJob['page'] . '.php')) {
cl_output('running php ' . $argv[0] . ' -c ' . $GLOBALS['configfile'] . ' -m ' . $cronJob['plugin'] . ' -p ' . $cronJob['page']);
exec('php ' . $argv[0] . ' -c ' . $GLOBALS['configfile'] . ' -m ' . $cronJob['plugin'] . ' -p ' . $cronJob['page'], $cmd_result);
} elseif (empty($cronJob['plugin']) && is_file(__DIR__ . '/' . $cronJob['page'] . '.php')) {
cl_output('running php ' . $argv[0] . ' -c ' . $GLOBALS['configfile'] . ' -p ' . $cronJob['page']);
exec('php ' . $argv[0] . ' -c ' . $GLOBALS['configfile'] . ' -p ' . $cronJob['page'], $cmd_result);
}
SaveConfig(md5($cronID), time(), 0);
} else {
$nextRun = $lastrun + $cronJob['frequency'] * 60 - $now;
if ($nextRun > $maxNextRun) {
$maxNextRun = $nextRun;
}
if (VERBOSE) {
cl_output('Will run ' . $cronJob['plugin'] . ' - ' . $cronJob['page'] . ' in' . secs2time($nextRun));
}
}
}
## tell how soon we need to run again, so that the calling system can relax a bit
if ($maxNextRun > 0) {
cl_output('DELAYUNTIL=' . (int) ($now + $maxNextRun));
}
#var_dump($cronJobs);
示例8: SaveConfig
SaveConfig('message_from_name', strip_tags($_REQUEST['adminname']), 1);
SaveConfig('campaignfrom_default', "{$adminemail} " . strip_tags($_REQUEST['adminname']));
SaveConfig('notifystart_default', $adminemail);
SaveConfig('notifyend_default', $adminemail);
SaveConfig('report_address', $adminemail);
SaveConfig('message_from_address', $adminemail);
SaveConfig('message_from_name', strip_tags($_REQUEST['adminname']));
SaveConfig('message_replyto_address', $adminemail);
if (!empty($_REQUEST['orgname'])) {
SaveConfig('organisation_name', strip_tags($_REQUEST['orgname']), 1);
SaveConfig('campaignfrom_default', "{$adminemail} " . strip_tags($_REQUEST['orgname']));
SaveConfig('message_from_name', strip_tags($_REQUEST['orgname']));
} elseif (!empty($_REQUEST['adminname'])) {
SaveConfig('organisation_name', strip_tags($_REQUEST['adminname']), 1);
} else {
SaveConfig('organisation_name', strip_tags($_REQUEST['adminemail']), 1);
}
# add a testlist
$info = $GLOBALS['I18N']->get('List for testing');
$result = Sql_query("insert into {$tables['list']} (name,description,entered,active,owner) values(\"test\",\"{$info}\",now(),0,1)");
$info = s('Sign up to our newsletter');
$result = Sql_query("insert into {$tables['list']} (name,description,entered,active,owner) values(\"newsletter\",\"{$info}\",now(),1,1)");
## add the admin to the lists
Sql_Query(sprintf('insert into %s (listid, userid, entered) values(%d,%d,now())', $tables['listuser'], 1, $userid));
Sql_Query(sprintf('insert into %s (listid, userid, entered) values(%d,%d,now())', $tables['listuser'], 2, $userid));
$uri = $_SERVER['REQUEST_URI'];
$uri = str_replace('?' . $_SERVER['QUERY_STRING'], '', $uri);
$body = '
Version: ' . VERSION . "\r\n" . ' Url: ' . $_SERVER['SERVER_NAME'] . $uri . "\r\n";
printf('<p class="information">' . $GLOBALS['I18N']->get('Success') . ': <a class="button" href="mailto:info@phplist.com?subject=Successful installation of phplist&body=%s">' . $GLOBALS['I18N']->get('Tell us about it') . '</a>. </p>', $body);
//printf('<p class="information">
示例9: Setup4
function Setup4()
{
global $zbp;
?>
<dl>
<dt></dt>
<dd id="ddleft"><div id="headerimg"><img src="../zb_system/image/admin/install.png" alt="Z-BlogPHP" />
<strong><?php
echo $zbp->lang['zb_install']['install_program'];
?>
</strong></div>
<div class="left"><?php
echo $zbp->lang['zb_install']['install_progress'];
?>
</div>
<div id="setup4" class="left"></div>
<p><b><?php
echo $zbp->lang['zb_install']['install_license'];
?>
</b> » <b><?php
echo $zbp->lang['zb_install']['environment_check'];
?>
</b> » <b><?php
echo $zbp->lang['zb_install']['db_build_set'];
?>
</b> » <b><?php
echo $zbp->lang['zb_install']['install_result'];
?>
</b></p>
</dd>
<dd id="ddright">
<div id="title"><?php
echo $zbp->lang['zb_install']['install_result'];
?>
</div>
<div id="content">
<?php
$isInstallFlag = true;
$zbp->option['ZC_DATABASE_TYPE'] = GetVars('dbtype', 'POST');
$cts = '';
switch ($zbp->option['ZC_DATABASE_TYPE']) {
case 'mysql':
case 'mysqli':
case 'pdo_mysql':
$cts = file_get_contents($GLOBALS['blogpath'] . 'zb_system/defend/createtable/mysql.sql');
if ($zbp->option['ZC_YUN_SITE'] != '') {
break;
}
$zbp->option['ZC_MYSQL_SERVER'] = GetVars('dbmysql_server', 'POST');
if (strpos($zbp->option['ZC_MYSQL_SERVER'], ':') !== false) {
$servers = explode(':', $zbp->option['ZC_MYSQL_SERVER']);
$zbp->option['ZC_MYSQL_SERVER'] = trim($servers[0]);
$zbp->option['ZC_MYSQL_PORT'] = (int) $servers[1];
if ($zbp->option['ZC_MYSQL_PORT'] == 0) {
$zbp->option['ZC_MYSQL_PORT'] = 3306;
}
unset($servers);
}
$zbp->option['ZC_MYSQL_USERNAME'] = trim(GetVars('dbmysql_username', 'POST'));
$zbp->option['ZC_MYSQL_PASSWORD'] = trim(GetVars('dbmysql_password', 'POST'));
$zbp->option['ZC_MYSQL_NAME'] = trim(str_replace(array('\'', '"'), array('', ''), GetVars('dbmysql_name', 'POST')));
$zbp->option['ZC_MYSQL_PRE'] = trim(str_replace(array('\'', '"'), array('', ''), GetVars('dbmysql_pre', 'POST')));
if ($zbp->option['ZC_MYSQL_PRE'] == '') {
$zbp->option['ZC_MYSQL_PRE'] == 'zbp_';
}
$zbp->option['ZC_MYSQL_ENGINE'] = GetVars('dbengine', 'POST');
$cts = str_replace('MyISAM', $zbp->option['ZC_MYSQL_ENGINE'], $cts);
$zbp->db = ZBlogPHP::InitializeDB($zbp->option['ZC_DATABASE_TYPE']);
if ($zbp->db->CreateDB($zbp->option['ZC_MYSQL_SERVER'], $zbp->option['ZC_MYSQL_PORT'], $zbp->option['ZC_MYSQL_USERNAME'], $zbp->option['ZC_MYSQL_PASSWORD'], $zbp->option['ZC_MYSQL_NAME']) == true) {
echo $zbp->lang['zb_install']['create_db'] . $zbp->option['ZC_MYSQL_NAME'] . "<br/>";
}
$zbp->db->dbpre = $zbp->option['ZC_MYSQL_PRE'];
$zbp->db->Close();
break;
case 'sqlite':
$cts = file_get_contents($GLOBALS['blogpath'] . 'zb_system/defend/createtable/sqlite.sql');
$cts = str_replace(' autoincrement', '', $cts);
$zbp->option['ZC_SQLITE_NAME'] = trim(GetVars('dbsqlite_name', 'POST'));
$zbp->option['ZC_SQLITE_PRE'] = trim(GetVars('dbsqlite_pre', 'POST'));
break;
case 'sqlite3':
case 'pdo_sqlite':
$cts = file_get_contents($GLOBALS['blogpath'] . 'zb_system/defend/createtable/sqlite.sql');
$zbp->option['ZC_SQLITE_NAME'] = trim(GetVars('dbsqlite_name', 'POST'));
$zbp->option['ZC_SQLITE_PRE'] = trim(GetVars('dbsqlite_pre', 'POST'));
break;
default:
$isInstallFlag = false;
break;
}
if ($isInstallFlag) {
$zbp->OpenConnect();
$zbp->ConvertTableAndDatainfo();
if (CreateTable($cts)) {
InsertInfo();
SaveConfig();
}
$zbp->CloseConnect();
} else {
echo '<p>还没有选择数据库类型,请后退重试。</p><p><a href="javascript:history.go(-1)">点击这里后退</a></p>';
//.........这里部分代码省略.........
示例10: upgradePlugins
function upgradePlugins($toUpgrade)
{
foreach ($toUpgrade as $pluginname) {
# print '<h2>Upgrading '.$pluginname. '</h2><br/> ';
# print md5('plugin-'.$pluginname.'-versiondate');
$currentDate = getConfig(md5('plugin-' . $pluginname . '-versiondate'));
# print 'CUrrent '.$currentDate;
if ($GLOBALS['allplugins'][$pluginname]->upgrade($currentDate)) {
# print "Saving ".'plugin-'.$pluginname.'-versiondate';
SaveConfig(md5('plugin-' . $pluginname . '-versiondate'), date('Y-m-d'), 0);
}
}
}
示例11: Sql_Fetch_Row_Query
$needscheck = Sql_Fetch_Row_Query($query);
if ($needscheck[0] != "0") {
@ini_set("user_agent", NAME . " (phplist version " . VERSION . ")");
@ini_set("default_socket_timeout", 5);
if ($fp = @fopen("https://www.phplist.com/files/LATESTVERSION", "r")) {
$latestversion = fgets($fp);
$latestversion = preg_replace("/[^\\.\\d]/", "", $latestversion);
@fclose($fp);
if (!versionCompare($thisversion, $latestversion)) {
## remember this, so we can remind about the update, without the need to check the phplist site
## hmmm, this causes it to be "stuck" on the last version checked
SaveConfig("updateavailable", $latestversion, 0, true);
$showUpdateAvail = true;
}
}
SaveConfig("updatelastcheck", date("Y-m-d H:i:s", time()), 0, true);
}
}
if ($showUpdateAvail) {
print '<div class="newversion note">';
print $GLOBALS['I18N']->get('A new version of phpList is available!');
print '<br/>';
print '<br/>' . $GLOBALS['I18N']->get('The new version may have fixed security issues,<br/>so it is recommended to upgrade as soon as possible');
print '<br/>' . $GLOBALS['I18N']->get('Your version') . ': <b>' . $thisversion . '</b>';
print '<br/>' . $GLOBALS['I18N']->get('Latest version') . ': <b>' . $latestversion . '</b><br/> ';
print '<a href="https://www.phplist.com/latestchanges?utm_source=pl' . $thisversion . '&utm_medium=updatenews&utm_campaign=phpList" title="' . s('Read what has changed in the new version') . '" target="_blank">' . $GLOBALS['I18N']->get('View what has changed') . '</a> ';
print '<a href="https://www.phplist.com/download?utm_source=pl' . $thisversion . '&utm_medium=updatedownload&utm_campaign=phpList" title="' . s('Download the new version') . '" target="_blank">' . $GLOBALS['I18N']->get('Download') . '</a></div>';
}
print '<div class="accordion">';
$some = 0;
$ls = new WebblerListing('');
示例12: MergeSettings
MergeSettings($config, $_REQUEST);
$OK = SaveConfig($config);
if ($OK) {
Redirect('config.php?section=' . $_REQUEST['section']);
}
} else {
if (isset($_REQUEST['delete'])) {
DeleteMultiSet($config, $_REQUEST['section'], $_REQUEST['delete'], $_REQUEST['id']);
$OK = SaveConfig($config);
if ($OK) {
Redirect('config.php?section=' . $_REQUEST['section']);
}
} else {
if (isset($_REQUEST['add'])) {
AddMultiSet($config, $_REQUEST['section'], $_REQUEST['add']);
$OK = SaveConfig($config);
if ($OK) {
Redirect('config.php?section=' . $_REQUEST['section'] . '#' . $_REQUEST['add'] . $_REQUEST['id']);
}
}
}
}
}
if ($OK) {
?>
<table width="100%">
<tr>
<td valign="top" width="270">
<?php
MakeMenu();
示例13: get_filesystem_image
public function get_filesystem_image($filename)
{
if (defined('EMBEDEXTERNALIMAGES') && EMBEDEXTERNALIMAGES) {
$extCacheDir = $GLOBALS['tmpdir'] . '/external_cache';
$cacheFile = $extCacheDir . '/' . $this->messageid . '_' . preg_replace(array('~[\\.][\\.]+~i', '~[^\\w\\.]~i'), array('', '_'), $filename);
if (file_exists($cacheFile) && @filesize($cacheFile) > 64) {
return base64_encode(file_get_contents($cacheFile));
}
}
## get the image contents
$localfile = basename(urldecode($filename));
# cl_output('get file system image'.$filename.' '.$localfile);
if (defined('UPLOADIMAGES_DIR')) {
# print 'UPLOAD';
$imageroot = getConfig('uploadimageroot');
if (is_file($imageroot . $localfile)) {
return base64_encode(file_get_contents($imageroot . $localfile));
} else {
if (is_file($_SERVER['DOCUMENT_ROOT'] . $localfile)) {
## save the document root to be able to retrieve the file later from commandline
SaveConfig('uploadimageroot', $_SERVER['DOCUMENT_ROOT'], 0, 1);
return base64_encode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . $localfile));
} elseif (is_file($_SERVER['DOCUMENT_ROOT'] . '/' . UPLOADIMAGES_DIR . '/image/' . $localfile)) {
SaveConfig('uploadimageroot', $_SERVER['DOCUMENT_ROOT'] . '/' . UPLOADIMAGES_DIR . '/image/', 0, 1);
return base64_encode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . '/' . UPLOADIMAGES_DIR . '/image/' . $localfile));
} elseif (is_file($_SERVER['DOCUMENT_ROOT'] . '/' . UPLOADIMAGES_DIR . '/' . $localfile)) {
SaveConfig('uploadimageroot', $_SERVER['DOCUMENT_ROOT'] . '/' . UPLOADIMAGES_DIR . '/', 0, 1);
return base64_encode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . '/' . UPLOADIMAGES_DIR . '/' . $localfile));
}
}
} elseif (is_file($_SERVER['DOCUMENT_ROOT'] . $GLOBALS['pageroot'] . '/' . FCKIMAGES_DIR . '/' . $localfile)) {
$elements = parse_url($filename);
$localfile = basename($elements['path']);
return base64_encode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . $GLOBALS['pageroot'] . '/' . FCKIMAGES_DIR . '/' . $localfile));
} elseif (is_file($_SERVER['DOCUMENT_ROOT'] . $GLOBALS['pageroot'] . '/' . FCKIMAGES_DIR . '/image/' . $localfile)) {
return base64_encode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . $GLOBALS['pageroot'] . '/' . FCKIMAGES_DIR . '/image/' . $localfile));
} elseif (is_file('../' . FCKIMAGES_DIR . '/' . $localfile)) {
## commandline
return base64_encode(file_get_contents('../' . FCKIMAGES_DIR . '/' . $localfile));
} elseif (is_file('../' . FCKIMAGES_DIR . '/image/' . $localfile)) {
return base64_encode(file_get_contents('../' . FCKIMAGES_DIR . '/image/' . $localfile));
}
return '';
}
示例14: refreshTlds
function refreshTlds($force = 0)
{
## fetch list of Tlds and store in DB
$lastDone = getConfig('tld_last_sync');
$tlds = '';
## let's not do this too often
if ($lastDone + TLD_REFETCH_TIMEOUT < time() || $force) {
## even if it fails we mark it as done, so that we won't getting stuck in eternal updating.
SaveConfig('tld_last_sync', time(), 0);
if (defined('TLD_AUTH_LIST')) {
$tlds = fetchUrl(TLD_AUTH_LIST);
}
if ($tlds && defined('TLD_AUTH_MD5')) {
$tld_md5 = fetchUrl(TLD_AUTH_MD5);
list($remote_md5, $fname) = explode(' ', $tld_md5);
$mymd5 = md5($tlds);
# print 'OK: '.$remote_md5.' '.$mymd5;
$validated = $remote_md5 == $mymd5;
} else {
$tlds = file_get_contents(dirname(__FILE__) . '/data/tlds-alpha-by-domain.txt');
$validated = true;
}
if ($validated) {
$lines = explode("\n", $tlds);
$tld_list = '';
foreach ($lines as $line) {
## for now, only handle ascii lines
if (preg_match('/^\\w+$/', $line)) {
$tld_list .= $line . '|';
}
}
$tld_list = substr($tld_list, 0, -1);
SaveConfig('internet_tlds', strtolower($tld_list), 0);
}
# } else {
# print $lastDone;
}
return true;
}
示例15: ini_get
<?php
$fopenAllowed = ini_get('allow_url_fopen');
if (!empty($_POST['apikey'])) {
if (!verifyToken()) {
print Error($GLOBALS['I18N']->get('No Access'));
return;
}
$streamContext = stream_context_create(array('http' => array('timeout' => 10)));
$check = @file_get_contents(PQAPI_URL . '&cmd=verifykey&key=' . trim($_POST['apikey']), false, $streamContext);
$check = trim($check);
if (!empty($check) && strpos($check, 'KEYPASS') !== false) {
SaveConfig('PQAPIkey', trim(str_replace('"', '', strip_tags($_POST['apikey']))), 0);
SaveConfig('pqchoice', 'phplistdotcom', 0);
## if we have active campaigns, start them now
$_SESSION['action_result'] = s('Remote queue processing settings were saved successfully');
$count = Sql_Fetch_Row_Query(sprintf("select count(*) from %s where status not in ('draft', 'sent', 'prepared', 'suspended') and embargo <= now()", $tables['message']));
if ($count[0] > 0) {
$_SESSION['action_result'] .= '<br/>' . activateRemoteQueue();
}
Redirect('messages&tab=active');
} else {
if (!empty($http_response_header[0]) && strpos($http_response_header[0], '200 OK') !== false) {
$_SESSION['action_result'] = s('Error, the API key is incorrect');
} else {
$_SESSION['action_result'] = s('Error, unable to connect to the phpList.com server for checking. Please verify that your webserver is able to connect to https://pqapi.phplist.com') . '<br/><a href="./?page=processqueue&pqchoice=local" class="button">' . s('Use local processing instead') . '</a>';
}
Redirect('hostedprocessqueuesetup');
}
}
$existingKey = getConfig('PQAPIkey');