[Shuttlebb-svn] SF.net SVN: shuttlebb: [80] branch
Brought to you by:
afterlife69,
danb00
|
From: <aft...@us...> - 2006-12-05 12:18:30
|
Revision: 80
http://svn.sourceforge.net/shuttlebb/?rev=80&view=rev
Author: afterlife69
Date: 2006-12-05 04:18:29 -0800 (Tue, 05 Dec 2006)
Log Message:
-----------
updates to the module system
Modified Paths:
--------------
branch/index.php
branch/module/module_main.php
branch/sources/class_module_loader.php
branch/template/Default/module_index.html
Added Paths:
-----------
branch/template/Default/cache/%%E2^E2A^E2AEC254%%module_index.html
Modified: branch/index.php
===================================================================
--- branch/index.php 2006-12-05 08:40:38 UTC (rev 79)
+++ branch/index.php 2006-12-05 12:18:29 UTC (rev 80)
@@ -39,7 +39,7 @@
/**
* Look for a valid installation
*/
-if ( ! define ('SBB_INSTALLED') )
+if ( ! defined ('SBB_INSTALLED') )
{
// If config not found, start installer
require (ROOT_PATH . 'install/index' . PHPEX);
@@ -115,7 +115,8 @@
'req_path' => REQ_PATH,
'lang_path' => LANG_PATH . $user->data['user_lang'] . '/',
'mod_path' => MOD_PATH,
- 'plug_path' => PLUG_PATH);
+ 'plug_path' => PLUG_PATH)
+);
/**
* Load the active module
Modified: branch/module/module_main.php
===================================================================
--- branch/module/module_main.php 2006-12-05 08:40:38 UTC (rev 79)
+++ branch/module/module_main.php 2006-12-05 12:18:29 UTC (rev 80)
@@ -52,6 +52,8 @@
global $auth;
global $template;
+ $template->display('module_index.html');
+
// Start module proper
echo 'Hello World!';
Modified: branch/sources/class_module_loader.php
===================================================================
--- branch/sources/class_module_loader.php 2006-12-05 08:40:38 UTC (rev 79)
+++ branch/sources/class_module_loader.php 2006-12-05 12:18:29 UTC (rev 80)
@@ -61,32 +61,34 @@
*
* @param string $mod_name
*/
- function load_module($mod_name)
+ function load_module($mod_name, $mod_prefix = 'module')
{
// Check for pre-generated module list
if ( ! is_array ( $this->mod_list ) )
{
// If not, walk modules dir
- $this->mod_list = $this->get_modules();
+ $this->mod_list = $this->get_modules($mod_prefix);
}
// Make sure the module is in the dir
if ( ! in_array ( $mod_name, $this->mod_list ) )
{
// Prevent parse errors
- if ( ! class_exists ( 'module_main' ) )
+ if ( ! class_exists ( $mod_prefix . '_main' ) )
{
- // Include the main module and init
- include( $this->mod_dir . 'module_main' . PHPEX );
- $this->module = new module_main();
+ $module = ($mod_prefix . '_main');
+
+ include( $this->mod_dir . $module . PHPEX );
+ $this->module = new $module();
}
}
else
{
- // Include the module and eval for init
+ $module = ($mod_prefix . '_' . $mod_name);
$this->mod_name = $mod_name;
- include( $this->mod_dir . 'module_' . $mod_name . PHPEX );
- eval('$this->module = new module_' . $mod_name . '();');
+
+ include( $this->mod_dir . $module. PHPEX );
+ $this->module = new $module();
}
return;
@@ -97,7 +99,7 @@
*
* @return array
*/
- function get_modules()
+ function get_modules($mod_prefix = 'module')
{
global $cache;
@@ -122,7 +124,7 @@
$dir = @opendir($this->mod_dir);
while ( $file = basename ( @readdir ( $dir ) ) )
{
- if ( preg_match ( '#module_(.*?)\\' . PHPEX . '#is', $file, $match ) )
+ if ( preg_match ( '#' . preg_quote($mod_prefix, '#') . '_(.*?)\\' . PHPEX . '#is', $file, $match ) )
{
$this->mod_list[] = $match[1];
}
@@ -134,7 +136,7 @@
// Look for main
if ( ! in_array ( 'main', $this->mod_list ) )
{
- trigger_error('module_main_missing');
+ trigger_error('Module_default_missing');
exit;
}
Added: branch/template/Default/cache/%%E2^E2A^E2AEC254%%module_index.html
===================================================================
--- branch/template/Default/cache/%%E2^E2A^E2AEC254%%module_index.html (rev 0)
+++ branch/template/Default/cache/%%E2^E2A^E2AEC254%%module_index.html 2006-12-05 12:18:29 UTC (rev 80)
@@ -0,0 +1,8 @@
+139
+a:4:{s:8:"template";a:1:{s:17:"module_index.html";b:1;}s:9:"timestamp";i:1165321058;s:7:"expires";i:1165324658;s:13:"cache_serials";a:0:{}}<!--
+/*
+ * $Id$
+ * $Date$
+ * $Rev$
+ */ -->
+ You are logged in!
Property changes on: branch/template/Default/cache/%%E2^E2A^E2AEC254%%module_index.html
___________________________________________________________________
Name: svn:keywords
+ Author Date Id Revision
Modified: branch/template/Default/module_index.html
===================================================================
--- branch/template/Default/module_index.html 2006-12-05 08:40:38 UTC (rev 79)
+++ branch/template/Default/module_index.html 2006-12-05 12:18:29 UTC (rev 80)
@@ -4,8 +4,8 @@
* $Date$
* $Rev$
*/ -->
-{if $user.user_id not $constants.guest_id }
+{if $user->user_id != $constants.guest_id }
You are logged in!
{else}
You are not logged in!
-{/else}
\ No newline at end of file
+{/if}
\ No newline at end of file
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|