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


PHP decode_message函数代码示例

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


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

示例1: get_quote_pm_func

function get_quote_pm_func($xmlrpc_params)
{
    global $db, $auth, $user;
    $user->setup('ucp');
    $params = php_xmlrpc_decode($xmlrpc_params);
    // get msg id from parameters
    $msg_id = intval($params[0]);
    if (!$msg_id) {
        trigger_error('NO_MESSAGE');
    }
    if (!$auth->acl_get('u_sendpm')) {
        trigger_error('NO_AUTH_SEND_MESSAGE');
    }
    $sql = 'SELECT p.*, u.username as quote_username
            FROM ' . PRIVMSGS_TABLE . ' p, ' . USERS_TABLE . ' u
            WHERE p.author_id = u.user_id
            AND p.msg_id = ' . $msg_id;
    $result = $db->sql_query($sql);
    $post = $db->sql_fetchrow($result);
    $db->sql_freeresult($result);
    $msg_id = (int) $post['msg_id'];
    if (!$post) {
        trigger_error('NO_MESSAGE');
    }
    if ((!$post['author_id'] || $post['author_id'] == ANONYMOUS && $action != 'delete') && $msg_id) {
        trigger_error('NO_AUTHOR');
    }
    $message_subject = (!preg_match('/^Re:/', $post['message_subject']) ? 'Re: ' : '') . censor_text($post['message_subject']);
    decode_message($post['message_text'], $post['bbcode_uid']);
    $message = '[quote="' . $post['quote_username'] . '"]' . censor_text(trim($post['message_text'])) . "[/quote]\n";
    return new xmlrpcresp(new xmlrpcval(array('msg_id' => new xmlrpcval($msg_id), 'msg_subject' => new xmlrpcval(html_entity_decode(strip_tags($message_subject)), 'base64'), 'text_body' => new xmlrpcval(html_entity_decode($message), 'base64')), 'struct'));
}
开发者ID:autonomous1,项目名称:tapatalk-phpbb3,代码行数:32,代码来源:get_quote_pm.php

示例2: test_text_formatter

 /**
  * @dataProvider get_text_formatter_tests
  */
 public function test_text_formatter($original, $expected)
 {
     $this->get_test_case_helpers()->set_s9e_services();
     $actual = $original;
     decode_message($actual);
     $this->assertSame($expected, $actual);
 }
开发者ID:MrAdder,项目名称:phpbb,代码行数:10,代码来源:decode_message_test.php

示例3: reply_to

 /**
  * initializes and returns a new privmsg object as reply to the message with msg_id $msg_id
  * @param int $msg_id
  * @param boolean $quote
  * @return \Gn36\OoPostingApi\privmsg
  **/
 static function reply_to($msg_id, $quote = true)
 {
     global $db;
     $sql = "SELECT p.msg_id, p.root_level, p.author_id, p.message_subject, p.message_text, p.bbcode_uid, p.to_address, p.bcc_address, u.username\n\t\t\t\tFROM " . PRIVMSGS_TABLE . " p\n\t\t\t\tLEFT JOIN " . USERS_TABLE . " u ON (p.author_id = u.user_id)\n\t\t\t\tWHERE msg_id = " . intval($msg_id);
     $result = $db->sql_query($sql);
     $row = $db->sql_fetchrow($result);
     if (!$row) {
         trigger_error('NO_PRIVMSG', E_USER_ERROR);
     }
     $privmsg = new privmsg();
     $privmsg->reply_from_msg_id = $row['msg_id'];
     $privmsg->root_level = $row['root_level'] ? $row['root_level'] : $row['msg_id'];
     $privmsg->message_subject = (!preg_match('/^Re:/', $row['message_subject']) ? 'Re: ' : '') . censor_text($row['message_subject']);
     if ($quote) {
         decode_message($row['message_text'], $row['bbcode_uid']);
         //for some reason we need " here instead of "
         $privmsg->message_text = '[quote="' . $row['username'] . '"]' . censor_text(trim($row['message_text'])) . "[/quote]\n";
     }
     //add original sender as recipient
     $privmsg->to($row['author_id']);
     //if message had only a single recipient, use that as sender
     if ($row['to_address'] == '' || $row['bcc_address'] == '') {
         $to = $row['to_address'] != '' ? $row['to_address'] : $row['bcc_address'];
         if (preg_match('#^u_(\\d+)$#', $to, $m)) {
             $privmsg->author_id = $m[1];
         }
     }
     return $privmsg;
 }
开发者ID:gn36,项目名称:phpbb-oo-posting-api,代码行数:35,代码来源:privmsg.php

示例4: titania_decode_message

/**
* Decode a message from the database (properly)
*
* @param string $message
* @param mixed $bbcode_uid
*/
function titania_decode_message(&$message, $bbcode_uid = '')
{
    decode_message($message, $bbcode_uid);
    // We have to do all sorts of crap because decode_message doesn't properly decode a message for reinserting into the database
    // Replace   with spaces - otherwise a number of issues happen...
    $message = str_replace(' ', ' ', $message);
    // Decode HTML entities, else bbcode reparsing will fail
    $message = html_entity_decode($message);
    // With magic_quotes_gpc on slashes are stripped too many times, so add them
    $message = STRIP ? addslashes($message) : $message;
    // Run set_var to re-encode the proper entities as if the user had submitted it themselves
    set_var($message, $message, 'string', true);
}
开发者ID:kairion,项目名称:customisation-db,代码行数:19,代码来源:functions.php

示例5: viewtopic_modify_post_row

 /**
  * Add decoded message text if full quotes are enabled.
  *
  * @param object $event The event object
  * @return null
  * @access public
  */
 public function viewtopic_modify_post_row($event)
 {
     $topic_data = $event['topic_data'];
     if ($this->config['qr_full_quote'] && $this->auth->acl_get('f_reply', $topic_data['forum_id'])) {
         $row = $event['row'];
         $post_row = $event['post_row'];
         $decoded_message = censor_text($row['post_text']);
         decode_message($decoded_message, $row['bbcode_uid']);
         $decoded_message = bbcode_nl2br($decoded_message);
         $post_row = array_merge($post_row, array('DECODED_MESSAGE' => $decoded_message));
         $event['post_row'] = $post_row;
     }
 }
开发者ID:edipdincer,项目名称:QuickReply,代码行数:20,代码来源:listener.php

示例6: blog_acp_profile

/**
* Perform actions on a user's profile from the acp_users file
*/
function blog_acp_profile($user_id, $submit)
{
    global $db, $phpbb_root_path, $phpEx, $template, $user;
    $user->add_lang(array('mods/blog/common', 'mods/blog/ucp'));
    include "{$phpbb_root_path}blog/includes/functions.{$phpEx}";
    include "{$phpbb_root_path}blog/includes/constants.{$phpEx}";
    include $phpbb_root_path . 'blog/plugins/plugins.' . $phpEx;
    new blog_plugins();
    if ($submit) {
        $blog_description = utf8_normalize_nfc(request_var('blog_description', '', true));
        $blog_description_uid = $blog_description_bitfield = $blog_description_options = '';
        generate_text_for_storage($blog_description, $blog_description_uid, $blog_description_bitfield, $blog_description_options, true, true, true);
        $blog_data = array('title' => utf8_normalize_nfc(request_var('blog_title', '', true)), 'description' => $blog_description, 'description_bbcode_bitfield' => $blog_description_bitfield, 'description_bbcode_uid' => $blog_description_uid, 'blog_style' => request_var('blog_style', ''), 'blog_css' => request_var('blog_css', ''));
        update_user_blog_settings($user_id, $blog_data);
    } else {
        global $user_settings;
        get_user_settings($user_id);
        $available_styles = array(array('name' => $user->lang['NONE'], 'value' => 0, 'demo' => $phpbb_root_path . 'images/spacer.gif'));
        $sql = 'SELECT * FROM ' . STYLES_TABLE . ' s, ' . STYLES_TEMPLATE_TABLE . ' st WHERE style_active = 1 AND s.template_id = st.template_id';
        $result = $db->sql_query($sql);
        while ($row = $db->sql_fetchrow($result)) {
            $demo = $phpbb_root_path . 'images/spacer.gif';
            if (@file_exists($phpbb_root_path . 'styles/' . $row['template_path'] . '/template/blog/demo.png')) {
                $demo = $phpbb_root_path . 'styles/' . $row['template_path'] . '/template/blog/demo.png';
            } else {
                if (@file_exists($phpbb_root_path . 'styles/' . $row['template_path'] . '/template/blog/demo.gif')) {
                    $demo = $phpbb_root_path . 'styles/' . $row['template_path'] . '/template/blog/demo.gif';
                } else {
                    if (@file_exists($phpbb_root_path . 'styles/' . $row['template_path'] . '/template/blog/demo.jpg')) {
                        $demo = $phpbb_root_path . 'styles/' . $row['template_path'] . '/template/blog/demo.jpg';
                    }
                }
            }
            $available_styles[] = array('name' => $row['style_name'], 'value' => $row['style_id'], 'demo' => $demo);
        }
        $db->sql_freeresult($result);
        $dh = @opendir($phpbb_root_path . 'blog/styles/');
        if ($dh) {
            while (($file = readdir($dh)) !== false) {
                if (file_exists($phpbb_root_path . 'blog/styles/' . $file . '/style.' . $phpEx)) {
                    // Inside of the style.php file, add to the $available_styles array
                    include $phpbb_root_path . 'blog/styles/' . $file . '/style.' . $phpEx;
                }
            }
            closedir($dh);
        }
        foreach ($available_styles as $row) {
            if (isset($user_settings[$user_id]) && $user_settings[$user_id]['blog_style'] == $row['value'] && isset($row['demo']) && $row['demo']) {
                $default_demo = $row['demo'];
            }
            $template->assign_block_vars('blog_styles', array('VALUE' => $row['value'], 'SELECTED' => isset($user_settings[$user_id]) && $user_settings[$user_id]['blog_style'] == $row['value'] ? true : false, 'NAME' => $row['name'], 'BLOG_CSS' => isset($row['blog_css']) && $row['blog_css'] ? true : false, 'DEMO' => isset($row['demo']) && $row['demo'] ? $row['demo'] : ''));
        }
        if (isset($user_settings[$user_id])) {
            decode_message($user_settings[$user_id]['description'], $user_settings[$user_id]['description_bbcode_uid']);
            $template->assign_vars(array('BLOG_TITLE' => $user_settings[$user_id]['title'], 'BLOG_DESCRIPTION' => $user_settings[$user_id]['description'], 'DEFAULT_DEMO' => isset($default_demo) ? $default_demo : $phpbb_root_path . 'images/spacer.gif', 'BLOG_CSS' => $user_settings[$user_id]['blog_css']));
        }
        blog_plugins::plugin_do_arg('function_blog_acp_profile', compact('blog_data', 'user_id'));
    }
}
开发者ID:EXreaction,项目名称:User-Blog-Mod,代码行数:62,代码来源:functions_admin.php

示例7: main


//.........这里部分代码省略.........
                     if ($dh) {
                         while (($file = readdir($dh)) !== false) {
                             if (file_exists($phpbb_root_path . 'blog/styles/' . $file . '/style.' . $phpEx)) {
                                 // Inside of the style.php file, add to the $available_styles array
                                 include $phpbb_root_path . 'blog/styles/' . $file . '/style.' . $phpEx;
                             }
                         }
                         closedir($dh);
                     }
                     foreach ($available_styles as $row) {
                         if (isset($user_settings[$user->data['user_id']]) && $user_settings[$user->data['user_id']]['blog_style'] == $row['value'] && isset($row['demo']) && $row['demo']) {
                             $default_demo = $row['demo'];
                         }
                         $template->assign_block_vars('blog_styles', array('VALUE' => $row['value'], 'SELECTED' => isset($user_settings[$user->data['user_id']]) && $user_settings[$user->data['user_id']]['blog_style'] == $row['value'] ? true : false, 'NAME' => $row['name'], 'BLOG_CSS' => isset($row['blog_css']) && $row['blog_css'] ? true : false, 'DEMO' => isset($row['demo']) && $row['demo'] ? $row['demo'] : ''));
                     }
                 }
                 $template->assign_vars(array('S_BLOG_INSTANT_REDIRECT' => isset($user_settings[$user->data['user_id']]) ? $user_settings[$user->data['user_id']]['instant_redirect'] : 0, 'S_SUBSCRIPTIONS' => $config['user_blog_subscription_enabled'] ? true : false, 'S_BLOG_STYLE' => isset($available_styles) && sizeof($available_styles) > 1 ? true : false, 'S_BLOG_CSS' => $auth->acl_get('u_blog_css') ? true : false, 'DEFAULT_DEMO' => isset($default_demo) ? $default_demo : $phpbb_root_path . 'images/spacer.gif', 'BLOG_CSS' => isset($user_settings[$user->data['user_id']]) ? $user_settings[$user->data['user_id']]['blog_css'] : ''));
             }
             break;
         case 'ucp_blog_permissions':
             if (!$config['user_blog_user_permissions']) {
                 $error[] = $user->lang['USER_PERMISSIONS_DISABLED'];
                 $template->assign_vars(array('PERMISSIONS_DISABLED' => true));
             } else {
                 if ($submit) {
                     $sql_ary = array('perm_guest' => request_var('perm_guest', 1), 'perm_registered' => request_var('perm_registered', 2), 'perm_foe' => request_var('perm_foe', 0), 'perm_friend' => request_var('perm_friend', 2));
                     update_user_blog_settings($user->data['user_id'], $sql_ary, isset($_POST['resync']) ? true : false);
                 } else {
                     permission_settings_builder();
                 }
             }
             break;
         case 'ucp_blog_title_description':
             include $phpbb_root_path . 'includes/functions_posting.' . $phpEx;
             include $phpbb_root_path . 'includes/message_parser.' . $phpEx;
             include $phpbb_root_path . 'blog/includes/functions_posting.' . $phpEx;
             if (!function_exists('display_custom_bbcodes')) {
                 include $phpbb_root_path . 'includes/functions_display.' . $phpEx;
             }
             $user->add_lang('posting');
             $post_options = new post_options();
             $post_options->set_status(true, true, true);
             $post_options->set_in_template();
             if ($submit || $preview) {
                 // see if they tried submitting a message or suject(if they hit preview or submit) put it in an array for consistency with the edit mode
                 $blog_title = utf8_normalize_nfc(request_var('title', '', true));
                 $blog_description = utf8_normalize_nfc(request_var('message', '', true));
                 // set up the message parser to parse BBCode, Smilies, etc
                 $message_parser = new parse_message();
                 $message_parser->message = $blog_description;
                 $message_parser->parse($post_options->enable_bbcode, $post_options->enable_magic_url, $post_options->enable_smilies, $post_options->img_status, $post_options->flash_status, $post_options->bbcode_status, $post_options->url_status);
             } else {
                 if (isset($user_settings[$user->data['user_id']])) {
                     $blog_title = $user_settings[$user->data['user_id']]['title'];
                     $blog_description = $user_settings[$user->data['user_id']]['description'];
                     decode_message($blog_description, $user_settings[$user->data['user_id']]['description_bbcode_uid']);
                 } else {
                     $blog_title = $blog_description = '';
                 }
             }
             if (!$submit || sizeof($error)) {
                 if ($preview && !sizeof($error)) {
                     $preview_message = $message_parser->format_display($post_options->enable_bbcode, $post_options->enable_magic_url, $post_options->enable_smilies, false);
                     // output some data to the template parser
                     $template->assign_vars(array('S_DISPLAY_PREVIEW' => true, 'PREVIEW_SUBJECT' => censor_text($blog_title), 'PREVIEW_MESSAGE' => $preview_message, 'POST_DATE' => $user->format_date(time())));
                 }
                 // Generate smiley listing
                 generate_smilies('inline', false);
                 // Build custom bbcodes array
                 display_custom_bbcodes();
                 $template->assign_vars(array('S_PREVIEW_BUTTON' => true, 'TITLE' => $blog_title, 'MESSAGE' => $blog_description));
             } else {
                 if ($submit) {
                     $sql_ary = array('user_id' => $user->data['user_id'], 'title' => $blog_title, 'description' => $message_parser->message, 'description_bbcode_bitfield' => $message_parser->bbcode_bitfield, 'description_bbcode_uid' => $message_parser->bbcode_uid);
                     unset($message_parser);
                     update_user_blog_settings($user->data['user_id'], $sql_ary);
                 }
             }
             break;
         default:
             $default = true;
             $temp = compact('mode', 'error', 'default');
             blog_plugins::plugin_do_ref('ucp_default', $temp);
             // make sure you set default to false if you use your own page
             extract($temp);
             if ($default) {
                 trigger_error('NO_MODE');
             }
     }
     blog_plugins::plugin_do('ucp_end');
     if ($submit && !sizeof($error)) {
         //$cache->destroy('_blog_settings_' . $user->data['user_id']);
         meta_refresh(3, $this->u_action);
         $message = $user->lang['PREFERENCES_UPDATED'] . '<br /><br />' . sprintf($user->lang['RETURN_UCP'], '<a href="' . $this->u_action . '">', '</a>');
         trigger_error($message);
     }
     $template->assign_vars(array('L_TITLE' => $user->lang[strtoupper($mode)], 'L_TITLE_EXPLAIN' => $user->lang[strtoupper($mode) . '_EXPLAIN'], 'ERROR' => sizeof($error) ? implode($error, '<br />') : false, 'MODE' => $mode, 'S_UCP_ACTION' => $this->u_action));
     $this->tpl_name = 'blog/ucp_blog';
     $this->page_title = strtoupper($mode);
 }
开发者ID:EXreaction,项目名称:User-Blog-Mod,代码行数:101,代码来源:ucp_blog.php

示例8: message_history

/**
* Display Message History
*/
function message_history($msg_id, $user_id, $message_row, $folder, $in_post_mode = false)
{
    global $db, $user, $config, $template, $phpbb_root_path, $phpEx, $auth;
    // Select all receipts and the author from the pm we currently view, to only display their pm-history
    $sql = 'SELECT author_id, user_id
		FROM ' . PRIVMSGS_TO_TABLE . "\n\t\tWHERE msg_id = {$msg_id}\n\t\t\tAND folder_id <> " . PRIVMSGS_HOLD_BOX;
    $result = $db->sql_query($sql);
    $recipients = array();
    while ($row = $db->sql_fetchrow($result)) {
        $recipients[] = (int) $row['user_id'];
        $recipients[] = (int) $row['author_id'];
    }
    $db->sql_freeresult($result);
    $recipients = array_unique($recipients);
    // Get History Messages (could be newer)
    $sql = 'SELECT t.*, p.*, u.*
		FROM ' . PRIVMSGS_TABLE . ' p, ' . PRIVMSGS_TO_TABLE . ' t, ' . USERS_TABLE . ' u
		WHERE t.msg_id = p.msg_id
			AND p.author_id = u.user_id
			AND t.folder_id NOT IN (' . PRIVMSGS_NO_BOX . ', ' . PRIVMSGS_HOLD_BOX . ')
			AND ' . $db->sql_in_set('t.author_id', $recipients, false, true) . "\n\t\t\tAND t.user_id = {$user_id}";
    // We no longer need those.
    unset($recipients);
    if (!$message_row['root_level']) {
        $sql .= " AND (p.root_level = {$msg_id} OR (p.root_level = 0 AND p.msg_id = {$msg_id}))";
    } else {
        $sql .= " AND (p.root_level = " . $message_row['root_level'] . ' OR p.msg_id = ' . $message_row['root_level'] . ')';
    }
    $sql .= ' ORDER BY p.message_time DESC';
    $result = $db->sql_query($sql);
    $row = $db->sql_fetchrow($result);
    if (!$row) {
        $db->sql_freeresult($result);
        return false;
    }
    $title = $row['message_subject'];
    $rowset = array();
    $folder_url = append_sid("{$phpbb_root_path}ucp.{$phpEx}", 'i=pm') . '&amp;folder=';
    do {
        $folder_id = (int) $row['folder_id'];
        $row['folder'][] = isset($folder[$folder_id]) ? '<a href="' . $folder_url . $folder_id . '">' . $folder[$folder_id]['folder_name'] . '</a>' : $user->lang['UNKNOWN_FOLDER'];
        if (isset($rowset[$row['msg_id']])) {
            $rowset[$row['msg_id']]['folder'][] = isset($folder[$folder_id]) ? '<a href="' . $folder_url . $folder_id . '">' . $folder[$folder_id]['folder_name'] . '</a>' : $user->lang['UNKNOWN_FOLDER'];
        } else {
            $rowset[$row['msg_id']] = $row;
        }
    } while ($row = $db->sql_fetchrow($result));
    $db->sql_freeresult($result);
    if (sizeof($rowset) == 1 && !$in_post_mode) {
        return false;
    }
    $title = censor_text($title);
    $url = append_sid("{$phpbb_root_path}ucp.{$phpEx}", 'i=pm');
    $next_history_pm = $previous_history_pm = $prev_id = 0;
    // Re-order rowset to be able to get the next/prev message rows...
    $rowset = array_values($rowset);
    for ($i = 0, $size = sizeof($rowset); $i < $size; $i++) {
        $row =& $rowset[$i];
        $id = (int) $row['msg_id'];
        $author_id = $row['author_id'];
        $folder_id = (int) $row['folder_id'];
        $subject = $row['message_subject'];
        $message = $row['message_text'];
        $message = censor_text($message);
        $decoded_message = false;
        if ($in_post_mode && $auth->acl_get('u_sendpm') && $author_id != ANONYMOUS) {
            $decoded_message = $message;
            decode_message($decoded_message, $row['bbcode_uid']);
            $decoded_message = bbcode_nl2br($decoded_message);
        }
        $parse_flags = $row['bbcode_bitfield'] ? OPTION_FLAG_BBCODE : 0;
        $parse_flags |= $row['enable_smilies'] ? OPTION_FLAG_SMILIES : 0;
        $message = generate_text_for_display($message, $row['bbcode_uid'], $row['bbcode_bitfield'], $parse_flags, false);
        $subject = censor_text($subject);
        if ($id == $msg_id) {
            $next_history_pm = isset($rowset[$i + 1]) ? (int) $rowset[$i + 1]['msg_id'] : 0;
            $previous_history_pm = $prev_id;
        }
        $template->assign_block_vars('history_row', array('MESSAGE_AUTHOR_QUOTE' => $decoded_message ? addslashes(get_username_string('username', $author_id, $row['username'], $row['user_colour'], $row['username'])) : '', 'MESSAGE_AUTHOR_FULL' => get_username_string('full', $author_id, $row['username'], $row['user_colour'], $row['username']), 'MESSAGE_AUTHOR_COLOUR' => get_username_string('colour', $author_id, $row['username'], $row['user_colour'], $row['username']), 'MESSAGE_AUTHOR' => get_username_string('username', $author_id, $row['username'], $row['user_colour'], $row['username']), 'U_MESSAGE_AUTHOR' => get_username_string('profile', $author_id, $row['username'], $row['user_colour'], $row['username']), 'SUBJECT' => $subject, 'SENT_DATE' => $user->format_date($row['message_time']), 'MESSAGE' => $message, 'FOLDER' => implode($user->lang['COMMA_SEPARATOR'], $row['folder']), 'DECODED_MESSAGE' => $decoded_message, 'S_CURRENT_MSG' => $row['msg_id'] == $msg_id, 'S_AUTHOR_DELETED' => $author_id == ANONYMOUS ? true : false, 'S_IN_POST_MODE' => $in_post_mode, 'MSG_ID' => $row['msg_id'], 'U_VIEW_MESSAGE' => "{$url}&amp;f={$folder_id}&amp;p=" . $row['msg_id'], 'U_QUOTE' => !$in_post_mode && $auth->acl_get('u_sendpm') && $author_id != ANONYMOUS ? "{$url}&amp;mode=compose&amp;action=quote&amp;f=" . $folder_id . "&amp;p=" . $row['msg_id'] : '', 'U_POST_REPLY_PM' => $author_id != $user->data['user_id'] && $author_id != ANONYMOUS && $auth->acl_get('u_sendpm') ? "{$url}&amp;mode=compose&amp;action=reply&amp;f={$folder_id}&amp;p=" . $row['msg_id'] : ''));
        unset($rowset[$i]);
        $prev_id = $id;
    }
    $template->assign_vars(array('QUOTE_IMG' => $user->img('icon_post_quote', $user->lang['REPLY_WITH_QUOTE']), 'HISTORY_TITLE' => $title, 'U_VIEW_NEXT_HISTORY' => $next_history_pm ? "{$url}&amp;p=" . $next_history_pm : '', 'U_VIEW_PREVIOUS_HISTORY' => $previous_history_pm ? "{$url}&amp;p=" . $previous_history_pm : ''));
    return true;
}
开发者ID:binano,项目名称:phpbb,代码行数:88,代码来源:functions_privmsgs.php

示例9: topic_review

/**
* Topic Review
*/
function topic_review($topic_id, $forum_id, $mode = 'topic_review', $cur_post_id = 0, $show_quote_button = true)
{
    global $user, $auth, $db, $template, $cache;
    global $config, $phpbb_root_path, $phpEx, $phpbb_container, $phpbb_dispatcher;
    /* @var $phpbb_content_visibility \phpbb\content_visibility */
    $phpbb_content_visibility = $phpbb_container->get('content.visibility');
    $sql_sort = $mode == 'post_review' ? 'ASC' : 'DESC';
    // Go ahead and pull all data for this topic
    $sql = 'SELECT p.post_id
		FROM ' . POSTS_TABLE . ' p' . "\n\t\tWHERE p.topic_id = {$topic_id}\n\t\t\tAND " . $phpbb_content_visibility->get_visibility_sql('post', $forum_id, 'p.') . '
			' . ($mode == 'post_review' ? " AND p.post_id > {$cur_post_id}" : '') . '
			' . ($mode == 'post_review_edit' ? " AND p.post_id = {$cur_post_id}" : '') . '
		ORDER BY p.post_time ' . $sql_sort . ', p.post_id ' . $sql_sort;
    $result = $db->sql_query_limit($sql, $config['posts_per_page']);
    $post_list = array();
    while ($row = $db->sql_fetchrow($result)) {
        $post_list[] = $row['post_id'];
    }
    $db->sql_freeresult($result);
    if (!sizeof($post_list)) {
        return false;
    }
    // Handle 'post_review_edit' like 'post_review' from now on
    if ($mode == 'post_review_edit') {
        $mode = 'post_review';
    }
    $sql_ary = array('SELECT' => 'u.username, u.user_id, u.user_colour, p.*, z.friend, z.foe', 'FROM' => array(USERS_TABLE => 'u', POSTS_TABLE => 'p'), 'LEFT_JOIN' => array(array('FROM' => array(ZEBRA_TABLE => 'z'), 'ON' => 'z.user_id = ' . $user->data['user_id'] . ' AND z.zebra_id = p.poster_id')), 'WHERE' => $db->sql_in_set('p.post_id', $post_list) . '
			AND u.user_id = p.poster_id');
    $sql = $db->sql_build_query('SELECT', $sql_ary);
    $result = $db->sql_query($sql);
    $rowset = array();
    $has_attachments = false;
    while ($row = $db->sql_fetchrow($result)) {
        $rowset[$row['post_id']] = $row;
        if ($row['post_attachment']) {
            $has_attachments = true;
        }
    }
    $db->sql_freeresult($result);
    // Grab extensions
    $extensions = $attachments = array();
    if ($has_attachments && $auth->acl_get('u_download') && $auth->acl_get('f_download', $forum_id)) {
        $extensions = $cache->obtain_attach_extensions($forum_id);
        // Get attachments...
        $sql = 'SELECT *
			FROM ' . ATTACHMENTS_TABLE . '
			WHERE ' . $db->sql_in_set('post_msg_id', $post_list) . '
				AND in_message = 0
			ORDER BY filetime DESC, post_msg_id ASC';
        $result = $db->sql_query($sql);
        while ($row = $db->sql_fetchrow($result)) {
            $attachments[$row['post_msg_id']][] = $row;
        }
        $db->sql_freeresult($result);
    }
    for ($i = 0, $end = sizeof($post_list); $i < $end; ++$i) {
        // A non-existing rowset only happens if there was no user present for the entered poster_id
        // This could be a broken posts table.
        if (!isset($rowset[$post_list[$i]])) {
            continue;
        }
        $row = $rowset[$post_list[$i]];
        $poster_id = $row['user_id'];
        $post_subject = $row['post_subject'];
        $decoded_message = false;
        if ($show_quote_button && $auth->acl_get('f_reply', $forum_id)) {
            $decoded_message = censor_text($row['post_text']);
            decode_message($decoded_message, $row['bbcode_uid']);
            $decoded_message = bbcode_nl2br($decoded_message);
        }
        $parse_flags = $row['bbcode_bitfield'] ? OPTION_FLAG_BBCODE : 0;
        $parse_flags |= $row['enable_smilies'] ? OPTION_FLAG_SMILIES : 0;
        $message = generate_text_for_display($row['post_text'], $row['bbcode_uid'], $row['bbcode_bitfield'], $parse_flags, true);
        if (!empty($attachments[$row['post_id']])) {
            $update_count = array();
            parse_attachments($forum_id, $message, $attachments[$row['post_id']], $update_count);
        }
        $post_subject = censor_text($post_subject);
        $post_anchor = $mode == 'post_review' ? 'ppr' . $row['post_id'] : 'pr' . $row['post_id'];
        $u_show_post = append_sid($phpbb_root_path . 'viewtopic.' . $phpEx, "f={$forum_id}&amp;t={$topic_id}&amp;p={$row['post_id']}&amp;view=show#p{$row['post_id']}");
        $post_row = array('POST_AUTHOR_FULL' => get_username_string('full', $poster_id, $row['username'], $row['user_colour'], $row['post_username']), 'POST_AUTHOR_COLOUR' => get_username_string('colour', $poster_id, $row['username'], $row['user_colour'], $row['post_username']), 'POST_AUTHOR' => get_username_string('username', $poster_id, $row['username'], $row['user_colour'], $row['post_username']), 'U_POST_AUTHOR' => get_username_string('profile', $poster_id, $row['username'], $row['user_colour'], $row['post_username']), 'S_HAS_ATTACHMENTS' => !empty($attachments[$row['post_id']]) ? true : false, 'S_FRIEND' => $row['friend'] ? true : false, 'S_IGNORE_POST' => $row['foe'] ? true : false, 'L_IGNORE_POST' => $row['foe'] ? sprintf($user->lang['POST_BY_FOE'], get_username_string('full', $poster_id, $row['username'], $row['user_colour'], $row['post_username']), "<a href=\"{$u_show_post}\" onclick=\"phpbb.toggleDisplay('{$post_anchor}', 1); return false;\">", '</a>') : '', 'POST_SUBJECT' => $post_subject, 'MINI_POST_IMG' => $user->img('icon_post_target', $user->lang['POST']), 'POST_DATE' => $user->format_date($row['post_time']), 'MESSAGE' => $message, 'DECODED_MESSAGE' => $decoded_message, 'POST_ID' => $row['post_id'], 'POST_TIME' => $row['post_time'], 'USER_ID' => $row['user_id'], 'U_MINI_POST' => append_sid("{$phpbb_root_path}viewtopic.{$phpEx}", 'p=' . $row['post_id']) . '#p' . $row['post_id'], 'U_MCP_DETAILS' => $auth->acl_get('m_info', $forum_id) ? append_sid("{$phpbb_root_path}mcp.{$phpEx}", 'i=main&amp;mode=post_details&amp;f=' . $forum_id . '&amp;p=' . $row['post_id'], true, $user->session_id) : '', 'POSTER_QUOTE' => $show_quote_button && $auth->acl_get('f_reply', $forum_id) ? addslashes(get_username_string('username', $poster_id, $row['username'], $row['user_colour'], $row['post_username'])) : '');
        $current_row_number = $i;
        /**
         * Event to modify the template data block for topic reviews
         *
         * @event core.topic_review_modify_row
         * @var	string	mode				The review mode
         * @var	int		topic_id			The topic that is being reviewed
         * @var	int		forum_id			The topic's forum
         * @var	int		cur_post_id			Post offset id
         * @var	int		current_row_number	Number of the current row being iterated
         * @var	array	post_row			Template block array of the current post
         * @var	array	row					Array with original post and user data
         * @since 3.1.4-RC1
         */
        $vars = array('mode', 'topic_id', 'forum_id', 'cur_post_id', 'current_row_number', 'post_row', 'row');
        extract($phpbb_dispatcher->trigger_event('core.topic_review_modify_row', compact($vars)));
//.........这里部分代码省略.........
开发者ID:prototech,项目名称:phpbb,代码行数:101,代码来源:functions_posting.php

示例10: view_folder


//.........这里部分代码省略.........
				$message_row = $db->sql_fetchrow($result);
				$db->sql_freeresult($result);

				$_types = array('u', 'g');
				foreach ($_types as $ug_type)
				{
					if (isset($address[$message_id][$ug_type]) && sizeof($address[$message_id][$ug_type]))
					{
						if ($ug_type == 'u')
						{
							$sql = 'SELECT user_id as id, username as name
								FROM ' . USERS_TABLE . '
								WHERE ';
						}
						else
						{
							$sql = 'SELECT group_id as id, group_name as name
								FROM ' . GROUPS_TABLE . '
								WHERE ';
						}
						$sql .= $db->sql_in_set(($ug_type == 'u') ? 'user_id' : 'group_id', array_map('intval', array_keys($address[$message_id][$ug_type])));

						$result = $db->sql_query($sql);

						while ($info_row = $db->sql_fetchrow($result))
						{
							$address[$message_id][$ug_type][$address[$message_id][$ug_type][$info_row['id']]][] = $info_row['name'];
							unset($address[$message_id][$ug_type][$info_row['id']]);
						}
						$db->sql_freeresult($result);
					}
				}

				decode_message($message_row['message_text'], $message_row['bbcode_uid']);

				$data[] = array(
					'subject'	=> censor_text($row['message_subject']),
					'sender'	=> $row['username'],
					'date'		=> $user->format_date($row['message_time']),
					'to'		=> ($folder_id == PRIVMSGS_OUTBOX || $folder_id == PRIVMSGS_SENTBOX) ? $address[$message_id] : '',
					'message'	=> $message_row['message_text']
				);
			}

			switch ($export_type)
			{
				case 'CSV':
				case 'CSV_EXCEL':
					$mimetype = 'text/csv';
					$filetype = 'csv';

					if ($export_type == 'CSV_EXCEL')
					{
						$enclosure = '"';
						$delimiter = ',';
						$newline = "\r\n";
					}
					else
					{
						$newline = "\n";
					}

					$string = '';
					foreach ($data as $value)
					{
						$recipients = $value['to'];
开发者ID:pombredanne,项目名称:ArcherSys,代码行数:67,代码来源:ucp_pm_viewfolder.php

示例11: generate_text_for_edit

/**
* For decoding custom parsed text for edits as well as extracting the flags
* Expects $text to be the value directly from the database (pre-parsed content)
*/
function generate_text_for_edit($text, $uid, $flags)
{
    global $phpbb_root_path, $phpEx, $phpbb_dispatcher;
    /**
     * Use this event to modify the text before it is decoded for editing
     *
     * @event core.modify_text_for_edit_before
     * @var string	text			The text to parse
     * @var string	uid				The BBCode UID
     * @var int		flags			The BBCode Flags
     * @since 3.1.0-a1
     */
    $vars = array('text', 'uid', 'flags');
    extract($phpbb_dispatcher->trigger_event('core.modify_text_for_edit_before', compact($vars)));
    decode_message($text, $uid);
    /**
     * Use this event to modify the text after it is decoded for editing
     *
     * @event core.modify_text_for_edit_after
     * @var string	text			The text to parse
     * @var int		flags			The BBCode Flags
     * @since 3.1.0-a1
     */
    $vars = array('text', 'flags');
    extract($phpbb_dispatcher->trigger_event('core.modify_text_for_edit_after', compact($vars)));
    return array('allow_bbcode' => $flags & OPTION_FLAG_BBCODE ? 1 : 0, 'allow_smilies' => $flags & OPTION_FLAG_SMILIES ? 1 : 0, 'allow_urls' => $flags & OPTION_FLAG_LINKS ? 1 : 0, 'text' => $text);
}
开发者ID:41px,项目名称:phpbb-auth-passage,代码行数:31,代码来源:functions_content.php

示例12: utf8_normalize_nfc

         // Prepare text to saving into DB
         $content = utf8_normalize_nfc(request_var('content', '', true));
         $uid = $bitfield = $options = '';
         $allow_bbcode = $allow_urls = $allow_smilies = true;
         generate_text_for_storage($content, $uid, $bitfield, $options, $allow_bbcode, $allow_urls, $allow_smilies);
         $sql_array = array('marshrut_desc' => $content, 'bbcode_uid' => $uid, 'bbcode_bitfield' => $bitfield);
         $sql = 'UPDATE ' . MARSHRUT_DATA_TABLE . ' SET ' . $db->sql_build_array('UPDATE', $sql_array) . " WHERE marshrut_id = {$marshrut_id}";
         $db->sql_query($sql);
         // Parse and display new post text
         $text = generate_text_for_display($content, $uid, $bitfield, 7);
         $template->assign_vars(array('DESC_TEXT' => $text, 'SAVE_DESC' => true));
     } else {
         /**
         Show quick edit form
         */
         decode_message($desc_data['marshrut_desc'], $desc_data['bbcode_uid']);
         $template->assign_vars(array('VK' => $vk ? TRUE : FALSE, 'EDIT_DESC' => true, 'DESC_TEXT' => $desc_data['marshrut_desc'], 'MARSHRUT_ID' => $marshrut_id));
     }
     // Output results
     $template->display('body');
 } else {
     if ($mode == 'meeting_geo_change') {
         // Set up language
         $user->setup('posting');
         $user->add_lang('lang_meeting');
         $_RESULT['success'] = false;
         if (!$user->data['is_registered']) {
             $_RESULT['success'] = false;
             exit($user->lang['USER_CANNOT_GHANGE']);
         }
         $geo_id = request_var('geo_id', '');
开发者ID:velocat,项目名称:phpbb3,代码行数:31,代码来源:aljax.php

示例13: main


//.........这里部分代码省略.........
                // Get additional profile fields and assign them to the template block var 'profile_fields'
                $user->get_profile_fields($user->data['user_id']);
                $cp->generate_profile_fields('profile', $user->get_iso_lang_id());
                break;
            case 'signature':
                if (!$auth->acl_get('u_sig')) {
                    trigger_error('NO_AUTH_SIGNATURE');
                }
                include $phpbb_root_path . 'includes/functions_posting.' . $phpEx;
                include $phpbb_root_path . 'includes/functions_display.' . $phpEx;
                $enable_bbcode = $config['allow_sig_bbcode'] ? (bool) $user->optionget('sig_bbcode') : false;
                $enable_smilies = $config['allow_sig_smilies'] ? (bool) $user->optionget('sig_smilies') : false;
                $enable_urls = $config['allow_sig_links'] ? (bool) $user->optionget('sig_links') : false;
                $signature = utf8_normalize_nfc(request_var('signature', (string) $user->data['user_sig'], true));
                add_form_key('ucp_sig');
                if ($submit || $preview) {
                    include $phpbb_root_path . 'includes/message_parser.' . $phpEx;
                    $enable_bbcode = $config['allow_sig_bbcode'] ? request_var('disable_bbcode', false) ? false : true : false;
                    $enable_smilies = $config['allow_sig_smilies'] ? request_var('disable_smilies', false) ? false : true : false;
                    $enable_urls = $config['allow_sig_links'] ? request_var('disable_magic_url', false) ? false : true : false;
                    if (!sizeof($error)) {
                        $message_parser = new parse_message($signature);
                        // Allowing Quote BBCode
                        $message_parser->parse($enable_bbcode, $enable_urls, $enable_smilies, $config['allow_sig_img'], $config['allow_sig_flash'], true, $config['allow_sig_links'], true, 'sig');
                        if (sizeof($message_parser->warn_msg)) {
                            $error[] = implode('<br />', $message_parser->warn_msg);
                        }
                        if (!check_form_key('ucp_sig')) {
                            $error[] = 'FORM_INVALID';
                        }
                        if (!sizeof($error) && $submit) {
                            $user->optionset('sig_bbcode', $enable_bbcode);
                            $user->optionset('sig_smilies', $enable_smilies);
                            $user->optionset('sig_links', $enable_urls);
                            $sql_ary = array('user_sig' => (string) $message_parser->message, 'user_options' => $user->data['user_options'], 'user_sig_bbcode_uid' => (string) $message_parser->bbcode_uid, 'user_sig_bbcode_bitfield' => $message_parser->bbcode_bitfield);
                            $sql = 'UPDATE ' . USERS_TABLE . '
								SET ' . $db->sql_build_array('UPDATE', $sql_ary) . '
								WHERE user_id = ' . $user->data['user_id'];
                            $db->sql_query($sql);
                            $message = $user->lang['PROFILE_UPDATED'] . '<br /><br />' . sprintf($user->lang['RETURN_UCP'], '<a href="' . $this->u_action . '">', '</a>');
                            trigger_error($message);
                        }
                    }
                    // Replace "error" strings with their real, localised form
                    $error = preg_replace('#^([A-Z_]+)$#e', "(!empty(\$user->lang['\\1'])) ? \$user->lang['\\1'] : '\\1'", $error);
                }
                $signature_preview = '';
                if ($preview) {
                    // Now parse it for displaying
                    $signature_preview = $message_parser->format_display($enable_bbcode, $enable_urls, $enable_smilies, false);
                    unset($message_parser);
                }
                decode_message($signature, $user->data['user_sig_bbcode_uid']);
                $template->assign_vars(array('ERROR' => sizeof($error) ? implode('<br />', $error) : '', 'SIGNATURE' => $signature, 'SIGNATURE_PREVIEW' => $signature_preview, 'S_BBCODE_CHECKED' => !$enable_bbcode ? ' checked="checked"' : '', 'S_SMILIES_CHECKED' => !$enable_smilies ? ' checked="checked"' : '', 'S_MAGIC_URL_CHECKED' => !$enable_urls ? ' checked="checked"' : '', 'BBCODE_STATUS' => $config['allow_sig_bbcode'] ? sprintf($user->lang['BBCODE_IS_ON'], '<a href="' . append_sid("{$phpbb_root_path}faq.{$phpEx}", 'mode=bbcode') . '">', '</a>') : sprintf($user->lang['BBCODE_IS_OFF'], '<a href="' . append_sid("{$phpbb_root_path}faq.{$phpEx}", 'mode=bbcode') . '">', '</a>'), 'SMILIES_STATUS' => $config['allow_sig_smilies'] ? $user->lang['SMILIES_ARE_ON'] : $user->lang['SMILIES_ARE_OFF'], 'IMG_STATUS' => $config['allow_sig_img'] ? $user->lang['IMAGES_ARE_ON'] : $user->lang['IMAGES_ARE_OFF'], 'FLASH_STATUS' => $config['allow_sig_flash'] ? $user->lang['FLASH_IS_ON'] : $user->lang['FLASH_IS_OFF'], 'URL_STATUS' => $config['allow_sig_links'] ? $user->lang['URL_IS_ON'] : $user->lang['URL_IS_OFF'], 'MAX_FONT_SIZE' => (int) $config['max_sig_font_size'], 'L_SIGNATURE_EXPLAIN' => sprintf($user->lang['SIGNATURE_EXPLAIN'], $config['max_sig_chars']), 'S_BBCODE_ALLOWED' => $config['allow_sig_bbcode'], 'S_SMILIES_ALLOWED' => $config['allow_sig_smilies'], 'S_BBCODE_IMG' => $config['allow_sig_img'] ? true : false, 'S_BBCODE_FLASH' => $config['allow_sig_flash'] ? true : false, 'S_LINKS_ALLOWED' => $config['allow_sig_links'] ? true : false));
                // Build custom bbcodes array
                display_custom_bbcodes();
                break;
            case 'avatar':
                include $phpbb_root_path . 'includes/functions_display.' . $phpEx;
                $display_gallery = request_var('display_gallery', '0');
                $avatar_select = basename(request_var('avatar_select', ''));
                $category = basename(request_var('category', ''));
                $can_upload = file_exists($phpbb_root_path . $config['avatar_path']) && phpbb_is_writable($phpbb_root_path . $config['avatar_path']) && $auth->acl_get('u_chgavatar') && (@ini_get('file_uploads') || strtolower(@ini_get('file_uploads')) == 'on') ? true : false;
                add_form_key('ucp_avatar');
                if ($submit) {
                    if (check_form_key('ucp_avatar')) {
                        if (avatar_process_user($error, false, $can_upload)) {
                            meta_refresh(3, $this->u_action);
                            $message = $user->lang['PROFILE_UPDATED'] . '<br /><br />' . sprintf($user->lang['RETURN_UCP'], '<a href="' . $this->u_action . '">', '</a>');
                            trigger_error($message);
                        }
                    } else {
                        $error[] = 'FORM_INVALID';
                    }
                    // Replace "error" strings with their real, localised form
                    $error = preg_replace('#^([A-Z_]+)$#e', "(!empty(\$user->lang['\\1'])) ? \$user->lang['\\1'] : '\\1'", $error);
                }
                if (!$config['allow_avatar'] && $user->data['user_avatar_type']) {
                    $error[] = $user->lang['AVATAR_NOT_ALLOWED'];
                } else {
                    if ($user->data['user_avatar_type'] == AVATAR_UPLOAD && !$config['allow_avatar_upload'] || $user->data['user_avatar_type'] == AVATAR_REMOTE && !$config['allow_avatar_remote'] || $user->data['user_avatar_type'] == AVATAR_GALLERY && !$config['allow_avatar_local']) {
                        $error[] = $user->lang['AVATAR_TYPE_NOT_ALLOWED'];
                    }
                }
                $template->assign_vars(array('ERROR' => sizeof($error) ? implode('<br />', $error) : '', 'AVATAR' => get_user_avatar($user->data['user_avatar'], $user->data['user_avatar_type'], $user->data['user_avatar_width'], $user->data['user_avatar_height'], 'USER_AVATAR', true), 'AVATAR_SIZE' => $config['avatar_filesize'], 'U_GALLERY' => append_sid("{$phpbb_root_path}ucp.{$phpEx}", 'i=profile&amp;mode=avatar&amp;display_gallery=1'), 'S_FORM_ENCTYPE' => $can_upload && ($config['allow_avatar_upload'] || $config['allow_avatar_remote_upload']) ? ' enctype="multipart/form-data"' : '', 'L_AVATAR_EXPLAIN' => sprintf($user->lang['AVATAR_EXPLAIN'], $config['avatar_max_width'], $config['avatar_max_height'], $config['avatar_filesize'] / 1024)));
                if ($config['allow_avatar'] && $display_gallery && $auth->acl_get('u_chgavatar') && $config['allow_avatar_local']) {
                    avatar_gallery($category, $avatar_select, 4);
                } else {
                    if ($config['allow_avatar']) {
                        $avatars_enabled = $can_upload && ($config['allow_avatar_upload'] || $config['allow_avatar_remote_upload']) || $auth->acl_get('u_chgavatar') && ($config['allow_avatar_local'] || $config['allow_avatar_remote']) ? true : false;
                        $template->assign_vars(array('AVATAR_WIDTH' => request_var('width', $user->data['user_avatar_width']), 'AVATAR_HEIGHT' => request_var('height', $user->data['user_avatar_height']), 'S_AVATARS_ENABLED' => $avatars_enabled, 'S_UPLOAD_AVATAR_FILE' => $can_upload && $config['allow_avatar_upload'] ? true : false, 'S_UPLOAD_AVATAR_URL' => $can_upload && $config['allow_avatar_remote_upload'] ? true : false, 'S_LINK_AVATAR' => $auth->acl_get('u_chgavatar') && $config['allow_avatar_remote'] ? true : false, 'S_DISPLAY_GALLERY' => $auth->acl_get('u_chgavatar') && $config['allow_avatar_local'] ? true : false));
                    }
                }
                break;
        }
        $template->assign_vars(array('L_TITLE' => $user->lang['UCP_PROFILE_' . strtoupper($mode)], 'S_HIDDEN_FIELDS' => $s_hidden_fields, 'S_UCP_ACTION' => $this->u_action));
        // Set desired template
        $this->tpl_name = 'ucp_profile_' . $mode;
        $this->page_title = 'UCP_PROFILE_' . strtoupper($mode);
    }
开发者ID:ahmatjan,项目名称:Crimson,代码行数:101,代码来源:ucp_profile.php

示例14: comment_edit

    function comment_edit($blog_id, $comment_id)
    {
        // Grab comment details
        $sql = 'SELECT c.*, b.blog_subject
				FROM ' . $this->ub_comments_table . ' c
				LEFT JOIN ' . $this->ub_blogs_table . ' b
					ON c.blog_id = b.blog_id
				WHERE c.comment_id = ' . (int) $comment_id . '
					AND c.blog_id = ' . (int) $blog_id;
        $result = $this->db->sql_query($sql);
        $comment = $this->db->sql_fetchrow($result);
        $this->db->sql_freeresult($result);
        if (!$comment) {
            trigger_error($this->user->lang['BLOG_COMMENT_NOT_EXIST'] . '<br><br><a href="' . $this->helper->route('posey_ultimateblog_blog_display', ['blog_id' => (int) $blog_id]) . '">&laquo; ' . $this->user->lang['BACK_TO_PREV'] . '</a>');
        }
        // Check if authorised to edit this comment
        if (!$this->auth->acl_gets('u_blog_comment_edit', 'm_blog_comment_edit')) {
            trigger_error($this->user->lang['AUTH_COMMENT_EDIT'] . '<br><br><a href="' . $this->helper->route('posey_ultimateblog_blog_display', ['blog_id' => (int) $blog_id]) . '">&laquo; ' . $this->user->lang['BLOG_BACK'] . '</a>');
        }
        if ($this->auth->acl_get('u_blog_edit') && $comment['poster_id'] != $this->user->data['user_id'] && !$this->auth->acl_get('m_blog_comment_edit')) {
            trigger_error($this->user->lang['AUTH_COMMENT_EDIT_ELSE'] . '<br><br><a href="' . $this->helper->route('posey_ultimateblog_blog_display', ['blog_id' => (int) $blog_id]) . '">&laquo; ' . $this->user->lang['BLOG_BACK'] . '</a>');
        }
        if (!function_exists('generate_smilies')) {
            include $this->phpbb_root_path . 'includes/functions_posting.' . $this->php_ext;
        }
        if (!function_exists('display_custom_bbcodes')) {
            include $this->phpbb_root_path . 'includes/functions_display.' . $this->php_ext;
        }
        // Add lang file
        $this->user->add_lang('posting');
        display_custom_bbcodes();
        generate_smilies('inline', 0);
        // Generate text for editing
        decode_message($comment['comment_text'], $comment['bbcode_uid']);
        $this->template->assign_vars(['MESSAGE' => $comment['comment_text'], 'S_FORM_ENCTYPE' => '', 'S_BBCODE_ALLOWED' => $this->config['allow_bbcode'] ? true : false, 'S_SMILIES_STATUS' => $this->config['allow_smilies'] ? true : false]);
        add_form_key('edit_comment');
        if ($this->request->is_set_post('submit')) {
            if (!check_form_key('edit_comment')) {
                // Invalid form key
                trigger_error($this->user->lang['FORM_INVALID'] . '<br><br><a href="' . $this->helper->route('posey_ultimateblog_comment', ['blog_id' => (int) $blog_id, 'comment_id' => (int) $comment_id, 'action' => 'edit']) . '">&laquo; ' . $this->user->lang['BACK_TO_PREV'] . '</a>');
            } else {
                if ($this->request->variable('comment_text', '', true) == '') {
                    // Empty comment message
                    trigger_error($this->user->lang['BLOG_COMMENT_EMPTY'] . '<br><br><a href="' . $this->helper->route('posey_ultimateblog_comment', ['blog_id' => (int) $blog_id, 'comment_id' => (int) $comment_id, 'action' => 'edit']) . '">&laquo; ' . $this->user->lang['BACK_TO_PREV'] . '</a>');
                } else {
                    // Generate text for storage
                    $comment_text = $this->request->variable('comment_text', '', true);
                    $uid = $bitfield = $options = '';
                    $allow_bbcode = $this->config['allow_bbcode'];
                    $allow_smilies = $this->config['allow_smilies'];
                    $allow_urls = $this->config['allow_post_links'];
                    generate_text_for_storage($comment_text, $uid, $bitfield, $options, $allow_bbcode, $allow_smilies, $allow_urls);
                    $comment_row = ['comment_text' => $comment_text, 'bbcode_uid' => $uid, 'bbcode_bitfield' => $bitfield, 'bbcode_options' => $options];
                    // Update the blog
                    $sql = 'UPDATE ' . $this->ub_comments_table . ' SET ' . $this->db->sql_build_array('UPDATE', $comment_row) . ' WHERE comment_id = ' . (int) $comment_id;
                    $this->db->sql_query($sql);
                    // Add it to the log
                    $this->log->add('admin', $this->user->data['user_id'], $this->user->ip, 'LOG_COMMENT_EDITED', false, array($comment_id));
                    // Send success message
                    trigger_error($this->user->lang['BLOG_COMMENT_EDITED'] . '<br><br><a href="' . $this->helper->route('posey_ultimateblog_blog_display', ['blog_id' => (int) $blog_id]) . '#c' . (int) $comment_id . '">' . $this->user->lang['BLOG_COMMENT_VIEW'] . ' &raquo;</a>');
                }
            }
        }
        // Assign breadcrumb template vars
        $navlinks_array = [['U_VIEW_FORUM' => $this->helper->route('posey_ultimateblog_blog'), 'FORUM_NAME' => $this->user->lang('BLOG')], ['U_VIEW_FORUM' => $this->helper->route('posey_ultimateblog_blog_display', ['blog_id' => (int) $blog_id]), 'FORUM_NAME' => $comment['blog_subject']]];
        foreach ($navlinks_array as $name) {
            $this->template->assign_block_vars('navlinks', ['FORUM_NAME' => $name['FORUM_NAME'], 'U_VIEW_FORUM' => $name['U_VIEW_FORUM']]);
        }
    }
开发者ID:MrGoldy,项目名称:ultimateblog,代码行数:69,代码来源:functions.php

示例15: flush

	);
}

print '<p><strong>Jelentések</strong> áthozva.</p>';
flush();


/**
* Transfer comments 
*/
$sql = 'SELECT * FROM phpbb_bugs_comments';
$result = $olddb->sql_query($sql);

while ($row = $olddb->sql_fetchrow($result))
{
	decode_message($row['comment_text'], $row['comment_bbcode_uid']);
	$md5_message= md5($row['comment_text']);
	
	$uid = $bitfield = $options = ''; // will be modified by generate_text_for_storage
	$allow_bbcode = $allow_urls = $allow_smilies = true;
	generate_text_for_storage($row['comment_text'], $uid, $bitfield, $options, $allow_bbcode, $allow_urls, $allow_smilies);
	
	$poll = false;
	$data = array(
		'forum_id'			=> $reports[$row['bug_id']]['forum_id'],
		'topic_id'			=> $reports[$row['bug_id']]['topic_id'],
		'topic_title'		=> $reports[$row['bug_id']]['topic_title'],
		'icon_id'			=> 0,
		'post_time'			=> $row['comment_time'],
		'message'			=> $row['comment_text'],
		'message_md5'		=> $message_md5,
开发者ID:BackupTheBerlios,项目名称:phpbb-hu-svn,代码行数:31,代码来源:convert_bugs.php


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