1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560
|
<?php
/**
* Displays list of post / browsing
*
* 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/}
*
* @package admin
*/
if( !defined('DB_USER') ) die( 'Please, do not access this page directly.' );
?>
<div class="left_col">
<div class="NavBar">
<?php
/**
* Includes:
*/
require_once( dirname(__FILE__). '/'. $admin_dirout. '/'. $core_subdir. '/_class_itemlist.php' );
require_once( dirname(__FILE__). '/'. $admin_dirout. '/'. $core_subdir. '/_class_calendar.php' );
require_once( dirname(__FILE__). '/'. $admin_dirout. '/'. $core_subdir. '/_class_archivelist.php' );
param( 'safe_mode', 'integer', 0 ); // Blogger style
param( 'p', 'integer' ); // Specific post number to display
param( 'm', 'integer', '', true ); // YearMonth(Day) to display
param( 'w', 'integer', '', true ); // Week number
param( 'cat', 'string', '', true ); // List of cats to restrict to
param( 'catsel', 'array', array(), true ); // Array of cats to restrict to
param( 'author', 'integer', '', true ); // List of authors to restrict to
param( 'order', 'string', 'DESC', true ); // ASC or DESC
param( 'orderby', 'string', '', true ); // list of fields to order by
param( 'posts', 'integer', '', true ); // # of posts to display on the page
param( 'paged', 'integer', '', true ); // List page number in paged display
param( 'poststart', 'integer', 1, true ); // Start results at this position
param( 'postend', 'integer', '', true ); // End results at this position
param( 's', 'string', '', true ); // Search string
param( 'sentence', 'string', 'AND', true ); // Search for sentence or for words
param( 'exact', 'integer', '', true ); // Require exact match of title or contents
$preview = 0;
param( 'c', 'string' );
param( 'tb', 'integer', 0 );
param( 'pb', 'integer', 0 );
param( 'show_status', 'array', array( 'published', 'protected', 'private', 'draft', 'deprecated' ), true ); // Array of cats to restrict to
$show_statuses = $show_status;
param( 'show_past', 'integer', '0', true );
param( 'show_future', 'integer', '0', true );
if( ($show_past == 0) && ( $show_future == 0 ) )
{
$show_past = 1;
$show_future = 1;
}
$timestamp_min = ( $show_past == 0 ) ? 'now' : '';
$timestamp_max = ( $show_future == 0 ) ? 'now' : '';
// Getting current blog info:
$blogparams = get_blogparams_by_ID( $blog );
// Get the posts to display:
$MainList = & new ItemList( $blog, $show_statuses, $p, $m, $w, $cat, $catsel, $author, $order, $orderby, $posts, $paged, $poststart, $postend, $s, $sentence, $exact, $preview, '', '', $timestamp_min, $timestamp_max );
$posts_per_page = $MainList->posts_per_page;
$what_to_show = $MainList->what_to_show;
$request = & $MainList->request;
$result_num_rows = $MainList->get_num_rows();
$postIDlist = & $MainList->postIDlist;
$postIDarray = & $MainList->postIDarray;
echo '<h2>';
single_cat_title();
single_month_title( T_(' Date range: '), 'htmlbody', true, 'b2browse.php', 'blog='.$blog );
single_post_title();
echo '</h2>';
if( !$posts )
{
if( $posts_per_page )
{
$posts = $posts_per_page;
}
else
{
$posts = 10;
$posts_per_page = $posts;
}
}
if( !$poststart )
{
$poststart = 1;
}
if( !$postend )
{
$postend = $poststart + $posts - 1;
}
$nextXstart = $postend + 1;
$nextXend = $postend + $posts;
$previousXstart = ($poststart - $posts);
$previousXend = $poststart - 1;
if( $previousXstart < 1 )
{
$previousXstart = 1;
}
require dirname(__FILE__). '/_edit_navbar.php';
?>
</div>
<?php
while( $Item = $MainList->get_item() )
{
?>
<div class="bPost<?php $Item->status( 'raw' ) ?>" lang="<?php $Item->lang() ?>">
<?php
// We don't switch locales in the backoffice, since we use the user pref anyway
$Item->anchor(); ?>
<div class="bSmallHead">
<div class="bSmallHeadRight">
<?php
locale_flag( $Item->locale, 'h10px' );
echo '<br />'.T_('Status').': <span class="Status">';
$Item->status();
echo '</span>';
?>
</div>
<?php
echo '<strong>';
$Item->issue_date(); echo ' @ '; $Item->issue_time();
echo '</strong>';
// TRANS: backoffice: each post is prefixed by "date BY author IN categories"
echo ' ', T_('by'), ' ';
$Item->Author->prefered_name();
echo ' (';
$Item->Author->login();
echo ', ', T_('level:');
$Item->Author->level();
echo ')';
// TRANS: backoffice: each post is prefixed by "date BY author IN categories"
echo '<br />'.T_('Categories').': ';
$Item->categories( false );
?>
</div>
<div class="bContent">
<h3 class="bTitle"><?php $Item->title() ?></h3>
<div class="bText">
<?php
$Item->content();
link_pages( '<p class="right">'.T_('Pages:'), '</p>' );
?>
</div>
</div>
<div class="PostActionsArea">
<a href="<?php $Item->permalink() ?>" title="<?php echo T_('Permanent link to full entry') ?>" class="permalink_right"><img src="img/chain_link.gif" alt="<?php echo T_('Permalink') ?>" width="14" height="14" border="0" class="middle" /></a>
<?php
// Display edit button if current user has the rights:
$Item->edit_link( ' ', ' ', '#', '#', 'ActionButton');
// Display publish NOW button if current user has the rights:
$Item->publish_link( ' ', ' ', '#', '#', 'PublishButton');
// Display delete button if current user has the rights:
$Item->delete_link( ' ', ' ', '#', '#', 'DeleteButton');
?>
<a href="b2browse.php?blog=<?php echo $blog ?>&p=<?php $Item->ID() ?>&c=1" class="ActionButton"><?php
// TRANS: Link to comments for current post
comments_number(T_('no comment'), T_('1 comment'), T_('%d comments'));
trackback_number('', ' · '.T_('1 Trackback'), ' · '.T_('%d Trackbacks'));
pingback_number('', ' · '.T_('1 Pingback'), ' · '.T_('%d Pingbacks'));
?></a>
</div>
<?php
// ---------- comments ----------
if( $c )
{ // We have request display of comments
?>
<div class="bFeedback">
<a name="comments"></a>
<h4><?php echo T_('Comments'), ', ', T_('Trackbacks'), ', ', T_('Pingbacks') ?>:</h4>
<?php
$CommentList = & new CommentList( 0, "'comment','trackback','pingback'", $show_statuses, $Item->ID, '', 'ASC' );
$CommentList->display_if_empty(
'<div class="bComment"><p>' .
T_('No feedback for this post yet...') .
'</p></div>' );
while( $Comment = $CommentList->get_next() )
{ // Loop through comments:
?>
<!-- ========== START of a COMMENT/TB/PB ========== -->
<div class="bComment">
<div class="bSmallHead">
<?php
$Comment->date();
echo ' @ ';
$Comment->time( 'H:i' );
if( $Comment->author_url( '', ' · Url: ', '' )
&& $current_User->check_perm( 'spamblacklist', 'edit' ) )
{ // There is an URL and we have permission to ban...
$baseDomain = preg_replace("/http:\/\//i", "", $Comment->author_url);
$baseDomain = preg_replace("/^www\./i", "", $baseDomain);
$baseDomain = preg_replace("/\/.*/i", "", $baseDomain);
?>
<a href="b2antispam.php?action=ban&keyword=<?php echo urlencode($baseDomain) ?>"><img src="img/noicon.gif" class="middle" alt="<?php echo /* TRANS: Abbrev. */ T_('Ban') ?>" title="<?php echo T_('Ban this domain!') ?>" /></a>
<?php
}
$Comment->author_email( '', ' · Email: ' );
$Comment->author_ip( ' · IP: ' );
?>
</div>
<div class="bCommentContent">
<div class="bCommentTitle">
<?php
switch( $Comment->get( 'type' ) )
{
case 'comment': // Display a comment:
echo T_('Comment from:') ?>
<?php break;
case 'trackback': // Display a trackback:
echo T_('Trackback from:') ?>
<?php break;
case 'pingback': // Display a pingback:
echo T_('Pingback from:') ?>
<?php break;
}
?>
<?php $Comment->author() ?>
</div>
<div class="bCommentText">
<?php $Comment->content() ?>
</div>
</div>
<div class="CommentActionsArea">
<a href="<?php $Comment->permalink() ?>" title="<?php echo T_('Permanent link to this comment') ?>" class="permalink_right"><img src="img/chain_link.gif" alt="<?php echo T_('Permalink') ?>" width="14" height="14" border="0" class="middle" /></a>
<?php
// Display edit button if current user has the rights:
$Comment->edit_link( ' ', ' ', '#', '#', 'ActionButton');
// Display delete button if current user has the rights:
$Comment->delete_link( ' ', ' ', '#', '#', 'DeleteButton');
?>
</div>
</div>
<!-- ========== END of a COMMENT/TB/PB ========== -->
<?php //end of the loop, don't delete
}
if( $Item->can_comment() )
{ // User can leave a comment
?>
<!-- ========== FORM to add a comment ========== -->
<h4><?php echo T_('Leave a comment') ?>:</h4>
<form action="<?php echo $htsrv_url ?>/comment_post.php" method="post" class="bComment">
<input type="hidden" name="comment_post_ID" value="<?php echo $Item->ID(); ?>" />
<input type="hidden" name="redirect_to" value="<?php echo htmlspecialchars($ReqURI); ?>" />
<fieldset>
<div class="label"><?php echo T_('User') ?>:</div>
<div class="info">
<strong><?php $current_User->prefered_name()?></strong>
<?php user_profile_link( ' [', ']', T_('Edit profile') ) ?>
</div>
</fieldset>
<?php
form_textarea( 'comment', '', 12, T_('Comment text'),
T_('Allowed XHTML tags').': '.htmlspecialchars(str_replace( '><',', ', $comment_allowed_tags)), 40, 'bComment' );
?>
<?php if(substr($comments_use_autobr,0,4) == 'opt-') { ?>
<fieldset>
<div class="label"><label><?php echo T_('Options') ?>:</label></div>
<div class="input"><input type="checkbox" class="checkbox" name="comment_autobr" value="1" <?php if ($comments_use_autobr == 'opt-out') echo ' checked="checked"' ?> id="comment_autobr" /> <label for="comment_autobr"><?php echo T_('Auto-BR') ?></label> <span class="notes"><?php echo T_('(Line breaks become <br>)') ?></span>
</div>
</fieldset>
<?php } ?>
<fieldset>
<div class="input">
<input type="submit" name="submit" value="<?php echo T_('Send comment') ?>" class="SaveButton" />
</div>
</fieldset>
<div class="clear"></div>
</form>
<!-- ========== END of FORM to add a comment ========== -->
<?php
} // / can comment
?>
</div>
<?php
} // / comments requested
?>
</div>
<?php
}
if( $MainList->get_total_num_posts() )
{ // don't display navbar twice if we have no post
?>
<div class="NavBar">
<?php require dirname(__FILE__). '/_edit_navbar.php'; ?>
</div>
<?php } ?>
</div>
<!-- ================================== START OF SIDEBAR ================================== -->
<div class="right_col">
<div class="bSideItem">
<h2><?php $Blog->disp( 'name', 'htmlbody' ) ?></h2>
<?php
// ---------- CALENDAR ----------
$Calendar = & new Calendar( $blog, ( empty($calendar) ? $m : $calendar ), '', $timestamp_min, $timestamp_max );
$Calendar->set( 'browseyears', 1 ); // allow browsing years in the calendar's caption
$Calendar->set( 'navigation', 'tfoot' );
$Calendar->display( $pagenow, 'blog='. $blog );
?>
<h3><?php echo T_('Notes') ?></h3>
<?php $Blog->disp( 'notes', 'htmlbody' ) ?>
</div>
<div class="bSideItem">
<form id="searchform" method="get" action="<?php echo $pagenow ?>">
<input type="submit" name="submit" value="<?php echo T_('Search') ?>" class="search" style="float:right" />
<h3><?php echo T_('Search') ?></h3>
<input type="hidden" name="blog" value="<?php echo $blog ?>" />
<fieldset title="Posts to show">
<legend><?php echo T_('Posts to show') ?></legend>
<div>
<input type="checkbox" name="show_past" value="1" id="ts_min" class="checkbox" <?php if( $show_past ) echo 'checked="checked" '?> />
<label for="ts_min"><?php echo T_('Past') ?></label><br />
<input type="checkbox" name="show_future" value="1" id="ts_max" class="checkbox" <?php if( $show_future ) echo 'checked="checked" '?> />
<label for="ts_max"><?php echo T_('Future') ?></label>
</div>
<div>
<input type="checkbox" name="show_status[]" value="published" id="sh_published" class="checkbox" <?php if( in_array( "published", $show_status ) ) echo 'checked="checked" '?> />
<label for="sh_published"><?php echo T_('Published (Public)') ?></label><br />
<input type="checkbox" name="show_status[]" value="protected" id="sh_protected" class="checkbox" <?php if( in_array( "protected", $show_status ) ) echo 'checked="checked" '?> />
<label for="sh_protected"><?php echo T_('Protected (Members only)') ?></label><br />
<input type="checkbox" name="show_status[]" value="private" id="sh_private" class="checkbox" <?php if( in_array( "private", $show_status ) ) echo 'checked="checked" '?> />
<label for="sh_private"><?php echo T_('Private (You only)') ?></label><br />
<input type="checkbox" name="show_status[]" value="draft" id="sh_draft" class="checkbox" <?php if( in_array( "draft", $show_status ) ) echo 'checked="checked" '?> />
<label for="sh_draft"><?php echo T_('Draft (Not published!)') ?></label><br />
<input type="checkbox" name="show_status[]" value="deprecated" id="sh_deprecated" class="checkbox" <?php if( in_array( "deprecated", $show_status ) ) echo 'checked="checked" '?> />
<label for="sh_deprecated"><?php echo T_('Deprecated (Not published!)') ?></label><br />
</div>
</fieldset>
<fieldset title="Text">
<legend><?php echo T_('Title / Text contains') ?></legend>
<div>
<input type="text" name="s" size="20" value="<?php echo htmlspecialchars($s) ?>" class="SearchField" />
</div>
<span class="line">
<?php echo T_('Words') ?>:
</span>
<span class="line">
<input type="radio" name="sentence" value="AND" id="sentAND" class="checkbox" <?php if( $sentence=='AND' ) echo 'checked="checked" '?> />
<label for="sentAND"><?php echo T_('AND') ?></label>
</span>
<span class="line">
<input type="radio" name="sentence" value="OR" id="sentOR" class="checkbox" <?php if( $sentence=='OR' ) echo 'checked="checked" '?> />
<label for="sentOR"><?php echo T_('OR') ?></label>
</span>
<span class="line">
<input type="radio" name="sentence" value="sentence" class="checkbox" id="sentence" <?php if( $sentence=='sentence' ) echo 'checked="checked" '?> />
<label for="sentence"><?php echo T_('Entire phrase') ?></label>
</span>
<span class="line">
<input type="checkbox" name="exact" value="1" id="exact" class="checkbox" <?php if( $exact ) echo 'checked="checked" '?> />
<label for="exact"><?php echo T_('Exact match') ?></label>
</span>
</fieldset>
<fieldset title="Archives">
<legend><?php echo T_('Archives') ?></legend>
<ul>
<?php
// this is what will separate your archive links
$archive_line_start = '<li>';
$archive_line_end = '</li>';
// this is what will separate dates on weekly archive links
$archive_week_separator = ' - ';
$dateformat = locale_datefmt();
$archive_day_date_format = $dateformat;
$archive_week_start_date_format = $dateformat;
$archive_week_end_date_format = $dateformat;
$arc_link_start = $pagenow. '?blog='. $blog. '&';
$ArchiveList = & new ArchiveList( $blog, $Settings->get('archive_mode'), $show_statuses, $timestamp_min, $timestamp_max, 36 );
while( $ArchiveList->get_item( $arc_year, $arc_month, $arc_dayofmonth, $arc_w, $arc_count, $post_ID, $post_title) )
{
echo $archive_line_start;
switch( $Settings->get('archive_mode') )
{
case 'monthly':
// --------------------------------- MONTHLY ARCHIVES ---------------------------------
$arc_m = $arc_year.zeroise($arc_month,2);
echo '<input type="radio" name="m" value="'. $arc_m. '" class="checkbox"';
if( $m == $arc_m ) echo ' checked="checked"' ;
echo ' /> ';
echo '<a href="'. $arc_link_start. 'm='. $arc_m. '">';
echo T_($month[zeroise($arc_month,2)]), ' ', $arc_year;
echo "</a> ($arc_count)";
break;
case 'daily':
// --------------------------------- DAILY ARCHIVES -----------------------------------
$arc_m = $arc_year.zeroise($arc_month,2).zeroise($arc_dayofmonth,2);
echo '<input type="radio" name="m" value="'. $arc_m. '" class="checkbox"';
if( $m == $arc_m ) echo ' checked="checked"' ;
echo ' /> ';
echo '<a href="'. $arc_link_start. 'm='. $arc_m. '">';
echo mysql2date($archive_day_date_format, $arc_year. '-'. zeroise($arc_month,2). '-'. zeroise($arc_dayofmonth,2). ' 00:00:00');
echo "</a> ($arc_count)";
break;
case 'weekly':
// --------------------------------- WEEKLY ARCHIVES ---------------------------------
echo '<a href="'. $arc_link_start. 'm='. $arc_year. '&w='. $arc_w. '">';
echo $arc_year.', '.T_('week').' '.$arc_w;
echo "</a> ($arc_count)";
break;
case 'postbypost':
default:
// ------------------------------- POSY BY POST ARCHIVES -----------------------------
echo '<a href="'. $arc_link_start. 'p='. $post_ID. '">';
if ($post_title) {
echo strip_tags($post_title);
} else {
echo $post_ID;
}
echo '</a>';
}
echo $archive_line_end."\n";
}
?>
</ul>
</fieldset>
<fieldset title="Categories">
<legend><?php echo T_('Categories') ?></legend>
<ul>
<?php
$cat_line_start = '<li>';
$cat_line_end = '</li>';
$cat_group_start = '<ul>';
$cat_group_end = '</ul>';
# When multiple blogs are listed on same page:
$cat_blog_start = '<li><strong>';
$cat_blog_end = '</strong></li>';
// ----------------- START RECURSIVE CAT LIST ----------------
cat_query(); // make sure the caches are loaded
if( ! isset( $cat_array ) ) $cat_array = array();
function cat_list_before_first( $parent_cat_ID, $level )
{ // callback to start sublist
global $cat_group_start;
if( $level > 0 ) echo "\n",$cat_group_start,"\n";
}
function cat_list_before_each( $cat_ID, $level )
{ // callback to display sublist element
global $blog, $cat_array, $cat_line_start, $pagenow;
$cat = get_the_category_by_ID( $cat_ID );
echo $cat_line_start;
echo '<label><input type="checkbox" name="catsel[]" value="'. $cat_ID. '" class="checkbox"';
if( in_array( $cat_ID, $cat_array ) )
{ // This category is in the current selection
echo ' checked="checked"';
}
echo ' /> ';
echo '<a href="', $pagenow, '?blog=', $blog, '&cat=', $cat_ID, '">', $cat['cat_name'], '</a> (', $cat['cat_postcount'] ,')';
if( in_array( $cat_ID, $cat_array ) )
{ // This category is in the current selection
echo "*";
}
echo '</label>';
}
function cat_list_after_each( $cat_ID, $level )
{ // callback to display sublist element
global $cat_line_end;
echo $cat_line_end,"\n";
}
function cat_list_after_last( $parent_cat_ID, $level )
{ // callback to end sublist
global $cat_group_end;
if( $level > 0 ) echo $cat_group_end,"\n";
}
if( $blog > 1 )
{ // We want to display cats for one blog
cat_children( $cache_categories, $blog, NULL, 'cat_list_before_first', 'cat_list_before_each', 'cat_list_after_each', 'cat_list_after_last', 0 );
}
else
{ // We want to display cats for all blogs
for( $curr_blog_ID=blog_list_start('stub');
$curr_blog_ID!=false;
$curr_blog_ID=blog_list_next('stub') )
{
echo $cat_blog_start;
?>
<a href="<?php blog_list_iteminfo('blogurl') ?>"><?php blog_list_iteminfo('name') ?></a>
<?php
echo $cat_blog_end;
// run recursively through the cats
cat_children( $cache_categories, $curr_blog_ID, NULL, 'cat_list_before_first', 'cat_list_before_each', 'cat_list_after_each', 'cat_list_after_last', 1 );
}
}
// ----------------- END RECURSIVE CAT LIST ----------------
?>
</ul>
</fieldset>
<input type="submit" name="submit" value="<?php echo T_('Search') ?>" class="search" />
<input type="button" value="<?php echo T_('Reset') ?>" onclick="document.location.href='<?php echo $pagenow,'?blog=',$blog ?>';" class="search" />
</form>
</div>
</div>
<div class="clear"></div>
|