Skip to content
This repository has been archived by the owner on Dec 13, 2022. It is now read-only.

Commit

Permalink
* refs #3846 : Fix issue with token on update module page
Browse files Browse the repository at this point in the history
Conflicts:
	www/include/options/oreon/modules/formModule.php
  • Loading branch information
Lionel Assepo committed Oct 23, 2015
1 parent f9d51e6 commit 95d3151
Show file tree
Hide file tree
Showing 5 changed files with 36 additions and 27 deletions.
6 changes: 3 additions & 3 deletions www/include/options/oreon/modules/formModule.ihtml
Original file line number Diff line number Diff line change
Expand Up @@ -49,12 +49,12 @@
</td>
</tr>
{/if}
{if $form2.list.html}
{if $form.list.html}
<tr class="list_one">
<td colspan="2" align="center">
<form {$form2.attributes}>
<form {$form.attributes}>
<br />
{$form2.list.html}
{$form.list.html}
</form>
</td>
</tr>
Expand Down
46 changes: 23 additions & 23 deletions www/include/options/oreon/modules/formModule.php
Original file line number Diff line number Diff line change
Expand Up @@ -56,11 +56,11 @@
$tpl->assign("headerMenu_infos", _("Additionnal Information"));
$tpl->assign("headerMenu_isinstalled", _("Installed"));
$tpl->assign("headerMenu_isvalid", _("Valid for an upgrade"));

/*
* "Name" case, it's not a module which is installed
*/
if ($name) {
if ($operationType === 'install') {
$flag = false;
include_once(_CENTREON_PATH_ . "www/modules/".$name."/conf.php");
$tpl->assign("module_rname", $module_conf[$name]["rname"]);
Expand All @@ -71,8 +71,9 @@
$infos_streams = file(_CENTREON_PATH_ . "www/modules/".$name."/infos/infos.txt");
$infos_streams = implode("<br />", $infos_streams);
$tpl->assign("module_infosTxt", $infos_streams);
} else
} else {
$tpl->assign("module_infosTxt", false);
}

$form1 = new HTML_QuickForm('Form', 'post', "?p=".$p);

Expand Down Expand Up @@ -121,14 +122,18 @@
$renderer = new HTML_QuickForm_Renderer_ArraySmarty($tpl);
$form1->accept($renderer);
$tpl->assign('form1', $renderer->toArray());
} else if ($id) {
} elseif ($operationType === 'upgrade') {

/*
* "ID" case, it's an installed module
*/

$moduleinfo = getModuleInfoInDB(NULL, $id);
$elemArr = array();
$form = new HTML_QuickForm('Form', 'post', "?p=".$p);
$form->addElement('submit', 'list', _("Back"));
if (is_dir($centreon_path . "www/modules/".$moduleinfo["name"]."/UPGRADE")) {
$handle = opendir($centreon_path . "www/modules/".$moduleinfo["name"]."/UPGRADE");
if (is_dir(_CENTREON_PATH_ . "www/modules/".$moduleinfo["name"]."/UPGRADE")) {
$handle = opendir(_CENTREON_PATH_ . "www/modules/".$moduleinfo["name"]."/UPGRADE");
$i = 0;
Expand All @@ -137,7 +142,7 @@
if (substr($filename, 0, 1) != "." && strstr($filename, $moduleinfo["name"]."-")) {
include_once(_CENTREON_PATH_ . "www/modules/".$moduleinfo["name"]."/UPGRADE/".$filename."/conf.php");
if ($moduleinfo["mod_release"] == $upgrade_conf[$moduleinfo["name"]]["release_from"]) {
$form = new HTML_QuickForm('Form', 'post', "?p=".$p);

$upgrade_ok = false;
# Upgrade
if ($form->validate()) {
Expand Down Expand Up @@ -195,32 +200,27 @@
$hid_id->setValue($id);
$up_name = $form->addElement('hidden', 'filename');
$up_name->setValue($filename);
$form->addElement('submit', 'list', _("Back"), array("class" => "btc bt_default"));
$renderer = new HTML_QuickForm_Renderer_ArraySmarty($tpl);
$form->accept($renderer);
$tpl->assign('form', $renderer->toArray());

}
}
}
closedir($handle);
}
$moduleinfo = array();
$moduleinfo = getModuleInfoInDB(NULL, $id);
$tpl->assign("module_rname", $moduleinfo["rname"]);
$tpl->assign("module_release", $moduleinfo["mod_release"]);
$tpl->assign("module_author", $moduleinfo["author"]);
$tpl->assign("module_infos", $moduleinfo["infos"]);
$tpl->assign("module_isinstalled", _("Yes"));
$tpl->assign("elemArr", $elemArr);
$form2 = new HTML_QuickForm('Form', 'post', "?p=".$p);
$form2->addElement('submit', 'list', _("Back"), array("class" => "btc bt_default"));
$renderer = new HTML_QuickForm_Renderer_ArraySmarty($tpl);
$form2->accept($renderer);
$tpl->assign('form2', $renderer->toArray());
$moduleinfo = array();
$moduleinfo = getModuleInfoInDB(NULL, $id);
$tpl->assign("module_rname", $moduleinfo["rname"]);
$tpl->assign("module_release", $moduleinfo["mod_release"]);
$tpl->assign("module_author", $moduleinfo["author"]);
$tpl->assign("module_infos", $moduleinfo["infos"]);
$tpl->assign("module_isinstalled", _("Yes"));
$tpl->assign("elemArr", $elemArr);
$renderer = new HTML_QuickForm_Renderer_ArraySmarty($tpl);
$form->accept($renderer);
$tpl->assign('form', $renderer->toArray());
}

/**
* Display form
*/
$tpl->display("formModule.ihtml");
?>
?>
9 changes: 8 additions & 1 deletion www/include/options/oreon/modules/modules.php
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,14 @@
isset($_GET["name"]) ? $nameG = $_GET["name"] : $nameG = NULL;
isset($_POST["name"]) ? $nameP = $_POST["name"] : $nameP = NULL;
$nameG ? $name = $nameG : $name = $nameP;


$operationType = '';
if ($name !== NULL) {
$operationType = 'install';
} elseif ($id !== NULL) {
$operationType = 'upgrade';
}

/*
* Pear library
*/
Expand Down
2 changes: 2 additions & 0 deletions www/install/sql/centreon/Update-DB-2.6.5_to_2.6.6.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
-- Change version of Centreon
UPDATE `informations` SET `value` = '2.6.6' WHERE CONVERT( `informations`.`key` USING utf8 ) = 'version' AND CONVERT ( `informations`.`value` USING utf8 ) = '2.6.5' LIMIT 1;

0 comments on commit 95d3151

Please sign in to comment.