1
0
mirror of https://github.com/Mowie/Mowie synced 2024-06-07 19:29:39 +00:00
Mowie/admin/action.php

164 lines
5.1 KiB
PHP
Raw Permalink Normal View History

2016-08-02 21:13:25 +00:00
<?php
require_once '../inc/autoload_adm.php';
2017-10-04 18:47:05 +00:00
use HGG\DbCmd\CmdBuilder\MySql;
use HGG\DbCmd\DbCmd;
// Full Database Backeup
2016-08-02 21:13:25 +00:00
if (isset($_GET['dbbackup']) && is_loggedin() && hasPerm('db_dump'))
{
2017-10-04 18:47:05 +00:00
try
2016-08-02 21:13:25 +00:00
{
2017-10-04 18:47:05 +00:00
$output = '';
$cmd = new DbCmd(new MySql());
$cmd->dumpDatabase($MCONF['db_usr'], $MCONF['db_pw'], $MCONF['db_host'], $MCONF['db_name'],
'.dbdump.tmp', array(), $output);
2016-11-13 12:38:19 +00:00
stream_message('{user} made a database-backup.', 4);
2016-08-02 21:13:25 +00:00
header("Cache-Control: public");
header("content-Description: File Transfer");
header('Content-Disposition: attachment; filename=Backup_' . str_replace(' ', '_', $MCONF['title']) . '_' . date('Y-m-d_h-d') . '.sql');
header("Content-Type: application/octet-stream; ");
header("Content-Transfer-Encoding: binary");
2017-10-04 18:47:05 +00:00
readfile('.dbdump.tmp');
2017-10-04 19:16:42 +00:00
unlink('.dbdump.tmp');
2017-10-04 18:47:05 +00:00
}
catch (\Exception $e)
{
echo msg('fail', $lang->get('action_backup_fail'));
2016-08-02 21:13:25 +00:00
}
2017-10-04 18:47:05 +00:00
exit;
2016-08-02 21:13:25 +00:00
}
if (hasPerm('manage_system'))
{
//construction
if (isset($_GET['construction']))
{
2016-10-21 17:58:27 +00:00
printHeader($lang->get('action_construction_message_edit'));
if (isset($_GET['constr_message']))
2016-08-02 21:13:25 +00:00
{
if (isset($_POST['constr_message']))
2016-08-02 21:13:25 +00:00
{
if (file_put_contents('../content/.system/construction2.txt', $_POST['constr_message']))
2016-08-02 21:13:25 +00:00
{
copy('../content/.system/construction2.txt', '../content/.system/construction.txt');
2017-04-29 21:16:39 +00:00
echo msg('success', $lang->get('action_construction_message_success') . ' <a href="general_config.php">' . $lang->get('back') . '</a>');
2016-11-13 12:38:19 +00:00
stream_message('{user} edited the construction-mode message.', 2);
2016-08-02 21:13:25 +00:00
} else
{
echo msg('fail', $lang->get('action_try_again_later') . ' <a href="general_config.php">' . $lang->get('back') . '</a>');
2016-08-02 21:13:25 +00:00
}
} else
{
tinymce();
?>
<div class="main">
<h1><?php echo $lang->get('action_construction_message_edit'); ?></h1>
<form action="<?php echo $_SERVER['REQUEST_URI'] ?>" method="post">
<textarea id="editor"
name="constr_message"><?php require('../content/.system/construction2.txt'); ?></textarea>
<input type="submit" value="<?php echo $lang->get('general_save_changes'); ?>"/>
</form>
</div>
<?php
}
} else
{
if (hasPerm('construction'))
{
if (!file_exists('../content/.system/construction.txt'))
2016-08-02 21:13:25 +00:00
{
if (isset($_GET['confirm']))
2016-08-02 21:13:25 +00:00
{
if (copy('../content/.system/construction2.txt', '../content/.system/construction.txt'))
2016-08-02 21:13:25 +00:00
{
2017-04-29 21:16:39 +00:00
echo msg('success', $lang->get('action_construction_success') . ' <a href="general_config.php">' . $lang->get('back') . '</a>');
2016-11-13 12:38:19 +00:00
stream_message('{user} put the site into construction mode.', 2);
2016-08-02 21:13:25 +00:00
} else
{
echo msg('fail', $lang->get('action_construction_error') . ' <a href="general_config.php">' . $lang->get('back') . '</a>');
2016-08-02 21:13:25 +00:00
}
} else
{
?>
<div class="main">
<p style="text-align: center;">
<?php echo $lang->get('action_construction_confirm'); ?><br/>
<a href="action.php?construction&confirm"
class="button"><?php echo $lang->get('general_yes'); ?></a>
<a href="general_config.php"
class="button btn_del"><?php echo $lang->get('general_no'); ?></a>
</p>
</div>
<?php
}
} else
{
if (isset($_GET['confirm']))
{
if (unlink('../content/.system/construction.txt'))
2016-08-02 21:13:25 +00:00
{
2017-04-29 21:16:39 +00:00
echo msg('success', $lang->get('action_construction_removed_success') . ' <a href="general_config.php">' . $lang->get('back') . '</a>');
2016-11-13 12:38:19 +00:00
stream_message('{user} put the site into production mode.', 2);
2016-08-02 21:13:25 +00:00
} else
{
echo msg('fail', $lang->get('action_construction_removed_error') . ' <a href="general_config.php">' . $lang->get('back') . '</a>');
}
} else
{
?>
<div class="main">
2016-08-02 21:13:25 +00:00
<p style="text-align: center;">
<?php echo $lang->get('action_construction_remove'); ?><br/>
<a href="action.php?construction&confirm"
class="button"><?php echo $lang->get('general_yes'); ?></a>
<a href="general_config.php"
class="button btn_del"><?php echo $lang->get('general_no'); ?></a>
2016-08-02 21:13:25 +00:00
</p>
</div>
<?php
2016-08-02 21:13:25 +00:00
}
}
}
}
}
2016-10-21 17:58:27 +00:00
//General Changes
if (isset($_GET['general']))
{
2016-10-21 17:58:27 +00:00
printHeader($lang->get('general_config'));
//Header
if (hasPerm('edit_title'))
2016-08-02 21:13:25 +00:00
{
$titel = $_POST['titel'];
if (file_put_contents('../content/.system/page_title.txt', $titel))
2016-08-02 21:13:25 +00:00
{
2017-04-29 21:16:39 +00:00
echo msg('success', $lang->get('action_change_page_title_success'));
2016-11-13 12:38:19 +00:00
stream_message('{user} edited the page title.', 2);
} else
{
echo msg('fail', $lang->get('action_try_again_later'));
2016-08-02 21:13:25 +00:00
}
}
$apps = new apps();
$appUri = '../apps/';
foreach ($apps->getApps() as $app => $appconf)
{
2017-05-07 19:48:33 +00:00
require $appUri . $appconf['app_path'] . '/config.php';
if (isset($_CONF['general_conf']) && $_CONF['general_conf'] != '' && file_exists($appUri . $appconf['app_path'] . '/' . $_CONF['general_conf']))
2016-08-02 21:13:25 +00:00
{
2017-05-07 19:48:33 +00:00
require $appUri .$appconf['app_path'] . '/' . $_CONF['general_conf'];
2016-08-02 21:13:25 +00:00
}
}
}
} else
2016-08-02 21:13:25 +00:00
{
2016-10-21 17:58:27 +00:00
printHeader($lang->get('action_edit_content'));
2016-08-02 21:13:25 +00:00
echo msg('info', $lang->get('missing_permission'));
}
require_once '../inc/footer.php';
?>