[jasmine-commit] SF.net SVN: newsphp: [135] trunk/jasmine
Brought to you by:
christoph_berg,
red-
|
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.
|