|
From: <luc...@us...> - 2013-08-27 22:17:05
|
Revision: 11987
http://sourceforge.net/p/xoops/svn/11987
Author: luciorota
Date: 2013-08-27 22:17:02 +0000 (Tue, 27 Aug 2013)
Log Message:
-----------
use breadcrumb object (in_progress)
code cleanup
Modified Paths:
--------------
XoopsModules/wfdownloads/trunk/wfdownloads/admin/index.php
XoopsModules/wfdownloads/trunk/wfdownloads/brokenfile.php
XoopsModules/wfdownloads/trunk/wfdownloads/class/category.php
XoopsModules/wfdownloads/trunk/wfdownloads/index.php
XoopsModules/wfdownloads/trunk/wfdownloads/mirror.php
XoopsModules/wfdownloads/trunk/wfdownloads/ratefile.php
XoopsModules/wfdownloads/trunk/wfdownloads/review.php
XoopsModules/wfdownloads/trunk/wfdownloads/singlefile.php
XoopsModules/wfdownloads/trunk/wfdownloads/templates/wfdownloads_brokenfile.html
XoopsModules/wfdownloads/trunk/wfdownloads/templates/wfdownloads_common_breadcrumb.html
XoopsModules/wfdownloads/trunk/wfdownloads/templates/wfdownloads_header.html
XoopsModules/wfdownloads/trunk/wfdownloads/templates/wfdownloads_ratefile.html
XoopsModules/wfdownloads/trunk/wfdownloads/templates/wfdownloads_viewcat.html
XoopsModules/wfdownloads/trunk/wfdownloads/viewcat.php
Modified: XoopsModules/wfdownloads/trunk/wfdownloads/admin/index.php
===================================================================
--- XoopsModules/wfdownloads/trunk/wfdownloads/admin/index.php 2013-08-27 21:19:22 UTC (rev 11986)
+++ XoopsModules/wfdownloads/trunk/wfdownloads/admin/index.php 2013-08-27 22:17:02 UTC (rev 11987)
@@ -121,7 +121,7 @@
$redirectFile = $_SERVER['PHP_SELF'];
if (!wfdownload_checkModule('formulize'))
- $indexAdmin->addConfigBoxLine(_AM_WFD_FORMULIZE_NOT_AVAILABLE);
+ $indexAdmin->addConfigBoxLine(_AM_WFD_FORMULIZE_NOT_AVILABLE);
else
$indexAdmin->addConfigBoxLine(_AM_WFD_FORMULIZE_AVAILABLE);
Modified: XoopsModules/wfdownloads/trunk/wfdownloads/brokenfile.php
===================================================================
--- XoopsModules/wfdownloads/trunk/wfdownloads/brokenfile.php 2013-08-27 21:19:22 UTC (rev 11986)
+++ XoopsModules/wfdownloads/trunk/wfdownloads/brokenfile.php 2013-08-27 22:17:02 UTC (rev 11987)
@@ -23,105 +23,134 @@
$lid = WfdownloadsRequest::getInt('lid', 0);
$download = $wfdownloads->getHandler('download')->get($lid);
+$cid = WfdownloadsRequest::getInt('cid', $download->getVar('cid'));
+$category = $wfdownloads->getHandler('category')->get($cid);
-if (!empty($_POST['submit'])) {
- // 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) {
- redirect_header('index.php', 3, _MD_WFD_NODOWNLOAD);
- }
+// 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) {
+ redirect_header('index.php', 3, _MD_WFD_NODOWNLOAD);
+}
- $senderUid = is_object($xoopsUser) ? (int)$xoopsUser->getVar('uid') : 0;
- $senderIp = getenv("REMOTE_ADDR");
+// Breadcrumb
+include_once XOOPS_ROOT_PATH . "/class/tree.php";
+$categoriesTree = new XoopsObjectTree($wfdownloads->getHandler('category')->getObjects(), 'cid', 'pid');
+$breadcrumb = new WfdownloadsBreadcrumb();
+$breadcrumb->addLink($wfdownloads->getModule()->getVar('name'), WFDOWNLOADS_URL);
+foreach(array_reverse($categoriesTree->getAllParent($cid)) as $parentCategory) {
+ $breadcrumb->addLink($parentCategory->getVar('title'), "viewcat.php?cid=" . $parentCategory->getVar('cid'));
+}
+$breadcrumb->addLink($category->getVar('title'), "viewcat.php?cid={$cid}");
+$breadcrumb->addLink($download->getVar('title'), "singlefile.php?lid={$lid}");
- // Check if REG user is trying to report twice
- $criteria = new Criteria("lid", $lid);
- $count = $wfdownloads->getHandler('report')->getCount($criteria);
- if ($count > 0) {
- redirect_header('index.php', 2, _MD_WFD_ALREADYREPORTED);
- } else {
- $report = $wfdownloads->getHandler('report')->create();
- $report->setVar('lid', $lid);
- $report->setVar('sender', $senderUid);
- $report->setVar('ip', $senderIp);
- $report->setVar('date', time());
- $report->setVar('confirmed', 0);
- $report->setVar('acknowledged', 0);
- $wfdownloads->getHandler('report')->insert($report);
- $tags = array();
- $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
- $user = $member_handler->getUser($download->getVar('submitter'));
- $subdate = formatTimestamp($download->getVar('published'), $wfdownloads->getConfig('dateformat'));
- $cid = $download->getVar('cid');
- $title = $download->getVar('title');
- $subject = _MD_WFD_BROKENREPORTED;
+$op = WfdownloadsRequest::getCmd('op', 'report.add');
+switch ($op) {
+ case "report.add" :
+ default :
+ // Get report sender 'uid'
+ $senderUid = is_object($xoopsUser) ? (int)$xoopsUser->getVar('uid') : 0;
+ $senderIp = getenv('REMOTE_ADDR');
- $xoopsMailer = &getMailer();
- $xoopsMailer->useMail();
- $template_dir = WFDOWNLOADS_ROOT_PATH . "/language/" . $xoopsConfig['language'] . "/mail_template";
+ if (!empty($_POST['submit'])) {
+ // Check if REG user is trying to report twice
+ $criteria = new Criteria('lid', $lid);
+ $reportsCount = $wfdownloads->getHandler('report')->getCount($criteria);
+ if ($reportsCount > 0) {
+ redirect_header('index.php', 2, _MD_WFD_ALREADYREPORTED);
+ } else {
- $xoopsMailer->setTemplateDir($template_dir);
- $xoopsMailer->setTemplate('filebroken_notify.tpl');
- $xoopsMailer->setToEmails($user->email());
- $xoopsMailer->setFromEmail($xoopsConfig['adminmail']);
- $xoopsMailer->setFromName($xoopsConfig['sitename']);
- $xoopsMailer->assign("X_UNAME", $user->uname());
- $xoopsMailer->assign("SITENAME", $xoopsConfig['sitename']);
- $xoopsMailer->assign("X_ADMINMAIL", $xoopsConfig['adminmail']);
- $xoopsMailer->assign('X_SITEURL', XOOPS_URL . '/');
- $xoopsMailer->assign("X_TITLE", $title);
- $xoopsMailer->assign("X_SUB_DATE", $subdate);
- $xoopsMailer->assign('X_DOWNLOAD', WFDOWNLOADS_URL . '/singlefile.php?cid=' . $cid . '&lid=' . $lid);
- $xoopsMailer->setSubject($subject);
- $xoopsMailer->send();
- redirect_header('index.php', 2, _MD_WFD_BROKENREPORTED);
- exit();
- }
-} else {
- // 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())) {
- redirect_header('index.php', 3, _MD_WFD_NODOWNLOAD);
- }
+ $report = $wfdownloads->getHandler('report')->create();
+ $report->setVar('lid', $lid);
+ $report->setVar('sender', $senderUid);
+ $report->setVar('ip', $senderIp);
+ $report->setVar('date', time());
+ $report->setVar('confirmed', 0);
+ $report->setVar('acknowledged', 0);
+ if ($wfdownloads->getHandler('report')->insert($report)) {
+ // All is well.
+ // Send notification.
+ $tags = array();
+ $tags['BROKENREPORTS_URL'] = WFDOWNLOADS_URL . '/admin/reportsmodifications.php?op=reports.modifications.list';
+ $notification_handler->triggerEvent('global', 0, 'file_broken', $tags);
- // Begin Main page Heading etc
- $catarray['imageheader'] = wfd_imageheader();
+ // 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 = $download->getVar('cid');
+ $title = $download->getVar('title');
+ $subject = _MD_WFD_BROKENREPORTED;
- $xoopsOption['template_main'] = 'wfdownloads_brokenfile.html';
- include XOOPS_ROOT_PATH . '/header.php';
+ $xoopsMailer = &getMailer();
+ $xoopsMailer->useMail();
+ $template_dir = WFDOWNLOADS_ROOT_PATH . "/language/" . $xoopsConfig['language'] . "/mail_template";
- $xoopsTpl->assign('catarray', $catarray);
- xoops_load('XoopsUserUtility');
+ $xoopsMailer->setTemplateDir($template_dir);
+ $xoopsMailer->setTemplate('filebroken_notify.tpl');
+ $xoopsMailer->setToEmails($user->email());
+ $xoopsMailer->setFromEmail($xoopsConfig['adminmail']);
+ $xoopsMailer->setFromName($xoopsConfig['sitename']);
+ $xoopsMailer->assign("X_UNAME", $user->uname());
+ $xoopsMailer->assign("SITENAME", $xoopsConfig['sitename']);
+ $xoopsMailer->assign("X_ADMINMAIL", $xoopsConfig['adminmail']);
+ $xoopsMailer->assign('X_SITEURL', XOOPS_URL . '/');
+ $xoopsMailer->assign("X_TITLE", $title);
+ $xoopsMailer->assign("X_SUB_DATE", $subdate);
+ $xoopsMailer->assign('X_DOWNLOAD', WFDOWNLOADS_URL . "/singlefile.php?cid={$cid}&lid={$lid}");
+ $xoopsMailer->setSubject($subject);
+ $xoopsMailer->send();
+ redirect_header('index.php', 2, _MD_WFD_BROKENREPORTED);
+ exit();
+ } else {
+ echo $report->getHtmlErrors();
+ }
+ }
+ } else {
+ $xoopsOption['template_main'] = 'wfdownloads_brokenfile.html';
+ include XOOPS_ROOT_PATH . '/header.php';
- $report = $wfdownloads->getHandler('report')->getObjects(new Criteria('lid', $lid));
- if (isset($report[0])) {
- $report_obj = $report[0];
+ // Begin Main page Heading etc
+ $catarray['imageheader'] = wfd_imageheader();
+ $xoopsTpl->assign('catarray', $catarray);
- $broken['title'] = trim($download->getVar('title'));
- $broken['id'] = $report_obj->getVar('reportid');
- $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 ;
+ $xoTheme->addStylesheet(WFDOWNLOADS_URL . '/module.css');
+ $xoTheme->addStylesheet(WFDOWNLOADS_URL . '/thickbox.css');
+ $xoopsTpl->assign('wfdownloads_url', WFDOWNLOADS_URL . '/');
- $xoopsTpl->assign('broken', $broken);
- $xoopsTpl->assign('brokenreport', true);
- } else {
- // 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((int)$download->getVar('submitter'));
+ // Breadcrumb
+ $breadcrumb->addLink(_MD_WFD_REPORTBROKEN, '');
+ $xoopsTpl->assign('wfdownloads_breadcrumb', $breadcrumb->render());
- $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);
- }
- include_once XOOPS_ROOT_PATH . '/footer.php';
-}
+ xoops_load('XoopsUserUtility');
+ $report = $wfdownloads->getHandler('report')->getObjects(new Criteria('lid', $lid));
+ if (isset($report[0])) {
+ $report_obj = $report[0];
+
+ $broken['title'] = trim($download->getVar('title'));
+ $broken['id'] = $report_obj->getVar('reportid');
+ $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 ;
+
+ $xoopsTpl->assign('broken', $broken);
+ $xoopsTpl->assign('brokenreport', true);
+ } else {
+ // 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((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);
+ include 'footer.php';
+ }
+ }
+ break;
+}
\ No newline at end of file
Modified: XoopsModules/wfdownloads/trunk/wfdownloads/class/category.php
===================================================================
--- XoopsModules/wfdownloads/trunk/wfdownloads/class/category.php 2013-08-27 21:19:22 UTC (rev 11986)
+++ XoopsModules/wfdownloads/trunk/wfdownloads/class/category.php 2013-08-27 22:17:02 UTC (rev 11987)
@@ -176,7 +176,7 @@
function getNicePath($cid, $root_filename = "index.php", $item_filename = "viewcat.php?op=") {
include_once WFDOWNLOADS_ROOT_PATH . '"/class/xoopstree.php';
$mytree = new WfdownloadsXoopsTree($this->table, $this->keyName, "pid");
- $pathstring = $mytree->getNicePathFromId(intval($cid), $this->identifierName, $item_filename);
+ $pathstring = $mytree->getNicePathFromId($cid, $this->identifierName, $item_filename);
/**
* Replacing the " with ">" and deleteing the last ">" at the end
Modified: XoopsModules/wfdownloads/trunk/wfdownloads/index.php
===================================================================
--- XoopsModules/wfdownloads/trunk/wfdownloads/index.php 2013-08-27 21:19:22 UTC (rev 11986)
+++ XoopsModules/wfdownloads/trunk/wfdownloads/index.php 2013-08-27 22:17:02 UTC (rev 11987)
@@ -28,6 +28,13 @@
$xoTheme->addStylesheet(WFDOWNLOADS_URL . '/thickbox.css');
$xoopsTpl->assign('wfdownloads_url', WFDOWNLOADS_URL . '/');
+
+$breadcrumb = new WfdownloadsBreadcrumb();
+$breadcrumb->addLink($wfdownloads->getModule()->getVar('name'), WFDOWNLOADS_URL);
+
+$xoopsTpl->assign('module_home', wfdownloads_module_home(false)); // this definition is not removed for compatibility issues
+$xoopsTpl->assign('wfdownloads_breadcrumb', $breadcrumb->render());
+
$cat_criteria = new CriteriaCompo();
$cat_criteria->setSort('weight ASC, title');
$categories = $wfdownloads->getHandler('category')->getObjects($cat_criteria);
@@ -174,7 +181,6 @@
$lang_ThereAre = $count != 1 ? _MD_WFD_THEREARE : _MD_WFD_THEREIS;
$xoopsTpl->assign('lang_thereare', sprintf($lang_ThereAre, $count, array_sum($listings['count'])));
-$xoopsTpl->assign('module_home', wfdownloads_module_home(false));
if($wfdownloads->getConfig('enablerss') == 1) {
//$rsslink=sprintf("<a href='%s' title='%s'><img src='%s' border=0 alt='%s' title='%s'></a>", WFDOWNLOADS_URL . "/rss.php", _MD_WFD_LEGENDTEXTRSS, XOOPS_URL . "/" . $wfdownloads->getConfig('mainimagedir') . "/icon/rss.gif", _MD_WFD_LEGENDTEXTRSS); $xoopsTpl->assign('full_rssfeed_link', $rsslink);
Modified: XoopsModules/wfdownloads/trunk/wfdownloads/mirror.php
===================================================================
--- XoopsModules/wfdownloads/trunk/wfdownloads/mirror.php 2013-08-27 21:19:22 UTC (rev 11986)
+++ XoopsModules/wfdownloads/trunk/wfdownloads/mirror.php 2013-08-27 22:17:02 UTC (rev 11987)
@@ -21,32 +21,43 @@
$currentFile = basename(__FILE__);
include 'header.php';
-$cid = WfdownloadsRequest::getInt('cid', 0);
+$lid = WfdownloadsRequest::getInt('lid', 0);
+$download = $wfdownloads->getHandler('download')->get($lid);
+$cid = WfdownloadsRequest::getInt('cid', $download->getVar('cid'));
+$category = $wfdownloads->getHandler('category')->get($cid);
+// Download not published, expired or taken offline - redirect
+if ($download->getVar('published') == 0 || $download->getVar('published') > time() || $download->getVar('offline') == 1 || ($download->getVar('expired') != 0 && $download->getVar('expired') < time()) || $download->getVar('status') == 0) {
+ redirect_header('index.php', 3, _MD_WFD_NODOWNLOAD);
+}
+
// Check permissions
+if ($wfdownloads->getConfig('enable_mirrors') == false && ((is_object($xoopsUser) && !$xoopsUser->isAdmin()) || !is_object($xoopsUser))) {
+ redirect_header('index.php', 3, _NOPERM);
+}
$groups = is_object($xoopsUser) ? $xoopsUser->getGroups() : array(0 => XOOPS_GROUP_ANONYMOUS);
if (!$gperm_handler->checkRight('WFDownCatPerm', $cid, $groups, $wfdownloads->getModule()->mid())) {
redirect_header('index.php', 3, _NOPERM);
}
-if ($wfdownloads->getConfig('enable_mirrors') == false && ((is_object($xoopsUser) && !$xoopsUser->isAdmin()) || !is_object($xoopsUser))) {
- redirect_header('index.php', 3, _NOPERM);
+
+// Breadcrumb
+include_once XOOPS_ROOT_PATH . "/class/tree.php";
+$categoriesTree = new XoopsObjectTree($wfdownloads->getHandler('category')->getObjects(), 'cid', 'pid');
+$breadcrumb = new WfdownloadsBreadcrumb();
+$breadcrumb->addLink($wfdownloads->getModule()->getVar('name'), WFDOWNLOADS_URL);
+foreach(array_reverse($categoriesTree->getAllParent($cid)) as $parentCategory) {
+ $breadcrumb->addLink($parentCategory->getVar('title'), "viewcat.php?cid=" . $parentCategory->getVar('cid'));
}
+$breadcrumb->addLink($category->getVar('title'), "viewcat.php?cid={$cid}");
+$breadcrumb->addLink($download->getVar('title'), "singlefile.php?lid={$lid}");
$op = WfdownloadsRequest::getString('op', 'mirror.add');
switch ($op) {
- case "mirrors.list";
- $cid = WfdownloadsRequest::getInt('cid', 0);
- $lid = WfdownloadsRequest::getInt('lid', 0);
+ case "mirrors.list" :
$start = WfdownloadsRequest::getInt('start', 0);
- $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') == 1 || ($download->getVar('expired') != 0 && $download->getVar('expired') < time()) || $download->getVar('status') == 0) {
- redirect_header('index.php', 3, _MD_WFD_NODOWNLOAD);
- }
-
$xoopsOption['template_main'] = 'wfdownloads_mirrors.html';
include XOOPS_ROOT_PATH . '/header.php';
@@ -54,29 +65,29 @@
$xoTheme->addStylesheet(WFDOWNLOADS_URL . '/thickbox.css');
$xoopsTpl->assign('wfdownloads_url', WFDOWNLOADS_URL . '/');
+ // Generate content header
$sql = "SELECT * FROM " . $xoopsDB->prefix('wfdownloads_indexpage') . " ";
$head_arr = $xoopsDB->fetchArray($xoopsDB->query($sql));
-
$catarray['imageheader'] = wfd_imageheader();
$catarray['letters'] = wfdownloads_lettersChoice();
$catarray['toolbar'] = wfd_toolbar();
$xoopsTpl->assign('catarray', $catarray);
-
- $category = $wfdownloads->getHandler('category')->get($cid);
- $pathstring = $wfdownloads->getHandler('category')->getNicePath($cid);
- $xoopsTpl->assign('category_path', $pathstring);
+ $xoopsTpl->assign('category_path', $wfdownloads->getHandler('category')->getNicePath($cid));
$xoopsTpl->assign('category_id', $cid);
+ // Count mirrors
$criteria = new CriteriaCompo(new Criteria("lid", $lid));
$criteria->add(new Criteria("submit", 1)); // true
- $mirror_amount = $wfdownloads->getHandler('mirror')->getCount($criteria);
- $criteria->setSort("date");
+ $mirrorsCount = $wfdownloads->getHandler('mirror')->getCount($criteria);
+
+ // Get mirrors
+ $criteria->setSort('date');
$criteria->setLimit(5);
$criteria->setStart($start);
$mirrors = $wfdownloads->getHandler('mirror')->getObjects($criteria);
- $down_arr = $download->toArray();
- $xoopsTpl->assign('down_arr', $down_arr);
+ $download_array = $download->toArray();
+ $xoopsTpl->assign('down_arr', $download_array);
$add_mirror = false;
if (!is_object($xoopsUser) && ($wfdownloads->getConfig('anonpost') == 3 || $wfdownloads->getConfig('anonpost') == 4) && ($wfdownloads->getConfig('submissions') == 3 || $wfdownloads->getConfig('submissions') == 4)) {
@@ -85,54 +96,57 @@
$add_mirror = true;
}
- foreach (array_keys($mirrors) as $i) {
- $down_mirror = $mirrors[$i]->toArray();
+ foreach ($mirrors as $mirror) {
+ $mirror_array = $mirror->toArray();
if ($wfdownloads->getConfig('enable_onlinechk') == 1) {
- $serverURL = str_replace('http://', '', trim($down_mirror['homeurl']));
- $down_mirror['isonline'] = wfdownloads_mirrorOnline($serverURL);
+ $serverURL = str_replace('http://', '', trim($mirror_array['homeurl']));
+ $mirror_array['isonline'] = wfdownloads_mirrorOnline($serverURL);
} else {
- $down_mirror['isonline'] = 2;
+ $mirror_array['isonline'] = 2;
}
- $down_mirror['add_mirror'] = $add_mirror;
- $down_mirror['date'] = formatTimestamp($down_mirror['date'], $wfdownloads->getConfig('dateformat'));
- $down_mirror['submitter'] = XoopsUserUtility::getUnameFromId($down_mirror['uid']);
- $xoopsTpl->append('down_mirror', $down_mirror);
+ $mirror_array['add_mirror'] = $add_mirror;
+ $mirror_array['date'] = formatTimestamp($mirror_array['date'], $wfdownloads->getConfig('dateformat'));
+ $mirror_array['submitter'] = XoopsUserUtility::getUnameFromId($mirror_array['uid']);
+ $xoopsTpl->append('down_mirror', $mirror_array);
}
- $xoopsTpl->assign('lang_mirror_found', sprintf(_MD_WFD_MIRROR_TOTAL, $mirror_amount));
+ $xoopsTpl->assign('lang_mirror_found', sprintf(_MD_WFD_MIRROR_TOTAL, $mirrorsCount));
include_once XOOPS_ROOT_PATH . '/class/pagenav.php';
- $pagenav = new XoopsPageNav($mirror_amount, 5 , $start, 'start', "op=list&cid={$cid}&lid={$lid}", 1);
+ $pagenav = new XoopsPageNav($mirrorsCount, 5 , $start, 'start', "op=mirrors.list&cid={$cid}&lid={$lid}", 1);
$navbar['navbar'] = $pagenav->renderNav();
$xoopsTpl->assign('navbar', $navbar);
- $xoopsTpl->assign('categoryPath', $pathstring . " > " . $down_arr['title']);
+ $xoopsTpl->assign('categoryPath', $pathstring . " > " . $download_array['title']);
$xoopsTpl->assign('module_home', wfdownloads_module_home(true));
include 'footer.php';
break;
- case "mirror.add";
- case "default" :
+ case "mirror.add" :
default :
+ // Check if ANONYMOUS user can post mirrors
if (!is_object($xoopsUser) && ($wfdownloads->getConfig('anonpost') == 1 || $wfdownloads->getConfig('anonpost') == 2)) {
redirect_header(XOOPS_URL . '/user.php', 1, _MD_WFD_MUSTREGFIRST);
exit();
- } elseif (is_object($xoopsUser) && ($wfdownloads->getConfig('submissions') == 1 || $wfdownloads->getConfig('submissions') == 2) && !$xoopsUser->isAdmin()) {
+ }
+ // Check if user can submit mirrors
+ if (is_object($xoopsUser) && ($wfdownloads->getConfig('submissions') == 1 || $wfdownloads->getConfig('submissions') == 2) && !$xoopsUser->isAdmin()) {
redirect_header('index.php', 1, _MD_WFD_MIRROR_NOTALLOWESTOSUBMIT);
exit();
}
+ // Get mirror poster 'uid'
+ $mirroruserUid = is_object($xoopsUser) ? (int)$xoopsUser->getVar('uid') : 0;
+
if (!empty($_POST['submit'])) {
- $uid = is_object($xoopsUser) ? (int)$xoopsUser->getVar('uid') : 0;
-
$mirror = $wfdownloads->getHandler('mirror')->create();
- $mirror->setVar('title', trim($_POST["title"]));
- $mirror->setVar('homeurl', formatURL(trim($_POST["homeurl"])));
- $mirror->setVar('location', trim($_POST["location"]));
- $mirror->setVar('continent', trim($_POST["continent"]));
- $mirror->setVar('downurl', trim($_POST["downurl"]));
- $mirror->setVar('lid', (int)$_POST["lid"]);
- $mirror->setVar('uid', $uid);
+ $mirror->setVar('title', trim($_POST['title']));
+ $mirror->setVar('homeurl', formatURL(trim($_POST['homeurl'])));
+ $mirror->setVar('location', trim($_POST['location']));
+ $mirror->setVar('continent', trim($_POST['continent']));
+ $mirror->setVar('downurl', trim($_POST['downurl']));
+ $mirror->setVar('lid', (int)$_POST['lid']);
+ $mirror->setVar('uid', $mirroruserUid);
$mirror->setVar('date', time());
if (($wfdownloads->getConfig('autoapprove') == 1 || $wfdownloads->getConfig('autoapprove') == 2) && !$wfdownloads_isAdmin) {
$approve = false;
@@ -150,21 +164,25 @@
}
} else {
include XOOPS_ROOT_PATH . '/header.php';
- include XOOPS_ROOT_PATH . '/class/xoopsformloader.php';
- $uid = is_object($xoopsUser) ? (int)$xoopsUser->getVar('uid') : 0;
$xoTheme->addStylesheet(WFDOWNLOADS_URL . '/module.css');
$xoTheme->addStylesheet(WFDOWNLOADS_URL . '/thickbox.css');
$xoopsTpl->assign('wfdownloads_url', WFDOWNLOADS_URL . '/');
+ // Breadcrumb
+ $breadcrumb->addLink(_MD_WFD_ADDMIRROR, '');
+ echo $breadcrumb->render();
+
echo "<div align='center'>" . wfd_imageheader() . "</div><br />\n";
echo "<div>" . _MD_WFD_MIRROR_SNEWMNAMEDESC . "</div>\n";
- $sform = new XoopsThemeForm(_MD_WFD_MIRROR_SUBMITMIRROR, "mirrorform", xoops_getenv('PHP_SELF'));
+ // Generate form
+ include XOOPS_ROOT_PATH . '/class/xoopsformloader.php';
+ $sform = new XoopsThemeForm(_MD_WFD_MIRROR_SUBMITMIRROR, 'mirrorform', xoops_getenv('PHP_SELF'));
$sform->addElement(new XoopsFormText(_MD_WFD_MIRROR_HOMEURLTITLE, 'title', 50, 255), true);
$sform->addElement(new XoopsFormText(_MD_WFD_MIRROR_HOMEURL, 'homeurl', 50, 255), true);
$sform->addElement(new XoopsFormText(_MD_WFD_MIRROR_LOCATION, 'location', 50, 255), true);
- $continent_select = new XoopsFormSelect(_MD_WFD_MIRROR_CONTINENT, "continent");
+ $continent_select = new XoopsFormSelect(_MD_WFD_MIRROR_CONTINENT, 'continent');
$continent_select->addOptionArray(array(
_MD_WFD_CONT1 => _MD_WFD_CONT1,
_MD_WFD_CONT2 => _MD_WFD_CONT2,
@@ -175,9 +193,9 @@
_MD_WFD_CONT7 => _MD_WFD_CONT7));
$sform->addElement($continent_select);
$sform->addElement(new XoopsFormText(_MD_WFD_MIRROR_DOWNURL, 'downurl', 50, 255), true);
- $sform->addElement(new XoopsFormHidden("lid", (int)$_GET['lid']));
- $sform->addElement(new XoopsFormHidden("cid", (int)$_GET['cid']));
- $sform->addElement(new XoopsFormHidden("uid", $uid));
+ $sform->addElement(new XoopsFormHidden('lid', $lid));
+ $sform->addElement(new XoopsFormHidden('cid', $cid));
+ $sform->addElement(new XoopsFormHidden('uid', $mirroruserUid));
$button_tray = new XoopsFormElementTray('', '');
$button_tray->addElement(new XoopsFormButton('', 'submit', _SUBMIT, 'submit'));
$sform->addElement($button_tray);
Modified: XoopsModules/wfdownloads/trunk/wfdownloads/ratefile.php
===================================================================
--- XoopsModules/wfdownloads/trunk/wfdownloads/ratefile.php 2013-08-27 21:19:22 UTC (rev 11986)
+++ XoopsModules/wfdownloads/trunk/wfdownloads/ratefile.php 2013-08-27 22:17:02 UTC (rev 11987)
@@ -22,86 +22,103 @@
include 'header.php';
$lid = WfdownloadsRequest::getInt('lid', 0);
-$cid = WfdownloadsRequest::getInt('cid', 0);
-
-// Get download
$download = $wfdownloads->getHandler('download')->get($lid);
+$cid = WfdownloadsRequest::getInt('cid', $download->getVar('cid'));
+$category = $wfdownloads->getHandler('category')->get($cid);
-if (!empty($_POST['submit'])) {
- //Download not published, expired or taken offline - redirect
- if ($download->getVar('published') == false || $download->getVar('published') > time() || $download->getVar('offline') == true || ($download->getVar('expired') !=0 && $download->getVar('expired') < time()) || $download->getVar('status') == 0) {
- redirect_header("index.php", 3, _MD_WFD_NODOWNLOAD);
- }
+// Download not published, expired or taken offline - redirect
+if ($download->getVar('published') == false || $download->getVar('published') > time() || $download->getVar('offline') == true || ($download->getVar('expired') != 0 && $download->getVar('expired') < time())) {
+ redirect_header("index.php", 3, _MD_WFD_NODOWNLOAD);
+}
- $ratinguserUid = is_object($xoopsUser) ? (int)$xoopsUser->getVar('uid') : 0;
- $ratinguserIp = getenv("REMOTE_ADDR");
-
- $rating = WfdownloadsRequest::getString('rating', '--', 'POST');
+// Breadcrumb
+include_once XOOPS_ROOT_PATH . "/class/tree.php";
+$categoriesTree = new XoopsObjectTree($wfdownloads->getHandler('category')->getObjects(), 'cid', 'pid');
+$breadcrumb = new WfdownloadsBreadcrumb();
+$breadcrumb->addLink($wfdownloads->getModule()->getVar('name'), WFDOWNLOADS_URL);
+foreach(array_reverse($categoriesTree->getAllParent($cid)) as $parentCategory) {
+ $breadcrumb->addLink($parentCategory->getVar('title'), "viewcat.php?cid=" . $parentCategory->getVar('cid'));
+}
+$breadcrumb->addLink($category->getVar('title'), "viewcat.php?cid={$cid}");
+$breadcrumb->addLink($download->getVar('title'), "singlefile.php?lid={$lid}");
- // Check if Rating is Null
- if ($rating == '--') {
- redirect_header("ratefile.php?cid={$cid}&lid={$lid}", 4, _MD_WFD_NORATING);
- exit();
- }
- if ($ratinguserUid != 0) {
- // Check if Download POSTER is voting (UNLESS Anonymous users allowed to post)
- if ($download->getVar('submitter') == $ratinguserUid) {
- redirect_header(WFDOWNLOADS_URL . "/singlefile.php?cid={$cid}&lid={$lid}", 4, _MD_WFD_CANTVOTEOWN);
- exit();
- }
- // Check if REG user is trying to vote twice.
- $criteria = new CriteriaCompo(new Criteria("lid", $lid));
- $criteria->add(new Criteria("ratinguser", $ratinguserUid));
- $ratingcount = $wfdownloads->getHandler('rating')->getCount($criteria);
- if ($ratingcount > 0) {
- redirect_header("singlefile.php?cid={$cid}&lid={$lid}", 4, _MD_WFD_VOTEONCE);
- exit();
- }
- } else {
- // Check if ANONYMOUS user is trying to vote more than once per day (only 1 anonymous from an IP in a single day).
- $anonymousWaitDays = 1;
- $yesterday = (time() - (86400 * $anonymousWaitDays));
- $criteria = new CriteriaCompo(new Criteria("lid", $lid));
- $criteria->add(new Criteria("ratinguser", 0));
- $criteria->add(new Criteria("ratinghostname", $ratinguserIp));
- $criteria->add(new Criteria("ratingtimestamp", $yesterday, ">"));
- $anonymousVotesCount = $wfdownloads->getHandler('rating')->getCount($criteria);
- if ($anonymousVotesCount > 0) {
- redirect_header("singlefile.php?cid={$cid}&lid={$lid}", 4, _MD_WFD_VOTEONCE);
- exit();
- }
- }
- // All is well. Add to Line Item Rate to DB.
- $rating = $wfdownloads->getHandler('rating')->create();
- $rating->setVar("lid", $lid);
- $rating->setVar("ratinguser", $ratinguserUid);
- $rating->setVar("rating", (int)$rating);
- $rating->setVar("ratinghostname", $ratinguserIp);
- $rating->setVar("ratingtimestamp", time());
- if ($wfdownloads->getHandler('rating')->insert($rating)) {
- // All is well. Calculate Score & Add to Summary (for quick retrieval & sorting) to DB.
- wfd_updaterating($lid);
- $thankyouMessage = _MD_WFD_VOTEAPPRE . "<br />" . sprintf(_MD_WFD_THANKYOU, $xoopsConfig['sitename']);
- redirect_header("singlefile.php?cid={$cid}&lid={$lid}", 4, $thankyouMessage);
- } else {
- echo $rating->getHtmlErrors();
- }
-} else {
- if ($download->getVar('published') == false || $download->getVar('published') > time() || $download->getVar('offline') == true || ($download->getVar('expired') != 0 && $download->getVar('expired') < time())) {
- //Download not published, expired or taken offline - redirect
- redirect_header("index.php", 3, _MD_WFD_NODOWNLOAD);
- }
- $xoopsOption['template_main'] = 'wfdownloads_ratefile.html';
- include XOOPS_ROOT_PATH . '/header.php';
-
- $xoTheme->addStylesheet(WFDOWNLOADS_URL . '/module.css');
- $xoTheme->addStylesheet(WFDOWNLOADS_URL . '/thickbox.css');
- $xoopsTpl->assign('wfdownloads_url', WFDOWNLOADS_URL . '/');
- $imageHeader = wfd_imageheader();
+$op = WfdownloadsRequest::getCmd('op', 'vote.add');
+switch ($op) {
+ case "vote.add" :
+ default :
+ // Get vote poster 'uid'
+ $ratinguserUid = is_object($xoopsUser) ? (int)$xoopsUser->getVar('uid') : 0;
+ $ratinguserIp = getenv("REMOTE_ADDR");
- $xoopsTpl -> assign('file', array('id' => $lid, 'lid' => $lid, 'cid' => $cid, 'title' => $download->getVar('title'), 'imageheader' => $imageHeader));
- include XOOPS_ROOT_PATH . '/footer.php';
-}
-include 'footer.php';
+ if (!empty($_POST['submit'])) {
+ $rating = WfdownloadsRequest::getString('rating', '--', 'POST');
+
+ // Check if Rating is Null
+ if ($rating == '--') {
+ redirect_header("?cid={$cid}&lid={$lid}", 4, _MD_WFD_NORATING);
+ exit();
+ }
+ if ($ratinguserUid != 0) {
+ // Check if Download POSTER is voting (UNLESS Anonymous users allowed to post)
+ if ($download->getVar('submitter') == $ratinguserUid) {
+ redirect_header(WFDOWNLOADS_URL . "/singlefile.php?cid={$cid}&lid={$lid}", 4, _MD_WFD_CANTVOTEOWN);
+ exit();
+ }
+ // Check if REG user is trying to vote twice.
+ $criteria = new CriteriaCompo(new Criteria('lid', $lid));
+ $criteria->add(new Criteria('ratinguser', $ratinguserUid));
+ $ratingsCount = $wfdownloads->getHandler('rating')->getCount($criteria);
+ if ($ratingsCount > 0) {
+ redirect_header("singlefile.php?cid={$cid}&lid={$lid}", 4, _MD_WFD_VOTEONCE);
+ exit();
+ }
+ } else {
+ // Check if ANONYMOUS user is trying to vote more than once per day (only 1 anonymous from an IP in a single day).
+ $anonymousWaitDays = 1;
+ $yesterday = (time() - (86400 * $anonymousWaitDays));
+ $criteria = new CriteriaCompo(new Criteria("lid", $lid));
+ $criteria->add(new Criteria('ratinguser', 0));
+ $criteria->add(new Criteria('ratinghostname', $ratinguserIp));
+ $criteria->add(new Criteria('ratingtimestamp', $yesterday, '>'));
+ $anonymousVotesCount = $wfdownloads->getHandler('rating')->getCount($criteria);
+ if ($anonymousVotesCount > 0) {
+ redirect_header("singlefile.php?cid={$cid}&lid={$lid}", 4, _MD_WFD_VOTEONCE);
+ exit();
+ }
+ }
+ // All is well. Add to Line Item Rate to DB.
+ $rating = $wfdownloads->getHandler('rating')->create();
+ $rating->setVar('lid', $lid);
+ $rating->setVar('ratinguser', $ratinguserUid);
+ $rating->setVar('rating', (int)$rating);
+ $rating->setVar('ratinghostname', $ratinguserIp);
+ $rating->setVar('ratingtimestamp', time());
+ if ($wfdownloads->getHandler('rating')->insert($rating)) {
+ // All is well. Calculate Score & Add to Summary (for quick retrieval & sorting) to DB.
+ wfd_updaterating($lid);
+ $thankyouMessage = _MD_WFD_VOTEAPPRE . "<br />" . sprintf(_MD_WFD_THANKYOU, $xoopsConfig['sitename']);
+ redirect_header("singlefile.php?cid={$cid}&lid={$lid}", 4, $thankyouMessage);
+ } else {
+ echo $rating->getHtmlErrors();
+ }
+ } else {
+ $xoopsOption['template_main'] = 'wfdownloads_ratefile.html';
+ include XOOPS_ROOT_PATH . '/header.php';
+
+ $xoTheme->addStylesheet(WFDOWNLOADS_URL . '/module.css');
+ $xoTheme->addStylesheet(WFDOWNLOADS_URL . '/thickbox.css');
+ $xoopsTpl->assign('wfdownloads_url', WFDOWNLOADS_URL . '/');
+
+ // Breadcrumb
+ $breadcrumb->addLink(_MD_WFD_RATETHISFILE, '');
+ $xoopsTpl->assign('wfdownloads_breadcrumb', $breadcrumb->render());
+
+ $imageHeader = wfd_imageheader();
+
+ $xoopsTpl->assign('file', array('id' => $lid, 'lid' => $lid, 'cid' => $cid, 'title' => $download->getVar('title'), 'imageheader' => $imageHeader));
+ include 'footer.php';
+ }
+ break;
+}
\ No newline at end of file
Modified: XoopsModules/wfdownloads/trunk/wfdownloads/review.php
===================================================================
--- XoopsModules/wfdownloads/trunk/wfdownloads/review.php 2013-08-27 21:19:22 UTC (rev 11986)
+++ XoopsModules/wfdownloads/trunk/wfdownloads/review.php 2013-08-27 22:17:02 UTC (rev 11987)
@@ -21,32 +21,41 @@
$currentFile = basename(__FILE__);
include 'header.php';
-$cid = WfdownloadsRequest::getInt('cid', 0);
+$lid = WfdownloadsRequest::getInt('lid', 0);
+$download = $wfdownloads->getHandler('download')->get($lid);
+$cid = WfdownloadsRequest::getInt('cid', $download->getVar('cid'));
+$category = $wfdownloads->getHandler('category')->get($cid);
+// Download not published, expired or taken offline - redirect
+if ($download->getVar('published') == 0 || $download->getVar('published') > time() || $download->getVar('offline') == true || ($download->getVar('expired') != 0 && $download->getVar('expired') < time()) || $download->getVar('status') == 0) {
+ redirect_header('index.php', 3, _MD_WFD_NODOWNLOAD);
+}
+
// Check permissions
$groups = is_object($xoopsUser) ? $xoopsUser->getGroups() : array(0=>XOOPS_GROUP_ANONYMOUS);
if (!$gperm_handler->checkRight('WFDownCatPerm', $cid, $groups, $wfdownloads->getModule()->mid())) {
redirect_header('index.php',3, _NOPERM);
}
+// Breadcrumb
+include_once XOOPS_ROOT_PATH . "/class/tree.php";
+$categoriesTree = new XoopsObjectTree($wfdownloads->getHandler('category')->getObjects(), 'cid', 'pid');
+$breadcrumb = new WfdownloadsBreadcrumb();
+$breadcrumb->addLink($wfdownloads->getModule()->getVar('name'), WFDOWNLOADS_URL);
+foreach(array_reverse($categoriesTree->getAllParent($cid)) as $parentCategory) {
+ $breadcrumb->addLink($parentCategory->getVar('title'), "viewcat.php?cid=" . $parentCategory->getVar('cid'));
+}
+$breadcrumb->addLink($category->getVar('title'), "viewcat.php?cid={$cid}");
+$breadcrumb->addLink($download->getVar('title'), "singlefile.php?lid={$lid}");
+
$op = WfdownloadsRequest::getCmd('op', 'review.add');
switch ($op) {
case "list" :
case "reviews.list" :
- $cid = WfdownloadsRequest::getInt('cid', 0);
- $lid = WfdownloadsRequest::getInt('lid', 0);
$start = WfdownloadsRequest::getInt('start', 0);
- // Get download
- $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') != 0 && $download->getVar('expired') < time()) || $download->getVar('status') == 0) {
- redirect_header('index.php', 3, _MD_WFD_NODOWNLOAD);
- }
-
$xoopsOption['template_main'] = 'wfdownloads_reviews.html';
include XOOPS_ROOT_PATH . '/header.php';
@@ -54,49 +63,52 @@
$xoTheme->addStylesheet(WFDOWNLOADS_URL . '/thickbox.css');
$xoopsTpl->assign('wfdownloads_url', WFDOWNLOADS_URL . '/');
+ // Generate content header
$sql = "SELECT * FROM " . $xoopsDB->prefix('wfdownloads_indexpage') . " ";
$head_arr = $xoopsDB->fetchArray($xoopsDB->query($sql));
$catarray['imageheader'] = wfd_imageheader();
$catarray['letters'] = wfdownloads_lettersChoice();
$catarray['toolbar'] = wfd_toolbar();
$xoopsTpl->assign('catarray', $catarray);
-
- $category = $wfdownloads->getHandler('category')->get($cid);
- $pathstring = $wfdownloads->getHandler('category')->getNicePath($cid);
- $xoopsTpl->assign('category_path', $pathstring);
+ $xoopsTpl->assign('category_path', $wfdownloads->getHandler('category')->getNicePath($cid));
$xoopsTpl->assign('category_id', $cid);
- $criteria = new CriteriaCompo(new Criteria("lid", $lid));
- $criteria->add(new Criteria("submit", 1));
- $review_amount = $wfdownloads->getHandler('review')->getCount($criteria);
- $criteria->setSort("date");
+ // Count reviews
+ $criteria = new CriteriaCompo(new Criteria('lid', $lid));
+ $criteria->add(new Criteria('submit', 1));
+ $reviewsCount = $wfdownloads->getHandler('review')->getCount($criteria);
+
+ // Get reviews
+ $criteria->setSort('date');
$criteria->setLimit(5);
$criteria->setStart($start);
$reviews = $wfdownloads->getHandler('review')->getObjects($criteria);
- $down_arr = $download->toArray();
- $xoopsTpl->assign('down_arr', $down_arr);
+ $download_array = $download->toArray();
+ $xoopsTpl->assign('down_arr', $download_array);
- foreach (array_keys($reviews) as $i) {
- $down_review = $reviews[$i]->toArray();
- $down_review['date'] = formatTimestamp($down_review['date'], $wfdownloads->getConfig('dateformat'));
- $down_review['submitter'] = XoopsUserUtility::getUnameFromId($down_review['uid']);
- $review_rating = round(number_format($down_review['rated'], 0) / 2);
- $down_review['rated_img'] = "rate{$review_rating}.gif";
- $xoopsTpl->append('down_review', $down_review);
+ foreach ($reviews as $review) {
+ $review_array = $reviews[$i]->toArray();
+ $review_array['date'] = formatTimestamp($review_array['date'], $wfdownloads->getConfig('dateformat'));
+ $review_array['submitter'] = XoopsUserUtility::getUnameFromId($review_array['uid']);
+ $review_rating = round(number_format($review_array['rated'], 0) / 2);
+ $review_array['rated_img'] = "rate{$review_rating}.gif";
+ $xoopsTpl->append('down_review', $review_array);
}
- $xoopsTpl->assign('lang_review_found', sprintf(_MD_WFD_REVIEWTOTAL, $review_amount));
+ $xoopsTpl->assign('lang_review_found', sprintf(_MD_WFD_REVIEWTOTAL, $reviewsCount));
include_once XOOPS_ROOT_PATH . '/class/pagenav.php';
- $pagenav = new XoopsPageNav($review_amount, 5 , $start, 'start', "op=list&cid={$cid}&lid={$lid}", 1);
+ $pagenav = new XoopsPageNav($reviewsCount, 5 , $start, 'start', "op=reviews.list&cid={$cid}&lid={$lid}", 1);
$navbar['navbar'] = $pagenav->renderNav();
$xoopsTpl->assign('navbar', $navbar);
+ $xoopsTpl->assign('categoryPath', $pathstring . " > " . $download_array['title']);
+ $xoopsTpl->assign('module_home', wfdownloads_module_home(true));
+
include 'footer.php';
break;
case "review.add" :
- case "default" :
default :
// Check if ANONYMOUS user can review
if (!is_object($xoopsUser) && !$wfdownloads->getConfig('rev_anonpost')) {
@@ -104,8 +116,10 @@
exit();
}
+ // Get review poster 'uid'
+ $reviewerUid = is_object($xoopsUser) ? (int)$xoopsUser->getVar('uid') : 0;
+
if (!empty($_POST['submit'])) {
- $reviewerUid = is_object($xoopsUser) ? (int)$xoopsUser->getVar('uid') : 0;
$review = $wfdownloads->getHandler('review')->create();
$review->setVar('title', trim($_POST["title"]));
$review->setVar('review', trim($_POST["review"]));
@@ -129,13 +143,18 @@
$xoTheme->addStylesheet(WFDOWNLOADS_URL . '/thickbox.css');
$xoopsTpl->assign('wfdownloads_url', WFDOWNLOADS_URL . '/');
+ // Breadcrumb
+ $breadcrumb->addLink(_MD_WFD_REVIEWTHISFILE, '');
+ echo $breadcrumb->render();
+
echo "<div align='center'>" . wfd_imageheader() . "</div><br />\n";
echo "<div>" . _MD_WFD_REV_SNEWMNAMEDESC . "</div>\n";
+ // Generate form
include XOOPS_ROOT_PATH . '/class/xoopsformloader.php';
- $sform = new XoopsThemeForm(_MD_WFD_REV_SUBMITREV, "reviewform", xoops_getenv('PHP_SELF'));
+ $sform = new XoopsThemeForm(_MD_WFD_REV_SUBMITREV, 'reviewform', xoops_getenv('PHP_SELF'));
$sform->addElement(new XoopsFormText(_MD_WFD_REV_TITLE, 'title', 50, 255), true);
- $rating_select = new XoopsFormSelect(_MD_WFD_REV_RATING, "rated", '10');
+ $rating_select = new XoopsFormSelect(_MD_WFD_REV_RATING, 'rated', '10');
$rating_select->addOptionArray(array(
'1' => 1,
'2' => 2,
@@ -149,9 +168,9 @@
'10' => 10));
$sform->addElement($rating_select);
$sform->addElement(new XoopsFormDhtmlTextArea(_MD_WFD_REV_DESCRIPTION, 'review', '', 15, 60), true);
- $sform->addElement(new XoopsFormHidden("lid", intval($_GET['lid'])));
- $reviewerUid = is_object($xoopsUser) ? (int)$xoopsUser->getVar('uid') : 0;
- $sform->addElement(new XoopsFormHidden("uid", $reviewerUid));
+ $sform->addElement(new XoopsFormHidden('lid', $lid));
+ $sform->addElement(new XoopsFormHidden('cid', $cid));
+ $sform->addElement(new XoopsFormHidden('uid', $reviewerUid));
$button_tray = new XoopsFormElementTray('', '');
$button_tray->addElement(new XoopsFormButton('', 'submit', _SUBMIT, 'submit'));
$sform->addElement($button_tray);
Modified: XoopsModules/wfdownloads/trunk/wfdownloads/singlefile.php
===================================================================
--- XoopsModules/wfdownloads/trunk/wfdownloads/singlefile.php 2013-08-27 21:19:22 UTC (rev 11986)
+++ XoopsModules/wfdownloads/trunk/wfdownloads/singlefile.php 2013-08-27 22:17:02 UTC (rev 11987)
@@ -22,7 +22,7 @@
include 'header.php';
$lid = WfdownloadsRequest::getInt('lid', 0);
-$cid = WfdownloadsRequest::getInt('cid', 0);
+$cid = WfdownloadsRequest::getInt('cid', $wfdownloads->getHandler('download')->get($lid)->getVar('cid'));//WfdownloadsRequest::getInt('cid', 0);
// Check permissions
$groups = is_object($xoopsUser) ? $xoopsUser->getGroups() : array(0=>XOOPS_GROUP_ANONYMOUS);
@@ -76,9 +76,7 @@
$xoopsTpl->assign('category_title', $category->getVar('title'));
$xoopsTpl->assign('category_image', $imgurl);
-/**
- * Retreiving the top parent category
- */
+// Retreiving the top parent category
$allSubcatsTopParentCid = $wfdownloads->getHandler('category')->getAllSubcatsTopParentCid();
$topCategory = $wfdownloads->getHandler('category')->allCategories[$allSubcatsTopParentCid[$download->getVar('cid')]];
$xoopsTpl->assign('topcategory_title', $topCategory->getVar('title'));
@@ -162,12 +160,14 @@
$add_mirror = 1;
}
+
+
+// Get download informations
$down = $download->getDownloadInfo();
-$xoopsTpl->assign('categoryPath', $down['path'] . " > " . $down['title']);
+$xoopsTpl->assign('categoryPath', $down['path'] . " > " . $down['title']); // this definition is not removed for compatibility issues
$xoopsTpl->assign('lang_dltimes', sprintf(_MD_WFD_DLTIMES, $down['hits']));
$xoopsTpl->assign('lang_subdate' , $down['is_updated']);
$xoopsTpl->append('file', $down);
-
$xoopsTpl->assign('show_screenshot', false);
if ($wfdownloads->getConfig('screenshot') == 1) {
$xoopsTpl->assign('shots_dir', $wfdownloads->getConfig('screenshots'));
@@ -175,16 +175,25 @@
$xoopsTpl->assign('shotheight', $wfdownloads->getConfig('shotheight'));
$xoopsTpl->assign('show_screenshot', true);
}
-/**
- * Show other author downloads
- */
+// Breadcrumb
+include_once XOOPS_ROOT_PATH . "/class/tree.php";
+$categoriesTree = new XoopsObjectTree($wfdownloads->getHandler('category')->getObjects(), 'cid', 'pid');
+$breadcrumb = new WfdownloadsBreadcrumb();
+$breadcrumb->addLink($wfdownloads->getModule()->getVar('name'), WFDOWNLOADS_URL);
+foreach(array_reverse($categoriesTree->getAllParent($cid)) as $parentCategory) {
+ $breadcrumb->addLink($parentCategory->getVar('title'), "viewcat.php?cid=" . $parentCategory->getVar('cid'));
+}
+$breadcrumb->addLink($category->getVar('title'), "viewcat.php?cid=" . $category->getVar('cid'));
+$breadcrumb->addLink($down['title'], '');
+$xoopsTpl->assign('wfdownloads_breadcrumb', $breadcrumb->render());
+
+// Show other author downloads
$criteria = new CriteriaCompo(new Criteria("submitter", $download->getVar('submitter')));
$criteria->add(new Criteria('lid', $lid, '!='));
$criteria->setLimit(20);
$criteria->setSort('published');
$criteria->setOrder('DESC');
-
$downloads = $wfdownloads->getHandler('download')->getActiveDownloads($criteria);
foreach (array_keys($downloads) as $i) {
$downuid['title'] = $downloads[$i]->getVar('title');
Modified: XoopsModules/wfdownloads/trunk/wfdownloads/templates/wfdownloads_brokenfile.html
===================================================================
--- XoopsModules/wfdownloads/trunk/wfdownloads/templates/wfdownloads_brokenfile.html 2013-08-27 21:19:22 UTC (rev 11986)
+++ XoopsModules/wfdownloads/trunk/wfdownloads/templates/wfdownloads_brokenfile.html 2013-08-27 22:17:02 UTC (rev 11987)
@@ -1,3 +1,5 @@
+<{include file='db:wfdownloads_header.html'}>
+
<{if $catarray.imageheader != ""}>
<div><{$catarray.imageheader}></div>
<{/if}>
Modified: XoopsModules/wfdownloads/trunk/wfdownloads/templates/wfdownloads_common_breadcrumb.html
===================================================================
--- XoopsModules/wfdownloads/trunk/wfdownloads/templates/wfdownloads_common_breadcrumb.html 2013-08-27 21:19:22 UTC (rev 11986)
+++ XoopsModules/wfdownloads/trunk/wfdownloads/templates/wfdownloads_common_breadcrumb.html 2013-08-27 22:17:02 UTC (rev 11987)
@@ -1,14 +1,17 @@
+<div class="wfdownloads_headertable">
+<div class="wfdownloads_breadcrumb">
<{foreach item=bread from=$breadcrumb name=bcloop}>
-<span>
-<{if ($bread.link)}>
- <a href="<{$bread.link}>" title="<{$bread.title}>"><{$bread.title}></a>
-<{else}>
- <{$bread.title}>
-<{/if}>
-</span>
-
-<{if !$smarty.foreach.bcloop.last}>
- <span class="delimiter"> > </span>
-<{/if}>
+ <span class="bread">
+ <{if ($bread.link)}>
+ <a href="<{$bread.link}>" title="<{$bread.title}>"><{$bread.title}></a>
+ <{else}>
+ <{$bread.title}>
+ <{/if}>
+ </span>
+ <{if !$smarty.foreach.bcloop.last}>
+ <span class="delimiter"> > </span>
+ <{/if}>
<{/foreach}>
-<hr />
\ No newline at end of file
+ <hr />
+</div>
+</div>
\ No newline at end of file
Modified: XoopsModules/wfdownloads/trunk/wfdownloads/templates/wfdownloads_header.html
===================================================================
--- XoopsModules/wfdownloads/trunk/wfdownloads/templates/wfdownloads_header.html 2013-08-27 21:19:22 UTC (rev 11986)
+++ XoopsModules/wfdownloads/trunk/wfdownloads/templates/wfdownloads_header.html 2013-08-27 22:17:02 UTC (rev 11987)
@@ -5,20 +5,11 @@
<div style="display: none;"><{$ref_smartfactory}></div>
<!-- Thank you for keeping this line in the template :-) //-->
-<div class="wfdownloads_headertable">
-<{if $module_home}>
- <span class="wfdownloads_modulename"><{$module_home}></span>
-<{/if}>
-<{if $categoryPath}>
- <span class="wfdownloads_breadcrumb">
-<{if $module_home}>
- >
-<{/if}>
- <{$categoryPath}>
- </span>
-<{/if}>
-</div>
+<{$wfdownloads_breadcrumb}>
+
+
+
<{if $catarray.imageheader != ""}>
<br />
<div class="wfd_head_catimageheader"><{$catarray.imageheader}></div>
Modified: XoopsModules/wfdownloads/trunk/wfdownloads/templates/wfdownloads_ratefile.html
===================================================================
--- XoopsModules/wfdownloads/trunk/wfdownloads/templates/wfdownloads_ratefile.html 2013-08-27 21:19:22 UTC (rev 11986)
+++ XoopsModules/wfdownloads/trunk/wfdownloads/templates/wfdownloads_ratefile.html 2013-08-27 22:17:02 UTC (rev 11987)
@@ -1,3 +1,5 @@
+<{include file='db:wfdownloads_header.html'}>
+
<{if $file.imageheader != ""}>
<div><{$file.imageheader}></div>
<{/if}>
Modified: XoopsModules/wfdownloads/trunk/wfdownloads/templates/wfdownloads_viewcat.html
===================================================================
--- XoopsModules/wfdownloads/trunk/wfdownloads/templates/wfdownloads_viewcat.html 2013-08-27 21:19:22 UTC (rev 11986)
+++ XoopsModules/wfdownloads/trunk/wfdownloads/templates/wfdownloads_viewcat.html 2013-08-27 22:17:02 UTC (rev 11987)
@@ -1,5 +1,4 @@
<{include file='db:wfdownloads_header.html'}>
-
<div class="wfd_view_top">
<{if $cat_rssfeed_link != ""}>
<{$cat_rssfeed_link}>
Modified: XoopsModules/wfdownloads/trunk/wfdownloads/viewcat.php
===================================================================
--- XoopsModules/wfdownloads/trunk/wfdownloads/viewcat.php 2013-08-27 21:19:22 UTC (rev 11986)
+++ XoopsModules/wfdownloads/trunk/wfdownloads/viewcat.php 2013-08-27 22:17:02 UTC (rev 11987)
@@ -45,19 +45,21 @@
$xoTheme->addStylesheet(WFDOWNLOADS_URL . '/thickbox.css');
$xoopsTpl->assign('wfdownloads_url', WFDOWNLOADS_URL . '/');
-// Added Formulize module support (2006/05/04) jpc - start
-// $category instantiation moved from above 'Breadcrumb' comment
$category = $wfdownloads->getHandler('category')->get($cid);
+$xoopsTpl->assign('cid', $cid);
+$xoopsTpl->assign('category_id', $cid);
// Retreiving the top parent category
+if (!isset($_GET['list']) && !isset($_GET['selectdate'])) {
+ $allSubcatsTopParentCid = $wfdownloads->getHandler('category')->getAllSubcatsTopParentCid();
+ $topCategory = $wfdownloads->getHandler('category')->allCategories[$allSubcatsTopParentCid[$cid]];
+ $xoopsTpl->assign('topcategory_title', $topCategory->getVar('title'));
+ $xoopsTpl->assign('topcategory_image', $topCategory->getVar('imgurl'));
+ $xoopsTpl->assign('topcategory_cid', $topCategory->getVar('cid'));
+}
+
+// Added Formulize module support (2006/05/04) jpc - start
if (wfdownload_checkModule('formulize')) {
- if (!isset($_GET['list']) && !isset($_GET['selectdate'])) {
- $allSubcatsTopParentCid = $wfdownloads->getHandler('category')->getAllSubcatsTopParentCid();
- $topCategory = $wfdownloads->getHandler('category')->allCategories[$allSubcatsTopParentCid[$cid]];
- $xoopsTpl->assign('topcategory_title', $topCategory->getVar('title'));
- $xoopsTpl->assign('topcategory_image', $topCategory->getVar('imgurl'));
- $xoopsTpl->assign('topcategory_cid', $topCategory->getVar('cid'));
- }
$formulize_fid = $category->getVar('formulize_fid');
if($formulize_fid)
$xoopsTpl->assign('custom_form', 1);
@@ -66,50 +68,57 @@
}
// Added Formulize module support (2006/05/04) jpc - end
+// Generate Header
$catArray['imageheader'] = wfd_imageheader();
$catArray['letters'] = wfdownloads_lettersChoice();
$catArray['toolbar'] = wfd_toolbar();
$xoopsTpl->assign('catarray', $catArray);
+$xoopsTpl->assign('categoryPath', $wfdownloads->getHandler('category')->getNicePath($cid)); // this definition is not removed for compatibility issues
+$xoopsTpl->assign('module_home', wfdownloads_module_home(true)); // this definition is not removed for compatibility issues
-/**
- * Breadcrumb
- */
-$pathString = $wfdownloads->getHandler('category')->getNicePath($cid);
-$xoopsTpl->assign('categoryPath', $pathString);
-$xoopsTpl->assign('category_id', $cid);
+
+// Get categories tree
$criteria = new CriteriaCompo();
$criteria->setSort('weight ASC, title');
$categories = $wfdownloads->getHandler('category')->getObjects($criteria, true);
include_once XOOPS_ROOT_PATH . "/class/tree.php";
-$mytree = new XoopsObjectTree($categories, 'cid', 'pid');
-$allSubCategories = $mytree->getFirstChild($cid);
+$categoriesTree = new XoopsObjectTree($categories, 'cid', 'pid');
-// Display Sub-categories for selected Category
+// Breadcrumb
+$breadcrumb = new WfdownloadsBreadcrumb();
+$breadcrumb->addLink($wfdownloads->getModule()->getVar('name'), WFDOWNLOADS_URL);
+foreach(array_reverse($categoriesTree->getAllParent($cid)) as $parentCategory) {
+ $breadcrumb->addLink($parentCategory->getVar('title'), "viewcat.php?cid=" . $parentCategory->getVar('cid'));
+}
+$breadcrumb->addLink($category->getVar('title'), '');
+$xoopsTpl->assign('wfdownloads_breadcrumb', $breadcrumb->render());
+
+// Display Subcategories for selected Category
+$allSubCategories = $categoriesTree->getFirstChild($cid);
if (is_array($allSubCategories) > 0 && !isset($_GET['list']) && !isset($_GET['selectdate'])) {
$allowedCategoriesIds = $gperm_handler->getItemIds('WFDownCatPerm', $groups, $wfdownloads->getModule()->mid());
$listings = wfd_getTotalItems(0, $allowedCategoriesIds);
$scount = 1;
- foreach(array_keys($allSubCategories) as $i) {
- $ele = $allSubCategories[$i];
- if (!in_array($ele->getVar('cid'), $allowedCategoriesIds)) {
+ foreach($allSubCategories as $subCategory) {
+ // Check if subcategory is allowed
+ if (!in_array($subCategory->getVar('cid'), $allowedCategoriesIds)) {
continue;
}
-
$infercategories = array();
- $catdowncount = isset($listings['count'][$ele->getVar('cid')]) ? $listings['count'][$ele->getVar('cid')] : 0;
- ...
[truncated message content] |