From 811db151b54c8ace7adb426e79f7496b91f1df11 Mon Sep 17 00:00:00 2001
From: mambax7 <{$img_albname}>
+
+
';
- }
+// if (0 === \Xmf\Request::getInt('cat_weight', 0, 'REQUEST')) {
+// $erreur = true;
+// $errorMessage = _AM_TDMDOWNLOADS_ERREUR_WEIGHT . '
';
+// }
if (\Xmf\Request::hasVar('cat_cid', 'REQUEST')) {
if ($cat_cid === \Xmf\Request::getInt('cat_pid', 0, 'POST')) {
$erreur = true;
diff --git a/admin/downloads.php b/admin/downloads.php
index 54ba70c..88d39b4 100644
--- a/admin/downloads.php
+++ b/admin/downloads.php
@@ -43,6 +43,9 @@
$GLOBALS['xoopsTpl']->assign('navigation', $adminObject->displayNavigation(basename(__FILE__)));
if (1 == $statusMenu) {
$adminObject->addItemButton(_AM_TDMDOWNLOADS_DOWNLOADS_NEW, 'downloads.php?op=new_downloads', 'add');
+
+ $adminObject->addItemButton(_AM_TDMDOWNLOADS_DOWNLOADS_NEW_MULTIUPLOAD, '../upload.php?op=list&alb_id=' . $albId, 'add');
+
if (0 == $downloads_waiting) {
$adminObject->addItemButton(_AM_TDMDOWNLOADS_DOWNLOADS_WAIT, 'downloads.php?op=list&statut_display=0', 'add');
} else {
diff --git a/class/Common/FineimpuploadHandler.php b/class/Common/FineimpuploadHandler.php
index 1667419..f6d2ead 100644
--- a/class/Common/FineimpuploadHandler.php
+++ b/class/Common/FineimpuploadHandler.php
@@ -106,7 +106,7 @@ protected function storeUploadedFile($target, $mimeType, $uid)
{
include_once XOOPS_ROOT_PATH .'/modules/'. $moduleDirName .'/header.php';
include_once XOOPS_ROOT_PATH .'/modules/'. $moduleDirName .'/include/resizer.php';
- $this->pathUpload = WGGALLERY_UPLOAD_IMAGE_PATH;
+ $this->pathUpload = constant($moduleDirNameUpper . '_' . 'UPLOAD_IMAGE_PATH');
$this->permUseralbum = 1; //TODO: handle an option, whether images should be online immediately or not
@@ -140,8 +140,8 @@ protected function storeUploadedFile($target, $mimeType, $uid)
if ( 0 < $wmId) {
$watermarksObj = $watermarksHandler->get($wmId);
$wmTarget = $watermarksObj->getVar('wm_target');
- if ( WGGALLERY_WATERMARK_TARGET_A === $wmTarget || WGGALLERY_WATERMARK_TARGET_M === $wmTarget) {$wmTargetM = true;}
- if ( WGGALLERY_WATERMARK_TARGET_A === $wmTarget || WGGALLERY_WATERMARK_TARGET_L === $wmTarget) {$wmTargetL = true;}
+ if ( constant($moduleDirNameUpper . '_' . 'WATERMARK_TARGET_A') === $wmTarget || constant($moduleDirNameUpper . '_' . 'WATERMARK_TARGET_M') === $wmTarget) {$wmTargetM = true;}
+ if ( constant($moduleDirNameUpper . '_' . 'WATERMARK_TARGET_A') === $wmTarget || constant($moduleDirNameUpper . '_' . 'WATERMARK_TARGET_L') === $wmTarget) {$wmTargetL = true;}
}
// create medium image
diff --git a/class/Common/Images.php b/class/Common/Images.php
index b66d004..25fb7e9 100644
--- a/class/Common/Images.php
+++ b/class/Common/Images.php
@@ -13,14 +13,10 @@
*/
/**
- * wgGallery module for xoops
- *
- * @copyright module for xoops
- * @license GPL 2.0 or later
- * @since 1.0
- * @min_xoops 2.5.9
+ * @copyright 2019 XOOPS Project (https://xoops.org)
+ * @license GNU GPL 2 or later (http://www.gnu.org/licenses/gpl-2.0.html)
+ * @link https://xoops.org
* @author Wedega - Email:
');
+ $imgpath = sprintf(AM_TDMDOWNLOADS_FORMIMAGE_PATH, $uploadDir);
+ $imageselect = new \XoopsFormSelect($imgpath, 'img', $img);
+ $imageArray = \XoopsLists::getImgListAsArray(XOOPS_ROOT_PATH . $uploadDir);
+ foreach ($imageArray as $image) {
+ $imageselect->addOption((string)$image, $image);
+ }
+ $imageselect->setExtra("onchange='showImgSelected(\"image_img\", \"img\", \"" . $uploadDir . '", "", "' . XOOPS_URL . "\")'");
+ $imgtray->addElement($imageselect);
+ $imgtray->addElement(new \XoopsFormLabel('', "
"));
+ $fileseltray = new \XoopsFormElementTray('', '
');
+ $fileseltray->addElement(new \XoopsFormFile(AM_TDMDOWNLOADS_FORMUPLOAD, 'img', xoops_getModuleOption('maxsize')));
+ $fileseltray->addElement(new \XoopsFormLabel(''));
+ $imgtray->addElement($fileseltray);
+ $this->addElement($imgtray);
+ // Weight
+ $this->addElement(new \XoopsFormText(AM_TDMDOWNLOADS_FIELD_WEIGHT, 'weight', 50, 255, $this->targetObject->getVar('weight')), false);
+ // Status
+ $this->addElement(new \XoopsFormText(AM_TDMDOWNLOADS_FIELD_STATUS, 'status', 50, 255, $this->targetObject->getVar('status')), false);
+ // Search
+ $this->addElement(new \XoopsFormText(AM_TDMDOWNLOADS_FIELD_SEARCH, 'search', 50, 255, $this->targetObject->getVar('search')), false);
+ // Status_def
+ $this->addElement(new \XoopsFormText(AM_TDMDOWNLOADS_FIELD_STATUS_DEF, 'status_def', 50, 255, $this->targetObject->getVar('status_def')), false);
+
+ $this->addElement(new \XoopsFormHidden('op', 'save'));
+ $this->addElement(new \XoopsFormButton('', 'submit', _SUBMIT, 'submit'));
+ }
+}
diff --git a/class/Form/index.html b/class/Form/index.html
new file mode 100644
index 0000000..2c5cdd3
--- /dev/null
+++ b/class/Form/index.html
@@ -0,0 +1 @@
+
diff --git a/include/common.php b/include/common.php
index f1a5408..2509acb 100644
--- a/include/common.php
+++ b/include/common.php
@@ -97,5 +97,5 @@
$pathModIcon32 = $helper->getModule()->getInfo('modicons32');
$GLOBALS['xoopsTpl']->assign('pathModIcon16', XOOPS_URL . '/modules/' . $moduleDirName . '/' . $pathModIcon16);
- $GLOBALS['xoopsTpl']->assign('pathModIcon32', $pathModIcon32);
+ $GLOBALS['xoopsTpl']->assign('pathModIcon32', XOOPS_URL . '/modules/' . $moduleDirName . '/' . $pathModIcon32);
}
diff --git a/language/english/admin.php b/language/english/admin.php
index 00ad74a..de78c11 100644
--- a/language/english/admin.php
+++ b/language/english/admin.php
@@ -184,3 +184,5 @@
define('_AM_TDMDOWNLOADS_ERROR_BAD_REMOVE', 'Could not delete %s');
define('_AM_TDMDOWNLOADS_ERROR_NO_PLUGIN', 'Could not load plugin');
define('_AM_TDMDOWNLOADS_NUMBYTES', '%s bytes');
+//multi-upload
+define('_AM_TDMDOWNLOADS_DOWNLOADS_NEW_MULTIUPLOAD', 'New Multi-upload');
diff --git a/upload.php b/upload.php
index b7cc1cf..e7d81d7 100644
--- a/upload.php
+++ b/upload.php
@@ -10,13 +10,12 @@
*/
/**
- * @copyright module for xoops
- * @license GPL 2.0 or later
- * @package wggallery
- * @since 1.0
- * @min_xoops 2.5.9
- * @author Wedega - Email:
';
-// }
if (\Xmf\Request::hasVar('cat_cid', 'REQUEST')) {
if ($cat_cid === \Xmf\Request::getInt('cat_pid', 0, 'POST')) {
$erreur = true;
diff --git a/class/Category.php b/class/Category.php
index e66d163..34e1219 100644
--- a/class/Category.php
+++ b/class/Category.php
@@ -16,6 +16,9 @@
* @license GNU GPL 2 (http://www.gnu.org/licenses/old-licenses/gpl-2.0.html)
* @author Gregory Mage (Aka Mage)
*/
+
+use XoopsModules\Tdmdownloads;
+
defined('XOOPS_ROOT_PATH') || die('Restricted access');
/**
@@ -32,6 +35,9 @@ class Category extends \XoopsObject
public function __construct()
{
parent::__construct();
+ /** @var Tdmdownloads\Helper $helper */
+ $this->helper = Tdmdownloads\Helper::getInstance();
+ $this->permHelper = new \Xmf\Module\Helper\Permission();
$this->initVar('cat_cid', XOBJ_DTYPE_INT, null, false, 5);
$this->initVar('cat_pid', XOBJ_DTYPE_INT, null, false, 5);
$this->initVar('cat_title', XOBJ_DTYPE_TXTBOX, null, false);
diff --git a/class/Common/FineimpuploadHandler.php b/class/Common/FineimpuploadHandler.php
index f6d2ead..076d1d5 100644
--- a/class/Common/FineimpuploadHandler.php
+++ b/class/Common/FineimpuploadHandler.php
@@ -98,8 +98,8 @@ class FineimpuploadHandler extends \SystemFineUploadHandler
public function __construct(\stdClass $claims)
{
parent::__construct($claims);
- $this->allowedMimeTypes = ['image/gif', 'image/jpeg', 'image/png'];
- $this->allowedExtensions = ['gif', 'jpeg', 'jpg', 'png'];
+ $this->allowedMimeTypes = array('image/gif', 'image/jpeg', 'image/png', 'application/zip');
+ $this->allowedExtensions = array('gif', 'jpeg', 'jpg', 'png', 'zip');
}
protected function storeUploadedFile($target, $mimeType, $uid)
@@ -230,6 +230,13 @@ private function getImageDim () {
case'image/gif':
$img = imagecreatefromgif($this->imagePath);
break;
+
+ case'application/zip':
+ $this->imageWidth = 0;
+ $this->imageHeight = 0;
+ // $img = imagecreatefromgif($this->imagePath);
+ break;
+
default:
$this->imageWidth = 0;
$this->imageHeight = 0;
diff --git a/class/Form/UploadForm.php b/class/Form/UploadForm.php
index 9268eda..353fc42 100644
--- a/class/Form/UploadForm.php
+++ b/class/Form/UploadForm.php
@@ -36,7 +36,7 @@
/**
* Class FieldForm
*/
-class FieldForm extends \XoopsThemeForm
+class UploadForm extends \XoopsThemeForm
{
public $targetObject;
diff --git a/include/common.php b/include/common.php
index 2509acb..bc19b07 100644
--- a/include/common.php
+++ b/include/common.php
@@ -56,6 +56,7 @@
define($moduleDirNameUpper . '_PATH', XOOPS_ROOT_PATH . '/modules/' . $moduleDirName . '/');
define($moduleDirNameUpper . '_URL', XOOPS_URL . '/modules/' . $moduleDirName . '/');
define($moduleDirNameUpper . '_IMAGE_URL', constant($moduleDirNameUpper . '_URL') . '/assets/images/');
+ define($moduleDirNameUpper . '_ICONS_URL', constant($moduleDirNameUpper . '_URL') . '/assets/icons/');
define($moduleDirNameUpper . '_IMAGE_PATH', constant($moduleDirNameUpper . '_ROOT_PATH') . '/assets/images');
define($moduleDirNameUpper . '_ADMIN_URL', constant($moduleDirNameUpper . '_URL') . '/admin/');
define($moduleDirNameUpper . '_ADMIN_PATH', constant($moduleDirNameUpper . '_ROOT_PATH') . '/admin/');
diff --git a/upload.php b/upload.php
index e7d81d7..d95d950 100644
--- a/upload.php
+++ b/upload.php
@@ -39,18 +39,17 @@
$categoryObj = $categoryHandler->create();
}
-if ($permissionsHandler->permGlobalSubmit()) {
-// $form = $categoryObj->getFormUploadToAlbum();
+//if ($permissionsHandler->permGlobalSubmit()) {
+ // $form = $categoryObj->getFormUploadToAlbum();
- $form = new XoopsModules\Tdmdownloads\Form\FieldForm();
-// $form->display();
+ $form = new \XoopsModules\Tdmdownloads\Form\UploadForm($categoryObj);
$GLOBALS['xoopsTpl']->assign('form', $form->render());
if (0 < $albId) {
$GLOBALS['xoopsTpl']->assign('albId', $albId);
- $albumObj = $categoryHandler->get($albId);
+ $categoryObj = $categoryHandler->get($albId);
// get config for file type/extenstion
$fileextions = $helper->getConfig('fileext');
$mimetypes = [];
@@ -74,6 +73,10 @@
case 'tif':
$mimetypes['image/tiff'] = 'image/tiff';
break;
+
+ case 'zip':
+ $mimetypes['application/zip'] = 'application/zip';
+
case 'else':
default:
@@ -104,9 +107,9 @@
$xoopsTpl->assign('img_maxsize', $helper->getConfig('maxsize'));
$xoopsTpl->assign('img_maxwidth', $helper->getConfig('maxwidth'));
$xoopsTpl->assign('img_maxheight', $helper->getConfig('maxheight'));
- $xoopsTpl->assign('img_albname', $albumObj->getVar('alb_name'));
- $xoopsTpl->assign('allowedfileext', $albumObj->getVar('allowedfileext'));
- $xoopsTpl->assign('allowedmimetypes', $albumObj->getVar('allowedmimetypes'));
+ $xoopsTpl->assign('img_albname', $categoryObj->getVar('alb_name'));
+ $xoopsTpl->assign('allowedfileext', $categoryObj->getVar('allowedfileext'));
+ $xoopsTpl->assign('allowedmimetypes', $categoryObj->getVar('allowedmimetypes'));
$payload = [
'aud' => 'ajaxfineupload.php',
'cat' => $albId,
@@ -124,7 +127,7 @@
}
$xoopsTpl->assign('fineup_debug', $fineup_debug);
}
-}
+//}
// Breadcrumbs
$xoBreadcrumbs[] = ['title' => constant('CO_' . $moduleDirNameUpper . '_IMAGES_UPLOAD')];
From 1f9dff6317deeebba6c414c17be09ce2ccd170a9 Mon Sep 17 00:00:00 2001
From: mambax7
');
- $imgpath = sprintf(AM_TDMDOWNLOADS_FORMIMAGE_PATH, $uploadDir);
+ $imgtray = new \XoopsFormElementTray(constant('CO_' . $moduleDirNameUpper . '_' . 'FIELD_IMG'), '
');
+ $imgpath = sprintf(constant('CO_' . $moduleDirNameUpper . '_' . 'FORMIMAGE_PATH'), $uploadDir);
$imageselect = new \XoopsFormSelect($imgpath, 'img', $img);
$imageArray = \XoopsLists::getImgListAsArray(XOOPS_ROOT_PATH . $uploadDir);
foreach ($imageArray as $image) {
$imageselect->addOption((string)$image, $image);
}
+
+
$imageselect->setExtra("onchange='showImgSelected(\"image_img\", \"img\", \"" . $uploadDir . '", "", "' . XOOPS_URL . "\")'");
$imgtray->addElement($imageselect);
$imgtray->addElement(new \XoopsFormLabel('', "
"));
$fileseltray = new \XoopsFormElementTray('', '
');
- $fileseltray->addElement(new \XoopsFormFile(AM_TDMDOWNLOADS_FORMUPLOAD, 'img', xoops_getModuleOption('maxsize')));
+ $fileseltray->addElement(new \XoopsFormFile(constant('CO_' . $moduleDirNameUpper . '_' . 'FORMUPLOAD'), 'img', xoops_getModuleOption('maxsize')));
$fileseltray->addElement(new \XoopsFormLabel(''));
$imgtray->addElement($fileseltray);
$this->addElement($imgtray);
// Weight
- $this->addElement(new \XoopsFormText(AM_TDMDOWNLOADS_FIELD_WEIGHT, 'weight', 50, 255, $this->targetObject->getVar('weight')), false);
+ $this->addElement(new \XoopsFormText(constant('CO_' . $moduleDirNameUpper . '_' . 'FIELD_WEIGHT'), 'weight', 50, 255, $this->targetObject->getVar('weight')), false);
// Status
- $this->addElement(new \XoopsFormText(AM_TDMDOWNLOADS_FIELD_STATUS, 'status', 50, 255, $this->targetObject->getVar('status')), false);
+ $this->addElement(new \XoopsFormText(constant('CO_' . $moduleDirNameUpper . '_' . 'FIELD_STATUS'), 'status', 50, 255, $this->targetObject->getVar('status')), false);
// Search
- $this->addElement(new \XoopsFormText(AM_TDMDOWNLOADS_FIELD_SEARCH, 'search', 50, 255, $this->targetObject->getVar('search')), false);
+ $this->addElement(new \XoopsFormText(constant('CO_' . $moduleDirNameUpper . '_' . 'FIELD_SEARCH'), 'search', 50, 255, $this->targetObject->getVar('search')), false);
// Status_def
- $this->addElement(new \XoopsFormText(AM_TDMDOWNLOADS_FIELD_STATUS_DEF, 'status_def', 50, 255, $this->targetObject->getVar('status_def')), false);
+ $this->addElement(new \XoopsFormText(constant('CO_' . $moduleDirNameUpper . '_' . 'FIELD_STATUS_DEF'), 'status_def', 50, 255, $this->targetObject->getVar('status_def')), false);
$this->addElement(new \XoopsFormHidden('op', 'save'));
$this->addElement(new \XoopsFormButton('', 'submit', _SUBMIT, 'submit'));
-*/
+
}
}
diff --git a/header.php b/header.php
index a46f412..44f704d 100644
--- a/header.php
+++ b/header.php
@@ -17,6 +17,7 @@
require dirname(dirname(__DIR__)) . '/mainfile.php';
$moduleDirName = basename(__DIR__);
+$moduleDirNameUpper = mb_strtoupper($moduleDirName);
//require_once XOOPS_ROOT_PATH.'/class/pagenav.php';
//require_once XOOPS_ROOT_PATH . '/class/xoopsformloader.php';
diff --git a/language/english/admin.php b/language/english/admin.php
index de78c11..77097d7 100644
--- a/language/english/admin.php
+++ b/language/english/admin.php
@@ -186,3 +186,5 @@
define('_AM_TDMDOWNLOADS_NUMBYTES', '%s bytes');
//multi-upload
define('_AM_TDMDOWNLOADS_DOWNLOADS_NEW_MULTIUPLOAD', 'New Multi-upload');
+
+
diff --git a/language/english/common.php b/language/english/common.php
index 9347e15..4108f78 100644
--- a/language/english/common.php
+++ b/language/english/common.php
@@ -135,3 +135,18 @@
// Album buttons
define('CO_' . $moduleDirNameUpper . '_' . 'ALBUM_ADD', 'Add Album');
define('CO_' . $moduleDirNameUpper . '_' . 'ALBUM_EDIT', 'Edit Album');
+
+//Uploader
+define('CO_' . $moduleDirNameUpper . '_' . 'FIELD_ADD', 'Edit Field');
+define('CO_' . $moduleDirNameUpper . '_' . 'FIELD_EDIT', 'Add Field');
+define('CO_' . $moduleDirNameUpper . '_' . 'FIELD_TITLE', 'Title');
+define('CO_' . $moduleDirNameUpper . '_' . 'FIELD_FID', 'ID');
+define('CO_' . $moduleDirNameUpper . '_' . 'FORMIMAGE_PATH', 'Image Path');
+define('CO_' . $moduleDirNameUpper . '_' . 'FIELD_IMG', 'Image Field');
+
+
+
+
+
+
+
diff --git a/language/english/main.php b/language/english/main.php
index 35adbe4..75955ad 100644
--- a/language/english/main.php
+++ b/language/english/main.php
@@ -138,3 +138,6 @@
define('_MD_TDMDOWNLOADS_BOOKMARK_TO_BALATARIN', 'Bookmark to Balatarin');
define('_MD_TDMDOWNLOADS_BOOKMARK_TO_GOOGLEPLUS', 'Bookmark to Google Plus');
define('_MD_TDMDOWNLOADS_BOOKMARK_TO_GOOGLEBOOKMARKS', 'Bookmark to Google Bookmarks');
+
+//module admin
+define('_MD_TDMDOWNLOADS_ADMIN', 'Module Admin');
diff --git a/templates/tdmdownloads_footer.tpl b/templates/tdmdownloads_footer.tpl
new file mode 100644
index 0000000..3af2021
--- /dev/null
+++ b/templates/tdmdownloads_footer.tpl
@@ -0,0 +1,23 @@
+<{if $error}>
+
+<{if $xoops_isadmin}>
+
+<{/if}>
+
+<{include file='db:system_notification_select.tpl'}>
+
+<{if $copyright}>
+<{$img_albname}>
<{$img_albname}>
diff --git a/upload.php b/upload.php
index 1d6a1b3..c9df059 100644
--- a/upload.php
+++ b/upload.php
@@ -31,7 +31,7 @@
$GLOBALS['xoopsOption']['template_main'] = $moduleDirName . '_upload.tpl';
include_once XOOPS_ROOT_PATH . '/header.php';
-$GLOBALS['xoopsTpl']->assign('tdmdownloads_icon_url_16', constant($moduleDirNameUpper . '_' . 'ICONS_URL') . '/16'); //TODO
+$GLOBALS['xoopsTpl']->assign('tdmdownloads_icon_url_16', constant($moduleDirNameUpper . '_' . 'ICONS_URL') . '16'); //TODO
$categoryHandler = new \XoopsModules\Tdmdownloads\CategoryHandler();
@@ -42,6 +42,9 @@
$categoryObj = $categoryHandler->create();
}
+$albId = 1; //for testing, comment out later
+$xoopsTpl->assign('multiupload', true);
+
//if ($permissionsHandler->permGlobalSubmit()) {
// $form = $categoryObj->getFormUploadToAlbum();
@@ -128,6 +131,8 @@
$fineup_debug = 'true';
}
$xoopsTpl->assign('fineup_debug', $fineup_debug);
+
+ $xoopsTpl->assign('multiupload', true);
}
//}
diff --git a/xoops_version.php b/xoops_version.php
index fe6d59b..e854aa1 100644
--- a/xoops_version.php
+++ b/xoops_version.php
@@ -183,6 +183,7 @@
['file' => $moduleDirName . '_upload.tpl', 'description' => ''],
['file' => $moduleDirName . '_header.tpl', 'description' => ''],
['file' => $moduleDirName . '_footer.tpl', 'description' => ''],
+ ['file' => $moduleDirName . '_breadcrumbs.tpl', 'description' => ''],
];
// ------------------- Help files ------------------- //
From f4bad400e708ccd2b8298a7811089dc7ef108ff8 Mon Sep 17 00:00:00 2001
From: mambax7
';
$form .= _MB_TDMDOWNLOADS_WHITE . ':
\n";
- $form .= _MB_TDMDOWNLOADS_CHARSDSC . ':
\n";
+ $form .= _MB_TDMDOWNLOADS_CHARSDSC . ':
\n";
$styleSelect = new \XoopsFormSelect('', 'options[9]', $options[9]);
$styleSelect->addOption('default', 'default');
$styleSelect->addOption('simple1', 'simple1');
$styleSelect->addOption('simple4', 'simple4');
$form .= _MB_TDMDOWNLOADS_BLOCKSTYLE . ': ' . $styleSelect->render() . '
';
-
+
array_shift($options);
array_shift($options);
array_shift($options);
diff --git a/class/Common/FineimpuploadHandler.php b/class/Common/FineimpuploadHandler.php
index 617169f..de0508d 100644
--- a/class/Common/FineimpuploadHandler.php
+++ b/class/Common/FineimpuploadHandler.php
@@ -40,6 +40,11 @@
use XoopsModules\Tdmdownloads;
//class FineImpUploadHandler extends \SystemFineUploadHandler
+
+/**
+ * Class FineimpuploadHandler
+ * @package XoopsModules\Tdmdownloads\Common
+ */
class FineimpuploadHandler extends \SystemFineUploadHandler
{
/**
@@ -93,47 +98,61 @@ class FineimpuploadHandler extends \SystemFineUploadHandler
/**
* XoopsFineImUploadHandler constructor.
- * @param stdClass $claims claims passed in JWT header
+ * @param \stdClass $claims claims passed in JWT header
*/
public function __construct(\stdClass $claims)
{
parent::__construct($claims);
- $this->allowedMimeTypes = array('image/gif', 'image/jpeg', 'image/png', 'application/zip');
- $this->allowedExtensions = array('gif', 'jpeg', 'jpg', 'png', 'zip');
+ $this->allowedMimeTypes = ['image/gif', 'image/jpeg', 'image/png', 'application/zip'];
+ $this->allowedExtensions = ['gif', 'jpeg', 'jpg', 'png', 'zip'];
}
+ /**
+ * @param $target
+ * @param $mimeType
+ * @param $uid
+ * @return array|bool
+ */
protected function storeUploadedFile($target, $mimeType, $uid)
{
$moduleDirName = basename(dirname(dirname(__DIR__)));
$moduleDirNameUpper = mb_strtoupper($moduleDirName);
include_once XOOPS_ROOT_PATH .'/modules/'. $moduleDirName .'/header.php';
- include_once XOOPS_ROOT_PATH .'/modules/'. $moduleDirName .'/include/resizer.php';
$this->pathUpload = constant($moduleDirNameUpper . '_' . 'UPLOAD_IMAGE_PATH');
+ $utility = new \XoopsModules\Tdmdownloads\Utility();
+ /** @var \XoopsModules\Tdmdownloads\Helper $helper */
+ $helper = \XoopsModules\Tdmdownloads\Helper::getInstance();
+
+// if ( WGGALLERY_PERM_SUBMITAPPR === $permissionsHandler->permGlobalSubmit()) {
+// $this->permUseralbum = WGGALLERY_STATE_APPROVAL_VAL;
+// } else {
+// $this->permUseralbum = WGGALLERY_STATE_ONLINE_VAL;
+// }
- $this->permUseralbum = 1; //TODO: handle an option, whether images should be online immediately or not
+ $this->permUseralbum = 1; //TODO: handle an option, whether images should be online immediately or not
$pathParts = pathinfo($this->getName());
$this->imageName = uniqid('img', true) . '.' . strtolower($pathParts['extension']);
$this->imageNicename = str_replace(['_', '-'], ' ', $pathParts['filename']);
$this->imageNameLarge = uniqid('imgl', true) . '.' . strtolower($pathParts['extension']);
- $this->imagePath = $this->pathUpload . '/large/' . $this->imageNameLarge;
+ $this->imagePath = $this->pathUpload . '/large/' . $this->imageNameLarge;
if (false === move_uploaded_file($_FILES[$this->inputName]['tmp_name'], $this->imagePath)) {
return false;
}
- $this->imageNameOrig = $_FILES[$this->inputName]['name'];
+ $this->imageNameOrig = $_FILES[$this->inputName]['name'];
$this->imageMimetype = $_FILES[$this->inputName]['type'];
$this->imageSize = $_FILES[$this->inputName]['size'];
- $ret = $this->handleImageDB();
+ $ret = $this->handleImageDB();
if (false === $ret) {
return [
'error' => sprintf(_FAILSAVEIMG, $this->imageNicename)
];
}
-
+
// load watermark settings
$albumObj = $albumsHandler->get($this->claims->cat);
$wmId = $albumObj->getVar('alb_wmid');
@@ -145,33 +164,33 @@ protected function storeUploadedFile($target, $mimeType, $uid)
if ( constant($moduleDirNameUpper . '_' . 'WATERMARK_TARGET_A') === $wmTarget || constant($moduleDirNameUpper . '_' . 'WATERMARK_TARGET_M') === $wmTarget) {$wmTargetM = true;}
if ( constant($moduleDirNameUpper . '_' . 'WATERMARK_TARGET_A') === $wmTarget || constant($moduleDirNameUpper . '_' . 'WATERMARK_TARGET_L') === $wmTarget) {$wmTargetL = true;}
}
-
+
// create medium image
// $ret = $this->resizeImage($this->pathUpload . '/medium/' . $this->imageName, $helper->getConfig('maxwidth_medium'), $helper->getConfig('maxheight_medium'));
- $ret = resizeImage($this->imagePath, $this->pathUpload . '/medium/' . $this->imageName, $helper->getConfig('maxwidth_medium'), $helper->getConfig('maxheight_medium'), $this->imageMimetype);
+ $ret = $utility->resizeImage($this->imagePath, $this->pathUpload . '/medium/' . $this->imageName, $helper->getConfig('maxwidth_medium'), $helper->getConfig('maxheight_medium'), $this->imageMimetype);
if (false === $ret) {
- return ['error' => sprintf(CO_TDMDOWNLOADS_FAILSAVEIMG_MEDIUM, $this->imageNicename)];
+ return ['error' => sprintf(constant($moduleDirNameUpper . '_' . 'FAILSAVEIMG_MEDIUM'), $this->imageNicename)];
}
if ('copy' === $ret) {
- copy($this->pathUpload . '/large/' . $this->imageNameLarge, $this->pathUpload . '/medium/' . $this->imageName);
+ copy($this->pathUpload . '/large/' . $this->imageNameLarge, $this->pathUpload . '/medium/' . $this->imageName);
}
-
+
// create thumb
- // $ret = $this->resizeImage($this->pathUpload . '/thumbs/' . $this->imageName, $helper->getConfig('maxwidth_thumbs'), $helper->getConfig('maxheight_thumbs'));
- $ret = resizeImage($this->imagePath, $this->pathUpload . '/thumbs/' . $this->imageName, $helper->getConfig('maxwidth_thumbs'), $helper->getConfig('maxheight_thumbs'), $this->imageMimetype);
+ // $ret = $this->resizeImage($this->pathUpload . '/thumbs/' . $this->imageName, $helper->getConfig('maxwidth_thumbs'), $helper->getConfig('maxheight_thumbs'));
+ $ret = $utility->resizeImage($this->imagePath, $this->pathUpload . '/thumbs/' . $this->imageName, $helper->getConfig('maxwidth_thumbs'), $helper->getConfig('maxheight_thumbs'), $this->imageMimetype);
if (false === $ret) {
- return ['error' => sprintf(CO_TDMDOWNLOADS_FAILSAVEIMG_THUMBS, $this->imageNicename)];
+ return ['error' => sprintf(constant($moduleDirNameUpper . '_' . 'FAILSAVEIMG_THUMBS'), $this->imageNicename)];
}
if ('copy' === $ret) {
- copy($this->pathUpload . '/large/' . $this->imageNameLarge, $this->pathUpload . '/thumbs/' . $this->imageName);
- }
-
+ copy($this->pathUpload . '/large/' . $this->imageNameLarge, $this->pathUpload . '/thumbs/' . $this->imageName);
+ }
+
// add watermark to large image
if ( true === $wmTargetL) {
$imgWm = $this->pathUpload . '/large/' . $this->imageNameLarge;
$resWm = $watermarksHandler->watermarkImage( $wmId, $imgWm, $imgWm );
if ( true !== $resWm) {
- return ['error' => sprintf(_MA_TDMDOWNLOADS_FAILSAVEWM_LARGE, $this->imageNicename, $resWm)];
+ return ['error' => sprintf(constant($moduleDirNameUpper . '_' . 'FAILSAVEWM_LARGE'), $this->imageNicename, $resWm)];
}
}
// add watermark to medium image
@@ -179,30 +198,33 @@ protected function storeUploadedFile($target, $mimeType, $uid)
$imgWm = $this->pathUpload . '/medium/' . $this->imageName;
$resWm = $watermarksHandler->watermarkImage( $wmId, $imgWm, $imgWm );
if ( true !== $resWm) {
- return ['error' => sprintf(_MA_TDMDOWNLOADS_FAILSAVEWM_MEDIUM, $this->imageNicename, $resWm)];
+ return ['error' => sprintf(constant($moduleDirNameUpper . '_' . 'FAILSAVEWM_MEDIUM'), $this->imageNicename, $resWm)];
}
}
-
+
return ['success' => true, 'uuid' => $uuid];
}
-
-
- private function handleImageDB () {
- include_once XOOPS_ROOT_PATH .'/modules/'. $moduleDirName .'/header.php';
+ /**
+ * @return bool
+ */
+ private function handleImageDB () {
+ $moduleDirName = basename(dirname(dirname(__DIR__)));
+ include_once XOOPS_ROOT_PATH .'/modules/'. $moduleDirName .'/header.php';
global $xoopsUser;
$this->getImageDim();
- $helper = \XoopsModules\Tdmdownloads\Helper::getInstance();
- $imagesHandler = $helper->getHandler('Images');
+ $helper = \XoopsModules\Tdmdownloads\Helper::getInstance();
+// $imagesHandler = $helper->getHandler('Images');
+ $imagesHandler = new \XoopsModules\Tdmdownloads\Common\ImagesHandler();
$imagesObj = $imagesHandler->create();
// Set Vars
$imagesObj->setVar('img_title', $this->imageNicename);
$imagesObj->setVar('img_desc', '');
$imagesObj->setVar('img_name', $this->imageName);
$imagesObj->setVar('img_namelarge', $this->imageNameLarge);
- $imagesObj->setVar('img_nameorig', $this->imageNameOrig);
+ $imagesObj->setVar('img_nameorig', $this->imageNameOrig);
$imagesObj->setVar('img_mimetype', $this->imageMimetype);
$imagesObj->setVar('img_size', $this->imageSize);
$imagesObj->setVar('img_resx', $this->imageWidth);
@@ -211,16 +233,19 @@ private function handleImageDB () {
$imagesObj->setVar('img_state', $this->permUseralbum);
$imagesObj->setVar('img_date', time());
$imagesObj->setVar('img_submitter', $xoopsUser->id());
- $imagesObj->setVar('img_ip', '-');
+ $imagesObj->setVar('img_ip', $_SERVER['REMOTE_ADDR']);
// Insert Data
if ($imagesHandler->insert($imagesObj)) {
- $this->imageId = $imagesHandler->getInsertId;
+ $this->imageId = $imagesHandler->getInsertId();
return true;
}
return false;
}
- private function getImageDim () {
+ /**
+ * @return bool|string
+ */
+ private function getImageDim () {
switch ($this->imageMimetype) {
case'image/png':
@@ -251,79 +276,4 @@ private function getImageDim () {
return true;
}
-
- /**
- * resize image if size exceed given width/height
- * @param string $endfile
- * @param int $max_width
- * @param int $max_height
- * @return string|boolean
- */
-/* private function resizeImage_sav($endfile, $max_width, $max_height){
- // check file extension
- switch ($this->imageMimetype) {
- case'image/png':
- $img = imagecreatefrompng($this->imagePath);
-
- break;
- case'image/jpeg':
- $img = imagecreatefromjpeg($this->imagePath);
- break;
- case'image/gif':
- $img = imagecreatefromgif($this->imagePath);
- break;
- default:
- return 'Unsupported format';
- }
-
- $width = imagesx($img);
- $height = imagesy($img);
-
- if ($width > $max_width || $height > $max_height) {
- // recalc image size based on max_width/max_height
- if ($width > $height) {
- if ($width < $max_width) {
- $new_width = $width;
- } else {
- $new_width = $max_width;
- $divisor = $width / $new_width;
- $new_height = floor($height / $divisor);
- }
- } else if($height < $max_height){
- $new_height = $height;
- } else {
- $new_height = $max_height;
- $divisor = $height / $new_height;
- $new_width = floor($width / $divisor);
- }
-
- // Create a new temporary image.
- $tmpimg = imagecreatetruecolor($new_width, $new_height);
- imagealphablending($tmpimg, false);
- imagesavealpha($tmpimg, true);
-
- // Copy and resize old image into new image.
- imagecopyresampled($tmpimg, $img, 0, 0, 0, 0, $new_width, $new_height, $width, $height);
-
- //compressing the file
- switch ($this->imageMimetype) {
- case'image/png':
- imagepng($tmpimg, $endfile, 0);
- break;
- case'image/jpeg':
- imagejpeg($tmpimg, $endfile, 100);
- break;
- case'image/gif':
- imagegif($tmpimg, $endfile);
- break;
- }
-
- // release the memory
- imagedestroy($tmpimg);
- } else {
- return 'copy';
- }
- imagedestroy($img);
- return true;
- } */
}
diff --git a/class/Common/ImageResizer.php b/class/Common/ImageResizer.php
new file mode 100644
index 0000000..0e65313
--- /dev/null
+++ b/class/Common/ImageResizer.php
@@ -0,0 +1,314 @@
+ - Website:
');
- $imgpath = sprintf(constant('CO_' . $moduleDirNameUpper . '_' . 'FORMIMAGE_PATH'), $uploadDir);
- $imageselect = new \XoopsFormSelect($imgpath, 'img', $img);
- $imageArray = \XoopsLists::getImgListAsArray(XOOPS_ROOT_PATH . $uploadDir);
- foreach ($imageArray as $image) {
- $imageselect->addOption((string)$image, $image);
- }
+ $categoryHandler = new \XoopsModules\Tdmdownloads\CategoryHandler();
+ $start = Request::getInt('start', 0);
+ $catPaginationLimit = $this->helper->getConfig('userpager') ?: 10;
+
+ $criteria = new \CriteriaCompo();
+ $criteria->setOrder('DESC');
+ $criteria->setLimit($catPaginationLimit);
+ $criteria->setStart($start);
+
+ $catCount = $categoryHandler->getCount($criteria);
+ $catArray = $categoryHandler->getAll($criteria);
+
+ // Form Select Category
+ $categoryIdSelect = new \XoopsFormSelect( constant('CO_' . $moduleDirNameUpper . '_' . 'SELECT'), 'cat_title', $this->targetObject->getVar('cat_cid'));
+ $categoryIdSelect->setExtra('onchange="submit()"');
+// $categoryIdSelect->addOption(0, ' ');
+
+ foreach(array_keys($catArray) as $i) {
+ $catName = $catArray[$i]->getVar('cat_title');
+ $catPid = $catArray[$i]->getVar('cat_pid');
+ if ( 0 < $catPid ) {
+ $categoryObj = $categoryHandler->get($catPid);
+ if (is_object( $categoryObj)) {
+ $catName .= ' (' . $categoryObj->getVar('cat_title') . ')';
+ } else {
+ $catName .= ' (' . constant('CO_' . $moduleDirNameUpper . '_' . 'ERROR_CATPID') . ')';
+ }
+ }
+ $categoryIdSelect->addOption($catArray[$i]->getVar('cat_cid'), $catName);
+ }
- $imageselect->setExtra("onchange='showImgSelected(\"image_img\", \"img\", \"" . $uploadDir . '", "", "' . XOOPS_URL . "\")'");
- $imgtray->addElement($imageselect);
- $imgtray->addElement(new \XoopsFormLabel('', "
"));
- $fileseltray = new \XoopsFormElementTray('', '
');
- $fileseltray->addElement(new \XoopsFormFile(constant('CO_' . $moduleDirNameUpper . '_' . 'FORMUPLOAD'), 'img', xoops_getModuleOption('maxsize')));
- $fileseltray->addElement(new \XoopsFormLabel(''));
- $imgtray->addElement($fileseltray);
- $this->addElement($imgtray);
-// // Weight
-// $this->addElement(new \XoopsFormText(constant('CO_' . $moduleDirNameUpper . '_' . 'FIELD_WEIGHT'), 'weight', 50, 255, $this->targetObject->getVar('weight')), false);
-// // Status
-// $this->addElement(new \XoopsFormText(constant('CO_' . $moduleDirNameUpper . '_' . 'FIELD_STATUS'), 'status', 50, 255, $this->targetObject->getVar('status')), false);
-// // Search
-// $this->addElement(new \XoopsFormText(constant('CO_' . $moduleDirNameUpper . '_' . 'FIELD_SEARCH'), 'search', 50, 255, $this->targetObject->getVar('search')), false);
-// // Status_def
-// $this->addElement(new \XoopsFormText(constant('CO_' . $moduleDirNameUpper . '_' . 'FIELD_STATUS_DEF'), 'status_def', 50, 255, $this->targetObject->getVar('status_def')), false);
-
- $this->addElement(new \XoopsFormHidden('op', 'save'));
- $this->addElement(new \XoopsFormButton('', 'submit', _SUBMIT, 'submit'));
+ $this->addElement($categoryIdSelect);
+ unset($categoryCriteria);
+ $this->addElement(new \XoopsFormHidden('start', 0));
+ $this->addElement(new \XoopsFormHidden('limit', 0));
}
}
diff --git a/class/Utility.php b/class/Utility.php
index c9be6b8..e2bef9e 100644
--- a/class/Utility.php
+++ b/class/Utility.php
@@ -26,6 +26,8 @@ class Utility
use Common\FilesManagement; // Files Management Trait
+ use Common\ImageResizer; // ImageResizer Trait
+
/**
* 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
@@ -343,9 +345,10 @@ public static function cleanVars(&$global, $key, $default = '', $type = 'int')
*/
public function getPathTree($mytree, $key, $category_array, $title, $prefix = '')
{
+ /** @var \XoopsObjectTree $mytree */
$categoryParent = $mytree->getAllParent($key);
$categoryParent = array_reverse($categoryParent);
- $path = '';
+ $path = '';
foreach (array_keys($categoryParent) as $j) {
/** @var \XoopsModules\Tdmdownloads\Category[] $categoryParent */
$path .= $categoryParent[$j]->getVar($title) . $prefix;
diff --git a/config/imageconfig.php b/config/imageconfig.php
new file mode 100644
index 0000000..3c26af5
--- /dev/null
+++ b/config/imageconfig.php
@@ -0,0 +1,46 @@
+loadLanguage('common');
+
+// extra module configs
+$modversion['config'][] = [
+ 'name' => 'imageConfigs',
+ 'title' => 'CO_' . $moduleDirNameUpper . '_' . 'IMAGE_CONFIG',
+ 'description' => 'CO_' . $moduleDirNameUpper . '_' . 'IMAGE_CONFIG_DSC',
+ 'formtype' => 'line_break',
+ 'valuetype' => 'textbox',
+ 'default' => 'head'
+];
+
+$modversion['config'][] = [
+ 'name' => 'imageWidth',
+ 'title' => 'CO_' . $moduleDirNameUpper . '_' . 'IMAGE_WIDTH',
+ 'description' => 'CO_' . $moduleDirNameUpper . '_' . 'IMAGE_WIDTH_DSC',
+ 'formtype' => 'textbox',
+ 'valuetype' => 'int',
+ 'default' => 1200
+]; // =1024/16
+
+$modversion['config'][] = [
+ 'name' => 'imageHeight',
+ 'title' => 'CO_' . $moduleDirNameUpper . '_' . 'IMAGE_HEIGHT',
+ 'description' => 'CO_' . $moduleDirNameUpper . '_' . 'IMAGE_HEIGHT_DSC',
+ 'formtype' => 'textbox',
+ 'valuetype' => 'int',
+ 'default' => 800
+]; // =768/16
+
+$modversion['config'][] = [
+ 'name' => 'imageUploadPath',
+ 'title' => 'CO_' . $moduleDirNameUpper . '_' . 'IMAGE_UPLOAD_PATH',
+ 'description' => 'CO_' . $moduleDirNameUpper . '_' . 'IMAGE_UPLOAD_PATH_DSC',
+ 'formtype' => 'textbox',
+ 'valuetype' => 'text',
+ 'default' => 'uploads/' . $modversion['dirname'] . '/images'
+];
+
diff --git a/config/index.html b/config/index.html
new file mode 100644
index 0000000..990cbd6
--- /dev/null
+++ b/config/index.html
@@ -0,0 +1 @@
+
\ No newline at end of file
diff --git a/docs/changelog.txt b/docs/changelog.txt
index a2701fa..0bdedf7 100644
--- a/docs/changelog.txt
+++ b/docs/changelog.txt
@@ -20,6 +20,10 @@
- implemented perm_autoapprove also for modifying on user side (goffy/mage)
- added description to preference maxuploadsize (goffy/mage)
- rebuild file list in search.php (goffy/mage)
+- added external config for images in /config/imageconfig.php (mamba)
+- added fineuploader based on Goffy's wggallery (mamba)
+- added ImageResizer trait based on Goffy's wggallery (mamba)
+
2.0 Alpha 1 [2019-01-05]
@@ -134,7 +138,7 @@ List of improvements:
Informations
- - See the file "lang_diff.txt" for changes in language.
+ - See the file "lang_diff.txt" for changes in language.
Installation:
@@ -182,7 +186,7 @@ List of improvements:
Informations:
- Adding the suffix "cat_" in all fields of the table "tdmdownloads_cat.
- - See the file "lang_diff.txt" for changes in language.
+ - See the file "lang_diff.txt" for changes in language.
1.10 [11.11.2009]
diff --git a/header.php b/header.php
index 44f704d..05b53ff 100644
--- a/header.php
+++ b/header.php
@@ -27,6 +27,8 @@
/** @var \XoopsModules\Tdmdownloads\Helper $helper */
$helper = \XoopsModules\Tdmdownloads\Helper::getInstance();
+$permHelper = new \Xmf\Module\Helper\Permission();
+
$modulePath = XOOPS_ROOT_PATH . '/modules/' . $moduleDirName;
require __DIR__ . '/include/common.php';
$myts = \MyTextSanitizer::getInstance();
diff --git a/language/english/blocksadmin.php b/language/english/blocksadmin.php
index bf10dec..9fc853b 100644
--- a/language/english/blocksadmin.php
+++ b/language/english/blocksadmin.php
@@ -26,7 +26,6 @@
define('_AM_VISIBLE', 'Visible');
define('_AM_VISIBLEIN', 'Visible In');
define('_AM_ACTION', 'Action');
-define('_AM_TITLE', 'Title');
define('_AM_BCACHETIME', 'Cache time');
define('_AM_ACTIVERIGHTS', 'Module administration rights');
define('_AM_ACCESSRIGHTS', 'Module access rights');
diff --git a/language/english/common.php b/language/english/common.php
index 6b54e01..34d2e69 100644
--- a/language/english/common.php
+++ b/language/english/common.php
@@ -119,12 +119,11 @@
//Menu
define('CO_' . $moduleDirNameUpper . '_' . 'ADMENU_MIGRATE', 'Migrate');
-
-define('CO_' . $moduleDirNameUpper . '_FOLDER_YES', 'Folder "%s" exist');
-define('CO_' . $moduleDirNameUpper . '_FOLDER_NO', 'Folder "%s" does not exist. Create the specified folder with CHMOD 777.');
+define('CO_' . $moduleDirNameUpper . '_' . 'FOLDER_YES', 'Folder "%s" exist');
+define('CO_' . $moduleDirNameUpper . '_' . 'FOLDER_NO', 'Folder "%s" does not exist. Create the specified folder with CHMOD 777.');
//Uploader
-define('CO_' . $moduleDirNameUpper . '_' . 'IMAGES_UPLOAD', 'Upload Images');
+define('CO_' . $moduleDirNameUpper . '_' . 'IMAGES_UPLOAD', 'Upload Files');
// ---------------- Errors ----------------
define('CO_' . $moduleDirNameUpper . '_' . 'FAILSAVEIMG_THUMBS', 'Error when creating thumb image: %s');
@@ -133,16 +132,16 @@
define('CO_' . $moduleDirNameUpper . '_' . 'FAILSAVEWM_LARGE', 'Error when adding watermark to large image: %s (reason: %g)');
// Album buttons
-define('CO_' . $moduleDirNameUpper . '_' . 'ALBUM_ADD', 'Add Album');
-define('CO_' . $moduleDirNameUpper . '_' . 'ALBUM_EDIT', 'Edit Album');
+define('CO_' . $moduleDirNameUpper . '_' . 'ALBUM_ADD', 'Add Category');
+define('CO_' . $moduleDirNameUpper . '_' . 'ALBUM_EDIT', 'Edit Category');
//Uploader
-define('CO_' . $moduleDirNameUpper . '_' . 'FIELD_ADD', 'Edit Field');
-define('CO_' . $moduleDirNameUpper . '_' . 'FIELD_EDIT', 'Add Field');
+define('CO_' . $moduleDirNameUpper . '_' . 'FIELD_ADD', 'Add Field');
+define('CO_' . $moduleDirNameUpper . '_' . 'FIELD_EDIT', 'Edit Field');
define('CO_' . $moduleDirNameUpper . '_' . 'FIELD_TITLE', 'Title');
define('CO_' . $moduleDirNameUpper . '_' . 'FIELD_FID', 'ID');
-define('CO_' . $moduleDirNameUpper . '_' . 'FORMIMAGE_PATH', 'Image Path');
-define('CO_' . $moduleDirNameUpper . '_' . 'FIELD_IMG', 'Image Field');
+define('CO_' . $moduleDirNameUpper . '_' . 'FORMIMAGE_PATH', 'File Path');
+define('CO_' . $moduleDirNameUpper . '_' . 'FIELD_IMG', 'File Field');
define('CO_' . $moduleDirNameUpper . '_' . 'FORMUPLOAD', 'Upload');
define('CO_' . $moduleDirNameUpper . '_' . 'FIELD_WEIGHT', 'Weight');
@@ -150,10 +149,27 @@
define('CO_' . $moduleDirNameUpper . '_' . 'FIELD_SEARCH', 'Search');
define('CO_' . $moduleDirNameUpper . '_' . 'FIELD_STATUS_DEF', 'Status Defi');
+// fine uploader
+define('CO_' . $moduleDirNameUpper . '_' . 'FU_SUBMIT', 'Submitting file: ');
+define('CO_' . $moduleDirNameUpper . '_' . 'FU_SUBMITTED', 'File successfully checked, please upload');
+define('CO_' . $moduleDirNameUpper . '_' . 'FU_UPLOAD', 'Upload file: ');
+define('CO_' . $moduleDirNameUpper . '_' . 'FU_FAILED', 'Errors occurred during uploading the file');
+define('CO_' . $moduleDirNameUpper . '_' . 'FU_SUCCEEDED', 'Successfully uploaded all files');
+define('CO_' . $moduleDirNameUpper . '_' . 'SELECT', 'Select Category');
+define('CO_' . $moduleDirNameUpper . '_' . 'ERROR_CATPID', 'Error: parent category not found');
+//image config
+define('CO_' . $moduleDirNameUpper . '_' . 'IMAGE_WIDTH', 'Image Display Width');
+define('CO_' . $moduleDirNameUpper . '_' . 'IMAGE_WIDTH_DSC', 'Display width for image');
+define('CO_' . $moduleDirNameUpper . '_' . 'IMAGE_HEIGHT', 'Image Display Height');
+define('CO_' . $moduleDirNameUpper . '_' . 'IMAGE_HEIGHT_DSC', 'Display height for image');
+define('CO_' . $moduleDirNameUpper . '_' . 'IMAGE_CONFIG', '--- EXTERNAL Image configuration --- ');
+define('CO_' . $moduleDirNameUpper . '_' . 'IMAGE_CONFIG_DSC', '');
+define('CO_' . $moduleDirNameUpper . '_' . 'IMAGE_UPLOAD_PATH', 'Image Upload path');
+define('CO_' . $moduleDirNameUpper . '_' . 'IMAGE_UPLOAD_PATH_DSC', 'Path for uploading images');
diff --git a/language/english/help/help.html b/language/english/help/help.html
index 2235a47..7a56dd7 100644
--- a/language/english/help/help.html
+++ b/language/english/help/help.html
@@ -14,7 +14,7 @@ Description
It uses XOOPS permission and group management, thus allowing a great flexibility in use.
Not available at the moment. diff --git a/language/french/admin.php b/language/french/admin.php index 5e7d9e0..3b4b31b 100644 --- a/language/french/admin.php +++ b/language/french/admin.php @@ -185,4 +185,3 @@ define('_AM_TDMDOWNLOADS_ERROR_BAD_REMOVE', 'Impossible de supprimer %s'); define('_AM_TDMDOWNLOADS_ERROR_NO_PLUGIN', 'Impossible de charger le plug-in'); define('_AM_TDMDOWNLOADS_NUMBYTES', '%s octets'); -define('_AM_TDMDOWNLOADS_NUMBYTES', '%s octets'); diff --git a/language/french/common.php b/language/french/common.php index 6c8ea6f..0085500 100644 --- a/language/french/common.php +++ b/language/french/common.php @@ -119,3 +119,49 @@ //Menu define('CO_' . $moduleDirNameUpper . '_' . 'ADMENU_MIGRATE', 'Migrate'); +define('CO_' . $moduleDirNameUpper . '_' . 'FOLDER_YES', 'Folder "%s" exist'); +define('CO_' . $moduleDirNameUpper . '_' . 'FOLDER_NO', 'Folder "%s" does not exist. Create the specified folder with CHMOD 777.'); + +//Uploader +define('CO_' . $moduleDirNameUpper . '_' . 'IMAGES_UPLOAD', 'Upload Files'); + +// ---------------- Errors ---------------- +define('CO_' . $moduleDirNameUpper . '_' . 'FAILSAVEIMG_THUMBS', 'Error when creating thumb image: %s'); +define('CO_' . $moduleDirNameUpper . '_' . 'FAILSAVEIMG_MEDIUM', 'Error when creating medium image: %s'); +define('CO_' . $moduleDirNameUpper . '_' . 'FAILSAVEWM_MEDIUM', 'Error when adding watermark to medium image: %s (reason: %g)'); +define('CO_' . $moduleDirNameUpper . '_' . 'FAILSAVEWM_LARGE', 'Error when adding watermark to large image: %s (reason: %g)'); + +// Album buttons +define('CO_' . $moduleDirNameUpper . '_' . 'ALBUM_ADD', 'Add Category'); +define('CO_' . $moduleDirNameUpper . '_' . 'ALBUM_EDIT', 'Edit Category'); + +//Uploader +define('CO_' . $moduleDirNameUpper . '_' . 'FIELD_ADD', 'Edit Field'); +define('CO_' . $moduleDirNameUpper . '_' . 'FIELD_EDIT', 'Add Field'); +define('CO_' . $moduleDirNameUpper . '_' . 'FIELD_TITLE', 'Title'); +define('CO_' . $moduleDirNameUpper . '_' . 'FIELD_FID', 'ID'); +define('CO_' . $moduleDirNameUpper . '_' . 'FORMIMAGE_PATH', 'File Path'); +define('CO_' . $moduleDirNameUpper . '_' . 'FIELD_IMG', 'File Field'); + +define('CO_' . $moduleDirNameUpper . '_' . 'FORMUPLOAD', 'Upload'); +define('CO_' . $moduleDirNameUpper . '_' . 'FIELD_WEIGHT', 'Weight'); +define('CO_' . $moduleDirNameUpper . '_' . 'FIELD_STATUS', 'Status'); +define('CO_' . $moduleDirNameUpper . '_' . 'FIELD_SEARCH', 'Search'); +define('CO_' . $moduleDirNameUpper . '_' . 'FIELD_STATUS_DEF', 'Status Defi'); + +// fine uploader +define('CO_' . $moduleDirNameUpper . '_' . 'FU_SUBMIT', 'Submitting file: '); +define('CO_' . $moduleDirNameUpper . '_' . 'FU_SUBMITTED', 'File successfully checked, please upload'); +define('CO_' . $moduleDirNameUpper . '_' . 'FU_UPLOAD', 'Upload file: '); +define('CO_' . $moduleDirNameUpper . '_' . 'FU_FAILED', 'Errors occurred during uploading the file'); +define('CO_' . $moduleDirNameUpper . '_' . 'FU_SUCCEEDED', 'Successfully uploaded all files'); + +//image config +define('CO_' . $moduleDirNameUpper . '_' . 'IMAGE_WIDTH', 'Image Display Width'); +define('CO_' . $moduleDirNameUpper . '_' . 'IMAGE_WIDTH_DSC', 'Display width for image'); +define('CO_' . $moduleDirNameUpper . '_' . 'IMAGE_HEIGHT', 'Image Display Height'); +define('CO_' . $moduleDirNameUpper . '_' . 'IMAGE_HEIGHT_DSC', 'Display height for image'); +define('CO_' . $moduleDirNameUpper . '_' . 'IMAGE_CONFIG', '--- EXTERNAL Image configuration --- '); +define('CO_' . $moduleDirNameUpper . '_' . 'IMAGE_CONFIG_DSC', ''); +define('CO_' . $moduleDirNameUpper . '_' . 'IMAGE_UPLOAD_PATH', 'Image Upload path'); +define('CO_' . $moduleDirNameUpper . '_' . 'IMAGE_UPLOAD_PATH_DSC', 'Path for uploading images'); diff --git a/language/french/help/help.html b/language/french/help/help.html index c91835b..4c87319 100644 --- a/language/french/help/help.html +++ b/language/french/help/help.html @@ -14,7 +14,7 @@
Non disponible pour le moment. diff --git a/language/french/modinfo.php b/language/french/modinfo.php index 7b81392..11876c5 100644 --- a/language/french/modinfo.php +++ b/language/french/modinfo.php @@ -126,7 +126,7 @@ define('_MI_TDMDOWNLOADS_TIMECACHERSS', 'Temps du cache RSS'); define('_MI_TDMDOWNLOADS_TIMECACHERSSDSC', 'Temps de cache pour les pages RSS en minutes'); define('_MI_TDMDOWNLOADS_LOGORSS', 'Logo du site pour les pages RSS'); -define('_MI_TDMDOWNLOADS_PREFERENCE_BREAK_COMNOTI', 'Commentaires et avis'); +//define('_MI_TDMDOWNLOADS_PREFERENCE_BREAK_COMNOTI', 'Commentaires et avis'); // Notifications define('_MI_TDMDOWNLOADS_GLOBAL_NOTIFY', 'Global'); define('_MI_TDMDOWNLOADS_GLOBAL_NOTIFYDSC', 'Options de notification globales pour les téléchargements .'); diff --git a/language/german/blocksadmin.php b/language/german/blocksadmin.php index 7d5018b..fd5a5e5 100644 --- a/language/german/blocksadmin.php +++ b/language/german/blocksadmin.php @@ -26,7 +26,6 @@ define('_AM_VISIBLE', 'Sichtbar'); define('_AM_VISIBLEIN', 'Sichtbar in'); define('_AM_ACTION', 'Aktion'); -define('_AM_TITLE', 'Titel'); define('_AM_BCACHETIME', 'Cache time'); define('_AM_ACTIVERIGHTS', 'Berechtigungen Modulverwaltung'); define('_AM_ACCESSRIGHTS', 'Berechtigungen Modulzugriffe'); diff --git a/language/german/changelog.txt b/language/german/changelog.txt index 320c486..5e0bc5f 100644 --- a/language/german/changelog.txt +++ b/language/german/changelog.txt @@ -42,7 +42,7 @@ List of improvements: Informations - - See the file "lang_diff.txt" for changes in language. + - See the file "lang_diff.txt" for changes in language. Installation: @@ -91,7 +91,7 @@ List of improvements: Informations: - Adding the suffix "cat_" in all fields of the table "tdmdownloads_cat. - - See the file "lang_diff.txt" for changes in language. + - See the file "lang_diff.txt" for changes in language. ------------------------------------------------- Version: 1.10 diff --git a/language/german/common.php b/language/german/common.php index f514cbc..93ccab7 100644 --- a/language/german/common.php +++ b/language/german/common.php @@ -102,6 +102,51 @@ define('CO_' . $moduleDirNameUpper . '_GENERATE', 'Generate'); define('CO_' . $moduleDirNameUpper . '_FILENAME', 'File Name'); //Menu -define('CO_' . $moduleDirNameUpper . '_ADMENU_MIGRATE', 'Migrate'); -define('CO_' . $moduleDirNameUpper . '_FOLDER_YES', 'Folder "%s" exist'); -define('CO_' . $moduleDirNameUpper . '_FOLDER_NO', 'Folder "%s" does not exist. Create the specified folder with CHMOD 777.'); +define('CO_' . $moduleDirNameUpper . '_' . 'ADMENU_MIGRATE', 'Migrate'); +define('CO_' . $moduleDirNameUpper . '_' . 'FOLDER_YES', 'Folder "%s" exist'); +define('CO_' . $moduleDirNameUpper . '_' . 'FOLDER_NO', 'Folder "%s" does not exist. Create the specified folder with CHMOD 777.'); + + +//Uploader +define('CO_' . $moduleDirNameUpper . '_' . 'IMAGES_UPLOAD', 'Upload Files'); + +// ---------------- Errors ---------------- +define('CO_' . $moduleDirNameUpper . '_' . 'FAILSAVEIMG_THUMBS', 'Error when creating thumb image: %s'); +define('CO_' . $moduleDirNameUpper . '_' . 'FAILSAVEIMG_MEDIUM', 'Error when creating medium image: %s'); +define('CO_' . $moduleDirNameUpper . '_' . 'FAILSAVEWM_MEDIUM', 'Error when adding watermark to medium image: %s (reason: %g)'); +define('CO_' . $moduleDirNameUpper . '_' . 'FAILSAVEWM_LARGE', 'Error when adding watermark to large image: %s (reason: %g)'); + +// Album buttons +define('CO_' . $moduleDirNameUpper . '_' . 'ALBUM_ADD', 'Add Category'); +define('CO_' . $moduleDirNameUpper . '_' . 'ALBUM_EDIT', 'Edit Category'); + +//Uploader +define('CO_' . $moduleDirNameUpper . '_' . 'FIELD_ADD', 'Edit Field'); +define('CO_' . $moduleDirNameUpper . '_' . 'FIELD_EDIT', 'Add Field'); +define('CO_' . $moduleDirNameUpper . '_' . 'FIELD_TITLE', 'Title'); +define('CO_' . $moduleDirNameUpper . '_' . 'FIELD_FID', 'ID'); +define('CO_' . $moduleDirNameUpper . '_' . 'FORMIMAGE_PATH', 'File Path'); +define('CO_' . $moduleDirNameUpper . '_' . 'FIELD_IMG', 'File Field'); + +define('CO_' . $moduleDirNameUpper . '_' . 'FORMUPLOAD', 'Upload'); +define('CO_' . $moduleDirNameUpper . '_' . 'FIELD_WEIGHT', 'Weight'); +define('CO_' . $moduleDirNameUpper . '_' . 'FIELD_STATUS', 'Status'); +define('CO_' . $moduleDirNameUpper . '_' . 'FIELD_SEARCH', 'Search'); +define('CO_' . $moduleDirNameUpper . '_' . 'FIELD_STATUS_DEF', 'Status Defi'); + +// fine uploader +define('CO_' . $moduleDirNameUpper . '_' . 'FU_SUBMIT', 'Submitting file: '); +define('CO_' . $moduleDirNameUpper . '_' . 'FU_SUBMITTED', 'File successfully checked, please upload'); +define('CO_' . $moduleDirNameUpper . '_' . 'FU_UPLOAD', 'Upload file: '); +define('CO_' . $moduleDirNameUpper . '_' . 'FU_FAILED', 'Errors occurred during uploading the file'); +define('CO_' . $moduleDirNameUpper . '_' . 'FU_SUCCEEDED', 'Successfully uploaded all files'); + +//image config +define('CO_' . $moduleDirNameUpper . '_' . 'IMAGE_WIDTH', 'Image Display Width'); +define('CO_' . $moduleDirNameUpper . '_' . 'IMAGE_WIDTH_DSC', 'Display width for image'); +define('CO_' . $moduleDirNameUpper . '_' . 'IMAGE_HEIGHT', 'Image Display Height'); +define('CO_' . $moduleDirNameUpper . '_' . 'IMAGE_HEIGHT_DSC', 'Display height for image'); +define('CO_' . $moduleDirNameUpper . '_' . 'IMAGE_CONFIG', '--- EXTERNAL Image configuration --- '); +define('CO_' . $moduleDirNameUpper . '_' . 'IMAGE_CONFIG_DSC', ''); +define('CO_' . $moduleDirNameUpper . '_' . 'IMAGE_UPLOAD_PATH', 'Image Upload path'); +define('CO_' . $moduleDirNameUpper . '_' . 'IMAGE_UPLOAD_PATH_DSC', 'Path for uploading images'); diff --git a/language/german/help/help.html b/language/german/help/help.html index 97cb205..97e4d78 100644 --- a/language/german/help/help.html +++ b/language/german/help/help.html @@ -14,7 +14,7 @@
Not available at the moment. diff --git a/modfile.php b/modfile.php index d2e4966..8be9254 100644 --- a/modfile.php +++ b/modfile.php @@ -163,7 +163,7 @@ $obj->setVar('size', \Xmf\Request::getInt('size', 0, 'POST') . ' ' . \Xmf\Request::getString('type_size', '', 'POST')); // Pour le fichier if (isset($_POST['xoops_upload_file'][0])) { - $uploader = new \XoopsMediaUploader($uploaddir_downloads, $helper->getConfig('mimetype'), $helper->getConfig('maxuploadsize'), null, null); + $uploader = new \XoopsMediaUploader($uploaddir_downloads, $helper->getConfig('mimetypes'), $helper->getConfig('maxuploadsize'), null, null); if ($uploader->fetchMedia($_POST['xoops_upload_file'][0])) { if ($helper->getConfig('newnamedownload')) { $uploader->setPrefix($helper->getConfig('prefixdownloads')); diff --git a/submit.php b/submit.php index fd3a49e..0a8cf88 100644 --- a/submit.php +++ b/submit.php @@ -164,7 +164,7 @@ $obj->setVar('size', \Xmf\Request::getString('size', '', 'POST') . ' ' . \Xmf\Request::getString('type_size', '', 'POST')); // Pour le fichier if (isset($_POST['xoops_upload_file'][0])) { - $uploader = new \XoopsMediaUploader($uploaddir_downloads, $helper->getConfig('mimetype'), $helper->getConfig('maxuploadsize'), null, null); + $uploader = new \XoopsMediaUploader($uploaddir_downloads, $helper->getConfig('mimetypes'), $helper->getConfig('maxuploadsize'), null, null); if ($uploader->fetchMedia($_POST['xoops_upload_file'][0])) { if ($helper->getConfig('newnamedownload')) { $uploader->setPrefix($helper->getConfig('prefixdownloads')); diff --git a/templates/blocks/tdmdownloads_block_new.tpl b/templates/blocks/tdmdownloads_block_new.tpl index b23c662..46bbaea 100644 --- a/templates/blocks/tdmdownloads_block_new.tpl +++ b/templates/blocks/tdmdownloads_block_new.tpl @@ -19,5 +19,5 @@ <{include file='db:tdmdownloads_block_styledefault.tpl' downloads=$downloads}> <{/foreach}> <{/if}> - + diff --git a/templates/blocks/tdmdownloads_block_random.tpl b/templates/blocks/tdmdownloads_block_random.tpl index 619d702..d29d0aa 100644 --- a/templates/blocks/tdmdownloads_block_random.tpl +++ b/templates/blocks/tdmdownloads_block_random.tpl @@ -8,5 +8,5 @@ <{include file='db:tdmdownloads_block_styledefault.tpl' downloads=$downloads}> <{/foreach}> <{/if}> - + diff --git a/templates/blocks/tdmdownloads_block_rating.tpl b/templates/blocks/tdmdownloads_block_rating.tpl index 619d702..d29d0aa 100644 --- a/templates/blocks/tdmdownloads_block_rating.tpl +++ b/templates/blocks/tdmdownloads_block_rating.tpl @@ -8,5 +8,5 @@ <{include file='db:tdmdownloads_block_styledefault.tpl' downloads=$downloads}> <{/foreach}> <{/if}> - + diff --git a/templates/blocks/tdmdownloads_block_styledefault.tpl b/templates/blocks/tdmdownloads_block_styledefault.tpl index 18acd22..d4eb17e 100644 --- a/templates/blocks/tdmdownloads_block_styledefault.tpl +++ b/templates/blocks/tdmdownloads_block_styledefault.tpl @@ -1,8 +1,8 @@
Z*N1vpwAFS
zm@W99qI|LLAQXj01err%#(02eY-fLPz>7Zjk9Cj=!NGBAG^cm
405|deq^LtcLHu!70+G
zv#vXLEwBvLB;YcNo=Sx~e)9pAsR!!+C?rT6piP50ztlrlq;-!<(v*56ppmY$y`Bx&
zp&K&lXL{!ugZ3CGWzDj3exs+Sr^AFMGc%cm?b**LHLa)VRP?;FppuP#x77Q+D@wl*
zMAw=pJdkCD@2Dpac@C8h$k;d@;{KzE3RfbXwoQAE3jx`u{yz2P1!{-rNmj6f^mDnN
z(53nly&aSHSAGT=tW(i5(6&g2A`eId)LiTyFH+8~!ast|jXH5k)t1@nUpF#$lE|v`
zeGc>n!mnHPHTa1$TX%)Ja3^1#XI94zX@=L%%ae2&9<7FOb2*YgO5V9=Bph*EX<&PW
zubO|%5BX{B`{ZKEu+V_^VXHpDMc;JGcVvo1wdrS6RlVQdwsV0J6r~a8Q&Uy464npr
z4La@wtE;P4439?xo+Z3fsw&j
' . sprintf(_AM_BLOCKTAG1, '{X_SITEURL}', XOOPS_URL . '/') . '');
$form->addElement($textarea, true);
$ctype_select = new \XoopsFormSelect(_AM_SYSTEM_BLOCKS_CTYPE, 'bctype', $block['ctype']);
- $ctype_select->addOptionArray([
- 'H' => _AM_SYSTEM_BLOCKS_HTML,
- 'P' => _AM_SYSTEM_BLOCKS_PHP,
- 'S' => _AM_SYSTEM_BLOCKS_AFWSMILE,
- 'T' => _AM_SYSTEM_BLOCKS_AFNOSMILE,
- ]);
+ $ctype_select->addOptionArray(
+ [
+ 'H' => _AM_SYSTEM_BLOCKS_HTML,
+ 'P' => _AM_SYSTEM_BLOCKS_PHP,
+ 'S' => _AM_SYSTEM_BLOCKS_AFWSMILE,
+ 'T' => _AM_SYSTEM_BLOCKS_AFNOSMILE,
+ ]
+ );
$form->addElement($ctype_select);
} else {
if ('' !== $block['template']) {
@@ -69,7 +74,7 @@
$form->addElement(new \XoopsFormLabel(_AM_SYSTEM_BLOCKS_CONTENT, '' . _AM_SYSTEM_BLOCKS_EDITTPL . ''));
} else {
/** @var \XoopsTplfile[] $btemplate2 */
- $btemplate2 = &$tplfileHandler->find('default', 'block', $block['bid']);
+ $btemplate2 = $tplfileHandler->find('default', 'block', $block['bid']);
if (count($btemplate2) > 0) {
$form->addElement(new \XoopsFormLabel(_AM_SYSTEM_BLOCKS_CONTENT, '' . _AM_SYSTEM_BLOCKS_EDITTPL . ''));
}
@@ -80,19 +85,21 @@
}
}
$cache_select = new \XoopsFormSelect(_AM_SYSTEM_BLOCKS_BCACHETIME, 'bcachetime', $block['bcachetime']);
-$cache_select->addOptionArray([
- '0' => _NOCACHE,
- '30' => sprintf(_SECONDS, 30),
- '60' => _MINUTE,
- '300' => sprintf(_MINUTES, 5),
- '1800' => sprintf(_MINUTES, 30),
- '3600' => _HOUR,
- '18000' => sprintf(_HOURS, 5),
- '86400' => _DAY,
- '259200' => sprintf(_DAYS, 3),
- '604800' => _WEEK,
- '2592000' => _MONTH,
- ]);
+$cache_select->addOptionArray(
+ [
+ '0' => _NOCACHE,
+ '30' => sprintf(_SECONDS, 30),
+ '60' => _MINUTE,
+ '300' => sprintf(_MINUTES, 5),
+ '1800' => sprintf(_MINUTES, 30),
+ '3600' => _HOUR,
+ '18000' => sprintf(_HOURS, 5),
+ '86400' => _DAY,
+ '259200' => sprintf(_DAYS, 3),
+ '604800' => _WEEK,
+ '2592000' => _MONTH,
+ ]
+);
$form->addElement($cache_select);
/** @var \XoopsGroupPermHandler $grouppermHandler */
@@ -112,7 +119,7 @@
}
//Submit buttons
-$buttonTray = new \XoopsFormElementTray('', '');
+$buttonTray = new \XoopsFormElementTray('', '');
$submit_button = new \XoopsFormButton('', 'submitblock', _SUBMIT, 'submit');
$buttonTray->addElement($submit_button);
diff --git a/admin/blocksadmin.php b/admin/blocksadmin.php
index 4f2f531..79d59b3 100644
--- a/admin/blocksadmin.php
+++ b/admin/blocksadmin.php
@@ -9,8 +9,8 @@
* @category Module
* @author XOOPS Development Team
* @copyright XOOPS Project
- * @link https://www.xoops.org
- * @license GNU GPL 2 or later (http://www.gnu.org/licenses/gpl-2.0.html)
+ * @link https://xoops.org
+ * @license GNU GPL 2 or later (https://www.gnu.org/licenses/gpl-2.0.html)
*/
use Xmf\Request;
@@ -60,7 +60,7 @@ function listBlocks()
xoops_loadLanguage('admin/blocksadmin', 'system');
xoops_loadLanguage('admin/groups', 'system');
- /** @var XoopsModuleHandler $moduleHandler */
+ /** @var \XoopsModuleHandler $moduleHandler */
$moduleHandler = xoops_getHandler('module');
/** @var \XoopsMemberHandler $memberHandler */
$memberHandler = xoops_getHandler('member');
@@ -76,7 +76,7 @@ function listBlocks()
echo "
" . constant('CO_' . $moduleDirNameUpper . '_' . 'BADMIN') . '
';
$moduleHandler = xoops_getHandler('module');
- echo "