|
From: <luc...@us...> - 2014-09-17 20:13:31
|
Revision: 12789
http://sourceforge.net/p/xoops/svn/12789
Author: luciorota
Date: 2014-09-17 20:13:28 +0000 (Wed, 17 Sep 2014)
Log Message:
-----------
this is my latest version, start from here
Modified Paths:
--------------
XoopsModules/wfdownloads/branches/luciorota/wfdownloads/admin/categories.php
XoopsModules/wfdownloads/branches/luciorota/wfdownloads/admin/downloads.php
XoopsModules/wfdownloads/branches/luciorota/wfdownloads/admin/reportsmodifications.php
XoopsModules/wfdownloads/branches/luciorota/wfdownloads/class/category.php
XoopsModules/wfdownloads/branches/luciorota/wfdownloads/include/search.inc.php
XoopsModules/wfdownloads/branches/luciorota/wfdownloads/sql/mysql.sql
XoopsModules/wfdownloads/branches/luciorota/wfdownloads/xoops_version.php
Modified: XoopsModules/wfdownloads/branches/luciorota/wfdownloads/admin/categories.php
===================================================================
--- XoopsModules/wfdownloads/branches/luciorota/wfdownloads/admin/categories.php 2014-09-17 13:55:08 UTC (rev 12788)
+++ XoopsModules/wfdownloads/branches/luciorota/wfdownloads/admin/categories.php 2014-09-17 20:13:28 UTC (rev 12789)
@@ -56,17 +56,17 @@
$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'));
+ $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_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\'"');
+ $butt_cancel->setExtra('onclick="this.form.elements.op.value=\'cancel\'"');
$create_tray -> addElement($butt_cancel);
- $sform -> addElement($create_tray);
- $sform -> display();
+ $sform->addElement($create_tray);
+ $sform->display();
xoops_cp_footer();
} else {
$source = WfdownloadsRequest::getInt('source', 0, 'POST');
@@ -77,7 +77,7 @@
if (!$target) {
redirect_header($currentFile . "?op=category.move&ok=0&cid={$source}", 5, _AM_WFDOWNLOADS_CCATEGORY_MODIFY_FAILEDT);
}
- $result = $wfdownloads->getHandler('download')->updateAll("cid", $target, new Criteria("cid", $source), true);
+ $result = $wfdownloads->getHandler('download')->updateAll('cid', $target, new Criteria('cid', $source), true);
if (!$result) {
$error = _AM_WFDOWNLOADS_DBERROR;
trigger_error($error, E_USER_ERROR);
@@ -91,26 +91,26 @@
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;
+ $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;
- $imgurl = 'blank.png';
- include_once XOOPS_ROOT_PATH.'/class/uploader.php';
+ 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');
+ $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();
}
@@ -152,15 +152,17 @@
echo $categoryObj->getHtmlErrors();
}
if (!$cid) {
- $newid = (int) $categoryObj->getVar('cid');
+ if ($cid == 0) {
+ $newid = (int) $categoryObj->getVar('cid');
+ }
wfdownloads_savePermissions($down_groups, $newid, 'WFDownCatPerm');
wfdownloads_savePermissions($up_groups, $newid, 'WFUpCatPerm');
// Notify of new category
$tags = array();
$tags['CATEGORY_NAME'] = $_POST['title'];
$tags['CATEGORY_URL'] = WFDOWNLOADS_URL . '/viewcat.php?cid=' . $newid;
- $notification_handler = & xoops_gethandler('notification');
- $notification_handler -> triggerEvent('global', 0, 'new_category', $tags);
+ $notification_handler = xoops_gethandler('notification');
+ $notification_handler->triggerEvent('global', 0, 'new_category', $tags);
$database_mess = _AM_WFDOWNLOADS_CCATEGORY_CREATED;
} else {
$database_mess = _AM_WFDOWNLOADS_CCATEGORY_MODIFIED;
@@ -179,7 +181,6 @@
if ($ok == true) {
// get all subcategories under the specified category
$childCategoryObjs = $categoryObjsTree->getAllChild($cid);
- $cids = array();
foreach ($childCategoryObjs as $childCategoryObj) {
// get all category ids
$cids[] = $childCategoryObj->getVar('cid');
@@ -238,7 +239,7 @@
$form = $categoryObj->getForm();
$form -> display();
- include 'admin_footer.php';
+ include_once dirname(__FILE__) . '/admin_footer.php';
break;
case 'categories.list':
@@ -261,7 +262,7 @@
} else {
redirect_header("{$currentFile}?op=category.add", 1, _AM_WFDOWNLOADS_CCATEGORY_NOEXISTS);
}
- include 'admin_footer.php';
+ include_once dirname(__FILE__) . '/admin_footer.php';
break;
case 'categories.reorder':
Modified: XoopsModules/wfdownloads/branches/luciorota/wfdownloads/admin/downloads.php
===================================================================
--- XoopsModules/wfdownloads/branches/luciorota/wfdownloads/admin/downloads.php 2014-09-17 13:55:08 UTC (rev 12788)
+++ XoopsModules/wfdownloads/branches/luciorota/wfdownloads/admin/downloads.php 2014-09-17 20:13:28 UTC (rev 12789)
@@ -41,9 +41,9 @@
$op = WfdownloadsRequest::getString('op', 'downloads.list');
switch ($op) {
- case "download.edit" :
- case "download.add" :
- case "Download" :
+ case 'download.edit':
+ case 'download.add':
+ case 'Download':
wfdownloads_xoops_cp_header();
$indexAdmin = new ModuleAdmin();
echo $indexAdmin->addNavigation($currentFile);
@@ -59,8 +59,8 @@
// 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";
@@ -83,7 +83,7 @@
} else {
// create download
$downloadObj = $wfdownloads->getHandler('download')->create();
- $cid = WfdownloadsRequest::getInt('cid', 0, 'POST');
+ $cid = WfdownloadsRequest::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);
@@ -97,15 +97,15 @@
$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;
+ include_once XOOPS_ROOT_PATH . '/modules/formulize/include/formdisplay.php';
+ include_once XOOPS_ROOT_PATH . '/modules/formulize/include/functions.php';
+ $customArray['fid'] = $fid;
$customArray['formulize_mgr'] = xoops_getmodulehandler('elements', 'formulize');
- $customArray['groups'] = $xoopsUser ? $xoopsUser->getGroups() : array(0 => XOOPS_GROUP_ANONYMOUS);
- $customArray['prevEntry'] = getEntryValues( // is a Formulize function
+ $customArray['groups'] = $xoopsUser ? $xoopsUser->getGroups() : array(0 => XOOPS_GROUP_ANONYMOUS);
+ $customArray['prevEntry'] = getEntryValues( // is a Formulize function
$downloadObj->getVar('formulize_idreq'),
$customArray['formulize_mgr'],
$customArray['groups'],
@@ -117,14 +117,14 @@
null
);
$customArray['entry'] = $downloadObj->getVar('formulize_idreq');
- $customArray['go_back'] = "";
- $customArray['parentLinks'] = "";
+ $customArray['go_back'] = '';
+ $customArray['parentLinks'] = '';
if (wfdownloads_checkModule('formulize') < 300) {
$owner = getEntryOwner($customArray['entry']); // is a Formulize function
} 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);
@@ -141,29 +141,29 @@
// Vote data list/manager
if ($lid) {
- $votes_count = $wfdownloads->getHandler('rating')->getCount();
+ $ratingCount = $wfdownloads->getHandler('rating')->getCount();
- $registeredCriteria = new CriteriaCompo(new Criteria('lid', $lid));
- $registeredCriteria->add(new Criteria('ratinguser', 0, '>'));
- $votesreg = $wfdownloads->getHandler('rating')->getCount($registeredCriteria);
- $registeredCriteria->setSort('ratingtimestamp');
- $registeredCriteria->setOrder('DESC');
- $regvotes = $wfdownloads->getHandler('rating')->getObjects($registeredCriteria);
+ $regUserCriteria = new CriteriaCompo(new Criteria('lid', $lid));
+ $regUserCriteria->add(new Criteria('ratinguser', 0, '>'));
+ $regUserRatingCount = $wfdownloads->getHandler('rating')->getCount($regUserCriteria);
+ $regUserCriteria->setSort('ratingtimestamp');
+ $regUserCriteria->setOrder('DESC');
+ $regUserRatingObjs = $wfdownloads->getHandler('rating')->getObjects($regUserCriteria);
- $anonymousCriteria = new CriteriaCompo(new Criteria('lid', $lid));
- $anonymousCriteria->add(new Criteria('ratinguser', 0, '='));
- $votesanon = $wfdownloads->getHandler('rating')->getCount($anonymousCriteria);
- $anonymousCriteria->setSort('ratingtimestamp');
- $anonymousCriteria->setOrder('DESC');
+ $anonUserCriteria = new CriteriaCompo(new Criteria('lid', $lid));
+ $anonUserCriteria->add(new Criteria('ratinguser', 0, '='));
+ $anonUserRatingCount = $wfdownloads->getHandler('rating')->getCount($anonUserCriteria);
+ $anonUserCriteria->setSort('ratingtimestamp');
+ $anonUserCriteria->setOrder('DESC');
echo "<fieldset><legend style='font-weight: bold; color: #900;'>" . _AM_WFDOWNLOADS_VOTE_RATINGINFOMATION . "</legend>\n";
- echo "<div style='padding: 8px;'><b>" . _AM_WFDOWNLOADS_VOTE_TOTALVOTES . "</b>{$votes_count}<br /><br />\n";
+ echo "<div style='padding: 8px;'><b>" . _AM_WFDOWNLOADS_VOTE_TOTALVOTES . "</b>{$ratingCount}<br /><br />\n";
- printf(_AM_WFDOWNLOADS_VOTE_REGUSERVOTES, $votesreg);
+ printf(_AM_WFDOWNLOADS_VOTE_REGUSERVOTES, $regUserRatingCount);
echo "<br />";
- printf(_AM_WFDOWNLOADS_VOTE_ANONUSERVOTES, $votesanon);
+ printf(_AM_WFDOWNLOADS_VOTE_ANONUSERVOTES, $anonUserRatingCount);
echo "
</div>\n
@@ -179,37 +179,32 @@
</tr>\n
";
- if ($votesreg == 0) {
+ if ($regUserRatingCount == 0) {
echo "<tr><td colspan='7' class='even'><b>" . _AM_WFDOWNLOADS_VOTE_NOREGVOTES . "</b></td></tr>";
} else {
- $uids = array();
- foreach (array_keys($regvotes) as $i) {
- $uids[] = $regvotes[$i]->getVar('ratinguser');
+ foreach ($regUserRatingObjs as $regUserRatingObj) {
+ $uids[] = $regUserRatingObj->getVar('ratinguser');
}
- $criteria = new Criteria("ratinguser", "(" . implode(',', $uids) . ")", "IN");
- $criteria->setGroupby("ratinguser");
+ $criteria = new Criteria('ratinguser', '(' . implode(',', $uids) . ')', 'IN');
+ $criteria->setGroupby('ratinguser');
$userRatings = $wfdownloads->getHandler('rating')->getUserAverage($criteria);
- foreach (array_keys($regvotes) as $i) {
- $formatted_date = XoopsLocal::formatTimestamp($regvotes[$i]->getVar('ratingtimestamp'), 'l');
- $userAvgRating = isset($userRatings[$regvotes[$i]->getVar('ratinguser')]) ? $userRatings[$regvotes[$i]->getVar(
- 'ratinguser'
- )]["avg"] : 0;
- $userVotes = isset($userRatings[$regvotes[$i]->getVar('ratinguser')]) ? $userRatings[$regvotes[$i]->getVar(
- 'ratinguser'
- )]["count"] : 0;
- $ratingUserName = XoopsUser :: getUnameFromId($regvotes[$i]->getVar('ratinguser'));
+ 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'));
echo "
<tr><td class='head'>$ratingUserName</td>\n
- <td class='even'>" . $regvotes[$i]->getVar('ratinghostname') . "</th>\n
- <td class='even'>" . $regvotes[$i]->getVar('rating') . "</th>\n
+ <td class='even'>" . $regUserRatingObj->getVar('ratinghostname') . "</th>\n
+ <td class='even'>" . $regUserRatingObj->getVar('rating') . "</th>\n
<td class='even'>$userAvgRating</th>\n
<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=" . $regvotes[$i]->getVar('ratingid') . "'>"
+ <a href='{$currentFile}?op=vote.delete&lid={$lid}&rid=" . $regUserRatingObj->getVar('ratingid') . "'>"
. $imagearray['deleteimg'] . "</a>\n
</th></tr>\n
";
@@ -229,29 +224,29 @@
<th>" . _AM_WFDOWNLOADS_MINDEX_ACTION . "</td>\n
</tr>\n
";
- if ($votesanon == 0) {
+ 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);
- $anonymousVotes = $wfdownloads->getHandler('rating')->getObjects($anonymousCriteria);
+ $criteria = new Criteria('ratinguser', 0);
+ $userRatings = $wfdownloads->getHandler('rating')->getUserAverage($criteria);
+ $anonUserRatingObjs = $wfdownloads->getHandler('rating')->getObjects($anonUserCriteria);
- foreach (array_keys($anonymousVotes) as $i) {
- $formatted_date = XoopsLocal::formatTimestamp($anonymousVotes[$i]->getVar('ratingtimestamp'), 'l');
- $userAvgRating = isset($userRatings['avg']) ? $userRatings["avg"] : 0;
- $userVotes = isset($userRatings['count']) ? $userRatings["count"] : 0;
+ 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;
$ratingUserName = $GLOBALS['xoopsConfig']['anonymous'];
echo "
<tr><td class='head'>$ratingUserName</td>\n
- <td class='even'>" . $anonymousVotes[$i]->getVar('ratinghostname') . "</th>\n
- <td class='even'>" . $anonymousVotes[$i]->getVar('rating') . "</th>\n
+ <td class='even'>" . $anonUserRatingObj->getVar('ratinghostname') . "</th>\n
+ <td class='even'>" . $anonUserRatingObj->getVar('rating') . "</th>\n
<td class='even'>$userAvgRating</th>\n
<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=" . $anonymousVotes[$i]->getVar('ratingid') . "'>"
+ <a href='{$currentFile}?op=vote.delete&lid={$lid}&rid=" . $anonUserRatingObj->getVar('ratingid') . "'>"
. $imagearray['deleteimg'] . "</a>\n
</th></tr>\n
";
@@ -260,32 +255,32 @@
echo "</table>\n";
echo "</fieldset>\n";
}
- include 'admin_footer.php';
+ include_once dirname(__FILE__) . '/admin_footer.php';
break;
- case "download.save" :
- case "addDownload" :
- $lid = WfdownloadsRequest::getInt('lid', 0, 'POST');
- $cid = WfdownloadsRequest::getInt('cid', 0, 'POST');
+ 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');
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'] : '';
+ if ($_POST['url'] && $_POST['url'] != '' && $_POST['url'] != "http://") {
+ $url = ($_POST['url'] != "http://") ? $_POST['url'] : '';
$filename = '';
$filetype = '';
// Get size from form
$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;
@@ -296,12 +291,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']);
@@ -330,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}";
@@ -380,12 +375,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;
}
@@ -401,7 +396,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;
@@ -409,7 +404,7 @@
$publishdate = time();
} else {
$publishdate = $_POST['was_published'];
- $expiredate = $_POST['was_expired'];
+ $expiredate = $_POST['was_expired'];
}
if ($approved == 1 && empty($publishdate)) {
$publishdate = time();
@@ -441,8 +436,8 @@
if (wfdownloads_checkModule('formulize')) {
$fid = $categoryObj->getVar('formulize_fid');
if ($fid) {
- include_once XOOPS_ROOT_PATH . "/modules/formulize/include/formread.php";
- include_once XOOPS_ROOT_PATH . "/modules/formulize/include/functions.php";
+ include_once XOOPS_ROOT_PATH . '/modules/formulize/include/formread.php';
+ include_once XOOPS_ROOT_PATH . '/modules/formulize/include/functions.php';
$formulize_mgr =& xoops_getmodulehandler('elements', 'formulize');
if ($lid) {
$entries[$fid][0] = $downloadObj->getVar('formulize_idreq');
@@ -453,19 +448,19 @@
$owner = getEntryOwner($entries[$fid][0], $fid); // is a Formulize function
}
} else {
- print "no idreq";
- $entries[$fid][0] = "";
- $owner = "";
+ print 'no idreq';
+ $entries[$fid][0] = '';
+ $owner = '';
}
$cid = $downloadObj->getVar('cid');
} else {
- $entries[$fid][0] = "";
- $owner = "";
+ $entries[$fid][0] = '';
+ $owner = '';
}
- $ownerGroups =& $member_handler->getGroupsByUser($owner, false);
- $uid = !empty($xoopsUser) ? $xoopsUser->getVar('uid') : 0;
- $groups = $xoopsUser ? $xoopsUser->getGroups() : array(0 => XOOPS_GROUP_ANONYMOUS);
- $entries = handleSubmission(
+ $ownerGroups = $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,
@@ -473,7 +468,7 @@
$fid,
$ownerGroups,
$groups,
- "new"
+ 'new'
); // "new" causes xoops token check to be skipped, since Wfdownloads should be doing that
if (!$owner) {
$id_req = $entries[$fid][0];
@@ -486,21 +481,21 @@
$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);
@@ -511,9 +506,9 @@
redirect_header($currentFile, 1, $message);
break;
- case "download.delete" :
+ case 'download.delete':
$lid = WfdownloadsRequest::getInt('lid', 0);
- $ok = WfdownloadsRequest::getBool('ok', false, 'POST');
+ $ok = WfdownloadsRequest::getBool('ok', false, 'POST');
if (!$downloadObj = $wfdownloads->getHandler('download')->get($lid)) {
redirect_header($currentFile, 4, _AM_WFDOWNLOADS_ERROR_DOWNLOADNOTFOUND);
exit();
@@ -545,17 +540,17 @@
}
break;
- case "vote.delete" :
- case "delVote" :
- $rating = $wfdownloads->getHandler('rating')->get($_GET['rid']);
- if ($wfdownloads->getHandler('rating')->delete($rating, true)) {
- wfdownloads_updateRating(intval($rating->getVar('lid')));
+ case 'vote.delete':
+ case 'delVote':
+ $ratingObj = $wfdownloads->getHandler('rating')->get($_GET['rid']);
+ if ($wfdownloads->getHandler('rating')->delete($ratingObj, true)) {
+ wfdownloads_updateRating((int) $ratingObj->getVar('lid'));
}
redirect_header($currentFile, 1, _AM_WFDOWNLOADS_VOTE_VOTEDELETED);
break;
// Formulize module support (2006/05/04) jpc - start
- case "patch_formulize" :
+ case 'patch_formulize':
if (wfdownloads_checkModule('formulize')) {
if (!isset($_POST['patch_formulize'])) {
print "<form action=\"{$currentFile}?op=patch_formulize\" method=post>";
@@ -577,8 +572,8 @@
break;
// Formulize module support (2006/05/04) jpc - end
- case "newdownload.approve" :
- case "approve" :
+ case 'newdownload.approve':
+ case 'approve':
$lid = WfdownloadsRequest::getInt('lid', 0);
if (!$downloadObj = $wfdownloads->getHandler('download')->get($lid)) {
redirect_header($currentFile, 4, _AM_WFDOWNLOADS_ERROR_DOWNLOADNOTFOUND);
@@ -592,14 +587,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,17 +603,18 @@
redirect_header($currentFile, 1, _AM_WFDOWNLOADS_SUB_NEWFILECREATED);
break;
- case "downloads.list" :
- case "downloads.filter" :
+ case 'downloads.list':
+ case 'downloads.filter':
default :
- $filter_title_condition = WfdownloadsRequest::getString('filter_title_condition', '=');
- $filter_title = WfdownloadsRequest::getString('filter_title', '');
+ // 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_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', '<');
+ // check filter conditions
if ($op == 'downloads.filter') {
if ($filter_title == '' && $filter_category_title == '' && is_null($filter_submitter)) {
$op = 'downloads.list';
@@ -627,16 +623,16 @@
include_once XOOPS_ROOT_PATH . '/class/pagenav.php';
- $categories = $wfdownloads->getHandler('category')->getObjects();
+ $categoryObjs = $wfdownloads->getHandler('category')->getObjects();
- $start_published = WfdownloadsRequest::getInt('start_published', 0);
- $start_new = WfdownloadsRequest::getInt('start_new', 0);
+ $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_expired = WfdownloadsRequest::getInt('start_expired', 0);
+ $start_offline = WfdownloadsRequest::getInt('start_offline', 0);
$totalCategoriesCount = wfdownloads_categoriesCount();
- $categories = $wfdownloads->getHandler('category')->getObjects(null, true, false);
+ $categoryObjs = $wfdownloads->getHandler('category')->getObjects(null, true, false);
$totalDownloadsCount = $wfdownloads->getHandler('download')->getCount();
@@ -684,13 +680,13 @@
$criteria->setOrder('DESC');
$criteria->setStart($start_published);
$criteria->setLimit($wfdownloads->getConfig('admin_perpage'));
- $publishedDownloads = $wfdownloads->getHandler('download')->getActiveDownloads($criteria);
- $publishedDownloadsCount = $wfdownloads->getHandler('download')->getActiveCount();
- $GLOBALS['xoopsTpl']->assign('published_downloads_count', $publishedDownloadsCount);
+ $publishedDownloadObjs = $wfdownloads->getHandler('download')->getActiveDownloads($criteria);
+ $publishedDownloadCount = $wfdownloads->getHandler('download')->getActiveCount();
+ $GLOBALS['xoopsTpl']->assign('published_downloads_count', $publishedDownloadCount);
- if ($publishedDownloadsCount > 0) {
- foreach ($publishedDownloads as $publishedDownload) {
- $publishedDownload_array = $publishedDownload->toArray();
+ if ($publishedDownloadCount > 0) {
+ foreach ($publishedDownloadObjs as $publishedDownloadObj) {
+ $publishedDownload_array = $publishedDownloadObj->toArray();
$publishedDownload_array['title_html'] = $myts->htmlSpecialChars(trim($publishedDownload_array['title']));
$publishedDownload_array['category_title'] = $categories[$publishedDownload_array['cid']]['title'];
$publishedDownload_array['submitter_uname'] = XoopsUserUtility::getUnameFromId($publishedDownload_array['submitter']);
@@ -724,12 +720,12 @@
$criteria->add(new Criteria('published', 0));
$criteria->setStart($start_new);
$criteria->setLimit($wfdownloads->getConfig('admin_perpage'));
- $newDownloads = $wfdownloads->getHandler('download')->getObjects($criteria);
- $newDownloadsCount = $wfdownloads->getHandler('download')->getCount($criteria);
- $GLOBALS['xoopsTpl']->assign('new_downloads_count', $newDownloadsCount);
- if ($newDownloadsCount > 0) {
- foreach ($newDownloads as $newDownload) {
- $newDownload_array = $newDownload->toArray();
+ $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'];
@@ -744,7 +740,7 @@
$GLOBALS['xoopsTpl']->append('new_downloads', $newDownload_array);
}
}
- $pagenav = new XoopsPageNav($newDownloadsCount, $wfdownloads->getConfig('admin_perpage'), $start_new, 'start_new');
+ $pagenav = new XoopsPageNav($newDownloadCount, $wfdownloads->getConfig('admin_perpage'), $start_new, 'start_new');
$GLOBALS['xoopsTpl']->assign('new_downloads_pagenav', $pagenav->renderNav());
// Autopublished Downloads
@@ -754,12 +750,12 @@
$criteria->setOrder("ASC");
$criteria->setStart($start_autopublished);
$criteria->setLimit($wfdownloads->getConfig('admin_perpage'));
- $autopublishedDownloads = $wfdownloads->getHandler('download')->getObjects($criteria);
- $autopublishedDownloadsCount = $wfdownloads->getHandler('download')->getCount($criteria);
- $GLOBALS['xoopsTpl']->assign('autopublished_downloads_count', $autopublishedDownloadsCount);
- if ($autopublishedDownloadsCount > 0) {
- foreach ($autopublishedDownloads as $autopublishedDownload) {
- $autopublishedDownload_array = $autopublishedDownload->toArray();
+ $autopublishedDownloadObjs = $wfdownloads->getHandler('download')->getObjects($criteria);
+ $autopublishedDownloadCount = $wfdownloads->getHandler('download')->getCount($criteria);
+ $GLOBALS['xoopsTpl']->assign('autopublished_downloads_count', $autopublishedDownloadCount);
+ if ($autopublishedDownloadCount > 0) {
+ foreach ($autopublishedDownloadObjs as $autopublishedDownloadObj) {
+ $autopublishedDownload_array = $autopublishedDownloadObj->toArray();
$autopublishedDownload_array['title_html'] = $myts->htmlSpecialChars(trim($autopublishedDownload_array['title']));
$autopublishedDownload_array['category_title'] = $categories[$autopublishedDownload_array['cid']]['title'];
$autopublishedDownload_array['submitter_uname'] = XoopsUserUtility::getUnameFromId($autopublishedDownload_array['submitter']);
@@ -767,7 +763,7 @@
$GLOBALS['xoopsTpl']->append('autopublished_downloads', $autopublishedDownload_array);
}
}
- $pagenav = new XoopsPageNav($autopublishedDownloadsCount, $wfdownloads->getConfig(
+ $pagenav = new XoopsPageNav($autopublishedDownloadCount, $wfdownloads->getConfig(
'admin_perpage'
), $start_autopublished, 'start_autopublished');
$GLOBALS['xoopsTpl']->assign('autopublished_downloads_pagenav', $pagenav->renderNav());
@@ -780,12 +776,12 @@
$criteria->setOrder('ASC');
$criteria->setStart($start_expired);
$criteria->setLimit($wfdownloads->getConfig('admin_perpage'));
- $expired_downloads = $wfdownloads->getHandler('download')->getObjects($criteria);
- $expiredDownloadsCount = $wfdownloads->getHandler('download')->getCount($criteria);
- $GLOBALS['xoopsTpl']->assign('expired_downloads_count', $expiredDownloadsCount);
- if ($expiredDownloadsCount > 0) {
- foreach ($expired_downloads as $expired_download) {
- $expired_download_array = $expired_download->toArray();
+ $expiredDownloadObjs = $wfdownloads->getHandler('download')->getObjects($criteria);
+ $expiredDownloadCount = $wfdownloads->getHandler('download')->getCount($criteria);
+ $GLOBALS['xoopsTpl']->assign('expired_downloads_count', $expiredDownloadCount);
+ if ($expiredDownloadCount > 0) {
+ foreach ($expiredDownloadObjs as $expiredDownloadObj) {
+ $expired_download_array = $expiredDownloadObj->toArray();
$expired_download_array['title_html'] = $myts->htmlSpecialChars(trim($expired_download_array['title']));
$expired_download_array['category_title'] = $categories[$expired_download_array['cid']]['title'];
$expired_download_array['submitter_uname'] = XoopsUserUtility::getUnameFromId($expired_download_array['submitter']);
@@ -793,7 +789,7 @@
$GLOBALS['xoopsTpl']->append('expired_downloads', $expired_download_array);
}
}
- $pagenav = new XoopsPageNav($expiredDownloadsCount, $wfdownloads->getConfig('admin_perpage'), $start_expired, 'start_expired');
+ $pagenav = new XoopsPageNav($expiredDownloadCount, $wfdownloads->getConfig('admin_perpage'), $start_expired, 'start_expired');
$GLOBALS['xoopsTpl']->assign('expired_downloads_pagenav', $pagenav->renderNav());
// Offline downloads
@@ -802,13 +798,12 @@
$criteria->setOrder('ASC');
$criteria->setStart($start_offline);
$criteria->setLimit($wfdownloads->getConfig('admin_perpage'));
- $offlineDownloadsCount = $wfdownloads->getHandler('download')->getCount($criteria);
- $offlineDownloads = $wfdownloads->getHandler('download')->getObjects($criteria);
- $offlineDownloadsCount = $wfdownloads->getHandler('download')->getCount($criteria);
- $GLOBALS['xoopsTpl']->assign('offline_downloads_count', $offlineDownloadsCount);
- if ($offlineDownloadsCount > 0) {
- foreach ($offlineDownloads as $offlineDownload) {
- $offlineDownload_array = $offlineDownload->toArray();
+ $offlineDownloadObjs = $wfdownloads->getHandler('download')->getObjects($criteria);
+ $offlineDownloadCount = $wfdownloads->getHandler('download')->getCount($criteria);
+ $GLOBALS['xoopsTpl']->assign('offline_downloads_count', $offlineDownloadCount);
+ if ($offlineDownloadCount > 0) {
+ foreach ($offlineDownloadObjs as $offlineDownloadObj) {
+ $offlineDownload_array = $offlineDownloadObj->toArray();
$offlineDownload_array['title_html'] = $myts->htmlSpecialChars(trim($offlineDownload_array['title']));
$offlineDownload_array['category_title'] = $categories[$offlineDownload_array['cid']]['title'];
$offlineDownload_array['submitter_uname'] = XoopsUserUtility::getUnameFromId($offlineDownload_array['submitter']);
@@ -816,7 +811,7 @@
$GLOBALS['xoopsTpl']->append('offline_downloads', $offlineDownload_array);
}
}
- $pagenav = new XoopsPageNav($offlineDownloadsCount, $wfdownloads->getConfig('admin_perpage'), $start_offline, 'start_offline');
+ $pagenav = new XoopsPageNav($offlineDownloadCount, $wfdownloads->getConfig('admin_perpage'), $start_offline, 'start_offline');
$GLOBALS['xoopsTpl']->assign('offline_downloads_pagenav', $pagenav->renderNav());
} else {
// NOP
@@ -844,10 +839,10 @@
$GLOBALS['xoopsTpl']->display("db:{$wfdownloads->getModule()->dirname()}_am_downloadslist.tpl");
- include 'admin_footer.php';
+ include_once dirname(__FILE__) . '/admin_footer.php';
break;
- case "batchfile.add" :
+ case 'batchfile.add':
$batchid = WfdownloadsRequest::getInt('batchid', 0);
$extensionToMime = include $GLOBALS['xoops']->path('include/mimetypes.inc.php');
@@ -874,7 +869,6 @@
$downloadObj->setVar('filename', $savedFileName);
$downloadObj->setVar('size', filesize($wfdownloads->getConfig('uploaddir') . '/' . $savedFileName));
$downloadObj->setVar('filetype', $extensionToMime[pathinfo($batchFile, PATHINFO_EXTENSION)]);
-
$downloadObj->setVar('version', 0);
$downloadObj->setVar('status', _WFDOWNLOADS_STATUS_APPROVED); // IN PROGRESS
$downloadObj->setVar('published', time());
@@ -893,7 +887,7 @@
redirect_header("{$currentFile}?op=download.edit&lid={$newid}", 3, _AM_WFDOWNLOADS_BATCHFILE_MOVEDEDITNOW);
break;
- case "batchfile.delete" :
+ case 'batchfile.delete':
$batchid = WfdownloadsRequest::getInt('batchid', 0);
$ok = WfdownloadsRequest::getBool('ok', false, 'POST');
@@ -923,7 +917,7 @@
}
break;
- case "ip_logs.list" :
+ case 'ip_logs.list':
$lid = WfdownloadsRequest::getInt('lid', 0);
if (!$lid) {
header('Location index.php');
@@ -944,15 +938,15 @@
}
$criteria->setSort('date');
$criteria->setOrder('DESC');
- $ip_logObjs = $wfdownloads->getHandler('ip_log')->getObjects($criteria);
- $ip_logs_count = $wfdownloads->getHandler('ip_log')->getCount($criteria);
- $GLOBALS['xoopsTpl']->assign('ip_logs_count', $ip_logs_count);
+ $ip_logObjs = $wfdownloads->getHandler('ip_log')->getObjects($criteria);
+ $ip_logCount = $wfdownloads->getHandler('ip_log')->getCount($criteria);
+ $GLOBALS['xoopsTpl']->assign('ip_logs_count', $ip_logCount);
unset($criteria);
// Get download info
if ($lid != 0) {
- $downloadObj = $wfdownloads->getHandler('download')->get($lid);
- $download_array = $downloadObj->toArray();
+ $downloadObj = $wfdownloads->getHandler('download')->get($lid);
+ $download_array = $downloadObj->toArray();
$download_array['log_title'] = sprintf(_AM_WFDOWNLOADS_LOG_FOR_LID, $download_array['title']);
$GLOBALS['xoopsTpl']->assign('download', $download_array);
}
@@ -973,8 +967,8 @@
// NOP
} else {
foreach ($ip_logObjs as $ip_logObj) {
- $ip_log_array = $ip_logObj->toArray();
- $ip_log_array['uname'] = XoopsUserUtility::getUnameFromId(
+ $ip_log_array = $ip_logObj->toArray();
+ $ip_log_array['uname'] = XoopsUserUtility::getUnameFromId(
$ip_log_array['uid']
);
//($ip_log_array['uid'] != 0) ? $userList[$ip_log_array['uid']] : _AM_WFDOWNLOADS_ANONYMOUS;
@@ -985,6 +979,6 @@
$GLOBALS['xoopsTpl']->display("db:{$wfdownloads->getModule()->dirname()}_am_ip_logslist.tpl");
- include 'admin_footer.php';
+ include_once dirname(__FILE__) . '/admin_footer.php';
break;
}
Modified: XoopsModules/wfdownloads/branches/luciorota/wfdownloads/admin/reportsmodifications.php
===================================================================
--- XoopsModules/wfdownloads/branches/luciorota/wfdownloads/admin/reportsmodifications.php 2014-09-17 13:55:08 UTC (rev 12788)
+++ XoopsModules/wfdownloads/branches/luciorota/wfdownloads/admin/reportsmodifications.php 2014-09-17 20:13:28 UTC (rev 12789)
@@ -23,26 +23,26 @@
$op = WfdownloadsRequest::getString('op', 'reports.modifications.list');
switch ($op) {
- case "reports.update" :
- $lid = WfdownloadsRequest::getInt('lid', 0);
+ case 'reports.update':
+ $lid = WfdownloadsRequest::getInt('lid', 0);
$criteria = new Criteria('lid', $lid);
if (isset($_GET['ack'])) {
$acknowledged = (isset($_GET['ack']) && $_GET['ack'] == 0) ? 1 : 0;
- $wfdownloads->getHandler('report')->updateAll("acknowledged", $acknowledged, $criteria, true);
+ $wfdownloads->getHandler('report')->updateAll('acknowledged', $acknowledged, $criteria, true);
$update_mess = _AM_WFDOWNLOADS_BROKEN_NOWACK;
}
if (isset($_GET['con'])) {
$confirmed = (isset($_GET['con']) && $_GET['con'] == 0) ? 1 : 0;
- $wfdownloads->getHandler('report')->updateAll("confirmed", $confirmed, $criteria, true);
+ $wfdownloads->getHandler('report')->updateAll('confirmed', $confirmed, $criteria, true);
$update_mess = _AM_WFDOWNLOADS_BROKEN_NOWCON;
}
redirect_header($currentFile, 1, $update_mess);
break;
- case "report.delete" :
- $lid = WfdownloadsRequest::getInt('lid', 0);
+ case 'report.delete':
+ $lid = WfdownloadsRequest::getInt('lid', 0);
$criteria = new Criteria('lid', $lid);
- $reportObjs = $wfdownloads->getHandler('report')->getObjects($criteria);
+ $reportObjs = $wfdownloads->getHandler('report')->getObjects($criteria);
if (isset($reportObjs[0])) {
$wfdownloads->getHandler('report')->delete($reportObjs[0], true);
}
@@ -51,31 +51,31 @@
redirect_header($currentFile, 1, _AM_WFDOWNLOADS_BROKENFILEDELETED);
break;
- case "report.ignore" :
- $lid = WfdownloadsRequest::getInt('lid', 0);
+ case 'report.ignore':
+ $lid = WfdownloadsRequest::getInt('lid', 0);
$criteria = new Criteria('lid', $lid);
- $reportObjs = $wfdownloads->getHandler('report')->getObjects($criteria);
+ $reportObjs = $wfdownloads->getHandler('report')->getObjects($criteria);
if (isset($reportObjs[0])) {
$wfdownloads->getHandler('report')->delete($reportObjs[0], true);
}
redirect_header($currentFile, 1, _AM_WFDOWNLOADS_BROKEN_FILEIGNORED);
break;
- case "modification.show":
+ case 'modification.show':
$requestid = WfdownloadsRequest::getInt('requestid', 0);
- $modificationObj = $wfdownloads->getHandler('modification')->get($requestid);
- $modify_user = new XoopsUser($modificationObj->getVar('modifysubmitter'));
- $modifyname = XoopsUserUtility::getUnameFromId((int) $modify_user->getVar('uid'));
- $modifyemail = $modify_user->getVar('email');
+ $modificationObj = $wfdownloads->getHandler('modification')->get($requestid);
+ $modify_user = new XoopsUser($modificationObj->getVar('modifysubmitter'));
+ $modifyname = XoopsUserUtility::getUnameFromId((int) $modify_user->getVar('uid'));
+ $modifyemail = $modify_user->getVar('email');
- $downloadObj = $wfdownloads->getHandler('download')->get($modificationObj->getVar('lid'));
- $orig_user = new XoopsUser($downloadObj->getVar('submitter'));
+ $downloadObj = $wfdownloads->getHandler('download')->get($modificationObj->getVar('lid'));
+ $orig_user = new XoopsUser($downloadObj->getVar('submitter'));
$submittername = XoopsUserUtility::getUnameFromId($downloadObj->getVar('submitter')); // $orig_user->getvar("uname");
$submitteremail = $orig_user->getVar('email');
- $categories = $wfdownloads->getHandler('category')->getObjects();
- $categoryObjsTree = new XoopsObjectTree($categories, 'cid', 'pid');
+ $categoryObjs = $wfdownloads->getHandler('category')->getObjects();
+ $categoryObjsTree = new XoopsObjectTree($categoryObjs, 'cid', 'pid');
wfdownloads_xoops_cp_header();
@@ -93,8 +93,8 @@
$downloadVars = $downloadObj->getVars();
$downloadKeys = array_keys($downloadVars);
// Get modification keys
- $modificationVars = $modificationObj->getVars();
- $modificationKeys = array_keys($modificationVars);
+ $modificationVars = $modificationObj->getVars();
+ $modificationKeys = array_keys($modificationVars);
// Get common keys
$commonKeys = array_intersect($downloadKeys, $modificationKeys);
// Set not allowed keys
@@ -108,61 +108,61 @@
if (in_array($key, $notAllowedKeys)) {
continue;
}
- $caption = constant("_AM_WFDOWNLOADS_MOD_" . strtoupper($key));
+ $caption = constant('_AM_WFDOWNLOADS_MOD_' . strtoupper($key));
$downloadContent = $downloadObj->getVar($key);
$modificationContent = $modificationObj->getVar($key);
// Extra jobs for some keys
switch ($key) {
- case "title" :
- case "url" :
+ case 'title':
+ case 'url':
// NOP
break;
- case "size" :
+ case 'size':
$downloadContent = wfdownloads_bytesToSize1024($downloadContent);
//
$modificationContent = wfdownloads_bytesToSize1024($modificationContent);
break;
- case "date" :
- case "published" :
- case "expired" :
- case "updated" :
+ case 'date':
+ case 'published':
+ case 'expired':
+ case 'updated':
$downloadContent = ($downloadContent != false) ? XoopsLocal::formatTimestamp($downloadContent, 'l') : _NO;
//
$modificationContent = ($modificationContent != false) ? XoopsLocal::formatTimestamp($modificationContent, 'l') : _NO;
break;
- case "platform":
- case "license":
- case "limitations":
- case "versiontypes":
+ case 'platform':
+ case 'license':
+ case 'limitations':
+ case 'versiontypes':
$tempArray = $wfdownloads->getConfig($key);
$downloadContent = isset($tempArray[$downloadObj->getVar($key)]) ? $tempArray[$downloadObj->getVar($key)] : '';
//
$modificationContent = isset($tempArray[$modificationObj->getVar($key)]) ? $tempArray[$modificationObj->getVar($key)] : '';
break;
- case "cid":
- $category_list = $wfdownloads->getHandler('category')->getObjects(new Criteria("cid", $downloadObj->getVar($key)));
+ case 'cid':
+ $category_list = $wfdownloads->getHandler('category')->getObjects(new Criteria('cid', $downloadObj->getVar($key)));
if (!isset($category_list[0])) continue;
$downloadContent = $category_list[0]->getVar('title', 'e');
//
- $category_list = $wfdownloads->getHandler('category')->getObjects(new Criteria("cid", $modificationObj->getVar($key)));
+ $category_list = $wfdownloads->getHandler('category')->getObjects(new Criteria('cid', $modificationObj->getVar($key)));
if (!isset($category_list[0])) continue;
$modificationContent = $category_list[0]->getVar('title', 'e');
break;
- case "screenshot":
- case "screenshot2":
- case "screenshot3":
- case "screenshot4":
+ case 'screenshot':
+ case 'screenshot2':
+ case 'screenshot3':
+ case 'screenshot4':
if ($downloadContent != '') $downloadContent = "<img src='" . XOOPS_URL . "/{$wfdownloads->getConfig('screenshots')}/{$downloadContent}' width='{$wfdownloads->getConfig('shotwidth')}' alt='' title='' />";
//
if ($modificationContent != '') $modificationContent = "<img src='" . XOOPS_URL . "/{$wfdownloads->getConfig('screenshots')}/{$modificationContent}' width='{$wfdownl...
[truncated message content] |