add language strings (english only currently)
Signed-off-by: Michael Kaufmann (d00p) <d00p@froxlor.org>
This commit is contained in:
@@ -4,3 +4,38 @@ if (! defined('FROXLOR_INSTALL_DIR')) {
|
|||||||
require_once FROXLOR_INSTALL_DIR . '/lib/tables.inc.php';
|
require_once FROXLOR_INSTALL_DIR . '/lib/tables.inc.php';
|
||||||
require_once FROXLOR_INSTALL_DIR . '/lib/functions.php';
|
require_once FROXLOR_INSTALL_DIR . '/lib/functions.php';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// query the whole table
|
||||||
|
$result_stmt = Database::query("SELECT * FROM `" . TABLE_PANEL_LANGUAGE . "`");
|
||||||
|
|
||||||
|
$langs = array();
|
||||||
|
// presort languages
|
||||||
|
while ($row = $result_stmt->fetch(PDO::FETCH_ASSOC)) {
|
||||||
|
$langs[$row['language']][] = $row;
|
||||||
|
// check for row[iso] cause older froxlor
|
||||||
|
// versions didn't have that and it will
|
||||||
|
// lead to a lot of undfined variables
|
||||||
|
// before the admin can even update
|
||||||
|
if (isset($row['iso'])) {
|
||||||
|
$iso[$row['iso']] = $row['language'];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// set default language before anything else to
|
||||||
|
// ensure that we can display messages
|
||||||
|
$language = Settings::Get('panel.standardlanguage');
|
||||||
|
|
||||||
|
// include every english language file we can get
|
||||||
|
foreach ($langs['English'] as $key => $value) {
|
||||||
|
include_once makeSecurePath($value['file']);
|
||||||
|
}
|
||||||
|
|
||||||
|
// now include the selected language if its not english
|
||||||
|
if ($language != 'English') {
|
||||||
|
foreach ($langs[$language] as $key => $value) {
|
||||||
|
include_once makeSecurePath($value['file']);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// last but not least include language references file
|
||||||
|
include_once makeSecurePath('lng/lng_references.php');
|
||||||
|
|||||||
@@ -175,31 +175,31 @@ class IpsAndPorts extends ApiCommand
|
|||||||
$id = $this->getParam('id');
|
$id = $this->getParam('id');
|
||||||
|
|
||||||
$result_stmt = Database::prepare("
|
$result_stmt = Database::prepare("
|
||||||
SELECT * FROM `" . TABLE_PANEL_IPSANDPORTS . "` WHERE `id` = :id
|
SELECT * FROM `" . TABLE_PANEL_IPSANDPORTS . "` WHERE `id` = :id
|
||||||
");
|
");
|
||||||
$result = Database::pexecute_first($result_stmt, array(
|
$result = Database::pexecute_first($result_stmt, array(
|
||||||
'id' => $id
|
'id' => $id
|
||||||
), true, true);
|
), true, true);
|
||||||
|
|
||||||
$ip = validate_ip2($this->getParam('ip'), false, 'invalidip', false, false, false, true);
|
$ip = validate_ip2($this->getParam('ip', $result['ip']), false, 'invalidip', false, false, false, true);
|
||||||
$port = validate($this->getParam('port'), 'port', '/^(([1-9])|([1-9][0-9])|([1-9][0-9][0-9])|([1-9][0-9][0-9][0-9])|([1-5][0-9][0-9][0-9][0-9])|(6[0-4][0-9][0-9][0-9])|(65[0-4][0-9][0-9])|(655[0-2][0-9])|(6553[0-5]))$/Di', array(
|
$port = validate($this->getParam('port', $result['port']), 'port', '/^(([1-9])|([1-9][0-9])|([1-9][0-9][0-9])|([1-9][0-9][0-9][0-9])|([1-5][0-9][0-9][0-9][0-9])|(6[0-4][0-9][0-9][0-9])|(65[0-4][0-9][0-9])|(655[0-2][0-9])|(6553[0-5]))$/Di', array(
|
||||||
'stringisempty',
|
'stringisempty',
|
||||||
'myport'
|
'myport'
|
||||||
), array(), true);
|
), array(), true);
|
||||||
$listen_statement = ! empty($this->getParam('listen_statement')) ? 1 : 0;
|
$listen_statement = $this->getParam('listen_statement', $result['listen_statement']);
|
||||||
$namevirtualhost_statement = ! empty($this->getParam('namevirtualhost_statement')) ? 1 : 0;
|
$namevirtualhost_statement = $this->getParam('namevirtualhost_statement', $result['namevirtualhost_statement']);
|
||||||
$vhostcontainer = ! empty($this->getParam('vhostcontainer')) ? 1 : 0;
|
$vhostcontainer = $this->getParam('vhostcontainer', $result['vhostcontainer']);
|
||||||
$specialsettings = validate(str_replace("\r\n", "\n", $this->getParam('specialsettings')), 'specialsettings', '/^[^\0]*$/', '', array(), true);
|
$specialsettings = validate(str_replace("\r\n", "\n", $this->getParam('specialsettings', $result['specialsettings'])), 'specialsettings', '/^[^\0]*$/', '', array(), true);
|
||||||
$vhostcontainer_servername_statement = ! empty($this->getParam('vhostcontainer_servername_statement')) ? 1 : 0;
|
$vhostcontainer_servername_statement = $this->getParam('vhostcontainer_servername_statement', $result['vhostcontainer_servername_statement']);
|
||||||
$default_vhostconf_domain = validate(str_replace("\r\n", "\n", $this->getParam('default_vhostconf_domain')), 'default_vhostconf_domain', '/^[^\0]*$/', '', array(), true);
|
$default_vhostconf_domain = validate(str_replace("\r\n", "\n", $this->getParam('default_vhostconf_domain', $result['default_vhostconf_domain'])), 'default_vhostconf_domain', '/^[^\0]*$/', '', array(), true);
|
||||||
$docroot = validate($this->getParam('docroot'), 'docroot', '', '', array(), true);
|
$docroot = validate($this->getParam('docroot', $result['docroot']), 'docroot', '', '', array(), true);
|
||||||
|
|
||||||
if ((int) Settings::Get('system.use_ssl') == 1) {
|
if ((int) Settings::Get('system.use_ssl') == 1) {
|
||||||
$ssl = ! empty($this->getParam('ssl')) ? intval($this->getParam('ssl')) : 0;
|
$ssl = $this->getParam('ssl', $result['ssl']);
|
||||||
$ssl_cert_file = validate($this->getParam('ssl_cert_file'), 'ssl_cert_file', '', '', array(), true);
|
$ssl_cert_file = validate($this->getParam('ssl_cert_file', $result['ssl_cert_file']), 'ssl_cert_file', '', '', array(), true);
|
||||||
$ssl_key_file = validate($this->getParam('ssl_key_file'), 'ssl_key_file', '', '', array(), true);
|
$ssl_key_file = validate($this->getParam('ssl_key_file', $result['ssl_key_file']), 'ssl_key_file', '', '', array(), true);
|
||||||
$ssl_ca_file = validate($this->getParam('ssl_ca_file'), 'ssl_ca_file', '', '', array(), true);
|
$ssl_ca_file = validate($this->getParam('ssl_ca_file', $result['ssl_ca_file']), 'ssl_ca_file', '', '', array(), true);
|
||||||
$ssl_cert_chainfile = validate($this->getParam('ssl_cert_chainfile'), 'ssl_cert_chainfile', '', '', array(), true);
|
$ssl_cert_chainfile = validate($this->getParam('ssl_cert_chainfile', $result['ssl_cert_chainfile']), 'ssl_cert_chainfile', '', '', array(), true);
|
||||||
} else {
|
} else {
|
||||||
$ssl = 0;
|
$ssl = 0;
|
||||||
$ssl_cert_file = '';
|
$ssl_cert_file = '';
|
||||||
@@ -209,22 +209,22 @@ class IpsAndPorts extends ApiCommand
|
|||||||
}
|
}
|
||||||
|
|
||||||
$result_checkfordouble_stmt = Database::prepare("
|
$result_checkfordouble_stmt = Database::prepare("
|
||||||
SELECT `id` FROM `" . TABLE_PANEL_IPSANDPORTS . "`
|
SELECT `id` FROM `" . TABLE_PANEL_IPSANDPORTS . "`
|
||||||
WHERE `ip` = :ip AND `port` = :port
|
WHERE `ip` = :ip AND `port` = :port
|
||||||
");
|
");
|
||||||
$result_checkfordouble = Database::pexecute_first($result_checkfordouble_stmt, array(
|
$result_checkfordouble = Database::pexecute_first($result_checkfordouble_stmt, array(
|
||||||
'ip' => $ip,
|
'ip' => $ip,
|
||||||
'port' => $port
|
'port' => $port
|
||||||
));
|
));
|
||||||
|
|
||||||
$result_sameipotherport_stmt = Database::prepare("
|
$result_sameipotherport_stmt = Database::prepare("
|
||||||
SELECT `id` FROM `" . TABLE_PANEL_IPSANDPORTS . "`
|
SELECT `id` FROM `" . TABLE_PANEL_IPSANDPORTS . "`
|
||||||
WHERE `ip` = :ip AND `id` <> :id
|
WHERE `ip` = :ip AND `id` <> :id
|
||||||
");
|
");
|
||||||
$result_sameipotherport = Database::pexecute_first($result_sameipotherport_stmt, array(
|
$result_sameipotherport = Database::pexecute_first($result_sameipotherport_stmt, array(
|
||||||
'ip' => $ip,
|
'ip' => $ip,
|
||||||
'id' => $id
|
'id' => $id
|
||||||
));
|
), true, true);
|
||||||
|
|
||||||
if ($listen_statement != '1') {
|
if ($listen_statement != '1') {
|
||||||
$listen_statement = '0';
|
$listen_statement = '0';
|
||||||
@@ -275,17 +275,17 @@ class IpsAndPorts extends ApiCommand
|
|||||||
} else {
|
} else {
|
||||||
|
|
||||||
$upd_stmt = Database::prepare("
|
$upd_stmt = Database::prepare("
|
||||||
UPDATE `" . TABLE_PANEL_IPSANDPORTS . "`
|
UPDATE `" . TABLE_PANEL_IPSANDPORTS . "`
|
||||||
SET
|
SET
|
||||||
`ip` = :ip, `port` = :port, `listen_statement` = :ls,
|
`ip` = :ip, `port` = :port, `listen_statement` = :ls,
|
||||||
`namevirtualhost_statement` = :nvhs, `vhostcontainer` = :vhc,
|
`namevirtualhost_statement` = :nvhs, `vhostcontainer` = :vhc,
|
||||||
`vhostcontainer_servername_statement` = :vhcss,
|
`vhostcontainer_servername_statement` = :vhcss,
|
||||||
`specialsettings` = :ss, `ssl` = :ssl,
|
`specialsettings` = :ss, `ssl` = :ssl,
|
||||||
`ssl_cert_file` = :ssl_cert, `ssl_key_file` = :ssl_key,
|
`ssl_cert_file` = :ssl_cert, `ssl_key_file` = :ssl_key,
|
||||||
`ssl_ca_file` = :ssl_ca, `ssl_cert_chainfile` = :ssl_chain,
|
`ssl_ca_file` = :ssl_ca, `ssl_cert_chainfile` = :ssl_chain,
|
||||||
`default_vhostconf_domain` = :dvhd, `docroot` = :docroot
|
`default_vhostconf_domain` = :dvhd, `docroot` = :docroot
|
||||||
WHERE `id` = :id;
|
WHERE `id` = :id;
|
||||||
");
|
");
|
||||||
$upd_data = array(
|
$upd_data = array(
|
||||||
'ip' => $ip,
|
'ip' => $ip,
|
||||||
'port' => $port,
|
'port' => $port,
|
||||||
|
|||||||
@@ -61,7 +61,7 @@ function standard_error($errors = '', $replacer = '', $throw_exception = false)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if ($throw_exception) {
|
if ($throw_exception) {
|
||||||
throw new Exception($error);
|
throw new Exception($error, 400);
|
||||||
}
|
}
|
||||||
eval("echo \"" . getTemplate('misc/error', '1') . "\";");
|
eval("echo \"" . getTemplate('misc/error', '1') . "\";");
|
||||||
exit;
|
exit;
|
||||||
|
|||||||
Reference in New Issue
Block a user