[admin_listhosts]

Description

Link: [admin_listhosts]
Author: Jason Huck
Category: Administration
Version: 8.x
License:
Posted: Nov. 21, 2006
Updated: Jan. 01, 0001
More by this author...
Returns an array of all enabled hosts for the given Lasso Site. Requires authentication as a user with permissions on Lasso's internal databases, i.e., with [auth_admin].

Parameters

none


Sample Usage

admin_listhosts;

-> array: (localhost), (DBServer)
						

Source Code

Click the "Download" button below to retrieve a copy of this tag, including the complete documentation and sample usage shown on this page. Place the downloaded ".inc" file in your LassoStartup folder, restart Lasso, and you can begin using this tag immediately.
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
define_tag(
	'listhosts',
	-namespace='admin_',
	-priority='replace',
	-description='Returns an array of all enabled hosts.'
);
	local('out' = array);

	local('sql' = '
		SELECT id, name
		FROM security_datasource_hosts 
		WHERE enabled = \'Y\'
		ORDER BY id
	');

	inline(
		-database='lasso_internal',
		-sql=#sql
	);
		rows;
			local('name') = field('name');
			
			local('sql' = '
				SELECT data
				FROM global_prefs
				WHERE store_key LIKE \'_admin_host_alias:' + field('id') + '%\'
			');
			
			inline( -sql=#sql);
				found_count ? #out->insert(field('data')) | #out->insert(#name);
			/inline;
		/rows;
	/inline;
	
	return(#out);
/define_tag;

 

Related Tags



Comments

none

Email:


Password:



Newest

Most Popular

Support tagSwap.net