public function forum_blocked() { // Get data for dashboard $data['current_page'] = $_SERVER['REQUEST_URI']; $data['title'] = "Forum Blocked Content"; $data['welcome_message'] = "Welcom to the Admin Panel Blocked Content Listing!"; // Get list of blocked topics $data['blocked_topics'] = $this->forum->getBlockedTopics(); // Get list of blocked topic replies $data['blocked_replies'] = $this->forum->getBlockedReplies(); // Setup Breadcrumbs $data['breadcrumbs'] = "\n <li><a href='" . DIR . "AdminPanel'><i class='glyphicon glyphicon-cog'></i> Admin Panel</a></li>\n <li class='active'><i class='glyphicon glyphicon-remove-sign'></i> " . $data['title'] . "</li>\n "; View::renderModule('AdminPanel/views/header', $data); View::renderModule('AdminPanel/views/forum_blocked', $data, $error, $success); View::renderModule('AdminPanel/views/footer', $data); }
/** * Edit Post */ public function edit($id) { if (!Auth::isLogged()) { Url::redirect('login'); } $data['js'] = array(Url::assetPath('js') . 'plugins/forms/selects/select2.min.js', Url::assetPath('js') . 'plugins/forms/validation/validate.min.js', Url::assetPath('js') . 'plugins/editors/summernote/summernote.min.js', Url::assetPath('js') . 'plugins/pickers/bootstrap-datetimepicker.min.js', Url::assetPath('js') . 'plugins/forms/styling/uniform.min.js', Url::assetPath('js') . 'plugins/notifications/bootbox.min.js', Url::assetPath('js') . 'pages/blog_add.js'); $data['categories'] = $this->blog->getCategories(); $data['statuses'] = (object) array(0 => (object) array('id' => '0', 'name' => $this->language->get('draft')), 1 => (object) array('id' => '1', 'name' => $this->language->get('publish'))); $data['post'] = $this->blog->getPost($id); if (isset($_POST['update'])) { $title = $_POST['title']; $status = $_POST['status']; $content = $_POST['content']; $category_id = $_POST['category']; $user_id = $_SESSION['id']; $schedule = isset($_POST['schedule']) ? '1' : '0'; if ($status == '1' && $schedule == '1') { if (isset($_POST['published_at'])) { $published_at = Date::convertLocalDateTimeToSQL($_POST['published_at'], $_SESSION['dateformat'] . ' ' . $_SESSION['timeformat']); } else { $published_at = ''; } } elseif ($status == '1' && $schedule == '0') { $published_at = Date::convertLocalDateTimeToSQL($_POST['published_at'], $_SESSION['dateformat'] . ' ' . $_SESSION['timeformat']); } else { $published_at = ''; $schedule = '0'; } if ($title == '') { $error[] = $this->language->get('title_required'); } if ($status == '') { $error[] = $this->language->get('status_required'); } if ($category_id == '') { $error[] = $this->language->get('category_required'); } if (!$error) { $data = array('title' => $title, 'content' => $content, 'status' => $status, 'category_id' => $category_id, 'user_id' => $user_id, 'schedule' => $schedule, 'published_at' => $published_at != '' ? $published_at : NULL); $where = array('id' => $id); $data_log = array('id' => $id, 'title' => $title, 'status' => $status, 'category_id' => $category_id, 'user_id' => $user_id, 'schedule' => $schedule, 'published_at' => $published_at != '' ? $published_at : NULL); $this->blog->updatePost($data, $where); Session::set('success', $this->language->get('msg_blog_edit')); Log::notice('log_blog_edit', $data_log); Url::redirect('blog'); } } if (isset($_POST['cancel'])) { Url::redirect('blog'); } View::renderTemplate('header', $data); View::renderModule('Blog/views/edit', $data, $error); View::renderTemplate('footer', $data); }
public function index() { View::renderModule('Search/templates/search/header'); View::renderModule('Search/views/search'); View::renderModule('Search/templates/search/footer'); }
public function newmessage($to_user = NULL) { // Check if user is logged in if ($this->auth->isLoggedIn()) { // Get Current User's ID $u_id = $this->auth->user_info(); } else { Url::redirect(); } // Check to see if user is over quota // Disable New Message Form is they are if ($this->model->checkMessageQuota($u_id)) { // user is over limit, disable new message form $data['hide_form'] = "true"; $error[] = "<span class='glyphicon glyphicon-exclamation-sign' aria-hidden='true'></span>\n <b>Your Outbox is Full!</b> You Can NOT send any messages!"; } // Check to make sure user is trying to send new message if (isset($_POST['submit'])) { // Check to make sure the csrf token is good if (Csrf::isTokenValid()) { // Get data from post $to_username = Request::post('to_username'); $subject = Request::post('subject'); $content = Request::post('content'); $reply = Request::post('reply'); // Check to see if this is coming from a reply button if ($reply != "true") { // Check to make sure user completed all required fields in form if (empty($to_username)) { // Username field is empty $error[] = 'Username Field is Blank!'; } if (empty($subject)) { // Subject field is empty $error[] = 'Subject Field is Blank!'; } if (empty($content)) { // Username field is empty $error[] = 'Message Content Field is Blank!'; } // Check for errors before sending message if (count($error) == 0) { // Get the userID of to username $to_userID = $this->model->getUserIDFromUsername($to_username); // Check to make sure user exists in Database if (isset($to_userID)) { // Check to see if to user's inbox is not full if ($this->model->checkMessageQuotaToUser($to_userID)) { // Run the Activation script if ($this->model->sendmessage($to_userID, $u_id, $subject, $content)) { // Success SuccessHelper::push('You Have Successfully Sent a Private Message', 'Messages'); $data['hide_form'] = "true"; } else { // Fail $error[] = 'Message Send Failed'; } } else { // To user's inbox is full. Let sender know message was not sent $error[] = '<b>${to_username}'s Inbox is Full!</b> Sorry, Message was NOT sent!'; } } else { // User does not exist $error[] = 'Message Send Failed - To User Does Not Exist'; } } // End Form Complete Check } else { // Get data from reply $_POST $subject = Request::post('subject'); $content = Request::post('content'); $date_sent = Request::post('date_sent'); // Add Reply details to subject ex: RE: $data['subject'] = "RE: " . $subject; // Clean up content so it looks pretty $content_reply = " ##########"; $content_reply .= " # PREVIOUS MESSAGE"; $content_reply .= " # From: {$to_username}"; $content_reply .= " # Sent: {$date_sent} "; $content_reply .= " ########## "; $content_reply .= $content; $content_reply = str_replace("<br />", " ", $content_reply); $data['content'] = $content_reply; } // End Reply Check } } // Check to see if there were any errors, if so then auto load form data if (count($error) > 0) { // Auto Fill form to make things eaiser for user $data['subject'] = Request::post('subject'); $data['content'] = Request::post('content'); } // Collect Data for view $data['title'] = "My Private Message"; $data['welcome_message'] = "Welcome to Your Private Message Creator"; $data['csrf_token'] = Csrf::makeToken(); // Check to see if username is in url or post if (isset($to_user)) { $data['to_username'] = $to_user; } else { $data['to_username'] = Request::post('to_username'); } // Setup Breadcrumbs $data['breadcrumbs'] = "\n\t\t\t<li><a href='" . DIR . "'>Home</a></li>\n\t\t\t<li><a href='" . DIR . "Messages'>Private Messages</a></li>\n\t\t\t<li class='active'>" . $data['title'] . "</li>\n\t\t"; // Get requested message data //$data['message'] = $this->model->getMessage($m_id); // Check for new messages in inbox $data['new_messages_inbox'] = $this->model->getUnreadMessages($u_id); // Send data to view View::renderTemplate('header', $data); View::renderModule('Messages/views/messages_sidebar', $data); View::renderModule('Messages/views/message_new', $data, $error, $success); View::renderTemplate('footer', $data); }
</li> </ul> <!-- Tab panes --> <div class="tab-content"> <div class="tab-pane active" id="configUser_<?php echo $randId; ?> "> <?php echo \Core\View::renderModule($self, "templates/user/users", array()); ?> </div> <div class="tab-pane" id="configRoles_<?php echo $randId; ?> "> <?php echo \Core\View::renderModule($self, "templates/user/roles", array()); ?> </div> <div class="tab-pane" id="configUserRole_<?php echo $randId; ?> "> <?php echo \Core\View::renderModule($self, "templates/user/userrole", array()); ?> </div> </div> </div>
public function editProfile() { $u_id = $this->auth->currentSessionInfo()['uid']; $onlineUsers = new MembersModel(); $username = $onlineUsers->getUserName($u_id); if (sizeof($username) > 0) { $username = $username[0]->username; $profile = $onlineUsers->getUserProfile($username); $data['title'] = $username . "'s Profile"; $data['profile'] = $profile[0]; $data['isLoggedIn'] = $this->auth->isLogged(); $data['csrf_token'] = Csrf::makeToken(); View::renderTemplate('header', $data); View::renderModule('Members/views/edit_profile', $data); View::renderTemplate('footer', $data); } else { Error::error404(); } }
if (!isset($aModules[$cls])) { $aModules[$cls] = $acls; } } ?> <div> <div class="modules_<?php echo $randId; ?> "> <?php foreach ($aModules as $cls => $aCls) { $cls = strtolower($cls); $cls = preg_replace("/^Modules_/i", "", $cls); $checked = $aCls["checked"] ? "checked" : ""; echo \Core\View::renderModule($self, "templates/list-checkbox-item", array("value" => $aCls["file"], "label" => str_replace("_", " / ", $cls), "checked" => $checked)); } ?> </div> <script type="text/javascript"> $("div.modules_<?php echo $randId; ?> ").sortable({ containerSelector: "div.modules_<?php echo $randId; ?> ", itemSelector: "div.sortable", handle : "i.fa-arrows"
</div> <div class="col-xs-9"> <div class="tab-content"> <?php $aUsers = $self->getUsers(); $class = 'active'; foreach ($aUsers as $user) { ?> <div class="tab-pane <?php echo $class; ?> " id="user_<?php echo $user["id"] . "_" . $randId; ?> "> <?php $roles = $self->getRole(); foreach ($roles as $role) { echo \Core\View::renderModule($self, "templates/list-checkbox-item", array("value" => $user["id"] . "_" . $role["id"], "label" => $role["role"], "checked" => false)); } ?> <div style="clear:both;"></div> </div> <?php $class = ""; } ?> </div> </div> <div style="clear:both;"></div>
public function editProfile() { $u_id = $this->auth->currentSessionInfo()['uid']; $onlineUsers = new MembersModel(); $username = $onlineUsers->getUserName($u_id); if (sizeof($username) > 0) { if (isset($_POST['submit'])) { if (Csrf::isTokenValid()) { $firstName = strip_tags(Request::post('firstName')); $gender = Request::post('gender') == 'male' ? 'Male' : 'Female'; $website = !filter_var(Request::post('website'), FILTER_VALIDATE_URL) === false ? Request::post('website') : DIR . 'profile/' . $username; $aboutMe = nl2br(strip_tags(Request::post('aboutMe'))); $picture = file_exists($_FILES['profilePic']['tmp_name']) || is_uploaded_file($_FILES['profilePic']['tmp_name']) ? $_FILES['profilePic'] : array(); $userImage = Request::post('oldImg'); if (sizeof($picture) > 0) { $check = getimagesize($picture['tmp_name']); if ($picture['size'] < 1000000 && $check && $check['mime'] == "image/jpeg") { if (!file_exists('images/profile-pics')) { mkdir('images/profile-pics', 0777, true); } $image = new SimpleImage($picture['tmp_name']); $dir = 'images/profile-pics/' . $username[0]->username . '.jpg'; $image->best_fit(400, 300)->save($dir); $userImage = $dir; } } $onlineUsers->updateProfile($u_id, $firstName, $gender, $website, $userImage, $aboutMe); $data['message'] = "Successfully updated profile"; $data['type'] = "success"; } else { $data['message'] = "Error Updating profile"; $data['type'] = "error"; } } $username = $username[0]->username; $profile = $onlineUsers->getUserProfile($username); $data['title'] = $username . "'s Profile"; $data['profile'] = $profile[0]; $data['isLoggedIn'] = $this->auth->isLogged(); $data['csrf_token'] = Csrf::makeToken(); View::renderTemplate('header', $data); View::renderModule('Members/views/edit_profile', $data); View::renderTemplate('footer', $data); } else { Error::error404(); } }
public function profile_edit() { $data['csrf_token'] = Csrf::makeToken(); $data['title'] = "Edit Profile"; $data['profile_content'] = "Use the following fields to update your User Profile."; $data['left_sidebar'] = $this->LeftLinks->AccountLinks(); // Setup Breadcrumbs $data['breadcrumbs'] = "\n\t\t\t<li><a href='" . DIR . "'>Home</a></li>\n\t\t\t<li><a href='" . DIR . "AccountSettings'>Account Settings</a></li>\n\t\t\t<li class='active'>" . $data['title'] . "</li>\n\t\t"; // Get Current User's userID $u_id = $this->auth->user_info(); // Check to make sure user is trying to update profile if (isset($_POST['submit'])) { // Check to make sure the csrf token is good if (Csrf::isTokenValid()) { // Catch password inputs using the Request helper $firstName = Request::post('firstName'); $gender = Request::post('gender'); $website = Request::post('website'); $userImage = Request::post('userImage'); $aboutme = Request::post('aboutme'); // Run the Activation script if ($this->model->updateProfile($u_id, $firstName, $gender, $website, $userImage, $aboutme)) { // Success $success[] = "You Have Successfully Updated Your Profile"; } else { // Fail $error[] = "Profile Update Failed"; } } } // Setup Current User data // Get user data from user's database $current_user_data = $this->model->user_data($u_id); foreach ($current_user_data as $user_data) { $data['u_username'] = $user_data->username; $data['u_firstName'] = $user_data->firstName; $data['u_gender'] = $user_data->gender; $data['u_userImage'] = $user_data->userImage; $data['u_aboutme'] = str_replace("<br />", "", $user_data->aboutme); $data['u_website'] = $user_data->website; } View::renderTemplate('header', $data); View::renderModule('Profile/views/profile_edit', $data, $error, $success); View::renderTemplate('footer', $data); }
echo \Core\View::renderModule($self, "templates/modules", array("randId" => $randId)); ?> <div style="clear:both;"></div> </div> <div class="tab-pane" id="routes_<?php echo $randId; ?> ">routes</div> <div class="tab-pane" id="security_<?php echo $randId; ?> "> <?php echo \Core\View::renderModule($self, "templates/security", array()); ?> <div style="clear:both;"></div> </div> <div class="tab-pane" id="user_<?php echo $randId; ?> "> <?php echo \Core\View::renderModule($self, "templates/user", array("randId" => $randId)); ?> <div style="clear:both;"></div> </div> </div> </div> </div> <div style="clear:both;"></div>
public function templateEventFormatClass($event) { switch ($event) { case "Page_FluxNotNull": $numParams = 2; break; case "Page_AccessDeny": $numParams = 2; break; case "Page_PreLoad": $numParams = 1; break; case "Page_ServiceLoad": $numParams = 2; break; case "Page_TaskLoad": $numParams = 4; break; case "Page_ServiceError": $numParams = 2; break; case "Page_BeforeRender": $numParams = 2; break; case "Page_Load": $numParams = 3; break; default: $numParams = 1; break; } $config = \Core\Config::get("event"); if (empty($config)) { $config = array(); } if (empty($config[$event])) { $config[$event] = array(); } $config[$event] = array_map("strtolower", $config[$event]); foreach ($config[$event] as &$evt) { if (!preg_match("/^\\\\/", $evt)) { $evt = "\\" . $evt; } } $aClass = self::templateEventGetClass($numParams); // Entete signature $listeP = array(); for ($i = 1; $i < $numParams; $i++) { $listeP[] = '$param' . $i; } echo "\n <div class='event-signature'>\n Signature : public [static] function (\n \\Core\\Request,\n " . implode(", ", $listeP) . "\n )\n </div>\n "; // Loaded event foreach ($config[$event] as &$evt) { echo \Core\View::renderModule($this, "templates/list-checkbox-item", array("value" => $evt, "label" => $evt, "checked" => "checked")); } // Other functions matching event signature foreach ($aClass as $className => $aCls) { foreach ($aCls as $cls) { $c = "\\" . $className . "::" . $cls["name"]; if (isset($config[$event]) && !in_array(strtolower($c), $config[$event])) { echo \Core\View::renderModule($this, "templates/list-checkbox-item", array("value" => $c, "label" => $c, "checked" => "")); } } } }
public function newtopic($id) { // Check if user is logged in if ($this->auth->isLoggedIn()) { // Get Current User's ID $u_id = $this->auth->user_info(); } else { //Url::redirect(); } // Output Current User's ID $data['current_userID'] = $u_id; // Get Requested Topic's Title and Description $data['forum_cat'] = $this->model->forum_cat($id); $data['forum_cat_des'] = $this->model->forum_cat_des($id); $data['forum_topics'] = $this->model->forum_topics($id); // Ouput Page Title $data['title'] = "New Topic for " . $data['forum_cat']; // Output Welcome Message $data['welcome_message'] = "Welcome to the new topic page."; // Check to see if current user is a new user $data['is_new_user'] = $this->auth->checkIsNewUser($u_id); // Check to see if user is submitting a new topic if (isset($_POST['submit'])) { // Check to make sure the csrf token is good if (Csrf::isTokenValid()) { // Get data from post $data['forum_title'] = strip_tags(Request::post('forum_title')); $data['forum_content'] = strip_tags(Request::post('forum_content')); // Check to make sure user completed all required fields in form if (empty($data['forum_title'])) { // Username field is empty $error[] = 'Topic Title Field is Blank!'; } if (empty($data['forum_content'])) { // Subject field is empty $error[] = 'Topic Content Field is Blank!'; } // Check for errors before sending message if (count($error) == 0) { // No Errors, lets submit the new topic to db $new_topic = $this->model->sendTopic($u_id, $id, $data['forum_title'], $data['forum_content']); if ($new_topic) { // New Topic Successfully Created Now Check if User is Uploading Image // Check for image upload with this topic $picture = file_exists($_FILES['forumImage']['tmp_name']) || is_uploaded_file($_FILES['forumImage']['tmp_name']) ? $_FILES['forumImage'] : array(); // Make sure image is being uploaded before going further if (sizeof($picture) > 0 && $data['is_new_user'] != true) { // Get image size $check = getimagesize($picture['tmp_name']); // Get file size for db $file_size = $picture['size']; // Make sure image size is not too large if ($picture['size'] < 5000000 && $check && ($check['mime'] == "image/jpeg" || $check['mime'] == "image/png" || $check['mime'] == "image/gif")) { if (!file_exists('images/forum-pics')) { mkdir('images/forum-pics', 0777, true); } // Upload the image to server $image = new SimpleImage($picture['tmp_name']); $new_image_name = "forum-image-topic-uid{$u_id}-fid{$id}-ftid{$new_topic}"; $dir = 'images/forum-pics/' . $new_image_name . '.gif'; $image->best_fit(400, 300)->save($dir); $forumImage = $dir; var_dump($forumImage); // Make sure image was Successfull if ($forumImage) { // Add new image to database if ($this->model->sendNewImage($u_id, $new_image_name, $dir, $file_size, $id, $new_topic)) { $img_success = "<br> Image Successfully Uploaded"; } else { $img_success = "<br> No Image Uploaded"; } } } else { $img_success = "<br> Image was NOT uploaded because the file size was too large!"; } } // Success SuccessHelper::push('You Have Successfully Created a New Topic' . $img_success, 'Topic/' . $new_topic); $data['hide_form'] = "true"; } else { // Fail $error[] = 'New Topic Create Failed'; } } // End Form Complete Check } } // Get Recent Posts List for Sidebar $data['forum_recent_posts'] = $this->model->forum_recent_posts(); // Setup Breadcrumbs $data['breadcrumbs'] = "\n \t\t\t<li><a href='" . DIR . "'>Home</a></li>\n <li><a href='" . DIR . "Forum'>" . $this->forum_title . "</a></li>\n <li><a href='" . DIR . "Topics/{$id}'>" . $data['forum_cat'] . "</a>\n \t\t\t<li class='active'>" . $data['title'] . "</li>\n \t\t"; // Ready the token! $data['csrf_token'] = Csrf::makeToken(); // Send data to view View::renderTemplate('header', $data); View::renderModule('Forum/views/newtopic', $data, $error, $success); View::renderModule('Forum/views/forum_sidebar', $data); View::renderTemplate('footer', $data); }
public function group($id) { // Check for orderby selection $data['orderby'] = Request::post('orderby'); // Get data for users $data['current_page'] = $_SERVER['REQUEST_URI']; $data['title'] = "Group"; $data['welcome_message'] = "Welcome to the Group Admin Panel"; $data['csrf_token'] = Csrf::makeToken(); // Get user groups data $data_groups = $this->model->getAllGroups(); // Get groups user is and is not member of foreach ($data_groups as $value) { $data_user_groups = $this->model->checkUserGroup($id, $value->groupID); if ($data_user_groups) { $group_member[] = $value->groupID; } else { $group_not_member[] = $value->groupID; } } // Gether group data for group user is member of if (isset($group_member)) { foreach ($group_member as $value) { $group_member_data[] = $this->model->getGroupData($value); } } // Push group data to view $data['user_member_groups'] = $group_member_data; // Gether group data for group user is not member of if (isset($group_not_member)) { foreach ($group_not_member as $value) { $group_notmember_data[] = $this->model->getGroupData($value); } } // Push group data to view $data['user_notmember_groups'] = $group_notmember_data; // Check to make sure admin is trying to update group data if (isset($_POST['submit'])) { // Check to make sure the csrf token is good if (Csrf::isTokenValid()) { // Check for update group if ($_POST['update_group'] == "true") { // Catch password inputs using the Request helper $ag_groupID = Request::post('ag_groupID'); $ag_groupName = Request::post('ag_groupName'); $ag_groupDescription = Request::post('ag_groupDescription'); $ag_groupFontColor = Request::post('ag_groupFontColor'); $ag_groupFontWeight = Request::post('ag_groupFontWeight'); // Run the update group script if ($this->model->updateGroup($ag_groupID, $ag_groupName, $ag_groupDescription, $ag_groupFontColor, $ag_groupFontWeight)) { // Success $success[] = "You Have Successfully Updated Group"; } else { // Fail $error[] = "Group Update Failed"; } } //Check for delete group if ($_POST['delete_group'] == "true") { // Catch password inputs using the Request helper $ag_groupID = Request::post('ag_groupID'); // Run the update group script if ($this->model->deleteGroup($ag_groupID)) { // Success $success[] = "You Have Successfully Deleted Group"; \Helpers\Url::redirect('AdminPanel-Groups'); } else { // Fail $error[] = "Group Delete Failed"; } } } } // Setup Current User data // Get user data from user's database $current_group_data = $this->model->getGroup($id); foreach ($current_group_data as $group_data) { $data['g_groupID'] = $group_data->groupID; $data['g_groupName'] = $group_data->groupName; $data['g_groupDescription'] = $group_data->groupDescription; $data['g_groupFontColor'] = $group_data->groupFontColor; $data['g_groupFontWeight'] = $group_data->groupFontWeight; } // Setup Breadcrumbs $data['breadcrumbs'] = "\n <li><a href='" . DIR . "AdminPanel'><i class='fa fa-fw fa-cog'></i> Admin Panel</a></li>\n <li><a href='" . DIR . "AdminPanel-Groups'><i class='fa fa-fw fa-user'></i> Groups </a></li>\n <li class='active'><i class='fa fa-fw fa-user'></i>Group - " . $data['g_groupName'] . "</li>\n "; View::renderModule('AdminPanel/views/header', $data); View::renderModule('AdminPanel/views/group', $data, $error, $success); View::renderModule('AdminPanel/views/footer', $data); }