Calendar_XH 1.4.6 plugin and php 7.07

Third Party Plugins to CMSimple - how to install, use and create plugins

Moderator: Tata

Post Reply
simpleSolutions.dk
Posts: 155
Joined: Thu Oct 06, 2011 7:00 am

Calendar_XH 1.4.6 plugin and php 7.07

Post by simpleSolutions.dk » Tue May 31, 2016 10:20 am

I can't save calendar evetns on php 7.07. There were no proplems on my development server running php 5.6 but when the plugin was moved to a server with php 7.07 no event data can be saved, exept of hours. I changed file permmissions to 777 with no results. Any ideas what's changed in php 7.07?

cmb
Posts: 14225
Joined: Tue Jun 21, 2011 11:04 am
Location: Bingen, RLP, DE
Contact:

Re: Calendar_XH 1.4.6 plugin and php 7.07

Post by cmb » Tue May 31, 2016 11:20 am

Christoph M. Becker – Plugins for CMSimple_XH

simpleSolutions.dk
Posts: 155
Joined: Thu Oct 06, 2011 7:00 am

Re: Calendar_XH 1.4.6 plugin and php 7.07

Post by simpleSolutions.dk » Wed Jun 01, 2016 10:06 am

Removing e parameter from preg_replace solved some, but not all bugs. Events are not highlighted in calendar view and nextevent marquee dosen't contain any data. NMay be I didn't find all preg_replace in the source, but I quess that there are som other changes in php 7 that teases.

cmb
Posts: 14225
Joined: Tue Jun 21, 2011 11:04 am
Location: Bingen, RLP, DE
Contact:

Re: Calendar_XH 1.4.6 plugin and php 7.07

Post by cmb » Wed Jun 01, 2016 11:28 am

simpleSolutions.dk wrote:Removing e parameter from preg_replace solved some, but not all bugs. Events are not highlighted in calendar view and nextevent marquee dosen't contain any data. NMay be I didn't find all preg_replace in the source, but I quess that there are som other changes in php 7 that teases.
I found at least one other issue, namely in includes/calendar.php line 890:

Code: Select all

                $$event_type_array[$keys]=$i; 
Such complex expressions did change their meaning in PHP 7 for a more uniform variable syntax. Changing the line to the following is supposed to work (PHP 5 and PHP 7):

Code: Select all

                ${$event_type_array[$keys]}=$i; 
PS: enabling debug-mode should be helpful to find such issues (you can ignore the deprecated warnings "Methods with the same name as their class will not be constructors…").

PPS: includes/nextevent.php lines 234-246 have to be changed accordingly:

Code: Select all

                array_push($event_1stline_array, ${$calendar_cf['marquee_1stline']});
PPPS: and apparently, there are more such complex variable variable expressions which would have to be changed.

PPPPS: a hopefully complete diff:

Code: Select all

 includes/calendar.php     |  2 +-
 includes/editevents.php   | 24 ++++++++++++------------
 includes/nextevent.php    | 22 +++++++++++-----------
 includes/simplemarkup.php |  4 ++--
 4 files changed, 26 insertions(+), 26 deletions(-)

diff --git a/includes/calendar.php b/includes/calendar.php
index 3367a5d..fe7c790 100644
--- a/includes/calendar.php
+++ b/includes/calendar.php
@@ -887,7 +887,7 @@ while ($extramonths < $number) {
               )
             {
                 //producing variables ($shortevent, $startevent, $midevent, $endevent. $holiday) that can be filled with a date
-                $$event_type_array[$keys]=$i;
+                ${$event_type_array[$keys]}=$i;
                 // extracting the holiday name
                 $day_name = $holiday_array[$keys];
 
diff --git a/includes/editevents.php b/includes/editevents.php
index 88ef61e..e9d2a68 100644
--- a/includes/editevents.php
+++ b/includes/editevents.php
@@ -156,25 +156,25 @@ if ($dataset=='' && !$newfilename) {
 
     //expanding single digit day, months and double digit years (in case datepicker is off)
     $datestart[$j] = preg_replace(array(
-                                       '/([\.|\-|\/])(\d)[\.|\-|\/]/e',  //single digit months
-                                        '/([\.|\-|\/])(\d\d)$/e',         //double digit years
-                                        '/^(\d)([\.|\-|\/])/e'            //single digit days
+                                       '/([\.|\-|\/])(\d)[\.|\-|\/]/',  //single digit months
+                                        '/([\.|\-|\/])(\d\d)$/',         //double digit years
+                                        '/^(\d)([\.|\-|\/])/'            //single digit days
                                        ),
                                        array(
-                                       "dpSeperator().'0$2'. dpSeperator()",
-                                       "dpSeperator().'20$2'",
-                                       "'0$1'.dpSeperator()"
+                                       dpSeperator().'0$2'. dpSeperator(),
+                                       dpSeperator().'20$2',
+                                       '0$1'.dpSeperator()
                                        ),
                                        $datestart[$j]);
     $dateend[$j] = preg_replace(array(
-                                        '/([\.|\-|\/])(\d)[\.|\-|\/]/e',  //single digit months
-                                        '/([\.|\-|\/])(\d\d)$/e',         //double digit years
-                                        '/^(\d)([\.|\-|\/])/e'            //single digit days
+                                        '/([\.|\-|\/])(\d)[\.|\-|\/]/',  //single digit months
+                                        '/([\.|\-|\/])(\d\d)$/',         //double digit years
+                                        '/^(\d)([\.|\-|\/])/'            //single digit days
                                        ),
                                        array(
-                                       "dpSeperator().'0$2'. dpSeperator()",
-                                       "dpSeperator().'20$2'",
-                                       "'0$1'.dpSeperator()"
+                                       dpSeperator().'0$2'. dpSeperator(),
+                                       dpSeperator().'20$2',
+                                       '0$1'.dpSeperator()
                                        ),
                                        $dateend[$j]);
     //Checking the date format. Entering ?, ??, -, -- is permitted. Some impossible dates can be given, but don't crash the plugin.
diff --git a/includes/nextevent.php b/includes/nextevent.php
index 0d2768b..2025e33 100644
--- a/includes/nextevent.php
+++ b/includes/nextevent.php
@@ -157,12 +157,12 @@ if(is_file($eventfile))
                     $age_txt_2    = $calendar_cf['marquee_age']=='2'   ? $age_txt:'';
 
                     array_push($event_sorting_array, strtotime("$event_month/$event_day/$anniversary 23:59"));
-                    array_push($event_1stline_array, $$calendar_cf['marquee_1stline'] . $age_txt_1);
+                    array_push($event_1stline_array, ${$calendar_cf['marquee_1stline']} . $age_txt_1);
                     array_push($event_headline_array, $event_day . dpSeperator() . $event_month . dpSeperator() . $anniversary . $age_txt_date);
                     if($yearly) {
-                        array_push($event_2ndline_array, $$calendar_cf['marquee_2ndline'] . ' ' . $age_txt_2);
+                        array_push($event_2ndline_array, ${$calendar_cf['marquee_2ndline']} . ' ' . $age_txt_2);
                     } else {
-                        array_push($event_2ndline_array, $$calendar_cf['marquee_2ndline']);
+                        array_push($event_2ndline_array, ${$calendar_cf['marquee_2ndline']});
                     }
                     $anniversary++;
                     $age++;
@@ -192,9 +192,9 @@ if(is_file($eventfile))
                             if($eventtime) {$headline .= " &mdash; " . $eventtime;}
 
                             array_push($event_sorting_array, $weekly_event);
-                            array_push($event_1stline_array, $$calendar_cf['marquee_1stline']);
+                            array_push($event_1stline_array, ${$calendar_cf['marquee_1stline']});
                             array_push($event_headline_array, $headline);
-                            array_push($event_2ndline_array, $$calendar_cf['marquee_2ndline']);
+                            array_push($event_2ndline_array, ${$calendar_cf['marquee_2ndline']});
                         }
                         $weekly_event = strtotime("+1 week", $weekly_event);
                     }
@@ -204,9 +204,9 @@ if(is_file($eventfile))
                             if($eventtime) {$headline .= " &mdash; " . $eventtime;}
 
                             array_push($event_sorting_array, $value);
-                            array_push($event_1stline_array, $$calendar_cf['marquee_1stline']);
+                            array_push($event_1stline_array, ${$calendar_cf['marquee_1stline']});
                             array_push($event_headline_array, $headline);
-                            array_push($event_2ndline_array, $$calendar_cf['marquee_2ndline']);
+                            array_push($event_2ndline_array, ${$calendar_cf['marquee_2ndline']});
                         }
                     }
                 }
@@ -231,9 +231,9 @@ if(is_file($eventfile))
                 } else {
                     array_push($event_sorting_array, $start);
                 }
-                array_push($event_1stline_array, $$calendar_cf['marquee_1stline']);
+                array_push($event_1stline_array, ${$calendar_cf['marquee_1stline']});
                 array_push($event_headline_array, /*'<b>normal</b>' .*/ $txt);
-                array_push($event_2ndline_array, $$calendar_cf['marquee_2ndline']);
+                array_push($event_2ndline_array, ${$calendar_cf['marquee_2ndline']});
 
                 if($additional) {
                     foreach ($additionaldatesarray as $value) {
@@ -241,9 +241,9 @@ if(is_file($eventfile))
                         if($eventtime) {$headline .= " &mdash; " . $eventtime;}
 
                         array_push($event_sorting_array, $value);
-                        array_push($event_1stline_array, $$calendar_cf['marquee_1stline']);
+                        array_push($event_1stline_array, ${$calendar_cf['marquee_1stline']});
                         array_push($event_headline_array, $headline);
-                        array_push($event_2ndline_array, $$calendar_cf['marquee_2ndline']);
+                        array_push($event_2ndline_array, ${$calendar_cf['marquee_2ndline']});
                     }
                 }
 
diff --git a/includes/simplemarkup.php b/includes/simplemarkup.php
index 1a690dc..2a98635 100644
--- a/includes/simplemarkup.php
+++ b/includes/simplemarkup.php
@@ -82,7 +82,7 @@ function simpleMarkupToHtml($text)
         '/(\\\)\*/',                   //7 - escaped *
 
         '/\s*\n*\s*$/',                //12- delete all empty lines at the end
-        '/\n/e'                        //13- transform any remaining line breaks to <br>
+        '/\n/'                        //13- transform any remaining line breaks to <br>
     );
 
     $replacement = array(
@@ -95,7 +95,7 @@ function simpleMarkupToHtml($text)
         '*',                           //7 - *
 
         '',                            //12- no empty lines at the end
-        "tag('br')"                    //13- replace line breaks by <br>
+        tag('br')                      //13- replace line breaks by <br>
     );
 
     $text = preg_replace($pattern, $replacement, $text);
Last edited by cmb on Wed Jun 01, 2016 12:25 pm, edited 5 times in total.
Reason: added PS, PPS, PPPS and PPPPS
Christoph M. Becker – Plugins for CMSimple_XH

Tata
Posts: 3586
Joined: Tue May 20, 2008 5:34 am
Location: Slovakia
Contact:

Re: Calendar_XH 1.4.6 plugin and php 7.07

Post by Tata » Thu Mar 09, 2017 8:45 pm

When about may be the PHP7 compatible version available?
CMSimple.sk
It's no shame to ask for an answer if all efforts failed.
But it's awful to ask without any effort to find the answer yourself.

cmb
Posts: 14225
Joined: Tue Jun 21, 2011 11:04 am
Location: Bingen, RLP, DE
Contact:

Re: Calendar_XH 1.4.6 plugin and php 7.07

Post by cmb » Sat Apr 08, 2017 5:20 pm

Tata wrote:When about may be the PHP7 compatible version available?
svasti is still short of time, so we have moved the Calendar plugin on Github for the time being. A new version which is supposed to solve the PHP 7 incompatibilities is available.

As the URL of the version.nfo for the Update-Check has been changed, users of 1.4.6 won't get notified for now, so spread the word!

Happy calendaring!
Christoph M. Becker – Plugins for CMSimple_XH

Tata
Posts: 3586
Joined: Tue May 20, 2008 5:34 am
Location: Slovakia
Contact:

Re: Calendar_XH 1.4.6 plugin and php 7.07

Post by Tata » Sat Apr 08, 2017 7:02 pm

Thanx a lot. It works fine. I just need to complete the translation.
CMSimple.sk
It's no shame to ask for an answer if all efforts failed.
But it's awful to ask without any effort to find the answer yourself.

Tata
Posts: 3586
Joined: Tue May 20, 2008 5:34 am
Location: Slovakia
Contact:

Re: Calendar_XH 1.4.6 plugin and php 7.07

Post by Tata » Mon Apr 10, 2017 12:26 pm

I have found one more thing:
If using the function editevents directly without loging in, the imagemanager doesn't work. The dialogue window opens, but this is the last step. Not yet tested on server. But locally it definitely doesn't work. No big problem, just to let you know.
CMSimple.sk
It's no shame to ask for an answer if all efforts failed.
But it's awful to ask without any effort to find the answer yourself.

cmb
Posts: 14225
Joined: Tue Jun 21, 2011 11:04 am
Location: Bingen, RLP, DE
Contact:

Re: Calendar_XH 1.4.6 plugin and php 7.07

Post by cmb » Mon Apr 10, 2017 1:31 pm

Tata wrote:If using the function editevents directly without loging in, the imagemanager doesn't work. The dialogue window opens, but this is the last step. Not yet tested on server. But locally it definitely doesn't work. No big problem, just to let you know.
That is a documented limitation. From the help file:
You may want to offer selected visitors to your site the possibility to enter events. Just put {{{PLUGIN:editevents();}}} on the page. For security reasons the filebrowser is disabled so that visitors are prevented from deleting or uploading files.
I'm afraid this can't be easily improved.
Christoph M. Becker – Plugins for CMSimple_XH

Tata
Posts: 3586
Joined: Tue May 20, 2008 5:34 am
Location: Slovakia
Contact:

Re: Calendar_XH 1.4.6 plugin and php 7.07

Post by Tata » Mon Apr 10, 2017 4:32 pm

It's OK so. I don't need memberspages/register on that website. It has basically only one admin, resp. two. And they are chief/subordinate. So they securly may use a regular login in the case that images shall be put in events plan. Otherways the editevent can be used. The page with editevent has difficultly detectable name.
Or - in other case - I can install memberpages and put membersloginform directly to the editeventpage.
CMSimple.sk
It's no shame to ask for an answer if all efforts failed.
But it's awful to ask without any effort to find the answer yourself.

Post Reply