示例#1
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');
 }
 function submit_register_form($form)
 {
     $notifications = new notifications();
     $node = node::add_new('title', $form['fields']['name']['value'], 1);
     $node->add_field('email', $form['fields']['email']['value']);
     $node->add_field('password', sha1($form['fields']['password']['value']));
     // Create the activation code.
     $activation_code = uniqid() . rand();
     $node->add_field('activation_code', $activation_code);
     // Then send the code to the new user.
     $reg_email = array('from' => '*****@*****.**', 'from_name' => 'Serum Core', 'is_html' => true, 'to' => $form['fields']['email']['value'], 'subject' => 'Activate your Serum Core login', 'message' => 'Activation code: ' . $activation_code);
     $notifications->mail($reg_email);
     header('location:' . base_path() . 'register/2/' . $node->id);
 }