Initial commit
This commit is contained in:
230
msd/inc/home/databases.php
Normal file
230
msd/inc/home/databases.php
Normal file
@ -0,0 +1,230 @@
|
||||
<?php
|
||||
/* ----------------------------------------------------------------------
|
||||
|
||||
MyOOS [Dumper]
|
||||
http://www.oos-shop.de/
|
||||
|
||||
Copyright (c) 2016 by the MyOOS Development Team.
|
||||
----------------------------------------------------------------------
|
||||
Based on:
|
||||
|
||||
MySqlDumper
|
||||
http://www.mysqldumper.de
|
||||
|
||||
Copyright (C)2004-2011 Daniel Schlichtholz (admin@mysqldumper.de)
|
||||
----------------------------------------------------------------------
|
||||
Released under the GNU General Public License
|
||||
---------------------------------------------------------------------- */
|
||||
|
||||
if (!defined('MSD_VERSION')) die('No direct access.');
|
||||
include('./language/'.$config['language'].'/lang_sql.php');
|
||||
$checkit=(isset($_GET['checkit'])) ? urldecode($_GET['checkit']) : '';
|
||||
$repair=(isset($_GET['repair'])) ? $_GET['repair'] : 0;
|
||||
$enableKeys=(isset($_GET['enableKeys'])) ? $_GET['enableKeys'] : '';
|
||||
for ($i=0; $i<count($databases['Name']); $i++)
|
||||
{
|
||||
if (isset($_POST['empty'.$i]))
|
||||
{
|
||||
EmptyDB($databases['Name'][$i]);
|
||||
$dba='<p class="green">'.$lang['L_DB']." ".$databases['Name'][$i]." ".$lang['L_INFO_CLEARED']."</p>";
|
||||
break;
|
||||
}
|
||||
if (isset($_POST['kill'.$i]))
|
||||
{
|
||||
$res=mysqli_query($config['dbconnection'], 'DROP DATABASE `'.$databases['Name'][$i].'`') or die(mysqli_error($config['dbconnection']));
|
||||
$dba='<p class="green">'.$lang['L_DB'].' '.$databases['Name'][$i].' '.$lang['L_INFO_DELETED'].'</p>';
|
||||
SetDefault();
|
||||
include ($config['files']['parameter']);
|
||||
echo '<script language="JavaScript">parent.MyOOS_Dumper_menu.location.href="menu.php?action=dbrefresh";</script>';
|
||||
break;
|
||||
}
|
||||
if (isset($_POST['optimize'.$i]))
|
||||
{
|
||||
mysqli_select_db($config['dbconnection'], $databases['Name'][$i]);
|
||||
$res=mysqli_query($config['dbconnection'], 'SHOW TABLES FROM `'.$databases['Name'][$i].'`');
|
||||
$tabellen='';
|
||||
while ($row=mysqli_fetch_row($res))
|
||||
$tabellen.='`'.$row[0].'`,';
|
||||
$tabellen=substr($tabellen,0,(strlen($tabellen)-1));
|
||||
if ($tabellen>"")
|
||||
{
|
||||
$query="OPTIMIZE TABLE ".$tabellen;
|
||||
$res=mysqli_query($config['dbconnection'], $query) or die(mysqli_error($config['dbconnection'])."");
|
||||
}
|
||||
$_GET['dbid']=$i;
|
||||
$dba='<p class="green">'.$lang['L_DB'].' <b>'.$databases['Name'][$i].'</b> '.$lang['L_INFO_OPTIMIZED'].'.</p>';
|
||||
break;
|
||||
}
|
||||
if (isset($_POST['check'.$i]))
|
||||
{
|
||||
$checkit="ALL";
|
||||
$_GET['dbid']=$i;
|
||||
}
|
||||
if (isset($_POST['enableKeys'.$i])) {
|
||||
$enableKeys="ALL";
|
||||
$_GET['dbid']=$i;
|
||||
}
|
||||
}
|
||||
|
||||
//list databases
|
||||
$tpl=new MSDTemplate();
|
||||
$tpl->set_filenames(array(
|
||||
'show' => './tpl/home/databases_list_dbs.tpl'));
|
||||
$tpl->assign_vars(array(
|
||||
'ICONPATH' => $config['files']['iconpath']));
|
||||
|
||||
if (!isset($config['dbconnection'])) MSD_mysql_connect();
|
||||
for ($i=0; $i<count($databases['Name']); $i++)
|
||||
{
|
||||
$rowclass=($i%2) ? 'dbrow' : 'dbrow1';
|
||||
if ($i==$databases['db_selected_index']) $rowclass="dbrowsel";
|
||||
|
||||
//gibts die Datenbank überhaupt?
|
||||
if (!mysqli_select_db($config['dbconnection'], $databases['Name'][$i]))
|
||||
{
|
||||
$tpl->assign_block_vars('DB_NOT_FOUND',array(
|
||||
'ROWCLASS' => $rowclass,
|
||||
'NR' => ($i+1),
|
||||
'DB_NAME' => $databases['Name'][$i],
|
||||
'DB_ID' => $i));
|
||||
}
|
||||
else
|
||||
{
|
||||
mysqli_select_db($config['dbconnection'], $databases['Name'][$i]);
|
||||
$tabellen=mysqli_query($config['dbconnection'], 'SHOW TABLES FROM `'.$databases['Name'][$i].'`');
|
||||
$num_tables=mysqli_num_rows($tabellen);
|
||||
$tpl->assign_block_vars('ROW',array(
|
||||
'ROWCLASS' => $rowclass,
|
||||
'NR' => ($i+1),
|
||||
'DB_NAME' => $databases['Name'][$i],
|
||||
'DB_ID' => $i,
|
||||
'TABLE_COUNT' => $num_tables));
|
||||
if ($num_tables==1) $tpl->assign_block_vars('ROW.TABLE',array());
|
||||
else
|
||||
$tpl->assign_block_vars('ROW.TABLES',array());
|
||||
}
|
||||
}
|
||||
$tpl->pparse('show');
|
||||
|
||||
//list tables of selected database
|
||||
if (isset($_GET['dbid']))
|
||||
{
|
||||
$disabled_keys_found = false;
|
||||
|
||||
// Output list of tables of the selected database
|
||||
$tpl=new MSDTemplate();
|
||||
$tpl->set_filenames(array(
|
||||
'show' => 'tpl/home/databases_list_tables.tpl'));
|
||||
$dbid=$_GET['dbid'];
|
||||
|
||||
$numrows=0;
|
||||
$res=@mysqli_query($config['dbconnection'], "SHOW TABLE STATUS FROM `".$databases['Name'][$dbid]."`");
|
||||
mysqli_select_db($config['dbconnection'], $databases['Name'][$dbid]);
|
||||
if ($res) $numrows=mysqli_num_rows($res);
|
||||
$tpl->assign_vars(array(
|
||||
'DB_NAME' => $databases['Name'][$dbid],
|
||||
'DB_NAME_URLENCODED' => urlencode($databases['Name'][$dbid]),
|
||||
'DB_ID' => $dbid,
|
||||
'TABLE_COUNT' => $numrows,
|
||||
'ICONPATH' => $config['files']['iconpath']));
|
||||
$numrows=intval($numrows);
|
||||
if ($numrows>1) $tpl->assign_block_vars('MORE_TABLES',array());
|
||||
elseif ($numrows==1) $tpl->assign_block_vars('1_TABLE',array());
|
||||
elseif ($numrows==0) $tpl->assign_block_vars('NO_TABLE',array());
|
||||
if ($numrows>0)
|
||||
{
|
||||
$last_update="2000-01-01 00:00:00";
|
||||
$sum_records=$sum_data_length='';
|
||||
for ($i=0; $i<$numrows; $i++)
|
||||
{
|
||||
$row=mysqli_fetch_array($res,MYSQLI_ASSOC);
|
||||
// Get nr of records -> need to do it this way because of incorrect returns when using InnoDBs
|
||||
$sql_2="SELECT count(*) as `count_records` FROM `".$databases['Name'][$dbid]."`.`".$row['Name']."`";
|
||||
$res2=@mysqli_query($config['dbconnection'], $sql_2);
|
||||
if ($res2===false)
|
||||
{
|
||||
$row['Rows']=0;
|
||||
$rowclass='dbrowsel';
|
||||
}
|
||||
else
|
||||
{
|
||||
$row2=mysqli_fetch_array($res2);
|
||||
$row['Rows']=$row2['count_records'];
|
||||
$rowclass=($i%2) ? 'dbrow' : 'dbrow1';
|
||||
}
|
||||
|
||||
if (isset($row['Update_time'])&&strtotime($row['Update_time'])>strtotime($last_update)) $last_update=$row['Update_time'];
|
||||
$sum_records+=$row['Rows'];
|
||||
$sum_data_length+=$row['Data_length']+$row['Index_length'];
|
||||
|
||||
$keys_disabled = false;
|
||||
if ($row['Engine'] == "MyIsam") {
|
||||
}
|
||||
$tpl->assign_block_vars('ROW',array(
|
||||
'ROWCLASS' => $rowclass,
|
||||
'NR' => ($i+1),
|
||||
'TABLE_NAME' => $row['Name'],
|
||||
'TABLE_NAME_URLENCODED' => urlencode($row['Name']),
|
||||
'RECORDS' => $row['Rows'],
|
||||
'SIZE' => byte_output($row['Data_length']+$row['Index_length']),
|
||||
'LAST_UPDATE' => $row['Update_time'],
|
||||
'ENGINE' => $row['Engine'],
|
||||
));
|
||||
|
||||
// Otimize & Repair - only for MyISAM-Tables
|
||||
if ($row['Engine']=='MyISAM')
|
||||
{
|
||||
if ($row['Data_free']==0) $tpl->assign_block_vars('ROW.OPTIMIZED',array());
|
||||
else
|
||||
$tpl->assign_block_vars('ROW.NOT_OPTIMIZED',array());
|
||||
|
||||
if ($checkit==$row['Name']||$repair==1)
|
||||
{
|
||||
$tmp_res=mysqli_query($config['dbconnection'], "REPAIR TABLE `".$row['Name']."`");
|
||||
}
|
||||
|
||||
if (($checkit==$row['Name']||$checkit=='ALL'))
|
||||
{
|
||||
// table needs to be checked
|
||||
$tmp_res=mysqli_query($config['dbconnection'], 'CHECK TABLE `'.$row['Name'].'`');
|
||||
if ($tmp_res)
|
||||
{
|
||||
$tmp_row=mysqli_fetch_row($tmp_res);
|
||||
if ($tmp_row[3]=='OK') $tpl->assign_block_vars('ROW.CHECK_TABLE_OK',array());
|
||||
else
|
||||
$tpl->assign_block_vars('ROW.CHECK_TABLE_NOT_OK',array());
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// Show Check table link
|
||||
$tpl->assign_block_vars('ROW.CHECK_TABLE',array());
|
||||
}
|
||||
if ($enableKeys==$row['Name'] || $enableKeys=="ALL")
|
||||
{
|
||||
$sSql= "ALTER TABLE `".$databases['Name'][$dbid]."`.`".$row['Name']."` ENABLE KEYS";
|
||||
$tmp_res=mysqli_query($config['dbconnection'], $sSql);
|
||||
}
|
||||
$res3=mysqli_query($config['dbconnection'], 'SHOW INDEX FROM `'.$databases['Name'][$dbid]."`.`".$row['Name']."`");
|
||||
while ($row3 = mysqli_fetch_array($res3, MYSQLI_ASSOC))
|
||||
{
|
||||
if ($row3['Comment']=="disabled") {
|
||||
$keys_disabled = true;
|
||||
$disabled_keys_found = true;
|
||||
}
|
||||
}
|
||||
if ($keys_disabled) $tpl->assign_block_vars('ROW.KEYS_DISABLED', array());
|
||||
else $tpl->assign_block_vars('ROW.KEYS_ENABLED', array());
|
||||
}
|
||||
|
||||
}
|
||||
// Output sum-row
|
||||
$tpl->assign_block_vars('SUM',array(
|
||||
'RECORDS' => number_format($sum_records,0,",","."),
|
||||
'SIZE' => byte_output($sum_data_length),
|
||||
'LAST_UPDATE' => $last_update));
|
||||
if ($disabled_keys_found) $tpl->assign_block_vars('DISABLED_KEYS_FOUND', array());
|
||||
|
||||
}
|
||||
$tpl->pparse('show');
|
||||
}
|
81
msd/inc/home/home.php
Normal file
81
msd/inc/home/home.php
Normal file
@ -0,0 +1,81 @@
|
||||
<?php
|
||||
/* ----------------------------------------------------------------------
|
||||
|
||||
MyOOS [Dumper]
|
||||
http://www.oos-shop.de/
|
||||
|
||||
Copyright (c) 2016 by the MyOOS Development Team.
|
||||
----------------------------------------------------------------------
|
||||
Based on:
|
||||
|
||||
MySqlDumper
|
||||
http://www.mysqldumper.de
|
||||
|
||||
Copyright (C)2004-2011 Daniel Schlichtholz (admin@mysqldumper.de)
|
||||
----------------------------------------------------------------------
|
||||
Released under the GNU General Public License
|
||||
---------------------------------------------------------------------- */
|
||||
|
||||
|
||||
if (!defined('MSD_VERSION')) die('No direct access.');
|
||||
$Sum_Files=$Sum_Size=0;
|
||||
$Last_BU=Array();
|
||||
$is_htaccess=(file_exists('./.htaccess'));
|
||||
|
||||
// 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;
|
||||
$Sum_Files++;
|
||||
$Sum_Size+=filesize($config['paths']['backup'].$filename);
|
||||
$ft=filectime($config['paths']['backup'].$filename);
|
||||
if (!isset($Last_BU[2])||(isset($Last_BU[2])&&$ft>$Last_BU[2]))
|
||||
{
|
||||
$Last_BU[0]=$filename;
|
||||
$Last_BU[1]=date("d.m.Y H:i",$ft);
|
||||
$Last_BU[2]=$ft;
|
||||
}
|
||||
}
|
||||
}
|
||||
$directory_warnings=DirectoryWarnings();
|
||||
|
||||
$tpl=new MSDTemplate();
|
||||
$tpl->set_filenames(array(
|
||||
'show' => 'tpl/home/home.tpl'));
|
||||
$tpl->assign_vars(array(
|
||||
'THEME' => $config['theme'],
|
||||
'MSD_VERSION' => MSD_VERSION,
|
||||
'OS' => MSD_OS,
|
||||
'OS_EXT' => MSD_OS_EXT,
|
||||
'MYSQL_VERSION' => MSD_MYSQL_VERSION,
|
||||
'PHP_VERSION' => PHP_VERSION,
|
||||
'MEMORY' => byte_output($config['php_ram']*1024*1024),
|
||||
'MAX_EXECUTION_TIME' => $config['max_execution_time'],
|
||||
'PHP_EXTENSIONS' => $config['phpextensions'],
|
||||
'SERVER_NAME' => $_SERVER['SERVER_NAME'],
|
||||
'MSD_PATH' => $config['paths']['root'],
|
||||
'DB' => $databases['db_actual'],
|
||||
'NR_OF_BACKUP_FILES' => $Sum_Files,
|
||||
'SIZE_BACKUPS' => byte_output($Sum_Size),
|
||||
'FREE_DISKSPACE' => MD_FreeDiskSpace()));
|
||||
if ($directory_warnings>'') $tpl->assign_block_vars('DIRECTORY_WARNINGS',array(
|
||||
'MSG' => $directory_warnings));
|
||||
|
||||
if ($config['disabled']>'') $tpl->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','<=')) $tpl->assign_block_vars('ZLIBBUG',array());
|
||||
if (!extension_loaded('ftp')) $tpl->assign_block_vars('NO_FTP',array());
|
||||
if (!$config['zlib']) $tpl->assign_block_vars('NO_ZLIB',array());
|
||||
if ($is_htaccess) $tpl->assign_block_vars('HTACCESS_EXISTS',array());
|
||||
else
|
||||
$tpl->assign_block_vars('HTACCESS_DOESNT_EXISTS',array());
|
||||
if ($Sum_Files>0&&isset($Last_BU[1])) $tpl->assign_block_vars('LAST_BACKUP',array(
|
||||
'LAST_BACKUP_INFO' => $Last_BU[1],
|
||||
'LAST_BACKUP_LINK' => $config['paths']['backup'].urlencode($Last_BU[0]),
|
||||
'LAST_BACKUP_NAME' => $Last_BU[0]));
|
||||
$tpl->pparse('show');
|
129
msd/inc/home/mysql_variables.php
Normal file
129
msd/inc/home/mysql_variables.php
Normal file
@ -0,0 +1,129 @@
|
||||
<?php
|
||||
/* ----------------------------------------------------------------------
|
||||
|
||||
MyOOS [Dumper]
|
||||
http://www.oos-shop.de/
|
||||
|
||||
Copyright (c) 2016 by the MyOOS Development Team.
|
||||
----------------------------------------------------------------------
|
||||
Based on:
|
||||
|
||||
MySqlDumper
|
||||
http://www.mysqldumper.de
|
||||
|
||||
Copyright (C)2004-2011 Daniel Schlichtholz (admin@mysqldumper.de)
|
||||
----------------------------------------------------------------------
|
||||
Released under the GNU General Public License
|
||||
---------------------------------------------------------------------- */
|
||||
|
||||
if (!defined('MSD_VERSION')) die('No direct access.');
|
||||
$var=(isset($_GET['var'])) ? $_GET['var'] : "prozesse";
|
||||
$Titelausgabe=array(
|
||||
|
||||
"variables" => $lang['L_VARIABELN'], "status" => $lang['L_STATUS'], "prozesse" => $lang['L_PROZESSE']);
|
||||
echo '<h5>'.$lang['L_MYSQLVARS'].'</h5><strong>'.$Titelausgabe[$var].'</strong> ';
|
||||
echo '<a href="main.php?action=vars&var=prozesse">'.$lang['L_PROZESSE'].'</a> ';
|
||||
echo '<a href="main.php?action=vars&var=status">'.$lang['L_STATUS'].'</a> ';
|
||||
echo '<a href="main.php?action=vars&var=variables">'.$lang['L_VARIABELN'].'</a> ';
|
||||
|
||||
echo '<p> </p>';
|
||||
//Variabeln
|
||||
switch ($var)
|
||||
{
|
||||
case "variables":
|
||||
$res=@mysqli_query($config['dbconnection'], "SHOW variables");
|
||||
if ($res) $numrows=mysqli_num_rows($res);
|
||||
if ($numrows==0)
|
||||
{
|
||||
echo $lang['L_INFO_NOVARS'];
|
||||
}
|
||||
else
|
||||
{
|
||||
echo '<table class="bdr"><tr class="thead"><th><strong>Name</strong></th><th><strong>'.$lang['L_INHALT'].'</strong></th></tr>';
|
||||
for ($i=0; $i<$numrows; $i++)
|
||||
{
|
||||
$row=mysqli_fetch_array($res);
|
||||
$cl=($i%2) ? "dbrow" : "dbrow1";
|
||||
echo '<tr class="'.$cl.'"><td align="left">'.$row[0].'</td><td align="left">'.$row[1].'</td></tr>';
|
||||
}
|
||||
}
|
||||
echo '</table>';
|
||||
break;
|
||||
case "status":
|
||||
$res=@mysqli_query($config['dbconnection'], "SHOW STATUS");
|
||||
if ($res) $numrows=mysqli_num_rows($res);
|
||||
if ($numrows==0)
|
||||
{
|
||||
echo $lang['L_INFO_NOSTATUS'];
|
||||
}
|
||||
else
|
||||
{
|
||||
echo '<table class="bdr"><tr class="thead"><th>Name</th><th>'.$lang['L_INHALT'].'</th></tr>';
|
||||
for ($i=0; $i<$numrows; $i++)
|
||||
{
|
||||
$cl=($i%2) ? "dbrow" : "dbrow1";
|
||||
$row=mysqli_fetch_array($res);
|
||||
echo '<tr class="'.$cl.'"><td align="left" valign="top">'.$row[0].'</td><td align="left" valign="top">'.$row[1].'</td></tr>';
|
||||
}
|
||||
}
|
||||
echo '</table>';
|
||||
break;
|
||||
case "prozesse":
|
||||
if ($config['processlist_refresh']<1000) $config['processlist_refresh']=2000;
|
||||
if (isset($_GET['killid'])&&$_GET['killid']>0)
|
||||
{
|
||||
$killid=(isset($_GET['killid'])) ? $_GET['killid'] : 0;
|
||||
$wait=(isset($_GET['wait'])) ? $_GET['wait'] : 0;
|
||||
if ($wait==0)
|
||||
{
|
||||
$ret=mysqli_query($config['dbconnection'], "KILL ".$_GET['killid']);
|
||||
$wait=2;
|
||||
}
|
||||
else
|
||||
$wait+=2;
|
||||
|
||||
if ($wait==0)
|
||||
{
|
||||
echo '<p class="success">'.$lang['L_PROCESSKILL1'].$_GET['killid'].' '.$lang['L_PROCESSKILL2'].'</p>';
|
||||
}
|
||||
else
|
||||
{
|
||||
echo '<p class="success">'.$lang['L_PROCESSKILL3'].$wait.$lang['L_PROCESSKILL4'].$_GET['killid'].' '.$lang['L_PROCESSKILL2'].'</p>';
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
$killid=$wait=0;
|
||||
$res=@mysqli_query($config['dbconnection'], "SHOW FULL PROCESSLIST ");
|
||||
if ($res) $numrows=mysqli_num_rows($res);
|
||||
if ($numrows==0)
|
||||
{
|
||||
echo $lang['L_INFO_NOPROCESSES'];
|
||||
}
|
||||
else
|
||||
{
|
||||
echo '<table class="bdr" style="width:100%"><tr class="thead"><th>ID</th><th>User</th><th>Host</th><th>DB</th><th>Command</th><th>Time</th><th>State</th><th width="800">Info</th><th nowrap="nowrap">RT: '.round($config['processlist_refresh']/1000).' sec</th></tr>';
|
||||
for ($i=0; $i<$numrows; $i++)
|
||||
{
|
||||
$cl=($i%2) ? "dbrow" : "dbrow1";
|
||||
$row=mysqli_fetch_array($res);
|
||||
echo '<tr><td>'.$row[0].'</td><td>'.$row[1].'</td>
|
||||
<td>'.$row[2].'</td><td>'.$row[3].'</td><td>'.$row[4].'</td><td>'.$row[5].'</td>
|
||||
<td>'.$row[6].'</td><td>'.$row[7].'</td>
|
||||
<td><a href="main.php?action=vars&var=prozesse&killid='.$row[0].'">kill</a></td></tr>';
|
||||
if ($row[0]==$killid&&$row[4]=="Killed")
|
||||
{
|
||||
$wait=$killid=0;
|
||||
}
|
||||
}
|
||||
}
|
||||
echo '</table>';
|
||||
echo '<form name="f" method="get" action="main.php">
|
||||
<input type="hidden" name="wait" value="'.$wait.'">
|
||||
<input type="hidden" name="killid" value="'.$killid.'">
|
||||
<input type="hidden" name="action" value="vars">
|
||||
<input type="hidden" name="var" value="prozesse"></form>';
|
||||
echo '<script language="JavaScript" type="text/javascript">window.setTimeout("document.f.submit();","'.$config['processlist_refresh'].'");</script>';
|
||||
|
||||
break;
|
||||
}
|
157
msd/inc/home/protection_create.php
Normal file
157
msd/inc/home/protection_create.php
Normal file
@ -0,0 +1,157 @@
|
||||
<?php
|
||||
/* ----------------------------------------------------------------------
|
||||
|
||||
MyOOS [Dumper]
|
||||
http://www.oos-shop.de/
|
||||
|
||||
Copyright (c) 2016 by the MyOOS Development Team.
|
||||
----------------------------------------------------------------------
|
||||
Based on:
|
||||
|
||||
MySqlDumper
|
||||
http://www.mysqldumper.de
|
||||
|
||||
Copyright (C)2004-2011 Daniel Schlichtholz (admin@mysqldumper.de)
|
||||
----------------------------------------------------------------------
|
||||
Released under the GNU General Public License
|
||||
---------------------------------------------------------------------- */
|
||||
|
||||
if (!defined('MSD_VERSION')) die('No direct access.');
|
||||
include ('./language/'.$config['language'].'/lang_sql.php');
|
||||
|
||||
$dba=$hta_dir=$Overwrite=$msg='';
|
||||
$error=array();
|
||||
$is_htaccess=(file_exists('./.htaccess'));
|
||||
if ($is_htaccess)
|
||||
{
|
||||
$Overwrite='<p class="error">'.$lang['L_HTACCESS8'].'</p>';
|
||||
$htaccess_exist=file('.htaccess'); // read .htaccess
|
||||
}
|
||||
|
||||
$step=(isset($_POST['step'])) ? intval($_POST['step']) : 0;
|
||||
$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=intval($_POST['type']);
|
||||
$username=(isset($_POST['username'])) ? $_POST['username'] : '';
|
||||
$userpass1=(isset($_POST['userpass1'])) ? $_POST['userpass1'] : '';
|
||||
$userpass2=(isset($_POST['userpass2'])) ? $_POST['userpass2'] : '';
|
||||
|
||||
header('Pragma: no-cache');
|
||||
header("Cache-Control: no-cache, must-revalidate");
|
||||
header("Expires: -1");
|
||||
header('Content-Type: text/html; charset=UTF-8');
|
||||
$tpl=new MSDTemplate();
|
||||
$tpl->set_filenames(array(
|
||||
'show' => './tpl/home/protection_create.tpl'));
|
||||
$tpl->assign_vars(array(
|
||||
'THEME' => $config['theme'],
|
||||
'HEADLINE' => headline($lang['L_HTACC_CREATE'])));
|
||||
|
||||
if (isset($_POST['username']))
|
||||
{
|
||||
// Form submitted
|
||||
if ($username=='') $error[]=$lang['L_HTACC_NO_USERNAME'];
|
||||
if (($userpass1!=$userpass2)||($userpass1=='')) $error[]=$lang['L_PASSWORDS_UNEQUAL'];
|
||||
|
||||
if (sizeof($error)==0)
|
||||
{
|
||||
$htaccess = "<IfModule mod_rewrite.c>\nRewriteEngine off\n</IfModule>\n";
|
||||
$realm='MyOOS-Dumper';
|
||||
$htaccess.="AuthName \"".$realm."\"\nAuthType Basic\nAuthUserFile \""
|
||||
.$config['paths']['root'].".htpasswd\"\nrequire valid-user";
|
||||
switch ($type)
|
||||
{
|
||||
// Crypt
|
||||
case 0:
|
||||
$userpass=crypt($userpass1);
|
||||
break;
|
||||
// MD5
|
||||
case 1:
|
||||
$userpass=md5($username.':'.$realm.':'.$userpass1);
|
||||
break;
|
||||
// WIn - no encryption
|
||||
case 2:
|
||||
$userpass=$userpass1;
|
||||
break;
|
||||
// SHA
|
||||
case 3:
|
||||
$userpass='{SHA}'.base64_encode(sha1($userpass1,TRUE));
|
||||
break;
|
||||
}
|
||||
$htpasswd=$username.':'.$userpass;
|
||||
@chmod($config['paths']['root'],0777);
|
||||
|
||||
// save .htpasswd
|
||||
if ($file_htpasswd=@fopen('.htpasswd','w'))
|
||||
{
|
||||
$saved=fputs($file_htpasswd,$htpasswd);
|
||||
fclose($file_htpasswd);
|
||||
}
|
||||
else
|
||||
$saved=false;
|
||||
|
||||
// save .htaccess
|
||||
if (false!==$saved)
|
||||
{
|
||||
$file_htaccess=@fopen('.htaccess','w');
|
||||
if ($file_htaccess)
|
||||
{
|
||||
$saved=fputs($file_htaccess,$htaccess);
|
||||
fclose($file_htaccess);
|
||||
}
|
||||
else
|
||||
$saved=false;
|
||||
}
|
||||
|
||||
if (false!==$saved)
|
||||
{
|
||||
if (version_compare(PHP_VERSION, '5.3.0', '>=')) {
|
||||
$output = array(
|
||||
'HTACCESS' => nl2br(htmlspecialchars($htaccess), false),
|
||||
'HTPASSWD' => nl2br(htmlspecialchars($htpasswd), false)
|
||||
);
|
||||
} else {
|
||||
$output = array(
|
||||
'HTACCESS' => nl2br(htmlspecialchars($htaccess)),
|
||||
'HTPASSWD' => nl2br(htmlspecialchars($htpasswd))
|
||||
);
|
||||
}
|
||||
|
||||
$msg='<span class="success">'.$lang['L_HTACC_CREATED'].'</span>';
|
||||
$tpl->assign_block_vars('CREATE_SUCCESS', $output);
|
||||
@chmod($config['paths']['root'],0755);
|
||||
}
|
||||
else
|
||||
{
|
||||
$tpl->assign_block_vars('CREATE_ERROR',array(
|
||||
'HTACCESS' => htmlspecialchars($htaccess),
|
||||
'HTPASSWD' => htmlspecialchars($htpasswd)));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (sizeof($error)>0||!isset($_POST['username']))
|
||||
{
|
||||
$tpl->assign_vars(array(
|
||||
'PASSWORDS_UNEQUAL' => my_addslashes($lang['L_PASSWORDS_UNEQUAL']),
|
||||
'HTACC_CONFIRM_DELETE' => my_addslashes($lang['L_HTACC_CONFIRM_DELETE'])));
|
||||
|
||||
$tpl->assign_block_vars('INPUT',array(
|
||||
'USERNAME' => htmlspecialchars($username),
|
||||
'USERPASS1' => htmlspecialchars($userpass1),
|
||||
'USERPASS2' => htmlspecialchars($userpass2),
|
||||
'TYPE0_CHECKED' => $type==0 ? ' checked="checked"' : '',
|
||||
'TYPE1_CHECKED' => $type==1 ? ' checked="checked"' : '',
|
||||
'TYPE2_CHECKED' => $type==2 ? ' checked="checked"' : '',
|
||||
'TYPE3_CHECKED' => $type==3 ? ' checked="checked"' : ''));
|
||||
}
|
||||
|
||||
if (sizeof($error)>0) $msg='<span class="error">'.implode('<br>',$error).'</span>';
|
||||
if ($msg>'') $tpl->assign_block_vars('MSG',array(
|
||||
'TEXT' => $msg));
|
||||
|
||||
$tpl->pparse('show');
|
||||
|
||||
echo MSDFooter();
|
||||
ob_end_flush();
|
||||
die();
|
24
msd/inc/home/protection_delete.php
Normal file
24
msd/inc/home/protection_delete.php
Normal file
@ -0,0 +1,24 @@
|
||||
<?php
|
||||
/* ----------------------------------------------------------------------
|
||||
|
||||
MyOOS [Dumper]
|
||||
http://www.oos-shop.de/
|
||||
|
||||
Copyright (c) 2016 by the MyOOS Development Team.
|
||||
----------------------------------------------------------------------
|
||||
Based on:
|
||||
|
||||
MySqlDumper
|
||||
http://www.mysqldumper.de
|
||||
|
||||
Copyright (C)2004-2011 Daniel Schlichtholz (admin@mysqldumper.de)
|
||||
----------------------------------------------------------------------
|
||||
Released under the GNU General Public License
|
||||
---------------------------------------------------------------------- */
|
||||
|
||||
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
|
100
msd/inc/home/protection_edit.php
Normal file
100
msd/inc/home/protection_edit.php
Normal file
@ -0,0 +1,100 @@
|
||||
<?php
|
||||
/* ----------------------------------------------------------------------
|
||||
|
||||
MyOOS [Dumper]
|
||||
http://www.oos-shop.de/
|
||||
|
||||
Copyright (c) 2016 by the MyOOS Development Team.
|
||||
----------------------------------------------------------------------
|
||||
Based on:
|
||||
|
||||
MySqlDumper
|
||||
http://www.mysqldumper.de
|
||||
|
||||
Copyright (C)2004-2011 Daniel Schlichtholz (admin@mysqldumper.de)
|
||||
----------------------------------------------------------------------
|
||||
Released under the GNU General Public License
|
||||
---------------------------------------------------------------------- */
|
||||
|
||||
if (!defined('MSD_VERSION')) die('No direct access.');
|
||||
include ('./language/'.$config['language'].'/lang_sql.php');
|
||||
echo MSDHeader();
|
||||
echo headline($lang['L_HTACC_EDIT']);
|
||||
|
||||
$htaccessdontexist=0;
|
||||
|
||||
if (isset($_POST['hta_dir'])&&isset($_POST['hta_file'])&&is_dir($_POST['hta_dir']))
|
||||
{
|
||||
$hta_dir=$_POST['hta_dir'];
|
||||
$hta_file=$_POST['hta_file'];
|
||||
}
|
||||
else
|
||||
{
|
||||
$hta_dir=$config['paths']['root'];
|
||||
$hta_file='.htaccess';
|
||||
}
|
||||
if ($hta_dir!=''&substr($hta_dir,-1)!='/') $hta_dir.='/';
|
||||
$hta_complete=$hta_dir.$hta_file;
|
||||
|
||||
if ((isset($_GET['create'])&&$_GET['create']==1)||(isset($_POST['create'])&&$_POST['create']==1))
|
||||
{
|
||||
$fp=fopen($hta_complete,'w');
|
||||
fwrite($fp,"# created by MySQLDumper ".MSD_VERSION."\n");
|
||||
fclose($fp);
|
||||
}
|
||||
|
||||
if (isset($_POST['submit'])&&isset($_POST['thta']))
|
||||
{
|
||||
$fp=fopen($hta_complete,'w');
|
||||
fwrite($fp,$_POST['thta']);
|
||||
fclose($fp);
|
||||
}
|
||||
if (file_exists($hta_complete))
|
||||
{
|
||||
$htaccess_exist=file($hta_complete);
|
||||
}
|
||||
else
|
||||
{
|
||||
$htaccessdontexist=1;
|
||||
}
|
||||
|
||||
echo $lang['L_HTACCESS32'];
|
||||
echo '<br><br><form name="ehta" action="main.php?action=edithtaccess" method="post">';
|
||||
echo '<table>';
|
||||
echo '<tr><td>'.$lang['L_DIR'].':</td><td><input type="text" name="hta_dir" value="'.$hta_dir.'" size="60"></td></tr>';
|
||||
echo '<tr><td>'.$lang['L_FILE'].':</td><td><input type="text" name="hta_file" value="'.$hta_file.'"></td></tr>';
|
||||
echo '</table>';
|
||||
if ($htaccessdontexist!=1)
|
||||
{
|
||||
echo '<table class="bdr"><tr><td style="width:70%;"><textarea rows="25" cols="40" name="thta" id="thta">'.htmlspecialchars(implode("",$htaccess_exist)).'</textarea><br><br>';
|
||||
echo '</td><td valign="top">';
|
||||
//Presets
|
||||
echo '<h6>Presets</h6><p><strong>'.$lang['L_HTACCESS30'].'</strong><p>
|
||||
<a href="javascript:insertHTA(1,document.ehta.thta)">all-inkl</a><br>
|
||||
|
||||
<br><p><strong>'.$lang['L_HTACCESS31'].'</strong></p>
|
||||
<a href="javascript:insertHTA(101,document.ehta.thta)">'.$lang['L_HTACCESS20'].'</a><br>
|
||||
<a href="javascript:insertHTA(102,document.ehta.thta)">'.$lang['L_HTACCESS21'].'</a><br>
|
||||
<a href="javascript:insertHTA(103,document.ehta.thta)">'.$lang['L_HTACCESS22'].'</a><br>
|
||||
<a href="javascript:insertHTA(104,document.ehta.thta)">'.$lang['L_HTACCESS23'].'</a><br>
|
||||
<a href="javascript:insertHTA(105,document.ehta.thta)">'.$lang['L_HTACCESS24'].'</a><br>
|
||||
<a href="javascript:insertHTA(106,document.ehta.thta)">'.$lang['L_HTACCESS25'].'</a><br>
|
||||
<a href="javascript:insertHTA(107,document.ehta.thta)">'.$lang['L_HTACCESS26'].'</a><br>
|
||||
<a href="javascript:insertHTA(108,document.ehta.thta)">'.$lang['L_HTACCESS27'].'</a><br>
|
||||
<a href="javascript:insertHTA(109,document.ehta.thta)">'.$lang['L_HTACCESS28'].'</a><br>
|
||||
<br><a href="http://httpd.apache.org/docs/2.0/mod/directives.html" target="_blank">'.$lang['L_HTACCESS29'].'</a>';
|
||||
echo '</td></tr>';
|
||||
echo '<tr><td colspan="2">';
|
||||
echo '<input type="submit" name="submit" value=" '.$lang['L_SAVE'].' " class="Formbutton"> ';
|
||||
echo '<input type="reset" name="reset" value=" '.$lang['L_RESET'].' " class="Formbutton"> ';
|
||||
echo '<input type="submit" name="newload" value=" '.$lang['L_HTACCESS19'].' " class="Formbutton">';
|
||||
echo '</td></tr></table></form>';
|
||||
}
|
||||
else
|
||||
{
|
||||
echo '<br>'.$lang['L_FILE_MISSING'].': '.$hta_complete.'<br><br>';
|
||||
echo '<form action="" method="post"><input type="hidden" name="hta_dir" value="'.$hta_dir.'"><input type="hidden" name="hta_file" value="'.$hta_file.'"><input type="hidden" name="create" value="1"><input type="submit" name="createhtaccess" value="'.$lang['L_CREATE'].'" class="Formbutton"></form>';
|
||||
}
|
||||
echo '</div>';
|
||||
ob_end_flush();
|
||||
exit();
|
121
msd/inc/home/system.php
Normal file
121
msd/inc/home/system.php
Normal file
@ -0,0 +1,121 @@
|
||||
<?php
|
||||
/* ----------------------------------------------------------------------
|
||||
|
||||
MyOOS [Dumper]
|
||||
http://www.oos-shop.de/
|
||||
|
||||
Copyright (c) 2016 by the MyOOS Development Team.
|
||||
----------------------------------------------------------------------
|
||||
Based on:
|
||||
|
||||
MySqlDumper
|
||||
http://www.mysqldumper.de
|
||||
|
||||
Copyright (C)2004-2011 Daniel Schlichtholz (admin@mysqldumper.de)
|
||||
----------------------------------------------------------------------
|
||||
Released under the GNU General Public License
|
||||
---------------------------------------------------------------------- */
|
||||
|
||||
if (!defined('MSD_VERSION')) die('No direct access.');
|
||||
$sysaction=(isset($_GET['dosys'])) ? $_GET['dosys'] : 0;
|
||||
$msg="";
|
||||
$res=@mysqli_query($config['dbconnection'], "SHOW VARIABLES LIKE 'datadir'");
|
||||
if ($res)
|
||||
{
|
||||
$row=mysqli_fetch_array($res);
|
||||
$data_dir=$row[1];
|
||||
}
|
||||
switch ($sysaction)
|
||||
{
|
||||
case 1: //FLUSH PRIVILEGES
|
||||
$msg="> operating FLUSH PRIVILEGES<br>";
|
||||
$res=@mysqli_query($config['dbconnection'], "FLUSH PRIVILEGES");
|
||||
$meldung=mysqli_error($config['dbconnection']);
|
||||
if ($meldung!="")
|
||||
{
|
||||
$msg.='> MySQL-Error: '.$meldung;
|
||||
}
|
||||
else
|
||||
{
|
||||
$msg.="> Privileges were reloaded.";
|
||||
}
|
||||
break;
|
||||
case 2: //FLUSH STATUS
|
||||
$msg="> operating FLUSH STATUS<br>";
|
||||
$res=@mysqli_query($config['dbconnection'], "FLUSH STATUS");
|
||||
$meldung=mysqli_error($config['dbconnection']);
|
||||
if ($meldung!="")
|
||||
{
|
||||
$msg.='> MySQL-Error: '.$meldung;
|
||||
}
|
||||
else
|
||||
{
|
||||
$msg.="> Status was reset.";
|
||||
}
|
||||
break;
|
||||
case 3: //FLUSH HOSTS
|
||||
$msg="> operating FLUSH HOSTS<br>";
|
||||
$res=@mysqli_query($config['dbconnection'], "FLUSH HOSTS");
|
||||
$meldung=mysqli_error($config['dbconnection']);
|
||||
if ($meldung!="")
|
||||
{
|
||||
$msg.='> MySQL-Error: '.$meldung;
|
||||
}
|
||||
else
|
||||
{
|
||||
$msg.="> Hosts were reloaded.";
|
||||
;
|
||||
}
|
||||
break;
|
||||
case 4: //SHOW MASTER LOGS
|
||||
$msg="> operating SHOW MASTER LOGS<br>";
|
||||
$res=@mysqli_query($config['dbconnection'],"SHOW MASTER LOGS");
|
||||
$meldung=mysqli_error($config['dbconnection']);
|
||||
if ($meldung!="")
|
||||
{
|
||||
$msg.='> MySQL-Error: '.$meldung;
|
||||
}
|
||||
else
|
||||
{
|
||||
$numrows=mysqli_num_rows($res);
|
||||
if ($numrows==0||$numrows===false)
|
||||
{
|
||||
$msg.='> there are no master log-files';
|
||||
}
|
||||
else
|
||||
{
|
||||
$msg.='> there are '.$numrows.' logfiles<br>';
|
||||
for ($i=0; $i<$numrows; $i++)
|
||||
{
|
||||
$row=mysqli_fetch_row($res);
|
||||
$msg.='> '.$row[0].' '.(($data_dir) ? byte_output(@filesize($data_dir.$row[0])) : '').'<br>';
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
case 5: //RESET MASTER
|
||||
$msg="> operating RESET MASTER<br>";
|
||||
$res=@mysqli_query($config['dbconnection'], "RESET MASTER");
|
||||
$meldung=mysqli_error($config['dbconnection']);
|
||||
if ($meldung!="")
|
||||
{
|
||||
$msg.='> MySQL-Error: '.$meldung;
|
||||
}
|
||||
else
|
||||
{
|
||||
$msg.="> All Masterlogs were deleted.";
|
||||
}
|
||||
break;
|
||||
}
|
||||
echo '<h5>'.$lang['L_MYSQLSYS'].'</h5>';
|
||||
echo '<div id="hormenu"><ul>
|
||||
<li><a href="main.php?action=sys&dosys=1">Reload Privileges</a></li>
|
||||
<li><a href="main.php?action=sys&dosys=2">Reset Status</a></li>
|
||||
<li><a href="main.php?action=sys&dosys=3">Reload Hosts</a></li>
|
||||
<li><a href="main.php?action=sys&dosys=4">Show Log-Files</a></li>
|
||||
<li><a href="main.php?action=sys&dosys=5">Reset Master-Log</a></li>
|
||||
</ul></div>';
|
||||
echo '<div align="center" class="MySQLbox">';
|
||||
echo '> MySQL Dumper v'.MSD_VERSION.' - Output Console<br><br>';
|
||||
echo ($msg!="") ? $msg : '> waiting for operation ...<br>';
|
||||
echo '</div>';
|
Reference in New Issue
Block a user