本文整理汇总了PHP中submit_post函数的典型用法代码示例。如果您正苦于以下问题:PHP submit_post函数的具体用法?PHP submit_post怎么用?PHP submit_post使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了submit_post函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: 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;
}
示例2: test_submit_post
/**
* @dataProvider submit_post_data
*/
public function test_submit_post($additional_post_data, $expected_before, $expected_after)
{
$sql = 'SELECT user_id, item_id, item_parent_id
FROM ' . NOTIFICATIONS_TABLE . ' n, ' . NOTIFICATION_TYPES_TABLE . " nt\n\t\t\tWHERE nt.notification_type_name = '" . $this->item_type . "'\n\t\t\t\tAND n.notification_type_id = nt.notification_type_id\n\t\t\tORDER BY user_id ASC, item_id ASC";
$result = $this->db->sql_query($sql);
$this->assertEquals($expected_before, $this->db->sql_fetchrowset($result));
$this->db->sql_freeresult($result);
$poll_data = array();
$post_data = array_merge($this->post_data, $additional_post_data);
submit_post('post', '', 'poster-name', POST_NORMAL, $poll_data, $post_data, false, false);
// Check whether the notifications got added successfully
$result = $this->db->sql_query($sql);
$this->assertEquals($expected_after, $this->db->sql_fetchrowset($result), 'Check whether the notifications got added successfully');
$this->db->sql_freeresult($result);
if (isset($additional_post_data['force_approved_state']) && $additional_post_data['force_approved_state'] === false) {
return;
}
$reply_data = array_merge($this->post_data, array('topic_id' => 2));
$url = submit_post('reply', '', 'poster-name', POST_NORMAL, $poll_data, $reply_data, false, false);
$reply_id = 3;
$this->assertStringEndsWith('p' . $reply_id, $url, 'Post ID of reply is not ' . $reply_id);
// Check whether the notifications are still correct after a reply has been added
$result = $this->db->sql_query($sql);
$this->assertEquals($expected_after, $this->db->sql_fetchrowset($result), 'Check whether the notifications are still correct after a reply has been added');
$this->db->sql_freeresult($result);
$result = $this->db->sql_query('SELECT *
FROM ' . POSTS_TABLE . '
WHERE post_id = ' . $reply_id);
$reply_edit_data = array_merge($this->post_data, $this->db->sql_fetchrow($result), array('force_approved_state' => false, 'post_edit_reason' => 'PHPBB3-12370'));
submit_post('edit', '', 'poster-name', POST_NORMAL, $poll_data, $reply_edit_data, false, false);
// Check whether the notifications are still correct after the reply has been edit
$result = $this->db->sql_query($sql);
$this->assertEquals($expected_after, $this->db->sql_fetchrowset($result), 'Check whether the notifications are still correct after the reply has been edit');
$this->db->sql_freeresult($result);
}
示例3: 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);
}
}
示例4: test_submit_post
/**
* @dataProvider submit_post_data
*/
public function test_submit_post($additional_post_data, $expected_before, $expected_after)
{
$sql = 'SELECT user_id, item_id, item_parent_id
FROM ' . NOTIFICATIONS_TABLE . ' n, ' . NOTIFICATION_TYPES_TABLE . " nt\n\t\t\tWHERE nt.notification_type_name = '" . $this->item_type . "'\n\t\t\t\tAND n.notification_type_id = nt.notification_type_id\n\t\t\tORDER BY user_id ASC, item_id ASC";
$result = $this->db->sql_query($sql);
$this->assertEquals($expected_before, $this->db->sql_fetchrowset($result));
$this->db->sql_freeresult($result);
$poll_data = $this->poll_data;
$post_data = array_merge($this->post_data, $additional_post_data);
submit_post('reply', '', 'poster-name', POST_NORMAL, $poll_data, $post_data, false, false);
$result = $this->db->sql_query($sql);
$this->assertEquals($expected_after, $this->db->sql_fetchrowset($result));
$this->db->sql_freeresult($result);
}
示例5: copy_topic
/**
* Copy a new topic to another forum
*
* @param object $event The event object
* @return null
* @access public
*/
public function copy_topic($event)
{
$mode = $event['mode'];
$data = $event['data'];
if ($this->config['copy_topic_enable'] && $mode == 'post' && $data['forum_id'] == $this->config['copy_topic_from_forum']) {
if ($this->check_fora()) {
$data['forum_id'] = $this->config['copy_topic_to_forum'];
// We need to make sure the topic does not need approval in the "to" forum
$data['force_approved_state'] = ITEM_APPROVED;
$poll = $event['poll'];
$post_author_name = $event['post_author_name'];
$post_data = $event['post_data'];
$update_message = $event['update_message'];
submit_post($mode, $post_data['post_subject'], $post_author_name, $post_data['topic_type'], $poll, $data, $update_message, $update_message || $update_subject ? true : false);
}
}
}
示例6: 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);
}
示例7: post2
function post2($forum_id, $topic_id, $content)
{
// This posts a roll
global $db;
global $phpEx, $phpbb_root_path;
include_once $phpbb_root_path . 'includes/functions_posting.' . $phpEx;
$roller = $user->data['username'];
$backup = array('user' => $user, 'auth' => $auth);
$user_id = 2;
$sql = 'SELECT *
FROM ' . USERS_TABLE . '
WHERE user_id = ' . $user_id;
$result = $db->sql_query($sql);
$row = $db->sql_fetchrow($result);
$db->sql_freeresult($result);
// $user->data = array_merge($user->data, $row);
// $auth->acl($user->data);
// $user->ip = '0.0.0.0';
$post_data['topic_title'] = "Roll";
$post_data['forum_id'] = $forum_id;
$post_data['topic_id'] = $topic_id;
$post_data['icon_id'] = 0;
$post_data['enable_bbcode'] = 0;
$post_data['enable_smilies'] = 0;
$post_data['enable_urls'] = 0;
$post_data['enable_sig'] = 0;
$post_data['message'] = $content;
$post_data['message_md5'] = md5($content);
$post_data['bbcode_bitfield'] = "";
$post_data['bbcode_uid'] = "";
$post_data['post_edit_locked'] = 1;
submit_post('reply', $post_data['topic_title'], "Roller", 'POST_NORMAL', $poll, $post_data, $update_message, $update_message || $update_subject ? true : false);
//submit_post('reply', $post_data['topic_title'], "", $post_data);
$user = $backup['user'];
$auth = $backup['auth'];
}
示例8:
'bbcode_uid' => $uid,
'bbcode_bitfield' => $bitfield,
'enable_bbcode' => true,
'enable_smilies' => true,
'enable_urls' => true,
'enable_sig' => 0,
'post_edit_locked' => 0,
'poster_id' => $row['comment_author'],
'enable_indexing' => true,
'forum_name' => $projects[$reports[$row['bug_id']]['project_id']]['project_title'],
'notify' => false,
'notify_set' => false,
);
submit_post('reply', $row['comment_title'], '', POST_NORMAL, $poll, $data);
/*$sql = 'SELECT p.post_id, t.topic_replies_real, t.topic_first_post_id, t.topic_last_post_id FROM ' . POSTS_TABLE . ' p
LEFT JOIN ' . TOPICS_TABLE . ' t ON p.topic_id = t.topic_id
WHERE p.post_id = ' . $data['post_id'];
$result53 = $db->sql_query($sql);
$post = $db->sql_fetchrow($result53);
$data['topic_time'] = $row['comment_time'];
$data['post_time'] = $row['comment_time'];
$data['topic_poster'] = $row['comment_author'];
$data['poster_id'] = $row['comment_author'];
$data['post_edit_reason'] = '';
$data['topic_replies_real'] = $post['topic_replies_real'];
$data['topic_first_post_id'] = $post['topic_first_post_id'];
$data['topic_last_post_id'] = $post['topic_last_post_id'];*/
示例9: save_raw_post_func
//.........这里部分代码省略.........
trigger_error('NOT_AUTHORISED');
}
$forum_id = $to_forum_id;
}
}
}
// Lock/Unlock Topic
$change_topic_status = $post_data['topic_status'];
$perm_lock_unlock = $auth->acl_get('m_lock', $forum_id) || $auth->acl_get('f_user_lock', $forum_id) && $user->data['is_registered'] && !empty($post_data['topic_poster']) && $user->data['user_id'] == $post_data['topic_poster'] && $post_data['topic_status'] == ITEM_UNLOCKED ? true : false;
if ($post_data['topic_status'] == ITEM_LOCKED && !$topic_lock && $perm_lock_unlock) {
$change_topic_status = ITEM_UNLOCKED;
} else {
if ($post_data['topic_status'] == ITEM_UNLOCKED && $topic_lock && $perm_lock_unlock) {
$change_topic_status = ITEM_LOCKED;
}
}
if ($change_topic_status != $post_data['topic_status']) {
$sql = 'UPDATE ' . TOPICS_TABLE . "\r\r\n SET topic_status = {$change_topic_status}\r\r\n WHERE topic_id = {$topic_id}\r\r\n AND topic_moved_id = 0";
$db->sql_query($sql);
$user_lock = $auth->acl_get('f_user_lock', $forum_id) && $user->data['is_registered'] && $user->data['user_id'] == $post_data['topic_poster'] ? 'USER_' : '';
add_log('mod', $forum_id, $topic_id, 'LOG_' . $user_lock . ($change_topic_status == ITEM_LOCKED ? 'LOCK' : 'UNLOCK'), $post_data['topic_title']);
}
// Lock/Unlock Post Edit
if ($mode == 'edit' && $post_data['post_edit_locked'] == ITEM_LOCKED && !$post_lock && $auth->acl_get('m_edit', $forum_id)) {
$post_data['post_edit_locked'] = ITEM_UNLOCKED;
} else {
if ($mode == 'edit' && $post_data['post_edit_locked'] == ITEM_UNLOCKED && $post_lock && $auth->acl_get('m_edit', $forum_id)) {
$post_data['post_edit_locked'] = ITEM_LOCKED;
}
}
$data = array('topic_title' => empty($post_data['topic_title']) ? $post_data['post_subject'] : $post_data['topic_title'], 'topic_first_post_id' => isset($post_data['topic_first_post_id']) ? (int) $post_data['topic_first_post_id'] : 0, 'topic_last_post_id' => isset($post_data['topic_last_post_id']) ? (int) $post_data['topic_last_post_id'] : 0, 'topic_time_limit' => (int) $post_data['topic_time_limit'], 'topic_attachment' => isset($post_data['topic_attachment']) ? (int) $post_data['topic_attachment'] : 0, 'post_id' => (int) $post_id, 'topic_id' => (int) $topic_id, 'forum_id' => (int) $forum_id, 'icon_id' => (int) $post_data['icon_id'], 'poster_id' => (int) $post_data['poster_id'], 'enable_sig' => (bool) $post_data['enable_sig'], 'enable_bbcode' => (bool) $post_data['enable_bbcode'], 'enable_smilies' => (bool) $post_data['enable_smilies'], 'enable_urls' => (bool) $post_data['enable_urls'], 'enable_indexing' => (bool) $post_data['enable_indexing'], 'message_md5' => (string) $message_md5, 'post_time' => isset($post_data['post_time']) ? (int) $post_data['post_time'] : time(), 'post_checksum' => isset($post_data['post_checksum']) ? (string) $post_data['post_checksum'] : '', 'post_edit_reason' => $post_data['post_edit_reason'], 'post_edit_user' => $mode == 'edit' ? $user->data['user_id'] : (isset($post_data['post_edit_user']) ? (int) $post_data['post_edit_user'] : 0), 'forum_parents' => $post_data['forum_parents'], 'forum_name' => $post_data['forum_name'], 'notify' => $notify, 'poster_ip' => isset($post_data['poster_ip']) ? $post_data['poster_ip'] : $user->ip, 'post_edit_locked' => (int) $post_data['post_edit_locked'], 'bbcode_bitfield' => $message_parser->bbcode_bitfield, 'bbcode_uid' => $message_parser->bbcode_uid, 'message' => $message_parser->message, 'attachment_data' => $message_parser->attachment_data, 'filename_data' => $message_parser->filename_data, 'topic_approved' => isset($post_data['topic_approved']) ? $post_data['topic_approved'] : false, 'post_approved' => isset($post_data['post_approved']) ? $post_data['post_approved'] : false);
$data['topic_replies_real'] = $post_data['topic_replies_real'];
$data['topic_replies'] = $post_data['topic_replies'];
include $phpbb_root_path . 'includes/functions_posting.' . $phpEx;
$cwd = getcwd();
chdir('../');
$redirect_url = submit_post($mode, $post_data['post_subject'], $post_data['username'], $post_data['topic_type'], $poll, $data, $update_message);
chdir($cwd);
// Check the permissions for post approval, as well as the queue trigger where users are put on approval with a post count lower than specified. Moderators are not affected.
$approved = true;
if (($config['enable_queue_trigger'] && $user->data['user_posts'] < $config['queue_trigger_posts'] || !$auth->acl_get('f_noapprove', $data['forum_id'])) && !$auth->acl_get('m_approve', $data['forum_id'])) {
$approved = false;
}
$reply_success = false;
$post_id = '';
if ($redirect_url) {
preg_match('/&p=(\\d+)/', $redirect_url, $matches);
$post_id = $matches[1];
$reply_success = true;
// get new post_content
$message = censor_text($data['message']);
$quote_wrote_string = $user->lang['WROTE'];
$message = str_replace('[/quote:' . $data['bbcode_uid'] . ']', '[/quote]', $message);
$message = preg_replace('/\\[quote(?:="(.*?)")?:' . $data['bbcode_uid'] . '\\]/ise', "'[quote]' . ('\$1' ? '\$1' . ' {$quote_wrote_string}:\n' : '\n')", $message);
$blocks = preg_split('/(\\[\\/?quote\\])/i', $message, -1, PREG_SPLIT_NO_EMPTY | PREG_SPLIT_DELIM_CAPTURE);
$quote_level = 0;
$message = '';
foreach ($blocks as $block) {
if ($block == '[quote]') {
if ($quote_level == 0) {
$message .= $block;
}
$quote_level++;
} else {
if ($block == '[/quote]') {
if ($quote_level <= 1) {
$message .= $block;
}
if ($quote_level >= 1) {
$quote_level--;
}
} else {
if ($quote_level <= 1) {
$message .= $block;
}
}
}
}
$message = preg_replace('/\\[(youtube|video|googlevideo|gvideo):' . $data['bbcode_uid'] . '\\](.*?)\\[\\/\\1:' . $data['bbcode_uid'] . '\\]/sie', "video_bbcode_format('\$1', '\$2')", $message);
$message = preg_replace('/\\[(BBvideo)[\\d, ]+:' . $row['bbcode_uid'] . '\\](.*?)\\[\\/\\1:' . $row['bbcode_uid'] . '\\]/si', "[url=\$2]YouTube Video[/url]", $message);
$message = preg_replace('/\\[(spoil|spoiler):' . $row['bbcode_uid'] . '\\](.*?)\\[\\/\\1:' . $row['bbcode_uid'] . '\\]/si', "[spoiler]\$2[/spoiler]", $message);
$message = preg_replace('/\\[b:' . $data['bbcode_uid'] . '\\](.*?)\\[\\/b:' . $data['bbcode_uid'] . '\\]/si', '[b]$1[/b]', $message);
$message = preg_replace('/\\[i:' . $data['bbcode_uid'] . '\\](.*?)\\[\\/i:' . $data['bbcode_uid'] . '\\]/si', '[i]$1[/i]', $message);
$message = preg_replace('/\\[u:' . $data['bbcode_uid'] . '\\](.*?)\\[\\/u:' . $data['bbcode_uid'] . '\\]/si', '[u]$1[/u]', $message);
$message = preg_replace('/\\[color=#(\\w{6}):' . $data['bbcode_uid'] . '\\](.*?)\\[\\/color:' . $data['bbcode_uid'] . '\\]/si', '[color=#$1]$2[/color]', $message);
// Second parse bbcode here
if ($data['bbcode_bitfield']) {
$bbcode = new bbcode(base64_encode($data['bbcode_bitfield']));
$bbcode->bbcode_second_pass($message, $data['bbcode_uid'], $data['bbcode_bitfield']);
}
$message = bbcode_nl2br($message);
$message = smiley_text($message);
if (!empty($data['attachment_data'])) {
parse_attachments($forum_id, $message, $data['attachment_data'], $update_count);
}
$updated_post_title = html_entity_decode(strip_tags(censor_text($data['topic_title'])), ENT_QUOTES, 'UTF-8');
}
$xmlrpc_reply_topic = new xmlrpcval(array('result' => new xmlrpcval($reply_success, 'boolean'), 'state' => new xmlrpcval($approved ? 0 : 1, 'int'), 'post_title' => new xmlrpcval($updated_post_title, 'base64'), 'post_content' => new xmlrpcval(post_html_clean($message), 'base64')), 'struct');
return new xmlrpcresp($xmlrpc_reply_topic);
}
示例10: trim
if (!empty($topic_tags))
{
$topic_tags = trim($topic_tags);
while(substr($topic_tags, -1) == ',')
{
$topic_tags = trim(substr($topic_tags, 0, -1));
}
$topic_tags_array = $class_topics_tags->create_tags_array($topic_tags);
$topic_tags = implode(', ', array_filter(array_unique($topic_tags_array)));
$topic_tags = substr($topic_tags, 0, 254);
//die($topic_tags);
}
unset($class_topics_tags);
}
submit_post($mode, $post_data, $return_message, $return_meta, $forum_id, $topic_id, $post_id, $topic_type, $bbcode_on, $html_on, $acro_auto_on, $smilies_on, $attach_sig, $username, $subject, $topic_title_clean, $topic_tags, $message, $poll_title, $poll_options, $poll_data, $reg_active, $reg_reset, $reg_max_option1, $reg_max_option2, $reg_max_option3, $reg_length, $news_category, $topic_show_portal, $mark_edit, $topic_desc, $topic_calendar_time, $topic_calendar_duration);
}
break;
case 'delete':
case 'poll_delete':
if ($error_msg != '')
{
message_die(GENERAL_MESSAGE, $error_msg);
}
if (!class_exists('class_mcp')) include(IP_ROOT_PATH . 'includes/class_mcp.' . PHP_EXT);
if (empty($class_mcp)) $class_mcp = new class_mcp();
$class_mcp->post_delete($mode, $post_data, $return_message, $return_meta, $forum_id, $topic_id, $post_id);
break;
}
示例11: submit
/**
* Submits a new idea.
*
* @param string $title The title of the idea.
* @param string $message The description of the idea.
* @param int $user_id The ID of the author.
*
* @return array|int Either an array of errors, or the ID of the new idea.
*/
public function submit($title, $message, $user_id)
{
$error = array();
if (utf8_clean_string($title) === '') {
$error[] = $this->language->lang('TITLE_TOO_SHORT');
}
if (utf8_strlen($title) > 64) {
$error[] = $this->language->lang('TITLE_TOO_LONG');
}
if (utf8_strlen($message) < $this->config['min_post_chars']) {
$error[] = $this->language->lang('TOO_FEW_CHARS');
}
if (utf8_strlen($message) > $this->config['max_post_chars']) {
$error[] = $this->language->lang('TOO_MANY_CHARS');
}
if (count($error)) {
return $error;
}
// Submit idea
$sql_ary = array('idea_title' => $title, 'idea_author' => $user_id, 'idea_date' => time(), 'topic_id' => 0);
$idea_id = $this->insert_idea_data($sql_ary, 'table_ideas');
// Initial vote
$idea = $this->get_idea($idea_id);
$this->vote($idea, $this->user->data['user_id'], 1);
$uid = $bitfield = $options = '';
generate_text_for_storage($message, $uid, $bitfield, $options, true, true, true);
$data = array('forum_id' => (int) $this->config['ideas_forum_id'], 'topic_id' => 0, 'icon_id' => false, 'poster_id' => (int) $this->config['ideas_poster_id'], 'enable_bbcode' => true, 'enable_smilies' => true, 'enable_urls' => true, 'enable_sig' => true, 'message' => $message, 'message_md5' => md5($message), 'bbcode_bitfield' => $bitfield, 'bbcode_uid' => $uid, 'post_edit_locked' => 0, 'topic_title' => $title, 'notify_set' => false, 'notify' => false, 'post_time' => 0, 'forum_name' => 'Ideas forum', 'enable_indexing' => true, 'force_approved_state' => true);
// Get Ideas Bot info
$sql = 'SELECT *
FROM ' . USERS_TABLE . '
WHERE user_id = ' . (int) $this->config['ideas_poster_id'];
$result = $this->db->sql_query_limit($sql, 1);
$poster_bot = $this->db->sql_fetchrow($result);
$this->db->sql_freeresult($result);
$poster_bot['is_registered'] = true;
$tmpdata = $this->user->data;
$this->user->data = $poster_bot;
$poll = array();
submit_post('post', $title, $this->user->data['username'], POST_NORMAL, $poll, $data);
$this->user->data = $tmpdata;
// Edit topic ID into idea; both should link to each other
$sql_ary = array('topic_id' => $data['topic_id']);
$this->update_idea_data($sql_ary, $idea_id, 'table_ideas');
return $idea_id;
}
示例12: implode
if (sizeof($message_parser->warn_msg)) {
$error[] = implode('<br />', $message_parser->warn_msg);
$message_parser->warn_msg = array();
}
$message_parser->parse($post_data['enable_bbcode'], $config['allow_post_links'] ? $post_data['enable_urls'] : false, $post_data['enable_smilies'], $img_status, $flash_status, $quote_status, $config['allow_post_links']);
// on a refresh we do not care about message parsing errors
if (sizeof($message_parser->warn_msg) && $refresh) {
$message_parser->warn_msg = array();
}
} else {
$message_parser->bbcode_bitfield = $post_data['bbcode_bitfield'];
}
// grab md5 'checksum' of new message
$message_md5 = md5($message_parser->message);
$data = array('topic_title' => $title, 'topic_first_post_id' => isset($post_data['topic_first_post_id']) ? (int) $post_data['topic_first_post_id'] : 0, 'topic_last_post_id' => isset($post_data['topic_last_post_id']) ? (int) $post_data['topic_last_post_id'] : 0, 'topic_time_limit' => (int) $post_data['topic_time_limit'], 'topic_attachment' => isset($post_data['topic_attachment']) ? (int) $post_data['topic_attachment'] : 0, 'post_id' => (int) $post_id, 'topic_id' => (int) $topic_id, 'forum_id' => (int) $forum_id, 'icon_id' => (int) $post_data['icon_id'], 'poster_id' => (int) $post_data['poster_id'], 'enable_sig' => (bool) $post_data['enable_sig'], 'enable_bbcode' => (bool) $post_data['enable_bbcode'], 'enable_smilies' => (bool) $post_data['enable_smilies'], 'enable_urls' => (bool) $post_data['enable_urls'], 'enable_indexing' => (bool) $post_data['enable_indexing'], 'message_md5' => (string) $message_md5, 'post_time' => isset($post_data['post_time']) ? (int) $post_data['post_time'] : $current_time, 'post_checksum' => isset($post_data['post_checksum']) ? (string) $post_data['post_checksum'] : '', 'post_edit_reason' => $post_data['post_edit_reason'], 'post_edit_user' => $mode == 'edit' ? $user->data['user_id'] : (isset($post_data['post_edit_user']) ? (int) $post_data['post_edit_user'] : 0), 'forum_parents' => $post_data['forum_parents'], 'forum_name' => $post_data['forum_name'], 'notify' => $notify, 'notify_set' => $post_data['notify_set'], 'poster_ip' => isset($post_data['poster_ip']) ? $post_data['poster_ip'] : $user->ip, 'post_edit_locked' => (int) $post_data['post_edit_locked'], 'bbcode_bitfield' => $message_parser->bbcode_bitfield, 'bbcode_uid' => $message_parser->bbcode_uid, 'message' => $message_parser->message, 'attachment_data' => $message_parser->attachment_data, 'filename_data' => $message_parser->filename_data, 'topic_approved' => isset($post_data['topic_approved']) ? $post_data['topic_approved'] : false, 'post_approved' => isset($post_data['post_approved']) ? $post_data['post_approved'] : false);
$output = clean(submit_post($mode, $title, $username, POST_NORMAL, $poll, $data, $update_message, 0));
}
}
// ***************************
// ********* SEARCH **********
// ***************************
if ($search) {
include $phpbb_root_path . 'includes/functions_display.' . $phpEx;
// configure style, language, etc.
$user->setup('viewforum', $user->data['user_style']);
// figure out what kind of reply counter to use
$replyStr = $auth->acl_get('m_approve', $id) ? 'topic_replies_real' : 'topic_replies';
// topic approved
$sql_approved = $auth->acl_get('m_approve', $id) ? '' : ' AND ' . TOPICS_TABLE . '.topic_approved = 1';
$sql = "SELECT topic_id,topic_moved_id,topic_title,topic_last_post_time,topic_last_poster_name,username,topic_time,topic_views,{$replyStr},forum_id FROM (" . TOPICS_TABLE . ") LEFT JOIN " . USERS_TABLE . " ON user_id=topic_poster WHERE topic_title LIKE '%" . $db->sql_escape($search) . "%' AND topic_type IN (" . POST_NORMAL . "){$sql_approved} ORDER BY topic_type DESC,topic_last_post_time DESC";
$result = $db->sql_query($sql);
示例13: array
$sql = 'UPDATE ' . FORUMS_TOPICS_TABLE . "\n\t\t\t\t\tSET topic_status = {$change_topic_status}\n\t\t\t\t\tWHERE topic_id = {$topic_id}\n\t\t\t\t\t\tAND topic_moved_id = 0";
$_CLASS['core_db']->query($sql);
$user_lock = $_CLASS['auth']->acl_get('f_user_lock', $forum_id) && $_CLASS['core_user']->is_user && $_CLASS['core_user']->data['user_id'] == $topic_poster ? 'USER_' : '';
//add_log('mod', $forum_id, $topic_id, 'LOG_' . $user_lock . (($change_topic_status == ITEM_LOCKED) ? 'LOCK' : 'UNLOCK'), $posting_data['topic_title']);
}
// Lock/Unlock Post Edit
if ($mode == 'edit' && $posting_data['post_edit_locked'] == ITEM_LOCKED && !$post_lock && $_CLASS['auth']->acl_get('m_edit', $forum_id)) {
$posting_data['post_edit_locked'] = ITEM_UNLOCKED;
} else {
if ($mode == 'edit' && $posting_data['post_edit_locked'] == ITEM_UNLOCKED && $post_lock && $_CLASS['auth']->acl_get('m_edit', $forum_id)) {
$posting_data['post_edit_locked'] = ITEM_LOCKED;
}
}
$post_data = array('topic_title' => !$posting_data['topic_title'] ? $subject : $posting_data['topic_title'], 'topic_first_post_id' => isset($topic_first_post_id) ? (int) $topic_first_post_id : 0, 'topic_last_post_id' => isset($topic_last_post_id) ? (int) $topic_last_post_id : 0, 'topic_time_limit' => (int) $topic_time_limit, 'topic_status' => (int) $posting_data['topic_status'], 'post_id' => (int) $post_id, 'topic_id' => (int) $topic_id, 'forum_id' => (int) $forum_id, 'icon_id' => (int) $icon_id, 'poster_id' => (int) $posting_data['poster_id'], 'enable_sig' => (bool) $enable_sig, 'enable_bbcode' => (bool) $enable_bbcode, 'enable_html' => (bool) $enable_html, 'enable_smilies' => (bool) $enable_smilies, 'enable_urls' => (bool) $enable_urls, 'enable_indexing' => (bool) $enable_indexing, 'message_md5' => (string) $message_md5, 'post_time' => $posting_data['post_time'] ? (int) $posting_data['post_time'] : $current_time, 'post_checksum' => isset($post_checksum) ? (string) $post_checksum : '', 'post_edit_reason' => $posting_data['post_edit_reason'], 'post_edit_user' => $mode == 'edit' ? $_CLASS['core_user']->data['user_id'] : (isset($post_edit_user) ? (int) $post_edit_user : 0), 'forum_parents' => $forum_parents, 'forum_name' => $forum_name, 'notify' => $notify, 'notify_set' => $notify_set, 'poster_ip' => isset($poster_ip) ? (int) $poster_ip : $_CLASS['core_user']->ip, 'post_edit_locked' => (int) $posting_data['post_edit_locked'], 'bbcode_bitfield' => (int) $message_parser->bbcode_bitfield, 'bbcode_uid' => $message_parser->bbcode_uid, 'message' => $message_parser->message, 'attachment_data' => $message_parser->attachment_data, 'filename_data' => $message_parser->filename_data);
unset($message_parser);
submit_post($mode, $subject, $posting_data['username'], $posting_data['topic_type'], $poll, $post_data, $update_message);
}
}
$post_subject = stripslashes($subject);
}
// Preview
if (!sizeof($error) && $preview) {
$posting_data['post_time'] = $mode == 'edit' ? $posting_data['post_time'] : $current_time;
$preview_message = $message_parser->format_display($enable_html, $enable_bbcode, $enable_urls, $enable_smilies, false);
$preview_signature = $mode == 'edit' ? $user_sig : $_CLASS['core_user']->data['user_sig'];
$preview_signature_uid = $mode == 'edit' ? $user_sig_bbcode_uid : $_CLASS['core_user']->data['user_sig_bbcode_uid'];
$preview_signature_bitfield = $mode == 'edit' ? $user_sig_bbcode_bitfield : $_CLASS['core_user']->data['user_sig_bbcode_bitfield'];
// Signature
if ($enable_sig && $config['allow_sig'] && $preview_signature && $_CLASS['auth']->acl_get('f_sigs', $forum_id)) {
$parse_sig = new parse_message($preview_signature);
$parse_sig->bbcode_uid = $preview_signature_uid;
示例14: make_apply_posting
/**
* post application on forum
*
* @param array $post_data
* @param array $current_time
* @param string $candidate_name
* @param int $template_id
*/
public function make_apply_posting($post_data, $current_time, $candidate_name, $template_id)
{
global $auth, $config, $db, $user, $phpbb_root_path, $phpEx, $captcha;
$candidate = new \bbdkp\apply\dkp_character();
$candidate->name = $candidate_name;
$sql = "SELECT * from " . APPTEMPLATELIST_TABLE . " WHERE template_id = " . $template_id;
$result = $db->sql_query($sql);
$row = $db->sql_fetchrow($result);
if (isset($row)) {
$this->questioncolor = $row['question_color'];
$this->answercolor = $row['answer_color'];
$this->gchoice = $row['gchoice'];
// add char to guild ?
$this->candidate_guild_id = $row['guild_id'];
$this->statsposition = $row['statpos'];
}
$Guild = new \bbdkp\controller\guilds\Guilds($this->candidate_guild_id);
$candidate->build_candidate($this);
// if user belongs to group that can add a character then attempt to register a dkp character
// guests should never be able to register characters (i.e user anonymous)
if ($auth->acl_get('u_dkp_charadd')) {
$candidate->register_bbdkp($Guild);
}
// build post
$this->message = '';
// load formatted questions and answers, max 100
$sql = "SELECT * FROM " . APPTEMPLATE_TABLE . ' WHERE template_id = ' . $template_id . ' ORDER BY qorder';
$result = $db->sql_query_limit($sql, 100, 0);
$this->titlecount = 0;
while ($row = $db->sql_fetchrow($result)) {
switch ($row['type']) {
case 'title':
$this->build_title_open($row['header']);
break;
case 'charname':
if (isset($_POST['candidate_name'])) {
$this->build_candidate_name($candidate, $Guild);
if ($this->statsposition == 'APPLY_TOP') {
$this->build_WoW_statistics($candidate);
}
}
break;
case 'Checkboxes':
if (isset($_POST['templatefield_' . $row['qorder']])) {
$this->build_checkboxes($row['header'], $row['question'], $row['qorder'], $row['showquestion']);
}
break;
case 'Inputbox':
case 'Textbox':
case 'Textboxbbcode':
case 'Selectbox':
case 'Radiobuttons':
if (isset($_POST['templatefield_' . $row['qorder']])) {
$this->build_textbox_answers($row['question'], $row['qorder'], $row['showquestion']);
}
break;
}
}
$this->build_title_close();
if ($this->statsposition == 'APPLY_BOTTOM') {
$this->build_WoW_statistics($candidate);
}
$db->sql_freeresult($result);
// variables to hold the parameters for submit_post
$poll = $uid = $bitfield = $options = '';
// parsed code
generate_text_for_storage($this->message, $uid, $bitfield, $options, true, true, true);
// subject & username
//$post_data['post_subject'] = utf8_normalize_nfc(request_var('headline', $user->data['username'], true));
$post_subj = (string) $candidate->name . " - " . $candidate->level . " " . $candidate->race . " " . $candidate->class;
// Store message, sync counters
$data = array('forum_id' => (int) $post_data['forum_id'], 'topic_first_post_id' => 0, 'topic_last_post_id' => 0, 'topic_attachment' => 0, 'icon_id' => false, 'enable_bbcode' => true, 'enable_smilies' => true, 'enable_urls' => true, 'enable_sig' => true, 'message' => $this->message, 'message_md5' => md5($this->message), 'bbcode_bitfield' => $bitfield, 'bbcode_uid' => $uid, 'topic_title' => $post_subj, 'notify_set' => false, 'notify' => false, 'post_time' => $current_time, 'poster_ip' => $user->ip, 'forum_name' => '', 'post_edit_locked' => 1, 'enable_indexing' => true, 'post_approved' => 1);
//submit post
$post_url = submit_post('post', $post_subj, $user->data['username'], POST_NORMAL, $poll, $data);
$redirect_url = $post_url;
if ($config['enable_post_confirm'] && (isset($captcha) && $captcha->is_solved() === true)) {
$captcha->reset();
}
//redirect to post
meta_refresh(3, $redirect_url);
$message = 'POST_STORED';
$message = $user->lang[$message] . '<br /><br />' . sprintf($user->lang['VIEW_MESSAGE'], '<a href="' . $redirect_url . '">', '</a>');
$message .= '<br /><br />' . sprintf($user->lang['RETURN_FORUM'], '<a href="' . append_sid("{$phpbb_root_path}viewforum.{$phpEx}", 'f=' . $data['forum_id']) . '">', '</a>');
trigger_error($message);
}
示例15: array
'notify_set' => '',
'post_time' => $article_data['post_time'],
'forum_name' => $forum_data['forum_name'],
'post_edit_reason' => $article_data['post_edit_reason'],
'topic_replies_real' => $article_data['topic_replies_real'],
'poster_id' => $article_data['poster_id'],
'post_id' => &$article_data['post_id'],
'topic_id' => &$article_data['topic_id'],
'topic_poster' => $article_data['topic_poster'],
'topic_first_post_id' => $article_data['topic_first_post_id'],
'topic_last_post_id' => $article_data['topic_last_post_id'],
);
$poll = false;
submit_post(($mode == 'add' ? 'post' : 'edit'), $article_data['article_title'], $article_data['topic_first_poster_name'], POST_NORMAL, $poll, $data);
/**
* Insert into our own custom database
*/
$sql_ary = array(
'topic_id' => $article_data['topic_id'],
'article_name' => $article_data['article_name'],
'article_desc' => $article_data['article_desc'],
'article_content' => $article_content_parsed,
);
if ($mode == 'add')
{
$sql = 'INSERT INTO ' . KB_ARTICLES_TABLE . ' ' . $db->sql_build_array('INSERT', $sql_ary);
$db->sql_query($sql);