Added interface required for AJAX-based method calls
authorAlexander Ebert <ebert@woltlab.com>
Mon, 22 Oct 2012 13:40:55 +0000 (15:40 +0200)
committerAlexander Ebert <ebert@woltlab.com>
Mon, 22 Oct 2012 13:40:55 +0000 (15:40 +0200)
wcfsetup/install/files/lib/action/AJAXInvokeAction.class.php
wcfsetup/install/files/lib/system/IAJAXInvokeAction.class.php [new file with mode: 0644]

index 65cdf728b5efaa3190146925abc60b5fa99260c1..4ccde0c3baa35ad4f9312fa7cb284b7e47effdf5 100644 (file)
@@ -10,6 +10,16 @@ use wcf\util\ClassUtil;
 use wcf\util\JSON;
 use wcf\util\StringUtil;
 
+/**
+ * Default implementation for AJAX-based method calls.
+ * 
+ * @author     Alexander Ebert
+ * @copyright  2001-2012 WoltLab GmbH
+ * @license    GNU Lesser General Public License <http://opensource.org/licenses/lgpl-license.php>
+ * @package    com.woltlab.wcf
+ * @subpackage action
+ * @category   Community Framework
+ */
 class AJAXInvokeAction extends AbstractSecureAction {
        /**
         * method name
@@ -100,7 +110,10 @@ class AJAXInvokeAction extends AbstractSecureAction {
         */
        protected function invoke() {
                // check for interface and inheritance of SingletonFactory
-               if (!ClassUtil::isInstanceOf($this->className, 'wcf\system\SingletonFactory')) {
+               if (!ClassUtil::isInstanceOf($this->className, 'wcf\system\IAJAXInvokeAction')) {
+                       throw new SystemException("'".$this->className."' should implement 'wcf\system\IAJAXInvokeAction'");
+               }
+               else if (!ClassUtil::isInstanceOf($this->className, 'wcf\system\SingletonFactory')) {
                        throw new SystemException("'".$this->className."' should extend 'wcf\system\SingletonFactory'");
                }
                
diff --git a/wcfsetup/install/files/lib/system/IAJAXInvokeAction.class.php b/wcfsetup/install/files/lib/system/IAJAXInvokeAction.class.php
new file mode 100644 (file)
index 0000000..63bdd32
--- /dev/null
@@ -0,0 +1,18 @@
+<?php
+namespace wcf\system;
+
+/**
+ * Default interface for AJAX-based method calls.
+ * 
+ * You SHOULD NOT implement this interface in generic classes, as each method is entirely
+ * responsible to verify parameters and permissions. Implementing this class in generic
+ * classes leads to a potential breach of security and unforseen side-effects.
+ * 
+ * @author     Alexander Ebert
+ * @copyright  2001-2012 WoltLab GmbH
+ * @license    GNU Lesser General Public License <http://opensource.org/licenses/lgpl-license.php>
+ * @package    com.woltlab.wcf
+ * @subpackage system
+ * @category   Community Framework
+ */
+interface IAJAXInvokeAction { }