Skip to content

Commit

Permalink
Legacy controller.php route replaced by controller/
Browse files Browse the repository at this point in the history
  • Loading branch information
jbogdani committed Apr 28, 2023
1 parent 1b25d66 commit 5b870d0
Show file tree
Hide file tree
Showing 46 changed files with 115 additions and 114 deletions.
12 changes: 6 additions & 6 deletions js/admin.js
Original file line number Diff line number Diff line change
Expand Up @@ -369,7 +369,7 @@ var admin = {
}

var body = $('<div />').addClass('modal-body').appendTo(dialog.find('div.modal-content')),
URLstring = 'controller.php?';
URLstring = 'controller/?';

if (opts.buttons && typeof opts.buttons == 'object'){

Expand Down Expand Up @@ -419,7 +419,7 @@ var admin = {
dialog.find('.modal-body').html('<i class="fa fa-circle-o-notch fa-spin fa-3x fa-fw margin-bottom" style="font-size: 3em;"></i>');
$.ajax({
'type': opts.post ? 'POST' : 'GET',
'url': 'controller.php?obj=' + opts.obj + '&method=' + opts.method + (opts.param ? '&param[]=' + opts.param.join('&param[]=') : '' ),
'url': 'controller/?obj=' + opts.obj + '&method=' + opts.method + (opts.param ? '&param[]=' + opts.param.join('&param[]=') : '' ),
'data': opts.post
})
.done(function(data){
Expand Down Expand Up @@ -510,7 +510,7 @@ var admin = {
this.tab.find('li:last').data('opts', opts);
$.ajax({
'type': opts.post ? 'POST' : 'GET',
'url': 'controller.php?obj=' + opts.obj + '&method=' + opts.method + (opts.param ? '&param[]=' + opts.param.join('&param[]=') : '' ),
'url': 'controller/?obj=' + opts.obj + '&method=' + opts.method + (opts.param ? '&param[]=' + opts.param.join('&param[]=') : '' ),
'data': opts.post
})
.done(function(data){
Expand Down Expand Up @@ -554,7 +554,7 @@ var admin = {
opts = $(tab.find('li').get(index)).data('opts');
}

var url = 'controller.php?obj=' + opts.obj + '&method=' + opts.method + (opts.param ? '&param[]=' + opts.param.join('&param[]=') : '' );
var url = 'controller/?obj=' + opts.obj + '&method=' + opts.method + (opts.param ? '&param[]=' + opts.param.join('&param[]=') : '' );

pane.html('<i class="fa fa-circle-o-notch fa-spin fa-3x fa-fw margin-bottom" style="font-size: 3em;"></i>');

Expand Down Expand Up @@ -647,7 +647,7 @@ var admin = {
},

deleteDir: function(path){
$.get('controller.php?obj=media_ctrl&method=delete&param[]=' + path, function(data){
$.get('controller/?obj=media_ctrl&method=delete&param[]=' + path, function(data){
admin.message(data.text, data.status);
if(data.status == 'success'){
admin.media.go2dir(data.new_path);
Expand All @@ -666,7 +666,7 @@ var admin = {
addclass: 'btn-danger',
action: 'close',
click: function(){
$.get('controller.php?obj=media_ctrl&method=delete&param[]=' + full_path, function(data){
$.get('controller/?obj=media_ctrl&method=delete&param[]=' + full_path, function(data){
admin.message(data.text, data.status);
if (data.status == 'success'){
admin.tabs.closeActive('media/all/' + data.new_path);
Expand Down
2 changes: 1 addition & 1 deletion js/admin.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion lib/Router.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ public static function run()

$controller = new Controller($_GET, $_POST, $_REQUEST);

$router->map('GET|POST', "/controller.php", function () use ($controller) {
$router->map('GET|POST', "/controller/", function () use ($controller) {
$controller->route();
return false;
}, 'controller');
Expand Down
4 changes: 2 additions & 2 deletions modules/addsite/addsite.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ class addsite_ctrl extends Controller

public function preInstallErrors()
{
if (!in_array('mod_rewrite', apache_get_modules())) {
$error[] = 'Apache mo_rewrite is not enabled!';
if (!function_exists('apache_get_modules') || !in_array('mod_rewrite', apache_get_modules())) {
$error[] = 'Apache mod_rewrite is not enabled!';
}

if (!extension_loaded('PDO')) {
Expand Down
2 changes: 1 addition & 1 deletion modules/admin/tmpl/admin.twig
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@

{% block content %}{% endblock %}

<script src="controller.php?obj=tr&method=lang2js"></script>
<script src="controller/?obj=tr&method=lang2js"></script>
{% for f, sha in js %}
<script src="{{ f }}?sha256={{ sha }}"></script>
{% endfor %}
Expand Down
2 changes: 1 addition & 1 deletion modules/admin/tmpl/createInstallForm.twig
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@
{% block scripts %}
<script>
$('#newsite').on('submit', function(){
$.post('./controller.php?obj=addsite_ctrl&method=build', $(this).serialize(), function(data){
$.post('./controller/?obj=addsite_ctrl&method=build', $(this).serialize(), function(data){
if (data.status === 'success'){
$('#register').fadeOut();
$('#message').fadeIn();
Expand Down
2 changes: 1 addition & 1 deletion modules/admin/tmpl/loginForm.twig
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ if (typeof recaptchaCallback !== 'function') {
<script>
$('#signin').on('submit', function(){
$('#logerror').hide();
$.post('controller.php?obj=log_ctrl&method=in', $(this).serialize(), function(data){
$.post('controller/?obj=log_ctrl&method=in', $(this).serialize(), function(data){
if (data.status === 'success'){
location.reload();
$(window).trigger('hashchange');
Expand Down
18 changes: 9 additions & 9 deletions modules/article/tmpl/form.twig
Original file line number Diff line number Diff line change
Expand Up @@ -365,7 +365,7 @@
$('#edit_form{{ uid }} input[name="textid"]').on('change', function(){
$this = $(this);
if ($this.val() != '{{ art.textid }}'){
$.get('controller.php?obj=article_ctrl&method=check_duplicates&param[]=' + $(this).val() + '&param[]={{ art.id }}', function(data){
$.get('controller/?obj=article_ctrl&method=check_duplicates&param[]=' + $(this).val() + '&param[]={{ art.id }}', function(data){
if (data){
$this.focus();
admin.message(data, 'error');
Expand All @@ -389,13 +389,13 @@
}
// Textid can not contain duplicate values
$.get('controller.php?obj=article_ctrl&method=check_duplicates&param[]=' + $('#edit_form{{ uid }} input[name="textid"]').val() + '&param[]={{ art.id }}', function(data){
$.get('controller/?obj=article_ctrl&method=check_duplicates&param[]=' + $('#edit_form{{ uid }} input[name="textid"]').val() + '&param[]={{ art.id }}', function(data){
if (data){
$('#edit_form{{ uid }} input[name="textid"]').focus();
admin.message(data, 'error');
$('#edit_form{{ uid }}').find('button[type="submit"]').button('reset');
} else {
var url = 'controller.php?obj=article_ctrl&method=save&param[]={{ art.id }}';
var url = 'controller/?obj=article_ctrl&method=save&param[]={{ art.id }}';
admin.wysiwyg.preSave();
Expand Down Expand Up @@ -429,12 +429,12 @@
{# article image upload #}
admin.upload(
$('#file_uploader_{{ uid }}')[0],
'controller.php?obj=utils&method=upload&param[]={{ tmp_path }}&param[]=sanitize&param[]=resize',
'controller/?obj=utils&method=upload&param[]={{ tmp_path }}&param[]=sanitize&param[]=resize',
{
one: true,
allowedExtensions: ['jpg', 'jpeg', 'png', 'gif'],
loaded: function(id, filename, responseJSON){
$.get('controller.php?obj=article_ctrl' +
$.get('controller/?obj=article_ctrl' +
'&method=attachImage' +
'&param[]={{ art.id }}' +
'&param[]=' + responseJSON.filename + '.' + responseJSON.ext,
Expand All @@ -452,10 +452,10 @@
{# article media upload #}
admin.upload(
$('#{{ uid }} .media_uploader')[0],
'controller.php?obj=utils&method=upload&param[]={{ tmp_path }}',
'controller/?obj=utils&method=upload&param[]={{ tmp_path }}',
{
loaded: function(id, filename, responseJSON){
$.get('controller.php?obj=article_ctrl' +
$.get('controller/?obj=article_ctrl' +
'&method=attachMedia' +
'&param[]={{ art.id }}' +
'&param[]=' +responseJSON.filename + '.' + responseJSON.ext,
Expand All @@ -472,7 +472,7 @@
$('a.delete_attach_img').on('click', function(){
$.get('controller.php?obj=article_ctrl&method=delete_art_img&param[]={{ art.id }}', function(data){
$.get('controller/?obj=article_ctrl&method=delete_art_img&param[]={{ art.id }}', function(data){
admin.message(data.text, data.status);
$('#edit_form{{ uid }}').submit();
admin.tabs.reloadThis('#{{ uid }}');
Expand All @@ -482,7 +482,7 @@
$('#{{ uid }} .create_gallery').on('click', function(){
var name = $(this).data('name');
var $this = this;
$.getJSON('controller.php?obj=galleries_ctrl&method=addGallery&param[]=' + name, function(data){
$.getJSON('controller/?obj=galleries_ctrl&method=addGallery&param[]=' + name, function(data){
admin.message(data.text, data.status);
if (data.status === 'success'){
$('#edit_form{{ uid }}').submit();
Expand Down
8 changes: 4 additions & 4 deletions modules/article/tmpl/list.twig
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ var tb = $('#{{ uid }} table.data_table').dataTable({
"bDestroy": true,
"bProcessing": true,
"bServerSide": true,
"sAjaxSource": "./controller.php?obj=article_ctrl&method=sql2json{{ imploded_active_tags|raw }}",
"sAjaxSource": "./controller/?obj=article_ctrl&method=sql2json{{ imploded_active_tags|raw }}",
"order": [[ 0, "desc" ]],
"aoColumns": [
{ "mData":"id"},
Expand Down Expand Up @@ -133,7 +133,7 @@ var tb = $('#{{ uid }} table.data_table').dataTable({
addclass: 'btn-danger',
action: 'close',
click: function(){
$.get('controller.php?obj=article_ctrl&method=delete&param[]=' + $this.data('id'), function(data){
$.get('controller/?obj=article_ctrl&method=delete&param[]=' + $this.data('id'), function(data){
admin.message(data.text, data.type);
if (data.type === 'success'){
admin.tabs.reloadThis('#{{ uid }}');
Expand All @@ -155,7 +155,7 @@ var tb = $('#{{ uid }} table.data_table').dataTable({
$('#{{ uid }} .deleteTag').on('click', function(){
$.get('controller.php?obj=article_ctrl&method=deleteTag&tag={{ active_tags[0] }}', function(data){
$.get('controller/?obj=article_ctrl&method=deleteTag&tag={{ active_tags[0] }}', function(data){
if (!data){
admin.tabs.closeActive('article/all');
} else {
Expand All @@ -166,7 +166,7 @@ $('#{{ uid }} .deleteTag').on('click', function(){
$('#{{ uid }} .deleteAllTags').on('click', function(){
$.get('controller.php?obj=article_ctrl&method=deleteAllTags', function(data){
$.get('controller/?obj=article_ctrl&method=deleteAllTags', function(data){
if (!data){
admin.tabs.closeActive('article/all');
} else {
Expand Down
2 changes: 1 addition & 1 deletion modules/article/tmpl/transl_form.twig
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@
admin.wysiwyg.preSave();
$.post(
'controller.php?obj=article_ctrl&method=saveTransl&param[]={{ art.id }}',
'controller/?obj=article_ctrl&method=saveTransl&param[]={{ art.id }}',
$('#form{{ uid }}').serialize(),
function(data){
admin.message(data.text, data.status);
Expand Down
6 changes: 3 additions & 3 deletions modules/backup/tmpl/list.twig
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@
<script>
$('#{{ uid }} .create_backup').on('click', function(){
var $this = this;
$.getJSON('controller.php?obj=backup_ctrl&method=createNew', function(data){
$.getJSON('controller/?obj=backup_ctrl&method=createNew', function(data){
if (data.status === 'success'){
admin.tabs.reloadThis('#{{ uid }}');
}
Expand All @@ -78,7 +78,7 @@
'addclass': 'btn-danger',
'glyphicon': 'trash',
'click': function(){
$.getJSON('controller.php?obj=backup_ctrl&method=deleteBackup&param[]=' + file, function(data){
$.getJSON('controller/?obj=backup_ctrl&method=deleteBackup&param[]=' + file, function(data){
if (data.status === 'success'){
admin.tabs.reloadThis('#{{ uid }}');
}
Expand Down Expand Up @@ -111,7 +111,7 @@
'glyphicon': 'share-alt',
'click': function(){
$.getJSON('controller.php?obj=backup_ctrl&method=restoreBackup&param[]=' + file, function(data){
$.getJSON('controller/?obj=backup_ctrl&method=restoreBackup&param[]=' + file, function(data){
if (data.status === 'success'){
admin.tabs.reloadThis('#{{ uid }}');
}
Expand Down
10 changes: 5 additions & 5 deletions modules/cfg/tmpl/form.twig
Original file line number Diff line number Diff line change
Expand Up @@ -662,7 +662,7 @@
<script>
$('#form-{{ uid }}').on('submit', function(){
$('#submit-{{ uid }}').button('loading');
$.post('controller.php?obj=cfg_ctrl&method=save', $(this).serialize(), function(data){
$.post('controller/?obj=cfg_ctrl&method=save', $(this).serialize(), function(data){
admin.message(data.text, data.status);
if(data.status === 'success'){
admin.tabs.reloadThis('#form-{{ uid }}');
Expand All @@ -680,7 +680,7 @@ $('#form-{{ uid }} button.encrypt').on('click', function(){
admin.message('Please enter a password to encrypt!', 'error');
pwd.focus();
} else {
$.post('controller.php?obj=log_ctrl&method=encodePwd&echo=true', {'password': pwd.val()}, function(data){
$.post('controller/?obj=log_ctrl&method=encodePwd&echo=true', {'password': pwd.val()}, function(data){
button.button('reset');
pwd.val(data);
});
Expand All @@ -690,7 +690,7 @@ $('#form-{{ uid }} button.encrypt').on('click', function(){
$('#cache-{{ uid }}').on('click', function(){
var btn = $(this);
btn.button('loading');
$.get('controller.php?obj=cfg_ctrl&method=empty_cache', function(data){
$.get('controller/?obj=cfg_ctrl&method=empty_cache', function(data){
admin.message(data.text, data.status);
btn.button('reset');
}, 'json');
Expand All @@ -699,7 +699,7 @@ $('#cache-{{ uid }}').on('click', function(){
$('#trash-{{ uid }}').on('click', function(){
var btn = $(this);
btn.button('loading');
$.get('controller.php?obj=cfg_ctrl&method=empty_trash', function(data){
$.get('controller/?obj=cfg_ctrl&method=empty_trash', function(data){
admin.message(data.text, data.status);
btn.button('reset');
}, 'json');
Expand All @@ -708,7 +708,7 @@ $('#trash-{{ uid }}').on('click', function(){
$('#htaccess-{{ uid }}').on('click', function(){
var btn = $(this);
btn.button('loading');
$.get('controller.php?obj=cfg_ctrl&method=update_htaccess', function(data){
$.get('controller/?obj=cfg_ctrl&method=update_htaccess', function(data){
admin.message(data.text, data.status);
btn.button('reset');
}, 'json');
Expand Down
4 changes: 2 additions & 2 deletions modules/download/tmpl/all.twig
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ $('#{{ uid }} a.reload').on('click', function(){
var dwn = {
delete: function(id){
$.get('controller.php?obj=download_ctrl&method=resetCount&id=' + id, function(data){
$.get('controller/?obj=download_ctrl&method=resetCount&id=' + id, function(data){
admin.message(data.text, data.status);
$('#{{ uid }} table.data_table').DataTable().ajax.reload();
}, 'json');
Expand All @@ -51,7 +51,7 @@ var tb = $('#{{ uid }} table.data_table').dataTable({
"bDestroy": true,
"bProcessing": true,
"bServerSide": true,
"sAjaxSource": "./controller.php?obj=download_ctrl&method=sql2json",
"sAjaxSource": "./controller/?obj=download_ctrl&method=sql2json",
"aoColumns": [
{ "mData":"id"},
{ "mData":"file" },
Expand Down
14 changes: 7 additions & 7 deletions modules/downloads/tmpl/editNode.twig
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@
var file = $(this).data('file'),
form = $(this).parents('form');
$.get('controller.php?obj=downloads_ctrl' +
$.get('controller/?obj=downloads_ctrl' +
'&method=deleteCover' +
'&param[file]=' + file,
function(data){
Expand All @@ -145,11 +145,11 @@
form = $(el).parents('form');
admin.upload(el,
'controller.php?obj=utils&method=upload&param[]={{ tmp_path }}&param[]=sanitize',
'controller/?obj=utils&method=upload&param[]={{ tmp_path }}&param[]=sanitize',
{
allowedExtensions: ['jpg'],
loaded: function(id, filename, responseJSON){
$.get('controller.php?obj=downloads_ctrl' +
$.get('controller/?obj=downloads_ctrl' +
'&method=addCover' +
'&param[path]={{ upload_dir }}' +
'&param[refFile]=' + file +
Expand All @@ -166,7 +166,7 @@
admin.upload(
$('#{{ uid }} div.uploader')[0],
'controller.php?obj=utils&method=upload&param[]={{ upload_dir }}&param[]=sanitize',
'controller/?obj=utils&method=upload&param[]={{ upload_dir }}&param[]=sanitize',
{
allLoaded: function(){
admin.tabs.reloadThis('#{{ uid }}');
Expand All @@ -177,7 +177,7 @@
$('#form{{ uid }}').on('submit', function(){
$.post(
'controller.php?obj=downloads_ctrl&method=saveData&param[]={{ upload_dir }}{% if translation %}&param[]={{ translation }}{% endif %}',
'controller/?obj=downloads_ctrl&method=saveData&param[]={{ upload_dir }}{% if translation %}&param[]={{ translation }}{% endif %}',
$('#form{{ uid }}').serializeArray(), function(data){
admin.message(data.text, data.status);
},
Expand All @@ -186,7 +186,7 @@
$('#{{ uid }} button.delete').on('click', function(){
$this = $(this);
$.get('controller.php?obj=downloads_ctrl&method=deleteFile&param[]={{ upload_dir }}&param[]=' + $(this).data('file'), function(data){
$.get('controller/?obj=downloads_ctrl&method=deleteFile&param[]={{ upload_dir }}&param[]=' + $(this).data('file'), function(data){
admin.message(data.text, data.status);
if (data.status !== 'error'){
Expand All @@ -201,7 +201,7 @@
$('#{{ uid }} .delete-node').on('click', function(){
$.get('controller.php?obj=downloads_ctrl&method=deleteNode&param[]={{ upload_dir }}', function(data){
$.get('controller/?obj=downloads_ctrl&method=deleteNode&param[]={{ upload_dir }}', function(data){
admin.message(data.text, data.status);
if (data.status == 'success'){
Expand Down
2 changes: 1 addition & 1 deletion modules/downloads/tmpl/list.twig
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@
if (!download){
admin.message(admin.tr('download_node_name_cannot_be_empty'), 'error');
} else {
$.get('controller.php?obj=downloads_ctrl&method=add&param[]=' + download, function(data){
$.get('controller/?obj=downloads_ctrl&method=add&param[]=' + download, function(data){
admin.message(data.text, data.status);
if (data.status == 'success'){
Expand Down
2 changes: 1 addition & 1 deletion modules/error_log/error_log.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ public static function show()
admin.tabs.reloadThis(this);
});
$('.log-delete').click(function() {
$.get('controller.php?obj=error_log_ctrl&method=delete', function(data) {
$.get('controller/?obj=error_log_ctrl&method=delete', function(data) {
admin.message(data.text, data.status);
if (data.status === 'success') {
admin.tabs.closeActive('error_log/show');
Expand Down
Loading

0 comments on commit 5b870d0

Please sign in to comment.