/** * Save any changes or additions that were made to these Notifications * * @return bool * */ public function save() { $of = $this->page->of(); if ($of) { $this->page->of(false); } $result = $this->page->save(SystemNotifications::fieldName, array('quiet' => true)); if ($of) { $this->page->of(true); } return $result; }
// check if the form was submitted if ($input->post->submit) { // determine if any fields were ommitted or didn't validate foreach ($required_fields as $key => $value) { if (trim($value) == '') { $error = true; } } // if no errors, create a new page if (!$error) { $mitarbeiter = new User(); $mitarbeiter->name = $sanitizer->text($input->post->mitarbeitername) . $sanitizer->text($input->post->mitarbeitervorname); $mitarbeiter->pass = $sanitizer->text($input->post->mitarbeiterpasswort); $mitarbeiter->email = $sanitizer->text($input->post->mitarbeiteremail); $mitarbeiter->save(); $mitarbeiter->of(false); // turn off output formatting // tmp upload folder for additional security // possibly restrict access to this folder using htaccess: // # RewriteRule ^.tmp_uploads(.*) - [F] $upload_path = $config->paths->root . "tmp_uploads/"; // new wire upload $u = new WireUpload('uploads'); $u->setMaxFiles(1); $u->setOverwrite(true); $u->setDestinationPath($upload_path); $u->setValidExtensions(array('jpg', 'jpeg', 'gif', 'png')); // execute upload and check for errors $files = $u->execute(); if (!$u->getErrors()) { // add images upload
$email = $sanitizer->email($input->post->email); $username = $sanitizer->pageName($email); $firstname = $sanitizer->text($input->post->firstname); $lastname = $sanitizer->text($input->post->lastname); $password = $input->post->password; if (strlen($username) != 0) { if (username_validation($username) == 0) { //if (1==2) { //$username->error = " "; $err_count++; $errors[] = "That email address is already in use!"; } } if (!$err_count) { $new_user = new User(); $new_user->of(false); $new_user->name = $username; $new_user->email = $email; $new_user->pass = $password; $new_user->addRole("guest"); $new_user->firstname = $firstname; $new_user->lastname = $lastname; //$new_user->user_activation = $activation; $new_user->save(); $new_user->of(true); } if (!$err_count) { $response_array['status'] = 1; } else { $response_array['status'] = 0; foreach ($errors as $error) {