-
Notifications
You must be signed in to change notification settings - Fork 9
/
Copy pathFAQ.php
97 lines (84 loc) · 2.75 KB
/
FAQ.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
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
<?php
class FAQPlugin extends MantisPlugin {
function register() {
$this->name = 'FAQ';
$this->description = 'Adds Frequently Asked Questions to your Mantis installation.';
$this->version = '2.05';
$this->requires = array('MantisCore' => '2.0.0',);
$this->author = 'Cas Nuy / based upon scripts from [email protected]';
$this->contact = 'Cas-at-nuy.info';
$this->url = 'http://www.nuy.info';
$this->page = 'config';
}
/**
* Default plugin configuration.
*/
function config() {
return array(
'promote_text' => ON,
'promote_threshold' => 55,
'project_text' => OFF,
'faq_view_window' => OFF,
'faq_view_check' => OFF,
'faq_view_threshold'=> 10,
);
}
function init() {
plugin_event_hook( 'EVENT_MENU_MAIN', 'mainmenu' );
plugin_event_hook( 'EVENT_MENU_ISSUE', 'faqmenu' );
}
function mainmenu() {
$links = array();
$links[] = array('title' => lang_get("menu_faq_link","FAQ"),'url' => plugin_page("faq_menu_page", true),'icon' => 'fa-user-secret');
return $links;
}
function faqmenu() {
if (ON == plugin_config_get('promote_text') ){
$bugid = gpc_get_int( 'id' );
if ( access_has_bug_level( plugin_config_get( 'promote_threshold' ), $bugid ) ){
$t_bug_p = bug_get( $bugid, true ) ;
if ( OFF == plugin_config_get( 'project_text')) {
$proj_id = 0 ;
} else{
$proj_id = $t_bug_p->project_id ;
}
$answer = urlencode($t_bug_p->description) ;
$answer .= " " ;
$answer .= urlencode($t_bug_p->additional_information) ;
$question = category_full_name( $t_bug_p->category_id ) ;
$question .= " -> " ;
$question .= urlencode($t_bug_p->summary) ;
if (ON == plugin_config_get('faq_view_check') ){
$import_page ='faq_add_page2.php';
} else {
$import_page ='faq_add.php';
}
$import_page .='&question=';
$import_page .= $question ;
$import_page .='&answere=';
$import_page .=$answer ;
$import_page .='&project_id=';
$import_page .= $proj_id;
if (ON == plugin_config_get('faq_view_check') ){
return array( plugin_lang_get( 'import_faq' )=>plugin_page( $import_page ). '" target=_new>' );
} else {
return array( plugin_lang_get( 'import_faq' )=>plugin_page( $import_page ) );
}
}
}
}
function schema() {
return array(
array( 'CreateTableSQL', array( plugin_table( 'results' ), "
id I NOTNULL UNSIGNED ZEROFILL AUTOINCREMENT PRIMARY,
project_id I NOTNULL UNSIGNED ZEROFILL ,
poster_id I NOTNULL UNSIGNED ZEROFILL ,
date_posted T NOTNULL,
last_modified T NOTNULL,
question C(250) DEFAULT \" '' \",
answere XL NOTNULL DEFAULT \" '' \",
view_access I NOTNULL UNSIGNED ZEROFILL DEFAULT \" '10' \"
" ) ),
);
}
}