Advanced search  

News:

CPG Release 1.6.26
Correct PHP8.2 issues with user and language managers.
Additional fixes for PHP 8.2
Correct PHP8 error with SMF 2.0 bridge.
Correct IPTC supplimental category parsing.
Download and info HERE

Pages: [1]   Go Down

Author Topic: Mod for Message to Administrator & more  (Read 26744 times)

0 Members and 1 Guest are viewing this topic.

FlemishDreams

  • Contributor
  • Coppermine newbie
  • ***
  • Offline Offline
  • Gender: Male
  • Posts: 7
    • Stock Photography Addict
Mod for Message to Administrator & more
« on: April 02, 2006, 02:09:53 am »

This is a small mod. If it's OK, it can be moved to the mod thread.

Many sites have a line at the bottom with "privacy, term of use, about, contact us". Especially when you're offering services on your gallery, a simple "contact us" form might be usefull. You probably don't want those functions on the main menu, just on links at the bottom. This small mod gives you the possibility for all this. They can be internationalized since all the texts are in the language files. Only the English version is provided here, but starting from there, you can translate it.

You will need 3 extra files and 2 mods. The 3 extra files are contactus.php (for the contact form), privacy.php (for the privacy statement) and copyright.php (for the terms of use).
The 2 mods are in english.php (to accomodate the texts) and functions.inc.php (to implement the bottom line). All mods are for CPG 1.4.4. You can backup the original files but there's really no need for it, since these are all just additions. Mods tested on Firefox, Netscape, IE, Opera under Win$XP. (all versions up to date except for Netscape 7.2).



File 1 is a new file "contactus.php", it goes in the root folder where you installed CPG. It is a very slimmed down version of report_file.php. It will do no harm when you don't use it.
Code: [Select]
<?php
/*************************
  Coppermine Photo Gallery
  ************************
  Copyright (c) 2003-2006 Coppermine Dev Team
  v1.1 originally written by Gregory DEMAR

  This program is free software; you can redistribute it and/or modify
  it under the terms of the GNU General Public License as published by
  the Free Software Foundation; either version 2 of the License, or
  (at your option) any later version.
  ********************************************
  Coppermine version: 1.4.4
   $Revision: 1.4 $
  $Author: gaugau $
  $modified after report_file.php, FlemishDreams $
  $Date: 2006/04/1 13:30:07 $
**********************************************/

define('IN_COPPERMINE'true);
define('REPORT_FILE_PHP'true);
define('CONTACTUS_PHP'true);

require(
'include/init.inc.php');
require(
'include/mailer.inc.php');

function 
get_post_var($name$default '') {
    return isset(
$_POST[$name]) ? $_POST[$name] : $default;
}

$sender_name get_post_var('sender_name'USER_NAME USER_NAME : (isset($USER['name']) ? $USER['name'] : ''));
$sender_plain_name $sender_name;
if (
defined('UDB_INTEGRATION')AND USER_ID$USER_DATA array_merge($USER_DATA,$cpg_udb->get_user_infos(USER_ID));
if (
$USER_DATA['user_email']){
        
$sender_email $USER_DATA['user_email'];
        
$sender_box $sender_email;
} else {
        
$sender_email get_post_var('sender_email',$USER['email'] ? $USER['email'] : '');
        
$sender_box "<input type=\"text\" class=\"textinput\" value=\"$sender_email\" name=\"sender_email\" style=\"width: 100%;\" />";
        
$sender_name "<input type=\"text\" class=\"textinput\" value=\"$sender_name\" name=\"sender_name\" style=\"width: 100%;\" />";
}
$subject get_post_var('subject');
$message get_post_var('message');
$sender_email_warning '';
$sender_name_warning '';
$sender_subject_warning '';
$sender_message_warning '';
$form_action="{$_SERVER['PHP_SELF']}";

// 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);
// Retry on errors
if (count($_POST) > 0) {
$sender_email_warning = ($valid_sender_email) ? "" : ('<br /><font size="1">' $lang_report_php['invalid_email'] . '</font>');
$sender_name strip_tags($sender_name);
if (!$sender_name$sender_name $sender_plain_name;
$sender_name_warning = (trim($sender_name)) ? "" : ('<font size="1">' $lang_contactus_php['invalid_sender'] . '<br /></font>');
$sender_subject_warning = (strlen(trim($subject)) > 2) ? "" : ('<font size="1">' $lang_contactus_php['invalid_subject'] . '</font>');
$sender_message_warning = (strlen(trim($message)) > 5) ? "" : ('<font size="1">' $lang_contactus_php['invalid_message'] . '</font>');
if (!$sender_email_warning && !$sender_name_warning && !$sender_subject_warning && !$sender_message_warning) {
$plaintext_message $message.'   ('.$lang_report_php['from'].' '.$sender_name.', IP '.$_SERVER['REMOTE_ADDR'].')';
$result cpg_mail('admin'$subject$plaintext_message'text/plain'$sender_name$sender_email);
if (!USER_ID) {
$USER['name'] = $sender_name;
$USER['email'] = $sender_email;
}
if ($result) {
pageheader($lang_contactus_php['title_contactus'], "<meta http-equiv=\"refresh\" content=\"3;\" />");
msg_box($lang_cpg_die[INFORMATION], $lang_contactus_php['send_success_contactus'], $lang_continue"index.php");
pagefooter();
ob_end_flush();
exit;
} else {
cpg_die(ERROR$lang_contactus_php['send_failed_contactus'], __FILE____LINE__);
}
}
}
$faq_contactus_msg str_replace('{SITE_NAME}',$CONFIG['gallery_name'],$faq_contactus);

pageheader($lang_contactus_php['title_contactus']);
starttable("100%"$lang_contactus_php['title_contactus'], 3);

echo <<<EOT
        <tr>
                <td align="center" class="tableh2" colspan="2"><b>
{$lang_report_php['from']}</b></td>
        </tr>
        <tr>
                <td align="left" class="tableb" valign="top" width="40%">
                        <form method="post" name="post" action="
$form_action">
                        
{$lang_report_php['your_name']}<br />
                </td>
                <td align="left" valign="top" class="tableb" width="60%">
                        
{$sender_name}
                        
{$sender_name_warning}
                </td>
        </tr>
        <tr>
                <td align="left" class="tableb" valign="top" width="40%">
                        
{$lang_report_php['your_email']}<br />
                </td>
                <td align="left" valign="top" class="tableb" width="60%">
                        
{$sender_box}
                        
{$sender_email_warning}
                </td>
        </tr>
<tr><td class="tableb">&nbsp;</td></tr>
        <tr>
                <td align="center" class="tableh2" colspan="3"><b>
{$lang_report_php['subject']}</b></td>
        </tr>
        <tr>
                <td align="left" class="tableb" colspan="3">
<input type="text" class="textinput" name="subject"  value="
$subject" style="width: 100%;" /><br />
                    
{$sender_subject_warning}
               </td>
        </tr>
        <tr>
                <td align="center" class="tableh2" colspan="3"><b>
{$lang_report_php['message']}</b></td>
        </tr>
        <tr>
                <td align="left" class="tableb" colspan="3" valign="top">
<textarea name="message" class="textinput" rows="8" cols="40" style="width: 100%;">
$message</textarea><br />
                    
{$sender_message_warning}<br />
                </td>
        </tr>
        <tr>
                <td colspan="3" align="center" class="tablef">
                        <input type="submit" class="button" value="
{$lang_contactus_php['button_contactus']}" />
                        </form>
                </td>
        </tr>
<tr><td class="tableb">&nbsp;</td></tr>
        <tr>
                <td align="center" class="tableh2" colspan="2"><b>
{$lang_contactus_php['consult_faq']}</b></td>
        </tr>
<tr><td class="tableb">&nbsp;</td></tr>
<tr>
               <td align="left" class="tableb" colspan="3" valign="top">
{$faq_contactus_msg}
                </td>
</tr>
<tr><td class="tableb">&nbsp;</td></tr>
EOT;

endtable();
pagefooter();
ob_end_flush();
?>




File 2 is a new file "privacy.php", it goes in the root folder where you installed CPG. It is a very simple screen you can adapt for other purposes too. It doesn't require any post or interactivity. All text is in the language files. Modify that text as you wish.  It will do no harm when you don't use it.
Code: [Select]
<?php
/*************************
  My Modifications:
  - Privacy page
  ************************/

define('IN_COPPERMINE'true);
define('PRIVACY_PHP'true);
require(
'include/init.inc.php');
global 
$CONFIG//, $PHP_SELF;

pageheader($lang_privacy_php['privacy_title']);
starttable("100%",$lang_privacy_php['privacy_title']);

echo <<<EOT
<tr>
<td class="tableb" style="padding: 10px;">
EOT;

echo 
str_replace('{SITE_NAME}',$CONFIG['gallery_name'],$lang_privacy_screen);
echo <<<EOT
</td>
</tr>
<tr>
<td colspan="2" class="tablef" width="100%"><table align="center"><tr>
<td><input type="button" onClick="javascript:history.go(-1);" value="
{$lang_privacy_php["back"]}" class="button" /></td>
</tr></table></td>
</tr>
EOT;

endtable();
pagefooter();
ob_end_flush();
?>




File 3 is a new file "copyright.php", it goes in the root folder where you installed CPG. It is a very simple screen you can adapt for other purposes too. It doesn't require any post or interactivity. All text is in the language files. Modify that text as you wish. Currently, there is just a placeholder text.  It will do no harm when you don't use it.
Code: [Select]
<?php
/*************************
  My Modifications:
  - Copyright page
  ************************/

define('IN_COPPERMINE'true);
define('COPYRIGHT_PHP'true);
require(
'include/init.inc.php');
global 
$CONFIG//, $PHP_SELF;

pageheader($lang_copyright_php['copyright_title']);
starttable("100%",$lang_copyright_php['copyright_header']);
echo <<<EOT
<tr>
<td class="tableb" style="padding: 10px;">
EOT;
echo str_replace('{SITE_NAME}',$CONFIG['gallery_name'],$lang_copyright_screen);
    echo <<<EOT
</td>
</tr>
<tr>
<td colspan="2" class="tablef" width="100%"><table align="center"><tr>
<td><input type="button" onClick="javascript:history.go(-1);" value="
{$lang_copyright_php["back"]}" class="button" /></td>
</tr></table></td>
</tr>
EOT;
endtable();
pagefooter();
ob_end_flush();
?>




Modification 1 is the language file "english.php". It is in the lang subfolder. Look for the next code in "english.php" on line 105.
Code: [Select]
$lang_bbcode_help = 'You can add clickable links and some formating.......
Then add this part UNDER that line:
Code: [Select]
// my additions - begin
// ------------------------------------------------------------------------- //
// File privacy.php
// ------------------------------------------------------------------------- //

if (defined('PRIVACY_PHP')) {

$lang_privacy_screen = <<<EOT
{SITE_NAME} contains neither spyware nor adware, nor any other hidden or stealth software. The site does not contain hidden links to third-party sites (like trackers, counters and ad-sites). If you access the visible external links, you will leave this website. We do not control those sites, neither their content nor their privacy practices, which may differ from ours.<br />
<br />
No popup screens are used. No personal identifiable information is sent back to the server except the information from your browser. The server log files (containing info like your IP, browser type and time of visit) are private and can only be accessed by the host administrator.<br />
<br />
Name and email address of registered users and for subscription, and any other optional info entered, can only be accessed by {SITE_NAME} managers. It is never communicated to third parties nor is it visible to other users. If you are concerned about your privacy, you can use an anonymous (valid) email address.<br />
<br />
You will only receive email in reply to a message to the site administrator. {SITE_NAME} does not send unsolicited email. In case you want to follow-up the site, you can subscribe to the anonymous RSS-feed.<br />
<br />
While all this information will not be disclosed to any third party (except when forced to do so by a court order), the site administrators cannot be held responsible for hacking attempts that may lead to the data being divulged or compromised.<br />
<br />
We hope you continue to enjoy {SITE_NAME}!
EOT;

$lang_privacy_php = array(
  'privacy_title' => 'Privacy statement',
  'privacy_short' => 'privacy',
  'back' => 'Back',
);
}
// ------------------------------------------------------------------------- //
// File copyright.php
// ------------------------------------------------------------------------- //

if (defined('COPYRIGHT_PHP')) {

$lang_copyright_screen = <<<EOT
This is a placeholder for the terms of use and copyright screen.<br />
<br />
We hope you continue to enjoy {SITE_NAME}!
EOT;

$lang_copyright_php = array(
  'copyright_title' => 'Terms of Use',
  'copyright_header' => 'Terms of Use and Copyright.',
  'copyright_poweredby' => 'Powered by',
  'back' => 'Back',
);
}
// ------------------------------------------------------------------------- //
// File contactus.php //cpg1.4
// ------------------------------------------------------------------------- //

if (defined('CONTACTUS_PHP')) {
$lang_contactus_php = array(
  'title_contactus' => 'Contact us', //cpg1.4
  'send_failed_contactus' => 'Sorry but the server can\'t send your message by email...', //cpg1.4
  'send_success_contactus' => 'Your message was sent by email', //cpg1.4
  'consult_faq' => 'Did you read the FAQ?',
  'button_contactus' => 'Send message',
  'invalid_sender' => '<b>Warning</b> : what is your name ?', //cpg1.4
  'invalid_subject' => '<b>Warning</b> : what is the subject of your message ?', //cpg1.4
  'invalid_message' => '<b>Warning</b> : your message is empty !', //cpg1.4
);
$faq_contactus = <<<EOT
The vast majority of questions can be solved by reading the Frequently Asked Questions (FAQ) list <a href="faq.php">here</a>. Please read this <a href="faq.php">FAQ</a> first before sending any email to {SITE_NAME}.<br />
<br />
If you need support for your Subscription or your question was not be solved by the FAQ, dont&#39;t hesitate to send mail. Users with a paid Subscription always get an answer as soon as possible, usually within the next 24 hours.<br />
<br />
If you want a reply to your email, make sure your email address is valid. Your email address will not be used for anything else, see our <a href="privacy.php">Privacy Statement</a>.<br />
Some email providers direct emails from domains like {SITE_NAME} or Yahoo to the spam box or bulk folder. Make sure your email spam settings enable you to receive email from {SITE_NAME} or from Yahoo, or you will never get the reply!
EOT;
}
// my additions - end



Modification 2 is the file "functions.inc.php". It is in the include subfolder. It will append the bottom line with the extra on all your CPG pages. Look for the next code  on line 687.
Code: [Select]
        $template_footer = ereg_replace("</body[^>]*>",$add_version_info,$template_footer);
and add this code UNDER that line and before the } :
Code: [Select]
// my additions - begin
define('CONTACTUS_PHP', true);
define('PRIVACY_PHP', true);
define('COPYRIGHT_PHP', true);
// emergency solution - I don't want to invoke the full language package here - this is just a copy from the variables that are defined in the language file - begin
if (!is_array($lang_privacy_php)) $lang_privacy_php = array(
  'privacy_title' => 'Privacy statement',
  'privacy_short' => 'privacy',
);
if (!is_array($lang_copyright_php)) $lang_copyright_php = array(
  'copyright_title' => 'Terms of Use',
  'copyright_header' => 'Terms of Use and Copyright',
  'copyright_poweredby' => 'Powered by',
);
if (!is_array($lang_contactus_php)) $lang_contactus_php = array(
  'title_contactus' => 'Contact us', //cpg1.4
);
// emergency solution - I don't want to invoke the full language package here - this is just a copy from the variables that are defined in the language file - end
$strcredits = '<a href="'.$CONFIG['site_url'].'index.php" title=" '.$CONFIG['gallery_name'].' " rel="external">&copy;2004-'.date("Y").' '.$CONFIG['gallery_name'].'</a> :: :: ';
$strcredits .= '<a href="copyright.php" title=" '.$lang_copyright_php['copyright_header'].' ">'.strtolower($lang_copyright_php['copyright_title']).'</a> :: ';
$strcredits .= '<a href="privacy.php " title=" '.$lang_privacy_php['privacy_title'].' ">'.strtolower($lang_privacy_php['privacy_short']).'</a> :: ';
$strcredits .= '<a href="contactus.php" title=" '.$lang_contactus_php['title_contactus'].' ">'.strtolower($lang_contactus_php['title_contactus']).'</a> :: ';
$strcredits .= ':: <a href="http://coppermine.sourceforge.net/" title=" '.$lang_copyright_php['copyright_poweredby'].' Coppermine Photo Gallery " rel="external">Coppermine Photo Gallery</a>';
$strfnd = 'Powered by <a href="http://coppermine.sourceforge.net/" title="Coppermine Photo Gallery" rel="external">Coppermine Photo Gallery</a></div>';
$template_footer = str_replace($strfnd,$strcredits.'</div>',$template_footer);
// my additions - end
Note: you will NEVER and under NO circumstances remove the "powered by Coppermine" link. No explanation needed I guess.



You can see this at work at my temporary CPG test site here:
http://www.flemishdreams.com/cpg/index.php
A warning about this link: this is just my test site I use to make a subscription-based stock mod. It might not work all the time and it might change. For now, just look at the bottom line with "privacy :: contact us :: terms of use" and try the links. When you send me a "contact us" message, I will reply you with the content of the mail that CPG sent. That is, if there not thousands of it ;-)
If you want to test the behavior of the "contactus" screen as a registered user, you can register or just log in as the fake user "bin" password "coppermine". But if you send a message as "bin", I'm affraid I can't reply  ;D
« Last Edit: April 02, 2006, 12:08:19 pm by GauGau »
Logged

Justttt

  • Coppermine frequent poster
  • ***
  • Offline Offline
  • Gender: Male
  • Posts: 170
    • Trippy-ILLusion.Co.Uk
Re: Mod for Message to Administrator & more
« Reply #1 on: July 23, 2006, 01:42:41 pm »

hey , i have done every thing listed here, but the links do not show at the bottem off coppermine . i am using stramms modded version, any help please?

thank you
  justttt
Logged
J U S T T T T

denny101

  • Coppermine newbie
  • Offline Offline
  • Gender: Male
  • Posts: 10
Re: Mod for Message to Administrator & more
« Reply #2 on: September 07, 2006, 02:56:57 pm »

Did you ever get it working with the Stramm mod? I'm having the same problem.
Logged
Pages: [1]   Go Up
 

Page created in 0.043 seconds with 20 queries.