public function sendEmailAlert() { $this->kuser = kuserPeer::retrieveByPK($this->getKuserId()); if ($this->kuser) { kJobsManager::addMailJob(null, 0, $this->kuser->getPartnerId(), $this->getAlertType(), kMailJobData::MAIL_PRIORITY_NORMAL, kconf::get("batch_notification_sender_email"), kconf::get("batch_notification_sender_name"), $this->kuser->getEmail(), $this->getBodyParamsArray(), $this->getSubjectParamsArray()); } }
public function execute() { $this->sent_request = false; if (isset($_POST['partner_id'])) { // do mail $mail_body = array(); foreach ($_POST as $key => $val) { $mail_body[] = $key . ': ' . $val; } $strMailBody = implode('<BR><BR>', $mail_body); $body_params = array($strMailBody); $subject_params = array($_POST['subject']); kJobsManager::addMailJob(null, 0, $_POST['partner_id'], self::SUPPORT_EMAIL_TYPE_ID, kMailJobData::MAIL_PRIORITY_NORMAL, $_POST['email'], $_POST['your_name'] . ' ', '*****@*****.**', $body_params, $subject_params); $this->sent_request = true; } sfView::SUCCESS; }
public function execute() { // Prevent the page fron being embeded in an iframe header('X-Frame-Options: SAMEORIGIN'); $this->sent_request = false; if (isset($_GET['style']) && $_GET['style'] == 'v') { // kmc virgo $this->closeFunction = 'parent.kmcCloseModal()'; $this->bodyBgColor = 'E1E1E1'; } else { $this->closeFunction = 'parent.kmc.utils.closeModal()'; $this->bodyBgColor = 'F8F8F8'; } if (isset($_POST['partner_id'])) { // do mail $mail_body = array(); foreach ($_POST as $key => $val) { $mail_body[] = $key . ': ' . $val; } $strMailBody = implode('<BR><BR>', $mail_body); $body_params = array($strMailBody); $subject_params = array($_POST['subject']); kJobsManager::addMailJob(null, 0, $_POST['partner_id'], self::SUPPORT_EMAIL_TYPE_ID, kMailJobData::MAIL_PRIORITY_NORMAL, $_POST['email'], $_POST['your_name'] . ' ', '*****@*****.**', $body_params, $subject_params); // Send support ticket to salesforce $post_items = array(); foreach ($_POST as $key => $value) { $post_items[] = $key . '=' . $value; } $post_string = implode('&', $post_items); $ch = curl_init("https://www.salesforce.com/servlet/servlet.WebToCase?encoding=UTF-8"); curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false); curl_setopt($ch, CURLOPT_POSTFIELDS, $post_string); $this->curlResult = curl_exec($ch); curl_close($ch); $this->sent_request = true; } sfView::SUCCESS; }
public static function sendNewUserMail(kuser $user, $existingUser) { // setup parameters $partnerId = $user->getPartnerId(); $userName = $user->getFullName(); if (!$userName) { $userName = $user->getPuserId(); } $creatorUserName = '******'; if (!is_null(kCurrentContext::$ks_uid)) { $creatorUser = kuserPeer::getKuserByPartnerAndUid($partnerId, kCurrentContext::$ks_uid); if ($creatorUser) { $creatorUserName = $creatorUser->getFullName(); } } $publisherName = PartnerPeer::retrieveByPK($partnerId)->getName(); $loginEmail = $user->getEmail(); $roleName = $user->getUserRoleNames(); $puserId = $user->getPuserId(); if (!$existingUser) { $resetPasswordLink = UserLoginDataPeer::getPassResetLink($user->getLoginData()->getPasswordHashKey()); } $kmcLink = trim(kConf::get('apphome_url'), '/') . '/kmc'; $adminConsoleLink = trim(kConf::get('admin_console_url')); $contactLink = kConf::get('contact_url'); $beginnersGuideLink = kConf::get('beginners_tutorial_url'); $quickStartGuideLink = kConf::get('quick_start_guide_url'); // setup mail $mailType = null; $bodyParams = array(); if ($partnerId == Partner::ADMIN_CONSOLE_PARTNER_ID) { if ($existingUser) { $mailType = self::KALTURA_NEW_EXISTING_USER_ADMIN_CONSOLE_EMAIL; $bodyParams = array($userName, $creatorUserName, $loginEmail, $roleName); } else { $mailType = self::KALTURA_NEW_USER_ADMIN_CONSOLE_EMAIL; $bodyParams = array($userName, $creatorUserName, $loginEmail, $resetPasswordLink, $roleName, $adminConsoleLink); } } else { if ($existingUser) { $mailType = self::KALTURA_NEW_EXISTING_USER_EMAIL; $bodyParams = array($userName, $creatorUserName, $publisherName, $loginEmail, $partnerId, $publisherName, $publisherName, $roleName, $publisherName, $puserId, $kmcLink, $contactLink, $beginnersGuideLink, $quickStartGuideLink); } else { $mailType = self::KALTURA_NEW_USER_EMAIL; $bodyParams = array($userName, $creatorUserName, $publisherName, $loginEmail, $resetPasswordLink, $partnerId, $publisherName, $publisherName, $roleName, $publisherName, $puserId, $kmcLink, $contactLink, $beginnersGuideLink, $quickStartGuideLink); } } // add mail job kJobsManager::addMailJob(null, 0, $partnerId, $mailType, kMailJobData::MAIL_PRIORITY_NORMAL, kConf::get("partner_registration_confirmation_email"), kConf::get("partner_registration_confirmation_name"), $loginEmail, $bodyParams); }
public static function emailChangedEmail($partner_id, $partner_old_email, $partner_new_email, $partner_name, $mail_type) { kJobsManager::addMailJob(null, 0, $partner_id, $mail_type, kMailJobData::MAIL_PRIORITY_NORMAL, kConf::get("partner_change_email_email"), kConf::get("partner_change_email_name"), $partner_old_email . ',' . $partner_new_email, array($partner_name, $partner_old_email, $partner_new_email)); }
public function myBatchFlattenServer($script_name) { $this->script_name = $script_name; $this->register($script_name); SET_CONTEXT("FS"); $MAX_ITERATIONS_DUE_TO_PROPEL_MEMORY_LEAK = 10000000; self::initDb(); list($sleep_between_cycles, $number_of_times_to_skip_writing_sleeping) = self::getSleepParams('app_flatten_'); $last_worker_count = 0; $iteration = 0; $c = new Criteria(); $currentDc = kDataCenterMgr::getCurrentDc(); $c->add(BatchJobPeer::DC, kDataCenterMgr::getCurrentDcId()); $c->add(BatchJobPeer::JOB_TYPE, BatchJobType::FLATTEN); $c->add(BatchJobPeer::STATUS, BatchJob::BATCHJOB_STATUS_PROCESSED); $temp_count = 0; while (1) { self::exitIfDone(); try { sleep($sleep_between_cycles); $jobs = BatchJobPeer::doSelect($c); foreach ($jobs as $job) { $data = json_decode($job->getData(true), true); $entry_id = $data['entryId']; $entry_int_id = $data['entryIntId']; $entry_version = $data['entryVersion']; $file_format = $data['fileFormat']; $entry = entryPeer::retrieveByPK($entry_id); if (!$entry) { // entry is probably deleted if it is not returned from retrieveByPK // close job as failed $job->setStatus(BatchJob::BATCHJOB_STATUS_FAILED); $job->setDescription("could not retrieve entry, probably deleted"); TRACE("could not retrieve entry {$entry_id} , probably deleted"); $job->save(); continue; } $fileSyncKey = $entry->getSyncKey(entry::FILE_SYNC_ENTRY_SUB_TYPE_DOWNLOAD, $file_format); $fullFinalPath = kFileSyncUtils::getLocalFilePathForKey($fileSyncKey); $finalPathNoExt = substr($fullFinalPath, 0, strlen($fullFinalPath) - strlen($file_format)); myContentStorage::fullMkdir($fullFinalPath); $wildcardFinalPath = $finalPathNoExt . "*"; $older_files = glob($wildcardFinalPath); foreach ($older_files as $older_file) { TRACE("removing old file: [{$older_file}]"); @unlink($older_file); } TRACE("Downloading: {$fullFinalPath}"); kFile::downloadUrlToFile($data["serverUrl"], $fullFinalPath); if (!file_exists($fullFinalPath)) { TRACE("file doesnt exist: " . $data["serverUrl"]); $job->setDescription("file doesnt exist: " . $data["serverUrl"]); $job->setStatus(BatchJob::BATCHJOB_STATUS_FAILED); } else { if (filesize($fullFinalPath) < 100000) { @unlink($fullFinalPath); TRACE("file too small: " . $data["serverUrl"]); $job->setDescription("file too small: " . $data["serverUrl"]); $job->setStatus(BatchJob::BATCHJOB_STATUS_FAILED); } else { if ($data['email']) { $downloadLink = $entry->getDownloadUrl() . '/format/' . $file_format; kJobsManager::addMailJob(null, $entry_id, $entry->getPartnerId(), self::KALTURAS_FLATTEN_READY, kMailJobData::MAIL_PRIORITY_NORMAL, kConf::get("batch_flatten_video_sender_email"), kConf::get("batch_flatten_video_sender_name"), $data['email'], array($data['email'], $downloadLink)); } TRACE("Deleting: " . $data["deleteUrl"]); kFile::downloadUrlToString($data["deleteUrl"]); myNotificationMgr::createNotification(kNotificationJobData::NOTIFICATION_TYPE_ENTRY_UPDATE, $entry); $job->setStatus(BatchJob::BATCHJOB_STATUS_FINISHED); $filePath = kFileSyncUtils::getLocalFilePathForKey($fileSyncKey); if (file_exists($filePath)) { try { kFileSyncUtils::createSyncFileForKey($fileSyncKey); } catch (Exception $ex) { TRACE("ignore ERROR: " . $ex->getMessage()); } } else { TRACE("The file [{$filePath}] doesn't exists, not creating FileSync"); } } } $job->save(); } } catch (Exception $ex) { TRACE("ERROR: " . $ex->getMessage()); self::initDb(true); self::failed(); } if ($temp_count == 0) { TRACE("Ended conversion. sleeping for a while (" . $sleep_between_cycles . " seconds). Will write to the log in (" . $sleep_between_cycles * $number_of_times_to_skip_writing_sleeping . ") seconds"); } $temp_count++; if ($temp_count >= $number_of_times_to_skip_writing_sleeping) { $temp_count = 0; } } }
private function emailResetPassword($partner_id, $cms_email, $admin_name, $resetPasswordLink) { kJobsManager::addMailJob(null, 0, $partner_id, adminKuserPeer::KALTURAS_CMS_PASSWORD_RESET, kMailJobData::MAIL_PRIORITY_NORMAL, kConf::get("partner_change_email_email"), kConf::get("partner_change_email_name"), $cms_email, array($admin_name, $resetPasswordLink)); }
public static function handleLiveReportExportAborted(BatchJob $dbBatchJob, kLiveReportExportJobData $data) { $time = date("m-d-y H:i", $data->timeReference + $data->timeZoneOffset); $email_id = MailType::MAIL_TYPE_LIVE_REPORT_EXPORT_ABORT; $params = array($dbBatchJob->getPartner()->getName(), $time, $dbBatchJob->getId()); $titleParams = array($time); kJobsManager::addMailJob(null, 0, $dbBatchJob->getPartnerId(), $email_id, kMailJobData::MAIL_PRIORITY_NORMAL, kConf::get("live_report_sender_email"), kConf::get("live_report_sender_name"), $data->recipientEmail, $params, $titleParams); return $dbBatchJob; }
private function sendRegistrationInformation(Partner $partner, kuser $adminKuser, $existingUser, $recipient_email = null, $partner_type = 1) { $mailType = null; $bodyParams = array(); $partnerId = $partner->getId(); $userName = $adminKuser->getFullName(); if (!$userName) { $userName = $adminKuser->getPuserId(); } $loginEmail = $adminKuser->getEmail(); $loginData = $adminKuser->getLoginData(); $hashKey = $loginData->getNewHashKeyIfCurrentInvalid(); $resetPasswordLink = UserLoginDataPeer::getPassResetLink($hashKey); $kmcLink = trim(kConf::get('apphome_url'), '/') . '/kmc'; $contactLink = kConf::get('contact_url'); $contactPhone = kConf::get('contact_phone_number'); $beginnersGuideLink = kConf::get('beginners_tutorial_url'); $quickStartGuideLink = kConf::get('quick_start_guide_url'); if ($recipient_email == null) { $recipient_email = $loginEmail; } // send the $cms_email,$cms_password, TWICE ! if (kConf::get('kaltura_installation_type') == 'CE') { $partner_type = 1; } switch ($partner_type) { // send different email for different partner types case 1: // KMC signup if ($existingUser) { $mailType = self::KALTURAS_EXISTING_USER_REGISTRATION_CONFIRMATION; $bodyParams = array($userName, $loginEmail, $partnerId, $contactLink, $contactPhone, $beginnersGuideLink, $quickStartGuideLink); } else { $mailType = self::KALTURAS_CMS_REGISTRATION_CONFIRMATION; $bodyParams = array($userName, $loginEmail, $partnerId, $resetPasswordLink, $kmcLink, $contactLink, $contactPhone, $beginnersGuideLink, $quickStartGuideLink); } break; default: // all others if ($existingUser) { $mailType = self::KALTURAS_DEFAULT_EXISTING_USER_REGISTRATION_CONFIRMATION; $bodyParams = array($userName, $loginEmail, $partnerId, $contactLink, $contactPhone, $beginnersGuideLink, $quickStartGuideLink); } else { $mailType = self::KALTURAS_DEFAULT_REGISTRATION_CONFIRMATION; $bodyParams = array($userName, $loginEmail, $partnerId, $resetPasswordLink, $kmcLink, $contactLink, $contactPhone, $beginnersGuideLink, $quickStartGuideLink); } break; } kJobsManager::addMailJob(null, 0, $partnerId, $mailType, kMailJobData::MAIL_PRIORITY_NORMAL, kConf::get("partner_registration_confirmation_email"), kConf::get("partner_registration_confirmation_name"), $recipient_email, $bodyParams); }
public static function sendBulkUploadNotificationEmail(BatchJob $dbBatchJob, $email_id, $params) { kJobsManager::addMailJob(null, 0, $dbBatchJob->getPartnerId(), $email_id, kMailJobData::MAIL_PRIORITY_NORMAL, kConf::get("batch_alert_email"), kConf::get("batch_alert_name"), $dbBatchJob->getPartner()->getBulkUploadNotificationsEmail(), $params); }