|
From: <luc...@us...> - 2014-11-26 21:42:23
|
Revision: 12875
http://sourceforge.net/p/xoops/svn/12875
Author: luciorota
Date: 2014-11-26 21:42:17 +0000 (Wed, 26 Nov 2014)
Log Message:
-----------
- update to latest mamba work
- fixed: use DateTime object instead of strtotime function (luciorota)
Modified Paths:
--------------
XoopsModules/wfdownloads/branches/luciorota/wfdownloads/admin/about.php
XoopsModules/wfdownloads/branches/luciorota/wfdownloads/admin/admin_header.php
XoopsModules/wfdownloads/branches/luciorota/wfdownloads/admin/categories.php
XoopsModules/wfdownloads/branches/luciorota/wfdownloads/admin/clone.php
XoopsModules/wfdownloads/branches/luciorota/wfdownloads/admin/downloads.php
XoopsModules/wfdownloads/branches/luciorota/wfdownloads/admin/images.php
XoopsModules/wfdownloads/branches/luciorota/wfdownloads/admin/import.php
XoopsModules/wfdownloads/branches/luciorota/wfdownloads/admin/index.php
XoopsModules/wfdownloads/branches/luciorota/wfdownloads/admin/indexpage.php
XoopsModules/wfdownloads/branches/luciorota/wfdownloads/admin/menu.php
XoopsModules/wfdownloads/branches/luciorota/wfdownloads/admin/mimetypes.php
XoopsModules/wfdownloads/branches/luciorota/wfdownloads/admin/mirrors.php
XoopsModules/wfdownloads/branches/luciorota/wfdownloads/admin/permissions.php
XoopsModules/wfdownloads/branches/luciorota/wfdownloads/admin/ratings.php
XoopsModules/wfdownloads/branches/luciorota/wfdownloads/admin/reportsmodifications.php
XoopsModules/wfdownloads/branches/luciorota/wfdownloads/admin/reviews.php
XoopsModules/wfdownloads/branches/luciorota/wfdownloads/admin/swishe.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/breadcrumb.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/ip_log.php
XoopsModules/wfdownloads/branches/luciorota/wfdownloads/class/mimetype.php
XoopsModules/wfdownloads/branches/luciorota/wfdownloads/class/mirror.php
XoopsModules/wfdownloads/branches/luciorota/wfdownloads/class/modification.php
XoopsModules/wfdownloads/branches/luciorota/wfdownloads/class/multicolumnsthemeform.php
XoopsModules/wfdownloads/branches/luciorota/wfdownloads/class/rating.php
XoopsModules/wfdownloads/branches/luciorota/wfdownloads/class/report.php
XoopsModules/wfdownloads/branches/luciorota/wfdownloads/class/review.php
XoopsModules/wfdownloads/branches/luciorota/wfdownloads/class/session.php
XoopsModules/wfdownloads/branches/luciorota/wfdownloads/class/tree.php
XoopsModules/wfdownloads/branches/luciorota/wfdownloads/class/wfdownloads.php
XoopsModules/wfdownloads/branches/luciorota/wfdownloads/class/wfdownloads_lists.php
XoopsModules/wfdownloads/branches/luciorota/wfdownloads/class/xoopstree.php
XoopsModules/wfdownloads/branches/luciorota/wfdownloads/comment_new.php
XoopsModules/wfdownloads/branches/luciorota/wfdownloads/docs/changelog.txt
XoopsModules/wfdownloads/branches/luciorota/wfdownloads/docs/credits.txt
XoopsModules/wfdownloads/branches/luciorota/wfdownloads/docs/install.txt
XoopsModules/wfdownloads/branches/luciorota/wfdownloads/docs/lang_diff.txt
XoopsModules/wfdownloads/branches/luciorota/wfdownloads/docs/readme.txt
XoopsModules/wfdownloads/branches/luciorota/wfdownloads/header.php
XoopsModules/wfdownloads/branches/luciorota/wfdownloads/include/comment_functions.php
XoopsModules/wfdownloads/branches/luciorota/wfdownloads/include/common.php
XoopsModules/wfdownloads/branches/luciorota/wfdownloads/include/directorychecker.php
XoopsModules/wfdownloads/branches/luciorota/wfdownloads/include/filechecker.php
XoopsModules/wfdownloads/branches/luciorota/wfdownloads/include/functions.php
XoopsModules/wfdownloads/branches/luciorota/wfdownloads/include/notification.inc.php
XoopsModules/wfdownloads/branches/luciorota/wfdownloads/include/oninstall.php
XoopsModules/wfdownloads/branches/luciorota/wfdownloads/include/onuninstall.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/language/english/admin.php
XoopsModules/wfdownloads/branches/luciorota/wfdownloads/language/english/mail_template/category_filemodified_notify.tpl
XoopsModules/wfdownloads/branches/luciorota/wfdownloads/language/english/mail_template/category_filesubmit_notify.tpl
XoopsModules/wfdownloads/branches/luciorota/wfdownloads/language/english/mail_template/category_newfile_notify.tpl
XoopsModules/wfdownloads/branches/luciorota/wfdownloads/language/english/mail_template/file_approve_notify.tpl
XoopsModules/wfdownloads/branches/luciorota/wfdownloads/language/english/mail_template/file_filemodified_notify.tpl
XoopsModules/wfdownloads/branches/luciorota/wfdownloads/language/english/mail_template/filebroken_notify.tpl
XoopsModules/wfdownloads/branches/luciorota/wfdownloads/language/english/mail_template/global_filebroken_notify.tpl
XoopsModules/wfdownloads/branches/luciorota/wfdownloads/language/english/mail_template/global_filemodified_notify.tpl
XoopsModules/wfdownloads/branches/luciorota/wfdownloads/language/english/mail_template/global_filemodify_notify.tpl
XoopsModules/wfdownloads/branches/luciorota/wfdownloads/language/english/mail_template/global_filesubmit_notify.tpl
XoopsModules/wfdownloads/branches/luciorota/wfdownloads/language/english/mail_template/global_newcategory_notify.tpl
XoopsModules/wfdownloads/branches/luciorota/wfdownloads/language/english/mail_template/global_newfile_notify.tpl
XoopsModules/wfdownloads/branches/luciorota/wfdownloads/language/english/mail_template/index.html
XoopsModules/wfdownloads/branches/luciorota/wfdownloads/language/english/main.php
XoopsModules/wfdownloads/branches/luciorota/wfdownloads/language/english/modinfo.php
XoopsModules/wfdownloads/branches/luciorota/wfdownloads/language/index.html
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/templates/admin/wfdownloads_am_categorieslist.tpl
XoopsModules/wfdownloads/branches/luciorota/wfdownloads/templates/wfdownloads_co_letterschoice.tpl
XoopsModules/wfdownloads/branches/luciorota/wfdownloads/templates/wfdownloads_singlefile.tpl
XoopsModules/wfdownloads/branches/luciorota/wfdownloads/templates/wfdownloads_viewcat.tpl
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/about.php
===================================================================
--- XoopsModules/wfdownloads/branches/luciorota/wfdownloads/admin/about.php 2014-11-26 21:38:33 UTC (rev 12874)
+++ XoopsModules/wfdownloads/branches/luciorota/wfdownloads/admin/about.php 2014-11-26 21:42:17 UTC (rev 12875)
@@ -18,7 +18,7 @@
* @author Xoops Development Team
* @version svn:$id$
*/
-include_once dirname(__FILE__) . '/admin_header.php';
+include_once __DIR__ . '/admin_header.php';
xoops_cp_header();
@@ -27,4 +27,4 @@
echo $aboutAdmin->addNavigation('about.php');
echo $aboutAdmin->renderAbout('6KJ7RW5DR3VTJ', false);
-include_once dirname(__FILE__) . '/admin_footer.php';
+include_once __DIR__ . '/admin_footer.php';
Modified: XoopsModules/wfdownloads/branches/luciorota/wfdownloads/admin/admin_header.php
===================================================================
--- XoopsModules/wfdownloads/branches/luciorota/wfdownloads/admin/admin_header.php 2014-11-26 21:38:33 UTC (rev 12874)
+++ XoopsModules/wfdownloads/branches/luciorota/wfdownloads/admin/admin_header.php 2014-11-26 21:42:17 UTC (rev 12875)
@@ -18,8 +18,8 @@
* @author Xoops Development Team
* @version svn:$id$
*/
-include_once dirname(dirname(dirname(dirname(__FILE__)))) . '/mainfile.php';
-include_once dirname(dirname(__FILE__)) . '/include/common.php';
+include_once dirname(dirname(dirname(__DIR__))) . '/mainfile.php';
+include_once dirname(__DIR__) . '/include/common.php';
// Include xoops admin header
include_once XOOPS_ROOT_PATH . '/include/cp_header.php';
Modified: XoopsModules/wfdownloads/branches/luciorota/wfdownloads/admin/categories.php
===================================================================
--- XoopsModules/wfdownloads/branches/luciorota/wfdownloads/admin/categories.php 2014-11-26 21:38:33 UTC (rev 12874)
+++ XoopsModules/wfdownloads/branches/luciorota/wfdownloads/admin/categories.php 2014-11-26 21:42:17 UTC (rev 12875)
@@ -19,7 +19,7 @@
* @version svn:$id$
*/
$currentFile = basename(__FILE__);
-include_once dirname(__FILE__) . '/admin_header.php';
+include_once __DIR__ . '/admin_header.php';
// Check directories
if (!is_dir($wfdownloads->getConfig('uploaddir'))) {
@@ -39,38 +39,38 @@
exit();
}
-$op = WfdownloadsRequest::getString('op', 'categories.list');
+$op = XoopsRequest::getString('op', 'categories.list');
switch ($op) {
case 'category.move':
case 'move':
- $ok = WfdownloadsRequest::getBool('ok', false, 'POST');
+ $ok = XoopsRequest::getBool('ok', false, 'POST');
if ($ok == false) {
- $cid = WfdownloadsRequest::getInt('cid', 0);
+ $cid = XoopsRequest::getInt('cid', 0);
wfdownloads_xoops_cp_header();
include_once XOOPS_ROOT_PATH . '/class/xoopsformloader.php';
$sform = new XoopsThemeForm(_AM_WFDOWNLOADS_CCATEGORY_MOVE, 'move', xoops_getenv('PHP_SELF'));
- $categoryObjs = $wfdownloads->getHandler('category')->getObjects();
+ $categoryObjs = $wfdownloads->getHandler('category')->getObjects();
$categoryObjsTree = new XoopsObjectTree($categoryObjs, 'cid', 'pid');
$sform->addElement(new XoopsFormLabel(_AM_WFDOWNLOADS_BMODIFY, $categoryObjsTree->makeSelBox('target', 'title')));
- $create_tray = new XoopsFormElementTray('', '');
- $create_tray->addElement(new XoopsFormHidden('source', $cid));
- $create_tray->addElement(new XoopsFormHidden('ok', true));
- $create_tray->addElement(new XoopsFormHidden('op', 'category.move'));
- $butt_save = new XoopsFormButton('', '', _AM_WFDOWNLOADS_BMOVE, 'submit');
- $butt_save->setExtra('onclick="this.form.elements.op.value=\'category.move\'"');
- $create_tray->addElement($butt_save);
- $butt_cancel = new XoopsFormButton('', '', _AM_WFDOWNLOADS_BCANCEL, 'submit');
- $butt_cancel->setExtra('onclick="this.form.elements.op.value=\'cancel\'"');
- $create_tray -> addElement($butt_cancel);
+ $create_tray = new XoopsFormElementTray('', '');
+ $create_tray->addElement(new XoopsFormHidden('source', $cid));
+ $create_tray->addElement(new XoopsFormHidden('ok', true));
+ $create_tray->addElement(new XoopsFormHidden('op', 'category.move'));
+ $butt_save = new XoopsFormButton('', '', _AM_WFDOWNLOADS_BMOVE, 'submit');
+ $butt_save->setExtra('onclick="this.form.elements.op.value=\'category.move\'"');
+ $create_tray->addElement($butt_save);
+ $butt_cancel = new XoopsFormButton('', '', _AM_WFDOWNLOADS_BCANCEL, 'submit');
+ $butt_cancel->setExtra('onclick="this.form.elements.op.value=\'cancel\'"');
+ $create_tray->addElement($butt_cancel);
$sform->addElement($create_tray);
$sform->display();
xoops_cp_footer();
} else {
- $source = WfdownloadsRequest::getInt('source', 0, 'POST');
- $target = WfdownloadsRequest::getInt('target', 0, 'POST');
+ $source = XoopsRequest::getInt('source', 0, 'POST');
+ $target = XoopsRequest::getInt('target', 0, 'POST');
if ($target == $source) {
redirect_header($currentFile . "?op=category.move&ok=0&cid={$source}", 5, _AM_WFDOWNLOADS_CCATEGORY_MODIFY_FAILED);
}
@@ -89,40 +89,40 @@
case 'category.save':
case 'addCat':
- $cid = WfdownloadsRequest::getInt('cid', 0, 'POST');
- $pid = WfdownloadsRequest::getInt('pid', 0, 'POST');
- $weight = (isset($_POST['weight']) && $_POST['weight'] > 0) ? (int) $_POST["weight"] : 0;
- $down_groups = isset($_POST['groups']) ? $_POST['groups'] : array();
- $up_groups = isset($_POST['up_groups']) ? $_POST['up_groups'] : array();
- $spotlighthis = (isset($_POST['lid'])) ? (int) $_POST['lid'] : 0;
+ $cid = XoopsRequest::getInt('cid', 0, 'POST');
+ $pid = XoopsRequest::getInt('pid', 0, 'POST');
+ $weight = (isset($_POST['weight']) && $_POST['weight'] > 0) ? (int)$_POST["weight"] : 0;
+ $down_groups = isset($_POST['groups']) ? $_POST['groups'] : array();
+ $up_groups = isset($_POST['up_groups']) ? $_POST['up_groups'] : array();
+ $spotlighthis = (isset($_POST['lid'])) ? (int)$_POST['lid'] : 0;
$spotlighttop = (isset($_POST['spotlighttop']) && ($_POST['spotlighttop'] == 1)) ? 1 : 0;
include_once XOOPS_ROOT_PATH . '/class/uploader.php';
$allowedMimetypes = array('image/gif', 'image/jpeg', 'image/pjpeg', 'image/x-png', 'image/png');
- $imgurl = 'blank.png';
- $maxFileSize = $wfdownloads->getConfig('maxfilesize');
- $maxImgWidth = $wfdownloads->getConfig('maximgwidth');
- $maxImgHeight = $wfdownloads->getConfig('maximgheight');
- $uploadDirectory = XOOPS_ROOT_PATH . '/' . $wfdownloads->getConfig('catimage');
- $uploader = new XoopsMediaUploader($uploadDirectory, $allowedMimetypes, $maxFileSize, $maxImgWidth, $maxImgHeight);
+ $imgurl = 'blank.png';
+ $maxFileSize = $wfdownloads->getConfig('maxfilesize');
+ $maxImgWidth = $wfdownloads->getConfig('maximgwidth');
+ $maxImgHeight = $wfdownloads->getConfig('maximgheight');
+ $uploadDirectory = XOOPS_ROOT_PATH . '/' . $wfdownloads->getConfig('catimage');
+ $uploader = new XoopsMediaUploader($uploadDirectory, $allowedMimetypes, $maxFileSize, $maxImgWidth, $maxImgHeight);
if ($uploader->fetchMedia($_POST['xoops_upload_file'][0])) {
$uploader->setTargetFileName('wfdownloads_' . uniqid(time()) . '--' . strtolower($_FILES['uploadfile']['name']));
$uploader->fetchMedia($_POST['xoops_upload_file'][0]);
if (!$uploader->upload()) {
$errors = $uploader->getErrors();
- redirect_header('javascript:history.go(-1)',3, $errors);
+ redirect_header('javascript:history.go(-1)', 3, $errors);
} else {
$imgurl = $uploader->getSavedFileName();
}
} else {
- $imgurl = (isset($_POST['imgurl']) && $_POST['imgurl'] != 'blank.png') ? $myts -> addslashes($_POST['imgurl']) : '';
+ $imgurl = (isset($_POST['imgurl']) && $_POST['imgurl'] != 'blank.png') ? $myts->addslashes($_POST['imgurl']) : '';
}
if (!$cid) {
$categoryObj = $wfdownloads->getHandler('category')->create();
} else {
$categoryObj = $wfdownloads->getHandler('category')->get($cid);
- $childcats = $wfdownloads->getHandler('category')->getChildCats($categoryObj);
+ $childcats = $wfdownloads->getHandler('category')->getChildCats($categoryObj);
if ($pid == $cid || in_array($pid, array_keys($childcats))) {
$categoryObj->setErrors(_AM_WFDOWNLOADS_CCATEGORY_CHILDASPARENT);
}
@@ -141,7 +141,7 @@
$categoryObj->setVar('dobr', isset($_POST['dobr']));
// Formulize module support (2006/05/04) jpc - start
if (wfdownloads_checkModule('formulize')) {
- $formulize_fid = (isset($_POST['formulize_fid'])) ? (int) $_POST['formulize_fid'] : 0;
+ $formulize_fid = (isset($_POST['formulize_fid'])) ? (int)$_POST['formulize_fid'] : 0;
$categoryObj->setVar('formulize_fid', $formulize_fid);
}
// Formulize module support (2006/05/04) jpc - end
@@ -153,15 +153,15 @@
}
if (!$cid) {
if ($cid == 0) {
- $newid = (int) $categoryObj->getVar('cid');
+ $newid = (int)$categoryObj->getVar('cid');
}
wfdownloads_savePermissions($down_groups, $newid, 'WFDownCatPerm');
wfdownloads_savePermissions($up_groups, $newid, 'WFUpCatPerm');
// Notify of new category
- $tags = array();
+ $tags = array();
$tags['CATEGORY_NAME'] = $_POST['title'];
- $tags['CATEGORY_URL'] = WFDOWNLOADS_URL . '/viewcat.php?cid=' . $newid;
- $notification_handler = xoops_gethandler('notification');
+ $tags['CATEGORY_URL'] = WFDOWNLOADS_URL . '/viewcat.php?cid=' . $newid;
+ $notification_handler = xoops_gethandler('notification');
$notification_handler->triggerEvent('global', 0, 'new_category', $tags);
$database_mess = _AM_WFDOWNLOADS_CCATEGORY_CREATED;
} else {
@@ -174,11 +174,11 @@
case 'category.delete':
case 'del':
- $cid = WfdownloadsRequest::getInt('cid', 0);
- $ok = WfdownloadsRequest::getBool('ok', false, 'POST');
- $categoryObjs = $wfdownloads->getHandler('category')->getObjects();
+ $cid = XoopsRequest::getInt('cid', 0);
+ $ok = XoopsRequest::getBool('ok', false, 'POST');
+ $categoryObjs = $wfdownloads->getHandler('category')->getObjects();
$categoryObjsTree = new XoopsObjectTree($categoryObjs, 'cid', 'pid');
- if ($ok == true) {
+ if ($ok === true) {
// get all subcategories under the specified category
$childCategoryObjs = $categoryObjsTree->getAllChild($cid);
foreach ($childCategoryObjs as $childCategoryObj) {
@@ -199,7 +199,7 @@
$wfdownloads->getHandler('report')->deleteAll($download_criteria);
$wfdownloads->getHandler('download')->deleteAll($download_criteria);
foreach (array_keys($downloads) as $lid) {
- xoops_comment_delete($wfdownloads->getModule()->mid(), (int) $lid);
+ xoops_comment_delete($wfdownloads->getModule()->mid(), (int)$lid);
}
// all downloads for each category is deleted, now delete the category data
@@ -207,8 +207,8 @@
$error = _AM_WFDOWNLOADS_DBERROR;
foreach ($cids as $cid) {
- xoops_groupperm_deletebymoditem ($wfdownloads->getModule()->mid(), 'WFDownCatPerm', $cid);
- xoops_groupperm_deletebymoditem ($wfdownloads->getModule() -> mid(), 'WFUpCatPerm', $cid);
+ xoops_groupperm_deletebymoditem($wfdownloads->getModule()->mid(), 'WFDownCatPerm', $cid);
+ xoops_groupperm_deletebymoditem($wfdownloads->getModule()->mid(), 'WFUpCatPerm', $cid);
}
redirect_header($currentFile, 1, _AM_WFDOWNLOADS_CCATEGORY_DELETED);
@@ -237,9 +237,9 @@
$categoryObj = $wfdownloads->getHandler('category')->create();
}
$form = $categoryObj->getForm();
- $form -> display();
+ $form->display();
- include_once dirname(__FILE__) . '/admin_footer.php';
+ include_once __DIR__ . '/admin_footer.php';
break;
case 'categories.list':
@@ -257,22 +257,22 @@
if ($totalCategories > 0) {
$sorted_categories = wfdownloads_sortCategories();
$GLOBALS['xoopsTpl']->assign('sorted_categories', $sorted_categories);
- $GLOBALS['xoopsTpl']->assign('token', $GLOBALS['xoopsSecurity']->getTokenHTML() );
+ $GLOBALS['xoopsTpl']->assign('token', $GLOBALS['xoopsSecurity']->getTokenHTML());
$GLOBALS['xoopsTpl']->display("db:{$wfdownloads->getModule()->dirname()}_am_categorieslist.tpl");
} else {
redirect_header("{$currentFile}?op=category.add", 1, _AM_WFDOWNLOADS_CCATEGORY_NOEXISTS);
}
- include_once dirname(__FILE__) . '/admin_footer.php';
+ include_once __DIR__ . '/admin_footer.php';
break;
case 'categories.reorder':
if (!$GLOBALS['xoopsSecurity']->check()) {
- redirect_header($currentFile, 3, implode(',', $GLOBALS['xoopsSecurity']->getErrors() ));
+ redirect_header($currentFile, 3, implode(',', $GLOBALS['xoopsSecurity']->getErrors()));
}
if (isset($_POST['new_weights']) && count($_POST['new_weights']) > 0) {
$new_weights = $_POST['new_weights'];
- $ids = array();
+ $ids = array();
foreach ($new_weights as $cid => $new_weight) {
$categoryObj = $wfdownloads->getHandler('category')->get($cid);
$categoryObj->setVar('weight', $new_weight);
Modified: XoopsModules/wfdownloads/branches/luciorota/wfdownloads/admin/clone.php
===================================================================
--- XoopsModules/wfdownloads/branches/luciorota/wfdownloads/admin/clone.php 2014-11-26 21:38:33 UTC (rev 12874)
+++ XoopsModules/wfdownloads/branches/luciorota/wfdownloads/admin/clone.php 2014-11-26 21:42:17 UTC (rev 12875)
@@ -19,7 +19,7 @@
* @version svn:$id$
*/
$currentFile = basename(__FILE__);
-include_once dirname(__FILE__) . '/admin_header.php';
+include_once __DIR__ . '/admin_header.php';
if (@$_POST['op'] == 'submit') {
if (!$GLOBALS['xoopsSecurity']->check()) {
@@ -71,7 +71,7 @@
$indexAdmin = new ModuleAdmin();
echo $indexAdmin->addNavigation($currentFile);
echo $message;
- include_once dirname(__FILE__) . '/admin_footer.php';
+ include_once __DIR__ . '/admin_footer.php';
exit();
} else {
@@ -86,7 +86,7 @@
$form->addElement(new XoopsFormHidden('op', 'submit'));
$form->addElement(new XoopsFormButton('', '', _SUBMIT, 'submit'));
$form->display();
- include_once dirname(__FILE__) . '/admin_footer.php';
+ include_once __DIR__ . '/admin_footer.php';
exit();
}
Modified: XoopsModules/wfdownloads/branches/luciorota/wfdownloads/admin/downloads.php
===================================================================
--- XoopsModules/wfdownloads/branches/luciorota/wfdownloads/admin/downloads.php 2014-11-26 21:38:33 UTC (rev 12874)
+++ XoopsModules/wfdownloads/branches/luciorota/wfdownloads/admin/downloads.php 2014-11-26 21:42:17 UTC (rev 12875)
@@ -19,7 +19,7 @@
* @version svn:$id$
*/
$currentFile = basename(__FILE__);
-include_once dirname(__FILE__) . '/admin_header.php';
+include_once __DIR__ . '/admin_header.php';
// Check directories
if (!is_dir($wfdownloads->getConfig('uploaddir'))) {
@@ -39,7 +39,7 @@
exit();
}
-$op = WfdownloadsRequest::getString('op', 'downloads.list');
+$op = XoopsRequest::getString('op', 'downloads.list');
switch ($op) {
case 'download.edit':
case 'download.add':
@@ -52,15 +52,15 @@
$adminMenu->addItemButton(_MI_WFDOWNLOADS_MENU_DOWNLOADS, "{$currentFile}?op=downloads.list", 'list');
echo $adminMenu->renderButton();
- $lid = WfdownloadsRequest::getInt('lid', 0);
+ $lid = XoopsRequest::getInt('lid', 0);
$categoriesCount = $wfdownloads->getHandler('category')->getCount();
if ($categoriesCount) {
// Allowed mimetypes list
echo "<fieldset><legend style='font-weight: bold; color: #900;'>" . _AM_WFDOWNLOADS_FILE_ALLOWEDAMIME . "</legend>\n";
echo "<div style='padding: 8px;'>\n";
- $criteria = new Criteria("mime_admin", true);
- $mimetypes = $wfdownloads->getHandler('mimetype')->getList($criteria);
+ $criteria = new Criteria("mime_admin", true);
+ $mimetypes = $wfdownloads->getHandler('mimetype')->getList($criteria);
$allowMimetypes = implode(' | ', $mimetypes);
echo $allowMimetypes;
echo "</div>\n";
@@ -77,16 +77,16 @@
redirect_header($currentFile, 4, _AM_WFDOWNLOADS_DOWN_ERROR_CATEGORYNOTFOUND);
exit();
}
- $title = preg_replace("/{category}/", $categoryObj->getVar('title'), _AM_WFDOWNLOADS_FILE_EDIT);
+ $title = preg_replace("/{category}/", $categoryObj->getVar('title'), _AM_WFDOWNLOADS_FILE_EDIT);
$title12 = preg_replace("/{category}/", $categoryObj->getVar('title'), _AM_WFDOWNLOADS_FFS_1STEP);
$title22 = preg_replace("/{category}/", $categoryObj->getVar('title'), _AM_WFDOWNLOADS_FFS_EDITDOWNLOADTITLE);
} else {
// create download
$downloadObj = $wfdownloads->getHandler('download')->create();
- $cid = WfdownloadsRequest::getInt('cid', 0, 'POST');
+ $cid = XoopsRequest::getInt('cid', 0, 'POST');
$categoryObj = $wfdownloads->getHandler('category')->get($cid);
$downloadObj->setVar('cid', $cid);
- $title = preg_replace("/{category}/", $categoryObj->getVar('title'), _AM_WFDOWNLOADS_FILE_CREATE);
+ $title = preg_replace("/{category}/", $categoryObj->getVar('title'), _AM_WFDOWNLOADS_FILE_CREATE);
$title12 = preg_replace("/{category}/", $categoryObj->getVar('title'), _AM_WFDOWNLOADS_FFS_1STEP);
$title22 = preg_replace("/{category}/", $categoryObj->getVar('title'), _AM_WFDOWNLOADS_FFS_DOWNLOADTITLE);
}
@@ -97,15 +97,16 @@
$sform = $downloadObj->getAdminForm($title);
} elseif ((isset($_POST['submit_category']) && !empty($_POST['submit_category']))) {
// two steps form: 2nd step
- $fid = $categoryObj->getVar('formulize_fid');
+ $fid = $categoryObj->getVar('formulize_fid');
$customArray = array();
if ($fid) {
include_once XOOPS_ROOT_PATH . '/modules/formulize/include/formdisplay.php';
include_once XOOPS_ROOT_PATH . '/modules/formulize/include/functions.php';
- $customArray['fid'] = $fid;
+ $customArray['fid'] = $fid;
$customArray['formulize_mgr'] = xoops_getmodulehandler('elements', 'formulize');
- $customArray['groups'] = $GLOBALS['xoopsUser'] ? $GLOBALS['xoopsUser']->getGroups() : array(0 => XOOPS_GROUP_ANONYMOUS);
- $customArray['prevEntry'] = getEntryValues( // is a Formulize function
+ $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'],
$customArray['groups'],
@@ -124,7 +125,7 @@
} else {
$owner = getEntryOwner($customArray['entry'], $fid); // is a Formulize function
}
- $ownerGroups = $member_handler->getGroupsByUser($owner, false);
+ $ownerGroups = $member_handler->getGroupsByUser($owner, false);
$customArray['owner_groups'] = $ownerGroups;
}
$sform = $downloadObj->getAdminForm($title22, $customArray);
@@ -192,9 +193,9 @@
foreach ($regUserRatingObjs as $regUserRatingObj) {
$formatted_date = XoopsLocal::formatTimestamp($regUserRatingObj->getVar('ratingtimestamp'), 'l');
- $userAvgRating = isset($userRatings[$regUserRatingObj->getVar('ratinguser')]) ? $userRatings[$regUserRatingObj->getVar('ratinguser')]['avg'] : 0;
- $userVotes = isset($userRatings[$regUserRatingObj->getVar('ratinguser')]) ? $userRatings[$regUserRatingObj->getVar('ratinguser')]['count'] : 0;
- $ratingUserName = XoopsUser :: getUnameFromId($regUserRatingObj->getVar('ratinguser'));
+ $userAvgRating = isset($userRatings[$regUserRatingObj->getVar('ratinguser')]) ? $userRatings[$regUserRatingObj->getVar('ratinguser')]['avg'] : 0;
+ $userVotes = isset($userRatings[$regUserRatingObj->getVar('ratinguser')]) ? $userRatings[$regUserRatingObj->getVar('ratinguser')]['count'] : 0;
+ $ratingUserName = XoopsUser:: getUnameFromId($regUserRatingObj->getVar('ratinguser'));
echo "
<tr><td class='head'>$ratingUserName</td>\n
@@ -204,8 +205,7 @@
<td class='even'>$userVotes</th>\n
<td class='even'>$formatted_date</th>\n
<td class='even'>\n
- <a href='{$currentFile}?op=vote.delete&lid={$lid}&rid=" . $regUserRatingObj->getVar('ratingid') . "'>"
- . $imagearray['deleteimg'] . "</a>\n
+ <a href='{$currentFile}?op=vote.delete&lid={$lid}&rid=" . $regUserRatingObj->getVar('ratingid') . "'>" . $imagearray['deleteimg'] . "</a>\n
</th></tr>\n
";
}
@@ -227,14 +227,14 @@
if ($anonUserRatingCount == 0) {
echo "<tr><td colspan='7' class='even'><b>" . _AM_WFDOWNLOADS_VOTE_NOUNREGVOTES . "</b></td></tr>";
} else {
- $criteria = new Criteria('ratinguser', 0);
- $userRatings = $wfdownloads->getHandler('rating')->getUserAverage($criteria);
+ $criteria = new Criteria('ratinguser', 0);
+ $userRatings = $wfdownloads->getHandler('rating')->getUserAverage($criteria);
$anonUserRatingObjs = $wfdownloads->getHandler('rating')->getObjects($anonUserCriteria);
foreach (array_keys($anonUserRatingObjs) as $anonUserRatingObj) {
$formatted_date = XoopsLocal::formatTimestamp($anonUserRatingObj->getVar('ratingtimestamp'), 'l');
- $userAvgRating = isset($userRatings['avg']) ? $userRatings['avg'] : 0;
- $userVotes = isset($userRatings['count']) ? $userRatings['count'] : 0;
+ $userAvgRating = isset($userRatings['avg']) ? $userRatings['avg'] : 0;
+ $userVotes = isset($userRatings['count']) ? $userRatings['count'] : 0;
$ratingUserName = $GLOBALS['xoopsConfig']['anonymous'];
@@ -246,8 +246,7 @@
<td class='even'>$userVotes</th>\n
<td class='even'>$formatted_date</th>\n
<td class='even'>\n
- <a href='{$currentFile}?op=vote.delete&lid={$lid}&rid=" . $anonUserRatingObj->getVar('ratingid') . "'>"
- . $imagearray['deleteimg'] . "</a>\n
+ <a href='{$currentFile}?op=vote.delete&lid={$lid}&rid=" . $anonUserRatingObj->getVar('ratingid') . "'>" . $imagearray['deleteimg'] . "</a>\n
</th></tr>\n
";
}
@@ -255,32 +254,32 @@
echo "</table>\n";
echo "</fieldset>\n";
}
- include_once dirname(__FILE__) . '/admin_footer.php';
+ include_once __DIR__ . '/admin_footer.php';
break;
case 'download.save':
case 'addDownload':
- $lid = WfdownloadsRequest::getInt('lid', 0, 'POST');
- $cid = WfdownloadsRequest::getInt('cid', 0, 'POST');
- $status = WfdownloadsRequest::getInt('status', _WFDOWNLOADS_STATUS_UPDATED, 'POST');
+ $lid = XoopsRequest::getInt('lid', 0, 'POST');
+ $cid = XoopsRequest::getInt('cid', 0, 'POST');
+ $status = XoopsRequest::getInt('status', _WFDOWNLOADS_STATUS_UPDATED, 'POST');
if ($lid > 0) {
$thisIsANewRecord = false; /* Added by Lankford on 2007/3/21 */
- $downloadObj = $wfdownloads->getHandler('download')->get($lid);
+ $downloadObj = $wfdownloads->getHandler('download')->get($lid);
} else {
$thisIsANewRecord = true; /* Added by Lankford on 2007/3/21 */
- $downloadObj = $wfdownloads->getHandler('download')->create();
+ $downloadObj = $wfdownloads->getHandler('download')->create();
}
// Define URL
if (empty($_FILES['userfile']['name'])) {
if ($_POST['url'] && $_POST['url'] != '' && $_POST['url'] != 'http://') {
- $url = ($_POST['url'] != 'http://') ? $_POST['url'] : '';
+ $url = ($_POST['url'] != 'http://') ? $_POST['url'] : '';
$filename = '';
$filetype = '';
// Get size from form
- $size = (empty($_POST['size']) || !is_numeric($_POST['size'])) ? 0 : (int) $_POST['size'];
+ $size = (empty($_POST['size']) || !is_numeric($_POST['size'])) ? 0 : (int)$_POST['size'];
} else {
- $url = ($_POST['url'] != 'http://') ? $_POST['url'] : '';
+ $url = ($_POST['url'] != 'http://') ? $_POST['url'] : '';
$filename = $_POST['filename'];
$filetype = $_POST['filetype'];
$filePath = $wfdownloads->getConfig('uploaddir') . '/' . $filename;
@@ -291,12 +290,12 @@
$downloadObj->setVar('filename', $filename);
$downloadObj->setVar('filetype', $filetype);
} else {
- $down = wfdownloads_uploading($_FILES, $wfdownloads->getConfig('uploaddir'), '', $currentFile, 0, false, true);
- $url = ($_POST['url'] != 'http://') ? $_POST['url'] : '';
- $size = $down['size'];
+ $down = wfdownloads_uploading($_FILES, $wfdownloads->getConfig('uploaddir'), '', $currentFile, 0, false, true);
+ $url = ($_POST['url'] != 'http://') ? $_POST['url'] : '';
+ $size = $down['size'];
$title = $_FILES['userfile']['name'];
- $ext = rtrim(strrchr($title, '.'), '.');
+ $ext = rtrim(strrchr($title, '.'), '.');
$title = str_replace($ext, '', $title);
$title = (isset($_POST['title_checkbox']) && $_POST['title_checkbox'] == 1) ? $title : trim($_POST['title']);
@@ -306,7 +305,7 @@
$downloadObj->setVar('filetype', $filetype);
}
// Get data from form
- $screenshots = array();
+ $screenshots = array();
$screenshots[] = ($_POST['screenshot'] != 'blank.png') ? $_POST['screenshot'] : '';
$screenshots[] = ($_POST['screenshot2'] != 'blank.png') ? $_POST['screenshot2'] : '';
$screenshots[] = ($_POST['screenshot3'] != 'blank.png') ? $_POST['screenshot3'] : '';
@@ -326,11 +325,11 @@
// If both conditions are true, then trigger all three notifications related to modified records.
if (!$thisIsANewRecord && ($downloadObj->getVar('version') != $version)) {
// Trigger the three events related to modified files (one for the file, category, and global event categories respectively)
- $tags = array();
- $tags['FILE_NAME'] = $title;
- $tags['FILE_URL'] = WFDOWNLOADS_URL . "/singlefile.php?cid={$cid}&lid={$lid}";
- $categoryObj = $wfdownloads->getHandler('category')->get($cid);
- $tags['FILE_VERSION'] = $version;
+ $tags = array();
+ $tags['FILE_NAME'] = $title;
+ $tags['FILE_URL'] = WFDOWNLOADS_URL . "/singlefile.php?cid={$cid}&lid={$lid}";
+ $categoryObj = $wfdownloads->getHandler('category')->get($cid);
+ $tags['FILE_VERSION'] = $version;
$tags['CATEGORY_NAME'] = $categoryObj->getVar('title');
$tags['CATEGORY_URL'] = WFDOWNLOADS_URL . "/viewcat.php?cid='{$cid}";
@@ -377,12 +376,12 @@
$versiontypes = (isset($_POST['versiontypes'])) ? $_POST['versiontypes'] : '';
$downloadObj->setVar('versiontypes', $versiontypes);
- $dhistory = (isset($_POST['dhistory'])) ? $_POST['dhistory'] : '';
+ $dhistory = (isset($_POST['dhistory'])) ? $_POST['dhistory'] : '';
$dhistoryhistory = (isset($_POST['dhistoryaddedd'])) ? $_POST['dhistoryaddedd'] : '';
if ($lid > 0 && !empty($dhistoryhistory)) {
$dhistory = $dhistory . "\n\n";
- $time = time();
+ $time = time();
$dhistory .= _AM_WFDOWNLOADS_FILE_HISTORYVERS . $version . _AM_WFDOWNLOADS_FILE_HISTORDATE . XoopsLocal::formatTimestamp($time, 'l') . "\n\n";
$dhistory .= $dhistoryhistory;
}
@@ -398,7 +397,7 @@
$offline = ($_POST['offline'] == true) ? true : false;
$downloadObj->setVar('offline', $offline);
- $approved = (isset($_POST['approved']) && $_POST['approved'] == true) ? true : false;
+ $approved = (isset($_POST['approved']) && $_POST['approved'] == true) ? true : false;
$notifypub = (isset($_POST['notifypub']) && $_POST['notifypub'] == true);
$expiredate = 0;
@@ -406,19 +405,23 @@
$publishdate = time();
} else {
$publishdate = $_POST['was_published'];
- $expiredate = $_POST['was_expired'];
+ $expiredate = $_POST['was_expired'];
}
if ($approved == 1 && empty($publishdate)) {
$publishdate = time();
}
if (isset($_POST['publishdateactivate'])) {
- $publishdate = strtotime($_POST['published']['date']) + $_POST['published']['time'];
+ $obj = DateTime::createFromFormat(_SHORTDATESTRING, $_POST['published']['date']);
+ $obj->setTime(0, 0, 0);
+ $publishdate = $obj->getTimestamp() + $_POST['published']['time'];
}
if ($_POST['clearpublish']) {
$publishdate = $downloadObj->getVar('published');
}
if (isset($_POST['expiredateactivate'])) {
- $expiredate = strtotime($_POST['expired']['date']) + $_POST['expired']['time'];
+ $obj = DateTime::createFromFormat(_SHORTDATESTRING, $_POST['expired']['date']);
+ $obj->setTime(0, 0, 0);
+ $expiredate = $obj->getTimestamp() + $_POST['expired']['time'];
}
if ($_POST['clearexpire']) {
$expiredate = '0';
@@ -452,17 +455,17 @@
} else {
print 'no idreq';
$entries[$fid][0] = '';
- $owner = '';
+ $owner = '';
}
$cid = $downloadObj->getVar('cid');
} else {
$entries[$fid][0] = '';
- $owner = '';
+ $owner = '';
}
$ownerGroups = $member_handler->getGroupsByUser($owner, false);
- $uid = !empty($GLOBALS['xoopsUser']) ? $GLOBALS['xoopsUser']->getVar('uid') : 0;
- $groups = $GLOBALS['xoopsUser'] ? $GLOBALS['xoopsUser']->getGroups() : array(0 => XOOPS_GROUP_ANONYMOUS);
- $entries = handleSubmission(
+ $uid = !empty($GLOBALS['xoopsUser']) ? $GLOBALS['xoopsUser']->getVar('uid') : 0;
+ $groups = $GLOBALS['xoopsUser'] ? $GLOBALS['xoopsUser']->getGroups() : array(0 => XOOPS_GROUP_ANONYMOUS);
+ $entries = handleSubmission(
$formulizeElements_handler,
$entries,
$uid,
@@ -480,24 +483,24 @@
}
// Formulize module support (2006/05/04) jpc - end
$wfdownloads->getHandler('download')->insert($downloadObj);
- $newid = (int) $downloadObj->getVar('lid');
+ $newid = (int)$downloadObj->getVar('lid');
// Send notifications
if (!$lid) {
- $tags = array();
- $tags['FILE_NAME'] = $title;
- $tags['FILE_URL'] = WFDOWNLOADS_URL . "/singlefile.php?cid={$cid}&lid={$newid}";
+ $tags = array();
+ $tags['FILE_NAME'] = $title;
+ $tags['FILE_URL'] = WFDOWNLOADS_URL . "/singlefile.php?cid={$cid}&lid={$newid}";
$tags['CATEGORY_NAME'] = $categoryObj->getVar('title');
- $tags['CATEGORY_URL'] = WFDOWNLOADS_URL . "/viewcat.php?cid={$cid}";
+ $tags['CATEGORY_URL'] = WFDOWNLOADS_URL . "/viewcat.php?cid={$cid}";
$notification_handler->triggerEvent('global', 0, 'new_file', $tags);
$notification_handler->triggerEvent('category', $cid, 'new_file', $tags);
}
if ($lid && $approved && $notifypub) {
- $tags = array();
- $tags['FILE_NAME'] = $title;
- $tags['FILE_URL'] = WFDOWNLOADS_URL . "/singlefile.php?cid={$cid}&lid={$lid}";
- $categoryObj = $wfdownloads->getHandler('category')->get($cid);
+ $tags = array();
+ $tags['FILE_NAME'] = $title;
+ $tags['FILE_URL'] = WFDOWNLOADS_URL . "/singlefile.php?cid={$cid}&lid={$lid}";
+ $categoryObj = $wfdownloads->getHandler('category')->get($cid);
$tags['CATEGORY_NAME'] = $categoryObj->getVar('title');
- $tags['CATEGORY_URL'] = WFDOWNLOADS_URL . '/viewcat.php?cid=' . $cid;
+ $tags['CATEGORY_URL'] = WFDOWNLOADS_URL . '/viewcat.php?cid=' . $cid;
$notification_handler->triggerEvent('global', 0, 'new_file', $tags);
$notification_handler->triggerEvent('category', $cid, 'new_file', $tags);
$notification_handler->triggerEvent('file', $lid, 'approve', $tags);
@@ -509,14 +512,14 @@
break;
case 'download.delete':
- $lid = WfdownloadsRequest::getInt('lid', 0);
- $ok = WfdownloadsRequest::getBool('ok', false, 'POST');
+ $lid = XoopsRequest::getInt('lid', 0);
+ $ok = XoopsRequest::getBool('ok', false, 'POST');
if (!$downloadObj = $wfdownloads->getHandler('download')->get($lid)) {
redirect_header($currentFile, 4, _AM_WFDOWNLOADS_ERROR_DOWNLOADNOTFOUND);
exit();
}
$title = $downloadObj->getVar('title');
- if ($ok == true) {
+ if ($ok === true) {
if (!$GLOBALS['xoopsSecurity']->check()) {
redirect_header($currentFile, 3, implode(',', $GLOBALS['xoopsSecurity']->getErrors()));
}
@@ -546,7 +549,7 @@
case 'delVote':
$ratingObj = $wfdownloads->getHandler('rating')->get($_GET['rid']);
if ($wfdownloads->getHandler('rating')->delete($ratingObj, true)) {
- wfdownloads_updateRating((int) $ratingObj->getVar('lid'));
+ wfdownloads_updateRating((int)$ratingObj->getVar('lid'));
}
redirect_header($currentFile, 1, _AM_WFDOWNLOADS_VOTE_VOTEDELETED);
break;
@@ -563,8 +566,7 @@
$sqls[] = "ALTER TABLE " . $GLOBALS['xoopsDB']->prefix('wfdownloads_downloads') . " ADD formulize_idreq int(5) NOT NULL default '0';";
foreach ($sqls as $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.");
+ exit("Error patching for Formulize.<br>SQL dump:<br>" . $sql . "<br>Please contact <a hre...@fr...>Freeform Solutions</a> for assistance.");
}
}
print "Patching for Formulize completed.";
@@ -575,7 +577,7 @@
case 'newdownload.approve':
case 'approve':
- $lid = WfdownloadsRequest::getInt('lid', 0);
+ $lid = XoopsRequest::getInt('lid', 0);
if (!$downloadObj = $wfdownloads->getHandler('download')->get($lid)) {
redirect_header($currentFile, 4, _AM_WFDOWNLOADS_ERROR_DOWNLOADNOTFOUND);
exit();
@@ -588,14 +590,14 @@
exit();
}
// Trigger notify
- $title = $downloadObj->getVar('title');
- $cid = $downloadObj->getVar('cid');
- $categoryObj = $wfdownloads->getHandler('category')->get($cid);
- $tags = array();
- $tags['FILE_NAME'] = $title;
- $tags['FILE_URL'] = WFDOWNLOADS_URL . "/singlefile.php?cid={$cid}&lid={$lid}";
+ $title = $downloadObj->getVar('title');
+ $cid = $downloadObj->getVar('cid');
+ $categoryObj = $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'] = $categoryObj->getVar('title');
- $tags['CATEGORY_URL'] = WFDOWNLOADS_URL . "/viewcat.php?cid={$cid}";
+ $tags['CATEGORY_URL'] = WFDOWNLOADS_URL . "/viewcat.php?cid={$cid}";
$notification_handler->triggerEvent('global', 0, 'new_file', $tags);
$notification_handler->triggerEvent('category', $cid, 'new_file', $tags);
if ($downloadObj->getVar('notifypub')) {
@@ -608,13 +610,13 @@
case 'downloads.filter':
default :
// get filter conditions
- $filter_title_condition = WfdownloadsRequest::getString('filter_title_condition', '=');
- $filter_title = WfdownloadsRequest::getString('filter_title', '');
- $filter_category_title_condition = WfdownloadsRequest::getString('filter_category_title_condition', '=');
- $filter_category_title = WfdownloadsRequest::getString('filter_category_title', '');
- $filter_submitter = WfdownloadsRequest::getArray('filter_submitter', null);
- $filter_date = WfdownloadsRequest::getArray('filter_date', null);
- $filter_date_condition = WfdownloadsRequest::getString('filter_date_condition', '<');
+ $filter_title_condition = XoopsRequest::getString('filter_title_condition', '=');
+ $filter_title = XoopsRequest::getString('filter_title', '');
+ $filter_category_title_condition = XoopsRequest::getString('filter_category_title_condition', '=');
+ $filter_category_title = XoopsRequest::getString('filter_category_title', '');
+ $filter_submitter = XoopsRequest::getArray('filter_submitter', null);
+ $filter_date = XoopsRequest::getArray('filter_date', null);
+ $filter_date_condition = XoopsRequest::getString('filter_date_condition', '<');
// check filter conditions
if ($op == 'downloads.filter') {
if ($filter_title == '' && $filter_category_title == '' && is_null($filter_submitter)) {
@@ -626,14 +628,14 @@
$categoryObjs = $wfdownloads->getHandler('category')->getObjects();
- $start_published = WfdownloadsRequest::getInt('start_published', 0);
- $start_new = WfdownloadsRequest::getInt('start_new', 0);
- $start_autopublished = WfdownloadsRequest::getInt('start_autopublished', 0);
- $start_expired = WfdownloadsRequest::getInt('start_expired', 0);
- $start_offline = WfdownloadsRequest::getInt('start_offline', 0);
+ $start_published = XoopsRequest::getInt('start_published', 0);
+ $start_new = XoopsRequest::getInt('start_new', 0);
+ $start_autopublished = XoopsRequest::getInt('start_autopublished', 0);
+ $start_expired = XoopsRequest::getInt('start_expired', 0);
+ $start_offline = XoopsRequest::getInt('start_offline', 0);
- $totalCategoriesCount = wfdownloads_categoriesCount();
- $categoryObjs = $wfdownloads->getHandler('category')->getObjects(null, true, false);
+ $totalCategoriesCount = wfdownloads_categoriesCount();
+ $categoryObjs = $wfdownloads->getHandler('category')->getObjects(null, true, false);
$totalDownloadsCount = $wfdownloads->getHandler('download')->getCount();
@@ -681,7 +683,7 @@
$criteria->setOrder('DESC');
$criteria->setStart($start_published);
$criteria->setLimit($wfdownloads->getConfig('admin_perpage'));
- $publishedDownloadObjs = $wfdownloads->getHandler('download')->getActiveDownloads($criteria);
+ $publishedDownloadObjs = $wfdownloads->getHandler('download')->getActiveDownloads($criteria);
$publishedDownloadCount = $wfdownloads->getHandler('download')->getActiveCount();
$GLOBALS['xoopsTpl']->assign('published_downloads_count', $publishedDownloadCount);
@@ -701,7 +703,7 @@
$GLOBALS['xoopsTpl']->assign('filter_title_condition', $filter_title_condition);
$GLOBALS['xoopsTpl']->assign('filter_category_title', $filter_category_title);
$GLOBALS['xoopsTpl']->assign('filter_category_title_condition', $filter_category_title_condition);
- $submitters = array();
+ $submitters = array();
$downloadsSubmitters_array = $wfdownloads->getHandler('download')->getAll(null, array('submitter'), false, false);
foreach ($downloadsSubmitters_array as $downloadSubmitters_array) {
$submitters[$downloadSubmitters_array['submitter']] = XoopsUserUtility::getUnameFromId($downloadSubmitters_array['submitter']);
@@ -721,23 +723,23 @@
$criteria->add(new Criteria('published', 0));
$criteria->setStart($start_new);
$criteria->setLimit($wfdownloads->getConfig('admin_perpage'));
- $newDownloadObjs = $wfdownloads->getHandler('download')->getObjects($criteria);
+ $newDownloadObjs = $wfdownloads->getHandler('download')->getObjects($criteria);
$newDownloadCount = $wfdownloads->getHandler('download')->getCount($criteria);
$GLOBALS['xoopsTpl']->assign('new_downloads_count', $newDownloadCount);
if ($newDownloadCount > 0) {
foreach ($newDownloadObjs as $newDownloadObj) {
- $newDownload_array = $newDownloadObj->toArray();
- $newDownload_array['rating'] = number_format($newDownload_array['rating'], 2);
- $newDownload_array['title_html'] = $myts->htmlSpecialChars($newDownload_array['title']);
- $newDownload_array['category_title'] = $categories[$newDownload_array['cid']]['title'];
-/*
- $url = urldecode($myts->htmlSpecialChars($newDownload_array['url']));
- $homepage = $myts->htmlSpecialChars($newDownload_array['homepage']);
- $version = $myts->htmlSpecialChars($newDownload_array['version']);
- $size = $myts->htmlSpecialChars($newDownload_array['size']);
- $platform = $myts->htmlSpecialChars($newDownload_array['platform']);
- $logourl = $myts->htmlSpecialChars($newDownload_array['screenshot']); // IN PROGRESS
-*/
+ $newDownload_array = $newDownloadObj->toArray();
+ $newDownload_array['rating'] = number_format($newDownload_array['rating'], 2);
+ $newDownload_array['title_html'] = $myts->htmlSpecialChars($newDownload_array['title']);
+ $newDownload_array['category_title'] = $categories[$newDownload_array['cid']]['title'];
+ /*
+ $url = urldecode($myts->htmlSpecialChars($newDownload_array['url']));
+ $homepage = $myts->htmlSpecialChars($newDownload_array['homepage']);
+ $version = $myts->htmlSpecialChars($newDownload_array['version']);
+ $size = $myts->htmlSpecialChars($newDownload_array['size']);
+ $platform = $myts->htmlSpecialChars($newDownload_array['platform']);
+ $logourl = $myts->htmlSpecialChars($newDownload_array['screenshot']); // IN PROGRESS
+ */
$newDownload_array['submitter_uname'] = XoopsUserUtility::getUnameFromId($newDownload_array['submitter']);
$newDownload_array['date_formatted'] = XoopsLocal::formatTimestamp($newDownload_array['date'], 'l');
$GLOBALS['xoopsTpl']->append('new_downloads', $newDownload_array);
@@ -753,7 +755,7 @@
$criteria->setOrder('ASC');
$criteria->setStart($start_autopublished);
$criteria->setLimit($wfdownloads->getConfig('admin_perpage'));
- $autopublishedDownloadObjs = $wfdownloads->getHandler('download')->getObjects($criteria);
+ $autopublishedDownloadObjs = $wfdownloads->getHandler('download')->getObjects($criteria);
$autopublishedDownloadCount = $wfdownloads->getHandler('download')->getCount($criteria);
$GLOBALS['xoopsTpl']->assign('autopublished_downloads_count', $autopublishedDownloadCount);
if ($autopublishedDownloadCount > 0) {
@@ -766,9 +768,11 @@
$GLOBALS['xoopsTpl']->append('autopublished_downloads', $autopublishedDownload_array);
}
}
- $pagenav = new XoopsPageNav($autopublishedDownloadCount, $wfdownloads->getConfig(
- 'admin_perpage'
- ), $start_autopublished, 'start_autopublished');
+ $pagenav = new XoopsPageNav(
+ $autopublishedDownloadCount, $wfdownloads->getConfig(
+ 'admin_perpage'
+ ), $start_autopublished, 'start_autopublished'
+ );
$GLOBALS['xoopsTpl']->assign('autopublished_downloads_pagenav', $pagenav->renderNav());
// Expired downloads
@@ -779,7 +783,7 @@
$criteria->setOrder('ASC');
$criteria->setStart($start_expired);
$criteria->setLimit($wfdownloads->getConfig('admin_perpage'));
- $expiredDownloadObjs = $wfdownloads->getHandler('download')->getObjects($criteria);
+ $expiredDownloadObjs = $wfdownloads->getHandler('download')->getObjects($criteria);
$expiredDownloadCount = $wfdownloads->getHandler('download')->getCount($criteria);
$GLOBALS['xoopsTpl']->assign('expired_downloads_count', $expiredDownloadCount);
if ($expiredDownloadCount > 0) {
@@ -801,7 +805,7 @@
$criteria->setOrder('ASC');
$criteria->setStart($start_offline);
$criteria->setLimit($wfdownloads->getConfig('admin_perpage'));
- $offlineDownloadObjs = $wfdownloads->getHandler('download')->getObjects($criteria);
+ $offlineDownloadObjs = $wfdownloads->getHandler('download')->getObjects($criteria);
$offlineDownloadCount = $wfdownloads->getHandler('download')->getCount($criteria);
$GLOBALS['xoopsTpl']->assign('offline_downloads_count', $offlineDownloadCount);
if ($offlineDownloadCount > 0) {
@@ -822,19 +826,19 @@
// Batch files
$extensionToMime = include $GLOBALS['xoops']->path('include/mimetypes.inc.php');
- $batchPath = $wfdownloads->getConfig('batchdir');
+ $batchPath = $wfdownloads->getConfig('batchdir');
$GLOBALS['xoopsTpl']->assign('batch_path', $batchPath);
- $batchFiles = wfdownloads_getFiles($batchPath . '/');
+ $batchFiles = wfdownloads_getFiles($batchPath . '/');
$batchFilesCount = count($batchFiles);
$GLOBALS['xoopsTpl']->assign('batch_files_count', $batchFilesCount);
if ($batchFilesCount > 0) {
- foreach($batchFiles as $key => $batchFile) {
- $batchFile_array = array();
- $batchFile_array['id'] = $key;
- $batchFile_array['filename'] = $batchFile;
- $batchFile_array['size'] = wfdownloads_bytesToSize1024(filesize($batchPath . '/' . $batchFile));
+ foreach ($batchFiles as $key => $batchFile) {
+ $batchFile_array = array();
+ $batchFile_array['id'] = $key;
+ $batchFile_array['filename'] = $batchFile;
+ $batchFile_array['size'] = wfdownloads_bytesToSize1024(filesize($batchPath . '/' . $batchFile));
$batchFile_array['extension'] = pathinfo($batchFile, PATHINFO_EXTENSION);
- $batchFile_array['mimetype'] = $extensionToMime[pathinfo($batchFile, PATHINFO_EXTENSION)];
+ $batchFile_array['mimetype'] = $extensionToMime[pathinfo($batchFile, PATHINFO_EXTENSION)];
$GLOBALS['xoopsTpl']->append('batch_files', $batchFile_array);
unset($batchFile_array);
}
@@ -842,15 +846,15 @@
$GLOBALS['xoopsTpl']->display("db:{$wfdownloads->getModule()->dirname()}_am_downloadslist.tpl");
- include_once dirname(__FILE__) . '/admin_footer.php';
+ include_once __DIR__ . '/admin_footer.php';
break;
case 'batchfile.add':
- $batchid = WfdownloadsRequest::getInt('batchid', 0);
+ $batchid = XoopsRequest::getInt('batchid', 0);
$extensionToMime = include $GLOBALS['xoops']->path('include/mimetypes.inc.php');
- $batchPath = $wfdownloads->getConfig('batchdir');
- $batchFiles = wfdownloads_getFiles($batchPath . '/');
+ $batchPath = $wfdownloads->getConfig('batchdir');
+ $batchFiles = wfdownloads_getFiles($batchPath . '/');
if (!isset($batchFiles[$batchid]) || !is_file($batchPath . '/' . $batchFiles[$batchid])) {
redirect_header($currentFile, 4, _AM_WFDOWNLOADS_ERROR_BATCHFILENOTFOUND);
@@ -891,10 +895,10 @@
break;
case 'batchfile.delete':
- $batchid = WfdownloadsRequest::getInt('batchid', 0);
- $ok = WfdownloadsRequest::getBool('ok', false, 'POST');
+ $batchid = XoopsRequest::getInt('batchid', 0);
+ $ok = XoopsRequest::getBool('ok', false, 'POST');
- $batchPath = $wfdownloads->getConfig('batchdir');
+ $batchPath = $wfdownloads->getConfig('batchdir');
$batchFiles = wfdownloads_getFiles($batchPath);
if (!isset($batchFiles[$batchid]) || !is_file($batchPath . '/' . $batchFiles[$batchid])) {
@@ ...
[truncated message content] |