Das Script index.php liegt in /srv/www/htdocs/webmail/myplugins/installer/. Dann müsste doch ../../roundcube_bug_fixes auf /srv/www/htdocs/webmail/myplugins/roundcube_bug_fixes zeigen, oder?
Vielleicht liegt es an den Back-Slashes. Ich habe die Pfade nun mit normalen Slashes und absoluten Pfaden definiert (unten).
Ansonsten ändere bitte die Pfadangaben so, dass es bei Dir läuft und gib dann Bescheid.
<?php
/* RoundCube Plugin API Installer (c) rosali
ABSOLUTELY NO WARRANTY !!! USE AT YOUR OWN RISK !!!
Make a copy of existing RoundCube Installation
before running this script !!!
If you do not need this script anymore, remove it !!!
*/
// extend execution time for slow servers
ini_set('max_execution_time', '300');
// include config file
@include ("config.php");
// functions
function absolute_path($extend=", $backward=0){
$path = $_SERVER["DOCUMENT_ROOT] . $_SERVER["PHP_SELF"];
if($backward == 0){
return $path .'/'. $extend;
}
else{
$split = explode("/", $path);
$new_path = "";
for($i=0;$i<count($split)-$backward;$i++){
$new_path .= $split[$i].'/';
}
return $new_path.$extend;
}
}
function pre_check($pluginfolder,$rootfolder){
global $api_installer;
if(!isset($api_installer['password']) || $api_installer['password'] == ""){
echo "Please open './myplugins/installer/config.php' and define a secure password to access this script !!! \n";
echo "<hr />\n\n";
return false;
}
if(!file_exists($rootfolder . "config/main.inc.php")){
echo "ERROR: Can't detect '" . $rootfolder . "config/main.inc.php'\n";
return false;
}
if(is_dir($pluginfolder . "roundcube_bug_fixes")){
echo "Pre-Check Bug Fixes ... \n";
echo "<hr />\n\n";
$ret = dircopy ($pluginfolder . "roundcube_bug_fixes",$rootfolder, false, true);
if($ret===0){
if(is_dir($pluginfolder . "roundcube_patches")){
echo "Pre-Check Patches ... \n";
echo "<hr />\n\n";
$ret = dircopy ($pluginfolder . "roundcube_patches",$rootfolder, false, true);
return $ret;
}
else{
echo "ERROR: Can't detect '" . $pluginfolder . "roundcube_patches'\n";
return false;
}
}
}
else{
echo "ERROR: Can't detect '" . $pluginfolder . "roundcube_bug_fixes'\n";
return false;
}
}
function dircopy($srcdir, $dstdir, $verbose=false,$precheck=false) {
$num = 0;
if(!is_dir($dstdir)) mkdir($dstdir);
if($curdir = opendir($srcdir)) {
while($file = readdir($curdir)) {
if($file != '.' && $file != '..') {
$srcfile = str_replace("//","/",$srcdir . '/' . $file);
$dstfile = str_replace("//","/",$dstdir . '/' . $file);
if(is_file($srcfile)) {
if(is_file($dstfile)) $ow = filemtime($srcfile) - filemtime($dstfile); else $ow = 1;
if($ow >= 0 || isset($_GET['_noprotection'])) {
if($verbose) echo "Copying '$srcfile'\n\tto \n\t'$dstfile'...\n";
if($precheck==false){
$result = copy($srcfile, $dstfile);
if($result){
touch($srcfile, filemtime($dstfile));
touch($dstfile, filemtime($srcfile));
$num++;
if($verbose) echo "OK\n\n";
}
else{
echo "Error:\tFile '$srcfile' could not be copied!\n\n";
}
}
}
else{
echo sprintf("Error:\tFile '$dstfile' is newer (%f days) than \n\t'$srcfile'\n\t-> overwrite protection!\n\n",$ow/60/60/12*-1);
echo "<hr />\n";
$_SESSION['overwrite'] = TRUE;
return false;
}
}
else if(is_dir($srcfile)) {
$num += dircopy($srcfile, $dstfile, $verbose,$precheck);
}
}
}
closedir($curdir);
}
return $num;
}
// Main
session_start();
echo "<pre>";
echo "Rouncube Plugin API Installer © roland-liebl.de\n";
echo "<hr />\n\n";
echo "
ABSOLUTELY NO WARRANTY !!! USE AT YOUR OWN RISK !!!
Make a copy of existing RoundCube Installation
before running this script !!!\n\n";
echo "<hr />\n\n";
$pluginfolder = absolute_path("",2);
$rootfolder = absolute_path("",3);
echo "Source Folder: " . $pluginfolder . "\n";
echo "Destination Folder: " . $rootfolder . "\n";
echo "<hr />\n";
if(!isset($_GET['_noprotection'])){
$ret = pre_check($pluginfolder,$rootfolder);
}
else{
$ret = 0;
}
if($ret === 0){
if(!isset($_POST['password']) || trim($_POST['password']) != $api_installer['password']){
if(isset($_SESSION['overwrite']) && !isset($_GET['_noprotection'])){
echo "Either you have modified files which have to be patched yourself or you run a RoundCube SVN release highter than revision 1589.\n";
echo "Please try again on a clean SVN install (revision 1589) or ask for an update 'mailto:roundcube@liebl.ath.cx'.\n\n";
echo "It is not recommended to proceed by installation without overwrite protection ! Click <a href=\"index.php?_noprotection\">here</a> to install without overwrite protection.\n";
}
else{
if(isset($_SESSION['overwrite'])){
echo "CAUTION: If you proceed, you are going to replace newer by older Files !!!\n\n";
}
echo "<form method=\"post\" action=\"index.php?" . $_SERVER['QUERY_STRING'] . "\">Enter Password <input name=\"password\"> <input type=\"submit\" value=\"Start Installation\"></form>\n";
unset($_SESSION['overwrite']);
}
echo "<hr />\n";
exit;
}
if(is_dir($pluginfolder . "roundcube_bug_fixes")){
echo "Applying Bug Fixes ... \n";
echo "<hr>\n\n";
$ret = dircopy ($pluginfolder . "roundcube_bug_fixes",$rootfolder, false);
echo "--> " . $ret . " files successfully copied\n";
echo "<hr />\n\n";
}
if(is_dir($pluginfolder . "roundcube_patches")){
echo "Applying Patches ... \n";
echo "<hr />\n\n";
$ret = dircopy ($pluginfolder . "roundcube_patches",$rootfolder, false);
echo "--> " . $ret . " files successfully copied\n";
echo "<hr />\n\n";
}
$content = @file_get_contents($rootfolder . "config/main.inc.php");
if($content){
if(!stripos($content,"./myplugins/config/plugins.inc")){
$content = str_replace("?>","\r\n//Find me: API: Bind API\r\n" . '@include "./myplugins/config/plugins.inc";' . "\r\n" . '?>',$content);
if(@file_put_contents($rootfolder . "config/main.inc.php",$content)){
echo "Plugin API successfully binded\n";
}
else{
echo "ERROR: Failed to bind Plugin API\n";
echo "<hr />\n\n";
exit;
}
}
else{
echo "WARNING: './config/main.inc.php' already includes API !\n";
echo " Do not care if you ran this installer script before !\n";
}
}
else{
echo "ERROR: Failed to bind Plugin API\n";
echo "<hr />\n\n";
exit;
}
}
else{
echo "Pre-Check failed !!! Abort !!!\n";
echo "<hr />\n\n";
exit;
}
echo "<hr />\n\n";
echo "#1- Please configure now './myplugins/config/config_plugins.php.dist' and rename the file to 'config_plugins.php'.\n\n";
echo "#2- Please configure then each './myplugins/collection/p_l_u_g_i_n__n_a_m_e/config.inc.dist' and rename the file to 'config.inc'.\n\n";
echo "<hr />\n\n";
echo "DONE !!! </pre>";
echo "<hr />\n\n";
unset($_SESSION['overwrite']);
?>