[Phpfreechat-svn] SF.net SVN: phpfreechat: [543] trunk/src/proxys
Status: Beta
Brought to you by:
kerphi
From: <ke...@us...> - 2006-06-01 15:48:12
|
Revision: 543 Author: kerphi Date: 2006-06-01 08:48:01 -0700 (Thu, 01 Jun 2006) ViewCVS: http://svn.sourceforge.net/phpfreechat/?rev=543&view=rev Log Message: ----------- Now the admin command are protected and a /deop command is available. Modified Paths: -------------- trunk/src/proxys/auth.class.php Added Paths: ----------- trunk/src/commands/deop.class.php Added: trunk/src/commands/deop.class.php =================================================================== --- trunk/src/commands/deop.class.php (rev 0) +++ trunk/src/commands/deop.class.php 2006-06-01 15:48:01 UTC (rev 543) @@ -0,0 +1,32 @@ +<?php + +require_once(dirname(__FILE__)."/../pfccommand.class.php"); + +class pfcCommand_deop extends pfcCommand +{ + var $usage = "/deop {nickname}"; + + function run(&$xml_reponse, $clientid, $param, $sender, $recipient, $recipientid) + { + $c =& $this->c; + $u =& $this->u; + + if (trim($param) == "") + { + // error + $msg = _pfc("Missing parameter"); + $msg .= " (".$this->usage.")"; + $cmd =& pfcCommand::Factory("error"); + $cmd->run($xml_reponse, $clientid, $msg, $sender, $recipient, $recipientid); + return; + } + + // just change the "isadmin" meta flag + $nicktodeop = trim($param); + $container =& $c->getContainerInstance(); + $nicktodeopid = $container->getNickId($nicktodeop); + $container->setMeta(false, "isadmin", "nickname", $nicktodeopid); + } +} + +?> \ No newline at end of file Modified: trunk/src/proxys/auth.class.php =================================================================== --- trunk/src/proxys/auth.class.php 2006-06-01 08:42:32 UTC (rev 542) +++ trunk/src/proxys/auth.class.php 2006-06-01 15:48:01 UTC (rev 543) @@ -35,27 +35,22 @@ $c =& $this->c; $u =& $this->u; - // $xml_reponse->addScript("alert('proxy auth');"); - - // if ($this->name == "send") - // $xml_reponse->addScript("alert('proxy auth');"); - - if ($this->name == "op") + // protect admin commands + $admincmd = array("kick", "ban", "unban", "op", "deop", "debug", "rehash", "init"); + if ( in_array($this->name, $admincmd) ) { $container =& $c->getContainerInstance(); $nickid = $container->getNickId($sender); $isadmin = $container->getMeta("isadmin", "nickname", $nickid); if (!$isadmin) { - $xml_reponse->addScript("alert('not allowed to do /op');"); + $xml_reponse->addScript("alert('".addslashes(_pfc("You are not allowed to run '%s' command", $this->name))."');"); return; } - else - { - // $xml_reponse->addScript("alert('allowed to do /op');"); - } } - else if ($this->name == "join") + + // protect channel from the banished users + if ($this->name == "join") { // check the user is not listed in the banished channel list $container =& $c->getContainerInstance(); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |