Skip to content

Commit

Permalink
Alot of SQL/Security/Infrastructure patches.
Browse files Browse the repository at this point in the history
  • Loading branch information
Artazor committed May 31, 2012
1 parent 1a6f1e3 commit 65b9c9a
Show file tree
Hide file tree
Showing 33 changed files with 59 additions and 131 deletions.
18 changes: 18 additions & 0 deletions common/admin_tools/admin_tools.class.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
<?

class Oxygen_Common_AdminTools extends Oxygen_Controller {

public function configure($x){
$x['dbs'] = $this->scope->connection;
$x['auth'] = $this->scope->__authenticated();
}

public function __toString() {
return 'Admin tools';
}

public function getIcon() {
return 'wrench';
}
}
?>
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?

class Oxygen_Common_Authenticator extends Oxygen_Object {
class Oxygen_Common_Auth extends Oxygen_Controller {

private $session = null;
const LOGON_SESSION_PREFIX = 'Logon::';
Expand All @@ -12,9 +12,12 @@ class Oxygen_Common_Authenticator extends Oxygen_Object {
'user' => false
);

public function getAuthDb() {
}

public function __get($name){
return $this->session->get(
self::LOGON_SESSION_PREFIX . $name,
self::LOGON_SESSION_PREFIX . $name,
self::$defaults[$name]
);
}
Expand All @@ -25,7 +28,7 @@ public function __complete() {

public function __set($name, $value) {
$this->session->put(
self::LOGON_SESSION_PREFIX . $name,
self::LOGON_SESSION_PREFIX . $name,
$value
);
}
Expand Down Expand Up @@ -71,4 +74,4 @@ public function process($data) {
}
}

?>
?>
7 changes: 0 additions & 7 deletions common/controller/controller.class.php

This file was deleted.

7 changes: 6 additions & 1 deletion controller/controller.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -317,7 +317,7 @@ public function offsetUnset($offset){
}

public function __toString() {
return $this->route;
return urldecode($this->route);
}

public function offsetSet($offset, $value) {
Expand Down Expand Up @@ -346,6 +346,10 @@ public function setPath($parent, $route = '', $rest = ''){
else $this->path = $path;
$this->parseArgs();
$this->__routed();
// in case if we are rebased - update all existing children;
foreach ($this->children as $route => $child) {
$child->setPath($this, $routes);
}
return $match[2];
}

Expand Down Expand Up @@ -461,6 +465,7 @@ public function addExplicit($route,$model) {
$model instanceof Oxygen_Controller,
'Explicit child should be instance of Oxygen_Controller'
);
$model->setPath($this,$route);
return $this->routes[$route] = $this->scope->Router($route, $model);
}

Expand Down
File renamed without changes
1 change: 1 addition & 0 deletions entity/collection/as_table_row.php
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
<tr><td><?$this->put_icon()?></td><td><?$this->put_as_child()?></td></tr>
Original file line number Diff line number Diff line change
@@ -1,11 +1,20 @@
<?

class Oxygen_Common_Collection extends Oxygen_Common_Controller {
class Oxygen_Entity_Collection extends Oxygen_Entity_Controller {
public function plural($n) {
if($n === 1) return 'item';
else return 'items';
}

public function configure($x) {
$ks = array();
foreach($this->model->meta['keys'][0] as $k=>$v){
$ks[] = '{'.$k.':url}';
};
$key = implode('/',$ks);
$x[$key]->Oxygen_Entity_Controller($this->model);
}

public function rpc_getMore($offset) {
$this->model = $this->model->slice($offset, 25);
return array(
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
7 changes: 7 additions & 0 deletions entity/controller/controller.class.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
<?

class Oxygen_Entity_Controller extends Oxygen_Controller {

}

?>
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion sql/row/row.class.php → entity/entity.class.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?

class Oxygen_SQL_Row extends Oxygen_Object implements ArrayAccess {
class Oxygen_Entity extends Oxygen_Object implements ArrayAccess {

const MISSING_DATA = 'Part of data is missing with key "{0}"';
const WRONG_ARGUMENT_COUNT = 'Wrong argument count';
Expand Down
2 changes: 1 addition & 1 deletion itself.php
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ function redirectResponse($data) {
function registerOxygenCommons($scope) {
$array = array(
'LogonPage' => 'Oxygen_Common_LogonPage',
'Authenticator' => 'Oxygen_Common_Authenticator',
'Authenticator' => 'Oxygen_Common_Auth',
'Application' => 'Oxygen_Common_Application',
'Page' => 'Oxygen_Common_Page'
);
Expand Down
90 changes: 0 additions & 90 deletions model/model.class.php

This file was deleted.

12 changes: 0 additions & 12 deletions sql/collection/collection.class.php

This file was deleted.

5 changes: 2 additions & 3 deletions sql/connection/connection.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,12 +28,11 @@ class Oxygen_SQL_Connection extends Oxygen_ScopeController {
'Column' => 'Oxygen_SQL_Column',
'Key' => 'Oxygen_SQL_Key',
'Keys' => 'Oxygen_SQL_Keys',
'Data' => 'Oxygen_SQL_Data',
'Row' => 'Oxygen_SQL_Row',
'DataSet' => 'Oxygen_SQL_DataSet',
'Builder' => 'Oxygen_SQL_Builder',
'ResultSet' => 'Oxygen_SQL_ResultSet',
'DataIterator' => 'Oxygen_SQL_ResultSet_Iterator'
'DataIterator' => 'Oxygen_SQL_ResultSet_Iterator',
'Row' => 'Oxygen_Entity'
);

public function __construct($config, $refreshSchemata = false) {
Expand Down
6 changes: 0 additions & 6 deletions sql/data/data.class.php

This file was deleted.

4 changes: 2 additions & 2 deletions sql/scripts/scripts.class.php
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
<?

class Oxygen_Sql_Scripts extends Oxygen_Common_Controller {
class Oxygen_Sql_Scripts extends Oxygen_Entity_Controller {


}

?>
?>
7 changes: 4 additions & 3 deletions sql/table/table.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -53,10 +53,10 @@ public function getData($alias) {

public function getKeys($alias) {
$result = array();
foreach($this['keys'] as $key => $columns) {
foreach($this->model['keys'] as $name => $key) {
$k = array();
foreach($columns as $name => $col) {
$k[$name] = $alias . '.' . $col->model['column'];
foreach($key['columns'] as $col) {
$k[$col['column']] = $alias . '.' . $col['column'];
}
$result[] = $k;
}
Expand Down Expand Up @@ -146,6 +146,7 @@ public function getPolicyPredicates($alias) {
public function configure($x) {
$x['columns']->Columns($this->model['columns']);
$x['keys']->Keys($this->model['keys']);
$x['rows']->Oxygen_Entity_Collection($this->getData($this->model['name']));
}

public function __complete() {
Expand Down

0 comments on commit 65b9c9a

Please sign in to comment.