Révision 32700c57
Ajouté par Assos Assos il y a environ 5 ans
drupal7/sites/all/modules/ldap/ldap_query/ldap_query.module | ||
---|---|---|
6 | 6 |
|
7 | 7 |
define('LDAP_QUERY_MENU_BASE_PATH', 'admin/config/people/ldap'); |
8 | 8 |
define('LDAP_QUERY_INDEX_BASE_PATH', 'admin/config/people/ldap/query'); |
9 |
define('LDAP_QUERY_MENU_BASE_PATH_PARTS', 4); // for argument offsets
|
|
10 |
|
|
9 |
// For argument offsets.
|
|
10 |
define('LDAP_QUERY_MENU_BASE_PATH_PARTS', 4); |
|
11 | 11 |
|
12 |
/** |
|
13 |
* |
|
14 |
*/ |
|
12 | 15 |
function ldap_query_menu() { |
13 | 16 |
$menu_offset = 4; |
14 | 17 |
|
15 |
$items['admin/config/people/ldap/query'] = array(
|
|
18 |
$items['admin/config/people/ldap/query'] = [
|
|
16 | 19 |
'title' => 'Queries', |
17 | 20 |
'page callback' => 'ldap_query_index', |
18 |
'page arguments' => array(),
|
|
21 |
'page arguments' => [],
|
|
19 | 22 |
'weight' => 6, |
20 | 23 |
'type' => MENU_LOCAL_TASK, |
21 |
'access arguments' => array('administer site configuration'),
|
|
24 |
'access arguments' => ['administer site configuration'],
|
|
22 | 25 |
'file' => 'ldap_query.admin.inc', |
23 |
);
|
|
26 |
];
|
|
24 | 27 |
|
25 |
$items['admin/config/people/ldap/query/list'] = array(
|
|
28 |
$items['admin/config/people/ldap/query/list'] = [
|
|
26 | 29 |
'title' => 'Queries', |
27 | 30 |
'type' => MENU_DEFAULT_LOCAL_TASK, |
28 |
);
|
|
31 |
];
|
|
29 | 32 |
|
30 |
$items['admin/config/people/ldap/query/add'] = array(
|
|
33 |
$items['admin/config/people/ldap/query/add'] = [
|
|
31 | 34 |
'title' => 'Add LDAP Query', |
32 | 35 |
'page callback' => 'drupal_get_form', |
33 |
'page arguments' => array('ldap_query_admin_form', 'add'),
|
|
36 |
'page arguments' => ['ldap_query_admin_form', 'add'],
|
|
34 | 37 |
'type' => MENU_LOCAL_TASK + MENU_CONTEXT_INLINE, |
35 | 38 |
'weight' => 3, |
36 |
'access arguments' => array('administer site configuration'),
|
|
39 |
'access arguments' => ['administer site configuration'],
|
|
37 | 40 |
'file' => 'ldap_query.admin.inc', |
38 |
);
|
|
41 |
];
|
|
39 | 42 |
|
40 |
$items['admin/config/people/ldap/query/edit/%'] = array(
|
|
43 |
$items['admin/config/people/ldap/query/edit/%'] = [
|
|
41 | 44 |
'title' => 'Edit LDAP Query', |
42 | 45 |
'page callback' => 'drupal_get_form', |
43 |
'page arguments' => array('ldap_query_admin_form', 'edit', $menu_offset + 2),
|
|
44 |
'access arguments' => array('administer site configuration'),
|
|
46 |
'page arguments' => ['ldap_query_admin_form', 'edit', $menu_offset + 2],
|
|
47 |
'access arguments' => ['administer site configuration'],
|
|
45 | 48 |
'file' => 'ldap_query.admin.inc', |
46 |
);
|
|
49 |
];
|
|
47 | 50 |
|
48 |
$items['admin/config/people/ldap/query/test/%'] = array(
|
|
51 |
$items['admin/config/people/ldap/query/test/%'] = [
|
|
49 | 52 |
'title' => 'Test LDAP Query', |
50 | 53 |
'page callback' => 'ldap_query_test', |
51 |
'page arguments' => array($menu_offset + 2),
|
|
52 |
'access arguments' => array('administer site configuration'),
|
|
54 |
'page arguments' => [$menu_offset + 2],
|
|
55 |
'access arguments' => ['administer site configuration'],
|
|
53 | 56 |
'file' => 'ldap_query.admin.inc', |
54 |
);
|
|
57 |
];
|
|
55 | 58 |
|
56 |
$items['admin/config/people/ldap/query/delete/%'] = array(
|
|
59 |
$items['admin/config/people/ldap/query/delete/%'] = [
|
|
57 | 60 |
'title' => 'Delete LDAP Query', |
58 | 61 |
'page callback' => 'drupal_get_form', |
59 |
'page arguments' => array('ldap_query_admin_delete', $menu_offset + 1, $menu_offset + 2),
|
|
60 |
'access arguments' => array('administer site configuration'),
|
|
62 |
'page arguments' => ['ldap_query_admin_delete', $menu_offset + 1, $menu_offset + 2],
|
|
63 |
'access arguments' => ['administer site configuration'],
|
|
61 | 64 |
'file' => 'ldap_query.admin.inc', |
62 |
);
|
|
65 |
];
|
|
63 | 66 |
|
64 |
$items['admin/config/people/ldap/query/enable/%'] = array(
|
|
67 |
$items['admin/config/people/ldap/query/enable/%'] = [
|
|
65 | 68 |
'title' => 'Enable LDAP Query', |
66 | 69 |
'page callback' => 'drupal_get_form', |
67 |
'page arguments' => array('ldap_query_admin_enable_disable', $menu_offset + 1, $menu_offset + 2),
|
|
68 |
'access arguments' => array('administer site configuration'),
|
|
70 |
'page arguments' => ['ldap_query_admin_enable_disable', $menu_offset + 1, $menu_offset + 2],
|
|
71 |
'access arguments' => ['administer site configuration'],
|
|
69 | 72 |
'file' => 'ldap_query.admin.inc', |
70 |
);
|
|
73 |
];
|
|
71 | 74 |
|
72 |
$items['admin/config/people/ldap/query/disable/%'] = array(
|
|
75 |
$items['admin/config/people/ldap/query/disable/%'] = [
|
|
73 | 76 |
'title' => 'Enable LDAP Query', |
74 | 77 |
'page callback' => 'drupal_get_form', |
75 |
'page arguments' => array('ldap_query_admin_enable_disable', $menu_offset + 1, $menu_offset + 2),
|
|
76 |
'access arguments' => array('administer site configuration'),
|
|
78 |
'page arguments' => ['ldap_query_admin_enable_disable', $menu_offset + 1, $menu_offset + 2],
|
|
79 |
'access arguments' => ['administer site configuration'],
|
|
77 | 80 |
'file' => 'ldap_query.admin.inc', |
78 |
);
|
|
81 |
];
|
|
79 | 82 |
|
80 | 83 |
return $items; |
81 | 84 |
} |
82 | 85 |
|
83 |
|
|
84 |
|
|
86 |
/** |
|
87 |
* |
|
88 |
*/ |
|
85 | 89 |
function ldap_query_theme() { |
86 |
return array(
|
|
87 |
'ldap_query_list' => array(
|
|
88 |
'variables' => array('ldap_query' => NULL, 'actions' => TRUE, 'type' => 'table'),
|
|
90 |
return [
|
|
91 |
'ldap_query_list' => [
|
|
92 |
'variables' => ['ldap_query' => NULL, 'actions' => TRUE, 'type' => 'table'],
|
|
89 | 93 |
'render element' => 'element', |
90 |
'file' => 'ldap_query.theme.inc' |
|
91 |
),
|
|
92 |
'ldap_query' => array(
|
|
93 |
'variables' => array('ldap_server' => NULL, 'actions' => FALSE, 'type' => 'detail'),
|
|
94 |
'file' => 'ldap_query.theme.inc',
|
|
95 |
],
|
|
96 |
'ldap_query' => [
|
|
97 |
'variables' => ['ldap_server' => NULL, 'actions' => FALSE, 'type' => 'detail'],
|
|
94 | 98 |
'render element' => 'element', |
95 |
'file' => 'ldap_query.theme.inc' |
|
96 |
),
|
|
97 |
'ldap_query_results' => array(
|
|
98 |
'variables' => array('ldap_query' => NULL, 'result' => FALSE, 'show_query' => TRUE),
|
|
99 |
'file' => 'ldap_query.theme.inc',
|
|
100 |
],
|
|
101 |
'ldap_query_results' => [
|
|
102 |
'variables' => ['ldap_query' => NULL, 'result' => FALSE, 'show_query' => TRUE],
|
|
99 | 103 |
'render element' => 'element', |
100 |
'file' => 'ldap_query.theme.inc' |
|
101 |
),
|
|
102 |
);
|
|
104 |
'file' => 'ldap_query.theme.inc',
|
|
105 |
],
|
|
106 |
];
|
|
103 | 107 |
} |
104 | 108 |
|
109 |
/** |
|
110 |
* |
|
111 |
*/ |
|
105 | 112 |
function ldap_query_cache_clear() { |
106 | 113 |
$discard = ldap_query_get_queries(NULL, 'all', FALSE, TRUE); |
107 | 114 |
} |
115 |
|
|
108 | 116 |
/** |
117 |
* Return ldap query objects. |
|
109 | 118 |
* |
110 |
* return ldap query objects |
|
119 |
* @param string $qid |
|
120 |
* @param string $type |
|
121 |
* 'all', 'enabled',. |
|
122 |
* @param bool $flatten |
|
123 |
* signifies if array or single object returned. Only works if sid is specified. |
|
124 |
* @param bool $reset |
|
125 |
* do not use cached or static result. |
|
111 | 126 |
* |
112 |
* @param alphanum $qid |
|
113 |
* @param enum $type 'all', 'enabled', |
|
114 |
* @param boolean $flatten signifies if array or single object returned. Only works if sid is specified |
|
115 |
* @param boolean $reset do not use cached or static result |
|
116 |
* @return - array of server conf object keyed on sid |
|
117 |
* - single server conf object (if flatten == TRUE) |
|
127 |
* @return array |
|
128 |
* of server conf object keyed on sid |
|
129 |
* - single server conf object (if flatten == TRUE) |
|
118 | 130 |
*/ |
119 | 131 |
function ldap_query_get_queries($qid = NULL, $type, $flatten = FALSE, $reset = FALSE) { |
120 | 132 |
ldap_servers_module_load_include('inc', 'ldap_query', 'ldap_query'); |
121 |
if (variable_get('ldap_simpletest', FALSE)) { |
|
122 |
return _ldap_query_get_simpletest_queries($qid, $type, $flatten, $reset); |
|
123 |
} |
|
124 |
else { |
|
125 |
return _ldap_query_get_queries($qid, $type, $flatten, $reset); |
|
126 |
} |
|
133 |
return _ldap_query_get_queries($qid, $type, $flatten, $reset); |
|
127 | 134 |
} |
128 | 135 |
|
136 |
/** |
|
137 |
* |
|
138 |
*/ |
|
129 | 139 |
function ldap_query_fields() { |
130 | 140 |
ldap_servers_module_load_include('php', 'ldap_query', 'LdapQuery.class'); |
131 | 141 |
return LdapQuery::fields(); |
132 | 142 |
} |
133 | 143 |
|
134 |
|
|
144 |
/** |
|
145 |
* |
|
146 |
*/ |
|
135 | 147 |
function ldap_query_help($path, $arg) { |
136 | 148 |
|
137 | 149 |
$help = '<h3>' . t('LDAP Query Module') . '</h3><p>' . |
Formats disponibles : Unified diff
Weekly update of contrib modules