function profileEdit() { // Authorize user $id = $_GET['id']; if ($this->_user['is_authorized']) { if (!($this->_user['id'] == $id)) { $this->set('authorized', false); die('You are not allowed to edit this profile!'); } else { $this->set('authorized', true); } } else { $this->set('authorized', false); die('You are not allowed to edit this profile!'); } // get all necessary user data $user = new User(); $user->createFromID($id); $email = $user->getEmail(); $language = $user->getDefaultLanguage(); $this->set('default_language', $language); // notification_interval is rewritten if any POST data is present $notification_interval = $user->getNotificationInterval(); $default_theme = $user->getDefaultTheme(); //if any POST data in - update profile $style = new Style(); $styles_list = $style->getAll(); $this->set('styles', $styles_list); $this->set('notification_interval', $notification_interval); $this->set('default_theme', $default_theme); $this->set('profile', $user); $this->set('email', $email); $this->set('page_title', "Edit User - " . $user->username); }