本文整理汇总了PHP中forum_trim函数的典型用法代码示例。如果您正苦于以下问题:PHP forum_trim函数的具体用法?PHP forum_trim怎么用?PHP forum_trim使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了forum_trim函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: clear_topics_subject
private function clear_topics_subject($topic_subject, $stop_list_fancy_simtopics, $lang = 'English')
{
$word_list = array();
$topic_subject = forum_trim(preg_replace('/[ \\t]+/', ' ', $topic_subject));
// strip extra whitespaces and tabs
// REMOVE SHORT
if (!empty($topic_subject)) {
// Put all unique words in the title into an array, and remove uppercases
$word_list = array_unique(explode(' ', utf8_strtolower($topic_subject)));
if ($lang != 'English') {
foreach ($word_list as $key => $word) {
// Lets eliminate all words of 2 characters or less
if (utf8_strlen(forum_trim($word)) < 3) {
unset($word_list[$key]);
}
}
}
}
// Remove any stop words from our array
if (!empty($word_list) && !empty($stop_list_fancy_simtopics)) {
// MAKE STOPLIST lowercased
function _makeitlow($value)
{
return utf8_strtolower($value);
}
$stop_list_fancy_simtopics = array_map('_makeitlow', $stop_list_fancy_simtopics);
$word_list = array_diff($word_list, $stop_list_fancy_simtopics);
}
// Rebuild our cleaned up topic title
$topic_subject = !empty($word_list) ? implode(' ', $word_list) : '';
return $topic_subject;
}
示例2: is_reserved_url
function is_reserved_url($full_url)
{
global $base_url, $forum_config;
static $urls = array();
if (empty($urls)) {
$urls = explode("\n", $forum_config['o_hcs_redirect_links']);
array_push($urls, $base_url);
}
foreach ($urls as $cur_url) {
if (strlen($cur_url) > 0 && strlen($full_url)) {
if (FALSE !== strpos(forum_trim($full_url), forum_trim($cur_url))) {
return TRUE;
}
}
}
return FALSE;
}
示例3: fancy_css_src_cb
function fancy_css_src_cb($p)
{
global $fancy_css_base;
$_m = array();
$_a = explode(',', $p[1]);
foreach ($_a as $b) {
$b = forum_trim($b);
$_b = explode('=', $b);
if ($_b[0] == 'src') {
$quoteChar = $_b[1][0] === "'" || $_b[1][0] === '"' ? $_b[1][0] : '';
$url = $quoteChar === '' ? $_b[1] : substr($_b[1], 1, strlen($_b[1]) - 2);
if (strpos($url, 'http') === 0 || strpos($url, '/') === 0 || strpos($url, 'ftp') === 0 || strpos($url, 'data:') === 0) {
// do nothing
} else {
$_b[1] = "{$quoteChar}{$fancy_css_base}{$url}{$quoteChar}";
}
}
array_push($_m, implode('=', $_b));
}
return 'AlphaImageLoader(' . implode(',', $_m) . ')';
}
示例4: forum_mail
function forum_mail($to, $subject, $message, $reply_to_email = '', $reply_to_name = '')
{
global $forum_config, $lang_common;
// Default sender address
$from_name = sprintf($lang_common['Forum mailer'], $forum_config['o_board_title']);
$from_email = $forum_config['o_webmaster_email'];
($hook = get_hook('em_fn_forum_mail_start')) ? eval($hook) : null;
// Do a little spring cleaning
$to = forum_trim(preg_replace('#[\\n\\r]+#s', '', $to));
$subject = forum_trim(preg_replace('#[\\n\\r]+#s', '', $subject));
$from_email = forum_trim(preg_replace('#[\\n\\r:]+#s', '', $from_email));
$from_name = forum_trim(preg_replace('#[\\n\\r:]+#s', '', str_replace('"', '', $from_name)));
$reply_to_email = forum_trim(preg_replace('#[\\n\\r:]+#s', '', $reply_to_email));
$reply_to_name = forum_trim(preg_replace('#[\\n\\r:]+#s', '', str_replace('"', '', $reply_to_name)));
// Set up some headers to take advantage of UTF-8
$from = "=?UTF-8?B?" . base64_encode($from_name) . "?=" . ' <' . $from_email . '>';
$subject = "=?UTF-8?B?" . base64_encode($subject) . "?=";
$headers = 'From: ' . $from . "\r\n" . 'Date: ' . gmdate('r') . "\r\n" . 'MIME-Version: 1.0' . "\r\n" . 'Content-transfer-encoding: 8bit' . "\r\n" . 'Content-type: text/plain; charset=utf-8' . "\r\n" . 'X-Mailer: PunBB Mailer';
// If we specified a reply-to email, we deal with it here
if (!empty($reply_to_email)) {
$reply_to = "=?UTF-8?B?" . base64_encode($reply_to_name) . "?=" . ' <' . $reply_to_email . '>';
$headers .= "\r\n" . 'Reply-To: ' . $reply_to;
}
// Make sure all linebreaks are CRLF in message (and strip out any NULL bytes)
$message = str_replace(array("\n", ""), array("\r\n", ''), forum_linebreaks($message));
($hook = get_hook('em_fn_forum_mail_pre_send')) ? eval($hook) : null;
if ($forum_config['o_smtp_host'] != '') {
smtp_mail($to, $subject, $message, $headers);
} else {
// Change the linebreaks used in the headers according to OS
if (strtoupper(substr(PHP_OS, 0, 3)) == 'MAC') {
$headers = str_replace("\r\n", "\r", $headers);
} else {
if (strtoupper(substr(PHP_OS, 0, 3)) != 'WIN') {
$headers = str_replace("\r\n", "\n", $headers);
}
}
mail($to, $subject, $message, $headers);
}
}
示例5: data_validation
public static function data_validation($question, &$poll_answers, &$poll_days, &$poll_votes, $read_unvote_users, $revote)
{
global $lang_pun_poll, $lang_common, $forum_config, $errors;
$errors = array();
if (empty($question)) {
$errors[] = $lang_pun_poll['Empty question'];
}
if (empty($poll_answers) || !is_array($poll_answers)) {
$errors[] = $lang_pun_poll['Empty answers'];
}
$answers = array();
foreach ($poll_answers as $answer) {
$ans = forum_trim($answer);
if (!empty($ans)) {
$answers[] = $ans;
}
}
if (!empty($answers)) {
$answers = array_unique($answers);
}
$poll_answers = $answers;
if (count($poll_answers) < 2) {
$errors[] = $lang_pun_poll['Min cnt options'];
}
if (count($poll_answers) > $forum_config['p_pun_poll_max_answers']) {
$errors[] = sprintf($lang_pun_poll['Max cnt options'], $forum_config['p_pun_poll_max_answers']);
}
if ($poll_days !== FALSE && $poll_votes !== FALSE) {
$errors[] = $lang_pun_poll['Days, votes count'];
} else {
if ($poll_days !== FALSE) {
$poll_days = intval($poll_days) > 0 ? intval($poll_days) : FALSE;
if (!$poll_days || $poll_days > 90) {
$errors[] = $lang_pun_poll['Days limit'];
}
} else {
if ($poll_votes !== FALSE) {
$poll_votes = intval($poll_votes) > 0 ? intval($poll_votes) : FALSE;
if (!$poll_votes || $poll_votes > 500) {
$errors[] = $lang_pun_poll['Votes count'];
}
}
}
}
if ($read_unvote_users !== FALSE) {
if (!$forum_config['p_pun_poll_enable_read'] || $read_unvote_users != 0 && $read_unvote_users != 1) {
message($lang_common['Bad request']);
}
}
if ($revote !== FALSE) {
if (!$forum_config['p_pun_poll_enable_revote'] || $revote != 0 && $revote != 1) {
message($lang_common['Bad request']);
}
}
}
示例6: array
if ($forum_user['language'] != 'English' && file_exists(FORUM_ROOT . 'extensions/fancy_tracker/lang/' . $forum_user['language'] . '/fancy_tracker.php')) {
require FORUM_ROOT . 'extensions/fancy_tracker/lang/' . $forum_user['language'] . '/fancy_tracker.php';
} else {
require FORUM_ROOT . 'extensions/fancy_tracker/lang/English/fancy_tracker.php';
}
$query = array('SELECT' => 'COUNT(*) AS enabled', 'FROM' => 'extensions', 'WHERE' => 'id=\'fancy_tracker\' AND disabled=0');
$result = $forum_db->query_build($query) or Fancy_Tracker::benc_error('Unable to check for extension.');
if ($forum_db->result($result) != '1') {
message($lang_common['Bad request']);
}
if ($forum_user['g_use_tracker'] == '0') {
message($lang_common['No view']);
}
$action = isset($_GET['action']) ? forum_trim($_GET['action']) : FALSE;
if ($action == 'get') {
$info_hash = isset($_GET['hash']) ? forum_trim($_GET['hash']) : '';
if (!Fancy_Tracker::is_info_hash($info_hash)) {
message($lang_common['Bad request']);
}
if (!file_exists(FORUM_ROOT . 'extensions/fancy_tracker/torrents/' . $info_hash . '.torrent')) {
message($lang_tracker['File not exists']);
}
$query = array('SELECT' => 't.name', 'FROM' => 'torrents AS t', 'WHERE' => 'UPPER(t.info_hash) = UPPER(\'' . $forum_db->escape($info_hash) . '\')');
$result = $forum_db->query_build($query) or error(__FILE__, __LINE__);
$name = $forum_db->result($result);
if (is_null($name) || $name === false) {
message($lang_common['Bad request']);
}
if (strlen($forum_user['passkey']) != 32) {
$forum_user['passkey'] = md5($forum_user['salt'] . $forum_user['id'] . time() . $forum_user['username'] . $forum_user['password']);
$query = array('UPDATE' => 'users', 'SET' => 'passkey=\'' . $forum_db->escape($forum_user['passkey']) . '\'', 'WHERE' => 'id=' . $forum_user['id']);
示例7: normalize
/**
* Транслит + убирает все лишние символы заменяя на символ $delimer
*
* @param unknown_type $string
* @param unknown_type $delimer
* @return unknown
*/
private function normalize($string, $delimer = '-')
{
$string = strtr($string, $this->translate);
return forum_trim(preg_replace('/[^\\w]+/i', $delimer, $string), $delimer);
}
示例8: prepare_message
private function prepare_message(&$errors)
{
if (!isset($_POST['req_message'])) {
message(App::$lang_common['Bad request']);
}
$message = forum_linebreaks(forum_trim($_POST['req_message']));
if ($message == '') {
$errors[] = App::$lang['No message'];
} else {
if (strlen($message) > App::$forum_config['o_reputation_maxmessage']) {
$errors[] = sprintf(App::$lang['Too long message'], App::$forum_config['o_reputation_maxmessage']);
}
}
if (App::$forum_config['p_message_bbcode'] == '1' || App::$forum_config['o_make_links'] == '1') {
if (!defined('FORUM_PARSER_LOADED')) {
require FORUM_ROOT . 'include/parser.php';
}
$message = preparse_bbcode($message, $errors);
}
return $message;
}
示例9: xml_to_array
function xml_to_array($raw_xml)
{
$xml_parser = xml_parser_create();
xml_parser_set_option($xml_parser, XML_OPTION_CASE_FOLDING, 0);
xml_parser_set_option($xml_parser, XML_OPTION_SKIP_WHITE, 0);
xml_parse_into_struct($xml_parser, $raw_xml, $vals);
xml_parser_free($xml_parser);
$_tmp = '';
foreach ($vals as $xml_elem) {
$x_tag = $xml_elem['tag'];
$x_level = $xml_elem['level'];
$x_type = $xml_elem['type'];
if ($x_level != 1 && $x_type == 'close') {
if (isset($multi_key[$x_tag][$x_level])) {
$multi_key[$x_tag][$x_level] = 1;
} else {
$multi_key[$x_tag][$x_level] = 0;
}
}
if ($x_level != 1 && $x_type == 'complete') {
if ($_tmp == $x_tag) {
$multi_key[$x_tag][$x_level] = 1;
}
$_tmp = $x_tag;
}
}
foreach ($vals as $xml_elem) {
$x_tag = $xml_elem['tag'];
$x_level = $xml_elem['level'];
$x_type = $xml_elem['type'];
if ($x_type == 'open') {
$level[$x_level] = $x_tag;
}
$start_level = 1;
$php_stmt = '$xml_array';
if ($x_type == 'close' && $x_level != 1) {
$multi_key[$x_tag][$x_level]++;
}
while ($start_level < $x_level) {
$php_stmt .= '[$level[' . $start_level . ']]';
if (isset($multi_key[$level[$start_level]][$start_level]) && $multi_key[$level[$start_level]][$start_level]) {
$php_stmt .= '[' . ($multi_key[$level[$start_level]][$start_level] - 1) . ']';
}
++$start_level;
}
$add = '';
if (isset($multi_key[$x_tag][$x_level]) && $multi_key[$x_tag][$x_level] && ($x_type == 'open' || $x_type == 'complete')) {
if (!isset($multi_key2[$x_tag][$x_level])) {
$multi_key2[$x_tag][$x_level] = 0;
} else {
$multi_key2[$x_tag][$x_level]++;
}
$add = '[' . $multi_key2[$x_tag][$x_level] . ']';
}
if (isset($xml_elem['value']) && forum_trim($xml_elem['value']) != '' && !array_key_exists('attributes', $xml_elem)) {
if ($x_type == 'open') {
$php_stmt_main = $php_stmt . '[$x_type]' . $add . '[\'content\'] = $xml_elem[\'value\'];';
} else {
$php_stmt_main = $php_stmt . '[$x_tag]' . $add . ' = $xml_elem[\'value\'];';
}
eval($php_stmt_main);
}
if (array_key_exists('attributes', $xml_elem)) {
if (isset($xml_elem['value'])) {
$php_stmt_main = $php_stmt . '[$x_tag]' . $add . '[\'content\'] = $xml_elem[\'value\'];';
eval($php_stmt_main);
}
foreach ($xml_elem['attributes'] as $key => $value) {
$php_stmt_att = $php_stmt . '[$x_tag]' . $add . '[\'attributes\'][$key] = $value;';
eval($php_stmt_att);
}
}
}
if (isset($xml_array)) {
// Make sure there's an array of notes (even if there is only one)
if (isset($xml_array['extension']['note'])) {
if (!is_array(current($xml_array['extension']['note']))) {
$xml_array['extension']['note'] = array($xml_array['extension']['note']);
}
} else {
$xml_array['extension']['note'] = array();
}
// Make sure there's an array of hooks (even if there is only one)
if (isset($xml_array['extension']['hooks']) && isset($xml_array['extension']['hooks']['hook'])) {
if (!is_array(current($xml_array['extension']['hooks']['hook']))) {
$xml_array['extension']['hooks']['hook'] = array($xml_array['extension']['hooks']['hook']);
}
}
}
return isset($xml_array) ? $xml_array : array();
}
示例10: route
public static function route($override_path = null)
{
if ($override_path == null and !isset($_GET['r'])) {
return false;
}
if ($override_path == null) {
$override_path = $_GET['r'];
}
$params = explode('/', preg_replace('/[^a-zA-Z0-9\\-_\\/]/', '', $override_path));
foreach ($params as $key => $cur_param) {
if (forum_trim($cur_param) == '') {
message(App::$lang_common['Bad request']);
}
//unset ($params[$key]);
}
//unset($_GET['r']);
$route['extension'] = array_shift($params);
$route['controller'] = 'default';
$route['action'] = 'index';
$route['arguments'] = array();
if (count($params) > 1) {
$route['controller'] = array_shift($params);
$route['action'] = array_shift($params);
if (count($params) > 0) {
$route['arguments'] = $params;
}
} else {
$route['controller'] = array_shift($params);
}
/*
* TODO
* Check action. If preffixed "_" then to deny access.
* Or refactoring with replace action calling only with preffix 'action_' on class method
*
* */
$controller_name = $route['extension'] . '_controller_' . $route['controller'];
self::$controller_instance = new $controller_name(FORUM_ROOT . 'extensions' . DS . $route['extension'] . DS);
self::$controller_instance->self_url = App::$base_url . '/extensions/' . $route['extension'];
// self::$controller_instance->attach ( Logger::get_instance(FORUM_CACHE_DIR.'controller_log.txt'));
/*
* TODO
* Arguments must be pairs: key->value
* Need check
*/
if (!empty($route['arguments'])) {
$params_count = count($route['arguments']);
$i = 0;
do {
self::$controller_instance->__set($route['arguments'][$i], $route['arguments'][++$i]);
} while (++$i < $params_count - 1);
}
if (method_exists(self::$controller_instance, $route['action'])) {
call_user_func(array(self::$controller_instance, $route['action']));
} else {
message('Invalid action <strong>' . forum_htmlencode($route['action']) . '</strong> on controller ' . forum_htmlencode($controller_name));
}
defined('FORUM_PAGE') or define('FORUM_PAGE', self::$controller_instance->page);
defined('FORUM_PAGE_SECTION') or define('FORUM_PAGE_SECTION', self::$controller_instance->section);
extract($GLOBALS, EXTR_REFS);
if (View::$instance) {
if (View::$forum_override) {
echo View::$instance->render();
} else {
require FORUM_ROOT . 'header.php';
ob_start();
echo View::$instance->render();
$tpl_temp = forum_trim(ob_get_contents());
$tpl_main = str_replace('<!-- forum_main -->', $tpl_temp, $tpl_main);
ob_end_clean();
require FORUM_ROOT . 'footer.php';
}
}
die;
}
示例11: generate_ext_versions_cache
function generate_ext_versions_cache($inst_exts, $repository_urls, $repository_url_by_extension)
{
$forum_ext_last_versions = array();
$forum_ext_repos = array();
foreach (array_unique(array_merge($repository_urls, $repository_url_by_extension)) as $url) {
//Get repository timestamp
$remote_file = get_remote_file($url . '/timestamp', 2);
$repository_timestamp = empty($remote_file['content']) ? '' : forum_trim($remote_file['content']);
unset($remote_file);
if (!is_numeric($repository_timestamp)) {
continue;
}
if (!isset($forum_ext_repos[$url]['timestamp'])) {
$forum_ext_repos[$url]['timestamp'] = $repository_timestamp;
}
if ($forum_ext_repos[$url]['timestamp'] <= $repository_timestamp) {
foreach ($inst_exts as $ext) {
$remote_file = get_remote_file($url . '/' . $ext['id'] . '/lastversion', 2);
$version = empty($remote_file['content']) ? '' : forum_trim($remote_file['content']);
unset($remote_file);
if (empty($version) || !preg_match('~^[0-9a-zA-Z\\. +-]+$~u', $version)) {
continue;
}
$forum_ext_repos[$url]['extension_versions'][$ext['id']] = $version;
//If key with current extension exist in array, compare it with version in rep-ry
if (!isset($forum_ext_last_versions[$ext['id']]) || version_compare($forum_ext_last_versions[$ext['id']]['version'], $version, '<')) {
$forum_ext_last_versions[$ext['id']] = array('version' => $version, 'repo_url' => $url);
$remote_file = get_remote_file($url . '/' . $ext['id'] . '/lastchanges', 2);
$last_changes = empty($remote_file['content']) ? '' : forum_trim($remote_file['content']);
unset($remote_file);
if (!empty($last_changes)) {
$forum_ext_last_versions[$ext['id']]['changes'] = $last_changes;
}
}
}
//Write timestamp to cache
$forum_ext_repos[$url]['timestamp'] = $repository_timestamp;
}
}
if (array_keys($forum_ext_last_versions) != array_keys($inst_exts)) {
foreach ($inst_exts as $ext) {
if (!in_array($ext['id'], array_keys($forum_ext_last_versions))) {
$forum_ext_last_versions[$ext['id']] = array('version' => $ext['version'], 'repo_url' => '', 'changes' => '');
}
}
}
($hook = get_hook('ch_generate_ext_versions_cache_check_repository')) ? eval($hook) : null;
// Output config as PHP code
$fh = @fopen(FORUM_CACHE_DIR . 'cache_ext_version_notifications.php', 'wb');
if (!$fh) {
error('Unable to write configuration cache file to cache directory. Please make sure PHP has write access to the directory \'cache\'.', __FILE__, __LINE__);
}
fwrite($fh, '<?php' . "\n\n" . 'if (!defined(\'FORUM_EXT_VERSIONS_LOADED\')) define(\'FORUM_EXT_VERSIONS_LOADED\', 1);' . "\n\n" . '$forum_ext_repos = ' . var_export($forum_ext_repos, true) . ';' . "\n\n" . ' $forum_ext_last_versions = ' . var_export($forum_ext_last_versions, true) . ";\n\n" . '$forum_ext_versions_update_cache = ' . time() . ";\n\n" . '?>');
fclose($fh);
}
示例12: get_table_info
function get_table_info($table_name, $no_prefix = false)
{
// Grab table info
$result = $this->query('SELECT sql FROM sqlite_master WHERE tbl_name = \'' . ($no_prefix ? '' : $this->prefix) . $this->escape($table_name) . '\' ORDER BY type DESC') or error(__FILE__, __LINE__);
$table = array();
$table['indices'] = array();
$num_rows = 0;
while ($cur_index = $this->fetch_assoc($result)) {
if (!isset($table['sql'])) {
$table['sql'] = $cur_index['sql'];
} else {
$table['indices'][] = $cur_index['sql'];
}
++$num_rows;
}
// Check for empty
if ($num_rows < 1) {
return;
}
// Work out the columns in the table currently
$table_lines = explode("\n", $table['sql']);
$table['columns'] = array();
foreach ($table_lines as $table_line) {
$table_line = forum_trim($table_line);
if (substr($table_line, 0, 12) == 'CREATE TABLE') {
continue;
} else {
if (substr($table_line, 0, 11) == 'PRIMARY KEY') {
$table['primary_key'] = $table_line;
} else {
if (substr($table_line, 0, 6) == 'UNIQUE') {
$table['unique'] = $table_line;
} else {
if (substr($table_line, 0, strpos($table_line, ' ')) != '') {
$table['columns'][substr($table_line, 0, strpos($table_line, ' '))] = forum_trim(substr($table_line, strpos($table_line, ' ')));
}
}
}
}
}
return $table;
}
示例13: redirect
function redirect($destination_url, $message)
{
global $forum_db, $forum_config, $lang_common, $forum_user, $base_url, $forum_loader;
define('FORUM_PAGE', 'redirect');
($hook = get_hook('fn_redirect_start')) ? eval($hook) : null;
// Prefix with base_url (unless it's there already)
if (strpos($destination_url, 'http://') !== 0 && strpos($destination_url, 'https://') !== 0 && strpos($destination_url, '/') !== 0) {
$destination_url = $base_url . '/' . $destination_url;
}
// Do a little spring cleaning
$destination_url = preg_replace('/([\\r\\n])|(%0[ad])|(;[\\s]*data[\\s]*:)/i', '', $destination_url);
// If the delay is 0 seconds, we might as well skip the redirect all together
if ($forum_config['o_redirect_delay'] == '0') {
header('Location: ' . str_replace('&', '&', $destination_url));
}
// Send no-cache headers
header('Expires: Thu, 21 Jul 1977 07:30:00 GMT');
// When yours truly first set eyes on this world! :)
header('Last-Modified: ' . gmdate('D, d M Y H:i:s') . ' GMT');
header('Cache-Control: post-check=0, pre-check=0', false);
header('Pragma: no-cache');
// For HTTP/1.0 compability
// Send the Content-type header in case the web server is setup to send something else
header('Content-type: text/html; charset=utf-8');
// Load the redirect template
if (file_exists(FORUM_ROOT . 'style/' . $forum_user['style'] . '/redirect.tpl')) {
$tpl_path = FORUM_ROOT . 'style/' . $forum_user['style'] . '/redirect.tpl';
} else {
$tpl_path = FORUM_ROOT . 'include/template/redirect.tpl';
}
($hook = get_hook('fn_redirect_pre_template_loaded')) ? eval($hook) : null;
$tpl_redir = forum_trim(file_get_contents($tpl_path));
($hook = get_hook('fn_redirect_template_loaded')) ? eval($hook) : null;
// START SUBST - <!-- forum_local -->
$tpl_redir = str_replace('<!-- forum_local -->', 'xml:lang="' . $lang_common['lang_identifier'] . '" lang="' . $lang_common['lang_identifier'] . '" dir="' . $lang_common['lang_direction'] . '"', $tpl_redir);
// END SUBST - <!-- forum_local -->
// START SUBST - <!-- forum_head -->
$forum_head['refresh'] = '<meta http-equiv="refresh" content="' . $forum_config['o_redirect_delay'] . ';URL=' . str_replace(array('<', '>', '"'), array('<', '>', '"'), $destination_url) . '" />';
$forum_head['title'] = '<title>' . $lang_common['Redirecting'] . $lang_common['Title separator'] . forum_htmlencode($forum_config['o_board_title']) . '</title>';
ob_start();
// Include stylesheets
require FORUM_ROOT . 'style/' . $forum_user['style'] . '/' . $forum_user['style'] . '.php';
$head_temp = forum_trim(ob_get_contents());
$num_temp = 0;
foreach (explode("\n", $head_temp) as $style_temp) {
$forum_head['style' . $num_temp++] = $style_temp;
}
ob_end_clean();
($hook = get_hook('fn_redirect_head')) ? eval($hook) : null;
$tmp_head = implode("\n", $forum_head) . $forum_loader->render_css();
$tpl_redir = str_replace('<!-- forum_head -->', $tmp_head, $tpl_redir);
unset($forum_head, $tmp_head);
// END SUBST - <!-- forum_head -->
// START SUBST - <!-- forum_redir_main -->
ob_start();
?>
<div id="brd-main" class="main basic">
<div class="main-head">
<h1 class="hn"><span><?php
echo $message . $lang_common['Redirecting'];
?>
</span></h1>
</div>
<div class="main-content main-message">
<p><?php
printf($lang_common['Forwarding info'], $forum_config['o_redirect_delay'], intval($forum_config['o_redirect_delay']) == 1 ? $lang_common['second'] : $lang_common['seconds']);
?>
<span> <a href="<?php
echo $destination_url;
?>
"><?php
echo $lang_common['Click redirect'];
?>
</a></span></p>
</div>
</div>
<?php
$tpl_temp = "\t" . forum_trim(ob_get_contents());
$tpl_redir = str_replace('<!-- forum_redir_main -->', $tpl_temp, $tpl_redir);
ob_end_clean();
// END SUBST - <!-- forum_redir_main -->
// START SUBST - <!-- forum_debug -->
if (defined('FORUM_SHOW_QUERIES')) {
$tpl_redir = str_replace('<!-- forum_debug -->', get_saved_queries(), $tpl_redir);
}
// End the transaction
$forum_db->end_transaction();
// END SUBST - <!-- forum_debug -->
// START SUBST - <!-- forum_include "*" -->
while (preg_match('#<!-- ?forum_include "([^/\\\\]*?)" ?-->#', $tpl_redir, $cur_include)) {
if (!file_exists(FORUM_ROOT . 'include/user/' . $cur_include[1])) {
error('Unable to process user include <!-- forum_include "' . forum_htmlencode($cur_include[1]) . '" --> from template redirect.tpl.<br />There is no such file in folder /include/user/.');
}
ob_start();
include FORUM_ROOT . 'include/user/' . $cur_include[1];
$tpl_temp = ob_get_contents();
$tpl_redir = str_replace($cur_include[0], $tpl_temp, $tpl_redir);
//.........这里部分代码省略.........
示例14: bin2hex
}
}
}
if (!isset($_GET[$key])) {
$fields[$keys[$i]] = $fields[$keys[$i]]['default'];
continue;
}
$fields[$keys[$i]] = $_GET[$key];
}
$fields['info_hash'] = bin2hex($fields['info_hash']);
$fields['peer_id'] = bin2hex($fields['peer_id']);
if ($forum_config['o_fancy_tracker_allow_submit_ip'] == '0') {
// OR the IP is a local IP
$fields['ip'] = forum_trim($_SERVER['REMOTE_ADDR']);
}
$fields['agent'] = forum_trim($_SERVER['HTTP_USER_AGENT']);
foreach ($fields as $key => $value) {
if ($value !== FALSE) {
continue;
}
Fancy_Tracker::benc_error('Required field \'' . $key . '\' is empty.');
}
if (strlen($fields['passkey']) != 32) {
Fancy_Tracker::benc_error('Invalid passkey length of ' . strlen($fields['passkey']) . ', should be 32: ' . forum_htmlencode($fields['passkey']));
}
foreach (array('info_hash', 'peer_id') as $key) {
if (strlen($fields[$key]) != 40) {
Fancy_Tracker::benc_error('Invalid ' . $key . ' length of ' . strlen($fields[$key]) . ', should be 40: ' . forum_htmlencode($fields[$key]));
}
}
foreach (array('uploaded', 'downloaded', 'left', 'port', 'num_want') as $key) {
示例15: forum_trim
$errors[] = $lang_profile['Registration flood'];
echo 'ERROR: '.$lang_profile['Registration flood'];
}
*/
// Did everything go according to plan so far?
if (empty($errors)) {
$username = forum_trim($_SESSION['userwd']);
$decrypted_email = ssl_decrypt($secretkey, $_SESSION['erem']);
$email1 = strtolower(forum_trim($decrypted_email));
if ($forum_config['o_regs_verify'] == '1') {
$password1 = random_key(8, true);
$password2 = $password1;
} else {
$decrypted_keypass = ssl_decrypt($secretkey, $_SESSION['erkp']);
$password1 = forum_trim($decrypted_keypass);
$password2 = $forum_config['o_mask_passwords'] == '1' ? forum_trim($decrypted_keypass) : $password1;
}
// Validate the username
//$errors = array_merge($errors, validate_username($username));
// ... and the password
if (utf8_strlen($password1) < 4) {
$errors[] = $lang_profile['Pass too short'];
echo 'ERROR: ' . $lang_profile['Pass too short'];
echo '<br /><a href="board/">Back to Board Index</a>';
} else {
if ($password1 != $password2) {
$errors[] = $lang_profile['Pass not match'];
echo 'ERROR: ' . $lang_profile['Pass not match'];
echo '<br /><a href="board/">Back to Board Index</a>';
}
}