السلام عليكم،
أنا أتذكر أنني فعلت هذا الأمر لموقع الزهراء - مدرسة الزهراء الإعدادية - الناصرة
كان لديهم "نيوك" ونقلت كل المواضيع الى "جمله"...
بطريقة متخلفة وبدائيه ولكنها كانت جميلة ... اذا أنني احتفظت بأرشفة غوغل بدون اي مشاكل..
طريقة عملي كانت... أنني حافظت على نفس ال ID لكل مقال عندما نقلته الى جمله - وكل من فتش عن موضوع ووجده في نيوك - كنت أحوله الى جمله محافظاً على نفس رقم المقال - الأمر الذي حافظ على ارشفة المقالات في غوغل...
اليك الملفات التي استعملتها - لا تسألني عنها شيئاً فأنا أعطيها لك آملاً أن تعرف تشغيلها لوحدك - فلا تسألني عن اي شئ... هذا السكريبت كتبته بعد أن لم أجد ما طلبته في الانترنت...
وكل ما يفعله هو انه ينقل المواضيع - وليس اي شئ آخر.
كود:
// the list file - to list all Old posts in nuke
// name it list.php
<?php require_once('Connections/rs.php'); ?>
<?php
//UPDATE `jos_content` SET catid=31 WHERE catid=0;
$Result1 = mysql_query("SET NAMES 'latin1'", $rs) or die(mysql_error());
if (!function_exists("GetSQLValueString")) {
function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "")
{
$theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue;
$theValue = function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($theValue);
switch ($theType) {
case "text":
$theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
break;
case "long":
case "int":
$theValue = ($theValue != "") ? intval($theValue) : "NULL";
break;
case "double":
$theValue = ($theValue != "") ? "'" . doubleval($theValue) . "'" : "NULL";
break;
case "date":
$theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
break;
case "defined":
$theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue;
break;
}
return $theValue;
}
}
$currentPage = $_SERVER["PHP_SELF"];
$maxRows_Recordset1 = 3;
$pageNum_Recordset1 = 0;
if (isset($_GET['pageNum_Recordset1'])) {
$pageNum_Recordset1 = $_GET['pageNum_Recordset1'];
}
$startRow_Recordset1 = $pageNum_Recordset1 * $maxRows_Recordset1;
mysql_select_db($database_rs, $rs);
$query_Recordset1 = "SELECT sid, catid, title FROM nuke_stories";
$query_limit_Recordset1 = sprintf("%s LIMIT %d, %d", $query_Recordset1, $startRow_Recordset1, $maxRows_Recordset1);
$Recordset1 = mysql_query($query_limit_Recordset1, $rs) or die(mysql_error());
$row_Recordset1 = mysql_fetch_assoc($Recordset1);
if (isset($_GET['totalRows_Recordset1'])) {
$totalRows_Recordset1 = $_GET['totalRows_Recordset1'];
} else {
$all_Recordset1 = mysql_query($query_Recordset1);
$totalRows_Recordset1 = mysql_num_rows($all_Recordset1);
}
$totalPages_Recordset1 = ceil($totalRows_Recordset1/$maxRows_Recordset1)-1;
$queryString_Recordset1 = "";
if (!empty($_SERVER['QUERY_STRING'])) {
$params = explode("&", $_SERVER['QUERY_STRING']);
$newParams = array();
foreach ($params as $param) {
if (stristr($param, "pageNum_Recordset1") == false &&
stristr($param, "totalRows_Recordset1") == false) {
array_push($newParams, $param);
}
}
if (count($newParams) != 0) {
$queryString_Recordset1 = "&" . htmlentities(implode("&", $newParams));
}
}
$queryString_Recordset1 = sprintf("&totalRows_Recordset1=%d%s", $totalRows_Recordset1, $queryString_Recordset1);
?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=windows-1256" />
<title>Untitled Document</title>
</head>
<body>
<table width="100%" border="0">
<tr>
<td width="15%"> </td>
<td width="16%"> </td>
<td width="66%"> </td>
<td width="3%"> </td>
</tr>
<?php do { ?>
<tr>
<td><?php echo $row_Recordset1['sid']; ?></td>
<td><?php echo $row_Recordset1['catid']; ?></td>
<td><a href=migrate?sid=<?php echo $row_Recordset1['sid']; ?> ><?php echo $row_Recordset1['title']; ?> </a></td>
<td> </td>
</tr>
<?php } while ($row_Recordset1 = mysql_fetch_assoc($Recordset1)); ?>
<tr>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
</tr>
</table>
<a href="<?php printf("%s?pageNum_Recordset1=%d%s", $currentPage, min($totalPages_Recordset1, $pageNum_Recordset1 - 1), $queryString_Recordset1); ?>">Previous</a> <a href="<?php printf("%s?pageNum_Recordset1=%d%s", $currentPage, max(0, $pageNum_Recordset1 + 1), $queryString_Recordset1); ?>">Next</a>
</body>
</html>
<?php
mysql_free_result($Recordset1);
?>
كود:
//The migrating file to put the new posts in joomla after converting it to UTF8
<?php
require_once('Connections/rs.php');
function GetSQLValueString($v){
$v=iconv("windows-1256","utf-8", $v);
$v=mysql_real_escape_string($v);
return $v;
}
function GetSQLValueString2($v){
//$v=iconv("windows-1256","utf-8", $v);
return $v;
}
$editFormAction = $_SERVER['PHP_SELF'];
if (isset($_SERVER['QUERY_STRING'])) {
$editFormAction .= "?" . $_SERVER['QUERY_STRING'];
}
$colname_Record = "-1";
if (isset($_GET['sid']) ) {
$colname_Record = $_GET['sid'];
}
mysql_select_db($database_rs, $rs);
$Result1 = mysql_query("SET NAMES 'latin1'", $rs) or die(mysql_error());
$query_Record = sprintf("SELECT sid,title,catid,hometext,bodytext FROM nuke_stories WHERE sid = %s", GetSQLValueString($colname_Record, "int"));
$Record = mysql_query($query_Record, $rs) or die(mysql_error());
$row_Record = mysql_fetch_assoc($Record);
$totalRows_Record = mysql_num_rows($Record);
$sid=GetSQLValueString($row_Record['sid']);
$title=GetSQLValueString($row_Record['title']);
$catid=GetSQLValueString($row_Record['catid']);
if($catid=="0" || $catid==0) $catid==32;
$hometext=GetSQLValueString( $row_Record['hometext']);
$bodytext=GetSQLValueString( $row_Record['bodytext']);
$Result1 = mysql_query("SET NAMES 'utf8'", $rs) or die(mysql_error());
$insertSQL="INSERT INTO `jos_content` VALUES ('$sid', '$title', '$title', '', '$hometext', '$bodytext', 1, 1, 0, $catid, '2008-06-05 13:26:59', 63 , '', '0000-00-00 00:00:00', 0, 0, '0000-00-00 00:00:00', '2008-06-05 13:26:59', '0000-00-00 00:00:00', '', '', 'show_title=\nlink_titles=\nshow_intro=\nshow_section=\nlink_section=\nshow_category=\nlink_category=\nshow_vote=\nshow_author=\nshow_create_date=\nshow_modify_date=\nshow_pdf_icon=\nshow_print_icon=\nshow_email_icon=\nlanguage=\nkeyref=\nreadmore=', 1, 0, 1, '', '', 0, 0, 'robots=\nauthor=');";
mysql_select_db($database_rs, $rs);
$Result1 = mysql_query($insertSQL, $rs) or die(mysql_error());
$insertSQL="DELETE FROM nuke_stories WHERE sid = $colname_Record ; ";
$Result1 = mysql_query($insertSQL, $rs) or die(mysql_error());
mysql_free_result($Record);
header("Location: list.php");
?>
كود:
//simple connection file
<?php
# FileName="Connection_php_mysql.htm"
# Type="MYSQL"
# HTTP="true"
$hostname_rs = "localhost";
$database_rs = "alzahraa_oldnuke";
$username_rs = "root";
$password_rs = "";
$rs = mysql_pconnect($hostname_rs, $username_rs, $password_rs) or trigger_error(mysql_error(),E_USER_ERROR);
?>