Example #1
0
function email_plugin_notify($check,$check_result,$subscription,$alt_email=false) {
  global $status_array;
  $user = new User($subscription->getUserId());
  $email = new fEmail();
  // This sets up fSMTP to connect to the gmail SMTP server
  // with a 5 second timeout. Gmail requires a secure connection.
  $smtp = new fSMTP(sys_var('smtp_server'), sys_var('smtp_port'), TRUE, 5);
  $smtp->authenticate(sys_var('smtp_user'), sys_var('smtp_pass'));
  if ($alt_email) {
    $email_address = usr_var('alt_email',$user->getUserId());
  } else {
    $email_address = $user->getEmail(); 
  }
  $email->addRecipient($email_address, $user->getUsername());
  // Set who the email is from
  $email->setFromEmail(sys_var('email_from'), sys_var('email_from_display'));
  // Set the subject include UTF-8 curly quotes
  $email->setSubject(str_replace('{check_name}', $check->prepareName(), sys_var('email_subject')));
  // Set the body to include a string containing UTF-8
  $state = $status_array[$check_result->getStatus()];
  $email->setHTMLBody("<p>$state Alert for {$check->prepareName()} </p><p>The check returned {$check_result->prepareValue()}</p><p>Warning Threshold is : ". $check->getWarn() . "</p><p>Error Threshold is : ". $check->getError() . '</p><p>View Alert Details : <a href="' . fURL::getDomain() . '/' . CheckResult::makeURL('list',$check_result) . '">'.$check->prepareName()."</a></p>");
  $email->setBody("
  $state Alert for {$check->prepareName()}
The check returned {$check_result->prepareValue()}
Warning Threshold is : ". $check->getWarn() . "
Error Threshold is : ". $check->getError() . "
           ");
  try {  
    $message_id = $email->send($smtp);
  } catch ( fConnectivityException $e) { 
    fCore::debug("email send failed",FALSE);
  }
}
		<meta property="og:title" content="Safecast" />
		<meta property="og:type" content="website" />
		<meta property="og:url" content="http://www.safecast.org" />
		<meta property="og:image" content="http://www.safecast.org/images/logo.png" />
		<meta property="og:site_name" content="Safecast" />
		<meta property="fb:admins" content="595809984" />
		<meta name="description" content="Safecast is a website that aggregates radioactivity data from throughout the world in order to provide real-time hyper-local information about the status of the Japanese nuclear crisis."> 
		<meta name="keywords" content="japan,fukushima,radiation,nuclear,reactor,geiger,counter,RDTN,Safecast">
		<title><?php 
echo $this->prepare('title');
echo strpos($this->get('title'), 'Safecast') === FALSE ? ' - Safecast' : '';
?>
</title>
		
		<base href="<?php 
echo fURL::getDomain() . URL_ROOT;
?>
" />


		<link rel="stylesheet" type="text/css" href="style/reset.css" media="screen" />
		<!--<link rel="stylesheet" type="text/css" href="style/base.css" media="screen" />-->
		<?php 
echo $this->place('css');
?>
		<script type="text/javascript" src="script/jquery-1.5.1.min.js"></script>
		<?php 
echo $this->place('js', 'js');
?>
		<!--[if lte IE 8]><script language="javascript" type="text/javascript" src="excanvas.min.js"></script><![endif]-->
		<script type="text/javascript">  
    fSession::destroy();
    fURL::redirect();
}
$uid = isset($_GET['uid']) ? htmlentities($_GET['uid']) : '{0}';
?>
<!DOCTYPE html>
<html>
<head>
    <title>Add card redirect</title>
    <style type="text/css">
        form {display: none}
    </style>
</head>
<body>
    <p>Redirecting, please wait...</p>
    <form name="addcard" action="<?php 
echo fURL::getDomain();
?>
/login_and_addcard.php" method="post">
        <label for="uid">Card to add</label>
        <input type="text" name="uid" value="<?php 
echo $uid;
?>
"/>
        <input type="submit" name="addcard" value="Add"/>
    </form>
    <script type="text/javascript">
        document.forms.addcard.submit();
    </script>
</body>
</html>