Skip to content

Commit

Permalink
Merge pull request #26 from ggoffy/master
Browse files Browse the repository at this point in the history
fixed declare type
  • Loading branch information
ggoffy authored Aug 4, 2020
2 parents 7292131 + 10b050d commit 74bdb81
Show file tree
Hide file tree
Showing 322 changed files with 20,789 additions and 3,235 deletions.
31 changes: 16 additions & 15 deletions admin/packages.php
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@
$packagesAll = $packagesHandler->getAllPackages($start, $limit, 'pkg_id', 'DESC');
$GLOBALS['xoopsTpl']->assign('packages_count', $packagesCount);
$GLOBALS['xoopsTpl']->assign('wgtransifex_url', WGTRANSIFEX_URL);
$GLOBALS['xoopsTpl']->assign('wgtransifex_upload_url', WGTRANSIFEX_UPLOAD_URL);
$GLOBALS['xoopsTpl']->assign('wgtransifex_upload_url', \WGTRANSIFEX_UPLOAD_URL);
// Table view packages
if ($packagesCount > 0) {
foreach (\array_keys($packagesAll) as $i) {
Expand Down Expand Up @@ -153,13 +153,13 @@
$langFolder = $languagesObj->getVar('lang_folder');

// Make the destination directory if not exist
$pkg_path = WGTRANSIFEX_UPLOAD_TRANS_PATH . '/' . $pkgName;
if (!mkdir($pkg_path) && !is_dir($pkg_path)) {
$pkg_path = \WGTRANSIFEX_UPLOAD_TRANS_PATH . '/' . $pkgName;
if (!\is_dir($pkg_path) && !\mkdir($pkg_path)) {
throw new \RuntimeException(sprintf('Directory "%s" was not created', $pkg_path));
}
$pkg_path .= '/' . $langFolder;
\clearDir($pkg_path);
if (!mkdir($pkg_path) && !is_dir($pkg_path)) {
if (!\is_dir($pkg_path) && !\mkdir($pkg_path)) {
throw new \RuntimeException(sprintf('Directory "%s" was not created', $pkg_path));
}

Expand Down Expand Up @@ -190,17 +190,18 @@
if (!mkdir($dst_path) && !is_dir($dst_path)) {
throw new \RuntimeException(sprintf('Directory "%s" was not created', $dst_path));
}
chmod($dst_path, 0777);
}
}
}
} else {
\redirect_header('packages.php?op=list', 5, \_AM_WGTRANSIFEX_PACKAGE_ERROR_NODATA);
}

$zipcreate = WGTRANSIFEX_UPLOAD_TRANS_PATH . '/' . $pkgName . '/' . $pkgName . '_' . $langFolder . '.zip';
$zipcreate = \WGTRANSIFEX_UPLOAD_TRANS_PATH . '/' . $pkgName . '/' . $pkgName . '_' . $langFolder . '.zip';
\unlink($zipcreate);
if (1 == Request::getInt('pkg_zipfile', 0)) {
$pkg_path = WGTRANSIFEX_UPLOAD_TRANS_PATH . '/' . $pkgName . '/' . $langFolder;
$pkg_path = \WGTRANSIFEX_UPLOAD_TRANS_PATH . '/' . $pkgName . '/' . $langFolder;
zipFiles($pkg_path, $zipcreate);
}

Expand All @@ -226,7 +227,7 @@
$imgNameDef = Request::getString('pkg_name');
$uploaderErrors = '';
$uploader = new \XoopsMediaUploader(
WGTRANSIFEX_UPLOAD_PATH . '/logos/',
\WGTRANSIFEX_UPLOAD_PATH . '/logos/',
$helper->getConfig('mimetypes_image'),
$helper->getConfig('maxsize_image'),
null,
Expand All @@ -246,8 +247,8 @@
if ($maxwidth > 0 && $maxheight > 0) {
// Resize image
$imgHandler = new Common\Resizer();
$imgHandler->sourceFile = WGTRANSIFEX_UPLOAD_PATH . '/logos/' . $savedFilename;
$imgHandler->endFile = WGTRANSIFEX_UPLOAD_PATH . '/logos/' . $savedFilename;
$imgHandler->sourceFile = \WGTRANSIFEX_UPLOAD_PATH . '/logos/' . $savedFilename;
$imgHandler->endFile = \WGTRANSIFEX_UPLOAD_PATH . '/logos/' . $savedFilename;
$imgHandler->imageMimetype = $imgMimetype;
$imgHandler->maxWidth = $maxwidth;
$imgHandler->maxHeight = $maxheight;
Expand Down Expand Up @@ -292,7 +293,7 @@
// Event new notification
$notificationHandler->triggerEvent('packages', $newPkgId, 'package_new', $tags);

\redirect_header('packages.php?op=list', 2, _AM_WGTRANSIFEX_FORM_OK);
\redirect_header('packages.php?op=list', 2, \_AM_WGTRANSIFEX_FORM_OK);
}
}
// Get Form
Expand Down Expand Up @@ -382,11 +383,11 @@ function zipFiles($source, $destination)
$iterator->setFlags(RecursiveDirectoryIterator::SKIP_DOTS);
$files = new RecursiveIteratorIterator($iterator, RecursiveIteratorIterator::SELF_FIRST);
foreach ($files as $file) {
$file = \realpath($file);
if (\is_dir($file)) {
$zip->addEmptyDir(\str_replace($source . DIRECTORY_SEPARATOR, '', $file . DIRECTORY_SEPARATOR));
} elseif (\is_file($file)) {
$zip->addFile($file, \str_replace($source . DIRECTORY_SEPARATOR, '', $file));
$filepath = \realpath($file->getPathname());
if (\is_dir($filepath)) {
$zip->addEmptyDir(\str_replace($source . DIRECTORY_SEPARATOR, '', $filepath . DIRECTORY_SEPARATOR));
} elseif (\is_file($filepath)) {
$zip->addFile($filepath, \str_replace($source . DIRECTORY_SEPARATOR, '', $filepath));
}
}
} elseif (\is_file($source)) {
Expand Down
1 change: 1 addition & 0 deletions class/TransifexLib.php
Original file line number Diff line number Diff line change
Expand Up @@ -349,6 +349,7 @@ protected function _get($url, $checkOnly = false)
if ($checkOnly) {
return (false == $error);
}
echo "<br>" . $url;
if ($error) {
//echo $url;
//catch common errors
Expand Down
1 change: 1 addition & 0 deletions docs/changelog.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ Change Log for wgTransifex - 2020/07/26 12:35:41 Version 1.04 RC1
- added clone feature for projects/resources (goffy)
- new preference 'Show Tx Admin Tools' (goffy)
- added project type (goffy)
- fixed problem with declare strict_types (goffy)

===================================================================
Change Log for wgTransifex - 2020/07/26 12:35:41 Version 1.03 RC2
Expand Down
31 changes: 21 additions & 10 deletions testdata/english/wgtransifex_packages.yml
Original file line number Diff line number Diff line change
@@ -1,22 +1,33 @@
-
pkg_id: '1'
pkg_name: newbb
pkg_desc: 'This is the language package for last version of newbb'
pkg_pro_id: '8'
pkg_id: '2'
pkg_name: 'Xoops 2.5.11'
pkg_desc: ''
pkg_pro_id: '30'
pkg_lang_id: '1'
pkg_status: '6'
pkg_zip: 'C:/Homepages/wamp/www/wgtransifex/htdocs/uploads/wgtransifex/translations/newbb/newbb_english.zip'
pkg_logo: newbb.png
pkg_date: '1594055580'
pkg_zip: 'C:/Homepages/wamp/www/wgtransifex/htdocs/uploads/wgtransifex/translations/Xoops 2.5.11/Xoops 2.5.11_english.zip'
pkg_logo: xoops.png
pkg_date: '1596562106'
pkg_submitter: '1'
-
pkg_id: '2'
pkg_id: '3'
pkg_name: Publisher
pkg_desc: 'Language package for Publisher, Version 1.07'
pkg_pro_id: '9'
pkg_lang_id: '1'
pkg_status: '6'
pkg_zip: 'C:/Homepages/wamp/www/wgtransifex/htdocs/uploads/wgtransifex/translations/Publisher/Publisher_english.zip'
pkg_logo: publisher.png
pkg_date: '1596562171'
pkg_submitter: '1'
-
pkg_id: '4'
pkg_name: wgGallery
pkg_desc: 'This is the language pack for wgGallery'
pkg_desc: 'Language package for Image Gallery module wgGallery, Version 1.14'
pkg_pro_id: '16'
pkg_lang_id: '1'
pkg_status: '6'
pkg_zip: 'C:/Homepages/wamp/www/wgtransifex/htdocs/uploads/wgtransifex/translations/wgGallery/wgGallery_english.zip'
pkg_logo: wggallery.png
pkg_date: '1594055553'
pkg_date: '1596562339'
pkg_submitter: '1'
Loading

0 comments on commit 74bdb81

Please sign in to comment.