Skip to content

Commit 3ca2c0f

Browse files
authored
Merge pull request #41 from ggoffy/master
cosmetics
2 parents 548077b + b55e87d commit 3ca2c0f

5 files changed

Lines changed: 30 additions & 26 deletions

File tree

_TODO.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ TODOs:
44
Permissions:
55
implement autoapprove
66

7-
7+
check error handling for upload image list (// Set Var tf_imagelist)
88

99

1010
*****************************

admin/codecleaning.php

Lines changed: 23 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -24,15 +24,18 @@
2424

2525
use Xmf\Request;
2626

27+
$moduleDirName = \basename(\dirname(\dirname(__DIR__)));
28+
$moduleDirNameUpper = \mb_strtoupper($moduleDirName);
29+
2730
// Define main template
28-
$templateMain = 'modulebuilder_index.tpl';
31+
$templateMain = $moduleDirName . '_index.tpl';
2932

3033
include __DIR__ . '/header.php';
3134
// Recovered value of argument op in the URL $
3235
$op = Request::getString('op', 'list');
3336

34-
$src_path = TDMC_PATH ;
35-
$dst_path = TDMC_UPLOAD_REPOSITORY_PATH . '/codecleaned';
37+
$src_path = \constant($moduleDirNameUpper . '_PATH');
38+
$dst_path = \constant($moduleDirNameUpper . '_UPLOAD_PATH') . '/codecleaned';
3639

3740
$patKeys = [];
3841
$patValues = [];
@@ -46,7 +49,10 @@ function_qualifier($dst_path);
4649

4750
function function_qualifier($dst_path) {
4851

49-
$phpFunctions = [
52+
$sources = [];
53+
54+
//php functions
55+
$sources[0] = [
5056
'array_diff',
5157
'array_filter',
5258
'array_key_exists',
@@ -162,12 +168,14 @@ function function_qualifier($dst_path) {
162168
'mb_strrpos',
163169
];
164170

165-
$xoopsFunctions = [
171+
// xoops functions
172+
$sources[1] = [
166173
'xoops_getHandler',
167174
'xoops_load',
168175
'xoops_loadLanguage',
169176
];
170177

178+
// repair known errors
171179
$errors = [
172180
'mb_\strlen(' => 'mb_strlen(',
173181
'mb_\substr(' => 'mb_substr(',
@@ -182,20 +190,17 @@ function function_qualifier($dst_path) {
182190
];
183191

184192
$patterns = [];
185-
//reset existing in order to avoid double \\
186-
foreach ($phpFunctions as $item) {
187-
$patterns['\\' . $item . '('] = $item . '(';
188-
}
189-
foreach ($xoopsFunctions as $item) {
190-
$patterns['\\' . $item . '('] = $item . '(';
191-
}
192-
//apply now for all
193-
foreach ($phpFunctions as $item) {
194-
$patterns[$item . '('] = '\\' . $item . '(';
195-
}
196-
foreach ($xoopsFunctions as $item) {
197-
$patterns[$item . '('] = '\\' . $item . '(';
193+
foreach ($sources as $source) {
194+
//reset existing in order to avoid double \\
195+
foreach ($source as $item) {
196+
$patterns['\\' . $item . '('] = $item . '(';
197+
}
198+
//apply now for all
199+
foreach ($source as $item) {
200+
$patterns[$item . '('] = '\\' . $item . '(';
201+
}
198202
}
203+
199204
//add errors
200205
foreach ($errors as $key => $value) {
201206
$patterns[$key] = $value;
@@ -265,4 +270,3 @@ function cloneFile($src_file, $dst_file, $patKeys = [], $patValues =[])
265270
\copy($src_file, $dst_file);
266271
}
267272
}
268-

class/Files/Language/LanguageModinfo.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -312,9 +312,9 @@ private function getLanguageConfig($language, $tables)
312312
$ret .= $this->ld->getDefine($language, 'MIMETYPES_IMAGE', 'Mime types image');
313313
$ret .= $this->ld->getDefine($language, 'MIMETYPES_IMAGE_DESC', 'Define the allowed mime types for uploading images');
314314
$ret .= $this->ld->getDefine($language, 'MAXWIDTH_IMAGE', 'Max width image');
315-
$ret .= $this->ld->getDefine($language, 'MAXWIDTH_IMAGE_DESC', 'Set the max width which is allowed for uploading images (in pixel)<br>0 means that images keep original size<br>If original image is smaller the image will be not enlarged');
315+
$ret .= $this->ld->getDefine($language, 'MAXWIDTH_IMAGE_DESC', 'Set the max width to which uploaded images should be scaled (in pixel)<br>0 means, that images keeps the original size. <br>If an image is smaller than maximum value then the image will be not enlarge, it will be save in original width.');
316316
$ret .= $this->ld->getDefine($language, 'MAXHEIGHT_IMAGE', 'Max height image');
317-
$ret .= $this->ld->getDefine($language, 'MAXHEIGHT_IMAGE_DESC', 'Set the max height which is allowed for uploading images (in pixel)<br>0 means that images keep original size<br>If original image is smaller the image will be not enlarged');
317+
$ret .= $this->ld->getDefine($language, 'MAXHEIGHT_IMAGE_DESC', 'Set the max height to which uploaded images should be scaled (in pixel)<br>0 means, that images keeps the original size. <br>If an image is smaller than maximum value then the image will be not enlarge, it will be save in original height');
318318
}
319319
if ($fieldFile) {
320320
$ret .= $this->ld->getDefine($language, 'MAXSIZE_FILE', 'Max size file');

class/Files/User/UserXoopsVersion.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -740,7 +740,7 @@ private function getXoopsVersionConfig($module, $tables, $language)
740740
'description' => "'{$language}MAXWIDTH_IMAGE_DESC'",
741741
'formtype' => "'textbox'",
742742
'valuetype' => "'int'",
743-
'default' => '8000',
743+
'default' => '800',
744744
];
745745
$ret .= $this->uxc->getUserModVersionArray(2, $maxwidth_image, 'config');
746746
$maxheight_image = [
@@ -749,7 +749,7 @@ private function getXoopsVersionConfig($module, $tables, $language)
749749
'description' => "'{$language}MAXHEIGHT_IMAGE_DESC'",
750750
'formtype' => "'textbox'",
751751
'valuetype' => "'int'",
752-
'default' => '8000',
752+
'default' => '800',
753753
];
754754
$ret .= $this->uxc->getUserModVersionArray(2, $maxheight_image, 'config');
755755
}

files/commonfiles/class/Common/XoopsConfirm.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -87,8 +87,8 @@ public function getFormXoopsConfirm()
8787
}
8888
$form->addElement(new \XoopsFormHidden('ok', 1));
8989
$buttonTray = new \XoopsFormElementTray('');
90-
$buttonTray->addElement(new \XoopsFormButton('', 'confirm_submit', _YES, 'submit', false));
91-
$buttonBack = new \XoopsFormButton('', 'confirm_back', _NO, 'button', false);
90+
$buttonTray->addElement(new \XoopsFormButton('', 'confirm_submit', _YES, 'submit'));
91+
$buttonBack = new \XoopsFormButton('', 'confirm_back', _NO, 'button');
9292
$buttonBack->setExtra('onclick="history.go(-1);return true;"');
9393
$buttonTray->addElement($buttonBack);
9494
$form->addElement($buttonTray);

0 commit comments

Comments
 (0)