<?php

$accessControl = array(
    "ProfileRequired" => true
);
require_once "../../AccessControl.php";

if ($_REQUEST['conf']=="newcnf" || $_REQUEST['conf']=="") {
    echo(_NAME_SAVE_PROFILE_BEFORE_USE);
    exit();    
}
include_once '../../includes/File_upload.php';
$upload = new Files_upload();

echo $upload->UploadifyScripts();

echo _UPLOAD_IFRAME_INFO;

if ($upload->isUploadDirSafe()==false) {
    //echo "hallo";
    echoWarning($upload->SecurityWarning());    
}
if ($upload->canWeUseUploadify()==false) {
    if ($upload->isUploadEnabled()==false) {
        echoWarning(_UPLOAD_IFRAME_WARNING_1);
    }
    if ($upload->isMimeTypeSupported()==false) {
        echoWarning(_UPLOAD_IFRAME_WARNING_2);
    }    
    echo "<div class='help'>".ShowSettings()."</div>";
} else {
    $msg = _FILE_UPLOAD_LIMIT . " ". $upload->MaxUploadSize() ." MB. ";
    if (!$validUserRequired || $session->isAdmin()) {
        $msg.= "<p>".ShowSettings() ."</p>";
    }
    echo "<div class='help'>".$msg."</div>";
    echo $upload->SelectFilesButton();
}

function ShowSettings() {
    global $upload;
    $o= _UPLOAD_SETTINGS . ":<ul>";
    foreach ($upload->UploadSettings() as $key => $val) {
        if ($key == "target directory") {
            $o.= "<li>". _UPLOAD_TARGET_DIRECTORY .": $val (". _CHANGE_GLOBAL_SETTINGS_TAB .")</li>";        
        } else {
            $o.= "<li>$key is: $val (". _CHANGE_PHP_INI .")</li>";
        }        
    }
    $o.= "</ul>";
    return $o;    
}

?>


