Merge branch 'support/3.2' into develop

This commit is contained in:
odain
2025-11-07 20:33:14 +01:00
1837 changed files with 33034 additions and 34549 deletions

View File

@@ -1,4 +1,5 @@
<?php
require_once(APPROOT.'application/newsroomprovider.class.inc.php');
class HubNewsroomProvider extends NewsroomProviderBase
@@ -10,24 +11,21 @@ class HubNewsroomProvider extends NewsroomProviderBase
public function GetTTL()
{
// TODO Auto-generated method stub
return 15*60; // Update every 15 minutes
return 15 * 60; // Update every 15 minutes
}
/**
* {@inheritDoc}
* @see NewsroomProviderBase::IsApplicable()
*/
public function IsApplicable(User $oUser = null)
{
if ($oUser !== null)
{
if ($oUser !== null) {
return UserRights::IsAdministrator($oUser);
}
else
{
} else {
return false;
}
}
/**
* {@inheritDoc}
@@ -37,33 +35,33 @@ class HubNewsroomProvider extends NewsroomProviderBase
{
return 'iTop Hub'; // No need to translate...
}
public function GetMarkAllAsReadURL()
{
return $this->MakeURL('route_mark_all_messages_as_read');
}
public function GetFetchURL()
{
return $this->MakeURL('route_fetch_unread_messages');
}
public function GetViewAllURL()
{
return $sBaseUrl = $this->oConfig->GetModuleSetting('itop-hub-connector', 'url').MetaModel::GetModuleSetting('itop-hub-connector', 'route_view_all_messages');
}
/**
* {@inheritDoc}
* @see iNewsroomProvider::GetPlaceholders()
*/
public function GetPlaceholders()
{
return array(
'%connect_to_itop_hub%' => utils::GetAbsoluteUrlModulePage('itop-hub-connector', 'launch.php', array('target' => 'view_dashboard')),
);
return [
'%connect_to_itop_hub%' => utils::GetAbsoluteUrlModulePage('itop-hub-connector', 'launch.php', ['target' => 'view_dashboard']),
];
}
/**
* {@inheritDoc}
* @see NewsroomProviderBase::GetPreferencesUrl()
@@ -72,15 +70,15 @@ class HubNewsroomProvider extends NewsroomProviderBase
{
return null;
}
private function MakeURL($sRouteCode)
{
$sBaseUrl = $this->oConfig->GetModuleSetting('itop-hub-connector', 'url').MetaModel::GetModuleSetting('itop-hub-connector', $sRouteCode);
$sParameters = 'uuid[bdd]='.urlencode((string) trim(DBProperty::GetProperty('database_uuid', ''), '{}'));
$sParameters .= '&uuid[file]='.urlencode((string) trim(@file_get_contents(utils::GetDataPath()."instance.txt"), "{} \n"));
$sParameters .= '&uuid[user]='.urlencode(UserRights::GetUserId());
return $sBaseUrl.'?'.$sParameters;
}
}