Skip to content

Commit

Permalink
refs #514
Browse files Browse the repository at this point in the history
  * unix 개행문자 수정
  • Loading branch information
inureyes committed Oct 27, 2008
1 parent ebb70e3 commit f012bc9
Show file tree
Hide file tree
Showing 28 changed files with 9,571 additions and 9,571 deletions.
120 changes: 60 additions & 60 deletions dispatcher.php
Original file line number Diff line number Diff line change
@@ -1,60 +1,60 @@
<?php
/// Copyright (c) 2004-2008, Needlworks / Tatter Network Foundation
/// All rights reserved. Licensed under the GPL.
/// See the GNU General Public License for more details. (/doc/LICENSE, /doc/COPYRIGHT)

/**
This file...
is executed AT FIRST.
specifies the main workflow of Textcube 2.0.
*/
define('TEXTCUBE_VERSION', '2.0');
define('ROOT', '.');

/// Load config.php.
if (file_exists(ROOT.'/config.php')) {
require_once(ROOT.'/config.php');
} else {
require(ROOT.'/setup.php');
exit;
}

/// Initialize class loader.
include(ROOT.'/framework/base.php');
include(ROOT.'/framework/settings.php');
include(ROOT.'/framework/loader.php');
$config = Config::getInstance();

// Parse and normalize URI. */
/* TODO: Unify the environment and do work-arounds. (For IIS, Apache - mod_php or fastcgi, lighttpd, and etc.) */
// Structure of fancy URL:
// host + blog prefix + interface path + pagination info + extra arguments not in $_REQUEST
// TODO: Apply this structure to $context->accessInfo...
try {
$context = Context::getInstance(); // automatic initialization via first instanciation
} catch (URIError $e) {
// Check existence of interface path.
if ($config->service['debugmode'])
echo $e;
exit;
}

/* Special pre-handlers. (favicon.ico, index.gif) */
if ($context->accessInfo['prehandler']) {
// Skip further processes such as session management.
require(ROOT.'/'.$context->accessInfo['interfacePath']);
exit;
}

/* TODO: Session management. */

// TODO: Do input validation as soon as possible?
/* Load final interface handler. */
// Each interface...
// validates passed arguments through IV.
// specify required ACL/permissions and check them.
// loads its necessary libraries, models and components.
// before actual execution.
require(ROOT.'/'.$context->accessInfo['interfacePath']);

?>
<?php
/// Copyright (c) 2004-2008, Needlworks / Tatter Network Foundation
/// All rights reserved. Licensed under the GPL.
/// See the GNU General Public License for more details. (/doc/LICENSE, /doc/COPYRIGHT)

/**
This file...
is executed AT FIRST.
specifies the main workflow of Textcube 2.0.
*/
define('TEXTCUBE_VERSION', '2.0');
define('ROOT', '.');

/// Load config.php.
if (file_exists(ROOT.'/config.php')) {
require_once(ROOT.'/config.php');
} else {
require(ROOT.'/setup.php');
exit;
}

/// Initialize class loader.
include(ROOT.'/framework/base.php');
include(ROOT.'/framework/settings.php');
include(ROOT.'/framework/loader.php');
$config = Config::getInstance();

// Parse and normalize URI. */
/* TODO: Unify the environment and do work-arounds. (For IIS, Apache - mod_php or fastcgi, lighttpd, and etc.) */
// Structure of fancy URL:
// host + blog prefix + interface path + pagination info + extra arguments not in $_REQUEST
// TODO: Apply this structure to $context->accessInfo...
try {
$context = Context::getInstance(); // automatic initialization via first instanciation
} catch (URIError $e) {
// Check existence of interface path.
if ($config->service['debugmode'])
echo $e;
exit;
}

/* Special pre-handlers. (favicon.ico, index.gif) */
if ($context->accessInfo['prehandler']) {
// Skip further processes such as session management.
require(ROOT.'/'.$context->accessInfo['interfacePath']);
exit;
}

/* TODO: Session management. */

// TODO: Do input validation as soon as possible?
/* Load final interface handler. */
// Each interface...
// validates passed arguments through IV.
// specify required ACL/permissions and check them.
// loads its necessary libraries, models and components.
// before actual execution.
require(ROOT.'/'.$context->accessInfo['interfacePath']);

?>
62 changes: 31 additions & 31 deletions framework/base.php
Original file line number Diff line number Diff line change
@@ -1,31 +1,31 @@
<?php
/// Copyright (c) 2004-2008, Needlworks / Tatter Network Foundation
/// All rights reserved. Licensed under the GPL.
/// See the GNU General Public License for more details. (/doc/LICENSE, /doc/COPYRIGHT)

/// Singleton implementation.
abstract class Singleton {
private static $instances = array();

protected function __construct() {
}

final protected static function _getInstance($className) {
if (!array_key_exists($className, self::$instances)) {
self::$instances[$className] = new $className();
}
return self::$instances[$className];
}

/*
// You should implement this method to the final class. (An example is below.)
// This is mainly because "late static bindings" is supported after PHP 5.3.
public static function getInstance() {
return self::_getInstance(__CLASS__);
}
*/
abstract public static function getInstance();
}

?>
<?php
/// Copyright (c) 2004-2008, Needlworks / Tatter Network Foundation
/// All rights reserved. Licensed under the GPL.
/// See the GNU General Public License for more details. (/doc/LICENSE, /doc/COPYRIGHT)

/// Singleton implementation.
abstract class Singleton {
private static $instances = array();

protected function __construct() {
}

final protected static function _getInstance($className) {
if (!array_key_exists($className, self::$instances)) {
self::$instances[$className] = new $className();
}
return self::$instances[$className];
}

/*
// You should implement this method to the final class. (An example is below.)
// This is mainly because "late static bindings" is supported after PHP 5.3.
public static function getInstance() {
return self::_getInstance(__CLASS__);
}
*/
abstract public static function getInstance();
}

?>
28 changes: 14 additions & 14 deletions framework/cache/ICache.php
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
<?php
/// Copyright (c) 2004-2008, Needlworks / Tatter Network Foundation
/// All rights reserved. Licensed under the GPL.
/// See the GNU General Public License for more details. (/doc/LICENSE, /doc/COPYRIGHT)

interface ICache
{
public function __construct($type);
public function setEntry($key, $expirationDue);
public function getEntry($key, $clear = false);

public static function generateKey();
}
?>
<?php
/// Copyright (c) 2004-2008, Needlworks / Tatter Network Foundation
/// All rights reserved. Licensed under the GPL.
/// See the GNU General Public License for more details. (/doc/LICENSE, /doc/COPYRIGHT)

interface ICache
{
public function __construct($type);
public function setEntry($key, $expirationDue);
public function getEntry($key, $clear = false);

public static function generateKey();
}
?>
12 changes: 6 additions & 6 deletions framework/data/Condition.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php
/// Copyright (c) 2004-2008, Needlworks / Tatter Network Foundation
/// All rights reserved. Licensed under the GPL.
/// See the GNU General Public License for more details. (/doc/LICENSE, /doc/COPYRIGHT)

?>
<?php
/// Copyright (c) 2004-2008, Needlworks / Tatter Network Foundation
/// All rights reserved. Licensed under the GPL.
/// See the GNU General Public License for more details. (/doc/LICENSE, /doc/COPYRIGHT)

?>
42 changes: 21 additions & 21 deletions framework/data/IAdapter.php
Original file line number Diff line number Diff line change
@@ -1,21 +1,21 @@
<?php
/// Copyright (c) 2004-2008, Needlworks / Tatter Network Foundation
/// All rights reserved. Licensed under the GPL.
/// See the GNU General Public License for more details. (/doc/LICENSE, /doc/COPYRIGHT)

interface IAdapter
{
public function connect($server, $dbname, $userid, $password, array $options);
public function disconnect();
public function beginTransaction();
public function endTransaction($apply = true);
public function query($query);
public static function escapeString($var);
public static function escapeFieldName($var);
}

class DBException extends Exception {}
class DBConnectionError extends DBException {}
class DBQueryError extends DBException {}

?>
<?php
/// Copyright (c) 2004-2008, Needlworks / Tatter Network Foundation
/// All rights reserved. Licensed under the GPL.
/// See the GNU General Public License for more details. (/doc/LICENSE, /doc/COPYRIGHT)

interface IAdapter
{
public function connect($server, $dbname, $userid, $password, array $options);
public function disconnect();
public function beginTransaction();
public function endTransaction($apply = true);
public function query($query);
public static function escapeString($var);
public static function escapeFieldName($var);
}

class DBException extends Exception {}
class DBConnectionError extends DBException {}
class DBQueryError extends DBException {}

?>
50 changes: 25 additions & 25 deletions framework/data/IModel.php
Original file line number Diff line number Diff line change
@@ -1,25 +1,25 @@
<?php
/// Copyright (c) 2004-2008, Needlworks / Tatter Network Foundation
/// All rights reserved. Licensed under the GPL.
/// See the GNU General Public License for more details. (/doc/LICENSE, /doc/COPYRIGHT)

interface IModel
{
static function _createTable();
static function _dropTable();
static function _dumpTable();

public function setField($fieldName, $value);
public function __set($fieldName, $value);
public function getField($fieldName);
public function __get($fieldName);

public static function findAll(array $condition);
public static function deleteAll(array $condition);
public static function get($id);
public static function create(array $fields);

public function save(array $options);
public function delete();
}
?>
<?php
/// Copyright (c) 2004-2008, Needlworks / Tatter Network Foundation
/// All rights reserved. Licensed under the GPL.
/// See the GNU General Public License for more details. (/doc/LICENSE, /doc/COPYRIGHT)

interface IModel
{
static function _createTable();
static function _dropTable();
static function _dumpTable();

public function setField($fieldName, $value);
public function __set($fieldName, $value);
public function getField($fieldName);
public function __get($fieldName);

public static function findAll(array $condition);
public static function deleteAll(array $condition);
public static function get($id);
public static function create(array $fields);

public function save(array $options);
public function delete();
}
?>
Loading

0 comments on commit f012bc9

Please sign in to comment.