38 if(file_exists($sFolderPath) && is_dir($sFolderPath)) {
40 while(
false !== ($sPlugin = readdir($rDirHandle)))
41 if(strpos($sPlugin,
".swf") === strlen($sPlugin)-4)
43 closedir($rDirHandle);
81 $rHandle = fopen($sFileName,
"rt");
82 $sContents = fread($rHandle, filesize($sFileName)) ;
86 $iMaxFileSize = min((ini_get(
'upload_max_filesize') + 0), (ini_get(
'post_max_size') + 0), $iFileSize);
101 case 'senderAuthorize':
115 case 'recipientAuthorize':
117 if(!
empty($sSearchResult)) {
132 if(file_exists($sFileName)) {
133 $rHandle = fopen($sFileName,
"rt");
134 $sContents = fread($rHandle, filesize($sFileName));
143 $sConfigFile =
"config.xml";
145 $aSmilesets = array();
147 while(
false !== ($sDir = readdir($rDirHandle)))
149 $aSmilesets[] = $sDir;
150 closedir($rDirHandle);
151 if(count($aSmilesets) == 0)
break;
153 if(isset($_COOKIE[
"RayzFontsmileset"]))
157 $sUserSmileset =
getValue(
"SELECT `Smileset` FROM `" . MODULE_DB_PREFIX .
"Profiles` WHERE `ID`='" .
$sSndId .
"'");
162 for($i=0; $i<count($aSmilesets); $i++) {
189 $rResult =
getResult(
"SELECT `Message` FROM `" . MODULE_DB_PREFIX .
"Pendings` WHERE `SenderID` = '" .
$sSndId .
"' AND `RecipientID` = '" .
$sRspId .
"' ORDER BY `ID`");
199 getResult(
"DELETE FROM `" . MODULE_DB_PREFIX .
"Pendings` WHERE `SenderID`='" .
$sSndId .
"' AND `RecipientID`='" .
$sRspId .
"'");
204 if(is_uploaded_file($_FILES[
'Filedata'][
'tmp_name'])) {
207 move_uploaded_file($_FILES[
'Filedata'][
'tmp_name'], $sFilePath);
208 @chmod($sFilePath, 0644);
216 if(!file_exists($sFilePath) || filesize($sFilePath) == 0)
break;
218 if(
empty($sContactId)) $sFileName =
time();
220 getResult(
"INSERT INTO `" . MODULE_DB_PREFIX .
"Messages`(`ContactID`, `Message`, `Type`, `When`) VALUES('" . $sContactId .
"', '" .
$sMessage .
"', 'file', '" .
time() .
"')");
223 $sFileName .=
".file";
224 if(!@rename($sFilePath,
$sFilesPath . $sFileName))
break;
230 $sId = str_replace(
".file",
"",
$sId);
241 $sBlocked = count($aBlocked) == 0 ?
"" :
" AND `SenderID` NOT IN('" . implode(
",", $aBlocked) .
"')";
242 $rResult =
getResult(
"SELECT `SenderID`, `Message` FROM `" . MODULE_DB_PREFIX .
"Pendings` WHERE `RecipientID`='" .
$sRspId .
"'" . $sBlocked .
" ORDER BY `ID` DESC");
244 while($aMsg = $rResult->fetch()) {
249 if($rResult->rowCount())
250 getResult(
"DELETE FROM `" . MODULE_DB_PREFIX .
"Pendings` WHERE `RecipientID`='" .
$sRspId .
"'");
259 case 'refreshStatus':
262 if(
empty($iContactId))
getResult(
"INSERT INTO `" . MODULE_DB_PREFIX .
"Contacts`(`SenderID`, `RecipientID`, `When`) VALUES ('" .
$sSndId .
"', '" .
$sRspId .
"', '" .
time() .
"')");
271 getResult(
"UPDATE `" . MODULE_DB_PREFIX .
"Contacts` SET `Online`='" .
$sOnline .
"' WHERE `SenderID`='" .
$sSndId .
"' AND `RecipientID`='" .
$sRspId .
"' LIMIT 1");
277 case 'recipientUpdate':
280 if(
empty(
$iId))
getResult(
"INSERT INTO `" . MODULE_DB_PREFIX .
"Contacts`(`SenderID`, `RecipientID`, `Online`, `When`) VALUES ('" .
$sSndId .
"', '" .
$sRspId .
"', '" . USER_STATUS_ONLINE .
"', '" .
time() .
"')");
287 $sQuery =
"SELECT * FROM `" . MODULE_DB_PREFIX .
"Contacts` AS `imc`, `" . MODULE_DB_PREFIX .
"Messages` AS `imm` WHERE `imc`.`ID`=`imm`.`ContactID` AND `imm`.`Type`='file' AND `imc`.`SenderID`='" .
$sRspId .
"' AND `imc`.`RecipientID`='" .
$sSndId .
"' ORDER BY `imm`.`ID`";
289 while($aFile = $res->fetch()) {
290 $sFileName = $aFile[
'ID'] .
".file";
291 if(!file_exists(
$sFilesPath . $sFileName))
continue;
299 $res =
getResult(
"SELECT * FROM `" . MODULE_DB_PREFIX .
"Messages` WHERE `ContactID`='" .
$iId .
"' AND `Type`='text' ORDER BY `ID`");
300 while($aMsg = $res->fetch()) {
301 $aStyle = unserialize($aMsg[
'Style']);
302 $sMsgs .=
parseXml(
$aXmlTemplates[
'message'], $aMsg[
'ID'], stripslashes($aMsg[
'Message']), $aStyle[
'color'], $aStyle[
'bold'], $aStyle[
'underline'], $aStyle[
'italic'], $aStyle[
'size'], $aStyle[
'font'], $aStyle[
'smileset']);
307 getResult(
"DELETE FROM `" . MODULE_DB_PREFIX .
"Messages` WHERE `ContactID`='" .
$iId .
"'");
316 if(!
empty($iContactRid)) {
323 $sStyle = serialize(array(
'color' => $sColor,
'bold' => $sBold,
'underline' => $sUnderline,
'italic' => $sItalic,
'smileset' =>
$sSmileset,
'size' => $iSize,
'font' => $sFont));
325 if(!
empty($iContactSid))
326 $rResult =
getResult(
"INSERT INTO `" . MODULE_DB_PREFIX .
"Messages` (`ContactID`, `Message`, `Style`, `When`) VALUES ('" . $iContactSid .
"', '" .
$sMsg .
"', '" . $sStyle .
"', '" .
time() .
"')");
335 if(file_exists($sFileName)) {
336 $rHandle = @fopen($sFileName,
"rt");
337 $sContents = @fread($rHandle, filesize($sFileName)) ;