* Abstract class for all versionable data actions.
*
* @author Jeffrey Reichardt
- * @copyright 2001-2012 WoltLab GmbH
+ * @copyright 2001-2013 WoltLab GmbH
* @license GNU Lesser General Public License <http://opensource.org/licenses/lgpl-license.php>
* @package com.woltlab.wcf
* @subpackage data
* Executes ACP search provider-related actions.
*
* @author Alexander Ebert
- * @copyright 2001-2012 WoltLab GmbH
+ * @copyright 2001-2013 WoltLab GmbH
* @license GNU Lesser General Public License <http://opensource.org/licenses/lgpl-license.php>
* @package com.woltlab.wcf
* @subpackage data.acp.search.provider
* @see wcf\data\ISearchAction::validateGetSearchResultList()
*/
public function validateGetSearchResultList() {
- $this->parameters['data']['searchString'] = (isset($this->parameters['data']['searchString'])) ? StringUtil::trim($this->parameters['data']['searchString']) : '';
- if (empty($this->parameters['data']['searchString'])) {
- throw new UserInputException('searchString');
- }
+ $this->readString('searchString', false, 'data');
}
/**
* @see wcf\data\AbstractDatabaseObjectAction::validateDelete()
*/
public function validateCreate() {
- if (!isset($this->parameters['data']['objectTypeID'])) {
- throw new UserInputException('objectTypeID');
- }
+ $this->readInteger('objectTypeID', false, 'data');
$objectType = CategoryHandler::getInstance()->getObjectType($this->parameters['data']['objectTypeID']);
if ($objectType === null) {
* Validates the 'execute' action.
*/
public function validateExecute() {
- // TODO: Fix this: We need update permissions for executing?
parent::validateUpdate();
}
* Executes language-related actions.
*
* @author Alexander Ebert
- * @copyright 2001-2012 WoltLab GmbH
+ * @copyright 2001-2013 WoltLab GmbH
* @license GNU Lesser General Public License <http://opensource.org/licenses/lgpl-license.php>
* @package com.woltlab.wcf
* @subpackage data.language
*/
protected $permissionsUpdate = array('admin.language.canEditLanguage');
+ /**
+ * language editor object
+ * @var wcf\data\language\LanguageEditor
+ */
+ protected $languageEditor = null;
+
/**
* Validates permission to set a language as default.
*/
public function validateSetAsDefault() {
WCF::getSession()->checkPermissions($this->permissionsUpdate);
- // read objects
- if (empty($this->objects)) {
- $this->readObjects();
-
- if (empty($this->objects)) {
- throw new UserInputException('objectIDs');
- }
- }
+ $this->languageEditor = $this->getSingleObject();
}
/**
* Sets language as default
*/
public function setAsDefault() {
- $language = array_shift($this->objects);
- $language->setAsDefault();
+ $this->languageEditor->setAsDefault();
}
}
*/
protected $package = null;
- /**
- * id of the package the prepared queue belongs to
- * @var integer
- */
- protected $packageID = 0;
-
/**
* @see wcf\data\AbstractDatabaseObjectAction::$className
*/
* Validates the 'prepareQueue' action:
*/
public function validatePrepareQueue() {
- if (isset($this->parameters['packageID'])) $this->packageID = intval($this->parameters['packageID']);
+ $this->readInteger('packageID');
- $this->package = new Package($this->packageID);
+ $this->package = new Package($this->parameters['packageID']);
if (!$this->package->packageID) {
throw new UserInputException('packageID');
}
* Validates permissions and parameters.
*/
public function validateCreate() {
- if (!isset($this->parameters['data']['password'])) {
- throw new UserInputException('password');
- }
+ $this->readString('password', false, 'data');
}
/**
* @see wcf\data\ISearchAction::validateGetSearchResultList()
*/
public function validateGetSearchResultList() {
- if (!isset($this->parameters['data']['searchString'])) {
- throw new UserInputException('searchString');
- }
-
- if (!isset($this->parameters['data']['includeUserGroups'])) {
- throw new UserInputException('includeUserGroups');
- }
+ $this->readBoolean('includeUserGroups', false, 'data');
+ $this->readString('searchString', false, 'data');
if (isset($this->parameters['data']['excludedSearchValues']) && !is_array($this->parameters['data']['excludedSearchValues'])) {
throw new UserInputException('excludedSearchValues');