/** * Displays the registration form. * * @access public * */ function del($id) { // security check: // admins or superadmins cannot be deleted in the users controller $edited_role = getUserPropertyFromId($id, 'role'); $allowed = ($edited_role != 'admin' and $edited_role != 'superadmin'); if (!$allowed) { $this->freakauth_light->denyAccess(getUserProperty('role')); } $this->usermodel->deleteUser($id); if ($this->config->item('FAL_create_user_profile') == TRUE) { $this->load->model('Userprofile'); $this->Userprofile->deleteUserProfile($id); } //set a flash message $msg = $this->db->affected_rows() . $this->lang->line('FAL_user_deleted'); flashMsg($msg); redirect('admin/users', 'location'); }
You are <b><?php echo getUserName(); ?> </b> (role:<b><?php echo getUserProperty('role'); ?> </b>), your id is <b><?php echo getUserProperty('id'); ?> </b>.<br /> Your first superadmin is <b><?php echo getUserPropertyFromId(1, 'user_name'); ?> </b>. <br /><br /> <b>example code:</b> <code> You are <b><?=getUserName()?></b> (role:<b><?=getUserProperty('role')?></b>), your id is <b><?=getUserProperty('id')?></b>.<br /><br /> <br /> Your first superadmin is <b><?=getUserPropertyFromId(1,'user_name')?></b>.<br /> </code> <br /><br /><?php echo anchor('example', 'back to the list');
/** * Deletes an administrator, but not a superadmin * * @access public * @param integer $id the id of the admin */ function del($id) { // we only allow edition of this admin if if he/she is // - not a superadmin $allowed = getUserPropertyFromId($id, 'role') != 'superadmin'; if (!$allowed) { $this->freakauth_light->denyAccess(getUserProperty('role')); } $this->usermodel->deleteUser($id); //set a flash message $msg = $this->db->affected_rows() . $this->lang->line('FAL_user_deleted'); if ($this->config->item('FAL_create_user_profile') == TRUE) { $this->load->model('Userprofile'); $this->Userprofile->deleteUserProfile($id); } $this->usermodel->deleteUser($id); flashMsg($msg); redirect('admin/admins', 'location'); }
function new_reply($topicID = 0, $quote_message = "") { $this->freakauth_light->check(); $this->load->helpers(array('smiley', 'bbcode')); $topicID = intval($topicID); $topic = array('userID' => $this->userID, 'forumID' => '', 'topicID' => $topicID, 'topic_name' => '', 'message' => '', 'notify' => 0, 'smileys' => 1); // Get the topic name $topic_data = $this->post_model->getTopicData($topicID); // Check if topic exists if (!empty($topic_data)) { // It reterns double array, so we need to get the 2 one with data $topic_data = $topic_data[0]; // Take only what we need $topic['forumID'] = $topic_data['forumID']; $topic['topic_name'] = $topic_data['post_title']; // Get the forum name $forum = $this->forum_model->getForum($topic['forumID']); $this->data = array_merge($this->data, $forum, $topic); if (!empty($_POST['submit'])) { $topicID = intval($this->input->post('topicID')); $message = trim($this->input->post('message')); $message = strip_tags($message); $smileys = intval($this->input->post('smileys')); if ($smileys != 1) { $smileys = 0; } $notify = intval($this->input->post('notify')); if ($notify != 1) { $notify = 0; } if (!empty($message) && $topicID > 0) { if ($this->post_model->postReply($this->userID, $topicID, $message, $smileys)) { // Notify about new post $this->post_model->NewPostNotify($topicID, $this->userID); // Add user to notify if ($notify) { $this->post_model->AddNotify($topicID, $this->userID); } // Get New topic ID $last_data = $this->post_model->getLastPost('user', $this->userID); redirect('forums/posts/view_reply/' . $last_data['postID']); } else { show_error('Error Accured While Adding Reply.'); } } } else { if (!empty($_POST['preview'])) { // Get message $message = $this->input->post('message'); $message = strip_tags($message); $smileys = intval($this->input->post('smileys')); if ($smileys != 1) { $smileys = 0; } $notify = intval($this->input->post('notify')); if ($notify != 1) { $notify = 0; } // If empty message field display error if (empty($message)) { $this->template->error('Error Message: Your message field is empty'); } // Define data $this->data['preview'] = $this->post_model->postParse($message, $smileys); $this->data['message'] = stripslashes($message); $this->data['smileys'] = $smileys; $this->data['notify'] = $notify; // Load View $this->template->title('Replying to \'' . $this->data['topic_name'] . '\''); $this->template->crumb($this->data['forum_name'], 'forums/view_forum/' . $forumID); $this->template->crumb('Replying to \'' . $this->data['topic_name'] . '\''); $this->template->create('new_reply', $this->data); } else { if (!empty($quote_message)) { $this->data['message'] = '[quote author="' . getUserPropertyFromId('user_name', $quote_message['authorID']) . '" date="' . $quote_message['post_date'] . '"]' . $quote_message["post_text"] . '[/quote]'; } $this->template->title('Forums > ' . $this->data['forum_name'] . ' > ' . $this->data['topic_name']); $this->template->create('new_reply', $this->data); } } } else { show_error("The topic doesn`t exist!"); } }