function updatePost($post_id, $mode = 'full', $content = 'not needed') { $objResponse = new xajaxResponse(); $project7 = new editsee_App(); if ($project7->loggedIn()) { if ($post_id == 'new') { $post_div = 'new-post'; $post['id'] = 'new'; $post['content'] = 'enter your new post content here'; if ($mode == 'page') { $objResponse->assign('posts', 'innerHTML', ''); } $objResponse->prepend('posts', 'innerHTML', '<div id="new-post" class="post"></div>'); } else { $result = $project7->db->_query($project7->post_select(" and id='" . $post_id . "'")); $post = $result->_fetch_assoc(); $post['title'] = stripslashes($post['title']); $post['content'] = stripslashes($post['content']); $post_div = 'post-' . $post['id']; if ($mode == 'draft') { $result = $project7->db->_query("select title,content from " . $project7->db->get_table_prefix() . "post where draft='" . $post_id . "'"); $draft = $result->_fetch_assoc(); $post['title'] = stripslashes($draft['title']); $post['content'] = stripslashes($draft['content']); } } if ($mode == 'quick') { if ($_SESSION['in-quick' . $post_id] != 'yes') { $_SESSION['in-quick' . $post_id] = 'yes'; ob_start(); include 'includes/layout/quickedit.php'; $quick_edit = ob_get_contents(); ob_end_clean(); $objResponse->assign('post-' . $post['id'], 'innerHTML', $quick_edit); $objResponse->script("mynicEditornew= new nicEditor({iconsPath : '" . str_replace('index.php', '', $_SERVER['SCRIPT_NAME']) . "includes/nicEdit/nicEditorIcons.gif',buttonList : [],uploadURI : 'http://" . $_SERVER['HTTP_HOST'] . "/nicUpload.php'}).panelInstance('post_content')"); } } else { if ($mode == 'inquick') { $post['content'] = stripslashes($content); } if ($project7->is_page($post_id)) { $mode = 'page'; } if ($mode == 'page') { $post_type = 'page'; } else { $post_type = 'post'; } $_SESSION['in-quick' . $post_id] = 'yes'; ob_start(); include 'includes/layout/newpost.php'; $newpost = ob_get_contents(); ob_end_clean(); $objResponse->assign($post_div, 'innerHTML', $newpost); $objResponse->script("mynicEditornew = new nicEditor({iconsPath : '" . str_replace('index.php', '', $_SERVER['SCRIPT_NAME']) . "includes/nicEdit/nicEditorIcons.gif',fullPanel: true,uploadURI : 'http://" . $_SERVER['HTTP_HOST'] . "/nicUpload.php'}).panelInstance('post_content')"); if ($project7->get_config('es_draft_save_time') == '') { $project7->update_config('es_draft_save_time', '60'); } } } else { $objResponse->alert($project7->notLoggedIn()); } return $objResponse; }