-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathLdapCacheFields.php
62 lines (54 loc) · 1.96 KB
/
LdapCacheFields.php
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
<?php
/**
* LdapCacheFields Plugin for MantisBT
* @link https://github.com/mantisbt-plugins/LdapCacheFields
*
* @author Marc-Antoine TURBET-DELOF<[email protected]>
* @copyright Copyright (c) 2020 Association Cocktail, Marc-Antoine TURBET-DELOF
*/
class LdapCacheFieldsPlugin extends MantisPlugin {
/**
* A method that populates the plugin information and minimum requirements.
* @return void
*/
function register() {
$this->name = plugin_lang_get( 'title' ); # Proper name of plugin
$this->description = plugin_lang_get( 'description' ); # Short description of the plugin
$this->page = 'config_page'; # Default plugin page
$this->version = '0.5'; # Plugin version string
$this->requires = array( # Plugin dependencies
'MantisCore' => '2.28', # Should always depend on an appropriate
# version of MantisBT
);
$this->author = 'Association Cocktail'; # Author/team name
$this->contact = '[email protected]'; # Author/team e-mail address
$this->url = 'https://asso-cocktail.fr'; # Support webpage
}
function hooks() {
return array(
'EVENT_LDAP_CACHE_ATTRS' => 'fields'
);
}
function schema() {
return array(
array('CreateTableSQL',
array( plugin_table('field', 'LdapCacheFields'), "
id I NOTNULL UNSIGNED AUTOINCREMENT PRIMARY,
title C(32) NOTNULL DEFAULT '',
name C(32) NOTNULL DEFAULT ''"
)
)
);
}
function fields( $p_event ) {
$t_field_table = plugin_table('field');
$t_fields_array = array();
$t_query = "SELECT name
FROM $t_field_table";
$t_result = db_query($t_query);
while( $t_row = db_fetch_array( $t_result ) ) {
array_push( $t_fields_array, $t_row['name'] );
}
return $t_fields_array;
}
}