<?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) {

			if (isset($_SESSION["triton"]["ircop"])) {
			
				$usersList = $this -> getChannelData($this -> channel, "users");
		
				/* User is not ghost? */
				if (!preg_match('/[G]:'.preg_quote($this -> nickname).',/i', $usersList)) {
					
					/* Mark as ghost */
					$usersList = preg_replace('/[A-Z]:('.preg_quote($this -> nickname).'),/i', 'G:\\1,', $usersList);
	
					$this -> writeChannelStrings(
						"wallop", 
						$this -> nickname, 
						vsprintf($this -> getMsg('WALLOP_GHOST'), array($this -> nickname, $this -> channel)),
						$this -> channel
					);
	
				}
				
				/* Set as respawn */
				else {
					
					/* Mark as ghost */
					$usersList = preg_replace('/[A-Z]:('.preg_quote($this -> nickname).'),/i', 'U:\\1,', $usersList);
	
					$this -> writeChannelStrings(
						"wallop", 
						$this -> nickname, 
						vsprintf($this -> getMsg('WALLOP_RESPAWN'), array($this -> nickname, $this -> channel)),
						$this -> channel
					);
				}
				
				/* Write the channel list */
				$this -> setChannelData($channel, "users", $usersList);
			}
			
			else $this -> localEcho('ERR_NOACCESS', array());
		}
	}

?>