function test_guess_uri() { $_SERVER['HTTP_HOST'] = 'example.org'; $_SERVER['SCRIPT_NAME'] = '/install.php'; $this->assertEquals('http://example.org/', guess_uri()); $_SERVER['SCRIPT_NAME'] = '/glotpress/install.php'; $this->assertEquals('http://example.org/glotpress/', guess_uri()); }
function gp_install() { global $gpdb; $errors = gp_upgrade_db(); if ($errors) { return $errors; } gp_update_option('uri', guess_uri()); }
function gp_install() { global $gpdb; $errors = gp_upgrade_db(); if ($errors) { return $errors; } gp_update_option('uri', guess_uri()); $gpdb->insert($gpdb->projects, array('name' => 'Sample', 'slug' => 'sample', 'description' => 'A Sample Project', 'path' => 'sample')); $gpdb->insert($gpdb->originals, array('project_id' => 1, 'singular' => 'GlotPress FTW', 'comment' => 'FTW means For The Win', 'context' => 'dashboard', 'references' => 'bigfile:666 little-dir/small-file.php:71')); $gpdb->insert($gpdb->originals, array('project_id' => 1, 'singular' => 'A GlotPress', 'plural' => 'Many GlotPresses')); $gpdb->insert($gpdb->translation_sets, array('name' => 'My Translation', 'slug' => 'my', 'project_id' => 1, 'locale' => 'bg')); // TODO: ask the user for an e-mail -- borrow WordPress install process if (!defined('CUSTOM_USER_TABLE')) { $admin = GP::$user->create(array('user_login' => 'admin', 'user_pass' => 'a', 'user_email' => '*****@*****.**')); GP::$permission->create(array('user_id' => $admin->id, 'action' => 'admin')); } // TODO: ask the user to choose an admin user if using custom table return array(); }
function gp_url_base_root() { $url_from_db = gp_get_option('url'); return gp_const_get('GP_BASE_URL', $url_from_db ? $url_from_db : guess_uri()); }