-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpnhandleruserapi.php
More file actions
148 lines (131 loc) · 4.1 KB
/
pnhandleruserapi.php
File metadata and controls
148 lines (131 loc) · 4.1 KB
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
<?php
/**
* FEproc - Mail template backend module for FormExpress for
* Zikula Content Management System
*
* @copyrightt (C) 2002 by Jason Judge, 2011 Chris Candreva
* @Version $Id: tables.php 84 2011-05-27 18:19:28Z ccandreva $
* @license GNU/GPL - http://www.gnu.org/copyleft/gpl.html
* @package FEproc
*
*
* LICENSE
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License (GPL)
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WIthOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* To read the license please visit http://www.gnu.org/copyleft/gpl.html
* ----------------------------------------------------------------------
* Original Author of file: Jason Judge.
* Based on template by Jim MacDonald.
* Current Maintainer of file: Chris Candreva <chris@westnet.com>
* ----------------------------------------------------------------------
*
*/
/**
* Count the number of handlers available.
* @returns int
* @return number of handlers available.
*/
function feproc_handleruserapi_counthandlers()
{
// Early security check.
if (!pnSecAuthAction(0, 'FEproc::', '::', ACCESS_READ))
{
return false;
}
return DBUtil::selectObjectCount('feproc_handlers', '', 'id', '');
}
/**
* Get handler specification
* The input parameters 'hid' and 'hname' are mutualy exclusive - use only
* one of them (either hid or name).
* @param args['hid'] handler id
* @param args['hname'] handler name
* @returns associative array
* (id,name,description,TODO)
* @return handler specification
*/
function feproc_handleruserapi_gethandler($args)
{
// Get arguments from argument array.
extract($args);
if (isset($hid)) {
//$where = "id = $hid";
$handler = DBUtil::SelectObjectById('feproc_handlers', $hid);
}
elseif (isset($name)) {
//$where = "name = $name";
$handler = DBUtil::SelectObjectById('feproc_handlers', $name, 'name');
}
elseif (isset($source)) {
list($type, $modulename, $apiname, $apifunc) = split(':', $source, 4);
$where = "type = $type"
. " and modulename = $modulename"
. " and apiname = $apiname"
. " and apifunc = $apifunc"
;
$obj = DBUtil::selectObjectArray('feproc_handlers', $where);
$handler = $obj[0];
}
else // No arguments set, return an error
{
pnSessionSetVar('errormsg', _FXMODARGSERROR);
return false;
}
$handler['source'] = implode(':', array($handler['type'], $handler['modulename'], $handler['apiname'], $handler['apifunc']));
$handler['hid'] = $handler['id'];
$handler['attributes'] = unserialize($handler['attributes']);
return $handler;
}
/**
* Get list of all handlers
* @param $args['startnum'] first handler number (starting from 1)
* @param $args['numitems'] number of handlers
* @returns array of associative arrays
* (id,name,description,type)
* @return array of all handlers
*/
function feproc_handleruserapi_getallhandlers($args)
{
// Get arguments from argument array.
extract($args);
// Argument check
if (!isset($startnum))
{
$startnum = 0;
} else {
--$startnum;
}
if (!isset($numitems))
{
$numitems = -1;
}
//$handlers = array();
// Early security check.
if (!pnSecAuthAction(0, 'FEproc::', "::", ACCESS_READ))
{
return array();
}
if ($type)
{
$where = "fp_type = '$type'";
} else {
$where = '';
}
$handlers = DBUtil::selectObjectArray('feproc_handlers', $where, 'name', $startnum, $numitems);
foreach ($handlers as &$obj) {
$obj['source'] = implode(':', array($obj['type'], $obj['modulename'], $obj['apiname'], $obj['apifunc']));
$obj['hid'] = $obj['id'];
}
unset($obj);
return $handlers;
}
?>