|
From: <luc...@us...> - 2013-09-13 20:32:27
|
Revision: 12031
http://sourceforge.net/p/xoops/svn/12031
Author: luciorota
Date: 2013-09-13 20:32:24 +0000 (Fri, 13 Sep 2013)
Log Message:
-----------
submit.php refactory
bugfix
Modified Paths:
--------------
XoopsModules/wfdownloads/trunk/wfdownloads/admin/downloads.php
XoopsModules/wfdownloads/trunk/wfdownloads/admin/images.php
XoopsModules/wfdownloads/trunk/wfdownloads/admin/indexpage.php
XoopsModules/wfdownloads/trunk/wfdownloads/admin/mimetypes.php
XoopsModules/wfdownloads/trunk/wfdownloads/admin/reportsmodifications.php
XoopsModules/wfdownloads/trunk/wfdownloads/class/category.php
XoopsModules/wfdownloads/trunk/wfdownloads/class/download.php
XoopsModules/wfdownloads/trunk/wfdownloads/class/object.php
XoopsModules/wfdownloads/trunk/wfdownloads/class/xoopstree.php
XoopsModules/wfdownloads/trunk/wfdownloads/include/functions.php
XoopsModules/wfdownloads/trunk/wfdownloads/include/module.php
XoopsModules/wfdownloads/trunk/wfdownloads/index.php
XoopsModules/wfdownloads/trunk/wfdownloads/js/jquery-latest.js
XoopsModules/wfdownloads/trunk/wfdownloads/singlefile.php
XoopsModules/wfdownloads/trunk/wfdownloads/submit.php
XoopsModules/wfdownloads/trunk/wfdownloads/templates/wfdownloads_disclaimer.html
XoopsModules/wfdownloads/trunk/wfdownloads/visit.php
Modified: XoopsModules/wfdownloads/trunk/wfdownloads/admin/downloads.php
===================================================================
--- XoopsModules/wfdownloads/trunk/wfdownloads/admin/downloads.php 2013-09-12 20:30:39 UTC (rev 12030)
+++ XoopsModules/wfdownloads/trunk/wfdownloads/admin/downloads.php 2013-09-13 20:32:24 UTC (rev 12031)
@@ -55,7 +55,7 @@
if (!$GLOBALS['xoopsSecurity']->check()) {
redirect_header($currentFile, 3, implode(',', $GLOBALS['xoopsSecurity']->getErrors()));
}
- $file = $wfdownloads->getConfig('uploaddir') . "/" . $download->getVar('filename');
+ $file = $wfdownloads->getConfig('uploaddir') . '/' . $download->getVar('filename');
if (is_file($file)) {
@chmod($file, 0777);
@unlink($file);
@@ -667,8 +667,8 @@
$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);
+ $approved = (isset($_POST['approved']) && $_POST['approved'] == true) ? true : false;
+ $notifypub = (isset($_POST['notifypub']) && $_POST['notifypub'] == true);
$expiredate = 0;
if (!$lid) {
@@ -729,7 +729,7 @@
$entries[$fid][0] = "";
$owner = "";
}
- $owner_groups =& $member_handler->getGroupsByUser($owner, FALSE);
+ $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
Modified: XoopsModules/wfdownloads/trunk/wfdownloads/admin/images.php
===================================================================
--- XoopsModules/wfdownloads/trunk/wfdownloads/admin/images.php 2013-09-12 20:30:39 UTC (rev 12030)
+++ XoopsModules/wfdownloads/trunk/wfdownloads/admin/images.php 2013-09-13 20:32:24 UTC (rev 12031)
@@ -25,19 +25,19 @@
switch ($op) {
case "image.upload" :
if ($_FILES['uploadfile']['name'] != "") {
- if (file_exists(XOOPS_ROOT_PATH . "/" . $_POST['uploadpath'] . "/" . $_FILES['uploadfile']['name'])) {
+ if (file_exists(XOOPS_ROOT_PATH . '/' . $_POST['uploadpath'] . '/' . $_FILES['uploadfile']['name'])) {
redirect_header($currentFile, 2, _AM_WFD_DOWN_IMAGEEXIST);
}
$allowedMimetypes = array('image/gif', 'image/jpeg', 'image/pjpeg', 'image/x-png', 'image/png');
$maxFileSize = $wfdownloads->getConfig('maxfilesize');
$maxImgWidth = $wfdownloads->getConfig('maximgwidth');
$maxImgHeight = $wfdownloads->getConfig('maximgheight');
- $uploadDir = XOOPS_ROOT_PATH . "/" . $_POST['uploadpath'];
+ $uploadDir = XOOPS_ROOT_PATH . '/' . $_POST['uploadpath'];
$screenShot = strtolower($_FILES['uploadfile']['name']);
- wfdownloads_uploading($screenShot, XOOPS_ROOT_PATH . "/" . $_POST['uploadpath'], $allowedMimetypes, $currentFile, 1, false, true);
+ wfdownloads_uploading($screenShot, XOOPS_ROOT_PATH . '/' . $_POST['uploadpath'], $allowedMimetypes, $currentFile, 1, false, true);
include_once WFDOWNLOADS_ROOT_PATH . '/class/img_uploader.php';
- $uploader = new XoopsMediaImgUploader($uploadDir . "/", $allowedMimetypes, $maxFileSize, $maxImgWidth, $maxImgHeight);
+ $uploader = new XoopsMediaImgUploader($uploadDir . '/', $allowedMimetypes, $maxFileSize, $maxImgWidth, $maxImgHeight);
redirect_header($currentFile, 2 , _AM_WFD_DOWN_IMAGEUPLOAD);
exit();
@@ -51,7 +51,7 @@
$ok = WfdownloadsRequest::getBool('ok', false, 'POST');
if ($ok == true) {
- $fileToDelete = XOOPS_ROOT_PATH . "/" . $_POST['uploadpath'] . "/" . $_POST['downfile'];
+ $fileToDelete = XOOPS_ROOT_PATH . '/' . $_POST['uploadpath'] . '/' . $_POST['downfile'];
if (file_exists($fileToDelete)) {
chmod($fileToDelete, 0666);
if (@unlink($fileToDelete)) {
@@ -119,17 +119,17 @@
ob_end_clean();
if ($rootPath > 0) {
- $iform->addElement(new XoopsFormLabel(_AM_WFD_DOWN_FUPLOADPATH, XOOPS_ROOT_PATH . "/" . $dirArray[$rootPath]));
- $iform->addElement(new XoopsFormLabel(_AM_WFD_DOWN_FUPLOADURL, XOOPS_URL . "/" . $dirArray[$rootPath]));
+ $iform->addElement(new XoopsFormLabel(_AM_WFD_DOWN_FUPLOADPATH, XOOPS_ROOT_PATH . '/' . $dirArray[$rootPath]));
+ $iform->addElement(new XoopsFormLabel(_AM_WFD_DOWN_FUPLOADURL, XOOPS_URL . '/' . $dirArray[$rootPath]));
- $graph_array = WfsLists::getListTypeAsArray(XOOPS_ROOT_PATH . "/" . $dirArray[$rootPath], $type = "images");
+ $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' />"));
+ $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' />"));
}
Modified: XoopsModules/wfdownloads/trunk/wfdownloads/admin/indexpage.php
===================================================================
--- XoopsModules/wfdownloads/trunk/wfdownloads/admin/indexpage.php 2013-09-12 20:30:39 UTC (rev 12030)
+++ XoopsModules/wfdownloads/trunk/wfdownloads/admin/indexpage.php 2013-09-13 20:32:24 UTC (rev 12031)
@@ -60,14 +60,14 @@
$sform = new XoopsThemeForm(_AM_WFD_IPAGE_MODIFY, "op", xoops_getenv('PHP_SELF'));
$sform->addElement(new XoopsFormText(_AM_WFD_IPAGE_CTITLE, 'indexheading', 60, 60, $indexheading), false);
- $graph_array = WfsLists::getListTypeAsArray(XOOPS_ROOT_PATH . "/" . $wfdownloads->getConfig('mainimagedir'), $type = "images");
+ $graph_array = WfsLists::getListTypeAsArray(XOOPS_ROOT_PATH . '/' . $wfdownloads->getConfig('mainimagedir'), $type = "images");
$indeximage_select = new XoopsFormSelect('', 'indeximage', $indeximage);
$indeximage_select->addOptionArray($graph_array);
$indeximage_select->setExtra("onchange='showImgSelected(\"image\", \"indeximage\", \"" . $wfdownloads->getConfig('mainimagedir') . "\", \"\", \"" . XOOPS_URL . "\")'");
$indeximage_tray = new XoopsFormElementTray(_AM_WFD_IPAGE_CIMAGE, ' ');
$indeximage_tray->addElement($indeximage_select);
if (!empty($indeximage)) {
- $indeximage_tray->addElement(new XoopsFormLabel('', "<br /><br /><img src='" . XOOPS_URL . "/".$wfdownloads->getConfig('mainimagedir')."/" . $indeximage . "' name='image' id='image' alt='' title='image' />"));
+ $indeximage_tray->addElement(new XoopsFormLabel('', "<br /><br /><img src='" . XOOPS_URL . '/'.$wfdownloads->getConfig('mainimagedir').'/' . $indeximage . "' 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' />"));
}
Modified: XoopsModules/wfdownloads/trunk/wfdownloads/admin/mimetypes.php
===================================================================
--- XoopsModules/wfdownloads/trunk/wfdownloads/admin/mimetypes.php 2013-09-12 20:30:39 UTC (rev 12030)
+++ XoopsModules/wfdownloads/trunk/wfdownloads/admin/mimetypes.php 2013-09-13 20:32:24 UTC (rev 12031)
@@ -46,7 +46,7 @@
echo $adminMenu->renderButton();
echo "<fieldset>\n";
- echo "<legend style='font-weight: bold; color: #900;'>" . _AM_WFD_MIME_CREATEF . "/" . _AM_WFD_MIME_MODIFYF . "</legend>\n";
+ echo "<legend style='font-weight: bold; color: #900;'>" . _AM_WFD_MIME_CREATEF . '/' . _AM_WFD_MIME_MODIFYF . "</legend>\n";
echo "<div>" . _AM_WFD_MIME_INFOTEXT . "</div>\n";
echo "</fieldset>\n";
Modified: XoopsModules/wfdownloads/trunk/wfdownloads/admin/reportsmodifications.php
===================================================================
--- XoopsModules/wfdownloads/trunk/wfdownloads/admin/reportsmodifications.php 2013-09-12 20:30:39 UTC (rev 12030)
+++ XoopsModules/wfdownloads/trunk/wfdownloads/admin/reportsmodifications.php 2013-09-13 20:32:24 UTC (rev 12031)
@@ -103,22 +103,22 @@
break;
case "screenshot":
if ($content != "") {
- $content = "<img src='" . XOOPS_URL . "/" . $wfdownloads->getConfig('screenshots') . "/" . $content . "' width='" . $wfdownloads->getConfig('shotwidth') . "' alt='' title='' />";
+ $content = "<img src='" . XOOPS_URL . '/' . $wfdownloads->getConfig('screenshots') . '/' . $content . "' width='" . $wfdownloads->getConfig('shotwidth') . "' alt='' title='' />";
}
break;
case "screenshot2":
if ($content != "") {
- $content = "<img src='" . XOOPS_URL . "/" . $wfdownloads->getConfig('screenshots') . "/" . $content . "' width='" . $wfdownloads->getConfig('shotwidth') . "' alt='' title='' />";
+ $content = "<img src='" . XOOPS_URL . '/' . $wfdownloads->getConfig('screenshots') . '/' . $content . "' width='" . $wfdownloads->getConfig('shotwidth') . "' alt='' title='' />";
}
break;
case "screenshot3":
if ($content != "") {
- $content = "<img src='" . XOOPS_URL . "/" . $wfdownloads->getConfig('screenshots') . "/" . $content . "' width='" . $wfdownloads->getConfig('shotwidth') . "' alt='' title='' />";
+ $content = "<img src='" . XOOPS_URL . '/' . $wfdownloads->getConfig('screenshots') . '/' . $content . "' width='" . $wfdownloads->getConfig('shotwidth') . "' alt='' title='' />";
}
break;
case "screenshot4":
if ($content != "") {
- $content = "<img src='" . XOOPS_URL . "/" . $wfdownloads->getConfig('screenshots') . "/" . $content . "' width='" . $wfdownloads->getConfig('shotwidth') . "' alt='' title='' />";
+ $content = "<img src='" . XOOPS_URL . '/' . $wfdownloads->getConfig('screenshots') . '/' . $content . "' width='" . $wfdownloads->getConfig('shotwidth') . "' alt='' title='' />";
}
break;
case "features":
@@ -131,7 +131,7 @@
}
break;
case "dhistory":
- $content = $myts->displayTarea($content, 1, 0, 0, 0, 1);
+ $content = $myts->displayTarea($content, true, false, false, false, true);
break;
}
$sform->addElement(new XoopsFormLabel($lang_def, $content));
@@ -169,22 +169,22 @@
break;
case "screenshot":
if ($content != "") {
- $content = "<img src='" . XOOPS_URL . "/" . $wfdownloads->getConfig('screenshots') . "/" . $content . "' width='" . $wfdownloads->getConfig('shotwidth') . "' alt='' title='' />";
+ $content = "<img src='" . XOOPS_URL . '/' . $wfdownloads->getConfig('screenshots') . '/' . $content . "' width='" . $wfdownloads->getConfig('shotwidth') . "' alt='' title='' />";
}
break;
case "screenshot2":
if ($content != "") {
- $content = "<img src='" . XOOPS_URL . "/" . $wfdownloads->getConfig('screenshots') . "/" . $content . "' width='" . $wfdownloads->getConfig('shotwidth') . "' alt='' title='' />";
+ $content = "<img src='" . XOOPS_URL . '/' . $wfdownloads->getConfig('screenshots') . '/' . $content . "' width='" . $wfdownloads->getConfig('shotwidth') . "' alt='' title='' />";
}
break;
case "screenshot3":
if ($content != "") {
- $content = "<img src='" . XOOPS_URL . "/" . $wfdownloads->getConfig('screenshots') . "/" . $content . "' width='" . $wfdownloads->getConfig('shotwidth') . "' alt='' title='' />";
+ $content = "<img src='" . XOOPS_URL . '/' . $wfdownloads->getConfig('screenshots') . '/' . $content . "' width='" . $wfdownloads->getConfig('shotwidth') . "' alt='' title='' />";
}
break;
case "screenshot4":
if ($content != "") {
- $content = "<img src='" . XOOPS_URL . "/" . $wfdownloads->getConfig('screenshots') . "/" . $content . "' width='" . $wfdownloads->getConfig('shotwidth') . "' alt='' title='' />";
+ $content = "<img src='" . XOOPS_URL . '/' . $wfdownloads->getConfig('screenshots') . '/' . $content . "' width='" . $wfdownloads->getConfig('shotwidth') . "' alt='' title='' />";
}
break;
case "features":
@@ -197,7 +197,7 @@
}
break;
case "dhistory":
- $content = $myts->displayTarea($content, 1, 0, 0, 0, 1);
+ $content = $myts->displayTarea($content, true, false, false, false, true);
break;
}
$sform->addElement(new XoopsFormLabel($lang_def, $content));
Modified: XoopsModules/wfdownloads/trunk/wfdownloads/class/category.php
===================================================================
--- XoopsModules/wfdownloads/trunk/wfdownloads/class/category.php 2013-09-12 20:30:39 UTC (rev 12030)
+++ XoopsModules/wfdownloads/trunk/wfdownloads/class/category.php 2013-09-13 20:32:24 UTC (rev 12031)
@@ -101,14 +101,14 @@
$groups_up_select->setDescription(_AM_WFD_FCATEGORY_GROUPPROMPT_UP_DESC);
$form->addElement($groups_up_select);
- $graph_array = & WfsLists::getListTypeAsArray(XOOPS_ROOT_PATH . "/" . $this->wfdownloads->getConfig('catimage'), $type = "images");
+ $graph_array = & WfsLists::getListTypeAsArray(XOOPS_ROOT_PATH . '/' . $this->wfdownloads->getConfig('catimage'), $type = "images");
$indeximage_select = new XoopsFormSelect('', 'imgurl', $this->getVar('imgurl'));
$indeximage_select->addOptionArray($graph_array);
$indeximage_select->setExtra("onchange='showImgSelected(\"image\", \"imgurl\", \"" . $this->wfdownloads->getConfig('catimage') . "\", \"\", \"" . XOOPS_URL . "\")'");
$indeximage_tray = new XoopsFormElementTray(_AM_WFD_FCATEGORY_CIMAGE, ' ');
$indeximage_tray->addElement($indeximage_select);
if ($this->getVar('imgurl') != "") {
- $indeximage_tray->addElement(new XoopsFormLabel('', "<br /><br /><img src='" . XOOPS_URL . "/" . $this->wfdownloads->getConfig('catimage') . "/" . $this->getVar('imgurl') . "' name='image' id='image' alt='' title='image' />"));
+ $indeximage_tray->addElement(new XoopsFormLabel('', "<br /><br /><img src='" . XOOPS_URL . '/' . $this->wfdownloads->getConfig('catimage') . '/' . $this->getVar('imgurl') . "' 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' />"));
}
@@ -158,25 +158,25 @@
$button_tray = new XoopsFormElementTray('', '');
$button_tray->addElement(new XoopsFormHidden('op', 'save'));
if ($this->isNew()) {
- $button_create = new XoopsFormButton('', '', _AM_WFD_BSAVE, 'submit');
+ $button_create = new XoopsFormButton('', '', _SAVE, 'submit');
$button_create->setExtra('onclick="this.form.elements.op.value=\'category.save\'"');
$button_tray->addElement($button_create);
- $button_reset = new XoopsFormButton('', '', _AM_WFD_BRESET, 'reset');
+ $button_reset = new XoopsFormButton('', '', _RESET, 'reset');
$button_tray->addElement($button_reset);
- $button_cancel = new XoopsFormButton('', '', _AM_WFD_BCANCEL, 'button');
+ $button_cancel = new XoopsFormButton('', '', _CANCEL, 'button');
$button_cancel->setExtra('onclick="history.go(-1)"');
$button_tray->addElement($button_cancel);
} else {
$form->addElement(new XoopsFormHidden('cid', $this->getVar('cid')));
- $button_create = new XoopsFormButton('', '', _AM_WFD_BMODIFY, 'submit');
+ $button_create = new XoopsFormButton('', '', _MODIFY, 'submit');
$button_create->setExtra('onclick="this.form.elements.op.value=\'category.save\'"');
$button_tray->addElement($button_create);
- $button_delete = new XoopsFormButton('', '', _AM_WFD_BDELETE, 'submit');
+ $button_delete = new XoopsFormButton('', '', _DELETE, 'submit');
$button_delete->setExtra('onclick="this.form.elements.op.value=\'category.delete\'"');
$button_tray->addElement($button_delete);
- $button_reset = new XoopsFormButton('', '', _AM_WFD_BRESET, 'reset');
+ $button_reset = new XoopsFormButton('', '', _RESET, 'reset');
$button_tray->addElement($button_reset);
- $button_cancel = new XoopsFormButton('', '', _AM_WFD_BCANCEL, 'button');
+ $button_cancel = new XoopsFormButton('', '', _CANCEL, 'button');
$button_cancel->setExtra('onclick="history.go(-1)"');
$button_tray->addElement($button_cancel);
}
Modified: XoopsModules/wfdownloads/trunk/wfdownloads/class/download.php
===================================================================
--- XoopsModules/wfdownloads/trunk/wfdownloads/class/download.php 2013-09-12 20:30:39 UTC (rev 12030)
+++ XoopsModules/wfdownloads/trunk/wfdownloads/class/download.php 2013-09-13 20:32:24 UTC (rev 12031)
@@ -157,45 +157,45 @@
if ($this->getVar('screenshot')) {
$download['screenshot_full'] = $this->getVar('screenshot');
- if ($this->getVar('screenshot') && file_exists(XOOPS_ROOT_PATH . "/" . $this->wfdownloads->getConfig('screenshots') . "/" . xoops_trim($this->getVar('screenshot')))) {
+ if ($this->getVar('screenshot') && file_exists(XOOPS_ROOT_PATH . '/' . $this->wfdownloads->getConfig('screenshots') . '/' . xoops_trim($this->getVar('screenshot')))) {
if ($this->wfdownloads->getConfig('usethumbs') == true) {
$download['screenshot_thumb'] = wfdownloads_createThumb($download['screenshot_full'], $this->wfdownloads->getConfig('screenshots'), "thumbs", $this->wfdownloads->getConfig('shotwidth'), $this->wfdownloads->getConfig('shotheight'),
$this->wfdownloads->getConfig('imagequality'), $this->wfdownloads->getConfig('updatethumbs'), $this->wfdownloads->getConfig('keepaspect'));
} else {
- $download['screenshot_thumb'] = XOOPS_URL . "/" . $this->wfdownloads->getConfig('screenshots') . "/" . xoops_trim($this->getVar('screenshot'));
+ $download['screenshot_thumb'] = XOOPS_URL . '/' . $this->wfdownloads->getConfig('screenshots') . '/' . xoops_trim($this->getVar('screenshot'));
}
}
}
if ($this->getVar('screenshot2') && $this->wfdownloads->getConfig('max_screenshot') >= 2) {
$download['screenshot_full2'] = $this->getVar('screenshot2');
- if ($this->getVar('screenshot2') && file_exists(XOOPS_ROOT_PATH . "/" . $this->wfdownloads->getConfig('screenshots') . "/" . xoops_trim($this->getVar('screenshot2')))) {
+ if ($this->getVar('screenshot2') && file_exists(XOOPS_ROOT_PATH . '/' . $this->wfdownloads->getConfig('screenshots') . '/' . xoops_trim($this->getVar('screenshot2')))) {
if ($this->wfdownloads->getConfig('usethumbs') == true) {
$download['screenshot_thumb2'] = wfdownloads_createThumb($download['screenshot_full2'], $this->wfdownloads->getConfig('screenshots'), "thumbs", $this->wfdownloads->getConfig('shotwidth'), $this->wfdownloads->getConfig('shotheight'),
$this->wfdownloads->getConfig('imagequality'), $this->wfdownloads->getConfig('updatethumbs'), $this->wfdownloads->getConfig('keepaspect'));
} else {
- $download['screenshot_thumb2'] = XOOPS_URL . "/" . $this->wfdownloads->getConfig('screenshots') . "/" . xoops_trim($this->getVar('screenshot2'));
+ $download['screenshot_thumb2'] = XOOPS_URL . '/' . $this->wfdownloads->getConfig('screenshots') . '/' . xoops_trim($this->getVar('screenshot2'));
}
}
}
if ($this->getVar('screenshot3') && $this->wfdownloads->getConfig('max_screenshot') >= 3) {
$download['screenshot_full3'] = $this->getVar('screenshot3');
- if ($this->getVar('screenshot3') && file_exists(XOOPS_ROOT_PATH . "/" . $this->wfdownloads->getConfig('screenshots') . "/" . xoops_trim($this->getVar('screenshot3')))) {
+ if ($this->getVar('screenshot3') && file_exists(XOOPS_ROOT_PATH . '/' . $this->wfdownloads->getConfig('screenshots') . '/' . xoops_trim($this->getVar('screenshot3')))) {
if ($this->wfdownloads->getConfig('usethumbs') == true) {
$download['screenshot_thumb3'] = wfdownloads_createThumb($download['screenshot_full3'], $this->wfdownloads->getConfig('screenshots'), "thumbs", $this->wfdownloads->getConfig('shotwidth'), $this->wfdownloads->getConfig('shotheight'),
$this->wfdownloads->getConfig('imagequality'), $this->wfdownloads->getConfig('updatethumbs'), $this->wfdownloads->getConfig('keepaspect'));
} else {
- $download['screenshot_thumb3'] = XOOPS_URL . "/" . $this->wfdownloads->getConfig('screenshots') . "/" . xoops_trim($this->getVar('screenshot3'));
+ $download['screenshot_thumb3'] = XOOPS_URL . '/' . $this->wfdownloads->getConfig('screenshots') . '/' . xoops_trim($this->getVar('screenshot3'));
}
}
}
if ($this->getVar('screenshot4') && $this->wfdownloads->getConfig('max_screenshot') >= 4) {
$download['screenshot_full4'] = $this->getVar('screenshot4');
- if ($this->getVar('screenshot4') && file_exists(XOOPS_ROOT_PATH . "/" . $this->wfdownloads->getConfig('screenshots') . "/" . xoops_trim($this->getVar('screenshot4')))) {
+ if ($this->getVar('screenshot4') && file_exists(XOOPS_ROOT_PATH . '/' . $this->wfdownloads->getConfig('screenshots') . '/' . xoops_trim($this->getVar('screenshot4')))) {
if ($this->wfdownloads->getConfig('usethumbs') == true) {
$download['screenshot_thumb4'] = wfdownloads_createThumb($download['screenshot_full4'], $this->wfdownloads->getConfig('screenshots'), "thumbs", $this->wfdownloads->getConfig('shotwidth'), $this->wfdownloads->getConfig('shotheight'),
$this->wfdownloads->getConfig('imagequality'), $this->wfdownloads->getConfig('updatethumbs'), $this->wfdownloads->getConfig('keepaspect'));
} else {
- $download['screenshot_thumb4'] = XOOPS_URL . "/" . $this->wfdownloads->getConfig('screenshots') . "/" . xoops_trim($this->getVar('screenshot4'));
+ $download['screenshot_thumb4'] = XOOPS_URL . '/' . $this->wfdownloads->getConfig('screenshots') . '/' . xoops_trim($this->getVar('screenshot4'));
}
}
}
@@ -237,7 +237,7 @@
// generate autosummary
$summaryLength = (int)$this->wfdownloads->getConfig('autosumlength');
$summaryDescription = stripslashes($this->getVar('description'));
- $download['summary'] = $myts->displayTarea($summaryDescription, 1);
+ $download['summary'] = $myts->displayTarea($summaryDescription, true);
if (strlen($summaryDescription) > $summaryLength) {
$download['summary'] = wfdownloads_truncateHtml($download['summary'], $summaryLength, '...', false, true);
} else {
@@ -265,7 +265,7 @@
$platformArray = $this->wfdownloads->getConfig('platform');
$download['platform'] = $myts->htmlSpecialChars($platformArray[$this->getVar('platform')]);
$history = $this->getVar('dhistory', 'n');
- $download['history'] = $myts->displayTarea($history, 1);
+ $download['history'] = $myts->displayTarea($history, true);
$download['features'] = '';
if ($this->getVar('features')) {
$downloadfeatures = explode('|', trim($this->getVar('features')));
@@ -447,24 +447,33 @@
$sform->addElement(new XoopsFormFile(_MD_WFD_DUPLOADSCRSHOT, 'screenshot4', 0), false);
}
}
- $option_tray = new XoopsFormElementTray(_MD_WFD_OPTIONS, '<br />');
- $notify_checkbox = new XoopsFormCheckBox('', 'notifypub');
- $notify_checkbox->addOption(1, _MD_WFD_NOTIFYAPPROVE);
- $option_tray->addElement($notify_checkbox);
+ $option_tray = new XoopsFormElementTray(_MD_WFD_OPTIONS, '<br />');
+ $notify_checkbox = new XoopsFormCheckBox('', 'notifypub');
+ $notify_checkbox->addOption(1, _MD_WFD_NOTIFYAPPROVE);
+ $option_tray->addElement($notify_checkbox);
$sform->addElement($option_tray);
// button tray
$button_tray = new XoopsFormElementTray('', '');
- if (!$this->isNew()) {
- $button_tray->addElement(new XoopsFormHidden('lid', (int)$this->getVar('lid', 'e')));
- }
- $button_submit = new XoopsFormButton('', 'submit', _SUBMIT, 'submit');
- $button_tray->addElement($button_submit);
+ if ($this->isNew()) {
+ $button_tray->addElement(new XoopsFormHidden('op', 'download.save'));
+ $button_submit = new XoopsFormButton('', '', _SAVE, 'submit');
+ $button_submit->setExtra('onclick="this.form.elements.op.value=\'download.save\'"');
+ $button_tray->addElement($button_submit);
+ } else {
+ $button_tray->addElement(new XoopsFormHidden('lid', (int)$this->getVar('lid')));
+ $button_tray->addElement(new XoopsFormHidden('op', 'download.save'));
+ $button_submit = new XoopsFormButton('', '', _MODIFY, 'submit');
+ $button_submit->setExtra('onclick="this.form.elements.op.value=\'download.save\'"');
+ $button_tray->addElement($button_submit);
+ }
$button_reset = new XoopsFormButton('', '', _RESET, 'reset');
$button_tray->addElement($button_reset);
$button_cancel = new XoopsFormButton('', '', _CANCEL, 'button');
$button_cancel->setExtra('onclick="history.go(-1)"');
$button_tray->addElement($button_cancel);
$sform->addElement($button_tray);
+
+
return $sform;
}
@@ -637,7 +646,7 @@
$indeximage_tray = new XoopsFormElementTray(_AM_WFD_FILE_SHOTIMAGE, ' ');
$indeximage_tray->addElement($indeximage_select);
if ($this->getVar('screenshot') != '') {
- $indeximage_tray->addElement(new XoopsFormLabel('', "<br /><br /><img src='" . XOOPS_URL . "/" . $this->wfdownloads->getConfig('screenshots') . "/" . $this->getVar('screenshot', 'e') . "' id='image1' alt='' title='screenshot 1' />"));
+ $indeximage_tray->addElement(new XoopsFormLabel('', "<br /><br /><img src='" . XOOPS_URL . '/' . $this->wfdownloads->getConfig('screenshots') . '/' . $this->getVar('screenshot', 'e') . "' id='image1' alt='' title='screenshot 1' />"));
} else {
$indeximage_tray->addElement(new XoopsFormLabel('', "<br /><br /><img src='" . XOOPS_URL . "/uploads/blank.gif' id='image1' alt='' title='' />"));
}
@@ -650,7 +659,7 @@
$indeximage_tray2 = new XoopsFormElementTray(_AM_WFD_FILE_SHOTIMAGE, ' ');
$indeximage_tray2->addElement($indeximage_select2);
if ($this->getVar('screenshot2') != '') {
- $indeximage_tray2->addElement(new XoopsFormLabel('', "<br /><br /><img src='" . XOOPS_URL . '/' . $this->wfdownloads->getConfig('screenshots') . "/" . $this->getVar('screenshot2', 'e') . "' id='image2' alt='' title='screenshot 2' />"));
+ $indeximage_tray2->addElement(new XoopsFormLabel('', "<br /><br /><img src='" . XOOPS_URL . '/' . $this->wfdownloads->getConfig('screenshots') . '/' . $this->getVar('screenshot2', 'e') . "' id='image2' alt='' title='screenshot 2' />"));
} else {
$indeximage_tray2->addElement(new XoopsFormLabel('', "<br /><br /><img src='" . XOOPS_URL . "/uploads/blank.gif' id='image2' alt='' title='' />"));
}
@@ -663,7 +672,7 @@
$indeximage_tray3 = new XoopsFormElementTray(_AM_WFD_FILE_SHOTIMAGE, ' ');
$indeximage_tray3->addElement($indeximage_select3);
if ($this->getVar('screenshot3') != '') {
- $indeximage_tray3->addElement(new XoopsFormLabel('', "<br /><br /><img src='" . XOOPS_URL . '/' . $this->wfdownloads->getConfig('screenshots') . "/" . $this->getVar('screenshot3', 'e') . "' id='image3' alt='' title='screenshot 3' />"));
+ $indeximage_tray3->addElement(new XoopsFormLabel('', "<br /><br /><img src='" . XOOPS_URL . '/' . $this->wfdownloads->getConfig('screenshots') . '/' . $this->getVar('screenshot3', 'e') . "' id='image3' alt='' title='screenshot 3' />"));
} else {
$indeximage_tray3 -> addElement(new XoopsFormLabel('', "<br /><br /><img src='" . XOOPS_URL . "/uploads/blank.gif' id='image3' alt='' title='' />"));
}
@@ -676,7 +685,7 @@
$indeximage_tray4 = new XoopsFormElementTray(_AM_WFD_FILE_SHOTIMAGE, ' ');
$indeximage_tray4->addElement($indeximage_select4);
if ($this->getVar('screenshot4') != "") {
- $indeximage_tray4->addElement(new XoopsFormLabel('', "<br /><br /><img src='" . XOOPS_URL . '/' . $this->wfdownloads->getConfig('screenshots') . "/" . $this->getVar('screenshot4', 'e') . "' id='image4' alt='' title='screenshot 4' />"));
+ $indeximage_tray4->addElement(new XoopsFormLabel('', "<br /><br /><img src='" . XOOPS_URL . '/' . $this->wfdownloads->getConfig('screenshots') . '/' . $this->getVar('screenshot4', 'e') . "' id='image4' alt='' title='screenshot 4' />"));
} else {
$indeximage_tray4->addElement(new XoopsFormLabel('', "<br /><br /><img src='" . XOOPS_URL . "/uploads/blank.gif' id='image4' alt='' title='' />"));
}
@@ -735,22 +744,22 @@
$button_tray->addElement(new XoopsFormHidden('status', 1));
$button_tray->addElement(new XoopsFormHidden('notifypub', $this->getVar('notifypub', 'e')));
$button_tray->addElement(new XoopsFormHidden('op', 'download.save'));
- $button_tray->addElement(new XoopsFormButton('', '', _AM_WFD_BSAVE, 'submit'));
+ $button_tray->addElement(new XoopsFormButton('', '', _SAVE, 'submit'));
$button_reset = new XoopsFormButton('', '', _RESET, 'reset');
$button_tray->addElement($button_reset);
$button_cancel = new XoopsFormButton('', '', _CANCEL, 'button');
$button_cancel->setExtra('onclick="history.go(-1)"');
$button_tray->addElement($button_cancel);
} else {
+ $button_tray->addElement(new XoopsFormHidden('status', 2));
$button_tray->addElement(new XoopsFormHidden('lid', (int)$this->getVar('lid')));
- $button_tray->addElement(new XoopsFormHidden('status', 2));
$button_tray->addElement(new XoopsFormHidden('op', 'download.save'));
- $butt_dup = new XoopsFormButton('', '', _AM_WFD_BMODIFY, 'submit');
- $butt_dup->setExtra('onclick="this.form.elements.op.value=\'download.save\'"');
- $button_tray->addElement($butt_dup);
- $butt_dupct = new XoopsFormButton('', '', _DELETE, 'submit');
- $butt_dupct->setExtra('onclick="this.form.elements.op.value=\'download.delete\'"');
- $button_tray->addElement($butt_dupct);
+ $button_submit = new XoopsFormButton('', '', _MODIFY, 'submit');
+ $button_submit->setExtra('onclick="this.form.elements.op.value=\'download.save\'"');
+ $button_tray->addElement($butt_submit);
+ $button_delete = new XoopsFormButton('', '', _DELETE, 'submit');
+ $button_delete->setExtra('onclick="this.form.elements.op.value=\'download.delete\'"');
+ $button_tray->addElement($button_delete);
$butt_dupct2 = new XoopsFormButton('', '', _AM_WFD_BCANCEL, 'submit');
$butt_dupct2->setExtra('onclick="this.form.elements.op.value=\'downloadsConfigMenu\'"');
$button_tray->addElement($butt_dupct2);
Modified: XoopsModules/wfdownloads/trunk/wfdownloads/class/object.php
===================================================================
--- XoopsModules/wfdownloads/trunk/wfdownloads/class/object.php 2013-09-12 20:30:39 UTC (rev 12030)
+++ XoopsModules/wfdownloads/trunk/wfdownloads/class/object.php 2013-09-13 20:32:24 UTC (rev 12031)
@@ -80,7 +80,7 @@
*
* @param mixed $id ID of the object - or array of ids for joint keys. Joint keys MUST be given in the same order as in the constructor
* @param bool $as_object whether to return an object or an array
- * @return mixed reference to the object, FALSE if failed
+ * @return mixed reference to the object, false if failed
*/
function &get($id, $as_object = true) {
if (is_array($this->keyName)) {
@@ -263,7 +263,7 @@
*
* @param object $obj reference to the object to delete
* @param bool $force
- * @return bool FALSE if failed.
+ * @return bool false if failed.
*/
function delete(&$obj, $force = false)
{
@@ -294,7 +294,7 @@
* @param object $obj reference to the object
* @param bool $force whether to force the query execution despite security settings
* @param bool $checkObject check if the object is dirty and clean the attributes
- * @return bool FALSE if failed, TRUE if already present and unchanged or successful
+ * @return bool false if failed, true if already present and unchanged or successful
*/
function insert(&$obj, $force = false, $checkObject = true)
Modified: XoopsModules/wfdownloads/trunk/wfdownloads/class/xoopstree.php
===================================================================
--- XoopsModules/wfdownloads/trunk/wfdownloads/class/xoopstree.php 2013-09-12 20:30:39 UTC (rev 12030)
+++ XoopsModules/wfdownloads/trunk/wfdownloads/class/xoopstree.php 2013-09-13 20:32:24 UTC (rev 12031)
@@ -135,7 +135,7 @@
list ($parentid, $name) = $this->db->fetchRow($result);
$myts = MyTextSanitizer::getInstance();
$name = $myts->htmlspecialchars($name);
- $path = "/" . $name . $path . "";
+ $path = '/' . $name . $path . "";
if ($parentid == 0) {
return $path;
}
@@ -217,7 +217,7 @@
return $path;
}
list ($parentid) = $this->db->fetchRow($result);
- $path = "/" . $sel_id . $path . "";
+ $path = '/' . $sel_id . $path . "";
if ($parentid == 0) {
return $path;
}
Modified: XoopsModules/wfdownloads/trunk/wfdownloads/include/functions.php
===================================================================
--- XoopsModules/wfdownloads/trunk/wfdownloads/include/functions.php 2013-09-12 20:30:39 UTC (rev 12030)
+++ XoopsModules/wfdownloads/trunk/wfdownloads/include/functions.php 2013-09-13 20:32:24 UTC (rev 12031)
@@ -166,7 +166,7 @@
* @param string $dir path to the directory to make
* @param int $perm mode
* @param bool $create_index if true create index.html
- * @return bool Returns TRUE on success or FALSE on failure
+ * @return bool Returns true on success or false on failure
*/
function wfdownloads_makeDir($dir, $perm = 0777, $create_index = true) {
if (!is_dir($dir)){
@@ -187,7 +187,7 @@
*
* @param string $source is the original directory
* @param string $destination is the destination directory
- * @return bool Returns TRUE on success or FALSE on failure
+ * @return bool Returns true on success or false on failure
*
*/
function wfdownloads_copyFile($source, $destination) {
@@ -202,7 +202,7 @@
*
* @param string $source is the original directory
* @param string $destination is the destination directory
- * @return bool Returns TRUE on success or FALSE on failure
+ * @return bool Returns true on success or false on failure
*
*/
function wfdownloads_copyDir($source, $destination) {
@@ -228,8 +228,8 @@
* Delete a empty/not empty directory
*
* @param string $dir path to the directory to delete
- * @param bool $if_not_empty if FALSE it delete directory only if false
- * @return bool Returns TRUE on success or FALSE on failure
+ * @param bool $if_not_empty if false it delete directory only if false
+ * @return bool Returns true on success or false on failure
*/
function wfdownloads_delDir($dir, $if_not_empty = true) {
if (!file_exists($dir)) return true;
@@ -463,7 +463,7 @@
*
* @param string $key
* @param string $value
- * @return bool TRUE if success, FALSE if failure
+ * @return bool true if success, false if failure
*
* @access public
* @author xhelp development team
@@ -986,10 +986,10 @@
$imagePath = XOOPS_ROOT_PATH . "/{$img_path}/{$imgName}";
$saveFile = "{$imgPath}/{$imgSavePath}/{$width}x{$height}_{$imgName}";
- $savePath = XOOPS_ROOT_PATH . "/" . $savefile;
+ $savePath = XOOPS_ROOT_PATH . '/' . $savefile;
// Return the image if no update and image exists
if ($update == 0 && file_exists($savePath)) {
- return XOOPS_URL . "/" . $saveFile;
+ return XOOPS_URL . '/' . $saveFile;
}
list($origWidth, $origHeight, $type, $attr) = getimagesize($imagePath, $info);
@@ -1058,7 +1058,7 @@
}
imagedestroy($img);
flush();
- return XOOPS_URL . "/" . $saveFile;
+ return XOOPS_URL . '/' . $saveFile;
}
@@ -1216,7 +1216,7 @@
redirect_header($redirectURL, 1 , _AM_WFD_UPLOADFILE);
} else {
if (is_file($uploader->savedDestination)) {
-// $file['url'] = XOOPS_URL . "/" . $uploadDirectory . "/";
+// $file['url'] = XOOPS_URL . '/' . $uploadDirectory . '/';
$file['filename'] = strtolower($uploader->savedFileName);
$file['filetype'] = $_FILES['userfile']['type'];
$file['size'] = filesize($uploadDirectory . strtolower($uploader->savedFileName));
@@ -1484,7 +1484,7 @@
$wfdownloads = WfdownloadsWfdownloads::getInstance();
$search_query = stripslashes($search_query);
- if(((strlen($search_query) > 2) && ($last_query != $search_query) ) && ($page == FALSE)) {
+ if(((strlen($search_query) > 2) && ($last_query != $search_query) ) && ($page == false)) {
//print "<BR>SEARCH!";
// Get the first word in $search_query and use it for the $summary_query.
$summary_query = str_replace("\""," ",$search_query);
@@ -1529,8 +1529,8 @@
// strip out all but the number of hits
$num_results = ereg_replace('# Number of hits: ', '', $num_line);
- //$table_header_flag = FALSE;
- //$disp_nff_flag = TRUE;
+ //$table_header_flag = false;
+ //$disp_nff_flag = true;
while ($line = @fgets($pipe_handler, 4096)) {
// loop through each line of the pipe result (i.e. swish-e output)
Modified: XoopsModules/wfdownloads/trunk/wfdownloads/include/module.php
===================================================================
--- XoopsModules/wfdownloads/trunk/wfdownloads/include/module.php 2013-09-12 20:30:39 UTC (rev 12030)
+++ XoopsModules/wfdownloads/trunk/wfdownloads/include/module.php 2013-09-13 20:32:24 UTC (rev 12031)
@@ -123,14 +123,15 @@
$gperm_handler = xoops_gethandler('groupperm');
$category_handler = xoops_getmodulehandler('category', $module->dirname());
+
$cids = $category_handler->getIds();
if (count($cids) > 0) {
- echo "<br /><b>Adding upload permissions to categories</b><br />";
+ echo "<br /><B>Adding upload permissions to categories</B><br />";
foreach ($cids as $cid) {
- $allowedDownGroupsIds = $gperm_handler->getGroupIds('WFDownCatPerm', $cid, $module->mid());
- foreach ($allowedDownGroupsIds as $allowedDownGroupsId) {
+ $down_groups_ids = $gperm_handler->getGroupIds('WFDownCatPerm', $cid, $module->mid());
+ foreach ($down_groups_ids as $down_group_id) {
//$gperm_handler->deleteByModule($module->mid(), 'WFUpCatPerm', $cid);
- $gperm_handler->addRight('WFUpCatPerm', $cid, $allowedDownGroupsId, $module->mid());
+ $gperm_handler->addRight('WFUpCatPerm', $cid, $down_group_id, $module->mid());
}
}
} else {
Modified: XoopsModules/wfdownloads/trunk/wfdownloads/index.php
===================================================================
--- XoopsModules/wfdownloads/trunk/wfdownloads/index.php 2013-09-12 20:30:39 UTC (rev 12030)
+++ XoopsModules/wfdownloads/trunk/wfdownloads/index.php 2013-09-13 20:32:24 UTC (rev 12031)
@@ -139,13 +139,13 @@
}
}
$isNewImage = wfdownloads_isNewImage($publishdate);
- if (($mainCategories[$i]->getVar('imgurl') != "") && is_file(XOOPS_ROOT_PATH . "/" . $wfdownloads->getConfig('catimage') . "/" . $mainCategories[$i]->getVar('imgurl'))) {
+ if (($mainCategories[$i]->getVar('imgurl') != "") && is_file(XOOPS_ROOT_PATH . '/' . $wfdownloads->getConfig('catimage') . '/' . $mainCategories[$i]->getVar('imgurl'))) {
if ($wfdownloads->getConfig('usethumbs') && function_exists('gd_info')) {
$imageURL = wfdownloads_createThumb($mainCategories[$i]->getVar('imgurl'), $wfdownloads->getConfig('catimage'),
"thumbs", $wfdownloads->getConfig('cat_imgwidth'), $wfdownloads->getConfig('cat_imgheight'),
$wfdownloads->getConfig('imagequality'), $wfdownloads->getConfig('updatethumbs'), $wfdownloads->getConfig('keepaspect'));
} else {
- $imageURL = XOOPS_URL . "/" . $wfdownloads->getConfig('catimage') . "/" . $mainCategories[$i]->getVar('imgurl');
+ $imageURL = XOOPS_URL . '/' . $wfdownloads->getConfig('catimage') . '/' . $mainCategories[$i]->getVar('imgurl');
}
} else {
$imageURL = $isNewImage['image'];
Modified: XoopsModules/wfdownloads/trunk/wfdownloads/js/jquery-latest.js
===================================================================
--- XoopsModules/wfdownloads/trunk/wfdownloads/js/jquery-latest.js 2013-09-12 20:30:39 UTC (rev 12030)
+++ XoopsModules/wfdownloads/trunk/wfdownloads/js/jquery-latest.js 2013-09-13 20:32:24 UTC (rev 12031)
@@ -1051,11 +1051,11 @@
// DEPRECATED
// And the / root expression
- } else if ( !t.indexOf("/") && !context.ownerDocument ) {
+ } else if ( !t.indexOf('/') && !context.ownerDocument ) {
context = context.documentElement;
t = t.substr(1,t.length);
- if ( t.indexOf("/") >= 1 )
- t = t.substr(t.indexOf("/"),t.length);
+ if ( t.indexOf('/') >= 1 )
+ t = t.substr(t.indexOf('/'),t.length);
}
// Initialize the search
Modified: XoopsModules/wfdownloads/trunk/wfdownloads/singlefile.php
===================================================================
--- XoopsModules/wfdownloads/trunk/wfdownloads/singlefile.php 2013-09-12 20:30:39 UTC (rev 12030)
+++ XoopsModules/wfdownloads/trunk/wfdownloads/singlefile.php 2013-09-13 20:32:24 UTC (rev 12031)
@@ -59,7 +59,7 @@
// Making the category image and title available in the template
if (
($category->getVar('imgurl') != "") &&
- is_file(XOOPS_ROOT_PATH . "/" . $wfdownloads->getConfig('catimage') . "/" . $category->getVar('imgurl'))) {
+ is_file(XOOPS_ROOT_PATH . '/' . $wfdownloads->getConfig('catimage') . '/' . $category->getVar('imgurl'))) {
if (
$wfdownloads->getConfig('usethumbs') &&
function_exists('gd_info')) {
Modified: XoopsModules/wfdownloads/trunk/wfdownloads/submit.php
===================================================================
--- XoopsModules/wfdownloads/trunk/wfdownloads/submit.php 2013-09-12 20:30:39 UTC (rev 12030)
+++ XoopsModules/wfdownloads/trunk/wfdownloads/submit.php 2013-09-13 20:32:24 UTC (rev 12031)
@@ -48,7 +48,7 @@
redirect_header('index.php', 5, _MD_WFD_NOTALLOWESTOSUBMIT);
}
-// If user is not an ADMIN check posts
+// Check posts if user is not an ADMIN
if (is_object($xoopsUser) && !$xoopsUser->isAdmin()) {
if ($xoopsUser->getVar('posts') < $wfdownloads->getConfig('upload_minposts')) {
redirect_header("index.php", 5, _MD_WFD_UPLOADMINPOSTS);
@@ -57,329 +57,19 @@
-if (!empty($_POST['submit'])) {
- $notify = !empty($_POST['notify']) ? true : false;
+$lid = WfdownloadsRequest::getInt('lid', 0);
+$cid = WfdownloadsRequest::getInt('cid', 0);
+$agreed = WfdownloadsRequest::getBool('agreed', false, 'POST');
+$op = WfdownloadsRequest::getString('op', 'download.form');
+$notify = WfdownloadsRequest::getBool('notify', false);
- $lid = WfdownloadsRequest::getInt('lid', 0, 'POST');
- $cid = WfdownloadsRequest::getInt('cid', 0, 'POST');
- 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 : (int)$_POST['size'];
- $title = trim($_POST['title']);
- } else {
- $isAdmin = wfdownloads_userIsAdmin();
+if ($wfdownloads->getConfig('showdisclaimer') && ($op == 'download.form') && $agreed == false) {
+ $op = 'download.disclaimer';
+}
- $down = wfdownloads_uploading($_FILES, $wfdownloads->getConfig('uploaddir'), '', '', 0, false, $isAdmin);
-
- $url = ($_POST['url'] != "http://") ? $_POST['url'] : '';
- $size = $down['size'];
- $filename = $down['filename'];
- $filetype = $_FILES['userfile']['type'];
- $title = $_FILES['userfile']['name'];
- $title = rtrim(wfdownloads_strrrchr($title, "."), ".");
- $title = (isset($_POST['title_checkbox']) && $_POST['title_checkbox'] == 1) ? $title : trim($_POST['title']);
- }
- // Load screenshot
- include_once WFDOWNLOADS_ROOT_PATH . '/class/img_uploader.php';
- $allowedMimetypes = array('image/gif', 'image/jpeg', 'image/pjpeg', 'image/x-png', 'image/png');
- $uploadDirectory = XOOPS_ROOT_PATH . '/' . $wfdownloads->getConfig('screenshots') . '/';
- // Load screenshot #1
- if (isset($_FILES['screenshot']['name']) && !empty($_FILES['screenshot']['name'])) {
- $screenshot = strtolower($_FILES['screenshot']['name']);
- $uploader = new XoopsMediaImgUploader($uploadDirectory, $allowedMimetypes, $wfdownloads->getConfig('maxfilesize'), $wfdownloads->getConfig('maximgwidth'), $wfdownloads->getConfig('maximgheight'));
- if ($uploader->fetchMedia($_POST['xoops_upload_file'][1])) {
- if (!$uploader->upload()) {
- $errors = $uploader->getErrors();
- @unlink($uploadDirectory . $screenshot);
- redirect_header($currentFile, 1, $errors);
- }
- } else {
- $errors = $uploader->getErrors();
- @unlink($uploadDirectory . $screenshot);
- redirect_header($currentFile, 1, $errors);
- }
- } else {
- $screenshot = '';
- }
- // Load screenshot #2
- if ($wfdownloads->getConfig('max_screenshot') >= 2) {
- if (isset($_FILES['screenshot2']['name']) && !empty($_FILES['screenshot2']['name'])) {
- $screenshot2 = strtolower($_FILES['screenshot2']['name']);
- $uploader = new XoopsMediaImgUploader($uploadDirectory, $allowedMimetypes, $wfdownloads->getConfig('maxfilesize'), $wfdownloads->getConfig('maximgwidth'), $wfdownloads->getConfig('maximgheight'));
- if ($uploader->fetchMedia($_POST['xoops_upload_file'][2])) {
- if (!$uploader->upload()) {
- $errors = $uploader->getErrors();
- @unlink($uploadDirectory . $screenshot2);
- redirect_header($currentFile, 1, $errors);
- }
- } else {
- $errors = $uploader->getErrors();
- @unlink($uploadDirectory . $screenshot2);
- redirect_header($currentFile, 1, $errors);
- }
- } else {
- $screenshot2 = '';
- }
- } else {
- $screenshot2 = '';
- }
- // Load screenshot #3
- if ($wfdownloads->getConfig('max_screenshot') >= 3) {
- if (isset($_FILES['screenshot3']['name']) && !empty($_FILES['screenshot3']['name'])) {
- $screenshot3 = strtolower($_FILES['screenshot3']['name']);
- $uploader = new XoopsMediaImgUploader($uploadDirectory, $allowedMimetypes, $wfdownloads->getConfig('maxfilesize'), $wfdownloads->getConfig('maximgwidth'), $wfdownloads->getConfig('maximgheight'));
- if ($uploader->fetchMedia($_POST['xoops_upload_file'][3])) {
- if (!$uploader->upload()) {
- $errors = $uploader->getErrors();
- @unlink($uploadDirectory . $screenshot3);
- redirect_header($currentFile, 1, $errors);
- }
- } else {
- $errors = $uploader->getErrors();
- @unlink($uploadDirectory . $screenshot3);
- redirect_header($currentFile, 1, $errors);
- }
- } else {
- $screenshot3 = '';
- }
- } else {
- $screenshot3 = '';
- }
- // Load screenshot #4
- if ($wfdownloads->getConfig('max_screenshot') >= 4) {
- if (isset($_FILES['screenshot4']['name']) && !empty($_FILES['screenshot4']['name'])) {
- $screenshot4 = strtolower($_FILES['screenshot4']['name']);
- $uploader = new XoopsMediaImgUploader($uploadDirectory, $allowedMimetypes, $wfdownloads->getConfig('maxfilesize'), $wfdownloads->getConfig('maximgwidth'), $wfdownloads->getConfig('maximgheight'));
- if ($uploader->fetchMedia($_POST['xoops_upload_file'][4])) {
- if (!$uploader->upload()) {
- $errors = $uploader->getErrors();
- @unlink($uploadDirectory . $screenshot4);
- redirect_header($currentFile, 1, $errors);
- }
- } else {
- $errors = $uploader->getErrors();
- @unlink($uploadDirectory . $screenshot4);
- redirect_header($currentFile, 1, $errors);
- }
- } else {
- $screenshot4 = '';
- }
- } else {
- $screenshot4 = '';
- }
-
- if ($lid > 0) {
- $thisIsANewRecord = false;
- if ($wfdownloads->getConfig('autoapprove') == _WFD_AUTOAPPROVE_DOWNLOAD || $wfdownloads->getConfig('autoapprove') == _WFD_AUTOAPPROVE_BOTH) {
- $download = $wfdownloads->getHandler('download')->get($lid);
- } else {
- $download = $wfdownloads->getHandler('modification')->create();
- $download->setVar('lid', $lid);
- }
- } else {
- $thisIsANewRecord = true;
- $download = $wfdownloads->getHandler('download')->create();
- if ($wfdownloads->getConfig('autoapprove') == _WFD_AUTOAPPROVE_DOWNLOAD || $wfdownloads->getConfig('autoapprove') == _WFD_AUTOAPPROVE_BOTH) {
- $download->setVar('published', time());
- $download->setVar('status', 1);
- } else {
- $download->setVar('published', false);
- $download->setVar('status', 0);
- }
- }
-
- // Added Formulize module support (2006/05/04) jpc - start
- if (wfdownloads_checkModule('formulize')) {
- // Now that the $download object has been instantiated, handle the Formulize part of the submission...
- $category = $wfdownloads->getHandler('category')->get($cid);
- $fid = $category->getVar('formulize_fid');
- if ($fid) {
- 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]) {
- if (wfdownloads_checkModule('formulize') < 300)
- $owner = getEntryOwner($entries[$fid][0]);
- else
- $owner = getEntryOwner($entries[$fid][0], $fid);
- } else {
- $entries[$fid][0] = "";
- $owner = "";
- }
- $cid = $download->getVar('cid');
- } else {
- $entries[$fid][0] = "";
- $owner = "";
- }
- $owner_groups =& $member_handler->getGroupsByUser($owner, false);
- $uid = is_object($xoopsUser) ? (int)$xoopsUser->getVar('uid') : 0;
- $groups = $xoopsUser ? $xoopsUser->getGroups() : array(0 => XOOPS_GROUP_ANONYMOUS);
- $entries = handleSubmission($formulize_mgr, $entries, $uid, $owner, $fid, $owner_groups, $groups, "new"); // "new" causes xoops token check to be skipped, since WF-downloads should be doing that
- if (!$owner) {
- $id_req = $entries[$fid][0];
- $download->setVar('formulize_idreq', $id_req);
- }
- }
- }
- // Added Formulize module support (2006/05/04) jpc - end
-
- if (!empty($_POST['homepage']) || $_POST['homepage'] != "http://") {
- $download->setVar('homepage', formatURL(trim($_POST["homepage"])));
- $download->setVar('homepagetitle', trim($_POST["homepagetitle"]));
- }
- $download->setVar('title', $title);
- $download->setVar('url', $url);
- $download->setVar('cid', (int)$cid);
- $download->setVar('filename', $filename);
- $download->setVar('filetype', $filetype);
-
- /* 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.
- $version = !empty($_POST["version"]) ? trim($_POST["version"]) : 0;
-
- 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)
- $tags = array();
- $tags['FILE_NAME'] = $title;
- $tags['FILE_URL'] = WFDOWNLOADS_URL . "/singlefile.php?cid={$cid}&lid={$lid}";
- $category = $wfdownloads->getHandler('category')->get($cid);
- $tags['FILE_VERSION'] = $version;
- $tags['CATEGORY_NAME'] = $category->getVar('title');
- $tags['CATEGORY_URL'] = WFDOWNLOADS_URL . "/viewcat.php?cid={$cid}";
-
- if ($wfdownloads->getConfig('autoapprove') == _WFD_AUTOAPPROVE_DOWNLOAD || $wfdownloads->getConfig('autoapprove') == _WFD_AUTOAPPROVE_BOTH) {
- // 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', $_POST['version']);
- $download->setVar('size', $size);
- $download->setVar('platform', $_POST['platform']);
- $download->setVar('screenshot', $screenshot);
- $download->setVar('screenshot2', $screenshot2);
- $download->setVar('screenshot3', $screenshot3);
- $download->setVar('screenshot4', $screenshot4);
- $download->setVar('summary', $_POST['summary']);
- $download->setVar('description', $_POST['description']);
- $submitter = is_object($xoopsUser) ? (int)$xoopsUser->getVar('uid') : 0;
- $download->setVar('submitter', $submitter);
- $download->setVar('publisher', trim($_POST['publisher']));
- $download->setVar('p...
[truncated message content] |