-
Notifications
You must be signed in to change notification settings - Fork 16
/
GoogleOauth.php
executable file
·79 lines (69 loc) · 1.78 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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
<?php
class GoogleOauthPlugin extends MantisPlugin {
var $cmv_pages;
var $current_page;
function register() {
$this->name = 'Google Authentication Module';
$this->description = 'Add Google authentication to MantisBT.';
$this->page = 'config';
$this->version = '2.1';
$this->requires = array(
'MantisCore' => '2.0.0',
);
$this->author = 'Alleen Wang';
$this->contact = '[email protected]';
$this->url = 'https://github.com/mantisbt-plugins/GoogleOauth';
}
function init() {
$this->cmv_pages = array(
'login_page.php',
'login_password_page.php'
);
$this->current_page = basename( $_SERVER['PHP_SELF'] );
}
function hooks() {
return array(
'EVENT_LAYOUT_RESOURCES' => 'resources'
);
}
function config() {
return array(
'clientId' => '',
'clientSecret' => '',
'redirect_uri' => '',
);
}
function resources() {
if ( ! in_array( $this->current_page, $this->cmv_pages ) ) {
return '';
}
return '
<meta name="redirectUri" content="' . plugin_config_get( 'redirect_uri' ) . '" />
<meta name="clientId" content="' . plugin_config_get( 'clientId' ) . '" />
<style>
#plugin_googleoauth {
margin-top:20px;
padding-top:20px;
border-top: 1px solid #CCC;
text-align:right;
}
#plugin_googleoauth a {
background: url('.plugin_file("google_signin.png").') -0 -0;;
text-indent: 100%;
white-space: nowrap;
overflow: hidden;
display: inline-block;
height: 46px;
width: 191px;
margin-right:25px;
}
#plugin_googleoauth a:hover {
background: url('.plugin_file("google_signin.png").') -0 -46px;
width: 191px;
height: 46px;
}
</style>
<script type="text/javascript" src="'.plugin_file("plugin.js").'"></script>
';
}
}