minor changes for testing
Signed-off-by: Michael Kaufmann (d00p) <d00p@froxlor.org>
This commit is contained in:
10
api.php
10
api.php
@@ -54,11 +54,13 @@ exit();
|
|||||||
*/
|
*/
|
||||||
function json_response($status, $status_message = '', $data = null)
|
function json_response($status, $status_message = '', $data = null)
|
||||||
{
|
{
|
||||||
$resheader = $_SERVER["SERVER_PROTOCOL"] . " " . $status;
|
if (isset($_SERVER["SERVER_PROTOCOL"]) && ! empty($_SERVER["SERVER_PROTOCOL"])) {
|
||||||
if (! empty($status_message)) {
|
$resheader = $_SERVER["SERVER_PROTOCOL"] . " " . $status;
|
||||||
$resheader .= ' ' . str_replace("\n", " ", $status_message);
|
if (! empty($status_message)) {
|
||||||
|
$resheader .= ' ' . str_replace("\n", " ", $status_message);
|
||||||
|
}
|
||||||
|
header($resheader);
|
||||||
}
|
}
|
||||||
header($resheader);
|
|
||||||
|
|
||||||
$response['status'] = $status;
|
$response['status'] = $status;
|
||||||
$response['status_message'] = $status_message;
|
$response['status_message'] = $status_message;
|
||||||
|
|||||||
@@ -116,7 +116,7 @@ abstract class ApiCommand
|
|||||||
throw new Exception("Invalid user data", 500);
|
throw new Exception("Invalid user data", 500);
|
||||||
}
|
}
|
||||||
$this->logger = FroxlorLogger::getInstanceOf($this->user_data);
|
$this->logger = FroxlorLogger::getInstanceOf($this->user_data);
|
||||||
|
|
||||||
// check whether the user is deactivated
|
// check whether the user is deactivated
|
||||||
if ($this->getUserDetail('deactivated') == 1) {
|
if ($this->getUserDetail('deactivated') == 1) {
|
||||||
$this->logger()->logAction(LOG_ERROR, LOG_INFO, "[API] User '" . $this->getUserDetail('loginnname') . "' tried to use API but is deactivated");
|
$this->logger()->logAction(LOG_ERROR, LOG_INFO, "[API] User '" . $this->getUserDetail('loginnname') . "' tried to use API but is deactivated");
|
||||||
@@ -161,13 +161,13 @@ abstract class ApiCommand
|
|||||||
|
|
||||||
// include every english language file we can get
|
// include every english language file we can get
|
||||||
foreach ($langs['English'] as $key => $value) {
|
foreach ($langs['English'] as $key => $value) {
|
||||||
include_once makeSecurePath($value['file']);
|
include_once makeSecurePath(FROXLOR_INSTALL_DIR . '/' . $value['file']);
|
||||||
}
|
}
|
||||||
|
|
||||||
// now include the selected language if its not english
|
// now include the selected language if its not english
|
||||||
if ($language != 'English') {
|
if ($language != 'English') {
|
||||||
foreach ($langs[$language] as $key => $value) {
|
foreach ($langs[$language] as $key => $value) {
|
||||||
include_once makeSecurePath($value['file']);
|
include_once makeSecurePath(FROXLOR_INSTALL_DIR . '/' . $value['file']);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -400,11 +400,13 @@ abstract class ApiCommand
|
|||||||
*/
|
*/
|
||||||
protected function response($status, $status_message, $data = null)
|
protected function response($status, $status_message, $data = null)
|
||||||
{
|
{
|
||||||
$resheader = $_SERVER["SERVER_PROTOCOL"] . " " . $status;
|
if (isset($_SERVER["SERVER_PROTOCOL"]) && ! empty($_SERVER["SERVER_PROTOCOL"])) {
|
||||||
if (! empty($status_message)) {
|
$resheader = $_SERVER["SERVER_PROTOCOL"] . " " . $status;
|
||||||
$resheader .= ' ' . str_replace("\n", " ", $status_message);
|
if (! empty($status_message)) {
|
||||||
|
$resheader .= ' ' . str_replace("\n", " ", $status_message);
|
||||||
|
}
|
||||||
|
header($resheader);
|
||||||
}
|
}
|
||||||
header($resheader);
|
|
||||||
|
|
||||||
$response['status'] = $status;
|
$response['status'] = $status;
|
||||||
$response['status_message'] = $status_message;
|
$response['status_message'] = $status_message;
|
||||||
|
|||||||
@@ -45,7 +45,7 @@ class Ftps extends ApiCommand implements ResourceEntity
|
|||||||
|
|
||||||
$params = array();
|
$params = array();
|
||||||
if ($this->isAdmin()) {
|
if ($this->isAdmin()) {
|
||||||
if ($this->getUserDetail('customers_see_all') != 1) {
|
if ($this->getUserDetail('customers_see_all') == false) {
|
||||||
// if it's a reseller or an admin who cannot see all customers, we need to check
|
// if it's a reseller or an admin who cannot see all customers, we need to check
|
||||||
// whether the database belongs to one of his customers
|
// whether the database belongs to one of his customers
|
||||||
$json_result = Customers::getLocal($this->getUserData())->list();
|
$json_result = Customers::getLocal($this->getUserData())->list();
|
||||||
|
|||||||
@@ -100,6 +100,11 @@ class Autoloader {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// don't load anything from a namespace, it's not our responsibility
|
||||||
|
if (strpos($class, "\\") !== false) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
// now iterate through the paths
|
// now iterate through the paths
|
||||||
foreach ($paths as $path) {
|
foreach ($paths as $path) {
|
||||||
// valid directory?
|
// valid directory?
|
||||||
|
|||||||
Reference in New Issue
Block a user