public function setUp() { parent::setUp(); USVN_Translation::initTranslation("en_US", "app/locale"); $data = array("users_id" => 2, "users_login" => 'testlogin', "users_password" => USVN_Crypt::crypt('testpassword'), "users_is_admin" => false); $this->db->insert("usvn_users", $data); }
public function setUp() { parent::setUp(); chdir($this->_path); chdir('www'); USVN_Translation::initTranslation('en_US', 'locale'); chmod("tools/usvn-import-htpasswd.php", 0700); }
public function setUp() { $params = array('host' => 'localhost', 'username' => 'usvn-test', 'password' => 'usvn-test', 'dbname' => 'usvn-test'); USVN_Translation::initTranslation('en_US', 'app/locale'); if (getenv('DB') != "PDO_MYSQL") { $this->markTestSkipped("Test only with PDO_MYSQL"); } $this->db = Zend_Db::factory('PDO_MYSQL', $params); Zend_Db_Table::setDefaultAdapter($this->db); USVN_Db_Utils::deleteAllTables($this->db); USVN_Db_Table::$prefix = "usvn_"; file_put_contents($this->testfile, "\n\t/*==============================================================*/\n\t/* Table: users */\n\t/*==============================================================*/\n\tcreate table usvn_users\n\t(\n\t users_id int not null,\n\t users_login varchar(255) not null,\n\t users_password varchar(44) not null,\n\t users_nom varchar(100),\n\t users_prenom varchar(100),\n\t users_email varchar(150),\n\t primary key (users_id)\n\t)\n\ttype = innodb;\n\n\t/*==============================================================*/\n\t/* Table: groups */\n\t/*==============================================================*/\n\tcreate table usvn_groups\n\t(\n\t groups_id int not null,\n\t groups_label varchar(100),\n\t groups_nom varchar(150),\n\t primary key (groups_id)\n\t)\n\ttype = innodb;\n\n\t/*==============================================================*/\n\t/* Table: to_belong */\n\t/*==============================================================*/\n\tcreate table usvn_to_belong\n\t(\n\t users_id int not null,\n\t groups_id int not null,\n\t primary key (users_id, groups_id)\n\t)\n\ttype = innodb;\n\n\t/*==============================================================*/\n\t/* Index: to_belong_fk */\n\t/*==============================================================*/\n\tcreate index to_belong_fk on usvn_to_belong\n\t(\n\t\tusers_id\n\t);\n\n\t/*==============================================================*/\n\t/* Index: to_belong2_fk */\n\t/*==============================================================*/\n\tcreate index to_belong2_fk on usvn_to_belong\n\t(\n\t\tgroups_id\n\t);\n\n\talter table usvn_to_belong add constraint fk_usvn_to_belong foreign key (users_id)\n\treferences usvn_users (users_id) on delete restrict on update restrict;\n\n\talter table usvn_to_belong add constraint fk_usvn_to_belong2 foreign key (groups_id)\n\treferences usvn_groups (groups_id) on delete restrict on update restrict;\n\t"); }
protected function setUp() { error_reporting(E_ALL | E_STRICT); date_default_timezone_set('UTC'); $this->_path = getcwd(); $this->setConsoleLocale(); USVN_Translation::initTranslation('en_US', 'app/locale'); USVN_DirectoryUtils::removeDirectory('tests/'); mkdir("tests"); mkdir("tests/tmp"); mkdir("tests/tmp/svn"); file_put_contents('tests/test.ini', '[general] subversion.path = "' . getcwd() . '/tests/tmp/" subversion.passwd = "' . getcwd() . '/tests/tmp/htpasswd" subversion.authz = "' . getcwd() . '/tests/tmp/authz" subversion.url = "http://localhost/" version = "0.8.4" translation.locale = "en_US" '); $config = new USVN_Config_Ini('tests/test.ini', 'general'); Zend_Registry::set('config', $config); }
public function test_translation() { USVN_Translation::initTranslation('fr_FR', 'app/locale'); $this->assertEquals("Bienvenue sur USVN", T_("Welcome to USVN"), "Translation error."); }
* @since 0.6.4 * @package tools * * This software has been written at EPITECH <http://www.epitech.net> * EPITECH, European Institute of Technology, Paris - FRANCE - * This project has been realised as part of * end of studies project. * * $Id$ */ defined('APPLICATION_PATH') || define('APPLICATION_PATH', realpath(dirname(__FILE__) . '/../../app')); require_once '../../app/bootstrap.php'; if (!isset($argv[2]) || isset($argv[3])) { echo "Usage: usvn-import-htpasswd.php config-file htpasswd-file\n"; exit(1); } $configfile = $argv[1]; $htpasswdfile = $argv[2]; try { $config = new USVN_Config_Ini($configfile, 'general'); USVN_Translation::initTranslation($config->translation->locale, APPLICATION_PATH . '/locale'); Zend_Db_Table::setDefaultAdapter(Zend_Db::factory($config->database->adapterName, $config->database->options->toArray())); Zend_Db_Table::getDefaultAdapter()->getProfiler()->setEnabled(true); USVN_Db_Table::$prefix = $config->database->prefix; Zend_Registry::set('config', $config); $import = new USVN_ImportHtpasswd($htpasswdfile); } catch (Exception $e) { echo $e->getMessage() . "\n"; exit(1); } exit(0);
} } break; } } /** * Initialize some configurations details */ try { $configFile = !empty($configFile) ? $configFile : 'config.ini'; $config = new USVN_Config_Ini($configFile, "general"); if ($options['verbose']) { print "Config file loaded: {$configFile}\n"; } Zend_Registry::set('config', $config); USVN_Translation::initTranslation($config->translation->locale, dirname(__FILE__) . "/../../app/locale"); date_default_timezone_set($config->timezone); $db = Zend_Db::factory($config->database->adapterName, $config->database->options->toArray()); USVN_Db_Table::$prefix = $config->database->prefix; Zend_Db_Table::setDefaultAdapter($db); Zend_Registry::set('config', $config); } catch (Exception $e) { echo $e->getMessage() . "\n"; exit(1); } /** * Look for SVN repositories to import into USVN and finally perform the action */ $svnImport = new USVN_ImportSVNRepositories(); foreach ($paths as $path) { $tmp = $svnImport->lookAfterSVNRepositoriesToImport($path, $options);
function installationOperation(&$step) { global $errors; $language = isset($_POST['language']) ? $_POST['language'] : $GLOBALS['language']; switch ($step) { case 1: $errors = Install::check(); break; case 2: $errors = Install::check(); Install::installUrl(USVN_CONFIG_FILE, USVN_HTACCESS_FILE, $_SERVER['REQUEST_URI'], $_SERVER['HTTP_HOST'], isset($_SERVER['HTTPS'])); break; case 3: Install::installLanguage(USVN_CONFIG_FILE, $language); Install::installTimezone(USVN_CONFIG_FILE, $_POST['timezone']); Install::installLocale(USVN_CONFIG_FILE); $GLOBALS['language'] = $_POST['language']; USVN_Translation::initTranslation($GLOBALS['language'], USVN_LOCALE_DIRECTORY); break; case 4: if ($_POST['agreement'] != 'ok') { throw new USVN_Exception(T_('You need to accept the licence to continue installation.')); } break; case 5: Install::installConfiguration(USVN_CONFIG_FILE, $_POST['title']); $import = Install::installSubversion(USVN_CONFIG_FILE, $_POST['pathSubversion'], $_POST['passwdFile'], $_POST['authzFile'], $_POST['urlSubversion'], $_FILES['configFile']); if ($import === true) { displayWarning(T_("A copy of the old SVN repository has been made, any modification done on the old one won't interact on the new one. You should disable the old repository access.")); $step = 7; } break; case 6: if (isset($_POST['createdb'])) { $createdb = true; } else { $createdb = false; } Install::installDb(USVN_CONFIG_FILE, USVN_APP_DIR . '/install/sql/', $_POST['host'], $_POST['user'], $_POST['password'], $_POST['database'], $_POST['prefix'], $_POST['adapter'], $createdb); break; case 7: Install::installAdmin(USVN_CONFIG_FILE, $_POST['login'], $_POST['password'], $_POST['firstname'], $_POST['lastname'], $_POST['email']); break; case 8: Install::installCheckForUpdate(USVN_CONFIG_FILE, $_POST['update']); Install::installEnd(USVN_CONFIG_FILE); $GLOBALS['apacheConfig'] = Install::getApacheConfig(USVN_CONFIG_FILE); break; } }
} } break; } } /** * Initialize some configurations details */ try { $configFile = !empty($configFile) ? $configFile : 'config.ini'; $config = new USVN_Config_Ini($configFile, "general"); if ($options['verbose']) { print "Config file loaded: {$configFile}\n"; } Zend_Registry::set('config', $config); USVN_Translation::initTranslation($config->translation->locale, "locale"); date_default_timezone_set($config->timezone); $db = Zend_Db::factory($config->database->adapterName, $config->database->options->toArray()); USVN_Db_Table::$prefix = $config->database->prefix; Zend_Db_Table::setDefaultAdapter($db); Zend_Registry::set('config', $config); } catch (Exception $e) { echo $e->getMessage() . "\n"; exit(1); } /** * Look for SVN repositories to import into USVN and finally perform the action */ $svnImport = new USVN_ImportSVNRepositories(); foreach ($paths as $path) { $tmp = $svnImport->lookAfterSVNRepositoriesToImport($path, $options);
} } foreach ($mandatory_options as $mandatory_option) { if (!array_key_exists($mandatory_option, $options) || empty($options[$mandatory_option])) { echo 'Error: "' . $mandatory_option . '" is a mandatory option, and it was not specified.' . "\n"; echo 'Aborting.' . "\n"; exit(1); } } try { if (!Install::installPossible(USVN_CONFIG_FILE)) { echo 'Error: USVN is already installed.' . "\n"; echo 'Aborting.' . "\n"; exit(1); } USVN_Translation::initTranslation($GLOBALS['language'], USVN_APP_DIR . '/locale'); $config = new USVN_Config_Ini($options['config-file'], USVN_CONFIG_SECTION); Zend_Registry::set('config', $config); /* * Those "echo"s are ugly, but anonymous functions are only available in PHP since versions >= 5.3.0 :( * It would have been nice to be able to do: * * installation_configure('site settings', function() * { * Install::installConfiguration(USVN_CONFIG_FILE, $config->site->title); * }); * installation_configure('subversion', function() * { * Install::installSubversion(USVN_CONFIG_FILE, $config->subversion->path, $config->subversion->passwd, $config->subversion->authz, $config->subversion->url); * }); *
exit(0); } if ($config->version != USVN_CONFIG_VERSION) { USVN_Update::runUpdate(); } } catch (Exception $e) { header('Location: install.php'); // echo '<pre>' . "\n"; // echo $e; // echo '</pre>' . "\n"; // exit(0); } /* USVN Configuration */ date_default_timezone_set($config->timezone); USVN_ConsoleUtils::setLocale($config->system->locale); USVN_Translation::initTranslation($config->translation->locale, USVN_LOCALE_DIR); USVN_Template::initTemplate($config->template->name, USVN_MEDIAS_DIR); /* Zend Configuration */ Zend_Registry::set('config', $config); Zend_Db_Table::setDefaultAdapter(Zend_Db::factory($config->database->adapterName, $config->database->options->toArray())); if (isset($config->database->prefix)) { USVN_Db_Table::$prefix = $config->database->prefix; } $front = Zend_Controller_Front::getInstance(); Zend_Layout::startMvc(array('layoutPath' => USVN_LAYOUTS_DIR)); $front->setRequest(new USVN_Controller_Request_Http()); $front->throwExceptions(true); $front->setBaseUrl($config->url->base); /* Initialize router */ $router = new Zend_Controller_Router_Rewrite(); $routes_config = new USVN_Config_Ini(USVN_ROUTES_CONFIG_FILE, USVN_CONFIG_SECTION);
* @copyright Copyright 2007, Team USVN * @since 0.6.4 * @package tools * * This software has been written at EPITECH <http://www.epitech.net> * EPITECH, European Institute of Technology, Paris - FRANCE - * This project has been realised as part of * end of studies project. * * $Id$ */ require_once 'USVN/autoload.php'; if (!isset($argv[2]) || isset($argv[3])) { echo "Usage: usvn-import-htpasswd.php config-file htpasswd-file\n"; exit(1); } $configfile = $argv[1]; $htpasswdfile = $argv[2]; try { USVN_Translation::initTranslation('en_US', 'locale'); $config = new USVN_Config_Ini($configfile, 'general'); Zend_Db_Table::setDefaultAdapter(Zend_Db::factory($config->database->adapterName, $config->database->options->toArray())); Zend_Db_Table::getDefaultAdapter()->getProfiler()->setEnabled(true); USVN_Db_Table::$prefix = $config->database->prefix; Zend_Registry::set('config', $config); $import = new USVN_ImportHtpasswd($htpasswdfile); } catch (Exception $e) { echo $e->getMessage() . "\n"; exit(1); } exit(0);