diff --git a/ground/app.php b/ground/app.php
index a580fec..68bbfcb 100644
--- a/ground/app.php
+++ b/ground/app.php
@@ -14,7 +14,7 @@ function __autoload($className)
}
if (!$loaded){
- App::error404();
+ App::error404('Class '.$className.' was not loaded!');
return false;
}
diff --git a/ground/classes/Coord.php b/ground/classes/Coord.php
new file mode 100644
index 0000000..7e1f32c
--- /dev/null
+++ b/ground/classes/Coord.php
@@ -0,0 +1,15 @@
+query("SELECT COUNT(`id`) pointsCount FROM `points`")->fetch(PDO::FETCH_ASSOC);
App::setConfig('title', $res['pointsCount'].' или даже больше поводов не сидеть дома');
+ self::addVar('pointsCount', $res['pointsCount']);
- if($_GET['point'] && is_numeric($_GET['point']))
+ if(isset($_GET['point']) && $_GET['point'] && is_numeric($_GET['point']))
{
$id = (int) $_GET['point'];
@@ -62,7 +63,7 @@ class IndexController extends Controller
$point->descriptionHtml .= ' #wikipoints';
$og['title'] = $point->name . ' - wikipoints.ru';
- $og['description'] = $point->descriptionHtml;
+ $og['description'] = 'http://wikipoints.ru/?point='.$id.' '.$point->descriptionHtml;
$og['site_name'] = 'WikiPoints - '.$res['pointsCount'].' или даже больше поводов не сидеть дома';
$og['type'] = 'article';
$og['url'] = 'http://wikipoints.ru/?point='.$id;
@@ -71,7 +72,7 @@ class IndexController extends Controller
else if($_GET['point'] && strtolower($_GET['point']) == 'random')
{
$og['title'] = 'Случайная точка на wikipoints.ru';
- $og['description'] = 'Точка на карте, выбранная случайным образом. Лучший способ узнать что-то новое!';
+ $og['description'] = 'Загляните сюда: http://vk.com/wikipoints Случайная точка на карте - лучший способ узнать что-то новое!';
$og['site_name'] = 'WikiPoints - '.$res['pointsCount'].' или даже больше поводов не сидеть дома';
$og['type'] = 'article';
$og['url'] = 'http://wikipoints.ru/?point=random';
@@ -131,4 +132,24 @@ class IndexController extends Controller
App::redirect('/');
}
+ static function actionSitemap()
+ {
+ $xml = new SimpleXMLElement('');
+
+ $points = new Point();
+ $points = $points->getAll('', 'ID DESC');
+
+ foreach ($points as $point)
+ {
+ $url = $xml->addChild('url');
+ $url->addChild('loc', 'http://wikipoints.ru/page/point/id/' . $point['id']);
+ $url->addChild('lastmod', date("Y-m-d", $point['date']));
+ $url->addChild('changefreq', "weekly");
+ $url->addChild('priority', "0.8");
+ }
+
+ Header('Content-type: text/xml');
+ print($xml->asXML());
+ }
+
}
diff --git a/ground/controllers/PageController.php b/ground/controllers/PageController.php
index 45d980e..4ec3741 100644
--- a/ground/controllers/PageController.php
+++ b/ground/controllers/PageController.php
@@ -44,4 +44,44 @@ class PageController extends Controller
'points' => $result,
));
}
+
+ static function actionPoint()
+ {
+ self::$layout = 'layoutPage.php';
+
+ $id = (int) App::getParam('id');
+ if ($id)
+ {
+ self::addScript('/js/jquery-2.1.0.min.js');
+ self::addScript('/js/jquery-ui-1.10.4.custom.min.js');
+ self::addScript('/js/bootstrap.min.js');
+
+ self::addScript('/js/app.js?ver=' . App::getConfig('version'));
+
+ self::addStyle('/css/style.css?ver=' . App::getConfig('version'));
+ self::addStyle('/css/bootstrap.min.css');
+ self::addStyle('/css/bootstrap-theme.min.css');
+
+ $point = new Point();
+ $point = $point->getByPK($id);
+ $point->descriptionHtml = nl2br($point->description);
+ $point->name = htmlspecialchars($point->name);
+
+ $categories = new Category();
+ $categories = $categories->getAll();
+
+ $point->categoryIcon = $categories[$point->categoryId]['icon'];
+ $point->categoryName = $categories[$point->categoryId]['name'];
+
+ self::render('point.php', array(
+ 'point' => $point,
+ 'categories' => $categories,
+ )
+ );
+ } else
+ {
+ App::error404();
+ }
+ }
+
}
diff --git a/ground/views/point.php b/ground/views/point.php
new file mode 100644
index 0000000..3a482db
--- /dev/null
+++ b/ground/views/point.php
@@ -0,0 +1,23 @@
+
+
= $point->name ?>
+
+Координаты:
+
+ = $point->lat > 0 ? 'N' : 'S' ?>= $point->lat > 0 ? $point->lat : (-1 * $point->lat) ?>°
+ = $point->lng > 0 ? 'E' : 'W' ?>= $point->lng > 0 ? $point->lng : (-1 * $point->lng) ?>°
+
+ /
+
+ = $point->lat > 0 ? 'N' : 'S' ?>= Coord::dergeeToMinute($point->lat) ?>
+ = $point->lng > 0 ? 'E' : 'W' ?>= Coord::dergeeToMinute($point->lng) ?>
+
+ /
+На карте
+
+
+= $point->descriptionHtml ?>
+
+
+
+

+
diff --git a/public/js/map.js b/public/js/map.js
index dd6a915..41e26bb 100644
--- a/public/js/map.js
+++ b/public/js/map.js
@@ -87,6 +87,7 @@ function init(lat, lng) {
if (!myMap._popup && $('#boxRoute').css('display') == 'none')
{
history.pushState({}, document.title, "/?lat=" + myMap.getCenter().lat + "&lng=" + myMap.getCenter().lng + "&zoom=" + myMap.getZoom());
+ document.title = pointsCount+' или даже больше поводов не сидеть дома';
}
});
@@ -189,7 +190,10 @@ function showInfo(id)
description = description + data.descriptionHtml;
if (data.source.length > 11)
+ {
+ //description = description + ' Подробнее...';
description = description + ' Подробнее...';
+ }
description = description + '';
@@ -201,6 +205,7 @@ function showInfo(id)
myMap.setView([points[id]._latlng.lat+diff, points[id]._latlng.lng], myMap.getZoom());
history.pushState({}, document.title, "/?point=" + id);
+ document.title = data.name;
}
});
} else {
@@ -209,6 +214,7 @@ function showInfo(id)
myMap.setView([points[id]._latlng.lat+diff, points[id]._latlng.lng], myMap.getZoom());
history.pushState({}, document.title, "/?point=" + id);
+ document.title = points[id].options.title;
}
}
@@ -277,8 +283,6 @@ function showMeOnTheMap()
points.im.setLatLng(coords).addTo(myMap);
myMap.setView(coords, 15);
});
-
- //myMap.setCenter(points.im.geometry.getCoordinates());
}
/**
diff --git a/public/robots.txt b/public/robots.txt
new file mode 100644
index 0000000..6e6b86e
--- /dev/null
+++ b/public/robots.txt
@@ -0,0 +1,3 @@
+User-agent: *
+Allow: /
+Sitemap: http://wikipoints.ru/index/sitemap
\ No newline at end of file