Subject: No "calendar extension" support patch
I didn`t find this in the docs, but the PHP is required to be compiled with the calendar extension. You may not see this at the begining, but some calendar functions are used when moving posts and leaving "moved note". On a production server, when trying to do that action you end up with a blank page and an error message in the logs: PHP Fatal error: Call to undefined function unixtojd()
Since calendar extension isn`t the default in PHP, some may want to run UNB without it. Here`s the path:
unb_lib/main.inc.php, lines around #390:
Maybe use some strtotime calculations instead of the unixtojd function? Dunno the pros and cons, but it seems that it would drop the extension requirement...
Since calendar extension isn`t the default in PHP, some may want to run UNB without it. Here`s the path:
unb_lib/main.inc.php, lines around #390:
days = 14;
if (rc('moved_thread_note_timeout')) $days = intval(rc('moved_thread_note_timeout'));
// The moved note should be visible that amount of time from TODAY on, not the last
// post date, as it is calculated in IThread.IsMovedExpired() which is used to remove
// expired threads in UnbListThreads().
// $days += unixtojd() - unixtojd($thread->GetLastPostDate());
$days += (time() / 86400 + 2440587.5) - ($thread->GetLastPostDate()/86400 + 2440587.5);
I`m not sure if the calculations are right, found them in comments in PHP manual. Hope it helps someone.if (rc('moved_thread_note_timeout')) $days = intval(rc('moved_thread_note_timeout'));
// The moved note should be visible that amount of time from TODAY on, not the last
// post date, as it is calculated in IThread.IsMovedExpired() which is used to remove
// expired threads in UnbListThreads().
// $days += unixtojd() - unixtojd($thread->GetLastPostDate());
$days += (time() / 86400 + 2440587.5) - ($thread->GetLastPostDate()/86400 + 2440587.5);
Maybe use some strtotime calculations instead of the unixtojd function? Dunno the pros and cons, but it seems that it would drop the extension requirement...

puck
Show profile
Link to this post