Got an iPhone or iPad? We have a brand new Pastebin App for both devices, and it's totally free! Click here to download the new Pastebin App for iOS.
Guest

webweyer

By: a guest on Mar 9th, 2008  |  syntax: PHP  |  size: 1.81 KB  |  hits: 205  |  expires: Never
download  |  raw  |  embed  |  report abuse
Copied
  1. function insert_forum($titre,$contenu) {
  2.         //Inclusion du fichier d'insertion phpBB
  3.         $phpbb_root_path='../forum/';
  4.         $phpEx='php';
  5.         global $auth;
  6.         global $user;
  7.         include($phpbb_root_path . 'includes/bbcode.' . $phpEx);
  8.         include($phpbb_root_path . 'includes/functions_posting.' . $phpEx);
  9.         $robot_user_id=53;
  10.         $robot_username='Ski-karellis.net';
  11.         $backup_ip = $user->ip;
  12.         $user->ip = '0.0.0.0';
  13.        
  14.         $backup_username = $user->data['username'];
  15.         $user->data['username'] = $robot_username;
  16.                
  17.         $backup_user_id = $user->data['user_id'];
  18.         $user->data['user_id'] = $robot_user_id;
  19.        
  20.        
  21.         $auth->acl($user->data);
  22.        
  23.         // note that multibyte support is enabled here
  24.         $my_subject   = utf8_normalize_nfc($titre);
  25.         $my_text   = utf8_normalize_nfc(nl2br($contenu));
  26.        
  27.         // variables to hold the parameters for submit_post
  28.         $poll = $uid = $bitfield = $options = '';
  29.        
  30.         generate_text_for_storage($my_subject, $uid, $bitfield, $options, false, false, false);
  31.         generate_text_for_storage($my_text, $uid, $bitfield, $options, true, true, true);
  32.        
  33.         $data = array(
  34.         'forum_id'      => 7,
  35.         'icon_id'      => false,
  36.        
  37.        'enable_bbcode'      => true,
  38.        'enable_smilies'   => true,
  39.        'enable_urls'      => true,
  40.        'enable_sig'      => true,
  41.  
  42.        'message'      => $my_text,
  43.        'message_md5'   => md5($my_text),
  44.                
  45.        'bbcode_bitfield'   => $bitfield,
  46.        'bbcode_uid'      => $uid,
  47.  
  48.        'post_edit_locked'   => 0,
  49.        'topic_title'      => $my_subject,
  50.        'notify_set'      => false,
  51.        'notify'         => false,
  52.        'post_time'       => 0,
  53.        'forum_name'      => '',
  54.        'enable_indexing'   => true,
  55.        );
  56.        if(submit_post('post', $my_subject, '', POST_NORMAL, $poll, $data)) {
  57.                return TRUE;
  58.        }
  59.        else {
  60.                return FALSE;
  61.        }
  62. }