Ejemplo n.º 1
0
                $exp_name = urlencode($exp_name."-config.ovpn");
                $expformat = "inline";
                break;
            case "confinlinedroid":
                $exp_name = urlencode($exp_name."-android-config.ovpn");
                $expformat = "inlinedroid";
                break;
            case "confinlineios":
                $exp_name = urlencode($exp_name."-ios-config.ovpn");
                $expformat = "inlineios";
                break;
            default:
                $exp_name = urlencode($exp_name."-config.ovpn");
                $expformat = "baseconf";
        }
        $exp_path = openvpn_client_export_config($srvid, $usrid, $crtid, $useaddr, $verifyservercn, $randomlocalport, $usetoken, $nokeys, $proxy, $expformat, $password, false, false, $openvpnmanager, $advancedoptions);
    }

    if ($act == "visc") {
        $exp_name = urlencode($exp_name."-Viscosity.visc.zip");
        $exp_path = viscosity_openvpn_client_config_exporter($srvid, $usrid, $crtid, $useaddr, $verifyservercn, $randomlocalport, $usetoken, $password, $proxy, $openvpnmanager, $advancedoptions);
    }

    if (substr($act, 0, 4) == "inst") {
        $exp_name = urlencode($exp_name."-install.exe");
        $exp_path = openvpn_client_export_installer($srvid, $usrid, $crtid, $useaddr, $verifyservercn, $randomlocalport, $usetoken, $password, $proxy, $openvpnmanager, $advancedoptions, substr($act, 5));
    }

    if (!$exp_path) {
        $input_errors[] = "Failed to export config files!";
    }
				$error = true;
				$input_errors[] = "You need to specify a username with the proxy config.";
			} else
				$proxy['user'] = $_GET['proxy_user'];
			if (!empty($_GET['proxy_user']) && empty($_GET['proxy_password'])) {
				$error = true;
				$input_errors[] = "You need to specify a password with the proxy user.";
			} else
				$proxy['password'] = $_GET['proxy_password'];
		}
	}

	$exp_name = openvpn_client_export_prefix($srvid);
	if ($act == "confall")
		$zipconf = true;
	$exp_data = openvpn_client_export_config($srvid, $usrid, $crtid, $useaddr, $usetoken, $nokeys, $proxy, $zipconf, $password, false, false, $advancedoptions);
	if (!$exp_data) {
		$input_errors[] = "Failed to export config files!";
		$error = true;
	}
	if (!$error) {
		if ($act == "confall") {
			$exp_name = urlencode($exp_data);
			$exp_size = filesize("{$g['tmp_path']}/{$exp_data}");
		} else {
			$exp_name = urlencode($exp_name."-config.ovpn");
			$exp_size = strlen($exp_data);
		}

		header('Pragma: ');
		header('Cache-Control: ');