Hi Robin

Sorry for not answering your mail.
I think storing the config in the session is the easiest way.
Go ahead and commit your path to the trunk.

~Thomas

On Thu, Apr 17, 2008 at 09:49, Robin Elfrink <[EMAIL PROTECTED]> wrote:
> Thomas Bruederli wrote:
>
>
>>> Can we not add a download-option to the installer, for main.inc.php and
>>> db.inc.php?
>>
>> Actually a good idea. The config is built out of the POST vars from the
>> installer form. We need to temporarily save this data in order to
>> correctly build the config files when downloading them.
>>
>> This needs some more code but your patch is good to start with.
>
> How's this (attached)? Works for me.
>
>
> Robin
>
> Index: installer/config.php
> ===================================================================
> --- installer/config.php        (revision 1321)
> +++ installer/config.php        (working copy)
> @@ -28,10 +28,10 @@
>
>   $textbox = new html_textarea(array('rows' => 16, 'cols' => 60, 'class' => 
> "configfile"));
>
> -  echo '<div><em>main.inc.php</em></div>';
> +  echo '<div><em>main.inc.php (<a 
> href="index.php?_getfile=main">download</a>)</em></div>';
>   echo $textbox->show($RCI->create_config('main'));
>
> -  echo '<div style="margin-top:1em"><em>db.inc.php</em></div>';
> +  echo '<div style="margin-top:1em"><em>db.inc.php (<a 
> href="index.php?_getfile=db">download</a>)</em></div>';
>   echo $textbox->show($RCI->create_config('db'));
>
>   echo '<p class="hint">Of course there are more options to configure.
> Index: installer/rcube_install.php
> ===================================================================
> --- installer/rcube_install.php (revision 1321)
> +++ installer/rcube_install.php (working copy)
> @@ -173,9 +173,21 @@
>         "'\\1 = ' . var_export(\$value, true) . ';'",
>         $out);
>     }
> -
> +
> +    $_SESSION[$which.'.inc.php'] = $out;
>     return trim($out);
>   }
> +
> +
> +  /**
> +   * Get config as created in create_config()
> +   *
> +   * @return string The complete config file content
> +   */
> +  function get_config($which)
> +  {
> +    return (isset($_SESSION[$which.'.inc.php']) ? 
> $_SESSION[$which.'.inc.php'] : $this->create_config($which));
> +  }
>
>
>   /**
> Index: installer/index.php
> ===================================================================
> --- installer/index.php (revision 1321)
> +++ installer/index.php (working copy)
> @@ -23,6 +23,16 @@
>   include_once $filename. '.php';
>  }
>
> +$RCI = rcube_install::get_instance();
> +$RCI->load_config();
> +
> +if (!empty($_GET['_getfile']) && preg_match('/^(main|db)$/', 
> $_GET['_getfile'])) {
> +       header('Content-type: text/plain');
> +       header('Content-Disposition: attachment; 
> filename="'.$_GET['_getfile'].'.inc.php');
> +       echo $RCI->get_config($_GET['_getfile']);
> +       exit;
> +}
> +
>  ?>
>  <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
>        "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd";>
> @@ -50,9 +60,6 @@
>
>  <?php
>
> -  $RCI = rcube_install::get_instance();
> -  $RCI->load_config();
> -
>   // exit if installation is complete
>   if ($RCI->configured && !$RCI->getprop('enable_installer') && 
> !$_SESSION['allowinstaller']) {
>     // header("HTTP/1.0 404 Not Found");
>
>
_______________________________________________
List info: http://lists.roundcube.net/dev/

Reply via email to