本文整理汇总了PHP中create_server_url函数的典型用法代码示例。如果您正苦于以下问题:PHP create_server_url函数的具体用法?PHP create_server_url怎么用?PHP create_server_url使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了create_server_url函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: process_digests
/**
* Process Digests
*/
function process_digests()
{
global $db, $cache, $config, $auth, $user, $lang, $bbcode;
global $template, $images, $theme, $table_prefix;
// Digests - BEGIN
if (!defined('DIGEST_SITE_URL')) {
$digest_server_url = create_server_url();
define('DIGEST_SITE_URL', $digest_server_url);
}
if (!empty($config['cron_digests_interval']) && $config['cron_digests_interval'] > 0) {
// MG PHP Cron Emulation For Digests - BEGIN
$page_url = pathinfo($_SERVER['SCRIPT_NAME']);
$digests_pages_array = array(CMS_PAGE_PROFILE, CMS_PAGE_POSTING);
if (empty($config['cron_lock_hour']) && !in_array($page_url['basename'], $digests_pages_array)) {
if (time() - $config['cron_digests_last_run'] > CRON_REFRESH) {
$config['cron_digests_last_run'] = empty($config['cron_digests_last_run']) ? time() - 3600 : $config['cron_digests_last_run'];
$last_send_time = @getdate($config['cron_digests_last_run']);
$cur_time = @getdate();
if (!empty($config['cron_digests_interval']) && $config['cron_digests_interval'] > 0 && $cur_time['hours'] != $last_send_time['hours']) {
$cron_lock_hour_id = defined('CRON_ID') ? CRON_ID : 1;
set_config('cron_lock_hour', $cron_lock_hour_id);
define('PHP_DIGESTS_CRON', true);
define('PHP_DIGESTS_FUNCTIONS_CRON', true);
include_once IP_ROOT_PATH . 'mail_digests.' . PHP_EXT;
}
}
}
// MG PHP Cron Emulation For Digests - END
}
// Digests - END
if (CRON_DEBUG == false) {
set_config('cron_digests_last_run', time());
}
}
示例2: build_captcha
function build_captcha()
{
global $db, $cache, $config, $template, $user, $lang;
// Clean old sessions and old confirm codes
$user->confirm_gc();
// Generate the required confirmation code
$confirm_image = '';
$code = unique_id();
// 0 (zero) could get confused with O (the letter) so we change it
//$code = substr(str_replace(array('0'), array('Z'), strtoupper(base_convert($code, 16, 35))), 2, 6);
// Easiest to read charset... some letters and numbers may be ambiguous
$code = substr(str_replace(array('0', '1', '2', '5', 'O', 'I', 'Z', 'S'), array('A', 'B', 'C', 'D', 'E', 'F', 'G', 'H'), strtoupper(base_convert($code, 16, 35))), 2, $this->code_length);
$confirm_id = md5(uniqid($user->ip));
$sql = "INSERT INTO " . CONFIRM_TABLE . " (confirm_id, session_id, code)\n\t\t\tVALUES ('" . $db->sql_escape($confirm_id) . "', '" . $db->sql_escape($user->data['session_id']) . "', '" . $db->sql_escape($code) . "')";
$result = $db->sql_query($sql);
unset($code);
$server_url = create_server_url();
$confirm_image = '<img src="' . append_sid($server_url . CMS_PAGE_PROFILE . '?mode=confirm&confirm_id=' . $confirm_id) . '" alt="" title="" />';
$template->assign_vars(array('S_CAPTCHA' => true, 'CONFIRM_IMG' => $confirm_image, 'CAPTCHA_HIDDEN' => '<input type="hidden" name="confirm_id" value="' . $confirm_id . '" />', 'CAPTCHA_CODE_LENGTH' => $this->code_length, 'L_CONFIRM_CODE_IMPAIRED' => sprintf($lang['CONFIRM_CODE_IMPAIRED'], '<a href="mailto:' . $config['board_email'] . '">', '</a>')));
$return_array = array('confirm_id' => $confirm_id, 'confirm_image' => $confirm_image);
return $return_array;
}
示例3: notification
function notification($sender_id, $recipient_id, $recipient_email, $email_subject, $email_text, $use_bcc = false, $pm_subject = '', $recipient_username = '', $recipient_lang = '', $emty_email_template = false)
{
global $db, $config, $user, $lang;
require IP_ROOT_PATH . 'includes/emailer.' . PHP_EXT;
$recipient_lang = empty($recipient_lang) ? $config['default_lang'] : $recipient_lang;
// Let's do some checking to make sure that mass mail functions are working in win32 versions of php.
if (preg_match('/[c-z]:\\\\.*/i', getenv('PATH')) && !$config['smtp_delivery']) {
// We are running on windows, force delivery to use our smtp functions since php's are broken by default
$config['smtp_delivery'] = 1;
$config['smtp_host'] = @ini_get('SMTP');
}
$emailer = new emailer();
$emailer->headers('X-AntiAbuse: Board servername - ' . trim($config['server_name']));
$emailer->headers('X-AntiAbuse: User_id - ' . $user->data['user_id']);
$emailer->headers('X-AntiAbuse: Username - ' . $user->data['username']);
$emailer->headers('X-AntiAbuse: User IP - ' . $user->ip);
if ($use_bcc) {
$emailer->to($config['board_email']);
$emailer->bcc($recipient_email);
} else {
$emailer->to($recipient_email);
}
$emailer->set_subject($email_subject);
if ($emty_email_template) {
$emailer->use_template('admin_send_email', $recipient_lang);
$emailer->assign_vars(array('SITENAME' => $config['sitename'], 'BOARD_EMAIL' => $config['board_email'], 'MESSAGE' => $email_text));
} else {
$server_url = create_server_url();
$privmsg_url = $server_url . CMS_PAGE_PRIVMSG;
$recipient_username = empty($recipient_username) ? $lang['User'] : $recipient_username;
$email_sig = create_signature($config['board_email_sig']);
$emailer->use_template('privmsg_notify', $recipient_lang);
$emailer->assign_vars(array('USERNAME' => $recipient_username, 'SITENAME' => $config['sitename'], 'EMAIL_SIG' => $email_sig, 'FROM' => $user->data['username'], 'DATE' => create_date($config['default_dateformat'], time(), $config['board_timezone']), 'SUBJECT' => $pm_subject, 'PRIV_MSG_TEXT' => $email_text, 'FROM_USERNAME' => $user->data['username'], 'U_INBOX' => $privmsg_url . '?folder=inbox'));
}
$emailer->send();
$emailer->reset();
return true;
}
示例4: array
$user_info = array();
$user_info = generate_user_info($thispic);
foreach ($user_info as $k => $v) {
${$k} = $v;
}
$poster_avatar = $user_info['avatar'];
$template->assign_vars(array('CAT_TITLE' => $thispic['cat_title'], 'U_VIEW_CAT' => append_sid(album_append_uid('album_cat.' . PHP_EXT . '?cat_id=' . $cat_id)), 'ALBUM_NAVIGATION_ARROW' => ALBUM_NAV_ARROW, 'NAV_CAT_DESC' => $album_nav_cat_desc, 'EDIT' => $auth_data['moderator'] || $user->data['user_id'] == $thispic['pic_user_id'] ? '<a href="' . append_sid(album_append_uid('album_edit.' . PHP_EXT . '?pic_id=' . $thispic['pic_id'])) . '">' . $edit_link_content . '</a>' : '', 'DELETE' => $auth_data['moderator'] || $user->data['user_id'] == $thispic['pic_user_id'] ? '<a href="' . append_sid(album_append_uid('album_delete.' . PHP_EXT . '?pic_id=' . $thispic['pic_id'])) . '">' . $delete_link_content . '</a>' : '', 'LOCK' => $auth_data['moderator'] ? '<a href="' . append_sid(album_append_uid('album_modcp.' . PHP_EXT . '?mode=' . ($thispic['pic_lock'] == 0 ? 'lock' : 'unlock') . '&pic_id=' . $thispic['pic_id'])) . '">' . $lock_link_content . '</a>' : '', 'MOVE' => $auth_data['moderator'] ? '<a href="' . append_sid(album_append_uid('album_modcp.' . PHP_EXT . '?mode=move&pic_id=' . $thispic['pic_id'])) . '">' . $move_link_content . '</a>' : '', 'COPY' => $auth_data['moderator'] ? '<a href="' . append_sid(album_append_uid('album_modcp.' . PHP_EXT . '?mode=copy&pic_id=' . $thispic['pic_id'])) . '">' . $copy_link_content . '</a>' : '', 'U_PIC_FULL_URL' => $server_url . $pic_fullpath, 'U_PIC' => $pic_link, 'U_PIC_SP' => $pic_sp_link, 'U_PIC_DL' => $pic_dl_link, 'U_PIC_L1' => $pic_full_set ? '' : '<a href="' . append_sid(album_append_uid('album_showpage.' . PHP_EXT . '?full=true&pic_id=' . $pic_id . $sort_append . $nuffimage_vars)) . '">', 'U_PIC_L2' => $pic_full_set ? '' : '</a>', 'U_PIC_CLICK' => $pic_full_set ? '' : $lang['Click_enlarge'], 'U_PIC_THUMB' => append_sid(album_append_uid('album_thumbnail.' . PHP_EXT . '?pic_id=' . $pic_id . $sort_append)), 'U_SMILEY_CREATOR' => append_sid('smiley_creator.' . PHP_EXT . '?mode=text2shield'), 'PIC_COUNT' => sprintf($lang['Pics_Counter'], $new_pic_array_id + 1, $total_pic_count), 'NEXT_PIC' => $next_pic, 'PREV_PIC' => $prev_pic, 'L_PIC_DETAILS' => $lang['Pic_Details'], 'L_PIC_SIZE' => $lang['Pic_Size'], 'L_PIC_TYPE' => $lang['Pic_Type'], 'PIC_HEIGHT' => $pic_full_set ? $pic_height : $album_config['midthumb_height'], 'PIC_WIDTH' => $pic_full_set ? $pic_width : $album_config['midthumb_width'], 'PIC_SIZE' => $pic_width . ' x ' . $pic_height . ' (' . intval($pic_filesize / 1024) . 'KB)', 'PIC_TYPE' => strtoupper(substr($thispic['pic_filename'], strlen($thispic['pic_filename']) - 3, 3)), 'PIC_ID' => $pic_id, 'PIC_BBCODE' => '[albumimg]' . $pic_id . '[/albumimg]', 'PIC_TITLE' => $thispic['pic_title'], 'PIC_DESC' => $pic_desc, 'S_THUMBNAIL_SIZE' => $album_config['thumbnail_size'], 'POSTER' => $poster, 'POSTER_AVATAR' => $poster_avatar, 'PIC_TIME' => create_date_ip($config['default_dateformat'], $thispic['pic_time'], $config['board_timezone']), 'PIC_VIEW' => $thispic['pic_view_count'], 'PIC_COMMENTS' => $total_comments, 'TARGET_BLANK' => $album_config['fullpic_popup'] ? 'target="_blank"' : '', 'L_PIC_ID' => $lang['Pic_ID'], 'L_PIC_BBCODE' => $lang['Pic_BBCode'], 'L_PIC_TITLE' => $lang['Pic_Image'], 'L_PIC_DESC' => $lang['Pic_Desc'], 'L_POSTER' => $lang['Pic_Poster'], 'L_POSTED' => $lang['Posted'], 'L_VIEW' => $lang['Views'], 'L_COMMENTS' => $lang['Comments'], 'L_RATING' => $lang['Rating'], 'L_EDIT' => $lang['Edit'], 'L_DELETE' => $lang['Delete'], 'L_USER_WWW' => $lang['Website'], 'L_USER_EMAIL' => $lang['Send_Email'], 'L_USER_PROFILE' => $lang['Profile'], 'L_ONLINE_STATUS' => $lang['Online_status'], 'L_PM' => $lang['Private_Message'], 'L_POST_YOUR_COMMENT' => $lang['Post_your_comment'], 'L_MESSAGE' => $lang['Message'], 'L_USERNAME' => $lang['Username'], 'L_COMMENT_NO_TEXT' => $lang['Comment_no_text'], 'L_COMMENT_TOO_LONG' => $lang['Comment_too_long'], 'L_MAX_LENGTH' => $lang['Max_length'], 'S_MAX_LENGTH' => $album_config['desc_length'], 'L_ORDER' => $lang['Order'], 'L_SORT' => $lang['Sort'], 'L_ASC' => $lang['Sort_Ascending'], 'L_DESC' => $lang['Sort_Descending'], 'L_BACK_TO_TOP' => $lang['Back_to_top'], 'L_COMMENT_WATCH' => $lang['Pic_comment_notification'], 'SORT_ASC' => $sort_order == 'ASC' ? 'selected="selected"' : '', 'SORT_DESC' => $sort_order == 'DESC' ? 'selected="selected"' : '', 'L_SUBMIT' => $lang['Submit'], 'S_ALBUM_ACTION' => append_sid(album_append_uid('album_showpage.' . PHP_EXT . '?pic_id=' . $pic_id)), 'U_COMMENT_WATCH_LINK' => $is_watching_comments ? '<a href="' . append_sid('album_showpage.' . PHP_EXT . '?pic_id=' . $pic_id . '&unwatch=comment') . '">' . $lang['Unwatch_pic'] . '</a>' : ($user->data['session_logged_in'] ? '<a href="' . append_sid('album_showpage.' . PHP_EXT . '?pic_id=' . $pic_id . '&watch=comment') . '">' . $lang['Watch_pic'] . '</a>' : ''), 'S_RATE_MSG' => !$user->data['session_logged_in'] && $auth_data['rate'] == 0 ? $lang['Login_To_Vote'] : ($own_pic_rate == true && $user->data['user_level'] != ADMIN ? $lang['Own_Pic_Rate'] : ($already_rated == true && $user->data['user_level'] != ADMIN ? $lang['Already_rated'] : $lang['Please_Rate_It'])), 'PIC_RATING' => $image_rating . ($own_pic_rate == true && $user->data['user_level'] != ADMIN ? ' (' . $lang['Own_Pic_Rate'] . ')' : ($already_rated == true && $user->data['user_level'] != ADMIN ? ' (' . $lang['Already_rated'] . ')' : '')), 'L_CURRENT_RATING' => $lang['Current_Rating'], 'L_PLEASE_RATE_IT' => $lang['Please_Rate_It']));
// Social Bookmarks
if ($config['show_social_bookmarks'] == true) {
$template->assign_block_vars('social_bookmarks', array());
}
$topic_title_enc = urlencode(ip_utf8_decode($thispic['pic_title']));
$topic_title_enc_utf8 = urlencode($thispic['pic_title']);
$topic_link = 'album_showpage.' . PHP_EXT . '?pic_id=' . $thispic['pic_id'] . $full_size_param . $nuffimage_vars . $sort_append;
$topic_url_enc = urlencode(ip_utf8_decode(create_server_url() . $topic_link));
$topic_url_enc_utf8 = urlencode(create_server_url() . $topic_link);
$template->assign_vars(array('TOPIC_TITLE_ENC' => $topic_title_enc, 'TOPIC_TITLE_ENC_UTF8' => $topic_title_enc_utf8, 'TOPIC_URL_ENC' => $topic_url_enc, 'TOPIC_URL_ENC_UTF8' => $topic_url_enc_utf8, 'U_TELL' => append_sid('tellafriend.' . PHP_EXT . '?topic_title=' . $topic_title_enc . '&topic_url=' . urlencode(ip_utf8_decode(str_replace('&', '&', $topic_link)))), 'L_SHARE_TOPIC' => $lang['ShareThisTopic']));
// BBCBMG - BEGIN
include IP_ROOT_PATH . 'includes/bbcb_mg.' . PHP_EXT;
$template->assign_var_from_handle('BBCB_MG', 'bbcb_mg');
// BBCBMG - END
// BBCBMG SMILEYS - BEGIN
generate_smilies('inline');
include IP_ROOT_PATH . 'includes/bbcb_smileys_mg.' . PHP_EXT;
$template->assign_var_from_handle('BBCB_SMILEYS_MG', 'bbcb_smileys_mg');
// BBCBMG SMILEYS - END
if ($album_config['comment'] == 1 && $total_comments > 0) {
$template->assign_vars(array('PAGINATION' => generate_pagination(append_sid(album_append_uid('album_showpage.' . PHP_EXT . '?pic_id=' . $pic_id . '&sort_order=' . $sort_order)), $total_comments, $comments_per_page, $start), 'PAGE_NUMBER' => sprintf($lang['Page_of'], floor($start / $comments_per_page) + 1, ceil($total_comments / $comments_per_page))));
$template->assign_block_vars('switch_comment', array());
$template->assign_block_vars('comment_switcharo_bottom', array());
}
示例5: obtain_smileys
function obtain_smileys($from_cache = false)
{
global $db, $config;
if (($smileys = $this->get('_smileys')) === false) {
$smileys = array();
$smileys_path = create_server_url() . $config['smilies_path'] . '/';
$sql = "SELECT code, smile_url FROM " . SMILIES_TABLE . " ORDER BY smilies_order";
$result = $from_cache ? $db->sql_query($sql, 0, 'smileys_') : $db->sql_query($sql);
while ($row = $db->sql_fetchrow($result)) {
$smileys[] = array('code' => $row['code'], 'replace' => '<img src="' . $smileys_path . $row['smile_url'] . '" alt="" />');
}
$db->sql_freeresult($result);
$this->put('_smileys', $smileys);
}
return $smileys;
}
示例6: urlencode
}
$topic_title = $post_data['topic_title'];
$topic_title_enc = urlencode(ip_utf8_decode($topic_title));
$topic_title_enc_utf8 = urlencode($topic_title);
// URL Rewrite - BEGIN
// Rewrite Social Bookmars URLs if any of URL Rewrite rules has been enabled
// Forum ID and KB Mode removed from topic_url_enc to avoid compatibility problems with redirects in tell a friend
if (($config['url_rw'] == true) || ($config['url_rw_guests'] == true))
{
$topic_url = create_server_url() . make_url_friendly($topic_title) . (empty($link_topic) ? ('-vp' . $post_id . '.html' . $post_id_append_url) : ('-vt' . $topic_id . '.html'));
}
else
{
$topic_url = create_server_url() . ip_build_url(CMS_PAGE_VIEWTOPIC, array($topic_id_append, $post_id_append), false) . $post_id_append_url;
}
$topic_url_ltt = htmlspecialchars($topic_url);
$topic_url_enc = urlencode(ip_utf8_decode($topic_url));
$topic_url_enc_utf8 = urlencode($topic_url);
// URL Rewrite - END
// Convert and clean special chars!
$topic_title = htmlspecialchars_clean($topic_title);
$template->assign_vars(array(
'FORUM_ID' => $forum_id,
'TOPIC_ID' => $topic_id,
'POST_ID' => $post_id,
'TOPIC_TITLE' => $topic_title,
'TOPIC_TITLE_SHORT' => ((strlen($topic_title) > 80) ? substr($topic_title, 0, 75) . '...' : $topic_title),
'TOPIC_TITLE_ENC' => $topic_title_enc,
示例7: birthday_email_send
/**
* Sends a birthday Email
*/
function birthday_email_send()
{
global $db, $cache, $config, $lang;
if (!class_exists('emailer')) {
@(include IP_ROOT_PATH . 'includes/emailer.' . PHP_EXT);
}
$server_url = create_server_url();
$birthdays_list = get_birthdays_list_email();
foreach ($birthdays_list as $k => $v) {
// Birthday - BEGIN
// Check if the user has or have had birthday, also see if greetings are enabled
if (!empty($config['birthday_greeting'])) {
// Birthday Email - BEGIN
setup_extra_lang(array('lang_cron_vars'), '', $v['user_lang']);
$year = create_date('Y', time(), $v['user_timezone']);
$date_today = create_date('Ymd', time(), $v['user_timezone']);
$user_birthday = realdate('md', $v['user_birthday']);
$user_birthday2 = ($year . $user_birthday < $date_today ? $year + 1 : $year) . $user_birthday;
$user_age = create_date('Y', time(), $v['user_timezone']) - realdate('Y', $v['user_birthday']);
if (create_date('md', time(), $v['user_timezone']) < realdate('md', $v['user_birthday'])) {
$user_age--;
}
$email_subject = sprintf($lang['BIRTHDAY_GREETING_EMAIL_SUBJECT'], $config['sitename']);
//$email_text = sprintf($lang['BIRTHDAY_GREETING_EMAIL_CONTENT_AGE'], $user_age);
$email_text = sprintf($lang['BIRTHDAY_GREETING_EMAIL_CONTENT'], $config['sitename']);
// Send the email!
$emailer = new emailer();
$emailer->use_template('birthday_greeting', $v['user_lang']);
$emailer->to($v['user_email']);
// If for some reason the mail template subject cannot be read... note it will not necessarily be in the posters own language!
$emailer->set_subject($email_subject);
$v['username'] = !empty($v['user_first_name']) ? $v['user_first_name'] : $v['username'];
// This is a nasty kludge to remove the username var ... till (if?) translators update their templates
$emailer->msg = preg_replace('#[ ]?{USERNAME}#', $v['username'], $emailer->msg);
$email_sig = create_signature($config['board_email_sig']);
$emailer->assign_vars(array('USERNAME' => !empty($config['html_email']) ? htmlspecialchars($v['username']) : $v['username'], 'USER_AGE' => $user_age, 'EMAIL_SIG' => $email_sig, 'SITENAME' => $config['sitename'], 'SITE_URL' => $server_url));
$emailer->send();
$emailer->reset();
// Birthday Email - END
$sql = "UPDATE " . USERS_TABLE . "\n\t\t\t\tSET user_next_birthday_greeting = " . (create_date('Y', time(), $v['user_timezone']) + 1) . "\n\t\t\t\tWHERE user_id = " . $v['user_id'];
$status = $db->sql_query($sql);
}
// Birthday - END
}
// We reset the lang again for default lang...
setup_extra_lang(array('lang_cron_vars'));
}
示例8: basename
if (!empty($setmodules)) {
$file = basename(__FILE__);
$module['2000_Downloads']['130_Fchecker'] = $file;
return;
}
if (!defined('IP_ROOT_PATH')) {
define('IP_ROOT_PATH', './../');
}
if (!defined('PHP_EXT')) {
define('PHP_EXT', substr(strrchr(__FILE__, '.'), 1));
}
require 'pagestart.' . PHP_EXT;
setup_extra_lang(array('lang_admin_pafiledb'));
include IP_ROOT_PATH . 'includes/pafiledb_common.' . PHP_EXT;
$this_dir = IP_ROOT_PATH . DOWNLOADS_PATH;
$html_path = create_server_url() . DOWNLOADS_PATH;
$safety = request_var('safety', 0);
$template->set_filenames(array('admin' => ADM_TPL . 'pa_admin_file_checker.tpl'));
$template->assign_vars(array('L_FILE_CHECKER' => $lang['File_checker'], 'L_FCHECKER_EXPLAIN' => $lang['File_checker_explain']));
if ($safety == 1) {
$saved = 0;
$template->assign_block_vars("check", array());
$template->assign_vars(array('L_FILE_CHECKER_SP1' => $lang['Checker_sp1']));
$sql = "SELECT * FROM " . PA_FILES_TABLE;
$overall_result = $db->sql_query($sql);
while ($temp = $db->sql_fetchrow($overall_result)) {
$temp_dlurl = $temp['file_dlurl'];
if (substr($temp_dlurl, 0, strlen($html_path)) !== $html_path) {
continue;
}
if (!is_file($this_dir . '/' . str_replace($html_path, '', $temp_dlurl))) {
示例9: create_server_url
include IP_ROOT_PATH . 'common.' . PHP_EXT;
// Options - BEGIN
// Number of items
$news_items = 10;
// Items type: 'news' or 'topics'
$news_type = 'news';
// Recent: true or false (if set to false then random items will be selected)
$news_recent = true;
// Cache: select true only if you want to use cached version of selected items
$news_cache = false;
// Cache file
$news_cache_file = MAIN_CACHE_FOLDER . 'flash_news_data.xml';
// Cache frequency
$news_cache_freq = 86400;
// Base address
$news_base_address = create_server_url();
// Viewtopic address
$news_base_url = CMS_PAGE_VIEWTOPIC;
// Options - END
/*
* Build_allowed_forums_list: needed to build a list of forum with read access
*/
function flash_build_allowed_forums_list()
{
$allowed_forums = '';
$forum_types = array(FORUM_POST);
$forums_array = get_forums_ids($forum_types, true, false, true, true);
foreach ($forums_array as $forum) {
$allowed_forums .= (empty($allowed_forums) ? '' : ',') . $forum['forum_id'];
}
return $allowed_forums;
示例10: main
//.........这里部分代码省略.........
global $pafiledb_config, $debug;
$file_id = request_var('file_id', 0);
if (empty($file_id)) {
message_die(GENERAL_MESSAGE, $lang['File_not_exist']);
}
$sql = 'SELECT file_catid, file_name
FROM ' . PA_FILES_TABLE . "\n\t\t\tWHERE file_id = {$file_id}";
$result = $db->sql_query($sql);
if (!($file_data = $db->sql_fetchrow($result))) {
message_die(GENERAL_MESSAGE, $lang['File_not_exist']);
}
$db->sql_freeresult($result);
if (!$this->auth[$file_data['file_catid']]['auth_email']) {
if (!$user->data['session_logged_in']) {
redirect(append_sid(CMS_PAGE_LOGIN . '?redirect=dload.' . PHP_EXT . '&action=email&file_id=' . $file_id, true));
}
$message = sprintf($lang['Sorry_auth_email'], $this->auth[$file_data['file_catid']]['auth_email_type']);
message_die(GENERAL_MESSAGE, $message);
}
if (isset($_POST['submit'])) {
// session id check
$sid = request_post_var('sid', '');
if (empty($sid) || $sid != $user->data['session_id']) {
message_die(GENERAL_ERROR, 'INVALID_SESSION');
}
$error = false;
$femail = request_var('femail', '');
if (!empty($femail) && preg_match('/^[a-z0-9\\.\\-_\\+]+@[a-z0-9\\-_]+\\.([a-z0-9\\-_]+\\.)*?[a-z]+$/is', $femail)) {
$user_email = $femail;
} else {
$error = true;
$error_msg = !empty($error_msg) ? $error_msg . '<br />' . $lang['Email_invalid'] : $lang['Email_invalid'];
}
$username = request_var('fname', '', true);
$sender_name = request_var('sname', '', true);
//if (!$user->data['session_logged_in'] || ($user->data['session_logged_in'] && ($sender_name != $user->data['username'])))
if (!$user->data['session_logged_in']) {
// Mighty Gorgon: is this really needed?
/*
include(IP_ROOT_PATH . 'includes/functions_validate.' . PHP_EXT);
$result = validate_username($sender_name);
if ($result['error'])
{
$error = true;
$error_msg .= (!empty($error_msg)) ? '<br />' . $result['error_msg'] : $result['error_msg'];
}
*/
} else {
$sender_name = $user->data['username'];
}
if (!$user->data['session_logged_in']) {
$semail = request_var('semail', '');
if (!empty($semail) && preg_match('/^[a-z0-9\\.\\-_\\+]+@[a-z0-9\\-_]+\\.([a-z0-9\\-_]+\\.)*?[a-z]+$/is', $femail)) {
$sender_email = $semail;
} else {
$error = true;
$error_msg = !empty($error_msg) ? $error_msg . '<br />' . $lang['Email_invalid'] : $lang['Email_invalid'];
}
} else {
$sender_email = $user->data['user_email'];
}
$subject = request_var('subject', '', true);
$subject = htmlspecialchars_decode($subject, ENT_COMPAT);
if (empty($subject)) {
$error = true;
$error_msg = !empty($error_msg) ? $error_msg . '<br />' . $lang['Empty_subject_email'] : $lang['Empty_subject_email'];
}
$message = request_var('message', '', true);
// We need to check if HTML emails are enabled so we can correctly escape content and linebreaks
$message = !empty($config['html_email']) ? nl2br($message) : htmlspecialchars_decode($message, ENT_COMPAT);
if (empty($message)) {
$error = true;
$error_msg = !empty($error_msg) ? $error_msg . '<br />' . $lang['Empty_message_email'] : $lang['Empty_message_email'];
}
if (!$error) {
include IP_ROOT_PATH . 'includes/emailer.' . PHP_EXT;
$emailer = new emailer();
$emailer->headers('X-AntiAbuse: Board servername - ' . trim($config['server_name']));
$emailer->headers('X-AntiAbuse: User_id - ' . $user->data['user_id']);
$emailer->headers('X-AntiAbuse: Username - ' . $user->data['username']);
$emailer->headers('X-AntiAbuse: User IP - ' . $user_ip);
$emailer->use_template('profile_send_email', $user_lang);
$emailer->to($user_email);
$emailer->from($sender_email);
$emailer->replyto($sender_email);
$emailer->set_subject($subject);
$emailer->assign_vars(array('SITENAME' => $config['sitename'], 'BOARD_EMAIL' => $config['board_email'], 'FROM_USERNAME' => $sender_name, 'TO_USERNAME' => $username, 'MESSAGE' => $message));
$emailer->send();
$emailer->reset();
$message = $lang['Econf'] . '<br /><br />' . sprintf($lang['Click_return'], '<a href="' . append_sid('dload.' . PHP_EXT . '?action=file&file_id=' . $file_id) . '">', '</a>') . '<br /><br />' . sprintf($lang['Click_return_forum'], '<a href="' . append_sid(CMS_PAGE_HOME) . '">', '</a>');
message_die(GENERAL_MESSAGE, $message);
}
if ($error) {
message_die(GENERAL_MESSAGE, $error_msg);
}
}
$this->generate_category_nav($file_data['file_catid']);
$template->assign_vars(array('USER_LOGGED' => !$user->data['session_logged_in'] ? true : false, 'L_HOME' => $lang['Home'], 'CURRENT_TIME' => sprintf($lang['Current_time'], create_date($config['default_dateformat'], time(), $config['board_timezone'])), 'S_EMAIL_ACTION' => append_sid('dload.' . PHP_EXT), 'S_HIDDEN_FIELDS' => '<input type="hidden" name="sid" value="' . $user->data['session_id'] . '" />', 'L_INDEX' => sprintf($lang['Forum_Index'], $config['sitename']), 'L_EMAIL' => $lang['Semail'], 'L_EMAIL' => $lang['Emailfile'], 'L_EMAILINFO' => $lang['Emailinfo'], 'L_YNAME' => $lang['Yname'], 'L_YEMAIL' => $lang['Yemail'], 'L_FNAME' => $lang['Fname'], 'L_FEMAIL' => $lang['Femail'], 'L_ETEXT' => $lang['Etext'], 'L_DEFAULTMAIL' => $lang['Defaultmail'], 'L_SEMAIL' => $lang['Semail'], 'L_ESUB' => $lang['Esub'], 'L_EMPTY_SUBJECT_EMAIL' => $lang['Empty_subject_email'], 'L_EMPTY_MESSAGE_EMAIL' => $lang['Empty_message_email'], 'U_INDEX_HOME' => append_sid(CMS_PAGE_HOME), 'U_DOWNLOAD_HOME' => append_sid('dload.' . PHP_EXT), 'U_FILE_NAME' => append_sid('dload.' . PHP_EXT . '?action=file&file_id=' . $file_id), 'FILE_NAME' => $file_data['file_name'], 'SNAME' => $user->data['username'], 'SEMAIL' => $user->data['user_email'], 'DOWNLOAD' => $pafiledb_config['settings_dbname'], 'FILE_URL' => create_server_url() . 'dload.' . PHP_EXT . '?action=file&file_id=' . $file_id, 'ID' => $file_id));
$this->display($lang['Download'], 'pa_email_body.tpl');
}
示例11: get_file_size
function get_file_size($file_id, $file_data = '')
{
global $db, $lang, $pafiledb_config;
$directory = IP_ROOT_PATH . $pafiledb_config['upload_dir'];
if (empty($file_data)) {
$sql = "SELECT file_dlurl, file_size, unique_name, file_dir\n\t\t\t\tFROM " . PA_FILES_TABLE . "\n\t\t\t\tWHERE file_id = '" . $file_id . "'";
$result = $db->sql_query($sql);
$file_data = $db->sql_fetchrow($result);
$db->sql_freeresult($result);
}
$file_url = $file_data['file_dlurl'];
$file_size = $file_data['file_size'];
$html_path = create_server_url() . $directory;
$update_filesize = false;
if ((substr($file_url, 0, strlen($html_path)) == $html_path || !empty($file_data['unique_name'])) && empty($file_size)) {
$file_url = basename($file_url);
$file_name = basename($file_url);
if (!empty($file_data['unique_name']) && !file_exists(IP_ROOT_PATH . $file_data['file_dir'] . $file_data['unique_name'])) {
return $lang['Not_available'];
}
if (empty($file_data['unique_name'])) {
$file_size = @filesize($directory . $file_name);
} else {
$file_size = @filesize(IP_ROOT_PATH . $file_data['file_dir'] . $file_data['unique_name']);
}
$update_filesize = true;
} elseif (empty($file_size) && (!(substr($file_url, 0, strlen($html_path)) == $html_path) || empty($file_data['unique_name']))) {
$ourhead = "";
$url = parse_url($file_url);
$host = $url['host'];
$path = $url['path'];
$port = !empty($url['port']) ? $url['port'] : 80;
$fp = @fsockopen($host, $port, $errno, $errstr, 20);
if (!$fp) {
return $lang['Not_available'];
} else {
fwrite($fp, "HEAD {$file_url} HTTP/1.1\r\n");
fwrite($fp, "HOST: {$host}\r\n");
fwrite($fp, "Connection: close\r\n\r\n");
while (!feof($fp)) {
$ourhead = sprintf('%s%s', $ourhead, fgets($fp, 128));
}
}
@fclose($fp);
$split_head = explode('Content-Length: ', $ourhead);
$file_size = round(abs($split_head[1]));
$update_filesize = true;
}
if ($update_filesize) {
$sql = 'UPDATE ' . PA_FILES_TABLE . "\n\t\t\t\tSET file_size = '{$file_size}'\n\t\t\t\tWHERE file_id = '{$file_id}'";
$db->sql_query($sql);
}
if ($file_size < 1024) {
$file_size_out = intval($file_size) . ' ' . $lang['Bytes'];
}
if ($file_size >= 1025) {
$file_size_out = round(intval($file_size) / 1024 * 100) / 100 . ' ' . $lang['KB'];
}
if ($file_size >= 1048575) {
$file_size_out = round(intval($file_size) / 1048576 * 100) / 100 . ' ' . $lang['MB'];
}
return $file_size_out;
}
示例12: header
}
include IP_ROOT_PATH . 'common.' . PHP_EXT;
// Start session management
$user->session_begin();
$auth->acl($user->data);
$user->setup();
// End session management
// Get general album information
include ALBUM_MOD_PATH . 'album_common.' . PHP_EXT;
// XML and nocaching headers
// header ('Cache-Control: private, pre-check=0, post-check=0, max-age=0');
header('Expires: ' . gmdate('D, d M Y H:i:s') . ' GMT');
header('Last-Modified: ' . gmdate('D, d M Y H:i:s') . ' GMT');
header('Content-Type: text/xml');
// Create main site url
$fap_full_url = create_server_url();
$index_site = $fap_full_url . 'album.' . PHP_EXT;
$index_url = $fap_full_url . 'album_showpage.' . PHP_EXT;
$thumb_url = $fap_full_url . 'album_thumbnail.' . PHP_EXT;
// If not set, set the output count to 25
$count = request_var('np', 25);
$count = $count <= 0 ? 25 : $count;
// BEGIN Recent Photos
// Start check permissions
$sql_allowed_cat = '';
$check_sel = $admin_mode ? 0 : 1;
if ($user->data['user_level'] != ADMIN) {
$album_user_access = personal_gallery_access(true, false);
$not_allowed_cat = $album_user_access['view'] == 1 ? '' : '0';
$sql = "SELECT c.*\n\t\tFROM " . ALBUM_CAT_TABLE . " AS c\n\t\tWHERE cat_id <> 0";
$result = $db->sql_query($sql);
示例13: array
$resultat = $db->sql_query($sql);
$show = $db->sql_numrows($resultat) ? true : false;
}
}
if (!$show && preg_match('/\\[hide/i', $message)) {
$search = array("/\\[hide\\](.*?)\\[\\/hide\\]/");
$replace = array($lang['xs_bbc_hide_message'] . ':' . $break . $lang['xs_bbc_hide_message_explain'] . $break);
$message = preg_replace($search, $replace, $message);
}
$message = unprepare_message($message);
$search = array('/(/', '/)/', '/:/', '/[/', '/]/', '/{/', '/}/');
$replace = array('(', ')', ':', '[', ']', '{', '}');
$message = preg_replace($search, $replace, $message);
$post_subject = censor_text($post_subject);
$message = censor_text($message);
$download_file .= $line . $break . $poster . $break . $post_date . $break . $break . $post_subject . $break . $line . $break . $message . $break . $break . $break;
}
$db->sql_freeresult($result);
$disp_folder = $download == -1 ? 'topic_' . $topic_id : 'post_' . $download;
$this_download_src = create_server_url() . (CMS_PAGE_VIEWTOPIC . '?' . $forum_id_append . '&' . $topic_id_append . ($download > 0 ? '&' . POST_POST_URL . '=' . $download . '#p' . $download : ''));
$download_file = $this_download_src . $break . $download_file;
if (!$is_auth_read['auth_read']) {
$download_file = sprintf($lang['Sorry_auth_read'], $is_auth_read['auth_read_type']);
$disp_folder = 'Download';
}
$filename = ip_clean_string($config['sitename'], $lang['ENCODING']) . '_' . ip_clean_string($post_subject, $lang['ENCODING']) . '_' . $disp_folder . '_' . gmdate('Ymd') . '.txt';
header('Content-Type: text/x-delimtext; name="' . $filename . '"');
header('Content-Disposition: attachment;filename="' . $filename . '"');
header('Content-Transfer-Encoding: plain/text');
header('Content-Length: ' . strlen($download_file));
print $download_file;
示例14: urlencode
$template->assign_var('S_FEATURED_IMAGE', true);
}
$topic_title_enc = urlencode(ip_utf8_decode($topic_title));
$topic_title_enc_utf8 = urlencode($topic_title);
// URL Rewrite - BEGIN
// Rewrite Social Bookmars URLs if any of URL Rewrite rules has been enabled
// Forum ID and KB Mode removed from topic_url_enc to avoid compatibility problems with redirects in tell a friend
if (($config['url_rw'] == true) || ($config['url_rw_guests'] == true))
{
$topic_url = create_server_url() . make_url_friendly($topic_title) . '-vt' . $topic_id . '.html' . ($kb_mode ? ('?' . $kb_mode_append) : '');
}
else
{
$topic_url = create_server_url() . ip_build_url(CMS_PAGE_VIEWTOPIC, array($forum_id_append, $topic_id_append), false) . $kb_mode_append_red;
}
$topic_url_ltt = htmlspecialchars($topic_url);
$topic_url_enc = urlencode(ip_utf8_decode($topic_url));
$topic_url_enc_utf8 = urlencode($topic_url);
// URL Rewrite - END
// Convert and clean special chars!
$topic_title = htmlspecialchars_clean($topic_title);
$template->assign_vars(array(
'FORUM_ID' => $forum_id,
'FORUM_ID_FULL' => POST_FORUM_URL . $forum_id,
'FORUM_NAME' => $forum_name,
'FORUM_RULES' => $rules_bbcode,
'TOPIC_ID' => $topic_id,
'TOPIC_ID_FULL' => POST_TOPIC_URL . $topic_id,
示例15: update_add_file
function update_add_file($file_id = false)
{
global $db, $config, $user, $pafiledb_config, $pafiledb_functions;
$ss_upload = request_post_var('screen_shot_url', '');
$ss_upload = empty($ss_upload) ? true : false;
$ss_remote_url = request_post_var('screen_shot_url', '');
$ss_local = $_FILES['screen_shot']['tmp_name'] !== 'none' ? $_FILES['screen_shot']['tmp_name'] : '';
$ss_name = $_FILES['screen_shot']['name'] !== 'none' ? $_FILES['screen_shot']['name'] : '';
$ss_size = !empty($_FILES['screen_shot']['size']) ? $_FILES['screen_shot']['size'] : '';
$file_upload = request_post_var('download_url', '');
$file_upload = empty($file_upload) ? true : false;
$file_remote_url = request_post_var('download_url', '');
$file_remote_url = str_replace(array(' '), array('%20'), $file_remote_url);
$file_local = $_FILES['userfile']['tmp_name'] !== 'none' ? $_FILES['userfile']['tmp_name'] : '';
$file_realname = $_FILES['userfile']['name'] !== 'none' ? $_FILES['userfile']['name'] : '';
$file_size = !empty($_FILES['userfile']['size']) ? $_FILES['userfile']['size'] : '';
if ($file_size == '' && $file_remote_url != '') {
$file_remote_url_clean = str_replace(create_server_url(), '', $file_remote_url);
//die("$file_remote_url_clean");
$file_size = @filesize($file_remote_url_clean);
$file_size = $file_size == false ? 0 : $file_size;
//die("$file_size");
}
$file_type = !empty($_FILES['userfile']['type']) ? $_FILES['userfile']['type'] : '';
$cat_id = request_var('cat_id', 0);
$file_name = request_post_var('name', '', true);
$file_long_desc = request_post_var('long_desc', '', true);
$file_short_desc = request_post_var('short_desc', '', true);
$file_short_desc = !empty($file_short_desc) ? $file_short_desc : (!empty($file_long_desc) ? substr($file_long_desc, 0, 50) . '...' : '');
$file_author = request_post_var('author', '', true);
$file_author = !empty($file_author) ? $file_author : ($user->data['user_id'] != ANONYMOUS ? $user->data['username'] : '');
$file_version = request_post_var('version', '', true);
$file_website = request_post_var('website', '', true);
if (!empty($file_website)) {
$file_website = !preg_match('#^http[s]?:\\/\\/#i', $file_website) ? 'http://' . $file_website : $file_website;
$file_website = preg_match('#^http[s]?\\:\\/\\/[a-z0-9\\-]+\\.([a-z0-9\\-]+\\.)?[a-z]+#i', $file_website) ? $file_website : '';
}
$file_posticon = request_post_var('posticon', '');
$file_license = request_post_var('license', 0);
$file_pin = request_post_var('pin', 0);
$file_ss_link = request_post_var('sshot_link', 0);
$file_dls = request_post_var('file_download', 0);
$file_time = time();
$file_time_sql = '';
if ($cat_id == -1) {
$this->error[] = $lang['Missing_field'];
}
if (empty($file_name)) {
$this->error[] = $lang['Missing_field'];
}
if (empty($file_long_desc)) {
$this->error[] = $lang['Missing_field'];
}
if (empty($file_remote_url) && empty($file_local) && !$file_id) {
$this->error[] = $lang['Missing_field'];
}
$forbidden_extensions = array_map('trim', @explode(',', $pafiledb_config['forbidden_extensions']));
$file_extension = $pafiledb_functions->get_extension($file_realname);
if (in_array($file_extension, $forbidden_extensions)) {
$this->error[] = 'You are not allowed to upload this type of files';
}
if (sizeof($this->error)) {
return;
}
$physical_file_name = '';
if ($file_id) {
$sql = 'SELECT file_dlurl, file_size, unique_name, file_dir, real_name, file_approved
FROM ' . PA_FILES_TABLE . "\n\t\t\t\tWHERE file_id = '{$file_id}'";
$result = $db->sql_query($sql);
$file_data = $db->sql_fetchrow($result);
$db->sql_freeresult($result);
if (!empty($file_remote_url) || !empty($file_local)) {
$file_time_sql = 'file_time = \'' . time() . '\',';
if (!empty($file_data['unique_name'])) {
$pafiledb_functions->pafiledb_unlink(IP_ROOT_PATH . $file_data['file_dir'] . $file_data['unique_name']);
}
} else {
$file_remote_url_old = $file_remote_url;
$file_realname_old = $file_realname;
$file_remote_url = $file_data['file_dlurl'];
$physical_file_name = $file_data['unique_name'];
$file_realname = $file_data['real_name'];
//die($file_remote_url_old . '<br />' . $file_remote_url . '<br />' . $file_realname_old . '<br />' . $file_realname);
if ($file_remote_url_old != $file_remote_url || $file_realname_old != $file_realname) {
$file_time_sql = 'file_time = \'' . time() . '\',';
}
if (empty($file_local)) {
$file_upload = false;
}
}
}
if ($file_upload) {
$physical_file_name = $pafiledb_functions->gen_unique_name('.' . $file_extension);
$file_info = $pafiledb_functions->upload_file($file_local, $physical_file_name, $file_size, $pafiledb_config['upload_dir']);
if ($file_info['error']) {
message_die(GENERAL_ERROR, $file_info['message']);
}
}
$ss_upload = request_post_var('screen_shot_url', '');
$ss_upload = empty($ss_upload) ? true : false;
//.........这里部分代码省略.........