コード例 #1
0
ファイル: install.lib.php プロジェクト: nioc/ampache
/**
 * install_create_account
 * this creates your initial account and sets up the preferences for the -1 user and you
 */
function install_create_account($username, $password, $password2)
{
    if (!strlen($username) or !strlen($password)) {
        Error::add('general', T_('No Username/Password specified'));
        return false;
    }
    if ($password !== $password2) {
        Error::add('general', T_('Passwords do not match'));
        return false;
    }
    if (!Dba::check_database()) {
        Error::add('general', sprintf(T_('Database connection failed: %s'), Dba::error()));
        return false;
    }
    if (!Dba::check_database_inserted()) {
        Error::add('general', sprintf(T_('Database select failed: %s'), Dba::error()));
        return false;
    }
    $username = Dba::escape($username);
    $password = Dba::escape($password);
    $insert_id = User::create($username, 'Administrator', '', '', $password, '100');
    if (!$insert_id) {
        Error::add('general', sprintf(T_('Administrative user creation failed: %s'), Dba::error()));
        return false;
    }
    // Fix the system users preferences
    User::fix_preferences('-1');
    return true;
}
コード例 #2
0
ファイル: show_test_table.inc.php プロジェクト: bl00m/ampache
    ?>
    </td>
    <td>
    <?php 
    echo T_("This test makes sure that you have set all of the required configuration variables and that we are able to completely parse your config file.");
    ?>
    </td>
</tr>
<tr>
    <td valign="top"><?php 
    echo T_("Database connection");
    ?>
</td>
    <td valign="top">
    <?php 
    echo debug_result(check_php_pdo() && Dba::check_database());
    ?>
    </td>
    <td>
    <?php 
    echo T_('This attempts to connect to your database using the values read from your configuration file.');
    ?>
    </td>
</tr>
<tr>
    <td valign="top"><?php 
    echo T_('Database tables');
    ?>
</td>
    <td valign="top">
    <?php 
コード例 #3
0
ファイル: install.php プロジェクト: cheese1/ampache
if (!$skip_admin) {
    AmpConfig::set_by_array(array('database_username' => $username, 'database_password' => $password), true);
}
if (isset($_REQUEST['transcode_template'])) {
    $mode = $_REQUEST['transcode_template'];
    install_config_transcode_mode($mode);
}
if (isset($_REQUEST['usecase'])) {
    $case = $_REQUEST['usecase'];
    if (Dba::check_database()) {
        install_config_use_case($case);
    }
}
if (isset($_REQUEST['backends'])) {
    $backends = $_REQUEST['backends'];
    if (Dba::check_database()) {
        install_config_backends($backends);
    }
}
// Charset and gettext setup
$htmllang = $_REQUEST['htmllang'];
$charset = $_REQUEST['charset'];
if (!$htmllang) {
    if ($_ENV['LANG']) {
        $lang = $_ENV['LANG'];
    } else {
        $lang = 'en_US';
    }
    if (strpos($lang, '.')) {
        $langtmp = explode('.', $lang);
        $htmllang = $langtmp[0];