public function saveEmailConfiguration(EmailConfiguration $emailConfiguration)
 {
     try {
         $emailConfiguration->save();
     } catch (Exception $e) {
         throw new DaoException($e->getMessage());
     }
 }
 /**
  * Retrieve EmailConfiguration
  * 
  * Fetch the existing email configuration or create a new one if not exists
  * 
  * @version 2.7 
  * @return Doctrine Collection 
  */
 public function getEmailConfiguration()
 {
     $emailConfiguration = $this->emailConfigurationDao->getEmailConfiguration();
     if (!$emailConfiguration) {
         $emailConfiguration = new EmailConfiguration();
         $emailConfiguration->setId(1);
         return $emailConfiguration;
     } else {
         return $emailConfiguration;
     }
 }
예제 #3
0
 public function sendAction()
 {
     include 'Mail.php';
     $data = $_POST;
     $headers['From'] = $data['username'];
     $headers['Subject'] = $data['subject'];
     $headers['Date'] = date("r");
     $recipients = array();
     if (is_array($data['to'])) {
         foreach ($data['to'] as $to) {
             $recipients[] = $to;
         }
     } else {
         $recipients[] = $data['to'];
     }
     if (array_key_exists('body', $data)) {
         $body = $data['body'];
     } else {
         $body = "";
     }
     $params['host'] = EmailConfiguration::getSmtpHost();
     $params['port'] = EmailConfiguration::getSmtpPort();
     $params['auth'] = EmailConfiguration::getSmtpAuth();
     $params['username'] = $data['username'];
     $params['password'] = $data['password'];
     // Create the mail object using the Mail::factory method
     $mail_object =& Mail::factory('smtp', $params);
     $mail_object->send($recipients, $headers, $body);
 }
예제 #4
0
 public static function getDevelopmentRecipients($extramail = '')
 {
     $recipients = EmailConfiguration::getDevelopmentRecepients();
     if ($extramail !== '') {
         $recipients[] = $extramail;
     }
     return array_unique($recipients);
 }
예제 #5
0
 /**
  * Check if report account credentials are configured properly
  * 
  * @return boolean
  */
 public static function canSendReport()
 {
     $smtp_host = EmailConfiguration::getSmtpHost();
     $report_creds = EmailService::getReportCredentials();
     if (!$report_creds || trim($smtp_host) === '') {
         return false;
     }
     return true;
 }
 public function __construct(sfEventDispatcher $dispatcher, $options)
 {
     // Load client based configuration
     $cfg = EmailConfiguration::getCurrent();
     // Update settings for the current client
     $options["transport"]["param"]["host"] = $cfg['host'];
     $options["transport"]["param"]["port"] = $cfg['port'];
     $options["transport"]["param"]["username"] = $cfg['username'];
     $options["transport"]["param"]["password"] = $cfg['password'];
     parent::__construct($dispatcher, $options);
 }
예제 #7
0
 /**
  * Init htmlMimeMail5, EmailConfiguration, EmailNotificationConfiguration.
  * Set smtp params, sendmailpath, from.
  **/
 public function __construct()
 {
     $this->emailNotificationConfig = new EmailNotificationConfiguration();
     $confObj = new EmailConfiguration();
     $this->mailType = $confObj->getMailType();
     if ($this->mailType == 'smtp') {
         $config = array();
         $authType = $confObj->getSmtpAuth();
         if ($authType != EmailConfiguration::EMAILCONFIGURATION_SMTP_AUTH_NONE) {
             $config['auth'] = strtolower($authType);
             $config['username'] = trim($confObj->getSmtpUser());
             $config['password'] = trim($confObj->getSmtpPass());
         }
         $security = $confObj->getSmtpSecurity();
         if ($security != EmailConfiguration::EMAILCONFIGURATION_SMTP_SECURITY_NONE) {
             $config['ssl'] = strtolower($security);
         }
         $config['port'] = trim($confObj->getSmtpPort());
         $transport = new Zend_Mail_Transport_Smtp($confObj->getSmtpHost(), $config);
     } else {
         if ($this->mailType = 'sendmail') {
             $transport = new Zend_Mail_Transport_Sendmail();
         }
     }
     Zend_Mail::setDefaultTransport($transport);
     $this->mailer = new Zend_Mail();
     $this->mailer->setFrom($confObj->getMailAddress(), "OrangeHRM");
 }
예제 #8
0
 private static function getRecipients()
 {
     return array(EmailConfiguration::getSupportAddress());
 }
 function updateData($index, $id, $object, $noRedirect = false)
 {
     try {
         $extraParams = "";
         switch ($index) {
             case 'EST':
                 $empstat = new EmploymentStatus();
                 $empstat = $object;
                 $res = $empstat->updateEmpStat();
                 break;
             case 'JOB':
                 $jobtit = new JobTitle();
                 $jobtit = $object;
                 $res = $jobtit->updateJobTitles();
                 break;
             case 'SPC':
                 $jobSpec = $object;
                 try {
                     $res = $jobSpec->save();
                 } catch (JobSpecException $e) {
                     $res = false;
                 }
                 break;
             case 'CST':
                 $compstruct = new CompStruct();
                 $compstruct = $object;
                 $res = $compstruct->updateCompStruct();
                 break;
             case 'BNK':
                 $bankinfo = new BankInfo();
                 $bankinfo = $object;
                 $res = $bankinfo->updateBankInfo();
                 break;
             case 'TAX':
                 $taxinfo = new TaxInfo();
                 $taxinfo = $object;
                 $res = $taxinfo->updateTaxInfo();
                 break;
             case 'CCB':
                 $cashben = new CashBen();
                 $cashben = $object;
                 $res = $cashben->updateCashBenefits();
                 break;
             case 'COS':
                 $cost = new CostCenter();
                 $cost = $object;
                 $res = $cost->updateCostCenter();
                 break;
             case 'COU':
                 $country = new CountryInfo();
                 $country = $object;
                 $res = $country->updateCountryInfo();
                 break;
             case 'CUR':
                 $currency = new CurrencyTypes();
                 $currency = $object;
                 $res = $currency->updateCurrencyTypes();
                 break;
             case 'DWT':
                 $dwinfo = new DwellingType();
                 $dwinfo = $object;
                 $res = $dwinfo->updateDwellingType();
                 break;
             case 'ELE':
                 $eleinfo = new ElectorateInfo();
                 $eleinfo = $object;
                 $res = $eleinfo->updateElectorateInfo();
                 break;
             case 'EMC':
                 $empcatinfo = new EmployeeCat();
                 $empcatinfo = $object;
                 $res = $empcatinfo->updateEmployeeCat();
                 break;
             case 'EMG':
                 $empgrpinfo = new EmployeeGroup();
                 $empgrpinfo = $object;
                 $res = $empgrpinfo->updateEmployeeGroup();
                 break;
             case 'ETY':
                 $emptype = new EmployeeType();
                 $emptype = $object;
                 $res = $emptype->updateEmployeeType();
                 break;
             case 'EXC':
                 $exccat = new ExtraCurrActCat();
                 $exccat = $object;
                 $res = $exccat->updateExtraCurrActCat();
                 break;
             case 'DEF':
                 $hicode = new HierarchyDefInfo();
                 $hicode = $object;
                 $res = $hicode->updateHierarchyDefInfo();
                 break;
             case 'JDC':
                 $jdcat = new JDCategory();
                 $jdcat = $object;
                 $res = $jdcat->updateJDCategory();
                 break;
             case 'LOC':
                 $loc = new models_eimadmin_Location();
                 $loc = $object;
                 $res = $loc->updateLocation();
                 break;
             case 'MEM':
                 $memtype = new MembershipType();
                 $memtype = $object;
                 $res = $memtype->updateMembershipType();
                 break;
             case 'NAT':
                 $natinfo = new NationalityInfo();
                 $natinfo = $object;
                 $res = $natinfo->updateNationalityInfo();
                 break;
             case 'NCB':
                 $noncashben = new NonCashBen();
                 $noncashben = $object;
                 $res = $noncashben->updateNonCashBenefits();
                 break;
             case 'QLF':
                 $qualtype = new QualificationType();
                 $qualtype = $object;
                 $res = $qualtype->updateQualificationType();
                 break;
             case 'RTM':
                 $rattype = new RatingTypes();
                 $rattype = $object;
                 $res = $rattype->updateRatingTypes();
                 break;
             case 'RTE':
                 $rouinfo = new RouteInfo();
                 $rouinfo = $object;
                 $res = $rouinfo->updateRouteInfo();
                 break;
             case 'SGR':
                 $salgread = new SalaryGrades();
                 $salgread = $object;
                 $res = $salgread->updateSalaryGrades();
                 break;
             case 'SKI':
                 $skill = new Skills();
                 $skill = $object;
                 $res = $skill->updateSkills();
                 break;
             case 'ETH':
                 $ethnicrace = new EthnicRace();
                 $ethnicrace = $object;
                 $res = $ethnicrace->updateEthnicRace();
                 break;
             case 'EXA':
                 $extcainfo = new ExtraCurActInfo();
                 $extcainfo = $object;
                 $res = $extcainfo->updateExtraCurActInfo();
                 break;
             case 'MME':
                 $membinfo = new MembershipInfo();
                 $membinfo = $object;
                 $res = $membinfo->updateMembershipInfo();
                 break;
             case 'JDK':
                 $jdkr = new JDKra();
                 $jdkr = $object;
                 $res = $jdkr->updateJDKra();
                 break;
             case 'LAN':
                 $laninfo = new LanguageInfo();
                 $laninfo = $object;
                 $res = $laninfo->updateLanguageInfo();
                 break;
             case 'RLG':
                 $relinfo = new ReligionInfo();
                 $relinfo = $object;
                 $res = $relinfo->updateReligionInfo();
                 break;
             case 'SAT':
                 $satinfo = new SatutoryInfo();
                 $satinfo = $object;
                 $res = $satinfo->updateSatutoryInfo();
                 break;
             case 'UNI':
                 $unitype = new UniformType();
                 $unitype = $object;
                 $res = $unitype->updateUniformType();
                 break;
             case 'EXA':
                 $excurac = new ExtraCurActInfo();
                 $excurac = $object;
                 $res = $excurac->updateExtraCurActInfo();
                 break;
             case 'EDU':
                 $edu = new Education();
                 $edu = $object;
                 $res = $edu->updateEducation();
                 break;
             case 'JDT':
                 $jdt = new JDType();
                 $jdt = $object;
                 $res = $jdt->updateJDType();
                 break;
             case 'SBJ':
                 $subin = new SubjectInfo();
                 $subin = $object;
                 $res = $subin->updateSubjectInfo();
                 break;
             case 'SSK':
                 $subsk = new SubSkillInfo();
                 $subsk = $object;
                 $res = $subsk->updateSubSkillInfo();
                 break;
             case 'BCH':
                 $brch = new Branches();
                 $brch = $object;
                 $res = $brch->updateBranches();
                 break;
             case 'CHI':
                 $cmphier = new CompHierachy();
                 $cmphier = $object;
                 $res = $cmphier->updateCompHierachy();
                 break;
             case 'CTT':
                 $corptit = new CorpTitle();
                 $corptit = $object;
                 $res = $corptit->updateCorpTitles();
                 break;
             case 'DSG':
                 $desig = new Designations();
                 $desig = $object;
                 $res = $desig->updateDesignations();
                 break;
             case 'DIS':
                 $disinfo = new DistrictInfo();
                 $disinfo = $object;
                 $res = $disinfo->updateDistrictInfo();
                 break;
             case 'EEC':
                 $eeojobcat = new EEOJobCat();
                 $eeojobcat = $object;
                 $res = $eeojobcat->updateEEOJobCat();
                 break;
             case 'LIC':
                 $licenses = new Licenses();
                 $licenses = $object;
                 $res = $licenses->updateLicenses();
                 break;
             case 'CUS':
                 $customers = new Customer();
                 $customers = $object;
                 $res = $customers->updateCustomer();
                 break;
             case 'CTM':
                 $customField = $object;
                 try {
                     $customField->updateCustomField();
                     $res = true;
                 } catch (CustomFieldsException $e) {
                     $res = false;
                 }
                 break;
             case 'CHD':
                 // Fall through to 'CEX' below
             // Fall through to 'CEX' below
             case 'CEX':
                 $customExport = $object;
                 try {
                     $customExport->save();
                     $res = true;
                 } catch (CustomExportException $e) {
                     if ($e->getCode() == CustomExportException::DUPLICATE_EXPORT_NAME) {
                         $showMsg = "DUPLICATE_NAME_FAILURE";
                     }
                     $res = false;
                 }
                 break;
             case 'CIM':
                 $customImport = $object;
                 try {
                     $customImport->save();
                     $res = true;
                 } catch (CustomImportException $e) {
                     if ($e->getCode() == CustomImportException::DUPLICATE_IMPORT_NAME) {
                         $showMsg = "DUPLICATE_NAME_FAILURE";
                     }
                     if ($e->getCode() == CustomImportException::COMPULSARY_FIELDS_NOT_ASSIGNED) {
                         $showMsg = "COMPULSARY_FIELDS_NOT_ASSIGNED_FAILURE";
                     }
                     $res = false;
                 }
                 break;
             case 'PRJ':
                 $projects = new Projects();
                 $projects = $object;
                 $res = $projects->updateProject();
                 break;
             case 'TCP':
                 $property = new CompProperty();
                 $property = $object;
                 if ($property->getEditPropFlag() == false) {
                     $res = $property->editPropertyList();
                 } else {
                     $res = $property->editProperty($id);
                 }
                 break;
             case 'PAC':
                 $projectActivity = $object;
                 $authorizeObj = new authorize($_SESSION['empID'], $_SESSION['isAdmin']);
                 $projectId = $projectActivity->getProjectId();
                 $res = true;
                 if ($authorizeObj->isAdmin() || $authorizeObj->isProjectAdminOf($projectId)) {
                     try {
                         $projectActivity->save();
                         $extraParams = "&projectId={$projectId}";
                     } catch (ProjectActivityException $e) {
                         $res = false;
                     }
                 }
                 break;
             case 'USR':
                 $users = new Users();
                 $users = $object;
                 $res = $users->updateUsers();
                 break;
             case 'USG':
                 $usergroups = new UserGroups();
                 $usergroups = $object;
                 $res = $usergroups->updateUserGroups();
                 break;
             case 'EMX':
                 $emailConfig = new EmailConfiguration();
                 $emailConfig = $object;
                 $res = (bool) $emailConfig->reWriteConf();
                 $testEmail = $emailConfig->getTestEmail();
                 $testEmailType = $emailConfig->getTestEmailType();
                 break;
             case 'ENS':
                 $emailNotifacationConfigs = new EmailNotificationConfiguration($_SESSION['user']);
                 $emailNotifacationConfigs = $object;
                 $res = true;
                 foreach ($emailNotifacationConfigs as $emailNotifacationConfig) {
                     $resp = $emailNotifacationConfig->updateNotificationStatus();
                     if (!$resp) {
                         $res = $resp;
                     }
                 }
                 break;
             case 'LDAP':
                 if ($_SESSION['ldap'] == "enabled") {
                     $ldapDetails = new LdapDetails();
                     $ldapDetails = $object;
                     $res = $ldapDetails->updateLdapDetails();
                 }
                 break;
         }
     } catch (Exception $e) {
         if ($e->getCode() == 1) {
             $res = false;
             $showMsg = "DUPLICATE_NAME_FAILURE";
         }
     }
     // Checking whether the $message Value returned is 1 or 0
     if ($res) {
         switch ($index) {
             case 'CEX':
                 // Go to CSV heading Define page
                 header("Location: ./CentralController.php?uniqcode=CHD&id={$id}");
                 break;
             case 'CHD':
                 $showMsg = "UPDATE_SUCCESS";
                 $esp = isset($_GET['isAdmin']) ? '&isAdmin=' . $_GET['isAdmin'] : '';
                 header("Location: ./CentralController.php?message={$showMsg}&uniqcode=CEX&VIEW=MAIN{$esp}{$extraParams}");
                 break;
             case 'CST':
                 break;
             case 'EMX':
                 $emailConfig = new EmailConfiguration();
                 $showMsg = "";
                 /*
                  * $testEmail and $testEmail should be initialized when writing the mailConfig file
                  * Getting the value for $testEmail should not be from the newlt created EmailConfiguration
                  * object, since test mail value is not written to the physical file
                  */
                 if (isset($testEmail) && !empty($testEmail) && isset($testEmailType) && !empty($testEmailType)) {
                     $emailConfig->setTestEmail($testEmail);
                     $emailConfig->setTestEmailType($testEmailType);
                     if ($emailConfig->sendTestEmail()) {
                         $showMsg = "TEST_EMAIL_SUCCESS";
                     } else {
                         $showMsg = "TEST_EMAIL_FAILIURE";
                     }
                 }
                 header("Location:./CentralController.php?uniqcode=EMX&VIEW=MAIN&msg={$showMsg}");
                 break;
             case 'SGR':
                 $showMsg = "UPDATE_SUCCESS";
                 header("Location:" . $_POST['referer'] . "&msg={$showMsg}");
                 break;
             case 'EST':
             case 'CUR':
                 if ($noRedirect) {
                     break;
                 }
             default:
                 $showMsg = "UPDATE_SUCCESS";
                 //If $message is 1 setting up the
                 $pageNoQueryString = isset($_REQUEST['pageNo']) ? '&pageNo=' . $_REQUEST['pageNo'] : '';
                 $uniqcode = $index;
                 $esp = isset($_GET['isAdmin']) ? '&isAdmin=' . $_GET['isAdmin'] : '';
                 header("Location: ./CentralController.php?message={$showMsg}&uniqcode={$uniqcode}&VIEW=MAIN{$esp}{$extraParams}{$pageNoQueryString}");
         }
     } else {
         if (!isset($showMsg) || empty($showMsg)) {
             $showMsg = "UPDATE_FAILURE";
         }
         $uniqcode = $index;
         $esp = isset($_GET['isAdmin']) ? '&isAdmin=' . $_GET['isAdmin'] : '';
         header("Location: ./CentralController.php?msg={$showMsg}&id={$id}&capturemode=updatemode&uniqcode={$uniqcode}{$esp}{$extraParams}");
     }
 }
예제 #10
0
?>
\n"
			} else if (!numeric($('txtLeaveTotalTime'))) {
				err = true;
				msg += " - <?php 
echo $lang_Error_NonNumericHours;
?>
\n"
			}
		}

		if (err) {
			alert(msg);
		} else {
			<?php 
$mailConfig = new EmailConfiguration();
$mailType = $mailConfig->getMailType();
$mailConfigError = false;
$mailConfigErrorMsg = '';
if ($mailType == 'sendmail') {
    $sendmailPath = $mailConfig->getSendmailPath();
    $sendmailPath = substr($sendmailPath, 0, strpos($sendmailPath, ' '));
    if (is_file($sendmailPath)) {
        if (!is_executable($sendmailPath)) {
            $mailConfigError = true;
            $mailConfigErrorMsg = $lang_Error_EmailConfigError_SendmailNotExecutable;
        }
    } elseif (is_link($sendmailPath)) {
        $sendmailPath = readlink($sendmailPath);
        if (is_executable($sendmailPath)) {
            $mailConfigError = true;
예제 #11
0
 public static function sendMessages($isReminder = false)
 {
     $items = db()->query("SELECT * FROM nonvalidated_apps_per_owner")->fetchAll();
     foreach ($items as $item) {
         $text = "";
         $body = "";
         if (is_null($item["contact"])) {
             error_log("[OutdatedApps]: No contact info for " . $item["ownerid"] . ":" . $item["firstname"] . " " . $item["lastname"]);
             //TODO: Case where the owner of the application has no contact point
             continue;
         }
         $recipients = array($item["contact"]);
         $subject = "Notification:";
         if (isnull($item["lastsent"]) == false) {
             $subject = "Reminder:";
         }
         $subject .= "EGI AppDB outdated software profile";
         $appids = $item["appids"];
         $appids = explode(";", $appids);
         $appnames = $item["appnames"];
         $appnames = explode(";", $appnames);
         if (count($appids) == 0) {
             continue;
         }
         if (count($appids) == 1) {
             $template = self::getTemplateBody($item["firstname"] . " " . $item["lastname"]);
             $body = preg_replace("/\\[1\\]/", "<a href='http://" . $_SERVER["APPLICATION_UI_HOSTNAME"] . "?p=" . base64_encode("/apps/details?id=" . $appids[0]) . "' target='_blank'>" . $appnames[0] . "</a>", $template);
             $body = preg_replace("/\\[2\\]/", "<a href='http://" . $_SERVER["APPLICATION_UI_HOSTNAME"] . "' target='_blank'>EGI Applications Database</a>", $body);
             $body = "<html><head></head><body><pre>" . $body . "</pre></body></html>";
             $text = preg_replace("/\\[1\\]/", "" . $appnames[0] . " [1]", $template);
             $text = preg_replace("/\\[2\\]/", "EGI Applications Database [2]", $text);
             $text .= "\n\n________________________________________________________________________________________________________\n";
             $text .= "[1]. http://" . $_SERVER["APPLICATION_UI_HOSTNAME"] . "?p=" . base64_encode("/apps/details?id=" . $appids[0]) . "\n";
             $text .= "[2]. http://" . $_SERVER["APPLICATION_UI_HOSTNAME"];
         } else {
             $template = self::getTemplateListBody($item["firstname"] . " " . $item["lastname"]);
             $listpermalink = "http://" . $_SERVER["APPLICATION_UI_HOSTNAME"] . "?p=" . base64_encode('{"url":"/apps","query":{"flt":"=application.owner:' . $item["ownerid"] . ' +=application.validated:false"},"ext":{"isBaseQuery":true,"append":true,"filterDisplay":"Search outdated...","mainTitle":"Outdated entries"}}');
             $body = preg_replace("/\\[1\\]/", "<a href='" . $listpermalink . "' target='_blank'>software</a>", $template);
             $body = preg_replace("/\\[2\\]/", "<a href='http://" . $_SERVER["APPLICATION_UI_HOSTNAME"] . "' target='_blank'>EGI Applications Database</a>", $body);
             $body = "<html><head></head><body><pre>" . $body . "</pre></body></html>";
             $text = preg_replace("/\\[1\\]/", "software [1]", $template);
             $text = preg_replace("/\\[2\\]/", "EGI Applications Database [2]", $text);
             $text .= "\n\n________________________________________________________________________________________________________\n";
             $text .= "[1]. " . $listpermalink . " \n";
             $text .= "[2]. http://" . $_SERVER["APPLICATION_UI_HOSTNAME"];
             $bodylist = "";
             $textlist = "";
             //Make unique arrays of application ids and names
             $unames = array();
             $uids = array();
             for ($i = 0; $i < count($appids); $i += 1) {
                 if (in_array($appids[$i], $uids) === false) {
                     $uids[] = $appids[$i];
                     $unames[] = $appnames[$i];
                 }
             }
             $appids = $uids;
             $appnames = $unames;
             for ($i = 0; $i < count($appids); $i += 1) {
                 $bodylist .= "<div style='padding-left:10px;'>-<a href='http://" . $_SERVER["APPLICATION_UI_HOSTNAME"] . "?p=" . base64_encode("/apps/details?id=" . $appids[$i]) . "' target='_blank'>" . $appnames[$i] . "</a></div>";
                 $textlist .= "\t- " . $appnames[$i] . "\n";
             }
             $body = preg_replace("/\\[\\*\\]/", $bodylist, $body);
             $text = preg_replace("/\\[\\*\\]/", $textlist, $text);
         }
         if (ApplicationConfiguration::isProductionInstance() === FALSE) {
             error_log("SENDING OUTDATED TO:");
             error_log("SUBJECT:" . $subject);
             error_log("RECIPIENTS: " . var_export($recipients, true));
             error_log("BODY: " . $text);
             echo "<div style='background-color:lightgrey;border:1px solid black'><b>subject:</b>" . $subject . "</div><div style='background-color:lightgrey;margin-bottom:10px;border:1px solid black'><b>TO:</b>" . implode(",", $recipients) . "</div><div style='background-color:lightgreen;border:1px solid black;'>" . $body . "</div><div style='background-color:#99DBFF;margin-bottom:10px;border:1px solid black'><pre>" . $text . "</pre></div>";
         } else {
             //sendMultipartMail($subject,$recipients,$text,$body,'*****@*****.**','enadyskolopassword','*****@*****.**',null, false,array("Precedence"=>"bulk"));
             EmailService::sendBulkReport($subject, $recipients, $text, $body, EmailConfiguration::getSupportAddress());
         }
     }
     if (APPLICATION_ENV === "production") {
         db()->query("INSERT INTO app_validation_log (appid) SELECT DISTINCT id FROM applications, (SELECT string_to_array(array_to_string(array_agg(array_to_string(ids,',')),','),',') as ids FROM (SELECT string_to_array(appids, ';') as ids FROM (SELECT * FROM nonvalidated_apps_per_owner) AS t) as tt) as ttt WHERE id::text = ANY(ttt.ids)")->fetchAll();
     }
     return true;
 }
예제 #12
0
 /**
  * List Mail Configuration
  * @param sfWebRequest $request
  * @return unknown_type
  */
 public function executeListMailConfiguration(sfWebRequest $request)
 {
     $emailConfiguration = new EmailConfiguration();
     $this->mailAddress = $emailConfiguration->getSentAs();
     $this->sendMailPath = $emailConfiguration->getSendMailPath();
     $this->smtpAuth = $emailConfiguration->getSmtpAuthType();
     $this->smtpSecurity = $emailConfiguration->getSmtpSecurityType();
     $this->smtpHost = $emailConfiguration->getSmtpHost();
     $this->smtpPort = $emailConfiguration->getSmtpPort();
     $this->smtpUser = $emailConfiguration->getSmtpUsername();
     $this->smtpPass = $emailConfiguration->getSmtpPassword();
     $this->emailType = $emailConfiguration->getMailType();
     if ($this->getUser()->hasFlash('templateMessage')) {
         $this->templateMessage = $this->getUser()->getFlash('templateMessage');
     }
 }
예제 #13
0
 private static function sendConfirmationEmail($session, $pending)
 {
     $researcher = $pending->getResearcher();
     $email = $researcher->getPrimaryContact();
     $accounttype = str_replace("-", " ", trim($pending->accountType));
     $accountname = trim($pending->accountName) === "" ? $pending->accountID : $pending->accountName;
     $res = "Dear " . $researcher->name . ",\n\n";
     $res .= "    a request has been made to connect the " . $accounttype . " account of " . $accountname . "\n";
     $res .= "to your profile in the EGI Applications Database [1].\n";
     $res .= "If it is really you the one that made this request and you wish to proceed with the account connection\n";
     $res .= " - go to the EGI Applications Database Portal[1] and\n";
     $res .= " - sign in with the same " . $accounttype . " account.\n";
     $res .= "The system will prompt you with a form where you should enter the confirmation code bellow:\n\n";
     $res .= "   Confirmation Code: " . $pending->code . "\n\n";
     $res .= "Note: The confirmation code expires 30 minutes after this message was sent.\n\n";
     $res .= "If you are not the one that made this request, then please report the incident by replying to this message.\n\n";
     $res .= "Best regards,\n";
     $res .= "EGI AppDB team\n";
     $res .= "\n\n__________________________________________________\n";
     $res .= "[1]. http://" . $_SERVER["APPLICATION_UI_HOSTNAME"];
     $subject = "EGI AppDB: Request to connect " . $accounttype . " account to your profile";
     $text = $res;
     $body = $body = preg_replace("/\n/", "<br/>", $res);
     $body = "<div>" . $body . "</div>";
     //DEVELOPMENT CODE
     if (ApplicationConfiguration::isProductionInstance() === FALSE) {
         error_log("\nSending to: " . $email);
         error_log("\n\n" . $res);
     }
     $recipients = array($email);
     //sendMultipartMail($subject,$recipients,$text,$body,'*****@*****.**','enadyskolopassword','*****@*****.**',null, false,array("Precedence"=>"bulk"));
     EmailService::sendBulkReport($subject, $recipients, $text, $body, EmailConfiguration::getSupportAddress());
 }
예제 #14
0
 public function submitAction()
 {
     if ($this->session->userid !== null) {
         $this->_helper->layout->disableLayout();
         $this->_helper->viewRenderer->setNoRender();
         $type = $this->_getParam("type");
         $entryID = $this->_getParam("entryID");
         $comment = $this->_getParam("comment");
         $reason = $this->_getParam("reason");
         switch ($reason) {
             case self::REASON_OTHER:
                 $reason_str = 'Other';
                 break;
             case self::REASON_COPYRIGHT_ISSUE:
                 $reason_str = 'Copyright Issue';
                 break;
             case self::REASON_INAPPROPRIATE_CONTENT:
                 $reason_str = 'Inappropriate Content';
                 break;
             case self::REASON_INVALID_DATA:
                 $reason_str = 'Invalid or False Data';
                 break;
             case self::REASON_OUT_OF_DATE:
                 $reason_str = 'Out of Date Information';
                 break;
             case self::REASON_BROKEN_LINK:
                 $reason_str = 'Broken Link';
                 break;
             case self::REASON_SPELLING:
                 $reason_str = 'Typo/Misspelling';
                 break;
             default:
                 $reason_str = 'Other';
                 break;
         }
         $offender = "id={$entryID}";
         $subject = "AppDB report";
         if (ApplicationConfiguration::isEnviroment("production")) {
             $to = EmailConfiguration::getList('ucst');
         } else {
             $to = EmailConfiguration::getList('debug');
         }
         $offenderApp = "";
         $body = "EGI Applications Database Abuse Report \n\n" . "A user has submitted a report concerning a" . (in_array(strtolower(substr($type, 0, 1)), array('a', 'e', 'i', 'o', 'u')) ? "n" : "") . " " . $type . "\n\n";
         $body = "--------------------------------------------------\n";
         $body .= "Please do not reply, this is an automated message.\n";
         $body .= "--------------------------------------------------\n\n";
         if ($type == "application") {
             $subject .= " - problem on content";
             $body .= "EGI Applications Database problem report on content \n\n";
             $body .= "A user has submitted a problem report concerning the software ";
             $apps = new Default_Model_Applications();
             $apps->filter->id->equals($entryID);
             if (count($apps->items) > 0) {
                 $offender = $apps->items[0]->name . ' (http://' . $_SERVER['HTTP_HOST'] . '/?p=' . base64_encode('/apps/details?id=' . $apps->items[0]->id) . ")";
                 $body .= $apps->items[0]->name . " with id: " . $apps->items[0]->id;
             }
         } elseif ($type == "comment") {
             $subject .= " - abuse on comment";
             $body .= "EGI Applications Database abuse report on a comment\n\n";
             $body .= "A user has submitted an abuse report concerning the software ";
             $aprs = new Default_Model_AppRatings();
             $aprs->filter->id->equals($entryID);
             if (count($aprs->items) > 0) {
                 $cid = $apps->items[0]->id;
                 $apps = new Default_Model_Applications();
                 $apps->filter->id->equals($aprs->items[0]->appid);
                 if (count($apps->items[0]) > 0) {
                     $body .= $apps->items[0]->name . " with id: " . $apps->items[0]->id;
                     $rs = new Default_Model_Researchers();
                     $rs->filter->id->equals($aprs->items[0]->submitterid);
                     if (count($rs->items) > 0) {
                         $commentPersonName = $rs->items[0]->firstname . ' ' . $rs->items[0]->lastname;
                     } else {
                         $commentPersonName = 'a guest user';
                     }
                     $commentDate = new DateTime($aprs->items[0]->submittedon);
                     $commentDate = $commentDate->format('Y-m-d H:i');
                     $offenderApp = "Offensive software entry: " . $apps->items[0]->name . ' (http://' . $_SERVER['HTTP_HOST'] . '/?p=' . base64_encode('/apps/details?id=' . $apps->items[0]->id) . ")\n";
                     $offender = "submitted by {$commentPersonName} on {$commentDate} (Comment ID: {$entryID})";
                 }
             }
         }
         $body = $body . "\n\n";
         $body .= $offenderApp . "Offensive " . $type . " entry: " . $offender . "\n" . 'Submitter: ' . $this->session->fullName . ' (http://' . $_SERVER['HTTP_HOST'] . '/?p=' . base64_encode('/people/details?id=' . $this->session->userid) . ")\n" . "Reason: " . $reason_str . "\n\n" . "Description: " . $comment . "\n";
         //sendMultipartMail($subject, $to, $body,"<pre>".$body."</pre>", '*****@*****.**', 'enadyskolopassword');
         EmailService::sendReport($subject, $to, $body, "<pre>" . $body . "</pre>");
     }
 }
예제 #15
0
 /**
  * Get application's smtp auth value
  * 
  * @return string
  */
 public static function getSmtpAuth()
 {
     return EmailConfiguration::getSmtp('auth', 'PLAIN');
 }
 public function getEmailConfiguration()
 {
     $url = $this->getUrl() . EmailConfiguration::$EMAIL_LINK;
     $request = $this->setHeadersGet($url, $this->_oauthToken);
     $result = $this->doGet($request);
     if (array_key_exists('errors', $result)) {
         $errors_tmp = new Errors();
         foreach ($result as $errorData) {
             $errors_tmp = Errors::fromArray($errorData);
         }
         $errors[] = $errors_tmp;
         return $errors;
     } else {
         $response_tmp = EmailConfiguration::fromArray($result['emailConfiguration']);
     }
     return $response_tmp;
 }
예제 #17
0
 public function feedbackAction()
 {
     $this->_helper->layout->disableLayout();
     if ($_SERVER["REQUEST_METHOD"] == "GET") {
         $this->view->src = isset($_GET["src"]) ? $_GET["src"] : null;
         $this->view->username = "";
         $this->view->contacts = array();
         if ($this->session->userid !== null) {
             $this->view->username = $this->session->fullName;
             $cnts = new Default_Model_Contacts();
             $cnts->filter->researcherid->equals($this->session->userid)->and($cnts->filter->contacttypeid->equals(7));
             if (count($cnts->items) > 0) {
                 $this->view->contacts = $cnts->items;
             }
         } else {
             $this->view->captcha = $this->generateCaptchaForm();
         }
     } else {
         if ($_SERVER["REQUEST_METHOD"] == "POST") {
             $this->_helper->viewRenderer->setNoRender();
             $feedback = isset($_POST["feedback"]) && trim($_POST["feedback"]) !== "" ? $_POST["feedback"] : "";
             $subject = isset($_POST["subject"]) && trim(stripslashes($_POST["subject"])) !== "" ? stripslashes($_POST["subject"]) : "<no subject>";
             $email = isset($_POST["email"]) && trim(stripslashes($_POST["email"])) !== "" ? stripslashes($_POST["email"]) : "";
             $cc = isset($_POST["cc"]) && trim($_POST["cc"]) !== "" ? $_POST["cc"] : false;
             $name = isset($_POST["name"]) && trim($_POST["name"]) !== "" ? $_POST["name"] : "anonymous";
             $captchaid = isset($_POST["captchaid"]) && trim($_POST["captchaid"]) !== "" ? $_POST["captchaid"] : "";
             $captcha = isset($_POST["captcha"]) && trim($_POST["captcha"]) !== "" ? $_POST["captcha"] : "";
             header("Content-type: text/xml; charset=utf-8");
             echo '<' . '?xml version="1.0"?' . '>';
             if ($feedback == "") {
                 echo "<response error='no feedback given' group='feedback'></response>";
                 return;
             }
             if ($email == "") {
                 echo "<response error='no email given' group='email'></response>";
                 return;
             }
             $bodyheader = "----------------------------------------------------------------------------\n";
             $bodyheader .= "Feedback from user: "******" " . ($this->session->userid !== null ? "(id:" . $this->session->userid . ")" : "") . " \n";
             $bodyheader .= "User email: " . $email . " \n";
             $bodyheader .= "----------------------------------------------------------------------------\n\n";
             //Make receivers array
             if (strpos($email, ";") !== false) {
                 $emailto = explode(";", $email);
                 $email = array();
                 for ($i = 0; $i < count($emailto); $i += 1) {
                     $emailto[$i] = trim($emailto[$i]);
                     if ($emailto[$i] !== "") {
                         $email[] = $emailto[$i];
                     }
                 }
             } else {
                 $email = array($email);
             }
             //Validate email format
             for ($i = 0; $i < count($email); $i += 1) {
                 if (!preg_match('/^([0-9a-z]+[-._+&])*[0-9a-z]+@([-0-9a-z]+[.])+[a-z]{2,6}$/i', $email[$i])) {
                     echo "<response error='Email " . $email[$i] . " is invalid' group='email'></response>";
                     return;
                 }
             }
             $body = base64_decode($feedback);
             $body = stripslashes($body);
             if (trim($body) == "") {
                 echo "<response error='no feedback given' group='feedback'></response>";
                 return;
             }
             if (preg_match("/(\r|\n)(to:|from:|cc:|bcc:)/i", $body)) {
                 echo "<response error='Message body contains invalid headers' group='feedback'></response>";
                 return;
             }
             if ($this->session->userid === null) {
                 if (trim($captchaid) == "" && trim($captcha) == "") {
                     echo "<response error='Must login first to send message'></response>";
                     return;
                 }
                 $sessionkey = "Zend_Form_Captcha_" . $captchaid;
                 if (isset($_SESSION[$sessionkey]) && isset($_SESSION[$sessionkey]["word"]) && $_SESSION[$sessionkey]["word"] == $captcha) {
                 } else {
                     echo "<response error='Security word is wrong' group='captcha'></response>";
                     return;
                 }
             }
             $subject = "[AppDB Portal Feedback]: " . $subject;
             $body = $bodyheader . $body;
             //Send email
             $recs = array(EmailConfiguration::getSupportAddress());
             $ccemails = false;
             if ($cc == true) {
                 $ccemails = $email;
             }
             //sendMultipartMail($subject,$recs, $body, '', '*****@*****.**', 'enadyskolopassword', $email[0], null, $ccemails);
             EmailService::sendReport($subject, $recs, $body, '', $email[0], null, $ccemails);
             $to = "";
             foreach ($email as $e) {
                 if (trim($to) !== "") {
                     $to .= ";";
                 }
                 $to .= $e;
             }
             echo "<response to='" . htmlspecialchars($to, ENT_QUOTES) . "' subject='" . htmlspecialchars($subject, ENT_QUOTES) . "' cc='" . $cc . "' >" . htmlspecialchars($body, ENT_QUOTES) . "</response>";
         }
     }
 }
 private function __setDefaultValues(EmailConfiguration $emailConfiguration)
 {
     $this->setDefaults(array('txtMailAddress' => $emailConfiguration->getSentAs(), 'cmbMailSendingMethod' => $emailConfiguration->getMailType(), 'txtSendmailPath' => $emailConfiguration->getSendmailPath(), 'txtSmtpHost' => $emailConfiguration->getSmtpHost(), 'txtSmtpPort' => $emailConfiguration->getSmtpPort(), 'optAuth' => $emailConfiguration->getSmtpAuthType(), 'txtSmtpUser' => $emailConfiguration->getSmtpUsername(), 'txtSmtpPass' => $emailConfiguration->getSmtpPassword(), 'optSecurity' => $emailConfiguration->getSmtpSecurityType(), 'txtTestEmail' => ''));
 }
예제 #19
0
 private static function mailDispatchReport($recipients, $filename, $folder)
 {
     $reportcsv = file_get_contents($folder . $filename . ".csv");
     if ($reportcsv === false) {
         error_log("[SocialReport::mailDispatch]: Could not load report " . $filename);
         return false;
     }
     $subject = "EGI AppDB Social media sharing report (" . date('Y') . "-" . date('m') . "-" . date('d') . ")";
     $sbody = "This is an automatically generated report for social media sharing count per registered software item.";
     $sbody = $sbody . "Please find attached a CSV file containing the report.<br/>";
     $sbody = $sbody . "You can access this report at http://" . $_SERVER['APPLICATION_UI_HOSTNAME'] . "/reports/social/" . $filename . ".csv <br/><br/>";
     $sbody = $sbody . "Regards,<br/>";
     $sbody = $sbody . "EGI AppDB Team";
     $textsbody = simpleHTML2Text($sbody);
     $att = array("data" => $reportcsv, "type" => "application/vnd.ms-excel", "name" => $filename . ".csv");
     //sendMultipartMail($subject, $recipients, $textsbody, $sbody, '*****@*****.**', 'enadyskolopassword', '*****@*****.**',$att, false,array("Precedence"=>"bulk"));
     EmailService::sendBulkReport($subject, $recipients, $textsbody, $sbody, EmailConfiguration::getSupportAddress(), $att);
 }