newsphp-commit Mailing List for PHPNews
Brought to you by:
christoph_berg,
red-
You can subscribe to this list here.
| 2007 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
(10) |
Sep
(1) |
Oct
(2) |
Nov
|
Dec
|
|---|
|
From: <chr...@us...> - 2007-10-27 10:03:01
|
Revision: 136
http://newsphp.svn.sourceforge.net/newsphp/?rev=136&view=rev
Author: christoph_berg
Date: 2007-10-27 03:03:04 -0700 (Sat, 27 Oct 2007)
Log Message:
-----------
Fixed a small error that crept in while SVN file merge
Modified Paths:
--------------
trunk/jasmine/modules/DB/DB.class.php
Modified: trunk/jasmine/modules/DB/DB.class.php
===================================================================
--- trunk/jasmine/modules/DB/DB.class.php 2007-10-27 10:00:56 UTC (rev 135)
+++ trunk/jasmine/modules/DB/DB.class.php 2007-10-27 10:03:04 UTC (rev 136)
@@ -163,15 +163,9 @@
}
}
-<<<<<<< .mine
$stmt =& $this->DB->prepare($sql);
$stmt->execute();
$rows =& $stmt->fetchAll(PDO::FETCH_ASSOC);
-=======
- //$stmt =& $this->m_DB->prepare($sql);
- //$stmt->execute();
- //$rows =& $stmt->fetchAll(PDO::FETCH_ASSOC);
->>>>>>> .r134
return $rows;
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <chr...@us...> - 2007-10-27 10:00:58
|
Revision: 135
http://newsphp.svn.sourceforge.net/newsphp/?rev=135&view=rev
Author: christoph_berg
Date: 2007-10-27 03:00:56 -0700 (Sat, 27 Oct 2007)
Log Message:
-----------
Fixed some member variable names
Switchted from using Core to ExtensionManager in Settings class
Added an Error class (only the header)
Modified Paths:
--------------
trunk/jasmine/classes/Core.class.php
trunk/jasmine/classes/Template.class.php
trunk/jasmine/classes/exceptions.class.php
trunk/jasmine/modules/DB/DB.class.php
trunk/jasmine/modules/Settings/Settings.class.php
Added Paths:
-----------
trunk/jasmine/classes/Error.class.php
Modified: trunk/jasmine/classes/Core.class.php
===================================================================
--- trunk/jasmine/classes/Core.class.php 2007-09-06 17:23:01 UTC (rev 134)
+++ trunk/jasmine/classes/Core.class.php 2007-10-27 10:00:56 UTC (rev 135)
@@ -65,7 +65,7 @@
// Call the parent constructor
parent::__construct();
- // Register extension Jasmine's default extension types
+ // Register Jasmine's default extension types
try
{
ExtensionManager::getSingleton()->addType('Module');
Added: trunk/jasmine/classes/Error.class.php
===================================================================
--- trunk/jasmine/classes/Error.class.php (rev 0)
+++ trunk/jasmine/classes/Error.class.php 2007-10-27 10:00:56 UTC (rev 135)
@@ -0,0 +1,11 @@
+<?php
+/**
+ * This file implements the Jasmine::Error class.
+ *
+ * @author PHPNews Team
+ * @license http://opensource.org/licenses/gpl-license.php GNU General Public Licence
+ * @copyright (c) 2005-2006 PHPNews Team
+ * @version 0.1.0
+ * @package Jasmine
+ */
+?>
\ No newline at end of file
Modified: trunk/jasmine/classes/Template.class.php
===================================================================
--- trunk/jasmine/classes/Template.class.php 2007-09-06 17:23:01 UTC (rev 134)
+++ trunk/jasmine/classes/Template.class.php 2007-10-27 10:00:56 UTC (rev 135)
@@ -1,7 +1,7 @@
<?php
class Template
{
- static private $instance; // Directory for the template files
+ static private $Instance; // Directory for the template files
private $TemplateData; // Directory for the template files
private $Root; // Root Directory Variable
private $Filename; // Directory for the template files
@@ -19,12 +19,12 @@
/** Starts the whole singleton() shabang **/
static function getSingleton()
{
- if( self::$instance == null )
+ if(is_null(self::$Instance))
{
- self::$instance = new Template();
+ self::$Instance = new Template();
}
- return self::$instance;
+ return self::$Instance;
}
/** Destroyer.. who likes metal! (it just kills the current template **/
Modified: trunk/jasmine/classes/exceptions.class.php
===================================================================
--- trunk/jasmine/classes/exceptions.class.php 2007-09-06 17:23:01 UTC (rev 134)
+++ trunk/jasmine/classes/exceptions.class.php 2007-10-27 10:00:56 UTC (rev 135)
@@ -272,7 +272,7 @@
*/
public function __construct(&$extension, &$type)
{
- $message = "Requested extension {$extension} of type ${type} does not exist.";
+ $message = "Requested extension {$extension} of type {$type} does not exist.";
parent::__construct($message);
}
Modified: trunk/jasmine/modules/DB/DB.class.php
===================================================================
--- trunk/jasmine/modules/DB/DB.class.php 2007-09-06 17:23:01 UTC (rev 134)
+++ trunk/jasmine/modules/DB/DB.class.php 2007-10-27 10:00:56 UTC (rev 135)
@@ -33,20 +33,20 @@
* Number of database queries executed
* @var integer
*/
- public $m_numQueries = 0;
+ public $numQueries = 0;
/**
* Holds the
*/
- private $m_dsn;
+ private $DSN;
/**
* PDO connection object
* @var object
*/
- private $m_DB;
+ private $DB;
- private $m_Driver;
+ private $Driver;
/**
* Default constructor
@@ -92,24 +92,24 @@
* a PDO object. It also outputs any exceptions that may occur.
*
* @param array Data needed to establish a connection
- *
*/
public function createConnection(array $cfg)
{
// Create Connection String
- $this->m_dsn = $cfg['dbEngine'] . ':host=' . $cfg['dbHost'] . ';dbname=' . $cfg['dbName'];
+ $this->DSN = $cfg['dbEngine'] . ':host=' . $cfg['dbHost'] . ';dbname=' . $cfg['dbName'];
try
{
- $this->m_DB = new PDO($this->m_dsn, $cfg['dbUser'], $cfg['dbPass'],
+ $this->DB = new PDO($this->DSN, $cfg['dbUser'], $cfg['dbPass'],
array(PDO::ATTR_PERSISTENT => true));
}
- catch (PDOException $e) {
+ catch (PDOException $e)
+ {
die ( 'Failed to obtain database handle: ' . $e->getMessage() );
}
- $this->m_Driver = $this->m_DB->getAttribute(PDO::ATTR_DRIVER_NAME);
- $this->m_DB->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
+ $this->Driver = $this->DB->getAttribute(PDO::ATTR_DRIVER_NAME);
+ $this->DB->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
$this->emit('createConnection');
}
@@ -125,11 +125,12 @@
*/
public function query($query)
{
- $this->m_numQueries++;
+ $this->numQueries++;
//$this->m_queries[$this->m_numQueries] = $query;
- try {
- // return $this->m_DB->query($query);
+ try
+ {
+ return $this->DB->query($query);
}
catch (PDOException $e)
{
@@ -148,23 +149,29 @@
* @param integer $limit Optional Value allowing you to limit the number of rows returned
* @return array
*/
- public function getRows($sql, $limit = null)
+ public function getRows($sql, $limit = 0)
{
- $this->m_numQueries++;
+ $this->numQueries++;
//$this->m_queries[$this->m_numQueries] = $sql;
// Limiting rows returned?
- if (isset($limit))
+ if ($limit != 0)
{
- if ($this->m_Driver == 'mysql' || $this->m_Driver == 'pgsql')
+ if ($this->Driver == 'mysql' || $this->Driver == 'pgsql')
{
$sql = $sql . ' LIMIT ' . $limit;
}
}
+<<<<<<< .mine
+ $stmt =& $this->DB->prepare($sql);
+ $stmt->execute();
+ $rows =& $stmt->fetchAll(PDO::FETCH_ASSOC);
+=======
//$stmt =& $this->m_DB->prepare($sql);
//$stmt->execute();
//$rows =& $stmt->fetchAll(PDO::FETCH_ASSOC);
+>>>>>>> .r134
return $rows;
}
Modified: trunk/jasmine/modules/Settings/Settings.class.php
===================================================================
--- trunk/jasmine/modules/Settings/Settings.class.php 2007-09-06 17:23:01 UTC (rev 134)
+++ trunk/jasmine/modules/Settings/Settings.class.php 2007-10-27 10:00:56 UTC (rev 135)
@@ -56,7 +56,7 @@
{
$sql = 'SELECT * FROM jasmine_settings';
- $result = Core::getSingleton()->getModule('DB')->getRows($sql);
+ $result = ExtensionsManager::getSingleton()->getModule('DB', 'Module')->getRows($sql);
for($i = 0; $i < count($result); $i++)
{
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <Re...@us...> - 2007-09-06 17:23:02
|
Revision: 134
http://newsphp.svn.sourceforge.net/newsphp/?rev=134&view=rev
Author: Red-
Date: 2007-09-06 10:23:01 -0700 (Thu, 06 Sep 2007)
Log Message:
-----------
-- null
Modified Paths:
--------------
trunk/jasmine/classes/Core.class.php
trunk/jasmine/classes/ExtensionManager.class.php
trunk/jasmine/classes/Logger.class.php
trunk/jasmine/classes/Session.Class.php
trunk/jasmine/classes/User.class.php
trunk/jasmine/index.php
trunk/jasmine/modules/DB/DB.class.php
trunk/jasmine/templatesets/Jasmine/Jasmine.template.php
trunk/jasmine/templatesets/Jasmine/templates/Footer.htm
trunk/jasmine/templatesets/Jasmine/templates/Header.htm
Modified: trunk/jasmine/classes/Core.class.php
===================================================================
--- trunk/jasmine/classes/Core.class.php 2007-08-31 18:44:07 UTC (rev 133)
+++ trunk/jasmine/classes/Core.class.php 2007-09-06 17:23:01 UTC (rev 134)
@@ -85,7 +85,7 @@
*
* @return Core Reference to single Core instance
*/
- public static function &getSingleton()
+ public static function getSingleton()
{
// Check if an instance exists
if (is_null(self::$Instance))
@@ -94,7 +94,7 @@
$c = __CLASS__;
self::$Instance = new $c;
-
+
// Load the extensions
ExtensionManager::getSingleton()->loadExtensions();
Modified: trunk/jasmine/classes/ExtensionManager.class.php
===================================================================
--- trunk/jasmine/classes/ExtensionManager.class.php 2007-08-31 18:44:07 UTC (rev 133)
+++ trunk/jasmine/classes/ExtensionManager.class.php 2007-09-06 17:23:01 UTC (rev 134)
@@ -282,13 +282,13 @@
// Check, if extension type is known
if (!array_key_exists($type, $this->Extensions))
{
- throw new NoSuchExtensionTypeException($type);
+ throw new NoSuchExtensionTypeException($name, $type);
}
// Check, if an extension with the specified name can be found
if (!array_key_exists($name, $this->Extensions[$type]))
{
- throw new NoSuchExtensionException($name);
+ throw new NoSuchExtensionException($name, $type);
}
return $this->Extensions[$type][$name];
Modified: trunk/jasmine/classes/Logger.class.php
===================================================================
--- trunk/jasmine/classes/Logger.class.php 2007-08-31 18:44:07 UTC (rev 133)
+++ trunk/jasmine/classes/Logger.class.php 2007-09-06 17:23:01 UTC (rev 134)
@@ -67,7 +67,7 @@
parent::__construct();
// Open handle to logfile
- if (!($this->LogHandle = fopen('./jasmine.log', 'wx+')))
+ if (!($this->LogHandle = fopen('./jasmine.log', 'rw+')))
{
throw new FileIOException('./jasmine.log');
}
Modified: trunk/jasmine/classes/Session.Class.php
===================================================================
--- trunk/jasmine/classes/Session.Class.php 2007-08-31 18:44:07 UTC (rev 133)
+++ trunk/jasmine/classes/Session.Class.php 2007-09-06 17:23:01 UTC (rev 134)
@@ -108,14 +108,14 @@
*/
public function logout()
{
- $Session_SQL = $this->db->query('SELECT * FROM '. SESSIONS_TABLE .' WHERE Session_ID = \''. $_SESSION['ID'] .'\'');
+ $Session_SQL = $this->db->query('SELECT * FROM jasmine_sessions WHERE Session_ID = \''. $_SESSION['ID'] .'\'');
while($Session = $this->db->getRows($Session_SQL))
{
- $User = $this->db->getRows($this->db->query('SELECT * FROM '. USERS_TABLE .' WHERE ID = \''. $_SESSION['UserID'] .'\''));
+ $User = $this->db->getRows($this->db->query('SELECT Total_time FROM jasmine_users WHERE ID = \''. $_SESSION['UserID'] .'\''));
// Get User Data, Update
$NewTime = $User['Total_time'] + ($Session['Session_End'] - $Session['Session_Start']);
- $this->db->query('UPDATE '. USERS_TABLE .' SET Total_time = \''. $NewTime .'\'');
+ $this->db->query('UPDATE jasmine_users SET Total_time = \''. $NewTime .'\'');
// Then Kill It. Kill It Dead.
$this->haltSession('User', $_SESSION['UserID']);
@@ -140,10 +140,10 @@
$this->setValue('UserID', $User);
// Update Certain User Info
- $this->db->query('UPDATE '. USERS_TABLE .' SET LoginNumber=LoginNumber+1,LastOn = \''.time().'\' WHERE ID = \'' . $User . '\'');
+ $this->db->query('UPDATE jasmine_users SET LoginNumber=LoginNumber+1,LastOn = \''.time().'\' WHERE ID = \'' . $User . '\'');
// Update Session WIth User ID
- $this->db->query('UPDATE '. SESSIONS_TABLE .' SET User = \''. $User .'\' WHERE Session_ID = \''. $_SESSION['ID'] . '\'');
+ $this->db->query('UPDATE jasmine_sessions SET User = \''. $User .'\' WHERE Session_ID = \''. $_SESSION['ID'] . '\'');
// Update Session
$this->updateSession();
@@ -175,7 +175,7 @@
*/
private function exists($key, $value)
{
- $S_Query = $this->db->query('SELECT * FROM '. SESSIONS_TABLE .' WHERE '. $key .' = \''. $value . '\'');
+ $S_Query = $this->db->query('SELECT * FROM jasmine_sessions WHERE '. $key .' = \''. $value . '\'');
if($this->db->numRows($S_Query) != 0)
{
@@ -192,7 +192,7 @@
private function createEntry()
{
// Get Session Vars
- $Session_ID = Core::getSingleton()->getNextID(SESSIONS_TABLE, 'Session_ID');
+ $Session_ID = Core::getSingleton()->getNextID('jasmine_sessions', 'Session_ID');
$Session_Time = time();
// Set $_SESSION Vars
@@ -200,7 +200,7 @@
$this->setValue('Time', $Session_Time);
// Insert into datanase
- $this->db->query('INSERT INTO '. SESSIONS_TABLE .' (Session_ID, Session_Start, Session_End, Session_Key, User)
+ $this->db->query('INSERT INTO jasmine_sessions (Session_ID, Session_Start, Session_End, Session_Key, User)
VALUES (\'' . $Session_ID . '\', \''. $Session_Time .'\', \''. $Session_Time .'\', \''. $this->SessionKey . '\', \''. $UserID .'\')');
}
@@ -231,7 +231,7 @@
}
// Insert into datanase
- $this->db->query('INSERT INTO '. SESSIONS_TABLE .' (Session_ID, Session_Start, Session_End, Session_Key, User)
+ $this->db->query('INSERT INTO jasmine_sessions (Session_ID, Session_Start, Session_End, Session_Key, User)
VALUES (\'' . $Session_ID . '\', \''. $Session_Time .'\', \''. $Session_Time .'\', \''. $this->SessionKey . '\', \''. $UserID .'\')');
}
@@ -242,7 +242,7 @@
private function createWithID()
{
// Insert into datanase
- $this->db->query('UPDATE '. SESSIONS_TABLE .' SET Session_Key = \''. $this->SessionKey . '\' WHERE Session_ID = \''. $_SESSION['ID'].'\'');
+ $this->db->query('UPDATE jasmine_sessions SET Session_Key = \''. $this->SessionKey . '\' WHERE Session_ID = \''. $_SESSION['ID'].'\'');
}
/**
* If the IP is inserted in the db
@@ -251,7 +251,7 @@
private function createFromKey()
{
// Get Session Query
- $Query = $this->db->query('SELECT * FROM '. SESSIONS_TABLE .' WHERE Session_Key = \''. $this->SessionKey . '\'');
+ $Query = $this->db->query('SELECT * FROM jasmine_sessions WHERE Session_Key = \''. $this->SessionKey . '\'');
$Result = $this->db->getRows($Query);
// Get Session Vars
@@ -275,7 +275,7 @@
$_SESSION['Time'] = time();
// Update session db time
- $this->db->query('UPDATE '. SESSIONS_TABLE .' SET Session_End = \''. time() .'\' WHERE Session_ID = \''. $_SESSION['ID'] . '\'');
+ $this->db->query('UPDATE jasmine_sessions SET Session_End = \''. time() .'\' WHERE Session_ID = \''. $_SESSION['ID'] . '\'');
// Handle Sessions
$this->handleSessions();
@@ -290,7 +290,7 @@
private function handleSessions()
{
// Gather the SQL for all sessions
- $Session_SQL = $this->db->query('SELECT * FROM '. SESSIONS_TABLE .' JOIN '.USERS_TABLE .'');
+ $Session_SQL = $this->db->query('SELECT * FROM jasmine_sessions JOIN jasmine_users');
while($Session = $this->db->getRows($Session_SQL))
{
// 10 minute time out
@@ -300,7 +300,7 @@
if($Session['User'] != '0')
{
$NewTime = $Session['Total_time'] + ($Session['Session_End'] - $Session['Session_Start']);
- $this->db->query('UPDATE '. USERS_TABLE .' SET Total_time = \''. $NewTime .'\'');
+ $this->db->query('UPDATE jasmine_users SET Total_time = \''. $NewTime .'\'');
}
$this->haltSession('Session_ID', $Session['Session_ID']);
@@ -318,7 +318,7 @@
*/
private function haltSession($Field, $ID)
{
- $this->db->query('DELETE FROM '. SESSIONS_TABLE .' WHERE '. $Field .' = \''. $ID . '\'');
+ $this->db->query('DELETE FROM jasmine_sessions WHERE '. $Field .' = \''. $ID . '\'');
}
/**
Modified: trunk/jasmine/classes/User.class.php
===================================================================
--- trunk/jasmine/classes/User.class.php 2007-08-31 18:44:07 UTC (rev 133)
+++ trunk/jasmine/classes/User.class.php 2007-09-06 17:23:01 UTC (rev 134)
@@ -77,7 +77,7 @@
private function Auth($User, $Pass, $Form)
{
// Start Check Query
- $CheckAuth = $this->db->query('SELECT * FROM ' . USERS_TABLE . ' WHERE Username = \'' . $User . '\' AND Password = \'' . md5($Pass) . '\'');
+ $CheckAuth = $this->db->query('SELECT * FROM jasmine_users WHERE Username = \'' . $User . '\' AND Password = \'' . md5($Pass) . '\'');
if($this->db->numRows($CheckAuth) != 0)
{
@@ -157,8 +157,8 @@
*/
private function loadPermissions()
{
- $this->permissions['Group'] = $this->db->query('SELECT * FROM '.GROUP_PERMISSIONS_TABLE.' WHERE gid = \''. $this->Userdata['Group'] .'\'');
- $this->permissions['User'] = $this->db->query('SELECT * FROM '.USERS_PERMISSIONS_TABLE.' WHERE uid = \''. $this->Userdata['ID'] .'\'');
+ $this->permissions['Group'] = $this->db->query('SELECT * FROM jasmine_permissions_groups WHERE gid = \''. $this->Userdata['Group'] .'\'');
+ $this->permissions['User'] = $this->db->query('SELECT * FROM jasmin_permissions_users WHERE uid = \''. $this->Userdata['ID'] .'\'');
while(list($Type) = each($this->permissions))
{
@@ -201,4 +201,4 @@
session_unset();
}
}
-?>
\ No newline at end of file
+?>
Modified: trunk/jasmine/index.php
===================================================================
--- trunk/jasmine/index.php 2007-08-31 18:44:07 UTC (rev 133)
+++ trunk/jasmine/index.php 2007-09-06 17:23:01 UTC (rev 134)
@@ -12,7 +12,6 @@
Core::setXmlParser(new DomXmlParser());
print_r(Core::getSingleton());
-
// =====================================================
// The pages we have to choose
//
Modified: trunk/jasmine/modules/DB/DB.class.php
===================================================================
--- trunk/jasmine/modules/DB/DB.class.php 2007-08-31 18:44:07 UTC (rev 133)
+++ trunk/jasmine/modules/DB/DB.class.php 2007-09-06 17:23:01 UTC (rev 134)
@@ -129,7 +129,7 @@
//$this->m_queries[$this->m_numQueries] = $query;
try {
- return $this->m_DB->query($query);
+ // return $this->m_DB->query($query);
}
catch (PDOException $e)
{
@@ -162,14 +162,28 @@
}
}
- $stmt =& $this->m_DB->prepare($sql);
- $stmt->execute();
- $rows =& $stmt->fetchAll(PDO::FETCH_ASSOC);
+ //$stmt =& $this->m_DB->prepare($sql);
+ //$stmt->execute();
+ //$rows =& $stmt->fetchAll(PDO::FETCH_ASSOC);
return $rows;
}
/**
+ *
+ * the numRows() function
+ *
+ * In beta testing with PDO, jerry-rigged.
+ *
+ * More documentation to come
+ */
+ public function numRows($sql)
+ {
+ $numRowsQuery = $this->getRows($this->query($sql));
+ return sizeof($numRowsQuery);
+ }
+
+ /**
* Intialises the connections with from the DB to other modules
*/
public function initialiseConnections()
Modified: trunk/jasmine/templatesets/Jasmine/Jasmine.template.php
===================================================================
--- trunk/jasmine/templatesets/Jasmine/Jasmine.template.php 2007-08-31 18:44:07 UTC (rev 133)
+++ trunk/jasmine/templatesets/Jasmine/Jasmine.template.php 2007-09-06 17:23:01 UTC (rev 134)
@@ -48,12 +48,12 @@
public function header()
{
// Load The Template File
- $template->set_filenames(array(
+ Template::getSingleton()->setFilenames(array(
'header' => 'Header.htm')
);
// Assign Template Variables
- $template->assign_vars(array(
+ Template::getSingleton()->assignVars(array(
'CSS_PATH' => 'PATH TO CSS',)
);
Modified: trunk/jasmine/templatesets/Jasmine/templates/Footer.htm
===================================================================
--- trunk/jasmine/templatesets/Jasmine/templates/Footer.htm 2007-08-31 18:44:07 UTC (rev 133)
+++ trunk/jasmine/templatesets/Jasmine/templates/Footer.htm 2007-09-06 17:23:01 UTC (rev 134)
@@ -1,7 +0,0 @@
- </div>
- <div class="copyright" style="clear:left; padding-top:20px;">
- {COPYRIGHT} {VERSION}<br />
- [ Script Execution Time: {LOADTIME} ] [ DB Queries: {QUERIES} ]
- </div>
- </body>
-</html>
\ No newline at end of file
Modified: trunk/jasmine/templatesets/Jasmine/templates/Header.htm
===================================================================
--- trunk/jasmine/templatesets/Jasmine/templates/Header.htm 2007-08-31 18:44:07 UTC (rev 133)
+++ trunk/jasmine/templatesets/Jasmine/templates/Header.htm 2007-09-06 17:23:01 UTC (rev 134)
@@ -1,10 +1,14 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
- "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<title>Jasmine - Administration Center</title>
<link href="{CSS_PATH}" rel="stylesheet" type="text/css" />
</head>
<body>
- <div id="border">
\ No newline at end of file
+ <div id="border">
+ </div>
+ <div class="copyright" style="clear:left; padding-top:20px;">
+ {COPYRIGHT} {VERSION}<br />
+ [ Script Execution Time: {LOADTIME} ] [ DB Queries: {QUERIES} ]
+ </div>
+ </body>
+</html>
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <chr...@us...> - 2007-08-31 18:44:09
|
Revision: 133
http://newsphp.svn.sourceforge.net/newsphp/?rev=133&view=rev
Author: christoph_berg
Date: 2007-08-31 11:44:07 -0700 (Fri, 31 Aug 2007)
Log Message:
-----------
Added missing style XML file
Added Paths:
-----------
trunk/jasmine/styles/Jasmine/Jasmine.xml
Added: trunk/jasmine/styles/Jasmine/Jasmine.xml
===================================================================
--- trunk/jasmine/styles/Jasmine/Jasmine.xml (rev 0)
+++ trunk/jasmine/styles/Jasmine/Jasmine.xml 2007-08-31 18:44:07 UTC (rev 133)
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="utf-8"?>
+<extension name="Jasmine" version="1.00" installed="false" stylesheet="Jasmine.css" type="Style">
+ <description lang="en-GB">
+ Standard style for Jasmine.
+ </description>
+ <description lang="de-DE">
+ Standardstil für Jasmine.
+ </description>
+</extension>
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <chr...@us...> - 2007-08-31 18:16:13
|
Revision: 131
http://newsphp.svn.sourceforge.net/newsphp/?rev=131&view=rev
Author: christoph_berg
Date: 2007-08-31 11:00:29 -0700 (Fri, 31 Aug 2007)
Log Message:
-----------
Added missing style factory class
Added Paths:
-----------
trunk/jasmine/classes/StyleFactory.class.php
Added: trunk/jasmine/classes/StyleFactory.class.php
===================================================================
--- trunk/jasmine/classes/StyleFactory.class.php (rev 0)
+++ trunk/jasmine/classes/StyleFactory.class.php 2007-08-31 18:00:29 UTC (rev 131)
@@ -0,0 +1,68 @@
+<?php
+/**
+ * This file implements the Jasmine::StyleFactory class.
+ *
+ * @author PHPNews Team
+ * @license http://opensource.org/licenses/gpl-license.php GNU General Public Licence
+ * @copyright (c) 2005-2006 PHPNews Team
+ * @version 0.1.0
+ * @package Jasmine
+ */
+
+require_once('Factory.class.php');
+require_once('Style.class.php');
+
+/**
+ * The StyleFactory Object Class
+ *
+ * This factory constructs an extension of type Style
+ *
+ * @author PHPNews Team
+ * @license http://opensource.org/licenses/gpl-license.php GNU General Public Licence
+ * @copyright (c) 2005-2006 PHPNews Team
+ * @version 0.1.0
+ * @package Jasmine
+ */
+final class StyleFactory extends Factory
+{
+ /**
+ * Creates a Style object from a given XML file
+ *
+ * @param filename string Filename of the XML document to load
+ * @return Extension of type Style
+ */
+ public function createFromXml($filename)
+ {
+ // Get extension path from filename
+ $this->extPath = dirname($filename);
+
+ // Get common data
+ $cdata =& $this->getCommonDataFromXml($filename);
+
+ $stylesheet = Core::getXmlParser()->getAttributeValue('extension', 'stylesheet');
+
+ // Create the Style using collected data and return it
+ return new $cdata['name']($cdata['name'], $cdata['version'], $cdata['installed'], $stylesheet, $cdata['description'], $cdata['image']);
+ }
+
+ /**
+ * Creates a theme object from an associative array (key => value)
+ *
+ * @param $data array Associative data array
+ * @throws NoSuchArrayKeyException if a needed key is not found in the array
+ */
+ public function createFromArray(array& $data)
+ {
+ // Get common data
+ $cdata =& $this->getCommonDataFromArray($data);
+
+ // Set active to default value, if it is not given
+ if (!isset($cdata['stylesheet']))
+ {
+ throw new NoSuchArrayKeyException('stylesheet');
+ }
+
+ // Create the Module using collected data and return it
+ return new $cdata['name']($cdata['name'], $cdata['version'], $cdata['installed'], $cdata['activated'], $cdata['description'], $cdata['image']);
+ }
+}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <chr...@us...> - 2007-08-31 18:15:53
|
Revision: 132
http://newsphp.svn.sourceforge.net/newsphp/?rev=132&view=rev
Author: christoph_berg
Date: 2007-08-31 11:15:52 -0700 (Fri, 31 Aug 2007)
Log Message:
-----------
Added theme directory and Jasmine theme
Added Paths:
-----------
trunk/jasmine/themes/
trunk/jasmine/themes/Jasmine/
trunk/jasmine/themes/Jasmine/Jasmine.xml
Added: trunk/jasmine/themes/Jasmine/Jasmine.xml
===================================================================
--- trunk/jasmine/themes/Jasmine/Jasmine.xml (rev 0)
+++ trunk/jasmine/themes/Jasmine/Jasmine.xml 2007-08-31 18:15:52 UTC (rev 132)
@@ -0,0 +1,10 @@
+<?xml version="1.0" encoding="utf-8"?>
+<extension name="Jasmine" version="1.00" installed="false" activated="false"
+ style="Jasmine" templateset="Jasmine" type="Theme">
+ <description lang="en-GB">
+ Standard theme for Jasmine.
+ </description>
+ <description lang="de-DE">
+ Standardthema für Jasmine.
+ </description>
+</extension>
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <chr...@us...> - 2007-08-19 21:00:40
|
Revision: 130
http://newsphp.svn.sourceforge.net/newsphp/?rev=130&view=rev
Author: christoph_berg
Date: 2007-08-19 14:00:33 -0700 (Sun, 19 Aug 2007)
Log Message:
-----------
Added last of the factories
Corrected hopefully all PHP strict errors
Added Jasmine Theme and Style extension
Refined the XSD schema (have to split it)
Enabled all extension types in Core
Modified Paths:
--------------
trunk/jasmine/classes/Core.class.php
trunk/jasmine/classes/ExtensionManager.class.php
trunk/jasmine/classes/Factory.class.php
trunk/jasmine/classes/Object.class.php
trunk/jasmine/classes/Style.class.php
trunk/jasmine/classes/ThemeFactory.class.php
trunk/jasmine/extension.xsd
trunk/jasmine/modules/DB/DB.class.php
trunk/jasmine/templatesets/Jasmine/Jasmine.xml
trunk/jasmine/tests/test_core.class.php
trunk/jasmine/tests/test_db.class.php
trunk/jasmine/tests/test_object.class.php
Added Paths:
-----------
trunk/jasmine/styles/
trunk/jasmine/styles/Jasmine/
trunk/jasmine/styles/Jasmine/Jasmine.css
Removed Paths:
-------------
trunk/jasmine/templatesets/Jasmine/Jasmine.css
Modified: trunk/jasmine/classes/Core.class.php
===================================================================
--- trunk/jasmine/classes/Core.class.php 2007-08-13 02:40:23 UTC (rev 129)
+++ trunk/jasmine/classes/Core.class.php 2007-08-19 21:00:33 UTC (rev 130)
@@ -70,8 +70,8 @@
{
ExtensionManager::getSingleton()->addType('Module');
ExtensionManager::getSingleton()->addType('TemplateSet');
- //ExtensionManager::getSingleton()->addType('Style');
- //ExtensionManager::getSingleton()->addType('Theme');
+ ExtensionManager::getSingleton()->addType('Style');
+ ExtensionManager::getSingleton()->addType('Theme');
}
catch (NoClassFoundException $x)
{
@@ -98,14 +98,14 @@
// Load the extensions
ExtensionManager::getSingleton()->loadExtensions();
- // Set the default theme
- //self::$Instance->setTheme();
-
// Create the connections
self::$Instance->connect('__construct',
ExtensionManager::getSingleton()->getExtension('DB', 'Module')
, 'createConnection');
+ // Set the default theme
+ self::$Instance->setTheme();
+
// Authentificate the user
self::$Instance->User = new User();
Modified: trunk/jasmine/classes/ExtensionManager.class.php
===================================================================
--- trunk/jasmine/classes/ExtensionManager.class.php 2007-08-13 02:40:23 UTC (rev 129)
+++ trunk/jasmine/classes/ExtensionManager.class.php 2007-08-19 21:00:33 UTC (rev 130)
@@ -103,7 +103,7 @@
foreach ($this->Paths as $Path)
{
- $dirIter =& new DirectoryIterator($Path);
+ $dirIter = new DirectoryIterator($Path);
Logger::getSingleton()->log(Logger::JM_DEBUG, Logger::JM_EM,
"Searching extensions in subdiretories of {$dirIter->getPath()}");
@@ -140,7 +140,7 @@
throw new NoSuchExtensionTypeException($type);
}
- $this->Extensions[$extType][$extName] =&
+ $this->Extensions[$extType][$extName] =
$this->Factories[$extType]->createFromXml($eEntry->getPathname());
Logger::getSingleton()->log(Logger::JM_INFORMATION, Logger::JM_EM,
@@ -239,7 +239,7 @@
}
else
{
- $this->Factories[$type] =& new $factory();
+ $this->Factories[$type] = new $factory();
}
}
}
Modified: trunk/jasmine/classes/Factory.class.php
===================================================================
--- trunk/jasmine/classes/Factory.class.php 2007-08-13 02:40:23 UTC (rev 129)
+++ trunk/jasmine/classes/Factory.class.php 2007-08-19 21:00:33 UTC (rev 130)
@@ -37,10 +37,10 @@
* @return Extension of concrete type
*/
abstract public function createFromXml($filename);
-
+
/**
* Creates a concrete extension from an associative array (key => value)
- *
+ *
* @param $data array Associative data array
* @return Extenion of concrete type
*/
@@ -48,7 +48,7 @@
/**
* Helper function to read common extension data from an XML file
- *
+ *
* @param $filename string Filename of the XML document to load
* @return array of common data
*/
@@ -61,20 +61,20 @@
catch (FileIOException $x)
{
Logger::getSingleton()->log(Logger::JM_WARNING, Logger::JM_EM,
- $x->getMessage());
+ $x->getMessage());
return;
}
catch (XmlParseError $e)
{
Logger::getSingleton()->Log(Logger::JM_ERROR, Logger::JM_EM,
- $e->getMessage());
+ $e->getMessage());
return;
}
$data = array();
-
- $Parser =& Core::getXmlParser();
+ $Parser = Core::getXmlParser();
+
$data['name'] = $Parser->getAttributeValue('extension', 'name');
$data['version'] = $Parser->getAttributeValue('extension', 'version');
@@ -99,7 +99,7 @@
// Create empty array
$data['description'] = array();
-
+
$descriptions = Core::getXMLParser()->getTagValue('description');
if (is_array($descriptions))
@@ -113,34 +113,34 @@
{
$data['description'][] = array($descriptions['lang'] => $descriptions['content']);
}
-
+
return $data;
}
-
+
/**
* Helper function to check array data for common attributes existence
- *
+ *
* @param $data array Associative data array
* @throws NoSuchArrayKeyException if a required key is not found in the array
*/
protected function &getCommonDataFromArray(array $data)
- {
+ {
if (!isset($data['name']))
{
throw new NoSuchArrayKeyException('name');
}
-
+
if (!isset($data['version']))
{
throw new NoSuchArrayKeyException('version');
}
-
+
// Set installed to default value, if it is not given
if (!isset($data['installed']))
{
$data['installed'] = false;
}
-
+
// Set image to default value, if it is not given
if (!isset($data['image']))
{
@@ -150,18 +150,18 @@
{
$data['image'] = $this->extPath . '/' . $data['image'];
}
-
+
if(!isset($data['description']))
{
$data['description'] = array();
}
-
+
return $data;
}
-
+
/**
* Sets the extension path
- *
+ *
* @param string $path New extension path
*/
public function setExtensionPath($path)
@@ -169,4 +169,4 @@
$this->extPath = $path;
}
}
-?>
\ No newline at end of file
+?>
Modified: trunk/jasmine/classes/Object.class.php
===================================================================
--- trunk/jasmine/classes/Object.class.php 2007-08-13 02:40:23 UTC (rev 129)
+++ trunk/jasmine/classes/Object.class.php 2007-08-19 21:00:33 UTC (rev 130)
@@ -39,7 +39,8 @@
*/
protected function __construct()
{
- $this->List = new ConnectionList($this->__toString());
+ // Double brackets needed to avoid triggering a php strict error
+ $this->List = new ConnectionList(($this->__toString()));
}
/**
Modified: trunk/jasmine/classes/Style.class.php
===================================================================
--- trunk/jasmine/classes/Style.class.php 2007-08-13 02:40:23 UTC (rev 129)
+++ trunk/jasmine/classes/Style.class.php 2007-08-19 21:00:33 UTC (rev 130)
@@ -13,14 +13,14 @@
/**
* The Style Object class
- *
+ *
* The Style class merely consists of a stylesheet information.
- *
+ *
* @author PHPNews Team
* @license http://opensource.org/licenses/gpl-license.php GNU General Public Licence
* @copyright (c) 2005-2006 PHPNews Team
* @version 0.1.0
- * @package Jasmine
+ * @package Jasmine
*/
abstract class Style extends Extension
{
@@ -29,7 +29,7 @@
* @var string
*/
protected $Stylesheet = '';
-
+
/**
* Default constructor
*
@@ -39,12 +39,12 @@
* @param string $version Theme version
* @param string $stylesheet Theme stylesheet
*/
- public function __construct($name, $version, $installed, $stylesheet = '', $description = '', $image = '')
+ public function __construct($name, $version, $installed, $stylesheet, $description = '', $image = '')
{
$this->Stylesheet = $stylesheet;
-
+
// Call the parent constructor
parent::__construct($name, $version, $installed, $description, $image);
}
}
-?>
\ No newline at end of file
+?>
Modified: trunk/jasmine/classes/ThemeFactory.class.php
===================================================================
--- trunk/jasmine/classes/ThemeFactory.class.php 2007-08-13 02:40:23 UTC (rev 129)
+++ trunk/jasmine/classes/ThemeFactory.class.php 2007-08-19 21:00:33 UTC (rev 130)
@@ -31,19 +31,19 @@
* @param filename string Filename of the XML document to load
* @return Extension of type Theme
*/
- protected function createFromXml($filename)
+ public function createFromXml($filename)
{
// Get extension path from filename
$this->extPath = dirname($filename);
// Get common data
- $cdata =& $this->getCommonDataFromXml($filename);
+ $cdata =& $this->getCommonDataFromXml($filename);
- $Parser =& Core::getXmlParser();
-
+ $Parser = Core::getXmlParser();
+
$style = ExtensionManager::getSingleton()->getExtension($Parser->getAttributeValue('extension', 'style'), 'Style');
$templateset = ExtensionManager::getSingleton()->getExtension($Parser->getAttributeValue('extension', 'templateset'), 'TemplateSet');
-
+
if ($Parser->getAttributeValue('extension', 'activated') == 'true')
{
$activated = true;
@@ -53,30 +53,28 @@
$activated = false;
}
- require_once ($this->extPath . '/' . $name .'.theme.php');
-
// Create the Theme using collected data and return it
return new $cdata['name']($cdata['name'], $cdata['version'], $cdata['installed'], $activated, $style, $templateset, $cdata['description'], $cdata['image']);
}
-
+
/**
* Creates a Theme object from an associative array (key => value)
- *
+ *
* @param $data array Associative data array
* @throws NoSuchArrayKeyException if a needed key is not found in the array
*/
- protected function createFromArray(array& $data)
+ public function createFromArray(array& $data)
{
if (!isset($data['name']))
{
throw new NoSuchArrayKeyException('name');
}
-
+
if (!isset($data['version']))
{
throw new NoSuchArrayKeyException('version');
}
-
+
if (!isset($data['style']))
{
throw new NoSuchArrayKeyException('style');
@@ -86,7 +84,7 @@
// Get a reference to the Style object
$style =& ExtensionManager::getSingleton()->getExtension($data['style'], 'Style');
}
-
+
if (!isset($data['templateset']))
{
throw new NoSuchArrayKeyException('templateset');
@@ -96,13 +94,13 @@
// Get a reference to the TemplateSet object
$templateset =& ExtensionManager::getSingleton()->getExtension($data['templateset'], 'TemplateSet');
}
-
+
// Set installed to default value, if it is not given
if (!isset($data['installed']))
{
$data['installed'] = false;
}
-
+
// Set active to default value, if it is not given
if (!isset($data['active']))
{
@@ -117,7 +115,7 @@
else
{
$image = $this->extPath . '/' . $data['image'];
- }
+ }
if (isset($data['description']))
{
@@ -135,8 +133,6 @@
}
}
- require_once ($this->extPath . '/' . $name .'.theme.php');
-
// Create the Theme using collected data and return it
return new $data['name']($data['name'], $data['version'], $data['installed'], $data['activated'], $style, $templateset, $description, $image);
}
Modified: trunk/jasmine/extension.xsd
===================================================================
--- trunk/jasmine/extension.xsd 2007-08-13 02:40:23 UTC (rev 129)
+++ trunk/jasmine/extension.xsd 2007-08-19 21:00:33 UTC (rev 130)
@@ -41,5 +41,8 @@
<xsd:attribute name="installed" type="xsd:boolean" use="required"/>
<xsd:attribute name="image" type="xsd:string"/>
<xsd:attribute name="activated" type="xsd:boolean"/>
+ <xsd:attribute name="stylesheet" type="xsd:string"/>
+ <xsd:attribute name="style" type="xsd:string"/>
+ <xsd:attribute name="templateset" type="xsd:string"/>
</xsd:complexType>
</xsd:schema>
Modified: trunk/jasmine/modules/DB/DB.class.php
===================================================================
--- trunk/jasmine/modules/DB/DB.class.php 2007-08-13 02:40:23 UTC (rev 129)
+++ trunk/jasmine/modules/DB/DB.class.php 2007-08-19 21:00:33 UTC (rev 130)
@@ -101,8 +101,8 @@
try
{
- $this->m_DB =& new PDO($this->m_dsn, $cfg['dbUser'], $cfg['dbPass'],
- array(PDO::ATTR_PERSISTENT => true));
+ $this->m_DB = new PDO($this->m_dsn, $cfg['dbUser'], $cfg['dbPass'],
+ array(PDO::ATTR_PERSISTENT => true));
}
catch (PDOException $e) {
die ( 'Failed to obtain database handle: ' . $e->getMessage() );
Copied: trunk/jasmine/styles/Jasmine/Jasmine.css (from rev 129, trunk/jasmine/templatesets/Jasmine/Jasmine.css)
===================================================================
--- trunk/jasmine/styles/Jasmine/Jasmine.css (rev 0)
+++ trunk/jasmine/styles/Jasmine/Jasmine.css 2007-08-19 21:00:33 UTC (rev 130)
@@ -0,0 +1,317 @@
+a:link {
+ color: #000000;
+ text-decoration: underline;
+}
+
+a:active {
+ color: #000000;
+ text-decoration: underline;
+}
+
+a:visited {
+ color: #000000;
+ text-decoration: underline;
+}
+
+a:hover {
+ color: #808080;
+ text-decoration: none;
+}
+
+a.bbcodebutton, a.bbcodebutton:visited, a.bbcodebutton:active {
+ color: #ffffff;
+ background-color: #5F7797;
+ border: 1px solid #354463;
+ padding: 2px 5px 2px 5px;
+ text-decoration: none;
+ line-height: 30px;
+}
+
+a.bbcodebutton:hover {
+ background-color: #354463;
+ color: #cccccc;
+ text-decoration: none;
+}
+
+body {
+ font-family: Verdana, Arial, Helvetica, sans-serif;
+ text-align: center;
+ font-size: 12px;
+}
+
+img {
+ border: none;
+ vertical-align: middle;
+}
+
+fieldset {
+ border-color: #000000;
+ border-style: solid;
+ border-width: 1px;
+ padding: 3px;
+ text-align: left;
+}
+
+h1 {
+ font-size: 22px;
+ margin: 0px;
+ padding-bottom: 5px;
+ padding-top: 5px;
+ text-align: center;
+}
+
+h2 {
+ font-size: 12px;
+ font-style: italic;
+}
+
+hr {
+ color: #003366;
+ height: 1px;
+ width: 100%;
+}
+
+img {
+ border: none;
+}
+
+label {
+ font-size: 12px;
+}
+
+li {
+ margin: 0px;
+ padding: 0px;
+}
+
+ol {
+ margin-top: 0px;
+ margin-bottom: 0px;
+ margin-left: 11px;
+ padding-left: 11px;
+}
+
+ul {
+ margin-top: 0px;
+ margin-bottom: 0px;
+ margin-left: 8px;
+ padding-left: 8px;
+}
+
+table {
+ font-size: 12px;
+}
+
+td {
+ padding: 4px;
+}
+
+textarea {
+ background-color: #FFFFFF;
+ border-color: #354463;
+ border-style: solid;
+ border-width: 1px;
+}
+
+th {
+ padding: 4px;
+}
+
+body.jswindow {
+ background-color: #BFC4CB;
+ border: none;
+ padding: 0px;
+ margin: 15px;
+}
+
+body.jswindow input[type=text], body.jswindow textarea {
+ background-color: #FFFFFF;
+ border-color: #354463;
+ border-style: solid;
+ border-width: 1px;
+ width: 200px;
+}
+
+div.code {
+ background-color: #DEE7EF;
+ margin-left: 15px;
+ margin-right: 15px;
+ margin-top: 5px;
+ padding: 5px;
+}
+
+div.module {
+ background-color: lightgrey;
+ border: black dotted 1px;
+ padding: 5px;
+ margin: 5px 0px;
+}
+
+div.module .title {
+ font-size: 18px;
+ font-weight: bold;
+ margin: 0px;
+}
+
+div.module p {
+ margin-left: 15px;
+ margin-right: 15px;
+ text-align: justify;
+}
+
+input[type=submit],
+input[type=reset],
+input[type=button] {
+ border-color: #354463;
+ border-style: solid;
+ border-width: 1px;
+ background-color: #5F7797;
+ color: #FFFFFF;
+ font-size: 11px;
+ padding-bottom: 1px;
+ padding-top: 1px;
+ width: 90px;
+}
+
+input[type=submit]:hover,
+input[type=reset]:hover,
+input[type=button]:hover {
+ background-color: #354463;
+}
+
+input[type=text], input[type=password] {
+ background-color: #FFFFFF;
+ border-color: #354463;
+ border-style: solid;
+ border-width: 1px;
+}
+
+table.tablecenter {
+ margin-left: auto;
+ margin-right: auto;
+}
+
+table.login {
+ background-color: #BFC4CB;
+ border-color: #000000;
+ border-style: solid;
+ border-width: 1px;
+ font-size: 12px;
+ margin-left: auto;
+ margin-right: auto;
+ padding: 0px;
+}
+
+table.login th {
+ background-color: #5F7797;
+ color: #E9F2FC;
+ padding: 5px;
+}
+
+table.login td {
+ padding: 5px;
+}
+
+table.installer {
+ background-color: #BFC4CB;
+ border-color: #000000;
+ border-style: solid;
+ border-width: 1px;
+ font-size: 12px;
+ margin-left: auto;
+ margin-right: auto;
+ padding: 0px;
+ width: 370px;
+}
+
+table.installer th {
+ background-color: #5F7797;
+ color: #E9F2FC;
+ padding: 5px;
+}
+
+table.installer td {
+ padding: 5px;
+}
+
+.hr {
+ background-color: transparent;
+ color: #6394bd;
+}
+
+.center {
+ text-align: center;
+}
+
+.copyright {
+ font-size: 11px;
+ text-align: center;
+}
+
+.left {
+ text-align: left;
+}
+
+.menu {
+ border-bottom-color: #000000;
+ border-bottom-style: dashed;
+ border-bottom-width: 1px;
+ border-left-color: #000000;
+ border-left-style: dashed;
+ border-left-width: 1px;
+ padding: 5px;
+}
+
+.notify {
+ background-color: lightgrey;
+}
+
+.notify td {
+ border-bottom-color: #000000;
+ border-bottom-style: solid;
+ border-bottom-width: 1px;
+ border-top-color: #000000;
+ border-top-style: solid;
+ border-top-width: 1px;
+}
+
+.right {
+ text-align: right;
+}
+
+.subtext {
+ margin-top: 0px;
+}
+
+#border {
+ margin-left: auto;
+ margin-right: auto;
+ text-align: left;
+ width: 600px;
+}
+
+#content {
+ border-bottom-color: #000000;
+ border-bottom-style: dashed;
+ border-bottom-width: 1px;
+ border-left-color: #000000;
+ border-left-style: dashed;
+ border-left-width: 1px;
+ border-right-color: #000000;
+ border-right-style: dashed;
+ border-right-width: 1px;
+ float: left;
+ padding: 5px;
+ min-height: 360px;
+ width: 388px;
+}
+
+#navigation {
+ float: left;
+ width: 200px;
+}
+
+#imageupload
+{
+ display: none;
+}
Deleted: trunk/jasmine/templatesets/Jasmine/Jasmine.css
===================================================================
--- trunk/jasmine/templatesets/Jasmine/Jasmine.css 2007-08-13 02:40:23 UTC (rev 129)
+++ trunk/jasmine/templatesets/Jasmine/Jasmine.css 2007-08-19 21:00:33 UTC (rev 130)
@@ -1,317 +0,0 @@
-a:link {
- color: #000000;
- text-decoration: underline;
-}
-
-a:active {
- color: #000000;
- text-decoration: underline;
-}
-
-a:visited {
- color: #000000;
- text-decoration: underline;
-}
-
-a:hover {
- color: #808080;
- text-decoration: none;
-}
-
-a.bbcodebutton, a.bbcodebutton:visited, a.bbcodebutton:active {
- color: #ffffff;
- background-color: #5F7797;
- border: 1px solid #354463;
- padding: 2px 5px 2px 5px;
- text-decoration: none;
- line-height: 30px;
-}
-
-a.bbcodebutton:hover {
- background-color: #354463;
- color: #cccccc;
- text-decoration: none;
-}
-
-body {
- font-family: Verdana, Arial, Helvetica, sans-serif;
- text-align: center;
- font-size: 12px;
-}
-
-img {
- border: none;
- vertical-align: middle;
-}
-
-fieldset {
- border-color: #000000;
- border-style: solid;
- border-width: 1px;
- padding: 3px;
- text-align: left;
-}
-
-h1 {
- font-size: 22px;
- margin: 0px;
- padding-bottom: 5px;
- padding-top: 5px;
- text-align: center;
-}
-
-h2 {
- font-size: 12px;
- font-style: italic;
-}
-
-hr {
- color: #003366;
- height: 1px;
- width: 100%;
-}
-
-img {
- border: none;
-}
-
-label {
- font-size: 12px;
-}
-
-li {
- margin: 0px;
- padding: 0px;
-}
-
-ol {
- margin-top: 0px;
- margin-bottom: 0px;
- margin-left: 11px;
- padding-left: 11px;
-}
-
-ul {
- margin-top: 0px;
- margin-bottom: 0px;
- margin-left: 8px;
- padding-left: 8px;
-}
-
-table {
- font-size: 12px;
-}
-
-td {
- padding: 4px;
-}
-
-textarea {
- background-color: #FFFFFF;
- border-color: #354463;
- border-style: solid;
- border-width: 1px;
-}
-
-th {
- padding: 4px;
-}
-
-body.jswindow {
- background-color: #BFC4CB;
- border: none;
- padding: 0px;
- margin: 15px;
-}
-
-body.jswindow input[type=text], body.jswindow textarea {
- background-color: #FFFFFF;
- border-color: #354463;
- border-style: solid;
- border-width: 1px;
- width: 200px;
-}
-
-div.code {
- background-color: #DEE7EF;
- margin-left: 15px;
- margin-right: 15px;
- margin-top: 5px;
- padding: 5px;
-}
-
-div.module {
- background-color: lightgrey;
- border: black dotted 1px;
- padding: 5px;
- margin: 5px 0px;
-}
-
-div.module .title {
- font-size: 18px;
- font-weight: bold;
- margin: 0px;
-}
-
-div.module p {
- margin-left: 15px;
- margin-right: 15px;
- text-align: justify;
-}
-
-input[type=submit],
-input[type=reset],
-input[type=button] {
- border-color: #354463;
- border-style: solid;
- border-width: 1px;
- background-color: #5F7797;
- color: #FFFFFF;
- font-size: 11px;
- padding-bottom: 1px;
- padding-top: 1px;
- width: 90px;
-}
-
-input[type=submit]:hover,
-input[type=reset]:hover,
-input[type=button]:hover {
- background-color: #354463;
-}
-
-input[type=text], input[type=password] {
- background-color: #FFFFFF;
- border-color: #354463;
- border-style: solid;
- border-width: 1px;
-}
-
-table.tablecenter {
- margin-left: auto;
- margin-right: auto;
-}
-
-table.login {
- background-color: #BFC4CB;
- border-color: #000000;
- border-style: solid;
- border-width: 1px;
- font-size: 12px;
- margin-left: auto;
- margin-right: auto;
- padding: 0px;
-}
-
-table.login th {
- background-color: #5F7797;
- color: #E9F2FC;
- padding: 5px;
-}
-
-table.login td {
- padding: 5px;
-}
-
-table.installer {
- background-color: #BFC4CB;
- border-color: #000000;
- border-style: solid;
- border-width: 1px;
- font-size: 12px;
- margin-left: auto;
- margin-right: auto;
- padding: 0px;
- width: 370px;
-}
-
-table.installer th {
- background-color: #5F7797;
- color: #E9F2FC;
- padding: 5px;
-}
-
-table.installer td {
- padding: 5px;
-}
-
-.hr {
- background-color: transparent;
- color: #6394bd;
-}
-
-.center {
- text-align: center;
-}
-
-.copyright {
- font-size: 11px;
- text-align: center;
-}
-
-.left {
- text-align: left;
-}
-
-.menu {
- border-bottom-color: #000000;
- border-bottom-style: dashed;
- border-bottom-width: 1px;
- border-left-color: #000000;
- border-left-style: dashed;
- border-left-width: 1px;
- padding: 5px;
-}
-
-.notify {
- background-color: lightgrey;
-}
-
-.notify td {
- border-bottom-color: #000000;
- border-bottom-style: solid;
- border-bottom-width: 1px;
- border-top-color: #000000;
- border-top-style: solid;
- border-top-width: 1px;
-}
-
-.right {
- text-align: right;
-}
-
-.subtext {
- margin-top: 0px;
-}
-
-#border {
- margin-left: auto;
- margin-right: auto;
- text-align: left;
- width: 600px;
-}
-
-#content {
- border-bottom-color: #000000;
- border-bottom-style: dashed;
- border-bottom-width: 1px;
- border-left-color: #000000;
- border-left-style: dashed;
- border-left-width: 1px;
- border-right-color: #000000;
- border-right-style: dashed;
- border-right-width: 1px;
- float: left;
- padding: 5px;
- min-height: 360px;
- width: 388px;
-}
-
-#navigation {
- float: left;
- width: 200px;
-}
-
-#imageupload
-{
- display: none;
-}
Modified: trunk/jasmine/templatesets/Jasmine/Jasmine.xml
===================================================================
--- trunk/jasmine/templatesets/Jasmine/Jasmine.xml 2007-08-13 02:40:23 UTC (rev 129)
+++ trunk/jasmine/templatesets/Jasmine/Jasmine.xml 2007-08-19 21:00:33 UTC (rev 130)
@@ -1,9 +1,9 @@
<?xml version="1.0" encoding="utf-8"?>
<extension name="Jasmine" version="1.00" installed="false" activated="false" type="TemplateSet">
<description lang="en-GB">
- Standard theme for Jasmine.
+ Standard template set for Jasmine.
</description>
<description lang="de-DE">
- Standardthema für Jasmine.
+ Standardvorlagensatz für Jasmine.
</description>
</extension>
Modified: trunk/jasmine/tests/test_core.class.php
===================================================================
--- trunk/jasmine/tests/test_core.class.php 2007-08-13 02:40:23 UTC (rev 129)
+++ trunk/jasmine/tests/test_core.class.php 2007-08-19 21:00:33 UTC (rev 130)
@@ -31,10 +31,10 @@
public function testGetSingelton()
{
// Create the XML parser
- $this->parser =& new DomXmlParser();
+ $this->parser = new DomXmlParser();
Core::setXmlParser($this->parser);
- $this->instance =& Core::getSingleton();
+ $this->instance = Core::getSingleton();
$this->assertEquals(true, $this->instance instanceof Core);
}
Modified: trunk/jasmine/tests/test_db.class.php
===================================================================
--- trunk/jasmine/tests/test_db.class.php 2007-08-13 02:40:23 UTC (rev 129)
+++ trunk/jasmine/tests/test_db.class.php 2007-08-19 21:00:33 UTC (rev 130)
@@ -22,7 +22,7 @@
*/
protected function setUp()
{
- $this->instance =& new DB('', '', false, false, '', '');
+ $this->instance = new DB('', '', false, false, '', '');
}
public function testCreateConnection()
Modified: trunk/jasmine/tests/test_object.class.php
===================================================================
--- trunk/jasmine/tests/test_object.class.php 2007-08-13 02:40:23 UTC (rev 129)
+++ trunk/jasmine/tests/test_object.class.php 2007-08-19 21:00:33 UTC (rev 130)
@@ -70,8 +70,8 @@
*/
protected function setUp()
{
- $this->a =& new Counter();
- $this->b =& new Counter();
+ $this->a = new Counter();
+ $this->b = new Counter();
}
/**
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <Re...@us...> - 2007-08-13 02:40:19
|
Revision: 129
http://newsphp.svn.sourceforge.net/newsphp/?rev=129&view=rev
Author: Red-
Date: 2007-08-12 19:40:23 -0700 (Sun, 12 Aug 2007)
Log Message:
-----------
Fixed a core error with an 'exit;'
Modified Paths:
--------------
trunk/jasmine/classes/Core.class.php
Modified: trunk/jasmine/classes/Core.class.php
===================================================================
--- trunk/jasmine/classes/Core.class.php 2007-08-13 02:39:23 UTC (rev 128)
+++ trunk/jasmine/classes/Core.class.php 2007-08-13 02:40:23 UTC (rev 129)
@@ -76,7 +76,7 @@
catch (NoClassFoundException $x)
{
echo $x->getMessage();
- exit 1;
+ exit;
}
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <Re...@us...> - 2007-08-13 02:39:21
|
Revision: 128
http://newsphp.svn.sourceforge.net/newsphp/?rev=128&view=rev
Author: Red-
Date: 2007-08-12 19:39:23 -0700 (Sun, 12 Aug 2007)
Log Message:
-----------
Fixed a quick bug in the User Class dealing with the permissions.
Modified Paths:
--------------
trunk/jasmine/classes/User.class.php
Modified: trunk/jasmine/classes/User.class.php
===================================================================
--- trunk/jasmine/classes/User.class.php 2007-08-13 02:31:22 UTC (rev 127)
+++ trunk/jasmine/classes/User.class.php 2007-08-13 02:39:23 UTC (rev 128)
@@ -10,6 +10,7 @@
private $Logout = false;
public $Auth = false;
private $Session_ID;
+ private $Type;
static private $instance;
private $db;
@@ -131,18 +132,17 @@
* param $Type is the type of permission
* to get. Ie, Group or User. If it's not
* set, User is the permissions assigned.
+ * If it is set with anything, use Group
*
+ * @todo organize the method
+ *
* return true or false
*/
public function isAllowed($Type = NULL)
- {
- self::loadPermissions();
-
- if($Type == NULL)
- {
- $Type = 'User';
- }
-
+ {
+ $this->Type = ($Type == NULL ? 'User' : 'Group');
+ $this->loadPermissions();
+
return $this->permissions[$Type]['Allowed'];
}
@@ -150,6 +150,10 @@
* The actual loader for permissions
* from the db. Relays to isAllowed.
*
+ * It loads both permissions for added
+ * permission security. Ie: If a user
+ * is allowed, but a group is not and
+ * the other way around.
*/
private function loadPermissions()
{
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <Re...@us...> - 2007-08-13 02:31:22
|
Revision: 127
http://newsphp.svn.sourceforge.net/newsphp/?rev=127&view=rev
Author: Red-
Date: 2007-08-12 19:31:22 -0700 (Sun, 12 Aug 2007)
Log Message:
-----------
Added Permissions. Fixed some small typos.
Modified Paths:
--------------
trunk/jasmine/classes/User.class.php
Modified: trunk/jasmine/classes/User.class.php
===================================================================
--- trunk/jasmine/classes/User.class.php 2007-08-11 02:35:19 UTC (rev 126)
+++ trunk/jasmine/classes/User.class.php 2007-08-13 02:31:22 UTC (rev 127)
@@ -76,9 +76,9 @@
private function Auth($User, $Pass, $Form)
{
// Start Check Query
- $CheckAuth = $this->db->sqlQuery('SELECT * FROM ' . USERS_TABLE . ' WHERE Username = \'' . $User . '\' AND Password = \'' . md5($Pass) . '\'');
+ $CheckAuth = $this->db->query('SELECT * FROM ' . USERS_TABLE . ' WHERE Username = \'' . $User . '\' AND Password = \'' . md5($Pass) . '\'');
- if($this->db->sqlNumrows($CheckAuth) != 0)
+ if($this->db->numRows($CheckAuth) != 0)
{
// Set Auth True
$this->Auth = true;
@@ -99,7 +99,10 @@
}
else
{
- $this->AuthFail('BadLogin');
+ // Set User ID and Group ID to 0 if fail
+ $this->Userdata['Group'] = '0';
+ $this->Userdata['ID'] = '0';
+
// Set Auth False
$this->Auth = false;
}
@@ -113,21 +116,60 @@
private function getUserdata($SQL)
{
$this->Userdata = array();
- while($row = $this->db->sqlFetchrow($SQL))
+ while($row = $this->db->getRows($SQL))
{
$this->Userdata = $row;
}
+
+ return $this->Userdata;
+ }
+
+ /*
+ * Checks the permissions of the User
+ * in corolation to their User ID.
+ *
+ * param $Type is the type of permission
+ * to get. Ie, Group or User. If it's not
+ * set, User is the permissions assigned.
+ *
+ * return true or false
+ */
+ public function isAllowed($Type = NULL)
+ {
+ self::loadPermissions();
- if($this->Userdata['Level'] == 3 && $this->Userdata['Group'] == 1)
+ if($Type == NULL)
{
- Template::getSingleton()->assignVars(array(
- 'ADMIN' => '<A class="Link" href="'.Core::getSingleton()->URL.'Admin">» Admin Panel</A><br>')
- );
+ $Type = 'User';
}
-
- return $this->Userdata;
+
+ return $this->permissions[$Type]['Allowed'];
}
+
+ /**
+ * The actual loader for permissions
+ * from the db. Relays to isAllowed.
+ *
+ */
+ private function loadPermissions()
+ {
+ $this->permissions['Group'] = $this->db->query('SELECT * FROM '.GROUP_PERMISSIONS_TABLE.' WHERE gid = \''. $this->Userdata['Group'] .'\'');
+ $this->permissions['User'] = $this->db->query('SELECT * FROM '.USERS_PERMISSIONS_TABLE.' WHERE uid = \''. $this->Userdata['ID'] .'\'');
+ while(list($Type) = each($this->permissions))
+ {
+ $result = $this->db->getRows($this->permissions[$Type]);
+ if($result['allowed'] = '1')
+ {
+ $this->permissions[$Type]['Allowed'] = true;
+ }
+ else
+ {
+ $this->permissions[$Type]['Allowed'] = false;
+ }
+ }
+ }
+
/**
* If Authentication Fails
* Tell Us Why! I sure as
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <Re...@us...> - 2007-08-11 02:35:16
|
Revision: 126
http://newsphp.svn.sourceforge.net/newsphp/?rev=126&view=rev
Author: Red-
Date: 2007-08-10 19:35:19 -0700 (Fri, 10 Aug 2007)
Log Message:
-----------
Added support for templates outside of the root directory (When relative to the /home path)
Modified Paths:
--------------
trunk/jasmine/classes/Template.class.php
Modified: trunk/jasmine/classes/Template.class.php
===================================================================
--- trunk/jasmine/classes/Template.class.php 2007-08-07 15:34:23 UTC (rev 125)
+++ trunk/jasmine/classes/Template.class.php 2007-08-11 02:35:19 UTC (rev 126)
@@ -67,6 +67,10 @@
{
$this->Filename = ($Replaced_Filename = $this->Root . '/' . $Filename) ? $Replaced_Filename : $Filename;
}
+ else
+ {
+ $this->Filename = $Filename;
+ }
if(!file_exists($Filename))
{
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <chr...@us...> - 2007-08-07 15:34:20
|
Revision: 125
http://newsphp.svn.sourceforge.net/newsphp/?rev=125&view=rev
Author: christoph_berg
Date: 2007-08-07 08:34:23 -0700 (Tue, 07 Aug 2007)
Log Message:
-----------
Updated copyright data in all files (hopefully)
Updated a lot of documentation
Renaming of methods in Session class, take 2
Adapted makedoc.sh to use doxygen like configuration variables
Added reference operator to some method parameters
Modified Paths:
--------------
trunk/jasmine/classes/Connection.class.php
trunk/jasmine/classes/ConnectionList.class.php
trunk/jasmine/classes/Core.class.php
trunk/jasmine/classes/Extension.class.php
trunk/jasmine/classes/ExtensionManager.class.php
trunk/jasmine/classes/Logger.class.php
trunk/jasmine/classes/Object.class.php
trunk/jasmine/classes/Session.Class.php
trunk/jasmine/classes/exceptions.class.php
trunk/jasmine/dotests.sh
trunk/jasmine/makedoc.sh
trunk/jasmine/modules/DB/DB.class.php
trunk/jasmine/modules/Settings/Settings.class.php
trunk/jasmine/sql/mysql.sql
Modified: trunk/jasmine/classes/Connection.class.php
===================================================================
--- trunk/jasmine/classes/Connection.class.php 2007-08-07 04:57:06 UTC (rev 124)
+++ trunk/jasmine/classes/Connection.class.php 2007-08-07 15:34:23 UTC (rev 125)
@@ -4,22 +4,23 @@
*
* @author PHPNews Team
* @license http://opensource.org/licenses/gpl-license.php GNU General Public Licence
- * @copyright (c) 2005-2006 PHPNews Team
- * @version 0.1.0
+ * @copyright (c) 2005-2007 PHPNews Team
+ * @version 0.9
* @package Jasmine
*/
/**
* The Connection Object class
*
- * The Connection class stores the signal of the sender object and a reference
+ * Stores the signal of the sender object and a reference
* to the receiver object and its slot name.
*
* @author PHPNews Team
* @license http://opensource.org/licenses/gpl-license.php GNU General Public Licence
- * @copyright (c) 2005-2006 PHPNews Team
- * @version 0.1.0
+ * @copyright (c) 2005-2007 PHPNews Team
+ * @version 0.9
* @package Jasmine
+ * @todo Finish documentation
*/
final class Connection
{
Modified: trunk/jasmine/classes/ConnectionList.class.php
===================================================================
--- trunk/jasmine/classes/ConnectionList.class.php 2007-08-07 04:57:06 UTC (rev 124)
+++ trunk/jasmine/classes/ConnectionList.class.php 2007-08-07 15:34:23 UTC (rev 125)
@@ -4,8 +4,8 @@
*
* @author PHPNews Team
* @license http://opensource.org/licenses/gpl-license.php GNU General Public Licence
- * @copyright (c) 2005-2006 PHPNews Team
- * @version 0.1.0
+ * @copyright (c) 2005-2007 PHPNews Team
+ * @version 0.9
* @package Jasmine
*/
@@ -18,9 +18,10 @@
*
* @author PHPNews Team
* @license http://opensource.org/licenses/gpl-license.php GNU General Public Licence
- * @copyright (c) 2005-2006 PHPNews Team
- * @version 0.1.0
+ * @copyright (c) 2005-2007 PHPNews Team
+ * @version 0.9
* @package Jasmine
+ * @todo Implement remove function
*/
class ConnectionList
{
@@ -58,22 +59,14 @@
* Adds a new connection to the list
*
* @param string $signal Function name of the signal
- * @param mixed $recipient Reveiving object or class name
+ * @param Object $recipient Reveiving object
* @param string $slot Function name of the slot (function of receiving object)
* @param string $type Specifies, if the connection is direct or checked
* @throws MultipleConnectException if a SigSlot connection should be
* established multiple times
*/
- public function addConnection($signal, &$recipient, $slot, $type)
+ public function addConnection(&$signal, Object &$recipient, &$slot, &$type)
{
- // Check if we got a string as parameter
- if (is_string($recipient))
- {
- // Get a reference to a module instance of the selected class type
- $recipient =& ExtensionManager::getSingleton()
- ->getExtension($recipient, 'Module');
- }
-
// Check if the signal was connected before
foreach($this->Connections as &$Connection)
{
@@ -81,13 +74,16 @@
$Connection->Recipient == $recipient &&
$Connection->Slot == $slot)
{
- throw new MultipleConnectException($this->Owner, $signal, $recipient->toString(), $slot, $type);
+ throw new MultipleConnectException($this->Owner->toString(),
+ $signal,
+ $recipient->toString(),
+ $slot, $type);
return false;
}
}
// Check, if slot is really a function of the reciving Object
- $reflector =& new ReflectionClass($recipient);
+ $reflector = new ReflectionClass($recipient);
if (!($reflector->hasMethod($slot)))
{
@@ -96,7 +92,7 @@
}
// Create the new connection
- $this->Connections[] =& new Connection($signal, $recipient, $slot, $type);
+ $this->Connections[] = new Connection($signal, $recipient, $slot, $type);
return true;
}
Modified: trunk/jasmine/classes/Core.class.php
===================================================================
--- trunk/jasmine/classes/Core.class.php 2007-08-07 04:57:06 UTC (rev 124)
+++ trunk/jasmine/classes/Core.class.php 2007-08-07 15:34:23 UTC (rev 125)
@@ -4,7 +4,7 @@
*
* @author PHPNews Team
* @license http://opensource.org/licenses/gpl-license.php GNU General Public Licence
- * @copyright (c) 2005-2006 PHPNews Team
+ * @copyright (c) 2005-2007 PHPNews Team
* @version 0.1.0
* @package Jasmine
*/
@@ -23,7 +23,7 @@
*
* @author PHPNews Team
* @license http://opensource.org/licenses/gpl-license.php GNU General Public Licence
- * @copyright (c) 2005-2006 PHPNews Team
+ * @copyright (c) 2005-2007 PHPNews Team
* @version 0.1.0
* @package Jasmine
*/
@@ -46,7 +46,7 @@
* @var User
*/
private $User = NULL;
-
+
/**
* Used theme
* @var string
@@ -66,10 +66,18 @@
parent::__construct();
// Register extension Jasmine's default extension types
- ExtensionManager::getSingleton()->addType('Module');
- ExtensionManager::getSingleton()->addType('TemplateSet');
- //ExtensionManager::getSingleton()->addType('Style');
- //ExtensionManager::getSingleton()->addType('Theme');
+ try
+ {
+ ExtensionManager::getSingleton()->addType('Module');
+ ExtensionManager::getSingleton()->addType('TemplateSet');
+ //ExtensionManager::getSingleton()->addType('Style');
+ //ExtensionManager::getSingleton()->addType('Theme');
+ }
+ catch (NoClassFoundException $x)
+ {
+ echo $x->getMessage();
+ exit 1;
+ }
}
/**
@@ -80,7 +88,7 @@
public static function &getSingleton()
{
// Check if an instance exists
- if (!isset(self::$Instance))
+ if (is_null(self::$Instance))
{
require_once('db_config.php');
@@ -94,17 +102,19 @@
//self::$Instance->setTheme();
// Create the connections
- self::$Instance->connect('__construct', 'DB', 'createConnection');
+ self::$Instance->connect('__construct',
+ ExtensionManager::getSingleton()->getExtension('DB', 'Module')
+ , 'createConnection');
// Authentificate the user
self::$Instance->User = new User();
-
+
// Emit the OnCoreCreated signal
self::$Instance->emit('__construct', $config);
// Log successful creation
Logger::getSingleton()->log(Logger::JM_INFORMATION, Logger::JM_CORE,
- 'Core created');
+ 'Core created');
}
return self::$Instance;
@@ -186,23 +196,6 @@
}
/**
- * Checks, if module is a special module
- *
- * This functions checks if the module specified by index
- * is one of the special modules defined for this application
- *
- * @param mixed $index Module name or index
- * @return bool
- */
- private function isSystemModule($index)
- {
- if (in_array($this->Modules[$index]->getName(), $this->SystemModules))
- return true;
-
- return false;
- }
-
- /**
* Sets the default theme used for this Jasmine session
*
* Asks the DB for a key named DefaultTheme. If it does not exist, the
@@ -235,7 +228,7 @@
{
$this->Theme = ExtensionManager::getSingleton()->getExtension('Jasmine, Theme');
}
-
+
// If we can't load the default theme, log it and die
Logger::getSingleton(Logger::JM_ERROR, Logger::JM_CORE,
"Theme {$name} could not be loaded "
@@ -243,7 +236,7 @@
die("Default Theme ${name} could not be loaded. Exiting...");
}
}
-
+
/**
* Enter description here...
*
@@ -253,7 +246,7 @@
public function getNextID($Table, $Column = NULL)
{
$this->db =& ExtensionManager::getSingleton()->getExtension('DB', 'Module');
-
+
if($Column != NULL)
{
$NumRows = $this->db->getRows($this->db->query('SELECT '. $Column .' FROM '. $Table .' ORDER BY '.$Column.' DESC'));
@@ -267,11 +260,11 @@
return $ID;
}
-
+
/**
* Friendly Neighbourhood Refresh Script!
*/
- public function Refresh($Path = NULL)
+ public function Refresh($Path = NULL)
{
if(isset($Path))
{
Modified: trunk/jasmine/classes/Extension.class.php
===================================================================
--- trunk/jasmine/classes/Extension.class.php 2007-08-07 04:57:06 UTC (rev 124)
+++ trunk/jasmine/classes/Extension.class.php 2007-08-07 15:34:23 UTC (rev 125)
@@ -4,27 +4,27 @@
*
* @author PHPNews Team
* @license http://opensource.org/licenses/gpl-license.php GNU General Public Licence
- * @copyright (c) 2005-2006 PHPNews Team
- * @version 0.1.0
+ * @copyright (c) 2005-2007 PHPNews Team
+ * @version 0.9
* @package Jasmine
*/
require_once('Object.class.php');
/**
- * The Extension Object class
+ * Provides an abstract template on which all extensions are based.
*
- * The Extension class is an abstract class. It declares certain functions,
- * which the user must define, when inheriting from this class, as all
- * modules will do, as defined in Jasmine rules.
- * It also provides helper functions, for example updating the XML file,
- * which the user can rely on in their extensions.
+ * The Extension class declares certain methods shared by all extensions, but
+ * because extensions are more or less different from each other, they
+ * have to be implemented by the extension developer. It also provides helper
+ * methods, which can be used by extension developers in their extensions.
*
* @author PHPNews Team
* @license http://opensource.org/licenses/gpl-license.php GNU General Public Licence
- * @copyright (c) 2005-2006 PHPNews Team
- * @version 0.1.0
+ * @copyright (c) 2005-2007 PHPNews Team
+ * @version 0.9
* @package Jasmine
+ * @todo Add more helper functions if necessary, refine documentation of abstract methods
*/
abstract class Extension extends Object
{
@@ -49,7 +49,7 @@
/**#@-*/
/**
- * Stores extension descriptions for every language, where a description
+ * Available descriptions for every language, where a description
* is given
* @var array
*/
@@ -62,15 +62,13 @@
protected $Installed = false;
/**
- * Default constructor
+ * Creates an extension object by setting all important information
*
- * Constructs an extension object by setting all important information
- *
- * @param string $name Extension name
- * @param string $version Extension version
- * @param bool $installed Is the extension installed?
- * @param string $description optional Extension description
- * @param string $image optional Extension image
+ * @param string Extension name
+ * @param string Extension version
+ * @param bool Is the extension installed?
+ * @param string optional Extension description
+ * @param string optional Extension image
*/
public function __construct($name, $version, $installed, $description = '', $image = '')
{
@@ -80,13 +78,13 @@
$this->Installed = $installed;
$this->Image = $image;
- // Call the parent constructor
parent::__construct();
}
/**
* Returns the name of the module
- * @return string
+ *
+ * @return string module name
*/
public function getName()
{
@@ -95,7 +93,8 @@
/**
* Returns the version of the module
- * @return string
+ *
+ * @return string module version
*/
public function getVersion()
{
@@ -126,7 +125,8 @@
/**
* Returns the image filename of the module
- * @return string
+ *
+ * @return string module image filename
*/
public function getImage()
{
@@ -135,7 +135,8 @@
/**
* Returns, if the module is installed
- * @return bool
+ *
+ * @return bool true if extension is installed, false otherwise
*/
public function isInstalled()
{
Modified: trunk/jasmine/classes/ExtensionManager.class.php
===================================================================
--- trunk/jasmine/classes/ExtensionManager.class.php 2007-08-07 04:57:06 UTC (rev 124)
+++ trunk/jasmine/classes/ExtensionManager.class.php 2007-08-07 15:34:23 UTC (rev 125)
@@ -4,8 +4,8 @@
*
* @author PHPNews Team
* @license http://opensource.org/licenses/gpl-license.php GNU General Public Licence
- * @copyright (c) 2005-2006 PHPNews Team
- * @version 0.1.0
+ * @copyright (c) 2005-2007 PHPNews Team
+ * @version 0.9
* @package Jasmine
*/
@@ -13,16 +13,15 @@
require_once('Logger.class.php');
/**
- * The ExtensionManager Object class
+ * Provides all necessary operations for managing extensions in a consistent
+ * way.
*
- * The ExtensionManager provides alle necessary operations for managing
- * extensions in a consistent way.
- *
* @author PHPNews Team
* @license http://opensource.org/licenses/gpl-license.php GNU General Public Licence
- * @copyright (c) 2005-2006 PHPNews Team
- * @version 0.1.0
+ * @copyright (c) 2005-2007 PHPNews Team
+ * @version 0.9
* @package Jasmine
+ * @todo Reenable connection creation, revise helper functions
*/
final class ExtensionManager extends Object
{
@@ -59,7 +58,7 @@
{
// Log successful creation
Logger::getSingleton()->log(Logger::JM_INFORMATION, Logger::JM_CORE,
- 'ExtensionManager created');
+ 'ExtensionManager created');
}
/**
@@ -70,10 +69,9 @@
public static function &getSingleton()
{
// Check if an instance exists
- if (!isset(self::$Instance))
+ if (is_null(self::$Instance))
{
- $c = __CLASS__;
- self::$Instance = new $c;
+ self::$Instance = new ExtensionManager;
}
return self::$Instance;
@@ -89,14 +87,14 @@
public function loadExtensions()
{
Logger::getSingleton()->log(Logger::JM_DEBUG, Logger::JM_EM,
- 'Loading all extensions');
+ 'Loading all extensions');
// Check for extension directories
if (empty($this->Paths))
{
// Log it and just return
Logger::getSingleton()->log(Logger::JM_INFORMATION, Logger::JM_EM,
- 'No extension directories registered');
+ 'No extension directories registered');
return;
}
@@ -118,7 +116,7 @@
$extIter = new DirectoryIterator($dEntry->getPathname());
Logger::getSingleton()->log(Logger::JM_DEBUG, Logger::JM_EM,
- "Searching for XML file in {$extIter->getPath()}");
+ "Searching for XML file in {$extIter->getPath()}");
// Search the subdirectory
foreach ($extIter as $eEntry)
@@ -146,7 +144,7 @@
$this->Factories[$extType]->createFromXml($eEntry->getPathname());
Logger::getSingleton()->log(Logger::JM_INFORMATION, Logger::JM_EM,
- "Loaded extension {$extName}. Type is "
+ "Loaded extension {$extName}. Type is "
."{$extType}.");
}
}
@@ -196,70 +194,23 @@
{
Logger::getSingleton()->log(Logger::JM_ERROR, Logger::JM_EM,
"Extension type {$name} will not "
- .'be added, because a factory '
+ .'be added, because a factory '
.'object cannot be created.');
return;
}
// Add section to extension array
$this->Extensions[$name] = array();
+
// Add path to extension paths
$this->Paths[] = strtolower($name) . 's';
}
-
+
Logger::getSingleton()->log(Logger::JM_DEBUG, Logger::JM_EM,
- "Extension type {$name} added");
+ "Extension type {$name} added");
}
/**
- * Helper function to set the installed attribute
- *
- * The extension's XML file is loaded and the installed attribute is set
- * to the given value.
- *
- * @param string $XmlFile Extension name or index
- * @param boolean $installed Specifies if the extension is installed
- */
- public function setInstalled($XmlFile, $installed)
- {
- // Convert bool to string
- $installed = $installed ? 'true' : 'false';
-
- // Load XML file
- $this->loadXmlFile($XmlFile, 'extension.xsd');
-
- // Update installed attribute
- $this->updateXmlAttribute('installed', $installed);
-
- // Save XML file
- $this->saveXmlFile($XmlFile);
- }
-
- /**
- * Helper function to set the activated attribute
- *
- * The extension's XML file is loaded and the installed attribute is set
- * to the given value.
- *
- * @param mixed $index Extension name or index
- * @param boolean $activated Specifies if the extension is activated
- */
- public function setActivated($XmlFile, $activated)
- {
- // Convert bool to string
- $activated = $activated ? 'true' : 'false';
-
- // Load XML file
- $this->loadXmlFile($XmlFile);
-
- // Update activated attribute
- $this->updateXmlAttribute('activated', $activated);
-
- // Save XML file
- $this->saveXmlFile($XmlFile);
- }
-
- /**
* Registers a new factory for a given type
*
* @param string $type Type for which the validator should be loaded
@@ -297,16 +248,19 @@
* Returns a reference to a factory for a given extension type
*
* @param string $type Type for which a factory should be returned
+ * @return Factory Reference to requested factory
+ * @throw NoSuchExtensionTypeException if a factory for an extension
+ * type is requested, which does not exist
*/
public function &getFactory($type)
{
// Check if type is registered
if (!array_key_exists($type, $this->Validators))
{
- throw new NoValidatorException($type);
+ throw new NoSuchExtensionTypeException($type);
}
- return $this->Validators[$type];
+ return $this->Factories[$type];
}
/**
@@ -317,23 +271,74 @@
*
* @param string $name Name of the extension
* @param int $type Type of the extension
- * @return Extension Reference to extension
- * @throws NonExistingExtensionException if a given type+name combination
- * was not registered as an extension
+ * @return Extension Reference to requested extension
+ * @throws NoSuchExtensionTypeException if an extension type is requested
+ * which does not exist
+ * @throws NoSuchExtensionException if a given type+name combination
+ * is requested which does not exist
*/
public function &getExtension($name, $type)
{
// Check, if extension type is known
if (!array_key_exists($type, $this->Extensions))
{
+ throw new NoSuchExtensionTypeException($type);
}
// Check, if an extension with the specified name can be found
if (!array_key_exists($name, $this->Extensions[$type]))
{
- throw new NonExistingExtensionException($name);
+ throw new NoSuchExtensionException($name);
}
return $this->Extensions[$type][$name];
}
+
+ /**
+ * Helper function to set the activated attribute
+ *
+ * The extension's XML file is loaded and the installed attribute is set
+ * to the given value.
+ *
+ * @param mixed $index Extension name or index
+ * @param boolean $activated Specifies if the extension is activated
+ */
+ public function setActivated($XmlFile, $activated)
+ {
+ // Convert bool to string
+ $activated = $activated ? 'true' : 'false';
+
+ // Load XML file
+ $this->loadXmlFile($XmlFile);
+
+ // Update activated attribute
+ $this->updateXmlAttribute('activated', $activated);
+
+ // Save XML file
+ $this->saveXmlFile($XmlFile);
+ }
+
+ /**
+ * Helper function to set the installed attribute
+ *
+ * The extension's XML file is loaded and the installed attribute is set
+ * to the given value.
+ *
+ * @param string $XmlFile Extension name or index
+ * @param boolean $installed Specifies if the extension is installed
+ */
+ public function setInstalled($XmlFile, $installed)
+ {
+ // Convert bool to string
+ $installed = $installed ? 'true' : 'false';
+
+ // Load XML file
+ $this->loadXmlFile($XmlFile, 'extension.xsd');
+
+ // Update installed attribute
+ $this->updateXmlAttribute('installed', $installed);
+
+ // Save XML file
+ $this->saveXmlFile($XmlFile);
+ }
}
Modified: trunk/jasmine/classes/Logger.class.php
===================================================================
--- trunk/jasmine/classes/Logger.class.php 2007-08-07 04:57:06 UTC (rev 124)
+++ trunk/jasmine/classes/Logger.class.php 2007-08-07 15:34:23 UTC (rev 125)
@@ -4,11 +4,13 @@
*
* @author PHPNews Team
* @license http://opensource.org/licenses/gpl-license.php GNU General Public Licence
- * @copyright (c) 2005-2006 PHPNews Team
- * @version 0.1.0
+ * @copyright (c) 2005-2007 PHPNews Team
+ * @version 0.9
* @package Jasmine
*/
+require_once('Object.class.php');
+
/**
* The Logger Object class
*
@@ -17,8 +19,8 @@
*
* @author PHPNews Team
* @license http://opensource.org/licenses/gpl-license.php GNU General Public Licence
- * @copyright (c) 2005-2006 PHPNews Team
- * @version 0.1.0
+ * @copyright (c) 2005-2007 PHPNews Team
+ * @version 0.9
* @package Jasmine
*/
class Logger extends Object
@@ -79,10 +81,9 @@
public static function &getSingleton()
{
// Check if an instance exists
- if (!isset(self::$Instance))
+ if (is_null(self::$Instance))
{
- $c = __CLASS__;
- self::$Instance = new $c;
+ self::$Instance = new Logger;
}
return self::$Instance;
Modified: trunk/jasmine/classes/Object.class.php
===================================================================
--- trunk/jasmine/classes/Object.class.php 2007-08-07 04:57:06 UTC (rev 124)
+++ trunk/jasmine/classes/Object.class.php 2007-08-07 15:34:23 UTC (rev 125)
@@ -4,8 +4,8 @@
*
* @author PHPNews Team
* @license http://opensource.org/licenses/gpl-license.php GNU General Public Licence
- * @copyright (c) 2005-2006 PHPNews Team
- * @version 0.1.0
+ * @copyright (c) 2005-2007 PHPNews Team
+ * @version 0.9
* @package Jasmine
*/
@@ -15,12 +15,12 @@
* The Object class
*
* This class is the base class for all of Jasmine's classes. It implements
- * functionality so that the signals and slots system works.
+ * functionality so that every child class can use the signals and slots system.
*
* @author PHPNews Team
* @license http://opensource.org/licenses/gpl-license.php GNU General Public Licence
- * @copyright (c) 2005-2006 PHPNews Team
- * @version 0.1.0
+ * @copyright (c) 2005-2007 PHPNews Team
+ * @version 0.9
* @package Jasmine
*/
abstract class Object
@@ -35,13 +35,11 @@
public $List = NULL;
/**
- * Default Constructor
- *
- * Initialises the connection list
+ * Creates an empty connection list
*/
protected function __construct()
{
- $this->List =& new ConnectionList($this->__toString());
+ $this->List = new ConnectionList($this->__toString());
}
/**
@@ -61,12 +59,11 @@
public function connect($signal, $receiver, $method, $type = Object::DirectConnection)
{
// Check, if signal is really a function of this object
- $reflector =& new ReflectionClass($this);
+ $reflector = new ReflectionClass($this);
if (!($reflector->hasMethod($signal)))
{
throw new NonExistingFunctionException(get_class($this->Owner), $signal);
- return false;
}
return $this->List->addConnection($signal, $receiver, $method, $type);
@@ -89,7 +86,7 @@
public function emit($signal)
{
// Check for existing signal
- $reflector =& new ReflectionClass($this);
+ $reflector = new ReflectionClass($this);
if (!($reflector->hasMethod($signal)))
{
@@ -98,7 +95,7 @@
}
// Get the arguments passed with the signal
- $args =& func_get_args();
+ $args = func_get_args();
// Remove the signal name from the argument list
array_shift($args);
Modified: trunk/jasmine/classes/Session.Class.php
===================================================================
--- trunk/jasmine/classes/Session.Class.php 2007-08-07 04:57:06 UTC (rev 124)
+++ trunk/jasmine/classes/Session.Class.php 2007-08-07 15:34:23 UTC (rev 125)
@@ -1,39 +1,61 @@
<?php
+/**
+ * This file implements the Jasmine::Session class.
+ *
+ * @author PHPNews Team
+ * @license http://opensource.org/licenses/gpl-license.php GNU General Public Licence
+ * @copyright (c) 2005-2007 PHPNews Team
+ * @version 0.1.0
+ * @package Jasmine
+ */
+
+require_once('ExtensionManager.class.php');
+
+/**
+ * The Session Object Class
+ *
+ * Provides an object orientated wrapper around PHP's session handling
+ * functionality.
+ *
+ * @author PHPNews Team
+ * @license http://opensource.org/licenses/gpl-license.php GNU General Public Licence
+ * @copyright (c) 2005-2007 PHPNews Team
+ * @version 0.1.0
+ * @package Jasmine
+ */
class Session
{
// Set instance for singleton
static private $instance;
private $SessionKey;
private $db;
-
+
public function __construct()
- {
- // Load DB Module
+ {
+ // Get a reference to the DB module
$this->db =& ExtensionManager::getSingleton()->getExtension('DB', 'Module');
-
+
// Check for Cookie Key
$this->checkCookieJar();
// Check If The Session_ID Exists
if(!isset($_SESSION['ID']))
- {
- // Before we enter duplicate entries, check of it exists as another session
+ {
+ // Before we enter duplicate entries, check if it exists as another session
if(!$this->exists('Session_Key', $this->SessionKey))
{
// Create Session
$this->createEntry();
}
-
// If it exists, update it with the newest session info
- else if($this->exists('Session_Key', $this->SessionKey))
+ else
{
// Create Session
$this->createFromKey();
}
}
-
- // or Check if a DB entry exists
- else if(isset($_SESSION['ID']))
+ // or Check if a DB entry exists
+ else
{
if(!$this->exists('Session_ID', $_SESSION['ID']))
{
@@ -46,9 +68,8 @@
{
// Create Session
$this->createWithID();
- }
-
- // Otherwise, update the DB if it's
+ }
+ // Otherwise, update the DB if it's
// The right time to update
else if(time() - $_SESSION['Time'] >= 300)
{
@@ -56,18 +77,23 @@
}
}
}
-
+
/**
- * Singleton method
+ * Returns a refernce to the single instance of the Session object
+ *
+ * @return Session Reference to single Session instance
*/
- static function getSingleton() {
- if(self::$instance == null) {
+ public static function &getSingleton()
+ {
+ // Check if an instance exists
+ if(is_null(self::$instance))
+ {
self::$instance = new Session();
- }
-
+ }
+
return self::$instance;
}
-
+
####################
#
# Public Functions
@@ -75,7 +101,7 @@
####################
/**
- * This is going to update the
+ * This is going to update the
* Users info to the DB and then
* Remove the entry from the DB
*
@@ -86,77 +112,79 @@
while($Session = $this->db->getRows($Session_SQL))
{
$User = $this->db->getRows($this->db->query('SELECT * FROM '. USERS_TABLE .' WHERE ID = \''. $_SESSION['UserID'] .'\''));
-
+
// Get User Data, Update
$NewTime = $User['Total_time'] + ($Session['Session_End'] - $Session['Session_Start']);
- $this->db->query('UPDATE '. USERS_TABLE .' SET Total_time = \''. $NewTime .'\'');
+ $this->db->query('UPDATE '. USERS_TABLE .' SET Total_time = \''. $NewTime .'\'');
// Then Kill It. Kill It Dead.
$this->haltSession('User', $_SESSION['UserID']);
}
}
-
+
/**
* When a user logs in the session
* is updated with their user id,
* so that when they log out, their
* time online can be logged.
- *
+ *
* $User = $Userdata['ID']
*
* @param UserID $User
*/
public function hijack($User)
{
- // Set UserID In Session,
+ // Set UserID In Session,
// Because it will save an
// SQL Query Later On
- $this->setSessionVars('UserID', $User);
-
+ $this->setValue('UserID', $User);
+
// Update Certain User Info
$this->db->query('UPDATE '. USERS_TABLE .' SET LoginNumber=LoginNumber+1,LastOn = \''.time().'\' WHERE ID = \'' . $User . '\'');
// Update Session WIth User ID
$this->db->query('UPDATE '. SESSIONS_TABLE .' SET User = \''. $User .'\' WHERE Session_ID = \''. $_SESSION['ID'] . '\'');
-
+
// Update Session
$this->updateSession();
}
-
+
####################
#
# Private Functions
#
####################
-
+
/**
- * Sets a $_Session Var
+ * Sets a new value of a session variable specified by key
*
- * @param Array Key Name $ArrN
- * @param Value $Value
+ * @param string $key Key of the session variable
+ * @param mixed $value New value of the session variable
*/
- private function setSessionVars($ArrN, $Value)
+ private function setValue($key, $value)
{
- $_SESSION[$ArrN] = $Value;
+ $_SESSION[$key] = $value;
}
-
+
/**
- * Checks if given is existing
+ * Checks if a given key/value combination exists in the database
*
- * @param What Feild $What
- * @param Value $This
+ * @param string $key Key of the database field
+ * @param mixed $value Value of the database field
+ * @return true if combination was found in database, false otherwise
*/
- private function exists($What, $This)
+ private function exists($key, $value)
{
- $S_Query = $this->db->query('SELECT * FROM '. SESSIONS_TABLE .' WHERE '. $What .' = \''. $This . '\'');
+ $S_Query = $this->db->query('SELECT * FROM '. SESSIONS_TABLE .' WHERE '. $key .' = \''. $value . '\'');
+
if($this->db->numRows($S_Query) != 0)
{
return true;
}
-
+
return false;
}
-
+
/**
* Create a brand spanking new session
*
@@ -166,18 +194,18 @@
// Get Session Vars
$Session_ID = Core::getSingleton()->getNextID(SESSIONS_TABLE, 'Session_ID');
$Session_Time = time();
-
- // Set $_Session Vars
- $this->setSessionVars('ID', $Session_ID);
- $this->setSessionVars('Time', $Session_Time);
-
+
+ // Set $_SESSION Vars
+ $this->setValue('ID', $Session_ID);
+ $this->setValue('Time', $Session_Time);
+
// Insert into datanase
$this->db->query('INSERT INTO '. SESSIONS_TABLE .' (Session_ID, Session_Start, Session_End, Session_Key, User)
VALUES (\'' . $Session_ID . '\', \''. $Session_Time .'\', \''. $Session_Time .'\', \''. $this->SessionKey . '\', \''. $UserID .'\')');
- }
-
+ }
+
/**
- * If the Session ID Var exists,
+ * If the Session ID Var exists,
* create it to an existing session
*/
private function createFromID()
@@ -185,14 +213,14 @@
// Get Session Vars
$Session_ID = $_SESSION['ID'];
$Session_Time = time();
-
+
// Check time and
// Set $_Session Vars
if(!isset($_SESSION['Time']))
{
- $this->setSessionVars('Time', $Session_Time);
+ $this->setValue('Time', $Session_Time);
}
-
+
if($_SESSION['UserID'] != '')
{
$UserID = $_SESSION['UserID'];
@@ -206,16 +234,16 @@
$this->db->query('INSERT INTO '. SESSIONS_TABLE .' (Session_ID, Session_Start, Session_End, Session_Key, User)
VALUES (\'' . $Session_ID . '\', \''. $Session_Time .'\', \''. $Session_Time .'\', \''. $this->SessionKey . '\', \''. $UserID .'\')');
}
-
+
/**
- * If the Session ID Var exists,
+ * If the Session ID Var exists,
* create it to an existing session
*/
private function createWithID()
{
// Insert into datanase
$this->db->query('UPDATE '. SESSIONS_TABLE .' SET Session_Key = \''. $this->SessionKey . '\' WHERE Session_ID = \''. $_SESSION['ID'].'\'');
- }
+ }
/**
* If the IP is inserted in the db
* create a session based off it
@@ -228,16 +256,14 @@
// Get Session Vars
$_SESSION['ID'] = $Result['Session_ID'];
- $Session_Time = time();
-
- // Check time and
- // Set $_Session Vars
+
+ // Check time and set $_Session Vars
if(!isset($_SESSION['Time']))
{
- $this->setSessionVars('Time', $Session_Time);
+ $this->setValue('Time', time());
}
- }
-
+ }
+
/**
* Update Session End Time
* With The Current Time
@@ -247,14 +273,14 @@
{
// Set new Session Time
$_SESSION['Time'] = time();
-
+
// Update session db time
$this->db->query('UPDATE '. SESSIONS_TABLE .' SET Session_End = \''. time() .'\' WHERE Session_ID = \''. $_SESSION['ID'] . '\'');
-
+
// Handle Sessions
$this->handleSessions();
}
-
+
/**
* This checks the db when called
* and looks for expired sessions.
@@ -274,14 +300,14 @@
if($Session['User'] != '0')
{
$NewTime = $Session['Total_time'] + ($Session['Session_End'] - $Session['Session_Start']);
- $this->db->query('UPDATE '. USERS_TABLE .' SET Total_time = \''. $NewTime .'\'');
+ $this->db->query('UPDATE '. USERS_TABLE .' SET Total_time = \''. $NewTime .'\'');
}
-
+
$this->haltSession('Session_ID', $Session['Session_ID']);
}
}
}
-
+
/**
* Kills the session in the DB
* and if a user is attached,
@@ -293,11 +319,11 @@
private function haltSession($Field, $ID)
{
$this->db->query('DELETE FROM '. SESSIONS_TABLE .' WHERE '. $Field .' = \''. $ID . '\'');
- }
+ }
/**
* This function handles the cookies
- *
+ *
* -- This fixes the session hijack
* of the same ip.
*
@@ -313,7 +339,7 @@
}
else if($_COOKIE['aGsSession'] == '')
{
- setcookie('aGsSession', $Key);
+ setcookie('aGsSession', $Key);
}
$this->SessionKey = $_COOKIE['aGsSession'];
Modified: trunk/jasmine/classes/exceptions.class.php
===================================================================
--- trunk/jasmine/classes/exceptions.class.php 2007-08-07 04:57:06 UTC (rev 124)
+++ trunk/jasmine/classes/exceptions.class.php 2007-08-07 15:34:23 UTC (rev 125)
@@ -1,124 +1,120 @@
<?php
/**
- * Implements all Exceptions, which can be thrown by Jasmine
+ * Definition and implementation of all exceptions, which are throwable by
+ * Jasmine
*
* @author PHPNews Team
* @license http://opensource.org/licenses/gpl-license.php GNU General Public Licence
- * @copyright (c) 2005-2006 PHPNews Team
+ * @copyright (c) 2005-2007 PHPNews Team
* @version 0.1.0
* @package Jasmine
*/
+require_once 'Logger.class.php';
+
/**
- * The NonExistingFunctionException class
+ * Thrown if the user tries to establish a connection to a non existent class
+ * method.
*
- * This exception is thrown if the user tries to establish a connection to a non
- * existent function. Function and class name are printed in the error string,
- * to help correcting the error.
- *
* @author PHPNews Team
* @license http://opensource.org/licenses/gpl-license.php GNU General Public Licence
- * @copyright (c) 2005-2006 PHPNews Team
- * @version 0.1.0
+ * @copyright (c) 2005-2007 PHPNews Team
+ * @version 0.9
* @package Jasmine
*/
-class NonExistingFunctionException extends Exception
+class NoSuchMethodException extends Exception
{
/**
- * Default constructor
+ * Sets the error message
*
- * @param string $class Name of the class
- * @param string $function Name of the non existing function
+ * @param string Name of the class
+ * @param string Name of the non existing function
+ * @todo Add logger output
*/
- public function __construct($class, $function)
+ public function __construct(&$class, &$method)
{
- $message = "NonExistingFunctionException: Function {$function} does "
- ."not exist in class {$class}";
+ $message = "Method {$method} does not exist in class {$class}";
- // Call the parent constructor
parent::__construct($message);
}
}
/**
- * The NonExistingExtensionException class
+ * Thrown if the user tries to connect the same signal to the same slot twice.
*
- * This exception is thrown if for a specified class name, there is no instance
- * found, which could be returned.
- *
* @author PHPNews Team
* @license http://opensource.org/licenses/gpl-license.php GNU General Public Licence
- * @copyright (c) 2005-2006 PHPNews Team
- * @version 0.1.0
+ * @copyright (c) 2005-2007 PHPNews Team
+ * @version 0.9
* @package Jasmine
*/
-class NonExistingExtensionException extends Exception
+class MultipleConnectException extends Exception
{
- public function __construct($class)
+ /**
+ * Sets the error message
+ *
+ * @param string Name of the sending object
+ * @param string Name of the sending object's signal
+ * @param string Name of the receiving object
+ * @param string Name of the receiving object's slot
+ * @todo Add logger output
+ */
+ public function __construct(&$sender, &$signal, &$receiver, &$slot)
{
- $message = "An instance of ${class} could not be found.";
+ $message = "Multiple connections from {$sender}::{$signal} to "
+ ."{$receiver}::{$slot} are not allowed.";
- // Call the parent constructor
parent::__construct($message);
}
}
/**
- * The UnhandeldSignalException class
+ * Thrown if a given function parameter is not of the expected type.
*
- * This exception is thrown if an sql statement contains an error
- *
* @author PHPNews Team
* @license http://opensource.org/licenses/gpl-license.php GNU General Public Licence
- * @copyright (c) 2005-2006 PHPNews Team
- * @version 0.1.0
+ * @copyright (c) 2005-2007 PHPNews Team
+ * @version 0.9
* @package Jasmine
*/
-class UnhandeldSignalException extends Exception
+class WrongParameterTypeException extends Exception
{
/**
- * Default constructor
+ * Sets the error message
*
- * @param string $sql Failing SQL statement
+ * @param string The paramter type the function received
+ * @param string The parameter type the function expected
+ * @todo Add logger output
*/
- public function __construct($sql)
+ public function __construct(&$givenType, &$expectedType)
{
- $message = '';
+ $message = "The function expected a parameter of type ${expectedType} "
+ ."but it got ${givenType} instead.";
- // Call the parent constructor
parent::__construct($message);
}
}
/**
- * The MultipleConnectException exception
+ * Thrown if a class should be used, but is not defined before.
*
- * This exception is thrown if the user tries to connect the same signal to the
- * same slot twice.
- *
* @author PHPNews Team
* @license http://opensource.org/licenses/gpl-license.php GNU General Public Licence
- * @copyright (c) 2005-2006 PHPNews Team
- * @version 0.1.0
+ * @copyright (c) 2005-2007 PHPNews Team
+ * @version 0.9
* @package Jasmine
*/
-class MultipleConnectException extends Exception
+class NoClassDefinitionException extends Exception
{
/**
- * Default constructor
+ * Sets the error message
*
- * @param string
- * @param string
- * @param string
- * @param string
- * @param int
+ * @param string Name of class
+ * @todo Add logger output
*/
- public function __construct($sender, $signal, $receiver, $slot, $type)
+ public function __construct(&$name)
{
- $message = "A connection between ${sender}:${signal} to ${receiver}::"
- ."${slot} cannot be established. You are not allowed to make "
- ."multiple connections between the same sender::signal to "
- ."receiver::slot";
+ $message = "The class {$name} was not defined.";
// Call the parent constructor
parent::__construct($message);
@@ -126,23 +122,26 @@
}
/**
- * The WrongParameterTypeException exception
+ * Thrown if a class tries to access the XML parser's functionality, but
+ * no XML parser was created.
*
- * This exception is thrown if a given parameter of a function is not of an
- * expected type.
- *
* @author PHPNews Team
* @license http://opensource.org/licenses/gpl-license.php GNU General Public Licence
- * @copyright (c) 2005-2006 PHPNews Team
- * @version 0.1.0
+ * @copyright (c) 2005-2007 PHPNews Team
+ * @version 0.9
* @package Jasmine
*/
-class WrongParameterTypeException extends Exception
+final class NoXmlParserException extends Exception
{
- public function __construct($give_type, $expected_type)
+ /**
+ * Sets the error message
+ *
+ * @todo Add logger output
+ */
+ public function __construct()
{
- $message = "The function expected a parameter of type ${expected_type} "
- ."but it got ${give_type} instead.";
+ $message = 'No XML parser registered. Please register one with '
+ .'setXmlParser before using its functionality.';
// Call the parent constructor
parent::__construct($message);
@@ -150,145 +149,155 @@
}
/**
- * The NoClassFoundException exception
+ * Thrown if general IO errors, like missing files etc, occur.
*
- * This exception is thrown if a class should be used, but is not
- * defined before.
- *
* @author PHPNews Team
* @license http://opensource.org/licenses/gpl-license.php GNU General Public Licence
- * @copyright (c) 2005-2006 PHPNews Team
+ * @copyright (c) 2005-2007 PHPNews Team
* @version 0.1.0
* @package Jasmine
*/
-class NoClassFoundException extends Exception
+final class FileIOException extends Exception
{
- public function __construct($name)
+ public function __construct(&$message)
{
- $message = "The class {$name} was not defined.";
-
// Call the parent constructor
parent::__construct($message);
}
}
/**
- * The NoXmlParserException exception
+ * Thrown if the XML parser finds an error while parsing an XML document.
*
- * This exception is thrown if a class tries to access the XML parser's functionality, but
- * no XML parser was created.
- *
* @author PHPNews Team
* @license http://opensource.org/licenses/gpl-license.php GNU General Public Licence
- * @copyright (c) 2005-2006 PHPNews Team
- * @version 0.1.0
+ * @copyright (c) 2005-2007 PHPNews Team
+ * @version 0.9
* @package Jasmine
*/
-final class NoXmlParserException extends Exception
+final class XmlParseException extends Exception
{
- public function __construct()
+ /**
+ * Sets the error message
+ *
+ * @param string Name of the XML file
+ * @param string Name of the XML schema file
+ * @todo Add logger output
+ */
+ public function __construct(&$filename, &$schema = '')
{
- $message = 'No XML parser registered. Please register one with setXmlParser before using '
- .'its functionality.';
+ // A general parse error happend
+ if (empty($schema))
+ {
+ $message = "While parsing {$filename} the following error occured:\n";
+ }
+ else
+ {
+ $message = "While validating {$filename} against the XML schema {$schema} the "
+ ."following error occured:\n";
+ }
+ // Append the libxml error to the message
+ $error = libxml_get_last_error();
+ $message .= "line: {$error->line}, column: {$error->column}, {$error->message}";
+
// Call the parent constructor
parent::__construct($message);
}
}
/**
- * The FileIOException exception
+ * Thrown if a requested XML attribute is not found.
*
- * This exception is thrown if general IO errors, like missing files etc, occur.
- *
* @author PHPNews Team
* @license http://opensource.org/licenses/gpl-license.php GNU General Public Licence
- * @copyright (c) 2005-2006 PHPNews Team
+ * @copyright (c) 2005-2007 PHPNews Team
* @version 0.1.0
* @package Jasmine
*/
-final class FileIOException extends Exception
+final class NoSuchAttributeException extends Exception
{
- public function __construct($message)
+ public function __construct(&$tag, &$attribute)
{
+ $message = "The tag {$tag} has no attribute {$attribute}.";
+
// Call the parent constructor
parent::__construct($message);
}
}
/**
- * The XmlParseException exception
+ * Thrown if a requested array key is not found.
*
- * This exception is thrown if the XML parser finds an error while parsing an XML document.
- *
* @author PHPNews Team
* @license http://opensource.org/licenses/gpl-license.php GNU General Public Licence
- * @copyright (c) 2005-2006 PHPNews Team
- * @version 0.1.0
+ * @copyright (c) 2005-2007 PHPNews Team
+ * @version 0.9
* @package Jasmine
*/
-final class XmlParseException extends Exception
+final class NoSuchArrayKeyException extends Exception
{
- public function __construct($filename, $schema = '')
+ /**
+ * Sets the error message
+ *
+ * @param mixed Missing array key
+ * @todo Add logger output
+ */
+ public function __construct(&$key)
{
- // A general parse error happend
- if (empty($schema))
- {
- $message = "While parsing {$filename} the following error occured:\n";
- }
- else
- {
- $message = "While validating {$filename} against the XML schema {$schema} the "
- ."following error occured:\n";
- }
+ $message = "The key {$key} does not exist in array.";
- // Append the libxml error to the message
- $error = libxml_get_last_error();
- $message .= "line: {$error->line}, column: {$error->column}, {$error->message}";
-
// Call the parent constructor
parent::__construct($message);
}
}
/**
- * The NoSuchAttributeException
- *
- * This exception is thrown if a requested XML attribute is not found.
- *
+ * Thrown if a requested type/extension does not exist.
+ *
* @author PHPNews Team
* @license http://opensource.org/licenses/gpl-license.php GNU General Public Licence
- * @copyright (c) 2005-2006 PHPNews Team
- * @version 0.1.0
+ * @copyright (c) 2005-2007 PHPNews Team
+ * @version 0.9
* @package Jasmine
*/
-final class NoSuchAttributeException extends Exception
+final class NoSuchExtensionException extends Exception
{
- public function __construct($tag, $attribute)
+ /**
+ * Sets the error message
+ *
+ * @param string Name of the extension
+ * @param string Name of the extension type
+ * @todo Add logger output
+ */
+ public function __construct(&$extension, &$type)
{
- $message = "The tag {$tag} has no attribute {$attribute}.";
-
- // Call the parent constructor
+ $message = "Requested extension {$extension} of type ${type} does not exist.";
+
parent::__construct($message);
}
}
/**
- * The NoSuchArrayKeyException
- *
- * This exception is thrown if a requested array key is not found.
- *
+ * Thrown if a requested extension type or factory is not found.
+ *
* @author PHPNews Team
* @license http://opensource.org/licenses/gpl-license.php GNU General Public Licence
- * @copyright (c) 2005-2006 PHPNews Team
- * @version 0.1.0
+ * @copyright (c) 2005-2007 PHPNews Team
+ * @version 0.9
* @package Jasmine
*/
-final class NoSuchArrayKeyException extends Exception
+final class NoSuchExtensionTypeException extends Exception
{
- public function __construct($key)
+ /**
+ * Sets the error message
+ *
+ * @param string Name of the extension type
+ * @todo Add logger output
+ */
+ public function __construct($type)
{
- $message = "The key {$key} does not exist in array.";
+ $message = "Requested extension type {$type} does not exist.";
// Call the parent constructor
parent::__construct($message);
Modified: trunk/jasmine/dotests.sh
===================================================================
--- trunk/jasmine/dotests.sh 2007-08-07 04:57:06 UTC (rev 124)
+++ trunk/jasmine/dotests.sh 2007-08-07 15:34:23 UTC (rev 125)
@@ -3,7 +3,7 @@
# Path to phpunit executable
# (don't forget the trailing slash)
-PATH_PHPUNIT="/usr/local/php5/bin/";
+PATH_PHPUNIT="/usr/bin/";
# Check for database configuration file
if [ ! -e db_config.php ]; then
Modified: trunk/jasmine/makedoc.sh
===================================================================
--- trunk/jasmine/makedoc.sh 2007-08-07 04:57:06 UTC (rev 124)
+++ trunk/jasmine/makedoc.sh 2007-08-07 15:34:23 UTC (rev 125)
@@ -1,94 +1,50 @@
-#!/bin/bash
-# $Id: makedoc.sh 23 2005-08-23 15:38:46Z christoph_berg $
+#!/bin/sh
+# Creates Jasmine's API documentation
-#/**
-# * makedoc - PHPDocumentor script to save your settings
-# *
-# * Put this file inside your PHP project homedir, edit its variables and run whenever you wants to
-# * re/make your project documentation.
-# *
-# * The version of this file is the version of PHPDocumentor it is compatible.
-# *
-# * It simples run phpdoc with the parameters you set in this file.
-# * NOTE: Do not add spaces after bash variables.
-# *
-# * @copyright makedoc.sh is part of PHPDocumentor project {@link http://freshmeat.net/projects/phpdocu/} and its LGPL
-# * @author Roberto Berto <darkelder (inside) users (dot) sourceforge (dot) net>
-# * @version Release-1.1.0
-# */
+# Path to PHPDoc executable
+PATH_PHPDOC=phpdoc
+# The PROJECT_NAME tag is a single word or a sequence of words surrounded
+# by quotes that should identify the project.
-##############################
-# should be edited
-##############################
+PROJECT_NAME="Jasmine"
-#/**
-# * title of generated documentation, default is 'Generated Documentation'
-# *
-# * @var string TITLE
-# */
-TITLE="Jasmine 0.1.0 API Documentation"
+# The PROJECT_NUMBER tag can be used to enter a project or revision number.
+# This could be handy for archiving the generated documentation or
+# if some version control system is used.
-#/**
-# * name to use for the default package. If not specified, uses 'default'
-# *
-# * @var string PACKAGES
-# */
-PACKAGES="Jasmine"
+PROJECT_NUMBER="0.9"
-#/**
-# * name of a directory(s) to parse directory1,directory2
-# * $PWD is the directory where makedoc.sh
-# *
-# * @var string PATH_PROJECT
-# */
-PATH_PROJECT=classes,modules
+# The INPUT tag can be used to specify the directories that contain
+# documented source files. You may enter directories like "/usr/src/myproject".
+# Separate the directories with commas.
-#/**
-# * path of PHPDoc executable
-# *
-# * @var string PATH_PHPDOC
-# */
-PATH_PHPDOC=phpdoc
+INPUT="classes,modules"
-#/**
-# * where documentation will be put
-# *
-# * @var string PATH_DOCS
-# */
-PATH_DOCS=$PWD/doc
+# The OUTPUT_DIRECTORY tag is used to specify the (relative or absolute)
+# base path where the generated documentation will be put.
+# If a relative path is entered, it will be relative to the location
+# where phpdoc was started. If left blank the current directory will be used.
-#/**
-# * what outputformat to use (html/pdf)
-# *
-# * @var string OUTPUTFORMAT
-# */
-OUTPUTFORMAT=HTML
+OUTPUT_DIRECTORY="./doc"
-#/**
-# * converter to be used
-# *
-# * @var string CONVERTER
-# */
+# Outputformat to use (html/pdf)
+OUTPUTFORMAT="HTML"
+
+# Converter to be used
CONVERTER=Smarty
-#/**
-# * template to use
-# *
-# * @var string TEMPLATE
-# */
+# Template to use
TEMPLATE=PHP
-#/**
-# * parse elements marked as private
-# *
-# * @var bool (on/off) PRIVATE
-# */
-PRIVATE=on
+# If the EXTRACT_PRIVATE tag is set to on all private members of a class
+# will be included in the documentation.
-# make documentation
-$PATH_PHPDOC -d $PATH_PROJECT -t $PATH_DOCS -ti "$TITLE" -dn $PACKAGES \
--o $OUTPUTFORMAT:$CONVERTER:$TEMPLATE -pp $PRIVATE
+EXTRACT_PRIVATE=on
-
-# vim: set expandtab :
+# Create documentation
+${PATH_PHPDOC} --directory ${INPUT} --target ${OUTPUT_DIRECTORY} \
+ --title "${PROJECT_NAME} ${PROJECT_NUMBER} API Documentation" \
+ --defaultpackagename ${PROJECT_NAME} \
+ --output ${OUTPUTFORMAT}:${CONVERTER}:${TEMPLATE} \
+ --parseprivate ${EXTRACT_PRIVATE}
Modified: trunk/jasmine/modules/DB/DB.class.php
===================================================================
--- trunk/jasmine/modules/DB/DB.class.php 2007-08-07 04:57:06 UTC (rev 124)
+++ trunk/jasmine/modules/DB/DB.class.php 2007-08-07 15:34:23 UTC (rev 125)
@@ -4,8 +4,8 @@
*
* @author PHPNews Team
* @license http://opensource.org/licenses/gpl-license.php GNU General Public Licence
- * @copyright (c) 2005-2006 PHPNews Team
- * @version 0.1.0
+ * @copyright (c) 2005-2007 PHPNews Team
+ * @version 0.5
* @package Jasmine
*/
@@ -21,11 +21,11 @@
*
* @author PHPNews Team
* @license http://opensource.org/licenses/gpl-license.php GNU General Public Licence
- * @copyright (c) 2005-2006 PHPNews Team
- * @version 0.1.0
+ * @copyright (c) 2005-2007 PHPNews Team
+ * @version 0.5
* @package Jasmine
- *
- * TODO: add numRows function.
+ *
+ * @todo add numRows function, revise class completely
*/
class DB extends Module
{
Modified: trunk/jasmine/modules/Settings/Settings.class.php
===================================================================
--- trunk/jasmine/modules/Settings/Settings.class.php 2007-08-07 04:57:06 UTC (rev 124)
+++ trunk/jasmine/modules/Settings/Settings.class.php 2007-08-07 15:34:23 UTC (rev 125)
@@ -5,7 +5,7 @@
* @author PHPNews Team
* @license http://opensource.org/licenses/gpl-license.php GNU General Public Licence
* @copyright (c) 2005-2006 PHPNews Team
- * @version 0.1.0
+ * @version 0.9
* @package Jasmine
*/
@@ -17,7 +17,7 @@
* @author PHPNews Team
* @license http://opensource.org/licenses/gpl-license.php GNU General Public Licence
* @copyright (c) 2003-2005 PHPNews Team
- * @version 0.1.0
+ * @version 0.9
* @package Jasmine
*/
Modified: trunk/jasmine/sql/mysql.sql
===================================================================
--- trunk/jasmine/sql/mysql.sql 2007-08-07 04:57:06 UTC (rev 124)
+++ trunk/jasmine/sql/mysql.sql 2007-08-07 15:34:23 UTC (rev 125)
@@ -2,15 +2,13 @@
SET SQL_MODE="NO_AUTO_VALUE_ON_ZERO";
---
+--
-- Database: `jasmine`
---
+--
--- --------------------------------------------------------
-
---
+--
-- Table structure for table `jasmine_groups`
---
+--
CREATE TABLE IF NOT EXISTS `jasmine_groups` (
`id` tinyint(3) unsigned NOT NULL auto_increment,
@@ -18,16 +16,9 @@
PRIMARY KEY (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_bin COMMENT='Stores all definied groups' AUTO_INCREMENT=1 ;
---
--- Dumping data for table `jasmine_groups`
---
-
-
--- --------------------------------------------------------
-
---
+--
-- Table structure for table `jasmine_modules`
---
+--
CREATE TABLE IF NOT EXISTS `jasmine_modules` (
`id` tinyint(3) unsigned NOT NULL auto_increment,
@@ -35,16 +26,10 @@
PRIMARY KEY (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_bin COMMENT='Stores all installed modules' AUTO_INCREMENT=1 ;
---
--- Dumping data for table `jasmine_modules`
---
-
--- --------------------------------------------------------
-
---
+--
-- Table structure for table `jasmine_modules_features`
---
+--
CREATE TABLE IF NOT EXISTS `jasmine_modules_features` (
`mid` tinyint(4) NOT NULL,
@@ -53,35 +38,21 @@
PRIMARY KEY (`mid`,`id`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_bin COMMENT='Stores module features, which can be restricted via permissi';
---
--- Dumping data for table `jasmine_modules_features`
---
-
-
--- --------------------------------------------------------
-
---
+--
-- Table structure for table `jasmine_permissions_groups`
---
+--
CREATE TABLE IF NOT EXISTS `jasmine_permissions_groups` (
`gid` tinyint(3) unsigned NOT NULL,
`mid` tinyint(3) unsigned NOT NULL,
`fid` tinyint(3) unsigned NOT NULL,
- `allowed` tinyint(1) NOT NULL,
+ `allowed` tinyint(1) NOT NULL COMMENT 'Boolean values: 0 = false, 1 = true',
KEY `gid` (`gid`,`mid`,`fid`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_bin COMMENT='Stores permissions on a group/feature base';
---
--- Dumping data for table `jasmine_permissions_groups`
---
-
-
--- --------------------------------------------------------
-
---
+--
-- Table structure for table `jasmine_permissions_users`
---
+--
CREATE TABLE IF NOT EXISTS `jasmine_permissions_users` (
`uid` tinyint(4) NOT NULL,
@@ -91,69 +62,42 @@
PRIMARY KEY (`uid`,`mid`,`fid`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_bin COMMENT='Stores permissions on a user/feature base';
---
--- Dumping data for table `jasmine_permissions_users`
---
-
-
--- --------------------------------------------------------
-
---
+--
-- Table structure for table `jasmine_sessions`
---
+--
CREATE TABLE IF NOT EXISTS `jasmine_sessions` (
`Session_ID` int(4) unsigned NOT NULL,
`Session_Start` int(4) unsigned NOT NULL default '0',
- `Session_End` varchar(255) collate latin1_general_ci NOT NULL,
- `Session_Key` varchar(32) collate latin1_general_ci NOT NULL,
+ `Session_End` varchar(255) collate utf8_bin NOT NULL,
+ `Session_Key` varchar(32) collate utf8_bin NOT NULL,
`User` int(6) unsigned NOT NULL default '0',
PRIMARY KEY (`Session_ID`)
-) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_general_ci PACK_KEYS=1;
+) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_bin PACK_KEYS=1;
---
--- Dumping data for table `jasmine_sessions`
---
-
-
--- --------------------------------------------------------
-
---
+--
-- Table structure for table `jasmine_settings`
---
+--
CREATE TABLE IF NOT EXISTS `jasmine_settings` (
`variable` varchar(20) collate utf8_bin NOT NULL default '',
`value` text collate utf8_bin NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_bin COMMENT='Stores various variables to configure Jasmine';
---
--- Dumping data for table `jasmine_settings`
---
-
-
--- --------------------------------------------------------
-
---
+--
-- Table structure for table `jasmine_users`
---
+--
CREATE TABLE IF NOT EXISTS `jasmine_users` (
`ID` int(13) unsigned NOT NULL default '0',
- `Username` varchar(16) collate latin1_general_ci NOT NULL default '',
- `Password` varchar(32) collate latin1_general_ci NOT NULL,
- `Email` varchar(255) collate latin1_general_ci NOT NULL default '',
- `Reg_Date` varchar(40) collate latin1_general_ci NOT NULL default '',
- `LastOn` varchar(24) collate latin1_general_ci NOT NULL default '',
- `LoginNumber` varchar(6) collate latin1_general_ci NOT NULL default '',
+ `Username` varchar(16) collate utf8_bin NOT NULL default '',
+ `Password` varchar(32) collate utf8_bin NOT NULL,
+ `Email` varchar(255) collate utf8_bin NOT NULL default '',
+ `Reg_Date` varchar(40) collate utf8_bin NOT NULL default '',
+ `LastOn` varchar(24) collate utf8_bin NOT NULL default '',
+ `LoginNumber` varchar(6) collate utf8_bin NOT NULL default '',
`Group` int(5) NOT NULL default '0',
- `Language` varchar(10) collate latin1_general_ci NOT NULL default '',
- `Total_time` varchar(32) collate latin1_general_ci NOT NULL default '',
+ `Language` varchar(10) collate utf8_bin NOT NULL default '',
+ `Total_time` varchar(32) collate utf8_bin NOT NULL default '',
PRIMARY KEY (`ID`)
-) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_general_ci PACK_KEYS=1;
-
---
--- Dumping data for table `jasmine_users`
---
-
-
+) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_bin PACK_KEYS=1;
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <Re...@us...> - 2007-08-07 04:57:05
|
Revision: 124
http://newsphp.svn.sourceforge.net/newsphp/?rev=124&view=rev
Author: Red-
Date: 2007-08-06 21:57:06 -0700 (Mon, 06 Aug 2007)
Log Message:
-----------
Updated MySQL, Fixed Session Bug, Renamed Methods, Updated User Class
Modified Paths:
--------------
trunk/jasmine/classes/Session.Class.php
trunk/jasmine/classes/User.class.php
trunk/jasmine/modules/DB/DB.class.php
trunk/jasmine/sql/mysql.sql
Modified: trunk/jasmine/classes/Session.Class.php
===================================================================
--- trunk/jasmine/classes/Session.Class.php 2007-08-01 15:15:36 UTC (rev 123)
+++ trunk/jasmine/classes/Session.Class.php 2007-08-07 04:57:06 UTC (rev 124)
@@ -1,89 +1,86 @@
<?php
class Session
{
- // Set isntance for singleton
+ // Set instance for singleton
static private $instance;
+ private $SessionKey;
private $db;
public function __construct()
- {
- // Start DB Extension
+ {
+ // Load DB Module
$this->db =& ExtensionManager::getSingleton()->getExtension('DB', 'Module');
- }
-
- /**
- * Singleton method
- */
- static function getSingleton() {
- if(self::$instance == null) {
- self::$instance = new Session();
- }
- return self::$instance;
- }
-
- ####################
- #
- # Public Functions
- #
- ####################
-
- /**
- * This Starts The Basic
- * Session Core
- *
- * @todo Need to fix IP check
- *
- * -- If two users sit behind
- * a router, and no session exitst
- * they will hijack their partners
- * session. Possible fixes, Cookies
- * To Deteremine the different users
- *
- */
- public function start()
- {
+ // Check for Cookie Key
+ $this->checkCookieJar();
+
// Check If The Session_ID Exists
if(!isset($_SESSION['ID']))
- {
+ {
// Before we enter duplicate entries, check of it exists as another session
- if(!$this->sExist('Session_IP', $_SERVER['REMOTE_ADDR']))
+ if(!$this->exists('Session_Key', $this->SessionKey))
{
// Create Session
- $this->sCreate();
+ $this->createEntry();
}
// If it exists, update it with the newest session info
- else
+ else if($this->exists('Session_Key', $this->SessionKey))
{
// Create Session
- $this->sCreateFromIP();
+ $this->createFromKey();
}
}
// or Check if a DB entry exists
- else if(isset($_SESSION['ID']) && !$this->sExist('Session_ID', $_SESSION['ID']))
+ else if(isset($_SESSION['ID']))
{
- // Create Session
- $this->sCreateFromID();
+ if(!$this->exists('Session_ID', $_SESSION['ID']))
+ {
+ // Create Session
+ $this->createFromID();
+ }
+
+ // Check for a db entry with the key
+ if(!$this->exists('Session_Key', $this->SessionKey))
+ {
+ // Create Session
+ $this->createWithID();
+ }
+
+ // Otherwise, update the DB if it's
+ // The right time to update
+ else if(time() - $_SESSION['Time'] >= 300)
+ {
+ $this->updateSession();
+ }
}
+ }
+
+ /**
+ * Singleton method
+ */
+ static function getSingleton() {
+ if(self::$instance == null) {
+ self::$instance = new Session();
+ }
- // Otherwise, update the DB if it's
- // The right time to update
- else if(time() - $_SESSION['Time'] >= 300)
- {
- $this->sUpdate();
- }
+ return self::$instance;
}
+ ####################
+ #
+ # Public Functions
+ #
+ ####################
+
/**
- * This is the logout
- *
- * Update the user time
- * Then Run The Handler
+ * This is going to update the
+ * Users info to the DB and then
+ * Remove the entry from the DB
*
*/
- public function sLogout()
+ public function logout()
{
$Session_SQL = $this->db->query('SELECT * FROM '. SESSIONS_TABLE .' WHERE Session_ID = \''. $_SESSION['ID'] .'\'');
while($Session = $this->db->getRows($Session_SQL))
@@ -95,21 +92,26 @@
$this->db->query('UPDATE '. USERS_TABLE .' SET Total_time = \''. $NewTime .'\'');
// Then Kill It. Kill It Dead.
- $this->sKill('User', $_SESSION['UserID']);
+ $this->haltSession('User', $_SESSION['UserID']);
}
}
/**
- * Hijack The Session
+ * When a user logs in the session
+ * is updated with their user id,
+ * so that when they log out, their
+ * time online can be logged.
+ *
+ * $User = $Userdata['ID']
*
- * @param User ID $User
+ * @param UserID $User
*/
- public function sHijack($User)
+ public function hijack($User)
{
// Set UserID In Session,
// Because it will save an
// SQL Query Later On
- $this->sSet('UserID', $User);
+ $this->setSessionVars('UserID', $User);
// Update Certain User Info
$this->db->query('UPDATE '. USERS_TABLE .' SET LoginNumber=LoginNumber+1,LastOn = \''.time().'\' WHERE ID = \'' . $User . '\'');
@@ -118,7 +120,7 @@
$this->db->query('UPDATE '. SESSIONS_TABLE .' SET User = \''. $User .'\' WHERE Session_ID = \''. $_SESSION['ID'] . '\'');
// Update Session
- $this->sUpdate();
+ $this->updateSession();
}
####################
@@ -128,12 +130,12 @@
####################
/**
- * Sets $_Session Var
+ * Sets a $_Session Var
*
* @param Array Key Name $ArrN
* @param Value $Value
*/
- private function sSet($ArrN, $Value)
+ private function setSessionVars($ArrN, $Value)
{
$_SESSION[$ArrN] = $Value;
}
@@ -144,10 +146,10 @@
* @param What Feild $What
* @param Value $This
*/
- private function sExist($What, $This)
+ private function exists($What, $This)
{
$S_Query = $this->db->query('SELECT * FROM '. SESSIONS_TABLE .' WHERE '. $What .' = \''. $This . '\'');
- if($this->db->sqlNumrows($S_Query) != 0)
+ if($this->db->numRows($S_Query) != 0)
{
return true;
}
@@ -159,26 +161,26 @@
* Create a brand spanking new session
*
*/
- private function sCreate()
+ private function createEntry()
{
// Get Session Vars
$Session_ID = Core::getSingleton()->getNextID(SESSIONS_TABLE, 'Session_ID');
$Session_Time = time();
// Set $_Session Vars
- $this->sSet('ID', $Session_ID);
- $this->sSet('Time', $Session_Time);
+ $this->setSessionVars('ID', $Session_ID);
+ $this->setSessionVars('Time', $Session_Time);
// Insert into datanase
- $this->db->query('INSERT INTO '. SESSIONS_TABLE .' (Session_ID, Session_Start, Session_End, Session_IP, User)
- VALUES (\'' . $Session_ID . '\', \''. $Session_Time .'\', \''. $Session_Time .'\', \''. $_SERVER['REMOTE_ADDR'] . '\', \'0\')');
+ $this->db->query('INSERT INTO '. SESSIONS_TABLE .' (Session_ID, Session_Start, Session_End, Session_Key, User)
+ VALUES (\'' . $Session_ID . '\', \''. $Session_Time .'\', \''. $Session_Time .'\', \''. $this->SessionKey . '\', \''. $UserID .'\')');
}
/**
* If the Session ID Var exists,
* create it to an existing session
*/
- private function sCreateFromID()
+ private function createFromID()
{
// Get Session Vars
$Session_ID = $_SESSION['ID'];
@@ -188,22 +190,40 @@
// Set $_Session Vars
if(!isset($_SESSION['Time']))
{
- $this->sSet('Time', $Session_Time);
+ $this->setSessionVars('Time', $Session_Time);
}
+
+ if($_SESSION['UserID'] != '')
+ {
+ $UserID = $_SESSION['UserID'];
+ }
+ else
+ {
+ $UserID = '0';
+ }
// Insert into datanase
- $this->db->query('INSERT INTO '. SESSIONS_TABLE .' (Session_ID, Session_Start, Session_End, Session_IP, User)
- VALUES (\'' . $Session_ID . '\', \''. $Session_Time .'\', \''. $Session_Time .'\', \''. $_SERVER['REMOTE_ADDR'] . '\', \'0\')');
- }
+ $this->db->query('INSERT INTO '. SESSIONS_TABLE .' (Session_ID, Session_Start, Session_End, Session_Key, User)
+ VALUES (\'' . $Session_ID . '\', \''. $Session_Time .'\', \''. $Session_Time .'\', \''. $this->SessionKey . '\', \''. $UserID .'\')');
+ }
/**
+ * If the Session ID Var exists,
+ * create it to an existing session
+ */
+ private function createWithID()
+ {
+ // Insert into datanase
+ $this->db->query('UPDATE '. SESSIONS_TABLE .' SET Session_Key = \''. $this->SessionKey . '\' WHERE Session_ID = \''. $_SESSION['ID'].'\'');
+ }
+ /**
* If the IP is inserted in the db
* create a session based off it
*/
- private function sCreateFromIP()
+ private function createFromKey()
{
// Get Session Query
- $Query = $this->db->query('SELECT * FROM '. SESSIONS_TABLE .' WHERE Session_IP = \''. $_SERVER['REMOTE_ADDR'] . '\'');
+ $Query = $this->db->query('SELECT * FROM '. SESSIONS_TABLE .' WHERE Session_Key = \''. $this->SessionKey . '\'');
$Result = $this->db->getRows($Query);
// Get Session Vars
@@ -214,7 +234,7 @@
// Set $_Session Vars
if(!isset($_SESSION['Time']))
{
- $this->sSet('Time', $Session_Time);
+ $this->setSessionVars('Time', $Session_Time);
}
}
@@ -223,7 +243,7 @@
* With The Current Time
*
*/
- private function sUpdate()
+ private function updateSession()
{
// Set new Session Time
$_SESSION['Time'] = time();
@@ -232,13 +252,16 @@
$this->db->query('UPDATE '. SESSIONS_TABLE .' SET Session_End = \''. time() .'\' WHERE Session_ID = \''. $_SESSION['ID'] . '\'');
// Handle Sessions
- $this->sHandle();
+ $this->handleSessions();
}
/**
- * handle Sessions
+ * This checks the db when called
+ * and looks for expired sessions.
+ * If it finds any, it will kill them
+ * and update the users info.
*/
- private function sHandle()
+ private function handleSessions()
{
// Gather the SQL for all sessions
$Session_SQL = $this->db->query('SELECT * FROM '. SESSIONS_TABLE .' JOIN '.USERS_TABLE .'');
@@ -254,20 +277,46 @@
$this->db->query('UPDATE '. USERS_TABLE .' SET Total_time = \''. $NewTime .'\'');
}
- $this->sKill('Session_ID', $Session['Session_ID']);
+ $this->haltSession('Session_ID', $Session['Session_ID']);
}
}
}
/**
- * This one should go to jail.
+ * Kills the session in the DB
+ * and if a user is attached,
+ * update their info
*
* @param Field Name $Field
* @param Value $ID
*/
- private function sKill($Field, $ID)
+ private function haltSession($Field, $ID)
{
$this->db->query('DELETE FROM '. SESSIONS_TABLE .' WHERE '. $Field .' = \''. $ID . '\'');
}
+
+ /**
+ * This function handles the cookies
+ *
+ * -- This fixes the session hijack
+ * of the same ip.
+ *
+ */
+ private function checkCookieJar()
+ {
+ // Take the MD5 of the timestamp for your key.
+ $Key = md5(time());
+
+ if(!isset($_COOKIE['aGsSession']))
+ {
+ setcookie('aGsSession', $Key);
+ }
+ else if($_COOKIE['aGsSession'] == '')
+ {
+ setcookie('aGsSession', $Key);
+ }
+
+ $this->SessionKey = $_COOKIE['aGsSession'];
+ }
}
-?>
\ No newline at end of file
+?>
Modified: trunk/jasmine/classes/User.class.php
===================================================================
--- trunk/jasmine/classes/User.class.php 2007-08-01 15:15:36 UTC (rev 123)
+++ trunk/jasmine/classes/User.class.php 2007-08-07 04:57:06 UTC (rev 124)
@@ -25,7 +25,7 @@
$this->db =& ExtensionManager::getSingleton()->getExtension('DB', 'Module');
// Start Session
- Session::getSingleton()->start();
+ Session::getSingleton();
// Check Wigga
if(isset($_GET['Logout']))
@@ -91,8 +91,7 @@
// User Sessions Handling
if($_POST['FromFormLogin'] == 'True')
{
- // Session::getSingleton()->hijackSession($User);
- Session::getSingleton()->sHijack($this->Userdata['ID']);
+ Session::getSingleton()->hijack($this->Userdata['ID']);
// Refresh
Core::getSingleton()->Refresh();
@@ -149,7 +148,7 @@
*/
public function Logout()
{
- Session::getSingleton()->sLogout();
+ Session::getSingleton()->logout();
$_SESSION['Username'] = '';
$_SESSION['Password'] = '';
session_destroy();
Modified: trunk/jasmine/modules/DB/DB.class.php
===================================================================
--- trunk/jasmine/modules/DB/DB.class.php 2007-08-01 15:15:36 UTC (rev 123)
+++ trunk/jasmine/modules/DB/DB.class.php 2007-08-07 04:57:06 UTC (rev 124)
@@ -24,6 +24,8 @@
* @copyright (c) 2005-2006 PHPNews Team
* @version 0.1.0
* @package Jasmine
+ *
+ * TODO: add numRows function.
*/
class DB extends Module
{
Modified: trunk/jasmine/sql/mysql.sql
===================================================================
--- trunk/jasmine/sql/mysql.sql 2007-08-01 15:15:36 UTC (rev 123)
+++ trunk/jasmine/sql/mysql.sql 2007-08-07 04:57:06 UTC (rev 124)
@@ -1,50 +1,159 @@
--------------------------------------------------------------------------------
--- PHPNews 2
--- File: sql.sql
--------------------------------------------------------------------------------
-CREATE TABLE `phpnews_posters` (
- `id` int(10) unsigned NOT NULL auto_increment,
- `username` varchar(20) NOT NULL default '',
- `password` varchar(32) NOT NULL default '',
- `cookie` varchar(32) character set utf8 collate utf8_bin NOT NULL default '',
- `session` varchar(32) character set utf8 collate utf8_bin NOT NULL default '',
- `ip` varchar(15) character set utf8 collate utf8_bin NOT NULL default '',
- `email` varchar(40) default NULL,
- `avatar` tinytext,
- `language` varchar(6) default NULL,
- `access` varchar(20) NOT NULL default '',
- PRIMARY KEY (`id`),
- UNIQUE KEY `username` (`username`)
-) ENGINE=InnoDB;
+-- Jasmine 0.9 SQL
--- Username and password is admin/admin
-INSERT INTO `phpnews_posters` VALUES (1, 'admin', '21232f297a57a5a743894a0e4a801fc3', '', 0x6631623965363732323062323563313439393537366465353831396632633232, 0x3132372e302e302e31, NULL, NULL, NULL, '');
+SET SQL_MODE="NO_AUTO_VALUE_ON_ZERO";
+--
+-- Database: `jasmine`
+--
--- Session storage
-CREATE TABLE `phpnews_sessions` (
- `sid` int(11) NOT NULL auto_increment,
- `ssessionid` varchar(128) NOT NULL default '',
- `sip` varchar(15) NOT NULL default '',
- `stime` int(11) NOT NULL default '0',
- `suid` int(11) NOT NULL default '0',
- `sexpire` int(11) NOT NULL default '0',
- `slastclick` int(11) NOT NULL default '0',
- PRIMARY KEY (`sid`),
- KEY `ssessionid` (`ssessionid`,`sip`,`suid`),
- KEY `sexpire` (`sexpire`)
-) ENGINE=MyISAM;
+-- --------------------------------------------------------
--- Settings storage
-CREATE TABLE `phpnews_settings` (
- `variable` varchar(20) NOT NULL default '',
- `value` text NOT NULL
-) ENGINE=InnoDB;
+--
+-- Table structure for table `jasmine_groups`
+--
-CREATE TABLE `phpnews_news` (
-`nid` INT( 11 ) NOT NULL AUTO_INCREMENT ,
-`subject` TINYTEXT NOT NULL ,
-`shorttext` MEDIUMTEXT NOT NULL ,
-`maintext` LONGTEXT,
-PRIMARY KEY ( `nid` )
-) TYPE = MYISAM ;
+CREATE TABLE IF NOT EXISTS `jasmine_groups` (
+ `id` tinyint(3) unsigned NOT NULL auto_increment,
+ `name` varchar(50) collate utf8_bin NOT NULL,
+ PRIMARY KEY (`id`)
+) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_bin COMMENT='Stores all definied groups' AUTO_INCREMENT=1 ;
+
+--
+-- Dumping data for table `jasmine_groups`
+--
+
+
+-- --------------------------------------------------------
+
+--
+-- Table structure for table `jasmine_modules`
+--
+
+CREATE TABLE IF NOT EXISTS `jasmine_modules` (
+ `id` tinyint(3) unsigned NOT NULL auto_increment,
+ `name` varchar(50) collate utf8_bin NOT NULL,
+ PRIMARY KEY (`id`)
+) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_bin COMMENT='Stores all installed modules' AUTO_INCREMENT=1 ;
+
+--
+-- Dumping data for table `jasmine_modules`
+--
+
+
+-- --------------------------------------------------------
+
+--
+-- Table structure for table `jasmine_modules_features`
+--
+
+CREATE TABLE IF NOT EXISTS `jasmine_modules_features` (
+ `mid` tinyint(4) NOT NULL,
+ `id` tinyint(4) NOT NULL,
+ `name` varchar(50) collate utf8_bin NOT NULL,
+ PRIMARY KEY (`mid`,`id`)
+) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_bin COMMENT='Stores module features, which can be restricted via permissi';
+
+--
+-- Dumping data for table `jasmine_modules_features`
+--
+
+
+-- --------------------------------------------------------
+
+--
+-- Table structure for table `jasmine_permissions_groups`
+--
+
+CREATE TABLE IF NOT EXISTS `jasmine_permissions_groups` (
+ `gid` tinyint(3) unsigned NOT NULL,
+ `mid` tinyint(3) unsigned NOT NULL,
+ `fid` tinyint(3) unsigned NOT NULL,
+ `allowed` tinyint(1) NOT NULL,
+ KEY `gid` (`gid`,`mid`,`fid`)
+) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_bin COMMENT='Stores permissions on a group/feature base';
+
+--
+-- Dumping data for table `jasmine_permissions_groups`
+--
+
+
+-- --------------------------------------------------------
+
+--
+-- Table structure for table `jasmine_permissions_users`
+--
+
+CREATE TABLE IF NOT EXISTS `jasmine_permissions_users` (
+ `uid` tinyint(4) NOT NULL,
+ `mid` tinyint(4) NOT NULL,
+ `fid` tinyint(4) NOT NULL,
+ `allowed` tinyint(1) NOT NULL COMMENT 'Boolean values: 0 = false, 1 = true',
+ PRIMARY KEY (`uid`,`mid`,`fid`)
+) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_bin COMMENT='Stores permissions on a user/feature base';
+
+--
+-- Dumping data for table `jasmine_permissions_users`
+--
+
+
+-- --------------------------------------------------------
+
+--
+-- Table structure for table `jasmine_sessions`
+--
+
+CREATE TABLE IF NOT EXISTS `jasmine_sessions` (
+ `Session_ID` int(4) unsigned NOT NULL,
+ `Session_Start` int(4) unsigned NOT NULL default '0',
+ `Session_End` varchar(255) collate latin1_general_ci NOT NULL,
+ `Session_Key` varchar(32) collate latin1_general_ci NOT NULL,
+ `User` int(6) unsigned NOT NULL default '0',
+ PRIMARY KEY (`Session_ID`)
+) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_general_ci PACK_KEYS=1;
+
+--
+-- Dumping data for table `jasmine_sessions`
+--
+
+
+-- --------------------------------------------------------
+
+--
+-- Table structure for table `jasmine_settings`
+--
+
+CREATE TABLE IF NOT EXISTS `jasmine_settings` (
+ `variable` varchar(20) collate utf8_bin NOT NULL default '',
+ `value` text collate utf8_bin NOT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_bin COMMENT='Stores various variables to configure Jasmine';
+
+--
+-- Dumping data for table `jasmine_settings`
+--
+
+
+-- --------------------------------------------------------
+
+--
+-- Table structure for table `jasmine_users`
+--
+
+CREATE TABLE IF NOT EXISTS `jasmine_users` (
+ `ID` int(13) unsigned NOT NULL default '0',
+ `Username` varchar(16) collate latin1_general_ci NOT NULL default '',
+ `Password` varchar(32) collate latin1_general_ci NOT NULL,
+ `Email` varchar(255) collate latin1_general_ci NOT NULL default '',
+ `Reg_Date` varchar(40) collate latin1_general_ci NOT NULL default '',
+ `LastOn` varchar(24) collate latin1_general_ci NOT NULL default '',
+ `LoginNumber` varchar(6) collate latin1_general_ci NOT NULL default '',
+ `Group` int(5) NOT NULL default '0',
+ `Language` varchar(10) collate latin1_general_ci NOT NULL default '',
+ `Total_time` varchar(32) collate latin1_general_ci NOT NULL default '',
+ PRIMARY KEY (`ID`)
+) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_general_ci PACK_KEYS=1;
+
+--
+-- Dumping data for table `jasmine_users`
+--
+
+
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|