1: <?php
2: 3: 4: 5: 6: 7: 8: 9: 10: 11: 12: 13: 14: 15:
16:
17: if (!defined('BEATNIK_BASE')) {
18: define('BEATNIK_BASE', dirname(__FILE__). '/..');
19: }
20:
21: if (!defined('HORDE_BASE')) {
22: 23:
24: if (file_exists(BEATNIK_BASE. '/config/horde.local.php')) {
25: include BEATNIK_BASE . '/config/horde.local.php';
26: } else {
27: define('HORDE_BASE', BEATNIK_BASE . '/..');
28: }
29: }
30:
31: 32:
33: require_once HORDE_BASE . '/lib/core.php';
34:
35:
36: class Beatnik_Application extends Horde_Registry_Application
37: {
38: public $version = 'H4 (1.0-git)';
39: public $driver = null;
40: public $domains = null;
41:
42: function _init()
43: {
44: $this->driver = Beatnik_Driver::factory();
45:
46:
47: $this->domains = $this->driver->getDomains();
48:
49:
50: if (Horde_Util::getFormData('curdomain') !== null && !empty($this->domains)) {
51: try {
52: $domain = $this->driver->getDomain(Horde_Util::getFormData('curdomain'));
53: } catch (Exception $e) {
54: $notification->push($e->getMessage(), 'horde.error');
55: $domain = $domains[0];
56: }
57:
58: $_SESSION['beatnik']['curdomain'] = $domain;
59: }
60:
61:
62: if (!isset($_SESSION['beatnik']['expertmode'])) {
63: $_SESSION['beatnik']['expertmode'] = false;
64: } elseif (Horde_Util::getFormData('expertmode') == 'toggle') {
65: if ($_SESSION['beatnik']['expertmode']) {
66: $notification->push(_('Expert Mode off'), 'horde.message');
67: $_SESSION['beatnik']['expertmode'] = false;
68: } else {
69: $notification->push(_('Expert Mode ON'), 'horde.warning');
70: $_SESSION['beatnik']['expertmode'] = true;
71: }
72: }
73:
74:
75: if (!isset($_SESSION['beatnik']['curpage'])) {
76: $_SESSION['beatnik']['curpage'] = 0;
77: }
78: }
79:
80: 81:
82: public function perms()
83: {
84: $perms = array(
85: 'domains' => array(
86: 'title' => _("Domains")
87: ),
88: );
89:
90:
91: foreach ($beatnik->driver->getDomains() as $domain) {
92: $perms['domains:' . $domain['zonename']] = array(
93: 'title' => $domain['zonename']
94: );
95: }
96:
97: return $perms;
98: }
99:
100: 101:
102: public function ($menu)
103: {
104: return Beatnik::getMenu();
105: }
106:
107: }
108: