1: <?php
2: 3: 4: 5: 6: 7: 8: 9: 10: 11: 12: 13: 14:
15:
16:
17: if (!defined('VILMA_BASE')) {
18: define('VILMA_BASE', dirname(__FILE__) . '/..');
19: }
20:
21: if (!defined('HORDE_BASE')) {
22: 23:
24: if (file_exists(VILMA_BASE . '/config/horde.local.php')) {
25: include VILMA_BASE . '/config/horde.local.php';
26: } else {
27: define('HORDE_BASE', VILMA_BASE . '/..');
28: }
29: }
30:
31: 32:
33: require_once HORDE_BASE . '/lib/core.php';
34:
35: class Vilma_Application extends Horde_Registry_Application
36: {
37: 38: 39: 40: 41:
42: public $version = 'H4 (1.0-git)';
43:
44: public $driver = null;
45: public $curdomain = null;
46:
47: protected function _init()
48: {
49: $this->driver = Vilma_Driver::factory();
50:
51:
52:
53:
54:
55: $domain_id = Horde_Util::getFormData('domain_id');
56:
57: if (!empty($domain_id)) {
58: $domain = $this->driver->getDomain($domain_id);
59: if (!is_a($domain, 'PEAR_Error') &&
60: !empty($domain['domain_name'])) {
61: $this->curdomain = $domain;
62: Vilma::setCurDomain($domain);
63: }
64: } elseif ($domain = $GLOBALS['session']->get('vilma', 'domain')) {
65: $this->curdomain = $domain;
66: }
67: }
68:
69: public function perms()
70: {
71: $perms = array(
72: 'superadmin' => array(
73: 'title' => _("Super Administrator")
74: )
75: );
76:
77: $domains = $this->driver->getDomains();
78:
79:
80: foreach ($domains as $domain) {
81: $perms['domains:' . $domain['domain_id']] = array(
82: 'title' => $domain['name']
83: );
84: }
85:
86: return $perms;
87: }
88:
89: 90:
91: public function ($menu)
92: {
93: $menu->add(Horde::url('domains/index.php'), _("_Domains"), 'domain.png');
94: if ($GLOBALS['vilma']->curdomain) {
95: $domain = $GLOBALS['session']->get('vilma', 'domain');
96: $menu->add(Horde::url('users/index.php')->add('domain_id', $domain['domain_id']), $domain['domain_name'], 'domain.png');
97: $menu->add(Horde::url('users/edit.php'), _("New _Address"), 'user.png');
98: } else {
99: $menu->add(Horde::url('domains/edit.php'), _("_New Domain"), 'domain.png');
100: }
101: }
102: }
103: