Piotr Labudda 10 лет назад
Родитель
Сommit
aa9848977b
2 измененных файлов с 134 добавлено и 216 удалено
  1. 126 214
      SE/se-lib/TableAjax.php
  2. 8 2
      SE/se-lib/V.php

+ 126 - 214
SE/se-lib/TableAjax.php

@@ -3686,39 +3686,34 @@ function <?php echo $jsToogleFiltrProcesuFunctionName; ?>(n) {
 				break;
 			}
 			case 'FILES': {
-				$id = V::get('ID', 0, $_REQUEST, 'int');
-				if ($id > 0) {
+				try {
+					$id = V::get('ID', 0, $_REQUEST, 'int');
+					if ($id <= 0) throw new HttpException("404", 404);
 					$this->sendAjaxFiles($id, $_REQUEST);
-				} else {
-					echo '404';
+				} catch (HttpException $e) {
+					Http::sendHeaderByCode($e->getCode());
+					echo $e->getMessage();
+					//SE_Layout::alert('danger', $e->getMessage());
+				} catch (Exception $e) {
+					echo '<div class="container">';
+						SE_Layout::alert('danger', $e->getMessage());
+					echo '</div>';
 				}
 				break;
 			}
 			case 'FILES_UPLOAD': {
-				$id = V::get('ID', 0, $_REQUEST, 'int');
-				if ($id > 0) {
-					$this->sendAjaxFilesUpload($id, $_REQUEST);
-				} else {
-					echo '404';
-				}
+				$this->sendAjaxResponseJson('ajaxFileUpload', $_REQUEST);
 				break;
 			}
 			case 'FILES_LIST': {
-				$id = V::get('ID', 0, $_REQUEST, 'int');
-				if ($id > 0) {
-					$this->sendAjaxFilesList($id, $_REQUEST);
-				} else {
-					echo '404';
-				}
+				$this->sendAjaxResponseJson('ajaxFileList', $_REQUEST);
 				break;
 			}
 			case 'FILE_REMOVE': {
-				$id = V::get('ID', 0, $_REQUEST, 'int');
-				if ($id > 0) {
-					$this->sendAjaxFileRemove($id, $_REQUEST);
-				} else {
-					echo '404';
-				}
+				$args = array();
+				$args['ID'] = V::get('ID', '', $_REQUEST);
+				$args['filename'] = V::get('filename', '', $_POST);
+				$this->sendAjaxResponseJson('ajaxFileRemove', $args);
 				break;
 			}
 			case 'filePermsRefresh': {
@@ -4555,184 +4550,112 @@ jQuery(document).ready(function(){
 		exit;
 	}
 
-	/**
-	 * Returns text/plain with type at first line: ERROR, WARNING, INFO, SUCCESS
-	 */
-	private function sendAjaxFilesUpload($id, $args) {
-		// http://www.sitepoint.com/html5-ajax-file-upload/
-		//$ajaxFileName = (isset($_SERVER['HTTP_X_FILENAME']) ? $_SERVER['HTTP_X_FILENAME'] : false);
-
-		//header("Content-type: text/plain");
-		header("Content-type: application/json");
-		$DBG = ('1' == V::get('DBG', '', $_REQUEST));
-
+	public function ajaxFileUpload($args) {
+		$id = V::get('ID', 0, $args, 'int');
+		if ($id <= 0) throw new HttpException("404", 404);
 		$dbID = $this->_acl->getDB();
 		$db = DB::getDB($dbID);
-		if (!$db) {
-			header('HTTP/1.0 406 Not Acceptable');
-			echo '{"type":"ERROR", "string": "No DB (' . $dbID . ')"}';
-			exit;
-		}
-
+		if (!$db) throw new HttpException("No DB ({$dbID})", 406);
 		$record = $this->_acl->getItem($id);
-		if (!$record) {
-			header('HTTP/1.0 404 Not Found');
-			echo '{"type":"ERROR", "string": "No item ID(' . $rowID . ')"}';
-			exit;
-		}
-
+		if (!$record) throw new HttpException("No item ID({$rowID})", 404);
+		if (!$this->_acl->canReadRecord($record)) throw new Exception("Brak uprawnień do odczytu");
+		if (!$this->_acl->canWriteRecord($record)) throw new Exception("Brak uprawnień do zapisu");
 		$tblName = $this->_acl->getName();
 		$confTblName = "{$tblName}_COLUMN";
 		$folderConfAll = FoldersConfig::getRawData();
-		if (!FoldersConfig::hasConfig($confTblName)) {
-			header('HTTP/1.0 404 Not Found');
-			echo '{"type":"ERROR", "string": "Brak danych konfiguracyjnych(' . $tblName . ')"}';
-			exit;
-		}
-
+		if (!FoldersConfig::hasConfig($confTblName)) throw new HttpException("Brak danych konfiguracyjnych ({$tblName})", 404);
 		$folderConf = FoldersConfig::getAll($confTblName);
 
 		$uploader = new FileUploader($confTblName, $record);
-		$errMsg = '';
-		if (!$uploader->setConfig($folderConf, $errMsg)) {
-			header('HTTP/1.0 404 Not Found');
-			echo '{"type":"ERROR", "string": "Błąd danych konfiguracyjnych(' . $tblName . ') <br>' . $errMsg . '"}';
-			exit;
-		}
+		if (!$uploader->setConfig($folderConf)) throw new HttpException("Błąd danych konfiguracyjnych ({$tblName})", 404);
 		$uploader->findFolder();
-
 		$errorMsg = '';
-		if (!empty($_POST['SCANS_COLUMN_ADD'])) {
+		if (!empty($args['SCANS_COLUMN_ADD'])) {
 			$uploaded = $uploader->tryMoveFromScanAjax($errorMsg);
 		}
 		else {
 			$uploaded = $uploader->tryUploadAjax($errorMsg);
 		}
 
-		if ($uploaded) {
-			$uploadedFileName = '';
-			$uploadedFile = $uploader->getLastUploadedFile();
-			if ($uploadedFile) {
-				$uploadedFileName = explode('/', $uploadedFile);
-				$uploadedFileName = end($uploadedFileName);
-			}
-			echo '{"type":"SUCCESS", "string": "Plik został poprawnie wgrany do odpowiedniego katalogu '.$uploadedFileName.'"}';
-
-			if (!empty($uploadedFileName)) {
-				$sqlObj = new stdClass();
-				$sqlObj->ID = $record->ID;
-				$sqlObj->M_DIST_FILES = "Wgrano plik {$uploadedFileName}";
-				$db->UPDATE_OBJ($this->_tbl, $sqlObj);
-			}
-		} else {
-			echo '{"type":"ERROR", "string": "' . $errorMsg . '"}';
+		$retJson = new stdClass();
+		if (!$uploaded) throw new Exception($errorMsg);
+		$uploadedFileName = '';
+		$uploadedFile = $uploader->getLastUploadedFile();
+		if ($uploadedFile) {
+			$uploadedFileName = explode('/', $uploadedFile);
+			$uploadedFileName = end($uploadedFileName);
 		}
-		exit;
-	}
+		//echo '{"type":"SUCCESS", "string": "Plik został poprawnie wgrany do odpowiedniego katalogu '.$uploadedFileName.'"}';
+		$retJson->type = 'SUCCESS';
+		$retJson->msg = "Plik został poprawnie wgrany do odpowiedniego katalogu {$uploadedFileName}";
 
-	private function sendAjaxFileRemove($id, $args) {
-		header("Content-type: application/json");
-		$DBG = ('1' == V::get('DBG', '', $_REQUEST));
-
-		if (empty($_POST['filename'])) {
-			echo '{"type":"ERROR", "string": "Nie wybrano pliku do usunięcia"}';
-			exit;
+		if (!empty($uploadedFileName)) {
+			$sqlObj = new stdClass();
+			$sqlObj->ID = $record->ID;
+			$sqlObj->M_DIST_FILES = "Wgrano plik {$uploadedFileName}";
+			$db->UPDATE_OBJ($this->_tbl, $sqlObj);
 		}
+		return $retJson;
+	}
 
+	public function ajaxFileRemove($args) {
+		$id = V::get('ID', 0, $args, 'int');
+		if ($id <= 0) throw new HttpException("404", 404);
+		$filename = V::get('filename', '', $args);
+		if (empty($filename)) throw new Exception("Nie wybrano pliku do usunięcia");
 		$dbID = $this->_acl->getDB();
 		$db = DB::getDB($dbID);
-		if (!$db) {
-			header('HTTP/1.0 406 Not Acceptable');
-			echo '{"type":"ERROR", "string": "No DB (' . $dbID . ')"}';
-			exit;
-		}
-
+		if (!$db) throw new HttpException("No DB ({$dbID})", 406);
 		$record = $this->_acl->getItem($id);
-		if (!$record) {
-			header('HTTP/1.0 404 Not Found');
-			echo '{"type":"ERROR", "string": "No item ID(' . $rowID . ')"}';
-			exit;
-		}
-
+		if (!$record) throw new HttpException("No item ID({$rowID})", 404);
+		if (!$this->_acl->canReadRecord($record)) throw new Exception("Brak uprawnień do odczytu");
+		if (!$this->_acl->canWriteRecord($record)) throw new Exception("Brak uprawnień do zapisu");
 		$tblName = $this->_acl->getName();
 		$confTblName = "{$tblName}_COLUMN";
 		$folderConfAll = FoldersConfig::getRawData();
-		if (!FoldersConfig::hasConfig($confTblName)) {
-			header('HTTP/1.0 404 Not Found');
-			echo '{"type":"ERROR", "string": "Brak danych konfiguracyjnych (' . $tblName . ')"}';
-			exit;
-		}
-
+		if (!FoldersConfig::hasConfig($confTblName)) throw new HttpException("Brak danych konfiguracyjnych ({$tblName})", 404);
 		$folderConf = FoldersConfig::getAll($confTblName);
 
 		$uploader = new FileUploader($confTblName, $record);
-		if (!$uploader->setConfig($folderConf)) {
-			header('HTTP/1.0 404 Not Found');
-			echo '{"type":"ERROR", "string": "Błąd danych konfiguracyjnych (' . $tblName . ')"}';
-			exit;
-		}
+		if (!$uploader->setConfig($folderConf)) throw new HttpException("Błąd danych konfiguracyjnych ({$tblName})", 404);
 		$uploader->findFolder();
 
 		$errorMsg = '';
-		$removed = $uploader->tryRemoveFromAjax($_POST['filename'], $errorMsg);
-		if (!$removed) {
-			echo '{"type":"ERROR", "string": "{' . $errorMsg . '}"}';
-		} else {
-			echo '{"type":"SUCCESS","string":"Plik został poprawnie usunięty"}';
-		}
-		exit;
+		$removed = $uploader->tryRemoveFromAjax($filename, $errorMsg);
+		if (!$removed) throw new Exception($errorMsg);
+		$retJson = new stdClass();
+		$retJson->type = 'SUCCESS';
+		$retJson->msg = 'Plik został poprawnie usunięty';
+		return $retJson;
 	}
 
-	private function sendAjaxFilesList($id, $args) {
-		header("Content-type: application/json");
-
+	public function ajaxFileList($args) {
+		$id = V::get('ID', 0, $args, 'int');
+		if ($id <= 0) throw new HttpException("404", 404);
 		$dbID = $this->_acl->getDB();
 		$db = DB::getDB($dbID);
-		if (!$db) {
-			header('HTTP/1.0 406 Not Acceptable');
-			echo '{"type":"ERROR", "string": "No DB (' . $dbID . ')"}';
-			exit;
-		}
-
+		if (!$db) throw new HttpException("No DB ({$dbID})", 406);
 		$record = $this->_acl->getItem($id);
-		if (!$record) {
-			header('HTTP/1.0 404 Not Found');
-			echo '{"type":"ERROR", "string": "No item ID(' . $rowID . ')"}';
-			exit;
-		}
-
+		if (!$record) throw new HttpException("No item ID({$rowID})", 404);
+		if (!$this->_acl->canReadRecord($record)) throw new Exception("Brak uprawnień do odczytu");
 		$tblName = $this->_acl->getName();
 		$confTblName = "{$tblName}_COLUMN";
 		$folderConfAll = FoldersConfig::getRawData();
-		if (!FoldersConfig::hasConfig($confTblName)) {
-			header('HTTP/1.0 404 Not Found');
-			echo '{"type":"ERROR", "string": "Brak danych konfiguracyjnych (' . $tblName . ')"}';
-			exit;
-		}
-
+		if (!FoldersConfig::hasConfig($confTblName)) throw new HttpException("Brak danych konfiguracyjnych ({$tblName})", 404);
 		$folderConf = FoldersConfig::getAll($confTblName);
 
 		$uploader = new FileUploader($confTblName, $record);
-		if (!$uploader->setConfig($folderConf)) {
-			header('HTTP/1.0 404 Not Found');
-			echo '{"type":"ERROR", "string": "Błąd danych konfiguracyjnych (' . $tblName . ')"}';
-			exit;
-		}
+		if (!$uploader->setConfig($folderConf)) throw new HttpException("Błąd danych konfiguracyjnych ({$tblName})", 404);
 		$uploader->findFolder();
-
 		$mainFolder = $uploader->getDestFolder();
-
 		$files = $uploader->getFilesFromFolder($mainFolder, false, true);
 		$localPath = $uploader->getLocalPath();
 		$folderWeb = $uploader->getFolderWeb();
 		$jsonFiles = $this->convertFileListToJson($files, $folderWeb, $localPath, $mainFolder);
-		echo json_encode($jsonFiles);
-		exit;
+		return $jsonFiles;
 	}
 
 	private function ajaxFilePermsRefresh($args) {
-		header("Content-type: application/json");
-
 		$id = V::get('ID', 0, $args, 'int');
 		if ($id <= 0) throw new HttpException("Wrong param ID", 404);
 
@@ -4985,45 +4908,24 @@ jQuery(document).ready(function(){
 
 		$dbID = $this->_acl->getDB();
 		$db = DB::getDB($dbID);
-		if (!$db) {
-			header('HTTP/1.0 406 Not Acceptable');
-			exit;
-		}
+		if (!$db) throw new HttpException("", 406);
 
 		$record = $this->_acl->getItem($id);
-		if (!$record) {
-			header('HTTP/1.0 404 Not Found');
-			echo "404: No item ID({$rowID})";
-			exit;
-		}
+		if (!$record) throw new HttpException("404: No item ID({$rowID})", 404);
 
-		if (!$this->_acl->canWriteRecord($record) && !$this->_acl->hasPermSuperWrite()) {
-			echo '<div class="alert alert-danger">';
-				echo "Brak dostępu do rekordu";// TODO: more info - reason
-			echo '</div>';
-			return;
-		}
+		if (!$this->_acl->canReadRecord($record)) throw new Exception("Brak uprawnień do odczytu");
 
 		$tblName = $this->_acl->getName();
 		$confTblName = "{$tblName}_COLUMN";
 		$folderConfAll = FoldersConfig::getRawData();
-		if (!FoldersConfig::hasConfig($confTblName)) {
-			header('HTTP/1.0 404 Not Found');
-			echo "Brak danych konfiguracyjnych";
-			exit;
-		}
+		if (!FoldersConfig::hasConfig($confTblName)) throw new HttpException("Brak danych konfiguracyjnych", 404);
 
 		$folderConf = FoldersConfig::getAll($confTblName);
 		//echo'<pre style="max-height:200px;overflow:auto;border:1px solid red;text-align:left;">$folderConf (' . __CLASS__ . '::' . __FUNCTION__ . ':' . __LINE__ . '): ';print_r($folderConf);echo'</pre>';
 
 		$uploader = new FileUploader($confTblName, $record);
 		$errMsg = '';
-		if (!$uploader->setConfig($folderConf, $errMsg)) {
-			header('HTTP/1.0 404 Not Found');
-			echo "Błąd danych konfiguracyjnych ({$tblName})";
-			echo '<br>' . "\n" . $errMsg;
-			exit;
-		}
+		if (!$uploader->setConfig($folderConf, $errMsg)) throw new HttpException("Błąd danych konfiguracyjnych ({$tblName})" . '<br>' . "\n" . $errMsg, 404);
 		$uploader->findFolder();
 		if($DBG){ echo'<pre style="max-height:200px;overflow:auto;border:1px solid red;text-align:left;">uploader (F.' . __FUNCTION__ . ':' . __LINE__ . '): ';print_r($uploader);echo'</pre>'; }
 
@@ -5106,7 +5008,11 @@ jQuery(document).ready(function(){
 
 		<br>
 		<br>
-
+<?php if (!$this->_acl->canWriteRecord($record)) : ?>
+			<div class="alert alert-warning">
+				Brak uprawnień do dodawania plików
+			</div>
+<?php else : ?>
 		<div id="FILES_CONN_TBLS_<?php echo $this->_htmlID; ?>"></div>
 
 		<form enctype="multipart/form-data" method="POST" action="" id="FILES_FRM_<?php echo $this->_htmlID; ?>" class="form-inline">
@@ -5236,6 +5142,7 @@ jQuery(document).ready(function(){
 			</table>
 		</form>
 		</div>
+<?php endif; ?>
 		<script>
 function fileListUpdateAjax<?php echo $this->_htmlID; ?>() {
 	var postData = {};
@@ -5245,12 +5152,11 @@ function fileListUpdateAjax<?php echo $this->_htmlID; ?>() {
 		//dataType: 'json',
 		//contentType: "application/json; charset=utf-8",
 		data: postData,
-		async: true,
 		success: function(data) {
 			fileListUpdate<?php echo $this->_htmlID; ?>(data);
 		},
 		error: function(jhr, textStatus, errorThrown) {
-			if (priv.options.debug) console.log('request error: ', errorThrown, ' textStatus: ', textStatus);
+			console.log('request error: ', errorThrown, ' textStatus: ', textStatus);
 		}
 	});
 }
@@ -5260,10 +5166,14 @@ function fileListUpdate<?php echo $this->_htmlID; ?>(fileListJson) {
 	fileListNode.empty();
 	fileListJson.map(function(file){
 		var node = $('<tr></tr>');
+<?php if (!$this->_acl->canWriteRecord($record)) : ?>
+		var fFun = null;
+<?php else : ?>
 		var fFun = $('<i class="glyphicon glyphicon-remove" style="cursor:pointer" data-filename="' + file.name + '"></i>');
+<?php endif; ?>
 		var fNameCell = $('<td style="overflow: hidden;"></td>');
 		var fName = $('<div style="overflow:hidden; white-space:nowrap;" title="' + file.name + '"></div>');
-		fName.append(fFun);
+		if (fFun) fName.append(fFun);
 		fName.append(file.name);
 		fName.appendTo(fNameCell);
 		node.append(fNameCell);
@@ -5275,40 +5185,41 @@ function fileListUpdate<?php echo $this->_htmlID; ?>(fileListJson) {
 		node.append('<td style="overflow:hidden; white-space:nowrap;">' + file.created + '</td>');
 		node.appendTo(fileListNode);
 
-		$(fFun).click(function(e){
-			var n = $(e.target);
-			var fname= n.data('filename');
-			if (!fname) {
-				return false;
-			}
-			if (confirm('Czy jesteś pewien, że chcesz usunąć plik o nazwie ' + fname + '?')) {
-				var postData = {filename: fname};
-				jQuery.ajax({
-					url: 'index-ajax.php?_zasobID=<?php echo $this->_zasobID; ?>&_cls=<?php echo __CLASS__; ?>&_hash=<?php echo $this->_htmlID; ?>&_task=FILE_REMOVE&ID=<?php echo $record->ID; ?>',
-					type: 'POST',
-					//dataType: 'json',
-					//contentType: "application/json; charset=utf-8",
-					data: postData,
-					async: true,
-					success: function(data) {
-						if (data && data.type) {
-							if (data.type == 'SUCCESS') {
-								n.parents('tr').remove();
-								//console.log('TODO: SUCCESS msg: ', data.string);
-							}
-							else if (data.type == 'ERROR') {
-								//console.log('TODO: ERROR msg: ', data.string);
+		if (fFun) {
+			$(fFun).click(function(e){
+				var n = $(e.target);
+				var fname= n.data('filename');
+				if (!fname) {
+					return false;
+				}
+				if (confirm('Czy jesteś pewien, że chcesz usunąć plik o nazwie ' + fname + '?')) {
+					var postData = {filename: fname};
+					jQuery.ajax({
+						url: 'index-ajax.php?_zasobID=<?php echo $this->_zasobID; ?>&_cls=<?php echo __CLASS__; ?>&_hash=<?php echo $this->_htmlID; ?>&_task=FILE_REMOVE&ID=<?php echo $record->ID; ?>',
+						type: 'POST',
+						//dataType: 'json',
+						//contentType: "application/json; charset=utf-8",
+						data: postData,
+						success: function(data) {
+							if (data && data.type) {
+								if (data.type == 'SUCCESS') {
+									n.parents('tr').remove();
+									//console.log('TODO: SUCCESS msg: ', data.msg);
+								}
+								else if (data.type == 'error') {
+									console.log('TODO: ERROR msg: ', data.msg);
+								}
+							} else {
+								console.log('TODO: ??? data: ', data);
 							}
-						} else {
-							if (priv.options.debug) console.log('TODO: ??? data: ', data);
+						},
+						error: function(jhr, textStatus, errorThrown) {
+							console.log('rm error: ', errorThrown, ' textStatus: ', textStatus);
 						}
-					},
-					error: function(jhr, textStatus, errorThrown) {
-						if (priv.options.debug) console.log('rm error: ', errorThrown, ' textStatus: ', textStatus);
-					}
-				});
-			}
-		});
+					});
+				}
+			});
+		}
 	});
 }
 
@@ -5324,7 +5235,6 @@ function connTblListUpdateAjax<?php echo $this->_htmlID; ?>(connTblID) {
 		//dataType: 'json',
 		//contentType: "application/json; charset=utf-8",
 		data: postData,
-		async: true,
 		success: function(data) {
 			connTblListUpdate<?php echo $this->_htmlID; ?>(data);
 		},
@@ -5461,23 +5371,25 @@ jQuery(document).ready(function(){
 			var $out = $('#FRM_UPLOAD_RESULTS_<?php echo $this->_htmlID; ?>');
 			var btnClose = '<button type="button" class="close" data-dismiss="alert"><i class="glyphicon glyphicon-remove"></i></button>';
 			if (typeof data == 'object') {
-				if (data.type == 'ERROR') {
-					$out.html('<div class="alert alert-danger">' + btnClose + data.string + '</div>');
+				if (data.type == 'error') {
+					$out.html('<div class="alert alert-danger">' + btnClose + data.msg + '</div>');
 				} else if (data.type == 'SUCCESS') {
-					$out.html('<div class="alert alert-success">' + btnClose + data.string + '</div>');
+					$out.html('<div class="alert alert-success">' + btnClose + data.msg + '</div>');
 					fileListUpdateAjax<?php echo $this->_htmlID; ?>();
+					// TODO: scanFileListUpdateAjax...
 				}
 			} else {
 				if (data.substr(0, 7) == 'WARNING') {
 					data = data.substr(7);
 					$out.html('<div class="alert alert-warning">' + btnClose + data + '</div>');
-				} else if (data.substr(0, 5) == 'ERROR') {
+				} else if (data.substr(0, 5) == 'error') {
 					data = data.substr(5);
 					$out.html('<div class="alert alert-danger">' + btnClose + data + '</div>');
 				} else if (data.substr(0, 7) == 'SUCCESS') {
 					data = data.substr(7);
 					$out.html('<div class="alert alert-success">' + btnClose + data + '</div>');
 					fileListUpdateAjax<?php echo $this->_htmlID; ?>();
+					// TODO: scanFileListUpdateAjax...
 				} else if (data.substr(0, 4) == 'INFO') {
 					data = data.substr(4);
 					$out.html('<div class="alert alert-info">' + btnClose + data + '</div>');

+ 8 - 2
SE/se-lib/V.php

@@ -327,11 +327,11 @@ class V {
 		$fldLabel = V::get('fld_label', '', $params);
 		$maxLength = V::get('max_length', 0, $params);
 		if ($maxLength > 0) {
-			if (strlen($value) > $maxLength) throw new Exception("Field {$fldLabel} cannot be longer then {$maxLength}.");
+			if (strlen($value) > $maxLength) throw new Exception("'{$fldLabel}' cannot be longer then {$maxLength}.");
 		}
 		$allowedValues = V::get('values', null, $params);
 		if (is_array($allowedValues) && !empty($allowedValues)) {
-			if (!in_array($value, $allowedValues)) throw new Exception("Field value is not allowed ({$fldLabel})");
+			if (!in_array($value, $allowedValues)) throw new Exception("'{$fldLabel}' value is not allowed");
 		}
 		$type = V::get('type', null, $params);
 		if ($type != null) {
@@ -341,6 +341,12 @@ class V {
 				throw new Exception("Unimplemented type to validate: '{$type}'");
 			}
 		}
+		if (array_key_exists('equal', $params)) {
+			if ($value != $params['equal']) throw new Exception(V::get('error_msg_equal', "'{$fldLabel}' must be equal to '{$params['equal']}'", $params));
+		}
+		if (array_key_exists('equalStrict', $params)) {
+			if ($value !== $params['equalStrict']) throw new Exception(V::get('error_msg_equalStrict', "'{$fldLabel}' must be strict equal to '{$params['equal']}'", $params));
+		}
 		return $value;
 	}