Example #1
0
function kav4proxy_license_upload()
{
    $tmp_file = $_FILES['fichier']['tmp_name'];
    if ($_SESSION[$tmp_file]["up"]) {
        writelogs("Uploading license {$tmp_file} already sended", __FUNCTION__, __FILE__);
        kav4proxy_license_iframe($_SESSION[$tmp_file]["results"]);
        exit;
    }
    $_SESSION[$tmp_file]["up"] = true;
    writelogs("Uploading license {$tmp_file}", __FUNCTION__, __FILE__);
    $content_dir = dirname(__FILE__) . "/ressources/logs";
    if (!is_dir($content_dir)) {
        mkdir($content_dir);
    }
    if (!is_uploaded_file($tmp_file)) {
        writelogs("not uploaded {$tmp_file}", __FUNCTION__, __FILE__);
        kav4proxy_license_iframe('{error_unable_to_upload_file}');
        exit;
    }
    $type_file = $_FILES['fichier']['type'];
    if (!strstr($type_file, 'key')) {
        kav4proxy_license_iframe('{error_file_extension_not_match} :key');
        exit;
    }
    $name_file = $_FILES['fichier']['name'];
    if (file_exists($content_dir . "/" . $name_file)) {
        @unlink($content_dir . "/" . $name_file);
    }
    if (!move_uploaded_file($tmp_file, $content_dir . "/" . $name_file)) {
        kav4proxy_license_upload("{error_unable_to_move_file} : " . $content_dir . "/" . $name_file);
        exit;
    }
    $_GET["moved_file"] = $content_dir . "/" . $name_file;
    $socket = new sockets();
    writelogs("Kav4ProxyUploadLicense:{$content_dir}/{$name_file}", __FUNCTION__, __FILE__);
    $res = base64_decode($socket->getFrameWork("cmd.php?Kav4ProxyUploadLicense={$content_dir}/{$name_file}&type={$_POST["license-type"]}"));
    $tp = explode("\n", $res);
    $tp[] = "ltp:{$_POST["license-type"]}";
    while (list($num, $val) = each($tp)) {
        if (trim($val) == null) {
            continue;
        }
        $val = htmlspecialchars($val);
        $html = $html . "<div><code>{$val}</code></div>";
    }
    writelogs("{$html}", __FUNCTION__, __FILE__);
    $_SESSION[$tmp_file]["results"] = $html;
    kav4proxy_license_upload($html);
}
Example #2
0
    exit;
}
if (isset($_GET["Kav4proxy-license-delete"])) {
    echo kav4proxy_license_delete();
    exit;
}
if (isset($_GET["kav4proxy-license-iframe"])) {
    echo kav4proxy_license_iframe();
    exit;
}
if (isset($_GET["Kav4ProxyLicenseInfos"])) {
    license_info();
    exit;
}
if (isset($_POST['InstallLicenseFile'])) {
    kav4proxy_license_upload();
    exit;
}
kav4proxy_license_js();
function kav4proxy_license_delete()
{
    $sock = new sockets();
    $datas = base64_decode($sock->getFrameWork('kav4proxy.php?license-infosDelete&type=' . $_GET["license-type"]));
}
function kav4proxy_license_js()
{
    $page = CurrentPageName();
    $tpl = new templates();
    $title = $tpl->_ENGINE_parse_body('{APP_KAV4PROXY}::{license_info}');
    if ($_GET["license-type"] == "milter") {
        $title = $tpl->_ENGINE_parse_body('{APP_KAVMILTER}::{license_info}', 'squid.index.php');