Skip to content

Commit 37f6c84

Browse files
zorg Code v4.11.1
Merge pull request #78 from zorgch/develop
2 parents d84cd79 + 4a5af6a commit 37f6c84

File tree

8 files changed

+88
-83
lines changed

8 files changed

+88
-83
lines changed

Docker/.env.docker

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ DOMAINNAME="zorg.local"
77
APACHE_USER="www-data"
88
APACHE_GROUP="www-data"
99
APACHE_WEBROOT="/var/www"
10-
PHP_Version=7.4
10+
PHP_VERSION=7.4
1111
PHP_INI_DIR="/usr/local/etc/php"
1212
XDEBUG_PORT=9003
1313
XDEBUG_MODES="develop,debug,profile"

www/includes/apod.inc.php

Lines changed: 42 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,9 @@
44
*
55
* Holt und speichert die Astronomy Pictures of the Day (APOD)
66
*
7-
* @author [z]biko
8-
* @date 01.01.2004
7+
* @version 1.0
8+
* @since 1.0 `01.01.2004` `[z]biko` File added
9+
*
910
* @package zorg\APOD
1011
*/
1112
/**
@@ -16,7 +17,7 @@
1617
* @include gallery.inc.php Gallery and Pic functions
1718
* @include util.inc.php Various Helper Functions
1819
*/
19-
require_once dirname(__FILE__).'/config.inc.php';
20+
require_once __DIR__.'/config.inc.php';
2021
require_once INCLUDES_DIR.'mysql.inc.php';
2122
require_once INCLUDES_DIR.'forum.inc.php';
2223
require_once INCLUDES_DIR.'gallery.inc.php';
@@ -36,28 +37,26 @@
3637
* hd | bool | False | Retrieve the URL for the high resolution image
3738
* api_key | string | DEMO_KEY | api.nasa.gov key for expanded usage
3839
*
39-
* @author [z]biko
40-
* @author IneX
41-
* @version 4.1
42-
* @since 1.0 `01.01.2004` function added
43-
* @since 2.0 `06.08.2018` function refactored to use NASA APOD API
44-
* @since 3.0 `09.08.2018` enhanced function so an APOD date can be passed
45-
* @since 4.0 `14.09.2018` added processing of videos & website links passed from the APOD API
46-
* @since 4.1 `26.06.2023` fixes code quality issue "Unreachable code ('cleanup:')"
40+
* @version 4.2
41+
* @since 1.0 `01.01.2004` `[z]biko` function added
42+
* @since 2.0 `06.08.2018` `IneX` function refactored to use NASA APOD API
43+
* @since 3.0 `09.08.2018` `IneX` enhanced function so an APOD date can be passed
44+
* @since 4.0 `14.09.2018` `IneX` added processing of videos & website links passed from the APOD API
45+
* @since 4.1 `26.06.2023` `IneX` fixes code quality issue "Unreachable code ('cleanup:')"
46+
* @since 4.2 `24.02.2024` `IneX` replaces deprecated $MAX_PIC_SIZE, fixes SQL INSERT with empty 'extension'
4747
*
48-
* @uses APOD_API, APOD_TEMP_IMGPATH, APOD_GALLERY_ID, $MAX_PIC_SIZE
48+
* @uses APOD_API, APOD_TEMP_IMGPATH, APOD_GALLERY_ID, MAX_PIC_SIZE
4949
* @uses cURLfetchJSON(), createPic(), getYoutubeVideoThumbnail(), getVimeoVideoThumbnail(), Comment::post()
5050
* @param string $apod_date (Optional) A valid date after June 16 1995, formatted as: yyyy-mm-dd (2018-08-06)
51-
* @global object $db Globales Class-Object mit allen MySQL-Methoden
52-
* @global array $MAX_PIC_SIZE Globales Array im Scope von gallery.inc.php mit den Image-Width & -Height Grössen für Pics und Thumbnails
51+
* @global object $db Globales Class-Object mit allen MySQL-Methoden
5352
* @return boolean Returns true or false, depening on if the function was processed successfully or not
5453
*/
5554
function get_apod($apod_date_input=NULL)
5655
{
57-
global $db, $MAX_PIC_SIZE;
56+
global $db;
5857

5958
/** Validate $apod_date if passed */
60-
if (DEVELOPMENT) error_log(sprintf('[DEBUG] <%s:%d> $apod_date_input: %s', __FUNCTION__, __LINE__, $apod_date_input));
59+
zorgDebugger::log()->debug('$apod_date_input: %s', [$apod_date_input]);
6160
if (empty($apod_date_input) || strtotime($apod_date_input) === false) $apod_date_input = NULL;
6261

6362
/** Retrieve the APOD data from the APOD_API */
@@ -82,10 +81,10 @@ function get_apod($apod_date_input=NULL)
8281
* [url] => https://apod.nasa.gov/apod/http://nusoft.fnal.gov/nova/public/img/FD-evt-echo.gif
8382
* )
8483
*/
85-
if ( DEVELOPMENT && $apod_date_input != NULL ) error_log(sprintf('[DEBUG] <%s:%d> date("ymd",$apod_date_input): %s', __FUNCTION__, __LINE__, date('ymd',strtotime($apod_date_input))));
86-
if ( DEVELOPMENT && $apod_date_input == NULL ) error_log(sprintf('[DEBUG] <%s:%d> date("ymd",strtotime($apod_data[date])): %s', __FUNCTION__, __LINE__, date('ymd',strtotime($apod_data['date']))));
84+
zorgDebugger::log()->debug('date("ymd",$apod_date_input): %s', [date('ymd',strtotime($apod_date_input))]);
85+
zorgDebugger::log()->debug('date("ymd",strtotime($apod_data[date])): %s', [date('ymd',strtotime($apod_data['date']))]);
8786
$new_apod_date = ( $apod_date_input != NULL ? date('ymd',strtotime($apod_date_input)) : date('ymd',strtotime($apod_data['date'])) );
88-
if (DEVELOPMENT) error_log(sprintf('[DEBUG] <%s:%d> $new_apod_date: %s', __FUNCTION__, __LINE__, $new_apod_date));
87+
zorgDebugger::log()->debug('$new_apod_date: %s', [$new_apod_date]);
8988
$new_apod_title = $apod_data['title'];
9089
$new_apod_explanation = $apod_data['explanation'];
9190
$new_apod_copyright = $apod_data['copyright'];
@@ -94,7 +93,7 @@ function get_apod($apod_date_input=NULL)
9493
$new_apod_img_large = str_replace('https://apod.nasa.gov/apod/http', 'http', $apod_data['hdurl']); // with fix for malformed url (APOD API issue)
9594
$new_apod_archive_url = APOD_SOURCE . 'ap'.$new_apod_date.'.html'; // E.g.: https://apod.nasa.gov/apod/ap180714.html
9695
$new_apod_urlparts = pathinfo($new_apod_img_small);
97-
if (DEVELOPMENT) error_log(sprintf('[DEBUG] <%s:%d> pathinfo(): %s', __FUNCTION__, __LINE__, print_r($new_apod_urlparts,true)));
96+
zorgDebugger::log()->debug('pathinfo(): %s', [print_r($new_apod_urlparts,true)]);
9897
$new_apod_fileext = $new_apod_urlparts['extension'];
9998
$new_apod_filename = $apod_data['date'] . '.' . $new_apod_fileext;
10099
$new_apod_temp_filepath = APOD_TEMP_IMGPATH . $new_apod_filename;
@@ -109,13 +108,14 @@ function get_apod($apod_date_input=NULL)
109108
if (!empty($new_apod_title))
110109
{
111110
if ($new_apod_mediatype === 'image') $new_apod_fileext = '.'.$new_apod_fileext;
112-
$new_apod_picid = $db->insert('gallery_pics', [
113-
'album'=>APOD_GALLERY_ID
114-
,'extension'=>$new_apod_fileext
115-
,'pic_added'=>$new_apod_date
116-
,'name'=>$new_apod_title.($new_apod_mediatype == 'video' ? ' [video]' : '')
117-
], __FILE__, __LINE__, __FUNCTION__);
118-
if (DEVELOPMENT) error_log(sprintf('[DEBUG] <%s:%d> $new_apod_picid: %s', __FUNCTION__, __LINE__, $new_apod_picid));
111+
$new_apod_basedata = [
112+
'album'=>APOD_GALLERY_ID
113+
,'pic_added'=>$new_apod_date
114+
,'name'=>$new_apod_title.($new_apod_mediatype == 'video' ? ' [video]' : '')
115+
];
116+
if (!empty($new_apod_fileext) && is_string($new_apod_fileext)) $new_apod_basedata['extension'] = $new_apod_fileext;
117+
$new_apod_picid = $db->insert('gallery_pics', $new_apod_basedata, __FILE__, __LINE__, __FUNCTION__);
118+
zorgDebugger::log()->debug('$new_apod_picid: %s', [$new_apod_picid]);
119119

120120
/** If $new_apod_title is empty, abort */
121121
} else {
@@ -142,8 +142,8 @@ function get_apod($apod_date_input=NULL)
142142
$new_apod_filepath_pic_tn = tnPath(APOD_GALLERY_ID, $new_apod_picid, $new_apod_fileext); // Fix eventual double-slashes in path
143143

144144
/** Create APOD gallery pic */
145-
if (DEVELOPMENT) error_log(sprintf('[DEBUG] <%s:%d> createPic(): %s', __FUNCTION__, __LINE__, $new_apod_filepath_pic));
146-
if (!createPic($new_apod_temp_filepath, $new_apod_filepath_pic, $MAX_PIC_SIZE['picWidth'], $MAX_PIC_SIZE['picHeight']))
145+
zorgDebugger::log()->debug('image createPic(): %s', [$new_apod_filepath_pic]);
146+
if (!createPic($new_apod_temp_filepath, $new_apod_filepath_pic, MAX_PIC_SIZE['width'], MAX_PIC_SIZE['height']))
147147
{
148148
error_log(sprintf('[ERROR] <%s:%d> %s createPic() ERROR: %s', __FILE__, __LINE__, __FUNCTION__, $new_apod_filepath_pic));
149149
/** Goto: cleanup */
@@ -152,8 +152,8 @@ function get_apod($apod_date_input=NULL)
152152
}
153153

154154
/** Create APOD gallery pic-thumbnail */
155-
if (DEVELOPMENT) error_log(sprintf('[DEBUG] <%s:%d> createPic() thumbnail: %s', __FUNCTION__, __LINE__, $new_apod_filepath_pic_tn));
156-
if (!createPic($new_apod_temp_filepath, $new_apod_filepath_pic_tn, $MAX_PIC_SIZE['tnWidth'], $MAX_PIC_SIZE['tnHeight']))
155+
zorgDebugger::log()->debug('image createPic() thumbnail: %s', [$new_apod_filepath_pic_tn]);
156+
if (!createPic($new_apod_temp_filepath, $new_apod_filepath_pic_tn, MAX_THUMBNAIL_SIZE['width'], MAX_THUMBNAIL_SIZE['height']))
157157
{
158158
error_log(sprintf('[ERROR] <%s:%d> %s createPic() thumbnail ERROR: %s', __FILE__, __LINE__, __FUNCTION__, $new_apod_filepath_pic_tn));
159159
/** Goto: cleanup */
@@ -171,6 +171,7 @@ function get_apod($apod_date_input=NULL)
171171
*/
172172
case 'video':
173173
/* Find out what 'video'-type exactly we're dealing with... */
174+
$media_type = null;
174175
$video_services = [
175176
[
176177
'service' => 'youtube'
@@ -186,14 +187,14 @@ function get_apod($apod_date_input=NULL)
186187
if (strpos($service['identifier'], $new_apod_urlparts['dirname']) !== false)
187188
{
188189
$media_type = $service['service'];
190+
zorgDebugger::log()->debug('$service[identifier] found: %s', [$media_type]);
189191
/** Video type found, let's exit the foreach{}-loop */
190-
if (DEVELOPMENT) error_log(sprintf('[DEBUG] <%s:%d> $service[identifier] found: %s', __FUNCTION__, __LINE__, $media_type));
191192
break;
192193
}
193194
}
194195

195196
/** No matching $media_type found, let's Goto: cleanup */
196-
if (DEVELOPMENT) error_log(sprintf('[DEBUG] <%s:%d> $media_type: %s', __FUNCTION__, __LINE__, print_r($media_type,true)));
197+
zorgDebugger::log()->debug('$media_type: NOT FOUND --> %s', [print_r($media_type,true)]);
197198
if (empty($media_type) || is_array($media_type))
198199
{
199200
/** Goto: cleanup */
@@ -204,7 +205,7 @@ function get_apod($apod_date_input=NULL)
204205
/** Get Video-Thumbnail image */
205206
$new_apod_img_thumbnail = getVideoThumbnail($media_type, $new_apod_urlparts['filename']);
206207
$new_apod_temp_filepath = $new_apod_temp_filepath.pathinfo($new_apod_img_thumbnail, PATHINFO_EXTENSION);
207-
if (DEVELOPMENT) error_log(sprintf('[DEBUG] <%s:%d> cURLfetchUrl(): %s', __FUNCTION__, __LINE__, $new_apod_temp_filepath));
208+
zorgDebugger::log()->debug('video cURLfetchUrl(): %s', [$new_apod_temp_filepath]);
208209
if (!cURLfetchUrl($new_apod_img_thumbnail, $new_apod_temp_filepath))
209210
{
210211
remove_apod_id_from_db($new_apod_picid);
@@ -213,8 +214,8 @@ function get_apod($apod_date_input=NULL)
213214

214215
/** Create APOD gallery pic-thumbnail for 'video' */
215216
$new_apod_filepath_pic_tn = tnPath(APOD_GALLERY_ID, $new_apod_picid, '.'.pathinfo($new_apod_img_thumbnail, PATHINFO_EXTENSION));
216-
if (DEVELOPMENT) error_log(sprintf('[DEBUG] <%s:%d> createPic() thumbnail: %s', __FUNCTION__, __LINE__, $new_apod_filepath_pic_tn));
217-
if (!createPic($new_apod_temp_filepath, $new_apod_filepath_pic_tn, $MAX_PIC_SIZE['tnWidth'], $MAX_PIC_SIZE['tnHeight']))
217+
zorgDebugger::log()->debug('video createPic() thumbnail: %s', [$new_apod_filepath_pic_tn]);
218+
if (!createPic($new_apod_temp_filepath, $new_apod_filepath_pic_tn, MAX_PIC_SIZE['width'], MAX_PIC_SIZE['height']))
218219
{
219220
error_log(sprintf('[ERROR] <%s:%d> %s createPic() thumbnail ERROR: %s', __FILE__, __LINE__, __FUNCTION__, $new_apod_filepath_pic_tn));
220221
remove_apod_id_from_db($new_apod_picid);
@@ -223,7 +224,7 @@ function get_apod($apod_date_input=NULL)
223224

224225
/** Update APOD 'video' entry in gallery_pics table */
225226
$result = $db->update('gallery_pics', ['id', $new_apod_picid], ['extension' => $media_type, 'picsize' => $new_apod_img_small], __FILE__, __LINE__, __FUNCTION__);
226-
if (DEVELOPMENT) error_log(sprintf('[DEBUG] <%s:%d> $db->update(gallery_pics): (%s) %s', __FUNCTION__, __LINE__, $result, ($result>0 ? 'true' : 'false')));
227+
zorgDebugger::log()->debug('$db->update(gallery_pics): (%s) %s', [$result, ($result>0 ? 'true' : 'false')]);
227228
if ($result === 0) {
228229
remove_apod_id_from_db($new_apod_picid);
229230
return false;
@@ -238,10 +239,10 @@ function get_apod($apod_date_input=NULL)
238239
case 'website':
239240
/** Create APOD gallery pic-thumbnail for 'video' or 'website' */
240241
$new_apod_temp_filepath = PHP_IMAGES_DIR . 'apod/tn_website.png';
241-
if (DEVELOPMENT) error_log(sprintf('[DEBUG] <%s:%d> $new_apod_temp_filepath: %s', __FUNCTION__, __LINE__, $new_apod_temp_filepath));
242+
zorgDebugger::log()->debug('$new_apod_temp_filepath: %s', [$new_apod_temp_filepath]);
242243
$new_apod_filepath_pic_tn = tnPath(APOD_GALLERY_ID, $new_apod_picid, '.'.pathinfo($new_apod_temp_filepath, PATHINFO_EXTENSION));
243-
if (DEVELOPMENT) error_log(sprintf('[DEBUG] <%s:%d> createPic() thumbnail: %s', __FUNCTION__, __LINE__, $new_apod_filepath_pic_tn));
244-
if (!createPic($new_apod_temp_filepath, $new_apod_filepath_pic_tn, $MAX_PIC_SIZE['tnWidth'], $MAX_PIC_SIZE['tnHeight']))
244+
zorgDebugger::log()->debug('website createPic() thumbnail: %s', [$new_apod_filepath_pic_tn]);
245+
if (!createPic($new_apod_temp_filepath, $new_apod_filepath_pic_tn, MAX_PIC_SIZE['width'], MAX_PIC_SIZE['height']))
245246
{
246247
error_log(sprintf('[ERROR] <%s:%d> %s createPic() thumbnail ERROR: %s', __FILE__, __LINE__, __FUNCTION__, $new_apod_filepath_pic_tn));
247248
remove_apod_id_from_db($new_apod_picid);
@@ -250,7 +251,7 @@ function get_apod($apod_date_input=NULL)
250251

251252
/** Update APOD 'website' entry in gallery_pics table */
252253
$result = $db->update('gallery_pics', ['id', $new_apod_picid], ['extension' => $new_apod_mediatype, 'picsize' => $new_apod_img_small], __FILE__, __LINE__, __FUNCTION__);
253-
if (DEVELOPMENT) error_log(sprintf('[DEBUG] <%s:%d> $db->update(gallery_pics): (%s) %s', __FUNCTION__, __LINE__, $result, ($result>0 ? 'true' : 'false')));
254+
zorgDebugger::log()->debug('$db->update(gallery_pics): (%s) %s', [($result>0 ? 'true' : 'false')]);
254255
if ($result === 0) {
255256
remove_apod_id_from_db($new_apod_picid);
256257
return false;

www/includes/gallery.inc.php

Lines changed: 17 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1497,14 +1497,14 @@ function createPic($srcFile, $dstFile, $maxWidth, $maxHeight, $bgcolor=0)
14971497

14981498
$ret = array('width'=>$maxWidth, 'height'=>$maxHeight);
14991499
} else {
1500-
$dst = ImageCreateTrueColor ($picWidth, $picHeight); // GD 2.0.1
1501-
//$dst = ImageCreate($picWidth, $picHeight); // GD 1.6
1500+
$dst = ImageCreateTrueColor($picWidth, $picHeight); // GD 2.0.1
1501+
//$dst = ImageCreate($picWidth, $picHeight); // GD 1.6
15021502
if (!$dst) return array('error'=>"Bild konnte nicht erzeugt werden");
15031503

15041504
if (ImageCopyResampled($dst, $src, 0,0,0,0, $picWidth, $picHeight, $width, $height)) {
1505-
if (DEVELOPMENT) error_log(sprintf('[DEBUG] <%s:%d> ImageCopyResampled OK', __FUNCTION__, __LINE__));
1505+
zorgDebugger::log()->debug('ImageCopyResampled OK');
15061506
} else {
1507-
error_log(sprintf('[ERROR] <%s:%d> ImageCopyResampled: %s => %s', __FUNCTION__, __LINE__, $src, $dst));
1507+
error_log(sprintf('[ERROR] <%s:%d> ImageCopyResampled: %s', __FUNCTION__, __LINE__, $src));
15081508
return false;
15091509
}
15101510

@@ -1513,42 +1513,41 @@ function createPic($srcFile, $dstFile, $maxWidth, $maxHeight, $bgcolor=0)
15131513

15141514
switch ($ext) {
15151515
case '.jpg':
1516-
if (DEVELOPMENT) error_log(sprintf('[DEBUG] <%s:%d> ImageJPEG(%s, %s)', __FUNCTION__, __LINE__, $dst, $dstFile));
1516+
zorgDebugger::log()->debug('ImageJPEG($dst, %s)', [$dstFile]);
15171517
if (!ImageJPEG($dst, $dstFile)) {
1518-
error_log(sprintf('[ERROR] <%s:%d> ImageJPEG: %s => %s', __FUNCTION__, __LINE__, $dst, $dstFile));
1518+
zorgDebugger::log()->debug('ImageJPEG: $dst => %s', [$dstFile]);
15191519
return false;
15201520
}
1521-
if (DEVELOPMENT) error_log(sprintf('[DEBUG] <%s:%d> ImageJPEG() OK', __FUNCTION__, __LINE__));
1521+
zorgDebugger::log()->debug('ImageJPEG() OK');
15221522
break;
15231523

15241524
case '.gif':
1525-
if (DEVELOPMENT) error_log(sprintf('[DEBUG] <%s:%d> ImageGIF(%s, %s)', __FUNCTION__, __LINE__, $dst, $dstFile));
1525+
zorgDebugger::log()->debug('ImageGIF($dst, %s)', [$dstFile]);
15261526
if (!ImageGIF($dst, $dstFile)) {
1527-
error_log(sprintf('[ERROR] <%s:%d> ImageGIF: %s => %s', __FUNCTION__, __LINE__, $dst, $dstFile));
1527+
zorgDebugger::log()->debug('ImageGIF: $dst => %s', [$dstFile]);
15281528
return false;
15291529
}
1530-
if (DEVELOPMENT) error_log(sprintf('[DEBUG] <%s:%d> ImageGIF() OK', __FUNCTION__, __LINE__));
1530+
zorgDebugger::log()->debug('ImageGIF() OK');
15311531
break;
15321532

15331533
case '.png':
1534-
if (DEVELOPMENT) error_log(sprintf('[DEBUG] <%s:%d> ImagePNG(%s, %s)', __FUNCTION__, __LINE__, $dst, $dstFile));
1534+
zorgDebugger::log()->debug('ImagePNG($dst, %s)', [$dstFile]);
15351535
if (!ImagePNG($dst, $dstFile)) {
1536-
error_log(sprintf('[ERROR] <%s:%d> ImagePNG: %s => %s', __FUNCTION__, __LINE__, $dst, $dstFile));
1536+
zorgDebugger::log()->debug('ImagePNG: $dst => %s', [$dstFile]);
15371537
return false;
15381538
}
1539-
if (DEVELOPMENT) error_log(sprintf('[DEBUG] <%s:%d> ImagePNG() OK', __FUNCTION__, __LINE__));
1539+
zorgDebugger::log()->debug('ImagePNG() OK');
15401540
break;
15411541

15421542
default:
1543-
error_log(sprintf('[ERROR] <%s:%d> Wrong File Type', __FUNCTION__, __LINE__));
1543+
error_log(sprintf('[ERROR] <%s:%d> Wrong File Type: %s', __FUNCTION__, __LINE__, strval($ext)));
15441544
return false;
1545-
break;
15461545
}
15471546
chmod($dstFile, 0664);
15481547

15491548
ImageDestroy($src);
15501549
ImageDestroy($dst);
1551-
if (DEVELOPMENT) error_log(sprintf('[DEBUG] <%s:%d> ImageDestroy() OK', __FUNCTION__, __LINE__));
1550+
zorgDebugger::log()->debug('ImageDestroy() OK');
15521551

15531552
return $ret;
15541553
}
@@ -2012,7 +2011,7 @@ function pic2album($id)
20122011
function getVideoThumbnail($service, $video_id, $image_size='small', $output_to='display')
20132012
{
20142013
/** Validate & format passed parameters */
2015-
if (DEVELOPMENT) error_log(sprintf('[DEBUG] <%s:%d> getVideoThumbnail(): %s, %s, %s, %s', __FUNCTION__, __LINE__, $service, $video_id, $image_size, $output_to));
2014+
zorgDebugger::log()->debug('getVideoThumbnail(): %s, %s, %s, %s', [$service, $video_id, $image_size, $output_to]);
20162015
if (is_array($service) || is_array($video_id) || is_array($image_size) || is_array($output_to)) return false;
20172016
if (is_numeric($service) || is_numeric($image_size) || is_numeric($output_to)) return false;
20182017
if (strpos($video_id, '?') > 0) $video_id = strtok($video_id, '?');
@@ -2037,7 +2036,7 @@ function getVideoThumbnail($service, $video_id, $image_size='small', $output_to=
20372036
]
20382037
];
20392038
$thumbnailUrl = sprintf($service_data[$service]['url'], $video_id, $service_data[$service]['size'][$image_size]);
2040-
if (DEVELOPMENT) error_log(sprintf('[DEBUG] <%s:%d> $thumbnailUrl: %s', __FUNCTION__, __LINE__, $thumbnailUrl));
2039+
zorgDebugger::log()->debug('$thumbnailUrl: %s', [$thumbnailUrl]);
20412040

20422041
/** Download Video-Thumbnail from URL to path as specified in $output_to */
20432042
if ($output_to != 'display')

www/includes/mysql.inc.php

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,9 +110,13 @@ function query($sql, $file='', $line=0, $funktion='', $params=[]) {
110110
/** Check if $params is provided, if not, execute the query directly */
111111
if (empty($params)) {
112112
$result = mysqli_query($this->conn, $sql);
113-
/* Log SQL-Queries not upgraded to Prepared Statements */
113+
/** Log SQL-Queries not upgraded to Prepared Statements */
114114
zorgDebugger::log()->debug('<%s:%d> may required update to SQL prepared statement, in %s', [$funktion, $line, $file]);
115115
} else {
116+
/** Ensure $params is an Array */
117+
if (is_object($params)) throw '$params cannot be of type object!';
118+
if (!is_array($params)) $params = [ $params ];
119+
116120
$stmt = mysqli_prepare($this->conn, $sql);
117121
if ($stmt === false) throw new mysqli_sql_exception(mysqli_error($this->conn));
118122

www/includes/usersystem.inc.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -187,7 +187,7 @@ function __construct()
187187

188188
/** Grundsätzlich mal jeden zuerst als "Gast" anschauen */
189189
$this->typ = USER_ALLE;
190-
session_name(ZORG_SESSION_ID);
190+
session_name(ZORG_SESSION_ID); // FIXME Cannot change session name when session is active
191191

192192
/** DEACTIVATED: Generelle Session Settings & Session (re-)Starten (wenn noch nicht aktiv) */
193193
// if (session_status() === PHP_SESSION_NONE)
@@ -1831,10 +1831,10 @@ function get_and_create_user_files_dir($user_id)
18311831
* @since 1.0 `04.01.2024` `IneX` Method added
18321832
*
18331833
* @param integer $user_id
1834-
* @param string $game_name Name of Game: «addle» or chess. Default: addle
1834+
* @param string $game_name Name of Game: «addle» or «chess». Default: addle
18351835
* @return boolean
18361836
*/
1837-
function userPlays($game_name='addle', $user_id)
1837+
function userPlays($user_id, $game_name='addle')
18381838
{
18391839
global $db;
18401840

www/profil.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -177,7 +177,7 @@
177177
$htmlOutput .= '<img src="'.$user->userImage($user_id, 1).'">';//style="width: 100%;max-width: 100%;"
178178

179179
/** User Addle (nur wenn Viewer selber eingeloggt ist) */
180-
if ($user->is_loggedin() && $user_id !== $user->id && $user->userPlays('addle', $user_id))
180+
if ($user->is_loggedin() && $user_id !== $user->id && $user->userPlays($user_id, 'addle'))
181181
{
182182
$sidebarHtml .= '<h3>Addle</h3>
183183
<form action="/addle.php?show=overview&do=new" method="post">

0 commit comments

Comments
 (0)