|
From: Lo?c C. <lo...@us...> - 2001-05-07 21:15:02
|
Update of /cvsroot/phpmychat/phpMyChat-0.15/chat/lib
In directory usw-pr-cvs1:/tmp/cvs-serv18898/chat/lib
Modified Files:
format_messages.lib.php3
Log Message:
C_USE_SMILIES has been renamed to C_MAX_GSMILIES
Index: format_messages.lib.php3
===================================================================
RCS file: /cvsroot/phpmychat/phpMyChat-0.15/chat/lib/format_messages.lib.php3,v
retrieving revision 1.7
retrieving revision 1.8
diff -C2 -r1.7 -r1.8
*** format_messages.lib.php3 2001/04/24 19:07:50 1.7
--- format_messages.lib.php3 2001/05/07 21:15:00 1.8
***************
*** 48,53 ****
/**
! * Check messages parts that should be transformed to html links (links must be
! * stricly compliant with the RFC 2396)
*
* @param string the message
--- 48,52 ----
/**
! * Check parts of the messages that should be transformed to html links
*
* @param string the message
***************
*** 57,90 ****
function pmcCheckLinks(&$str)
{
! // Defines the regular expressions to search for
! $reserved = '[;/?:@&=+$,]';
! $unreserved = '[a-z0-9\-_\.!~*\'()]';
! $escaped = '%[a-z0-9]{2}';
! $uric = "($reserved)|($unreserved)|($escaped)";
! // urls except 'news:'
! $scheme = '(http|https|ftp|telnet|gopher|file|wais)://';
! $user = "(($unreserved)|($escaped)|[;:&=+$,])+@";
! $host = "[a-z0-9]([a-z0-9]|$escaped|[\-\.])*[a-z0-9]";
! $port = ':([0-9]+)';
! $path = "/(($unreserved)|($escaped)|[:@&=+$,]|[/;])*";
! $query = "\?($uric)*";
! $fragment = "#($uric)*";
! $urlPattern = "$scheme(($user)?$host($port)?($path)?($query)?($fragment)?)";
!
! // 'news:' urls
! $scheme = 'news:';
! $host = "[a-z0-9]([a-z0-9]|$escaped|[\-\.])*[a-z0-9]";
! $newsPattern = "$scheme($host)";
!
! // e-mails
! $scheme = 'mailto:';
! $host = '[0-9a-z]([-_.]?[0-9a-z])*@[0-9a-z]([-.]?[0-9a-z])*\\.[a-wyz][a-z](fo|g|l|m|mes|o|op|pa|ro|seum|t|u|v|z)?';
! $mailPattern = "($scheme)?($host)";
!
! // Do the work
! $str = eregi_replace($urlPattern, '<a href="\\1://\\2" target="_blank">\\1://\\2</a>', $str);
! $str = eregi_replace($newsPattern, '<a href="news:\\1" target="_blank">\\1</a>', $str);
! $str = eregi_replace($mailPattern, '<a href="mailto:\\2" target="_blank">\\2</a>', $str);
} // end of the 'pmcCheckLinks()' function
--- 56,67 ----
function pmcCheckLinks(&$str)
{
! // Handle urls and 'news:' links
! $urlPattern = '(^| )(([^ ]+://[^ ]+)|(www\\.[^ ]+)|(news:[^ ]+))( |$)';
! $str = eregi_replace($urlPattern, '\\1<a href="\\2" target="_blank">\\2</a>\\6', $str);
! $str = str_replace('<a href="www', '<a href="http://www', str_replace('<a href="WWW', '<a href="http://WWW', $str));
! // Handle e-mail address
! $emailPattern = '(^| )((mailto:)|())([^ ]+@[^ ]+)( |$)';
! $str = eregi_replace($emailPattern, '\\1<a href="mailto:\\5" target="_blank">\\2\\5</a>\\6', $str);
} // end of the 'pmcCheckLinks()' function
|