function bi_AjaxRedirect($result = '') { global $bi_Pagename, $_REQUEST, $bi_CommentPage, $EnablePost, $MessagesFmt, $action, $bi_Name, $bi_Group, $bi_Pages, $bi_SkinClasses; bi_debugLog('AjaxRedirect: ' . $_REQUEST['bi_context']); if ($EnablePost && count($MessagesFmt) == 0) { #set to 0 if pmform failed (invalid captcha, etc) if ($_REQUEST['target'] == 'blogit-comments') { bi_SendAjax('(:includesection "' . ($_REQUEST['bi_context'] == $bi_SkinClasses['comment-admin-list'] ? '#unapproved-comments' : '#comments-pagelist') . ' commentid=' . $bi_CommentPage . ' entrycomments=readonly":)', $bi_CommentPage == $bi_Pagename ? 'Successfully updated comment.' : XL('Successfully added new comment.') . (PageTextVar($bi_CommentPage, 'commentapproved') == 'false' ? '<br />' . XL('All comments are reviewed before being displayed.') : ''), MarkupToHTML($bi_Pagename, '{$Captcha} (:input captcha tabindex=1:)')); } elseif ($_REQUEST['target'] == 'blogit-entry') { bi_SendAjax(isset($_REQUEST['bi_context']) ? '(:includesection "' . ($_REQUEST['bi_context'] == $bi_SkinClasses['blog-entry-summary'] ? '#blog-summary-pagelist group=' . $bi_Group . ' name=' . $bi_Name : ($_REQUEST['bi_context'] == $bi_SkinClasses['blog-list-row'] ? '#blog-grid group=' . $bi_Group . ' name=' . $bi_Name : '#single-entry-view')) . '":)' : '', 'Successfully ' . ($action == 'bi_ne' || $action == 'pmform' && $bi_Pagename == $bi_Pages['admin'] ? 'added' : 'updated') . ' blog entry.'); } else { bi_echo_json_encode($result); } } else { bi_echo_json_encode(array('result' => 'error', 'msg' => FmtPageName(utf8_encode(implode($MessagesFmt)), $bi_Pagename))); } exit; }
function bi_AjaxRedirect($result = '') { global $bi_Pagename, $_REQUEST, $bi_CommentPage, $EnablePost, $MessagesFmt, $action, $bi_Name, $bi_Group, $bi_Pages, $bi_SkinClasses, $bi_FrmAction, $_POST; bi_debugLog('AjaxRedirect: ' . $_REQUEST['bi_context'] . '::' . $_REQUEST['target'] . '::' . $action); if ($EnablePost && count($MessagesFmt) == 0) { //set to 0 if pmform failed (invalid captcha, etc) //Translate the class of the html element being updated (bi_context) to the template to be used to generate new data on includesection from pmwiki //bi_context: class determines which includesection template to use //$bi_SkinClasses['comment-admin-list'] - '.blogit-comment-admin-list': '#unapproved-comments' //otherwise: '#comments-pagelist' //$bi_SkinClasses['blog-entry-summary'] - '.blogit-post-summary': '#blog-summary-pagelist //$bi_SkinClasses['blog-list-row'] - '.blogit-blog-list-row': '#blog-grid // otherwise ('.blogit-post'): '#single-entry-view' if ($_REQUEST['target'] == 'blogit-comments') { //determine which pmform is requested bi_SendAjax('(:includesection "' . ($_REQUEST['bi_context'] == $bi_SkinClasses['comment-admin-list'] ? '#unapproved-comments' : '#comments-pagelist') . ' commentid=' . $bi_CommentPage . ' entrycomments=readonly base=' . IsEnabled($_POST['ptv_blogit_basepage']) . '":)', $bi_FrmAction == 'bi_ce' ? XL('Successfully updated comment.') : XL('Successfully added new comment.') . (PageTextVar($bi_CommentPage, 'commentapproved') == 'false' ? '<br />' . XL('All comments are reviewed before being displayed.') : ''), MarkupToHTML($bi_Pagename, '{$Captcha} (:input captcha tabindex=1:)')); } elseif ($_REQUEST['target'] == 'blogit-entry') { bi_SendAjax(isset($_REQUEST['bi_context']) ? '(:includesection "' . ($_REQUEST['bi_context'] == $bi_SkinClasses['blog-entry-summary'] ? '#blog-summary-pagelist group=' . $bi_Group . ' name=' . $bi_Name : ($_REQUEST['bi_context'] == $bi_SkinClasses['blog-list-row'] ? '#blog-grid group=' . $bi_Group . ' name=' . $bi_Name : '#single-entry-view')) . '":)' : 'No context set on comment submit.', 'Successfully ' . ($bi_FrmAction == 'bi_ne' ? 'added' : 'updated') . ' blog entry.'); } else { bi_echo_json_encode($result); } } else { bi_echo_json_encode(array('result' => 'error', 'msg' => FmtPageName(utf8_encode(implode($MessagesFmt)), $bi_Pagename))); } exit; }