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


PHP censorText函数代码示例

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


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

示例1: PrintTopic

function PrintTopic()
{
    global $db_prefix, $topic, $txt, $scripturl, $context;
    global $board_info;
    if (empty($topic)) {
        fatal_lang_error(472, false);
    }
    // Get the topic starter information.
    $request = db_query("\n\t\tSELECT m.posterTime, IFNULL(mem.realName, m.posterName) AS posterName\n\t\tFROM {$db_prefix}messages AS m\n\t\t\tLEFT JOIN {$db_prefix}members AS mem ON (mem.ID_MEMBER = m.ID_MEMBER)\n\t\tWHERE m.ID_TOPIC = {$topic}\n\t\tORDER BY ID_MSG\n\t\tLIMIT 1", __FILE__, __LINE__);
    if (mysql_num_rows($request) == 0) {
        fatal_lang_error('smf232');
    }
    $row = mysql_fetch_assoc($request);
    mysql_free_result($request);
    // Lets "output" all that info.
    loadTemplate('Printpage');
    $context['template_layers'] = array('print');
    $context['board_name'] = $board_info['name'];
    $context['category_name'] = $board_info['cat']['name'];
    $context['poster_name'] = $row['posterName'];
    $context['post_time'] = timeformat($row['posterTime'], false);
    // Split the topics up so we can print them.
    $request = db_query("\n\t\tSELECT subject, posterTime, body, IFNULL(mem.realName, posterName) AS posterName\n\t\tFROM {$db_prefix}messages AS m\n\t\t\tLEFT JOIN {$db_prefix}members AS mem ON (mem.ID_MEMBER = m.ID_MEMBER)\n\t\tWHERE ID_TOPIC = {$topic}\n\t\tORDER BY ID_MSG", __FILE__, __LINE__);
    $context['posts'] = array();
    while ($row = mysql_fetch_assoc($request)) {
        // Censor the subject and message.
        censorText($row['subject']);
        censorText($row['body']);
        $context['posts'][] = array('subject' => $row['subject'], 'member' => $row['posterName'], 'time' => timeformat($row['posterTime'], false), 'timestamp' => forum_time(true, $row['posterTime']), 'body' => parse_bbc($row['body'], 'print'));
        if (!isset($context['topic_subject'])) {
            $context['topic_subject'] = $row['subject'];
        }
    }
    mysql_free_result($request);
}
开发者ID:VBGAMER45,项目名称:SMFMods,代码行数:35,代码来源:Printpage.php

示例2: pmxc_AdmBlock_init

    /**
     * AdmBlock_init().
     * Setup caching and returns the language file name.
     */
    function pmxc_AdmBlock_init()
    {
        global $context, $modSettings, $smcFunc;
        // get all subject for select
        $padlen = 0;
        $this->posts = array();
        if (!empty($context['pmx']['promotes'])) {
            $request = $smcFunc['db_query']('', '
				SELECT id_msg, subject
				FROM {db_prefix}messages
				WHERE id_msg IN ({array_int:messages})' . ($modSettings['postmod_active'] ? ' AND approved = {int:is_approved}' : '') . '
				ORDER BY id_msg DESC', array('messages' => $context['pmx']['promotes'], 'is_approved' => 1));
            while ($row = $smcFunc['db_fetch_assoc']($request)) {
                censorText($row['subject']);
                $padlen = $padlen == 0 ? strlen($row['id_msg']) : $padlen;
                $this->posts[$row['id_msg']] = '[' . str_pad($row['id_msg'], $padlen, ' ', STR_PAD_LEFT) . '] ' . $row['subject'];
            }
            $smcFunc['db_free_result']($request);
        }
        if (empty($this->cfg['config']['settings']['posts'])) {
            $this->cfg['config']['settings']['posts'] = array();
        }
        $this->block_classdef = PortaMx_getdefaultClass(true);
        // extended classdef
        $this->can_cached = 1;
        // enable caching
    }
开发者ID:thunderamur,项目名称:PortaMx-Virgo-2.0-Beta-2,代码行数:31,代码来源:promotedposts_adm.php

示例3: SendTopic

function SendTopic()
{
    global $topic, $txt, $db_prefix, $context, $scripturl, $sourcedir;
    // Check permissions...
    isAllowedTo('send_topic');
    // We need at least a topic... go away if you don't have one.
    if (empty($topic)) {
        fatal_lang_error(472, false);
    }
    // Get the topic's subject.
    $request = db_query("\n\t\tSELECT m.subject\n\t\tFROM ({$db_prefix}messages AS m, {$db_prefix}topics AS t)\n\t\tWHERE t.ID_TOPIC = {$topic}\n\t\t\tAND t.ID_FIRST_MSG = m.ID_MSG\n\t\tLIMIT 1", __FILE__, __LINE__);
    if (mysql_num_rows($request) == 0) {
        fatal_lang_error(472, false);
    }
    $row = mysql_fetch_assoc($request);
    mysql_free_result($request);
    // Censor the subject....
    censorText($row['subject']);
    // Sending yet, or just getting prepped?
    if (empty($_POST['send'])) {
        loadTemplate('SendTopic');
        $context['page_title'] = sprintf($txt['sendtopic_title'], $row['subject']);
        $context['start'] = $_REQUEST['start'];
        return;
    }
    // Actually send the message...
    checkSession();
    spamProtection('spam');
    // This is needed for sendmail().
    require_once $sourcedir . '/Subs-Post.php';
    // Trim the names..
    $_POST['y_name'] = trim($_POST['y_name']);
    $_POST['r_name'] = trim($_POST['r_name']);
    // Make sure they aren't playing "let's use a fake email".
    if ($_POST['y_name'] == '_' || !isset($_POST['y_name']) || $_POST['y_name'] == '') {
        fatal_lang_error(75, false);
    }
    if (!isset($_POST['y_email']) || $_POST['y_email'] == '') {
        fatal_lang_error(76, false);
    }
    if (preg_match('~^[0-9A-Za-z=_+\\-/][0-9A-Za-z=_\'+\\-/\\.]*@[\\w\\-]+(\\.[\\w\\-]+)*(\\.[\\w]{2,6})$~', stripslashes($_POST['y_email'])) == 0) {
        fatal_lang_error(243, false);
    }
    // The receiver should be valid to.
    if ($_POST['r_name'] == '_' || !isset($_POST['r_name']) || $_POST['r_name'] == '') {
        fatal_lang_error(75, false);
    }
    if (!isset($_POST['r_email']) || $_POST['r_email'] == '') {
        fatal_lang_error(76, false);
    }
    if (preg_match('~^[0-9A-Za-z=_+\\-/][0-9A-Za-z=_\'+\\-/\\.]*@[\\w\\-]+(\\.[\\w\\-]+)*(\\.[\\w]{2,6})$~', stripslashes($_POST['r_email'])) == 0) {
        fatal_lang_error(243, false);
    }
    // Emails don't like entities...
    $row['subject'] = un_htmlspecialchars($row['subject']);
    // And off we go!
    sendmail($_POST['r_email'], $txt[118] . ': ' . $row['subject'] . ' (' . $txt[318] . ' ' . $_POST['y_name'] . ')', sprintf($txt['sendtopic_dear'], $_POST['r_name']) . "\n\n" . sprintf($txt['sendtopic_this_topic'], $row['subject']) . ":\n\n" . $scripturl . '?topic=' . $topic . ".0\n\n" . (!empty($_POST['comment']) ? $txt['sendtopic2'] . ":\n" . $_POST['comment'] . "\n\n" : '') . $txt['sendtopic_thanks'] . ",\n" . $_POST['y_name'], $_POST['y_email']);
    // Back to the topic!
    redirectexit('topic=' . $topic . '.0');
}
开发者ID:VBGAMER45,项目名称:SMFMods,代码行数:60,代码来源:SendTopic.php

示例4: PrintTopic

function PrintTopic()
{
    global $topic, $txt, $scripturl, $context, $user_info;
    global $board_info, $smcFunc, $modSettings;
    // Redirect to the boardindex if no valid topic id is provided.
    if (empty($topic)) {
        redirectexit();
    }
    // Whatever happens don't index this.
    $context['robot_no_index'] = true;
    // Get the topic starter information.
    $request = $smcFunc['db_query']('', '
		SELECT m.poster_time, IFNULL(mem.real_name, m.poster_name) AS poster_name
		FROM {db_prefix}messages AS m
			LEFT JOIN {db_prefix}members AS mem ON (mem.id_member = m.id_member)
		WHERE m.id_topic = {int:current_topic}
		ORDER BY m.id_msg
		LIMIT 1', array('current_topic' => $topic));
    // Redirect to the boardindex if no valid topic id is provided.
    if ($smcFunc['db_num_rows']($request) == 0) {
        redirectexit();
    }
    $row = $smcFunc['db_fetch_assoc']($request);
    $smcFunc['db_free_result']($request);
    // Lets "output" all that info.
    loadTemplate('Printpage');
    $context['template_layers'] = array('print');
    $context['board_name'] = $board_info['name'];
    $context['category_name'] = $board_info['cat']['name'];
    $context['poster_name'] = $row['poster_name'];
    $context['post_time'] = timeformat($row['poster_time'], false);
    $context['parent_boards'] = array();
    foreach ($board_info['parent_boards'] as $parent) {
        $context['parent_boards'][] = $parent['name'];
    }
    // Split the topics up so we can print them.
    $request = $smcFunc['db_query']('', '
		SELECT subject, poster_time, body, IFNULL(mem.real_name, poster_name) AS poster_name
		FROM {db_prefix}messages AS m
			LEFT JOIN {db_prefix}members AS mem ON (mem.id_member = m.id_member)
		WHERE m.id_topic = {int:current_topic}' . ($modSettings['postmod_active'] && !allowedTo('approve_posts') ? '
			AND (m.approved = {int:is_approved}' . ($user_info['is_guest'] ? '' : ' OR m.id_member = {int:current_member}') . ')' : '') . '
		ORDER BY m.id_msg', array('current_topic' => $topic, 'is_approved' => 1, 'current_member' => $user_info['id']));
    $context['posts'] = array();
    while ($row = $smcFunc['db_fetch_assoc']($request)) {
        // Censor the subject and message.
        censorText($row['subject']);
        censorText($row['body']);
        $context['posts'][] = array('subject' => $row['subject'], 'member' => $row['poster_name'], 'time' => timeformat($row['poster_time'], false), 'timestamp' => forum_time(true, $row['poster_time']), 'body' => parse_bbc($row['body'], 'print'));
        if (!isset($context['topic_subject'])) {
            $context['topic_subject'] = $row['subject'];
        }
    }
    $smcFunc['db_free_result']($request);
    // Set a canonical URL for this page.
    $context['canonical_url'] = $scripturl . '?topic=' . $topic . '.0';
}
开发者ID:abdulhadikaryana,项目名称:kebudayaan,代码行数:57,代码来源:Printpage.php

示例5: SetCensor

function SetCensor()
{
    global $txt, $modSettings, $context;
    if (!empty($_POST['save_censor'])) {
        // Make sure censoring is something they can do.
        checkSession();
        $censored_vulgar = array();
        $censored_proper = array();
        // Rip it apart, then split it into two arrays.
        if (isset($_POST['censortext'])) {
            $_POST['censortext'] = explode("\n", strtr($_POST['censortext'], array("\r" => '')));
            foreach ($_POST['censortext'] as $c) {
                list($censored_vulgar[], $censored_proper[]) = array_pad(explode('=', trim($c)), 2, '');
            }
        } elseif (isset($_POST['censor_vulgar'], $_POST['censor_proper'])) {
            if (is_array($_POST['censor_vulgar'])) {
                foreach ($_POST['censor_vulgar'] as $i => $value) {
                    if (trim(strtr($value, '*', ' ')) == '') {
                        unset($_POST['censor_vulgar'][$i], $_POST['censor_proper'][$i]);
                    }
                }
                $censored_vulgar = $_POST['censor_vulgar'];
                $censored_proper = $_POST['censor_proper'];
            } else {
                $censored_vulgar = explode("\n", strtr($_POST['censor_vulgar'], array("\r" => '')));
                $censored_proper = explode("\n", strtr($_POST['censor_proper'], array("\r" => '')));
            }
        }
        // Set the new arrays and settings in the database.
        $updates = array('censor_vulgar' => implode("\n", $censored_vulgar), 'censor_proper' => implode("\n", $censored_proper), 'censorWholeWord' => empty($_POST['censorWholeWord']) ? '0' : '1', 'censorIgnoreCase' => empty($_POST['censorIgnoreCase']) ? '0' : '1');
        updateSettings($updates);
    }
    if (isset($_POST['censortest'])) {
        $censorText = htmlspecialchars($_POST['censortest'], ENT_QUOTES);
        $context['censor_test'] = strtr(censorText($censorText), array('"' => '"'));
    }
    // Set everything up for the template to do its thang.
    $censor_vulgar = explode("\n", $modSettings['censor_vulgar']);
    $censor_proper = explode("\n", $modSettings['censor_proper']);
    $context['censored_words'] = array();
    for ($i = 0, $n = count($censor_vulgar); $i < $n; $i++) {
        if (empty($censor_vulgar[$i])) {
            continue;
        }
        // Skip it, it's either spaces or stars only.
        if (trim(strtr($censor_vulgar[$i], '*', ' ')) == '') {
            continue;
        }
        $context['censored_words'][htmlspecialchars(trim($censor_vulgar[$i]))] = isset($censor_proper[$i]) ? htmlspecialchars($censor_proper[$i]) : '';
    }
    $context['sub_template'] = 'edit_censored';
    $context['page_title'] = $txt['admin_censored_words'];
}
开发者ID:norv,项目名称:EosAlpha,代码行数:53,代码来源:ManagePosts.php

示例6: getLastPosts

function getLastPosts($latestPostOptions)
{
    global $scripturl, $txt, $user_info, $modSettings, $smcFunc, $context;
    // Find all the posts.  Newer ones will have higher IDs.  (assuming the last 20 * number are accessable...)
    // !!!SLOW This query is now slow, NEEDS to be fixed.  Maybe break into two?
    $request = $smcFunc['db_query']('substring', '
		SELECT
			m.poster_time, m.subject, m.id_topic, m.id_member, m.id_msg,
			IFNULL(mem.real_name, m.poster_name) AS poster_name, t.id_board, b.name AS board_name,
			SUBSTRING(m.body, 1, 385) AS body, m.smileys_enabled
		FROM {db_prefix}messages AS m
			INNER JOIN {db_prefix}topics AS t ON (t.id_topic = m.id_topic)
			INNER JOIN {db_prefix}boards AS b ON (b.id_board = t.id_board)
			LEFT JOIN {db_prefix}members AS mem ON (mem.id_member = m.id_member)
		WHERE m.id_msg >= {int:likely_max_msg}' . (!empty($modSettings['recycle_enable']) && $modSettings['recycle_board'] > 0 ? '
			AND b.id_board != {int:recycle_board}' : '') . '
			AND {query_wanna_see_board}' . ($modSettings['postmod_active'] ? '
			AND t.approved = {int:is_approved}
			AND m.approved = {int:is_approved}' : '') . '
		ORDER BY m.id_msg DESC
		LIMIT ' . $latestPostOptions['number_posts'], array('likely_max_msg' => max(0, $modSettings['maxMsgID'] - 50 * $latestPostOptions['number_posts']), 'recycle_board' => $modSettings['recycle_board'], 'is_approved' => 1));
    $posts = array();
    $context['MemberColor_ID_MEMBER'] = array();
    while ($row = $smcFunc['db_fetch_assoc']($request)) {
        // Censor the subject and post for the preview ;).
        censorText($row['subject']);
        censorText($row['body']);
        $row['body'] = strip_tags(strtr(parse_bbc($row['body'], $row['smileys_enabled'], $row['id_msg']), array('<br />' => '&#10;')));
        if ($smcFunc['strlen']($row['body']) > 128) {
            $row['body'] = $smcFunc['substr']($row['body'], 0, 128) . '...';
        }
        // Build the array.
        $posts[] = array('board' => array('id' => $row['id_board'], 'name' => $row['board_name'], 'href' => $scripturl . '?board=' . $row['id_board'] . '.0', 'link' => '<a href="' . $scripturl . '?board=' . $row['id_board'] . '.0">' . $row['board_name'] . '</a>'), 'topic' => $row['id_topic'], 'poster' => array('id' => $row['id_member'], 'name' => $row['poster_name'], 'href' => empty($row['id_member']) ? '' : $scripturl . '?action=profile;u=' . $row['id_member'], 'link' => empty($row['id_member']) ? (!empty($modSettings['MemberColorGuests']) ? '<span style="color:' . $modSettings['MemberColorGuests'] . ';">' : '') . $row['poster_name'] . (!empty($modSettings['MemberColorGuests']) ? '</span>' : '') : '<a href="' . $scripturl . '?action=profile;u=' . $row['id_member'] . '" title="' . $txt['profile_of'] . ' ' . $row['poster_name'] . '">' . $row['poster_name'] . '</a>'), 'subject' => $row['subject'], 'short_subject' => shorten_subject($row['subject'], 24), 'preview' => $row['body'], 'time' => timeformat($row['poster_time']), 'timestamp' => forum_time(true, $row['poster_time']), 'raw_timestamp' => $row['poster_time'], 'href' => $scripturl . '?topic=' . $row['id_topic'] . '.msg' . $row['id_msg'] . ';topicseen#msg' . $row['id_msg'], 'link' => '<a href="' . $scripturl . '?topic=' . $row['id_topic'] . '.msg' . $row['id_msg'] . ';topicseen#msg' . $row['id_msg'] . '" rel="nofollow">' . $row['subject'] . '</a>');
        //The Last Posters id for the MemberColor.
        if (!empty($modSettings['MemberColorRecentLastPost']) && !empty($row['id_member'])) {
            $context['MemberColor_ID_MEMBER'][$row['id_member']] = $row['id_member'];
        }
    }
    $smcFunc['db_free_result']($request);
    // Know set the colors for the Recent posts...
    if (!empty($context['MemberColor_ID_MEMBER'])) {
        $colorDatas = load_onlineColors($context['MemberColor_ID_MEMBER']);
        //So Let's Color The Recent Posts ;)
        if (!empty($modSettings['MemberColorRecentLastPost']) && is_array($posts)) {
            foreach ($posts as $postkey => $postid_memcolor) {
                if (!empty($colorDatas[$postid_memcolor['poster']['id']]['colored_link'])) {
                    $posts[$postkey]['poster']['link'] = $colorDatas[$postid_memcolor['poster']['id']]['colored_link'];
                }
            }
        }
    }
    return $posts;
}
开发者ID:Kheros,项目名称:MMOver,代码行数:53,代码来源:Subs-Recent.php

示例7: ShowAnnouncements

function ShowAnnouncements()
{
    global $context, $txt, $sourcedir, $ultimateportalSettings;
    if (!isset($_POST['save'])) {
        checkSession('get');
    }
    if (isset($_POST['save'])) {
        checkSession('post');
        $configUltimatePortalVar['up_news_global_announcement'] = censorText($_POST['up_news_global_announcement']);
        updateUltimatePortalSettings($configUltimatePortalVar, 'config_up_news');
    }
    // Needed for the editor and message icons.
    require_once $sourcedir . '/Subs-Editor.php';
    // Now create the editor.
    $editorOptions = array('id' => 'up_news_global_announcement', 'value' => $ultimateportalSettings['up_news_global_announcement'], 'form' => 'newsform');
    create_control_richedit($editorOptions);
    // Store the ID.
    $context['post_box_name'] = $editorOptions['id'];
    $context['sub_template'] = 'announcement';
    $context['page_title'] = $txt['ultport_admin_news_title'] . ' - ' . $txt['ultport_admin_announcements_title'] . ' - ' . $txt['ultport_admin_module_title2'];
}
开发者ID:4kstore,项目名称:UltimatePortal-0.4,代码行数:21,代码来源:UltimatePortalModules.php

示例8: action_selectgroup

 /**
  * Allow a user to chose the membergroups to send the announcement to.
  * Lets the user select the membergroups that will receive the topic announcement.
  * Accessed by action=announce;sa=selectgroup
  * @uses Announce template announce sub template
  */
 public function action_selectgroup()
 {
     global $context, $topic, $board_info;
     require_once SUBSDIR . '/Membergroups.subs.php';
     require_once SUBSDIR . '/Topic.subs.php';
     // Build a list of groups that can see this board
     $groups = array_merge($board_info['groups'], array(1));
     foreach ($groups as $id => $group) {
         $groups[$id] = (int) $group;
     }
     // Prepare for a group selection list in the template
     $context['groups'] = getGroups($groups);
     // Get the subject of the topic we're about to announce.
     $topic_info = getTopicInfo($topic, 'message');
     $context['topic_subject'] = $topic_info['subject'];
     censorText($context['announce_topic']['subject']);
     // Prepare for the template
     $context['move'] = isset($_REQUEST['move']) ? 1 : 0;
     $context['go_back'] = isset($_REQUEST['goback']) ? 1 : 0;
     $context['sub_template'] = 'announce';
 }
开发者ID:KeiroD,项目名称:Elkarte,代码行数:27,代码来源:Announce.controller.php

示例9: getLastPosts

function getLastPosts($latestPostOptions)
{
    global $scripturl, $txt, $user_info, $modSettings, $smcFunc, $context;
    // Find all the posts.  Newer ones will have higher IDs.  (assuming the last 20 * number are accessable...)
    // !!!SLOW This query is now slow, NEEDS to be fixed.  Maybe break into two?
    $request = smf_db_query('
		SELECT
			m.poster_time, m.subject, m.id_topic, m.id_member, m.id_msg, b.name, m1.subject AS first_subject,
			IFNULL(mem.real_name, m.poster_name) AS poster_name, t.id_board, b.name AS board_name,
			SUBSTRING(m.body, 1, 385) AS body, m.smileys_enabled
		FROM {db_prefix}messages AS m
			INNER JOIN {db_prefix}topics AS t ON (t.id_topic = m.id_topic)
			INNER JOIN {db_prefix}boards AS b ON (b.id_board = t.id_board)
			INNER JOIN {db_prefix}messages AS m1 ON (m1.id_msg = t.id_first_msg)
			LEFT JOIN {db_prefix}members AS mem ON (mem.id_member = m.id_member)
		WHERE m.id_msg >= {int:likely_max_msg}' . (!empty($modSettings['recycle_enable']) && $modSettings['recycle_board'] > 0 ? '
			AND b.id_board != {int:recycle_board}' : '') . '
			AND {query_wanna_see_board}' . ($modSettings['postmod_active'] ? '
			AND t.approved = {int:is_approved}
			AND m.approved = {int:is_approved}' : '') . '
		ORDER BY m.id_msg DESC
		LIMIT ' . $latestPostOptions['number_posts'], array('likely_max_msg' => max(0, $modSettings['maxMsgID'] - 50 * $latestPostOptions['number_posts']), 'recycle_board' => $modSettings['recycle_board'], 'is_approved' => 1));
    $posts = array();
    while ($row = mysql_fetch_assoc($request)) {
        // Censor the subject and post for the preview ;).
        censorText($row['subject']);
        censorText($row['body']);
        $row['body'] = strip_tags(strtr(parse_bbc($row['body'], $row['smileys_enabled'], $row['id_msg']), array('<br />' => '&#10;')));
        if (commonAPI::strlen($row['body']) > 128) {
            $row['body'] = commonAPI::substr($row['body'], 0, 128) . '...';
        }
        $bhref = URL::board($row['id_board'], $row['board_name'], 0, true);
        $mhref = URL::user($row['id_member'], $row['poster_name']);
        $thref = URL::topic($row['id_topic'], $row['first_subject'], 0, false, '.msg' . $row['id_msg'], ';topicseen#msg' . $row['id_msg']);
        // Build the array.
        $posts[] = array('board' => array('id' => $row['id_board'], 'name' => $row['board_name'], 'href' => $bhref, 'link' => '<a href="' . $bhref . '">' . $row['board_name'] . '</a>'), 'topic' => $row['id_topic'], 'poster' => array('id' => $row['id_member'], 'name' => $row['poster_name'], 'href' => empty($row['id_member']) ? '' : $mhref, 'link' => empty($row['id_member']) ? $row['poster_name'] : '<a href="' . $mhref . '">' . $row['poster_name'] . '</a>'), 'subject' => $row['subject'], 'short_subject' => shorten_subject($row['subject'], 35), 'preview' => $row['body'], 'time' => timeformat($row['poster_time']), 'timestamp' => forum_time(true, $row['poster_time']), 'raw_timestamp' => $row['poster_time'], 'href' => $thref, 'link' => '<a href="' . $thref . '" rel="nofollow">' . $row['first_subject'] . '</a>');
    }
    mysql_free_result($request);
    return $posts;
}
开发者ID:norv,项目名称:EosAlpha,代码行数:40,代码来源:Subs-Recent.php

示例10: calendarEventArray

function calendarEventArray($low_date, $high_date, $use_permissions = true)
{
    global $db_prefix, $ID_MEMBER, $scripturl, $modSettings, $user_info, $sc;
    $low_date_time = sscanf($low_date, '%04d-%02d-%02d');
    $low_date_time = mktime(0, 0, 0, $low_date_time[1], $low_date_time[2], $low_date_time[0]);
    $high_date_time = sscanf($high_date, '%04d-%02d-%02d');
    $high_date_time = mktime(0, 0, 0, $high_date_time[1], $high_date_time[2], $high_date_time[0]);
    // Find all the calendar info...
    $result = db_query("\n\t\tSELECT\n\t\t\tcal.ID_EVENT, cal.startDate, cal.endDate, cal.title, cal.ID_MEMBER, cal.ID_TOPIC,\n\t\t\tcal.ID_BOARD, b.memberGroups, t.ID_FIRST_MSG\n\t\tFROM {$db_prefix}calendar AS cal\n\t\t\tLEFT JOIN {$db_prefix}boards AS b ON (b.ID_BOARD = cal.ID_BOARD)\n\t\t\tLEFT JOIN {$db_prefix}topics AS t ON (t.ID_TOPIC = cal.ID_TOPIC)\n\t\tWHERE cal.startDate <= '{$high_date}'\n\t\t\tAND cal.endDate >= '{$low_date}'" . ($use_permissions ? "\n\t\t\tAND (cal.ID_BOARD = 0 OR {$user_info['query_see_board']})" : ''), __FILE__, __LINE__);
    $events = array();
    while ($row = mysql_fetch_assoc($result)) {
        // Censor the title.
        censorText($row['title']);
        $startDate = sscanf($row['startDate'], '%04d-%02d-%02d');
        $startDate = max(mktime(0, 0, 0, $startDate[1], $startDate[2], $startDate[0]), $low_date_time);
        $endDate = sscanf($row['endDate'], '%04d-%02d-%02d');
        $endDate = min(mktime(0, 0, 0, $endDate[1], $endDate[2], $endDate[0]), $high_date_time);
        $lastDate = '';
        for ($date = $startDate; $date <= $endDate; $date += 86400) {
            // Attempt to avoid DST problems.
            //!!! Resolve this properly at some point.
            if (strftime('%Y-%m-%d', $date) == $lastDate) {
                $date += 3601;
            }
            $lastDate = strftime('%Y-%m-%d', $date);
            // If we're using permissions (calendar pages?) then just ouput normal contextual style information.
            if ($use_permissions) {
                $events[strftime('%Y-%m-%d', $date)][] = array('id' => $row['ID_EVENT'], 'title' => $row['title'], 'can_edit' => allowedTo('calendar_edit_any') || $row['ID_MEMBER'] == $ID_MEMBER && allowedTo('calendar_edit_own'), 'modify_href' => $scripturl . '?action=' . ($row['ID_BOARD'] == 0 ? 'calendar;sa=post;' : 'post;msg=' . $row['ID_FIRST_MSG'] . ';topic=' . $row['ID_TOPIC'] . '.0;calendar;') . 'eventid=' . $row['ID_EVENT'] . ';sesc=' . $sc, 'href' => $row['ID_BOARD'] == 0 ? '' : $scripturl . '?topic=' . $row['ID_TOPIC'] . '.0', 'link' => $row['ID_BOARD'] == 0 ? $row['title'] : '<a href="' . $scripturl . '?topic=' . $row['ID_TOPIC'] . '.0">' . $row['title'] . '</a>', 'start_date' => $row['startDate'], 'end_date' => $row['endDate'], 'is_last' => false);
            } else {
                $events[strftime('%Y-%m-%d', $date)][] = array('id' => $row['ID_EVENT'], 'title' => $row['title'], 'topic' => $row['ID_TOPIC'], 'msg' => $row['ID_FIRST_MSG'], 'poster' => $row['ID_MEMBER'], 'start_date' => $row['startDate'], 'end_date' => $row['endDate'], 'is_last' => false, 'allowed_groups' => explode(',', $row['memberGroups']));
            }
        }
    }
    mysql_free_result($result);
    // If we're doing normal contextual data, go through and make things clear to the templates ;).
    if ($use_permissions) {
        foreach ($events as $mday => $array) {
            $events[$mday][count($array) - 1]['is_last'] = true;
        }
    }
    return $events;
}
开发者ID:VBGAMER45,项目名称:SMFMods,代码行数:42,代码来源:Calendar.php

示例11: MessagePost2


//.........这里部分代码省略.........
                $post_errors = array_diff($post_errors, array('no_to'));
                foreach ($namesNotFound[$recipientType] as $name) {
                    $context['send_log']['failed'][] = sprintf($txt['pm_error_user_not_found'], $name);
                }
            }
        }
    }
    // Did they make any mistakes?
    if ($_REQUEST['subject'] == '') {
        $post_errors[] = 'no_subject';
    }
    if (!isset($_REQUEST['message']) || $_REQUEST['message'] == '') {
        $post_errors[] = 'no_message';
    } elseif (!empty($modSettings['max_messageLength']) && $smcFunc['strlen']($_REQUEST['message']) > $modSettings['max_messageLength']) {
        $post_errors[] = 'long_message';
    } else {
        // Preparse the message.
        $message = $_REQUEST['message'];
        preparsecode($message);
        // Make sure there's still some content left without the tags.
        if ($smcFunc['htmltrim'](strip_tags(parse_bbc($smcFunc['htmlspecialchars']($message, ENT_QUOTES), false), '<img>')) === '' && (!allowedTo('admin_forum') || strpos($message, '[html]') === false)) {
            $post_errors[] = 'no_message';
        }
    }
    // Wrong verification code?
    if (!$user_info['is_admin'] && !isset($_REQUEST['xml']) && !empty($modSettings['pm_posts_verification']) && $user_info['posts'] < $modSettings['pm_posts_verification']) {
        require_once $sourcedir . '/Subs-Editor.php';
        $verificationOptions = array('id' => 'pm');
        $context['require_verification'] = create_control_verification($verificationOptions, true);
        if (is_array($context['require_verification'])) {
            $post_errors = array_merge($post_errors, $context['require_verification']);
        }
    }
    // If they did, give a chance to make ammends.
    if (!empty($post_errors) && !$is_recipient_change && !isset($_REQUEST['preview']) && !isset($_REQUEST['xml'])) {
        return messagePostError($post_errors, $namedRecipientList, $recipientList);
    }
    // Want to take a second glance before you send?
    if (isset($_REQUEST['preview'])) {
        // Set everything up to be displayed.
        $context['preview_subject'] = $smcFunc['htmlspecialchars']($_REQUEST['subject']);
        $context['preview_message'] = $smcFunc['htmlspecialchars']($_REQUEST['message'], ENT_QUOTES);
        preparsecode($context['preview_message'], true);
        // Parse out the BBC if it is enabled.
        $context['preview_message'] = parse_bbc($context['preview_message']);
        // Censor, as always.
        censorText($context['preview_subject']);
        censorText($context['preview_message']);
        // Set a descriptive title.
        $context['page_title'] = $txt['preview'] . ' - ' . $context['preview_subject'];
        // Pretend they messed up but don't ignore if they really did :P.
        return messagePostError($post_errors, $namedRecipientList, $recipientList);
    } elseif ($is_recipient_change) {
        // Maybe we couldn't find one?
        foreach ($namesNotFound as $recipientType => $names) {
            $post_errors[] = 'bad_' . $recipientType;
            foreach ($names as $name) {
                $context['send_log']['failed'][] = sprintf($txt['pm_error_user_not_found'], $name);
            }
        }
        return messagePostError(array(), $namedRecipientList, $recipientList);
    }
    // Want to save this as a draft and think about it some more?
    if (!empty($modSettings['drafts_enabled']) && !empty($modSettings['drafts_pm_enabled']) && isset($_POST['save_draft'])) {
        require_once $sourcedir . '/Drafts.php';
        SavePMDraft($post_errors, $recipientList);
        return messagePostError($post_errors, $namedRecipientList, $recipientList);
    } elseif (!empty($modSettings['max_pm_recipients']) && count($recipientList['to']) + count($recipientList['bcc']) > $modSettings['max_pm_recipients'] && !allowedTo(array('moderate_forum', 'send_mail', 'admin_forum'))) {
        $context['send_log'] = array('sent' => array(), 'failed' => array(sprintf($txt['pm_too_many_recipients'], $modSettings['max_pm_recipients'])));
        return messagePostError($post_errors, $namedRecipientList, $recipientList);
    }
    // Protect from message spamming.
    spamProtection('pm');
    // Prevent double submission of this form.
    checkSubmitOnce('check');
    // Do the actual sending of the PM.
    if (!empty($recipientList['to']) || !empty($recipientList['bcc'])) {
        $context['send_log'] = sendpm($recipientList, $_REQUEST['subject'], $_REQUEST['message'], !empty($_REQUEST['outbox']), null, !empty($_REQUEST['pm_head']) ? (int) $_REQUEST['pm_head'] : 0);
    } else {
        $context['send_log'] = array('sent' => array(), 'failed' => array());
    }
    // Mark the message as "replied to".
    if (!empty($context['send_log']['sent']) && !empty($_REQUEST['replied_to']) && isset($_REQUEST['f']) && $_REQUEST['f'] == 'inbox') {
        $smcFunc['db_query']('', '
			UPDATE {db_prefix}pm_recipients
			SET is_read = is_read | 2
			WHERE id_pm = {int:replied_to}
				AND id_member = {int:current_member}', array('current_member' => $user_info['id'], 'replied_to' => (int) $_REQUEST['replied_to']));
    }
    // If one or more of the recipient were invalid, go back to the post screen with the failed usernames.
    if (!empty($context['send_log']['failed'])) {
        return messagePostError($post_errors, $namesNotFound, array('to' => array_intersect($recipientList['to'], $context['send_log']['failed']), 'bcc' => array_intersect($recipientList['bcc'], $context['send_log']['failed'])));
    }
    // Message sent successfully?
    if (!empty($context['send_log']) && empty($context['send_log']['failed'])) {
        $context['current_label_redirect'] = $context['current_label_redirect'] . ';done=sent';
    }
    // Go back to the where they sent from, if possible...
    redirectexit($context['current_label_redirect']);
}
开发者ID:Glyph13,项目名称:SMF2.1,代码行数:101,代码来源:PersonalMessage.php

示例12: list_getGroupRequests

function list_getGroupRequests($start, $items_per_page, $sort, $where, $where_parameters)
{
    global $smcFunc, $txt, $scripturl;
    $request = $smcFunc['db_query']('', '
		SELECT lgr.id_request, lgr.id_member, lgr.id_group, lgr.time_applied, lgr.reason,
			mem.member_name, mg.group_name, mg.online_color, mem.real_name
		FROM {db_prefix}log_group_requests AS lgr
			INNER JOIN {db_prefix}members AS mem ON (mem.id_member = lgr.id_member)
			INNER JOIN {db_prefix}membergroups AS mg ON (mg.id_group = lgr.id_group)
		WHERE ' . $where . '
		ORDER BY {raw:sort}
		LIMIT ' . $start . ', ' . $items_per_page, array_merge($where_parameters, array('sort' => $sort)));
    $group_requests = array();
    while ($row = $smcFunc['db_fetch_assoc']($request)) {
        if (!empty($row['id_member'])) {
            $context['MemberColor_ID_MEMBER'][$row['id_member']] = $row['id_member'];
        }
        $group_requests[] = array('id' => $row['id_request'], 'id_member' => $row['id_member'], 'member_link' => '<a href="' . $scripturl . '?action=profile;u=' . $row['id_member'] . '">' . $row['real_name'] . '</a>', 'group_link' => '<span style="color: ' . $row['online_color'] . '">' . $row['group_name'] . '</span>', 'reason' => censorText($row['reason']), 'time_submitted' => timeformat($row['time_applied']));
    }
    $smcFunc['db_free_result']($request);
    //Give me some Colors baby ;D
    global $modSettings;
    if (!empty($modSettings['MemberColorModCenter']) && !empty($context['MemberColor_ID_MEMBER']) && !empty($group_requests)) {
        $colorDatas = load_onlineColors($context['MemberColor_ID_MEMBER']);
        foreach ($group_requests as $key => $item) {
            if (!empty($colorDatas[$item['id_member']]['colored_link'])) {
                $group_requests[$key]['member_link'] = $colorDatas[$item['id_member']]['colored_link'];
            }
        }
    }
    return $group_requests;
}
开发者ID:Kheros,项目名称:MMOver,代码行数:32,代码来源:Groups.php

示例13: fetch_data

    /**
     * fetch_data.
     * Fetch Boards, Topics, Messages and Attaches.
     */
    function fetch_data()
    {
        global $context, $smcFunc, $modSettings, $settings, $boardurl, $scripturl, $txt;
        $boards = !empty($this->cfg['config']['settings']['board']) ? $this->cfg['config']['settings']['board'] : array();
        $this->cfg['config']['settings']['total'] = empty($this->cfg['config']['settings']['total']) ? 1 : $this->cfg['config']['settings']['total'];
        $this->posts = null;
        $this->attaches = null;
        $this->imgName = '';
        if (!empty($boards)) {
            // Load the message icons
            $stable_icons = array('xx', 'thumbup', 'thumbdown', 'exclamation', 'question', 'lamp', 'smiley', 'angry', 'cheesy', 'grin', 'sad', 'wink', 'moved', 'recycled');
            $icon_sources = array();
            foreach ($stable_icons as $icon) {
                $icon_sources[$icon] = 'images_url';
            }
            // find the n post from each board
            $this->cfg['config']['settings']['total'] = empty($this->cfg['config']['settings']['total']) ? 1 : $this->cfg['config']['settings']['total'];
            $msgids = array();
            $curboard = 0;
            $request = $smcFunc['db_query']('', '
				SELECT b.id_board, b.name, t.id_topic, t.num_replies, t.num_views, m.*
				FROM {db_prefix}topics as t
				LEFT JOIN {db_prefix}boards as b ON (t.id_board = b.id_board)
				LEFT JOIN {db_prefix}messages as m ON (t.id_first_msg = m.id_msg)
				WHERE b.id_board IN ({array_int:boards}) AND {query_wanna_see_board}
					' . ($modSettings['postmod_active'] ? ' AND m.approved = {int:approv}' : '') . '
					AND t.id_last_msg >= {int:min_msg}
				ORDER BY b.id_board ASC, t.id_topic DESC', array('boards' => $boards, 'min_msg' => $modSettings['maxMsgID'] - 100 * $this->cfg['config']['settings']['total'], 'approv' => 1));
            while ($row = $smcFunc['db_fetch_assoc']($request)) {
                if ($row['id_board'] != $curboard) {
                    $curboard = $row['id_board'];
                    $max = $this->cfg['config']['settings']['total'];
                }
                if (!empty($max)) {
                    $msgids[$row['id_topic']] = $row['id_msg'];
                    $max--;
                    $row['body'] = parse_bbc($row['body'], $row['smileys_enabled'], $row['id_msg']);
                    // Check that this message icon is there...
                    if (empty($modSettings['messageIconChecks_disable']) && !isset($icon_sources[$row['icon']])) {
                        $icon_sources[$row['icon']] = file_exists($settings['theme_dir'] . '/images/post/' . $row['icon'] . '.png') ? 'images_url' : 'default_images_url';
                    }
                    censorText($row['subject']);
                    censorText($row['body']);
                    // Rescale inline Images ?
                    if (!empty($this->cfg['config']['settings']['rescale']) || empty($this->cfg['config']['settings']['rescale']) && !is_numeric($this->cfg['config']['settings']['rescale'])) {
                        // find all images
                        if (preg_match_all('~<img[^>]*>~iS', $row['body'], $matches) > 0) {
                            // remove smileys
                            foreach ($matches[0] as $i => $data) {
                                if (strpos($data, $modSettings['smileys_url']) !== false) {
                                    unset($matches[0][$i]);
                                }
                            }
                            // images found?
                            if (count($matches[0]) > 0) {
                                $this->imgName = $this->cfg['blocktype'] . '-' . $this->cfg['id'];
                                if (empty($this->cfg['config']['settings']['rescale'])) {
                                    $fnd = array('~ class?=?"[^"]*"~', '~ alt?=?"[^"]*"~', '~ title?=?"[^"]*"~');
                                } else {
                                    $fnd = array('~ width?=?"\\d+"~', '~ height?=?"\\d+"~', '~ class?=?"[^"]*"~', '~ alt?=?"[^"]*"~', '~ title?=?"[^"]*"~');
                                }
                                // modify the images for highslide
                                foreach ($matches[0] as $i => $data) {
                                    $datlen = strlen($data);
                                    preg_match('~src?=?"([^\\"]*\\")~i', $data, $src);
                                    $alt = substr(strrchr($src[1], '/'), 1);
                                    $alt = str_replace(array('_', '-'), ' ', strtoupper(substr($alt, 0, strrpos($alt, '.'))));
                                    $tmp = str_replace($src[0], ' class="' . $this->imgName . '" alt="' . $alt . '" ' . $src[0], preg_replace($fnd, '', $data));
                                    // highslide disabled?
                                    if (!empty($context['pmx']['settings']['disableHS']) || !empty($context['pmx']['settings']['disableHSonfront'])) {
                                        $row['body'] = substr_replace($row['body'], $tmp, strpos($row['body'], $data), $datlen);
                                    } elseif (empty($this->cfg['config']['settings']['disableHSimg']) && empty($context['pmx']['settings']['disableHSonfront'])) {
                                        $row['body'] = substr_replace($row['body'], '<a href="' . $boardurl . '" class="' . $this->imgName . ' highslide" title="' . $txt['pmx_hs_expand'] . '" onclick="return hs.expand(this, {src: \'' . str_replace('"', '', $src[1]) . '\', align: \'center\', headingEval: \'this.thumb.alt\'})">' . $tmp . '</a>', strpos($row['body'], $data), $datlen);
                                    } else {
                                        $row['body'] = substr_replace($row['body'], $tmp, strpos($row['body'], $data), $datlen);
                                    }
                                }
                            }
                        }
                    } elseif (is_numeric($this->cfg['config']['settings']['rescale'])) {
                        $row['body'] = PortaMx_revoveLinks($row['body'], false, true);
                    }
                    // teaser enabled ?
                    if (!empty($this->cfg['config']['settings']['teaser'])) {
                        $row['body'] = PortaMx_Tease_posts($row['body'], $this->cfg['config']['settings']['teaser'], '', false, false);
                    }
                    $this->posts[] = array('id_board' => $row['id_board'], 'board_name' => $row['name'], 'id' => $row['id_topic'], 'message_id' => $row['id_msg'], 'icon' => '<img src="' . $settings[$icon_sources[$row['icon']]] . '/post/' . $row['icon'] . '.png" alt="' . $row['icon'] . '" />', 'subject' => $row['subject'], 'time' => timeformat($row['poster_time']), 'timestamp' => forum_time(true, $row['poster_time']), 'body' => $row['body'], 'replies' => $row['num_replies'], 'views' => $row['num_views'], 'poster' => array('id' => $row['id_member'], 'name' => $row['poster_name'], 'href' => !empty($row['id_member']) ? $scripturl . '?action=profile;u=' . $row['id_member'] : '', 'link' => !empty($row['id_member']) ? '<a href="' . $scripturl . '?action=profile;u=' . $row['id_member'] . '">' . $row['poster_name'] . '</a>' : $row['poster_name']), 'locked' => !empty($row['locked']));
                }
            }
            $smcFunc['db_free_result']($request);
            // any post found?
            if (!is_null($this->posts)) {
                // get attachments if show thumnails set
                $allow_boards = boardsAllowedTo('view_attachments');
                if (!empty($this->cfg['config']['settings']['thumbs']) && !empty($allow_boards)) {
                    $request = $smcFunc['db_query']('', '
//.........这里部分代码省略.........
开发者ID:thunderamur,项目名称:PortaMx-Virgo-2.0-Beta-2,代码行数:101,代码来源:boardnewsmult.php

示例14: sendNotifications

function sendNotifications($ID_TOPIC, $type)
{
    global $txt, $scripturl, $db_prefix, $language, $user_info;
    global $ID_MEMBER, $modSettings, $sourcedir;
    $notification_types = array('reply' => array('subject' => 'notification_reply_subject', 'message' => 'notification_reply'), 'sticky' => array('subject' => 'notification_sticky_subject', 'message' => 'notification_sticky'), 'lock' => array('subject' => 'notification_lock_subject', 'message' => 'notification_lock'), 'unlock' => array('subject' => 'notification_unlock_subject', 'message' => 'notification_unlock'), 'remove' => array('subject' => 'notification_remove_subject', 'message' => 'notification_remove'), 'move' => array('subject' => 'notification_move_subject', 'message' => 'notification_move'), 'merge' => array('subject' => 'notification_merge_subject', 'message' => 'notification_merge'), 'split' => array('subject' => 'notification_split_subject', 'message' => 'notification_split'));
    $current_type = $notification_types[$type];
    // Can't do it if there's no topic.
    if (empty($ID_TOPIC)) {
        return;
    } elseif (!is_numeric($ID_TOPIC)) {
        trigger_error('sendNotifications(): \'' . $ID_TOPIC . '\' is not a topic id', E_USER_NOTICE);
    }
    // Get the subject and body...
    $result = db_query("\n\t\tSELECT mf.subject, ml.body, t.ID_LAST_MSG\n\t\tFROM ({$db_prefix}topics AS t, {$db_prefix}messages AS mf, {$db_prefix}messages AS ml)\n\t\tWHERE t.ID_TOPIC = {$ID_TOPIC}\n\t\t\tAND mf.ID_MSG = t.ID_FIRST_MSG\n\t\t\tAND ml.ID_MSG = t.ID_LAST_MSG\n\t\tLIMIT 1", __FILE__, __LINE__);
    list($subject, $body, $last_id) = mysql_fetch_row($result);
    mysql_free_result($result);
    if (empty($last_id)) {
        trigger_error('sendNotifications(): non-existant topic passed', E_USER_NOTICE);
    }
    // Censor...
    censorText($subject);
    censorText($body);
    $subject = un_htmlspecialchars($subject);
    $body = trim(un_htmlspecialchars(strip_tags(strtr(parse_bbc($body, false, $last_id), array('<br />' => "\n", '</div>' => "\n", '</li>' => "\n", '&#91;' => '[', '&#93;' => ']')))));
    // Find the members with notification on for this topic.
    $members = db_query("\n\t\tSELECT\n\t\t\tmem.ID_MEMBER, mem.emailAddress, mem.notifyOnce, mem.notifyTypes, mem.notifySendBody, mem.lngfile,\n\t\t\tln.sent, mem.ID_GROUP, mem.additionalGroups, b.memberGroups, mem.ID_POST_GROUP, t.ID_MEMBER_STARTED\n\t\tFROM ({$db_prefix}log_notify AS ln, {$db_prefix}members AS mem, {$db_prefix}topics AS t, {$db_prefix}boards AS b)\n\t\tWHERE ln.ID_TOPIC = {$ID_TOPIC}\n\t\t\tAND t.ID_TOPIC = {$ID_TOPIC}\n\t\t\tAND b.ID_BOARD = t.ID_BOARD\n\t\t\tAND mem.ID_MEMBER != {$ID_MEMBER}\n\t\t\tAND mem.is_activated = 1\n\t\t\tAND mem.notifyTypes < " . ($type == 'reply' ? '4' : '3') . "\n\t\t\tAND ln.ID_MEMBER = mem.ID_MEMBER\n\t\tGROUP BY mem.ID_MEMBER\n\t\tORDER BY mem.lngfile", __FILE__, __LINE__);
    $sent = 0;
    while ($row = mysql_fetch_assoc($members)) {
        // Easier to check this here... if they aren't the topic poster do they really want to know?
        if ($type != 'reply' && $row['notifyTypes'] == 2 && $row['ID_MEMBER'] != $row['ID_MEMBER_STARTED']) {
            continue;
        }
        if ($row['ID_GROUP'] != 1) {
            $allowed = explode(',', $row['memberGroups']);
            $row['additionalGroups'] = explode(',', $row['additionalGroups']);
            $row['additionalGroups'][] = $row['ID_GROUP'];
            $row['additionalGroups'][] = $row['ID_POST_GROUP'];
            if (count(array_intersect($allowed, $row['additionalGroups'])) == 0) {
                continue;
            }
        }
        $needed_language = empty($row['lngfile']) || empty($modSettings['userLanguage']) ? $language : $row['lngfile'];
        if (empty($current_language) || $current_language != $needed_language) {
            $current_language = loadLanguage('Post', $needed_language, false);
        }
        $message = sprintf($txt[$current_type['message']], un_htmlspecialchars($user_info['name']));
        if ($type != 'remove') {
            $message .= $scripturl . '?topic=' . $ID_TOPIC . '.new;topicseen#new' . "\n\n" . $txt['notifyUnsubscribe'] . ': ' . $scripturl . '?action=notify;topic=' . $ID_TOPIC . '.0';
        }
        // Do they want the body of the message sent too?
        if (!empty($row['notifySendBody']) && $type == 'reply' && empty($modSettings['disallow_sendBody'])) {
            $message .= "\n\n" . $txt['notification_reply_body'] . "\n\n" . $body;
        }
        if (!empty($row['notifyOnce']) && $type == 'reply') {
            $message .= "\n\n" . $txt['notifyXOnce2'];
        }
        // Send only if once is off or it's on and it hasn't been sent.
        if ($type != 'reply' || empty($row['notifyOnce']) || empty($row['sent'])) {
            sendmail($row['emailAddress'], sprintf($txt[$current_type['subject']], $subject), $message . "\n\n" . $txt[130], null, 'm' . $last_id);
            $sent++;
        }
    }
    mysql_free_result($members);
    if (isset($current_language) && $current_language != $user_info['language']) {
        loadLanguage('Post');
    }
    // Sent!
    if ($type == 'reply' && !empty($sent)) {
        db_query("\n\t\t\tUPDATE {$db_prefix}log_notify\n\t\t\tSET sent = 1\n\t\t\tWHERE ID_TOPIC = {$ID_TOPIC}\n\t\t\t\tAND ID_MEMBER != {$ID_MEMBER}", __FILE__, __LINE__);
    }
}
开发者ID:VBGAMER45,项目名称:SMFMods,代码行数:71,代码来源:Subs-Post.php

示例15: SendTopic

function SendTopic()
{
    global $topic, $txt, $context, $scripturl, $sourcedir, $smcFunc, $modSettings;
    // Check permissions...
    isAllowedTo('send_topic');
    // We need at least a topic... go away if you don't have one.
    if (empty($topic)) {
        fatal_lang_error('not_a_topic', false);
    }
    // Get the topic's subject.
    $request = $smcFunc['db_query']('', '
		SELECT m.subject, t.approved
		FROM {db_prefix}topics AS t
			INNER JOIN {db_prefix}messages AS m ON (m.id_msg = t.id_first_msg)
		WHERE t.id_topic = {int:current_topic}
		LIMIT 1', array('current_topic' => $topic));
    if ($smcFunc['db_num_rows']($request) == 0) {
        fatal_lang_error('not_a_topic', false);
    }
    $row = $smcFunc['db_fetch_assoc']($request);
    $smcFunc['db_free_result']($request);
    // Can't send topic if its unapproved and using post moderation.
    if ($modSettings['postmod_active'] && !$row['approved']) {
        fatal_lang_error('not_approved_topic', false);
    }
    // Censor the subject....
    censorText($row['subject']);
    // Sending yet, or just getting prepped?
    if (empty($_POST['send'])) {
        $context['page_title'] = sprintf($txt['sendtopic_title'], $row['subject']);
        $context['start'] = $_REQUEST['start'];
        return;
    }
    // Actually send the message...
    checkSession();
    spamProtection('sendtopc');
    // This is needed for sendmail().
    require_once $sourcedir . '/Subs-Post.php';
    // Trim the names..
    $_POST['y_name'] = trim($_POST['y_name']);
    $_POST['r_name'] = trim($_POST['r_name']);
    // Make sure they aren't playing "let's use a fake email".
    if ($_POST['y_name'] == '_' || !isset($_POST['y_name']) || $_POST['y_name'] == '') {
        fatal_lang_error('no_name', false);
    }
    if (!isset($_POST['y_email']) || $_POST['y_email'] == '') {
        fatal_lang_error('no_email', false);
    }
    if (preg_match('~^[0-9A-Za-z=_+\\-/][0-9A-Za-z=_\'+\\-/\\.]*@[\\w\\-]+(\\.[\\w\\-]+)*(\\.[\\w]{2,6})$~', $_POST['y_email']) == 0) {
        fatal_lang_error('email_invalid_character', false);
    }
    // The receiver should be valid to.
    if ($_POST['r_name'] == '_' || !isset($_POST['r_name']) || $_POST['r_name'] == '') {
        fatal_lang_error('no_name', false);
    }
    if (!isset($_POST['r_email']) || $_POST['r_email'] == '') {
        fatal_lang_error('no_email', false);
    }
    if (preg_match('~^[0-9A-Za-z=_+\\-/][0-9A-Za-z=_\'+\\-/\\.]*@[\\w\\-]+(\\.[\\w\\-]+)*(\\.[\\w]{2,6})$~', $_POST['r_email']) == 0) {
        fatal_lang_error('email_invalid_character', false);
    }
    // Emails don't like entities...
    $row['subject'] = un_htmlspecialchars($row['subject']);
    $replacements = array('TOPICSUBJECT' => $row['subject'], 'SENDERNAME' => $_POST['y_name'], 'RECPNAME' => $_POST['r_name'], 'TOPICLINK' => $scripturl . '?topic=' . $topic . '.0');
    $emailtemplate = 'send_topic';
    if (!empty($_POST['comment'])) {
        $emailtemplate .= '_comment';
        $replacements['COMMENT'] = $_POST['comment'];
    }
    $emaildata = loadEmailTemplate($emailtemplate, $replacements);
    // And off we go!
    sendmail($_POST['r_email'], $emaildata['subject'], $emaildata['body'], $_POST['y_email']);
    // Back to the topic!
    redirectexit('topic=' . $topic . '.0');
}
开发者ID:valek0972,项目名称:hackits,代码行数:75,代码来源:SendTopic.php


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