#353 Add FastDL webspace modul with quotas

This commit is contained in:
Ulrich Block 2014-03-09 16:19:15 +01:00
parent d6139bb374
commit f7d59fc2ae
16 changed files with 967 additions and 26 deletions

View File

@ -72,6 +72,34 @@ if (isset($admin_id) and $pa['dedicatedServer'] and $ui->smallletters('d', 7, 'g
}
$template_file = 'ajax_admin_roots_ips.tpl';
} else if (isset($admin_id) and $pa['fastdl'] and $ui->smallletters('d', 12, 'get') == 'fastdlmaster' and $ui->id('id', 10, 'get')) {
$sprache = getlanguagefile('fastdl', $user_language, $resellerLockupID);
$maxVhost = 0;
$maxHDD = 0;
$fastdlVhosts = 0;
$leftHDD = 0;
$totalHDD = 0;
$totalVhosts = 0;
$quotaActive = 'N';
$dns = '';
$query = $sql->prepare("SELECT m.`vhostTemplate`,m.`maxVhost`,m.`maxHDD`,m.`quotaActive`,m.`defaultdns`,(SELECT COUNT(v.`fastdlVhostID`) AS `a` FROM `fastdlVhost` AS v WHERE v.`fastdlMasterID`=m.`fastdlMasterID`) AS `totalVhosts`,(SELECT SUM(v.`hdd`) AS `a` FROM `fastdlVhost` AS v WHERE v.`fastdlMasterID`=m.`fastdlMasterID`) AS `totalHDD` FROM `fastdlMaster` AS m WHERE m.`fastdlMasterID`=? AND m.`resellerID`=? LIMIT 1");
$query->execute(array($ui->id('id', 10, 'get'), $resellerLockupID));
foreach ($query->fetchAll(PDO::FETCH_ASSOC) as $row) {
$vhostTemplate = $row['vhostTemplate'];
$maxVhost = (int) $row['maxVhost'];
$maxHDD = (int) $row['maxHDD'];
$totalVhosts = (int) $row['totalVhosts'];
$leftHDD = (int) $row['maxHDD'] - $row['totalHDD'];
$quotaActive = $row['quotaActive'];
$dns = $row['defaultdns'];
}
$template_file = 'ajax_admin_fastdlmaster.tpl';
}
if (isset($template_file)) {

View File

@ -6,8 +6,12 @@
<example>Beispiel: ftp://Deinusername:Deinftppasswort@Adresse/Pfad</example>
<fdlfailed>Fastdownload Abgleich fehlgeschlagen</fdlfailed>
<fdlstarted>Fastdownload Abgleich gestartet</fdlstarted>
<ftpIP>FTP Adresse</ftpIP>
<ftpPassword>FTP Passwort</ftpPassword>
<ftpPort>FTP Port</ftpPort>
<haupt>Standard Fastdownload Speicher</haupt>
<haupt2>Standard Fastdownload Speicher benutzen?</haupt2>
<hdd>Speicherplatz</hdd>
<help_fdl>
<![CDATA[
Mittels Fastdownload können Spieler auf Ihrem Gameserver Zusatz-Dateien schneller herunterladen.<br />
@ -19,6 +23,7 @@
Damit diese Einstellung auf Ihrem Gameserver aktiv wird, muss die entsprechende <strong>HTTP-URL</strong> auch in der <strong>server.cfg</strong> oder <strong>dedicated.cfg</strong> am Gameserver eingetragen werden.
]]>
</help_fdl>
<help_fdl_master>Achtung, es wird empfohlen den Host ausschließlich für Fastdownload zu nutzen. Andere Panels und Dienste könnten ansonsten Konflikte und Probleme verursachen. Des Weiteren verursacht Fastdownload regelmäßige Lastspitzen in der Bandbreite, die andere Serverdienste zum Laggen bringen können.</help_fdl_master>
<httpdCmd>HTTPD Start/Reload Befehl</httpdCmd>
<installedHDD>Zugewiesene HDD</installedHDD>
<installedVhost>Installierte Vhosts</installedVhost>
@ -26,8 +31,10 @@
<maxVhost>Maximale Vhosts</maxVhost>
<neben>FTP Zugang zum Fastdownload Webspace für</neben>
<noset>Keine FTP Daten hinterlegt</noset>
<own2>Eigener Fastdownload Speicher</own2>
<optional>(optional)</optional>
<own>Haupt FTP nutzen</own>
<own2>Eigener Fastdownload Speicher</own2>
<ownVhost>Eigenes Vhosttemplate</ownVhost>
<quotaActive>Quotas Aktivieren</quotaActive>
<quotaCmd>Quota Befehl</quotaCmd>
<quotaWarning>Achtung! Ohne Quotas kann der User unbegrenzt Dateien hochladen!</quotaWarning>
@ -35,6 +42,7 @@
<server>Server</server>
<startfdl>Abgleich starten</startfdl>
<udsuc>FTP Daten erfolgreich geändert</udsuc>
<usage>Belegung</usage>
<userAddCmd>Hinzufügen Befehl</userAddCmd>
<userDelCmd>Löschen Befehl</userDelCmd>
<userModCmd>Bearbeiten Befehl</userModCmd>

View File

@ -37,7 +37,7 @@
* Programm erhalten haben. Wenn nicht, siehe <http://www.gnu.org/licenses/>.
*/
if (!isset($admin_id) or $main != 1 or $reseller_id != 0 or !$pa['gserver']) {
if (!isset($admin_id) or $main != 1 or !isset($admin_id) or !isset($reseller_id) or !$pa['fastdl']) {
header('Location: admin.php');
die;
}
@ -67,9 +67,11 @@ $publickey = ($ui->w('publickey', 1, 'post')) ? $ui->w('publickey', 1, 'post') :
$keyname = $ui->startparameter('keyname', 'post');
$active = ($ui->active('active', 'post')) ? $ui->active('active', 'post') : 'Y';
$ip = $ui->ip('ip', 'post');
$port = $ui->port('port', 'post');
$user = $ui->username('user',255, 'post');
$pass = $ui->password('pass',255, 'post');
$port = ($ui->port('port', 'post')) ? $ui->port('port', 'post') : 22;
$user = $ui->username('user', 255, 'post');
$pass = $ui->password('pass', 255, 'post');
$ftpIP = $ui->ip('ftpIP', 'post');
$ftpPort = ($ui->port('ftpPort', 'post')) ? $ui->port('ftpPort', 'post') : 21;
$description = $ui->escaped('description', 'post');
$maxVhost = ($ui->id('maxVhost', 10, 'post')) ? $ui->id('maxVhost', 10, 'post') : 100;
$maxHDD = ($ui->id('maxHDD', 10, 'post')) ? $ui->id('maxHDD', 10, 'post') : 10000;
@ -142,6 +144,8 @@ if ($ui->w('action',4, 'post') and !token(true)) {
$user = $row['decrypteduser'];
$pass = $row['decryptedpass'];
$description = $row['description'];
$ftpIP = $row['ftpIP'];
$ftpPort = $row['ftpPort'];
$publickey = $row['publickey'];
$keyname = $row['keyname'];
$maxVhost = $row['maxVhost'];
@ -171,16 +175,23 @@ if ($ui->w('action',4, 'post') and !token(true)) {
} else if ($ui->st('action', 'post') == 'md' or $ui->st('action', 'post') == 'ad') {
if (!$ip) {
$errors['ip'] = $sprache->haupt_ip;
$errors['ip'] = $dedicatedLanguage->ssh_ip;
}
if (!$port) {
$errors['port'] = $sprache->ssh_port;
$errors['port'] = $dedicatedLanguage->ssh_port;
}
if (!$user) {
$errors['user'] = $sprache->ssh_user;
$errors['user'] = $dedicatedLanguage->ssh_user;
}
if (!$publickey) {
$errors['publickey'] = $sprache->keyuse;
$errors['publickey'] = $dedicatedLanguage->keyuse;
}
if (!$ftpPort) {
$errors['ftpPort'] = $sprache->ftpPort;
}
$ssh2Check = (count($errors) == 0) ? ssh_check($ip, $port, $user, $publickey, $keyname, $pass) : true;
@ -188,42 +199,78 @@ if ($ui->w('action',4, 'post') and !token(true)) {
if ($ssh2Check !== true) {
if ($ssh2Check == 'ipport') {
$errors['ip'] = $sprache->haupt_ip;
$errors['port'] = $sprache->ssh_port;
$errors['ip'] = $dedicatedLanguage->ssh_ip;
$errors['port'] = $dedicatedLanguage->ssh_port;
} else {
$errors['user'] = $sprache->ssh_user;
$errors['publickey'] = $sprache->keyuse;
$errors['user'] = $dedicatedLanguage->ssh_user;
$errors['publickey'] = $dedicatedLanguage->keyuse;
if ($publickey == 'N') {
$errors['pass'] = $sprache->ssh_pass;
$errors['pass'] = $dedicatedLanguage->ssh_pass;
} else if (!$ui->active('publickey', 'post') == 'B') {
$errors['pass'] = $sprache->ssh_pass;
$errors['keyname'] = $sprache->keyname;
$errors['pass'] = $dedicatedLanguage->ssh_pass;
$errors['keyname'] = $dedicatedLanguage->keyname;
} else {
$errors['keyname'] = $sprache->keyname;
$errors['keyname'] = $dedicatedLanguage->keyname;
}
}
}
if ($ui->st('action', 'post') == 'md' and $id) {
$query = $sql->prepare("SELECT `active`,`vhostTemplate` FROM `fastdlMaster` WHERE `fastdlMasterID`=? AND `resellerID`=? LIMIT 1");
$query->execute(array($id, $resellerLockupID));
foreach ($query->fetchAll(PDO::FETCH_ASSOC) as $row) {
$oldActive = $row['active'];
$oldVhostTemplate = $row['vhostTemplate'];
}
// This should only be true in case of REQUEST data manipulation
if (!isset($oldActive) or !isset($oldVhostTemplate)) {
$errors['keyname'] = 'ID';
}
}
// Submitted values are OK
if (count($errors) == 0) {
// Make the inserts or updates define the log entry and get the affected rows from insert
if ($ui->st('action', 'post') == 'ad') {
$query = $sql->prepare("INSERT INTO `fastdlMaster` (`active`,`ip`,`port`,`user`,`pass`,`publickey`,`keyname`,`maxVhost`,`maxHDD`,`defaultdns`,`httpdCmd`,`vhostStoragePath`,`vhostConfigPath`,`vhostTemplate`,`quotaActive`,`quotaCmd`,`description`,`userGroup`,`userAddCmd`,`userModCmd`,`userDelCmd`,`resellerID`) VALUES (:active,:ip,:port,AES_ENCRYPT(:user,:aeskey),AES_ENCRYPT(:pass,:aeskey),:publickey,:keyname,:maxVhost,:maxHDD,:defaultdns,:httpdCmd,:vhostStoragePath,:vhostConfigPath,:vhostTemplate,:quotaActive,:quotaCmd,:description,:userGroup,:userAddCmd,:userModCmd,:userDelCmd,:resellerID)");
$query->execute(array(':active' => $active,':ip' => $ip,':port' => $port,':aeskey' => $aeskey,':user' => $user,':pass' => $pass,':publickey' => $publickey,':keyname' => $keyname,':maxVhost' => $maxVhost,':maxHDD' => $maxHDD,':defaultdns' => $defaultdns,':httpdCmd' => $httpdCmd,':vhostStoragePath' => $vhostStoragePath,':vhostConfigPath' => $vhostConfigPath,':vhostTemplate' => $vhostTemplate,':quotaActive' => $quotaActive,':quotaCmd' => $quotaCmd,':description' => $description,':userGroup' => $userGroup,':userAddCmd' => $userAddCmd,':userModCmd' => $userModCmd,':userDelCmd' => $userDelCmd,':resellerID' => $resellerLockupID));
$query = $sql->prepare("INSERT INTO `fastdlMaster` (`active`,`ip`,`port`,`user`,`pass`,`publickey`,`keyname`,`ftpIP`,`ftpPort`,`maxVhost`,`maxHDD`,`defaultdns`,`httpdCmd`,`vhostStoragePath`,`vhostConfigPath`,`vhostTemplate`,`quotaActive`,`quotaCmd`,`description`,`userGroup`,`userAddCmd`,`userModCmd`,`userDelCmd`,`resellerID`) VALUES (:active,:ip,:port,AES_ENCRYPT(:user,:aeskey),AES_ENCRYPT(:pass,:aeskey),:publickey,:keyname,:ftpIP,:ftpPort,:maxVhost,:maxHDD,:defaultdns,:httpdCmd,:vhostStoragePath,:vhostConfigPath,:vhostTemplate,:quotaActive,:quotaCmd,:description,:userGroup,:userAddCmd,:userModCmd,:userDelCmd,:resellerID)");
$query->execute(array(':active' => $active,':ip' => $ip,':port' => $port,':aeskey' => $aeskey,':user' => $user,':pass' => $pass,':publickey' => $publickey,':keyname' => $keyname,':ftpIP' => $ftpIP, ':ftpPort' => $ftpPort,':maxVhost' => $maxVhost,':maxHDD' => $maxHDD,':defaultdns' => $defaultdns,':httpdCmd' => $httpdCmd,':vhostStoragePath' => $vhostStoragePath,':vhostConfigPath' => $vhostConfigPath,':vhostTemplate' => $vhostTemplate,':quotaActive' => $quotaActive,':quotaCmd' => $quotaCmd,':description' => $description,':userGroup' => $userGroup,':userAddCmd' => $userAddCmd,':userModCmd' => $userModCmd,':userDelCmd' => $userDelCmd,':resellerID' => $resellerLockupID));
$rowCount = $query->rowCount();
$loguseraction = '%add% %fastdlmaster% ' . $ip;
} else if ($ui->st('action', 'post') == 'md' and $id) {
$query = $sql->prepare("UPDATE `fastdlMaster` SET `active`=:active,`ip`=:ip,`port`=:port,`user`=AES_ENCRYPT(:user,:aeskey),`pass`=AES_ENCRYPT(:pass,:aeskey),`publickey`=:publickey,`keyname`=:keyname,`maxVhost`=:maxVhost,`maxHDD`=:maxHDD,`defaultdns`=:defaultdns,`httpdCmd`=:httpdCmd,`vhostStoragePath`=:vhostStoragePath,`vhostConfigPath`=:vhostConfigPath,`vhostTemplate`=:vhostTemplate,`quotaActive`=:quotaActive,`quotaCmd`=:quotaCmd,`description`=:description,`userGroup`=:userGroup,`userAddCmd`=:userAddCmd,`userModCmd`=:userModCmd,`userDelCmd`=:userDelCmd WHERE `fastdlMasterID`=:id AND `resellerID`=:resellerID LIMIT 1");
$query->execute(array(':active' => $active,':ip' => $ip,':port' => $port,':aeskey' => $aeskey,':user' => $user,':pass' => $pass,':publickey' => $publickey,':keyname' => $keyname,':maxVhost' => $maxVhost,':maxHDD' => $maxHDD,':defaultdns' => $defaultdns,':httpdCmd' => $httpdCmd,':vhostStoragePath' => $vhostStoragePath,':vhostConfigPath' => $vhostConfigPath,':vhostTemplate' => $vhostTemplate,':quotaActive' => $quotaActive,':quotaCmd' => $quotaCmd,':description' => $description, ':userGroup' => $userGroup,':userAddCmd' => $userAddCmd,':userModCmd' => $userModCmd,':userDelCmd' => $userDelCmd,':id' => $id,':resellerID' => $resellerLockupID));
// In case the template has been changed we need to add change jobs for every vhost that uses the global template.
if ($oldVhostTemplate != $vhostTemplate) {
$query = $sql->prepare("SELECT `fastdlVhostID`,`userID`,`dns` FROM `fastdlVhost` WHERE `fastdlMasterID`=? AND `resellerID`=? AND `ownVhost`='N'");
$query2 = $sql->prepare("INSERT INTO `jobs` (`api`,`type`,`invoicedByID`,`affectedID`,`hostID`,`userID`,`name`,`status`,`date`,`action`,`extraData`,`resellerid`) VALUES ('S','fd',?,?,?,?,?,NULL,NOW(),'md','',?)");
$query->execute(array($id, $resellerLockupID));
foreach ($query->fetchAll(PDO::FETCH_ASSOC) as $row) {
$query2->execute(array($admin_id, $row['fastdlVhostID'], $row['fastdlMasterID'], $row['userID'], $row['dns'], $resellerLockupID));
}
$query = $sql->prepare("UPDATE `fastdlVhost` SET `vhostTemplate`=? WHERE `fastdlMasterID`=? AND `resellerID`=? AND `ownVhost`='N'");
$query->execute(array($vhostTemplate, $id, $resellerLockupID));
}
// Update Vhosts in case active changed
if ($oldActive != $active) {
$query = $sql->prepare("UPDATE `fastdlVhost` SET `active`=? WHERE `fastdlMasterID`=? AND `resellerID`=?");
$query->execute(array($active, $id, $resellerLockupID));
}
$query = $sql->prepare("UPDATE `fastdlMaster` SET `active`=:active,`ip`=:ip,`port`=:port,`user`=AES_ENCRYPT(:user,:aeskey),`pass`=AES_ENCRYPT(:pass,:aeskey),`publickey`=:publickey,`keyname`=:keyname,`ftpIP`=:ftpIP,`ftpPort`=:ftpPort,`maxVhost`=:maxVhost,`maxHDD`=:maxHDD,`defaultdns`=:defaultdns,`httpdCmd`=:httpdCmd,`vhostStoragePath`=:vhostStoragePath,`vhostConfigPath`=:vhostConfigPath,`vhostTemplate`=:vhostTemplate,`quotaActive`=:quotaActive,`quotaCmd`=:quotaCmd,`description`=:description,`userGroup`=:userGroup,`userAddCmd`=:userAddCmd,`userModCmd`=:userModCmd,`userDelCmd`=:userDelCmd WHERE `fastdlMasterID`=:id AND `resellerID`=:resellerID LIMIT 1");
$query->execute(array(':active' => $active,':ip' => $ip,':port' => $port,':aeskey' => $aeskey,':user' => $user,':pass' => $pass,':publickey' => $publickey,':keyname' => $keyname,':ftpIP' => $ftpIP, ':ftpPort' => $ftpPort,':maxVhost' => $maxVhost,':maxHDD' => $maxHDD,':defaultdns' => $defaultdns,':httpdCmd' => $httpdCmd,':vhostStoragePath' => $vhostStoragePath,':vhostConfigPath' => $vhostConfigPath,':vhostTemplate' => $vhostTemplate,':quotaActive' => $quotaActive,':quotaCmd' => $quotaCmd,':description' => $description, ':userGroup' => $userGroup,':userAddCmd' => $userAddCmd,':userModCmd' => $userModCmd,':userDelCmd' => $userDelCmd,':id' => $id,':resellerID' => $resellerLockupID));
$rowCount = $query->rowCount();
$loguseraction = '%mod% %fastdlmaster% ' . $ip;
@ -340,7 +387,7 @@ if ($ui->w('action',4, 'post') and !token(true)) {
}
$query = $sql->prepare("SELECT `active`,`fastdlMasterID`,`ip`,`maxVhost`,`maxHDD`,`description` FROM `fastdlMaster` WHERE `resellerID`=? ORDER BY " . $orderby);
$query2 = $sql->prepare("SELECT `fastdlVhostID`,`active`,`dns` FROM `fastdlVhost` WHERE `fastdlMasterID`=? AND `resellerID`=?");
$query2 = $sql->prepare("SELECT `fastdlVhostID`,`active`,`dns`,`hdd` FROM `fastdlVhost` WHERE `fastdlMasterID`=? AND `resellerID`=?");
$query->execute(array($resellerLockupID));
foreach ($query->fetchAll(PDO::FETCH_ASSOC) as $row) {
@ -349,6 +396,7 @@ if ($ui->w('action',4, 'post') and !token(true)) {
$hddSum = 0;
$vhostCount = 0;
$query2->execute(array($row['fastdlMasterID'], $resellerLockupID));
foreach ($query2->fetchAll(PDO::FETCH_ASSOC) as $row2) {
$hddSum += $row2['hdd'];
$vhostCount++;

View File

@ -0,0 +1,475 @@
<?php
/**
* File: fastdl_vhost.php.
* Author: Ulrich Block
* Date: 02.03.14
* Contact: <ulrich.block@easy-wi.com>
*
* This file is part of Easy-WI.
*
* Easy-WI is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Easy-WI is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with Easy-WI. If not, see <http://www.gnu.org/licenses/>.
*
* Diese Datei ist Teil von Easy-WI.
*
* Easy-WI ist Freie Software: Sie koennen es unter den Bedingungen
* der GNU General Public License, wie von der Free Software Foundation,
* Version 3 der Lizenz oder (nach Ihrer Wahl) jeder spaeteren
* veroeffentlichten Version, weiterverbreiten und/oder modifizieren.
*
* Easy-WI wird in der Hoffnung, dass es nuetzlich sein wird, aber
* OHNE JEDE GEWAEHELEISTUNG, bereitgestellt; sogar ohne die implizite
* Gewaehrleistung der MARKTFAEHIGKEIT oder EIGNUNG FUER EINEN BESTIMMTEN ZWECK.
* Siehe die GNU General Public License fuer weitere Details.
*
* Sie sollten eine Kopie der GNU General Public License zusammen mit diesem
* Programm erhalten haben. Wenn nicht, siehe <http://www.gnu.org/licenses/>.
*/
if (!isset($admin_id) or $main != 1 or !isset($admin_id) or !isset($reseller_id) or !$pa['fastdl']) {
header('Location: admin.php');
die;
}
include(EASYWIDIR . '/stuff/keyphrasefile.php');
$dedicatedLanguage = getlanguagefile('reseller', $user_language, $resellerLockupID);
$sprache = getlanguagefile('fastdl', $user_language, $resellerLockupID);
$loguserid = $admin_id;
$logusername = getusername($admin_id);
$logusertype = 'admin';
if ($reseller_id == 0) {
$logreseller = 0;
$logsubuser = 0;
} else {
$logsubuser = (isset($_SESSION['oldid'])) ? $_SESSION['oldid'] : 0;
$logreseller = 0;
}
// Define the ID variable which will be used at the form and SQLs
$id = $ui->id('id', 10, 'get');
$fastdlMasterID = $ui->id('fastdlMasterID', 10, 'post');
$userID = $ui->id('userID', 10, 'post');
$active = ($ui->active('active', 'post')) ? $ui->active('active', 'post') : 'Y';
$hdd = ($ui->id('hdd', 10, 'post')) ? $ui->id('hdd', 10, 'post') : 1000;
$dns = (string) strtolower($ui->domain('dns', 'post'));
$ftpPassword = ($ui->password('ftpPassword', 255, 'post')) ? $ui->password('ftpPassword', 255, 'post') : passwordgenerate(10);
$vhostTemplate = $ui->escaped('vhostTemplate', 'post');
$ownVhost = ($ui->active('ownVhost', 'post')) ? $ui->active('ownVhost', 'post') : 'N';
// CSFR protection with hidden tokens. If token(true) returns false, we likely have an attack
if ($ui->w('action',4, 'post') and !token(true)) {
unset($header, $text);
$tokenError = true;
$errors = array($spracheResponse->token);
}
// Add and modify entries. Same validation can be used.
if ($ui->st('d', 'get') == 'ad' or $ui->st('d', 'get') == 'md') {
// Error handling. Check if required attributes are set and can be validated
$errors = array();
// Add or mod is opened
if (!$ui->smallletters('action', 2, 'post')) {
// Gather data for adding if needed and define add template
if ($ui->st('d', 'get') == 'ad') {
$table = array();
$table2 = array();
$maxVhost = 0;
$maxHDD = 0;
$totalVhosts = 0;
$leftHDD = 0;
$quotaActive = 'N';
// Get useraccounts
$query = $sql->prepare("SELECT `id`,`cname`,`vname`,`name` FROM `userdata` WHERE `resellerid`=? AND `accounttype`='u' AND `active`='Y' ORDER BY `id` DESC");
$query->execute(array($resellerLockupID));
foreach ($query->fetchAll(PDO::FETCH_ASSOC) as $row) {
$table[$row['id']] = trim($row['cname'] . ' ' . trim($row['vname'] . ' ' . $row['name']));
}
// Get masterserver. Sort by usage.
$query = $sql->prepare("SELECT m.`fastdlMasterID`,m.`ip`,m.`description`,(SELECT COUNT(v.`fastdlVhostID`) AS `a` FROM `fastdlVhost` AS v WHERE v.`fastdlMasterID`=m.`fastdlMasterID`)/(m.`maxVhost`/100) AS `percentVhostUsage`,(SELECT SUM(v.`hdd`) AS `a` FROM `fastdlVhost` AS v WHERE v.`fastdlMasterID`=m.`fastdlMasterID`)/(m.`maxHDD`/100) AS `percentHDDUsage` FROM `fastdlMaster` AS m WHERE m.`active`='Y' AND m.`resellerID`=? GROUP BY m.`fastdlMasterID` HAVING (`percentVhostUsage`<100 OR `percentVhostUsage`IS NULL) AND (`percentHDDUsage`<100 OR `percentHDDUsage`IS NULL) ORDER BY `percentHDDUsage` ASC,`percentVhostUsage` ASC");
$query->execute(array($resellerLockupID));
foreach ($query->fetchAll(PDO::FETCH_ASSOC) as $row) {
$table2[$row['fastdlMasterID']] = trim($row['ip'] . ' ' . $row['description']);
}
if (count($table2) > 0) {
$bestID = key($table2);
$query = $sql->prepare("SELECT m.`vhostTemplate`,m.`maxVhost`,m.`maxHDD`,m.`quotaActive`,m.`defaultdns`,(SELECT COUNT(v.`fastdlVhostID`) AS `a` FROM `fastdlVhost` AS v WHERE v.`fastdlMasterID`=m.`fastdlMasterID`) AS `totalVhosts`,(SELECT SUM(v.`hdd`) AS `a` FROM `fastdlVhost` AS v WHERE v.`fastdlMasterID`=m.`fastdlMasterID`) AS `totalHDD` FROM `fastdlMaster` AS m WHERE m.`fastdlMasterID`=? AND m.`resellerID`=? LIMIT 1");
$query->execute(array($bestID, $resellerLockupID));
foreach ($query->fetchAll(PDO::FETCH_ASSOC) as $row) {
$vhostTemplate = $row['vhostTemplate'];
$maxVhost = (int) $row['maxVhost'];
$maxHDD = (int) $row['maxHDD'];
$totalVhosts = (int) $row['totalVhosts'];
$leftHDD = (int) $row['maxHDD'] - $row['totalHDD'];
$quotaActive = $row['quotaActive'];
$dns = $row['defaultdns'];
}
}
$template_file = 'admin_fastdl_vhost_add.tpl';
// Gather data for modding in case we have an ID and define mod template
} else if ($ui->st('d', 'get') == 'md' and $id) {
$query = $sql->prepare("SELECT v.*,AES_DECRYPT(v.`ftpPassword`,?) AS `decryptedFTPPass`,m.`ip`,m.`ftpIP`,m.`ftpPort`,m.`description`,m.`maxHDD`,m.`quotaActive`,(SELECT SUM(v.`hdd`) AS `a` FROM `fastdlVhost` AS v WHERE v.`fastdlMasterID`=m.`fastdlMasterID`) AS `totalHDD`,u.`cname`,u.`vname`,u.`name` FROM `fastdlVhost` AS v INNER JOIN `fastdlMaster` AS m ON m.`fastdlMasterID`=v.`fastdlMasterID` INNER JOIN `userdata` AS u ON u.`id`=v.`userID` WHERE v.`fastdlVhostID`=? AND v.`resellerID`=? LIMIT 1");
$query->execute(array($aeskey, $id, $resellerLockupID));
foreach ($query->fetchAll(PDO::FETCH_ASSOC) as $row) {
// Userdata from JOIN, trim in case attributes are not provided
$userName = trim($row['cname'] . ' ' . trim($row['vname'] . ' ' . $row['name']));
// Masterserver from JOIN. Display FTP IP in case it is provided
$ftpServer = (isip($row['ftpIP'], 'ip4')) ? $row['ftpIP'] : $row['ip'];
$ftpServer .= ':' . $row['ftpPort'];
$description = $row['description'];
$maxHDD = (int) $row['maxHDD'];
$leftHDD = (int) $row['maxHDD'] - $row['totalHDD'];
$quotaActive = $row['quotaActive'];
// Vhost data
$active = $row['active'];
$hdd = $row['hdd'];
$dns = $row['dns'];
$ftpPassword = $row['decryptedFTPPass'];
$ownVhost = $row['ownVhost'];
$vhostTemplate = $row['vhostTemplate'];
}
// Check if database entry exists and if not display 404 page
$template_file = ($query->rowCount() > 0) ? 'admin_fastdl_vhost_md.tpl' : 'admin_404.tpl';
// Show 404 if GET parameters did not add up or no ID was given with mod
} else {
$template_file = 'admin_404.tpl';
}
// Form is submitted
} else if ($ui->st('action', 'post') == 'md' or $ui->st('action', 'post') == 'ad') {
if (!$active) {
$errors['active'] = $dedicatedLanguage->active;
}
if (!$ftpPassword) {
$errors['ftpPassword'] = $sprache->ftpPassword;
}
if (!$dns) {
$errors['dns'] = $sprache->dns;
}
// Only at ADD user and masterserver can be defined. We need to check if they exist
if ($ui->st('action', 'post') == 'ad') {
if ($userID) {
$query = $sql->prepare("SELECT `cname` FROM `userdata` WHERE `id`=? AND `resellerid`=? LIMIT 1");
$query->execute(array($userID, $resellerLockupID));
$ftpUser = $query->fetchColumn();
if (strlen($ftpUser) < 1) {
$errors['userID'] = $dedicatedLanguage->user;
}
} else {
$errors['userID'] = $dedicatedLanguage->user;
}
if ($fastdlMasterID) {
$query = $sql->prepare("SELECT `defaultdns` FROM `fastdlMaster` WHERE `fastdlMasterID`=? AND `resellerID`=? LIMIT 1");
$query->execute(array($fastdlMasterID, $resellerLockupID));
$defaultDns = (string) $query->fetchColumn();
if (strlen($defaultDns) < 1) {
$errors['fastdlMasterID'] = $gsprache->master;
}
} else {
$errors['fastdlMasterID'] = $gsprache->master;
}
}
// Submitted values are OK
if (count($errors) == 0) {
// Make the inserts or updates define the log entry and get the affected rows from insert
if ($ui->st('action', 'post') == 'ad') {
$query = $sql->prepare("INSERT INTO `fastdlVhost` (`fastdlMasterID`,`userID`,`active`,`hdd`,`ftpPassword`,`ownVhost`,`vhostTemplate`,`resellerID`) VALUES (?,?,?,?,AES_ENCRYPT(?,?),?,?,?)");
$query->execute(array($fastdlMasterID, $userID, $active, $hdd, $ftpPassword, $aeskey, $ownVhost, $vhostTemplate, $resellerLockupID));
$id = (int) $sql->lastInsertId();
$ftpUser .= '-' . $id;
if ($defaultDns == $dns) {
$dns = str_replace('..', '.', $ftpUser . '.' .$defaultDns);
}
$query = $sql->prepare("UPDATE `fastdlVhost` SET `dns`=?,`ftpUser`=? WHERE `fastdlVhostID`=? AND `resellerID`=? LIMIT 1");
$query->execute(array($dns, $ftpUser, $id, $resellerLockupID));
$rowCount = $query->rowCount();
$loguseraction = '%add% %fastdlvhost% ' . $dns;
} else if ($ui->st('action', 'post') == 'md' and $id) {
$query = $sql->prepare("SELECT `active` FROM `fastdlVhost` WHERE `fastdlVhostID`=? AND `resellerID`=? LIMIT 1");
$query->execute(array($id, $resellerLockupID));
$oldActive = $query->fetchColumn();
$query = $sql->prepare("UPDATE `fastdlVhost` SET `active`=?,`hdd`=?,`dns`=?,`ftpPassword`=AES_ENCRYPT(?,?),`ownVhost`=?,`vhostTemplate`=? WHERE `fastdlVhostID`=? AND `resellerID`=? LIMIT 1");
$query->execute(array($active, $hdd, $dns, $ftpPassword, $aeskey, $ownVhost, $vhostTemplate, $id, $resellerLockupID));
// in case vhost is deactivated change password to random for later processing
if ($oldActive == 'Y' and $oldActive != $active) {
$ftpPassword = passwordgenerate(10);
}
$rowCount = $query->rowCount();
$loguseraction = '%mod% %fastdlvhost% ' . $dns;
}
// Check if a row was affected during insert or update
if (isset($rowCount) and $rowCount > 0) {
$insertlog->execute();
$template_file = $spracheResponse->table_add;
// No update or insert failed
} else {
$template_file = $spracheResponse->error_table;
}
// An error occurred during validation unset the redirect information and display the form again
} else {
unset($header, $text);
if ($ui->st('d', 'get') == 'ad') {
$table = array();
$table2 = array();
$maxVhost = 0;
$maxHDD = 0;
$fastdlVhosts = 0;
$leftHDD = 0;
$totalHDD = 0;
$totalVhosts = 0;
$quotaActive = 'N';
$dns = '';
// Get useraccounts
$query = $sql->prepare("SELECT `id`,`cname`,`vname`,`name` FROM `userdata` WHERE `resellerid`=? AND `accounttype`='u' AND `active`='Y' ORDER BY `id` DESC");
$query->execute(array($resellerLockupID));
foreach ($query->fetchAll(PDO::FETCH_ASSOC) as $row) {
$table[$row['id']] = trim($row['cname'] . ' ' . trim($row['vname'] . ' ' . $row['name']));
}
// Get masterserver. Sort by usage.
$query = $sql->prepare("SELECT m.`fastdlMasterID`,m.`ip`,m.`description`,(SELECT COUNT(v.`fastdlVhostID`) AS `a` FROM `fastdlVhost` AS v WHERE v.`fastdlMasterID`=m.`fastdlMasterID`)/(m.`maxVhost`/100) AS `percentVhostUsage`,(SELECT SUM(v.`hdd`) AS `a` FROM `fastdlVhost` AS v WHERE v.`fastdlMasterID`=m.`fastdlMasterID`)/(m.`maxHDD`/100) AS `percentHDDUsage` FROM `fastdlMaster` AS m WHERE m.`active`='Y' AND m.`resellerID`=? GROUP BY m.`fastdlMasterID` HAVING (`percentVhostUsage`<100 OR `percentVhostUsage`IS NULL) AND (`percentHDDUsage`<100 OR `percentHDDUsage`IS NULL) ORDER BY `percentHDDUsage` ASC,`percentVhostUsage` ASC");
$query->execute(array($resellerLockupID));
foreach ($query->fetchAll(PDO::FETCH_ASSOC) as $row) {
$table2[$row['fastdlMasterID']] = trim($row['ip'] . ' ' . $row['description']);
}
if (count($table2) > 0) {
$bestID = key($table2);
$query = $sql->prepare("SELECT m.`vhostTemplate`,m.`maxVhost`,m.`maxHDD`,m.`quotaActive`,m.`defaultdns`,(SELECT COUNT(v.`fastdlVhostID`) AS `a` FROM `fastdlVhost` AS v WHERE v.`fastdlMasterID`=m.`fastdlMasterID`) AS `totalVhosts`,(SELECT SUM(v.`hdd`) AS `a` FROM `fastdlVhost` AS v WHERE v.`fastdlMasterID`=m.`fastdlMasterID`) AS `totalHDD` FROM `fastdlMaster` AS m WHERE m.`fastdlMasterID`=? AND m.`resellerID`=? LIMIT 1");
$query->execute(array($bestID, $resellerLockupID));
foreach ($query->fetchAll(PDO::FETCH_ASSOC) as $row) {
$vhostTemplate = $row['vhostTemplate'];
$maxVhost = (int) $row['maxVhost'];
$maxHDD = (int) $row['maxHDD'];
$totalVhosts = (int) $row['totalVhosts'];
$leftHDD = (int) $row['maxHDD'] - $row['totalHDD'];
$quotaActive = $row['quotaActive'];
$dns = $row['defaultdns'];
}
}
$template_file = 'admin_fastdl_vhost_add.tpl';
} else {
$template_file = 'admin_fastdl_vhost_md.tpl';
}
}
}
// Remove entries in case we have an ID given with the GET request
} else if (!isset($tokenError) and $ui->st('d', 'get') == 'dl' and $id) {
$query = $sql->prepare("SELECT v.`dns`,u.`cname`,u.`vname`,u.`name` FROM `fastdlVhost` AS v LEFT JOIN `userdata` AS u ON v.`userID`=u.`id` WHERE v.`fastdlVhostID`=? AND v.`resellerID`=? LIMIT 1");
$query->execute(array($id, $resellerLockupID));
foreach ($query->fetchAll(PDO::FETCH_ASSOC) as $row) {
$dns = $row['dns'];
$user = trim($row['cname'] . ' ' . trim($row['vname'] . ' ' . $row['name']));
}
// Nothing submitted yet, display the delete form
if (!$ui->st('action', 'post') and isset($user)) {
// Check if we could find an entry and if not display 404 page
$template_file = ($query->rowCount() > 0) ? 'admin_fastdl_vhost_dl.tpl' : 'admin_404.tpl';
// User submitted remove the entry
} else if ($ui->st('action', 'post') == 'dl' and isset($user)) {
$query = $sql->prepare("DELETE FROM `fastdlVhost` WHERE `fastdlVhostID`=? AND `resellerID`=? LIMIT 1");
$query->execute(array($id, $resellerLockupID));
// Check if a row was affected meaning an entry could be deleted. If yes add log entry and display success message
if ($query->rowCount() > 0) {
$template_file = $spracheResponse->table_del;
$loguseraction = '%del% %fastdlvhost% ' . $dns;
$insertlog->execute();
// Nothing was deleted, display an error
} else {
$template_file = $spracheResponse->error_table;
}
// GET Request did not add up. Display 404 error.
} else {
$template_file = 'admin_404.tpl';
}
// List the available entries
} else {
$table = array();
$query = $sql->prepare("SELECT COUNT(`fastdlVhostID`) AS `amount` FROM `fastdlVhost` WHERE `resellerID`=?");
$query->execute(array($resellerLockupID));
$colcount = $query->fetchColumn();
if (!isset($start)) {
$start = 0;
}
if (!isset($amount)) {
$amount = 20;
}
if ($start > $colcount) {
$start = $colcount - $amount;
}
if ($start < 0) {
$start = 0;
}
$next = $start + $amount;
$vor = ($colcount > $next) ? $start + $amount : $start;
$back = $start - $amount;
$zur = ($back >= 0) ? $start - $amount : $start;
$o = (string) $ui->st('o', 'get');
if ($ui->st('o', 'get') == 'dd') {
$orderby = 'v.`dns` DESC';
} else if ($ui->st('o', 'get') == 'ad') {
$orderby = 'v.`dns` ASC';
} else if ($ui->st('o', 'get') == 'dc') {
$orderby = 'u.`cname` DESC';
} else if ($ui->st('o', 'get') == 'ac') {
$orderby = 'u.`cname` ASC';
} else if ($ui->st('o', 'get') == 'ds') {
$orderby = 'v.`active` DESC';
} else if ($ui->st('o', 'get') == 'as') {
$orderby = 'v.`active` ASC';
} else if ($ui->st('o', 'get') == 'di') {
$orderby = 'v.`fastdlVhostID` DESC';
} else {
$orderby = 'v.`fastdlVhostID` ASC';
$o = 'ai';
}
$query = $sql->prepare("SELECT v.*,u.`cname` FROM `fastdlVhost` AS v LEFT JOIN `userdata` u ON v.`userID`=u.`id` WHERE v.`resellerID`=? ORDER BY " . $orderby . " LIMIT " . $start . "," . $amount);
$query2 = $sql->prepare("SELECT `action`,`extraData` FROM `jobs` WHERE `affectedID`=? AND `type`='fd' AND (`status` IS NULL OR `status`=1 OR `status`=4) ORDER BY `jobID` DESC LIMIT 1");
$query->execute(array($resellerLockupID));
foreach ($query->fetchAll(PDO::FETCH_ASSOC) as $row) {
$jobPending = $gsprache->no;
if ($row['jobPending'] == 'Y') {
$query2->execute(array($row['dedicatedID']));
foreach ($query2->fetchAll(PDO::FETCH_ASSOC) as $row2) {
if ($row2['action'] == 'ad') {
$jobPending = $gsprache->add;
} else if ($row2['action'] == 'dl') {
$jobPending = $gsprache->del;
} else {
$jobPending = $gsprache->mod;
}
$json = @json_decode($row2['extraData']);
$tobeActive = (is_object($json) and isset($json->newActive)) ? $json->newActive : 'N';
}
}
$active = 'Y';
if ($row['jobPending'] == 'Y' and isset($tobeActive) and $tobeActive == 'Y') {
$active = 'Y';
} else if ($row['active'] == 'N') {
$active = 'N';
}
$table[] = array('id' => $row['fastdlVhostID'], 'active' => $row['active'], 'dns' => $row['dns'], 'hdd' => $row['hdd'], 'jobPending' => $jobPending, 'userID' => $row['userID'], 'cname' => $row['cname']);
}
$pageamount = ceil($colcount / $amount);
$link = '<a href="admin.php?w=fv&amp;o=' . $o . '&amp;a=' . $amount;
$link .= ($start == 0) ? '&p=0" class="bold">1</a>' : '&p=0">1</a>';
$pages[] = $link;
$i = 2;
while ($i <= $pageamount) {
$selectpage = ($i - 1) * $amount;
$pages[] = ($start == $selectpage) ? '<a href="admin.php?w=fv&amp;o=' . $o . '&amp;a=' . $amount . '&p=' . $selectpage . '" class="bold">' . $i . '</a>' : '<a href="admin.php?w=fv&amp;o=' . $o . '&amp;a=' . $amount . '&p=' . $selectpage . '">' . $i . '</a>';
$i++;
}
$pages = implode(', ',$pages);
$template_file = 'admin_fastdl_vhost_list.tpl';
}

View File

@ -215,6 +215,8 @@ $query = "CREATE TABLE IF NOT EXISTS `fastdlMaster` (
`pass` blob,
`publickey` enum('B','Y','N') DEFAULT 'N',
`keyname` varchar(255),
`ftpIP` varchar(15),
`ftpPort` int(5) unsigned,
`maxVhost` int(10) unsigned,
`maxHDD` int(10) unsigned,
`defaultdns` varchar(255),
@ -236,6 +238,24 @@ $query = "CREATE TABLE IF NOT EXISTS `fastdlMaster` (
$add = $sql->prepare($query);
$add->execute();
$query = "CREATE TABLE IF NOT EXISTS `fastdlVhost` (
`fastdlVhostID` int(10) unsigned NOT NULL AUTO_INCREMENT,
`fastdlMasterID` int(10) unsigned NOT NULL,
`userID` int(10) unsigned NOT NULL,
`active` enum('Y','N') DEFAULT 'Y',
`jobPending` enum('Y','N') DEFAULT 'N',
`hdd` int(10) unsigned DEFAULT 0,
`dns` varchar(255),
`ftpUser` varchar(255),
`ftpPassword` blob,
`ownVhost` enum('Y','N') DEFAULT 'N',
`vhostTemplate` text,
`resellerID` int(10) unsigned DEFAULT 0,
PRIMARY KEY (`fastdlVhostID`),KEY(`fastdlMasterID`),KEY(`userID`),KEY(`resellerID`)
) ENGINE=InnoDB";
$add = $sql->prepare($query);
$add->execute();
$query = "CREATE TABLE IF NOT EXISTS `feeds_news` (
`newsID` bigint(19) unsigned NOT NULL AUTO_INCREMENT,
`feedID` int(10) unsigned NOT NULL,

View File

@ -258,6 +258,8 @@ $defined['fastdlMaster'] = array(
'pass' => array("Type"=>"blob","Null"=>"YES","Key"=>"","Default"=>"","Extra"=>""),
'publickey' => array("Type"=>"enum('B','Y','N')","Null"=>"YES","Key"=>"","Default"=>"","Extra"=>""),
'keyname' => array("Type"=>"varchar(255)","Null"=>"YES","Key"=>"","Default"=>"","Extra"=>""),
'ftpIP' => array("Type"=>"varchar(15)","Null"=>"YES","Key"=>"","Default"=>"","Extra"=>""),
'ftpPort' => array("Type"=>"int(5) unsigned","Null"=>"YES","Key"=>"","Default"=>"","Extra"=>""),
'maxVhost' => array("Type"=>"int(10) unsigned","Null"=>"YES","Key"=>"","Default"=>"0","Extra"=>""),
'maxHDD' => array("Type"=>"int(10) unsigned","Null"=>"YES","Key"=>"","Default"=>"0","Extra"=>""),
'defaultdns' => array("Type"=>"varchar(255)","Null"=>"YES","Key"=>"","Default"=>"","Extra"=>""),
@ -276,6 +278,21 @@ $defined['fastdlMaster'] = array(
'resellerID' => array("Type"=>"int(10) unsigned","Null"=>"YES","Key"=>"MUL","Default"=>"0","Extra"=>"")
);
$defined['fastdlVhost'] = array(
'fastdlVhostID' => array("Type"=>"int(10) unsigned","Null"=>"NO","Key"=>"PRI","Default"=>"","Extra"=>"auto_increment"),
'fastdlMasterID' => array("Type"=>"int(10) unsigned","Null"=>"NO","Key"=>"MUL","Default"=>"","Extra"=>""),
'userID' => array("Type"=>"int(10) unsigned","Null"=>"NO","Key"=>"MUL","Default"=>"","Extra"=>""),
'active' => array("Type"=>"enum('Y','N')","Null"=>"YES","Key"=>"","Default"=>"Y","Extra"=>""),
'jobPending' => array("Type"=>"enum('Y','N')","Null"=>"YES","Key"=>"","Default"=>"N","Extra"=>""),
'hdd' => array("Type"=>"int(10) unsigned","Null"=>"YES","Key"=>"","Default"=>"0","Extra"=>""),
'dns' => array("Type"=>"varchar(255)","Null"=>"YES","Key"=>"","Default"=>"","Extra"=>""),
'ftpUser' => array("Type"=>"varchar(255)","Null"=>"YES","Key"=>"","Default"=>"","Extra"=>""),
'ftpPassword' => array("Type"=>"blob","Null"=>"YES","Key"=>"","Default"=>"","Extra"=>""),
'ownVhost' => array("Type"=>"enum('Y','N')","Null"=>"YES","Key"=>"","Default"=>"N","Extra"=>""),
'vhostTemplate' => array("Type"=>"text","Null"=>"YES","Key"=>"","Default"=>"","Extra"=>""),
'resellerID' => array("Type"=>"int(10) unsigned","Null"=>"YES","Key"=>"MUL","Default"=>"0","Extra"=>"")
);
$defined['feeds_news'] = array(
'newsID' => array("Type"=>"bigint(19) unsigned","Null"=>"NO","Key"=>"PRI","Default"=>"","Extra"=>"auto_increment"),
'feedID' => array("Type"=>"int(10) unsigned","Null"=>"NO","Key"=>"MUL","Default"=>"0","Extra"=>""),

View File

@ -7,6 +7,9 @@
</ul>
</div>
</div>
<div class="alert alert-info">
<?php echo $sprache->help_fdl_master;?>
</div>
<?php if (count($errors)>0){ ?>
<div class="alert alert-error">
<button type="button" class="close" data-dismiss="alert">&times;</button>
@ -58,6 +61,14 @@
<label class="control-label" for="inputSshPass"><?php echo $dedicatedLanguage->ssh_pass;?></label>
<div class="controls"><input id="inputSshPass" class="span11" type="password" name="pass" value="<?php echo $pass;?>"></div>
</div>
<div class="control-group">
<label class="control-label" for="inputftpIP"><?php echo $sprache->ftpIP.' '.$sprache->optional;?></label>
<div class="controls"><input id="inputftpIP" class="span11" type="text" name="ftpIP" value="<?php echo $ftpIP;?>" maxlength="15" ></div>
</div>
<div class="control-group<?php if(isset($errors['ftpPort'])) echo ' error';?>">
<label class="control-label" for="inputftpPort"><?php echo $sprache->ftpPort;?></label>
<div class="controls"><input id="inputftpPort" class="span11" type="number" name="ftpPort" value="<?php echo $ftpPort;?>" maxlength="5" required></div>
</div>
<div class="control-group">
<label class="control-label" for="inputDesc"><?php echo $dedicatedLanguage->description;?></label>
<div class="controls"><input id="inputDesc" class="span11" type="text" name="description" value="<?php echo $description;?>"></div>

View File

@ -11,9 +11,9 @@
<div class="row-fluid">
<div class="span6">
<dl class="dl-horizontal">
<dt><?php echo $sprache->ssh_ip?></dt>
<dt><?php echo $dedicatedLanguage->ssh_ip?></dt>
<dd><?php echo $ip;?></dd>
<dt><?php echo $sprache->description?></dt>
<dt><?php echo $dedicatedLanguage->description?></dt>
<dd><?php echo $description;?></dd>
</dl>
</div>

View File

@ -50,7 +50,7 @@
<tbody>
<?php foreach($table_row['dns'] as $row){ ?>
<tr class="<?php if($row['active']=='Y') echo 'success'; else echo 'warning';?>">
<td><?php echo $row['address'];?></td>
<td><?php echo $row['dns'];?></td>
<td><a href="admin.php?w=fv&amp;d=dl&amp;id=<?php echo $row['id'];?>" ><span class="btn btn-mini btn-danger"><i class="fa fa-trash-o"></i></span></a></td>
<td><a href="admin.php?w=fv&amp;d=md&amp;id=<?php echo $row['id'];?>" ><span class="btn btn-mini btn-primary"><i class="icon-white icon-edit"></i></span></a></td>
</tr>

View File

@ -8,6 +8,9 @@
</ul>
</div>
</div>
<div class="alert alert-info">
<?php echo $sprache->help_fdl_master;?>
</div>
<?php if (count($errors)>0){ ?>
<div class="alert alert-error">
<button type="button" class="close" data-dismiss="alert">&times;</button>
@ -59,6 +62,14 @@
<label class="control-label" for="inputSshPass"><?php echo $dedicatedLanguage->ssh_pass;?></label>
<div class="controls"><input id="inputSshPass" class="span11" type="password" name="pass" value="<?php echo $pass;?>"></div>
</div>
<div class="control-group">
<label class="control-label" for="inputftpIP"><?php echo $sprache->ftpIP.' '.$sprache->optional;?></label>
<div class="controls"><input id="inputftpIP" class="span11" type="text" name="ftpIP" value="<?php echo $ftpIP;?>" maxlength="15" ></div>
</div>
<div class="control-group<?php if(isset($errors['ftpPort'])) echo ' error';?>">
<label class="control-label" for="inputftpPort"><?php echo $sprache->ftpPort;?></label>
<div class="controls"><input id="inputftpPort" class="span11" type="number" name="ftpPort" value="<?php echo $ftpPort;?>" maxlength="5" required></div>
</div>
<div class="control-group">
<label class="control-label" for="inputDesc"><?php echo $dedicatedLanguage->description;?></label>
<div class="controls"><input id="inputDesc" class="span11" type="text" name="description" value="<?php echo $description;?>"></div>

View File

@ -0,0 +1,106 @@
<div class="row-fluid">
<div class="span12">
<ul class="breadcrumb">
<li><a href="admin.php">Home</a> <span class="divider">/</span></li>
<li><a href="admin.php?w=fv"><?php echo $gsprache->fastdownload;?> Vhost</a> <span class="divider">/</span></li>
<li class="active"><?php echo $gsprache->add;?></li>
</ul>
</div>
</div>
<?php if (count($errors)>0){ ?>
<div class="alert alert-error">
<button type="button" class="close" data-dismiss="alert">&times;</button>
<h4>Error(s)</h4>
<?php echo implode(', ',$errors);?>
</div>
<?php }?>
<div class="row-fluid">
<div class="span11">
<form class="form-horizontal" action="admin.php?w=fv&amp;d=ad&amp;r=fv" onsubmit="return confirm('<?php echo $gsprache->sure; ?>');" method="post">
<input type="hidden" name="token" value="<?php echo token();?>">
<input type="hidden" name="action" value="ad">
<div class="control-group<?php if(isset($errors['userID'])) echo ' error';?>">
<label class="control-label" for="inputUserID"><?php echo $dedicatedLanguage->user;?></label>
<div class="controls">
<select id="inputUserID" name="userID" class="span11">
<?php foreach ($table as $k=>$v){ ?>
<option value="<?php echo $k;?>" <?php if ($userID==$k) echo 'selected="selected";'?>><?php echo $v;?></option>
<?php } ?>
</select>
</div>
</div>
<div class="control-group">
<label class="control-label" for="inputFtpPassword"><?php echo $sprache->ftpPassword;?></label>
<div class="controls"><input id="inputFtpPassword" class="span11" type="text" name="ftpPassword" value="<?php echo $ftpPassword;?>" required></div>
</div>
<div class="control-group<?php if(isset($errors['active'])) echo ' error';?>">
<label class="control-label" for="inputActive"><?php echo $dedicatedLanguage->active;?></label>
<div class="controls">
<select id="inputActive" class="span11" name="active">
<option value="Y"><?php echo $gsprache->yes;?></option>
<option value="N" <?php if ($active=='N') echo 'selected="selected";'?>><?php echo $gsprache->no;?></option>
</select>
</div>
</div>
<div class="control-group<?php if(isset($errors['fastdlMasterID'])) echo ' error';?>">
<label class="control-label" for="inputFastdlMasterID"><?php echo $gsprache->master;?></label>
<div class="controls">
<select id="inputFastdlMasterID" name="fastdlMasterID" class="span11" onchange="getdetails('ajax.php?d=fastdlmaster&id=', this.value)">
<?php foreach ($table2 as $k=>$v){ ?>
<option value="<?php echo $k;?>" <?php if ($fastdlMasterID==$k) echo 'selected="selected";'?>><?php echo $v;?></option>
<?php } ?>
</select>
</div>
</div>
<div id="information">
<div class="control-group">
<label class="control-label lead" for="displayUsage"><b><?php echo $sprache->usage;?></b></label>
<div class="controls">
<dl id="displayUsage">
<dt><?php echo $sprache->maxVhost;?></dt>
<dd><?php echo $totalVhosts.'/'.$maxVhost;?></dd>
<dt><?php echo $sprache->maxHDD;?></dt>
<dd><?php echo $leftHDD.'/'.$maxHDD;?> MB</dd>
</dl>
</div>
</div>
<?php if($quotaActive=='Y'){ ?>
<div class="control-group<?php if(isset($errors['hdd'])) echo ' error';?>">
<label class="control-label" for="inputHDD"><?php echo $sprache->hdd;?></label>
<div class="controls">
<div class="input-append span12">
<input id="inputHDD" class="span11" type="number" name="hdd" value="<?php echo $hdd;?>">
<span class="add-on">MB</span>
</div>
</div>
</div>
<?php } ?>
<div class="control-group">
<label class="control-label" for="inputDNS"><?php echo $sprache->dns;?></label>
<div class="controls"><input id="inputDNS" class="span11" type="text" name="dns" value="<?php echo $dns;?>" required></div>
</div>
<div class="control-group<?php if(isset($errors['ownVhost'])) echo ' error';?>">
<label class="control-label" for="inputOwnVhost"><?php echo $sprache->ownVhost;?></label>
<div class="controls">
<select id="inputOwnVhost" class="span11" name="ownVhost" onchange="textdrop('OwnVhostTemplate')">
<option value="N"><?php echo $gsprache->no;?></option>
<option value="Y" <?php if ($ownVhost=='Y') echo 'selected="selected";'?>><?php echo $gsprache->yes;?></option>
</select>
</div>
</div>
<div class="control-group<?php if($ownVhost=='N') echo ' display_none';?>" id="OwnVhostTemplate">
<label class="control-label" for="inputvhostTemplate"><?php echo $sprache->vhostTemplate;?></label>
<div class="controls">
<textarea id="inputvhostTemplate" class="span11" name="vhostTemplate" rows="20"><?php echo $vhostTemplate;?></textarea>
</div>
</div>
</div>
<div class="control-group">
<label class="control-label" for="inputEdit"></label>
<div class="controls">
<button class="btn btn-primary" id="inputEdit" type="submit"><i class="icon-plus-sign icon-white"></i> <?php echo $gsprache->add;?></button>
</div>
</div>
</form>
</div>
</div>

View File

@ -0,0 +1,34 @@
<div class="row-fluid">
<div class="span12">
<ul class="breadcrumb">
<li><a href="admin.php">Home</a> <span class="divider">/</span></li>
<li><a href="admin.php?w=fv"><?php echo $gsprache->fastdownload;?> Vhost</a> <span class="divider">/</span></li>
<li><?php echo $gsprache->del;?> <span class="divider">/</span></li>
<li class="active"><?php echo $dns;?></li>
</ul>
</div>
</div>
<div class="row-fluid">
<div class="span6">
<dl class="dl-horizontal">
<dt><?php echo $sprache->dns?></dt>
<dd><?php echo $dns;?></dd>
<dt><?php echo $dedicatedLanguage->user?></dt>
<dd><?php echo $user;?></dd>
</dl>
</div>
</div>
<div class="row-fluid">
<div class="span6">
<form class="form-horizontal" action="admin.php?w=fv&amp;d=dl&amp;id=<?php echo $id;?>&amp;r=fv" onsubmit="return confirm('<?php echo $gsprache->sure; ?>');" method="post">
<input type="hidden" name="token" value="<?php echo token();?>">
<input type="hidden" name="action" value="dl">
<div class="control-group">
<label class="control-label" for="inputEdit"></label>
<div class="controls">
<button class="btn btn-danger pull-left" id="inputEdit" type="submit"><i class="fa fa-trash-o"></i> <?php echo $gsprache->del;?></button>
</div>
</div>
</form>
</div>
</div>

View File

@ -0,0 +1,56 @@
<div class="row-fluid">
<div class="span12">
<ul class="breadcrumb">
<li><a href="admin.php">Home</a> <span class="divider">/</span></li>
<li><a href="admin.php?w=fv"><?php echo $gsprache->fastdownload;?> Vhost</a> <span class="divider">/</span></li>
<li class="active"><?php echo $gsprache->overview;?></li>
</ul>
</div>
</div>
<div class="row-fluid">
<div class="span6">
<?php echo $gsprache->fastdownload;?> Vhost <a href="admin.php?w=fv&amp;d=ad"><span class="btn btn-primary btn-mini"><i class="icon-white icon-plus-sign"></i> <?php echo $gsprache->add;?></span></a>
</div>
</div>
<hr>
<div class="row-fluid">
<div class="span11 pagination">
<ul>
<li><a href="admin.php?w=fv&amp;o=<?php echo $o;?>&amp;a=<?php echo $amount;?>&amp;p=<?php echo $zur;?>"><i class="icon-step-backward"></i></a></li>
<li><a href="admin.php?w=fv&amp;o=<?php echo $o;?>&amp;a=20&amp;p=<?php echo $start; ?>">20</a></li>
<li><a href="admin.php?w=fv&amp;o=<?php echo $o;?>&amp;a=50&amp;p=<?php echo $start; ?>">50</a></li>
<li><a href="admin.php?w=fv&amp;o=<?php echo $o;?>&amp;a=100&amp;p=<?php echo $start; ?>">100</a></li>
<li><a href="admin.php?w=fv&amp;o=<?php echo $o;?>&amp;a=<?php echo $amount;?>&amp;p=<?php echo $vor;?>"><i class="icon-step-forward"></i></a></li>
</ul>
</div>
</div>
<div class="row-fluid">
<div class="span11">
<table class="table table-bordered table-hover table-striped footable">
<thead>
<tr>
<th data-class="expand"><a href="admin.php?w=fv&amp;a=<?php echo $amount;?>&amp;p=<?php echo $start;?>&amp;o=<?php if ($o=='ad') { echo 'dd'; } else { echo 'ad'; } ?>"><?php echo $sprache->dns;?></a></th>
<th data-hide="phone,tablet"><a href="admin.php?w=fv&amp;a=<?php echo $amount;?>&amp;p=<?php echo $start;?>&amp;o=<?php if ($o=='ai') { echo 'di'; } else { echo 'ai'; } ?>">ID</a></th>
<th data-hide="phone,tablet"><a href="admin.php?w=fv&amp;a=<?php echo $amount;?>&amp;p=<?php echo $start;?>&amp;o=<?php if ($o=='as') { echo 'ds'; } else { echo 'as'; } ?>"><?php echo $gsprache->status;?></a></th>
<th data-hide="phone,tablet"><a href="admin.php?w=fv&amp;a=<?php echo $amount;?>&amp;p=<?php echo $start;?>&amp;o=<?php if ($o=='ac') { echo 'dc'; } else { echo 'ac'; } ?>"><?php echo $dedicatedLanguage->user;?></a></th>
<th data-hide="phone,tablet"><?php echo $gsprache->jobPending;?></th>
<th><?php echo $gsprache->del;?></th>
<th><?php echo $gsprache->mod;?></th>
</tr>
</thead>
<tbody>
<?php foreach ($table as $table_row) { ?>
<tr>
<td><?php echo $table_row['dns'];?></td>
<td><?php echo $table_row['id'];?></td>
<td><i class="<?php if($table_row['active']=='Y') echo 'fa fa-check'; else echo 'fa fa-ban';?>"></i></td>
<td><?php if(isid($table_row['userID'], 10)) { ?><a href="switch.php?id=<?php echo $table_row['userID'];?>"><?php echo $table_row['cname'];?></a><?php }?></td>
<td><?php echo $table_row['jobPending'];?></td>
<td><a href="admin.php?w=fv&amp;d=dl&amp;id=<?php echo $table_row['id'];?>" ><span class="btn btn-mini btn-danger"><i class="fa fa-trash-o"></i></span></a></td>
<td><a href="admin.php?w=fv&amp;d=md&amp;id=<?php echo $table_row['id'];?>" ><span class="btn btn-mini btn-primary"><i class="icon-white icon-edit"></i></span></a></td>
</tr>
<?php } ?>
</tbody>
</table>
</div>
</div>

View File

@ -0,0 +1,85 @@
<div class="row-fluid">
<div class="span12">
<ul class="breadcrumb">
<li><a href="admin.php">Home</a> <span class="divider">/</span></li>
<li><a href="admin.php?w=fv"><?php echo $gsprache->fastdownload;?> Vhost</a> <span class="divider">/</span></li>
<li><?php echo $gsprache->mod;?> <span class="divider">/</span></li>
<li class="active"><?php echo $dns;?></li>
</ul>
</div>
</div>
<?php if (count($errors)>0){ ?>
<div class="alert alert-error">
<button type="button" class="close" data-dismiss="alert">&times;</button>
<h4>Error(s)</h4>
<?php echo implode(', ',$errors);?>
</div>
<?php }?>
<div class="row-fluid">
<div class="span11">
<form class="form-horizontal" action="admin.php?w=fv&amp;d=md&amp;id=<?php echo $id;?>&amp;r=fv" onsubmit="return confirm('<?php echo $gsprache->sure; ?>');" method="post">
<input type="hidden" name="token" value="<?php echo token();?>">
<input type="hidden" name="action" value="md">
<div class="control-group">
<label class="control-label lead" for="displayServerInfo"><b><?php echo $gsprache->fastdownload.' '.$gsprache->master;?></b></label>
<div class="controls">
<dl id="displayServerInfo">
<dt><?php echo $sprache->maxHDD;?></dt>
<dd><?php echo $leftHDD.'/'.$maxHDD;?> MB</dd>
<dt><?php echo $sprache->ftpIP;?></dt>
<dd><?php echo $ftpServer;?></dd>
</dl>
</div>
</div>
<div class="control-group">
<label class="control-label" for="inputFtpPassword"><?php echo $sprache->ftpPassword;?></label>
<div class="controls"><input id="inputFtpPassword" class="span11" type="text" name="ftpPassword" value="<?php echo $ftpPassword;?>" required></div>
</div>
<div class="control-group<?php if(isset($errors['active'])) echo ' error';?>">
<label class="control-label" for="inputActive"><?php echo $dedicatedLanguage->active;?></label>
<div class="controls">
<select id="inputActive" class="span11" name="active">
<option value="Y"><?php echo $gsprache->yes;?></option>
<option value="N" <?php if ($active=='N') echo 'selected="selected";'?>><?php echo $gsprache->no;?></option>
</select>
</div>
</div>
<?php if($quotaActive=='Y'){ ?>
<div class="control-group<?php if(isset($errors['hdd'])) echo ' error';?>">
<label class="control-label" for="inputHDD"><?php echo $sprache->hdd;?></label>
<div class="controls">
<div class="input-append span12">
<input id="inputHDD" class="span11" type="number" name="hdd" value="<?php echo $hdd;?>">
<span class="add-on">MB</span>
</div>
</div>
</div>
<?php } ?>
<div class="control-group">
<label class="control-label" for="inputDNS"><?php echo $sprache->dns;?></label>
<div class="controls"><input id="inputDNS" class="span11" type="text" name="dns" value="<?php echo $dns;?>" required></div>
</div>
<div class="control-group<?php if(isset($errors['ownVhost'])) echo ' error';?>">
<label class="control-label" for="inputOwnVhost"><?php echo $sprache->ownVhost;?></label>
<div class="controls">
<select id="inputOwnVhost" class="span11" name="ownVhost" onchange="textdrop('OwnVhostTemplate')">
<option value="N"><?php echo $gsprache->no;?></option>
<option value="Y" <?php if ($ownVhost=='Y') echo 'selected="selected";'?>><?php echo $gsprache->yes;?></option>
</select>
</div>
</div>
<div class="control-group<?php if($ownVhost=='N') echo ' display_none';?>" id="OwnVhostTemplate">
<label class="control-label" for="inputvhostTemplate"><?php echo $sprache->vhostTemplate;?></label>
<div class="controls">
<textarea id="inputvhostTemplate" class="span11" name="vhostTemplate" rows="20"><?php echo $vhostTemplate;?></textarea>
</div>
</div>
<div class="control-group">
<label class="control-label" for="inputEdit"></label>
<div class="controls">
<button class="btn btn-primary" id="inputEdit" type="submit"><i class="icon-plus-sign icon-white"></i> <?php echo $gsprache->add;?></button>
</div>
</div>
</form>
</div>
</div>

View File

@ -9,7 +9,7 @@
</div>
<div class="row-fluid">
<div class="span6">
<?php echo $gsprache->dedicated;?> <a href="admin.php?w=rh&amp;d=ad"><span class="btn btn-primary btn-mini"><i class="icon-white icon-plus-sign"></i></span></a>
<?php echo $gsprache->dedicated;?> <a href="admin.php?w=rh&amp;d=ad"><span class="btn btn-primary btn-mini"><i class="icon-white icon-plus-sign"></i> <?php echo $gsprache->add;?></span></a>
</div>
</div>
<hr>

View File

@ -0,0 +1,42 @@
<div class="control-group">
<label class="control-label lead" for="displayUsage"><b><?php echo $sprache->usage;?></b></label>
<div class="controls">
<dl id="displayUsage">
<dt><?php echo $sprache->maxVhost;?></dt>
<dd><?php echo $totalVhosts.'/'.$maxVhost;?></dd>
<dt><?php echo $sprache->maxHDD;?></dt>
<dd><?php echo $leftHDD.'/'.$maxHDD;?> MB</dd>
</dl>
</div>
</div>
<?php if($quotaActive=='Y'){ ?>
<div class="control-group<?php if(isset($errors['hdd'])) echo ' error';?>">
<label class="control-label" for="inputHDD"><?php echo $sprache->hdd;?></label>
<div class="controls">
<div class="input-append span12">
<input id="inputHDD" class="span11" type="number" name="hdd" value="1000">
<span class="add-on">MB</span>
</div>
</div>
</div>
<?php } ?>
<div class="control-group">
<label class="control-label" for="inputDNS"><?php echo $sprache->dns;?></label>
<div class="controls"><input id="inputDNS" class="span11" type="text" name="dns" value="<?php echo $dns;?>" required></div>
</div>
<div class="control-group<?php if(isset($errors['ownVhost'])) echo ' error';?>">
<label class="control-label" for="inputOwnVhost"><?php echo $sprache->ownVhost;?></label>
<div class="controls">
<select id="inputOwnVhost" class="span11" name="ownVhost" onchange="textdrop('OwnVhostTemplate')">
<option value="N"><?php echo $gsprache->no;?></option>
<option value="Y"><?php echo $gsprache->yes;?></option>
</select>
</div>
</div>
<div class="control-group" id="OwnVhostTemplate" style="display: none;">
<label class="control-label" for="inputvhostTemplate"><?php echo $sprache->vhostTemplate;?></label>
<div class="controls">
<textarea id="inputvhostTemplate" class="span11" name="vhostTemplate" rows="20"><?php echo $vhostTemplate;?></textarea>
</div>
</div>