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


PHP phpbb_realpath函数代码示例

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


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

示例1: extract_current_page

 /**
  * Extract current session page
  *
  * @param string $root_path current root path (phpbb_root_path)
  */
 function extract_current_page($root_path)
 {
     $page_array = array();
     // First of all, get the request uri...
     $script_name = !empty($_SERVER['PHP_SELF']) ? $_SERVER['PHP_SELF'] : getenv('PHP_SELF');
     $args = !empty($_SERVER['QUERY_STRING']) ? explode('&', $_SERVER['QUERY_STRING']) : explode('&', getenv('QUERY_STRING'));
     // If we are unable to get the script name we use REQUEST_URI as a failover and note it within the page array for easier support...
     if (!$script_name) {
         $script_name = !empty($_SERVER['REQUEST_URI']) ? $_SERVER['REQUEST_URI'] : getenv('REQUEST_URI');
         $script_name = ($pos = strpos($script_name, '?')) !== false ? substr($script_name, 0, $pos) : $script_name;
         $page_array['failover'] = 1;
     }
     // Replace backslashes and doubled slashes (could happen on some proxy setups)
     $script_name = str_replace(array('\\', '//'), '/', $script_name);
     // Now, remove the sid and let us get a clean query string...
     $use_args = array();
     // Since some browser do not encode correctly we need to do this with some "special" characters...
     // " -> %22, ' => %27, < -> %3C, > -> %3E
     $find = array('"', "'", '<', '>');
     $replace = array('%22', '%27', '%3C', '%3E');
     foreach ($args as $key => $argument) {
         if (strpos($argument, 'sid=') === 0) {
             continue;
         }
         $use_args[] = str_replace($find, $replace, $argument);
     }
     unset($args);
     // The following examples given are for an request uri of {path to the phpbb directory}/adm/index.php?i=10&b=2
     // The current query string
     $query_string = trim(implode('&', $use_args));
     // basenamed page name (for example: index.php)
     $page_name = substr($script_name, -1, 1) == '/' ? '' : basename($script_name);
     $page_name = urlencode(htmlspecialchars($page_name));
     // current directory within the phpBB root (for example: adm)
     $root_dirs = explode('/', str_replace('\\', '/', phpbb_realpath($root_path)));
     $page_dirs = explode('/', str_replace('\\', '/', phpbb_realpath('./')));
     $intersection = array_intersect_assoc($root_dirs, $page_dirs);
     $root_dirs = array_diff_assoc($root_dirs, $intersection);
     $page_dirs = array_diff_assoc($page_dirs, $intersection);
     $page_dir = str_repeat('../', sizeof($root_dirs)) . implode('/', $page_dirs);
     if ($page_dir && substr($page_dir, -1, 1) == '/') {
         $page_dir = substr($page_dir, 0, -1);
     }
     // Current page from phpBB root (for example: adm/index.php?i=10&b=2)
     $page = ($page_dir ? $page_dir . '/' : '') . $page_name . ($query_string ? "?{$query_string}" : '');
     // The script path from the webroot to the current directory (for example: /phpBB3/adm/) : always prefixed with / and ends in /
     $script_path = trim(str_replace('\\', '/', dirname($script_name)));
     // The script path from the webroot to the phpBB root (for example: /phpBB3/)
     $script_dirs = explode('/', $script_path);
     array_splice($script_dirs, -sizeof($page_dirs));
     $root_script_path = implode('/', $script_dirs) . (sizeof($root_dirs) ? '/' . implode('/', $root_dirs) : '');
     // We are on the base level (phpBB root == webroot), lets adjust the variables a bit...
     if (!$root_script_path) {
         $root_script_path = $page_dir ? str_replace($page_dir, '', $script_path) : $script_path;
     }
     $script_path .= substr($script_path, -1, 1) == '/' ? '' : '/';
     $root_script_path .= substr($root_script_path, -1, 1) == '/' ? '' : '/';
     $page_array += array('page_name' => $page_name, 'page_dir' => $page_dir, 'query_string' => $query_string, 'script_path' => str_replace(' ', '%20', htmlspecialchars($script_path)), 'root_script_path' => str_replace(' ', '%20', htmlspecialchars($root_script_path)), 'page' => $page, 'forum' => isset($_REQUEST['f']) && $_REQUEST['f'] > 0 ? (int) $_REQUEST['f'] : 0);
     return $page_array;
 }
开发者ID:esacinc,项目名称:forum-sitplatform-org-website,代码行数:65,代码来源:session.php

示例2: language_select

function language_select($select_name = 'language', $default = 'english', $dirname = 'language', $return_array = false)
{
    $dir = opendir(IP_ROOT_PATH . $dirname);
    $lang = array();
    while ($file = readdir($dir)) {
        if (preg_match('#^lang_#i', $file) && !is_file(@phpbb_realpath(IP_ROOT_PATH . $dirname . '/' . $file)) && !is_link(@phpbb_realpath(IP_ROOT_PATH . $dirname . '/' . $file))) {
            $filename = trim(str_replace("lang_", "", $file));
            $displayname = preg_replace("/^(.*?)_(.*)\$/", "\\1 [ \\2 ]", $filename);
            $displayname = preg_replace("/\\[(.*?)_(.*)\\]/", "[ \\1 - \\2 ]", $displayname);
            $lang[$displayname] = $filename;
        }
    }
    closedir($dir);
    @asort($lang);
    @reset($lang);
    if ($return_array) {
        $result = $lang;
    } else {
        $lang_select = '<select name="' . $select_name . '">';
        while (list($displayname, $filename) = @each($lang)) {
            $selected = strtolower($default) == strtolower($filename) ? ' selected="selected"' : '';
            $lang_select .= '<option value="' . $filename . '"' . $selected . '>' . ucwords($displayname) . '</option>';
        }
        $lang_select .= '</select>';
        $result = $lang_select;
    }
    return $result;
}
开发者ID:ALTUN69,项目名称:icy_phoenix,代码行数:28,代码来源:functions_selects.php

示例3: find

 /**
  * Find a list of controllers
  *
  * @param string $base_path Base path to prepend to file paths
  * @return provider
  */
 public function find($base_path = '')
 {
     $this->routes = new RouteCollection();
     foreach ($this->routing_files as $file_path) {
         $loader = new YamlFileLoader(new FileLocator(phpbb_realpath($base_path)));
         $this->routes->addCollection($loader->load($file_path));
     }
     return $this;
 }
开发者ID:Tarendai,项目名称:spring-website,代码行数:15,代码来源:provider.php

示例4: load

 /**
  * Loads a specific configuration.
  *
  * @param array            $config    An array of configuration values
  * @param ContainerBuilder $container A ContainerBuilder instance
  *
  * @throws \InvalidArgumentException When provided tag is not defined in this extension
  */
 public function load(array $config, ContainerBuilder $container)
 {
     foreach ($this->paths as $path) {
         if (file_exists($path . '/config/services.yml')) {
             $loader = new YamlFileLoader($container, new FileLocator(phpbb_realpath($path . '/config')));
             $loader->load('services.yml');
         }
     }
 }
开发者ID:Tarendai,项目名称:spring-website,代码行数:17,代码来源:ext.php

示例5: language_select

function language_select($default, $select_name = "language", $dirname = "language")
{
    global $phpEx, $phpbb_root_path;
    $dir = opendir($phpbb_root_path . $dirname);
    $lang = array();
    while ($file = readdir($dir)) {
        if (preg_match('#^lang_#i', $file) && !is_file(@phpbb_realpath($phpbb_root_path . $dirname . '/' . $file)) && !is_link(@phpbb_realpath($phpbb_root_path . $dirname . '/' . $file))) {
            $filename = trim(str_replace("lang_", "", $file));
            $displayname = preg_replace("/^(.*?)_(.*)\$/", "\\1 [ \\2 ]", $filename);
            $displayname = preg_replace("/\\[(.*?)_(.*)\\]/", "[ \\1 - \\2 ]", $displayname);
            $lang[$displayname] = $filename;
        }
    }
    closedir($dir);
    @asort($lang);
    @reset($lang);
    $lang_select = '<select name="' . $select_name . '">';
    while (list($displayname, $filename) = @each($lang)) {
        $selected = strtolower($default) == strtolower($filename) ? ' selected="selected"' : '';
        $lang_select .= '<option value="' . $filename . '"' . $selected . '>' . ucwords($displayname) . '</option>';
    }
    $lang_select .= '</select>';
    return $lang_select;
}
开发者ID:BackupTheBerlios,项目名称:phpbbsfp,代码行数:24,代码来源:functions_selects.php

示例6: check_filesystem_path

 /**
  * Check a filesystem path to make sure it is within a minimum directory
  *
  * @param string $directory
  * @param mixed $minimum_directory if false, we check the store, upload path, and temp path
  */
 public function check_filesystem_path($directory, $minimum_directory = false)
 {
     // If minimum directory is false, we check the store, upload path, and temp path
     if ($minimum_directory === false) {
         return $this->check_filesystem_path($directory, TITANIA_ROOT . 'store/') || $this->check_filesystem_path($directory, titania::$config->upload_path) || $this->check_filesystem_path($directory, titania::$config->contrib_temp_path) ? true : false;
     }
     // Find the directory (ignore files and roll back through non-existant directories)
     $directory = substr($directory, 0, strrpos($directory, '/'));
     while (!file_exists($directory)) {
         $directory = substr($directory, 0, strrpos($directory, '/', -1));
     }
     $minimum_directory = phpbb_realpath($minimum_directory);
     $directory = phpbb_realpath($directory);
     // If the path of the directory doesn't start the same as the minimum directory then it's not within the directory
     if (strpos($directory, $minimum_directory) !== 0) {
         return false;
     }
     return true;
 }
开发者ID:Gfksx,项目名称:customisation-db,代码行数:25,代码来源:contrib_tools.php

示例7: make_filename

 /**
  * Generates a full path+filename for the given filename, which can either
  * be an absolute name, or a name relative to the rootdir for this Template
  * object.
  */
 function make_filename($filename)
 {
     // Check if it's an absolute or relative path.
     if (substr($filename, 0, 1) != '/') {
         $filename = phpbb_realpath($this->root . '/' . $filename);
     }
     if (!file_exists($filename)) {
         die("Template->make_filename(): Error - file {$filename} does not exist");
     }
     return $filename;
 }
开发者ID:ZerGabriel,项目名称:adr-rpg,代码行数:16,代码来源:template_file_cache.php

示例8: validate_cache_folder

 /**
  * Checks cache folder
  */
 function validate_cache_folder($cache_folder, $is_sql = false, $deep_check = false)
 {
     $default_cache_folder = !empty($is_sql) ? $this->cache_dir_sql : $this->cache_dir;
     $cache_folder = !empty($cache_folder) && in_array($cache_folder, $this->cache_dirs) ? $cache_folder : $default_cache_folder;
     if (!empty($deep_check)) {
         $cache_folder = @is_dir($cache_folder) ? $cache_folder : $default_cache_folder;
         // This part of code should should ensure realpath folder identified...
         $cache_folder = @is_dir($cache_folder) ? $cache_folder : @phpbb_realpath($cache_folder);
     }
     return $cache_folder;
 }
开发者ID:GabrielAnca,项目名称:icy_phoenix,代码行数:14,代码来源:class_cache.php

示例9: user_avatar_upload

function user_avatar_upload($mode, $avatar_mode, &$current_avatar, &$current_type, &$error, &$error_msg, $avatar_filename, $avatar_realname, $avatar_filesize, $avatar_filetype)
{
    global $board_config, $db, $lang;
    $ini_val = @phpversion() >= '4.0.0' ? 'ini_get' : 'get_cfg_var';
    if ($avatar_mode == 'remote' && preg_match('/^(http:\\/\\/)?([\\w\\-\\.]+)\\:?([0-9]*)\\/(.*)$/', $avatar_filename, $url_ary)) {
        if (empty($url_ary[4])) {
            $error = true;
            $error_msg = !empty($error_msg) ? $error_msg . '<br />' . $lang['Incomplete_URL'] : $lang['Incomplete_URL'];
            return;
        }
        $base_get = '/' . $url_ary[4];
        $port = !empty($url_ary[3]) ? $url_ary[3] : 80;
        if (!($fsock = @fsockopen($url_ary[2], $port, $errno, $errstr))) {
            $error = true;
            $error_msg = !empty($error_msg) ? $error_msg . '<br />' . $lang['No_connection_URL'] : $lang['No_connection_URL'];
            return;
        }
        @fputs($fsock, "GET {$base_get} HTTP/1.1\r\n");
        @fputs($fsock, "HOST: " . $url_ary[2] . "\r\n");
        @fputs($fsock, "Connection: close\r\n\r\n");
        unset($avatar_data);
        while (!@feof($fsock)) {
            $avatar_data .= @fread($fsock, $board_config['avatar_filesize']);
        }
        @fclose($fsock);
        if (!preg_match('#Content-Length\\: ([0-9]+)[^ /][\\s]+#i', $avatar_data, $file_data1) || !preg_match('#Content-Type\\: image/[x\\-]*([a-z]+)[\\s]+#i', $avatar_data, $file_data2)) {
            $error = true;
            $error_msg = !empty($error_msg) ? $error_msg . '<br />' . $lang['File_no_data'] : $lang['File_no_data'];
            return;
        }
        $avatar_filesize = $file_data1[1];
        $avatar_filetype = $file_data2[1];
        if (!$error && $avatar_filesize > 0 && $avatar_filesize < $board_config['avatar_filesize']) {
            $avatar_data = substr($avatar_data, strlen($avatar_data) - $avatar_filesize, $avatar_filesize);
            $tmp_path = !@$ini_val('safe_mode') ? '/tmp' : './' . $board_config['avatar_path'] . '/tmp';
            $tmp_filename = tempnam($tmp_path, uniqid(rand()) . '-');
            $fptr = @fopen($tmp_filename, 'wb');
            $bytes_written = @fwrite($fptr, $avatar_data, $avatar_filesize);
            @fclose($fptr);
            if ($bytes_written != $avatar_filesize) {
                @unlink($tmp_filename);
                message_die(GENERAL_ERROR, 'Could not write avatar file to local storage. Please contact the board administrator with this message', '', __LINE__, __FILE__);
            }
            list($width, $height) = @getimagesize($tmp_filename);
        } else {
            $l_avatar_size = sprintf($lang['Avatar_filesize'], round($board_config['avatar_filesize'] / 1024));
            $error = true;
            $error_msg = !empty($error_msg) ? $error_msg . '<br />' . $l_avatar_size : $l_avatar_size;
        }
    } else {
        if (file_exists(@phpbb_realpath($avatar_filename)) && preg_match('/\\.(jpg|jpeg|gif|png)$/i', $avatar_realname)) {
            if ($avatar_filesize <= $board_config['avatar_filesize'] && $avatar_filesize > 0) {
                preg_match('#image\\/[x\\-]*([a-z]+)#', $avatar_filetype, $avatar_filetype);
                $avatar_filetype = $avatar_filetype[1];
            } else {
                $l_avatar_size = sprintf($lang['Avatar_filesize'], round($board_config['avatar_filesize'] / 1024));
                $error = true;
                $error_msg = !empty($error_msg) ? $error_msg . '<br />' . $l_avatar_size : $l_avatar_size;
                return;
            }
            list($width, $height) = @getimagesize($avatar_filename);
        }
    }
    if (!($imgtype = check_image_type($avatar_filetype, $error, $error_msg))) {
        return;
    }
    if ($width <= $board_config['avatar_max_width'] && $height <= $board_config['avatar_max_height']) {
        $new_filename = uniqid(rand()) . $imgtype;
        if ($mode == 'editprofile' && $current_type == USER_AVATAR_UPLOAD && $current_avatar != '') {
            if (file_exists(@phpbb_realpath('./' . $board_config['avatar_path'] . '/' . $current_avatar))) {
                @unlink('./' . $board_config['avatar_path'] . '/' . $current_avatar);
            }
        }
        if ($avatar_mode == 'remote') {
            @copy($tmp_filename, './' . $board_config['avatar_path'] . "/{$new_filename}");
            @unlink($tmp_filename);
        } else {
            if (@$ini_val('open_basedir') != '') {
                if (@phpversion() < '4.0.3') {
                    message_die(GENERAL_ERROR, 'open_basedir is set and your PHP version does not allow move_uploaded_file', '', __LINE__, __FILE__);
                }
                $move_file = 'move_uploaded_file';
            } else {
                $move_file = 'copy';
            }
            $move_file($avatar_filename, './' . $board_config['avatar_path'] . "/{$new_filename}");
        }
        @chmod('./' . $board_config['avatar_path'] . "/{$new_filename}", 0777);
        $avatar_sql = $mode == 'editprofile' ? ", user_avatar = '{$new_filename}', user_avatar_type = " . USER_AVATAR_UPLOAD : "'{$new_filename}', " . USER_AVATAR_UPLOAD;
    } else {
        $l_avatar_size = sprintf($lang['Avatar_imagesize'], $board_config['avatar_max_width'], $board_config['avatar_max_height']);
        $error = true;
        $error_msg = !empty($error_msg) ? $error_msg . '<br />' . $l_avatar_size : $l_avatar_size;
    }
    return $avatar_sql;
}
开发者ID:BackupTheBerlios,项目名称:smileinstaller,代码行数:96,代码来源:usercp_avatar.php

示例10: str_replace

    $template->assign_vars(array('USERNAME' => $username, 'CUR_PASSWORD' => $cur_password, 'NEW_PASSWORD' => $new_password, 'PASSWORD_CONFIRM' => $password_confirm, 'EMAIL' => $email, 'YIM' => $yim, 'ICQ' => $icq, 'MSN' => $msn, 'AIM' => $aim, 'OCCUPATION' => $occupation, 'INTERESTS' => $interests, 'LOCATION' => $location, 'WEBSITE' => $website, 'SIGNATURE' => str_replace('<br />', "\n", $signature), 'VIEW_EMAIL_YES' => $viewemail ? 'checked="checked"' : '', 'VIEW_EMAIL_NO' => !$viewemail ? 'checked="checked"' : '', 'HIDE_USER_YES' => !$allowviewonline ? 'checked="checked"' : '', 'HIDE_USER_NO' => $allowviewonline ? 'checked="checked"' : '', 'NOTIFY_PM_YES' => $notifypm ? 'checked="checked"' : '', 'NOTIFY_PM_NO' => !$notifypm ? 'checked="checked"' : '', 'POPUP_PM_YES' => $popup_pm ? 'checked="checked"' : '', 'POPUP_PM_NO' => !$popup_pm ? 'checked="checked"' : '', 'ALWAYS_ADD_SIGNATURE_YES' => $attachsig ? 'checked="checked"' : '', 'ALWAYS_ADD_SIGNATURE_NO' => !$attachsig ? 'checked="checked"' : '', 'NOTIFY_REPLY_YES' => $notifyreply ? 'checked="checked"' : '', 'NOTIFY_REPLY_NO' => !$notifyreply ? 'checked="checked"' : '', 'ALWAYS_ALLOW_BBCODE_YES' => $allowbbcode ? 'checked="checked"' : '', 'ALWAYS_ALLOW_BBCODE_NO' => !$allowbbcode ? 'checked="checked"' : '', 'ALWAYS_ALLOW_HTML_YES' => $allowhtml ? 'checked="checked"' : '', 'ALWAYS_ALLOW_HTML_NO' => !$allowhtml ? 'checked="checked"' : '', 'ALWAYS_ALLOW_SMILIES_YES' => $allowsmilies ? 'checked="checked"' : '', 'ALWAYS_ALLOW_SMILIES_NO' => !$allowsmilies ? 'checked="checked"' : '', 'ALLOW_AVATAR' => $board_config['allow_avatar_upload'], 'AVATAR' => $avatar_img, 'AVATAR_SIZE' => $board_config['avatar_filesize'], 'LANGUAGE_SELECT' => language_select($user_lang, 'language'), 'STYLE_SELECT' => style_select($user_style, 'style'), 'TIMEZONE_SELECT' => tz_select($user_timezone, 'timezone'), 'DATE_FORMAT' => $user_dateformat, 'HTML_STATUS' => $html_status, 'BBCODE_STATUS' => sprintf($bbcode_status, '<a href="' . append_sid("faq.{$phpEx}?mode=bbcode") . '" target="_phpbbcode">', '</a>'), 'SMILIES_STATUS' => $smilies_status, 'L_CURRENT_PASSWORD' => $lang['Current_password'], 'L_NEW_PASSWORD' => $mode == 'register' ? $lang['Password'] : $lang['New_password'], 'L_CONFIRM_PASSWORD' => $lang['Confirm_password'], 'L_CONFIRM_PASSWORD_EXPLAIN' => $mode == 'editprofile' ? $lang['Confirm_password_explain'] : '', 'L_PASSWORD_IF_CHANGED' => $mode == 'editprofile' ? $lang['password_if_changed'] : '', 'L_PASSWORD_CONFIRM_IF_CHANGED' => $mode == 'editprofile' ? $lang['password_confirm_if_changed'] : '', 'L_SUBMIT' => $lang['Submit'], 'L_RESET' => $lang['Reset'], 'L_ICQ_NUMBER' => $lang['ICQ'], 'L_MESSENGER' => $lang['MSNM'], 'L_YAHOO' => $lang['YIM'], 'L_WEBSITE' => $lang['Website'], 'L_AIM' => $lang['AIM'], 'L_LOCATION' => $lang['Location'], 'L_OCCUPATION' => $lang['Occupation'], 'L_BOARD_LANGUAGE' => $lang['Board_lang'], 'L_BOARD_STYLE' => $lang['Board_style'], 'L_TIMEZONE' => $lang['Timezone'], 'L_DATE_FORMAT' => $lang['Date_format'], 'L_DATE_FORMAT_EXPLAIN' => $lang['Date_format_explain'], 'L_YES' => $lang['Yes'], 'L_NO' => $lang['No'], 'L_INTERESTS' => $lang['Interests'], 'L_ALWAYS_ALLOW_SMILIES' => $lang['Always_smile'], 'L_ALWAYS_ALLOW_BBCODE' => $lang['Always_bbcode'], 'L_ALWAYS_ALLOW_HTML' => $lang['Always_html'], 'L_HIDE_USER' => $lang['Hide_user'], 'L_ALWAYS_ADD_SIGNATURE' => $lang['Always_add_sig'], 'L_AVATAR_PANEL' => $lang['Avatar_panel'], 'L_AVATAR_EXPLAIN' => sprintf($lang['Avatar_explain'], $board_config['avatar_max_width'], $board_config['avatar_max_height'], round($board_config['avatar_filesize'] / 1024)), 'L_UPLOAD_AVATAR_FILE' => $lang['Upload_Avatar_file'], 'L_UPLOAD_AVATAR_URL' => $lang['Upload_Avatar_URL'], 'L_UPLOAD_AVATAR_URL_EXPLAIN' => $lang['Upload_Avatar_URL_explain'], 'L_AVATAR_GALLERY' => $lang['Select_from_gallery'], 'L_SHOW_GALLERY' => $lang['View_avatar_gallery'], 'L_LINK_REMOTE_AVATAR' => $lang['Link_remote_Avatar'], 'L_LINK_REMOTE_AVATAR_EXPLAIN' => $lang['Link_remote_Avatar_explain'], 'L_DELETE_AVATAR' => $lang['Delete_Image'], 'L_CURRENT_IMAGE' => $lang['Current_Image'], 'L_SIGNATURE' => $lang['Signature'], 'L_SIGNATURE_EXPLAIN' => sprintf($lang['Signature_explain'], $board_config['max_sig_chars']), 'L_NOTIFY_ON_REPLY' => $lang['Always_notify'], 'L_NOTIFY_ON_REPLY_EXPLAIN' => $lang['Always_notify_explain'], 'L_NOTIFY_ON_PRIVMSG' => $lang['Notify_on_privmsg'], 'L_POPUP_ON_PRIVMSG' => $lang['Popup_on_privmsg'], 'L_POPUP_ON_PRIVMSG_EXPLAIN' => $lang['Popup_on_privmsg_explain'], 'L_PREFERENCES' => $lang['Preferences'], 'L_PUBLIC_VIEW_EMAIL' => $lang['Public_view_email'], 'L_ITEMS_REQUIRED' => $lang['Items_required'], 'L_REGISTRATION_INFO' => $lang['Registration_info'], 'L_PROFILE_INFO' => $lang['Profile_info'], 'L_PROFILE_INFO_NOTICE' => $lang['Profile_info_warn'], 'L_EMAIL_ADDRESS' => $lang['Email_address'], 'S_ALLOW_AVATAR_UPLOAD' => $board_config['allow_avatar_upload'], 'S_ALLOW_AVATAR_LOCAL' => $board_config['allow_avatar_local'], 'S_ALLOW_AVATAR_REMOTE' => $board_config['allow_avatar_remote'], 'S_HIDDEN_FIELDS' => $s_hidden_fields, 'S_FORM_ENCTYPE' => $form_enctype, 'S_PROFILE_ACTION' => append_sid("profile.{$phpEx}")));
    //
    // This is another cheat using the block_var capability
    // of the templates to 'fake' an IF...ELSE...ENDIF solution
    // it works well :)
    //
    if ($mode != 'register') {
        if ($userdata['user_allowavatar'] && ($board_config['allow_avatar_upload'] || $board_config['allow_avatar_local'] || $board_config['allow_avatar_remote'])) {
            $template->assign_block_vars('switch_avatar_block', array());
            if ($board_config['allow_avatar_upload'] && file_exists(@phpbb_realpath('./' . $board_config['avatar_path']))) {
                if ($form_enctype != '') {
                    $template->assign_block_vars('switch_avatar_block.switch_avatar_local_upload', array());
                }
                $template->assign_block_vars('switch_avatar_block.switch_avatar_remote_upload', array());
            }
            if ($board_config['allow_avatar_remote']) {
                $template->assign_block_vars('switch_avatar_block.switch_avatar_remote_link', array());
            }
            if ($board_config['allow_avatar_local'] && file_exists(@phpbb_realpath('./' . $board_config['avatar_gallery_path']))) {
                $template->assign_block_vars('switch_avatar_block.switch_avatar_local_gallery', array());
            }
        }
    }
}
function docookie($setuser_id, $setusername, $setuser_password, $setstorynum, $setumode, $setuorder, $setthold, $setnoscore, $setublockon, $settheme, $setcommentmax)
{
    $info = base64_encode("{$setuser_id}:{$setusername}:{$setuser_password}:{$setstorynum}:{$setumode}:{$setuorder}:{$setthold}:{$setnoscore}:{$setublockon}:{$settheme}:{$setcommentmax}");
    setcookie("user", "{$info}", time() + 15552000);
}
$template->pparse('body');
include "includes/page_tail.php";
开发者ID:BackupTheBerlios,项目名称:domsmod-svn,代码行数:31,代码来源:usercp_register.php

示例11: encode_file

 function encode_file($sourcefile)
 {
     if (is_readable(phpbb_realpath($sourcefile))) {
         $fd = fopen($sourcefile, "r");
         $contents = fread($fd, filesize($sourcefile));
         $encoded = $this->myChunkSplit(base64_encode($contents));
         fclose($fd);
     }
     return $encoded;
 }
开发者ID:BackupTheBerlios,项目名称:phpbbsfp,代码行数:10,代码来源:emailer.php

示例12: define

 *   (at your option) any later version.
 *
 ***************************************************************************/
define('IN_PHPBB', 1);
if (!empty($setmodules)) {
    $file = basename(__FILE__);
    $phpbb_module['ZphpBB2']['Post_text_replace'] = "{$file}";
    return;
}
$phpbb_root_path = 'modules/ZphpBB2/vendor/phpBB2/';
require $phpbb_root_path . 'extension.inc';
require $phpbb_root_path . 'admin/pagestart.' . $phpEx;
include $phpbb_root_path . 'includes/sql_parse.' . $phpEx;
// Obtain language file
$temp_language = $board_config['default_lang'];
if (!file_exists(@phpbb_realpath($phpbb_root_path . 'language/lang_' . $temp_language . '/admin/lang_searchreplace.' . $phpEx))) {
    $temp_language = 'english';
}
include $phpbb_root_path . 'language/lang_' . $temp_language . '/admin/lang_searchreplace.' . $phpEx;
if (isset($_POST['submit']) && !empty($_POST['find_text']) && !empty($_POST['replace_with'])) {
    $find_text = $_POST['find_text'];
    $replace_with = $_POST['replace_with'];
    $sql = "SELECT post_id, post_text FROM " . POSTS_TEXT_TABLE . " WHERE post_text LIKE '%" . DataUtil::formatForStore(htmlspecialchars($find_text)) . "%';";
    $result = $db->sql_query($sql);
    $i = 0;
    while ($row = $db->sql_fetchrow($result)) {
        $i++;
        $changetext = str_replace($find_text, $replace_with, $row['post_text']);
        $sql = "UPDATE " . POSTS_TEXT_TABLE . " SET post_text = '" . DataUtil::formatForStore($changetext) . "' WHERE post_id = " . $row['post_id'] . ";";
        if (!$db->sql_query($sql)) {
            break;
开发者ID:nmpetkov,项目名称:ZphpBB2,代码行数:31,代码来源:admin_post_text_replace.php

示例13: msg_handler

/**
* Error and message handler, call with trigger_error if reqd
*/
function msg_handler($errno, $msg_text, $errfile, $errline)
{
    global $cache, $db, $auth, $template, $config, $user;
    global $phpEx, $phpbb_root_path, $msg_title, $msg_long_text;
    // Do not display notices if we suppress them via @
    if (error_reporting() == 0 && $errno != E_USER_ERROR && $errno != E_USER_WARNING && $errno != E_USER_NOTICE) {
        return;
    }
    // Message handler is stripping text. In case we need it, we are possible to define long text...
    if (isset($msg_long_text) && $msg_long_text && !$msg_text) {
        $msg_text = $msg_long_text;
    }
    if (!defined('E_DEPRECATED')) {
        define('E_DEPRECATED', 8192);
    }
    switch ($errno) {
        case E_NOTICE:
        case E_WARNING:
            // Check the error reporting level and return if the error level does not match
            // If DEBUG is defined the default level is E_ALL
            if (($errno & (defined('DEBUG') ? E_ALL : error_reporting())) == 0) {
                return;
            }
            if (strpos($errfile, 'cache') === false && strpos($errfile, 'template.') === false) {
                // remove complete path to installation, with the risk of changing backslashes meant to be there
                $errfile = str_replace(array(phpbb_realpath($phpbb_root_path), '\\'), array('', '/'), $errfile);
                $msg_text = str_replace(array(phpbb_realpath($phpbb_root_path), '\\'), array('', '/'), $msg_text);
                $error_name = $errno === E_WARNING ? 'PHP Warning' : 'PHP Notice';
                echo '<b>[phpBB Debug] ' . $error_name . '</b>: in file <b>' . $errfile . '</b> on line <b>' . $errline . '</b>: <b>' . $msg_text . '</b><br />' . "\n";
                // we are writing an image - the user won't see the debug, so let's place it in the log
                if (defined('IMAGE_OUTPUT') || defined('IN_CRON')) {
                    add_log('critical', 'LOG_IMAGE_GENERATION_ERROR', $errfile, $errline, $msg_text);
                }
                // echo '<br /><br />BACKTRACE<br />' . get_backtrace() . '<br />' . "\n";
            }
            return;
            break;
        case E_USER_ERROR:
            if (!empty($user) && !empty($user->lang)) {
                $msg_text = !empty($user->lang[$msg_text]) ? $user->lang[$msg_text] : $msg_text;
                $msg_title = !isset($msg_title) ? $user->lang['GENERAL_ERROR'] : (!empty($user->lang[$msg_title]) ? $user->lang[$msg_title] : $msg_title);
                $l_return_index = sprintf($user->lang['RETURN_INDEX'], '<a href="' . $phpbb_root_path . '">', '</a>');
                $l_notify = '';
                if (!empty($config['board_contact'])) {
                    $l_notify = '<p>' . sprintf($user->lang['NOTIFY_ADMIN_EMAIL'], $config['board_contact']) . '</p>';
                }
            } else {
                $msg_title = 'General Error';
                $l_return_index = '<a href="' . $phpbb_root_path . '">Return to index page</a>';
                $l_notify = '';
                if (!empty($config['board_contact'])) {
                    $l_notify = '<p>Please notify the board administrator or webmaster: <a href="mailto:' . $config['board_contact'] . '">' . $config['board_contact'] . '</a></p>';
                }
            }
            if ((defined('DEBUG') || defined('IN_CRON') || defined('IMAGE_OUTPUT')) && isset($db)) {
                // let's avoid loops
                $db->sql_return_on_error(true);
                add_log('critical', 'LOG_GENERAL_ERROR', $msg_title, $msg_text);
                $db->sql_return_on_error(false);
            }
            // Do not send 200 OK, but service unavailable on errors
            send_status_line(503, 'Service Unavailable');
            garbage_collection();
            // Try to not call the adm page data...
            echo '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">';
            echo '<html xmlns="http://www.w3.org/1999/xhtml" dir="ltr">';
            echo '<head>';
            echo '<meta http-equiv="content-type" content="text/html; charset=utf-8" />';
            echo '<title>' . $msg_title . '</title>';
            echo '<style type="text/css">' . "\n" . '/* <![CDATA[ */' . "\n";
            echo '* { margin: 0; padding: 0; } html { font-size: 100%; height: 100%; margin-bottom: 1px; background-color: #E4EDF0; } body { font-family: "Lucida Grande", Verdana, Helvetica, Arial, sans-serif; color: #536482; background: #E4EDF0; font-size: 62.5%; margin: 0; } ';
            echo 'a:link, a:active, a:visited { color: #006699; text-decoration: none; } a:hover { color: #DD6900; text-decoration: underline; } ';
            echo '#wrap { padding: 0 20px 15px 20px; min-width: 615px; } #page-header { text-align: right; height: 40px; } #page-footer { clear: both; font-size: 1em; text-align: center; } ';
            echo '.panel { margin: 4px 0; background-color: #FFFFFF; border: solid 1px  #A9B8C2; } ';
            echo '#errorpage #page-header a { font-weight: bold; line-height: 6em; } #errorpage #content { padding: 10px; } #errorpage #content h1 { line-height: 1.2em; margin-bottom: 0; color: #DF075C; } ';
            echo '#errorpage #content div { margin-top: 20px; margin-bottom: 5px; border-bottom: 1px solid #CCCCCC; padding-bottom: 5px; color: #333333; font: bold 1.2em "Lucida Grande", Arial, Helvetica, sans-serif; text-decoration: none; line-height: 120%; text-align: left; } ';
            echo "\n" . '/* ]]> */' . "\n";
            echo '</style>';
            echo '</head>';
            echo '<body id="errorpage">';
            echo '<div id="wrap">';
            echo '	<div id="page-header">';
            echo '		' . $l_return_index;
            echo '	</div>';
            echo '	<div id="acp">';
            echo '	<div class="panel">';
            echo '		<div id="content">';
            echo '			<h1>' . $msg_title . '</h1>';
            echo '			<div>' . $msg_text . '</div>';
            echo $l_notify;
            echo '		</div>';
            echo '	</div>';
            echo '	</div>';
            echo '	<div id="page-footer">';
            echo '		Powered by <a href="http://www.phpbb.com/">phpBB</a>&reg; Forum Software &copy; phpBB Group';
            echo '	</div>';
            echo '</div>';
//.........这里部分代码省略.........
开发者ID:jsib,项目名称:intranet,代码行数:101,代码来源:functions.php

示例14: message_die

 // Handle the file upload ....
 // If no file was uploaded report an error...
 //
 $backup_file_name = !empty($HTTP_POST_FILES['backup_file']['name']) ? $HTTP_POST_FILES['backup_file']['name'] : "";
 $backup_file_tmpname = $HTTP_POST_FILES['backup_file']['tmp_name'] != "none" ? $HTTP_POST_FILES['backup_file']['tmp_name'] : "";
 $backup_file_type = !empty($HTTP_POST_FILES['backup_file']['type']) ? $HTTP_POST_FILES['backup_file']['type'] : "";
 if ($backup_file_tmpname == "" || $backup_file_name == "") {
     message_die(GENERAL_MESSAGE, $lang['Restore_Error_no_file']);
 }
 //
 // If I file was actually uploaded, check to make sure that we
 // are actually passed the name of an uploaded file, and not
 // a hackers attempt at getting us to process a local system
 // file.
 //
 if (file_exists(phpbb_realpath($backup_file_tmpname))) {
     if (preg_match("/^(text\\/[a-zA-Z]+)|(application\\/(x\\-)?gzip(\\-compressed)?)|(application\\/octet-stream)\$/is", $backup_file_type)) {
         if (preg_match("/\\.gz\$/is", $backup_file_name)) {
             $do_gzip_compress = FALSE;
             $phpver = phpversion();
             if ($phpver >= "4.0") {
                 if (extension_loaded("zlib")) {
                     $do_gzip_compress = TRUE;
                 }
             }
             if ($do_gzip_compress) {
                 $gz_ptr = gzopen($backup_file_tmpname, 'rb');
                 $sql_query = "";
                 while (!gzeof($gz_ptr)) {
                     $sql_query .= gzgets($gz_ptr, 100000);
                 }
开发者ID:bitweaver,项目名称:phpbb,代码行数:31,代码来源:admin_db_utilities.php

示例15: erc_throw_error

     $db->sql_return_on_error(true);
     $result = $db->sql_query($sql);
     $db->sql_return_on_error(false);
     if (!$result) {
         erc_throw_error("Couldn't update config table!", __LINE__, __FILE__, $sql);
     }
     success_message($lang['rcd_success']);
     break;
 case 'rld':
     // Reset language data
     check_authorization();
     $new_lang = isset($_POST['new_lang']) ? $db->sql_escape($_POST['new_lang']) : '';
     $board_user = isset($_POST['board_user']) ? trim(htmlspecialchars($_POST['board_user'])) : '';
     $board_user = substr(str_replace("\\'", "'", $board_user), 0, 25);
     $board_user = str_replace("'", "\\'", $board_user);
     if (is_file(@phpbb_realpath(IP_ROOT_PATH . 'language/lang_' . $new_lang . '/lang_main.' . PHP_EXT)) && is_file(@phpbb_realpath(IP_ROOT_PATH . 'language/lang_' . $new_lang . '/lang_admin.' . PHP_EXT))) {
         $sql = "UPDATE " . USERS_TABLE . "\n\t\t\t\t\t\tSET user_lang = '{$new_lang}'\n\t\t\t\t\t\tWHERE username_clean = '" . $db->sql_escape(utf8_clean_string($board_user)) . "'";
         $db->sql_return_on_error(true);
         $result = $db->sql_query($sql);
         $db->sql_return_on_error(false);
         if (!$result) {
             erc_throw_error("Couldn't update user table!", __LINE__, __FILE__, $sql);
         }
         $sql = "UPDATE " . CONFIG_TABLE . "\n\t\t\t\t\t\tSET config_value = '{$new_lang}'\n\t\t\t\t\t\tWHERE config_name = 'default_lang'";
         $db->sql_return_on_error(true);
         $result = $db->sql_query($sql);
         $db->sql_return_on_error(false);
         if (!$result) {
             erc_throw_error("Couldn't update config table!", __LINE__, __FILE__, $sql);
         }
         success_message($lang['rld_success']);
开发者ID:ALTUN69,项目名称:icy_phoenix,代码行数:31,代码来源:erc.php


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