Changeset 5406 for branches/2.0/wp-admin/import/dotclear.php
- Timestamp:
- 05/07/2007 04:10:20 PM (19 years ago)
- File:
-
- 1 edited
-
branches/2.0/wp-admin/import/dotclear.php (modified) (44 diffs)
Legend:
- Unmodified
- Added
- Removed
-
branches/2.0/wp-admin/import/dotclear.php
r5391 r5406 1 1 <?php 2 /* 3 * DotClear import plugin 4 * by Thomas Quinot - http://thomas.quinot.org/ 5 */ 6 2 7 /** 3 8 Add These Functions to make our lives easier … … 5 10 if(!function_exists('get_catbynicename')) 6 11 { 7 function get_catbynicename($category_nicename) 12 function get_catbynicename($category_nicename) 8 13 { 9 14 global $wpdb; 10 15 11 16 $cat_id -= 0; // force numeric 12 17 $name = $wpdb->get_var('SELECT cat_ID FROM '.$wpdb->categories.' WHERE category_nicename="'.$category_nicename.'"'); 13 18 14 19 return $name; 15 20 } … … 56 61 // This cries out for a C-implementation to be included in PHP core 57 62 // 58 function valid_1byte($char) { 59 if(!is_int($char)) return false; 60 return ($char & 0x80) == 0x00; 61 } 62 63 function valid_2byte($char) { 64 if(!is_int($char)) return false; 65 return ($char & 0xE0) == 0xC0; 66 } 67 68 function valid_3byte($char) { 69 if(!is_int($char)) return false; 70 return ($char & 0xF0) == 0xE0; 71 } 72 73 function valid_4byte($char) { 74 if(!is_int($char)) return false; 75 return ($char & 0xF8) == 0xF0; 76 } 77 78 function valid_nextbyte($char) { 79 if(!is_int($char)) return false; 80 return ($char & 0xC0) == 0x80; 81 } 82 83 function valid_utf8($string) { 84 $len = strlen($string); 85 $i = 0; 86 while( $i < $len ) { 87 $char = ord(substr($string, $i++, 1)); 88 if(valid_1byte($char)) { // continue 89 continue; 90 } else if(valid_2byte($char)) { // check 1 byte 91 if(!valid_nextbyte(ord(substr($string, $i++, 1)))) 92 return false; 93 } else if(valid_3byte($char)) { // check 2 bytes 94 if(!valid_nextbyte(ord(substr($string, $i++, 1)))) 95 return false; 96 if(!valid_nextbyte(ord(substr($string, $i++, 1)))) 97 return false; 98 } else if(valid_4byte($char)) { // check 3 bytes 99 if(!valid_nextbyte(ord(substr($string, $i++, 1)))) 100 return false; 101 if(!valid_nextbyte(ord(substr($string, $i++, 1)))) 102 return false; 103 if(!valid_nextbyte(ord(substr($string, $i++, 1)))) 104 return false; 105 } // goto next char 106 } 107 return true; // done 108 } 63 64 function valid_1byte($char) { 65 if(!is_int($char)) return false; 66 return ($char & 0x80) == 0x00; 67 } 68 69 function valid_2byte($char) { 70 if(!is_int($char)) return false; 71 return ($char & 0xE0) == 0xC0; 72 } 73 74 function valid_3byte($char) { 75 if(!is_int($char)) return false; 76 return ($char & 0xF0) == 0xE0; 77 } 78 79 function valid_4byte($char) { 80 if(!is_int($char)) return false; 81 return ($char & 0xF8) == 0xF0; 82 } 83 84 function valid_nextbyte($char) { 85 if(!is_int($char)) return false; 86 return ($char & 0xC0) == 0x80; 87 } 88 89 function valid_utf8($string) { 90 $len = strlen($string); 91 $i = 0; 92 while( $i < $len ) { 93 $char = ord(substr($string, $i++, 1)); 94 if(valid_1byte($char)) { // continue 95 continue; 96 } else if(valid_2byte($char)) { // check 1 byte 97 if(!valid_nextbyte(ord(substr($string, $i++, 1)))) 98 return false; 99 } else if(valid_3byte($char)) { // check 2 bytes 100 if(!valid_nextbyte(ord(substr($string, $i++, 1)))) 101 return false; 102 if(!valid_nextbyte(ord(substr($string, $i++, 1)))) 103 return false; 104 } else if(valid_4byte($char)) { // check 3 bytes 105 if(!valid_nextbyte(ord(substr($string, $i++, 1)))) 106 return false; 107 if(!valid_nextbyte(ord(substr($string, $i++, 1)))) 108 return false; 109 if(!valid_nextbyte(ord(substr($string, $i++, 1)))) 110 return false; 111 } // goto next char 112 } 113 return true; // done 114 } 109 115 110 116 function csc ($s) { … … 128 134 { 129 135 echo '<div class="wrap">'; 130 echo '<h2>'.__('Import Dot clear').'</h2>';136 echo '<h2>'.__('Import DotClear').'</h2>'; 131 137 echo '<p>'.__('Steps may take a few minutes depending on the size of your database. Please be patient.').'</p>'; 132 138 } … … 136 142 echo '</div>'; 137 143 } 138 144 139 145 function greet() 140 146 { 141 echo '< p>'.__('Howdy! This importer allows you to extract posts from a Dotclear database into your blog. Mileage may vary.').'</p>';142 echo '<p>'.__('Your Dot clear Configuration settings are as follows:').'</p>';147 echo '<div class="narrow"><p>'.__('Howdy! This importer allows you to extract posts from a DotClear database into your blog. Mileage may vary.').'</p>'; 148 echo '<p>'.__('Your DotClear Configuration settings are as follows:').'</p>'; 143 149 echo '<form action="admin.php?import=dotclear&step=1" method="post">'; 150 wp_nonce_field('import-dotclear'); 144 151 $this->db_form(); 145 echo '< input type="submit" name="submit" value="'.__('Import Categories').'" />';146 echo '</form> ';147 } 148 149 function get_dc_cats() 152 echo '<p class="submit"><input type="submit" name="submit" value="'.attribute_escape(__('Import Categories »')).'" /></p>'; 153 echo '</form></div>'; 154 } 155 156 function get_dc_cats() 150 157 { 151 158 global $wpdb; … … 153 160 $dcdb = new wpdb(get_option('dcuser'), get_option('dcpass'), get_option('dcname'), get_option('dchost')); 154 161 set_magic_quotes_runtime(0); 155 $ prefix = get_option('tpre');156 162 $dbprefix = get_option('dcdbprefix'); 163 157 164 // Get Categories 158 return $dcdb->get_results('SELECT * FROM dc_categorie', ARRAY_A);159 } 160 165 return $dcdb->get_results('SELECT * FROM '.$dbprefix.'categorie', ARRAY_A); 166 } 167 161 168 function get_dc_users() 162 169 { … … 165 172 $dcdb = new wpdb(get_option('dcuser'), get_option('dcpass'), get_option('dcname'), get_option('dchost')); 166 173 set_magic_quotes_runtime(0); 167 $ prefix = get_option('tpre');168 174 $dbprefix = get_option('dcdbprefix'); 175 169 176 // Get Users 170 171 return $dcdb->get_results('SELECT * FROM dc_user', ARRAY_A);172 } 173 177 178 return $dcdb->get_results('SELECT * FROM '.$dbprefix.'user', ARRAY_A); 179 } 180 174 181 function get_dc_posts() 175 182 { … … 177 184 $dcdb = new wpdb(get_option('dcuser'), get_option('dcpass'), get_option('dcname'), get_option('dchost')); 178 185 set_magic_quotes_runtime(0); 179 $ prefix = get_option('tpre');180 186 $dbprefix = get_option('dcdbprefix'); 187 181 188 // Get Posts 182 return $dcdb->get_results('SELECT dc_post.*, dc_categorie.cat_libelle_url AS post_cat_name183 FROM dc_post INNER JOIN dc_categorie184 ON dc_post.cat_id = dc_categorie.cat_id', ARRAY_A);185 } 186 189 return $dcdb->get_results('SELECT '.$dbprefix.'post.*, '.$dbprefix.'categorie.cat_libelle_url AS post_cat_name 190 FROM '.$dbprefix.'post INNER JOIN '.$dbprefix.'categorie 191 ON '.$dbprefix.'post.cat_id = '.$dbprefix.'categorie.cat_id', ARRAY_A); 192 } 193 187 194 function get_dc_comments() 188 195 { … … 191 198 $dcdb = new wpdb(get_option('dcuser'), get_option('dcpass'), get_option('dcname'), get_option('dchost')); 192 199 set_magic_quotes_runtime(0); 193 $ prefix = get_option('tpre');194 200 $dbprefix = get_option('dcdbprefix'); 201 195 202 // Get Comments 196 return $dcdb->get_results('SELECT * FROM dc_comment', ARRAY_A);197 } 198 203 return $dcdb->get_results('SELECT * FROM '.$dbprefix.'comment', ARRAY_A); 204 } 205 199 206 function get_dc_links() 200 207 { … … 202 209 $dcdb = new wpdb(get_option('dcuser'), get_option('dcpass'), get_option('dcname'), get_option('dchost')); 203 210 set_magic_quotes_runtime(0); 204 $ prefix = get_option('tpre');205 206 return $dcdb->get_results('SELECT * FROM dc_link ORDER BY position', ARRAY_A);207 } 208 209 function cat2wp($categories='') 211 $dbprefix = get_option('dcdbprefix'); 212 213 return $dcdb->get_results('SELECT * FROM '.$dbprefix.'link ORDER BY position', ARRAY_A); 214 } 215 216 function cat2wp($categories='') 210 217 { 211 218 // General Housekeeping … … 217 224 { 218 225 echo '<p>'.__('Importing Categories...').'<br /><br /></p>'; 219 foreach ($categories as $category) 226 foreach ($categories as $category) 220 227 { 221 228 $count++; 222 229 extract($category); 223 230 224 231 // Make Nice Variables 225 232 $name = $wpdb->escape($cat_libelle_url); … … 237 244 $dccat2wpcat[$id] = $ret_id; 238 245 } 239 246 240 247 // Store category translation for future use 241 248 add_option('dccat2wpcat',$dccat2wpcat); … … 246 253 return false; 247 254 } 248 255 249 256 function users2wp($users='') 250 257 { … … 253 260 $count = 0; 254 261 $dcid2wpid = array(); 255 262 256 263 // Midnight Mojo 257 264 if(is_array($users)) … … 262 269 $count++; 263 270 extract($user); 264 271 265 272 // Make Nice Variables 266 273 $name = $wpdb->escape(csc ($name)); 267 274 $RealName = $wpdb->escape(csc ($user_pseudo)); 268 275 269 276 if($uinfo = get_userdatabylogin($name)) 270 277 { 271 278 272 279 $ret_id = wp_insert_user(array( 273 280 'ID' => $uinfo->ID, … … 279 286 ); 280 287 } 281 else 288 else 282 289 { 283 290 $ret_id = wp_insert_user(array( … … 290 297 } 291 298 $dcid2wpid[$user_id] = $ret_id; 292 293 // Set Dot clear-to-WordPress permissions translation294 299 300 // Set DotClear-to-WordPress permissions translation 301 295 302 // Update Usermeta Data 296 303 $user = new WP_User($ret_id); … … 303 310 else if(2 <= $wp_perms) { $user->set_role('contributor'); } 304 311 else { $user->set_role('subscriber'); } 305 312 306 313 update_usermeta( $ret_id, 'wp_user_level', $wp_perms); 307 314 update_usermeta( $ret_id, 'rich_editing', 'false'); … … 309 316 update_usermeta( $ret_id, 'last_name', csc ($user_nom)); 310 317 }// End foreach($users as $user) 311 318 312 319 // Store id translation array for future use 313 320 add_option('dcid2wpid',$dcid2wpid); 314 315 321 322 316 323 echo '<p>'.sprintf(__('Done! <strong>%1$s</strong> users imported.'), $count).'<br /><br /></p>'; 317 324 return true; 318 325 }// End if(is_array($users) 319 326 320 327 echo __('No Users to Import!'); 321 328 return false; 322 329 323 330 }// End function user2wp() 324 331 325 332 function posts2wp($posts='') 326 333 { … … 339 346 $count++; 340 347 extract($post); 341 342 // Set Dot clear-to-WordPress status translation348 349 // Set DotClear-to-WordPress status translation 343 350 $stattrans = array(0 => 'draft', 1 => 'publish'); 344 351 $comment_status_map = array (0 => 'closed', 1 => 'open'); 345 352 346 353 //Can we do this more efficiently? 347 354 $uinfo = ( get_userdatabylogin( $user_id ) ) ? get_userdatabylogin( $user_id ) : 1; … … 350 357 $Title = $wpdb->escape(csc ($post_titre)); 351 358 $post_content = textconv ($post_content); 359 $post_excerpt = ""; 352 360 if ($post_chapo != "") { 353 361 $post_excerpt = textconv ($post_chapo); … … 357 365 $post_content = $wpdb->escape ($post_content); 358 366 $post_status = $stattrans[$post_pub]; 359 367 360 368 // Import Post data into WordPress 361 369 362 370 if($pinfo = post_exists($Title,$post_content)) 363 371 { … … 379 387 ); 380 388 } 381 else 389 else 382 390 { 383 391 $ret_id = wp_insert_post(array( … … 398 406 } 399 407 $dcposts2wpposts[$post_id] = $ret_id; 400 408 401 409 // Make Post-to-Category associations 402 410 $cats = array(); … … 408 416 // Store ID translation for later use 409 417 add_option('dcposts2wpposts',$dcposts2wpposts); 410 418 411 419 echo '<p>'.sprintf(__('Done! <strong>%1$s</strong> posts imported.'), $count).'<br /><br /></p>'; 412 return true; 413 } 414 420 return true; 421 } 422 415 423 function comments2wp($comments='') 416 424 { … … 420 428 $dccm2wpcm = array(); 421 429 $postarr = get_option('dcposts2wpposts'); 422 430 423 431 // Magic Mojo 424 432 if(is_array($comments)) … … 429 437 $count++; 430 438 extract($comment); 431 439 432 440 // WordPressify Data 433 441 $comment_ID = (int) ltrim($comment_id, '0'); … … 438 446 $web = "http://".$wpdb->escape($comment_site); 439 447 $message = $wpdb->escape(textconv ($comment_content)); 440 448 441 449 if($cinfo = comment_exists($name, $comment_dt)) 442 450 { … … 455 463 ); 456 464 } 457 else 465 else 458 466 { 459 467 // Insert comments … … 473 481 } 474 482 // Store Comment ID translation for future use 475 add_option('dccm2wpcm', $dccm2wpcm); 476 483 add_option('dccm2wpcm', $dccm2wpcm); 484 477 485 // Associate newly formed categories with posts 478 486 get_comment_count($ret_id); 479 480 487 488 481 489 echo '<p>'.sprintf(__('Done! <strong>%1$s</strong> comments imported.'), $count).'<br /><br /></p>'; 482 490 return true; … … 485 493 return false; 486 494 } 487 495 488 496 function links2wp($links='') 489 497 { … … 491 499 global $wpdb; 492 500 $count = 0; 493 501 494 502 // Deal with the links 495 503 if(is_array($links)) … … 500 508 $count++; 501 509 extract($link); 502 510 503 511 if ($title != "") { 504 512 if ($cinfo = link_cat_exists (csc ($title))) { … … 512 520 $linkname = $wpdb->escape(csc ($label)); 513 521 $description = $wpdb->escape(csc ($title)); 514 522 515 523 if($linfo = link_exists($linkname)) { 516 524 $ret_id = wp_insert_link(array( … … 541 549 return false; 542 550 } 543 544 function import_categories() 545 { 546 // Category Import 551 552 function import_categories() 553 { 554 // Category Import 547 555 $cats = $this->get_dc_cats(); 548 556 $this->cat2wp($cats); 549 557 add_option('dc_cats', $cats); 550 551 552 558 559 560 553 561 echo '<form action="admin.php?import=dotclear&step=2" method="post">'; 554 printf('<input type="submit" name="submit" value="%s" />', __('Import Users')); 562 wp_nonce_field('import-dotclear'); 563 printf('<input type="submit" name="submit" value="%s" />', attribute_escape(__('Import Users'))); 555 564 echo '</form>'; 556 565 557 566 } 558 567 559 568 function import_users() 560 569 { 561 570 // User Import 562 $users = $this->get_dc_users(); 571 $users = $this->get_dc_users(); 563 572 $this->users2wp($users); 564 573 565 574 echo '<form action="admin.php?import=dotclear&step=3" method="post">'; 566 printf('<input type="submit" name="submit" value="%s" />', __('Import Posts')); 575 wp_nonce_field('import-dotclear'); 576 printf('<input type="submit" name="submit" value="%s" />', attribute_escape(__('Import Posts'))); 567 577 echo '</form>'; 568 578 } 569 579 570 580 function import_posts() 571 581 { … … 573 583 $posts = $this->get_dc_posts(); 574 584 $this->posts2wp($posts); 575 585 576 586 echo '<form action="admin.php?import=dotclear&step=4" method="post">'; 577 printf('<input type="submit" name="submit" value="%s" />', __('Import Comments')); 587 wp_nonce_field('import-dotclear'); 588 printf('<input type="submit" name="submit" value="%s" />', attribute_escape(__('Import Comments'))); 578 589 echo '</form>'; 579 590 } 580 591 581 592 function import_comments() 582 593 { … … 584 595 $comments = $this->get_dc_comments(); 585 596 $this->comments2wp($comments); 586 597 587 598 echo '<form action="admin.php?import=dotclear&step=5" method="post">'; 588 printf('<input type="submit" name="submit" value="%s" />', __('Import Links')); 599 wp_nonce_field('import-dotclear'); 600 printf('<input type="submit" name="submit" value="%s" />', attribute_escape(__('Import Links'))); 589 601 echo '</form>'; 590 602 } 591 603 592 604 function import_links() 593 605 { … … 596 608 $this->links2wp($links); 597 609 add_option('dc_links', $links); 598 610 599 611 echo '<form action="admin.php?import=dotclear&step=6" method="post">'; 600 printf('<input type="submit" name="submit" value="%s" />', __('Finish')); 612 wp_nonce_field('import-dotclear'); 613 printf('<input type="submit" name="submit" value="%s" />', attribute_escape(__('Finish'))); 601 614 echo '</form>'; 602 615 } 603 616 604 617 function cleanup_dcimport() 605 618 { 606 delete_option(' tpre');619 delete_option('dcdbprefix'); 607 620 delete_option('dc_cats'); 608 621 delete_option('dcid2wpid'); … … 618 631 $this->tips(); 619 632 } 620 633 621 634 function tips() 622 635 { 623 echo '<p>'.__('Welcome to WordPress. We hope (and expect!) that you will find this platform incredibly rewarding! As a new WordPress user coming from Dot clear, there are some things that we would like to point out. Hopefully, they will help your transition go as smoothly as possible.').'</p>';636 echo '<p>'.__('Welcome to WordPress. We hope (and expect!) that you will find this platform incredibly rewarding! As a new WordPress user coming from DotClear, there are some things that we would like to point out. Hopefully, they will help your transition go as smoothly as possible.').'</p>'; 624 637 echo '<h3>'.__('Users').'</h3>'; 625 echo '<p>'.sprintf(__('You have already setup WordPress and have been assigned an administrative login and password. Forget it. You didn\'t have that login in Dot clear, why should you have it here? Instead we have taken care to import all of your users into our system. Unfortunately there is one downside. Because both WordPress and Dotclear uses a strong encryption hash with passwords, it is impossible to decrypt it and we are forced to assign temporary passwords to all your users. <strong>Every user has the same username, but their passwords are reset to password123.</strong> So <a href="%1$s">Login</a> and change it.'), '/wp-login.php').'</p>';638 echo '<p>'.sprintf(__('You have already setup WordPress and have been assigned an administrative login and password. Forget it. You didn\'t have that login in DotClear, why should you have it here? Instead we have taken care to import all of your users into our system. Unfortunately there is one downside. Because both WordPress and DotClear uses a strong encryption hash with passwords, it is impossible to decrypt it and we are forced to assign temporary passwords to all your users. <strong>Every user has the same username, but their passwords are reset to password123.</strong> So <a href="%1$s">Login</a> and change it.'), '/wp-login.php').'</p>'; 626 639 echo '<h3>'.__('Preserving Authors').'</h3>'; 627 640 echo '<p>'.__('Secondly, we have attempted to preserve post authors. If you are the only author or contributor to your blog, then you are safe. In most cases, we are successful in this preservation endeavor. However, if we cannot ascertain the name of the writer due to discrepancies between database tables, we assign it to you, the administrative user.').'</p>'; 628 641 echo '<h3>'.__('Textile').'</h3>'; 629 echo '<p>'.__('Also, since you\'re coming from Dot clear, you probably have been using Textile to format your comments and posts. If this is the case, we recommend downloading and installing <a href="http://www.huddledmasses.org/category/development/wordpress/textile/">Textile for WordPress</a>. Trust me... You\'ll want it.').'</p>';642 echo '<p>'.__('Also, since you\'re coming from DotClear, you probably have been using Textile to format your comments and posts. If this is the case, we recommend downloading and installing <a href="http://www.huddledmasses.org/category/development/wordpress/textile/">Textile for WordPress</a>. Trust me... You\'ll want it.').'</p>'; 630 643 echo '<h3>'.__('WordPress Resources').'</h3>'; 631 644 echo '<p>'.__('Finally, there are numerous WordPress resources around the internet. Some of them are:').'</p>'; … … 637 650 echo '<p>'.sprintf(__('That\'s it! What are you waiting for? Go <a href="%1$s">login</a>!'), '../wp-login.php').'</p>'; 638 651 } 639 652 640 653 function db_form() 641 654 { 642 echo '< ul>';643 printf('< li><label for="dbuser">%s</label> <input type="text" name="dbuser" id="dbuser" /></li>', __('Dotclear Database User:'));644 printf('< li><label for="dbpass">%s</label> <input type="password" name="dbpass" id="dbpass" /></li>', __('Dotclear Database Password:'));645 printf('< li><label for="dbname">%s</label> <input type="text" name="dbname" id="dbname" /></li>', __('Dotclear Database Name:'));646 printf('< li><label for="dbhost">%s</label> <input type="text" name="dbhost" id="dbhost" value="localhost" /></li>', __('Dotclear Database Host:'));647 /* printf('<li><label for="dbprefix">%s</label> <input type="text" name="dbprefix" /></li>', __('Dotclear Table prefix (if any):')); */648 printf('< li><label for="dccharset">%s</label> <input type="text" id="dccharset" name="dccharset" value="ISO-8859-15"/></li>', __('Originating character set:'));649 echo '</ ul>';650 } 651 652 function dispatch() 655 echo '<table class="editform">'; 656 printf('<tr><th><label for="dbuser">%s</label></th><td><input type="text" name="dbuser" id="dbuser" /></td></tr>', __('DotClear Database User:')); 657 printf('<tr><th><label for="dbpass">%s</label></th><td><input type="password" name="dbpass" id="dbpass" /></td></tr>', __('DotClear Database Password:')); 658 printf('<tr><th><label for="dbname">%s</label></th><td><input type="text" name="dbname" id="dbname" /></td></tr>', __('DotClear Database Name:')); 659 printf('<tr><th><label for="dbhost">%s</label></th><td><input type="text" name="dbhost" nameid="dbhost" value="localhost" /></td></tr>', __('DotClear Database Host:')); 660 printf('<tr><th><label for="dbprefix">%s</label></th><td><input type="text" name="dbprefix" id="dbprefix" value="dc_"/></td></tr>', __('DotClear Table prefix:')); 661 printf('<tr><th><label for="dccharset">%s</label></th><td><input type="text" name="dccharset" id="dccharset" value="ISO-8859-15"/></td></tr>', __('Originating character set:')); 662 echo '</table>'; 663 } 664 665 function dispatch() 653 666 { 654 667 … … 658 671 $step = (int) $_GET['step']; 659 672 $this->header(); 660 661 if ( $step > 0 ) 673 674 if ( $step > 0 ) 662 675 { 676 check_admin_referer('import-dotclear'); 677 663 678 if($_POST['dbuser']) 664 679 { 665 680 if(get_option('dcuser')) 666 delete_option('dcuser'); 667 add_option('dcuser', $_POST['dbuser']);681 delete_option('dcuser'); 682 add_option('dcuser', sanitize_user($_POST['dbuser'], true)); 668 683 } 669 684 if($_POST['dbpass']) 670 685 { 671 686 if(get_option('dcpass')) 672 delete_option('dcpass'); 673 add_option('dcpass', $_POST['dbpass']);674 } 675 687 delete_option('dcpass'); 688 add_option('dcpass', sanitize_user($_POST['dbpass'], true)); 689 } 690 676 691 if($_POST['dbname']) 677 692 { 678 693 if(get_option('dcname')) 679 delete_option('dcname'); 680 add_option('dcname', $_POST['dbname']);694 delete_option('dcname'); 695 add_option('dcname', sanitize_user($_POST['dbname'], true)); 681 696 } 682 697 if($_POST['dbhost']) … … 684 699 if(get_option('dchost')) 685 700 delete_option('dchost'); 686 add_option('dchost', $_POST['dbhost']);701 add_option('dchost', sanitize_user($_POST['dbhost'], true)); 687 702 } 688 703 if($_POST['dccharset']) … … 690 705 if(get_option('dccharset')) 691 706 delete_option('dccharset'); 692 add_option('dccharset', $_POST['dccharset']);693 } 707 add_option('dccharset', sanitize_user($_POST['dccharset'], true)); 708 } 694 709 if($_POST['dbprefix']) 695 710 { 696 if(get_option(' tpre'))697 delete_option(' tpre');698 add_option(' tpre',$_POST['dbprefix']);699 } 711 if(get_option('dcdbprefix')) 712 delete_option('dcdbprefix'); 713 add_option('dcdbprefix', sanitize_user($_POST['dbprefix'], true)); 714 } 700 715 701 716 702 717 } 703 718 704 switch ($step) 719 switch ($step) 705 720 { 706 721 default: … … 727 742 break; 728 743 } 729 744 730 745 $this->footer(); 731 746 } 732 747 733 function Dotclear_Import() 734 { 735 // Nothing. 748 function Dotclear_Import() 749 { 750 // Nothing. 736 751 } 737 752 } 738 753 739 754 $dc_import = new Dotclear_Import(); 740 register_importer('dotclear', __('Dot clear'), __('Import posts from a Dotclear Blog'), array ($dc_import, 'dispatch'));755 register_importer('dotclear', __('DotClear'), __('Import categories, users, posts, comments, and links from a DotClear blog'), array ($dc_import, 'dispatch')); 741 756 ?>
Note: See TracChangeset
for help on using the changeset viewer.