Skip to content

Commit

Permalink
refs #514
Browse files Browse the repository at this point in the history
  * trunk 와 branches/1.8  동기화
  • Loading branch information
inureyes committed Oct 9, 2009
1 parent b60479c commit a505c76
Show file tree
Hide file tree
Showing 664 changed files with 75,907 additions and 1,705 deletions.
1 change: 0 additions & 1 deletion blog/README

This file was deleted.

953 changes: 0 additions & 953 deletions blog/checkup/index.php

This file was deleted.

14 changes: 0 additions & 14 deletions blog/index.php

This file was deleted.

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

final class Dispatcher {
private static $instances = array();
Expand Down Expand Up @@ -103,7 +103,7 @@ private function URIinterpreter() {
case 'feeder':
$uri['interfaceType'] = 'feeder';
break;
case 'owner':
case 'owner': case 'control':
$uri['interfaceType'] = 'owner';
break;
case 'favicon.ico':
Expand Down Expand Up @@ -143,7 +143,7 @@ private function URIinterpreter() {
case 'entry': case 'feeder': case 'foaf': case 'guestbook': case 'iMazing':
case 'keylog': case 'line': case 'location': case 'locationSuggest':
case 'logout': case 'notice': case 'page': case 'plugin': case 'pluginForOwner':
case 'search': case 'suggest': case 'sync': case 'tag': case 'ttxml':
case 'search': case 'suggest': case 'tag': case 'ttxml':
$pathPart = $uri['fragment'][0];
$interfacePath = 'interface/blog/'.$pathPart.'.php';
break;
Expand Down
4 changes: 2 additions & 2 deletions framework/alias/DBAdapter.php
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
<?php
/// Copyright (c) 2004-2009, Needlworks / Tatter Network Foundation
/// All rights reserved. Licensed under the GPL.
/// See the GNU General Public License for more details. (/doc/LICENSE, /doc/COPYRIGHT)
/// See the GNU General Public License for more details. (/documents/LICENSE, /documents/COPYRIGHT)

$context = Model_Context::getInstance();
$dbms = 'mysql';
$dbms = 'MySQL';
if(!is_null($context->getProperty('database.dbms'))) $dbms = $context->getProperty('database.dbms');
require_once(ROOT."/framework/data/IAdapter.php");
require_once(ROOT."/framework/data/".$dbms."/Adapter.php");
Expand Down
2 changes: 1 addition & 1 deletion framework/alias/DBModel.php
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?php
/// Copyright (c) 2004-2009, Needlworks / Tatter Network Foundation
/// All rights reserved. Licensed under the GPL.
/// See the GNU General Public License for more details. (/doc/LICENSE, /doc/COPYRIGHT)
/// See the GNU General Public License for more details. (/documents/LICENSE, /documents/COPYRIGHT)

if(!class_exists('DBAdapter')) require_once (ROOT.'/framework/alias/DBAdapter,php');
require_once(ROOT."/framework/model/IModel.php");
Expand Down
2 changes: 1 addition & 1 deletion framework/boot/00-UnifiedEnvironment.php
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?php
/// Copyright (c) 2004-2009, Needlworks / Tatter Network Foundation
/// All rights reserved. Licensed under the GPL.
/// See the GNU General Public License for more details. (/doc/LICENSE, /doc/COPYRIGHT)
/// See the GNU General Public License for more details. (/documents/LICENSE, /documents/COPYRIGHT)

/// @brief Environment unifier.
ini_set('session.use_trans_sid', '0');
Expand Down
2 changes: 1 addition & 1 deletion framework/boot/10-CoreClasses.php
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?php
/// Copyright (c) 2004-2009, Needlworks / Tatter Network Foundation
/// All rights reserved. Licensed under the GPL.
/// See the GNU General Public License for more details. (/doc/LICENSE, /doc/COPYRIGHT)
/// See the GNU General Public License for more details. (/documents/LICENSE, /documents/COPYRIGHT)

/// Singleton implementation.
abstract class Singleton {
Expand Down
2 changes: 1 addition & 1 deletion framework/boot/20-Autoload.php
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?php
/// Copyright (c) 2004-2009, Needlworks / Tatter Network Foundation
/// All rights reserved. Licensed under the GPL.
/// See the GNU General Public License for more details. (/doc/LICENSE, /doc/COPYRIGHT)
/// See the GNU General Public License for more details. (/documents/LICENSE, /documents/COPYRIGHT)

/// Legacy support
require_once(ROOT.'/framework/legacy/Needlworks.PHP.Loader.php');
Expand Down
7 changes: 4 additions & 3 deletions framework/boot/30-Auth.php
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?php
/// Copyright (c) 2004-2009, Needlworks / Tatter Network Foundation
/// All rights reserved. Licensed under the GPL.
/// See the GNU General Public License for more details. (/doc/LICENSE, /doc/COPYRIGHT)
/// See the GNU General Public License for more details. (/documents/LICENSE, /documents/COPYRIGHT)

// Of course, BITWISE must be BITWISE! (2^)
define( 'BITWISE_EDITOR', 0x1 ); // 00001
Expand Down Expand Up @@ -252,7 +252,7 @@ function authorize( $domain, $userid ) {

$blogid = getBlogId();
$data = DBModel::getInstance();
$data->reset($context->getProperty('database.prefix'));
$data->reset('Privileges');
$data->setQualifier('blogid','equals',$blogid);
$data->setQualifier('userid','equals',$userid);
$data->setAttribute('lastLogin',Timestamp::getUNIXtime());
Expand Down Expand Up @@ -373,7 +373,8 @@ function authenticate( $blogid, $loginid, $password, $blogapi = false ) {
if ((strlen($password) == 32) && preg_match('/[0-9a-f]{32}/i', $password)) { // Raw login. ( with/without auth token)
$userid = getUserIdByEmail($loginid);
if(!empty($userid) && !is_null($userid)) {
$query = new DBModel($database['prefix']. 'UserSettings');
$query = DBModel::getInstance();
$query->reset('UserSettings');
$query->setQualifier('userid','equals',$userid);
$query->setQualifier('name','equals','AuthToken',true);
$authtoken = $query->getCell('value');
Expand Down
18 changes: 12 additions & 6 deletions framework/cache/ICache.php
Original file line number Diff line number Diff line change
@@ -1,14 +1,20 @@
<?php
/// Copyright (c) 2004-2009, Needlworks / Tatter Network Foundation
/// All rights reserved. Licensed under the GPL.
/// See the GNU General Public License for more details. (/doc/LICENSE, /doc/COPYRIGHT)
/// See the GNU General Public License for more details. (/documents/LICENSE, /documents/COPYRIGHT)

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

public static function generateKey();
public function __construct();
public function __destruct();
public function reset();
/// Default methods
public function set($key, $value, $expirationDue);
public function get($key, $clear = false);
public function purge($key);
public function flush();
/// Namespaces
public function useNamespace($ns = null);
public function getNamespace();
}
?>
115 changes: 115 additions & 0 deletions framework/cache/Memcache.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,115 @@
<?php
/// Copyright (c) 2004-2009, Needlworks / Tatter Network Foundation
/// All rights reserved. Licensed under the GPL.
/// See the GNU General Public License for more details. (/documents/LICENSE, /documents/COPYRIGHT)

/**
* @requires Model_Context
*/

class Cache_Memcache extends Singleton {
private static $memcache, $__namespace, $__value, $__qualifiers;

public static function getInstance() {
return self::_getInstance(__CLASS__);
}
public function __construct() {
$context = Model_Context::getInstance();
$this->__qualifiers = array();
if($context->getProperty('service.memcached') == true):
$this->memcache = new Memcache;
$this->memcache->connect((!is_null($context->getProperty('memcached.server')) ? $context->getProperty('memcached.server') : 'localhost'));
endif;
}
public function __destruct() {
}
/// Default methods
public function set($key, $value, $expirationDue = 0) {
if(strpos($key,'.') === false) { // If key contains namespace, use it.
if (!empty($this->__namespace)) {
$key = $this->getNamespaceHash().'.'.$key;
} else {
$key = $this->getNamespaceHash('global').$key;
}
}
$this->memcache->set($key,$value,$expirationDue);
}
public function get($key, $clear = false) {
if(strpos($key,'.') === false) { // If key doesn't contain namespace,
if (!empty($this->__namespace)) $key = $this->getNamespaceHash().'.'.$key;
else $key = $this->getNamespaceHash('global').$key;
}
return $this->memcache->get($key);
}
public function purge($key) {
if(strpos($key,'.') === false) { // If key doesn't contain namespace,
if (!empty($this->__namespace)) $key = $this->__namespace.'.'.$key;
else $key = $this->getNamespaceHash('global').'.'.$key;
}
return $this->memcache->delete($key);
}
public function flush() {
if(is_null($this->__namespace)) return $this->memcache->flush();
else $this->renewNamespaceHash($this->__namespace);
}
/// Namespaces
public function useNamespace($ns = null) {
if(is_null($ns)) $this->__namespace = null;
else $this->__namespace = $ns;
}
public function getNamespace() {
return $this->__namespace;
}

/// Compatibility layer via Data_IModel
public function reset($ns,$param = '') {
$this->__qualifiers = array();
$this->useNamespace($ns.$param);
}
public function setQualifier($key, $condition, $value, $param = null) {
array_push($this->__qualifiers,$key.$condition.$value);
}
public function setAttribute($key, $value = null, $param = null) {
$this->__value = $value; // Last attribute set will be used as key-value pair index.
return true;
}
public function getAll() {
return $this->getCell();
}
public function getCell() {
return $this->get($this->getKeyFromQualifiers());
}
public function insert(){
return $this->set($this->getKeyFromQualifiers(),$this->__value);
}
public function delete(){
return $this->purge($this->getKeyFromQualifiers());
}
public function replace(){
return $this->insert();
}

/// Private methods
private function getNamespaceHash($ns = null, $renew = false) {
$context = Model_Context::getInstance();
if(is_null($ns)) $ns = $this->__namespace;
$prefix = $context->getProperty('service.domain').'-'.$context->getProperty('blog.id').'-'.$ns.'-';
if($renew !== false) $namehash = false;
else $namehash = $this->memcache->get($prefix);
if($namehash == false) {
$seed = dechex(rand(0x10000000, 0x7FFFFFFF)).dechex(rand(0x10000000, 0x7FFFFFFF));
$this->memcache->set($prefix,$seed);
return $seed;
} else {
return $namehash;
}
}
private function renewNamespaceHash($ns = null) {
return $this->getNamespaceHash($ns, true);
}
private function getKeyFromQualifiers() {
asort($this->__qualifiers);
return abs(crc32(implode('-',$this->__qualifiers)));
}
}
?>
2 changes: 1 addition & 1 deletion framework/data/Condition.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php
/// Copyright (c) 2004-2009, Needlworks / Tatter Network Foundation
/// All rights reserved. Licensed under the GPL.
/// See the GNU General Public License for more details. (/doc/LICENSE, /doc/COPYRIGHT)
/// See the GNU General Public License for more details. (/documents/LICENSE, /documents/COPYRIGHT)

?>
2 changes: 1 addition & 1 deletion framework/data/Cubrid/Adapter.php
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?php
/// Copyright (c) 2004-2009, Needlworks / Tatter Network Foundation
/// All rights reserved. Licensed under the GPL.
/// See the GNU General Public License for more details. (/doc/LICENSE, /doc/COPYRIGHT)
/// See the GNU General Public License for more details. (/documents/LICENSE, /documents/COPYRIGHT)

// DBQuery version 1.8 for Cubrid

Expand Down
2 changes: 1 addition & 1 deletion framework/data/Cubrid/Debug.php
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?php
/// Copyright (c) 2004-2009, Needlworks / Tatter Network Foundation
/// All rights reserved. Licensed under the GPL.
/// See the GNU General Public License for more details. (/doc/LICENSE, /doc/COPYRIGHT)
/// See the GNU General Public License for more details. (/documents/LICENSE, /documents/COPYRIGHT)

define( 'TCDEBUG', true );

Expand Down
10 changes: 6 additions & 4 deletions framework/data/DBModel.php
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?php
/// Copyright (c) 2004-2009, Needlworks / Tatter Network Foundation
/// All rights reserved. Licensed under the GPL.
/// See the GNU General Public License for more details. (/doc/LICENSE, /doc/COPYRIGHT)
/// See the GNU General Public License for more details. (/documents/LICENSE, /documents/COPYRIGHT)

// DB-related function. will be merged into DBMS unification function.
function escapeSearchString($str) {
Expand Down Expand Up @@ -37,22 +37,24 @@ class DBModel extends Singleton implements IModel {
protected $_relations, $_filters, $_order, $_limitation, $table, $id, $_reservedFields, $_isReserved;

function __construct($table = null) {
$this->context = Model_Context::getInstance();
$this->reset($table);
}

public static function getInstance() {
return self::_getInstance(__CLASS__);
}

public function reset($table = null) {
$this->table = $table;
public function reset($table = null, $param = null) {
if(!is_null($table)) $this->table = $this->context->getProperty('database.prefix').$table;
else $this->table = null;
$this->id = null;
$this->_attributes = array();
$this->_qualifiers = array();
$this->_relations = array();
$this->_filters = array();
$this->_order = array();
$this->_limitation = array();
$this->_limit = array();
$this->_isReserved = array();

$this->_reservedFields = POD::reservedFieldNames();
Expand Down
2 changes: 1 addition & 1 deletion framework/data/IAdapter.php
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?php
/// Copyright (c) 2004-2009, Needlworks / Tatter Network Foundation
/// All rights reserved. Licensed under the GPL.
/// See the GNU General Public License for more details. (/doc/LICENSE, /doc/COPYRIGHT)
/// See the GNU General Public License for more details. (/documents/LICENSE, /documents/COPYRIGHT)

interface IAdapter {
/// DBMS Connection
Expand Down
2 changes: 1 addition & 1 deletion framework/data/MySQL/Adapter.php
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?php
/// Copyright (c) 2004-2009, Needlworks / Tatter Network Foundation
/// All rights reserved. Licensed under the GPL.
/// See the GNU General Public License for more details. (/doc/LICENSE, /doc/COPYRIGHT)
/// See the GNU General Public License for more details. (/documents/LICENSE, /documents/COPYRIGHT)

// DBQuery version 1.8 for MySQL

Expand Down
2 changes: 1 addition & 1 deletion framework/data/MySQL/Debug.php
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?php
/// Copyright (c) 2004-2009, Needlworks / Tatter Network Foundation
/// All rights reserved. Licensed under the GPL.
/// See the GNU General Public License for more details. (/doc/LICENSE, /doc/COPYRIGHT)
/// See the GNU General Public License for more details. (/documents/LICENSE, /documents/COPYRIGHT)

define( 'TCDEBUG', true );

Expand Down
2 changes: 1 addition & 1 deletion framework/data/MySQLi/Adapter.php
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?php
/// Copyright (c) 2004-2009, Needlworks / Tatter Network Foundation
/// All rights reserved. Licensed under the GPL.
/// See the GNU General Public License for more details. (/doc/LICENSE, /doc/COPYRIGHT)
/// See the GNU General Public License for more details. (/documents/LICENSE, /documents/COPYRIGHT)

// DBQuery version 1.8 for MySQL improved.

Expand Down
2 changes: 1 addition & 1 deletion framework/data/MySQLi/Debug.php
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?php
/// Copyright (c) 2004-2009, Needlworks / Tatter Network Foundation
/// All rights reserved. Licensed under the GPL.
/// See the GNU General Public License for more details. (/doc/LICENSE, /doc/COPYRIGHT)
/// See the GNU General Public License for more details. (/documents/LICENSE, /documents/COPYRIGHT)

define( 'TCDEBUG', true );

Expand Down
2 changes: 1 addition & 1 deletion framework/data/PostgreSQL/Adapter.php
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?php
/// Copyright (c) 2004-2009, Needlworks / Tatter Network Foundation
/// All rights reserved. Licensed under the GPL.
/// See the GNU General Public License for more details. (/doc/LICENSE, /doc/COPYRIGHT)
/// See the GNU General Public License for more details. (/documents/LICENSE, /documents/COPYRIGHT)

// DBQuery version 1.7 for Postgresql

Expand Down
2 changes: 1 addition & 1 deletion framework/data/PostgreSQL/Debug.php
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?php
/// Copyright (c) 2004-2009, Needlworks / Tatter Network Foundation
/// All rights reserved. Licensed under the GPL.
/// See the GNU General Public License for more details. (/doc/LICENSE, /doc/COPYRIGHT)
/// See the GNU General Public License for more details. (/documents/LICENSE, /documents/COPYRIGHT)

define( 'TCDEBUG', true );

Expand Down
2 changes: 1 addition & 1 deletion framework/legacy/Eolin.API.Syndication.php
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?php
/// Copyright (c) 2004-2009, Needlworks / Tatter Network Foundation
/// All rights reserved. Licensed under the GPL.
/// See the GNU General Public License for more details. (/doc/LICENSE, /doc/COPYRIGHT)
/// See the GNU General Public License for more details. (/documents/LICENSE, /documents/COPYRIGHT)
class Syndication {
/*@static@*/
function join($link) {
Expand Down
Loading

0 comments on commit a505c76

Please sign in to comment.