'.implode(', ', $plugins).'

'); } } // Check access rights function check_upgrade_access_rights($current_release, $username, $password) { global $conf, $page; if(!@get_magic_quotes_gpc()) { $username = pwg_db_real_escape_string($username); } if (version_compare($current_release, '2.0', '<')) { $username = utf8_decode($username); $password = utf8_decode($password); } if (version_compare($current_release, '1.5', '<')) { $query = ' SELECT password, status FROM '.USERS_TABLE.' WHERE username = "'.$username.'" ;'; } else { $query = ' SELECT u.password, ui.status FROM '.USERS_TABLE.' AS u INNER JOIN '.USER_INFOS_TABLE.' AS ui ON u.'.$conf['user_fields']['id'].'=ui.user_id WHERE '.$conf['user_fields']['username'].'="'.$username.'" ;'; } $row = pwg_db_fetch_assoc(pwg_query($query)); if (!isset($conf['pass_convert'])) { $conf['pass_convert'] = create_function('$s', 'return md5($s);'); } if ($row['password'] != $conf['pass_convert']($password)) { array_push($page['errors'], l10n('Invalid password!')); } elseif ($row['status'] != 'admin' and $row['status'] != 'webmaster') { array_push($page['errors'], l10n('You do not have access rights to run upgrade')); } else { define('PHPWG_IN_UPGRADE', true); } } /** * which upgrades are available ? * * @return array */ function get_available_upgrade_ids() { $upgrades_path = PHPWG_ROOT_PATH.'install/db'; $available_upgrade_ids = array(); if ($contents = opendir($upgrades_path)) { while (($node = readdir($contents)) !== false) { if (is_file($upgrades_path.'/'.$node) and preg_match('/^(.*?)-database\.php$/', $node, $match)) { array_push($available_upgrade_ids, $match[1]); } } } natcasesort($available_upgrade_ids); return $available_upgrade_ids; } /** * returns true if there are available upgrade files */ function check_upgrade_feed() { // retrieve already applied upgrades $query = ' SELECT id FROM '.UPGRADE_TABLE.' ;'; $applied = array_from_query($query, 'id'); // retrieve existing upgrades $existing = get_available_upgrade_ids(); // which upgrades need to be applied? return (count(array_diff($existing, $applied)) > 0); } function upgrade_db_connect() { global $conf; try { $pwg_db_link = pwg_db_connect($conf['db_host'], $conf['db_user'], $conf['db_password'], $conf['db_base']); if ($pwg_db_link) { pwg_db_check_version(); } } catch (Exception $e) { my_error(l10n($e->getMessage()), true); } } /** * Get languages defined in the language directory */ function get_fs_languages($target_charset = null) { if ( empty($target_charset) ) { $target_charset = get_pwg_charset(); } $target_charset = strtolower($target_charset); $dir = opendir(PHPWG_ROOT_PATH.'language'); while ($file = readdir($dir)) { $path = PHPWG_ROOT_PATH.'language/'.$file; if (!is_link($path) and is_dir($path) and file_exists($path.'/iso.txt')) { list($language_name) = @file($path.'/iso.txt'); $languages[$file] = convert_charset($language_name, $target_charset); } } closedir($dir); @asort($languages); return $languages; } ?>