本文整理汇总了PHP中get_setting函数的典型用法代码示例。如果您正苦于以下问题:PHP get_setting函数的具体用法?PHP get_setting怎么用?PHP get_setting使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了get_setting函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: __construct
/**
* Constructor (generates a connection to the API)
* @param string Clockworksms API key required to use the plugin
* @return void
*/
public function __construct($apiKey = null)
{
$plugin = ClockworksmsPlugin::create();
$clockWorkSMSPlugin = $plugin->get('tool_enable');
if (empty($apiKey)) {
$clockWorkSMSApiKey = $plugin->get('api_key');
} else {
$clockWorkSMSApiKey = $apiKey;
}
$this->table = Database::get_main_table('user_field_values');
if ($clockWorkSMSPlugin == true) {
$this->apiKey = $clockWorkSMSApiKey;
// Setting Clockworksms api
define('CONFIG_SECURITY_API_KEY', $this->apiKey);
$trimmedApiKey = trim(CONFIG_SECURITY_API_KEY);
if (!empty($trimmedApiKey)) {
$this->api = new Clockwork(CONFIG_SECURITY_API_KEY);
} else {
$this->api = new Clockwork(' ');
$recipient_name = api_get_person_name(
api_get_setting('administratorName'),
api_get_setting('administratorSurname'),
null,
PERSON_NAME_EMAIL_ADDRESS
);
$email_form = get_setting('emailAdministrator');
$emailsubject = 'Clockworksms error';
$emailbody = 'Key cannot be blank';
$sender_name = $recipient_name;
$email_admin = $email_form;
api_mail_html($recipient_name, $email_form, $emailsubject, $emailbody, $sender_name, $email_admin);
}
$this->plugin_enabled = true;
}
}
示例2: __construct
public function __construct()
{
parent::__construct();
// if this is a load balancer FoOlSlide, disable the public interface
if (get_setting('fs_balancer_master_url')) {
show_404();
}
// We need to set some theme stuff, so let's load the template system
$this->load->library('template');
$this->config->load('theme');
// Set theme by using the theme variable
$this->template->set_theme(get_setting('fs_theme_dir') ? get_setting('fs_theme_dir') : 'default');
// load the controller from the current theme, else load the default one
if (file_exists('content/themes/' . get_setting('fs_theme_dir') . '/reader_controller.php')) {
require_once 'content/themes/' . get_setting('fs_theme_dir') . '/reader_controller.php';
} else {
require_once 'content/themes/' . $this->config->item('theme_extends') . '/reader_controller.php';
}
$this->RC = new Reader_Controller();
// load the functions from the current theme, else load the default one
if (file_exists('content/themes/' . get_setting('fs_theme_dir') . '/reader_functions.php')) {
require_once 'content/themes/' . get_setting('fs_theme_dir') . '/reader_functions.php';
} else {
require_once 'content/themes/' . $this->config->item('theme_extends') . '/reader_functions.php';
}
}
示例3: register
function register($_username, $_password, $_email)
{
if ($this->ucenter_charset != 'utf-8') {
$result = uc_user_register(convert_encoding($_username, 'utf-8', $this->ucenter_charset), $_password, $_email);
} else {
$result = uc_user_register($_username, $_password, $_email);
}
switch ($result) {
default:
$uid = $this->model('account')->user_register($_username, $_password, $_email);
if (get_setting('register_valid_type') == 'N' or get_setting('register_valid_type') == 'email' and get_setting('register_type') == 'invite') {
$this->model('active')->active_user_by_uid($uid);
}
return array('user_info' => $this->model('account')->get_user_info_by_username($_username), 'uc_uid' => $result, 'username' => $_username, 'email' => $_email);
break;
case -1:
return '用户名不合法';
break;
case -2:
return '用户名包含不允许注册的词语';
break;
case -3:
return '用户名已经存在';
break;
case -4:
return 'Email 格式有误';
break;
case -5:
return 'Email 不允许注册';
break;
case -6:
return '该 Email 已经被注册';
break;
}
}
示例4: bet
/**
* User command for betting on the coin toss game in the casino
*
* @param bet int The amount of money to bet on the coin toss game
* @return Array
*
* @note
* If the player bets within ~1% of the maximum bet, they will receive a reward item
*/
public function bet()
{
$player = new Player(self_char_id());
$bet = intval(in('bet'));
$negative = $bet < 0;
set_setting('bet', max(0, $bet));
$pageParts = ['reminder-max-bet'];
if ($negative) {
$pageParts = ['result-cheat'];
$player->vo->health = subtractHealth($player->id(), 99);
} else {
if ($bet > $player->vo->gold) {
$pageParts = ['result-no-gold'];
} else {
if ($bet > 0 && $bet <= self::MAX_BET) {
if (rand(0, 1) === 1) {
$pageParts = ['result-win'];
$player->vo->gold = add_gold($player->id(), $bet);
if ($bet >= round(self::MAX_BET * 0.99)) {
// within about 1% of the max bet & you win, you get a reward item.
add_item($player->id(), self::REWARD, 1);
}
} else {
$player->vo->gold = subtract_gold($player->id(), $bet);
$pageParts = ['result-lose'];
}
}
}
}
// End of not cheating check.
return $this->render(['pageParts' => $pageParts, 'player' => $player, 'bet' => get_setting('bet')]);
}
示例5: binding_callback_action
function binding_callback_action()
{
$oauth = new Services_Weibo_WeiboOAuth(get_setting('sina_akey'), get_setting('sina_skey'));
if ($_GET['uid'] and $this->user_info['permission']['is_administortar']) {
$user_id = intval($_GET['uid']);
$user_info = $this->model('account')->get_user_info_by_uid($user_id);
if (empty($user_info)) {
H::ajax_json_output(AWS_APP::RSM(null, -1, AWS_APP::lang()->_t('本地用户不存在,无法绑定')));
}
$sina_token = $oauth->getAccessToken('code', array('code' => $_GET['code'], 'redirect_uri' => get_js_url('/account/sina/binding_callback/uid-' . $user_id)));
} else {
$user_id = $this->user_id;
AWS_APP::session()->sina_token = $oauth->getAccessToken('code', array('code' => $_GET['code'], 'redirect_uri' => get_js_url('/account/sina/binding_callback/')));
$sina_token = AWS_APP::session()->sina_token;
$redirect = get_js_url('/account/setting/openid/');
}
$client = new Services_Weibo_WeiboClient(get_setting('sina_akey'), get_setting('sina_skey'), $sina_token['access_token']);
$uid_get = $client->get_uid();
$sina_profile = $client->show_user_by_id($uid_get['uid']);
if ($sina_profile['error']) {
H::redirect_msg(AWS_APP::lang()->_t('与微博通信出错, 错误代码: %s', $sina_profile['error']), "/account/setting/openid/");
}
if (!$this->model('integral')->fetch_log($user_id, 'BIND_OPENID')) {
$this->model('integral')->process($user_id, 'BIND_OPENID', round(get_setting('integral_system_config_profile') * 0.2), '绑定 OPEN ID');
}
//$this->model('openid_weibo')->bind_account($sina_profile, get_js_url('/account/setting/openid/'), $user_id, $last_key['oauth_token'], $last_key['oauth_token_secret'], $sina_token);
$this->model('openid_weibo')->bind_account($sina_profile, $redirect, $user_id, $sina_token);
}
示例6: send_activation_mail
public function send_activation_mail($email, $name, $role, $token)
{
$this->load->library('mailer');
$mail = new PHPMailer();
$mail->SMTPAuth = true;
$mail->SMTPSecure = "ssl";
$mail->Host = "smtp.gmail.com";
$mail->Port = 465;
$mail->Username = "anggadarkprince@gmail.com";
$mail->Password = "guardianoftime";
$mail->Subject = "Jagamana Registration";
$template = file_get_contents(base_url() . '/assets/template/registration.html');
$template = preg_replace('%SITEPATH%', base_url() . "register/activate", $template);
$template = preg_replace('%NAME%', $name, $template);
$template = preg_replace('%ROLE%', $role, $template);
$template = preg_replace('%TOKEN%', $token, $template);
$template = preg_replace('%YEAR%', date("Y"), $template);
$template = preg_replace('%ADDRESS%', get_setting("Address"), $template);
$template = preg_replace('%WEBSITE%', get_setting("Website Name"), $template);
$mail->Body = $template;
$mail->isSMTP();
$mail->isHTML(true);
$mail->SetFrom('no-reply@jagamana.com', 'Jagamana Service');
$mail->AddReplyTo("no-reply@jagamana.com", "Jagamana Service");
$mail->AddAddress($email, $name);
if ($mail->Send()) {
return true;
}
return false;
}
示例7: build_auth_header
public function build_auth_header($args = array(), $request_url, $request_method)
{
if (isset($args) and !is_array($args)) {
return false;
}
if (isset($args['oauth_token_secret'])) {
$oauth_token_secret = $args['oauth_token_secret'];
unset($args['oauth_token_secret']);
}
$timestamp = time();
$args['oauth_consumer_key'] = get_setting('twitter_consumer_key');
$args['oauth_nonce'] = base64_encode(md5($timestamp));
$args['oauth_signature_method'] = 'HMAC-SHA1';
$args['oauth_timestamp'] = $timestamp;
$args['oauth_version'] = '1.0';
ksort($args);
$parm_str = http_build_query($args, '', '&', PHP_QUERY_RFC3986);
$sign_base_str = $request_method . '&' . rawurlencode($request_url) . '&' . rawurlencode($parm_str);
$sign_key = rawurlencode(get_setting('twitter_consumer_secret')) . '&' . rawurlencode($oauth_token_secret);
$args['oauth_signature'] = base64_encode(hash_hmac('sha1', $sign_base_str, $sign_key, true));
ksort($args);
$auth_header = 'Authorization: OAuth ';
foreach ($args as $key => $value) {
$auth_header .= $key . '="' . rawurlencode($value) . '", ';
}
return substr($auth_header, 0, strlen($auth_header) - 2);
}
示例8: index_action
public function index_action()
{
if ($_GET['tag']) {
$this->crumb(AWS_APP::lang()->_t('标签') . ': ' . $_GET['tag'], '/favorite/tag-' . $_GET['tag']);
}
//边栏可能感兴趣的人或话题
if (TPL::is_output('block/sidebar_recommend_users_topics.tpl.htm', 'favorite/index')) {
$recommend_users_topics = $this->model('module')->recommend_users_topics($this->user_id);
TPL::assign('sidebar_recommend_users_topics', $recommend_users_topics);
}
if ($action_list = $this->model('favorite')->get_item_list($_GET['tag'], $this->user_id, calc_page_limit($_GET['page'], get_setting('contents_per_page')))) {
foreach ($action_list as $key => $val) {
$item_ids[] = $val['item_id'];
}
TPL::assign('list', $action_list);
} else {
if (!$_GET['page'] or $_GET['page'] == 1) {
$this->model('favorite')->remove_favorite_tag(null, null, $_GET['tag'], $this->user_id);
}
}
if ($item_ids) {
$favorite_items_tags = $this->model('favorite')->get_favorite_items_tags_by_item_id($this->user_id, $item_ids);
TPL::assign('favorite_items_tags', $favorite_items_tags);
}
TPL::assign('favorite_tags', $this->model('favorite')->get_favorite_tags($this->user_id));
TPL::assign('pagination', AWS_APP::pagination()->initialize(array('base_url' => get_js_url('/favorite/tag-' . $_GET['tag']), 'total_rows' => $this->model('favorite')->count_favorite_items($this->user_id, $_GET['tag']), 'per_page' => get_setting('contents_per_page')))->create_links());
TPL::output('favorite/index');
}
示例9: normal_sign
function normal_sign($uid, $tieba)
{
$setting = get_setting($uid);
$url = "http://tieba.baidu.com/mo/m?kw={$tieba[unicode_name]}";
$get_url = curl_get($url, $uid);
if (!$get_url) {
return array(1, '无法打开贴吧首页', 0);
}
$get_url = wrap_text($get_url);
preg_match('/<ahref="([^"]*?)">签到<\\/a>/', $get_url, $matches);
if (isset($matches[1])) {
$s = str_replace('&', '&', $matches[1]);
$sign_url = 'http://tieba.baidu.com' . $s;
$get_sign = curl_get($sign_url, $uid, $setting['use_bdbowser']);
$done++;
if (!$get_sign) {
return array(1, '签到错误,可能已经签到成功,稍后重试', 0);
}
$get_sign = wrap_text($get_sign);
preg_match('/<spanclass="light">签到成功,经验值上升<spanclass="light">(\\d+)<\\/span>/', $get_sign, $matches);
if ($matches[1]) {
return array(2, "签到成功,经验值+{$matches[1]}", $matches[1]);
} else {
return array(1, '签到错误,可能已经签到成功,稍后重试', 0);
}
} else {
preg_match('/<span>已签到<\\/span>/', $get_url, $matches);
if ($matches[0]) {
return array(2, '此前已成功签到', 0);
} else {
return array(-1, '找不到签到链接,稍后重试', 0);
}
}
}
示例10: setup
public function setup()
{
if (get_setting('index_per_page')) {
$this->per_page = get_setting('index_per_page');
}
HTTP::no_cache_header();
}
示例11: Upload
protected function Upload($dir, $files)
{
global $lang;
$sum = 0;
foreach ($files as $key => $val) {
$sum += $_FILES[$val]['size'];
}
if ($sum <= 2097152) {
$rel_dir = 'Uploads/';
$make_dir = FALSE;
if (get_setting('ftp', 'use_ftp') || intval(get_setting('ftp', 'use_ftp')) == 1) {
if ($conn_id = ftp_connect(get_setting('ftp', 'server'))) {
if (@ftp_login($conn_id, get_setting('ftp', 'username'), get_setting('ftp', 'password'))) {
@ftp_mkdir($conn_id, $rel_dir . $dir);
@ftp_chmod($conn_id, 0777, $rel_dir . $dir);
$make_dir = TRUE;
}
}
} else {
if (@mkdir($rel_dir . $dir)) {
$make_dir = TRUE;
}
}
if ($make_dir) {
foreach ($files as $key => $file) {
@move_uploaded_file($_FILES[$file]['tmp_name'], $rel_dir . $dir . '/' . $_FILES[$file]['name']);
}
}
} else {
return SetError::Set($lang['L_ERRORFILESTOOBIG']);
}
return TRUE;
}
示例12: Execute
public function Execute(Template $template, Session $session, $request)
{
if ($session['user'] instanceof Member && $session['user']['perms'] & ADMIN) {
$dba = DBA::Open();
$table = $request['act'] == 'addpi' ? POSTICONS : EMOTICONS;
$img_location = $table == POSTICONS ? 'PostIcons' : 'Emoticons';
$description = $dba->Quote($request['description']);
if ($_FILES['upload']['error'] == 0) {
$image = $_FILES['upload']['name'];
move_uploaded_file($_FILES['upload']['tmp_name'], $rel_dir . 'Images/' . get_setting('template', 'imgfolder') . '/Icons/' . $img_location . '/' . $_FILES['upload']['name']);
} else {
$image = $dba->Quote($request['current_images']);
}
if ($table == POSTICONS) {
if ($dba->Query("INSERT INTO " . $table . " (image, description) VALUES ('{$image}', '{$description}')")) {
header("Location: admin.php?act=icons");
}
} else {
$typed = htmlspecialchars($request['typed']);
if ($dba->Query("INSERT INTO " . $table . " (image, description, typed) VALUES ('{$image}', '{$description}', '{$typed}')")) {
header("Location: admin.php?act=icons");
}
}
}
}
示例13: search_result_action
public function search_result_action()
{
if (!in_array($_GET['search_type'], array('questions', 'topics', 'users', 'articles'))) {
$_GET['search_type'] = null;
}
$search_result = $this->model('search')->search(cjk_substr($_GET['q'], 0, 64), $_GET['search_type'], $_GET['page'], get_setting('contents_per_page'), null, $_GET['is_recommend']);
if ($this->user_id and $search_result) {
foreach ($search_result as $key => $val) {
switch ($val['type']) {
case 'questions':
$search_result[$key]['focus'] = $this->model('question')->has_focus_question($val['search_id'], $this->user_id);
break;
case 'topics':
$search_result[$key]['focus'] = $this->model('topic')->has_focus_topic($this->user_id, $val['search_id']);
break;
case 'users':
$search_result[$key]['focus'] = $this->model('follow')->user_follow_check($this->user_id, $val['search_id']);
break;
}
}
}
TPL::assign('search_result', $search_result);
if (is_mobile()) {
TPL::output('m/ajax/search_result');
} else {
TPL::output('search/ajax/search_result');
}
}
示例14: check_latest
/**
* Connects to FoOlPod to retrieve which is the latest version from the API
*
* @param type $force forces returning the download even if FoOlSlide is up to date
* @return type FALSE or the download URL
*/
function check_latest($force = FALSE)
{
if (function_exists('curl_init')) {
$this->load->library('curl');
$result = $this->curl->simple_post($this->pod . '/api/software/foolslide', array('url' => site_url(), 'version' => get_setting('fs_priv_version')));
} else {
$result = file_get_contents($this->pod . '/api/software/foolslide');
}
if (!$result) {
set_notice('error', _('FoOlPod server could not be contacted: impossible to check for new versions.'));
return FALSE;
}
$data = json_decode($result);
$new_versions = array();
foreach ($data->versions as $new) {
if (!$this->is_bigger_version(FOOLSLIDE_VERSION, $new)) {
break;
}
$new_versions[] = $new;
}
if (!empty($new_versions)) {
return $new_versions;
}
if ($force) {
return array($data->versions[0]);
}
return FALSE;
}
示例15: __construct
public function __construct($request)
{
global $lang;
$this->lang = $lang;
if (isset($_GET['sort']) && $_GET['sort'] != "*") {
//if($request['sort'] == "*") {
//$order ="[a-zA-Z].*$";
//$like = 'REGEXP';
//} else {
$order = strtolower($_GET['sort']) . '%';
$like = 'LIKE';
//}
} else {
$order = "%";
$like = 'LIKE';
}
$limit = isset($_GET['limit']) ? intval($_GET['limit']) : NULL;
$start = isset($_GET['start']) ? intval($_GET['start']) : NULL;
global $settings;
$db_type = get_setting(get_setting('application', 'dba_name'), 'type');
$proper_limit = $db_type == 'pgsql' ? "LIMIT {$limit} OFFSET {$start}" : "LIMIT {$start}, {$limit}";
$extra = !is_null($limit) && !is_null($start) ? $proper_limit : "LIMIT " . $settings['memberlistperpage'];
$query = "SELECT * FROM " . USERS . " WHERE name {$like} '{$order}' {$extra}";
$this->users = DBA::Open()->Query($query)->GetIterator();
}