|
From: <luc...@us...> - 2014-09-18 21:56:31
|
Revision: 12794
http://sourceforge.net/p/xoops/svn/12794
Author: luciorota
Date: 2014-09-18 21:56:17 +0000 (Thu, 18 Sep 2014)
Log Message:
-----------
$GLOBALS['...] instead of global $... IN PROGRESS
Modified Paths:
--------------
XoopsModules/wfdownloads/branches/luciorota/wfdownloads/admin/downloads.php
XoopsModules/wfdownloads/branches/luciorota/wfdownloads/admin/import.php
XoopsModules/wfdownloads/branches/luciorota/wfdownloads/admin/indexpage.php
XoopsModules/wfdownloads/branches/luciorota/wfdownloads/blocks/top.php
XoopsModules/wfdownloads/branches/luciorota/wfdownloads/blocks/top_by_cat.php
XoopsModules/wfdownloads/branches/luciorota/wfdownloads/brokenfile.php
XoopsModules/wfdownloads/branches/luciorota/wfdownloads/class/category.php
XoopsModules/wfdownloads/branches/luciorota/wfdownloads/class/dbupdater.php
XoopsModules/wfdownloads/branches/luciorota/wfdownloads/class/download.php
XoopsModules/wfdownloads/branches/luciorota/wfdownloads/class/mirror.php
XoopsModules/wfdownloads/branches/luciorota/wfdownloads/class/review.php
XoopsModules/wfdownloads/branches/luciorota/wfdownloads/include/functions.php
XoopsModules/wfdownloads/branches/luciorota/wfdownloads/include/notification.inc.php
XoopsModules/wfdownloads/branches/luciorota/wfdownloads/include/onupdate.php
XoopsModules/wfdownloads/branches/luciorota/wfdownloads/include/search.inc.php
XoopsModules/wfdownloads/branches/luciorota/wfdownloads/index.php
XoopsModules/wfdownloads/branches/luciorota/wfdownloads/mirror.php
XoopsModules/wfdownloads/branches/luciorota/wfdownloads/newlist.php
XoopsModules/wfdownloads/branches/luciorota/wfdownloads/ratefile.php
XoopsModules/wfdownloads/branches/luciorota/wfdownloads/review.php
XoopsModules/wfdownloads/branches/luciorota/wfdownloads/rss.php
XoopsModules/wfdownloads/branches/luciorota/wfdownloads/singlefile.php
XoopsModules/wfdownloads/branches/luciorota/wfdownloads/submit.php
XoopsModules/wfdownloads/branches/luciorota/wfdownloads/topten.php
XoopsModules/wfdownloads/branches/luciorota/wfdownloads/viewcat.php
XoopsModules/wfdownloads/branches/luciorota/wfdownloads/visit.php
XoopsModules/wfdownloads/branches/luciorota/wfdownloads/xoops_version.php
Modified: XoopsModules/wfdownloads/branches/luciorota/wfdownloads/admin/downloads.php
===================================================================
--- XoopsModules/wfdownloads/branches/luciorota/wfdownloads/admin/downloads.php 2014-09-18 21:15:31 UTC (rev 12793)
+++ XoopsModules/wfdownloads/branches/luciorota/wfdownloads/admin/downloads.php 2014-09-18 21:56:17 UTC (rev 12794)
@@ -104,7 +104,7 @@
include_once XOOPS_ROOT_PATH . '/modules/formulize/include/functions.php';
$customArray['fid'] = $fid;
$customArray['formulize_mgr'] = xoops_getmodulehandler('elements', 'formulize');
- $customArray['groups'] = $xoopsUser ? $xoopsUser->getGroups() : array(0 => XOOPS_GROUP_ANONYMOUS);
+ $customArray['groups'] = $GLOBALS['xoopsUser'] ? $GLOBALS['xoopsUser']->getGroups() : array(0 => XOOPS_GROUP_ANONYMOUS);
$customArray['prevEntry'] = getEntryValues( // is a Formulize function
$downloadObj->getVar('formulize_idreq'),
$customArray['formulize_mgr'],
@@ -458,8 +458,8 @@
$owner = '';
}
$ownerGroups = $member_handler->getGroupsByUser($owner, false);
- $uid = !empty($xoopsUser) ? $xoopsUser->getVar('uid') : 0;
- $groups = $xoopsUser ? $xoopsUser->getGroups() : array(0 => XOOPS_GROUP_ANONYMOUS);
+ $uid = !empty($GLOBALS['xoopsUser']) ? $GLOBALS['xoopsUser']->getVar('uid') : 0;
+ $groups = $GLOBALS['xoopsUser'] ? $GLOBALS['xoopsUser']->getGroups() : array(0 => XOOPS_GROUP_ANONYMOUS);
$entries = handleSubmission(
$formulize_mgr,
$entries,
@@ -557,11 +557,10 @@
print "<input type = submit name=patch_formulize value=\"Apply Patch for Formulize\">";
print "</form>";
} else {
- global $xoopsDB;
- $sqls[] = "ALTER TABLE " . $xoopsDB->prefix("wfdownloads_cat") . " ADD formulize_fid int(5) NOT NULL default '0';";
- $sqls[] = "ALTER TABLE " . $xoopsDB->prefix("wfdownloads_downloads") . " ADD formulize_idreq int(5) NOT NULL default '0';";
+ $sqls[] = "ALTER TABLE " . $GLOBALS['xoopsDB']->prefix('wfdownloads_cat') . " ADD formulize_fid int(5) NOT NULL default '0';";
+ $sqls[] = "ALTER TABLE " . $GLOBALS['xoopsDB']->prefix('wfdownloads_downloads') . " ADD formulize_idreq int(5) NOT NULL default '0';";
foreach ($sqls as $sql) {
- if (!$result = $xoopsDB->queryF($sql)) {
+ if (!$result = $GLOBALS['xoopsDB']->queryF($sql)) {
exit("Error patching for Formulize.<br>SQL dump:<br>" . $sql
. "<br>Please contact <a hre...@fr...>Freeform Solutions</a> for assistance.");
}
@@ -874,8 +873,8 @@
$downloadObj->setVar('published', time());
$downloadObj->setVar('date', time());
$downloadObj->setVar('ipaddress', $_SERVER['REMOTE_ADDR']);
- $downloadObj->setVar('submitter', $xoopsUser->getVar('uid', 'e'));
- $downloadObj->setVar('publisher', $xoopsUser->getVar('uid', 'e'));
+ $downloadObj->setVar('submitter', $GLOBALS['xoopsUser']->getVar('uid', 'e'));
+ $downloadObj->setVar('publisher', $GLOBALS['xoopsUser']->getVar('uid', 'e'));
if (!$wfdownloads->getHandler('download')->insert($downloadObj)) {
wfdownloads_delFile($wfdownloads->getConfig('uploaddir') . '/' . $savedFileName);
Modified: XoopsModules/wfdownloads/branches/luciorota/wfdownloads/admin/import.php
===================================================================
--- XoopsModules/wfdownloads/branches/luciorota/wfdownloads/admin/import.php 2014-09-18 21:15:31 UTC (rev 12793)
+++ XoopsModules/wfdownloads/branches/luciorota/wfdownloads/admin/import.php 2014-09-18 21:56:17 UTC (rev 12794)
@@ -248,13 +248,12 @@
*/
function import_wfd_to_wfdownloads()
{
- global $xoopsDB;
- $module_handler =& xoops_gethandler('module');
+ $module_handler = xoops_gethandler('module');
// Get source module/config
$wfdDirname = 'wf' . 'downloads'; // don't modify, is for cloning
$wfdModule = $module_handler->getByDirname($wfdDirname);
if (empty($wfdModuleConfig)) {
- $config_handler = xoops_gethandler("config");
+ $config_handler = xoops_gethandler('config');
$wfdModuleConfig = $config_handler->getConfigsByCat(0, $wfdModule->mid());
}
$wfdCategoriesHandler = xoops_getModuleHandler('category', $wfdDirname);
@@ -301,47 +300,47 @@
echo "<br />";
$destination = array(
- "cat" => $xoopsDB->prefix("wfdownloads_cat"),
- "downloads" => $xoopsDB->prefix("wfdownloads_downloads"),
- "mirrors" => $xoopsDB->prefix("wfdownloads_mirrors"),
- "reviews" => $xoopsDB->prefix("wfdownloads_reviews"),
- "broken" => $xoopsDB->prefix("wfdownloads_broken"),
- "mod" => $xoopsDB->prefix("wfdownloads_mod"),
- "votes" => $xoopsDB->prefix("wfdownloads_votedata")
+ "cat" => $GLOBALS['xoopsDB']->prefix("wfdownloads_cat"),
+ "downloads" => $GLOBALS['xoopsDB']->prefix("wfdownloads_downloads"),
+ "mirrors" => $GLOBALS['xoopsDB']->prefix("wfdownloads_mirrors"),
+ "reviews" => $GLOBALS['xoopsDB']->prefix("wfdownloads_reviews"),
+ "broken" => $GLOBALS['xoopsDB']->prefix("wfdownloads_broken"),
+ "mod" => $GLOBALS['xoopsDB']->prefix("wfdownloads_mod"),
+ "votes" => $GLOBALS['xoopsDB']->prefix("wfdownloads_votedata")
);
$source = array(
- "cat" => $xoopsDB->prefix("wf" . "downloads_cat"), // don't modify, is for cloning
- "downloads" => $xoopsDB->prefix("wf" . "downloads_downloads"), // don't modify, is for cloning
- "mirrors" => $xoopsDB->prefix("wf" . "downloads_mirrors"), // don't modify, is for cloning
- "reviews" => $xoopsDB->prefix("wf" . "downloads_reviews"), // don't modify, is for cloning
- "broken" => $xoopsDB->prefix("wf" . "downloads_broken"), // don't modify, is for cloning
- "mod" => $xoopsDB->prefix("wf" . "downloads_mod"), // don't modify, is for cloning
- "votes" => $xoopsDB->prefix("wf" . "downloads_votedata")
+ "cat" => $GLOBALS['xoopsDB']->prefix("wf" . "downloads_cat"), // don't modify, is for cloning
+ "downloads" => $GLOBALS['xoopsDB']->prefix("wf" . "downloads_downloads"), // don't modify, is for cloning
+ "mirrors" => $GLOBALS['xoopsDB']->prefix("wf" . "downloads_mirrors"), // don't modify, is for cloning
+ "reviews" => $GLOBALS['xoopsDB']->prefix("wf" . "downloads_reviews"), // don't modify, is for cloning
+ "broken" => $GLOBALS['xoopsDB']->prefix("wf" . "downloads_broken"), // don't modify, is for cloning
+ "mod" => $GLOBALS['xoopsDB']->prefix("wf" . "downloads_mod"), // don't modify, is for cloning
+ "votes" => $GLOBALS['xoopsDB']->prefix("wf" . "downloads_votedata")
); // don't modify, is for cloning
//Add temporary field to category table
- $xoopsDB->query("ALTER TABLE {$destination['cat']} ADD `old_cid` int NOT NULL default 0");
- $xoopsDB->query("ALTER TABLE {$destination['cat']} ADD `old_pid` int NOT NULL default 0");
+ $GLOBALS['xoopsDB']->query("ALTER TABLE {$destination['cat']} ADD `old_cid` int NOT NULL default 0");
+ $GLOBALS['xoopsDB']->query("ALTER TABLE {$destination['cat']} ADD `old_pid` int NOT NULL default 0");
//Add temporary fields to downloads table
- $xoopsDB->query("ALTER TABLE {$destination['downloads']} ADD `old_lid` int NOT NULL default 0");
- $xoopsDB->query("ALTER TABLE {$destination['downloads']} ADD `old_cid` int NOT NULL default 0");
+ $GLOBALS['xoopsDB']->query("ALTER TABLE {$destination['downloads']} ADD `old_lid` int NOT NULL default 0");
+ $GLOBALS['xoopsDB']->query("ALTER TABLE {$destination['downloads']} ADD `old_cid` int NOT NULL default 0");
//Get latest mirror ID to determine which records will need an updated lid value afterwards
- $result = $xoopsDB->query("SELECT MAX(mirror_id) FROM {$destination['mirrors']}");
- list($max_mirrorid) = $xoopsDB->fetchRow($result);
+ $result = $GLOBALS['xoopsDB']->query("SELECT MAX(mirror_id) FROM {$destination['mirrors']}");
+ list($max_mirrorid) = $GLOBALS['xoopsDB']->fetchRow($result);
//Get latest review ID to determine which records will need an updated lid value afterwards
- $result = $xoopsDB->query("SELECT MAX(review_id) FROM {$destination['reviews']}");
- list($max_reviewid) = $xoopsDB->fetchRow($result);
+ $result = $GLOBALS['xoopsDB']->query("SELECT MAX(review_id) FROM {$destination['reviews']}");
+ list($max_reviewid) = $GLOBALS['xoopsDB']->fetchRow($result);
//Get latest mod request ID to determine which records will need an updated lid value afterwards
- $result = $xoopsDB->query("SELECT MAX(requestid) FROM {$destination['mod']}");
- list($max_requestid) = $xoopsDB->fetchRow($result);
+ $result = $GLOBALS['xoopsDB']->query("SELECT MAX(requestid) FROM {$destination['mod']}");
+ list($max_requestid) = $GLOBALS['xoopsDB']->fetchRow($result);
//Get latest report ID to determine, which records will need an updated lid value afterwards
- $result = $xoopsDB->query("SELECT MAX(reportid) FROM {$destination['broken']}");
- list($max_reportid) = $xoopsDB->fetchRow($result);
+ $result = $GLOBALS['xoopsDB']->query("SELECT MAX(reportid) FROM {$destination['broken']}");
+ list($max_reportid) = $GLOBALS['xoopsDB']->fetchRow($result);
//Get latest vote ID to determine which records will need an updated lid value afterwards
- $result = $xoopsDB->query("SELECT MAX(ratingid) FROM {$destination['votes']}");
- list($max_ratingid) = $xoopsDB->fetchRow($result);
+ $result = $GLOBALS['xoopsDB']->query("SELECT MAX(ratingid) FROM {$destination['votes']}");
+ list($max_ratingid) = $GLOBALS['xoopsDB']->fetchRow($result);
//Import data into category table
if (wfdownloads_checkModule('wf' . 'downloads') >= 320) {
@@ -357,8 +356,8 @@
$sql .= " `cid`, `pid`, `title`, `imgurl`, `description`, `total`, `summary`, `spotlighttop`, `spotlighthis`, `dohtml`, `dosmiley`, `doxcode`, `doimage`, `dobr`, `weight`";
$sql .= " FROM {$source['cat']}";
}
- $xoopsDB->query($sql);
- echo "Imported {$xoopsDB->getAffectedRows()} categories into {$destination['cat']}<br />";
+ $GLOBALS['xoopsDB']->query($sql);
+ echo "Imported {$GLOBALS['xoopsDB']->getAffectedRows()} categories into {$destination['cat']}<br />";
//Import data into downloads table
if (wfdownloads_checkModule('wf' . 'downloads') >= 320) {
@@ -374,8 +373,8 @@
$sql .= " 0, `lid`, `cid`, `title`, `url`, `filename`, `filetype`, `homepage`, `version`, `size`, `platform`, `screenshot`, `submitter`, `publisher`, `status`, `date`, `hits`, `rating`, `votes`, `comments`, `license`, `mirror`, `price`, `paypalemail`, `features`, `requirements`, `homepagetitle`, `forumid`, `limitations`, `dhistory`, `published`, `expired`, `updated`, `offline`, `summary`, `description`, `ipaddress`, `notifypub`";
$sql .= " FROM {$source['downloads']}";
}
- $xoopsDB->query($sql);
- echo "Imported {$xoopsDB->getAffectedRows()} downloads into {$destination['downloads']}<br />";
+ $GLOBALS['xoopsDB']->query($sql);
+ echo "Imported {$GLOBALS['xoopsDB']->getAffectedRows()} downloads into {$destination['downloads']}<br />";
//Import data into mirrors table
$sql = "INSERT INTO {$destination['mirrors']} (";
@@ -383,8 +382,8 @@
$sql .= " ) SELECT";
$sql .= " `lid`, `title`, `homeurl`, `location`, `continent`, `downurl`, `submit`, `date`, `uid`";
$sql .= " FROM {$source['mirrors']}";
- $xoopsDB->query($sql);
- echo "Imported {$xoopsDB->getAffectedRows()} mirrors into {$destination['mirrors']}<br />";
+ $GLOBALS['xoopsDB']->query($sql);
+ echo "Imported {$GLOBALS['xoopsDB']->getAffectedRows()} mirrors into {$destination['mirrors']}<br />";
//Import data into reviews table
if (wfdownloads_checkModule('wf' . 'downloads') >= 320) {
@@ -400,8 +399,8 @@
$sql .= " `lid`, `title`, `review`, `submit`, `date`, `uid`";
$sql .= " FROM {$source['reviews']}";
}
- $xoopsDB->query($sql);
- echo "Imported {$xoopsDB->getAffectedRows()} reviews into {$destination['reviews']}<br />";
+ $GLOBALS['xoopsDB']->query($sql);
+ echo "Imported {$GLOBALS['xoopsDB']->getAffectedRows()} reviews into {$destination['reviews']}<br />";
//Import data into brokens table
$sql = "INSERT INTO {$destination['broken']} (";
@@ -409,8 +408,8 @@
$sql .= " ) SELECT";
$sql .= " `lid`, `sender`, `date`, `ip`";
$sql .= " FROM {$source['broken']}";
- $xoopsDB->query($sql);
- echo "Imported {$xoopsDB->getAffectedRows()} broken reports into {$destination['broken']}<br />";
+ $GLOBALS['xoopsDB']->query($sql);
+ echo "Imported {$GLOBALS['xoopsDB']->getAffectedRows()} broken reports into {$destination['broken']}<br />";
//Import data into votedata table
$sql = "INSERT INTO {$destination['votes']} (";
@@ -418,8 +417,8 @@
$sql .= " ) SELECT";
$sql .= " `lid`, `ratinguser`, `rating`, `ratinghostname`, `ratingtimestamp`";
$sql .= " FROM {$source['votes']}";
- $xoopsDB->query($sql);
- echo "Imported {$xoopsDB->getAffectedRows()} votes into {$destination['votes']}<br />";
+ $GLOBALS['xoopsDB']->query($sql);
+ echo "Imported {$GLOBALS['xoopsDB']->getAffectedRows()} votes into {$destination['votes']}<br />";
//Import data into mod request table
$sql = "INSERT INTO {$destination['mod']} (";
@@ -427,51 +426,51 @@
$sql .= " SELECT";
$sql .= " `lid`, `cid`, `title`, `url`, `homepage`, `version`, `size`, `platform`, `screenshot`, `description`, `modifysubmitter`, `features`, `requirements`, `publisher`, `dhistory`, `summary`";
$sql .= " FROM {$source['mod']}";
- $xoopsDB->query($sql);
- echo "Imported {$xoopsDB->getAffectedRows()} modification requests into {$destination['mod']}<br />";
+ $GLOBALS['xoopsDB']->query($sql);
+ echo "Imported {$GLOBALS['xoopsDB']->getAffectedRows()} modification requests into {$destination['mod']}<br />";
// Update category ID to new value
- $xoopsDB->query("UPDATE {$destination['downloads']} d, {$destination['cat']} c SET d.cid=c.cid WHERE d.old_cid=c.old_cid AND d.old_cid != 0");
- $xoopsDB->query("UPDATE {$destination['cat']} c1, {$destination['cat']} c2 SET c1.pid=c2.cid WHERE c1.old_pid=c2.old_cid AND c1.old_pid != 0");
+ $GLOBALS['xoopsDB']->query("UPDATE {$destination['downloads']} d, {$destination['cat']} c SET d.cid=c.cid WHERE d.old_cid=c.old_cid AND d.old_cid != 0");
+ $GLOBALS['xoopsDB']->query("UPDATE {$destination['cat']} c1, {$destination['cat']} c2 SET c1.pid=c2.cid WHERE c1.old_pid=c2.old_cid AND c1.old_pid != 0");
// Update lid values in mod table
if ($max_requestid) {
- $xoopsDB->query(
+ $GLOBALS['xoopsDB']->query(
"UPDATE {$destination['mod']} m, {$destination['cat']} c SET m.cid=c.cid WHERE m.requestid > {$max_requestid} AND c.old_cid=m.cid"
);
- $xoopsDB->query(
+ $GLOBALS['xoopsDB']->query(
"UPDATE {$destination['mod']} m, {$destination['downloads']} d SET m.lid=d.lid WHERE m.requestid > {$max_requestid} AND m.lid=d.old_lid"
);
}
// Update lid values in mirrors table
if ($max_mirrorid) {
- $xoopsDB->query(
+ $GLOBALS['xoopsDB']->query(
"UPDATE {$destination['mirrors']} v, {$destination['downloads']} d SET v.lid=d.lid WHERE v.mirror_id > {$max_mirrorid} AND v.lid=d.old_lid"
);
}
// Update lid values in reviews table
if ($max_reviewid) {
- $xoopsDB->query(
+ $GLOBALS['xoopsDB']->query(
"UPDATE {$destination['reviews']} v, {$destination['downloads']} d SET v.lid=d.lid WHERE v.review_id > {$max_reviewid} AND v.lid=d.old_lid"
);
}
// Update lid values in votedata table
if ($max_ratingid) {
- $xoopsDB->query(
+ $GLOBALS['xoopsDB']->query(
"UPDATE {$destination['votes']} v, {$destination['downloads']} d SET v.lid=d.lid WHERE v.ratingid > {$max_ratingid} AND v.lid=d.old_lid"
);
}
// Update lid values in broken table
if ($max_reportid) {
- $xoopsDB->query(
+ $GLOBALS['xoopsDB']->query(
"UPDATE {$destination['broken']} b, {$destination['downloads']} d SET b.lid=d.lid WHERE b.reportid > {$max_reportid} AND b.lid=d.old_lid"
);
}
//Remove temporary fields
- $xoopsDB->query("ALTER TABLE " . $destination['cat'] . " DROP `old_cid`");
- $xoopsDB->query("ALTER TABLE " . $destination['cat'] . " DROP `old_pid`");
- $xoopsDB->query("ALTER TABLE " . $destination['downloads'] . " DROP `old_cid`");
- $xoopsDB->query("ALTER TABLE " . $destination['downloads'] . " DROP `old_lid`");
+ $GLOBALS['xoopsDB']->query("ALTER TABLE " . $destination['cat'] . " DROP `old_cid`");
+ $GLOBALS['xoopsDB']->query("ALTER TABLE " . $destination['cat'] . " DROP `old_pid`");
+ $GLOBALS['xoopsDB']->query("ALTER TABLE " . $destination['downloads'] . " DROP `old_cid`");
+ $GLOBALS['xoopsDB']->query("ALTER TABLE " . $destination['downloads'] . " DROP `old_lid`");
return null;
}
@@ -481,111 +480,109 @@
// =========================================================================================
function import_wmpdownloads_to_wfdownloads()
{
- global $xoopsDB;
-
echo "<br />";
echo _AM_WFDOWNLOADS_IMPORT_IMPORTINGDATA;
echo "<br />";
$destination = array(
- "cat" => $xoopsDB->prefix("wfdownloads_cat"),
- "downloads" => $xoopsDB->prefix("wfdownloads_downloads"),
- "broken" => $xoopsDB->prefix("wfdownloads_broken"),
- "mod" => $xoopsDB->prefix("wfdownloads_mod"),
- "votes" => $xoopsDB->prefix("wfdownloads_votedata")
+ "cat" => $GLOBALS['xoopsDB']->prefix("wfdownloads_cat"),
+ "downloads" => $GLOBALS['xoopsDB']->prefix("wfdownloads_downloads"),
+ "broken" => $GLOBALS['xoopsDB']->prefix("wfdownloads_broken"),
+ "mod" => $GLOBALS['xoopsDB']->prefix("wfdownloads_mod"),
+ "votes" => $GLOBALS['xoopsDB']->prefix("wfdownloads_votedata")
);
$source = array(
- "cat" => $xoopsDB->prefix("wmpdownloads_cat"),
- "downloads" => $xoopsDB->prefix("wmpdownloads_downloads"),
- "broken" => $xoopsDB->prefix("wmpdownloads_broken"),
- "mod" => $xoopsDB->prefix("wmpdownloads_mod"),
- "votes" => $xoopsDB->prefix("wmpdownloads_votedata"),
- "text" => $xoopsDB->prefix("wmpdownloads_text")
+ "cat" => $GLOBALS['xoopsDB']->prefix("wmpdownloads_cat"),
+ "downloads" => $GLOBALS['xoopsDB']->prefix("wmpdownloads_downloads"),
+ "broken" => $GLOBALS['xoopsDB']->prefix("wmpdownloads_broken"),
+ "mod" => $GLOBALS['xoopsDB']->prefix("wmpdownloads_mod"),
+ "votes" => $GLOBALS['xoopsDB']->prefix("wmpdownloads_votedata"),
+ "text" => $GLOBALS['xoopsDB']->prefix("wmpdownloads_text")
);
//Add temporary field to category table
- $xoopsDB->query("ALTER TABLE " . $destination['cat'] . " ADD `old_cid` int NOT NULL default 0");
- $xoopsDB->query("ALTER TABLE " . $destination['cat'] . " ADD `old_pid` int NOT NULL default 0");
+ $GLOBALS['xoopsDB']->query("ALTER TABLE " . $destination['cat'] . " ADD `old_cid` int NOT NULL default 0");
+ $GLOBALS['xoopsDB']->query("ALTER TABLE " . $destination['cat'] . " ADD `old_pid` int NOT NULL default 0");
//Add temporary fields to downloads table
- $xoopsDB->query(
+ $GLOBALS['xoopsDB']->query(
"ALTER TABLE " . $destination['downloads'] . " ADD `old_lid` int NOT NULL default 0,
ADD `old_cid` int NOT NULL default 0"
);
//Get latest mod request ID to determine which records will need an updated lid value afterwards
- $result = $xoopsDB->query("SELECT MAX(requestid) FROM " . $destination['mod']);
- list($max_requestid) = $xoopsDB->fetchRow($result);
+ $result = $GLOBALS['xoopsDB']->query("SELECT MAX(requestid) FROM " . $destination['mod']);
+ list($max_requestid) = $GLOBALS['xoopsDB']->fetchRow($result);
//Get latest report ID to determine, which records will need an updated lid value afterwards
- $result = $xoopsDB->query("SELECT MAX(reportid) FROM " . $destination['broken']);
- list($max_reportid) = $xoopsDB->fetchRow($result);
+ $result = $GLOBALS['xoopsDB']->query("SELECT MAX(reportid) FROM " . $destination['broken']);
+ list($max_reportid) = $GLOBALS['xoopsDB']->fetchRow($result);
//Get latest vote ID to determine which records will need an updated lid value afterwards
- $result = $xoopsDB->query("SELECT MAX(ratingid) FROM " . $destination['votes']);
- list($max_ratingid) = $xoopsDB->fetchRow($result);
+ $result = $GLOBALS['xoopsDB']->query("SELECT MAX(ratingid) FROM " . $destination['votes']);
+ list($max_ratingid) = $GLOBALS['xoopsDB']->fetchRow($result);
//Import data into category table
- $xoopsDB->query(
+ $GLOBALS['xoopsDB']->query(
"INSERT"
. " INTO " . $destination['cat']
. " (`old_cid`, `old_pid`, `title`, `imgurl`, `summary`)"
. " SELECT `cid`, `pid`, `title`, `imgurl`, ''"
. " FROM " . $source['cat']
);
- echo "Imported " . $xoopsDB->getAffectedRows() . " categories into " . $destination['cat'] . "<br />";
+ echo "Imported " . $GLOBALS['xoopsDB']->getAffectedRows() . " categories into " . $destination['cat'] . "<br />";
//Import data into downloads table
- $xoopsDB->query(
+ $GLOBALS['xoopsDB']->query(
"INSERT"
. " INTO " . $destination['downloads']
. " (`cid`, `old_lid`, `old_cid`, `title`, `url`, `homepage`, `version`, `size`, `platform`, `screenshot`, `submitter`, `status`, `published`, `hits`, `rating`, `votes`, `comments`, `features`, `requirements`, `dhistory`, `summary`, `description`)"
. " SELECT 0,`lid`, `cid`, `title`, `url`, `homepage`, `version`, `size`, `platform`, `logourl`, `submitter`, `status`, `date`, `hits`, `rating`, `votes`, `comments`, '', '','','', ''"
. " FROM " . $source['downloads']
);
- echo "Imported " . $xoopsDB->getAffectedRows() . " downloads into " . $destination['downloads'] . "<br />";
+ echo "Imported " . $GLOBALS['xoopsDB']->getAffectedRows() . " downloads into " . $destination['downloads'] . "<br />";
//Import data into brokens table
- $xoopsDB->query(
+ $GLOBALS['xoopsDB']->query(
"INSERT"
. " INTO " . $destination['broken']
. " (`lid`, `sender`, `ip`)"
. " SELECT `lid`, `sender`, `ip`"
. " FROM " . $source['broken']
);
- echo "Imported " . $xoopsDB->getAffectedRows() . " broken reports into " . $destination['broken'] . "<br />";
+ echo "Imported " . $GLOBALS['xoopsDB']->getAffectedRows() . " broken reports into " . $destination['broken'] . "<br />";
//Import data into votedata table
- $xoopsDB->query(
+ $GLOBALS['xoopsDB']->query(
"INSERT"
. " INTO " . $destination['votes']
. " (`lid`, `ratinguser`, `rating`, `ratinghostname`, `ratingtimestamp`)"
. "SELECT `lid`, `ratinguser`, `rating`, `ratinghostname`, `ratingtimestamp`"
. " FROM " . $source['votes']
);
- echo "Imported " . $xoopsDB->getAffectedRows() . " votes into " . $destination['votes'] . "<br />";
+ echo "Imported " . $GLOBALS['xoopsDB']->getAffectedRows() . " votes into " . $destination['votes'] . "<br />";
//Import data into mod request table
- $xoopsDB->query(
+ $GLOBALS['xoopsDB']->query(
"INSERT INTO " . $destination['mod']
. " (`lid`, `cid`, `title`, `url`, `homepage`, `version`, `size`, `platform`, `screenshot`, `description`, `modifysubmitter`,`features`, `requirements`, `publisher`, `dhistory`, `summary`)"
. " SELECT `lid`, `cid`, `title`, `url`, `homepage`, `version`, `size`, `platform`, `logourl`, `description`, `modifysubmitter`,'','','','',''"
. " FROM " . $source['mod']
);
- echo "Imported " . $xoopsDB->getAffectedRows() . " modification requests into " . $destination['mod'] . "<br />";
+ echo "Imported " . $GLOBALS['xoopsDB']->getAffectedRows() . " modification requests into " . $destination['mod'] . "<br />";
//Update category ID to new value
- $xoopsDB->query(
+ $GLOBALS['xoopsDB']->query(
"UPDATE " . $destination['downloads'] . " d, " . $destination['cat'] . " c SET d.cid=c.cid"
. " WHERE d.old_cid=c.old_cid AND d.old_cid != 0"
);
- $xoopsDB->query(
+ $GLOBALS['xoopsDB']->query(
"UPDATE " . $destination['cat'] . " c1, " . $destination['cat'] . " c2 SET c1.pid=c2.cid"
. " WHERE c1.old_pid=c2.old_cid AND c1.old_pid != 0"
);
if ($max_requestid) {
- $xoopsDB->query(
+ $GLOBALS['xoopsDB']->query(
"UPDATE " . $destination['mod'] . " m, " . $destination['cat'] . " c SET m.cid=c.cid"
. " WHERE m.requestid > " . $max_requestid
. " AND c.old_cid=m.cid"
);
//Update lid values in mod table
- $xoopsDB->query(
+ $GLOBALS['xoopsDB']->query(
"UPDATE " . $destination['mod'] . " m, " . $destination['downloads'] . " d SET m.lid=d.lid"
. " WHERE m.requestid > " . $max_requestid
. " AND m.lid=d.old_lid"
@@ -593,7 +590,7 @@
}
if ($max_ratingid) {
//Update lid values in votedata table
- $xoopsDB->query(
+ $GLOBALS['xoopsDB']->query(
"UPDATE " . $destination['votes'] . " v, " . $destination['downloads'] . " d SET v.lid=d.lid"
. " WHERE v.ratingid > " . $max_ratingid
. " AND v.lid=d.old_lid"
@@ -601,21 +598,21 @@
}
if ($max_reportid) {
//Update lid values in brokens table
- $xoopsDB->query(
+ $GLOBALS['xoopsDB']->query(
"UPDATE " . $destination['broken'] . " b, " . $destination['downloads'] . " d SET b.lid=d.lid"
. " WHERE b.reportid > " . $max_reportid
. " AND b.lid=d.old_lid"
);
}
//Update description
- $xoopsDB->query("UPDATE " . $destination['downloads'] . " d, " . $source['text'] . " t SET d.description=t.description"
+ $GLOBALS['xoopsDB']->query("UPDATE " . $destination['downloads'] . " d, " . $source['text'] . " t SET d.description=t.description"
. " WHERE t.lid=d.old_lid");
//Remove temporary fields
- $xoopsDB->query("ALTER TABLE ." . $destination['cat'] . " DROP `old_cid`");
- $xoopsDB->query("ALTER TABLE ." . $destination['cat'] . " DROP `old_pid`");
- $xoopsDB->query("ALTER TABLE ." . $destination['downloads'] . " DROP `old_cid`");
- $xoopsDB->query("ALTER TABLE ." . $destination['downloads'] . " DROP `old_lid`");
+ $GLOBALS['xoopsDB']->query("ALTER TABLE ." . $destination['cat'] . " DROP `old_cid`");
+ $GLOBALS['xoopsDB']->query("ALTER TABLE ." . $destination['cat'] . " DROP `old_pid`");
+ $GLOBALS['xoopsDB']->query("ALTER TABLE ." . $destination['downloads'] . " DROP `old_cid`");
+ $GLOBALS['xoopsDB']->query("ALTER TABLE ." . $destination['downloads'] . " DROP `old_lid`");
}
@@ -624,106 +621,104 @@
// =========================================================================================
function import_pddownloads_to_wfdownloads()
{
- global $xoopsDB;
-
echo "<br />";
echo _AM_WFDOWNLOADS_IMPORT_IMPORTINGDATA;
echo "<br />";
$destination = array(
- "cat" => $xoopsDB->prefix("wfdownloads_cat"),
- "downloads" => $xoopsDB->prefix("wfdownloads_downloads"),
- "broken" => $xoopsDB->prefix("wfdownloads_broken"),
- "mod" => $xoopsDB->prefix("wfdownloads_mod"),
- "votes" => $xoopsDB->prefix("wfdownloads_votedata")
+ "cat" => $GLOBALS['xoopsDB']->prefix("wfdownloads_cat"),
+ "downloads" => $GLOBALS['xoopsDB']->prefix("wfdownloads_downloads"),
+ "broken" => $GLOBALS['xoopsDB']->prefix("wfdownloads_broken"),
+ "mod" => $GLOBALS['xoopsDB']->prefix("wfdownloads_mod"),
+ "votes" => $GLOBALS['xoopsDB']->prefix("wfdownloads_votedata")
);
$source = array(
- "cat" => $xoopsDB->prefix("PDdownloads_cat"),
- "downloads" => $xoopsDB->prefix("PDdownloads_downloads"),
- "broken" => $xoopsDB->prefix("PDdownloads_broken"),
- "mod" => $xoopsDB->prefix("PDdownloads_mod"),
- "votes" => $xoopsDB->prefix("PDdownloads_votedata")
+ "cat" => $GLOBALS['xoopsDB']->prefix("PDdownloads_cat"),
+ "downloads" => $GLOBALS['xoopsDB']->prefix("PDdownloads_downloads"),
+ "broken" => $GLOBALS['xoopsDB']->prefix("PDdownloads_broken"),
+ "mod" => $GLOBALS['xoopsDB']->prefix("PDdownloads_mod"),
+ "votes" => $GLOBALS['xoopsDB']->prefix("PDdownloads_votedata")
);
//Add temporary field to category table
- $xoopsDB->query("ALTER TABLE " . $destination['cat'] . " ADD `old_cid` int NOT NULL default 0");
- $xoopsDB->query("ALTER TABLE " . $destination['cat'] . " ADD `old_pid` int NOT NULL default 0");
+ $GLOBALS['xoopsDB']->query("ALTER TABLE " . $destination['cat'] . " ADD `old_cid` int NOT NULL default 0");
+ $GLOBALS['xoopsDB']->query("ALTER TABLE " . $destination['cat'] . " ADD `old_pid` int NOT NULL default 0");
//Add temporary fields to downloads table
- $xoopsDB->query(
+ $GLOBALS['xoopsDB']->query(
"ALTER TABLE " . $destination['downloads'] . " ADD `old_lid` int NOT NULL default 0,
ADD `old_cid` int NOT NULL default 0"
);
//Get latest mod request ID to determine which records will need an updated lid value afterwards
- $result = $xoopsDB->query("SELECT MAX(requestid) FROM " . $destination['mod']);
- list($max_requestid) = $xoopsDB->fetchRow($result);
+ $result = $GLOBALS['xoopsDB']->query("SELECT MAX(requestid) FROM " . $destination['mod']);
+ list($max_requestid) = $GLOBALS['xoopsDB']->fetchRow($result);
//Get latest report ID to determine, which records will need an updated lid value afterwards
- $result = $xoopsDB->query("SELECT MAX(reportid) FROM " . $destination['broken']);
- list($max_reportid) = $xoopsDB->fetchRow($result);
+ $result = $GLOBALS['xoopsDB']->query("SELECT MAX(reportid) FROM " . $destination['broken']);
+ list($max_reportid) = $GLOBALS['xoopsDB']->fetchRow($result);
//Get latest vote ID to determine which records will need an updated lid value afterwards
- $result = $xoopsDB->query("SELECT MAX(ratingid) FROM " . $destination['votes']);
- list($max_ratingid) = $xoopsDB->fetchRow($result);
+ $result = $GLOBALS['xoopsDB']->query("SELECT MAX(ratingid) FROM " . $destination['votes']);
+ list($max_ratingid) = $GLOBALS['xoopsDB']->fetchRow($result);
//Import data into category table
- $xoopsDB->query(
+ $GLOBALS['xoopsDB']->query(
"INSERT INTO " . $destination['cat']
. " (`old_cid`, `old_pid`, `title`, `imgurl`, `description`, `total`, `weight`)"
. " SELECT `cid`, `pid`, `title`, `imgurl`, `description`, `total`, `weight`"
. " FROM " . $source['cat']
);
- echo "Imported " . $xoopsDB->getAffectedRows() . " categories into " . $destination['cat'] . "<br />";
+ echo "Imported " . $GLOBALS['xoopsDB']->getAffectedRows() . " categories into " . $destination['cat'] . "<br />";
//Import data into downloads table
- $xoopsDB->query(
+ $GLOBALS['xoopsDB']->query(
"INSERT INTO " . $destination['downloads']
. " (`cid`, `old_lid`, `old_cid`, `title`, `url`, `homepage`, `homepagetitle`, `version`, `size`, `platform`, `screenshot`, `submitter`, `publisher`, `status`, `date`, `hits`, `rating`, `votes`, `comments`, `features`, `forumid`, `dhistory`, `published`, `expired`, `updated`, `offline`, `description`, `ipaddress`, `notifypub`)"
. " SELECT 0,`lid`, `cid`, `title`, `url`, `homepage`, `homepagetitle`, `version`, `size`, `platform`, `screenshot`, `submitter`, `publisher`, `status`, `date`, `hits`, `rating`, `votes`, `comments`, `features`, `forumid`, `dhistory`, `published`, `expired`, `updated`, `offline`, `description`, `ipaddress`, `notifypub`"
. " FROM " . $source['downloads']
);
- echo "Imported " . $xoopsDB->getAffectedRows() . " downloads into " . $destination['downloads'] . "<br />";
+ echo "Imported " . $GLOBALS['xoopsDB']->getAffectedRows() . " downloads into " . $destination['downloads'] . "<br />";
//Import data into brokens table
- $xoopsDB->query(
+ $GLOBALS['xoopsDB']->query(
"INSERT INTO " . $destination['broken']
. " (`reportid`, `lid`, `sender`, `ip`, `date`, `confirmed`, `acknowledged`)"
. " SELECT `reportid`, `lid`, `sender`, `ip`, `date`, `confirmed`, `acknowledged`"
. " FROM " . $source['broken']
);
- echo "Imported " . $xoopsDB->getAffectedRows() . " broken reports into " . $destination['broken'] . "<br />";
+ echo "Imported " . $GLOBALS['xoopsDB']->getAffectedRows() . " broken reports into " . $destination['broken'] . "<br />";
//Import data into votedata table
- $xoopsDB->query(
+ $GLOBALS['xoopsDB']->query(
"INSERT INTO " . $destination['votes']
. " (`ratingid`, `lid`, `ratinguser`, `rating`, `ratinghostname`, `ratingtimestamp`)"
. " SELECT `ratingid`, `lid`, `ratinguser`, `rating`, `ratinghostname`, `ratingtimestamp`"
. " FROM " . $source['votes']
);
- echo "Imported " . $xoopsDB->getAffectedRows() . " votes into " . $destination['votes'] . "<br />";
+ echo "Imported " . $GLOBALS['xoopsDB']->getAffectedRows() . " votes into " . $destination['votes'] . "<br />";
//Import data into mod request table
- $xoopsDB->query(
+ $GLOBALS['xoopsDB']->query(
"INSERT INTO " . $destination['mod']
. " (`lid`, `cid`, `title`, `url`, `homepage`, `homepagetitle`, `version`, `size`, `platform`, `screenshot`, `submitter`, `publisher`, `status`, `date`, `hits`, `rating`, `votes`, `comments`, `features`, `forumid`, `dhistory`, `published`, `expired`, `updated`, `offline`, `description`, `modifysubmitter`, `requestdate`)"
. " SELECT `lid`, `cid`, `title`, `url`, `homepage`, `homepagetitle`, `version`, `size`, `platform`, `screenshot`, `submitter`, `publisher`, `status`, `date`, `hits`, `rating`, `votes`, `comments`, `features`, `forumid`, `dhistory`, `published`, `expired`, `updated`, `offline`, `description`, `modifysubmitter`, `requestdate`"
. " FROM " . $source['mod']
);
- echo "Imported " . $xoopsDB->getAffectedRows() . " modification requests into " . $destination['mod'] . "<br />";
+ echo "Imported " . $GLOBALS['xoopsDB']->getAffectedRows() . " modification requests into " . $destination['mod'] . "<br />";
//Update category ID to new value
- $xoopsDB->query(
+ $GLOBALS['xoopsDB']->query(
"UPDATE " . $destination['downloads'] . " d, " . $destination['cat'] . " c SET d.cid=c.cid"
. " WHERE d.old_cid=c.old_cid AND d.old_cid != 0"
);
- $xoopsDB->query(
+ $GLOBALS['xoopsDB']->query(
"UPDATE " . $destination['cat'] . " c1, " . $destination['cat'] . " c2 SET c1.pid=c2.cid"
. " WHERE c1.old_pid=c2.old_cid AND c1.old_pid != 0"
);
if ($max_requestid) {
- $xoopsDB->query(
+ $GLOBALS['xoopsDB']->query(
"UPDATE " . $destination['mod'] . " m, " . $destination['cat'] . " c SET m.cid=c.cid"
. " WHERE m.requestid > " . $max_requestid
. " AND c.old_cid=m.cid"
);
//Update lid values in mod table
- $xoopsDB->query(
+ $GLOBALS['xoopsDB']->query(
"UPDATE " . $destination['mod'] . " m, " . $destination['downloads'] . " d SET m.lid=d.lid"
. " WHERE m.requestid > " . $max_requestid
. " AND m.lid=d.old_lid"
@@ -731,7 +726,7 @@
}
if ($max_ratingid) {
//Update lid values in votedata table
- $xoopsDB->query(
+ $GLOBALS['xoopsDB']->query(
"UPDATE " . $destination['votes'] . " v, " . $destination['downloads'] . " d SET v.lid=d.lid"
. " WHERE v.ratingid > " . $max_ratingid
. " AND v.lid=d.old_lid"
@@ -739,7 +734,7 @@
}
if ($max_reportid) {
//Update lid values in brokens table
- $xoopsDB->query(
+ $GLOBALS['xoopsDB']->query(
"UPDATE " . $destination['broken'] . " b, " . $destination['downloads'] . " d SET b.lid=d.lid"
. " WHERE b.reportid > " . $max_reportid
. " AND b.lid=d.old_lid"
@@ -747,10 +742,10 @@
}
//Remove temporary fields
- $xoopsDB->query("ALTER TABLE ." . $destination['cat'] . " DROP `old_cid`");
- $xoopsDB->query("ALTER TABLE ." . $destination['cat'] . " DROP `old_pid`");
- $xoopsDB->query("ALTER TABLE ." . $destination['downloads'] . " DROP `old_cid`");
- $xoopsDB->query("ALTER TABLE ." . $destination['downloads'] . " DROP `old_lid`");
+ $GLOBALS['xoopsDB']->query("ALTER TABLE ." . $destination['cat'] . " DROP `old_cid`");
+ $GLOBALS['xoopsDB']->query("ALTER TABLE ." . $destination['cat'] . " DROP `old_pid`");
+ $GLOBALS['xoopsDB']->query("ALTER TABLE ." . $destination['downloads'] . " DROP `old_cid`");
+ $GLOBALS['xoopsDB']->query("ALTER TABLE ." . $destination['downloads'] . " DROP `old_lid`");
}
@@ -759,107 +754,105 @@
// =========================================================================================
function import_mydownloads_to_wfdownloads()
{
- global $xoopsDB;
-
echo "<br />";
echo _AM_WFDOWNLOADS_IMPORT_IMPORTINGDATA;
echo "<br />";
$destination = array(
- "cat" => $xoopsDB->prefix("wfdownloads_cat"),
- "downloads" => $xoopsDB->prefix("wfdownloads_downloads"),
- "broken" => $xoopsDB->prefix("wfdownloads_broken"),
- "mod" => $xoopsDB->prefix("wfdownloads_mod"),
- "votes" => $xoopsDB->prefix("wfdownloads_votedata")
+ "cat" => $GLOBALS['xoopsDB']->prefix("wfdownloads_cat"),
+ "downloads" => $GLOBALS['xoopsDB']->prefix("wfdownloads_downloads"),
+ "broken" => $GLOBALS['xoopsDB']->prefix("wfdownloads_broken"),
+ "mod" => $GLOBALS['xoopsDB']->prefix("wfdownloads_mod"),
+ "votes" => $GLOBALS['xoopsDB']->prefix("wfdownloads_votedata")
);
$source = array(
- "cat" => $xoopsDB->prefix("mydownloads_cat"),
- "downloads" => $xoopsDB->prefix("mydownloads_downloads"),
- "broken" => $xoopsDB->prefix("mydownloads_broken"),
- "mod" => $xoopsDB->prefix("mydownloads_mod"),
- "votes" => $xoopsDB->prefix("mydownloads_votedata"),
- "text" => $xoopsDB->prefix("mydownloads_text")
+ "cat" => $GLOBALS['xoopsDB']->prefix("mydownloads_cat"),
+ "downloads" => $GLOBALS['xoopsDB']->prefix("mydownloads_downloads"),
+ "broken" => $GLOBALS['xoopsDB']->prefix("mydownloads_broken"),
+ "mod" => $GLOBALS['xoopsDB']->prefix("mydownloads_mod"),
+ "votes" => $GLOBALS['xoopsDB']->prefix("mydownloads_votedata"),
+ "text" => $GLOBALS['xoopsDB']->prefix("mydownloads_text")
);
//Add temporary field to category table
- $xoopsDB->query("ALTER TABLE " . $destination['cat'] . " ADD `old_cid` int NOT NULL default 0");
- $xoopsDB->query("ALTER TABLE " . $destination['cat'] . " ADD `old_pid` int NOT NULL default 0");
+ $GLOBALS['xoopsDB']->query("ALTER TABLE " . $destination['cat'] . " ADD `old_cid` int NOT NULL default 0");
+ $GLOBALS['xoopsDB']->query("ALTER TABLE " . $destination['cat'] . " ADD `old_pid` int NOT NULL default 0");
//Add temporary fields to downloads table
- $xoopsDB->query(
+ $GLOBALS['xoopsDB']->query(
"ALTER TABLE " . $destination['downloads'] . " ADD `old_lid` int NOT NULL default 0,
ADD `old_cid` int NOT NULL default 0"
);
//Get latest mod request ID to determine which records will need an updated lid value afterwards
- $result = $xoopsDB->query("SELECT MAX(requestid) FROM " . $destination['mod']);
- list($max_requestid) = $xoopsDB->fetchRow($result);
+ $result = $GLOBALS['xoopsDB']->query("SELECT MAX(requestid) FROM " . $destination['mod']);
+ list($max_requestid) = $GLOBALS['xoopsDB']->fetchRow($result);
//Get latest report ID to determine, which records will need an updated lid value afterwards
- $result = $xoopsDB->query("SELECT MAX(reportid) FROM " . $destination['broken']);
- list($max_reportid) = $xoopsDB->fetchRow($result);
+ $result = $GLOBALS['xoopsDB']->query("SELECT MAX(reportid) FROM " . $destination['broken']);
+ list($max_reportid) = $GLOBALS['xoopsDB']->fetchRow($result);
//Get latest vote ID to determine which records will need an updated lid value afterwards
- $result = $xoopsDB->query("SELECT MAX(ratingid) FROM " . $destination['votes']);
- list($max_ratingid) = $xoopsDB->fetchRow($result);
+ $result = $GLOBALS['xoopsDB']->query("SELECT MAX(ratingid) FROM " . $destination['votes']);
+ list($max_ratingid) = $GLOBALS['xoopsDB']->fetchRow($result);
//Import data into category table
- $xoopsDB->query(
+ $GLOBALS['xoopsDB']->query(
"INSERT INTO " . $destination['cat']
. " (`old_cid`, `old_pid`, `title`, `imgurl`, `summary`)"
. " SELECT `cid`, `pid`, `title`, `imgurl`, ''"
. " FROM " . $source['cat']
);
- echo "Imported " . $xoopsDB->getAffectedRows() . " categories into " . $destination['cat'] . "<br />";
+ echo "Imported " . $GLOBALS['xoopsDB']->getAffectedRows() . " categories into " . $destination['cat'] . "<br />";
//Import data into downloads table
- $xoopsDB->query(
+ $GLOBALS['xoopsDB']->query(
"INSERT INTO " . $destination['downloads']
. " (`cid`, `old_lid`, `old_cid`, `title`, `url`, `homepage`, `version`, `size`, `platform`, `screenshot`, `submitter`, `status`, `published`, `hits`, `rating`, `votes`, `comments`, `features`, `requirements`, `dhistory`, `summary`, `description`)"
. " SELECT 0,`lid`, `cid`, `title`, `url`, `homepage`, `version`, `size`, `platform`, `logourl`, `submitter`, `status`, `date`, `hits`, `rating`, `votes`, `comments`, '', '','','', ''"
. " FROM " . $source['downloads']
);
- echo "Imported " . $xoopsDB->getAffectedRows() . " downloads into " . $destination['downloads'] . "<br />";
+ echo "Imported " . $GLOBALS['xoopsDB']->getAffectedRows() . " downloads into " . $destination['downloads'] . "<br />";
//Import data into brokens table
- $xoopsDB->query(
+ $GLOBALS['xoopsDB']->query(
"INSERT INTO " . $destination['broken']
. " (`lid`, `sender`, `ip`)"
. " SELECT `lid`, `sender`, `ip`"
. " FROM " . $source['broken']
);
- echo "Imported " . $xoopsDB->getAffectedRows() . " broken reports into " . $destination['broken'] . "<br />";
+ echo "Imported " . $GLOBALS['xoopsDB']->getAffectedRows() . " broken reports into " . $destination['broken'] . "<br />";
//Import data into votedata table
- $xoopsDB->query(
+ $GLOBALS['xoopsDB']->query(
"INSERT INTO " . $destination['votes']
. " (`lid`, `ratinguser`, `rating`, `ratinghostname`, `ratingtimestamp`)"
. " SELECT `lid`, `ratinguser`, `rating`, `ratinghostname`, `ratingtimestamp`"
. " FROM " . $source['votes']
);
- echo "Imported " . $xoopsDB->getAffectedRows() . " votes into " . $destination['votes'] . "<br />";
+ echo "Imported " . $GLOBALS['xoopsDB']->getAffectedRows() . " votes into " . $destination['votes'] . "<br />";
//Import data into mod request table
- $xoopsDB->query(
+ $GLOBALS['xoopsDB']->query(
"INSERT INTO " . $destination['mod']
. " (`lid`, `cid`, `title`, `url`, `homepage`, `version`, `size`, `platform`, `screenshot`, `description`, `modifysubmitter`,`features`, `requirements`, `publisher`, `dhistory`, `summary`)"
. " SELECT `lid`, `cid`, `title`, `url`, `homepage`, `version`, `size`, `platform`, `logourl`, `description`, `modifysubmitter`,'','','','',''"
. " FROM " . $source['mod']
);
- echo "Imported " . $xoopsDB->getAffectedRows() . " modification requests into " . $destination['mod'] . "<br />";
+ echo "Imported " . $GLOBALS['xoopsDB']->getAffectedRows() . " modification requests into " . $destination['mod'] . "<br />";
//Update category ID to new value
- $xoopsDB->query(
+ $GLOBALS['xoopsDB']->query(
"UPDATE " . $destination['downloads'] . " d, " . $destination['cat'] . " c SET d.cid=c.cid"
. " WHERE d.old_cid=c.old_cid AND d.old_cid != 0"
);
- $xoopsDB->query(
+ $GLOBALS['xoopsDB']->query(
"UPDATE " . $destination['cat'] . " c1, " . $destination['cat'] . " c2 SET c1.pid=c2.cid"
. " WHERE c1.old_pid=c2.old_cid AND c1.old_pid != 0"
);
if ($max_requestid) {
- $xoopsDB->query(
+ $GLOBALS['xoopsDB']->query(
"UPDATE " . $destination['mod'] . " m, " . $destination['cat'] . " c SET m.cid=c.cid"
. " WHERE m.requestid > " . $max_requestid
. " AND c.old_cid=m.cid"
);
//Update lid values in mod table
- $xoopsDB->query(
+ $GLOBALS['xoopsDB']->query(
"UPDATE " . $destination['mod'] . " m, " . $destination['downloads'] . " d SET m.lid=d.lid"
. " WHERE m.requestid > " . $max_requestid
. " AND m.lid=d.old_lid"
@@ -867,7 +860,7 @@
}
if ($max_ratingid) {
//Update lid values in votedata table
- $xoopsDB->query(
+ $GLOBALS['xoopsDB']->query(
"UPDATE " . $destination['votes'] . " v, " . $destination['downloads'] . " d SET v.lid=d.lid"
. " WHERE v.ratingid > " . $max_ratingid
. " AND v.lid=d.old_lid"
@@ -875,23 +868,23 @@
}
if ($max_reportid) {
//Update lid values in brokens table
- $xoopsDB->query(
+ $GLOBALS['xoopsDB']->query(
"UPDATE " . $destination['broken'] . " b, " . $destination['downloads'] . " d SET b.lid=d.lid"
. " WHERE b.reportid > " . $max_reportid
. " AND b.lid=d.old_lid"
);
}
//Update description
- $xoopsDB->query(
+ $GLOBALS['xoopsDB']->query(
"UPDATE " . $destination['downloads'] . " d, " . $source['text'] . " t SET d.description=t.description"
. " WHERE t.lid=d.old_lid"
);
//Remove temporary fields
- $xoopsDB->query("ALTER TABLE ." . $destination['cat'] . " DROP `old_cid`");
- $xoopsDB->query("ALTER TABLE ." . $destination['cat'] . " DROP `old_pid`");
- $xoopsDB->query("ALTER TABLE ." . $destination['downloads'] . " DROP `old_cid`");
- $xoopsDB->query("ALTER TABLE ." . $destination['downloads'] . " DROP `old_lid`");
+ $GLOBALS['xoopsDB']->query("ALTER TABLE ." . $destination['cat'] . " DROP `old_cid`");
+ $GLOBALS['xoopsDB']->query("ALTER TABLE ." . $destination['cat'] . " DROP `old_pid`");
+ $GLOBALS['xoopsDB']->query("ALTER TABLE ." . $destination['downloads'] . " DROP `old_cid`");
+ $GLOBALS['xoopsDB']->query("ALTER TABLE ." . $destination['downloads'] . " DROP `old_lid`");
}
@@ -900,112 +893,110 @@
// =========================================================================================
function import_tdmdownloads_to_wfdownloads()
{
- global $xoopsDB;
-
echo "<br /><span style='font-weight: bold;'>Importing Data</span><br />";
$destination = array(
- "cat" => $xoopsDB->prefix("wfdownloads_cat"),
- "downloads" => $xoopsDB->prefix("wfdownloads_downloads"),
- "broken" => $xoopsDB->prefix("wfdownloads_broken"),
- "mod" => $xoopsDB->prefix("wfdownloads_mod"),
- "votes" => $xoopsDB->prefix("wfdownloads_votedata")
+ "cat" => $GLOBALS['xoopsDB']->prefix("wfdownloads_cat"),
+ "downloads" => $GLOBALS['xoopsDB']->prefix("wfdownloads_downloads"),
+ "broken" => $GLOBALS['xoopsDB']->prefix("wfdownloads_broken"),
+ "mod" => $GLOBALS['xoopsDB']->prefix("wfdownloads_mod"),
+ "votes" => $GLOBALS['xoopsDB']->prefix("wfdownloads_votedata")
);
$source = array(
- "cat" => $xoopsDB->prefix("tdmdownloads_cat"),
- "downloads" => $xoopsDB->prefix("tdmdownloads_downloads"),
- "broken" => $xoopsDB->prefix("tdmdownloads_broken"),
- "mod" => $xoopsDB->prefix("tdmdownloads_mod"),
- "votes" => $xoopsDB->prefix("tdmdownloads_votedata"),
- "field" => $xoopsDB->prefix("tdmdownloads_field"),
- "fielddata" => $xoopsDB->prefix("tdmdownloads_fielddata"),
- "modfielddata" => $xoopsDB->prefix("tdmdownloads_modfielddata"),
- "downlimit" => $xoopsDB->prefix("tdmdownloads_downlimit")
+ "cat" => $GLOBALS['xoopsDB']->prefix("tdmdownloads_cat"),
+ "downloads" => $GLOBALS['xoopsDB']->prefix("tdmdownloads_downloads"),
+ "broken" => $GLOBALS['xoopsDB']->prefix("tdmdownloads_broken"),
+ "mod" => $GLOBALS['xoopsDB']->prefix("tdmdownloads_mod"),
+ "votes" => $GLOBALS['xoopsDB']->prefix("tdmdownloads_votedata"),
+ "field" => $GLOBALS['xoopsDB']->prefix("tdmdownloads_field"),
+ "fielddata" => $GLOBALS['xoopsDB']->prefix("tdmdownloads_fielddata"),
+ "modfielddata" => $GLOBALS['xoopsDB']->prefix("tdmdownloads_modfielddata"),
+ "downlimit" => $GLOBALS['xoopsDB']->prefix("tdmdownloads_downlimit")
);
//Add temporary field to category table
- $xoopsDB->query("ALTER TABLE " . $destination['cat'] . " ADD `old_cid` int NOT NULL default 0");
- $xoopsDB->query("ALTER TABLE " . $destination['cat'] . " ADD `old_pid` int NOT NULL default 0");
+ $GLOBALS['xoopsDB']->query("ALTER TABLE " . $destination['cat'] . " ADD `old_cid` int NOT NULL default 0");
+ $GLOBALS['xoopsDB']->query("ALTER TABLE " . $destination['cat'] . " ADD `old_pid` int NOT NULL default 0");
//Add temporary fields to downloads table
- $xoopsDB->query(
+ $GLOBALS['xoopsDB']->query(
"ALTER TABLE " . $destination['downloads'] . " ADD `old_lid` int NOT NULL default 0,
ADD `old_cid` int NOT NULL default 0"
);
//Get latest mod request ID to determine which records will need an updated lid value afterwards
- $result = $xoopsDB->query("SELECT MAX(requestid) FROM " . $destination['mod']);
- list($max_requestid) = $xoopsDB->fetchRow($result);
+ $result = $GLOBALS['xoopsDB']->query("SELECT MAX(requestid) FROM " . $destination['mod']);
+ list($max_requestid) = $GLOBALS['xoopsDB']->fetchRow($result);
//Get latest report ID to determine, which records will need an updated lid value afterwards
- $result = $xoopsDB->query("SELECT MAX(reportid) FROM " . $destination['broken']);
- list($max_reportid) = $xoopsDB->fetchRow($result);
+ $result = $GLOBALS['xoopsDB']->query("SELECT MAX(reportid) FROM " . $destination['broken']);
+ list($max_reportid) = $GLOBALS['xoopsDB']->fetchRow($result);
//Get latest vote ID to determine which records will need an updated lid value afterwards
- $result = $xoopsDB->query("SELECT MAX(ratingid) FROM " . $destination['votes']);
- list($max_ratingid) = $xoopsDB->fetchRow($result);
+ $result = $GLOBALS['xoopsDB']->query("SELECT MAX(ratingid) FROM " . $destination['votes']);
+ list($max_ratingid) = $GLOBALS['xoopsDB']->fetchRow($result);
//Import data into category table
- $xoopsDB->query(
+ $GLOBALS['xoopsDB']->query(
"INSERT"
. " INTO " . $destination['cat']
. " (`old_cid`, `old_pid`, `title`, `imgurl`, `description`, `weight`, `dohtml`)"
. " SELECT `cat_cid`, `cat_pid`, `cat_title`, `cat_imgurl`, `cat_description_main`, `cat_weight`, 1"
. " FROM " . $source['cat']
);
- echo "Imported " . $xoopsDB->getAffectedRows() . " categories into " . $destination['cat'] . "<br />";
+ echo "Imported " . $GLOBALS['xoopsDB']->getAffectedRows() . " categories into " . $destination['cat'] . "<br />";
//Import data into downloads table
- $xoopsDB->query(
+ $GLOBALS['xoopsDB']->query(
"INSERT"
. " INTO " . $destination['downloads']
. " (`cid`, `old_lid`, `old_cid`, `title`, `url`, `homepage`, `version`, `size`, `platform`, `screenshot`, `submitter`, `status`, `published`, `hits`, `rating`, `votes`, `comments`, `features`, `requirements`, `dhistory`, `summary`, `description`, `dohtml`)"
. " SELECT 0, `lid`, `cid`, `title`, `url`, `homepage`, `version`, `size`, `platform`, `logourl`, `submitter`, `status`, `date`, `hits`, `rating`, `votes`, `comments`, '', '', '', '', `description`, 1"
. " FROM " . $source['downloads']
);
- echo "Imported " . $xoopsDB->getAffectedRows() . " downloads into " . $destination['downloads'] . "<br />";
+ echo "Imported " . $GLOBALS['xoopsDB']->getAffectedRows() . " downloads into " . $destination['downloads'] . "<br />";
//Import data into brokens table
- $xoopsDB->query(
+ $GLOBALS['xoopsDB']->query(
"INSERT"
. " INTO " . $destination['broken']
. " (`lid`, `sender`, `ip`)"
. " SELECT `lid`, `sender`, `ip`"
. " FROM " . $source['broken']
);
- echo "Imported " . $xoopsDB->getAffectedRows() . " broken reports into " . $destination['broken'] . "<br />";
+ echo "Imported " . $GLOBALS['xoopsDB']->getAffectedRows() . " broken reports into " . $destination['broken'] . "<br />";
//Import data into votedata table
- $xoopsDB->query(
+ $GLOBALS['xoopsDB']->query(
"INSERT"
. " INTO " . $destination['votes']
. " (`lid`, `ratinguser`, `rating`, `ratinghostname`, `ratingtimestamp`)"
. " SELECT `lid`, `ratinguser`, `rating`, `ratinghostname`, `ratingtimestamp`"
. " FROM " . $source['votes']
);
- echo "Imported " . $xoopsDB->getAffectedRows() . " votes into " . $destination['votes'] . "<br />";
+ echo "Imported " . $GLOBALS['xoopsDB']->getAffectedRows() . " votes into " . $destination['votes'] . "<br />";
/*
//Import data into mod request table
- $xoopsDB->query(
+ $GLOBALS['xoopsDB']->query(
"INSERT INTO " . $destination['mod'] . " (`lid`, `cid`, `title`, `url`, `homepage`, `version`, `size`, `platform`, `screenshot`, `description`, `modifysubmitter`,`features`, `requirements`, `publisher`, `dhistory`, `summary`)
SELECT `lid`, `cid`, `title`, `url`, `homepage`, `version`, `size`, `platform`, `logourl`, `description`, `modifysubmitter`,'','','','','' FROM "
. $source['mod']
);
- echo "Imported " . $xoopsDB->getAffectedRows() . " modification requests into " . $destination['mod'] . "<br />";
+ echo "Imported " . $GLOBALS['xoopsDB']->getAffectedRows() . " modification requests into " . $destination['mod'] . "<br />";
*/
//Update category ID to new value
- $xoopsDB->query(
+ $GLOBALS['xoopsDB']->query(
"UPDATE " . $destination['downloads'] . " d, " . $destination['cat'] . " c SET d.cid=c.cid"
. " WHERE d.old_cid=c.old_cid AND d.old_cid != 0"
);
- $xoopsDB->query(
+ $GLOBALS['xoopsDB']->query(
"UPDATE " . $destination['cat'] . " c1, " . $destination['cat'] . " c2 SET c1.pid=c2.cid"
. " WHERE c1.old_pid=c2.old_cid AND c1.old_pid != 0"
);
/*
if ($max_requestid) {
- $xoopsDB->query(
+ $GLOBALS['xoopsDB']->query(
"UPDATE " . $destination['mod'] . " m, " . $destination['cat'] . " c SET m.cid=c.cid"
. " WHERE m.requestid > " . $max_requestid
. " AND c.old_cid=m.cid"
);
//Update lid values in mod table
- $xoopsDB->query(
+ $GLOBALS['xoopsDB']->query(
"UPDATE " . $destination['mod'] . " m, " . $destination['downloads'] . " d SET m.lid=d.lid"
. " WHERE m.requestid > " . $max_requestid
. " AND m.lid=d.old_lid"
@@ -1014,7 +1005,7 @@
*/
if ($max_ratingid) {
//Update lid values in votedata table
- $xoopsDB->query(
+ $GLOBALS['xoopsDB']->query(
"UPDATE " . $destination['votes'] . " v, " . $destination['downloads'] . " d SET v.lid=d.lid"
. " WHERE v.ratingid > " . $max_ratingid
. " AND v.lid=d.old_lid"
@@ -1022,7 +1013,7 @@
}
if ($max_reportid) {
//Update lid values in brokens table
- $xoopsDB->query(
+ $GLOBALS['xoopsDB']->query(
"UPDATE " . $destination['broken'] . " b, " . $destination['downloads'] . " d SET b.lid=d.lid"
. " WHERE b.reportid > " . $max_reportid
. " AND b.lid=d.old_lid"
@@ -1030,9 +1021,8 @@
}
//Remove temporary fields
- $xoopsDB->query("ALTER TABLE ." . $destination['cat'] . " DROP `old_cid`");
- $xoopsDB->query("ALTER TABLE ." . $destination['cat'] . " DROP `old_pid`");
- $xoopsDB->query("ALTER TABLE ." . $destination['downloads'] . " DROP `old_cid`");
- $xoopsDB...
[truncated message content] |