Hi!
The Mod Shoutbox II has many features:
- Guests can read Comments = enable/disable
- Guests can write Comments = enable/disable
- Members can edit comments = enable/disable
- Members can delete comments = enable/disable
- Enable HTML in Comments = enable/disable
- How many rows are displayed = default 10 rows
- How many of the recent comments are to be stored in the database? = default 100
- "Flood" Protection, time in Seconds before a User re-submit a comment =default 60
and much more...
Demo1.) Copy all files from Attachment in your Galery
2.) Call the file, as Admin, "install_shoutbox2.php" and follow the instructions.
3.) search in includes/constants.php
define('WORDMATCH_TABLE', $table_prefix.'wordmatch');
insert below:
//################## Start Shoutbox II #########
define('SHOUTBOX_TABLE', $table_prefix.'shoutbox');
define('SHOUTBOX_SETTINGS_TABLE', $table_prefix.'shoutbox_settings');
//################## End Shoutbox II ###########
4.) search in includes/functions.php "?>" and insert above:
//################## Start Shoutbox II #########
function shoutbox_setting(){
global $config,$site_db;
$sql = "SELECT setting_name, setting_value
FROM ".SHOUTBOX_SETTINGS_TABLE;
$result = $site_db->query($sql);
while ($row = $site_db->fetch_array($result)) {
$config[$row['setting_name']] = $row['setting_value'];
}
return $config;
}
function show_smiley($text,$flip = 0) {
$search_array = array(
'icon_biggrin' => ':D',
'icon_bad' => ':x',
'icon_cool' => '8)',
'icon_eek' => ':O',
'icon_evil' => ':@',
'icon_lol' => ':-)',
'icon_neutral' => ':|',
'icon_razz' => ':p',
'icon_rolleyes' => ':r',
'icon_rouge' => ':o',
'icon_sad' => ':(',
'icon_smile' => ':)',
'icon_wink' => ';)'
);
if($flip){
$search_array = array_flip($search_array);
$imgsrc_regex = '/<img[^>]+\>/i';
$count = preg_match_all($imgsrc_regex, $text, $result);
}else{
$count = count($search_array);
$array_values = array_values($search_array);
$array_keys = array_keys($search_array);
}
for($i=0;$i<$count;$i++){
if($flip){
$blub = preg_match('/src=(["\'])(.*?)\1/i', $result[0][$i], $match);
$filename = get_file_name($match[2]);
$smiley = array_search($filename, $search_array);
$text = str_replace($result[0][$i],$smiley,$text);
}else{
$text = str_replace($array_values[$i]," <img class=\"smiley_img\" src=\"".TEMPLATE_PATH."/shoutbox_smileys/".$array_keys[$i].".gif\" title=\"$array_values[$i]\"> ",$text);
}
}
return $text;
}
//################## End Shoutbox II ###########
5.) search in admin/index.php:
show_nav_option($lang['nav_comments_edit'], "comments.php?action=modifycomments");
insert below:
//################## Start Shoutbox II #############################
show_nav_header($lang['nav_shoutbox_main']);
show_nav_option($lang['nav_general_settings'], "shoutbox_settings.php?action=modifysettings");
show_nav_option($lang['nav_shoutbox_edit'], "shoutbox_admin.php?action=modifycomments");
//################## End Shoutbox II ###############################
6.) search in lang/your lang/admin.php "?>" and insert above:
(deutsch)
//--------------------------------------------
//-- Shoutbox ----------------------------
//--------------------------------------------
$setting_group["shoutbox"] = "Shoutbox Einstellungen";
$setting['shoutbox_enable'] = "Shoutbox aktivieren:";
$setting['shoutbox_guest_comments_read'] = "Gäste dürfen Kommentare lesen :";
$setting['shoutbox_guest_comments_write'] = "Gäste dürfen Kommentare schreiben :";
$setting['shoutbox_user_edit_comments'] = "User dürfen ihre Kommentare bearbeiten :<br><span class=\"smalltext\">Bei Doppelklick auf den eigenen Kommentar wird die \"Inline Edit\" funktion Aktiviert. (\"Java Script\" muß dazu eingeschaltet sein)";
$setting['shoutbox_user_delete_comments'] = "User dürfen ihre Kommentar löschen :";
$setting['shoutbox_html_comments'] = "HTML in der Shoutbox erlauben :";
$setting['shoutbox_bb_comments'] = "BB Code in der Shoutbox erlauben :";
$setting['shoutbox_admin_quick_edit'] = "Quick Edit auch für ADMIN :<br><span class=\"smalltext\">Bei abgeschalteten \"Quick Edit\" kann die Edit/Delete funktion als ADMIN über das ACP durchgeführt werden.</span>";
$setting['shoutbox_display_rows'] = "Wie viele Zeilen sollen angezeigt werden?";
$setting['shoutbox_stored_rows'] = "Wie viele der letzten Kommentare sollen in der Datenbank gespeichert werden?";
$setting['shoutbox_show_date_time'] = "Zeige Datum und Zeit :<br><span class=\"smalltext\">Bei \"mouseover\" wird als Admin die User IP angezeigt.</span>";
$setting['shoutbox_show_user_profile'] = "User Profil Link :";
$setting['shoutbox_wordwrap_comments'] = "Umbruch von Wörtern :<br><span class=\"smalltext\">Um ein aufspannen der Seite durch lange Wörter zu vermeiden, kann hier die Stelle der Zeichen angegeben werden, an der ein Umbruch erfolgen soll. Der Wert 0 schaltet die Funktion aus.</span>";
$setting['shoutbox_flood_protection'] = "\"Flood\" Protection:<br><span class=\"smalltext\">Zeit in Sekunden die vergehen müßen bis ein User erneut einen Kommentar abgeben kann.</span>";
(english)
//--------------------------------------------
//-- Shoutbox ----------------------------
//--------------------------------------------
$setting_group["shoutbox"] = "Shoutbox Settings";
$setting['shoutbox_enable'] = "Shoutbox Activated:";
$setting['shoutbox_guest_comments_read'] = "Allow guests read comments :";
$setting['shoutbox_guest_comments_write'] = "Allow guests write comments :";
$setting['shoutbox_user_edit_comments'] = "Allow users to edit their own comments :<br><span class=\"smalltext\">Double click to the comment row, activated the inline edit.(\"Java Script\" required)";
$setting['shoutbox_user_delete_comments'] = "Allow users to delete their own comments:";
$setting['shoutbox_html_comments'] = "Allow HTML in the Shoutbox :";
$setting['shoutbox_bb_comments'] = " Allow BB Code in the Shoutbox :";
$setting['shoutbox_admin_quick_edit'] = "Enable \"Quick Edit\" for ADMIN :<br><span class=\"smalltext\">Bei abgeschalteten \"Quick Edit\" kann die Edit/Delete funktion als ADMIN über das ACP durchgeführt werden.</span>";
$setting['shoutbox_display_rows'] = "How many lines are displayed?";
$setting['shoutbox_stored_rows'] = "How many of the recent comments are to be stored in the database?";
$setting['shoutbox_show_date_time'] = "Show date and time :<br><span class=\"smalltext\">ON \"mouseover \" appears as the Admin the User IP.</span>";
$setting['shoutbox_show_user_profile'] = "User Profil Link :";
$setting['shoutbox_wordwrap_comments'] = "Word wrap<br /><span class=\"smalltext\">in order to prevent horizontal scrolling, set a max. number of chars per line. 0 disables word wrapping.</span>";
$setting['shoutbox_flood_protection'] = "\"Flood\" Protection:<br><span class=\"smalltext\">Time in seconds to until a user re-submit a comment.</span>";
6.1) search:
(deutsch)
$lang['nav_comments_edit'] = "Kommentare bearbeiten";
inser below:
//################## Start Shoutbox II #############
$lang['nav_shoutbox_main'] = "Shoutbox";
$lang['nav_shoutbox_edit'] = "Shoutbox bearbeiten";
//################## End Shoutbox II ###############
(english)
$lang['nav_comments_edit'] = "Edit comments";
insert below:
//################## Start Shoutbox II #############
$lang['nav_shoutbox_main'] = "Shoutbox";
$lang['nav_shoutbox_edit'] = "Edit Shoutbox";
//################## End Shoutbox II ###############
7.) search in index.php:
//-----------------------------------------------------
//--- Show Categories ---------------------------------
insert above:
//################## Start Shoutbox II #############
include(ROOT_PATH.'shoutbox.php');
//################## End Shoutbox II #############
8.) in your templates/your template/style.css add to the end:
.smiley {
background-color:transparent;
background-repeat:no-repeat;
border:none;
margin:2px 0 0 0;
padding:0;
width:15px;
}
.smiley_img{
vertical-align:middle;
}
.shoutboxheight{
height: 150px;
overflow:auto;
background-color: #e1e1e1; /* = commentrow1 = background-color: #e1e1e1;*/
}
.shoutboxwidth{
width:400px;
}
.shoutboxbutton {
border:0;
background-color:#cccccc;
color:#0f5475;
font-family: Tahoma,Verdana,Arial,Helvetica,sans-serif;
font-weight:bold;
text-decoration:none;
font-size:11px;
padding:1px 1px;
margin:1px 1px;
height:20;
}
.shoutboxbutton:hover{
background-color:#e8e8e8;
cursor:pointer;
}
.shoutboxbutton:active{
color:#cccccc;
}
.shoutboxinput{
border:0px;
font-family: Tahoma,Verdana,Arial,Helvetica,sans-serif;
color: #0f5475;
font-size: 11px;
width: 220px;
height:20px;
margin:3px 0 0 0;
}
.shoutboxdate{
font-size:9px;
}
9.) insert in templates/your Template/home.html where ever you want, or e.g. search:
{whos_online}
insert above:
{if shoutbox_enable}
{jeditable}
<a name="shoutbox"></a>
{if shoutbox_msg}<b>{shoutbox_msg}</b>{endif shoutbox_msg}
<table class="shoutboxwidth" align="center" valign="top" border="0" cellspacing="0" cellpadding="0">
<tr>
<td class="head1">
<table width="100%" border="0" cellspacing="0" cellpadding="1">
<tr>
<td class="head1" valign="top" style="line-height:18px;"> Shoutbox</td>
</tr>
<tr>
<td>
<div class="shoutboxheight">
<table width="100%" border="0" cellspacing="0" cellpadding="3">
{shoutbox}
</table>
</div>
</td>
</tr>
</table>
</td>
</tr>
<tr>
<td>
{shoutbox_form}
</td>
</tr>
</table>
<br>
{endif shoutbox_enable}
The Shoutbox is currently set to 400px width and 200px height, they can edit it, search in "style.css" (step 7.):
"height: 150px;" and "width:400px;"
For the Input fields search: "width: 230px;"
The "Inline Edit" field can you edit in "shoutbox.php" search:
width : 250,
Do you want no scrollbar search in step 9.) the "<div ...> ... </div>" elements and remove or comment it out, and set in ACP/Shoutbox Setting
"How many lines are displayed?" to e.g. "10"
The Shoutbox Setting, find you in ACP below Comments/Edit Comments.
10.) Do you have problem by editing "German umlauts" (ÄÖÜäöü) search in "shoutbox.php":
$shoutbox_text = show_smiley($shoutbox_text,1);
replace:
$shoutbox_text = utf8_decode(show_smiley($shoutbox_text,1));search:
echo show_smiley($result['shoutbox_text']);
and replace:
echo utf8_encode(show_smiley($result['shoutbox_text']));
Thats all, have fun!
mfg Andi