diff --git a/.gitignore b/.gitignore index 3f7ae9c..d4e16ce 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,4 @@ -ground/config.php +config.php public/img/avatars/*.jpg diff --git a/ground/app.php b/app.php similarity index 97% rename from ground/app.php rename to app.php index 0767131..96a4a55 100644 --- a/ground/app.php +++ b/app.php @@ -6,7 +6,7 @@ function __autoload($className) $loaded = false; foreach ($dirs as $dir) { - $fileName = dirname(__FILE__) . '/../ground/' . $dir . '/' . $className . '.php'; + $fileName = App::getBasedir() . $dir . '/' . $className . '.php'; if (file_exists($fileName)) { $loaded = (bool) include $fileName; @@ -152,13 +152,14 @@ class App } /** - * Возвращает директорию фреймворка /full/path/ground/ + * Возвращает директорию фреймворка /full/path/ * @return type */ public static function getBasedir() { - if (!self::$basedir) + if (!self::$basedir) { self::$basedir = dirname(__FILE__) . '/'; + } return self::$basedir; } @@ -216,7 +217,7 @@ class App public static function log($logName, $value) { $fileName = App::getBasedir() . - '../logs/' . + 'logs/' . $logName . '.log'; return file_put_contents( diff --git a/ground/classes/Controller.php b/classes/Controller.php similarity index 100% rename from ground/classes/Controller.php rename to classes/Controller.php diff --git a/ground/classes/Coord.php b/classes/Coord.php similarity index 100% rename from ground/classes/Coord.php rename to classes/Coord.php diff --git a/ground/classes/Helper.php b/classes/Helper.php similarity index 100% rename from ground/classes/Helper.php rename to classes/Helper.php diff --git a/ground/classes/Image.php b/classes/Image.php similarity index 97% rename from ground/classes/Image.php rename to classes/Image.php index 03a1a83..552c827 100644 --- a/ground/classes/Image.php +++ b/classes/Image.php @@ -32,8 +32,7 @@ class Image public static function createAllSizes($imgName, $noWatermark = false, $folder = '') { $sizes = App::getConfig('images'); - $pathInfo = pathinfo($_SERVER['SCRIPT_FILENAME']); - $uploaddir = $pathInfo['dirname'] . '/photos/' . $folder; + $uploaddir = App::getBasedir() . 'public/photos/' . $folder; $watermarkDir = App::getBasedir() . 'watermarks/'; foreach ($sizes as $dir => $size) { diff --git a/ground/classes/Markdown.php b/classes/Markdown.php similarity index 100% rename from ground/classes/Markdown.php rename to classes/Markdown.php diff --git a/ground/classes/Model.php b/classes/Model.php similarity index 100% rename from ground/classes/Model.php rename to classes/Model.php diff --git a/ground/config_template.php b/config_template.php similarity index 100% rename from ground/config_template.php rename to config_template.php diff --git a/ground/controllers/ArticleController.php b/controllers/ArticleController.php similarity index 100% rename from ground/controllers/ArticleController.php rename to controllers/ArticleController.php diff --git a/ground/controllers/ArticlesController.php b/controllers/ArticlesController.php similarity index 100% rename from ground/controllers/ArticlesController.php rename to controllers/ArticlesController.php diff --git a/ground/controllers/CommentsController.php b/controllers/CommentsController.php similarity index 100% rename from ground/controllers/CommentsController.php rename to controllers/CommentsController.php diff --git a/ground/controllers/FeedController.php b/controllers/FeedController.php similarity index 100% rename from ground/controllers/FeedController.php rename to controllers/FeedController.php diff --git a/ground/controllers/GoController.php b/controllers/GoController.php similarity index 100% rename from ground/controllers/GoController.php rename to controllers/GoController.php diff --git a/ground/controllers/ImagesController.php b/controllers/ImagesController.php similarity index 84% rename from ground/controllers/ImagesController.php rename to controllers/ImagesController.php index 28671d9..a0d1d7e 100644 --- a/ground/controllers/ImagesController.php +++ b/controllers/ImagesController.php @@ -32,13 +32,13 @@ class ImagesController extends Controller if ($img) { - $photo = $photo = App::getBasedir() . '../public/' . 'photos/' . $img->name; + $photo = $photo = App::getBasedir() . 'public/' . 'photos/' . $img->name; } else { - $photo = $photo = App::getBasedir() . '../public/' . 'img/noPhoto.png'; + $photo = $photo = App::getBasedir() . 'public/' . 'img/noPhoto.png'; } if (!file_exists($photo)) { - $photo = $photo = App::getBasedir() . '../public/' . 'img/noPhoto.png'; + $photo = $photo = App::getBasedir() . 'public/' . 'img/noPhoto.png'; } Image::createCustomSize($photo, $width, $height); @@ -49,7 +49,7 @@ class ImagesController extends Controller { if (isset($_FILES) && !empty($_FILES) && App::$user) { $userId = App::$user->id; - $uploaddir = App::getBasedir() . '../public/photos/articles/'; + $uploaddir = App::getBasedir() . 'public/photos/articles/'; $fileName = (string)$_FILES['photo']['name']; $temp = pathinfo($fileName); $extension = strtolower($temp['extension']); diff --git a/ground/controllers/IndexController.php b/controllers/IndexController.php similarity index 98% rename from ground/controllers/IndexController.php rename to controllers/IndexController.php index fb8b38b..377c561 100644 --- a/ground/controllers/IndexController.php +++ b/controllers/IndexController.php @@ -135,7 +135,7 @@ class IndexController extends Controller } } - $target = App::getBasedir().'../public/img/avatars/'.$user->id.'.jpg'; + $target = App::getBasedir().'public/img/avatars/'.$user->id.'.jpg'; Image::createAvatar($uLoginUser['photo_big'], $target); App::userLogin($user); diff --git a/ground/controllers/JsonController.php b/controllers/JsonController.php similarity index 99% rename from ground/controllers/JsonController.php rename to controllers/JsonController.php index fa1949c..3daa16c 100644 --- a/ground/controllers/JsonController.php +++ b/controllers/JsonController.php @@ -139,7 +139,7 @@ class JsonController extends Controller $photos = $images = array(); if (empty($errors) && !App::$request['ajax'] && isset($_POST['id']) && (int) $_POST['id']) { $id = (int) $_POST['id']; - $uploaddir = App::getBasedir().'../public/photos/'; + $uploaddir = App::getBasedir().'public/photos/'; if (isset($_FILES) && !empty($_FILES)) { foreach ($_FILES['photos']['name'] as $key => $fileName) { diff --git a/ground/controllers/PageController.php b/controllers/PageController.php similarity index 100% rename from ground/controllers/PageController.php rename to controllers/PageController.php diff --git a/ground/controllers/PointController.php b/controllers/PointController.php similarity index 100% rename from ground/controllers/PointController.php rename to controllers/PointController.php diff --git a/ground/controllers/UserController.php b/controllers/UserController.php similarity index 100% rename from ground/controllers/UserController.php rename to controllers/UserController.php diff --git a/ground/models/Article.php b/models/Article.php similarity index 100% rename from ground/models/Article.php rename to models/Article.php diff --git a/ground/models/ArticlePhotos.php b/models/ArticlePhotos.php similarity index 100% rename from ground/models/ArticlePhotos.php rename to models/ArticlePhotos.php diff --git a/ground/models/ArticlePoints.php b/models/ArticlePoints.php similarity index 100% rename from ground/models/ArticlePoints.php rename to models/ArticlePoints.php diff --git a/ground/models/Category.php b/models/Category.php similarity index 100% rename from ground/models/Category.php rename to models/Category.php diff --git a/ground/models/Comment.php b/models/Comment.php similarity index 100% rename from ground/models/Comment.php rename to models/Comment.php diff --git a/ground/models/ExtraParams.php b/models/ExtraParams.php similarity index 100% rename from ground/models/ExtraParams.php rename to models/ExtraParams.php diff --git a/ground/models/Favorite.php b/models/Favorite.php similarity index 100% rename from ground/models/Favorite.php rename to models/Favorite.php diff --git a/ground/models/GoAway.php b/models/GoAway.php similarity index 100% rename from ground/models/GoAway.php rename to models/GoAway.php diff --git a/ground/models/Goods.php b/models/Goods.php similarity index 100% rename from ground/models/Goods.php rename to models/Goods.php diff --git a/ground/models/Like.php b/models/Like.php similarity index 100% rename from ground/models/Like.php rename to models/Like.php diff --git a/ground/models/News.php b/models/News.php similarity index 100% rename from ground/models/News.php rename to models/News.php diff --git a/ground/models/Notifications.php b/models/Notifications.php similarity index 100% rename from ground/models/Notifications.php rename to models/Notifications.php diff --git a/ground/models/Photo.php b/models/Photo.php similarity index 100% rename from ground/models/Photo.php rename to models/Photo.php diff --git a/ground/models/PhotoLinks.php b/models/PhotoLinks.php similarity index 100% rename from ground/models/PhotoLinks.php rename to models/PhotoLinks.php diff --git a/ground/models/Point.php b/models/Point.php similarity index 100% rename from ground/models/Point.php rename to models/Point.php diff --git a/ground/models/Route.php b/models/Route.php similarity index 100% rename from ground/models/Route.php rename to models/Route.php diff --git a/ground/models/User.php b/models/User.php similarity index 100% rename from ground/models/User.php rename to models/User.php diff --git a/public/index.php b/public/index.php index 3a7f81a..960c5e0 100644 --- a/public/index.php +++ b/public/index.php @@ -7,5 +7,5 @@ ini_set('session.gc_maxlifetime', 86400); ini_set('session.cookie_lifetime', 86400); - include_once dirname(__FILE__) . '/../ground/app.php'; + include_once dirname(__FILE__) . '/../app.php'; App::run('config.php'); \ No newline at end of file diff --git a/update.sh b/update.sh index 570cbe9..e7091f4 100755 --- a/update.sh +++ b/update.sh @@ -1,2 +1,2 @@ git pull -git rev-parse HEAD | cut -c-5 > ground/version +git rev-parse HEAD | cut -c-5 > version diff --git a/ground/version b/version similarity index 100% rename from ground/version rename to version diff --git a/ground/views/article.php b/views/article.php similarity index 100% rename from ground/views/article.php rename to views/article.php diff --git a/ground/views/articles/edit.php b/views/articles/edit.php similarity index 100% rename from ground/views/articles/edit.php rename to views/articles/edit.php diff --git a/ground/views/articles/index.php b/views/articles/index.php similarity index 100% rename from ground/views/articles/index.php rename to views/articles/index.php diff --git a/ground/views/comments/all.php b/views/comments/all.php similarity index 100% rename from ground/views/comments/all.php rename to views/comments/all.php diff --git a/ground/views/comments/comment.php b/views/comments/comment.php similarity index 100% rename from ground/views/comments/comment.php rename to views/comments/comment.php diff --git a/ground/views/comments/deny.php b/views/comments/deny.php similarity index 100% rename from ground/views/comments/deny.php rename to views/comments/deny.php diff --git a/ground/views/comments/form.php b/views/comments/form.php similarity index 100% rename from ground/views/comments/form.php rename to views/comments/form.php diff --git a/ground/views/error404.php b/views/error404.php similarity index 100% rename from ground/views/error404.php rename to views/error404.php diff --git a/ground/views/feed/index.php b/views/feed/index.php similarity index 100% rename from ground/views/feed/index.php rename to views/feed/index.php diff --git a/ground/views/ganalytics.php b/views/ganalytics.php similarity index 100% rename from ground/views/ganalytics.php rename to views/ganalytics.php diff --git a/ground/views/indexTemplate.php b/views/indexTemplate.php similarity index 100% rename from ground/views/indexTemplate.php rename to views/indexTemplate.php diff --git a/ground/views/json.php b/views/json.php similarity index 100% rename from ground/views/json.php rename to views/json.php diff --git a/ground/views/layouts/clear.php b/views/layouts/clear.php similarity index 100% rename from ground/views/layouts/clear.php rename to views/layouts/clear.php diff --git a/ground/views/layouts/default.php b/views/layouts/default.php similarity index 100% rename from ground/views/layouts/default.php rename to views/layouts/default.php diff --git a/ground/views/layouts/page.php b/views/layouts/page.php similarity index 100% rename from ground/views/layouts/page.php rename to views/layouts/page.php diff --git a/ground/views/layouts/print.php b/views/layouts/print.php similarity index 100% rename from ground/views/layouts/print.php rename to views/layouts/print.php diff --git a/ground/views/metrika.php b/views/metrika.php similarity index 100% rename from ground/views/metrika.php rename to views/metrika.php diff --git a/ground/views/modals/addPoint.php b/views/modals/addPoint.php similarity index 100% rename from ground/views/modals/addPoint.php rename to views/modals/addPoint.php diff --git a/ground/views/modals/article.php b/views/modals/article.php similarity index 100% rename from ground/views/modals/article.php rename to views/modals/article.php diff --git a/ground/views/modals/articleInfo.php b/views/modals/articleInfo.php similarity index 100% rename from ground/views/modals/articleInfo.php rename to views/modals/articleInfo.php diff --git a/ground/views/modals/categories.php b/views/modals/categories.php similarity index 100% rename from ground/views/modals/categories.php rename to views/modals/categories.php diff --git a/ground/views/modals/image.php b/views/modals/image.php similarity index 100% rename from ground/views/modals/image.php rename to views/modals/image.php diff --git a/ground/views/modals/login.php b/views/modals/login.php similarity index 100% rename from ground/views/modals/login.php rename to views/modals/login.php diff --git a/ground/views/modals/pointAgreement.php b/views/modals/pointAgreement.php similarity index 100% rename from ground/views/modals/pointAgreement.php rename to views/modals/pointAgreement.php diff --git a/ground/views/point.php b/views/point.php similarity index 100% rename from ground/views/point.php rename to views/point.php diff --git a/ground/views/pointsTemplate.php b/views/pointsTemplate.php similarity index 100% rename from ground/views/pointsTemplate.php rename to views/pointsTemplate.php diff --git a/ground/views/rightNavigation.php b/views/rightNavigation.php similarity index 100% rename from ground/views/rightNavigation.php rename to views/rightNavigation.php diff --git a/ground/views/route.php b/views/route.php similarity index 100% rename from ground/views/route.php rename to views/route.php diff --git a/ground/views/user/index.php b/views/user/index.php similarity index 100% rename from ground/views/user/index.php rename to views/user/index.php diff --git a/ground/views/user/notification.php b/views/user/notification.php similarity index 100% rename from ground/views/user/notification.php rename to views/user/notification.php diff --git a/ground/views/user/notifications.php b/views/user/notifications.php similarity index 100% rename from ground/views/user/notifications.php rename to views/user/notifications.php diff --git a/ground/views/vkPoint.php b/views/vkPoint.php similarity index 100% rename from ground/views/vkPoint.php rename to views/vkPoint.php diff --git a/ground/watermarks/big.png b/watermarks/big.png similarity index 100% rename from ground/watermarks/big.png rename to watermarks/big.png diff --git a/ground/watermarks/middle.png b/watermarks/middle.png similarity index 100% rename from ground/watermarks/middle.png rename to watermarks/middle.png