dragonfly - adodb-time.inc.php conflict with calendar module

majorheadache
majorheadache's picture

Joined: 2004-04-22
Posts: 66
Posted: Fri, 2006-02-17 21:21

Tried installing 2.02 on a dragonfly CMS which also had a calendar module. Upon entering the gallery in embedded mode, I get this error:

Fatal error: Cannot redeclare adodb_date_test_date() (previously declared in /home/xxxxxx/public_html/modules/CPGNuCalendar/includes/adodb-time.inc:375) in /home/xxxxxx/public_html/gallery2/lib/adodb/adodb-time.inc.php on line 379

Is there any workaround for this? I tried commenting out line 379 on the gallery adodb-time.inc.php file which let gallery display, but with a time error.

Gallery 2.02 @ http://www.mlparena.com/gallery2.html
Apache/1.3.34
PHP/4.4.1
PHPInfo www.mlparena.com/gallery2/lib/support/phpinfo.php
MySQL/4.0.25
RedHat Ent 3

 
ckdake
ckdake's picture

Joined: 2004-02-18
Posts: 2258
Posted: Thu, 2006-02-23 01:35

You could wrap all of each adodb file that causes this error in an if defined ADODB_INCLUDED and put a define ADODB_INCLUDED as the first item inside the loop. It's a bit of a hack but would work.

 
majorheadache
majorheadache's picture

Joined: 2004-04-22
Posts: 66
Posted: Thu, 2006-02-23 06:39

Could you possibly post the code on how that would be done?

Here is the area where I get the error message: (line 379 starts with "function")

if (!defined('ADODB_ALLOW_NEGATIVE_TS')) define('ADODB_NO_NEGATIVE_TS',1);

function adodb_date_test_date($y1,$m,$d=13)
{
	$t = adodb_mktime(0,0,0,$m,$d,$y1);
	$rez = adodb_date('Y-n-j H:i:s',$t);
	if ("$y1-$m-$d 00:00:00" != $rez) {
		print "<b>$y1 error, expected=$y1-$m-$d 00:00:00, adodb=$rez</b><br>";
		return false;
	}
	return true;
}

Gallery 2.02 @ http://www.mlparena.com/gallery2.html
Apache/1.3.34
PHP/4.4.1
PHPInfo www.mlparena.com/gallery2/lib/support/phpinfo.php
MySQL/4.0.25
RedHat Ent 3

 
ckdake
ckdake's picture

Joined: 2004-02-18
Posts: 2258
Posted: Sat, 2006-02-25 07:37
if (!defined('ADODB_ALLOW_NEGATIVE_TS')) define('ADODB_NO_NEGATIVE_TS',1);

if (!defined('ALREADY_DID_THIS_THING_YEAH_SOMETHING')) {
    define('ALREADY_DID_THIS_THING_YEAH_SOMETHING',1);

    function adodb_date_test_date($y1,$m,$d=13)
    {
        $t = adodb_mktime(0,0,0,$m,$d,$y1);
        $rez = adodb_date('Y-n-j H:i:s',$t);
        if ("$y1-$m-$d 00:00:00" != $rez) {
        print "<b>$y1 error, expected=$y1-$m-$d 00:00:00, adodb=$rez</b><br>";
        return false;
    }
    return true;
    }
}

Or something like that :)

Oh yeah, instead of the defined thing, you could use http://us2.php.net/function_exists

if (!function_exists('blah')) {
  function blah() {
     return;
  }
}

--
http://ckdake.com/

If you found my help useful, please consider donating to Gallery.