/**
* @return array|string
*/
public static function getIpNotifications()
{
if (!function_exists('curl_init')) {
return array();
}
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, \Ip\Internal\System\Model::instance()->getImpressPagesAPIUrl());
curl_setopt($ch, CURLOPT_POST, 1);
$postFields = 'module_group=service&module_name=communication&action=getInfo&version=1&afterLogin='******'&systemVersion=' . \Ip\ServiceLocator::storage()->get('Ip', 'version');
$plugins = \Ip\Internal\Plugins\Model::getActivePlugins();
foreach ($plugins as $plugin) {
$postFields .= '&plugins[' . $plugin['name'] . ']=' . $plugin['version'];
}
curl_setopt($ch, CURLOPT_POSTFIELDS, $postFields);
curl_setopt($ch, CURLOPT_REFERER, ipConfig()->baseUrl());
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_TIMEOUT, 30);
$answer = curl_exec($ch);
$notices = json_decode($answer);
if (!is_array($notices)) {
// json decode error or wrong answer
ipLog()->error('System.updateCheckInvalidResponse', array('curl_error' => curl_error($ch), 'response' => $answer));
return array();
}
return $notices;
}