public function testDateTimeValidation() { $validations = array(); $values = array(1 => array('31/12/2014 13:59', 'd/m/y'), 2 => array('12/31/2014 13:59:59', 'm/d/y'), 3 => array('2014-12-31 1:00pm', 'y-m-d'), 4 => array('28.2.2014 01:59:59 PM', 'd.m.y'), 5 => array('02.28.2014 11:59 am', 'm.d.y')); foreach ($values as $key => $val) { $validations['txtDateTime' . $key] = array('caption' => 'DateTime ' . $key, 'value' => $val[0], 'rules' => array('datetime'), 'dateFormat' => $val[1]); } $this->assertTrue(validation_check($validations)); $validations = array(); $values = array(1 => array('31/12/2014 13:59', 'd/m/y'), 2 => array('12/31/2014 13:59:59', 'm/d/y'), 2 => array('12/31/2014 02:00:00', 'm/d/y')); foreach ($values as $key => $val) { $validations['txtDateTime' . $key] = array('caption' => 'DateTime ' . $key, 'value' => $val[0], 'rules' => array('datetime'), 'dateFormat' => $val[1], 'timeFormat' => '24'); } $this->assertTrue(validation_check($validations)); $validations = array(); $values = array(1 => array('2014-12-31 1:00pm', 'y-m-d'), 2 => array('28.2.2014 01:59:59 PM', 'd.m.y'), 3 => array('02.28.2014 11:59 am', 'm.d.y')); foreach ($values as $key => $val) { $validations['txtDateTime' . $key] = array('caption' => 'DateTime ' . $key, 'value' => $val[0], 'rules' => array('datetime'), 'dateFormat' => $val[1], 'timeFormat' => '12'); } $this->assertTrue(validation_check($validations)); }
$noten = new noten(); $check = $noten->folder_contents("../" . $settings["path_noten"]); $okay = FALSE; for ($i = 0; $i < sizeof($check); $i++) { if ($eingabe == $check[$i]) { $okay = TRUE; } } if ($okay === TRUE) { return true; } else { return false; } } $pdfFolder = '../' . $settings["path_noten"] . '/'; if (isset($_GET['pdfdir']) & validation_check($_GET['pdfdir'])) { $pdfDir = $_GET['pdfdir'] . "/"; if (isset($_GET['pdf']) && basename($_GET['pdf']) == $_GET['pdf']) { $pdf = $pdfFolder . $pdfDir . $_GET['pdf']; if (file_exists($pdf) && is_readable($pdf)) { header('Content-Type: application/pdf'); header('Content-length: ' . filesize($pdf)); $file = @fopen($pdf, 'rb'); if ($file) { fpassthru($file); fclose($file); exit; } } } }
$webDir = str_replace('\\', '/', str_replace(ROOT, WEB_ROOT, $uploadDir)); $maxSize = $get['maxSize']; $fileTypes = $get['exts'] ? explode(',', $get['exts']) : ''; $phpCallback = isset($get['phpCallback']) ? $get['phpCallback'] : ''; $buttons = isset($get['buttons']) ? explode(',', $get['buttons']) : array(); $dimensions = isset($get['dimensions']) ? explode(',', $get['dimensions']) : array(); $data = array('success' => false, 'id' => $buttonId, 'name' => $name, 'label' => $label, 'disabledButtons' => $buttons, 'value' => '', 'savedId' => '', 'dimensions' => array(), 'displayFileName' => '', 'displayFileLink' => '', 'uniqueId' => '', 'extension' => '', 'error' => ''); if (count($_FILES)) { $post = _post($_POST); $validations = array($name => array('caption' => $label, 'value' => $_FILES['file'], 'rules' => array('fileMaxSize'), 'maxSize' => $maxSize, 'messages' => array('fileMaxSize' => _t('File size exceeds the maximum allowed upload size %dMB', $maxSize)))); if ($fileTypes) { $validations[$name]['rules'][] = 'fileExtension'; $validations[$name]['extensions'] = $fileTypes; $validations[$name]['messages']['fileExtension'] = _t('File must be one of the file types: %s.', _fstr($fileTypes)); } if (validation_check($validations, 'single') === true) { $file = _fileHelper(); $uniqueId = $file->get('uniqueId'); $file->set('uploadDir', $uploadDir); if (is_array($dimensions) && $dimensions) { $file->set('dimensions', $dimensions); } $fileData = $file->upload($_FILES['file']); if ($fileData) { $data['success'] = true; $data['value'] = $fileData['fileName']; $data['displayFileName'] = $fileData['fileName']; $data['displayFileLink'] = $webDir . $fileData['fileName']; $data['extension'] = $fileData['extension']; $data['dimensions'] = $dimensions; $data['uniqueId'] = $uniqueId;