function pwg_db_check_version()
{
    $current_mysql = pwg_get_db_version();
    if (version_compare($current_mysql, REQUIRED_MYSQL_VERSION, '<')) {
        fatal_error(sprintf('your MySQL version is too old, you have "%s" and you need at least "%s"', $current_mysql, REQUIRED_MYSQL_VERSION));
    }
}
 /**
  * Check version
  *
  * @param c13y object
  * @return void
  */
 function c13y_version($c13y)
 {
     global $conf;
     $check_list = array();
     $check_list[] = array('type' => 'PHP', 'current' => phpversion(), 'required' => REQUIRED_PHP_VERSION);
     $check_list[] = array('type' => 'MySQL', 'current' => pwg_get_db_version(), 'required' => REQUIRED_MYSQL_VERSION);
     foreach ($check_list as $elem) {
         if (version_compare($elem['current'], $elem['required'], '<')) {
             $c13y->add_anomaly(sprintf(l10n('The version of %s [%s] installed is not compatible with the version required [%s]'), $elem['type'], $elem['current'], $elem['required']), null, null, l10n('You need to upgrade your system to take full advantage of the application else the application will not work correctly, or not at all') . '<br>' . $c13y->get_htlm_links_more_info());
         }
     }
 }
Exemple #3
0
/**
 * Adds the caracter set to a create table sql query.
 * All CREATE TABLE queries must call this function
 *
 * @param string $query
 * @return string
 */
function create_table_add_character_set($query)
{
    defined('DB_CHARSET') or fatal_error('create_table_add_character_set DB_CHARSET undefined');
    if ('DB_CHARSET' != '') {
        if (version_compare(pwg_get_db_version(), '4.1.0', '<')) {
            return $query;
        }
        $charset_collate = " DEFAULT CHARACTER SET " . DB_CHARSET;
        if (DB_COLLATE != '') {
            $charset_collate .= " COLLATE " . DB_COLLATE;
        }
        if (is_array($query)) {
            foreach ($query as $id => $q) {
                $q = trim($q);
                $q = trim($q, ';');
                if (preg_match('/^CREATE\\s+TABLE/i', $q)) {
                    $q .= $charset_collate;
                }
                $q .= ';';
                $query[$id] = $q;
            }
        } else {
            $query = trim($query);
            $query = trim($query, ';');
            if (preg_match('/^CREATE\\s+TABLE/i', $query)) {
                $query .= $charset_collate;
            }
            $query .= ';';
        }
    }
    return $query;
}
Exemple #4
0
    }
} else {
    if (isset($_GET['action']) and 'phpinfo' == $_GET['action']) {
        phpinfo();
        exit;
    }
}
// +-----------------------------------------------------------------------+
// |                             template init                             |
// +-----------------------------------------------------------------------+
$template->set_filenames(array('intro' => 'intro.tpl'));
if ($conf['show_newsletter_subscription']) {
    $template->assign(array('EMAIL' => $user['email'], 'SUBSCRIBE_BASE_URL' => get_newsletter_subscribe_base_url($user['language'])));
}
$php_current_timestamp = date("Y-m-d H:i:s");
$db_version = pwg_get_db_version();
list($db_current_date) = pwg_db_fetch_row(pwg_query('SELECT now();'));
$query = '
SELECT COUNT(*)
  FROM ' . IMAGES_TABLE . '
;';
list($nb_elements) = pwg_db_fetch_row(pwg_query($query));
$query = '
SELECT COUNT(*)
  FROM ' . CATEGORIES_TABLE . '
;';
list($nb_categories) = pwg_db_fetch_row(pwg_query($query));
$query = '
SELECT COUNT(*)
  FROM ' . CATEGORIES_TABLE . '
  WHERE dir IS NULL