1: <?php
 2:  3:  4:  5:  6:  7:  8:  9: 10: 11: 12: 13: 14: 
15: 
16: 
17: if (!defined('WICKED_BASE')) {
18:     define('WICKED_BASE', dirname(__FILE__) . '/..');
19: }
20: 
21: if (!defined('HORDE_BASE')) {
22:     23: 
24:     if (file_exists(WICKED_BASE . '/config/horde.local.php')) {
25:         include WICKED_BASE . '/config/horde.local.php';
26:     } else {
27:         define('HORDE_BASE', WICKED_BASE . '/..');
28:     }
29: }
30: 
31: 32: 
33: require_once HORDE_BASE . '/lib/core.php';
34: 
35: class Wicked_Application extends Horde_Registry_Application
36: {
37:     38: 
39:     public $version = 'H4 (1.0.3-git)';
40: 
41:     42: 43: 44: 45: 
46:     protected function _init()
47:     {
48:         $GLOBALS['injector']->bindFactory('Wicked_Driver', 'Wicked_Factory_Driver', 'create');
49:         $GLOBALS['wicked'] = $GLOBALS['injector']->getInstance('Wicked_Driver');
50:         $GLOBALS['linkTags'] = array('<link href="' . Horde::url('opensearch.php', true, -1) . '" rel="search" type="application/opensearchdescription+xml" title="' . $GLOBALS['registry']->get('name') . ' (' . Horde::url('', true) . ')" />');
51:     }
52: 
53:     54: 
55:     public function perms()
56:     {
57:         $perms = array(
58:             'pages' => array(
59:                 'title' => _("Pages")
60:             )
61:         );
62: 
63:         foreach (array('AllPages', 'LeastPopular', 'MostPopular', 'RecentChanges') as $val) {
64:             $perms['pages:' . $val] = array(
65:                 'title' => $val
66:             );
67:         }
68: 
69:         try {
70:             $pages = $GLOBALS['wicked']->getPages();
71:             sort($pages);
72:             foreach ($pages as $pagename) {
73:                 $perms['pages:' .$GLOBALS['wicked']->getPageId($pagename)] = array(
74:                     'title' => $pagename
75:                 );
76:             }
77:         } catch (Wicked_Exception $e) {}
78: 
79:         return $perms;
80:     }
81: 
82: }
83: