function initialize_page() { LoginRequired("/admin/login/", array("admin")); $accnt_id = requestIdParam(); $account = Paypal_Config::FindById($accnt_id); $post_action = ""; if (isset($_POST['submit'])) { $post_action = $_POST['submit']; } if ($post_action == "Save") { $account->email = $_POST['email']; $account->success_url = $_POST['success_url']; $account->cancel_url = $_POST['cancel_url']; $account->save(); setFlash("<h3>Paypal account changes saved</h3>"); } }
function initialize_page() { LoginRequired("/admin/login/", array("admin")); $post_action = ""; if (isset($_POST['submit'])) { $post_action = $_POST['submit']; } if ($post_action == "Add User" || $post_action == "Add and Send New User Email") { $email = $_POST['email']; $password = $_POST['password']; $possible_space = strrpos($password, " "); if (empty($email) || empty($password)) { setFlash("<h3>Please enter a username and/or password of at least 6 characters and no spaces</h3>"); } else { if ($possible_space == true) { setFlash("<h3>No spaces are allowed in a password</h3>"); } else { if (strlen(utf8_decode($password)) < 6) { setFlash("<h3>A password should contain at least 6 characters and no spaces</h3>"); } else { $count = MyActiveRecord::Count('Users', "email = '{$email}'"); if ($count > 0) { $duplicate = Users::FindByEmail($email); setFlash("<h3>User already exists (see below)</h3>"); redirect("/admin/edit_user" . $duplicate->id); } else { $new_user = MyActiveRecord::Create('Users', $_POST); $new_user->hash_password(); $new_user->is_admin = checkboxValue($_POST, 'is_admin'); $new_user->is_staff = $new_user->is_admin ? 0 : 1; $new_user->save(); $success = "User added"; if ($post_action == "Add User and Send New User Email") { $new_user->send_newuser_email($_POST['password']); $success .= " / Email Notification Sent"; } setFlash("<h3>" . $success . "</h3>"); redirect("/admin/list_users"); } } } } } }
if (getRequestVarAtIndex(3) != "") { $optionalredirect .= "/" . getRequestVarAtIndex(3); } if (getRequestVarAtIndex(4) != "") { $optionalredirect .= "/" . getRequestVarAtIndex(4); } if (getRequestVarAtIndex(5) != "") { $optionalredirect .= "/" . getRequestVarAtIndex(5); } if (getRequestVarAtIndex(6) != "") { $optionalredirect .= "/" . getRequestVarAtIndex(6); } $userroles = explode(',', USER_ROLES); //$userroles = array( "admin", "staff" ); if (!(getRequestVarAtIndex(0) == "admin" && getRequestVarAtIndex(1) == "login")) { LoginRequired("/admin/login/" . $optionalredirect, $userroles); } $page = get_content_page(); $area = get_content_area(); $user = Users::GetCurrentUser(); $pagename = getRequestVarAtIndex(1); $pagetitle = $pagename != "" ? ucwords(unslug($pagename)) : "Backend GUI"; $bodyclass = $pagename != "" ? $pagename : "home"; $maintenancemode = MAINTENANCE_MODE ? ' {Maintenance Mode}' : ''; ?> <!doctype html> <html xmlns="http://www.w3.org/1999/xhtml" class="no-js"> <head> <meta charset="utf-8"> <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"> <title><?php