Skip to content

Commit

Permalink
more direct json, move update.php to view (else, no proper rewrite, f…
Browse files Browse the repository at this point in the history
…older-view), and other stuff
  • Loading branch information
Vinzenz Hersche committed Jun 7, 2018
1 parent e375eda commit 844b2b0
Show file tree
Hide file tree
Showing 12 changed files with 41 additions and 26 deletions.
6 changes: 6 additions & 0 deletions .htaccess
Original file line number Diff line number Diff line change
Expand Up @@ -37,10 +37,16 @@ RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^.*$ index.php [L,QSA]

# big exception, we need to rename or move that update-folder
RewriteRule ^update/?$ update/update.php [NC,L]

# from official example
# RewriteEngine on
# RewriteCond %{SCRIPT_FILENAME} !-f
# RewriteCond %{SCRIPT_FILENAME} !-d
# RewriteCond %{SCRIPT_FILENAME} !-l
# RewriteRule ^(.*)$ index.php/$1
</IfModule>
<IfModule mod_xsendfile.c>
RewriteRule ^videos/([A-Za-z0-9-_.]+)$ view/xsendfile.php?file=$1 [QSA]
</IfModule>
18 changes: 12 additions & 6 deletions index.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,9 @@
SimpleRouter::get($basePath."info", function() {
require_once "view/info.php";
});
SimpleRouter::get($basePath."siteConfigurations", function() {
require_once "view/configurations.php";
});
SimpleRouter::get($basePath."signUp", function() {
require_once "view/signUp.php";
});
Expand All @@ -28,6 +31,9 @@
SimpleRouter::get($basePath."about", function() {
require_once "view/about.php";
});
SimpleRouter::get($basePath."orphanFiles", function() {
require_once "view/orphanFiles.php";
});
SimpleRouter::get($basePath."contact", function() {
require_once "view/contact.php";
});
Expand Down Expand Up @@ -59,10 +65,7 @@
require_once "view/charts.php";
});
SimpleRouter::get($basePath."update", function() {
require_once "update/update.php";
});
SimpleRouter::post($basePath."youtubeUpload", function() {
require_once "objects/youtubeUpload.json.php";
require_once "view/update.php";
});
SimpleRouter::post($basePath."googleAdView", function() {
require_once "view/googleAdView.php";
Expand Down Expand Up @@ -114,11 +117,11 @@
SimpleRouter::get($basePath."help", function() {
require_once "view/help.php";
});
SimpleRouter::get($basePath."like", function() {
SimpleRouter::post($basePath."like", function() {
$_GET['like']="1";
require_once "objects/like.json.php";
});
SimpleRouter::get($basePath."dislike", function() {
SimpleRouter::post($basePath."dislike", function() {
$_GET['like']="-1";
require_once "objects/like.json.php";
});
Expand Down Expand Up @@ -156,6 +159,9 @@
require_once "objects/login.json.php";
});
/*
SimpleRouter::post($basePath."youtubeUpload", function() {
require_once "objects/youtubeUpload.json.php";
});
SimpleRouter::post($basePath."addNewAd", function() {
require_once "objects/video_adsAddNew.json.php";
});
Expand Down
6 changes: 3 additions & 3 deletions plugin/FBTube/view/getVideos.php
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,7 @@ function loadPlayLists<?php echo $video['id']; ?>() {
$('.playListsIds').change(function () {
modal.showPleaseWait();
$.ajax({
url: '<?php echo $global['webSiteRootURL']; ?>playListAddVideo.json',
url: '<?php echo $global['webSiteRootURL']; ?>objects/playListAddVideo.json.php',
method: 'POST',
data: {
'videos_id': <?php echo $video['id']; ?>,
Expand Down Expand Up @@ -429,7 +429,7 @@ function loadPlayLists<?php echo $video['id']; ?>() {
evt.preventDefault();
modal.showPleaseWait();
$.ajax({
url: '<?php echo $global['webSiteRootURL']; ?>sendEmail',
url: '<?php echo $global['webSiteRootURL']; ?>objects/sendEmail.json.php',
data: $('#contact_form<?php echo $video['id']; ?>').serializeArray(),
type: 'post',
success: function (response) {
Expand Down Expand Up @@ -509,7 +509,7 @@ function loadPlayLists<?php echo $video['id']; ?>() {
search: "<?php echo __("Search"); ?>",
},
ajax: true,
url: "<?php echo $global['webSiteRootURL'] . "comments.json/" . $video['id']; ?>",
url: "<?php echo $global['webSiteRootURL'] . "objects/comments.json.php?video_id=" . $video['id']; ?>",
sorting: false,
templates: {
header: ""
Expand Down
2 changes: 1 addition & 1 deletion plugin/YouPHPFlix/view/js/script.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ function loadPlayLists() {
$('.playListsIds').change(function () {
modal.showPleaseWait();
$.ajax({
url: webSiteRootURL + 'playListAddVideo.json',
url: webSiteRootURL + 'objects/playListAddVideo.json.php',
method: 'POST',
data: {
'videos_id': videos_id,
Expand Down
8 changes: 4 additions & 4 deletions view/channel.php
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@
modal.showPleaseWait();
var list = $(this).sortable("toArray");
$.ajax({
url: '<?php echo $global['webSiteRootURL']; ?>sortPlaylist',
url: '<?php echo $global['webSiteRootURL']; ?>objects/playlistSort.php',
data: {
"list": list,
"playlist_id": <?php echo $playlist['id']; ?>
Expand Down Expand Up @@ -279,7 +279,7 @@ function () {
var playlist_id = $(currentObject).attr('playlist_id');
var video_id = $(currentObject).attr('video_id');
$.ajax({
url: '<?php echo $global['webSiteRootURL']; ?>removeVideoFromPlaylist',
url: '<?php echo $global['webSiteRootURL']; ?>objects/playlistRemoveVideo.php',
data: {
"playlist_id": playlist_id,
"video_id": video_id
Expand Down Expand Up @@ -309,7 +309,7 @@ function () {
var playlist_id = $(currentObject).attr('playlist_id');
console.log(playlist_id);
$.ajax({
url: '<?php echo $global['webSiteRootURL']; ?>removePlaylist',
url: '<?php echo $global['webSiteRootURL']; ?>objects/playlistRemove.php',
data: {
"playlist_id": playlist_id
},
Expand Down Expand Up @@ -346,7 +346,7 @@ function (inputValue) {
var playlist_id = $(currentObject).attr('playlist_id');
console.log(playlist_id);
$.ajax({
url: '<?php echo $global['webSiteRootURL']; ?>renamePlaylist',
url: '<?php echo $global['webSiteRootURL']; ?>objects/playlistRename.php',
data: {
"playlist_id": playlist_id,
"name": inputValue
Expand Down
4 changes: 2 additions & 2 deletions view/configurations.php
Original file line number Diff line number Diff line change
Expand Up @@ -599,7 +599,7 @@ function readFile(input, c) {
evt.preventDefault();
modal.showPleaseWait();
$.ajax({
url: '<?php echo $global['webSiteRootURL']; ?>sendEmail',
url: '<?php echo $global['webSiteRootURL']; ?>objects/sendEmail.json.php',
data: {
captcha:$('#captchaText').val(),
first_name: "Your Site test",
Expand Down Expand Up @@ -726,7 +726,7 @@ function readFile(input, c) {
logoImgBase64 = resp;

$.ajax({
url: 'updateConfig',
url: '<?php echo $global['webSiteRootURL']; ?>objects/configurationUpdate.json.php',
data: {
"logoSmallImgBase64": logoSmallImgBase64,
"logoImgBase64": logoImgBase64,
Expand Down
4 changes: 2 additions & 2 deletions view/managerPlugins.php
Original file line number Diff line number Diff line change
Expand Up @@ -473,7 +473,7 @@ function createPluginStoreList(src, name, price, description) {
$('#savePluginBtn').click(function (evt) {
modal.showPleaseWait();
$.ajax({
url: 'addDataObjectPlugin.json',
url: '<?php echo $global['webSiteRootURL']; ?>objects/pluginAddDataObject.json.php',
data: {"id": $('#inputPluginId').val(), "object_data": $('#inputData').val()},
type: 'post',
success: function (response) {
Expand All @@ -487,7 +487,7 @@ function createPluginStoreList(src, name, price, description) {
$('#pluginsImportFormModal').modal();
});
$('#input-b1').fileinput({
uploadUrl: '<?php echo $global['webSiteRootURL']; ?>pluginImport.json',
uploadUrl: '<?php echo $global['webSiteRootURL']; ?>objects/pluginImport.json.php',
allowedFileExtensions: ['zip']
}).on('fileuploaded', function (event, data, id, index) {
$("#grid").bootgrid('reload');
Expand Down
2 changes: 1 addition & 1 deletion view/managerSubscribes.php
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ function _subscribe(email,user_id, id) {
function notify(){
modal.showPleaseWait();
$.ajax({
url: '<?php echo $global['webSiteRootURL']; ?>notifySubscribers.json',
url: '<?php echo $global['webSiteRootURL']; ?>objects/notifySubscribers.json.php',
method: 'POST',
data: {'message': $('#emailMessage').val()},
success: function (response) {
Expand Down
4 changes: 2 additions & 2 deletions view/managerVideos.php
Original file line number Diff line number Diff line change
Expand Up @@ -684,7 +684,7 @@ function createQueueItem(queueItem, position) {
}
});
$.ajax({
url: 'youtubeUpload',
url: '<?php echo $global['webSiteRootURL']; ?>objects/youtubeUpload.json.php',
data: {"id": vals},
type: 'post',
success: function (response) {
Expand Down Expand Up @@ -1035,7 +1035,7 @@ function () {
var row = $("#grid").bootgrid("getCurrentRows")[row_index];
modal.showPleaseWait();
$.ajax({
url: 'youtubeUpload',
url: '<?php echo $global['webSiteRootURL']; ?>objects/youtubeUpload.json.php',
data: {"id": row.id},
type: 'post',
success: function (response) {
Expand Down
4 changes: 2 additions & 2 deletions view/modeYoutube.php
Original file line number Diff line number Diff line change
Expand Up @@ -330,7 +330,7 @@ function loadPlayLists() {
$('.playListsIds').change(function () {
modal.showPleaseWait();
$.ajax({
url: '<?php echo $global['webSiteRootURL']; ?>playListAddVideo.json',
url: '<?php echo $global['webSiteRootURL']; ?>objects/playListAddVideo.json.php',
method: 'POST',
data: {
'videos_id': <?php echo $video['id']; ?>,
Expand Down Expand Up @@ -536,7 +536,7 @@ function loadPlayLists() {
evt.preventDefault();
modal.showPleaseWait();
$.ajax({
url: '<?php echo $global['webSiteRootURL']; ?>sendEmail',
url: '<?php echo $global['webSiteRootURL']; ?>objects/sendEmail.json.php',
data: $('#contact_form').serializeArray(),
type: 'post',
success: function (response) {
Expand Down
5 changes: 4 additions & 1 deletion update/update.php → view/update.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
<?php
require_once '../videos/configuration.php';
global $global, $config;
if(!isset($global['systemRootPath'])){
require_once '../videos/configuration.php';
}
require_once $global['systemRootPath'] . 'objects/user.php';
//check if there is a update
if (!User::isAdmin()) {
Expand Down
4 changes: 2 additions & 2 deletions view/videoComments.php
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@
search: "<?php echo __("Search"); ?>",
},
ajax: true,
url: "<?php echo $global['webSiteRootURL']; ?>comments.json/<?php echo empty($video['id']) ? "0" : $video['id']; ?>",
url: "<?php echo $global['webSiteRootURL']; ?>objects/comments.json.php?video_id=<?php echo empty($video['id']) ? "0" : $video['id']; ?>",
sorting: false,
templates: {
header: ""
Expand Down Expand Up @@ -322,7 +322,7 @@ function gridLoaded() {
search: "<?php echo __("Search"); ?>",
},
ajax: true,
url: "<?php echo $global['webSiteRootURL']; ?>comments.json/<?php echo empty($video['id']) ? "0" : $video['id']; ?>",
url: "<?php echo $global['webSiteRootURL']; ?>objects/comments.json.php?video_id=<?php echo empty($video['id']) ? "0" : $video['id']; ?>",
sorting: false,
templates: {
header: ""
Expand Down

0 comments on commit 844b2b0

Please sign in to comment.