Private GIT

Skip to content
Snippets Groups Projects
Commit 921f00d7 authored by Matthieu Kermagoret's avatar Matthieu Kermagoret
Browse files

Fix style of procedures.class.php.

parent d4b44e6f
No related branches found
No related tags found
No related merge requests found
......@@ -143,7 +143,7 @@ class procedures
* @param CentreonDB $pearDB
* @return int
*/
function getMyHostID($host_name = null)
public function getMyHostID($host_name = null)
{
$DBRESULT = $this->centreon_DB->query("SELECT host_id FROM host WHERE host_name = '".$host_name."' LIMIT 1");
$row = $DBRESULT->fetchRow();
......@@ -159,7 +159,7 @@ class procedures
* @param string $service_description
* @return int
*/
function getMyServicesID($host_id, $service_description)
public function getMyServicesID($host_id, $service_description)
{
/*
* Get Services attached to hosts
......@@ -279,7 +279,8 @@ class procedures
} else {
$this->hostTplList[$data["host_name"]] = $data["host_id"];
}
$this->hostIconeList["Host:".$data["host_name"]] = "./img/media/" . $this->getImageFilePath($data["ehi_icon_image"]);
$this->hostIconeList["Host:" . $data["host_name"]] =
"./img/media/" . $this->getImageFilePath($data["ehi_icon_image"]);
}
$DBRESULT->free();
unset($data);
......@@ -320,8 +321,7 @@ class procedures
$DBRESULT = $this->centreon_DB->query("SELECT service_description, service_id, service_register
FROM service WHERE service_register = '0'
ORDER BY service_description");
while ($data = $DBRESULT->fetchRow())
{
while ($data = $DBRESULT->fetchRow()) {
$this->serviceTplList["Service:".$data["service_description"]] = $data["service_id"];
}
$DBRESULT->free();
......@@ -350,21 +350,31 @@ class procedures
if ($type == 3) {
$template = "S-TPL-".$template;
}
$DBRESULT = $this->DB->query("SELECT * FROM ".$this->db_prefix."page WHERE page_title LIKE '$template'");
$DBRESULT = $this->DB->query(
"SELECT * FROM ".$this->db_prefix."page WHERE page_title LIKE '$template'"
);
$data = $DBRESULT->fetchRow();
$DBRESULT->free();
if ($debug) {
print "SELECT * FROM ".$this->db_prefix."revision WHERE rev_page LIKE '".$data['page_id']."' ORDER BY rev_text_id DESC LIMIT 1";
print "SELECT * FROM " . $this->db_prefix . "revision WHERE rev_page LIKE '" .
$data['page_id'] . "' ORDER BY rev_text_id DESC LIMIT 1";
}
$DBRESULT = $this->DB->query("SELECT * FROM ".$this->db_prefix."revision WHERE ".$this->db_prefix."rev_page LIKE '".$data['page_id']."' ORDER BY rev_text_id DESC LIMIT 1");
$DBRESULT = $this->DB->query(
"SELECT * FROM " . $this->db_prefix . "revision WHERE " . $this->db_prefix .
"rev_page LIKE '" . $data['page_id'] . "' ORDER BY rev_text_id DESC LIMIT 1"
);
$revision = $DBRESULT->fetchRow();
$DBRESULT->free();
if ($debug) {
print "SELECT * FROM ".$this->db_prefix."text WHERE old_id = '".$data['page_id']."' ORDER BY old_id DESC LIMIT 1";
print "SELECT * FROM " . $this->db_prefix . "text WHERE old_id = '" .
$data['page_id'] . "' ORDER BY old_id DESC LIMIT 1";
}
$DBRESULT = $this->DB->query("SELECT * FROM ".$this->db_prefix."text WHERE old_id = '".$data['page_id']."' ORDER BY old_id DESC LIMIT 1");
$DBRESULT = $this->DB->query(
"SELECT * FROM " . $this->db_prefix . "text WHERE old_id = '" .
$data['page_id'] . "' ORDER BY old_id DESC LIMIT 1"
);
$text = $DBRESULT->fetchRow();
$DBRESULT->free();
......@@ -382,23 +392,46 @@ class procedures
}
if ($debug) {
print ("INSERT INTO ".$this->db_prefix."page (`page_namespace` ,`page_title`,`page_counter` ,`page_is_redirect`,`page_is_new`,`page_random` ,`page_touched`,`page_latest`,`page_len`) " .
" VALUES ('0', '".$object."', '', '0', '1', '', '".$data["page_touched"]."', '".$data["page_latest"]."', '".$data["page_len"]."')");
print(
"INSERT INTO " . $this->db_prefix . "page (`page_namespace` ,`page_title`,`page_counter`, " .
" `page_is_redirect`,`page_is_new`,`page_random` ,`page_touched`,`page_latest`,`page_len`) " .
" VALUES ('0', '" . $object . "', '', '0', '1', '', '" . $data["page_touched"] . "', '" .
$data["page_latest"] . "', '" . $data["page_len"] . "')"
);
}
$dateTouch = date("YmdHis");
$this->DB->query("INSERT INTO ".$this->db_prefix."page (`page_namespace` ,`page_title`,`page_counter` ,`page_is_redirect`,`page_is_new`,`page_random` ,`page_touched`,`page_latest`,`page_len`) " .
" VALUES ('0', '".$object."', '0', '0', '1', '".$data["page_random"]."', '".$dateTouch."', '".$data["page_latest"]."', '".$data["page_len"]."')");
$this->DB->query(
"INSERT INTO " . $this->db_prefix . "page (`page_namespace` ,`page_title`,`page_counter`, " .
" `page_is_redirect`,`page_is_new`,`page_random` ,`page_touched`,`page_latest`,`page_len`) " .
" VALUES ('0', '" . $object . "', '0', '0', '1', '" . $data["page_random"] . "', '" .
$dateTouch . "', '" . $data["page_latest"] . "', '" . $data["page_len"]."')"
);
$DBRESULT = $this->DB->query("SELECT MAX(page_id) FROM ".$this->db_prefix."page");
$id = $DBRESULT->fetchRow();
if ($debug) {
print("INSERT INTO `".$this->db_prefix."text` (old_id, old_text, old_flags) VALUE (NULL, '".$text["old_text"]."', '".$text["old_flags"]."')");
print("INSERT INTO `".$this->db_prefix."revision` (rev_page, rev_text_id, rev_comment, rev_user_text, rev_timestamp) VALUE ('".$id["MAX(page_id)"]."', (SELECT MAX(old_id) FROM text), '".$revision["rev_comment"]."', 'Centreon','".$dateTouch."')");
print(
"INSERT INTO `" . $this->db_prefix . "text` (old_id, old_text, old_flags) " .
" VALUE (NULL, '" . $text["old_text"] . "', '" . $text["old_flags"] . "')"
);
print(
"INSERT INTO `" . $this->db_prefix . "revision` (rev_page, rev_text_id, rev_comment, " .
" rev_user_text, rev_timestamp) VALUE ('" . $id["MAX(page_id)"] .
"', (SELECT MAX(old_id) FROM text), '" . $revision["rev_comment"] . "', 'Centreon','" .
$dateTouch . "')"
);
}
$this->DB->query("INSERT INTO `text` (old_id, old_text, old_flags) VALUE (NULL, '".$text["old_text"]."', '".$text["old_flags"]."')");
$this->DB->query("INSERT INTO `revision` (rev_page, rev_text_id, rev_comment, rev_user_text, rev_timestamp, rev_len) VALUE ('".$id["MAX(page_id)"]."', (SELECT MAX(old_id) FROM text), '".$revision["rev_comment"]."', '".$revision["rev_user_text"]."','".$dateTouch."','".$revision["rev_len"]."')");
$this->DB->query(
"INSERT INTO `text` (old_id, old_text, old_flags) VALUE (NULL, '" .
$text["old_text"] . "', '" . $text["old_flags"] . "')"
);
$this->DB->query(
"INSERT INTO `revision` (rev_page, rev_text_id, rev_comment, rev_user_text, rev_timestamp, " .
" rev_len) VALUE ('" . $id["MAX(page_id)"] . "', (SELECT MAX(old_id) FROM text), '" .
$revision["rev_comment"] . "', '" . $revision["rev_user_text"] . "','" . $dateTouch .
"','" . $revision["rev_len"] . "')"
);
} else {
;
}
......@@ -505,5 +538,3 @@ class procedures
return false;
}
}
?>
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment