[Ataraxis-checkins] SF.net SVN: ataraxis: [23] core
Status: Planning
Brought to you by:
klarinetking
|
From: <kla...@us...> - 2006-07-31 14:58:37
|
Revision: 23 Author: klarinetking Date: 2006-07-31 07:58:19 -0700 (Mon, 31 Jul 2006) ViewCVS: http://svn.sourceforge.net/ataraxis/?rev=23&view=rev Log Message: ----------- Moved the page output functions to a separate class. Removed the functions.inc.php file. Modified Paths: -------------- core/common.inc.php core/inc/classes/class.session.php core/inc/template/internal/template.fetch_compile_include.php core/index.php core/login.php core/templates/header.inc.tpl core/templates/indexBody.inc.tpl Added Paths: ----------- core/inc/classes/class.page.php core/inc/config/config.inc.ini core/templates/sidebarLeft.inc.tpl core/templates/sidebarRight.inc.tpl Removed Paths: ------------- core/inc/functions.inc.php Modified: core/common.inc.php =================================================================== --- core/common.inc.php 2006-07-31 01:50:37 UTC (rev 22) +++ core/common.inc.php 2006-07-31 14:58:19 UTC (rev 23) @@ -21,6 +21,7 @@ require ($rootPath . 'inc/template/class.template.php'); require ($rootPath . 'inc/classes/class.session.php'); require ($rootPath . 'inc/classes/class.user.php'); +require ($rootPath . 'inc/classes/class.page.php'); /** * Set up basic classes @@ -48,4 +49,6 @@ $registry->register('session', $session); $user = new user($registry); + +$page = new page($registry); ?> \ No newline at end of file Added: core/inc/classes/class.page.php =================================================================== --- core/inc/classes/class.page.php (rev 0) +++ core/inc/classes/class.page.php 2006-07-31 14:58:19 UTC (rev 23) @@ -0,0 +1,100 @@ +<?php +/** + * @author Nick Ross <kla...@us...> + * @copyright Ataraxis Group 2006 + * @package core + */ + +/** + * The base page making class + * + * This class constructs the web pages. + * + * @package dbal + */ + +class page +{ + /** + * The constructor. + * + * Sets up access to the settings and template objects. + * + * @access public + * @param object $registry + */ + + + public function __construct ($registry) + { + $this->settings = $registry->get('settings'); + $this->template = $registry->get('template'); + } + + /** + * outputHeader + * + * Displays the header. + * + * @access public + * @param string $title + */ + + public function outputHeader ($title) + { + $this->template->assign('lTitle', $this->settings->get('general.sitename') . ' :: ' . $title); + $this->template->assign('lSiteName', $this->settings->get('general.sitename')); + $this->template->display('header.inc.tpl'); + } + + /** + * outputLeftSidebar + * + * Displays the left sidebar. + * + * @access public + */ + + public function outputLeftSidebar () + { + $this->template->display('sidebarLeft.inc.tpl'); + } + + /** + * outputRightSidebar + * + * Displays the right sidebar. + * + * @access public + */ + + public function outputRightSidebar () + { + $this->template->display('sidebarRight.inc.tpl'); + } + + /** + * outputFooter + * + * Displays the footer + * + * @access public + */ + + public function outputFooter () + { + global $startTime; + + $endTime = microtime(); + $totalTime = $endTime - $startTime; + $totalTime = substr($totalTime, 0, 6); + + $this->template->assign(array( + 'lCopyright' => 'This system powered by the <a href="http://ataraxis.sourceforge.net" target="_blank">Ataraxis Blogging System</a>', + 'vLoadTime' => 'Load Time: ' . $totalTime . 's') + ); + + $this->template->display('footer.inc.tpl'); + } +} +?> \ No newline at end of file Modified: core/inc/classes/class.session.php =================================================================== --- core/inc/classes/class.session.php 2006-07-31 01:50:37 UTC (rev 22) +++ core/inc/classes/class.session.php 2006-07-31 14:58:19 UTC (rev 23) @@ -154,5 +154,12 @@ return; } + + public function appendSid ($url) + { + $urlDelim = (strpos($url, '?') === FALSE) ? '?' : '&'; + + return $url . $urlDelim . 'sid=' . $this->sid; + } } ?> \ No newline at end of file Added: core/inc/config/config.inc.ini =================================================================== --- core/inc/config/config.inc.ini (rev 0) +++ core/inc/config/config.inc.ini 2006-07-31 14:58:19 UTC (rev 23) @@ -0,0 +1,5 @@ +;General Configuration File + +[general] + +sitename = Ataraxis Blogging System 0.1 \ No newline at end of file Deleted: core/inc/functions.inc.php =================================================================== --- core/inc/functions.inc.php 2006-07-31 01:50:37 UTC (rev 22) +++ core/inc/functions.inc.php 2006-07-31 14:58:19 UTC (rev 23) @@ -1,41 +0,0 @@ -<?php -/** - * @author Nick Ross <kla...@us...> - * @copyright Ataraxis Group 2006 - * @package core - */ - -function appendSid ($url) -{ - global $session; - - $urlDelim = (strpos($url, '?') === FALSE) ? '?' : '&'; - - return $url . $urlDelim . 'sid=' . $session->sid; -} - -function pageHeader ($title) -{ - global $template, $settings; - - $template->assign('lTitle', $settings->get('general.sitename') . ' :: ' . $title); - $template->assign('lSiteName', $settings->get('general.sitename')); - $template->display('header.inc.tpl'); -} - -function pageFooter () -{ - global $template, $startTime; - - $endTime = microtime(); - $totalTime = $endTime - $startTime; - $totalTime = substr($totalTime, 0, 6); - - $template->assign(array( - 'lCopyright' => 'This system powered by the <a href="http://ataraxis.sourceforge.net" target="_blank">Ataraxis Blogging System</a>', - 'vLoadTime' => 'Load Time: ' . $totalTime . 's') - ); - - $template->display('footer.inc.tpl'); -} -?> \ No newline at end of file Modified: core/inc/template/internal/template.fetch_compile_include.php =================================================================== --- core/inc/template/internal/template.fetch_compile_include.php 2006-07-31 01:50:37 UTC (rev 22) +++ core/inc/template/internal/template.fetch_compile_include.php 2006-07-31 14:58:19 UTC (rev 23) @@ -17,9 +17,17 @@ } $object->_vars = array_merge($object->_vars, $_templatelite_include_vars); - array_unshift($object->_confs, $object->_confs[0]); - $_compiled_output = $object->_fetch_compile($_templatelite_include_file); - array_shift($object->_confs); + if(isset($object->_confs[0])) + { + array_unshift($object->_confs, $object->_confs[0]); + $_compiled_output = $object->_fetch_compile($_templatelite_include_file); + array_shift($object->_confs); + } + else + { + $_compiled_output = $object->_fetch_compile($_templatelite_include_file); + } + $object->_inclusion_depth--; if ($object->debugging) { Modified: core/index.php =================================================================== --- core/index.php 2006-07-31 01:50:37 UTC (rev 22) +++ core/index.php 2006-07-31 14:58:19 UTC (rev 23) @@ -7,8 +7,6 @@ require_once ('./common.inc.php'); -pageHeader('Index'); - if ( $session->loggedOn == TRUE ) { $template->assign('loggedOn', 'True'); @@ -19,10 +17,14 @@ 'lLogout' => '(Logout)', - 'uLogout' => appendSid('./login.php?logout=true')) + 'uLogout' => $session->appendSid('./login.php?logout=true')) ); +// Output the page + +$page->outputHeader('Main Page'); +$page->outputLeftSidebar(); +$page->outputRightSidebar(); $template->display('indexBody.inc.tpl'); - -pageFooter(); +$page->outputFooter(); ?> \ No newline at end of file Modified: core/login.php =================================================================== --- core/login.php 2006-07-31 01:50:37 UTC (rev 22) +++ core/login.php 2006-07-31 14:58:19 UTC (rev 23) @@ -25,7 +25,7 @@ $auth->check($username, $password); - $home = appendSid('./index.php'); + $home = $session->appendSid('./index.php'); echo "Click <a href='$home'>here</a> to go back"; } ?> \ No newline at end of file Modified: core/templates/header.inc.tpl =================================================================== --- core/templates/header.inc.tpl 2006-07-31 01:50:37 UTC (rev 22) +++ core/templates/header.inc.tpl 2006-07-31 14:58:19 UTC (rev 23) @@ -12,4 +12,7 @@ <h1> {$lSiteName} </h1> - </div> \ No newline at end of file + </div> + <div id="wrapper1"> + <div id="wrapper2"> + <div id="maincol"> \ No newline at end of file Modified: core/templates/indexBody.inc.tpl =================================================================== --- core/templates/indexBody.inc.tpl 2006-07-31 01:50:37 UTC (rev 22) +++ core/templates/indexBody.inc.tpl 2006-07-31 14:58:19 UTC (rev 23) @@ -1,34 +1,4 @@ - <div id="wrapper1"> - <div id="wrapper2"> - <div id="maincol"> - <div id="leftcol"> - <p> - What should go here? - </p> - <p> - I think maybe a blogroll - </p> - <p> - Possibly links to other pages - </p> - </div> - <div id="rightcol"> - <p> - {if $loggedOn == True} - Welcome {$vUsername}<br /> - <a href="{$uLogout}">{$lLogout}</a> - {else} - {include file="loginForm.inc.tpl"} - {/if} - </p> - <p> - Probably the archives over here, but that can change - </p> - <p> - {include file="searchForm.inc.tpl"} - </p> - </div> <div id="centercol"> <p> Main posts in here, duh Added: core/templates/sidebarLeft.inc.tpl =================================================================== --- core/templates/sidebarLeft.inc.tpl (rev 0) +++ core/templates/sidebarLeft.inc.tpl 2006-07-31 14:58:19 UTC (rev 23) @@ -0,0 +1,11 @@ + <div id="leftcol"> + <p> + What should go here? + </p> + <p> + I think maybe a blogroll + </p> + <p> + Possibly links to other pages + </p> + </div> \ No newline at end of file Added: core/templates/sidebarRight.inc.tpl =================================================================== --- core/templates/sidebarRight.inc.tpl (rev 0) +++ core/templates/sidebarRight.inc.tpl 2006-07-31 14:58:19 UTC (rev 23) @@ -0,0 +1,16 @@ + <div id="rightcol"> + <p> + {if $loggedOn == True} + Welcome {$vUsername}<br /> + <a href="{$uLogout}">{$lLogout}</a> + {else} + {include file="loginForm.inc.tpl"} + {/if} + </p> + <p> + Probably the archives over here, but that can change + </p> + <p> + {include file="searchForm.inc.tpl"} + </p> + </div> \ No newline at end of file This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |