예제 #1
0
 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);
 }
예제 #2
0
 public function setUp()
 {
     parent::setUp();
     chdir($this->_path);
     chdir('www');
     USVN_Translation::initTranslation('en_US', 'locale');
     chmod("tools/usvn-import-htpasswd.php", 0700);
 }
예제 #3
0
파일: Config.php 프로젝트: phpscr/usvn
 /**
  * Set default language in the config file
  *
  * @param string The default language
  * @throw USVN_Exception
  */
 public static function setLanguage($language)
 {
     if (in_array($language, USVN_Translation::listTranslation())) {
         $config = new USVN_Config_Ini(USVN_CONFIG_FILE, USVN_CONFIG_SECTION);
         $config->translation->locale = $language;
         $config->save();
     } else {
         throw new USVN_Exception(T_("Invalid language"));
     }
 }
예제 #4
0
파일: Translation.php 프로젝트: phpscr/usvn
 /**
  * Return available translations
  * @todo check if it is a valid translation directory
  *
  * @return array
  */
 public static function listTranslation()
 {
     $res = array();
     $list = USVN_DirectoryUtils::listDirectory(USVN_Translation::$locale_directory);
     foreach ($list as $filename) {
         if (USVN_Translation::isValidLanguageDirectory(USVN_Translation::$locale_directory . '/' . $filename)) {
             $res[] = $filename;
         }
     }
     return $res;
 }
예제 #5
0
 public function indexAction()
 {
     $this->view->config = Zend_Registry::get("config");
     if ($this->view->config->ldap == null) {
         $this->view->config->ldap = array();
     }
     if ($this->view->config->ldap->options == null) {
         $this->view->config->ldap->options = array();
     }
     $this->view->locale = new Zend_Locale(USVN_Translation::getLanguage());
     $this->render("index");
 }
예제 #6
0
파일: UtilsTest.php 프로젝트: phpscr/usvn
 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");
 }
예제 #7
0
파일: Test.php 프로젝트: phpscr/usvn
    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);
    }
예제 #8
0
 public function test_isValidLanguageDirectory()
 {
     $this->assertTrue(USVN_Translation::isValidLanguageDirectory('app/locale/fr_FR'));
     $this->assertTrue(USVN_Translation::isValidLanguageDirectory('app/locale/en_US'));
     $this->assertFalse(USVN_Translation::isValidLanguageDirectory('app/locale/.svn'));
 }
예제 #9
0
 * @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);
예제 #10
0
파일: install.php 프로젝트: jiangti/usvn
 /**
  * This method will  write the choosen language into config file.
  *
  * Throw an exception in case of problems.
  *
  * @param string Path to the USVN config file
  * @param string Language
  * @throw USVN_Exception
  */
 public static function installLanguage($config_file, $language)
 {
     if (in_array($language, USVN_Translation::listTranslation())) {
         $config = Install::_loadConfig($config_file);
         $config->translation = array('locale' => $language);
         $config->save();
     } else {
         throw new USVN_Exception(T_('Invalid language'));
     }
 }
예제 #11
0
 * @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);
예제 #12
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);
예제 #13
0
파일: bootstrap.php 프로젝트: royalrex/usvn
        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);
예제 #14
0
파일: functions.php 프로젝트: phpscr/usvn
function T_($str)
{
    return USVN_Translation::_($str);
}
예제 #15
0
파일: index.php 프로젝트: jiangti/usvn
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;
    }
}
예제 #16
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, "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);
예제 #17
0
파일: install-cli.php 프로젝트: phpscr/usvn
    }
}
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);
     * });
     *