|
From: <luc...@us...> - 2013-08-24 07:36:34
|
Revision: 11968
http://sourceforge.net/p/xoops/svn/11968
Author: luciorota
Date: 2013-08-24 07:36:27 +0000 (Sat, 24 Aug 2013)
Log Message:
-----------
Modified Paths:
--------------
XoopsModules/wfdownloads/trunk/wfdownloads/admin/categories.php
XoopsModules/wfdownloads/trunk/wfdownloads/admin/downloads.php
XoopsModules/wfdownloads/trunk/wfdownloads/blocks/top.php
XoopsModules/wfdownloads/trunk/wfdownloads/blocks/top_by_cat.php
XoopsModules/wfdownloads/trunk/wfdownloads/brokenfile.php
XoopsModules/wfdownloads/trunk/wfdownloads/class/category.php
XoopsModules/wfdownloads/trunk/wfdownloads/class/download.php
XoopsModules/wfdownloads/trunk/wfdownloads/class/wfdownloads.php
XoopsModules/wfdownloads/trunk/wfdownloads/comment_new.php
XoopsModules/wfdownloads/trunk/wfdownloads/footer.php
XoopsModules/wfdownloads/trunk/wfdownloads/include/common.php
XoopsModules/wfdownloads/trunk/wfdownloads/include/functions.php
XoopsModules/wfdownloads/trunk/wfdownloads/index.php
XoopsModules/wfdownloads/trunk/wfdownloads/language/english/admin.php
XoopsModules/wfdownloads/trunk/wfdownloads/language/english/main.php
XoopsModules/wfdownloads/trunk/wfdownloads/mirror.php
XoopsModules/wfdownloads/trunk/wfdownloads/newlist.php
XoopsModules/wfdownloads/trunk/wfdownloads/ratefile.php
XoopsModules/wfdownloads/trunk/wfdownloads/review.php
XoopsModules/wfdownloads/trunk/wfdownloads/rss.php
XoopsModules/wfdownloads/trunk/wfdownloads/singlefile.php
XoopsModules/wfdownloads/trunk/wfdownloads/sql/mysql.sql
XoopsModules/wfdownloads/trunk/wfdownloads/submit.php
XoopsModules/wfdownloads/trunk/wfdownloads/templates/admin/wfdownloads_admin_downloadslist.html
XoopsModules/wfdownloads/trunk/wfdownloads/templates/wfdownloads_brokenfile.html
XoopsModules/wfdownloads/trunk/wfdownloads/templates/wfdownloads_ratefile.html
XoopsModules/wfdownloads/trunk/wfdownloads/topten.php
XoopsModules/wfdownloads/trunk/wfdownloads/viewcat.php
XoopsModules/wfdownloads/trunk/wfdownloads/visit.php
XoopsModules/wfdownloads/trunk/wfdownloads/xoops_version.php
Modified: XoopsModules/wfdownloads/trunk/wfdownloads/admin/categories.php
===================================================================
--- XoopsModules/wfdownloads/trunk/wfdownloads/admin/categories.php 2013-08-24 04:38:58 UTC (rev 11967)
+++ XoopsModules/wfdownloads/trunk/wfdownloads/admin/categories.php 2013-08-24 07:36:27 UTC (rev 11968)
@@ -95,9 +95,12 @@
$category->setErrors(_AM_WFD_CCATEGORY_CHILDASPARENT);
}
}
- // added - start - March 4 2006 - jpc
- $formulize_fid = (isset($_POST["formulize_fid"])) ? (int)$_POST["formulize_fid"] : 0;
- // added - end - March 4 2006 - jpc
+
+ //added formulize support (2006/05/04) jpc - start
+ if (xoops_isActiveModule('formulize')) {
+ $formulize_fid = (isset($_POST["formulize_fid"])) ? (int)$_POST["formulize_fid"] : 0;
+ }
+ //added formulize support (2006/05/04) jpc - end
$category->setVar('title', $_POST["title"]);
$category->setVar('description', $_POST["description"]);
$category->setVar('summary', $_POST["summary"]);
@@ -111,9 +114,11 @@
$category->setVar('spotlighthis', $spotlighthis);
$category->setVar('spotlighttop', $spotlighttop);
$category->setVar('imgurl', $imgurl);
- // added - start - March 4 2006 - jpc
- $category->setVar('formulize_fid', $formulize_fid);
- // added - end - March 4 2006 - jpc
+ //added formulize support (2006/05/04) jpc - start
+ if (xoops_isActiveModule('formulize')) {
+ $category->setVar('formulize_fid', $formulize_fid);
+ }
+ //added formulize support (2006/05/04) jpc - end
$result = $wfdownloads->getHandler('category')->insert($category);
if (!$result) {
echo $category->getHtmlErrors();
Modified: XoopsModules/wfdownloads/trunk/wfdownloads/admin/downloads.php
===================================================================
--- XoopsModules/wfdownloads/trunk/wfdownloads/admin/downloads.php 2013-08-24 04:38:58 UTC (rev 11967)
+++ XoopsModules/wfdownloads/trunk/wfdownloads/admin/downloads.php 2013-08-24 07:36:27 UTC (rev 11968)
@@ -81,23 +81,25 @@
redirect_header($currentFile, 1, _AM_WFD_VOTE_VOTEDELETED);
break;
- // added - start - March 4 2006 - jpc
+ //added formulize support (2006/05/04) jpc - start
case "patch_formulize":
- if(!isset($_POST['patch_formulize'])) {
- print "<form action=\"{$currentFile}?op=patch_formulize\" method=post>";
- print "<input type = submit name=patch_formulize value=\"Apply Patch for Formulize\">";
- print "</form>";
- } else {
- global $xoopsDB;
- $sqls[] = "ALTER TABLE " . $xoopsDB->prefix("wfdownloads_cat") . " ADD formulize_fid int(5) NOT NULL default '0';";
- $sqls[] = "ALTER TABLE " . $xoopsDB->prefix("wfdownloads_downloads") . " ADD formulize_idreq int(5) NOT NULL default '0';";
- foreach($sqls as $sql)
- if(!$result = $xoopsDB->queryF($sql))
- 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.";
+ if (xoops_isActiveModule('formulize')) {
+ if(!isset($_POST['patch_formulize'])) {
+ print "<form action=\"{$currentFile}?op=patch_formulize\" method=post>";
+ print "<input type = submit name=patch_formulize value=\"Apply Patch for Formulize\">";
+ print "</form>";
+ } else {
+ global $xoopsDB;
+ $sqls[] = "ALTER TABLE " . $xoopsDB->prefix("wfdownloads_cat") . " ADD formulize_fid int(5) NOT NULL default '0';";
+ $sqls[] = "ALTER TABLE " . $xoopsDB->prefix("wfdownloads_downloads") . " ADD formulize_idreq int(5) NOT NULL default '0';";
+ foreach($sqls as $sql)
+ if(!$result = $xoopsDB->queryF($sql))
+ 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.";
+ }
}
break;
- // added - end - March 4 2006 - jpc
+ //added formulize support (2006/05/04) jpc - end
case "newdownload.approve":
case "approve":
@@ -138,19 +140,14 @@
$start_published = wfdownloads_CleanVars($_GET, 'start_published', 0, 'int');
$start_new = wfdownloads_CleanVars($_GET, 'start_new', 0, 'int');
- $start_auto_published = wfdownloads_CleanVars($_GET, 'start_auto_published', 0, 'int');
+ $start_autopublished = wfdownloads_CleanVars($_GET, 'start_autopublished', 0, 'int');
$start_expired = wfdownloads_CleanVars($_GET, 'start_expired', 0, 'int');
$start_offline = wfdownloads_CleanVars($_GET, 'start_offline', 0, 'int');
$totalcats = wfd_totalcategory();
$categories = $wfdownloads->getHandler('category')->getObjects(null, true, false);
- $totalbrokendownloads = $wfdownloads->getHandler('report')->getCount();
- $totalmodrequests = $wfdownloads->getHandler('modification')->getCount();
- $newreviews = $wfdownloads->getHandler('review')->getCount();
- $newmirrors = $wfdownloads->getHandler('mirror')->getCount();
- $totalnewdownloads = $wfdownloads->getHandler('download')->getCount(new Criteria("published", 0));
- $totaldownloads = $wfdownloads->getHandler('download')->getCount(new Criteria("published", 0, ">"));
+ $totalDownloadsCount = $wfdownloads->getHandler('download')->getCount();
wfdownloads_xoops_cp_header();
$indexAdmin = new ModuleAdmin();
@@ -161,28 +158,28 @@
$adminMenu->addItemButton(_AM_WFD_FFS_DOWNLOADTITLE, $currentFile . "?op=download.add", 'add');
echo $adminMenu->renderButton();
- if ($totaldownloads > 0) {
+ if ($totalDownloadsCount > 0) {
// Published Downloads
$criteria = new CriteriaCompo();
$criteria->setSort("published");
$criteria->setOrder("DESC");
$criteria->setStart($start_published);
$criteria->setLimit($wfdownloads->getConfig('admin_perpage'));
- $published_downloads = $wfdownloads->getHandler('download')->getActiveDownloads($criteria);
- $published_downloads_count = $wfdownloads->getHandler('download')->getActiveCount();
- $GLOBALS['xoopsTpl']->assign('published_downloads_count', $published_downloads_count);
- if ($published_downloads_count > 0) {
- foreach ($published_downloads as $published_download) {
- $published_download_array = $published_download->toArray();
- $published_download_array['title_html'] = $myts->htmlSpecialChars(trim($published_download_array['title']));
- $published_download_array['category_title'] = $categories[$published_download_array['cid']]['title'];
- $published_download_array['submitter_uname'] = XoopsUserUtility::getUnameFromId($published_download_array['submitter']);
- $published_download_array['published_timestamp'] = formatTimestamp($published_download_array['published'], _DATESTRING);
- $GLOBALS['xoopsTpl']->append('published_downloads', $published_download_array);
+ $publishedDownloads = $wfdownloads->getHandler('download')->getActiveDownloads($criteria);
+ $publishedDownloadsCount = $wfdownloads->getHandler('download')->getActiveCount();
+ $GLOBALS['xoopsTpl']->assign('published_downloads_count', $publishedDownloadsCount);
+ if ($publishedDownloadsCount > 0) {
+ foreach ($publishedDownloads as $publishedDownload) {
+ $publishedDownload_array = $publishedDownload->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']);
+ $publishedDownload_array['published_timestamp'] = formatTimestamp($publishedDownload_array['published'], _DATESTRING);
+ $GLOBALS['xoopsTpl']->append('published_downloads', $publishedDownload_array);
}
}
- $pagenav = new XoopsPageNav($published_downloads_count, $wfdownloads->getConfig('admin_perpage'), $start_published, 'start_published');
+ $pagenav = new XoopsPageNav($publishedDownloadsCount, $wfdownloads->getConfig('admin_perpage'), $start_published, 'start_published');
$GLOBALS['xoopsTpl']->assign('published_downloads_pagenav', $pagenav->renderNav());
// New Downloads
@@ -190,51 +187,51 @@
$criteria->add(new Criteria("published", 0));
$criteria->setStart($start_new);
$criteria->setLimit($wfdownloads->getConfig('admin_perpage'));
- $new_downloads = $wfdownloads->getHandler('download')->getObjects($criteria);
- $new_downloads_count = $wfdownloads->getHandler('download')->getCount($criteria);
- $GLOBALS['xoopsTpl']->assign('new_downloads_count', $new_downloads_count);
- if ($new_downloads_count > 0) {
- foreach ($new_downloads as $new_download) {
- $new_download_array = $new_download->toArray();
- $new_download_array['rating'] = number_format($new_download_array['rating'], 2);
- $new_download_array['title_html'] = $myts->htmlSpecialChars($new_download_array['title']);
- $new_download_array['category_title'] = $categories[$published_download_array['cid']]['title'];
- $url = urldecode($myts->htmlSpecialChars($new_download_array['url']));
- $homepage = $myts->htmlSpecialChars($new_download_array['homepage']);
- $version = $myts->htmlSpecialChars($new_download_array['version']);
- $size = $myts->htmlSpecialChars($new_download_array['size']);
- $platform = $myts->htmlSpecialChars($new_download_array['platform']);
- $logourl = $myts->htmlSpecialChars($new_download_array['screenshot']);
- $new_download_array['submitter_uname'] = XoopsUserUtility::getUnameFromId($new_download_array['submitter']);
- $new_download_array['date_timestamp'] = formatTimestamp($new_download_array['date'], _DATESTRING);
- $GLOBALS['xoopsTpl']->append('new_downloads', $new_download_array);
+ $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();
+ $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']);
+ $newDownload_array['submitter_uname'] = XoopsUserUtility::getUnameFromId($newDownload_array['submitter']);
+ $newDownload_array['date_timestamp'] = formatTimestamp($newDownload_array['date'], _DATESTRING);
+ $GLOBALS['xoopsTpl']->append('new_downloads', $newDownload_array);
}
}
- $pagenav = new XoopsPageNav($new_downloads_count, $wfdownloads->getConfig('admin_perpage'), $start_new, 'start_new');
+ $pagenav = new XoopsPageNav($newDownloadsCount, $wfdownloads->getConfig('admin_perpage'), $start_new, 'start_new');
$GLOBALS['xoopsTpl']->assign('new_downloads_pagenav', $pagenav->renderNav());
- // Auto Published Downloads
+ // Autopublished Downloads
$criteria = new CriteriaCompo();
$criteria->add(new Criteria("published", time(), ">"));
$criteria->setSort("published");
$criteria->setOrder("ASC");
- $criteria->setStart($start_auto_published);
+ $criteria->setStart($start_autopublished);
$criteria->setLimit($wfdownloads->getConfig('admin_perpage'));
- $auto_published_downloads = $wfdownloads->getHandler('download')->getObjects($criteria);
- $auto_published_downloads_count = $wfdownloads->getHandler('download')->getCount($criteria);
- $GLOBALS['xoopsTpl']->assign('auto_published_downloads_count', $auto_published_downloads_count);
- if ($auto_published_downloads_count > 0) {
- foreach ($auto_published_downloads as $auto_published_download) {
- $auto_published_download_array = $auto_published_download->toArray();
- $auto_published_download_array['title_html'] = $myts->htmlSpecialChars(trim($auto_published_download_array['title']));
- $auto_published_download_array['category_title'] = $categories[$auto_published_download_array['cid']]['title'];
- $auto_published_download_array['submitter_uname'] = XoopsUserUtility::getUnameFromId($auto_published_download_array['submitter']);
- $auto_published_download_array['published_timestamp'] = formatTimestamp($auto_published_download_array['published'], _DATESTRING);
- $GLOBALS['xoopsTpl']->append('auto_published_downloads', $auto_published_download_array);
+ $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();
+ $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']);
+ $autopublishedDownload_array['published_timestamp'] = formatTimestamp($autopublishedDownload_array['published'], _DATESTRING);
+ $GLOBALS['xoopsTpl']->append('autopublished_downloads', $autopublishedDownload_array);
}
}
- $pagenav = new XoopsPageNav($auto_published_downloads_count, $wfdownloads->getConfig('admin_perpage'), $start_auto_published, 'start_auto_published');
- $GLOBALS['xoopsTpl']->assign('auto_published_downloads_pagenav', $pagenav->renderNav());
+ $pagenav = new XoopsPageNav($autopublishedDownloadsCount, $wfdownloads->getConfig('admin_perpage'), $start_autopublished, 'start_autopublished');
+ $GLOBALS['xoopsTpl']->assign('autopublished_downloads_pagenav', $pagenav->renderNav());
// Expired downloads
$criteria = new CriteriaCompo();
@@ -245,9 +242,9 @@
$criteria->setStart($start_expired);
$criteria->setLimit($wfdownloads->getConfig('admin_perpage'));
$expired_downloads = $wfdownloads->getHandler('download')->getObjects($criteria);
- $expired_downloads_count = $wfdownloads->getHandler('download')->getCount($criteria);
- $GLOBALS['xoopsTpl']->assign('expired_downloads_count', $expired_downloads_count);
- if ($expired_downloads_count > 0) {
+ $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();
$expired_download_array['title_html'] = $myts->htmlSpecialChars(trim($expired_download_array['title']));
@@ -257,7 +254,7 @@
$GLOBALS['xoopsTpl']->append('expired_downloads', $expired_download_array);
}
}
- $pagenav = new XoopsPageNav($expired_downloads_count, $wfdownloads->getConfig('admin_perpage'), $start_expired, 'start_expired');
+ $pagenav = new XoopsPageNav($expiredDownloadsCount, $wfdownloads->getConfig('admin_perpage'), $start_expired, 'start_expired');
$GLOBALS['xoopsTpl']->assign('expired_downloads_pagenav', $pagenav->renderNav());
// Offline downloads
@@ -266,22 +263,22 @@
$criteria->setOrder("ASC");
$criteria->setStart($start_offline);
$criteria->setLimit($wfdownloads->getConfig('admin_perpage'));
- $offline_downloads_count = $wfdownloads->getHandler('download')->getCount($criteria);
- $offline_downloads = $wfdownloads->getHandler('download')->getObjects($criteria);
- $offline_downloads_count = $wfdownloads->getHandler('download')->getCount($criteria);
- $GLOBALS['xoopsTpl']->assign('offline_downloads_count', $offline_downloads_count);
- if ($offline_downloads_count > 0) {
- foreach ($offline_downloads as $offline_download) {
- $offline_download_array = $offline_download->toArray();
- $offline_download_array['title_html'] = $myts->htmlSpecialChars(trim($offline_download_array['title']));
- $offline_download_array['category_title'] = $categories[$offline_download_array['cid']]['title'];
- $offline_download_array['submitter_uname'] = XoopsUserUtility::getUnameFromId($offline_download_array['submitter']);
- $offline_download_array['published_timestamp'] = formatTimestamp($offline_download_array['published'], _DATESTRING);
+ $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();
+ $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']);
+ $offlineDownload_array['published_timestamp'] = formatTimestamp($offlineDownload_array['published'], _DATESTRING);
- $GLOBALS['xoopsTpl']->append('offline_downloads', $offline_download_array);
+ $GLOBALS['xoopsTpl']->append('offline_downloads', $offlineDownload_array);
}
}
- $pagenav = new XoopsPageNav($offline_downloads_count, $wfdownloads->getConfig('admin_perpage'), $start_offline, 'start_offline');
+ $pagenav = new XoopsPageNav($offlineDownloadsCount, $wfdownloads->getConfig('admin_perpage'), $start_offline, 'start_offline');
$GLOBALS['xoopsTpl']->assign('offline_downloads_pagenav', $pagenav->renderNav());
} else {
// NOP
@@ -308,8 +305,8 @@
echo "<div style='padding: 8px;'>\n";
$criteria = new Criteria("mime_admin", true);
$mimetypes = $wfdownloads->getHandler('mimetype')->getList($criteria);
- $allowmimetypes = implode(' | ', $mimetypes);
- echo $allowmimetypes;
+ $allowMimetypes = implode(' | ', $mimetypes);
+ echo $allowMimetypes;
echo "</div>\n";
echo "</fieldset><br />\n";
@@ -334,7 +331,6 @@
// changed - start - March 4 2006 - jpc
if ((isset($_POST['submit_category']) && !empty($_POST['submit_category'])) || $lid) {
-
$fid = $category->getVar('formulize_fid');
$customArray = array();
if($fid) {
@@ -349,9 +345,10 @@
$customArray['go_back'] = "";
$customArray['parentLinks'] = "";
- $owner = getEntryOwner($entry);
- $owner_groups =& $member_handler->getGroupsByUser($owner, false);
-
+ // $owner = getEntryOwner($entry);
+ $owner = getEntryOwner($entry, $fid);
+ $member_handler = xoops_gethandler('member');
+ $owner_groups = $member_handler->getGroupsByUser($owner, false);
$customArray['owner_groups'] = $owner_groups;
}
$sform = $download->getAdminForm($title, $customArray);
@@ -490,9 +487,9 @@
global $xoopsUser, $currentFile;
$wfdownloads = WfdownloadsWfdownloads::getInstance();
- $lid = (!empty($_POST['lid'])) ? intval($_POST['lid']) : 0;
- $cid = (!empty($_POST['cid'])) ? intval($_POST['cid']) : 0;
- $status = (!empty($_POST['status'])) ? intval($_POST['status']) : 2;
+ $lid = !empty($_POST['lid']) ? (int)$_POST['lid'] : 0;
+ $cid = !empty($_POST['cid']) ? (int)$_POST['cid'] : 0;
+ $status = !empty($_POST['status']) ? (int)$_POST['status'] : 2;
if ($lid > 0) {
$thisIsANewRecord = false; /* Added by Lankford on 2007/3/21 */
@@ -503,27 +500,27 @@
}
/* 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 = '';
} else {
- $url = ($_POST["url"] != "http://") ? $_POST["url"] : '';
+ $url = ($_POST["url"] != "http://") ? $_POST['url'] : '';
$filename = $_POST['filename'];
$filetype = $_POST['filetype'];
}
- $size = ((empty($_POST["size"]) || !is_numeric($_POST["size"]))) ? 0 : intval($_POST["size"]);
- $title = trim($_POST["title"]);
+ $size = (empty($_POST['size']) || !is_numeric($_POST['size'])) ? 0 : (int)$_POST["size"];
+ $title = trim($_POST['title']);
$download->setVar('filename', $filename);
$download->setVar('filetype', $filetype);
} else {
- $down = wfd_uploading($_FILES, $wfdownloads->getConfig('uploaddir'), "", $currentFile, 0, 0);
- $url = ($_POST["url"] != "http://") ? $_POST["url"] : '';
+ $down = wfd_uploading($_FILES, $wfdownloads->getConfig('uploaddir'), '', $currentFile, 0, 0);
+ $url = ($_POST['url'] != "http://") ? $_POST["url"] : '';
$size = $down['size'];
$title = $_FILES['userfile']['name'];
$ext = rtrim(strrchr($title, '.'), '.');
$title = str_replace($ext, '', $title);
- $title = (isset($_POST["title_checkbox"]) && $_POST["title_checkbox"] == 1) ? $title : trim($_POST["title"]);
+ $title = (isset($_POST['title_checkbox']) && $_POST['title_checkbox'] == 1) ? $title : trim($_POST['title']);
$filename = $down['filename'];
$filetype = $_FILES['userfile']['type'];
@@ -531,17 +528,17 @@
$download->setVar('filetype', $filetype);
}
/* Get data from form */
- $screenshot = ($_POST["screenshot"] != "blank.png") ? $_POST["screenshot"] : '';
- $screenshot2 = ($_POST["screenshot2"] != "blank.png") ? $_POST["screenshot2"] : '';
- $screenshot3 = ($_POST["screenshot3"] != "blank.png") ? $_POST["screenshot3"] : '';
- $screenshot4 = ($_POST["screenshot4"] != "blank.png") ? $_POST["screenshot4"] : '';
+ $screenshot = ($_POST['screenshot'] != 'blank.png') ? $_POST['screenshot'] : '';
+ $screenshot2 = ($_POST['screenshot2'] != 'blank.png') ? $_POST['screenshot2'] : '';
+ $screenshot3 = ($_POST['screenshot3'] != 'blank.png') ? $_POST['screenshot3'] : '';
+ $screenshot4 = ($_POST['screenshot4'] != 'blank.png') ? $_POST['screenshot4'] : '';
- if (!empty($_POST["homepage"]) || $_POST["homepage"] != "http://") {
- $download->setVar('homepage', trim($_POST["homepage"]));
- $download->setVar('homepagetitle', trim($_POST["homepagetitle"]));
+ if (!empty($_POST['homepage']) || $_POST['homepage'] != "http://") {
+ $download->setVar('homepage', trim($_POST['homepage']));
+ $download->setVar('homepagetitle', trim($_POST['homepagetitle']));
}
- $version = (!empty($_POST["version"])) ? trim($_POST["version"]) : 0;
+ $version = !empty($_POST['version']) ? trim($_POST['version']) : 0;
/* Added by Lankford on 2007/3/21 */
// Here, I want to know if:
@@ -552,11 +549,11 @@
// 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;
+ $tags['FILE_URL'] = WFDOWNLOADS_URL . "/singlefile.php?cid={$cid}&lid={$lid}";
$category = $wfdownloads->getHandler('category')->get($cid);
$tags['FILE_VERSION'] = $version;
$tags['CATEGORY_NAME'] = $category->getVar('title');
- $tags['CATEGORY_URL'] = WFDOWNLOADS_URL . '/viewcat.php?cid=' . $cid;
+ $tags['CATEGORY_URL'] = WFDOWNLOADS_URL . "/viewcat.php?cid='{$cid}";
if ($wfdownloads->getConfig('autoapprove') == 2 || $wfdownloads->getConfig('autoapprove') == 4) {
// Then this change will be automatically approved, so the notification needs to go out.
@@ -576,25 +573,25 @@
$download->setVar('screenshot2', $screenshot2);
$download->setVar('screenshot3', $screenshot3);
$download->setVar('screenshot4', $screenshot4);
- $download->setVar('platform', trim($_POST["platform"]));
- $download->setVar('summary', trim($_POST["summary"]));
- $download->setVar('description', trim($_POST["description"]));
- $download->setVar('submitter', trim($_POST["submitter"]));
- $download->setVar('publisher', trim($_POST["publisher"]));
- $download->setVar('price', trim($_POST["price"]));
+ $download->setVar('platform', trim($_POST['platform']));
+ $download->setVar('summary', trim($_POST['summary']));
+ $download->setVar('description', trim($_POST['description']));
+ $download->setVar('submitter', trim($_POST['submitter']));
+ $download->setVar('publisher', trim($_POST['publisher']));
+ $download->setVar('price', trim($_POST['price']));
if (!$wfdownloads->getConfig('enable_mirrors')) {
- $download->setVar('mirror', formatURL(trim($_POST["mirror"])));
+ $download->setVar('mirror', formatURL(trim($_POST['mirror'])));
}
- $download->setVar('license', trim($_POST["license"]));
- $download->setVar('features', trim($_POST["features"]));
- $download->setVar('requirements', trim($_POST["requirements"]));
- $limitations = (isset($_POST["limitations"])) ? $_POST["limitations"] : '';
+ $download->setVar('license', trim($_POST['license']));
+ $download->setVar('features', trim($_POST['features']));
+ $download->setVar('requirements', trim($_POST['requirements']));
+ $limitations = (isset($_POST['limitations'])) ? $_POST['limitations'] : '';
$download->setVar('limitations', $limitations);
- $versiontypes = (isset($_POST["versiontypes"])) ? $_POST["versiontypes"] : '';
+ $versiontypes = (isset($_POST['versiontypes'])) ? $_POST['versiontypes'] : '';
$download->setVar('versiontypes', $versiontypes);
- $dhistory = (isset($_POST["dhistory"])) ? $_POST["dhistory"] : '';
- $dhistoryhistory = (isset($_POST["dhistoryaddedd"])) ? $_POST["dhistoryaddedd"] : '';
+ $dhistory = (isset($_POST['dhistory'])) ? $_POST['dhistory'] : '';
+ $dhistoryhistory = (isset($_POST['dhistoryaddedd'])) ? $_POST['dhistoryaddedd'] : '';
if ($lid > 0 && !empty($dhistoryhistory)) {
$dhistory = $dhistory . "\n\n";
@@ -650,42 +647,44 @@
$download->setVar('ipaddress', $_SERVER['REMOTE_ADDR']);
}
- // added - start - March 4 2006 - jpc
- $category = $wfdownloads->getHandler('category')->get($cid);
- $fid = $category->getVar('formulize_fid');
- if($fid) {
- global $xoopsUser;
- include_once XOOPS_ROOT_PATH . "/modules/formulize/include/formread.php";
- include_once XOOPS_ROOT_PATH . "/modules/formulize/include/functions.php";
+ //added formulize support (2006/05/04) jpc - start
+ if (xoops_isActiveModule('formulize')) {
+ $category = $wfdownloads->getHandler('category')->get($cid);
+ $fid = $category->getVar('formulize_fid');
+ if($fid) {
+ global $xoopsUser;
+ 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');
+ $formulize_mgr =& xoops_getmodulehandler('elements', 'formulize');
- if ($lid) {
- $entries[$fid][0] = $download->getVar('formulize_idreq');
- if($entries[$fid][0]) {
- $owner = getEntryOwner($entries[$fid][0]);
+ if ($lid) {
+ $entries[$fid][0] = $download->getVar('formulize_idreq');
+ if($entries[$fid][0]) {
+ // $owner = getEntryOwner($entries[$fid][0]);
+ $owner = getEntryOwner($entries[$fid][0], $fid);
+ } else {
+ print "no idreq";
+ $entries[$fid][0] = "";
+ $owner = "";
+ }
+ $cid = $download->getVar('cid');
} else {
- print "no idreq";
- $entries[$fid][0] = "";
- $owner = "";
+ $entries[$fid][0] = "";
+ $owner = "";
}
- $cid = $download->getVar('cid');
- } else {
- $entries[$fid][0] = "";
- $owner = "";
+ $owner_groups =& $member_handler->getGroupsByUser($owner, FALSE);
+ $uid = !empty($xoopsUser) ? $xoopsUser->getVar('uid') : 0;
+ $groups = $xoopsUser ? $xoopsUser->getGroups() : array(0=>XOOPS_GROUP_ANONYMOUS);
+ $entries = handleSubmission($formulize_mgr, $entries, $uid, $owner, $fid, $owner_groups, $groups, "new"); // "new" causes xoops token check to be skipped, since WF-downloads should be doing that
+
+ if(!$owner) {
+ $id_req = $entries[$fid][0];
+ $download->setVar('formulize_idreq', $id_req);
+ }
}
- $owner_groups =& $member_handler->getGroupsByUser($owner, FALSE);
- $uid = !empty($xoopsUser) ? $xoopsUser->getVar('uid') : 0;
- $groups = $xoopsUser ? $xoopsUser->getGroups() : array(0=>XOOPS_GROUP_ANONYMOUS);
- $entries = handleSubmission($formulize_mgr, $entries, $uid, $owner, $fid, $owner_groups, $groups, "new"); // "new" causes xoops token check to be skipped, since WF-downloads should be doing that
-
- //if (!$lid)
- if(!$owner) {
- $id_req = $entries[$fid][0];
- $download->setVar('formulize_idreq', $id_req);
- }
}
- // added - end - March 4 2006 - jpc
+ //added formulize support (2006/05/04) jpc - end
$wfdownloads->getHandler('download')->insert($download);
$newid = intval($download->getVar('lid'));
/**
Modified: XoopsModules/wfdownloads/trunk/wfdownloads/blocks/top.php
===================================================================
--- XoopsModules/wfdownloads/trunk/wfdownloads/blocks/top.php 2013-08-24 04:38:58 UTC (rev 11967)
+++ XoopsModules/wfdownloads/trunk/wfdownloads/blocks/top.php 2013-08-24 07:36:27 UTC (rev 11968)
@@ -27,43 +27,47 @@
* $options[1] = How many downloads are displayes
* Output : Returns the most recent or most popular downloads
*/
-include_once XOOPS_ROOT_PATH . '/class/xoopsform/grouppermform.php';
+//include_once XOOPS_ROOT_PATH . '/class/xoopsform/grouppermform.php';
function wfdownloads_top_show($options)
{
global $xoopsUser;
+ $module_handler = xoops_gethandler('module');
+ $gperm_handler = xoops_gethandler('groupperm');
+ $download_handler = xoops_getmodulehandler('download', 'wfdownloads');
+ $category_handler = xoops_getmodulehandler('category', 'wfdownloads');
+
$block = array();
- $modhandler = xoops_gethandler('module');
- $wfModule = $modhandler->getByDirname("wfdownloads");
+ $wfModule = $module_handler->getByDirname("wfdownloads");
$config_handler = xoops_gethandler('config');
- $wf_mid = intval($wfModule->mid());
- $wfModuleConfig = $config_handler->getConfigsByCat(0, $wf_mid);
+ $wfModule_mid = $wfModule->getVar('mid');
+ $wfModule_config = $config_handler->getConfigsByCat(0, $wfModule_mid);
$groups = is_object($xoopsUser) ? $xoopsUser->getGroups() : array(0 => XOOPS_GROUP_ANONYMOUS);
- $gperm_handler = &xoops_gethandler('groupperm');
- $allowed_cats = $gperm_handler->getItemIds("WFDownCatPerm", $groups, $wf_mid);
+ $allowed_cats = $gperm_handler->getItemIds("WFDownCatPerm", $groups, $wfModule_mid);
+ // get downloads
$criteria = new Criteria("cid", implode(',', $allowed_cats), "IN");
- $criteria = new CriteriaCompo(new Criteria('offline', 0));
+ $criteria = new CriteriaCompo(new Criteria('offline', 0)); // false
$criteria->setSort($options[0]);
$criteria->setOrder("DESC");
$criteria->setLimit($options[1]);
- $downloads = $wfdownloads->getHandler('download')->getObjects($criteria);
+ $downloads = $download_handler->getObjects($criteria);
foreach (array_keys($downloads) as $i) {
$download = $downloads[$i]->toArray();
- if (!in_array(intval($download['cid']), $allowed_cats)){
+ if (!in_array((int)$download['cid'], $allowed_cats)){
continue;
}
$download['title'] = xoops_substr($download['title'], 0, ($options[2] -1));
- $download['id'] = intval($download['lid']);
+ $download['id'] = (int)$download['lid'];
if ($options[0] == "published") {
- $download['date'] = formatTimestamp($download['published'], $wfModuleConfig['dateformat']);
+ $download['date'] = formatTimestamp($download['published'], $wfModule_config['dateformat']);
} else {
- $download['date'] = formatTimestamp($download['date'], $wfModuleConfig['dateformat']);
+ $download['date'] = formatTimestamp($download['date'], $wfModule_config['dateformat']);
}
$download['dirname'] = $wfModule->dirname();
$block['downloads'][] = $download;
Modified: XoopsModules/wfdownloads/trunk/wfdownloads/blocks/top_by_cat.php
===================================================================
--- XoopsModules/wfdownloads/trunk/wfdownloads/blocks/top_by_cat.php 2013-08-24 04:38:58 UTC (rev 11967)
+++ XoopsModules/wfdownloads/trunk/wfdownloads/blocks/top_by_cat.php 2013-08-24 07:36:27 UTC (rev 11968)
@@ -27,53 +27,56 @@
* $options[1] = How many downloads are displayes
* Output : Returns the most recent or most popular downloads
*/
-include_once XOOPS_ROOT_PATH . '/class/xoopsform/grouppermform.php';
+//include_once XOOPS_ROOT_PATH . '/class/xoopsform/grouppermform.php';
function wfdownloads_top_by_cat_show($options)
{
global $xoopsUser;
+
$module_handler = xoops_gethandler('module');
$gperm_handler = xoops_gethandler('groupperm');
+ $download_handler = xoops_getmodulehandler('download', 'wfdownloads');
+ $category_handler = xoops_getmodulehandler('category', 'wfdownloads');
$block = array();
$wfModule = $module_handler->getByDirname("wfdownloads");
$config_handler = xoops_gethandler('config');
- $wfModule_mid = $wfModule->mid();
- $wfModuleConfig = $config_handler->getConfigsByCat(0, $wfModule_mid);
+ $wfModule_mid = $wfModule->getVar('mid');
+ $wfModule_config = $config_handler->getConfigsByCat(0, $wfModule_mid);
$groups = is_object($xoopsUser) ? $xoopsUser->getGroups() : array(0=>XOOPS_GROUP_ANONYMOUS);
$allowed_cats = $gperm_handler->getItemIds("WFDownCatPerm", $groups, $wfModule_mid);
+ // get downloads
$criteria = new CriteriaCompo();
$criteria->add(new Criteria("cid", '(' . implode(',', $allowed_cats) . ')', "IN"));
$criteria->add(new Criteria('offline', 0)); // false
$criteria->setSort('date');
$criteria->setOrder("DESC");
$criteria->setLimit($options[1]);
+ $downloads = $download_handler->getObjects($criteria);
- $downloads = $wfdownloads->getHandler('download')->getObjects($criteria);
-
foreach (array_keys($downloads) as $i) {
$download = $downloads[$i]->toArray();
- if (!in_array((int)($download['cid']), $allowed_cats)) {
+ if (!in_array((int)$download['cid'], $allowed_cats)) {
continue;
}
$download['title'] = xoops_substr($download['title'], 0, ($options[2] -1));
$download['id'] = (int)($download['lid']);
if ($options[0] == "published") {
- $download['date'] = formatTimestamp($download['published'], $wfModuleConfig['dateformat']);
+ $download['date'] = formatTimestamp($download['published'], $wfModule_config['dateformat']);
}
$download['dirname'] = $wfModule->dirname();
$block['downloads'][] = $download;
}
- $allsubcats_linked_totop = $wfdownloads->getHandler('category')->getAllSubcatsTopParentCid();
+ $allsubcats_linked_totop = $category_handler->getAllSubcatsTopParentCid();
- foreach($wfdownloads->getHandler('category')->topCategories as $topcid) {
- $block['topcats'][$topcid]['title'] = $wfdownloads->getHandler('category')->allCategories[$topcid]->getVar('title');
- $block['topcats'][$topcid]['imgurl'] = $wfdownloads->getHandler('category')->allCategories[$topcid]->getVar('imgurl');
+ foreach($category_handler->topCategories as $topcid) {
+ $block['topcats'][$topcid]['title'] = $category_handler->allCategories[$topcid]->getVar('title');
+ $block['topcats'][$topcid]['imgurl'] = $category_handler->allCategories[$topcid]->getVar('imgurl');
}
foreach($block['downloads'] as $k=>$v) {
Modified: XoopsModules/wfdownloads/trunk/wfdownloads/brokenfile.php
===================================================================
--- XoopsModules/wfdownloads/trunk/wfdownloads/brokenfile.php 2013-08-24 04:38:58 UTC (rev 11967)
+++ XoopsModules/wfdownloads/trunk/wfdownloads/brokenfile.php 2013-08-24 07:36:27 UTC (rev 11968)
@@ -21,21 +21,19 @@
$currentFile = basename(__FILE__);
include 'header.php';
+$lid = WfdownloadsRequest::getInt('lid', 0);
+$download = $wfdownloads->getHandler('download')->get($lid);
+
if (!empty($_POST['submit'])) {
- $lid = WfdownloadsRequest::getInt('lid', 0, 'POST');
- $download = $wfdownloads->getHandler('download')->get($lid);
+ // Download not published, expired or taken offline - redirect
if ($download->getVar('published') == 0 || $download->getVar('published') > time() || $download->getVar('offline') == true || ($download->getVar('expired') == true && $download->getVar('expired') < time()) || $download->getVar('status') == 0) {
- //Download not published, expired or taken offline - redirect
redirect_header('index.php', 3, _MD_WFD_NODOWNLOAD);
}
- $sender = (is_object($xoopsUser)) ? $xoopsUser->getVar('uid') : 0;
- $ip = getenv("REMOTE_ADDR");
- $time = time();
+ $senderUid = is_object($xoopsUser) ? (int)$xoopsUser->getVar('uid') : 0;
+ $senderIp = getenv("REMOTE_ADDR");
- /*
- * Check if REG user is trying to report twice.
- */
+ // Check if REG user is trying to report twice
$criteria = new Criteria("lid", $lid);
$count = $wfdownloads->getHandler('report')->getCount($criteria);
if ($count > 0) {
@@ -43,8 +41,8 @@
} else {
$report = $wfdownloads->getHandler('report')->create();
$report->setVar('lid', $lid);
- $report->setVar('sender', $sender);
- $report->setVar('ip', $ip);
+ $report->setVar('sender', $senderUid);
+ $report->setVar('ip', $senderIp);
$report->setVar('date', time());
$report->setVar('confirmed', 0);
$report->setVar('acknowledged', 0);
@@ -54,12 +52,10 @@
$tags['BROKENREPORTS_URL'] = WFDOWNLOADS_URL . '/admin/reportsmodifications.php?op=reports.modifications.list';
$notification_handler->triggerEvent('global', 0, 'file_broken', $tags);
- /**
- * Send email to the owner of the download stating that it is broken
- */
+ // Send email to the owner of the download stating that it is broken
$user = $member_handler->getUser($download->getVar('submitter'));
$subdate = formatTimestamp($download->getVar('published'), $wfdownloads->getConfig('dateformat'));
- $cid = (int)($download->getVar('cid'));
+ $cid = $download->getVar('cid');
$title = $download->getVar('title');
$subject = _MD_WFD_BROKENREPORTED;
@@ -85,16 +81,12 @@
exit();
}
} else {
- $lid = WfdownloadsRequest::getInt('lid', 0, 'GET');
- $download = $wfdownloads->getHandler('download')->get($lid);
+ // Download not published, expired or taken offline - redirect
if ($download->getVar('published') == 0 || $download->getVar('published') > time() || $download->getVar('offline') == true || ($download->getVar('expired') == true && $download->getVar('expired') < time())) {
- //Download not published, expired or taken offline - redirect
redirect_header('index.php', 3, _MD_WFD_NODOWNLOAD);
}
- /**
- * Begin Main page Heading etc
- */
+ // Begin Main page Heading etc
$catarray['imageheader'] = wfd_imageheader();
$xoopsOption['template_main'] = 'wfdownloads_brokenfile.html';
@@ -109,7 +101,7 @@
$broken['title'] = trim($download->getVar('title'));
$broken['id'] = $report_obj->getVar('reportid');
- $broken['reporter'] = XoopsUserUtility::getUnameFromId(intval($report_obj->getVar('sender')));
+ $broken['reporter'] = XoopsUserUtility::getUnameFromId((int)$report_obj->getVar('sender'));
$broken['date'] = formatTimestamp($report_obj->getVar('published'), $wfdownloads->getConfig('dateformat'));
$broken['acknowledged'] = ($report_obj->getVar('acknowledged') == 1) ? _YES : _NO ;
$broken['confirmed'] = ($report_obj->getVar('confirmed') == 1) ? _YES : _NO ;
@@ -117,19 +109,16 @@
$xoopsTpl->assign('broken', $broken);
$xoopsTpl->assign('brokenreport', true);
} else {
- /**
- * file info
- */
+ // file info
$down['title'] = trim($download->getVar('title'));
$down['homepage'] = $myts->makeClickable(formatURL(trim($download->getVar('homepage'))));
$time = ($download->getVar('updated') != false) ? $download->getVar('updated') : $download->getVar('published');
$down['updated'] = formatTimestamp($time, $wfdownloads->getConfig('dateformat'));
$is_updated = ($download->getVar('updated') != false) ? _MD_WFD_UPDATEDON : _MD_WFD_SUBMITDATE;
- $down['publisher'] = XoopsUserUtility::getUnameFromId(intval($download->getVar('submitter')));
+ $down['publisher'] = XoopsUserUtility::getUnameFromId((int)$download->getVar('submitter'));
$xoopsTpl->assign('file_id', $lid);
$xoopsTpl->assign('lang_subdate' , $is_updated);
-
$xoopsTpl->assign('is_updated', $download->getVar('updated'));
$xoopsTpl->assign('lid', $lid);
$xoopsTpl->assign('down', $down);
Modified: XoopsModules/wfdownloads/trunk/wfdownloads/class/category.php
===================================================================
--- XoopsModules/wfdownloads/trunk/wfdownloads/class/category.php 2013-08-24 04:38:58 UTC (rev 11967)
+++ XoopsModules/wfdownloads/trunk/wfdownloads/class/category.php 2013-08-24 07:36:27 UTC (rev 11968)
@@ -39,9 +39,9 @@
$this->initVar('doimage', XOBJ_DTYPE_INT, true); // boolean
$this->initVar('dobr', XOBJ_DTYPE_INT, true); // boolean
$this->initVar('weight', XOBJ_DTYPE_INT, 0);
- // added - start - March 4 2006 - jpc
+ //added formulize support (2006/05/04) jpc - start
$this->initVar('formulize_fid', XOBJ_DTYPE_INT, 0);
- // added - end - March 4 2006 - jpc
+ //added formulize support (2006/05/04) jpc - end
}
function getForm($action = false)
@@ -117,46 +117,49 @@
$options_tray -> addElement($breaks_checkbox);
$form -> addElement($options_tray);
- // added - start - March 4 2006 - jpc
- if(file_exists(XOOPS_ROOT_PATH . "/modules/formulize/include/functions.php")) {
- include_once XOOPS_ROOT_PATH . "/modules/formulize/include/functions.php";
- $fids = allowedForms();
- $fids_select = array();
- $fids_select[0] = _AM_WFD_FFS_STANDARD_FORM;
- foreach( $fids as $fid )
- $fids_select[$fid] = getFormTitle($fid);
-
- $formulize_forms = new XoopsFormSelect(_AM_WFD_FFS_CUSTOM_FORM, "formulize_fid", $this->getVar('formulize_fid') );
- $formulize_forms -> addOptionArray( $fids_select );
- $form -> addElement($formulize_forms);
+ //added formulize support (2006/05/04) jpc - start
+ if (xoops_isActiveModule('formulize')) {
+ if(file_exists(XOOPS_ROOT_PATH . "/modules/formulize/include/functions.php")) {
+ include_once XOOPS_ROOT_PATH . "/modules/formulize/include/functions.php";
+ $fids = allowedForms();
+ $fids_select = array();
+ $fids_select[0] = _AM_WFD_FFS_STANDARD_FORM;
+ foreach( $fids as $fid )
+ $fids_select[$fid] = getFormTitle($fid);
+
+ $formulize_forms = new XoopsFormSelect(_AM_WFD_FFS_CUSTOM_FORM, "formulize_fid", $this->getVar('formulize_fid') );
+ $formulize_forms->addOptionArray( $fids_select );
+ $form -> addElement($formulize_forms);
+ }
}
- // added - end - March 4 2006 - jpc
+ //added formulize support (2006/05/04) jpc - end
$button_tray = new XoopsFormElementTray('', '');
- $hidden = new XoopsFormHidden('op', 'save');
- $button_tray -> addElement($hidden);
+ $button_tray->addElement(new XoopsFormHidden('op', 'save'));
if ($this->isNew()) {
- $butt_create = new XoopsFormButton('', '', _AM_WFD_BSAVE, 'submit');
- $butt_create -> setExtra('onclick="this.form.elements.op.value=\'addCat\'"');
- $button_tray -> addElement($butt_create);
- $butt_clear = new XoopsFormButton('', '', _AM_WFD_BRESET, 'reset');
- $button_tray -> addElement($butt_clear);
- $butt_cancel = new XoopsFormButton('', '', _AM_WFD_BCANCEL, 'button');
- $butt_cancel -> setExtra('onclick="history.go(-1)"');
- $button_tray -> addElement($butt_cancel);
+ $button_create = new XoopsFormButton('', '', _AM_WFD_BSAVE, 'submit');
+ $button_create->setExtra('onclick="this.form.elements.op.value=\'category.save\'"');
+ $button_tray->addElement($button_create);
+ $button_reset = new XoopsFormButton('', '', _AM_WFD_BRESET, 'reset');
+ $button_tray->addElement($button_reset);
+ $button_cancel = new XoopsFormButton('', '', _AM_WFD_BCANCEL, 'button');
+ $button_cancel->setExtra('onclick="history.go(-1)"');
+ $button_tray->addElement($button_cancel);
} else {
$form->addElement(new XoopsFormHidden('cid', $this->getVar('cid')));
- $butt_create = new XoopsFormButton('', '', _AM_WFD_BMODIFY, 'submit');
- $butt_create -> setExtra('onclick="this.form.elements.op.value=\'addCat\'"');
- $button_tray -> addElement($butt_create);
- $butt_delete = new XoopsFormButton('', '', _AM_WFD_BDELETE, 'submit');
- $butt_delete -> setExtra('onclick="this.form.elements.op.value=\'delCat\'"');
- $button_tray -> addElement($butt_delete);
- $butt_cancel = new XoopsFormButton('', '', _AM_WFD_BCANCEL, 'button');
- $butt_cancel -> setExtra('onclick="history.go(-1)"');
- $button_tray -> addElement($butt_cancel);
+ $button_create = new XoopsFormButton('', '', _AM_WFD_BMODIFY, 'submit');
+ $button_create->setExtra('onclick="this.form.elements.op.value=\'category.save\'"');
+ $button_tray->addElement($button_create);
+ $button_delete = new XoopsFormButton('', '', _AM_WFD_BDELETE, 'submit');
+ $button_delete->setExtra('onclick="this.form.elements.op.value=\'category.delete\'"');
+ $button_tray->addElement($button_delete);
+ $button_reset = new XoopsFormButton('', '', _AM_WFD_BRESET, 'reset');
+ $button_tray->addElement($button_reset);
+ $button_cancel = new XoopsFormButton('', '', _AM_WFD_BCANCEL, 'button');
+ $button_cancel->setExtra('onclick="history.go(-1)"');
+ $button_tray->addElement($button_cancel);
}
- $form -> addElement($button_tray);
+ $form->addElement($button_tray);
return $form;
}
}
Modified: XoopsModules/wfdownloads/trunk/wfdownloads/class/download.php
===================================================================
--- XoopsModules/wfdownloads/trunk/wfdownloads/class/download.php 2013-08-24 04:38:58 UTC (rev 11967)
+++ XoopsModules/wfdownloads/trunk/wfdownloads/class/download.php 2013-08-24 07:36:27 UTC (rev 11968)
@@ -73,15 +73,15 @@
$this->initVar('doimage', XOBJ_DTYPE_INT, 1, false); // boolean
$this->initVar('dobr', XOBJ_DTYPE_INT, 1, false); // boolean
- // added - start - March 4 2006 - jpc
+ //added formulize support (2006/05/04) jpc - start
$this->initVar('formulize_idreq', XOBJ_DTYPE_INT, 0);
- // added - end - March 4 2006 - jpc
- }
+ //added formulize support (2006/05/04) jpc - end
+ }
function getDownloadInfo() {
- global $xoopsConfig, $xoopsUser, $xoopsModule, $myts;
+ global $xoopsConfig, $xoopsUser, $myts;
xoops_load('XoopsUserUtility');
$wfdownloads = WfdownloadsWfdownloads::getInstance();
@@ -99,8 +99,8 @@
$down['use_mirrors'] = $use_mirrors;
$rating = round(number_format($this->getVar('rating'), 0) / 2);
- $rateimg = "rate$rating.gif";
- $down['rateimg'] = $rateimg;
+ $rateImage = "rate{$rating}.gif";
+ $down['rateimg'] = $rateImage;
$down['votes'] = ($this->getVar('votes') == 1) ? _MD_WFD_ONEVOTE : sprintf(_MD_WFD_NUMVOTES, $this->getVar('votes'));
$down['hits'] = $this->getVar('hits');
@@ -193,7 +193,7 @@
$summary = $this->getVar('summary');
if ($wfdownloads->getConfig('autosummary') == 1 || empty($summary))
{
- $sumlength = intval($wfdownloads->getConfig('autosumlength'));
+ $sumlength = (int)$wfdownloads->getConfig('autosumlength');
$sumdesc = stripslashes($this->getVar('description'));
if (strlen($sumdesc) > $sumlength) {
$sumdesc = substr($sumdesc, 0, $sumlength);
@@ -243,7 +243,7 @@
$down['mail_subject'] = rawurlencode(sprintf(_MD_WFD_INTFILEFOUND, $xoopsConfig['sitename']));
$down['mail_body'] = rawurlencode(sprintf(_MD_WFD_INTFILEFOUND, $xoopsConfig['sitename']) . ': ' . WFDOWNLOADS_URL . '/singlefile.php?cid=' . $down['cid'] . '&lid=' . $down['id']);
- $down['isadmin'] = (!empty($xoopsUser) && $xoopsUser->isAdmin($xoopsModule->mid())) ? true : false;
+ $down['isadmin'] = (!empty($xoopsUser) && $xoopsUser->isAdmin($wfdownloads->getModule()->mid())) ? true : false;
$down['adminlink'] = '';
if ($down['isadmin'] == true) {
@@ -264,18 +264,18 @@
$down['reviews_num'] = ($numrows) ? $numrows : 0;
- $finalrating = 0;
- $totalrating = 0;
+ $finalRating = 0;
+ $totalRating = 0;
while ($review_text = $xoopsDB->fetchArray($results)) {
- $totalrating += $review_text['rated'];
+ $totalRating += $review_text['rated'];
}
if ($down['reviews_num'] > 0) {
- $finalrating = $totalrating / $down['reviews_num'];
- $finalrating = round(number_format($finalrating, 0) / 2);
+ $finalRating = $totalRating / $down['reviews_num'];
+ $finalRating = round(number_format($finalRating, 0) / 2);
}
- $down['review_rateimg'] = "rate$finalrating.gif";;
+ $down['review_rateimg'] = "rate{$finalRating}.gif";;
$down['icons'] = wfd_displayicons($this->getVar('published'), $this->getVar('status'), $this->getVar('hits'));
@@ -291,17 +291,18 @@
- function getForm($customArray=array()) { // $custom array added April 22, 2006 by jwe) {
+ function getForm($customArray = array()) { // $custom array added April 22, 2006 by jwe) {
global $xoopsUser;
+
include XOOPS_ROOT_PATH . '/class/xoopsformloader.php';
- include_once(XOOPS_ROOT_PATH . "/class/tree.php");
+ include_once XOOPS_ROOT_PATH . '/class/tree.php';
$wfdownloads = WfdownloadsWfdownloads::getInstance();
$groups = $xoopsUser->getGroups();
$use_mirrors = $wfdownloads->getConfig('enable_mirrors');
- $sform = new XoopsThemeForm(_MD_WFD_SUBMITCATHEAD, "storyform", $_SERVER['REQUEST_URI']);
+ $sform = new XoopsThemeForm(_MD_WFD_SUBMITCATHEAD, 'storyform', $_SERVER['REQUEST_URI']);
$sform->setExtra('enctype="multipart/form-data"');
$sform->addElement(new XoopsFormText(_MD_WFD_FILETITLE, 'title', 50, 255, $this->getVar('title', 'e')), true);
@@ -318,7 +319,7 @@
}
// changed - start - March 4 2006 - jpc
- if(file_exists(XOOPS_ROOT_PATH . "/modules/formulize/include/functions.php")) {
+ if(file_exists(XOOPS_ROOT_PATH . '/modules/formulize/include/functions.php')) {
$sform->addElement(new XoopsFormHidden('cid', $this->getVar('cid', 'e')));
} else {
$categories = $wfdownloads->getHandler('category')->getUserUpCategories();
@@ -356,12 +357,12 @@
$sform->addElement($versiontypes_select);
$sform->addElement(new XoopsFormText(_MD_WFD_PRICEC, 'price', 10, 20, $this->getVar('price', 'e')), false);
- $sform->addElement(new XoopsFormDhtmlTextArea(_MD_WFD_SUMMARY, 'summary', $this->getVar('summary', 'e'), 10, 60, "smartHiddenSummary"), false);
- $sform->addElement(new XoopsFormDhtmlTextArea(_MD_WFD_DESCRIPTION, 'description', $this->getVar('description', 'e'), 15, 60, "smartHiddenDescription"), true);
+ $sform->addElement(new XoopsFormDhtmlTextArea(_MD_WFD_SUMMARY, 'summary', $this->getVar('summary', 'e'), 10, 60, 'smartHiddenSummary'), false);
+ $sform->addElement(new XoopsFormDhtmlTextArea(_MD_WFD_DESCRIPTION, 'description', $this->getVar('description', 'e'), 15, 60, 'smartHiddenDescription'), true);
$sform->addElement(new XoopsFormTextArea(_MD_WFD_KEYFEATURESC, 'features', $this->getVar('features', 'e'), 7, 60), false);
$sform->addElement(new XoopsFormTextArea(_MD_WFD_REQUIREMENTSC, 'requirements', $this->getVar('requirements', 'e'), 7, 60), false);
} else { // if we are using a custom form, then add in the form's elements here
- $sform->addElement(new XoopsFormDhtmlTextArea(_MD_WFD_DESCRIPTION, 'description', $this->getVar('description', 'e'), 15, 60, "smartHiddenDescription"), true);
+ $sform->addElement(new XoopsFormDhtmlTextArea(_MD_WFD_DESCRIPTION, 'description', $this->getVar('description', 'e'), 15, 60, 'smartHiddenDescription'), true);
$sform -> addElement(new XoopsFormHidden('size', $this->getVar('size', 'e')));
$sform = compileElements($customArray['fid'], $sform, $customArray['formulize_mgr'], $customArray['prevEntry'], $customArray['entry'], $customArray['go_back'], $customArray['pa...
[truncated message content] |