From b5641db6074d0dda1dec7b32e33a89fe67de7a10 Mon Sep 17 00:00:00 2001 From: origami11 Date: Thu, 9 Feb 2017 14:57:40 +0300 Subject: [PATCH] =?UTF-8?q?=D0=9F=D0=B5=D1=80=D0=B5=D0=B4=D0=B5=D0=BB?= =?UTF-8?q?=D0=BA=D0=B0=20=D0=B4=D0=BB=D1=8F=20composer=20autoload?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- composer.json | 6 +- core/connection/all.php | 4 - core/database.php | 16 ---- core/drivers/database.mysql.php | 50 ------------- core/drivers/database.odbc.php | 54 -------------- core/drivers/database.pgsql.php | 74 ------------------- core/drivers/db.php | 50 ------------- core/safecollection.php | 35 --------- {core => src}/adapter.php | 2 +- {core => src}/arr.php | 0 {core => src}/collection.php | 0 {core => src}/config.php | 0 {core => src}/connection/httpconnection.php | 3 +- .../connection/httpconnectionresponse.php | 2 +- {core => src}/connection/idna_convert.php | 0 .../controller/action.php | 10 --- {core => src}/controller/component.php | 4 +- {core => src}/controller/controller.php | 4 +- .../controller/front.php | 0 {core => src}/controller/installer.php | 4 +- {core => src}/controller/state.php | 2 +- {core => src}/data/areas.php | 0 {core => src}/data/city-short.php | 0 {core => src}/data/city.php | 0 {core => src}/data/mime.php | 0 {core => src}/data/okato.php | 0 {core => src}/data/regions.php | 0 {core => src}/data/states.php | 0 core/database_pdo.php => src/database.php | 0 {core => src}/error.php | 0 {core => src}/file.php | 0 {core => src}/filter/actionaccess.php | 0 {core => src}/filter/actionlogger.php | 0 {core => src}/filter/filterbase.php | 2 +- {core => src}/filter/filterlogin.php | 2 +- .../filter.php => src/filter/useraccess.php | 0 {core => src}/form/form.php | 0 {core => src}/form/viewstate.php | 0 {core => src}/formats/dot.php | 0 {core => src}/formats/helix.php | 0 {core => src}/functions.php | 0 {core => src}/geometry/point.php | 0 {core => src}/geometry/rectangle.php | 0 {core => src}/httprequest.php | 3 - {core => src}/layout/layout.php | 0 {core => src}/mail.php | 0 {core => src}/mapper/factory.php | 0 {core => src}/mapper/mapper.php | 0 {core => src}/mapper/pathmapper.php | 0 {core => src}/markup/simple_bb_code.php | 0 {core => src}/numbers.php | 0 {core => src}/path.php | 0 {core => src}/primitive.php | 2 - {core => src}/query/meta.php | 0 {core => src}/query/query.php | 0 {core => src}/query/table.php | 0 {core => src}/registry.php | 1 - {search => src/search}/htmlhelper.php | 0 {search => src/search}/index.php | 0 {search => src/search}/lexer.php | 0 {search => src/search}/search.php | 0 {search => src/search}/searcher.php | 0 {search => src/search}/stemmer.php | 0 {core => src}/session.php | 0 {core => src}/settings.php | 2 - {core => src}/setup.php | 5 -- {core => src}/shortcut.php | 0 {core => src}/sort.php | 0 {core => src}/spell.php | 2 - {core => src}/tabletree.php | 0 {core => src}/tales.php | 0 {core => src}/tools/drawing.php | 0 {core => src}/tools/exceltable.php | 0 {core => src}/tools/image.php | 0 {core => src}/tools/password.php | 0 {core => src}/tools/string.php | 0 {core => src}/tools/tableview.php | 0 {core => src}/tools/templateimage.php | 0 {core => src}/tools/translit.php | 0 {core => src}/tree/database.php | 0 {core => src}/tree/dbtree.php | 0 {core => src}/tree/sort.php | 0 {core => src}/validator/rule/abstract.php | 0 {core => src}/validator/rule/all.php | 0 {core => src}/validator/rule/alpha.php | 0 {core => src}/validator/rule/code.php | 0 {core => src}/validator/rule/count.php | 0 {core => src}/validator/rule/date.php | 0 {core => src}/validator/rule/email.php | 0 {core => src}/validator/rule/emaillist.php | 0 {core => src}/validator/rule/isfile.php | 0 {core => src}/validator/rule/match.php | 0 {core => src}/validator/rule/notnull.php | 0 {core => src}/validator/rule/numeric.php | 0 {core => src}/validator/rule/time.php | 0 {core => src}/validator/rule/unique.php | 0 {core => src}/validator/validator.php | 0 {core => src}/view/compositeview.php | 0 {core => src}/view/view.php | 0 {core => src}/zipfile.php | 0 100 files changed, 14 insertions(+), 325 deletions(-) delete mode 100644 core/connection/all.php delete mode 100644 core/database.php delete mode 100644 core/drivers/database.mysql.php delete mode 100644 core/drivers/database.odbc.php delete mode 100644 core/drivers/database.pgsql.php delete mode 100644 core/drivers/db.php delete mode 100644 core/safecollection.php rename {core => src}/adapter.php (90%) rename {core => src}/arr.php (100%) rename {core => src}/collection.php (100%) rename {core => src}/config.php (100%) rename {core => src}/connection/httpconnection.php (98%) rename {core => src}/connection/httpconnectionresponse.php (98%) rename {core => src}/connection/idna_convert.php (100%) rename core/controller/admincontroller.php => src/controller/action.php (97%) rename {core => src}/controller/component.php (99%) rename {core => src}/controller/controller.php (99%) rename core/controller/frontcontroller.php => src/controller/front.php (100%) rename {core => src}/controller/installer.php (98%) rename {core => src}/controller/state.php (98%) rename {core => src}/data/areas.php (100%) rename {core => src}/data/city-short.php (100%) rename {core => src}/data/city.php (100%) rename {core => src}/data/mime.php (100%) rename {core => src}/data/okato.php (100%) rename {core => src}/data/regions.php (100%) rename {core => src}/data/states.php (100%) rename core/database_pdo.php => src/database.php (100%) rename {core => src}/error.php (100%) rename {core => src}/file.php (100%) rename {core => src}/filter/actionaccess.php (100%) rename {core => src}/filter/actionlogger.php (100%) rename {core => src}/filter/filterbase.php (96%) rename {core => src}/filter/filterlogin.php (98%) rename core/filter/filter.php => src/filter/useraccess.php (100%) rename {core => src}/form/form.php (100%) rename {core => src}/form/viewstate.php (100%) rename {core => src}/formats/dot.php (100%) rename {core => src}/formats/helix.php (100%) rename {core => src}/functions.php (100%) rename {core => src}/geometry/point.php (100%) rename {core => src}/geometry/rectangle.php (100%) rename {core => src}/httprequest.php (97%) rename {core => src}/layout/layout.php (100%) rename {core => src}/mail.php (100%) rename {core => src}/mapper/factory.php (100%) rename {core => src}/mapper/mapper.php (100%) rename {core => src}/mapper/pathmapper.php (100%) rename {core => src}/markup/simple_bb_code.php (100%) rename {core => src}/numbers.php (100%) rename {core => src}/path.php (100%) rename {core => src}/primitive.php (99%) rename {core => src}/query/meta.php (100%) rename {core => src}/query/query.php (100%) rename {core => src}/query/table.php (100%) rename {core => src}/registry.php (92%) rename {search => src/search}/htmlhelper.php (100%) rename {search => src/search}/index.php (100%) rename {search => src/search}/lexer.php (100%) rename {search => src/search}/search.php (100%) rename {search => src/search}/searcher.php (100%) rename {search => src/search}/stemmer.php (100%) rename {core => src}/session.php (100%) rename {core => src}/settings.php (99%) rename {core => src}/setup.php (94%) rename {core => src}/shortcut.php (100%) rename {core => src}/sort.php (100%) rename {core => src}/spell.php (99%) rename {core => src}/tabletree.php (100%) rename {core => src}/tales.php (100%) rename {core => src}/tools/drawing.php (100%) rename {core => src}/tools/exceltable.php (100%) rename {core => src}/tools/image.php (100%) rename {core => src}/tools/password.php (100%) rename {core => src}/tools/string.php (100%) rename {core => src}/tools/tableview.php (100%) rename {core => src}/tools/templateimage.php (100%) rename {core => src}/tools/translit.php (100%) rename {core => src}/tree/database.php (100%) rename {core => src}/tree/dbtree.php (100%) rename {core => src}/tree/sort.php (100%) rename {core => src}/validator/rule/abstract.php (100%) rename {core => src}/validator/rule/all.php (100%) rename {core => src}/validator/rule/alpha.php (100%) rename {core => src}/validator/rule/code.php (100%) rename {core => src}/validator/rule/count.php (100%) rename {core => src}/validator/rule/date.php (100%) rename {core => src}/validator/rule/email.php (100%) rename {core => src}/validator/rule/emaillist.php (100%) rename {core => src}/validator/rule/isfile.php (100%) rename {core => src}/validator/rule/match.php (100%) rename {core => src}/validator/rule/notnull.php (100%) rename {core => src}/validator/rule/numeric.php (100%) rename {core => src}/validator/rule/time.php (100%) rename {core => src}/validator/rule/unique.php (100%) rename {core => src}/validator/validator.php (100%) rename {core => src}/view/compositeview.php (100%) rename {core => src}/view/view.php (100%) rename {core => src}/zipfile.php (100%) diff --git a/composer.json b/composer.json index a187ad9..8c45455 100644 --- a/composer.json +++ b/composer.json @@ -7,5 +7,9 @@ "email": "phedor@edu.yar.ru" } ], - "require": {} + "require": { + "psr-0": { + "": "src/" + } + } } diff --git a/core/connection/all.php b/core/connection/all.php deleted file mode 100644 index 3bc9748..0000000 --- a/core/connection/all.php +++ /dev/null @@ -1,4 +0,0 @@ - \ No newline at end of file diff --git a/core/database.php b/core/database.php deleted file mode 100644 index 52eca1a..0000000 --- a/core/database.php +++ /dev/null @@ -1,16 +0,0 @@ -connect($dsn); - return $database; - } -} diff --git a/core/drivers/database.mysql.php b/core/drivers/database.mysql.php deleted file mode 100644 index 99eb601..0000000 --- a/core/drivers/database.mysql.php +++ /dev/null @@ -1,50 +0,0 @@ -db = $db); - } - - public function close() - { - return mysql_close($this->db); - } - - public function query($query) - { - $res = mysql_query($this->db, $query) - or die("Error: wrong SQL query #$query#"); - return $res; - } - - public function fetchAllArray($query) - { - $res = $this->query($query); - - while ($row = mysql_fetch_array ($res)) - $rows[] = $row; - mysql_free_result($res); - return ($rows) ? $rows : array(); - } - - public function fetchOneArray($query) - { - $res = $this->query($query); - $row = mysql_fetch_array($res); - mysql_free_result($res); - return ($row) ? $row : array(); - } -} - -?> \ No newline at end of file diff --git a/core/drivers/database.odbc.php b/core/drivers/database.odbc.php deleted file mode 100644 index cb166bf..0000000 --- a/core/drivers/database.odbc.php +++ /dev/null @@ -1,54 +0,0 @@ -db = $db); - } - - public function close() - { - return odbc_close($this->db); - } - - public function query($query) - { - $res = odbc_exec($this->db, $query) - or die("Error: wrong SQL query #$query#"); - return $res; - } - - public function fetchAllArray($query) - { - $res = $this->query($query); - $to = odbc_num_fields($res); - while (odbc_fetch_row($res)) { - for ($i = 1; $i <= $to; $i++) { - $row [odbc_field_name($res, $i)] = trim(odbc_result($res, $i)); - } - $rows[] = $row; - } - return ($rows)? $rows : array(); - } - - public function fetchOneArray($query) - { - $res = $this->query($query); - if (!odbc_fetch_row($res)) return array (); - $to = odbc_num_fields($res); - for ($i = 1; $i <= $to; $i++) { - $row [odbc_field_name($res, $i)] = trim(odbc_result($res, $i)); - } - return $row; - } -} - -?> \ No newline at end of file diff --git a/core/drivers/database.pgsql.php b/core/drivers/database.pgsql.php deleted file mode 100644 index 64de93f..0000000 --- a/core/drivers/database.pgsql.php +++ /dev/null @@ -1,74 +0,0 @@ -db = $db); - } - - public function close() - { - return pg_close($this->db); - } - - public function query($query) - { - $res = pg_query($this->db, $query) - or die("Error: wrong SQL query #$query#"); - return $res; - } - - public function fetchAllArray($query, $type = PGSQL_ASSOC) - { - $res = $this->query($query); - - $rows = array(); - while ($row = pg_fetch_array($res, NULL, $type)) { - $rows[] = $this->clean($row); - } - pg_free_result($res); - return ($rows) ? $rows : array(); - } - - public function affectedRows() - { - return pg_affected_rows($this->db); - } - - private function clean($row) - { - foreach ($row as $key => $value) { - $row[$key] = trim($value); - } - return $row; - } - - public function fetchOneArray($query, $type = PGSQL_ASSOC) - { - $res = $this->query($query); - $row = pg_fetch_array($res, NULL, $type); - pg_free_result($res); - return ($row) ? $this->clean($row) : array(); - } - - function getNextId($seq) - { - $result = $this->fetchOneArray("SELECT nextval('$seq')"); - return $result['nextval']; - } -} diff --git a/core/drivers/db.php b/core/drivers/db.php deleted file mode 100644 index 3e5014d..0000000 --- a/core/drivers/db.php +++ /dev/null @@ -1,50 +0,0 @@ -query("INSERT INTO $table (" . implode(",", array_keys($values)) - . ") VALUES (" . implode(",", array_map(array('self', 'quote'), array_values($values))) . ")"); - } - - function update($table, array $values, $cond) - { - return $this->query("UPDATE $table SET " . implode(",", - array_map(array('self', 'assign_quote'), array_keys($values), array_values($values))) . " WHERE $cond"); - } - - function check_text($text) - { - if(strlen($text) > self::limit) $text = substr($text, 0, self::limit); - $text = htmlspecialchars(trim($text)); - return $text; - } -} - -?> \ No newline at end of file diff --git a/core/safecollection.php b/core/safecollection.php deleted file mode 100644 index df5529d..0000000 --- a/core/safecollection.php +++ /dev/null @@ -1,35 +0,0 @@ -data = $this->_stripSlashes($this->data); - } - $this->data = $this->data; - } - - function import(array $data) - { - parent::import($data); - $this->_clean(); - } - - /** - * Strip slashes code from php.net website. - * - * @param mixed $value - * @return array - */ - protected function _stripSlashes($value) - { - if(is_array($value)) { - return array_map(array($this,'_stripSlashes'), $value); - } else { - return stripslashes($value); - } - } -} diff --git a/core/adapter.php b/src/adapter.php similarity index 90% rename from core/adapter.php rename to src/adapter.php index 39af4c2..42bd4ab 100644 --- a/core/adapter.php +++ b/src/adapter.php @@ -14,7 +14,7 @@ class Adapter public function get($name) { if (is_array ($this->adaptee)) { - return $this->adaptee [$name]; + return $this->adaptee[$name]; } else { return $this->adaptee->$name; } diff --git a/core/arr.php b/src/arr.php similarity index 100% rename from core/arr.php rename to src/arr.php diff --git a/core/collection.php b/src/collection.php similarity index 100% rename from core/collection.php rename to src/collection.php diff --git a/core/config.php b/src/config.php similarity index 100% rename from core/config.php rename to src/config.php diff --git a/core/connection/httpconnection.php b/src/connection/httpconnection.php similarity index 98% rename from core/connection/httpconnection.php rename to src/connection/httpconnection.php index b2b25f3..534be58 100644 --- a/core/connection/httpconnection.php +++ b/src/connection/httpconnection.php @@ -1,7 +1,6 @@ value; } } - -?> \ No newline at end of file diff --git a/core/query/meta.php b/src/query/meta.php similarity index 100% rename from core/query/meta.php rename to src/query/meta.php diff --git a/core/query/query.php b/src/query/query.php similarity index 100% rename from core/query/query.php rename to src/query/query.php diff --git a/core/query/table.php b/src/query/table.php similarity index 100% rename from core/query/table.php rename to src/query/table.php diff --git a/core/registry.php b/src/registry.php similarity index 92% rename from core/registry.php rename to src/registry.php index 661dad5..862a3d4 100644 --- a/core/registry.php +++ b/src/registry.php @@ -5,7 +5,6 @@ * http://www.patternsforphp.com/wiki/Singleton * http://www.phppatterns.com/docs/design/the_registry?s=registry */ -require_once 'core/settings.php'; class Registry extends Settings { diff --git a/search/htmlhelper.php b/src/search/htmlhelper.php similarity index 100% rename from search/htmlhelper.php rename to src/search/htmlhelper.php diff --git a/search/index.php b/src/search/index.php similarity index 100% rename from search/index.php rename to src/search/index.php diff --git a/search/lexer.php b/src/search/lexer.php similarity index 100% rename from search/lexer.php rename to src/search/lexer.php diff --git a/search/search.php b/src/search/search.php similarity index 100% rename from search/search.php rename to src/search/search.php diff --git a/search/searcher.php b/src/search/searcher.php similarity index 100% rename from search/searcher.php rename to src/search/searcher.php diff --git a/search/stemmer.php b/src/search/stemmer.php similarity index 100% rename from search/stemmer.php rename to src/search/stemmer.php diff --git a/core/session.php b/src/session.php similarity index 100% rename from core/session.php rename to src/session.php diff --git a/core/settings.php b/src/settings.php similarity index 99% rename from core/settings.php rename to src/settings.php index 35de901..3566c89 100644 --- a/core/settings.php +++ b/src/settings.php @@ -1,7 +1,5 @@ \ No newline at end of file diff --git a/core/shortcut.php b/src/shortcut.php similarity index 100% rename from core/shortcut.php rename to src/shortcut.php diff --git a/core/sort.php b/src/sort.php similarity index 100% rename from core/sort.php rename to src/sort.php diff --git a/core/spell.php b/src/spell.php similarity index 99% rename from core/spell.php rename to src/spell.php index bc45a0d..43b0ce8 100644 --- a/core/spell.php +++ b/src/spell.php @@ -96,5 +96,3 @@ class Spell return false; } } - -?> \ No newline at end of file diff --git a/core/tabletree.php b/src/tabletree.php similarity index 100% rename from core/tabletree.php rename to src/tabletree.php diff --git a/core/tales.php b/src/tales.php similarity index 100% rename from core/tales.php rename to src/tales.php diff --git a/core/tools/drawing.php b/src/tools/drawing.php similarity index 100% rename from core/tools/drawing.php rename to src/tools/drawing.php diff --git a/core/tools/exceltable.php b/src/tools/exceltable.php similarity index 100% rename from core/tools/exceltable.php rename to src/tools/exceltable.php diff --git a/core/tools/image.php b/src/tools/image.php similarity index 100% rename from core/tools/image.php rename to src/tools/image.php diff --git a/core/tools/password.php b/src/tools/password.php similarity index 100% rename from core/tools/password.php rename to src/tools/password.php diff --git a/core/tools/string.php b/src/tools/string.php similarity index 100% rename from core/tools/string.php rename to src/tools/string.php diff --git a/core/tools/tableview.php b/src/tools/tableview.php similarity index 100% rename from core/tools/tableview.php rename to src/tools/tableview.php diff --git a/core/tools/templateimage.php b/src/tools/templateimage.php similarity index 100% rename from core/tools/templateimage.php rename to src/tools/templateimage.php diff --git a/core/tools/translit.php b/src/tools/translit.php similarity index 100% rename from core/tools/translit.php rename to src/tools/translit.php diff --git a/core/tree/database.php b/src/tree/database.php similarity index 100% rename from core/tree/database.php rename to src/tree/database.php diff --git a/core/tree/dbtree.php b/src/tree/dbtree.php similarity index 100% rename from core/tree/dbtree.php rename to src/tree/dbtree.php diff --git a/core/tree/sort.php b/src/tree/sort.php similarity index 100% rename from core/tree/sort.php rename to src/tree/sort.php diff --git a/core/validator/rule/abstract.php b/src/validator/rule/abstract.php similarity index 100% rename from core/validator/rule/abstract.php rename to src/validator/rule/abstract.php diff --git a/core/validator/rule/all.php b/src/validator/rule/all.php similarity index 100% rename from core/validator/rule/all.php rename to src/validator/rule/all.php diff --git a/core/validator/rule/alpha.php b/src/validator/rule/alpha.php similarity index 100% rename from core/validator/rule/alpha.php rename to src/validator/rule/alpha.php diff --git a/core/validator/rule/code.php b/src/validator/rule/code.php similarity index 100% rename from core/validator/rule/code.php rename to src/validator/rule/code.php diff --git a/core/validator/rule/count.php b/src/validator/rule/count.php similarity index 100% rename from core/validator/rule/count.php rename to src/validator/rule/count.php diff --git a/core/validator/rule/date.php b/src/validator/rule/date.php similarity index 100% rename from core/validator/rule/date.php rename to src/validator/rule/date.php diff --git a/core/validator/rule/email.php b/src/validator/rule/email.php similarity index 100% rename from core/validator/rule/email.php rename to src/validator/rule/email.php diff --git a/core/validator/rule/emaillist.php b/src/validator/rule/emaillist.php similarity index 100% rename from core/validator/rule/emaillist.php rename to src/validator/rule/emaillist.php diff --git a/core/validator/rule/isfile.php b/src/validator/rule/isfile.php similarity index 100% rename from core/validator/rule/isfile.php rename to src/validator/rule/isfile.php diff --git a/core/validator/rule/match.php b/src/validator/rule/match.php similarity index 100% rename from core/validator/rule/match.php rename to src/validator/rule/match.php diff --git a/core/validator/rule/notnull.php b/src/validator/rule/notnull.php similarity index 100% rename from core/validator/rule/notnull.php rename to src/validator/rule/notnull.php diff --git a/core/validator/rule/numeric.php b/src/validator/rule/numeric.php similarity index 100% rename from core/validator/rule/numeric.php rename to src/validator/rule/numeric.php diff --git a/core/validator/rule/time.php b/src/validator/rule/time.php similarity index 100% rename from core/validator/rule/time.php rename to src/validator/rule/time.php diff --git a/core/validator/rule/unique.php b/src/validator/rule/unique.php similarity index 100% rename from core/validator/rule/unique.php rename to src/validator/rule/unique.php diff --git a/core/validator/validator.php b/src/validator/validator.php similarity index 100% rename from core/validator/validator.php rename to src/validator/validator.php diff --git a/core/view/compositeview.php b/src/view/compositeview.php similarity index 100% rename from core/view/compositeview.php rename to src/view/compositeview.php diff --git a/core/view/view.php b/src/view/view.php similarity index 100% rename from core/view/view.php rename to src/view/view.php diff --git a/core/zipfile.php b/src/zipfile.php similarity index 100% rename from core/zipfile.php rename to src/zipfile.php