I need some help for checking my "old" MOD for new 1.4.4 version I need some help for checking my "old" MOD for new 1.4.4 version
 

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]

Main Menu

I need some help for checking my "old" MOD for new 1.4.4 version

Started by Makc666, February 26, 2006, 10:06:35 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Makc666

I need some help for checking my "old" MOD for new 1.4.4 version.

I wrote this MOD for version 1.3.x-1.3.5
http://forum.coppermine-gallery.net/index.php?topic=7243.0

Now I updated to 1.4.4 and rewrite it.
But I get Error when I hit Button Submit after filling all fields...

Error is:
QuoteLine:10
Symbol:52
Code:0
Errir:Expected ';'
URL:http://test.test.com/register.php

Can some one look throw code? May be you will see where there is error in my code...

Thanks.

Here is the "updated" version...

##############################################################
## MOD Title: Restriction of email domains
## MOD Author: Makc666 < makc666@yahoo.com > (Makc666 Makc666) http://makc666.starnet.ru/
## MOD Description: Restriction of domain for email in registration and ecard sending
## MOD Version: 1.4.4-1.4
##
## Installation Level: (Easy)
## Installation Time: 10 Minute
## Files To Edit:
## register.php
## ecard.php
## lang/english.php
## Included Files: (n/a)
##############################################################
## For Security Purposes, Please Check: http://coppermine.sourceforge.net/board/index.php?topic=7243.0 for the
## latest version of this MOD. Downloading this MOD from other sites could cause malicious code
## to enter into your phpBB Forum. As such, Coppermine will not offer support for MOD's not offered
## in our MOD-Database, located at: http://coppermine.sourceforge.net/board/index.php?board=8.0
##############################################################
## Author Notes: Tested on Coppermine 1.3.0 only. Support http://coppermine.sourceforge.net/board/index.php?topic=7243.0
## Thanks to lehis from www.starnet.ru
##
## Always modify "lang/english.php" file.
## After all changes open it in Notepad and "Save as..." in UTF-8 format with name "lang/english-utf-8.php"
## Don't forget to modify $Id: english-utf-8.php in new UTF-8 file.
##
## Loking for man who will help to add possibility to allow more than 1 domain for each option.
##############################################################
## MOD History:
##
##   2004-06-21 - Version 0.0.0-1.0
##      - Project started
##
##   2004-06-24 - Version 1.3.0-1.0
##      - Initial Release
##
##   2004-07-01 - Version 1.3.0-1.1
##      - Fixed bug with activation link
##
##   2004-07-23 - Version 1.3.1-1.2
##      - No changes. Just 1.3.1 check
##
##   2004-07-23 - Version 1.3.2-1.2
##      - No changes. Just 1.3.2 check
##
##   2006-02-26 - Version 1.4.4-1.4
##      - Updated for version 1.4.4
##
##############################################################
## Before Adding This MOD To Your Gallery, You Should Back Up All Files Related To This MOD
##############################################################

#
#-----[ SQL ]------------------------------------------
#
#   If you have a different table prefix then change this command accordingly.
#   I have used the default table prefix for Coppermine 1.3.0!
#

INSERT INTO `cpg130_config` ( `name` , `value` )
VALUES
('domain_email_reg', 'your_domain.com'),
('domain_email_ecard', 'your_domain.com'),
('requires_domain_email_reg', '0'),
('requires_domain_email_ecard', '0'),
('requires_domain_email_ecard_admin', '0')

#
#-----[ OPEN ]------------------------------------------
#
register.php

#
#-----[ FIND ]------------------------------------------
#

    global $lang_register_disclamer, $lang_register_php;

#
#-----[ AFTER, ADD ]------------------------------------------
#   

if ($CONFIG['requires_domain_email_reg']) {
    global $lang_register_disclamer_domain_email_reg, $lang_register_php;
}
if ($CONFIG['requires_domain_email_ecard']) {
    global $lang_register_disclamer_domain_email_ecard, $lang_register_php;
}

#
#-----[ FIND ]------------------------------------------
#

    echo str_replace('{SITE_NAME}', $CONFIG['gallery_name'], $lang_register_disclamer);

#
#-----[ AFTER, ADD ]------------------------------------------
#

    echo str_replace('{DOMAIN_REG}', $CONFIG['domain_email_reg'], $lang_register_disclamer_domain_email_reg);
    echo str_replace('{DOMAIN_ECARD}', $CONFIG['domain_email_ecard'], $lang_register_disclamer_domain_email_ecard);

#
#-----[ FIND ]------------------------------------------
#

    if ($password == $user_name) $error .= '<li>' . $lang_register_php['err_uname_pass_diff'];
    if ($password != $password_again) $error .= '<li>' . $lang_register_php['err_password_mismatch'];

    if (!eregi("^[_\.0-9a-z\-]+@([0-9a-z][0-9a-z-]+\.)+[a-z]{2,6}$", $email)) $error .= '<li>' . $lang_register_php['err_invalid_email'];

    if ($error != '') return false;

#
#-----[ REPLACE WITH ]------------------------------------------
#

    if ($password == $user_name) $error .= '<li>' . $lang_register_php['err_uname_pass_diff'];
    if ($password != $password_again) $error .= '<li>' . $lang_register_php['err_password_mismatch'];

    if ($CONFIG['requires_domain_email_reg']) {

$sql = "SELECT value " . "FROM {$CONFIG['TABLE_CONFIG']} " . "WHERE name = '" . addslashes(domain_email_reg) . "'";
$res=db_query($sql);
$res1=@mysql_fetch_row($res);
$domain_email_reg=$res1[0];

if (!eregi("^[_\.0-9a-z\-]+@$domain_email_reg", $email)) $error .= sprintf('<li>' . $lang_register_php['err_invalid_domain_email_reg'], $domain_email_reg);

        mysql_free_result($res);

    if ($error != '') return false;

    } else {

    if (!eregi("^[_\.0-9a-z\-]+@([0-9a-z][0-9a-z-]+\.)+[a-z]{2,6}$", $email)) $error .= '<li>' . $lang_register_php['err_invalid_email'];

    if ($error != '') return false;
    }

#
#-----[ OPEN ]------------------------------------------
#
ecard.php

#
#-----[ FIND ]------------------------------------------
#

// Check supplied email address
$valid_email_pattern = "^[_\.0-9a-z\-]+@([0-9a-z][0-9a-z-]*\.)+[a-z]{2,6}$";
$valid_sender_email = eregi($valid_email_pattern, $sender_email);
$valid_recipient_email = eregi($valid_email_pattern, $recipient_email);
$invalid_email = '<font size="1">' . $lang_ecard_php['invalid_email'] . ' (' . $recipient_email . ')</font>';
if (!$valid_sender_email && count($_POST) > 0) $sender_email_warning = $invalid_email;
if (!$valid_recipient_email && count($_POST) > 0) $recipient_email_warning = $invalid_email;

#
#-----[ REPLACE WITH ]------------------------------------------
#

// Check supplied email address
if ($CONFIG['requires_domain_email_ecard'] && $CONFIG['requires_domain_email_ecard_admin'] && GALLERY_ADMIN_MODE) {   
         
$valid_email_pattern = "^[_\.0-9a-z\-]+@([0-9a-z][0-9a-z-]*\.)+[a-z]{2,6}$";
$valid_sender_email = eregi($valid_email_pattern, $sender_email);
$valid_recipient_email = eregi($valid_email_pattern, $recipient_email);
$invalid_email = '<font size="1">' . $lang_ecard_php['invalid_email'] . ' (' . $recipient_email . ')</font>';
if (!$valid_sender_email && count($_POST) > 0) $sender_email_warning = $invalid_email;
if (!$valid_recipient_email && count($_POST) > 0) $recipient_email_warning = $invalid_email;

} else {

if ($CONFIG['requires_domain_email_ecard']) {
$sql = "SELECT value " . "FROM {$CONFIG['TABLE_CONFIG']} " . "WHERE name = '" . addslashes(domain_email_ecard) . "'";
$res=db_query($sql);
$res1=@mysql_fetch_row($res);
$domain_email_ecard=$res1[0];
       
$valid_email_pattern = "^[_\.0-9a-z\-]+@$domain_email_ecard";
$valid_sender_email = eregi($valid_email_pattern, $sender_email);
$valid_recipient_email = eregi($valid_email_pattern, $recipient_email);
$invalid_email = sprintf('<font size="1">' . $lang_ecard_php['invalid_domain_email_ecard'] . ' (' . $recipient_email . ')</font>', $domain_email_ecard);
if (!$valid_sender_email && count($_POST) > 0) $sender_email_warning = $invalid_email;
if (!$valid_recipient_email && count($_POST) > 0) $recipient_email_warning = $invalid_email;

mysql_free_result($res);

} else {

$valid_email_pattern = "^[_\.0-9a-z\-]+@([0-9a-z][0-9a-z-]*\.)+[a-z]{2,6}$";
$valid_sender_email = eregi($valid_email_pattern, $sender_email);
$valid_recipient_email = eregi($valid_email_pattern, $recipient_email);
$invalid_email = '<font size="1">' . $lang_ecard_php['invalid_email'] . ' (' . $recipient_email . ')</font>';
if (!$valid_sender_email && count($_POST) > 0) $sender_email_warning = $invalid_email;
if (!$valid_recipient_email && count($_POST) > 0) $recipient_email_warning = $invalid_email;
        }
}


#
#-----[ OPEN ]------------------------------------------
#
lang/english.php

#
#-----[ FIND ]------------------------------------------
#

  'User settings',
  array('Allow new user registrations', 'allow_user_registration', 1, 'f=index.htm&amp;as=admin_allow_registration&amp;ae=admin_allow_registration_end'),

#
#-----[ BEFORE, ADD ]------------------------------------------


  'Domain email restrictions for registration and ecards sending',
  array('Domain email available for registration (the value after @)', 'domain_email_reg', 0),
  array('Check domain name in email during registration', 'requires_domain_email_reg', 1),
  array('Domain email available for sending ecards to (the value after @)', 'domain_email_ecard', 0),
  array('Check domain name in email during ecards sending', 'requires_domain_email_ecard', 1),
  array('Allow administrators to override this restriction for sending ecards', 'requires_domain_email_ecard_admin', 1),
 

#
#-----[ FIND ]------------------------------------------
#

  'invalid_email' => '<b>Warning</b> : invalid email address !',
 
#
#-----[ AFTER, ADD ]------------------------------------------
#

  'invalid_domain_email_ecard' => '<b>Warning</b> : email domain is invalid.<br />You can send ecards only in <b>@%s</b> domain',
 
#
#-----[ FIND ]------------------------------------------
#

<br />
By clicking 'I agree' below you agree to be bound by these conditions.
EOT;

#
#-----[ REPLACE WITH ]------------------------------------------
#

<br />
By clicking 'I agree' below you agree to be bound by these conditions.<br />
EOT;

$lang_register_disclamer_domain_email_reg = <<<EOT
<br /><b>Registration is only allowed for domain: <u>@{DOMAIN_REG}</u></b><br />
EOT;

$lang_register_disclamer_domain_email_ecard = <<<EOT
<br /><b>You will be able to send ecards only to domain: <u>@{DOMAIN_ECARD}</u></b><br />
<br />
EOT;

#
#-----[ FIND ]------------------------------------------
#

  'err_invalid_email' => 'Email address is invalid',
 
#
#-----[ AFTER, ADD ]------------------------------------------
#

  'err_invalid_domain_email_reg' => 'Email domain is invalid. You can register only to <u>@%s</u> domain',

#
#-----[ SAVE/CLOSE ALL FILES ]------------------------------------------
#
# EoM

Makc666

Sorry. Forgot to add.

When I want to send Ecard and press link for sending ecard for any image, I get this error:

QuoteFatal error: Call to undefined function: db_query() in /*************/gallery/ecard.php on line 81

Makc666

Find the main error...

Line:
$res=db_query($sql);

Must be for both files - register and ecard:
$res=cpg_db_query($sql);

Makc666