/**
  * Send an email.
  */
 function mail($data = array())
 {
     global $settings;
     // Call up PHPMailer
     $mail = new PHPMailer();
     // Send using SMTP.
     $mail->IsSMTP();
     $mail->SMTPDebug = 1;
     $mail->SMTPAuth = $settings['smtp']['auth'];
     // turn on SMTP authentication
     // This comes from the settings file.
     $mail->Host = $settings['smtp']['host'];
     $mail->Username = $settings['smtp']['username'];
     $mail->Password = $settings['smtp']['password'];
     $mail->Port = $settings['smtp']['port'];
     $mail->From = $data['from'];
     $mail->FromName = $data['from_name'];
     $mail->AddAddress($data['to']);
     $mail->WordWrap = 80;
     $mail->IsHTML($data['is_html']);
     // set email format to HTML otherwise if text use false.
     $mail->Subject = $data['subject'];
     $mail->Body = $data['message'];
     if (!$mail->Send()) {
         serum_set_message('There was an error sending the email. ' . $mail->errorInfo);
     }
 }
Ejemplo n.º 2
0
 function add_contact_submit($form)
 {
     $node = node::add_new('title', $form['fields']['title']['value'], 1);
     //Now loop through the rest of this array and add it to the node.
     foreach ($form['fields'] as $k => $v) {
         $node->add_field($v['name'], $v['value']);
     }
     serum_set_message('Contact has been added successfully.');
     // We need to return the form again. I dont like this much...
     header('location: ' . base_path() . 'contacts');
 }
Ejemplo n.º 3
0
 function submit_login_form($form)
 {
     $auth = node::authenticate_node($form['fields']['username']['value'], $form['fields']['password']['value']);
     if ($auth) {
         $_SESSION['SERUM_AUTHENTICATED'] = true;
         $_SESSION['ACTIVE_NODE_ID'] = $auth->id;
     } else {
         //Send error message back to browser.
         $_SESSION['SERUM_AUTHENTICATED'] = false;
         serum_set_message('Authentication Failed.', $type = 'status');
     }
     header('location: ' . base_path());
 }