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


PHP prepare_message函数代码示例

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


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

示例1: send_pm

function send_pm($user_from_id, $user_to_id, $pm_subject, $pm_message)
{
    global $ft_cfg, $lang;
    $sql = "SELECT *\r\n\t\tFROM " . USERS_TABLE . " \r\n\t\tWHERE user_id = " . $user_to_id . "\r\n\t\tAND user_id <> " . GUEST_UID;
    if (!($result = DB()->sql_query($sql))) {
        message_die(GENERAL_ERROR, $lang['non_existing_user'], '', __LINE__, __FILE__, $sql);
    }
    $usertodata = DB()->sql_fetchrow($result);
    // prepare pm message
    $bbcode_uid = make_bbcode_uid();
    $pm_message = prepare_message($pm_message, 0, 1, 1, $bbcode_uid);
    $msg_time = time();
    // Do inbox limit stuff
    $sql = "SELECT COUNT(privmsgs_id) AS inbox_items, MIN(privmsgs_date) AS oldest_post_time \r\n\t\tFROM " . PRIVMSGS_TABLE . " \r\n\t\tWHERE ( privmsgs_type = " . PRIVMSGS_NEW_MAIL . " \r\n\t\t\tOR privmsgs_type = " . PRIVMSGS_READ_MAIL . "  \r\n\t\t\tOR privmsgs_type = " . PRIVMSGS_UNREAD_MAIL . " ) \r\n\t\t\tAND privmsgs_to_userid = " . $usertodata['user_id'];
    if (!($result = DB()->sql_query($sql))) {
        message_die(GENERAL_MESSAGE, $lang['No_such_user']);
    }
    $sql_priority = SQL_LAYER == 'mysql' ? 'LOW_PRIORITY' : '';
    if ($inbox_info = DB()->sql_fetchrow($result)) {
        if ($inbox_info['inbox_items'] >= $ft_cfg['max_inbox_privmsgs']) {
            $sql = "DELETE {$sql_priority} FROM " . PRIVMSGS_TABLE . " \r\n\t\t\t\tWHERE ( privmsgs_type = " . PRIVMSGS_NEW_MAIL . " \r\n\t\t\t\t\tOR privmsgs_type = " . PRIVMSGS_READ_MAIL . " \r\n\t\t\t\t\tOR privmsgs_type = " . PRIVMSGS_UNREAD_MAIL . "  ) \r\n\t\t\t\t\tAND privmsgs_date = " . $inbox_info['oldest_post_time'] . " \r\n\t\t\t\t\tAND privmsgs_to_userid = " . $usertodata['user_id'];
            if (!DB()->sql_query($sql)) {
                message_die(GENERAL_ERROR, $lang['not_delete_pm'], '', __LINE__, __FILE__, $sql);
            }
        }
    }
    $sql_info = "INSERT INTO " . PRIVMSGS_TABLE . " (privmsgs_type, privmsgs_subject, privmsgs_from_userid, privmsgs_to_userid, privmsgs_date, privmsgs_ip, privmsgs_enable_html, privmsgs_enable_bbcode, privmsgs_enable_smilies, privmsgs_attach_sig)\r\n\t\tVALUES (" . PRIVMSGS_NEW_MAIL . ", '" . str_replace("\\'", "''", $pm_subject) . "', " . $user_from_id . ", " . $usertodata['user_id'] . ", {$msg_time}, '{$user_ip}', 0, 1, 1, 1)";
    if (!($result = DB()->sql_query($sql_info, BEGIN_TRANSACTION))) {
        message_die(GENERAL_ERROR, $lang['no_sent_pm_insert'], "", __LINE__, __FILE__, $sql_info);
    }
    $privmsg_sent_id = DB()->sql_nextid();
    $sql = "INSERT INTO " . PRIVMSGS_TEXT_TABLE . " (privmsgs_text_id, privmsgs_bbcode_uid, privmsgs_text)\r\n\t\tVALUES ({$privmsg_sent_id}, '" . $bbcode_uid . "', '" . str_replace("\\'", "''", $pm_message) . "')";
    if (!DB()->sql_query($sql, END_TRANSACTION)) {
        message_die(GENERAL_ERROR, $lang['no_sent_pm_insert'], "", __LINE__, __FILE__, $sql_info);
    }
    // Add to the users new pm counter
    $sql = "UPDATE " . USERS_TABLE . "\r\n\t\tSET user_new_privmsg = user_new_privmsg + 1, user_last_privmsg = " . time() . "\r\n\t\tWHERE user_id = " . $usertodata['user_id'];
    if (!($status = DB()->sql_query($sql))) {
        message_die(GENERAL_ERROR, $lang['no_sent_pm_insert'], '', __LINE__, __FILE__, $sql);
    }
    return;
}
开发者ID:forummaks,项目名称:forum_maks,代码行数:42,代码来源:function_sendpm.php

示例2: main

    function main($action)
    {
        global $db, $cache, $config, $template, $images, $theme, $user, $lang, $bbcode, $bbcode_tpl;
        global $html_entities_match, $html_entities_replace, $unhtml_specialchars_match, $unhtml_specialchars_replace;
        global $pafiledb_functions, $pafiledb_config, $view_pic_upload, $starttime, $post_image_lang;
        @(include_once IP_ROOT_PATH . 'includes/bbcode.' . PHP_EXT);
        @(include_once IP_ROOT_PATH . 'includes/functions_post.' . PHP_EXT);
        @(include_once IP_ROOT_PATH . PA_FILE_DB_PATH . 'functions_comment.' . PHP_EXT);
        $file_id = request_var('file_id', 0);
        if (empty($file_id)) {
            message_die(GENERAL_MESSAGE, $lang['File_not_exist']);
        }
        define('IN_PA_POSTING', true);
        define('IN_ICYPHOENIX', true);
        // BBCBMG - BEGIN
        include IP_ROOT_PATH . 'includes/bbcb_mg.' . PHP_EXT;
        // BBCBMG - END
        // BBCBMG SMILEYS - BEGIN
        generate_smilies('inline');
        include IP_ROOT_PATH . 'includes/bbcb_smileys_mg.' . PHP_EXT;
        // BBCBMG SMILEYS - END
        // MX Addon
        $cid = request_var('cid', 0);
        $delete = request_var('delete', '');
        $submit = isset($_POST['submit']) ? true : false;
        $preview = isset($_POST['preview']) ? true : false;
        $subject = request_post_var('subject', '', true);
        $message = request_post_var('message', '', true);
        $sql = "SELECT file_name, file_catid\n\t\t\tFROM " . 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_post_comment']) {
            if (!$user->data['session_logged_in']) {
                redirect(append_sid(CMS_PAGE_LOGIN . '?redirect=dload.' . PHP_EXT . '&action=post_comment&file_id=' . $file_id, true));
            }
            $message = sprintf($lang['Sorry_auth_download'], $this->auth[$file_data['file_catid']]['auth_post_comment_type']);
            message_die(GENERAL_MESSAGE, $message);
        }
        $html_on = $user->data['user_allowhtml'] && $pafiledb_config['allow_html'] ? 1 : 0;
        $bbcode_on = $user->data['user_allowbbcode'] && $pafiledb_config['allow_bbcode'] ? 1 : 0;
        $smilies_on = $user->data['user_allowsmile'] && $pafiledb_config['allow_smilies'] ? 1 : 0;
        // =======================================================
        // MX Addon
        // =======================================================
        if ($delete == 'do') {
            $sql = 'SELECT *
				FROM ' . PA_FILES_TABLE . "\n\t\t\t\tWHERE file_id = {$file_id}";
            $result = $db->sql_query($sql);
            $file_info = $db->sql_fetchrow($result);
            if ($this->auth[$file_info['file_catid']]['auth_delete_comment'] && $file_info['user_id'] == $user->data['user_id'] || $this->auth[$file_info['file_catid']]['auth_mod']) {
                $sql = 'DELETE FROM ' . PA_COMMENTS_TABLE . "\n\t\t\t\t\tWHERE comments_id = {$cid}";
                $db->sql_query($sql);
                $this->_pafiledb();
                $message = $lang['Comment_deleted'] . '<br /><br />' . sprintf($lang['Click_return'], '<a href="' . append_sid('dload.' . PHP_EXT . '?action=file&amp;file_id=' . $file_id) . '">', '</a>');
                message_die(GENERAL_MESSAGE, $message);
            } else {
                $message = sprintf($lang['Sorry_auth_delete'], $this->auth[$cat_id]['auth_upload_type']);
                message_die(GENERAL_MESSAGE, $message);
            }
        }
        if (!$submit) {
            // Generate smilies listing for page output
            //$pafiledb_functions->pa_generate_smilies('inline');
            $html_status = $user->data['user_allowhtml'] && $pafiledb_config['allow_html'] ? $lang['HTML_is_ON'] : $lang['HTML_is_OFF'];
            $bbcode_status = $user->data['user_allowbbcode'] && $pafiledb_config['allow_bbcode'] ? $lang['BBCode_is_ON'] : $lang['BBCode_is_OFF'];
            $smilies_status = $user->data['user_allowsmile'] && $pafiledb_config['allow_smilies'] ? $lang['Smilies_are_ON'] : $lang['Smilies_are_OFF'];
            $links_status = $pafiledb_config['allow_comment_links'] ? $lang['Links_are_ON'] : $lang['Links_are_OFF'];
            $images_status = $pafiledb_config['allow_comment_images'] ? $lang['Images_are_ON'] : $lang['Images_are_OFF'];
            $hidden_form_fields = '<input type="hidden" name="action" value="post_comment" /><input type="hidden" name="file_id" value="' . $file_id . '" /><input type="hidden" name="comment" value="post" />';
            // Output the data to the template
            $this->generate_category_nav($file_data['file_catid']);
            $template->assign_vars(array('HTML_STATUS' => $html_status, 'BBCODE_STATUS' => sprintf($bbcode_status, '<a href="' . append_sid('faq.' . PHP_EXT . '?mode=bbcode') . '" target="_blank">', '</a>'), 'SMILIES_STATUS' => $smilies_status, 'LINKS_STATUS' => $links_status, 'IMAGES_STATUS' => $images_status, 'FILE_NAME' => $file_data['file_name'], 'DOWNLOAD' => $pafiledb_config['settings_dbname'], 'MESSAGE_LENGTH' => $pafiledb_config['max_comment_chars'], 'L_HOME' => $lang['Home'], 'CURRENT_TIME' => sprintf($lang['Current_time'], create_date($config['default_dateformat'], time(), $config['board_timezone'])), 'L_COMMENT_ADD' => $lang['Comment_add'], 'L_COMMENT' => $lang['Message_body'], 'L_COMMENT_TITLE' => $lang['Subject'], 'L_OPTIONS' => $lang['Options'], 'L_COMMENT_EXPLAIN' => sprintf($lang['Comment_explain'], $pafiledb_config['max_comment_chars']), 'L_PREVIEW' => $lang['Preview'], 'L_SUBMIT' => $lang['Submit'], 'L_DOWNLOAD' => $lang['Download'], 'L_INDEX' => sprintf($lang['Forum_Index'], $config['sitename']), 'L_CHECK_MSG_LENGTH' => $lang['Check_message_length'], 'L_MSG_LENGTH_1' => $lang['Msg_length_1'], 'L_MSG_LENGTH_2' => $lang['Msg_length_2'], 'L_MSG_LENGTH_3' => $lang['Msg_length_3'], 'L_MSG_LENGTH_4' => $lang['Msg_length_4'], 'L_MSG_LENGTH_5' => $lang['Msg_length_5'], 'L_MSG_LENGTH_6' => $lang['Msg_length_6'], '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&amp;file_id=' . $file_id), 'S_POST_ACTION' => append_sid('dload.' . PHP_EXT), 'S_HIDDEN_FORM_FIELDS' => $hidden_form_fields));
            // Show preview stuff if user clicked preview
            if ($preview) {
                $comments_text = stripslashes(prepare_message(addslashes(unprepare_message($message)), $html_on, $bbcode_on, $smilies_on));
                $title = $subject;
                $title = censor_text($title);
                $comments_text = censor_text($comments_text);
                $bbcode->allow_html = $html_on ? true : false;
                $bbcode->allow_bbcode = $bbcode_on ? true : false;
                $bbcode->allow_smilies = $smilies_on ? true : false;
                $comments_text = $bbcode->parse($comments_text);
                //bbcode parser End
                $comments_text = str_replace("\n", '<br />', $comments_text);
                $template->assign_vars(array('PREVIEW' => true, 'COMMENT' => stripslashes($_POST['message']), 'SUBJECT' => stripslashes($_POST['subject']), 'PRE_COMMENT' => $comments_text));
            }
        }
        if ($submit) {
            $subject = request_post_var('subject', '', true);
            $message = request_post_var('message', '', true);
            $message = htmlspecialchars_decode($message, ENT_COMPAT);
            $length = strlen($message);
            //$comments_text = str_replace('<br />', "\n", $message);
            $comments_text = $message;
            $poster_id = intval($user->data['user_id']);
            $title = $subject;
            $time = time();
//.........这里部分代码省略.........
开发者ID:ALTUN69,项目名称:icy_phoenix,代码行数:101,代码来源:pa_post_comment.php

示例3: preg_replace

         if (!$password && $password_confirm) {
             $error = TRUE;
             $error_msg .= (isset($error_msg) ? '<br />' : '') . $lang['Password_mismatch'];
         }
     }
 }
 if ($signature != '') {
     $sig_length_check = preg_replace('/(\\[.*?)(=.*?)\\]/is', '\\1]', stripslashes($signature));
     if ($allowhtml) {
         $sig_length_check = preg_replace('/(\\<.*?)(=.*?)( .*?=.*?)?([ \\/]?\\>)/is', '\\1\\3\\4', $sig_length_check);
     }
     // Only create a new bbcode_uid when there was no uid yet.
     if ($signature_bbcode_uid == '') {
         $signature_bbcode_uid = $allowbbcode ? make_bbcode_uid() : '';
     }
     $signature = prepare_message($signature, $allowhtml, $allowbbcode, $allowsmilies, $signature_bbcode_uid);
     if (strlen($sig_length_check) > $board_config['max_sig_chars']) {
         $error = TRUE;
         $error_msg .= (isset($error_msg) ? '<br />' : '') . $lang['Signature_too_long'];
     }
 }
 //
 // Avatar stuff
 //
 $avatar_sql = "";
 if (isset($HTTP_POST_VARS['avatardel'])) {
     if ($this_userdata['user_avatar_type'] == USER_AVATAR_UPLOAD && $this_userdata['user_avatar'] != "") {
         if (@file_exists(@phpbb_realpath("./" . $board_config['avatar_path'] . "/" . $this_userdata['user_avatar']))) {
             @unlink("./" . $board_config['avatar_path'] . "/" . $this_userdata['user_avatar']);
         }
     }
开发者ID:BackupTheBerlios,项目名称:phpbbsfp,代码行数:31,代码来源:admin_users.php

示例4: prepare_post

function prepare_post(&$mode, &$post_data, &$bbcode_on, &$html_on, &$smilies_on, &$error_msg, &$username, &$bbcode_uid, &$subject, &$message, &$poll_title, &$poll_options, &$poll_length)
{
    global $board_config, $userdata, $lang, $phpEx, $phpbb_root_path;
    // Check username
    if (!empty($username)) {
        $username = trim(strip_tags($username));
        if (!$userdata['session_logged_in'] || $userdata['session_logged_in'] && $username != $userdata['username']) {
            include "includes/functions_validate.php";
            $result = validate_username($username);
            if ($result['error']) {
                $error_msg .= !empty($error_msg) ? '<br />' . $result['error_msg'] : $result['error_msg'];
            }
        } else {
            $username = '';
        }
    }
    // Check subject
    if (!empty($subject)) {
        $subject = htmlspecialchars(trim($subject));
    } else {
        if ($mode == 'newtopic' || $mode == 'editpost' && $post_data['first_post']) {
            $error_msg .= !empty($error_msg) ? '<br />' . $lang['Empty_subject'] : $lang['Empty_subject'];
        }
    }
    // Check message
    if (!empty($message)) {
        $bbcode_uid = $bbcode_on ? make_bbcode_uid() : '';
        $message = prepare_message(trim($message), $html_on, $bbcode_on, $smilies_on, $bbcode_uid);
    } else {
        if ($mode != 'delete' && $mode != 'poll_delete') {
            $error_msg .= !empty($error_msg) ? '<br />' . $lang['Empty_message'] : $lang['Empty_message'];
        }
    }
    //
    // Handle poll stuff
    //
    if ($mode == 'newtopic' || $mode == 'editpost' && $post_data['first_post']) {
        $poll_length = isset($poll_length) ? max(0, intval($poll_length)) : 0;
        if (!empty($poll_title)) {
            $poll_title = htmlspecialchars(trim($poll_title));
        }
        if (!empty($poll_options)) {
            $temp_option_text = array();
            while (list($option_id, $option_text) = @each($poll_options)) {
                $option_text = trim($option_text);
                if (!empty($option_text)) {
                    $temp_option_text[$option_id] = htmlspecialchars($option_text);
                }
            }
            $option_text = $temp_option_text;
            if (count($poll_options) < 2) {
                $error_msg .= !empty($error_msg) ? '<br />' . $lang['To_few_poll_options'] : $lang['To_few_poll_options'];
            } else {
                if (count($poll_options) > $board_config['max_poll_options']) {
                    $error_msg .= !empty($error_msg) ? '<br />' . $lang['To_many_poll_options'] : $lang['To_many_poll_options'];
                } else {
                    if ($poll_title == '') {
                        $error_msg .= !empty($error_msg) ? '<br />' . $lang['Empty_poll_title'] : $lang['Empty_poll_title'];
                    }
                }
            }
        }
    }
    return;
}
开发者ID:BackupTheBerlios,项目名称:domsmod-svn,代码行数:65,代码来源:functions_post.php

示例5: validate_username

	{
		include(IP_ROOT_PATH . 'includes/functions_validate.' . PHP_EXT);
		$result = validate_username($username);
		if ($result['error'])
		{
			$error_msg .= (!empty($error_msg)) ? '<br />' . $result['error_msg'] : $result['error_msg'];
		}
	}

	$message = request_post_var('message', '', true);
	$message = htmlspecialchars_decode($message, ENT_COMPAT);
	// insert shout !
	if (!empty($message) && $is_auth['auth_post'] && !$error)
	{
		include_once(IP_ROOT_PATH . 'includes/functions_post.' . PHP_EXT);
		$message = prepare_message(trim($message), $html_on, $bbcode_on, $smilies_on);
		if ($config['img_shoutbox'] == true)
		{
			$message = preg_replace ("#\[url=(http://)([^ \"\n\r\t<]*)\]\[img\](http://)([^ \"\n\r\t<]*)\[/img\]\[/url\]#i", '[url=\\1\\2]\\4[/url]', $message);
			$message = preg_replace ("#\[img\](http://)([^ \"\n\r\t<]*)\[/img\]#i", '[url=\\1\\2]\\2[/url]', $message);
			$message = preg_replace ("#\[img align=left\](http://)([^ \"\n\r\t<]*)\[/img\]#i", '[url=\\1\\2]\\2[/url]', $message);
			$message = preg_replace ("#\[img align=right\](http://)([^ \"\n\r\t<]*)\[/img\]#i", '[url=\\1\\2]\\2[/url]', $message);
		}
		$sql = "INSERT INTO " . SHOUTBOX_TABLE . " (shout_text, shout_session_time, shout_user_id, shout_ip, shout_username, enable_bbcode, enable_html, enable_smilies)
				VALUES ('" . $db->sql_escape($message) . "', '" . time() . "', '" . $user->data['user_id'] . "', '$user_ip', '" . $db->sql_escape($username) . "', $bbcode_on, $html_on, $smilies_on)";
		$result = $db->sql_query($sql);

		// auto prune
		if ($config['prune_shouts'])
		{
			$sql = "DELETE FROM " . SHOUTBOX_TABLE . " WHERE shout_session_time<=" . (time() - (86400 * $config['prune_shouts']));
开发者ID:ALTUN69,项目名称:icy_phoenix,代码行数:31,代码来源:shoutbox.php

示例6: htmlspecialchars

     $poll_options[] = htmlspecialchars(trim(stripslashes($HTTP_POST_VARS['add_poll_option_text'])));
 }
 if ($mode == 'newtopic' || $mode == 'reply') {
     $user_sig = $userdata['user_sig'] != '' && $board_config['allow_sig'] ? $userdata['user_sig'] : '';
 } else {
     if ($mode == 'editpost') {
         $user_sig = $post_info['user_sig'] != '' && $board_config['allow_sig'] ? $post_info['user_sig'] : '';
         $userdata['user_sig_bbcode_uid'] = $post_info['user_sig_bbcode_uid'];
     }
 }
 if ($preview) {
     $orig_word = array();
     $replacement_word = array();
     obtain_word_list($orig_word, $replacement_word);
     $bbcode_uid = $bbcode_on ? make_bbcode_uid() : '';
     $preview_message = stripslashes(prepare_message(addslashes(unprepare_message($message)), $html_on, $bbcode_on, $smilies_on, $bbcode_uid));
     $preview_subject = $subject;
     $preview_username = $username;
     //
     // Finalise processing as per viewtopic
     //
     if (!$html_on) {
         if ($user_sig != '' || !$userdata['user_allowhtml']) {
             $user_sig = preg_replace('#(<)([\\/]?.*?)(>)#is', '&lt;\\2&gt;', $user_sig);
         }
     }
     if ($attach_sig && $user_sig != '' && $userdata['user_sig_bbcode_uid']) {
         $user_sig = bbencode_second_pass($user_sig, $userdata['user_sig_bbcode_uid']);
     }
     if ($bbcode_on) {
         $preview_message = bbencode_second_pass($preview_message, $bbcode_uid);
开发者ID:damncabbage,项目名称:publicwhip,代码行数:31,代码来源:posting.php

示例7: generate_feed_details

            $number_items_current = $number_items;
        }
    }
}
// user has set a different language as used in cached feed description? Regenerate.
if ($user->data['user_lang'] != $feed_data['lang']) {
    generate_feed_details($content, $global, $feed_data);
}
foreach ($feed_data['items'] as $item) {
    // apply session id to links if user is logged in
    if ($user->data['user_id'] != ANONYMOUS) {
        $item_link = append_sid($item['link']);
    } else {
        $item_link = $item['link'];
    }
    $template->assign_block_vars('item', array('AUTHOR' => $item['author'], 'TIME' => format_date($item['time'], $syndication_method), 'LINK' => $item_link, 'IDENTIFIER' => $item['identifier'], 'TITLE' => $item['title'], 'TEXT' => prepare_message($item['text'], $syndication_method)));
}
$template->set_filenames(array('body' => 'syndication_' . ($syndication_method == SYNDICATION_ATOM ? 'atom' : 'rss2') . '.html'));
// get time from last item or use current time in case of an empty feed
$last_build_date = $number_items_current ? $feed_data['items'][$number_items_current - 1]['time'] : time();
$template->assign_vars(array('HEADER' => '<?xml version="1.0" encoding="UTF-8"?>' . "\n", 'TITLE' => $feed_data['title'], 'DESCRIPTION' => $feed_data['description'], 'LINK' => $feed_data['source_link'], 'FEED_LINK' => build_feed_url(true), 'LAST_BUILD' => format_date($last_build_date, $syndication_method)));
// gzip compression
if ($config['gzip_compress']) {
    if (@extension_loaded('zlib') && !headers_sent()) {
        ob_start('ob_gzhandler');
    }
}
// text/xml for Internet Explorer
header('Content-Type: text/xml; charset=UTF-8');
header('Last-Modified: ' . date('D, d M Y H:i:s O', $last_build_date));
$template->display('body');
开发者ID:sietf,项目名称:sietf.org,代码行数:31,代码来源:generate_feed.php

示例8: notifyUser

function notifyUser($user_id, $notify_type, $offer_id, $offer_title)
{
    global $db, $lang, $auction_config_data, $board_config;
    if ($auction_config_data['auction_end_notify_email']) {
        // BEGIN EMAIL-NOTIFY
        $sql = "SELECT user_email,\r\n                         username\r\n                  FROM " . USERS_TABLE . "\r\n                  WHERE user_id=" . $user_id . "";
        if (!($result = $db->sql_query($sql))) {
        }
        // if
        $user = $db->sql_fetchrow($result);
        $server_name = trim($board_config['server_name']);
        $server_protocol = $board_config['cookie_secure'] ? 'https://' : 'http://';
        $server_port = $board_config['server_port'] != 80 ? ':' . trim($board_config['server_port']) . '/' : '/';
        $username = $user['username'];
        $email = $user['user_email'];
        $emailer = new emailer($board_config['smtp_delivery']);
        $emailer->from($board_config['board_email']);
        $emailer->replyto($board_config['board_email']);
        if ($notify_type == 'WON') {
            $emailer->use_template('auction_won', stripslashes($user_lang));
            $emailer->set_subject($lang['auction_won']);
            $emailer->assign_vars(array('AUCTION_WON' => $lang['auction_offer_won'], 'AUCTION_SITENAME' => $board_config['sitename'], 'AUCTION_OFFER' => prepare_message(addslashes(unprepare_message(htmlspecialchars(trim(stripslashes($offer_title))))), $board_config['allow_html'], $board_config['allow_bbcode'], $board_config['allow_smilies'], 0), 'U_AUCTION_OFFER' => $server_protocol . $server_name . $board_config['script_path'] . 'auction_offer_view.php?ao=' . $offer_id, 'AUCTION_EMAIL_SIG' => !empty($board_config['board_email_sig']) ? str_replace('<br />', "\n", "-- \n" . $board_config['board_email_sig']) : ''));
        }
        if ($notify_type == 'SOLD') {
            $emailer->use_template('auction_sold', stripslashes($user_lang));
            $emailer->set_subject($lang['auction_sold']);
            $emailer->assign_vars(array('AUCTION_SOLD' => $lang['auction_offer_sold'], 'AUCTION_SITENAME' => $board_config['sitename'], 'AUCTION_OFFER' => prepare_message(addslashes(unprepare_message(htmlspecialchars(trim(stripslashes($offer_title))))), $board_config['allow_html'], $board_config['allow_bbcode'], $board_config['allow_smilies'], 0), 'U_AUCTION_OFFER' => $server_protocol . $server_name . $board_config['script_path'] . 'auction_offer_view.php?ao=' . $offer_id, 'AUCTION_EMAIL_SIG' => !empty($board_config['board_email_sig']) ? str_replace('<br />', "\n", "-- \n" . $board_config['board_email_sig']) : ''));
        }
        if ($notify_type == 'NOT_SOLD') {
            $emailer->use_template('auction_not_sold', stripslashes($user_lang));
            $emailer->set_subject($lang['auction_not_sold']);
            $emailer->assign_vars(array('AUCTION_NOT_SOLD' => $lang['auction_offer_not_sold'], 'AUCTION_SITENAME' => $board_config['sitename'], 'AUCTION_OFFER' => prepare_message(addslashes(unprepare_message(htmlspecialchars(trim(stripslashes($offer_title))))), $board_config['allow_html'], $board_config['allow_bbcode'], $board_config['allow_smilies'], 0), 'U_AUCTION_OFFER' => $server_protocol . $server_name . $board_config['script_path'] . 'auction_offer_view.php?ao=' . $offer_id, 'AUCTION_EMAIL_SIG' => !empty($board_config['board_email_sig']) ? str_replace('<br />', "\n", "-- \n" . $board_config['board_email_sig']) : ''));
        }
        $emailer->email_address($email);
        // Try to send email...
        $emailer->send();
        //          $emailer->reset();
    }
    // END EMAIL-NOTIFY
    if ($auction_config_data['auction_end_notify_pm']) {
        // BEGIN PM-NOTIFY ON OUTBID
        if ($notify_type == 'WON') {
            $pm_subject = $lang['auction_won'];
            $pm_text = $lang['auction_won_text'];
        }
        if ($notify_type == 'SOLD') {
            $pm_subject = $lang['auction_sold'];
            $pm_text = $lang['auction_sold_text'];
        }
        if ($notify_type == 'NOT_SOLD') {
            $pm_subject = $lang['auction_not_sold'];
            $pm_text = $lang['auction_not_sold_text'];
        }
        $privmsgs_date = date("U");
        $sql = "INSERT INTO " . PRIVMSGS_TABLE . "\r\n                     (privmsgs_type,\r\n                      privmsgs_subject,\r\n                      privmsgs_from_userid,\r\n                      privmsgs_to_userid,\r\n                      privmsgs_date,\r\n                      privmsgs_enable_html,\r\n                      privmsgs_enable_bbcode,\r\n                      privmsgs_enable_smilies,\r\n                      privmsgs_attach_sig)\r\n                  VALUES ('0',\r\n                          '" . str_replace("\\'", "''", addslashes(sprintf($pm_subject, $board_config['sitename']))) . "',\r\n                          '2',\r\n                          " . $user_id . ",\r\n                          " . $privmsgs_date . ",\r\n                          '0',\r\n                          '1',\r\n                          '1',\r\n                          '0')";
        if (!$db->sql_query($sql)) {
        }
        // if
        $outbid_sent_id = $db->sql_nextid();
        $sql = "INSERT INTO " . PRIVMSGS_TEXT_TABLE . "\r\n                      (privmsgs_text_id,\r\n                       privmsgs_text)\r\n                   VALUES (" . $outbid_sent_id . ",\r\n                           '" . str_replace("\\'", "''", $pm_text . "</br></br><a href=\"auction_offer_view.php?ao=" . $offer_id . "\">" . prepare_message(addslashes(unprepare_message(htmlspecialchars(trim(stripslashes($offer_title))))), $board_config['allow_html'], $board_config['allow_bbcode'], $board_config['allow_smilies'], 0) . "</a></br>" . $board_config['board_email_sig']) . "')";
        if (!$db->sql_query($sql)) {
        }
        // if
        $sql = "UPDATE " . USERS_TABLE . "\r\n                   SET user_new_privmsg=user_new_privmsg+1\r\n                   WHERE user_id=" . $user_id;
        if (!$db->sql_query($sql)) {
        }
        // if
    }
    // End pm-notification
}
开发者ID:wrtcoder,项目名称:mini_isp,代码行数:70,代码来源:auction_cron.php

示例9: die

<?php

if (!defined('IN_AJAX')) {
    die(basename(__FILE__));
}
global $lang, $userdata;
$post_id = (int) $this->request['post_id'];
$mc_type = (int) $this->request['mc_type'];
$mc_text = (string) $this->request['mc_text'];
if (!($mc_text = prepare_message($mc_text))) {
    $this->ajax_die($lang['EMPTY_MESSAGE']);
}
$post = DB()->fetch_row("\n\tSELECT\n\t\tp.post_id, p.poster_id\n\tFROM      " . BB_POSTS . " p\n\tWHERE p.post_id = {$post_id}\n");
if (!$post) {
    $this->ajax_die('not post');
}
$data = array('mc_comment' => $mc_type ? $mc_text : '', 'mc_type' => $mc_type, 'mc_user_id' => $mc_type ? $userdata['user_id'] : 0);
$sql_args = DB()->build_array('UPDATE', $data);
DB()->query("UPDATE " . BB_POSTS . " SET {$sql_args} WHERE post_id = {$post_id}");
if ($mc_type && $post['poster_id'] != $userdata['user_id']) {
    $subject = sprintf($lang['MC_COMMENT_PM_SUBJECT'], $lang['MC_COMMENT'][$mc_type]['type']);
    $message = sprintf($lang['MC_COMMENT_PM_MSG'], get_username($post['poster_id']), make_url(POST_URL . "{$post_id}#{$post_id}"), $lang['MC_COMMENT'][$mc_type]['type'], $mc_text);
    send_pm($post['poster_id'], $subject, $message);
    cache_rm_user_sessions($post['poster_id']);
}
switch ($mc_type) {
    case 1:
        // Комментарий
        $mc_class = 'success';
        break;
    case 2:
开发者ID:ErR163,项目名称:torrentpier,代码行数:31,代码来源:post_mod_comment.php

示例10: prepare_post

function prepare_post(&$mode, &$post_data, &$bbcode_on, &$html_on, &$smilies_on, &$error_msg, &$username, &$subject, &$message, &$poll_title, &$poll_options, &$poll_data, &$reg_active, &$reg_reset, &$reg_max_option1, &$reg_max_option2, &$reg_max_option3, &$reg_length, &$topic_desc, $topic_calendar_time = 0, $topic_calendar_duration = 0)
{
    global $config, $user, $lang;
    global $topic_id;
    global $db;
    // Check username
    if (!empty($username)) {
        $username = phpbb_clean_username($username);
        if (!$user->data['session_logged_in'] || $user->data['session_logged_in'] && $username != $user->data['username']) {
            include IP_ROOT_PATH . 'includes/functions_validate.' . PHP_EXT;
            $result = validate_username($username);
            if ($result['error']) {
                $error_msg .= !empty($error_msg) ? '<br />' . $result['error_msg'] : $result['error_msg'];
            }
        } else {
            $username = '';
        }
    }
    // Check subject
    if (!empty($subject)) {
        $subject = trim($subject);
    } elseif ($mode == 'newtopic' || $mode == 'editpost' && $post_data['first_post']) {
        $error_msg .= !empty($error_msg) ? '<br />' . $lang['Empty_subject'] : $lang['Empty_subject'];
    }
    // Check Topic Desciption
    if (!empty($topic_desc)) {
        $topic_desc = trim($topic_desc);
    }
    // Check message
    if (!empty($message)) {
        $message = prepare_message(trim($message), $html_on, $bbcode_on, $smilies_on);
        // Mighty Gorgon - TO BE VERIFIED
        //$message = addslashes($message);
        // Mighty Gorgon - TO BE VERIFIED
    } elseif ($mode != 'delete' && $mode != 'poll_delete') {
        $error_msg .= !empty($error_msg) ? '<br />' . $lang['Empty_message'] : $lang['Empty_message'];
    }
    // check calendar date
    if (!empty($topic_calendar_time) && ($mode == 'newtopic' || $mode == 'editpost' && $post_data['first_post'])) {
        $year = intval(gmdate('Y', $topic_calendar_time));
        $month = intval(gmdate('m', $topic_calendar_time));
        $day = intval(gmdate('d', $topic_calendar_time));
        if (!checkdate($month, $day, $year)) {
            $error_msg .= (!empty($error_msg) ? '<br />' : '') . sprintf($lang['Date_error'], $day, $month, $year);
        }
    }
    // Check to see if there's a new post while the user is posting
    $new_post_while_posting = false;
    if (!empty($_POST['post_time']) && ($mode == 'reply' || $mode == 'quote') && $config['show_new_reply_posting']) {
        $last_post_time = intval($_POST['post_time']);
        if (!empty($topic_id) && $last_post_time) {
            $sql = "SELECT post_time FROM " . POSTS_TABLE . " WHERE topic_id = '" . $topic_id . "' ORDER BY post_time DESC LIMIT 0, 1";
            $db->sql_return_on_error(true);
            $result = $db->sql_query($sql);
            $db->sql_return_on_error(false);
            if ($result) {
                if ($row = $db->sql_fetchrow($result)) {
                    $last_post_time2 = $row['post_time'];
                    if ($last_post_time2 > $last_post_time) {
                        $new_post_while_posting = true;
                        $error_msg .= (empty($error_msg) ? '' : '<br />') . $lang['Warn_new_post'];
                    }
                }
                $db->sql_freeresult($result);
            }
        }
    }
    // Check to see if the user is last poster and is bumping
    //if(($mode == 'reply' || $mode == 'quote') && ($config['no_bump'] == true) && ($new_post_while_posting == false))
    $no_bump = $config['no_bump'] == 1 && $user->data['user_level'] != ADMIN || $config['no_bump'] == 2 && $user->data['user_level'] != ADMIN && $user->data['user_level'] != MOD ? true : false;
    if (($mode == 'reply' || $mode == 'quote') && $no_bump == true && $new_post_while_posting == false) {
        if (!empty($topic_id)) {
            $sql = "SELECT poster_id FROM " . POSTS_TABLE . "\n\t\t\t\t\t\t\tWHERE topic_id = '" . $topic_id . "'\n\t\t\t\t\t\t\tAND post_time > " . (time() - 86400) . "\n\t\t\t\t\t\t\tORDER BY post_time DESC\n\t\t\t\t\t\t\tLIMIT 0, 1";
            $db->sql_return_on_error(true);
            $result = $db->sql_query($sql);
            $db->sql_return_on_error(false);
            if ($result) {
                if ($row = $db->sql_fetchrow($result)) {
                    if ($row['poster_id'] == $user->data['user_id']) {
                        $error_msg .= (empty($error_msg) ? '' : '<br />') . $lang['WARN_NO_BUMP'];
                    }
                }
                $db->sql_freeresult($result);
            }
        }
    }
    // Handle poll stuff
    if ($mode == 'newtopic' || $mode == 'editpost' && $post_data['first_post']) {
        $poll_title = !empty($poll_title) ? trim($poll_title) : (isset($poll_data['title']) ? trim($poll_data['title']) : '');
        $poll_start = isset($poll_data['start']) ? $poll_data['start'] : time();
        $poll_length = isset($poll_data['length']) ? max(0, intval($poll_data['length'])) : 0;
        $poll_max_options = isset($poll_data['max_options']) ? max(1, intval($poll_data['max_options'])) : 1;
        $poll_change = isset($poll_data['change']) ? $poll_data['change'] : 0;
        $poll_data = array('title' => $poll_title, 'start' => $poll_start, 'length' => $poll_length, 'max_options' => $poll_max_options, 'change' => $poll_change);
        if (!empty($poll_options)) {
            $temp_option_text = array();
            while (list($option_id, $option_text) = @each($poll_options)) {
                $option_text = trim($option_text);
                if (!empty($option_text)) {
                    $temp_option_text[intval($option_id)] = $option_text;
//.........这里部分代码省略.........
开发者ID:ALTUN69,项目名称:icy_phoenix,代码行数:101,代码来源:functions_post.php

示例11: cash_pm

function cash_pm(&$targetdata, $privmsg_subject, &$message)
{
    global $db, $board_config, $lang, $userdata, $phpbb_root_path, $phpEx, $html_entities_match, $html_entities_replace;
    //
    // It looks like we're sending a PM!
    // NOTE: most of the following code is shamelessly "reproduced" from privmsg.php
    //
    include $phpbb_root_path . 'includes/bbcode.' . $phpEx;
    include $phpbb_root_path . 'includes/functions_post.' . $phpEx;
    //
    // Toggles
    //
    if (!$board_config['allow_html']) {
        $html_on = 0;
    } else {
        $html_on = $userdata['user_allowhtml'];
    }
    $bbcode_on = TRUE;
    if (!$board_config['allow_smilies']) {
        $smilies_on = 0;
    } else {
        $smilies_on = $userdata['user_allowsmile'];
    }
    $attach_sig = $userdata['user_attachsig'];
    //
    // Flood control
    //
    $sql = "SELECT MAX(privmsgs_date) AS last_post_time\n\t\tFROM " . PRIVMSGS_TABLE . "\n\t\tWHERE privmsgs_from_userid = " . $userdata['user_id'];
    if ($result = $db->sql_query($sql)) {
        $db_row = $db->sql_fetchrow($result);
        $last_post_time = $db_row['last_post_time'];
        $current_time = time();
        if ($current_time - $last_post_time < $board_config['flood_interval']) {
            message_die(GENERAL_MESSAGE, $lang['Flood_Error']);
        }
    }
    //
    // End Flood control
    //
    $msg_time = time();
    $bbcode_uid = make_bbcode_uid();
    $privmsg_message = prepare_message($message, $html_on, $bbcode_on, $smilies_on, $bbcode_uid);
    //
    // See if recipient is at their inbox limit
    //
    $sql = "SELECT COUNT(privmsgs_id) AS inbox_items, MIN(privmsgs_date) AS oldest_post_time \n\t\tFROM " . PRIVMSGS_TABLE . " \n\t\tWHERE ( privmsgs_type = " . PRIVMSGS_NEW_MAIL . " \n\t\t\t\tOR privmsgs_type = " . PRIVMSGS_READ_MAIL . "  \n\t\t\t\tOR privmsgs_type = " . PRIVMSGS_UNREAD_MAIL . " ) \n\t\t\tAND privmsgs_to_userid = " . $targetdata['user_id'];
    if (!($result = $db->sql_query($sql))) {
        message_die(GENERAL_MESSAGE, $lang['No_such_user']);
    }
    $sql_priority = SQL_LAYER == 'mysql' ? 'LOW_PRIORITY' : '';
    if ($inbox_info = $db->sql_fetchrow($result)) {
        if ($inbox_info['inbox_items'] >= $board_config['max_inbox_privmsgs']) {
            $sql = "SELECT privmsgs_id FROM " . PRIVMSGS_TABLE . " \n\t\t\t\tWHERE ( privmsgs_type = " . PRIVMSGS_NEW_MAIL . " \n\t\t\t\t\t\tOR privmsgs_type = " . PRIVMSGS_READ_MAIL . " \n\t\t\t\t\t\tOR privmsgs_type = " . PRIVMSGS_UNREAD_MAIL . "  ) \n\t\t\t\t\tAND privmsgs_date = " . $inbox_info['oldest_post_time'] . " \n\t\t\t\t\tAND privmsgs_to_userid = " . $targetdata['user_id'];
            if (!($result = $db->sql_query($sql))) {
                message_die(GENERAL_ERROR, 'Could not find oldest privmsgs (inbox)', '', __LINE__, __FILE__, $sql);
            }
            $old_privmsgs_id = $db->sql_fetchrow($result);
            $old_privmsgs_id = $old_privmsgs_id['privmsgs_id'];
            $sql = "DELETE {$sql_priority} FROM " . PRIVMSGS_TABLE . " \n\t\t\t\tWHERE privmsgs_id = {$old_privmsgs_id}";
            if (!$db->sql_query($sql)) {
                message_die(GENERAL_ERROR, 'Could not delete oldest privmsgs (inbox)' . $sql, '', __LINE__, __FILE__, $sql);
            }
            $sql = "DELETE {$sql_priority} FROM " . PRIVMSGS_TEXT_TABLE . " \n\t\t\t\tWHERE privmsgs_text_id = {$old_privmsgs_id}";
            if (!$db->sql_query($sql)) {
                message_die(GENERAL_ERROR, 'Could not delete oldest privmsgs text (inbox)', '', __LINE__, __FILE__, $sql);
            }
        }
    }
    $sql_info = "INSERT INTO " . PRIVMSGS_TABLE . " (privmsgs_type, privmsgs_subject, privmsgs_from_userid, privmsgs_to_userid, privmsgs_date, privmsgs_ip, privmsgs_enable_html, privmsgs_enable_bbcode, privmsgs_enable_smilies, privmsgs_attach_sig)\n\t\tVALUES (" . PRIVMSGS_NEW_MAIL . ", '" . str_replace("\\'", "''", $privmsg_subject) . "', " . $userdata['user_id'] . ", " . $targetdata['user_id'] . ", {$msg_time}, '{$user_ip}', {$html_on}, {$bbcode_on}, {$smilies_on}, {$attach_sig})";
    if (!($result = $db->sql_query($sql_info, BEGIN_TRANSACTION))) {
        message_die(GENERAL_ERROR, "Could not insert/update private message sent info.", "", __LINE__, __FILE__, $sql_info);
    }
    $privmsg_sent_id = $db->sql_nextid();
    $sql = "INSERT INTO " . PRIVMSGS_TEXT_TABLE . " (privmsgs_text_id, privmsgs_bbcode_uid, privmsgs_text)\n\t\tVALUES ({$privmsg_sent_id}, '" . $bbcode_uid . "', '" . str_replace("\\'", "''", $privmsg_message) . "')";
    if (!$db->sql_query($sql, END_TRANSACTION)) {
        message_die(GENERAL_ERROR, "Could not insert/update private message sent text.", "", __LINE__, __FILE__, $sql_info);
    }
    //
    // Add to the users new pm counter
    //
    $sql = "UPDATE " . USERS_TABLE . "\n\t\tSET user_new_privmsg = user_new_privmsg + 1, user_last_privmsg = " . time() . "  \n\t\tWHERE user_id = " . $targetdata['user_id'];
    if (!($status = $db->sql_query($sql))) {
        message_die(GENERAL_ERROR, 'Could not update private message new/read status for user', '', __LINE__, __FILE__, $sql);
    }
    if ($targetdata['user_notify_pm'] && !empty($targetdata['user_email']) && $targetdata['user_active']) {
        $script_name = preg_replace('/^\\/?(.*?)\\/?$/', "\\1", trim($board_config['script_path']));
        $script_name = $script_name != '' ? $script_name . '/privmsg.' . $phpEx : 'privmsg.' . $phpEx;
        $server_name = trim($board_config['server_name']);
        $server_protocol = $board_config['cookie_secure'] ? 'https://' : 'http://';
        $server_port = $board_config['server_port'] != 80 ? ':' . trim($board_config['server_port']) . '/' : '/';
        include $phpbb_root_path . 'includes/emailer.' . $phpEx;
        $emailer = new emailer($board_config['smtp_delivery']);
        $emailer->from($board_config['board_email']);
        $emailer->replyto($board_config['board_email']);
        $emailer->use_template('privmsg_notify', $targetdata['user_lang']);
        $emailer->email_address($targetdata['user_email']);
        $emailer->set_subject($lang['Notification_subject']);
        $emailer->assign_vars(array('USERNAME' => $to_username, 'SITENAME' => $board_config['sitename'], 'EMAIL_SIG' => !empty($board_config['board_email_sig']) ? str_replace('<br />', "\n", "-- \n" . $board_config['board_email_sig']) : '', 'U_INBOX' => $server_protocol . $server_name . $server_port . $script_name . '?folder=inbox'));
        $emailer->send();
        $emailer->reset();
//.........这里部分代码省略.........
开发者ID:BackupTheBerlios,项目名称:flushcms,代码行数:101,代码来源:functions_cash.php

示例12: convert_comment

function convert_comment($comment)
{
    $post_text = prepare_message($comment['text'], true, true);
    $post_data = array("posts" => array("post_id" => $comment['id'], "topic_id" => $comment['torrent'], "forum_id" => $comment['category'], "poster_id" => $comment['user'], "post_time" => $comment['added'], "poster_ip" => encode_ip($comment['ip']), "post_edit_time" => $comment['editedat'], "post_edit_count" => $comment['editedat'] ? 1 : 0), "posts_text" => array("post_id" => $comment['id'], "post_text" => $post_text));
    tp_add_post($post_data);
    return;
}
开发者ID:ErR163,项目名称:torrentpier,代码行数:7,代码来源:functions.php

示例13: strval

             $b_group .= ',' . strval($i);
         } else {
             $b_group .= strval($i);
             $not_first = TRUE;
         }
     }
 }
 $layout = $l_id;
 if ($b_title == "") {
     message_die(GENERAL_MESSAGE, $lang['Must_enter_block']);
 }
 $bbcode_uid = '';
 if ($b_type) {
     if (!empty($b_content)) {
         $bbcode_uid = $bbcode_parse->make_bbcode_uid();
         $b_content = prepare_message(trim($b_content), TRUE, TRUE, TRUE, $bbcode_uid);
         $b_content = str_replace("\\'", "''", $b_content);
     }
 }
 if ($b_id) {
     $sql = "UPDATE " . BLOCKS_TABLE . "\n                SET\n                title = '" . str_replace("\\'", "''", $b_title) . "',\n                bposition = '" . str_replace("\\'", "''", $b_bposition) . "',\n                active = '" . $b_active . "',\n                type = '" . $b_type . "',\n                content = '" . $b_content . "',\n                block_bbcode_uid = '" . $bbcode_uid . "',\n                blockfile = '" . str_replace("\\'", "''", $b_blockfile) . "',\n                layout = '" . $layout . "',\n                view = '" . $b_view . "',\n                border = '" . $b_border . "',\n                titlebar = '" . $b_titlebar . "',\n                local = '" . $b_local . "',\n                background = '" . $b_background . "',\n                groups = '" . $b_group . "'\n                WHERE bid = {$b_id}";
     if (!($result = $db->sql_query($sql))) {
         message_die(GENERAL_ERROR, "Could not insert data into blocks table", $lang['Error'], __LINE__, __FILE__, $sql);
     }
     $message = $lang['Block_updated'];
     if (!empty($b_blockfile)) {
         if (file_exists($phpbb_root_path . '/blocks/' . $b_blockfile . '.cfg')) {
             include $phpbb_root_path . '/blocks/' . $b_blockfile . '.cfg';
             $message .= '<br /><br />' . $lang['B_BV_added'];
             for ($i = 0; $i < $block_count_variables; $i++) {
                 $sql = "SELECT count(1) existing FROM " . BLOCKS_VARIABLE_TABLE . "\n                            WHERE config_name = '" . $block_variables[$i][2] . "'";
开发者ID:BackupTheBerlios,项目名称:phpbbsfp,代码行数:31,代码来源:admin_blocks.php

示例14: bb_die

        if ($mode == 'reply' && $post_info['topic_status'] == TOPIC_LOCKED) {
            $locked_warn = '
				<div class="warnColor1">
					<b>' . $lang['LOCKED_WARN'] . '</b>
				</div>
				<br /><hr /><br />
			';
            $return_message = $locked_warn . $return_message;
        }
        bb_die($return_message);
    }
}
if ($refresh || $error_msg || $submit && $topic_has_new_posts) {
    $username = !empty($_POST['username']) ? clean_username($_POST['username']) : '';
    $subject = !empty($_POST['subject']) ? clean_title($_POST['subject']) : '';
    $message = !empty($_POST['message']) ? prepare_message($_POST['message']) : '';
    if ($preview) {
        $preview_subject = $subject;
        $preview_username = $username;
        $preview_message = htmlCHR($message, false, ENT_NOQUOTES);
        $preview_message = bbcode2html($preview_message);
        $template->assign_vars(array('TPL_PREVIEW_POST' => true, 'TOPIC_TITLE' => wbr($preview_subject), 'POST_SUBJECT' => $preview_subject, 'POSTER_NAME' => $preview_username, 'POST_DATE' => bb_date(TIMENOW), 'PREVIEW_MSG' => $preview_message));
    }
} else {
    // User default entry point
    if ($mode == 'newtopic') {
        $username = $userdata['session_logged_in'] ? $userdata['username'] : '';
        $subject = $message = '';
    } elseif ($mode == 'reply') {
        $username = $userdata['session_logged_in'] ? $userdata['username'] : '';
        $subject = $message = '';
开发者ID:ErR163,项目名称:torrentpier,代码行数:31,代码来源:posting.php

示例15: make_post

function make_post($new_topic_id, $forum_id, $user_id, $post_username, $text, $mode = 'newtopic')
{
    global $db;
    $current_time = time();
    $user_ip = "ac100202";
    $bbcode_on = 1;
    $html_on = 1;
    $smilies_on = 1;
    $attach_sig = 1;
    $bbcode_uid = make_bbcode_uid();
    $post_subject = 'random subject';
    $post_message = prepare_message($text, $html_on, $bbcode_on, $smilies_on, $bbcode_uid);
    $sql = "INSERT INTO " . POSTS_TABLE . " (topic_id, forum_id, poster_id, attach_id, icon_id, post_username, post_time, poster_ip, post_visibility, bbcode_uid, enable_bbcode, enable_html, enable_smilies, enable_sig, post_subject, post_text)\n\t\tVALUES ({$new_topic_id}, {$forum_id}, {$user_id}, 0, 0, '{$post_username}', {$current_time}, '{$user_ip}', 1, '{$bbcode_uid}', {$bbcode_on}, {$html_on}, {$smilies_on}, {$attach_sig}, '{$post_subject}', '{$post_message}')";
    $result = $db->sql_query($sql);
    if ($result) {
        $new_post_id = $db->sql_nextid();
        $sql = "UPDATE " . TOPICS_TABLE . "\n\t\t\tSET topic_last_post_id = {$new_post_id}";
        if ($mode == "reply") {
            $sql .= ", topic_replies = topic_replies + 1 ";
        }
        $sql .= " WHERE topic_id = {$new_topic_id}";
        if ($db->sql_query($sql)) {
            $sql = "UPDATE " . FORUMS_TABLE . "\n\t\t\t\tSET forum_last_post_id = {$new_post_id}, forum_posts_approved = forum_posts_approved + 1";
            if ($mode == "newtopic") {
                $sql .= ", forum_topics_approved = forum_topics_approved + 1";
            }
            $sql .= " WHERE forum_id = {$forum_id}";
            if ($db->sql_query($sql)) {
                $sql = "UPDATE " . USERS_TABLE . "\n\t\t\t\t\tSET user_posts = user_posts + 1\n\t\t\t\t\tWHERE user_id = " . $user_id;
                if ($db->sql_query($sql, END_TRANSACTION)) {
                    // SUCCESS.
                    return true;
                } else {
                    message_die(GENERAL_ERROR, "Error updating users table", "", __LINE__, __FILE__, $sql);
                }
            } else {
                message_die(GENERAL_ERROR, "Error updating forums table", "", __LINE__, __FILE__, $sql);
            }
        } else {
            // Rollback
            if ($db->get_sql_layer() == "mysql") {
                $sql = "DELETE FROM " . POSTS_TABLE . "\n\t\t\t\t\tWHERE post_id = {$new_post_id}";
                $db->sql_query($sql);
            }
            message_die(GENERAL_ERROR, "Error updating topics table", "", __LINE__, __FILE__, $sql);
        }
    } else {
        message_die(GENERAL_ERROR, "Error inserting data into posts table", "", __LINE__, __FILE__, $sql);
    }
}
开发者ID:bruninoit,项目名称:phpbb,代码行数:50,代码来源:benchmark.php


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