Commit 58aa12cd authored by cconard96's avatar cconard96 Committed by Johan Cwiklinski
Browse files

Fix dynamic methods called as static

parent 77e0e347
......@@ -741,7 +741,7 @@ abstract class API extends CommonGLPI {
&& $params['with_networkports']) {
$fields['_networkports'] = [];
if (!NetworkEquipment::canView()) {
$fields['_networkports'] = self::arrayRightError();
$fields['_networkports'] = $this->arrayRightError();
} else {
foreach (NetworkPort::getNetworkPortInstantiations() as $networkport_type) {
$netport_table = $networkport_type::getTable();
......@@ -905,7 +905,7 @@ abstract class API extends CommonGLPI {
&& $params['with_infocoms']) {
$fields['_infocoms'] = [];
if (!Infocom::canView()) {
$fields['_infocoms'] = self::arrayRightError();
$fields['_infocoms'] = $this->arrayRightError();
} else {
$ic = new Infocom();
if ($ic->getFromDBforDevice($itemtype, $id)) {
......@@ -919,7 +919,7 @@ abstract class API extends CommonGLPI {
&& $params['with_contracts']) {
$fields['_contracts'] = [];
if (!Contract::canView()) {
$fields['_contracts'] = self::arrayRightError();
$fields['_contracts'] = $this->arrayRightError();
} else {
$iterator = $DB->request([
'SELECT' => ['glpi_contracts_items.*'],
......@@ -958,7 +958,7 @@ abstract class API extends CommonGLPI {
&& $itemtype != 'KnowbaseItem'
&& $itemtype != 'Reminder'
&& !Document::canView()) {
$fields['_documents'] = self::arrayRightError();
$fields['_documents'] = $this->arrayRightError();
} else {
$doc_criteria = [
'glpi_documents_items.items_id' => $id,
......@@ -1013,7 +1013,7 @@ abstract class API extends CommonGLPI {
&& $params['with_tickets']) {
$fields['_tickets'] = [];
if (!Ticket::canView()) {
$fields['_tickets'] = self::arrayRightError();
$fields['_tickets'] = $this->arrayRightError();
} else {
$criteria = Ticket::getCommonCriteria();
$criteria['WHERE'] = [
......@@ -1032,7 +1032,7 @@ abstract class API extends CommonGLPI {
&& $params['with_problems']) {
$fields['_problems'] = [];
if (!Problem::canView()) {
$fields['_problems'] = self::arrayRightError();
$fields['_problems'] = $this->arrayRightError();
} else {
$criteria = Problem::getCommonCriteria();
$criteria['WHERE'] = [
......@@ -1051,7 +1051,7 @@ abstract class API extends CommonGLPI {
&& $params['with_changes']) {
$fields['_changes'] = [];
if (!Change::canView()) {
$fields['_changes'] = self::arrayRightError();
$fields['_changes'] = $this->arrayRightError();
} else {
$criteria = Change::getCommonCriteria();
$criteria['WHERE'] = [
......@@ -1070,7 +1070,7 @@ abstract class API extends CommonGLPI {
&& $params['with_notes']) {
$fields['_notes'] = [];
if (!Session::haveRight($itemtype::$rightname, READNOTE)) {
$fields['_notes'] = self::arrayRightError();
$fields['_notes'] = $this->arrayRightError();
} else {
$fields['_notes'] = Notepad::getAllForItem($item);
}
......@@ -1081,7 +1081,7 @@ abstract class API extends CommonGLPI {
&& $params['with_logs']) {
$fields['_logs'] = [];
if (!Session::haveRight($itemtype::$rightname, READNOTE)) {
$fields['_logs'] = self::arrayRightError();
$fields['_logs'] = $this->arrayRightError();
} else {
$fields['_logs'] = getAllDataFromTable(
"glpi_logs", [
......@@ -1854,7 +1854,7 @@ abstract class API extends CommonGLPI {
$failed = 0;
$index = 0;
foreach ($input as $object) {
$object = self::inputObjectToArray($object);
$object = $this->inputObjectToArray($object);
$current_res = [];
//check rights
......@@ -2218,9 +2218,9 @@ abstract class API extends CommonGLPI {
}
$this->checkAppToken();
$this->logEndpointUsage($endpoint);
self::checkSessionToken();
$this->checkSessionToken();
if ($unlock_session) {
self::unlockSessionIfPossible();
$this->unlockSessionIfPossible();
}
}
......@@ -2414,7 +2414,7 @@ abstract class API extends CommonGLPI {
* @return void
*/
public function inlineDocumentation($file) {
self::header(true, __("API Documentation"));
$this->header(true, __("API Documentation"));
echo Html::css("public/lib/prismjs.css");
echo Html::script("public/lib/prismjs.js");
......
......@@ -190,7 +190,7 @@ class APIRest extends API {
} else if ($resource === "search") {
// Search on itemtype
self::checkSessionToken();
$this->checkSessionToken();
$itemtype = $this->getItemtype(1, true, true);
//clean stdObjects in parameter
......@@ -555,7 +555,7 @@ class APIRest extends API {
}
http_response_code($httpcode);
self::header($this->debug);
$this->header($this->debug);
if ($response !== null) {
$json = json_encode($response, JSON_UNESCAPED_UNICODE
......
......@@ -119,7 +119,7 @@ class APIXmlrpc extends API {
$this->parameters));
} else if ($resource === "search") { // Search on itemtype
self::checkSessionToken();
$this->checkSessionToken();
//search
$response = $this->searchItems($this->parameters['itemtype'], $this->parameters);
......@@ -300,7 +300,7 @@ class APIXmlrpc extends API {
}
http_response_code($httpcode);
self::header($this->debug);
$this->header($this->debug);
$response = $this->escapekeys($response);
$out = xmlrpc_encode_request(null, $response, ['encoding' => 'UTF-8',
......
......@@ -206,7 +206,7 @@ abstract class CommonDBChild extends CommonDBConnexity {
function canChildItem($methodItem, $methodNotItem) {
try {
return static::canConnexityItem($methodItem, $methodNotItem, static::$checkParentRights,
return $this->canConnexityItem($methodItem, $methodNotItem, static::$checkParentRights,
static::$itemtype, static::$items_id);
} catch (CommonDBConnexityItemNotFound $e) {
return !static::$mustBeAttached;
......
......@@ -436,7 +436,7 @@ abstract class CommonDBRelation extends CommonDBConnexity {
static::$items_id_1, $item1);
}
} catch (CommonDBConnexityItemNotFound $e) {
if (static::$mustBeAttached_1 && !static::isAttach1Valid($this->fields)) {
if (static::$mustBeAttached_1 && !$this->isAttach1Valid($this->fields)) {
return false;
}
$can1 = true;
......@@ -454,7 +454,7 @@ abstract class CommonDBRelation extends CommonDBConnexity {
static::$items_id_2, $item2);
}
} catch (CommonDBConnexityItemNotFound $e) {
if (static::$mustBeAttached_2 && !static::isAttach2Valid($this->fields)) {
if (static::$mustBeAttached_2 && !$this->isAttach2Valid($this->fields)) {
return false;
}
$can2 = true;
......
......@@ -230,7 +230,7 @@ abstract class CommonDropdown extends CommonDBTM {
function prepareInputForUpdate($input) {
//add a "metadata to find if we're on an update or a add
$input['_is_update'] = true;
return self::prepareInputForAdd($input);
return $this->prepareInputForAdd($input);
}
......
......@@ -6952,7 +6952,7 @@ abstract class CommonITILObject extends CommonDBTM {
}
// show title for timeline
static::showTimelineHeader();
$this->showTimelineHeader();
$timeline_index = 0;
foreach ($timeline as $item) {
......
......@@ -238,7 +238,7 @@ HTML;
}
// prepare all available cards
$cards = self::getAllDasboardCards();
$cards = $this->getAllDasboardCards();
$cards_json = json_encode($cards);
// prepare all available widgets
......
......@@ -132,7 +132,7 @@ class DeviceGraphicCard extends CommonDevice {
* @see CommonDropdown::prepareInputForAdd()
**/
function prepareInputForAdd($input) {
return self::prepareInputForAddOrUpdate($input);
return $this->prepareInputForAddOrUpdate($input);
}
......@@ -141,7 +141,7 @@ class DeviceGraphicCard extends CommonDevice {
* @see CommonDropdown::prepareInputForUpdate()
**/
function prepareInputForUpdate($input) {
return self::prepareInputForAddOrUpdate($input);
return $this->prepareInputForAddOrUpdate($input);
}
......
......@@ -139,7 +139,7 @@ class DeviceHardDrive extends CommonDevice {
* @see CommonDropdown::prepareInputForAdd()
**/
function prepareInputForAdd($input) {
return self::prepareInputForAddOrUpdate($input);
return $this->prepareInputForAddOrUpdate($input);
}
......@@ -148,7 +148,7 @@ class DeviceHardDrive extends CommonDevice {
* @see CommonDropdown::prepareInputForUpdate()
**/
function prepareInputForUpdate($input) {
return self::prepareInputForAddOrUpdate($input);
return $this->prepareInputForAddOrUpdate($input);
}
......
......@@ -127,7 +127,7 @@ class DeviceMemory extends CommonDevice {
* @see CommonDropdown::prepareInputForAdd()
**/
function prepareInputForAdd($input) {
return self::prepareInputForAddOrUpdate($input);
return $this->prepareInputForAddOrUpdate($input);
}
......@@ -136,7 +136,7 @@ class DeviceMemory extends CommonDevice {
* @see CommonDropdown::prepareInputForUpdate()
**/
function prepareInputForUpdate($input) {
return self::prepareInputForAddOrUpdate($input);
return $this->prepareInputForAddOrUpdate($input);
}
......
......@@ -136,7 +136,7 @@ class DeviceProcessor extends CommonDevice {
function prepareInputForAdd($input) {
return self::prepareInputForAddOrUpdate($input);
return $this->prepareInputForAddOrUpdate($input);
}
......@@ -145,7 +145,7 @@ class DeviceProcessor extends CommonDevice {
* @see CommonDropdown::prepareInputForUpdate()
**/
function prepareInputForUpdate($input) {
return self::prepareInputForAddOrUpdate($input);
return $this->prepareInputForAddOrUpdate($input);
}
......
......@@ -506,7 +506,7 @@ class Document extends CommonDBTM {
$open = '';
$close = '';
if (self::canView()
|| self::canViewFile(['tickets_id' =>$this->fields['tickets_id']])) {
|| $this->canViewFile(['tickets_id' => $this->fields['tickets_id']])) {
$open = "<a href='".$CFG_GLPI["root_doc"]."/front/document.send.php?docid=".
$this->fields['id'].$params."' alt=\"".$initfileout."\"
title=\"".$initfileout."\"target='_blank'>";
......
......@@ -191,7 +191,7 @@ class NetworkPortInstantiation extends CommonDBChild {
HTMLTableCell $father = null,
array $options = []) {
self::getInstantiationHTMLTable($netport, $row, $father, $options);
$this->getInstantiationHTMLTable($netport, $row, $father, $options);
return null;
}
......
......@@ -587,7 +587,7 @@ class NotificationTarget extends CommonDBChild {
if ($admin_data) {
if (!isset($admin_data['usertype'])) {
$admin_data['usertype'] = self::getDefaultUserType();
$admin_data['usertype'] = $this->getDefaultUserType();
}
$this->addToRecipientsList($admin_data);
}
......@@ -681,7 +681,7 @@ class NotificationTarget extends CommonDBChild {
if ($admins_data) {
foreach ($admins_data as $admin_data) {
if (!isset($admin_data['usertype'])) {
$admin_data['usertype'] = self::getDefaultUserType();
$admin_data['usertype'] = $this->getDefaultUserType();
}
$this->addToRecipientsList($admin_data);
}
......
......@@ -1532,7 +1532,7 @@ class Profile extends CommonDBTM {
echo "<form method='post' action='".$this->getFormURL()."' data-track-changes='true'>";
}
$dropdown_rights = CommonDBTM::getRights();
$dropdown_rights = $this->getRights();
unset($dropdown_rights[DELETE]);
unset($dropdown_rights[UNLOCK]);
......
......@@ -558,7 +558,7 @@ class Reminder extends CommonDBVisible implements
function post_getEmpty() {
$this->fields["name"] = __('New note');
self::trait_post_getEmpty();
$this->trait_post_getEmpty();
}
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment