[Phpfreechat-svn] SF.net SVN: phpfreechat: [652] trunk/src
Status: Beta
Brought to you by:
kerphi
From: <ke...@us...> - 2006-07-07 11:45:20
|
Revision: 652 Author: kerphi Date: 2006-07-07 04:45:12 -0700 (Fri, 07 Jul 2006) ViewCVS: http://svn.sourceforge.net/phpfreechat/?rev=652&view=rev Log Message: ----------- New proxy : the lock proxy can be used to lock the chat and redirect all the online users to a given url (use the $params["islocked"] and $params["lockurl"] parameters). Modified Paths: -------------- trunk/src/pfcglobalconfig.class.php Added Paths: ----------- trunk/src/proxys/lock.class.php Modified: trunk/src/pfcglobalconfig.class.php =================================================================== --- trunk/src/pfcglobalconfig.class.php 2006-07-07 07:48:48 UTC (rev 651) +++ trunk/src/pfcglobalconfig.class.php 2006-07-07 11:45:12 UTC (rev 652) @@ -36,9 +36,12 @@ var $nick = ""; // the initial nickname ("" means the user will be queried) var $isadmin = false; var $admins = array("admin" => ""); // nicknames is the key, password is the value + + var $islocked = false; // set this parameter to true to lock the chat for all users + var $lockurl = "http://www.phpfreechat.net"; // this is the url where the users must be redirected when the chat is locked // these parameters are static (cached) - var $proxys = array("auth", "noflood", "censor"); + var $proxys = array("lock", "auth", "noflood", "censor"); var $proxys_cfg = array("auth" => array(), "noflood" => array("limit"=>10,"delay"=>5), "censor" => array("words"=>array("fuck","sex","bitch"),"replaceby"=>"*")); @@ -459,9 +462,10 @@ $pfc_configvar = unserialize(file_get_contents($cachefile)); foreach($pfc_configvar as $key => $val) { - // the 'nick' and 'isadmin' are dynamic parameters, it must not be cached + // the 'nick', 'isadmin', and 'islocked' are dynamic parameters, it must not be cached if ($key != "nick" && - $key != "isadmin") + $key != "isadmin" && + $key != "islocked" ) $this->$key = $val; } Added: trunk/src/proxys/lock.class.php =================================================================== --- trunk/src/proxys/lock.class.php (rev 0) +++ trunk/src/proxys/lock.class.php 2006-07-07 11:45:12 UTC (rev 652) @@ -0,0 +1,51 @@ +<?php +/** + * lock.class.php + * + * Copyright © 2006 Stephane Gully <ste...@gm...> + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the + * Free Software Foundation, 51 Franklin St, Fifth Floor, + * Boston, MA 02110-1301 USA + */ +require_once dirname(__FILE__)."/../pfci18n.class.php"; +require_once dirname(__FILE__)."/../pfcuserconfig.class.php"; +require_once dirname(__FILE__)."/../pfcproxycommand.class.php"; + +/** + * pfcProxyCommand_lock + * if the chat is locked, redirect users to a given url + * @author Stephane Gully <ste...@gm...> + */ +class pfcProxyCommand_lock extends pfcProxyCommand +{ + function run(&$xml_reponse, $clientid, $param, $sender, $recipient, $recipientid) + { + $c =& $this->c; + $u =& $this->u; + + // check if the chat is locked + if ($c->islocked) + { + $xml_reponse->addRedirect($c->lockurl); + } + else + { + // forward the command to the next proxy or to the final command + $this->next->run(&$xml_reponse, $clientid, $param, $sender, $recipient, $recipientid); + } + } +} + +?> \ No newline at end of file This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |