• [MOD] guestbook 5 0 5 1
Currently:  

Author Topic: [MOD] guestbook  (Read 524412 times)

0 Members and 2 Guests are viewing this topic.

Offline funpersian

  • Newbie
  • *
  • Posts: 23
    • View Profile
[MOD] guestbook
« on: April 14, 2005, 09:53:08 AM »
hi all
::;recovery cache google:::


this is MOD by chlee

I created a guest book page. Administrator can specify if guests are allowed to view, post, edit, delete the guestbook entries. The edit and delete function was ip oriented. You could take a look and try it over  Feel free to sign my guestbook but please don't register unless you are a medical specialist and are willing to share you medical images for educational purpose.

First, created a new file guestbook.php in your root directory

Code:
Code: [Select]
<?php 
/************************************************************************** 
 *                                                                        * 
 *    4images - A Web Based Image Gallery Management System               * 
 *    ----------------------------------------------------------------    * 
 *                                                                        * 
 *             File: details.php                                          * 
 *        Copyright: (C) 2002 Jan Sorgalla                                * 
 *            Email: jan@4homepages.de                                    * 
 *              Web: http://www.4homepages.de                             * 
 *    Scriptversion: 1.7                                                  * 
 *                                                                        * 
 *    Never released without support from: Nicky (http://www.nicky.net)   * 
 *                                                                        * 
 ************************************************************************** 
 *                                                                        * 
 *    Dieses Script ist KEINE Freeware. Bitte lesen Sie die Lizenz-       * 
 *    bedingungen (Lizenz.txt) f?r weitere Informationen.                 * 
 *    ---------------------------------------------------------------     * 
 *    This script is NOT freeware! Please read the Copyright Notice       * 
 *    (Licence.txt) for further information.                              * 
 *                                                                        * 
 *************************************************************************/ 

$main_template 'guestbook'
define('GET_CACHES'1); 
define('ROOT_PATH''./'); 
include(
ROOT_PATH.'global.php'); 
require(
ROOT_PATH.'includes/sessions.php'); 
$user_access get_permission(); 
include(
ROOT_PATH.'includes/page_header.php'); 

if (
$config['guestbook_view'] != 1) { 
  
header("Location: ".$site_sess->url(ROOT_PATH."index.php")); 
  exit; 


if (
$action == "") { 
   
$action "showcomments"


if (isset(
$HTTP_GET_VARS[URL_COMMENT_ID]) || isset($HTTP_POST_VARS[URL_COMMENT_ID])) { 
  
$comment_id = (isset($HTTP_GET_VARS[URL_COMMENT_ID])) ? intval($HTTP_GET_VARS[URL_COMMENT_ID]) : intval($HTTP_POST_VARS[URL_COMMENT_ID]); 

else { 
  
$comment_id 0

if (
$action == "deletecomment") { 
  if (!
$comment_id || ($config['user_delete_guestbook'] != && $user_info['user_level'] != ADMIN)) { 
    
show_error_page($lang['no_permission']); 
    exit; 
  } 
  
  
$sql "SELECT comment_id, comment_ip 
          FROM "
.GUESTBOOK_TABLE.
          WHERE comment_id = 
$comment_id"
  
$comment_row $site_db->query_firstrow($sql); 
  if (!
$comment_row || ($comment_row['comment_ip'] != $session_info['session_ip'] && $user_info['user_level'] != ADMIN)) { 
    
show_error_page($lang['no_permission']); 
    exit; 
  } 
  
  
$txt_clickstream $lang['comment_delete']; 
  
  
$sql "DELETE FROM ".GUESTBOOK_TABLE.
          WHERE comment_id = 
$comment_id"
  
$result $site_db->query($sql); 
  
  
$msg = ($result) ? $lang['comment_delete_success'] : $lang['comment_delete_error']; 


if (
$action == "removecomment") { 
  if (!
$comment_id || ($config['user_delete_guestbook'] != && $user_info['user_level'] != ADMIN)) { 
    
header("Location: ".$site_sess->url($url"&")); 
    exit; 
  } 

  
$sql "SELECT comment_id, user_name AS comment_user_name, comment_site, comment_text, comment_ip 
          FROM "
.GUESTBOOK_TABLE.
          WHERE comment_id = 
$comment_id"
  
$comment_row $site_db->query_firstrow($sql); 
  if (!
$comment_row || ($comment_row['comment_ip'] != $session_info['session_ip'] && $user_info['user_level'] != ADMIN)) { 
    
header("Location: ".$site_sess->url($url"&")); 
    exit; 
  } 

  
$txt_clickstream $lang['comment_delete']; 
  
$comment_user_name $comment_row['comment_user_name']; 
  
  
$site_template->register_vars(array( 
    
"comment_id" => $comment_id
    
"comment_user_name" => htmlspecialchars($comment_user_name), 
    
"comment_site" => format_text($comment_row['comment_site'], 0$config['wordwrap_comments'], 00), 
    
"comment_text" => format_text($comment_row['comment_text'], $config['html_comments'], $config['wordwrap_comments'], $config['bb_comments'], $config['bb_img_comments']), 
    
"lang_delete_comment" => $lang['comment_delete'], 
    
"lang_delete_comment_confirm" => $lang['comment_delete_confirm'], 
    
"lang_name" => $lang['name'], 
    
"lang_site" => $lang['site'], 
    
"lang_comment" => $lang['comment'], 
    
"lang_submit" => $lang['submit'], 
    
"lang_reset" => $lang['reset'], 
    
"lang_yes" => $lang['yes'], 
    
"lang_no" => $lang['no'
  )); 
  
$contents $site_template->parse_template("guestbook_deletecomment"); 


if (
$action == "updatecomment") { 
  if (!
$comment_id || ($config['user_edit_guestbook'] != && $user_info['user_level'] != ADMIN)) { 
    
show_error_page($lang['no_permission']); 
    exit; 
  } 
  
$sql "SELECT comment_id, comment_ip 
          FROM "
.GUESTBOOK_TABLE."  
          WHERE comment_id = 
$comment_id"
  
$comment_row $site_db->query_firstrow($sql); 
  if (!
$comment_row || ($comment_row['comment_ip'] != $session_info['session_ip'] && $user_info['user_level'] != ADMIN)) { 
    
show_error_page($lang['no_permission']); 
    exit; 
  } 
  
  
$txt_clickstream $lang['comment_edit']; 
  
  
$error 0
  
  
$comment_site un_htmlspecialchars(trim($HTTP_POST_VARS['comment_site'])); 
  
$comment_text un_htmlspecialchars(trim($HTTP_POST_VARS['comment_text'])); 
  
$comment_user_name un_htmlspecialchars(trim($HTTP_POST_VARS['comment_user_name'])); 
  
  if (
$comment_user_name == "")  { 
      
$msg .= (($msg != "") ? "<br />" "").$lang['name_required']; 
      
$error 1
    } elseif (
$site_db->not_empty("SELECT user_name FROM "
                              
GUESTBOOK_TABLE
                           
" WHERE user_name= '".strtolower($comment_user_name)."' AND comment_date > ".(time()-60 60 24))) { 
      
$msg .= (($msg != "") ? "<br />" "").$lang['username_exists']; 
      
$error 1
   } 
    if (
$comment_text == "")  { 
      
$msg .= (($msg != "") ? "<br />" "").$lang['comment_required']; 
      
$error 1
    } 

   if (!
$error)  { 
      if (
$comment_site =="http://") { 
         
$comment_site ""
      } 
      
$sql "UPDATE ".GUESTBOOK_TABLE.
               SET comment_site = '
$comment_site', comment_text = '$comment_text', user_name= '$comment_user_name
            WHERE comment_id = 
$comment_id"
      
$result $site_db->query($sql); 
      
$msg = ($result) ? $lang['comment_edit_success'] : $lang['comment_edit_error']; 
   } else { 
      
$action "editcomment"
      
$sendprocess 1
   } 


if (
$action == "editcomment") { 
  if (!
$comment_id || ($config['user_edit_guestbook'] != && $user_info['user_level'] != ADMIN)) { 
    
show_error_page($lang['no_permission']); 
    exit; 
  } 

  
$sql "SELECT comment_id, user_name AS comment_user_name, comment_site, comment_text, comment_ip 
          FROM "
.GUESTBOOK_TABLE.
        WHERE comment_id = 
$comment_id"
  
$comment_row $site_db->query_firstrow($sql); 
  if (!
$comment_row || ($comment_row['comment_ip'] != $session_info['session_ip'] && $user_info['user_level'] != ADMIN)) { 
    
show_error_page($lang['no_permission']); 
    exit; 
  } 
  
  
$txt_clickstream $lang['comment_edit']; 

  
$comment_site = (isset($HTTP_POST_VARS['comment_site'])) ? un_htmlspecialchars(stripslashes(trim($HTTP_POST_VARS['comment_site']))) : (empty($comment_row['comment_site']) ? "http://" $comment_row['comment_site']); 
  
$comment_text = (isset($HTTP_POST_VARS['comment_text'])) ? un_htmlspecialchars(stripslashes(trim($HTTP_POST_VARS['comment_text']))) : $comment_row['comment_text']; 
  
$comment_user_name = (isset($HTTP_POST_VARS['comment_user_name'])) ? un_htmlspecialchars(stripslashes(trim($HTTP_POST_VARS['comment_user_name']))) : $comment_row['comment_user_name']; 

  
$bbcode ""
  if (
$config['bb_comments'] == 1) { 
    
$site_template->register_vars(array( 
      
"lang_bbcode" => $lang['bbcode'], 
     
"smiles_text" => get_smiles_text(), 
      
"lang_tag_prompt" => $lang['tag_prompt'], 
      
"lang_link_text_prompt" => $lang['link_text_prompt'], 
      
"lang_link_url_prompt" => $lang['link_url_prompt'], 
      
"lang_link_email_prompt" => $lang['link_email_prompt'], 
      
"lang_list_type_prompt" => $lang['list_type_prompt'], 
      
"lang_list_item_prompt" => $lang['list_item_prompt'
    )); 
    
$bbcode $site_template->parse_template("bbcode"); 
  } 

  
$site_template->register_vars(array( 
    
"bbcode" => $bbcode
    
"comment_id" => $comment_id
    
"comment_user_name" => htmlspecialchars($comment_user_name), 
    
"comment_site" => htmlspecialchars($comment_site), 
    
"comment_text" => htmlspecialchars($comment_text), 
    
"lang_edit_comment" => $lang['comment_edit'], 
    
"lang_name" => $lang['name'], 
    
"lang_site" => $lang['site'], 
    
"lang_comment" => $lang['comment'], 
    
"lang_submit" => $lang['submit'], 
    
"lang_reset" => $lang['reset'], 
    
"lang_yes" => $lang['yes'], 
    
"lang_no" => $lang['no'], 
  )); 
  
$contents $site_template->parse_template("guestbook_editcomment"); 


//----------------------------------------------------- 
//--- Save Comment ------------------------------------ 
//----------------------------------------------------- 
$error 0
if (
$action == "postcomment" && $config['guestbook_post'] == 1) { 
    
$comment_user_name un_htmlspecialchars(trim($HTTP_POST_VARS['comment_user_name'])); 
    
$comment_text un_htmlspecialchars(trim($HTTP_POST_VARS['comment_text'])); 
   
$comment_site un_htmlspecialchars(trim($HTTP_POST_VARS['comment_site'])); 
    
// Flood Check 
   
$sql "SELECT comment_ip, comment_date 
              FROM "
.GUESTBOOK_TABLE.
         WHERE comment_ip = '"
.$session_info['session_ip']."'  
         ORDER BY comment_date DESC 
         LIMIT 1"

   
$spam_row $site_db->query_firstrow($sql); 
   
$spamtime $spam_row['comment_date'] + 360

   if (
time() <= $spamtime && $user_info['user_level'] != ADMIN)  { 
      
$msg .= (($msg != "") ? "<br />" "").$lang['spamming']; 
      
$error 1
   } 

   if (
$comment_user_name == "")  { 
      
$msg .= (($msg != "") ? "<br />" "").$lang['name_required']; 
      
$error 1
    } elseif (
$site_db->not_empty("SELECT user_name FROM "
                              
GUESTBOOK_TABLE
                           
" WHERE user_name= '".strtolower($comment_user_name)."' AND comment_date > ".(time()-60 60 24))) { 
      
$msg .= (($msg != "") ? "<br />" "").$lang['username_exists']; 
      
$error 1
   } 
    if (
$comment_text == "")  { 
      
$msg .= (($msg != "") ? "<br />" "").$lang['comment_required']; 
      
$error 1
    } 

   if (!
$error)  { 
      if (
$comment_site =="http://") { 
         
$comment_site ""
      } 
      
$sql "INSERT INTO ".GUESTBOOK_TABLE.
               (user_name, comment_site, comment_text, comment_ip, comment_date) 
            VALUES 
            ('
$comment_user_name', '$comment_site', '$comment_text', '".$session_info['session_ip']."', ".time().")"
      
$site_db->query($sql); 
   } 
   unset(
$spam_row); 



//----------------------------------------------------- 
//---Show Guestbook Comments--------------------------- 
//----------------------------------------------------- 

if (($action == "showcomments" || $action == "postcomment" ) && $config['guestbook_view'] == 1) { 
     if (isset(
$HTTP_POST_VARS['commentsetperpage']) || isset($HTTP_GET_VARS['commentsetperpage'])) { 
      
$commentsetperpage = (intval($HTTP_POST_VARS['commentsetperpage']) ) ? intval($HTTP_POST_VARS['commentsetperpage']) : intval($HTTP_GET_VARS['commentsetperpage']); 
      if (
$commentsetperpage) { 
         
$site_sess->set_session_var("commentperpage"$commentsetperpage); 
         
$session_info['commentperpage'] = $commentsetperpage
      } 
   } 

   if (isset(
$session_info['commentperpage'])) { 
      
$commentperpage $session_info['commentperpage']; 
   } else { 
      
$commentperpage 8
   } 
  
   
$sql "SELECT COUNT(user_name) AS comments 
          FROM "
.GUESTBOOK_TABLE
   
$result $site_db->query_firstrow($sql); 
   
$num_comments $result['comments']; 
   
$site_db->free_result(); 
   
$num_rows_all = (isset($num_comments)) ? $num_comments 0
   
$link_arg $site_sess->url(ROOT_PATH."guestbook.php");  
   include_once(
ROOT_PATH.'includes/paging.php'); 
   
$getpaging = new Paging($page$commentperpage$num_rows_all$link_arg); 
   
$offset $getpaging->get_offset(); 
   
$site_template->register_vars(array( 
        
"paging" => $getpaging->get_paging(), 
      
"paging_stats" => $getpaging->get_paging_stats() 
   )); 

   
$sql "SELECT comment_id, user_name AS comment_user_name, comment_site, comment_text, comment_ip, comment_date 
         FROM "
.GUESTBOOK_TABLE.
         ORDER BY comment_date DESC 
         LIMIT 
$offset$commentperpage"
  
   
$result $site_db->query($sql); 
   
$comment_row = array(); 
   while (
$row $site_db->fetch_array($result)) { 
      
$comment_row[] = $row
   } 
   
$site_db->free_result($result); 
   
$num_comments sizeof($comment_row); 
   
$comments ""
    
   
$site_template->register_vars(array( 
        
"lang_guest_from" => $lang['guest_from'], 
      
"lang_guest_site" => $lang['guest_site'
   )); 
   if (
$num_comments) { 
      
$bgcounter 0
      for (
$i 0$i $num_comments$i++) { 
         
$row_bg_number = ($bgcounter++ % == 0) ? 2

         
$comment_user_name htmlspecialchars($comment_row[$i]['comment_user_name']); 
         
$comment_user_ip = ($user_info['user_level'] == ADMIN) ? $comment_row[$i]['comment_ip'] : ""

         
$admin_links ""
         if (
$user_info['user_level'] == ADMIN) { 
            
$admin_links .= "<a href=\""
                          
$site_sess->url(ROOT_PATH."guestbook.php?action=editcomment&amp;comment_id="
                                         
$comment_row[$i]['comment_id']). 
                          
"\" target=\"admin_edit\">".$lang['edit']."</a>&nbsp;"
            
$admin_links .= "<a href=\"".$site_sess->url(ROOT_PATH."guestbook.php?action=removecomment&amp;comment_id=".$comment_row[$i]['comment_id'])."\" target=\"admin_edit\">".$lang['delete']."</a>"
         } elseif (
$comment_row[$i]['comment_ip'] == $session_info['session_ip']) { // if ip equals, permit to edit 
            
$admin_links .= ($config['user_edit_guestbook'] != 1) ? "" 
                          
"<a href=\"".$site_sess->url(ROOT_PATH."guestbook.php?action=editcomment&amp;comment_id=".$comment_row[$i]['comment_id'])."\" target=\"admin_edit\">".$lang['edit']."</a>&nbsp;"
            
$admin_links .= ($config['user_delete_guestbook'] != 1) ? "" 
                          
"<a href=\"".$site_sess->url(ROOT_PATH."guestbook.php?action=removecomment&amp;comment_id=".$comment_row[$i]['comment_id'])."\" target=\"admin_edit\">".$lang['delete']."</a>"
         } 
         
$site_template->register_vars(array( 
            
"comment_id" => $comment_row[$i]['comment_id'], 
            
"comment_user_name" => $comment_user_name
            
"comment_user_ip" => $comment_user_ip
            
"comment_site" => format_text($comment_row[$i]['comment_site'], 0$config['wordwrap_comments'], 00), 
            
"comment_text" => format_text($comment_row[$i]['comment_text'], $config['html_comments'], $config['wordwrap_comments'], $config['bb_comments'], $config['bb_img_comments']), 
            
"comment_date" => format_date($config['date_format']." ".$config['time_format'], $comment_row[$i]['comment_date']), 
            
"row_bg_number" => $row_bg_number
            
"admin_links" => $admin_links
         )); 
            
$comments .= $site_template->parse_template("guestbook_comment_bit"); 
          
      } 
// end for 
   
} else { 
      
$comments $lang['be_the_first']; 
   } 
   
//---End Show Guestbook Comments---- 


  //----------------------------------------------------- 
  //--- BBCode & Form ----------------------------------- 
  //----------------------------------------------------- 
  
$bbcode ""
  if (
$config['bb_comments'] == 1) { 
    
$site_template->register_vars(array( 
      
"lang_bbcode" => $lang['bbcode'], 
     
"smiles_text" => get_smiles_text(), 
      
"lang_tag_prompt" => $lang['tag_prompt'], 
      
"lang_link_text_prompt" => $lang['link_text_prompt'], 
      
"lang_link_url_prompt" => $lang['link_url_prompt'], 
      
"lang_link_email_prompt" => $lang['link_email_prompt'], 
      
"lang_list_type_prompt" => $lang['list_type_prompt'], 
      
"lang_list_item_prompt" => $lang['list_item_prompt'
    )); 
    
$bbcode $site_template->parse_template("bbcode"); 
  } 

  if (
$config['guestbook_post'] != 1) { 
     
$comment_form ""
  } else { 
  
$comment_user_name = (isset($HTTP_POST_VARS['comment_user_name']) && $error) ? stripslashes(htmlspecialchars(trim($HTTP_POST_VARS['comment_user_name']))) : (($user_info['user_level'] != GUEST) ? htmlspecialchars($user_info['user_name']) : ""); 
  
$comment_site = (isset($HTTP_POST_VARS['comment_site']) && $error) ? stripslashes(htmlspecialchars(trim($HTTP_POST_VARS['comment_site']))) : "http://"

  
$site_template->register_vars(array( 
     
"bbcode" => $bbcode
      
"comment_user_name" => $comment_user_name
      
"comment_site" => $comment_site
      
"comment_text" => $comment_text
      
"lang_post_guestbook" => $lang['post_guestbook'], 
      
"lang_name" => $lang['name'], 
      
"lang_site" => $lang['site'], 
      
"lang_comment" => $lang['comment'
    )); 
    
$comment_form $site_template->parse_template("guestbook_form"); 
   
$site_template->register_vars("guestbook_form"$comment_form); 
   
$contents $site_template->parse_template("guestbook_showcomments"); 
   unset(
$comment_form); 
  } 
// end if allow_comments 
  
$txt_clickstream $lang['post_guestbook']; 


//----------------------------------------------------- 
//---Clickstream--------------------------------------- 
//----------------------------------------------------- 
$clickstream "<span class=\"clickstream\"><a href=\"".$site_sess->url(ROOT_PATH."index.php")."\" class=\"clickstream\">".$lang['home']."</a>".$config['category_separator'
            .
"<a href=\"".$site_sess->url(ROOT_PATH."guestbook.php?action=showcomments")."\">".$lang['guestbook']."</a>".$config['category_separator'].$txt_clickstream."</span>"

//----------------------------------------------------- 
//--- Print Out --------------------------------------- 
//----------------------------------------------------- 
$site_template->register_vars(array( 
  
"contents" => $contents
  
"guestbook_comments" => $comments
  
"lang_sign_my_guestbook" => $lang['sign_my_guestbook'], 
  
"msg" => $msg
  
"clickstream" => $clickstream 
)); 
unset(
$contents); 
$site_template->print_template($site_template->parse_template($main_template)); 
include(
ROOT_PATH.'includes/page_footer.php'); 

?>


Then open lang/your_lang/main.php and add these definitions

code:
Code: [Select]
$lang['guestbook'] = "GuestBook";
$lang['site'] = "Your Homepage:";
$lang['post_guestbook'] = "Sign our GuestBook";
$lang['sign_my_guestbook'] = "Please sign our GuestBook";
$lang['be_the_first'] = "Be the first to sign our GuestBook";
$lang['guest_site'] = "Homepage:";
$lang['guest_from'] = "From:";


And these into lang/your_lang/admin.php

code:
Code: [Select]
/*-- Setting-Group 11 --*/
$setting_group[11]="GuestBook";
$setting['guestbook_view'] = "Allow view GuestBook";
$setting['guestbook_post'] = "Allow post GuestBook";
$setting['user_delete_guestbook'] = "Allow delete post in GuestBook";
$setting['user_edit_guestbook'] = "Allow edit post in GuestBook";

Find this in admin/settings.php

Code:
Code: [Select]
show_form_footer($lang['save_changes'], "", 2);
Add these before it
Code:
Code: [Select]
 show_table_separator($setting_group[11], 2, "#setting_group_11");
  show_setting_row("guestbook_view", "radio");
  show_setting_row("guestbook_post", "radio");
  show_setting_row("user_edit_guestbook", "radio");
  show_setting_row("user_delete_guestbook", "radio");
 


NOTICE: You might need to change the 11 in above code.

Open includes/constants.php and find
Code:
Code: [Select]
// URL Parameters
 


Add these before it
Code:
Code: [Select]
define('GUESTBOOK_TABLE', $table_prefix.'guestbook');
 


Open includes/page_header.php and find
Code:
Code: [Select]
"url_categories" => $site_sess->url(ROOT_PATH."categories.php"),
 


Add this after it
Code:
Code: [Select]
"url_guestbook" => (!empty($url_guestbook)) ? $site_sess->url($url_guestbook) : $site_sess->url(ROOT_PATH."guestbook.php"),
 


Now you need several new template html files. You might need to modify these to make it beautifully incoporated into your site because I am not using a standard theme.

templates/your_template/guestbook.html
Code:
Code: [Select]
{header}
{if msg}<br /><b>{msg}</b>{endif msg}

<br />
{contents}

<br />

{footer}
 


Or just copy the member.html and change the tag {content} to {contents}.

templates/your_template/guestbook_form.html
Code:
Code: [Select]
<script language="JavaScript" src="bbcode.js" type="text/javascript"></script>
<table width="100%" cellpadding="3" cellspacing="1" border="0" class="forumline">
        <tr>
          <td valign="top" class="row1" width="100%">
            <form name="commentform" action="{self}#comments" method="post" onSubmit="return checkForm(this)">
              <table cellpadding="4" cellspacing="0" border="0">
              <tr>
                  <td width="90"><b>{lang_name}</b></td>
                  <td>
                    <input type="text" name="comment_user_name" size="40" value="{comment_user_name}" class="commentinput" />
                  </td>
                </tr>
                <tr>
                  <td width="90"><b>{lang_site}</b></td>
                  <td>
                    <input type="text" name="comment_site" size="40" value="{comment_site}" class="commentinput" />
                  </td>
                </tr>
                <tr>
                  <td width="90" valign="top"><b>{lang_comment}</b></td>
                  <td>
                    <textarea name="comment_text" cols="85" rows="10" class="commenttextarea" wrap="virtual" onSelect="storeCaret(this);" onClick="storeCaret(this);" onKeyUp="storeCaret(this);">{comment_text}</textarea>
                  </td>
                </tr>
            <tr>
                  <td width="90" valign="top">&nbsp;</td>
                  <td>{bbcode}</td>
                </tr>
                <tr>
                  <td width="90" valign="top">&nbsp;</td>
                  <td>
                    <input type="hidden" name="action" value="postcomment" />
                    <input type="hidden" name="id" value="{image_id}" />
                    <input type="submit" name="postbutton" value="{lang_post_guestbook}" class="button" />
                  </td>
                </tr>
              </table>
            </form>
          </td>
        </tr>
      </table>
 

templates/your_template/guestbook_editcomment.html
Code:
Code: [Select]
<script language="JavaScript" src="bbcode.js" type="text/javascript"></script>
<form name="commentform" action="{url_guestbook}" method="post" onsubmit="uploadbutton.disabled=true;">
  <input type="hidden" name="action" value="updatecomment" />
  <input type="hidden" name="comment_id" value="{comment_id}" />

<table width="100%" cellpadding="2" cellspacing="1" border="0" class="forumline">
<tr>
<td class="cat" colspan="2">{lang_edit_guestbook}</td>
</tr>

<tr>
  <td class="row2"><b>{lang_name}</b></td>
  <td class="row2">
    <input type="text" name="comment_user_name" size="30" value="{comment_user_name}" class="commentinput" />
  </td>
</tr>
<tr>
  <td class="row2"><b>{lang_site}</b></td>
  <td class="row2">
    <input type="text" name="comment_site" size="30" value="{comment_site}" class="commentinput" />
  </td>
</tr>
<tr>
  <td class="row1" valign="top"><b>{lang_comment}</b></td>
  <td class="row1">
    <textarea name="comment_text" cols="30" rows="10" wrap="virtual" class="commenttextarea"
      onSelect="storeCaret(this);" onClick="storeCaret(this);" onKeyUp="storeCaret(this);">{comment_text}</textarea>
  </td>
</tr>
<tr>
  <td class="row2" valign="top">&nbsp;</td>
  <td class="row2">{bbcode}</td>
</tr>
<tr>
<td class="cat" colspan="2">
  <p align="center">
    <input type="submit" name="uploadbutton" value="{lang_submit}" class="button" />
    <input type="reset" value="{lang_reset}" class="button" />
  </p>
</td>
</tr>
</table>
</form>
 

templates/your_template/guestbook_showcomments.html
Code:
Code: [Select]
<table width="100%" border="0" cellspacing="1" cellpadding="6" class="forumline">
    <tr>
        <td align="left" class="cat" width="100%" >{lang_sign_my_guestbook}</td>
    </tr>
    <tr>
        <td class="row1">
        {guestbook_comments}
      {if paging}
         <br/>
         <span align="center">{paging}</span>
      {endif paging}
        </td>
    </tr>
   <tr>
        <td class="row2">
        {guestbook_form}
        </td>
    </tr>
</table>
 

templates/your_template/guestbook_deletecomment.html
Code:
Code: [Select]
<form method="post" action="{url_guestbook}" onsubmit="uploadbutton.disabled=true;">
  <input type="hidden" name="action" value="deletecomment" />
  <input type="hidden" name="comment_id" value="{comment_id}" />
<table width="100%" cellpadding="2" cellspacing="1" border="0" class="forumline">
<tr>
<td class="cat">{lang_delete_comment}</td>
</tr>

<tr>
<td class="row2">{lang_delete_comment_confirm}</td>
</tr>

<tr>
<td class="cat">
  <p align="center">
    <input type="submit" name="uploadbutton" value="{lang_yes}" class="button" />
    <input type="button" value="{lang_no}" class="button" onclick="javascript:history.go(-1)" />
  </p>
</td>
</tr>
</table>
</form>
 

templates/your_templates/guestbook_comment_bit.html
Code:
Code: [Select]
<table width="100%" cellspacing="0" cellpadding="4" style="border:solid 1 #CCCCEE">
<tr>
   <td class="commentrow{row_bg_number}" width="80%" ><b>{comment_user_name}</b></td>
   <td class="commentrow{row_bg_number}" align="right" ><small>({lang_release_date}{comment_date})</small></td>
</tr>
<tr>
   <td colspan=2 class="commentrow{row_bg_number}" align="left" style="border-top:solid 1 #DDDDFF">
     {comment_text}
   </td>
</tr>
{if comment_site}
<tr>
   <td colspan=2 class="commentrow{row_bg_number}" align="left" style="border-top:solid 1 #DDDDFF">
     <b>{lang_guest_site}&nbsp;</b>{comment_site}
   </td>
</tr>
{endif comment_site}
{if admin_links}
<tr>
   <td class="commentrow{row_bg_number}" align="left" style="border-top:solid 1 #DDDDFF">
     <b>{lang_guest_from}&nbsp;</b>{comment_user_ip}</td>
   <td class="commentrow{row_bg_number}" align="right" style="border-top:solid 1 #DDDDFF">{admin_links}</td>
</tr>
{endif admin_links}
</table>
<br/>
 
now download this file http://140.112.132.43/install_guestbook.zip


Visit that page

http://your_4images_site/install_guestbook.php


install complete  :wink:


------------------------------------------------------------------------------- :wink:------------------------------------------------------------------------


 :!:this is support for guestbook :?:



 
Some users requested template files for default 4images theme. Basically, you could just copy your templates/your_template/member.html to templates/your_template/guestbook.html and replace the tag {content} to {contents}.

Replace all
Code:
class="forumline"
 

to
Code:

class="bordercolor"
 

in all guestbook_XXXX.html


--------------------------------------------------------- :lol:------------------------------------------

Quote:
- Add badword check to headline
 


To filter user_name for bad words
Find this in guestbook.php
Code:
Code: [Select]
"comment_user_name" => $comment_user_name,
 


change it to
Code:
Code: [Select]
"comment_user_name" => format_text($comment_user_name, $config['html_comments'], $config['wordwrap_comments'], $config['bb_comments'], $config['bb_img_comments']),
 
------------------------------------------------------------ :wink:------------------------------------------------------------

Hello.
I put everything in as you wrote,but in my main page ,there is no "Guestbook" to see.
What did I wrong?

here is the text of the link:

Code: [Select]
<td><img src="{template_url}/images/spacer.gif" width="4" height="4" alt="" />{clickstream}</td>
<td align="right">
<a href="{url_guestbook}"><b>{Guestbook}</b></a>&nbsp;
<a href="{url_new_images}"><b>{lang_new_images}</b></a>&nbsp;
<a href="{url_new_images}"><b>{lang_new_images}</b></a>&nbsp;
Thanks for any lhelp


Open includes/page_header.php and find
Code:

Code: [Select]
"url_categories" => $site_sess->url(ROOT_PATH."categories.php"),
  
 


Add this after it

Code:
Code: [Select]
"lang_guestbook" => $lang['guestbook'],
 

Now you code should be
Code:
Code: [Select]
<td><img src="{template_url}/images/spacer.gif" width="4" height="4" alt="" />{clickstream}</td>
<td align="right">
<a href="{url_guestbook}"><b>{lang_guestbook}</b></a>&nbsp;
<a href="{url_new_images}"><b>{lang_new_images}</b></a>&nbsp;
<a href="{url_new_images}"><b>{lang_new_images}</b></a>&nbsp;

 
------------------------------------------------------ :wink:-----------------------------------------------------------------

Johnny_H wrote:
Works fine this mod  

but i have a little slight problem...

"User name already exists."

when i try to post an entry.... seems only one nick can post.. how to disable?

It is set to restrict one nick can post once each day. If you want to disable it. Find two times in guestbook.php
Code:
Code: [Select]
if ($comment_user_name == "")  {
      $msg .= (($msg != "") ? "<br />" : "").$lang['name_required'];
      $error = 1;
    } elseif ($site_db->not_empty("SELECT user_name FROM ".
                              GUESTBOOK_TABLE.
                           " WHERE user_name= '".strtolower($comment_user_name)."' AND comment_date > ".(time()-60 * 60 * 24))) {
      $msg .= (($msg != "") ? "<br />" : "").$lang['username_exists'];
      $error = 1;
   }
 
change them to
Code:
Code: [Select]
if ($comment_user_name == "")  {
      $msg .= (($msg != "") ? "<br />" : "").$lang['name_required'];
      $error = 1;
    }
 
--------------------------------------------------------------- :wink:----------------------------------------------

JensF wrote:
Hi there,

what must i do to become a Mail or a PM when a Guest or a Member sign in the Guestbook??


In guestbook.php, find
Code:
Code: [Select]
$sql = "UPDATE ".GUESTBOOK_TABLE."
 

Add before
Code:
Code: [Select]
  //-----------------------------------------------------
   // Start Emailer for guestbook
   //-----------------------------------------------------
   if (!empty($config['guestbook_manager'])) {
      $current_time = time();
      include_once(ROOT_PATH.'includes/email.php');
      $site_email = new Email();
      $site_email->set_to($config['guestbook_manager']);
      $site_email->set_from($config['site_email'], $config['site_name']);
      $site_email->set_subject("Guestbook Edited");
      $site_email->register_vars(array(
        "recipient_name" => "GuestBook Manager",
        "comment_date" => format_date($config['date_format']." ".$config['time_format'], $current_time),
        "comment_username" => $comment_user_name,
        "comment_text" => $comment_text,
        "comment_site" => $comment_site,
        "site_name" => $config['site_name'],
        "user_country" => $user_country
      ));
      $site_email->set_body("guestbook_email", $config['language_dir']);
      $site_email->send_email();
   }
   //--end emailer
 
Find
Code:
Code: [Select]
$sql = "INSERT INTO ".GUESTBOOK_TABLE."
 

Add before
Code:
Code: [Select]
//-----------------------------------------------------
   // Start Emailer for guestbook
   //-----------------------------------------------------
   if (!empty($config['guestbook_manager'])) {
      $current_time = time();
      include_once(ROOT_PATH.'includes/email.php');
      $site_email = new Email();
      $site_email->set_to($config['guestbook_manager']);
      $site_email->set_from($config['site_email'], $config['site_name']);
      $site_email->set_subject("Guestbook Signed");
      $site_email->register_vars(array(
        "recipient_name" => "GuestBook Manager",
        "comment_date" => format_date($config['date_format']." ".$config['time_format'], $current_time),
        "comment_username" => $comment_user_name,
        "comment_text" => $comment_text,
        "comment_site" => $comment_site,
        "site_name" => $config['site_name'],
        "user_country" => $user_country
      ));
      $site_email->set_body("guestbook_email", $config['language_dir']);
      $site_email->send_email();
   }
   //--end emailer
 
In lang/your_lang/admin.php, find
Code:
Code: [Select]
$setting['user_edit_guestbook'] = "Allow edit post in GuestBook";
 
Add after
Code:
Code: [Select]
$setting['guestbook_manager'] = "Email for monitoring GuestBook";
 

In admin/settings.php, find
Code:
Code: [Select]
 show_setting_row("user_delete_guestbook", "radio");
 

Add after
Code:
Code: [Select]
show_setting_row("guestbook_manager");
 


Add a new file: lang/your_lang/email/guestbook_email.html
Code:
Code: [Select]
Dear {recipient_name},

{comment_username} signed our guestbook on {comment_date}
at {site_name}.
...............................................................
{comment_text}

{comment_site}
{user_country}
---------------------------------------------------------------
Thanks for you support to our site.

Best Regards,

{site_name}
 


In phpMyAdmin, add this setting into 4images_settings table
Code:
Code: [Select]
INSERT INTO `4images_settings` ( `setting_name` , `setting_value` )
VALUES (

'guestbook_manager', 'your_email_account@your_emailserver'
)
 

That should work. If you want to disable this feature, keep guestbook_manager field blank.


------------------------------------------------------------ :wink:--------------------------------------------------------

tikle wrote:
Fatal error: Call to undefined function: get_smiles_text() in /home/www/web22/html/foto/guestbook.php on line 362

 


Remove this line in guestbook.php
Code:
Code: [Select]
"smiles_text" => get_smiles_text(),
 


 :wink: :wink: :wink: :wink: :roll:

Edited by mawenzi :
- 22.06.2009 : install_guestbook.zip attached
« Last Edit: June 22, 2009, 07:43:06 PM by mawenzi »

Offline universal

  • Full Member
  • ***
  • Posts: 213
    • View Profile
    • http://www.funny.lt
Re: [MOD] guestbook
« Reply #1 on: April 18, 2005, 03:26:58 PM »
Again this addres?!
http://www.funny.lt

Offline V@no

  • If you don't tell me what to do, I won't tell you where you should go :)
  • Global Moderator
  • 4images Guru
  • *****
  • Posts: 17.849
  • mmm PHP...
    • View Profile
    • 4images MODs Demo
Re: [MOD] guestbook
« Reply #2 on: April 19, 2005, 02:24:21 AM »
Any sugestions?
yes, I have one:
See your explanation/description along with the question.
With 108 posts, u should know better by now ;)
Your first three "must do" before you ask a question:
Please do not PM me asking for help unless you've been specifically asked to do so. Such PMs will be deleted without answer. (forum rule #6)
Extension for Firefox/Thunderbird: Master Password+    Back/Forward History Tweaks (restartless)    Cookies Manager+    Fit Images (restartless for Thunderbird)

Offline universal

  • Full Member
  • ***
  • Posts: 213
    • View Profile
    • http://www.funny.lt
Re: [MOD] guestbook
« Reply #3 on: April 19, 2005, 04:49:56 AM »
Sorry  :oops:
Guestbook posts everything to db, but I can`t see anything (posts in guestbook).
Again this addres?!
http://www.funny.lt

Offline V@no

  • If you don't tell me what to do, I won't tell you where you should go :)
  • Global Moderator
  • 4images Guru
  • *****
  • Posts: 17.849
  • mmm PHP...
    • View Profile
    • 4images MODs Demo
Re: [MOD] guestbook
« Reply #4 on: April 19, 2005, 04:52:11 AM »
perhaps u removed something when edited the template?
Your first three "must do" before you ask a question:
Please do not PM me asking for help unless you've been specifically asked to do so. Such PMs will be deleted without answer. (forum rule #6)
Extension for Firefox/Thunderbird: Master Password+    Back/Forward History Tweaks (restartless)    Cookies Manager+    Fit Images (restartless for Thunderbird)

Offline universal

  • Full Member
  • ***
  • Posts: 213
    • View Profile
    • http://www.funny.lt
Re: [MOD] guestbook
« Reply #5 on: April 19, 2005, 05:05:49 AM »
Hmm, I tryed to do these steps few times... Maybe it`s time for me to buy reading-glass.
Again this addres?!
http://www.funny.lt

Offline emersontiago

  • Pre-Newbie
  • Posts: 2
    • View Profile
    • Arquivo Digital Emerson Tiago
Re: [MOD] guestbook
« Reply #6 on: April 23, 2005, 06:57:47 PM »
Thanks funpersian !

http://www.emersontiago.com/4images/guestbook.php


[]´s

-emersontiago-

 
 

Offline universal

  • Full Member
  • ***
  • Posts: 213
    • View Profile
    • http://www.funny.lt
Re: [MOD] guestbook
« Reply #7 on: April 24, 2005, 10:24:57 AM »
Hmm I redid all the steps, and now I can`t even see guestbook  :lol:  :oops:
An I don`t get it why? When I go to http://www.pramoga.net/guestbook.php
It redirects to index.php ... Something with headers?  :?
Again this addres?!
http://www.funny.lt

Offline Sopur

  • Jr. Member
  • **
  • Posts: 54
    • View Profile
    • Bilder des Harassenlaufs in Basel
Re: [MOD] guestbook
« Reply #8 on: April 25, 2005, 11:22:14 AM »
Hallo Zusammen!
Ich habe das Gästebuch nun installiert. Leider kann ich es nirgends sehen. Die Anleitung oben versuchte ich zu befolgen, jedoch ohne Erfolt.
Ich hätte gerne einen Eintrag oben auf der Seite neben "Top Bilder" und "Neue Bilder".
Wo finde ich das? Bzw. wie muss so ein Link aussehen?
Vielen Dank für Eure Hilfe!
M
F
G
Sopur

Offline Schwarz Liesi

  • Pre-Newbie
  • Posts: 5
    • View Profile
Re: [MOD] guestbook
« Reply #9 on: April 25, 2005, 09:58:11 PM »
Hallo Zusammen!
Ich habe das Gästebuch nun installiert. Leider kann ich es nirgends sehen. Die Anleitung oben versuchte ich zu befolgen, jedoch ohne Erfolt.
Ich hätte gerne einen Eintrag oben auf der Seite neben "Top Bilder" und "Neue Bilder".
Wo finde ich das? Bzw. wie muss so ein Link aussehen?
Vielen Dank für Eure Hilfe!
M
F
G
Sopur

Hallo!

Du kannst es im jeweiligen Template einfach einfügen!
in der Template-Datei home.html zB:

suche:


Code: [Select]
<td class="navbar" align="right">
<a href="{url_top_images}"><b>{lang_top_images}</b></a>&nbsp;|&nbsp;
<a href="{url_new_images}"><b>{lang_new_images}</b></a>&nbsp;
 </td>


Du könntest den Link zB vor dem Link zu den Top-Bildern einfügen:

Code: [Select]
<td class="navbar" align="right">
<a href="LINK ZU GB"><b>TEXT FÜR GB-LINK</b></a>&nbsp;|&nbsp;
<a href="{url_top_images}"><b>{lang_top_images}</b></a>&nbsp;|&nbsp;
<a href="{url_new_images}"><b>{lang_new_images}</b></a>&nbsp;
 </td>

Wenn noch Fragen, einfach stellen!  :wink:
LieGrü,
Schwarz Liesi

running an local 4images-gallery for my fotoarchiv and share it with others in our local lan (whole village (10 houses))

Offline Sopur

  • Jr. Member
  • **
  • Posts: 54
    • View Profile
    • Bilder des Harassenlaufs in Basel
Re: [MOD] guestbook
« Reply #10 on: April 26, 2005, 03:23:41 PM »
Hm - leider habe ich den entsprechenden Abschnitt in der home.html nicht gefunden. Kann es sein, dass Du Version 1.7.1 benutzt? (Ich benutze nur 1.7)
MFG
Sopur

Offline Sopur

  • Jr. Member
  • **
  • Posts: 54
    • View Profile
    • Bilder des Harassenlaufs in Basel
Re: [MOD] guestbook
« Reply #11 on: April 27, 2005, 06:41:12 PM »
Habe die richtige Datei nun gefunden. Nun habe ich aber folgendes Problem: wenn ich den BB-Code aktiviere, erhalte ich beim Aufruf des Gästebuches immer folgende Fehlermeldung:
Fatal error: Call to undefined function: get_smiles_text() in /home/schwabch/public_html/harassenlauf/guestbook.php on line 354

Was kann man dagegen tun?
Vielen Dank!
M
F
G
Sopur

Offline funpersian

  • Newbie
  • *
  • Posts: 23
    • View Profile
Re: [MOD] guestbook
« Reply #12 on: April 28, 2005, 02:05:45 AM »
Habe die richtige Datei nun gefunden. Nun habe ich aber folgendes Problem: wenn ich den BB-Code aktiviere, erhalte ich beim Aufruf des Gästebuches immer folgende Fehlermeldung:
Fatal error: Call to undefined function: get_smiles_text() in /home/schwabch/public_html/harassenlauf/guestbook.php on line 354

Was kann man dagegen tun?
Vielen Dank!
M
F
G
Sopur

Remove this line in guestbook.php
Code:

Code:
Code: [Select]
"smiles_text" => get_smiles_text(),

Offline Sopur

  • Jr. Member
  • **
  • Posts: 54
    • View Profile
    • Bilder des Harassenlaufs in Basel
Re: [MOD] guestbook
« Reply #13 on: April 28, 2005, 03:47:48 PM »
Thank you! It worked. But you have to remove the line twice :-)
Regards
Sopur

Offline Sopur

  • Jr. Member
  • **
  • Posts: 54
    • View Profile
    • Bilder des Harassenlaufs in Basel
Re: [MOD] guestbook
« Reply #14 on: April 29, 2005, 05:00:39 PM »
So, das Gästebuch läuft einwandfrei. Nun habe ich erst jetzt nach ein paar Einträgen gemerkt, dass der Benutzer seine EMail gar nicht angeben kann. Gibt es eine Möglichkeit dies noch einzubauen?
M
F
G
Sopur