summaryrefslogtreecommitdiff
path: root/src/lib/MessageHandler.class.php
blob: 1fa9faf9bc857f8bdc8a2c6c13cc1588baf988bc (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
<?php

class MessageHandler {
	public function __constructor() {
		
	}
	public function loadPlugin($plugin_name) {
		global $m;
		
		require_once("$plugin.class.php");
		$obj = new $plugin;
		$params = call_user_func("$plugin::configList");
		foreach ($params as $param => $type) {
			$value = $m->getPluginConf($plugin, $param);
			if ($value!==false) {
				switch ($type) {
				case 'text':
				case 'password':
					$value = "$value";
					break;
				case 'int':
					$value = (int)$value;
					break;
				}
				$obj->configSet($param, $value);
			}
		}
		return $obj;
	}
	public function main() {
		global $BASE;
		
		$private_senders = array();
		$broadcast_senders = array();
		
		$plugin_list = $m->getSysConf('plugins');
		$plugins = explode(',', $plugin_list);
		foreach ($plugins as $plugin) {
			require_once("$plugin.class.php");
			if (is_subclass_of($plugin, 'SenderPrivate')) {
				$private_senders[] = $this->loadPlugin($plugin);
			}
			if (is_subclass_of($plugin, 'SenderBroadcast')) {
				$broadcast_senders[] = $this->loadPlugin($plugin);
			}
		}
		//foreach ($private_senders)
	}
}