Пример #1
0
 function run(Model_Alert $alert, $sensors)
 {
     @($to = DevblocksPlatform::parseCsvString($alert->actions[self::EXTENSION_ID]['to']));
     @($template_subject = $alert->actions[self::EXTENSION_ID]['template_subject']);
     @($template_body = $alert->actions[self::EXTENSION_ID]['template_body']);
     $logger = DevblocksPlatform::getConsoleLog();
     // Assign template variables
     $tpl = DevblocksPlatform::getTemplateService();
     $tpl->clear_all_assign();
     $tpl->assign('alert', $alert);
     $tpl->assign('sensors', $sensors);
     $tpl->assign('num_sensors', count($sensors));
     // Build template
     $tpl_builder = DevblocksPlatform::getTemplateBuilder();
     $errors = array();
     // Subject
     if (false == ($subject = $tpl_builder->build($template_subject))) {
         $errors += $tpl_builder->getErrors();
     }
     // Body
     if (false == ($body = $tpl_builder->build($template_body))) {
         $errors += $tpl_builder->getErrors();
     }
     if (!empty($errors)) {
         $logger->err(sprintf("Errors in mail template (skipping): %s", implode("<br>\r\n", $errors)));
         return false;
     }
     if (is_array($to)) {
         foreach ($to as $address) {
             $logger->info(sprintf("Sending mail to %s about %d sensors", $address, count($sensors)));
             PortSensorMail::quickSend($address, $subject, $body);
         }
     }
 }
Пример #2
0
             @($contact_phone = stripslashes($_REQUEST['contact_phone']));
             @($contact_refer = stripslashes($_REQUEST['contact_refer']));
             @($q1 = stripslashes($_REQUEST['q1']));
             @($q2 = stripslashes($_REQUEST['q2']));
             @($q3 = stripslashes($_REQUEST['q3']));
             @($q4 = stripslashes($_REQUEST['q4']));
             @($q5_support = stripslashes($_REQUEST['q5_support']));
             @($q5_opensource = stripslashes($_REQUEST['q5_opensource']));
             @($q5_price = stripslashes($_REQUEST['q5_price']));
             @($q5_updates = stripslashes($_REQUEST['q5_updates']));
             @($q5_developers = stripslashes($_REQUEST['q5_developers']));
             @($q5_community = stripslashes($_REQUEST['q5_community']));
             @($comments = stripslashes($_REQUEST['comments']));
             if (isset($_REQUEST['form_submit'])) {
                 $msg = sprintf("Contact Name: %s\r\n" . "Organization: %s\r\n" . "Referred by: %s\r\n" . "Phone: %s\r\n" . "\r\n" . "#1: Briefly, what does your organization do?\r\n%s\r\n\r\n" . "#2: How is your team currently handling service monitoring?\r\n%s\r\n\r\n" . "#3: Are you considering both free and commercial solutions?\r\n%s\r\n\r\n" . "#4: What will be your first important milestone?\r\n%s\r\n\r\n" . "#5: How important are the following benefits in making your decision?\r\n" . "Near-Instant Support: %d\r\nAvailable Source Code: %d\r\nCompetitive Purchase Price: %d\r\n" . "Frequent Product Updates: %d\r\nAccess to Developers: %d\r\nLarge User Community: %d\r\n" . "\r\n" . "Additional Comments: \r\n%s\r\n\r\n", $contact_name, $contact_company, $contact_refer, $contact_phone, $q1, $q2, $q3, $q4, $q5_support, $q5_opensource, $q5_price, $q5_updates, $q5_developers, $q5_community, $comments);
                 PortSensorMail::quickSend('*****@*****.**', "About: {$contact_name} of {$contact_company}", $msg, $contact_email, $contact_name);
             }
         }
         $tpl->assign('step', STEP_FINISHED);
         $tpl->display('steps/redirect.tpl');
         exit;
     }
     $tpl->assign('template', 'steps/step_register.tpl');
     break;
 case STEP_UPGRADE:
     $tpl->assign('template', 'steps/step_upgrade.tpl');
     break;
     // [TODO] Delete the /install/ directory (security)
 // [TODO] Delete the /install/ directory (security)
 case STEP_FINISHED:
     // Set up the default cron jobs
Пример #3
0
 function doRecoverStep1Action()
 {
     $translate = DevblocksPlatform::getTranslationService();
     @($email = DevblocksPlatform::importGPC($_REQUEST['email'], 'string'));
     $worker = null;
     $results = DAO_Worker::getWhere(sprintf("%s = %s", DAO_Worker::EMAIL, Ps_ORMHelper::qstr($email)));
     if (!empty($results)) {
         $worker = array_shift($results);
     }
     if (empty($email) || empty($worker)) {
         return;
     }
     $_SESSION[self::KEY_FORGOT_EMAIL] = $email;
     try {
         $code = PortSensorApplication::generatePassword(10);
         $_SESSION[self::KEY_FORGOT_SENTCODE] = $code;
         $to = $email;
         $subject = $translate->_('login.forgot.mail.subject');
         $body = vsprintf($translate->_('login.forgot.mail.body'), $code);
         PortSensorMail::quickSend($to, $subject, $body);
     } catch (Exception $e) {
         DevblocksPlatform::redirect(new DevblocksHttpResponse(array('login', 'forgot', 'step1', 'failed')));
     }
     DevblocksPlatform::redirect(new DevblocksHttpResponse(array('login', 'forgot', 'step2')));
 }