|
From: <luc...@us...> - 2013-10-10 12:50:56
|
Revision: 12168
http://sourceforge.net/p/xoops/svn/12168
Author: luciorota
Date: 2013-10-10 12:50:52 +0000 (Thu, 10 Oct 2013)
Log Message:
-----------
fixed: mimetype permissions error
fixed: category permissions error
fixed: user can modify only his downloads/ administrator can modify all downloads
in progress: improved download/modification comparison table
Modified Paths:
--------------
XoopsModules/wfdownloads/trunk/wfdownloads/admin/reportsmodifications.php
XoopsModules/wfdownloads/trunk/wfdownloads/class/download.php
XoopsModules/wfdownloads/trunk/wfdownloads/class/wfdownloads.php
XoopsModules/wfdownloads/trunk/wfdownloads/docs/changelog.txt
XoopsModules/wfdownloads/trunk/wfdownloads/include/common.php
XoopsModules/wfdownloads/trunk/wfdownloads/include/functions.php
XoopsModules/wfdownloads/trunk/wfdownloads/index.php
XoopsModules/wfdownloads/trunk/wfdownloads/language/english/modinfo.php
XoopsModules/wfdownloads/trunk/wfdownloads/submit.php
XoopsModules/wfdownloads/trunk/wfdownloads/templates/wfdownloads_download.html
XoopsModules/wfdownloads/trunk/wfdownloads/templates/wfdownloads_viewcat.html
XoopsModules/wfdownloads/trunk/wfdownloads/viewcat.php
XoopsModules/wfdownloads/trunk/wfdownloads/xoops_version.php
Added Paths:
-----------
XoopsModules/wfdownloads/trunk/wfdownloads/class/multicolumnsthemeform.php
Modified: XoopsModules/wfdownloads/trunk/wfdownloads/admin/reportsmodifications.php
===================================================================
--- XoopsModules/wfdownloads/trunk/wfdownloads/admin/reportsmodifications.php 2013-10-09 18:17:16 UTC (rev 12167)
+++ XoopsModules/wfdownloads/trunk/wfdownloads/admin/reportsmodifications.php 2013-10-10 12:50:52 UTC (rev 12168)
@@ -65,16 +65,24 @@
$requestid = WfdownloadsRequest::getInt('requestid', 0);
$modification = $wfdownloads->getHandler('modification')->get($requestid);
+ $modify_user = new XoopsUser($modification->getVar('modifysubmitter'));
+ $modifyname = XoopsUserUtility::getUnameFromId((int)$modify_user->getVar('uid'));
+ $modifyemail = $modify_user->getVar('email');
+
$download = $wfdownloads->getHandler('download')->get($modification->getVar('lid'));
-
$orig_user = new XoopsUser($download->getVar('submitter'));
$submittername = XoopsUserUtility::getUnameFromId($download->getVar('submitter')); // $orig_user->getvar("uname");
$submitteremail = $orig_user->getVar('email');
+
wfdownloads_xoops_cp_header();
echo "<div><b>" . _AM_WFDOWNLOADS_MOD_MODPOSTER . "</b> $submittername</div>";
$not_allowed = array('lid', 'submitter', 'requestid', 'modifysubmitter');
+// IN PROGRESS
+// IN PROGRESS
+// IN PROGRESS
+// IN PROGRESS ORG FROM HERE
$sform = new XoopsThemeForm(_AM_WFDOWNLOADS_MOD_ORIGINAL, 'storyform', 'index.php');
$keys = $download->getVars();
@@ -141,10 +149,6 @@
}
$sform->display();
- $modify_user = new XoopsUser($modification->getVar('modifysubmitter'));
- $modifyname = XoopsUserUtility::getUnameFromId((int)$modify_user->getVar('uid'));
- $modifyemail = $modify_user->getVar('email');
-
echo "<div><b>" . _AM_WFDOWNLOADS_MOD_MODIFYSUBMITTER . "</b> $modifyname</div>";
$sform = new XoopsThemeForm(_AM_WFDOWNLOADS_MOD_PROPOSED, 'storyform', 'reportsmodifications.php');
$keys = $modification->getVars();
@@ -226,6 +230,130 @@
$sform->addElement($button_tray);
$sform->display();
+// IN PROGRESS
+// IN PROGRESS
+// IN PROGRESS
+// IN PROGRESS NEW FROM HERE
+
+echo "<div><b>" . _AM_WFDOWNLOADS_MOD_MODPOSTER . "</b> $submittername</div>";
+echo "<div><b>" . _AM_WFDOWNLOADS_MOD_MODIFYSUBMITTER . "</b> $modifyname</div>";
+
+$mcform = new WfdownloadsMulticolumnsThemeForm(_AM_WFDOWNLOADS_MOD_ORIGINAL, 'storyform', 'index.php');
+
+// Get download keys
+$downloadVars = $download->getVars();
+$downloadKeys = array_keys($downloadVars);
+// Get modification keys
+$modificationVars = $modification->getVars();
+$modificationKeys = array_keys($modificationVars);
+// Get common keys
+$commonKeys = array_intersect($downloadKeys, $modificationKeys);
+// Set not allowed keys
+$notAllowedKeys = array('lid', 'submitter', 'requestid', 'modifysubmitter');
+
+$i = 0;
+//$mcform->addElement(' ', false, 0, 0);
+//$mcform->addElement(_AM_WFDOWNLOADS_MOD_ORIGINAL, false, 0, 1);
+//$mcform->addElement(_AM_WFDOWNLOADS_MOD_PROPOSED, false, 0, 2);
+$i = 1;
+foreach ($commonKeys as $key) {
+ if (in_array($key, $notAllowedKeys)) {
+ continue;
+ }
+ $caption = constant("_AM_WFDOWNLOADS_MOD_" . strtoupper($key));
+ $downloadContent = $download->getVar($key, 'e');
+ $modificationContent = $modification->getVar($key, 'e');
+ // Extra jobs for some keys
+ switch ($key) {
+ case "platform":
+ case "license":
+ case "limitations":
+ case "versiontypes":
+ $tempArray = $wfdownloads->getConfig($key);
+ $downloadContent = isset($tempArray[$download->getVar($key)]) ? $tempArray[$download->getVar($key)] : '';
+ //
+ $modificationContent = isset($tempArray[$modification->getVar($key)]) ? $tempArray[$modification->getVar($key)] : '';
+ break;
+ case "cid":
+ $category_list = $wfdownloads->getHandler('category')->getObjects(new Criteria("cid", $download->getVar($key)));
+ if (!isset($category_list[0])) continue;
+ $downloadContent = $category_list[0]->getVar('title', 'e');
+ //
+ $category_list = $wfdownloads->getHandler('category')->getObjects(new Criteria("cid", $modification->getVar($key)));
+ if (!isset($category_list[0])) continue;
+ $modificationContent = $category_list[0]->getVar('title', 'e');
+ break;
+ case "screenshot":
+ case "screenshot2":
+ case "screenshot3":
+ case "screenshot4":
+ if ($downloadContent != '') $downloadContent = "<img src='" . XOOPS_URL . "/{$wfdownloads->getConfig('screenshots')}/{$downloadContent}' width='{$wfdownloads->getConfig('shotwidth')}' alt='' title='' />";
+ //
+ if ($modificationContent != '') $modificationContent = "<img src='" . XOOPS_URL . "/{$wfdownloads->getConfig('screenshots')}/{$modificationContent}' width='{$wfdownloads->getConfig('shotwidth')}' alt='' title='' />";
+ break;
+ case "features":
+ case "requirements":
+ if ($downloadContent != '') {
+ $downrequirements = explode('|', trim($downloadContent));
+ $downloadContent = "<ul>";
+ foreach ($downrequirements as $bi) { $downloadContent.= "<li>{$bi}</li>"; }
+ $downloadContent.= "</ul>";
+ }
+ //
+ if ($modificationContent != '') {
+ $downrequirements = explode('|', trim($modificationContent));
+ $modificationContent = "<ul>";
+ foreach ($downrequirements as $bi) { $modificationContent.= "<li>{$bi}</li>"; }
+ $modificationContent.= "</ul>";
+ }
+ break;
+ case "dhistory":
+ $downloadContent = $myts->displayTarea($downloadContent, true, false, false, false, true);
+ //
+ $modificationContent = $myts->displayTarea($modificationContent, true, false, false, false, true);
+ break;
+ }
+ $mcform->addElement($caption, false, $i, 0);
+ $mcform->addElement(new XoopsFormLabel('', $downloadContent), false, $i, 1);
+ $mcform->addElement(new XoopsFormLabel('', $modificationContent), false, $i, 2);
+ $i++;
+}
+$mcform->addElement(' ', false, 0, 0);
+$mcform->addElement(_AM_WFDOWNLOADS_MOD_ORIGINAL, false, 0, 1);
+$mcform->addElement(_AM_WFDOWNLOADS_MOD_PROPOSED, false, 0, 2);
+$mcform->display();
+
+
+
+
+
+
+
+
+
+
+
+
+/*
+ $button_tray = new XoopsFormElementTray('', '');
+ $button_tray->addElement(new XoopsFormHidden('requestid', $requestid));
+ $button_tray->addElement(new XoopsFormHidden('lid', (int)$modification->getVar('lid')));
+ $hidden = new XoopsFormHidden('op', 'modification.change');
+ $button_tray->addElement($hidden);
+ if (!$modification->isNew()) {
+ $approve_button = new XoopsFormButton('', '', _AM_WFDOWNLOADS_BAPPROVE, 'submit');
+ $approve_button->setExtra('onclick="this.form.elements.op.value=\'modification.change\'"');
+ $button_tray->addElement($approve_button);
+ }
+ $ignore_button = new XoopsFormButton('', '', _AM_WFDOWNLOADS_BIGNORE, 'submit');
+ $ignore_button->setExtra('onclick="this.form.elements.op.value=\'modification.ignore\'"');
+ $button_tray->addElement($ignore_button);
+ $sform->addElement($button_tray);
+ $sform->display();
+*/
+
+
+
xoops_cp_footer();
exit();
break;
Modified: XoopsModules/wfdownloads/trunk/wfdownloads/class/download.php
===================================================================
--- XoopsModules/wfdownloads/trunk/wfdownloads/class/download.php 2013-10-09 18:17:16 UTC (rev 12167)
+++ XoopsModules/wfdownloads/trunk/wfdownloads/class/download.php 2013-10-10 12:50:52 UTC (rev 12168)
@@ -407,7 +407,8 @@
$download['is_updated'] = ($this->getVar('updated') > 0) ? _MD_WFDOWNLOADS_UPDATEDON : _MD_WFDOWNLOADS_SUBMITDATE;
if (is_object($xoopsUser) && $download['isadmin'] != true) {
- $download['useradminlink'] = ((int)($xoopsUser->getvar('uid')) == $this->getVar('submitter')) ? true : false;
+ $download['useradminlink'] = ((int)($xoopsUser->getvar('uid')) == $this->getVar('submitter')) ? true : false; // this definition is not removed for backward compatibility issues
+ $download['issubmitter'] = ((int)($xoopsUser->getvar('uid')) == $this->getVar('submitter')) ? true : false;
}
$sql2 = "SELECT rated FROM " . $xoopsDB->prefix('wfdownloads_reviews') . " WHERE lid = '" . intval($download['id']) . "' AND submit = '1'";
Added: XoopsModules/wfdownloads/trunk/wfdownloads/class/multicolumnsthemeform.php
===================================================================
--- XoopsModules/wfdownloads/trunk/wfdownloads/class/multicolumnsthemeform.php (rev 0)
+++ XoopsModules/wfdownloads/trunk/wfdownloads/class/multicolumnsthemeform.php 2013-10-10 12:50:52 UTC (rev 12168)
@@ -0,0 +1,210 @@
+<?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.
+ */
+/**
+ * WfdownloadsMulticolumnsThemeForm Class
+ *
+ * @copyright The XOOPS Project http://sourceforge.net/projects/xoops/
+ * @license http://www.fsf.org/copyleft/gpl.html GNU public license
+ * @author lucio <luc...@gm...>
+ * @package Wfdownloads
+ * @since 3.23
+ * @version $Id:$
+ */
+
+defined('XOOPS_ROOT_PATH') or die('Restricted access');
+
+xoops_load('XoopsForm');
+
+/**
+ * Form that will output formatted as a HTML table
+ *
+ * No styles and no JavaScript to check for required fields.
+ */
+class WfdownloadsMulticolumnsThemeForm extends XoopsForm
+{
+ /**
+ * number of two-dimensional array (matrix) rows
+ *
+ * @var int
+ */
+ var $_rows = 0;
+
+ /**
+ * return number of rows
+ *
+ * @return int
+ */
+ public function getCountRows()
+ {
+ return $this->_rows;
+ }
+
+ /**
+ * number of two-dimensional array (matrix) columns
+ *
+ * @var int
+ */
+ var $_columns = 0;
+
+ /**
+ * return number of columns
+ *
+ * @return int
+ */
+ public function getCountColumns()
+ {
+ return $this->_columns;
+ }
+
+ /**
+ * two-dimensional array (matrix) of {@link XoopsFormElement} objects
+ *
+ * @var array
+ */
+ var $_elements = array();
+
+ /**
+ * Add an element to the form
+ *
+ * @param object $ &$formElement reference to a {@link XoopsFormElement}
+ * @param bool $required is this a "required" element?
+ * @param int $row two-dimensional array (matrix) row (0 first key)
+ * @param int $column two-dimensional array (matrix) column (0 first key)
+ */
+ public function addElement($formElement, $required = false, $row = null, $column = null)
+ {
+ if (is_null($row))
+ $row = $this->_rows;
+ if (is_null($column))
+ $column = ($this->_columns == 0) ? $this->_columns : $this->_columns - 1; // add new element as new row of the last column
+ if (is_string($formElement)) {
+ $this->_elements[$row][$column] = $formElement;
+ if ($row >= $this->_rows)
+ $this->_rows = $row + 1;
+ if ($column >= $this->_columns)
+ $this->_columns = $column + 1;
+ } elseif (is_subclass_of($formElement, 'xoopsformelement')) {
+ $this->_elements[$row][$column] = &$formElement;
+ if ($row >= $this->_rows)
+ $this->_rows = $row + 1;
+ if ($column >= $this->_columns)
+ $this->_columns = $column + 1;
+ if (! $formElement->isContainer()) {
+ if ($required) {
+ $formElement->_required = true;
+ $this->_required[] = &$formElement;
+ }
+ } else {
+ $required_elements = &$formElement->getRequired();
+ $count = count($required_elements);
+ for ($i = 0; $i < $count; $i ++) {
+ $this->_required[] = &$required_elements[$i];
+ }
+ }
+ }
+ }
+
+ public function addRow($elements)
+ {
+ foreach ($elements as $key => $element) {
+ $this->addElement($element, false, $this->_rows, $key);
+ }
+ }
+
+ public function addColumn($elements)
+ {
+ foreach ($elements as $key => $element) {
+ $this->addElement($element, false, $key, $this->_columns);
+ }
+ }
+
+ public function addForm($form)
+ {
+ foreach ($form->getElements() as $element) {
+ $this->addElement($element, $element->isRequired(), $key, $this->_columns);
+ }
+ }
+
+ /**
+ * create HTML to output the form as a theme-enabled table with validation.
+ *
+ * YOU SHOULD AVOID TO USE THE FOLLOWING Nocolspan METHOD, IT WILL BE REMOVED
+ *
+ * To use the noColspan simply use the following example:
+ *
+ * $colspan = new XoopsFormDhtmlTextArea( '', 'key', $value, '100%', '100%' );
+ * $colspan->setNocolspan();
+ * $form->addElement( $colspan );
+ *
+ * @return string
+ */
+ function render()
+ {
+ $ele_name = $this->getName();
+ $ret = '';
+ $ret .= '<form name="' . $ele_name . '" id="' . $ele_name . '" action="' . $this->getAction() . '" method="' . $this->getMethod() . '" onsubmit="return xoopsFormValidate_' . $ele_name . '();"' . $this->getExtra() . '>' . NWLINE;
+ $ret .= '<table width="100%" class="outer" cellspacing="1">' . NWLINE;
+ $ret .= '<tr><th colspan="' . $this->_columns . '">' . $this->getTitle() . '</th></tr>' . NWLINE;
+ $hidden = '';
+ $class = 'even';
+ for ($row = 0; $row < $this->_rows; $row++) {
+ $ret .= "<tr>";
+ for ($column = 0; $column < $this->_columns; $column++) {
+ $ret .= "<td class='{$class}'>";
+ if (isset($this->_elements[$row][$column])) {
+ $ele = $this->_elements[$row][$column];
+ } else {
+ $ele = ' ';
+ }
+ if (!is_object($ele)) {
+ $ret .= $ele;
+ } else if (!$ele->isHidden()) {
+ if (!$ele->getNocolspan()) {
+ //$ret .= '<tr valign="top" align="left"><td class="head">';
+ if (($caption = $ele->getCaption()) != '') {
+ $ret .= '<div class="xoops-form-element-caption' . ($ele->isRequired() ? '-required' : '') . '">';
+ $ret .= '<span class="caption-text">' . $caption . '</span>';
+ $ret .= '<span class="caption-marker">*</span>';
+ $ret .= '</div>';
+ }
+ if (($desc = $ele->getDescription()) != '') {
+ $ret .= '<div class="xoops-form-element-help">' . $desc . '</div>';
+ }
+ //$ret .= '</td><td class="' . $class . '">';
+ $ret .= $ele->render();
+ //$ret .= '</td></tr>' . NWLINE;
+ } else {
+ //$ret .= '<tr valign="top" align="left"><td class="head" colspan="2">';
+ if (($caption = $ele->getCaption()) != '') {
+ $ret .= '<div class="xoops-form-element-caption' . ($ele->isRequired() ? '-required' : '') . '">';
+ $ret .= '<span class="caption-text">' . $caption . '</span>';
+ $ret .= '<span class="caption-marker">*</span>';
+ $ret .= '</div>';
+ }
+ //$ret .= '</td></tr>' . NWLINE;
+ //$ret .= '<tr valign="top" align="left"><td class="' . $class . '" colspan="' . $this->_columns . '">';
+ $ret .= $ele->render();
+ //$ret .= '</td></tr>' . NWLINE;
+ }
+ } else {
+ $hidden .= $ele->render();
+ }
+ $ret .= "</td>";
+ }
+ $ret .= "</tr>";
+ }
+ $ret .= '</table>' . NWLINE;
+ $ret .= ' ' . $hidden . NWLINE;
+ $ret .= '</form>' . NWLINE;
+ $ret .= $this->renderValidationJS(true);
+ return $ret;
+ }
+}
\ No newline at end of file
Modified: XoopsModules/wfdownloads/trunk/wfdownloads/class/wfdownloads.php
===================================================================
--- XoopsModules/wfdownloads/trunk/wfdownloads/class/wfdownloads.php 2013-10-09 18:17:16 UTC (rev 12167)
+++ XoopsModules/wfdownloads/trunk/wfdownloads/class/wfdownloads.php 2013-10-10 12:50:52 UTC (rev 12168)
@@ -42,9 +42,6 @@
if (!$instance) {
$instance = new self($debug);
}
-//error_log("istance: [" . print_r($istance,true) . "]");
-//phpinfo();
-//debug_print_backtrace ();
return $instance;
}
Modified: XoopsModules/wfdownloads/trunk/wfdownloads/docs/changelog.txt
===================================================================
--- XoopsModules/wfdownloads/trunk/wfdownloads/docs/changelog.txt 2013-10-09 18:17:16 UTC (rev 12167)
+++ XoopsModules/wfdownloads/trunk/wfdownloads/docs/changelog.txt 2013-10-10 12:50:52 UTC (rev 12168)
@@ -1,4 +1,4 @@
-<b><u>=> Version 3.23 Beta (2013-10-08)</u></b>
+<b><u>=> Version 3.23 Beta (2013-10-10)</u></b>
- standardization of English language files (cesag)
- fixed: typos in english folder (cesag)
- module standardization: header.php, admin/admin_header.php, xoops_version.php
Modified: XoopsModules/wfdownloads/trunk/wfdownloads/include/common.php
===================================================================
--- XoopsModules/wfdownloads/trunk/wfdownloads/include/common.php 2013-10-09 18:17:16 UTC (rev 12167)
+++ XoopsModules/wfdownloads/trunk/wfdownloads/include/common.php 2013-10-10 12:50:52 UTC (rev 12168)
@@ -38,6 +38,7 @@
include_once WFDOWNLOADS_ROOT_PATH . '/class/wfdownloads.php';
include_once WFDOWNLOADS_ROOT_PATH . '/class/request.php';
include_once WFDOWNLOADS_ROOT_PATH . '/class/breadcrumb.php';
+include_once WFDOWNLOADS_ROOT_PATH . '/class/multicolumnsthemeform.php';
$debug = false;
$wfdownloads = WfdownloadsWfdownloads::getInstance($debug);
Modified: XoopsModules/wfdownloads/trunk/wfdownloads/include/functions.php
===================================================================
--- XoopsModules/wfdownloads/trunk/wfdownloads/include/functions.php 2013-10-09 18:17:16 UTC (rev 12167)
+++ XoopsModules/wfdownloads/trunk/wfdownloads/include/functions.php 2013-10-10 12:50:52 UTC (rev 12168)
@@ -623,24 +623,24 @@
global $xoopsUser;
$wfdownloads = WfdownloadsWfdownloads::getInstance();
- $submissions = 0;
+ $isSubmissionAllowed = false;
if (is_object($xoopsUser)
&& ($wfdownloads->getConfig('submissions') == _WFDOWNLOADS_SUBMISSIONS_DOWNLOAD
|| $wfdownloads->getConfig('submissions') == _WFDOWNLOADS_SUBMISSIONS_BOTH)
) {
$groups = $xoopsUser->getGroups();
- if (array_intersect($wfdownloads->getConfig('submitarts'), $groups)) {
- $submissions = 1;
+ if (count(array_intersect($wfdownloads->getConfig('submitarts'), $groups)) > 0) {
+ $isSubmissionAllowed = true;
}
} elseif (!is_object($xoopsUser)
&& ($wfdownloads->getConfig('anonpost') == _WFDOWNLOADS_ANONPOST_DOWNLOAD
|| $wfdownloads->getConfig('anonpost') == _WFDOWNLOADS_ANONPOST_BOTH)
) {
- $submissions = 1;
+ $isSubmissionAllowed = true;
}
$toolbar = "[ ";
- if ($submissions == 1) {
+ if ($isSubmissionAllowed == true) {
$category_suffix = !empty($_GET['cid']) ? "?cid=" . (int)$_GET['cid'] : ""; //Added by Lankford
$toolbar .= "<a href='submit.php{$category_suffix}'>" . _MD_WFDOWNLOADS_SUBMITDOWNLOAD . "</a> | ";
}
@@ -1160,10 +1160,12 @@
} else {
$criteria->add(new Criteria('mime_user', true));
}
- $mimetypes = $wfdownloads->getHandler('mimetype')->getObjects($criteria);
- $mimetype = $mimetypes[0];
- $ret = explode(' ', $mimetype->getVar('mime_types'));
-
+ if ($mimetypes = $wfdownloads->getHandler('mimetype')->getObjects($criteria)) {
+ $mimetype = $mimetypes[0];
+ $ret = explode(' ', $mimetype->getVar('mime_types'));
+ } else {
+ $ret = array();
+ }
return $ret;
}
@@ -1192,12 +1194,16 @@
$onlyImages = false
) {
$wfdownloads = WfdownloadsWfdownloads::getInstance();
-
$file = array();
if (empty($allowedMimetypes)) {
$allowedMimetypes = wfdownloads_allowedMimetypes($_FILES['userfile']['name'], $isAdmin);
}
+ if (empty($allowedMimetypes)) {
+ $errors = 'MIME type not allowed';
+ redirect_header($redirectURL, 4, $errors);
+ }
+
$uploadDirectory = $uploadDirectory . '/';
$file_name = $_FILES['userfile']['name'];
@@ -1205,23 +1211,27 @@
$maxImageWidth = $wfdownloads->getConfig('maximgwidth');
$maxImageHeight = $wfdownloads->getConfig('maximgheight');
+ // TO DO: use Xoops XoopsMediaUploader class
if ($onlyImages) {
include_once XOOPS_ROOT_PATH . '/modules/wfdownloads/class/img_uploader.php';
+ //xoops_load('XoopsMediaUploader');
$uploader = new XoopsMediaImgUploader($uploadDirectory, $allowedMimetypes, $maxFileSize, $maxImageWidth, $maxImageHeight);
} else {
include_once XOOPS_ROOT_PATH . '/modules/wfdownloads/class/uploader.php';
+ //xoops_load('XoopsMediaUploader');
$uploader = new XoopsMediaUploader($uploadDirectory, $allowedMimetypes, $maxFileSize, $maxImageWidth, $maxImageHeight);
}
+
$uploader->noAdminSizeCheck(1);
if ($uploader->fetchMedia($_POST['xoops_upload_file'][0])) {
if (!$uploader->upload()) {
$errors = $uploader->getErrors();
unlink($uploadDirectory . $uploader->savedFileName);
- redirect_header($redirectURL, 2, $errors);
+ redirect_header($redirectURL, 4, $errors);
} else {
if ($redirect) {
- redirect_header($redirectURL, 1, _AM_WFDOWNLOADS_UPLOADFILE);
+ redirect_header($redirectURL, 4, _AM_WFDOWNLOADS_UPLOADFILE);
} else {
if (is_file($uploader->savedDestination)) {
// $file['url'] = XOOPS_URL . '/' . $uploadDirectory . '/';
@@ -1236,7 +1246,7 @@
} else {
$errors = $uploader->getErrors();
unlink($uploadDirectory . $uploader->savedFileName);
- redirect_header($redirectURL, 1, $errors);
+ redirect_header($redirectURL, 4, $errors);
}
}
Modified: XoopsModules/wfdownloads/trunk/wfdownloads/index.php
===================================================================
--- XoopsModules/wfdownloads/trunk/wfdownloads/index.php 2013-10-09 18:17:16 UTC (rev 12167)
+++ XoopsModules/wfdownloads/trunk/wfdownloads/index.php 2013-10-10 12:50:52 UTC (rev 12168)
@@ -31,7 +31,7 @@
) {
// if user is a registered user
$groups = $xoopsUser->getGroups();
- if (array_intersect($xoopsModuleConfig['submitarts'], $groups)) {
+ if (count(array_intersect($wfdownloads->getConfig('submitarts'), $groups)) > 0) {
$isSubmissionAllowed = true;
}
} else {
Modified: XoopsModules/wfdownloads/trunk/wfdownloads/language/english/modinfo.php
===================================================================
--- XoopsModules/wfdownloads/trunk/wfdownloads/language/english/modinfo.php 2013-10-09 18:17:16 UTC (rev 12167)
+++ XoopsModules/wfdownloads/trunk/wfdownloads/language/english/modinfo.php 2013-10-10 12:50:52 UTC (rev 12168)
@@ -76,13 +76,13 @@
define('_MI_WFDOWNLOADS_CAT_IMGHEIGHT', "Categories images display height");
define('_MI_WFDOWNLOADS_CAT_IMGHEIGHTDSC', "Display height for category image.");
define('_MI_WFDOWNLOADS_ANONPOST', "[submissions] Anonymous user submission");
-define('_MI_WFDOWNLOADS_ANONPOSTDSC', "Allow Anonymous users to submit new Downloads/Mirrors to your website.");
+define('_MI_WFDOWNLOADS_ANONPOSTDSC', "Allow Anonymous users to submit new Downloads and/or Mirrors to your website.");
define('_MI_WFDOWNLOADS_ANONPOST1', "None");
define('_MI_WFDOWNLOADS_ANONPOST2', "Download only");
define('_MI_WFDOWNLOADS_ANONPOST3', "Mirror only");
define('_MI_WFDOWNLOADS_ANONPOST4', "Both");
-define('_MI_WFDOWNLOADS_AUTOAPPROVE', "[submissions] Auto approve submitted Downloads/Mirrors");
-define('_MI_WFDOWNLOADS_AUTOAPPROVEDSC', "Select to approve submitted Downloads/Mirrors without moderation.");
+define('_MI_WFDOWNLOADS_AUTOAPPROVE', "[submissions] Auto approve submitted Downloads and/or Mirrors");
+define('_MI_WFDOWNLOADS_AUTOAPPROVEDSC', "Select to approve submitted Downloads and/or Mirrors without moderation.");
define('_MI_WFDOWNLOADS_AUTOAPPROVE1', "None");
define('_MI_WFDOWNLOADS_AUTOAPPROVE2', "Download only");
define('_MI_WFDOWNLOADS_AUTOAPPROVE3', "Mirror only");
@@ -110,7 +110,7 @@
define('_MI_WFDOWNLOADS_UPLOADMINPOSTS', "Minimum posts required to upload");
define('_MI_WFDOWNLOADS_UPLOADMINPOSTSDSC', "Enter the minimum number of posts required to upload a file.");
define('_MI_WFDOWNLOADS_ALLOWSUBMISS', "[submissions] User submissions");
-define('_MI_WFDOWNLOADS_ALLOWSUBMISSDSC', "Allow users to submit new Downloads/Mirrors.");
+define('_MI_WFDOWNLOADS_ALLOWSUBMISSDSC', "Allow users to submit new Downloads and/or Mirrors.");
define('_MI_WFDOWNLOADS_ALLOWSUBMISS1', "None");
define('_MI_WFDOWNLOADS_ALLOWSUBMISS2', "Download only");
define('_MI_WFDOWNLOADS_ALLOWSUBMISS3', "Mirror only");
Modified: XoopsModules/wfdownloads/trunk/wfdownloads/submit.php
===================================================================
--- XoopsModules/wfdownloads/trunk/wfdownloads/submit.php 2013-10-09 18:17:16 UTC (rev 12167)
+++ XoopsModules/wfdownloads/trunk/wfdownloads/submit.php 2013-10-10 12:50:52 UTC (rev 12168)
@@ -22,15 +22,15 @@
include 'header.php';
// Check if submissions are allowed
-$submissionsAllowed = false;
+$isSubmissionAllowed = false;
if (is_object($xoopsUser)
&& ($wfdownloads->getConfig('submissions') == _WFDOWNLOADS_SUBMISSIONS_DOWNLOAD
|| $wfdownloads->getConfig('submissions') == _WFDOWNLOADS_SUBMISSIONS_BOTH)
) {
// if user is a registered user
$groups = $xoopsUser->getGroups();
- if (array_intersect($wfdownloads->getConfig('submitarts'), $groups)) {
- $submissionsAllowed = true;
+ if (count(array_intersect($wfdownloads->getConfig('submitarts'), $groups)) > 0) {
+ $isSubmissionAllowed = true;
}
} else {
// if user is ANONYMOUS
@@ -38,7 +38,7 @@
&& ($wfdownloads->getConfig('anonpost') == _WFDOWNLOADS_ANONPOST_DOWNLOAD
|| $wfdownloads->getConfig('anonpost') == _WFDOWNLOADS_ANONPOST_BOTH)
) {
- $submissionsAllowed = true;
+ $isSubmissionAllowed = true;
} else {
redirect_header(XOOPS_URL . '/user.php', 5, _MD_WFDOWNLOADS_MUSTREGFIRST);
}
@@ -46,12 +46,11 @@
// Get categories where user can submit
$categories = $wfdownloads->getHandler('category')->getUserUpCategories();
if (count($categories) == 0) {
- $submissionsAllowed = false;
+ $isSubmissionAllowed = false;
}
-if (!$submissionsAllowed) {
+if ($isSubmissionAllowed == false) {
redirect_header('index.php', 5, _MD_WFDOWNLOADS_NOTALLOWESTOSUBMIT);
}
-
// Check posts if user is not an ADMIN
if (is_object($xoopsUser) && !$xoopsUser->isAdmin()) {
if ($xoopsUser->getVar('posts') < $wfdownloads->getConfig('upload_minposts')) {
@@ -207,9 +206,7 @@
$title = trim($_POST['title']);
} else {
$isAdmin = wfdownloads_userIsAdmin();
-
- $down = wfdownloads_uploading($_FILES, $wfdownloads->getConfig('uploaddir'), '', '', 0, false, $isAdmin);
-
+ $down = wfdownloads_uploading($_FILES, $wfdownloads->getConfig('uploaddir'), '', $currentFile, 0, true, $isAdmin);
$url = ($_POST['url'] != "http://") ? $_POST['url'] : '';
$size = $down['size'];
$filename = $down['filename'];
@@ -453,7 +450,7 @@
) {
$notification_handler->triggerEvent('global', 0, 'new_file', $tags);
$notification_handler->triggerEvent('category', $cid, 'new_file', $tags);
- redirect_header('index.php', 2, _MD_WFDOWNLOADS_ISAPPROVED . "");
+ redirect_header('index.php', 2, _MD_WFDOWNLOADS_ISAPPROVED);
} else {
$tags['WAITINGFILES_URL'] = WFDOWNLOADS_URL . '/admin/downloads.php';
$notification_handler->triggerEvent('global', 0, 'file_submit', $tags);
@@ -478,10 +475,11 @@
$tags = array();
$tags['FILE_NAME'] = $title;
$tags['FILE_URL'] = WFDOWNLOADS_URL . "/singlefile.php?cid={$cid}&lid={$lid}";
-
$category = $wfdownloads->getHandler('category')->get($cid);
$tags['CATEGORY_NAME'] = $category->getVar('title');
$tags['CATEGORY_URL'] = WFDOWNLOADS_URL . "/viewcat.php?cid={$cid}";
+ $notification_handler->triggerEvent('global', 0, 'file_modify', $tags);
+ redirect_header('index.php', 2, _MD_WFDOWNLOADS_ISAPPROVED);
} else {
$updated = (isset($_POST['up_dated']) && $_POST['up_dated'] == 0) ? 0 : time();
$download->setVar('updated', $updated);
@@ -494,8 +492,9 @@
$tags = array();
$tags['MODIFYREPORTS_URL'] = WFDOWNLOADS_URL . '/admin/reportsmodifications.php';
$notification_handler->triggerEvent('global', 0, 'file_modify', $tags);
+ redirect_header('index.php', 2, _MD_WFDOWNLOADS_THANKSFORINFO);
}
- redirect_header('index.php', 2, _MD_WFDOWNLOADS_THANKSFORINFO);
+
}
break;
}
Modified: XoopsModules/wfdownloads/trunk/wfdownloads/templates/wfdownloads_download.html
===================================================================
--- XoopsModules/wfdownloads/trunk/wfdownloads/templates/wfdownloads_download.html 2013-10-09 18:17:16 UTC (rev 12167)
+++ XoopsModules/wfdownloads/trunk/wfdownloads/templates/wfdownloads_download.html 2013-10-10 12:50:52 UTC (rev 12168)
@@ -1,8 +1,10 @@
<div>
<b><a href="singlefile.php?cid=<{$download.cid}>&lid=<{$download.id}>" title="<{$smarty.const._MD_WFDOWNLOADS_VIEWDETAILS}>"><{$download.title}></a></b> <{$download.icons}>
- <{if ($download.isadmin == true)}>
+ <{if ($download.isadmin == true or $download.issubmitter == true)}>
<a href="submit.php?op=download.edit&lid=<{$download.id}>"><img src="<{xoModuleIcons16 edit.png}>" title="<{$smarty.const._EDIT}>"
alt="<{$smarty.const._EDIT}>"/></a>
+ <{/if}>
+ <{if ($download.isadmin == true)}>
<a href="admin/downloads.php?op=download.delete&lid=<{$download.id}>"><img src="<{xoModuleIcons16 delete.png}>"
title="<{$smarty.const._DELETE}>" alt="<{$smarty.const._DELETE}>"/></a>
<{/if}>
Modified: XoopsModules/wfdownloads/trunk/wfdownloads/templates/wfdownloads_viewcat.html
===================================================================
--- XoopsModules/wfdownloads/trunk/wfdownloads/templates/wfdownloads_viewcat.html 2013-10-09 18:17:16 UTC (rev 12167)
+++ XoopsModules/wfdownloads/trunk/wfdownloads/templates/wfdownloads_viewcat.html 2013-10-10 12:50:52 UTC (rev 12168)
@@ -250,7 +250,7 @@
<div>
<{include file="db:wfdownloads_download.html" download=$download}>
</div>
- <br/>
+ <br />
<{/foreach}>
<!-- End link loop -->
<div style="clear:both"></div>
Modified: XoopsModules/wfdownloads/trunk/wfdownloads/viewcat.php
===================================================================
--- XoopsModules/wfdownloads/trunk/wfdownloads/viewcat.php 2013-10-09 18:17:16 UTC (rev 12167)
+++ XoopsModules/wfdownloads/trunk/wfdownloads/viewcat.php 2013-10-10 12:50:52 UTC (rev 12168)
@@ -48,7 +48,7 @@
) {
// if user is a registered user
$groups = $xoopsUser->getGroups();
- if (array_intersect($xoopsModuleConfig['submitarts'], $groups)) {
+ if (count(array_intersect($wfdownloads->getConfig('submitarts'), $groups)) > 0) {
$isSubmissionAllowed = true;
}
} else {
Modified: XoopsModules/wfdownloads/trunk/wfdownloads/xoops_version.php
===================================================================
--- XoopsModules/wfdownloads/trunk/wfdownloads/xoops_version.php 2013-10-09 18:17:16 UTC (rev 12167)
+++ XoopsModules/wfdownloads/trunk/wfdownloads/xoops_version.php 2013-10-10 12:50:52 UTC (rev 12168)
@@ -42,9 +42,9 @@
$modversion['onUpdate'] = 'include/module.php';
$modversion['onUninstall'] = 'include/module.php';
-$modversion['date'] = '2013-10-08';
-$modversion['release_date'] = '2013/10/08';
-$modversion['releasedate'] = '2013-10-08';
+$modversion['date'] = '2013-10-10';
+$modversion['release_date'] = '2013/10/10';
+$modversion['releasedate'] = '2013-10-10';
$modversion['status'] = 'BETA 1';
$modversion['teammembers'] = "Bender, David, FrankBlack, Xpider, M0nty, Mithrandir, Marcan, felix[fx2024], Sudhaker, Jegelstaff";
@@ -159,7 +159,7 @@
) {
// if user is a registered user
$groups = $xoopsUser->getGroups();
- if (array_intersect($xoopsModuleConfig['submitarts'], $groups)) {
+ if (count(array_intersect($xoopsModuleConfig['submitarts'], $groups)) > 0) {
$isSubmissionAllowed = true;
}
} else {
|