Link to CPGNuCalendar problem

3.3 Forum ONLY: If you've run into a problem, such as an error message, blank page, or similar problem, this is where to look. Post any installation or other problems or questions here, and I and other users will try to help.
  
5 Oct '10 Tue Oct 05, 2010 11:25    
rosbif
BetaTester  BetaTester
  •  

Envio Re: Link to CPGNuCalendar problem

Hmm, interesting.. It's just done the link correctly using admin submit. Odd thing is doing non-admin submit it's changed 1400-1800 into 1600-2000 so a two hour shift...

(and found another time where & characters need to be allowed for - I'll post on the other thread)



rosbif's server specs (Server OS / Apache / MySQL / PHP / DragonflyCMS)

Linux/2.2.11/4.1.22/5.2.17/9.3.4.1

 
 
 
 
  
5 Oct '10 Tue Oct 05, 2010 11:30    
layingback
Site Admin  
  •  

Envio Re: Link to CPGNuCalendar problem

Well that's useful info! Probably means just a typo in functions.php, or missed/messed up update. I'm sure user-side Calendar links haven't been used much. But I'm getting hungry...



layingback's server specs (Server OS / Apache / MySQL / PHP / DragonflyCMS)

2.6.32 / 1.3 - 2.4 / 5.5 - 5.6 / 5.4 - 5.5 / 9.4

 
 
 
 
  
5 Oct '10 Tue Oct 05, 2010 14:01    
layingback
Site Admin  
  •  

Envio Re: Link to CPGNuCalendar problem

OK, found some differences between the 2 routines - looks as if last set of changes to admin_functions was not migrated across to functions.

So please in functions.php try replacing the entire create_cal routine with the one in the attached txt file.

(The routines are not identical in their calls and access privileges, so you can't just copy from admin into functions.)



layingback's server specs (Server OS / Apache / MySQL / PHP / DragonflyCMS)

2.6.32 / 1.3 - 2.4 / 5.5 - 5.6 / 5.4 - 5.5 / 9.4

 
 
 
 
  
5 Oct '10 Tue Oct 05, 2010 15:59    
rosbif
BetaTester  BetaTester
  •  

Envio Re: Link to CPGNuCalendar problem

OK...

This is all for non-admin submit.

It is still adding 2 hours to the entry - 1400-1800 becomes 1600-2000.

If you edit the original story the boxes on the edit page subsequently become 1800-2200. And then the edit routine adds the amp; bit to the title when it changes the calendar entry...



rosbif's server specs (Server OS / Apache / MySQL / PHP / DragonflyCMS)

Linux/2.2.11/4.1.22/5.2.17/9.3.4.1

 
 
 
 
  
8 Oct '10 Fri Oct 08, 2010 08:47    
layingback
Site Admin  
  •  

Envio Re: Link to CPGNuCalendar problem

OK, I *may* have got this working (although I'm worried that as I'm on GMT I may be special case ...) And it looks to be patchable.

For admin_functions.php only, make the following edits:

Find at the bottom of function dttime_edit

PHP:
        $content .= ($gmttime == 0) ? '' : ' <span class="pn_tiny">GMT'.((($userinfo['user_timezone']+L10NTime::in_dst($gmttime, $userinfo['user_dst'])) >= 0) ? '+' : '-').($userinfo['user_timezone']+L10NTime::in_dst($gmttime, $userinfo['user_dst']))._PNHRS.'</span>';
$content .= ' <span class="pn_tinygrey">';
$content .= ($hropt) ? '('._PNOPTIONAL.')' : '';
$content .= '</span>';


and replace with

PHP:
        $content .= ' '._PNGMT.((($userinfo['user_timezone']+L10NTime::in_dst(($gmttime == 0 ? time() : $gmttime), $userinfo['user_dst'])) >= 0) ? '+' : '').($userinfo['user_timezone']+L10NTime::in_dst(($gmttime == 0 ? time() : $gmttime), $userinfo['user_dst']))._PNHRS.' &nbsp; <span class="pn_tinygrey">';
$content .= ($hropt) ? '('._PNOPTIONAL.')</span>' : '</span>';



In function create_cal find these 2 lines

PHP:
        $startday = mktime(0, 0, 0, ProNewsAdm::pndate('m', $clsdttime, $userinfo['user_dst'], $userinfo['user_timezone']), ProNewsAdm::pndate('d', $clsdttime, $userinfo['user_dst'], $userinfo['user_timezone']), ProNewsAdm::pndate('Y', $clsdttime, $userinfo['user_dst'], $userinfo['user_timezone']));


PHP:
            $endday = mktime(0, 0, 0, ProNewsAdm::pndate('m', $cledttime, $userinfo['user_dst'], $userinfo['user_timezone']), ProNewsAdm::pndate('d', $cledttime, $userinfo['user_dst'], $userinfo['user_timezone']), ProNewsAdm::pndate('Y', $cledttime, $userinfo['user_dst'], $userinfo['user_timezone']));


and change all the calls to ProNewsAdm::pndate in each to just date (ie delete 'ProNewsAdm::pn').

and find

PHP:
        $clstime = ($clstime == -1) ? -1 : formatDateTime($clsdttime,'%H%M').'00';
$sql = 'INSERT INTO '.$prefix.'_cpgnucalendar VALUES ("", "'.$postby.'", "'.formatDateTime($clsdttime,'%Y%m%d').'", "'.$clstime.'", "'.formatDateTime(time(),'%Y%m%d').'", "'.formatDateTime(time(),'%H%M%S').'", "'.$cal_durtn.'", "'.$cal_priority.'", "'.$cal_rpt.'", "'.$cal_view.'", "'.$title.'", "'.$cal_content.'", "'.$cal_image.'", "'.$cal_appvd.'", "'.$cal_category.'")';


and replace with

PHP:
        $clstime = ($clstime == -1) ? -1 : formatDateTime($clsdttime,'%H%M').'00';
$sql = 'INSERT INTO '.$prefix.'_cpgnucalendar VALUES ("", "'.$postby.'", "'.formatDateTime($clsdttime,'%Y%m%d').'", "'.$clstime.'", "'.formatDateTime(time(),'%Y%m%d').'", "'.formatDateTime(time(),'%H%M%S').'", "'.$cal_durtn.'", "'.$cal_priority.'", "'.$cal_rpt.'", "'.$cal_view.'", "'.$title.'", "'.$cal_content.'", "'.$cal_image.'", "'.$cal_appvd.'", "'.$cal_category.'")';



Last line should also clean up the & in title issue.

The first edit above is just to display your current tz a la user side.

Remaining edits are to address the 3 interrelated issues - dsl subtracted not added as I suspected, no longer any need for my own date routine, and finally compensating for CPGNC not handling dst.

Should be easy to migrate to user side if you wish.

Please note that the above is for INSERT ONLY - more changes are required for update, etc. But this should handle 90+% of cases.



layingback's server specs (Server OS / Apache / MySQL / PHP / DragonflyCMS)

2.6.32 / 1.3 - 2.4 / 5.5 - 5.6 / 5.4 - 5.5 / 9.4

 
 
 
 
  
8 Oct '10 Fri Oct 08, 2010 19:12    
rosbif
BetaTester  BetaTester
  •  

Envio Re: Link to CPGNuCalendar problem

Hmm, that didn't work. Nothing went into the calendar at all (from looking at the database) and when you go to edit the article the date entry is all wrong.

I entered 17 Oct 10 1400 - 1800 and in the edit it is showing as 17 Mar 07 1930 - 2130!

There's also now an undefined language entry of _PNGMT. (although it now correctly shows as GMT+2 for my setting)



rosbif's server specs (Server OS / Apache / MySQL / PHP / DragonflyCMS)

Linux/2.2.11/4.1.22/5.2.17/9.3.4.1

 
 
 
 
  
8 Oct '10 Fri Oct 08, 2010 19:18    
rosbif
BetaTester  BetaTester
  •  

Envio Re: Link to CPGNuCalendar problem

Just tried doing exactly the same - still no entry in the CPGNuCalendar table and if I look to edit the same article with the same dates initially entered it is now showing the calendar entry as 31 Mar 07 1200-1900!

PHP debug info on the admin page also shows

modules/Pro_News/admin/admin_functions.php
Notice line 118: Undefined variable: sqlcount
Notice line 216: Undefined variable: is_home



rosbif's server specs (Server OS / Apache / MySQL / PHP / DragonflyCMS)

Linux/2.2.11/4.1.22/5.2.17/9.3.4.1

 
 
 
 
  
8 Oct '10 Fri Oct 08, 2010 21:17    
layingback
Site Admin  
  •  

Envio Re: Link to CPGNuCalendar problem

You can address the language entry by adding:

PHP:
define('_PNGMT','GMT');        //Greenwich Mean Time / UTC Coordinated Universal Time



The Notices don't matter (Notices never do) and in this case are immaterial because they are from the Admin Articles display (to see errors from the Submit Article screen you need to comment out the url redirect to the Admin Articles screen).

The saved article will get its times from the Calendar, but I don't understand why you have no visible entry in Calendar... Hmmm.

EDIT: Both Notices now addressed (in next release).



layingback's server specs (Server OS / Apache / MySQL / PHP / DragonflyCMS)

2.6.32 / 1.3 - 2.4 / 5.5 - 5.6 / 5.4 - 5.5 / 9.4

 
 
 
 
  
9 Oct '10 Sat Oct 09, 2010 02:22    
rosbif
BetaTester  BetaTester
  •  

Envio Re: Link to CPGNuCalendar problem

OK, just wondered if the notices were relevant to the problem... Do you want me to comment out the redirect to see the SQL etc?



rosbif's server specs (Server OS / Apache / MySQL / PHP / DragonflyCMS)

Linux/2.2.11/4.1.22/5.2.17/9.3.4.1

 
 
 
 
  
9 Oct '10 Sat Oct 09, 2010 07:32    
layingback
Site Admin  
  •  

Envio Re: Link to CPGNuCalendar problem

Please. Look for

PHP:
    // -- Submit mode

in admin_article function, and comment out the first url redirect after that - about 27 lines later - the one following the INSERT INTO's. Also please remove the // in front of all 2 echo lines in the create_cal function.

Then submit a NEW article. Article will post, and update Calendar (or try to) but will display 3 echo lines rather than switching to Admin display. Please post those 3 lines here. (Start and end times in Epoch, start time in DDMMYYYY, duration in mins, approved in DDMMYYY.)



layingback's server specs (Server OS / Apache / MySQL / PHP / DragonflyCMS)

2.6.32 / 1.3 - 2.4 / 5.5 - 5.6 / 5.4 - 5.5 / 9.4

 
 
 
 
  
9 Oct '10 Sat Oct 09, 2010 12:52    
rosbif
BetaTester  BetaTester
  •  

Envio Re: Link to CPGNuCalendar problem

This for an article submitted with a link to an event on 10/10/2010 1400-1800.

startday=943920000 endday=943920000 s time=1286712000 e time=1286726400 clstime= calduration=240

I added a couple of echos for the cal approved one and sql and got this:

startday=943920000 endday=943920000 s time=1286712000 e time=1286726400 clstime= calduration=240 cal_appvd=20101009

sql=INSERT INTO chantill_cpgnucalendar VALUES ("", "webmaster", "20101010", "140000", "20101009", "145105", "240", "2", "E", "0", "Testing", "Please ignore Click to follow Link to Originating Article.", "circle.gif", "20101009", "1")

Nothing was added to the cpgnucalendar table. Turning on warnings I got this - not sure if relevant:

modules/Pro_News/admin/admin_functions.php
Warning line 2810: date() expects at most 2 parameters, 4 given
Warning line 2810: date() expects at most 2 parameters, 4 given
Warning line 2810: date() expects at most 2 parameters, 4 given
Warning line 2814: date() expects at most 2 parameters, 4 given
Warning line 2814: date() expects at most 2 parameters, 4 given
Warning line 2814: date() expects at most 2 parameters, 4 given



rosbif's server specs (Server OS / Apache / MySQL / PHP / DragonflyCMS)

Linux/2.2.11/4.1.22/5.2.17/9.3.4.1

 
 
 
 
  
9 Oct '10 Sat Oct 09, 2010 20:01    
layingback
Site Admin  
  •  

Envio Re: Link to CPGNuCalendar problem

So near and yet so far!

I'm confused. The SQL line looks fine, yet it didn't take? You aren't using MySQL5 in STRICT mode are you? That would need a 0 in the first field (in place of null) - but that should give an SQL error.

I just pasted that SQL line into MyPhpAdmin and it took. Just changed the db prefix and added the 0 - because I run in STRICT now so that I hit the issues before anyone else.

The date and times look correct. So if we could find the cause of it not saving to the db, we'd be done. Besides the update code, and the port to user side, and the read back error for subsequent updates, and ... Guiño

The warning for date is because my pndate had extra parameters, need to remove the extras, but for now they should just be ignored...



layingback's server specs (Server OS / Apache / MySQL / PHP / DragonflyCMS)

2.6.32 / 1.3 - 2.4 / 5.5 - 5.6 / 5.4 - 5.5 / 9.4

 
 
 
 
  
14 Oct '10 Thu Oct 14, 2010 10:02    
rosbif
BetaTester  BetaTester
  •  

Envio Re: Link to CPGNuCalendar problem

Very odd - have just tried the sql in phpmyadmin and it entered it fine (so don't appear to be in strict mode). Going to have another go with it after lunch...



rosbif's server specs (Server OS / Apache / MySQL / PHP / DragonflyCMS)

Linux/2.2.11/4.1.22/5.2.17/9.3.4.1

 
 
 
 
  
14 Oct '10 Thu Oct 14, 2010 13:11    
rosbif
BetaTester  BetaTester
  •  

Envio Re: Link to CPGNuCalendar problem

Just tried again - it still isn't adding anything to the cpgnucalendar table... very odd. Just checked the non-admin submit and that does add an entry (albeit wrong!)



rosbif's server specs (Server OS / Apache / MySQL / PHP / DragonflyCMS)

Linux/2.2.11/4.1.22/5.2.17/9.3.4.1

 
 
 
 
  
14 Oct '10 Thu Oct 14, 2010 13:15    
layingback
Site Admin  
  •  

Envio Re: Link to CPGNuCalendar problem

You are creating a new article (and event) aren't you? (I haven't patched the edit function as yet.)



layingback's server specs (Server OS / Apache / MySQL / PHP / DragonflyCMS)

2.6.32 / 1.3 - 2.4 / 5.5 - 5.6 / 5.4 - 5.5 / 9.4

 
 
 
 
Link  QR 
Share this Versión Imprimible  facebook   google+   linkedin   twitthis  
Show more ...

Ir a página Anterior  1, 2, 3  Siguiente