b2evolution PHP Cross Reference Blogging Systems

Source: /inc/tools/wpimport.ctrl.php - 575 lines - 20734 bytes - Summary - Text - Print

   1  <?php
   2  /* WordPress 2.3 to b2evolution 2.0 alpha converter
   3     Copyright (C) 2007 V.Harishankar.
   4  
   5     Please use this with care and at your own discretion. This script will try and import the following from
   6     WP to b2evolution:
   7      1. posts
   8      2. comments
   9      3. categories
  10      4. users
  11  
  12     This is alpha software and subject to change.
  13  */
  14  if( !defined('EVO_MAIN_INIT') ) die( 'Please, do not access this page directly.' );
  15  
  16      // set error reporting to full in order to get useful info when something fails
  17      $prevlevel = error_reporting (E_ALL);
  18  
  19      ?>
  20  <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
  21  <html>
  22  
  23  <head>
  24    <title>WP to b2evolution Converter</title>
  25    <meta name="GENERATOR" content="Quanta Plus">
  26    <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
  27  </head>
  28  <body bgcolor="#EEEEEE" text="#000000" link="#0000FF" alink="#FF0000" vlink="#7E0089">
  29      <h1>WordPress 2.3 to b2evolution importer</h1>
  30      [<a href="<?php echo $dispatcher ?>?ctrl=tools">Back to b2evolution</a>]
  31      <p><FONT SIZE="-2">Copyright &copy; 2007 <a href="http://hari.literaryforums.org/2007/10/04/wordpress-to-b2evolution-import-script">V.Harishankar</a>.  Released under the GNU GPL.</FONT></p>
  32      <?php
  33  
  34      // Check if user is logged in and is in group #1 (admins)
  35      if( !is_logged_in( false ) || $current_User->grp_ID != 1 )
  36      {    // login failed
  37          debug_die( 'You must login with an administrator (group #1) account.' );
  38      }
  39  
  40      // The form has not yet been posted
  41      if ( ! isset ( $_POST['wp_db'] ) ) { ?>
  42          <P>Before running this importer, you must ensure that a proper <font color="#00CC00"><strong><em>NEW, EMPTY</em></strong></font> installation of b2evolution 2 exists! <strong><font color="#FF0000">IMPORTANT</font></strong>: This works <strong>only</strong> with WordPress 2.3 and above.</P>
  43  
  44          <p><font color="#FF0000"><strong>Warning!!</strong> Your existing b2evolution posts, categories, tags, comments and users (except admin) will be removed if you run this script. Make sure you have a backup before you proceed.</font></p>
  45  
  46          <FORM action="<?php echo $dispatcher ?>?ctrl=wpimport" enctype="multipart/form-data" method="POST" >
  47          <h2>DB Settings</h2>
  48          <table>
  49              <tbody>
  50              <tr>
  51              <td>WordPress database name</td>
  52              <td><INPUT type="text" name="wp_db"><br></td>
  53              </tr>
  54  
  55              <tr>
  56              <td>WordPress table prefix</td>
  57              <td><INPUT type="text" name="wp_prefix" value="wp_"><br></td>
  58              </tr>
  59  
  60              <tr>
  61              <td>b2evolution database</td>
  62              <td><INPUT type="text" name="b2evo_db" value="<?php echo $db_config['name'] ?>"></td>
  63              </tr>
  64              
  65              <tr>
  66              <td>b2evolution table prefix</td>
  67              <td><INPUT type="text" name="b2evo_prefix" value="<?php echo $tableprefix ?>"></td>
  68              </tr>
  69  
  70              <tr>
  71              <td>Database host</td>
  72              <td><INPUT type="text" name="db_host" value="<?php echo $db_config['host'] ?>"></td>
  73              </tr>
  74  
  75              <tr>
  76              <td>Username</td>
  77              <td><INPUT type="text" name="db_user" value="<?php echo $db_config['user'] ?>"></td>
  78              </tr>
  79  
  80              <tr>
  81              <td>Password</td>
  82              <td><INPUT type="password" name="db_pass" value="<?php echo $db_config['password'] ?>"></td>
  83              </tr>
  84  
  85              <tr>
  86              <td>Default locale for imported posts</td>
  87              <td><INPUT type="text" name="locale" value="en-US"></td>
  88              </tr>
  89  
  90              <tr>
  91              <td></td>
  92              <td><INPUT type="submit" value="import"></td>
  93              </tr>
  94              </tbody>
  95              </table>
  96  
  97          </FORM>
  98      <?php // The form has been posted; do the conversion
  99          }
 100          else
 101          {
 102              // Try to obtain some serious time to do some serious processing (15 minutes)
 103              set_max_execution_time(900);
 104  
 105              // required fields initialization
 106              $wp_db = $_POST['wp_db'];
 107              $evo_db = $_POST['b2evo_db'];
 108              $host = $_POST['db_host'];
 109              $user = $_POST['db_user'];
 110              $password = $_POST['db_pass'];
 111              $wp = $_POST['wp_prefix'];
 112              $b2 = $_POST['b2evo_prefix'];
 113              $locale = $_POST['locale'];
 114  
 115              // establish database connection
 116              $con = mysql_connect ($host, $user, $password);
 117              if (! $con )
 118                  die ( 'Error connecting to MySQL. Please check whether the server is running and the host, username and password fields are correct!' );
 119  
 120              // First remove existing database items in categories, users, postcats, items__item, comments, blogusers
 121              $db = mysql_select_db ($evo_db, $con);
 122              if (! $db)
 123                  die ('b2evolution database name is incorrect. Please check your b2evolution installation.');
 124  
 125              $query = 'DELETE FROM '.$b2.'categories;';
 126              $flag = mysql_query ($query);
 127              if (! $flag )
 128                  die ('Existing categories deleting failed. Cannot proceed.');
 129  
 130              $query = 'DELETE FROM '.$b2.'items__item;';
 131              $flag = mysql_query ($query);
 132              if (! $flag )
 133                  die ('Existing posts deletion failed. Cannot proceed.');
 134  
 135              $query = 'DELETE FROM '.$b2.'postcats;';
 136              $flag = mysql_query ($query);
 137              if (! $flag )
 138                  die ('Existing post categories deletion failed. Cannot proceed.');
 139  
 140              $query = 'DELETE FROM '.$b2.'comments;';
 141              $flag = mysql_query ($query);
 142              if (! $flag )
 143                  die ('Existing comments deletion failed. Cannot proceed.');
 144  
 145              $query = 'DELETE FROM '.$b2.'items__itemtag;';
 146              $flag = mysql_query ($query);
 147              if (! $flag )
 148                  die ('Existing post tags deletion failed. Cannot proceed.');
 149  
 150              $query = 'DELETE FROM '.$b2.'items__tag;';
 151              $flag = mysql_query ($query);
 152              if (! $flag )
 153                  die ('Existing tags deletion failed. Cannot proceed.');
 154  
 155              $query = 'DELETE FROM '.$b2.'users WHERE user_ID <> 1;';
 156              $flag = mysql_query ($query);
 157              if (! $flag )
 158                  die ('Existing users deletion failed. Cannot proceed.');
 159  
 160              $query = 'DELETE FROM '.$b2.'blogusers WHERE bloguser_user_ID <> 1;';
 161              $flag = mysql_query ($query);
 162              if (! $flag )
 163                  die ('Existing user permissions deletion failed. Cannot proceed.');
 164  
 165              // CATEGORIES + TAGS
 166              echo '<h2>Trying to import categories and tags:</h2>';
 167              $cats = array();
 168              $tags = array();
 169  
 170              // select the wordpress database
 171              $db = mysql_select_db ($wp_db, $con);
 172              if (! $db)
 173                  die ('WordPress database name is incorrect. Please check the name and try again.');
 174  
 175              // get the list of taxonomy terms. includes categories, link cats and tags as well
 176              $query = 'SELECT *
 177                                      FROM '.$wp.'terms;' ;
 178              $res = mysql_query ($query);
 179              if (! $res )
 180                  die ('Query failed. Please check your WordPress installation.');
 181  
 182              $i = 0;
 183              while( $row = mysql_fetch_array ($res, MYSQL_ASSOC) )
 184              {
 185                  // in order to establish whether a term is a category or not
 186                  $query2 = 'SELECT *
 187                                       FROM '.$wp.'term_taxonomy
 188                                      WHERE term_id='.$row['term_id'].';';
 189                  $res2 = mysql_query ($query2);
 190                  if (! $res2)
 191                      die ('Query 2 failed. Please check your WordPress installation.');
 192                  $row2 = mysql_fetch_array ($res2, MYSQL_ASSOC);
 193  
 194                  // if it is a category only then import. ignore tags and link categories
 195                  switch( $row2['taxonomy'] )
 196                  {
 197                      case 'category':
 198                          echo 'Reading cat: '.$row['name'].'<br>';
 199                          $cats[$i]['name'] = $row['name'];
 200                          $cats[$i]['slug'] = $row['slug'];
 201                          $cats[$i]['description'] = $row2['description'];
 202                          $cats[$i]['cat_id'] = $row2['term_taxonomy_id'];
 203                          $i ++;
 204                          break;
 205  
 206                      case 'post_tag':
 207                          echo 'Reading tag: '.$row['name'].'<br>';
 208                          $tag_id = $row2['term_taxonomy_id'];
 209                          $tags[$tag_id]['name'] = evo_strtolower( $row['name'] );
 210                          $tags[$tag_id]['slug'] = $row['slug'];
 211                          $tags[$tag_id]['description'] = $row2['description'];
 212                          break;
 213                  }
 214                  mysql_free_result ($res2);
 215              }
 216              mysql_free_result ($res);
 217  
 218              if( empty($cats) )
 219              {
 220                  die( 'There must be at least one category!' );
 221              }
 222  
 223              // Use the first category as the default category in case we find uncategorized posts later on.
 224              $default_category_ID = $cats[0]['cat_id'];
 225  
 226              // select the evolution database
 227              $db = mysql_select_db ($evo_db, $con);
 228              if (! $db)
 229                  die ('b2evolution database name is incorrect. Please check the name and try again.');
 230              foreach ($cats as $category)
 231              {
 232                  // insert each category into the evolution database
 233                  $query = 'INSERT INTO '.$b2.'categories (cat_ID, cat_name, cat_urlname, cat_blog_ID, cat_description) VALUES ("'.$category['cat_id'].'", "'.$category['name'].'", "'.$category['slug'].'", "1", "'.$category['description'].'");';
 234  
 235                  $flag = mysql_query ($query);
 236  
 237                  if (! $flag )
 238                      die ('Category importing failed. Please check your b2evolution installation.');
 239              }
 240              echo '<font color="#00CC00">Categories inserted successfully!</font><br>';
 241  
 242              // INSERT TAGS:
 243              foreach( $tags as $tag_id => $tag )
 244              {
 245                  // insert each tags into the evolution database
 246                  $query = 'INSERT INTO '.$b2.'items__tag(tag_ID, tag_name)
 247                                      VALUES ( '.$tag_id.', "'.evo_substr($tag['name'],0,50).'" );';
 248                  $flag = mysql_query ($query);
 249  
 250                  if(! $flag )
 251                  {
 252                      pre_dump($query);
 253                      die ('Tag importing failed. Please check your b2evolution installation.');
 254                  }
 255              }
 256              echo '<font color="#00CC00">Tags inserted successfully!</font><br>';
 257  
 258  
 259              // Now import the posts into b2evolution
 260              echo '<h2>Trying to import posts</h2>';
 261  
 262              $posts = array ();
 263              $db = mysql_select_db ($wp_db, $con);
 264              if (! $db)
 265                  die ('WordPress database name is incorrect. Please check the name and try again.');
 266  
 267              $query = 'SELECT * FROM '.$wp.'posts WHERE post_type="post" OR post_type="page";' ;
 268              $res = mysql_query ($query);
 269              if (! $res )
 270                  die ('Query failed. Please check your WordPress installation.');
 271  
 272              $i = 0;
 273              while ( $row = mysql_fetch_array ($res, MYSQL_ASSOC) )
 274              {
 275                  $posts[$i]['post_id'] = $row['ID'];
 276                  $posts[$i]['slug'] = $row['post_name'];
 277                  $posts[$i]['title'] = $row['post_title'];
 278                  $posts[$i]['status'] = $row['post_status'];
 279                  $posts[$i]['create_date'] = $row['post_date'];
 280                  $posts[$i]['modified_date'] = $row['post_modified'];
 281                  $posts[$i]['excerpt'] = $row['post_excerpt'];
 282                  $posts[$i]['comment_status'] = $row['comment_status'];
 283                  $posts[$i]['content'] = $row['post_content'];
 284                  $posts[$i]['author'] = $row['post_author'];
 285                  $posts[$i]['type'] = 1;
 286  
 287                  if (strcmp ($row['post_type'], 'page') == 0)
 288                      $posts[$i]['type'] = 1000;
 289  
 290                  echo 'Reading: '.$posts[$i]['title'].'<br>';
 291  
 292                  // Now to get the cats for each post. Includes both CATS and TAGS
 293                  $j = 0;
 294                  $posts[$i]['cats'] = array ();
 295                  $posts[$i]['tags'] = array ();
 296  
 297                  // Get all reltated terms:
 298                  $query2 = 'SELECT *
 299                                           FROM '.$wp.'term_relationships
 300                                          WHERE object_id='.$row['ID'].'; ';
 301                  $res2 = mysql_query ($query2);
 302                  if (! $res2)
 303                      die ('Query 2 failed. Please check your WordPress installation.');
 304  
 305                  // Lop through terms
 306                  while( $row2 = mysql_fetch_array ($res2, MYSQL_ASSOC) )
 307                  {
 308                      // Get each specific term:
 309                      $query3 = 'SELECT *
 310                                               FROM '.$wp.'term_taxonomy
 311                                              WHERE term_taxonomy_id='.$row2['term_taxonomy_id'].';';
 312                      $res3 = mysql_query ($query3);
 313                      if (! $res3 )
 314                          die ('Query 3 failed. Please check your WordPress installation.');
 315                      $row3 = mysql_fetch_array ($res3, MYSQL_ASSOC);
 316                      switch( $row3['taxonomy'] )
 317                      {
 318                          case 'category':
 319                              $posts[$i]['cats'][$j] = $row2['term_taxonomy_id'];
 320                              $j ++;
 321                              break;
 322  
 323                          case 'post_tag':
 324                              $posts[$i]['tags'][] = $row2['term_taxonomy_id'];
 325                              break;
 326                      }
 327  
 328                      mysql_free_result ($res3);
 329                  }
 330                  mysql_free_result ($res2);
 331                  $i ++;
 332              }
 333              mysql_free_result ($res);
 334  
 335              // select the evolution database
 336              $db = mysql_select_db ($evo_db, $con);
 337              if (! $db)
 338                  die ('b2evolution database name is incorrect. Please check the name and try again.');
 339  
 340  			function fix_date( $date )
 341              {
 342                  if( $date == '0000-00-00 00:00:00' )
 343                  {
 344                      $date = '2000-01-01 00:00:00';
 345                  }
 346                  return $date;
 347              }
 348  
 349  			function convert_status( $status )
 350              {
 351                  switch( $status )
 352                  {
 353                      case 'publish':
 354                          return 'published';
 355  
 356                      case 'pivate':
 357                          return 'private';
 358  
 359                      default:
 360                          return 'draft';
 361                  }
 362              }
 363  
 364              foreach ($posts as $post)
 365              {
 366                  echo '<br/>Inserting: '.$post['title'];
 367  
 368                  // Check that we have at least one category:
 369                  if( empty($post['cats']) )
 370                  {    // Use default category:
 371                      $post['cats'][0] = $default_category_ID;
 372                  }
 373  
 374                  // set the post rendering options. TODO: this could probably be an option for the user before importing
 375                  $postrenderers = 'b2evSmil.b2evALnk.b2WPAutP';
 376  
 377                  // Check that slug is not empty. Mind you, in WP it CAN happen!
 378                  if( empty( $post['slug'] ) )
 379                  {
 380                      $post['slug'] = preg_replace( '/[^a-z0-9]/i', '-', $post['post_id'].'-'.$post['title'] );
 381                      echo '<br /> ** WARNING: generated automatic slug: '.$post['slug'];
 382                  }
 383  
 384                  // query to insert the posts into the b2evolution table
 385                  $query = 'INSERT INTO '.$b2.'items__item (post_ptyp_ID, post_ID, post_main_cat_ID, post_creator_user_ID,
 386                                                              post_lastedit_user_ID, post_datestart, post_datecreated, post_datemodified, post_status,
 387                                                              post_locale, post_content, post_excerpt, post_title, post_urltitle, post_comment_status,
 388                                                              post_renderers)
 389                  VALUES ("'. $post['type'].'", "'.$post['post_id'].'", "'.$post['cats'][0].'", "'. $post['author'].'", "'
 390                                          .$post['author'].'", "'.fix_date($post['create_date']).'", "'.fix_date($post['create_date']).'", "'
 391                                          .fix_date($post['modified_date']).'", "'.convert_status($post['status']).'", "'.$locale.'", "'
 392                                          .mysql_real_escape_string($post['content']).'", "'.mysql_real_escape_string($post['excerpt'])
 393                                          .'", "'.mysql_real_escape_string($post['title']).'", "'.substr($post['slug'],0,50).'", "'
 394                                          .$post['comment_status'].'", "'.$postrenderers.'");';
 395  
 396                  $flag = mysql_query($query);
 397                  if (! $flag )
 398                  {
 399                      pre_dump( $query );
 400                      die ('Post importing failed.');
 401                  }
 402  
 403  
 404                  // insert the post categories into the postcats table
 405                  foreach($post['cats'] as $cat)
 406                  {
 407                      // query to insert each category for the particular post
 408                      $query = 'INSERT INTO '.$b2.'postcats (postcat_post_ID, postcat_cat_ID) VALUES ("'.$post['post_id']. '", "'.$cat.'");';
 409                      $flag = mysql_query ($query);
 410                      if (! $flag )
 411                          die ('Post categories insertion failed. Please check your b2evolution installation.');
 412                  }
 413  
 414                  // insert the post tags
 415                  foreach($post['tags'] as $tag_id)
 416                  {
 417                      $query = 'INSERT INTO '.$b2.'items__itemtag (itag_itm_ID, itag_tag_ID)
 418                                                   VALUES ('.$post['post_id'].', '.$tag_id.');';
 419                      $flag = mysql_query ($query);
 420                      if (! $flag )
 421                          die ('Post tags insertion failed. Please check your b2evolution installation.');
 422                  }
 423  
 424              }
 425              echo '<font color="#00CC00">Posts and post categories imported successfully!</font>';
 426  
 427              // Now import the comments
 428              echo '<h2>Trying to import comments</h2>';
 429              $comments = array ();
 430  
 431              // select the wordpress database
 432              $db = mysql_select_db ($wp_db);
 433              if (! $db)
 434                  die ('WordPress database name is incorrect. Please check the name and try again.');
 435  
 436              // discard the spam comments. select only comments where status is either 'in moderation' or 'approved'
 437              $query = 'SELECT * FROM '.$wp.'comments WHERE comment_approved="0" OR comment_approved="1" ORDER BY comment_date ASC;';
 438  
 439              $res = mysql_query ($query);
 440              if (! $res )
 441                  die ('Query failed. Please check your WordPress installation.');
 442  
 443              $i = 0;
 444              while ($row = mysql_fetch_array ($res, MYSQL_ASSOC) )
 445              {
 446                  // set the values from comments table
 447                  $comments[$i]['comment_id'] = $row['comment_ID'];
 448                  $comments[$i]['post_id'] = $row['comment_post_ID'];
 449                  $comments[$i]['author'] = $row['comment_author'];
 450                  $comments[$i]['email'] = $row['comment_author_email'];
 451                  $comments[$i]['url'] = $row['comment_author_url'];
 452                  $comments[$i]['ip'] = $row['comment_author_IP'];
 453                  $comments[$i]['date'] = $row['comment_date'];
 454                  $comments[$i]['content'] = $row['comment_content'];
 455                  $comments[$i]['author_id'] = $row['user_id'];
 456  
 457                  // set default comment status to published
 458                  $comments[$i]['status'] = 'published';
 459                  // if the comment isn't approved set it to draft
 460                  if ($row['comment_approved'] == 0)
 461                      $comments[$i]['status'] = 'draft';
 462  
 463                  // default comment type is 'comment
 464                  $comments[$i]['type'] = 'comment';
 465                  // if it is a pingback or trackback change the type accordingly
 466                  if ($row['comment_type'] == 'pingback' || $row['comment_type'] == 'trackback')
 467                      $comments[$i]['type'] = 'pingback';
 468  
 469                  $i ++;
 470              }
 471              // free the query result set
 472              mysql_free_result ($res);
 473  
 474              // select the evolution db
 475              $db = mysql_select_db ($evo_db, $con);
 476              if (! $db)
 477                  die ('b2evolution database name is incorrect. Please check the name and try again.');
 478  
 479              foreach ($comments as $comment)
 480              {
 481                  // escape the string and replace UNIX newlines to line breaks in order to
 482                  // render properly in b2evolution
 483                  $ccontent = mysql_real_escape_string ($comment['content']);
 484                  $ccontent = str_replace ('\r\n', '<br />', $ccontent);
 485  
 486                  // query to insert the comments into the b2evolution table
 487                  $query = 'INSERT INTO '.$b2.'comments (comment_ID, comment_post_ID, comment_type, comment_status, comment_author_ID, comment_author, comment_author_email, comment_author_url, comment_author_IP, comment_date, comment_content, comment_allow_msgform)
 488                  VALUES ("'. $comment['comment_id'].'", "'.$comment['post_id'].'", "'.$comment['type'].'", "'
 489                                  .$comment['status'].'", "'.$comment['author_id'].'", "'.evo_substr($comment['author'],0,100).'", "'.$comment['email']
 490                                  .'", "'.$comment['url'].'", "'.$comment['ip'].'", "'.$comment['date'].'", "'.$ccontent.'", "1");';
 491  
 492                  $flag = mysql_query ($query);
 493                  if (! $flag)
 494                  {
 495                      pre_dump( $query );
 496                      die ('Comment importing failed. Please check your b2evolution installation.');
 497                  }
 498  
 499              }
 500              echo '<font color="#00CC00">Comments imported successfully!</font>';
 501  
 502              // Now to import users. Note: all users other than admin will be imported and then they will be set to the default level
 503              // of 0
 504              echo '<h2>Trying to import all users (except admin)</h2>';
 505              $users = array ();
 506  
 507              // select the wordpress database
 508              $db = mysql_select_db ($wp_db, $con);
 509              if (! $db)
 510                  die ('WordPress database name is incorrect. Please check the name and try again.');
 511  
 512              // select all users except the admin user
 513              $query = 'SELECT * FROM '. $wp.'users WHERE user_login <> "admin";';
 514              $res = mysql_query ($query);
 515              if (! $res )
 516                  die ('Query failed. Please check your WordPress installation.');
 517  
 518              $i = 0;
 519              while ( $row = mysql_fetch_array ($res, MYSQL_ASSOC) )
 520              {
 521                  // set all the values from the user table
 522                  $users[$i]['id'] = $row['ID'];
 523                  $users[$i]['login'] = $row['user_login'];
 524                  $users[$i]['password'] = $row['user_pass'];
 525                  $users[$i]['nickname'] = $row['user_nicename'];
 526                  $users[$i]['email'] = $row['user_email'];
 527                  $users[$i]['url'] = $row['user_url'];
 528                  $users[$i]['date'] = $row['user_registered'];
 529                  $users[$i]['firstname'] = $row['display_name'];
 530                  echo 'Reading: '.$users[$i]['login'].'<br>';
 531                  $i ++;
 532              }
 533              mysql_free_result ($res);
 534  
 535              // select the evolution db
 536              $db = mysql_select_db ($evo_db, $con);
 537              if (! $db )
 538                  die ('b2evolution database name is incorrect. Please check the name and try again.');
 539  
 540              foreach ($users as $a_user)
 541              {
 542                  // Import the user
 543                  $query = 'INSERT INTO '.$b2.'users (user_ID, user_login, user_pass, user_firstname, user_nickname, user_email,
 544                                                                                          user_url, user_created_datetime, user_validated, user_grp_ID)
 545                                      VALUES ("'.$a_user['id'].'", "'.$a_user['login'].'", "'.$a_user['password'].'", "'
 546                                                          .$a_user['firstname'].'", "'.$a_user['nickname'].'", "'.$a_user['email']
 547                                                          .'", "'.$a_user['url'].'", "'.fix_date($a_user['date']).'", "1", "4");';
 548  
 549                  $flag = mysql_query ($query);
 550                  if (! $flag)
 551                  {
 552                      pre_dump($query);
 553                      die ('User importing failed. Please check your b2evolution installation.');
 554                  }
 555  
 556                  // Import the permissions for blog for the user
 557                  $query = 'INSERT INTO '.$b2.'blogusers (bloguser_blog_ID, bloguser_user_ID, bloguser_ismember) VALUES ("1", "'.$a_user['id'].'", "1");';
 558  
 559                  $flag = mysql_query ($query);
 560                  if (! $flag)
 561                      die ('User (permissions) importing failed. Please check you b2evolution installation.');
 562              }
 563              echo '<font color="#00CC00">Users imported successfully! <strong>NOTE:</strong> all users are set to basic users level by default. You should probably reconfigure user permissions in the admin control panel if you want to give them higher privileges.</font>';
 564  
 565              // All done
 566              echo '<br><br>';
 567              echo '<strong><font color="#00CC00">Everything imported correctly. Try out your new b2evolution blog!</font></strong>';
 568  
 569              // close the connection to the MySQL server
 570              mysql_close ($con);
 571       } ?>
 572       <?php    // reset the PHP error reporting to the previous level
 573            error_reporting ($prevlevel); ?>
 574  </body>
 575  </html>

title

Description

title

Description

title

Description

title

title

Body