how translate the guestbook in every language

Everything related to GBook PHP guestbook
Post Reply
oiro
Posts: 3
Joined: Tue Nov 29, 2005 11:10 am

how translate the guestbook in every language

Post by oiro »

Script URL: -------
Version of script: 0
Version of PHP: all
Hosting company: -----------
Have you searched THIS FORUM for your problem: --------
(if not please do before posting)
If so, what terms did you try:

Write your message below:
------------------------------------------------------------
------------------------------------------------------------

like for CCount
viewtopic.php?t=541

3 files settings.php gbook.php language/it.php || language/en.php || language/yourLanguage.php

--------------------------------
settings.php
add this

Code: Select all

//some server use an alias for some file (FirstClass server)
//leaves empty if d'not use
//define ('X_FC_PATH','/supporto/guestBook/');
define ('X_FC_PATH','');

// your traslation file
define ('LANGUAGE_FILE','language/it.php');

--------------------------------
gbook.php
replace with this

Code: Select all

<?php
# PHP guestbook (GBook)
# Version: 1.34
# File last modified: November 16 2005 18:08
# File name: gbook.php
# Written 27th December 2004 by Klemen Stirn (info@phpjunkyard.com)
# http://www.PHPJunkYard.com

##############################################################################
# COPYRIGHT NOTICE                                                           #
# Copyright 2004-2005 PHPJunkYard All Rights Reserved.                       #
#                                                                            #
# This script may be used and modified free of charge by anyone so long as   #
# this copyright notice and the comments above remain intact. By using this  #
# code you agree to indemnify Klemen Stirn from any liability that might     #
# arise from it's use.                                                       #
#                                                                            #
# Selling the code for this program without prior written consent is         #
# expressly forbidden. In other words, please ask first before you try and   #
# make money off this program.                                               #
#                                                                            #
# Obtain permission before redistributing this software over the Internet or #
# in any other medium. In all cases copyright and header must remain intact. #
# This Copyright is in full effect in any country that has International     #
# Trade Agreements with the United States of America or with                 #
# the European Union.                                                        #
##############################################################################

#############################
#     DO NOT EDIT BELOW     #
#############################

error_reporting(E_ALL ^ E_NOTICE);

require_once('settings.php');
require_once LANGUAGE_FILE;

if($settings['system'] == 2) {$settings['newline']="\r\n";}
elseif($settings['system'] == 3) {$settings['newline']="\r";}
else {$settings['newline']="\n";}

$a=$_REQUEST['a'];

/* This should take care of the signup form not caching problem */
if($a!="sign") {printNoCache();}
/* And this will start session which will help prevent multiple submissions */
if($a=="add") {
session_start();
	if (!isset($_SESSION['checked']))
    {
	    $_SESSION['checked']="N";
	    $_SESSION['secnum']=rand(10000,99999);
	    $_SESSION['checksum']=$_SESSION['secnum'].$settings['filter_sum'].date('dmy');
	    session_regenerate_id();
    }
}

printTopHTML();

if (!(empty($a))) {
	if($a=="sign") {
    	printSign();
    } elseif($a=="delete") {
        $num=gbook_isNumber($_REQUEST['num'],INVALID_ID);
        confirmDelete($num);
    } elseif($a=="viewprivate") {
        $num=gbook_isNumber($_REQUEST['num'],INVALID_ID);
		confirmViewPrivate($num);
    } elseif($a=="add") {
        $name=gbook_input($_REQUEST['name'],PLEASE_ENTER_YOUR_NAME);
        $from=gbook_input($_REQUEST['from']);
        $a=check_mail_url(); $email=$a['email']; $url=$a['url'];
        $comments=gbook_input($_REQUEST['comments'],PLEASE_ENTER_YOUR_COMMENTS);
        $isprivate=gbook_input($_REQUEST['private']);

        if ($settings['autosubmit'] == 1)
        {
			if ($_SESSION['checked'] == "N")
	        {
                print_secimg($name,$from,$email,$url,$comments,$isprivate);
	        }
            elseif ($_SESSION['checked'] == "P")
            {
                $_SESSION['checked'] = "N";
                $secnumber=gbook_isNumber($_REQUEST['secnumber']);
	            if(empty($secnumber)) {print_secimg($name,$from,$email,$url,$comments,$isprivate,1);}
	            $secimg=check_secnum($secnumber,$_SESSION['checksum']);
                if (empty($secimg))
                {print_secimg($name,$from,$email,$url,$comments,$isprivate,2);}
            }
            else {problem(INTERNAL_SCRIPT_ERROR_WRONG_SESSION_PARAMETERS);}
        }

    	addEntry($name,$from,$email,$url,$comments,$isprivate);

    } elseif($a=="confirmdelete") {
    	$pass=gbook_input($_REQUEST['pass'],PLEASE_ENTER_YOUR_PASSWORD);
        $num=gbook_isNumber($_REQUEST['num'],INVALID_ID);
    	doDelete($pass,$num);
    } elseif($a=="showprivate") {
    	$pass=gbook_input($_REQUEST['pass'],PLEASE_ENTER_YOUR_PASSWORD);
        $num=gbook_isNumber($_REQUEST['num'],INVALID_ID);
	    showPrivate($pass,$num);
    } else {
    problem(THIS_IS_NOT_A_VALID_ACTION);
    }
}

$page=gbook_isNumber($_REQUEST['page']);
if ($page>0) {
	$start=($page*10)-9;$end=$start+9;
} else {
	$page=1;$start=1;$end=10;
}

$filesize=filesize($settings['logfile']);
$fp = @fopen($settings['logfile'],"rb") or problem("Can't open the log file ($settings[logfile]) for reading! CHMOD this file to 666 (rw-rw-rw)!");
$content=@fread($fp,$filesize);
fclose($fp);
$content = trim(chop($content));
$lines = explode($settings['newline'],$content);

if ($filesize == 0) {$total=0;}
else {
$total = count($lines);
	if ($end > $total) {$end=$total;}
$pages = ceil($total/10);
echo '<p>'.DISPLAYING_PAGE.$page.OF.$pages.' - '.PAGES;
	for ($i=1; $i<=$pages; $i++) {
		if($i == $page) {echo "<b>$i</b>\n";}
        else {echo '<a href="gbook.php?page='.$i.'">'.$i.'</a> ';}
	}
}

echo '</p>
<table border="0" cellspacing="0" cellpadding="2" width="95%" class="entries">';

if ($filesize == 0) {
echo '<tr>
<td>'.NO_ENTRIES_YET.'</td>
</tr>';
}
else {printEntries($lines,$start,$end);}

echo '</table>';

if ($filesize != 0) {
echo '<p>'.PAGES;
	for ($i=1; $i<=$pages; $i++) {
		if($i == $page) {echo "<b>$i</b>\n";}
        else {echo '<a href="gbook.php?page='.$i.'">'.$i.'</a> ';}
	}
}

printCopyHTML();
printDownHTML();
exit();


// >>> START FUNCTIONS <<< //

function check_secnum($secnumber,$checksum) {
global $settings;
$secnumber.=$settings['filter_sum'].date('dmy');
    if ($secnumber == $checksum)
        {
        unset($_SESSION['checked']);
        return true;
        }
    else
    {
        return false;
    }
} // END check_secnum


function print_secimg($name,$from,$email,$url,$comments,$isprivate,$message=0) {
$_SESSION['checked']="P";
?>
<h3 align="center"><?php echo ANTI_SPAM_CHECK; ?></h3>
</p>
<form action="gbook.php?<?php echo strip_tags (SID)?>" method="POST" name="form"><input type="hidden" name="a" value="add">
<table class="entries" cellspacing="0" cellpadding="4" border="0">
<tr>
<td>

<p>&nbsp;</p>
<?php
if ($message == 1) {echo '<p align="center"><b>'.PLEASE_TYPE_IN_THE_SECURITY_NUMBER.'</b></p>';}
elseif ($message == 2) {echo '<p align="center"><b>'.WRONG_SECURITY_NUMBER_PLEASE_TRY_AGAIN.'</b></p>';}
?>
<p>&nbsp;</p>
<p><?php echo THIS_IS_A_SECURITY_CHECK_THAT_PREVENTS_AUTOMATED_SIGNUPS; ?></p>
<p>&nbsp;</p>
<p><?php echo SECURITY_NUMBER; ?><b><?php echo $_SESSION['secnum']; ?></b><br>
<?php echo PLEASE_TYPE_IN_THE_SECURITY_NUMBER_DISPLAYED_ABOVE; ?>
<input type="text" size="7" name="secnumber" maxlength="5" id="input"></p>
<p>&nbsp;
<input type="hidden" name="name" value="<?php echo $name; ?>">
<input type="hidden" name="from" value="<?php echo $from; ?>">
<input type="hidden" name="email" value="<?php echo $email; ?>">
<input type="hidden" name="url" value="<?php echo $url; ?>">
<input type="hidden" name="comments" value="<?php echo $comments; ?>">
<input type="hidden" name="private" value="<?php echo $isprivate; ?>">
<input type="hidden" name="nosmileys" value="<?php echo $_REQUEST['nosmileys']; ?>">
</p>
<p align="center"><input type="submit" value=" <?php echo CONTINUE_; ?> "></p>
<p>&nbsp;</p>
<p>&nbsp;</p>
</td>
</tr>
</table>
</form>

<?php
printCopyHTML();
printDownHTML();
exit();
} // END print_secimg



function filter_bad_words($text) {
global $settings;
$file = 'badwords/'.$settings['filter_lang'].'.php';

	if (file_exists($file))
    {
    	include_once($file);
    }
    else
    {
    	problem("The bad words file ($file) can't be found! Please check the
        name of the file. On most servers names are CaSe SeNsiTiVe!");
    }

	foreach ($settings['badwords'] as $k => $v)
    {
    	$text = preg_replace("/$k/i",$v,$text);
    }

return $text;
} // END filter_bad_words

function showPrivate($pass,$num) {
global $settings;
if ($pass != $settings[apass]) {problem(WRONG_PASSWORD_ONLY_THE_GUESTBOOK_OWNER_MAY_READ_THIS_POST,"1");}

$delimiter="\t";
$lines = file($settings['logfile']);

list($name,$from,$email,$url,$comment,$added,$isprivate)=explode($delimiter,$lines[$num]);
echo '
<table border="0" cellspacing="0" cellpadding="2" width="95%" class="entries">
<tr>
<td class="upper" width="35%"><b>'.SUBMITTED_BY.'</b></td>
<td class="upper" width="65%"><b>'.COMMENTS.'</b></td>
</tr>
<tr>
<td valign="top" width="35%"><b>'.$name.'</b><br>';
if (strlen($from)>0) {
echo '<font class="smaller">'.FROM.$from.'</font><br>';
}
if (strlen($url)>0) {
echo '<font class="smaller">'.WEBSITE.'</font> 
<a href="go.php?url='.$url.'" target="_blank" class="smaller">'.$url.'</a><br>';
}
if (strlen($email)>0) {
echo '<font class="smaller">'.E_MAIL.'</font> <a href="mailto:'.$email.'" target="_blank" class="smaller">'.$email.'</a>';
}
echo '</td>
<td valign="top" width="65%">'.$comment.'
<hr>
<font class="smaller">'.ADDED.$added.' &nbsp;&nbsp;&nbsp;&nbsp;
<a href="gbook.php?a=delete&num='.$num.'"><img src="'.X_FC_PATH.'images/delete.gif" width="16" height="14" border="0" alt="'.DELETE_THIS_ENTRY.'" title="'.DELETE_THIS_ENTRY.'" align="right" valign="top"></a></font>
</td>
</tr>
</table>
<p align="center"><a href="gbook.php">'.BACK_TO_GUESTBOOK.'</a></p>
';

printCopyHTML();
printDownHTML();
exit();
} // END showPrivate

function confirmViewPrivate($num) {
?>
<p>&nbsp;</p>
<p>&nbsp;</p>
<form action="gbook.php" method="POST"><input type="hidden" name="a" value="showprivate">
<input type="hidden" name="num" value="<?php echo($num); ?>">
<p><b><?php echo THIS_IS_A_PRIVATE_POST_FOR_THE_OWNER_OF_THIS_QUESTBOOK; ?></b></p>
<p><?php echo PLEASE_ENTER_YOUR_ADMINISTRATION_PASSWORD; ?><br>
<input type="password" name="pass" size="20"></p>
<p><input type="submit" value="<?php echo VIEW_THIS_ENTRY; ?>"> | <a href="Javascript:history.go(-1)"><?php echo BACK; ?></a></p>
</form>
<p>&nbsp;</p>
<p>&nbsp;</p>
<?php
printCopyHTML();
printDownHTML();
exit();
} // END confirmViewPrivate

function processsmileys($text) {
$text = str_replace(':)','<img src="'.X_FC_PATH.'images/icon_smile.gif" border="0" alt="">',$text);
$text = str_replace(':(','<img src="'.X_FC_PATH.'images/icon_frown.gif" border="0" alt="">',$text);
$text = str_replace(':D','<img src="'.X_FC_PATH.'images/icon_biggrin.gif" border="0" alt="">',$text);
$text = str_replace(';)','<img src="'.X_FC_PATH.'images/icon_wink.gif" border="0" alt="">',$text);
$text = preg_replace("/\:o/i",'<img src="'.X_FC_PATH.'images/icon_redface.gif" border="0" alt="">',$text);
$text = preg_replace("/\:p/i",'<img src="'.X_FC_PATH.'images/icon_razz.gif" border="0" alt="">',$text);
$text = str_replace(':cool:','<img src="'.X_FC_PATH.'images/icon_cool.gif" border="0" alt="">',$text);
$text = str_replace(':rolleyes:','<img src="'.X_FC_PATH.'images/icon_rolleyes.gif" border="0" alt="">',$text);
$text = str_replace(':mad:','<img src="'.X_FC_PATH.'images/icon_mad.gif" border="0" alt="">',$text);
$text = str_replace(':eek:','<img src="'.X_FC_PATH.'images/icon_eek.gif" border="0" alt="">',$text);
$text = str_replace(':clap:','<img src="'.X_FC_PATH.'images/yelclap.gif" border="0" alt="">',$text);
$text = str_replace(':bonk:','<img src="'.X_FC_PATH.'images/bonk.gif" border="0" alt="">',$text);
$text = str_replace(':chased:','<img src="'.X_FC_PATH.'images/chased.gif" border="0" alt="">',$text);
$text = str_replace(':crazy:','<img src="'.X_FC_PATH.'images/crazy.gif" border="0" alt="">',$text);
$text = str_replace(':cry:','<img src="'.X_FC_PATH.'images/cry.gif" border="0" alt="">',$text);
$text = str_replace(':curse:','<img src="'.X_FC_PATH.'images/curse.gif" border="0" alt="">',$text);
$text = str_replace(':err:','<img src="'.X_FC_PATH.'images/errr.gif" border="0" alt="">',$text);
$text = str_replace(':livid:','<img src="'.X_FC_PATH.'images/livid.gif" border="0" alt="">',$text);
$text = str_replace(':rotflol:','<img src="'.X_FC_PATH.'images/rotflol.gif" border="0" alt="">',$text);
$text = str_replace(':love:','<img src="'.X_FC_PATH.'images/love.gif" border="0" alt="">',$text);
$text = str_replace(':nerd:','<img src="'.X_FC_PATH.'images/nerd.gif" border="0" alt="">',$text);
$text = str_replace(':nono:','<img src="'.X_FC_PATH.'images/nono.gif" border="0" alt="">',$text);
$text = str_replace(':smash:','<img src="'.X_FC_PATH.'images/smash.gif" border="0" alt="">',$text);
$text = str_replace(':thumbsup:','<img src="'.X_FC_PATH.'images/thumbup.gif" border="0" alt="">',$text);
$text = str_replace(':toast:','<img src="'.X_FC_PATH.'images/toast.gif" border="0" alt="">',$text);
$text = str_replace(':welcome:','<img src="'.X_FC_PATH.'images/welcome.gif" border="0" alt="">',$text);
$text = str_replace(':ylsuper:','<img src="'.X_FC_PATH.'images/ylsuper.gif" border="0" alt="">',$text);
return $text;
} // END processsmileys

function doDelete($pass,$num) {
global $settings;
if ($pass != $settings[apass]) {problem(WRONG_PASSWORD_THE_ENTRY_HASNT_BEEN_DELETED,"1");}

$filesize=filesize($settings['logfile']);
$fp = @fopen($settings['logfile'],"rb") or problem("Can't open the log file ($settings[logfile]) for reading! CHMOD this file to 666 (rw-rw-rw)!");
$content=@fread($fp,$filesize);
fclose($fp);
$content = trim(chop($content));
$lines = explode($settings['newline'],$content);
unset($lines[$num]);
$fp = fopen($settings['logfile'],"wb") or problem("Couldn't open links file ($settings[logfile]) for writing! Please CHMOD all $settings[logfile] to 666 (rw-rw-rw)!");
foreach ($lines as $thisline) {
$thisline .= $settings['newline'];
fputs($fp,$thisline);
}
fclose($fp);

?>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p><b><?php echo SELECTED_ENTRY_WAS_SUCCESSFULLY_REMOVED; ?></b></p>
<p><a href="gbook.php?page=1"><?php echo CLICK_HERE_TO_CONTINUE; ?></a></p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<?php
printCopyHTML();
printDownHTML();
exit();
} // END doDelete

function confirmDelete($num) {
?>
<p>&nbsp;</p>
<p>&nbsp;</p>
<form action="gbook.php" method="POST"><input type="hidden" name="a" value="confirmdelete">
<input type="hidden" name="num" value="<?php echo($num); ?>">
<p><b><?php echo PLEASE_ENTER_YOUR_ADMINISTRATION_PASSWORD; ?></b><br>
<input type="password" name="pass" size="20"></p>
<p><b><?php echo ARE_YOU_SURE_YOU_WANT_TO_DELETE_THIS_ENTRY; ?></b></p>
<p><input type="submit" value="<?php echo YES_DELETE_THIS_ENTRY; ?>"> | <a href="gbook.php"><?php echo NO_I_CHANGED_MY_MIND; ?></a></p>
</form>
<p>&nbsp;</p>
<p>&nbsp;</p>
<?php
printCopyHTML();
printDownHTML();
exit();
} // END confirmDelete


function check_mail_url()
{
$v = array('email' => '','url' => '');
$char = array('.','@');
$repl = array(".","@");

$v['email']=htmlspecialchars("$_REQUEST[email]");
if (strlen($v['email']) > 0 && !(preg_match("/([\w\-]+\@[\w\-]+\.[\w\-]+)/",$v['email']))) {problem(PLEASE_ENTER_A_VALID_EMAIL_ADDRESS,"1");}
$v['email']=str_replace($char,$repl,$v['email']);

$v['url']=htmlspecialchars("$_REQUEST[url]");
if ($v['url'] == "http://" || $v['url'] == "https://") {$v['url'] = "";}
elseif (strlen($v['url']) > 0 && !(preg_match("/(http(s)?:\/\/+[\w\-]+\.[\w\-]+)/i",$v['url']))) {problem(THE_SITE_URL_IS_NOT_VALID,"1");}

return $v;
} // END check_mail_url


function addEntry($name,$from,$email,$url,$comments,$isprivate="0") {
global $settings;

	/* This part will help prevent multiple submissions */
    if ($settings['one_per_session'] && $_SESSION['add'])
    {
        problem("You may only submit this guestbook once per session!");
    }

$delimiter="\t";
//$added=date ("F j, Y");
//$added=date ("l j F Y");
$added=date ("d - m - Y");

$comments_nosmileys=$comments;
$comments = str_replace("\r\n","<br>",$comments);
$comments = str_replace("\n","<br>",$comments);
$comments = str_replace("\r","<br>",$comments);
$comments = wordwrap($comments,$settings['max_word'],'<br>',1);
if ($settings['smileys'] == 1 && $_REQUEST['nosmileys'] != "Y") {$comments = processsmileys($comments);}

if ($settings['filter']) {
$comments = filter_bad_words($comments);
$name = filter_bad_words($name);
$from = filter_bad_words($from);
}

$addline = "$name$delimiter$from$delimiter$email$delimiter$url$delimiter$comments$delimiter$added$delimiter$isprivate$settings[newline]";

$fp = @fopen($settings['logfile'],"rb") or problem("Can't open the log file ($settings[logfile]) for reading! CHMOD this file to 666 (rw-rw-rw)!");
$links = @fread($fp,filesize($settings['logfile']));
fclose($fp);
$addline .= $links;
$fp = fopen($settings['logfile'],"wb") or problem("Couldn't open links file ($settings[logfile]) for writing! Please CHMOD all $settings[logfile] to 666 (rw-rw-rw)!");
fputs($fp,$addline);
fclose($fp);

if ($settings['notify'] == 1)
	{
    $char = array('.','@');
	$repl = array(".","@");
    $email=str_replace($repl,$char,$email);
    $message = "Hello!

Someone has just signed your guestbook!

Name: $name
From: $from
E-mail: $email
Website: $url

Message (without smileys):
$comments_nosmileys


Visit the below URL to view your guestbook:
$settings[gbook_url]

End of message
";

    mail("$settings[admin_email]","Someone has just signed your guestbook",$message);
    }

/* Register this session variable */
$_SESSION['add']=1;

?>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p><b><?php echo YOUR_MESSAGE_WAS_SUCCESSFULLY_ADDED; ?></b></p>
<p><a href="gbook.php?page=1"><?php echo CLICK_HERE_TO_CONTINUE; ?></a></p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<?php
printCopyHTML();
printDownHTML();
exit();
} // END addEntry

function printSign() {
global $settings;
?>
<h3 align="center"><?php echo SIGN_GUESTBOOK; ?></h3>
<p><?php echo REQUIRED_FIELDS_ARE_BOLD; ?>
<script language="Javascript" type="text/javascript"><!--
function openSmiley() {
w=window.open("<?php echo X_FC_PATH; ?>smileys.htm", "smileys", "fullscreen=no,toolbar=no,status=no,menubar=no,scrollbars=yes,resizable=yes,directories=no,location=no,width=300,height=300");
  if(!w.opener)
  {
  w.opener=self;
  }
}
//-->
</script>
</p>
<form action="gbook.php" method="POST" name="form"><input type="hidden" name="a" value="add">
<table class="entries" cellspacing="0" cellpadding="4" border="0">
<tr>
<td>

<table cellspacing="0" cellpadding="3" border="0">
<tr>
<td><b><?php echo YOUR_NAME; ?></b></td>
<td><input type="text" name="name" size="30" maxlength="30"></td>
</tr>
<tr>
<td><?php echo WHERE_ARE_YOU_FROM; ?></td>
<td><input type="text" name="from" size="30" maxlength="30"></td>
</tr>
<tr>
<td><?php echo YOUR_E_MAIL; ?></td>
<td><input type="text" name="email" size="30" maxlength="50"></td>
</tr>
<tr>
<td><?php echo YOUR_WEBSITE; ?></td>
<td><input type="text" name="url" value="http://" size="40" maxlength="80"></td>
</tr>
</table>
<p align="center"><b><?php echo COMMENTS; ?></b><br>
<textarea name="comments" rows="9" cols="50"></textarea><?php
if ($settings['smileys'] == 1) {
echo '<br><a href="javascript:openSmiley()">'.INSERT_SMILEYS.'</a> '.OPENS_A_NEW_WINDOW.'<br>
<input type="checkbox" name="nosmileys" value="Y"> '.DISABLE_SMILEYS;
}
?></p>
<p align="center"><input type="checkbox" name="private" value="Y"><?php echo MAKE_THIS_POST_PRIVATE; ?></p>
<p align="center"><input type="submit" value=" <?php echo ADD_MY_COMMENTS; ?> "></p>
</td>
</tr>
</table>
</form>
<?php
printCopyHTML();
printDownHTML();
exit();
} // END printSign


function printEntries($lines,$start,$end) {
$start=$start-1;
$end=$end-1;
$delimiter="\t";
for ($i=$start;$i<=$end;$i++) {
list($name,$from,$email,$url,$comment,$added,$isprivate)=explode($delimiter,$lines[$i]);
echo '
<tr>
<td class="upper" width="35%"><b>'.SUBMITTED_BY.'</b></td>
<td class="upper" width="65%"><b>'.COMMENTS.'</b></td>
</tr>
<tr>
<td valign="top" width="35%"><b>'.$name.'</b><br>';
if (strlen($from)>0) {
echo '<font class="smaller">'.FROM.$from.'</font><br>';
}
if (strlen($url)>0) {
echo '<font class="smaller">Website:</font> <a href="go.php?url='.$url.'" target="_blank" class="smaller">'.$url.'</a><br>';
}

if (strlen($email)>0) {
echo '<font class="smaller">'.E_MAIL.'</font><a href="mailto:'.$email.'" target="_blank" class="smaller">'.$email.'</a>';
}
echo '</td>
<td valign="top" width="65%">';

	if (empty($isprivate)) {echo $comment;}
    else {
    	echo '<p>&nbsp;</p>
    	<p><i><a href="gbook.php?a=viewprivate&num='.$i.'">'.PRIVATE_POST_CLICK_TO_VIEW.'</a></i></p>';
    }

echo '<hr>
<font class="smaller">'.ADDED.$added.' &nbsp;&nbsp;&nbsp;&nbsp;
<a href="gbook.php?a=delete&num='.$i.'"><img src="'.X_FC_PATH.'images/delete.gif" width="16" height="14" border="0" alt="'.DELETE_THIS_ENTRY.'" title="'.DELETE_THIS_ENTRY.'" align="right" valign="top"></a></font>
</td>
</tr>
';
}
} // END printEntries


function problem($myproblem,$backlink="1") {
$html = '<p>&nbsp;</p>
<p>&nbsp;</p>
<p align="center"><b>'.ERROR.'</b></p>
<p align="center">'.$myproblem.'</p>
<p>&nbsp;</p>
';
	if ($backlink) {
		$html .= '<p align="center"><a href="Javascript:history.go(-1)">'.BACK_TO_THE_PREVIOUS_PAGE.'</a></p>';
	}

$html .= '<p>&nbsp;</p> <p>&nbsp;</p>';

echo $html;

printCopyHTML();
printDownHTML();
exit();
} // END problem


function printNoCache() {
header("Expires: Mon, 26 Jul 2000 05:00:00 GMT");
header("Cache-Control: no-store, no-cache, must-revalidate");
header("Cache-Control: post-check=0, pre-check=0", false);
header("Pragma: no-cache");
} // END printNoCache


function printTopHTML() {
global $settings;
echo '<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
<title>'.$settings['gbook_title'].'</title>
<meta content="text/html; charset=windows-1250">
<link href="'.X_FC_PATH.'style.css" type="text/css" rel="stylesheet">
</head>
<body">
';
include_once 'header.txt';
echo '<h3 align="center">'.$settings['gbook_title'].'</h3>
<p align="center"><a href="'.$settings['website_url'].'">'.BACK_TO.$settings['website_title'].'</a>
| <a href="gbook.php">'.VIEW_GUESTBOOK.'</a>
| <a href="gbook.php?a=sign">'.SIGN_GUESTBOOK.'</a></p>
<div align="center">
<center>
';
} // END printTopHTML


function printDownHTML() {
global $settings;
echo '</center>
</div>';
include_once 'footer.txt';
echo '</body>
</html>';
}  // END printDownHTML


function printCopyHTML() {
global $settings;
echo rawurldecode('%3Chr%20width%3D%2295%25%22%3E%0D%0A%3C%21--%0D%0AChanging%20the%20%22Powered%20by%22%20credit%20sentence%20without%20purchasing%20a%20licence%20is%20illegal%21%0D%0APlease%20visit%20http%3A%2F%2Fwww.phpjunkyard.com%2Fcopyright-removal.php%20for%20more%20information.%0D%0A--%3E%0D%0A%3Cp%20align%3D%22center%22%3E%3Cfont%20class%3D%22smaller%22%3EPowered%20by%20%3Ca%20href%3D%22http%3A%2F%2Fwww.phpjunkyard.com%2Fphp-guestbook-script.php%22%20class%3D%22smaller%22%20target%3D%22_blank%22%3EPHP%20guestbook%3C%2Fa%3E%20').$settings['verzija'].rawurldecode('%20from%0D%0A%3Ca%20href%3D%22http%3A%2F%2Fwww.phpjunkyard.com%2F%22%20target%3D%22_blank%22%20class%3D%22smaller%22%3EPHPJunkyard%20-%20Free%20PHP%20scripts%3C%2Fa%3E%3C%2Ffont%3E%3C%2Fp%3E');
} // END printCopyHTML

function gbook_input($in,$error=0) {
	$in = trim($in);
    if (strlen($in))
    {
        $in = htmlspecialchars($in);
    }
    elseif ($error)
    {
    	problem($error);
    }
    return stripslashes($in);
} // END gbook_input()

function gbook_isNumber($in,$error=0) {
	$in = trim($in);
	if (preg_match("/\D/",$in) || $in=="")
    {
    	if ($error)
        {
        	problem($error);
        }
        else
        {
        	return '0';
        }
    }
    return $in;
} // END gbook_isNumber()
?>

----------------------------------------
make a folder -language- and put within your tlaslation
language/en.php

Code: Select all

<?php
define ('BACK_TO_GUESTBOOK','Back to Guestbook.');
define ('BACK_TO_THE_PREVIOUS_PAGE','Back to the previous page');
define ('BACK_TO','Back to');
define ('VIEW_GUESTBOOK','View guestbook');
define ('SIGN_GUESTBOOK','Sign guestbook');
define ('DISPLAYING_PAGE','Displaying page ');
define ('OF',' of ');
define ('PAGES',' Pages: ');
define ('FROM','From:');
define ('WEBSITE','Website: ');
define ('E_MAIL','E@mail: ');
define ('ADDED','Added: ');
define ('DELETE_THIS_ENTRY','Delete this entry');
define ('REQUIRED_FIELDS_ARE_BOLD','Required fields are <b>bold</b>');
define ('YOUR_NAME','Your name:');
define ('WHERE_ARE_YOU_FROM','Where are you from?');
define ('YOUR_E_MAIL','Your e-mail:');
define ('YOUR_WEBSITE','Your website:');
define ('INSERT_SMILEYS','Insert smileys');
define ('OPENS_A_NEW_WINDOW','(Opens a new window)');
define ('DISABLE_SMILEYS','Disable smileys');
define ('MAKE_THIS_POST_PRIVATE','Make this post private');
define ('ADD_MY_COMMENTS','Add my comments');
define ('ANTI_SPAM_CHECK','Anti-SPAM check');
define ('PLEASE_TYPE_IN_THE_SECURITY_NUMBER','Please type in the security number');
define ('WRONG_SECURITY_NUMBER_PLEASE_TRY_AGAIN','Wrong security number. Please try again');
define ('THIS_IS_A_SECURITY_CHECK_THAT_PREVENTS_AUTOMATED_SIGNUPS','This is a security check that prevents automated signups of this guestbook (SPAM).Please enter the security number displayed below into the input field and click the continue button.');
define ('SECURITY_NUMBER','Security number: ');
define ('PLEASE_TYPE_IN_THE_SECURITY_NUMBER_DISPLAYED_ABOVE','Please type in the security number displayed above: ');
define ('CONTINUE_','Continue');
define ('YOUR_MESSAGE_WAS_SUCCESSFULLY_ADDED','Your message was successfully added!');
define ('CLICK_HERE_TO_CONTINUE','Click here to continue');
define ('PRIVATE_POST_CLICK_TO_VIEW','Private post. Click to view.');
define ('THIS_IS_A_PRIVATE_POST_FOR_THE_OWNER_OF_THIS_QUESTBOOK','This is a private post for the owner of this questbook.');
define ('PLEASE_ENTER_YOUR_ADMINISTRATION_PASSWORD','Please enter your administration password:');
define ('VIEW_THIS_ENTRY','View this entry');
define ('BACK','Back');
define ('ARE_YOU_SURE_YOU_WANT_TO_DELETE_THIS_ENTRY','Are you sure you want to delete this entry? This action cannot be undone!');
define ('YES_DELETE_THIS_ENTRY','YES, delete this entry');
define ('NO_I_CHANGED_MY_MIND','NO, I changed my mind');
define ('PLEASE_ENTER_YOUR_PASSWORD','Please enter your password');
define ('THIS_IS_NOT_A_VALID_ACTION','This is not a valid action!');
define ('INVALID_ID','Invalid ID');
define ('INTERNAL_SCRIPT_ERROR_WRONG_SESSION_PARAMETERS','Internal script error. Wrong session parameters!');
define ('SELECTED_ENTRY_WAS_SUCCESSFULLY_REMOVED','Selected entry was successfully removed!');
define ('WRONG_PASSWORD_THE_ENTRY_HASNT_BEEN_DELETED','Wrong password! The entry hasn\'t been deleted.');
define ('WRONG_PASSWORD_ONLY_THE_GUESTBOOK_OWNER_MAY_READ_THIS_POST','Wrong password! Only the guestbook owner may read this post!');
define ('ERROR','ERROR');
define ('PLEASE_ENTER_YOUR_NAME','Please enter your name');
define ('PLEASE_ENTER_YOUR_COMMENTS','Please enter your comments');
define ('SUBMITTED_BY','Submitted by');
define ('COMMENTS','Comments:');
define ('PLEASE_ENTER_A_VALID_EMAIL_ADDRESS','Please enter a valid e-mail address!');
define ('THE_SITE_URL_IS_NOT_VALID','The site URL is not valid, make sure you start it with http:// or https://!');
define ('NO_ENTRIES_YET','<br>No entries yet!<br><br>');
?>

--------------------------------------------
my traslation in italiano
language/it.php

Code: Select all


<?php
define ('BACK_TO_GUESTBOOK','Ritorna al libro degli ospiti<br><br>');
define ('BACK_TO_THE_PREVIOUS_PAGE','Ritorna alla pagina precedente');
define ('BACK_TO','Ritorna a... ');
define ('VIEW_GUESTBOOK','Visualizza i messaggi');
define ('SIGN_GUESTBOOK','Inserisci il tuo messaggio');
define ('DISPLAYING_PAGE','Visualizzazione della pagina ');
define ('OF',' di... ');
define ('PAGES',' Pagine: ');
define ('FROM','Provenienza: ');
define ('WEBSITE','Sito WEB: ');
define ('E_MAIL','E@mail: ');
define ('ADDED','Messaggio inserito in data: ');
define ('DELETE_THIS_ENTRY','Elimina questo messaggio');
define ('REQUIRED_FIELDS_ARE_BOLD','In <b>grassetto</b> i campi obbligatori');
define ('YOUR_NAME','Il tuo nome:');
define ('WHERE_ARE_YOU_FROM','Da dove vieni ?');
define ('YOUR_E_MAIL','La tua E@mail:');
define ('YOUR_WEBSITE','Il tuo sito WEB:');
define ('INSERT_SMILEYS','Inserisci le icone simpatiche');
define ('OPENS_A_NEW_WINDOW','(Apertura di una nuova finestra)');
define ('DISABLE_SMILEYS','Disabilita le icone simpatiche');
define ('MAKE_THIS_POST_PRIVATE','Questo e\' un messaggio privato');
define ('ADD_MY_COMMENTS','Inserisci il messaggio');
define ('ANTI_SPAM_CHECK','Controllo Anti-SPAM');
define ('PLEASE_TYPE_IN_THE_SECURITY_NUMBER','Inserisci il Numero di Sicurezza... ');
define ('WRONG_SECURITY_NUMBER_PLEASE_TRY_AGAIN','Numero di Sicurezza non valido. Riprova...');
define ('THIS_IS_A_SECURITY_CHECK_THAT_PREVENTS_AUTOMATED_SIGNUPS','Questo e\' un controllo per prevenire l\'inserimento di messaggi in modo automatico da parte di SPAMMERS e-o robots.<br>Inserisci il Numero visualizzato qui sotto nel campo di testo, e clicca sul bottone "Continua" ...');
define ('SECURITY_NUMBER','Numero di Sicurezza:  ');
define ('PLEASE_TYPE_IN_THE_SECURITY_NUMBER_DISPLAYED_ABOVE','Inserisci il Numero di Sicurezza visualizzato sopra:  ');
define ('CONTINUE_','Continua');
define ('YOUR_MESSAGE_WAS_SUCCESSFULLY_ADDED','Il tuo messaggio e\' stato aggiunto!');
define ('CLICK_HERE_TO_CONTINUE','Clicca qui per continuare');
define ('PRIVATE_POST_CLICK_TO_VIEW','Messaggio Privato. Clicca per visualizzarlo...');
define ('THIS_IS_A_PRIVATE_POST_FOR_THE_OWNER_OF_THIS_QUESTBOOK','Questo e\' un messaggio privato per il gestore del libro degli ospiti.');
define ('PLEASE_ENTER_YOUR_ADMINISTRATION_PASSWORD','Inserisci la password: ');
define ('VIEW_THIS_ENTRY','Visualizza questo messaggio...');
define ('BACK','Indietro...');
define ('ARE_YOU_SURE_YOU_WANT_TO_DELETE_THIS_ENTRY','Sei sicuro di voler eliminare questo messaggo??  Questa azione non puo\' essere annullata!');
define ('YES_DELETE_THIS_ENTRY','SI, elimina questo messaggio!');
define ('NO_I_CHANGED_MY_MIND','NO, Ho cambiato idea');
define ('PLEASE_ENTER_YOUR_PASSWORD','Inserisci la password...');
define ('THIS_IS_NOT_A_VALID_ACTION','Questa non e\' un\'azione valida!');
define ('INVALID_ID','Invalid ID...');
define ('INTERNAL_SCRIPT_ERROR_WRONG_SESSION_PARAMETERS','Errore interno. Parametri di sessione non corretti!');
define ('SELECTED_ENTRY_WAS_SUCCESSFULLY_REMOVED','Il messaggio selezionato e\' stato eliminato!');
define ('WRONG_PASSWORD_THE_ENTRY_HASNT_BEEN_DELETED','Password non corretta! Il messaggio non e\' stato eliminato.');
define ('WRONG_PASSWORD_ONLY_THE_GUESTBOOK_OWNER_MAY_READ_THIS_POST','Password non corretta! Solo il gestore del libro degli ospiti puo\' leggere questo messaggio!');
define ('ERROR','ERRORE');
define ('PLEASE_ENTER_YOUR_NAME','Inserisci il tuo nome...');
define ('PLEASE_ENTER_YOUR_COMMENTS','Inserisci il testo del tuo messaggio...');
define ('SUBMITTED_BY','Inserito da:');
define ('COMMENTS','Commento:');
define ('PLEASE_ENTER_A_VALID_EMAIL_ADDRESS','Inserisci un\'indirizzo e@mail valido!');
define ('THE_SITE_URL_IS_NOT_VALID','L\'URL del sito WEB non e\' valido. Controlla che inizi con&nbsp;&nbsp;&nbsp;http://&nbsp;&nbsp;&nbsp;oppure&nbsp;&nbsp;&nbsp;https://&nbsp;&nbsp;&nbsp;');
define ('NO_ENTRIES_YET','<br>Il libro degli ospiti e\' vuoto<br><br>');
?>

---------------------------------------------------

ciao
Mario
oiro
Posts: 3
Joined: Tue Nov 29, 2005 11:10 am

how translate the guestbook in every language (email notify)

Post by oiro »

in the language file add this code for traslate the amail notify

Code: Select all

define ('HELLO','Hello!');
define ('SOMEONE_HAS_JUST_SIGNED_YOUR_GUESTBOOK','Someone has just signed your guestbook!');
define ('MESSAGE_WITHOUT_SMILEYS','Message (without smileys):');
define ('VISIT_THE_BELOW_URL_TO_VIEW_YOUR_GUESTBOOK','Visit the below URL to view your guestbook:');
define ('END_OF_MESSAGE','End of message');
define ('NAME','Name:  ');
-----------------------
in the gbook.php find this

Code: Select all

if ($settings['notify'] == 1)
	{
    $char = array('.','@');
	$repl = array(".","@");
    $email=str_replace($repl,$char,$email);
    $message = "Hello!

Someone has just signed your guestbook!

Name: $name
From: $from
E-mail: $email
Website: $url

Message (without smileys):
$comments_nosmileys


Visit the below URL to view your guestbook:
$settings[gbook_url]

End of message
";

    mail("$settings[admin_email]","Someone has just signed your guestbook",$message);
    }

and replace with this

Code: Select all

if ($settings['notify'] == 1)
	{
    $char = array('.','@');
	$repl = array(".","@");
    $email=str_replace($repl,$char,$email);
    $message = "#####################################
#####################################
".HELLO." 
 
".SOMEONE_HAS_JUST_SIGNED_YOUR_GUESTBOOK." 


".NAME.$name." 
".FROM.$from." 
".E_MAIL.$email." 
".WEBSITE.$url." 


".MESSAGE_WITHOUT_SMILEYS." 
".$comments_nosmileys." 


".VISIT_THE_BELOW_URL_TO_VIEW_YOUR_GUESTBOOK." 
".$settings[gbook_url]." 

".END_OF_MESSAGE." 
#####################################
#####################################";

    mail("$settings[admin_email]",SOMEONE_HAS_JUST_SIGNED_YOUR_GUESTBOOK,$message);
    }

ciao
mario
Post Reply