|
From: <luc...@us...> - 2013-08-10 14:28:52
|
Revision: 11894
http://sourceforge.net/p/xoops/svn/11894
Author: luciorota
Date: 2013-08-10 14:28:46 +0000 (Sat, 10 Aug 2013)
Log Message:
-----------
module standardization: use WfdownloadWfdownload object instead of $xoopsModule, $xoopsModuleConfig and xoops_getmodulehandler
Modified Paths:
--------------
XoopsModules/wfdownloads/trunk/wfdownloads/admin/admin_header.php
XoopsModules/wfdownloads/trunk/wfdownloads/admin/categories.php
XoopsModules/wfdownloads/trunk/wfdownloads/admin/downloads.php
XoopsModules/wfdownloads/trunk/wfdownloads/admin/images.php
XoopsModules/wfdownloads/trunk/wfdownloads/admin/index.php
XoopsModules/wfdownloads/trunk/wfdownloads/admin/indexpage.php
XoopsModules/wfdownloads/trunk/wfdownloads/admin/ip_logs.php
XoopsModules/wfdownloads/trunk/wfdownloads/admin/mimetypes.php
XoopsModules/wfdownloads/trunk/wfdownloads/admin/mirrors.php
XoopsModules/wfdownloads/trunk/wfdownloads/admin/permissions.php
XoopsModules/wfdownloads/trunk/wfdownloads/admin/ratings.php
XoopsModules/wfdownloads/trunk/wfdownloads/admin/reportsmodifications.php
XoopsModules/wfdownloads/trunk/wfdownloads/admin/reviews.php
XoopsModules/wfdownloads/trunk/wfdownloads/blocks/top.php
XoopsModules/wfdownloads/trunk/wfdownloads/blocks/top_by_cat.php
XoopsModules/wfdownloads/trunk/wfdownloads/brokenfile.php
XoopsModules/wfdownloads/trunk/wfdownloads/class/category.php
XoopsModules/wfdownloads/trunk/wfdownloads/class/download.php
XoopsModules/wfdownloads/trunk/wfdownloads/class/mimetype.php
XoopsModules/wfdownloads/trunk/wfdownloads/class/modification.php
XoopsModules/wfdownloads/trunk/wfdownloads/comment_new.php
XoopsModules/wfdownloads/trunk/wfdownloads/docs/changelog.txt
XoopsModules/wfdownloads/trunk/wfdownloads/footer.php
XoopsModules/wfdownloads/trunk/wfdownloads/header.php
XoopsModules/wfdownloads/trunk/wfdownloads/include/comment_functions.php
XoopsModules/wfdownloads/trunk/wfdownloads/include/functions.php
XoopsModules/wfdownloads/trunk/wfdownloads/include/search.inc.php
XoopsModules/wfdownloads/trunk/wfdownloads/index.php
XoopsModules/wfdownloads/trunk/wfdownloads/mirror.php
XoopsModules/wfdownloads/trunk/wfdownloads/newlist.php
XoopsModules/wfdownloads/trunk/wfdownloads/ratefile.php
XoopsModules/wfdownloads/trunk/wfdownloads/review.php
XoopsModules/wfdownloads/trunk/wfdownloads/rss.php
XoopsModules/wfdownloads/trunk/wfdownloads/singlefile.php
XoopsModules/wfdownloads/trunk/wfdownloads/submit.php
XoopsModules/wfdownloads/trunk/wfdownloads/topten.php
XoopsModules/wfdownloads/trunk/wfdownloads/viewcat.php
XoopsModules/wfdownloads/trunk/wfdownloads/visit.php
XoopsModules/wfdownloads/trunk/wfdownloads/xoops_version.php
Modified: XoopsModules/wfdownloads/trunk/wfdownloads/admin/admin_header.php
===================================================================
--- XoopsModules/wfdownloads/trunk/wfdownloads/admin/admin_header.php 2013-08-09 20:19:06 UTC (rev 11893)
+++ XoopsModules/wfdownloads/trunk/wfdownloads/admin/admin_header.php 2013-08-10 14:28:46 UTC (rev 11894)
@@ -67,17 +67,6 @@
xoops_loadLanguage('modinfo', $xoopsModule->dirname());
xoops_loadLanguage('main', $xoopsModule->dirname());
-// Load module handlers
-$category_handler = xoops_getmodulehandler('category', $xoopsModule->dirname());
-$download_handler = xoops_getmodulehandler('download', $xoopsModule->dirname());
-$review_handler = xoops_getmodulehandler('review', $xoopsModule->dirname());
-$mirror_handler = xoops_getmodulehandler('mirror', $xoopsModule->dirname());
-$mime_handler = xoops_getmodulehandler('mimetype', $xoopsModule->dirname());
-$report_handler = xoops_getmodulehandler('report', $xoopsModule->dirname());
-$modification_handler = xoops_getmodulehandler('modification', $xoopsModule->dirname());
-$ip_log_handler = xoops_getmodulehandler('ip_log', $xoopsModule->dirname());
-$rating_handler = xoops_getmodulehandler('rating', $xoopsModule->dirname());
-
// Load Xoops handlers
$member_handler = xoops_gethandler('member');
$notification_handler = &xoops_gethandler('notification');
Modified: XoopsModules/wfdownloads/trunk/wfdownloads/admin/categories.php
===================================================================
--- XoopsModules/wfdownloads/trunk/wfdownloads/admin/categories.php 2013-08-09 20:19:06 UTC (rev 11893)
+++ XoopsModules/wfdownloads/trunk/wfdownloads/admin/categories.php 2013-08-10 14:28:46 UTC (rev 11894)
@@ -39,8 +39,7 @@
include_once XOOPS_ROOT_PATH . '/class/xoopsformloader.php';
$sform = new XoopsThemeForm(_AM_WFD_CCATEGORY_MOVE, "move", xoops_getenv('PHP_SELF'));
- $category_handler = xoops_getmodulehandler('category');
- $categories = $category_handler->getObjects();
+ $categories = $wfdownloads->getHandler('category')->getObjects();
$mytree = new XoopsObjectTree($categories, "cid", "pid");
$sform->addElement(new XoopsFormLabel(_AM_WFD_BMODIFY, $mytree->makeSelBox('target', 'title')));
$create_tray = new XoopsFormElementTray('', '');
@@ -65,8 +64,7 @@
if (!$target) {
redirect_header($currentFile . "?op=category.move&ok=0&cid={$source}", 5, _AM_WFD_CCATEGORY_MODIFY_FAILEDT);
}
- $download_handler = xoops_getmodulehandler('download');
- $result = $download_handler->updateAll("cid", $target, new Criteria("cid", $source), true);
+ $result = $wfdownloads->getHandler('download')->updateAll("cid", $target, new Criteria("cid", $source), true);
if (!$result) {
$error = _AM_WFD_DBERROR;
trigger_error($error, E_USER_ERROR);
@@ -93,12 +91,11 @@
$doimage = isset($_POST['doimage']);
$dobr = isset($_POST['dobr']);
- $category_handler = xoops_getmodulehandler('category');
if (!$cid) {
- $category = $category_handler->create();
+ $category = $wfdownloads->getHandler('category')->create();
} else {
- $category = $category_handler->get($cid);
- $childcats = $category_handler->getChildCats($category);
+ $category = $wfdownloads->getHandler('category')->get($cid);
+ $childcats = $wfdownloads->getHandler('category')->getChildCats($category);
if ($pid == $cid || in_array($pid, array_keys($childcats))) {
$category->setErrors(_AM_WFD_CCATEGORY_CHILDASPARENT);
}
@@ -122,7 +119,7 @@
// added - start - March 4 2006 - jpc
$category->setVar('formulize_fid', $formulize_fid);
// added - end - March 4 2006 - jpc
- $result = $category_handler->insert($category);
+ $result = $wfdownloads->getHandler('category')->insert($category);
if (!$result) {
echo $category->getHtmlErrors();
}
@@ -153,8 +150,7 @@
case "del" :
$cid = wfdownloads_CleanVars($_REQUEST, 'cid', 0, 'int');
$ok = wfdownloads_CleanVars($_POST, 'ok', false, 'boolean');
- $category_handler = xoops_getmodulehandler('category');
- $categories = $category_handler->getObjects();
+ $categories = $wfdownloads->getHandler('category')->getObjects();
$mytree = new XoopsObjectTree($categories, "cid", "pid");
if ($ok == true) {
// get all subcategories under the specified category
@@ -167,25 +163,21 @@
$criteria = new Criteria("cid", "(" . implode(',', $cids) . ")", "IN");
- $download_handler = xoops_getmodulehandler('download');
//get list of downloads in these subcategories
- $downloads = $download_handler->getList($criteria);
+ $downloads = $wfdownloads->getHandler('download')->getList($criteria);
$download_criteria = new Criteria("lid", "(" . implode(',', array_keys($downloads)) . ")", "IN");
- $rating_handler = xoops_getmodulehandler('rating');
- $report_handler = xoops_getmodulehandler('report');
-
// now for each download, delete the text data and vote data associated with the download
- $rating_handler->deleteAll($download_criteria);
- $report_handler->deleteAll($download_criteria);
- $download_handler->deleteAll($download_criteria);
+ $wfdownloads->getHandler('rating')->deleteAll($download_criteria);
+ $wfdownloads->getHandler('report')->deleteAll($download_criteria);
+ $wfdownloads->getHandler('download')->deleteAll($download_criteria);
foreach (array_keys($downloads) as $lid) {
xoops_comment_delete($xoopsModule->getVar('mid'), (int)$lid);
}
// all downloads for each category is deleted, now delete the category data
- $category_handler->deleteAll($criteria);
+ $wfdownloads->getHandler('category')->deleteAll($criteria);
$error = _AM_WFD_DBERROR;
foreach ($cids as $cid) {
@@ -215,9 +207,9 @@
echo $adminMenu->renderButton();
if (isset($_REQUEST['cid'])) {
- $category = $category_handler->get($_REQUEST['cid']);
+ $category = $wfdownloads->getHandler('category')->get($_REQUEST['cid']);
} else {
- $category = $category_handler->create();
+ $category = $wfdownloads->getHandler('category')->create();
}
$form = $category->getForm();
$form -> display();
@@ -258,9 +250,9 @@
$new_weights = $_POST['new_weights'];
$ids = array();
foreach ($new_weights as $cid => $new_weight ) {
- $category = $category_handler->get($cid);
+ $category = $wfdownloads->getHandler('category')->get($cid);
$category->setVar('weight', $new_weight);
- if (!$category_handler->insert($category)) {
+ if (!$wfdownloads->getHandler('category')->insert($category)) {
redirect_header($currentFile, 3, $category->getErrors());
}
unset($category);
Modified: XoopsModules/wfdownloads/trunk/wfdownloads/admin/downloads.php
===================================================================
--- XoopsModules/wfdownloads/trunk/wfdownloads/admin/downloads.php 2013-08-09 20:19:06 UTC (rev 11893)
+++ XoopsModules/wfdownloads/trunk/wfdownloads/admin/downloads.php 2013-08-10 14:28:46 UTC (rev 11894)
@@ -20,6 +20,7 @@
*/
$currentFile = basename(__FILE__);
include 'admin_header.php';
+
include_once XOOPS_ROOT_PATH . '/class/xoopsform/grouppermform.php';
include_once WFDOWNLOADS_ROOT_PATH . '/class/wfd_lists.php';
@@ -52,7 +53,7 @@
case "download.delete" :
$lid = wfdownloads_CleanVars($_REQUEST, 'lid', 0, 'int');
$ok = wfdownloads_CleanVars($_POST, 'ok', false, 'boolean');
- if (!$download = $download_handler->get($lid)) {
+ if (!$download = $wfdownloads->getHandler('download')->get($lid)) {
redirect_header($currentFile, 4, _AM_WFD_ERROR_DOWNLOADNOTFOUND);
exit();
}
@@ -61,12 +62,12 @@
if (!$GLOBALS['xoopsSecurity']->check()) {
redirect_header($currentFile, 3, implode(',', $GLOBALS['xoopsSecurity']->getErrors()));
}
- $file = $xoopsModuleConfig['uploaddir'] . "/" . $download->getVar('filename');
+ $file = $wfdownloads->getConfig('uploaddir') . "/" . $download->getVar('filename');
if (is_file($file)) {
@chmod($file, 0777);
@unlink($file);
}
- if ($download_handler->delete($download)) {
+ if ($wfdownloads->getHandler('download')->delete($download)) {
redirect_header($currentFile, 1, sprintf(_AM_WFD_FILE_FILEWASDELETED, $title));
} else {
echo $download->getHtmlErrors();
@@ -80,9 +81,8 @@
case "vote.delete" :
case "delVote" :
- $rating_handler = xoops_getmodulehandler('rating');
- $rating = $rating_handler->get($_GET['rid']);
- if ($rating_handler->delete($rating, true)) {
+ $rating = $wfdownloads->getHandler('rating')->get($_GET['rid']);
+ if ($wfdownloads->getHandler('rating')->delete($rating, true)) {
wfd_updaterating(intval($rating->getVar('lid')));
}
redirect_header($currentFile, 1, _AM_WFD_VOTE_VOTEDELETED);
@@ -109,28 +109,26 @@
case "newdownload.approve" :
case "approve":
$lid = wfdownloads_CleanVars($_REQUEST, 'lid', 0, 'int');
- $download_handler = xoops_getmodulehandler('download');
- if (!$download = $download_handler->get($lid)) {
+ if (!$download = $wfdownloads->getHandler('download')->get($lid)) {
redirect_header($currentFile, 4, _AM_WFD_ERROR_DOWNLOADNOTFOUND);
exit();
}
// Update the database
$download->setVar('published', time());
$download->setVar('status', 1);
- if (!$download_handler->insert($download, true)) {
+ if (!$wfdownloads->getHandler('download')->insert($download, true)) {
echo $download->getHtmlErrors();
exit();
}
// Trigger notify
$title = $download->getVar('title');
$cid = $download->getVar('cid');
- $category = $category_handler->get($cid);
+ $category = $wfdownloads->getHandler('category')->get($cid);
$tags = array();
$tags['FILE_NAME'] = $title;
$tags['FILE_URL'] = WFDOWNLOADS_URL . "/singlefile.php?cid={$cid}&lid={$lid}";
$tags['CATEGORY_NAME'] = $category->getVar('title');
$tags['CATEGORY_URL'] = WFDOWNLOADS_URL . "/viewcat.php?cid={$cid}";
- $notification_handler = &xoops_gethandler('notification');
$notification_handler->triggerEvent('global', 0, 'new_file', $tags);
$notification_handler->triggerEvent('category', $cid, 'new_file', $tags);
if ($download->getVar('notifypub')) {
@@ -143,7 +141,7 @@
default :
include_once XOOPS_ROOT_PATH . '/class/pagenav.php';
- $categories = $category_handler->getObjects();
+ $categories = $wfdownloads->getHandler('category')->getObjects();
$start_published = wfdownloads_CleanVars($_GET, 'start_published', 0, 'int');
$start_new = wfdownloads_CleanVars($_GET, 'start_new', 0, 'int');
@@ -152,14 +150,14 @@
$start_offline = wfdownloads_CleanVars($_GET, 'start_offline', 0, 'int');
$totalcats = wfd_totalcategory();
- $categories = $category_handler->getObjects(null, true, false);
+ $categories = $wfdownloads->getHandler('category')->getObjects(null, true, false);
- $totalbrokendownloads = $report_handler->getCount();
- $totalmodrequests = $modification_handler->getCount();
- $newreviews = $review_handler->getCount();
- $newmirrors = $mirror_handler->getCount();
- $totalnewdownloads = $download_handler->getCount(new Criteria("published", 0));
- $totaldownloads = $download_handler->getCount(new Criteria("published", 0, ">"));
+ $totalbrokendownloads = $wfdownloads->getHandler('report')->getCount();
+ $totalmodrequests = $wfdownloads->getHandler('modification')->getCount();
+ $newreviews = $wfdownloads->getHandler('review')->getCount();
+ $newmirrors = $wfdownloads->getHandler('mirror')->getCount();
+ $totalnewdownloads = $wfdownloads->getHandler('download')->getCount(new Criteria("published", 0));
+ $totaldownloads = $wfdownloads->getHandler('download')->getCount(new Criteria("published", 0, ">"));
wfdownloads_xoops_cp_header();
$indexAdmin = new ModuleAdmin();
@@ -176,9 +174,9 @@
$criteria->setSort("published");
$criteria->setOrder("DESC");
$criteria->setStart($start_published);
- $criteria->setLimit($xoopsModuleConfig['admin_perpage']);
- $published_downloads = $download_handler->getActiveDownloads($criteria);
- $published_downloads_count = $download_handler->getActiveCount();
+ $criteria->setLimit($wfdownloads->getConfig('admin_perpage'));
+ $published_downloads = $wfdownloads->getHandler('download')->getActiveDownloads($criteria);
+ $published_downloads_count = $wfdownloads->getHandler('download')->getActiveCount();
$GLOBALS['xoopsTpl']->assign('published_downloads_count', $published_downloads_count);
if ($published_downloads_count > 0) {
foreach ($published_downloads as $published_download) {
@@ -191,16 +189,16 @@
}
}
- $pagenav = new XoopsPageNav($published_downloads_count, $xoopsModuleConfig['admin_perpage'], $start_published, 'start_published');
+ $pagenav = new XoopsPageNav($published_downloads_count, $wfdownloads->getConfig('admin_perpage'), $start_published, 'start_published');
$GLOBALS['xoopsTpl']->assign('published_downloads_pagenav', $pagenav->renderNav());
// New Downloads
$criteria = new CriteriaCompo();
$criteria->add(new Criteria("published", 0));
$criteria->setStart($start_new);
- $criteria->setLimit($xoopsModuleConfig['admin_perpage']);
- $new_downloads = $download_handler->getObjects($criteria);
- $new_downloads_count = $download_handler->getCount($criteria);
+ $criteria->setLimit($wfdownloads->getConfig('admin_perpage'));
+ $new_downloads = $wfdownloads->getHandler('download')->getObjects($criteria);
+ $new_downloads_count = $wfdownloads->getHandler('download')->getCount($criteria);
$GLOBALS['xoopsTpl']->assign('new_downloads_count', $new_downloads_count);
if ($new_downloads_count > 0) {
foreach ($new_downloads as $new_download) {
@@ -219,7 +217,7 @@
$GLOBALS['xoopsTpl']->append('new_downloads', $new_download_array);
}
}
- $pagenav = new XoopsPageNav($new_downloads_count, $xoopsModuleConfig['admin_perpage'], $start_new, 'start_new');
+ $pagenav = new XoopsPageNav($new_downloads_count, $wfdownloads->getConfig('admin_perpage'), $start_new, 'start_new');
$GLOBALS['xoopsTpl']->assign('new_downloads_pagenav', $pagenav->renderNav());
// Auto Published Downloads
@@ -228,9 +226,9 @@
$criteria->setSort("published");
$criteria->setOrder("ASC");
$criteria->setStart($start_auto_published);
- $criteria->setLimit($xoopsModuleConfig['admin_perpage']);
- $auto_published_downloads = $download_handler->getObjects($criteria);
- $auto_published_downloads_count = $download_handler->getCount($criteria);
+ $criteria->setLimit($wfdownloads->getConfig('admin_perpage'));
+ $auto_published_downloads = $wfdownloads->getHandler('download')->getObjects($criteria);
+ $auto_published_downloads_count = $wfdownloads->getHandler('download')->getCount($criteria);
$GLOBALS['xoopsTpl']->assign('auto_published_downloads_count', $auto_published_downloads_count);
if ($auto_published_downloads_count > 0) {
foreach ($auto_published_downloads as $auto_published_download) {
@@ -242,7 +240,7 @@
$GLOBALS['xoopsTpl']->append('auto_published_downloads', $auto_published_download_array);
}
}
- $pagenav = new XoopsPageNav($auto_published_downloads_count, $xoopsModuleConfig['admin_perpage'], $start_auto_published, 'start_auto_published');
+ $pagenav = new XoopsPageNav($auto_published_downloads_count, $wfdownloads->getConfig('admin_perpage'), $start_auto_published, 'start_auto_published');
$GLOBALS['xoopsTpl']->assign('auto_published_downloads_pagenav', $pagenav->renderNav());
// Expired downloads
@@ -252,9 +250,9 @@
$criteria->setSort("expired");
$criteria->setOrder("ASC");
$criteria->setStart($start_expired);
- $criteria->setLimit($xoopsModuleConfig['admin_perpage']);
- $expired_downloads = $download_handler->getObjects($criteria);
- $expired_downloads_count = $download_handler->getCount($criteria);
+ $criteria->setLimit($wfdownloads->getConfig('admin_perpage'));
+ $expired_downloads = $wfdownloads->getHandler('download')->getObjects($criteria);
+ $expired_downloads_count = $wfdownloads->getHandler('download')->getCount($criteria);
$GLOBALS['xoopsTpl']->assign('expired_downloads_count', $expired_downloads_count);
if ($expired_downloads_count > 0) {
foreach ($expired_downloads as $expired_download) {
@@ -266,7 +264,7 @@
$GLOBALS['xoopsTpl']->append('expired_downloads', $expired_download_array);
}
}
- $pagenav = new XoopsPageNav($expired_downloads_count, $xoopsModuleConfig['admin_perpage'], $start_expired, 'start_expired');
+ $pagenav = new XoopsPageNav($expired_downloads_count, $wfdownloads->getConfig('admin_perpage'), $start_expired, 'start_expired');
$GLOBALS['xoopsTpl']->assign('expired_downloads_pagenav', $pagenav->renderNav());
// Offline downloads
@@ -274,10 +272,10 @@
$criteria->setSort("published");
$criteria->setOrder("ASC");
$criteria->setStart($start_offline);
- $criteria->setLimit($xoopsModuleConfig['admin_perpage']);
- $offline_downloads_count = $download_handler->getCount($criteria);
- $offline_downloads = $download_handler->getObjects($criteria);
- $offline_downloads_count = $download_handler->getCount($criteria);
+ $criteria->setLimit($wfdownloads->getConfig('admin_perpage'));
+ $offline_downloads_count = $wfdownloads->getHandler('download')->getCount($criteria);
+ $offline_downloads = $wfdownloads->getHandler('download')->getObjects($criteria);
+ $offline_downloads_count = $wfdownloads->getHandler('download')->getCount($criteria);
$GLOBALS['xoopsTpl']->assign('offline_downloads_count', $offline_downloads_count);
if ($offline_downloads_count > 0) {
foreach ($offline_downloads as $offline_download) {
@@ -290,7 +288,7 @@
$GLOBALS['xoopsTpl']->append('offline_downloads', $offline_download_array);
}
}
- $pagenav = new XoopsPageNav($offline_downloads_count, $xoopsModuleConfig['admin_perpage'], $start_offline, 'start_offline');
+ $pagenav = new XoopsPageNav($offline_downloads_count, $wfdownloads->getConfig('admin_perpage'), $start_offline, 'start_offline');
$GLOBALS['xoopsTpl']->assign('offline_downloads_pagenav', $pagenav->renderNav());
} else {
// NOP
@@ -306,39 +304,37 @@
function addDownload()
{
global $xoopsUser, $imagearray, $currentFile;
- $download_handler = xoops_getmodulehandler('download');
- $category_handler = xoops_getmodulehandler('category');
+ $wfdownloads = WfdownloadsWfdownloads::getInstance();
$lid = wfdownloads_CleanVars($_REQUEST, 'lid', 0, 'int');
- $numrows = $category_handler->getCount();
+ $numrows = $wfdownloads->getHandler('category')->getCount();
if ($numrows) {
// allowed mimetypes list
echo "<fieldset><legend style='font-weight: bold; color: #900;'>" . _AM_WFD_FILE_ALLOWEDAMIME . "</legend>\n";
echo "<div style='padding: 8px;'>\n";
- $mime_handler = xoops_getmodulehandler('mimetype');
$criteria = new Criteria("mime_admin", true);
- $mimetypes = $mime_handler->getList($criteria);
+ $mimetypes = $wfdownloads->getHandler('mimetype')->getList($criteria);
$allowmimetypes = implode(' | ', $mimetypes);
echo $allowmimetypes;
echo "</div>\n";
echo "</fieldset><br />\n";
if ($lid) {
- if (!$download = $download_handler->get($lid)) {
+ if (!$download = $wfdownloads->getHandler('download')->get($lid)) {
redirect_header($currentFile, 4, _AM_WFD_DOWN_ERROR_FILENOTFOUND);
exit();
}
$cid = $download->getVar('cid');
- if(!$category = $category_handler->get($cid)) {
+ if(!$category = $wfdownloads->getHandler('category')->get($cid)) {
redirect_header($currentFile, 4, _AM_WFD_DOWN_ERROR_CATEGORYNOTFOUND);
exit();
}
$title = preg_replace("/{category}/", $category->getVar('title'), _AM_WFD_FFS_EDITDOWNLOADTITLE);
} else {
- $download = $download_handler->create();
+ $download = $wfdownloads->getHandler('download')->create();
$cid = wfdownloads_CleanVars($_POST, 'cid', 0, 'int');
- $category = $category_handler->get($cid);
+ $category = $wfdownloads->getHandler('category')->get($cid);
$download->setVar('cid', $cid);
$title = preg_replace("/{category}/", $category->getVar('title'), _AM_WFD_FFS_DOWNLOADTITLE);
}
@@ -361,7 +357,6 @@
$customArray['parentLinks'] = "";
$owner = getEntryOwner($entry);
- $member_handler =& xoops_gethandler('member');
$owner_groups =& $member_handler->getGroupsByUser($owner, false);
$customArray['owner_groups'] = $owner_groups;
@@ -381,19 +376,18 @@
// Vote data list/manager
if ($lid) {
- $rating_handler = xoops_getmodulehandler('rating');
- $totalvotes = $rating_handler->getCount();
+ $totalvotes = $wfdownloads->getHandler('rating')->getCount();
$reg_criteria = new CriteriaCompo(new Criteria('lid', $lid));
$reg_criteria->add(new Criteria("ratinguser", 0, ">"));
- $votesreg = $rating_handler->getCount($reg_criteria);
+ $votesreg = $wfdownloads->getHandler('rating')->getCount($reg_criteria);
$reg_criteria->setSort("ratingtimestamp");
$reg_criteria->setOrder("DESC");
- $regvotes = $rating_handler->getObjects($reg_criteria);
+ $regvotes = $wfdownloads->getHandler('rating')->getObjects($reg_criteria);
$anon_criteria = new CriteriaCompo(new Criteria('lid', $lid));
$anon_criteria->add(new Criteria("ratinguser", 0, "="));
- $votesanon = $rating_handler->getCount($anon_criteria);
+ $votesanon = $wfdownloads->getHandler('rating')->getCount($anon_criteria);
$anon_criteria->setSort("ratingtimestamp");
$anon_criteria->setOrder("DESC");
@@ -429,7 +423,7 @@
$criteria = new Criteria("ratinguser", "(".implode(',', $uids).")", "IN");
$criteria->setGroupby("ratinguser");
- $userratings = $rating_handler->getUserAverage($criteria);
+ $userratings = $wfdownloads->getHandler('rating')->getUserAverage($criteria);
foreach (array_keys($regvotes) as $i) {
$formatted_date = formatTimestamp($regvotes[$i]->getVar('ratingtimestamp'), _DATESTRING);
@@ -468,8 +462,8 @@
echo "<tr><td colspan='7' class='even'><b>" . _AM_WFD_VOTE_NOUNREGVOTES . "</b></td></tr>";
} else {
$criteria = new Criteria("ratinguser", 0);
- $userratings = $rating_handler->getUserAverage($criteria);
- $anonvotes = $rating_handler->getObjects($anon_criteria);
+ $userratings = $wfdownloads->getHandler('rating')->getUserAverage($criteria);
+ $anonvotes = $wfdownloads->getHandler('rating')->getObjects($anon_criteria);
foreach (array_keys($anonvotes) as $i) {
$formatted_date = formatTimestamp($anonvotes[$i]->getVar('ratingtimestamp'), _DATESTRING);
@@ -500,19 +494,19 @@
function saveDownload()
{
- global $xoopsUser, $xoopsModuleConfig, $currentFile, $_FILES;
+ global $xoopsUser, $currentFile;
+ $wfdownloads = WfdownloadsWfdownloads::getInstance();
$lid = (!empty($_POST['lid'])) ? intval($_POST['lid']) : 0;
$cid = (!empty($_POST['cid'])) ? intval($_POST['cid']) : 0;
$status = (!empty($_POST['status'])) ? intval($_POST['status']) : 2;
- $download_handler = xoops_getmodulehandler('download');
if ($lid > 0) {
$thisIsANewRecord = false; /* Added by Lankford on 2007/3/21 */
- $download = $download_handler->get($lid);
+ $download = $wfdownloads->getHandler('download')->get($lid);
} else {
$thisIsANewRecord = true; /* Added by Lankford on 2007/3/21 */
- $download = $download_handler->create();
+ $download = $wfdownloads->getHandler('download')->create();
}
/* Define URL */
if (empty($_FILES['userfile']['name'])) {
@@ -530,7 +524,7 @@
$download->setVar('filename', $filename);
$download->setVar('filetype', $filetype);
} else {
- $down = wfd_uploading($_FILES, $xoopsModuleConfig['uploaddir'], "", $currentFile, 0, 0);
+ $down = wfd_uploading($_FILES, $wfdownloads->getConfig('uploaddir'), "", $currentFile, 0, 0);
$url = ($_POST["url"] != "http://") ? $_POST["url"] : '';
$size = $down['size'];
$title = $_FILES['userfile']['name'];
@@ -563,17 +557,15 @@
// If both conditions are true, then trigger all three notifications related to modified records.
if (!$thisIsANewRecord and ($download->getVar('version') != $version)) {
// Trigger the three events related to modified files (one for the file, category, and global event categories respectively)
- $notification_handler = &xoops_gethandler('notification');
$tags = array();
$tags['FILE_NAME'] = $title;
$tags['FILE_URL'] = WFDOWNLOADS_URL . '/singlefile.php?cid=' . $cid . '&lid=' . $lid;
- $category_handler = xoops_getmodulehandler('category');
- $category = $category_handler->get($cid);
+ $category = $wfdownloads->getHandler('category')->get($cid);
$tags['FILE_VERSION'] = $version;
$tags['CATEGORY_NAME'] = $category->getVar('title');
$tags['CATEGORY_URL'] = WFDOWNLOADS_URL . '/viewcat.php?cid=' . $cid;
- if ($xoopsModuleConfig['autoapprove'] == 2 || $xoopsModuleConfig['autoapprove'] == 4) {
+ if ($wfdownloads->getConfig('autoapprove') == 2 || $wfdownloads->getConfig('autoapprove') == 4) {
// Then this change will be automatically approved, so the notification needs to go out.
$notification_handler->triggerEvent('global', 0, 'filemodified', $tags);
$notification_handler->triggerEvent('category', $cid, 'filemodified', $tags);
@@ -597,7 +589,7 @@
$download->setVar('submitter', trim($_POST["submitter"]));
$download->setVar('publisher', trim($_POST["publisher"]));
$download->setVar('price', trim($_POST["price"]));
- if (!$xoopsModuleConfig['enable_mirrors']) {
+ if (!$wfdownloads->getConfig('enable_mirrors')) {
$download->setVar('mirror', formatURL(trim($_POST["mirror"])));
}
$download->setVar('license', trim($_POST["license"]));
@@ -666,8 +658,7 @@
}
// added - start - March 4 2006 - jpc
- $category_handler = xoops_getmodulehandler('category');
- $category = $category_handler->get($cid);
+ $category = $wfdownloads->getHandler('category')->get($cid);
$fid = $category->getVar('formulize_fid');
if($fid) {
global $xoopsUser;
@@ -690,11 +681,10 @@
$entries[$fid][0] = "";
$owner = "";
}
- $member_handler =& xoops_gethandler('member');
$owner_groups =& $member_handler->getGroupsByUser($owner, FALSE);
- $uid = !empty($xoopsUser) ? $xoopsUser->getVar('uid') : 0;
- $groups = $xoopsUser ? $xoopsUser->getGroups() : array(0=>XOOPS_GROUP_ANONYMOUS);
- $entries = handleSubmission($formulize_mgr, $entries, $uid, $owner, $fid, $owner_groups, $groups, "new"); // "new" causes xoops token check to be skipped, since WF-downloads should be doing that
+ $uid = !empty($xoopsUser) ? $xoopsUser->getVar('uid') : 0;
+ $groups = $xoopsUser ? $xoopsUser->getGroups() : array(0=>XOOPS_GROUP_ANONYMOUS);
+ $entries = handleSubmission($formulize_mgr, $entries, $uid, $owner, $fid, $owner_groups, $groups, "new"); // "new" causes xoops token check to be skipped, since WF-downloads should be doing that
//if (!$lid)
if(!$owner) {
@@ -703,7 +693,7 @@
}
}
// added - end - March 4 2006 - jpc
- $download_handler->insert($download);
+ $wfdownloads->getHandler('download')->insert($download);
$newid = intval($download->getVar('lid'));
/**
* Send notifications
@@ -712,10 +702,6 @@
$tags = array();
$tags['FILE_NAME'] = $title;
$tags['FILE_URL'] = WFDOWNLOADS_URL . "/singlefile.php?cid={$cid}&lid={$newid}";
- // changed - start - March 4 2006 - jpc
- //$category_handler = xoops_getmodulehandler('category');
- //$category = $category_handler->get($cid);
- // changed - end - March 4 2006 - jpc
$tags['CATEGORY_NAME'] = $category->getVar('title');
$tags['CATEGORY_URL'] = WFDOWNLOADS_URL . "/viewcat.php?cid={$cid}";
$notification_handler = & xoops_gethandler('notification');
@@ -726,11 +712,9 @@
$tags = array();
$tags['FILE_NAME'] = $title;
$tags['FILE_URL'] = WFDOWNLOADS_URL . "/singlefile.php?cid={$cid}&lid={$lid}";
- $category_handler = xoops_getmodulehandler('category');
- $category = $category_handler->get($cid);
+ $category = $wfdownloads->getHandler('category')->get($cid);
$tags['CATEGORY_NAME'] = $category->getVar('title');
$tags['CATEGORY_URL'] = WFDOWNLOADS_URL . '/viewcat.php?cid=' . $cid;
- $notification_handler = & xoops_gethandler('notification');
$notification_handler -> triggerEvent('global', 0, 'new_file', $tags);
$notification_handler -> triggerEvent('category', $cid, 'new_file', $tags);
$notification_handler -> triggerEvent('file', $lid, 'approve', $tags);
Modified: XoopsModules/wfdownloads/trunk/wfdownloads/admin/images.php
===================================================================
--- XoopsModules/wfdownloads/trunk/wfdownloads/admin/images.php 2013-08-09 20:19:06 UTC (rev 11893)
+++ XoopsModules/wfdownloads/trunk/wfdownloads/admin/images.php 2013-08-10 14:28:46 UTC (rev 11894)
@@ -31,9 +31,9 @@
redirect_header($currentFile, 2, _AM_WFD_DOWN_IMAGEEXIST);
}
$allowedMimetypes = array('image/gif', 'image/jpeg', 'image/pjpeg', 'image/x-png', 'image/png');
- $maxFileSize = $xoopsModuleConfig['maxfilesize'];
- $maxImgWidth = $xoopsModuleConfig['maximgwidth'];
- $maxImgHeight = $xoopsModuleConfig['maximgheight'];
+ $maxFileSize = $wfdownloads->getConfig('maxfilesize');
+ $maxImgWidth = $wfdownloads->getConfig('maximgwidth');
+ $maxImgHeight = $wfdownloads->getConfig('maximgheight');
$uploadDir = XOOPS_ROOT_PATH . "/" . $_POST['uploadpath'];
$screenShot = strtolower($_FILES['uploadfile']['name']);
wfd_uploading($screenShot, XOOPS_ROOT_PATH . "/" . $_POST['uploadpath'], $allowedMimetypes, "images.php", 1, 0, true);
@@ -83,7 +83,7 @@
$indexAdmin = new ModuleAdmin();
echo $indexAdmin->addNavigation($currentFile);
- $dirArray = array(1 => $xoopsModuleConfig['catimage'], 2 => $xoopsModuleConfig['screenshots'], 3 => $xoopsModuleConfig['mainimagedir']);
+ $dirArray = array(1 => $wfdownloads->getConfig('catimage'), 2 => $wfdownloads->getConfig('screenshots'), 3 => $wfdownloads->getConfig('mainimagedir'));
$nameArray = array(1 => _AM_WFD_DOWN_CATIMAGE , 2 => _AM_WFD_DOWN_SCREENSHOTS, 3 => _AM_WFD_DOWN_MAINIMAGEDIR);
$listArray = array(1 => _AM_WFD_DOWN_FCATIMAGE , 2 => _AM_WFD_DOWN_FSCREENSHOTS, 3 => _AM_WFD_DOWN_FMAINIMAGEDIR);
Modified: XoopsModules/wfdownloads/trunk/wfdownloads/admin/index.php
===================================================================
--- XoopsModules/wfdownloads/trunk/wfdownloads/admin/index.php 2013-08-09 20:19:06 UTC (rev 11893)
+++ XoopsModules/wfdownloads/trunk/wfdownloads/admin/index.php 2013-08-10 14:28:46 UTC (rev 11894)
@@ -28,20 +28,13 @@
$indexAdmin = new ModuleAdmin();
//--------------------------
-$report_handler = xoops_getmodulehandler('report');
-$review_handler = xoops_getmodulehandler('review');
-$mirror_handler = xoops_getmodulehandler('mirror');
-$modification_handler = xoops_getmodulehandler('modification');
-$download_handler = xoops_getmodulehandler('download');
-
-
$totalcats = wfd_totalcategory();
-$totalbrokendownloads = $report_handler->getCount();
-$totalmodrequests = $modification_handler->getCount();
-$newreviews = $review_handler->getCount();
-$newmirrors = $mirror_handler->getCount();
-$totalnewdownloads = $download_handler->getCount(new Criteria("published", 0));
-$totaldownloads = $download_handler->getCount(new Criteria("published", 0, ">"));
+$totalbrokendownloads = $wfdownloads->getHandler('report')->getCount();
+$totalmodrequests = $wfdownloads->getHandler('modification')->getCount();
+$newreviews = $wfdownloads->getHandler('review')->getCount();
+$newmirrors = $wfdownloads->getHandler('mirror')->getCount();
+$totalnewdownloads = $wfdownloads->getHandler('download')->getCount(new Criteria("published", 0));
+$totaldownloads = $wfdownloads->getHandler('download')->getCount(new Criteria("published", 0, ">"));
$indexAdmin->addInfoBox(_AM_WFD_MINDEX_DOWNSUMMARY);
// Categories
@@ -127,18 +120,18 @@
$indexAdmin->addConfigBoxLine('');
$redirectFile = $_SERVER['PHP_SELF'];
-$path = $xoopsModuleConfig['uploaddir'] . '/';
+$path = $wfdownloads->getConfig('uploaddir') . '/';
$indexAdmin->addConfigBoxLine(DirectoryChecker::getDirectoryStatus($path, 0777, $redirectFile));
$indexAdmin->addConfigBoxLine('');
-$path = XOOPS_ROOT_PATH . '/' . $xoopsModuleConfig['mainimagedir'] . '/';
+$path = XOOPS_ROOT_PATH . '/' . $wfdownloads->getConfig('mainimagedir') . '/';
$indexAdmin->addConfigBoxLine(DirectoryChecker::getDirectoryStatus($path, 0777, $redirectFile));
$indexAdmin->addConfigBoxLine(FileChecker::getFileStatus($path . 'blank.gif', dirname(dirname(__FILE__)) . '/images/blank.gif', $redirectFile));
$indexAdmin->addConfigBoxLine('');
-$path = XOOPS_ROOT_PATH . '/' . $xoopsModuleConfig['screenshots'] . '/';
+$path = XOOPS_ROOT_PATH . '/' . $wfdownloads->getConfig('screenshots') . '/';
$indexAdmin->addConfigBoxLine(DirectoryChecker::getDirectoryStatus($path, 0777, $redirectFile));
$indexAdmin->addConfigBoxLine(FileChecker::getFileStatus($path . 'blank.gif', dirname(dirname(__FILE__)) . '/images/blank.gif', $redirectFile));
$indexAdmin->addConfigBoxLine(DirectoryChecker::getDirectoryStatus($path . 'thumbs' . '/', 0777, $redirectFile));
@@ -146,7 +139,7 @@
$indexAdmin->addConfigBoxLine('');
-$path = XOOPS_ROOT_PATH . '/' . $xoopsModuleConfig['catimage'] . '/';
+$path = XOOPS_ROOT_PATH . '/' . $wfdownloads->getConfig('catimage') . '/';
$indexAdmin->addConfigBoxLine(DirectoryChecker::getDirectoryStatus($path, 0777, $redirectFile));
$indexAdmin->addConfigBoxLine(FileChecker::getFileStatus($path . 'blank.gif', dirname(dirname(__FILE__)) . '/images/blank.gif', $redirectFile));
$indexAdmin->addConfigBoxLine(DirectoryChecker::getDirectoryStatus($path . 'thumbs' . '/', 0777, $redirectFile));
Modified: XoopsModules/wfdownloads/trunk/wfdownloads/admin/indexpage.php
===================================================================
--- XoopsModules/wfdownloads/trunk/wfdownloads/admin/indexpage.php 2013-08-09 20:19:06 UTC (rev 11893)
+++ XoopsModules/wfdownloads/trunk/wfdownloads/admin/indexpage.php 2013-08-10 14:28:46 UTC (rev 11894)
@@ -22,12 +22,8 @@
$op = isset($_REQUEST['op']) ?$_REQUEST['op'] : "default";
-switch ($op)
-{
+switch ($op) {
case "save":
-
- global $xoopsDB;
-
$indexheading = $myts->addslashes($_POST['indexheading']);
$indexheader = $myts->addslashes($_POST['indexheader']);
$indexfooter = $myts->addslashes($_POST['indexfooter']);
@@ -47,12 +43,9 @@
break;
default:
-
include_once WFDOWNLOADS_ROOT_PATH . '/class/wfd_lists.php';
include XOOPS_ROOT_PATH . '/class/xoopsformloader.php';
- global $xoopsModuleConfig, $xoopsDB;
-
$result = $xoopsDB->query("SELECT indeximage, indexheading, indexheader, indexfooter, nohtml, nosmiley, noxcodes, noimages, nobreak, indexheaderalign, indexfooteralign FROM " . $xoopsDB->prefix('wfdownloads_indexpage') . " ");
list($indeximage, $indexheading, $indexheader, $indexfooter, $nohtml, $nosmiley, $noxcodes, $noimages, $nobreak, $indexheaderalign, $indexfooteralign) = $xoopsDB->fetchrow($result);
@@ -66,14 +59,14 @@
$sform = new XoopsThemeForm(_AM_WFD_IPAGE_MODIFY, "op", xoops_getenv('PHP_SELF'));
$sform->addElement(new XoopsFormText(_AM_WFD_IPAGE_CTITLE, 'indexheading', 60, 60, $indexheading), false);
- $graph_array = &WfsLists::getListTypeAsArray(XOOPS_ROOT_PATH . "/" . $xoopsModuleConfig['mainimagedir'], $type = "images");
+ $graph_array = &WfsLists::getListTypeAsArray(XOOPS_ROOT_PATH . "/" . $wfdownloads->getConfig('mainimagedir'), $type = "images");
$indeximage_select = new XoopsFormSelect('', 'indeximage', $indeximage);
$indeximage_select->addOptionArray($graph_array);
- $indeximage_select->setExtra("onchange='showImgSelected(\"image\", \"indeximage\", \"" . $xoopsModuleConfig['mainimagedir'] . "\", \"\", \"" . XOOPS_URL . "\")'");
+ $indeximage_select->setExtra("onchange='showImgSelected(\"image\", \"indeximage\", \"" . $wfdownloads->getConfig('mainimagedir') . "\", \"\", \"" . XOOPS_URL . "\")'");
$indeximage_tray = new XoopsFormElementTray(_AM_WFD_IPAGE_CIMAGE, ' ');
$indeximage_tray->addElement($indeximage_select);
if (!empty($indeximage)) {
- $indeximage_tray->addElement(new XoopsFormLabel('', "<br /><br /><img src='" . XOOPS_URL . "/".$xoopsModuleConfig['mainimagedir']."/" . $indeximage . "' name='image' id='image' alt='' title='image' />"));
+ $indeximage_tray->addElement(new XoopsFormLabel('', "<br /><br /><img src='" . XOOPS_URL . "/".$wfdownloads->getConfig('mainimagedir')."/" . $indeximage . "' name='image' id='image' alt='' title='image' />"));
} else {
$indeximage_tray->addElement(new XoopsFormLabel('', "<br /><br /><img src='" . XOOPS_URL . "/uploads/blank.gif' name='image' id='image' alt='' title='image' />"));
}
@@ -119,5 +112,4 @@
$sform->display();
break;
}
-//xoops_cp_footer();
include_once "admin_footer.php";
Modified: XoopsModules/wfdownloads/trunk/wfdownloads/admin/ip_logs.php
===================================================================
--- XoopsModules/wfdownloads/trunk/wfdownloads/admin/ip_logs.php 2013-08-09 20:19:06 UTC (rev 11893)
+++ XoopsModules/wfdownloads/trunk/wfdownloads/admin/ip_logs.php 2013-08-10 14:28:46 UTC (rev 11894)
@@ -30,13 +30,13 @@
$indexAdmin = new ModuleAdmin();
echo $indexAdmin->addNavigation($currentFile);
-$download = $download_handler->get($lid);
+$download = $wfdownloads->getHandler('download')->get($lid);
$criteria = new CriteriaCompo();
$criteria->add(new Criteria('lid', $lid));
$criteria->setSort('date');
$criteria->setOrder('DESC');
-$ip_logsObj = $ip_log_handler->getObjects($criteria);
+$ip_logsObj = $wfdownloads->getHandler('ip_log')->getObjects($criteria);
unset($criteria);
$uidArray = array();
foreach($ip_logsObj as $ip_logObj) {
Modified: XoopsModules/wfdownloads/trunk/wfdownloads/admin/mimetypes.php
===================================================================
--- XoopsModules/wfdownloads/trunk/wfdownloads/admin/mimetypes.php 2013-08-09 20:19:06 UTC (rev 11893)
+++ XoopsModules/wfdownloads/trunk/wfdownloads/admin/mimetypes.php 2013-08-10 14:28:46 UTC (rev 11894)
@@ -52,9 +52,9 @@
echo "</fieldset>\n";
if (isset($_REQUEST['mime_id'])) {
- $mimetype = $mime_handler->get($_REQUEST['mime_id']);
+ $mimetype = $wfdownloads->getHandler('mimetype')->get($_REQUEST['mime_id']);
} else {
- $mimetype = $mime_handler->create();
+ $mimetype = $wfdownloads->getHandler('mimetype')->create();
}
$form = $mimetype->getForm();
@@ -78,7 +78,7 @@
case 'mimetype.save':
$mime_id = wfdownloads_CleanVars($_POST, 'mime_id', 0, 'int');
- if (!$mimetype = $mime_handler->get($mime_id)) {
+ if (!$mimetype = $wfdownloads->getHandler('mimetype')->get($mime_id)) {
redirect_header($currentFile, 4, _AM_WFD_ERROR_MIMETYPENOTFOUND);
exit();
}
@@ -88,7 +88,7 @@
$mimetype->setVar('mime_types', $_POST['mime_type']);
$mimetype->setVar('mime_admin', (int)$_POST['mime_admin']);
$mimetype->setVar('mime_user', (int)$_POST['mime_user']);
- if (!$mime_handler->insert($mimetype)) {
+ if (!$wfdownloads->getHandler('mimetype')->insert($mimetype)) {
$error = "Could not update mimetype information";
trigger_error($error, E_USER_ERROR);
}
@@ -98,7 +98,7 @@
case 'mimetype.update';
$mime_id = wfdownloads_CleanVars($_REQUEST, 'mime_id', 0, 'int');
- if (!$mimetype = $mime_handler->get($mime_id)) {
+ if (!$mimetype = $wfdownloads->getHandler('mimetype')->get($mime_id)) {
redirect_header($currentFile, 4, _AM_WFD_ERROR_MIMETYPENOTFOUND);
exit();
}
@@ -117,7 +117,7 @@
$mimetype->setVar('mime_user', true);
}
}
- if (!$mime_handler->insert($mimetype, true)) {
+ if (!$wfdownloads->getHandler('mimetype')->insert($mimetype, true)) {
trigger_error($error, E_USER_ERROR);
}
redirect_header("{$currentFile}?start=" . intval($_GET['start']) . "", 0, _AM_WFD_MIME_MODIFIED);
@@ -136,7 +136,7 @@
$criteria = new CriteriaCompo();
$criteria->setStart($start);
$criteria->setLimit(20);
- if (!$mime_handler->updateAll($field, $type_all, $criteria, true)) {
+ if (!$wfdownloads->getHandler('mimetype')->updateAll($field, $type_all, $criteria, true)) {
$error = "Could not update mimetype information";
trigger_error($error, E_USER_ERROR);
}
@@ -146,7 +146,7 @@
case "mimetype.delete":
$mime_id = wfdownloads_CleanVars($_REQUEST, 'mime_id', 0, 'int');
$ok = wfdownloads_CleanVars($_POST, 'ok', false, 'boolean');
- if (!$mimetype = $mime_handler->get($mime_id)) {
+ if (!$mimetype = $wfdownloads->getHandler('mimetype')->get($mime_id)) {
redirect_header($currentFile, 4, _AM_WFD_ERROR_MIMETYPENOTFOUND);
exit();
}
@@ -154,7 +154,7 @@
if (!$GLOBALS['xoopsSecurity']->check()) {
redirect_header($currentFile, 3, implode(',', $GLOBALS['xoopsSecurity']->getErrors()));
}
- if ($mime_handler->delete($mimetype)) {
+ if ($wfdownloads->getHandler('mimetype')->delete($mimetype)) {
redirect_header($currentFile, 1, sprintf(_AM_WFD_MIME_MIMEDELETED, $mimetype->getVar('mime_name')));
exit();
} else {
@@ -176,8 +176,8 @@
$criteria->setSort("mime_name");
$criteria->setStart($start);
$criteria->setLimit(20);
- $mimetypes = $mime_handler->getObjects($criteria);
- $mime_num = $mime_handler->getCount();
+ $mimetypes = $wfdownloads->getHandler('mimetype')->getObjects($criteria);
+ $mime_num = $wfdownloads->getHandler('mimetype')->getCount();
wfdownloads_xoops_cp_header();
$indexAdmin = new ModuleAdmin();
Modified: XoopsModules/wfdownloads/trunk/wfdownloads/admin/mirrors.php
===================================================================
--- XoopsModules/wfdownloads/trunk/wfdownloads/admin/mirrors.php 2013-08-09 20:19:06 UTC (rev 11893)
+++ XoopsModules/wfdownloads/trunk/wfdownloads/admin/mirrors.php 2013-08-10 14:28:46 UTC (rev 11894)
@@ -28,7 +28,7 @@
case "mirror.delete" :
$mirror_id = wfdownloads_CleanVars($_REQUEST, 'mirror_id', 0, 'int');
$ok = wfdownloads_CleanVars($_POST, 'ok', false, 'boolean');
- if (!$mirror = $mirror_handler->get($mirror_id)) {
+ if (!$mirror = $wfdownloads->getHandler('mirror')->get($mirror_id)) {
redirect_header($currentFile, 4, _AM_WFD_ERROR_MIRRORNOTFOUND);
exit();
}
@@ -36,7 +36,7 @@
if (!$GLOBALS['xoopsSecurity']->check()) {
redirect_header($currentFile, 3, implode(',', $GLOBALS['xoopsSecurity']->getErrors()));
}
- if ($mirror_handler->delete($mirror)) {
+ if ($wfdownloads->getHandler('mirror')->delete($mirror)) {
redirect_header($currentFile, 1, sprintf(_AM_WFD_FILE_FILEWASDELETED, $mirror->getVar('title')));
exit();
} else {
@@ -53,13 +53,13 @@
case "mirror.approve" :
$mirror_id = wfdownloads_CleanVars($_REQUEST, 'mirror_id', 0, 'int');
$ok = wfdownloads_CleanVars($_POST, 'ok', false, 'boolean');
- if (!$mirror = $mirror_handler->get($mirror_id)) {
+ if (!$mirror = $wfdownloads->getHandler('mirror')->get($mirror_id)) {
redirect_header($currentFile, 4, _AM_WFD_ERROR_MIRRORNOTFOUND);
exit();
}
if ($ok == true) {
$mirror->setVar('submit', true);
- $mirror_handler->insert($mirror);
+ $wfdownloads->getHandler('mirror')->insert($mirror);
redirect_header($currentFile, 1, sprintf( _AM_WFD_MIRROR_MIRROR_UPDATED, $mirror->getVar('title')));
exit();
} else {
@@ -71,7 +71,7 @@
case "mirror.edit" :
$mirror_id = wfdownloads_CleanVars($_REQUEST, 'mirror_id', 0, 'int');
- if (!$mirror = $mirror_handler->get($mirror_id)) {
+ if (!$mirror = $wfdownloads->getHandler('mirror')->get($mirror_id)) {
redirect_header($currentFile, 4, _AM_WFD_ERROR_MIRRORNOTFOUND);
exit();
}
@@ -83,7 +83,7 @@
case "mirror.save" :
$mirror_id = wfdownloads_CleanVars($_REQUEST, 'mirror_id', 0, 'int');
- if (!$mirror = $mirror_handler->get($mirror_id)) {
+ if (!$mirror = $wfdownloads->getHandler('mirror')->get($mirror_id)) {
redirect_header($currentFile, 4, _AM_WFD_ERROR_MIRRORNOTFOUND);
exit();
}
@@ -93,7 +93,7 @@
$mirror->setVar('continent', trim($_POST['continent']));
$mirror->setVar('downurl', formatURL(trim($_POST['downurl'])));
$mirror->setVar('submit', (int)($_POST['approve']));
- $mirror_handler->insert($mirror);
+ $wfdownloads->getHandler('mirror')->insert($mirror);
redirect_header($currentFile, 1, _AM_WFD_MIRROR_MIRROR_UPDATED);
exit();
break;
@@ -108,20 +108,20 @@
$start_published = wfdownloads_CleanVars($_GET, 'start_published', 0, 'int');
$criteria_waiting = new Criteria("submit", 0); // false
- $waiting_count = $mirror_handler->getCount($criteria_waiting);
+ $waiting_count = $wfdownloads->getHandler('mirror')->getCount($criteria_waiting);
$criteria_waiting->setSort("date");
$criteria_waiting->setOrder("DESC");
- $criteria_waiting->setLimit($xoopsModuleConfig['admin_perpage']);
+ $criteria_waiting->setLimit($wfdownloads->getConfig('admin_perpage'));
$criteria_waiting->setStart($start_waiting);
- $mirrors_waiting = $mirror_handler->getObjects($criteria_waiting);
+ $mirrors_waiting = $wfdownloads->getHandler('mirror')->getObjects($criteria_waiting);
$criteria_published = new Criteria("submit", 1); // true
- $published_count = $mirror_handler->getCount($criteria_published);
+ $published_count = $wfdownloads->getHandler('mirror')->getCount($criteria_published);
$criteria_published->setSort("date");
$criteria_published->setOrder("DESC");
- $criteria_published->setLimit($xoopsModuleConfig['admin_perpage']);
+ $criteria_published->setLimit($wfdownloads->getConfig('admin_perpage'));
$criteria_published->setStart($start_published);
- $mirrors_published = $mirror_handler->getObjects($criteria_published);
+ $mirrors_published = $wfdownloads->getHandler('mirror')->getObjects($criteria_published);
$GLOBALS['xoopsTpl']->assign('mirrors_waiting_count', $waiting_count);
$GLOBALS['xoopsTpl']->assign('mirrors_published_count', $published_count);
@@ -131,7 +131,7 @@
$lids_waiting[] = $mirror_waiting->getVar('lid');
$uids_waiting[] = $mirror_waiting->getVar('uid');
}
- $downloads = $download_handler->getObjects(new Criteria("lid", "(" . implode(',', array_unique($lids_waiting)) . ")", "IN"), true, false);
+ $downloads = $wfdownloads->getHandler('download')->getObjects(new Criteria("lid", "(" . implode(',', array_unique($lids_waiting)) . ")", "IN"), true, false);
$users = $member_handler->getUserList(new Criteria("uid", "(" . implode(',', $uids_waiting) . ")"));
foreach ($mirrors_waiting as $mirror_waiting) {
$mirror_waiting_array = $mirror_waiting->toArray();
@@ -142,7 +142,7 @@
}
//Include page navigation
include_once XOOPS_ROOT_PATH . '/class/pagenav.php';
- $pagenav_waiting = new XoopsPageNav($waiting_count, $xoopsModuleConfig['admin_perpage'] , $start_waiting, 'start_waiting');
+ $pagenav_waiting = new XoopsPageNav($waiting_count, $wfdownloads->getConfig('admin_perpage') , $start_waiting, 'start_waiting');
$GLOBALS['xoopsTpl']->assign('mirrors_waiting_pagenav', $pagenav_waiting -> renderNav());
}
@@ -151,7 +151,7 @@
$lids_published[] = $mirror_published->getVar('lid');
$uids_published[] = $mirror_published->getVar('uid');
}
- $downloads = $download_handler->getObjects(new Criteria("lid", "(" . implode(',', array_unique($lids_published)) . ")", "IN"), true, false);
+ $downloads = $wfdownloads->getHandler('download')->getObjects(new Criteria("lid", "(" . implode(',', array_unique($lids_published)) . ")", "IN"), true, false);
$users = $member_handler->getUserList(new Criteria("uid", "(" . implode(',', $uids_published) . ")"));
foreach ($mirrors_published as $mirror_published) {
$mirror_published_array = $mirror_published->toArray();
@@ -162,7 +162,7 @@
}
//Include page navigation
include_once XOOPS_ROOT_PATH . '/class/pagenav.php';
- $pagenav_published = new XoopsPageNav($published_count, $xoopsModuleConfig['admin_perpage'] , $start_published, 'start_published');
+ $pagenav_published = new XoopsPageNav($published_count, $wfdownloads->getConfig('admin_perpage') , $start_published, 'start_published');
$GLOBALS['xoopsTpl']->assign('mirrors_published_pagenav', $pagenav_published -> renderNav());
}
Modified: XoopsModules/wfdownloads/trunk/wfdownloads/admin/permissions.php
===================================================================
--- XoopsModules/wfdownloads/trunk/wfdownloads/admin/permissions.php 2013-08-09 20:19:06 UTC (rev 11893)
+++ XoopsModules/wfdownloads/trunk/wfdownloads/admin/permissions.php 2013-08-10 14:28:46 UTC (rev 11894)
@@ -21,11 +21,11 @@
$currentFile = basename(__FILE__);
include 'admin_header.php';
-if ($category_handler->getCount() == 0) {
+if ($wfdownloads->getHandler('category')->getCount() == 0) {
redirect_header('categories.php', 1, _AM_WFD_CCATEGORY_NOEXISTS);
exit();
}
-$categories = $category_handler->getObjects();
+$categories = $wfdownloads->getHandler('category')->getObjects();
include_once XOOPS_ROOT_PATH . '/class/xoopsform/grouppermform.php';
$down_cat_form = new XoopsGroupPermForm(_AM_WFD_FCATEGORY_GROUPPROMPT, $xoopsModule->getVar('mid'), 'WFDownCatPerm', _AM_WFD_PERM_CSELECTPERMISSIONS, "admin/{$currentFile}", true);
Modified: XoopsModules/wfdownloads/trunk/wfdownloads/admin/ratings.php
===================================================================
--- XoopsModules/wfdownloads/trunk/wfdownloads/admin/ratings.php 2013-08-09 20:19:06 UTC (rev 11893)
+++ XoopsModules/wfdownloads/trunk/wfdownloads/admin/ratings.php 2013-08-10 14:28:46 UTC (rev 11894)
@@ -20,7 +20,6 @@
*/
$currentFile = basename(__FILE__);
include 'admin_header.php';
-$rating_handler = xoops_getmodulehandler('rating');
$op = wfdownloads_CleanVars($_REQUEST, 'op', 'votes.list', 'string');
@@ -28,7 +27,7 @@
case 'vote.delete' :
$rid = wfdownloads_CleanVars($_GET, 'rid', null, 'int');
$lid = wfdownloads_CleanVars($_GET, 'lid', null, 'int');
- $rating_handler->deleteAll(new Criteria("ratingid", $rid), true);
+ $wfdownloads->getHandler('rating')->deleteAll(new Criteria("ratingid", $rid), true);
wfd_updaterating($lid);
redirect_header($currentFile, 1, _AM_WFD_VOTEDELETED);
break;
@@ -40,15 +39,15 @@
$uservotes = '0';
$criteria = new CriteriaCompo();
- $votes = $rating_handler->getCount($criteria);
- $ratings_count = $rating_handler->getCount($criteria);
+ $votes = $wfdownloads->getHandler('rating')->getCount($criteria);
+ $ratings_count = $wfdownloads->getHandler('rating')->getCount($criteria);
$criteria->setSort('ratingtimestamp');
$criteria->setOrder("DESC");
$criteria->setStart($start);;
$criteria->setLimit(20);
- $ratings = $rating_handler->getObjects($criteria);
+ $ratings = $wfdownloads->getHandler('rating')->getObjects($criteria);
- $useravgrating = $rating_handler->getUserAverage();
+ $useravgrating = $wfdownloads->getHandler('rating')->getUserAverage();
$useravgrating = number_format($useravgrating["avg"], 2);
wfdownloads_xoops_cp_header();
@@ -62,8 +61,7 @@
foreach ($ratings as $rating) {
$lids[] = $rating->getVar('lid');
}
- $download_handler = xoops_getmodulehandler('download');
- $downloads = $download_handler->getObjects(new Criteria("lid", "(" . implode(',', array_unique($lids)) . ")", "IN"), true);
+ $downloads = $wfdownloads->getHandler('download')->getObjects(new Criteria("lid", "(" . implode(',', array_unique($lids)) . ")", "IN"), true);
foreach ($ratings as $rating) {
$rating_array = $rating->toArray();
$rating_array['formatted_date'] = formatTimestamp($rating->getVar('ratingtimestamp'), _DATESTRING);
@@ -74,7 +72,7 @@
}
//Include page navigation
include_once XOOPS_ROOT_PATH . '/class/pagenav.php';
- $ratings_pagenav = new XoopsPageNav($ratings_count, $xoopsModuleConfig['admin_perpage'], $start, 'start');
+ $ratings_pagenav = new XoopsPageNav($ratings_count, $wfdownloads->getConfig('admin_perpage'), $start, 'start');
$GLOBALS['xoopsTpl']->assign('ratings_pagenav', $ratings_pagenav->renderNav());
$GLOBALS['xoopsTpl']->display("db:" . $xoopsModule->dirname() . "_admin_ratingslist.html");
Modified: XoopsModules/wfdownloads/trunk/wfdownloads/admin/reportsmodifications.php
===================================================================
--- XoopsModules/wfdownloads/trunk/wfdownloads/admin/reportsmodifications.php 2013-08-09 20:19:06 UTC (rev 11893)
+++ XoopsModules/wfdownloads/trunk/wfdownloads/admin/reportsmodifications.php 2013-08-10 14:28:46 UTC (rev 11894)
@@ -29,12 +29,12 @@
$criteria = new Criteria('lid', $lid);
if (isset($_GET['ack'])) {
$acknowledged = (isset($_GET['ack']) && $_GET['ack'] ...
[truncated message content] |