[Phpfreechat-svn] SF.net SVN: phpfreechat: [590] trunk/src/commands/connect.class.php
Status: Beta
Brought to you by:
kerphi
From: <ke...@us...> - 2006-06-15 14:50:26
|
Revision: 590 Author: kerphi Date: 2006-06-15 07:50:17 -0700 (Thu, 15 Jun 2006) ViewCVS: http://svn.sourceforge.net/phpfreechat/?rev=590&view=rev Log Message: ----------- Now the first connected user gets automatically the server admin rights. Modified Paths: -------------- trunk/src/commands/connect.class.php Modified: trunk/src/commands/connect.class.php =================================================================== --- trunk/src/commands/connect.class.php 2006-06-15 14:34:07 UTC (rev 589) +++ trunk/src/commands/connect.class.php 2006-06-15 14:50:17 UTC (rev 590) @@ -14,12 +14,20 @@ $container =& $c->getContainerInstance(); $disconnected_users = $container->removeObsoleteNick(NULL, $c->timeout); + $isadmin = $c->isadmin; + if (!$isadmin) + { + // check if the user is alone on the server, and give it the admin status if yes + $users = $container->getOnlineNick(NULL); + if (count($users) == 0) $isadmin = true; + } + // setup some user meta $nickid = $u->nickid; // store the user ip $container->setMeta($_SERVER["REMOTE_ADDR"], "ip", "nickname", $nickid); // store the admin flag - $container->setMeta($c->isadmin, "isadmin", "nickname", $nickid); + $container->setMeta($isadmin, "isadmin", "nickname", $nickid); // connect to the server $xml_reponse->addScript("pfc.handleResponse('connect', 'ok', '');"); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |