} else { //You don't have permission to update content echo json_encode(array('success' => 0, 'msg' => MSG_NO_PERMISSION_TO_EDIT_PAGE)); } } exit; //==================== Add New Page ====================// //==================== Add New Page ====================// case 'add': //check if this user is active one $userIns = new BuckysUser(); $userData = $userIns->getUserData($userID); if ($userData['status'] == BuckysUser::STATUS_USER_ACTIVE) { //When you create a page, it will add empty page in DB already and display them to you. $pageData = array('userID' => $userID, 'title' => BuckysPage::DEFAULT_PAGE_TITLE); $newPageID = $pageIns->addPage($pageData); //It will redirect you to view page. You can edit the page while viewing. buckys_redirect('/page.php?pid=' . $newPageID); exit; } else { buckys_redirect('/account.php'); } //==================== Delete this page ====================// //==================== Delete this page ====================// case 'delete': $paramPageID = get_secure_integer($_REQUEST['pid']); //Check if this user has rights to delete this one if ($pageIns->deletePageByID($paramPageID, $userID)) { //Deleted successfully buckys_redirect('/account.php', MSG_DELETE_PAGE_SUCCESS, MSG_TYPE_SUCCESS); } else {
if (!$_POST['pageName']) { buckys_redirect("/page_add.php", MSG_PAGE_NAME_EMPTY, MSG_TYPE_ERROR); } if (!$_POST['file']) { buckys_redirect("/page_add.php", MSG_PAGE_LOGO_EMPTY, MSG_TYPE_ERROR); } if (!isset($_POST['file']) || strpos($_POST['file'], "../") !== false || !file_exists(DIR_FS_PHOTO_TMP . $_POST['file'])) { buckys_redirect("/page_add.php", MSG_FILE_UPLOAD_ERROR, MSG_TYPE_ERROR); } $fileParts = pathinfo($_POST['file']); if (!in_array(strtolower($fileParts['extension']), $TNB_GLOBALS['imageTypes'])) { buckys_redirect("/page_add.php", MSG_INVALID_PHOTO_TYPE, MSG_TYPE_ERROR); return false; } $pageClass = new BuckysPage(); if ($pageID = $pageClass->addPage($userID, $_POST)) { buckys_add_message(MSG_PAGE_CREATED_SUCCESSFULLY, MSG_TYPE_SUCCESS); buckys_redirect("/page.php?pid=" . $pageID); } else { buckys_redirect("/page_add.php"); } } buckys_enqueue_stylesheet('account.css'); buckys_enqueue_stylesheet('uploadify.css'); buckys_enqueue_stylesheet('jquery.Jcrop.css'); buckys_enqueue_stylesheet('posting.css'); buckys_enqueue_stylesheet('page.css'); buckys_enqueue_javascript('uploadify/jquery.uploadify.js'); buckys_enqueue_javascript('jquery.Jcrop.js'); buckys_enqueue_javascript('jquery.color.js'); buckys_enqueue_javascript('add_page.js');