|
From: <luc...@us...> - 2013-09-09 18:28:47
|
Revision: 12015
http://sourceforge.net/p/xoops/svn/12015
Author: luciorota
Date: 2013-09-09 18:28:43 +0000 (Mon, 09 Sep 2013)
Log Message:
-----------
improved autosummary system
Modified Paths:
--------------
XoopsModules/wfdownloads/trunk/wfdownloads/class/download.php
XoopsModules/wfdownloads/trunk/wfdownloads/docs/changelog.txt
XoopsModules/wfdownloads/trunk/wfdownloads/include/functions.php
XoopsModules/wfdownloads/trunk/wfdownloads/language/english/main.php
XoopsModules/wfdownloads/trunk/wfdownloads/language/english/modinfo.php
XoopsModules/wfdownloads/trunk/wfdownloads/xoops_version.php
Modified: XoopsModules/wfdownloads/trunk/wfdownloads/class/download.php
===================================================================
--- XoopsModules/wfdownloads/trunk/wfdownloads/class/download.php 2013-09-09 13:53:12 UTC (rev 12014)
+++ XoopsModules/wfdownloads/trunk/wfdownloads/class/download.php 2013-09-09 18:28:43 UTC (rev 12015)
@@ -125,11 +125,11 @@
function getDownloadInfo() {
- global $xoopsConfig, $xoopsUser, $myts;
+ global $xoopsConfig, $xoopsUser, $myts, $xoopsDB;
xoops_load('XoopsUserUtility');
- $down['id'] = $this->getVar('lid');
- $down['cid'] = $this->getVar('cid');
+ $download['id'] = $this->getVar('lid');
+ $download['cid'] = $this->getVar('cid');
$use_mirrors = $this->wfdownloads->getConfig('enable_mirrors');
$add_mirror = false;
@@ -138,191 +138,188 @@
} elseif (is_object($xoopsUser) && ($this->wfdownloads->getConfig('submissions') == _WFD_SUBMISSIONS_MIRROR || $this->wfdownloads->getConfig('submissions') == _WFD_SUBMISSIONS_BOTH || $xoopsUser->isAdmin()) && $use_mirrors == true) {
$add_mirror = true;
}
- $down['add_mirror'] = $add_mirror;
- $down['use_mirrors'] = $use_mirrors;
+ $download['add_mirror'] = $add_mirror;
+ $download['use_mirrors'] = $use_mirrors;
- $down['rateimg'] = "rate" . round(number_format($this->getVar('rating'), 0) / 2) . ".gif"; // this definition is not removed for compatibility issues
- $down['average_rating'] = $this->getVar('rating'); // new
- $down['votes'] = ($this->getVar('votes') == 1) ? _MD_WFD_ONEVOTE : sprintf(_MD_WFD_NUMVOTES, $this->getVar('votes'));
- $down['hits'] = $this->getVar('hits');
+ $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_WFD_ONEVOTE : sprintf(_MD_WFD_NUMVOTES, $this->getVar('votes'));
+ $download['hits'] = $this->getVar('hits');
- $down['path'] = $this->wfdownloads->getHandler('category')->getNicePath($down['cid']);
+ $download['path'] = $this->wfdownloads->getHandler('category')->getNicePath($download['cid']);
- $down['imageheader'] = wfd_imageheader();
+ $download['imageheader'] = wfd_imageheader();
- $down['title'] = trim($this->getVar('title'));
- $down['url'] = $this->getVar('url');
- $down['filename'] = $this->getVar('filename');
- $down['filetype'] = $this->getVar('filetype');
+ $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')) {
- $down['screenshot_full'] = $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->wfdownloads->getConfig('usethumbs') == true) {
- $down['screenshot_thumb'] = down_createthumb($down['screenshot_full'], $this->wfdownloads->getConfig('screenshots'), "thumbs", $this->wfdownloads->getConfig('shotwidth'), $this->wfdownloads->getConfig('shotheight'),
+ $download['screenshot_thumb'] = down_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 {
- $down['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) {
- $down['screenshot_full2'] = $this->getVar('screenshot2');
+ $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->wfdownloads->getConfig('usethumbs') == true) {
- $down['screenshot_thumb2'] = down_createthumb($down['screenshot_full2'], $this->wfdownloads->getConfig('screenshots'), "thumbs", $this->wfdownloads->getConfig('shotwidth'), $this->wfdownloads->getConfig('shotheight'),
+ $download['screenshot_thumb2'] = down_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 {
- $down['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) {
- $down['screenshot_full3'] = $this->getVar('screenshot3');
+ $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->wfdownloads->getConfig('usethumbs') == true) {
- $down['screenshot_thumb3'] = down_createthumb($down['screenshot_full3'], $this->wfdownloads->getConfig('screenshots'), "thumbs", $this->wfdownloads->getConfig('shotwidth'), $this->wfdownloads->getConfig('shotheight'),
+ $download['screenshot_thumb3'] = down_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 {
- $down['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) {
- $down['screenshot_full4'] = $this->getVar('screenshot4');
+ $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->wfdownloads->getConfig('usethumbs') == true) {
- $down['screenshot_thumb4'] = down_createthumb($down['screenshot_full4'], $this->wfdownloads->getConfig('screenshots'), "thumbs", $this->wfdownloads->getConfig('shotwidth'), $this->wfdownloads->getConfig('shotheight'),
+ $download['screenshot_thumb4'] = down_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 {
- $down['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'));
}
}
}
- $down['homepage'] = (!$this->getVar('homepage') || $this->getVar('homepage') == "http://") ? '' : $myts->htmlSpecialChars(trim($this->getVar('homepage')));
+ $download['homepage'] = (!$this->getVar('homepage') || $this->getVar('homepage') == "http://") ? '' : $myts->htmlSpecialChars(trim($this->getVar('homepage')));
$homepagetitle = $this->getVar('homepagetitle');
- if ($down['homepage'] && !empty($down['homepage'])) {
- $down['homepagetitle'] = ($homepagetitle != "") ? trim($down['homepage']) : trim($homepagetitle);
- $down['homepage'] = "<a href='" . $down['homepage'] . "' target='_blank'>" . $homepagetitle . "</a>";
+ if ($download['homepage'] && !empty($download['homepage'])) {
+ $download['homepagetitle'] = ($homepagetitle != "") ? trim($download['homepage']) : trim($homepagetitle);
+ $download['homepage'] = "<a href='" . $download['homepage'] . "' target='_blank'>" . $homepagetitle . "</a>";
} else {
- $down['homepage'] = '';
+ $download['homepage'] = '';
}
if ($use_mirrors !== true) {
- $down['mirror'] = ($this->getVar('mirror') == "http://") ? '' : trim($this->getVar('mirror'));
- if ($down['mirror'] && !empty($down['mirror'])) {
- $down['mirror'] = "<a href='" . $down['mirror'] . "' target='_blank'>" . _MD_WFD_MIRRORSITE . "</a>";
+ $download['mirror'] = ($this->getVar('mirror') == "http://") ? '' : trim($this->getVar('mirror'));
+ if ($download['mirror'] && !empty($download['mirror'])) {
+ $download['mirror'] = "<a href='" . $download['mirror'] . "' target='_blank'>" . _MD_WFD_MIRRORSITE . "</a>";
} else {
- $down['mirror'] = '';
+ $download['mirror'] = '';
}
}
- $down['comments'] = $this->getVar('comments');
+ $download['comments'] = $this->getVar('comments');
$version = $this->getVar('version');
if ($version != 0) {
- $down['version'] = $this->getVar('version');
+ $download['version'] = $this->getVar('version');
} else {
- $down['version'] = 0;
+ $download['version'] = 0;
}
- $down['downtime'] = wfdownloads_GetDownloadTime($this->getVar('size'), 1, 1, 1, 1, 0);
- $down['downtime'] = str_replace("|", "<br />", $down['downtime']);
- $down['size'] = wfdownloads_bytesToSize1024($this->getVar('size'));
+ $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'));
$time = ($this->getVar('updated') != 0) ? $this->getVar('updated') : $this->getVar('published');
- $down['updated'] = formatTimestamp($time, $this->wfdownloads->getConfig('dateformat'));
+ $download['updated'] = formatTimestamp($time, $this->wfdownloads->getConfig('dateformat'));
$is_updated = ($this->getVar('updated') != 0) ? _MD_WFD_UPDATEDON : _MD_WFD_SUBMITDATE;
- $down['lang_subdate'] = $is_updated;
+ $download['lang_subdate'] = $is_updated;
$summary = $this->getVar('summary');
- if ($this->wfdownloads->getConfig('autosummary') == true || empty($summary))
- {
+ if ($this->wfdownloads->getConfig('autosummary') == true || empty($summary)) {
+ // generate autosummary
$summaryLength = (int)$this->wfdownloads->getConfig('autosumlength');
- $summaryDescription = stripslashes($this->getVar('summary'));
+ $summaryDescription = stripslashes($this->getVar('description'));
+ $download['summary'] = $myts->displayTarea($summaryDescription, 1);
if (strlen($summaryDescription) > $summaryLength) {
- $summaryDescription = substr($summaryDescription, 0, $summaryLength);
- $summaryDescription = trim(substr($summaryDescription, 0, strrpos($summaryDescription, ' '))) . ' ...';
- $down['summary'] = $myts->displayTarea($summaryDescription, 1);
+ $download['summary'] = wfdownloads_truncateHtml($download['summary'], $summaryLength, '...', false, true);
} else {
- $down['summary'] = $myts->displayTarea($summaryDescription, 1);
+ // NOP
}
} else {
- $down['summary'] = $summary;
+ $download['summary'] = $summary;
}
- $down['description'] = $this->getVar('description'); //no html
- $down['price'] = ($this->getVar('price') != 0) ? $this->getVar('price') : _MD_WFD_PRICEFREE;
+ $download['description'] = $this->getVar('description'); //no html
+ $download['price'] = ($this->getVar('price') != 0) ? $this->getVar('price') : _MD_WFD_PRICEFREE;
$limitationsArray = $this->wfdownloads->getConfig('limitations');
- $down['limitations'] = ($this->getVar('limitations') == "") ? _MD_WFD_NOTSPECIFIED : $myts->htmlSpecialChars(trim($limitationsArray[$this->getVar('limitations')]));
+ $download['limitations'] = ($this->getVar('limitations') == "") ? _MD_WFD_NOTSPECIFIED : $myts->htmlSpecialChars(trim($limitationsArray[$this->getVar('limitations')]));
$versiontypesArray = $this->wfdownloads->getConfig('versiontypes');
- $down['versiontypes'] = ($this->getVar('versiontypes') == "") ? _MD_WFD_NOTSPECIFIED : $myts->htmlSpecialChars(trim($versiontypesArray[$this->getVar('versiontypes')]));
+ $download['versiontypes'] = ($this->getVar('versiontypes') == "") ? _MD_WFD_NOTSPECIFIED : $myts->htmlSpecialChars(trim($versiontypesArray[$this->getVar('versiontypes')]));
$licenseArray = $this->wfdownloads->getConfig('license');
- $down['license'] = ($this->getVar('license')=="") ? _MD_WFD_NOTSPECIFIED : $myts->htmlSpecialChars(trim($licenseArray[$this->getVar('license')]));
- $down['submitter'] = XoopsUserUtility::getUnameFromId($this->getVar('submitter'));
+ $download['license'] = ($this->getVar('license')=="") ? _MD_WFD_NOTSPECIFIED : $myts->htmlSpecialChars(trim($licenseArray[$this->getVar('license')]));
+ $download['submitter'] = XoopsUserUtility::getUnameFromId($this->getVar('submitter'));
$publisher = $this->getVar('publisher');
if (!empty($publisher)) {
- $down['publisher'] = $publisher;
+ $download['publisher'] = $publisher;
} else {
- $down['publisher'] = '';
+ $download['publisher'] = '';
}
$platformArray = $this->wfdownloads->getConfig('platform');
- $down['platform'] = $myts->htmlSpecialChars($platformArray[$this->getVar('platform')]);
+ $download['platform'] = $myts->htmlSpecialChars($platformArray[$this->getVar('platform')]);
$history = $this->getVar('dhistory', 'n');
- $down['history'] = $myts->displayTarea($history, 1);
- $down['features'] = '';
+ $download['history'] = $myts->displayTarea($history, 1);
+ $download['features'] = '';
if ($this->getVar('features')) {
- $downfeatures = explode('|', trim($this->getVar('features')));
- foreach ($downfeatures as $bi) {
- $down['features'][] = $bi;
+ $downloadfeatures = explode('|', trim($this->getVar('features')));
+ foreach ($downloadfeatures as $bi) {
+ $download['features'][] = $bi;
}
}
- $down['requirements'] = '';
+ $download['requirements'] = '';
if ($this->getVar('requirements')) {
- $downrequirements = explode('|', trim($this->getVar('requirements')));
- foreach ($downrequirements as $bi) {
- $down['requirements'][] = $bi;
+ $downloadrequirements = explode('|', trim($this->getVar('requirements')));
+ foreach ($downloadrequirements as $bi) {
+ $download['requirements'][] = $bi;
}
}
- $down['mail_subject'] = rawurlencode(sprintf(_MD_WFD_INTFILEFOUND, $xoopsConfig['sitename']));
- $down['mail_body'] = rawurlencode(sprintf(_MD_WFD_INTFILEFOUND, $xoopsConfig['sitename']) . ': ' . WFDOWNLOADS_URL . '/singlefile.php?cid=' . $down['cid'] . '&lid=' . $down['id']);
+ $download['mail_subject'] = rawurlencode(sprintf(_MD_WFD_INTFILEFOUND, $xoopsConfig['sitename']));
+ $download['mail_body'] = rawurlencode(sprintf(_MD_WFD_INTFILEFOUND, $xoopsConfig['sitename']) . ': ' . WFDOWNLOADS_URL . '/singlefile.php?cid=' . $download['cid'] . '&lid=' . $download['id']);
- $down['isadmin'] = (!empty($xoopsUser) && $xoopsUser->isAdmin($this->wfdownloads->getModule()->mid())) ? true : false;
+ $download['isadmin'] = (!empty($xoopsUser) && $xoopsUser->isAdmin($this->wfdownloads->getModule()->mid())) ? true : false;
- $down['adminlink'] = '';
- if ($down['isadmin'] == true) {
- $down['adminlink'] = '[<a href="' . WFDOWNLOADS_URL . '/admin/downloads.php?op=download.edit&lid=' . $down['id'] . '">' . _MD_WFD_EDIT . '</a> | ';
- $down['adminlink'] .= '<a href="' . WFDOWNLOADS_URL . '/admin/downloads.php?op=download.delete&lid=' . $down['id'] . '">' . _MD_WFD_DELETE . '</a>]';
+ $download['adminlink'] = '';
+ if ($download['isadmin'] == true) {
+ $download['adminlink'] = '[<a href="' . WFDOWNLOADS_URL . '/admin/downloads.php?op=download.edit&lid=' . $download['id'] . '">' . _MD_WFD_EDIT . '</a> | ';
+ $download['adminlink'] .= '<a href="' . WFDOWNLOADS_URL . '/admin/downloads.php?op=download.delete&lid=' . $download['id'] . '">' . _MD_WFD_DELETE . '</a>]';
}
$votestring = ($this->getVar('votes') == 1) ? _MD_WFD_ONEVOTE : sprintf(_MD_WFD_NUMVOTES, $this->getVar('votes'));
- $down['is_updated'] = ($this->getVar('updated') > 0) ? _MD_WFD_UPDATEDON : _MD_WFD_SUBMITDATE;
+ $download['is_updated'] = ($this->getVar('updated') > 0) ? _MD_WFD_UPDATEDON : _MD_WFD_SUBMITDATE;
- if (is_object($xoopsUser) && $down['isadmin'] != true) {
- $down['useradminlink'] = ((int)($xoopsUser->getvar('uid')) == $this->getVar('submitter')) ? true : false;
+ if (is_object($xoopsUser) && $download['isadmin'] != true) {
+ $download['useradminlink'] = ((int)($xoopsUser->getvar('uid')) == $this->getVar('submitter')) ? true : false;
}
- global $xoopsDB;
- $sql2 = "SELECT rated FROM " . $xoopsDB->prefix('wfdownloads_reviews') . " WHERE lid = '" . intval($down['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);
- $down['reviews_num'] = ($numrows) ? $numrows : 0;
+ $download['reviews_num'] = ($numrows) ? $numrows : 0;
$totalReviewsRating = 0;
while ($review_text = $xoopsDB->fetchArray($results)) {
$totalReviewsRating += $review_text['rated'];
}
- $averageReviewsRating = ($down['reviews_num'] > 0) ? $totalReviewsRating / $down['reviews_num'] : 0;
- $down['review_average_rating'] = $averageReviewsRating; // new
- $down['review_rateimg'] = "rate" . round(number_format($averageReviewsRating, 0) / 2) . ".gif"; // this definition is not removed for compatibility issues
+ $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
- $down['icons'] = wfd_displayicons($this->getVar('published'), $this->getVar('status'), $this->getVar('hits'));
+ $download['icons'] = wfd_displayicons($this->getVar('published'), $this->getVar('status'), $this->getVar('hits'));
- global $xoopsDB;
- $sql3 = "SELECT downurl FROM " . $xoopsDB->prefix('wfdownloads_mirrors') . " WHERE lid = '" . $down['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);
- $down['mirrors_num'] = ($numrows2) ? $numrows2 : 0;
- return $down;
+ $download['mirrors_num'] = ($numrows2) ? $numrows2 : 0;
+ return $download;
}
@@ -351,9 +348,9 @@
$userfile_file = new XoopsFormFile(_MD_WFD_UPLOAD_FILEC, 'userfile', 0);
$maxFileSize = wfdownloads_bytesToSize1024($this->wfdownloads->getConfig('maxfilesize'));
if (is_object($xoopsUser) && $xoopsUser->isAdmin()) {
- $criteria = new Criteria("mime_admin", true);
+ $criteria = new Criteria('mime_admin', true);
} else {
- $criteria = new Criteria("mime_user", true);
+ $criteria = new Criteria('mime_user', true);
}
$mimetypes = $this->wfdownloads->getHandler('mimetype')->getList($criteria);
$allowMimetypes = implode(' | ', $mimetypes);
@@ -369,7 +366,7 @@
$sform->addElement(new XoopsFormHidden('cid', $this->getVar('cid', 'e')));
} else {
$categories = $this->wfdownloads->getHandler('category')->getUserUpCategories();
- $categoriesTree = new XoopsObjectTree($categories, "cid", "pid");
+ $categoriesTree = new XoopsObjectTree($categories, 'cid', 'pid');
$sform->addElement(new XoopsFormLabel(_MD_WFD_CATEGORYC, $categoriesTree->makeSelBox('cid', 'title', "-", $this->getVar('cid', 'e'))));
}
// changed - end - March 4 2006 - jpc
@@ -382,47 +379,59 @@
$sform->addElement(new XoopsFormText(_MD_WFD_PUBLISHERC, 'publisher', 50, 255, $this->getVar('publisher', 'e')), false);
$sform->addElement(new XoopsFormText(_MD_WFD_FILESIZEC, 'size', 10, 20, $this->getVar('size', 'e')), false);
- $platform_array = $this->wfdownloads->getConfig('platform');
- $platform_select = new XoopsFormSelect(_MD_WFD_PLATFORMC, 'platform', $this->getVar('platform', 'e'));
- $platform_select->addOptionArray($platform_array);
+ $platform_array = $this->wfdownloads->getConfig('platform');
+ $platform_select = new XoopsFormSelect(_MD_WFD_PLATFORMC, 'platform', $this->getVar('platform', 'e'));
+ $platform_select->addOptionArray($platform_array);
$sform->addElement($platform_select);
- $license_array = $this->wfdownloads->getConfig('license');
- $license_select = new XoopsFormSelect(_MD_WFD_LICENCEC, 'license', $this->getVar('license', 'e'));
- $license_select->addOptionArray($license_array);
+ $license_array = $this->wfdownloads->getConfig('license');
+ $license_select = new XoopsFormSelect(_MD_WFD_LICENCEC, 'license', $this->getVar('license', 'e'));
+ $license_select->addOptionArray($license_array);
$sform->addElement($license_select);
- $limitations_array = $this->wfdownloads->getConfig('limitations');
- $limitations_select = new XoopsFormSelect(_MD_WFD_LIMITATIONS, 'limitations', $this->getVar('limitations', 'e'));
- $limitations_select->addOptionArray($limitations_array);
+ $limitations_array = $this->wfdownloads->getConfig('limitations');
+ $limitations_select = new XoopsFormSelect(_MD_WFD_LIMITATIONS, 'limitations', $this->getVar('limitations', 'e'));
+ $limitations_select->addOptionArray($limitations_array);
$sform->addElement($limitations_select);
- $versiontypes_array = $this->wfdownloads->getConfig('versiontypes');
- $versiontypes_select = new XoopsFormSelect(_MD_WFD_VERSIONTYPES, 'versiontypes', $this->getVar('versiontypes', 'e'));
- $versiontypes_select->addOptionArray($versiontypes_array);
+ $versiontypes_array = $this->wfdownloads->getConfig('versiontypes');
+ $versiontypes_select = new XoopsFormSelect(_MD_WFD_VERSIONTYPES, 'versiontypes', $this->getVar('versiontypes', 'e'));
+ $versiontypes_select->addOptionArray($versiontypes_array);
$sform->addElement($versiontypes_select);
$sform->addElement(new XoopsFormText(_MD_WFD_PRICEC, 'price', 10, 20, $this->getVar('price', 'e')), false);
- $summary_dhtmltextarea = new XoopsFormDhtmlTextArea(_MD_WFD_SUMMARY, 'summary', $this->getVar('summary', 'e'), 10, 60, 'smartHiddenSummary');
- $summary_dhtmltextarea->setDescription(_MD_WFD_SUMMARY_DESC);
- $sform->addElement($summary_dhtmltextarea, false);
- $sform->addElement(new XoopsFormDhtmlTextArea(_MD_WFD_DESCRIPTION, 'description', $this->getVar('description', 'e'), 15, 60, 'smartHiddenDescription'), true);
+
+ if ($this->wfdownloads->getConfig('autosummary') == true) {
+ $summary_dhtmltextarea = new XoopsFormDhtmlTextArea(_MD_WFD_SUMMARY, 'summary', $this->getVar('summary', 'e'), 10, 60, 'smartHiddenSummary');
+ $summary_dhtmltextarea->setDescription(_MD_WFD_SUMMARY_DESC_AUTOSUMMARY_ON);
+ $summary_dhtmltextarea->setExtra('disabled', 'disabled');
+ $sform->addElement($summary_dhtmltextarea, false);
+ } else {
+ $summary_dhtmltextarea = new XoopsFormDhtmlTextArea(_MD_WFD_SUMMARY, 'summary', $this->getVar('summary', 'e'), 10, 60, 'smartHiddenSummary');
+ $summary_dhtmltextarea->setDescription(_MD_WFD_SUMMARY_DESC_AUTOSUMMARY_OFF);
+ $sform->addElement($summary_dhtmltextarea, false);
+ }
+
+ $description_dhtmltextarea = new XoopsFormDhtmlTextArea(_MD_WFD_DESCRIPTION, 'description', $this->getVar('description', 'e'), 15, 60, 'smartHiddenDescription');
+ $description_dhtmltextarea->setDescription(_MD_WFD_DESCRIPTION_DESC);
+ $sform->addElement($description_dhtmltextarea, true);
$features_textarea = new XoopsFormTextArea(_MD_WFD_KEYFEATURESC, 'features', $this->getVar('features', 'e'), 7, 60);
- $features_textarea->setDescription(_MD_WFD_KEYFEATURESC_DESC);
+ $features_textarea->setDescription(_MD_WFD_SUMMARY_DESC_AUTOSUMMARY_ON);
$sform->addElement($features_textarea, false);
$requirements_textarea = new XoopsFormTextArea(_MD_WFD_REQUIREMENTSC, 'requirements', $this->getVar('requirements', 'e'), 7, 60);
$requirements_textarea->setDescription(_MD_WFD_REQUIREMENTSC_DESC);
$sform->addElement($requirements_textarea, false);
- } else { // if we are using a custom form, then add in the form's elements here
+ } else {
+ // if we are using a custom form, then add in the form's elements here
$sform->addElement(new XoopsFormDhtmlTextArea(_MD_WFD_DESCRIPTION, 'description', $this->getVar('description', 'e'), 15, 60, 'smartHiddenDescription'), true);
- $sform -> addElement(new XoopsFormHidden('size', $this->getVar('size', 'e')));
+ $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_WFD_HISTORYC, 'dhistory', $this->getVar('dhistory', 'e'), 7, 60), false);
if (!$this->isNew() && $this->getVar('dhistory', 'n') != "") {
- $dhistoryaddedd_textarea = new XoopsFormTextArea(_MD_WFD_HISTORYD, 'dhistoryaddedd', "", 7, 60);
+ $dhistoryaddedd_textarea = new XoopsFormTextArea(_MD_WFD_HISTORYD, 'dhistoryaddedd', '', 7, 60);
$dhistoryaddedd_textarea->setDescription(_MD_WFD_HISTORYD_DESC);
$sform->addElement($dhistoryaddedd_textarea, false);
}
@@ -470,12 +479,12 @@
$use_mirrors = $this->wfdownloads->getConfig('enable_mirrors');
$sform = new XoopsThemeForm($title, "storyform", $_SERVER['REQUEST_URI']);
- $sform -> setExtra('enctype="multipart/form-data"');
+ $sform->setExtra('enctype="multipart/form-data"');
if (!$this->isNew()) {
$sform -> addElement(new XoopsFormLabel(_AM_WFD_FILE_ID, (int)$this->getVar('lid')));
}
if ($this->getVar('ipaddress') != "") {
- $sform -> addElement(new XoopsFormLabel(_AM_WFD_FILE_IP, $this->getVar('ipaddress')));
+ $sform->addElement(new XoopsFormLabel(_AM_WFD_FILE_IP, $this->getVar('ipaddress')));
}
$titles_tray = new XoopsFormElementTray(_AM_WFD_FILE_TITLE, '<br />');
@@ -484,39 +493,45 @@
$titles_checkbox = new XoopsFormCheckBox('', 'title_checkbox', 0);
$titles_checkbox -> addOption(1, _AM_WFD_FILE_USE_UPLOAD_TITLE);
$titles_tray -> addElement($titles_checkbox);
- $sform -> addElement($titles_tray);
+ $sform->addElement($titles_tray);
if (!$this->isNew()) {
//$sform -> addElement(new XoopsFormText(_AM_WFD_FILE_SUBMITTERID, 'submitter', 10, 10, $this->getVar('submitter', 'e')), true);
$submitter_select = new XoopsFormSelectUser (_AM_WFD_FILE_SUBMITTER, 'submitter', false, $this->getVar('submitter', 'e'), 1, false);
$submitter_select->setDescription(_AM_WFD_FILE_SUBMITTER_DESC);
- $sform -> addElement($submitter_select);
+ $sform->addElement($submitter_select);
} else {
- $sform -> addElement(new XoopsFormHidden('submitter', $xoopsUser->getVar('uid', 'e')));
+ $sform->addElement(new XoopsFormHidden('submitter', $xoopsUser->getVar('uid', 'e')));
}
- $sform -> addElement(new XoopsFormText(_AM_WFD_FILE_DLURL, 'url', 50, 255, $this->getVar('url', 'e')), false);
- $sform -> addElement(new XoopsFormText(_AM_WFD_FILE_FILENAME, 'filename', 50, 255, $this->getVar('filename', 'e')), false);
+ $sform->addElement(new XoopsFormText(_AM_WFD_FILE_DLURL, 'url', 50, 255, $this->getVar('url', 'e')), false);
+ $sform->addElement(new XoopsFormText(_AM_WFD_FILE_FILENAME, 'filename', 50, 255, $this->getVar('filename', 'e')), false);
/*
$filename_tray = new XoopsFormElementTray(_AM_WFD_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($filename_tray, false);
*/
- $sform -> addElement(new XoopsFormText(_AM_WFD_FILE_FILETYPE, 'filetype', 50, 100, $this->getVar('filetype', 'e')), false);
+ $sform->addElement(new XoopsFormText(_AM_WFD_FILE_FILETYPE, 'filetype', 50, 100, $this->getVar('filetype', 'e')), false);
if ($use_mirrors !== true) {
- $sform -> addElement(new XoopsFormText(_AM_WFD_FILE_MIRRORURL, 'mirror', 50, 255, $this->getVar('mirror', 'e')), false);
+ $sform->addElement(new XoopsFormText(_AM_WFD_FILE_MIRRORURL, 'mirror', 50, 255, $this->getVar('mirror', 'e')), false);
}
- $sform -> addElement(new XoopsFormFile(_AM_WFD_FILE_DUPLOAD, 'userfile', 0), false);
+ $userfile_file = new XoopsFormFile(_MD_WFD_UPLOAD_FILEC, 'userfile', 0);
+ $maxFileSize = wfdownloads_bytesToSize1024($this->wfdownloads->getConfig('maxfilesize'));
+ $criteria = new Criteria("mime_admin", true);
+ $mimetypes = $this->wfdownloads->getHandler('mimetype')->getList($criteria);
+ $allowMimetypes = implode(' | ', $mimetypes);
+ $userfile_file->setDescription(sprintf(_MD_WFD_UPLOAD_FILEC_DESC, $maxFileSize, $this->wfdownloads->getConfig('maximgwidth'), $this->wfdownloads->getConfig('maximgheight'), $allowMimetypes));
+ $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();
- $categoriesTree = new XoopsObjectTree($categories, "cid", "pid");
- $sform->addElement(new XoopsFormLabel(_AM_WFD_FILE_CATEGORY, $categoriesTree->makeSelBox('cid', 'title', "-", $this->getVar('cid', 'e'))));
+ $categoriesTree = new XoopsObjectTree($categories, 'cid', 'pid');
+ $sform->addElement(new XoopsFormLabel(_AM_WFD_FILE_CATEGORY, $categoriesTree->makeSelBox('cid', 'title', '-', $this->getVar('cid', 'e'))));
// }
// changed - end - March 4 2006 - jpc
@@ -558,62 +573,52 @@
$sform->addElement(new XoopsFormText(_AM_WFD_FILE_PRICE, 'price', 10, 20, $this->getVar('price', 'e')), false);
-// $sform -> addElement(new XoopsFormDhtmlTextArea(_AM_WFD_FILE_SUMMARY, 'summary', $this->getVar('summary', 'e'), 10, 60, "smartHiddenSummary"), false);
- $optionsTrayNote = new XoopsFormElementTray(_AM_WFD_FILE_SUMMARY, '<br />');
- if (class_exists('XoopsFormEditor')) {
- $options['name'] = 'summary';
- $options['value'] = $this->getVar('summary', 'e');
- $options['rows'] = 10;
- $options['cols'] = '100%';
- $options['width'] = '100%';
- $options['height'] = '200px';
- $formSummary = new XoopsFormEditor('', $this->wfdownloads->getConfig('editor_options'), $options, $nohtml = false, $onfailure = 'textarea');
- $optionsTrayNote->addElement($formSummary);
- } else {
- $formSummary = new XoopsFormDhtmlTextArea('', 'summary', $this->getVar('summary', 'e'), 10, 60, 'smartHiddenSummary');
- $optionsTrayNote->addElement($formSummary);
- }
- $sform->addElement($optionsTrayNote);
+ $summary_tray = new XoopsFormElementTray(_MD_WFD_SUMMARY, '<br />');
+ $options['name'] = 'summary';
+ $options['value'] = $this->getVar('summary', 'e');
+ $options['rows'] = 10;
+ $options['cols'] = '100%';
+ $options['width'] = '100%';
+ $options['height'] = '200px';
+ $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_WFD_SUMMARY_DESC_AUTOSUMMARY_ON);
+ } else {
+ $summary_tray->setDescription(_MD_WFD_SUMMARY_DESC_AUTOSUMMARY_OFF);
+ }
+ $sform->addElement($summary_tray);
-// $sform -> addElement(new XoopsFormDhtmlTextArea(_AM_WFD_FILE_DESCRIPTION, 'description', $this->getVar('description', 'e'), 15, 60, "smartHiddenDescription"), true);
- $optionsTrayNote2 = new XoopsFormElementTray(_AM_WFD_FILE_DESCRIPTION, '<br />');
- if (class_exists('XoopsFormEditor')) {
+ $description_tray = new XoopsFormElementTray(_MD_WFD_DESCRIPTION, '<br />');
$options['name'] = 'description';
$options['value'] = $this->getVar('description', 'e');
$options['rows'] = 15;
$options['cols'] = '100%';
$options['width'] = '100%';
$options['height'] = '200px';
- $formDescription = new XoopsFormEditor('', $this->wfdownloads->getConfig('editor_options'), $options, $nohtml = false, $onfailure = 'textarea');
- $optionsTrayNote2->addElement($formDescription, true);
- } else {
- $formDescription = new XoopsFormDhtmlTextArea('', 'description', $this->getVar('description', 'e'), 15, 60, 'smartHiddenDescription');
- $optionsTrayNote2->addElement($formDescription, true);
- }
- $sform->addElement($optionsTrayNote2);
+ $description_editor = new XoopsFormEditor('', $this->wfdownloads->getConfig('editor_options'), $options, $nohtml = false, $onfailure = 'textarea');
+ $description_tray->addElement($description_editor, true);
+ $description_tray->setDescription(_MD_WFD_DESCRIPTION_DESC);
+ $sform->addElement($description_tray);
$sform->addElement(new XoopsFormTextArea(_AM_WFD_FILE_KEYFEATURES, 'features', $this->getVar('features', 'e'), 7, 60), false);
$sform->addElement(new XoopsFormTextArea(_AM_WFD_FILE_REQUIREMENTS, 'requirements', $this->getVar('requirements', 'e'), 7, 60), false);
- } else { // if we are using a custom form, then add in the form's elements here
+ } else {
+ // if we are using a custom form, then add in the form's elements here
-// $sform -> addElement(new XoopsFormDhtmlTextArea(_AM_WFD_FILE_DESCRIPTION, 'description', $this->getVar('description', 'e'), 15, 60, "smartHiddenDescription"), true);
-
- $optionsTrayNote2 = new XoopsFormElementTray(_AM_WFD_FILE_DESCRIPTION, '<br />');
- if (class_exists('XoopsFormEditor')) {
+ // $sform -> addElement(new XoopsFormDhtmlTextArea(_AM_WFD_FILE_DESCRIPTION, 'description', $this->getVar('description', 'e'), 15, 60, "smartHiddenDescription"), true);
+ $description_tray = new XoopsFormElementTray(_MD_WFD_DESCRIPTION, '<br />');
$options['name'] = 'description';
$options['value'] = $this->getVar('description', 'e');
$options['rows'] = 15;
$options['cols'] = '100%';
$options['width'] = '100%';
$options['height'] = '200px';
- $formDescription = new XoopsFormEditor('', $this->wfdownloads->getConfig('editor_options'), $options, $nohtml = false, $onfailure = 'textarea');
- $optionsTrayNote2->addElement($formDescription, true);
- } else {
- $formDescription = new XoopsFormDhtmlTextArea('', 'description', $this->getVar('description', 'e'), 15, 60, "smartHiddenDescription");
- $optionsTrayNote2->addElement($formDescription, true);
- }
- $sform->addElement($optionsTrayNote2);
+ $description_editor = new XoopsFormEditor('', $this->wfdownloads->getConfig('editor_options'), $options, $nohtml = false, $onfailure = 'textarea');
+ $description_tray->addElement($description_editor, true);
+ $description_tray->setDescription(_MD_WFD_DESCRIPTION_DESC);
+ $sform->addElement($description_tray);
$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']);
@@ -625,102 +630,102 @@
if (!$this->isNew() && $this->getVar('dhistory') != "") {
$sform -> addElement(new XoopsFormTextArea(_AM_WFD_FILE_HISTORYD, 'dhistoryaddedd', '', 7, 60), false);
}
- $graph_array = & WfsLists :: getListTypeAsArray(XOOPS_ROOT_PATH . "/" . $this->wfdownloads->getConfig('screenshots'), $type = "images");
+ $graph_array = & WfsLists :: getListTypeAsArray(XOOPS_ROOT_PATH . '/' . $this->wfdownloads->getConfig('screenshots'), $type = "images");
$indeximage_select = new XoopsFormSelect('', 'screenshot', $this->getVar('screenshot', 'e'));
- $indeximage_select -> addOptionArray($graph_array);
- $indeximage_select -> setExtra("onchange='showImgSelected(\"image1\", \"screenshot\", \"" . $this->wfdownloads->getConfig('screenshots') . "\", \"\", \"" . XOOPS_URL . "\")'");
+ $indeximage_select->addOptionArray($graph_array);
+ $indeximage_select->setExtra("onchange='showImgSelected(\"image1\", \"screenshot\", \"" . $this->wfdownloads->getConfig('screenshots') . "\", \"\", \"" . XOOPS_URL . "\")'");
$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($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' />"));
} else {
- $indeximage_tray -> addElement(new XoopsFormLabel('', "<br /><br /><img src='" . XOOPS_URL . "/uploads/blank.gif' id='image1' alt='' title='' />"));
+ $indeximage_tray->addElement(new XoopsFormLabel('', "<br /><br /><img src='" . XOOPS_URL . "/uploads/blank.gif' id='image1' alt='' title='' />"));
}
$sform -> addElement($indeximage_tray);
- $graph_array2 = & WfsLists :: getListTypeAsArray(XOOPS_ROOT_PATH . "/" . $this->wfdownloads->getConfig('screenshots'), $type = "images");
+ $graph_array2 = & WfsLists :: getListTypeAsArray(XOOPS_ROOT_PATH . '/' . $this->wfdownloads->getConfig('screenshots'), $type = "images");
$indeximage_select2 = new XoopsFormSelect('', 'screenshot2', $this->getVar('screenshot2', 'e'));
- $indeximage_select2 -> addOptionArray($graph_array2);
- $indeximage_select2 -> setExtra("onchange='showImgSelected(\"image2\", \"screenshot2\", \"" . $this->wfdownloads->getConfig('screenshots') . "\", \"\", \"" . XOOPS_URL . "\")'");
+ $indeximage_select2->addOptionArray($graph_array2);
+ $indeximage_select2->setExtra("onchange='showImgSelected(\"image2\", \"screenshot2\", \"" . $this->wfdownloads->getConfig('screenshots') . "\", \"\", \"" . XOOPS_URL . "\")'");
$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($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' />"));
} else {
- $indeximage_tray2 -> addElement(new XoopsFormLabel('', "<br /><br /><img src='" . XOOPS_URL . "/uploads/blank.gif' id='image2' alt='' title='' />"));
+ $indeximage_tray2->addElement(new XoopsFormLabel('', "<br /><br /><img src='" . XOOPS_URL . "/uploads/blank.gif' id='image2' alt='' title='' />"));
}
- $sform -> addElement($indeximage_tray2);
+ $sform->addElement($indeximage_tray2);
- $graph_array3 = & WfsLists :: getListTypeAsArray(XOOPS_ROOT_PATH . "/" . $this->wfdownloads->getConfig('screenshots'), $type = "images");
+ $graph_array3 = & WfsLists :: getListTypeAsArray(XOOPS_ROOT_PATH . '/' . $this->wfdownloads->getConfig('screenshots'), $type = "images");
$indeximage_select3 = new XoopsFormSelect('', 'screenshot3', $this->getVar('screenshot3', 'e', true));
- $indeximage_select3 -> addOptionArray($graph_array3);
- $indeximage_select3 -> setExtra("onchange='showImgSelected(\"image3\", \"screenshot3\", \"" . $this->wfdownloads->getConfig('screenshots') . "\", \"\", \"" . XOOPS_URL . "\")'");
+ $indeximage_select3->addOptionArray($graph_array3);
+ $indeximage_select3->setExtra("onchange='showImgSelected(\"image3\", \"screenshot3\", \"" . $this->wfdownloads->getConfig('screenshots') . "\", \"\", \"" . XOOPS_URL . "\")'");
$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($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' />"));
} else {
$indeximage_tray3 -> addElement(new XoopsFormLabel('', "<br /><br /><img src='" . XOOPS_URL . "/uploads/blank.gif' id='image3' alt='' title='' />"));
}
$sform -> addElement($indeximage_tray3);
- $graph_array4 = & WfsLists :: getListTypeAsArray(XOOPS_ROOT_PATH . "/" . $this->wfdownloads->getConfig('screenshots'), $type = "images");
+ $graph_array4 = & WfsLists :: getListTypeAsArray(XOOPS_ROOT_PATH . '/' . $this->wfdownloads->getConfig('screenshots'), $type = "images");
$indeximage_select4 = new XoopsFormSelect('', 'screenshot4', $this->getVar('screenshot4', 'e'));
- $indeximage_select4 -> addOptionArray($graph_array4);
- $indeximage_select4 -> setExtra("onchange='showImgSelected(\"image4\", \"screenshot4\", \"" . $this->wfdownloads->getConfig('screenshots') . "\", \"\", \"" . XOOPS_URL . "\")'");
+ $indeximage_select4->addOptionArray($graph_array4);
+ $indeximage_select4->setExtra("onchange='showImgSelected(\"image4\", \"screenshot4\", \"" . $this->wfdownloads->getConfig('screenshots') . "\", \"\", \"" . XOOPS_URL . "\")'");
$indeximage_tray4 = new XoopsFormElementTray(_AM_WFD_FILE_SHOTIMAGE, ' ');
- $indeximage_tray4 -> addElement($indeximage_select4);
+ $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='' />"));
+ $indeximage_tray4->addElement(new XoopsFormLabel('', "<br /><br /><img src='" . XOOPS_URL . "/uploads/blank.gif' id='image4' alt='' title='' />"));
}
- $sform -> addElement($indeximage_tray4);
+ $sform->addElement($indeximage_tray4);
- $sform -> insertBreak(sprintf(_AM_WFD_FILE_MUSTBEVALID, "<b>" . $this->wfdownloads->getConfig('screenshots') . "</b>"), "even");
+ $sform->insertBreak(sprintf(_AM_WFD_FILE_MUSTBEVALID, "<b>" . $this->wfdownloads->getConfig('screenshots') . "</b>"), "even");
$publishtext = ($this->isNew() || $this->getVar('published') == 0) ? _AM_WFD_FILE_SETPUBLISHDATE : _AM_WFD_FILE_SETNEWPUBLISHDATE;
if ($this->getVar('published') > time()) {
$publishtext = _AM_WFD_FILE_SETPUBDATESETS;
}
- $ispublished = ($this->getVar('published') > time()) ? 1 : 0 ;
+ $ispublished = ($this->getVar('published') > time()) ? true : false;
$publishdates = ($this->getVar('published') > time()) ? _AM_WFD_FILE_PUBLISHDATESET . formatTimestamp($this->getVar('published', 'e'), "Y-m-d H:s") : _AM_WFD_FILE_SETDATETIMEPUBLISH;
$publishdate_checkbox = new XoopsFormCheckBox('', 'publishdateactivate', $ispublished);
- $publishdate_checkbox -> addOption(1, $publishdates . '<br />');
+ $publishdate_checkbox->addOption(1, $publishdates . '<br />');
if (!$this->isNew()) {
- $sform -> addElement(new XoopsFormHidden('was_published', $this->getVar('published', 'e')));
- $sform -> addElement(new XoopsFormHidden('was_expired', $this->getVar('expired', 'e')));
+ $sform->addElement(new XoopsFormHidden('was_published', $this->getVar('published', 'e')));
+ $sform->addElement(new XoopsFormHidden('was_expired', $this->getVar('expired', 'e')));
}
$publishdate_tray = new XoopsFormElementTray(_AM_WFD_FILE_PUBLISHDATE, '');
- $publishdate_tray -> addElement($publishdate_checkbox);
- $publishdate_tray -> addElement(new XoopsFormDateTime($publishtext, 'published', 15, $this->getVar('published', 'e')));
- $publishdate_tray -> addElement(new XoopsFormRadioYN(_AM_WFD_FILE_CLEARPUBLISHDATE, 'clearpublish', 0));
- $sform -> addElement($publishdate_tray);
+ $publishdate_tray->addElement($publishdate_checkbox);
+ $publishdate_tray->addElement(new XoopsFormDateTime($publishtext, 'published', 15, $this->getVar('published', 'e')));
+ $publishdate_tray->addElement(new XoopsFormRadioYN(_AM_WFD_FILE_CLEARPUBLISHDATE, 'clearpublish', 0));
+ $sform->addElement($publishdate_tray);
- $isexpired = ($this->getVar('expired', 'e') > time()) ? 1: 0 ;
+ $isexpired = ($this->getVar('expired', 'e') > time()) ? true : false;
$expiredates = ($this->getVar('expired', 'e') > time()) ? _AM_WFD_FILE_EXPIREDATESET . formatTimestamp($this->getVar('expired'), 'Y-m-d H:s') : _AM_WFD_FILE_SETDATETIMEEXPIRE;
$warning = ($this->getVar('published') > $this->getVar('expired') && $this->getVar('expired') > time()) ? _AM_WFD_FILE_EXPIREWARNING : '';
$expiredate_checkbox = new XoopsFormCheckBox('', 'expiredateactivate', $isexpired);
$expiredate_checkbox -> addOption(1, $expiredates . '<br />');
$expiredate_tray = new XoopsFormElementTray(_AM_WFD_FILE_EXPIREDATE . $warning, '');
- $expiredate_tray -> addElement($expiredate_checkbox);
- $expiredate_tray -> addElement(new XoopsFormDateTime(_AM_WFD_FILE_SETEXPIREDATE, 'expired', 15, $this->getVar('expired')));
- $expiredate_tray -> addElement(new XoopsFormRadioYN(_AM_WFD_FILE_CLEAREXPIREDATE, 'clearexpire', 0));
- $sform -> addElement($expiredate_tray);
+ $expiredate_tray->addElement($expiredate_checkbox);
+ $expiredate_tray->addElement(new XoopsFormDateTime(_AM_WFD_FILE_SETEXPIREDATE, 'expired', 15, $this->getVar('expired')));
+ $expiredate_tray->addElement(new XoopsFormRadioYN(_AM_WFD_FILE_CLEAREXPIREDATE, 'clearexpire', 0));
+ $sform->addElement($expiredate_tray);
$filestatus_radio = new XoopsFormRadioYN(_AM_WFD_FILE_FILESSTATUS, 'offline', $this->getVar('offline', 'e'));
- $sform -> addElement($filestatus_radio);
+ $sform->addElement($filestatus_radio);
- $up_dated = ($this->getVar('updated', 'e') == 0) ? 0 : 1;
+ $up_dated = ($this->getVar('updated', 'e') == 0) ? false : true;
$file_updated_radio = new XoopsFormRadioYN(_AM_WFD_FILE_SETASUPDATED, 'up_dated', $up_dated);
- $sform -> addElement($file_updated_radio);
+ $sform->addElement($file_updated_radio);
if (!$this->isNew() && $this->getVar('published') == 0) {
- $approved = ($this->getVar('published') == 0) ? 0 : 1;
- $approve_checkbox = new XoopsFormCheckBox(_AM_WFD_FILE_EDITAPPROVE, "approved", 1);
+ $approved = ($this->getVar('published') == 0) ? false : true;
+ $approve_checkbox = new XoopsFormCheckBox(_AM_WFD_FILE_EDITAPPROVE, 'approved', true);
$approve_checkbox -> addOption(1, " ");
$sform->addElement($approve_checkbox);
}
Modified: XoopsModules/wfdownloads/trunk/wfdownloads/docs/changelog.txt
===================================================================
--- XoopsModules/wfdownloads/trunk/wfdownloads/docs/changelog.txt 2013-09-09 13:53:12 UTC (rev 12014)
+++ XoopsModules/wfdownloads/trunk/wfdownloads/docs/changelog.txt 2013-09-09 18:28:43 UTC (rev 12015)
@@ -1,4 +1,4 @@
-<b><u>=> Version 3.23 Beta (2013-08-29)</u></b>
+<b><u>=> Version 3.23 Beta (2013-09-09)</u></b>
- module standardization: header.php, admin/admin_header.php, xoops_version.php
- module standardization: standardize directories/files names/structures
- module standardization: standardize code headers
@@ -11,12 +11,14 @@
- fixed: deprecated "XoopsTree" (luciorota)
- fixed: html errors in templates (luciorota)
- fixed: deprecated XoopsTree (mamba)
+- added: breadcrumb class (luciorota)
+- added: html tags compatible autosummary generator (luciorota)
- added: sort subcategories by cid or title or weight (luciorota)
- added: improved letters choice bar (luciorota)
- added: wfdownloads_submit.html template for submit.php (luciorota)
- added: folder checker (mamba + luciorota)
- added: file checker (luciorota)
-- removed: unapgraded languages (luciorota)
+- removed: unupgraded languages from repository (luciorota)
- removed: unused templates (luciorota)
- removed: unused images files (luciorota)
Modified: XoopsModules/wfdownloads/trunk/wfdownloads/include/functions.php
===================================================================
--- XoopsModules/wfdownloads/trunk/wfdownloads/include/functions.php 2013-09-09 13:53:12 UTC (rev 12014)
+++ XoopsModules/wfdownloads/trunk/wfdownloads/include/functions.php 2013-09-09 18:28:43 UTC (rev 12015)
@@ -1309,6 +1309,111 @@
+/**
+ * truncateHtml can truncate a string up to a number of characters while preserving whole words and HTML tags
+ * www.gsdesign.ro/blog/cut-html-string-without-breaking-the-tags
+ * www.cakephp.org
+ *
+ * @param string $text String to truncate.
+ * @param integer $length Length of returned string, including ellipsis.
+ * @param string $ending Ending to be appended to the trimmed string.
+ * @param boolean $exact If false, $text will not be cut mid-word
+ * @param boolean $considerHtml If true, HTML tags would be handled correctly
+ *
+ * @return string Trimmed string.
+ */
+function wfdownloads_truncateHtml($text, $length = 100, $ending = '...', $exact = false, $considerHtml = true) {
+ if ($considerHtml) {
+ // if the plain text is shorter than the maximum length, return the whole text
+ if (strlen(preg_replace('/<.*?>/', '', $text)) <= $length) {
+ return $text;
+ }
+ // splits all html-tags to scanable lines
+ preg_match_all('/(<.+?>)?([^<>]*)/s', $text, $lines, PREG_SET_ORDER);
+ $total_length = strlen($ending);
+ $open_tags = array();
+ $truncate = '';
+ foreach ($lines as $line_matchings) {
+ // if there is any html-tag in this line, handle it and add it (uncounted) to the output
+ if (!empty($line_matchings[1])) {
+ // if it's an "empty element" with or without xhtml-conform closing slash
+ if (preg_match('/^<(\s*.+?\/\s*|\s*(img|br|input|hr|area|base|basefont|col|frame|isindex|link|meta|param)(\s.+?)?)>$/is', $line_matchings[1])) {
+ // do nothing
+ // if tag is a closing tag
+ } else if (preg_match('/^<\s*\/([^\s]+?)\s*>$/s', $line_matchings[1], $tag_matchings)) {
+ // delete tag from $open_tags list
+ $pos = array_search($tag_matchings[1], $open_tags);
+ if ($pos !== false) {
+ unset($open_tags[$pos]);
+ }
+ // if tag is an opening tag
+ } else if (preg_match('/^<\s*([^\s>!]+).*?>$/s', $line_matchings[1], $tag_matchings)) {
+ // add tag to the beginning of $open_tags list
+ array_unshift($open_tags, strtolower($tag_matchings[1]));
+ }
+ // add html-tag to $truncate'd text
+ $truncate .= $line_matchings[1];
+ }
+ // calculate the length of the plain text part of the line; handle entities as one character
+ $content_length = strlen(preg_replace('/&[0-9a-z]{2,8};|&#[0-9]{1,7};|[0-9a-f]{1,6};/i', ' ', $line_matchings[2]));
+ if ($total_length+$content_length> $length) {
+ // the number of characters which are left
+ $left = $length - $total_length;
+ $entities_length = 0;
+ // search for html entities
+ if (preg_match_all('/&[0-9a-z]{2,8};|&#[0-9]{1,7};|[0-9a-f]{1,6};/i', $line_matchings[2]...
[truncated message content] |