<?php// Could work on other systems, but tested it only on debian...// Copyright (c) 2007 mabako, http://www.mabako.netclass extcmd_stats { public $Index; public $Restricted;function format_time($old_time, $current_time) { $timediff = $current_time-$old_time;// Allright, we moved that to an higher instance (functions not in// a class... but be aware, uncommenting this is may needed for it // to work if you dont have the same file as I do. $days=intval($timediff/86400); $remain=$timediff%86400; $hours=intval($remain/3600); $remain=$remain%3600; $mins=intval($remain/60); $secs=$remain%60; $text = array(); if($days > 0) $text[] = $days.' days'; if($hours > 0) $text[] = $hours.' hours'; if($mins > 0) $text[] = $mins.' mins'; if($secs > 0) $text[] = $secs.' secs'; return COLOUR.'03'.implode(' ',$text).COLOUR; return COLOUR.'03'.format_time($timediff).COLOUR; } function command_stats($params = '') { global $Bot; $this->format_time($extdata[1],time()); $Head = $Bot[$this->Index]; // For ease. $uptime = trim(exec('cut -d. -f1 /proc/uptime')); $process_count = trim(exec('ps aux | grep -v grep | wc -l')); $text = str_replace(array('%C','%B'),array(COLOUR,BOLD),'%C14(S%C15tats%C14) %C7%B'.chr(187).'%C%B '.trim(exec('hostname -f')).' %C7%B'.chr(171).'%B%C %C14(U%C15ptime%C14) %C7%B'.chr(187).'%C%B '.format_time($uptime).' %C7%B'.chr(171).'%B%C %C14(P%C15rocess Count%C14) %C7%B'.chr(187).'%C%B '.$process_count.' %C7%B'.chr(171).'%B%C %C14(M%C15essages%C14) %C7%B'.chr(187).'%C%B '.$Head->Socket->LastBuffer.' sent/'.$Head->Socket->TotalReceived.' received %C7%B'.chr(171).'%B%C'); $Head->Out->PrivMsg($Head->In->Channel,$text); }}