[geeklog-cvs] geeklog-1.3/public_html index.php,1.47,1.48

geeklog-cvs-admin at lists.geeklog.net geeklog-cvs-admin at lists.geeklog.net
Thu May 22 17:08:33 EDT 2003


Update of /usr/cvs/geeklog/geeklog-1.3/public_html
In directory internal.geeklog.net:/tmp/cvs-serv23869/public_html

Modified Files:
	index.php 
Log Message:
Re-implemented "static pages on frontpage hack" using the new center block API.


Index: index.php
===================================================================
RCS file: /usr/cvs/geeklog/geeklog-1.3/public_html/index.php,v
retrieving revision 1.47
retrieving revision 1.48
diff -C2 -d -r1.47 -r1.48
*** index.php	15 May 2003 15:25:21 -0000	1.47
--- index.php	22 May 2003 21:08:31 -0000	1.48
***************
*** 40,151 ****
      $topic = '';
  }
- if (isset ($HTTP_GET_VARS['display']) && ($HTTP_GET_VARS['display'] == 'new') && empty ($topic)) {
-     $newstories = true;
- } else {
-     $newstories = false;
- }
- require_once('lib-common.php');
- 
- $display = '';
- 
- /*
-  *  Staticpage on Frontpage Addon (Hacked together by MLimburg)
-  *
-  *  If a staticpage with the title 'frontpage' exists, then it is shown before
-  *  the news messages.  If this staticpage has the label 'nonews', then it is
-  *  shown INSTEAD of news messages.
-  *  This will only occur on the basic index.php page, and not on the $topic
-  *  pages.
-  */
- 
- $shownews = true;
  
! // check if static pages plugin is installed and enabled
! if (DB_getItem ($_TABLES['plugins'], 'pi_enabled', "pi_name = 'staticpages'") == 1) {
! 
!     if (empty ($topic)) {
!         $staticpage_title = 'frontpage';
!     } else {
!         $staticpage_title = 'topic:' . $topic;
      }
  
!     $perms = SP_getPerms ();
!     if (!empty ($perms)) {
!         $perms = ' AND ' . $perms;
!     }
!     $spsql = "SELECT sp_content,sp_label,sp_format,sp_php FROM {$_TABLES['staticpage']} WHERE sp_title = '{$staticpage_title}'" . $perms;
!     $result = DB_query ($spsql);
  
!     if (DB_numRows ($result) > 0) {
!         $spresult = DB_fetchArray ($result);
  
!         if ($spresult['sp_label'] == 'nonews') { // replace news entirely
!             $shownews = false;
!             switch ($spresult['sp_format']) {
!                 case 'noblocks':
!                     $display .= COM_siteHeader ('none')
!                              . COM_showMessage ($HTTP_GET_VARS['msg']);
!                     break;
!                 case 'allblocks':
!                 case 'leftblocks':
!                     $display .= COM_siteHeader ('menu')
!                              . COM_showMessage ($HTTP_GET_VARS['msg']);
!                     break;
!             }
  
!             // Check for type (ie html or php)
!             if ($spresult['sp_php'] == 1) {
!                 $display .= eval (stripslashes ($spresult['sp_content']));
!             } else {
!                 $display .= stripslashes ($spresult['sp_content']);
!             }
  
!             if ($spresult['sp_format'] == 'allblocks') {
!                 $display .= COM_siteFooter (true);
!             } else if ($spresult['sp_format'] != 'blankpage') {
!                 $display .= COM_siteFooter ();
!             }
!         } else { // display static page content before the news
!             $display .= COM_siteHeader ()
!                      . COM_showMessage ($HTTP_GET_VARS['msg']);
!             if (($_SP_CONF['in_block'] == 1) && !empty ($spresult['sp_label'])) {
!                 $display .= COM_startBlock ($spresult['sp_label']);
!             }
  
-             // Check for type (ie html or php)
-             if ($spresult['sp_php'] == 1) {
-                 $display .= eval (stripslashes ($spresult['sp_content']));
-             } else {
-                 $display .= stripslashes ($spresult['sp_content']);
-             }
  
-             if (($_SP_CONF['in_block'] == 1) && !empty ($spresult['sp_label'])) {
-                 $display .= COM_endBlock ();
-             }
-         }
-     } else {
-         $display .= COM_siteHeader() . COM_showMessage ($HTTP_GET_VARS['msg']);
-     }
- } else {
-     $display .= COM_siteHeader() . COM_showMessage ($HTTP_GET_VARS['msg']);
- }
  
  // Show any Plugin formatted blocks
  // Requires a plugin to have a function called plugin_centerblock_<plugin_name>
! $display .= PLG_showCenterblock ();
! 
! if ($shownews) {
  
  $maxstories = 0;
  
- if (isset ($HTTP_GET_VARS['page'])) {
-     $page = $HTTP_GET_VARS['page'];
- }
- 
- if (empty($page)) {
-     // If no page sent then assume the first.
-     $page = 1;
- }
- 
  if (!empty($_USER['uid'])) {
      $result = DB_query("SELECT noboxes,maxstories,tids,aids FROM {$_TABLES['userindex']} WHERE uid = '{$_USER['uid']}'");
--- 40,85 ----
      $topic = '';
  }
  
! $newstories = false;
! $displayall = false;
! if (isset ($HTTP_GET_VARS['display']) && empty ($topic)) {
!     if ($HTTP_GET_VARS['display'] == 'new') {
!         $newstories = true;
!     } else if ($HTTP_GET_VARS['display'] == 'all') {
!         $displayall = true;
      }
+ }
  
! if (isset ($HTTP_GET_VARS['page'])) {
!     $page = $HTTP_GET_VARS['page'];
! }
! if (empty ($page)) {
!     // If no page sent then assume the first.
!     $page = 1;
! }
  
! require_once('lib-common.php');
  
! $display = '';
  
! if (!$newstories && !$displayall) {
!     // give plugins a chance to replace this page entirely
!     $newcontent = PLG_showCenterblock (0, $page, $topic);
!     if (!empty ($newcontent)) {
!         echo $newcontent;
!         exit;
!     }
! }
  
! $display .= COM_siteHeader() . COM_showMessage ($HTTP_GET_VARS['msg']);
  
  
  
  // Show any Plugin formatted blocks
  // Requires a plugin to have a function called plugin_centerblock_<plugin_name>
! $display .= PLG_showCenterblock (1, $page, $topic); // top blocks
  
  $maxstories = 0;
  
  if (!empty($_USER['uid'])) {
      $result = DB_query("SELECT noboxes,maxstories,tids,aids FROM {$_TABLES['userindex']} WHERE uid = '{$_USER['uid']}'");
***************
*** 247,250 ****
--- 181,187 ----
          }
          $display .= COM_article($A,'y');
+         if ($A['featured'] == 1) {
+             $display .= PLG_showCenterblock (2, $page, $topic);
+         }
      }
  
***************
*** 268,274 ****
  }
  
! $display .= COM_siteFooter(true); // The true value enables right hand blocks.
  
! }
  
  // Output page 
--- 205,211 ----
  }
  
! $display .= PLG_showCenterblock (3, $page, $topic); // bottom blocks
  
! $display .= COM_siteFooter(true); // The true value enables right hand blocks.
  
  // Output page 





More information about the geeklog-cvs mailing list