Aleksander Machniak
2016-02-05 bd0551b22076b82a6d49e9f7a2b2e0c90a1b2326
program/include/rcmail_install.php
@@ -1,6 +1,6 @@
<?php
/*
/**
 +-----------------------------------------------------------------------+
 | rcmail_install.php                                                    |
 |                                                                       |
@@ -13,13 +13,12 @@
 +-----------------------------------------------------------------------+
*/
/**
 * Class to control the installation process of the Roundcube Webmail package
 *
 * @category Install
 * @package  Roundcube
 * @author Thomas Bruederli
 * @author   Thomas Bruederli
 */
class rcmail_install
{
@@ -163,7 +162,7 @@
    $value = $this->config[$name];
    if ($name == 'des_key' && !$this->configured && !isset($_REQUEST["_$name"]))
      $value = self::random_key(24);
      $value = rcube_utils::random_bytes(24);
    return $value !== null && $value !== '' ? $value : $default;
  }
@@ -193,7 +192,7 @@
      // generate new encryption key, never use the default value
      if ($prop == 'des_key' && $value == $this->defaults[$prop])
        $value = $this->random_key(24);
        $value = rcube_utils::random_bytes(24);
      // convert some form data
      if ($prop == 'debug_level' && !$is_default) {
@@ -523,7 +522,7 @@
    foreach ($default_hosts as $key => $name) {
      if (!empty($name))
        $out[] = rcube_parse_host(is_numeric($key) ? $name : $key);
        $out[] = rcube_utils::parse_host(is_numeric($key) ? $name : $key);
    }
    return $out;
@@ -602,7 +601,7 @@
   */
  function pass($name, $message = '')
  {
    echo Q($name) . ':&nbsp; <span class="success">OK</span>';
    echo rcube::Q($name) . ':&nbsp; <span class="success">OK</span>';
    $this->_showhint($message);
  }
@@ -621,7 +620,7 @@
      $this->failures++;
    }
    echo Q($name) . ':&nbsp; <span class="fail">NOT OK</span>';
    echo rcube::Q($name) . ':&nbsp; <span class="fail">NOT OK</span>';
    $this->_showhint($message, $url);
  }
@@ -635,7 +634,7 @@
   */
  function optfail($name, $message = '', $url = '')
  {
    echo Q($name) . ':&nbsp; <span class="na">NOT OK</span>';
    echo rcube::Q($name) . ':&nbsp; <span class="na">NOT OK</span>';
    $this->_showhint($message, $url);
  }
@@ -649,17 +648,17 @@
   */
  function na($name, $message = '', $url = '')
  {
    echo Q($name) . ':&nbsp; <span class="na">NOT AVAILABLE</span>';
    echo rcube::Q($name) . ':&nbsp; <span class="na">NOT AVAILABLE</span>';
    $this->_showhint($message, $url);
  }
  function _showhint($message, $url = '')
  {
    $hint = Q($message);
    $hint = rcube::Q($message);
    if ($url)
      $hint .= ($hint ? '; ' : '') . 'See <a href="' . Q($url) . '" target="_blank">' . Q($url) . '</a>';
      $hint .= ($hint ? '; ' : '') . 'See <a href="' . rcube::Q($url) . '" target="_blank">' . rcube::Q($url) . '</a>';
    if ($hint)
      echo '<span class="indent">(' . $hint . ')</span>';
@@ -785,25 +784,4 @@
  {
      $this->last_error = $p;
  }
  /**
   * Generarte a ramdom string to be used as encryption key
   *
   * @param int Key length
   * @return string The generated random string
   * @static
   */
  function random_key($length)
  {
    $alpha = 'ABCDEFGHIJKLMNOPQERSTUVXYZabcdefghijklmnopqrtsuvwxyz0123456789+*%&?!$-_=';
    $out = '';
    for ($i=0; $i < $length; $i++)
      $out .= $alpha{rand(0, strlen($alpha)-1)};
    return $out;
  }
}