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 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158
|
<?php
/**
* Horde external API interface.
*
* This file defines Horde's external API interface. Other
* applications can interact with Horde through this API.
*
* $Horde: horde/lib/api.php,v 1.43 2004/12/11 12:11:53 jan Exp $
*
* @package Horde
*/
$_types = array(
'stringArray' => array(array('item' => 'string')),
'hashItem' => array('key' => 'string', 'value' => 'string'),
'hash' => array(array('item' => '{urn:horde}hashItem')));
$_services['admin_list'] = array(true);
$_services['removeUserData'] = array(
'args' => array('user' => 'string')
);
/**
* General API for deleting Horde_Links
*/
$_services['deleteLink'] = array(
'link' => '%application%/services/links/delete.php?' .
'link_data=|link_data|&return_url=|url|'
);
$_services['listApps'] = array(
'args' => array('filter' => '{urn:horde}stringArray'),
'type' => '{urn:horde}stringArray'
);
$_services['listAPIs'] = array(
'args' => array(),
'type' => '{urn:horde}stringArray'
);
$_services['blockTitle'] = array(
'args' => array('app' => 'string', 'name' => 'string', 'params' => '{urn:horde}hash'),
'type' => 'string'
);
$_services['blockContent'] = array(
'args' => array('app' => 'string', 'name' => 'string', 'params' => '{urn:horde}hash'),
'type' => 'string'
);
$_services['blocks'] = array(
'args' => array(),
'type' => '{urn:horde}hash'
);
function &_horde_block($app, $name, $params = array())
{
global $registry;
require_once 'Horde/Block.php';
require_once 'Horde/Block/Collection.php';
$result = $registry->pushApp($app);
if (!is_a($result, 'PEAR_Error')) {
$result = Horde_Block_Collection::getBlock($app, $name, $params);
$registry->popApp($app);
}
return $result;
}
function _horde_blockTitle($app, $name, $params = array())
{
$block = &_horde_block($app, $name, $params);
if (is_a($block, 'PEAR_Error')) {
return $block->getMessage();
}
return $block->getTitle();
}
function _horde_blockContent($app, $name, $params = array())
{
$block = &_horde_block($app, $name, $params);
if (is_a($block, 'PEAR_Error')) {
return $block->getMessage();
}
return $block->getContent();
}
function _horde_blocks()
{
require_once 'Horde/Block/Collection.php';
$collection = &Horde_Block_Collection::singleton();
if (is_a($collection, 'PEAR_Error')) {
return $collection;
} else {
return $collection->getBlocksList();
}
}
function _horde_admin_list()
{
return array('configuration' => array(
'link' => '%application%/admin/setup/',
'name' => _("_Setup"),
'icon' => 'config.png'),
'users' => array(
'link' => '%application%/admin/user.php',
'name' => _("_Users"),
'icon' => 'user.png'),
'groups' => array(
'link' => '%application%/admin/groups.php',
'name' => _("_Groups"),
'icon' => 'group.png'),
'perms' => array(
'link' => '%application%/admin/perms/index.php',
'name' => _("_Permissions"),
'icon' => 'perms.png'),
'datatree' => array(
'link' => '%application%/admin/datatree.php',
'name' => _("_DataTree"),
'icon' => 'perms.png'),
'phpshell' => array(
'link' => '%application%/admin/phpshell.php',
'name' => _("P_HP Shell"),
'icon' => 'shell.png'),
'sqlshell' => array(
'link' => '%application%/admin/sqlshell.php',
'name' => _("S_QL Shell"),
'icon' => 'sql.png'),
'cmdshell' => array(
'link' => '%application%/admin/cmdshell.php',
'name' => _("_CLI"),
'icon' => 'shell.png'),
);
}
function _horde_removeUserData($user)
{
global $conf;
require_once 'Horde/Prefs.php';
$prefs = &Prefs::singleton($conf['prefs']['driver'], null, $user);
if (is_a($result = $prefs->clear(), 'PEAR_Error')) {
return $result;
}
}
function _horde_listApps($filter = null)
{
return $GLOBALS['registry']->listApps($filter);
}
function _horde_listAPIs()
{
return $GLOBALS['registry']->listAPIs();
}
|