<?php
///////////////////////////////////////////////////////////////////////////////////////
// PHPizabi 0.848b C1 [ALICIA]                               http://www.phpizabi.net //
///////////////////////////////////////////////////////////////////////////////////////
// Please read the license.txt file before using / modifying this software           //
// Original author:         Claude Desjardins, R - feedback@realitymedias.com        //
// Last modification date:  February 21th 2007                                       //
// Version:                 PHPizabi 0.848b C1                                       //
//                                                                                   //
// (C) 2005, 2007 Real!ty Medias / PHPizabi - All rights reserved                    //
///////////////////////////////////////////////////////////////////////////////////////

	class t_command extends triton {
		function runCommand($param, $channel=NULL) {
		
			/* Username set? */
			if (isset($param[1])) {
				
				$usersList = $this -> getChannelData($this -> channel, "users");
	
				/* Me is operator? */
				if (strstr($usersList, "O:".$this -> nickname.",") or isset($_SESSION["triton"]["ircop"])) {
				
					/* User is in channel? */
					if (preg_match('/[A-Z]:'.preg_quote($param[1]).',/i', $usersList)) {
		
						/* User is not already operator? */
						if (preg_match('/O:'.preg_quote($param[1]).',/i', $usersList)) {
						
							/* M'kay! Let's do it */
							$usersList = preg_replace('/[A-Z]:('.preg_quote($param[1]).'),/i', 'U:\\1,', $usersList);
							$this -> setChannelData($channel, "users", $usersList);
							
							$this -> sysMsg('SYS_DOP', array($param[1], $this -> nickname));
						}
					}
					else $this -> localEcho('ERR_NOSUCHNICK', array($param[1]));
				}
				else $this -> localEcho('ERR_NOACCESS', array());
			}
			else $this -> localEcho('ERR_PARAMCOUNT', array($param[0]));
		}
	}
?>