diff --git a/.gitignore b/.gitignore index c1f80d8..a4ced0f 100644 --- a/.gitignore +++ b/.gitignore @@ -1,6 +1,6 @@ -backend/volkszaehler.conf.php -share/sql/demo/pulses.dummy.copy +etc/volkszaehler.conf.php +misc/sql/demo/pulses.dummy.copy .project .buildpath .settings/ -backend/lib/vendor/* +lib/vendor/* diff --git a/.gitmodules b/.gitmodules index 2def10d..73fed6c 100644 --- a/.gitmodules +++ b/.gitmodules @@ -1,3 +1,3 @@ -[submodule "controller/ethersex"] - path = controller/ethersex +[submodule "misc/controller/ethersex"] + path = misc/controller/ethersex url = git://github.com/volkszaehler/ethersex.git diff --git a/.htaccess b/.htaccess new file mode 100644 index 0000000..26f6af9 --- /dev/null +++ b/.htaccess @@ -0,0 +1,2 @@ +Deny from all +#Allow from localhost diff --git a/backend/.gitignore b/backend/.gitignore deleted file mode 100644 index bc3d175..0000000 --- a/backend/.gitignore +++ /dev/null @@ -1 +0,0 @@ -/database.sqlite diff --git a/backend/.htaccess b/backend/.htaccess deleted file mode 100644 index 4261867..0000000 --- a/backend/.htaccess +++ /dev/null @@ -1,5 +0,0 @@ - - RewriteEngine On - RewriteCond %{SCRIPT_FILENAME} !index.php$ - RewriteRule (.*) index.php/$1 [L] - diff --git a/backend/bin/doctrine b/bin/doctrine similarity index 100% rename from backend/bin/doctrine rename to bin/doctrine diff --git a/backend/bin/doctrine.php b/bin/doctrine.php similarity index 79% rename from backend/bin/doctrine.php rename to bin/doctrine.php index 9add58b..4ef6716 100644 --- a/backend/bin/doctrine.php +++ b/bin/doctrine.php @@ -29,15 +29,14 @@ use Volkszaehler\Util; // TODO replace by state class define('VZ_VERSION', 0.2); define('VZ_DIR', realpath(__DIR__ . '/../..')); -define('VZ_BACKEND_DIR', VZ_DIR . '/backend'); // class autoloading -require_once VZ_BACKEND_DIR . '/lib/Util/ClassLoader.php'; +require_once VZ_DIR . '/lib/Util/ClassLoader.php'; $classLoaders = array( - new Volkszaehler\Util\ClassLoader('Doctrine', VZ_BACKEND_DIR . '/lib/vendor/Doctrine'), - new Volkszaehler\Util\ClassLoader('Symfony', VZ_BACKEND_DIR . '/lib/vendor/Symfony'), - new Volkszaehler\Util\ClassLoader('Volkszaehler', VZ_BACKEND_DIR . '/lib') + new Volkszaehler\Util\ClassLoader('Doctrine', VZ_DIR . '/lib/vendor/Doctrine'), + new Volkszaehler\Util\ClassLoader('Symfony', VZ_DIR . '/lib/vendor/Symfony'), + new Volkszaehler\Util\ClassLoader('Volkszaehler', VZ_DIR . '/lib') ); foreach ($classLoaders as $loader) { @@ -45,7 +44,7 @@ foreach ($classLoaders as $loader) { } // load configuration -Util\Configuration::load(VZ_BACKEND_DIR . '/volkszaehler.conf'); +Util\Configuration::load(VZ_DIR . '/etc/volkszaehler.conf'); $em = Volkszaehler\Router::createEntityManager(TRUE); // get admin credentials diff --git a/controller/ethersex b/controller/ethersex deleted file mode 160000 index df9cbb1..0000000 --- a/controller/ethersex +++ /dev/null @@ -1 +0,0 @@ -Subproject commit df9cbb1f251f6aa609f127ab2109f4ea6933c1fe diff --git a/backend/volkszaehler.conf.template.php b/etc/volkszaehler.conf.template.php similarity index 100% rename from backend/volkszaehler.conf.template.php rename to etc/volkszaehler.conf.template.php diff --git a/htdocs/.htaccess b/htdocs/.htaccess new file mode 100644 index 0000000..98ded0f --- /dev/null +++ b/htdocs/.htaccess @@ -0,0 +1,6 @@ +Allow from all + + + RewriteEngine On + RewriteRule ^backend/(.*) backend.php/$1 [L] + diff --git a/backend/index.php b/htdocs/backend.php similarity index 82% rename from backend/index.php rename to htdocs/backend.php index b3f1454..262fb4b 100644 --- a/backend/index.php +++ b/htdocs/backend.php @@ -35,21 +35,20 @@ error_reporting(E_ALL | E_STRICT); // TODO replace by state class define('VZ_VERSION', 0.2); define('VZ_DIR', realpath(__DIR__ . '/..')); -define('VZ_BACKEND_DIR', VZ_DIR . '/backend'); // class autoloading -require VZ_BACKEND_DIR . '/lib/Util/ClassLoader.php'; +require VZ_DIR . '/lib/Util/ClassLoader.php'; $classLoaders = array( - new Util\ClassLoader('Volkszaehler', VZ_BACKEND_DIR . '/lib'), - new Util\ClassLoader('Doctrine', VZ_BACKEND_DIR . '/lib/vendor/Doctrine') + new Util\ClassLoader('Volkszaehler', VZ_DIR . '/lib'), + new Util\ClassLoader('Doctrine', VZ_DIR . '/lib/vendor/Doctrine') ); foreach ($classLoaders as $loader) { $loader->register(); // register on SPL autoload stack } -Util\Configuration::load(VZ_BACKEND_DIR . '/volkszaehler.conf'); +Util\Configuration::load(VZ_DIR . '/etc/volkszaehler.conf'); $r = new Router(); $r->run(); diff --git a/frontend/images/add.png b/htdocs/frontend/images/add.png similarity index 100% rename from frontend/images/add.png rename to htdocs/frontend/images/add.png diff --git a/frontend/images/arrow_refresh.png b/htdocs/frontend/images/arrow_refresh.png similarity index 100% rename from frontend/images/arrow_refresh.png rename to htdocs/frontend/images/arrow_refresh.png diff --git a/frontend/images/arrow_right.png b/htdocs/frontend/images/arrow_right.png similarity index 100% rename from frontend/images/arrow_right.png rename to htdocs/frontend/images/arrow_right.png diff --git a/frontend/images/chart_curve.png b/htdocs/frontend/images/chart_curve.png similarity index 100% rename from frontend/images/chart_curve.png rename to htdocs/frontend/images/chart_curve.png diff --git a/frontend/images/chart_line.png b/htdocs/frontend/images/chart_line.png similarity index 100% rename from frontend/images/chart_line.png rename to htdocs/frontend/images/chart_line.png diff --git a/frontend/images/control_end_blue.png b/htdocs/frontend/images/control_end_blue.png similarity index 100% rename from frontend/images/control_end_blue.png rename to htdocs/frontend/images/control_end_blue.png diff --git a/frontend/images/control_fastforward_blue.png b/htdocs/frontend/images/control_fastforward_blue.png similarity index 100% rename from frontend/images/control_fastforward_blue.png rename to htdocs/frontend/images/control_fastforward_blue.png diff --git a/frontend/images/control_rewind_blue.png b/htdocs/frontend/images/control_rewind_blue.png similarity index 100% rename from frontend/images/control_rewind_blue.png rename to htdocs/frontend/images/control_rewind_blue.png diff --git a/frontend/images/control_start_blue.png b/htdocs/frontend/images/control_start_blue.png similarity index 100% rename from frontend/images/control_start_blue.png rename to htdocs/frontend/images/control_start_blue.png diff --git a/frontend/images/delete.png b/htdocs/frontend/images/delete.png similarity index 100% rename from frontend/images/delete.png rename to htdocs/frontend/images/delete.png diff --git a/frontend/images/empty.png b/htdocs/frontend/images/empty.png similarity index 100% rename from frontend/images/empty.png rename to htdocs/frontend/images/empty.png diff --git a/frontend/images/eye.png b/htdocs/frontend/images/eye.png similarity index 100% rename from frontend/images/eye.png rename to htdocs/frontend/images/eye.png diff --git a/frontend/images/folder.png b/htdocs/frontend/images/folder.png similarity index 100% rename from frontend/images/folder.png rename to htdocs/frontend/images/folder.png diff --git a/frontend/images/information.png b/htdocs/frontend/images/information.png similarity index 100% rename from frontend/images/information.png rename to htdocs/frontend/images/information.png diff --git a/frontend/images/link.png b/htdocs/frontend/images/link.png similarity index 100% rename from frontend/images/link.png rename to htdocs/frontend/images/link.png diff --git a/frontend/images/loading.gif b/htdocs/frontend/images/loading.gif similarity index 100% rename from frontend/images/loading.gif rename to htdocs/frontend/images/loading.gif diff --git a/frontend/images/save.png b/htdocs/frontend/images/save.png similarity index 100% rename from frontend/images/save.png rename to htdocs/frontend/images/save.png diff --git a/frontend/images/server.png b/htdocs/frontend/images/server.png similarity index 100% rename from frontend/images/server.png rename to htdocs/frontend/images/server.png diff --git a/frontend/images/shading.png b/htdocs/frontend/images/shading.png similarity index 100% rename from frontend/images/shading.png rename to htdocs/frontend/images/shading.png diff --git a/frontend/images/star.png b/htdocs/frontend/images/star.png similarity index 100% rename from frontend/images/star.png rename to htdocs/frontend/images/star.png diff --git a/frontend/images/table.png b/htdocs/frontend/images/table.png similarity index 100% rename from frontend/images/table.png rename to htdocs/frontend/images/table.png diff --git a/frontend/images/toggle-collapse-dark.png b/htdocs/frontend/images/toggle-collapse-dark.png similarity index 100% rename from frontend/images/toggle-collapse-dark.png rename to htdocs/frontend/images/toggle-collapse-dark.png diff --git a/frontend/images/toggle-collapse-light.png b/htdocs/frontend/images/toggle-collapse-light.png similarity index 100% rename from frontend/images/toggle-collapse-light.png rename to htdocs/frontend/images/toggle-collapse-light.png diff --git a/frontend/images/toggle-expand-dark.png b/htdocs/frontend/images/toggle-expand-dark.png similarity index 100% rename from frontend/images/toggle-expand-dark.png rename to htdocs/frontend/images/toggle-expand-dark.png diff --git a/frontend/images/toggle-expand-light.png b/htdocs/frontend/images/toggle-expand-light.png similarity index 100% rename from frontend/images/toggle-expand-light.png rename to htdocs/frontend/images/toggle-expand-light.png diff --git a/frontend/images/ui-bg_gloss-wave_35_red_500x100.png b/htdocs/frontend/images/ui-bg_gloss-wave_35_red_500x100.png similarity index 100% rename from frontend/images/ui-bg_gloss-wave_35_red_500x100.png rename to htdocs/frontend/images/ui-bg_gloss-wave_35_red_500x100.png diff --git a/frontend/images/wrench.png b/htdocs/frontend/images/wrench.png similarity index 100% rename from frontend/images/wrench.png rename to htdocs/frontend/images/wrench.png diff --git a/frontend/images/zoom.png b/htdocs/frontend/images/zoom.png similarity index 100% rename from frontend/images/zoom.png rename to htdocs/frontend/images/zoom.png diff --git a/frontend/images/zoom_in.png b/htdocs/frontend/images/zoom_in.png similarity index 100% rename from frontend/images/zoom_in.png rename to htdocs/frontend/images/zoom_in.png diff --git a/frontend/images/zoom_out.png b/htdocs/frontend/images/zoom_out.png similarity index 100% rename from frontend/images/zoom_out.png rename to htdocs/frontend/images/zoom_out.png diff --git a/frontend/index.html b/htdocs/frontend/index.html similarity index 100% rename from frontend/index.html rename to htdocs/frontend/index.html diff --git a/frontend/javascripts/entity.js b/htdocs/frontend/javascripts/entity.js similarity index 100% rename from frontend/javascripts/entity.js rename to htdocs/frontend/javascripts/entity.js diff --git a/frontend/javascripts/firebug-lite.js b/htdocs/frontend/javascripts/firebug-lite.js similarity index 100% rename from frontend/javascripts/firebug-lite.js rename to htdocs/frontend/javascripts/firebug-lite.js diff --git a/frontend/javascripts/flot/excanvas.js b/htdocs/frontend/javascripts/flot/excanvas.js similarity index 100% rename from frontend/javascripts/flot/excanvas.js rename to htdocs/frontend/javascripts/flot/excanvas.js diff --git a/frontend/javascripts/flot/excanvas.min.js b/htdocs/frontend/javascripts/flot/excanvas.min.js similarity index 100% rename from frontend/javascripts/flot/excanvas.min.js rename to htdocs/frontend/javascripts/flot/excanvas.min.js diff --git a/frontend/javascripts/flot/jquery.colorhelpers.js b/htdocs/frontend/javascripts/flot/jquery.colorhelpers.js similarity index 100% rename from frontend/javascripts/flot/jquery.colorhelpers.js rename to htdocs/frontend/javascripts/flot/jquery.colorhelpers.js diff --git a/frontend/javascripts/flot/jquery.flot.crosshair.js b/htdocs/frontend/javascripts/flot/jquery.flot.crosshair.js similarity index 100% rename from frontend/javascripts/flot/jquery.flot.crosshair.js rename to htdocs/frontend/javascripts/flot/jquery.flot.crosshair.js diff --git a/frontend/javascripts/flot/jquery.flot.fillbetween.js b/htdocs/frontend/javascripts/flot/jquery.flot.fillbetween.js similarity index 100% rename from frontend/javascripts/flot/jquery.flot.fillbetween.js rename to htdocs/frontend/javascripts/flot/jquery.flot.fillbetween.js diff --git a/frontend/javascripts/flot/jquery.flot.image.js b/htdocs/frontend/javascripts/flot/jquery.flot.image.js similarity index 100% rename from frontend/javascripts/flot/jquery.flot.image.js rename to htdocs/frontend/javascripts/flot/jquery.flot.image.js diff --git a/frontend/javascripts/flot/jquery.flot.js b/htdocs/frontend/javascripts/flot/jquery.flot.js similarity index 100% rename from frontend/javascripts/flot/jquery.flot.js rename to htdocs/frontend/javascripts/flot/jquery.flot.js diff --git a/frontend/javascripts/flot/jquery.flot.navigate.js b/htdocs/frontend/javascripts/flot/jquery.flot.navigate.js similarity index 100% rename from frontend/javascripts/flot/jquery.flot.navigate.js rename to htdocs/frontend/javascripts/flot/jquery.flot.navigate.js diff --git a/frontend/javascripts/flot/jquery.flot.pie.js b/htdocs/frontend/javascripts/flot/jquery.flot.pie.js similarity index 100% rename from frontend/javascripts/flot/jquery.flot.pie.js rename to htdocs/frontend/javascripts/flot/jquery.flot.pie.js diff --git a/frontend/javascripts/flot/jquery.flot.selection.js b/htdocs/frontend/javascripts/flot/jquery.flot.selection.js similarity index 100% rename from frontend/javascripts/flot/jquery.flot.selection.js rename to htdocs/frontend/javascripts/flot/jquery.flot.selection.js diff --git a/frontend/javascripts/flot/jquery.flot.stack.js b/htdocs/frontend/javascripts/flot/jquery.flot.stack.js similarity index 100% rename from frontend/javascripts/flot/jquery.flot.stack.js rename to htdocs/frontend/javascripts/flot/jquery.flot.stack.js diff --git a/frontend/javascripts/flot/jquery.flot.symbol.js b/htdocs/frontend/javascripts/flot/jquery.flot.symbol.js similarity index 100% rename from frontend/javascripts/flot/jquery.flot.symbol.js rename to htdocs/frontend/javascripts/flot/jquery.flot.symbol.js diff --git a/frontend/javascripts/flot/jquery.flot.threshold.js b/htdocs/frontend/javascripts/flot/jquery.flot.threshold.js similarity index 100% rename from frontend/javascripts/flot/jquery.flot.threshold.js rename to htdocs/frontend/javascripts/flot/jquery.flot.threshold.js diff --git a/frontend/javascripts/frontend.js b/htdocs/frontend/javascripts/frontend.js similarity index 100% rename from frontend/javascripts/frontend.js rename to htdocs/frontend/javascripts/frontend.js diff --git a/frontend/javascripts/helper.js b/htdocs/frontend/javascripts/helper.js similarity index 100% rename from frontend/javascripts/helper.js rename to htdocs/frontend/javascripts/helper.js diff --git a/frontend/javascripts/init.js b/htdocs/frontend/javascripts/init.js similarity index 100% rename from frontend/javascripts/init.js rename to htdocs/frontend/javascripts/init.js diff --git a/frontend/javascripts/jquery/jquery-1.4.2.min.js b/htdocs/frontend/javascripts/jquery/jquery-1.4.2.min.js similarity index 100% rename from frontend/javascripts/jquery/jquery-1.4.2.min.js rename to htdocs/frontend/javascripts/jquery/jquery-1.4.2.min.js diff --git a/frontend/javascripts/jquery/jquery-extensions.js b/htdocs/frontend/javascripts/jquery/jquery-extensions.js similarity index 100% rename from frontend/javascripts/jquery/jquery-extensions.js rename to htdocs/frontend/javascripts/jquery/jquery-extensions.js diff --git a/frontend/javascripts/jquery/jquery-treeTable.min.js b/htdocs/frontend/javascripts/jquery/jquery-treeTable.min.js similarity index 100% rename from frontend/javascripts/jquery/jquery-treeTable.min.js rename to htdocs/frontend/javascripts/jquery/jquery-treeTable.min.js diff --git a/frontend/javascripts/jquery/jquery-ui-1.8.6.min.js b/htdocs/frontend/javascripts/jquery/jquery-ui-1.8.6.min.js similarity index 100% rename from frontend/javascripts/jquery/jquery-ui-1.8.6.min.js rename to htdocs/frontend/javascripts/jquery/jquery-ui-1.8.6.min.js diff --git a/frontend/javascripts/json.js b/htdocs/frontend/javascripts/json.js similarity index 100% rename from frontend/javascripts/json.js rename to htdocs/frontend/javascripts/json.js diff --git a/frontend/javascripts/options.js b/htdocs/frontend/javascripts/options.js similarity index 100% rename from frontend/javascripts/options.js rename to htdocs/frontend/javascripts/options.js diff --git a/frontend/javascripts/property.js b/htdocs/frontend/javascripts/property.js similarity index 100% rename from frontend/javascripts/property.js rename to htdocs/frontend/javascripts/property.js diff --git a/frontend/javascripts/uuid.js b/htdocs/frontend/javascripts/uuid.js similarity index 100% rename from frontend/javascripts/uuid.js rename to htdocs/frontend/javascripts/uuid.js diff --git a/frontend/stylesheets/jquery.treeTable.css b/htdocs/frontend/stylesheets/jquery.treeTable.css similarity index 100% rename from frontend/stylesheets/jquery.treeTable.css rename to htdocs/frontend/stylesheets/jquery.treeTable.css diff --git a/frontend/stylesheets/jquery.ui.custom.css b/htdocs/frontend/stylesheets/jquery.ui.custom.css similarity index 100% rename from frontend/stylesheets/jquery.ui.custom.css rename to htdocs/frontend/stylesheets/jquery.ui.custom.css diff --git a/frontend/stylesheets/style.css b/htdocs/frontend/stylesheets/style.css similarity index 100% rename from frontend/stylesheets/style.css rename to htdocs/frontend/stylesheets/style.css diff --git a/frontend/stylesheets/ui-lightness/images/ui-bg_diagonals-thick_18_b81900_40x40.png b/htdocs/frontend/stylesheets/ui-lightness/images/ui-bg_diagonals-thick_18_b81900_40x40.png similarity index 100% rename from frontend/stylesheets/ui-lightness/images/ui-bg_diagonals-thick_18_b81900_40x40.png rename to htdocs/frontend/stylesheets/ui-lightness/images/ui-bg_diagonals-thick_18_b81900_40x40.png diff --git a/frontend/stylesheets/ui-lightness/images/ui-bg_diagonals-thick_20_666666_40x40.png b/htdocs/frontend/stylesheets/ui-lightness/images/ui-bg_diagonals-thick_20_666666_40x40.png similarity index 100% rename from frontend/stylesheets/ui-lightness/images/ui-bg_diagonals-thick_20_666666_40x40.png rename to htdocs/frontend/stylesheets/ui-lightness/images/ui-bg_diagonals-thick_20_666666_40x40.png diff --git a/frontend/stylesheets/ui-lightness/images/ui-bg_flat_10_000000_40x100.png b/htdocs/frontend/stylesheets/ui-lightness/images/ui-bg_flat_10_000000_40x100.png similarity index 100% rename from frontend/stylesheets/ui-lightness/images/ui-bg_flat_10_000000_40x100.png rename to htdocs/frontend/stylesheets/ui-lightness/images/ui-bg_flat_10_000000_40x100.png diff --git a/frontend/stylesheets/ui-lightness/images/ui-bg_glass_100_f6f6f6_1x400.png b/htdocs/frontend/stylesheets/ui-lightness/images/ui-bg_glass_100_f6f6f6_1x400.png similarity index 100% rename from frontend/stylesheets/ui-lightness/images/ui-bg_glass_100_f6f6f6_1x400.png rename to htdocs/frontend/stylesheets/ui-lightness/images/ui-bg_glass_100_f6f6f6_1x400.png diff --git a/frontend/stylesheets/ui-lightness/images/ui-bg_glass_100_fdf5ce_1x400.png b/htdocs/frontend/stylesheets/ui-lightness/images/ui-bg_glass_100_fdf5ce_1x400.png similarity index 100% rename from frontend/stylesheets/ui-lightness/images/ui-bg_glass_100_fdf5ce_1x400.png rename to htdocs/frontend/stylesheets/ui-lightness/images/ui-bg_glass_100_fdf5ce_1x400.png diff --git a/frontend/stylesheets/ui-lightness/images/ui-bg_glass_65_ffffff_1x400.png b/htdocs/frontend/stylesheets/ui-lightness/images/ui-bg_glass_65_ffffff_1x400.png similarity index 100% rename from frontend/stylesheets/ui-lightness/images/ui-bg_glass_65_ffffff_1x400.png rename to htdocs/frontend/stylesheets/ui-lightness/images/ui-bg_glass_65_ffffff_1x400.png diff --git a/frontend/stylesheets/ui-lightness/images/ui-bg_gloss-wave_35_f6a828_500x100.png b/htdocs/frontend/stylesheets/ui-lightness/images/ui-bg_gloss-wave_35_f6a828_500x100.png similarity index 100% rename from frontend/stylesheets/ui-lightness/images/ui-bg_gloss-wave_35_f6a828_500x100.png rename to htdocs/frontend/stylesheets/ui-lightness/images/ui-bg_gloss-wave_35_f6a828_500x100.png diff --git a/frontend/stylesheets/ui-lightness/images/ui-bg_highlight-soft_100_eeeeee_1x100.png b/htdocs/frontend/stylesheets/ui-lightness/images/ui-bg_highlight-soft_100_eeeeee_1x100.png similarity index 100% rename from frontend/stylesheets/ui-lightness/images/ui-bg_highlight-soft_100_eeeeee_1x100.png rename to htdocs/frontend/stylesheets/ui-lightness/images/ui-bg_highlight-soft_100_eeeeee_1x100.png diff --git a/frontend/stylesheets/ui-lightness/images/ui-bg_highlight-soft_75_ffe45c_1x100.png b/htdocs/frontend/stylesheets/ui-lightness/images/ui-bg_highlight-soft_75_ffe45c_1x100.png similarity index 100% rename from frontend/stylesheets/ui-lightness/images/ui-bg_highlight-soft_75_ffe45c_1x100.png rename to htdocs/frontend/stylesheets/ui-lightness/images/ui-bg_highlight-soft_75_ffe45c_1x100.png diff --git a/frontend/stylesheets/ui-lightness/images/ui-icons_222222_256x240.png b/htdocs/frontend/stylesheets/ui-lightness/images/ui-icons_222222_256x240.png similarity index 100% rename from frontend/stylesheets/ui-lightness/images/ui-icons_222222_256x240.png rename to htdocs/frontend/stylesheets/ui-lightness/images/ui-icons_222222_256x240.png diff --git a/frontend/stylesheets/ui-lightness/images/ui-icons_228ef1_256x240.png b/htdocs/frontend/stylesheets/ui-lightness/images/ui-icons_228ef1_256x240.png similarity index 100% rename from frontend/stylesheets/ui-lightness/images/ui-icons_228ef1_256x240.png rename to htdocs/frontend/stylesheets/ui-lightness/images/ui-icons_228ef1_256x240.png diff --git a/frontend/stylesheets/ui-lightness/images/ui-icons_ef8c08_256x240.png b/htdocs/frontend/stylesheets/ui-lightness/images/ui-icons_ef8c08_256x240.png similarity index 100% rename from frontend/stylesheets/ui-lightness/images/ui-icons_ef8c08_256x240.png rename to htdocs/frontend/stylesheets/ui-lightness/images/ui-icons_ef8c08_256x240.png diff --git a/frontend/stylesheets/ui-lightness/images/ui-icons_ffd27a_256x240.png b/htdocs/frontend/stylesheets/ui-lightness/images/ui-icons_ffd27a_256x240.png similarity index 100% rename from frontend/stylesheets/ui-lightness/images/ui-icons_ffd27a_256x240.png rename to htdocs/frontend/stylesheets/ui-lightness/images/ui-icons_ffd27a_256x240.png diff --git a/frontend/stylesheets/ui-lightness/images/ui-icons_ffffff_256x240.png b/htdocs/frontend/stylesheets/ui-lightness/images/ui-icons_ffffff_256x240.png similarity index 100% rename from frontend/stylesheets/ui-lightness/images/ui-icons_ffffff_256x240.png rename to htdocs/frontend/stylesheets/ui-lightness/images/ui-icons_ffffff_256x240.png diff --git a/frontend/stylesheets/ui-lightness/jquery-ui-1.8.6.css b/htdocs/frontend/stylesheets/ui-lightness/jquery-ui-1.8.6.css similarity index 100% rename from frontend/stylesheets/ui-lightness/jquery-ui-1.8.6.css rename to htdocs/frontend/stylesheets/ui-lightness/jquery-ui-1.8.6.css diff --git a/index.php b/htdocs/index.php similarity index 95% rename from index.php rename to htdocs/index.php index 38123ec..02d6e24 100644 --- a/index.php +++ b/htdocs/index.php @@ -24,6 +24,8 @@ * along with volkszaehler.org. If not, see . */ +// TODO check for requirements (Javascript etc) + header('Location: ' . ((isset($_SERVER['HTTPS'])) ? 'https://' : 'http://') . $_SERVER['HTTP_HOST'] . dirname($_SERVER['SCRIPT_NAME']) . '/frontend/'); ?> diff --git a/backend/lib/Controller/AggregatorController.php b/lib/Controller/AggregatorController.php similarity index 100% rename from backend/lib/Controller/AggregatorController.php rename to lib/Controller/AggregatorController.php diff --git a/backend/lib/Controller/CapabilitiesController.php b/lib/Controller/CapabilitiesController.php similarity index 100% rename from backend/lib/Controller/CapabilitiesController.php rename to lib/Controller/CapabilitiesController.php diff --git a/backend/lib/Controller/ChannelController.php b/lib/Controller/ChannelController.php similarity index 100% rename from backend/lib/Controller/ChannelController.php rename to lib/Controller/ChannelController.php diff --git a/backend/lib/Controller/Controller.php b/lib/Controller/Controller.php similarity index 100% rename from backend/lib/Controller/Controller.php rename to lib/Controller/Controller.php diff --git a/backend/lib/Controller/DataController.php b/lib/Controller/DataController.php similarity index 100% rename from backend/lib/Controller/DataController.php rename to lib/Controller/DataController.php diff --git a/backend/lib/Controller/EntityController.php b/lib/Controller/EntityController.php similarity index 100% rename from backend/lib/Controller/EntityController.php rename to lib/Controller/EntityController.php diff --git a/backend/lib/Definition/Definition.php b/lib/Definition/Definition.php similarity index 97% rename from backend/lib/Definition/Definition.php rename to lib/Definition/Definition.php index e435846..8ba15f1 100644 --- a/backend/lib/Definition/Definition.php +++ b/lib/Definition/Definition.php @@ -105,7 +105,7 @@ abstract class Definition { } public static function getJSON() { - return Util\JSON::decode(file_get_contents(VZ_BACKEND_DIR . static::FILE)); + return Util\JSON::decode(file_get_contents(VZ_DIR . static::FILE)); } /* diff --git a/backend/lib/Definition/EntityDefinition.json b/lib/Definition/EntityDefinition.json similarity index 100% rename from backend/lib/Definition/EntityDefinition.json rename to lib/Definition/EntityDefinition.json diff --git a/backend/lib/Definition/EntityDefinition.php b/lib/Definition/EntityDefinition.php similarity index 100% rename from backend/lib/Definition/EntityDefinition.php rename to lib/Definition/EntityDefinition.php diff --git a/backend/lib/Definition/PropertyDefinition.json b/lib/Definition/PropertyDefinition.json similarity index 100% rename from backend/lib/Definition/PropertyDefinition.json rename to lib/Definition/PropertyDefinition.json diff --git a/backend/lib/Definition/PropertyDefinition.php b/lib/Definition/PropertyDefinition.php similarity index 100% rename from backend/lib/Definition/PropertyDefinition.php rename to lib/Definition/PropertyDefinition.php diff --git a/backend/lib/Interpreter/AggregatorInterpreter.php b/lib/Interpreter/AggregatorInterpreter.php similarity index 100% rename from backend/lib/Interpreter/AggregatorInterpreter.php rename to lib/Interpreter/AggregatorInterpreter.php diff --git a/backend/lib/Interpreter/Interpreter.php b/lib/Interpreter/Interpreter.php similarity index 100% rename from backend/lib/Interpreter/Interpreter.php rename to lib/Interpreter/Interpreter.php diff --git a/backend/lib/Interpreter/InterpreterInterface.php b/lib/Interpreter/InterpreterInterface.php similarity index 100% rename from backend/lib/Interpreter/InterpreterInterface.php rename to lib/Interpreter/InterpreterInterface.php diff --git a/backend/lib/Interpreter/Iterator/DataAggregationIterator.php b/lib/Interpreter/Iterator/DataAggregationIterator.php similarity index 100% rename from backend/lib/Interpreter/Iterator/DataAggregationIterator.php rename to lib/Interpreter/Iterator/DataAggregationIterator.php diff --git a/backend/lib/Interpreter/Iterator/DataIterator.php b/lib/Interpreter/Iterator/DataIterator.php similarity index 100% rename from backend/lib/Interpreter/Iterator/DataIterator.php rename to lib/Interpreter/Iterator/DataIterator.php diff --git a/backend/lib/Interpreter/MeterInterpreter.php b/lib/Interpreter/MeterInterpreter.php similarity index 100% rename from backend/lib/Interpreter/MeterInterpreter.php rename to lib/Interpreter/MeterInterpreter.php diff --git a/backend/lib/Interpreter/SensorInterpreter.php b/lib/Interpreter/SensorInterpreter.php similarity index 100% rename from backend/lib/Interpreter/SensorInterpreter.php rename to lib/Interpreter/SensorInterpreter.php diff --git a/backend/lib/Model/Aggregator.php b/lib/Model/Aggregator.php similarity index 100% rename from backend/lib/Model/Aggregator.php rename to lib/Model/Aggregator.php diff --git a/backend/lib/Model/Channel.php b/lib/Model/Channel.php similarity index 100% rename from backend/lib/Model/Channel.php rename to lib/Model/Channel.php diff --git a/backend/lib/Model/Data.php b/lib/Model/Data.php similarity index 100% rename from backend/lib/Model/Data.php rename to lib/Model/Data.php diff --git a/backend/lib/Model/Entity.php b/lib/Model/Entity.php similarity index 100% rename from backend/lib/Model/Entity.php rename to lib/Model/Entity.php diff --git a/backend/lib/Model/Property.php b/lib/Model/Property.php similarity index 100% rename from backend/lib/Model/Property.php rename to lib/Model/Property.php diff --git a/backend/lib/Model/Proxy/VolkszaehlerModelAggregatorProxy.php b/lib/Model/Proxy/VolkszaehlerModelAggregatorProxy.php similarity index 100% rename from backend/lib/Model/Proxy/VolkszaehlerModelAggregatorProxy.php rename to lib/Model/Proxy/VolkszaehlerModelAggregatorProxy.php diff --git a/backend/lib/Model/Proxy/VolkszaehlerModelChannelProxy.php b/lib/Model/Proxy/VolkszaehlerModelChannelProxy.php similarity index 100% rename from backend/lib/Model/Proxy/VolkszaehlerModelChannelProxy.php rename to lib/Model/Proxy/VolkszaehlerModelChannelProxy.php diff --git a/backend/lib/Model/Proxy/VolkszaehlerModelDataProxy.php b/lib/Model/Proxy/VolkszaehlerModelDataProxy.php similarity index 100% rename from backend/lib/Model/Proxy/VolkszaehlerModelDataProxy.php rename to lib/Model/Proxy/VolkszaehlerModelDataProxy.php diff --git a/backend/lib/Model/Proxy/VolkszaehlerModelEntityProxy.php b/lib/Model/Proxy/VolkszaehlerModelEntityProxy.php similarity index 100% rename from backend/lib/Model/Proxy/VolkszaehlerModelEntityProxy.php rename to lib/Model/Proxy/VolkszaehlerModelEntityProxy.php diff --git a/backend/lib/Model/Proxy/VolkszaehlerModelPropertyProxy.php b/lib/Model/Proxy/VolkszaehlerModelPropertyProxy.php similarity index 100% rename from backend/lib/Model/Proxy/VolkszaehlerModelPropertyProxy.php rename to lib/Model/Proxy/VolkszaehlerModelPropertyProxy.php diff --git a/backend/lib/Router.php b/lib/Router.php similarity index 81% rename from backend/lib/Router.php rename to lib/Router.php index 28f8407..8071f12 100644 --- a/backend/lib/Router.php +++ b/lib/Router.php @@ -114,13 +114,17 @@ class Router { // initialize view $this->pathInfo = self::getPathInfo(); - $this->format = self::getFormat($this->pathInfo); - $this->operation = self::getOperation($request); + $this->format = pathinfo($this->pathInfo, PATHINFO_EXTENSION); + + Util\Debug::log('env vars', $_SERVER); - if (empty(self::$viewMapping[$this->format])) { + if (!array_key_exists($this->format, self::$viewMapping)) { $this->view = new View\JSON($request, $response); // fallback view - if (empty($this->format)) { + if (empty($this->pathInfo)) { + throw new \Exception('Missing or invalid PATH_INFO'); + } + elseif (empty($this->format)) { throw new \Exception('Missing format'); } else { @@ -138,22 +142,27 @@ class Router { * Example: http://sub.domain.local/vz/backend/channel/550e8400-e29b-11d4-a716-446655440000/data.json?operation=edit&title=New Title */ public function run() { - $pathInfo = substr($this->pathInfo, 1, strrpos($this->pathInfo, '.') -1); // remove leading slash and format - $pathInfo = explode('/', $pathInfo); // split into path segments - - if (array_key_exists($pathInfo[0], self::$controllerMapping)) { - $class = self::$controllerMapping[$pathInfo[0]]; - $controller = new $class($this->view, $this->em); - - if (isset($pathInfo[1])) { - $result = $controller->run($this->operation, array_slice($pathInfo, 1)); + $operation = self::getOperation($this->view->request); + $context = substr($this->pathInfo, 1, strrpos($this->pathInfo, '.') -1); // remove leading slash and format + $context = explode('/', $context); // split into path segments + + if (!array_key_exists($context[0], self::$controllerMapping)) { + if (empty($context[0])) { + throw new \Exception('Missing context'); } else { - $result = $controller->run($this->operation); + throw new \Exception('Unknown context: ' . $context[0]); } } + + $class = self::$controllerMapping[$context[0]]; + $controller = new $class($this->view, $this->em); + + if (isset($pathInfo[1])) { + $result = $controller->run($operation, array_slice($context, 1)); + } else { - throw new \Exception('Unknown context: ' . $pathInfo[0]); + $result = $controller->run($operation); } $this->view->add($result); @@ -163,16 +172,9 @@ class Router { if ($operation = $request->getParameter('operation')) { return $operation; } - elseif (isset(self::$operationMapping[strtolower($request->getMethod())])) { + else { return self::$operationMapping[strtolower($request->getMethod())]; } - else { - throw new \Exception('Can\'t determine operation'); - } - } - - protected static function getFormat($pathInfo) { - return pathinfo($pathInfo, PATHINFO_EXTENSION); } /** @@ -190,9 +192,6 @@ class Router { elseif (strlen($_SERVER['PHP_SELF']) > strlen($_SERVER['SCRIPT_NAME'])) { return substr($_SERVER['PHP_SELF'], strlen($_SERVER['SCRIPT_NAME'])); } - else { - throw new \Exception('Can\'t get PATH_INFO'); - } } /** @@ -210,10 +209,10 @@ class Router { $config->setQueryCacheImpl($cache); } - $driverImpl = $config->newDefaultAnnotationDriver(VZ_BACKEND_DIR . '/lib/Model'); + $driverImpl = $config->newDefaultAnnotationDriver(VZ_DIR . '/lib/Model'); $config->setMetadataDriverImpl($driverImpl); - $config->setProxyDir(VZ_BACKEND_DIR . '/lib/Model/Proxy'); + $config->setProxyDir(VZ_DIR . '/lib/Model/Proxy'); $config->setProxyNamespace('Volkszaehler\Model\Proxy'); $config->setAutoGenerateProxyClasses(Util\Configuration::read('devmode')); diff --git a/backend/lib/Util/ClassLoader.php b/lib/Util/ClassLoader.php similarity index 100% rename from backend/lib/Util/ClassLoader.php rename to lib/Util/ClassLoader.php diff --git a/backend/lib/Util/Configuration.php b/lib/Util/Configuration.php similarity index 100% rename from backend/lib/Util/Configuration.php rename to lib/Util/Configuration.php diff --git a/backend/lib/Util/Debug.php b/lib/Util/Debug.php similarity index 100% rename from backend/lib/Util/Debug.php rename to lib/Util/Debug.php diff --git a/backend/lib/Util/JSON.php b/lib/Util/JSON.php similarity index 100% rename from backend/lib/Util/JSON.php rename to lib/Util/JSON.php diff --git a/backend/lib/Util/Random.php b/lib/Util/Random.php similarity index 100% rename from backend/lib/Util/Random.php rename to lib/Util/Random.php diff --git a/backend/lib/Util/UUID.php b/lib/Util/UUID.php similarity index 100% rename from backend/lib/Util/UUID.php rename to lib/Util/UUID.php diff --git a/backend/lib/View/CSV.php b/lib/View/CSV.php similarity index 100% rename from backend/lib/View/CSV.php rename to lib/View/CSV.php diff --git a/backend/lib/View/HTTP/Request.php b/lib/View/HTTP/Request.php similarity index 94% rename from backend/lib/View/HTTP/Request.php rename to lib/View/HTTP/Request.php index c9dbdf6..96fd9f5 100644 --- a/backend/lib/View/HTTP/Request.php +++ b/lib/View/HTTP/Request.php @@ -50,10 +50,10 @@ class Request { $this->method = $_SERVER['REQUEST_METHOD']; $this->parameters= array( - 'get' => $_GET, - 'post' => $_POST, - 'cookies' => $_COOKIE, - 'files' => $_FILES + 'get' => $_GET, + 'post' => $_POST, + 'cookies' => $_COOKIE, + 'files' => $_FILES ); unset($_GET, $_POST, $_COOKIE, $_FILES); @@ -75,8 +75,9 @@ class Request { } /** - * setter & getter + * Setter & getter */ + public function getHeader($header) { return $this->headers[$header]; } public function getMethod() { return $this->method; } public function getParameter($name, $method = 'get') { return (isset($this->parameters[$method][$name])) ? $this->parameters[$method][$name] : NULL; } diff --git a/backend/lib/View/HTTP/Response.php b/lib/View/HTTP/Response.php similarity index 100% rename from backend/lib/View/HTTP/Response.php rename to lib/View/HTTP/Response.php diff --git a/backend/lib/View/JSON.php b/lib/View/JSON.php similarity index 100% rename from backend/lib/View/JSON.php rename to lib/View/JSON.php diff --git a/backend/lib/View/JpGraph.php b/lib/View/JpGraph.php similarity index 96% rename from backend/lib/View/JpGraph.php rename to lib/View/JpGraph.php index 8f61e69..63b595a 100644 --- a/backend/lib/View/JpGraph.php +++ b/lib/View/JpGraph.php @@ -27,9 +27,9 @@ use Volkszaehler\Interpreter; use Volkszaehler\Model; use Volkszaehler\Util; -require_once VZ_BACKEND_DIR . '/lib/vendor/JpGraph/jpgraph.php'; -require_once VZ_BACKEND_DIR . '/lib/vendor/JpGraph/jpgraph_scatter.php'; -require_once VZ_BACKEND_DIR . '/lib/vendor/JpGraph/jpgraph_date.php'; +require_once VZ_DIR . '/lib/vendor/JpGraph/jpgraph.php'; +require_once VZ_DIR . '/lib/vendor/JpGraph/jpgraph_scatter.php'; +require_once VZ_DIR . '/lib/vendor/JpGraph/jpgraph_date.php'; /** * Plotting and graphing of data on the server side diff --git a/backend/lib/View/PlainText.php b/lib/View/PlainText.php similarity index 100% rename from backend/lib/View/PlainText.php rename to lib/View/PlainText.php diff --git a/backend/lib/View/View.php b/lib/View/View.php similarity index 99% rename from backend/lib/View/View.php rename to lib/View/View.php index cc81114..5003a03 100644 --- a/backend/lib/View/View.php +++ b/lib/View/View.php @@ -85,7 +85,6 @@ abstract class View { */ final public function exceptionHandler(\Exception $exception) { $this->add($exception); - echo $exception; $code = ($exception->getCode() == 0 || !HTTP\Response::getCodeDescription($exception->getCode())) ? 400 : $exception->getCode(); $this->response->setCode($code); diff --git a/backend/lib/View/XML.php b/lib/View/XML.php similarity index 100% rename from backend/lib/View/XML.php rename to lib/View/XML.php diff --git a/backend/lib/vendor/README b/lib/vendor/README similarity index 100% rename from backend/lib/vendor/README rename to lib/vendor/README diff --git a/controller/README b/misc/controller/README similarity index 100% rename from controller/README rename to misc/controller/README diff --git a/controller/bash/log_onewire.sh b/misc/controller/bash/log_onewire.sh similarity index 100% rename from controller/bash/log_onewire.sh rename to misc/controller/bash/log_onewire.sh diff --git a/controller/current_cost/README b/misc/controller/current_cost/README similarity index 100% rename from controller/current_cost/README rename to misc/controller/current_cost/README diff --git a/controller/current_cost/create-rrd.sh b/misc/controller/current_cost/create-rrd.sh similarity index 100% rename from controller/current_cost/create-rrd.sh rename to misc/controller/current_cost/create-rrd.sh diff --git a/controller/current_cost/crontab.example b/misc/controller/current_cost/crontab.example similarity index 100% rename from controller/current_cost/crontab.example rename to misc/controller/current_cost/crontab.example diff --git a/controller/current_cost/doall.sh b/misc/controller/current_cost/doall.sh similarity index 100% rename from controller/current_cost/doall.sh rename to misc/controller/current_cost/doall.sh diff --git a/controller/current_cost/fetchdata.pl b/misc/controller/current_cost/fetchdata.pl similarity index 100% rename from controller/current_cost/fetchdata.pl rename to misc/controller/current_cost/fetchdata.pl diff --git a/controller/current_cost/makegraphs.sh b/misc/controller/current_cost/makegraphs.sh similarity index 100% rename from controller/current_cost/makegraphs.sh rename to misc/controller/current_cost/makegraphs.sh diff --git a/controller/php/channel.php b/misc/controller/php/channel.php similarity index 100% rename from controller/php/channel.php rename to misc/controller/php/channel.php diff --git a/controller/php/log.php b/misc/controller/php/log.php similarity index 100% rename from controller/php/log.php rename to misc/controller/php/log.php diff --git a/CHANGELOG b/misc/docs/CHANGELOG similarity index 100% rename from CHANGELOG rename to misc/docs/CHANGELOG diff --git a/COPYING b/misc/docs/COPYING similarity index 100% rename from COPYING rename to misc/docs/COPYING diff --git a/INSTALL b/misc/docs/INSTALL similarity index 100% rename from INSTALL rename to misc/docs/INSTALL diff --git a/share/graphics/backend.dia b/misc/graphics/backend.dia similarity index 100% rename from share/graphics/backend.dia rename to misc/graphics/backend.dia diff --git a/share/graphics/backend.png b/misc/graphics/backend.png similarity index 100% rename from share/graphics/backend.png rename to misc/graphics/backend.png diff --git a/share/graphics/logo.png b/misc/graphics/logo.png similarity index 100% rename from share/graphics/logo.png rename to misc/graphics/logo.png diff --git a/share/graphics/logo.svg b/misc/graphics/logo.svg similarity index 100% rename from share/graphics/logo.svg rename to misc/graphics/logo.svg diff --git a/share/graphics/overview.png b/misc/graphics/overview.png similarity index 100% rename from share/graphics/overview.png rename to misc/graphics/overview.png diff --git a/share/graphics/overview.svg b/misc/graphics/overview.svg similarity index 100% rename from share/graphics/overview.svg rename to misc/graphics/overview.svg diff --git a/share/sql/README b/misc/sql/README similarity index 100% rename from share/sql/README rename to misc/sql/README diff --git a/share/sql/demo/README b/misc/sql/demo/README similarity index 100% rename from share/sql/demo/README rename to misc/sql/demo/README diff --git a/share/sql/demo/data-demoset1.sql b/misc/sql/demo/data-demoset1.sql similarity index 100% rename from share/sql/demo/data-demoset1.sql rename to misc/sql/demo/data-demoset1.sql diff --git a/share/sql/demo/entities.sql b/misc/sql/demo/entities.sql similarity index 100% rename from share/sql/demo/entities.sql rename to misc/sql/demo/entities.sql diff --git a/share/sql/demo/properties.sql b/misc/sql/demo/properties.sql similarity index 100% rename from share/sql/demo/properties.sql rename to misc/sql/demo/properties.sql diff --git a/share/tests/ajax.php b/misc/tests/ajax.php similarity index 100% rename from share/tests/ajax.php rename to misc/tests/ajax.php diff --git a/share/tests/configuration.php b/misc/tests/configuration.php similarity index 100% rename from share/tests/configuration.php rename to misc/tests/configuration.php diff --git a/share/tests/json.php b/misc/tests/json.php similarity index 100% rename from share/tests/json.php rename to misc/tests/json.php diff --git a/share/tests/pdobench.php b/misc/tests/pdobench.php similarity index 100% rename from share/tests/pdobench.php rename to misc/tests/pdobench.php diff --git a/share/tests/properties.php b/misc/tests/properties.php similarity index 100% rename from share/tests/properties.php rename to misc/tests/properties.php diff --git a/share/tests/random.php b/misc/tests/random.php similarity index 100% rename from share/tests/random.php rename to misc/tests/random.php diff --git a/share/tests/test.conf.php b/misc/tests/test.conf.php similarity index 100% rename from share/tests/test.conf.php rename to misc/tests/test.conf.php diff --git a/share/tools/check.php b/misc/tools/check.php similarity index 100% rename from share/tools/check.php rename to misc/tools/check.php diff --git a/share/tools/generate_docs.php b/misc/tools/generate_docs.php similarity index 100% rename from share/tools/generate_docs.php rename to misc/tools/generate_docs.php diff --git a/share/tools/import_flo.php b/misc/tools/import_flo.php similarity index 100% rename from share/tools/import_flo.php rename to misc/tools/import_flo.php diff --git a/share/tools/import_justin.php b/misc/tools/import_justin.php similarity index 100% rename from share/tools/import_justin.php rename to misc/tools/import_justin.php diff --git a/share/tools/install.php b/misc/tools/install.php similarity index 100% rename from share/tools/install.php rename to misc/tools/install.php diff --git a/share/tools/install.sh b/misc/tools/install.sh similarity index 100% rename from share/tools/install.sh rename to misc/tools/install.sh