'. t('Last checked: ') . ($last ? format_interval(time() - $last) .' '. t('ago') : t('Never')); $output .= ' ('. l(t('Check manually'), 'admin/reports/updates/check') .')'; $output .= "\n"; if (!is_array($data)) { $output .= '

'. $data .'

'; return $output; } $header = array(); $rows = array(); $notification_level = variable_get('update_notification_threshold', 'all'); foreach ($data as $project) { switch ($project['status']) { case UPDATE_CURRENT: $class = 'ok'; $icon = theme('image', 'misc/watchdog-ok.png'); break; case UPDATE_NOT_SECURE: case UPDATE_NOT_CURRENT: if ($notification_level == 'all' || $project['status'] == UPDATE_NOT_SECURE) { $class = 'error'; $icon = theme('image', 'misc/watchdog-error.png'); break; } // Otherwise, deliberate no break and use the warning class/icon. default: $class = 'warning'; $icon = theme('image', 'misc/watchdog-warning.png'); break; } $row = '
'; switch ($project['status']) { case UPDATE_CURRENT: $row .= t('Up to date'); break; case UPDATE_NOT_SECURE: $row .= ''; $row .= t('Security update required!'); $row .= ''; break; case UPDATE_NOT_CURRENT: $row .= t('Update available'); break; default: $row .= check_plain($project['reason']); break; } $row .= ''. $icon .''; $row .= "
\n"; $row .= '
'; if (isset($project['title'])) { if (isset($project['link'])) { $row .= l($project['title'], $project['link']); } else { $row .= check_plain($project['title']); } } else { $row .= check_plain($project['name']); } $row .= ' '. check_plain($project['existing_version']); if ($project['install_type'] == 'dev' && !empty($project['datestamp'])) { $row .= ' ('. format_date($project['datestamp'], 'custom', 'Y-M-d') .') '; } $row .= "
\n"; $row .= "
\n"; if (isset($project['recommended'])) { if ($project['status'] != UPDATE_CURRENT || $project['existing_version'] != $project['recommended']) { // First, figure out what to recommend. // If there's only 1 security update and it has the same version we're // recommending, give it the same CSS class as if it was recommended, // but don't print out a separate "Recommended" line for this project. if (!empty($project['security updates']) && count($project['security updates']) == 1 && $project['security updates'][0]['version'] == $project['recommended']) { $security_class = ' version-recommended version-recommended-strong'; } else { $security_class = ''; $version_class = 'version-recommended'; // Apply an extra class if we're displaying both a recommended // version and anything else for an extra visual hint. if ($project['recommended'] != $project['latest_version'] || !empty($project['also']) || ($project['install_type'] == 'dev' && $project['latest_version'] != $project['dev_version'] && $project['recommended'] != $project['dev_version']) || (isset($project['security updates'][0]) && $project['recommended'] != $project['security updates'][0]) ) { $version_class .= ' version-recommended-strong'; } $row .= theme('update_version', $project['releases'][$project['recommended']], t('Recommended version:'), $version_class); } // Now, print any security updates. if (!empty($project['security updates'])) { foreach ($project['security updates'] as $security_update) { $row .= theme('update_version', $security_update, t('Security update:'), 'version-security'. $security_class); } } } if ($project['recommended'] != $project['latest_version']) { $row .= theme('update_version', $project['releases'][$project['latest_version']], t('Latest version:'), 'version-latest'); } if ($project['install_type'] == 'dev' && $project['status'] != UPDATE_CURRENT && $project['recommended'] != $project['dev_version']) { $row .= theme('update_version', $project['releases'][$project['dev_version']], t('Development version:'), 'version-latest'); } } if (isset($project['also'])) { foreach ($project['also'] as $also) { $row .= theme('update_version', $project['releases'][$also], t('Also available:'), 'version-also-available'); } } $row .= "
\n"; // versions div. $row .= "
\n"; if (!empty($project['extra'])) { $row .= '
'."\n"; foreach ($project['extra'] as $key => $value) { $row .= '
'; $row .= check_plain($value['label']) .': '; $row .= theme('placeholder', $value['data']); $row .= "
\n"; } $row .= "
\n"; // extra div. } $row .= '
'; sort($project['includes']); $row .= t('Includes: %includes', array('%includes' => implode(', ', $project['includes']))); $row .= "
\n"; $row .= "
\n"; // info div. if (!isset($rows[$project['project_type']])) { $rows[$project['project_type']] = array(); } $rows[$project['project_type']][] = array( 'class' => $class, 'data' => array($row), ); } $project_types = array( 'core' => t('Drupal core'), 'module' => t('Modules'), 'theme' => t('Themes'), 'disabled-module' => t('Disabled modules'), 'disabled-theme' => t('Disabled themes'), ); foreach ($project_types as $type_name => $type_label) { if (!empty($rows[$type_name])) { $output .= "\n

". $type_label ."

\n"; $output .= theme('table', $header, $rows[$type_name], array('class' => 'update')); } } drupal_add_css(drupal_get_path('module', 'update') .'/update.css'); return $output; } /** * Theme the version display of a project. * * @ingroup themeable */ function theme_update_version($version, $tag, $class) { $output = ''; $output .= ''; $output .= ''; $output .= '\n"; $output .= '\n"; $output .= ''; $output .= ''; $output .= "
'. $tag ."'; $output .= l($version['version'], $version['release_link']); $output .= ' ('. format_date($version['date'], 'custom', 'Y-M-d') .') '; $output .= "
\n"; return $output; }