Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
136 additions
and
26 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
<?php | ||
namespace chat\data\user; | ||
use wcf\system\WCF; | ||
|
||
/** | ||
* User related chat actions. | ||
* | ||
* @author Maximilian Mader | ||
* @copyright 2010-2014 Tim Düsterhus | ||
* @license Creative Commons Attribution-NonCommercial-ShareAlike <http://creativecommons.org/licenses/by-nc-sa/3.0/legalcode> | ||
* @package be.bastelstu.chat | ||
* @subpackage data.user | ||
*/ | ||
class UserAction extends \wcf\data\AbstractDatabaseObjectAction { | ||
/** | ||
* @see \wcf\data\AbstractDatabaseObjectAction::$className | ||
*/ | ||
protected $className = 'wcf\data\user\UserEditor'; | ||
|
||
/** | ||
* Validates updating of chat user options | ||
*/ | ||
public function validateUpdateOption() { | ||
$this->readString('optionName'); | ||
$this->readBoolean('optionValue'); | ||
|
||
if (!preg_match('~^chat[A-Z]~', $this->parameters['optionName'])) throw new \wcf\system\exception\UserInputException('optionName'); | ||
|
||
$this->optionID = \wcf\data\user\User::getUserOptionID($this->parameters['optionName']); | ||
|
||
if (!$this->optionID) throw new \wcf\system\exception\UserInputException('optionName'); | ||
} | ||
|
||
/** | ||
* Updates chat user options | ||
*/ | ||
public function updateOption() { | ||
$userAction = new \wcf\data\user\UserAction(array(WCF::getUser()), 'update', array( | ||
'options' => array( | ||
$this->optionID => $this->parameters['optionValue'] ? 1 : 0 | ||
) | ||
)); | ||
$userAction->executeAction(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<data xmlns="http://www.woltlab.com" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.woltlab.com http://www.woltlab.com/XSD/maelstrom/userOption.xsd"> | ||
<import> | ||
<options> | ||
<option name="chatButtonFullscreen"> | ||
<categoryname>hidden</categoryname> | ||
<optiontype>boolean</optiontype> | ||
<defaultvalue>0</defaultvalue> | ||
</option> | ||
|
||
<option name="chatButtonNotify"> | ||
<categoryname>hidden</categoryname> | ||
<optiontype>boolean</optiontype> | ||
<defaultvalue>0</defaultvalue> | ||
</option> | ||
|
||
<option name="chatButtonSmilies"> | ||
<categoryname>hidden</categoryname> | ||
<optiontype>boolean</optiontype> | ||
<defaultvalue>1</defaultvalue> | ||
</option> | ||
</options> | ||
</import> | ||
</data> |