Exemplo n.º 1
0
 function restoreState()
 {
     //  must call super
     parent::restoreState();
     if (isset($_FILES[$this->name])) {
         if (!is_array($_FILES[$this->name]['name'])) {
             throw new Exception("WFBulkUpload expected multiple upload files but only found one.");
         }
         $phpUploadErrors = @array(UPLOAD_ERR_OK => 'Value: 0; There is no error, the file uploaded with success.', UPLOAD_ERR_INI_SIZE => 'Value: 1; The uploaded file exceeds the upload_max_filesize directive in php.ini.', UPLOAD_ERR_FORM_SIZE => 'Value: 2; The uploaded file exceeds the MAX_FILE_SIZE directive that was specified in the HTML form.', UPLOAD_ERR_PARTIAL => 'Value: 3; The uploaded file was only partially uploaded.', UPLOAD_ERR_NO_FILE => 'Value: 4; No file was uploaded.', UPLOAD_ERR_NO_TMP_DIR => 'Value: 6; Missing a temporary folder. Introduced in PHP 4.3.10 and PHP 5.0.3.', UPLOAD_ERR_CANT_WRITE => 'Value: 7; Failed to write file to disk. Introduced in PHP 5.1.0.', UPLOAD_ERR_EXTENSION => 'Value: 8; File upload stopped by extension. Introduced in PHP 5.2.0.');
         $count = count($_FILES[$this->name]['name']);
         for ($i = 0; $i < $count; $i++) {
             // check for errors
             if ($_FILES[$this->name]['error'][$i] == UPLOAD_ERR_OK) {
                 if (is_uploaded_file($_FILES[$this->name]['tmp_name'][$i])) {
                     $this->uploads[] = new WFUploadedFile_Basic($_FILES[$this->name]['tmp_name'][$i], $_FILES[$this->name]['type'][$i], $_FILES[$this->name]['name'][$i]);
                     $this->hasUpload = true;
                 } else {
                     $this->addError(new WFError("File: '{$_FILES[$this->name]['name'][$i]}' is not a legitimate PHP upload. This is a hack attempt."));
                 }
             } else {
                 if ($_FILES[$this->name]['error'][$i] != UPLOAD_ERR_NO_FILE) {
                     $this->addError(new WFError("File: '{$_FILES[$this->name]['name'][$i]}' reported error: " . $phpUploadErrors[$_FILES[$this->name]['error'][$i]]));
                 }
             }
         }
     }
 }
Exemplo n.º 2
0
 function restoreState()
 {
     //  must call super
     parent::restoreState();
     if (isset($_REQUEST[$this->name])) {
         $this->value = $_REQUEST[$this->name];
     }
 }
Exemplo n.º 3
0
 function restoreState()
 {
     //  must call super
     parent::restoreState();
     // look for the things in the form I need to restore state...
     if (isset($_REQUEST[$this->name]) and $this->nullPlaceholder !== $_REQUEST[$this->name]) {
         $this->value = $_REQUEST[$this->name];
     }
 }
Exemplo n.º 4
0
 function restoreState()
 {
     //  must call super
     parent::restoreState();
     if (isset($_REQUEST[$this->name])) {
         $reqVal = $this->normalizeLineEndings($_REQUEST[$this->name]);
         $nullPlaceholder = $this->normalizeLineEndings($this->nullPlaceholder);
         if ($reqVal !== $nullPlaceholder) {
             $this->setValue($_REQUEST[$this->name]);
         }
     }
 }
Exemplo n.º 5
0
 function restoreState()
 {
     //  must call super
     parent::restoreState();
     // look for the things in the form I need to restore state...
     if (isset($_REQUEST[$this->name])) {
         $this->value = $_REQUEST[$this->name];
         if ($this->value && $this->confirmPasswordId) {
             $confirmPasswordWidget = $this->page->outlet($this->confirmPasswordId);
             $confirmPasswordWidget->restoreState();
             $confirmValue = $confirmPasswordWidget->value();
             if ($confirmValue !== $this->value) {
                 $this->addError(new WFError("Passwords entered do not match.", self::ERR_PASSWORDS_DO_NOT_MATCH));
             }
         }
     }
 }
Exemplo n.º 6
0
 function restoreState()
 {
     parent::restoreState();
 }
Exemplo n.º 7
0
 function restoreState()
 {
     //  must call super
     parent::restoreState();
     if ($this->multiple()) {
         if (isset($_REQUEST[$this->name])) {
             $this->setValues($_REQUEST[$this->name]);
         }
     } else {
         if (isset($_REQUEST[$this->name])) {
             $this->setValue($_REQUEST[$this->name]);
         }
     }
 }
Exemplo n.º 8
0
 function restoreState()
 {
     //  must call super
     parent::restoreState();
     if ($this->groupMode) {
         if (isset($_REQUEST[$this->name])) {
             if (in_array($this->checkedValue, $_REQUEST[$this->name])) {
                 $this->setChecked(true);
             } else {
                 $this->setChecked(false);
             }
         }
     } else {
         if (isset($_REQUEST[$this->name])) {
             $this->setValue($_REQUEST[$this->name]);
         } else {
             $this->setChecked(false);
         }
     }
 }
Exemplo n.º 9
0
 function restoreState()
 {
     parent::restoreState();
     // restore state of all children
     foreach ($this->children() as $radio) {
         if ($radio instanceof WFDynamic) {
             continue;
         }
         // special sauce to skip the WFDynamic that created the WFRadio's
         $radio->restoreState();
     }
 }
Exemplo n.º 10
0
 function restoreState()
 {
     //  must call super
     parent::restoreState();
     if (isset($_REQUEST[$this->parent()->name()])) {
         if ($_REQUEST[$this->parent()->name()] == $this->selectedValue()) {
             $this->parent()->setSelectedRadio($this);
         }
     }
 }
Exemplo n.º 11
0
 function restoreState()
 {
     //  must call super
     parent::restoreState();
     if (isset($_FILES[$this->name])) {
         if (is_array($_FILES[$this->name]['name'])) {
             throw new Exception("WFUpload expected a single upload files but multiple found.");
         }
         // use @ so that pre-php-5.2 users don't see warnings b/c some of these didn't exist
         $phpUploadErrors = @array(UPLOAD_ERR_OK => 'Value: 0; There is no error, the file uploaded with success.', UPLOAD_ERR_INI_SIZE => 'Value: 1; The uploaded file exceeds the upload_max_filesize directive in php.ini.', UPLOAD_ERR_FORM_SIZE => 'Value: 2; The uploaded file exceeds the MAX_FILE_SIZE directive that was specified in the HTML form.', UPLOAD_ERR_PARTIAL => 'Value: 3; The uploaded file was only partially uploaded.', UPLOAD_ERR_NO_FILE => 'Value: 4; No file was uploaded.', UPLOAD_ERR_NO_TMP_DIR => 'Value: 6; Missing a temporary folder. Introduced in PHP 4.3.10 and PHP 5.0.3.', UPLOAD_ERR_CANT_WRITE => 'Value: 7; Failed to write file to disk. Introduced in PHP 5.1.0.', UPLOAD_ERR_EXTENSION => 'Value: 8; File upload stopped by extension. Introduced in PHP 5.2.0.');
         if ($_FILES[$this->name]['error'] == UPLOAD_ERR_OK) {
             if (is_uploaded_file($_FILES[$this->name]['tmp_name'])) {
                 $this->hasUpload = true;
                 $this->tmpFileName = $_FILES[$this->name]['tmp_name'];
                 $this->originalFileName = $_FILES[$this->name]['name'];
                 $this->mimeType = $_FILES[$this->name]['type'];
             } else {
                 $this->addError(new WFError("File: '{$_FILES[$this->name]['name']}' is not a legitimate PHP upload. This is a hack attempt."));
             }
         } else {
             if ($_FILES[$this->name]['error'] != UPLOAD_ERR_NO_FILE) {
                 $this->addError(new WFError("File: '{$_FILES[$this->name]['name']}' reported error: " . $phpUploadErrors[$_FILES[$this->name]['error']]));
             }
         }
     }
 }
Exemplo n.º 12
0
 function restoreState()
 {
     parent::restoreState();
     WFLog::log("WFCheckboxGroup restoreState()<bR>");
     // restore state of all children
     foreach ($this->children() as $checkbox) {
         $checkbox->restoreState();
     }
     // rebuild our meta-value
     $this->updateGroupValues();
     WFLog::log("WFCheckboxGroup restoreState() done, value now:" . $this->values);
 }