Main Page   File List   File Members   Related Pages  

basic_page.php

Go to the documentation of this file.
00001 <?php
00002 // $Header: /cvsroot/modphpcms/modphpcms/modules/basic_page.php,v 1.6 2004/05/17 12:47:40 fred87 Exp $
00003 include 'includes/basic_page.inc.php';
00004 
00005 function basic_page_install()
00006 //{{{
00007 {
00008         $info['name'] = 'basic_page';
00009         $info['title'] = 'Basic pages';
00010         $info['description'] = 'Provides support for basic static content.';
00011         $info['has_admin'] = 1;
00012         $info['enabled'] = 1;
00013         set_module_info($info);
00014 
00015         set_entry('config', 'fontpage', '0');
00016         set_entry('config', 'frontpage_items', 10);
00017         
00018         $hooks = get_entry('hooks', 'content');
00019         ListAdd('basic_page', $hooks);
00020         set_entry('hooks', 'content', $hooks);
00021         $hooks = get_entry('hooks', 'DoSummary');
00022         ListAdd('basic_page', $hooks);
00023         set_entry('hooks', 'DoSummary', $hooks);
00024 
00025         module_installed();
00026 }
00027 //}}}
00028 function basic_page_uninstall($preserve_data)
00029 //{{{
00030 {
00031         delete_module('basic_page');
00032 
00033         if (!$preserve_data)
00034         {
00035                 delete_entry('config', 'frontpage_items');
00036                 delete_entry('config', 'fontpage');
00037         }
00038 
00039         $hooks = get_entry('hooks', 'content');
00040         ListDel('basic_page', $hooks);
00041         set_entry('hooks', 'content', $hooks);
00042 
00043         $hooks = get_entry('hooks', 'DoSummary');
00044         ListDel('basic_page', $hooks);
00045         set_entry('hooks', 'DoSummary', $hooks);
00046 }
00047 //}}}
00048 function basic_page_content()
00049 //{{{
00050 {
00051         global $pageType, $ptFound;
00052         $info = get_module_info('basic_page');
00053         if (!$info['enabled'])
00054                 return;
00055 
00056         if ($pageType == 'normal')
00057                 $ptFound = true;
00058         else
00059                 return;
00060 
00061         $_REQUEST['pid'] == ''
00062                 ?       $pid = 0
00063                 :       $pid = $_REQUEST['pid'];
00064                 
00065         if ($pid == 0)
00066         {
00067 //{{{Frontpage
00068                 $frontpage = get_entry('config', 'fontpage');
00069                 if ($frontpage == 0)
00070                 {
00071                         $count = get_reccount('pages');
00072                         $pages = array();
00073                         print "\n<table width='100%' class='article_table' cellspacing='0'>\n";
00074                         for ($i = 1; $i <= $count; $i++)
00075                         {
00076                                 $record = get_array2('pages', $i);
00077                                 @$extra = unserialize($record[$extra]);
00078                                 if (!is_array($extra))
00079                                         $extra = array();
00080         
00081                                 $records[$i] = $record;
00082                         }
00083         
00084                         usort($records, 'Ibasic_page_cmpID');           
00085                 
00086                         $done = false;
00087                         for ($i = 1; $i <= count($records); $i++)
00088                         {
00089                         
00090                                 $currentRecord = $records[count($records) - ($i - 1)];
00091                                 if (get_field2('pages', 'id', $currentRecord['id'] + 1, 'frontpage') == 0)
00092                                         continue;
00093                                 if ($done == true)
00094                                 {
00095                                         print "<tr class='articles_spacer'><td colspan='2'>\n";
00096                                         CallHooks('article_spacer');
00097                                         print "</td></tr>\n";
00098                                 }
00099                                 CallHooks('DoSummary', $currentRecord['id']);
00100                                 $done = true;
00101                         }
00102                         print "</table>\n";
00103                         return;
00104                 } else $pid = $frontpage;
00106         }
00107         
00108         $title = get_field('pages', 'id', $pid, 'title');
00109         $content = get_field('pages', 'id', $pid, 'content');
00110         $author = get_field('pages', 'id', $pid, 'author');
00111         $back = get_entry('lang', 'back');
00112 
00113         RemoveHTML($content);
00114         textToXHTML($content, TRUE);
00115 
00116         CallHooks('content_top');
00117 ?>
00118 <table width='100%' class='article_table' cellspacing='0'>
00119 <tr class='article_row'>
00120         <th class='article_title'>
00121 <?php
00122 CallHooks('title_left');
00123 echo $title;
00124 CallHooks('title_right');
00125 ?>
00126         </th>
00127 </tr>
00128 <tr class='article_row'>
00129         <td class='article_text'>
00130 <?php
00131 CallHooks('content_top');
00132 echo $content;
00133 CallHooks('content_bottom');
00134 ?>
00135         </td>
00136 </tr>
00137 <tr class='article_row'>
00138         <td class='article_bRow'>
00139         <table width='100%' cellspacing='0'><tr>
00140                 <td class='article_author'>
00141                         <a href='page.php?pt=user&amp;pid=<?php echo $author; ?>'>
00142 <?php
00143 CallHooks('author_left');
00144 echo $author;
00145 CallHooks('author_right');
00146 ?></a>
00147                 </td>
00148                 <td class='article_go'>
00149                         <a href='javascript:history.back()'>
00150 <?php
00151 CallHooks('go_left');
00152 echo $back;
00153 CallHooks('go_right');
00154 ?></a>
00155                 </td>
00156         </tr></table>
00157         </td>
00158 </tr>
00159 </table>
00160 <?php
00161 }
00162 //}}}
00163 ?>

Generated on Wed Jun 9 03:38:16 2004 for modphpcms by doxygen1.2.18