-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Hi,
I'm not quiet sure if this is the best way or even the right place to send my idea of a webinterface to. The code is php and uses a apache-mod for ssh while sending messages or getting the name of the user. For authorization it is necessary to use the basic-mode. It is everything else than complete but maybe someone is interested in it. At least it is very hardly commented and it might not work with other languages than english. Good bye and thank you for centerim! Thomas Add to /etc/apache2/sites-enabled/default - ------------------------------------------------------- Alias /centerim/ "/home/user/center/" <Directory "/home/user/center/"> Options Indexes MultiViews Order allow,deny allow from all AllowOverride None AuthType Basic Authname "Centerim History" AuthUserFile /etc/apache2/basic Require valid-user </Directory> - ------------------------------------------------------- Index.php - ------------------------------------------------------- <?php $ShowLines = isset($_GET['lines'])==true?$_GET['lines']:0; $ShowLines = isset($_POST['lines'])==true?$_POST['lines']:$ShowLines; $CountEvents = isset($_GET['countevents'])==true?$_GET['countevents']:1; $CountEvents = isset($_POST['countevents'])==true?$_POST['countevents']:$CountEvents; $ID = isset($_GET['ID'])==true?$_GET['ID']:-1; $Group = isset($_GET['Group'])==true?$_GET['Group']:-1; $TS = isset($_GET['TS'])==true?$_GET['TS']:-1; $user = $_SERVER['PHP_AUTH_USER']; $mainRoot = "/home/".$user."/.centerim/"; $msg = isset($_POST['msg'])==true?$_POST['msg']:""; $sendmsg = isset($_POST['sendmsg'])==true?true:false; $readlmsg = isset($_POST['readlmsg'])==true?true:false; $jab_ac = isset($_POST['jab'])==true?$_POST['jab']:""; $icq_ac = isset($_POST['icq'])==true?$_POST['icq']:""; $yah_ac = isset($_POST['yah'])==true?$_POST['yah']:""; $msn_ac = isset($_POST['msn'])==true?$_POST['msn']:""; $aim_ac = isset($_POST['aim'])==true?$_POST['aim']:""; $lj_ac = isset($_POST['lj'])==true?$_POST['lj']:""; $jab_ac = $jab_ac=='0'?"":$_POST['jab']; $icq_ac = $icq_ac=='0'?"":$_POST['icq']; $yah_ac = $yah_ac=='0'?"":$_POST['yah']; $msn_ac = $msn_ac=='0'?"":$_POST['msn']; $aim_ac = $aim_ac=='0'?"":$_POST['aim']; $lj_ac = $lj_ac=='0'?"":$_POST['lj']; $host = "127.0.0.1"; $port = 22; $pw = $_SERVER['PHP_AUTH_PW']; $statu = array('0' => 'unchanged', 'o' => 'online', '_' => 'offline', 'a' => 'away', 'd' => 'do not disturb', 'n' => 'not avialable', 'l' => 'out for lunch', 'c' => 'occupied', 'f' => 'free for chat', 'i' => 'invisble'); $restatu = array('0' => 'unchanged', 'online' => 'o', 'offline' => '_', 'away' => 'a', 'do not disturb' => 'd', 'dnd' => 'd', 'not avialable' => 'n', 'n/a' => 'n', 'out for lunch' => 'l', 'occupied' => 'c', 'free for chat' => 'f', 'invisible' => 'i'); ?> <html> <head> <title> HistoPHP - centerim-history-viewer </title> <link rel=stylesheet type="text/css" href="styles.css"> </head> <body> <?php $connection = ssh2_connect($host, $port); ssh2_auth_password($connection, $user, $pw); $reply = ""; $realname = ""; $command = "finger -m ".$user." | grep Name:"; $stream = ssh2_exec($connection, $command); stream_set_blocking($stream, true); while($o=fgets($stream)) { $realname = $reply.$o; } $realname = explode("Name: ", $realname); $realname = $realname[1]; $LogFile = fopen($mainRoot."log", 'r'); $Log = array(); $FileCounter = 2; $LineCounter = 1; $Log[$LineCounter] = ""; $OwnStatu = array(); $self = array(); $statuse = array(); do { $InLineCounter = 0; $Log[$LineCounter] = ""; $ok = false; do { fseek($LogFile, -$FileCounter, SEEK_END); $Log[$LineCounter] = $Log[$LineCounter].fgetc($LogFile); $FileCounter++; }while($Log[$LineCounter]{$InLineCounter++} != chr(10)); if ((substr_compare(strrev($Log[$LineCounter]), "incoming message", 27, 16) == 0) || (substr_compare(strrev($Log[$LineCounter]), "outgoing message", 27, 16) == 0)) continue; $proto = substr(strrev($Log[$LineCounter]), 27); $proto = explode("[", $proto); $proto = explode("]", $proto[1]); $proto = trim($proto[0]); $buddy = explode("]", strrev($Log[$LineCounter])); $buddy = explode("(", $buddy[1]); $buddy = trim($buddy[0]); $newstat = explode(")", $Log[$LineCounter]); $newstat = trim(strrev($newstat[0])); if ($newstat{0} == "[") { $newstat = explode("[", $newstat); $newstat = explode("]", $newstat[1]); $newstat = trim($newstat[0]); $ok = true; } elseif (strcmp($newstat, "went offline") == 0) { $newstat = "offline"; $ok = true; } elseif (strcmp(substr($newstat, 0, 6), "is now") == 0) { $newstat = explode(",", substr($newstat, 6)); $newstat = trim($newstat[0]); $ok = true; } elseif ($buddy == "") { $proto = explode(":", $newstat); if (isset($proto[4]) == false) { $proto = explode("changed our", $proto[3]); $proto = explode("status to", $proto[1]); $newstat = explode("from", $proto[1]); $newstat = trim($newstat[0]); $proto = trim($proto[0]); } else { $newstat = explode("status", $proto[4]); $proto = trim($proto[3]); $newstat = trim($newstat[1]); } } $dirname = (((strcmp($proto, "icq")!=0)?$proto{0}:"").$buddy); if ((isset($statuse[$dirname]) == false) && ($buddy != "")) $statuse[$dirname] = $restatu[strtolower($newstat)]; elseif (($buddy == "") && (isset($self[$proto])==false)) $self[$proto] = $restatu[strtolower($newstat)]; }while(substr_compare(strrev($Log[$LineCounter++]), ": events log started", 25) != 0); if ($sendmsg == true) { $command = "echo '".str_replace("'", "", $msg)."' | centerim -s msg -p ".($ID{0}=='j'?"jab":($ID{0}=='y'?"yahoo":"icq"))." -t ".(($ID{0}=='j' || $ID{0}=='y')?substr($ID, 1):$ID); $stream = ssh2_exec($connection, $command); stream_set_blocking($stream, true); while($o=fgets($stream)) { $reply = $reply.$o; } if (strcmp(substr($reply, 0, 11), "message to")) $reply = "Message send.\n"; } if ($jab_ac != "" && $jab_ac != $self['jab']) { $command = "centerim -S $jab_ac -p jab"; $stream = ssh2_exec($connection, $command); $reply = $reply."Jabber-Status changed to $statu[$jab_ac].\n"; } if ($icq_ac != "" && $icq_ac != $self['icq']) { $command = "centerim -S $icq_ac -p icq"; $stream = ssh2_exec($connection, $command); $reply = $reply."ICQ-Status changed to $statu[$icq_ac].\n"; } if ($yah_ac != "" && $yah_ac != $self['yahoo']) { $command = "centerim -S $yah_ac -p yahoo"; $stream = ssh2_exec($connection, $command); $reply = $reply."Yahoo-Status changed to $statu[$yah_ac].\n"; } if ($aim_ac != "" && $aim_ac != $self['aim']) { $command = "centerim -S $aim_ac -p aim"; $stream = ssh2_exec($connection, $command); $reply = $reply."AIM-Status changed to $statu[$aim_ac].\n"; } if ($msn_ac != "" && $msn_ac != $self['msn']) { $command = "centerim -S $msn_ac -p msn"; $stream = ssh2_exec($connection, $command); $reply = $reply."MSN-Status changed to $statu[$msn_ac].\n"; } if ($lj_ac != "" && $lj_ac != $self['lj']) { $command = "centerim -S $lj_ac -p lj"; $stream = ssh2_exec($connection, $command); $reply = $reply."LJ-Status changed to $statu[$lj_ac].\n"; } $Menu = ""; $Groups[] = array(); $GroupEvents[] = array(); $GroupFile = file($mainRoot."groups"); $MainDir = opendir($mainRoot); while (false !== ($filename = readdir($MainDir))) $BuddyList[] = $filename; sort($BuddyList); $Buddy = 2; // I have to start with 2, because of the two 'directories' "." and "..". while ($Buddy < count($BuddyList)) { $Buddyname = $BuddyList[$Buddy]; $BuddyDirectory = $mainRoot.$Buddyname; if (file_exists($BuddyDirectory."/history")) { $InfoFile = file($BuddyDirectory."/info"); $LastreadFile = fopen($BuddyDirectory."/lastread", "r"); $HistoryFile = fopen($BuddyDirectory."/history", "r"); $About = file_get_contents($BuddyDirectory."/about", "r"); $Lastread = intval(fgets($LastreadFile)); fclose($LastreadFile); $History = fread($HistoryFile, filesize($BuddyDirectory."/history")); $Events = substr_count($History, "\x0C\x0AOUT\x0AMSG")+substr_count($History, "\x0C\x0AIN\x0AMSG"); $AllEvents += $Events; $LastMessage = explode("\x0C\x0AIN\x0AMSG\x0A", $History); $LastMessage = explode("\x0A", end($LastMessage)); if ($readlmsg == true && strcmp($Buddyname, $ID)==0) { $LastreadFile = fopen($BuddyDirectory."/lastread", "w"); fwrite($LastreadFile, strval($LastMessage[0])); $Lastread = $LastMessage[0]; } $msgertyp = $Buddyname{0}=='j'?1:($Buddyname{0}=='y'?2:($Buddyname{0}=='a'?3:($Buddyname {0}=='l'?4:($Buddyname{0}=='r'?5:0)))); // 0 ICQ, 1 Jabber, 2 Yahoo, 3 AIM, 4 LJ, 5 RSS $time = date('U'); $BuddyStatus = (isset($statuse[$Buddyname])==true && $statuse[$Buddyname]!='_')?("[".$statuse[$Buddyname]."] "):"[_] "; if ($LastMessage[0] > $Lastread) $PreMenu = $PreMenu."\t\t\t<a href='index.php?ID=$Buddyname&Group=$Group&TS=$time&lines=$ShowLines&countev ents=$CountEvents#end' title='".($msgertyp==1?'JABBER:':($msgertyp==2?'Yahoo:':($msgertyp==3?'AIM:' :($msgertyp==4?'LJ:':($msgertyp==5?'RSS:':'ICQ#:')))))." $Buddyname' class='".($msgertyp==1?'jab':($msgertyp==2?'yahoo':($msgertyp==3?'aim':($msg ertyp==4?'lj':($msgertyp==5?'rss':'icq')))))."'>\n\t\t\t\t".$BuddyStatus.htm lentities(trim($InfoFile[45]).($CountEvents==1?" [$Events events]":""))."<br>\n\t\t\t</a>\n"; $Groups[$InfoFile[51]] = $Groups[$InfoFile[51]]."\t\t\t<a href='index.php?ID=$Buddyname&Group=$Group&TS=$time&lines=$ShowLines&countev ents=$CountEvents#end' title='".($msgertyp==1?'JABBER:':($msgertyp==2?'Yahoo:':($msgertyp==3?'AIM:' :($msgertyp==4?'LJ:':($msgertyp==5?'RSS:':'ICQ#:')))))." $Buddyname' class='".($msgertyp==1?'jab':($msgertyp==2?'yahoo':($msgertyp==3?'aim':($msg ertyp==4?'lj':($msgertyp==5?'rss':'icq')))))."'>\n\t\t\t\t".$BuddyStatus.htm lentities(trim($InfoFile[45]).($CountEvents==1?" [$Events events]":""))."<br>\n\t\t\t</a>\n"; $GroupEvents[$InfoFile[51]] += $Events; } $Buddy++; } foreach($GroupFile as $GroupLine) { $GroupArray = explode("\t", $GroupLine); $Menu = $Menu."\t\t\t<a href='index.php?lines=$ShowLines&countevents=$CountEvents".((strcmp($Group, $GroupArray[0]) == 0)?"":"&Group=$GroupArray[0]&TS=$time")."' class='centerim'>\n\t\t\t\t<b style='text-weight:bolder;'>\n\t\t\t\t\t".htmlentities(trim($GroupArray[1])) .($CountEvents==1?" [".$GroupEvents[$GroupArray[0]."\n"]." events]":"")."<br>\n\t\t\t\t</b>\n\t\t\t</a>\n"; if ($GroupArray[0] == $Group || $Group == 0) $Menu = $Menu.$Groups[$GroupArray[0]."\n"]; } ?> <div style="height:100%;max-height:100%;width:20%;float:left;"> <div style="height:10%;max-height:10%;width:100%;float:none;"> logged in as <?php echo $user; ?><br /> <a href="index.php<?php echo $Group==0?"?TS=$time&lines=$ShowLines&countevents=$CountEvents":"?Group=0&TS =$time&lines=$ShowLines&countevents=$CountEvents"; ?>"><b id='head'>ALL</b></a><b id='head'>/</b><a href="index.php?TS=<?php echo $time."&lines=$ShowLines&countevents=$CountEvents"; ?>"><b id='head'>NONE</b></a><b id='head'><?php echo ($CountEvents==1?" [$AllEvents events]":""); ?></b> <br /><b id='head'><?php echo date("r"); ?></b> </div> <div style="height:90%;max-height:90%;width:100%;overflow:auto;line-height:125%;" > <?php echo $PreMenu; echo $Menu; echo "<br />"; if ($ID != -1 && $ID{0} != 'l') { ?> <form action='index.php?ID=<?php echo "$ID&Group=$Group&TS=$time&lines=$ShowLines&countevents=$CountEvents"; ?>#end' method=POST> <?php if ($ID{0} != 'r' || $reply != "") { ?> <textarea rows='7' name='msg' class='centerim' id='me' style='width:95%;'><?php echo $reply; ?></textarea> <br /> <?php } ?> <b class='jab'>jab: </b><select name='jab' size='1' class='centerim'> <option value='0' <?php echo (isset($self['jab'])==false?"selected>":">").$statu['0']; ?></option> <option value='o' <?php echo (($self['jab'])=='o'?"selected>":">").$statu['o']; ?></option> <option value='_' <?php echo (($self['jab'])=='_'?"selected>":">").$statu['_']; ?></option> <option value='a' <?php echo (($self['jab'])=='a'?"selected>":">").$statu['a']; ?></option> <option value='d' <?php echo (($self['jab'])=='d'?"selected>":">").$statu['d']; ?></option> <option value='n' <?php echo (($self['jab'])=='n'?"selected>":">").$statu['n']; ?></option> <option value='l' <?php echo (($self['jab'])=='l'?"selected>":">").$statu['l']; ?></option> <option value='c' <?php echo (($self['jab'])=='c'?"selected>":">").$statu['c']; ?></option> <option value='f' <?php echo (($self['jab'])=='f'?"selected>":">").$statu['f']; ?></option> <option value='i' <?php echo (($self['jab'])=='i'?"selected>":">").$statu['i']; ?></option> </select> <?php if ($ID{0} != 'r') { ?> <input type='checkbox' checked='checked' name='sendmsg' value='send message' class='centerim'><b class='centerim'> send message</b> <?php } else { ?> <input type='checkbox' unchecked='unchecked' name='readlmsg' value='read last message' class='centerim'><b class='centerim'> read last</b> <?php } ?> <br /> <b class='icq'>icq: </b><select name='icq' size='1' class='centerim'> <option value='0' <?php echo (isset($self['icq'])==false?"selected>":">").$statu['0']; ?></option> <option value='o' <?php echo (($self['icq'])=='o'?"selected>":">").$statu['o']; ?></option> <option value='_' <?php echo (($self['icq'])=='_'?"selected>":">").$statu['_']; ?></option> <option value='a' <?php echo (($self['icq'])=='a'?"selected>":">").$statu['a']; ?></option> <option value='d' <?php echo (($self['icq'])=='d'?"selected>":">").$statu['d']; ?></option> <option value='n' <?php echo (($self['icq'])=='n'?"selected>":">").$statu['n']; ?></option> <option value='l' <?php echo (($self['icq'])=='l'?"selected>":">").$statu['l']; ?></option> <option value='c' <?php echo (($self['icq'])=='c'?"selected>":">").$statu['c']; ?></option> <option value='f' <?php echo (($self['icq'])=='f'?"selected>":">").$statu['f']; ?></option> <option value='i' <?php echo (($self['icq'])=='i'?"selected>":">").$statu['i']; ?></option> </select> <?php if ($ID{0} != 'r') { ?> <input type='checkbox' unchecked='unchecked' name='readlmsg' value='read last message' class='centerim'><b class='centerim'> read last</b> <?php } ?> <br /> <b class='yahoo'>yahoo: </b><select name='yah' size='1' class='centerim'> <option value='0' <?php echo (isset($self['yah'])==false?"selected>":">").$statu['0']; ?></option> <option value='o' <?php echo (($self['yah'])=='o'?"selected>":">").$statu['o']; ?></option> <option value='_' <?php echo (($self['yah'])=='_'?"selected>":">").$statu['_']; ?></option> <option value='a' <?php echo (($self['yah'])=='a'?"selected>":">").$statu['a']; ?></option> <option value='d' <?php echo (($self['yah'])=='d'?"selected>":">").$statu['d']; ?></option> <option value='n' <?php echo (($self['yah'])=='n'?"selected>":">").$statu['n']; ?></option> <option value='l' <?php echo (($self['yah'])=='l'?"selected>":">").$statu['l']; ?></option> <option value='c' <?php echo (($self['yah'])=='c'?"selected>":">").$statu['c']; ?></option> <option value='f' <?php echo (($self['yah'])=='f'?"selected>":">").$statu['f']; ?></option> <option value='i' <?php echo (($self['yah'])=='i'?"selected>":">").$statu['i']; ?></option> </select> <br /> <b class='aim'>aim: </b><select name='aim' size='1' class='centerim'> <option value='0' <?php echo (isset($self['aim'])==false?"selected>":">").$statu['0']; ?></option> <option value='o' <?php echo (($self['aim'])=='o'?"selected>":">").$statu['o']; ?></option> <option value='_' <?php echo (($self['aim'])=='_'?"selected>":">").$statu['_']; ?></option> <option value='a' <?php echo (($self['aim'])=='a'?"selected>":">").$statu['a']; ?></option> <option value='d' <?php echo (($self['aim'])=='d'?"selected>":">").$statu['d']; ?></option> <option value='n' <?php echo (($self['aim'])=='n'?"selected>":">").$statu['n']; ?></option> <option value='l' <?php echo (($self['aim'])=='l'?"selected>":">").$statu['l']; ?></option> <option value='c' <?php echo (($self['aim'])=='c'?"selected>":">").$statu['c']; ?></option> <option value='f' <?php echo (($self['aim'])=='f'?"selected>":">").$statu['f']; ?></option> <option value='i' <?php echo (($self['aim'])=='i'?"selected>":">").$statu['i']; ?></option> </select> <br /> <b class='lj'>lj: </b><select name='lj' size='1' class='centerim'> <option value='0' <?php echo (isset($self['lj'])==false?"selected>":">").$statu['0']; ?></option> <option value='o' <?php echo (($self['lj'])=='o'?"selected>":">").$statu['o']; ?></option> <option value='_' <?php echo (($self['lj'])=='_'?"selected>":">").$statu['_']; ?></option> <option value='a' <?php echo (($self['lj'])=='a'?"selected>":">").$statu['a']; ?></option> <option value='d' <?php echo (($self['lj'])=='d'?"selected>":">").$statu['d']; ?></option> <option value='n' <?php echo (($self['lj'])=='n'?"selected>":">").$statu['n']; ?></option> <option value='l' <?php echo (($self['lj'])=='l'?"selected>":">").$statu['l']; ?></option> <option value='c' <?php echo (($self['lj'])=='c'?"selected>":">").$statu['c']; ?></option> <option value='f' <?php echo (($self['lj'])=='f'?"selected>":">").$statu['f']; ?></option> <option value='i' <?php echo (($self['lj'])=='i'?"selected>":">").$statu['i']; ?></option> </select> <br /> <b class='msn'>msn: </b><select name='msn' size='1' class='centerim'> <option value='0' <?php echo (isset($self['msn'])==false?"selected>":">").$statu['0']; ?></option> <option value='o' <?php echo (($self['msn'])=='o'?"selected>":">").$statu['o']; ?></option> <option value='_' <?php echo (($self['msn'])=='_'?"selected>":">").$statu['_']; ?></option> <option value='a' <?php echo (($self['msn'])=='a'?"selected>":">").$statu['a']; ?></option> <option value='d' <?php echo (($self['msn'])=='d'?"selected>":">").$statu['d']; ?></option> <option value='n' <?php echo (($self['msn'])=='n'?"selected>":">").$statu['n']; ?></option> <option value='l' <?php echo (($self['msn'])=='l'?"selected>":">").$statu['l']; ?></option> <option value='c' <?php echo (($self['msn'])=='c'?"selected>":">").$statu['c']; ?></option> <option value='f' <?php echo (($self['msn'])=='f'?"selected>":">").$statu['f']; ?></option> <option value='i' <?php echo (($self['msn'])=='i'?"selected>":">").$statu['i']; ?></option> </select> <input type='submit' class='centerim' value='Abschicken'> </form> <?php } else { ?> <form action='index.php<?php echo "?lines=$ShowLines&countevents=$CountEvents".($Group!=-1?"&Group=$Group":"") ; ?>#end' method=POST> <?php if ($reply != "") { ?> <textarea rows='7' name='msg' class='centerim' id='me' style='width:95%;' readonly='readonly'><?php echo $reply; ?></textarea><br /> <?php } ?> <b class='jab'>jab: </b><select name='jab' size='1' class='centerim'> <option value='0' <?php echo (isset($self['jab'])==false?"selected>":">").$statu['0']; ?></option> <option value='o' <?php echo (($self['jab'])=='o'?"selected>":">").$statu['o']; ?></option> <option value='_' <?php echo (($self['jab'])=='_'?"selected>":">").$statu['_']; ?></option> <option value='a' <?php echo (($self['jab'])=='a'?"selected>":">").$statu['a']; ?></option> <option value='d' <?php echo (($self['jab'])=='d'?"selected>":">").$statu['d']; ?></option> <option value='n' <?php echo (($self['jab'])=='n'?"selected>":">").$statu['n']; ?></option> <option value='l' <?php echo (($self['jab'])=='l'?"selected>":">").$statu['l']; ?></option> <option value='c' <?php echo (($self['jab'])=='c'?"selected>":">").$statu['c']; ?></option> <option value='f' <?php echo (($self['jab'])=='f'?"selected>":">").$statu['f']; ?></option> <option value='i' <?php echo (($self['jab'])=='i'?"selected>":">").$statu['i']; ?></option> </select><br /> <b class='icq'>icq: </b><select name='icq' size='1' class='centerim'> <option value='0' <?php echo (isset($self['icq'])==false?"selected>":">").$statu['0']; ?></option> <option value='o' <?php echo (($self['icq'])=='o'?"selected>":">").$statu['o']; ?></option> <option value='_' <?php echo (($self['icq'])=='_'?"selected>":">").$statu['_']; ?></option> <option value='a' <?php echo (($self['icq'])=='a'?"selected>":">").$statu['a']; ?></option> <option value='d' <?php echo (($self['icq'])=='d'?"selected>":">").$statu['d']; ?></option> <option value='n' <?php echo (($self['icq'])=='n'?"selected>":">").$statu['n']; ?></option> <option value='l' <?php echo (($self['icq'])=='l'?"selected>":">").$statu['l']; ?></option> <option value='c' <?php echo (($self['icq'])=='c'?"selected>":">").$statu['c']; ?></option> <option value='f' <?php echo (($self['icq'])=='f'?"selected>":">").$statu['f']; ?></option> <option value='i' <?php echo (($self['icq'])=='i'?"selected>":">").$statu['i']; ?></option> </select><br /> <b class='yahoo'>yahoo: </b><select name='yah' size='1' class='centerim'> <option value='0' <?php echo (isset($self['yah'])==false?"selected>":">").$statu['0']; ?></option> <option value='o' <?php echo (($self['yah'])=='o'?"selected>":">").$statu['o']; ?></option> <option value='_' <?php echo (($self['yah'])=='_'?"selected>":">").$statu['_']; ?></option> <option value='a' <?php echo (($self['yah'])=='a'?"selected>":">").$statu['a']; ?></option> <option value='d' <?php echo (($self['yah'])=='d'?"selected>":">").$statu['d']; ?></option> <option value='n' <?php echo (($self['yah'])=='n'?"selected>":">").$statu['n']; ?></option> <option value='l' <?php echo (($self['yah'])=='l'?"selected>":">").$statu['l']; ?></option> <option value='c' <?php echo (($self['yah'])=='c'?"selected>":">").$statu['c']; ?></option> <option value='f' <?php echo (($self['yah'])=='f'?"selected>":">").$statu['f']; ?></option> <option value='i' <?php echo (($self['yah'])=='i'?"selected>":">").$statu['i']; ?></option> </select><br /> <b class='aim'>aim: </b><select name='aim' size='1' class='centerim'> <option value='0' <?php echo (isset($self['aim'])==false?"selected>":">").$statu['0']; ?></option> <option value='o' <?php echo (($self['aim'])=='o'?"selected>":">").$statu['o']; ?></option> <option value='_' <?php echo (($self['aim'])=='_'?"selected>":">").$statu['_']; ?></option> <option value='a' <?php echo (($self['aim'])=='a'?"selected>":">").$statu['a']; ?></option> <option value='d' <?php echo (($self['aim'])=='d'?"selected>":">").$statu['d']; ?></option> <option value='n' <?php echo (($self['aim'])=='n'?"selected>":">").$statu['n']; ?></option> <option value='l' <?php echo (($self['aim'])=='l'?"selected>":">").$statu['l']; ?></option> <option value='c' <?php echo (($self['aim'])=='c'?"selected>":">").$statu['c']; ?></option> <option value='f' <?php echo (($self['aim'])=='f'?"selected>":">").$statu['f']; ?></option> <option value='i' <?php echo (($self['aim'])=='i'?"selected>":">").$statu['i']; ?></option> </select> <br /> <b class='lj'>lj: </b><select name='lj' size='1' class='centerim'> <option value='0' <?php echo (isset($self['lj'])==false?"selected>":">").$statu['0']; ?></option> <option value='o' <?php echo (($self['lj'])=='o'?"selected>":">").$statu['o']; ?></option> <option value='_' <?php echo (($self['lj'])=='_'?"selected>":">").$statu['_']; ?></option> <option value='a' <?php echo (($self['lj'])=='a'?"selected>":">").$statu['a']; ?></option> <option value='d' <?php echo (($self['lj'])=='d'?"selected>":">").$statu['d']; ?></option> <option value='n' <?php echo (($self['lj'])=='n'?"selected>":">").$statu['n']; ?></option> <option value='l' <?php echo (($self['lj'])=='l'?"selected>":">").$statu['l']; ?></option> <option value='c' <?php echo (($self['lj'])=='c'?"selected>":">").$statu['c']; ?></option> <option value='f' <?php echo (($self['lj'])=='f'?"selected>":">").$statu['f']; ?></option> <option value='i' <?php echo (($self['lj'])=='i'?"selected>":">").$statu['i']; ?></option> </select> <br /> <b class='msn'>msn: </b><select name='msn' size='1' class='centerim'> <option value='0' <?php echo (isset($self['msn'])==false?"selected>":">").$statu['0']; ?></option> <option value='o' <?php echo (($self['msn'])=='o'?"selected>":">").$statu['o']; ?></option> <option value='_' <?php echo (($self['msn'])=='_'?"selected>":">").$statu['_']; ?></option> <option value='a' <?php echo (($self['msn'])=='a'?"selected>":">").$statu['a']; ?></option> <option value='d' <?php echo (($self['msn'])=='d'?"selected>":">").$statu['d']; ?></option> <option value='n' <?php echo (($self['msn'])=='n'?"selected>":">").$statu['n']; ?></option> <option value='l' <?php echo (($self['msn'])=='l'?"selected>":">").$statu['l']; ?></option> <option value='c' <?php echo (($self['msn'])=='c'?"selected>":">").$statu['c']; ?></option> <option value='f' <?php echo (($self['msn'])=='f'?"selected>":">").$statu['f']; ?></option> <option value='i' <?php echo (($self['msn'])=='i'?"selected>":">").$statu['i']; ?></option> </select> <input type='submit' class='centerim' value='Abschicken'> <?php } ?> </form> </div> </div> <div style="height:100%;max-height:100%;width:80%;float:left;"> <div style="height:10%;max-height:10%;width:100%;float:none;font-size:12pt;"> <?php if (file_exists($mainRoot.$ID."/info")) { $File = file($mainRoot.$ID."/info"); echo "\t\t\t<table border=0 style='width:100%;height:100%'>\n"; echo "\t\t\t\t<tr>\n"; echo "\t\t\t\t\t<td style='vertical-align:middle'>\n"; echo "\t\t\t\t\t\t<b id='you'>\n"; echo "\t\t\t\t\t\t\t".htmlentities(trim($File[45]))."\n"; echo "\t\t\t\t\t\t</b>\n"; echo "\t\t\t\t\t\t<b id='head'>\n"; echo "\t\t\t\t\t\t\t and \n"; echo "\t\t\t\t\t\t</b>\n"; echo "\t\t\t\t\t\t<b id='me'>\n"; echo "\t\t\t\t\t\t\t".$realname."\n"; echo "\t\t\t\t\t\t</b>\n"; echo "\t\t\t\t\t</td>\n"; echo "\t\t\t\t\t<td style='vertical-align:middle;text-align:right'>\n"; $link = "index.php?countevents=$CountEvents".(($Group!=-1)?"&Group=$Group":"").(($ID !=-1)?"&ID=$ID":"")."#end"; echo "\t\t\t\t\t\t<form action='$link' method=POST>\n"; echo "\t\t\t\t\t\t\t<b id='head'><input type='radio' name='countevents' value='1' class='centerim' id='head' ".($CountEvents==1?"checked='checked'":"").">count <input type='radio' name='countevents' value='0' class='centerim' id='head'".($CountEvents==0?"checked='checked'":"").">don't count \n"; echo "\t\t\t\t\t\t\t<input type='text' size='6' maxlength='10' name='lines' class='centerim' id='head' value='$ShowLines'/>\n"; echo "\t\t\t\t\t\t\t<input type='submit' value='Change' class='centerim' id='head'/></b>\n"; echo "\t\t\t\t\t\t</form>\n"; echo "\t\t\t\t</tr>\n"; echo "\t\t\t</table>\n"; } else { echo "\t\t\t<table border=0 style='width:100%;height:100%'>\n"; echo "\t\t\t\t<tr>\n"; echo "\t\t\t\t\t<td style='vertical-align:middle;text-align:right'>\n"; $link = "index.php?countevents=$CountEvents".(($Group!=-1)?"&Group=$Group":"").(($ID !=-1)?"&ID=$ID":"")."#end"; echo "\t\t\t\t\t\t<form action='$link' method=POST>\n"; echo "\t\t\t\t\t\t\t<b id='head'><input type='radio' name='countevents' value='1' class='centerim' id='head' ".($CountEvents==1?"checked='checked'":"").">count <input type='radio' name='countevents' value='0' class='centerim' id='head'".($CountEvents==0?"checked='checked'":"").">don't count \n"; echo "\t\t\t\t\t\t\t<input type='text' size='6' maxlength='10' name='lines' class='centerim' id='head' value='$ShowLines'/>\n"; echo "\t\t\t\t\t\t\t<input type='submit' value='Change' class='centerim' id='head'/></b>\n"; echo "\t\t\t\t\t\t</form>\n"; echo "\t\t\t\t</tr>\n"; echo "\t\t\t</table>\n"; } ?> </div> <div style='vertical-align:top;font-size:8pt;width:100%;height:90%;max-height:90% ;overflow:auto;'> <table border=1 class='table' style="border-collapse:collapse;"> <?php if (file_exists($mainRoot.$_GET['ID']."/"."history")) { $Datei = fopen($mainRoot.$_GET['ID']."/"."history", "r"); $Counter = 0; $line = fgets($Datei); ?> <tr id='head'> <th class='table'> Transmit </th> <th class='table'> Receive </th> <th class='table'> Message </th> </tr> <?php $Multiline = false; $TextLines = array(); $i=0; $TextLines[$i] = ''; while (!feof($Datei)) { $line = fgets($Datei); $Counter++; if (strcmp($line,"IN\n") == 0) { $input = true; $auth_line = false; $Counter = 1; } elseif (strcmp($line,"OUT\n") == 0) { $input = false; $auth_line = false; $Counter = 1; } if (strcmp($line,"AUTH\n") == 0) $auth_line = true; if ($auth_line == false && $Counter >= 3) { if ($Counter == 3) { $i++; $TextLines[$i] = $TextLines[$i]."\t\t\t\t<tr class='table' id='".(($input==true)?"you":"me")."'>\n"; $TextLines[$i] = $TextLines[$i]."\t\t\t\t\t<td class='table' id='date'>\n\t\t\t\t\t\t".date("l, d.m.y H:i", $line)."\n\t\t\t\t\t</td>\n"; } elseif ($Counter == 4) $TextLines[$i] = $TextLines[$i]."\t\t\t\t\t<td class='table' id='date'>\n\t\t\t\t\t\t".date("l, d.m.y H:i", $line)."\n\t\t\t\t\t</td>\n"; if ($Counter == 4) $TextLines[$i] = $TextLines[$i]."\t\t\t\t\t<td class='table'>\n"; $rss_counter = 0; $rss_content = array(); $rss = array(); while (($Counter == 4) && !feof($Datei)) { if ($ID{0} == 'r') { if ($Counter == 4) { $line = fgets($Datei); if (strcmp($line,"\x0C\n") == 0) { $Counter = 0; $Multiline = false; } else { $rss[$rss_counter++] = $line; $Multiline = true; } foreach ($rss as $tolook) { $temp = explode(':', $tolook); if (strcmp($temp[0], "Title") == 0) $rss_content['Title'] = substr($tolook, strlen($temp[0])+1); elseif(strcmp($temp[0], "Link") == 0) $rss_content['Link'] = substr($tolook, strlen($temp[0])+1); else $rss_content['rest'] = substr($tolook, strlen($temp[0])+1); } if ($Counter == 0 || feof($Datei)) { $TextLines[$i] = $TextLines[$i]."\t\t\t\t\t\t<a href='".$rss_content['Link']."' id='you' target='_blank'>".trim(htmlentities($rss_content['Title']))."</a><br>".$rss_ content['rest']."\n"; $TextLines[$i] = $TextLines[$i]."\t\t\t\t\t</td>\n\t\t\t\t</tr>\n"; } } } else { if ($Counter == 4) { $line = fgets($Datei); if (strcmp($line,"\x0C\n") == 0) { $Counter = 0; $TextLines[$i] = $TextLines[$i]."\t\t\t\t\t</td>\n\t\t\t\t</tr>\n"; $Multiline = false; } else { $TextLines[$i] = $TextLines[$i]."\t\t\t\t\t\t".trim(htmlentities($line))."\n"; if ($Multiline == true) $TextLines[$i] = $TextLines[$i]."\t\t\t\t\t\t<br />\n"; $Multiline = true; } } } } } } if (isset($input) == true) $TextLines[$i] = $TextLines[$i]."\t\t\t\t\t</td>\n\t\t\t\t</tr>\n"; } $CurrentLineOut = 0; if (count($TextLines)>0) { foreach($TextLines as $TextLine) { if (($i - $ShowLines < $CurrentLineOut++) || ($ShowLines == 0)) echo $TextLine; } } ?> </table> <a name="end"></a> </div> </body> </html> - ------------------------------------------------------- styles.css - ------------------------------------------------------- body { overflow:hidden; margin:0px; margin-left:5px; background-color: #111111; scrollbar-base-color:#000000; scrollbar-arrow-color:#FFFF55; scrollbar-darkshadow-color:#00BB00; scrollbar-face-color:#000000; scrollbar-highlight-color:#00FFFF; scrollbar-shadow-color:#00BBBB; scrollbar-track-color:#BBBBBB; } a { text-decoration:none; font-family:Courier New,monospace; font-size:8pt; } b { font-family:Courier New,monospace; font-size:8pt; text-decoration:bold; } div { font-family:Courier New, monospace; } .centerim { background-color: #111111; scrollbar-base-color:#000000; scrollbar-arrow-color:#FFFF55; scrollbar-darkshadow-color:#00BB00; scrollbar-face-color:#000000; scrollbar-highlight-color:#00FFFF; scrollbar-shadow-color:#00BBBB; scrollbar-track-color:#BBBBBB; color:#FFFF55; font-family:Courier New,monospace; font-size:8pt; border-color:#00BBBB; overflow:hidden; } .icq { color:#00BB00; } .jab { color:#BD0000; } .yahoo { color:#bd00bd; } .msn { color:#18b2b2; } .aim { color:#bdba00; } .lj { color:#52ffff; } .rss { color:#ffffff; } .table { border-color: #5255ff; text-decoration:none; font-family:Courier New,monospace; font-size:8pt; } #date { text-align:center; } #me { color:#00BBBB; } #you { color:#FFFF55; } #head { color:#BBBBBB; } - ------------------------------------------------------- -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.7 (MingW32) iQEVAwUBSYTz9B/SaM7/TgdQAQL91wf+Jrr9PGvNc6FEZ83Dv6NP+ULAgFzje6PA EaxL+4QkDvnVtz8Mwq6KYvfywT+eD2Fb7XDdvEOVa4YJRr23X+yiUWNxszFtEBbV paCdJjH/L4qJG2aRCRMA/FphYobPTY5DCifs0JL1aRizQIZlgxiIhW5tP8bQAoHN fYCzr8A5xZUZNru+4nZymMATVIDy4Av6+PY24I8rduqt4kXboQugzafcxrRU0bnf S6uj6RDDe6CBcVsa6OhxmJu+CXsUoNzXFN8v6lYSUoRBrz7h30iXOoz8usc90BRQ TkVEpFzhx/3pOW4ZneF4QnZz+r86mDMSG6MXSn8YVPFJ2NJTdLGgOw== =b+E0 -----END PGP SIGNATURE----- -- _______________________________________________ Centerim-devel mailing list Centerim-devel@centerim.org http://centerim.org/mailman/listinfo/centerim-devel http://www.centerim.org/