mirror of
https://github.com/Combodo/iTop.git
synced 2026-04-23 18:48:51 +02:00
Merge remote-tracking branch 'origin/support/2.7' into support/2.7
This commit is contained in:
@@ -3256,16 +3256,15 @@ EOF
|
||||
*/
|
||||
public function DisplayDocumentInline(WebPage $oPage, $sAttCode)
|
||||
{
|
||||
/** @var \ormDocument $oDoc */
|
||||
$oDoc = $this->Get($sAttCode);
|
||||
$sClass = get_class($this);
|
||||
$Id = $this->GetKey();
|
||||
switch ($oDoc->GetMainMimeType())
|
||||
{
|
||||
switch ($oDoc->GetMainMimeType()) {
|
||||
case 'text':
|
||||
case 'html':
|
||||
$data = $oDoc->GetData();
|
||||
switch ($oDoc->GetMimeType())
|
||||
{
|
||||
switch ($oDoc->GetMimeType()) {
|
||||
case 'text/xml':
|
||||
$oPage->add("<iframe id='preview_$sAttCode' src=\"".utils::GetAbsoluteUrlAppRoot()."pages/ajax.render.php?operation=display_document&class=$sClass&id=$Id&field=$sAttCode\" width=\"100%\" height=\"400\">Loading...</iframe>\n");
|
||||
break;
|
||||
|
||||
@@ -2337,4 +2337,12 @@ class utils
|
||||
$e = new CoreException($sMessage, null, '', $oException);
|
||||
throw $e;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return bool : indicate whether we run under a windows environnement or not
|
||||
* @since 2.7.4 : N°3412
|
||||
*/
|
||||
public static function IsWindowsEnvironment(){
|
||||
return (substr(PHP_OS,0,3) === 'WIN');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -554,19 +554,23 @@ class SetupUtils
|
||||
return new CheckResult(CheckResult::ERROR, "The PHP exec() function has been disabled on this server");
|
||||
}
|
||||
|
||||
clearstatcache();
|
||||
if (!is_file($sGraphvizPath) || ! is_executable($sGraphvizPath)){
|
||||
//N°3412 avoid shell injection
|
||||
return new CheckResult(CheckResult::ERROR, "$sGraphvizPath could not be executed: Please make sure it is installed and in the path");
|
||||
}
|
||||
|
||||
$sGraphvizPath = escapeshellcmd($sGraphvizPath);
|
||||
|
||||
// availability of dot / dot.exe
|
||||
if (empty($sGraphvizPath))
|
||||
{
|
||||
$sGraphvizPath = 'dot';
|
||||
} else {
|
||||
clearstatcache();
|
||||
if (!is_file($sGraphvizPath) || !is_executable($sGraphvizPath)) {
|
||||
//N°3412 avoid shell injection
|
||||
return new CheckResult(CheckResult::ERROR,
|
||||
"$sGraphvizPath could not be executed: Please make sure it is installed and in the path");
|
||||
}
|
||||
|
||||
if (!utils::IsWindowsEnvironment()){
|
||||
$sGraphvizPath = escapeshellcmd($sGraphvizPath);
|
||||
}
|
||||
}
|
||||
|
||||
$sCommand = "\"$sGraphvizPath\" -V 2>&1";
|
||||
|
||||
$aOutput = array();
|
||||
|
||||
@@ -517,7 +517,8 @@ class CriterionConversionTest extends ItopDataTestCase
|
||||
*/
|
||||
function testOqlToForSearchToOqlAltLanguageFR($sOQL, $sExpectedOQL, $aExpectedCriterion)
|
||||
{
|
||||
$this->OqlToSearchToOqlAltLanguage($sOQL, $sExpectedOQL, $aExpectedCriterion, "FR FR");
|
||||
\MetaModel::GetConfig()->Set('date_and_time_format', array('default' => array('date' => 'Y-m-d', 'time' => 'H:i:s', 'date_time' => '$date $time')));
|
||||
$this->OqlToSearchToOqlAltLanguage($sOQL, $sExpectedOQL, $aExpectedCriterion, "FR FR");
|
||||
}
|
||||
|
||||
|
||||
@@ -537,10 +538,10 @@ class CriterionConversionTest extends ItopDataTestCase
|
||||
*/
|
||||
function testOqlToForSearchToOqlAltLanguageEN($sOQL, $sExpectedOQL, $aExpectedCriterion)
|
||||
{
|
||||
\MetaModel::GetConfig()->Set('date_and_time_format', array('default' => array('date' => 'Y-m-d', 'time' => 'H:i:s', 'date_time' => '$date $time')));
|
||||
$this->OqlToSearchToOqlAltLanguage($sOQL, $sExpectedOQL, $aExpectedCriterion, "EN US");
|
||||
}
|
||||
|
||||
|
||||
function OqlProviderDates()
|
||||
{
|
||||
return array(
|
||||
|
||||
@@ -30,16 +30,16 @@ class SetupUtilsTest extends ItopTestCase
|
||||
}
|
||||
|
||||
/**
|
||||
* @dataProvider CheckGravitzProvider
|
||||
* @dataProvider CheckGraphvizProvider
|
||||
*/
|
||||
public function testCheckGravitz($sScriptPath, $iSeverity, $sLabel){
|
||||
public function testCheckGraphviz($sScriptPath, $iSeverity, $sLabel){
|
||||
/** @var \CheckResult $oCheck */
|
||||
$oCheck = SetupUtils::CheckGraphviz($sScriptPath);
|
||||
$this->assertEquals($iSeverity, $oCheck->iSeverity);
|
||||
$this->assertContains($sLabel, $oCheck->sLabel);
|
||||
}
|
||||
|
||||
public function CheckGravitzProvider(){
|
||||
public function CheckGraphvizProvider(){
|
||||
if (substr(PHP_OS,0,3) === 'WIN'){
|
||||
return [];
|
||||
}
|
||||
@@ -55,6 +55,11 @@ class SetupUtilsTest extends ItopTestCase
|
||||
2,
|
||||
"",
|
||||
],
|
||||
"empty command => dot by default" => [
|
||||
"",
|
||||
2,
|
||||
"",
|
||||
],
|
||||
"command failed" => [
|
||||
"/bin/ls",
|
||||
1,
|
||||
|
||||
Reference in New Issue
Block a user