Changeset 2390 for trunk/bb-post.php
- Timestamp:
- 01/13/2010 09:47:16 PM (16 years ago)
- File:
-
- 1 edited
-
trunk/bb-post.php (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/bb-post.php
r2075 r2390 2 2 require('./bb-load.php'); 3 3 4 bb_auth('logged_in'); 4 if ( bb_is_login_required() ) { 5 bb_auth('logged_in'); 6 } 5 7 6 if ( $throttle_time = bb_get_option( 'throttle_time' ) ) 7 if ( isset($bb_current_user->data->last_posted) && time() < $bb_current_user->data->last_posted + $throttle_time && !bb_current_user_can('throttle') ) 8 bb_die(__('Slow down; you move too fast.')); 8 bb_check_comment_flood(); 9 9 10 10 if ( !$post_content = trim($_POST['post_content']) ) 11 11 bb_die(__('You need to actually submit some content!')); 12 12 13 $post_author = $post_email = $post_url = ''; 14 15 if ( ! bb_is_user_logged_in() ) { 16 if ( bb_is_login_required() ) { 17 bb_die(__('You are not allowed to post. Are you logged in?')); 18 } else { 19 if ( ! $post_author = trim($_POST['author']) ) { 20 bb_die(__('You need to submit your name!')); 21 } elseif ( ! $post_email = trim($_POST['email']) ) { 22 bb_die(__('You need to submit your email!')); 23 } 24 25 if ( ! empty( $_POST['url'] ) ) { 26 $post_url = trim($_POST['url']); 27 } 28 } 29 } 30 31 32 33 13 34 if ( isset($_POST['topic']) && $forum_id = (int) $_POST['forum_id'] ) { 14 if ( !bb_current_user_can('write_posts') )35 if ( bb_is_login_required() && ! bb_current_user_can('write_posts') ) 15 36 bb_die(__('You are not allowed to post. Are you logged in?')); 16 37 17 if ( !bb_current_user_can( 'write_topic', $forum_id ) )38 if ( bb_is_login_required() && ! bb_current_user_can( 'write_topic', $forum_id ) ) 18 39 bb_die(__('You are not allowed to write new topics.')); 19 40 … … 33 54 } 34 55 35 if ( !bb_current_user_can( 'write_post', $topic_id ) )56 if ( bb_is_login_required() && ! bb_current_user_can( 'write_post', $topic_id ) ) 36 57 bb_die(__('You are not allowed to post. Are you logged in?')); 37 58 … … 39 60 bb_die(__('This topic has been closed')); 40 61 41 $post_id = bb_new_post( $topic_id, $_POST['post_content'] ); 62 $post_data = array( 63 'post_text' => stripslashes($_POST['post_content']), 64 'topic_id' => $topic_id, 65 ); 66 67 foreach( array('post_author', 'post_email', 'post_url') as $field ) { 68 if ( ! empty( $$field ) ) { 69 $post_data[$field] = $$field; 70 } 71 } 72 73 $post_id = bb_insert_post($post_data); 42 74 43 75 $tags = trim( $_POST['tags'] );
Note: See TracChangeset
for help on using the changeset viewer.