| 1 | <?php | 
|---|
| 2 | # -- BEGIN LICENSE BLOCK --------------------------------------- | 
|---|
| 3 | # | 
|---|
| 4 | # This file is part of Dotclear 2. | 
|---|
| 5 | # | 
|---|
| 6 | # Copyright (c) 2003-2013 Olivier Meunier & Association Dotclear | 
|---|
| 7 | # Licensed under the GPL version 2.0 license. | 
|---|
| 8 | # See LICENSE file or | 
|---|
| 9 | # http://www.gnu.org/licenses/old-licenses/gpl-2.0.html | 
|---|
| 10 | # | 
|---|
| 11 | # -- END LICENSE BLOCK ----------------------------------------- | 
|---|
| 12 | if (!defined('DC_RC_PATH')) { return; } | 
|---|
| 13 |  | 
|---|
| 14 | function dcSystemCheck($con,&$err) | 
|---|
| 15 | { | 
|---|
| 16 | $err = array(); | 
|---|
| 17 |  | 
|---|
| 18 | if (version_compare(phpversion(),'5.0','<')) { | 
|---|
| 19 | $err[] = sprintf(__('PHP version is %s (5.0 or earlier needed).'),phpversion()); | 
|---|
| 20 | } | 
|---|
| 21 |  | 
|---|
| 22 | if (!function_exists('mb_detect_encoding')) { | 
|---|
| 23 | $err[] = __('Multibyte string module (mbstring) is not available.'); | 
|---|
| 24 | } | 
|---|
| 25 |  | 
|---|
| 26 | if (!function_exists('iconv')) { | 
|---|
| 27 | $err[] = __('Iconv module is not available.'); | 
|---|
| 28 | } | 
|---|
| 29 |  | 
|---|
| 30 | if (!function_exists('ob_start')) { | 
|---|
| 31 | $err[] = __('Output control functions are not available.'); | 
|---|
| 32 | } | 
|---|
| 33 |  | 
|---|
| 34 | if (!function_exists('simplexml_load_string')) { | 
|---|
| 35 | $err[] = __('SimpleXML module is not available.'); | 
|---|
| 36 | } | 
|---|
| 37 |  | 
|---|
| 38 | if (!function_exists('dom_import_simplexml')) { | 
|---|
| 39 | $err[] = __('DOM XML module is not available.'); | 
|---|
| 40 | } | 
|---|
| 41 |  | 
|---|
| 42 | $pcre_str = base64_decode('w6nDqMOgw6o='); | 
|---|
| 43 | if (!@preg_match('/'.$pcre_str.'/u', $pcre_str)) { | 
|---|
| 44 | $err[] = __('PCRE engine does not support UTF-8 strings.'); | 
|---|
| 45 | } | 
|---|
| 46 |  | 
|---|
| 47 | if (!function_exists("spl_classes")) { | 
|---|
| 48 | $err[] = __('SPL module is not available.'); | 
|---|
| 49 | } | 
|---|
| 50 |  | 
|---|
| 51 | if ($con->driver() == 'mysql' || $con->driver() == 'mysqli') | 
|---|
| 52 | { | 
|---|
| 53 | if (version_compare($con->version(),'4.1','<')) | 
|---|
| 54 | { | 
|---|
| 55 | $err[] = sprintf(__('MySQL version is %s (4.1 or earlier needed).'),$con->version()); | 
|---|
| 56 | } | 
|---|
| 57 | else | 
|---|
| 58 | { | 
|---|
| 59 | $rs = $con->select('SHOW ENGINES'); | 
|---|
| 60 | $innodb = false; | 
|---|
| 61 | while ($rs->fetch()) { | 
|---|
| 62 | if (strtolower($rs->f(0)) == 'innodb' && strtolower($rs->f(1)) != 'disabled' && strtolower($rs->f(1)) != 'no') { | 
|---|
| 63 | $innodb = true; | 
|---|
| 64 | break; | 
|---|
| 65 | } | 
|---|
| 66 | } | 
|---|
| 67 |  | 
|---|
| 68 | if (!$innodb) { | 
|---|
| 69 | $err[] = __('MySQL InnoDB engine is not available.'); | 
|---|
| 70 | } | 
|---|
| 71 | } | 
|---|
| 72 | } | 
|---|
| 73 | elseif ($con->driver() == 'pgsql') | 
|---|
| 74 | { | 
|---|
| 75 | if (version_compare($con->version(),'8.0','<')) | 
|---|
| 76 | { | 
|---|
| 77 | $err[] = sprintf(__('PostgreSQL version is %s (8.0 or earlier needed).'),$con->version()); | 
|---|
| 78 | } | 
|---|
| 79 | } | 
|---|
| 80 |  | 
|---|
| 81 | return count($err) == 0; | 
|---|
| 82 | } | 
|---|