Beispiel #1
0
     // todo validate format of a date...
     if (!is_numeric($birth_year)) {
         unset($user->data->date_of_birth);
     }
 }
 if ($user->save()) {
     $result->success = TRUE;
     $result->message = "User saved successfully.";
     if (isset($_POST['nickname'])) {
         require_once APPLICATION_PATH . MODEL_DIR . '/Presenter.php';
         $presenter = new Presenter();
         $presenter_data = array();
         $presenter_data['id'] = $_POST['presenter_id'];
         $presenter_data['nickname'] = $_POST['nickname'];
         $presenter->set($presenter_data);
         $presenter->save();
     }
     if ($model == 'presenter' && $data['tax_exempt'] != $original_tax_exempt) {
         require_once APPLICATION_PATH . MODEL_DIR . '/Admin_user_audit.php';
         $audit = new Admin_user_audit();
         $exempt_reason = !empty($exempt_reason) ? $exempt_reason : 'Admin3 Tax Exempt Status change. tax_exempt: ' . $data['tax_exempt'];
         $audit->set(array('admin_user_id' => CakeSession::read('admin_user')->id, 'reference_name' => 'presenters.tax_exempt', 'reference_id' => $data['id'], 'old_value' => $original_tax_exempt, 'new_value' => $data['tax_exempt'], 'notes' => $exempt_reason));
         $audit->save();
     }
     if ($model == 'email') {
         //log email changes
         $original = $_POST['original'];
         $original_email = $original[$data['email_type_id']]['email'];
         require_once APPLICATION_PATH . MODEL_DIR . '/Admin_user_audit.php';
         $audit = new Admin_user_audit();
         $audit->set(array('admin_user_id' => CakeSession::read('admin_user')->id, 'reference_name' => 'emails.id', 'reference_id' => $data['id'], 'old_value' => $original_email, 'new_value' => $data['email'], 'notes' => 'Admin3 Email change. email_type_id: ' . $data['email_type_id']));