#!/usr/bin/php /dev/null',$out,$returncode); if(isset($out[0]) && stristr($out[0],$appname) && $returncode == 0) { return true; } else { return false; } } echo "\n\n".str_repeat('-',80)."\n"; echo " _____ ___________ _____ __ _ |_ _/ ___| ___ \ / __ \ / _(_) | | \ `--.| |_/ / | / \/ ___ _ __ | |_ _ __ _ | | `--. \ __/ | | / _ \| '_ \| _| |/ _` | _| |_/\__/ / | | \__/\ (_) | | | | | | | (_| | \___/\____/\_| \____/\___/|_| |_|_| |_|\__, | __/ | |___/ "; echo "\n".str_repeat('-',80)."\n"; echo "\n\n>> Patch tool \n\n"; echo "Please enter the patch id that you want to be applied to your ISPConfig installation.\nPlease be aware that we take NO responsibility that this will work for you.\nOnly use patches if you know what you are doing.\n\n"; if(!is_installed('patch')) { swriteln("The program 'patch' is missing on your server. Please install it and try again."); } $patch_id = simple_query('Enter patch id', false, ''); if($patch_id == '') { swriteln("Patch terminated by user.\n"); die(); } elseif(preg_match('/^[a-zA-Z0-9_\-]+$/', $patch_id) == false) { swriteln("Invalid patch id.\n"); die(); } $patch_data = @file_get_contents('http://ispconfig.org/downloads/patches/' . $patch_id . '.diff'); if(!$patch_data) { swriteln("Patch with id " . $patch_id . " does not exist.\n"); die(); } $patch_text = @file_get_contents('http://ispconfig.org/downloads/patches/' . $patch_id . '.txt'); if($patch_text) { $ok = simple_query("Patch description:\n".str_repeat("-", 80)."\n".$patch_text."\n".str_repeat("-", 80)."\nDo you really want to apply this patch now?", array('y','n'), 'y'); if($ok != 'y') { swriteln("Patch terminated by user.\n"); die(); } } $temp_file = tempnam(sys_get_temp_dir(), 'ispc'); file_put_contents($temp_file, $patch_data); chdir('/usr/local/ispconfig'); passthru('patch -p0 < ' . escapeshellarg($temp_file)); unlink($temp_file); exit; ?>