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


PHP generate_text_for_storage函数代码示例

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


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

示例1: main

 public function main($id, $mode)
 {
     global $config, $user, $template, $request;
     $user->add_lang_ext('rinsrans/textbox', 'common');
     $this->tpl_name = 'acp_textbox_body';
     $this->page_title = $user->lang('ACP_TEXTBOX_TITLE');
     add_form_key('acp_textbox');
     // Form is submitted
     if ($request->is_set_post('submit')) {
         if (!check_form_key('acp_textbox')) {
             trigger_error($user->lang('FORM_INVALID') . adm_back_link($this->u_action), E_USER_WARNING);
         }
         // Set the new settings to config
         $uid = $bitfield = $options = '';
         $textbox_content = $request->variable('textbox_content', '', true);
         generate_text_for_storage($textbox_content, $uid, $bitfield, $options, true, true, true);
         $config->set('textbox_content', $textbox_content);
         $config->set('textbox_bbcode_uid', $uid);
         $config->set('textbox_bbcode_bitfield', $bitfield);
         trigger_error($user->lang('ACP_TEXTBOX_SAVED') . adm_back_link($this->u_action));
     }
     $textbox_content = generate_text_for_edit($config['textbox_content'], $config['textbox_bbcode_uid'], 3);
     // Send the curent settings to template
     $template->assign_vars(array('U_ACTION' => $this->u_action, 'TEXTBOX_CONTENT' => $textbox_content['text']));
 }
开发者ID:rinsrans,项目名称:phpBB-textbox,代码行数:25,代码来源:textbox_module.php

示例2: generate_text_for_storage

 /**
  * Generate text for storing in the database
  *
  * @param bool $allow_bbcode
  * @param bool $allow_urls
  * @param bool $allow_smilies
  */
 public function generate_text_for_storage($allow_bbcode = false, $allow_urls = false, $allow_smilies = false)
 {
     $message = $message_uid = $message_bitfield = $message_options = false;
     $this->get_message_fields($message, $message_uid, $message_bitfield, $message_options);
     generate_text_for_storage($message, $message_uid, $message_bitfield, $message_options, $allow_bbcode, $allow_urls, $allow_smilies);
     $this->set_message_fields($message, $message_uid, $message_bitfield, $message_options);
 }
开发者ID:Sajaki,项目名称:customisation-db,代码行数:14,代码来源:message_base.php

示例3: create_welcome_topic

    public function create_welcome_topic($user_id)
    {
        if (!$this->config['welcomerobot_enable']) {
            return false;
        }
        if (!function_exists('get_username_string')) {
            include $this->root_path . 'includes/functions_content.' . $this->phpEx;
        }
        if (!function_exists('submit_post')) {
            include $this->root_path . 'includes/functions_posting.' . $this->phpEx;
        }
        $sql = 'SELECT *
			FROM ' . USERS_TABLE . "\n\t\t\tWHERE user_id = " . intval($user_id) . "";
        $dbresult = $this->db->sql_query($sql);
        $row = $this->db->sql_fetchrow($dbresult);
        $this->db->sql_freeresult($dbresult);
        if (empty($row)) {
            return false;
        }
        $username = get_username_string('full', $row['user_id'], $row['username'], $row['user_colour']);
        $clean_username = utf8_clean_string($row['username']);
        $topic_title = str_replace(array('%user', '%robot', '%board'), array($clean_username, $this->config['welcomerobot_username'], $this->config['sitename']), $this->config['welcomerobot_title']);
        $topic_content = str_replace(array('%user', '%robot', '%board'), array($clean_username, $this->config['welcomerobot_username'], $this->config['sitename']), $this->config['welcomerobot_detail']);
        $poll = $uid = $bitfield = $options = '';
        // will be modified by generate_text_for_storage
        $allow_bbcode = $allow_urls = $allow_smilies = true;
        generate_text_for_storage($topic_content, $uid, $bitfield, $options, $allow_bbcode, $allow_urls, $allow_smilies);
        $data = array('forum_id' => $this->config['welcomerobot_forum'], 'topic_id' => 0, 'icon_id' => false, 'robot_name' => $this->config['welcomerobot_username'], 'enable_bbcode' => true, 'enable_smilies' => true, 'enable_urls' => true, 'enable_sig' => true, 'message' => $topic_content, 'message_md5' => md5($topic_content), 'bbcode_bitfield' => $bitfield, 'bbcode_uid' => $uid, 'post_edit_locked' => 0, 'topic_title' => $topic_title, 'notify_set' => false, 'notify' => false, 'post_time' => 0, 'forum_name' => '', 'enable_indexing' => true, 'force_approved_state' => true);
        submit_post('post', $topic_title, 'robot_name', POST_NORMAL, $poll, $data);
        return true;
    }
开发者ID:Elias64,项目名称:autoPost,代码行数:31,代码来源:listener.php

示例4: add_post

 static function add_post($id = null, $add_to_forums = [])
 {
     global $user, $phpbb_root_path, $phpEx, $phpbb_log, $wpdb;
     //we save the forums association
     update_post_meta($id, 'wpphpbbu_forums', $add_to_forums);
     $post = get_post($id);
     $current_user = wp_get_current_user();
     // Get current user info
     // If the user cannot create posts on forum then return.
     // This info is comming from WordPress administration panel
     if (!current_user_can('post_to_forum') || $post->post_status !== "publish") {
         return;
     }
     if ($post->post_status == "publish") {
         // Import functions_posting.php
         require_once $phpbb_root_path . 'includes/functions_posting.php';
         $post_content = $post->post_content;
         // Getting post content
         $post_title = $post->post_title;
         // Getting post title
         $uid = $bitfield = $options = '';
         // Set post options
         generate_text_for_storage($post_content, $uid, $bitfield, $options, true, true, true);
         // Process post content
         generate_text_for_storage($post_title, $uid, $bitfield, $options, true, true, true);
         // Process post title
         $poll = null;
         // There is no poll
         $p = get_post($id);
         $current_title = $p->post_title;
         $current_hash = md5($p->post_content);
         //
         // Loop through the allowed forums
         foreach ($add_to_forums as $forum_id) {
             $edit = get_post_meta($id, 'wpphpbbu_topic_id', true);
             $topicId = $edit ? (int) $edit : 0;
             // var_dump($topicId);
             // die();
             $data = array('forum_id' => $forum_id, 'topic_id' => $topicId, 'icon_id' => false, 'enable_bbcode' => true, 'enable_smilies' => true, 'enable_urls' => true, 'enable_sig' => true, 'message' => $post_content, 'message_md5' => md5($post_content), 'bbcode_bitfield' => $bitfield, 'bbcode_uid' => $uid, 'post_edit_locked' => 0, 'topic_title' => $post_title, 'notify_set' => false, 'notify' => false, 'post_time' => time(), 'forum_name' => '', 'enable_indexing' => true, 'force_approved_state' => true);
             if ($edit) {
                 $data['post_id'] = get_post_meta($id, 'wpphpbbu_post_id', true);
                 $data['post_subject'] = $data['topic_title'];
                 $data['post_edit_user'] = $data['poster_id'] = $user->data['user_id'];
             }
             // Submit the data here
             submit_post($edit ? 'edit' : 'post', $post_title, $user->data['username'], POST_NORMAL, $poll, $data);
             var_dump($data);
             $topic_id = $data['topic_id'];
             update_post_meta($id, 'wpphpbbu_topic_id', $topic_id);
             $topic_id = $data['post_id'];
             update_post_meta($id, 'wpphpbbu_post_id', $topic_id);
         }
         unset($p);
     }
 }
开发者ID:RARgames,项目名称:wpphpbbunicorn,代码行数:55,代码来源:Post.php

示例5: announcements

    function announcements()
    {
        global $config, $db, $user, $auth, $template;
        global $phpbb_root_path, $phpEx;
        // Set some vars
        //$action	= request_var('action', '');
        $preview = isset($_POST['preview']) ? true : false;
        $submit = isset($_POST['submit']) ? true : false;
        $announcement_row = array('announcement_forum_id' => request_var('announcement_forum_id', 0), 'announcement_topic_id' => request_var('announcement_topic_id', 0), 'announcement_post_id' => request_var('announcement_post_id', 0), 'announcement_gopost' => request_var('announcement_gopost', 0), 'announcement_first_last_post' => utf8_normalize_nfc(request_var('announcement_first_last_post', '')), 'announcement_title' => utf8_normalize_nfc(request_var('announcement_title', $user->lang['ANNOUNCEMENT_TITLE'], true)), 'announcement_text' => utf8_normalize_nfc(request_var('announcement_text', $user->lang['ANNOUNCEMENT_TEXT'], true)), 'announcement_draft' => utf8_normalize_nfc(request_var('announcement_draft', $user->lang['ANNOUNCEMENT_DRAFT'], true)), 'announcement_title_guests' => utf8_normalize_nfc(request_var('announcement_title_guests', $user->lang['ANNOUNCEMENT_TITLE_GUESTS'], true)), 'announcement_text_guests' => utf8_normalize_nfc(request_var('announcement_text_guests', $user->lang['ANNOUNCEMENT_TEXT_GUESTS'], true)));
        if ($submit || $preview) {
            if (!check_form_key('announcement_centre')) {
                trigger_error('FORM_INVALID');
            }
        }
        if ($submit) {
            $uid_text = $bitfield_text = $options_text = '';
            // will be modified by generate_text_for_storage
            $uid_text_guests = $bitfield_text_guests = $options_text_guests = '';
            // will be modified by generate_text_for_storage
            $uid_draft = $bitfield_draft = $options_draft = '';
            // will be modified by generate_text_for_storage
            $allow_bbcode = $allow_urls = $allow_smilies = true;
            generate_text_for_storage($announcement_row['announcement_text'], $uid_text, $bitfield_text, $options_text, $allow_bbcode, $allow_urls, $allow_smilies);
            generate_text_for_storage($announcement_row['announcement_text_guests'], $uid_text_guests, $bitfield_text_guests, $options_text_guests, $allow_bbcode, $allow_urls, $allow_smilies);
            generate_text_for_storage($announcement_row['announcement_draft'], $uid_draft, $bitfield_draft, $options_draft, $allow_bbcode, $allow_urls, $allow_smilies);
            $sql_ary = array('announcement_forum_id' => (int) $announcement_row['announcement_forum_id'], 'announcement_topic_id' => (int) $announcement_row['announcement_topic_id'], 'announcement_post_id' => (int) $announcement_row['announcement_post_id'], 'announcement_gopost' => (int) $announcement_row['announcement_gopost'], 'announcement_first_last_post' => (string) $announcement_row['announcement_first_last_post'], 'announcement_title' => (string) $announcement_row['announcement_title'], 'announcement_text' => (string) $announcement_row['announcement_text'], 'announcement_text_bbcode_uid' => (string) $uid_text, 'announcement_text_bbcode_bitfield' => (string) $bitfield_text, 'announcement_text_bbcode_options' => (int) $options_text, 'announcement_draft' => (string) $announcement_row['announcement_draft'], 'announcement_draft_bbcode_uid' => (string) $uid_draft, 'announcement_draft_bbcode_bitfield' => (string) $bitfield_draft, 'announcement_draft_bbcode_options' => (int) $options_draft, 'announcement_title_guests' => (string) $announcement_row['announcement_title_guests'], 'announcement_text_guests' => (string) $announcement_row['announcement_text_guests'], 'announcement_text_guests_bbcode_uid' => (string) $uid_text_guests, 'announcement_text_guests_bbcode_bitfield' => (string) $bitfield_text_guests, 'announcement_text_guests_bbcode_options' => (int) $options_text_guests);
            $sql = 'UPDATE ' . ANNOUNCEMENTS_CENTRE_TABLE . '
					SET ' . $db->sql_build_array('UPDATE', $sql_ary);
            $db->sql_query($sql);
        }
        if ($submit) {
            add_log('admin', 'LOG_ANNOUNCEMENT_UPDATED');
            trigger_error($user->lang['LOG_ANNOUNCEMENT_UPDATED'] . adm_back_link($this->u_action));
        }
        $sql = 'SELECT * 
			FROM ' . ANNOUNCEMENTS_CENTRE_TABLE;
        $result = $db->sql_query($sql);
        $announcement = $db->sql_fetchrow($result);
        $db->sql_freeresult($result);
        $announcement_preview = '';
        if ($preview) {
            $announcement_preview = preview_announcement($announcement_row['announcement_draft']);
        }
        generate_smilies('inline', '', 1);
        $announcement_draft = '';
        $announcement_draft = $announcement['announcement_draft'];
        $announcement_draft = generate_text_for_display($announcement_draft, $announcement['announcement_draft_bbcode_uid'], $announcement['announcement_draft_bbcode_bitfield'], $announcement['announcement_draft_bbcode_options']);
        decode_message($announcement['announcement_text'], $announcement['announcement_text_bbcode_uid']);
        decode_message($announcement['announcement_draft'], $announcement['announcement_draft_bbcode_uid']);
        decode_message($announcement['announcement_text_guests'], $announcement['announcement_text_guests_bbcode_uid']);
        $template->assign_vars(array('U_ACTION' => $this->u_action, 'S_ANNOUNCEMENT_CONFIGURATION' => false, 'ANNOUNCEMENT_TITLE' => $announcement['announcement_title'], 'ANNOUNCEMENT_FORUM_ID' => $announcement['announcement_forum_id'], 'ANNOUNCEMENT_TOPIC_ID' => $announcement['announcement_topic_id'], 'ANNOUNCEMENT_POST_ID' => $announcement['announcement_post_id'], 'ANNOUNCEMENT_GOPOST' => $announcement['announcement_gopost'], 'ANNOUNCEMENT_FIRST_LAST_POST' => $announcement['announcement_first_last_post'], 'ANNOUNCEMENT_TEXT' => $announcement['announcement_text'], 'ANNOUNCEMENT_DRAFT' => $announcement_preview ? $announcement_row['announcement_draft'] : $announcement['announcement_draft'], 'ANNOUNCEMENT_DRAFT_PREVIEW' => $announcement_preview ? $announcement_preview : $announcement_draft, 'ANNOUNCEMENT_TITLE_GUESTS' => $announcement['announcement_title_guests'], 'ANNOUNCEMENT_TEXT_GUESTS' => $announcement['announcement_text_guests'], 'ANNOUNCEMENT_VERSION' => $config['acmod_version']));
        // Assigning custom bbcodes
        display_custom_bbcodes();
    }
开发者ID:jverkoey,项目名称:Three20-Scope,代码行数:54,代码来源:acp_announcements_centre.php

示例6: save

 /**
  * @param int $block_id
  * @return array
  */
 public function save($block_id)
 {
     $content = $this->request->variable('content', '', true);
     $cblocks = $this->_get_custom_blocks();
     $sql_data = array('block_id' => $block_id, 'block_content' => $content, 'bbcode_bitfield' => '', 'bbcode_options' => 7, 'bbcode_uid' => '');
     generate_text_for_storage($sql_data['block_content'], $sql_data['bbcode_uid'], $sql_data['bbcode_bitfield'], $sql_data['bbcode_options'], true, true, true);
     $sql = !isset($cblocks[$block_id]) ? 'INSERT INTO ' . $this->cblocks_table . ' ' . $this->db->sql_build_array('INSERT', $sql_data) : 'UPDATE ' . $this->cblocks_table . ' SET ' . $this->db->sql_build_array('UPDATE', $sql_data) . ' WHERE block_id = ' . (int) $block_id;
     $this->db->sql_query($sql);
     $this->cache->destroy('pt_cblocks');
     return array('id' => $block_id, 'content' => $this->_get_content($sql_data), 'callback' => 'previewCustomBlock');
 }
开发者ID:BogusCurry,项目名称:phpBB-ext-sitemaker,代码行数:15,代码来源:custom.php

示例7: encode_announcement

/**
 * encode announcement text
 *
 * @param unknown_type $text
 * @return unknown
 */
function encode_announcement($text)
{
    $uid = $bitfield = $options = '';
    // will be modified by generate_text_for_storage
    $allow_bbcode = $allow_urls = $allow_smilies = true;
    generate_text_for_storage($text, $uid, $bitfield, $options, $allow_bbcode, $allow_urls, $allow_smilies);
    $announce['text'] = $text;
    $announce['uid'] = $uid;
    $announce['bitfield'] = $bitfield;
    return $announce;
}
开发者ID:ZerGabriel,项目名称:Raidplanner,代码行数:17,代码来源:index.php

示例8: user_welcome

 /** User PM welcome message */
 private function user_welcome($user_to, $user_id, $subject, $text)
 {
     $m_flags = 3;
     // 1 is bbcode, 2 is smiles, 4 is urls (add together to turn on more than one)
     $uid = $bitfield = '';
     $allow_bbcode = $allow_urls = $allow_smilies = true;
     $text = str_replace('{USERNAME}', $this->user->data['username'], $text);
     generate_text_for_storage($text, $uid, $bitfield, $m_flags, $allow_bbcode, $allow_urls, $allow_smilies);
     include_once $this->phpbb_root_path . 'includes/functions_privmsgs.' . $this->php_ext;
     $pm_data = array('address_list' => array('u' => array($user_to => 'to')), 'from_user_id' => $user_id, 'from_user_ip' => $this->user->ip, 'enable_sig' => false, 'enable_bbcode' => $allow_bbcode, 'enable_smilies' => $allow_smilies, 'enable_urls' => $allow_urls, 'icon_id' => 0, 'bbcode_bitfield' => $bitfield, 'bbcode_uid' => $uid, 'message' => utf8_normalize_nfc($text));
     submit_pm('post', utf8_normalize_nfc($subject), $pm_data, false);
 }
开发者ID:Galixte,项目名称:apwa,代码行数:13,代码来源:listener.php

示例9: test_text_formatter

 /**
  * @dataProvider get_text_formatter_tests
  */
 public function test_text_formatter($original, $expected, $allow_bbcode, $allow_urls, $allow_smilies, $allow_img_bbcode, $allow_flash_bbcode, $allow_quote_bbcode, $allow_url_bbcode, $setup = null)
 {
     $actual = $original;
     $uid = '';
     $bitfield = '';
     $flags = 0;
     if (isset($setup)) {
         $setup();
     }
     generate_text_for_storage($actual, $uid, $bitfield, $flags, $allow_bbcode, $allow_urls, $allow_smilies, $allow_img_bbcode, $allow_flash_bbcode, $allow_quote_bbcode, $allow_url_bbcode);
     $this->assertSame($expected, $actual);
 }
开发者ID:MrAdder,项目名称:phpbb,代码行数:15,代码来源:generate_text_for_storage_test.php

示例10: main

 public function main($id, $mode)
 {
     global $user, $request, $template;
     global $config, $phpbb_root_path, $phpEx, $phpbb_container;
     $user->add_lang(array('acp/board', 'posting'));
     $this->tpl_name = 'acp_contact';
     $this->page_title = 'ACP_CONTACT_SETTINGS';
     $form_name = 'acp_contact';
     add_form_key($form_name);
     $error = '';
     if (!function_exists('display_custom_bbcodes')) {
         include $phpbb_root_path . 'includes/functions_display.' . $phpEx;
     }
     if (!class_exists('parse_message')) {
         include $phpbb_root_path . 'includes/message_parser.' . $phpEx;
     }
     /* @var $config_text \phpbb\config\db_text */
     $config_text = $phpbb_container->get('config_text');
     $contact_admin_data = $config_text->get_array(array('contact_admin_info', 'contact_admin_info_uid', 'contact_admin_info_bitfield', 'contact_admin_info_flags'));
     $contact_admin_info = $contact_admin_data['contact_admin_info'];
     $contact_admin_info_uid = $contact_admin_data['contact_admin_info_uid'];
     $contact_admin_info_bitfield = $contact_admin_data['contact_admin_info_bitfield'];
     $contact_admin_info_flags = $contact_admin_data['contact_admin_info_flags'];
     if ($request->is_set_post('submit') || $request->is_set_post('preview')) {
         if (!check_form_key($form_name)) {
             $error = $user->lang('FORM_INVALID');
         }
         $contact_admin_info = $request->variable('contact_admin_info', '', true);
         generate_text_for_storage($contact_admin_info, $contact_admin_info_uid, $contact_admin_info_bitfield, $contact_admin_info_flags, !$request->variable('disable_bbcode', false), !$request->variable('disable_magic_url', false), !$request->variable('disable_smilies', false));
         if (empty($error) && $request->is_set_post('submit')) {
             $config->set('contact_admin_form_enable', $request->variable('contact_admin_form_enable', false));
             $config_text->set_array(array('contact_admin_info' => $contact_admin_info, 'contact_admin_info_uid' => $contact_admin_info_uid, 'contact_admin_info_bitfield' => $contact_admin_info_bitfield, 'contact_admin_info_flags' => $contact_admin_info_flags));
             trigger_error($user->lang['CONTACT_US_INFO_UPDATED'] . adm_back_link($this->u_action));
         }
     }
     $contact_admin_info_preview = '';
     if ($request->is_set_post('preview')) {
         $contact_admin_info_preview = generate_text_for_display($contact_admin_info, $contact_admin_info_uid, $contact_admin_info_bitfield, $contact_admin_info_flags);
     }
     $contact_admin_edit = generate_text_for_edit($contact_admin_info, $contact_admin_info_uid, $contact_admin_info_flags);
     /** @var \phpbb\controller\helper $controller_helper */
     $controller_helper = $phpbb_container->get('controller.helper');
     $template->assign_vars(array('ERRORS' => $error, 'CONTACT_ENABLED' => $config['contact_admin_form_enable'], 'CONTACT_US_INFO' => $contact_admin_edit['text'], 'CONTACT_US_INFO_PREVIEW' => $contact_admin_info_preview, 'S_BBCODE_DISABLE_CHECKED' => !$contact_admin_edit['allow_bbcode'], 'S_SMILIES_DISABLE_CHECKED' => !$contact_admin_edit['allow_smilies'], 'S_MAGIC_URL_DISABLE_CHECKED' => !$contact_admin_edit['allow_urls'], 'BBCODE_STATUS' => $user->lang('BBCODE_IS_ON', '<a href="' . $controller_helper->route('phpbb_help_bbcode_controller') . '">', '</a>'), 'SMILIES_STATUS' => $user->lang['SMILIES_ARE_ON'], 'IMG_STATUS' => $user->lang['IMAGES_ARE_ON'], 'FLASH_STATUS' => $user->lang['FLASH_IS_ON'], 'URL_STATUS' => $user->lang['URL_IS_ON'], 'S_BBCODE_ALLOWED' => true, 'S_SMILIES_ALLOWED' => true, 'S_BBCODE_IMG' => true, 'S_BBCODE_FLASH' => true, 'S_LINKS_ALLOWED' => true));
     // Assigning custom bbcodes
     display_custom_bbcodes();
 }
开发者ID:MrAdder,项目名称:phpbb,代码行数:46,代码来源:acp_contact.php

示例11: sendphpbbfp

function sendphpbbfp($raidid, $raidname, $raidtime, $raiddate, $raiddesc)
{
    include_once './forum/includes/functions_posting.php';
    // note that multibyte support is enabled here
    $my_subject = 'New Raid Posted';
    $my_text = utf8_normalize_nfc('[color=#BF00BF][size=150][b]' . $raidname . '[/b][/size][/color]
			
			[b]Date:[/b] ' . $raiddate . '
			[b]Time:[/b] ' . $raidtime . ' UTC (GMT)
			
			[b][url=http://www.crimson-alliance.com/calendar_signup.php?id=' . $raidid . ']Click here to sign up.[/url][/b]
			
			[b]Description:[/b]
			' . $raiddesc . '');
    // variables to hold the parameters for submit_post
    $poll = $uid = $bitfield = $options = '';
    generate_text_for_storage($my_subject, $uid, $bitfield, $options, false, false, false);
    generate_text_for_storage($my_text, $uid, $bitfield, $options, true, true, true);
    $data = array('forum_id' => 24, 'topic_id' => 7, 'icon_id' => false, 'enable_bbcode' => true, 'enable_smilies' => true, 'enable_urls' => true, 'enable_sig' => false, 'message' => $my_text, 'message_md5' => md5($my_text), 'bbcode_bitfield' => $bitfield, 'bbcode_uid' => $uid, 'post_edit_locked' => 0, 'topic_title' => $my_subject, 'notify_set' => false, 'notify' => false, 'post_time' => 0, 'forum_name' => 'Raid Postings', 'enable_indexing' => true, 'force_approved_state' => true);
    submit_post('reply', $my_subject, '', POST_NORMAL, $poll, $data, $update_message = true);
}
开发者ID:ahmatjan,项目名称:Crimson,代码行数:21,代码来源:admin.php

示例12: reparse_record

 /**
  * Reparse given record
  *
  * @param array $record Associative array containing the record's data
  */
 protected function reparse_record(array $record)
 {
     $record = $this->add_missing_fields($record);
     $flags = $record['enable_bbcode'] ? OPTION_FLAG_BBCODE : 0;
     $flags |= $record['enable_smilies'] ? OPTION_FLAG_SMILIES : 0;
     $flags |= $record['enable_magic_url'] ? OPTION_FLAG_LINKS : 0;
     $unparsed = array_merge($record, generate_text_for_edit($record['text'], $record['bbcode_uid'], $flags));
     // generate_text_for_edit() and decode_message() actually return the text as HTML. It has to
     // be decoded to plain text before it can be reparsed
     $text = html_entity_decode($unparsed['text'], ENT_QUOTES, 'UTF-8');
     $bitfield = $flags = null;
     generate_text_for_storage($text, $unparsed['bbcode_uid'], $bitfield, $flags, $unparsed['enable_bbcode'], $unparsed['enable_magic_url'], $unparsed['enable_smilies'], $unparsed['enable_img_bbcode'], $unparsed['enable_flash_bbcode'], $unparsed['enable_quote_bbcode'], $unparsed['enable_url_bbcode'], 'reparse');
     // Save the new text if it has changed and it's not a dry run
     if ($text !== $record['text'] && $this->save_changes) {
         $record['text'] = $text;
         $this->save_record($record);
     }
 }
开发者ID:phpbb,项目名称:phpbb-core,代码行数:23,代码来源:base.php

示例13: advanced_profile_system


//.........这里部分代码省略.........
				AND z.friend = 1
				AND u.user_id = z.zebra_id', 'GROUP_BY' => 'z.zebra_id, u.user_id, u.username_clean, u.user_colour, u.username', 'ORDER_BY' => 'u.username_clean ASC');
        $sql_friend_list = $this->db->sql_build_query('SELECT_DISTINCT', $sql_friend);
        $friend_result = $this->db->sql_query($sql_friend_list);
        while ($friend_row = $this->db->sql_fetchrow($friend_result)) {
            $img = phpbb_get_user_avatar($friend_row);
            // Use phpBB's Built in Avatar creator, for all types
            $has_avatar = false;
            if ($img == '') {
                $has_avatar = false;
                // This friend has no avatar..
            } else {
                $has_avatar = true;
                // This friend has an avatar
                $offset = 25;
                //Start off the img src
                $end = strpos($img, '"', $offset);
                // Find end of img src
                $length = $end - $offset;
                // Determine src length
                $friend_avatar = substr($img, $offset, $length);
                // Grab just the src
            }
            $this->template->assign_block_vars('friends', array('USERNAME' => get_username_string('full', $friend_row['user_id'], $friend_row['username'], $friend_row['user_colour']), 'AVATAR' => $friend_avatar, 'HAS_AVATAR' => $has_avatar));
        }
        $this->db->sql_freeresult($friend_result);
        // Master gave Dobby a sock, now Dobby is free!
        /*******
         * WALL *
         *******/
        // INSERTING A WALL POST
        add_form_key('postwall');
        $sendwall = isset($_POST['sendwall']) ? true : false;
        if ($sendwall) {
            if (check_form_key('postwall') && $this->auth->acl_get('u_wall_post')) {
                $msg_text = $this->request->variable('msg_text', '', true);
                $uid = $bitfield = $options = '';
                // will be modified by generate_text_for_storage
                $allow_bbcode = $allow_urls = $allow_smilies = true;
                generate_text_for_storage($msg_text, $uid, $bitfield, $options, $allow_bbcode, $allow_urls, $allow_smilies);
                $msg_time = time();
                $wall_ary = array('user_id' => $user_id, 'poster_id' => $this->user->data['user_id'], 'msg' => $msg_text, 'msg_time' => (int) $msg_time, 'bbcode_uid' => $uid, 'bbcode_bitfield' => $bitfield, 'bbcode_options' => $options);
                $insertwall = 'INSERT INTO ' . $this->wall_table . ' ' . $this->db->sql_build_array('INSERT', $wall_ary);
                $this->db->sql_query($insertwall);
                if ($user_id != $this->user->data['user_id']) {
                    $msg_id = (int) $this->db->sql_nextid();
                    $poster_name = get_username_string('no_profile', $this->user->data['user_id'], $this->user->data['username'], $this->user->data['user_colour']);
                    $notification_msg = $msg_text;
                    strip_bbcode($notification_msg, $uid);
                    $wall_notification_data = array('msg_id' => $msg_id, 'user_id' => $user_id, 'poster_name' => $poster_name, 'notification_msg' => strlen($notification_msg) > 30 ? substr($notification_msg, 0, 30) . '...' : $notification_msg);
                    $phpbb_notifications = $this->container->get('notification_manager');
                    $phpbb_notifications->add_notifications('posey.aps.notification.type.wall', $wall_notification_data);
                }
            } else {
                trigger_error($this->user->lang['FORM_INVALID']);
            }
        }
        // DISPLAYING WALL POSTS
        $getwall_ary = array('SELECT' => 'w.*, u.username, u.user_colour, u.user_avatar, u.user_avatar_type, u.user_avatar_width, u.user_avatar_height', 'FROM' => array($this->wall_table => 'w'), 'LEFT_JOIN' => array(array('FROM' => array(USERS_TABLE => 'u'), 'ON' => 'u.user_id = w.poster_id')), 'WHERE' => 'w.user_id = ' . $user_id, 'ORDER_BY' => 'w.msg_id DESC');
        $getwall = $this->db->sql_build_query('SELECT_DISTINCT', $getwall_ary);
        $wallresult = $this->db->sql_query_limit($getwall, 10);
        // Only get latest 10 wall posts
        while ($wall = $this->db->sql_fetchrow($wallresult)) {
            $wall_msg = generate_text_for_display($wall['msg'], $wall['bbcode_uid'], $wall['bbcode_bitfield'], $wall['bbcode_options']);
            // Parse wall message text
            $msg_id = $wall['msg_id'];
            $msg_time = $this->user->format_date($wall['msg_time']);
            $this->template->assign_block_vars('wall', array('MSG' => $wall_msg, 'ID' => $wall['msg_id'], 'MSG_TIME' => $msg_time, 'POSTER' => get_username_string('full', $wall['poster_id'], $wall['username'], $wall['user_colour']), 'POSTER_AVATAR' => phpbb_get_user_avatar($wall), 'S_HIDDEN_FIELDS' => build_hidden_fields(array('deletewallid' => $wall['msg_id']))));
        }
        $this->db->sql_freeresult($wallresult);
        // Master gave Dobby a sock, now Dobby is free!
        // DELETE WALL POST
        $deletewall = isset($_POST['deletewall']) ? true : false;
        if ($deletewall) {
            if (confirm_box(true)) {
                $deletewallid = request_var('deletewallid', 0);
                $delete_msg = 'DELETE FROM ' . $this->wall_table . '
								WHERE msg_id = ' . $deletewallid;
                $this->db->sql_query($delete_msg);
                $msg_deleted_redirect = append_sid("{$this->phpbb_root_path}memberlist.{$this->phpEx}", "mode=viewprofile&amp;u=" . $user_id . "#wall");
                $message = $this->user->lang['CONFIRM_WALL_DEL'] . '<br /><br />' . sprintf($this->user->lang['RETURN_WALL'], '<a href="' . $msg_deleted_redirect . '">', $username, '</a>');
                meta_refresh(3, $msg_deleted_redirect);
                trigger_error($message);
            } else {
                $s_hidden_fields = build_hidden_fields(array('deletewall' => true, 'deletewallid' => request_var('deletewallid', 0)));
                confirm_box(false, $this->user->lang['CONFIRM_WALL_DEL_EXPLAIN'], $s_hidden_fields);
            }
        }
        /***********************
         * Let's set some links *
         ***********************/
        $post_wall_action = append_sid("{$this->phpbb_root_path}memberlist.{$this->phpEx}", "mode=viewprofile&amp;u=" . $user_id);
        // Needed for wall form
        $total_topics_url = append_sid("{$this->phpbb_root_path}search.{$this->phpEx}", 'author_id=' . $user_id . '&amp;sr=topics');
        // Link to search URL for user's topics
        /****************************
         * ASSIGN TEMPLATE VARIABLES *
         ****************************/
        $this->template->assign_vars(array('TOTAL_TOPICS' => $total_topics, 'PROFILE_VIEWS' => $member['user_profile_views'], 'NO_WALL_POSTS' => sprintf($this->user->lang['FIRST_POST_WALL'], '<strong>' . $username . '</strong>'), 'USER_NO_POSTS' => sprintf($this->user->lang['USER_NO_POSTS'], '<strong>' . $username . '</strong>'), 'COVERPHOTO' => $member['user_coverphoto'], 'CP_PANEL_ID' => $this->config['cp_panel_id'] ? $this->config['cp_panel_id'] : 1, 'FL_ENABLED' => $this->config['fl_enabled'] ? true : false, 'CP_ENABLED' => $this->config['cp_enabled'] ? true : false, 'AF_ENABLED' => $this->config['af_enabled'] ? true : false, 'U_SEARCH_USER_TOPICS' => $total_topics_url, 'S_POST_WALL' => $post_wall_action, 'S_CAN_POST_WALL' => $this->auth->acl_get('u_wall_post') ? true : false, 'S_CAN_READ_WALL' => $this->auth->acl_get('u_wall_read') ? true : false, 'S_CAN_DEL_WALL' => $this->auth->acl_get('u_wall_del') ? true : false, 'S_MOD_DEL_WALL' => $this->auth->acl_get('m_wall_del') ? true : false));
    }
开发者ID:rampmaster,项目名称:APS,代码行数:101,代码来源:main_listener.php

示例14: posts_merging

 public function posts_merging($event)
 {
     $mode = $event['mode'];
     $subject = $event['subject'];
     $username = $event['username'];
     $topic_type = $event['topic_type'];
     $poll = $event['poll'];
     $data = $event['data'];
     $update_message = $event['update_message'];
     $update_search_index = $event['update_search_index'];
     $current_time = time();
     $do_not_merge_with_previous = $this->request->variable('posts_merging_option', false);
     if (!$do_not_merge_with_previous && !$this->helper->post_needs_approval($data) && in_array($mode, array('reply', 'quote')) && $this->merge_interval && !$this->helper->excluded_from_merge($data)) {
         $merge_post_data = $this->helper->get_last_post_data($data);
         // Do not merge if there's no last post data, the post is locked or allowed merge period has left
         if (!$merge_post_data || $merge_post_data['post_edit_locked'] || $current_time - (int) $merge_post_data['topic_last_post_time'] > $this->merge_interval || !$this->user->data['is_registered']) {
             return;
         }
         // Also, don't let user to violate attachments limit by posts merging
         // In this case, also don't merge posts and return
         // Exceptions are administrators and forum moderators
         $num_old_attachments = $this->helper->count_post_attachments((int) $merge_post_data['post_id']);
         $num_new_attachments = sizeof($data['attachment_data']);
         $total_attachments_count = $num_old_attachments + $num_new_attachments;
         if ($total_attachments_count > $this->config['max_attachments'] && !$this->auth->acl_get('a_') && !$this->auth->acl_get('m_', (int) $data['forum_id'])) {
             return;
         }
         $data['post_id'] = (int) $merge_post_data['post_id'];
         $merge_post_data['post_attachment'] = $total_attachments_count ? 1 : 0;
         // Decode old message and addon
         $merge_post_data['post_text'] = $this->helper->prepare_text_for_merge($merge_post_data);
         $data['message'] = $this->helper->prepare_text_for_merge($data);
         // Handle inline attachments BBCode in old message
         if ($num_new_attachments) {
             $merge_post_data['post_text'] = preg_replace('#\\[attachment=([0-9]+)\\](.*?)\\[\\/attachment\\]#e', "'[attachment='.(\\1 + {$num_new_attachments}).']\\2[/attachment]'", $merge_post_data['post_text']);
         }
         // Prepare message separator
         $this->user->add_lang_ext('rxu/PostsMerging', 'posts_merging');
         $interval = $this->helper->get_time_interval($current_time, $merge_post_data['post_time']);
         $time = array();
         $time[] = $interval->h ? $this->user->lang('D_HOURS', $interval->h) : null;
         $time[] = $interval->i ? $this->user->lang('D_MINUTES', $interval->i) : null;
         $time[] = $interval->s ? $this->user->lang('D_SECONDS', $interval->s) : null;
         $separator = $this->user->lang('MERGE_SEPARATOR', implode(' ', $time));
         // Merge subject
         if (!empty($subject) && $subject != $merge_post_data['post_subject'] && $merge_post_data['post_id'] != $merge_post_data['topic_first_post_id']) {
             $separator .= sprintf($this->user->lang['MERGE_SUBJECT'], $subject);
         }
         // Merge posts
         $merge_post_data['post_text'] = $merge_post_data['post_text'] . $separator . $data['message'];
         // Make sure the message is safe
         $this->type_cast_helper->recursive_set_var($merge_post_data['post_text'], '', true);
         //Prepare post for submit
         $options = '';
         $warn_msg = generate_text_for_storage($merge_post_data['post_text'], $merge_post_data['bbcode_uid'], $merge_post_data['bbcode_bitfield'], $options, $merge_post_data['enable_bbcode'], $merge_post_data['enable_magic_url'], $merge_post_data['enable_smilies']);
         // If $warn_msg is not empty, the merged message does not conform some restrictions
         // In this case we simply don't merge and return back to the function submit_post()
         if (!empty($warn_msg)) {
             return;
         }
         // Update post time and submit post to database
         $merge_post_data['post_time'] = $data['post_time'] = $current_time;
         $this->helper->submit_post_to_database($merge_post_data);
         // Submit attachments
         $this->helper->submit_attachments($data);
         // Update read tracking
         $this->helper->update_read_tracking($data);
         // If a username was supplied or the poster is a guest, we will use the supplied username.
         // Doing it this way we can use "...post by guest-username..." in notifications when
         // "guest-username" is supplied or ommit the username if it is not.
         $username = $username !== '' || !$this->user->data['is_registered'] ? $username : $this->user->data['username'];
         // Send Notifications
         // Despite the post_id is the same and users who've been already notified
         // won't be notified again about the same post_id, we send notifications
         // for new users possibly subscribed to it
         $notification_data = array_merge($data, array('topic_title' => isset($data['topic_title']) ? $data['topic_title'] : $subject, 'post_username' => $username, 'poster_id' => (int) $data['poster_id'], 'post_text' => $data['message'], 'post_time' => $merge_post_data['post_time'], 'post_subject' => $subject));
         $this->notification_manager->add_notifications(array('notification.type.quote', 'notification.type.bookmark', 'notification.type.post'), $notification_data);
         // Update search index
         $this->helper->update_search_index($merge_post_data);
         //Generate redirection URL and redirecting
         $params = $add_anchor = '';
         $params .= '&amp;t=' . $data['topic_id'];
         $params .= '&amp;p=' . $data['post_id'];
         $add_anchor = '#p' . $data['post_id'];
         $url = "{$this->phpbb_root_path}viewtopic.{$this->php_ext}";
         $url = append_sid($url, 'f=' . $data['forum_id'] . $params) . $add_anchor;
         /**
          * Modify the data for post submitting
          *
          * @event rxu.postsmerging.posts_merging_end
          * @var	string	mode				Variable containing posting mode value
          * @var	string	subject				Variable containing post subject value
          * @var	string	username			Variable containing post author name
          * @var	int		topic_type			Variable containing topic type value
          * @var	array	poll				Array with the poll data for the post
          * @var	array	data				Array with the data for the post
          * @var	bool	update_message		Flag indicating if the post will be updated
          * @var	bool	update_search_index	Flag indicating if the search index will be updated
          * @var	string	url					The "Return to topic" URL
          * @since 2.0.0
//.........这里部分代码省略.........
开发者ID:phpbb-store,项目名称:OfficeForum,代码行数:101,代码来源:listener.php

示例15: file_exists

            }
            if ($points_config['robbery_sendpm'] && $user_info['user_allow_pm'] == 1 && $user_robbery_pm) {
                // Select the receiver language
                $user_row['user_lang'] = file_exists($phpbb_root_path . 'language/' . $user_row['user_lang'] . "/mods/points.{$phpEx}") ? $user_row['user_lang'] : $config['default_lang'];
                // load receivers language
                include $phpbb_root_path . 'language/' . basename($user_row['user_lang']) . "/mods/points.{$phpEx}";
                // Send PM
                $pm_subject = utf8_normalize_nfc($lang['ROBBERY_PM_BAD_SUBJECT']);
                if ($robbery_pm_info == 1) {
                    $pm_text = utf8_normalize_nfc(sprintf($lang['ROBBERY_PM_BAD_BODY_1'], $user_namepoints, $attacked_amount, $config['points_name'], sprintf(number_format_points($lose))));
                } else {
                    $pm_text = utf8_normalize_nfc(sprintf($lang['ROBBERY_PM_BAD_BODY'], $user_namepoints, $attacked_amount, $config['points_name']));
                }
                $poll = $uid = $bitfield = $options = '';
                generate_text_for_storage($pm_subject, $uid, $bitfield, $options, false, false, false);
                generate_text_for_storage($pm_text, $uid, $bitfield, $options, true, true, true);
                $pm_data = array('address_list' => array('u' => array($user_id => 'to')), 'from_user_id' => $user->data['user_id'], 'from_username' => $user->lang['ROBBERY_PM_SENDER'], 'icon_id' => 0, 'from_user_ip' => '', 'enable_bbcode' => true, 'enable_smilies' => true, 'enable_urls' => true, 'enable_sig' => true, 'message' => $pm_text, 'bbcode_bitfield' => $bitfield, 'bbcode_uid' => $uid);
                submit_pm('post', $pm_subject, $pm_data, false);
            }
            $message = $user->lang['ROBBERY_BAD'] . '<br /><br />' . $robbery_usage_info . '<br /><br /><a href="' . append_sid("{$phpbb_root_path}points.{$phpEx}", "mode=robbery") . '">&laquo; ' . $user->lang['BACK_TO_PREV'] . '</a>';
            trigger_error($message);
        }
    }
    $template->assign_vars(array('USER_NAME' => get_username_string('full', $checked_user['user_id'], $points_config['username'], $points_config['user_colour']), 'U_ACTION' => $this->u_action, 'S_HIDDEN_FIELDS' => $hidden_fields));
}
// If Robbery PN is enabled, show option to disable for the users
if ($points_config['robbery_sendpm']) {
    if (isset($_POST['robbery_pm'])) {
        if (!check_form_key('robbery_attack')) {
            trigger_error('FORM_INVALID');
        }
开发者ID:FifoF,项目名称:phpbb3.1_ultimate_points,代码行数:31,代码来源:points_robbery.php


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