Overview

Packages

  • None
  • Sam

Classes

  • Sam_Api
  • Sam_Application
  • Overview
  • Package
  • Class
  • Tree
 1: <?php
 2: /**
 3:  * Sam application API.
 4:  *
 5:  * This file defines Horde's core API interface. Other core Horde libraries
 6:  * can interact with Sam through this API.
 7:  *
 8:  * Copyright 2002-2012 Horde LLC (http://www.horde.org/)
 9:  *
10:  * See the enclosed file COPYING for license information (GPL). If you
11:  * did not receive this file, see http://www.horde.org/licenses/gpl.
12:  *
13:  * @package Sam
14:  */
15: 
16: /* Determine the base directories. */
17: if (!defined('SAM_BASE')) {
18:     define('SAM_BASE', dirname(__FILE__) . '/..');
19: }
20: 
21: if (!defined('HORDE_BASE')) {
22:     /* If Horde does not live directly under the app directory, the HORDE_BASE
23:      * constant should be defined in config/horde.local.php. */
24:     if (file_exists(SAM_BASE . '/config/horde.local.php')) {
25:         include SAM_BASE . '/config/horde.local.php';
26:     } else {
27:         define('HORDE_BASE', SAM_BASE . '/..');
28:     }
29: }
30: 
31: /* Load the Horde Framework core (needed to autoload
32:  * Horde_Registry_Application::). */
33: require_once HORDE_BASE . '/lib/core.php';
34: 
35: class Sam_Application extends Horde_Registry_Application
36: {
37:     /**
38:      */
39:     public $version = 'H4 (1.0-git)';
40: 
41:     /**
42:      */
43:     protected function _init()
44:     {
45:         $GLOBALS['injector']->bindFactory('Sam_Driver', 'Sam_Factory_Driver', 'create');
46:     }
47: 
48:     /**
49:      */
50:     public function menu($menu)
51:     {
52:         if ($GLOBALS['conf']['enable']['rules']) {
53:             $menu->add(Horde::url('spam.php'), _("Spam Options"), 'sam.png',
54:                        null, null, null,
55:                        basename($_SERVER['PHP_SELF']) == 'index.php' ? 'current' : null);
56:         }
57:         try {
58:             $whitelist_url = $GLOBALS['registry']->link('mail/showWhitelist');
59:             $menu->add(Horde::url($whitelist_url), _("Whitelist"), 'whitelist.png');
60:         } catch (Horde_Exception $e) {
61:         }
62:         try {
63:             $blacklist_url = $GLOBALS['registry']->link('mail/showBlacklist');
64:             $menu->add(Horde::url($blacklist_url), _("Blacklist"), 'blacklist.png');
65:         } catch (Horde_Exception $e) {
66:         }
67:     }
68: }
69: 
API documentation generated by ApiGen