Example #1
0
     // we only need to check for comment managing and content data if we are editing a comment
     if ($action == 'edit_comment') {
         if (!$auth->acl_get('a_blog_manage') && !$auth->acl_get('u_blog_comment_manage')) {
             trigger_error($user->lang['UNAUTHED']);
         } else {
             if (!($comment_data = blog::get_comment_data($cid))) {
                 trigger_error($user->lang['INVALID_CMNT_ID'] . '<BR /><BR /><a href="' . append_sid("{$phpbb_root_path}blog.{$phpEx}") . '">' . $user->lang['RETURN'] . '</a>');
             }
         }
     }
     if (!empty($_POST['submit'])) {
         $id = $action == 'edit_comment' ? $comment_data['cmnt_blog_id'] : request_var('id', 0);
         $approved = $auth->acl_get('u_blog_approved') ? true : false;
         $data = array('cmnt_text' => utf8_normalize_nfc(request_var('message', '', true)), 'cmnt_blog_id' => $id, 'cmnt_poster_id' => $user->data['user_id'], 'cmnt_approved' => $approved, 'enable_bbcode' => $config['blog_bbcode_on'] && $auth->acl_get('u_blog_bbcode'), 'enable_smilies' => $config['blog_emote_on'] && $auth->acl_get('u_block_emote'));
         $mode = $action == 'post_comment' ? 'new' : 'update';
         $comment = blog::submit_comment($mode, $id, $data, $cid);
         $message = $approved ? $user->lang['CMNTSUCCESS'] : $user->lang['RETURN'];
         $submessage = $approved ? $user->lang['RETURN_CMNT'] : $user->lang['RETURN'];
         $u_action = append_sid("{$phpbb_root_path}blog.{$phpEx}", array($act_name => 'view', 'id' => $id)) . '#comment' . $comment;
         meta_refresh('3', $u_action);
         trigger_error($message . '<BR /><BR /><a href="' . $u_action . '">' . $submessage . '</a>');
     }
     // if the form has not been submit, display it.
     decode_message($comment_data['cmnt_text'], $comment_data['bbcode_uid']);
     $template->assign_vars(array('MESSAGE' => $comment_data['cmnt_text'], 'CMNT_BLOG_ID' => $comment_data['cmnt_blog_id'], 'U_ACTION' => append_sid("{$phpbb_root_path}blog.{$phpEx}", array($act_name => 'edit_comment', 'cid' => $cid))));
     page_header($user->lang('BLOG'));
     $template->set_filenames(array('body' => 'blog_comment_edit_body.html'));
     page_footer();
     break;
 case 'delete_comment':
     $cid = request_var('cid', 0);