Intergrading any guestbook into Copermine Intergrading any guestbook into Copermine
 

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

Main Menu

Intergrading any guestbook into Copermine

Started by jmcurtusan, September 09, 2007, 09:03:44 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

jmcurtusan

hey guys im not so new at coding but new at this copermine and took me a while to figure this out and got it working perfectly.

If you guys have a guestbook that you want intergrated into copermine read this its really neat.

First copy your CPG/search.php file and rename the coppied file to guestbook.php.
Secont move the guestbook.php back to same location as search.php.
Third edit the guestbook.php and do the following.

This is the contents of search.php that you copied and renamed to guestbook.php.
<?php
/*************************
  Coppermine Photo Gallery
  ************************
  Copyright (c) 2003-2007 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.12
  $Source$
  $Revision: 3636 $
  $Author: gaugau $
  $Date: 2007-06-29 11:35:30 +0200 (Fr, 29 Jun 2007) $
**********************************************/

define('IN_COPPERMINE'true);
define('SEARCH_PHP'true);

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

if (!
USER_ID && $CONFIG['allow_unlogged_access'] == 0) {
    
$redirect $redirect "login.php";
    
header("Location: $redirect");
    exit();
}

pageheader($lang_search_php['title']);


echo <<< EOT

<form method="post" action="thumbnails.php" name="searchcpg">
EOT;

starttable('60%'$lang_search_php['title']);

$ip GALLERY_ADMIN_MODE '
        <tr>
                <td>
                        <input type="checkbox" name="pic_raw_ip" class="checkbox" id="pic_raw_ip" /><label for="pic_raw_ip" class="clickable_option">'
.$lang_search_php['ip_address'].'</label>
                </td>
        </tr>' 
:
        
'<tr>
                <td>&nbsp;</td>
                <td>&nbsp;</td>
        </tr>'
;

$customs '';

$result cpg_db_query("SELECT * FROM {$CONFIG['TABLE_CONFIG']} WHERE name LIKE 'user_field%_name' AND value <> '' ORDER BY name ASC");

while (
$row mysql_fetch_assoc($result)){
        
$name str_replace(array('_field''_name'), ''$row['name']);
        
$customs .= <<< EOT
                <tr>
                        <td><input type="checkbox" name="
$name" id="$name" class="checkbox" /><label for="$name" class="clickable_option">{$row['value']}</label></td>
                </tr>
EOT;
}
echo <<< EOT
        <tr>
            <td class="tableb" align="center" >
                <input type="text" style="width: 80%" name="search" maxlength="255" value="" class="textinput" />
                <input type="submit" value="
{$lang_search_php['submit_search']}" class="button" />
                <input type="hidden" name="album" value="search" />
            </td>
        </tr>
                <tr>
                        <td class="tableb">
                                <table align="center" width="60%">
                                        <tr>
                                                <td>
{$lang_search_php['fields']}:</td>
                                                <td align="center">
{$lang_search_php['age']}:</td>
                                        </tr>
                                        <tr>
                                                <td><input type="checkbox" name="title" id="title" class="checkbox" checked="checked" /><label for="title" class="clickable_option">
{$lang_adv_opts['title']}</label></td>
                                                <td align="right">
{$lang_search_php['newer_than']} <input type="text" name="newer_than" size="3" maxlength="4" class="textinput" /> {$lang_search_php['days']}</td>
                                        </tr>
                                        <tr>
                                                <td><input type="checkbox" name="caption" id="caption" class="checkbox" checked="checked" /><label for="caption" class="clickable_option">
{$lang_adv_opts['caption']}</label></td>
                                                <td align="right">
{$lang_search_php['older_than']} <input type="text" name="older_than" size="3" maxlength="4" class="textinput" /> {$lang_search_php['days']}</td>
                                        </tr>
                                        <tr>
                                                <td><input type="checkbox" name="keywords" id="keywords" class="checkbox" checked="checked" /><label for="keywords" class="clickable_option">
{$lang_adv_opts['keywords']}</label></td>
                                                <td>&nbsp;</td>

                                        </tr>
                                        <tr>
                                                <td><input type="checkbox" name="owner_name" id="owner_name" class="checkbox" /><label for="owner_name" class="clickable_option">
{$lang_adv_opts['owner_name']}</label></td>
                                                <td align="right"><select name="type" class="listbox">
                                                        <option value="AND" selected="selected">
{$lang_search_php['all_words']}</option>
                                                        <option value="OR">
{$lang_search_php['any_words']}</option></select>
                                                </td>
                                        </tr>
                                        <tr>
                                                <td><input type="checkbox" name="filename" id="filename" class="checkbox" /><label for="filename" class="clickable_option">
{$lang_adv_opts['filename']}</label></td>
                                                <td>&nbsp;</td>
                                        </tr>
                                                
$customs
                                                
$ip
                                </table>
                        </td>
                </tr>
EOT;


endtable();
echo 
'</form>';

if (
$CONFIG['clickable_keyword_search'] != 0) {
    include(
'include/keyword.inc.php');
}

echo <<< EOT
      <script language="javascript" type="text/javascript">
      <!--
      document.searchcpg.search.focus();
      -->
      </script>
EOT;


pagefooter();
ob_end_flush();
?>



Everything in the above code FROM "echo <<< EOT" TO "ob_end_flush();" must be removed EXEPT "pagefooter();" and replaced WITH CODE BELOW.

echo "<iframe src=\"http://www.xxxxxxxx.com/guest/mjguest.php\" name=\"frame1\" scrolling=\"auto\" frameborder=\"yes\" align=\"center\" height = \"600px\" width = \"100%\">\n";
echo "</iframe>\n";


Your guestbook.php file you coppied looks like this now with the new added code.

<?php
/*************************
  Coppermine Photo Gallery
  ************************
  Copyright (c) 2003-2007 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.12
  $Source$
  $Revision: 3636 $
  $Author: gaugau $
  $Date: 2007-06-29 11:35:30 +0200 (Fr, 29 Jun 2007) $
**********************************************/

define('IN_COPPERMINE'true);
define('SEARCH_PHP'true);

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

if (!
USER_ID && $CONFIG['allow_unlogged_access'] == 0) {
    
$redirect $redirect "login.php";
    
header("Location: $redirect");
    exit();
}

pageheader($lang_search_php['title']);


echo 
"<iframe src=\"http://www.xxxxxxxx.com/guest/mjguest.php\" name=\"frame1\" scrolling=\"auto\" frameborder=\"yes\" align=\"center\" height = \"600px\" width = \"100%\">\n";
echo 
"</iframe>\n";

pagefooter();
?>



All you need to do after this is replace the "http://www.xxxxxxxx.com/guest/mjguest.php" with the site address of your guestbook's index page and than go to your settings in copermine and under theme settings add your custom link as guestbook and the loocation to your guestbook.php file.

here is an example on my page www.on-my-space.com/photos/guestbook.php

ENJOY

jmcurtusan

The "echo <<< EOT" that im talking about is located after "pageheader($lang_search_php['title']);" witch is technicaly the first "echo <<< EOT" in the file.

Sorry for the confusion. Just look at the guestbook.php code after changes how it should look and you should be fine.

DO NOT REMOVE "pagefooter();"

Joachim Müller

Including pages using an iframe is not recommended.

jmcurtusan


Joachim Müller

1) The URL of the wrapping page will not change if the URL of the iframe changes. End users will not be aware of this. Bookmarks will fail.
2) If the content of the iframe is wider than the frame definition, there will be ugly scroll bars
3) The design of the iframe will not match the rest of the gallery
4) Users coming from search engines will not see your wrapping page and therefor will not see your menu. Subsequently, they will only see your guestbook and won't be able to browse the rest of your page
5) The guestbook app embedded by iframe is not aware of the user being logged in into coppermine and therefor will ask the user for his name/email/homepage even though the user has already entered that data. Many may be reluctant to enter that twice.

In fact, all drawbacks of frames apply. This is not a generic coppermine issue, but applies to all iframed pages. That's why we recommend a "real" integration. Best one posted so far was the viper guestbook integration. Sadly, the project has been abandoned.

jmcurtusan

Well for my purpose its working quite well because i have no user registration or members its only made for friends and family guests to see and sign guestbook and comment on pics (no log in required).  when you bookmark my guesbook.php page it will show you the gallary menu as well as the guestbook because there is no login required.