3 * phpGACL - Generic Access Control List
4 * Copyright (C) 2002,2003 Mike Benoit
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Lesser General Public
8 * License as published by the Free Software Foundation; either
9 * version 2.1 of the License, or (at your option) any later version.
11 * This library is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Lesser General Public License for more details.
16 * You should have received a copy of the GNU Lesser General Public
17 * License along with this library; if not, write to the Free Software
18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
20 * For questions, help, comments, discussion, etc., please join the
21 * phpGACL mailing list. http://sourceforge.net/mail/?group_id=57103
23 * You may contact the author of phpGACL by e-mail at:
26 * The latest version of phpGACL can be obtained from:
27 * http://phpgacl.sourceforge.net/
35 * For examples, see example.php or the Administration interface,
36 * as it makes use of nearly every API Call.
40 * gacl_admin_api Custom Extended API Class
42 * Class gacl_api should be used for applications that must interface directly with
43 * phpGACL's data structures, objects, and rules.
46 * @author Mike Benoit <ipso@snappymail.ca>
50 class gacl_admin_api
extends gacl_api
{
53 * Administration interface settings
55 /** @var int Number of items to display per page in the phpGACL interface. */
56 var $_items_per_page = 100;
57 /** @var int Maximum number of items to display in a select box. Override to manage large collections via ACL Admin */
58 var $_max_select_box_items = 100;
59 /** @var int Maximum number of items to return in an ACL Search. */
60 var $_max_search_return_items = 100;
64 * Misc admin functions.
71 * Sends the user back to a passed URL, unless debug is enabled, then we don't redirect.
72 * If no URL is passed, try the REFERER
73 * @param string URL to return to.
75 function return_page($url="") {
76 global $_SERVER, $debug;
78 if (empty($url) AND !empty($_SERVER[HTTP_REFERER
])) {
79 $this->debug_text("return_page(): URL not set, using referer!");
80 $url = $_SERVER[HTTP_REFERER
];
83 if (!$debug OR $debug==0) {
84 header("Location: $url\n\n");
86 $this->debug_text("return_page(): URL: $url -- Referer: $_SERVER[HTTP_REFERRER]");
93 * Creates a basic array for Smarty to deal with paging large recordsets.
95 * @param ADORecordSet ADODB recordset.
97 function get_paging_data($rs) {
99 'prevpage' => $rs->absolutepage() - 1,
100 'currentpage' => $rs->absolutepage(),
101 'nextpage' => $rs->absolutepage() +
1,
102 'atfirstpage' => $rs->atfirstpage(),
103 'atlastpage' => $rs->atlastpage(),
104 'lastpageno' => $rs->lastpageno()