Update of /cvsroot/phpmychat/phpMyChat-0.15/chat/lib
In directory usw-pr-cvs1:/tmp/cvs-serv18521/chat/lib
Modified Files:
smilies.lib.php3
Log Message:
Added the ability to associate a reserved smiley to a registered user
Index: smilies.lib.php3
===================================================================
RCS file: /cvsroot/phpmychat/phpMyChat-0.15/chat/lib/smilies.lib.php3,v
retrieving revision 1.8
retrieving revision 1.9
diff -C2 -r1.8 -r1.9
*** smilies.lib.php3 2001/04/24 11:25:29 1.8
--- smilies.lib.php3 2001/04/26 20:12:26 1.9
***************
*** 36,39 ****
--- 36,43 ----
* - the smilies codes are used in a case sensitive way ('a' and 'A' are
* different).
+ *
+ * Note that the code ':mine:' is reserved: it will be replace by a gif smiley
+ * which name is the nick of the user if you put such one inside the
+ * 'chat/image/smilies' subdirectory and if the usrs is a registered one.
*/
$smilies = array(
***************
*** 121,130 ****
--- 125,139 ----
*
* @global array the smilies array
+ * @global array the session data
*
* @access public
+ *
+ * @todo ensure all invalid characters for file names have been checked
+ * before to use the 'getImageSize()' function
*/
function pmcCheckForSmilies(&$string)
{
global $smilies;
+ global $dbSessionVars;
// Sort the smilies array in a convenient order
***************
*** 159,162 ****
--- 168,178 ----
$substring = str_replace(' ' . $modifiedKey . ' ', ' <img src="images/smilies/' . $prop[0] . '" width="' . $prop[1] . '" height="' . $prop[2] . '" alt="' . str_replace('"', '"', stripslashes($key)) . '" /> ', $substring);
}
+ }
+ // Reserved smilies for registered users
+ if (!empty($dbSessionVars['pwdHash'])
+ && !ereg('[/:\*?"<>|]', $dbSessionVars['nick'])
+ && ($prop = getImageSize('./images/smilies/' . $dbSessionVars['nick'] . '.gif')))
+ {
+ $substring = str_replace(' :mine: ', ' <img src="images/smilies/' . $dbSessionVars['nick'] . '.gif" width="' . $prop[0] . '" height="' . $prop[1] . '" alt="' . str_replace('"', '"', $dbSessionVars['nick']) . '" /> ', $substring);
}
$tmp[$i] = substr($substring, 1, strlen($substring) - 2);
|