|
From: <luc...@us...> - 2014-09-16 21:48:14
|
Revision: 12785
http://sourceforge.net/p/xoops/svn/12785
Author: luciorota
Date: 2014-09-16 21:48:09 +0000 (Tue, 16 Sep 2014)
Log Message:
-----------
fixed bugs
code standardization
Modified Paths:
--------------
XoopsModules/wfdownloads/branches/luciorota/wfdownloads/admin/categories.php
XoopsModules/wfdownloads/branches/luciorota/wfdownloads/admin/downloads.php
Modified: XoopsModules/wfdownloads/branches/luciorota/wfdownloads/admin/categories.php
===================================================================
--- XoopsModules/wfdownloads/branches/luciorota/wfdownloads/admin/categories.php 2014-09-16 20:57:03 UTC (rev 12784)
+++ XoopsModules/wfdownloads/branches/luciorota/wfdownloads/admin/categories.php 2014-09-16 21:48:09 UTC (rev 12785)
@@ -41,8 +41,8 @@
$op = WfdownloadsRequest::getString('op', 'categories.list');
switch ($op) {
- case "category.move":
- case "move":
+ case 'category.move':
+ case 'move':
$ok = WfdownloadsRequest::getBool('ok', false, 'POST');
if ($ok == false) {
$cid = WfdownloadsRequest::getInt('cid', 0);
@@ -50,11 +50,11 @@
wfdownloads_xoops_cp_header();
include_once XOOPS_ROOT_PATH . '/class/xoopsformloader.php';
- $sform = new XoopsThemeForm(_AM_WFDOWNLOADS_CCATEGORY_MOVE, "move", xoops_getenv('PHP_SELF'));
+ $sform = new XoopsThemeForm(_AM_WFDOWNLOADS_CCATEGORY_MOVE, 'move', xoops_getenv('PHP_SELF'));
$categoryObjs = $wfdownloads->getHandler('category')->getObjects();
- $mytree = new XoopsObjectTree($categoryObjs, "cid", "pid");
- $sform->addElement(new XoopsFormLabel(_AM_WFDOWNLOADS_BMODIFY, $mytree->makeSelBox('target', 'title')));
+ $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));
@@ -87,21 +87,22 @@
}
break;
- case "category.save" :
- case "addCat" :
+ 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;
+ $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');
- $maxFileSize = $wfdownloads->getConfig('maxfilesize');
- $maxImgWidth = $wfdownloads->getConfig('maximgwidth');
- $maxImgHeight = $wfdownloads->getConfig('maximgheight');
+ $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])) {
@@ -109,7 +110,7 @@
$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();
}
@@ -151,9 +152,7 @@
echo $categoryObj->getHtmlErrors();
}
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
@@ -171,27 +170,28 @@
redirect_header($currentFile, 1, $database_mess);
break;
- case "category.delete" :
- case "del" :
+ case 'category.delete':
+ case 'del':
$cid = WfdownloadsRequest::getInt('cid', 0);
$ok = WfdownloadsRequest::getBool('ok', false, 'POST');
$categoryObjs = $wfdownloads->getHandler('category')->getObjects();
- $mytree = new XoopsObjectTree($categoryObjs, "cid", "pid");
+ $categoryObjsTree = new XoopsObjectTree($categoryObjs, 'cid', 'pid');
if ($ok == true) {
// get all subcategories under the specified category
- $arr = $mytree -> getAllChild($cid);
- foreach ($arr as $child) {
+ $childCategoryObjs = $categoryObjsTree->getAllChild($cid);
+ $cids = array();
+ foreach ($childCategoryObjs as $childCategoryObj) {
// get all category ids
- $cids[] = $child->getVar('cid');
+ $cids[] = $childCategoryObj->getVar('cid');
}
$cids[] = $cid;
- $criteria = new Criteria("cid", "(" . implode(',', $cids) . ")", "IN");
+ $criteria = new Criteria('cid', '(' . implode(',', $cids) . ')', 'IN');
//get list of downloads in these subcategories
$downloads = $wfdownloads->getHandler('download')->getList($criteria);
- $download_criteria = new Criteria("lid", "(" . implode(',', array_keys($downloads)) . ")", "IN");
+ $download_criteria = new Criteria('lid', '(' . implode(',', array_keys($downloads)) . ')', 'IN');
// now for each download, delete the text data and vote data associated with the download
$wfdownloads->getHandler('rating')->deleteAll($download_criteria);
@@ -219,9 +219,9 @@
}
break;
- case "category.add" :
- case "category.edit" :
- case "modCat":
+ case 'category.add':
+ case 'category.edit':
+ case 'modCat':
wfdownloads_xoops_cp_header();
$indexAdmin = new ModuleAdmin();
echo $indexAdmin->addNavigation($currentFile);
@@ -238,12 +238,12 @@
$form = $categoryObj->getForm();
$form -> display();
- include_once dirname(__FILE__) . '/admin_footer.php';
+ include 'admin_footer.php';
break;
- case 'categories.list' :
- case 'main' :
- default :
+ case 'categories.list':
+ case 'main':
+ default:
wfdownloads_xoops_cp_header();
$indexAdmin = new ModuleAdmin();
echo $indexAdmin->addNavigation($currentFile);
@@ -261,10 +261,10 @@
} else {
redirect_header("{$currentFile}?op=category.add", 1, _AM_WFDOWNLOADS_CCATEGORY_NOEXISTS);
}
- include_once dirname(__FILE__) . '/admin_footer.php';
+ include 'admin_footer.php';
break;
- case 'categories.reorder' :
+ case 'categories.reorder':
if (!$GLOBALS['xoopsSecurity']->check()) {
redirect_header($currentFile, 3, implode(',', $GLOBALS['xoopsSecurity']->getErrors() ));
}
Modified: XoopsModules/wfdownloads/branches/luciorota/wfdownloads/admin/downloads.php
===================================================================
--- XoopsModules/wfdownloads/branches/luciorota/wfdownloads/admin/downloads.php 2014-09-16 20:57:03 UTC (rev 12784)
+++ XoopsModules/wfdownloads/branches/luciorota/wfdownloads/admin/downloads.php 2014-09-16 21:48:09 UTC (rev 12785)
@@ -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) {
- $ratingCount = $wfdownloads->getHandler('rating')->getCount();
+ $votes_count = $wfdownloads->getHandler('rating')->getCount();
- $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);
+ $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);
- $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');
+ $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');
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>{$ratingCount}<br /><br />\n";
+ echo "<div style='padding: 8px;'><b>" . _AM_WFDOWNLOADS_VOTE_TOTALVOTES . "</b>{$votes_count}<br /><br />\n";
- printf(_AM_WFDOWNLOADS_VOTE_REGUSERVOTES, $regUserRatingCount);
+ printf(_AM_WFDOWNLOADS_VOTE_REGUSERVOTES, $votesreg);
echo "<br />";
- printf(_AM_WFDOWNLOADS_VOTE_ANONUSERVOTES, $anonUserRatingCount);
+ printf(_AM_WFDOWNLOADS_VOTE_ANONUSERVOTES, $votesanon);
echo "
</div>\n
@@ -179,32 +179,37 @@
</tr>\n
";
- if ($regUserRatingCount == 0) {
+ if ($votesreg == 0) {
echo "<tr><td colspan='7' class='even'><b>" . _AM_WFDOWNLOADS_VOTE_NOREGVOTES . "</b></td></tr>";
} else {
- foreach ($regUserRatingObjs as $regUserRatingObj) {
- $uids[] = $regUserRatingObj->getVar('ratinguser');
+ $uids = array();
+ foreach (array_keys($regvotes) as $i) {
+ $uids[] = $regvotes[$i]->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 ($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'));
+ 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'));
echo "
<tr><td class='head'>$ratingUserName</td>\n
- <td class='even'>" . $regUserRatingObj->getVar('ratinghostname') . "</th>\n
- <td class='even'>" . $regUserRatingObj->getVar('rating') . "</th>\n
+ <td class='even'>" . $regvotes[$i]->getVar('ratinghostname') . "</th>\n
+ <td class='even'>" . $regvotes[$i]->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=" . $regUserRatingObj->getVar('ratingid') . "'>"
+ <a href='{$currentFile}?op=vote.delete&lid={$lid}&rid=" . $regvotes[$i]->getVar('ratingid') . "'>"
. $imagearray['deleteimg'] . "</a>\n
</th></tr>\n
";
@@ -224,29 +229,29 @@
<th>" . _AM_WFDOWNLOADS_MINDEX_ACTION . "</td>\n
</tr>\n
";
- if ($anonUserRatingCount == 0) {
+ if ($votesanon == 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);
- $anonUserRatingObjs = $wfdownloads->getHandler('rating')->getObjects($anonUserCriteria);
+ $criteria = new Criteria('ratinguser', 0);
+ $userRatings = $wfdownloads->getHandler('rating')->getUserAverage($criteria);
+ $anonymousVotes = $wfdownloads->getHandler('rating')->getObjects($anonymousCriteria);
- 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;
+ 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;
$ratingUserName = $GLOBALS['xoopsConfig']['anonymous'];
echo "
<tr><td class='head'>$ratingUserName</td>\n
- <td class='even'>" . $anonUserRatingObj->getVar('ratinghostname') . "</th>\n
- <td class='even'>" . $anonUserRatingObj->getVar('rating') . "</th>\n
+ <td class='even'>" . $anonymousVotes[$i]->getVar('ratinghostname') . "</th>\n
+ <td class='even'>" . $anonymousVotes[$i]->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=" . $anonUserRatingObj->getVar('ratingid') . "'>"
+ <a href='{$currentFile}?op=vote.delete&lid={$lid}&rid=" . $anonymousVotes[$i]->getVar('ratingid') . "'>"
. $imagearray['deleteimg'] . "</a>\n
</th></tr>\n
";
@@ -255,32 +260,32 @@
echo "</table>\n";
echo "</fieldset>\n";
}
- include_once dirname(__FILE__) . '/admin_footer.php';
+ include '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;
@@ -291,12 +296,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']);
@@ -325,11 +330,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}";
@@ -375,12 +380,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;
}
@@ -396,7 +401,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;
@@ -404,7 +409,7 @@
$publishdate = time();
} else {
$publishdate = $_POST['was_published'];
- $expiredate = $_POST['was_expired'];
+ $expiredate = $_POST['was_expired'];
}
if ($approved == 1 && empty($publishdate)) {
$publishdate = time();
@@ -436,8 +441,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');
@@ -448,19 +453,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,
@@ -468,7 +473,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];
@@ -481,21 +486,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;
+ ...
[truncated message content] |