function mailIt($content, $subject, $email, $recipient, $bcc) { global $attachuser, $attachtemp, $attachsize, $attachtype, $this_version; $headpart = ""; // build message headers if ($email == '') { $email = "*****@*****.**"; } $headpart = "From: {$email}\r\n"; $headpart .= "Reply-To: {$email}\r\n"; if ($bcc != '') { $headpart .= "Bcc: {$bcc}\r\n"; } $headpart .= "X-Mailer: HiQ FormMail {$this_version}\r\n"; $headpart .= "Content-Type: text/plain; charset=ISO-8859-1\r\n"; $headpart .= "Content-Transfer-Encoding: 7bit\r\n\r\n"; if ($attachuser) { // create a MIME boundary string $boundary = md5(uniqid(time())); // add MIME data to the message headers $headpart = "MIME-Version:1.0\r\n"; $headpart .= "From: {$email}\r\n"; $headpart .= "Reply-To: {$email}\r\n"; if ($bcc != '') { $headpart .= "Bcc: {$bcc}\r\n"; } $headpart .= "X-Mailer: HiQ FormMail Version {$this_version}\r\n"; $headpart .= "Content-Type: multipart/mixed;\r\n\tboundary=\"{$boundary}\"\r\n"; $msgpart = "This is a multi-part message in MIME format.\r\n"; $msgpart .= "\r\n--{$boundary}\r\n"; $msgpart .= "Content-Type: text/plain; charset=ISO-8859-1\r\n"; $msgpart .= "Content-Transfer-Encoding: 8bit\r\n\r\n"; $msgpart .= "{$content}\r\n"; for ($i = 0; $i < count($attachuser); $i++) { $msgpart .= "\r\n--{$boundary}\r\n"; $fname = basename($attachuser[$i]); $msgpart .= "Content-Type: {$attachtype[$i]}; \r\n\tname=\"{$fname}\"\r\n"; $msgpart .= "Content-Transfer-Encoding: base64\r\n"; $msgpart .= "Content-Disposition: attachment; filename=\"{$fname}\"\r\n\r\n"; $fcontent = fread(fopen($attachtemp[$i], "r"), filesize($attachtemp[$i])); $fcontent = chunk_split(base64_encode($fcontent)); $msgpart .= "{$fcontent}\r\n"; } $msgpart .= "\r\n--{$boundary}--\r\n"; } else { $msgpart .= "{$content}\r\n"; } if (!mail($recipient, $subject, $msgpart, $headpart)) { deleteTempFiles(); issueSingleError("An undetermined error occured while attempting to send mail."); } deleteTempFiles(); }
* Upload user's file */ case 'uploadFile': $sContents = uploadVideo($_FILES['Filedata']['tmp_name'], $sId); $sContentsType = "other"; break; case 'initFile': $sContents = initVideo($sId, $sTitle, $sCategory, $sTags, $sDesc); $sContentsType = "other"; break; case 'publishRecordedFile': $sContents = publishRecordedVideo($sId, $sTitle, $sCategory, $sTags, $sDesc); $sContentsType = "other"; break; case 'removeTempFiles': deleteTempFiles($sId); break; case 'screenshot': $sPlayFile = $sFilesPath . $sId . (file_exists($sFilesPath . $sId . M4V_EXTENSION) ? M4V_EXTENSION : FLV_EXTENSION); if (grabImages($sPlayFile, $sFilesPath . $sId, $sTime, true)) { $sContents = parseXml($aXmlTemplates['result'], "", SUCCESS_VAL); } else { $sContents = parseXml($aXmlTemplates['result'], "msgErrorScreenshot", FAILED_VAL); } break; case 'screenshotRecorder': $sFile = $sFilesPath . $sId . TEMP_FILE_NAME; $sPlayFile = $sFile . (file_exists($sFile . M4V_EXTENSION) ? M4V_EXTENSION : FLV_EXTENSION); if (grabImages($sPlayFile, $sFile, $sTime, true)) { $sContents = parseXml($aXmlTemplates['result'], "", SUCCESS_VAL); } else {
$bJustRename = $sConvert != TRUE_VAL; if (!convert($sId, $bJustRename)) { deleteTempFiles($sId); break; } $sAutoApprove = $bAdmin ? TRUE_VAL : getSettingValue($sModule, "autoApprove"); $sUri = genUri($sTitle); getResult("INSERT INTO `" . MODULE_DB_PREFIX . "Files`(`CategoryId`, `Title`, `Uri`, `Tags`, `Description`, `Date`, `Owner`, `Approved`) VALUES ('" . $sCategory . "', '" . $sTitle . "', '" . $sUri . "', '" . $sTags . "', '" . $sDesc . "', '" . time() . "', '" . $sId . "', '" . $sAutoApprove . "')"); $sFileId = getLastInsertId(); if (!renameFile($sId, $sFileId)) { deleteTempFiles($sId); getResult("DELETE FROM `" . MODULE_DB_PREFIX . "Files` WHERE `ID`='" . $sFileId . "' LIMIT 1"); break; } $sNewFileName = $sFileId . MP3_EXTENSION; deleteTempFiles($sId, true); parseTags($sFileId); if ($sId != "0") { getResult("UPDATE `" . MODULE_DB_PREFIX . "PlayLists` SET `Order`=`Order`+1 WHERE `Owner` = '" . $sId . "'"); getResult("INSERT INTO `" . MODULE_DB_PREFIX . "PlayLists` VALUES('" . $sFileId . "', '" . $sId . "', '1')"); } $sContents = parseXml($aXmlTemplates['result'], "", SUCCESS_VAL); $sContents .= parseXml($aXmlTemplates['file'], $sFileId, $sNewFileName); break; case 'updateFile': getResult("UPDATE `" . MODULE_DB_PREFIX . "Files` SET `Title`='" . $sTitle . "', `Tags`='" . $sTags . "', `Description`='" . $sDesc . "' WHERE `ID`='" . $sFile . "' LIMIT 1"); parseTags($sFile); break; case 'approveFile': $aFiles = empty($sFile) ? array() : explode(",", $sFile); $sIn = count($aFiles > 0) ? " IN('" . implode("','", $aFiles) . "')" : " IN('0')";
function convertVideo($sId) { global $sModule; global $sFilesPath; $sTempFile = $sFilesPath . $sId; $sSourceFile = $sTempFile; $bUseX264 = usex264(); $sTmpl = prepareCommand($GLOBALS['aConvertTmpls'][$bUseX264 ? "playX264" : "play"], array("bitrate" => getVideoBitrate(), "audio_options" => $bUseX264 ? "-acodec libfaac -ab 128kb -ac 2 -ar 44100" : "-acodec libmp3lame -ar 44100")); if (file_exists($sTempFile) && filesize($sTempFile) > 0) { $sTmpl = prepareCommand($sTmpl, array("input" => $sTempFile, "size" => getVideoSize($sTempFile))); } else { $sSourceFile .= FLV_EXTENSION; if (file_exists($sSourceFile) && filesize($sSourceFile) > 0) { $sTmpl = prepareCommand($sTmpl, array("input" => $sSourceFile, "size" => getVideoSize($sSourceFile))); } } if (empty($sTmpl)) { return false; } $sDBModule = DB_PREFIX . ucfirst($sModule); getResult("UPDATE `" . $sDBModule . "Files` SET `Date`='" . time() . "', `Status`='" . STATUS_PROCESSING . "' WHERE `ID`='" . $sId . "'"); $bResult = convertMainVideo($sId, $sTmpl); if (!$bResult) { return false; } $sMobileFile = $sTempFile . MOBILE_EXTENSION; $sMobileCommand = prepareCommand($GLOBALS['aConvertTmpls']['mobile'], array("input" => $sSourceFile, "size" => "qcif", "output" => $sMobileFile)); $bResult = convertVideoFile($sMobileFile, $sMobileCommand); if ($bResult) { $sAutoApprove = getSettingValue($sModule, "autoApprove") == TRUE_VAL ? STATUS_APPROVED : STATUS_DISAPPROVED; getResult("UPDATE `" . $sDBModule . "Files` SET `Date`='" . time() . "', `Status`='" . $sAutoApprove . "' WHERE `ID`='" . $sId . "'"); } else { getResult("UPDATE `" . $sDBModule . "Files` SET `Status`='" . STATUS_FAILED . "' WHERE `ID`='" . $sId . "'"); } deleteTempFiles($sId); return $bResult; }
if ($thisDir != '') { $content .= "HTTP_REFERER: " . $_SERVER['HTTP_REFERER'] . "\n"; } $thisDir = $config->getDirective('REMOTE_ADDR'); if ($thisDir != '') { $content .= "REMOTE_ADDR: " . $_SERVER['REMOTE_ADDR'] . "\n"; } $thisDir = $config->getDirective('BROWSER'); if ($thisDir != '') { $content .= "BROWSER: " . $_SERVER['HTTP_USER_AGENT'] . "\n"; } // IF NO ERRORS send it off // If there are errors we need to delete any temp files which may have // been uploaded prior to calling the issueErrors function. if ($errorlist != "") { deleteTempFiles(); $ehead = $config->getDirective('er_header_file'); $efoot = $config->getDirective('er_footer_file'); issueErrors($errorlist, $ehead, $efoot); } else { // //// security patch 09/22/05 if (eregi("\r", $recipient)) { die("<B>Error Exit</B> Possible Spam Bot attack. Carriage return not allowed in To"); } if (eregi("\n", $recipient)) { die("<B>Error Exit</B> Possible Spam Bot attack. Line feed not allowed in To"); } if (eregi("\r", $subject)) { die("<B>Error Exit</B> Possible Spam Bot attack. Carriage return not allowed in subject"); }
function convertVideo($sId) { global $sModule; global $sFilesPath; $sTempFile = $sFilesPath . $sId; $sSourceFile = $sTempFile; $bUseX264 = usex264(); $sTmpl = prepareCommand($GLOBALS['aConvertTmpls'][$bUseX264 ? "playX264" : "play"], array("bitrate" => getVideoBitrate(), "audio_options" => $bUseX264 ? " -acodec aac -strict experimental -b:a 128k -ar 44100 " : "-acodec libmp3lame -b:a 128k -ar 44100 ")); if (file_exists($sTempFile) && filesize($sTempFile) > 0) { $sTmpl = prepareCommand($sTmpl, array("input" => $sTempFile, "size" => getVideoSize($sTempFile))); } else { $sSourceFile .= FLV_EXTENSION; if (file_exists($sSourceFile) && filesize($sSourceFile) > 0) { $sTmpl = prepareCommand($sTmpl, array("input" => $sSourceFile, "size" => getVideoSize($sSourceFile))); } } if (empty($sTmpl)) { return false; } $sDBModule = DB_PREFIX . ucfirst($sModule); getResult("UPDATE `" . $sDBModule . "Files` SET `Date`='" . time() . "', `Status`='" . STATUS_PROCESSING . "' WHERE `ID`='" . $sId . "'"); $bResult = convertMainVideo($sId, $sTmpl); if (!$bResult) { return false; } $oAlert = new BxDolAlerts('bx_videos', 'convert', $sId, getLoggedId(), array('result' => &$bResult, 'ffmpeg' => $GLOBALS['sFfmpegPath'], 'tmp_file' => $sTempFile, 'bitrate' => getVideoBitrate(), 'size' => getVideoSize($sTempFile))); $oAlert->alert(); if ($bResult) { $sAutoApprove = getSettingValue($sModule, "autoApprove") == TRUE_VAL ? STATUS_APPROVED : STATUS_DISAPPROVED; getResult("UPDATE `" . $sDBModule . "Files` SET `Date`='" . time() . "', `Status`='" . $sAutoApprove . "' WHERE `ID`='" . $sId . "'"); } else { getResult("UPDATE `" . $sDBModule . "Files` SET `Status`='" . STATUS_FAILED . "' WHERE `ID`='" . $sId . "'"); } deleteTempFiles($sId); return $bResult; }