Advanced search  

News:

cpg1.5.48 Security release - upgrade mandatory!
The Coppermine development team is releasing a security update for Coppermine in order to counter a recently discovered vulnerability. It is important that all users who run version cpg1.5.46 or older update to this latest version as soon as possible.
[more]

Pages: [1]   Go Down

Author Topic: Integration of coppermine ecard to phpnukemailer  (Read 12843 times)

0 Members and 1 Guest are viewing this topic.

pCwOrM

  • Coppermine newbie
  • Offline Offline
  • Posts: 2
Integration of coppermine ecard to phpnukemailer
« on: April 03, 2006, 09:57:53 pm »

initially thank to all coppermine developers to publish this product with us. This galery is really so exciting and nice  to use.
i had had a fault about sending ecards and had an error message as below;

Code: [Select]
Fatal error: Cannot redeclare class phpmailer in myrootfolder\includes\class.phpmailer.php on line 21
and i began to scan where a decleration found before. Then minded that i am a user of phpNukeMailerv1.0.4 and this add-on has the same file on path ../includes/phpmailer/class.phpmailer.php with the file used by coppermine for classes.

Code: [Select]
Ps for phpNukeMailerv1.0.4
its one of mailer tools 4 phpnuke instead of usind mail() function.

And this class file was declared by my ../includes/phpnukemailer.php earlier then coppermine's ../modules/coppermine/ecard.php did it because i inclueded ../includes/phpnukemailer.php at the end of my ../mainfile.php. Therefore rudey they crashed.

Firstly, i removed

Code: [Select]
require("includes/class.phpmailer.php");
this line in my ../modules/coppermine/ecard.php file and got ;

Code: [Select]
//   require("includes/class.phpmailer.php");that line means skipped.

then i decided to modify lines and force coppermine to use my phpnukemailer email functions.

Here is a copy  of my phpnukemailer ../includes/phpmailer/class.phpmailer.php file;

http://rapidshare.de/files/17129170/class.phpmailer.php.html

Code: [Select]
download password:
http://coppermine-gallery.net

then just saw that there is a variable that not declared in my phpnukemailer's phpnukemailer class file 2 lines below as;

Code: [Select]
$mail->SetLanguage();
this variable belongs to coppermine's class file so i removed that line, too. as;

Code: [Select]
// $mail->SetLanguage();
line skipped and avoided getting error message.

Code: [Select]
PS
you can delete skipped lines if you want

continue debuging ecard.php..

and again i found a line has a variable that my phpnukemailer class file wouldnt declare. as;

Code: [Select]
$mail->IsHTML(true);
it is again one of coppermine's class file's variables. it declares the way of sending method of mail. and i would use SMTP method.
So, i modify this line as;

Code: [Select]
$mail->IsSMTP(true);[/
which is compatible with my phpnukemailer class file.

after i finished to debug coppermine's ecard.php file, i have begun to seek in my ../modules/coppermine/include/mailer.inc file.
Pointed that

Quote
    if (empty($CONFIG['smtp_host'])) {
        return mail($to, $subject, $msg_body, $extra_headers);
    } else {
        return smtp_mail($to, $subject, $msg_body, $extra_headers);
    }


word equation. And learned that the condition of using mail() function is null input of smtp_host value. however
i emptied my smtp settings values as below;

Quote
$CONFIG['smtp_host'] = '';
$CONFIG['smtp_username'] = '';
$CONFIG['smtp_password'] = '';

 ??? seems like the crashed with coppermine documentaries told us  :) about SMTP usage  ::) but no panic. things allright, so lets go on.

emptying values provides us to hold the if loop mentioned above on first condition to modify the mail() function as known by phpnukemailer users to able to access phpnukemailer methods. if we send the loop mentioned above to second condition hard to control the smtp_mail() function of mailer.inc by filling SMTP variables. Easily we should link the coppermine's mail modulation to phpnukemailer on first condition.

the last step of our debuging in mailer.inc is here...

As known, phpnukemail() function loaded as

Code: [Select]
phpnukemail($to, $subject, $msg, $sender_mail, $sender_name, $encode = 1);
instead of mail() functions in php-nuke.

Here we have to point that this variables, declared by phpnukemailerv1.0.0.4 classes, dont let us using ranged variables as here;

Quote
    $extra_headers = "From: $sender_name <$sender_email>\n";
    $extra_headers .= "Reply-To: $sender_email\n";
    $extra_headers .= "MIME-Version: 1.0\n";
    $extra_headers .= "Content-Type: text/html; charset=$charset\n\n";

in malier.inc. as seen $extra_headers values contains all sender's info. but as mentioned we couldnt use variables in pfpnukemail() function like this way. so i seperated $extra_headers into two parts as $sender_email and $sender_name.
-$encode parameter told to phpnukemail() function wheter message format is html or plain, so i added $encode=1 in my line.

Andi modified the line

Code: [Select]
return mail($to, $subject, $msg_body, $extra_headers);
as my phpnukemailer requires to;

Code: [Select]
return phpnukemail($to, $subject, $msg_body, $sender_email,$sender_name, $encode = 1);
thislike. Now all save our files then ecard again.
see how nice its. thanks to coppermine developpers again for this tool.

here is a copy of my phpnukemailer.php file to able understand more about its variables;

http://rapidshare.de/files/17129377/phpnukemailer.php.html

Code: [Select]
Download password:
http://coppermine-gallery.net

Finally i reached the end of my integration of coppermine to phpnukemailer.
Hopefully it will be helpful for phpnukemailer users to use coppermines ecarding module.

i dont have time to modify all files with a better debug way. So my request from developpers
to set the files for phpnukemailer users. I dont think its so difficult to write some more codes to take the information of an installed copy of any phpnukemailer exists or not on php-nuke.  If exists force coppermine to use phpnukemailer methods not to get errors, unless use the coppermine's methods to ecard.

Waiting for your integration codes of this usage.
Fairfully








« Last Edit: April 03, 2006, 11:09:29 pm by pCwOrM »
Logged

Joachim Müller

  • Dev Team member
  • Coppermine addict
  • ****
  • Offline Offline
  • Gender: Male
  • Posts: 47843
  • aka "GauGau"
    • gaugau.de
Re: Integration of coppermine ecard to phpnukemailer
« Reply #1 on: April 04, 2006, 07:09:01 am »

What's your actual request/question? Nuke goes unsupported, we don't know it. Moving your posting accordingly, please read the sticky thread on the board I'm moving your posting to.
Logged

pCwOrM

  • Coppermine newbie
  • Offline Offline
  • Posts: 2
Re: Integration of coppermine ecard to phpnukemailer
« Reply #2 on: April 04, 2006, 09:44:52 am »

if i wrote it under wrong topic im really sorry. but iwas so sleepy when i posted it.
and saw that here has no more support 4 coppermine 4 phpnuke in here. as in installation file and it continues at http://www.pcnuke.com
so sorry again.
But may be this topic is helpful for users have same problem.

An one more thing to solve this error is copying coppermine's class file over phpnukemailer's  class file then change the all icluding data about it. it will work without things above.. but needed a stable solution for all.

ill forward it to postnuke.com to request a stable solution for all phpnukemailer users. if needed maybe found there.

thanks again.
« Last Edit: April 04, 2006, 11:28:37 am by pCwOrM »
Logged
Pages: [1]   Go Up
 

Page created in 0.019 seconds with 18 queries.