4include_once 
'Services/UIComponent/Toolbar/interfaces/interface.ilToolbarItem.php';
 
    5include_once(
"./Services/Form/classes/class.ilSubEnabledFormPropertyGUI.php");
 
   44        $this->lng = 
$DIC->language();
 
   47        parent::__construct($a_title, $a_postvar);
 
   59        if (!is_array($a_values[$this->
getPostVar()])) {
 
   72        $this->value = $a_value;
 
   92        $this->size = $a_size;
 
  112        $this->filename = $a_val;
 
  134        $this->suffixes = $a_suffixes;
 
  144        return $this->suffixes;
 
  154        $this->forbidden_suffixes = $a_suffixes;
 
  174        $this->pending = $a_val;
 
  196        $this->filename_selection = 
true;
 
  197        $this->filename_post = $a_post_var;
 
  208        return $this->filename_selection ? true : 
false;
 
  230        $this->allow_deletion = $a_val;
 
  259        if (!is_array($_FILES[$this->
getPostVar()])) {
 
  260            $this->
setAlert(
$lng->txt(
"form_msg_file_size_exceeds"));
 
  266        include_once(
"./Services/Utilities/classes/class.ilStr.php");
 
  273        $filename_arr = pathinfo($_FILES[$this->
getPostVar()][
"name"]);
 
  274        $suffix = $filename_arr[
"extension"];
 
  275        $mimetype = $_FILES[$this->
getPostVar()][
"type"];
 
  276        $size_bytes = $_FILES[$this->
getPostVar()][
"size"];
 
  277        $temp_name = $_FILES[$this->
getPostVar()][
"tmp_name"];
 
  284                case UPLOAD_ERR_INI_SIZE:
 
  285                    $this->
setAlert(
$lng->txt(
"form_msg_file_size_exceeds"));
 
  289                case UPLOAD_ERR_FORM_SIZE:
 
  290                    $this->
setAlert(
$lng->txt(
"form_msg_file_size_exceeds"));
 
  294                case UPLOAD_ERR_PARTIAL:
 
  295                    $this->
setAlert(
$lng->txt(
"form_msg_file_partially_uploaded"));
 
  299                case UPLOAD_ERR_NO_FILE:
 
  308                case UPLOAD_ERR_NO_TMP_DIR:
 
  309                    $this->
setAlert(
$lng->txt(
"form_msg_file_missing_tmp_dir"));
 
  313                case UPLOAD_ERR_CANT_WRITE:
 
  314                    $this->
setAlert(
$lng->txt(
"form_msg_file_cannot_write_to_disk"));
 
  318                case UPLOAD_ERR_EXTENSION:
 
  319                    $this->
setAlert(
$lng->txt(
"form_msg_file_upload_stopped_ext"));
 
  326        if ($_FILES[$this->
getPostVar()][
"tmp_name"] != 
"") {
 
  327            if (is_array($this->forbidden_suffixes) && in_array(strtolower($suffix), $this->forbidden_suffixes)) {
 
  328                $this->
setAlert(
$lng->txt(
"form_msg_file_type_is_not_allowed") . 
" (" . $suffix . 
")");
 
  332                if (!in_array(strtolower($suffix), $this->
getSuffixes())) {
 
  333                    $this->
setAlert(
$lng->txt(
"form_msg_file_wrong_file_type"));
 
  340        if ($_FILES[$this->
getPostVar()][
"tmp_name"] != 
"") {
 
  342            if ($vir[0] == 
false) {
 
  343                $this->
setAlert(
$lng->txt(
"form_msg_file_virus_found") . 
"<br />" . $vir[1]);
 
  358        $quota_exceeded = $quota_legend = 
false;
 
  359        if (self::$check_wsp_quota) {
 
  360            include_once 
"Services/DiskQuota/classes/class.ilDiskQuotaHandler.php";
 
  362                $lng->loadLanguageModule(
"file");
 
  363                $quota_exceeded = 
$lng->txt(
"personal_workspace_quota_exceeded_warning");
 
  369        $f_tpl = 
new ilTemplate(
"tpl.prop_file.html", 
true, 
true, 
"Services/Form");
 
  374            $f_tpl->setCurrentBlock(
'filename');
 
  376            $f_tpl->setVariable(
'VAL_FILENAME', $this->
getFilename());
 
  377            $f_tpl->setVariable(
'FILENAME_ID', $this->
getFieldId());
 
  378            $f_tpl->setVAriable(
'TXT_FILENAME_HINT', 
$lng->txt(
'if_no_title_then_filename'));
 
  379            $f_tpl->parseCurrentBlock();
 
  381            if (trim($this->
getValue() != 
"")) {
 
  383                    $f_tpl->setCurrentBlock(
"delete_bl");
 
  384                    $f_tpl->setVariable(
"POST_VAR_D", $this->
getPostVar());
 
  386                        "TXT_DELETE_EXISTING",
 
  387                        $lng->txt(
"delete_existing_file")
 
  389                    $f_tpl->parseCurrentBlock();
 
  392                $f_tpl->setCurrentBlock(
'prop_file_propval');
 
  393                $f_tpl->setVariable(
'FILE_VAL', $this->
getValue());
 
  394                $f_tpl->parseCurrentBlock();
 
  398        if ($a_mode != 
"toolbar") {
 
  399            if (!$quota_exceeded) {
 
  402                $f_tpl->setCurrentBlock(
"max_size");
 
  403                $f_tpl->setVariable(
"TXT_MAX_SIZE", 
$lng->txt(
"file_notice") . 
" " .
 
  404                    $this->getMaxFileSizeString());
 
  405                $f_tpl->parseCurrentBlock();
 
  408                    $f_tpl->setVariable(
"TXT_MAX_SIZE", $quota_legend);
 
  409                    $f_tpl->parseCurrentBlock();
 
  412                $f_tpl->setCurrentBlock(
"max_size");
 
  413                $f_tpl->setVariable(
"TXT_MAX_SIZE", $quota_exceeded);
 
  414                $f_tpl->parseCurrentBlock();
 
  416        } elseif ($quota_exceeded) {
 
  417            return $quota_exceeded;
 
  422            $f_tpl->setCurrentBlock(
"pending");
 
  423            $f_tpl->setVariable(
"TXT_PENDING", 
$lng->txt(
"file_upload_pending") .
 
  425            $f_tpl->parseCurrentBlock();
 
  431                " disabled=\"disabled\"" 
  435        $f_tpl->setVariable(
"POST_VAR", $this->
getPostVar());
 
  436        $f_tpl->setVariable(
"ID", $this->
getFieldId());
 
  437        $f_tpl->setVariable(
"SIZE", $this->
getSize());
 
  441        $f_tpl->setVariable(
"TXT_BROWSE", 
$lng->txt(
"select_file"));
 
  444        return $f_tpl->get();
 
  456        $a_tpl->setCurrentBlock(
"prop_generic");
 
  457        $a_tpl->setVariable(
"PROP_GENERIC", 
$html);
 
  458        $a_tpl->parseCurrentBlock();
 
  467            $suff_str = $delim = 
"";
 
  469                $suff_str.= $delim . 
"." . $suffix;
 
  472            $a_tpl->setCurrentBlock($a_block);
 
  474                "TXT_ALLOWED_SUFFIXES",
 
  475                $lng->txt(
"file_allowed_suffixes") . 
" " . $suff_str
 
  477            $a_tpl->parseCurrentBlock();
 
  484        $umf = ini_get(
"upload_max_filesize");
 
  486        $pms = ini_get(
"post_max_size");
 
  489        $multiplier_a=array(
"K"=>1024, 
"M"=>1024*1024, 
"G"=>1024*1024*1024);
 
  494        if (count($umf_parts) == 2) {
 
  495            $umf = $umf_parts[0]*$multiplier_a[$umf_parts[1]];
 
  497        if (count($pms_parts) == 2) {
 
  498            $pms = $pms_parts[0]*$multiplier_a[$pms_parts[1]];
 
  502        $max_filesize = min($umf, $pms);
 
  504        if (!$max_filesize) {
 
  505            $max_filesize=max($umf, $pms);
 
  509        $max_filesize = 
sprintf(
"%.1f MB", $max_filesize/1024/1024);
 
  511        return $max_filesize;
 
  536        if ((
bool) $a_value) {
 
  537            include_once 
"Services/WebDAV/classes/class.ilDiskQuotaActivationChecker.php";
 
  539                self::$check_wsp_quota = 
true;
 
  543        self::$check_wsp_quota = 
false;
 
sprintf('%.4f', $callTime)
An exception for terminatinating execution or to throw for unit testing.
static _isPersonalWorkspaceActive()
Static getter.
static isUploadPossible($a_additional_size=null)
static normalizeUtf8String($a_str)
Normalize UTF8 string.
special template class to simplify handling of ITX/PEAR
static virusHandling($a_file, $a_orig_name="", $a_clean=true)
scan file for viruses and clean files if possible
static stripSlashes($a_str, $a_strip_html=true, $a_allow="")
strip slashes if magic qoutes is enabled
echo;exit;}function LogoutNotification($SessionID){ global $ilDB;$q="SELECT session_id, data FROM usr_session WHERE expires > (\w+)\|/" PREG_SPLIT_NO_EMPTY PREG_SPLIT_DELIM_CAPTURE