Changeset 128
- Timestamp:
- 06/01/2003 09:01:04 AM (22 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/wp-admin/links.import.php
r118 r128 33 33 $title = 'Import Blogroll'; 34 34 35 function mysql_doh($msg,$sql,$error) {36 echo "<p>$msg</p>";37 echo "<p>query:<br />$sql</p>";38 echo "<p>error:<br />$error</p>";39 die();40 }41 42 $connexion = mysql_connect($server, $loginsql, $passsql) or die("<h1>Check your b2config.php file!</h1>Can't connect to the database<br />".mysql_error());43 $dbconnexion = mysql_select_db($base, $connexion);44 45 if (!$dbconnexion) {46 echo mysql_error();47 die();48 }49 35 $step = $HTTP_GET_VARS['step']; 50 36 if (!$step) $step = 0; … … 57 43 include_once('b2header.php'); 58 44 if ($user_level < $minadminlevel) 59 die ("Cheatin ' uh?");45 die ("Cheatin’ uh?"); 60 46 ?> 61 47 <div class="wrap"> 62 <table width="75%" cellpadding="5" cellspacing="0" border="0"> 63 <tr><td> 48 64 49 <h3>On this page you can import your blogroll.</h3> 65 <p>You will need your unique blogrolling.com Id.</p> 66 <p>First, go to <a href="http://www.blogrolling.com">Blogrolling.com</a> 67 and sign in. Once you've done that, click on <b>Get Code</b>, and then 68 look for the <b><abbr title="Outline Processor Markup Language">OPML</abbr> 69 code</b>.</p> 50 <form name="blogroll" action="links.import.php" method="get"> 51 <ol> 52 <li>Go to <a href="http://www.blogrolling.com">Blogrolling.com</a> 53 and sign in. Once you've done that, click on <strong>Get Code</strong>, and then 54 look for the <strong><abbr title="Outline Processor Markup Language">OPML</abbr> 55 code</strong>.</li> 70 56 71 < p>Select that and copy it into the box below.</p>72 <form name="blogroll" action="links.import.php" method="GET">57 <li>Select that and copy it into the box below.<br /> 58 73 59 <input type="hidden" name="step" value="1" /> 74 60 Your OPML code: <input type="text" name="opml_url" size="65" /> 75 <p>Please select a category for these links.</p> 61 </li> 62 <li>Now select a category you want to put these links in.<br /> 63 Category: <select name="cat_id"> 76 64 <?php 77 $query = "SELECT cat_id, cat_name, auto_toggle FROM $tablelinkcategories ORDER BY cat_id";78 $result = mysql_query($query) or die("Couldn't execute query. ".mysql_error()); 65 $categories = $wpdb->get_results("SELECT cat_id, cat_name, auto_toggle FROM $tablelinkcategories ORDER BY cat_id"); 66 foreach ($categories as $category) { 79 67 ?> 80 < p>Select category: <select name="cat_id">68 <option value="<?php echo $category->cat_id; ?>"><?php echo $category->cat_id.': '.$category->cat_name; ?></option> 81 69 <?php 82 while($row = mysql_fetch_object($result)) { 83 ?> 84 <option value="<?php echo $row->cat_id; ?>"><?php echo $row->cat_id.': '.$row->cat_name; ?></option> 85 <?php 86 } // end while 70 } // end foreach 87 71 ?> 88 72 </select> 89 <p>Finally, click on the 'Import' button and we're off!</p> 90 <input type="submit" name="submit" value="Import" /> 73 74 </li> 75 76 <li><input type="submit" name="submit" value="Import!" /></li> 77 </ol> 91 78 </form> 92 </td> 93 </tr> 94 </table> 79 95 80 </div> 96 81 <?php … … 105 90 ?> 106 91 <div class="wrap"> 107 <table width="75%" cellpadding="5" cellspacing="0" border="0"> 108 <tr><td> 92 109 93 <h3>Importing...</h3> 110 94 <?php … … 115 99 $opml_url = $HTTP_GET_VARS['opml_url']; 116 100 if ($opml_url == '') { 117 echo "<p>You need to supply your O LPML url. Press back on your browser and try again</p>\n";101 echo "<p>You need to supply your OPML url. Press back on your browser and try again</p>\n"; 118 102 } 119 103 else … … 127 111 $targets = $items[5]; 128 112 $link_count = count($names); 129 for ($i = 0; $i < count($names); $i++) {113 for ($i = 0; $i < $link_count; $i++) { 130 114 if ('Last' == substr($titles[$i], 0, 4)) 131 115 $titles[$i] = ''; 116 if ('http' == substr($titles[$i], 0, 4)) 117 $titles[$i] = ''; 132 118 //echo "INSERT INTO $tablelinks (link_url, link_name, link_target, link_category, link_description, link_owner) VALUES('{$urls[$i]}', '{$names[$i]}', '{$targets[$i]}', $cat_id, '{$titles[$i]}', \$user_ID)<br />\n"; 133 $query = "INSERT INTO $tablelinks (link_url, link_name, link_target, link_category, link_description, link_owner)\n " . 134 " VALUES('{$urls[$i]}', '".addslashes($names[$i])."', '{$targets[$i]}', $cat_id, '".addslashes($titles[$i])."', $user_ID)\n"; 135 $result = mysql_query($query) or die("Couldn't insert link. Sorry".mysql_error()); 119 $query = "INSERT INTO $tablelinks (link_url, link_name, link_target, link_category, link_description, link_owner) 120 VALUES('{$urls[$i]}', '".addslashes($names[$i])."', '{$targets[$i]}', $cat_id, '".addslashes($titles[$i])."', $user_ID)\n"; 121 $result = $wpdb->query($query); 122 echo "<p>Inserted <strong>{$names[$i]}</strong></p>"; 136 123 } 137 124 ?> 138 <p>Inserted <?php echo $link_count ?> links into category <?php echo $cat_id; ?>. </p>125 <p>Inserted <?php echo $link_count ?> links into category <?php echo $cat_id; ?>. All done! Go <a href="linkmanager.php">manage those links</a>.</p> 139 126 <?php 140 127 } // end else got url 141 128 ?> 142 </td> 143 </tr> 144 </table> 129 145 130 </div> 146 131 <?php
Note: See TracChangeset
for help on using the changeset viewer.