/** * Save chosen password */ public function save_pass() { $pass = F::request()->data->password; $pass2 = F::request()->data->password2; if ($pass === $pass2) { if (!empty($pass)) { if (Action::savePassword($pass)) { $_SESSION['flashbag'] = ' <div class="alert alert-success alert-dismissible"> <button type="button" class="close" data-dismiss="alert" aria-label="Close"><span aria-hidden="true">×</span></button> Your password has successfully been set. </div>'; $_SESSION['admin'] = 1; F::redirect('/settings'); exit; } else { $_SESSION['flashbag'] = '<div class="alert alert-danger">An error occured. Please verify that the app/ and src/ folder are writable.</div>'; } } else { $_SESSION['flashbag'] = '<div class="alert alert-warning">No password ? Are you serious ? Put at least some letters.</div>'; } } else { $_SESSION['flashbag'] = '<div class="alert alert-danger">You must enter the same password twice.</div>'; } $this->index(); }
public function getId($arrayToCheck, $title) { $clean_thing_base = Action::cleanUrl($title); $clean_thing = $clean_thing_base; if (empty($clean_thing)) { die('Empty Category/Page Title field.'); } $i = 2; while (array_key_exists($clean_thing, $arrayToCheck)) { $clean_thing = $clean_thing_base . '-' . $i; $i++; } return $clean_thing; }