craigk5n / webcalendar

WebCalendar is a PHP application used to maintain a calendar for a single user or an intranet group of users. It can also be configured as an event calendar.
http://www.k5n.us/webcalendar.php
GNU General Public License v2.0
153 stars 75 forks source link

Error when creating a new category #496

Closed s22-tech closed 1 month ago

s22-tech commented 3 months ago

PHP Parse error: syntax error, unexpected single-quoted string " )" in /cal/category_handler.php on line 74

I fixed it by making this change:

if (!dbi_execute("
   DELETE FROM `webcal_entry_categories`
   WHERE `cat_id` = ? AND ( `cat_owner` = ?"
    . ($is_admin ? " OR `cat_owner` = '' )" : " )"),
   [$id, $login]
)) {

Switching to double quotes around the SQL not only eliminates the problem, but also makes the SQL stand out from the rest of the code.

s22-tech commented 3 months ago

Unfortunately, I'm not able to delete a category. I'm not getting an error, but $delete = getPostValue('delete'); appears to be empty.

s22-tech commented 3 months ago

I'm getting this error in the console. It flashes briefly before disappearing, so I had to take a video of it, and then a still. There is no line 238 in category.php, let alone a line 170, so not sure what it's referring to.

Screenshot 2024-06-25 at 8 43 11 PM

s22-tech commented 3 months ago

I found it. Line 89 of category.php is missing a quote mark. Change this:

. 'type="submit" onclick="return confirm('

to this:

. 'type="submit" onclick="return confirm(\''

craigk5n commented 1 month ago

Should be fixed now.