forked from mantisbt-plugins/GoogleOauth
-
Notifications
You must be signed in to change notification settings - Fork 0
/
GoogleOauth.php
executable file
·52 lines (43 loc) · 1.27 KB
/
GoogleOauth.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
<?php
class GoogleOauthPlugin extends MantisPlugin {
function register() {
$this->name = 'Google Authentication Module';
$this->description = 'Add Google authentication to MantisBT.';
$this->page = 'config';
$this->version = '1.0';
$this->requires = array(
'MantisCore' => '1.2.0',
);
$this->author = 'Alleen Wang';
$this->contact = '[email protected]';
$this->url = 'http://alleen.tw';
}
function init() {
$this->cmv_pages = array(
'login_page.php'
);
$this->current_page = basename($_SERVER['PHP_SELF']);
}
function hooks() {
return array(
'EVENT_LAYOUT_PAGE_HEADER' => 'my_begin',
'EVENT_LAYOUT_RESOURCES' => 'my_resources'
);
}
function config() {
return array(
'clientId' => '',
'clientSecret' => '',
'redirect_uri' => '',
);
}
function my_begin($p_event) {
if (!in_array($this->current_page, $this->cmv_pages)) return '';
include ('pages/login_view.php');
return $p_javascript;
}
function my_resources($p_event) {
if (!in_array($this->current_page, $this->cmv_pages)) return '';
return '<script src="plugins/GoogleOauth/pages/assets/lib/jquery-2.1.3.min.js"></script>';
}
}