shuttlebb-svnotify Mailing List for ShuttleBB
Brought to you by:
afterlife69,
danb00
You can subscribe to this list here.
| 2006 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
(38) |
|---|
|
From: <aft...@us...> - 2006-12-20 13:07:29
|
Revision: 90
http://svn.sourceforge.net/shuttlebb/?rev=90&view=rev
Author: afterlife69
Date: 2006-12-20 05:07:28 -0800 (Wed, 20 Dec 2006)
Log Message:
-----------
T.T re-adding files would help.
Added Paths:
-----------
trunk/
trunk/index.php
trunk/install/
trunk/install/index.php
trunk/install/sources/
trunk/install/sources/functions_install.php
trunk/install/sources/index.html
trunk/install/sql/
trunk/install/sql/index.html
trunk/install/sql/mysql_data.sql
trunk/install/sql/mysql_schema.sql
trunk/language/
trunk/language/english/
trunk/language/english/global.php
trunk/language/english/lang_index.php
trunk/module/
trunk/module/module_main.php
trunk/plugins/
trunk/plugins/Hello_World.php
trunk/plugins/index.html
trunk/require/
trunk/require/configuration.php
trunk/require/constants.php
trunk/require/extensions.php
trunk/sources/
trunk/sources/cache/
trunk/sources/cache/cache_directory.php
trunk/sources/cache/cache_sql.php
trunk/sources/cache/cache_template.php
trunk/sources/cache/cache_xml.php
trunk/sources/cache/index.html
trunk/sources/captcha/
trunk/sources/captcha/captcha_legacy.php
trunk/sources/captcha/captcha_shape.php
trunk/sources/captcha/index.html
trunk/sources/class_access_control.php
trunk/sources/class_bbcode.php
trunk/sources/class_cache.php
trunk/sources/class_captcha.php
trunk/sources/class_dbal.php
trunk/sources/class_email_handler.php
trunk/sources/class_file.php
trunk/sources/class_hooks.php
trunk/sources/class_language.php
trunk/sources/class_message.php
trunk/sources/class_module_loader.php
trunk/sources/class_privmsg.php
trunk/sources/class_session.php
trunk/sources/class_template.php
trunk/sources/class_user.php
trunk/sources/dbal/
trunk/sources/dbal/dbal_mysql.php
trunk/sources/dbal/dbal_mysqli.php
trunk/sources/dbal/index.html
trunk/sources/error/
trunk/sources/error/index.html
trunk/sources/error/templates/
trunk/sources/error/templates/index.html
trunk/sources/functions_general.php
trunk/sources/functions_handlers.php
trunk/sources/index.html
trunk/sources/smarty/
trunk/sources/smarty/Config_File.class.php
trunk/sources/smarty/Smarty.class.php
trunk/sources/smarty/Smarty_Compiler.class.php
trunk/sources/smarty/debug.tpl
trunk/sources/smarty/index.html
trunk/sources/smarty/internals/
trunk/sources/smarty/internals/core.assemble_plugin_filepath.php
trunk/sources/smarty/internals/core.assign_smarty_interface.php
trunk/sources/smarty/internals/core.create_dir_structure.php
trunk/sources/smarty/internals/core.display_debug_console.php
trunk/sources/smarty/internals/core.get_include_path.php
trunk/sources/smarty/internals/core.get_microtime.php
trunk/sources/smarty/internals/core.get_php_resource.php
trunk/sources/smarty/internals/core.is_secure.php
trunk/sources/smarty/internals/core.is_trusted.php
trunk/sources/smarty/internals/core.load_plugins.php
trunk/sources/smarty/internals/core.load_resource_plugin.php
trunk/sources/smarty/internals/core.process_cached_inserts.php
trunk/sources/smarty/internals/core.process_compiled_include.php
trunk/sources/smarty/internals/core.read_cache_file.php
trunk/sources/smarty/internals/core.rm_auto.php
trunk/sources/smarty/internals/core.rmdir.php
trunk/sources/smarty/internals/core.run_insert_handler.php
trunk/sources/smarty/internals/core.smarty_include_php.php
trunk/sources/smarty/internals/core.write_cache_file.php
trunk/sources/smarty/internals/core.write_compiled_include.php
trunk/sources/smarty/internals/core.write_compiled_resource.php
trunk/sources/smarty/internals/core.write_file.php
trunk/sources/smarty/internals/index.html
trunk/sources/smarty/plugins/
trunk/sources/smarty/plugins/block.textformat.php
trunk/sources/smarty/plugins/compiler.assign.php
trunk/sources/smarty/plugins/function.assign_debug_info.php
trunk/sources/smarty/plugins/function.config_load.php
trunk/sources/smarty/plugins/function.counter.php
trunk/sources/smarty/plugins/function.cycle.php
trunk/sources/smarty/plugins/function.debug.php
trunk/sources/smarty/plugins/function.eval.php
trunk/sources/smarty/plugins/function.fetch.php
trunk/sources/smarty/plugins/function.html_checkboxes.php
trunk/sources/smarty/plugins/function.html_image.php
trunk/sources/smarty/plugins/function.html_options.php
trunk/sources/smarty/plugins/function.html_radios.php
trunk/sources/smarty/plugins/function.html_select_date.php
trunk/sources/smarty/plugins/function.html_select_time.php
trunk/sources/smarty/plugins/function.html_table.php
trunk/sources/smarty/plugins/function.mailto.php
trunk/sources/smarty/plugins/function.math.php
trunk/sources/smarty/plugins/function.popup.php
trunk/sources/smarty/plugins/function.popup_init.php
trunk/sources/smarty/plugins/index.html
trunk/sources/smarty/plugins/modifier.capitalize.php
trunk/sources/smarty/plugins/modifier.cat.php
trunk/sources/smarty/plugins/modifier.count_characters.php
trunk/sources/smarty/plugins/modifier.count_paragraphs.php
trunk/sources/smarty/plugins/modifier.count_sentences.php
trunk/sources/smarty/plugins/modifier.count_words.php
trunk/sources/smarty/plugins/modifier.date_format.php
trunk/sources/smarty/plugins/modifier.debug_print_var.php
trunk/sources/smarty/plugins/modifier.default.php
trunk/sources/smarty/plugins/modifier.escape.php
trunk/sources/smarty/plugins/modifier.indent.php
trunk/sources/smarty/plugins/modifier.lower.php
trunk/sources/smarty/plugins/modifier.nl2br.php
trunk/sources/smarty/plugins/modifier.regex_replace.php
trunk/sources/smarty/plugins/modifier.replace.php
trunk/sources/smarty/plugins/modifier.spacify.php
trunk/sources/smarty/plugins/modifier.string_format.php
trunk/sources/smarty/plugins/modifier.strip.php
trunk/sources/smarty/plugins/modifier.strip_tags.php
trunk/sources/smarty/plugins/modifier.truncate.php
trunk/sources/smarty/plugins/modifier.upper.php
trunk/sources/smarty/plugins/modifier.wordwrap.php
trunk/sources/smarty/plugins/outputfilter.trimwhitespace.php
trunk/sources/smarty/plugins/shared.escape_special_chars.php
trunk/sources/smarty/plugins/shared.make_timestamp.php
trunk/template/
trunk/template/Default/
trunk/template/Default/cache/
trunk/template/Default/cache/index.html
trunk/template/Default/compile/
trunk/template/Default/compile/index.html
trunk/template/Default/config/
trunk/template/Default/config/index.html
trunk/template/Default/index.html
trunk/template/Default/module_index.html
trunk/template/index.html
Added: trunk/index.php
===================================================================
--- trunk/index.php (rev 0)
+++ trunk/index.php 2006-12-20 13:07:28 UTC (rev 90)
@@ -0,0 +1,149 @@
+<?php
+/**
+ * ShuttleBB Core
+ *
+ * $Id: index.php 82 2006-12-05 16:19:23Z afterlife69 $
+ * $Date: 2006-12-06 03:19:23 +1100 (Wed, 06 Dec 2006) $
+ * $Rev: 82 $
+ */
+
+$sbb_start_var = microtime(true);
+
+/**
+ * Define self
+ */
+define('IN_SBB', true);
+
+/**
+ * Define full paths for security
+ */
+define('PHPEX', '.php');
+define('ROOT_PATH', dirname(__FILE__) . '/');
+define('INC_PATH', ROOT_PATH . 'sources/');
+define('REQ_PATH', ROOT_PATH . 'require/');
+define('LANG_PATH', ROOT_PATH . 'language/');
+define('TPL_PATH', ROOT_PATH . 'template/');
+define('MOD_PATH', ROOT_PATH . 'module/');
+define('PLUG_PATH', ROOT_PATH . 'plugins/');
+
+/**
+ * Start output buffering
+ */
+ob_start();
+
+/**
+ * Require some static files
+ */
+require (REQ_PATH . 'configuration' . PHPEX);
+require (REQ_PATH . 'constants' . PHPEX);
+require (REQ_PATH . 'extensions' . PHPEX);
+
+/**
+ * Look for a valid installation
+ */
+if ( ! defined ('SBB_INSTALLED') )
+{
+ // If config not found, start installer
+ require (ROOT_PATH . 'install/index' . PHPEX);
+ exit;
+}
+
+/**
+ * Require functions
+ */
+require (INC_PATH . 'functions_general' . PHPEX);
+require (INC_PATH . 'functions_handlers' . PHPEX);
+
+/**
+ * Require smarty templating system
+ */
+require (INC_PATH . 'smarty/Smarty.class' . PHPEX);
+
+/**
+ * Include base sources
+ */
+handler_load('class_session', 'session');
+handler_load('class_user', 'user');
+/* Smarty is on trial atm.
+handler_load('class_template', 'template'); */
+handler_load('class_dbal', 'dbal');
+handler_load('class_module_loader', 'module_loader');
+handler_load('class_access_control', 'acl_core');
+handler_load('class_language', 'language');
+
+/**
+ * Construct the database abstraction layer
+ */
+$db = new dbal(DB_LAYER);
+$db->sql_connect(DB_USER, DB_PASS, DB_NAME, DB_SERVER, DB_PERSISTANT);
+
+/**
+ * Construct some important objects
+ */
+$session = new session();
+$user = new user($session);
+$auth = new acl_core();
+/* Removed for smarty
+$template = new template(TPL_PATH . $user->_get_current_template() . '/'); */
+$language = new language($user->data['user_lang']);
+$module = new module_loader(MOD_PATH);
+
+/**
+ * Build the smarty object
+ *
+ * @link http://smarty.php.net
+ */
+$template = new Smarty; // Construct the smarty template object
+$template->plugin_dir = (INC_PATH . 'smarty/plugins/'); // Set the plugins directory
+$template->template_dir = (TPL_PATH . $user->_get_current_template() . '/'); // Set the template directory
+$template->cache_dir = ($template->template_dir . 'cache/'); // Set the caching directory
+$template->compile_dir = ($template->template_dir . 'compile/'); // Set the template compilation directory
+$template->config_dir = ($template->template_dir . 'config/'); // Set the configuration directory
+$template->debugging = false; // Turn debugging console off
+$template->compile_check = true; // Turn the compile check on
+$template->caching = true; // Turn overall caching on
+$template->force_compile = false; // Never force compiling
+
+/**
+ * Assign some important information to smarty
+ */
+$template->assign('user', $user->data);
+$template->assign('session', $session->data);
+$template->assign('constants', array(
+ 'guest_id' => UNREGISTERED,
+ 'root_path' => ROOT_PATH,
+ 'inc_path' => INC_PATH,
+ 'tpl_path' => $template->template_dir,
+ 'req_path' => REQ_PATH,
+ 'lang_path' => LANG_PATH . $user->data['user_lang'] . '/',
+ 'mod_path' => MOD_PATH,
+ 'plug_path' => PLUG_PATH)
+);
+
+/**
+ * Load the active module
+ */
+$this_module = ( isset ( $_GET['module'] ) ) ? $_GET['module'] : false;
+$module->load_module($this_module);
+
+/**
+ * Unload the modules, close the db connection
+ */
+$module->deconstruct();
+$db->sql_close();
+
+/**
+ * Stop output buffering and output
+ */
+$output = ob_get_contents();
+ob_end_clean();
+echo $output;
+
+echo 'Generation time: ' . ($sbb_start_var - time());
+
+/**
+ * Bye!
+ */
+exit;
+
+?>
\ No newline at end of file
Added: trunk/install/index.php
===================================================================
--- trunk/install/index.php (rev 0)
+++ trunk/install/index.php 2006-12-20 13:07:28 UTC (rev 90)
@@ -0,0 +1,25 @@
+<?php
+/**
+ * ShuttleBB Installer
+ *
+ * $Id: index.php 77 2006-12-05 07:55:32Z afterlife69 $
+ * $Rev: 77 $
+ * $Date: 2006-12-05 18:55:32 +1100 (Tue, 05 Dec 2006) $
+ */
+
+if ( ! defined ( 'IN_SBB' ) )
+{
+ return;
+}
+
+if ( defined ( 'SBB_INSTALLED' ) )
+{
+ return;
+}
+
+// Get installer functions
+require (ROOT_PATH . 'install/sources/functions_install' . PHPEX);
+
+echo 'Placeholder';
+
+?>
\ No newline at end of file
Added: trunk/install/sources/functions_install.php
===================================================================
--- trunk/install/sources/functions_install.php (rev 0)
+++ trunk/install/sources/functions_install.php 2006-12-20 13:07:28 UTC (rev 90)
@@ -0,0 +1,22 @@
+<?php
+/**
+ * Required functions for installer
+ *
+ * $Id: functions_install.php 77 2006-12-05 07:55:32Z afterlife69 $
+ * $Rev: 77 $
+ * $Date: 2006-12-05 18:55:32 +1100 (Tue, 05 Dec 2006) $
+ */
+
+if ( ! defined ( 'IN_SBB' ) )
+{
+ return;
+}
+
+if ( defined ( 'SBB_INSTALLED' ) )
+{
+ return;
+}
+
+echo 'Placeholder';
+
+?>
\ No newline at end of file
Added: trunk/install/sources/index.html
===================================================================
Added: trunk/install/sql/index.html
===================================================================
Added: trunk/install/sql/mysql_data.sql
===================================================================
--- trunk/install/sql/mysql_data.sql (rev 0)
+++ trunk/install/sql/mysql_data.sql 2006-12-20 13:07:28 UTC (rev 90)
@@ -0,0 +1,2 @@
+INSERT INTO `sbb_users` (`user_id`, `username`, `password`, `user_email`, `user_active`, `user_code`, `user_msn`, `user_icq`, `user_yim`, `user_aim`, `user_sig`, `user_rank`, `user_web`, `user_ip`)
+ VALUES (-1, 'Guest', '37a6259cc0c1dae299a7866489dff0bd', 'webmaster@127.0.0.1', 0, '0', NULL, NULL, NULL, NULL, NULL, 0, NULL, '');
\ No newline at end of file
Added: trunk/install/sql/mysql_schema.sql
===================================================================
--- trunk/install/sql/mysql_schema.sql (rev 0)
+++ trunk/install/sql/mysql_schema.sql 2006-12-20 13:07:28 UTC (rev 90)
@@ -0,0 +1,39 @@
+CREATE TABLE `sbb_users` (
+ `user_id` int(255) NOT NULL auto_increment,
+ `username` varchar(255) NOT NULL,
+ `password` varchar(32) NOT NULL,
+ `user_email` text NOT NULL,
+ `user_active` tinyint(1) NOT NULL,
+ `user_code` varchar(12) NOT NULL,
+ `user_msn` varchar(255) default NULL,
+ `user_icq` int(255) default NULL,
+ `user_yim` varchar(255) default NULL,
+ `user_aim` varchar(255) default NULL,
+ `user_sig` text collate latin1_general_ci,
+ `user_rank` int(255) NOT NULL,
+ `user_web` varchar(255) default NULL,
+ `user_ip` varchar(255) NOT NULL,
+ PRIMARY KEY (`user_id`)
+);
+
+CREATE TABLE `sbb_config` (
+ `config_key` varchar(90) NOT NULL,
+ `config_value` text NOT NULL,
+ PRIMARY KEY (`config_key`)
+);
+
+CREATE TABLE `sbb_session_keys` (
+ `key_name` varchar(16) NOT NULL,
+ `key_expire` int(90) NOT NULL,
+ `user_id` int(255) NOT NULL,
+ PRIMARY KEY (`key_name`)
+);
+
+CREATE TABLE `sbb_sessions` (
+ `session_id` varchar(32) NOT NULL,
+ `session_ip` varchar(15) NOT NULL,
+ `session_agent` varchar(255) NOT NULL,
+ `session_time` int(20) NOT NULL,
+ `session_page` int(10) NOT NULL,
+ `user_id` int(255) NOT NULL
+);
\ No newline at end of file
Added: trunk/language/english/global.php
===================================================================
--- trunk/language/english/global.php (rev 0)
+++ trunk/language/english/global.php 2006-12-20 13:07:28 UTC (rev 90)
@@ -0,0 +1,21 @@
+<?php
+/**
+ * Base language entries
+ *
+ * This is the base for all modules language
+ *
+ * $Id: global.php 86 2006-12-10 09:24:27Z afterlife69 $
+ * $Rev: 86 $
+ * $Date: 2006-12-10 20:24:27 +1100 (Sun, 10 Dec 2006) $
+ */
+
+if ( ! define ( 'IN_SBB' ) )
+{
+ return;
+}
+
+$lang = array(
+ 'Board_Index' => 'Board Index'
+);
+
+?>
\ No newline at end of file
Added: trunk/language/english/lang_index.php
===================================================================
--- trunk/language/english/lang_index.php (rev 0)
+++ trunk/language/english/lang_index.php 2006-12-20 13:07:28 UTC (rev 90)
@@ -0,0 +1,19 @@
+<?php
+/**
+ * Language file for "index" module.
+ *
+ * $Id: lang_index.php 53 2006-12-02 04:52:12Z afterlife69 $
+ * $Rev: 53 $
+ * $Date: 2006-12-02 15:52:12 +1100 (Sat, 02 Dec 2006) $
+ */
+
+if ( ! define ( 'IN_SBB' ) )
+{
+ return;
+}
+
+$lang = array(
+ 'Lang_key' => 'Lang_value'
+);
+
+?>
\ No newline at end of file
Added: trunk/module/module_main.php
===================================================================
--- trunk/module/module_main.php (rev 0)
+++ trunk/module/module_main.php 2006-12-20 13:07:28 UTC (rev 90)
@@ -0,0 +1,106 @@
+<?php
+/**
+ * ShuttleBB "Hello World" Module.
+ *
+ * $Id: module_main.php 80 2006-12-05 12:18:29Z afterlife69 $
+ * $Date: 2006-12-05 23:18:29 +1100 (Tue, 05 Dec 2006) $
+ * $Rev: 80 $
+ */
+
+/**
+ * Standard security
+ *
+ * This prevents the module from being executed directly.
+ */
+if ( ! defined ( 'IN_SBB' ) )
+{
+ return;
+}
+
+/**
+ * C/C++ Programmers will pick up the module system very fast, it is based on filename
+ * and gos as followed: module_x.php becomes class:module_x and is constructed on init
+ * the constructor (function with the same name as the class) is called when the object
+ * is constructed (go figure).
+ *
+ * Just like C/C++, the default module is "main" or module_main, this is called when a
+ * module is not found, or there is no module defined. All module authors are expected
+ * to use the phpDoc syntax when packing their modules, and if they require external
+ * sources, the sources should be stored in a directory inside the modules folder with
+ * the same name as the module itself (ie, module_main would have the directory "main").
+ *
+ * When external sources are used, their package must be the same as the "subpackage"
+ * name used on the base module (in this case "main") and the subpackage would be their
+ * actual package name.
+ *
+ * @package shuttlebb
+ * @subpackage main
+ * @author Dean Newman <web...@au...>
+ */
+class module_main
+{
+ /**
+ *
+ */
+ function module_main()
+ {
+ // All pre-init sources
+ global $session;
+ global $user;
+ global $module;
+ global $language;
+ global $auth;
+ global $template;
+
+ $template->display('module_index.html');
+
+ // Start module proper
+ echo 'Hello World!';
+
+ // Init another class in this module
+ new module_main_required();
+
+ // Call a function
+ random_function();
+
+ return;
+ }
+}
+
+/**
+ * Is it possible to execute commands outside of the module class
+ * however this is not permitted by the module coding standards
+ * which are provided with the documents in the package you downloaded
+ */
+echo 'This is not permitted!';
+
+/**
+ * However, you may include other classes or functions in your module.
+ */
+class module_main_required
+{
+ function module_main_required()
+ {
+ echo 'This is permitted';
+ }
+}
+
+function random_function()
+{
+ echo 'Wow, A function!';
+}
+
+/**
+ * Also, constants can also be added to your module, however you must
+ * follow the coding standards to ensure the constant is uppercase with
+ * underscores to seperate words.
+ */
+define('MY_CONSTANT', 'value!');
+
+/**
+ * As a final note, these rules only apply if you are planning to release
+ * your module to the shuttlebb community.
+ */
+return;
+
+?>
\ No newline at end of file
Added: trunk/plugins/Hello_World.php
===================================================================
--- trunk/plugins/Hello_World.php (rev 0)
+++ trunk/plugins/Hello_World.php 2006-12-20 13:07:28 UTC (rev 90)
@@ -0,0 +1,36 @@
+<?php
+/**
+ * Basic "Hello World" Plugin that hooks the index.
+ *
+ * $Id: Hello_World.php 71 2006-12-04 03:53:33Z afterlife69 $
+ * $Rev: 71 $
+ * $Date: 2006-12-04 14:53:33 +1100 (Mon, 04 Dec 2006) $
+ */
+
+/**
+ * Standard security
+ *
+ * This prevents the plugin from being executed directly.
+ */
+if ( ! defined ( 'IN_SBB' ) )
+{
+ return;
+}
+
+/**
+ * This is a basic "Hello World" function that the hooks system will execute.
+ */
+function hello_world($date = 0)
+{
+ echo 'Hello World, The current date is ' . ($date) ? date('d-m-Y', $date) : date('d-m-Y') . '.';
+}
+
+/**
+ * The "register" method requires 2 parameters ($handle, $function) and everything after
+ * that is used as a parameter for the function call.
+ * For a full list of hooks, see {@link http://shuttlebb.com/coming_soon}
+ */
+hooks::register('index/login', 'hello_world'); // This hook does not call the parameter
+hooks::register('index/statistics', 'hello_world', time()); // This hook does call the parameter
+
+?>
\ No newline at end of file
Added: trunk/plugins/index.html
===================================================================
Added: trunk/require/configuration.php
===================================================================
--- trunk/require/configuration.php (rev 0)
+++ trunk/require/configuration.php 2006-12-20 13:07:28 UTC (rev 90)
@@ -0,0 +1,22 @@
+<?php
+/**
+ * ShuttleBB Configuration File
+ *
+ * Defines the constants and variables needed for the system to init.
+ *
+ * $Id: configuration.php 77 2006-12-05 07:55:32Z afterlife69 $
+ * $Date: 2006-12-05 18:55:32 +1100 (Tue, 05 Dec 2006) $
+ * $Rev: 77 $
+ */
+
+define('SBB_INSTALLED', 1);
+
+define('DB_USER', 'root');
+define('DB_PASS', '');
+define('DB_NAME', 'sbb');
+define('DB_SERVER', 'localhost');
+define('DB_LAYER', 'mysql');
+define('DB_PERSISTANT', 1);
+define('DB_PREFIX', 'sbb_');
+
+?>
\ No newline at end of file
Added: trunk/require/constants.php
===================================================================
--- trunk/require/constants.php (rev 0)
+++ trunk/require/constants.php 2006-12-20 13:07:28 UTC (rev 90)
@@ -0,0 +1,32 @@
+<?php
+/**
+ * ShuttleBB Constants File
+ *
+ * Defines the constants and variables needed for the system to init.
+ *
+ * $Id: constants.php 81 2006-12-05 16:05:08Z afterlife69 $
+ * $Date: 2006-12-06 03:05:08 +1100 (Wed, 06 Dec 2006) $
+ * $Rev: 81 $
+ */
+
+if ( ! defined ( 'IN_SBB' ) )
+{
+ return;
+}
+
+//
+// Table definitions
+//
+define('SESSIONS_TABLE', DB_PREFIX . 'sessions');
+define('SESSIONS_KEY_TABLE', DB_PREFIX . 'session_keys');
+define('USERS_TABLE', DB_PREFIX . 'users');
+define('CONFIG_TABLE', DB_PREFIX . 'config');
+define('BBCODE_TABLE', DB_PREFIX . 'bbcode');
+define('ACL_TABLE', DB_PREFIX . 'acl');
+
+/**
+ * This constant is used to identify "Guest" users.
+ */
+define('UNREGISTERED', '-1');
+
+?>
\ No newline at end of file
Added: trunk/require/extensions.php
===================================================================
--- trunk/require/extensions.php (rev 0)
+++ trunk/require/extensions.php 2006-12-20 13:07:28 UTC (rev 90)
@@ -0,0 +1,40 @@
+<?php
+/**
+ * This file is responcible for loading all required extensions
+ *
+ * @todo Test the file
+ *
+ * $Id: extensions.php 45 2006-11-04 10:24:04Z afterlife69 $
+ * $Date: 2006-11-04 21:24:04 +1100 (Sat, 04 Nov 2006) $
+ * $Rev: 45 $
+ */
+
+define('EXT_PREFIX', ( ( PHP_SHLIB_SUFFIX === 'dll' ) ? 'php_' : '') );
+define('EXT_POSTFIX', '.' . PHP_SHLIB_SUFFIX);
+define('EXT_PATH', ( ini_get('extension_dir') ) ? ini_get('extension_dir') : '' );
+
+$required_exts = array(
+ 'mysql',
+ 'xml'
+);
+
+// Loop through the required extensions
+while ( list ( , $extension ) = @each ( $required_exts ) )
+{
+ // Check if the extension is loaded
+ $extfile = (EXT_PATH . EXT_PREFIX . $extension . EXT_POSTFIX);
+ if ( ! extension_loaded ( $extension ) )
+ {
+ // Is the file binary and readable?
+ if ( is_executable($extfile) && is_readable($extfile) )
+ {
+ // Attempt to load the extension
+ if ( ! dl($extfile) )
+ {
+ trigger_error('Unable to load required extension, Please check system requirements.', ERROR_FATAL);
+ }
+ }
+ }
+}
+
+?>
\ No newline at end of file
Added: trunk/sources/cache/cache_directory.php
===================================================================
--- trunk/sources/cache/cache_directory.php (rev 0)
+++ trunk/sources/cache/cache_directory.php 2006-12-20 13:07:28 UTC (rev 90)
@@ -0,0 +1,10 @@
+<?php
+/**
+ * @todo Create cache::directory for caching directory contents (recursive)
+ *
+ * $Id: cache_directory.php 36 2006-10-29 04:23:43Z afterlife69 $
+ * $Date: 2006-10-29 15:23:43 +1100 (Sun, 29 Oct 2006) $
+ * $Rev: 36 $
+ */
+
+?>
\ No newline at end of file
Added: trunk/sources/cache/cache_sql.php
===================================================================
--- trunk/sources/cache/cache_sql.php (rev 0)
+++ trunk/sources/cache/cache_sql.php 2006-12-20 13:07:28 UTC (rev 90)
@@ -0,0 +1,10 @@
+<?php
+/**
+ * @todo Create cache::sql for caching database results
+ *
+ * $Id: cache_sql.php 36 2006-10-29 04:23:43Z afterlife69 $
+ * $Date: 2006-10-29 15:23:43 +1100 (Sun, 29 Oct 2006) $
+ * $Rev: 36 $
+ */
+
+?>
\ No newline at end of file
Added: trunk/sources/cache/cache_template.php
===================================================================
--- trunk/sources/cache/cache_template.php (rev 0)
+++ trunk/sources/cache/cache_template.php 2006-12-20 13:07:28 UTC (rev 90)
@@ -0,0 +1,10 @@
+<?php
+/**
+ * @todo Create cache::template for caching compiled templates
+ *
+ * $Id: cache_template.php 36 2006-10-29 04:23:43Z afterlife69 $
+ * $Date: 2006-10-29 15:23:43 +1100 (Sun, 29 Oct 2006) $
+ * $Rev: 36 $
+ */
+
+?>
\ No newline at end of file
Added: trunk/sources/cache/cache_xml.php
===================================================================
--- trunk/sources/cache/cache_xml.php (rev 0)
+++ trunk/sources/cache/cache_xml.php 2006-12-20 13:07:28 UTC (rev 90)
@@ -0,0 +1,10 @@
+<?php
+/**
+ * @todo Create cache::xml for caching parsed xml
+ *
+ * $Id: cache_xml.php 36 2006-10-29 04:23:43Z afterlife69 $
+ * $Date: 2006-10-29 15:23:43 +1100 (Sun, 29 Oct 2006) $
+ * $Rev: 36 $
+ */
+
+?>
\ No newline at end of file
Added: trunk/sources/cache/index.html
===================================================================
Added: trunk/sources/captcha/captcha_legacy.php
===================================================================
Added: trunk/sources/captcha/captcha_shape.php
===================================================================
Added: trunk/sources/captcha/index.html
===================================================================
Added: trunk/sources/class_access_control.php
===================================================================
--- trunk/sources/class_access_control.php (rev 0)
+++ trunk/sources/class_access_control.php 2006-12-20 13:07:28 UTC (rev 90)
@@ -0,0 +1,63 @@
+<?php
+/**
+ * $Id: class_access_control.php 60 2006-12-03 12:49:18Z afterlife69 $
+ * $Date: 2006-12-03 23:49:18 +1100 (Sun, 03 Dec 2006) $
+ * $Rev: 60 $
+ */
+
+define('ACL_USER', 1);
+define('ACL_GROUP', 2);
+
+define('ACL_ALL', 0);
+define('ACL_ACTION', 1);
+define('ACL_ACCESS', 2);
+
+class acl_core
+{
+ function acl_core()
+ {
+
+ }
+
+ function append($permission, $row_id, $row_type = ACL_USER)
+ {
+ switch ( $row_type )
+ {
+ default:
+ case ACL_USER:
+
+ break;
+ case ACL_GROUP:
+
+ break;
+ }
+ }
+
+ function remove($permission, $row_id, $row_type = ACL_USER)
+ {
+ switch ( $row_type )
+ {
+ default:
+ case ACL_USER:
+
+ break;
+ case ACL_GROUP:
+
+ break;
+ }
+ }
+
+ function query($row_id, $row_type = ACL_USER, $acl_type = ACL_ALL)
+ {
+ $sql = "SELECT {$acl_fields} FROM " . TABLE_ACL . "
+ WHERE acl_handle_type = '{$row_type}' AND acl_handle = '{$row_id}'
+ GROUP BY acl_name, acl_type LIMIT 1";
+ $db->sql_query($sql);
+ $return = $db->sql_fetchrow();
+ $db->sql_freeresult();
+
+ return $return;
+ }
+}
+
+?>
\ No newline at end of file
Added: trunk/sources/class_bbcode.php
===================================================================
--- trunk/sources/class_bbcode.php (rev 0)
+++ trunk/sources/class_bbcode.php 2006-12-20 13:07:28 UTC (rev 90)
@@ -0,0 +1,78 @@
+<?php
+/**
+ * $Id: class_bbcode.php 73 2006-12-04 07:38:33Z afterlife69 $
+ * $Date: 2006-12-04 18:38:33 +1100 (Mon, 04 Dec 2006) $
+ * $Rev: 73 $
+ */
+
+/**
+ * BBCode Management Class
+ *
+ * @author Dean Newman <web...@au...>
+ */
+class bbcode
+{
+ /**
+ * Constructor, useless?
+ *
+ * @return bbcode
+ */
+ function bbcode()
+ {
+ }
+
+ /**
+ * Insert new bbcode into database
+ *
+ * @param string $tag The name of the bbcode tag
+ * @param string $regex The regular expression used to validate the bbcode
+ * @param string $replacement The replacement text for the bbcode
+ * @param string $description The tooltip that will appear on hover
+ */
+ function insert($tag, $regex, $replacement, $description = '')
+ {
+ }
+
+ /**
+ * Remove the bbcode by tag or id from the database
+ *
+ * @param string|int $tag The tag or row ID
+ * @param string $type The type of id used to remove the bbcode
+ */
+ function remove($tag, $type = 'tag')
+ {
+ }
+
+ /**
+ * Perform a bbcode transformation
+ *
+ * @param string $text The text to transform
+ */
+ function transform($text)
+ {
+ $tags = $this->select();
+
+ $find = $replace = array();
+ for ( $i = 0; $i < count($tags); $i++ )
+ {
+ $find[] = $tags[$i]['bbcode_regex'];
+ $replace[] = $tags[$i]['bbcode_replace'];
+ }
+
+ return preg_replace ( $find, $replace, $text );;
+ }
+
+ /**
+ * Select the bbcode data from the database
+ *
+ * @return array
+ */
+ function select()
+ {
+ $sql = 'SELECT bbcode_tag, bbcode_regex, bbcode_replace FROM ' . BBCODE_TABLE . ' WHERE bbcode_active = 1';
+ $result = $db->sql_query($sql);
+ return $db->sql_fetchrowset($result, 'assoc');
+ }
+}
+
+?>
\ No newline at end of file
Added: trunk/sources/class_cache.php
===================================================================
--- trunk/sources/class_cache.php (rev 0)
+++ trunk/sources/class_cache.php 2006-12-20 13:07:28 UTC (rev 90)
@@ -0,0 +1,169 @@
+<?php
+/**
+ * Cache Handler
+ *
+ * This handler is responcible for caching of all kinds, it will
+ * generate files, check expiration dates, remove expired files
+ * and load cached data into other classes throughout the software.
+ *
+ * $Id: class_cache.php 58 2006-12-03 12:30:18Z afterlife69 $
+ * $Date: 2006-12-03 23:30:18 +1100 (Sun, 03 Dec 2006) $
+ * $Rev: 58 $
+ */
+
+if ( class_exists ( 'cache_handler' ) )
+{
+ return;
+}
+
+/**
+ * Cache Handler
+ *
+ * @package ShuttleBB
+ * @subpackage cache_handler
+ * @copyright Copyright 2006, ShuttleBB Development Team
+ * @author ShuttleBB Development Team <dev...@sh...>
+ * @author Dean Newman <web...@au...>
+ */
+class cache_handler
+{
+// var $xml;
+ var $sql;
+ var $tpl;
+ var $dir;
+ var $stats;
+
+ function cache_handler()
+ {
+ // Include sources
+ // include(INC_PATH . 'cache/cache_xml' . PHPEX);
+ include(INC_PATH . 'cache/cache_sql' . PHPEX);
+ include(INC_PATH . 'cache/cache_tpl' . PHPEX);
+ include(INC_PATH . 'cache/cache_dir' . PHPEX);
+
+ // Init objects
+ // $this->xml = new cache_xml();
+ $this->sql = new cache_sql();
+ $this->tpl = new cache_tpl();
+ $this->dir = new cache_dir();
+
+ // Expire invalid cache
+ $this->expire();
+ }
+
+ function expire()
+ {
+ $cached = $this->_log_get();
+ $sizeof_cached = sizeof($cached);
+ if ( ! is_array ( $cached ) )
+ {
+ return;
+ }
+
+ // Check validity
+ while ( list ( $key, $data ) = each ( $cached ) )
+ {
+ /**
+ * Structure of $data ...
+ *
+ * $data = array(
+ * 'ttl' => (int) time(),
+ * 'type' => (string) substr(__CLASS__, 5);
+ * 'stamp' => (int) time(),
+ * 'handle'=> (sting) $cachename,
+ * 'path' => (string) (INC_PATH . 'cache/cached/' . $cachename),
+ * 'hash' => (string) md5_file(INC_PATH . 'cache/cached/' . $cachename)
+ * );
+ */
+
+ // Handle different types differently
+ switch ( $data['type'] )
+ {
+ default:
+ trigger_error('Cache_unknown_type');
+ break;
+ case 'sql':
+ if ( time() > $data['ttl'] )
+ {
+ $this->$data['type']->expire($data['handle']);
+ unset($cached[$key]);
+ }
+ break;
+ case 'tpl':
+ case 'dir':
+ // case 'xml':
+ $lastmod = @mtime(INC_PATH . 'cache/cached/' . $data['path']);
+
+ if ( ! $data['ttl'] || ! $lastmod )
+ {
+ if ( $lastmod > $data['stamp'] )
+ {
+ $this->$data['type']->expire($data['handle']);
+ unset($cached[$key]);
+ }
+ }
+ else
+ {
+ if ( time() > $data['ttl'] )
+ {
+ $this->$data['type']->expire($data['handle']);
+ unset($cached[$key]);
+ }
+ }
+
+ break;
+ }
+ }
+
+ if ( $sizeof_cached <> sizeof($cached) )
+ {
+ $this->_log_update($cached);
+ }
+
+ return;
+ }
+
+ function validate()
+ {
+
+ }
+
+ function _log_get()
+ {
+ // Check the log file exists
+ if ( ! file_exists ( INC_PATH . 'cache/cached.log' ) )
+ {
+ // If not, create
+ @touch(INC_PATH . 'cache/cached.log');
+ @chmod(INC_PATH . 'cache/cached.log', 0777);
+ }
+
+ // Get the data
+ $serialized = @file_get_contents(INC_PATH . 'cache/cached.log');
+ if ( ! $serialized )
+ {
+ return;
+ }
+
+ // Convert data
+ $cached = unserialize($serialized);
+ if ( ! is_array ( $cache ) )
+ {
+ return;
+ }
+
+ return $cached;
+ }
+
+ function _log_update($cached)
+ {
+ // Write to the
+ $file = new file_handler(INC_PATH . 'cache/cached.log', 'w');
+ $file->write(serialize($cached));
+ $file->close();
+
+ return;
+ }
+}
+
+?>
\ No newline at end of file
Added: trunk/sources/class_captcha.php
===================================================================
--- trunk/sources/class_captcha.php (rev 0)
+++ trunk/sources/class_captcha.php 2006-12-20 13:07:28 UTC (rev 90)
@@ -0,0 +1,496 @@
+<?php
+/**
+ * Captcha abstraction layer
+ *
+ * This handler is responcible for caching of all kinds, it will
+ * generate files, check expiration dates, remove expired files
+ * and load cached data into other classes throughout the software.
+ *
+ * $Id: class_captcha.php 85 2006-12-06 05:34:36Z afterlife69 $
+ * $Date: 2006-12-06 16:34:36 +1100 (Wed, 06 Dec 2006) $
+ * $Rev: 85 $
+ */
+
+/**
+ * Constants
+ */
+define ( CAPTCHA_TABLE, $table_prefix . 'captcha' );
+
+/*
+CREATE TABLE `sbb_captcha` (
+ `captcha_id` INT( 1 ) NOT NULL AUTO_INCREMENT PRIMARY KEY ,
+ `captcha_string` TEXT NOT NULL ,
+ `user_id` TEXT NOT NULL
+);
+*/
+
+
+/**
+ * CAPTCHA Class.
+ * Allows advanced CAPTCHA creation using simple wrapper functions.
+ *
+ * @todo This class should be an abstract master layer (abstract = parent only)
+ *
+ * @author Tyler King <ai...@ya...>
+ * @author Dean Newman <web...@au...>
+ */
+class captcha
+{
+ /**
+ * Contains the directory path to the TFF fonts.
+ *
+ * @var string
+ */
+ var $font_path;
+
+ /**
+ * Contains the directory path to the image backgrounds.
+ *
+ * @var string
+ */
+ var $background_path;
+
+ /**
+ * Contains the CAPTCHA configuration.
+ *
+ * @var string
+ */
+ var $data;
+
+ /**
+ * Contains randomly assigned colors.
+ *
+ * @var string
+ */
+ var $rgb;
+
+ /**
+ * Initilizes the class.
+ */
+ function captcha ( )
+ {
+ // Set up the in-class variables.
+ $this->font_path = './ttf/';
+ $this->background_path = './backgrounds/';
+ $this->data = array ( );
+ $this->rgb = $this->gen_rand_color ( );
+ }
+
+ /**
+ * Generates random RGB colors.
+ *
+ * @param integer $start
+ * @param integer $end
+ * @return array
+ */
+ function gen_rand_color ( $start = 0, $end = 255 )
+ {
+ return array ( rand ( $start, $end ), rand ( $start, $end ), rand ( $start, $end ) );
+ }
+
+ /**
+ * Converts hex values to RGB values.
+ *
+ * @param string $color
+ * @return array
+ */
+ function hex_rgb ( $color )
+ {
+ // Remove the hex identifier.
+ $color = str_replace ( '#', '', $color );
+ for ( $i = 0; $i < 3; $i++ )
+ {
+ // Convert to RGB decimal values.
+ $rgb[ ] = hexdec ( substr ( $color, ( 2 * $i ), 2 ) );
+ }
+
+ return $rgb;
+ }
+
+ /**
+ * Walk a directory to return it's files.
+ *
+ * @param string $dir_path
+ * @return array
+ */
+ function walk_dir ( $dir_path )
+ {
+ // Open the directory. Set up the file array.
+ $dh = @opendir ( $dir_path );
+ $files = array ( );
+
+ while ( $file = @readdir ( $dh ) )
+ {
+ // A hidden file ?
+ if ( $file == '.' || $file == '..' || $file{0} == '.' )
+ {
+ // Yes, it is hidden. Skip it.
+ continue;
+ }
+ else
+ {
+ // No, it is not hidden. Append it.
+ $files[ ] = $file;
+ }
+ }
+ @closedir ( $dh );
+
+ return $files;
+ }
+
+ /**
+ * Resizes a background image to the CAPTCHA dimensions.
+ *
+ * @param string $image
+ * @return object
+ */
+ function resize_image ( $image )
+ {
+ // Get the background's height and width.
+ $image_data = getimagesize ( $image );
+
+ // Resize it.
+ $im = imagecreatetruecolor( $this->data[ 'width' ], $this->data[ 'height' ] );
+ $image = imagecreatefrompng ( $image );
+ imagecopyresampled ( $im, $image, 0, 0, 0, 0, $this->data[ 'width' ], $this->data[ 'width' ], $image_data[ 0 ], $image_data[ 1 ] );
+
+ return $im;
+ }
+
+ /**
+ * Check if a CAPTCHA code entered by a user is correct.
+ *
+ * @param string $code
+ * @return boolean
+ */
+ function confirm ( $code )
+ {
+ global $db;
+ global $userdata;
+
+ // Get the CAPTCHAs.
+ $sql = 'SELECT * FROM ' . CAPTCHA_TABLE;
+ $result = $db->sql_query ( $sql );
+ $row = $db->sql_fetchrow ( $result );
+
+ // Does the string entered by user match the database ?
+ if ( strtolower ( $row[ 'captcha_string' ] ) == strtolower ( $code ) )
+ {
+ // Yes. Delete it. Return true for correct.
+ $sql = 'DELETE FROM ' . CAPTCHA_TABLE . ' WHERE user_id = ' . $userdata[ 'user_id' ];
+ $db->sql_query ( $sql );
+
+ return true;
+ }
+ else
+ {
+ // No. Delete it. Return false for incorrect.
+ $sql = 'DELETE FROM ' . CAPTCHA_TABLE . ' WHERE user_id = ' . $userdata[ 'user_id' ];
+ $db->sql_query ( $sql );
+
+ return false;
+ }
+ }
+
+ /**
+ * (Wrapper) Set the size for the CAPTCHA.
+ *
+ * @param integer $height
+ * @param integer $width
+ */
+ function size ( $height, $width )
+ {
+ $this->data[ 'width' ] = $width;
+ $this->data[ 'height' ] = $height;
+ }
+
+ /**
+ * (Wrapper) Set the color for strings and backgrounds of the CAPTCHA.
+ *
+ * @param string $color
+ */
+ function color ( $color = '' )
+ {
+ // Is it a hex value ?
+ if ( strstr ( $color, '#' ) )
+ {
+ // Yes. Convert it to RGB.
+ $this->data[ 'color' ] = $this->hex_rgb ( $background );
+ }
+ else
+ {
+ // No. Randomize a color.
+ $this->data[ 'color' ] = $this->gen_rand_color ( 200, 255 );
+ }
+ }
+
+ /**
+ * (Wrapper) Set the CAPTCHA code length.
+ *
+ * @param integer $length
+ */
+ function string_length ( $length )
+ {
+ $this->data[ 'string.length' ] = $length;
+ }
+
+ /**
+ * (Wrapper) Set the background image for the CAPTCHA.
+ *
+ * @param boolean/string $background
+ */
+ function background ( $background = true )
+ {
+ // True = random background image. String = background image.
+ $this->data[ 'background' ] = $background;
+ }
+
+ /**
+ * (Wrapper) Set lines for the CAPTCHA.
+ *
+ * @param integer $lines
+ * @param string $layer
+ */
+ function lines ( $lines = 0, $layer = 'background' )
+ {
+ $this->data[ 'lines.layer' ] = $layer;
+ $this->data[ 'lines' ] = ( $lines > 0 ) ? $lines : rand ( 4, 5 );
+ }
+
+ /**
+ * (Wrapper) Set noise for the CAPTCHA.
+ *
+ * @param integer $amount
+ * @param string $layer
+ */
+ function noise ( $amount = '', $layer = 'background' )
+ {
+ $this->data[ 'noise.layer' ] = $layer;
+ $this->data[ 'noise' ] = ( $amount > 0 ) ? $amount : rand ( 4, 5 );
+ }
+
+ /**
+ * (Wrapper) Set ellipses for the CAPTCHA.
+ *
+ * @param integer $amount
+ * @param string $layer
+ */
+ function ellipse ( $amount = '', $layer = 'background' )
+ {
+ $this->data[ 'ellipse.layer' ] = $layer;
+ $this->data[ 'ellipse' ] = ( $amount > 0 ) ? $amount : rand ( 4, 5 );
+ }
+
+ /**
+ * (Wrapper) Set filters for the CAPTCHA
+ *
+ * @param integer $amount
+ * @param string $filter
+ */
+ function filter ( $amount = '', $filter = 'random' )
+ {
+ if ( strtolower ( $filter ) == 'blur' )
+ {
+ $type = IMG_FILTER_GAUSSIAN_BLUR;
+ }
+ else if ( strtolower ( $filter ) == 'contrast' )
+ {
+ $type = IMG_FILTER_CONTRAST;
+ }
+ else if ( strtolower ( $filter ) == 'colorize' )
+ {
+ $type = IMG_FILTER_COLORIZE;
+ }
+ else if ( strtolower ( $filter ) == 'emboss' )
+ {
+ $type = IMG_FILTER_EMBOSS;
+ }
+ else if ( strtolower ( $filter ) == 'highlight' )
+ {
+ $type = IMG_FILTER_EDGEDETECT;
+ }
+ else if ( strtolower ( $filter ) == 'sketch' )
+ {
+ $type = IMG_FILTER_MEAN_REMOVAL;
+ }
+ else if ( strtolower ( $filter ) == 'smooth' )
+ {
+ $type = IMG_FILTER_SMOOTH;
+ }
+ else
+ {
+ // Nothing set, randomize.
+ $type = rand ( ) & count ( array ( IMG_FILTER_GAUSSIAN_BLUR, IMG_FILTER_CONTRAST, IMG_FILTER_COLORIZE, IMG_FILTER_EMBOSS, IMG_FILTER_EDGEDETECT, IMG_FILTER_MEAN_REMOVAL, IMG_FILTER_SMOOTH0 ) );
+ }
+
+ $this->data[ 'filter' ] = $type;
+ $this->data[ 'filter.amount' ] = $amount;
+ }
+
+ /**
+ * Render the CAPTCHA image with all the configurations set.
+ *
+ * @return object.
+ */
+ function render ( )
+ {
+ global $db;
+ global $userdata;
+
+ // Walk the directories to return the files.
+ $walked = $this->walk_dir ( $this->font_path );
+ $backgrounds = $this->walk_dir ( $this->background_path );
+
+ if ( !empty ( $this->data[ 'background' ] ) )
+ {
+ // Background set. Resize the background.
+ $captcha = $this->resize_image ( $this->background_path . $backgrounds[ rand ( ) % count ( $backgrounds ) ] );
+ }
+ else
+ {
+ // No background set.
+ $captcha = imagecreate ( $this->data[ 'width' ], $this->data[ 'height' ] );
+ }
+
+ if ( !empty ( $this->data[ 'string.length' ] ) )
+ {
+ // Length set.
+ $string_length = strlen ( $this->data[ 'string.length' ] );
+ }
+ else
+ {
+ // No length set, randomize.
+ $string_length = rand ( 4, 5 );
+ }
+
+ for ( $i = 0; $i < $string_length; $i++ )
+ {
+ // Convert the integers into characters.
+ $string .= chr ( rand ( 65, 90 ) );
+ }
+
+ if ( !empty ( $this->data[ 'color' ] ) )
+ {
+ // Color set (already converted into RGB).
+ $colors = $this->data[ 'color' ];
+ }
+ else
+ {
+ // No color set, randomize.
+ $colors = $this->gen_rand_color ( 200, 255 );
+ }
+
+ $back_color = imagecolorallocate ( $captcha, $colors[ 0 ], $colors[ 1 ], $colors[ 2 ] );
+ if ( !empty ( $this->data[ 'lines.layer' ] ) && $this->data[ 'lines.layer' ] == 'background' )
+ {
+ for ( $i = 0; $i < $this->data[ 'lines' ]; $i++ )
+ {
+ // All the X, Y and length of things.
+ $rx1 = rand ( 0, $this->data[ 'width' ] );
+ $rx2 = rand ( 0, $this->data[ 'width' ] );
+ $ry1 = rand ( 0, $this->data[ 'height' ] );
+ $ry2 = rand ( 0, $this->data[ 'height' ] );
+ $rcVal = rand ( 0, 255 );
+
+ $rc1 = imagecolorallocate ( $captcha, rand ( 0, 255 ), rand ( 0, 255 ), rand ( 100, 255 ) );
+ imageline ( $captcha, $rx1, $ry1, $rx2, $ry2, $rc1 );
+ }
+ }
+
+ if ( !empty ( $this->data[ 'noise.layer' ] ) && $this->data[ 'noise.layer' ] == 'background' )
+ {
+ for ( $i = 0; $i< $this->data[ 'noise' ]; $i++ )
+ {
+ // Set where the pixel is and it's color.
+ imagesetpixel ( $captcha, rand ( 0, $this->data[ 'width' ] ), rand ( 0, $this->data[ 'height' ] ), rand ( 0, 255 ) );
+ }
+ }
+
+ if ( !empty ( $this->data[ 'ellipse.layer' ] ) && $this->data[ 'ellipse.layer' ] == 'background' )
+ {
+ for ( $i = 1; $i < $this->data[ 'ellipse' ]; $i++ )
+ {
+ // Set where the ellipse is and it's color. (Random colors).
+ imageellipse ( $captcha, rand ( 1, 200 ), rand ( 1, 50 ), rand ( 50, 100 ), rand ( 12, 25 ), $colors[ rand ( 0, 24 ) ] );
+ }
+
+ for ( $i = 1; $i < $this->data[ 'ellipse' ]; $i++ )
+ {
+ // Set where the ellipse is and it's color. (Set colors).
+ imageellipse ( $captcha, rand ( 1, 200 ), rand ( 1, 50 ), rand ( 50, 100 ), rand ( 12, 25 ), $back_color );
+ }
+ }
+
+ for ( $i = 0; $i < 25; $i++ )
+ {
+ // Get some random colors to use.
+ $rgb = $this->gen_rand_color ( rand ( 0, 125 ), rand ( 125, 255 ) );
+ $colors[ ] = imagecolorallocate ( $captcha, $rgb[ 0 ], $rgb[ 1 ], $rgb[ 2 ] );
+ }
+
+ for ( $i = 1; $i <= $string_length; $i++ )
+ {
+ $c_c = ( rand ( 1, 2 ) == 1 ) ? rand ( 0, 45 ) : rand ( 315, 360 );
+
+ // Add in a character with color and a random font.
+ imagettftext ( $captcha, rand ( 14, 20 ), $c_c, ( $i * 25 ), 30, $colors[ rand ( 0, 24 ) ], $this->font_path . $walked[ rand ( ) % count ( $walked ) ], substr ( $string, ( $i - 1 ), 1 ) );
+ }
+
+ if ( !empty ( $this->data[ 'ellipse.layer' ] ) && $this->data[ 'ellipse.layer' ] == 'foreground' )
+ {
+ for ( $i = 1; $i < $this->data[ 'ellipse' ]; $i++ )
+ {
+ // Set where the ellipse is and it's color. (Random colors).
+ imageellipse ( $captcha, rand ( 1, 200 ), rand ( 1, 50 ), rand ( 50, 100 ), rand ( 12, 25 ), $colors[ rand ( 0, 24 ) ] );
+ }
+
+ for ( $i = 1; $i < $this->data[ 'ellipse' ]; $i++ )
+ {
+ // Set where the ellipse is and it's color. (Set colors).
+ imageellipse ( $captcha, rand ( 1, 200 ), rand ( 1, 50 ), rand ( 50, 100 ), rand ( 12, 25 ), $backcolor );
+ }
+ }
+
+ if ( !empty ( $this->data[ 'noise.layer' ] ) && $this->data[ 'noise.layer' ] == 'foreground' )
+ {
+ for ( $i = 0; $i < $this->data[ 'noise' ]; $i++ )
+ {
+ // Set where the pixel is and it's color.
+ imagesetpixel ( $captcha, rand ( 0, $this->data[ 'width' ] ), rand ( 0, $this->data[ 'height' ] ), rand ( 0, 255 ) );
+ }
+ }
+
+ if ( !empty ( $this->data[ 'lines.layer' ] ) && $this->data[ 'lines.layer' ] == 'foreground' )
+ {
+ for ( $i = 0; $i < $this->data[ 'lines' ]; $i++ )
+ {
+ // All the X, Y and length of things.
+ $rx1 = rand ( 0, $this->data[ 'width' ] );
+ $rx2 = rand ( 0, $this->data[ 'width' ] );
+ $ry1 = rand ( 0, $this->data[ 'height' ] );
+ $ry2 = rand ( 0, $this->data[ 'height' ] );
+ $rcVal = rand ( 0, 255 );
+
+ $rc1 = imagecolorallocate ( $captcha, rand ( 0, 255 ), rand ( 0, 255 ), rand ( 100, 255 ) );
+ imageline ( $captcha, $rx1, $ry1, $rx2, $ry2, $rc1 );
+ }
+ }
+
+ if ( !empty ( $this->data[ 'filter' ] ) && phpversion ( ) >= 5 )
+ {
+ // Assign the filter if the PHP version is not less then 5.
+ imagefilter ( $captcha, $type, ( !empty ( $this->data[ 'filter.amount' ] ) ) ? $this->data[ 'filter.amount' ] : 50 );
+ }
+
+ // Insert it into the database for later.
+ $sql = 'INSERT INTO ' . CAPTCHA_TABLE . ' (captcha_id, captcha_string, user_id) VALUES ("NULL", "' . $string . '", "' . $userdata[ 'user_id' ] . '")';
+ $db->sql_query ( $sql );
+
+ // Output it.
+ header ( 'Content-Type: image/png' );
+ imagepng ( $captcha );
+ imagedestroy ( $captcha );
+ }
+}
+
+?>
Added: trunk/sources/class_dbal.php
===================================================================
--- trunk/sources/class_dbal.php (rev 0)
+++ trunk/sources/class_dbal.php 2006-12-20 13:07:28 UTC (rev 90)
@@ -0,0 +1,547 @@
+<?php
+/**
+ * ShuttleBB DBAL -
+ *
+ * This database abstaction layer was written, benchmarked, and tested by Dean Newman;
+ * it is designed and optimized for maximum performance and security.
+ *
+ * The purpose of this package is to provide support to many different databases without
+ * the need of seperate releases and/or increased lines of code.
+ *
+ * This package depends on a couple of vital includes from the shuttlebb core including
+ * but not limited to: Caching, Constants, Configuration and The Error Handler.
+ *
+ * You are permitted to use this system in your own projects for personal use only,
+ * however the ShuttleBB Development Team will not be responcible for support, security
+ * or any other issues that may occur.
+ *
+ * The main interface class also contains a number of small methods to make sql queries
+ * and database interface much easier and cleaner; these include field management, simple
+ * updating, simple inserts and many other useful methods and functions.
+ *
+ * $Id: class_dbal.php 66 2006-12-03 13:45:51Z afterlife69 $
+ * $Date: 2006-12-04 00:45:51 +1100 (Mon, 04 Dec 2006) $
+ * $Rev: 66 $
+ */
+
+/**
+ * @todo Caching Object(s) <<<
+ *
+ * The new caching object should include seperate subclasses for different handling of caching,
+ * the main object will be just a shell.
+ *
+ * The following are used in this API:
+ * - cache::cache_sql::store($cache_name);
+ * - cache::cache_sql::load($cache_name);
+ *
+ * >>>
+ */
+
+/**
+ * Prevent include errors
+ */
+if ( class_exists ( 'dbal' ) )
+{
+ return;
+}
+
+/**
+ * Secure the class
+ */
+if ( ! defined ( 'IN_SBB' ) )
+{
+ trigger_error('Error_Security_Include');
+ exit;
+}
+
+/**
+ * Database Abstraction Layer
+ *
+ * This wrapper handles all the caching and debugging jobs,
+ * while interfacing with a specific database layer.
+ *
+ * @package shuttlebb
+ * @subpackage dbal
+ * @author Dean Newman
+ * @copyright © 2006, ShuttleBB Development Team
+ * @access Public
+ */
+class dbal
+{
+ var $layer;
+ var $error;
+ var $cache;
+ var $stats;
+
+ /**
+ * Constructor
+ *
+ * @param string $db_type The name of the db layer to use
+ * @return dbal
+ */
+ function dbal ( $db_type = DB_LAYER )
+ {
+ // Typecast the DB layer for error prevention
+ $db_type = (string) $db_type;
+ $db_layer = (string) 'dbal_' . $db_type;
+
+ // Ensure the file exists
+ if ( ! file_exists ( INC_PATH . 'dbal/' . $db_layer . PHPEX ) )
+ {
+ // If not, die
+ trigger_error('Error_DB_Include');
+ exit;
+ }
+
+ // Include layer and ensure file is secure
+ include ( INC_PATH . 'dbal/' . $db_layer . PHPEX );
+ if ( ! class_exists ( $db_layer ) )
+ {
+ // If not, die
+ trigger_error('Error_DB_Include,Error_DB_Security_Include');
+ exit;
+ }
+
+ // Init the object as a subclass
+ $this->layer = new $db_layer();
+
+ // Fill some values
+ $this->stats = array(
+ 'queries' => 0,
+ 'cached' => 0,
+ );
+ $this->cache = array();
+ $this->error = array();
+ }
+
+ /**
+ * Connects to the database server
+ *
+ * @param string $db_user Username for db server
+ * @param string $db_pass Password for db server
+ * @param string $db_name Name of the database
+ * @param string $db_server The db server to connect to
+ * @param boolean $db_persistant Use a persistant connection?
+ * @return boolean
+ */
+ function sql_connect($db_user, $db_pass, $db_name, $db_server, $db_persistant)
+ {
+ // Attempt to the connection
+ $connection = $this->layer->sql_connect($db_user, $db_pass, $db_name, $db_server, $db_persistant);
+
+ // Check if it connected
+ if ( ! $connection )
+ {
+ // If not, error.
+ trigger_error('Error_DB_Connect');
+ }
+
+ // Return connection identifier
+ return $connection;
+ }
+
+ /**
+ * Close the database connection
+ *
+ * @return boolean
+ */
+ function sql_close()
+ {
+ // Close the db connection
+ return $this->layer->sql_close();
+ }
+
+ /**
+ * Execute an sql query, Cache the result if needed, Load the result
+ * if available.
+ *
+ * @global object $cache Cache object included for sql caching
+ * @param string $sql The sql query to be executed
+ * @param string $cache_name The cache handle for this query
+ * @return mixed
+ */
+ function sql_query($sql, $cache_name = false)
+ {
+ global $cache;
+
+ // Increment the query counter.
+ $this->stats['queries']++;
+
+ // Check for caching
+ if ( $cache_name != false && class_exists ( 'cache_handler' ) )
+ {
+ // Allow the query to be cached without a handle
+ if ( gettype($cache_name) == 'boolean' )
+ {
+ // The handle becomes an md5 string of the sql
+ $cache_name = md5($sql);
+ }
+
+ // If not, execute and handle bad results.
+ if ( ! $result = $this->layer->sql_query($sql) )
+ {
+ // Report a query error.
+ trigger_error('Error_DB_Query');
+ }
+
+ // Attempt to load cache
+ if ( ! $this->cache[$cache_name] = $cache->sql->load($cache_name) )
+ {
+ // If load fails, free var
+ $this->sql_freeresult($result);
+ }
+
+ // Only execute if not already set
+ if ( ! isset ( $this->cache[$cache_name] ) )
+ {
+ // Handle caching if needed
+ $cache[$cache_name] = $this->sql_fetchrowset($result, 'assoc');
+ $cache->sql->store($cache_name, $cache[$cache_name]);
+
+ // Free the result
+ $this->sql_freeresult($result);
+ }
+
+ // Return as cache handle
+ $result = $cache_name;
+
+ // Increment cached queries
+ $this->stats['cached']++;
+ }
+
+ // Check if cache loaded
+ if ( ! isset ( $result ) )
+ {
+ // If not, execute and handle bad results.
+ if ( ! $result = $this->layer->sql_query($sql) )
+ {
+ // Report a query error.
+ trigger_error('Error_DB_Query(' . $this->layer->sql_error($result) . ',' . $sql . ')');
+ }
+ }
+
+ // Return Identifier
+ return $result;
+ }
+
+ /**
+ * Get a database result row
+ *
+ * @param mixed $resource Either the query resource identifier or the cache handle
+ * @param string $type The type of output to return (assoc, object or index)
+ * @return mixed
+ */
+ function sql_fetchrow($result, $type = 'assoc')
+ {
+ if ( is_string($result) && isset ( $this->cache[$result] ) && is_array ( $this->cache[$result] ) )
+ {
+ $row = current($this->cache[$result]);
+ next($this->cache[$result]);
+
+ $typecast = '';
+ switch ($type)
+ {
+ default:
+ case 'assoc':
+ $typecast = 'array';
+ break;
+ case 'object':
+ $typecast = 'object';
+ break;
+ case 'index':
+ $row = array_values($row);
+ $typecast = 'array';
+ }
+
+ return $row;
+ }
+
+ return $this->layer->sql_fetchrow($result, $type);
+ }
+
+ /**
+ * Get a set of database result rows
+ *
+ * @param mixed $resource Either the query resource identifier or the cache handle
+ * @param string $type The type of output to return (assoc, object or index)
+ * @return array
+ */
+ function sql_fetchrowset($result, $row_type = 'assoc')
+ {
+ $rowset = array();
+ while ( $row = $this->sql_fetchrow($result, $row_type) )
+ {
+ $rowset[] = $row;
+ }
+
+ return $rowset;
+ }
+
+ /**
+ * Free the result from a mysql query
+ *
+ * @param mixed $resource Either the query resource identifier or the cache handle
+ * @return boolean
+ */
+ function sql_freeresult($resource = false)
+ {
+ // Allow loose coding (no set resource)
+ $resource = ( $resource == false ) ? array_pop($this->layer->queries) : $resource;
+
+ // Check if the resource is actualy a cache handle
+ if ( is_string($resource) && isset ( $this->cache[$resource] ) )
+ {
+ // If so, unset and return
+ unset($this->cache[$resource]);
+ return true;
+ }
+
+ // Return boolean
+ return $this->layer->sql_freeresult($resource);
+ }
+
+ /**
+ * Escape a single value, or array of values for safe entry in the db
+ *
+ * @param mixed $value A value or array of values to escape for sql entry
+ */
+ function sql_escape(&$value)
+ {
+ // Check if the value is an array of values
+ if ( is_array ( $value ) )
+ {
+ // If so, Loop through them
+ while ( list ( $key, ) = @each ( $value ) )
+ {
+ // And escape each value
+ $value[$key] = $this->layer->sql_escape($value[$key]);
+ }
+ }
+ else
+ {
+ // Else escape single value
+ $value = $this->layer->sql_escape($value);
+ }
+
+ // Return escaped value(s)
+ return $value;
+ }
+
+ /**
+ * Build the sql for an update query
+ *
+ * @param array $valueset The value set to use in the build, if no fieldset is defined array keys will be used.
+ * @param array $fieldset A set of field names to match the values.
+ * @param boolean $escape_val Automatically escapes values if true.
+ */
+ function sql_build_update($valueset, $fieldset = false, $escape_val = false)
+ {
+ // Check for a fieldset
+ if ( ! $fieldset )
+ {
+ // If none defined, use valueset keys
+ $fieldset = array_keys($valueset);
+ }
+
+ // Unsure the arrays are not assoc
+ $valueset = array_values($valueset);
+ $fieldset = array_values($fieldset);
+
+ // Ensure the arrays are the same size
+ if ( sizeof ( $valueset ) <> sizeof ( $fieldset ) )
+ {
+ // Return false if so.
+ return false;
+ }
+
+ // Loop through the fields and values.
+ $return = array();
+ for ( $i = 0 ; $i < sizeof ( $valueset ) ; $i++ )
+ {
+ // Escape the value if needed
+ $valueset[$i] = ( $escape_val ) ? $this->sql_escape($valueset[$i]) : $valueset[$i];
+
+ // Add to the return values (Backticks for multi-word fields)
+ $return[] = "`{$fieldset[$i]}` = '{$valueset[$i]}'";
+ }
+
+ // Return the update string
+ return 'SET ' . implode(', ', $return);
+ }
+
+ /**
+ * Build the sql for an insert query
+ *
+ * @param array $valueset The value set to use in the build, if no fieldset is defined array keys will be used.
+ * @param array $fieldset A set of field names to match the values.
+ * @param boolean $escape_val Automatically escapes values if true.
+ */
+ function sql_build_insert($valueset, $fieldset = false, $escape_val = false)
+ {
+ // Check for a fieldset
+ if ( ! $fieldset )
+ {
+ // If none defined, use valueset keys
+ $fieldset = array_keys($valueset);
+ }
+
+ // Unsure the arrays are not assoc
+ $valueset = array_values($valueset);
+ $fieldset = array_values($fieldset);
+
+ // Ensure the arrays are the same size
+ if ( sizeof ( $valueset ) <> sizeof ( $fieldset ) )
+ {
+ // Return false if so.
+ return false;
+ }
+
+ // Make the fields part
+ $fields = array();
+ for ( $i = 0 ; $i < sizeof ( $fieldset ) ; $i++ )
+ {
+ // Add to fields, backtick for multi-word fields
+ $fields[] = "`{$fieldset[$i]}`";
+ }
+
+ // Make the values part
+ $values = array();
+ for ( $i = 0 ; $i < sizeof ( $valueset ) ; $i++ )
+ {
+ // Escape the value if needed
+ $valueset[$i] = ( $escape_val ) ? $this->sql_escape($valueset[$i]) : $valueset[$i];
+
+ // Add to values
+ $values[] = "'{$valueset[$i]}'";
+ }
+
+ // Implode the fields and values
+ $fields = implode(', ', $fields);
+ $values = implode(', ', $values);
+
+ return "({$fields}) VALUES ({$values})";
+ }
+
+ /**
+ * Executes an sql insert instruction
+ *
+ * @param string $table The table to insert the row into
+ * @param array $valueset The value set to use in the build, if no fieldset is defined array keys will be used.
+ * @param array $fieldset A set of field names to match the values.
+ * @param boolean $escape_val Automatically escapes values if true.
+ */
+ function sql_insert($table, $valueset, $fieldset = false, $escape_val = false)
+ {
+ // Build the query
+ $sql = 'INSERT INTO `' . $table . '` ' . $this->sql_build_insert($valueset, $fieldset, $escape_val);
+
+ // Execute the query
+ $result = $this->sql_query($sql);
+
+ // Free the result
+ $this->sql_freeresult($result);
+
+ return;
+ }
+
+ /**
+ * Executes an sql update instruction
+ *
+ * @param string $table The table to update values for
+ * @param array $valueset The value set to use in the build, if no fieldset is defined array keys will be used.
+ * @param array $fieldset A set of field names to match the values.
+ * @param string $where_sql The where condition for the update.
+ * @param boolean $escape_val Automatically escapes values if true.
+ */
+ function sql_update($table, $valueset, $fieldset = false, $escape_val = false, $where_sql = '')
+ {
+ // Build the query
+ $sql = 'UPDATE `' . $table . '` ' . $this->sql_build_update($valueset, $fieldset, $escape_val) . ' ' . $where_sql;
+
+ // Execute the query
+ $result = $this->sql_query($sql);
+
+ // Free the result
+ $this->sql_freeresult($result);
+
+ return;
+ }
+
+ /**
+ * Returns all available information for a field pointer or name
+ *
+ * @param string $field_key The field name or pointer (depending on parameter 2)
+ * @param boolean $force_pointer Forces the field name parameter to use the pointer instead
+ * @return array An associative array of various field information
+ */
+ function sql_field_info($field_key, $force_pointer = false)
+ {
+ return array();
+ }
+
+ /**
+ * Show tables in the current database.
+ *
+ * @return array
+ */
+ function sql_list_tables()
+ {
+ $sql = 'SHOW TABLES FROM `' . $this->layer->db_name . '`';
+ $result = $this->sql_query($sql);
+ $this->sql_fr...
[truncated message content] |
|
From: <aft...@us...> - 2006-12-20 13:01:16
|
Revision: 89
http://svn.sourceforge.net/shuttlebb/?rev=89&view=rev
Author: afterlife69
Date: 2006-12-20 05:01:09 -0800 (Wed, 20 Dec 2006)
Log Message:
-----------
branch renamed to root
Removed Paths:
-------------
branch/
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <aft...@us...> - 2006-12-10 17:27:43
|
Revision: 88
http://svn.sourceforge.net/shuttlebb/?rev=88&view=rev
Author: afterlife69
Date: 2006-12-10 09:26:57 -0800 (Sun, 10 Dec 2006)
Log Message:
-----------
Modified Paths:
--------------
branch/sources/class_message.php
Modified: branch/sources/class_message.php
===================================================================
--- branch/sources/class_message.php 2006-12-10 09:25:11 UTC (rev 87)
+++ branch/sources/class_message.php 2006-12-10 17:26:57 UTC (rev 88)
@@ -13,10 +13,17 @@
*/
/**
+ * @ignore
+ */
+define('ERROR_CRITICAL', 'Critical_Error');
+define('ERROR_MAJOR', 'Major_Error');
+define('ERROR_MINOR', 'Minor_Error');
+define('GENERAL_MESSAGE', 'General_Message');
+
+/**
* Message handler
*
- * @package shuttlebb
- * @subpackage message_handler
+ * @package message_handler
* @author ShuttleBB Development Team <dev...@sh...>
* @author Dean Newman <web...@au...>
*/
@@ -25,17 +32,47 @@
var $message;
var $title;
var $level;
-
var $line;
var $file;
var $sql;
function message_handler($level, $message, $title = '', $line = '', $file = '', $sql = '')
{
+ /**
+ * Set class properties
+ */
+ $this->level = $level;
+ $this->message = $message;
+ $this->title = $title;
+ $this->line = $line;
+ $this->file = $file;
+ $this->sql = $sql;
+
+ /**
+ * Ensure level is set
+ */
+ if ( ! in_array ( $this->level, array(GENERAL_MESSAGE, ERROR_CRITICAL, ERROR_MAJOR, ERROR_MINOR) ) )
+ {
+ $this->level = GENERAL_MESSAGE;
+ }
+
+ /**
+ * Report and display error
+ */
+ if ( in_array ( $this->level, array(ERROR_CRITICAL, ERROR_MAJOR, ERROR_MINOR) ) )
+ {
+ $this->report_error();
+ $this->display_error();
+ }
+ else
+ {
+ }
+
+ return;
}
- function report()
+ function report_error()
{
global $db;
@@ -67,19 +104,34 @@
function sql_insert_log()
{
+ global $db;
+
+ if ( ! is_object($db) )
+ {
+ return;
+ }
}
function file_insert_log()
{
+ if ( ! defined ( 'ERROR_LOG_FILE' ) )
+ {
+ return;
+ }
}
function mail_insert_log()
{
+ if ( ! defined ( 'ERROR_LOG_EMAIL' ) )
+ {
+ return;
+ }
}
- function render()
+ function display_error()
{
- global $template, $db;
+ global $template;
+ global $db;
/**
* If the template object is not set
@@ -107,12 +159,12 @@
* Delete current output
*/
ob_end_clean();
-
+
/**
* Render template
*/
- $template->assign('error', array(
- 'level' => $this->level,
+ $template->assign('info', array(
+ 'level' => ( isset($lang[$this->level]) ) ? $lang[$this->level] : $this->level,
'title' => $this->title,
'message' => $this->message,
'line' => $this->line,
@@ -120,12 +172,16 @@
'sql' => $this->sql)
);
- $template->display('error_' . $this->level . '.html');
+ $template->display(strtolower($this->level) . '.html');
$db->sql_close();
exit;
}
+
+ function display()
+ {
+ }
}
?>
\ No newline at end of file
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <aft...@us...> - 2006-12-10 09:25:12
|
Revision: 87
http://svn.sourceforge.net/shuttlebb/?rev=87&view=rev
Author: afterlife69
Date: 2006-12-10 01:25:11 -0800 (Sun, 10 Dec 2006)
Log Message:
-----------
damn cache files
Removed Paths:
-------------
branch/template/Default/cache/%%E2^E2A^E2AEC254%%module_index.html
Deleted: branch/template/Default/cache/%%E2^E2A^E2AEC254%%module_index.html
===================================================================
--- branch/template/Default/cache/%%E2^E2A^E2AEC254%%module_index.html 2006-12-10 09:24:27 UTC (rev 86)
+++ branch/template/Default/cache/%%E2^E2A^E2AEC254%%module_index.html 2006-12-10 09:25:11 UTC (rev 87)
@@ -1,9 +0,0 @@
-139
-a:4:{s:8:"template";a:1:{s:17:"module_index.html";b:1;}s:9:"timestamp";i:1165688284;s:7:"expires";i:1165691884;s:13:"cache_serials";a:0:{}}<!--
-/*
- * $Id$
- * $Date$
- * $Rev$
- */ -->
-
- You are not logged in!
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <aft...@us...> - 2006-12-10 09:24:30
|
Revision: 86
http://svn.sourceforge.net/shuttlebb/?rev=86&view=rev
Author: afterlife69
Date: 2006-12-10 01:24:27 -0800 (Sun, 10 Dec 2006)
Log Message:
-----------
started work on message_handler
Modified Paths:
--------------
branch/sources/class_message.php
Added Paths:
-----------
branch/language/english/global.php
branch/sources/cache/index.html
branch/sources/captcha/index.html
branch/sources/dbal/index.html
branch/sources/error/
branch/sources/error/index.html
branch/sources/error/templates/
branch/sources/error/templates/index.html
branch/sources/index.html
branch/template/Default/cache/%%E2^E2A^E2AEC254%%module_index.html
Added: branch/language/english/global.php
===================================================================
--- branch/language/english/global.php (rev 0)
+++ branch/language/english/global.php 2006-12-10 09:24:27 UTC (rev 86)
@@ -0,0 +1,21 @@
+<?php
+/**
+ * Base language entries
+ *
+ * This is the base for all modules language
+ *
+ * $Id$
+ * $Rev$
+ * $Date$
+ */
+
+if ( ! define ( 'IN_SBB' ) )
+{
+ return;
+}
+
+$lang = array(
+ 'Board_Index' => 'Board Index'
+);
+
+?>
\ No newline at end of file
Property changes on: branch/language/english/global.php
___________________________________________________________________
Name: svn:keywords
+ Author Date Id Revision
Name: svn:eol-style
+ native
Added: branch/sources/cache/index.html
===================================================================
Property changes on: branch/sources/cache/index.html
___________________________________________________________________
Name: svn:keywords
+ Author Date Id Revision
Name: svn:eol-style
+ native
Added: branch/sources/captcha/index.html
===================================================================
Property changes on: branch/sources/captcha/index.html
___________________________________________________________________
Name: svn:keywords
+ Author Date Id Revision
Name: svn:eol-style
+ native
Modified: branch/sources/class_message.php
===================================================================
--- branch/sources/class_message.php 2006-12-06 05:34:36 UTC (rev 85)
+++ branch/sources/class_message.php 2006-12-10 09:24:27 UTC (rev 86)
@@ -20,55 +20,112 @@
* @author ShuttleBB Development Team <dev...@sh...>
* @author Dean Newman <web...@au...>
*/
-class class_message
+class message_handler
{
- var $code;
var $message;
+ var $title;
+ var $level;
+
var $line;
var $file;
var $sql;
- var $level;
- function class_message($message, $code = false, $line = false, $file = false, $sql = false, $level = false)
+ function message_handler($level, $message, $title = '', $line = '', $file = '', $sql = '')
{
- global $config;
+
}
- function insert_log()
+ function report()
{
- global $config;
-
- switch ( $config['error_report_level'] )
+ global $db;
+
+ switch ( $this->level )
{
- default:
+ //
+ // Critical error, log via email and sql or file
+ //
case ERROR_CRITICAL:
-
+ ( is_object($db) ) ? $this->sql_insert_log() : $this->file_insert_log();
+ $this->mail_insert_log();
break;
- case ERROR_TEMPLATE:
-
+ //
+ // Major error, logs via sql or file
+ //
+ case ERROR_MAJOR:
+ ( is_object($db) ) ? $this->sql_insert_log() : $this->file_insert_log();
break;
- case ERROR_DATABASE:
-
+ //
+ // Minor error, logs via sql or file
+ //
+ case ERROR_MINOR:
+ ( is_object($db) ) ? $this->sql_insert_log() : $this->file_insert_log();
break;
- case ERROR_CACHE:
-
- break;
- case ERROR_ALL:
-
- break;
}
+
+ return;
}
- function output()
+ function sql_insert_log()
{
- global $template;
- global $config;
}
-}
-
-function trigger_message($message, $code, $title)
-{
+ function file_insert_log()
+ {
+ }
+
+ function mail_insert_log()
+ {
+ }
+
+ function render()
+ {
+ global $template, $db;
+
+ /**
+ * If the template object is not set
+ */
+ if ( ! is_object($template) )
+ {
+ /**
+ * Build the smarty object
+ *
+ * @link http://smarty.php.net
+ */
+ $template = new Smarty; // Construct the smarty template object
+ $template->plugin_dir = (INC_PATH . 'smarty/plugins/'); // Set the plugins directory
+ $template->template_dir = (INC_PATH . 'error/templates/'); // Set the template directory
+ $template->cache_dir = ($template->template_dir . 'cache/'); // Set the caching directory
+ $template->compile_dir = ($template->template_dir . 'compile/'); // Set the template compilation directory
+ $template->config_dir = ($template->template_dir . 'config/'); // Set the configuration directory
+ $template->debugging = false; // Turn debugging console off
+ $template->compile_check = true; // Turn the compile check on
+ $template->caching = true; // Turn overall caching on
+ $template->force_compile = false; // Never force compiling
+ }
+
+ /**
+ * Delete current output
+ */
+ ob_end_clean();
+
+ /**
+ * Render template
+ */
+ $template->assign('error', array(
+ 'level' => $this->level,
+ 'title' => $this->title,
+ 'message' => $this->message,
+ 'line' => $this->line,
+ 'file' => $this->file,
+ 'sql' => $this->sql)
+ );
+
+ $template->display('error_' . $this->level . '.html');
+
+ $db->sql_close();
+
+ exit;
+ }
}
?>
\ No newline at end of file
Added: branch/sources/dbal/index.html
===================================================================
Property changes on: branch/sources/dbal/index.html
___________________________________________________________________
Name: svn:keywords
+ Author Date Id Revision
Name: svn:eol-style
+ native
Added: branch/sources/error/index.html
===================================================================
Property changes on: branch/sources/error/index.html
___________________________________________________________________
Name: svn:keywords
+ Author Date Id Revision
Name: svn:eol-style
+ native
Added: branch/sources/error/templates/index.html
===================================================================
Property changes on: branch/sources/error/templates/index.html
___________________________________________________________________
Name: svn:keywords
+ Author Date Id Revision
Name: svn:eol-style
+ native
Added: branch/sources/index.html
===================================================================
Property changes on: branch/sources/index.html
___________________________________________________________________
Name: svn:keywords
+ Author Date Id Revision
Name: svn:eol-style
+ native
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-10 09:24:27 UTC (rev 86)
@@ -0,0 +1,9 @@
+139
+a:4:{s:8:"template";a:1:{s:17:"module_index.html";b:1;}s:9:"timestamp";i:1165688284;s:7:"expires";i:1165691884;s:13:"cache_serials";a:0:{}}<!--
+/*
+ * $Id$
+ * $Date$
+ * $Rev$
+ */ -->
+
+ You are not logged in!
Property changes on: branch/template/Default/cache/%%E2^E2A^E2AEC254%%module_index.html
___________________________________________________________________
Name: svn:keywords
+ Author Date Id Revision
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <aft...@us...> - 2006-12-06 05:34:37
|
Revision: 85
http://svn.sourceforge.net/shuttlebb/?rev=85&view=rev
Author: afterlife69
Date: 2006-12-05 21:34:36 -0800 (Tue, 05 Dec 2006)
Log Message:
-----------
captcha
Modified Paths:
--------------
branch/sources/class_captcha.php
Modified: branch/sources/class_captcha.php
===================================================================
--- branch/sources/class_captcha.php 2006-12-05 16:33:46 UTC (rev 84)
+++ branch/sources/class_captcha.php 2006-12-06 05:34:36 UTC (rev 85)
@@ -1,8 +1,496 @@
<?php
/**
+ * Captcha abstraction layer
+ *
+ * This handler is responcible for caching of all kinds, it will
+ * generate files, check expiration dates, remove expired files
+ * and load cached data into other classes throughout the software.
+ *
* $Id$
* $Date$
* $Rev$
*/
-?>
\ No newline at end of file
+/**
+ * Constants
+ */
+define ( CAPTCHA_TABLE, $table_prefix . 'captcha' );
+
+/*
+CREATE TABLE `sbb_captcha` (
+ `captcha_id` INT( 1 ) NOT NULL AUTO_INCREMENT PRIMARY KEY ,
+ `captcha_string` TEXT NOT NULL ,
+ `user_id` TEXT NOT NULL
+);
+*/
+
+
+/**
+ * CAPTCHA Class.
+ * Allows advanced CAPTCHA creation using simple wrapper functions.
+ *
+ * @todo This class should be an abstract master layer (abstract = parent only)
+ *
+ * @author Tyler King <ai...@ya...>
+ * @author Dean Newman <web...@au...>
+ */
+class captcha
+{
+ /**
+ * Contains the directory path to the TFF fonts.
+ *
+ * @var string
+ */
+ var $font_path;
+
+ /**
+ * Contains the directory path to the image backgrounds.
+ *
+ * @var string
+ */
+ var $background_path;
+
+ /**
+ * Contains the CAPTCHA configuration.
+ *
+ * @var string
+ */
+ var $data;
+
+ /**
+ * Contains randomly assigned colors.
+ *
+ * @var string
+ */
+ var $rgb;
+
+ /**
+ * Initilizes the class.
+ */
+ function captcha ( )
+ {
+ // Set up the in-class variables.
+ $this->font_path = './ttf/';
+ $this->background_path = './backgrounds/';
+ $this->data = array ( );
+ $this->rgb = $this->gen_rand_color ( );
+ }
+
+ /**
+ * Generates random RGB colors.
+ *
+ * @param integer $start
+ * @param integer $end
+ * @return array
+ */
+ function gen_rand_color ( $start = 0, $end = 255 )
+ {
+ return array ( rand ( $start, $end ), rand ( $start, $end ), rand ( $start, $end ) );
+ }
+
+ /**
+ * Converts hex values to RGB values.
+ *
+ * @param string $color
+ * @return array
+ */
+ function hex_rgb ( $color )
+ {
+ // Remove the hex identifier.
+ $color = str_replace ( '#', '', $color );
+ for ( $i = 0; $i < 3; $i++ )
+ {
+ // Convert to RGB decimal values.
+ $rgb[ ] = hexdec ( substr ( $color, ( 2 * $i ), 2 ) );
+ }
+
+ return $rgb;
+ }
+
+ /**
+ * Walk a directory to return it's files.
+ *
+ * @param string $dir_path
+ * @return array
+ */
+ function walk_dir ( $dir_path )
+ {
+ // Open the directory. Set up the file array.
+ $dh = @opendir ( $dir_path );
+ $files = array ( );
+
+ while ( $file = @readdir ( $dh ) )
+ {
+ // A hidden file ?
+ if ( $file == '.' || $file == '..' || $file{0} == '.' )
+ {
+ // Yes, it is hidden. Skip it.
+ continue;
+ }
+ else
+ {
+ // No, it is not hidden. Append it.
+ $files[ ] = $file;
+ }
+ }
+ @closedir ( $dh );
+
+ return $files;
+ }
+
+ /**
+ * Resizes a background image to the CAPTCHA dimensions.
+ *
+ * @param string $image
+ * @return object
+ */
+ function resize_image ( $image )
+ {
+ // Get the background's height and width.
+ $image_data = getimagesize ( $image );
+
+ // Resize it.
+ $im = imagecreatetruecolor( $this->data[ 'width' ], $this->data[ 'height' ] );
+ $image = imagecreatefrompng ( $image );
+ imagecopyresampled ( $im, $image, 0, 0, 0, 0, $this->data[ 'width' ], $this->data[ 'width' ], $image_data[ 0 ], $image_data[ 1 ] );
+
+ return $im;
+ }
+
+ /**
+ * Check if a CAPTCHA code entered by a user is correct.
+ *
+ * @param string $code
+ * @return boolean
+ */
+ function confirm ( $code )
+ {
+ global $db;
+ global $userdata;
+
+ // Get the CAPTCHAs.
+ $sql = 'SELECT * FROM ' . CAPTCHA_TABLE;
+ $result = $db->sql_query ( $sql );
+ $row = $db->sql_fetchrow ( $result );
+
+ // Does the string entered by user match the database ?
+ if ( strtolower ( $row[ 'captcha_string' ] ) == strtolower ( $code ) )
+ {
+ // Yes. Delete it. Return true for correct.
+ $sql = 'DELETE FROM ' . CAPTCHA_TABLE . ' WHERE user_id = ' . $userdata[ 'user_id' ];
+ $db->sql_query ( $sql );
+
+ return true;
+ }
+ else
+ {
+ // No. Delete it. Return false for incorrect.
+ $sql = 'DELETE FROM ' . CAPTCHA_TABLE . ' WHERE user_id = ' . $userdata[ 'user_id' ];
+ $db->sql_query ( $sql );
+
+ return false;
+ }
+ }
+
+ /**
+ * (Wrapper) Set the size for the CAPTCHA.
+ *
+ * @param integer $height
+ * @param integer $width
+ */
+ function size ( $height, $width )
+ {
+ $this->data[ 'width' ] = $width;
+ $this->data[ 'height' ] = $height;
+ }
+
+ /**
+ * (Wrapper) Set the color for strings and backgrounds of the CAPTCHA.
+ *
+ * @param string $color
+ */
+ function color ( $color = '' )
+ {
+ // Is it a hex value ?
+ if ( strstr ( $color, '#' ) )
+ {
+ // Yes. Convert it to RGB.
+ $this->data[ 'color' ] = $this->hex_rgb ( $background );
+ }
+ else
+ {
+ // No. Randomize a color.
+ $this->data[ 'color' ] = $this->gen_rand_color ( 200, 255 );
+ }
+ }
+
+ /**
+ * (Wrapper) Set the CAPTCHA code length.
+ *
+ * @param integer $length
+ */
+ function string_length ( $length )
+ {
+ $this->data[ 'string.length' ] = $length;
+ }
+
+ /**
+ * (Wrapper) Set the background image for the CAPTCHA.
+ *
+ * @param boolean/string $background
+ */
+ function background ( $background = true )
+ {
+ // True = random background image. String = background image.
+ $this->data[ 'background' ] = $background;
+ }
+
+ /**
+ * (Wrapper) Set lines for the CAPTCHA.
+ *
+ * @param integer $lines
+ * @param string $layer
+ */
+ function lines ( $lines = 0, $layer = 'background' )
+ {
+ $this->data[ 'lines.layer' ] = $layer;
+ $this->data[ 'lines' ] = ( $lines > 0 ) ? $lines : rand ( 4, 5 );
+ }
+
+ /**
+ * (Wrapper) Set noise for the CAPTCHA.
+ *
+ * @param integer $amount
+ * @param string $layer
+ */
+ function noise ( $amount = '', $layer = 'background' )
+ {
+ $this->data[ 'noise.layer' ] = $layer;
+ $this->data[ 'noise' ] = ( $amount > 0 ) ? $amount : rand ( 4, 5 );
+ }
+
+ /**
+ * (Wrapper) Set ellipses for the CAPTCHA.
+ *
+ * @param integer $amount
+ * @param string $layer
+ */
+ function ellipse ( $amount = '', $layer = 'background' )
+ {
+ $this->data[ 'ellipse.layer' ] = $layer;
+ $this->data[ 'ellipse' ] = ( $amount > 0 ) ? $amount : rand ( 4, 5 );
+ }
+
+ /**
+ * (Wrapper) Set filters for the CAPTCHA
+ *
+ * @param integer $amount
+ * @param string $filter
+ */
+ function filter ( $amount = '', $filter = 'random' )
+ {
+ if ( strtolower ( $filter ) == 'blur' )
+ {
+ $type = IMG_FILTER_GAUSSIAN_BLUR;
+ }
+ else if ( strtolower ( $filter ) == 'contrast' )
+ {
+ $type = IMG_FILTER_CONTRAST;
+ }
+ else if ( strtolower ( $filter ) == 'colorize' )
+ {
+ $type = IMG_FILTER_COLORIZE;
+ }
+ else if ( strtolower ( $filter ) == 'emboss' )
+ {
+ $type = IMG_FILTER_EMBOSS;
+ }
+ else if ( strtolower ( $filter ) == 'highlight' )
+ {
+ $type = IMG_FILTER_EDGEDETECT;
+ }
+ else if ( strtolower ( $filter ) == 'sketch' )
+ {
+ $type = IMG_FILTER_MEAN_REMOVAL;
+ }
+ else if ( strtolower ( $filter ) == 'smooth' )
+ {
+ $type = IMG_FILTER_SMOOTH;
+ }
+ else
+ {
+ // Nothing set, randomize.
+ $type = rand ( ) & count ( array ( IMG_FILTER_GAUSSIAN_BLUR, IMG_FILTER_CONTRAST, IMG_FILTER_COLORIZE, IMG_FILTER_EMBOSS, IMG_FILTER_EDGEDETECT, IMG_FILTER_MEAN_REMOVAL, IMG_FILTER_SMOOTH0 ) );
+ }
+
+ $this->data[ 'filter' ] = $type;
+ $this->data[ 'filter.amount' ] = $amount;
+ }
+
+ /**
+ * Render the CAPTCHA image with all the configurations set.
+ *
+ * @return object.
+ */
+ function render ( )
+ {
+ global $db;
+ global $userdata;
+
+ // Walk the directories to return the files.
+ $walked = $this->walk_dir ( $this->font_path );
+ $backgrounds = $this->walk_dir ( $this->background_path );
+
+ if ( !empty ( $this->data[ 'background' ] ) )
+ {
+ // Background set. Resize the background.
+ $captcha = $this->resize_image ( $this->background_path . $backgrounds[ rand ( ) % count ( $backgrounds ) ] );
+ }
+ else
+ {
+ // No background set.
+ $captcha = imagecreate ( $this->data[ 'width' ], $this->data[ 'height' ] );
+ }
+
+ if ( !empty ( $this->data[ 'string.length' ] ) )
+ {
+ // Length set.
+ $string_length = strlen ( $this->data[ 'string.length' ] );
+ }
+ else
+ {
+ // No length set, randomize.
+ $string_length = rand ( 4, 5 );
+ }
+
+ for ( $i = 0; $i < $string_length; $i++ )
+ {
+ // Convert the integers into characters.
+ $string .= chr ( rand ( 65, 90 ) );
+ }
+
+ if ( !empty ( $this->data[ 'color' ] ) )
+ {
+ // Color set (already converted into RGB).
+ $colors = $this->data[ 'color' ];
+ }
+ else
+ {
+ // No color set, randomize.
+ $colors = $this->gen_rand_color ( 200, 255 );
+ }
+
+ $back_color = imagecolorallocate ( $captcha, $colors[ 0 ], $colors[ 1 ], $colors[ 2 ] );
+ if ( !empty ( $this->data[ 'lines.layer' ] ) && $this->data[ 'lines.layer' ] == 'background' )
+ {
+ for ( $i = 0; $i < $this->data[ 'lines' ]; $i++ )
+ {
+ // All the X, Y and length of things.
+ $rx1 = rand ( 0, $this->data[ 'width' ] );
+ $rx2 = rand ( 0, $this->data[ 'width' ] );
+ $ry1 = rand ( 0, $this->data[ 'height' ] );
+ $ry2 = rand ( 0, $this->data[ 'height' ] );
+ $rcVal = rand ( 0, 255 );
+
+ $rc1 = imagecolorallocate ( $captcha, rand ( 0, 255 ), rand ( 0, 255 ), rand ( 100, 255 ) );
+ imageline ( $captcha, $rx1, $ry1, $rx2, $ry2, $rc1 );
+ }
+ }
+
+ if ( !empty ( $this->data[ 'noise.layer' ] ) && $this->data[ 'noise.layer' ] == 'background' )
+ {
+ for ( $i = 0; $i< $this->data[ 'noise' ]; $i++ )
+ {
+ // Set where the pixel is and it's color.
+ imagesetpixel ( $captcha, rand ( 0, $this->data[ 'width' ] ), rand ( 0, $this->data[ 'height' ] ), rand ( 0, 255 ) );
+ }
+ }
+
+ if ( !empty ( $this->data[ 'ellipse.layer' ] ) && $this->data[ 'ellipse.layer' ] == 'background' )
+ {
+ for ( $i = 1; $i < $this->data[ 'ellipse' ]; $i++ )
+ {
+ // Set where the ellipse is and it's color. (Random colors).
+ imageellipse ( $captcha, rand ( 1, 200 ), rand ( 1, 50 ), rand ( 50, 100 ), rand ( 12, 25 ), $colors[ rand ( 0, 24 ) ] );
+ }
+
+ for ( $i = 1; $i < $this->data[ 'ellipse' ]; $i++ )
+ {
+ // Set where the ellipse is and it's color. (Set colors).
+ imageellipse ( $captcha, rand ( 1, 200 ), rand ( 1, 50 ), rand ( 50, 100 ), rand ( 12, 25 ), $back_color );
+ }
+ }
+
+ for ( $i = 0; $i < 25; $i++ )
+ {
+ // Get some random colors to use.
+ $rgb = $this->gen_rand_color ( rand ( 0, 125 ), rand ( 125, 255 ) );
+ $colors[ ] = imagecolorallocate ( $captcha, $rgb[ 0 ], $rgb[ 1 ], $rgb[ 2 ] );
+ }
+
+ for ( $i = 1; $i <= $string_length; $i++ )
+ {
+ $c_c = ( rand ( 1, 2 ) == 1 ) ? rand ( 0, 45 ) : rand ( 315, 360 );
+
+ // Add in a character with color and a random font.
+ imagettftext ( $captcha, rand ( 14, 20 ), $c_c, ( $i * 25 ), 30, $colors[ rand ( 0, 24 ) ], $this->font_path . $walked[ rand ( ) % count ( $walked ) ], substr ( $string, ( $i - 1 ), 1 ) );
+ }
+
+ if ( !empty ( $this->data[ 'ellipse.layer' ] ) && $this->data[ 'ellipse.layer' ] == 'foreground' )
+ {
+ for ( $i = 1; $i < $this->data[ 'ellipse' ]; $i++ )
+ {
+ // Set where the ellipse is and it's color. (Random colors).
+ imageellipse ( $captcha, rand ( 1, 200 ), rand ( 1, 50 ), rand ( 50, 100 ), rand ( 12, 25 ), $colors[ rand ( 0, 24 ) ] );
+ }
+
+ for ( $i = 1; $i < $this->data[ 'ellipse' ]; $i++ )
+ {
+ // Set where the ellipse is and it's color. (Set colors).
+ imageellipse ( $captcha, rand ( 1, 200 ), rand ( 1, 50 ), rand ( 50, 100 ), rand ( 12, 25 ), $backcolor );
+ }
+ }
+
+ if ( !empty ( $this->data[ 'noise.layer' ] ) && $this->data[ 'noise.layer' ] == 'foreground' )
+ {
+ for ( $i = 0; $i < $this->data[ 'noise' ]; $i++ )
+ {
+ // Set where the pixel is and it's color.
+ imagesetpixel ( $captcha, rand ( 0, $this->data[ 'width' ] ), rand ( 0, $this->data[ 'height' ] ), rand ( 0, 255 ) );
+ }
+ }
+
+ if ( !empty ( $this->data[ 'lines.layer' ] ) && $this->data[ 'lines.layer' ] == 'foreground' )
+ {
+ for ( $i = 0; $i < $this->data[ 'lines' ]; $i++ )
+ {
+ // All the X, Y and length of things.
+ $rx1 = rand ( 0, $this->data[ 'width' ] );
+ $rx2 = rand ( 0, $this->data[ 'width' ] );
+ $ry1 = rand ( 0, $this->data[ 'height' ] );
+ $ry2 = rand ( 0, $this->data[ 'height' ] );
+ $rcVal = rand ( 0, 255 );
+
+ $rc1 = imagecolorallocate ( $captcha, rand ( 0, 255 ), rand ( 0, 255 ), rand ( 100, 255 ) );
+ imageline ( $captcha, $rx1, $ry1, $rx2, $ry2, $rc1 );
+ }
+ }
+
+ if ( !empty ( $this->data[ 'filter' ] ) && phpversion ( ) >= 5 )
+ {
+ // Assign the filter if the PHP version is not less then 5.
+ imagefilter ( $captcha, $type, ( !empty ( $this->data[ 'filter.amount' ] ) ) ? $this->data[ 'filter.amount' ] : 50 );
+ }
+
+ // Insert it into the database for later.
+ $sql = 'INSERT INTO ' . CAPTCHA_TABLE . ' (captcha_id, captcha_string, user_id) VALUES ("NULL", "' . $string . '", "' . $userdata[ 'user_id' ] . '")';
+ $db->sql_query ( $sql );
+
+ // Output it.
+ header ( 'Content-Type: image/png' );
+ imagepng ( $captcha );
+ imagedestroy ( $captcha );
+ }
+}
+
+?>
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <aft...@us...> - 2006-12-05 16:49:55
|
Revision: 84
http://svn.sourceforge.net/shuttlebb/?rev=84&view=rev
Author: afterlife69
Date: 2006-12-05 08:33:46 -0800 (Tue, 05 Dec 2006)
Log Message:
-----------
user seems more logical?
Modified Paths:
--------------
branch/template/Default/module_index.html
Modified: branch/template/Default/module_index.html
===================================================================
--- branch/template/Default/module_index.html 2006-12-05 16:21:20 UTC (rev 83)
+++ branch/template/Default/module_index.html 2006-12-05 16:33:46 UTC (rev 84)
@@ -4,7 +4,7 @@
* $Date$
* $Rev$
*/ -->
-{if isset($constants.guest_id) and $user.user_id != $constants.guest_id }
+{if isset($user.user_id) and $user.user_id != $constants.guest_id }
Hello {$user.username}, You are logged in!
{else}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <aft...@us...> - 2006-12-05 16:49:52
|
Revision: 82
http://svn.sourceforge.net/shuttlebb/?rev=82&view=rev
Author: afterlife69
Date: 2006-12-05 08:19:23 -0800 (Tue, 05 Dec 2006)
Log Message:
-----------
user handler is now working again
Modified Paths:
--------------
branch/index.php
branch/sources/class_user.php
branch/template/Default/module_index.html
Removed Paths:
-------------
branch/template/Default/cache/%%E2^E2A^E2AEC254%%module_index.html
Modified: branch/index.php
===================================================================
--- branch/index.php 2006-12-05 16:05:08 UTC (rev 81)
+++ branch/index.php 2006-12-05 16:19:23 UTC (rev 82)
@@ -107,8 +107,8 @@
/**
* Assign some important information to smarty
*/
-$template->assign('user', $user);
-$template->assign('session', $session);
+$template->assign('user', $user->data);
+$template->assign('session', $session->data);
$template->assign('constants', array(
'guest_id' => UNREGISTERED,
'root_path' => ROOT_PATH,
Modified: branch/sources/class_user.php
===================================================================
--- branch/sources/class_user.php 2006-12-05 16:05:08 UTC (rev 81)
+++ branch/sources/class_user.php 2006-12-05 16:19:23 UTC (rev 82)
@@ -64,6 +64,9 @@
$this->login($sessiondata['user_id']);
}
}
+
+ // Pull userdata
+ $this->data = $this->userdata($this->session->data['user_id']);
/*
// Pull userdata based on session
@@ -343,8 +346,8 @@
function userdata($user_id)
{
global $db;
-
- $result = $db->sql_query('SELECT * FROM ' . SESSIONS_TABLE . ' WHERE user_id = ' . (int) $user_id);
+
+ $result = $db->sql_query('SELECT * FROM ' . USERS_TABLE . ' WHERE user_id = ' . (int) $user_id);
$row = $db->sql_fetchrow($result);
$db->sql_freeresult($result);
Deleted: branch/template/Default/cache/%%E2^E2A^E2AEC254%%module_index.html
===================================================================
--- branch/template/Default/cache/%%E2^E2A^E2AEC254%%module_index.html 2006-12-05 16:05:08 UTC (rev 81)
+++ branch/template/Default/cache/%%E2^E2A^E2AEC254%%module_index.html 2006-12-05 16:19:23 UTC (rev 82)
@@ -1,8 +0,0 @@
-139
-a:4:{s:8:"template";a:1:{s:17:"module_index.html";b:1;}s:9:"timestamp";i:1165333881;s:7:"expires";i:1165337481;s:13:"cache_serials";a:0:{}}<!--
-/*
- * $Id$
- * $Date$
- * $Rev$
- */ -->
- You are logged in!
Modified: branch/template/Default/module_index.html
===================================================================
--- branch/template/Default/module_index.html 2006-12-05 16:05:08 UTC (rev 81)
+++ branch/template/Default/module_index.html 2006-12-05 16:19:23 UTC (rev 82)
@@ -4,8 +4,9 @@
* $Date$
* $Rev$
*/ -->
-{if $user->user_id != $constants.guest_id }
- You are logged in!
+{if isset($constants.guest_id) and $user.user_id != $constants.guest_id }
+ Hello {$user.username}, You are logged in!
{else}
+
You are not logged in!
{/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.
|
|
From: <aft...@us...> - 2006-12-05 16:49:52
|
Revision: 83
http://svn.sourceforge.net/shuttlebb/?rev=83&view=rev
Author: afterlife69
Date: 2006-12-05 08:21:20 -0800 (Tue, 05 Dec 2006)
Log Message:
-----------
guest user
Modified Paths:
--------------
branch/install/sql/mysql_data.sql
Modified: branch/install/sql/mysql_data.sql
===================================================================
--- branch/install/sql/mysql_data.sql 2006-12-05 16:19:23 UTC (rev 82)
+++ branch/install/sql/mysql_data.sql 2006-12-05 16:21:20 UTC (rev 83)
@@ -0,0 +1,2 @@
+INSERT INTO `sbb_users` (`user_id`, `username`, `password`, `user_email`, `user_active`, `user_code`, `user_msn`, `user_icq`, `user_yim`, `user_aim`, `user_sig`, `user_rank`, `user_web`, `user_ip`)
+ VALUES (-1, 'Guest', '37a6259cc0c1dae299a7866489dff0bd', 'webmaster@127.0.0.1', 0, '0', NULL, NULL, NULL, NULL, NULL, 0, NULL, '');
\ No newline at end of file
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <aft...@us...> - 2006-12-05 16:05:10
|
Revision: 81
http://svn.sourceforge.net/shuttlebb/?rev=81&view=rev
Author: afterlife69
Date: 2006-12-05 08:05:08 -0800 (Tue, 05 Dec 2006)
Log Message:
-----------
moved a constant, used a constant
Modified Paths:
--------------
branch/index.php
branch/require/constants.php
branch/sources/class_session.php
branch/sources/class_user.php
branch/template/Default/cache/%%E2^E2A^E2AEC254%%module_index.html
Modified: branch/index.php
===================================================================
--- branch/index.php 2006-12-05 12:18:29 UTC (rev 80)
+++ branch/index.php 2006-12-05 16:05:08 UTC (rev 81)
@@ -7,6 +7,8 @@
* $Rev$
*/
+$sbb_start_var = microtime(true);
+
/**
* Define self
*/
@@ -137,10 +139,7 @@
ob_end_clean();
echo $output;
-/**
- * Source code highlighting
- */
-highlight_file(__FILE__);
+echo 'Generation time: ' . ($sbb_start_var - time());
/**
* Bye!
Modified: branch/require/constants.php
===================================================================
--- branch/require/constants.php 2006-12-05 12:18:29 UTC (rev 80)
+++ branch/require/constants.php 2006-12-05 16:05:08 UTC (rev 81)
@@ -24,4 +24,9 @@
define('BBCODE_TABLE', DB_PREFIX . 'bbcode');
define('ACL_TABLE', DB_PREFIX . 'acl');
+/**
+ * This constant is used to identify "Guest" users.
+ */
+define('UNREGISTERED', '-1');
+
?>
\ No newline at end of file
Modified: branch/sources/class_session.php
===================================================================
--- branch/sources/class_session.php 2006-12-05 12:18:29 UTC (rev 80)
+++ branch/sources/class_session.php 2006-12-05 16:05:08 UTC (rev 81)
@@ -136,7 +136,7 @@
'session_agent' => (string) $db->sql_escape($this->agent),
'session_time' => (int) time(),
'session_page' => (int) $this->page,
- 'user_id' => 0,
+ 'user_id' => UNREGISTERED,
));
// set session data
Modified: branch/sources/class_user.php
===================================================================
--- branch/sources/class_user.php 2006-12-05 12:18:29 UTC (rev 80)
+++ branch/sources/class_user.php 2006-12-05 16:05:08 UTC (rev 81)
@@ -8,11 +8,6 @@
*/
/**
- * This constant is used to identify "Guest" users.
- */
-define('UNREGISTERED', -1);
-
-/**
* This class manages all aspects of the user including templates, language and sessions
*/
class user
Modified: branch/template/Default/cache/%%E2^E2A^E2AEC254%%module_index.html
===================================================================
--- branch/template/Default/cache/%%E2^E2A^E2AEC254%%module_index.html 2006-12-05 12:18:29 UTC (rev 80)
+++ branch/template/Default/cache/%%E2^E2A^E2AEC254%%module_index.html 2006-12-05 16:05:08 UTC (rev 81)
@@ -1,5 +1,5 @@
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:{}}<!--
+a:4:{s:8:"template";a:1:{s:17:"module_index.html";b:1;}s:9:"timestamp";i:1165333881;s:7:"expires";i:1165337481;s:13:"cache_serials";a:0:{}}<!--
/*
* $Id$
* $Date$
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
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.
|
|
From: <aft...@us...> - 2006-12-05 08:40:39
|
Revision: 79
http://svn.sourceforge.net/shuttlebb/?rev=79&view=rev
Author: afterlife69
Date: 2006-12-05 00:40:38 -0800 (Tue, 05 Dec 2006)
Log Message:
-----------
lol $user->lang = $user->data.
Modified Paths:
--------------
branch/index.php
Modified: branch/index.php
===================================================================
--- branch/index.php 2006-12-05 08:38:00 UTC (rev 78)
+++ branch/index.php 2006-12-05 08:40:38 UTC (rev 79)
@@ -113,7 +113,7 @@
'inc_path' => INC_PATH,
'tpl_path' => $template->template_dir,
'req_path' => REQ_PATH,
- 'lang_path' => LANG_PATH . $user->lang['user_lang'] . '/',
+ 'lang_path' => LANG_PATH . $user->data['user_lang'] . '/',
'mod_path' => MOD_PATH,
'plug_path' => PLUG_PATH);
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <aft...@us...> - 2006-12-05 08:38:01
|
Revision: 78
http://svn.sourceforge.net/shuttlebb/?rev=78&view=rev
Author: afterlife69
Date: 2006-12-05 00:38:00 -0800 (Tue, 05 Dec 2006)
Log Message:
-----------
Smarty integration.
Modified Paths:
--------------
branch/index.php
branch/sources/class_module_loader.php
branch/template/Default/module_index.html
Added Paths:
-----------
branch/sources/smarty/
branch/sources/smarty/Config_File.class.php
branch/sources/smarty/Smarty.class.php
branch/sources/smarty/Smarty_Compiler.class.php
branch/sources/smarty/debug.tpl
branch/sources/smarty/index.html
branch/sources/smarty/internals/
branch/sources/smarty/internals/core.assemble_plugin_filepath.php
branch/sources/smarty/internals/core.assign_smarty_interface.php
branch/sources/smarty/internals/core.create_dir_structure.php
branch/sources/smarty/internals/core.display_debug_console.php
branch/sources/smarty/internals/core.get_include_path.php
branch/sources/smarty/internals/core.get_microtime.php
branch/sources/smarty/internals/core.get_php_resource.php
branch/sources/smarty/internals/core.is_secure.php
branch/sources/smarty/internals/core.is_trusted.php
branch/sources/smarty/internals/core.load_plugins.php
branch/sources/smarty/internals/core.load_resource_plugin.php
branch/sources/smarty/internals/core.process_cached_inserts.php
branch/sources/smarty/internals/core.process_compiled_include.php
branch/sources/smarty/internals/core.read_cache_file.php
branch/sources/smarty/internals/core.rm_auto.php
branch/sources/smarty/internals/core.rmdir.php
branch/sources/smarty/internals/core.run_insert_handler.php
branch/sources/smarty/internals/core.smarty_include_php.php
branch/sources/smarty/internals/core.write_cache_file.php
branch/sources/smarty/internals/core.write_compiled_include.php
branch/sources/smarty/internals/core.write_compiled_resource.php
branch/sources/smarty/internals/core.write_file.php
branch/sources/smarty/internals/index.html
branch/sources/smarty/plugins/
branch/sources/smarty/plugins/block.textformat.php
branch/sources/smarty/plugins/compiler.assign.php
branch/sources/smarty/plugins/function.assign_debug_info.php
branch/sources/smarty/plugins/function.config_load.php
branch/sources/smarty/plugins/function.counter.php
branch/sources/smarty/plugins/function.cycle.php
branch/sources/smarty/plugins/function.debug.php
branch/sources/smarty/plugins/function.eval.php
branch/sources/smarty/plugins/function.fetch.php
branch/sources/smarty/plugins/function.html_checkboxes.php
branch/sources/smarty/plugins/function.html_image.php
branch/sources/smarty/plugins/function.html_options.php
branch/sources/smarty/plugins/function.html_radios.php
branch/sources/smarty/plugins/function.html_select_date.php
branch/sources/smarty/plugins/function.html_select_time.php
branch/sources/smarty/plugins/function.html_table.php
branch/sources/smarty/plugins/function.mailto.php
branch/sources/smarty/plugins/function.math.php
branch/sources/smarty/plugins/function.popup.php
branch/sources/smarty/plugins/function.popup_init.php
branch/sources/smarty/plugins/index.html
branch/sources/smarty/plugins/modifier.capitalize.php
branch/sources/smarty/plugins/modifier.cat.php
branch/sources/smarty/plugins/modifier.count_characters.php
branch/sources/smarty/plugins/modifier.count_paragraphs.php
branch/sources/smarty/plugins/modifier.count_sentences.php
branch/sources/smarty/plugins/modifier.count_words.php
branch/sources/smarty/plugins/modifier.date_format.php
branch/sources/smarty/plugins/modifier.debug_print_var.php
branch/sources/smarty/plugins/modifier.default.php
branch/sources/smarty/plugins/modifier.escape.php
branch/sources/smarty/plugins/modifier.indent.php
branch/sources/smarty/plugins/modifier.lower.php
branch/sources/smarty/plugins/modifier.nl2br.php
branch/sources/smarty/plugins/modifier.regex_replace.php
branch/sources/smarty/plugins/modifier.replace.php
branch/sources/smarty/plugins/modifier.spacify.php
branch/sources/smarty/plugins/modifier.string_format.php
branch/sources/smarty/plugins/modifier.strip.php
branch/sources/smarty/plugins/modifier.strip_tags.php
branch/sources/smarty/plugins/modifier.truncate.php
branch/sources/smarty/plugins/modifier.upper.php
branch/sources/smarty/plugins/modifier.wordwrap.php
branch/sources/smarty/plugins/outputfilter.trimwhitespace.php
branch/sources/smarty/plugins/shared.escape_special_chars.php
branch/sources/smarty/plugins/shared.make_timestamp.php
branch/template/Default/cache/
branch/template/Default/cache/index.html
branch/template/Default/compile/
branch/template/Default/compile/index.html
branch/template/Default/config/
branch/template/Default/config/index.html
branch/template/Default/index.html
branch/template/index.html
Removed Paths:
-------------
branch/admin.php
Deleted: branch/admin.php
===================================================================
--- branch/admin.php 2006-12-05 07:55:32 UTC (rev 77)
+++ branch/admin.php 2006-12-05 08:38:00 UTC (rev 78)
@@ -1,12 +0,0 @@
-<?php
-/**
- * ShuttleBB Administration
- *
- * $Id$
- * $Date$
- * $Rev$
- */
-
-echo 'I wish.';
-
-?>
\ No newline at end of file
Modified: branch/index.php
===================================================================
--- branch/index.php 2006-12-05 07:55:32 UTC (rev 77)
+++ branch/index.php 2006-12-05 08:38:00 UTC (rev 78)
@@ -7,10 +7,14 @@
* $Rev$
*/
-// Define self
+/**
+ * Define self
+ */
define('IN_SBB', true);
-// Define paths for security
+/**
+ * Define full paths for security
+ */
define('PHPEX', '.php');
define('ROOT_PATH', dirname(__FILE__) . '/');
define('INC_PATH', ROOT_PATH . 'sources/');
@@ -18,16 +22,23 @@
define('LANG_PATH', ROOT_PATH . 'language/');
define('TPL_PATH', ROOT_PATH . 'template/');
define('MOD_PATH', ROOT_PATH . 'module/');
+define('PLUG_PATH', ROOT_PATH . 'plugins/');
-// Start output buffering
+/**
+ * Start output buffering
+ */
ob_start();
-// Include required sources
+/**
+ * Require some static files
+ */
require (REQ_PATH . 'configuration' . PHPEX);
require (REQ_PATH . 'constants' . PHPEX);
require (REQ_PATH . 'extensions' . PHPEX);
-// Check for valid installation
+/**
+ * Look for a valid installation
+ */
if ( ! define ('SBB_INSTALLED') )
{
// If config not found, start installer
@@ -35,48 +46,104 @@
exit;
}
-// Include basic functions
+/**
+ * Require functions
+ */
require (INC_PATH . 'functions_general' . PHPEX);
require (INC_PATH . 'functions_handlers' . PHPEX);
-// Load required classes
+/**
+ * Require smarty templating system
+ */
+require (INC_PATH . 'smarty/Smarty.class' . PHPEX);
+
+/**
+ * Include base sources
+ */
handler_load('class_session', 'session');
handler_load('class_user', 'user');
-handler_load('class_template', 'template');
+/* Smarty is on trial atm.
+handler_load('class_template', 'template'); */
handler_load('class_dbal', 'dbal');
handler_load('class_module_loader', 'module_loader');
handler_load('class_access_control', 'acl_core');
handler_load('class_language', 'language');
-// Construct the dbal
+/**
+ * Construct the database abstraction layer
+ */
$db = new dbal(DB_LAYER);
$db->sql_connect(DB_USER, DB_PASS, DB_NAME, DB_SERVER, DB_PERSISTANT);
-// Build module, session, user, template, auth
+/**
+ * Construct some important objects
+ */
$session = new session();
$user = new user($session);
$auth = new acl_core();
-$template = new template(TPL_PATH . $user->_get_current_template() . '/');
+/* Removed for smarty
+$template = new template(TPL_PATH . $user->_get_current_template() . '/'); */
$language = new language($user->data['user_lang']);
$module = new module_loader(MOD_PATH);
-// Build the current object
+/**
+ * Build the smarty object
+ *
+ * @link http://smarty.php.net
+ */
+$template = new Smarty; // Construct the smarty template object
+$template->plugin_dir = (INC_PATH . 'smarty/plugins/'); // Set the plugins directory
+$template->template_dir = (TPL_PATH . $user->_get_current_template() . '/'); // Set the template directory
+$template->cache_dir = ($template->template_dir . 'cache/'); // Set the caching directory
+$template->compile_dir = ($template->template_dir . 'compile/'); // Set the template compilation directory
+$template->config_dir = ($template->template_dir . 'config/'); // Set the configuration directory
+$template->debugging = false; // Turn debugging console off
+$template->compile_check = true; // Turn the compile check on
+$template->caching = true; // Turn overall caching on
+$template->force_compile = false; // Never force compiling
+
+/**
+ * Assign some important information to smarty
+ */
+$template->assign('user', $user);
+$template->assign('session', $session);
+$template->assign('constants', array(
+ 'guest_id' => UNREGISTERED,
+ 'root_path' => ROOT_PATH,
+ 'inc_path' => INC_PATH,
+ 'tpl_path' => $template->template_dir,
+ 'req_path' => REQ_PATH,
+ 'lang_path' => LANG_PATH . $user->lang['user_lang'] . '/',
+ 'mod_path' => MOD_PATH,
+ 'plug_path' => PLUG_PATH);
+
+/**
+ * Load the active module
+ */
$this_module = ( isset ( $_GET['module'] ) ) ? $_GET['module'] : false;
$module->load_module($this_module);
-// Deconstruct objects
+/**
+ * Unload the modules, close the db connection
+ */
$module->deconstruct();
-// $db->sql_close();
+$db->sql_close();
-// Stop output buffering and output
+/**
+ * Stop output buffering and output
+ */
$output = ob_get_contents();
ob_end_clean();
echo $output;
-// Source code highlighting
+/**
+ * Source code highlighting
+ */
highlight_file(__FILE__);
-// Exit the script
+/**
+ * Bye!
+ */
exit;
?>
\ No newline at end of file
Modified: branch/sources/class_module_loader.php
===================================================================
--- branch/sources/class_module_loader.php 2006-12-05 07:55:32 UTC (rev 77)
+++ branch/sources/class_module_loader.php 2006-12-05 08:38:00 UTC (rev 78)
@@ -107,7 +107,7 @@
// Look for main
if ( ! in_array ( 'main', $this->mod_list ) )
{
- trigger_error('module_main_missing');
+ trigger_error('Module_default_missing');
exit;
}
@@ -148,11 +148,17 @@
return $this->mod_list;
}
+ /**
+ * Unsets a module and calls the "deconstruct" method if exists
+ */
function deconstruct()
{
+ if ( method_exists($this->module, 'deconstruct') )
+ {
+ $this->module->deconstruct();
+ }
+
unset($this->module);
-
- return;
}
}
Added: branch/sources/smarty/Config_File.class.php
===================================================================
--- branch/sources/smarty/Config_File.class.php (rev 0)
+++ branch/sources/smarty/Config_File.class.php 2006-12-05 08:38:00 UTC (rev 78)
@@ -0,0 +1,389 @@
+<?php
+
+/**
+ * Config_File class.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ *
+ * @link http://smarty.php.net/
+ * @version 2.6.15
+ * @copyright Copyright: 2001-2005 New Digital Group, Inc.
+ * @author Andrei Zmievski <an...@ph...>
+ * @access public
+ * @package Smarty
+ */
+
+/* $Id$ */
+
+/**
+ * Config file reading class
+ * @package Smarty
+ */
+class Config_File {
+ /**#@+
+ * Options
+ * @var boolean
+ */
+ /**
+ * Controls whether variables with the same name overwrite each other.
+ */
+ var $overwrite = true;
+
+ /**
+ * Controls whether config values of on/true/yes and off/false/no get
+ * converted to boolean values automatically.
+ */
+ var $booleanize = true;
+
+ /**
+ * Controls whether hidden config sections/vars are read from the file.
+ */
+ var $read_hidden = true;
+
+ /**
+ * Controls whether or not to fix mac or dos formatted newlines.
+ * If set to true, \r or \r\n will be changed to \n.
+ */
+ var $fix_newlines = true;
+ /**#@-*/
+
+ /** @access private */
+ var $_config_path = "";
+ var $_config_data = array();
+ /**#@-*/
+
+ /**
+ * Constructs a new config file class.
+ *
+ * @param string $config_path (optional) path to the config files
+ */
+ function Config_File($config_path = NULL)
+ {
+ if (isset($config_path))
+ $this->set_path($config_path);
+ }
+
+
+ /**
+ * Set the path where configuration files can be found.
+ *
+ * @param string $config_path path to the config files
+ */
+ function set_path($config_path)
+ {
+ if (!empty($config_path)) {
+ if (!is_string($config_path) || !file_exists($config_path) || !is_dir($config_path)) {
+ $this->_trigger_error_msg("Bad config file path '$config_path'");
+ return;
+ }
+ if(substr($config_path, -1) != DIRECTORY_SEPARATOR) {
+ $config_path .= DIRECTORY_SEPARATOR;
+ }
+
+ $this->_config_path = $config_path;
+ }
+ }
+
+
+ /**
+ * Retrieves config info based on the file, section, and variable name.
+ *
+ * @param string $file_name config file to get info for
+ * @param string $section_name (optional) section to get info for
+ * @param string $var_name (optional) variable to get info for
+ * @return string|array a value or array of values
+ */
+ function get($file_name, $section_name = NULL, $var_name = NULL)
+ {
+ if (empty($file_name)) {
+ $this->_trigger_error_msg('Empty config file name');
+ return;
+ } else {
+ $file_name = $this->_config_path . $file_name;
+ if (!isset($this->_config_data[$file_name]))
+ $this->load_file($file_name, false);
+ }
+
+ if (!empty($var_name)) {
+ if (empty($section_name)) {
+ return $this->_config_data[$file_name]["vars"][$var_name];
+ } else {
+ if(isset($this->_config_data[$file_name]["sections"][$section_name]["vars"][$var_name]))
+ return $this->_config_data[$file_name]["sections"][$section_name]["vars"][$var_name];
+ else
+ return array();
+ }
+ } else {
+ if (empty($section_name)) {
+ return (array)$this->_config_data[$file_name]["vars"];
+ } else {
+ if(isset($this->_config_data[$file_name]["sections"][$section_name]["vars"]))
+ return (array)$this->_config_data[$file_name]["sections"][$section_name]["vars"];
+ else
+ return array();
+ }
+ }
+ }
+
+
+ /**
+ * Retrieves config info based on the key.
+ *
+ * @param $file_name string config key (filename/section/var)
+ * @return string|array same as get()
+ * @uses get() retrieves information from config file and returns it
+ */
+ function &get_key($config_key)
+ {
+ list($file_name, $section_name, $var_name) = explode('/', $config_key, 3);
+ $result = &$this->get($file_name, $section_name, $var_name);
+ return $result;
+ }
+
+ /**
+ * Get all loaded config file names.
+ *
+ * @return array an array of loaded config file names
+ */
+ function get_file_names()
+ {
+ return array_keys($this->_config_data);
+ }
+
+
+ /**
+ * Get all section names from a loaded file.
+ *
+ * @param string $file_name config file to get section names from
+ * @return array an array of section names from the specified file
+ */
+ function get_section_names($file_name)
+ {
+ $file_name = $this->_config_path . $file_name;
+ if (!isset($this->_config_data[$file_name])) {
+ $this->_trigger_error_msg("Unknown config file '$file_name'");
+ return;
+ }
+
+ return array_keys($this->_config_data[$file_name]["sections"]);
+ }
+
+
+ /**
+ * Get all global or section variable names.
+ *
+ * @param string $file_name config file to get info for
+ * @param string $section_name (optional) section to get info for
+ * @return array an array of variables names from the specified file/section
+ */
+ function get_var_names($file_name, $section = NULL)
+ {
+ if (empty($file_name)) {
+ $this->_trigger_error_msg('Empty config file name');
+ return;
+ } else if (!isset($this->_config_data[$file_name])) {
+ $this->_trigger_error_msg("Unknown config file '$file_name'");
+ return;
+ }
+
+ if (empty($section))
+ return array_keys($this->_config_data[$file_name]["vars"]);
+ else
+ return array_keys($this->_config_data[$file_name]["sections"][$section]["vars"]);
+ }
+
+
+ /**
+ * Clear loaded config data for a certain file or all files.
+ *
+ * @param string $file_name file to clear config data for
+ */
+ function clear($file_name = NULL)
+ {
+ if ($file_name === NULL)
+ $this->_config_data = array();
+ else if (isset($this->_config_data[$file_name]))
+ $this->_config_data[$file_name] = array();
+ }
+
+
+ /**
+ * Load a configuration file manually.
+ *
+ * @param string $file_name file name to load
+ * @param boolean $prepend_path whether current config path should be
+ * prepended to the filename
+ */
+ function load_file($file_name, $prepend_path = true)
+ {
+ if ($prepend_path && $this->_config_path != "")
+ $config_file = $this->_config_path . $file_name;
+ else
+ $config_file = $file_name;
+
+ ini_set('track_errors', true);
+ $fp = @fopen($config_file, "r");
+ if (!is_resource($fp)) {
+ $this->_trigger_error_msg("Could not open config file '$config_file'");
+ return false;
+ }
+
+ $contents = ($size = filesize($config_file)) ? fread($fp, $size) : '';
+ fclose($fp);
+
+ $this->_config_data[$config_file] = $this->parse_contents($contents);
+ return true;
+ }
+
+ /**
+ * Store the contents of a file manually.
+ *
+ * @param string $config_file file name of the related contents
+ * @param string $contents the file-contents to parse
+ */
+ function set_file_contents($config_file, $contents)
+ {
+ $this->_config_data[$config_file] = $this->parse_contents($contents);
+ return true;
+ }
+
+ /**
+ * parse the source of a configuration file manually.
+ *
+ * @param string $contents the file-contents to parse
+ */
+ function parse_contents($contents)
+ {
+ if($this->fix_newlines) {
+ // fix mac/dos formatted newlines
+ $contents = preg_replace('!\r\n?!', "\n", $contents);
+ }
+
+ $config_data = array();
+ $config_data['sections'] = array();
+ $config_data['vars'] = array();
+
+ /* reference to fill with data */
+ $vars =& $config_data['vars'];
+
+ /* parse file line by line */
+ preg_match_all('!^.*\r?\n?!m', $contents, $match);
+ $lines = $match[0];
+ for ($i=0, $count=count($lines); $i<$count; $i++) {
+ $line = $lines[$i];
+ if (empty($line)) continue;
+
+ if ( substr($line, 0, 1) == '[' && preg_match('!^\[(.*?)\]!', $line, $match) ) {
+ /* section found */
+ if (substr($match[1], 0, 1) == '.') {
+ /* hidden section */
+ if ($this->read_hidden) {
+ $section_name = substr($match[1], 1);
+ } else {
+ /* break reference to $vars to ignore hidden section */
+ unset($vars);
+ $vars = array();
+ continue;
+ }
+ } else {
+ $section_name = $match[1];
+ }
+ if (!isset($config_data['sections'][$section_name]))
+ $config_data['sections'][$section_name] = array('vars' => array());
+ $vars =& $config_data['sections'][$section_name]['vars'];
+ continue;
+ }
+
+ if (preg_match('/^\s*(\.?\w+)\s*=\s*(.*)/s', $line, $match)) {
+ /* variable found */
+ $var_name = rtrim($match[1]);
+ if (strpos($match[2], '"""') === 0) {
+ /* handle multiline-value */
+ $lines[$i] = substr($match[2], 3);
+ $var_value = '';
+ while ($i<$count) {
+ if (($pos = strpos($lines[$i], '"""')) === false) {
+ $var_value .= $lines[$i++];
+ } else {
+ /* end of multiline-value */
+ $var_value .= substr($lines[$i], 0, $pos);
+ break;
+ }
+ }
+ $booleanize = false;
+
+ } else {
+ /* handle simple value */
+ $var_value = preg_replace('/^([\'"])(.*)\1$/', '\2', rtrim($match[2]));
+ $booleanize = $this->booleanize;
+
+ }
+ $this->_set_config_var($vars, $var_name, $var_value, $booleanize);
+ }
+ /* else unparsable line / means it is a comment / means ignore it */
+ }
+ return $config_data;
+ }
+
+ /**#@+ @access private */
+ /**
+ * @param array &$container
+ * @param string $var_name
+ * @param mixed $var_value
+ * @param boolean $booleanize determines whether $var_value is converted to
+ * to true/false
+ */
+ function _set_config_var(&$container, $var_name, $var_value, $booleanize)
+ {
+ if (substr($var_name, 0, 1) == '.') {
+ if (!$this->read_hidden)
+ return;
+ else
+ $var_name = substr($var_name, 1);
+ }
+
+ if (!preg_match("/^[a-zA-Z_]\w*$/", $var_name)) {
+ $this->_trigger_error_msg("Bad variable name '$var_name'");
+ return;
+ }
+
+ if ($booleanize) {
+ if (preg_match("/^(on|true|yes)$/i", $var_value))
+ $var_value = true;
+ else if (preg_match("/^(off|false|no)$/i", $var_value))
+ $var_value = false;
+ }
+
+ if (!isset($container[$var_name]) || $this->overwrite)
+ $container[$var_name] = $var_value;
+ else {
+ settype($container[$var_name], 'array');
+ $container[$var_name][] = $var_value;
+ }
+ }
+
+ /**
+ * @uses trigger_error() creates a PHP warning/error
+ * @param string $error_msg
+ * @param integer $error_type one of
+ */
+ function _trigger_error_msg($error_msg, $error_type = E_USER_WARNING)
+ {
+ trigger_error("Config_File error: $error_msg", $error_type);
+ }
+ /**#@-*/
+}
+
+?>
Property changes on: branch/sources/smarty/Config_File.class.php
___________________________________________________________________
Name: svn:keywords
+ Author Date Id Revision
Name: svn:eol-style
+ native
Added: branch/sources/smarty/Smarty.class.php
===================================================================
--- branch/sources/smarty/Smarty.class.php (rev 0)
+++ branch/sources/smarty/Smarty.class.php 2006-12-05 08:38:00 UTC (rev 78)
@@ -0,0 +1,1944 @@
+<?php
+
+/**
+ * Project: Smarty: the PHP compiling template engine
+ * File: Smarty.class.php
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ *
+ * For questions, help, comments, discussion, etc., please join the
+ * Smarty mailing list. Send a blank e-mail to
+ * sma...@li...
+ *
+ * @link http://smarty.php.net/
+ * @copyright 2001-2005 New Digital Group, Inc.
+ * @author Monte Ohrt <monte at ohrt dot com>
+ * @author Andrei Zmievski <an...@ph...>
+ * @package Smarty
+ * @version 2.6.15
+ */
+
+/* $Id$ */
+
+/**
+ * DIR_SEP isn't used anymore, but third party apps might
+ */
+if(!defined('DIR_SEP')) {
+ define('DIR_SEP', DIRECTORY_SEPARATOR);
+}
+
+/**
+ * set SMARTY_DIR to absolute path to Smarty library files.
+ * if not defined, include_path will be used. Sets SMARTY_DIR only if user
+ * application has not already defined it.
+ */
+
+if (!defined('SMARTY_DIR')) {
+ define('SMARTY_DIR', dirname(__FILE__) . DIRECTORY_SEPARATOR);
+}
+
+if (!defined('SMARTY_CORE_DIR')) {
+ define('SMARTY_CORE_DIR', SMARTY_DIR . 'internals' . DIRECTORY_SEPARATOR);
+}
+
+define('SMARTY_PHP_PASSTHRU', 0);
+define('SMARTY_PHP_QUOTE', 1);
+define('SMARTY_PHP_REMOVE', 2);
+define('SMARTY_PHP_ALLOW', 3);
+
+/**
+ * @package Smarty
+ */
+class Smarty
+{
+ /**#@+
+ * Smarty Configuration Section
+ */
+
+ /**
+ * The name of the directory where templates are located.
+ *
+ * @var string
+ */
+ var $template_dir = 'templates';
+
+ /**
+ * The directory where compiled templates are located.
+ *
+ * @var string
+ */
+ var $compile_dir = 'templates_c';
+
+ /**
+ * The directory where config files are located.
+ *
+ * @var string
+ */
+ var $config_dir = 'configs';
+
+ /**
+ * An array of directories searched for plugins.
+ *
+ * @var array
+ */
+ var $plugins_dir = array('plugins');
+
+ /**
+ * If debugging is enabled, a debug console window will display
+ * when the page loads (make sure your browser allows unrequested
+ * popup windows)
+ *
+ * @var boolean
+ */
+ var $debugging = false;
+
+ /**
+ * When set, smarty does uses this value as error_reporting-level.
+ *
+ * @var boolean
+ */
+ var $error_reporting = null;
+
+ /**
+ * This is the path to the debug console template. If not set,
+ * the default one will be used.
+ *
+ * @var string
+ */
+ var $debug_tpl = '';
+
+ /**
+ * This determines if debugging is enable-able from the browser.
+ * <ul>
+ * <li>NONE => no debugging control allowed</li>
+ * <li>URL => enable debugging when SMARTY_DEBUG is found in the URL.</li>
+ * </ul>
+ * @link http://www.foo.dom/index.php?SMARTY_DEBUG
+ * @var string
+ */
+ var $debugging_ctrl = 'NONE';
+
+ /**
+ * This tells Smarty whether to check for recompiling or not. Recompiling
+ * does not need to happen unless a template or config file is changed.
+ * Typically you enable this during development, and disable for
+ * production.
+ *
+ * @var boolean
+ */
+ var $compile_check = true;
+
+ /**
+ * This forces templates to compile every time. Useful for development
+ * or debugging.
+ *
+ * @var boolean
+ */
+ var $force_compile = false;
+
+ /**
+ * This enables template caching.
+ * <ul>
+ * <li>0 = no caching</li>
+ * <li>1 = use class cache_lifetime value</li>
+ * <li>2 = use cache_lifetime in cache file</li>
+ * </ul>
+ * @var integer
+ */
+ var $caching = 0;
+
+ /**
+ * The name of the directory for cache files.
+ *
+ * @var string
+ */
+ var $cache_dir = 'cache';
+
+ /**
+ * This is the number of seconds cached content will persist.
+ * <ul>
+ * <li>0 = always regenerate cache</li>
+ * <li>-1 = never expires</li>
+ * </ul>
+ *
+ * @var integer
+ */
+ var $cache_lifetime = 3600;
+
+ /**
+ * Only used when $caching is enabled. If true, then If-Modified-Since headers
+ * are respected with cached content, and appropriate HTTP headers are sent.
+ * This way repeated hits to a cached page do not send the entire page to the
+ * client every time.
+ *
+ * @var boolean
+ */
+ var $cache_modified_check = false;
+
+ /**
+ * This determines how Smarty handles "<?php ... ?>" tags in templates.
+ * possible values:
+ * <ul>
+ * <li>SMARTY_PHP_PASSTHRU -> print tags as plain text</li>
+ * <li>SMARTY_PHP_QUOTE -> escape tags as entities</li>
+ * <li>SMARTY_PHP_REMOVE -> remove php tags</li>
+ * <li>SMARTY_PHP_ALLOW -> execute php tags</li>
+ * </ul>
+ *
+ * @var integer
+ */
+ var $php_handling = SMARTY_PHP_PASSTHRU;
+
+ /**
+ * This enables template security. When enabled, many things are restricted
+ * in the templates that normally would go unchecked. This is useful when
+ * untrusted parties are editing templates and you want a reasonable level
+ * of security. (no direct execution of PHP in templates for example)
+ *
+ * @var boolean
+ */
+ var $security = false;
+
+ /**
+ * This is the list of template directories that are considered secure. This
+ * is used only if {@link $security} is enabled. One directory per array
+ * element. {@link $template_dir} is in this list implicitly.
+ *
+ * @var array
+ */
+ var $secure_dir = array();
+
+ /**
+ * These are the security settings for Smarty. They are used only when
+ * {@link $security} is enabled.
+ *
+ * @var array
+ */
+ var $security_settings = array(
+ 'PHP_HANDLING' => false,
+ 'IF_FUNCS' => array('array', 'list',
+ 'isset', 'empty',
+ 'count', 'sizeof',
+ 'in_array', 'is_array',
+ 'true', 'false', 'null'),
+ 'INCLUDE_ANY' => false,
+ 'PHP_TAGS' => false,
+ 'MODIFIER_FUNCS' => array('count'),
+ 'ALLOW_CONSTANTS' => false
+ );
+
+ /**
+ * This is an array of directories where trusted php scripts reside.
+ * {@link $security} is disabled during their inclusion/execution.
+ *
+ * @var array
+ */
+ var $trusted_dir = array();
+
+ /**
+ * The left delimiter used for the template tags.
+ *
+ * @var string
+ */
+ var $left_delimiter = '{';
+
+ /**
+ * The right delimiter used for the template tags.
+ *
+ * @var string
+ */
+ var $right_delimiter = '}';
+
+ /**
+ * The order in which request variables are registered, similar to
+ * variables_order in php.ini E = Environment, G = GET, P = POST,
+ * C = Cookies, S = Server
+ *
+ * @var string
+ */
+ var $request_vars_order = 'EGPCS';
+
+ /**
+ * Indicates wether $HTTP_*_VARS[] (request_use_auto_globals=false)
+ * are uses as request-vars or $_*[]-vars. note: if
+ * request_use_auto_globals is true, then $request_vars_order has
+ * no effect, but the php-ini-value "gpc_order"
+ *
+ * @var boolean
+ */
+ var $request_use_auto_globals = true;
+
+ /**
+ * Set this if you want different sets of compiled files for the same
+ * templates. This is useful for things like different languages.
+ * Instead of creating separate sets of templates per language, you
+ * set different compile_ids like 'en' and 'de'.
+ *
+ * @var string
+ */
+ var $compile_id = null;
+
+ /**
+ * This tells Smarty whether or not to use sub dirs in the cache/ and
+ * templates_c/ directories. sub directories better organized, but
+ * may not work well with PHP safe mode enabled.
+ *
+ * @var boolean
+ *
+ */
+ var $use_sub_dirs = false;
+
+ /**
+ * This is a list of the modifiers to apply to all template variables.
+ * Put each modifier in a separate array element in the order you want
+ * them applied. example: <code>array('escape:"htmlall"');</code>
+ *
+ * @var array
+ */
+ var $default_modifiers = array();
+
+ /**
+ * This is the resource type to be used when not specified
+ * at the beginning of the resource path. examples:
+ * $smarty->display('file:index.tpl');
+ * $smarty->display('db:index.tpl');
+ * $smarty->display('index.tpl'); // will use default resource type
+ * {include file="file:index.tpl"}
+ * {include file="db:index.tpl"}
+ * {include file="index.tpl"} {* will use default resource type *}
+ *
+ * @var array
+ */
+ var $default_resource_type = 'file';
+
+ /**
+ * The function used for cache file handling. If not set, built-in caching is used.
+ *
+ * @var null|string function name
+ */
+ var $cache_handler_func = null;
+
+ /**
+ * This indicates which filters are automatically loaded into Smarty.
+ *
+ * @var array array of filter names
+ */
+ var $autoload_filters = array();
+
+ /**#@+
+ * @var boolean
+ */
+ /**
+ * This tells if config file vars of the same name overwrite each other or not.
+ * if disabled, same name variables are accumulated in an array.
+ */
+ var $config_overwrite = true;
+
+ /**
+ * This tells whether or not to automatically booleanize config file variables.
+ * If enabled, then the strings "on", "true", and "yes" are treated as boolean
+ * true, and "off", "false" and "no" are treated as boolean false.
+ */
+ var $config_booleanize = true;
+
+ /**
+ * This tells whether hidden sections [.foobar] are readable from the
+ * tempalates or not. Normally you would never allow this since that is
+ * the point behind hidden sections: the application can access them, but
+ * the templates cannot.
+ */
+ var $config_read_hidden = false;
+
+ /**
+ * This tells whether or not automatically fix newlines in config files.
+ * It basically converts \r (mac) or \r\n (dos) to \n
+ */
+ var $config_fix_newlines = true;
+ /**#@-*/
+
+ /**
+ * If a template cannot be found, this PHP function will be executed.
+ * Useful for creating templates on-the-fly or other special action.
+ *
+ * @var string function name
+ */
+ var $default_template_handler_func = '';
+
+ /**
+ * The file that contains the compiler class. This can a full
+ * pathname, or relative to the php_include path.
+ *
+ * @var string
+ */
+ var $compiler_file = 'Smarty_Compiler.class.php';
+
+ /**
+ * The class used for compiling templates.
+ *
+ * @var string
+ */
+ var $compiler_class = 'Smarty_Compiler';
+
+ /**
+ * The class used to load config vars.
+ *
+ * @var string
+ */
+ var $config_class = 'Config_File';
+
+/**#@+
+ * END Smarty Configuration Section
+ * There should be no need to touch anything below this line.
+ * @access private
+ */
+ /**
+ * where assigned template vars are kept
+ *
+ * @var array
+ */
+ var $_tpl_vars = array();
+
+ /**
+ * stores run-time $smarty.* vars
+ *
+ * @var null|array
+ */
+ var $_smarty_vars = null;
+
+ /**
+ * keeps track of sections
+ *
+ * @var array
+ */
+ var $_sections = array();
+
+ /**
+ * keeps track of foreach blocks
+ *
+ * @var array
+ */
+ var $_foreach = array();
+
+ /**
+ * keeps track of tag hierarchy
+ *
+ * @var array
+ */
+ var $_tag_stack = array();
+
+ /**
+ * configuration object
+ *
+ * @var Config_file
+ */
+ var $_conf_obj = null;
+
+ /**
+ * loaded configuration settings
+ *
+ * @var array
+ */
+ var $_config = array(array('vars' => array(), 'files' => array()));
+
+ /**
+ * md5 checksum of the string 'Smarty'
+ *
+ * @var string
+ */
+ var $_smarty_md5 = 'f8d698aea36fcbead2b9d5359ffca76f';
+
+ /**
+ * Smarty version number
+ *
+ * @var string
+ */
+ var $_version = '2.6.15';
+
+ /**
+ * current template inclusion depth
+ *
+ * @var integer
+ */
+ var $_inclusion_depth = 0;
+
+ /**
+ * for different compiled templates
+ *
+ * @var string
+ */
+ var $_compile_id = null;
+
+ /**
+ * text in URL to enable debug mode
+ *
+ * @var string
+ */
+ var $_smarty_debug_id = 'SMARTY_DEBUG';
+
+ /**
+ * debugging information for debug console
+ *
+ * @var array
+ */
+ var $_smarty_debug_info = array();
+
+ /**
+ * info that makes up a cache file
+ *
+ * @var array
+ */
+ var $_cache_info = array();
+
+ /**
+ * default file permissions
+ *
+ * @var integer
+ */
+ var $_file_perms = 0644;
+
+ /**
+ * default dir permissions
+ *
+ * @var integer
+ */
+ var $_dir_perms = 0771;
+
+ /**
+ * registered objects
+ *
+ * @var array
+ */
+ var $_reg_objects = array();
+
+ /**
+ * table keeping track of plugins
+ *
+ * @var array
+ */
+ var $_plugins = array(
+ 'modifier' => array(),
+ 'function' => array(),
+ 'block' => array(),
+ 'compiler' => array(),
+ 'prefilter' => array(),
+ 'postfilter' => array(),
+ 'outputfilter' => array(),
+ 'resource' => array(),
+ 'insert' => array());
+
+
+ /**
+ * cache serials
+ *
+ * @var array
+ */
+ var $_cache_serials = array();
+
+ /**
+ * name of optional cache include file
+ *
+ * @var string
+ */
+ var $_cache_include = null;
+
+ /**
+ * indicate if the current code is used in a compiled
+ * include
+ *
+ * @var string
+ */
+ var $_cache_including = false;
+
+ /**#@-*/
+ /**
+ * The class constructor.
+ */
+ function Smarty()
+ {
+ $this->assign('SCRIPT_NAME', isset($_SERVER['SCRIPT_NAME']) ? $_SERVER['SCRIPT_NAME']
+ : @$GLOBALS['HTTP_SERVER_VARS']['SCRIPT_NAME']);
+ }
+
+ /**
+ * assigns values to template variables
+ *
+ * @param array|string $tpl_var the template variable name(s)
+ * @param mixed $value the value to assign
+ */
+ function assign($tpl_var, $value = null)
+ {
+ if (is_array($tpl_var)){
+ foreach ($tpl_var as $key => $val) {
+ if ($key != '') {
+ $this->_tpl_vars[$key] = $val;
+ }
+ }
+ } else {
+ if ($tpl_var != '')
+ $this->_tpl_vars[$tpl_var] = $value;
+ }
+ }
+
+ /**
+ * assigns values to template variables by reference
+ *
+ * @param string $tpl_var the template variable name
+ * @param mixed $value the referenced value to assign
+ */
+ function assign_by_ref($tpl_var, &$value)
+ {
+ if ($tpl_var != '')
+ $this->_tpl_vars[$tpl_var] = &$value;
+ }
+
+ /**
+ * appends values to template variables
+ *
+ * @param array|string $tpl_var the template variable name(s)
+ * @param mixed $value the value to append
+ */
+ function append($tpl_var, $value=null, $merge=false)
+ {
+ if (is_array($tpl_var)) {
+ // $tpl_var is an array, ignore $value
+ foreach ($tpl_var as $_key => $_val) {
+ if ($_key != '') {
+ if(!@is_array($this->_tpl_vars[$_key])) {
+ settype($this->_tpl_vars[$_key],'array');
+ }
+ if($merge && is_array($_val)) {
+ foreach($_val as $_mkey => $_mval) {
+ $this->_tpl_vars[$_key][$_mkey] = $_mval;
+ }
+ } else {
+ $this->_tpl_vars[$_key][] = $_val;
+ }
+ }
+ }
+ } else {
+ if ($tpl_var != '' && isset($value)) {
+ if(!@is_array($this->_tpl_vars[$tpl_var])) {
+ settype($this->_tpl_vars[$tpl_var],'array');
+ }
+ if($merge && is_array($value)) {
+ foreach($value as $_mkey => $_mval) {
+ $this->_tpl_vars[$tpl_var][$_mkey] = $_mval;
+ }
+ } else {
+ $this->_tpl_vars[$tpl_var][] = $value;
+ }
+ }
+ }
+ }
+
+ /**
+ * appends values to template variables by reference
+ *
+ * @param string $tpl_var the template variable name
+ * @param mixed $value the referenced value to append
+ */
+ function append_by_ref($tpl_var, &$value, $merge=false)
+ {
+ if ($tpl_var != '' && isset($value)) {
+ if(!@is_array($this->_tpl_vars[$tpl_var])) {
+ settype($this->_tpl_vars[$tpl_var],'array');
+ }
+ if ($merge && is_array($value)) {
+ foreach($value as $_key => $_val) {
+ $this->_tpl_vars[$tpl_var][$_key] = &$value[$_key];
+ }
+ } else {
+ $this->_tpl_vars[$tpl_var][] = &$value;
+ }
+ }
+ }
+
+
+ /**
+ * clear the given assigned template variable.
+ *
+ * @param string $tpl_var the template variable to clear
+ */
+ function clear_assign($tpl_var)
+ {
+ if (is_array($tpl_var))
+ foreach ($tpl_var as $curr_var)
+ unset($this->_tpl_vars[$curr_var]);
+ else
+ unset($this->_tpl_vars[$tpl_var]);
+ }
+
+
+ /**
+ * Registers custom function to be used in templates
+ *
+ * @param string $function the name of the template function
+ * @param string $function_impl the name of the PHP function to register
+ */
+ function register_function($function, $function_impl, $cacheable=true, $cache_attrs=null)
+ {
+ $this->_plugins['function'][$function] =
+ array($function_impl, null, null, false, $cacheable, $cache_attrs);
+
+ }
+
+ /**
+ * Unregisters custom function
+ *
+ * @param string $function name of template function
+ */
+ function unregister_function($function)
+ {
+ unset($this->_plugins['function'][$function]);
+ }
+
+ /**
+ * Registers object to be used in templates
+ *
+ * @param string $object name of template object
+ * @param object &$object_impl the referenced PHP object to register
+ * @param null|array $allowed list of allowed methods (empty = all)
+ * @param boolean $smarty_args smarty argument format, else traditional
+ * @param null|array $block_functs list of methods that are block format
+ */
+ function register_object($object, &$object_impl, $allowed = array(), $smarty_args = true, $block_methods = array())
+ {
+ settype($allowed, 'array');
+ settype($smarty_args, 'boolean');
+ $this->_reg_objects[$object] =
+ array(&$object_impl, $allowed, $smarty_args, $block_methods);
+ }
+
+ /**
+ * Unregisters object
+ *
+ * @param string $object name of template object
+ */
+ function unregister_object($object)
+ {
+ unset($this->_reg_objects[$object]);
+ }
+
+
+ /**
+ * Registers block function to be used in templates
+ *
+ * @param string $block name of template block
+ * @param string $block_impl PHP function to register
+ */
+ function register_block($block, $block_impl, $cacheable=true, $cache_attrs=null)
+ {
+ $this->_plugins['block'][$block] =
+ array($block_impl, null, null, false, $cacheable, $cache_attrs);
+ }
+
+ /**
+ * Unregisters block function
+ *
+ * @param string $block name of template function
+ */
+ function unregister_block($block)
+ {
+ unset($this->_plugins['block'][$block]);
+ }
+
+ /**
+ * Registers compiler function
+ *
+ * @param string $function name of template function
+ * @param string $function_impl name of PHP function to register
+ */
+ function register_compiler_function($function, $function_impl, $cacheable=true)
+ {
+ $this->_plugins['compiler'][$function] =
+ array($function_impl, null, null, false, $cacheable);
+ }
+
+ /**
+ * Unregisters compiler function
+ *
+ * @param string $function name of template function
+ */
+ function unregister_compiler_function($function)
+ {
+ unset($this->_plugins['compiler'][$function]);
+ }
+
+ /**
+ * Registers modifier to be used in templates
+ *
+ * @param string $modifier name of template modifier
+ * @param string $modifier_impl name of PHP function to register
+ */
+ function register_modifier($modifier, $modifier_impl)
+ {
+ $this->_plugins['modifier'][$modifier] =
+ array($modifier_impl, null, null, false);
+ }
+
+ /**
+ * Unregisters modifier
+ *
+ * @param string $modifier name of template modifier
+ */
+ function unregister_modifier($modifier)
+ {
+ unset($this->_plugins['modifier'][$modifier]);
+ }
+
+ /**
+ * Registers a resource to fetch a template
+ *
+ * @param string $type name of resource
+ * @param array $functions array of functions to handle resource
+ */
+ function register_resource($type, $functions)
+ {
+ if (count($functions)==4) {
+ $this->_plugins['resource'][$type] =
+ array($functions, false);
+
+ } elseif (count($functions)==5) {
+ $this->_plugins['resource'][$type] =
+ array(array(array(&$functions[0], $functions[1])
+ ,array(&$functions[0], $functions[2])
+ ,array(&$functions[0], $functions[3])
+ ,array(&$functions[0], $functions[4]))
+ ,false);
+
+ } else {
+ $this->trigger_error("malformed function-list for '$type' in register_resource");
+
+ }
+ }
+
+ /**
+ * Unregisters a resource
+ *
+ * @param string $type name of resource
+ */
+ function unregister_resource($type)
+ {
+ unset($this->_plugins['resource'][$type]);
+ }
+
+ /**
+ * Registers a prefilter function to apply
+ * to a template before compiling
+ *
+ * @param string $function name of PHP function to register
+ */
+ function register_prefilter($function)
+ {
+ $_name = (is_array($function)) ? $function[1] : $function;
+ $this->_plugins['prefilter'][$_name]
+ = array($function, null, null, false);
+ }
+
+ /**
+ * Unregisters a prefilter function
+ *
+ * @param string $function name of PHP function
+ */
+ function unregister_prefilter($function)
+ {
+ unset($this->_plugins['prefilter'][$function]);
+ }
+
+ /**
+ * Registers a postfilter function to apply
+ * to a compiled template after compilation
+ *
+ * @param string $function name of PHP function to register
+ */
+ function register_postfilter($function)
+ {
+ $_name = (is_array($function)) ? $function[1] : $function;
+ $this->_plugins['postfilter'][$_name]
+ = array($function, null, null, false);
+ }
+
+ /**
+ * Unregisters a postfilter function
+ *
+ * @param string $function name of PHP function
+ */
+ function unregister_postfilter($function)
+ {
+ unset($this->_plugins['postfilter'][$function]);
+ }
+
+ /**
+ * Registers an output filter function to apply
+ * to a template output
+ *
+ * @param string $function name of PHP function
+ */
+ function register_outputfilter($function)
+ {
+ $_name = (is_array($function)) ? $function[1] : $function;
+ $this->_plugins['outputfilter'][$_name]
+ = array($function, null, null, false);
+ }
+
+ /**
+ * Unregisters an outputfilter function
+ *
+ * @param string $function name of PHP function
+ */
+ function unregister_outputfilter($function)
+ {
+ unset($this->_plugins['outputfilter'][$function]);
+ }
+
+ /**
+ * load a filter of specified type and name
+ *
+ * @param string $type filter type
+ * @param string $name filter name
+ */
+ function load_filter($type, $name)
+ {
+ switch ($type) {
+ case 'output':
+ $_params = array('plugins' => array(array($type . 'filter', $name, null, null, false)));
+ require_once(SMARTY_CORE_DIR . 'core.load_plugins.php');
+ smarty_core_load_plugins($_params, $this);
+ break;
+
+ case 'pre':
+ case 'post':
+ if (!isset($this->_plugins[$type . 'filter'][$name]))
+ $this->_plugins[$type . 'filter'][$name] = false;
+ break;
+ }
+ }
+
+ /**
+ * clear cached content for the given template and cache id
+ *
+ * @param string $tpl_file name of template file
+ * @param string $cache_id name of cache_id
+ * @param string $compile_id name of compile_id
+ * @param string $exp_time expiration time
+ * @return boolean
+ */
+ function clear_cache($tpl_file = null, $cache_id = null, $compile_id = null, $exp_time = null)
+ {
+
+ if (!isset($compile_id))
+ $compile_id = $this->compile_id;
+
+ if (!isset($tpl_file))
+ $compile_id = null;
+
+ $_auto_id = $this->_get_auto_id($cache_id, $compile_id);
+
+ if (!empty($this->cache_handler_func)) {
+ return call_user_func_array($this->cache_handler_func,
+ array('clear', &$this, &$dummy, $tpl_file, $cache_id, $compile_id, $exp_time));
+ } else {
+ $_params = array('auto_base' => $this->cache_dir,
+ 'auto_source' => $tpl_file,
+ 'auto_id' => $_auto_id,
+ 'exp_time' => $exp_time);
+ require_once(SMARTY_CORE_DIR . 'core.rm_auto.php');
+ return smarty_core_rm_auto($_params, $this);
+ }
+
+ }
+
+
+ /**
+ * clear the entire contents of cache (all templates)
+ *
+ * @param string $exp_time expire time
+ * @return boolean results of {@link smarty_core_rm_auto()}
+ */
+ function clear_all_cache($exp_time = null)
+ {
+ return $this->clear_cache(null, null, null, $exp_time);
+ }
+
+
+ /**
+ * test to see if valid cache exists for this template
+ *
+ * @param string $tpl_file name of template file
+ * @param string $cache_id
+ * @param string $compile_id
+ * @return string|false results of {@link _read_cache_file()}
+ */
+ function is_cached($tpl_file, $cache_id = null, $compile_id = null)
+ {
+ if (!$this->caching)
+ return false;
+
+ if (!isset($compile_id))
+ $compile_id = $this->compile_id;
+
+ $_params = array(
+ 'tpl_file' => $tpl_file,
+ 'cache_id' => $cache_id,
+ 'compile_id' => $compile_id
+ );
+ require_once(SMARTY_CORE_DIR . 'core.read_cache_file.php');
+ return smarty_core_read_cache_file($_params, $this);
+ }
+
+
+ /**
+ * clear all the assigned template variables.
+ *
+ */
+ function clear_all_assign()
+ {
+ $this->_tpl_vars = array();
+ }
+
+ /**
+ * clears compiled version of specified template resource,
+ * or all compiled template files if one is not specified.
+ * This function is for advanced use only, not normally needed.
+ *
+ * @param string $tpl_file
+ * @param string $compile_id
+ * @param string $exp_time
+ * @return boolean results of {@link smarty_core_rm_auto()}
+ */
+ function clear_compiled_tpl($tpl_file = null, $compile_id = null, $exp_time = null)
+ {
+ if (!isset($compile_id)) {
+ $compile_id = $this->compile_id;
+ }
+ $_params = array('auto_base' => $this->compile_dir,
+ 'auto_source' => $tpl_file,
+ 'auto_id' => $compile_id,
+ 'exp_time' => $exp_time,
+ 'extensions' => array('.inc', '.php'));
+ require_once(SMARTY_CORE_DIR . 'core.rm_auto.php');
+ return smarty_core_rm_auto($_params, $this);
+ }
+
+ /**
+ * Checks whether requested template exists.
+ *
+ * @param string $tpl_file
+ * @return boolean
+ */
+ function template_exists($tpl_file)
+ {
+ $_params = array('resource_name' => $tpl_file, 'quiet'=>true, 'get_source'=>false);
+ return $this->_fetch_resource_info($_params);
+ }
+
+ /**
+ * Returns an array containing template variables
+ *
+ * @param string $name
+ * @param string $type
+ * @return array
+ */
+ function &get_template_vars($name=null)
+ {
+ if(!isset($name)) {
+ return $this->_tpl_vars;
+ } elseif(isset($this->_tpl_vars[$name])) {
+ return $this->_tpl_vars[$name];
+ } else {
+ // var non-existant, return valid reference
+ $_tmp = null;
+ return $_tmp;
+ }
+ }
+
+ /**
+ * Returns an array containing config variables
+ *
+ * @param string $name
+ * @param string $type
+ * @return array
+ */
+ function &get_config_vars($name=null)
+ {
+ if(!isset($name) && is_array($this->_config[0])) {
+ return $this->_config[0]['vars'];
+ } else if(isset($this->_config[0]['vars'][$name])) {
+ return $this->_config[0]['vars'][$name];
+ } else {
+ // var non-existant, return valid reference
+ $_tmp = null;
+ return $_tmp;
+ }
+ }
+
+ /**
+ * trigger Smarty error
+ *
+ * @param string $error_msg
+ * @param integer $error_type
+ */
+ function trigger_error($error_msg, $error_type = E_USER_WARNING)
+ {
+ trigger_error("Smarty error: $error_msg", $error_type);
+ }
+
+
+ /**
+ * executes & displays the template results
+ *
+ * @param string $resource_name
+ * @param string $cache_id
+ * @param string $compile_id
+ */
+ function display($resource_name, $cache_id = null, $compile_id = null)
+ {
+ $this->fetch($resource_name, $cache_id, $compile_id, true);
+ }
+
+ /**
+ * executes & returns or displays the template results
+ *
+ * @param string $resource_name
+ * @param string $cache_id
+ * @param string $compile_id
+ * @param boolean $display
+ */
+ function fetch($resource_name, $cache_id = null, $compile_id = null, $display = false)
+ {
+ static $_cache_info = array();
+
+ $_smarty_old_error_level = $this->debugging ? error_reporting() : error_reporting(isset($this->error_reporting)
+ ? $this->error_reporting : error_reporting() & ~E_NOTICE);
+
+ if (!$this->debugging && $this->debugging_ctrl == 'URL') {
+ $_query_string = $this->request_use_auto_globals ? $_SERVER['QUERY_STRING'] : $GLOBALS['HTTP_SERVER_VARS']['QUERY_STRING'];
+ if (@strstr($_query_string, $this->_smarty_debug_id)) {
+ if (@strstr($_query_string, $this->_smarty_debug_id . '=on')) {
+ // enable debugging for this browser session
+ @setcookie('SMARTY_DEBUG', true);
+ $this->debugging = true;
+ } elseif (@strstr($_query_string, $this->_smarty_debug_id . '=off')) {
+ // disable debugging for this browser session
+ @setcookie('SMARTY_DEBUG', false);
+ $this->debugging = false;
+ } else {
+ // enable debugging for this page
+ $this->debugging = true;
+ }
+ } else {
+ $this->debugging = (bool)($this->request_use_auto_globals ? @$_COOKIE['SMARTY_DEBUG'] : @$GLOBALS['HTTP_COOKIE_VARS']['SMARTY_DEBUG']);
+ }
+ }
+
+ if ($this->debugging) {
+ // capture time for debugging info
+ $_params = array();
+ require_once(SMARTY_CORE_DIR . 'core.get_microtime.php');
+ $_debug_start_time = smarty_core_get_microtime($_params, $this);
+ $this->_smarty_debug_info[] = array('type' => 'template',
+ 'filename' => $resource_name,
+ 'depth' => 0);
+ $_included_tpls_idx = count($this->_smarty_debug_info) - 1;
+ }
+
+ if (!isset($compile_id)) {
+ $compile_id = $this->compile_id;
+ }
+
+ $this->_compile_id = $compile_id;
+ $this->_inclusion_depth = 0;
+
+ if ($this->caching) {
+ // save old cache_info, initialize cache_info
+ array_push($_cache_info, $this->_cache_info);
+ $this->_cache_info = array();
+ $_params = array(
+ 'tpl_file' => $resource_name,
+ 'cache_id' => $cache_id,
+ 'compile_id' => $compile_id,
+ 'results' => null
+ );
+ require_once(SMARTY_CORE_DIR . 'core.read_cache_file.php');
+ if (smarty_core_read_cache_file($_params, $this)) {
+ $_smarty_results = $_params['results'];
+ if (!empty($this->_cache_info['insert_tags'])) {
+ $_params = array('plugins' => $this->_cache_info['insert_tags']);
+ require_once(SMARTY_CORE_DIR . 'core.load_plugins.php');
+ smarty_core_load_plugins($_params, $this);
+ $_params = array('results' => $_smarty_results);
+ requ...
[truncated message content] |
|
From: <aft...@us...> - 2006-12-05 07:55:36
|
Revision: 77
http://svn.sourceforge.net/shuttlebb/?rev=77&view=rev
Author: afterlife69
Date: 2006-12-04 23:55:32 -0800 (Mon, 04 Dec 2006)
Log Message:
-----------
added basic structure for installer
Modified Paths:
--------------
branch/index.php
branch/require/configuration.php
Added Paths:
-----------
branch/install/
branch/install/index.php
branch/install/sources/
branch/install/sources/functions_install.php
branch/install/sources/index.html
branch/install/sql/
branch/install/sql/index.html
branch/install/sql/mysql_data.sql
branch/install/sql/mysql_schema.sql
Removed Paths:
-------------
branch/db_schema.sql
Deleted: branch/db_schema.sql
===================================================================
--- branch/db_schema.sql 2006-12-04 13:29:48 UTC (rev 76)
+++ branch/db_schema.sql 2006-12-05 07:55:32 UTC (rev 77)
@@ -1,39 +0,0 @@
-CREATE TABLE `sbb_users` (
- `user_id` int(255) NOT NULL auto_increment,
- `username` varchar(255) NOT NULL,
- `password` varchar(32) NOT NULL,
- `user_email` text NOT NULL,
- `user_active` tinyint(1) NOT NULL,
- `user_code` varchar(12) NOT NULL,
- `user_msn` varchar(255) default NULL,
- `user_icq` int(255) default NULL,
- `user_yim` varchar(255) default NULL,
- `user_aim` varchar(255) default NULL,
- `user_sig` text collate latin1_general_ci,
- `user_rank` int(255) NOT NULL,
- `user_web` varchar(255) default NULL,
- `user_ip` varchar(255) NOT NULL,
- PRIMARY KEY (`user_id`)
-);
-
-CREATE TABLE `sbb_config` (
- `config_key` varchar(90) NOT NULL,
- `config_value` text NOT NULL,
- PRIMARY KEY (`config_key`)
-);
-
-CREATE TABLE `sbb_session_keys` (
- `key_name` varchar(16) NOT NULL,
- `key_expire` int(90) NOT NULL,
- `user_id` int(255) NOT NULL,
- PRIMARY KEY (`key_name`)
-);
-
-CREATE TABLE `sbb_sessions` (
- `session_id` varchar(32) NOT NULL,
- `session_ip` varchar(15) NOT NULL,
- `session_agent` varchar(255) NOT NULL,
- `session_time` int(20) NOT NULL,
- `session_page` int(10) NOT NULL,
- `user_id` int(255) NOT NULL
-);
\ No newline at end of file
Modified: branch/index.php
===================================================================
--- branch/index.php 2006-12-04 13:29:48 UTC (rev 76)
+++ branch/index.php 2006-12-05 07:55:32 UTC (rev 77)
@@ -23,12 +23,22 @@
ob_start();
// Include required sources
-require ( REQ_PATH . 'configuration' . PHPEX );
-require ( REQ_PATH . 'constants' . PHPEX );
-require ( REQ_PATH . 'extensions' . PHPEX );
-require ( INC_PATH . 'functions_general' . PHPEX );
-require ( INC_PATH . 'functions_handlers' . PHPEX );
+require (REQ_PATH . 'configuration' . PHPEX);
+require (REQ_PATH . 'constants' . PHPEX);
+require (REQ_PATH . 'extensions' . PHPEX);
+// Check for valid installation
+if ( ! define ('SBB_INSTALLED') )
+{
+ // If config not found, start installer
+ require (ROOT_PATH . 'install/index' . PHPEX);
+ exit;
+}
+
+// Include basic functions
+require (INC_PATH . 'functions_general' . PHPEX);
+require (INC_PATH . 'functions_handlers' . PHPEX);
+
// Load required classes
handler_load('class_session', 'session');
handler_load('class_user', 'user');
@@ -38,9 +48,6 @@
handler_load('class_access_control', 'acl_core');
handler_load('class_language', 'language');
-// Construct required objects
-
-
// Construct the dbal
$db = new dbal(DB_LAYER);
$db->sql_connect(DB_USER, DB_PASS, DB_NAME, DB_SERVER, DB_PERSISTANT);
Added: branch/install/index.php
===================================================================
--- branch/install/index.php (rev 0)
+++ branch/install/index.php 2006-12-05 07:55:32 UTC (rev 77)
@@ -0,0 +1,25 @@
+<?php
+/**
+ * ShuttleBB Installer
+ *
+ * $Id$
+ * $Rev$
+ * $Date$
+ */
+
+if ( ! defined ( 'IN_SBB' ) )
+{
+ return;
+}
+
+if ( defined ( 'SBB_INSTALLED' ) )
+{
+ return;
+}
+
+// Get installer functions
+require (ROOT_PATH . 'install/sources/functions_install' . PHPEX);
+
+echo 'Placeholder';
+
+?>
\ No newline at end of file
Property changes on: branch/install/index.php
___________________________________________________________________
Name: svn:keywords
+ Author Date Id Revision
Name: svn:eol-style
+ native
Added: branch/install/sources/functions_install.php
===================================================================
--- branch/install/sources/functions_install.php (rev 0)
+++ branch/install/sources/functions_install.php 2006-12-05 07:55:32 UTC (rev 77)
@@ -0,0 +1,22 @@
+<?php
+/**
+ * Required functions for installer
+ *
+ * $Id$
+ * $Rev$
+ * $Date$
+ */
+
+if ( ! defined ( 'IN_SBB' ) )
+{
+ return;
+}
+
+if ( defined ( 'SBB_INSTALLED' ) )
+{
+ return;
+}
+
+echo 'Placeholder';
+
+?>
\ No newline at end of file
Property changes on: branch/install/sources/functions_install.php
___________________________________________________________________
Name: svn:keywords
+ Author Date Id Revision
Name: svn:eol-style
+ native
Added: branch/install/sources/index.html
===================================================================
Property changes on: branch/install/sources/index.html
___________________________________________________________________
Name: svn:keywords
+ Author Date Id Revision
Name: svn:eol-style
+ native
Added: branch/install/sql/index.html
===================================================================
Property changes on: branch/install/sql/index.html
___________________________________________________________________
Name: svn:keywords
+ Author Date Id Revision
Name: svn:eol-style
+ native
Added: branch/install/sql/mysql_data.sql
===================================================================
Property changes on: branch/install/sql/mysql_data.sql
___________________________________________________________________
Name: svn:keywords
+ Author Date Id Revision
Name: svn:eol-style
+ native
Added: branch/install/sql/mysql_schema.sql
===================================================================
--- branch/install/sql/mysql_schema.sql (rev 0)
+++ branch/install/sql/mysql_schema.sql 2006-12-05 07:55:32 UTC (rev 77)
@@ -0,0 +1,39 @@
+CREATE TABLE `sbb_users` (
+ `user_id` int(255) NOT NULL auto_increment,
+ `username` varchar(255) NOT NULL,
+ `password` varchar(32) NOT NULL,
+ `user_email` text NOT NULL,
+ `user_active` tinyint(1) NOT NULL,
+ `user_code` varchar(12) NOT NULL,
+ `user_msn` varchar(255) default NULL,
+ `user_icq` int(255) default NULL,
+ `user_yim` varchar(255) default NULL,
+ `user_aim` varchar(255) default NULL,
+ `user_sig` text collate latin1_general_ci,
+ `user_rank` int(255) NOT NULL,
+ `user_web` varchar(255) default NULL,
+ `user_ip` varchar(255) NOT NULL,
+ PRIMARY KEY (`user_id`)
+);
+
+CREATE TABLE `sbb_config` (
+ `config_key` varchar(90) NOT NULL,
+ `config_value` text NOT NULL,
+ PRIMARY KEY (`config_key`)
+);
+
+CREATE TABLE `sbb_session_keys` (
+ `key_name` varchar(16) NOT NULL,
+ `key_expire` int(90) NOT NULL,
+ `user_id` int(255) NOT NULL,
+ PRIMARY KEY (`key_name`)
+);
+
+CREATE TABLE `sbb_sessions` (
+ `session_id` varchar(32) NOT NULL,
+ `session_ip` varchar(15) NOT NULL,
+ `session_agent` varchar(255) NOT NULL,
+ `session_time` int(20) NOT NULL,
+ `session_page` int(10) NOT NULL,
+ `user_id` int(255) NOT NULL
+);
\ No newline at end of file
Property changes on: branch/install/sql/mysql_schema.sql
___________________________________________________________________
Name: svn:keywords
+ Author Date Id Revision
Name: svn:eol-style
+ native
Modified: branch/require/configuration.php
===================================================================
--- branch/require/configuration.php 2006-12-04 13:29:48 UTC (rev 76)
+++ branch/require/configuration.php 2006-12-05 07:55:32 UTC (rev 77)
@@ -9,6 +9,8 @@
* $Rev$
*/
+define('SBB_INSTALLED', 1);
+
define('DB_USER', 'root');
define('DB_PASS', '');
define('DB_NAME', 'sbb');
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <aft...@us...> - 2006-12-04 13:29:53
|
Revision: 76
http://svn.sourceforge.net/shuttlebb/?rev=76&view=rev
Author: afterlife69
Date: 2006-12-04 05:29:48 -0800 (Mon, 04 Dec 2006)
Log Message:
-----------
dumb the schema in a db called "sbb" and run :)
Modified Paths:
--------------
branch/index.php
branch/require/configuration.php
branch/sources/class_user.php
branch/sources/dbal/dbal_mysql.php
branch/sources/dbal/dbal_mysqli.php
Added Paths:
-----------
branch/db_schema.sql
Added: branch/db_schema.sql
===================================================================
--- branch/db_schema.sql (rev 0)
+++ branch/db_schema.sql 2006-12-04 13:29:48 UTC (rev 76)
@@ -0,0 +1,39 @@
+CREATE TABLE `sbb_users` (
+ `user_id` int(255) NOT NULL auto_increment,
+ `username` varchar(255) NOT NULL,
+ `password` varchar(32) NOT NULL,
+ `user_email` text NOT NULL,
+ `user_active` tinyint(1) NOT NULL,
+ `user_code` varchar(12) NOT NULL,
+ `user_msn` varchar(255) default NULL,
+ `user_icq` int(255) default NULL,
+ `user_yim` varchar(255) default NULL,
+ `user_aim` varchar(255) default NULL,
+ `user_sig` text collate latin1_general_ci,
+ `user_rank` int(255) NOT NULL,
+ `user_web` varchar(255) default NULL,
+ `user_ip` varchar(255) NOT NULL,
+ PRIMARY KEY (`user_id`)
+);
+
+CREATE TABLE `sbb_config` (
+ `config_key` varchar(90) NOT NULL,
+ `config_value` text NOT NULL,
+ PRIMARY KEY (`config_key`)
+);
+
+CREATE TABLE `sbb_session_keys` (
+ `key_name` varchar(16) NOT NULL,
+ `key_expire` int(90) NOT NULL,
+ `user_id` int(255) NOT NULL,
+ PRIMARY KEY (`key_name`)
+);
+
+CREATE TABLE `sbb_sessions` (
+ `session_id` varchar(32) NOT NULL,
+ `session_ip` varchar(15) NOT NULL,
+ `session_agent` varchar(255) NOT NULL,
+ `session_time` int(20) NOT NULL,
+ `session_page` int(10) NOT NULL,
+ `user_id` int(255) NOT NULL
+);
\ No newline at end of file
Property changes on: branch/db_schema.sql
___________________________________________________________________
Name: svn:keywords
+ Author Date Id Revision
Name: svn:eol-style
+ native
Modified: branch/index.php
===================================================================
--- branch/index.php 2006-12-04 13:17:07 UTC (rev 75)
+++ branch/index.php 2006-12-04 13:29:48 UTC (rev 76)
@@ -35,6 +35,8 @@
handler_load('class_template', 'template');
handler_load('class_dbal', 'dbal');
handler_load('class_module_loader', 'module_loader');
+handler_load('class_access_control', 'acl_core');
+handler_load('class_language', 'language');
// Construct required objects
Modified: branch/require/configuration.php
===================================================================
--- branch/require/configuration.php 2006-12-04 13:17:07 UTC (rev 75)
+++ branch/require/configuration.php 2006-12-04 13:29:48 UTC (rev 76)
@@ -13,6 +13,7 @@
define('DB_PASS', '');
define('DB_NAME', 'sbb');
define('DB_SERVER', 'localhost');
+define('DB_LAYER', 'mysql');
define('DB_PERSISTANT', 1);
define('DB_PREFIX', 'sbb_');
Modified: branch/sources/class_user.php
===================================================================
--- branch/sources/class_user.php 2006-12-04 13:17:07 UTC (rev 75)
+++ branch/sources/class_user.php 2006-12-04 13:29:48 UTC (rev 76)
@@ -312,7 +312,7 @@
$db->sql_query('DELETE FROM ' . SESSIONS_KEY_TABLE . ' WHERE user_id = ' . (int) $this->session->data['user_id']);
}
- return $db->sql_update(SESSIONS_TABLE, array('user_id' => UNREGISTERED), false, false, 'session_id = \'' . $db->sql_escape($this->session->sid) . '\'')
+ return $db->sql_update(SESSIONS_TABLE, array('user_id' => UNREGISTERED), false, false, 'session_id = \'' . $db->sql_escape($this->session->sid) . '\'');
}
/**
Modified: branch/sources/dbal/dbal_mysql.php
===================================================================
--- branch/sources/dbal/dbal_mysql.php 2006-12-04 13:17:07 UTC (rev 75)
+++ branch/sources/dbal/dbal_mysql.php 2006-12-04 13:29:48 UTC (rev 76)
@@ -22,6 +22,7 @@
class dbal_mysql
{
var $conn_id;
+ var $queries;
function dbal_mysql()
{
@@ -31,6 +32,8 @@
exit;
}
+ $this->queries = array();
+
return;
}
@@ -51,7 +54,8 @@
function sql_query($sql)
{
// exec sql query
- return @mysql_query($sql, $this->conn_id);
+ $this->queries[] = @mysql_query($sql, $this->conn_id);
+ return array_pop($this->queries);
}
function sql_fetchrow($result, $type)
Modified: branch/sources/dbal/dbal_mysqli.php
===================================================================
--- branch/sources/dbal/dbal_mysqli.php 2006-12-04 13:17:07 UTC (rev 75)
+++ branch/sources/dbal/dbal_mysqli.php 2006-12-04 13:29:48 UTC (rev 76)
@@ -22,6 +22,7 @@
class dbal_mysqli
{
var $conn_id;
+ var $queries;
function dbal_mysqli()
{
@@ -31,6 +32,9 @@
trigger_error('Error_DB_Extension');
exit;
}
+
+ $this->queries = array();
+
return;
}
@@ -50,7 +54,8 @@
function sql_query($sql)
{
// exec sql query
- return $this->conn_id->query($sql);
+ $this->queries[] = $this->conn_id->query($sql);
+ return array_pop($this->queries);
}
function sql_fetchrow($result, $type)
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <aft...@us...> - 2006-12-04 13:17:09
|
Revision: 75
http://svn.sourceforge.net/shuttlebb/?rev=75&view=rev
Author: afterlife69
Date: 2006-12-04 05:17:07 -0800 (Mon, 04 Dec 2006)
Log Message:
-----------
constants!
Modified Paths:
--------------
branch/index.php
branch/require/configuration.php
Added Paths:
-----------
branch/require/constants.php
Modified: branch/index.php
===================================================================
--- branch/index.php 2006-12-04 07:40:32 UTC (rev 74)
+++ branch/index.php 2006-12-04 13:17:07 UTC (rev 75)
@@ -24,6 +24,7 @@
// Include required sources
require ( REQ_PATH . 'configuration' . PHPEX );
+require ( REQ_PATH . 'constants' . PHPEX );
require ( REQ_PATH . 'extensions' . PHPEX );
require ( INC_PATH . 'functions_general' . PHPEX );
require ( INC_PATH . 'functions_handlers' . PHPEX );
Modified: branch/require/configuration.php
===================================================================
--- branch/require/configuration.php 2006-12-04 07:40:32 UTC (rev 74)
+++ branch/require/configuration.php 2006-12-04 13:17:07 UTC (rev 75)
@@ -9,9 +9,9 @@
* $Rev$
*/
-define('DB_USER', '');
+define('DB_USER', 'root');
define('DB_PASS', '');
-define('DB_NAME', 'database');
+define('DB_NAME', 'sbb');
define('DB_SERVER', 'localhost');
define('DB_PERSISTANT', 1);
define('DB_PREFIX', 'sbb_');
Added: branch/require/constants.php
===================================================================
--- branch/require/constants.php (rev 0)
+++ branch/require/constants.php 2006-12-04 13:17:07 UTC (rev 75)
@@ -0,0 +1,27 @@
+<?php
+/**
+ * ShuttleBB Constants File
+ *
+ * Defines the constants and variables needed for the system to init.
+ *
+ * $Id$
+ * $Date$
+ * $Rev$
+ */
+
+if ( ! defined ( 'IN_SBB' ) )
+{
+ return;
+}
+
+//
+// Table definitions
+//
+define('SESSIONS_TABLE', DB_PREFIX . 'sessions');
+define('SESSIONS_KEY_TABLE', DB_PREFIX . 'session_keys');
+define('USERS_TABLE', DB_PREFIX . 'users');
+define('CONFIG_TABLE', DB_PREFIX . 'config');
+define('BBCODE_TABLE', DB_PREFIX . 'bbcode');
+define('ACL_TABLE', DB_PREFIX . 'acl');
+
+?>
\ No newline at end of file
Property changes on: branch/require/constants.php
___________________________________________________________________
Name: svn:keywords
+ Author Date Id Revision
Name: svn:eol-style
+ native
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <aft...@us...> - 2006-12-04 07:40:33
|
Revision: 74
http://svn.sourceforge.net/shuttlebb/?rev=74&view=rev
Author: afterlife69
Date: 2006-12-03 23:40:32 -0800 (Sun, 03 Dec 2006)
Log Message:
-----------
removed unneeded file
Removed Paths:
-------------
branch/sources/class_modules.php
Deleted: branch/sources/class_modules.php
===================================================================
--- branch/sources/class_modules.php 2006-12-04 07:38:33 UTC (rev 73)
+++ branch/sources/class_modules.php 2006-12-04 07:40:32 UTC (rev 74)
@@ -1,8 +0,0 @@
-<?php
-/**
- * $Id$
- * $Date$
- * $Rev$
- */
-
-?>
\ No newline at end of file
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <aft...@us...> - 2006-12-04 07:38:35
|
Revision: 73
http://svn.sourceforge.net/shuttlebb/?rev=73&view=rev
Author: afterlife69
Date: 2006-12-03 23:38:33 -0800 (Sun, 03 Dec 2006)
Log Message:
-----------
Modified Paths:
--------------
branch/sources/class_bbcode.php
Modified: branch/sources/class_bbcode.php
===================================================================
--- branch/sources/class_bbcode.php 2006-12-04 07:17:51 UTC (rev 72)
+++ branch/sources/class_bbcode.php 2006-12-04 07:38:33 UTC (rev 73)
@@ -50,11 +50,16 @@
*/
function transform($text)
{
- $tags = this->select();
- for ( $i = 0; $i < count($tags); $i++ ){
- preg_replace ( $tags[$i]['regex'], $tags[$i]['replace'], $text );
+ $tags = $this->select();
+
+ $find = $replace = array();
+ for ( $i = 0; $i < count($tags); $i++ )
+ {
+ $find[] = $tags[$i]['bbcode_regex'];
+ $replace[] = $tags[$i]['bbcode_replace'];
}
- return $text;
+
+ return preg_replace ( $find, $replace, $text );;
}
/**
@@ -64,9 +69,9 @@
*/
function select()
{
- $sql = 'SELECT tag, replace, regex FROM bbcodes';
- $result = sql_query($sql);
- return sql_fetchrow($result, 'assoc');
+ $sql = 'SELECT bbcode_tag, bbcode_regex, bbcode_replace FROM ' . BBCODE_TABLE . ' WHERE bbcode_active = 1';
+ $result = $db->sql_query($sql);
+ return $db->sql_fetchrowset($result, 'assoc');
}
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <bla...@us...> - 2006-12-04 07:17:53
|
Revision: 72
http://svn.sourceforge.net/shuttlebb/?rev=72&view=rev
Author: blazes816
Date: 2006-12-03 23:17:51 -0800 (Sun, 03 Dec 2006)
Log Message:
-----------
Select and transform functions added.
Modified Paths:
--------------
branch/sources/class_bbcode.php
Modified: branch/sources/class_bbcode.php
===================================================================
--- branch/sources/class_bbcode.php 2006-12-04 03:53:33 UTC (rev 71)
+++ branch/sources/class_bbcode.php 2006-12-04 07:17:51 UTC (rev 72)
@@ -50,6 +50,11 @@
*/
function transform($text)
{
+ $tags = this->select();
+ for ( $i = 0; $i < count($tags); $i++ ){
+ preg_replace ( $tags[$i]['regex'], $tags[$i]['replace'], $text );
+ }
+ return $text;
}
/**
@@ -59,6 +64,9 @@
*/
function select()
{
+ $sql = 'SELECT tag, replace, regex FROM bbcodes';
+ $result = sql_query($sql);
+ return sql_fetchrow($result, 'assoc');
}
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <aft...@us...> - 2006-12-04 03:53:34
|
Revision: 71
http://svn.sourceforge.net/shuttlebb/?rev=71&view=rev
Author: afterlife69
Date: 2006-12-03 19:53:33 -0800 (Sun, 03 Dec 2006)
Log Message:
-----------
doh! security helps.
Modified Paths:
--------------
branch/plugins/Hello_World.php
Modified: branch/plugins/Hello_World.php
===================================================================
--- branch/plugins/Hello_World.php 2006-12-04 03:52:36 UTC (rev 70)
+++ branch/plugins/Hello_World.php 2006-12-04 03:53:33 UTC (rev 71)
@@ -8,6 +8,16 @@
*/
/**
+ * Standard security
+ *
+ * This prevents the plugin from being executed directly.
+ */
+if ( ! defined ( 'IN_SBB' ) )
+{
+ return;
+}
+
+/**
* This is a basic "Hello World" function that the hooks system will execute.
*/
function hello_world($date = 0)
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <aft...@us...> - 2006-12-04 03:52:41
|
Revision: 70
http://svn.sourceforge.net/shuttlebb/?rev=70&view=rev
Author: afterlife69
Date: 2006-12-03 19:52:36 -0800 (Sun, 03 Dec 2006)
Log Message:
-----------
Example module and hook added with intense documentation.
Modified Paths:
--------------
branch/module/module_main.php
Added Paths:
-----------
branch/plugins/
branch/plugins/Hello_World.php
branch/plugins/index.html
Modified: branch/module/module_main.php
===================================================================
--- branch/module/module_main.php 2006-12-04 03:31:14 UTC (rev 69)
+++ branch/module/module_main.php 2006-12-04 03:52:36 UTC (rev 70)
@@ -1,21 +1,104 @@
<?php
/**
+ * ShuttleBB "Hello World" Module.
+ *
* $Id$
* $Date$
* $Rev$
*/
+/**
+ * Standard security
+ *
+ * This prevents the module from being executed directly.
+ */
+if ( ! defined ( 'IN_SBB' ) )
+{
+ return;
+}
+
+/**
+ * C/C++ Programmers will pick up the module system very fast, it is based on filename
+ * and gos as followed: module_x.php becomes class:module_x and is constructed on init
+ * the constructor (function with the same name as the class) is called when the object
+ * is constructed (go figure).
+ *
+ * Just like C/C++, the default module is "main" or module_main, this is called when a
+ * module is not found, or there is no module defined. All module authors are expected
+ * to use the phpDoc syntax when packing their modules, and if they require external
+ * sources, the sources should be stored in a directory inside the modules folder with
+ * the same name as the module itself (ie, module_main would have the directory "main").
+ *
+ * When external sources are used, their package must be the same as the "subpackage"
+ * name used on the base module (in this case "main") and the subpackage would be their
+ * actual package name.
+ *
+ * @package shuttlebb
+ * @subpackage main
+ * @author Dean Newman <web...@au...>
+ */
class module_main
{
+ /**
+ *
+ */
function module_main()
{
- global $user, $ses;
-
- // construct the user object
- $user = new user();
+ // All pre-init sources
+ global $session;
+ global $user;
+ global $module;
+ global $language;
+ global $auth;
+ global $template;
+ // Start module proper
echo 'Hello World!';
+
+ // Init another class in this module
+ new module_main_required();
+
+ // Call a function
+ random_function();
+
+ return;
}
}
+/**
+ * Is it possible to execute commands outside of the module class
+ * however this is not permitted by the module coding standards
+ * which are provided with the documents in the package you downloaded
+ */
+echo 'This is not permitted!';
+
+/**
+ * However, you may include other classes or functions in your module.
+ */
+class module_main_required
+{
+ function module_main_required()
+ {
+ echo 'This is permitted';
+ }
+}
+
+function random_function()
+{
+ echo 'Wow, A function!';
+}
+
+/**
+ * Also, constants can also be added to your module, however you must
+ * follow the coding standards to ensure the constant is uppercase with
+ * underscores to seperate words.
+ */
+define('MY_CONSTANT', 'value!');
+
+/**
+ * As a final note, these rules only apply if you are planning to release
+ * your module to the shuttlebb community.
+ */
+return;
+
?>
\ No newline at end of file
Added: branch/plugins/Hello_World.php
===================================================================
--- branch/plugins/Hello_World.php (rev 0)
+++ branch/plugins/Hello_World.php 2006-12-04 03:52:36 UTC (rev 70)
@@ -0,0 +1,26 @@
+<?php
+/**
+ * Basic "Hello World" Plugin that hooks the index.
+ *
+ * $Id$
+ * $Rev$
+ * $Date$
+ */
+
+/**
+ * This is a basic "Hello World" function that the hooks system will execute.
+ */
+function hello_world($date = 0)
+{
+ echo 'Hello World, The current date is ' . ($date) ? date('d-m-Y', $date) : date('d-m-Y') . '.';
+}
+
+/**
+ * The "register" method requires 2 parameters ($handle, $function) and everything after
+ * that is used as a parameter for the function call.
+ * For a full list of hooks, see {@link http://shuttlebb.com/coming_soon}
+ */
+hooks::register('index/login', 'hello_world'); // This hook does not call the parameter
+hooks::register('index/statistics', 'hello_world', time()); // This hook does call the parameter
+
+?>
\ No newline at end of file
Property changes on: branch/plugins/Hello_World.php
___________________________________________________________________
Name: svn:keywords
+ Author Date Id Revision
Name: svn:eol-style
+ native
Added: branch/plugins/index.html
===================================================================
Property changes on: branch/plugins/index.html
___________________________________________________________________
Name: svn:keywords
+ Author Date Id Revision
Name: svn:eol-style
+ native
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <aft...@us...> - 2006-12-04 03:31:15
|
Revision: 69
http://svn.sourceforge.net/shuttlebb/?rev=69&view=rev
Author: afterlife69
Date: 2006-12-03 19:31:14 -0800 (Sun, 03 Dec 2006)
Log Message:
-----------
user now accepts session as a parameter instead of global.
Modified Paths:
--------------
branch/sources/class_user.php
Modified: branch/sources/class_user.php
===================================================================
--- branch/sources/class_user.php 2006-12-04 03:22:06 UTC (rev 68)
+++ branch/sources/class_user.php 2006-12-04 03:31:14 UTC (rev 69)
@@ -37,12 +37,20 @@
* @param integer $page_id
* @return object
*/
- function user ( $page_id )
+ function user ( $session )
{
- global $session, $db, $tpl, $_GET, $config, $lng, $_COOKIE, $auth;
+ global $db;
+ global $config;
+ global $_COOKIE;
+ global $_GET;
- // Init session object
- $session = new session ( $page_id );
+ // Handle the session object
+ $this->session = ( is_object ( $session ) ) ? $session : false;
+ if ( ! $this->session )
+ {
+ global $session;
+ $this->session = $session = new session();
+ }
// Handle autologins
$session_key = ( is_string ( $_COOKIE['_autologin'] ) ) ? $db->sql_escape($_COOKIE['_autologin']) : false;
@@ -184,7 +192,8 @@
*/
function ban($user_id, $ban_type, $ban_data, $ban_reason, $ban_time)
{
- global $db, $auth, $session;
+ global $db;
+ global $auth;
$result = $db->sql_query('SELECT * FROM ' . BAN_TABLE . '
WHERE ban_type = \'' . $db->sql_escape($ban_type) . '\'
@@ -196,7 +205,7 @@
return false;
}
- if ( $session->ip == $ban_data && $ban_type == 'ip' )
+ if ( $this->session->ip == $ban_data && $ban_type == 'ip' )
{
$db->sql_freeresult($result);
return false;
@@ -264,17 +273,17 @@
*/
function login($user_id, $autologin = false)
{
- global $db, $session;
+ global $db;
$result = $db->sql_query('SELECT * FROM ' . SESSIONS_TABLE . ' WHERE user_id = ' . (int) $user_id);
while ( $row = $db->sql_fetchrow($result) )
{
- $session->purge($row['session_id']);
+ $this->session->purge($row['session_id']);
}
$db->sql_freeresult($result);
- $db->sql_update(SESSION_TABLE, array('user_id' => $user_id), false, true, 'session_id = \'' . $db->sql_escape($session->sid) . '\'');
+ $db->sql_update(SESSION_TABLE, array('user_id' => $user_id), false, true, 'session_id = \'' . $db->sql_escape($this->session->sid) . '\'');
if ( $autologin )
{
@@ -296,14 +305,14 @@
*/
function logout()
{
- global $db, $session;
+ global $db;
- if ( $session->data['user_id'] != UNREGISTERED )
+ if ( $this->session->data['user_id'] != UNREGISTERED )
{
- $db->sql_query('DELETE FROM ' . SESSIONS_KEY_TABLE . ' WHERE user_id = ' . (int) $session->data['user_id']);
+ $db->sql_query('DELETE FROM ' . SESSIONS_KEY_TABLE . ' WHERE user_id = ' . (int) $this->session->data['user_id']);
}
- return $db->sql_update(SESSIONS_TABLE, array('user_id' => 0), false, false, 'session_id = \'' . $db->sql_escape($session->sid) . '\'')
+ return $db->sql_update(SESSIONS_TABLE, array('user_id' => UNREGISTERED), false, false, 'session_id = \'' . $db->sql_escape($this->session->sid) . '\'')
}
/**
@@ -314,9 +323,9 @@
*/
function check_ban($user_id = '')
{
- global $db, $session;
+ global $db;
- $result = $db->sql_query('SELECT * FROM ' . BAN_TABLE . ' WHERE (user_id = "' . (int) $user_id . '" OR user_ip = "' . $db->sql_escape($session->ip) . '")');
+ $result = $db->sql_query('SELECT * FROM ' . BAN_TABLE . ' WHERE (user_id = "' . (int) $user_id . '" OR user_ip = "' . $db->sql_escape($this->session->ip) . '")');
if ( $db->sql_fetchrow ( $result ) )
{
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <aft...@us...> - 2006-12-04 03:22:08
|
Revision: 68
http://svn.sourceforge.net/shuttlebb/?rev=68&view=rev
Author: afterlife69
Date: 2006-12-03 19:22:06 -0800 (Sun, 03 Dec 2006)
Log Message:
-----------
further updates on user for new dbal
Modified Paths:
--------------
branch/index.php
branch/sources/class_user.php
Modified: branch/index.php
===================================================================
--- branch/index.php 2006-12-03 19:19:21 UTC (rev 67)
+++ branch/index.php 2006-12-04 03:22:06 UTC (rev 68)
@@ -16,7 +16,7 @@
define('INC_PATH', ROOT_PATH . 'sources/');
define('REQ_PATH', ROOT_PATH . 'require/');
define('LANG_PATH', ROOT_PATH . 'language/');
-define('TPL_PATH', ROOT_PATH . 'language/');
+define('TPL_PATH', ROOT_PATH . 'template/');
define('MOD_PATH', ROOT_PATH . 'module/');
// Start output buffering
@@ -36,18 +36,19 @@
handler_load('class_module_loader', 'module_loader');
// Construct required objects
-$module = new module_loader(MOD_PATH);
+
// Construct the dbal
$db = new dbal(DB_LAYER);
$db->sql_connect(DB_USER, DB_PASS, DB_NAME, DB_SERVER, DB_PERSISTANT);
-// Build session, user, template, auth
-$ses = new session();
-$user = new user();
-$auth = new acl_core();
-$tpl = new template( $user->_get_current_template() );
-$lang = new language($user->data['user_lang']);
+// Build module, session, user, template, auth
+$session = new session();
+$user = new user($session);
+$auth = new acl_core();
+$template = new template(TPL_PATH . $user->_get_current_template() . '/');
+$language = new language($user->data['user_lang']);
+$module = new module_loader(MOD_PATH);
// Build the current object
$this_module = ( isset ( $_GET['module'] ) ) ? $_GET['module'] : false;
Modified: branch/sources/class_user.php
===================================================================
--- branch/sources/class_user.php 2006-12-03 19:19:21 UTC (rev 67)
+++ branch/sources/class_user.php 2006-12-04 03:22:06 UTC (rev 68)
@@ -8,6 +8,11 @@
*/
/**
+ * This constant is used to identify "Guest" users.
+ */
+define('UNREGISTERED', -1);
+
+/**
* This class manages all aspects of the user including templates, language and sessions
*/
class user
@@ -34,38 +39,34 @@
*/
function user ( $page_id )
{
- global $ses, $db, $tpl, $_GET, $config, $lng, $_COOKIE, $auth;
+ global $session, $db, $tpl, $_GET, $config, $lng, $_COOKIE, $auth;
// Init session object
- $ses = new session ( $page_id );
+ $session = new session ( $page_id );
// Handle autologins
$session_key = ( is_string ( $_COOKIE['_autologin'] ) ) ? $db->sql_escape($_COOKIE['_autologin']) : false;
- if ( ! empty ( $session_key ) && $ses->data['user_id'] == 0 )
+ if ( ! empty ( $session_key ) && $session->data['user_id'] == UNREGISTERED )
{
- $sql = 'SELECT * FROM ' . SESSIONS_KEY_TABLE . ' WHERE key_name = \'' . $session_key . '\'';
- if ( ! $result = $db->sql_query ( $sql ) )
- {
- exit;
- }
- $session_data = $db->sql_fetchrow($result);
+ $result = $db->sql_query('SELECT * FROM ' . SESSIONS_KEY_TABLE . ' WHERE key_name = \'' . $session_key . '\'');
+ $sessiondata = $db->sql_fetchrow($result);
$db->sql_freeresult($result);
- if ( ! $session_data )
+ if ( ! $sessiondata )
{
setcookie ( '_autologin', '' );
}
else
{
- $this->login ( $session_data['user_id'] );
+ $this->login($sessiondata['user_id']);
}
}
/*
// Pull userdata based on session
- if ( isset ( $ses->data['user_id'] ) )
+ if ( isset ( $session->data['user_id'] ) )
{
- $user_id = ( $ses->data['user_id'] ) ? $ses->data['user_id'] : '0';
+ $user_id = ( $session->data['user_id'] ) ? $session->data['user_id'] : '0';
$db->sql_select(USERS_TABLE, $result, array('user_id' => (int) $user_id), false, 'ASC', false, 'user_' . (int) $user_id);
if ( ! $this->data = $db->sql_fetchrow($result) )
{
@@ -109,7 +110,7 @@
// Attempt to select the username from the database.
$sql = 'SELECT user_id, username, user_email FROM ' . USERS_TABLE . '
- WHERE username = \'' . $userdata['username'] . '\' OR user_email = \'' . $userdata['user_email'] . '\'
+ WHERE username = \'' . $db->sql_escape($userdata['username']) . '\' OR user_email = \'' . $db->sql_escape($userdata['user_email']) . '\'
ORDER by username LIMIT 1';
$result = $db->sql_query($sql);
@@ -132,7 +133,7 @@
$db->sql_freeresult($result);
// Insert data
- $db->sql_insert ( USERS_TABLE, $userdata );
+ $db->sql_insert(USERS_TABLE, $userdata, false, true);
// Return success
return 1;
@@ -148,13 +149,15 @@
function update($user_id, $array)
{
global $db;
+
// Make sure array is valid
if ( ! is_array ( $array ) )
{
return false;
}
+
// Insert data
- return $db->sql_update ( USERS_TABLE, $array, array( 'user_id' => intval ( $user_id ) ) );
+ return $db->sql_update(USERS_TABLE, $array, array('user_id' => intval ($user_id)));
}
/**
@@ -181,26 +184,25 @@
*/
function ban($user_id, $ban_type, $ban_data, $ban_reason, $ban_time)
{
- global $db, $auth, $ses;
+ global $db, $auth, $session;
+
+ $result = $db->sql_query('SELECT * FROM ' . BAN_TABLE . '
+ WHERE ban_type = \'' . $db->sql_escape($ban_type) . '\'
+ AND ban_data = \'' . $db->sql_escape($ban_data) . '\'');
- $db->sql_select ( BAN_TABLE, $result, array(
- 'ban_type' => $db->sql_escape($ban_type),
- 'ban_data' => $db->sql_escape($ban_data),
- ));
-
if ( $row = $db->sql_query($result) )
{
$db->sql_freeresult($result);
return false;
}
- if ( $ses->ip == $ban_data && $ban_type == 'ip' )
+ if ( $session->ip == $ban_data && $ban_type == 'ip' )
{
$db->sql_freeresult($result);
return false;
}
- if ( $ban_type == '' || $ban_type == 'user' )
+ if ( empty($ban_type) || $ban_type == 'user' )
{
$auth->get($ban_data);
if ( $auth->data['auth_admin'] )
@@ -208,15 +210,16 @@
return false;
}
}
+
$db->sql_freeresult($result);
- return $db->sql_insert ( BAN_TABLE, array(
- 'ban_type' => $db->sql_escape ( $ban_type ),
- 'ban_data' => $db->sql_escape ( $ban_data ),
- 'ban_reason' => $db->sql_escape ( $ban_reason ),
+ return $db->sql_insert(BAN_TABLE, array(
+ 'ban_type' => $ban_type,
+ 'ban_data' => $ban_data,
+ 'ban_reason' => $ban_reason,
'ban_time' => (int) $ban_time,
'user_id' => (int) $user_id
- ));
+ ), false, true);
}
/**
@@ -261,20 +264,17 @@
*/
function login($user_id, $autologin = false)
{
- global $db, $ses;
+ global $db, $session;
$result = $db->sql_query('SELECT * FROM ' . SESSIONS_TABLE . ' WHERE user_id = ' . (int) $user_id);
while ( $row = $db->sql_fetchrow($result) )
{
- $ses->purge($row['session_id']);
+ $session->purge($row['session_id']);
}
$db->sql_freeresult($result);
- $db->sql_update ( SESSIONS_TABLE, array (
- 'user_id' => $user_id ), array (
- 'session_id' => $ses->sid )
- );
+ $db->sql_update(SESSION_TABLE, array('user_id' => $user_id), false, true, 'session_id = \'' . $db->sql_escape($session->sid) . '\'');
if ( $autologin )
{
@@ -283,7 +283,7 @@
'key_name' => $autologin_key,
'key_expire' => 0,
'user_id' => $user_id,
- ));
+ ), false, true);
setcookie ( '_autologin', $autologin_key );
}
@@ -296,20 +296,14 @@
*/
function logout()
{
- global $db, $ses;
+ global $db, $session;
- if ( $ses->data['user_id'] != 0 )
+ if ( $session->data['user_id'] != UNREGISTERED )
{
- $db->sql_delete ( SESSIONS_KEY_TABLE, array(
- 'user_id' => $ses->data['user_id'],
- ));
+ $db->sql_query('DELETE FROM ' . SESSIONS_KEY_TABLE . ' WHERE user_id = ' . (int) $session->data['user_id']);
}
-
- $db->sql_update ( SESSIONS_TABLE, array (
- 'user_id' => '0' ), array (
- 'session_id' => $ses->sid )
- );
-
+
+ return $db->sql_update(SESSIONS_TABLE, array('user_id' => 0), false, false, 'session_id = \'' . $db->sql_escape($session->sid) . '\'')
}
/**
@@ -320,10 +314,9 @@
*/
function check_ban($user_id = '')
{
- global $db, $ses;
+ global $db, $session;
- $sql = 'SELECT * FROM ' . BAN_TABLE . ' WHERE (user_id = "' . $user_id . '" OR user_ip = "' . $ses->ip . '")';
- $result = $db->sql_query ( $sql );
+ $result = $db->sql_query('SELECT * FROM ' . BAN_TABLE . ' WHERE (user_id = "' . (int) $user_id . '" OR user_ip = "' . $db->sql_escape($session->ip) . '")');
if ( $db->sql_fetchrow ( $result ) )
{
@@ -348,8 +341,9 @@
global $db;
$result = $db->sql_query('SELECT * FROM ' . SESSIONS_TABLE . ' WHERE user_id = ' . (int) $user_id);
- $row = $db->sql_fetchrow ( $result );
+ $row = $db->sql_fetchrow($result);
$db->sql_freeresult($result);
+
return $row;
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <lor...@us...> - 2006-12-03 19:19:22
|
Revision: 67
http://svn.sourceforge.net/shuttlebb/?rev=67&view=rev
Author: lord_le_brand
Date: 2006-12-03 11:19:21 -0800 (Sun, 03 Dec 2006)
Log Message:
-----------
close the brackets next time dean :P
Modified Paths:
--------------
branch/sources/class_user.php
Modified: branch/sources/class_user.php
===================================================================
--- branch/sources/class_user.php 2006-12-03 13:45:51 UTC (rev 66)
+++ branch/sources/class_user.php 2006-12-03 19:19:21 UTC (rev 67)
@@ -166,7 +166,7 @@
function delete($user_id)
{
global $db;
- return $db->sql_query('DELETE FROM ' . USERS_TABLE . ' WHERE user_id = ' . (int) $user_id;
+ return $db->sql_query('DELETE FROM ' . USERS_TABLE . ' WHERE user_id = ' . (int) $user_id);
}
/**
@@ -228,7 +228,7 @@
function unban($ban_id)
{
global $db;
- return $db->sql_query('DELETE FROM ' . BANS_TABLE . ' WHERE ban_id = ' . (int) $ban_id;
+ return $db->sql_query('DELETE FROM ' . BANS_TABLE . ' WHERE ban_id = ' . (int) $ban_id);
}
/**
@@ -263,7 +263,7 @@
{
global $db, $ses;
- $result = $db->sql_query('SELECT * FROM ' . SESSIONS_TABLE . ' WHERE user_id = ' . (int) $user_id;
+ $result = $db->sql_query('SELECT * FROM ' . SESSIONS_TABLE . ' WHERE user_id = ' . (int) $user_id);
while ( $row = $db->sql_fetchrow($result) )
{
$ses->purge($row['session_id']);
@@ -347,7 +347,7 @@
{
global $db;
- $result = $db->sql_query('SELECT * FROM ' . SESSIONS_TABLE . ' WHERE user_id = ' . (int) $user_id;
+ $result = $db->sql_query('SELECT * FROM ' . SESSIONS_TABLE . ' WHERE user_id = ' . (int) $user_id);
$row = $db->sql_fetchrow ( $result );
$db->sql_freeresult($result);
return $row;
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <aft...@us...> - 2006-12-03 13:45:52
|
Revision: 66
http://svn.sourceforge.net/shuttlebb/?rev=66&view=rev
Author: afterlife69
Date: 2006-12-03 05:45:51 -0800 (Sun, 03 Dec 2006)
Log Message:
-----------
sessions work!
Modified Paths:
--------------
branch/sources/class_dbal.php
branch/sources/class_session.php
branch/sources/dbal/dbal_mysql.php
branch/sources/dbal/dbal_mysqli.php
Modified: branch/sources/class_dbal.php
===================================================================
--- branch/sources/class_dbal.php 2006-12-03 13:16:50 UTC (rev 65)
+++ branch/sources/class_dbal.php 2006-12-03 13:45:51 UTC (rev 66)
@@ -38,27 +38,6 @@
*/
/**
- * @todo Database Layer(s) <<<
- *
- * Each database layer must contain the following methods:
- *
- * dbal_layer::dbal_layer
- *
- * dbal_layer::sql_connect
- * dbal_layer::sql_close
- * dbal_layer::sql_query
- * dbal_layer::sql_freeresult
- * dbal_layer::sql_escape
- * dbal_layer::sql_field_info
- * dbal_layer::sql_num_rows
- * dbal_layer::sql_num_fields
- * dbal_layer::sql_info
- * dbal_layer::sql_select_db
- *
- * >>>
- */
-
-/**
* Prevent include errors
*/
if ( class_exists ( 'dbal' ) )
@@ -237,7 +216,7 @@
if ( ! $result = $this->layer->sql_query($sql) )
{
// Report a query error.
- trigger_error('Error_DB_Query(' . $sql . ')');
+ trigger_error('Error_DB_Query(' . $this->layer->sql_error($result) . ',' . $sql . ')');
}
}
Modified: branch/sources/class_session.php
===================================================================
--- branch/sources/class_session.php 2006-12-03 13:16:50 UTC (rev 65)
+++ branch/sources/class_session.php 2006-12-03 13:45:51 UTC (rev 66)
@@ -7,6 +7,11 @@
* @package sbb_core
*/
+if ( ! defined ( 'IN_SBB' ) )
+{
+ return;
+}
+
/**
* Session Emulation Class.
* This class manages sessions without using the built-in php session handler
@@ -69,7 +74,7 @@
// Set the class variables
$this->ip = ( preg_match ( '/^([0-9]{1,3})\.([0-9]{1,3})\.([0-9]{1,3})\.([0-9]{1,3})$/', $_SERVER['REMOTE_ADDR'] ) ) ? $_SERVER['REMOTE_ADDR'] : '';
$this->agent = ( isset ( $_SERVER['HTTP_USER_AGENT'] ) ) ? $_SERVER['HTTP_USER_AGENT'] : false;
- $this->page = ( ! empty ( $page_id ) ) ? $page_id : PAGE_MAIN;
+ $this->page = ( ! empty ( $page_id ) ) ? $page_id : 0;
$this->method = ( ! empty ( $_COOKIE['_sid']) ) ? 'cookie' : 'get';
$this->sid = ( $this->method == 'cookie' ) ? $_COOKIE['_sid'] : $_GET['sid'];
@@ -153,7 +158,7 @@
global $db;
// Update the session
- $db->sql_query('UPDATE TABLE ' . SESSIONS_TABLE . ' ' .
+ $db->sql_query('UPDATE ' . SESSIONS_TABLE . ' ' .
$db->sql_build_update(array(
'session_ip' => (string) $db->sql_escape($this->ip),
'session_time' => (int) time(),
Modified: branch/sources/dbal/dbal_mysql.php
===================================================================
--- branch/sources/dbal/dbal_mysql.php 2006-12-03 13:16:50 UTC (rev 65)
+++ branch/sources/dbal/dbal_mysql.php 2006-12-03 13:45:51 UTC (rev 66)
@@ -118,6 +118,11 @@
// delete field in table
return $this->sql_query("ALTER TABLE `$table` DROP `$field`");
}
+
+ function sql_error($result)
+ {
+ return @mysql_errno($result) . ':' . @mysql_error($result);
+ }
}
?>
\ No newline at end of file
Modified: branch/sources/dbal/dbal_mysqli.php
===================================================================
--- branch/sources/dbal/dbal_mysqli.php 2006-12-03 13:16:50 UTC (rev 65)
+++ branch/sources/dbal/dbal_mysqli.php 2006-12-03 13:45:51 UTC (rev 66)
@@ -37,19 +37,20 @@
function sql_connect($db_user, $db_pass, $db_name, $db_server)
{
// connect to database
- return $this->conn_id = @mysqli_connect($db_server, $db_user, $db_pass, $db_name);
+ $this->conn_id = new mysqli($db_server, $db_user, $db_pass, $db_name);
+ return ( ! mysqli_connect_errno() );
}
function sql_close()
{
// close db connection
- return @mysqli_close($this->conn_id);
+ return $this->conn_id->close();
}
function sql_query($sql)
{
// exec sql query
- return @mysqli_query($this->conn_id, $sql);
+ return $this->conn_id->query($sql);
}
function sql_fetchrow($result, $type)
@@ -58,13 +59,13 @@
{
default:
case 'assoc':
- return @mysqli_fetch_assoc($result);
+ return $result->fetch_assoc();
break;
case 'object':
- return @mysqli_fetch_object($result);
+ return $result->fetch_object();
break;
case 'index':
- return @mysqli_fetch_array($result, MYSQLI_NUM);
+ return $result->fetch_array(MYSQLI_NUM);
break;
}
}
@@ -72,37 +73,37 @@
function sql_freeresult($resource)
{
// free the sql result
- return @mysqli_free_result($resource);
+ return $result->close();
}
function sql_escape($value)
{
// escape the value
- return @mysqli_real_escape_string($this->conn_id, $value);
+ return $this->conn_id->real_escape_string($value);
}
function sql_num_fields($result)
{
// number of fields in result
- return @mysqli_num_fields($result);
+ return $result->field_count;
}
function sql_num_rows($result)
{
// number of rows in result
- return @mysqli_num_rows($reuslt);
+ return $result->row_count;
}
function sql_info()
{
// mysqli info
- return @mysqli_info($this->conn_id);
+ return ( isset($this->conn_id->info) ) ? $this->conn_id->info : false;
}
function sql_select_db($dbname)
{
// select database
- return @mysqli_select_db($this->conn_id, $dbname);
+ return true;
}
function sql_field_create($table, $field, $type, $len)
@@ -116,6 +117,11 @@
// delete field in table
return $this->sql_query("ALTER TABLE `$table` DROP `$field`");
}
+
+ function sql_error($result)
+ {
+ return $result->errno . ':' . $result->error;
+ }
}
?>
\ No newline at end of file
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|