本文整理汇总了PHP中phpbb_rtrim函数的典型用法代码示例。如果您正苦于以下问题:PHP phpbb_rtrim函数的具体用法?PHP phpbb_rtrim怎么用?PHP phpbb_rtrim使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了phpbb_rtrim函数的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: phpbb_clean_username
function phpbb_clean_username($username)
{
$username = substr(htmlspecialchars(str_replace("\\'", "'", trim($username))), 0, 25);
$username = phpbb_rtrim($username, "\\");
$username = str_replace("'", "\\'", $username);
return $username;
}
示例2: explode
}
//
// Was a highlight request part of the URI?
//
$highlight_match = $highlight = '';
if (isset($HTTP_GET_VARS['highlight'])) {
// Split words and phrases
$words = explode(' ', trim(htmlspecialchars($HTTP_GET_VARS['highlight'])));
for ($i = 0; $i < sizeof($words); $i++) {
if (trim($words[$i]) != '') {
$highlight_match .= ($highlight_match != '' ? '|' : '') . str_replace('*', '\\w*', preg_quote($words[$i], '#'));
}
}
unset($words);
$highlight = urlencode($HTTP_GET_VARS['highlight']);
$highlight_match = phpbb_rtrim($highlight_match, "\\");
}
//
// Post, reply and other URL generation for
// templating vars
//
$new_topic_url = append_sid("posting.{$phpEx}?mode=newtopic&" . POST_FORUM_URL . "={$forum_id}");
$reply_topic_url = append_sid("posting.{$phpEx}?mode=reply&" . POST_TOPIC_URL . "={$topic_id}");
// Begin FavPal Mod
$thank_topic_url = append_sid("posting.{$phpEx}?mode=thank&" . POST_TOPIC_URL . "={$topic_id}");
// End FavPal Mod
$view_forum_url = append_sid("viewforum.{$phpEx}?" . POST_FORUM_URL . "={$forum_id}");
$view_prev_topic_url = append_sid("viewtopic.{$phpEx}?" . POST_TOPIC_URL . "={$topic_id}&view=previous");
$view_next_topic_url = append_sid("viewtopic.{$phpEx}?" . POST_TOPIC_URL . "={$topic_id}&view=next");
//
// Mozilla navigation bar
示例3: init_userprefs
function init_userprefs($userdata)
{
global $board_config, $theme, $images;
global $template, $lang, $phpEx, $phpbb_root_path, $db;
global $nav_links;
if ($userdata['user_id'] != ANONYMOUS) {
if (!empty($userdata['user_lang'])) {
$default_lang = phpbb_ltrim(basename(phpbb_rtrim($userdata['user_lang'])), "'");
}
if (!empty($userdata['user_dateformat'])) {
$board_config['default_dateformat'] = $userdata['user_dateformat'];
}
if (isset($userdata['user_timezone'])) {
$board_config['board_timezone'] = $userdata['user_timezone'];
}
} else {
$default_lang = phpbb_ltrim(basename(phpbb_rtrim($board_config['default_lang'])), "'");
}
if (!file_exists(@phpbb_realpath($phpbb_root_path . 'language/lang_' . $default_lang . '/lang_main.' . $phpEx))) {
if ($userdata['user_id'] != ANONYMOUS) {
// For logged in users, try the board default language next
$default_lang = phpbb_ltrim(basename(phpbb_rtrim($board_config['default_lang'])), "'");
} else {
// For guests it means the default language is not present, try english
// This is a long shot since it means serious errors in the setup to reach here,
// but english is part of a new install so it's worth us trying
$default_lang = 'english';
}
if (!file_exists(@phpbb_realpath($phpbb_root_path . 'language/lang_' . $default_lang . '/lang_main.' . $phpEx))) {
message_die(CRITICAL_ERROR, 'Could not locate valid language pack');
}
}
// If we've had to change the value in any way then let's write it back to the database
// before we go any further since it means there is something wrong with it
if ($userdata['user_id'] != ANONYMOUS && $userdata['user_lang'] !== $default_lang) {
$sql = 'UPDATE ' . USERS_TABLE . "\n\t\t\tSET user_lang = '" . $default_lang . "'\n\t\t\tWHERE user_lang = '" . $userdata['user_lang'] . "'";
if (!($result = $db->sql_query($sql))) {
message_die(CRITICAL_ERROR, 'Could not update user language info');
}
$userdata['user_lang'] = $default_lang;
} elseif ($userdata['user_id'] === ANONYMOUS && $board_config['default_lang'] !== $default_lang) {
$sql = 'UPDATE ' . CONFIG_TABLE . "\n\t\t\tSET config_value = '" . $default_lang . "'\n\t\t\tWHERE config_name = 'default_lang'";
if (!($result = $db->sql_query($sql))) {
message_die(CRITICAL_ERROR, 'Could not update user language info');
}
}
$board_config['default_lang'] = $default_lang;
include $phpbb_root_path . 'language/lang_' . $board_config['default_lang'] . '/lang_main.' . $phpEx;
if (defined('IN_ADMIN')) {
if (!file_exists(@phpbb_realpath($phpbb_root_path . 'language/lang_' . $board_config['default_lang'] . '/lang_admin.' . $phpEx))) {
$board_config['default_lang'] = 'english';
}
include $phpbb_root_path . 'language/lang_' . $board_config['default_lang'] . '/lang_admin.' . $phpEx;
}
include_attach_lang();
include $phpbb_root_path . './includes/lang_extend_mac.' . $phpEx;
//
// Set up style
//
if (!$board_config['override_user_style']) {
if ($userdata['user_id'] != ANONYMOUS && $userdata['user_style'] > 0) {
if ($theme = setup_style($userdata['user_style'])) {
return;
}
}
}
$theme = setup_style($board_config['default_style']);
//
// Mozilla navigation bar
// Default items that should be valid on all pages.
// Defined here to correctly assign the Language Variables
// and be able to change the variables within code.
//
$nav_links['top'] = array('url' => append_sid($phpbb_root_path . 'index.' . $phpEx), 'title' => sprintf($lang['Forum_Index'], $board_config['sitename']));
$nav_links['search'] = array('url' => append_sid($phpbb_root_path . 'search.' . $phpEx), 'title' => $lang['Search']);
$nav_links['help'] = array('url' => append_sid($phpbb_root_path . 'faq.' . $phpEx), 'title' => $lang['FAQ']);
$nav_links['author'] = array('url' => append_sid($phpbb_root_path . 'memberlist.' . $phpEx), 'title' => $lang['Memberlist']);
return;
}
示例4: sprintf
$subject = $lang['Meeting_change_message'];
$message = sprintf($lang['Meeting_change_user'], $user->data['username'], $meeting_subject);
} else {
$subject = $lang['Meeting_unwill_message'];
$message = sprintf($lang['Meeting_unwill_user'], $user->data['username'], $meeting_subject);
}
}
$sql = "DELETE FROM " . MEETING_GUESTNAMES_TABLE . "\n\t\tWHERE meeting_id = {$id}\n\t\tAND user_id = {$meeting_user}";
if ($meeting_gnames) {
$guest_counter = 0;
for ($i = 0; $i < sizeof($meeting_guest_name); $i++) {
$mgpn = htmlspecialchars(str_replace("\\'", "'", trim($meeting_guest_prename[$i])));
$mgpn = phpbb_rtrim($mgpn, "\\");
$mgpn = str_replace("'", "\\'", $mgpn);
$mgna = htmlspecialchars(str_replace("\\'", "'", trim($meeting_guest_name[$i])));
$mgna = phpbb_rtrim($mgna, "\\");
$mgna = str_replace("'", "\\'", $mgna);
if ($mgpn != '' && $mgna != '') {
$sql = "INSERT INTO " . MEETING_GUESTNAMES_TABLE . "\n\t\t\t\t(meeting_id, user_id, guest_prename, guest_name)\n\t\t\t\tVALUES ({$id}, {$meeting_user}, '{$mgpn}', '{$mgna}')";
$guest_counter++;
}
}
if ($guest_counter != $meeting_guests) {
$meeting_guests = $guest_counter;
$sql = "UPDATE " . MEETING_USER_TABLE . "\n\t\t\t\tSET meeting_guests = {$guest_counter}\n\t\t\t\tWHERE meeting_id = {$id}\n\t\t\t\tAND user_id = {$meeting_user}";
}
}
// --------------- EMAIL -----------------
/*
if ($meeting_config['meeting_notify'] || $meeting_notify)
{
示例5: word_limit
/**
* Cut the text according to the number of words.
* Borrowed from www.php.net http://www.php.net/preg_replace
* @access private
*/
function word_limit($string, $length = 50, $ellipsis = ' ...')
{
if ($this->rss_config['non_utf8']) {
return count($words = preg_split('/\\s+/', phpbb_ltrim($string), $length + 1)) > $length ? phpbb_rtrim(substr($string, 0, strlen($string) - strlen(end($words)))) . $ellipsis : $string;
} else {
return count($words = preg_split('/\\s+/', phpbb_ltrim($string), $length + 1)) > $length ? phpbb_rtrim(utf8_substr($string, 0, utf8_strlen($string) - utf8_strlen(end($words)))) . $ellipsis : $string;
}
}
示例6: init_userprefs
function init_userprefs($userdata)
{
global $db, $HTTP_GET_VARS, $HTTP_POST_VARS, $HTTP_COOKIE_VARS;
global $board_config, $theme, $images;
global $template, $lang, $phpEx, $phpbb_root_path, $db;
global $nav_links;
if ($userdata['user_id'] != ANONYMOUS) {
if (!empty($userdata['user_lang'])) {
$default_lang = phpbb_ltrim(basename(phpbb_rtrim($userdata['user_lang'])), "'");
}
if (!empty($userdata['user_dateformat'])) {
$board_config['default_dateformat'] = $userdata['user_dateformat'];
}
if (isset($userdata['user_timezone'])) {
$board_config['board_timezone'] = $userdata['user_timezone'];
}
if (isset($userdata['user_use_rel_date'])) {
$board_config['ty_use_rel_date'] = $userdata['user_use_rel_date'];
}
if (isset($userdata['user_use_rel_time'])) {
$board_config['ty_use_rel_time'] = $userdata['user_use_rel_time'];
}
} else {
$default_lang = phpbb_ltrim(basename(phpbb_rtrim($board_config['default_lang'])), "'");
}
if (!file_exists(@phpbb_realpath($phpbb_root_path . 'language/lang_' . $default_lang . '/lang_main.' . $phpEx))) {
if ($userdata['user_id'] != ANONYMOUS) {
// For logged in users, try the board default language next
$default_lang = phpbb_ltrim(basename(phpbb_rtrim($board_config['default_lang'])), "'");
} else {
// For guests it means the default language is not present, try english
// This is a long shot since it means serious errors in the setup to reach here,
// but english is part of a new install so it's worth us trying
$default_lang = 'french';
}
if (!file_exists(@phpbb_realpath($phpbb_root_path . 'language/lang_' . $default_lang . '/lang_main.' . $phpEx))) {
message_die(CRITICAL_ERROR, 'Could not locate valid language pack');
}
}
// If we've had to change the value in any way then let's write it back to the database
// before we go any further since it means there is something wrong with it
if ($userdata['user_id'] != ANONYMOUS && $userdata['user_lang'] !== $default_lang) {
$sql = 'UPDATE ' . USERS_TABLE . "\r\n\t\t\tSET user_lang = '" . $default_lang . "'\r\n\t\t\tWHERE user_lang = '" . $userdata['user_lang'] . "'";
if (!($result = $db->sql_query($sql))) {
message_die(CRITICAL_ERROR, 'Could not update user language info');
}
$board_config['default_lang'] = $default_lang;
$userdata['user_lang'] = $default_lang;
} elseif ($board_config['default_lang'] !== $default_lang) {
$sql = 'UPDATE ' . CONFIG_TABLE . "\r\n\t\t\tSET config_value = '" . $default_lang . "'\r\n\t\t\tWHERE config_name = 'default_lang'";
if (!($result = $db->sql_query($sql))) {
message_die(CRITICAL_ERROR, 'Could not update user language info');
}
$board_config['default_lang'] = $default_lang;
}
include $phpbb_root_path . 'language/lang_' . $board_config['default_lang'] . '/lang_main.' . $phpEx;
include $phpbb_root_path . 'adr/language/lang_' . $board_config['default_lang'] . '/lang_adr_common_main.' . $phpEx;
include $phpbb_root_path . 'adr/language/lang_' . $board_config['default_lang'] . '/lang_adr_TownMap_main.' . $phpEx;
if (defined('IN_ADMIN')) {
if (!file_exists(@phpbb_realpath($phpbb_root_path . 'language/lang_' . $board_config['default_lang'] . '/lang_admin.' . $phpEx))) {
$board_config['default_lang'] = 'french';
}
include $phpbb_root_path . 'language/lang_' . $board_config['default_lang'] . '/lang_admin.' . $phpEx;
include $phpbb_root_path . 'adr/language/lang_' . $board_config['default_lang'] . '/lang_adr_common_admin.' . $phpEx;
}
//MOD Keep_unread_2
read_cookies($userdata);
//-- mod : language settings ---------------------------------------------------
//-- add
include $phpbb_root_path . 'includes/lang_extend_mac.' . $phpEx;
//-- fin mod : language settings -----------------------------------------------
// Disable board if needed
board_disable();
if (!defined('NO_ATTACH_MOD')) {
include_attach_lang();
}
//
// Set up style
//
if (!$board_config['override_user_style']) {
if (isset($HTTP_GET_VARS[STYLE_URL])) {
$style = urldecode($HTTP_GET_VARS[STYLE_URL]);
if ($theme = setup_style($style)) {
if ($theme['themes_id'] == $userdata['user_style']) {
return;
}
if ($userdata['user_id'] != ANONYMOUS) {
// user logged in --> save new style ID in user profile
$sql = "UPDATE " . USERS_TABLE . " \r\n\t\t\t\t\t\tSET user_style = " . $theme['themes_id'] . "\r\n\t\t\t\t\t\tWHERE user_id = " . $userdata['user_id'];
if (!$db->sql_query($sql)) {
message_die(CRITICAL_ERROR, 'Error updating user style', '', __LINE__, __FILE__, $sql);
}
$userdata['user_style'] = $theme['themes_id'];
} else {
// user not logged in --> save new style ID in cookie
setcookie($board_config['cookie_name'] . '_style', $style, time() + 31536000, $board_config['cookie_path'], $board_config['cookie_domain'], $board_config['cookie_secure']);
}
return;
}
}
//.........这里部分代码省略.........