- <{if $bl_date != ""}>
+ <{if $bl_date|default:'' != ''}>
- <{$smarty.const._MD_TDMDOWNLOADS_INDEX_BLDATE}>
+ <{$smarty.const._MD_TDMDOWNLOADS_INDEX_BLDATE}>
|
<{/if}>
- <{if $bl_pop != ""}>
+ <{if $bl_pop|default:'' != ''}>
- <{$smarty.const._MD_TDMDOWNLOADS_INDEX_BLPOP}>
+ <{$smarty.const._MD_TDMDOWNLOADS_INDEX_BLPOP}>
|
<{/if}>
- <{if $bl_rating != ""}>
+ <{if $bl_rating|default:'' != ''}>
- <{$smarty.const._MD_TDMDOWNLOADS_INDEX_BLRATING}>
+ <{$smarty.const._MD_TDMDOWNLOADS_INDEX_BLRATING}>
\ No newline at end of file
+
diff --git a/templates/tdmdownloads_modfile.tpl b/templates/tdmdownloads_modfile.tpl
index d4bccad..c0dda07 100644
--- a/templates/tdmdownloads_modfile.tpl
+++ b/templates/tdmdownloads_modfile.tpl
@@ -2,13 +2,13 @@
-
+
<{$navigation}>
- <{if $message_erreur}>
+ <{if $message_erreur|default:''}>
<{$message_erreur}>
<{/if}>
diff --git a/templates/tdmdownloads_ratefile.tpl b/templates/tdmdownloads_ratefile.tpl
index 0e02755..292bce3 100644
--- a/templates/tdmdownloads_ratefile.tpl
+++ b/templates/tdmdownloads_ratefile.tpl
@@ -2,7 +2,7 @@
-
+
@@ -18,7 +18,7 @@
- <{if $message_erreur}>
+ <{if $message_erreur|default:''}>
<{$message_erreur}>
<{/if}>
diff --git a/templates/tdmdownloads_rss.tpl b/templates/tdmdownloads_rss.tpl
index b60ba1c..b5a8beb 100644
--- a/templates/tdmdownloads_rss.tpl
+++ b/templates/tdmdownloads_rss.tpl
@@ -12,7 +12,7 @@
<{$channel_webmaster}>
<{$channel_language}>
- <{if $image_url != ""}>
+ <{if $image_url|default:'' != ''}>
<{$channel_title}>
<{$image_url}>
diff --git a/templates/tdmdownloads_singlefile.tpl b/templates/tdmdownloads_singlefile.tpl
index e6be16a..cd1f8f3 100644
--- a/templates/tdmdownloads_singlefile.tpl
+++ b/templates/tdmdownloads_singlefile.tpl
@@ -2,7 +2,7 @@
-
+
@@ -22,7 +22,7 @@
<{if $show_screenshot === true}>
- <{if $logourl != ''}>
+ <{if $logourl|default:'' != ''}>
<{/if}>
<{/if}>
@@ -34,7 +34,7 @@
<{$smarty.const._MD_TDMDOWNLOADS_SINGLEFILE_AUTHOR}><{$author}>
<{$hits}>
<{$smarty.const._MD_TDMDOWNLOADS_SINGLEFILE_RATING}><{$rating}><{$votes}>
- <{if $commentsnav != ''}>
+ <{if $commentsnav|default:'' != ''}>
<{/if}>
@@ -46,22 +46,22 @@
<{/if}>
- <{if $perm_vote != ""}>
+ <{if $perm_vote|default:'' != ''}>
<{/if}>
- <{if $perm_modif != ""}>
+ <{if $perm_modif|default:'' != ''}>
<{/if}>
<{$tellafriend_texte}>
- <{if $perm_download != ""}>
+ <{if $perm_download|default:'' != ''}>
<{$smarty.const._MD_TDMDOWNLOADS_INDEX_DLNOW}>
@@ -100,13 +100,13 @@
-
+
@@ -124,45 +124,45 @@
<{$smarty.const._MD_TDMDOWNLOADS_BOOKMARK_ME}>
-
-
-
+
+
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+ href="http://cgi.fark.com/cgi/fark/edit.pl?new_url=<{$mod_url}>/singlefile.php?lid=<{$lid}>&new_comment=<{$downloads.title}>&new_link_other=<{$downloads.title}>&linktype=Misc">
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
<{/if}>
@@ -172,11 +172,11 @@
<{$lang_notice}>
- <{if $comment_mode == "flat"}>
- <{include file="db:system_comments_flat.tpl"}>
- <{elseif $comment_mode == "thread"}>
- <{include file="db:system_comments_thread.tpl"}>
- <{elseif $comment_mode == "nest"}>
+ <{if $comment_mode|default:'' == "flat"}>
+ <{include file="db:system_comments_flat.tpl"}>
+ <{elseif $comment_mode|default:'' == "thread"}>
+ <{include file="db:system_comments_thread.tpl"}>
+ <{elseif $comment_mode|default:'' == "nest"}>
<{include file="db:system_comments_nest.tpl"}>
<{/if}>
diff --git a/templates/tdmdownloads_submit.tpl b/templates/tdmdownloads_submit.tpl
index ec9a486..9d64e41 100644
--- a/templates/tdmdownloads_submit.tpl
+++ b/templates/tdmdownloads_submit.tpl
@@ -2,7 +2,7 @@
-
+
@@ -18,7 +18,7 @@
- <{if $message_erreur}>
+ <{if $message_erreur|default:''}>
<{$message_erreur}>
<{/if}>
diff --git a/templates/tdmdownloads_trigger_uploads.tpl b/templates/tdmdownloads_trigger_uploads.tpl
new file mode 100644
index 0000000..be4ebe2
--- /dev/null
+++ b/templates/tdmdownloads_trigger_uploads.tpl
@@ -0,0 +1,70 @@
+
+
diff --git a/templates/tdmdownloads_upload.tpl b/templates/tdmdownloads_upload.tpl
new file mode 100644
index 0000000..017b28d
--- /dev/null
+++ b/templates/tdmdownloads_upload.tpl
@@ -0,0 +1,113 @@
+<{include file='db:tdmdownloads_header.tpl'}>
+
+<{if $form}>
+ <{$form}>
+<{/if}>
+
+<{if $multiupload}>
+
+ <{include file="db:tdmdownloads_trigger_uploads.tpl"}>
+ <{$categoryname}>
+
+ <{$smarty.const._IMGMAXSIZE}> <{$file_maxsize}>
+ <{$smarty.const._IMGMAXWIDTH}> <{$img_maxwidth}>
+ <{$smarty.const._IMGMAXHEIGHT}> <{$img_maxheight}>
+
+
+<{/if}>
+
+
+
+
+<{include file='db:tdmdownloads_footer.tpl'}>
diff --git a/templates/tdmdownloads_viewcat.tpl b/templates/tdmdownloads_viewcat.tpl
index a8fbc35..c8b9e4e 100644
--- a/templates/tdmdownloads_viewcat.tpl
+++ b/templates/tdmdownloads_viewcat.tpl
@@ -2,13 +2,13 @@
-
+
<{$category_path}>
- <{if $cat_description != ""}>
+ <{if $cat_description|default:'' != ''}>
<{$cat_description}>
<{/if}>
@@ -21,18 +21,18 @@
- <{if $category.image != ""}>
-
+ <{if $category.image|default:'' != ''}>
+
<{/if}>
<{$category.description_main}>
- <{if $category.subcategories != ""}>
+ <{if $category.subcategories|default:'' != ''}>
<{$smarty.const._MD_TDMDOWNLOADS_INDEX_SCAT}>
<{$category.subcategories}>
@@ -51,7 +51,7 @@
<{if $bl_affichage==1}>
@@ -59,43 +59,43 @@
<{$smarty.const._MD_TDMDOWNLOADS_INDEX_BLNAME}>
- <{if $bl_date != ""}>
+ <{if $bl_date|default:'' != ''}>
- <{$smarty.const._MD_TDMDOWNLOADS_INDEX_BLDATE}>
+ <{$smarty.const._MD_TDMDOWNLOADS_INDEX_BLDATE}>
|
<{/if}>
- <{if $bl_pop != ""}>
+ <{if $bl_pop|default:'' != ''}>
- <{$smarty.const._MD_TDMDOWNLOADS_INDEX_BLPOP}>
+ <{$smarty.const._MD_TDMDOWNLOADS_INDEX_BLPOP}>
|
<{/if}>
- <{if $bl_rating != ""}>
+ <{if $bl_rating|default:'' != ''}>
- <{$smarty.const._MD_TDMDOWNLOADS_INDEX_BLRATING}>
+ <{$smarty.const._MD_TDMDOWNLOADS_INDEX_BLRATING}>
@@ -134,38 +134,38 @@
<{$smarty.const._MD_TDMDOWNLOADS_CAT_SORTBY}>
<{$smarty.const._MD_TDMDOWNLOADS_CAT_TITLE}> (
-
-
+
+
-
-
+
+
)
<{$smarty.const._MD_TDMDOWNLOADS_CAT_DATE}>(
-
-
+
+
-
-
+
+
)
<{$smarty.const._MD_TDMDOWNLOADS_CAT_RATING}>(
-
-
+
+
-
-
+
+
)
<{$smarty.const._MD_TDMDOWNLOADS_CAT_POPULARITY}>(
-
-
+
+
-
-
+
+
)
@@ -174,7 +174,7 @@
<{/if}>
- <{if $file != ""}>
+ <{if $file|default:'' != ''}>
<{$smarty.const._MD_TDMDOWNLOADS_CAT_LIST}>
- <{if $pagenav != ''}>
+ <{if $pagenav|default:'' != ''}>
<{$pagenav}>
<{/if}>
diff --git a/testdata/english/group_permission.yml b/testdata/english/group_permission.yml
new file mode 100644
index 0000000..b7924c6
--- /dev/null
+++ b/testdata/english/group_permission.yml
@@ -0,0 +1,115 @@
+-
+ gperm_groupid: '2'
+ gperm_itemid: '32'
+ gperm_modid: '1831'
+ gperm_name: tdmdownloads_ac
+-
+ gperm_groupid: '2'
+ gperm_itemid: '16'
+ gperm_modid: '1831'
+ gperm_name: tdmdownloads_ac
+-
+ gperm_groupid: '2'
+ gperm_itemid: '8'
+ gperm_modid: '1831'
+ gperm_name: tdmdownloads_ac
+-
+ gperm_groupid: '2'
+ gperm_itemid: '4'
+ gperm_modid: '1831'
+ gperm_name: tdmdownloads_ac
+-
+ gperm_groupid: '1'
+ gperm_itemid: '64'
+ gperm_modid: '1831'
+ gperm_name: tdmdownloads_ac
+-
+ gperm_groupid: '1'
+ gperm_itemid: '32'
+ gperm_modid: '1831'
+ gperm_name: tdmdownloads_ac
+-
+ gperm_groupid: '1'
+ gperm_itemid: '16'
+ gperm_modid: '1831'
+ gperm_name: tdmdownloads_ac
+-
+ gperm_groupid: '1'
+ gperm_itemid: '8'
+ gperm_modid: '1831'
+ gperm_name: tdmdownloads_ac
+-
+ gperm_groupid: '1'
+ gperm_itemid: '4'
+ gperm_modid: '1831'
+ gperm_name: tdmdownloads_ac
+-
+ gperm_groupid: '2'
+ gperm_itemid: '2'
+ gperm_modid: '1831'
+ gperm_name: tdmdownloads_download
+-
+ gperm_groupid: '2'
+ gperm_itemid: '1'
+ gperm_modid: '1831'
+ gperm_name: tdmdownloads_download
+-
+ gperm_groupid: '1'
+ gperm_itemid: '2'
+ gperm_modid: '1831'
+ gperm_name: tdmdownloads_download
+-
+ gperm_groupid: '1'
+ gperm_itemid: '1'
+ gperm_modid: '1831'
+ gperm_name: tdmdownloads_download
+-
+ gperm_groupid: '2'
+ gperm_itemid: '2'
+ gperm_modid: '1831'
+ gperm_name: tdmdownloads_submit
+-
+ gperm_groupid: '2'
+ gperm_itemid: '1'
+ gperm_modid: '1831'
+ gperm_name: tdmdownloads_submit
+-
+ gperm_groupid: '1'
+ gperm_itemid: '2'
+ gperm_modid: '1831'
+ gperm_name: tdmdownloads_submit
+-
+ gperm_groupid: '1'
+ gperm_itemid: '1'
+ gperm_modid: '1831'
+ gperm_name: tdmdownloads_submit
+-
+ gperm_groupid: '3'
+ gperm_itemid: '2'
+ gperm_modid: '1831'
+ gperm_name: tdmdownloads_view
+-
+ gperm_groupid: '3'
+ gperm_itemid: '1'
+ gperm_modid: '1831'
+ gperm_name: tdmdownloads_view
+-
+ gperm_groupid: '2'
+ gperm_itemid: '2'
+ gperm_modid: '1831'
+ gperm_name: tdmdownloads_view
+-
+ gperm_groupid: '2'
+ gperm_itemid: '1'
+ gperm_modid: '1831'
+ gperm_name: tdmdownloads_view
+-
+ gperm_groupid: '1'
+ gperm_itemid: '2'
+ gperm_modid: '1831'
+ gperm_name: tdmdownloads_view
+-
+ gperm_groupid: '1'
+ gperm_itemid: '1'
+ gperm_modid: '1831'
+ gperm_name: tdmdownloads_view
diff --git a/testdata/english/index.php b/testdata/english/index.php
new file mode 100644
index 0000000..4ae18fd
--- /dev/null
+++ b/testdata/english/index.php
@@ -0,0 +1,2 @@
+history.go(-1);
diff --git a/testdata/images/index.php b/testdata/images/index.php
new file mode 100644
index 0000000..2ea9b7d
--- /dev/null
+++ b/testdata/images/index.php
@@ -0,0 +1,3 @@
+history.go(-1);
diff --git a/testdata/index.php b/testdata/index.php
index a1d533a..4149986 100644
--- a/testdata/index.php
+++ b/testdata/index.php
@@ -1,4 +1,5 @@
-loadLanguage('common');
switch ($op) {
case 'load':
- loadSampleData();
+ if (Request::hasVar('ok', 'REQUEST') && 1 === Request::getInt('ok', 0)) {
+ if (!$GLOBALS['xoopsSecurity']->check()) {
+ \redirect_header($helper->url('admin/index.php'), 3, implode(',', $GLOBALS['xoopsSecurity']->getErrors()));
+ }
+ loadSampleData();
+ } else {
+ xoops_cp_header();
+ xoops_confirm(['ok' => 1, 'op' => 'load'], 'index.php', \sprintf(\constant('CO_' . $moduleDirNameUpper . '_' . 'LOAD_SAMPLEDATA_CONFIRM')), \constant('CO_' . $moduleDirNameUpper . '_' . 'CONFIRM'), true);
+ xoops_cp_footer();
+ }
break;
case 'save':
saveSampleData();
break;
+ case 'clear':
+ clearSampleData();
+ break;
}
// XMF TableLoad for SAMPLE data
function loadSampleData()
{
- $moduleDirName = basename(dirname(__DIR__));
- $moduleDirNameUpper = mb_strtoupper($moduleDirName); //$capsDirName
- $helper = Tdmdownloads\Helper::getInstance();
- $utility = new Tdmdownloads\Utility();
- $configurator = new Common\Configurator();
- // Load language files
- $helper->loadLanguage('admin');
- $helper->loadLanguage('modinfo');
- $helper->loadLanguage('common');
+ global $xoopsConfig;
+ $moduleDirName = \basename(\dirname(__DIR__));
+ $moduleDirNameUpper = \mb_strtoupper($moduleDirName);
- // $items = \Xmf\Yaml::readWrapped('quotes_data.yml');
- // \Xmf\Database\TableLoad::truncateTable($moduleDirName . '_quotes');
- // \Xmf\Database\TableLoad::loadTableFromArray($moduleDirName . '_quotes', $items);
+ $utility = new Utility();
+ $configurator = new Configurator();
$tables = \Xmf\Module\Helper::getHelper($moduleDirName)->getModule()->getInfo('tables');
+ $language = 'english/';
+ if (\is_dir(__DIR__ . '/' . $xoopsConfig['language'])) {
+ $language = $xoopsConfig['language'] . '/';
+ }
+
+ // load module tables
foreach ($tables as $table) {
- $tabledata = \Xmf\Yaml::readWrapped($table . '.yml');
- \Xmf\Database\TableLoad::truncateTable($table);
- \Xmf\Database\TableLoad::loadTableFromArray($table, $tabledata);
+ $tabledata = Yaml::readWrapped($language . $table . '.yml');
+ TableLoad::truncateTable($table);
+ TableLoad::loadTableFromArray($table, $tabledata);
}
+ // load permissions
+ $table = 'group_permission';
+ $tabledata = Yaml::readWrapped($language . $table . '.yml');
+ $mid = \Xmf\Module\Helper::getHelper($moduleDirName)->getModule()->getVar('mid');
+ loadTableFromArrayWithReplace($table, $tabledata, 'gperm_modid', $mid);
+
// --- COPY test folder files ---------------
- if (is_array($configurator->copyTestFolders) && count($configurator->copyTestFolders) > 0) {
+ if (\is_array($configurator->copyTestFolders) && \count($configurator->copyTestFolders) > 0) {
// $file = dirname(__DIR__) . '/testdata/images/';
- foreach (array_keys($configurator->copyTestFolders) as $i) {
- $src = $configurator->copyTestFolders[$i][0];
+ foreach (\array_keys($configurator->copyTestFolders) as $i) {
+ $src = $configurator->copyTestFolders[$i][0];
$dest = $configurator->copyTestFolders[$i][1];
$utility::rcopy($src, $dest);
}
}
-
- redirect_header('../admin/index.php', 1, constant('CO_' . $moduleDirNameUpper . '_' . 'SAMPLEDATA_SUCCESS'));
+ \redirect_header('../admin/index.php', 1, \constant('CO_' . $moduleDirNameUpper . '_' . 'LOAD_SAMPLEDATA_SUCCESS'));
}
function saveSampleData()
{
- $moduleDirName = basename(dirname(__DIR__));
- $moduleDirNameUpper = mb_strtoupper($moduleDirName);
-
- $tables = \Xmf\Module\Helper::getHelper($moduleDirName)->getModule()->getInfo('tables');
+ global $xoopsConfig;
+ $moduleDirName = \basename(\dirname(__DIR__));
+ $moduleDirNameUpper = \mb_strtoupper($moduleDirName);
+ $helper = Helper::getInstance();
+ $tables = $helper->getModule()->getInfo('tables');
+
+ $languageFolder = __DIR__ . '/' . $xoopsConfig['language'];
+ if (!\file_exists($languageFolder . '/')) {
+ Utility::createFolder($languageFolder . '/');
+ }
+ $exportFolder = $languageFolder . '/Exports-' . date('Y-m-d-H-i-s') . '/';
+ Utility::createFolder($exportFolder);
+ // save module tables
foreach ($tables as $table) {
- \Xmf\Database\TableLoad::saveTableToYamlFile($table, $table . '_' . date('Y-m-d H-i-s') . '.yml');
+ TableLoad::saveTableToYamlFile($table, $exportFolder . $table . '.yml');
}
- redirect_header('../admin/index.php', 1, constant('CO_' . $moduleDirNameUpper . '_' . 'SAMPLEDATA_SUCCESS'));
+ // save permissions
+ $criteria = new \CriteriaCompo();
+ $criteria->add(new \Criteria('gperm_modid', $helper->getModule()->getVar('mid')));
+ $skipColumns[] = 'gperm_id';
+ TableLoad::saveTableToYamlFile('group_permission', $exportFolder . 'group_permission.yml', $criteria, $skipColumns);
+ unset($criteria);
+
+ \redirect_header('../admin/index.php', 1, \constant('CO_' . $moduleDirNameUpper . '_' . 'SAVE_SAMPLEDATA_SUCCESS'));
}
function exportSchema()
{
+ $moduleDirName = \basename(\dirname(__DIR__));
+ $moduleDirNameUpper = \mb_strtoupper($moduleDirName);
+
try {
- $moduleDirName = basename(dirname(__DIR__));
- $moduleDirNameUpper = mb_strtoupper($moduleDirName);
+ // TODO set exportSchema
+ // $migrate = new Migrate($moduleDirName);
+ // $migrate->saveCurrentSchema();
+ //
+ // redirect_header('../admin/index.php', 1, constant('CO_' . $moduleDirNameUpper . '_' . 'EXPORT_SCHEMA_SUCCESS'));
+ } catch (\Throwable $e) {
+ exit(constant('CO_' . $moduleDirNameUpper . '_' . 'EXPORT_SCHEMA_ERROR'));
+ }
+}
- $migrate = new \Xmf\Database\Migrate($moduleDirName);
- $migrate->saveCurrentSchema();
+/**
+ * loadTableFromArrayWithReplace
+ *
+ * @param string $table value with should be used insead of original value of $search
+ *
+ * @param array $data array of rows to insert
+ * Each element of the outer array represents a single table row.
+ * Each row is an associative array in 'column' => 'value' format.
+ * @param string $search name of column for which the value should be replaced
+ * @param $replace
+ * @return int number of rows inserted
+ */
+function loadTableFromArrayWithReplace($table, $data, $search, $replace)
+{
+ /** @var \XoopsMySQLDatabase $db */
+ $db = \XoopsDatabaseFactory::getDatabaseConnection();
+
+ $prefixedTable = $db->prefix($table);
+ $count = 0;
+
+ $sql = 'DELETE FROM ' . $prefixedTable . ' WHERE `' . $search . '`=' . $db->quote($replace);
+
+ $result = $db->queryF($sql);
+
+ if ($result) {
+ foreach ($data as $row) {
+ $insertInto = 'INSERT INTO ' . $prefixedTable . ' (';
+ $valueClause = ' VALUES (';
+ $first = true;
+ foreach ($row as $column => $value) {
+ if ($first) {
+ $first = false;
+ } else {
+ $insertInto .= ', ';
+ $valueClause .= ', ';
+ }
+
+ $insertInto .= $column;
+ if ($search === $column) {
+ $valueClause .= $db->quote($replace);
+ } else {
+ $valueClause .= $db->quote($value);
+ }
+ }
+
+ $sql = $insertInto . ') ' . $valueClause . ')';
+
+ $result = $db->queryF($sql);
+ if (false !== $result) {
+ ++$count;
+ }
+ }
+ }
+ return $count;
+}
- redirect_header('../admin/index.php', 1, constant('CO_' . $moduleDirNameUpper . '_' . 'EXPORT_SCHEMA_SUCCESS'));
- } catch (\Exception $e) {
- exit(constant('CO_' . $moduleDirNameUpper . '_' . 'EXPORT_SCHEMA_ERROR'));
+function clearSampleData()
+{
+ $moduleDirName = \basename(\dirname(__DIR__));
+ $moduleDirNameUpper = \mb_strtoupper($moduleDirName);
+ $helper = Helper::getInstance();
+ // Load language files
+ $helper->loadLanguage('common');
+ $tables = $helper->getModule()->getInfo('tables');
+ // truncate module tables
+ foreach ($tables as $table) {
+ \Xmf\Database\TableLoad::truncateTable($table);
}
+ redirect_header($helper->url('admin/index.php'), 1, constant('CO_' . $moduleDirNameUpper . '_' . 'CLEAR_SAMPLEDATA_OK'));
}
diff --git a/testdata/uploads/blank.png b/testdata/uploads/blank.png
new file mode 100644
index 0000000..e1ee728
Binary files /dev/null and b/testdata/uploads/blank.png differ
diff --git a/testdata/uploads/category/blank.png b/testdata/uploads/category/blank.png
new file mode 100644
index 0000000..e1ee728
Binary files /dev/null and b/testdata/uploads/category/blank.png differ
diff --git a/testdata/uploads/category/index.php b/testdata/uploads/category/index.php
new file mode 100644
index 0000000..4ae18fd
--- /dev/null
+++ b/testdata/uploads/category/index.php
@@ -0,0 +1,2 @@
+history.go(-1);
\ No newline at end of file
diff --git a/testdata/uploads/index.php b/testdata/uploads/index.php
new file mode 100644
index 0000000..2ea9b7d
--- /dev/null
+++ b/testdata/uploads/index.php
@@ -0,0 +1,3 @@
+history.go(-1);
diff --git a/tests/index.php b/tests/index.php
new file mode 100644
index 0000000..2ea9b7d
--- /dev/null
+++ b/tests/index.php
@@ -0,0 +1,3 @@
+ - Website:
+ */
+
+use Xmf\Jwt\TokenFactory;
+use Xmf\Module\Admin;
+use Xmf\Request;
+use XoopsModules\Tdmdownloads\{
+ CategoryHandler,
+ Form\UploadForm
+};
+/** @var \Xmf\Module\Helper\Permission $permHelper */
+
+require_once __DIR__ . '/header.php';
+
+$moduleDirName = basename(__DIR__);
+$moduleDirNameUpper = \mb_strtoupper($moduleDirName);
+
+// It recovered the value of argument op in URL$
+$op = Request::getString('op', 'form');
+$catId = Request::getInt('cat_cid', 0);
+// Template
+$GLOBALS['xoopsOption']['template_main'] = $moduleDirName . '_upload.tpl';
+require_once XOOPS_ROOT_PATH . '/header.php';
+
+$pathIcon16 = Admin::iconUrl('', '16');
+$GLOBALS['xoopsTpl']->assign('pathIcon16', $pathIcon16);
+
+$categoryHandler = new CategoryHandler();
+
+// Form Create
+if (isset($catId)) {
+ $categoryObj = $categoryHandler->get($catId);
+} else {
+ $categoryObj = $categoryHandler->create();
+}
+
+$catId = 1; //for testing, comment out later
+$xoopsTpl->assign('multiupload', true);
+
+$form = new UploadForm($categoryObj);
+$form->setExtra('enctype="multipart/form-data"');
+$GLOBALS['xoopsTpl']->assign('form', $form->render());
+
+$permHelper->checkPermissionRedirect('tdmdownloads_submit', $catId, 'index.php', 3, 'You are not allowed to submit a file', false);
+$permissionUpload = $permHelper->checkPermission('tdmdownloads_submit', $catId, false);
+if ($permissionUpload) {
+ if ($catId > 0) {
+ $GLOBALS['xoopsTpl']->assign('catId', $catId);
+
+ $categoryObj = $categoryHandler->get($catId);
+
+ // get config for file type/extenstion
+
+ $fileextions = $helper->getConfig('mimetypes');
+
+ $mimetypes = [];
+
+ foreach ($fileextions as $fe) {
+ switch ($fe) {
+ case 'jpg':
+ case 'jpeg':
+ case 'jpe':
+ $mimetypes['image/jpeg'] = 'image/jpeg';
+ break;
+ case 'gif':
+ $mimetypes['image/gif'] = 'image/gif';
+ break;
+ case 'png':
+ $mimetypes['image/png'] = 'image/png';
+ break;
+ case 'bmp':
+ $mimetypes['image/bmp'] = 'image/bmp';
+ break;
+ case 'tiff':
+ case 'tif':
+ $mimetypes['image/tiff'] = 'image/tiff';
+ break;
+ case 'zip':
+ $mimetypes['application/zip'] = 'application/zip';
+ break;
+ case 'else':
+ default:
+ break;
+ }
+ }
+
+ $allowedfileext = implode("', '", $fileextions);
+
+ if ('' !== $allowedfileext) {
+ $allowedfileext = "'" . $allowedfileext . "'";
+ }
+
+ $allowedmimetypes = implode("', '", $mimetypes);
+
+ if ('' !== $allowedmimetypes) {
+ $allowedmimetypes = "'" . $allowedmimetypes . "'";
+ }
+
+ // Define Stylesheet
+
+ /** @var xos_opal_Theme $xoTheme */
+
+ $xoTheme->addStylesheet(XOOPS_URL . '/media/fine-uploader/fine-uploader-new.css');
+
+ $xoTheme->addStylesheet(XOOPS_URL . '/media/fine-uploader/ManuallyTriggerUploads.css');
+
+ $xoTheme->addStylesheet(XOOPS_URL . '/media/font-awesome/css/font-awesome.min.css');
+
+ $xoTheme->addStylesheet(XOOPS_URL . '/modules/system/css/admin.css');
+
+ // Define scripts
+
+ $xoTheme->addScript('browse.php?Frameworks/jquery/jquery.js');
+
+ $xoTheme->addScript('modules/system/js/admin.js');
+
+ $xoTheme->addScript('media/fine-uploader/fine-uploader.js');
+
+ // Define Breadcrumb and tips
+
+ $xoopsTpl->assign('multiupload', true);
+
+ // echo $helper->getConfig('mimetypes');
+
+ $xoopsTpl->assign('file_maxsize', $helper->getConfig('maxuploadsize'));
+
+ $xoopsTpl->assign('img_maxwidth', $helper->getConfig('imageWidth'));
+
+ $xoopsTpl->assign('img_maxheight', $helper->getConfig('imageHeight'));
+
+ $xoopsTpl->assign('categoryname', $categoryObj->getVar('cat_title'));
+
+ $xoopsTpl->assign('allowedfileext', $categoryObj->getVar('allowedfileext'));
+
+ $xoopsTpl->assign('allowedmimetypes', $categoryObj->getVar('allowedmimetypes'));
+
+ $payload = [
+ 'aud' => 'ajaxfineupload.php',
+ 'cat' => $catId,
+ 'uid' => $xoopsUser instanceof \XoopsUser ? $xoopsUser->id() : 0,
+ 'handler' => '\XoopsModules\\' . ucfirst($moduleDirName) . '\Common\FineimpuploadHandler',
+ 'moddir' => $moduleDirName,
+ ];
+
+ $jwt = TokenFactory::build('fineuploader', $payload, 60 * 30); // token good for 30 minutes
+
+ $xoopsTpl->assign('jwt', $jwt);
+
+ setcookie('jwt', $jwt);
+
+ $fineup_debug = 'false';
+
+ if (($xoopsUser instanceof \XoopsUser ? $xoopsUser->isAdmin() : false)
+ && isset($_REQUEST['FINEUPLOADER_DEBUG'])) {
+ $fineup_debug = 'true';
+ }
+
+ $xoopsTpl->assign('fineup_debug', $fineup_debug);
+ }
+}
+
+// Breadcrumbs
+$xoBreadcrumbs[] = ['title' => constant('CO_' . $moduleDirNameUpper . '_IMAGES_UPLOAD')];
+//require __DIR__ . '/footer.php';
+require_once XOOPS_ROOT_PATH . '/footer.php';
diff --git a/view.tag.php b/view.tag.php
index 56abb33..239bf08 100644
--- a/view.tag.php
+++ b/view.tag.php
@@ -1,4 +1,5 @@
-setOrder('ASC');
$criteria->add(new \Criteria('cat_cid', '(' . implode(',', $categories) . ')', 'IN'));
$downloadscatArray = $categoryHandler->getAll($criteria);
-$mytree = new \XoopsModules\Tdmdownloads\Tree($downloadscatArray, 'cat_cid', 'cat_pid');
+$mytree = new Tree($downloadscatArray, 'cat_cid', 'cat_pid');
//tableau des téléchargements
$criteria = new \CriteriaCompo();
@@ -56,16 +63,16 @@
$xoopsTpl->assign('lang_thereare', sprintf(_MD_TDMDOWNLOADS_INDEX_THEREARE, count($downloadsArray)));
//navigation
-$navCategory = $utility->getPathTreeUrl($mytree, $cid, $downloadscatArray, 'cat_title', $prefix = ' ', true, 'ASC');
+$navCategory = $utility::getPathTreeUrl($mytree, $cid, $downloadscatArray, 'cat_title', $prefix = ' ', true, 'ASC');
$xoopsTpl->assign('category_path', $navCategory);
// info catégorie
$xoopsTpl->assign('category_id', $cid);
$cat_info = $categoryHandler->get($cid);
$xoopsTpl->assign('cat_description', $cat_info->getVar('cat_description_main'));
-$uploadurl = XOOPS_URL . '/uploads/' . $moduleDirName . '/images/cats/';
+$uploadurl = XOOPS_URL . '/uploads/' . $moduleDirName . '/images/cats/';
$categoryObject = $categoryHandler->get($cid);
-$tempCategory = [
+$tempCategory = [
'image' => $cat_info->getVar('cat_imgurl'),
'id' => $cat_info->getVar('cat_cid'),
'title' => $cat_info->getVar('cat_title'),
@@ -82,32 +89,49 @@
$keywords = '';
foreach (array_keys($downloadscatArray) as $i) {
/** @var \XoopsModules\Tdmdownloads\Category[] $downloadscatArray */
+
if ($downloadscatArray[$i]->getVar('cat_pid') == $cid) {
- $totaldownloads = $utility->getNumbersOfEntries($mytree, $categories, $downloadsArray, $downloadscatArray[$i]->getVar('cat_cid'));
+ $totaldownloads = $utility->getNumbersOfEntries($mytree, $categories, $downloadsArray, $downloadscatArray[$i]->getVar('cat_cid'));
+
$subcategories_arr = $mytree->getFirstChild($downloadscatArray[$i]->getVar('cat_cid'));
- $chcount = 0;
- $subcategories = '';
+
+ $chcount = 0;
+
+ $subcategories = '';
+
//pour les mots clef
+
$keywords .= $downloadscatArray[$i]->getVar('cat_title') . ',';
+
foreach (array_keys($subcategories_arr) as $j) {
/** @var \XoopsModules\Tdmdownloads\Category[] $subcategories_arr */
+
if ($chcount >= $helper->getConfig('nbsouscat')) {
$subcategories .= '[+]';
+
break;
}
+
$subcategories .= '' . $subcategories_arr[$j]->getVar('cat_title') . '';
- $keywords .= $downloadscatArray[$i]->getVar('cat_title') . ',';
+
+ $keywords .= $downloadscatArray[$i]->getVar('cat_title') . ',';
+
++$chcount;
}
- $xoopsTpl->append('subcategories', [
- 'image' => $uploadurl . $downloadscatArray[$i]->getVar('cat_imgurl'),
- 'id' => $downloadscatArray[$i]->getVar('cat_cid'),
- 'title' => $downloadscatArray[$i]->getVar('cat_title'),
- 'description_main' => $downloadscatArray[$i]->getVar('cat_description_main'),
- 'infercategories' => $subcategories,
- 'totaldownloads' => $totaldownloads,
- 'count' => $count,
- ]);
+
+ $xoopsTpl->append(
+ 'subcategories',
+ [
+ 'image' => $uploadurl . $downloadscatArray[$i]->getVar('cat_imgurl'),
+ 'id' => $downloadscatArray[$i]->getVar('cat_cid'),
+ 'title' => $downloadscatArray[$i]->getVar('cat_title'),
+ 'description_main' => $downloadscatArray[$i]->getVar('cat_description_main'),
+ 'infercategories' => $subcategories,
+ 'totaldownloads' => $totaldownloads,
+ 'count' => $count,
+ ]
+ );
+
++$count;
}
}
@@ -117,73 +141,115 @@
//téléchargements récents
if (1 == $helper->getConfig('bldate')) {
$criteria = new \CriteriaCompo();
+
$criteria->add(new \Criteria('status', 0, '!='));
+
$criteria->add(new \Criteria('cid', '(' . implode(',', $categories) . ')', 'IN'));
+
$criteria->add(new \Criteria('cid', \Xmf\Request::getInt('cid', 0, 'REQUEST')));
+
$criteria->setSort('date');
+
$criteria->setOrder('DESC');
+
$criteria->setLimit($helper->getConfig('nbbl'));
+
$downloadsArray = $downloadsHandler->getAll($criteria);
+
foreach (array_keys($downloadsArray) as $i) {
/** @var \XoopsModules\Tdmdownloads\Downloads[] $downloadsArray */
+
$title = $downloadsArray[$i]->getVar('title');
+
if (mb_strlen($title) >= $helper->getConfig('longbl')) {
$title = mb_substr($title, 0, $helper->getConfig('longbl')) . '...';
}
+
$date = formatTimestamp($downloadsArray[$i]->getVar('date'), 's');
- $xoopsTpl->append('bl_date', [
- 'id' => $downloadsArray[$i]->getVar('lid'),
- 'cid' => $downloadsArray[$i]->getVar('cid'),
- 'date' => $date,
- 'title' => $title,
- ]);
+
+ $xoopsTpl->append(
+ 'bl_date',
+ [
+ 'id' => $downloadsArray[$i]->getVar('lid'),
+ 'cid' => $downloadsArray[$i]->getVar('cid'),
+ 'date' => $date,
+ 'title' => $title,
+ ]
+ );
}
}
//plus téléchargés
if (1 == $helper->getConfig('blpop')) {
$criteria = new \CriteriaCompo();
+
$criteria->add(new \Criteria('status', 0, '!='));
+
$criteria->add(new \Criteria('cid', '(' . implode(',', $categories) . ')', 'IN'));
+
$criteria->add(new \Criteria('cid', \Xmf\Request::getInt('cid', 0, 'REQUEST')));
+
$criteria->setSort('hits');
+
$criteria->setOrder('DESC');
+
$criteria->setLimit($helper->getConfig('nbbl'));
+
$downloadsArray = $downloadsHandler->getAll($criteria);
+
foreach (array_keys($downloadsArray) as $i) {
$title = $downloadsArray[$i]->getVar('title');
+
if (mb_strlen($title) >= $helper->getConfig('longbl')) {
$title = mb_substr($title, 0, $helper->getConfig('longbl')) . '...';
}
- $xoopsTpl->append('bl_pop', [
- 'id' => $downloadsArray[$i]->getVar('lid'),
- 'cid' => $downloadsArray[$i]->getVar('cid'),
- 'hits' => $downloadsArray[$i]->getVar('hits'),
- 'title' => $title,
- ]);
+
+ $xoopsTpl->append(
+ 'bl_pop',
+ [
+ 'id' => $downloadsArray[$i]->getVar('lid'),
+ 'cid' => $downloadsArray[$i]->getVar('cid'),
+ 'hits' => $downloadsArray[$i]->getVar('hits'),
+ 'title' => $title,
+ ]
+ );
}
}
//mieux notés
if (1 == $helper->getConfig('blrating')) {
$criteria = new \CriteriaCompo();
+
$criteria->add(new \Criteria('status', 0, '!='));
+
$criteria->add(new \Criteria('cid', '(' . implode(',', $categories) . ')', 'IN'));
+
$criteria->add(new \Criteria('cid', \Xmf\Request::getInt('cid', 0, 'REQUEST')));
+
$criteria->setSort('rating');
+
$criteria->setOrder('DESC');
+
$criteria->setLimit($helper->getConfig('nbbl'));
+
$downloadsArray = $downloadsHandler->getAll($criteria);
+
foreach (array_keys($downloadsArray) as $i) {
$title = $downloadsArray[$i]->getVar('title');
+
if (mb_strlen($title) >= $helper->getConfig('longbl')) {
$title = mb_substr($title, 0, $helper->getConfig('longbl')) . '...';
}
- $rating = number_format($downloadsArray[$i]->getVar('rating'), 1);
- $xoopsTpl->append('bl_rating', [
- 'id' => $downloadsArray[$i]->getVar('lid'),
- 'cid' => $downloadsArray[$i]->getVar('cid'),
- 'rating' => $rating,
- 'title' => $title,
- ]);
+
+ $rating = number_format((float)$downloadsArray[$i]->getVar('rating'), 1);
+
+ $xoopsTpl->append(
+ 'bl_rating',
+ [
+ 'id' => $downloadsArray[$i]->getVar('lid'),
+ 'cid' => $downloadsArray[$i]->getVar('cid'),
+ 'rating' => $rating,
+ 'title' => $title,
+ ]
+ );
}
}
// affichage du résumé
@@ -196,84 +262,126 @@
// affichage des téléchargements
if ($helper->getConfig('perpage') > 0) {
$xoopsTpl->assign('nb_dowcol', $helper->getConfig('nb_dowcol'));
+
//Utilisation d'une copie d'écran avec la largeur selon les préférences
+
if (1 == $helper->getConfig('useshots')) {
$xoopsTpl->assign('shotwidth', $helper->getConfig('shotwidth'));
+
$xoopsTpl->assign('show_screenshot', true);
+
$xoopsTpl->assign('img_float', $helper->getConfig('img_float'));
}
+
$criteria = new \CriteriaCompo();
+
$criteria->add(new \Criteria('status', 0, '!='));
+
$criteria->add(new \Criteria('cid', '(' . implode(',', $categories) . ')', 'IN'));
+
$criteria->add(new \Criteria('cid', \Xmf\Request::getInt('cid', 0, 'REQUEST')));
+
$numrows = $downloadsHandler->getCount($criteria);
+
$xoopsTpl->assign('lang_thereare', sprintf(_MD_TDMDOWNLOADS_CAT_THEREARE, $numrows));
// Pour un affichage sur plusieurs pages
+
if (\Xmf\Request::hasVar('limit', 'REQUEST')) {
$criteria->setLimit(\Xmf\Request::getInt('limit', 0, 'REQUEST'));
+
$limit = \Xmf\Request::getInt('limit', 0, 'REQUEST');
} else {
$criteria->setLimit($helper->getConfig('perpage'));
+
$limit = $helper->getConfig('perpage');
}
+
if (\Xmf\Request::hasVar('start', 'REQUEST')) {
$criteria->setStart(\Xmf\Request::getInt('start', 0, 'REQUEST'));
+
$start = \Xmf\Request::getInt('start', 0, 'REQUEST');
} else {
$criteria->setStart(0);
+
$start = 0;
}
+
if (\Xmf\Request::hasVar('sort', 'REQUEST')) {
$criteria->setSort(\Xmf\Request::getString('sort', '', 'REQUEST'));
+
$sort = \Xmf\Request::getString('sort', '', 'REQUEST');
} else {
$criteria->setSort('date');
+
$sort = 'date';
}
+
if (\Xmf\Request::hasVar('order', 'REQUEST')) {
$criteria->setOrder(\Xmf\Request::getString('order', '', 'REQUEST'));
+
$order = \Xmf\Request::getString('order', '', 'REQUEST');
} else {
$criteria->setOrder('DESC');
+
$order = 'DESC';
}
$downloadsArray = $downloadsHandler->getAll($criteria);
+
if ($numrows > $limit) {
- require_once XOOPS_ROOT_PATH.'/class/pagenav.php';
+ require_once XOOPS_ROOT_PATH . '/class/pagenav.php';
+
$pagenav = new \XoopsPageNav($numrows, $limit, $start, 'start', 'limit=' . $limit . '&cid=' . \Xmf\Request::getInt('cid', 0, 'REQUEST') . '&sort=' . $sort . '&order=' . $order);
+
$pagenav = $pagenav->renderNav(4);
} else {
$pagenav = '';
}
+
$xoopsTpl->assign('pagenav', $pagenav);
- $summary = '';
- $cpt = 0;
+
+ $summary = '';
+
+ $cpt = 0;
+
$categories = $utility->getItemIds('tdmdownloads_download', $moduleDirName);
- $item = $utility->getItemIds('tdmdownloads_download_item', $moduleDirName);
+
+ $item = $utility->getItemIds('tdmdownloads_download_item', $moduleDirName);
+
foreach (array_keys($downloadsArray) as $i) {
if ('blank.gif' === $downloadsArray[$i]->getVar('logourl')) {
$logourl = '';
} else {
$logourl = $downloadsArray[$i]->getVar('logourl');
+
$logourl = $uploadurl_shots . $logourl;
}
- $datetime = formatTimestamp($downloadsArray[$i]->getVar('date'), 's');
- $submitter = \XoopsUser::getUnameFromId($downloadsArray[$i]->getVar('submitter'));
+
+ $datetime = formatTimestamp($downloadsArray[$i]->getVar('date'), 's');
+
+ $submitter = \XoopsUser::getUnameFromId($downloadsArray[$i]->getVar('submitter'));
+
$description = $downloadsArray[$i]->getVar('description');
+
//permet d'afficher uniquement la description courte
+
if (false === mb_strpos($description, '[pagebreak]')) {
$descriptionShort = $description;
} else {
$descriptionShort = mb_substr($description, 0, mb_strpos($description, '[pagebreak]'));
}
+
// pour les vignettes "new" et "mis à jour"
+
$new = $utility->getStatusImage($downloadsArray[$i]->getVar('date'), $downloadsArray[$i]->getVar('status'));
+
$pop = $utility->getPopularImage($downloadsArray[$i]->getVar('hits'));
// Défini si la personne est un admin
+
$adminlink = '';
+
if (is_object($xoopsUser) && $xoopsUser->isAdmin($xoopsModule->mid())) {
$adminlink = '';
}
+
//permission de télécharger
+
$downloadPermission = true;
+
if (1 === $helper->getConfig('permission_download')) {
- if (!in_array($downloadsArray[$i]->getVar('cid'), $categories, true)) {
+ if (!in_array($downloadsArray[$i]->getVar('cid'), $categories)) {
$downloadPermission = false;
}
} else {
- if (!in_array($downloadsArray[$i]->getVar('lid'), $item, true)) {
+ if (!in_array($downloadsArray[$i]->getVar('lid'), $item)) {
$downloadPermission = false;
}
}
+
// utilisation du sommaire
+
++$cpt;
+
$summary = $cpt . '- ' . $downloadsArray[$i]->getVar('title') . ' ';
+
$xoopsTpl->append('summary', ['title' => $summary, 'count' => $cpt]);
- $xoopsTpl->append('file', [
- 'id' => $downloadsArray[$i]->getVar('lid'),
- 'cid' => $downloadsArray[$i]->getVar('cid'),
- 'title' => $downloadsArray[$i]->getVar('title'),
- 'rating' => number_format($downloadsArray[$i]->getVar('rating'), 1),
- 'hits' => $downloadsArray[$i]->getVar('hits'),
- 'new' => $new,
- 'pop' => $pop,
- 'logourl' => $logourl,
- 'updated' => $datetime,
- 'description_short' => $descriptionShort,
- 'adminlink' => $adminlink,
- 'submitter' => $submitter,
- 'perm_download' => $downloadPermission,
- 'count' => $cpt,
- ]);
+ $xoopsTpl->append(
+ 'file',
+ [
+ 'id' => $downloadsArray[$i]->getVar('lid'),
+ 'cid' => $downloadsArray[$i]->getVar('cid'),
+ 'title' => $downloadsArray[$i]->getVar('title'),
+ 'rating' => number_format((float)$downloadsArray[$i]->getVar('rating'), 1),
+ 'hits' => $downloadsArray[$i]->getVar('hits'),
+ 'new' => $new,
+ 'pop' => $pop,
+ 'logourl' => $logourl,
+ 'updated' => $datetime,
+ 'description_short' => $descriptionShort,
+ 'adminlink' => $adminlink,
+ 'submitter' => $submitter,
+ 'perm_download' => $downloadPermission,
+ 'count' => $cpt,
+ ]
+ );
+
//pour les mots clef
+
$keywords .= $downloadsArray[$i]->getVar('title') . ',';
}
if (0 == $numrows) {
$bl_affichage = 0;
}
+
$xoopsTpl->assign('bl_affichage', $bl_affichage);
// affichage du sommaire
+
if ($helper->getConfig('autosummary')) {
if (0 == $numrows) {
$xoopsTpl->assign('aff_summary', false);
@@ -344,40 +466,51 @@
}
// sort menu display
+
if ($numrows > 1) {
$xoopsTpl->assign('navigation', true);
+
$sortorder = $sort . $order;
+
if ('hitsASC' === $sortorder) {
$displaySort = _MD_TDMDOWNLOADS_CAT_POPULARITYLTOM;
}
+
if ('hitsDESC' === $sortorder) {
$displaySort = _MD_TDMDOWNLOADS_CAT_POPULARITYMTOL;
}
+
if ('titleASC' === $sortorder) {
$displaySort = _MD_TDMDOWNLOADS_CAT_TITLEATOZ;
}
+
if ('titleDESC' === $sortorder) {
$displaySort = _MD_TDMDOWNLOADS_CAT_TITLEZTOA;
}
+
if ('dateASC' === $sortorder) {
$displaySort = _MD_TDMDOWNLOADS_CAT_DATEOLD;
}
+
if ('dateDESC' === $sortorder) {
$displaySort = _MD_TDMDOWNLOADS_CAT_DATENEW;
}
+
if ('ratingASC' === $sortorder) {
$displaySort = _MD_TDMDOWNLOADS_CAT_RATINGLTOH;
}
+
if ('ratingDESC' === $sortorder) {
$displaySort = _MD_TDMDOWNLOADS_CAT_RATINGHTOL;
}
+
$xoopsTpl->assign('affichage_tri', sprintf(_MD_TDMDOWNLOADS_CAT_CURSORTBY, $displaySort));
}
}
// référencement
// titre de la page
-$pagetitle = $utility->getPathTreeUrl($mytree, $cid, $downloadscatArray, 'cat_title', $prefix = ' - ', false, 'DESC');
+$pagetitle = $utility::getPathTreeUrl($mytree, $cid, $downloadscatArray, 'cat_title', $prefix = ' - ', false, 'DESC');
$xoopsTpl->assign('xoops_pagetitle', $pagetitle);
//description
$xoTheme->addMeta('meta', 'description', strip_tags($downloadscatArray[$cid]->getVar('cat_description_main')));
diff --git a/visit.php b/visit.php
index 1b4a23c..09b4169 100644
--- a/visit.php
+++ b/visit.php
@@ -1,4 +1,5 @@
-getItemIds('tdmdownloads_view', $moduleDirName);
-if (!in_array($viewDownloads->getVar('cid'), $categories, true)) {
+if (!in_array($viewDownloads->getVar('cid'), $categories)) {
redirect_header(XOOPS_URL, 2, _NOPERM);
}
//redirection si pas de permission (télécharger)
if (2 == $helper->getConfig('permission_download')) {
$item = $utility->getItemIds('tdmdownloads_download_item', $moduleDirName);
- if (!in_array($viewDownloads->getVar('lid'), $item, true)) {
+
+ if (!in_array($viewDownloads->getVar('lid'), $item)) {
redirect_header('singlefile.php?lid=' . $viewDownloads->getVar('lid'), 2, _MD_TDMDOWNLOADS_SINGLEFILE_NOPERMDOWNLOAD);
}
} else {
$categories = $utility->getItemIds('tdmdownloads_download', $moduleDirName);
- if (!in_array($viewDownloads->getVar('cid'), $categories, true)) {
+
+ if (!in_array($viewDownloads->getVar('cid'), $categories)) {
redirect_header('singlefile.php?lid=' . $viewDownloads->getVar('lid'), 2, _MD_TDMDOWNLOADS_SINGLEFILE_NOPERMDOWNLOAD);
}
}
//check download limit option
if (1 == $helper->getConfig('downlimit')) {
- $limitlid = $helper->getConfig('limitlid');
+ $limitlid = $helper->getConfig('limitlid');
+
$limitglobal = $helper->getConfig('limitglobal');
- $yesterday = strtotime(formatTimestamp(time() - 86400));
+
+ $yesterday = strtotime(formatTimestamp(time() - 86400));
+
if ($limitlid > 0) {
$criteria = new \CriteriaCompo();
+
if ($xoopsUser) {
$criteria->add(new \Criteria('downlimit_uid', $xoopsUser->getVar('uid'), '='));
} else {
$criteria->add(new \Criteria('downlimit_hostname', getenv('REMOTE_ADDR'), '='));
}
+
$criteria->add(new \Criteria('downlimit_lid', $lid, '='));
+
$criteria->add(new \Criteria('downlimit_date', $yesterday, '>'));
+
$numrows = $downlimitHandler->getCount($criteria);
+
if ($numrows >= $limitlid) {
redirect_header('singlefile.php?lid=' . $viewDownloads->getVar('lid'), 5, sprintf(_MD_TDMDOWNLOADS_SINGLEFILE_LIMITLID, $numrows, $limitlid));
}
}
+
if ($limitglobal > 0) {
$criteria = new \CriteriaCompo();
+
if ($xoopsUser) {
$criteria->add(new \Criteria('downlimit_uid', $xoopsUser->getVar('uid'), '='));
} else {
$criteria->add(new \Criteria('downlimit_hostname', getenv('REMOTE_ADDR'), '='));
}
+
$criteria->add(new \Criteria('downlimit_date', $yesterday, '>'));
+
$numrows = $downlimitHandler->getCount($criteria);
+
if ($numrows >= $limitglobal) {
redirect_header('singlefile.php?lid=' . $viewDownloads->getVar('lid'), 5, sprintf(_MD_TDMDOWNLOADS_SINGLEFILE_LIMITGLOBAL, $numrows, $limitglobal));
}
}
/** @var \XoopsModules\Tdmdownloads\Downlimit $obj */
+
$obj = $downlimitHandler->create();
+
$obj->setVar('downlimit_lid', $lid);
+
$obj->setVar('downlimit_uid', !empty($xoopsUser) ? $xoopsUser->getVar('uid') : 0);
+
$obj->setVar('downlimit_hostname', getenv('REMOTE_ADDR'));
+
$obj->setVar('downlimit_date', strtotime(formatTimestamp(time())));
+
$downlimitHandler->insert($obj) || $obj->getHtmlErrors();
+
// purge
+
$criteria = new \CriteriaCompo();
+
$criteria->add(new \Criteria('downlimit_date', time() - 172800, '<'));
+
$numrows = $downlimitHandler->getCount($criteria);
+
echo 'a détruire: ' . $numrows . ' ';
+
$downlimitHandler->deleteAll($criteria);
}
@$xoopsLogger->activated = false;
error_reporting(0);
if ($helper->getConfig('check_host')) {
- $goodhost = 0;
- $referer = parse_url(xoops_getenv('HTTP_REFERER'));
+ $goodhost = 0;
+
+ $referer = parse_url(xoops_getenv('HTTP_REFERER'));
+
$refererHost = $referer['host'];
+
foreach ($helper->getConfig('referers') as $ref) {
if (!empty($ref) && preg_match('/' . $ref . '/i', $refererHost)) {
$goodhost = '1';
+
break;
}
}
+
if (!$goodhost) {
redirect_header(XOOPS_URL . "/modules/$moduleDirName/singlefile.php?cid=$cid&lid=$lid", 30, _MD_TDMDOWNLOADS_NOPERMISETOLINK);
}
@@ -112,10 +148,11 @@
$sql = sprintf('UPDATE %s SET hits = hits+1 WHERE lid = %u AND status > 0', $xoopsDB->prefix('tdmdownloads_downloads'), $lid);
$xoopsDB->queryF($sql);
-$url = $viewDownloads->getVar('url', 'n');
-$contentLength = $utility::StringSizeConvert($viewDownloads->getVar('size'));
+$url = $viewDownloads->getVar('url', 'n');
+$contentLength = $utility::convertStringToSize($viewDownloads->getVar('size'));
if (!preg_match("/^ed2k*:\/\//i", $url)) {
- header("Content-Length: $contentLength");
+ header("Content-Length: $contentLength");
+
header("Location: $url");
}
echo '';
diff --git a/xoops_version.php b/xoops_version.php
index 80b3f51..b8b3900 100644
--- a/xoops_version.php
+++ b/xoops_version.php
@@ -1,4 +1,5 @@
- _MI_TDMDOWNLOADS_NAME,
- 'version' => '2.0',
- 'module_status' => 'RC 1',
- 'release_date' => '2019/01/31',
- 'description' => _MI_TDMDOWNLOADS_DESC,
- 'credits' => 'Mage, Mamba, Goffy',
- 'author' => 'Mage',
- 'nickname' => 'Mage',
- 'module_website_url' => 'www.xoops.org',
+ 'name' => _MI_TDMDOWNLOADS_NAME,
+ 'version' => '2.01',
+ 'module_status' => 'Beta 1',
+ 'release_date' => '2021/08/08',
+ 'description' => _MI_TDMDOWNLOADS_DESC,
+ 'credits' => 'Mage, Mamba, Goffy, Heyula',
+ 'author' => 'Mage',
+ 'nickname' => 'Mage',
+ 'module_website_url' => 'www.xoops.org',
'module_website_name' => 'Support site',
- 'help' => 'page=help',
- 'license' => 'GNU GPL 2.0 or later',
- 'license_url' => 'www.gnu.org/licenses/gpl-2.0.html',
- 'official' => 0,
+ 'help' => 'page=help',
+ 'license' => 'GNU GPL 2.0 or later',
+ 'license_url' => 'www.gnu.org/licenses/gpl-2.0.html',
+ 'official' => 0,
// ------------------- Folders & Files -------------------
- 'dirname' => $moduleDirName,
- 'image' => 'assets/images/logoModule.png',
- 'modicons16' => 'assets/images/icons/16',
- 'modicons32' => 'assets/images/icons/32',
- 'release_file' => XOOPS_URL . '/modules/' . $moduleDirName . '/docs/changelog.txt',
- 'onInstall' => 'include/oninstall.php',
- 'onUpdate' => 'include/onupdate.php',
+ 'dirname' => $moduleDirName,
+ 'image' => 'assets/images/logoModule.png',
+ 'modicons16' => 'assets/images/icons/16',
+ 'modicons32' => 'assets/images/icons/32',
+ 'release_file' => XOOPS_URL . '/modules/' . $moduleDirName . '/docs/changelog.txt',
+ 'onInstall' => 'include/oninstall.php',
+ 'onUpdate' => 'include/onupdate.php',
// ------------------- Min Requirements -------------------
- 'min_php' => '7.0',
- 'min_xoops' => '2.5.9',
- 'min_admin' => '1.1',
- 'min_db' => ['mysql' => '5.0.7', 'mysqli' => '5.0.7'],
+ 'min_php' => '7.1',
+ 'min_xoops' => '2.5.10',
+ 'min_admin' => '1.2',
+ 'min_db' => ['mysql' => '5.5'],
// ------------------- Admin Menu -------------------
- 'hasAdmin' => 1,
- 'system_menu' => 1,
- 'adminindex' => 'admin/index.php',
- 'adminmenu' => 'admin/menu.php',
+ 'hasAdmin' => 1,
+ 'system_menu' => 1,
+ 'adminindex' => 'admin/index.php',
+ 'adminmenu' => 'admin/menu.php',
// ------------------- Mysql -------------------
- 'sqlfile' => ['mysql' => 'sql/mysql.sql'],
+ 'sqlfile' => ['mysql' => 'sql/mysql.sql'],
// ------------------- Tables -------------------
- 'tables' => [
+ 'tables' => [
$moduleDirName . '_broken',
$moduleDirName . '_cat',
$moduleDirName . '_downloads',
@@ -72,21 +74,21 @@
],
// ------------------- Menu -------------------
- 'hasMain' => 1,
- 'sub' => [
+ 'hasMain' => 1,
+ 'sub' => [
[
'name' => _MI_TDMDOWNLOADS_SMNAME1,
- 'url' => 'submit.php',
+ 'url' => 'submit.php',
],
[
'name' => _MI_TDMDOWNLOADS_SMNAME2,
- 'url' => 'search.php',
+ 'url' => 'search.php',
],
],
// ------------------- Search -------------------
'hasSearch' => 1,
- 'search' => [
+ 'search' => [
'file' => 'include/search.inc.php',
'func' => 'tdmdownloads_search',
],
@@ -95,63 +97,63 @@
// Pour les blocs
$modversion['blocks'][] = [
- 'file' => 'tdmdownloads_top.php',
- 'name' => _MI_TDMDOWNLOADS_BNAME1,
+ 'file' => 'tdmdownloads_top.php',
+ 'name' => _MI_TDMDOWNLOADS_BNAME1,
'description' => _MI_TDMDOWNLOADS_BNAMEDSC1,
- 'show_func' => 'b_tdmdownloads_top_show',
- 'edit_func' => 'b_tdmdownloads_top_edit',
- 'options' => 'date|10|19|1|1|1|left|90|400|0',
- 'template' => $moduleDirName . '_block_new.tpl',
+ 'show_func' => 'b_tdmdownloads_top_show',
+ 'edit_func' => 'b_tdmdownloads_top_edit',
+ 'options' => 'date|10|19|1|1|1|left|90|400|0',
+ 'template' => $moduleDirName . '_block_new.tpl',
];
$modversion['blocks'][] = [
- 'file' => 'tdmdownloads_top.php',
- 'name' => _MI_TDMDOWNLOADS_BNAME2,
+ 'file' => 'tdmdownloads_top.php',
+ 'name' => _MI_TDMDOWNLOADS_BNAME2,
'description' => _MI_TDMDOWNLOADS_BNAMEDSC2,
- 'show_func' => 'b_tdmdownloads_top_show',
- 'edit_func' => 'b_tdmdownloads_top_edit',
- 'options' => 'hits|10|19|1|1|1|left|90|400|0',
- 'template' => $moduleDirName . '_block_top.tpl',
+ 'show_func' => 'b_tdmdownloads_top_show',
+ 'edit_func' => 'b_tdmdownloads_top_edit',
+ 'options' => 'hits|10|19|1|1|1|left|90|400|0',
+ 'template' => $moduleDirName . '_block_top.tpl',
];
$modversion['blocks'][] = [
- 'file' => 'tdmdownloads_top.php',
- 'name' => _MI_TDMDOWNLOADS_BNAME3,
+ 'file' => 'tdmdownloads_top.php',
+ 'name' => _MI_TDMDOWNLOADS_BNAME3,
'description' => _MI_TDMDOWNLOADS_BNAMEDSC3,
- 'show_func' => 'b_tdmdownloads_top_show',
- 'edit_func' => 'b_tdmdownloads_top_edit',
- 'options' => 'rating|10|19|1|1|1|left|90|400|0',
- 'template' => $moduleDirName . '_block_rating.tpl',
+ 'show_func' => 'b_tdmdownloads_top_show',
+ 'edit_func' => 'b_tdmdownloads_top_edit',
+ 'options' => 'rating|10|19|1|1|1|left|90|400|0',
+ 'template' => $moduleDirName . '_block_rating.tpl',
];
$modversion['blocks'][] = [
- 'file' => 'tdmdownloads_top.php',
- 'name' => _MI_TDMDOWNLOADS_BNAME4,
+ 'file' => 'tdmdownloads_top.php',
+ 'name' => _MI_TDMDOWNLOADS_BNAME4,
'description' => _MI_TDMDOWNLOADS_BNAMEDSC4,
- 'show_func' => 'b_tdmdownloads_top_show',
- 'edit_func' => 'b_tdmdownloads_top_edit',
- 'options' => 'random|10|19|1|1|1|left|90|400|0',
- 'template' => $moduleDirName . '_block_random.tpl',
+ 'show_func' => 'b_tdmdownloads_top_show',
+ 'edit_func' => 'b_tdmdownloads_top_edit',
+ 'options' => 'random|10|19|1|1|1|left|90|400|0',
+ 'template' => $moduleDirName . '_block_random.tpl',
];
$modversion['blocks'][] = [
- 'file' => 'tdmdownloads_search.php',
- 'name' => _MI_TDMDOWNLOADS_BNAME5,
+ 'file' => 'tdmdownloads_search.php',
+ 'name' => _MI_TDMDOWNLOADS_BNAME5,
'description' => _MI_TDMDOWNLOADS_BNAMEDSC5,
- 'show_func' => 'b_tdmdownloads_search_show',
- 'edit_func' => '',
- 'options' => '',
- 'template' => $moduleDirName . '_block_search.tpl',
+ 'show_func' => 'b_tdmdownloads_search_show',
+ 'edit_func' => '',
+ 'options' => '',
+ 'template' => $moduleDirName . '_block_search.tpl',
];
// Commentaires
-$modversion['hasComments'] = 1;
-$modversion['comments']['itemName'] = 'lid';
-$modversion['comments']['pageName'] = 'singlefile.php';
-$modversion['comments']['extraParams'] = ['cid'];
-$modversion['comments']['callbackFile'] = 'include/comment_functions.php';
+$modversion['hasComments'] = 1;
+$modversion['comments']['itemName'] = 'lid';
+$modversion['comments']['pageName'] = 'singlefile.php';
+$modversion['comments']['extraParams'] = ['cid'];
+$modversion['comments']['callbackFile'] = 'include/comment_functions.php';
$modversion['comments']['callback']['approve'] = 'tdmdownloads_com_approve';
-$modversion['comments']['callback']['update'] = 'tdmdownloads_com_update';
+$modversion['comments']['callback']['update'] = 'tdmdownloads_com_update';
// Templates
$modversion['templates'] = [
@@ -181,6 +183,12 @@
['file' => $moduleDirName . '_viewcat.tpl', 'description' => ''],
['file' => $moduleDirName . '_liste.tpl', 'description' => ''],
['file' => $moduleDirName . '_rss.tpl', 'description' => ''],
+ //uploads
+ ['file' => $moduleDirName . '_trigger_uploads.tpl', 'description' => ''],
+ ['file' => $moduleDirName . '_upload.tpl', 'description' => ''],
+ ['file' => $moduleDirName . '_header.tpl', 'description' => ''],
+ ['file' => $moduleDirName . '_footer.tpl', 'description' => ''],
+ ['file' => $moduleDirName . '_breadcrumbs.tpl', 'description' => ''],
];
// ------------------- Help files ------------------- //
@@ -193,151 +201,154 @@
// Préférences
$modversion['config'][] = [
- 'name' => 'break',
- 'title' => '_MI_TDMDOWNLOADS_PREFERENCE_BREAK_GENERAL',
+ 'name' => 'break',
+ 'title' => '_MI_TDMDOWNLOADS_PREFERENCE_BREAK_GENERAL',
'description' => '',
- 'formtype' => 'line_break',
- 'valuetype' => 'textbox',
- 'default' => 'head',
+ 'formtype' => 'line_break',
+ 'valuetype' => 'textbox',
+ 'default' => 'head',
];
$modversion['config'][] = [
- 'name' => 'popular',
- 'title' => '_MI_TDMDOWNLOADS_POPULAR',
+ 'name' => 'popular',
+ 'title' => '_MI_TDMDOWNLOADS_POPULAR',
'description' => '',
- 'formtype' => 'textbox',
- 'valuetype' => 'int',
- 'default' => 100,
+ 'formtype' => 'textbox',
+ 'valuetype' => 'int',
+ 'default' => 100,
];
$modversion['config'][] = [
- 'name' => 'autosummary',
- 'title' => '_MI_TDMDOWNLOADS_AUTO_SUMMARY',
+ 'name' => 'autosummary',
+ 'title' => '_MI_TDMDOWNLOADS_AUTO_SUMMARY',
'description' => '',
- 'formtype' => 'yesno',
- 'valuetype' => 'int',
- 'default' => 0,
+ 'formtype' => 'yesno',
+ 'valuetype' => 'int',
+ 'default' => 0,
];
$modversion['config'][] = [
- 'name' => 'showupdated',
- 'title' => '_MI_TDMDOWNLOADS_SHOW_UPDATED',
+ 'name' => 'showupdated',
+ 'title' => '_MI_TDMDOWNLOADS_SHOW_UPDATED',
'description' => '',
- 'formtype' => 'yesno',
- 'valuetype' => 'int',
- 'default' => 1,
+ 'formtype' => 'yesno',
+ 'valuetype' => 'int',
+ 'default' => 1,
];
$modversion['config'][] = [
- 'name' => 'useshots',
- 'title' => '_MI_TDMDOWNLOADS_USESHOTS',
+ 'name' => 'useshots',
+ 'title' => '_MI_TDMDOWNLOADS_USESHOTS',
'description' => '',
- 'formtype' => 'yesno',
- 'valuetype' => 'int',
- 'default' => 1,
+ 'formtype' => 'yesno',
+ 'valuetype' => 'int',
+ 'default' => 1,
];
$modversion['config'][] = [
- 'name' => 'shotwidth',
- 'title' => '_MI_TDMDOWNLOADS_SHOTWIDTH',
+ 'name' => 'shotwidth',
+ 'title' => '_MI_TDMDOWNLOADS_SHOTWIDTH',
'description' => '',
- 'formtype' => 'textbox',
- 'valuetype' => 'int',
- 'default' => 90,
+ 'formtype' => 'textbox',
+ 'valuetype' => 'int',
+ 'default' => 90,
];
$modversion['config'][] = [
- 'name' => 'img_float',
- 'title' => '_MI_TDMDOWNLOADS_IMGFLOAT',
+ 'name' => 'img_float',
+ 'title' => '_MI_TDMDOWNLOADS_IMGFLOAT',
'description' => '',
- 'formtype' => 'select',
- 'valuetype' => 'text',
- 'default' => 'left',
- 'options' => [_MI_TDMDOWNLOADS_IMGFLOAT_LEFT => 'left', _MI_TDMDOWNLOADS_IMGFLOAT_RIGHT => 'Aaright'],
+ 'formtype' => 'select',
+ 'valuetype' => 'text',
+ 'default' => 'left',
+ 'options' => [_MI_TDMDOWNLOADS_IMGFLOAT_LEFT => 'left', _MI_TDMDOWNLOADS_IMGFLOAT_RIGHT => 'Aaright'],
];
$modversion['config'][] = [
- 'name' => 'platform',
- 'title' => '_MI_TDMDOWNLOADS_PLATEFORM',
+ 'name' => 'platform',
+ 'title' => '_MI_TDMDOWNLOADS_PLATEFORM',
'description' => '_MI_TDMDOWNLOADS_PLATEFORM_DSC',
- 'formtype' => 'textarea',
- 'valuetype' => 'text',
- 'default' => 'None|XOOPS 2.0.x|XOOPS 2.2.x|XOOPS 2.3.x|XOOPS 2.4.x|XOOPS 2.5.x|XOOPS 2.6.x|Other',
+ 'formtype' => 'textarea',
+ 'valuetype' => 'text',
+ 'default' => 'None|XOOPS 2.0.x|XOOPS 2.2.x|XOOPS 2.3.x|XOOPS 2.4.x|XOOPS 2.5.x|XOOPS 2.6.x|Other',
];
$modversion['config'][] = [
- 'name' => 'usetellafriend',
- 'title' => '_MI_TDMDOWNLOADS_USETELLAFRIEND',
+ 'name' => 'usetellafriend',
+ 'title' => '_MI_TDMDOWNLOADS_USETELLAFRIEND',
'description' => '_MI_TDMDOWNLOADS_USETELLAFRIENDDSC',
- 'formtype' => 'yesno',
- 'valuetype' => 'int',
- 'default' => 0,
+ 'formtype' => 'yesno',
+ 'valuetype' => 'int',
+ 'default' => 0,
];
$modversion['config'][] = [
- 'name' => 'usetag',
- 'title' => '_MI_TDMDOWNLOADS_USETAG',
+ 'name' => 'usetag',
+ 'title' => '_MI_TDMDOWNLOADS_USETAG',
'description' => '_MI_TDMDOWNLOADS_USETAGDSC',
- 'formtype' => 'yesno',
- 'valuetype' => 'int',
- 'default' => 0,
+ 'formtype' => 'yesno',
+ 'valuetype' => 'int',
+ 'default' => 0,
];
+//xoops_load('xoopseditorhandler');
+//$editorHandler = \XoopsEditorHandler::getInstance();
+
$modversion['config'][] = [
- 'name' => 'editor',
- 'title' => '_MI_TDMDOWNLOADS_FORM_OPTIONS',
+ 'name' => 'editor',
+ 'title' => '_MI_TDMDOWNLOADS_FORM_OPTIONS',
'description' => '',
- 'formtype' => 'select',
- 'valuetype' => 'text',
- 'default' => 'dhtmltextarea',
- 'options' => array_flip($editorHandler->getList()),
+ 'formtype' => 'select',
+ 'valuetype' => 'text',
+ 'default' => 'dhtmltextarea',
+ 'options' => array_flip($editorHandler->getList()),
];
$modversion['config'][] = [
- 'name' => 'break',
- 'title' => '_MI_TDMDOWNLOADS_PREFERENCE_BREAK_USER',
+ 'name' => 'break',
+ 'title' => '_MI_TDMDOWNLOADS_PREFERENCE_BREAK_USER',
'description' => '',
- 'formtype' => 'line_break',
- 'valuetype' => 'textbox',
- 'default' => 'head',
+ 'formtype' => 'line_break',
+ 'valuetype' => 'textbox',
+ 'default' => 'head',
];
$modversion['config'][] = [
- 'name' => 'perpage',
- 'title' => '_MI_TDMDOWNLOADS_PERPAGE',
+ 'name' => 'perpage',
+ 'title' => '_MI_TDMDOWNLOADS_PERPAGE',
'description' => '',
- 'formtype' => 'textbox',
- 'valuetype' => 'int',
- 'default' => 10,
+ 'formtype' => 'textbox',
+ 'valuetype' => 'int',
+ 'default' => 10,
];
$modversion['config'][] = [
- 'name' => 'nb_dowcol',
- 'title' => '_MI_TDMDOWNLOADS_NBDOWCOL',
+ 'name' => 'nb_dowcol',
+ 'title' => '_MI_TDMDOWNLOADS_NBDOWCOL',
'description' => '',
- 'formtype' => 'select',
- 'valuetype' => 'int',
- 'default' => 1,
- 'options' => ['1' => 1, '2' => 2, '3' => 3, '4' => 4, '5' => 5],
+ 'formtype' => 'select',
+ 'valuetype' => 'int',
+ 'default' => 1,
+ 'options' => ['1' => 1, '2' => 2, '3' => 3, '4' => 4, '5' => 5],
];
$modversion['config'][] = [
- 'name' => 'newdownloads',
- 'title' => '_MI_TDMDOWNLOADS_NEWDLS',
+ 'name' => 'newdownloads',
+ 'title' => '_MI_TDMDOWNLOADS_NEWDLS',
'description' => '',
- 'formtype' => 'textbox',
- 'valuetype' => 'int',
- 'default' => 10,
+ 'formtype' => 'textbox',
+ 'valuetype' => 'int',
+ 'default' => 10,
];
$modversion['config'][] = [
- 'name' => 'toporder',
- 'title' => '_MI_TDMDOWNLOADS_TOPORDER',
+ 'name' => 'toporder',
+ 'title' => '_MI_TDMDOWNLOADS_TOPORDER',
'description' => '',
- 'formtype' => 'select',
- 'valuetype' => 'int',
- 'default' => 1,
- 'options' => [
+ 'formtype' => 'select',
+ 'valuetype' => 'int',
+ 'default' => 1,
+ 'options' => [
'_MI_TDMDOWNLOADS_TOPORDER1' => 1,
'_MI_TDMDOWNLOADS_TOPORDER2' => 2,
'_MI_TDMDOWNLOADS_TOPORDER3' => 3,
@@ -350,22 +361,22 @@
];
$modversion['config'][] = [
- 'name' => 'perpageliste',
- 'title' => '_MI_TDMDOWNLOADS_PERPAGELISTE',
+ 'name' => 'perpageliste',
+ 'title' => '_MI_TDMDOWNLOADS_PERPAGELISTE',
'description' => '',
- 'formtype' => 'textbox',
- 'valuetype' => 'int',
- 'default' => 15,
+ 'formtype' => 'textbox',
+ 'valuetype' => 'int',
+ 'default' => 15,
];
$modversion['config'][] = [
- 'name' => 'searchorder',
- 'title' => '_MI_TDMDOWNLOADS_SEARCHORDER',
+ 'name' => 'searchorder',
+ 'title' => '_MI_TDMDOWNLOADS_SEARCHORDER',
'description' => '',
- 'formtype' => 'select',
- 'valuetype' => 'int',
- 'default' => 8,
- 'options' => [
+ 'formtype' => 'select',
+ 'valuetype' => 'int',
+ 'default' => 8,
+ 'options' => [
'_MI_TDMDOWNLOADS_TOPORDER1' => 1,
'_MI_TDMDOWNLOADS_TOPORDER2' => 2,
'_MI_TDMDOWNLOADS_TOPORDER3' => 3,
@@ -378,295 +389,309 @@
];
$modversion['config'][] = [
- 'name' => 'nbsouscat',
- 'title' => '_MI_TDMDOWNLOADS_SUBCATPARENT',
+ 'name' => 'nbsouscat',
+ 'title' => '_MI_TDMDOWNLOADS_SUBCATPARENT',
'description' => '',
- 'formtype' => 'textbox',
- 'valuetype' => 'int',
- 'default' => 5,
+ 'formtype' => 'textbox',
+ 'valuetype' => 'int',
+ 'default' => 5,
];
$modversion['config'][] = [
- 'name' => 'nb_catcol',
- 'title' => '_MI_TDMDOWNLOADS_NBCATCOL',
+ 'name' => 'nb_catcol',
+ 'title' => '_MI_TDMDOWNLOADS_NBCATCOL',
'description' => '',
- 'formtype' => 'select',
- 'valuetype' => 'int',
- 'default' => 3,
- 'options' => ['1' => 1, '2' => 2, '3' => 3, '4' => 4, '5' => 5],
+ 'formtype' => 'select',
+ 'valuetype' => 'int',
+ 'default' => 3,
+ 'options' => ['1' => 1, '2' => 2, '3' => 3, '4' => 4, '5' => 5],
];
$modversion['config'][] = [
- 'name' => 'bldate',
- 'title' => '_MI_TDMDOWNLOADS_BLDATE',
+ 'name' => 'bldate',
+ 'title' => '_MI_TDMDOWNLOADS_BLDATE',
'description' => '',
- 'formtype' => 'yesno',
- 'valuetype' => 'int',
- 'default' => 1,
+ 'formtype' => 'yesno',
+ 'valuetype' => 'int',
+ 'default' => 1,
];
$modversion['config'][] = [
- 'name' => 'blpop',
- 'title' => '_MI_TDMDOWNLOADS_BLPOP',
+ 'name' => 'blpop',
+ 'title' => '_MI_TDMDOWNLOADS_BLPOP',
'description' => '',
- 'formtype' => 'yesno',
- 'valuetype' => 'int',
- 'default' => 1,
+ 'formtype' => 'yesno',
+ 'valuetype' => 'int',
+ 'default' => 1,
];
$modversion['config'][] = [
- 'name' => 'blrating',
- 'title' => '_MI_TDMDOWNLOADS_BLRATING',
+ 'name' => 'blrating',
+ 'title' => '_MI_TDMDOWNLOADS_BLRATING',
'description' => '',
- 'formtype' => 'yesno',
- 'valuetype' => 'int',
- 'default' => 1,
+ 'formtype' => 'yesno',
+ 'valuetype' => 'int',
+ 'default' => 1,
];
$modversion['config'][] = [
- 'name' => 'nbbl',
- 'title' => '_MI_TDMDOWNLOADS_NBBL',
+ 'name' => 'nbbl',
+ 'title' => '_MI_TDMDOWNLOADS_NBBL',
'description' => '',
- 'formtype' => 'textbox',
- 'valuetype' => 'int',
- 'default' => 5,
+ 'formtype' => 'textbox',
+ 'valuetype' => 'int',
+ 'default' => 5,
];
$modversion['config'][] = [
- 'name' => 'longbl',
- 'title' => '_MI_TDMDOWNLOADS_LONGBL',
+ 'name' => 'longbl',
+ 'title' => '_MI_TDMDOWNLOADS_LONGBL',
'description' => '',
- 'formtype' => 'textbox',
- 'valuetype' => 'int',
- 'default' => 20,
+ 'formtype' => 'textbox',
+ 'valuetype' => 'int',
+ 'default' => 20,
];
$modversion['config'][] = [
- 'name' => 'show_bookmark',
- 'title' => '_MI_TDMDOWNLOADS_BOOKMARK',
+ 'name' => 'show_bookmark',
+ 'title' => '_MI_TDMDOWNLOADS_BOOKMARK',
'description' => '_MI_TDMDOWNLOADS_BOOKMARK_DSC',
- 'formtype' => 'yesno',
- 'valuetype' => 'int',
- 'default' => 1,
+ 'formtype' => 'yesno',
+ 'valuetype' => 'int',
+ 'default' => 1,
];
$modversion['config'][] = [
- 'name' => 'show_social',
- 'title' => '_MI_TDMDOWNLOADS_SOCIAL',
+ 'name' => 'show_social',
+ 'title' => '_MI_TDMDOWNLOADS_SOCIAL',
'description' => '_MI_TDMDOWNLOADS_SOCIAL_DSC',
- 'formtype' => 'yesno',
- 'valuetype' => 'int',
- 'default' => 1,
+ 'formtype' => 'yesno',
+ 'valuetype' => 'int',
+ 'default' => 1,
];
$modversion['config'][] = [
- 'name' => 'download_float',
- 'title' => '_MI_TDMDOWNLOADS_DOWNLOADFLOAT',
+ 'name' => 'download_float',
+ 'title' => '_MI_TDMDOWNLOADS_DOWNLOADFLOAT',
'description' => '_MI_TDMDOWNLOADS_DOWNLOADFLOAT_DSC',
- 'formtype' => 'select',
- 'valuetype' => 'text',
- 'default' => 'ltr',
- 'options' => [_MI_TDMDOWNLOADS_DOWNLOADFLOAT_LTR => 'ltr', _MI_TDMDOWNLOADS_DOWNLOADFLOAT_RTL => 'rtl'],
+ 'formtype' => 'select',
+ 'valuetype' => 'text',
+ 'default' => 'ltr',
+ 'options' => [_MI_TDMDOWNLOADS_DOWNLOADFLOAT_LTR => 'ltr', _MI_TDMDOWNLOADS_DOWNLOADFLOAT_RTL => 'rtl'],
];
$modversion['config'][] = [
- 'name' => 'show_latest_files',
- 'title' => '_MI_TDMDOWNLOADS_SHOW_LATEST_FILES',
+ 'name' => 'show_latest_files',
+ 'title' => '_MI_TDMDOWNLOADS_SHOW_LATEST_FILES',
'description' => '_MI_TDMDOWNLOADS_SHOW_LATEST_FILES_DSC',
- 'formtype' => 'yesno',
- 'valuetype' => 'int',
- 'default' => 1,
+ 'formtype' => 'yesno',
+ 'valuetype' => 'int',
+ 'default' => 1,
];
$modversion['config'][] = [
- 'name' => 'break',
- 'title' => '_MI_TDMDOWNLOADS_PREFERENCE_BREAK_ADMIN',
+ 'name' => 'break',
+ 'title' => '_MI_TDMDOWNLOADS_PREFERENCE_BREAK_ADMIN',
'description' => '',
- 'formtype' => 'line_break',
- 'valuetype' => 'textbox',
- 'default' => 'head',
+ 'formtype' => 'line_break',
+ 'valuetype' => 'textbox',
+ 'default' => 'head',
];
$modversion['config'][] = [
- 'name' => 'perpageadmin',
- 'title' => '_MI_TDMDOWNLOADS_PERPAGEADMIN',
+ 'name' => 'perpageadmin',
+ 'title' => '_MI_TDMDOWNLOADS_PERPAGEADMIN',
'description' => '',
- 'formtype' => 'textbox',
- 'valuetype' => 'int',
- 'default' => 15,
+ 'formtype' => 'textbox',
+ 'valuetype' => 'int',
+ 'default' => 15,
];
$modversion['config'][] = [
- 'name' => 'break',
- 'title' => '_MI_TDMDOWNLOADS_PREFERENCE_BREAK_DOWNLOADS',
+ 'name' => 'break',
+ 'title' => '_MI_TDMDOWNLOADS_PREFERENCE_BREAK_DOWNLOADS',
'description' => '',
- 'formtype' => 'line_break',
- 'valuetype' => 'textbox',
- 'default' => 'head',
+ 'formtype' => 'line_break',
+ 'valuetype' => 'textbox',
+ 'default' => 'head',
];
$modversion['config'][] = [
- 'name' => 'permission_download',
- 'title' => '_MI_TDMDOWNLOADS_PERMISSIONDOWNLOAD',
+ 'name' => 'permission_download',
+ 'title' => '_MI_TDMDOWNLOADS_PERMISSIONDOWNLOAD',
'description' => '',
- 'formtype' => 'select',
- 'valuetype' => 'int',
- 'default' => 1,
- 'options' => ['_MI_TDMDOWNLOADS_PERMISSIONDOWNLOAD1' => 1, '_MI_TDMDOWNLOADS_PERMISSIONDOWNLOAD2' => 2],
+ 'formtype' => 'select',
+ 'valuetype' => 'int',
+ 'default' => 1,
+ 'options' => ['_MI_TDMDOWNLOADS_PERMISSIONDOWNLOAD1' => 1, '_MI_TDMDOWNLOADS_PERMISSIONDOWNLOAD2' => 2],
];
$modversion['config'][] = [
- 'name' => 'newnamedownload',
- 'title' => '_MI_TDMDOWNLOADS_DOWNLOAD_NAME',
+ 'name' => 'newnamedownload',
+ 'title' => '_MI_TDMDOWNLOADS_DOWNLOAD_NAME',
'description' => '_MI_TDMDOWNLOADS_DOWNLOAD_NAMEDSC',
- 'formtype' => 'yesno',
- 'valuetype' => 'int',
- 'default' => 1,
+ 'formtype' => 'yesno',
+ 'valuetype' => 'int',
+ 'default' => 1,
];
$modversion['config'][] = [
- 'name' => 'prefixdownloads',
- 'title' => '_MI_TDMDOWNLOADS_DOWNLOAD_PREFIX',
+ 'name' => 'prefixdownloads',
+ 'title' => '_MI_TDMDOWNLOADS_DOWNLOAD_PREFIX',
'description' => '_MI_TDMDOWNLOADS_DOWNLOAD_PREFIXDSC',
- 'formtype' => 'textbox',
- 'valuetype' => 'text',
- 'default' => 'downloads_',
+ 'formtype' => 'textbox',
+ 'valuetype' => 'text',
+ 'default' => 'downloads_',
];
-include_once XOOPS_ROOT_PATH . '/modules/tdmdownloads/include/xoops_version.inc.php';
-$iniPostMaxSize = tdmdownloadsReturnBytes(ini_get('post_max_size'));
-$iniUploadMaxFileSize = tdmdownloadsReturnBytes(ini_get('upload_max_filesize'));
-$maxSize = min($iniPostMaxSize, $iniUploadMaxFileSize);
+$iniPostMaxSize = \XoopsModules\Tdmdownloads\Utility::returnBytes(ini_get('post_max_size'));
+$iniUploadMaxFileSize = \XoopsModules\Tdmdownloads\Utility::returnBytes(ini_get('upload_max_filesize'));
+$maxSize = min($iniPostMaxSize, $iniUploadMaxFileSize);
if ($maxSize > 10000 * 1048576) {
$increment = 500;
}
-if ($maxSize <= 10000 * 1048576){
+if ($maxSize <= 10000 * 1048576) {
$increment = 200;
}
-if ($maxSize <= 5000 * 1048576){
+if ($maxSize <= 5000 * 1048576) {
$increment = 100;
}
-if ($maxSize <= 2500 * 1048576){
+if ($maxSize <= 2500 * 1048576) {
$increment = 50;
}
-if ($maxSize <= 1000 * 1048576){
+if ($maxSize <= 1000 * 1048576) {
$increment = 20;
}
-if ($maxSize <= 500 * 1048576){
+if ($maxSize <= 500 * 1048576) {
$increment = 10;
}
-if ($maxSize <= 100 * 1048576){
+if ($maxSize <= 100 * 1048576) {
$increment = 2;
}
-if ($maxSize <= 50 * 1048576){
+if ($maxSize <= 50 * 1048576) {
$increment = 1;
}
-if ($maxSize <= 25 * 1048576){
+if ($maxSize <= 25 * 1048576) {
$increment = 0.5;
}
$optionMaxsize = [];
-$i = $increment;
-while ($i* 1048576 <= $maxSize) {
+$i = $increment;
+while ($i * 1048576 <= $maxSize) {
$optionMaxsize[$i . ' ' . _MI_TDMDOWNLOADS_MAXUPLOAD_SIZE_MB] = $i * 1048576;
+
$i += $increment;
}
$modversion['config'][] = [
- 'name' => 'maxuploadsize',
- 'title' => '_MI_TDMDOWNLOADS_MAXUPLOAD_SIZE',
+ 'name' => 'maxuploadsize',
+ 'title' => '_MI_TDMDOWNLOADS_MAXUPLOAD_SIZE',
'description' => '_MI_TDMDOWNLOADS_MAXUPLOAD_SIZE_DESC',
- 'formtype' => 'select',
- 'valuetype' => 'int',
- 'default' => 1048576,
- 'options' => $optionMaxsize,
+ 'formtype' => 'select',
+ 'valuetype' => 'int',
+ 'default' => 1048576,
+ 'options' => $optionMaxsize,
];
$modversion['config'][] = [
- 'name' => 'mimetype',
- 'title' => '_MI_TDMDOWNLOADS_MIMETYPE',
+ 'name' => 'mimetypes',
+ 'title' => '_MI_TDMDOWNLOADS_MIMETYPE',
'description' => '_MI_TDMDOWNLOADS_MIMETYPE_DSC',
- 'formtype' => 'select_multi',
- 'valuetype' => 'array',
- 'default' => [
- 'image/gif', 'image/jpeg', 'image/png',
- 'application/zip', 'application/rar', 'application/pdf', 'application/x-gtar', 'application/x-tar',
- 'application/msword', 'application/vnd.ms-excel', 'application/vnd.oasis.opendocument.text', 'application/vnd.oasis.opendocument.spreadsheet',
- 'application/vnd.openxmlformats-officedocument.wordprocessingml.document', 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet',
+ 'formtype' => 'select_multi',
+ 'valuetype' => 'array',
+ 'default' => [
+ 'image/gif',
+ 'image/jpeg',
+ 'image/png',
+ 'application/zip',
+ 'application/rar',
+ 'application/pdf',
+ 'application/x-gtar',
+ 'application/x-tar',
+ 'application/msword',
+ 'application/vnd.ms-excel',
+ 'application/vnd.oasis.opendocument.text',
+ 'application/vnd.oasis.opendocument.spreadsheet',
+ 'application/vnd.openxmlformats-officedocument.wordprocessingml.document',
+ 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet',
],
- 'options' => include $GLOBALS['xoops']->path('include/mimetypes.inc.php'),
+ 'options' => require $GLOBALS['xoops']->path('include/mimetypes.inc.php'),
];
+//---------------- picture -------------------------
+require_once __DIR__ . '/config/imageconfig.php';
+//---------------- picture -------------------------
+
$modversion['config'][] = [
- 'name' => 'check_host',
- 'title' => '_MI_TDMDOWNLOADS_CHECKHOST',
+ 'name' => 'check_host',
+ 'title' => '_MI_TDMDOWNLOADS_CHECKHOST',
'description' => '',
- 'formtype' => 'yesno',
- 'valuetype' => 'int',
- 'default' => 0,
+ 'formtype' => 'yesno',
+ 'valuetype' => 'int',
+ 'default' => 0,
];
-$xoopsUrl = parse_url(XOOPS_URL);
+$xoopsUrl = parse_url(XOOPS_URL);
$modversion['config'][] = [
- 'name' => 'referers',
- 'title' => '_MI_TDMDOWNLOADS_REFERERS',
+ 'name' => 'referers',
+ 'title' => '_MI_TDMDOWNLOADS_REFERERS',
'description' => '',
- 'formtype' => 'textarea',
- 'valuetype' => 'array',
- 'default' => [$xoopsUrl['host']],
+ 'formtype' => 'textarea',
+ 'valuetype' => 'array',
+ 'default' => [$xoopsUrl['host']],
];
$modversion['config'][] = [
- 'name' => 'downlimit',
- 'title' => '_MI_TDMDOWNLOADS_DOWNLIMIT',
+ 'name' => 'downlimit',
+ 'title' => '_MI_TDMDOWNLOADS_DOWNLIMIT',
'description' => '_MI_TDMDOWNLOADS_DOWNLIMITDSC',
- 'formtype' => 'yesno',
- 'valuetype' => 'int',
- 'default' => 0,
+ 'formtype' => 'yesno',
+ 'valuetype' => 'int',
+ 'default' => 0,
];
$modversion['config'][] = [
- 'name' => 'limitglobal',
- 'title' => '_MI_TDMDOWNLOADS_LIMITGLOBAL',
+ 'name' => 'limitglobal',
+ 'title' => '_MI_TDMDOWNLOADS_LIMITGLOBAL',
'description' => '_MI_TDMDOWNLOADS_LIMITGLOBALDSC',
- 'formtype' => 'textbox',
- 'valuetype' => 'int',
- 'default' => 10,
+ 'formtype' => 'textbox',
+ 'valuetype' => 'int',
+ 'default' => 10,
];
$modversion['config'][] = [
- 'name' => 'limitlid',
- 'title' => '_MI_TDMDOWNLOADS_LIMITLID',
+ 'name' => 'limitlid',
+ 'title' => '_MI_TDMDOWNLOADS_LIMITLID',
'description' => '_MI_TDMDOWNLOADS_LIMITLIDDSC',
- 'formtype' => 'textbox',
- 'valuetype' => 'int',
- 'default' => 2,
+ 'formtype' => 'textbox',
+ 'valuetype' => 'int',
+ 'default' => 2,
];
$modversion['config'][] = [
- 'name' => 'break',
- 'title' => '_MI_TDMDOWNLOADS_PREFERENCE_BREAK_PAYPAL',
+ 'name' => 'break',
+ 'title' => '_MI_TDMDOWNLOADS_PREFERENCE_BREAK_PAYPAL',
'description' => '',
- 'formtype' => 'line_break',
- 'valuetype' => 'textbox',
- 'default' => 'head',
+ 'formtype' => 'line_break',
+ 'valuetype' => 'textbox',
+ 'default' => 'head',
];
$modversion['config'][] = [
- 'name' => 'use_paypal',
- 'title' => '_MI_TDMDOWNLOADS_USEPAYPAL',
+ 'name' => 'use_paypal',
+ 'title' => '_MI_TDMDOWNLOADS_USEPAYPAL',
'description' => '',
- 'formtype' => 'yesno',
- 'valuetype' => 'int',
- 'default' => 0,
+ 'formtype' => 'yesno',
+ 'valuetype' => 'int',
+ 'default' => 0,
];
$modversion['config'][] = [
- 'name' => 'currency_paypal',
- 'title' => '_MI_TDMDOWNLOADS_CURRENCYPAYPAL',
+ 'name' => 'currency_paypal',
+ 'title' => '_MI_TDMDOWNLOADS_CURRENCYPAYPAL',
'description' => '',
- 'formtype' => 'select',
- 'valuetype' => 'text',
- 'default' => 'EUR',
- 'options' => [
+ 'formtype' => 'select',
+ 'valuetype' => 'text',
+ 'default' => 'EUR',
+ 'options' => [
'AUD' => 'AUD',
'BRL' => 'BRL',
'CAD' => 'CAD',
@@ -693,202 +718,202 @@
];
$modversion['config'][] = [
- 'name' => 'image_paypal',
- 'title' => '_MI_TDMDOWNLOADS_IMAGEPAYPAL',
+ 'name' => 'image_paypal',
+ 'title' => '_MI_TDMDOWNLOADS_IMAGEPAYPAL',
'description' => '_MI_TDMDOWNLOADS_IMAGEPAYPALDSC',
- 'formtype' => 'textbox',
- 'valuetype' => 'text',
- 'default' => 'https://www.paypal.com/fr_FR/FR/i/btn/btn_donateCC_LG.gif',
+ 'formtype' => 'textbox',
+ 'valuetype' => 'text',
+ 'default' => 'https://www.paypal.com/fr_FR/FR/i/btn/btn_donateCC_LG.gif',
];
$modversion['config'][] = [
- 'name' => 'break',
- 'title' => '_MI_TDMDOWNLOADS_PREFERENCE_BREAK_RSS',
+ 'name' => 'break',
+ 'title' => '_MI_TDMDOWNLOADS_PREFERENCE_BREAK_RSS',
'description' => '',
- 'formtype' => 'line_break',
- 'valuetype' => 'textbox',
- 'default' => 'head',
+ 'formtype' => 'line_break',
+ 'valuetype' => 'textbox',
+ 'default' => 'head',
];
$modversion['config'][] = [
- 'name' => 'perpagerss',
- 'title' => '_MI_TDMDOWNLOADS_PERPAGERSS',
+ 'name' => 'perpagerss',
+ 'title' => '_MI_TDMDOWNLOADS_PERPAGERSS',
'description' => '_MI_TDMDOWNLOADS_PERPAGERSSDSC',
- 'formtype' => 'textbox',
- 'valuetype' => 'int',
- 'default' => 10,
+ 'formtype' => 'textbox',
+ 'valuetype' => 'int',
+ 'default' => 10,
];
$modversion['config'][] = [
- 'name' => 'timecacherss',
- 'title' => '_MI_TDMDOWNLOADS_TIMECACHERSS',
+ 'name' => 'timecacherss',
+ 'title' => '_MI_TDMDOWNLOADS_TIMECACHERSS',
'description' => '_MI_TDMDOWNLOADS_TIMECACHERSSDSC',
- 'formtype' => 'textbox',
- 'valuetype' => 'int',
- 'default' => 60,
+ 'formtype' => 'textbox',
+ 'valuetype' => 'int',
+ 'default' => 60,
];
$modversion['config'][] = [
- 'name' => 'logorss',
- 'title' => '_MI_TDMDOWNLOADS_LOGORSS',
+ 'name' => 'logorss',
+ 'title' => '_MI_TDMDOWNLOADS_LOGORSS',
'description' => '',
- 'formtype' => 'textbox',
- 'valuetype' => 'text',
- 'default' => '/modules/tdmdownloads/assets/images/mydl_slogo.png',
+ 'formtype' => 'textbox',
+ 'valuetype' => 'text',
+ 'default' => '/modules/' . $moduleDirName . '/assets/images/mydl_slogo.png',
];
$modversion['config'][] = [
- 'name' => 'break',
- 'title' => '_MI_TDMDOWNLOADS_CONFCAT_OTHERS',
+ 'name' => 'break',
+ 'title' => '_MI_TDMDOWNLOADS_CONFCAT_OTHERS',
'description' => '',
- 'formtype' => 'line_break',
- 'valuetype' => 'textbox',
- 'default' => 'head',
+ 'formtype' => 'line_break',
+ 'valuetype' => 'textbox',
+ 'default' => 'head',
];
/**
* Make Sample button visible?
*/
$modversion['config'][] = [
- 'name' => 'displaySampleButton',
- 'title' => '_MI_TDMDOWNLOADS_SHOW_SAMPLE_BUTTON',
+ 'name' => 'displaySampleButton',
+ 'title' => '_MI_TDMDOWNLOADS_SHOW_SAMPLE_BUTTON',
'description' => '_MI_TDMDOWNLOADS_SHOW_SAMPLE_BUTTON_DESC',
- 'formtype' => 'yesno',
- 'valuetype' => 'int',
- 'default' => 1,
+ 'formtype' => 'yesno',
+ 'valuetype' => 'int',
+ 'default' => 1,
];
/**
* Show Developer Tools?
*/
$modversion['config'][] = [
- 'name' => 'displayDeveloperTools',
- 'title' => '_MI_TDMDOWNLOADS_SHOW_DEV_TOOLS',
+ 'name' => 'displayDeveloperTools',
+ 'title' => '_MI_TDMDOWNLOADS_SHOW_DEV_TOOLS',
'description' => '_MI_TDMDOWNLOADS_SHOW_DEV_TOOLS_DESC',
- 'formtype' => 'yesno',
- 'valuetype' => 'int',
- 'default' => 0,
+ 'formtype' => 'yesno',
+ 'valuetype' => 'int',
+ 'default' => 0,
];
// ------------------- Notifications -------------------
-$modversion['config'][] = [
- 'name' => 'break',
- 'title' => '_MI_TDMDOWNLOADS_PREFERENCE_BREAK_COMNOTI',
+$modversion['config'][] = [
+ 'name' => 'break',
+ 'title' => '_MI_TDMDOWNLOADS_PREFERENCE_BREAK_COMNOTI',
'description' => '',
- 'formtype' => 'line_break',
- 'valuetype' => 'textbox',
- 'default' => 'head',
+ 'formtype' => 'line_break',
+ 'valuetype' => 'textbox',
+ 'default' => 'head',
];
-$modversion['hasNotification'] = 1;
+$modversion['hasNotification'] = 1;
$modversion['notification']['lookup_file'] = 'include/notification.inc.php';
$modversion['notification']['lookup_func'] = 'tdmdownloads_notify_iteminfo';
$modversion['notification']['category'][] = [
- 'name' => 'global',
- 'title' => _MI_TDMDOWNLOADS_GLOBAL_NOTIFY,
- 'description' => _MI_TDMDOWNLOADS_GLOBAL_NOTIFYDSC,
+ 'name' => 'global',
+ 'title' => _MI_TDMDOWNLOADS_GLOBAL_NOTIFY,
+ 'description' => _MI_TDMDOWNLOADS_GLOBAL_NOTIFYDSC,
'subscribe_from' => ['index.php', 'viewcat.php', 'singlefile.php'],
];
$modversion['notification']['category'][] = [
- 'name' => 'category',
- 'title' => _MI_TDMDOWNLOADS_CATEGORY_NOTIFY,
- 'description' => _MI_TDMDOWNLOADS_CATEGORY_NOTIFYDSC,
+ 'name' => 'category',
+ 'title' => _MI_TDMDOWNLOADS_CATEGORY_NOTIFY,
+ 'description' => _MI_TDMDOWNLOADS_CATEGORY_NOTIFYDSC,
'subscribe_from' => ['viewcat.php', 'singlefile.php'],
- 'item_name' => 'cid',
+ 'item_name' => 'cid',
'allow_bookmark' => 1,
];
$modversion['notification']['category'][] = [
- 'name' => 'file',
- 'title' => _MI_TDMDOWNLOADS_FILE_NOTIFY,
- 'description' => _MI_TDMDOWNLOADS_FILE_NOTIFYDSC,
+ 'name' => 'file',
+ 'title' => _MI_TDMDOWNLOADS_FILE_NOTIFY,
+ 'description' => _MI_TDMDOWNLOADS_FILE_NOTIFYDSC,
'subscribe_from' => 'singlefile.php',
- 'item_name' => 'lid',
+ 'item_name' => 'lid',
'allow_bookmark' => 1,
];
$modversion['notification']['event'][] = [
- 'name' => 'new_category',
- 'category' => 'global',
- 'title' => _MI_TDMDOWNLOADS_GLOBAL_NEWCATEGORY_NOTIFY,
- 'caption' => _MI_TDMDOWNLOADS_GLOBAL_NEWCATEGORY_NOTIFYCAP,
- 'description' => _MI_TDMDOWNLOADS_GLOBAL_NEWCATEGORY_NOTIFYDSC,
+ 'name' => 'new_category',
+ 'category' => 'global',
+ 'title' => _MI_TDMDOWNLOADS_GLOBAL_NEWCATEGORY_NOTIFY,
+ 'caption' => _MI_TDMDOWNLOADS_GLOBAL_NEWCATEGORY_NOTIFYCAP,
+ 'description' => _MI_TDMDOWNLOADS_GLOBAL_NEWCATEGORY_NOTIFYDSC,
'mail_template' => 'global_newcategory_notify',
- 'mail_subject' => _MI_TDMDOWNLOADS_GLOBAL_NEWCATEGORY_NOTIFYSBJ,
+ 'mail_subject' => _MI_TDMDOWNLOADS_GLOBAL_NEWCATEGORY_NOTIFYSBJ,
];
$modversion['notification']['event'][] = [
- 'name' => 'file_modify',
- 'category' => 'global',
- 'admin_only' => 1,
- 'title' => _MI_TDMDOWNLOADS_GLOBAL_FILEMODIFY_NOTIFY,
- 'caption' => _MI_TDMDOWNLOADS_GLOBAL_FILEMODIFY_NOTIFYCAP,
- 'description' => _MI_TDMDOWNLOADS_GLOBAL_FILEMODIFY_NOTIFYDSC,
+ 'name' => 'file_modify',
+ 'category' => 'global',
+ 'admin_only' => 1,
+ 'title' => _MI_TDMDOWNLOADS_GLOBAL_FILEMODIFY_NOTIFY,
+ 'caption' => _MI_TDMDOWNLOADS_GLOBAL_FILEMODIFY_NOTIFYCAP,
+ 'description' => _MI_TDMDOWNLOADS_GLOBAL_FILEMODIFY_NOTIFYDSC,
'mail_template' => 'global_filemodify_notify',
- 'mail_subject' => _MI_TDMDOWNLOADS_GLOBAL_FILEMODIFY_NOTIFYSBJ,
+ 'mail_subject' => _MI_TDMDOWNLOADS_GLOBAL_FILEMODIFY_NOTIFYSBJ,
];
$modversion['notification']['event'][] = [
- 'name' => 'file_submit',
- 'category' => 'global',
- 'admin_only' => 1,
- 'title' => _MI_TDMDOWNLOADS_GLOBAL_FILESUBMIT_NOTIFY,
- 'caption' => _MI_TDMDOWNLOADS_GLOBAL_FILESUBMIT_NOTIFYCAP,
- 'description' => _MI_TDMDOWNLOADS_GLOBAL_FILESUBMIT_NOTIFYDSC,
+ 'name' => 'file_submit',
+ 'category' => 'global',
+ 'admin_only' => 1,
+ 'title' => _MI_TDMDOWNLOADS_GLOBAL_FILESUBMIT_NOTIFY,
+ 'caption' => _MI_TDMDOWNLOADS_GLOBAL_FILESUBMIT_NOTIFYCAP,
+ 'description' => _MI_TDMDOWNLOADS_GLOBAL_FILESUBMIT_NOTIFYDSC,
'mail_template' => 'global_filesubmit_notify',
- 'mail_subject' => _MI_TDMDOWNLOADS_GLOBAL_FILESUBMIT_NOTIFYSBJ,
+ 'mail_subject' => _MI_TDMDOWNLOADS_GLOBAL_FILESUBMIT_NOTIFYSBJ,
];
$modversion['notification']['event'][] = [
- 'name' => 'file_broken',
- 'category' => 'global',
- 'admin_only' => 1,
- 'title' => _MI_TDMDOWNLOADS_GLOBAL_FILEBROKEN_NOTIFY,
- 'caption' => _MI_TDMDOWNLOADS_GLOBAL_FILEBROKEN_NOTIFYCAP,
- 'description' => _MI_TDMDOWNLOADS_GLOBAL_FILEBROKEN_NOTIFYDSC,
+ 'name' => 'file_broken',
+ 'category' => 'global',
+ 'admin_only' => 1,
+ 'title' => _MI_TDMDOWNLOADS_GLOBAL_FILEBROKEN_NOTIFY,
+ 'caption' => _MI_TDMDOWNLOADS_GLOBAL_FILEBROKEN_NOTIFYCAP,
+ 'description' => _MI_TDMDOWNLOADS_GLOBAL_FILEBROKEN_NOTIFYDSC,
'mail_template' => 'global_filebroken_notify',
- 'mail_subject' => _MI_TDMDOWNLOADS_GLOBAL_FILEBROKEN_NOTIFYSBJ,
+ 'mail_subject' => _MI_TDMDOWNLOADS_GLOBAL_FILEBROKEN_NOTIFYSBJ,
];
$modversion['notification']['event'][] = [
- 'name' => 'new_file',
- 'category' => 'global',
- 'title' => _MI_TDMDOWNLOADS_GLOBAL_NEWFILE_NOTIFY,
- 'caption' => _MI_TDMDOWNLOADS_GLOBAL_NEWFILE_NOTIFYCAP,
- 'description' => _MI_TDMDOWNLOADS_GLOBAL_NEWFILE_NOTIFYDSC,
+ 'name' => 'new_file',
+ 'category' => 'global',
+ 'title' => _MI_TDMDOWNLOADS_GLOBAL_NEWFILE_NOTIFY,
+ 'caption' => _MI_TDMDOWNLOADS_GLOBAL_NEWFILE_NOTIFYCAP,
+ 'description' => _MI_TDMDOWNLOADS_GLOBAL_NEWFILE_NOTIFYDSC,
'mail_template' => 'global_newfile_notify',
- 'mail_subject' => _MI_TDMDOWNLOADS_GLOBAL_NEWFILE_NOTIFYSBJ,
+ 'mail_subject' => _MI_TDMDOWNLOADS_GLOBAL_NEWFILE_NOTIFYSBJ,
];
$modversion['notification']['event'][] = [
- 'name' => 'file_submit',
- 'category' => 'category',
- 'admin_only' => 1,
- 'title' => _MI_TDMDOWNLOADS_CATEGORY_FILESUBMIT_NOTIFY,
- 'caption' => _MI_TDMDOWNLOADS_CATEGORY_FILESUBMIT_NOTIFYCAP,
- 'description' => _MI_TDMDOWNLOADS_CATEGORY_FILESUBMIT_NOTIFYDSC,
+ 'name' => 'file_submit',
+ 'category' => 'category',
+ 'admin_only' => 1,
+ 'title' => _MI_TDMDOWNLOADS_CATEGORY_FILESUBMIT_NOTIFY,
+ 'caption' => _MI_TDMDOWNLOADS_CATEGORY_FILESUBMIT_NOTIFYCAP,
+ 'description' => _MI_TDMDOWNLOADS_CATEGORY_FILESUBMIT_NOTIFYDSC,
'mail_template' => 'category_filesubmit_notify',
- 'mail_subject' => _MI_TDMDOWNLOADS_CATEGORY_FILESUBMIT_NOTIFYSBJ,
+ 'mail_subject' => _MI_TDMDOWNLOADS_CATEGORY_FILESUBMIT_NOTIFYSBJ,
];
$modversion['notification']['event'][] = [
- 'name' => 'new_file',
- 'category' => 'category',
- 'title' => _MI_TDMDOWNLOADS_CATEGORY_NEWFILE_NOTIFY,
- 'caption' => _MI_TDMDOWNLOADS_CATEGORY_NEWFILE_NOTIFYCAP,
- 'description' => _MI_TDMDOWNLOADS_CATEGORY_NEWFILE_NOTIFYDSC,
+ 'name' => 'new_file',
+ 'category' => 'category',
+ 'title' => _MI_TDMDOWNLOADS_CATEGORY_NEWFILE_NOTIFY,
+ 'caption' => _MI_TDMDOWNLOADS_CATEGORY_NEWFILE_NOTIFYCAP,
+ 'description' => _MI_TDMDOWNLOADS_CATEGORY_NEWFILE_NOTIFYDSC,
'mail_template' => 'category_newfile_notify',
- 'mail_subject' => _MI_TDMDOWNLOADS_CATEGORY_NEWFILE_NOTIFYSBJ,
+ 'mail_subject' => _MI_TDMDOWNLOADS_CATEGORY_NEWFILE_NOTIFYSBJ,
];
$modversion['notification']['event'][] = [
- 'name' => 'approve',
- 'category' => 'file',
- 'invisible' => 1,
- 'title' => _MI_TDMDOWNLOADS_FILE_APPROVE_NOTIFY,
- 'caption' => _MI_TDMDOWNLOADS_FILE_APPROVE_NOTIFYCAP,
- 'description' => _MI_TDMDOWNLOADS_FILE_APPROVE_NOTIFYDSC,
+ 'name' => 'approve',
+ 'category' => 'file',
+ 'invisible' => 1,
+ 'title' => _MI_TDMDOWNLOADS_FILE_APPROVE_NOTIFY,
+ 'caption' => _MI_TDMDOWNLOADS_FILE_APPROVE_NOTIFYCAP,
+ 'description' => _MI_TDMDOWNLOADS_FILE_APPROVE_NOTIFYDSC,
'mail_template' => 'file_approve_notify',
- 'mail_subject' => _MI_TDMDOWNLOADS_FILE_APPROVE_NOTIFYSBJ,
+ 'mail_subject' => _MI_TDMDOWNLOADS_FILE_APPROVE_NOTIFYSBJ,
];
| | |