|
From: <be...@us...> - 2013-10-05 23:01:55
|
Revision: 12138
http://sourceforge.net/p/xoops/svn/12138
Author: beckmi
Date: 2013-10-05 23:01:51 +0000 (Sat, 05 Oct 2013)
Log Message:
-----------
Fixing Admin Form Edit, fixing Modifications Approval
Modified Paths:
--------------
XoopsModules/wfdownloads/trunk/wfdownloads/class/download.php
XoopsModules/wfdownloads/trunk/wfdownloads/class/modification.php
XoopsModules/wfdownloads/trunk/wfdownloads/language/english/admin.php
XoopsModules/wfdownloads/trunk/wfdownloads/language/english/main.php
Modified: XoopsModules/wfdownloads/trunk/wfdownloads/class/download.php
===================================================================
--- XoopsModules/wfdownloads/trunk/wfdownloads/class/download.php 2013-10-05 16:44:47 UTC (rev 12137)
+++ XoopsModules/wfdownloads/trunk/wfdownloads/class/download.php 2013-10-05 23:01:51 UTC (rev 12138)
@@ -32,7 +32,7 @@
* @var WfdownloadsCategory
* @access public
*/
- public $_category = null;
+ public $category = null;
/**
* @param int|null $id
@@ -40,7 +40,7 @@
public function __construct($id = null)
{
$this->wfdownloads = WfdownloadsWfdownloads::getInstance();
- $this->db = XoopsDatabaseFactory::getDatabaseConnection();
+ $this->db = XoopsDatabaseFactory::getDatabaseConnection();
$this->initVar('lid', XOBJ_DTYPE_INT);
$this->initVar('cid', XOBJ_DTYPE_INT, 0);
$this->initVar('title', XOBJ_DTYPE_TXTBOX, '');
@@ -131,88 +131,162 @@
global $xoopsConfig, $xoopsUser, $myts, $xoopsDB;
xoops_load('XoopsUserUtility');
- $download['id'] = $this->getVar('lid');
+ $download['id'] = $this->getVar('lid');
$download['cid'] = $this->getVar('cid');
$use_mirrors = $this->wfdownloads->getConfig('enable_mirrors');
- $add_mirror = false;
- if (!is_object($xoopsUser) && ($this->wfdownloads->getConfig('anonpost') == _WFDOWNLOADS_ANONPOST_MIRROR || $this->wfdownloads->getConfig('anonpost') == _WFDOWNLOADS_ANONPOST_BOTH) && ($this->wfdownloads->getConfig('submissions') == _WFDOWNLOADS_SUBMISSIONS_MIRROR || $this->wfdownloads->getConfig('submissions') == _WFDOWNLOADS_SUBMISSIONS_BOTH) && $use_mirrors == true) {
+ $add_mirror = false;
+ if (!is_object($xoopsUser)
+ && ($this->wfdownloads->getConfig('anonpost') == _WFDOWNLOADS_ANONPOST_MIRROR
+ || $this->wfdownloads->getConfig('anonpost') == _WFDOWNLOADS_ANONPOST_BOTH)
+ && ($this->wfdownloads->getConfig('submissions') == _WFDOWNLOADS_SUBMISSIONS_MIRROR
+ || $this->wfdownloads->getConfig('submissions') == _WFDOWNLOADS_SUBMISSIONS_BOTH)
+ && $use_mirrors == true
+ ) {
$add_mirror = true;
- } elseif (is_object($xoopsUser) && ($this->wfdownloads->getConfig('submissions') == _WFDOWNLOADS_SUBMISSIONS_MIRROR || $this->wfdownloads->getConfig('submissions') == _WFDOWNLOADS_SUBMISSIONS_BOTH || wfdownloads_userIsAdmin()) && $use_mirrors == true) {
+ } elseif (is_object($xoopsUser)
+ && ($this->wfdownloads->getConfig('submissions') == _WFDOWNLOADS_SUBMISSIONS_MIRROR
+ || $this->wfdownloads->getConfig('submissions') == _WFDOWNLOADS_SUBMISSIONS_BOTH
+ || wfdownloads_userIsAdmin())
+ && $use_mirrors == true
+ ) {
$add_mirror = true;
}
- $download['add_mirror'] = $add_mirror;
+ $download['add_mirror'] = $add_mirror;
$download['use_mirrors'] = $use_mirrors;
- $use_reviews = $this->wfdownloads->getConfig('enable_reviews');
+ $use_reviews = $this->wfdownloads->getConfig('enable_reviews');
$download['use_reviews'] = $use_reviews;
$use_ratings = $this->wfdownloads->getConfig('enable_ratings');
- $download['rateimg'] = "rate" . round(number_format($this->getVar('rating'), 0) / 2) . ".gif"; // this definition is not removed for compatibility issues
+ $download['rateimg']
+ =
+ "rate" . round(number_format($this->getVar('rating'), 0) / 2) . ".gif"; // this definition is not removed for compatibility issues
$download['average_rating'] = $this->getVar('rating'); // new
- $download['votes'] = ($this->getVar('votes') == 1) ? _MD_WFDOWNLOADS_ONEVOTE : sprintf(_MD_WFDOWNLOADS_NUMVOTES, $this->getVar('votes'));
- $download['hits'] = $this->getVar('hits');
- $download['use_ratings'] = $use_ratings;
+ $download['votes'] = ($this->getVar('votes') == 1)
+ ? _MD_WFDOWNLOADS_ONEVOTE
+ : sprintf(
+ _MD_WFDOWNLOADS_NUMVOTES,
+ $this->getVar('votes')
+ );
+ $download['hits'] = $this->getVar('hits');
+ $download['use_ratings'] = $use_ratings;
$download['path'] = $this->wfdownloads->getHandler('category')->getNicePath($download['cid']);
$download['imageheader'] = wfdownloads_headerImage();
- $download['title'] = trim($this->getVar('title'));
- $download['url'] = $this->getVar('url');
+ $download['title'] = trim($this->getVar('title'));
+ $download['url'] = $this->getVar('url');
$download['filename'] = $this->getVar('filename');
$download['filetype'] = $this->getVar('filetype');
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'));
+ $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'));
+ $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'));
+ $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'));
+ $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'));
}
}
}
- $download['homepage'] = (!$this->getVar('homepage') || $this->getVar('homepage') == "http://") ? '' : $myts->htmlSpecialChars(trim($this->getVar('homepage')));
- $homepagetitle = $this->getVar('homepagetitle');
+ $download['homepage'] = (!$this->getVar('homepage') || $this->getVar('homepage') == "http://")
+ ? ''
+ : $myts->htmlSpecialChars(
+ trim($this->getVar('homepage'))
+ );
+ $homepagetitle = $this->getVar('homepagetitle');
if ($download['homepage'] && !empty($download['homepage'])) {
$download['homepagetitle'] = ($homepagetitle != "") ? trim($download['homepage']) : trim($homepagetitle);
- $download['homepage'] = "<a href='" . $download['homepage'] . "' target='_blank'>" . $homepagetitle . "</a>";
+ $download['homepage'] = "<a href='" . $download['homepage'] . "' target='_blank'>" . $homepagetitle . "</a>";
} else {
$download['homepage'] = '';
}
@@ -225,7 +299,7 @@
}
}
$download['comments'] = $this->getVar('comments');
- $version = $this->getVar('version');
+ $version = $this->getVar('version');
if ($version != 0) {
$download['version'] = $this->getVar('version');
} else {
@@ -233,23 +307,23 @@
}
$download['downtime'] = wfdownloads_getDownloadTime($this->getVar('size'), 1, 1, 1, 1, 0);
$download['downtime'] = str_replace('|', '<br />', $download['downtime']);
- $download['size'] = wfdownloads_bytesToSize1024($this->getVar('size'));
+ $download['size'] = wfdownloads_bytesToSize1024($this->getVar('size'));
- $time = ($this->getVar('updated') != 0) ? $this->getVar('updated') : $this->getVar('published');
- $download['updated'] = formatTimestamp($time, $this->wfdownloads->getConfig('dateformat'));
+ $time = ($this->getVar('updated') != 0) ? $this->getVar('updated') : $this->getVar('published');
+ $download['updated'] = formatTimestamp($time, $this->wfdownloads->getConfig('dateformat'));
$download['lang_subdate'] = ($this->getVar('updated') != 0) ? _MD_WFDOWNLOADS_UPDATEDON : _MD_WFDOWNLOADS_SUBMITDATE;
$summary = $this->getVar('summary');
- if (
- ($this->wfdownloads->getConfig('autosummary') == _WFDOWNLOADS_AUTOSUMMARY_YES) ||
- ($this->wfdownloads->getConfig('autosummary') == _WFDOWNLOADS_AUTOSUMMARY_IFBLANK && empty($summary))) {
+ if (($this->wfdownloads->getConfig('autosummary') == _WFDOWNLOADS_AUTOSUMMARY_YES)
+ || ($this->wfdownloads->getConfig('autosummary') == _WFDOWNLOADS_AUTOSUMMARY_IFBLANK && empty($summary))
+ ) {
// generate autosummary
- $maxSummaryLength = (int) $this->wfdownloads->getConfig('autosumlength');
+ $maxSummaryLength = (int)$this->wfdownloads->getConfig('autosumlength');
if (wfdownloads_checkModule('xlanguage')) {
global $xlanguage;
- include_once(XOOPS_ROOT_PATH.'/modules/xlanguage/include/vars.php');
- include_once(XOOPS_ROOT_PATH.'/modules/xlanguage/include/functions.php');
+ include_once(XOOPS_ROOT_PATH . '/modules/xlanguage/include/vars.php');
+ include_once(XOOPS_ROOT_PATH . '/modules/xlanguage/include/functions.php');
$download['summary'] = xlanguage_ml($this->getVar('description'));
} else {
$download['summary'] = $this->getVar('description');
@@ -263,25 +337,37 @@
$download['summary'] = $summary;
}
- $download['description'] = $this->getVar('description'); //no html
- $download['price'] = ($this->getVar('price') != 0) ? $this->getVar('price') : _MD_WFDOWNLOADS_PRICEFREE;
- $limitationsArray = $this->wfdownloads->getConfig('limitations');
- $download['limitations'] = ($this->getVar('limitations') == '') ? _MD_WFDOWNLOADS_NOTSPECIFIED : $myts->htmlSpecialChars(trim($limitationsArray[$this->getVar('limitations')]));
- $versiontypesArray = $this->wfdownloads->getConfig('versiontypes');
- $download['versiontypes'] = ($this->getVar('versionypes') == '') ? _MD_WFDOWNLOADS_NOTSPECIFIED : $myts->htmlSpecialChars(trim($versiontypesArray[$this->getVar('versiontypes')]));
- $licenseArray = $this->wfdownloads->getConfig('license');
- $download['license'] = ($this->getVar('license') == '') ? _MD_WFDOWNLOADS_NOTSPECIFIED : $myts->htmlSpecialChars(trim($licenseArray[$this->getVar('license')]));
- $download['submitter'] = XoopsUserUtility::getUnameFromId($this->getVar('submitter'));
- $publisher = $this->getVar('publisher');
+ $download['description'] = $this->getVar('description'); //no html
+ $download['price'] = ($this->getVar('price') != 0) ? $this->getVar('price') : _MD_WFDOWNLOADS_PRICEFREE;
+ $limitationsArray = $this->wfdownloads->getConfig('limitations');
+ $download['limitations'] = ($this->getVar('limitations') == '')
+ ? _MD_WFDOWNLOADS_NOTSPECIFIED
+ : $myts->htmlSpecialChars(
+ trim($limitationsArray[$this->getVar('limitations')])
+ );
+ $versiontypesArray = $this->wfdownloads->getConfig('versiontypes');
+ $download['versiontypes'] = ($this->getVar('versionypes') == '')
+ ? _MD_WFDOWNLOADS_NOTSPECIFIED
+ : $myts->htmlSpecialChars(
+ trim($versiontypesArray[$this->getVar('versiontypes')])
+ );
+ $licenseArray = $this->wfdownloads->getConfig('license');
+ $download['license'] = ($this->getVar('license') == '')
+ ? _MD_WFDOWNLOADS_NOTSPECIFIED
+ : $myts->htmlSpecialChars(
+ trim($licenseArray[$this->getVar('license')])
+ );
+ $download['submitter'] = XoopsUserUtility::getUnameFromId($this->getVar('submitter'));
+ $publisher = $this->getVar('publisher');
if (!empty($publisher)) {
$download['publisher'] = $publisher;
} else {
$download['publisher'] = '';
}
- $platformArray = $this->wfdownloads->getConfig('platform');
+ $platformArray = $this->wfdownloads->getConfig('platform');
$download['platform'] = $myts->htmlSpecialChars($platformArray[$this->getVar('platform')]);
- $history = $this->getVar('dhistory', 'n');
- $download['history'] = $myts->displayTarea($history, true);
+ $history = $this->getVar('dhistory', 'n');
+ $download['history'] = $myts->displayTarea($history, true);
$download['features'] = '';
if ($this->getVar('features')) {
$downloadfeatures = explode('|', trim($this->getVar('features')));
@@ -298,23 +384,29 @@
}
}
$download['mail_subject'] = rawurlencode(sprintf(_MD_WFDOWNLOADS_INTFILEFOUND, $xoopsConfig['sitename']));
- $download['mail_body'] = rawurlencode(sprintf(_MD_WFDOWNLOADS_INTFILEFOUND, $xoopsConfig['sitename']) . ': ' . WFDOWNLOADS_URL . '/singlefile.php?cid=' . $download['cid'] . '&lid=' . $download['id']);
+ $download['mail_body'] = rawurlencode(
+ sprintf(_MD_WFDOWNLOADS_INTFILEFOUND, $xoopsConfig['sitename']) . ': ' . WFDOWNLOADS_URL . '/singlefile.php?cid=' . $download['cid']
+ . '&lid=' . $download['id']
+ );
$download['isadmin'] = (wfdownloads_userIsAdmin()) ? true : false;
$download['adminlink'] = '';
if ($download['isadmin'] == true) {
- $download['adminlink'] = '[<a href="' . WFDOWNLOADS_URL . '/admin/downloads.php?op=download.edit&lid=' . $download['id'] . '">' . _MD_WFDOWNLOADS_EDIT . '</a> | ';
- $download['adminlink'] .= '<a href="' . WFDOWNLOADS_URL . '/admin/downloads.php?op=download.delete&lid=' . $download['id'] . '">' . _MD_WFDOWNLOADS_DELETE . '</a>]';
+ $download['adminlink']
+ = '[<a href="' . WFDOWNLOADS_URL . '/admin/downloads.php?op=download.edit&lid=' . $download['id'] . '">' . _MD_WFDOWNLOADS_EDIT
+ . '</a> | ';
+ $download['adminlink'] .= '<a href="' . WFDOWNLOADS_URL . '/admin/downloads.php?op=download.delete&lid=' . $download['id'] . '">'
+ . _MD_WFDOWNLOADS_DELETE . '</a>]';
}
- $votestring = ($this->getVar('votes') == 1) ? _MD_WFDOWNLOADS_ONEVOTE : sprintf(_MD_WFDOWNLOADS_NUMVOTES, $this->getVar('votes'));
+ $votestring = ($this->getVar('votes') == 1) ? _MD_WFDOWNLOADS_ONEVOTE : sprintf(_MD_WFDOWNLOADS_NUMVOTES, $this->getVar('votes'));
$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;
}
- $sql2 = "SELECT rated FROM " . $xoopsDB->prefix('wfdownloads_reviews') . " WHERE lid = '" . intval($download['id']) . "' AND submit = '1'";
+ $sql2 = "SELECT rated FROM " . $xoopsDB->prefix('wfdownloads_reviews') . " WHERE lid = '" . intval($download['id']) . "' AND submit = '1'";
$results = $xoopsDB->query($sql2);
$numrows = $xoopsDB->getRowsNum($results);
@@ -324,13 +416,15 @@
while ($review_text = $xoopsDB->fetchArray($results)) {
$totalReviewsRating += $review_text['rated'];
}
- $averageReviewsRating = ($download['reviews_num'] > 0) ? $totalReviewsRating / $download['reviews_num'] : 0;
+ $averageReviewsRating = ($download['reviews_num'] > 0) ? $totalReviewsRating / $download['reviews_num'] : 0;
$download['review_average_rating'] = $averageReviewsRating; // new
- $download['review_rateimg'] = 'rate' . round(number_format($averageReviewsRating, 0) / 2) . '.gif'; // this definition is not removed for compatibility issues
+ $download['review_rateimg']
+ =
+ 'rate' . round(number_format($averageReviewsRating, 0) / 2) . '.gif'; // this definition is not removed for compatibility issues
$download['icons'] = wfdownloads_displayIcons($this->getVar('published'), $this->getVar('status'), $this->getVar('hits'));
- $sql3 = "SELECT downurl FROM " . $xoopsDB->prefix('wfdownloads_mirrors') . " WHERE lid = '" . $download['id'] . "' AND submit = '1'";
+ $sql3 = "SELECT downurl FROM " . $xoopsDB->prefix('wfdownloads_mirrors') . " WHERE lid = '" . $download['id'] . "' AND submit = '1'";
$results3 = $xoopsDB->query($sql3);
$numrows2 = $xoopsDB->getRowsNum($results3);
@@ -340,8 +434,9 @@
}
- function getForm($customArray = array()) { // $custom array added April 22, 2006 by jwe)
- {
+ function getForm($customArray = array())
+ { // $custom array added April 22, 2006 by jwe)
+
global $xoopsUser;
include XOOPS_ROOT_PATH . '/class/xoopsformloader.php';
@@ -360,17 +455,28 @@
$sform->addElement(new XoopsFormHidden('filename', $this->getVar('filename', 'e')));
$sform->addElement(new XoopsFormHidden('filetype', $this->getVar('filetype', 'e')));
}
- if (($this->wfdownloads->getConfig('useruploads') && array_intersect($this->wfdownloads->getConfig('useruploadsgroup'), $groups)) || (wfdownloads_userIsAdmin()) ) {
- $userfile_file = new XoopsFormFile(_MD_WFDOWNLOADS_UPLOAD_FILEC, 'userfile', 0);
- $maxFileSize = wfdownloads_bytesToSize1024($this->wfdownloads->getConfig('maxfilesize'));
- if (wfdownloads_userIsAdmin()) {
- $criteria = new Criteria('mime_admin', true);
- } else {
- $criteria = new Criteria('mime_user', true);
- }
- $mimetypes = $this->wfdownloads->getHandler('mimetype')->getList($criteria);
- $allowedExtensions = implode(' | ', $mimetypes);
- $userfile_file->setDescription(sprintf(_MD_WFDOWNLOADS_UPLOAD_FILEC_DESC, $maxFileSize, $this->wfdownloads->getConfig('maximgwidth'), $this->wfdownloads->getConfig('maximgheight'), $allowedExtensions, substr($allowedExtensions, 0, 40) . '...'));
+ if (($this->wfdownloads->getConfig('useruploads') && array_intersect($this->wfdownloads->getConfig('useruploadsgroup'), $groups))
+ || (wfdownloads_userIsAdmin())
+ ) {
+ $userfile_file = new XoopsFormFile(_MD_WFDOWNLOADS_UPLOAD_FILEC, 'userfile', 0);
+ $maxFileSize = wfdownloads_bytesToSize1024($this->wfdownloads->getConfig('maxfilesize'));
+ if (wfdownloads_userIsAdmin()) {
+ $criteria = new Criteria('mime_admin', true);
+ } else {
+ $criteria = new Criteria('mime_user', true);
+ }
+ $mimetypes = $this->wfdownloads->getHandler('mimetype')->getList($criteria);
+ $allowedExtensions = implode(' | ', $mimetypes);
+ $userfile_file->setDescription(
+ sprintf(
+ _MD_WFDOWNLOADS_UPLOAD_FILEC_DESC,
+ $maxFileSize,
+ $this->wfdownloads->getConfig('maximgwidth'),
+ $this->wfdownloads->getConfig('maximgheight'),
+ $allowedExtensions,
+ substr($allowedExtensions, 0, 40) . '...'
+ )
+ );
$sform->addElement($userfile_file, false);
}
if ($use_mirrors !== true) {
@@ -381,140 +487,178 @@
if (wfdownloads_checkModule('formulize')) {
$sform->addElement(new XoopsFormHidden('cid', $this->getVar('cid', 'e')));
} else {
- $categories = $this->wfdownloads->getHandler('category')->getUserUpCategories();
+ $categories = $this->wfdownloads->getHandler('category')->getUserUpCategories();
$categoriesTree = new XoopsObjectTree($categories, 'cid', 'pid');
- $sform->addElement(new XoopsFormLabel(_MD_WFDOWNLOADS_CATEGORYC, $categoriesTree->makeSelBox('cid', 'title', "-", $this->getVar('cid', 'e'))));
+ $sform->addElement(
+ new XoopsFormLabel(_MD_WFDOWNLOADS_CATEGORYC, $categoriesTree->makeSelBox('cid', 'title', "-", $this->getVar('cid', 'e')))
+ );
}
// changed - end - March 4 2006 - jpc
- // Changed - start - April 22, 2006 - jwe
- if (count($customArray) == 0) {
- $sform->addElement(new XoopsFormText(_MD_WFDOWNLOADS_HOMEPAGETITLEC, 'homepagetitle', 50, 255, $this->getVar('homepagetitle', 'e')), false);
- $sform->addElement(new XoopsFormText(_MD_WFDOWNLOADS_HOMEPAGEC, 'homepage', 50, 255, $this->getVar('homepage', 'e')), false);
- $sform->addElement(new XoopsFormText(_MD_WFDOWNLOADS_VERSIONC, 'version', 10, 20, $this->getVar('version', 'e')), false);
- $sform->addElement(new XoopsFormText(_MD_WFDOWNLOADS_PUBLISHERC, 'publisher', 50, 255, $this->getVar('publisher', 'e')), false);
- $sform->addElement(new XoopsFormText(_MD_WFDOWNLOADS_FILESIZEC, 'size', 10, 20, $this->getVar('size', 'e')), false);
+ // Changed - start - April 22, 2006 - jwe
+ if (count($customArray) == 0) {
+ $sform->addElement(
+ new XoopsFormText(_MD_WFDOWNLOADS_HOMEPAGETITLEC, 'homepagetitle', 50, 255, $this->getVar('homepagetitle', 'e')),
+ false
+ );
+ $sform->addElement(new XoopsFormText(_MD_WFDOWNLOADS_HOMEPAGEC, 'homepage', 50, 255, $this->getVar('homepage', 'e')), false);
+ $sform->addElement(new XoopsFormText(_MD_WFDOWNLOADS_VERSIONC, 'version', 10, 20, $this->getVar('version', 'e')), false);
+ $sform->addElement(new XoopsFormText(_MD_WFDOWNLOADS_PUBLISHERC, 'publisher', 50, 255, $this->getVar('publisher', 'e')), false);
+ $sform->addElement(new XoopsFormText(_MD_WFDOWNLOADS_FILESIZEC, 'size', 10, 20, $this->getVar('size', 'e')), false);
- $platform_array = $this->wfdownloads->getConfig('platform');
+ $platform_array = $this->wfdownloads->getConfig('platform');
$platform_select = new XoopsFormSelect(_MD_WFDOWNLOADS_PLATFORMC, 'platform', $this->getVar('platform', 'e'));
$platform_select->addOptionArray($platform_array);
- $sform->addElement($platform_select);
+ $sform->addElement($platform_select);
- $license_array = $this->wfdownloads->getConfig('license');
+ $license_array = $this->wfdownloads->getConfig('license');
$license_select = new XoopsFormSelect(_MD_WFDOWNLOADS_LICENCEC, 'license', $this->getVar('license', 'e'));
$license_select->addOptionArray($license_array);
- $sform->addElement($license_select);
+ $sform->addElement($license_select);
- $limitations_array = $this->wfdownloads->getConfig('limitations');
+ $limitations_array = $this->wfdownloads->getConfig('limitations');
$limitations_select = new XoopsFormSelect(_MD_WFDOWNLOADS_LIMITATIONS, 'limitations', $this->getVar('limitations', 'e'));
$limitations_select->addOptionArray($limitations_array);
- $sform->addElement($limitations_select);
+ $sform->addElement($limitations_select);
- $versiontypes_array = $this->wfdownloads->getConfig('versiontypes');
+ $versiontypes_array = $this->wfdownloads->getConfig('versiontypes');
$versiontypes_select = new XoopsFormSelect(_MD_WFDOWNLOADS_VERSIONTYPES, 'versiontypes', $this->getVar('versiontypes', 'e'));
$versiontypes_select->addOptionArray($versiontypes_array);
- $sform->addElement($versiontypes_select);
+ $sform->addElement($versiontypes_select);
- $sform->addElement(new XoopsFormText(_MD_WFDOWNLOADS_PRICEC, 'price', 10, 20, $this->getVar('price', 'e')), false);
-/*
- if ($this->wfdownloads->getConfig('autosummary') == true) {
- $summary_dhtmltextarea = new XoopsFormDhtmlTextArea(_MD_WFDOWNLOADS_SUMMARY, 'summary', $this->getVar('summary', 'e'), 10, 60, 'smartHiddenSummary');
- $summary_dhtmltextarea->setDescription(_MD_WFDOWNLOADS_SUMMARY_DESC_AUTOSUMMARY_ON);
- $summary_dhtmltextarea->setExtra('disabled', 'disabled');
- $sform->addElement($summary_dhtmltextarea, false);
- } else {
- $summary_dhtmltextarea = new XoopsFormDhtmlTextArea(_MD_WFDOWNLOADS_SUMMARY, 'summary', $this->getVar('summary', 'e'), 10, 60, 'smartHiddenSummary');
- $summary_dhtmltextarea->setDescription(_MD_WFDOWNLOADS_SUMMARY_DESC_AUTOSUMMARY_OFF);
- $sform->addElement($summary_dhtmltextarea, false);
- }
-*/
- switch ($this->wfdownloads->getConfig('autosummary')) {
- case _WFDOWNLOADS_AUTOSUMMARY_YES :
- $summary_dhtmltextarea = new XoopsFormDhtmlTextArea(_MD_WFDOWNLOADS_SUMMARY, 'summary', $this->getVar('summary', 'e'), 10, 60, 'smartHiddenSummary');
+ $sform->addElement(new XoopsFormText(_MD_WFDOWNLOADS_PRICEC, 'price', 10, 20, $this->getVar('price', 'e')), false);
+ /*
+ if ($this->wfdownloads->getConfig('autosummary') == true) {
+ $summary_dhtmltextarea = new XoopsFormDhtmlTextArea(_MD_WFDOWNLOADS_SUMMARY, 'summary', $this->getVar('summary', 'e'), 10, 60, 'smartHiddenSummary');
+ $summary_dhtmltextarea->setDescription(_MD_WFDOWNLOADS_SUMMARY_DESC_AUTOSUMMARY_ON);
+ $summary_dhtmltextarea->setExtra('disabled', 'disabled');
+ $sform->addElement($summary_dhtmltextarea, false);
+ } else {
+ $summary_dhtmltextarea = new XoopsFormDhtmlTextArea(_MD_WFDOWNLOADS_SUMMARY, 'summary', $this->getVar('summary', 'e'), 10, 60, 'smartHiddenSummary');
+ $summary_dhtmltextarea->setDescription(_MD_WFDOWNLOADS_SUMMARY_DESC_AUTOSUMMARY_OFF);
+ $sform->addElement($summary_dhtmltextarea, false);
+ }
+ */
+ switch ($this->wfdownloads->getConfig('autosummary')) {
+ case _WFDOWNLOADS_AUTOSUMMARY_YES :
+ $summary_dhtmltextarea = new XoopsFormDhtmlTextArea(_MD_WFDOWNLOADS_SUMMARY, 'summary', $this->getVar(
+ 'summary',
+ 'e'
+ ), 10, 60, 'smartHiddenSummary');
$summary_dhtmltextarea->setDescription(_MD_WFDOWNLOADS_SUMMARY_DESC_AUTOSUMMARY_YES);
$summary_dhtmltextarea->setExtra('disabled', 'disabled');
- $sform->addElement($summary_dhtmltextarea, false);
- break;
- case _WFDOWNLOADS_AUTOSUMMARY_IFBLANK :
- $summary_dhtmltextarea = new XoopsFormDhtmlTextArea(_MD_WFDOWNLOADS_SUMMARY, 'summary', $this->getVar('summary', 'e'), 10, 60, 'smartHiddenSummary');
+ $sform->addElement($summary_dhtmltextarea, false);
+ break;
+ case _WFDOWNLOADS_AUTOSUMMARY_IFBLANK :
+ $summary_dhtmltextarea = new XoopsFormDhtmlTextArea(_MD_WFDOWNLOADS_SUMMARY, 'summary', $this->getVar(
+ 'summary',
+ 'e'
+ ), 10, 60, 'smartHiddenSummary');
$summary_dhtmltextarea->setDescription(_MD_WFDOWNLOADS_SUMMARY_DESC_AUTOSUMMARY_IFBLANK);
- $sform->addElement($summary_dhtmltextarea, false);
- break;
- default :
- case _WFDOWNLOADS_AUTOSUMMARY_NO :
- $summary_dhtmltextarea = new XoopsFormDhtmlTextArea(_MD_WFDOWNLOADS_SUMMARY, 'summary', $this->getVar('summary', 'e'), 10, 60, 'smartHiddenSummary');
+ $sform->addElement($summary_dhtmltextarea, false);
+ break;
+ default :
+ case _WFDOWNLOADS_AUTOSUMMARY_NO :
+ $summary_dhtmltextarea = new XoopsFormDhtmlTextArea(_MD_WFDOWNLOADS_SUMMARY, 'summary', $this->getVar(
+ 'summary',
+ 'e'
+ ), 10, 60, 'smartHiddenSummary');
$summary_dhtmltextarea->setDescription(_MD_WFDOWNLOADS_SUMMARY_DESC_AUTOSUMMARY_NO);
- $sform->addElement($summary_dhtmltextarea, false);
- break;
- }
+ $sform->addElement($summary_dhtmltextarea, false);
+ break;
+ }
- $description_dhtmltextarea = new XoopsFormDhtmlTextArea(_MD_WFDOWNLOADS_DESCRIPTION, 'description', $this->getVar('description', 'e'), 15, 60, 'smartHiddenDescription');
+ $description_dhtmltextarea = new XoopsFormDhtmlTextArea(_MD_WFDOWNLOADS_DESCRIPTION, 'description', $this->getVar(
+ 'description',
+ 'e'
+ ), 15, 60, 'smartHiddenDescription');
$description_dhtmltextarea->setDescription(_MD_WFDOWNLOADS_DESCRIPTION_DESC);
- $sform->addElement($description_dhtmltextarea, true);
+ $sform->addElement($description_dhtmltextarea, true);
$features_textarea = new XoopsFormTextArea(_MD_WFDOWNLOADS_KEYFEATURESC, 'features', $this->getVar('features', 'e'), 7, 60);
$features_textarea->setDescription(_MD_WFDOWNLOADS_KEYFEATURESC_DESC);
- $sform->addElement($features_textarea, false);
- $requirements_textarea = new XoopsFormTextArea(_MD_WFDOWNLOADS_REQUIREMENTSC, 'requirements', $this->getVar('requirements', 'e'), 7, 60);
+ $sform->addElement($features_textarea, false);
+ $requirements_textarea = new XoopsFormTextArea(_MD_WFDOWNLOADS_REQUIREMENTSC, 'requirements', $this->getVar(
+ 'requirements',
+ 'e'
+ ), 7, 60);
$requirements_textarea->setDescription(_MD_WFDOWNLOADS_REQUIREMENTSC_DESC);
- $sform->addElement($requirements_textarea, false);
- } else {
- // if we are using a custom form, then add in the form's elements here
- $sform->addElement(new XoopsFormDhtmlTextArea(_MD_WFDOWNLOADS_DESCRIPTION, 'description', $this->getVar('description', 'e'), 15, 60, 'smartHiddenDescription'), true);
- $sform->addElement(new XoopsFormHidden('size', $this->getVar('size', 'e')));
- $sform = compileElements($customArray['fid'], $sform, $customArray['formulize_mgr'], $customArray['prevEntry'], $customArray['entry'], $customArray['go_back'], $customArray['parentLinks'], $customArray['owner_groups'], $customArray['groups']);
- }
- // Changed - end - April 22, 2006 - jwe
+ $sform->addElement($requirements_textarea, false);
+ } else {
+ // if we are using a custom form, then add in the form's elements here
+ $sform->addElement(
+ new XoopsFormDhtmlTextArea(_MD_WFDOWNLOADS_DESCRIPTION, 'description', $this->getVar(
+ 'description',
+ 'e'
+ ), 15, 60, 'smartHiddenDescription'),
+ true
+ );
+ $sform->addElement(new XoopsFormHidden('size', $this->getVar('size', 'e')));
+ $sform = compileElements(
+ $customArray['fid'],
+ $sform,
+ $customArray['formulize_mgr'],
+ $customArray['prevEntry'],
+ $customArray['entry'],
+ $customArray['go_back'],
+ $customArray['parentLinks'],
+ $customArray['owner_groups'],
+ $customArray['groups']
+ );
+ }
+ // Changed - end - April 22, 2006 - jwe
$sform->addElement(new XoopsFormTextArea(_MD_WFDOWNLOADS_HISTORYC, 'dhistory', $this->getVar('dhistory', 'e'), 7, 60), false);
if (!$this->isNew() && $this->getVar('dhistory', 'n') != "") {
- $dhistoryaddedd_textarea = new XoopsFormTextArea(_MD_WFDOWNLOADS_HISTORYD, 'dhistoryaddedd', '', 7, 60);
- $dhistoryaddedd_textarea->setDescription(_MD_WFDOWNLOADS_HISTORYD_DESC);
+ $dhistoryaddedd_textarea = new XoopsFormTextArea(_MD_WFDOWNLOADS_HISTORYD, 'dhistoryaddedd', '', 7, 60);
+ $dhistoryaddedd_textarea->setDescription(_MD_WFDOWNLOADS_HISTORYD_DESC);
$sform->addElement($dhistoryaddedd_textarea, false);
}
- if (($this->wfdownloads->getConfig('useruploads') && array_intersect($this->wfdownloads->getConfig('useruploadsgroup'), $groups)) || wfdownloads_userIsAdmin() ) {
+ if (($this->wfdownloads->getConfig('useruploads') && array_intersect($this->wfdownloads->getConfig('useruploadsgroup'), $groups))
+ || wfdownloads_userIsAdmin()
+ ) {
$sform->addElement(new XoopsFormFile(_MD_WFDOWNLOADS_DUPLOADSCRSHOT, 'screenshot', 0), false);
if ($this->wfdownloads->getConfig('max_screenshot') >= 2) {
$sform->addElement(new XoopsFormFile(_MD_WFDOWNLOADS_DUPLOADSCRSHOT, 'screenshot2', 0), false);
}
if ($this->wfdownloads->getConfig('max_screenshot') >= 3) {
- $sform->addElement(new XoopsFormFile(_MD_WFDOWNLOADS_DUPLOADSCRSHOT, 'screenshot3', 0), false);
+ $sform->addElement(new XoopsFormFile(_MD_WFDOWNLOADS_DUPLOADSCRSHOT, 'screenshot3', 0), false);
}
if ($this->wfdownloads->getConfig('max_screenshot') >= 4) {
- $sform->addElement(new XoopsFormFile(_MD_WFDOWNLOADS_DUPLOADSCRSHOT, 'screenshot4', 0), false);
+ $sform->addElement(new XoopsFormFile(_MD_WFDOWNLOADS_DUPLOADSCRSHOT, 'screenshot4', 0), false);
}
}
- $option_tray = new XoopsFormElementTray(_MD_WFDOWNLOADS_OPTIONS, '<br />');
- $notify_checkbox = new XoopsFormCheckBox('', 'notifypub');
- $notify_checkbox->addOption(1, _MD_WFDOWNLOADS_NOTIFYAPPROVE);
- $option_tray->addElement($notify_checkbox);
+ $option_tray = new XoopsFormElementTray(_MD_WFDOWNLOADS_OPTIONS, '<br />');
+ $notify_checkbox = new XoopsFormCheckBox('', 'notifypub');
+ $notify_checkbox->addOption(1, _MD_WFDOWNLOADS_NOTIFYAPPROVE);
+ $option_tray->addElement($notify_checkbox);
$sform->addElement($option_tray);
// button tray
- $button_tray = new XoopsFormElementTray('', '');
- if ($this->isNew()) {
- $button_tray->addElement(new XoopsFormHidden('op', 'download.save'));
- $button_submit = new XoopsFormButton('', '', _SUBMIT, '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('', '', _SUBMIT, '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);
+ $button_tray = new XoopsFormElementTray('', '');
+ if ($this->isNew()) {
+ $button_tray->addElement(new XoopsFormHidden('op', 'download.save'));
+ $button_submit = new XoopsFormButton('', '', _SUBMIT, '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('', '', _SUBMIT, '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;
}
-
- function getAdminForm($title, $customArray=array()) { // $custom array added April 22, 2006 by jwe
+ function getAdminForm($title, $customArray = array())
+ { // $custom array added April 22, 2006 by jwe
global $xoopsUser;
include_once XOOPS_ROOT_PATH . '/class/xoopsformloader.php';
@@ -525,24 +669,27 @@
$sform = new XoopsThemeForm($title, "storyform", $_SERVER['REQUEST_URI']);
$sform->setExtra('enctype="multipart/form-data"');
if (!$this->isNew()) {
- $sform -> addElement(new XoopsFormLabel(_AM_WFDOWNLOADS_FILE_ID, (int) $this->getVar('lid')));
+ $sform->addElement(new XoopsFormLabel(_AM_WFDOWNLOADS_FILE_ID, (int)$this->getVar('lid')));
}
if ($this->getVar('ipaddress') != "") {
$sform->addElement(new XoopsFormLabel(_AM_WFDOWNLOADS_FILE_IP, $this->getVar('ipaddress')));
}
- $titles_tray = new XoopsFormElementTray(_AM_WFDOWNLOADS_FILE_TITLE, '<br />');
- $titles = new XoopsFormText('', 'title', 50, 255, $this->getVar('title', 'e'));
- $titles_tray -> addElement($titles);
- $titles_checkbox = new XoopsFormCheckBox('', 'title_checkbox', 0);
- $titles_checkbox -> addOption(1, _AM_WFDOWNLOADS_FILE_USE_UPLOAD_TITLE);
- $titles_tray -> addElement($titles_checkbox);
+ $titles_tray = new XoopsFormElementTray(_AM_WFDOWNLOADS_FILE_TITLE, '<br />');
+ $titles = new XoopsFormText('', 'title', 50, 255, $this->getVar('title', 'e'));
+ $titles_tray->addElement($titles);
+ $titles_checkbox = new XoopsFormCheckBox('', 'title_checkbox', 0);
+ $titles_checkbox->addOption(1, _AM_WFDOWNLOADS_FILE_USE_UPLOAD_TITLE);
+ $titles_tray->addElement($titles_checkbox);
$sform->addElement($titles_tray);
if (!$this->isNew()) {
//$sform -> addElement(new XoopsFormText(_AM_WFDOWNLOADS_FILE_SUBMITTERID, 'submitter', 10, 10, $this->getVar('submitter', 'e')), true);
- $submitter_select = new XoopsFormSelectUser (_AM_WFDOWNLOADS_FILE_SUBMITTER, 'submitter', false, $this->getVar('submitter', 'e'), 1, false);
- $submitter_select->setDescription(_AM_WFDOWNLOADS_FILE_SUBMITTER_DESC);
+ $submitter_select = new XoopsFormSelectUser (_AM_WFDOWNLOADS_FILE_SUBMITTER, 'submitter', false, $this->getVar(
+ 'submitter',
+ 'e'
+ ), 1, false);
+ $submitter_select->setDescription(_AM_WFDOWNLOADS_FILE_SUBMITTER_DESC);
$sform->addElement($submitter_select);
} else {
$sform->addElement(new XoopsFormHidden('submitter', $xoopsUser->getVar('uid', 'e')));
@@ -550,247 +697,339 @@
$sform->addElement(new XoopsFormText(_AM_WFDOWNLOADS_FILE_DLURL, 'url', 50, 255, $this->getVar('url', 'e')), false);
$sform->addElement(new XoopsFormText(_AM_WFDOWNLOADS_FILE_FILENAME, 'filename', 50, 255, $this->getVar('filename', 'e')), false);
-/*
- $filename_tray = new XoopsFormElementTray(_AM_WFDOWNLOADS_FILE_FILENAME);
- $filename_tray->addElement(new XoopsFormLabel($this->getVar('filename')));
- $filename_tray->addElement(new XoopsFormHidden("filename", $this->getVar('filename', 'e')));
- $sform->addElement($filename_tray, false);
-*/
+ /*
+ $filename_tray = new XoopsFormElementTray(_AM_WFDOWNLOADS_FILE_FILENAME);
+ $filename_tray->addElement(new XoopsFormLabel($this->getVar('filename')));
+ $filename_tray->addElement(new XoopsFormHidden("filename", $this->getVar('filename', 'e')));
+ $sform->addElement($filename_tray, false);
+ */
$sform->addElement(new XoopsFormText(_AM_WFDOWNLOADS_FILE_FILETYPE, 'filetype', 50, 100, $this->getVar('filetype', 'e')), false);
if ($use_mirrors !== true) {
$sform->addElement(new XoopsFormText(_AM_WFDOWNLOADS_FILE_MIRRORURL, 'mirror', 50, 255, $this->getVar('mirror', 'e')), false);
}
- $userfile_file = new XoopsFormFile(_MD_WFDOWNLOADS_UPLOAD_FILEC, 'userfile', 0);
- $maxFileSize = wfdownloads_bytesToSize1024($this->wfdownloads->getConfig('maxfilesize'));
- $criteria = new Criteria('mime_admin', true);
- $mimetypes = $this->wfdownloads->getHandler('mimetype')->getList($criteria);
- $allowedExtensions = implode(' | ', $mimetypes);
- $userfile_file->setDescription(sprintf(_MD_WFDOWNLOADS_UPLOAD_FILEC_DESC, $maxFileSize, $this->wfdownloads->getConfig('maximgwidth'), $this->wfdownloads->getConfig('maximgheight'), $allowedExtensions, substr($allowedExtensions, 0, 40) . '...'));
+ $userfile_file = new XoopsFormFile(_MD_WFDOWNLOADS_UPLOAD_FILEC, 'userfile', 0);
+ $maxFileSize = wfdownloads_bytesToSize1024($this->wfdownloads->getConfig('maxfilesize'));
+ $criteria = new Criteria('mime_admin', true);
+ $mimetypes = $this->wfdownloads->getHandler('mimetype')->getList($criteria);
+ $allowedExtensions = implode(' | ', $mimetypes);
+ $userfile_file->setDescription(
+ sprintf(
+ _MD_WFDOWNLOADS_UPLOAD_FILEC_DESC,
+ $maxFileSize,
+ $this->wfdownloads->getConfig('maximgwidth'),
+ $this->wfdownloads->getConfig('maximgheight'),
+ $allowedExtensions,
+ substr($allowedExtensions, 0, 40) . '...'
+ )
+ );
$sform->addElement($userfile_file, false);
// changed - start - March 4 2006 - jpc
// if (file_exists(XOOPS_ROOT_PATH . "/modules/formulize/include/functions.php")) {
// $sform->addElement(new XoopsFormHidden('cid', $this->getVar('cid', 'e')));
// } else {
- $categories = $this->wfdownloads->getHandler('category')->getObjects();
+ $categories = $this->wfdownloads->getHandler('category')->getObjects();
$categoriesTree = new XoopsObjectTree($categories, 'cid', 'pid');
- $sform->addElement(new XoopsFormLabel(_AM_WFDOWNLOADS_FILE_CATEGORY, $categoriesTree->makeSelBox('cid', 'title', '-', $this->getVar('cid', 'e'))));
+ $sform->addElement(
+ new XoopsFormLabel(_AM_WFDOWNLOADS_FILE_CATEGORY, $categoriesTree->makeSelBox('cid', 'title', '-', $this->getVar('cid', 'e')))
+ );
// }
// changed - end - March 4 2006 - jpc
- // changed and added - start - April 22, 2006 - jwe
+ // changed and added - start - April 22, 2006 - jwe
if (count($customArray) == 0) {
- $sform->addElement(new XoopsFormText(_AM_WFDOWNLOADS_FILE_HOMEPAGETITLE, 'homepagetitle', 50, 255, $this->getVar('homepagetitle', 'e')), false);
+ $sform->addElement(
+ new XoopsFormText(_AM_WFDOWNLOADS_FILE_HOMEPAGETITLE, 'homepagetitle', 50, 255, $this->getVar('homepagetitle', 'e')),
+ false
+ );
$sform->addElement(new XoopsFormText(_AM_WFDOWNLOADS_FILE_HOMEPAGE, 'homepage', 50, 255, $this->getVar('homepage', 'e')), false);
$sform->addElement(new XoopsFormText(_AM_WFDOWNLOADS_FILE_VERSION, 'version', 10, 20, $this->getVar('version', 'e')), false);
$sform->addElement(new XoopsFormText(_AM_WFDOWNLOADS_FILE_PUBLISHER, 'publisher', 50, 255, $this->getVar('publisher', 'e')), false);
+
$sform->addElement(new XoopsFormText(_AM_WFDOWNLOADS_FILE_SIZE, 'size', 10, 20, $this->getVar('size', 'e')), false);
- $platform_array = $this->wfdownloads->getConfig('platform');
- $platform_select = new XoopsFormSelect('', 'platform', $this->getVar('platform', 'e'), '', '', 0);
- $platform_select->addOptionArray($platform_array);
- $platform_tray = new XoopsFormElementTray(_AM_WFDOWNLOADS_FILE_PLATFORM, ' ');
- $platform_tray->addElement($platform_select);
+ $platform_array = $this->wfdownloads->getConfig('platform');
+ $platform_select = new XoopsFormSelect('', 'platform', $this->getVar('platform', 'e'), '', '', 0);
+ $platform_select->addOptionArray($platform_array);
+ $platform_tray = new XoopsFormElementTray(_AM_WFDOWNLOADS_FILE_PLATFORM, ' ');
+ $platform_tray->addElement($platform_select);
$sform->addElement($platform_tray);
- $license_array = $this->wfdownloads->getConfig('license');
- $license_select = new XoopsFormSelect('', 'license', $this->getVar('license', 'e'), '', '', 0);
- $license_select->addOptionArray($license_array);
- $license_tray = new XoopsFormElementTray(_AM_WFDOWNLOADS_FILE_LICENCE, ' ');
- $license_tray->addElement($license_select);
+ $license_array = $this->wfdownloads->getConfig('license');
+ $license_select = new XoopsFormSelect('', 'license', $this->getVar('license', 'e'), '', '', 0);
+ $license_select->addOptionArray($license_array);
+ $license_tray = new XoopsFormElementTray(_AM_WFDOWNLOADS_FILE_LICENCE, ' ');
+ $license_tray->addElement($license_select);
$sform->addElement($license_tray);
- $limitations_array = $this->wfdownloads->getConfig('limitations');
- $limitations_select = new XoopsFormSelect('', 'limitations', $this->getVar('limitations', 'e'), '', '', 0);
- $limitations_select->addOptionArray($limitations_array);
- $limitations_tray = new XoopsFormElementTray(_AM_WFDOWNLOADS_FILE_LIMITATIONS, ' ');
- $limitations_tray->addElement($limitations_select);
+ $limitations_array = $this->wfdownloads->getConfig('limitations');
+ $limitations_select = new XoopsFormSelect('', 'limitations', $this->getVar('limitations', 'e'), '', '', 0);
+ $limitations_select->addOptionArray($limitations_array);
+ $limitations_tray = new XoopsFormElementTray(_AM_WFDOWNLOADS_FILE_LIMITATIONS, ' ');
+ $limitations_tray->addElement($limitations_select);
$sform->addElement($limitations_tray);
- $versiontypes_array = $this->wfdownloads->getConfig('versiontypes');
- $versiontypes_select = new XoopsFormSelect('', 'versiontypes', $this->getVar('versiontypes', 'e'), '', '', 0);
- $versiontypes_select->addOptionArray($versiontypes_array);
- $versiontypes_tray = new XoopsFormElementTray(_AM_WFDOWNLOADS_FILE_VERSIONTYPES, ' ');
- $versiontypes_tray->addElement($versiontypes_select);
+ $versiontypes_array = $this->wfdownloads->getConfig('versiontypes');
+ $versiontypes_select = new XoopsFormSelect('', 'versiontypes', $this->getVar('versiontypes', 'e'), '', '', 0);
+ $versiontypes_select->addOptionArray($versiontypes_array);
+ $versiontypes_tray = new XoopsFormElementTray(_AM_WFDOWNLOADS_FILE_VERSIONTYPES, ' ');
+ $versiontypes_tray->addElement($versiontypes_select);
$sform->addElement($versiontypes_tray);
$sform->addElement(new XoopsFormText(_AM_WFDOWNLOADS_FILE_PRICE, 'price', 10, 20, $this->getVar('price', 'e')), false);
- $mode = 'html';
- $summary_tray = new XoopsFormElementTray(_MD_WFDOWNLOADS_SUMMARY, '<br />');
- $options['name'] = 'summary';
- $options['value'] = $this->getVar('summary', 'e');
- $options['rows'] = 10;
- $options['cols'] = '100%';
- $options['width'] = '100%';
- $options['height'] = '200px';
- $options['mode'] = $mode; // for editors that support mode option
- $summary_editor = new XoopsFormEditor('', $this->wfdownloads->getConfig('editor_options'), $options, $nohtml = false, $onfailure = 'textarea');
- $summary_tray->addElement($summary_editor);
-/*
- if ($this->wfdownloads->getConfig('autosummary') == true) {
- $summary_tray->setDescription(_MD_WFDOWNLOADS_SUMMARY_DESC_AUTOSUMMARY_ON);
- } else {
- $summary_tray->setDescription(_MD_WFDOWNLOADS_SUMMARY_DESC_AUTOSUMMARY_OFF);
- }
-*/
- switch ($this->wfdownloads->getConfig('autosummary')) {
- case _WFDOWNLOADS_AUTOSUMMARY_YES :
- $summary_tray->setDescription(_MD_WFDOWNLOADS_SUMMARY_DESC_AUTOSUMMARY_YES);
- break;
- case _WFDOWNLOADS_AUTOSUMMARY_IFBLANK :
- $summary_tray->setDescription(_MD_WFDOWNLOADS_SUMMARY_DESC_AUTOSUMMARY_IFBLANK);
- break;
- default :
- case _WFDOWNLOADS_AUTOSUMMARY_NO :
- $summary_tray->setDescription(_MD_WFDOWNLOADS_SUMMARY_DESC_AUTOSUMMARY_NO);
- break;
- }
- $sform->addElement($summary_tray);
+ $mode = 'html';
+ $summary_tray = new XoopsFormElementTray(_MD_WFDOWNLOADS_SUMMARY, '<br />');
+ $options['name'] = 'summary';
+ $options['value'] = $this->getVar('summary', 'e');
+ $options['rows'] = 10;
+ $options['cols'] = '100%';
+ $options['width'] = '100%';
+ $options['height'] = '200px';
+ $options['mode'] = $mode; // for editors that support mode option
+ $summary_editor = new XoopsFormEditor('', $this->wfdownloads->getConfig('editor_options'), $options, $nohtml = false,
+ $onfailure = 'textarea');
+ $summary_tray->addElement($summary_editor);
+ /*
+ if ($this->wfdownloads->getConfig('autosummary') == true) {
+ $summary_tray->setDescription(_MD_WFDOWNLOADS_SUMMARY_DESC_AUTOSUMMARY_ON);
+ } else {
+ $summary_tray->setDescription(_MD_WFDOWNLOADS_SUMMARY_DESC_AUTOSUMMARY_OFF);
+ }
+ */
+ switch ($this->wfdownloads->getConfig('autosummary')) {
+ case _WFDOWNLOADS_AUTOSUMMARY_YES :
+ $summary_tray->setDescription(_MD_WFDOWNLOADS_SUMMARY_DESC_AUTOSUMMARY_YES);
+ break;
+ case _WFDOWNLOADS_AUTOSUMMARY_IFBLANK :
+ $summary_tray->setDescription(_MD_WFDOWNLOADS_SUMMARY_DESC_AUTOSUMMARY_IFBLANK);
+ break;
+ default :
+ case _WFDOWNLOADS_AUTOSUMMARY_NO :
+ $summary_tray->setDescription(_MD_WFDOWNLOADS_SUMMARY_DESC_AUTOSUMMARY_NO);
+ break;
+ }
+ $sform->addElement($summary_tray);
- $description_tray = new XoopsFormElementTray(_MD_WFDOWNLOADS_DESCRIPTION, '<br />');
- $options['name'] ...
[truncated message content] |