• Forum
  • Doc
  • Screenshots
  • Download
  • Donate
  • Contributors
  • Contact
  • Follow @phpfreechat
  • DEMO
  • Board index ‹ Version 1.x branch ‹ Feature Requests (v1.x)
  • Change font size
  • FAQ
  • Register
  • Login

Deny posting contact information

This forum is now locked as we will no longer be developing the v1.x branch

Moderators: OldWolf, re*s.t.a.r.s.*2

Topic locked
6 posts • Page 1 of 1

Postby coolwaif » Fri Jun 23, 2006 6:00 pm

For some safety and privacy reasons, I don't want users posting their contact information (like email address, phone no, or URL) in the chat room.

To check the patterns like XXXX@XXX.XXX for email,
the patterns like any numbers more than 4 digits for phone no. like 000-0000, 0000000, 000 0000,
and the patterns like http://xxx.xxx.xxx or xxx.xxx.xxx

I think this optional feature is very useful, pls think about it, thanks!
coolwaif
New member
 
Posts: 4
Joined: Fri Jun 23, 2006 1:20 pm
Top

Postby phpfreechat » Wed Jun 28, 2006 3:35 pm

I'm not sure it's doable because it's easy to go round to these tests.
Example:
this email "stephane dot gully at gmail dot com" is readable by human but undetectable by a robot.
phpfreechat
Site Admin
 
Posts: 2657
Joined: Tue Feb 07, 2006 3:35 pm
Location: France
Top

Postby coolwaif » Fri Jun 30, 2006 4:57 am

Yes, I know these problems. Just like if users insist to post some bad words, they can still post those bad words in some smarter ways. Both cases are also very hard to be filtered completely by the robot.

Another reason is most of users do not read the rule or term before joining a chat room. This function can be used to remind them not posting contact information or some sensitive information (credit card no.) in the chat room. If they have to post them in smarter way, that means they disrespect the rule on purpose. In case, they deserve to be kicked or banned by human moderators.

Therefore, I just want some very basic detection only at least better than nothing. All other cases will be handled by human moderators during their available time, thanks for your consideration!
Last edited by coolwaif on Fri Jun 30, 2006 5:51 am, edited 1 time in total.
coolwaif
New member
 
Posts: 4
Joined: Fri Jun 23, 2006 1:20 pm
Top

Postby phpfreechat » Fri Jun 30, 2006 9:04 am

I will implement a proxy command to filter bad words.
Then I think you will be able to adapte the code for other purposes.
phpfreechat
Site Admin
 
Posts: 2657
Joined: Tue Feb 07, 2006 3:35 pm
Location: France
Top

Postby phpfreechat » Fri Jun 30, 2006 5:30 pm

I just coded the censor proxy, here is the code:
(you can browe the code here : http://svn.sourceforge.net/viewcvs.cgi/ ... up&rev=635)
Code: Select all
Modified: trunk/src/pfcglobalconfig.class.php
===================================================================
--- trunk/src/pfcglobalconfig.class.php 2006-06-28 19:59:12 UTC (rev 634)
+++ trunk/src/pfcglobalconfig.class.php 2006-06-30 16:28:03 UTC (rev 635)
@@ -38,9 +38,10 @@
  var $admins              = array("admin" => ""); // nicknames is the key, password is the value

  // these parameters are static (cached)
-  var $proxys              = array("auth", "noflood");
+  var $proxys              = array("auth", "noflood", "censor");
  var $proxys_cfg          = array("auth"    => array(),
-                                   "noflood" => array("limit"=>10,"delay"=>5));
+                                   "noflood" => array("limit"=>10,"delay"=>5),
+                                   "censor"  => array("words"=>array("fuck","sex","bitch"),"replaceby"=>"*"));
  var $title               = ""; // default is _pfc("My Chat")
  var $channels            = array(); // the default joined channels when opening the chat
  var $frozen_channels     = array(); // by default allow users to create there own channels

Added: trunk/src/proxys/censor.class.php
===================================================================
--- trunk/src/proxys/censor.class.php                           (rev 0)
+++ trunk/src/proxys/censor.class.php   2006-06-30 16:28:03 UTC (rev 635)
@@ -0,0 +1,59 @@
+<?php
+/**
+ * censor.class.php
+ *
+ * Copyright © 2006 Stephane Gully <stephane.gully@gmail.com>
+ *
+ * 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_censor
+ * this proxy will filter bad words from messages
+ * @author Stephane Gully <stephane.gully@gmail.com>
+ */
+class pfcProxyCommand_censor extends pfcProxyCommand
+{
+  function run(&$xml_reponse, $clientid, $param, $sender, $recipient, $recipientid)
+  {
+    $c =& $this->c;
+    $u =& $this->u;
+
+    $cmdtocheck = array("send", "nick", "me");
+    if ( in_array($this->name, $cmdtocheck) )
+    {
+      $words     = $c->proxys_cfg[$this->proxyname]["words"];
+      $replaceby = $c->proxys_cfg[$this->proxyname]["replaceby"];
+
+      $patterns = array();
+      $replacements = array();
+      foreach($words as $w)
+      {
+        $patterns[] = "/".preg_quote($w)."/i";
+        $replacements[] = str_repeat($replaceby,strlen($w));
+      }
+      $param = preg_replace($patterns, $replacements, $param);
+    }
+
+    // forward the command to the next proxy or to the final command
+    $this->next->run(&$xml_reponse, $clientid, $param, $sender, $recipient, $recipientid);
+  }
+}
+
+?>

Feel free to adapte the code for your purpose.

Hope that help.
phpfreechat
Site Admin
 
Posts: 2657
Joined: Tue Feb 07, 2006 3:35 pm
Location: France
Top

Postby coolwaif » Sat Jul 08, 2006 4:52 am

I just noticed that the new 1.0-Beta3 is released with censor proxy function.
Thank you!
coolwaif
New member
 
Posts: 4
Joined: Fri Jun 23, 2006 1:20 pm
Top


Topic locked
6 posts • Page 1 of 1

Return to Feature Requests (v1.x)

Who is online

Users browsing this forum: No registered users and 4 guests

  • Board index
  • The team • Delete all board cookies • All times are UTC + 1 hour
Powered by phpBB® Forum Software © phpBB Group
Sign in
Wrong credentials
Sign up I forgot my password
.
jeu-gratuit.net | more partners
Fork me on GitHub