Source for file b2edit.php
Documentation is available at b2edit.php
* b2evolution - {@link http://b2evolution.net/}
* Released under GNU GPL License - {@link http://b2evolution.net/about/license.html}
* @copyright (c)2003-2005 by Francois PLANQUE - {@link http://fplanque.net/}
require_once (dirname(__FILE__
).
'/_header.php');
param( 'action', 'string' );
// All statuses are allowed for display/acting on (including drafts and deprecated posts):
$show_statuses =
array( 'published', 'protected', 'private', 'draft', 'deprecated' );
* --------------------------------------------------------------------
* Display post editing form
param( 'post', 'integer', true );
$postdata =
get_postdata( $post ) or die( T_('Oops, no post with this ID.') );
$post_locale =
$edited_Item->get( 'locale' );
$cat =
$edited_Item->get( 'main_cat_ID' );
$admin_pagetitle =
T_('Editing post');
require
(dirname(__FILE__
).
'/_menutop.php');
require
(dirname(__FILE__
).
'/_menutop_end.php');
$post_status =
$edited_Item->get( 'status' );
$current_User->check_perm( 'blog_post_statuses', $post_status, true, $blog );
$post_title =
$edited_Item->get( 'title' );
$post_urltitle =
$edited_Item->get( 'urltitle' );
$post_url =
$edited_Item->get( 'url' );
$content =
format_to_edit( $edited_Item->get( 'content' ), $edited_Item->get( 'autobr' ) );
$post_autobr =
$edited_Item->get( 'autobr' );
$post_comments =
$edited_Item->get( 'comments' );
$post_issue_date =
$edited_Item->get( 'issue_date' );
$renderers =
$edited_Item->get( 'renderers' );
$form_action =
'editpost';
require
(dirname(__FILE__
).
'/_edit_form.php');
* --------------------------------------------------------------------
* Display comment in edit form
param( 'comment', 'integer', true );
$commentdata =
get_commentdata($comment,1) or die( T_('Oops, no comment with this ID!') );
$admin_pagetitle =
T_('Editing comment');
require
(dirname(__FILE__
).
'/_menutop.php');
echo
"#".
$commentdata['comment_ID'];
require
(dirname(__FILE__
).
'/_menutop_end.php');
$comment_post_ID =
$commentdata['comment_post_ID'];
$current_User->check_perm( 'blog_comments', 'any', true, $blog );
$content =
$commentdata['comment_content'];
$content =
format_to_edit($content, ($comments_use_autobr ==
'always' ||
$comments_use_autobr ==
'opt-out') );
$post_autobr =
($comments_use_autobr ==
'always' ||
$comments_use_autobr ==
'opt-out');
$aa =
mysql2date('Y', $commentdata['comment_date']);
$mm =
mysql2date('m', $commentdata['comment_date']);
$jj =
mysql2date('d', $commentdata['comment_date']);
$hh =
mysql2date('H', $commentdata['comment_date']);
$mn =
mysql2date('i', $commentdata['comment_date']);
$ss =
mysql2date('s', $commentdata['comment_date']);
$form_action =
'editedcomment';
require
(dirname(__FILE__
).
'/_edit_form.php');
* --------------------------------------------------------------------
* New post form (can be a bookmarklet form if mode == bookmarklet )
$admin_pagetitle =
T_('New post in blog:');
require
(dirname(__FILE__
).
'/_menutop.php');
if( ($blog ==
0) &&
$current_User->check_perm( 'blog_post_statuses', 'any', false, $default_to_blog ) )
{ // Default blog is a valid choice
$blog =
$default_to_blog;
// ---------------------------------- START OF BLOG LIST ----------------------------------
if( ! $current_User->check_perm( 'blog_post_statuses', 'any', false, $curr_blog_ID ) )
{ // Current user is not a member of this blog...
{ // If no selected blog yet, select this one:
// This is for when Javascript is not available:
echo
'<a href="b2edit.php?blog=', $curr_blog_ID;
if( !empty( $mode ) ) echo
'&mode=', $mode;
{ // loop blog has no categories, you cannot post to it.
echo
'onclick="alert(\'', str_replace( "'", "\'", T_('Since this blog has no categories, you cannot post to it. You must create categories first.') ), '\'); return false;" title="', T_('Since this blog has no categories, you cannot post to it. You must create categories first.'), '"';
{ // loop blog AND current blog both have catageories, normal situation:
echo
'onclick="return edit_reload(this.ownerDocument.forms.namedItem(\'post\'), ', $curr_blog_ID,' )" title="', T_('Switch to this blog (keeping your input if Javascript is active)'), '"';
if( $curr_blog_ID ==
$blog )
echo
' class="CurrentBlog"';
echo
' class="OtherBlog"';
} // --------------------------------- END OF BLOG LIST ---------------------------------
require
(dirname(__FILE__
).
'/_menutop_end.php');
<?php printf( T_('Since you\'re a newcomer, you\'ll have to wait for an admin to authorize you to post. You can also <a %s>e-mail the admin</a> to ask for a promotion. When you\'re promoted, just reload this page and you\'ll be able to blog. :)'), 'href="mailto:'.
$admin_email.
'?subject=b2-promotion"' ); ?>
<div class="panelinfo"><p>
<?php echo
T_('Since this blog has no categories, you cannot post to it. You must create categories first.') ?>
$current_User->check_perm( 'blog_post_statuses', 'any', true, $blog );
// Okay now we know we can use at least one status,
// but we need to make sure the requested/default one is ok...
param( 'post_status', 'string', $default_post_status ); // 'published' or 'draft' or ...
if( ! $current_User->check_perm( 'blog_post_statuses', $post_status, false, $blog ) )
{ // We need to find another one:
if( $current_User->check_perm( 'blog_post_statuses', 'published', false, $blog ) )
$post_status =
'published';
elseif( $current_User->check_perm( 'blog_post_statuses', 'protected', false, $blog ) )
$post_status =
'protected';
elseif( $current_User->check_perm( 'blog_post_statuses', 'private', false, $blog ) )
$post_status =
'private';
elseif( $current_User->check_perm( 'blog_post_statuses', 'draft', false, $blog ) )
$post_status =
'deprecated';
// These are bookmarklet params:
param( 'popuptitle', 'string', '' );
param( 'popupurl', 'string', '' );
param( 'text', 'html', '' );
param( 'post_autobr', 'integer', $Settings->get('AutoBR') ); // Use default if nothing provided
param( 'post_pingback', 'integer', 0 );
param( 'trackback_url', 'string' );
$post_trackbacks =
& $trackback_url;
param( 'content', 'html', $text );
param( 'post_title', 'html', $popuptitle );
param( 'post_urltitle', 'string', '' );
param( 'post_url', 'string', $popupurl );
param( 'post_comments', 'string', 'open' ); // 'open' or 'closed' or ...
param( 'post_extracats', 'array', array() );
param( 'post_locale', 'string', $default_locale );
param( 'renderers', 'array', array( 'default' ) );
param( 'edit_date', 'integer', 0 );
param( 'aa', 'string', date( 'Y', $localtimenow) );
param( 'mm', 'string', date( 'm', $localtimenow) );
param( 'jj', 'string', date( 'd', $localtimenow) );
param( 'hh', 'string', date( 'H', $localtimenow) );
param( 'mn', 'string', date( 'i', $localtimenow) );
param( 'ss', 'string', date( 's', $localtimenow) );
require
(dirname(__FILE__
).
'/_edit_form.php');
require
( dirname(__FILE__
).
'/_footer.php' );