summaryrefslogtreecommitdiff
path: root/classes/pluginhandler.php
blob: 9682e440ffa0bb5ad2ffc4f660d19fc47aad7387 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
<?php
class PluginHandler extends Handler_Protected {
	function csrf_ignore($method) {
		return true;
	}

	function catchall($method) {
		$plugin_name = clean($_REQUEST["plugin"]);
		$plugin = PluginHost::getInstance()->get_plugin($plugin_name);

		if ($plugin) {
			if (method_exists($plugin, $method)) {
				$plugin->$method();
			} else {
				user_error("PluginHandler: Requested unknown method '$method' of plugin '$plugin_name'.", E_USER_WARNING);
				print error_json(13);
			}
		} else {
			user_error("PluginHandler: Requested method '$method' of unknown plugin '$plugin_name'.", E_USER_WARNING);
			print error_json(14);
		}
	}
}