本文整理汇总了PHP中forum_get_setting函数的典型用法代码示例。如果您正苦于以下问题:PHP forum_get_setting函数的具体用法?PHP forum_get_setting怎么用?PHP forum_get_setting使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了forum_get_setting函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: forum_links_get_links
function forum_links_get_links()
{
if (!($db = db::get())) {
return false;
}
if (!($table_prefix = get_table_prefix())) {
return false;
}
$forum_links_top_link = forum_get_setting('forum_links_top_link', null, gettext("Forum Links"));
$sql = "SELECT LID, TITLE, URI FROM `{$table_prefix}FORUM_LINKS` ";
$sql .= "ORDER BY POS ASC";
if (!($result = $db->query($sql))) {
return false;
}
if ($result->num_rows == 0) {
return false;
}
$links_array = array($forum_links_top_link);
while ($forum_links_data = $result->fetch_assoc()) {
if (!isset($forum_links_data['TITLE']) || strlen(trim($forum_links_data['TITLE'])) < 1) {
$forum_links_data['TITLE'] = '-';
}
if (!isset($forum_links_data['URI']) || strlen(trim($forum_links_data['URI'])) < 1) {
$links_array[$forum_links_data['LID']] = $forum_links_data['TITLE'];
} else {
$forum_links_data['URI'] = href_cleanup_query_keys($forum_links_data['URI']);
$links_array[$forum_links_data['URI']] = $forum_links_data['TITLE'];
}
}
return $links_array;
}
示例2: __construct
public function __construct($num_chars = 6, $min_char_size = 15, $max_char_size = 25, $noise_factor = 9, $max_rotation = 30)
{
if (!is_numeric($num_chars)) {
$num_chars = 6;
}
if (!is_numeric($min_char_size)) {
$min_char_size = 20;
}
if (!is_numeric($max_char_size)) {
$max_char_size = 40;
}
if (!is_numeric($noise_factor)) {
$noise_factor = 9;
}
if (!is_numeric($max_rotation)) {
$max_rotation = 30;
}
$this->num_chars = $num_chars;
$this->min_char_size = $min_char_size;
$this->max_char_size = $max_char_size;
$this->max_rotation = $max_rotation;
$this->key = forum_get_setting('text_captcha_key');
$this->image_x = ($num_chars + 1) * (int) (($this->max_char_size + $this->min_char_size) / 1.5);
$this->image_y = (int) (2.4 * $this->max_char_size);
if (($text_captcha_dir = forum_get_setting('text_captcha_dir', 'strlen', false)) !== false) {
$this->text_captcha_dir = rtrim($text_captcha_dir, '/');
}
if ($noise_factor > 0) {
$this->noise_factor = $noise_factor;
$this->noise_level = $num_chars * $noise_factor;
} else {
$this->noise_factor = 0;
$this->noise_level = 0;
}
}
示例3: sfs_check_banned
function sfs_check_banned($user_data, &$cached_response = false)
{
if (forum_get_setting('sfs_enabled', 'N')) {
return false;
}
$request = array('f' => 'json');
if (isset($user_data['IPADDRESS']) && strlen(trim($user_data['IPADDRESS'])) > 0) {
$request['ip'] = ipv6_to_ipv4($user_data['IPADDRESS']);
}
if (!isset($user_data['UID']) || $user_data['UID'] > 0) {
if (isset($user_data['LOGON']) && strlen(trim($user_data['LOGON'])) > 0) {
$request['username'] = $user_data['LOGON'];
}
if (isset($user_data['EMAIL']) && strlen(trim($user_data['EMAIL'])) > 0) {
$request['email'] = $user_data['EMAIL'];
}
}
if (sizeof($request) < 2) {
return false;
}
$ban_type_array = array('ip' => BAN_TYPE_IP, 'username' => BAN_TYPE_LOGON, 'email' => BAN_TYPE_EMAIL);
$sfs_api_url_array = parse_url(forum_get_setting('sfs_api_url', null, 'http://www.stopforumspam.com/api'));
$sfs_api_url_array['query'] = http_build_query($request, false, '&');
$sfs_api_url = build_url_str($sfs_api_url_array);
$sfs_api_url_md5 = md5($sfs_api_url);
$min_confidence = forum_get_setting('sfs_min_confidence', null, 75);
$response_confidence = 0;
$cached_response = false;
try {
if (!($response = sfs_cache_get($sfs_api_url_md5, $cached_response))) {
$curl = curl_init($sfs_api_url);
curl_setopt($curl, CURLOPT_CONNECTTIMEOUT_MS, 500);
curl_setopt($curl, CURLOPT_TIMEOUT_MS, 500);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, false);
$response = json_decode(curl_exec($curl), true);
}
if (!isset($response['success']) || $response['success'] != 1) {
return false;
}
if (!$cached_response) {
sfs_cache_put($sfs_api_url_md5, $response);
}
foreach (array_keys($ban_type_array) as $key) {
if (!isset($response[$key]['confidence'])) {
continue;
}
$response_confidence += $response[$key]['confidence'];
}
$response_confidence = $response_confidence / (count($request) - 1);
} catch (Exception $e) {
return false;
}
return $response_confidence > $min_confidence;
}
示例4: sphinx_search_connect
function sphinx_search_connect()
{
if (!($sphinx_search_host = forum_get_setting('sphinx_search_host'))) {
return false;
}
if (!($sphinx_search_port = forum_get_setting('sphinx_search_port', 'is_numeric', false))) {
return false;
}
try {
return mysqli_connect($sphinx_search_host, null, null, null, $sphinx_search_port);
} catch (Exception $e) {
return false;
}
}
示例5: sfs_check_banned
function sfs_check_banned($user_data, &$cached_response = false)
{
if (forum_get_setting('sfs_enabled', 'N')) {
return false;
}
$request = array('f' => 'json');
if (isset($user_data['IPADDRESS']) && strlen(trim($user_data['IPADDRESS'])) > 0) {
$request['ip'] = $user_data['IPADDRESS'];
}
if (!isset($user_data['UID']) || $user_data['UID'] > 0) {
if (isset($user_data['LOGON']) && strlen(trim($user_data['LOGON'])) > 0) {
$request['username'] = $user_data['LOGON'];
}
if (isset($user_data['EMAIL']) && strlen(trim($user_data['EMAIL'])) > 0) {
$request['email'] = $user_data['EMAIL'];
}
}
if (sizeof($request) < 2) {
return false;
}
$ban_type_array = array('ip' => BAN_TYPE_IP, 'username' => BAN_TYPE_LOGON, 'email' => BAN_TYPE_EMAIL);
$sfs_api_url_array = parse_url(forum_get_setting('sfs_api_url', null, 'http://www.stopforumspam.com/api'));
$sfs_api_url_array['query'] = http_build_query($request, false, '&');
$sfs_api_url = build_url_str($sfs_api_url_array);
$sfs_api_url_md5 = md5($sfs_api_url);
$min_confidence = forum_get_setting('sfs_min_confidence', null, 75);
$response_confidence = 0;
try {
if (!($response = sfs_cache_get($sfs_api_url_md5, $cached_response))) {
$context = stream_context_create(array('http' => array('timeout' => 1)));
$response = json_decode(file_get_contents($sfs_api_url, null, $context), true);
}
sfs_cache_put($sfs_api_url_md5, $response);
if (!isset($response['success']) || $response['success'] != 1) {
return false;
}
foreach (array_keys($ban_type_array) as $key) {
if (!isset($response[$key]['confidence'])) {
continue;
}
$response_confidence += $response[$key]['confidence'];
}
$response_confidence = $response_confidence / (count($request) - 1);
} catch (Exception $e) {
return false;
}
return $response_confidence > $min_confidence;
}
示例6: form_check_csrf_token
function form_check_csrf_token()
{
if (!isset($_SERVER['REQUEST_METHOD']) || mb_strtoupper($_SERVER['REQUEST_METHOD']) !== 'POST') {
return;
}
if (in_array(basename($_SERVER['PHP_SELF']), get_csrf_exempt_files()) || defined('BH_DISABLE_CSRF')) {
return;
}
if (!($token_name = forum_get_setting('csrf_token_name'))) {
html_draw_error(gettext('Sorry, you do not have access to this page.'));
}
if (!isset($_POST[$token_name]) || $_POST[$token_name] != session::get_csrf_token()) {
unset($_POST[$token_name]);
session::refresh_csrf_token();
html_draw_error(gettext('Sorry, you do not have access to this page.'));
}
unset($_POST[$token_name]);
}
示例7: word_filter_get_by_uid
function word_filter_get_by_uid($uid)
{
if (!is_numeric($uid)) {
return false;
}
if (!($user_prefs = user_get_prefs($uid))) {
return false;
}
static $word_filter_array = array();
if (!isset($word_filter_array[$uid])) {
$word_filter_array[$uid] = array();
if (isset($user_prefs['USE_ADMIN_FILTER']) && $user_prefs['USE_ADMIN_FILTER'] == 'Y' || forum_get_setting('force_word_filter', 'Y')) {
word_filter_get(0, $word_filter_array[$uid]);
}
if (isset($user_prefs['USE_WORD_FILTER']) && $user_prefs['USE_WORD_FILTER'] == 'Y') {
word_filter_get($uid, $word_filter_array[$uid]);
}
}
return word_filter_prepare($word_filter_array[$uid]);
}
示例8: image_resize
function image_resize($src, $dest, $max_width = 150, $max_height = 150)
{
// Check attachment thumbnails are enabled.
if (forum_get_setting('attachment_thumbnails', 'N')) {
return false;
}
// Get the thumbnail method.
$attachment_thumbnail_method = forum_get_setting('attachment_thumbnail_method');
// Different function for each method.
switch ($attachment_thumbnail_method) {
// Use external ImageMagick binary.
case ATTACHMENT_THUMBNAIL_IMAGEMAGICK:
return image_resize_imagemagick($src, $dest, $max_width, $max_height);
break;
// Use PHP's GD image library.
// Use PHP's GD image library.
default:
return image_resize_gd($src, $dest, $max_width, $max_height);
break;
}
}
示例9: sphinx_search_connect
function sphinx_search_connect()
{
if (!($sphinx_search_host = forum_get_setting('sphinx_search_host'))) {
return false;
}
if (!($sphinx_search_port = forum_get_setting('sphinx_search_port', 'is_numeric', false))) {
return false;
}
if (!($sphinx = mysqli_init())) {
return false;
}
if (!$sphinx->options(MYSQLI_OPT_CONNECT_TIMEOUT, 2)) {
return false;
}
if (!$sphinx->real_connect($sphinx_search_host, null, null, null, $sphinx_search_port)) {
return false;
}
if (mysqli_connect_error()) {
return false;
}
return $sphinx;
}
示例10: lang_init
function lang_init()
{
$available_languages = lang_get_available(false);
if (isset($_SESSION['LANGUAGE']) && in_array($_SESSION['LANGUAGE'], $available_languages)) {
$language = $_SESSION['LANGUAGE'];
} else {
if (isset($_SERVER['HTTP_ACCEPT_LANGUAGE'])) {
$language = locale_accept_from_http($_SERVER['HTTP_ACCEPT_LANGUAGE']);
}
}
if (!isset($language)) {
$language = forum_get_setting('default_language', 'strlen', 'en_GB');
}
$languages = array($language . '.utf8', $language . '.UTF8', $language . '.utf-8', $language . '.UTF-8', $language);
setlocale(LC_ALL, $languages);
putenv('LC_ALL=' . $language);
putenv('LANG=' . $language);
putenv('LANGUAGE=' . $language);
bindtextdomain('messages', realpath(BH_INCLUDE_PATH . 'locale'));
bind_textdomain_codeset('messages', 'UTF-8');
textdomain('messages');
}
示例11: form_submit
echo " </tr>\n";
echo " </table>\n";
echo " </td>\n";
echo " </tr>\n";
echo " </table>\n";
echo " </div>\n";
echo " </td>\n";
echo " </tr>\n";
echo " <tr>\n";
echo " <td align=\"left\"> </td>\n";
echo " </tr>\n";
echo " <tr>\n";
echo " <td align=\"left\">\n";
echo " ", form_submit("post", gettext("Post")), " ", form_submit("preview_poll", gettext("Preview")), " ", form_submit("preview_form", gettext("Preview Voting Form"));
echo " <a href=\"discussion.php?webtag={$webtag}\" class=\"button\" target=\"_self\"><span>", gettext("Cancel"), "</span></a>";
if (forum_get_setting('attachments_enabled', 'Y')) {
echo " <a href=\"attachments.php?webtag={$webtag}&aid={$aid}\" class=\"button popup 660x500\" id=\"attachments\"><span>", gettext("Attachments"), "</span></a>\n";
echo " ", form_input_hidden("aid", htmlentities_array($aid)), "\n";
}
echo " </td>\n";
echo " </tr>\n";
echo " </table>\n";
echo " </td>\n";
echo " </tr>\n";
echo " </table>\n";
echo " </td>\n";
echo " </tr>\n";
echo " <tr>\n";
echo " <td align=\"left\"> </td>\n";
echo " </tr>\n";
echo " </table>\n";
示例12: form_submit
echo " </td>\n";
echo " </tr>\n";
echo " <tr>\n";
echo " <td align=\"left\">\n";
echo form_submit("post", gettext("Post"), "tabindex=\"2\""), "\n";
echo form_submit("preview", gettext("Preview"), "tabindex=\"3\""), "\n";
if (isset($_POST['t_tid']) && is_numeric($_POST['t_tid']) && isset($_POST['t_rpid']) && is_numeric($_POST['t_rpid'])) {
echo "<a href=\"discussion.php?webtag={$webtag}&msg={$_POST['t_tid']}.{$_POST['t_rpid']}\" class=\"button\" target=\"_self\"><span>", gettext("Cancel"), "</span></a>\n";
} else {
if (isset($_GET['replyto']) && validate_msg($_GET['replyto'])) {
echo "<a href=\"discussion.php?webtag={$webtag}&msg={$_GET['replyto']}\" class=\"button\" target=\"_self\"><span>", gettext("Cancel"), "</span></a>\n";
} else {
echo "<a href=\"discussion.php?webtag={$webtag}\" class=\"button\" target=\"_self\"><span>", gettext("Cancel"), "</span></a>\n";
}
}
if (forum_get_setting('attachments_enabled', 'Y') && (session::check_perm(USER_PERM_POST_ATTACHMENTS | USER_PERM_POST_READ, $t_fid) || $new_thread)) {
echo "<a href=\"attachments.php?aid={$aid}\" class=\"button popup 660x500\" id=\"attachments\"><span>", gettext("Attachments"), "</span></a>\n";
echo form_input_hidden("aid", htmlentities_array($aid));
}
if ($allow_sig == true) {
echo " </td>\n";
echo " </tr>\n";
echo " <tr>\n";
echo " <td align=\"left\"> </td>\n";
echo " </tr>\n";
echo " <tr>\n";
echo " <td align=\"left\">\n";
echo " <table class=\"messagefoot\" width=\"553\" cellspacing=\"0\">\n";
echo " <tr>\n";
echo " <td align=\"left\" class=\"subhead\">", gettext("Signature"), "</td>\n";
if (($page_prefs & POST_SIGNATURE_DISPLAY) > 0) {
示例13: gettext
if (session::check_perm(USER_PERM_ADMIN_TOOLS, 0, 0) && sizeof($admin_user_array['user_array']) > 0) {
echo " <table cellpadding=\"0\" cellspacing=\"0\" width=\"86%\">\n";
echo " <tr>\n";
echo " <td align=\"left\">\n";
echo " <table class=\"box\" width=\"100%\">\n";
echo " <tr>\n";
echo " <td align=\"left\" class=\"posthead\">\n";
echo " <table width=\"100%\">\n";
echo " <tr>\n";
echo " <td class=\"subhead\" align=\"left\">", gettext("Options"), "</td>\n";
echo " </tr>\n";
echo " <tr>\n";
echo " <td align=\"center\">\n";
echo " <table class=\"posthead\" width=\"95%\">\n";
echo " <tr>\n";
if (forum_get_setting('require_user_approval', 'Y')) {
echo " <td align=\"left\" valign=\"top\" style=\"white-space: nowrap\">", gettext("With selected"), ": </td>\n";
echo " <td align=\"left\" valign=\"top\" style=\"white-space: nowrap\" width=\"100%\">", form_dropdown_array("action", array(-1 => ' ', ADMIN_USER_OPTION_END_SESSION => gettext("End Session (Kick)"), ADMIN_USER_OPTION_APPROVE => gettext("Approve")), false, false, 'bhlogondropdown'), " ", form_submit("select_action", gettext("Go")), "</td>\n";
} else {
echo " <td align=\"left\" valign=\"top\" style=\"white-space: nowrap\">", gettext("With selected"), ": </td>\n";
echo " <td align=\"left\" valign=\"top\" style=\"white-space: nowrap\" width=\"100%\">", form_dropdown_array("action", array(-1 => ' ', ADMIN_USER_OPTION_END_SESSION => gettext("End Session (Kick)")), false, false, 'bhlogondropdown'), " ", form_submit("select_action", gettext("Go")), "</td>\n";
}
echo " </tr>\n";
echo " </table>\n";
echo " </td>\n";
echo " </tr>\n";
echo " <tr>\n";
echo " <td align=\"left\" colspan=\"6\"> </td>\n";
echo " </tr>\n";
echo " </table>\n";
echo " </td>\n";
示例14: gettext
echo " <table class=\"box\" width=\"100%\">\n";
echo " <tr>\n";
echo " <td align=\"left\" class=\"posthead\">\n";
echo " <table class=\"posthead\" width=\"100%\">\n";
echo " <tr>\n";
echo " <td align=\"left\" class=\"subhead\">", gettext("Options"), "</td>\n";
echo " </tr>\n";
echo " </table>\n";
echo " <table class=\"posthead\" width=\"100%\">\n";
echo " <tr>\n";
echo " <td align=\"center\">\n";
echo " <table class=\"posthead\" width=\"95%\">\n";
echo " <tr>\n";
echo " <td align=\"left\">", form_checkbox("use_word_filter", "Y", gettext("Enable word filter."), session::get_value('USE_WORD_FILTER') == 'Y'), "</td>\n";
echo " </tr>\n";
if (!forum_get_setting('force_word_filter', 'Y')) {
echo " <tr>\n";
echo " <td align=\"left\">", form_checkbox("use_admin_filter", "Y", gettext("Include admin word filter in my list."), session::get_value('USE_ADMIN_FILTER') == 'Y'), "</td>\n";
echo " </tr>\n";
}
echo " <tr>\n";
echo " <td align=\"left\"> </td>\n";
echo " </tr>\n";
echo " </table>\n";
echo " </td>\n";
echo " </tr>\n";
echo " </table>\n";
echo " </td>\n";
echo " </tr>\n";
echo " </table>\n";
echo " </td>\n";
示例15: stats_get_most_downloaded_attachment
function stats_get_most_downloaded_attachment()
{
if (!($db = db::get())) {
return false;
}
if (!($table_prefix = get_table_prefix())) {
return false;
}
if (!($attachment_dir = forum_get_setting('attachment_dir'))) {
return false;
}
if (!($forum_fid = get_forum_fid())) {
return false;
}
$sql = "SELECT PAI.TID, PAI.PID, PAF.AID, PAF.HASH, PAF.FILENAME, ";
$sql .= "PAF.MIMETYPE, PAF.DOWNLOADS FROM POST_ATTACHMENT_FILES PAF ";
$sql .= "LEFT JOIN POST_ATTACHMENT_IDS PAI ON (PAI.AID = PAF.AID) ";
$sql .= "WHERE PAI.FID = '{$forum_fid}' ";
$sql .= "ORDER BY PAF.DOWNLOADS DESC ";
if (!($result = $db->query($sql))) {
return false;
}
while ($attachment_data = $result->fetch_assoc()) {
if (@file_exists("{$attachment_dir}/{$attachment_data['HASH']}")) {
if (@file_exists("{$attachment_dir}/{$attachment_data['HASH']}.thumb")) {
$filesize = filesize("{$attachment_dir}/{$attachment_data['HASH']}");
$filesize += filesize("{$attachment_dir}/{$attachment_data['HASH']}.thumb");
return array("msg" => sprintf("%s.%s", $attachment_data['TID'], $attachment_data['PID']), "filename" => rawurldecode($attachment_data['FILENAME']), "filedate" => filemtime("{$attachment_dir}/{$attachment_data['HASH']}"), "filesize" => $filesize, "aid" => $attachment_data['AID'], "hash" => $attachment_data['HASH'], "mimetype" => $attachment_data['MIMETYPE'], "downloads" => $attachment_data['DOWNLOADS']);
} else {
return array("msg" => sprintf("%s.%s", $attachment_data['TID'], $attachment_data['PID']), "filename" => rawurldecode($attachment_data['FILENAME']), "filedate" => filemtime("{$attachment_dir}/{$attachment_data['HASH']}"), "filesize" => filesize("{$attachment_dir}/{$attachment_data['HASH']}"), "aid" => $attachment_data['AID'], "hash" => $attachment_data['HASH'], "mimetype" => $attachment_data['MIMETYPE'], "downloads" => $attachment_data['DOWNLOADS']);
}
}
}
return false;
}