|
From: <luc...@us...> - 2014-07-24 14:54:37
|
Revision: 12723
http://sourceforge.net/p/xoops/svn/12723
Author: luciorota
Date: 2014-07-24 14:54:30 +0000 (Thu, 24 Jul 2014)
Log Message:
-----------
RC2
Modified Paths:
--------------
XoopsModules/wfdownloads/trunk/admin/categories.php
XoopsModules/wfdownloads/trunk/admin/clone.php
XoopsModules/wfdownloads/trunk/admin/downloads.php
XoopsModules/wfdownloads/trunk/admin/import.php
XoopsModules/wfdownloads/trunk/admin/index.php
XoopsModules/wfdownloads/trunk/admin/menu.php
XoopsModules/wfdownloads/trunk/admin/mimetypes.php
XoopsModules/wfdownloads/trunk/admin/mirrors.php
XoopsModules/wfdownloads/trunk/admin/permissions.php
XoopsModules/wfdownloads/trunk/admin/ratings.php
XoopsModules/wfdownloads/trunk/admin/reportsmodifications.php
XoopsModules/wfdownloads/trunk/admin/reviews.php
XoopsModules/wfdownloads/trunk/blocks/top_by_cat.php
XoopsModules/wfdownloads/trunk/class/breadcrumb.php
XoopsModules/wfdownloads/trunk/class/category.php
XoopsModules/wfdownloads/trunk/class/download.php
XoopsModules/wfdownloads/trunk/class/wfdownloads_lists.php
XoopsModules/wfdownloads/trunk/docs/changelog.txt
XoopsModules/wfdownloads/trunk/include/functions.php
XoopsModules/wfdownloads/trunk/include/notification.inc.php
XoopsModules/wfdownloads/trunk/include/search.inc.php
XoopsModules/wfdownloads/trunk/language/english/admin.php
XoopsModules/wfdownloads/trunk/language/english/main.php
XoopsModules/wfdownloads/trunk/language/english/modinfo.php
XoopsModules/wfdownloads/trunk/singlefile.php
XoopsModules/wfdownloads/trunk/submit.php
XoopsModules/wfdownloads/trunk/templates/wfdownloads_singlefile.tpl
XoopsModules/wfdownloads/trunk/topten.php
XoopsModules/wfdownloads/trunk/viewcat.php
XoopsModules/wfdownloads/trunk/xoops_version.php
Added Paths:
-----------
XoopsModules/wfdownloads/trunk/admin/swishe.php
XoopsModules/wfdownloads/trunk/assets/images/module_logo_blank.png
XoopsModules/wfdownloads/trunk/templates/admin/wfdownloads_am_categorieslist.tpl
XoopsModules/wfdownloads/trunk/templates/admin/wfdownloads_am_downloadslist.tpl
XoopsModules/wfdownloads/trunk/templates/admin/wfdownloads_am_ip_logslist.tpl
XoopsModules/wfdownloads/trunk/templates/admin/wfdownloads_am_mimetypeslist.tpl
XoopsModules/wfdownloads/trunk/templates/admin/wfdownloads_am_mirrorslist.tpl
XoopsModules/wfdownloads/trunk/templates/admin/wfdownloads_am_permissions.tpl
XoopsModules/wfdownloads/trunk/templates/admin/wfdownloads_am_ratingslist.tpl
XoopsModules/wfdownloads/trunk/templates/admin/wfdownloads_am_reportsmodificationslist.tpl
XoopsModules/wfdownloads/trunk/templates/admin/wfdownloads_am_reviewslist.tpl
XoopsModules/wfdownloads/trunk/templates/blocks/wfdownloads_mb_new.tpl
XoopsModules/wfdownloads/trunk/templates/blocks/wfdownloads_mb_top.tpl
XoopsModules/wfdownloads/trunk/templates/blocks/wfdownloads_mb_top_by_cat.tpl
XoopsModules/wfdownloads/trunk/templates/wfdownloads_co_breadcrumb.tpl
XoopsModules/wfdownloads/trunk/templates/wfdownloads_co_letterschoice.tpl
Removed Paths:
-------------
XoopsModules/wfdownloads/trunk/templates/admin/wfdownloads_admin_categorieslist.tpl
XoopsModules/wfdownloads/trunk/templates/admin/wfdownloads_admin_downloadslist.tpl
XoopsModules/wfdownloads/trunk/templates/admin/wfdownloads_admin_ip_logslist.tpl
XoopsModules/wfdownloads/trunk/templates/admin/wfdownloads_admin_mimetypeslist.tpl
XoopsModules/wfdownloads/trunk/templates/admin/wfdownloads_admin_mirrorslist.tpl
XoopsModules/wfdownloads/trunk/templates/admin/wfdownloads_admin_permissions.tpl
XoopsModules/wfdownloads/trunk/templates/admin/wfdownloads_admin_ratingslist.tpl
XoopsModules/wfdownloads/trunk/templates/admin/wfdownloads_admin_reportsmodificationslist.tpl
XoopsModules/wfdownloads/trunk/templates/admin/wfdownloads_admin_reviewslist.tpl
XoopsModules/wfdownloads/trunk/templates/wfdownloads_common_breadcrumb.tpl
XoopsModules/wfdownloads/trunk/templates/wfdownloads_common_letterschoice.tpl
XoopsModules/wfdownloads/trunk/wfdownloads/
Modified: XoopsModules/wfdownloads/trunk/admin/categories.php
===================================================================
--- XoopsModules/wfdownloads/trunk/admin/categories.php 2014-07-22 12:18:06 UTC (rev 12722)
+++ XoopsModules/wfdownloads/trunk/admin/categories.php 2014-07-24 14:54:30 UTC (rev 12723)
@@ -257,7 +257,7 @@
$sorted_categories = wfdownloads_sortCategories();
$GLOBALS['xoopsTpl']->assign('sorted_categories', $sorted_categories);
$GLOBALS['xoopsTpl']->assign('token', $GLOBALS['xoopsSecurity']->getTokenHTML() );
- $GLOBALS['xoopsTpl']->display("db:{$wfdownloads->getModule()->dirname()}_admin_categorieslist.tpl");
+ $GLOBALS['xoopsTpl']->display("db:{$wfdownloads->getModule()->dirname()}_am_categorieslist.tpl");
} else {
redirect_header("{$currentFile}?op=category.add", 1, _AM_WFDOWNLOADS_CCATEGORY_NOEXISTS);
}
Modified: XoopsModules/wfdownloads/trunk/admin/clone.php
===================================================================
--- XoopsModules/wfdownloads/trunk/admin/clone.php 2014-07-22 12:18:06 UTC (rev 12722)
+++ XoopsModules/wfdownloads/trunk/admin/clone.php 2014-07-24 14:54:30 UTC (rev 12723)
@@ -38,6 +38,10 @@
if ($cloneDirname && is_dir(XOOPS_ROOT_PATH . '/modules/' . $cloneDirname)) {
redirect_header($currentFile, 3, sprintf(_AM_WFDOWNLOADS_CLONE_EXISTS, $cloneDirname));
}
+ // Check dirname length for template file name length issues (template file name cannot be longer than 50 chars)
+ if (strlen($cloneDirname) > 18) {
+ redirect_header($currentFile, 3, sprintf(_AM_WFDOWNLOADS_CLONE_TOOLONG, $cloneDirname));
+ }
$patterns = array(
strtolower(WFDOWNLOADS_DIRNAME) => strtolower($cloneDirname),
@@ -79,7 +83,7 @@
_AM_WFDOWNLOADS_CLONE_TITLE,
$wfdownloads->getModule()->getVar('name', 'E')
), 'clone', $currentFile, 'post', true);
- $cloneDirname_text = new XoopsFormText(_AM_WFDOWNLOADS_CLONE_NAME, 'clonedirname', 20, 20, '');
+ $cloneDirname_text = new XoopsFormText(_AM_WFDOWNLOADS_CLONE_NAME, 'clonedirname', 18, 18, '');
$cloneDirname_text->setDescription(_AM_WFDOWNLOADS_CLONE_NAME_DSC);
$form->addElement($cloneDirname_text, true);
$form->addElement(new XoopsFormHidden('op', 'submit'));
@@ -152,7 +156,7 @@
}
}
// Check original image/font
- if (!file_exists($imageBase = XOOPS_ROOT_PATH . "/modules/" . $dirname . "/assets/images/module_logo.png")) {
+ if (!file_exists($imageBase = XOOPS_ROOT_PATH . "/modules/" . $dirname . "/assets/images/module_logo_blank.png")) {
return false;
}
if (!file_exists($font = XOOPS_ROOT_PATH . "/modules/" . $wfdownloads->getModule()->dirname() . "/assets/images/VeraBd.ttf")) {
Modified: XoopsModules/wfdownloads/trunk/admin/downloads.php
===================================================================
--- XoopsModules/wfdownloads/trunk/admin/downloads.php 2014-07-22 12:18:06 UTC (rev 12722)
+++ XoopsModules/wfdownloads/trunk/admin/downloads.php 2014-07-24 14:54:30 UTC (rev 12723)
@@ -841,7 +841,7 @@
}
}
- $GLOBALS['xoopsTpl']->display("db:{$wfdownloads->getModule()->dirname()}_admin_downloadslist.tpl");
+ $GLOBALS['xoopsTpl']->display("db:{$wfdownloads->getModule()->dirname()}_am_downloadslist.tpl");
include 'admin_footer.php';
break;
@@ -982,7 +982,7 @@
}
}
- $GLOBALS['xoopsTpl']->display("db:{$wfdownloads->getModule()->dirname()}_admin_ip_logslist.tpl");
+ $GLOBALS['xoopsTpl']->display("db:{$wfdownloads->getModule()->dirname()}_am_ip_logslist.tpl");
include 'admin_footer.php';
break;
Modified: XoopsModules/wfdownloads/trunk/admin/import.php
===================================================================
--- XoopsModules/wfdownloads/trunk/admin/import.php 2014-07-22 12:18:06 UTC (rev 12722)
+++ XoopsModules/wfdownloads/trunk/admin/import.php 2014-07-24 14:54:30 UTC (rev 12723)
@@ -269,27 +269,39 @@
$wfdownloads = WfdownloadsWfdownloads::getInstance();
echo "<br /><span style='font-weight: bold;'>Copying Files</span><br />";
+
// Copy categories images/thumbnails
if (!wfdownloads_copyDir(XOOPS_ROOT_PATH . '/' . $wfdModuleConfig['catimage'], XOOPS_ROOT_PATH . '/' . $wfdownloads->getConfig('catimage'))) {
return false;
}
echo "Copied categories images and thumbnails<br />";
+
// Copy screenshots images/thumbnails
if (!wfdownloads_copyDir(
XOOPS_ROOT_PATH . '/' . $wfdModuleConfig['screenshots'],
XOOPS_ROOT_PATH . '/' . $wfdownloads->getConfig('screenshots')
- )
- ) {
+ )) {
return false;
}
echo "Copied downloads screenshots and thumbnails<br />";
+
// Copy files
- if (!wfdownloads_copyDir($wfdModuleConfig['uploaddir'], $wfdownloads->getConfig('uploaddir'))) {
- return false;
+ $wfdDownloadObjs = $wfdDownloadsHandler->getObjects();
+ $countCopied = 0;
+ $countNotCopied = 0;
+ foreach($wfdDownloadObjs as $wfdDownloadObj) {
+ if (wfdownloads_copyFile($wfdModuleConfig['uploaddir'] . "/" . $wfdDownloadObj->getVar('filename'), $wfdownloads->getConfig('uploaddir') . "/" . $wfdDownloadObj->getVar('filename'))) {
+ echo "<span style='color:green;'>" . $wfdModuleConfig['uploaddir'] . "/" . $wfdDownloadObj->getVar('filename') . " copied</span><br />";
+ ++$countCopied;
+ } else {
+ echo "<span style='color:red;'>ERROR copying:" . $wfdModuleConfig['uploaddir'] . "/" . $wfdDownloadObj->getVar('filename') . "</span><br />";
+ ++$countNotCopied;
+ }
}
- echo "Copied files<br />";
-
+ echo "Files copied: ". $countCopied;
echo "<br />";
+ echo "Files not copied: ". $countNotCopied;
+ echo "<br />";
echo _AM_WFDOWNLOADS_IMPORT_IMPORTINGDATA;
echo "<br />";
@@ -337,19 +349,36 @@
list($max_ratingid) = $xoopsDB->fetchRow($result);
//Import data into category table
- $sql = "INSERT INTO {$destination['cat']} (";
- $sql .= " `old_cid`, `old_pid`, `title`, `imgurl`, `description`, `total`, `summary`, `spotlighttop`, `spotlighthis`, `dohtml`, `dosmiley`, `doxcode`, `doimage`, `dobr`, `weight`, `formulize_fid`";
- $sql .= " ) SELECT ";
- $sql .= " `cid`, `pid`, `title`, `imgurl`, `description`, `total`, `summary`, `spotlighttop`, `spotlighthis`, `dohtml`, `dosmiley`, `doxcode`, `doimage`, `dobr`, `weight`, `formulize_fid`";
- $sql .= " FROM {$source['cat']}";
+ if (wfdownloads_checkModule('wf' . 'downloads') >= 320) {
+ $sql = "INSERT INTO {$destination['cat']} (";
+ $sql .= " `old_cid`, `old_pid`, `title`, `imgurl`, `description`, `total`, `summary`, `spotlighttop`, `spotlighthis`, `dohtml`, `dosmiley`, `doxcode`, `doimage`, `dobr`, `weight`, `formulize_fid`";
+ $sql .= " ) SELECT ";
+ $sql .= " `cid`, `pid`, `title`, `imgurl`, `description`, `total`, `summary`, `spotlighttop`, `spotlighthis`, `dohtml`, `dosmiley`, `doxcode`, `doimage`, `dobr`, `weight`, `formulize_fid`";
+ $sql .= " FROM {$source['cat']}";
+ } else {
+ $sql = "INSERT INTO {$destination['cat']} (";
+ $sql .= " `old_cid`, `old_pid`, `title`, `imgurl`, `description`, `total`, `summary`, `spotlighttop`, `spotlighthis`, `dohtml`, `dosmiley`, `doxcode`, `doimage`, `dobr`, `weight`";
+ $sql .= " ) SELECT ";
+ $sql .= " `cid`, `pid`, `title`, `imgurl`, `description`, `total`, `summary`, `spotlighttop`, `spotlighthis`, `dohtml`, `dosmiley`, `doxcode`, `doimage`, `dobr`, `weight`";
+ $sql .= " FROM {$source['cat']}";
+ }
$xoopsDB->query($sql);
echo "Imported {$xoopsDB->getAffectedRows()} categories into {$destination['cat']}<br />";
+
//Import data into downloads table
- $sql = "INSERT INTO {$destination['downloads']} (";
- $sql .= " `cid`, `old_lid`, `old_cid`, `title`, `url`, `filename`, `filetype`, `homepage`, `version`, `size`, `platform`, `screenshot`, `screenshot2`, `screenshot3`, `screenshot4`, `submitter`, `publisher`, `status`, `date`, `hits`, `rating`, `votes`, `comments`, `license`, `mirror`, `price`, `paypalemail`, `features`, `requirements`, `homepagetitle`, `forumid`, `limitations`, `versiontypes`, `dhistory`, `published`, `expired`, `updated`, `offline`, `summary`, `description`, `ipaddress`, `notifypub`, `formulize_idreq`, `screenshots`";
- $sql .= " ) SELECT ";
- $sql .= " 0, `lid`, `cid`, `title`, `url`, `filename`, `filetype`, `homepage`, `version`, `size`, `platform`, `screenshot`, `screenshot2`, `screenshot3`, `screenshot4`, `submitter`, `publisher`, `status`, `date`, `hits`, `rating`, `votes`, `comments`, `license`, `mirror`, `price`, `paypalemail`, `features`, `requirements`, `homepagetitle`, `forumid`, `limitations`, `versiontypes`, `dhistory`, `published`, `expired`, `updated`, `offline`, `summary`, `description`, `ipaddress`, `notifypub`, `formulize_idreq`, `screenshots`";
- $sql .= " FROM {$source['downloads']}";
+ if (wfdownloads_checkModule('wf' . 'downloads') >= 320) {
+ $sql = "INSERT INTO {$destination['downloads']} (";
+ $sql .= " `cid`, `old_lid`, `old_cid`, `title`, `url`, `filename`, `filetype`, `homepage`, `version`, `size`, `platform`, `screenshot`, `screenshot2`, `screenshot3`, `screenshot4`, `submitter`, `publisher`, `status`, `date`, `hits`, `rating`, `votes`, `comments`, `license`, `mirror`, `price`, `paypalemail`, `features`, `requirements`, `homepagetitle`, `forumid`, `limitations`, `versiontypes`, `dhistory`, `published`, `expired`, `updated`, `offline`, `summary`, `description`, `ipaddress`, `notifypub`, `formulize_idreq`";
+ $sql .= " ) SELECT ";
+ $sql .= " 0, `lid`, `cid`, `title`, `url`, `filename`, `filetype`, `homepage`, `version`, `size`, `platform`, `screenshot`, `screenshot2`, `screenshot3`, `screenshot4`, `submitter`, `publisher`, `status`, `date`, `hits`, `rating`, `votes`, `comments`, `license`, `mirror`, `price`, `paypalemail`, `features`, `requirements`, `homepagetitle`, `forumid`, `limitations`, `versiontypes`, `dhistory`, `published`, `expired`, `updated`, `offline`, `summary`, `description`, `ipaddress`, `notifypub`, `formulize_idreq`";
+ $sql .= " FROM {$source['downloads']}";
+ } else {
+ $sql = "INSERT INTO {$destination['downloads']} (";
+ $sql .= " `cid`, `old_lid`, `old_cid`, `title`, `url`, `filename`, `filetype`, `homepage`, `version`, `size`, `platform`, `screenshot`, `submitter`, `publisher`, `status`, `date`, `hits`, `rating`, `votes`, `comments`, `license`, `mirror`, `price`, `paypalemail`, `features`, `requirements`, `homepagetitle`, `forumid`, `limitations`, `dhistory`, `published`, `expired`, `updated`, `offline`, `summary`, `description`, `ipaddress`, `notifypub`";
+ $sql .= " ) SELECT ";
+ $sql .= " 0, `lid`, `cid`, `title`, `url`, `filename`, `filetype`, `homepage`, `version`, `size`, `platform`, `screenshot`, `submitter`, `publisher`, `status`, `date`, `hits`, `rating`, `votes`, `comments`, `license`, `mirror`, `price`, `paypalemail`, `features`, `requirements`, `homepagetitle`, `forumid`, `limitations`, `dhistory`, `published`, `expired`, `updated`, `offline`, `summary`, `description`, `ipaddress`, `notifypub`";
+ $sql .= " FROM {$source['downloads']}";
+ }
$xoopsDB->query($sql);
echo "Imported {$xoopsDB->getAffectedRows()} downloads into {$destination['downloads']}<br />";
@@ -361,22 +390,33 @@
$sql .= " FROM {$source['mirrors']}";
$xoopsDB->query($sql);
echo "Imported {$xoopsDB->getAffectedRows()} mirrors into {$destination['mirrors']}<br />";
+
//Import data into reviews table
- $sql = "INSERT INTO {$destination['reviews']} (";
- $sql .= " `lid`, `title`, `review`, `submit`, `date`, `uid`, `rate`";
- $sql .= " ) SELECT";
- $sql .= " `lid`, `title`, `review`, `submit`, `date`, `uid`, `rate`";
- $sql .= " FROM {$source['reviews']}";
+ if (wfdownloads_checkModule('wf' . 'downloads') >= 320) {
+ $sql = "INSERT INTO {$destination['reviews']} (";
+ $sql .= " `lid`, `title`, `review`, `submit`, `date`, `uid`, `rate`";
+ $sql .= " ) SELECT";
+ $sql .= " `lid`, `title`, `review`, `submit`, `date`, `uid`, `rate`";
+ $sql .= " FROM {$source['reviews']}";
+ } else {
+ $sql = "INSERT INTO {$destination['reviews']} (";
+ $sql .= " `lid`, `title`, `review`, `submit`, `date`, `uid`";
+ $sql .= " ) SELECT";
+ $sql .= " `lid`, `title`, `review`, `submit`, `date`, `uid`";
+ $sql .= " FROM {$source['reviews']}";
+ }
$xoopsDB->query($sql);
echo "Imported {$xoopsDB->getAffectedRows()} reviews into {$destination['reviews']}<br />";
+
//Import data into brokens table
$sql = "INSERT INTO {$destination['broken']} (";
- $sql .= " `lid`, `sender`, `ip`";
+ $sql .= " `lid`, `sender`, `date`, `ip`";
$sql .= " ) SELECT";
- $sql .= " `lid`, `sender`, `ip`";
+ $sql .= " `lid`, `sender`, `date`, `ip`";
$sql .= " FROM {$source['broken']}";
$xoopsDB->query($sql);
echo "Imported {$xoopsDB->getAffectedRows()} broken reports into {$destination['broken']}<br />";
+
//Import data into votedata table
$sql = "INSERT INTO {$destination['votes']} (";
$sql .= " `lid`, `ratinguser`, `rating`, `ratinghostname`, `ratingtimestamp`";
@@ -385,6 +425,7 @@
$sql .= " FROM {$source['votes']}";
$xoopsDB->query($sql);
echo "Imported {$xoopsDB->getAffectedRows()} votes into {$destination['votes']}<br />";
+
//Import data into mod request table
$sql = "INSERT INTO {$destination['mod']} (";
$sql .= " `lid`, `cid`, `title`, `url`, `homepage`, `version`, `size`, `platform`, `screenshot`, `description`, `modifysubmitter`, `features`, `requirements`, `publisher`, `dhistory`, `summary`)";
@@ -432,10 +473,10 @@
}
//Remove temporary fields
- $xoopsDB->query("ALTER TABLE ." . $destination['cat'] . " DROP `old_cid`");
- $xoopsDB->query("ALTER TABLE ." . $destination['cat'] . " DROP `old_pid`");
- $xoopsDB->query("ALTER TABLE ." . $destination['downloads'] . " DROP `old_cid`");
- $xoopsDB->query("ALTER TABLE ." . $destination['downloads'] . " DROP `old_lid`");
+ $xoopsDB->query("ALTER TABLE " . $destination['cat'] . " DROP `old_cid`");
+ $xoopsDB->query("ALTER TABLE " . $destination['cat'] . " DROP `old_pid`");
+ $xoopsDB->query("ALTER TABLE " . $destination['downloads'] . " DROP `old_cid`");
+ $xoopsDB->query("ALTER TABLE " . $destination['downloads'] . " DROP `old_lid`");
return null;
}
Modified: XoopsModules/wfdownloads/trunk/admin/index.php
===================================================================
--- XoopsModules/wfdownloads/trunk/admin/index.php 2014-07-22 12:18:06 UTC (rev 12722)
+++ XoopsModules/wfdownloads/trunk/admin/index.php 2014-07-24 14:54:30 UTC (rev 12723)
@@ -32,6 +32,7 @@
//--------------------------
$categories_count = wfdownloads_categoriesCount();
+$votes_count = $wfdownloads->getHandler('rating')->getCount();
$brokenDownloads_count = $wfdownloads->getHandler('report')->getCount();
$modificationRequests_count = $wfdownloads->getHandler('modification')->getCount();
$newReviews_count = $wfdownloads->getHandler('review')->getCount();
@@ -111,6 +112,29 @@
'green'
);
}
+// Ratings
+if ($wfdownloads->getConfig('enable_ratings') == false) {
+ $indexAdmin->addInfoBoxLine(
+ _AM_WFDOWNLOADS_MINDEX_DOWNSUMMARY,
+ '<infolabel>' . _AM_WFDOWNLOADS_SVOTES . '</infolabel>',
+ _CO_WFDOWNLOADS_DISABLED,
+ 'red'
+ );
+} elseif ($votes_count > 0) {
+ $indexAdmin->addInfoBoxLine(
+ _AM_WFDOWNLOADS_MINDEX_DOWNSUMMARY,
+ '<infolabel><a href="ratings.php">' . _AM_WFDOWNLOADS_SVOTES . '</a></infolabel>',
+ $votes_count,
+ 'green'
+ );
+} else {
+ $indexAdmin->addInfoBoxLine(
+ _AM_WFDOWNLOADS_MINDEX_DOWNSUMMARY,
+ '<infolabel>' . _AM_WFDOWNLOADS_SVOTES . '</infolabel>',
+ $votes_count,
+ 'green'
+ );
+}
// Modifications
if ($modificationRequests_count > 0) {
$indexAdmin->addInfoBoxLine(
Modified: XoopsModules/wfdownloads/trunk/admin/menu.php
===================================================================
--- XoopsModules/wfdownloads/trunk/admin/menu.php 2014-07-22 12:18:06 UTC (rev 12722)
+++ XoopsModules/wfdownloads/trunk/admin/menu.php 2014-07-24 14:54:30 UTC (rev 12723)
@@ -20,11 +20,13 @@
*/
defined('XOOPS_ROOT_PATH') || die('XOOPS root path not defined');
-$module_handler = xoops_gethandler('module');
-$module = $module_handler->getByDirname(basename(dirname(dirname(__FILE__))));
-$pathIcon32 = '../../' . $module->getInfo('icons32');
+//$module_handler = xoops_gethandler('module');
+//$module = $module_handler->getByDirname(basename(dirname(dirname(__FILE__))));
+include_once dirname(dirname(__FILE__)) . '/include/common.php';
+$wfdownloads = WfdownloadsWfdownloads::getInstance();
+$pathIcon32 = '../../' . $wfdownloads->getModule()->getInfo('icons32');
-xoops_loadLanguage('modinfo', $module->dirname());
+xoops_loadLanguage('modinfo', $wfdownloads->getModule()->dirname());
$adminmenu = array();
$i=0;
@@ -59,6 +61,16 @@
$adminmenu[$i]['title'] = _MI_WFDOWNLOADS_MENU_INDEXPAGE;
$adminmenu[$i]['link'] = "admin/indexpage.php";
$adminmenu[$i]["icon"] = $pathIcon32 . '/index.png';
+/*
+// Swish-e support EXPERIMENTAL
+if ($wfdownloads->getConfig('enable_swishe') == true) {
+ ++$i;
+ $adminmenu[$i]['title'] = _MI_WFDOWNLOADS_MENU_SWISHE;
+ $adminmenu[$i]['link'] = "admin/swishe.php";
+ $adminmenu[$i]["icon"] = $pathIcon32 . '/search.png';
+}
+// Swish-e support EXPERIMENTAL
+*/
++$i;
$adminmenu[$i]['title'] = _MI_WFDOWNLOADS_MENU_IMAGES;
$adminmenu[$i]['link'] = "admin/images.php";
Modified: XoopsModules/wfdownloads/trunk/admin/mimetypes.php
===================================================================
--- XoopsModules/wfdownloads/trunk/admin/mimetypes.php 2014-07-22 12:18:06 UTC (rev 12722)
+++ XoopsModules/wfdownloads/trunk/admin/mimetypes.php 2014-07-24 14:54:30 UTC (rev 12723)
@@ -218,7 +218,7 @@
$GLOBALS['xoopsTpl']->assign('allowAdminMimetypes', $allowAdminMimetypes);
$GLOBALS['xoopsTpl']->assign('allowUserMimetypes', $allowUserMimetypes);
- $GLOBALS['xoopsTpl']->display("db:{$wfdownloads->getModule()->dirname()}_admin_mimetypeslist.tpl");
+ $GLOBALS['xoopsTpl']->display("db:{$wfdownloads->getModule()->dirname()}_am_mimetypeslist.tpl");
include 'admin_footer.php';
break;
Modified: XoopsModules/wfdownloads/trunk/admin/mirrors.php
===================================================================
--- XoopsModules/wfdownloads/trunk/admin/mirrors.php 2014-07-22 12:18:06 UTC (rev 12722)
+++ XoopsModules/wfdownloads/trunk/admin/mirrors.php 2014-07-24 14:54:30 UTC (rev 12723)
@@ -190,7 +190,7 @@
$xoopsTpl->assign('use_reviews', $wfdownloads->getConfig('enable_reviews'));
$xoopsTpl->assign('use_brokenreports', $wfdownloads->getConfig('enable_brokenreports'));
- $GLOBALS['xoopsTpl']->display("db:{$wfdownloads->getModule()->dirname()}_admin_mirrorslist.tpl");
+ $GLOBALS['xoopsTpl']->display("db:{$wfdownloads->getModule()->dirname()}_am_mirrorslist.tpl");
include 'admin_footer.php';
break;
Modified: XoopsModules/wfdownloads/trunk/admin/permissions.php
===================================================================
--- XoopsModules/wfdownloads/trunk/admin/permissions.php 2014-07-22 12:18:06 UTC (rev 12722)
+++ XoopsModules/wfdownloads/trunk/admin/permissions.php 2014-07-24 14:54:30 UTC (rev 12723)
@@ -45,6 +45,6 @@
$GLOBALS['xoopsTpl']->assign('down_cat_form', $down_cat_form->render());
$GLOBALS['xoopsTpl']->assign('up_cat_form', $up_cat_form->render());
-$GLOBALS['xoopsTpl']->display("db:{$wfdownloads->getModule()->dirname()}_admin_permissions.tpl");
+$GLOBALS['xoopsTpl']->display("db:{$wfdownloads->getModule()->dirname()}_am_permissions.tpl");
include 'admin_footer.php';
Modified: XoopsModules/wfdownloads/trunk/admin/ratings.php
===================================================================
--- XoopsModules/wfdownloads/trunk/admin/ratings.php 2014-07-22 12:18:06 UTC (rev 12722)
+++ XoopsModules/wfdownloads/trunk/admin/ratings.php 2014-07-24 14:54:30 UTC (rev 12723)
@@ -83,7 +83,7 @@
$xoopsTpl->assign('use_reviews', $wfdownloads->getConfig('enable_reviews'));
$xoopsTpl->assign('use_brokenreports', $wfdownloads->getConfig('enable_brokenreports'));
- $GLOBALS['xoopsTpl']->display("db:{$wfdownloads->getModule()->dirname()}_admin_ratingslist.tpl");
+ $GLOBALS['xoopsTpl']->display("db:{$wfdownloads->getModule()->dirname()}_am_ratingslist.tpl");
include 'admin_footer.php';
break;
Modified: XoopsModules/wfdownloads/trunk/admin/reportsmodifications.php
===================================================================
--- XoopsModules/wfdownloads/trunk/admin/reportsmodifications.php 2014-07-22 12:18:06 UTC (rev 12722)
+++ XoopsModules/wfdownloads/trunk/admin/reportsmodifications.php 2014-07-24 14:54:30 UTC (rev 12723)
@@ -404,7 +404,7 @@
$xoopsTpl->assign('use_reviews', $wfdownloads->getConfig('enable_reviews'));
$xoopsTpl->assign('use_brokenreports', $wfdownloads->getConfig('enable_brokenreports'));
- $GLOBALS['xoopsTpl']->display("db:{$wfdownloads->getModule()->dirname()}_admin_reportsmodificationslist.tpl");
+ $GLOBALS['xoopsTpl']->display("db:{$wfdownloads->getModule()->dirname()}_am_reportsmodificationslist.tpl");
include 'admin_footer.php';
break;
Modified: XoopsModules/wfdownloads/trunk/admin/reviews.php
===================================================================
--- XoopsModules/wfdownloads/trunk/admin/reviews.php 2014-07-22 12:18:06 UTC (rev 12722)
+++ XoopsModules/wfdownloads/trunk/admin/reviews.php 2014-07-24 14:54:30 UTC (rev 12723)
@@ -202,7 +202,7 @@
$xoopsTpl->assign('use_reviews', $wfdownloads->getConfig('enable_reviews'));
$xoopsTpl->assign('use_brokenreports', $wfdownloads->getConfig('enable_brokenreports'));
- $GLOBALS['xoopsTpl']->display("db:{$wfdownloads->getModule()->dirname()}_admin_reviewslist.tpl");
+ $GLOBALS['xoopsTpl']->display("db:{$wfdownloads->getModule()->dirname()}_am_reviewslist.tpl");
include 'admin_footer.php';
break;
Added: XoopsModules/wfdownloads/trunk/admin/swishe.php
===================================================================
--- XoopsModules/wfdownloads/trunk/admin/swishe.php (rev 0)
+++ XoopsModules/wfdownloads/trunk/admin/swishe.php 2014-07-24 14:54:30 UTC (rev 12723)
@@ -0,0 +1,78 @@
+<?php
+/*
+ You may not change or alter any portion of this comment or credits
+ of supporting developers from this source code or any supporting source code
+ which is considered copyrighted (c) material of the original comment or credit authors.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ */
+/**
+ * Wfdownloads module
+ *
+ * @copyright The XOOPS Project http://sourceforge.net/projects/xoops/
+ * @license GNU GPL 2 or later (http://www.gnu.org/licenses/gpl-2.0.html)
+ * @package wfdownload
+ * @since 3.23
+ * @author Xoops Development Team
+ * @version svn:$id$
+ */
+$currentFile = basename(__FILE__);
+include_once dirname(__FILE__) . '/admin_header.php';
+
+if (@$_POST['op'] == 'submit') {
+ if (!$GLOBALS['xoopsSecurity']->check()) {
+ redirect_header($currentFile, 3, implode('<br />', $GLOBALS['xoopsSecurity']->getErrors()));
+ exit();
+ }
+
+ wfdownloads_xoops_cp_header();
+ $indexAdmin = new ModuleAdmin();
+ echo $indexAdmin->addNavigation($currentFile);
+
+ // Swish-e support EXPERIMENTAL
+ wfdownloads_swishe_config();
+ // Swish-e support EXPERIMENTAL
+
+ include 'admin_footer.php';
+ exit();
+
+} else {
+ wfdownloads_xoops_cp_header();
+ $indexAdmin = new ModuleAdmin();
+ echo $indexAdmin->addNavigation($currentFile);
+
+ // Swish-e support EXPERIMENTAL
+ if (wfdownloads_swishe_check() == true) {
+ echo "OK";
+ } else {
+ echo "NOT OK" . "<br />";
+ include_once XOOPS_ROOT_PATH . '/class/xoopsformloader.php';
+ $form = new XoopsThemeForm(_AM_WFDOWNLOADS_SWISHE_CONFIG, 'config', $currentFile, 'post', true);
+ $form->addElement(new XoopsFormHidden('op', 'submit'));
+ $form->addElement(new XoopsFormButton('', '', _SUBMIT, 'submit'));
+ $form->display();
+ }
+
+ // Get the location of the document repository (the index files are located in the root)
+ $swisheDocPath = $wfdownloads->getConfig('uploaddir');
+
+ // Get the location of the SWISH-E executable
+ $swisheExePath = $wfdownloads->getConfig('swishe_exe_path');
+
+ // check if _binfilter.sh exists
+ echo "{$swisheDocPath}/_binfilter.sh" . "<br />";
+// IN PROGRESS
+ // check if swish-e.conf exists
+ echo "{$swisheDocPath}/swish-e.conf" . "<br />";
+// IN PROGRESS
+ // check if swish-e exists
+ echo "{$swisheExePath}/swish-e" . "<br />"; // path of swish-e command
+ echo "{$swisheDocPath}/index.swish-e" . "<br />"; // path of swish-e index file
+// IN PROGRESS
+ // Swish-e support EXPERIMENTAL
+
+ include 'admin_footer.php';
+ exit();
+}
Added: XoopsModules/wfdownloads/trunk/assets/images/module_logo_blank.png
===================================================================
(Binary files differ)
Index: XoopsModules/wfdownloads/trunk/assets/images/module_logo_blank.png
===================================================================
--- XoopsModules/wfdownloads/trunk/assets/images/module_logo_blank.png 2014-07-22 12:18:06 UTC (rev 12722)
+++ XoopsModules/wfdownloads/trunk/assets/images/module_logo_blank.png 2014-07-24 14:54:30 UTC (rev 12723)
Property changes on: XoopsModules/wfdownloads/trunk/assets/images/module_logo_blank.png
___________________________________________________________________
Added: svn:mime-type
## -0,0 +1 ##
+application/octet-stream
\ No newline at end of property
Modified: XoopsModules/wfdownloads/trunk/blocks/top_by_cat.php
===================================================================
--- XoopsModules/wfdownloads/trunk/blocks/top_by_cat.php 2014-07-22 12:18:06 UTC (rev 12722)
+++ XoopsModules/wfdownloads/trunk/blocks/top_by_cat.php 2014-07-24 14:54:30 UTC (rev 12723)
@@ -70,17 +70,17 @@
$block['downloads'][] = $download;
}
- $allsubcats_linked_totop = $wfdownloads->getHandler('category')->getAllSubcatsTopParentCid();
+ $categoriesTopParentByCid = $wfdownloads->getHandler('category')->getAllSubcatsTopParentCid();
+
foreach ($wfdownloads->getHandler('category')->topCategories as $cid) {
$block['topcats'][$cid]['title'] = $wfdownloads->getHandler('category')->allCategories[$cid]->getVar('title');
$block['topcats'][$cid]['cid'] = $cid;
$block['topcats'][$cid]['imgurl'] = $wfdownloads->getHandler('category')->allCategories[$cid]->getVar('imgurl');
}
-//mb foreach ($block['downloads'] as $key => $value) {
foreach ($block['downloads'] as $value) {
- $block['topcats'][$allsubcats_linked_totop[$value['cid']]]['downloads'][] = $value;
+ $block['topcats'][$categoriesTopParentByCid[$value['cid']]]['downloads'][] = $value;
}
return $block;
Modified: XoopsModules/wfdownloads/trunk/class/breadcrumb.php
===================================================================
--- XoopsModules/wfdownloads/trunk/class/breadcrumb.php 2014-07-22 12:18:06 UTC (rev 12722)
+++ XoopsModules/wfdownloads/trunk/class/breadcrumb.php 2014-07-24 14:54:30 UTC (rev 12723)
@@ -46,6 +46,8 @@
/**
* Add link to breadcrumb
*
+ * @param string $title
+ * @param string $link
*/
function addLink( $title='', $link='' )
{
@@ -69,7 +71,7 @@
require_once $GLOBALS['xoops']->path('class/template.php');
$breadcrumbTpl = new XoopsTpl();
$breadcrumbTpl->assign('breadcrumb', $this->_bread);
- $html = $breadcrumbTpl->fetch("db:" . $this->dirname . "_common_breadcrumb.tpl");
+ $html = $breadcrumbTpl->fetch("db:" . $this->dirname . "_co_breadcrumb.tpl");
unset($breadcrumbTpl);
return $html;
Modified: XoopsModules/wfdownloads/trunk/class/category.php
===================================================================
--- XoopsModules/wfdownloads/trunk/class/category.php 2014-07-22 12:18:06 UTC (rev 12722)
+++ XoopsModules/wfdownloads/trunk/class/category.php 2014-07-24 14:54:30 UTC (rev 12723)
@@ -107,7 +107,7 @@
);
}
// category: weight
- $form->addElement(new XoopsFormText(_AM_WFDOWNLOADS_FCATEGORY_WEIGHT, 'weight', 10, 80, $this->getVar('weight')), false);
+ $form->addElement(new XoopsFormText(_AM_WFDOWNLOADS_FCATEGORY_WEIGHT, 'weight', 11, 11, $this->getVar('weight')), false);
// permission: WFDownCatPerm
$groups = $gperm_handler->getGroupIds('WFDownCatPerm', $this->getVar('cid'), $this->wfdownloads->getModule()->mid());
$groups_down_select = new XoopsFormSelectGroup(_AM_WFDOWNLOADS_FCATEGORY_GROUPPROMPT, "groups", true, $groups, 5, true);
@@ -241,16 +241,16 @@
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($cid, $this->identifierName, $item_filename);
+ $mytree = new WfdownloadsXoopsTree($this->table, $this->keyName, 'pid');
+ $pathString = $mytree->getNicePathFromId($cid, $this->identifierName, $item_filename);
/**
* Replacing the " with ">" and deleteing the last ">" at the end
*/
- $pathstring = trim($pathstring);
- $pathstring = str_replace(':', '>', $pathstring);
-// $pathstring = substr($pathstring, 0, strlen($pathstring) - 13); // not needed now with fixed icms core! but required for XOOPS
- return $pathstring;
+ $pathString = trim($pathString);
+ $pathString = str_replace(':', '>', $pathString);
+// $pathString = substr($pathString, 0, strlen($pathString) - 13); // not needed now with fixed icms core! but required for XOOPS
+ return $pathString;
}
/**
@@ -266,7 +266,7 @@
global $xoopsUser;
$gperm_handler = xoops_gethandler('groupperm');
- $groups = is_object($xoopsUser) ? $xoopsUser->getGroups() : array(0 => XOOPS_GROUP_ANONYMOUS);
+ $groups = is_object($xoopsUser) ? $xoopsUser->getGroups() : array(0 => XOOPS_GROUP_ANONYMOUS);
$allowedDownCategoriesIds = $gperm_handler->getItemIds('WFDownCatPerm', $groups, $this->wfdownloads->getModule()->mid());
return $this->getObjects(new Criteria('cid', '(' . implode(',', $allowedDownCategoriesIds) . ')', 'IN'), $id_as_key, $as_object);
@@ -285,7 +285,7 @@
global $xoopsUser;
$gperm_handler = xoops_gethandler('groupperm');
- $groups = is_object($xoopsUser) ? $xoopsUser->getGroups() : array(0 => XOOPS_GROUP_ANONYMOUS);
+ $groups = is_object($xoopsUser) ? $xoopsUser->getGroups() : array(0 => XOOPS_GROUP_ANONYMOUS);
$allowedDownCategoriesIds = $gperm_handler->getItemIds('WFDownCatPerm', $groups, $this->wfdownloads->getModule()->mid());
return $this->getObjects(new Criteria('cid', '(' . implode(',', $allowedDownCategoriesIds) . ')', 'IN'), $id_as_key, $as_object);
@@ -302,7 +302,7 @@
global $xoopsUser;
$gperm_handler = xoops_gethandler('groupperm');
- $groups = is_object($xoopsUser) ? $xoopsUser->getGroups() : XOOPS_GROUP_ANONYMOUS;
+ $groups = is_object($xoopsUser) ? $xoopsUser->getGroups() : XOOPS_GROUP_ANONYMOUS;
$allowedUpCategoriesIds = $gperm_handler->getItemIds('WFUpCatPerm', $groups, $this->wfdownloads->getModule()->mid());
return $this->getObjects(new Criteria('cid', '(' . implode(',', $allowedUpCategoriesIds) . ')', 'IN'), $id_as_key, $as_object);
@@ -315,11 +315,11 @@
*/
function getChildCats($category)
{
- $allcats = $this->getObjects();
+ $categoryObjs = $this->getObjects();
include_once XOOPS_ROOT_PATH . '/class/tree.php';
- $tree = new XoopsObjectTree($allcats, $this->keyName, 'pid');
+ $categoryObjsTree = new XoopsObjectTree($categoryObjs, $this->keyName, 'pid');
- return $tree->getAllChild($category->getVar($this->keyName));
+ return $categoryObjsTree->getAllChild($category->getVar($this->keyName));
}
/**
@@ -332,52 +332,62 @@
}
include_once XOOPS_ROOT_PATH . '/class/tree.php';
- $tree = new XoopsObjectTree($this->allCategories, $this->keyName, 'pid');
- $treeobj = $tree->getTree();
+ $categoryObjsTree = new XoopsObjectTree($this->allCategories, $this->keyName, 'pid');
- /**
- * Let's create an array where key will be cid of the top categories and
- * value will be an array containing all the cid of its subcategories
- * If value = 0, then this topcat does not have any subcats
- */
- $topcatsarray = array();
- foreach ($treeobj[0]['child'] as $topcid) {
- if (!isset($this->topCategories[$topcid])) {
- $this->topCategories[$topcid] = $topcid;
+ $allsubcats_linked_totop = array();
+ foreach ($this->allCategories as $cid => $category) {
+ $parentCategoryObjs = $categoryObjsTree->getAllParent($cid);
+ if (count($parents) == 0) {
+ // is a top category
+ $allsubcats_linked_totop[$cid] = $cid;
+ } else {
+ // is not a top category
+ $topParentCategoryObj = end($parentCategoryObjs);
+ $allsubcats_linked_totop[$cid] = $topParentCategoryObj->getVar($cid);
}
- foreach ($tree->getAllChild($topcid) as /*$key =>*/ $category) {
- $childrenids[] = $category->getVar('cid');
+ unset($parentCategoryObjs);
+ }
+ return $allsubcats_linked_totop;
+/*
+ $categoryObjsTreeNodes = $categoryObjsTree->getTree();
+
+ // Let's create an array where key will be cid of the top categories and
+ // value will be an array containing all the cid of its subcategories
+ // If value = 0, then this topcat does not have any subcats
+ $topCategories = array();
+ foreach ($categoryObjsTreeNodes[0]['child'] as $topCategory_cid) {
+ if (!isset($this->topCategories[$topCategory_cid])) {
+ $this->topCategories[$topCategory_cid] = $topCategory_cid;
}
- $childrenids = isset($childrenids) ? $childrenids : 0;
- $topcatsarray[$topcid] = $childrenids;
- unset($childrenids);
+ foreach ($categoryObjsTree->getAllChild($topCategory_cid) as $key => $childCategory) {
+ $childCategory_cids[] = $childCategory->getVar('cid');
+ }
+ $childCategory_cids = isset($childCategory_cids) ? $childCategory_cids : 0;
+ $topCategories[$topCategory_cid] = $childCategory_cids;
+ unset($childCategory_cids);
}
- /**
- * Now we need to create another array where key will be all subcategories cid and
- * value will be the cid of its top most category
- */
+ // Now we need to create another array where key will be all subcategories cid and
+ // value will be the cid of its top most category
$allsubcats_linked_totop = array();
- foreach ($topcatsarray as $topcatcid => $subcatsarray) {
- if ($subcatsarray == 0) {
- $allsubcats_linked_totop[$topcatcid] = $topcatcid;
+ foreach ($topCategories as $topCategory_cid => $childCategory_cids) {
+ if ($childCategory_cids == 0) {
+ $allsubcats_linked_totop[$topCategory_cid] = $topCategory_cid;
} else {
- foreach ($subcatsarray as $subcatcid) {
- $allsubcats_linked_totop[$subcatcid] = $topcatcid;
+ foreach ($childCategory_cids as $childCategory_cid) {
+ $allsubcats_linked_totop[$childCategory_cid] = $topCategory_cid;
}
}
}
- /**
- * Finally, let's finish by adding to this array, all the top categories which values
- * will be their cid
- */
-// foreach ($this->topCategories as $topcid) {
- foreach ($topcatsarray as $topcid) {
- $allsubcats_linked_totop[$topcid] = $topcid;
+ // Finally, let's finish by adding to this array, all the top categories which values
+ // will be their cid
+ foreach ($topCategories as $topCategory_cid) {
+ $allsubcats_linked_totop[$topCategory_cid] = $topCategory_cid;
}
return $allsubcats_linked_totop;
+*/
}
}
Modified: XoopsModules/wfdownloads/trunk/class/download.php
===================================================================
--- XoopsModules/wfdownloads/trunk/class/download.php 2014-07-22 12:18:06 UTC (rev 12722)
+++ XoopsModules/wfdownloads/trunk/class/download.php 2014-07-24 14:54:30 UTC (rev 12723)
@@ -446,7 +446,7 @@
// Return if download has custom fields
$download['has_custom_fields'] = (wfdownloads_checkModule('formulize') && $this->getVar('formulize_idreq'));
-
+
return $download;
}
@@ -1149,6 +1149,8 @@
// Formulize module support (2006/03/06, 2006/03/08) jpc - start
/**
+ * @param $title
+ *
* @return XoopsThemeForm
*/
function getCategoryForm($title)
Modified: XoopsModules/wfdownloads/trunk/class/wfdownloads_lists.php
===================================================================
--- XoopsModules/wfdownloads/trunk/class/wfdownloads_lists.php 2014-07-22 12:18:06 UTC (rev 12722)
+++ XoopsModules/wfdownloads/trunk/class/wfdownloads_lists.php 2014-07-24 14:54:30 UTC (rev 12723)
@@ -40,6 +40,15 @@
* Images
* files
* dir
+ *
+ * @param string $path
+ * @param null $value
+ * @param string $selected
+ * @param int $size
+ * @param int $emptyselect
+ * @param int $type
+ * @param string $prefix
+ * @param string $suffix
*/
function __construct($path = "uploads", $value = null, $selected = '', $size = 1, $emptyselect = 0, $type = 0, $prefix = '', $suffix = '')
@@ -78,6 +87,8 @@
/**
* Private to be called by other parts of the class
+ * @param $dirname
+ * @return array
*/
function &getDirListAsArray($dirname)
{
Modified: XoopsModules/wfdownloads/trunk/docs/changelog.txt
===================================================================
--- XoopsModules/wfdownloads/trunk/docs/changelog.txt 2014-07-22 12:18:06 UTC (rev 12722)
+++ XoopsModules/wfdownloads/trunk/docs/changelog.txt 2014-07-24 14:54:30 UTC (rev 12723)
@@ -1,4 +1,5 @@
-<b><u>=> Version 3.23 Beta (2014-04-27)</u></b>
+<b><u>=> Version 3.23 RC2 (2014-07-24)</u></b>
+- todo: Swish-e files indexing support
- removed obsolete eval() that was used for PHP4 (mamba)
- removed object.php file (mamba)
- 'file_url' is calculated inside download object for better usability (luciorota)
Modified: XoopsModules/wfdownloads/trunk/include/functions.php
===================================================================
--- XoopsModules/wfdownloads/trunk/include/functions.php 2014-07-22 12:18:06 UTC (rev 12722)
+++ XoopsModules/wfdownloads/trunk/include/functions.php 2014-07-24 14:54:30 UTC (rev 12723)
@@ -175,6 +175,11 @@
return null;
}
+/**
+ * @param string $path
+ *
+ * @return array
+ */
function wfdownloads_getFiles($path = '.')
{
$files = array();
@@ -343,8 +348,8 @@
if (count($subCategoryObjs) > 0) {
++$level;
foreach ($subCategoryObjs as $subCategoryObj) {
- $pid = $subCategoryObj->getVar('pid');
- $cid = $subCategoryObj->getVar('cid');
+ $pid = $subCategoryObj->getVar('pid');
+ $cid = $subCategoryObj->getVar('cid');
$sorted[] = array('pid' => $pid, 'cid' => $cid, 'level' => $level, 'category' => $subCategoryObj->toArray());
if ($subSorted = wfdownloads_sortCategories($cid, $level)) {
$sorted = array_merge($sorted, $subSorted);
@@ -397,7 +402,7 @@
$letterschoiceTpl = new XoopsTpl();
$letterschoiceTpl->caching = false; // Disable cache
$letterschoiceTpl->assign('alphabet', $alphabet_array);
- $html = $letterschoiceTpl->fetch("db:" . $wfdownloads->getModule()->dirname() . "_common_letterschoice.tpl");
+ $html = $letterschoiceTpl->fetch("db:" . $wfdownloads->getModule()->dirname() . "_co_letterschoice.tpl");
unset($letterschoiceTpl);
return $html;
@@ -1315,7 +1320,7 @@
*
* @return int
*/
-function return_bytes($size_str)
+function wfdownloads_return_bytes($size_str)
{
switch (substr ($size_str, -1))
{
@@ -1366,7 +1371,7 @@
$file_name = $_FILES['userfile']['name'];
//Admin can upload files of any size
if (wfdownloads_userIsAdmin()) {
- $maxFileSize = return_bytes(ini_get('upload_max_filesize'));
+ $maxFileSize = wfdownloads_return_bytes(ini_get('upload_max_filesize'));
} else {
$maxFileSize = $wfdownloads->getConfig('maxfilesize');
}
@@ -1460,15 +1465,18 @@
// IN PROGRESS
// IN PROGRESS
/**
-* @author Jack Mason
-* @website volunteer @ http://www.osipage.com, web access application and bookmarking tool.
-* @copyright Free script, use anywhere as you like, no attribution required
-* @created 2014
-* The script is capable of downloading really large files in PHP. Files greater than 2GB may fail in 32-bit windows or similar system.
-* All incorrect headers have been removed and no nonsense code remains in this script. Should work well.
-* The best and most recommended way to download files with PHP is using xsendfile, learn
-* more here: https://tn123.org/mod_xsendfile/
-*/
+ * @author Jack Mason
+ * @website volunteer @ http://www.osipage.com, web access application and bookmarking tool.
+ * @copyright Free script, use anywhere as you like, no attribution required
+ * @created 2014
+ * The script is capable of downloading really large files in PHP. Files greater than 2GB may fail in 32-bit windows or similar system.
+ * All incorrect headers have been removed and no nonsense code remains in this script. Should work well.
+ * The best and most recommended way to download files with PHP is using xsendfile, learn
+ * more here: https://tn123.org/mod_xsendfile/
+ *
+ * @param $filePath
+ * @param $fileMimetype
+ */
function wfdownloads_largeDownload($filePath, $fileMimetype)
{
/* You may need these ini settings too */
@@ -1694,96 +1702,118 @@
return $truncate;
}
-// IN PROGRESS
-// IN PROGRESS
-// IN PROGRESS
-/*
-php4swish-e 1.1, a web search interface for the swish-e search engine.
-swish-e is a popular open-source search engine that runs on many platforms.
-More information on swish-e is available at swish-e.org.
-This code has been thoroughly tested and is ready for production
- on any UNIX or Linux server that has the swish-e search engine installed.
-You are free to modify this code as you see fit.
-You must specify the path of swish-e ($swish) and
- the location of the search index file ($search_index).
-You will also need to change the default index file served if it is not index.php.
-If you want the meta description information to display completely,
- be sure the <meta description... information is on *one* line for each web page.
-If you wish to allow external search forms to call this script, be sure to set the
- form's action attribute to whatever you name this file.
-Suggestions for enhancements are welcome.
-*/
+
+
+// Swish-e support EXPERIMENTAL
+/**
+ * php4swish-e 1.1, a web search interface for the swish-e search engine.
+ * swish-e is a popular open-source search engine that runs on many platforms.
+ * More information on swish-e is available at swish-e.org.
+ * This code has been thoroughly tested and is ready for production
+ * on any UNIX or Linux server that has the swish-e search engine installed.
+ * You are free to modify this code as you see fit.
+ * You must specify the path of swish-e ($swish) and
+ * the location of the search index file ($swisheIndexFilePath).
+ * You will also need to change the default index file served if it is not index.php.
+ * If you want the meta description information to display completely,
+ * be sure the <meta description... information is on *one* line for each web page.
+ * If you wish to allow external search forms to call this script, be sure to set the
+ * form's action attribute to whatever you name this file.
+ * Suggestions for enhancements are welcome.
+ */
+function wfdownloads_swishe_check()
+{
+ $wfdownloads = WfdownloadsWfdownloads::getInstance();
+
+ // Get the location of the document repository (the index files are located in the root)
+ $swisheDocPath = $wfdownloads->getConfig('uploaddir');
+
+ // Get the location of the SWISH-E executable
+ $swisheExePath = $wfdownloads->getConfig('swishe_exe_path');
+
+ // check if _binfilter.sh exists
+ if (!is_file("{$swisheDocPath}/_binfilter.sh")) {
+ return false;
+ }
+
+ // check if swish-e.conf exists
+ if (!is_file("{$swisheDocPath}/swish-e.conf")) {
+ return false;
+ }
+
+ // check if swish-e.exe exists
+ if (!is_file("{$swisheExePath}/swish-e.exe")) {
+ return false;
+ }
+
+ return true;
+}
+
function wfdownloads_swishe_config()
{
$wfdownloads = WfdownloadsWfdownloads::getInstance();
- // Get the path to the repository
- // IN PROGRESS
- // IN PROGRESS
- // IN PROGRESS
- $swisheDocPath = $wfdownloads->getConfig('swishe_doc_path'); // IN PROGRESS WFDOWNLOADS REPOSITORY PATH
+ // Get the location of the document repository (the index files are located in the root)
+ $swisheDocPath = $wfdownloads->getConfig('uploaddir');
// Create _binfilter.sh
- // IN PROGRESS
- // IN PROGRESS
- // IN PROGRESS
- //$file = "{$swisheDocPath}/_binfilter.sh";
- //$fp = fopen($file, 'w') or die("<BR><BR>Unable to open $file");
- //fputs($fp, "strings \"\$1\" - 2>/dev/null\n");
- //fclose($fp);
- //chmod($file, 0755);
+ $file = "{$swisheDocPath}/_binfilter.sh";
+ $fp = fopen($file, 'w') or die("<BR><BR>Unable to open $file");
+ fputs($fp, "strings \"\$1\" - 2>/dev/null\n");
+ fclose($fp);
+ chmod($file, 0755);
+ unset($fp);
// Create swish-e.conf
$file = "{$swisheDocPath}/swish-e.conf";
- $fp = fopen($file, 'w') || die("<BR><BR>Unable to open {$file}");
- $line = "IndexDir {$swisheDocPath}/\n";
- fputs($fp, $line);
- $line = "IndexFile {$swisheDocPath}/index.swish-e\n";
- fputs($fp, $line);
- //$line = "TruncateDocSize 100000\n";
- //fputs($fp,$line);
- $line = "IndexReport 1\n";
- fputs($fp, $line);
- $line = "IndexContents TXT* .dat\n";
- fputs($fp, $line);
- //$line = "FileFilter .dat \"{$swisheDocPath}/_binfilter.sh\" \"'%p'\"\n";
- //fputs($fp,$line);
- $line = "IndexOnly .dat\n";
- fputs($fp, $line);
- $line = "MinWordLimit 3\n";
- fputs($fp, $line);
+ $fp = fopen($file, 'w') or die("<BR><BR>Unable to open {$file}");
+ // IndexDir [directories or files|URL|external program]
+ // IndexDir defines the source of the documents for Swish-e. Swish-e currently supports three file access methods: File system, HTTP (also called spidering), and prog for reading files from an external program.
+ fputs($fp, "IndexDir {$swisheDocPath}/\n");
+ // IndexFile *path*
+ // Index file specifies the location of the generated index file. If not specified, Swish-e will create the file index.swish-e in the current directory.
+ fputs($fp, "IndexFile {$swisheDocPath}/index.swish-e\n");
+ // TruncateDocSize *number of characters*
+ // TruncateDocSize limits the size of a document while indexing documents and/or using filters. This config directive truncates the numbers of read bytes of a document to the specified size. This means: if a document is larger, read only the specified numbers of bytes of the document.
+ //fputs($fp, "TruncateDocSize 100000\n");
+ // IndexReport [0|1|2|3]
+ // This is how detailed you want reporting while indexing. You can specify numbers 0 to 3. 0 is totally silent, 3 is the most verbose. The default is 1.
+ fputs($fp, "IndexReport 1\n");
+ // IndexContents [TXT|HTML|XML|TXT2|HTML2|XML2|TXT*|HTML*|XML*] *file extensions*
+ // The IndexContents directive assigns one of Swish-e's document parsers to a document, based on the its extension. Swish-e currently knows how to parse TXT, HTML, and XML documents.
+ fputs($fp, "IndexContents TXT* .dat\n");
+ // FileFilter *suffix* "filter-prog" ["filter-options"]
+ // This maps file suffix (extension) to a filter program. If filter-prog starts with a directory delimiter (absolute path), Swish-e doesn't use the FilterDir settings, but uses the given filter-prog path directly.
+ //fputs($fp, "FileFilter .dat \"{$swisheDocPath}/_binfilter.sh\" \"'%p'\"\n");
+ // IndexOnly *list of file suffixes*
+ // This directive specifies the allowable file suffixes (extensions) while indexing. The default is to index all files specified in IndexDir.
+ fputs($fp, "IndexOnly .dat\n");
+ // MinWordLimit *integer*
+ // Set the minimum length of an word. Shorter words will not be indexed. The default is 1 (as defined in src/config.h).
+ fputs($fp, "MinWordLimit 3\n");
fclose($fp);
chmod($file, 0755);
-
- // IN PROGRESS
- // IN PROGRESS
- // IN PROGRESS
- print("<SCRIPT LANGUAGE='Javascript'>\r");
- print("location='config_main.php';");
- print("</SCRIPT>");
}
-// IN PROGRESS
-// IN PROGRESS
-// IN PROGRESS
/**
- * @param $search_query
+ * @param $swisheQueryWords
*/
-function wfdownloads_swishe_search($search_query)
+function wfdownloads_swishe_search($swisheQueryWords)
{
$wfdownloads = WfdownloadsWfdownloads::getInstance();
+ $ret = false;
// IN PROGRESS
// IN PROGRESS
// IN PROGRESS
- $search_query = stripslashes($search_query);
- if (((strlen($search_query) > 2) && ($last_query != $search_query)) && ($page == false)) {
+ $swisheQueryWords = stripslashes($swisheQueryWords);
+ if (strlen($swisheQueryWords) > 2) {
//print "<BR>SEARCH!";
- // Get the first word in $search_query and use it for the $summary_query.
+ // Get the first word in $swisheQueryWords and use it for the $summary_query.
// IN PROGRESS
// IN PROGRESS
// IN PROGRESS
- $summary_query = str_replace("\"", " ", $search_query);
+ $summary_query = str_replace("\"", " ", $swisheQueryWords);
$summary_query = trim($summary_query);
$summary_query_e = explode(" ", $summary_query);
$summary_query = trim($summary_query_e[0]);
@@ -1792,42 +1822,32 @@
//print "<BR>SQ: ".$summary_query;
// Get the location of the document repository (the index files are located in the root)
- // IN PROGRESS
- // IN PROGRESS
- // IN PROGRESS
- $swisheDocPath = $wfdownloads->getConfig('swishe_doc_path'); // IN PROGRESS WFDOWNLOADS REPOSITORY PATH
+ $swisheDocPath = $wfdownloads->getConfig('uploaddir');
$swisheDocPath_strlen = strlen($wfdownloads->getConfig('swishe_doc_path'));
// Get the location of the SWISH-E executable
- // IN PROGRESS
- // IN PROGRESS
- // IN PROGRESS
$swisheExePath = $wfdownloads->getConfig('swishe_exe_path');
- // Get the search_limit to limit the search to X number of entries
- // IN PROGRESS
- // IN PROGRESS
- // IN PROGRESS
- $search_limit = $wfdownloads->getConfig('search_limit');
- //print "<BR>Query: ".$search_query;
-
// Get search query
- $search_query = EscapeShellCmd($search_query); // escape potentially malicious shell commands
- $search_query = stripslashes($search_query); // remove backslashes from search query
- $search_query = preg_replace('#("|\')#', '', $search_query); // remove quotes from search query
- $swish = "{$swisheExePath}/swish-e"; // path of swish-e command
- $search_index = "{$swisheDocPath}/index.swish-e"; // path of swish-e index file
- $search_params = "-H1 -m{$search_limit}"; // Additional search parameters
+ $swisheQueryWords = escapeshellcmd($swisheQueryWords); // escape potentially malicious shell commands
+ $swisheQueryWords = stripslashes($swisheQueryWords); // remove backslashes from search query
+ $swisheQueryWords = preg_replace('#("|\')#', '', $swisheQueryWords); // remove quotes from search query
+ $swisheCommand = "{$swisheExePath}/swish-e"; // path of swish-e command
+ $swisheIndexFilePath = "{$swisheDocPath}/index.swish-e"; // path of swish-e index file
+ $swisheSearchParams = ""; // Additional search parameters
+ $swisheSearchParams .= "-H1"; // -H1 : print standard result header (default).
+ if ($wfdownloads->getConfig('swishe_search_limit') != 0) {
+ $swisheSearchParams .= " -m{$wfdownloads->getConfig('swishe_search_limit')}"; // -m *number* (max results)
+ }
// Opens a pipe to swish-e
- $pipe_handler = popen("{$swish} -w {$search_query} -f {$search_index} {$search_params}", "r")
- || die("The search request generated an error...Please try again.");
+ $swishePipeHandler = popen("{$swisheCommand} -w {$swisheQueryWords} -f {$swisheIndexFilePath} {$swisheSearchParams}", "r");
+ if(!$swishePipeHandler) die("The search request generated an error...Please try again.");
+error_log("{$swisheCommand} -w {$swisheQueryWords} -f {$swisheIndexFilePath} {$swisheSearchParams}");
- //print "$swish -w $search_query -f $search_index $search_params<BR>";
-
$line_cnt = 1;
// loop through each line of the pipe result (i.e. swish-e output) to find hit number
- while ($nline = @fgets($pipe_handler, 1024)) {
+ while ($nline = @fgets($swishePipeHandler, 1024)) {
if ($line_cnt == 4) {
$num_line = $nline;
break; // grab the 4th line, which contains the number of hits returned
@@ -1836,12 +1856,13 @@
}
// strip out all but the number of hits
- $num_results = preg_replace('/# Number of hits: /', '', $num_line);
+ //$num_results = preg_replace('/# Number of hits: /', '', $num_line);
//$table_header_flag = false;
//$disp_nff_flag = true;
- while ($line = @fgets($pipe_handler, 4096)) {
+ $ret = array();
+ while ($line = @fgets($swishePipeHandler, 4096)) {
// loop through each line of the pipe result (i.e. swish-e output)
if (preg_match("/^(\d+)\s+(\S+)\s+\"(.*)\"\s+(\d+)/", $line)) {
// Skip commented-out lines and the last line
@@ -1849,60 +1870,24 @@
$line[1] = preg_replace("/[[:blank:]]/", "%%", $line[1]); // replace every space with %% for the phrase in quotation marks
$line = implode('"', $line); // collapse the array into a string
$line = preg_replace("/[[:blank:]]/", "\t", $line); // replace every space with a tab
- list ($rel...
[truncated message content] |