Struggeling with relocating
Dieser Commit ist enthalten in:
Commit
89ea01c429
301 geänderte Dateien mit 59926 neuen und 0 gelöschten Zeilen
119
inc/home/home.php
Normale Datei
119
inc/home/home.php
Normale Datei
|
|
@ -0,0 +1,119 @@
|
|||
<?php
|
||||
/**
|
||||
* This file is part of MySQLDumper released under the GNU/GPL 2 license
|
||||
* http://www.mysqldumper.net
|
||||
*
|
||||
* @package MySQLDumper
|
||||
* @version SVN: $rev: 1207 $
|
||||
* @author $Author$
|
||||
* @lastmodified $Date$
|
||||
*/
|
||||
|
||||
if (!defined('MSD_VERSION')) die('No direct access.');
|
||||
$sumFiles = $sumSize = 0;
|
||||
$lastBu = Array();
|
||||
if ($action == '') {
|
||||
$action = 'status';
|
||||
}
|
||||
include ('./inc/define_icons.php');
|
||||
|
||||
if (isset($_POST['htaccess']) || $action == 'schutz') {
|
||||
include ('./inc/home/protection_create.php');
|
||||
} elseif ($action == 'edithtaccess') {
|
||||
include ('./inc/home/protection_edit.php');
|
||||
} elseif ($action == 'deletehtaccess') {
|
||||
include ('./inc/home/protection_delete.php');
|
||||
}
|
||||
|
||||
if ($action == 'status') {
|
||||
$htaExists = (file_exists('./.htaccess'));
|
||||
if (!defined('MSD_MYSQL_VERSION')) GetMySQLVersion();
|
||||
// find latest backup file
|
||||
$dh = opendir($config['paths']['backup']);
|
||||
while (false !== ($fileName = readdir($dh))) {
|
||||
if ($fileName != '.' && $fileName != '..'
|
||||
&& !is_dir($config['paths']['backup'] . $fileName)) {
|
||||
$files[] = $fileName;
|
||||
$sumFiles++;
|
||||
$sumSize += filesize($config['paths']['backup'] . $fileName);
|
||||
$ft = filectime($config['paths']['backup'] . $fileName);
|
||||
if (!isset($lastBu[2]) || (isset($lastBu[2]) && $ft > $lastBu[2])) {
|
||||
$lastBu[0] = $fileName;
|
||||
$lastBu[1] = date("d.m.Y H:i", $ft);
|
||||
$lastBu[2] = $ft;
|
||||
}
|
||||
}
|
||||
}
|
||||
$directoryWarnings = checkDirectories();
|
||||
|
||||
$tplHome = new MSDTemplate();
|
||||
$tplHome->set_filenames(array('tplHome' => 'tpl/home/home.tpl'));
|
||||
$tplHome->assign_vars(
|
||||
array(
|
||||
'ICON_EDIT' => $icon['edit'],
|
||||
'ICON_DELETE' => $icon['delete'],
|
||||
'ICON_SEARCH' => $icon['search'],
|
||||
'THEME' => $config['theme'],
|
||||
'MSD_VERSION' => MSD_VERSION . ' (' . MSD_VERSION_SUFFIX . ')',
|
||||
'OS' => MSD_OS,
|
||||
'OS_EXT' => MSD_OS_EXT,
|
||||
'MYSQL_VERSION' => MSD_MYSQL_VERSION,
|
||||
'MYSQL_CLIENT_VERSION' => $dbo->getClientInfo(),
|
||||
'PHP_VERSION' => PHP_VERSION,
|
||||
'MEMORY' => byteOutput($config['php_ram'] * 1024 * 1024),
|
||||
'MAX_EXECUTION_TIME' => intval(@get_cfg_var('max_execution_time')),
|
||||
'MAX_EXEC_USED_BY_MSD' => $config['max_execution_time'],
|
||||
'PHP_EXTENSIONS' => $config['phpextensions'],
|
||||
'SERVER_NAME' => $_SERVER['SERVER_NAME'],
|
||||
'MSD_PATH' => $config['paths']['root'],
|
||||
'DB' => $config['db_actual'],
|
||||
'NR_OF_BACKUP_FILES' => $sumFiles,
|
||||
'SIZE_BACKUPS' => byteOutput($sumSize),
|
||||
'FREE_DISKSPACE' => getFreeDiskSpace()
|
||||
)
|
||||
);
|
||||
if ($directoryWarnings > '') {
|
||||
$tplHome->assign_block_vars(
|
||||
'DIRECTORY_WARNINGS', array('MSG' => $directoryWarnings)
|
||||
);
|
||||
}
|
||||
|
||||
if ($config['disabled'] > '') {
|
||||
$tplHome->assign_block_vars(
|
||||
'DISABLED_FUNCTIONS',
|
||||
array(
|
||||
'PHP_DISABLED_FUNCTIONS' =>
|
||||
str_replace(',', ', ', $config['disabled'])
|
||||
)
|
||||
);
|
||||
}
|
||||
// Zlib is buggy from version 4.3.0 upto 4.3.2,
|
||||
// so lets check for these versions
|
||||
if (version_compare(PHP_VERSION, '4.3.0', '>=')
|
||||
&& version_compare(PHP_VERSION, '4.3.2', '<=')) {
|
||||
$tplHome->assign_block_vars('ZLIBBUG', array());
|
||||
}
|
||||
if (!extension_loaded('ftp')) {
|
||||
$tplHome->assign_block_vars('NO_FTP', array());
|
||||
}
|
||||
if (!$config['zlib']) {
|
||||
$tplHome->assign_block_vars('NO_ZLIB', array());
|
||||
}
|
||||
if ($htaExists) {
|
||||
$tplHome->assign_block_vars('HTACCESS_EXISTS', array());
|
||||
} else {
|
||||
$tplHome->assign_block_vars('HTACCESS_DOESNT_EXISTS', array());
|
||||
}
|
||||
if ($sumFiles > 0 && isset($lastBu[1])) {
|
||||
$fileSize = @filesize($config['paths']['backup'] . $lastBu[0]);
|
||||
$tplHome->assign_block_vars(
|
||||
'LAST_BACKUP',
|
||||
array(
|
||||
'INFO' => $lastBu[1],
|
||||
'LINK' => $config['paths']['backup'] . urlencode($lastBu[0]),
|
||||
'NAME' => $lastBu[0],
|
||||
'SIZE' => byteOutput($fileSize)
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
||||
12
inc/home/phpinfo.php
Normale Datei
12
inc/home/phpinfo.php
Normale Datei
|
|
@ -0,0 +1,12 @@
|
|||
<?php
|
||||
/**
|
||||
* This file is part of MySQLDumper released under the GNU/GPL 2 license
|
||||
* http://www.mysqldumper.net
|
||||
*
|
||||
* @package MySQLDumper
|
||||
* @version SVN: $rev: 1207 $
|
||||
* @author $Author$
|
||||
* @lastmodified $Date$
|
||||
*/
|
||||
|
||||
phpinfo();
|
||||
144
inc/home/protection_create.php
Normale Datei
144
inc/home/protection_create.php
Normale Datei
|
|
@ -0,0 +1,144 @@
|
|||
<?php
|
||||
/**
|
||||
* This file is part of MySQLDumper released under the GNU/GPL 2 license
|
||||
* http://www.mysqldumper.net
|
||||
*
|
||||
* @package MySQLDumper
|
||||
* @version SVN: $rev: 1207 $
|
||||
* @author $Author$
|
||||
* @lastmodified $Date$
|
||||
*/
|
||||
|
||||
if (!defined('MSD_VERSION')) die('No direct access.');
|
||||
|
||||
$dba = $htaDir = $overwrite = $msg = '';
|
||||
$error = array();
|
||||
$type = 0; // default encryption type set to crypt()
|
||||
if (strtoupper(substr(MSD_OS, 0, 3)) == 'WIN') {
|
||||
$type = 2; // we are on a Win-System; pre-select encryption type
|
||||
}
|
||||
if (isset($_POST['type'])) {
|
||||
$type = (int) $_POST['type'];
|
||||
}
|
||||
$username = (isset($_POST['username'])) ? $_POST['username'] : '';
|
||||
$userpassOne = (isset($_POST['userpass1'])) ? $_POST['userpass1'] : '';
|
||||
$userpassConfirm = (isset($_POST['userpass2'])) ? $_POST['userpass2'] : '';
|
||||
|
||||
$tplHomeProtectionCreate = new MSDTemplate();
|
||||
$tplHomeProtectionCreate->set_filenames(
|
||||
array('tplHomeProtectionCreate' => 'tpl/home/protection_create.tpl')
|
||||
);
|
||||
$tplHomeProtectionCreate->assign_vars(array('THEME' => $config['theme']));
|
||||
|
||||
if (isset($_POST['username'])) {
|
||||
// Form submitted
|
||||
if ($username == '') {
|
||||
$error[] = $lang['L_HTACC_NO_USERNAME'];
|
||||
}
|
||||
if (($userpassOne != $userpassConfirm) || ($userpassOne == '')) {
|
||||
$error[] = $lang['L_PASSWORDS_UNEQUAL'];
|
||||
}
|
||||
|
||||
if (sizeof($error) == 0) {
|
||||
$realm = 'MySQLDumper';
|
||||
$htaccess = "AuthName \"" . $realm
|
||||
. "\"\nAuthType Basic\nAuthUserFile \""
|
||||
. $config['paths']['root'] . ".htpasswd\"\nrequire valid-user\n";
|
||||
switch ($type)
|
||||
{
|
||||
// Crypt
|
||||
case 0:
|
||||
$userpass = crypt($userpassOne);
|
||||
break;
|
||||
// MD5
|
||||
case 1:
|
||||
$userpass = md5($username . ':' . $realm . ':' . $userpassOne);
|
||||
break;
|
||||
// Win - no encryption
|
||||
case 2:
|
||||
$userpass = $userpassOne;
|
||||
break;
|
||||
// SHA
|
||||
case 3:
|
||||
if (version_compare(PHP_VERSION, '5.0.0', '>=')) {
|
||||
$userpass = '{SHA}' . base64_encode(sha1($userpassOne, TRUE));
|
||||
} else {
|
||||
$userpass = '{SHA}' . base64_encode(sha1($userpassOne));
|
||||
}
|
||||
break;
|
||||
}
|
||||
$htpasswd = $username . ':' . $userpass;
|
||||
@chmod($config['paths']['root'], 0777);
|
||||
|
||||
$saved = true;
|
||||
// save .htpasswd
|
||||
if ($f = @fopen('.htpasswd', 'w')) {
|
||||
$saved = fputs($f, $htpasswd);
|
||||
fclose($f);
|
||||
}
|
||||
|
||||
// save .htaccess
|
||||
if (false !== $saved) {
|
||||
$f = @fopen('.htaccess', 'w');
|
||||
if ($f) {
|
||||
$saved = fputs($f, $htaccess);
|
||||
fclose($f);
|
||||
} else {
|
||||
$saved = false;
|
||||
}
|
||||
}
|
||||
|
||||
if (false !== $saved) {
|
||||
$msg = $lang['L_HTACC_CREATED'];
|
||||
$tplHomeProtectionCreate->assign_block_vars(
|
||||
'CREATE_SUCCESS',
|
||||
array(
|
||||
'HTACCESS' => nl2br(Html::replaceQuotes($htaccess)),
|
||||
'HTPASSWD' => nl2br(Html::replaceQuotes($htpasswd))
|
||||
)
|
||||
);
|
||||
@chmod($config['paths']['root'], 0755);
|
||||
} else {
|
||||
$tplHomeProtectionCreate->assign_block_vars(
|
||||
'CREATE_ERROR',
|
||||
array(
|
||||
'HTACCESS' => Html::replaceQuotes($htaccess),
|
||||
'HTPASSWD' => Html::replaceQuotes($htpasswd)
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (sizeof($error) > 0 || !isset($_POST['username'])) {
|
||||
$tplHomeProtectionCreate->assign_vars(
|
||||
array(
|
||||
'PASSWORDS_UNEQUAL' =>
|
||||
Html::getJsQuote($lang['L_PASSWORDS_UNEQUAL']),
|
||||
'HTACC_CONFIRM_DELETE' =>
|
||||
Html::getJsQuote($lang['L_HTACC_CONFIRM_DELETE'])
|
||||
)
|
||||
);
|
||||
|
||||
$tplHomeProtectionCreate->assign_block_vars(
|
||||
'INPUT',
|
||||
array(
|
||||
'USERNAME' => Html::replaceQuotes($username),
|
||||
'USERPASS1' => Html::replaceQuotes($userpassOne),
|
||||
'USERPASS2' => Html::replaceQuotes($userpassConfirm),
|
||||
'TYPE0_CHECKED' => Html::getChecked($type, 0),
|
||||
'TYPE1_CHECKED' => Html::getChecked($type, 1),
|
||||
'TYPE2_CHECKED' => Html::getChecked($type, 2),
|
||||
'TYPE3_CHECKED' => Html::getChecked($type, 3)
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
if (!empty($error)) {
|
||||
$msg = '<span class="error">' . implode('<br />', $error) . '</span>';
|
||||
}
|
||||
if ($msg > '') {
|
||||
$tplHomeProtectionCreate->assign_block_vars(
|
||||
'MSG', array('TEXT' => $msg)
|
||||
);
|
||||
}
|
||||
17
inc/home/protection_delete.php
Normale Datei
17
inc/home/protection_delete.php
Normale Datei
|
|
@ -0,0 +1,17 @@
|
|||
<?php
|
||||
/**
|
||||
* This file is part of MySQLDumper released under the GNU/GPL 2 license
|
||||
* http://www.mysqldumper.net
|
||||
*
|
||||
* @package MySQLDumper
|
||||
* @version SVN: $rev: 1207 $
|
||||
* @author $Author$
|
||||
* @lastmodified $Date$
|
||||
*/
|
||||
|
||||
if (!defined('MSD_VERSION')) die('No direct access.');
|
||||
@unlink($config['paths']['root'] . '.htaccess');
|
||||
@unlink($config['paths']['root'] . '.htpasswd');
|
||||
$action = 'status';
|
||||
|
||||
//TODO -> give user info about success or failure of deleting action
|
||||
57
inc/home/protection_edit.php
Normale Datei
57
inc/home/protection_edit.php
Normale Datei
|
|
@ -0,0 +1,57 @@
|
|||
<?php
|
||||
/**
|
||||
* This file is part of MySQLDumper released under the GNU/GPL 2 license
|
||||
* http://www.mysqldumper.net
|
||||
*
|
||||
* @package MySQLDumper
|
||||
* @version SVN: $rev: 1207 $
|
||||
* @author $Author$
|
||||
* @lastmodified $Date$
|
||||
*/
|
||||
|
||||
if (!defined('MSD_VERSION')) die('No direct access.');
|
||||
include ('./inc/define_icons.php');
|
||||
$hta = '';
|
||||
|
||||
$tplHomeProtectionEdit = new MSDTemplate();
|
||||
$tplHomeProtectionEdit->set_filenames(
|
||||
array('tplHomeProtectionEdit' => 'tpl/home/protection_edit.tpl')
|
||||
);
|
||||
|
||||
if (isset($_POST['hta_content'])) {
|
||||
if ($fp = fopen('./.htaccess', 'w')) {
|
||||
if (fwrite($fp, $_POST['hta_content'])) {
|
||||
$tplHomeProtectionEdit->assign_block_vars(
|
||||
'HTA_SAVED_SUCCESSFULLY', array()
|
||||
);
|
||||
} else {
|
||||
$tplHomeProtectionEdit->assign_block_vars(
|
||||
'HTA_SAVED_UNSUCCESSFULLY', array()
|
||||
);
|
||||
}
|
||||
fclose($fp);
|
||||
} else {
|
||||
$tplHomeProtectionEdit->assign_block_vars(
|
||||
'ERROR_OPENING_HTACCESS', array()
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
if (file_exists('./.htaccess') && is_readable('./.htaccess')) {
|
||||
$hta = implode('', file('./.htaccess'));
|
||||
} else {
|
||||
$tplHomeProtectionEdit->assign_block_vars(
|
||||
'ERROR_OPENING_HTACCESS', array()
|
||||
);
|
||||
}
|
||||
|
||||
$tplHomeProtectionEdit->assign_vars(
|
||||
array(
|
||||
'HTA_CONTENT' => htmlspecialchars($hta, ENT_COMPAT, 'UTF-8'),
|
||||
'ICON_SEARCH' => $icon['search'],
|
||||
'ICON_OPEN_FILE' => $icon['small']['open_file'],
|
||||
'ICON_SAVE' => $icon['small']['save'],
|
||||
'ICON_DELETE' => $icon['delete'],
|
||||
'ICON_ARROW_LEFT' => $icon['arrow_left']
|
||||
)
|
||||
);
|
||||
Laden …
Tabelle hinzufügen
Einen Link hinzufügen
In neuem Issue referenzieren