|
From: <luc...@us...> - 2013-05-24 21:43:04
|
Revision: 11584
http://sourceforge.net/p/xoops/svn/11584
Author: luciorota
Date: 2013-05-24 21:43:01 +0000 (Fri, 24 May 2013)
Log Message:
-----------
code cleanup
Modified Paths:
--------------
XoopsModules/wfdownloads/trunk/wfdownloads/admin/about.php
XoopsModules/wfdownloads/trunk/wfdownloads/admin/admin_footer.php
XoopsModules/wfdownloads/trunk/wfdownloads/admin/admin_header.php
XoopsModules/wfdownloads/trunk/wfdownloads/admin/admin_header2.php
XoopsModules/wfdownloads/trunk/wfdownloads/admin/brokendown.php
XoopsModules/wfdownloads/trunk/wfdownloads/admin/category.php
XoopsModules/wfdownloads/trunk/wfdownloads/admin/cookies.js
XoopsModules/wfdownloads/trunk/wfdownloads/admin/funcs.js
XoopsModules/wfdownloads/trunk/wfdownloads/admin/import.php
XoopsModules/wfdownloads/trunk/wfdownloads/admin/index.php
XoopsModules/wfdownloads/trunk/wfdownloads/admin/indexpage.php
XoopsModules/wfdownloads/trunk/wfdownloads/admin/ip_log.php
XoopsModules/wfdownloads/trunk/wfdownloads/admin/menu.php
XoopsModules/wfdownloads/trunk/wfdownloads/admin/mimetypes.php
XoopsModules/wfdownloads/trunk/wfdownloads/admin/mirror.php
XoopsModules/wfdownloads/trunk/wfdownloads/admin/modifications.php
XoopsModules/wfdownloads/trunk/wfdownloads/admin/newdownloads.php
XoopsModules/wfdownloads/trunk/wfdownloads/admin/newstory.php
XoopsModules/wfdownloads/trunk/wfdownloads/admin/permissions.php
XoopsModules/wfdownloads/trunk/wfdownloads/admin/review.php
XoopsModules/wfdownloads/trunk/wfdownloads/admin/update.php
XoopsModules/wfdownloads/trunk/wfdownloads/admin/votedata.php
XoopsModules/wfdownloads/trunk/wfdownloads/blocks/index.html
XoopsModules/wfdownloads/trunk/wfdownloads/blocks/wfdownloads_top.php
XoopsModules/wfdownloads/trunk/wfdownloads/blocks/wfdownloads_top_by_cat.php
XoopsModules/wfdownloads/trunk/wfdownloads/brokenfile.php
XoopsModules/wfdownloads/trunk/wfdownloads/class/category.php
XoopsModules/wfdownloads/trunk/wfdownloads/class/dbupdater.php
XoopsModules/wfdownloads/trunk/wfdownloads/class/download.php
XoopsModules/wfdownloads/trunk/wfdownloads/class/img_uploader.php
XoopsModules/wfdownloads/trunk/wfdownloads/class/index.html
XoopsModules/wfdownloads/trunk/wfdownloads/class/ip_log.php
XoopsModules/wfdownloads/trunk/wfdownloads/class/mimetype.php
XoopsModules/wfdownloads/trunk/wfdownloads/class/mirror.php
XoopsModules/wfdownloads/trunk/wfdownloads/class/modification.php
XoopsModules/wfdownloads/trunk/wfdownloads/class/object.php
XoopsModules/wfdownloads/trunk/wfdownloads/class/rating.php
XoopsModules/wfdownloads/trunk/wfdownloads/class/report.php
XoopsModules/wfdownloads/trunk/wfdownloads/class/review.php
XoopsModules/wfdownloads/trunk/wfdownloads/class/uploader.php
XoopsModules/wfdownloads/trunk/wfdownloads/class/wfd_lists.php
XoopsModules/wfdownloads/trunk/wfdownloads/comment_delete.php
XoopsModules/wfdownloads/trunk/wfdownloads/comment_edit.php
XoopsModules/wfdownloads/trunk/wfdownloads/comment_new.php
XoopsModules/wfdownloads/trunk/wfdownloads/comment_post.php
XoopsModules/wfdownloads/trunk/wfdownloads/comment_reply.php
XoopsModules/wfdownloads/trunk/wfdownloads/docs/changelog.txt
XoopsModules/wfdownloads/trunk/wfdownloads/docs/english/__about.html
XoopsModules/wfdownloads/trunk/wfdownloads/docs/index.html
XoopsModules/wfdownloads/trunk/wfdownloads/footer.php
XoopsModules/wfdownloads/trunk/wfdownloads/header.php
XoopsModules/wfdownloads/trunk/wfdownloads/images/category/index.html
XoopsModules/wfdownloads/trunk/wfdownloads/images/category/thumbs/index.html
XoopsModules/wfdownloads/trunk/wfdownloads/images/icon/index.html
XoopsModules/wfdownloads/trunk/wfdownloads/images/index.html
XoopsModules/wfdownloads/trunk/wfdownloads/images/screenshots/index.html
XoopsModules/wfdownloads/trunk/wfdownloads/images/screenshots/thumbs/140x79_imonfire.gif
XoopsModules/wfdownloads/trunk/wfdownloads/images/screenshots/thumbs/index.html
XoopsModules/wfdownloads/trunk/wfdownloads/include/comment_functions.php
XoopsModules/wfdownloads/trunk/wfdownloads/include/common.php
XoopsModules/wfdownloads/trunk/wfdownloads/include/functions.php
XoopsModules/wfdownloads/trunk/wfdownloads/include/index.html
XoopsModules/wfdownloads/trunk/wfdownloads/include/js/index.html
XoopsModules/wfdownloads/trunk/wfdownloads/include/notification.inc.php
XoopsModules/wfdownloads/trunk/wfdownloads/include/search.inc.php
XoopsModules/wfdownloads/trunk/wfdownloads/include/update.php
XoopsModules/wfdownloads/trunk/wfdownloads/index.php
XoopsModules/wfdownloads/trunk/wfdownloads/language/english/admin.php
XoopsModules/wfdownloads/trunk/wfdownloads/language/english/help/help.html
XoopsModules/wfdownloads/trunk/wfdownloads/language/english/main.php
XoopsModules/wfdownloads/trunk/wfdownloads/language/english/modinfo.php
XoopsModules/wfdownloads/trunk/wfdownloads/mirror.php
XoopsModules/wfdownloads/trunk/wfdownloads/module.css
XoopsModules/wfdownloads/trunk/wfdownloads/newlist.php
XoopsModules/wfdownloads/trunk/wfdownloads/notification_update.php
XoopsModules/wfdownloads/trunk/wfdownloads/ratefile.php
XoopsModules/wfdownloads/trunk/wfdownloads/review.php
XoopsModules/wfdownloads/trunk/wfdownloads/rss.php
XoopsModules/wfdownloads/trunk/wfdownloads/singlefile.php
XoopsModules/wfdownloads/trunk/wfdownloads/sql/index.html
XoopsModules/wfdownloads/trunk/wfdownloads/sql/wfdownloads.sql
XoopsModules/wfdownloads/trunk/wfdownloads/submit.php
XoopsModules/wfdownloads/trunk/wfdownloads/thickbox.css
XoopsModules/wfdownloads/trunk/wfdownloads/topten.php
XoopsModules/wfdownloads/trunk/wfdownloads/uploads/index.html
XoopsModules/wfdownloads/trunk/wfdownloads/viewcat.php
XoopsModules/wfdownloads/trunk/wfdownloads/visit.php
XoopsModules/wfdownloads/trunk/wfdownloads/xoops_version.php
Added Paths:
-----------
XoopsModules/wfdownloads/trunk/wfdownloads/admin/download.php
XoopsModules/wfdownloads/trunk/wfdownloads/admin/imageupload.php
XoopsModules/wfdownloads/trunk/wfdownloads/admin/index.html
XoopsModules/wfdownloads/trunk/wfdownloads/index.html
Removed Paths:
-------------
XoopsModules/wfdownloads/trunk/wfdownloads/admin/main.php
XoopsModules/wfdownloads/trunk/wfdownloads/admin/upload.php
Modified: XoopsModules/wfdownloads/trunk/wfdownloads/admin/about.php
===================================================================
--- XoopsModules/wfdownloads/trunk/wfdownloads/admin/about.php 2013-05-24 21:34:18 UTC (rev 11583)
+++ XoopsModules/wfdownloads/trunk/wfdownloads/admin/about.php 2013-05-24 21:43:01 UTC (rev 11584)
@@ -1,23 +1,23 @@
<?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.
+ 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.
*/
-
/**
- * @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
- * @since
- * @author XOOPS Development Team
- * @version $Id $
+ * WF-Downloads module
+ *
+ * @copyright The XOOPS Project http://sourceforge.net/projects/xoops/
+ * @license GNU GPL 2 (http://www.gnu.org/licenses/old-licenses/gpl-2.0.html)
+ * @package wfdownload
+ * @since 3.23
+ * @author WF-Sections, Xoops Development Team, luciorota
+ * @version svn:$Id$
*/
-
include_once dirname(__FILE__) . '/admin_header.php';
xoops_cp_header();
Modified: XoopsModules/wfdownloads/trunk/wfdownloads/admin/admin_footer.php
===================================================================
--- XoopsModules/wfdownloads/trunk/wfdownloads/admin/admin_footer.php 2013-05-24 21:34:18 UTC (rev 11583)
+++ XoopsModules/wfdownloads/trunk/wfdownloads/admin/admin_footer.php 2013-05-24 21:43:01 UTC (rev 11584)
@@ -1,23 +1,23 @@
<?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.
+ 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.
*/
-
/**
- * @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
- * @since
- * @author XOOPS Development Team
- * @version $Id $
+ * WF-Downloads module
+ *
+ * @copyright The XOOPS Project http://sourceforge.net/projects/xoops/
+ * @license GNU GPL 2 (http://www.gnu.org/licenses/old-licenses/gpl-2.0.html)
+ * @package wfdownload
+ * @since 3.23
+ * @author WF-Sections, Xoops Development Team, luciorota
+ * @version svn:$Id$
*/
-
echo "<div class='adminfooter'>\n"
." <div style='text-align: center;'>\n"
." <a href='http://www.xoops.org' rel='external'><img src='{$pathIcon32}/xoopsmicrobutton.gif' alt='XOOPS' title='XOOPS'></a>\n"
Modified: XoopsModules/wfdownloads/trunk/wfdownloads/admin/admin_header.php
===================================================================
--- XoopsModules/wfdownloads/trunk/wfdownloads/admin/admin_header.php 2013-05-24 21:34:18 UTC (rev 11583)
+++ XoopsModules/wfdownloads/trunk/wfdownloads/admin/admin_header.php 2013-05-24 21:43:01 UTC (rev 11584)
@@ -1,23 +1,23 @@
<?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.
+ 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.
*/
-
/**
- * @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
- * @since
- * @author XOOPS Development Team
- * @version $Id $
+ * WF-Downloads module
+ *
+ * @copyright The XOOPS Project http://sourceforge.net/projects/xoops/
+ * @license GNU GPL 2 (http://www.gnu.org/licenses/old-licenses/gpl-2.0.html)
+ * @package wfdownload
+ * @since 3.23
+ * @author WF-Sections, Xoops Development Team, luciorota
+ * @version svn:$Id$
*/
-
$path = dirname(dirname(dirname(dirname(__FILE__))));
include_once $path . '/mainfile.php';
include_once $path . '/include/cp_functions.php';
Modified: XoopsModules/wfdownloads/trunk/wfdownloads/admin/admin_header2.php
===================================================================
--- XoopsModules/wfdownloads/trunk/wfdownloads/admin/admin_header2.php 2013-05-24 21:34:18 UTC (rev 11583)
+++ XoopsModules/wfdownloads/trunk/wfdownloads/admin/admin_header2.php 2013-05-24 21:43:01 UTC (rev 11584)
@@ -1,13 +1,23 @@
<?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.
+ */
/**
- * $Id: admin_header.php,v 1.5 2007/08/10 20:59:33 m0nty_ Exp $
- * Module: WF-Downloads
- * Version: v2.0.5a
- * Release Date: 26 july 2004
- * Author: WF-Sections
- * Licence: GNU
+ * WF-Downloads module
+ *
+ * @copyright The XOOPS Project http://sourceforge.net/projects/xoops/
+ * @license GNU GPL 2 (http://www.gnu.org/licenses/old-licenses/gpl-2.0.html)
+ * @package wfdownload
+ * @since 3.23
+ * @author WF-Sections, Xoops Development Team, luciorota
+ * @version svn:$Id$
*/
-
include '../../../include/cp_header.php';
include_once(XOOPS_ROOT_PATH . '/modules/wfdownloads/include/functions.php');
include_once(XOOPS_ROOT_PATH . '/modules/wfdownloads/include/common.php');
Modified: XoopsModules/wfdownloads/trunk/wfdownloads/admin/brokendown.php
===================================================================
--- XoopsModules/wfdownloads/trunk/wfdownloads/admin/brokendown.php 2013-05-24 21:34:18 UTC (rev 11583)
+++ XoopsModules/wfdownloads/trunk/wfdownloads/admin/brokendown.php 2013-05-24 21:43:01 UTC (rev 11584)
@@ -1,13 +1,23 @@
<?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.
+ */
/**
- * $Id: brokendown.php,v 1.7 2007/09/30 12:39:13 m0nty_ Exp $
- * Module: WF-Downloads
- * Version: v2.0.5a
- * Release Date: 26 july 2004
- * Author: WF-Sections
- * Licence: GNU
+ * WF-Downloads module
+ *
+ * @copyright The XOOPS Project http://sourceforge.net/projects/xoops/
+ * @license GNU GPL 2 (http://www.gnu.org/licenses/old-licenses/gpl-2.0.html)
+ * @package wfdownload
+ * @since 3.23
+ * @author WF-Sections, Xoops Development Team, luciorota
+ * @version svn:$Id$
*/
-
include 'admin_header.php';
$op = '';
Modified: XoopsModules/wfdownloads/trunk/wfdownloads/admin/category.php
===================================================================
--- XoopsModules/wfdownloads/trunk/wfdownloads/admin/category.php 2013-05-24 21:34:18 UTC (rev 11583)
+++ XoopsModules/wfdownloads/trunk/wfdownloads/admin/category.php 2013-05-24 21:43:01 UTC (rev 11584)
@@ -1,11 +1,22 @@
<?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.
+ */
/**
- * $Id: category.php,v 1.11 2007/09/30 12:39:13 m0nty_ Exp $
- * Module: WF-Downloads
- * Version: v2.0.5a
- * Release Date: 26 july 2004
- * Author: WF-Sections
- * Licence: GNU
+ * WF-Downloads module
+ *
+ * @copyright The XOOPS Project http://sourceforge.net/projects/xoops/
+ * @license GNU GPL 2 (http://www.gnu.org/licenses/old-licenses/gpl-2.0.html)
+ * @package wfdownload
+ * @since 3.23
+ * @author WF-Sections, Xoops Development Team, luciorota
+ * @version svn:$Id$
*/
include 'admin_header.php';
include_once XOOPS_ROOT_PATH . '/class/xoopsform/grouppermform.php';
@@ -100,7 +111,7 @@
global $xoopsDB, $myts, $_FILES, $xoopsModuleConfig;
$cid = (isset($_POST["cid"])) ? intval($_POST["cid"]) : 0;
- $groups = isset($_POST['groups']) ? $_POST['groups'] : array();
+ $down_groups = isset($_POST['groups']) ? $_POST['groups'] : array();
// hack upload - start
$up_groups = isset($_POST['up_groups']) ? $_POST['up_groups'] : array();
// hack upload - end
@@ -160,7 +171,7 @@
if ($cid == 0) {
$newid = intval($category->getVar('cid'));
}
- wfd_save_Permissions($groups, $newid, 'WFDownCatPerm');
+ wfd_save_Permissions($down_groups, $newid, 'WFDownCatPerm');
// hack upload - start
wfd_save_Permissions($up_groups, $newid, 'WFUpCatPerm');
// hack upload - end
@@ -178,7 +189,7 @@
else
{
$database_mess = _AM_WFD_CCATEGORY_MODIFIED;
- wfd_save_Permissions($groups, $cid, 'WFDownCatPerm');
+ wfd_save_Permissions($down_groups, $cid, 'WFDownCatPerm');
// hack upload - start
wfd_save_Permissions($up_groups, $cid, 'WFUpCatPerm');
// hack upload - end
Modified: XoopsModules/wfdownloads/trunk/wfdownloads/admin/cookies.js
===================================================================
--- XoopsModules/wfdownloads/trunk/wfdownloads/admin/cookies.js 2013-05-24 21:34:18 UTC (rev 11583)
+++ XoopsModules/wfdownloads/trunk/wfdownloads/admin/cookies.js 2013-05-24 21:43:01 UTC (rev 11584)
@@ -1,4 +1,24 @@
+/*
+ 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.
+ */
/**
+ * WF-Downloads module
+ *
+ * @copyright The XOOPS Project http://sourceforge.net/projects/xoops/
+ * @license GNU GPL 2 (http://www.gnu.org/licenses/old-licenses/gpl-2.0.html)
+ * @package wfdownload
+ * @since 3.23
+ * @author WF-Sections, Xoops Development Team, luciorota
+ * @version svn:$Id$
+ */
+
+/**
* Read the JavaScript cookies tutorial at:
* http://www.netspade.com/articles/javascript/cookies.xml
*/
Added: XoopsModules/wfdownloads/trunk/wfdownloads/admin/download.php
===================================================================
--- XoopsModules/wfdownloads/trunk/wfdownloads/admin/download.php (rev 0)
+++ XoopsModules/wfdownloads/trunk/wfdownloads/admin/download.php 2013-05-24 21:43:01 UTC (rev 11584)
@@ -0,0 +1,692 @@
+<?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.
+ */
+/**
+ * WF-Downloads module
+ *
+ * @copyright The XOOPS Project http://sourceforge.net/projects/xoops/
+ * @license GNU GPL 2 (http://www.gnu.org/licenses/old-licenses/gpl-2.0.html)
+ * @package wfdownload
+ * @since 3.23
+ * @author WF-Sections, Xoops Development Team, luciorota
+ * @version svn:$Id$
+ */
+include 'admin_header.php';
+include_once XOOPS_ROOT_PATH . '/class/xoopsformloader.php';
+include_once XOOPS_ROOT_PATH . '/class/xoopsform/grouppermform.php';
+include_once WFDOWNLOADS_ROOT_PATH.'class/wfd_lists.php';
+include_once XOOPS_ROOT_PATH . '/class/tree.php';
+include_once XOOPS_ROOT_PATH . '/class/xoopstree.php';
+
+function Download()
+{
+ $download_handler = xoops_getmodulehandler('download');
+ $category_handler = xoops_getmodulehandler('category');
+
+ $lid = wfdownloads_CleanVars($_REQUEST, 'lid', 0, 'int');
+
+ $numrows = $category_handler->getCount();
+ if ($numrows) {
+ wfdownloads_xoops_cp_header();
+ $indexAdmin = new ModuleAdmin();
+ echo $indexAdmin->addNavigation('download.php');
+
+ $adminMenu = new ModuleAdmin();
+ $adminMenu->addItemButton(_MI_WFD_BINDEX, 'download.php?op=list', 'list');
+ $adminMenu->addItemButton(_AM_WFD_FFS_DOWNLOADTITLE, 'download.php?op=Download', 'add');
+ echo $adminMenu->renderButton();
+
+ // allowed mimetypes list
+ echo "<fieldset><legend style='font-weight: bold; color: #900;'>" . _AM_WFD_FILE_ALLOWEDAMIME . "</legend>\n";
+ echo "<div style='padding: 8px;'>\n";
+ $mime_handler = xoops_getmodulehandler('mimetype');
+ $criteria = new Criteria("mime_admin", 1);
+ $mimetypes = $mime_handler->getList($criteria);
+ $allowmimetypes = implode(' | ', $mimetypes);
+ echo $allowmimetypes;
+ echo "</div>\n";
+ echo "</fieldset><br />\n";
+
+ if ($lid) {
+ $download = $download_handler->get($lid);
+ $title = _AM_WFD_FILE_MODIFYFILE;
+ // added - start - March 4 2006 - jpc
+ $cid = intval($download->getVar('cid'));
+ $category = $category_handler->get($cid);
+ // added - end - March 4 2006 - jpc
+ // changed - start - April 22 2006 - jwe
+ //$title = _AM_WFD_FILE_MODIFYFILE;
+ $title = preg_replace("/{category}/", $category->getVar('title'), _AM_WFD_FFS_EDITDOWNLOADTITLE);
+ // changed - end - April 22 2006 - jwe
+ } else {
+ $download = $download_handler->create();
+ $title = _AM_WFD_FILE_CREATENEWFILE;
+ // added - start - March 4 2006 - jpc
+ $cid = (!empty($_POST['cid'])) ? intval($_POST['cid']) : 0 ;
+ $download->setVar('cid', $cid);
+ $category = $category_handler->get($cid);
+ // added - end - March 4 2006 - jpc
+ // changed - start - April 22 2006 - jwe
+ //$title = _AM_WFD_FILE_CREATENEWFILE;
+ $title = preg_replace("/{category}/", $category->getVar('title'), _AM_WFD_FFS_DOWNLOADTITLE);
+ // changed - end - April 22 2006 - jwe
+ }
+
+ // changed - start - March 4 2006 - jpc
+ if ((isset($_POST['submit_category']) && !empty($_POST['submit_category'])) || $lid) {
+
+ $fid = $category->getVar('formulize_fid');
+ $customArray = array();
+ if($fid) {
+ global $xoopsUser;
+ include_once XOOPS_ROOT_PATH . "/modules/formulize/include/formdisplay.php";
+ include_once XOOPS_ROOT_PATH . "/modules/formulize/include/functions.php";
+
+ $customArray['fid'] = $fid;
+ $customArray['formulize_mgr'] =& xoops_getmodulehandler('elements', 'formulize');
+ $customArray['groups'] = $xoopsUser ? $xoopsUser->getGroups() : array(0=>XOOPS_GROUP_ANONYMOUS);
+ $customArray['prevEntry'] = getEntryValues($download->getVar('formulize_idreq'), $customArray['formulize_mgr'], $customArray['groups'], $fid);
+ $customArray['entry'] = $download->getVar('formulize_idreq');
+ $customArray['go_back'] = "";
+ $customArray['parentLinks'] = "";
+
+ $owner = getEntryOwner($entry);
+ $member_handler =& xoops_gethandler('member');
+ $owner_groups =& $member_handler->getGroupsByUser($owner, FALSE);
+
+ $customArray['owner_groups'] = $owner_groups;
+ }
+ $sform = $download->getAdminForm($title, $customArray);
+ } elseif(file_exists(XOOPS_ROOT_PATH . "/modules/formulize/include/functions.php")) {
+ $sform = $download->getCategoryForm();
+ } else {
+ $sform = $download->getAdminForm($title);
+ }
+ $sform->display();
+ // changed - end - March 4 2006 - jpc
+ } else {
+ redirect_header(WFDOWNLOADS_URL.'admin/category.php?', 1, _AM_WFD_CCATEGORY_NOEXISTS);
+ exit();
+ }
+
+ if ($lid) {
+ global $imagearray;
+ // Vote data
+ $rating_handler = xoops_getmodulehandler('rating');
+ $totalvotes = $rating_handler->getCount();
+
+ $reg_criteria = new CriteriaCompo(new Criteria('lid', $lid));
+ $reg_criteria->add(new Criteria("ratinguser", 0, ">"));
+ $votesreg = $rating_handler->getCount($reg_criteria);
+ $reg_criteria->setSort("ratingtimestamp");
+ $reg_criteria->setOrder("DESC");
+ $regvotes = $rating_handler->getObjects($reg_criteria);
+
+ $anon_criteria = new CriteriaCompo(new Criteria('lid', $lid));
+ $anon_criteria->add(new Criteria("ratinguser", 0, "="));
+ $votesanon = $rating_handler->getCount($anon_criteria);
+ $anon_criteria->setSort("ratingtimestamp");
+ $anon_criteria->setOrder("DESC");
+
+ echo "<fieldset><legend style='font-weight: bold; color: #900;'>" . _AM_WFD_VOTE_RATINGINFOMATION . "</legend>\n";
+ echo "<div style='padding: 8px;'><b>" . _AM_WFD_VOTE_TOTALVOTES . "</b>" . $totalvotes . "<br /><br />\n";
+
+ printf(_AM_WFD_VOTE_REGUSERVOTES, $votesreg);
+
+ echo "<br />";
+
+ printf(_AM_WFD_VOTE_ANONUSERVOTES, $votesanon);
+
+ echo "
+ </div>\n
+ <table width='100%' cellspacing='1' cellpadding='2' class='outer'>\n
+ <tr>\n
+ <th align='center'>" . _AM_WFD_VOTE_USER . "</td>\n
+ <th align='center'>" . _AM_WFD_VOTE_IP . "</td>\n
+ <th align='center'>" . _AM_WFD_VOTE_RATING . "</td>\n
+ <th align='center'>" . _AM_WFD_VOTE_USERAVG . "</td>\n
+ <th align='center'>" . _AM_WFD_VOTE_TOTALRATE . "</td>\n
+ <th align='center'>" . _AM_WFD_VOTE_DATE . "</td>\n
+ <th align='center'>" . _AM_WFD_MINDEX_ACTION . "</td>\n
+ </tr>\n
+ ";
+
+ if ($votesreg == 0) {
+ echo "<tr><td align='center' colspan='7' class='even'><b>" . _AM_WFD_VOTE_NOREGVOTES . "</b></td></tr>";
+ } else {
+ foreach (array_keys($regvotes) as $i) {
+ $uids[] = $regvotes[$i]->getVar('ratinguser');
+ }
+
+ $criteria = new Criteria("ratinguser", "(".implode(',', $uids).")", "IN");
+ $criteria->setGroupby("ratinguser");
+ $userratings = $rating_handler->getUserAverage($criteria);
+
+
+ foreach (array_keys($regvotes) as $i) {
+ $formatted_date = formatTimestamp($regvotes[$i]->getVar('ratingtimestamp'), $xoopsModuleConfig['dateformat']);
+ $useravgrating = isset($userratings[$regvotes[$i]->getVar('ratinguser')]) ? $userratings[$regvotes[$i]->getVar('ratinguser')]["avg"] : 0;
+ $uservotes = isset($userratings[$regvotes[$i]->getVar('ratinguser')]) ? $userratings[$regvotes[$i]->getVar('ratinguser')]["count"] : 0;
+ $ratinguname = XoopsUser :: getUnameFromId($regvotes[$i]->getVar('ratinguser'));
+
+ echo "
+ <tr><td align='center' class='head'>$ratinguname</td>\n
+ <td align='center' class='even'>" . $regvotes[$i]->getVar('ratinghostname') . "</th>\n
+ <td align='center' class='even'>" . $regvotes[$i]->getVar('rating') . "</th>\n
+ <td align='center' class='even'>$useravgrating</th>\n
+ <td align='center' class='even'>$uservotes</th>\n
+ <td align='center' class='even'>$formatted_date</th>\n
+ <td align='center' class='even'>\n
+ <a href='" . WFDOWNLOADS_URL . "admin/download.php?op=delVote&lid=" . $lid . "&rid=" . $regvotes[$i]->getVar('ratingid') . "'>" . $imagearray['deleteimg'] . "</a>\n
+ </th></tr>\n
+ ";
+ }
+ }
+ echo "
+ </table>\n
+ <br />\n
+ <table width='100%' cellspacing='1' cellpadding='2' class='outer'>\n
+ <tr>\n
+ <th align='center'>" . _AM_WFD_VOTE_USER . "</td>\n
+ <th align='center'>" . _AM_WFD_VOTE_IP . "</td>\n
+ <th align='center'>" . _AM_WFD_VOTE_RATING . "</td>\n
+ <th align='center'>" . _AM_WFD_VOTE_USERAVG . "</td>\n
+ <th align='center'>" . _AM_WFD_VOTE_TOTALRATE . "</td>\n
+ <th align='center'>" . _AM_WFD_VOTE_DATE . "</td>\n
+ <th align='center'>" . _AM_WFD_MINDEX_ACTION . "</td>\n
+ </tr>\n
+ ";
+ if ($votesanon == 0) {
+ echo "<tr><td colspan='7' align='center' class='even'><b>" . _AM_WFD_VOTE_NOUNREGVOTES . "</b></td></tr>";
+ } else {
+ $criteria = new Criteria("ratinguser", 0);
+ $userratings = $rating_handler->getUserAverage($criteria);
+ $anonvotes = $rating_handler->getObjects($anon_criteria);
+
+ foreach (array_keys($anonvotes) as $i) {
+ $formatted_date = formatTimestamp($anonvotes[$i]->getVar('ratingtimestamp'), $xoopsModuleConfig['dateformat']);
+ $useravgrating = isset($userratings['avg']) ? $userratings["avg"] : 0;
+ $uservotes = isset($userratings['count']) ? $userratings["count"] : 0;
+
+ $ratinguname = $GLOBALS['xoopsConfig']['anonymous'];
+
+ echo "
+ <tr><td align='center' class='head'>$ratinguname</td>\n
+ <td align='center' class='even'>" . $anonvotes[$i]->getVar('ratinghostname') . "</th>\n
+ <td align='center' class='even'>" . $anonvotes[$i]->getVar('rating') . "</th>\n
+ <td align='center' class='even'>$useravgrating</th>\n
+ <td align='center' class='even'>$uservotes</th>\n
+ <td align='center' class='even'>$formatted_date</th>\n
+ <td align='center' class='even'>\n
+ <a href='" . WFDOWNLOADS_URL . "admin/download.php?op=delVote&lid=" . $lid . "&rid=" . $anonvotes[$i]->getVar('ratingid') . "'>" . $imagearray['deleteimg'] . "</a>\n
+ </th></tr>\n
+ ";
+ }
+ }
+ echo "
+ </table>\n
+ </fieldset>\n
+ ";
+ }
+ xoops_cp_footer();
+}
+
+function delVote()
+{
+ global $_GET;
+ $rating_handler = xoops_getmodulehandler('rating');
+ $rating = $rating_handler->get($_GET['rid']);
+ if ($rating_handler->delete($rating, true)) {
+ wfd_updaterating(intval($rating->getVar('lid')));
+ }
+ redirect_header(WFDOWNLOADS_URL . 'admin/download.php', 1, _AM_WFD_VOTE_VOTEDELETED);
+}
+
+function addDownload()
+{
+ global $xoopsUser, $xoopsModuleConfig;
+
+ $lid = (!empty($_POST['lid'])) ? intval($_POST['lid']) : 0;
+ $cid = (!empty($_POST['cid'])) ? intval($_POST['cid']) : 0;
+ $status = (!empty($_POST['status'])) ? intval($_POST['status']) : 2;
+
+ $download_handler = xoops_getmodulehandler('download');
+ if ($lid > 0) {
+ $thisIsANewRecord = false; /* Added by Lankford on 2007/3/21 */
+
+ $download = $download_handler->get($lid);
+ } else {
+ $thisIsANewRecord = true; /* Added by Lankford on 2007/3/21 */
+
+ $download = $download_handler->create();
+ }
+
+ /**
+ * Define URL
+ */
+ if (empty($_FILES['userfile']['name'])) {
+ if ($_POST["url"] && $_POST["url"] != "" && $_POST["url"] != "http://") {
+ $url = ($_POST["url"] != "http://") ? $_POST["url"] : '';
+ $filename = '';
+ $filetype = '';
+ } else {
+ $url = ($_POST["url"] != "http://") ? $_POST["url"] : '';
+ $filename = $_POST['filename'];
+ $filetype = $_POST['filetype'];
+ }
+ $size = ((empty($_POST["size"]) || !is_numeric($_POST["size"]))) ? 0 : intval($_POST["size"]);
+ $title = trim($_POST["title"]);
+ $download->setVar('filename', $filename);
+ $download->setVar('filetype', $filetype);
+ } else {
+ global $_FILES;
+
+ $down = wfd_uploading($_FILES, $xoopsModuleConfig['uploaddir'], "", "download.php", 0, 0);
+ $url = ($_POST["url"] != "http://") ? $_POST["url"] : '';
+ $size = $down['size'];
+ $title = $_FILES['userfile']['name'];
+ $ext = rtrim(strrchr($title, '.'), '.');
+ $title = str_replace($ext, '', $title);
+ $title = (isset($_POST["title_checkbox"]) && $_POST["title_checkbox"] == 1) ? $title : trim($_POST["title"]);
+
+ $filename = $down['filename'];
+ $filetype = $_FILES['userfile']['type'];
+ $download->setVar('filename', $filename);
+ $download->setVar('filetype', $filetype);
+ }
+
+ /**
+ * Get data from form
+ */
+ $screenshot = ($_POST["screenshot"] != "blank.png") ? $_POST["screenshot"] : '';
+ $screenshot2 = ($_POST["screenshot2"] != "blank.png") ? $_POST["screenshot2"] : '';
+ $screenshot3 = ($_POST["screenshot3"] != "blank.png") ? $_POST["screenshot3"] : '';
+ $screenshot4 = ($_POST["screenshot4"] != "blank.png") ? $_POST["screenshot4"] : '';
+
+ if (!empty($_POST["homepage"]) || $_POST["homepage"] != "http://") {
+ $download->setVar('homepage', trim($_POST["homepage"]));
+ $download->setVar('homepagetitle', trim($_POST["homepagetitle"]));
+ }
+
+ $version = (!empty($_POST["version"])) ? trim($_POST["version"]) : 0;
+
+ /* Added by Lankford on 2007/3/21 */
+ // Here, I want to know if:
+ // a) Are they actually changing the value of version, or is it the same?
+ // b) Are they actually modifying the record, or is this a new one?
+ // If both conditions are true, then trigger all three notifications related to modified records.
+ if (!$thisIsANewRecord and ($download->getVar('version') != $version)) {
+ // Trigger the three events related to modified files (one for the file, category, and global event categories respectively)
+ $notification_handler = &xoops_gethandler('notification');
+ $tags = array();
+ $tags['FILE_NAME'] = $title;
+ $tags['FILE_URL'] = WFDOWNLOADS_URL . 'singlefile.php?cid=' . $cid . '&lid=' . $lid;
+ $category_handler = xoops_getmodulehandler('category');
+ $category = $category_handler->get($cid);
+ $tags['FILE_VERSION'] = $version;
+ $tags['CATEGORY_NAME'] = $category->getVar('title');
+ $tags['CATEGORY_URL'] = WFDOWNLOADS_URL . 'viewcat.php?cid=' . $cid;
+
+ if ($xoopsModuleConfig['autoapprove'] == 2 || $xoopsModuleConfig['autoapprove'] == 4) {
+ // Then this change will be automatically approved, so the notification needs to go out.
+ $notification_handler->triggerEvent('global', 0, 'filemodified', $tags);
+ $notification_handler->triggerEvent('category', $cid, 'filemodified', $tags);
+ $notification_handler->triggerEvent('file', $lid, 'filemodified', $tags);
+ }
+ }
+ /* End add block */
+
+ $download->setVar('version', $version);
+ $download->setVar('url', $url);
+ $download->setVar('cid', $cid);
+ $download->setVar('title', $title);
+ $download->setVar('status', $status);
+ $download->setVar('size', $size);
+ $download->setVar('screenshot', $screenshot);
+ $download->setVar('screenshot2', $screenshot2);
+ $download->setVar('screenshot3', $screenshot3);
+ $download->setVar('screenshot4', $screenshot4);
+ $download->setVar('platform', trim($_POST["platform"]));
+ $download->setVar('summary', trim($_POST["summary"]));
+ $download->setVar('description', trim($_POST["description"]));
+ $download->setVar('submitter', trim($_POST["submitter"]));
+ $download->setVar('publisher', trim($_POST["publisher"]));
+ $download->setVar('price', trim($_POST["price"]));
+ if (!$xoopsModuleConfig['enable_mirrors']) {
+ $download->setVar('mirror', formatURL(trim($_POST["mirror"])));
+ }
+ $download->setVar('license', trim($_POST["license"]));
+ $download->setVar('features', trim($_POST["features"]));
+ $download->setVar('requirements', trim($_POST["requirements"]));
+ $limitations = (isset($_POST["limitations"])) ? $_POST["limitations"] : '';
+ $download->setVar('limitations', $limitations);
+ $versiontypes = (isset($_POST["versiontypes"])) ? $_POST["versiontypes"] : '';
+ $download->setVar('versiontypes', $versiontypes);
+
+ $dhistory = (isset($_POST["dhistory"])) ? $_POST["dhistory"] : '';
+ $dhistoryhistory = (isset($_POST["dhistoryaddedd"])) ? $_POST["dhistoryaddedd"] : '';
+
+ if ($lid > 0 && !empty($dhistoryhistory)) {
+ $dhistory = $dhistory . "\n\n";
+ $time = time();
+ $dhistory .= _AM_WFD_FILE_HISTORYVERS . $version . _AM_WFD_FILE_HISTORDATE . formatTimestamp($time, $xoopsModuleConfig['dateformat']) . "\n\n";
+ $dhistory .= $dhistoryhistory;
+ }
+ $download->setVar('dhistory', $dhistory);
+ $download->setVar('dhistoryhistory', $dhistoryhistory);
+
+ $updated = (isset($_POST['was_published']) && $_POST['was_published'] == 0) ? 0 : time();
+
+ if ($_POST['up_dated'] == 0) {
+ $updated = 0;
+ }
+ $download->setVar('updated', $updated);
+
+ $offline = ($_POST['offline'] == 1) ? 1 : 0;
+ $download->setVar('offline', $offline);
+ $approved = (isset($_POST['approved']) && $_POST['approved'] == 1) ? 1 : 0;
+ $notifypub = (isset($_POST['notifypub']) && $_POST['notifypub'] == 1);
+
+ $expiredate = 0;
+ if (!$lid) {
+ $publishdate = time();
+ } else {
+ $publishdate = $_POST['was_published'];
+ $expiredate = $_POST['was_expired'];
+ }
+
+ if ($approved == 1 && empty($publishdate))
+ {
+ $publishdate = time();
+ }
+
+ if (isset($_POST['publishdateactivate'])) {
+ $publishdate = strtotime($_POST['published']['date']) + $_POST['published']['time'];
+ }
+ if ($_POST['clearpublish']) {
+ $publishdate = $download->getVar('published');
+ }
+
+ if (isset($_POST['expiredateactivate'])) {
+ $expiredate = strtotime($_POST['expired']['date']) + $_POST['expired']['time'];
+ }
+ if ($_POST['clearexpire']) {
+ $expiredate = '0';
+ }
+
+ $download->setVar('expired', $expiredate);
+ $download->setVar('published', $publishdate);
+ $download->setVar('date', time());
+ /**
+ * Update or insert download data into database
+ */
+ if (!$lid) {
+ $download->setVar('ipaddress', $_SERVER['REMOTE_ADDR']);
+ }
+
+
+ // added - start - March 4 2006 - jpc
+ $category_handler = xoops_getmodulehandler('category');
+ $category = $category_handler->get($cid);
+ $fid = $category->getVar('formulize_fid');
+ if($fid) {
+ global $xoopsUser;
+ include_once XOOPS_ROOT_PATH . "/modules/formulize/include/formread.php";
+ include_once XOOPS_ROOT_PATH . "/modules/formulize/include/functions.php";
+
+ $formulize_mgr =& xoops_getmodulehandler('elements', 'formulize');
+
+ if ($lid) {
+ $entries[$fid][0] = $download->getVar('formulize_idreq');
+ if($entries[$fid][0]) {
+ $owner = getEntryOwner($entries[$fid][0]);
+ } else {
+ print "no idreq";
+ $entries[$fid][0] = "";
+ $owner = "";
+ }
+ $cid = $download->getVar('cid');
+ } else {
+ $entries[$fid][0] = "";
+ $owner = "";
+ }
+ $member_handler =& xoops_gethandler('member');
+ $owner_groups =& $member_handler->getGroupsByUser($owner, FALSE);
+ $uid = !empty($xoopsUser) ? $xoopsUser->getVar('uid') : 0;
+ $groups = $xoopsUser ? $xoopsUser->getGroups() : array(0=>XOOPS_GROUP_ANONYMOUS);
+ $entries = handleSubmission($formulize_mgr, $entries, $uid, $owner, $fid, $owner_groups, $groups, "new"); // "new" causes xoops token check to be skipped, since WF-downloads should be doing that
+
+ //if (!$lid)
+ if(!$owner) {
+ $id_req = $entries[$fid][0];
+ $download->setVar('formulize_idreq', $id_req);
+ }
+ }
+ // added - end - March 4 2006 - jpc
+ $download_handler->insert($download);
+ $newid = intval($download->getVar('lid'));
+ /**
+ * Send notifications
+ */
+ if (!$lid) {
+ $tags = array();
+ $tags['FILE_NAME'] = $title;
+ $tags['FILE_URL'] = WFDOWNLOADS_URL . 'singlefile.php?cid=' . $cid . '&lid=' . $newid;
+
+ // changed - start - March 4 2006 - jpc
+ //$category_handler = xoops_getmodulehandler('category');
+ //$category = $category_handler->get($cid);
+ // changed - end - March 4 2006 - jpc
+ $tags['CATEGORY_NAME'] = $category->getVar('title');
+ $tags['CATEGORY_URL'] = WFDOWNLOADS_URL . 'viewcat.php?cid=' . $cid;
+ $notification_handler = & xoops_gethandler('notification');
+ $notification_handler -> triggerEvent('global', 0, 'new_file', $tags);
+ $notification_handler -> triggerEvent('category', $cid, 'new_file', $tags);
+ }
+ if ($lid && $approved && $notifypub) {
+ $tags = array();
+ $tags['FILE_NAME'] = $title;
+ $tags['FILE_URL'] = WFDOWNLOADS_URL . 'singlefile.php?cid=' . $cid . '&lid=' . $lid;
+ $category_handler = xoops_getmodulehandler('category');
+ $category = $category_handler->get($cid);
+ $tags['CATEGORY_NAME'] = $category->getVar('title');
+ $tags['CATEGORY_URL'] = WFDOWNLOADS_URL . 'viewcat.php?cid=' . $cid;
+ $notification_handler = & xoops_gethandler('notification');
+ $notification_handler -> triggerEvent('global', 0, 'new_file', $tags);
+ $notification_handler -> triggerEvent('category', $cid, 'new_file', $tags);
+ $notification_handler -> triggerEvent('file', $lid, 'approve', $tags);
+ }
+ $message = (!$lid) ? _AM_WFD_FILE_NEWFILEUPLOAD : _AM_WFD_FILE_FILEMODIFIEDUPDATE ;
+ $message = ($lid && !$_POST['was_published'] && $approved) ? _AM_WFD_FILE_FILEAPPROVED : $message;
+
+ redirect_header(WFDOWNLOADS_URL . 'admin/download.php', 1, $message);
+}
+
+
+
+// Page start here
+$op = isset($_REQUEST['op']) ? $_REQUEST['op'] : 'main';
+switch ($op) {
+ case "addDownload":
+ addDownload();
+ break;
+
+ case "Download":
+ Download();
+ break;
+
+ case "delDownload":
+ global $xoopsModule, $xoopsModuleConfig;
+ $confirm = (isset($_REQUEST['confirm'])) ? 1 : 0;
+ $lid = (isset($_GET['lid'])) ? intval($_GET['lid']) : 0;
+ $lid = (isset($_POST['lid'])) ? intval($_POST['lid']) : $lid;
+ $download_handler = xoops_getmodulehandler('download');
+ $download = $download_handler->get($lid);
+ $title = $download->getVar('title');
+ if ($confirm) {
+ $file = $xoopsModuleConfig['uploaddir'] . "/" . $download->getVar('filename');
+ if (is_file($file)) {
+ @chmod($file, 0777);
+ @unlink($file);
+ }
+ $download_handler->delete($download);
+ redirect_header(WFDOWNLOADS_URL . 'admin/download.php', 1, sprintf(_AM_WFD_FILE_FILEWASDELETED, $title));
+ exit();
+ } else {
+ wfdownloads_xoops_cp_header();
+ xoops_confirm(array('op' => 'delDownload', 'lid' => $lid, 'confirm' => 1, 'title' => $title), 'download.php', _AM_WFD_FILE_REALLYDELETEDTHIS . "<br /><br>" . $title, _DELETE);
+ xoops_cp_footer();
+ }
+ break;
+
+ case "delVote":
+ delVote();
+ break;
+
+ // added - start - March 4 2006 - jpc
+ case "patch_formulize":
+ patch_formulize();
+ break;
+ // added - end - March 4 2006 - jpc
+
+ case 'main':
+ default:
+ global $xoopsUser, $xoopsDB, $xoopsConfig;
+ include_once XOOPS_ROOT_PATH . '/class/pagenav.php';
+ $start = wfdownloads_CleanVars($_GET, 'start', 0, 'int');
+ $start1 = wfdownloads_CleanVars($_GET, 'start1', 0, 'int');
+ $start2 = wfdownloads_CleanVars($_GET, 'start2', 0, 'int');
+ $start3 = wfdownloads_CleanVars($_GET, 'start3', 0, 'int');
+ $start4 = wfdownloads_CleanVars($_GET, 'start4', 0, 'int');
+ $totalcats = wfd_totalcategory();
+
+ $report_handler = xoops_getmodulehandler('report');
+ $review_handler = xoops_getmodulehandler('review');
+ $mirror_handler = xoops_getmodulehandler('mirror');
+ $modification_handler = xoops_getmodulehandler('modification');
+ $download_handler = xoops_getmodulehandler('download');
+
+ $totalbrokendownloads = $report_handler->getCount();
+ $totalmodrequests = $modification_handler->getCount();
+ $newreviews = $review_handler->getCount();
+ $newmirrors = $mirror_handler->getCount();
+ $totalnewdownloads = $download_handler->getCount(new Criteria("published", 0));
+ $totaldownloads = $download_handler->getCount(new Criteria("published", 0, ">"));
+
+ wfdownloads_xoops_cp_header();
+ $indexAdmin = new ModuleAdmin();
+ echo $indexAdmin->addNavigation('download.php');
+
+ $adminMenu = new ModuleAdmin();
+ $adminMenu->addItemButton(_MI_WFD_BINDEX, 'download.php?op=list', 'list');
+ $adminMenu->addItemButton(_AM_WFD_FFS_DOWNLOADTITLE, 'download.php?op=Download', 'add');
+ echo $adminMenu->renderButton();
+
+ if ($totaldownloads > 0) {
+ // Published Downloads
+ $criteria = new CriteriaCompo();
+ $criteria->setLimit($xoopsModuleConfig['admin_perpage']);
+ $criteria->setStart($start);
+ $criteria->setSort("published");
+ $criteria->setOrder("DESC");
+ $published_array = $download_handler->getActiveDownloads($criteria);
+ $published_array_count = $download_handler->getActiveCount();
+
+ wfd_downlistheader(_AM_WFD_MINDEX_PUBLISHEDDOWN);
+ if ($published_array_count > 0) {
+ foreach (array_keys($published_array) as $i) {
+ wfd_downlistbody($published_array[$i]->toArray());
+ }
+ } else {
+ wfd_downlistfooter();
+ }
+ wfd_downlistpagenav($published_array_count, $start, 'art');
+ // Auto Published Downloads
+ $criteria = new Criteria("published", time(), ">");
+ $auto_publish_count = $download_handler->getCount($criteria);
+ $criteria->setSort("published");
+ $criteria->setOrder("ASC");
+ $criteria->setLimit($xoopsModuleConfig['admin_perpage']);
+ $criteria->setStart($start2);
+ $auto_published_array = $download_handler->getObjects($criteria);
+
+ wfd_downlistheader(_AM_WFD_MINDEX_AUTOPUBLISHEDDOWN);
+ if ($auto_publish_count > 0) {
+ foreach (array_keys($auto_published_array) as $i) {
+ wfd_downlistbody($auto_published_array[$i]->toArray());
+ }
+ } else {
+ wfd_downlistfooter();
+ }
+ wfd_downlistpagenav($auto_publish_count, $start2, 'art2');
+ // Expired downloads
+ $criteria = new CriteriaCompo();
+ $criteria->add(new Criteria("expired", time(), "<"), 'AND');
+ $criteria->add(new Criteria("expired", 0, "<>"), 'AND');
+ $expired_count = $download_handler->getCount($criteria);
+ $criteria->setSort("expired");
+ $criteria->setOrder("ASC");
+ $criteria->setLimit($xoopsModuleConfig['admin_perpage']);
+ $criteria->setStart($start3);
+ $expired_array = $download_handler->getObjects($criteria);
+
+ wfd_downlistheader(_AM_WFD_MINDEX_EXPIREDDOWN);
+ if ($expired_count > 0) {
+ foreach (array_keys($expired_array) as $i) {
+ wfd_downlistbody($expired_array[$i]->toArray());
+ }
+ } else {
+ wfd_downlistfooter();
+ }
+ wfd_downlistpagenav($expired_count, $start3, 'art3');
+ // Offline download
+ $criteria = new Criteria("offline", 1);
+ $offline_count = $download_handler->getCount($criteria);
+ $criteria->setSort("published");
+ $criteria->setOrder("ASC");
+ $criteria->setLimit($xoopsModuleConfig['admin_perpage']);
+ $criteria->setStart($start4);
+ $offline_array = $download_handler->getObjects($criteria);
+
+ wfd_downlistheader(_AM_WFD_MINDEX_OFFLINEDOWN);
+ if ($offline_count > 0) {
+ foreach (array_keys($offline_array) as $i) {
+ wfd_downlistbody($offline_array[$i]->toArray());
+ }
+ } else {
+ wfd_downlistfooter();
+ }
+ wfd_downlistpagenav($offline_count, $start4, 'art4');
+ }
+ //xoops_cp_footer();
+ include_once "admin_footer.php";
+ break;
+}
+
+
+
+// added - start - March 4 2006 - jpc
+function patch_formulize()
+{
+ if(!isset($_POST['patch_formulize'])) {
+ print "<form action=\"download.php?op=patch_formulize\" method=post>";
+ print "<input type = submit name=patch_formulize value=\"Apply Patch for Formulize\">";
+ print "</form>";
+ } else {
+ global $xoopsDB;
+ $sqls[] = "ALTER TABLE " . $xoopsDB->prefix("wfdownloads_cat") . " ADD formulize_fid int(5) NOT NULL default '0';";
+ $sqls[] = "ALTER TABLE " . $xoopsDB->prefix("wfdownloads_downloads") . " ADD formulize_idreq int(5) NOT NULL default '0';";
+ foreach($sqls as $sql)
+ if(!$result = $xoopsDB->queryF($sql))
+ exit("Error patching for Formulize.<br>SQL dump:<br>" . $sql . "<br>Please contact <a hre...@fr...>Freeform Solutions</a> for assistance.");
+ print "Patching for Formulize completed.";
+ }
+}
+// added - end - March 4 2006 - jpc
Modified: XoopsModules/wfdownloads/trunk/wfdownloads/admin/funcs.js
===================================================================
--- XoopsModules/wfdownloads/trunk/wfdownloads/admin/funcs.js 2013-05-24 21:34:18 UTC (rev 11583)
+++ XoopsModules/wfdownloads/trunk/wfdownloads/admin/funcs.js 2013-05-24 21:43:01 UTC (rev 11584)
@@ -1,3 +1,23 @@
+/*
+ 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.
+ */
+/**
+ * WF-Downloads module
+ *
+ * @copyright The XOOPS Project http://sourceforge.net/projects/xoops/
+ * @license GNU GPL 2 (http://www.gnu.org/licenses/old-licenses/gpl-2.0.html)
+ * @package wfdownload
+ * @since 3.23
+ * @author WF-Sections, Xoops Development Team, luciorota
+ * @version svn:$Id$
+ */
+
function smartsectionPageWrap(id, page) {
var revisedMessage;
var textareaDom = xoopsGetElementById(id);
Added: XoopsModules/wfdownloads/trunk/wfdownloads/admin/imageupload.php
===================================================================
--- XoopsModules/wfdownloads/trunk/wfdownloads/admin/imageupload.php (rev 0)
+++ XoopsModules/wfdownloads/trunk/wfdownloads/admin/imageupload.php 2013-05-24 21:43:01 UTC (rev 11584)
@@ -0,0 +1,143 @@
+<?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.
+ */
+/**
+ * WF-Downloads module
+ *
+ * @copyright The XOOPS Project http://sourceforge.net/projects/xoops/
+ * @license GNU GPL 2 (http://www.gnu.org/licenses/old-licenses/gpl-2.0.html)
+ * @package wfdownload
+ * @since 3.23
+ * @author WF-Sections, Xoops Development Team, luciorota
+ * @version svn:$Id$
+ */
+include 'admin_header.php';
+
+include_once XOOPS_ROOT_PATH . '/class/tree.php';
+include_once XOOPS_ROOT_PATH."/class/xoopstree.php";
+
+$op = wfdownloads_CleanVars($_REQUEST, 'op', 'default', 'string');
+$rootpath = wfdownloads_CleanVars($_GET, 'rootpath', 0, 'int');
+
+switch ($op) {
+ case "upload":
+ if ($_FILES['uploadfile']['name'] != "") {
+ if (file_exists(XOOPS_ROOT_PATH . "/" . $_POST['uploadpath'] . "/" . $_FILES['uploadfile']['name'])) {
+ redirect_header(WFDOWNLOADS_URL . 'admin/imageupload.php', 2, _AM_WFD_DOWN_IMAGEEXIST);
+ }
+ $allowed_mimetypes = array('image/gif', 'image/jpeg', 'image/pjpeg', 'image/x-png', 'image/png');
+ $maxfilesize = $xoopsModuleConfig['maxfilesize'];
+ $maxfilewidth = $xoopsModuleConfig['maximgwidth'];
+ $maxfileheight = $xoopsModuleConfig['maximgheight'];
+ $uploaddir = XOOPS_ROOT_PATH."/".$_POST['uploadpath'];
+ $screenshot = strtolower($_FILES['uploadfile']['name']);
+ wfd_uploading($screenshot, XOOPS_ROOT_PATH . "/" . $_POST['uploadpath'], $allowed_mimetypes, "imageupload.php", 1, 0, true);
+
+ include_once WFDOWNLOADS_ROOT_PATH . 'class/img_uploader.php';
+ $uploader = new XoopsMediaImgUploader($uploaddir . "/", $allowed_mimetypes, $maxfilesize, $maxfilewidth, $maxfileheight);
+
+ redirect_header(WFDOWNLOADS_URL . 'admin/imageupload.php', 2 , _AM_WFD_DOWN_IMAGEUPLOAD);
+ exit();
+
+ } else {
+ redirect_header(WFDOWNLOADS_URL . 'admin/imageupload.php', 2 , _AM_WFD_DOWN_NOIMAGEEXIST);
+ exit();
+ }
+ break;
+
+ case "delfile":
+ if (isset($_POST['confirm']) && $_POST['confirm'] == 1) {
+ $filetodelete = XOOPS_ROOT_PATH . "/" . $_POST['uploadpath'] . "/" . $_POST['downfile'];
+ if (file_exists($filetodelete)) {
+ chmod($filetodelete, 0666);
+ if (@unlink($filetodelete)) {
+ redirect_header(WFDOWNLOADS_URL . 'admin/imageupload.php', 1, _AM_WFD_DOWN_FILEDELETED);
+ } else {
+ redirect_header(WFDOWNLOADS_URL . 'admin/imageupload.php', 1, _AM_WFD_DOWN_FILEERRORDELETE);
+ }
+ }
+ exit();
+ } else {
+ if (empty($_POST['downfile'])) {
+ redirect_header(WFDOWNLOADS_URL . 'admin/imageupload.php', 1, _AM_WFD_DOWN_NOFILEERROR);
+ exit();
+ }
+ wfdownloads_xoops_cp_header();
+ xoops_confirm(array('op' => 'delfile', 'uploadpath' => $_POST['uploadpath'], 'downfile' => $_POST['downfile'], 'confirm' => 1),
+ 'imageupload.php', _AM_WFD_DOWN_DELETEFILE . "<br /><br />" . $_POST['downfile'], _AM_WFD_BDELETE);
+ }
+ break;
+
+ case "default":
+ default:
+ include_once WFDOWNLOADS_ROOT_PATH . 'class/wfd_lists.php';
+
+ $displayimage = '';
+ wfdownloads_xoops_cp_header();
+ $indexAdmin = new ModuleAdmin();
+ echo $indexAdmin->addNavigation('imageupload.php');
+
+ Global $xoopsUser, $xoopsDB, $xoopsModuleConfig;
+
+ $dirarray = array(1 => $xoopsModuleConfig['catimage'], 2 => $xoopsModuleConfig['screenshots'], 3 => $xoopsModuleConfig['mainimagedir']);
+ $namearray = array(1 => _AM_WFD_DOWN_CATIMAGE , 2 => _AM_WFD_DOWN_SCREENSHOTS, 3 => _AM_WFD_DOWN_MAINIMAGEDIR);
+ $listarray = array(1 => _AM_WFD_DOWN_FCATIMAGE , 2 => _AM_WFD_DOWN_FSCREENSHOTS, 3 => _AM_WFD_DOWN_FMAINIMAGEDIR);
+
+ //wfdownloads_adminMenu(6, _AM_WFD_MUPLOADS);
+ if ($rootpath > 0) {
+ echo "<div><b>" . _AM_WFD_DOWN_FUPLOADPATH . "</b> " . XOOPS_ROOT_PATH . "/" . $dirarray[$rootpath] . "</div>\n";
+ echo "<div><b>" . _AM_WFD_DOWN_FUPLOADURL . "</b> " . XOOPS_URL . "/" . $dirarray[$rootpath] . "</div><br />\n";
+ }
+ $pathlist = (isset($listarray[$rootpath])) ? $namearray[$rootpath] : '';
+ $namelist = (isset($listarray[$rootpath])) ? $namearray[$rootpath] : '';
+
+ $iform = new XoopsThemeForm(_AM_WFD_DOWN_FUPLOADIMAGETO . $pathlist, "op", xoops_getenv('PHP_SELF'));
+ $iform->setExtra('enctype="multipart/form-data"');
+
+ ob_start();
+ $iform->addElement(new XoopsFormHidden('dir', $rootpath));
+ wfd_getDirSelectOption($namelist, $dirarray, $namearray);
+ $iform->addElement(new XoopsFormLabel(_AM_WFD_DOWN_FOLDERSELECTION, ob_get_contents()));
+ ob_end_clean();
+
+ if ($rootpath > 0) {
+ $graph_array = &WfsLists::getListTypeAsArray(XOOPS_ROOT_PATH . "/" . $dirarray[$rootpath], $type = "images");
+ $indeximage_select = new XoopsFormSelect('', 'downfile', '');
+ $indeximage_select->addOptionArray($graph_array);
+ $indeximage_select->setExtra("onchange='showImgSelected(\"image\", \"downfile\", \"" . $dirarray[$rootpath] . "\", \"\", \"" . XOOPS_URL . "\")'");
+ $indeximage_tray = new XoopsFormElementTray(_AM_WFD_DOWN_FSHOWSELECTEDIMAGE, ' ');
+ $indeximage_tray->addElement($indeximage_select);
+ if (!empty($_REQUEST['downfile'])) {
+ $indeximage_tray->addElement(new XoopsFormLabel('', "<br /><br /><img src='" . XOOPS_URL . "/" . $dirarray[$rootpath] . "/" . $_REQUEST['downfile'] . "' name='image' id='image' alt='' title='image' />"));
+ } else {
+ $indeximage_tray->addElement(new XoopsFormLabel('', "<br /><br /><img src='" . XOOPS_URL . "/uploads/blank.gif' name='image' id='image' alt='' title='image' />"));
+ }
+ $iform->addElement($indeximage_tray);
+
+ $iform->addElement(new XoopsFormFile(_AM_WFD_DOWN_FUPLOADIMAGE, 'uploadfile', 0));
+ $iform->addElement(new XoopsFormHidden('uploadpath', $dirarray[$rootpath]));
+ $iform->addElement(new XoopsFormHidden('rootnumber', $rootpath));
+
+ $dup_tray = new XoopsFormElementTray('', '');
+ $dup_tray->addElement(new XoopsFormHidden('op', 'upload'));
+ $butt_dup = new XoopsFormButton('', '', _AM_WFD_BUPLOAD, 'submit');
+ $butt_dup->setExtra('onclick="this.form.elements.op.value=\'upload\'"');
+ $dup_tray->addElement($butt_dup);
+
+ $butt_dupct = new XoopsFormButton('', '', _AM_WFD_BDELETEIMAGE, 'submit');
+ $butt_dupct->setExtra('onclick="this.form.elements.op.value=\'delfile\'"');
+ $dup_tray->addElement($butt_dupct);
+ $iform->addElement($dup_tray);
+ }
+ $iform->display();
+ echo wfd_serverstats();
+}
+//xoops_cp_footer();
+include_once "admin_footer.php";
Modified: XoopsModules/wfdownloads/trunk/wfdownloads/admin/import.php
====...
[truncated message content] |