Author Topic: [Mod] Shoutbox II  (Read 50055 times)

0 Members and 1 Guest are viewing this topic.

Rembrandt

  • Guest
[Mod] Shoutbox II
« on: May 23, 2012, 05:56:52 PM »
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...

Demo

1.) 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:
Code: [Select]
.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:
Code: [Select]
                 {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;">&nbsp;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:
Code: [Select]
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
 
« Last Edit: June 01, 2012, 06:59:03 PM by Rembrandt »

Offline Jan-Lukas

  • Addicted member
  • ******
  • Posts: 1.289
    • View Profile
    • Discover the New World of Kindersurprise
Re: [Mod] Shoutbox II
« Reply #1 on: May 24, 2012, 09:40:42 PM »
Wer möchte das der Eintrag unter dem Namen beginnt, ändert es wie folgt

öffne
shoutbox_bit.html

suche
Code: [Select]
<span {class_shoutbox_edit} style="vertical-align:middle" id="{shoutbox_id}">{shoutbox_text}</span>
ändere es in
Code: [Select]
<span {class_shoutbox_edit} style="vertical-align:middle" id="{shoutbox_id}"><br>{shoutbox_text}</span>
ansonsten sieht der Text nicht schön aus, weil die Begrenzung von z.B 50 Zeichen, dahinter anfängt, die neue Zeile aber kürzer ist.

LG


Edit:
Warum funzt die Gegrenzung bei dem Test nicht, dabei wird das Feld auf die ganze Seite ausgedehnt??

Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet. Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet.

Edit2:
Ich habe es im footer eingebaut, wird aber nur auf der Startseite angezeigt, wo mus was rein, damit es überall angezeigt wird ;)

Danke
Danke Harald




Rembrandt

  • Guest
Re: [Mod] Shoutbox II
« Reply #2 on: May 25, 2012, 07:50:04 AM »
Hi!
...Warum funzt die Gegrenzung bei dem Test nicht, dabei wird das Feld auf die ganze Seite ausgedehnt??
Die "Begrenzung" ist für lange Wörter gedacht, den die würden die Tabelle aufspannen, nicht für lange Texte.
Ein langer Text wird am Zeilenende umgebrochen, vorrausgesetzt eine  Weitenangabe ist in der Tabelle vorhanden.
 class="shoutboxwidth" ist in der style.css definiert, und in step 9.) angegeben.
du kannst das gerne hier oder hier ausprobieren.

versuch, ersetze in der  shoutbox_bit.html:
Code: [Select]
style="vertical-align:middle"
mit:
Code: [Select]
style="vertical-align:middle;white-space:pre-wrap"

...Edit2:
Ich habe es im footer eingebaut, wird aber nur auf der Startseite angezeigt, wo mus was rein, damit es überall angezeigt wird ;)
...

ich habe eine neue version der shoutbox.php hochgeladen, und step 7.) nicht in die index.php sonder in der includes/page_header über:
if (!empty($additional_urls)) {

mfg Andi
« Last Edit: May 25, 2012, 08:16:10 AM by Rembrandt »

Offline Jan-Lukas

  • Addicted member
  • ******
  • Posts: 1.289
    • View Profile
    • Discover the New World of Kindersurprise
Re: [Mod] Shoutbox II
« Reply #3 on: May 26, 2012, 12:11:10 AM »
vorrausgesetzt eine  Weitenangabe ist in der Tabelle vorhanden.
 class="shoutboxwidth" ist in der style.css definiert, und in step 9.) angegeben.

mfg Andi

OK, jetzt habe auch ich das begriffen, da waren wieder mal Bäume im Wald *klopf,klopf*
Danke Harald




Offline Jan-Lukas

  • Addicted member
  • ******
  • Posts: 1.289
    • View Profile
    • Discover the New World of Kindersurprise
Re: [Mod] Shoutbox II
« Reply #4 on: May 28, 2012, 08:05:16 PM »
und step 7.) nicht in die index.php sonder in der includes/page_header über:
if (!empty($additional_urls)) {

mfg Andi

Noch eine kleine Frage  :wink:
Ich habe rechts ein Menü, liegt im templateordner/incl und wird aufgerufen mit
<?php
 require "{template_url}/incl/menu.php";
 ?>

Nur wird die Shoutbox da leider nicht angezeigt, hast Du da einen Tipp

LG Harald
Danke Harald




Rembrandt

  • Guest
Re: [Mod] Shoutbox II
« Reply #5 on: May 28, 2012, 08:27:03 PM »
...Nur wird die Shoutbox da leider nicht angezeigt, hast Du da einen Tipp
...
Das funktioniert nicht, du kannst step 9.) nur in all deinen main templates unter:

<?php
 
require "{template_url}/incl/menu.php";
 
?>

einfügen.

mfg Andi

Offline Jan-Lukas

  • Addicted member
  • ******
  • Posts: 1.289
    • View Profile
    • Discover the New World of Kindersurprise
Re: [Mod] Shoutbox II
« Reply #6 on: May 28, 2012, 09:06:53 PM »
hatte ich befürchtet, hatte schon mit anderen Sachen Probleme, dann halt auf die harte Tour ;)

Danke dir
Danke Harald




Offline Sunny C.

  • Addicted member
  • ******
  • Posts: 1.805
  • I ♥ 4I
    • View Profile
Re: [Mod] Shoutbox II
« Reply #7 on: May 28, 2012, 09:25:04 PM »
hehe :D

Offline jennylein

  • Pre-Newbie
  • Posts: 7
    • View Profile
Re: [Mod] Shoutbox II
« Reply #8 on: May 30, 2012, 08:08:30 PM »

Hallo,

ich hab vorhin die ShoutboxII Schritt für Schritt eingegeben. Als ich dann ins ACP wollte, kam nur eine weisse Seite. Auf meiner home-Seite wird oben links ein Fehler angezeigt:

DB Error: Bad SQL Query: SELECT setting_name, setting_value FROM 4images_shoutbox_settings
Table 'usr_web680_2.4images_shoutbox_settings' doesn't exist

Ich hab alle Schritte nochmal wiederholt, gleiches Ergebnis. Bin leider noch nicht so fit in der Materie, deswegen leite ich daraus nur, dass etwas fehlt. Weiss aber nicht was und wo. Alle anderen Seiten werden ohne Fehlermeldung angezeigt.

Irgend jemand eine Idee, woran das liegen könnte?

Offline nobby

  • 4images Guru
  • *******
  • Posts: 2.873
    • View Profile
Re: [Mod] Shoutbox II
« Reply #9 on: May 30, 2012, 08:13:23 PM »
Hallo,

ja Du hast wahrscheinlich den Datenbankeintrag nicht geschrieben.

Diese Datei install_shoutbox2.zip gibt es am ende von Rembrandts Mod zum runterladen.

Aufgerufen wird es dann so: www. deineseite .de/install_shoutbox2.php, damit wird der Datenbankeintrag geschrieben.
                                         deineseite, ersetzen mit Dein Domainname

Wenn der Datenbankeintrag ordnungsgemäß geschrieben wurde, kann die install_shoutbox2.php gelöscht werden.

nobby
« Last Edit: May 30, 2012, 09:09:27 PM by nobby »

Offline jennylein

  • Pre-Newbie
  • Posts: 7
    • View Profile
Re: [Mod] Shoutbox II
« Reply #10 on: May 30, 2012, 09:36:51 PM »

Hallo nobby,

vielen Dank für die schnelle Antwort. Du lagst vollkommen richtig! Ich habe Schritt 2 mißverstanden, dachte, ich müsste die install_shoutbox2.php übers ACP aufrufen. Jetzt funktioniert die Shoutbox :-)

Leider ist der Fehler mit dem ACP immer noch da. Ich hatte zwischenzeitlich alle Änderungen rückgängig gemacht, konnte danach aber immer noch nicht auf mein ACP zugreifen. Jetzt, wo die Shoutbox funktioniert und alles ok zu sein scheint, wird mir immer noch eine weisse Seite angezeigt. Vielleicht hast du dafür auch einen guten Tip. Ich hoffe, ich muß 4images nicht komplett neu installieren...

Nebenbei ist mir bei der Shoutbox ein kleiner Makel aufgefallen: jedesmal, wenn ich die home-Seite mit der Shoutbox neu lade, wird mein Eintrag nochmal geschrieben. Also 5 mal refresh = 5 mal gleicher Eintrag hintereinander.

Offline nobby

  • 4images Guru
  • *******
  • Posts: 2.873
    • View Profile
Re: [Mod] Shoutbox II
« Reply #11 on: May 30, 2012, 09:44:34 PM »
Nein, 4images musst Du sicherlich nicht neu installieren  :) das wäre ja doof  :P

Mit Deinem ACP Problem wird dir @rembrandt besser helfen können als ich, der hat das Script schliesslich geschrieben
und ist das besser bewandert als ich es bin.

Habe ein wenig Geduld er wird sich hier melden  :wink:

nobby

Offline Sunny C.

  • Addicted member
  • ******
  • Posts: 1.805
  • I ♥ 4I
    • View Profile
Re: [Mod] Shoutbox II
« Reply #12 on: May 30, 2012, 10:55:12 PM »
Super Mod!
Danke dafür!

Eventuell zwei Anregungen:
- Sound bei ankommende und abgesendeten Shouts
- Anleitung für die Details- Seite, ist ja nur das Include übernehmen

Offline Jan-Lukas

  • Addicted member
  • ******
  • Posts: 1.289
    • View Profile
    • Discover the New World of Kindersurprise
Re: [Mod] Shoutbox II
« Reply #13 on: May 30, 2012, 10:56:56 PM »

Hallo,

ich hab vorhin die ShoutboxII Schritt für Schritt eingegeben. Als ich dann ins ACP wollte, kam nur eine weisse Seite.


Ich tippe auf diesen Bereich

Quote
search in lang/your lang/admin.php "?>" and insert above:

da hast Du bestimmt das "?>" am Ende gelöscht, oder den Code unter diesem Zeichen eingefügt (muss über ?> eingefügt werden)

und das mit dem refresh macht man ja auch nicht, ausser man will einen Counter pushen (solltest das mal auf wichtigen Seiten machen, dann weisst du das man das nicht macht ;) )

und deine Seite fehlt in deinem Profil
Danke Harald




Offline Sunny C.

  • Addicted member
  • ******
  • Posts: 1.805
  • I ♥ 4I
    • View Profile
Re: [Mod] Shoutbox II
« Reply #14 on: May 30, 2012, 11:53:56 PM »
Was ich auch begrüßen würde, wäre eine Umsetzung mit Ajax, so das sich nur die Shoutbox nachlädt. Wenn man Beispielsweise Musik in der Gallery geladen hat und jemand die Shoutbox aktualisiert bzw. man selber etwas schreibt, wird die gesamte Seite aktualisiert.