Skip to content
This repository has been archived by the owner on Oct 4, 2022. It is now read-only.

Commit

Permalink
0.2.0
Browse files Browse the repository at this point in the history
  • Loading branch information
mazay committed Apr 7, 2012
1 parent f4cc126 commit 3351f46
Show file tree
Hide file tree
Showing 18 changed files with 480 additions and 58 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
2012.04.07 0.2.0
+++++++++++++++++++++
1. Added function to set default setting, such as FTP directory, ul/dl speed limit, etc.
2. Added configuration file.
3. Several bug fixes.

2012.04.06 0.1.2a
+++++++++++++++++++++
1. Added function for check database connection (ticket #1).
Expand Down
5 changes: 3 additions & 2 deletions blocks/db_connect.php
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
<?
include ("config.php");
$db = FALSE;
$db = mysql_connect ("localhost", "purewebui", "purewebui");
$db = mysql_connect ("$mysql_host", "$mysql_webui_user", "$mysql_webui_passwd");
if (!$db) {
$info = "<p align=\"center\" class=\"table_error\">Could not connect:" . mysql_error() . "</p>";
die (mysql_error());
}
$table = FALSE;
$table = mysql_select_db ("pureftpd", $db);
$table = mysql_select_db ("$mysql_database", $db);
if (!$table) {
$info = "<p align=\"center\" class=\"table_error\">Could not connect:" . mysql_error() . "</p>";
die (mysql_error());
Expand Down
36 changes: 36 additions & 0 deletions blocks/default.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
<?php
include ("db_connect.php");

$result = mysql_query ("SELECT * FROM settings WHERE name='ftp_dir'");
$array = mysql_fetch_array ($result);
$ftp_dir = $array["value"];

$result = mysql_query ("SELECT * FROM settings WHERE name='upload_speed'");
$array = mysql_fetch_array ($result);
$upload_speed = $array["value"];

$result = mysql_query ("SELECT * FROM settings WHERE name='download_speed'");
$array = mysql_fetch_array ($result);
$download_speed = $array["value"];

$result = mysql_query ("SELECT * FROM settings WHERE name='quota_size'");
$array = mysql_fetch_array ($result);
$quota_size = $array["value"];

$result = mysql_query ("SELECT * FROM settings WHERE name='quota_files'");
$array = mysql_fetch_array ($result);
$quota_files = $array["value"];

$result = mysql_query ("SELECT * FROM settings WHERE name='permitted_ip'");
$array = mysql_fetch_array ($result);
$permitted_ip = $array["value"];

$result = mysql_query ("SELECT * FROM settings WHERE name='pureftpd_conf_path'");
$array = mysql_fetch_array ($result);
$pureftpd_conf_path = $array["value"];

$result = mysql_query ("SELECT * FROM settings WHERE name='pureftpd_init_script_path'");
$array = mysql_fetch_array ($result);
$pureftpd_init_script_path = $array["value"];

?>
7 changes: 5 additions & 2 deletions blocks/footer.php
Original file line number Diff line number Diff line change
@@ -1,2 +1,5 @@
<td class="bottom_border"><div align="center"><p class="footer"><a href="http://pure-ftpd-webui.org/">Pure-FTPd WebUI</a> beta 0.1.1 © 2010-2011 Yevgeniy Valeyev</p></div></td>
</tr>
<?php
include ("version.php");
echo("<td class=\"bottom_border\"><div align=\"center\"><p class=\"footer\"><a href=\"http://pure-ftpd-webui.org/\">Pure-FTPd WebUI</a> $version © 2010-2012 Yevgeniy Valeyev</p></div></td>
</tr>");
?>
12 changes: 10 additions & 2 deletions blocks/menu.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,13 +33,21 @@
{
echo "<li><a href='daemon_control.php'><p class='menu_text'>$menu4_daemon</p></a></li>";
}
if ($master == "edit_settings.php")
{
echo "<li id='current'><a href='edit_settings.php'><p class='menu_text'>$menu5_settings</p></a></li>";
}
else
{
echo "<li><a href='edit_settings.php'><p class='menu_text'>$menu5_settings</p></a></li>";
}
if ($master == "webui_users.php")
{
echo "<li id='current'><a href='webui_users.php'><p class='menu_text'>$menu5_webuictl</p></a></li>";
echo "<li id='current'><a href='webui_users.php'><p class='menu_text'>$menu6_webuictl</p></a></li>";
}
else
{
echo "<li><a href='webui_users.php'><p class='menu_text'>$menu5_webuictl</p></a></li>";
echo "<li><a href='webui_users.php'><p class='menu_text'>$menu6_webuictl</p></a></li>";
}
?>
</ul>
Expand Down
19 changes: 4 additions & 15 deletions config.php
Original file line number Diff line number Diff line change
@@ -1,17 +1,6 @@
# Pure-FTPd WebUI configuration file

<?php

// Database connection
$mysql_host = 'localhost';
$mysql_user = 'purewebui';
$mysql_pass = 'purewebui';
$database = 'pureftpd';
$users_table = 'ftpd';
$admins_table = 'userlist';

// Pure-FTPd path
$daemon_path = '/etc/init.d/pure-ftpd';
$config_path = '/etc/pure-ftpd/pure-ftpd.conf';

$mysql_host = $mysql_host;
$mysql_webui_user = $mysql_webui_user;
$mysql_webui_passwd = $mysql_webui_passwd;
$mysql_database = $mysql_database;
?>
17 changes: 11 additions & 6 deletions daemon_control.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
<?php
$master = "daemon_control.php";
include ("blocks/default.php");
include ("blocks/lock.php");
include ("blocks/db_connect.php"); /*Подключаемся к базе*/
$user = $_SERVER['PHP_AUTH_USER'];
Expand All @@ -9,12 +10,16 @@
if (!$get_user_language) {
if (($err = mysql_errno()) == 1054) {
$info = "<p align=\"center\" class=\"table_error\">Your version of Pure-FTPd WebUI users table is not currently supported by current version, please upgrade your database to use miltilanguage support.</p>";
include("lang/english.php");
}
$language = "english";
include("lang/english.php");
}
else {
$language_row = mysql_fetch_array ($get_user_language);
$language = $language_row['language'];
if ($language == '') {
$language = "english";
}
include("lang/$language.php");
}

Expand Down Expand Up @@ -50,7 +55,7 @@
// Эта часть используется, если была нажата кнопка "Править конфиг"
if($_POST['edit']) {
// Путь к файлу
$filename = "/etc/pure-ftpd/pure-ftpd.conf";
$filename = "$pureftpd_conf_path";
// Открываем файл для чтения
$handle = fopen($filename, "r");
// Вытаскиваем содержимое файла
Expand Down Expand Up @@ -100,19 +105,19 @@

// Если была дана команда "старт" - стартуем демона
if ($daemon_ctl == 'start') {
$result = shell_exec("sudo /etc/init.d/pure-ftpd start");
$result = shell_exec("sudo $pureftpd_init_script_path start");
echo("<p>$result</p>");}

// Если была дана комнда "стоп" - останавливаем демона
elseif ($daemon_ctl == 'stop') {
$result = shell_exec("sudo /etc/init.d/pure-ftpd stop");
$result = shell_exec("sudo $pureftpd_init_script_path stop");
echo("<p>$result</p>");}

// Если была дана команда "рестарт" - рестартуем демона
elseif ($daemon_ctl == 'restart') {
$result = shell_exec("sudo /etc/init.d/pure-ftpd stop");
$result = shell_exec("sudo $pureftpd_init_script_path stop");
echo("<p>$result</p>");
$result = shell_exec("sudo /etc/init.d/pure-ftpd start");
$result = shell_exec("sudo $pureftpd_init_script_path start");
echo("<p>$result</p>");}

// Если ни один вариант не верен - выдаём ошибку
Expand Down
6 changes: 5 additions & 1 deletion del_user.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,16 @@
if (!$get_user_language) {
if (($err = mysql_errno()) == 1054) {
$info = "<p align=\"center\" class=\"table_error\">Your version of Pure-FTPd WebUI users table is not currently supported by current version, please upgrade your database to use miltilanguage support.</p>";
include("lang/english.php");
}
$language = "english";
include("lang/english.php");
}
else {
$language_row = mysql_fetch_array ($get_user_language);
$language = $language_row['language'];
if ($language == '') {
$language = "english";
}
include("lang/$language.php");
}

Expand Down
6 changes: 5 additions & 1 deletion drop_user.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,16 @@
if (!$get_user_language) {
if (($err = mysql_errno()) == 1054) {
$info = "<p align=\"center\" class=\"table_error\">Your version of Pure-FTPd WebUI users table is not currently supported by current version, please upgrade your database to use miltilanguage support.</p>";
include("lang/english.php");
}
$language = "english";
include("lang/english.php");
}
else {
$language_row = mysql_fetch_array ($get_user_language);
$language = $language_row['language'];
if ($language == '') {
$language = "english";
}
include("lang/$language.php");
}

Expand Down
Loading

0 comments on commit 3351f46

Please sign in to comment.