summaryrefslogtreecommitdiff
path: root/src/lib/MessageHandler.class.php
blob: 2dce49106149db0699c1d57533bd97c09f2da133 (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
50
51
52
53
54
55
<?php


require_once('send/SenderGVSMS.class.php');
require_once('send/SenderIdentica.class.php');

set_include_path(get_include_path().PATH_SEPARATOR."$BASE/src/plugins");

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;
				}
				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)
	}
}