b2evolution PHP Cross Reference Blogging Systems

Source: /inc/dashboard/dashboard.ctrl.php - 776 lines - 24612 bytes - Summary - Text - Print

Description: This file implements the UI controller for the dashboard. b2evolution - {@link http://b2evolution.net/} Released under GNU GPL License - {@link http://b2evolution.net/about/license.html}

   1  <?php
   2  /**
   3   * This file implements the UI controller for the dashboard.
   4   *
   5   * b2evolution - {@link http://b2evolution.net/}
   6   * Released under GNU GPL License - {@link http://b2evolution.net/about/license.html}
   7   *
   8   * @copyright (c)2003-2007 by Francois PLANQUE - {@link http://fplanque.net/}
   9   *
  10   * {@internal Open Source relicensing agreement:
  11   * }}
  12   *
  13   * @package admin
  14   *
  15   * {@internal Below is a list of authors who have contributed to design/coding of this file: }}
  16   * @author fplanque: Francois PLANQUE.
  17   *
  18   * @todo add 5 plugin hooks. Will be widgetized later (same as SkinTag became Widgets)
  19   *
  20   * @version $Id: dashboard.ctrl.php 6320 2014-03-25 04:37:43Z fplanque $
  21   */
  22  if( !defined('EVO_MAIN_INIT') ) die( 'Please, do not access this page directly.' );
  23  
  24  /**
  25   * @var User
  26   */
  27  global $current_User;
  28  
  29  global $dispatcher, $allow_evo_stats, $blog;
  30  
  31  if( $blog )
  32  {
  33      if( ! $current_User->check_perm( 'blog_ismember', 'view', false, $blog ) )
  34      {    // We don't have permission for the requested blog (may happen if we come to admin from a link on a different blog)
  35          set_working_blog( 0 );
  36          unset( $Blog );
  37      }
  38  }
  39  
  40  $AdminUI->set_coll_list_params( 'blog_ismember', 'view', array(), T_('Global'), '?blog=0' );
  41  
  42  $AdminUI->set_path( 'dashboard' );
  43  
  44  require_js( 'communication.js' ); // auto requires jQuery
  45  // Load the appropriate blog navigation styles (including calendar, comment forms...):
  46  require_css( $rsc_url.'css/blog_base.css' ); // Default styles for the blog navigation
  47  // Colorbox (a lightweight Lightbox alternative) allows to zoom on images and do slideshows with groups of images:
  48  require_js_helper( 'colorbox' );
  49  
  50  $AdminUI->breadcrumbpath_init();
  51  
  52  // Display <html><head>...</head> section! (Note: should be done early if actions do not redirect)
  53  $AdminUI->disp_html_head();
  54  
  55  // Display title, menu, messages, etc. (Note: messages MUST be displayed AFTER the actions)
  56  $AdminUI->disp_body_top();
  57  
  58  if( $blog )
  59  {    // We want to look at a specific blog:
  60  
  61      // load dashboard functions
  62      load_funcs( 'dashboard/model/_dashboard.funcs.php' );
  63  
  64      // Begin payload block:
  65      // This div is to know where to display the message after overlay close:
  66      echo '<div class="first_payload_block">'."\n";
  67  
  68      $AdminUI->disp_payload_begin();
  69  
  70      echo '<h2>'.$Blog->dget( 'name' ).'</h2>';
  71  
  72      echo '<table class="browse" cellspacing="0" cellpadding="0" border="0"><tr><td>';
  73  
  74      load_class( 'items/model/_itemlist.class.php', 'ItemList' );
  75  
  76      $block_item_Widget = new Widget( 'dash_item' );
  77  
  78      $nb_blocks_displayed = 0;
  79  
  80      $blog_moderation_statuses = explode( ',', $Blog->get_setting( 'moderation_statuses' ) );
  81      $highest_publish_status = get_highest_publish_status( 'comment', $Blog->ID, false );
  82      $user_modeartion_statuses = array();
  83  
  84      foreach( $blog_moderation_statuses as $status )
  85      {
  86          if( ( $status !== $highest_publish_status ) && $current_User->check_perm( 'blog_comment!'.$status, 'edit', false, $blog ) )
  87          {
  88              $user_modeartion_statuses[] = $status;
  89          }
  90      }
  91      $user_perm_moderate_cmt = count( $user_modeartion_statuses );
  92  
  93      if( $user_perm_moderate_cmt )
  94      {
  95          /*
  96           * COMMENTS:
  97           */
  98          $CommentList = new CommentList2( $Blog );
  99  
 100          // Filter list:
 101          $CommentList->set_filters( array(
 102                  'types' => array( 'comment','trackback','pingback' ),
 103                  'statuses' => $user_modeartion_statuses,
 104                  'user_perm' => 'moderate',
 105                  'post_statuses' => array( 'published', 'community', 'protected' ),
 106                  'order' => 'DESC',
 107                  'comments' => 5,
 108              ) );
 109  
 110          // Set param prefix for URLs
 111          $param_prefix = 'cmnt_fullview_';
 112          if( !empty( $CommentList->param_prefix ) )
 113          {
 114              $param_prefix = $CommentList->param_prefix;
 115          }
 116  
 117          // Get ready for display (runs the query):
 118          $CommentList->display_init();
 119      }
 120  
 121      if( $user_perm_moderate_cmt && $CommentList->result_num_rows )
 122      {    // We have comments awaiting moderation
 123  
 124          global $htsrv_url;
 125  
 126          ?>
 127  
 128          <script type="text/javascript">
 129              <!--
 130              // currently midified comments id and status. After update is done, the appropiate item will be removed.
 131              var modifieds = new Array();
 132  
 133              // Process result after publish/deprecate/delete action has been completed
 134  			function processResult(result, modifiedlist)
 135              {
 136                  jQuery('#comments_container').html(result);
 137                  for(var id in modifiedlist)
 138                  {
 139                      switch(modifiedlist[id])
 140                      {
 141                          case 'published':
 142                              jQuery('#' + id).css( 'backgroundColor', '#339900' );
 143                              break;
 144                          case 'deprecated':
 145                              jQuery('#' + id).css( 'backgroundColor', '#656565' );
 146                              break;
 147                          case 'deleted':
 148                              jQuery('#' + id).css( 'backgroundColor', '#fcc' );
 149                              break;
 150                      }
 151                  }
 152  
 153                  var comments_number = jQuery('#new_badge').val();
 154                  if(comments_number == '0')
 155                  {
 156                      var options = {};
 157                      jQuery('#comments_block').effect('blind', options, 200);
 158                      jQuery('#comments_block').remove();
 159                  }
 160                  else
 161                  {
 162                      jQuery('#badge').text(comments_number);
 163                  }
 164              }
 165  
 166              // Set comments status
 167  			function setCommentStatus(id, status)
 168              {
 169                  var divid = 'comment_' + id;
 170                  switch(status)
 171                  {
 172                      case 'published':
 173                          fadeIn(divid, '#339900');
 174                          break;
 175                      case 'deprecated':
 176                          fadeIn(divid, '#656565');
 177                          break;
 178                  };
 179  
 180                  modifieds[divid] = status;
 181  
 182                  jQuery.ajax({
 183                  type: 'POST',
 184                  url: '<?php echo $htsrv_url; ?>async.php',
 185                  data: 'blogid=' + <?php echo $Blog->ID; ?> + '&commentid=' + id + '&status=' + status + '&action=set_comment_status&' + <?php echo '\''.url_crumb('comment').'\''; ?>,
 186                  success: function(result)
 187                      {
 188                          // var divid = 'comment_' + id;
 189                          delete modifieds[divid];
 190                          processResult( ajax_debug_clear( result ), modifieds);
 191                      }
 192                  });
 193              }
 194  
 195              // Display voting tool when JS is enable
 196              jQuery( 'document' ).ready( function() { jQuery( '.vote_spam' ).show(); } );
 197              // Set comments vote
 198  			function setCommentVote(id, type, vote)
 199              {
 200                  var divid = 'comment_' + id;
 201                  var highlight_class = '';
 202                  var color = '';
 203                  switch(vote)
 204                  {
 205                      case 'spam':
 206                          color = fadeIn(divid, '#ffc9c9');
 207                          highlight_class = 'roundbutton_red';
 208                          break;
 209                      case 'notsure':
 210                          color = fadeIn(divid, '#bbbbbb');
 211                          break;
 212                      case 'ok':
 213                          color = fadeIn(divid, '#bcffb5');
 214                          highlight_class = 'roundbutton_green';
 215                          break;
 216                  };
 217  
 218                  if( highlight_class != '' )
 219                  {
 220                      jQuery( '#vote_'+type+'_'+id ).find( 'a.roundbutton, span.roundbutton' ).addClass( highlight_class );
 221                  }
 222  
 223                  jQuery.ajax({
 224                  type: 'POST',
 225                  url: '<?php echo $htsrv_url; ?>anon_async.php',
 226                  data:
 227                      { 'blogid': <?php echo '\''.$Blog->ID.'\''; ?>,
 228                          'commentid': id,
 229                          'type': type,
 230                          'vote': vote,
 231                          'action': 'set_comment_vote',
 232                          'crumb_comment': <?php echo '\''.get_crumb('comment').'\''; ?>,
 233                      },
 234                  success: function(result)
 235                      {
 236                          if( color != '' )
 237                          { // Revert back color
 238                              fadeIn( divid, color );
 239                          }
 240                          jQuery('#vote_'+type+'_'+id).after( ajax_debug_clear( result ) );
 241                          jQuery('#vote_'+type+'_'+id).remove();
 242                      }
 243                  });
 244              }
 245  
 246              // Delete comment
 247  			function deleteComment(id)
 248              {
 249                  var divid = 'comment_' + id;
 250                  fadeIn(divid, '#fcc');
 251  
 252                  modifieds[divid] = 'deleted';
 253  
 254                  jQuery.ajax({
 255                  type: 'POST',
 256                  url: '<?php echo $htsrv_url; ?>async.php',
 257                  data: 'action=get_opentrash_link&' + <?php echo '\''.url_crumb('comment').'\''; ?>,
 258                  success: function(result)
 259                      {
 260                          var recycle_bin = jQuery('#recycle_bin');
 261                          if( recycle_bin.length )
 262                          {
 263                              recycle_bin.replaceWith( ajax_debug_clear( result ) );
 264                          }
 265                      }
 266                  });
 267  
 268                  jQuery.ajax({
 269                  type: 'POST',
 270                  url: '<?php echo $htsrv_url; ?>async.php',
 271                  data: 'blogid=' + <?php echo $Blog->ID; ?> + '&commentid=' + id + '&action=delete_comment&' + <?php echo '\''.url_crumb('comment').'\''; ?>,
 272                  success: function(result)
 273                      {
 274                          jQuery('#' + divid).effect('transfer', { to: jQuery('#recycle_bin') }, 700, function() {
 275                              delete modifieds[divid];
 276                              processResult( ajax_debug_clear( result ), modifieds);
 277                          });
 278                      }
 279                  });
 280              }
 281  
 282              // Fade in background color
 283  			function fadeIn(id, color)
 284              {
 285                  var bg_color = jQuery('#' + id).css( 'backgroundColor' );
 286                  jQuery('#' + id).animate({ backgroundColor: color }, 200);
 287                  return bg_color;
 288              }
 289  
 290              // Delete comment author_url
 291  			function delete_comment_url(id)
 292              {
 293                  var divid = 'commenturl_' + id;
 294                  fadeIn(divid, '#fcc');
 295  
 296                  jQuery.ajax({
 297                      type: 'POST',
 298                      url: '<?php echo $htsrv_url; ?>async.php',
 299                      data: 'blogid=' + <?php echo $Blog->ID; ?> + '&commentid=' + id + '&action=delete_comment_url' + '&' + <?php echo '\''.url_crumb('comment').'\''; ?>,
 300                      success: function(result) { jQuery('#' + divid).remove(); }
 301                  });
 302              }
 303  
 304              // This is called when we get the response from the server:
 305  			function antispamSettings( the_html )
 306              {
 307                  // add placeholder for antispam settings form:
 308                  jQuery( 'body' ).append( '<div id="screen_mask" onclick="closeAntispamSettings()"></div><div id="overlay_page"></div>' );
 309                  var evobar_height = jQuery( '#evo_toolbar' ).height();
 310                  jQuery( '#screen_mask' ).css({ top: evobar_height });
 311                  jQuery( '#screen_mask' ).fadeTo(1,0.5).fadeIn(200);
 312                  jQuery( '#overlay_page' ).html( the_html ).addClass( 'overlay_page_active' );
 313                  AttachServerRequest( 'antispam_ban' ); // send form via hidden iframe
 314                  jQuery( '#close_button' ).bind( 'click', closeAntispamSettings );
 315                  jQuery( '.SaveButton' ).bind( 'click', refresh_overlay );
 316  
 317                  // Close antispam popup if Escape key is pressed:
 318                  var keycode_esc = 27;
 319                  jQuery(document).keyup(function(e)
 320                  {
 321                      if( e.keyCode == keycode_esc )
 322                      {
 323                          closeAntispamSettings();
 324                      }
 325                  });
 326              }
 327  
 328              // This is called to close the antispam ban overlay page
 329  			function closeAntispamSettings()
 330              {
 331                  jQuery( '#overlay_page' ).hide();
 332                  jQuery( '.action_messages').remove();
 333                  jQuery( '#server_messages' ).insertBefore( '.first_payload_block' );
 334                  jQuery( '#overlay_page' ).remove();
 335                  jQuery( '#screen_mask' ).remove();
 336                  return false;
 337              }
 338  
 339              // Ban comment url
 340  			function ban_url(authorurl)
 341              {
 342                  <?php global $rsc_url; ?>
 343                  antispamSettings( '<img src="<?php echo $rsc_url; ?>img/ajax-loader2.gif" alt="<?php echo T_('Loading...'); ?>" title="<?php echo T_('Loading...'); ?>" style="display:block;margin:auto;position:absolute;top:0;bottom:0;left:0;right:0;" />' );
 344                  jQuery.ajax({
 345                      type: 'POST',
 346                      url: '<?php echo $admin_url; ?>',
 347                      data: 'ctrl=antispam&action=ban&display_mode=js&mode=iframe&request=checkban&keyword=' + authorurl +
 348                            '&' + <?php echo '\''.url_crumb('antispam').'\''; ?>,
 349                      success: function(result)
 350                      {
 351                          antispamSettings( result );
 352                      }
 353                  });
 354              }
 355  
 356              // Refresh overlay page after Check&ban button click
 357  			function refresh_overlay()
 358              {
 359                  var parameters = jQuery( '#antispam_add' ).serialize();
 360  
 361                  jQuery.ajax({
 362                      type: 'POST',
 363                      url: '<?php echo $admin_url; ?>',
 364                      data: 'action=ban&display_mode=js&mode=iframe&request=checkban&' + parameters,
 365                      success: function(result)
 366                      {
 367                          antispamSettings( result );
 368                      }
 369                  });
 370                  return false;
 371              }
 372  
 373              // Refresh comments on dashboard after ban url -> delete comment
 374  			function refreshAfterBan(deleted_ids)
 375              {
 376                  var comment_ids = String(deleted_ids).split(',');
 377                  for( var i=0;i<comment_ids.length; ++i )
 378                  {
 379                      var divid = 'comment_' + comment_ids[i];
 380                      fadeIn(divid, '#fcc');
 381                  }
 382  
 383                  jQuery.ajax({
 384                      type: 'POST',
 385                      url: '<?php echo $htsrv_url; ?>async.php',
 386                      data: 'blogid=' + <?php echo $Blog->ID; ?> + '&action=refresh_comments&' + <?php echo '\''.url_crumb('comment').'\''; ?>,
 387                      success: function(result)
 388                      {
 389                          processResult( ajax_debug_clear( result ), modifieds);
 390                      }
 391                  });
 392              }
 393  
 394  			function startRefreshComments()
 395              {
 396                  jQuery('#comments_container').slideUp('fast', refreshComments());
 397              }
 398  
 399              // Absolute refresh comment list
 400  			function refreshComments()
 401              {
 402                  jQuery.ajax({
 403                      type: 'POST',
 404                      url: '<?php echo $htsrv_url; ?>async.php',
 405                      data: 'blogid=' + <?php echo $Blog->ID; ?> + '&action=refresh_comments&' + <?php echo '\''.url_crumb('comment').'\''; ?>,
 406                      success: function(result)
 407                      {
 408                          processResult( ajax_debug_clear( result ), modifieds);
 409                          jQuery('#comments_container').slideDown('fast');
 410                      }
 411                  });
 412              }
 413  
 414              -->
 415          </script>
 416          <?php
 417  
 418          $nb_blocks_displayed++;
 419  
 420          $opentrash_link = get_opentrash_link();
 421          $refresh_link = '<span class="floatright">'.action_icon( T_('Refresh comment list'), 'refresh', 'javascript:startRefreshComments()' ).'</span> ';
 422  
 423          $show_statuses_param = $param_prefix.'show_statuses[]='.implode( '&amp;'.$param_prefix.'show_statuses[]=', $user_modeartion_statuses );
 424          $block_item_Widget->title = $refresh_link.$opentrash_link.T_('Comments awaiting moderation').
 425              ' <a href="'.$admin_url.'?ctrl=comments&amp;blog='.$Blog->ID.'&amp;'.$show_statuses_param.'" style="text-decoration:none">'.
 426              '<span id="badge" class="badge badge-important">'.$CommentList->total_rows.'</span></a>';
 427  
 428          echo '<div id="styled_content_block">';
 429          echo '<div id="comments_block">';
 430  
 431          $block_item_Widget->disp_template_replaced( 'block_start' );
 432  
 433          echo '<div id="comments_container">';
 434  
 435          // GET COMMENTS AWAITING MODERATION (the code generation is shared with the AJAX callback):
 436          show_comments_awaiting_moderation( $Blog->ID, $CommentList );
 437  
 438          echo '</div>';
 439  
 440          $block_item_Widget->disp_template_raw( 'block_end' );
 441  
 442          echo '</div>';
 443          echo '</div>';
 444      }
 445  
 446      /*
 447       * RECENT POSTS awaiting moderation
 448       */
 449      // TODO: asimo> Make this configurable per blogs the same way as we have in case of comments
 450      echo '<div id="styled_content_block" class="items_container">';
 451      $default_moderation_statuses = get_visibility_statuses( 'moderation' );
 452      foreach( $default_moderation_statuses as $status )
 453      { // go through all statuses
 454          if( display_posts_awaiting_moderation( $status, $block_item_Widget ) )
 455          { // a block was dispalyed for this status
 456              $nb_blocks_displayed++;
 457          }
 458      }
 459      echo '</div>';
 460  
 461      /*
 462       * RECENTLY EDITED
 463       */
 464      // Create empty List:
 465      $ItemList = new ItemList2( $Blog, NULL, NULL );
 466  
 467      // Filter list:
 468      $ItemList->set_filters( array(
 469              'visibility_array' => get_visibility_statuses( 'keys', array('trash') ),
 470              'orderby' => 'datemodified',
 471              'order' => 'DESC',
 472              'posts' => 5,
 473          ) );
 474  
 475      // Get ready for display (runs the query):
 476      $ItemList->display_init();
 477  
 478      if( $ItemList->result_num_rows )
 479      {    // We have recent edits
 480  
 481          $nb_blocks_displayed++;
 482  
 483          if( $current_User->check_perm( 'blog_post_statuses', 'edit', false, $Blog->ID ) )
 484          {    // We have permission to add a post with at least one status:
 485              $block_item_Widget->global_icon( T_('Write a new post...'), 'new', '?ctrl=items&amp;action=new&amp;blog='.$Blog->ID, T_('New post').' &raquo;', 3, 4 );
 486          }
 487  
 488          $block_item_Widget->title = T_('Recently edited');
 489          $block_item_Widget->disp_template_replaced( 'block_start' );
 490  
 491          echo '<div id="styled_content_block" class="items_container">';
 492  
 493          while( $Item = & $ItemList->get_item() )
 494          {
 495              echo '<div class="dashboard_post dashboard_post_'.($ItemList->current_idx % 2 ? 'even' : 'odd' ).'" lang="'.$Item->get('locale').'">';
 496              // We don't switch locales in the backoffice, since we use the user pref anyway
 497              // Load item's creator user:
 498              $Item->get_creator_User();
 499  
 500              $Item->status( array(
 501                      'before' => '<div class="floatright"><span class="note status_'.$Item->status.'"><span>',
 502                      'after'  => '</span></span></div>',
 503                  ) );
 504  
 505              echo '<div class="dashboard_float_actions">';
 506              $Item->edit_link( array( // Link to backoffice for editing
 507                      'before'    => ' ',
 508                      'after'     => ' ',
 509                      'class'     => 'ActionButton btn'
 510                  ) );
 511              echo '</div>';
 512  
 513              echo '<h3 class="dashboard_post_title">';
 514              $item_title = $Item->dget('title');
 515              if( ! strlen($item_title) )
 516              {
 517                  $item_title = '['.format_to_output(T_('No title')).']';
 518              }
 519              echo '<a href="?ctrl=items&amp;blog='.$Blog->ID.'&amp;p='.$Item->ID.'">'.$item_title.'</a>';
 520              echo ' <span class="dashboard_post_details">';
 521              $Item->views();
 522              echo '</span>';
 523              echo '</h3>';
 524  
 525              // Display images that are linked to this post:
 526              $Item->images( array(
 527                      'before' =>              '<div class="dashboard_thumbnails">',
 528                      'before_image' =>        '',
 529                      'before_image_legend' => NULL,    // No legend
 530                      'after_image_legend' =>  NULL,
 531                      'after_image' =>         '',
 532                      'after' =>               '</div>',
 533                      'image_size' =>          'fit-80x80',
 534                      'restrict_to_image_position' => 'teaser',    // Optionally restrict to files/images linked to specific position: 'teaser'|'aftermore'
 535                  ) );
 536  
 537              echo '<span class="small">'.htmlspecialchars( $Item->get_content_excerpt( 150 ) ).'</span>';
 538  
 539              echo '<div style="clear:left;">'.get_icon('pixel').'</div>'; // IE crap
 540              echo '</div>';
 541          }
 542  
 543          echo '</div>';
 544  
 545          $block_item_Widget->disp_template_raw( 'block_end' );
 546      }
 547  
 548  
 549      if( $nb_blocks_displayed == 0 )
 550      {    // We haven't displayed anything yet!
 551  
 552          $nb_blocks_displayed++;
 553  
 554          $block_item_Widget = new Widget( 'block_item' );
 555          $block_item_Widget->title = T_('Getting started');
 556          $block_item_Widget->disp_template_replaced( 'block_start' );
 557  
 558          echo '<p><strong>'.T_('Welcome to your new blog\'s dashboard!').'</strong></p>';
 559  
 560          echo '<p>'.T_('Use the links on the right to write a first post or to customize your blog.').'</p>';
 561  
 562          echo '<p>'.T_('You can see your blog page at any time by clicking "See" in the b2evolution toolbar at the top of this page.').'</p>';
 563  
 564           echo '<p>'.T_('You can come back here at any time by clicking "Manage" in that same evobar.').'</p>';
 565  
 566          $block_item_Widget->disp_template_raw( 'block_end' );
 567      }
 568  
 569  
 570      /*
 571       * DashboardBlogMain to be added here (anyone?)
 572       */
 573  
 574  
 575      echo '</td><td>';
 576  
 577      /*
 578       * RIGHT COL
 579       */
 580  
 581      $side_item_Widget = new Widget( 'side_item' );
 582  
 583      $side_item_Widget->title = T_('Manage your blog');
 584      $side_item_Widget->disp_template_replaced( 'block_start' );
 585  
 586      echo '<div class="dashboard_sidebar">';
 587      echo '<ul>';
 588          if( $current_User->check_perm( 'blog_post_statuses', 'edit', false, $Blog->ID ) )
 589          {
 590              echo '<li><a href="'.$dispatcher.'?ctrl=items&amp;action=new&amp;blog='.$Blog->ID.'">'.T_('Write a new post').' &raquo;</a></li>';
 591          }
 592  
 593           echo '<li>'.T_('Browse').':<ul>';
 594          echo '<li><a href="'.$dispatcher.'?ctrl=items&tab=full&filter=restore&blog='.$Blog->ID.'">'.T_('Posts (full)').' &raquo;</a></li>';
 595          echo '<li><a href="'.$dispatcher.'?ctrl=items&tab=list&filter=restore&blog='.$Blog->ID.'">'.T_('Posts (list)').' &raquo;</a></li>';
 596          if( $current_User->check_perm( 'blog_comments', 'edit', false, $Blog->ID ) )
 597          {
 598              echo '<li><a href="'.$dispatcher.'?ctrl=comments&amp;filter=restore&amp;blog='.$Blog->ID.'">'.T_('Comments').' &raquo;</a></li>';
 599          }
 600          echo '</ul></li>';
 601  
 602          if( $current_User->check_perm( 'blog_cats', '', false, $Blog->ID ) )
 603          {
 604              echo '<li><a href="'.$dispatcher.'?ctrl=chapters&blog='.$Blog->ID.'">'.T_('Edit categories').' &raquo;</a></li>';
 605          }
 606  
 607           echo '<li><a href="'.$Blog->get('url').'">'.T_('View this blog').'</a></li>';
 608      echo '</ul>';
 609      echo '</div>';
 610  
 611      $side_item_Widget->disp_template_raw( 'block_end' );
 612  
 613      if( $current_User->check_perm( 'blog_properties', 'edit', false, $Blog->ID ) )
 614      {
 615          $side_item_Widget->title = T_('Customize your blog');
 616          $side_item_Widget->disp_template_replaced( 'block_start' );
 617  
 618          echo '<div class="dashboard_sidebar">';
 619          echo '<ul>';
 620  
 621          echo '<li><a href="'.$dispatcher.'?ctrl=coll_settings&amp;tab=general&amp;blog='.$Blog->ID.'">'.T_('Blog properties').' &raquo;</a></li>';
 622          echo '<li><a href="'.$dispatcher.'?ctrl=coll_settings&amp;tab=features&amp;blog='.$Blog->ID.'">'.T_('Blog features').' &raquo;</a></li>';
 623          echo '<li><a href="'.$dispatcher.'?ctrl=coll_settings&amp;tab=skin&amp;blog='.$Blog->ID.'">'.T_('Blog skin').' &raquo;</a></li>';
 624          echo '<li><a href="'.$dispatcher.'?ctrl=widgets&amp;blog='.$Blog->ID.'">'.T_('Blog widgets').' &raquo;</a></li>';
 625          echo '<li><a href="'.$dispatcher.'?ctrl=coll_settings&amp;tab=urls&amp;blog='.$Blog->ID.'">'.T_('Blog URLs').' &raquo;</a></li>';
 626  
 627          echo '</ul>';
 628          echo '</div>';
 629  
 630          $side_item_Widget->disp_template_raw( 'block_end' );
 631      }
 632  
 633  
 634      /*
 635       * DashboardBlogSide to be added here (anyone?)
 636       */
 637  
 638  
 639       echo '</td></tr></table>';
 640  
 641  
 642      // End payload block:
 643      $AdminUI->disp_payload_end();
 644  
 645      echo '</div>'."\n";
 646  }
 647  else
 648  {    // We're on the GLOBAL tab...
 649  
 650      $AdminUI->disp_payload_begin();
 651      echo '<h2>'.T_('Select a blog').'</h2>';
 652      // Display blog list VIEW:
 653      $AdminUI->disp_view( 'collections/views/_coll_list.view.php' );
 654      $AdminUI->disp_payload_end();
 655  
 656  
 657      /*
 658       * DashboardGlobalMain to be added here (anyone?)
 659       */
 660  }
 661  
 662  
 663  /*
 664   * Administrative tasks
 665   */
 666  
 667  if( $current_User->check_perm( 'options', 'edit' ) )
 668  {    // We have some serious admin privilege:
 669  
 670      /**
 671       * @var AbstractSettings
 672       */
 673      global $global_Cache;
 674  
 675      // Begin payload block:
 676      $AdminUI->disp_payload_begin();
 677  
 678      echo '<table class="browse" cellspacing="0" cellpadding="0" border="0"><tr><td>';
 679  
 680      $block_item_Widget = new Widget( 'block_item' );
 681  
 682      $block_item_Widget->title = T_('Updates from b2evolution.net');
 683      $block_item_Widget->disp_template_replaced( 'block_start' );
 684  
 685  
 686      // Note: hopefully, the updates will have been downloaded in the shutdown function of a previous page (including the login screen)
 687      // However if we have outdated info, we will load updates here.
 688      load_funcs( 'dashboard/model/_dashboard.funcs.php' );
 689      // Let's clear any remaining messages that should already have been displayed before...
 690      $Messages->clear();
 691  
 692      if( b2evonet_get_updates() !== NULL )
 693      {    // Updates are allowed, display them:
 694  
 695          // Display info & error messages
 696          echo $Messages->display( NULL, NULL, false, 'action_messages' );
 697  
 698          $version_status_msg = $global_Cache->get( 'version_status_msg' );
 699          if( !empty($version_status_msg) )
 700          {    // We have managed to get updates (right now or in the past):
 701              echo '<p>'.$version_status_msg.'</p>';
 702              $extra_msg = $global_Cache->get( 'extra_msg' );
 703              if( !empty($extra_msg) )
 704              {
 705                  echo '<p>'.$extra_msg.'</p>';
 706              }
 707          }
 708  
 709          $block_item_Widget->disp_template_replaced( 'block_end' );
 710  
 711          /*
 712           * DashboardAdminMain to be added here (anyone?)
 713           */
 714      }
 715      else
 716      {
 717          echo '<p>Updates from b2evolution.net are disabled!</p>';
 718          echo '<p>You will <b>NOT</b> be alerted if you are running an insecure configuration.</p>';
 719      }
 720  
 721      echo '</td><td>';
 722  
 723      // Track just the first login into b2evolution to determine how many people installed manually vs automatic installs:
 724      if( $current_User->ID == 1 && $UserSettings->get('first_login') == NULL )
 725      {
 726          echo 'This is the Admin\'s first ever login.';
 727          echo '<img src="http://b2evolution.net/htsrv/track.php?key=first-ever-login" alt="" />';
 728          // OK, done. Never do this again from now on:
 729          $UserSettings->set('first_login', $localtimenow ); // We might actually display how long the system has been running somewhere
 730          $UserSettings->dbupdate();
 731      }
 732  
 733  
 734      /*
 735       * RIGHT COL
 736       */
 737      $side_item_Widget = new Widget( 'side_item' );
 738  
 739      $side_item_Widget->title = T_('System stats');
 740      $side_item_Widget->disp_template_replaced( 'block_start' );
 741  
 742      echo '<div class="dashboard_sidebar">';
 743      echo '<ul>';
 744          echo '<li>'.sprintf( T_('%s Users'), get_table_count( 'T_users' ) ).'</li>';
 745          echo '<li>'.sprintf( T_('%s Blogs'), get_table_count( 'T_blogs' ) ).'</li>';
 746          echo '<li>'.sprintf( T_('%s Posts'), $post_all_counter = (int)get_table_count( 'T_items__item' ) ).'</li>';
 747          echo '<ul>';
 748              echo '<li>'.sprintf( T_('%s on web'), $post_through_admin = (int)$global_Cache->get( 'post_through_admin' ) ).'</li>';
 749              echo '<li>'.sprintf( T_('%s by XMLRPC'), $post_through_xmlrpc = (int)$global_Cache->get( 'post_through_xmlrpc' ) ).'</li>';
 750              echo '<li>'.sprintf( T_('%s by email'), $post_through_email = (int)$global_Cache->get( 'post_through_email' ) ).'</li>';
 751              echo '<li>'.sprintf( T_('%s unknown'), $post_all_counter - $post_through_admin - $post_through_xmlrpc - $post_through_email ).'</li>';
 752          echo '</ul>';
 753          echo '<li>'.sprintf( T_('%s Slugs'), get_table_count( 'T_slug' ) ).'</li>';
 754          echo '<li>'.sprintf( T_('%s Comments'), get_table_count( 'T_comments' ) ).'</li>';
 755          echo '<li>'.sprintf( T_('%s Files'), get_table_count( 'T_files' ) ).'</li>';
 756          echo '<li>'.sprintf( T_('%s Conversations'), get_table_count( 'T_messaging__thread' ) ).'</li>';
 757          echo '<li>'.sprintf( T_('%s Messages'), get_table_count( 'T_messaging__message' ) ).'</li>';
 758      echo '</ul>';
 759      echo '</div>';
 760  
 761      $side_item_Widget->disp_template_raw( 'block_end' );
 762  
 763      /*
 764       * DashboardAdminSide to be added here (anyone?)
 765       */
 766  
 767      echo '</td></tr></table>';
 768  
 769      // End payload block:
 770      $AdminUI->disp_payload_end();
 771  }
 772  
 773  // Display body bottom, debug info and close </html>:
 774  $AdminUI->disp_global_footer();
 775  
 776  ?>

title

Description

title

Description

title

Description

title

title

Body