Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Alot of SQL/Security/Infrastructure patches.

  • Loading branch information...
commit 65b9c9a517c22826184dd768d0a35af666b89efa 1 parent 1a6f1e3
Artazor Artazor authored

Showing 33 changed files with 59 additions and 131 deletions. Show diff stats Hide diff stats

  1. +18 0 common/admin_tools/admin_tools.class.php
  2. +7 4 common/{authenticator/authenticator.class.php → auth/auth.class.php}
  3. +0 7 common/controller/controller.class.php
  4. +6 1 controller/controller.class.php
  5. 0  {common → entity}/collection/ajax-loader.gif
  6. +1 0  entity/collection/as_table_row.php
  7. +10 1 {common → entity}/collection/collection.class.php
  8. 0  {common → entity}/collection/filter.less
  9. 0  {common → entity}/collection/filter.php
  10. 0  {common → entity}/collection/header_actions.php
  11. 0  {common → entity}/collection/short_info.php
  12. 0  {common → entity}/collection/table.js
  13. 0  {common → entity}/collection/table.less
  14. 0  {common → entity}/collection/table.php
  15. 0  {common → entity}/collection/table_header.php
  16. 0  {common → entity}/collection/table_rows.php
  17. 0  {common → entity}/collection/view.php
  18. 0  {common → entity}/controller/as_table_row.php
  19. +7 0 entity/controller/controller.class.php
  20. 0  {common → entity}/controller/data_content.php
  21. 0  {common → entity}/controller/data_view.php
  22. 0  {common → entity}/controller/header.less
  23. 0  {common → entity}/controller/header.php
  24. 0  {common → entity}/controller/header_actions.php
  25. 0  {common → entity}/controller/short_info.php
  26. +1 1  sql/row/row.class.php → entity/entity.class.php
  27. +1 1  itself.php
  28. +0 90 model/model.class.php
  29. +0 12 sql/collection/collection.class.php
  30. +2 3 sql/connection/connection.class.php
  31. +0 6 sql/data/data.class.php
  32. +2 2 sql/scripts/scripts.class.php
  33. +4 3 sql/table/table.class.php
18 common/admin_tools/admin_tools.class.php
... ... @@ -0,0 +1,18 @@
  1 +<?
  2 +
  3 + class Oxygen_Common_AdminTools extends Oxygen_Controller {
  4 +
  5 + public function configure($x){
  6 + $x['dbs'] = $this->scope->connection;
  7 + $x['auth'] = $this->scope->__authenticated();
  8 + }
  9 +
  10 + public function __toString() {
  11 + return 'Admin tools';
  12 + }
  13 +
  14 + public function getIcon() {
  15 + return 'wrench';
  16 + }
  17 + }
  18 +?>
11 common/authenticator/authenticator.class.php → common/auth/auth.class.php
... ... @@ -1,6 +1,6 @@
1 1 <?
2 2
3   - class Oxygen_Common_Authenticator extends Oxygen_Object {
  3 + class Oxygen_Common_Auth extends Oxygen_Controller {
4 4
5 5 private $session = null;
6 6 const LOGON_SESSION_PREFIX = 'Logon::';
@@ -12,9 +12,12 @@ class Oxygen_Common_Authenticator extends Oxygen_Object {
12 12 'user' => false
13 13 );
14 14
  15 + public function getAuthDb() {
  16 + }
  17 +
15 18 public function __get($name){
16 19 return $this->session->get(
17   - self::LOGON_SESSION_PREFIX . $name,
  20 + self::LOGON_SESSION_PREFIX . $name,
18 21 self::$defaults[$name]
19 22 );
20 23 }
@@ -25,7 +28,7 @@ public function __complete() {
25 28
26 29 public function __set($name, $value) {
27 30 $this->session->put(
28   - self::LOGON_SESSION_PREFIX . $name,
  31 + self::LOGON_SESSION_PREFIX . $name,
29 32 $value
30 33 );
31 34 }
@@ -71,4 +74,4 @@ public function process($data) {
71 74 }
72 75 }
73 76
74   -?>
  77 +?>
7 common/controller/controller.class.php
... ... @@ -1,7 +0,0 @@
1   -<?
2   -
3   - class Oxygen_Common_Controller extends Oxygen_Controller {
4   -
5   - }
6   -
7   -?>
7 controller/controller.class.php
@@ -317,7 +317,7 @@ public function offsetUnset($offset){
317 317 }
318 318
319 319 public function __toString() {
320   - return $this->route;
  320 + return urldecode($this->route);
321 321 }
322 322
323 323 public function offsetSet($offset, $value) {
@@ -346,6 +346,10 @@ public function setPath($parent, $route = '', $rest = ''){
346 346 else $this->path = $path;
347 347 $this->parseArgs();
348 348 $this->__routed();
  349 + // in case if we are rebased - update all existing children;
  350 + foreach ($this->children as $route => $child) {
  351 + $child->setPath($this, $routes);
  352 + }
349 353 return $match[2];
350 354 }
351 355
@@ -461,6 +465,7 @@ public function addExplicit($route,$model) {
461 465 $model instanceof Oxygen_Controller,
462 466 'Explicit child should be instance of Oxygen_Controller'
463 467 );
  468 + $model->setPath($this,$route);
464 469 return $this->routes[$route] = $this->scope->Router($route, $model);
465 470 }
466 471
0  common/collection/ajax-loader.gif → entity/collection/ajax-loader.gif
File renamed without changes
1  entity/collection/as_table_row.php
... ... @@ -0,0 +1 @@
  1 +<tr><td><?$this->put_icon()?></td><td><?$this->put_as_child()?></td></tr>
11 common/collection/collection.class.php → entity/collection/collection.class.php
... ... @@ -1,11 +1,20 @@
1 1 <?
2 2
3   - class Oxygen_Common_Collection extends Oxygen_Common_Controller {
  3 + class Oxygen_Entity_Collection extends Oxygen_Entity_Controller {
4 4 public function plural($n) {
5 5 if($n === 1) return 'item';
6 6 else return 'items';
7 7 }
8 8
  9 + public function configure($x) {
  10 + $ks = array();
  11 + foreach($this->model->meta['keys'][0] as $k=>$v){
  12 + $ks[] = '{'.$k.':url}';
  13 + };
  14 + $key = implode('/',$ks);
  15 + $x[$key]->Oxygen_Entity_Controller($this->model);
  16 + }
  17 +
9 18 public function rpc_getMore($offset) {
10 19 $this->model = $this->model->slice($offset, 25);
11 20 return array(
0  common/collection/filter.less → entity/collection/filter.less
File renamed without changes
0  common/collection/filter.php → entity/collection/filter.php
File renamed without changes
0  common/collection/header_actions.php → entity/collection/header_actions.php
File renamed without changes
0  common/collection/short_info.php → entity/collection/short_info.php
File renamed without changes
0  common/collection/table.js → entity/collection/table.js
File renamed without changes
0  common/collection/table.less → entity/collection/table.less
File renamed without changes
0  common/collection/table.php → entity/collection/table.php
File renamed without changes
0  common/collection/table_header.php → entity/collection/table_header.php
File renamed without changes
0  common/collection/table_rows.php → entity/collection/table_rows.php
File renamed without changes
0  common/collection/view.php → entity/collection/view.php
File renamed without changes
0  common/controller/as_table_row.php → entity/controller/as_table_row.php
File renamed without changes
7 entity/controller/controller.class.php
... ... @@ -0,0 +1,7 @@
  1 +<?
  2 +
  3 + class Oxygen_Entity_Controller extends Oxygen_Controller {
  4 +
  5 + }
  6 +
  7 +?>
0  common/controller/data_content.php → entity/controller/data_content.php
File renamed without changes
0  common/controller/data_view.php → entity/controller/data_view.php
File renamed without changes
0  common/controller/header.less → entity/controller/header.less
File renamed without changes
0  common/controller/header.php → entity/controller/header.php
File renamed without changes
0  common/controller/header_actions.php → entity/controller/header_actions.php
File renamed without changes
0  common/controller/short_info.php → entity/controller/short_info.php
File renamed without changes
2  sql/row/row.class.php → entity/entity.class.php
... ... @@ -1,6 +1,6 @@
1 1 <?
2 2
3   - class Oxygen_SQL_Row extends Oxygen_Object implements ArrayAccess {
  3 + class Oxygen_Entity extends Oxygen_Object implements ArrayAccess {
4 4
5 5 const MISSING_DATA = 'Part of data is missing with key "{0}"';
6 6 const WRONG_ARGUMENT_COUNT = 'Wrong argument count';
2  itself.php
@@ -82,7 +82,7 @@ function redirectResponse($data) {
82 82 function registerOxygenCommons($scope) {
83 83 $array = array(
84 84 'LogonPage' => 'Oxygen_Common_LogonPage',
85   - 'Authenticator' => 'Oxygen_Common_Authenticator',
  85 + 'Authenticator' => 'Oxygen_Common_Auth',
86 86 'Application' => 'Oxygen_Common_Application',
87 87 'Page' => 'Oxygen_Common_Page'
88 88 );
90 model/model.class.php
... ... @@ -1,90 +0,0 @@
1   -<?
2   -
3   - class Oxygen_Model extends Oxygen_Object implements ArrayAccess {
4   -
5   - const MISSING_DATA = 'Part of data is missing with key "{0}"';
6   - const WRONG_ARGUMENT_COUNT = 'Wrong argument count';
7   -
8   - private $original = array();
9   - private $current = array();
10   - private $new = false;
11   -
12   - public function getDefaults() {
13   - return array();
14   - }
15   -
16   - public function __submit() {
17   - }
18   -
19   - public function __construct($original = false) {
20   - if($original === false) {
21   - $new = true;
22   - $original = array();
23   - $current = $this->getDefaults();
24   - }
25   - $this->original = $original;
26   - $this->current = $original;
27   - }
28   -
29   - public function offsetExists($data) {
30   - if(is_string($data)) {
31   - return isset($this->current[$data]);
32   - } else if(is_array($data)) {
33   - foreach($data as $d) {
34   - if(!$this->offsetExists($d)) {
35   - return false;
36   - }
37   - }
38   - return true;
39   - } else {
40   - return false;
41   - }
42   - }
43   -
44   - public function offsetUnset($data) {
45   -
46   - if(is_string($data)) {
47   - unset($this->current[$data]);
48   - } else if(is_array($data)) {
49   - foreach($data as $d) {
50   - $this->offsetUnset($d);
51   - }
52   - }
53   - }
54   -
55   - public function offsetSet($data,$value) {
56   - if(is_string($data)){
57   - $this->current[$data] = $value;
58   - } else if(is_array($data)) {
59   - foreach($data as $k => $d) {
60   - if(!isset($value[$k])) {
61   - $this->throwException(
62   - Oxygen_Utils_Text::format(self::MISSING_DATA,$k)
63   - );
64   - }
65   - $this->offsetSet($d, $value[$k]);
66   - }
67   - }
68   - }
69   -
70   - public function offsetGet($data) {
71   - if(is_string($data)) {
72   - if(!isset($this->current[$data])) {
73   - $this->throwException(
74   - Oxygen_Utils_Text::format(self::MISSING_DATA,$k)
75   - );
76   - }
77   - $result = $this->current[$data];
78   - } else if(is_array($data)) {
79   - $result = array();
80   - foreach($data as $k => $d) {
81   - $result[$k] = $this->offsetGet($d);
82   - }
83   - }
84   - return $result;
85   - }
86   - }
87   -
88   -
89   -
90   -?>
12 sql/collection/collection.class.php
... ... @@ -1,12 +0,0 @@
1   -<?
2   -
3   - class Oxygen_SQL_Collection extends Oxygen_Object
4   - implements Countable, ArrayAccess, IteratorAggregate
5   -
6   - {
7   -
8   -
9   - }
10   -
11   -
12   -?>
5 sql/connection/connection.class.php
@@ -28,12 +28,11 @@ class Oxygen_SQL_Connection extends Oxygen_ScopeController {
28 28 'Column' => 'Oxygen_SQL_Column',
29 29 'Key' => 'Oxygen_SQL_Key',
30 30 'Keys' => 'Oxygen_SQL_Keys',
31   - 'Data' => 'Oxygen_SQL_Data',
32   - 'Row' => 'Oxygen_SQL_Row',
33 31 'DataSet' => 'Oxygen_SQL_DataSet',
34 32 'Builder' => 'Oxygen_SQL_Builder',
35 33 'ResultSet' => 'Oxygen_SQL_ResultSet',
36   - 'DataIterator' => 'Oxygen_SQL_ResultSet_Iterator'
  34 + 'DataIterator' => 'Oxygen_SQL_ResultSet_Iterator',
  35 + 'Row' => 'Oxygen_Entity'
37 36 );
38 37
39 38 public function __construct($config, $refreshSchemata = false) {
6 sql/data/data.class.php
... ... @@ -1,6 +0,0 @@
1   -<?
2   -
3   - class Oxygen_SQL_Data extends Oxygen_Controller {
4   - }
5   -
6   -?>
4 sql/scripts/scripts.class.php
... ... @@ -1,8 +1,8 @@
1 1 <?
2 2
3   - class Oxygen_Sql_Scripts extends Oxygen_Common_Controller {
  3 + class Oxygen_Sql_Scripts extends Oxygen_Entity_Controller {
4 4
5 5
6 6 }
7 7
8   -?>
  8 +?>
7 sql/table/table.class.php
@@ -53,10 +53,10 @@ public function getData($alias) {
53 53
54 54 public function getKeys($alias) {
55 55 $result = array();
56   - foreach($this['keys'] as $key => $columns) {
  56 + foreach($this->model['keys'] as $name => $key) {
57 57 $k = array();
58   - foreach($columns as $name => $col) {
59   - $k[$name] = $alias . '.' . $col->model['column'];
  58 + foreach($key['columns'] as $col) {
  59 + $k[$col['column']] = $alias . '.' . $col['column'];
60 60 }
61 61 $result[] = $k;
62 62 }
@@ -146,6 +146,7 @@ public function getPolicyPredicates($alias) {
146 146 public function configure($x) {
147 147 $x['columns']->Columns($this->model['columns']);
148 148 $x['keys']->Keys($this->model['keys']);
  149 + $x['rows']->Oxygen_Entity_Collection($this->getData($this->model['name']));
149 150 }
150 151
151 152 public function __complete() {

0 comments on commit 65b9c9a

Please sign in to comment.
Something went wrong with that request. Please try again.