Basilius-Network

Das offizielle Forum zum Basilius-Network und aller Komponenten.
Aktuelle Zeit: Do 9. Sep 2010, 23:32

Alle Zeiten sind UTC + 1 Stunde [ Sommerzeit ]




Ein neues Thema erstellen Auf das Thema antworten  [ 1 Beitrag ] 
Autor Nachricht
 Betreff des Beitrags: [PHP5] [Bibliothek] [Klasse] Commentary-Bundle
BeitragVerfasst: Fr 13. Jul 2007, 15:40 
Offline
Administrator

Registriert: Do 24. Mai 2007, 21:18
Beiträge: 35
Wohnort: Riehen (CH)
Engelsreich-Charakter: Charakter vorhanden
Charakternamen: Sefardius, Schlumpf, Testi
In diesem Thread wird das Commentary-Bundle weiter entwickelt. Es können Patches eingebracht werden, etc. Es wird hier nur an der PHP5-Version gearbeitet!

Jeweils hier oben ist die aktuelle Version mit allen Änderungen, die ich in das Release aufgenommen habe. Es ist nicht empfohlen, die hiesige Version in Live-Umbegungen zu verwenden!

Änderungen seit dem letzten stabilen Release (1.1.2)
  • Allgemeines
    • Standardwerte nun auch in den Einstellungen definierbar
    • *Bugfix: Emotes & Standardfarben werden nun korrekt assoziiert und angezeigt.
  • Features
    • Bio-Links nun individuell anpassbar (Per Konstanten)
    • Statische Methode Commentary::exInsert() nun verfügbar, mit der man extern Kommentare einfügen sollte.
  • Einstellungen
    • COMMENTARY_DEFAULTLIMIT: Die Standardlimite für Angezeigte Kommentare (Ursprünglich musste das Objekt geändert werden)
    • COMMENTARY_DEFAULTTALKLINE: Die Standardsprechzeile
    • COMMENTARY_DEFAULTMESSAGE: Der Text, der Standardmässig über den Chats erscheint
    • COMMENTARY_BIO_LINKTEMPLATE: Das Template, wie der Name angezeigt werden soll, inklusive Link.
    • COMMENTARY_BIO_LINK: Der Link, der in die Whitelist eingetragen werden muss (Wird auch für etwaige Popups gebraucht)

commentary.php:
Code:
<?php
/********************************************************************
    A mod from "Basilius-Extensions"
    Class Commentary, Version 1.2.0
    2006 by Basilius "Eliwood" Sauter
   
*********************************************************************

SQL for an update:
ALTER TABLE `commentary` ADD `emote` tinyint(3) unsigned NOT NULL default '0';
*/

# Einstellungen
Include 'commentary.setting.php';

class Commentary {
   // Definieren der Variablen
   protected $section;
   protected $limit;
   protected $talkline;
   protected $emote;
   protected $message;
 
   // Konstruktor
   public function __construct(&$user, $section, $message = COMMENTARY_DEFAULTMESSAGE,$limit = COMMENTARY_DEFAULTLIMIT,  $talkline = COMMENTARY_DEFAULTTALKLINE) {
      if(is_array($section)) {
         $this->section = $section; # Admin *g*
      }
      else {
         $this->section = trim(db_real_escape_string(stripslashes($section)));
      }
      $this->limit = (int)$limit;
      $this->talkline = trim(db_real_escape_string(stripslashes($talkline)));
      $this->user = &$user;
      $this->message = $message;
      $this->coloremote = '`2';
      $this->color3person = '`&';
      $this->colortalkline = '`3';
      $this->colorspeak = '`#';
   }
 
   public function ChangeDefaultColors($speak = false, $thirdperson = false, $emote = false) {
      if($speak !== false) {
         $this->colorspeak = $speak;
      }
      if($emote !== false) {
         $this->coloremote = $emote;
      }
      if($thirdperson !== false) {
         $this->color3person = $thirdperson;
      }
   }
   // Funktionen
   public function Add() {
      if(isset($_SESSION['session']['comment_for_insert'])) {
         $_POST = $_SESSION['session']['comment_for_insert'];
      }

      if($_POST['section'] == HTMLEntities($this->section)) {
      
         $commentary = trim($_POST['commentary']);
         if($commentary != '') {
            // Emotecheck
            $emote = 0;
            if(substr($commentary,0,2) === '::') {
               $commentary = $this->coloremote.substr($commentary,2);
               $emote = 1;
            }
            elseif(substr($commentary,0,1) === ':') {
               $commentary = $this->coloremote.substr($commentary,1);
               $emote = 1;
            }
            elseif(strtolower(substr($commentary,0,3)) === '/me') {
               $commentary = $this->coloremote.substr($commentary,3);
               $emote = 1;
            }
            elseif(strtolower(substr($commentary,0,3)) === '/ms') {
               $commentary = $this->coloremote.substr($commentary,3);
               $emote = 3;
            }
            elseif(strtolower(substr($commentary,0,3)) === '/em') {
               $commentary = $this->color3person.substr($commentary,3);
               $emote = 2;
            }
            elseif(strtolower(substr($commentary,0,2)) === '/x') {
               $commentary = $this->color3person.substr($commentary,2);
               $emote = 2;
            }         
            else {
               $commentary = $this->colorspeak.$commentary;
            }
            
            $this->emote = $emote;
           
            $commentary = $this->Clear($commentary);
           
            $this->Insert($commentary,$this->user['acctid']);
         }
         
         unset($session['comment_for_insert']);
         $_POST = array();
         return true;      
      }
      else return false;
   }
 
   private function Clear($commentary) {
      $commentary = str_replace('`n','',$commentary);
      return $commentary;
   }
 
   private function Insert($commentary,$author) {
      // Kommentare kürzen, radikal *g*
      $commentary = substr($commentary, 0, COMMENTARY_MAXLENGHT);
   
      // Eintragen
      $sql = 'INSERT INTO `commentary` (`author`,`comment`,`section`,`emote`,`postdate`) '
         .'VALUES ( '
         .'"'.$author.'",'
         .'"'.db_real_escape_string(stripslashes($commentary)).'",'
         .'"'.$this->section.'",'
         .'"'.$this->emote.'",'
         .'NOW()'
         .') ';
      db_query($sql) or die('MySQL-Error (#'.db_errno()."): <br />\r\n".db_error());
   }
   
   static public function exInsert($author, $emote, $commentary, $section) {
      // Kommentare kürzen, radikal *g*
      $commentary = substr($commentary, 0, COMMENTARY_MAXLENGHT);
      
      $sql = 'INSERT INTO `commentary` (`author`,`comment`,`section`,`emote`,`postdate`) '
         .'VALUES ( '
         .'"'.db_real_escape_string(stripslashes($author)).'",'
         .'"'.db_real_escape_string(stripslashes($commentary)).'",'
         .'"'.db_real_escape_string(stripslashes($section)).'",'
         .'"'.db_real_escape_string(stripslashes($emote)).'",'
         .'NOW()'
         .') ';
      db_query($sql) or die('MySQL-Error (#'.db_errno()."): <br />\r\n".db_error());
   }
 
   private function ParseBioLink($link, array $vals) {
      foreach($vals as $search => $replace) {
         $link = str_replace($search, $replace, $link);
      }
      return $link;
   }
   
   public function View($postfield = true) {
      $com = (int)$_GET['comscroll'];
      $REQUEST_URI = $_SERVER['REQUEST_URI'];
   
       $sql = 'SELECT
         `commentary`.*,
         `accounts`.`name`,
         `accounts`.`login`,
         `accounts`.`loggedin`,
         `accounts`.`location`,
         `accounts`.`laston` ,
         `accounts`.`acctid`
       FROM
         `commentary`
       INNER JOIN
         `accounts`
       ON
         `accounts`.`acctid` = `commentary`.`author`
       WHERE
         `commentary`.`section` = "'.$this->section.'"
       ORDER BY
         `commentid` DESC
       LIMIT '.($com*$this->limit).','.$this->limit.' ';
      
      if(COMMENTARY_GUILDTAG_DISPLAY) {
         $sql = $this->GuildPrefixes('overwrite_sql', COMMENTARY_GUILDTAG_VERSION, array('section' => $this->section, 'com' => $com, 'limit' => $this->limit));
      }
      
       $result = db_query($sql);
       $i = 0;
       $comments = array();
       $search = array('`&amp;');
       $replace = array('`&');
       define('endl',"\r\n");
       if(NOBIO === false) {
         $linktemplate = COMMENTARY_BIO_LINKTEMPLATE;
         $link = COMMENTARY_BIO_LINK;
       }
       else {
         $linktemplate = '{NAME}';
         $link = '';
       }
   
       while($row = db_fetch_assoc($result)) {
         $row['comment'] = preg_replace("'[`][^".COMMENTARY_ALLOWEDTAGS."]'","",$row['comment']);
        
         $replacearray = array(
            '{ACCTID}' => $row['acctid'],
            '{REQUESTURI}' => RawURLEncode($REQUEST_URI),
            '{LOGIN}' => RawURLEncode($row['login'])
         );
         $link = $this->ParseBioLink($link, $replacearray);
         $replacearray['{NAME}'] = $row['name'];
         $replacearray['{POPUP}'] = popup($link).'; return false;';
         $row['name'] = $this->ParseBioLink($linktemplate, $replacearray);
         
         if(COMMENTARY_GUILDTAG_DISPLAY) {
            $row['name'] = $this->GuildPrefixes('addprefix', COMMENTARY_GUILDTAG_VERSION, array('row' => $row, 'name' => $row['name']));
         }
         
         // Deleteprefix
         if($this->user['superuser'] >= COMMENTARY_LIVEDELETING_SULEVEL) {
            $prefix = '[<a href="'.COMMENTARY_LIVEDELETING_DELETETARGET.'&commentid='.$row['commentid'].'&return='.RawURLEncode($_SERVER['REQUEST_URI']).'">X</a>]&nbsp;';
            addnav("",COMMENTARY_LIVEDELETING_DELETETARGET.'&commentid='.$row['commentid'].'&return='.RawURLEncode($_SERVER['REQUEST_URI']));
         }
         else {
            $prefix = '';
         }
         
         // Timestamp
         if(COMMENTARY_TIMESTAMP_DISPLAY === true) {
            $prefix .= '`0['.date(COMMENTARY_TIMESTAMP_FORMAT, strToTime($row['postdate'])).']`0';
         }         
         
         // Emotler entlarven
         if(COMMENTARY_DISPLAYEMOTLERNAME === true AND $this->user['superuser'] >= COMMENTARY_DISPLAYEMOTLERNAME_SULEVEL) {
            $emotename = ' `0('.trim($row['namebackup']).')`0 ';
         }
         else {
            $emotename = '';
         }
        
         switch($row['emote']) {
            case 3:
               $lastchar = strToLower(substr($this->StripTag($row['namebackup']), -1));
               switch($lastchar) {
                  case 's':
                  case 'z':
                  case 'c':
                     $comments[] = $prefix.str_replace($search,$replace,
                        '`&'.substr($row['name'], 0, -2)."`` ".$this->nl2paragraph($row['comment'])."`0\r\n");
                     break;
                     
                  default:
                     $comments[] = $prefix.str_replace($search,$replace,
                        '`&'.substr($row['name'], 0, -2)."s ".$this->nl2paragraph($row['comment'])."`0\r\n");
                     break;
               }
               break;
               
            case 2:
               $comments[] = $prefix.str_replace($search,$replace,
               $emotename.$this->nl2paragraph($row['comment'])."`0\r\n");
               break;
               
            case 1:
               $comments[] = $prefix.str_replace($search,$replace,
               '`&'.$row['name'].' '.$this->nl2paragraph($row['comment'])."`0\r\n");
               break;
               
            default:
               $comments[] = $prefix.str_replace($search,$replace,
               '`&'.$row['name'].' '.$this->colortalkline.$this->talkline.': "'.$this->nl2paragraph($row['comment']).$this->colortalkline."\"`0\r\n");
         }
         $i++;
       }
      
       // Ausgabe
       krsort($comments);
       reset($comments);
       while (list($sec,$v)=each($comments)){
         if(COMMENTARY_USEPARAGRAPHS === true) {
            output('<p style="line-height: '.COMMENTARY_LINEHEIGHT.'em; margin-top: '.(COMMENTARY_PARAGRAPHS_MARGIN/2).'em; margin-bottom: '.(COMMENTARY_PARAGRAPHS_MARGIN/2).'em;">'.$v.'</p>',true);
         }
         else {
            output($v.'<br />',true);
         }
       }
      
       // Textfeld
       if($postfield === true) {
         $this->Field();
      }
       $this->Navigation($result);
      
       db_free_result($result);
    }
   
   private function Field() {
       global $REQUEST_URI;

       rawoutput('<hr><br /><form action="'.$REQUEST_URI.'" method="POST"> ');
   
      if(COMMENTARY_AUTOTEXTAREA === true) {
         if(COMMENTARY_MAXLENGHT <= COMMENTARY_AUTEXTAREA_CHARS) {
            # Einzeiliges Feld
            if(COMMENTARY_USE_CHATPREVIEW) {
               if(COMMENTARY_FARBHACK_IS_INSTALLED) {
                  $this->PrintJS('chatpreview.withfarbhack');
               }
               else {
                  $this->PrintJS('chatpreview.withoutfarbhack');
               }
               # Mit Chatpreview, einzeilig, automatisch
               rawoutput("<span id='chatpreview' style='word-wrap:break-word'></span><br /><br />");
               rawoutput('<input size='.COMMENTARY_INPUTFIELD_SIZE.' maxlenght='.COMMENTARY_MAXLENGHT.' name="commentary" class="input" onkeyup="document.getElementById(\'chatpreview\').innerHTML = appoencode(this.value,\''.$this->talkline.'\',\''.substr($this->colorspeak, 1, 1).'\',\''.substr($this->color3person, 1, 1).'\',\''.substr($this->coloremote, 1, 1).'\');"><br />');
            }
            else {
               # Ohne Chatpreview, einzeilig, automatisch
               rawoutput('<input size='.COMMENTARY_INPUTFIELD_SIZE.' maxlenght='.COMMENTARY_MAXLENGHT.' name="commentary" class="input"><br />');
            }
         }
         else {
            # Mehrzeiliges Feld
            if(COMMENTARY_TEXTAREA_SHOWCHARS === true) {
               if(COMMENTARY_USE_CHATPREVIEW) {
                  if(COMMENTARY_FARBHACK_IS_INSTALLED) {
                     $this->PrintJS('chatpreview.withfarbhack');
                  }
                  else {
                     $this->PrintJS('chatpreview.withoutfarbhack');
                  }
                  # Mit Chatpreview, mit Zeichen-übrig, mehrzeilig
                  $this->PrintJS('textarea.chars');
                  rawoutput("<span id='chatpreview' style='word-wrap:break-word'></span><br /><br />");
                  rawoutput('<textarea '.(COMMENTARY_TEXTAREA_FONTFAMILY !== '' ? 'style="font-family: '.COMMENTARY_TEXTAREA_FONTFAMILY.';"': '') .' rows="'.COMMENTARY_TEXTAREA_ROWS.'" cols="'.COMMENTARY_TEXTAREA_COLS.'" name="commentary" id="commentary" class="input" OnKeyUp="CountMax(); document.getElementById(\'chatpreview\').innerHTML = appoencode(this.value,\''.$this->talkline.'\',\''.substr($this->colorspeak, 1, 1).'\',\''.substr($this->color3person, 1, 1).'\',\''.substr($this->coloremote, 1, 1).'\');"></textarea><br />
                  Übrige Zeichen: <input id="showchars" value="'.COMMENTARY_MAXLENGHT.'" size="'.COMMENTARY_SHOWCHARS_SIZE.'" disabled="disabled" /><br />');
               }
               else {
                  // Ohne Chatpreview, mit Zeichen-übrig, mehrzeilig
                  $this->PrintJS('textarea.chars');
                  rawoutput('<textarea '.(COMMENTARY_TEXTAREA_FONTFAMILY !== '' ? 'style="font-family: '.COMMENTARY_TEXTAREA_FONTFAMILY.';"': '') .' rows="'.COMMENTARY_TEXTAREA_ROWS.'" cols="'.COMMENTARY_TEXTAREA_COLS.'" name="commentary" id="commentary" class="input" OnKeyUp="CountMax()"></textarea><br />
                  Übrige Zeichen: <input id="showchars" value="'.COMMENTARY_MAXLENGHT.'" size="7" disabled="disabled" /><br />');
               }
            }
            else {
               if(COMMENTARY_USE_CHATPREVIEW) {
                  if(COMMENTARY_FARBHACK_IS_INSTALLED) {
                     $this->PrintJS('chatpreview.withfarbhack');
                  }
                  else {
                     $this->PrintJS('chatpreview.withoutfarbhack');
                  }
                  # Mit Chatpreview, ohne Zeichen-übrig, mehrzeilig
                  rawoutput("<span id='chatpreview' style='word-wrap:break-word'></span><br /><br />");
                  rawoutput('<textarea '.(COMMENTARY_TEXTAREA_FONTFAMILY !== '' ? 'style="font-family: '.COMMENTARY_TEXTAREA_FONTFAMILY.';"': '') .' rows="'.COMMENTARY_TEXTAREA_ROWS.'" cols="'.COMMENTARY_TEXTAREA_COLS.'" name="commentary" class="input" onkeyup="document.getElementById(\'chatpreview\').innerHTML = appoencode(this.value,\''.$this->talkline.'\',\''.substr($this->colorspeak, 1, 1).'\',\''.substr($this->coloremote, 1, 1).'\',\''.substr($this->color3person, 1, 1).'\');"></textarea><br />');
               }
               else {
                  # Ohne Chatpreview, ohne Zeichen-übrig, mehrzeilig
                  rawoutput('<textarea '.(COMMENTARY_TEXTAREA_FONTFAMILY !== '' ? 'style="font-family: '.COMMENTARY_TEXTAREA_FONTFAMILY.';"': '') .' rows="'.COMMENTARY_TEXTAREA_ROWS.'" cols="'.COMMENTARY_TEXTAREA_COLS.'" name="commentary" class="input"></textarea><br />');
               }
            }
         }
      }
      elseif(COMMENTARY_ACTIVETEXTAREA === true) {
         # Mehrzeiliges Feld
         if(COMMENTARY_TEXTAREA_SHOWCHARS === true) {
            if(COMMENTARY_USE_CHATPREVIEW) {
               if(COMMENTARY_FARBHACK_IS_INSTALLED) {
                  $this->PrintJS('chatpreview.withfarbhack');
               }
               else {
                  $this->PrintJS('chatpreview.withoutfarbhack');
               }
               # Mit Chatpreview, mit Zeichen übrig, mehrzeilig
               $this->PrintJS('textarea.chars');
               rawoutput("<span id='chatpreview' style='word-wrap:break-word'></span><br /><br />");
               rawoutput('<textarea '.(COMMENTARY_TEXTAREA_FONTFAMILY !== '' ? 'style="font-family: '.COMMENTARY_TEXTAREA_FONTFAMILY.';"': '') .' rows="'.COMMENTARY_TEXTAREA_ROWS.'" cols="'.COMMENTARY_TEXTAREA_COLS.'" name="commentary" id="commentary" class="input" OnKeyUp="CountMax(); document.getElementById(\'chatpreview\').innerHTML = appoencode(this.value,\''.$this->talkline.'\',\''.substr($this->colorspeak, 1, 1).'\',\''.substr($this->coloremote, 1, 1).'\',\''.substr($this->color3person, 1, 1).'\');"></textarea><br />
               Übrige Zeichen: <input id="showchars" value="'.COMMENTARY_MAXLENGHT.'" size="'.COMMENTARY_SHOWCHARS_SIZE.'" disabled="disabled" /><br />');
            }
            else {
               # Ohne Chatpreview, mit Zeichen übrig, mehrzeilig
               $this->PrintJS('textarea.chars');
               rawoutput('<textarea '.(COMMENTARY_TEXTAREA_FONTFAMILY !== '' ? 'style="font-family: '.COMMENTARY_TEXTAREA_FONTFAMILY.';"': '') .' rows="'.COMMENTARY_TEXTAREA_ROWS.'" cols="'.COMMENTARY_TEXTAREA_COLS.'" name="commentary" id="commentary" class="input" OnKeyUp="CountMax()"></textarea><br />
               Übrige Zeichen: <input id="showchars" value="'.COMMENTARY_MAXLENGHT.'" size="'.COMMENTARY_SHOWCHARS_SIZE.'" disabled="disabled" /><br />');
            }
         }
         else {
            if(COMMENTARY_USE_CHATPREVIEW) {
               if(COMMENTARY_FARBHACK_IS_INSTALLED) {
                  $this->PrintJS('chatpreview.withfarbhack');
               }
               else {
                  $this->PrintJS('chatpreview.withoutfarbhack');
               }
               # Ohne Chatpreview, mit zeichen übrig, mehrzeilig
               rawoutput("<span id='chatpreview' style='word-wrap:break-word'></span><br /><br />");
               rawoutput('<textarea '.(COMMENTARY_TEXTAREA_FONTFAMILY !== '' ? 'style="font-family: '.COMMENTARY_TEXTAREA_FONTFAMILY.';"': '') .' rows="'.COMMENTARY_TEXTAREA_ROWS.'" cols="'.COMMENTARY_TEXTAREA_COLS.'" name="commentary" class="input" onkeyup="document.getElementById(\'chatpreview\').innerHTML = appoencode(this.value,\''.$this->talkline.'\',\''.substr($this->colorspeak, 1, 1).'\',\''.substr($this->color3person, 1, 1).'\',\''.substr($this->coloremote, 1, 1).'\');"></textarea><br />');
            }
            else {
               # Ohne Chatpreview, ohne Zeichen übrig, mehrzeilig
               rawoutput('<textarea '.(COMMENTARY_TEXTAREA_FONTFAMILY !== '' ? 'style="font-family: '.COMMENTARY_TEXTAREA_FONTFAMILY.';"': '') .' rows="'.COMMENTARY_TEXTAREA_ROWS.'" cols="'.COMMENTARY_TEXTAREA_COLS.'" name="commentary" class="input"></textarea><br />');
            }
         }
      }
      else {
         # Einzeiliges Feld
            if(COMMENTARY_USE_CHATPREVIEW) {
               if(COMMENTARY_FARBHACK_IS_INSTALLED) {
                  $this->PrintJS('chatpreview.withfarbhack');
               }
               else {
                  $this->PrintJS('chatpreview.withoutfarbhack');
               }
               # Mit Chatpreview, einzeilig, manuell
               rawoutput("<span id='chatpreview' style='word-wrap:break-word'></span><br /><br />");
               rawoutput('<input size='.COMMENTARY_INPUTFIELD_SIZE.' maxlenght='.COMMENTARY_MAXLENGHT.' name="commentary" class="input" onkeyup="document.getElementById(\'chatpreview\').innerHTML = appoencode(this.value,\''.$this->talkline.'\',\''.substr($this->colorspeak, 1, 1).'\',\''.substr($this->color3person, 1, 1).'\',\''.substr($this->coloremote, 1, 1).'\');"><br />');
            }
            else {
               # Ohne Chatpreview, einzeilig, manuell
               rawoutput('<input size='.COMMENTARY_INPUTFIELD_SIZE.' maxlenght='.COMMENTARY_MAXLENGHT.' name="commentary" class="input"><br />');
            }
      }
       
       rawoutput('<input type="hidden" value="'.HTMLEntities($this->section).'" name="section" />
         <input type="submit" class="button" value="Absenden" />'
         .'</form>');
       addnav('',$REQUEST_URI);
   }
 
   private function StripTag($input) {
     // 2005-2006 by Eliwood
     return preg_replace("'[`].'","",$input);
   }
   
   # Möglichkeiten für which:
   #   - chatpreview.withoutfarbhack
   #    - chatpreview.withfarbhack
   #   - textarea.chars
   private function PrintJS($which) {
      switch($which) {
      // OnFocus='CountMax(".getsetting('mailsizelimit' ,0).");' OnClick='CountMax(".getsetting('mailsizelimit' ,0).");' OnChange='CountMax(".getsetting('mailsizelimit' ,0).");' onKeydown='CountMax(".getsetting('mailsizelimit' ,0).");' onKeyup='CountMax(".getsetting('mailsizelimit' ,0).");'
         case 'textarea.chars':
            // Script taken from anpera.NET; Originaly by Day aka Kevz, modified by Eliwood
            rawoutput('<!-- Script taken from anpera.NET; Originaly by Day aka Kevz, modified by Eliwood -->
            <script language="JavaScript"> 
               <!-- 
               function CountMax() { 
                  var wert,max; 
                  max = '.COMMENTARY_MAXLENGHT.';
                  var commentary = document.getElementById("commentary");
                  var showchars = document.getElementById("showchars");
                  
                  wert = max - commentary.value.length; 
                  '.(/*if (wert < 0) {   
                     commentary.value = commentary.value.substring(0,max); 
                     wert = max - commentary.value.length; 
                     showchars.value = wert;
                  } else {   
                  } */'').'                     
                  showchars.value = wert;
               } 
               //--> 
               </script> ');

            break;
            
         case 'chatpreview.withoutfarbhack':
            # Chatvorschau, Orignal von Chaosmaker, modifziziert von blackfin. Danke an Rikka für das rausrücken vom Code *g*
            # Weitere, kleine Modifikationen von Basilius Sauter.
            
            $my_name = $this->user['name'] ;
            $clearname = str_replace("`0","",$this->striptag($my_name)) ;
            $my_lastchar = substr($clearname,strlen($clearname)-1,0) ;
            // $myemoteuse = $this->user['emoteuse'] ;
            
            $script .= <<<JS
               <script type="text/javascript">
               <!--
                  function appoencode(data,talkline,thismycolor, thisthirdpersonemote,thisemotecolor) {
                     var Fundstelle = -1;
                     var tag = '';
                     var append = '';
                     //var output = '<br />Vorschau: ';
                     var output = '';
                     var openspan = false;
                     var myname = '$my_name';
                     var mylchar = '$my_lastchar' ;
                     //var myadmin = '$myemoteuse' ;
                     var mecheck = '' ;
                     var doppelcheck = '' ;
                  var xcheck = '';
                     //var mesearch = data.search('/me') ;
                     var mesearch = 0 ;

                     if(thisemotecolor == '') thisemotecolor = '&' ;
                     if(thismycolor == '') thismycolor = '#' ;
                  if(thisthirdpersonemote == '') thisthirdpersonemote = '&';

                       data = data.replace('/mE','/me');
                       data = data.replace('/ME','/me');
                       data = data.replace('/Me','/me');
                  
                       data = data.replace('/Em','/em');
                       data = data.replace('/eM','/em');
                       data = data.replace('/EM','/em');
                  
                       data = data.replace('/mS','/ms');
                       data = data.replace('/MS','/ms');
                       data = data.replace('/Ms','/ms');
                  
                  data = data.replace('/X', '/x');
                       var clname = myname.replace('`0','');
                  
                  // Emote-Check
                     mecheck = data.substr(0,3).toLowerCase() ;
                  if(mecheck == '/me') {
                     data = data.replace('/me',''+myname+' `'+thisemotecolor+'');
                     mesearch = 1 ;
                  }
                  if(mecheck == '/ms') {
                          if(mylchar == 's') {
                             alert(mylchar) ;
                             data = data.replace('/ms',''+clname+'\'`'+thisemotecolor+' ');
                          }else {
                             data = data.replace('/ms',''+clname+'s`'+thisemotecolor+' ');
                          }
                     mesearch = 1 ;
                  }      
                  doppelcheck = data.substr(0,1).toLowerCase() ;
                     if(doppelcheck == ':') {
                     data = data.replace(':',''+myname+' `'+thisemotecolor+'');
                     mesearch = 1 ;
                  }         
                  // Dritte-Personcheck
                  if(mecheck == '/em') { // && myadmin == 1) {
                     data = data.replace('/em','`^NSC: `'+thisthirdpersonemote+' ');
                     data = '`&'+data+'' ;
                     mesearch = 1 ;
                   }         
                  xcheck = data.substr(0,2).toLowerCase();
                  if(xcheck == '/x') {
                     data = data.replace('/x','`^NSC: `'+thisthirdpersonemote+' ');
                     mesearch = 1 ;
                  }
                  // Der Rest
                  if(mesearch == 0 && data.length != 0) {
                     data = ''+myname+' `3' +talkline+' : `'+thismycolor+'"'+data+'`'+thismycolor+'"' ;
                     }
                     while ((Fundstelle = data.search(/`/)) != -1) {
                        tag = data.substr(Fundstelle+1, 1);
                        append = data.substr(0,Fundstelle);
                        append = append.replace(/</,'&lt;');
                        append = append.replace(/>/,'&gt;');
                        output = output+ append;
                        if (data.length >= Fundstelle+2) data = data.substring(Fundstelle+2,data.length);
                        else data = '';

                        switch (tag) {
case "n":
                        if (openspan) output=output+"<br />";
                     //   openspan = false;
                        break;
                           case "0":
                           if (openspan) output= output+"</span>";
                           openspan = false;
                        break;
                          
                       case "1":
                              if (openspan) output= output+"</span>"; else openspan = true;
                              output= output+"<span class='colDkBlue'>";
                       break;
case "2":
                           if (openspan) output= output+"</span>"; else openspan=true;
                           output= output+"<span class='colDkGreen'>";
                        break;
                           case "3":
                           if (openspan) output= output+"</span>"; else openspan=true;
                           output= output+"<span class='colDkCyan'>";
                        break;
                           case "4":
                           if (openspan) output= output+"</span>"; else openspan=true;
                           output= output+"<span class='colDkRed'>";
                        break;
                           case "5":
                           if (openspan) output= output+"</span>"; else openspan=true;
                           output= output+"<span class='colDkMagenta'>";
                        break;
                           case "6":
                           if (openspan) output= output+"</span>"; else openspan=true;
                           output= output+"<span class='colDkYellow'>";
                        break;
                           case "7":
                           if (openspan) output= output+"</span>"; else openspan=true;
                           output= output+"<span class='colDkWhite'>";
                        break;
                           case "8":
                           if (openspan) output= output+"</span>"; else openspan=true;
                           output= output+"<span class='colLime'>";
                        break;
                           case "9":
                           if (openspan) output= output+"</span>"; else openspan=true;
                           output= output+"<span class='colBlue'>";
                        break;
                           case "!":
                           if (openspan) output= output+"</span>"; else openspan=true;
                           output= output+"<span class='colLtBlue'>";
                        break;
                           case "@":
                           if (openspan) output= output+"</span>"; else openspan=true;
                           output= output+"<span class='colLtGreen'>";
                        break;
                           case "#":
                           if (openspan) output= output+"</span>"; else openspan=true;
                           output= output+"<span class='colLtCyan'>";
                        break;
                           case "$":
                           if (openspan) output= output+"</span>"; else openspan=true;
                           output= output+"<span class='colLtRed'>";
                        break;
                           case "%":
                           if (openspan) output= output+"</span>"; else openspan=true;
                           output= output+"<span class='colLtMagenta'>";
                        break;
                           case "^":
                           if (openspan) output= output+"</span>"; else openspan=true;
                           output= output+"<span class='colLtYellow'>";
                        break;
                           case "&":
                           if (openspan) output= output+"</span>"; else openspan=true;
                           output= output+"<span class='colLtWhite'>";
                        break;
                           case "~":
                              if (openspan) output= output+"</span>"; else openspan=true;
                              output= output+"<span class='colBlack'>";
                        break;
                           case "Q":
                              if (openspan) output= output+"</span>"; else openspan=true;
                               output= output+"<span class='colDkOrange'>";
                        break;
                           case "q":
                              if (openspan) output= output+"</span>"; else openspan=true;
                               output= output+"<span class='colOrange'>";
                               break;
                           case "r":
                           case "R":
                               if (openspan) output= output+"</span>"; else openspan=true;
                               output= output+"<span class='colRose'>";
                                break;
                           case "V":
                              if (openspan) output= output+"</span>"; else openspan=true;
                               output= output+"<span class='colBlueViolet'>";
                        break;
                           case "v":
                              if (openspan) output= output+"</span>"; else openspan=true;
                               output= output+"<span class='coliceviolet'>";
                        break;
                           case "g":
                           case "G":
                              if (openspan) output= output+"</span>"; else openspan=true;
                               output= output+"<span class='colXLtGreen'>";
                        break;
                           case "T":
                              if (openspan) output= output+"</span>"; else openspan=true;
                               output= output+"<span class='colDkBrown'>";
                        break;
                           case "t":
                              if (openspan) output= output+"</span>"; else openspan=true;
                               output= output+"<span class='colLtBrown'>";
                        break;
                           case "?":
                               if (openspan) output= output+"</span>"; else openspan=true;
                               output= output+"<span class='colWhiteBlack'>";
                        break;
                           case "*":
                              if (openspan) output= output+"</span>"; else openspan=true;
                               output= output+"<span class='colBack'>";
                        break;
                            case "A":
                            case "a":
                              if (openspan) output= output+"</span>"; else openspan=true;
                               output= output+"<span class='colAttention'>";
                        break;
                           case "`":
                           output= output+"`";
                        break;

                           default:
                           output= output+"`"+tag;
                        }
                     }


                     output += data;
                     if (openspan) output += '</span>';
                  
                  output = output.replace(/\\n/g, '<br />');
                  output = output.replace(/\\\\n/gi, '<br />');
                  
                     return output;
                  }
               //-->
               </script>
JS;
            // chat preview mod by Chaosmaker - end
              // modified by blackfin
            // chat preview mod by Chaosmaker - end
            
            rawoutput($script);
            break;
            
         case 'chatpreview.withfarbhack':
            global $appoencode;
            # Chatvorschau, Orignal von Chaosmaker, modifziziert von blackfin. Danke an Rikka für das rausrücken vom Code *g*
            # Weitere, kleine Modifikationen von Basilius Sauter.
            
            $my_name = $this->user['name'] ;
            $clearname = str_replace("`0","",$this->striptag($my_name)) ;
            $my_lastchar = substr($clearname,strlen($clearname)-1,0) ;
            // $myemoteuse = $this->user['emoteuse'] ;
            
            $includinscript = '';
            reset($appoencode);
            while(list($key,$val) = each($appoencode)) {
               $includinscript .= '
               case "'.$key.'":
                  if(openspan) output = output+"</span>"; else openspan = true;
                  output= output + "<span style=\"color: #'.$val['color'].';\">";
                  break;';
            }
            $script .= <<<JS
               <script type="text/javascript">
               <!--
                 function appoencode(data,talkline,thismycolor, thisthirdpersonemote,thisemotecolor) {
                     var Fundstelle = -1;
                     var tag = '';
                     var append = '';
                     //var output = '<br />Vorschau: ';
                     var output = '';
                     var openspan = false;
                     var myname = '$my_name';
                     var mylchar = '$my_lastchar' ;
                     //var myadmin = '$myemoteuse' ;
                     var mecheck = '' ;
                     var doppelcheck = '' ;
                  var xcheck = '';
                     //var mesearch = data.search('/me') ;
                     var mesearch = 0 ;

                     if(thisemotecolor == '') thisemotecolor = '&' ;
                     if(thismycolor == '') thismycolor = '#' ;
                  if(thisthirdpersonemote == '') thisthirdpersonemote = '&';

                       data = data.replace('/mE','/me');
                       data = data.replace('/ME','/me');
                       data = data.replace('/Me','/me');
                  
                       data = data.replace('/Em','/em');
                       data = data.replace('/eM','/em');
                       data = data.replace('/EM','/em');
                  
                       data = data.replace('/mS','/ms');
                       data = data.replace('/MS','/ms');
                       data = data.replace('/Ms','/ms');
                  
                  data = data.replace('/X', '/x');
                  
                       var clname = myname.replace('`0','');
// Emote-Check
                     mecheck = data.substr(0,3).toLowerCase() ;
                  if(mecheck == '/me') {
                     data = data.replace('/me',''+myname+' `'+thisemotecolor+'');
                     mesearch = 1 ;
                  }
                  if(mecheck == '/ms') {
                          if(mylchar == 's') {
                             alert(mylchar) ;
                             data = data.replace('/ms',''+clname+'\'`'+thisemotecolor+' ');
                          }else {
                             data = data.replace('/ms',''+clname+'s`'+thisemotecolor+' ');
                          }
                     mesearch = 1 ;
                  }      
                  doppelcheck = data.substr(0,1).toLowerCase() ;
                     if(doppelcheck == ':') {
                     data = data.replace(':',''+myname+' `'+thisemotecolor+'');
                     mesearch = 1 ;
                  }         
                  // Dritte-Personcheck
                  if(mecheck == '/em') { // && myadmin == 1) {
                     data = data.replace('/em','`^NSC: `'+thisthirdpersonemote+' ');
                     data = '`&'+data+'' ;
                     mesearch = 1 ;
                   }         
                  xcheck = data.substr(0,2).toLowerCase();
                  if(xcheck == '/x') {
                     data = data.replace('/x','`^NSC: `'+thisthirdpersonemote+' ');
                     mesearch = 1 ;
                  }
                  // Der Rest
                  if(mesearch == 0 && data.length != 0) {
                     data = ''+myname+' `3' +talkline+' : `'+thismycolor+'"'+data+'`'+thismycolor+'"' ;
                     }
                     while ((Fundstelle = data.search(/`/)) != -1) {
                        tag = data.substr(Fundstelle+1, 1);
                        append = data.substr(0,Fundstelle);
                        append = append.replace(/</,'&lt;');
                        append = append.replace(/>/,'&gt;');
                        output = output+ append;
                        if (data.length >= Fundstelle+2) data = data.substring(Fundstelle+2,data.length);
                        else data = '';

                        switch (tag) {
case "n":
                        if (openspan) output=output+"</br>";
                     //   openspan = false;
                        break;
                           case "0":
                           if (openspan) output= output+"</span>";
                           openspan = false;
                        break;
                           $includinscript

                           case "`":
                           output= output+"`";
                        break;
                      /*    case "n":
                                output= output+"</br>";
                        break;*/
                           default:
                           output= output+"`"+tag;
                        }
                     }


                     output += data;
                     if (openspan) output += '</span>';
                  
                  output = output.replace(/\\n/g, '<br />');
                  output = output.replace(/\\\\n/gi, '<br />');
                  
                     return output;
                  }
               //-->
               </script>
JS;
            // chat preview mod by Chaosmaker - end
            // modified by blackfin
            // chat preview mod by Chaosmaker - end
            rawoutput($script);
            break;
      }
   }
   
   private function Navigation($result) {
      global $REQUEST_URI;
       $com = (int)$_GET['comscroll'];
      
       $req1 = preg_replace("'[&]?c(omscroll)?=([[:digit:]-])*'","",$REQUEST_URI);
      
      // Zurück
       if(db_num_rows($result) >= $this->limit) {
         $req = $req1."&comscroll=".($com+1);
         $req = str_replace('?&','?',$req);
         if (!strpos($req,'?')) $req = str_replace('&','?',$req);
         rawoutput('<a href="'.HTMLSpecialchars($req).'">&lt;&lt; Vorherige</a>');
         addnav('',$req);
       }
      
      // Aktualisieren
       $req = $req1."&comscroll=0";
       $req = str_replace("?&","?",$req);
       if (!strpos($req,"?")) $req = str_replace("&","?",$req);
       rawoutput('&nbsp;<a href="'.HTMLSpecialchars($req).'">Aktualisieren</a>&nbsp;');
       addnav("",$req);
      
      // Wieder nach vorne
       if ($com>0){
         $req = $req1."&comscroll=".($com-1);
         $req = str_replace("?&","?",$req);
         if (!strpos($req,"?")) $req = str_replace("&","?",$req);
         rawoutput(' <a href="'.HTMLSpecialchars($req).'">Nächste &gt;&gt;</a>');
         addnav("",$req);
       }
   }

   private function nl2paragraph($input) {
      $input = HTMLSpecialchars($input);
      if(COMMENTARY_ALLOWPARAGRAPHS) {
         $input = str_replace(COMMENTARY_MANUALPARAGRAPHCHAR, "\n", $input);
         if(COMMENTARY_USEPARAGRAPHS) {
            $input = str_replace("\r\n", "\n", $input);
            $input = str_replace("\r", "\n", $input);
            $exploded = explode("\n", $input);
            return implode('</p><p style="line-height: '.COMMENTARY_LINEHEIGHT.'em; margin-top: '.(COMMENTARY_PARAGRAPHS_MARGIN/2).'em; margin-bottom: '.(COMMENTARY_PARAGRAPHS_MARGIN/2).'em;">', $exploded);
         }
         else {
            $search = array("\r\n", "\r", "\n");
            return str_Replace($search, '<br />', $input);
         }
      }
      else return $input;
   }
   
   public function SuView($deletetarget = 'superuser.php?op=commentdelete', $sectionviewfile = 'superuser.php?op=checkcommentary') {
      $com = (int)$_GET['comscroll'];
      $REQUEST_URI = $_SERVER['REQUEST_URI'];      
      
      if(empty($_GET['section'])) {
         $where = '';
         $i = 0;
         
         foreach($this->section as $disallowedsection) {
            $where.= ($i > 0?'AND ':'WHERE ').'`commentary`.`section` NOT LIKE "'.$disallowedsection.'"';
            $i++;
         }
         
         $sql = 'SELECT
               `commentary`.`section`,
               COUNT(`commentid`) as counter
             FROM
               `commentary`
             INNER JOIN
               `accounts`
             ON
               `accounts`.`acctid` = `commentary`.`author`
            '.$where.'
             GROUP BY
               `section`
             LIMIT '.($com*$this->limit).','.$this->limit.' ';
      }
      else {
         $where = 'WHERE `section` = "'.$_GET['section'].'" ';
         
         $sql = 'SELECT
               `commentary`.*,
               `accounts`.`name`,
               `accounts`.`login`,
               `accounts`.`loggedin`,
               `accounts`.`location`,
               `accounts`.`laston`
             FROM
               `commentary`
             INNER JOIN
               `accounts`
             ON
               `accounts`.`acctid` = `commentary`.`author`
            '.$where.'
             ORDER BY
               `section` ASC,
               `commentid` DESC
             LIMIT '.($com*$this->limit).','.$this->limit.' ';
      }
      
      
       $result = db_query($sql);
       $i = 0;
       $comments = array();
      $sections = array();
      $counts = array();
       $search = array('`&amp;');
       $replace = array('`&');
       define('endl',"\r\n");

      $linktemplate = '{$NAME}';
      $acsection = '';
      
       while($row = db_fetch_assoc($result)) {
         $row['comment'] = preg_replace("'[`][^".COMMENTARY_ALLOWEDTAGS."]'","",$row['comment']);
        
         $sea4linktemplate = array('{$NAME}');
          $rep4linktemplate = array($row['name']);

         $sections[] = $row['section'];
         
         $row['namebackup'] = $row['name'];
         $row['name'] = str_replace($sea4linktemplate,$rep4linktemplate,$linktemplate);
         $delprefix = '[ <a href="'.$deletetarget.'&commentid='.$row['commentid'].'&return='.RawURLEncode($_SERVER['REQUEST_URI']).'">X</a> ]&nbsp;';
         addnav("",$deletetarget.'&commentid='.$row['commentid'].'&return='.RawURLEncode($_SERVER['REQUEST_URI']));
         
         // Timestamp
         if(COMMENTARY_TIMESTAMP_DISPLAY === true) {
            $prefix .= '`0['.date(COMMENTARY_TIMESTAMP_FORMAT, strToTime($row['postdate'])).']`0';
         }   
         // Emotler entlarven
         if(COMMENTARY_DISPLAYEMOTLERNAME === true AND $this->user['superuser'] >= COMMENTARY_DISPLAYEMOTLERNAME_SULEVEL) {
            $emotename = ' `0('.trim($row['namebackup']).')`0 ';
         }
         else {
            $emotename = '';
         }
         
         switch($row['emote']) {
            case 3:
               $lastchar = strToLower(substr($this->StripTag($row['namebackup']), -1));
               switch($lastchar) {
                  case 's':
                  case 'z':
                  case 'c':
                     $comments[] = $delprefix.str_replace($search,$replace,
                        '`&'.substr($row['name'], 0, -2)."`` ".$this->nl2paragraph($row['comment'])."`0\r\n");
                     break;
                     
                  default:
                     $comments[] = $delprefix.str_replace($search,$replace,
                        '`&'.substr($row['name'], 0, -2)."s ".$this->nl2paragraph($row['comment'])."`0\r\n");
                     break;
               }
               break;
               
            case 2:
               $comments[] = $delprefix.str_replace($search,$replace,
               $emotename.$this->nl2paragraph($row['comment'])."`0\r\n");
               break;
               
            case 1:
               $comments[] = $delprefix.str_replace($search,$replace,
               '`&'.$row['name'].' '.$this->nl2paragraph($row['comment'])."`0\r\n");
               break;
               
            default:
               $comments[] = $delprefix.str_replace($search,$replace,
               '`&'.$row['name'].' '.$this->colortalkline.$this->talkline.': "'.$this->nl2paragraph($row['comment']).$this->colortalkline."\"`0\r\n");
         }
         
         if(empty($_GET['section'])) {
            $counts[] = $row['counter'];
         }
         $i++;
       }
      
       // Ausgabe
       krsort($comments); krsort($sections); ksort($counts);
       reset($comments);   reset($sections); reset($counts);
      $acsection = '';
       while (list($sec,$v)=each($comments)){
         if($acsection != $sections[$sec]) {
            $acsection = $sections[$sec];
            if(empty($_GET['section'])) {
               $count = $counts[$sec];
               output('<h3><b><a href="'.$sectionviewfile.'&section='.RawURLEncode($acsection).'">'.$acsection.'</a> ('.$count.')</b></h3>', true);
               addnav('', $sectionviewfile.'&section='.RawURLEncode($acsection));
            }
            else {
               output('<h3><b>'.$acsection.'</b></h3>', true);
            }      
         }
         
         if(!empty($_GET['section'])) {
            if(COMMENTARY_USEPARAGRAPHS === true) {
               output('<p style="line-height: '.COMMENTARY_LINEHEIGHT.'em; margin-top: '.(COMMENTARY_PARAGRAPHS_MARGIN/2).'em; margin-bottom: '.(COMMENTARY_PARAGRAPHS_MARGIN/2).'em;">'.$v.'</p>',true);
            }
            else {
               output($v.'<br />',true);
            }
         }
       }
      
       $this->SuNavigation($result, $sectionviewfile);
      
       db_free_result($result);
   }

   private function SuNavigation($result, $sectionviewfile) {
      global $REQUEST_URI;
       $com = (int)$_GET['comscroll'];
      
       $req1 = preg_replace("'[&]?c(omscroll)?=([[:digit:]-])*'","",$REQUEST_URI);
      
      // Zurück
       if(db_num_rows($result) >= $this->limit) {
         $req = $req1."&comscroll=".($com+1);
         $req = str_replace('?&','?',$req);
         if (!strpos($req,'?')) $req = str_replace('&','?',$req);
         rawoutput('<a href="'.HTMLSpecialchars($req).'">&lt;&lt; Vorherige</a>');
         addnav('',$req);
       }
      
      // Aktualisieren
       $req = $req1."&comscroll=0";
       $req = str_replace("?&","?",$req);
       if (!strpos($req,"?")) $req = str_replace("&","?",$req);
       rawoutput('&nbsp;<a href="'.HTMLSpecialchars($req).'">Aktualisieren</a>&nbsp;');
       addnav("",$req);
      
      // Wieder nach vorne
       if ($com>0){
         $req = $req1."&comscroll=".($com-1);
         $req = str_replace("?&","?",$req);
         if (!strpos($req,"?")) $req = str_replace("&","?",$req);
         rawoutput(' <a href="'.HTMLSpecialchars($req).'">Nächste &gt;&gt;</a>');
         addnav("",$req);
       }
      
      // Zurück zur Übersicht
      if(!empty($_GET['section'])) {
         rawoutput('<br />&nbsp;<a href="'.$sectionviewfile.'">Zurück zur Übersicht</a>&nbsp;');
         addnav('', $sectionviewfile);
      }
   }
   
   private function GuildPrefixes($hook, $guildv, $args) {
      switch($hook) {
         case 'overwrite_sql':
            switch($guildv) {
               case 'dashguild':
                  $sql = "SELECT commentary.*,
                          accounts.loggedin,
                          accounts.name,
                          accounts.login,
                          accounts.guildID,
                          accounts.prefs,
                          lotbd_guilds.GuildPrefix ,
         `accounts`.`acctid`
                      FROM commentary
                           INNER JOIN accounts
                                ON accounts.acctid = commentary.author
                           LEFT JOIN lotbd_guilds
                                ON lotbd_guilds.ID = accounts.GuildID
                               WHERE section = '$args[section]'
                                   AND accounts.locked=0
                               ORDER BY commentid DESC
                               LIMIT ".($args['com']*$args['limit']).",$args[limit]";
                  break;
                  
               case 'eliguild':
                  $sql = "SELECT commentary.*,
                            accounts.name,
                            accounts.login,
                            accounts.prefs,
                            accounts.loggedin,
                            accounts.location,
                            accounts.laston,
                            accounts.memberid,
                            accounts.acctid,
                            gilden.gildenprefix,
                            gilden.gildenid,
                            gilden.leaderid ,
         `accounts`.`acctid`
                       FROM commentary
                      INNER JOIN accounts
                         ON accounts.acctid = commentary.author
                      LEFT JOIN gilden
                         ON gilden.leaderid = accounts.acctid OR gilden.gildenid = accounts.memberid
                      WHERE section = '$args[section]'
                        AND accounts.locked=0
                      ORDER BY commentid DESC
                      LIMIT ".($args['com']*$args['limit']).",$args[limit]";
                  break;
                  
               case 'eliguildv2':
                  break;
            
            }
            return $sql;
            break;
            
         case 'addprefix':
            $row = $args['row'];
            
            switch($guildv) {
               case 'dashguild':         
                  # Dashers Gilden
                  if (!(unserialize($row['GuildPrefix'])===false)) {
                        $row['GuildPrefix']=unserialize($row['GuildPrefix']);
                        $pre=$row['GuildPrefix']['pre']; // Prefix or postfix
                        $prefix=$row['GuildPrefix']['display']."";  // This Guild TLA
                        if ($prefix!="") {
                           // The link to display the guild info for non-members
                            $Guildshortlink = "guild.php?op=nonmember&action=examine&id=".$row['guildID'].
                            "&return=".URLEncode(CalcReturnPath());
                            $Guildlink = "`0<a href='".$Guildshortlink."' style='text-decoration: none'>`0[$prefix`0]</a>`& ";
                            switch ( $pre ) {
                                case 0:  // suffix
                                $guildsuf = $Guildlink;
                                $guildpre = "";
                                addnav("",$Guildshortlink);
                                break;
                                case 1:  // prefix
                                $guildsuf = "";
                                $guildpre = $Guildlink;
                                addnav("",$Guildshortlink);
                                break;
                                case 2:  // nofix
                                default:
                                $guildsuf = "";
                                $guildpre = "";
                                break;
                            }
                        }
                    }
                  $name = $guildpre.' '.$args['name'].' '.$guildsuf;
                  break;
                  
               case 'eliguild':
                  if($row['gildenid'] > 0) {
                     $link2 = "`2[`0<a href='showdetail.php?id=".$row['gildenid']."' target='window_popup' onClick=\"".popup("showdetail.php?id=".$row['gildenid'])."; return false;\">`&".stripslashes($row['gildenprefix'])."`&</a>`2]`0";
                  }
                  
                  $name = $link2.' '.$args['name'];
                  break;
                  
               case 'eliguildv2':
                  break;
            }
            return $name;
            break;
      }
   }
}


/// Wrapperfunktionen
//  Wird für noch nicht vorhandene Ersetzungen gebraucht

function addcommentary() {
   define('COMMENTARY_ADD',true);
   if(isset($_POST['commentary'])) {
      $session['comment_for_insert'] = $_POST;
   }
}

function viewcommentary($section,$message="Kommentar hinzufügen?",$limit=COMMENTARY_DEFAULTLIMIT,$talkline="sagt", $arg5 = false) {
   global $session;
   $comment = new Commentary($session['user'],$section,$message,$limit,$talkline);
 
   /*   Entklammere die Untere Funktion, wenn du die Standardfarben des Users injezieren willst
    *  Der Erste Parameter ist für die Sprechfarbe, der zweite Parameter für die /me-Farbe, der dritte für die /X-Farbe. */
   #$comment->ChangeDefaultColors('`%', '`5', '`^');

   if(defined('COMMENTARY_ADD') && StrToLower($message) != 'x' && strToLower($message) != 'y') {
      $comment->Add();
   }
   
   if(strToLower($message) == 'x') {
      // Admin
      if(empty($arg5)) {
         $comment->SuView();
      }
      else {
         $comment->SuView($arg5[0], $arg5[1]);
      }
   }
   elseif(strToLower($message) == 'y') {
      // View only, Idea from anpera.NET, thanks Leen
      $comment->View(false);
   }
   else {
      // Normal *g*
      $comment->View();
   }
   
   unset($comment);
}

// Ende

?>


commentary.settings.php:
Code:
<?php
/********************************************************************
    A mod from "Basilius-Extensions"
    Class Commentary, Settingfile for v1.2.0
    2006 by Basilius "Eliwood" Sauter
   
**********************************************************************/

define('NOBIO',false);
define('COMMENTARY_TEXTAREA_COLS', 50);
define('COMMENTARY_TEXTAREA_ROWS', 3);
define('COMMENTARY_TEXTAREA_FONTFAMILY', 'serif'); // Nichts eingeben für Standard
define('COMMENTARY_TEXTAREA_SHOWCHARS', false);

define('COMMENTARY_SHOWCHARS_SIZE', 7); # Länge des "Zeichen übrig"-Feldes

define('COMMENTARY_INPUTFIELD_SIZE', 50);

define('COMMENTARY_AUTOTEXTAREA', true); # Bei mehr als COMMENTARY_AUTEXTAREA_CHARS Zeichen wird automatisch eine Textarea genommen
define('COMMENTARY_AUTEXTAREA_CHARS', 200); # konstante für oben
define('COMMENTARY_ACTIVETEXTAREA', false); # muss false sein, wenn autotextarea auf true steht :)

define('COMMENTARY_DEFAULTLIMIT', 10);
define('COMMENTARY_DEFAULTTALKLINE', 'sagt');

define('COMMENTARY_MAXLENGHT', 1000000); # Maximale Zeichen pro Post
define('COMMENTARY_USEPARAGRAPHS', true); # Paragraphen <p> anstatt <br> gebrauchen
define('COMMENTARY_ALLOWPARAGRAPHS', true); # Erlaube \n auch in Chats - Gebrauche entweder <br oder p, je nach dem, was COMMENTARY_USEPARAGRAPHS zulässt.
define('COMMENTARY_MANUALPARAGRAPHCHAR', '\n'); # Manueller Zeilenumbruch - Unter anderem für Einzeilige Textfelder
define('COMMENTARY_PARAGRAPHS_MARGIN', 1); # Abstand zwischen den Paragraphen, gemessen in em, Totale Angabe für oben+unten
define('COMMENTARY_LINEHEIGHT', 1.15); # Zeilenhöhe in em, 1.15 ist für längere Texte eindeutig bequemer zu lesen
define('COMMENTARY_USE_CHATPREVIEW', true); # auf true setzen, wenn die Chatpreview angezeigt werden soll
define('COMMENTARY_FARBHACK_IS_INSTALLED', true); # auf true setzen, wenn der Farbhack von Eliwood&Serra installiert ist

define('COMMENTARY_TIMESTAMP_DISPLAY', false); # Auf true setzen, wenn eine Zeitanzeige erfolgen soll
define('COMMENTARY_TIMESTAMP_FORMAT', 'G:i'); # Identisch mit dem ersten Parameter der Funktion date().

define('COMMENTARY_GUILDTAG_DISPLAY', false); # Auf true stellen, wenn die Gildentags angezeigt werden sollen
define('COMMENTARY_GUILDTAG_VERSION', ''); # Version der Gilden. Beliebig, wenn COMMENTARY_GUILDTAG_DISPLAY auf false. Mögliche Werte um die Gilden zu identifizieren:
                                           # Dashers Gilden:  dashguild
                                 # Eliwoods Gilden: eliguild
                                 # Eliwoods Gilden v2: eliguildv2 ***UNRELEASED***

define('COMMENTARY_DEFAULTLIMIT', 20); # Standardlimite für Angezeigte Posts
define('COMMENTARY_DEFAULTTALKLINE', 'sagt'); # Standardsprechprefix ($user sagt: "")
define('COMMENTARY_DEFAULTMESSAGE', '`iSpiele hier Rollenspiel`i'); # Standardüberschrift für den Chat

define('COMMENTARY_BIO_LINKTEMPLATE', "`0<a href=\"bio.php?char={LOGIN}&ret={REQUESTURI}\" style=\"text-decoration: none\">\r\n`&{NAME}`0</a>\r\n"); # Der Link mit Name (Anzeige) für die Bio. Geparst wird: {LOGIN}, {REQUESTURI}, {ACCTID}, {NAME}, {POPUP}
define('COMMENTARY_BIO_LINK', 'bio.php?char={LOGIN}&ret={REQUESTURI}'); # Der reine Link (Whiteliste der Navigation) für die Bio. Geparst wird: {LOGIN}, {REQUESTURI}, {ACCTID}

# Su-Betreffendes
define('COMMENTARY_LIVEDELETING_SULEVEL', 3); # Level für "Live-Deleting" - [X] in jeglichen Chats neben den Kommentaren
define('COMMENTARY_LIVEDELETING_DELETETARGET', 'superuser.php?op=commentdelete'); # Zielort für das Livedeleting
define('COMMENTARY_DISPLAYEMOTLERNAME', true); # Für Admins den Schreiber eines /X-Emotes entlarven?
define('COMMENTARY_DISPLAYEMOTLERNAME_SULEVEL', 3); # Mindest-Sulevel, das gebraucht wird, um diese Anzeige sehen zu können

if(COMMENTARY_FARBHACK_IS_INSTALLED === true) {
   define('COMMENTARY_ALLOWEDTAGS', $appoencode_str);
}
else {
   define('COMMENTARY_ALLOWEDTAGS', '123456789!@#$%&QqRr*~^?VvGgTtAa');
}
?>


Nach oben
 Profil  
 
Beiträge der letzten Zeit anzeigen:  Sortiere nach  
Ein neues Thema erstellen Auf das Thema antworten  [ 1 Beitrag ] 

Alle Zeiten sind UTC + 1 Stunde [ Sommerzeit ]


Wer ist online?

Mitglieder in diesem Forum: 0 Mitglieder


Du darfst keine neuen Themen in diesem Forum erstellen.
Du darfst keine Antworten zu Themen in diesem Forum erstellen.
Du darfst deine Beiträge in diesem Forum nicht ändern.
Du darfst deine Beiträge in diesem Forum nicht löschen.
Du darfst keine Dateianhänge in diesem Forum erstellen.

Suche nach:
Gehe zu:  
cron
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
Deutsche Übersetzung durch phpBB.de