1 | <?php |
---|
2 | |
---|
3 | function color_requirements($phase) { |
---|
4 | $requirements = array(); |
---|
5 | |
---|
6 | if ($phase == 'runtime') { |
---|
7 | // Check GD library |
---|
8 | if (function_exists('imagegd2')) { |
---|
9 | $info = gd_info(); |
---|
10 | $requirements['gd'] = array( |
---|
11 | 'value' => $info['GD Version'], |
---|
12 | ); |
---|
13 | |
---|
14 | // Check PNG support |
---|
15 | if (function_exists('imagecreatefrompng')) { |
---|
16 | $requirements['gd']['severity'] = REQUIREMENT_OK; |
---|
17 | } |
---|
18 | else { |
---|
19 | $requirements['gd']['severity'] = REQUIREMENT_ERROR; |
---|
20 | $requirements['gd']['description'] = t('The GD library for PHP is enabled, but was compiled without PNG support. Please check the <a href="@url">PHP image documentation</a> for information on how to correct this.', array('@url' => 'http://www.php.net/manual/en/ref.image.php')); |
---|
21 | } |
---|
22 | } |
---|
23 | else { |
---|
24 | $requirements['gd'] = array( |
---|
25 | 'value' => t('Not installed'), |
---|
26 | 'severity' => REQUIREMENT_ERROR, |
---|
27 | 'description' => t('The GD library for PHP is missing or outdated. Please check the <a href="@url">PHP image documentation</a> for information on how to correct this.', array('@url' => 'http://www.php.net/manual/en/ref.image.php')), |
---|
28 | ); |
---|
29 | } |
---|
30 | $requirements['gd']['title'] = t('GD library'); |
---|
31 | } |
---|
32 | |
---|
33 | return $requirements; |
---|
34 | } |
---|
35 | |
---|
36 | /** |
---|
37 | * Warn site administrator if unsafe CSS color codes are found in the database. |
---|
38 | */ |
---|
39 | function color_update_6001() { |
---|
40 | $ret = array(); |
---|
41 | $result = db_query("SELECT name FROM {variable} WHERE name LIKE 'color_%_palette'"); |
---|
42 | while ($variable = db_fetch_array($result)) { |
---|
43 | $palette = variable_get($variable['name'], array()); |
---|
44 | foreach ($palette as $key => $color) { |
---|
45 | if (!preg_match('/^#([a-f0-9]{3}){1,2}$/iD', $color)) { |
---|
46 | drupal_set_message('Some of the custom CSS color codes specified via the color module are invalid. Please examine the themes which are making use of the color module at the <a href="'. url('admin/appearance/settings') .'">Appearance settings</a> page to verify their CSS color values.', 'warning'); |
---|
47 | } |
---|
48 | } |
---|
49 | } |
---|
50 | return $ret; |
---|
51 | } |
---|