当前位置: 首页>>代码示例>>PHP>>正文


PHP phpbb_ltrim函数代码示例

本文整理汇总了PHP中phpbb_ltrim函数的典型用法代码示例。如果您正苦于以下问题:PHP phpbb_ltrim函数的具体用法?PHP phpbb_ltrim怎么用?PHP phpbb_ltrim使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了phpbb_ltrim函数的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: user_avatar_gallery

function user_avatar_gallery($mode, &$error, &$error_msg, $avatar_filename, $avatar_category)
{
    global $board_config;
    $avatar_filename = phpbb_ltrim(basename($avatar_filename), "'");
    $avatar_category = phpbb_ltrim(basename($avatar_category), "'");
    if (!preg_match('/(\\.gif$|\\.png$|\\.jpg|\\.jpeg)$/is', $avatar_filename)) {
        return '';
    }
    if ($avatar_filename == "" || $avatar_category == "") {
        return '';
    }
    if (file_exists(@phpbb_realpath($board_config['avatar_gallery_path'] . '/' . $avatar_category . '/' . $avatar_filename)) && $mode == 'editprofile') {
        $return = ", user_avatar = '" . str_replace("\\'", "''", $avatar_category . '/' . $avatar_filename) . "', user_avatar_type = " . USER_AVATAR_GALLERY;
    } else {
        $return = '';
    }
    return $return;
}
开发者ID:rotvulpix,项目名称:php-nuke,代码行数:18,代码来源:usercp_avatar.php

示例2: user_avatar_gallery

function user_avatar_gallery($mode, &$error, &$error_msg, $avatar_filename, $avatar_category)
{
    global $board_config;
    $avatar_filename = phpbb_ltrim(basename($avatar_filename), "'");
    $avatar_category = phpbb_ltrim(basename($avatar_category), "'");
    if (!preg_match('/(\\.gif$|\\.png$|\\.jpg|\\.jpeg)$/is', $avatar_filename)) {
        return '';
    }
    if ($avatar_filename == "" || $avatar_category == "") {
        return '';
    }
    // Begin PNphpBB2 Module
    /*
    	if ( file_exists(@phpbb_realpath($board_config['avatar_gallery_path'] . '/' . $avatar_category . '/' . $avatar_filename)) && ($mode == 'editprofile') )
    	{
    		$return = ", user_avatar = '" . str_replace("\'", "''", $avatar_category . '/' . $avatar_filename) . "', user_avatar_type = " . USER_AVATAR_GALLERY;
    	}
    	else
    	{
    		$return = '';
    	}
    */
    // Is the returned avatar path a PostNuke avatar?
    if ($avatar_category == 'Main_site') {
        // ZphpBB2 - removed prefix $phpbb_root_path, now default is site root
        if (file_exists(@phpbb_realpath('images/avatar/' . $avatar_filename)) && $mode == 'editprofile') {
            $return = ", user_avatar = '" . str_replace("\\'", "''", $avatar_filename) . "', user_avatar_type = " . USER_AVATAR_GALLERY;
        } else {
            $return = '';
        }
    } else {
        if (file_exists(@phpbb_realpath($board_config['avatar_gallery_path'] . '/' . $avatar_category . '/' . $avatar_filename)) && $mode == 'editprofile') {
            $return = ", user_avatar = '" . str_replace("\\'", "''", $avatar_category . '/' . $avatar_filename) . "', user_avatar_type = " . USER_AVATAR_GALLERY;
        } else {
            $return = '';
        }
    }
    // End PNphpBB2 Module
    return $return;
}
开发者ID:nmpetkov,项目名称:ZphpBB2,代码行数:40,代码来源:usercp_avatar.php

示例3: str_replace

             }
         }
     } else {
         if ($user_avatar_remoteurl != "" && $avatar_sql == "" && !$error) {
             if (!preg_match("#^http:\\/\\/#i", $user_avatar_remoteurl)) {
                 $user_avatar_remoteurl = "http://" . $user_avatar_remoteurl;
             }
             if (preg_match("#^(http:\\/\\/[a-z0-9\\-]+?\\.([a-z0-9\\-]+\\.)*[a-z]+\\/.*?\\.(gif|jpg|png)\$)#is", $user_avatar_remoteurl)) {
                 $avatar_sql = ", user_avatar = '" . str_replace("\\'", "''", $user_avatar_remoteurl) . "', user_avatar_type = " . USER_AVATAR_REMOTE;
             } else {
                 $error = true;
                 $error_msg = !empty($error_msg) ? $error_msg . "<br />" . $lang['Wrong_remote_avatar_format'] : $lang['Wrong_remote_avatar_format'];
             }
         } else {
             if ($user_avatar_local != "" && $avatar_sql == "" && !$error) {
                 $avatar_sql = ", user_avatar = '" . str_replace("\\'", "''", phpbb_ltrim(basename($user_avatar_category), "'") . '/' . phpbb_ltrim(basename($user_avatar_local), "'")) . "', user_avatar_type = " . USER_AVATAR_GALLERY;
             }
         }
     }
 }
 //
 // Update entry in DB
 //
 if (!$error) {
     $sql = "UPDATE " . USERS_TABLE . "\n\t\t\t\tSET " . $username_sql . $passwd_sql . "user_email = '" . str_replace("\\'", "''", $email) . "', user_icq = '" . str_replace("\\'", "''", $icq) . "', user_website = '" . str_replace("\\'", "''", $website) . "', user_occ = '" . str_replace("\\'", "''", $occupation) . "', user_from = '" . str_replace("\\'", "''", $location) . "', user_interests = '" . str_replace("\\'", "''", $interests) . "', user_sig = '" . str_replace("\\'", "''", $signature) . "', user_viewemail = {$viewemail}, user_aim = '" . str_replace("\\'", "''", $aim) . "', user_yim = '" . str_replace("\\'", "''", $yim) . "', user_msnm = '" . str_replace("\\'", "''", $msn) . "', user_attachsig = {$attachsig}, user_sig_bbcode_uid = '{$signature_bbcode_uid}', user_allowsmile = {$allowsmilies}, user_allowhtml = {$allowhtml}, user_allowavatar = {$user_allowavatar}, user_allowbbcode = {$allowbbcode}, user_allow_viewonline = {$allowviewonline}, user_notify = {$notifyreply}, user_allow_pm = {$user_allowpm}, user_notify_pm = {$notifypm}, user_popup_pm = {$popuppm}, user_lang = '" . str_replace("\\'", "''", $user_lang) . "', user_style = {$user_style}, user_timezone = {$user_timezone}, user_dateformat = '" . str_replace("\\'", "''", $user_dateformat) . "', user_active = {$user_status}, user_rank = {$user_rank}" . $avatar_sql . "\n\t\t\t\tWHERE user_id = {$user_id}";
     if ($result = $db->sql_query($sql)) {
         if (isset($rename_user)) {
             $sql = "UPDATE " . GROUPS_TABLE . "\n\t\t\t\t\t\tSET group_name = '" . str_replace("\\'", "''", $rename_user) . "'\n\t\t\t\t\t\tWHERE group_name = '" . str_replace("'", "''", $this_userdata['username']) . "'";
             if (!($result = $db->sql_query($sql))) {
                 message_die(GENERAL_ERROR, 'Could not rename users group', '', __LINE__, __FILE__, $sql);
             }
开发者ID:bitweaver,项目名称:phpbb,代码行数:31,代码来源:admin_users.php

示例4: 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;
}
开发者ID:puring0815,项目名称:OpenKore,代码行数:79,代码来源:functions.php

示例5: sprintf

     //			$message = $lang['smiley_edit_success'] . "<br /><br />" . sprintf($lang['Click_return_smileadmin'], "<a href=\"" . append_sid("admin_smilies.$phpEx") . "\">", "</a>") . "<br /><br />" . sprintf($lang['Click_return_admin_index'], "<a href=\"" . append_sid("index.$phpEx?pane=right") . "\">", "</a>");
     $message = $lang['smiley_edit_success'] . "<br /><br />" . sprintf($lang['Click_return_smileadmin'], "<a href=\"" . append_sid("admin_smilies.{$phpEx}") . "\">", "</a>") . "<br /><br />" . sprintf($lang['Click_return_admin_index'], "<a href=\"" . append_sid("admin.{$phpEx}?pane=right") . "\">", "</a>");
     // End PNphpBB2 Module
     message_die(GENERAL_MESSAGE, $message);
     break;
 case "savenew":
     //
     // Admin has submitted changes while adding a new smiley.
     //
     //
     // Get the submitted data being careful to ensure the the data
     // we recieve and process is only the data we are looking for.
     //
     $smile_code = isset($_POST['smile_code']) ? $_POST['smile_code'] : '';
     $smile_url = isset($_POST['smile_url']) ? $_POST['smile_url'] : '';
     $smile_url = phpbb_ltrim(basename($smile_url), "'");
     $smile_emotion = isset($_POST['smile_emotion']) ? htmlspecialchars(trim($_POST['smile_emotion'])) : '';
     $smile_code = trim($smile_code);
     $smile_url = trim($smile_url);
     // If no code was entered complain ...
     if ($smile_code == '' || $smile_url == '') {
         message_die(GENERAL_MESSAGE, $lang['Fields_empty']);
     }
     //
     // Convert < and > to proper htmlentities for parsing.
     //
     $smile_code = str_replace('<', '&lt;', $smile_code);
     $smile_code = str_replace('>', '&gt;', $smile_code);
     //
     // Save the data to the smiley table.
     //
开发者ID:nmpetkov,项目名称:ZphpBB2,代码行数:31,代码来源:admin_smilies.php

示例6: seo_kill_dupes

 /**
  * seo_kill_dupes($url) will kill dupicate when pages are not cached
  * @access private
  */
 function seo_kill_dupes($url)
 {
     if ($this->mod_r_config['zero_dupe']) {
         $requested_url = $this->path_config['root_url'] . phpbb_ltrim($this->output_data['uri'], "/");
         $url = str_replace("&amp;", "&", $url);
         if (!($requested_url === $url)) {
             $this->ggs_seo_redirect($url);
         }
     }
     return;
 }
开发者ID:Nekrofage,项目名称:FJR,代码行数:15,代码来源:ggs_functions.php

示例7: 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;
            }
        }
//.........这里部分代码省略.........
开发者ID:Nekrofage,项目名称:FJR,代码行数:101,代码来源:functions.php


注:本文中的phpbb_ltrim函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。