-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
274 changed files
with
48,784 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
RewriteEngine on | ||
|
||
RewriteCond %{REQUEST_FILENAME} -s [OR] | ||
RewriteCond %{REQUEST_FILENAME} -l [OR] | ||
RewriteCond %{REQUEST_FILENAME} -d | ||
|
||
RewriteRule ^.*$ - [NC,L] | ||
RewriteRule ^(.*) /index.html [NC,L] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
<?php | ||
|
||
include dirname(__FILE__) . '/../../app/db/connection.php'; | ||
|
||
$ip = $_SERVER['REMOTE_ADDR']; | ||
$player = $_POST['player']; | ||
$score = 0; | ||
|
||
$player = preg_replace("/[^a-zA-Z0-9]+/", "", $player); | ||
$player = substr($player, 0, 32); | ||
|
||
$db_connection = connect(); | ||
|
||
$query = ' SELECT id, score FROM _game_scores' . | ||
' WHERE player = :player AND ip = :ip'; | ||
|
||
$statement = $db_connection->prepare($query); | ||
|
||
$statement->bindParam(':player', $player, PDO::PARAM_STR); | ||
$statement->bindParam(':ip', $ip, PDO::PARAM_STR); | ||
|
||
$statement->execute(); | ||
|
||
$row_item = $statement->fetch(PDO::FETCH_ASSOC); | ||
|
||
if (is_array($row_item)) | ||
{ | ||
if (array_key_exists('id', $row_item) && array_key_exists('score', $row_item)) | ||
{ | ||
$id = $row_item['id']; | ||
$score = $row_item['score']; | ||
} | ||
} | ||
|
||
$response = array('player' => $player, 'ip' => $ip, 'score' => $score); | ||
|
||
echo json_encode($response); | ||
|
||
?> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
<?php | ||
|
||
include dirname(__FILE__) . '/../../app/db/connection.php'; | ||
|
||
$result = array(); | ||
|
||
$db_connection = connect(); | ||
|
||
$query = ' SELECT id, player, ip, score, saved FROM _game_scores' . | ||
' ORDER BY score DESC LIMIT 20'; | ||
|
||
$statement = $db_connection->prepare($query); | ||
|
||
$statement->execute(); | ||
|
||
$result = $statement->fetchAll(PDO::FETCH_ASSOC); | ||
|
||
echo json_encode($result); | ||
|
||
?> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
<?php | ||
|
||
include dirname(__FILE__) . '/../../app/db/connection.php'; | ||
|
||
$ip = $_SERVER['REMOTE_ADDR']; | ||
$player = $_POST['player']; | ||
$score = intval($_POST['score']); | ||
|
||
$player = preg_replace("/[^a-zA-Z0-9]+/", "", $player); | ||
$player = substr($player, 0, 32); | ||
|
||
$db_connection = connect(); | ||
|
||
$query = ' SELECT id, score FROM _game_scores' . | ||
' WHERE player = :player AND ip = :ip'; | ||
|
||
$statement = $db_connection->prepare($query); | ||
|
||
$statement->bindParam(':player', $player, PDO::PARAM_STR); | ||
$statement->bindParam(':ip', $ip, PDO::PARAM_STR); | ||
|
||
$statement->execute(); | ||
|
||
$row_item = $statement->fetch(PDO::FETCH_ASSOC); | ||
|
||
if (is_array($row_item)) | ||
{ | ||
if (array_key_exists('id', $row_item) && array_key_exists('score', $row_item)) | ||
{ | ||
$id = $row_item['id']; | ||
$last_score = $row_item['score']; | ||
if ($last_score < $score) | ||
{ | ||
$query = 'UPDATE _game_scores' . | ||
' SET score = :score, saved = NOW()' . | ||
' WHERE id = :id'; | ||
|
||
$statement = $db_connection->prepare($query); | ||
|
||
$statement->bindValue(':id', $id, PDO::PARAM_INT); | ||
$statement->bindValue(':score', $score, PDO::PARAM_INT); | ||
|
||
$statement->execute(); | ||
} | ||
else | ||
{ | ||
$score = $last_score; | ||
} | ||
} | ||
} | ||
else | ||
{ | ||
if (strlen($player)) | ||
{ | ||
$query = 'INSERT INTO _game_scores' . | ||
' (player, ip, score, saved) VALUES' . | ||
' (:player, :ip, :score, NOW())'; | ||
|
||
$statement = $db_connection->prepare($query); | ||
|
||
$statement->bindValue(':player', $player, PDO::PARAM_STR); | ||
$statement->bindValue(':ip', $ip, PDO::PARAM_STR); | ||
$statement->bindValue(':score', $score, PDO::PARAM_INT); | ||
|
||
$statement->execute(); | ||
} | ||
} | ||
|
||
$response = array('player' => $player, 'ip' => $ip, 'score' => $score); | ||
|
||
echo json_encode($response); | ||
|
||
?> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
<?php | ||
|
||
header('Access-Control-Allow-Origin: *'); | ||
header('content-type: application/text; charset=utf-8'); | ||
|
||
if (isset($_POST['id'])) | ||
{ | ||
echo $_POST['id']; | ||
} | ||
|
||
?> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
angular.module('config', []) | ||
|
||
.constant('config', { | ||
baseUrl: '/', | ||
apiUrl: 'app/models/', | ||
componentsUrl: 'app/components/', | ||
imgUrl: 'public/img', | ||
cssUrl: 'public/css', | ||
galleryUrl: 'public/img/gallery', | ||
thumbUrl: 'public/img/thumbnail', | ||
installUrl: 'app/components/install/', | ||
installFolder: 'install/', | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
angular.module('MainApp', [ | ||
'appRoutes', | ||
'config', | ||
'mainDirective', | ||
'mainFilter', | ||
'navController', | ||
'navService', | ||
'mainController', | ||
'metaController', | ||
'metaService', | ||
'authController', | ||
'authService', | ||
'adminController', | ||
'adminService', | ||
'contactController', | ||
'contactService', | ||
'settingsController', | ||
'settingsService', | ||
'homeController', | ||
'categoryController', | ||
'pageController', | ||
'usersController', | ||
'usersService', | ||
'aclController', | ||
'aclService', | ||
'categoriesController', | ||
'categoriesService', | ||
'pagesController', | ||
'pagesService', | ||
'imagesController', | ||
'imagesService', | ||
'messagesController', | ||
'messagesService', | ||
'visitorsController', | ||
'visitorsService', | ||
'stylesController', | ||
'stylesService', | ||
'scriptsController', | ||
'scriptsService', | ||
'installController', | ||
'installService', | ||
'searchesController', | ||
'searchesService', | ||
]) | ||
|
||
.config(function ($httpProvider) { | ||
$httpProvider.interceptors.push('AuthInterceptor'); | ||
}) | ||
|
||
.config(function ($provide) { | ||
|
||
$provide.decorator('$document', ['$delegate', function ($delegate) { | ||
$delegate.getReferer = function() { | ||
return document.referrer; | ||
}; | ||
return $delegate; | ||
}]); | ||
|
||
$provide.decorator('formDirective', ['$delegate', function ($delegate) { | ||
var formDirective = $delegate[0]; | ||
var oldCompile = formDirective.compile; | ||
formDirective.compile = function (element, attrs, transclude) { | ||
var compile = oldCompile ? oldCompile.apply(this, arguments) : {}; | ||
element.attr("spellcheck", "false"); | ||
return compile; | ||
}; | ||
return $delegate; | ||
}]); | ||
|
||
}); | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,119 @@ | ||
angular.module('appRoutes', ['ngRoute', 'ngMeta']) | ||
|
||
.config(['$routeProvider', '$locationProvider', 'ngMetaProvider', function($routeProvider, $locationProvider, ngMetaProvider) { | ||
|
||
$routeProvider | ||
|
||
.when('/', { | ||
templateUrl: 'app/components/home/homeView.html', | ||
controller: 'HomeController', | ||
isProtected: false, | ||
}) | ||
.when('/category/:id', { | ||
templateUrl: 'app/components/category/categoryView.html', | ||
controller: 'CategoryController', | ||
isProtected: false, | ||
}) | ||
.when('/page/:id', { | ||
templateUrl: 'app/components/page/pageView.html', | ||
controller: 'PageController', | ||
isProtected: false, | ||
}) | ||
.when('/login', { | ||
templateUrl: 'app/components/login/loginView.html', | ||
controller: 'AuthController', | ||
isProtected: false, | ||
}) | ||
.when('/password', { | ||
templateUrl: 'app/components/login/passwordView.html', | ||
controller: 'AuthController', | ||
isProtected: false, | ||
}) | ||
.when('/register', { | ||
templateUrl: 'app/components/register/registerView.html', | ||
controller: 'AuthController', | ||
isProtected: false, | ||
}) | ||
.when('/logout', { | ||
templateUrl: 'app/components/login/logoutView.html', | ||
isProtected: true, | ||
}) | ||
.when('/contact', { | ||
templateUrl: 'app/components/contact/contactView.html', | ||
isProtected: false, | ||
}) | ||
.when('/admin', { | ||
templateUrl: 'app/components/admin/adminView.html', | ||
isProtected: true, | ||
}) | ||
.when('/acl', { | ||
templateUrl: 'app/components/acl/aclView.html', | ||
isProtected: true, | ||
}) | ||
.when('/settings', { | ||
templateUrl: 'app/components/settings/settingsView.html', | ||
isProtected: true, | ||
}) | ||
.when('/users', { | ||
templateUrl: 'app/components/users/usersView.html', | ||
isProtected: true, | ||
}) | ||
.when('/categories', { | ||
templateUrl: 'app/components/categories/categoriesView.html', | ||
isProtected: true, | ||
}) | ||
.when('/pages', { | ||
templateUrl: 'app/components/pages/pagesView.html', | ||
isProtected: true, | ||
}) | ||
.when('/images', { | ||
templateUrl: 'app/components/images/imagesView.html', | ||
isProtected: true, | ||
}) | ||
.when('/messages', { | ||
templateUrl: 'app/components/messages/messagesView.html', | ||
isProtected: true, | ||
}) | ||
.when('/visitors', { | ||
templateUrl: 'app/components/visitors/visitorsView.html', | ||
isProtected: true, | ||
}) | ||
.when('/styles', { | ||
templateUrl: 'app/components/styles/stylesView.html', | ||
isProtected: true, | ||
}) | ||
.when('/scripts', { | ||
templateUrl: 'app/components/scripts/scriptsView.html', | ||
isProtected: true, | ||
}) | ||
.when('/install', { | ||
templateUrl: 'app/components/install/installView.html', | ||
controller: 'InstallController', | ||
isProtected: false, | ||
}) | ||
.when('/search', { | ||
templateUrl: 'app/components/search/searchView.html', | ||
isProtected: false, | ||
}) | ||
.when('/searches', { | ||
templateUrl: 'app/components/search/searchesView.html', | ||
isProtected: true, | ||
}) | ||
.otherwise({ | ||
redirectTo: '/' | ||
}); | ||
|
||
$locationProvider.html5Mode(true); | ||
|
||
ngMetaProvider.useTitleSuffix(true); | ||
ngMetaProvider.setDefaultTitle('Angular CMS'); | ||
ngMetaProvider.setDefaultTitleSuffix(' | Angular CMS - Single Page Application @ AngularJS framework'); | ||
ngMetaProvider.setDefaultTag('author', 'Andrzej Żukowski'); | ||
|
||
}]) | ||
|
||
.run(['ngMeta', function(ngMeta) { | ||
|
||
ngMeta.init(); | ||
|
||
}]); |
Oops, something went wrong.