public function __construct($title, CSRFSynchronizerToken $csrf, array $list_of_gerrits)
 {
     parent::__construct($title, $csrf);
     $this->list_of_servers = $list_of_gerrits;
     $this->can_use_gerrit_2_8 = server_is_php_version_equal_or_greater_than_53();
     $this->btn_submit = $GLOBALS['Language']->getText('global', 'btn_submit');
 }
Пример #2
0
 public function index()
 {
     if (!server_is_php_version_equal_or_greater_than_53()) {
         return $this->showPHP51Home();
     } else {
         return $this->showPHP53Home();
     }
 }
 public static function getPasswordHandler()
 {
     if (server_is_php_version_equal_or_greater_than_53()) {
         return new StandardPasswordHandler();
     } else {
         return new WeakPasswordHandler();
     }
 }
Пример #4
0
 /**
  * Builds the Gerrit Driver regarding the gerrit server version
  *
  * @param Git_RemoteServer_GerritServer $server The gerrit server
  *
  * @return Git_Driver_Gerrit
  */
 public function getDriver(Git_RemoteServer_GerritServer $server)
 {
     include_once 'server.php';
     if (server_is_php_version_equal_or_greater_than_53() && $server->getGerritVersion() === Git_RemoteServer_GerritServer::GERRIT_VERSION_2_8_PLUS) {
         include_once '/usr/share/php-guzzle/guzzle.phar';
         $class = 'Guzzle\\Http\\Client';
         return new Git_Driver_GerritREST(new $class(), $this->logger);
     }
     return new Git_Driver_GerritLegacy(new Git_Driver_Gerrit_RemoteSSHCommand($this->logger), $this->logger);
 }
Пример #5
0
//exit_error library
require_once 'exit.php';
//various html libs like button bar, themable
require_once 'html.php';
//left-hand nav library, themable
require_once 'menu.php';
//insert this page view into the database
if (!IS_SCRIPT) {
    require_once 'logger.php';
}
/*

	Timezone must come after logger to prevent messups
*/
if ($current_user->isLoggedIn()) {
    if (server_is_php_version_equal_or_greater_than_53() == true) {
        date_default_timezone_set($current_user->getTimezone());
    } else {
        putenv('TZ=' . $current_user->getTimezone());
    }
    if (!$cookie_manager->isCookie(CookieManager::USER_TOKEN)) {
        $user_manager->setUserTokenCookie($current_user);
    }
    if (!$cookie_manager->isCookie(CookieManager::USER_ID)) {
        $user_manager->setUserIdCookie($current_user);
    }
}
$theme_manager = new ThemeManager();
$HTML = $theme_manager->getTheme($current_user);
// If the Software license was declined by the site admin
// so stop all accesses to the site. Use exlicit path to avoid
Пример #6
0
 /**
  * Check if PHP version support HttpOnly option.
  *
  * HttpOnly is an additional flag included in Cookie.
  * Using the HttpOnly flag when generating a cookie helps mitigate the risk of client side script accessing the protected cookie.
  */
 private function isPhpHttpOnlyCompatible()
 {
     return server_is_php_version_equal_or_greater_than_53();
 }
Пример #7
0
 /**
  * Takes a string and tries to convert all special characters to UTF-8.
  * Any characters that are not recognised will be removed from the string.
  *
  * This is done since for php >= 5.2 the method preg_replace_callback() cannot process non-utf-8 strings.
  *
  * Note: We need to know if the version is greater than 5.3.0 since the htmlentities()
  * parameter ENT_IGNORE only exists for php > 5.3.0
  */
 private function convertToUTF8($string)
 {
     if (!server_is_php_version_equal_or_greater_than_53()) {
         return $string;
     }
     $encoding = mb_detect_encoding($string, implode(',', $this->php_supported_encoding_types));
     $string = htmlentities($string, ENT_IGNORE, $encoding);
     return html_entity_decode($string, ENT_IGNORE, 'UTF-8');
 }