Tech

How to convert phpNuke to WordPress

<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />PHP nuke / United Nuke to WordPress v1.0.04

<!--?php 

/**
  * PHP nuke / United Nuke to WordPress v1.0.04
  *
  * This program is free software; you can redistribute it and/or
  * modify it under the terms of the GNU General Public License
  * as published by the Free Software Foundation; either version 2
  * of the License, or (at your option) any later version.
**/

// Database connection PHP nuke / United Nuke
$con = mysql_pconnect("localhost","name","password"); // server, name, password

// Change encoding to utf-8 
mysql_query('SET NAMES utf8');
mysql_query("SET CHARACTER SET utf8");
mysql_query('SET CHARACTER_SET_CLIENT=utf8');
mysql_query('SET CHARACTER_SET_RESULTS=utf8');

if (!$con)
{die('The connection to the PHP Nuke / United Nuke server failed: ' . mysql_error()); }
$db_selected = mysql_select_db('prefix_nuke', $con); // PHP nuke / United Nuke database name
echo '<em-->Database PHP nuke / United Nuke connected. &lt;br?&gt;';
if (!$db_selected) {   die ('<em>The connection to the PHP Nuke / United Nuke server failed:</em> ' . mysql_error());}

// Database connection WordPress
$con1 = mysql_connect("localhost","name","password","wp_database"); // server, name, password, name wp database
if (!$con1) // Fixed bugs by WebSupport.sk
{die('<em>The connection to the WordPress server failed:</em> ' . mysql_error()); }
echo '<em>WordPress database connected. </em>
';

// Select the desired field of PHP Nuke / United Nuke
$contunit = mysql_query("select * FROM `tableprefix_stories`", $con);

while($nuke = mysql_fetch_array($contunit)) {
$sid = $nuke['sid'];
$title = $nuke['title'];
$time = $nuke['time'];
$bodytext = $nuke['bodytext'];

// Creating a URL of the article title, and the creation of
$odstrandia = Array('ä'=&gt;'a', 'Ä'=&gt;'A', 'á'=&gt;'a', 'Á'=&gt;'A', 'à'=&gt;'a', 'À'=&gt;'A', 'ã'=&gt;'a', 'Ã'=&gt;'A', 'â'=&gt;'a', 'Â'=&gt;'A', 'č'=&gt;'c', 'Č'=&gt;'C', 'ć'=&gt;'c', 'Ć'=&gt;'C', 'ď'=&gt;'d', 'Ď'=&gt;'D', 'ě'=&gt;'e', 'Ě'=&gt;'E', 'é'=&gt;'e', 'É'=&gt;'E', 'ë'=&gt;'e', 'Ë'=&gt;'E', 'è'=&gt;'e', 'È'=&gt;'E', 'ê'=&gt;'e', 'Ê'=&gt;'E', 'í'=&gt;'i', 'Í'=&gt;'I', 'ï'=&gt;'i', 'Ï'=&gt;'I', 'ì'=&gt;'i', 'Ì'=&gt;'I', 'î'=&gt;'i', 'Î'=&gt;'I', 'ľ'=&gt;'l', 'Ľ'=&gt;'L', 'ĺ'=&gt;'l', 'Ĺ'=&gt;'L', 'ń'=&gt;'n', 'Ń'=&gt;'N', 'ň'=&gt;'n', 'Ň'=&gt;'N', 'ñ'=&gt;'n', 'Ñ'=&gt;'N', 'ó'=&gt;'o', 'Ó'=&gt;'O', 'ö'=&gt;'o', 'Ö'=&gt;'O', 'ô'=&gt;'o', 'Ô'=&gt;'O', 'ò'=&gt;'o', 'Ò'=&gt;'O', 'õ'=&gt;'o', 'Õ'=&gt;'O', 'ő'=&gt;'o', 'Ő'=&gt;'O', 'ř'=&gt;'r', 'Ř'=&gt;'R', 'ŕ'=&gt;'r', 'Ŕ'=&gt;'R', 'š'=&gt;'s', 'Š'=&gt;'S', 'ś'=&gt;'s', 'Ś'=&gt;'S', 'ť'=&gt;'t', 'Ť'=&gt;'T', 'ú'=&gt;'u', 'Ú'=&gt;'U', 'ů'=&gt;'u', 'Ů'=&gt;'U', 'ü'=&gt;'u', 'Ü'=&gt;'U', 'ù'=&gt;'u', 'Ù'=&gt;'U', 'ũ'=&gt;'u', 'Ũ'=&gt;'U', 'û'=&gt;'u', 'Û'=&gt;'U','ý'=&gt;'y', 'Ý'=&gt;'Y', 'ž'=&gt;'z', 'Ž'=&gt;'Z', 'ź'=&gt;'z', 'Ź'=&gt;'Z');

// Removing original method - strtr
$urlone = strtr($title, $odstrandia);

$urldva = StrToLower($urlone); // Change to lower case
$urldvaa = Trim($urldva); // Gaps at the end and the beginning
$urltri = str_replace(" ", "-", $urldvaa); // Replace the clean field gap
$urlsty = str_replace(":", "", $urltri); // Replace the colon clean for field
$urlpa = str_replace(",", "", $urlsty);  // Change comma after the clean field
$url = "http://wp.domain.com/".$urlpa."-".$sid.".html";
$postname = $urlpa."-".$sid;

// Insertion of an Article in WordPressu
$sql= "INSERT INTO table_prefix.wp_posts VALUES ('',1,'$time','$time','$bodytext','$title','','publish', 'open', 'open','','$postname','','','$time','$time','',0,'$url',0,'post','',0 )";

$kontrola=mysql_query($sql);
}
if($kontrola){
echo "
<strong>Job finished...</strong>";
}
else {
echo "<strong>Error!</strong>";
}
?&gt;

download code