diff --git a/www/class/centreon-knowledge/wikiApi.class.php b/www/class/centreon-knowledge/wikiApi.class.php index 10ad514b609cf6a37436f3529c9cc57f8e18958b..81ab654f730eda1e3d9c1b3cc2f6824f350b2f9e 100644 --- a/www/class/centreon-knowledge/wikiApi.class.php +++ b/www/class/centreon-knowledge/wikiApi.class.php @@ -244,16 +244,20 @@ class WikiApi $token = $this->getMethodToken('delete', $title); - $postfields = array( - 'action' => 'delete', - 'title' => $title, - 'token' => $token - ); + if($token){ + $postfields = array( + 'action' => 'delete', + 'title' => $title, + 'token' => $token + ); - curl_setopt($this->curl, CURLOPT_POSTFIELDS, $postfields); - curl_exec($this->curl); + curl_setopt($this->curl, CURLOPT_POSTFIELDS, $postfields); + curl_exec($this->curl); - return true; + return true; + } else { + return false; + } } public function getAllPages() diff --git a/www/include/configuration/configKnowledge/templates/display.ihtml b/www/include/configuration/configKnowledge/templates/display.ihtml index 8b2e4cfc88df181fd3d3d87776404c3f5a817a3f..b4001a8f6d1b87d12d291ff5a12013b37587ddec 100644 --- a/www/include/configuration/configKnowledge/templates/display.ihtml +++ b/www/include/configuration/configKnowledge/templates/display.ihtml @@ -1,4 +1,5 @@ <script type="text/javascript" src="./include/common/javascript/tool.js"></script> +<div id="errorMsg" class="inactive"></div> <form name='form' method="POST"> <table class="ajaxOption table"> <tr> @@ -241,7 +242,15 @@ title: title }), success: function (data) { - location.reload() + if(data.result){ + location.reload() + } else { + var msg = "Deletion failed, please check your wiki configuration and your wiki user rights."; + var $popin = jQuery("#errorMsg"); + $popin.html(msg); + jQuery($popin).css('display', 'block'); + $popin.centreonPopin("open"); + } } }); }