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


PHP make_bbcode_uid函数代码示例

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


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

示例1: __construct

 public function __construct()
 {
     global $template, $announcement_centre_config;
     $this->config = $announcement_centre_config;
     $this->config['announcement_text'] = smilies_pass($this->config['announcement_text']);
     $announcement_text_uid = make_bbcode_uid();
     $this->config['announcement_text'] = bbencode_first_pass($this->config['announcement_text'], $announcement_text_uid);
     $this->config['announcement_text'] = bbencode_second_pass($this->config['announcement_text'], $announcement_text_uid);
     $this->config['announcement_text'] = str_replace("\n", "\n<br />\n", $this->config['announcement_text']);
     $this->config['announcement_guest_text'] = smilies_pass($this->config['announcement_guest_text']);
     $announcement_guest_text_uid = make_bbcode_uid();
     $this->config['announcement_guest_text'] = bbencode_first_pass($this->config['announcement_guest_text'], $announcement_guest_text_uid);
     $this->config['announcement_guest_text'] = bbencode_second_pass($this->config['announcement_guest_text'], $announcement_guest_text_uid);
     $this->config['announcement_guest_text'] = str_replace("\n", "\n<br />\n", $this->config['announcement_guest_text']);
     $announcement_guest_text = $this->config['announcement_guest_text'];
     $announcement_title = empty($this->config['announcement_title']) ? $lang['Site_announcement_block_title'] : str_replace("\n", "\n<br />\n", $this->config['announcement_title']);
     $announcement_guest_title = empty($this->config['announcement_guest_title']) ? $lang['Guest_announcement_block_title'] : str_replace("\n", "\n<br />\n", $this->config['announcement_guest_title']);
     // get the post information in case last topic or forum has been entered
     if (!$this->config['announcement_forum_id'] == '' || !$this->config['announcement_topic_id'] == '') {
         if (!($result = $db->sql_query($this->getFetchSql()))) {
             message_die(GENERAL_ERROR, 'Error in getting announcement post', '', __LINE__, __FILE__, $sql);
         }
         if ($row = $db->sql_fetchrow($result)) {
             $row['post_text'] = smilies_pass($row['post_text']);
             $row['post_text'] = bbencode_first_pass($row['post_text'], $row['bbcode_uid']);
             $row['post_text'] = bbencode_second_pass($row['post_text'], $row['bbcode_uid']);
             $row['post_text'] = str_replace("\n", "\n<br />\n", $row['post_text']);
             $announcement_text = $row['post_text'];
         }
     } else {
         $announcement_text = $this->config['announcement_text'];
     }
     // who sees the announcements
     if ($this->config['announcement_status'] == ANNOUNCEMENTS_LEFTY74_SHOW_YES) {
         switch ($this->getDisplay()) {
             case 'normal':
                 $template->assign_block_vars('announcement_displayed', array());
                 break;
             case 'guest':
                 $template->assign_block_vars('guest_announcement_displayed', array());
                 break;
             default:
                 $template->assign_block_vars('announcement_not_displayed', array());
         }
     }
     //BEGIN ACP Site Announcement Centre by lefty74
     $template->assign_vars(array('L_ANNOUNCEMENT_TITLE' => $announcement_title, 'SITE_ANNOUNCEMENTS_LEFTY74' => $announcement_text, 'L_ANNOUNCEMENT_GUEST_TITLE' => $announcement_guest_title, 'GUEST_ANNOUNCEMENTS_LEFTY74' => $announcement_guest_text));
 }
开发者ID:Nekrofage,项目名称:FJR,代码行数:48,代码来源:announcement_center.php

示例2: 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

示例3: array

 }
 //
 // Start output, first preview, then errors then post form
 //
 $page_title = $lang['Send_private_message'];
 include $phpbb_root_path . 'includes/page_header.' . $phpEx;
 //-- mod : bbcode box reloaded -------------------------------------------------
 //-- add
 include $phpbb_root_path . 'includes/bbc_box_tags.' . $phpEx;
 //-- fin mod : bbcode box reloaded ---------------------------------------------
 if ($preview && !$error) {
     $orig_word = array();
     $replacement_word = array();
     obtain_word_list($orig_word, $replacement_word);
     if ($bbcode_on) {
         $bbcode_uid = make_bbcode_uid();
     }
     $preview_message = stripslashes(prepare_message($privmsg_message, $html_on, $bbcode_on, $smilies_on, $bbcode_uid));
     $privmsg_message = stripslashes(preg_replace($html_entities_match, $html_entities_replace, $privmsg_message));
     //
     // Finalise processing as per viewtopic
     //
     if (!$html_on || !$board_config['allow_html'] || !$userdata['user_allowhtml']) {
         if ($user_sig != '') {
             $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) {
开发者ID:Nekrofage,项目名称:FJR,代码行数:31,代码来源:privmsg.php

示例4: preg_replace

         $error_msg .= (isset($error_msg) ? '<br />' : '') . $lang['Password_mismatch'];
     } else {
         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

示例5: 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, &$max_vote, &$hide_vote, &$tothide_vote)
{
    global $board_config, $userdata, $lang, $phpEx, $phpbb_root_path;
    // Check username
    if (!empty($username)) {
        $username = phpbb_clean_username($username);
        if (!$userdata['session_logged_in'] || $userdata['session_logged_in'] && $username != $userdata['username']) {
            include $phpbb_root_path . 'includes/functions_validate.' . $phpEx;
            $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'];
        }
    }
    // Start Smilies Invasion Mod
    // Check Smiley Count
    if ($userdata['user_level'] != ADMIN) {
        // -~= { Start User Configuration } =~- \\
        $smilies_limit = 3;
        // -~= { End User Configuration { =~- \\
        $smilies_count = smilies_count($subject);
        if ($smilies_count > $smilies_limit) {
            $error_msg .= !empty($error_msg) ? '<br />' . sprintf($lang['Smilies_invasion_error_count'], $smilies_count, $smilies_limit) : sprintf($lang['Smilies_invasion_error_count'], $smilies_count, $smilies_limit);
        }
    }
    // End Smilies Invasion Mod
    // 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, $poll_length + $poll_length_h / 24) : 0;
        ${$max_vote} = isset($max_vote) ? max(0, intval($max_vote)) : 0;
        ${$hide_vote} = isset($hide_vote) ? max(0, intval($hide_vote)) : 0;
        ${$tothide_vote} = isset($tothide_vote) ? max(0, intval($tothide_vote)) : 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[intval($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:Nekrofage,项目名称:FJR,代码行数:80,代码来源:functions_post.php

示例6: 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

示例7: MAX

     //
     $where_sql = $userdata['user_id'] == ANONYMOUS ? "shout_ip = '{$user_ip}'" : 'shout_user_id = ' . $userdata['user_id'];
     $sql = "SELECT MAX(shout_session_time) AS last_post_time\r\n\t\tFROM " . SHOUTBOX_TABLE . "\r\n\t\tWHERE {$where_sql}";
     if ($result = $db->sql_query($sql)) {
         if ($row = $db->sql_fetchrow($result)) {
             if ($row['last_post_time'] > 0 && $current_time - $row['last_post_time'] < $board_config['flood_interval']) {
                 $error = true;
                 $error_msg .= !empty($error_msg) ? '<br />' . $lang['Flood_Error'] : $lang['Flood_Error'];
             }
         }
     }
     $message = isset($HTTP_POST_VARS['message']) ? trim($HTTP_POST_VARS['message']) : '';
     // insert shout !
     if (!empty($message) && $is_auth['auth_post'] && !$error) {
         require_once $phpbb_root_path . 'includes/functions_post.' . $phpEx;
         $bbcode_uid = $bbcode_on ? make_bbcode_uid() : '';
         $message = prepare_message(trim($message), $html_on, $bbcode_on, $smilies_on, $bbcode_uid);
         $sql = "INSERT INTO " . SHOUTBOX_TABLE . " (shout_text, shout_session_time, shout_user_id, shout_ip, shout_username, shout_bbcode_uid,enable_bbcode,enable_html,enable_smilies) \r\n\t\t\t\tVALUES ('{$message}', '" . time() . "', '" . $userdata['user_id'] . "', '{$user_ip}', '" . $username . "', '" . $bbcode_uid . "',{$bbcode_on},{$html_on},{$smilies_on})";
         if (!($result = $db->sql_query($sql))) {
             message_die(GENERAL_ERROR, 'Error inserting shout.', '', __LINE__, __FILE__, $sql);
         }
         // auto prune
         if ($board_config['prune_shouts']) {
             $sql = "DELETE FROM " . SHOUTBOX_TABLE . " WHERE shout_session_time<=" . (time() - 86400 * $board_config['prune_shouts']);
             if (!($result = $db->sql_query($sql))) {
                 message_die(GENERAL_ERROR, 'Error autoprune shouts.', '', __LINE__, __FILE__, $sql);
             }
         }
     }
 } else {
     if ($mode == 'delete' || $mode == 'censor') {
开发者ID:Nekrofage,项目名称:FJR,代码行数:31,代码来源:shoutbox_max.php

示例8: isset

		}
	}

	$username_sql = '';

	if ( $signature != '' )
	{
		if ( strlen($signature) > $board_config['max_sig_chars'] )
		{
			$error = TRUE;
			$error_msg .= ( ( isset($error_msg) ) ? '<br />' : '' ) . $lang['Signature_too_long'];
		}

		if ( $signature_bbcode_uid == '' )
		{
			$signature_bbcode_uid = ( $allowbbcode ) ? make_bbcode_uid() : '';
		}
		$signature = prepare_message($signature, $allowhtml, $allowbbcode, $allowsmilies, $signature_bbcode_uid);
	}

	if ( $website != '' )
	{
		rawurlencode($website);
	}

	if ( isset($HTTP_POST_VARS['avatardel']) && $mode == 'editprofile' )
	{
		$avatar_sql = user_avatar_delete($userdata['user_avatar_type'], $userdata['user_avatar']);
	}
	else if ( ( !empty($user_avatar_upload) || !empty($user_avatar_name) ) && $board_config['allow_avatar_upload'] )
	{
开发者ID:BackupTheBerlios,项目名称:limb-svn,代码行数:31,代码来源:usercp_register.php

示例9: insert_post

function insert_post($message, $subject, $forum_id, $user_id, $user_name, $user_attach_sig, $topic_id = NULL, $topic_type = POST_NORMAL, $do_notification = false, $notify_user = false, $current_time = 0, $error_die_function = '', $html_on = 0, $bbcode_on = 1, $smilies_on = 1)
{
    global $db, $board_config, $user_ip;
    // initialise some variables
    $topic_vote = 0;
    $mode = 'reply';
    $bbcode_uid = $bbcode_on ? make_bbcode_uid() : '';
    $error_die_function = $error_die_function == '' ? "message_die" : $error_die_function;
    $current_time = $current_time == 0 ? time() : $current_time;
    // parse the message and the subject (belt & braces :)
    $message = addslashes(unprepare_message($message));
    $message = prepare_message(trim($message), $html_on, $bbcode_on, $smilies_on, $bbcode_uid);
    $subject = addslashes(str_replace('"', '&quot;', trim($subject)));
    $username = addslashes(unprepare_message(trim($user_name)));
    // fix for \" in username - wineknow.com
    $username = str_replace("\\\"", "\"", $username);
    // if this is a new topic then insert the topic details
    if (is_null($topic_id)) {
        $mode = 'newtopic';
        $sql = "INSERT INTO " . TOPICS_TABLE . " (topic_title, topic_poster, topic_time, forum_id, topic_status, topic_type, topic_vote) VALUES ('{$subject}', " . $user_id . ", {$current_time}, {$forum_id}, " . TOPIC_UNLOCKED . ", {$topic_type}, {$topic_vote})";
        if (!$db->sql_query($sql, BEGIN_TRANSACTION)) {
            $error_die_function(GENERAL_ERROR, 'Error in posting', '', __LINE__, __FILE__, $sql);
        }
        $topic_id = $db->sql_nextid();
    }
    // insert the post details using the topic id
    $sql = "INSERT INTO " . POSTS_TABLE . " (topic_id, forum_id, poster_id, post_username, post_time, poster_ip, enable_bbcode, enable_html, enable_smilies, enable_sig) VALUES ({$topic_id}, {$forum_id}, " . $user_id . ", '{$username}', {$current_time}, '{$user_ip}', {$bbcode_on}, {$html_on}, {$smilies_on}, {$user_attach_sig})";
    if (!$db->sql_query($sql, BEGIN_TRANSACTION)) {
        $error_die_function(GENERAL_ERROR, 'Error in posting', '', __LINE__, __FILE__, $sql);
    }
    $post_id = $db->sql_nextid();
    // insert the actual post text for our new post
    $sql = "INSERT INTO " . POSTS_TEXT_TABLE . " (post_id, post_subject, bbcode_uid, post_text) VALUES ({$post_id}, '{$subject}', '{$bbcode_uid}', '{$message}')";
    if (!$db->sql_query($sql, BEGIN_TRANSACTION)) {
        $error_die_function(GENERAL_ERROR, 'Error in posting', '', __LINE__, __FILE__, $sql);
    }
    // update the post counts etc.
    $newpostsql = $mode == 'newtopic' ? ',forum_topics = forum_topics + 1' : '';
    $sql = "UPDATE " . FORUMS_TABLE . " SET \n                forum_posts = forum_posts + 1,\n                forum_last_post_id = {$post_id}\n                {$newpostsql} \t\n            WHERE forum_id = {$forum_id}";
    if (!$db->sql_query($sql, BEGIN_TRANSACTION)) {
        $error_die_function(GENERAL_ERROR, 'Error in posting', '', __LINE__, __FILE__, $sql);
    }
    // update the first / last post ids for the topic
    $first_post_sql = $mode == 'newtopic' ? ", topic_first_post_id = {$post_id}  " : ' , topic_replies=topic_replies+1';
    $sql = "UPDATE " . TOPICS_TABLE . " SET \n                topic_last_post_id = {$post_id} \n                {$first_post_sql}\n            WHERE topic_id = {$topic_id}";
    if (!$db->sql_query($sql, BEGIN_TRANSACTION)) {
        $error_die_function(GENERAL_ERROR, 'Error in posting', '', __LINE__, __FILE__, $sql);
    }
    // update the user's post count and commit the transaction
    $sql = "UPDATE " . USERS_TABLE . " SET \n                user_posts = user_posts + 1\n            WHERE user_id = {$user_id}";
    if (!$db->sql_query($sql, END_TRANSACTION)) {
        $error_die_function(GENERAL_ERROR, 'Error in posting', '', __LINE__, __FILE__, $sql);
    }
    // add the search words for our new post
    switch ($board_config['version']) {
        case '.0.0':
        case '.0.1':
        case '.0.2':
        case '.0.3':
            add_search_words($post_id, stripslashes($message), stripslashes($subject));
            break;
        default:
            add_search_words('', $post_id, stripslashes($message), stripslashes($subject));
            break;
    }
    // do we need to do user notification
    if ($mode == 'reply' && $do_notification) {
        // DP bugfix (critical): $userdata['user_id'] must be set; otherwise,
        // user_notification() will generate a bad SQL query and die.
        global $userdata;
        $userdata['user_id'] = $user_id;
        // DP bugfix (minor): We should pass the topic title, not the post subject,
        // as the third param to user_notification.
        $sql = "SELECT topic_title FROM " . TOPICS_TABLE . " WHERE topic_id = {$topic_id}";
        if (!($result = $db->sql_query($sql))) {
            $error_die_function(GENERAL_ERROR, 'Error getting topic_title', '', __LINE__, __FILE__, $sql);
        }
        list($topic_title) = $db->sql_fetchrow($result);
        $post_data = array();
        user_notification($mode, $post_data, $topic_title, $forum_id, $topic_id, $post_id, $notify_user);
    }
    // if all is well then return the id of our new post
    return array('post_id' => $post_id, 'topic_id' => $topic_id);
}
开发者ID:cpeel,项目名称:dproofreaders-shadow,代码行数:84,代码来源:functions_insert_post.php

示例10: 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

示例11: adr_send_pm

function adr_send_pm($dest_user, $subject, $message, $check_from_id = '')
{
    global $db, $phpbb_root_path, $phpEx, $lang, $user_ip, $board_config, $userdata;
    $dest_user = intval($dest_user);
    $msg_time = time();
    $from_id = $check_from_id === '' ? intval($userdata['user_id']) : $check_from_id;
    $html_on = 1;
    $bbcode_on = 1;
    $smilies_on = 1;
    include_once $phpbb_root_path . 'includes/functions_post.' . $phpEx;
    include_once $phpbb_root_path . 'includes/bbcode.' . $phpEx;
    $privmsg_subject = trim(strip_tags($subject));
    $bbcode_uid = make_bbcode_uid();
    $privmsg_message = trim(strip_tags($message));
    // APM compliance
    if (defined('PRIVMSGA_TABLE')) {
        include_once $phpbb_root_path . 'includes/functions_messages.' . $phpEx;
        send_pm(0, '', $dest_user, $privmsg_subject, $privmsg_message, '');
    } else {
        $sql = "SELECT user_id, user_notify_pm, user_email, user_lang, user_active\r\n\t\t\t FROM " . USERS_TABLE . "\r\n\t\t\t WHERE user_id = {$dest_user} ";
        if (!($result = $db->sql_query($sql))) {
            $error = TRUE;
            $error_msg = $lang['No_such_user'];
        }
        $to_userdata = $db->sql_fetchrow($result);
        $sql = "SELECT COUNT(privmsgs_id) AS inbox_items, MIN(privmsgs_date) AS oldest_post_time\r\n\t\t\tFROM " . PRIVMSGS_TABLE . "\r\n\t\t\tWHERE ( privmsgs_type = " . PRIVMSGS_NEW_MAIL . "\r\n\t\t\t  OR privmsgs_type = " . PRIVMSGS_READ_MAIL . " \r\n\t\t\t\tOR privmsgs_type = " . PRIVMSGS_UNREAD_MAIL . " )\r\n\t\t\tAND privmsgs_to_userid = {$dest_user} ";
        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 . "\r\n\t\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 = {$dest_user} ";
                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 . "\r\n\t\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 . "\r\n\t\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 . " \r\n\t\t\t(privmsgs_type, privmsgs_subject, privmsgs_from_userid, privmsgs_to_userid, privmsgs_date, privmsgs_ip, privmsgs_enable_html, privmsgs_enable_bbcode, privmsgs_enable_smilies)\r\n\t\t\tVALUES ( 1 , '" . str_replace("\\'", "''", addslashes($privmsg_subject)) . "' , " . $from_id . ", " . $to_userdata['user_id'] . ", {$msg_time}, '{$user_ip}' , {$html_on}, {$bbcode_on}, {$smilies_on})";
        if (!$db->sql_query($sql_info)) {
            message_die(GENERAL_ERROR, 'Could not delete oldest privmsgs text (inbox)', '', __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\t\tVALUES ({$privmsg_sent_id}, '" . $bbcode_uid . "', '" . str_replace("\\'", "''", addslashes($privmsg_message)) . "')";
        if (!$db->sql_query($sql, END_TRANSACTION)) {
            message_die(GENERAL_ERROR, "Could not insert/update private message sent text.", "", __LINE__, __FILE__, $sql);
        }
        $sql = "UPDATE " . USERS_TABLE . "\r\n\t\t\tSET user_new_privmsg = user_new_privmsg + 1, user_last_privmsg = " . time() . " \r\n\t\t\tWHERE user_id = " . $to_userdata['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 ($to_userdata['user_notify_pm'] && !empty($to_userdata['user_email']) && $to_userdata['user_active']) {
            // have the mail sender infos
            $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_once $phpbb_root_path . './includes/emailer.' . $phpEx;
            $emailer = new emailer($board_config['smtp_delivery']);
            if ($board_config['version'] == '.0.5' || $board_config['version'] == '.0.6' || $board_config['version'] == '.0.7' || $board_config['version'] == '.0.8' || $board_config['version'] == '.0.9') {
                $emailer->from($board_config['board_email']);
                $emailer->replyto($board_config['board_email']);
                $emailer->use_template('privmsg_notify', $to_userdata['user_lang']);
            } else {
                $email_headers = 'From: ' . $board_config['board_email'] . "\nReturn-Path: " . $board_config['board_email'] . "\n";
                $emailer->use_template('privmsg_notify', $to_userdata['user_lang']);
                $emailer->extra_headers($email_headers);
            }
            $emailer->email_address($to_userdata['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();
        }
    }
    return;
}
开发者ID:Nekrofage,项目名称:FJR,代码行数:88,代码来源:adr_functions_communicate.php

示例12: array

                $row++;
            } else {
                $col++;
            }
        }
        if ($mode == 'inline' && $num_smilies > $inline_rows * $inline_columns) {
            $template->assign_block_vars('switch_smilies_extra', array());
            $template->assign_vars(array('L_MORE_SMILIES' => $lang['More_emoticons'], 'U_MORE_SMILIES_ANNOUNCEMENT_TEXT' => append_sid("../posting.{$phpEx}?mode=smilies_announcement_text")));
        }
        $template->assign_vars(array('L_EMOTICONS' => $lang['Emoticons'], 'L_CLOSE_WINDOW' => $lang['Close_window'], 'S_SMILIES_COLSPAN' => $s_colspan));
    }
}
$template->set_filenames(array("body" => "admin/announcement_centre_config_body.tpl"));
//
// Escape any quotes in the site description for proper display in the text
// box on the Announcement Box page
//
$new['announcement_text'] = str_replace('"', '&quot;', $new['announcement_text']);
$new['announcement_guest_text'] = str_replace('"', '&quot;', $new['announcement_guest_text']);
$new['announcement_text_draft'] = str_replace('"', '&quot;', $new['announcement_text_draft']);
$new['announcement_title'] = str_replace('"', '&quot;', $new['announcement_title']);
$new['announcement_guest_title'] = str_replace('"', '&quot;', $new['announcement_guest_title']);
$preview_announcement = $new['announcement_text_draft'];
$preview_announcement_uid = make_bbcode_uid();
$preview_announcement = bbencode_first_pass($preview_announcement, $preview_announcement_uid);
$preview_announcement = bbencode_second_pass($preview_announcement, $preview_announcement_uid);
$preview_announcement = smilies_pass($preview_announcement, './../');
$preview_announcement = str_replace("\n", "\n<br />\n", $preview_announcement);
$template->assign_vars(array("S_ANNOUNCEMENT_ACTION" => append_sid("admin_announcement_centre.{$phpEx}"), "L_BBCODE_B_HELP" => $lang['bbcode_b_help'], "L_BBCODE_I_HELP" => $lang['bbcode_i_help'], "L_BBCODE_U_HELP" => $lang['bbcode_u_help'], "L_BBCODE_Q_HELP" => $lang['bbcode_q_help'], "L_BBCODE_C_HELP" => $lang['bbcode_c_help'], "L_BBCODE_L_HELP" => $lang['bbcode_l_help'], "L_BBCODE_O_HELP" => $lang['bbcode_o_help'], "L_BBCODE_P_HELP" => $lang['bbcode_p_help'], "L_BBCODE_W_HELP" => $lang['bbcode_w_help'], "L_BBCODE_A_HELP" => $lang['bbcode_a_help'], "L_BBCODE_S_HELP" => $lang['bbcode_s_help'], "L_BBCODE_F_HELP" => $lang['bbcode_f_help'], "L_EMPTY_MESSAGE" => $lang['Empty_message'], "L_FONT_COLOR" => $lang['Font_color'], "L_COLOR_DEFAULT" => $lang['color_default'], "L_COLOR_DARK_RED" => $lang['color_dark_red'], "L_COLOR_RED" => $lang['color_red'], "L_COLOR_ORANGE" => $lang['color_orange'], "L_COLOR_BROWN" => $lang['color_brown'], "L_COLOR_YELLOW" => $lang['color_yellow'], "L_COLOR_GREEN" => $lang['color_green'], "L_COLOR_OLIVE" => $lang['color_olive'], "L_COLOR_CYAN" => $lang['color_cyan'], "L_COLOR_BLUE" => $lang['color_blue'], "L_COLOR_DARK_BLUE" => $lang['color_dark_blue'], "L_COLOR_INDIGO" => $lang['color_indigo'], "L_COLOR_VIOLET" => $lang['color_violet'], "L_COLOR_WHITE" => $lang['color_white'], "L_COLOR_BLACK" => $lang['color_black'], "L_FONT_SIZE" => $lang['Font_size'], "L_FONT_TINY" => $lang['font_tiny'], "L_FONT_SMALL" => $lang['font_small'], "L_FONT_NORMAL" => $lang['font_normal'], "L_FONT_LARGE" => $lang['font_large'], "L_FONT_HUGE" => $lang['font_huge'], "L_BBCODE_CLOSE_TAGS" => $lang['Close_Tags'], "L_STYLES_TIP" => $lang['Styles_tip'], "L_ANNOUNCEMENT_MAIN_TITLE" => $lang['Announcement_main_title'], "L_ANNOUNCEMENT_MAIN_TITLE_EXPLAIN" => $lang['Announcement_main_title_explain'], "L_ANNOUNCEMENT_BLOCK_TITLE" => $lang['Announcement_block_title'], "L_ANNOUNCEMENT_DRAFT_TEXT" => $lang['Announcement_draft_text'], "L_ANNOUNCEMENT_DRAFT_TEXT_EXPLAIN" => $lang['Announcement_draft_text_explain'], "L_SHOW_ANNOUNCEMENT_TEXT" => $lang['Show_announcement_text'], "L_ANNOUNCEMENT_TITLE" => $lang['Announcement_title'], "L_ANNOUNCEMENT_TITLE_EXPLAIN" => $lang['Announcement_title_explain'], "L_ANNOUNCEMENT_DEFAULT_TITLE_EXPLAIN" => $lang['Announcement_default_title_explain'] . $lang['Site_announcement_block_title'], "L_ANNOUNCEMENT_TEXT" => $lang['Announcement_text'], "L_ANNOUNCEMENT_TEXT_EXPLAIN" => $lang['Announcement_text_explain'], "L_FORUM_ID" => $lang['Forum_ID'], "L_TOPIC_ID" => $lang['Topic_ID'], "L_ANNOUNCEMENT_FORUM_TOPIC_LATEST" => $lang['Announcement_forum_topic_latest'], "L_ANNOUNCEMENT_FORUM_TOPIC_FIRST" => $lang['Announcement_forum_topic_first'], "L_ANNOUNCEMENT_GUEST_TITLE" => $lang['Announcement_guest_title'], "L_ANNOUNCEMENT_DEFAULT_GUEST_TITLE_EXPLAIN" => $lang['Announcement_default_title_explain'] . $lang['Guest_announcement_block_title'], "L_ANNOUNCEMENT_GUEST_TITLE_EXPLAIN" => $lang['Announcement_guest_title_explain'], "L_ANNOUNCEMENT_GUEST_TEXT" => $lang['Announcement_guest_text'], "L_SELECT_ALL" => $lang['Select_all'], "L_COPY_TO_ANNOUNCEMENT" => $lang['Copy_to_Announcement'], "L_COPY_TO_GUEST_ANNOUNCEMENT" => $lang['Copy_to_Guest_Announcement'], "L_SUBMIT" => $lang['Submit'], "L_PREVIEW" => $lang['Preview'], "L_RESET" => $lang['Reset'], "L_YES" => $lang['Yes'], "L_NO" => $lang['No'], "ANNOUNCEMENT_VERSION" => sprintf($announcement_centre_config['announcement_mod_version']), "L_SHOW_ANNOUNCEMENT_ALL" => $lang['Show_announcement_all'], "L_SHOW_ANNOUNCEMENT_REG" => $lang['Show_announcement_reg'], "L_SHOW_ANNOUNCEMENT_MOD" => $lang['Show_announcement_mod'], "L_SHOW_ANNOUNCEMENT_ADM" => $lang['Show_announcement_adm'], "L_SHOW_ANNOUNCEMENT_WHO" => $lang['Show_announcement_who'], "L_ANNOUNCEMENT_GUESTS_ONLY" => $lang['Announcement_guests_only'], "L_ANNOUNCEMENT_GUESTS_ONLY_EXPLAIN" => $lang['Announcement_guests_only_explain'], "ANNOUNCEMENT_FORUM_ID" => $new['announcement_forum_id'], "ANNOUNCEMENT_TOPIC_ID" => $new['announcement_topic_id'], "ANNOUNCEMENT_TITLE" => $new['announcement_title'], "ANNOUNCEMENT_TEXT" => $new['announcement_text'], "ANNOUNCEMENT_GUEST_TITLE" => $new['announcement_guest_title'], "ANNOUNCEMENT_GUEST_TEXT" => $new['announcement_guest_text'], "ANNOUNCEMENT_TEXT_DRAFT" => $new['announcement_text_draft'], "ANNOUNCEMENT_PREVIEW" => $preview_announcement, "S_ANNOUNCEMENT_STATUS_YES" => $announcement_status_yes, "SHOW_ANNOUNCEMENT_YES" => ANNOUNCEMENTS_LEFTY74_SHOW_YES, "S_ANNOUNCEMENT_STATUS_NO" => $announcement_status_no, "SHOW_ANNOUNCEMENT_NO" => ANNOUNCEMENTS_LEFTY74_SHOW_NO, "S_ANNOUNCEMENT_FORUM_TOPIC_LATEST" => $announcement_forum_topic_latest, "ANNOUNCEMENT_FORUM_TOPIC_LATEST" => ANNOUNCEMENTS_LEFTY74_FORUM_TOPIC_LATEST, "S_ANNOUNCEMENT_FORUM_TOPIC_FIRST" => $announcement_forum_topic_first, "ANNOUNCEMENT_FORUM_TOPIC_FIRST" => ANNOUNCEMENTS_LEFTY74_FORUM_TOPIC_FIRST, "ANNOUNCEMENT_GUEST_SEPARATE_STATUS_YES" => ANNOUNCEMENTS_LEFTY74_GUEST_YES, "S_ANNOUNCEMENT_GUEST_SEPARATE_STATUS_YES" => $announcement_guestannouncement_status_yes, "ANNOUNCEMENT_GUEST_SEPARATE_STATUS_NO" => ANNOUNCEMENTS_LEFTY74_GUEST_NO, "S_ANNOUNCEMENT_GUEST_SEPARATE_STATUS_NO" => $announcement_guestannouncement_status_no, "SHOW_ANNOUNCEMENT_ALL" => ANNOUNCEMENTS_LEFTY74_SHOW_ALL, "S_SHOW_ANNOUNCEMENT_ALL_CHECKED" => $show_announcement_all, "SHOW_ANNOUNCEMENT_REG" => ANNOUNCEMENTS_LEFTY74_SHOW_REG, "S_SHOW_ANNOUNCEMENT_REG_CHECKED" => $show_announcement_reg, "SHOW_ANNOUNCEMENT_MOD" => ANNOUNCEMENTS_LEFTY74_SHOW_MOD, "S_SHOW_ANNOUNCEMENT_MOD_CHECKED" => $show_announcement_mod, "SHOW_ANNOUNCEMENT_ADM" => ANNOUNCEMENTS_LEFTY74_SHOW_ADM, "S_SHOW_ANNOUNCEMENT_ADM_CHECKED" => $show_announcement_adm));
$template->pparse("body");
include './page_footer_admin.' . $phpEx;
开发者ID:Nekrofage,项目名称:FJR,代码行数:31,代码来源:admin_announcement_centre.php

示例13: 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

示例14: wpu_user

 function wpu_user($name, $password, $email)
 {
     global $board_config;
     $this->username = $this->sql_escape($name);
     $this->user_password = $this->sql_escape($password);
     $this->user_email = $this->sql_escape($email);
     $this->user_id = '';
     // Now we need to set the remaining fields to some default values
     // If you wish to integrate with another MOD, you should add any initilization
     // it requires after this
     $this->user_fields['user_regdate'] = time();
     $this->user_fields['user_from'] = '';
     $this->user_fields['user_occ'] = '';
     $this->user_fields['user_interests'] = '';
     $this->user_fields['user_website'] = '';
     $this->user_fields['user_icq'] = '';
     $this->user_fields['user_aim'] = '';
     $this->user_fields['user_yim'] = '';
     $this->user_fields['user_msnm'] = '';
     $this->user_fields['user_sig'] = '';
     $this->user_fields['user_sig_bbcode_uid'] = $board_config['allow_bbcode'] ? make_bbcode_uid() : '';
     $this->user_fields['user_avatar'] = '';
     $this->user_fields['user_avatar_type'] = USER_AVATAR_NONE;
     $this->user_fields['user_viewemail'] = 1;
     $this->user_fields['user_attachsig'] = 1;
     $this->user_fields['user_allowsmile'] = $board_config['allow_smilies'];
     $this->user_fields['user_allowhtml'] = $board_config['allow_html'];
     $this->user_fields['user_allowbbcode'] = $board_config['allow_bbcode'];
     $this->user_fields['user_allow_viewonline'] = 1;
     $this->user_fields['user_notify'] = 0;
     $this->user_fields['user_notify_pm'] = 1;
     $this->user_fields['user_popup_pm'] = 1;
     $this->user_fields['user_timezone'] = $board_config['board_timezone'];
     $this->user_fields['user_dateformat'] = $board_config['default_dateformat'];
     $this->user_fields['user_lang'] = $board_config['default_lang'];
     $this->user_fields['user_style'] = $board_config['default_style'];
     $this->user_fields['user_level'] = USER;
     $this->user_fields['user_posts'] = 0;
     $this->user_fields['user_wpuint_id'] = '';
 }
开发者ID:Oddsor,项目名称:lpt-forum,代码行数:40,代码来源:abstractify.php


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