本文整理汇总了PHP中read_config函数的典型用法代码示例。如果您正苦于以下问题:PHP read_config函数的具体用法?PHP read_config怎么用?PHP read_config使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了read_config函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: index
public function index()
{
// Load our current settings
Template::set(read_config('news'));
$articles = $this->get_articles();
Template::render();
}
示例2: send_forgotten_mail
function send_forgotten_mail($email, $username, $link)
{
if (!isset($ini)) {
$ini = read_config();
}
$mail = new PHPMailer();
$mail->isSMTP();
// Set mailer to use SMTP
$mail->Host = $ini["mail_server"];
// Specify main and backup SMTP servers
$mail->SMTPAuth = true;
// Enable SMTP authentication
$mail->Username = $ini["mail_user"];
// SMTP username
$mail->Password = $ini["mail_pwd"];
// SMTP password
//$mail->SMTPSecure = 'ssl'; // Enable encryption, 'ssl' also accepted
//$mail->Port = 465;
$mail->From = $ini["mail_from"];
$mail->FromName = 'Mailer';
$mail->addAddress($email);
// Add a recipient
$mail->Subject = 'Reset password';
$mail->Body = 'You can reset your password with this link: ' . $link;
//$mail->SMTPDebug = 2;
if (!$mail->send()) {
return false;
} else {
return true;
}
}
示例3: index
public function index()
{
$this->load->library('form_validation');
if ($this->input->post('submit')) {
$this->form_validation->set_rules('sender_email', 'System Email', 'required|trim|valid_email|max_length[120]|xss_clean');
$this->form_validation->set_rules('mailpath', 'Sendmail Path', 'trim|xss_clean');
$this->form_validation->set_rules('smtp_host', 'SMTP Server Address', 'trim|strip_tags|xss_clean');
$this->form_validation->set_rules('smtp_user', 'SMTP Username', 'trim|strip_tags|xss_clean');
$this->form_validation->set_rules('smtp_pass', 'SMTP Password', 'trim|strip_tags|xss_clean');
$this->form_validation->set_rules('smtp_port', 'SMTP Port', 'trim|strip_tags|numeric|xss_clean');
$this->form_validation->set_rules('smtp_timeout', 'SMTP timeout', 'trim|strip_tags|numeric|xss_clean');
if ($this->form_validation->run() !== FALSE) {
$data = array('sender_email' => $this->input->post('sender_email'), 'mailtype' => $this->input->post('mailtype'), 'protocol' => strtolower($_POST['protocol']), 'mailpath' => $_POST['mailpath'], 'smtp_host' => isset($_POST['smtp_host']) ? $_POST['smtp_host'] : '', 'smtp_user' => isset($_POST['smtp_user']) ? $_POST['smtp_user'] : '', 'smtp_pass' => isset($_POST['smtp_pass']) ? $_POST['smtp_pass'] : '', 'smtp_port' => isset($_POST['smtp_port']) ? $_POST['smtp_port'] : '', 'smtp_timeout' => isset($_POST['smtp_timeout']) ? $_POST['smtp_timeout'] : '5');
if (write_config('email', $data)) {
// Success, so reload the page, so they can see their settings
Template::set_message('Email settings successfully saved.', 'success');
redirect(SITE_AREA . '/settings/emailer');
} else {
Template::set_message('There was an error saving the file: config/email.', 'error');
}
}
}
// Load our current settings
Template::set(read_config('email'));
Template::set('toolbar_title', 'Email Settings');
Template::render();
}
示例4: init
public static function init()
{
if (!function_exists('read_config')) {
$ci =& get_instance();
$ci->load->helper('config_file');
}
self::$events = read_config('events');
if (self::$events == false) {
self::$events = array();
}
}
示例5: index
public function index()
{
if ($this->input->post('submit')) {
if ($this->save_settings()) {
Template::set_message('Your settings were successfully saved.', 'success');
redirect(SITE_AREA . '/settings');
} else {
Template::set_message('There was an error saving your settings.', 'error');
}
}
// Read our current settings
Template::set('settings', read_config('application'));
Template::set_view('admin/settings/index');
Template::render();
}
示例6: load
public function load($storage_name)
{
$mc_server = read_config(array("mvid", "storage", "memcache", "server"), "localhost");
$mc_port = read_config(array("mvid", "storage", "memcache", "port"), 11211);
$mc_timeout = read_config(array("mvid", "storage", "memcache", "timeout"), 3600);
session_start();
$memcache = new Memcache();
if (!$memcache->connect($mc_server, $mc_port)) {
return NULL;
}
$mv_session_id = $memcache->get(session_id() . "_{$storage_name}");
if ($mv_session_id) {
return $mv_session_id;
}
return NULL;
}
示例7: read_gene_network
function read_gene_network()
{
global $config, $network, $errors, $wikiurl;
if (!$config) {
read_config();
}
$network = array();
$errors = array();
# retrieve mediawiki pages for nodes and edges
$wikinodes = file_get_html("{$wikiurl}/Nodes");
$wikiedges = file_get_html("{$wikiurl}/Edges");
# parse nodes info (parse table-related html)
foreach ($wikinodes->find('tr') as $row) {
$node = $row->find('td', 0)->plaintext;
if (is_null($node)) {
continue;
}
# remove all spaces. Spaces exists in the ends and middle.
# I can use regular expression to remove spaces in the ends and replace spaces in the middle with '_',
# so that the format can be consistent with mediawiki.
# but I am too lazy to do that, and it requires more computing resources.
# This is why the node name cannot contain any spaces.
$node = str_replace(' ', '', $node);
$type = str_replace(' ', '', $row->find('td', 1)->plaintext);
$network[$node] = array("name" => $node, "type" => $type, "upstream" => array(), "downstream" => array());
}
unset($row);
# parse edges info (parse table-related html)
foreach ($wikiedges->find('tr') as $row) {
$source = $row->find('td', 0)->plaintext;
if (is_null($source)) {
continue;
}
$source = str_replace(' ', '', $source);
$target = str_replace(' ', '', $row->find('td', 1)->plaintext);
# check whether the node exists in the node mediawik page
# if not, report errors
if (isset($network[$target]) and isset($network[$source])) {
$network[$target]["upstream"][] = $source;
$network[$source]["downstream"][] = $target;
} else {
$errors[] = "Unrecognized edges: '{$source}' targets '{$target}'.\n";
}
}
unset($row);
}
示例8: init
/**
* Loads the config/events.php file into memory so we can access it
* later without the disk load.
*
* @access public
*
* @return void
*/
public static function init()
{
if (!function_exists('read_config')) {
$ci =& get_instance();
$ci->load->helper('config_file');
}
self::$events = read_config('events');
// merge other modules events
foreach (module_list(TRUE) as $module) {
if ($module_events = read_config('events', TRUE, $module)) {
self::$events = array_merge_recursive(self::$events, $module_events);
}
}
if (self::$events == false) {
self::$events = array();
}
}
示例9: init
/**
* Loads the library's dependencies and configuration.
*
* @return void
*/
public static function init()
{
if (!function_exists('read_config')) {
self::$ci =& get_instance();
self::$ci->load->helper('config_file');
}
self::$events = read_config('events', true, null, false);
// Merge events from indivdual modules.
foreach (Modules::list_modules(true) as $module) {
$module_events = read_config('events', true, $module, true);
if (is_array($module_events)) {
self::$events = array_merge_recursive(self::$events, $module_events);
}
}
if (self::$events == false) {
self::$events = array();
}
}
示例10: init_db
function init_db()
{
$conf = read_config();
# FIXME: should be read from ssscrape's local.conf
#$db_settings = array(
# 'hostname' => 'grabber',
# 'username' => 'ssscrape',
# 'password' => 'S3crape;',
# 'database' => 'ssscrape',
# 'charset' => 'utf8',
# 'use_unicode' => true,
# );
if (array_key_exists('database-web', $conf)) {
$section = 'database-web';
} else {
$section = 'database-workers';
}
$db_settings = array('hostname' => $conf[$section]['hostname'], 'username' => $conf[$section]['username'], 'password' => $conf[$section]['password'], 'database' => $conf[$section]['database'], 'charset' => 'utf8', 'use_unicode' => true);
$db =& DB::get_instance('mysql', $db_settings);
$db->prepare_execute('SET NAMES "UTF8"');
unset($db);
}
示例11: define
define('ITEM_FILTER_LIMIT', 500);
define('ITEM_XLSX_LIMIT', 500);
Podio::$debug = true;
gc_enable();
ini_set("memory_limit", "200M");
global $start;
$start = time();
global $config;
$config_command_line = getopt("fvs:l:", array("backupTo:", "podioClientId:", "podioClientSecret:", "podioUser:", "podioPassword:", "help"));
$usage = "\nUsage:\n\n" . "php podio_backup_full_cli [-f] [-v] [-s PARAMETER_FILE] --backupTo BACKUP_FOLDER" . " --podioClientId PODIO_CLIENT_ID --podioClientSecret PODIO_CLIENT_SECRET " . "--podioUser PODIO_USERNAME --podioPassword PODIO_PASSWORD\n\n" . "php podio_backup_full_cli [-f] [-v] -l PARAMETER_FILE [--backupTo BACKUP_FOLDER]" . " [--podioClientId PODIO_CLIENT_ID] [--podioClientSecret PODIO_CLIENT_SECRET] " . "[--podioUser PODIO_USERNAME] [--podioPassword PODIO_PASSWORD]\n\n" . "php podio_backup_full_cli --help" . "\n\nArguments:\n" . " -f\tdownload files from podio (rate limit of 250/h applies!)\n" . " -v\tverbose\n" . " -s\tstore parameters in PARAMETER_FILE\n" . " -l\tload parameters from PARAMETER_FILE (parameters can be overwritten by command line parameters)\n" . " \n" . "BACKUP_FOLDER represents a (incremental) backup storage. " . "I.e. consecutive backups only downloads new files.\n";
if (array_key_exists("help", $config_command_line)) {
echo $usage;
return;
}
if (array_key_exists("l", $config_command_line)) {
read_config($config_command_line['l']);
$config = array_merge($config, $config_command_line);
} else {
$config = $config_command_line;
}
if (array_key_exists("s", $config_command_line)) {
write_config($config['s']);
}
$downloadFiles = array_key_exists("f", $config);
global $verbose;
$verbose = array_key_exists("v", $config);
check_backup_folder();
if (check_config()) {
do_backup($downloadFiles);
} else {
echo $usage;
示例12: __construct
function __construct($user, $bot)
{
$this->user = $user;
$this->Bot = $bot;
$this->log = read_config('log_bots') ? '' : NULL;
$this->Database = new BotDatabase(md5($user['id']));
$this->end_planet = NULL;
}
示例13: read_data
function read_data()
{
global $config, $data, $dataset, $errors;
if (!$config) {
read_config();
}
$json = json_decode(file_get_contents("data/{$dataset}/objects.json"), true);
$data = array();
$errors = array();
foreach ($json as $obj) {
$data[$obj['name']] = $obj;
}
foreach ($data as &$obj) {
$obj['dependedOnBy'] = array();
}
unset($obj);
foreach ($data as &$obj) {
foreach ($obj['depends'] as $name) {
if ($data[$name]) {
$data[$name]['dependedOnBy'][] = $obj['name'];
} else {
$errors[] = "Unrecognized dependency: '{$obj['name']}' depends on '{$name}'";
}
}
}
unset($obj);
foreach ($data as &$obj) {
$obj['docs'] = get_html_docs($obj);
}
unset($obj);
}
示例14: session_name
<?php
$msd_path=realpath(dirname(__FILE__));
$msd_path=str_replace('\\','/',$msd_path);
$msd_path=str_replace('/inc','/',$msd_path);
if (!defined('MSD_PATH')) define('MSD_PATH',$msd_path);
session_name('MySQLDumper');
session_start();
if (!isset($download))
{
header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT");
header("Cache-Control: no-store, no-cache, must-revalidate");
header("Cache-Control: post-check=0, pre-check=0",false);
header("Pragma: no-cache");
}
include ( MSD_PATH . 'inc/functions.php' );
include ( MSD_PATH . 'inc/mysql.php' );
if (!defined('MSD_VERSION')) die('No direct access.');
if (!file_exists($config['files']['parameter'])) $error=TestWorkDir();
read_config($config['config_file']);
include ( MSD_PATH . 'language/lang_list.php' );
if (!isset($databases['db_selected_index'])) $databases['db_selected_index']=0;
SelectDB($databases['db_selected_index']);
$config['files']['iconpath']='./css/' . $config['theme'] . '/icons/';
if (isset($error)) echo $error;
示例15: get_tv_sec
function get_tv_sec()
{
global $DEBUG, $MARK_TIME;
if ($MARK_TIME <= 0) {
return NULL;
}
if (($now = time()) >= $this->mark_next) {
read_config();
logger(sprintf('---MARK--- (clients: %d, workshops: %d)', sizeof($this->clients), sizeof($this->workshops)));
$this->mark_next = $now + $MARK_TIME;
if ($DEBUG >= WLOG_DEBUG) {
$this->dump_overview();
}
foreach ($this->clients as $cid => $client) {
$payload = "---MARK--- ({$client->nick})";
$frame = '';
$this->frame_encode(0x89, $payload, $frame);
$this->clients[$cid]->send($frame);
logger("sending PING({$cid}): '{$payload}'", WLOG_DEBUG);
}
}
return $this->mark_next - $now;
}