Benutzer-Werkzeuge

Webseiten-Werkzeuge


de:clf:file0

Unterschiede

Hier werden die Unterschiede zwischen zwei Versionen angezeigt.

Link zu dieser Vergleichsansicht

Beide Seiten der vorigen Revision Vorhergehende Überarbeitung
de:clf:file0 [2018-05-23 23:37]
thorsten gelöscht
— (aktuell)
Zeile 1: Zeile 1:
-====== clf_main.php ====== 
-**Version:​** 1.1.26 beta\\ 
-**Standalone:​** no\\ 
-**Interpreter:​** PHP >4.x.x\\ 
-**Includes:​** [[de:​clf:​file1|clf_messages.php]]\\ 
-**Required functions:​** //null//\\ 
-**Required variables:​** $_POST, $phpbb_root_path,​ $phpEx 
  
- 
-<code php> 
-<?php 
- 
- // Security Check: Is this script called by a valid phpBB script? 
- if (!defined('​IN_PHPBB'​)) { 
-  header('​HTTP/​1.1 403 Forbidden'​);​ 
-  die('<​b>​403 Forbidden</​b><​br />This script cannot be called directly.'​);​ 
- } 
- 
-  
- // Define the current script version and upload path 
- ​$clf_version = '​1.1.26 beta'; 
- ​$clf_uploadpath = '​users/​temp/';​ 
-  ​ 
- // Retrieve chat log 
- ​$clf_src = $_POST['​chatlog'​];​ 
-  
-  
- // Do local file upload when set 
- if (isset($_POST['​upload'​])) { 
- 
-  // Did we receive a file? 
-  if (!isset($_FILES['​chatlog_file'​]['​tmp_name'​])) { 
-   ​$clf_errormsg = 'Die Datei wurde fehlerhaft übertragen oder konnte aus unbekanntem Grund nicht auf dem Webserver gespeichert werden. Bitte versuchen Sie den Upload erneut. Sollte das Problem fortbestehen,​ informieren Sie bitte den Administrator.';​ 
-  ​ 
-  // Did we receive a text file? 
-  } elseif (!substr($_FILES['​chatlog_file'​]['​type'​],​ 0, 5) == '​text/'​) { 
-   ​$clf_errormsg = '​Diesen Dateityp können Sie nicht hochladen. Erlaubt sind nur Textdateien.';​ 
-  ​ 
-  // Is the text file to huge? 
-  } elseif ($_FILES['​chatlog_file'​]['​size'​] > 256000) { 
-   ​$clf_errormsg = 'Diese Datei ist zu groß. Es können nur Textdateien bis maximal 250 kB verarbeitet werden.';​ 
-  ​ 
-  // Move file and get its content 
-  } else { 
-   ​$clf_filename = $phpbb_root_path . $clf_uploadpath . microtime() . '​.txt';​ 
-   ​move_uploaded_file($_FILES['​chatlog_file'​]['​tmp_name'​],​ $clf_filename);​ 
-   ​$clf_src = file_get_contents($clf_filename);​ 
-   ​unlink($clf_filename);​ 
-  } 
- ​}  ​ 
-  ​ 
-  ​ 
- // Analyse chat log when there is a chat log 
- if ($clf_src != ''​ && $clf_errormsg == ''​) { 
-  
-  // Define this as parsed stage 
-  $clf_stage = 1; 
- 
-  // Load predefined messages 
-  require_once($phpbb_root_path . '​includes/​clf_messages.'​ . $phpEx); ​ 
-  
-  // Prepare predefined arrays for preg_match 
-  $clf_systemmsg_preg = clfCreateRegExList($clf_systemmsg);​ 
-  $clf_actionmsg_preg = clfCreateRegExList($clf_actionmsg);​ 
-  ​ 
-  // Init some variables 
-  $clf_atom = array(); 
-  $clf_players = array(); 
-  $m = 0; 
-  
-  // Split chat log to single lines 
-  $clf_line = explode("​\r\n",​ $clf_src); 
-  ​ 
-  // Scan every single line 
-  for ($n=0; $n<​count($clf_line);​ $n++) { 
-   if ($clf_line[$n] != ''​) { 
-    $clf_atom[$m]['​date'​] = clfGetDate($clf_line[$n]);​ 
-    $clf_atom[$m]['​msg'​] = clfGetMsg($clf_line[$n]);​ 
-    $clf_atom[$m]['​type'​] = clfGetMsgType($clf_atom[$m]['​msg'​],​ $clf_msg_id);​ 
-    $clf_atom[$m]['​msg_id'​] = $clf_msg_id;​ 
-    
-    switch ($clf_atom[$m]['​type'​]) { 
-     case 0: // Player Chat Message | "​{player}:​ {text}"​ 
-      $clf_atom[$m]['​player'​] = clfGetMsgReferer($clf_atom[$m]['​msg'​]);​ 
-      $clf_atom[$m]['​text'​] = clfGetMsgText($clf_atom[$m]['​msg'​]);​ 
-      $clf_players[] = $clf_atom[$m]['​player'​];​ 
-      break; 
-      ​ 
-     case 1: // Player Status Message | "​{player} ({status}):"​ 
-      //​$clf_referer = clfGetMsgReferer($clf_atom[$m]['​msg'​]);​ 
-      //​$clf_atom[$m]['​player'​] = clfGetMsgPlayer_a($clf_referer);​ 
-      //​$clf_atom[$m]['​status'​] = chatlog_getmsgstatus($clf_referer);​ 
-      //​$clf_players[] = $clf_atom[$m]['​player'​];​ 
-      break; 
-      ​ 
-     case 2: // Private Message Incoming | "From {player} in {location}: {text}"​ 
-      $clf_msg = substr($clf_atom[$m]['​msg'​],​ 5); 
-      $clf_referer = clfGetMsgReferer($clf_msg);​ 
-      $clf_atom[$m]['​player'​] = clfGetMsgPlayer($clf_referer);​ 
-      $clf_atom[$m]['​location'​] = clfGetMsgLocation($clf_referer);​ 
-      $clf_atom[$m]['​text'​] = clfGetMsgText($clf_atom[$m]['​msg'​]);​ 
-      $clf_players[] = $clf_atom[$m]['​player'​];​ 
-      break; 
-      ​ 
-     case 3: // Private Reply Outgoing | "To {player} in {location}: {text}"​ 
-      $clf_msg = substr($clf_atom[$m]['​msg'​],​ 3); 
-      $clf_referer = clfGetMsgReferer($clf_msg);​ 
-      $clf_atom[$m]['​player'​] = clfGetMsgPlayer($clf_referer);​ 
-      $clf_atom[$m]['​location'​] = clfGetMsgLocation($clf_referer);​ 
-      $clf_atom[$m]['​text'​] = clfGetMsgText($clf_atom[$m]['​msg'​]);​ 
-      $clf_players[] = $clf_atom[$m]['​player'​];​ 
-      break;  ​ 
-      ​ 
-     case 4: // Private Message Outgoing | "To {playername}:​ {text}"​ 
-      $clf_msg = substr($clf_atom[$m]['​msg'​],​ 3); 
-      $clf_atom[$m]['​player'​] = clfGetMsgReferer($clf_msg);​ 
-      $clf_atom[$m]['​text'​] = clfGetMsgText($clf_atom[$m]['​msg'​]);​ 
-      $clf_players[] = $clf_atom[$m]['​player'​]; ​     ​ 
-      break; 
-      
-     case 5: // System Message | "​{text}"​ 
-      clfExplodeSystemMsg($clf_atom[$m]['​msg'​],​ $clf_atom[$m]['​msg_id'​],​ $clf_player,​ $clf_text); 
-      $clf_atom[$m]['​player'​] = $clf_player;​ 
-      $clf_atom[$m]['​text'​] = $clf_text; 
-      break; 
-      ​ 
-     case 6: // Action Message | "​{text{player}text}"​ 
-      clfExplodeActionMsg($clf_atom[$m]['​msg'​],​ $clf_atom[$m]['​msg_id'​],​ $clf_player,​ $clf_text); 
-      $clf_atom[$m]['​player'​] = $clf_player;​ 
-      $clf_atom[$m]['​text'​] = $clf_text; 
-      $clf_players[] = $clf_atom[$m]['​player'​];​ 
-      break; 
-      ​ 
-     case 7: // Personal Action Message | "​{player} {text}"​ 
-      // We cannot get any useful information in this stage, needs a second pass 
-      break; 
-      ​ 
-     case 8: // Error Message | "​Error:​ {text}"​ 
-      $clf_atom[$m]['​text'​] = substr($clf_atom[$m]['​msg'​],​ 7); 
-      break; 
-      ​ 
-     case 9: // Private Reply Incoming | "From {playername}:​ {text}"​ 
-      $clf_msg = substr($clf_atom[$m]['​msg'​],​ 5); 
-      $clf_atom[$m]['​player'​] = clfGetMsgReferer($clf_msg);​ 
-      $clf_atom[$m]['​text'​] = clfGetMsgText($clf_atom[$m]['​msg'​]);​ 
-      $clf_players[] = $clf_atom[$m]['​player'​]; ​     ​ 
-      break; 
-      ​ 
-     case 10: // Fun Messages | "There is no feather."​ 
-      // Nobody needs them in a chatlog anyway, so dump them 
-      break; ​     
-    } 
-    $m++; 
-   } 
-  } 
-  
-  // Remove duplicates from player list and sort it 
-  $clf_players = array_unique($clf_players);​ 
-  sort($clf_players);​ 
-  ​ 
-  // Second pass for personal action messages 
-  for ($n=0; $n<​count($clf_atom);​ $n++) { 
-   if ($clf_atom[$n]['​type'​] == 7) { 
-    $clf_playerfound = clfExplodePersActionMsg($clf_atom[$n]['​msg'​],​ $clf_player,​ $clf_text); 
-    $clf_atom[$n]['​player'​] = $clf_player;​ 
-    $clf_atom[$n]['​text'​] = $clf_text; 
-    ​ 
-    if (!$clf_playerfound) { 
-     ​$clf_players[] = $clf_atom[$n]['​player'​];​ 
-     ​$clf_playersexpanded = true; 
-    } 
-   } 
-  } 
-  ​ 
-  // If there are new players in the list after second pass, remove duplicates and sort again 
-  if ($clf_playersexpanded) { 
-   ​$clf_players = array_unique($clf_players);​ 
-   ​sort($clf_players);​ 
-  } 
- 
-  // Format the chat log 
-  if (isset($_POST['​format'​])) { 
-  ​ 
-   // Define this as final stage 
-   ​$clf_stage = 2; 
-  ​ 
-   // Preserve the chat log and clear it 
-   // $clf_old = $clf_src; 
-   ​$clf_src = '';​ 
-    
-   // Create a format string for the selected date format 
-   ​switch ($_POST['​date-type'​]) { 
-    case 0: // Remove the date 
-     ​$clf_dateformat = '';​ break; 
-    case 1: // Uru Live format 
-     ​$clf_dateformat = '\[m/d H:​i:​s\]';​ break; 
-    case 2: // Format of the forum 
-     ​$clf_dateformat = '​\['​ . $board_config['​default_dateformat'​] . '​\]';​ break; 
-    case 3: // Format of the user, if available; otherwise as case 2 
-     ​$clf_dateformat = '​\['​ . ($userdata['​user_dateformat'​] == ''​ ? $board_config['​default_dateformat'​] : $userdata['​user_dateformat'​]) . '​\]';​ break; ​   
-    case 4: // User-defined format 
-     ​$clf_dateformat = $_POST['​date-format'​];​ break; 
-    case 5: // Only time (European) 
-     ​$clf_dateformat = '​\[H:​i:​s\]';​ break; 
-    case 6: // Only time (American) 
-     ​$clf_dateformat = '​\[h:​i:​s a\]'; break; 
-   } 
-    
-   // Determine the missing year 
-   if ($_POST['​dateyear'​] >= 1970 && $_POST['​dateyear'​] <= 2037) { 
-    $clf_dateyear = (int)$_POST['​dateyear'​];​ 
-   } else { 
-    $clf_dateyear = date('​Y',​ time()); 
-   } 
-    
-   // Compile every single line 
-   for ($n=0; $n<​count($clf_atom);​ $n++) { 
-    $clf_date = '';​ 
-    $clf_output = '';​ 
-    
-    // Format the date/time stamp 
-    if ($clf_dateformat != ''​) { 
-     ​$clf_date = clfDateFormat($clf_atom[$n]['​date'​],​ $clf_dateyear,​ $clf_dateformat);​ 
-     ​$clf_date = clfFormat($clf_date,​ '​date'​); ​   ​ 
-     ​$clf_date .= ' '; 
-    } 
-    ​ 
-    // Dertemine the player key 
-    $clf_playerkey = clfGetPlayerKey($clf_atom[$n]['​player'​]);​ 
-    ​ 
-    switch ($clf_atom[$n]['​type'​]) { 
-     case 0: // Player Chat Message 
-      if ($_POST['​chat-type'​] > 0 && $_POST[$clf_playerkey . '​-type'​] > 0) { 
-       ​$clf_output = clfReplaceDiacritics($clf_atom[$n]['​text'​],​ $_POST['​diacritics-type'​]); ​       
-       ​$clf_output = $clf_atom[$n]['​player'​] . ': ' . $clf_output;​ 
-       ​$clf_output = clfFormat($clf_output,​ $clf_playerkey,​ '​chat'​);​ 
-       ​$clf_output = $clf_date . $clf_output . "​\r\n";​ 
-      } 
-      break; 
-      
-     case 1: // Player Status Message 
-      //if ($_POST['​status-type'​] > 0 && $_POST[$clf_playerkey . '​-type'​] > 1) { 
-      // $clf_output = $clf_atom[$n]['​player'​] . ' (' . $clf_atom[$n]['​status'​] . '​)';​ 
-      // $clf_output = chatlog_format($clf_output,​ $clf_playerkey,​ '​status'​);​ 
-      // $clf_output = $clf_date . $clf_output . "​\r\n";​ 
-      //} 
-      break; 
-      
-     case 2: // Private Message Incoming 
-      if ($_POST['​pm-type'​] > 1 && $_POST[$clf_playerkey . '​-type'​] > 2) { 
-       ​$clf_output = clfReplaceDiacritics($clf_atom[$n]['​text'​],​ $_POST['​diacritics-type'​]); ​       
-       ​$clf_output = 'Von ' . $clf_atom[$n]['​player'​] . ' in ' . $clf_atom[$n]['​location'​] . ': ' . $clf_output;​ 
-       ​$clf_output = clfFormat($clf_output,​ $clf_playerkey,​ '​pm'​);​ 
-       ​$clf_output = $clf_date . $clf_output . "​\r\n";​ 
-      } 
-      break; 
-      ​ 
-     case 3: // Private Replay Outgoing 
-      if (($_POST['​pm-type'​] == 1 || $_POST['​pm-type'​] > 2) && $_POST[$clf_playerkey . '​-type'​] > 2) { 
-       ​$clf_output = clfReplaceDiacritics($clf_atom[$n]['​text'​],​ $_POST['​diacritics-type'​]); ​       
-       ​$clf_output = 'An ' . $clf_atom[$n]['​player'​] . ' in ' . $clf_atom[$n]['​location'​] . ': ' . $clf_output;​ 
-       ​$clf_output = clfFormat($clf_output,​ $clf_playerkey,​ '​pm'​);​ 
-       ​$clf_output = $clf_date . $clf_output . "​\r\n";​ 
-      } 
-      break; 
-      ​ 
-     case 4: // Private Message Outgoing 
-      if (($_POST['​pm-type'​] == 1 || $_POST['​pm-type'​] > 2) && $_POST[$clf_playerkey . '​-type'​] > 2) { 
-       ​$clf_output = clfReplaceDiacritics($clf_atom[$n]['​text'​],​ $_POST['​diacritics-type'​]); ​       
-       ​$clf_output = 'An ' . $clf_atom[$n]['​player'​] . ': ' . $clf_output;​ 
-       ​$clf_output = clfFormat($clf_output,​ $clf_playerkey,​ '​pm'​);​ 
-       ​$clf_output = $clf_date . $clf_output . "​\r\n";​ 
-      } 
-      break; 
-      ​ 
-     case 5: // System Message 
-      if ($_POST['​system-type'​] > 0) { 
-       if ($_POST['​system-type'​] == 1) { 
-        $clf_output = $clf_atom[$n]['​msg'​];​ 
-       } else { 
-        $clf_output = clfSystemMsgTranslate($clf_atom[$n]['​player'​],​ $clf_atom[$n]['​msg_id'​]);​ 
-       ​} ​       
-       ​$clf_output = clfFormat($clf_output,​ '​system'​);​ 
-       ​$clf_output = $clf_date . $clf_output . "​\r\n";​ 
-      } 
-      break; 
-      
-     case 6: // Action Message 
-      if ($_POST['​action-type'​] > 0 && $_POST[$clf_playerkey . '​-type'​] > 1) { 
-       if ($_POST['​action-type'​] == 1) { 
-        $clf_output = $clf_atom[$n]['​msg'​];​ 
-       } else { 
-        $clf_output = clfActionMsgTranslate($clf_atom[$n]['​player'​],​ $clf_atom[$n]['​msg_id'​]);​ 
-       } 
-       ​$clf_output = clfFormat($clf_output,​ $clf_playerkey,​ '​action'​);​ 
-       ​$clf_output = $clf_date . $clf_output . "​\r\n";​ 
-      } 
-      break; 
-      ​ 
-     case 7: // Personal Action Message 
-      if ($_POST['​action-type'​] > 0 && $_POST[$clf_playerkey . '​-type'​] > 1) { 
-       ​$clf_output = clfReplaceDiacritics($clf_atom[$n]['​text'​],​ $_POST['​diacritics-type'​]);​ 
-       ​$clf_output = $clf_atom[$n]['​player'​] . ' ' . $clf_output;​ 
-       ​$clf_output = clfFormat($clf_output,​ $clf_playerkey,​ '​action'​);​ 
-       ​$clf_output = $clf_date . $clf_output . "​\r\n";​ 
-      } 
-      break; 
-      ​ 
-     case 8: // Error Message 
-      if ($_POST['​error-type'​] > 0) { 
-       ​$clf_output = '​Fehler:​ ' . $clf_atom[$n]['​text'​];​ 
-       ​$clf_output = clfFormat($clf_output,​ '​error'​);​ 
-       ​$clf_output = $clf_date . $clf_output . "​\r\n"; ​     ​ 
-      } 
-      break; 
-      ​ 
-     case 9: // Private Reply Incoming 
-      if (($_POST['​pm-type'​] > 1) && $_POST[$clf_playerkey . '​-type'​] > 2) { 
-       ​$clf_output = clfReplaceDiacritics($clf_atom[$n]['​text'​],​ $_POST['​diacritics-type'​]); ​       
-       ​$clf_output = 'Von ' . $clf_atom[$n]['​player'​] . ': ' . $clf_output;​ 
-       ​$clf_output = clfFormat($clf_output,​ $clf_playerkey,​ '​pm'​);​ 
-       ​$clf_output = $clf_date . $clf_output . "​\r\n";​ 
-      } 
-      break; 
-    } 
-    //$chatlog .= '​['​ . $clf_atom[$n]['​type'​] . '] '; 
-    $clf_src .= $clf_output;​ 
-   } 
-  } 
- } 
-  
-  
- // Extracts the date/time stamp from a chatline 
- ​function clfGetDate ($chatline) { 
-  return substr($chatline,​ 0, strpos($chatline,​ ') ') + 1); 
- } 
-  
- // Extracts the message from a chatline 
- ​function clfGetMsg ($chatline) { 
-  return substr($chatline,​ strpos($chatline,​ ') ') + 2); 
- } 
-  
- // Extracts the referer from a message 
- ​function clfGetMsgReferer ($chatmsg) { 
-  $chatreferer = substr($chatmsg,​ 0, strpos($chatmsg,​ ': ')); 
-  return trim($chatreferer);​ 
- } 
-  
- // Extracts the text from a message 
- ​function clfGetMsgText ($chatmsg) { 
-  $chattext = substr($chatmsg,​ strpos($chatmsg,​ ': ') + 1); 
-  return trim($chattext);​ 
- } 
-  
- // Extracts the player from a referer 
- ​function clfGetMsgPlayer ($chatreferer) { 
-  $chatplayer = substr($chatreferer,​ 0, strpos($chatreferer,​ ' in ')); 
-  return trim($chatplayer);​ 
- } 
-  
- // Extracts the location of the player from a referer 
- ​function clfGetMsgLocation ($chatreferer) { 
-  $chatlocation = substr($chatreferer,​ strpos($chatreferer,​ ' in ') + 4); 
-  return trim($chatlocation);​ 
- ​} ​ 
-  
-  
-  
-  
- ​function chatlog_getmsgplayer_a ($chatreferer) { 
-  return substr($chatreferer,​ 0, strpos($chatreferer,​ ' (')); 
- } 
-  
- // Extracts player and text from a sytem message 
- ​function clfExplodeSystemMsg ($chatmsg, $msgid, &​$chatplayer,​ &​$chattext) { 
-  global $clf_systemmsg_preg;​ 
-  ​ 
-  if (preg_match($clf_systemmsg_preg[$msgid],​ $chatmsg, $res) == 1) { 
-   ​$chatplayer = $res[1]; 
-   ​$chattext = str_replace($chatplayer,​ '​%1',​ $chatmsg); 
-   ​return true; 
-  } 
- ​} ​   ​ 
- 
- // Extracts player and text from a action message 
- ​function clfExplodeActionMsg ($chatmsg, $msgid, &​$chatplayer,​ &​$chattext) { 
-  global $clf_actionmsg_preg;​ 
-  ​ 
-  if (preg_match($clf_actionmsg_preg[$msgid],​ $chatmsg, $res) == 1) { 
-   ​$chatplayer = trim($res[1]);​ 
-   ​$chattext = str_replace($chatplayer,​ '​%1',​ $chatmsg); 
-   ​return true; 
-  } 
- } 
-  
- // Extracts player and text from a personal action message 
- ​function clfExplodePersActionMsg ($chatmsg, &​$chatplayer,​ &​$chattext) { 
-  global $clf_players;​ 
-  ​ 
-  // First try: Check player list for matching player names 
-  for ($n=0; $n<​count($clf_players);​ $n++) { 
-   if (substr($chatmsg,​ 0, strlen($clf_players[$n]) + 1)  == $clf_players[$n] . ' ') { 
-    $chatplayer = $clf_players[$n];​ 
-    $chattext = substr($chatmsg,​ strlen($chatplayer) + 1); 
-    return true; 
-   } 
-  } 
-  ​ 
-  // Second try: Suppose player name has no whitespaces in between and split at first whitespace 
-  $whitespace_pos = strpos($chatmsg,​ ' ', 1); 
-  $chatplayer = substr($chatmsg,​ 0, $whitespace_pos);​ 
-  $chattext = substr($chatmsg,​ $whitespace_pos + 1); 
-  return false;  ​ 
- } 
-  
- // Tries to determine the type of a message 
- ​function clfGetMsgtype ($chatmsg, &​$msgid) { 
-  if (substr($chatmsg,​ 0, 1) == ' ') { 
-   if (substr($chatmsg,​ 1, 2) == ' ') { 
-    return 10; // Fun Message 
-   } else { 
-    $chatmsg = trim($chatmsg);​ 
-    if (substr($chatmsg,​ strlen($chatmsg) - 1, 1) == ':'​) { 
-     ​return 1; // Player Status Message 
-    } else { 
-     ​return 0; // Player Chat Message 
-    } 
-   } 
-  } else { 
-   if (substr($chatmsg,​ 0, 3) == 'To ') { 
-    if (strpos(clfGetMsgReferer($chatmsg),​ ' in ') > 0) { 
-     ​return 3; // Private Reply Outgoing 
-    } else { 
-     ​return 4; // Private Message Outgoing 
-    } 
-   } elseif (substr($chatmsg,​ 0, 5) == 'From ') { 
-    if (strpos(clfGetMsgReferer($chatmsg),​ ' in ') > 0) { 
-     ​return 2; // Private Message Incoming 
-    } else { 
-     ​return 9; // Private Reply Incoming 
-    } 
-   } elseif (substr($chatmsg,​ 0, 7) == '​Error:​ ') { 
-    return 8; // Error 
-   } elseif (clfIsSystemMsg($chatmsg,​ $msgid)) { 
-    return 5; // System Message 
-   } elseif (clfIsActionMsg($chatmsg,​ $msgid)) { 
-    return 6; // Action Message 
-   } else { 
-    return 7; // Personal Action Message 
-   } 
-  } 
- } 
-  
- // Detects if message matches a known system message 
- ​function clfIsSystemMsg ($chatmsg, &​$msgid) { 
-  global $clf_systemmsg_preg;​ 
-  ​ 
-  for ($n=0; $n<​count($clf_systemmsg_preg);​ $n++) { 
-   if (preg_match($clf_systemmsg_preg[$n],​ $chatmsg) == 1) { 
-    $msgid = $n; return true; 
-   } 
-  } 
- } 
-  
- // Detects if message matches a known action message 
- ​function clfIsActionMsg ($chatmsg, &​$msgid) { 
-  global $clf_actionmsg_preg;​ 
-  ​ 
-  for ($n=0; $n<​count($clf_actionmsg_preg);​ $n++) { 
-   if (preg_match($clf_actionmsg_preg[$n],​ $chatmsg) == 1) { 
-    $msgid = $n; return true; 
-   } 
-  } 
- } 
-  
- // Converts all strings inside an array to a regular expression, replacing %1 with a 
- // variable term 
- ​function clfCreateRegExList ($list) { 
-  for ($n=0; $n<​count($list);​ $n++) { 
-   ​$list[$n] = '/​^'​ . str_replace('​%1',​ '​(.+)',​ preg_quote($list[$n])) . '​$/';​ 
-  } 
-  return $list; 
- } 
-  
- 
-  
- 
-  
- ​function chatlog_getmsgstatus ($chatreferer) { 
-  $chatreferer = substr($chatreferer,​ strpos($chatreferer,​ ' (' + 2)); 
-  return substr($chatrefer,​ 0, strlen($chatreferer) - 1); 
- } 
-  
- 
-  
- 
- // Converts a date/time stamp to another format 
- ​function clfDateFormat ($datestring,​ $datestring_date_year,​ $dateformat) { 
-  $datestring = substr($datestring,​ 1, strlen($datestring) - 2); 
-  ​ 
-  $datestring_split = explode('​ ', $datestring,​ 2); 
-  $datestring_date = $datestring_split[0];​ 
-  $datestring_time = $datestring_split[1];​ 
-  ​ 
-  $datestring_date_split = explode('/',​ $datestring_date,​ 2); 
-  $datestring_date_month = $datestring_date_split[0];​ 
-  $datestring_date_day = $datestring_date_split[1];​ 
-  ​ 
-  $datestring_time_split = explode(':',​ $datestring_time,​ 3); 
-  $datestring_time_hour = $datestring_time_split[0];​ 
-  $datestring_time_minute = $datestring_time_split[1];​ 
-  $datestring_time_second = $datestring_time_split[2];​ 
-  ​ 
-  $timestamp = mktime($datestring_time_hour,​ $datestring_time_minute,​ $datestring_time_second,​ 
-   ​$datestring_date_month,​ $datestring_date_day,​ $datestring_date_year);​ 
-    
-  return date($dateformat,​ $timestamp); ​ 
- } 
- 
- // BB code format a string 
- ​function clfFormat ($string, $key1, $key2 = ''​) { 
-  if (isset($_POST[$key1 . '​-style-underline'​]) || isset($_POST[$key2 . '​-style-underline'​])) 
-   ​$string = '​[u]'​ . $string . '​[/​u]';​ 
-  if (isset($_POST[$key1 . '​-style-italic'​]) || isset($_POST[$key2 . '​-style-italic'​])) 
-   ​$string = '​[i]'​ . $string . '​[/​i]';​ 
-  if (isset($_POST[$key1 . '​-style-bold'​]) || isset($_POST[$key2 . '​-style-bold'​])) 
-   ​$string = '​[b]'​ . $string . '​[/​b]';​ 
-  if ($_POST[$key1 . '​-style-color'​] != ''​) 
-   ​$string = '​[color='​ . $_POST[$key1 . '​-style-color'​] . '​]'​ . $string . '​[/​color]';​ 
-  elseif ($_POST[$key2 . '​-style-color'​] != ''​) 
-   ​$string = '​[color='​ . $_POST[$key2 . '​-style-color'​] . '​]'​ . $string . '​[/​color]';​ 
-  return $string; 
- } 
-  
- // Create a unique, html valid player key 
- ​function clfGetPlayerKey ($player) { 
-  return '​player-'​ . rawurlencode($player);​ 
- ​} ​ 
-  
- // Translate a system message 
- ​function clfSystemMsgTranslate ($chatplayer,​ $msgid) { 
-  global $clf_systemmsg_de;​ 
-  return str_replace('​%1',​ $chatplayer,​ $clf_systemmsg_de[$msgid]);​ 
- } 
-  
- // Translate an action message 
- ​function clfActionMsgTranslate ($chatplayer,​ $msgid) { 
-  global $clf_actionmsg_de;​ 
-  return str_replace('​%1',​ $chatplayer,​ $clf_actionmsg_de[$msgid]);​ 
- } 
-  
- // Replace paraphrased German diacritics with umlauts and sharp S 
- ​function clfReplaceDiacritics ($string, $mode) { 
-  if ($mode > 0) { 
-   ​$string = str_replace('​Ae',​ '​Ä',​ $string); 
-   ​$string = str_replace('​Oe',​ '​Ö',​ $string); 
-   ​$string = str_replace('​Ue',​ '​Ü',​ $string); 
-   ​$string = str_replace('​ae',​ '​ä',​ $string); 
-   ​$string = str_replace('​oe',​ '​ö',​ $string); 
-   ​$string = preg_replace('/​([^(a|ä|e|u|q)])ue/',​ '​$1ü',​ $string); 
-  ​ 
-   if ($mode > 1) { 
-    $string = preg_replace('/​(ah|äh|eh|ih|oh|öh|uh|üh|aa|äa|ee|ii|oo|öo|uu|üu|ai|au|äu|ei|eu|ie|ui)ss/',​ '​$1ß',​ $string); 
-   } 
-  } 
-  return $string; 
- } 
-  
-?> 
-</​code>​