Skip to content

Commit d6f8c5c

Browse files
committed
Release phpwcms v1.10.9
Merge branch 'v1.10-dev'
2 parents 960fd36 + 8670b15 commit d6f8c5c

535 files changed

Lines changed: 41790 additions & 5299 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

README.md

Lines changed: 18 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -33,10 +33,24 @@ Never forget to backup your database and files before you start the upgrade proc
3333
Server system requirements
3434
--------------------------
3535

36-
**phpwcms** version 1.10.8 requires a web server with PHP 8.2 or newer.
36+
**phpwcms** version 1.10.9 requires a web server with PHP 8.2 or newer.
3737
and a MySQL/MariaDB database (minimum version 5.6+ or equivalent).
3838

3939

40+
FAQ
41+
---
42+
43+
### How to set up SMTP with Microsoft Azure and XOAUTH2?
44+
45+
You can find the setup guide for Microsoft Azure and XOAUTH2 in the
46+
[PHPMailer wiki](https://github.com/PHPMailer/PHPMailer/wiki/Microsoft-Azure-and-XOAUTH2-setup-guide)
47+
48+
### How to set up SMTP with Google and XOAUTH2?
49+
50+
You can find the setup guide for Google and XOAUTH2 in the
51+
[PHPMailer wiki](https://github.com/PHPMailer/PHPMailer/wiki/Using-Gmail-with-XOAUTH2).
52+
53+
4054
Known problems
4155
--------------
4256

@@ -67,9 +81,7 @@ Creator
6781
**Oliver Georgi**
6882

6983
- <https://github.com/slackero>
70-
- <https://webverbund.de>
7184
- <https://www.linkedin.com/in/olivergeorgi>
72-
- <https://twitter.com/slackero>
7385

7486

7587
Copyright and license
@@ -95,7 +107,7 @@ GNU General Public License for more details.
95107

96108
You should have received a copy of the GNU General Public License
97109
along with this program; if not, write to the.
98-
Free Software Foundation, Inc.,
99-
51 Franklin Street, Fifth Floor, Boston,
100-
MA 02110-1301,
110+
Free Software Foundation, Inc.,
111+
51 Franklin Street, Fifth Floor, Boston,
112+
MA 02110-1301,
101113
USA.

composer.json

Lines changed: 16 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -10,22 +10,25 @@
1010
"php": ">=8.2",
1111
"algo26-matthias/idna-convert": "^v4.2.0",
1212
"enshrined/svg-sanitize": "^0.21.0",
13+
"greew/oauth2-azure-provider": "^v2.0.0",
1314
"netcarver/textile": "v4.1.3",
14-
"league/commonmark": "^2.6.1",
15+
"league/commonmark": "^2.7.0",
16+
"league/oauth2-google": "^4.0.1",
1517
"ezyang/htmlpurifier": "^v4.18.0",
1618
"openpsa/universalfeedcreator": "^v1.9.0",
17-
"phpmailer/phpmailer": "^v6.9.3",
18-
"phpoffice/phpspreadsheet": "4.1.0",
19+
"phpmailer/phpmailer": "^v6.10.0",
20+
"phpoffice/phpspreadsheet": "^4.3.1",
1921
"simplepie/simplepie": "@dev",
2022
"html2text/html2text": "^4.3.2",
2123
"php81_bc/strftime": "^0.7.6",
22-
"symfony/polyfill-php73": "v1.31.0",
23-
"symfony/polyfill-php74": "v1.31.0",
24-
"symfony/polyfill-php80": "v1.31.0",
25-
"symfony/polyfill-php81": "v1.31.0",
26-
"symfony/polyfill-php82": "v1.31.0",
27-
"symfony/polyfill-php83": "v1.31.0",
28-
"symfony/polyfill-php84": "v1.31.0",
24+
"symfony/polyfill-mbstring": "v1.32.0",
25+
"symfony/polyfill-php73": "v1.32.0",
26+
"symfony/polyfill-php74": "v1.32.0",
27+
"symfony/polyfill-php80": "v1.32.0",
28+
"symfony/polyfill-php81": "v1.32.0",
29+
"symfony/polyfill-php82": "v1.32.0",
30+
"symfony/polyfill-php83": "v1.32.0",
31+
"symfony/polyfill-php84": "v1.32.0",
2932
"ext-intl": "*",
3033
"ext-gd": "*",
3134
"ext-iconv": "*",
@@ -40,5 +43,8 @@
4043
"ext-ctype": "*",
4144
"ext-simplexml": "*",
4245
"ext-curl": "*"
46+
},
47+
"require-dev": {
48+
"roave/security-advisories": "dev-latest"
4349
}
4450
}

image_resized.php

Lines changed: 74 additions & 56 deletions
Original file line numberDiff line numberDiff line change
@@ -11,70 +11,93 @@
1111

1212
// <img src="image_resized.php?format=jpg&w=100&h=200&q=85&imgfile=test.jpg" alt="" border="0">
1313

14-
$img_target = (isset($_GET['format'])) ? strtolower(trim($_GET['format'])) : 'jpg';
15-
$img_file = (isset($_GET['imgfile'])) ? trim($_GET['imgfile']) : 'img/leer.gif';
16-
$img_width = (isset($_GET['w'])) ? intval($_GET['w']) : 0;
17-
$img_height = (isset($_GET['h'])) ? intval($_GET['h']) : 0;
18-
$img_quality= (isset($_GET['q']) && intval($_GET['q']) <= 100 && intval($_GET['q'])) ? intval($_GET['q']) : 75;
19-
20-
$img_file = str_replace(array('http://', 'https://'), '', $img_file);
21-
22-
switch($img_target) {
14+
$img_target = isset($_GET['format']) ? strtolower(trim($_GET['format'])) : 'jpg';
15+
$img_file = isset($_GET['imgfile']) ? trim(urldecode($_GET['imgfile'])) : 'img/leer.gif';
16+
$img_width = isset($_GET['w']) ? (int)$_GET['w'] : 0;
17+
$img_height = isset($_GET['h']) ? (int)$_GET['h'] : 0;
18+
$img_quality = isset($_GET['q']) && (int)$_GET['q'] <= 100 && (int)$_GET['q'] ? (int)$_GET['q'] : 75;
19+
$result = false;
20+
21+
// Ensure no protocol handlers (http://…) or something like C:\ or C:/ or ./ or ../ is part of the file name
22+
if (
23+
$img_file
24+
&&
25+
(
26+
$img_file[0] === '.'
27+
||
28+
$img_file[0] === '/'
29+
||
30+
$img_file[0] === '\\'
31+
||
32+
strpos($img_file, ':/') !== false
33+
||
34+
strpos($img_file, './') !== false
35+
||
36+
strpos($img_file, ':\\') !== false
37+
||
38+
strpos($img_file, '.\\') !== false
39+
)
40+
) {
41+
$img_file = '';
42+
} else {
43+
// Absolute path only related to the current directory
44+
$img_file = __DIR__ . '/' . $img_file;
45+
}
2346

47+
switch ($img_target) {
2448
case 'png':
25-
$img_mimetype = 'image/png';
26-
$img_target = 'jpg';
49+
$img_mimetype = 'image/png';
50+
$img_target = 'jpg';
2751
break;
2852

2953
case 'gif':
30-
if(function_exists('imagegif')) {
54+
if (function_exists('imagegif')) {
3155
$img_mimetype = 'image/gif';
32-
$img_target = 'gif';
56+
$img_target = 'gif';
3357
} else {
34-
$img_target = 'png';
58+
$img_target = 'png';
3559
$img_mimetype = 'image/png';
3660
}
3761
break;
3862

3963
case 'webp':
40-
$img_mimetype = 'image/webp';
41-
$img_target = 'webp';
64+
$img_mimetype = 'image/webp';
65+
$img_target = 'webp';
4266
break;
4367

4468
case 'jpeg':
4569
case 'jpg':
4670
default:
47-
$img_mimetype = 'image/jpeg';
48-
$img_target = 'jpg';
49-
71+
$img_mimetype = 'image/jpeg';
72+
$img_target = 'jpg';
5073
}
5174

52-
if(is_file($img_file) && $img_info = getimagesize($img_file)) {
75+
if ($img_file !== '' && is_readable($img_file) && $img_info = getimagesize($img_file)) {
5376

54-
if(!$img_width || $img_width >= $img_info[0]) {
77+
if (!$img_width || $img_width >= $img_info[0]) {
5578
$percent_width = 1;
5679
} else {
5780
$percent_width = $img_width / $img_info[0];
5881
}
5982

60-
if(!$img_height || $img_height >= $img_info[1]) {
83+
if (!$img_height || $img_height >= $img_info[1]) {
6184
$percent_height = 1;
6285
} else {
6386
$percent_height = $img_height / $img_info[1];
6487
}
6588

66-
if($percent_height < $percent_width) {
89+
if ($percent_height < $percent_width) {
6790
$percent = $percent_height;
68-
} elseif($percent_height > $percent_width) {
91+
} elseif ($percent_height > $percent_width) {
6992
$percent = $percent_width;
7093
} else {
7194
$percent = $percent_width;
7295
}
7396

74-
$img_width = $img_info[0] * $percent;
97+
$img_width = $img_info[0] * $percent;
7598
$img_height = $img_info[1] * $percent;
7699

77-
switch($img_target) {
100+
switch ($img_target) {
78101
case 'jpg':
79102
case 'png':
80103
case 'webp':
@@ -86,8 +109,7 @@
86109
break;
87110
}
88111

89-
switch($img_info[2]) {
90-
112+
switch ($img_info[2]) {
91113
case IMAGETYPE_GIF: // GIF
92114
$img_source = imagecreatefromgif($img_file);
93115
break;
@@ -105,41 +127,37 @@
105127
break;
106128
}
107129

108-
imagecopyresized($new_img, $img_source, 0, 0, 0, 0, $img_width, $img_height, $img_info[0], $img_info[1]);
109-
110-
header('Content-type: '.$img_mimetype);
111-
112-
switch($img_target) {
113-
114-
case 'jpg':
115-
imagejpeg($new_img, NULL, $img_quality);
116-
break;
117-
118-
case 'webp':
119-
imagewebp($new_img, NULL, $img_quality);
120-
break;
121-
122-
case 'png':
123-
imagepng($new_img, NULL, 9);
124-
break;
125-
126-
case 'gif':
127-
imagegif($new_img);
128-
break;
129-
130+
$result = imagecopyresized($new_img, $img_source, 0, 0, 0, 0, $img_width, $img_height, $img_info[0], $img_info[1]);
131+
132+
if ($result) {
133+
header('Content-type: ' . $img_mimetype);
134+
135+
switch ($img_target) {
136+
case 'jpg':
137+
$result = imagejpeg($new_img, NULL, $img_quality);
138+
break;
139+
case 'webp':
140+
$result = imagewebp($new_img, NULL, $img_quality);
141+
break;
142+
case 'png':
143+
$result = imagepng($new_img, NULL, 9);
144+
break;
145+
case 'gif':
146+
$result = imagegif($new_img);
147+
break;
148+
}
130149
}
131150

132151
imagedestroy($new_img);
133152
imagedestroy($img_source);
153+
}
134154

135-
} else {
136-
137-
// error / no image
138-
header ('Content-type: image/png');
155+
// Error / no image
156+
if (!$result) {
157+
header('Content-type: image/png');
139158
$new_img = imagecreatetruecolor(75, 20);
140159
$text_color = imagecolorallocate($new_img, 255, 255, 255);
141-
imagestring($new_img, 1, 5, 5, "Image Error", $text_color);
160+
imagestring($new_img, 1, 5, 5, 'Image Error', $text_color);
142161
imagepng($new_img, NULL, 9);
143162
imagedestroy($new_img);
144-
145163
}

include/config/dist.conf.inc.php

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@
5656
$phpwcms['img_prev_height'] = 734; // max height of the large preview image
5757
$phpwcms['max_time'] = 1800; // logout after max_time/60 seconds
5858
$phpwcms['responsive'] = 1; // 0 max. image width = $phpwcms['content_width'], 1 = as given
59-
$phpwcms['preserve_image_name'] = 0; // keep file name for resized versions of the image
59+
$phpwcms['preserve_image_name'] = 1; // keep file name for resized versions of the image
6060

6161
// other stuff
6262
$phpwcms['image_library'] = 'GD2'; // GD, GD2, ImageMagick, GraphicsMagick or GM, NetPBM
@@ -163,11 +163,17 @@
163163
$phpwcms['SMTP_FROM_NAME'] = 'My Name'; // reply/from name
164164
$phpwcms['SMTP_HOST'] = 'localhost'; // SMTP server (host/IP)
165165
$phpwcms['SMTP_PORT'] = 25; // SMTP server port (default 25)
166-
$phpwcms['SMTP_MAILER'] = 'mail'; // mail method: mail (default), smtp, sendmail
166+
$phpwcms['SMTP_MAILER'] = 'mail'; // mail method: mail (default), smtp, sendmail, qmail
167167
$phpwcms['SMTP_USER'] = 'user'; // default SMTP login (user) name
168168
$phpwcms['SMTP_PASS'] = 'pass'; // default SMTP password
169169
$phpwcms['SMTP_SECURE'] = ''; // secure connection, phpMailer options: '', 'ssl' or 'tls'
170170
$phpwcms['SMTP_AUTH'] = 0; // SMTP authentication, ON=1/OFF=0
171-
$phpwcms['SMTP_AUTH_TYPE'] = ''; // sets SMTP auth type: LOGIN (default), PLAIN, NTLM, CRAM-MD5
171+
$phpwcms['SMTP_AUTH_TYPE'] = ''; // sets SMTP auth type: CRAM-MD5, LOGIN, PLAIN, XOAUTH2
172+
$phpwcms['SMTP_XOAUTH_PROVIDER'] = ''; // XOAUTH2 authentication provider, currently 'Google', 'Microsoft' or 'Azure' are supported
173+
$phpwcms['SMTP_CLIENT_ID'] = ''; // The client ID for OAuth2 authentication
174+
$phpwcms['SMTP_CLIENT_SECRET'] = ''; // The client secret for OAuth2 authentication
175+
$phpwcms['SMTP_TENANT_ID'] = ''; // The tenant ID for Microsoft OAuth2 authentication
176+
$phpwcms['SMTP_REFRESH_TOKEN'] = ''; // The OAuth2 refresh token (see the backend to obtain it)
177+
$phpwcms['SMTP_DEBUG'] = 0; // SMTP debug level, 0 = off, 1 = client messages, 2 = client and server messages, 3 = plus connection status, 4 = low-level data
172178

173179
define('PHPWCMS_INCLUDE_CHECK', true);

0 commit comments

Comments
 (0)