diff --git a/www/include/common/quickSearch.ihtml b/www/include/common/quickSearch.ihtml deleted file mode 100644 index 0cc7ef9b9ed9e5189109daadfc23749d26c5c172..0000000000000000000000000000000000000000 --- a/www/include/common/quickSearch.ihtml +++ /dev/null @@ -1,15 +0,0 @@ -<div id="QuickSearch"> - <form action='?p={$p}' {$form_search_attributes} name='search' id='formsearch'> - <span class="quick_search2"> - {$form_search.search.label} {$form_search.search.html} {if $FlagSearchService}{$form_search.search_service.html}{/if}{$form_search.submit.html} <img src="./img/icones/16x16/brush2.png" title="{$cleanSearch}" onClick="javascript:document.getElementById('input_search').value='';document.getElementById('input_service').value='';document.search.input_search.focus();"> - </span> - {if $displayHSOptions == 1} - <span class="quick_search2"> - {$form_search.search_type_host.html} {$form_search.search_type_host.label} - {$form_search.search_type_service.html} {$form_search.search_type_service.label} - </span> - {/if} - {$form_search.hidden} - <input type='submit' style='position: absolute; left: -9999px;'> - </form> -</div> \ No newline at end of file diff --git a/www/include/common/quickSearch.php b/www/include/common/quickSearch.php deleted file mode 100644 index 62b5ae92a1af520e32c63ff1ec1fd5a593dabf04..0000000000000000000000000000000000000000 --- a/www/include/common/quickSearch.php +++ /dev/null @@ -1,151 +0,0 @@ -<?php -/* - * Copyright 2005-2015 Centreon - * Centreon is developped by : Julien Mathis and Romain Le Merlus under - * GPL Licence 2.0. - * - * This program is free software; you can redistribute it and/or modify it under - * the terms of the GNU General Public License as published by the Free Software - * Foundation ; either version 2 of the License. - * - * This program is distributed in the hope that it will be useful, but WITHOUT ANY - * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A - * PARTICULAR PURPOSE. See the GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along with - * this program; if not, see <http://www.gnu.org/licenses>. - * - * Linking this program statically or dynamically with other modules is making a - * combined work based on this program. Thus, the terms and conditions of the GNU - * General Public License cover the whole combination. - * - * As a special exception, the copyright holders of this program give Centreon - * permission to link this program with independent modules to produce an executable, - * regardless of the license terms of these independent modules, and to copy and - * distribute the resulting executable under terms of Centreon choice, provided that - * Centreon also meet, for each linked independent module, the terms and conditions - * of the license of that module. An independent module is a module which is not - * derived from this program. If you modify this program, you may extend this - * exception to your version of the program, but you are not obliged to do so. If you - * do not wish to do so, delete this exception statement from your version. - * - * For more information : contact@centreon.com - * - */ - -global $search; - -if (!isset($oreon)) { - exit(); -} - -/* - * Init Flag - */ -$displayHSOptions = 0; - -$form_search = new HTML_QuickForm('quickSearchForm', 'POST', "?p=".$p."&o=".$o); -if (isset($_POST["search"])) { - $search = $_POST["search"]; -} elseif (isset($_GET["search"])) { - $search = $_GET["search"]; -} elseif (isset($oreon->historySearch[$url])) { - $search = $oreon->historySearch[$url]; -} else { - $search = null; -} - -$searchRaw = $search; -$search = mysql_real_escape_string($search); - -if (!isset($search_service)) { - $search_service = ""; - $search_serviceRaw = ""; -} else { - $search_serviceRaw = $search_service; - $search_service = mysql_real_escape_string($search_service); -} - -if (isset($search) && $search) { - if ($p == "4" || $p == "402" || $p == "203") { - $attrsText = array("size"=>"15", "id"=>"input_search", "class"=>"search_input_active_host", "style" => "padding-top:1px;padding-bottom:1px;"); - } else { - $attrsText = array("size"=>"15", "id"=>"input_search", "class"=>"search_input_active", "style" => "padding-top:1px;padding-bottom:1px;"); - } -} else { - if ($p == "4" || $p == "402" || $p == "203") { - $attrsText = array("size"=>"15", "id"=>"input_search", "class"=>"search_input_host", "style" => "padding-top:1px;padding-bottom:1px;"); - } else { - $attrsText = array("size"=>"15", "id"=>"input_search", "class"=>"search_input", "style" => "padding-top:1px;padding-bottom:1px;"); - } -} - -if (isset($search_service) && $search_service) { - $attrsText2 = array("size"=>"15", "id"=>"input_service", "class"=>"search_input_active_service", "style" => "padding-top:1px;padding-bottom:1px;", "title" => _("Service Description Search Key")); -} else { - $attrsText2 = array("size"=>"15", "id"=>"input_service", "class"=>"search_input_service", "style" => "padding-top:1px;padding-bottom:1px;", "title" => _("Service Description Search Key")); -} -$attrsText["title"] = _("Search"); -$attrsSubmit = array("style"=>"display:none;"); - -if (!isset($limit)) { - $limit = 20; -} - -$tab = array ("search" => $searchRaw, - "search_service" => $search_serviceRaw, - "p" => $p, - "o" => $o, - "limit" => $limit, - "search_type_host" => 1, - "search_type_service" => 1); - -$form_search->addElement('text', 'search', _("Quick Search"), $attrsText); -if (isset($FlagSearchService) && $FlagSearchService) { - $form_search->addElement('text', 'search_service', _("Quick Search"), $attrsText2); -} -$form_search->addElement('submit', 'submit', _("Go"), $attrsSubmit); -$form_search->addElement('hidden', 'p'); -$form_search->addElement('hidden', 'limit'); -$form_search->addElement('hidden', 'list'); - -/* - * Add specific options for search in commands - */ -if ($p == '608' || $p == '60801' || $p == '60802' || $p == '60803' || $p == '60106') { - $form_search->addElement('hidden', 'type'); - $tab['type'] = 2; - if (isset($type)) { - $tab['type'] = $type; - } -} - -$tabQuickSearch = array(602 => 1, 60201 => 1, 2020201 => 1, 2020202 => 1, 2020203 => 1, 202 => 1, - 2 => 1, 2020101 => 1, 20203 => 1, 2020301 => 1, 2020302 => 1, 2020303 => 1, 20208 => 1, - 2020801 => 1, 2020802 => 1, 2020803 => 1, 20211 => 1, - 2021101 => 1, 2021102 => 1, 2021103 => 1); - - -if (isset($tabQuickSearch[$p])) { - $form_search->addElement('advcheckbox', 'search_type_host', _("host"), '', 'class=mini_checkbox'); - $form_search->addElement('advcheckbox', 'search_type_service', _("service"), '', 'class=mini_checkbox'); - $displayHSOptions = 1; -} -$form_search->setDefaults($tab); - -/* - * Render with a smarty template - */ -$tpl = new Smarty(); -$tpl = initSmartyTpl("./include/common/", $tpl); - -$renderer = new HTML_QuickForm_Renderer_ArraySmarty($tpl); -$form_search->accept($renderer); -$tpl->assign('form_search', $renderer->toArray()); -$tpl->assign('p', $p); -$tpl->assign("displayHSOptions", $displayHSOptions); -$tpl->assign("cleanSearch", _("Reset filters")); -if (isset($FlagSearchService) && $FlagSearchService) { - $tpl->assign("FlagSearchService", $FlagSearchService); -} -$tpl->display("quickSearch.ihtml"); diff --git a/www/include/options/accessLists/define/DB-Func.php b/www/include/options/accessLists/define/DB-Func.php deleted file mode 100644 index fe0237550a5622b71ac07703f59b81a06e9d9388..0000000000000000000000000000000000000000 --- a/www/include/options/accessLists/define/DB-Func.php +++ /dev/null @@ -1,354 +0,0 @@ -<?php -/* - * Copyright 2005-2015 Centreon - * Centreon is developped by : Julien Mathis and Romain Le Merlus under - * GPL Licence 2.0. - * - * This program is free software; you can redistribute it and/or modify it under - * the terms of the GNU General Public License as published by the Free Software - * Foundation ; either version 2 of the License. - * - * This program is distributed in the hope that it will be useful, but WITHOUT ANY - * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A - * PARTICULAR PURPOSE. See the GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along with - * this program; if not, see <http://www.gnu.org/licenses>. - * - * Linking this program statically or dynamically with other modules is making a - * combined work based on this program. Thus, the terms and conditions of the GNU - * General Public License cover the whole combination. - * - * As a special exception, the copyright holders of this program give Centreon - * permission to link this program with independent modules to produce an executable, - * regardless of the license terms of these independent modules, and to copy and - * distribute the resulting executable under terms of Centreon choice, provided that - * Centreon also meet, for each linked independent module, the terms and conditions - * of the license of that module. An independent module is a module which is not - * derived from this program. If you modify this program, you may extend this - * exception to your version of the program, but you are not obliged to do so. If you - * do not wish to do so, delete this exception statement from your version. - * - * For more information : contact@centreon.com - * - * SVN : $URL$ - * SVN : $Id$ - * - */ - -function testExistence($name = null) -{ - global $pearDB, $form; - $id = null; - if (isset($form)) { - $id = $form->getSubmitValue('lca_id'); - } - $DBRESULT = $pearDB->query("SELECT lca_name, lca_id FROM lca_define WHERE lca_name = '".$name."'"); - $lca = $DBRESULT->fetchRow(); - #Modif case - if ($DBRESULT->numRows() >= 1 && $lca["lca_id"] == $id) { - return true; - } elseif ($DBRESULT->numRows() >= 1 && $lca["lca_id"] != $id) { #Duplicate entry - return false; - } else { - return true; - } -} - -function enableLCAInDB($lca_id = null) -{ - if (!$lca_id) { - return; - } - global $pearDB; - $DBRESULT = $pearDB->query("UPDATE lca_define SET lca_activate = '1' WHERE lca_id = '".$lca_id."'"); -} - -function disableLCAInDB($lca_id = null) -{ - if (!$lca_id) { - return; - } - global $pearDB; - $DBRESULT = $pearDB->query("UPDATE lca_define SET lca_activate = '0' WHERE lca_id = '".$lca_id."'"); -} - -function deleteLCAInDB($lcas = array()) -{ - global $pearDB; - foreach ($lcas as $key => $value) { - $DBRESULT = $pearDB->query("DELETE FROM lca_define WHERE lca_id = '".$key."'"); - } -} - -function multipleLCAInDB($lcas = array(), $nbrDup = array()) -{ - foreach ($lcas as $key => $value) { - global $pearDB; - $DBRESULT = $pearDB->query("SELECT * FROM lca_define WHERE lca_id = '".$key."' LIMIT 1"); - $row = $DBRESULT->fetchRow(); - $row["lca_id"] = ''; - for ($i = 1; $i <= $nbrDup[$key]; $i++) { - $val = null; - foreach ($row as $key2 => $value2) { - $key2 == "lca_name" ? ($lca_name = $value2 = $value2."_".$i) : null; - - if ($val) { - $val .= ($value2!=null?(", '".$value2."'"):", NULL"); - } else { - $val .= ($value2!=null?("'".$value2."'"):"NULL"); - } - } - if (testExistence($lca_name)) { - $val ? $rq = "INSERT INTO lca_define VALUES (".$val.")" : $rq = null; - $pearDB->query($rq); - $DBRESULT = $pearDB->query("SELECT MAX(lca_id) FROM lca_define"); - $maxId = $DBRESULT->fetchRow(); - if (isset($maxId["MAX(lca_id)"])) { - $DBRESULT = $pearDB->query( - "SELECT DISTINCT contactgroup_cg_id FROM lca_define_contactgroup_relation " - . "WHERE lca_define_lca_id = '".$key."'" - ); - while ($cg = $DBRESULT->fetchRow()) { - $DBRESULT2 = $pearDB->query( - "INSERT INTO lca_define_contactgroup_relation " - . "VALUES ('', '".$maxId["MAX(lca_id)"]."', '".$cg["contactgroup_cg_id"]."')" - ); - } - $DBRESULT = $pearDB->query( - "SELECT DISTINCT host_host_id " - . "FROM lca_define_host_relation WHERE lca_define_lca_id = '".$key."'" - ); - while ($host = $DBRESULT->fetchRow()) { - $DBRESULT2 = $pearDB->query( - "INSERT INTO lca_define_host_relation VALUES ('', '" - . $maxId["MAX(lca_id)"]."', '".$host["host_host_id"]."')" - ); - } - $DBRESULT = $pearDB->query( - "SELECT DISTINCT hostgroup_hg_id " - . "FROM lca_define_hostgroup_relation WHERE lca_define_lca_id = '".$key."'" - ); - while ($hg = $DBRESULT->fetchRow()) { - $DBRESULT2 = $pearDB->query( - "INSERT INTO lca_define_hostgroup_relation VALUES ('', '" - . $maxId["MAX(lca_id)"]."', '".$hg["hostgroup_hg_id"]."')" - ); - } - $DBRESULT = $pearDB->query( - "SELECT DISTINCT servicegroup_sg_id " - . "FROM lca_define_servicegroup_relation WHERE lca_define_lca_id = '".$key."'" - ); - while ($sg = $DBRESULT->fetchRow()) { - $DBRESULT2 = $pearDB->query( - "INSERT INTO lca_define_servicegroup_relation VALUES ('', '" - . $maxId["MAX(lca_id)"]."', '".$sg["servicegroup_sg_id"]."')" - ); - } - $DBRESULT = $pearDB->query( - "SELECT DISTINCT topology_topology_id FROM " - . "lca_define_topology_relation WHERE lca_define_lca_id = '".$key."'" - ); - while ($sg = $DBRESULT->fetchRow()) { - $DBRESULT2 = $pearDB->query( - "INSERT INTO lca_define_topology_relation VALUES ('', '" - . $maxId["MAX(lca_id)"]."', '".$sg["topology_topology_id"]."')" - ); - } - } - } - } - } -} - -function updateLCAInDB($lca_id = null) -{ - if (!$lca_id) { - return; - } - updateLCA($lca_id); - updateLCAContactGroups($lca_id); - updateLCAHosts($lca_id); - updateLCAHostGroups($lca_id); - updateLCAServiceGroups($lca_id); - updateLCATopology($lca_id); -} - -function insertLCAInDB() -{ - $lca_id = insertLCA(); - updateLCAContactGroups($lca_id); - updateLCAHosts($lca_id); - updateLCAHostGroups($lca_id); - updateLCAServiceGroups($lca_id); - updateLCATopology($lca_id); - return ($lca_id); -} - -function insertLCA() -{ - global $form; - global $pearDB; - $ret = array(); - $ret = $form->getSubmitValues(); - $rq = "INSERT INTO lca_define "; - $rq .= "(lca_name, lca_alias, lca_comment, lca_hg_childs, lca_activate) "; - $rq .= "VALUES "; - $rq .= "('".htmlentities($ret["lca_name"], ENT_QUOTES, "UTF-8")."', '" - . htmlentities($ret["lca_alias"], ENT_QUOTES, "UTF-8")."', '" - . htmlentities($ret["lca_comment"], ENT_QUOTES, "UTF-8") - . "', '".$ret["lca_hg_childs"]["lca_hg_childs"]."', '".$ret["lca_activate"]["lca_activate"]."')"; - $DBRESULT = $pearDB->query($rq); - $DBRESULT = $pearDB->query("SELECT MAX(lca_id) FROM lca_define"); - $lca_id = $DBRESULT->fetchRow(); - return ($lca_id["MAX(lca_id)"]); -} - -function updateLCA($lca_id = null) -{ - if (!$lca_id) { - return; - } - global $form; - global $pearDB; - $ret = array(); - $ret = $form->getSubmitValues(); - $rq = "UPDATE lca_define "; - $rq .= "SET lca_name = '".htmlentities($ret["lca_name"], ENT_QUOTES, "UTF-8")."', " . - "lca_alias = '".htmlentities($ret["lca_alias"], ENT_QUOTES, "UTF-8")."', " . - "lca_comment = '".htmlentities($ret["lca_comment"], ENT_QUOTES, "UTF-8")."', " . - "lca_hg_childs = '".$ret["lca_hg_childs"]["lca_hg_childs"]."', " . - "lca_activate = '".$ret["lca_activate"]["lca_activate"]."' " . - "WHERE lca_id = '".$lca_id."'"; - $DBRESULT = $pearDB->query($rq); -} - -function updateLCAContactGroups($lca_id = null) -{ - if (!$lca_id) { - return; - } - global $form; - global $pearDB; - global $oreon; - $lcas = array(); - $rq = "DELETE FROM lca_define_contactgroup_relation "; - $rq .= "WHERE lca_define_lca_id = '".$lca_id."'"; - $DBRESULT = $pearDB->query($rq); - $ret = array(); - $ret = $form->getSubmitValue("lca_cgs"); - for ($i = 0; $i < count($ret); $i++) { - $rq = "INSERT INTO lca_define_contactgroup_relation "; - $rq .= "(lca_define_lca_id, contactgroup_cg_id) "; - $rq .= "VALUES "; - $rq .= "('".$lca_id."', '".$ret[$i]."')"; - $DBRESULT = $pearDB->query($rq); - } -} - -function updateLCAHosts($lca_id = null) -{ - if (!$lca_id) { - return; - } - global $form, $pearDB; - $rq = "DELETE FROM lca_define_host_relation "; - $rq .= "WHERE lca_define_lca_id = '".$lca_id."'"; - $DBRESULT = $pearDB->query($rq); - $ret = array(); - $ret = $form->getSubmitValue("lca_hosts"); - for ($i = 0; $i < count($ret); $i++) { - $rq = "INSERT INTO lca_define_host_relation "; - $rq .= "(lca_define_lca_id, host_host_id) "; - $rq .= "VALUES "; - $rq .= "('".$lca_id."', '".$ret[$i]."')"; - $DBRESULT = $pearDB->query($rq); - } -} - -function updateLCAHostGroups($lca_id = null) -{ - if (!$lca_id) { - return; - } - global $form, $pearDB; - $rq = "DELETE FROM lca_define_hostgroup_relation "; - $rq .= "WHERE lca_define_lca_id = '".$lca_id."'"; - $DBRESULT = $pearDB->query($rq); - $ret = array(); - $ret = $form->getSubmitValue("lca_hgs"); - for ($i = 0; $i < count($ret); $i++) { - $rq = "INSERT INTO lca_define_hostgroup_relation "; - $rq .= "(lca_define_lca_id, hostgroup_hg_id) "; - $rq .= "VALUES "; - $rq .= "('".$lca_id."', '".$ret[$i]."')"; - $DBRESULT = $pearDB->query($rq); - } -} - -function updateLCAServiceGroups($lca_id = null) -{ - if (!$lca_id) { - return; - } - global $form, $pearDB; - $rq = "DELETE FROM lca_define_servicegroup_relation "; - $rq .= "WHERE lca_define_lca_id = '".$lca_id."'"; - $DBRESULT = $pearDB->query($rq); - $ret = array(); - $ret = $form->getSubmitValue("lca_sgs"); - for ($i = 0; $i < count($ret); $i++) { - $rq = "INSERT INTO lca_define_servicegroup_relation "; - $rq .= "(lca_define_lca_id, servicegroup_sg_id) "; - $rq .= "VALUES "; - $rq .= "('".$lca_id."', '".$ret[$i]."')"; - $DBRESULT = $pearDB->query($rq); - } -} - -function updateLCATopology($lca_id = null) -{ - if (!$lca_id) { - return; - } - global $form, $pearDB; - $rq = "DELETE FROM lca_define_topology_relation "; - $rq .= "WHERE lca_define_lca_id = '".$lca_id."'"; - $DBRESULT = $pearDB->query($rq); - $ret = array(); - $ret = $form->getSubmitValue("lca_topos"); - - if (is_array($ret)) { - $ret = array_keys($ret); - } - for ($i = 0; $i < count($ret); $i++) { - if (isset($ret[$i])) { - $rq = "INSERT INTO lca_define_topology_relation "; - $rq .= "(lca_define_lca_id, topology_topology_id) "; - $rq .= "VALUES "; - $rq .= "('".$lca_id."', '".$ret[$i]."')"; - $DBRESULT = $pearDB->query($rq); - } - } -} - -function updateLCATopologyChilds($topology_id = null, $lca_id = null) -{ - if (!$topology_id || !$lca_id) { - return; - } - global $pearDB; - $DBRESULT = $pearDB->query("SELECT DISTINCT topology_page FROM topology WHERE topology_id = '".$topology_id."'"); - $level1 = $DBRESULT->fetchRow(); - $DBRESULT2 = $pearDB->query( - "SELECT topology_id, topology_page FROM topology WHERE topology_parent = '".$level1["topology_page"]."'" - ); - while ($level2 = $DBRESULT2->fetchRow()) { - $rq = "INSERT INTO lca_define_topology_relation "; - $rq .= "(lca_define_lca_id, topology_topology_id) "; - $rq .= "VALUES "; - $rq .= "('".$lca_id."', '".$level2["topology_id"]."')"; - $DBRESULT = $pearDB->query($rq); - updateLCATopologyChilds($level2["topology_id"], $lca_id); - } -} diff --git a/www/include/options/accessLists/define/formLCA.ihtml b/www/include/options/accessLists/define/formLCA.ihtml deleted file mode 100644 index 526d8125cb6a4e500e885e6c73bf48ee5e90ea3e..0000000000000000000000000000000000000000 --- a/www/include/options/accessLists/define/formLCA.ihtml +++ /dev/null @@ -1,113 +0,0 @@ -<script type="text/javascript" src="./include/common/javascript/tool.js"></script> -{$form.javascript} -<form {$form.attributes}> -<div> -<ul id="mainnav"> - <li class="a" id='c1'><a href="#" onclick="javascript:montre('1');">{$sort1}</a></li> - <li class="b" id='c2'><a href="#" onclick="javascript:montre('2');">{$sort2}</a></li> - <li class="b" id='c3'><a href="#" onclick="javascript:montre('3');">{$sort3}</a></li> -</ul> -</div> -<div id="validFormTop"> -{if $o == "a" || $o == "c"} - <p class="oreonbutton">{$form.submitC.html}{$form.submitA.html} {$form.reset.html}</p> -{else if $o == "w"} - <p class="oreonbutton">{$form.change.html}</p> -{/if} -</div> -<div id='tab1' class="tab"> - <table class="ListTable"> - <tr class="ListHeader"><td class="FormHeader" colspan="2"><img src='./img/icones/16x16/application_lock.gif'> {$form.header.title}</td></tr> - - <tr class="list_lvl_1"><td class="ListColLvl1_name" colspan="2"><img src='./img/icones/16x16/house.gif'> {$form.header.information}</td></tr> - - <tr class="list_one"><td class="FormRowField">{$form.lca_name.label}</td><td class="FormRowValue">{$form.lca_name.html}</td></tr> - <tr class="list_two"><td class="FormRowField">{$form.lca_alias.label}</td><td class="FormRowValue">{$form.lca_alias.html}</td></tr> - <tr class="list_one"><td class="FormRowField">{$form.lca_activate.label}</td><td class="FormRowValue">{$form.lca_activate.html}</td></tr> - <tr class="list_lvl_1"><td class="ListColLvl1_name" colspan="2"><img src='./img/icones/16x16/users_family.gif'> {$form.header.cg}</td></tr> - <tr class="list_one"><td class="FormRowField">{$form.lca_cgs.label}</td><td class="FormRowValue">{$form.lca_cgs.html}</td></tr> - - <tr class="list_lvl_1"><td class="ListColLvl1_name" colspan="2"><img src='./img/icones/16x16/cookies.gif'> {$form.header.furtherInfos}</td></tr> - <tr class="list_one"><td class="FormRowField">{$form.lca_comment.label}</td><td class="FormRowValue">{$form.lca_comment.html}</td></tr> - - {if $o == "a" || $o == "c"} - <tr class="list_lvl_2"><td class="ListColLvl2_name" colspan="2">{$form.required._note}</td></tr> - {/if} - </table> -</div> -<div id='tab2' class="tab"> - <table class="ListTable"> - <tr class="ListHeader"><td class="FormHeader" colspan="2"><img src='./img/icones/16x16/application_lock.gif'> {$form.header.title}</td></tr> - - <tr class="list_lvl_1"><td class="ListColLvl1_name" colspan="2"><img src='./img/icones/16x16/clients.gif'> {$form.header.rs}</td></tr> - <tr class="list_one"><td class="FormRowField">{$form.lca_hgs.label}</td><td class="FormRowValue">{$form.lca_hgs.html}</td></tr> - <tr class="list_two"><td class="FormRowField">{$form.lca_hg_childs.label}</td><td class="FormRowValue">{$form.lca_hg_childs.html}</td></tr> - <!--<tr class="list_one"><td class="FormRowField">{$form.lca_sgs.label}</td><td class="FormRowValue">{$form.lca_sgs.html}</td></tr>--> - <tr class="list_two"><td class="FormRowField">{$form.lca_hosts.label}</td><td class="FormRowValue">{$form.lca_hosts.html}</td></tr> - </table> -</div> -<div id='tab3' class="tab"> - <table class="ListTable"> - <tr class="ListHeader"><td class="FormHeader" ><img src='./img/icones/16x16/application_lock.gif'> {$form.header.title}</td></tr> - <tr class="list_lvl_1"><td class="ListColLvl1_name" ><img src='./img/icones/16x16/window_application_delete.gif'> {$form.header.pages}</td></tr> - - <tr > - <td> - - <ul class="arbo_a"> - {foreach key=key item=a from=$lca_topos2} - <li> - <img id="img_{$a.c_id}" src="img/icones/16x16/navigate_plus.gif" onclick="toggleDisplay('{$a.c_id}');"> - - <input id="i{$a.c_id}" name="lca_topos[{$a.id}]" type="checkbox" {if $a.checked == "true"}checked="checked"{/if} value="1" onclick="toggleCheckAll(this, 'i{$a.c_id}');" /><label for="{$a.id}">{$a.name}</label> - <ul class="arbo_b" id="{$a.c_id}"> - - {foreach key=key item=b from=$a.childs} - <li> - <img id="img_{$b.c_id}" src="img/icones/16x16/navigate_plus.gif" onclick="toggleDisplay('{$b.c_id}');"> - <input id="i{$b.c_id}" name="lca_topos[{$b.id}]" type="checkbox" {if $b.checked == "true"}checked="checked"{/if} value="1" onclick="toggleCheckAll(this, 'i{$b.c_id}');" /><label for="{$b.id}">{$b.name}</label> - <ul class="arbo_c" id="{$b.c_id}"> - - {foreach key=key item=c from=$b.childs} - <li> - <img id="img_{$c.c_id}" src="img/icones/16x16/navigate_plus.gif" onclick="toggleDisplay('{$c.c_id}');"> - <input id="i{$c.c_id}" name="lca_topos[{$c.id}]" type="checkbox" {if $c.checked == "true"}checked="checked"{/if} value="1" onclick="toggleCheckAll(this, 'i{$c.c_id}');" /><label for="{$c.id}">{$c.name}</label> - - <ul class="arbo_d" id="{$c.c_id}"> - {foreach key=key item=d from=$c.childs} - <li> - <input id="i{$d.c_id}" name="lca_topos[{$d.id}]" type="checkbox" {if $c.checked == "true"}checked="checked"{/if} value="1" /><label for="{$d.id}">{$d.name}</label> - </li> - {/foreach} - </ul> - - </li> - {/foreach} - </ul> - - - </li> - {/foreach} - </ul> - - - - </li> - {/foreach} - </ul> - - </td></tr> - </table> - -</div> -<div id="validForm"> -{if $o == "a" || $o == "c"} - <p>{$form.action.html}</p> - <p>{$form.submitC.html}{$form.submitA.html} {$form.reset.html}</p> -{else if $o == "w"} - <p>{$form.change.html}</p> -{/if} -</div> -{$form.hidden} -</form> - diff --git a/www/include/options/accessLists/define/formLCA.php b/www/include/options/accessLists/define/formLCA.php deleted file mode 100644 index 068b7ae8977f88f5cf2ee8013abc1070d82d3f8e..0000000000000000000000000000000000000000 --- a/www/include/options/accessLists/define/formLCA.php +++ /dev/null @@ -1,501 +0,0 @@ -<?php -/* - * Copyright 2005-2015 Centreon - * Centreon is developped by : Julien Mathis and Romain Le Merlus under - * GPL Licence 2.0. - * - * This program is free software; you can redistribute it and/or modify it under - * the terms of the GNU General Public License as published by the Free Software - * Foundation ; either version 2 of the License. - * - * This program is distributed in the hope that it will be useful, but WITHOUT ANY - * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A - * PARTICULAR PURPOSE. See the GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along with - * this program; if not, see <http://www.gnu.org/licenses>. - * - * Linking this program statically or dynamically with other modules is making a - * combined work based on this program. Thus, the terms and conditions of the GNU - * General Public License cover the whole combination. - * - * As a special exception, the copyright holders of this program give Centreon - * permission to link this program with independent modules to produce an executable, - * regardless of the license terms of these independent modules, and to copy and - * distribute the resulting executable under terms of Centreon choice, provided that - * Centreon also meet, for each linked independent module, the terms and conditions - * of the license of that module. An independent module is a module which is not - * derived from this program. If you modify this program, you may extend this - * exception to your version of the program, but you are not obliged to do so. If you - * do not wish to do so, delete this exception statement from your version. - * - * For more information : contact@centreon.com - * - * SVN : $URL$ - * SVN : $Id$ - * - */ - -if (!isset($oreon)) { - exit(); -} - -# -## Database retrieve information for LCA -# -if ($o == "c" || $o == "w") { - $DBRESULT = $pearDB->query("SELECT * FROM lca_define WHERE lca_id = '".$lca_id."' LIMIT 1"); - # Set base value - $lca = array_map("myDecode", $DBRESULT->fetchRow()); - # Set Service Groups relations - $DBRESULT = $pearDB->query( - "SELECT DISTINCT servicegroup_sg_id " - . "FROM lca_define_servicegroup_relation WHERE lca_define_lca_id = '".$lca_id."'" - ); - for ($i = 0; $sg = $DBRESULT->fetchRow(); $i++) { - $lca["lca_sgs"][$i] = $sg["servicegroup_sg_id"]; - } - $DBRESULT->free(); - # Set Host Groups relations - $DBRESULT = $pearDB->query( - "SELECT DISTINCT hostgroup_hg_id " - . "FROM lca_define_hostgroup_relation WHERE lca_define_lca_id = '".$lca_id."'" - ); - for ($i = 0; $hg = $DBRESULT->fetchRow(); $i++) { - $lca["lca_hgs"][$i] = $hg["hostgroup_hg_id"]; - } - $DBRESULT->free(); - # Set Host relations - $DBRESULT = $pearDB->query( - "SELECT DISTINCT host_host_id " - . "FROM lca_define_host_relation WHERE lca_define_lca_id = '".$lca_id."'" - ); - for ($i = 0; $host = $DBRESULT->fetchRow(); $i++) { - $lca["lca_hosts"][$i] = $host["host_host_id"]; - } - $DBRESULT->free(); - # Set Contact Groups relations - $DBRESULT = $pearDB->query( - "SELECT DISTINCT contactgroup_cg_id " - . "FROM lca_define_contactgroup_relation WHERE lca_define_lca_id = '".$lca_id."'" - ); - for ($i = 0; $cg = $DBRESULT->fetchRow(); $i++) { - $lca["lca_cgs"][$i] = $cg["contactgroup_cg_id"]; - } - $DBRESULT->free(); - # Set Topology relations - $DBRESULT = $pearDB->query( - "SELECT topology_topology_id " - . "FROM lca_define_topology_relation WHERE lca_define_lca_id = '".$lca_id."'" - ); - for ($i = 0; $topo = $DBRESULT->fetchRow(); $i++) { - $lca["lca_topos"][$topo["topology_topology_id"]] = 1; - } - $DBRESULT->free(); -} - -if (!isset($lca["lca_topos"])) { - function one($v) - { - $v->setValue(1); - return $v; - } - $lca["lca_topos"] = array(); -} - -# Init LCA - -$lca_data = getLCAHostByID($pearDB); -$lcaHostStr = getLCAHostStr($lca_data["LcaHost"]); -$lcaHGStr = getLCAHGStr($lca_data["LcaHostGroup"]); -$lca_sg = getLCASG($pearDB); -$lcaSGStr = getLCASGStr($lca_sg); - -# -## Database retrieve information for differents elements list we need on the page -# -# Host Groups comes from DB -> Store in $hgs Array -$hgs = array(); -if ($oreon->user->admin || !HadUserLca($pearDB)) { - $DBRESULT = $pearDB->query("SELECT hg_id, hg_name FROM hostgroup ORDER BY hg_name"); -} else { - $DBRESULT = $pearDB->query( - "SELECT hg_id, hg_name FROM hostgroup WHERE hg_id IN (".$lcaHGStr.") ORDER BY hg_name" - ); -} -while ($hg = $DBRESULT->fetchRow()) { - $hgs[$hg["hg_id"]] = $hg["hg_name"]; -} -$DBRESULT->free(); -# -# Service Groups comes from DB -> Store in $sgs Array -$sgs = array(); -if ($oreon->user->admin || !HadUserLca($pearDB)) { - $DBRESULT = $pearDB->query("SELECT sg_id, sg_name FROM servicegroup ORDER BY sg_name"); -} else { - $DBRESULT = $pearDB->query( - "SELECT sg_id, sg_name FROM servicegroup WHERE sg_id IN (".$lcaSGStr.") ORDER BY sg_name" - ); -} -while ($sg = $DBRESULT->fetchRow()) { - $sgs[$sg["sg_id"]] = $sg["sg_name"]; -} -$DBRESULT->free(); -# -# Host comes from DB -> Store in $hosts Array -$hosts = array(); -if ($oreon->user->admin || !HadUserLca($pearDB)) { - $DBRESULT = $pearDB->query("SELECT host_id, host_name FROM host WHERE host_register = '1' ORDER BY host_name"); -} else { - $DBRESULT = $pearDB->query( - "SELECT host_id, host_name " - . "FROM host WHERE host_register = '1' AND host_id IN (".$lcaHostStr.") ORDER BY host_name" - ); -} -while ($host = $DBRESULT->fetchRow()) { - $hosts[$host["host_id"]] = $host["host_name"]; -} -$DBRESULT->free(); -# -# Contact Groups comes from DB -> Store in $cgs Array -$cgs = array(); -$DBRESULT = $pearDB->query("SELECT cg_id, cg_name FROM contactgroup ORDER BY cg_name"); -while ($cg = $DBRESULT->fetchRow()) { - $cgs[$cg["cg_id"]] = $cg["cg_name"]; -} -$DBRESULT->free(); -# -# End of "database-retrieved" information -########################################################## -########################################################## -# Var information to format the element -# -$attrsText = array("size"=>"30"); -$attrsAdvSelect = array("style" => "width: 200px; height: 100px;"); -$attrsTextarea = array("rows"=>"3", "cols"=>"30"); -$eTemplate = '<table>' - . '<tr>' - . '<td><div class="ams">{label_2}</div>{unselected}</td><td align="center">{add}<br /><br /><br />{remove}</td>' - . '<td><div class="ams">{label_3}</div>{selected}</td>' - . '</tr>' - . '</table>'; - -# -## Form begin -# -$form = new HTML_QuickForm('Form', 'post', "?p=".$p); -if ($o == "a") { - $form->addElement('header', 'title', _("Add an ACL")); -} elseif ($o == "c") { - $form->addElement('header', 'title', _("Modify an ACL")); -} elseif ($o == "w") { - $form->addElement('header', 'title', _("View an ACL")); -} - -# -## LCA basic information -# -$form->addElement('header', 'information', _("General Information")); -$form->addElement('text', 'lca_name', _("ACL Definition"), $attrsText); -$form->addElement('text', 'lca_alias', _("Alias"), $attrsText); -/* $tab = array(); -$tab[] = HTML_QuickForm::createElement('radio', 'lca_type', null, _("Menu"), '1'); -$tab[] = HTML_QuickForm::createElement('radio', 'lca_type', null, _("Resources"), '2'); -$tab[] = HTML_QuickForm::createElement('radio', 'lca_type', null, _("Both"), '3'); -$form->addGroup($tab, 'lca_type', _("Type"), ' '); -$form->setDefaults(array('lca_type' => '3')); */ -$tab = array(); -$tab[] = HTML_QuickForm::createElement('radio', 'lca_activate', null, _("Enabled"), '1'); -$tab[] = HTML_QuickForm::createElement('radio', 'lca_activate', null, _("Disabled"), '0'); -$form->addGroup($tab, 'lca_activate', _("Status"), ' '); -$form->setDefaults(array('lca_activate' => '1')); - -# -## Contact Group concerned -# -$form->addElement('header', 'cg', _("Implied Contact Groups")); -$ams1 = $form->addElement( - 'advmultiselect', - 'lca_cgs', - array(_("Contact Groups"), _("Available"), _("Selected")), - $cgs, - $attrsAdvSelect, - SORT_ASC -); -$ams1->setButtonAttributes('add', array('value' => _("Add"), "class" => "btc bt_success")); -$ams1->setButtonAttributes('remove', array('value' => _("Remove"), "class" => "btc bt_danger")); -$ams1->setElementTemplate($eTemplate); -echo $ams1->getElementJs(false); - -# -## Further informations -# -$form->addElement('header', 'furtherInfos', _("Additional Information")); -$form->addElement('textarea', 'lca_comment', _("Comments"), $attrsTextarea); - -# -## Resources concerned -# -$form->addElement('header', 'rs', _("Implied Resources")); - -$ams1 = $form->addElement( - 'advmultiselect', - 'lca_hgs', - array(_("Host Groups"), _("Available"), _("Selected")), - $hgs, - $attrsAdvSelect, - SORT_ASC -); -$ams1->setButtonAttributes('add', array('value' => _("Add"), "class" => "btc bt_success")); -$ams1->setButtonAttributes('remove', array('value' => _("Remove"), "class" => "btc bt_danger")); -$ams1->setElementTemplate($eTemplate); -echo $ams1->getElementJs(false); -$tab = array(); -$tab[] = HTML_QuickForm::createElement('radio', 'lca_hg_childs', null, _("Yes"), '1'); -$tab[] = HTML_QuickForm::createElement('radio', 'lca_hg_childs', null, _("No"), '0'); -$form->addGroup($tab, 'lca_hg_childs', _("Include Host Groups -> Hosts"), ' '); -$form->setDefaults(array('lca_hg_childs' => '1')); - -$ams1 = $form->addElement( - 'advmultiselect', - 'lca_hosts', - array(_("Hosts"), _("Available"), _("Selected")), - $hosts, - $attrsAdvSelect, - SORT_ASC -); -$ams1->setButtonAttributes('add', array('value' => _("Add"), "class" => "btc bt_success")); -$ams1->setButtonAttributes('remove', array('value' => _("Remove"), "class" => "btc bt_danger")); -$ams1->setElementTemplate($eTemplate); -echo $ams1->getElementJs(false); - -$ams1 = $form->addElement( - 'advmultiselect', - 'lca_sgs', - array(_("Service Groups"), _("Available"), _("Selected")), - $sgs, - $attrsAdvSelect, - SORT_ASC -); -$ams1->setButtonAttributes('add', array('value' => _("Add"), "class" => "btc bt_success")); -$ams1->setButtonAttributes('remove', array('value' => _("Remove"), "class" => "btc bt_danger")); -$ams1->setElementTemplate($eTemplate); -echo $ams1->getElementJs(false); - -# -## Topology concerned -# -$form->addElement('header', 'pages', _("Implied page")); -$rq = "SELECT topology_id, topology_page, topology_name, topology_parent " - . "FROM topology " - . "WHERE topology_parent IS NULL AND topology_page IN (".$oreon->user->lcaTStr.") ORDER BY topology_order"; -$DBRESULT1 = $pearDB->query($rq); -# -$lca_topos = array(); - -$lca_topos2 = array(); -$a = 0; -while ($topo1 = $DBRESULT1->fetchRow()) { - $lca_topos2[$a] = array(); - $lca_topos2[$a]["name"] = _($topo1["topology_name"]); - $lca_topos2[$a]["id"] = $topo1["topology_id"]; - $lca_topos2[$a]["checked"] = array_key_exists($topo1["topology_id"], $lca["lca_topos"]) ? "true" : "false"; - $lca_topos2[$a]["c_id"] = $a; - $lca_topos2[$a]["childs"] = array(); - - /*old*/ - $lca_topos[] = HTML_QuickForm::createElement( - 'checkbox', - $topo1["topology_id"], - null, - array_key_exists($topo1["topology_name"], $lang) - ? " "._($topo1["topology_name"])."<br />" - : " #UNDEF#"."<br />", - array("style"=>"margin-top: 5px;", "id"=>$topo1["topology_id"]) - ); - $rq = "SELECT topology_id, topology_page, topology_name, topology_parent " - . "FROM topology " - . "WHERE topology_parent = '".$topo1["topology_page"]."' " - . "AND topology_page IN (".$oreon->user->lcaTStr.") " - . "ORDER BY topology_order"; - $DBRESULT2 = $pearDB->query($rq); - /*old*/ - $b = 0; - while ($topo2 = $DBRESULT2->fetchRow()) { - $lca_topos2[$a]["childs"][$b] = array(); - $lca_topos2[$a]["childs"][$b]["name"] = _($topo2["topology_name"]); - $lca_topos2[$a]["childs"][$b]["id"] = $topo2["topology_id"]; - $lca_topos2[$a]["childs"][$b]["checked"] = - array_key_exists($topo2["topology_id"], $lca["lca_topos"]) ? "true" : "false"; - $lca_topos2[$a]["childs"][$b]["c_id"] = $a."_".$b; - $lca_topos2[$a]["childs"][$b]["childs"] = array(); - - - - /*old*/ - $lca_topos[] = HTML_QuickForm::createElement( - 'checkbox', - $topo2["topology_id"], - null, - array_key_exists($topo2["topology_name"], $lang) - ? " "._($topo2["topology_name"])."<br />" - : " #UNDEF#"."<br />", - array("style"=>"margin-top: 5px; margin-left: 20px;") - ); - $rq = "SELECT topology_id, topology_name, topology_parent, topology_page " - . "FROM topology " - . "WHERE topology_parent = '".$topo2["topology_page"]."' " - . "AND topology_page IN (".$oreon->user->lcaTStr.") " - . "ORDER BY topology_order"; - $DBRESULT3 = $pearDB->query($rq); - /*old*/ - $c = 0; - while ($topo3 = $DBRESULT3->fetchRow()) { - $lca_topos2[$a]["childs"][$b]["childs"][$c] = array(); - $lca_topos2[$a]["childs"][$b]["childs"][$c]["name"] = _($topo3["topology_name"]); - $lca_topos2[$a]["childs"][$b]["childs"][$c]["id"] = $topo3["topology_id"]; - $lca_topos2[$a]["childs"][$b]["childs"][$c]["checked"] = - array_key_exists($topo3["topology_id"], $lca["lca_topos"]) ? "true" : "false"; - $lca_topos2[$a]["childs"][$b]["childs"][$c]["c_id"] = $a."_".$b."_".$c; - $lca_topos2[$a]["childs"][$b]["childs"][$c]["childs"] = array(); - - - - /*old*/ - $lca_topos[] = HTML_QuickForm::createElement( - 'checkbox', - $topo3["topology_id"], - null, - array_key_exists($topo3["topology_name"], $lang) - ? " "._($topo3["topology_name"])."<br />" - : " #UNDEF#"."<br />", - array("style"=>"margin-top: 5px; margin-left: 40px;") - ); - $rq = "SELECT topology_id, topology_name, topology_parent " - . "FROM topology " - . "WHERE topology_parent = '".$topo3["topology_page"]."' " - . "AND topology_page IN (".$oreon->user->lcaTStr.") ORDER BY topology_order"; - $DBRESULT4 = $pearDB->query($rq); - /*old*/ - $d = 0; - while ($topo4 = $DBRESULT4->fetchRow()) { - $lca_topos2[$a]["childs"][$b]["childs"][$c]["childs"][$d] = array(); - $lca_topos2[$a]["childs"][$b]["childs"][$c]["childs"][$d]["name"] = _("topology_name"); - $lca_topos2[$a]["childs"][$b]["childs"][$c]["childs"][$d]["id"] = $topo4["topology_id"]; - $lca_topos2[$a]["childs"][$b]["childs"][$c]["childs"][$d]["checked"] = - array_key_exists($topo4["topology_id"], $lca["lca_topos"]) ? "true" : "false"; - $lca_topos2[$a]["childs"][$b]["childs"][$c]["childs"][$d]["c_id"] = $a."_".$b."_".$c."_".$d; - $lca_topos2[$a]["childs"][$b]["childs"][$c]["childs"][$d]["childs"] = array(); - - /*old*/ - $lca_topos[] = HTML_QuickForm::createElement( - 'checkbox', - $topo4["topology_id"], - null, - array_key_exists($topo4["topology_name"], $lang) - ? " "._($topo4["topology_name"])."<br />" - : " #UNDEF#"."<br />", - array("style"=>"margin-top: 5px; margin-left: 55px;") - ); - /*old*/ - $d++; - } - $c++; - } - $b++; - } - $a++; -} - - -if ($o == "a") { - $lca_topos = array_map("one", $lca_topos); -} -$form->addGroup($lca_topos, 'lca_topos', _("Visible page"), ' '); - -$tab = array(); -$tab[] = HTML_QuickForm::createElement('radio', 'action', null, _("List"), '1'); -$tab[] = HTML_QuickForm::createElement('radio', 'action', null, _("Form"), '0'); -$form->addGroup($tab, 'action', _("More Actions"), ' '); -$form->setDefaults(array('action'=>'1')); - - -$form->addElement('hidden', 'lca_id'); -$redirect = $form->addElement('hidden', 'o'); -$redirect->setValue($o); - -# -## Form Rules -# -$form->applyFilter('__ALL__', 'myTrim'); -$form->addRule('lca_name', _("Required"), 'required'); -$form->registerRule('exist', 'callback', 'testExistence'); -$form->addRule('lca_name', _("Already exists"), 'exist'); -$form->setRequiredNote(_("Required field")); - -# -##End of form definition -# - -# Smarty template Init -$tpl = new Smarty(); -$tpl = initSmartyTpl($path, $tpl); - -# Just watch a LCA information -if ($o == "w") { - $form->addElement( - "button", - "change", - _("Modify"), - array("onClick"=>"javascript:window.location.href='?p=".$p."&o=c&lca_id=".$lca_id."'") - ); - $form->setDefaults($lca); - $form->freeze(); -} elseif ($o == "c") { # Modify a LCA information - $subC = $form->addElement('submit', 'submitC', _("Save")); - $res = $form->addElement('reset', 'reset', _("Delete")); - $form->setDefaults($lca); -} elseif ($o == "a") { # Add a LCA information - $subA = $form->addElement('submit', 'submitA', _("Save")); - $res = $form->addElement('reset', 'reset', _("Delete")); -} -$tpl->assign('msg', array("changeL"=>"?p=".$p."&o=c&lca_id=".$lca_id, "changeT"=>_("Modify"))); - - -$tpl->assign("lca_topos2", $lca_topos2); - -$tpl->assign("sort1", _("General Information")); -$tpl->assign("sort2", _("Resources")); -$tpl->assign("sort3", _("Topology")); - -$valid = false; -if ($form->validate()) { - $lcaObj = $form->getElement('lca_id'); - if ($form->getSubmitValue("submitA")) { - $lcaObj->setValue(insertLCAInDB()); - } elseif ($form->getSubmitValue("submitC")) { - updateLCAInDB($lcaObj->getValue()); - } - $o = null; - $form->addElement( - "button", - "change", - _("Modify"), - array("onClick"=>"javascript:window.location.href='?p=".$p."&o=c&lca_id=".$lcaObj->getValue()."'") - ); - $form->freeze(); - $valid = true; -} -$action = $form->getSubmitValue("action"); -if ($valid && $action["action"]) { - require_once("listLCA.php"); -} else { - #Apply a template definition - $renderer = new HTML_QuickForm_Renderer_ArraySmarty($tpl, true); - $renderer->setRequiredTemplate('{$label} <font color="red" size="1">*</font>'); - $renderer->setErrorTemplate('<font color="red">{$error}</font><br />{$html}'); - $form->accept($renderer); - $tpl->assign('form', $renderer->toArray()); - $tpl->assign('o', $o); - $tpl->display("formLCA.ihtml"); -} diff --git a/www/include/options/accessLists/define/index.html b/www/include/options/accessLists/define/index.html deleted file mode 100644 index e69de29bb2d1d6434b8b29ae775ad8c2e48c5391..0000000000000000000000000000000000000000 diff --git a/www/include/options/accessLists/define/lca.php b/www/include/options/accessLists/define/lca.php deleted file mode 100644 index 2088c51d19424a18290ce954f7a143bd2d5c93ff..0000000000000000000000000000000000000000 --- a/www/include/options/accessLists/define/lca.php +++ /dev/null @@ -1,96 +0,0 @@ -<?php -/* - * Copyright 2005-2015 Centreon - * Centreon is developped by : Julien Mathis and Romain Le Merlus under - * GPL Licence 2.0. - * - * This program is free software; you can redistribute it and/or modify it under - * the terms of the GNU General Public License as published by the Free Software - * Foundation ; either version 2 of the License. - * - * This program is distributed in the hope that it will be useful, but WITHOUT ANY - * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A - * PARTICULAR PURPOSE. See the GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along with - * this program; if not, see <http://www.gnu.org/licenses>. - * - * Linking this program statically or dynamically with other modules is making a - * combined work based on this program. Thus, the terms and conditions of the GNU - * General Public License cover the whole combination. - * - * As a special exception, the copyright holders of this program give Centreon - * permission to link this program with independent modules to produce an executable, - * regardless of the license terms of these independent modules, and to copy and - * distribute the resulting executable under terms of Centreon choice, provided that - * Centreon also meet, for each linked independent module, the terms and conditions - * of the license of that module. An independent module is a module which is not - * derived from this program. If you modify this program, you may extend this - * exception to your version of the program, but you are not obliged to do so. If you - * do not wish to do so, delete this exception statement from your version. - * - * For more information : contact@centreon.com - * - * SVN : $URL$ - * SVN : $Id$ - * - */ -if (!isset($oreon)) { - exit(); -} - -isset($_GET["lca_id"]) ? $cG = $_GET["lca_id"] : $cG = null; -isset($_POST["lca_id"]) ? $cP = $_POST["lca_id"] : $cP = null; -$cG ? $lca_id = $cG : $lca_id = $cP; - -isset($_GET["select"]) ? $cG = $_GET["select"] : $cG = null; -isset($_POST["select"]) ? $cP = $_POST["select"] : $cP = null; -$cG ? $select = $cG : $select = $cP; - -isset($_GET["dupNbr"]) ? $cG = $_GET["dupNbr"] : $cG = null; -isset($_POST["dupNbr"]) ? $cP = $_POST["dupNbr"] : $cP = null; -$cG ? $dupNbr = $cG : $dupNbr = $cP; - - -#Pear library -require_once "HTML/QuickForm.php"; -require_once 'HTML/QuickForm/advmultiselect.php'; -require_once 'HTML/QuickForm/Renderer/ArraySmarty.php'; - -#Path to the configuration dir -$path = "./include/options/LCA/define/"; - -#PHP functions -require_once $path."DB-Func.php"; -require_once "./include/common/common-Func.php"; - -switch ($o) { - case "a": - require_once($path."formLCA.php"); - break; #Add a LCA - case "w": - require_once($path."formLCA.php"); - break; #Watch a LCA - case "c": - require_once($path."formLCA.php"); - break; #Modify a LCA - case "s": - enableLCAInDB($lca_id); - require_once($path."listLCA.php"); - break; #Activate a LCA - case "u": - disableLCAInDB($lca_id); - require_once($path."listLCA.php"); - break; #Desactivate a LCA - case "m": - multipleLCAInDB(isset($select) ? $select : array(), $dupNbr); - require_once($path."listLCA.php"); - break; #Duplicate n LCAs - case "d": - deleteLCAInDB(isset($select) ? $select : array()); - require_once($path."listLCA.php"); - break; #Delete n LCAs - default: - require_once($path."listLCA.php"); - break; -} diff --git a/www/include/options/accessLists/define/listLCA.ihtml b/www/include/options/accessLists/define/listLCA.ihtml deleted file mode 100644 index d7aa7cc83216d4d7299c73189db30879a980519e..0000000000000000000000000000000000000000 --- a/www/include/options/accessLists/define/listLCA.ihtml +++ /dev/null @@ -1,52 +0,0 @@ -<script type="text/javascript" src="./include/common/javascript/tool.js"></script> -<form name='form' method='POST'> - <table class="ToolbarTable"> - <tr class="ToolbarTR"> - <td class="Toolbar_TDSelectAction_Top"> - {$msg.options} {$form.o1.html} - - <a href="{$msg.addL}">{$msg.addT}</a> - </td> - <input name="p" value="{$p}" type="hidden"> - {php} - include('./include/common/pagination.php'); - {/php} - </tr> - </table> - - <table class="ListTable"> - <tr class="ListHeader"> - <td class="ListColHeaderPicker"><input type="checkbox" name="checkall" onclick="checkUncheckAll(this);"/></td> - <td class="ListColHeaderLeft">{$headerMenu_name}</td> - <td class="ListColHeaderLeft">{$headerMenu_alias}</td> - <td class="ListColHeaderCenter">{$headerMenu_status}</td> - <td class="ListColHeaderRight">{$headerMenu_options}</td> - </tr> - {section name=elem loop=$elemArr} - <tr class={$elemArr[elem].MenuClass}> - <td class="ListColPicker">{$elemArr[elem].RowMenu_select}</td> - <td class="ListColLeft"><a href="{$elemArr[elem].RowMenu_link}">{$elemArr[elem].RowMenu_name}</a></td> - <td class="ListColLeft"><a href="{$elemArr[elem].RowMenu_link}">{$elemArr[elem].RowMenu_alias}</a></td> - <td class="ListColCenter">{$elemArr[elem].RowMenu_status}</td> - <td class="ListColRight">{$elemArr[elem].RowMenu_options}</td> - </tr> - {/section} - </table> - - <table class="ToolbarTable"> - <tr> - <td class="Toolbar_TDSelectAction_Bottom"> - {$msg.options} {$form.o2.html} - - <a href="{$msg.addL}">{$msg.addT}</a> - </td> - <input name="p" value="{$p}" type="hidden"> - {php} - include('./include/common/pagination.php'); - {/php} - </tr> - </table> -<input type='hidden' name='o' id='o' value='42'> -<input type='hidden' id='limit' name='limit' value='{$limit}'> -{$form.hidden} -</form> \ No newline at end of file diff --git a/www/include/options/accessLists/define/listLCA.php b/www/include/options/accessLists/define/listLCA.php deleted file mode 100644 index f2e596db8a9bd55884d99ea6578e5766e917c37c..0000000000000000000000000000000000000000 --- a/www/include/options/accessLists/define/listLCA.php +++ /dev/null @@ -1,205 +0,0 @@ -<?php -/* - * Copyright 2005-2015 Centreon - * Centreon is developped by : Julien Mathis and Romain Le Merlus under - * GPL Licence 2.0. - * - * This program is free software; you can redistribute it and/or modify it under - * the terms of the GNU General Public License as published by the Free Software - * Foundation ; either version 2 of the License. - * - * This program is distributed in the hope that it will be useful, but WITHOUT ANY - * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A - * PARTICULAR PURPOSE. See the GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along with - * this program; if not, see <http://www.gnu.org/licenses>. - * - * Linking this program statically or dynamically with other modules is making a - * combined work based on this program. Thus, the terms and conditions of the GNU - * General Public License cover the whole combination. - * - * As a special exception, the copyright holders of this program give Centreon - * permission to link this program with independent modules to produce an executable, - * regardless of the license terms of these independent modules, and to copy and - * distribute the resulting executable under terms of Centreon choice, provided that - * Centreon also meet, for each linked independent module, the terms and conditions - * of the license of that module. An independent module is a module which is not - * derived from this program. If you modify this program, you may extend this - * exception to your version of the program, but you are not obliged to do so. If you - * do not wish to do so, delete this exception statement from your version. - * - * For more information : contact@centreon.com - * - */ - -if (!isset($centreon)) { - exit(); -} - -include("./include/common/autoNumLimit.php"); - -# start quickSearch form -$advanced_search = 0; -include_once("./include/common/quickSearch.php"); -# end quickSearch form - -$lca_reg = null; -# Not list the LCA the user is registered by || is admin -if (!$centreon->user->get_admin()) { - $DBRESULT = $pearDB->query( - "SELECT contactgroup_cg_id " - . "FROM contactgroup_contact_relation WHERE contact_contact_id = '".$centreon->user->get_id()."'" - ); - while ($contactGroup = $DBRESULT->fetchRow()) { - $DBRESULT2 = $pearDB->query( - "SELECT lca.lca_id " - . "FROM lca_define_contactgroup_relation ldcgr, lca_define lca " - . "WHERE ldcgr.contactgroup_cg_id = '".$contactGroup["contactgroup_cg_id"]."' " - . "AND ldcgr.lca_define_lca_id = lca.lca_id" - ); - while ($lca = $DBRESULT2->fetchRow()) { - $lca_reg ? $lca_reg .= ", ".$lca["lca_id"] : $lca_reg = $lca["lca_id"]; - } - } -} -$lca_reg ? $lca_reg = $lca_reg : $lca_reg = '\'\''; -if (isset($search)) { - $DBRESULT = $pearDB->query( - "SELECT COUNT(*) " - . "FROM lca_define " - . "WHERE lca_id NOT IN (".$lca_reg.") " - . "AND (lca_name LIKE '".$search."' OR lca_alias LIKE '".$search."')" - ); -} else { - $DBRESULT = $pearDB->query("SELECT COUNT(*) FROM lca_define WHERE lca_id NOT IN (".$lca_reg.")"); -} -$tmp = $DBRESULT->fetchRow(); -$rows = $tmp["COUNT(*)"]; - -# Smarty template Init -$tpl = new Smarty(); -$tpl = initSmartyTpl($path, $tpl); - -# start header menu -$tpl->assign("headerMenu_name", _("Name")); -$tpl->assign("headerMenu_alias", _("Alias")); -$tpl->assign("headerMenu_status", _("Status")); -$tpl->assign("headerMenu_options", _("Options")); -# end header menu - -#List -if ($search) { - $rq = "SELECT lca_id, lca_name, lca_alias, lca_activate " - . "FROM lca_define " - . "WHERE (lca_name LIKE '".$search."' OR lca_alias LIKE '".$search."') " - . "AND lca_id NOT IN (".$lca_reg.") " - . "ORDER BY lca_name LIMIT ".$num * $limit.", ".$limit; -} else { - $rq = "SELECT lca_id, lca_name, lca_alias, lca_activate " - . "FROM lca_define " - . "WHERE lca_id NOT IN (".$lca_reg.") " - . "ORDER BY lca_name LIMIT ".$num * $limit.", ".$limit; -} -$DBRESULT = $pearDB->query($rq); - -$search = tidySearchKey($search, $advanced_search); - -$form = new HTML_QuickForm('select_form', 'POST', "?p=".$p); -#Different style between each lines -$style = "one"; -#Fill a tab with a mutlidimensionnal Array we put in $tpl -$elemArr = array(); -for ($i = 0; $lca = $DBRESULT->fetchRow(); $i++) { - $moptions = ""; - $selectedElements = $form->addElement('checkbox', "select[".$lca['lca_id']."]"); - if ($lca["lca_activate"]) { - $moptions .= "<a href='main.php?p=".$p."&lca_id=".$lca['lca_id']."&o=u&limit=".$limit."&num=".$num."&search=" - . $search."'><img src='img/icones/16x16/element_previous.gif' border='0' alt='" - . _("Disabled")."'></a> "; - } else { - $moptions .= "<a href='main.php?p=".$p."&lca_id=".$lca['lca_id']."&o=s&limit=".$limit."&num=".$num."&search=" - . $search."'><img src='img/icones/16x16/element_next.gif' border='0' alt='" - . _("Enabled")."'></a> "; - } - $moptions .= " <input onKeypress=\"if(event.keyCode > 31 && (event.keyCode < 45 || event.keyCode > 57)) " - . "event.returnValue = false; if(event.which > 31 && (event.which < 45 || event.which > 57)) return false;\" " - . "maxlength=\"3\" size=\"3\" value='1' style=\"margin-bottom:0px;\" name='dupNbr[" - . $lca['lca_id']."]'></input>"; - - $elemArr[$i] = array("MenuClass"=>"list_".$style, - "RowMenu_select"=>$selectedElements->toHtml(), - "RowMenu_name"=>$lca["lca_name"], - "RowMenu_link"=>"?p=".$p."&o=c&lca_id=".$lca['lca_id'], - "RowMenu_alias"=>$lca["lca_alias"], - "RowMenu_status"=>$lca["lca_activate"] ? _("Enabled") : _("Disabled"), - "RowMenu_options"=>$moptions); - $style != "two" ? $style = "two" : $style = "one"; -} -$tpl->assign("elemArr", $elemArr); -#Different messages we put in the template -$tpl->assign('msg', array("addL"=>"?p=".$p."&o=a", "addT"=>_("Add"), "delConfirm"=>_("Do you confirm the deletion ?"))); - -# -##Toolbar select lgd_more_actions -# -?> -<script type="text/javascript"> -function setO(_i) { - document.forms['form'].elements['o'].value = _i; -} -</SCRIPT> -<?php -$attrs = array( - 'onchange'=>"javascript: " . - "if (this.form.elements['o1'].selectedIndex == 1 && confirm('"._("Do you confirm the duplication ?")."')) {" . - " setO(this.form.elements['o1'].value); submit();} " . - "else if (this.form.elements['o1'].selectedIndex == 2 && confirm('"._("Do you confirm the deletion ?")."')) {" . - " setO(this.form.elements['o1'].value); submit();} " . - "else if (this.form.elements['o1'].selectedIndex == 3) {" . - " setO(this.form.elements['o1'].value); submit();} " . - "" -); - -$form->addElement( - 'select', - 'o1', - null, - array(null=>_("More actions..."), "m"=>_("Duplicate"), "d"=>_("Delete")), - $attrs -); -$form->setDefaults(array('o1' => null)); -$o1 = $form->getElement('o1'); -$o1->setValue(null); - -$attrs = array( - 'onchange'=>"javascript: " . - "if (this.form.elements['o2'].selectedIndex == 1 && confirm('"._("Do you confirm the duplication ?")."')) {" . - " setO(this.form.elements['o2'].value); submit();} " . - "else if (this.form.elements['o2'].selectedIndex == 2 && confirm('"._("Do you confirm the deletion ?")."')) {" . - " setO(this.form.elements['o2'].value); submit();} " . - "else if (this.form.elements['o2'].selectedIndex == 3) {" . - " setO(this.form.elements['o2'].value); submit();} " . - "" -); -$form->addElement( - 'select', - 'o2', - null, - array(null=>_("More actions..."), "m"=>_("Duplicate"), "d"=>_("Delete")), - $attrs -); -$form->setDefaults(array('o2' => null)); - -$o2 = $form->getElement('o2'); -$o2->setValue(null); - -$tpl->assign('limit', $limit); - -# -##Apply a template definition -# -$renderer = new HTML_QuickForm_Renderer_ArraySmarty($tpl); -$form->accept($renderer); -$tpl->assign('form', $renderer->toArray()); -$tpl->display("listLCA.ihtml"); diff --git a/www/install/sql/centreon/Update-DB-2.8.21_to_2.8.22.sql b/www/install/sql/centreon/Update-DB-2.8.21_to_2.8.22.sql new file mode 100644 index 0000000000000000000000000000000000000000..134a3cc4bbe1d1ce57abce2d5671a59348d10827 --- /dev/null +++ b/www/install/sql/centreon/Update-DB-2.8.21_to_2.8.22.sql @@ -0,0 +1,6 @@ + +-- Clean source code and remove potential problems with ACL +UPDATE topology SET topology_url = NULL WHERE topology_page = 502; + +-- Change version of Centreon +UPDATE `informations` SET `value` = '2.8.22' WHERE CONVERT( `informations`.`key` USING utf8 ) = 'version' AND CONVERT ( `informations`.`value` USING utf8 ) = '2.8.21' LIMIT 1;