*/
public $defaultSortOrder = 'DESC';
+ /**
+ * @see wcf\page\SortablePage::$validSortFields
+ */
+ public $validSortFields = array('sessionLogID', 'username', 'ipAddress', 'userAgent', 'time', 'lastActivityTime', 'accesses');
+
/**
* @see wcf\page\MultipleLinkPage::$objectListClassName
*/
parent::readObjects();
}
- /**
- * @see wcf\page\SortablePage::validateSortField()
- */
- public function validateSortField() {
- parent::validateSortField();
-
- switch ($this->sortField) {
- case 'sessionLogID':
- case 'username':
- case 'ipAddress':
- case 'userAgent':
- case 'time':
- case 'lastActivityTime':
- case 'accesses': break;
- default: $this->sortField = $this->defaultSortField;
- }
- }
-
/**
* @see wcf\page\IPage::assignVariables()
*/
*/
public $defaultSortField = 'time';
+ /**
+ * @see wcf\page\SortablePage::$validSortFields
+ */
+ public $validSortFields = array('sessionAccessLogID', 'ipAddress', 'time', 'requestURI', 'requestMethod', 'className', 'packageName');
+
/**
* session log id
* @var integer
parent::readObjects();
}
- /**
- * @see wcf\page\SortablePage::validateSortField()
- */
- public function validateSortField() {
- parent::validateSortField();
-
- switch ($this->sortField) {
- case 'sessionAccessLogID':
- case 'ipAddress':
- case 'time':
- case 'requestURI':
- case 'requestMethod':
- case 'className':
- case 'packageName': break;
- default: $this->sortField = $this->defaultSortField;
- }
- }
-
/**
* @see wcf\page\IPage::assignVariables()
*/
*/
public $defaultSortField = 'description';
+ /**
+ * @see wcf\page\SortablePage::$validSortFields
+ */
+ public $validSortFields = array('description', 'cronjobID', 'nextExec', 'startMinute', 'startHour', 'startDom', 'startMonth', 'startDow');
+
/**
* @see wcf\page\MultipleLinkPage::$objectListClassName
*/
));
}
- /**
- * @see wcf\page\SortablePage::validateSortField()
- */
- public function validateSortField() {
- parent::validateSortField();
-
- switch ($this->sortField) {
- case 'description':
- case 'cronjobID':
- case 'nextExec':
- case 'startMinute':
- case 'startHour':
- case 'startDom':
- case 'startMonth':
- case 'startDow': break;
- default: $this->sortField = $this->defaultSortField;
- }
- }
-
/**
* @see wcf\page\IPage::show()
*/
* @see wcf\page\SortablePage::$defaultSortOrder
*/
public $defaultSortOrder = 'DESC';
+
+ /**
+ * @see wcf\page\SortablePage::$validSortFields
+ */
+ public $validSortFields = array('cronjobID', 'classPath', 'description', 'execTime', 'success');
/**
* @see wcf\page\MultipleLinkPage::$objectListClassName
));
}
- /**
- * @see wcf\page\SortablePage::validateSortField()
- */
- public function validateSortField() {
- parent::validateSortField();
-
- switch ($this->sortField) {
- case 'cronjobID':
- case 'classPath':
- case 'description':
- case 'execTime':
- case 'success': break;
- default: $this->sortField = $this->defaultSortField;
- }
- }
-
/**
* @see wcf\page\IPage::show()
*/
*/
public $defaultSortOrder = 'DESC';
+ /**
+ * @see wcf\page\SortablePage::$validSortFields
+ */
+ public $validSortFields = array('packageID', 'package', 'packageDir', 'packageName', 'instanceNo', 'packageDescription', 'packageVersion', 'packageDate', 'packageURL', 'parentPackageID', 'isUnique', 'standalone', 'author', 'authorURL', 'installDate', 'updateDate');
+
/**
* @see wcf\page\MultipleLinkPage::$objectListClassName
*/
parent::show();
}
-
- /**
- * @see wcf\page\SortablePage::validateSortField()
- */
- public function validateSortField() {
- parent::validateSortField();
-
- switch ($this->sortField) {
- case 'packageID':
- case 'package':
- case 'packageDir':
- case 'packageName':
- case 'instanceNo':
- case 'packageDescription':
- case 'packageVersion':
- case 'packageDate':
- case 'packageURL':
- case 'parentPackageID':
- case 'isUnique':
- case 'standalone':
- case 'author':
- case 'authorURL':
- case 'installDate':
- case 'updateDate': break;
- default: $this->sortField = $this->defaultSortField;
- }
- }
}
*/
public $defaultSortField = 'packageName';
+ /**
+ * @see wcf\page\SortablePage::$validSortFields
+ */
+ public $validSortFields = array('package', 'packageName', 'author');
+
/**
* id of the package update search
* @var integer
return $row['count'];
}
- /**
- * @see wcf\page\SortablePage::validateSortField()
- */
- public function validateSortField() {
- parent::validateSortField();
-
- switch ($this->sortField) {
- case 'package':
- case 'packageName':
- case 'author': break;
- default: $this->sortField = $this->defaultSortField;
- }
- }
-
/**
* Gets a list of packages.
*/
*/
public $defaultSortField = 'serverURL';
+ /**
+ * @see wcf\page\SortablePage::$validSortFields
+ */
+ public $validSortFields = array('packageUpdateServerID', 'serverURL', 'status', 'errorMessage', 'lastUpdateTime', 'packages');
+
/**
* @see wcf\page\MultipleLinkPage::$objectListClassName
*/
parent::show();
}
-
- /**
- * @see wcf\page\SortablePage::validateSortField()
- */
- public function validateSortField() {
- parent::validateSortField();
-
- switch ($this->sortField) {
- case 'packageUpdateServerID':
- case 'serverURL':
- case 'status':
- case 'errorMessage':
- case 'lastUpdateTime':
- case 'packages': break;
- default: $this->sortField = $this->defaultSortField;
- }
- }
}
*/
public $defaultSortField = 'groupName';
+ /**
+ * @see wcf\page\SortablePage::$validSortFields
+ */
+ public $validSortFields = array('groupID', 'groupName', 'groupType', 'members');
+
/**
* @see wcf\page\MultipleLinkPage::$objectListClassName
*/
}
}
- /**
- * @see wcf\page\SortablePage::validateSortField()
- */
- public function validateSortField() {
- parent::validateSortField();
-
- switch ($this->sortField) {
- case 'groupID':
- case 'groupName':
- case 'groupType':
- case 'members': break;
- default: $this->sortField = $this->defaultSortField;
- }
- }
-
/**
* @see wcf\page\MultipleLinkPage::initObjectList()
*/
*/
public $defaultSortField = 'username';
+ /**
+ * @see wcf\page\SortablePage::$validSortFields
+ */
+ public $validSortFields = array('email', 'userID', 'registrationDate', 'username');
+
/**
* id of a user search
* @var integer
* @see wcf\page\SortablePage::validateSortField()
*/
public function validateSortField() {
- parent::validateSortField();
+ // add options to valid sort fields
+ $this->validSortFields = array_merge($this->validSortFields, array_keys($this->options));
- switch ($this->sortField) {
- case 'email':
- case 'userID':
- case 'registrationDate':
- case 'username': break;
- default:
- if (!isset($this->options[$this->sortField])) {
- $this->sortField = $this->defaultSortField;
- }
- }
+ parent::validateSortField();
}
/**
*/
public $defaultSortOrder = 'ASC';
+ /**
+ * list of valid sort fields
+ * @var array<string>
+ */
+ public $validSortFields = array();
+
/**
* @see wcf\page\IPage::readParameters()
*/
public function validateSortField() {
// call validateSortField event
EventHandler::getInstance()->fireAction($this, 'validateSortField');
+
+ if (!in_array($this->sortField, $this->validSortFields)) {
+ $this->sortField = $this->defaultSortField;
+ }
}
/**