Commit 7ef7bfc0 authored by loiclau's avatar loiclau Committed by GitHub

Php deprecated (#5995)

* fix(function) replace split

* fix(php) fix mktime is_dst

* fix(php) function __construct

* fix(php) clean magic quotes

* fix(php) clean reference

* fix(php) function __construct

* fix(php) style

* fix(php) constructor

* fix(php) php tags
parent 5f05e8e3
......@@ -71,7 +71,7 @@ class CentreonUser
* CentreonUser constructor.
* @param array $user
*/
public function CentreonUser($user = array())
public function __construct($user = array())
{
global $pearDB;
......
......@@ -41,10 +41,11 @@ class CentreonXML
{
public $buffer;
/*
* Constructor
/**
* CentreonXML constructor.
* @param bool $indent
*/
public function CentreonXML($indent = false)
public function __construct($indent = false)
{
$this->buffer = new XMLWriter();
$this->buffer->openMemory();
......
<?php
/*
* Copyright 2005-2015 Centreon
* Centreon is developped by : Julien Mathis and Romain Le Merlus under
......@@ -43,12 +42,9 @@ class Engine extends AbstractObject
# lock_file, daemon_dumps_core
protected $attributes_select = '
nagios_id,
use_timezone,
cfg_dir,
cfg_file as cfg_filename,
log_file,
status_file,
check_result_path,
......@@ -114,7 +110,6 @@ class Engine extends AbstractObject
debug_verbosity,
max_debug_file_size,
log_pid,
global_host_event_handler as global_host_event_handler_id,
global_service_event_handler as global_service_event_handler_id,
ocsp_command as ocsp_command_id,
......@@ -123,7 +118,6 @@ class Engine extends AbstractObject
service_perfdata_command as service_perfdata_command_id,
host_perfdata_file_processing_command as host_perfdata_file_processing_command_id,
service_perfdata_file_processing_command as service_perfdata_file_processing_command_id,
enable_notifications,
execute_service_checks,
accept_passive_service_checks,
......@@ -143,7 +137,7 @@ class Engine extends AbstractObject
auto_reschedule_checks,
use_aggressive_host_checking,
soft_state_dependencies,
obsess_over_services,
obsess_over_services,
obsess_over_hosts,
process_performance_data,
host_perfdata_file_mode,
......@@ -227,7 +221,6 @@ class Engine extends AbstractObject
'debug_verbosity',
'max_debug_file_size',
'log_pid', // cengine
'global_host_event_handler',
'global_service_event_handler',
'ocsp_command',
......@@ -257,7 +250,7 @@ class Engine extends AbstractObject
'auto_reschedule_checks',
'use_aggressive_host_checking',
'soft_state_dependencies',
'obsess_over_services',
'obsess_over_services',
'obsess_over_hosts',
'process_performance_data',
'host_perfdata_file_mode',
......
......@@ -205,7 +205,7 @@ while ($res = $DBRESULT->fetchRow()) {
if ($tmp != -1) {
if (isset($tmp['h'])) {
$tmp2 = $centreon->CentreonLogAction->getHostId($res['object_id']);
$tabHost = split(',', $tmp2["h"]);
$tabHost = explode(',', $tmp2["h"]);
if (count($tabHost) == 1) {
$host_name = $centreon->CentreonLogAction->getHostName($tmp2["h"]);
} elseif (count($tabHost) > 1) {
......@@ -216,7 +216,7 @@ while ($res = $DBRESULT->fetchRow()) {
}
} elseif (isset($tmp['hg'])) {
$tmp2 = $centreon->CentreonLogAction->getHostId($res['object_id']);
$tabHost = split(',', $tmp2["hg"]);
$tabHost = explode(',', $tmp2["hg"]);
if (count($tabHost) == 1) {
$hg_name = $centreon->CentreonLogAction->getHostGroupName($tmp2["hg"]);
} elseif (count($tabHost) > 1) {
......
......@@ -244,7 +244,7 @@ $form->setDefaults(array("p" => $p, "search" => $search, "num" => $num));
/*
* Init QuickForm
*/
$renderer =& new HTML_QuickForm_Renderer_ArraySmarty($tpl);
$renderer = new HTML_QuickForm_Renderer_ArraySmarty($tpl);
$form->accept($renderer);
isset($_GET["host_name"]) ? $host_name = $_GET["host_name"] : $host_name = null;
......
......@@ -84,8 +84,6 @@ include_once "./include/common/checkPagination.php";
* Smarty template Init
*/
set_magic_quotes_runtime(0);
$tpl = new Smarty();
$tpl = initSmartyTpl($path, $tpl);
......
......@@ -238,12 +238,12 @@ if ($EndDate != "" && $EndTime == "") {
if ($StartDate != "") {
preg_match("/^([0-9]*)\/([0-9]*)\/([0-9]*)/", $StartDate, $matchesD);
preg_match("/^([0-9]*):([0-9]*)/", $StartTime, $matchesT);
$start = mktime($matchesT[1], $matchesT[2], "0", $matchesD[1], $matchesD[2], $matchesD[3], -1);
$start = mktime($matchesT[1], $matchesT[2], "0", $matchesD[1], $matchesD[2], $matchesD[3]);
}
if ($EndDate != "") {
preg_match("/^([0-9]*)\/([0-9]*)\/([0-9]*)/", $EndDate, $matchesD);
preg_match("/^([0-9]*):([0-9]*)/", $EndTime, $matchesT);
$end = mktime($matchesT[1], $matchesT[2], "0", $matchesD[1], $matchesD[2], $matchesD[3], -1);
$end = mktime($matchesT[1], $matchesT[2], "0", $matchesD[1], $matchesD[2], $matchesD[3]);
}
$period = 86400;
......
......@@ -142,7 +142,7 @@ if ($centreon->user->access->checkAction("service_comment")) {
//global services comment
if (!isset($_POST["host_id"])) {
foreach ($_POST["service_id"] as $value) {
$info = split('-', $value);
$info = explode('-', $value);
AddSvcComment(
$info[0],
$info[1],
......
......@@ -383,7 +383,7 @@ if (!$centreon->user->access->checkAction("host_schedule_downtime")
}
foreach ($_POST["service_id"] as $value) {
$info = split('-', $value);
$info = explode('-', $value);
if ($centreon->user->access->admin || in_array($info[0], $host_acl_id)) {
$ecObj->addSvcDowntime(
$info[0],
......
......@@ -130,7 +130,7 @@ class Services_JSON
* bubble up with an error, so all return values
* from encode() should be checked with isError()
*/
public function Services_JSON($use = 0)
public function __construct($use = 0)
{
$this->use = $use;
}
......@@ -800,7 +800,7 @@ if (class_exists('PEAR_Error')) {
class Services_JSON_Error extends PEAR_Error
{
public function Services_JSON_Error(
public function __construct(
$message = 'unknown error',
$code = null,
$mode = null,
......@@ -817,7 +817,7 @@ if (class_exists('PEAR_Error')) {
*/
class Services_JSON_Error
{
public function Services_JSON_Error(
public function __construct(
$message = 'unknown error',
$code = null,
$mode = null,
......
Markdown is supported
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