Skip to content

Commit 0b7da7e

Browse files
authored
Merge pull request #63 from brlumen/master-2.6.x
Fix eol in branch master-2.6.x
2 parents d1b781b + 4427250 commit 0b7da7e

File tree

4 files changed

+129
-128
lines changed

4 files changed

+129
-128
lines changed

.gitattributes

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
* text=auto eol=lf

.gitignore

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1-
/nbproject/
2-
/old_files/
1+
/nbproject/
2+
/old_files/
33
/vendor/
Lines changed: 84 additions & 84 deletions
Original file line numberDiff line numberDiff line change
@@ -1,84 +1,84 @@
1-
<?php
2-
3-
# Copyright (c) 2018 Grigoriy Ermolaev (igflocal@gmail.com)
4-
# Calendar for MantisBT is free software:
5-
# you can redistribute it and/or modify it under the terms of the GNU
6-
# General Public License as published by the Free Software Foundation,
7-
# either version 2 of the License, or (at your option) any later version.
8-
#
9-
# Calendar plugin for for MantisBT is distributed in the hope
10-
# that it will be useful, but WITHOUT ANY WARRANTY; without even the
11-
# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
12-
# See the GNU General Public License for more details.
13-
#
14-
# You should have received a copy of the GNU General Public License
15-
# along with Customer management plugin for MantisBT.
16-
# If not, see <http://www.gnu.org/licenses/>.
17-
18-
/**
19-
* Check if the user has the specified access level for the given bug
20-
* and deny access to the page if not
21-
* @see access_has_bug_level
22-
* @param integer $p_access_level Integer representing access level.
23-
* @param integer $p_event_id Integer representing bug id to check access against.
24-
* @param integer|null $p_user_id Integer representing user id, defaults to null to use current user.
25-
* @return void
26-
* @access public
27-
*/
28-
function access_ensure_event_level( $p_access_level, $p_event_id, $p_user_id = null ) {
29-
if( !access_has_event_level( $p_access_level, $p_event_id, $p_user_id ) ) {
30-
access_denied();
31-
}
32-
}
33-
34-
/**
35-
* Check the current user's access against the given value and return true
36-
* if the user's access is equal to or higher, false otherwise.
37-
* This function looks up the bug's project and performs an access check
38-
* against that project
39-
* @param integer $p_access_level Integer representing access level.
40-
* @param integer $p_event_id Integer representing bug id to check access against.
41-
* @param integer|null $p_user_id Integer representing user id, defaults to null to use current user.
42-
* @return boolean whether user has access level specified
43-
* @access public
44-
*/
45-
function access_has_event_level( $p_access_level, $p_event_id, $p_user_id = null ) {
46-
if( $p_user_id === null ) {
47-
$p_user_id = auth_get_current_user_id();
48-
}
49-
50-
# Deal with not logged in silently in this case
51-
# @@@ we may be able to remove this and just error
52-
# and once we default to anon login, we can remove it for sure
53-
if( empty( $p_user_id ) && !auth_is_user_authenticated() ) {
54-
return false;
55-
}
56-
57-
$t_project_id = event_get_field( $p_event_id, 'project_id' );
58-
$t_event_is_user_reporter = event_is_user_reporter( $p_event_id, $p_user_id );
59-
$t_access_level = access_get_project_level( $t_project_id, $p_user_id );
60-
61-
# check limit_Reporter (Issue #4769)
62-
# reporters can view just issues they reported
63-
$t_limit_reporters = config_get( 'limit_reporters', null, $p_user_id, $t_project_id );
64-
if( $t_limit_reporters && !$t_event_is_user_reporter ) {
65-
# Here we only need to check that the current user has an access level
66-
# higher than the lowest needed to report issues (report_bug_threshold).
67-
# To improve performance, esp. when processing for several projects, we
68-
# build a static array holding that threshold for each project
69-
static $s_thresholds = array();
70-
if( !isset( $s_thresholds[$t_project_id] ) ) {
71-
$t_report_event_threshold = plugin_config_get( 'report_event_threshold', null, $p_user_id, $t_project_id );
72-
if( empty( $t_report_event_threshold ) ) {
73-
$s_thresholds[$t_project_id] = NOBODY;
74-
} else {
75-
$s_thresholds[$t_project_id] = access_threshold_min_level( $t_report_event_threshold ) + 1;
76-
}
77-
}
78-
if( !access_compare_level( $t_access_level, $s_thresholds[$t_project_id] ) ) {
79-
return false;
80-
}
81-
}
82-
83-
return access_compare_level( $t_access_level, $p_access_level );
84-
}
1+
<?php
2+
3+
# Copyright (c) 2018 Grigoriy Ermolaev (igflocal@gmail.com)
4+
# Calendar for MantisBT is free software:
5+
# you can redistribute it and/or modify it under the terms of the GNU
6+
# General Public License as published by the Free Software Foundation,
7+
# either version 2 of the License, or (at your option) any later version.
8+
#
9+
# Calendar plugin for for MantisBT is distributed in the hope
10+
# that it will be useful, but WITHOUT ANY WARRANTY; without even the
11+
# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
12+
# See the GNU General Public License for more details.
13+
#
14+
# You should have received a copy of the GNU General Public License
15+
# along with Customer management plugin for MantisBT.
16+
# If not, see <http://www.gnu.org/licenses/>.
17+
18+
/**
19+
* Check if the user has the specified access level for the given bug
20+
* and deny access to the page if not
21+
* @see access_has_bug_level
22+
* @param integer $p_access_level Integer representing access level.
23+
* @param integer $p_event_id Integer representing bug id to check access against.
24+
* @param integer|null $p_user_id Integer representing user id, defaults to null to use current user.
25+
* @return void
26+
* @access public
27+
*/
28+
function access_ensure_event_level( $p_access_level, $p_event_id, $p_user_id = null ) {
29+
if( !access_has_event_level( $p_access_level, $p_event_id, $p_user_id ) ) {
30+
access_denied();
31+
}
32+
}
33+
34+
/**
35+
* Check the current user's access against the given value and return true
36+
* if the user's access is equal to or higher, false otherwise.
37+
* This function looks up the bug's project and performs an access check
38+
* against that project
39+
* @param integer $p_access_level Integer representing access level.
40+
* @param integer $p_event_id Integer representing bug id to check access against.
41+
* @param integer|null $p_user_id Integer representing user id, defaults to null to use current user.
42+
* @return boolean whether user has access level specified
43+
* @access public
44+
*/
45+
function access_has_event_level( $p_access_level, $p_event_id, $p_user_id = null ) {
46+
if( $p_user_id === null ) {
47+
$p_user_id = auth_get_current_user_id();
48+
}
49+
50+
# Deal with not logged in silently in this case
51+
# @@@ we may be able to remove this and just error
52+
# and once we default to anon login, we can remove it for sure
53+
if( empty( $p_user_id ) && !auth_is_user_authenticated() ) {
54+
return false;
55+
}
56+
57+
$t_project_id = event_get_field( $p_event_id, 'project_id' );
58+
$t_event_is_user_reporter = event_is_user_reporter( $p_event_id, $p_user_id );
59+
$t_access_level = access_get_project_level( $t_project_id, $p_user_id );
60+
61+
# check limit_Reporter (Issue #4769)
62+
# reporters can view just issues they reported
63+
$t_limit_reporters = config_get( 'limit_reporters', null, $p_user_id, $t_project_id );
64+
if( $t_limit_reporters && !$t_event_is_user_reporter ) {
65+
# Here we only need to check that the current user has an access level
66+
# higher than the lowest needed to report issues (report_bug_threshold).
67+
# To improve performance, esp. when processing for several projects, we
68+
# build a static array holding that threshold for each project
69+
static $s_thresholds = array();
70+
if( !isset( $s_thresholds[$t_project_id] ) ) {
71+
$t_report_event_threshold = plugin_config_get( 'report_event_threshold', null, $p_user_id, $t_project_id );
72+
if( empty( $t_report_event_threshold ) ) {
73+
$s_thresholds[$t_project_id] = NOBODY;
74+
} else {
75+
$s_thresholds[$t_project_id] = access_threshold_min_level( $t_report_event_threshold ) + 1;
76+
}
77+
}
78+
if( !access_compare_level( $t_access_level, $s_thresholds[$t_project_id] ) ) {
79+
return false;
80+
}
81+
}
82+
83+
return access_compare_level( $t_access_level, $p_access_level );
84+
}
Lines changed: 42 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -1,42 +1,42 @@
1-
<?php
2-
/*
3-
* To change this license header, choose License Headers in Project Properties.
4-
* To change this template file, choose Tools | Templates
5-
* and open the template in the editor.
6-
*/
7-
8-
/**
9-
* Description of ColumnTime
10-
*
11-
* @author ermolaev
12-
*/
13-
class TimeColumn extends ColumnForm {
14-
15-
function __construct() {
16-
parent::__construct();
17-
$this->title_text = plugin_lang_get( 'time_event' );
18-
$t_date = self::$time_period_list[count( self::$time_period_list ) - 1];
19-
$this->last_row_text = gmdate( "H:i", $t_date );
20-
}
21-
22-
protected function html_column_param() {
23-
return '<td class="column-time-td">';
24-
}
25-
26-
protected function html_hour_text( $p_time ) {
27-
$t_result = '';
28-
29-
// if( $p_time % (Calendar::$min_segment_time_in_hour * 2) == 0 ) {
30-
// $t_result .= gmdate( "H:i", $p_time );
31-
// }
32-
if( self::$intervals_per_hour % 2 == 0 ) {
33-
if( ( $p_time / self::$min_segment_time_in_hour ) % 2 == 0 ) {
34-
$t_result .= gmdate( "H:i", $p_time );
35-
}
36-
} elseif( ( $p_time / self::$min_segment_time_in_hour ) % 2 != 0 ) {
37-
$t_result .= gmdate( "H:i", $p_time );
38-
}
39-
return $t_result;
40-
}
41-
42-
}
1+
<?php
2+
/*
3+
* To change this license header, choose License Headers in Project Properties.
4+
* To change this template file, choose Tools | Templates
5+
* and open the template in the editor.
6+
*/
7+
8+
/**
9+
* Description of ColumnTime
10+
*
11+
* @author ermolaev
12+
*/
13+
class TimeColumn extends ColumnForm {
14+
15+
function __construct() {
16+
parent::__construct();
17+
$this->title_text = plugin_lang_get( 'time_event' );
18+
$t_date = self::$time_period_list[count( self::$time_period_list ) - 1];
19+
$this->last_row_text = gmdate( "H:i", $t_date );
20+
}
21+
22+
protected function html_column_param() {
23+
return '<td class="column-time-td">';
24+
}
25+
26+
protected function html_hour_text( $p_time ) {
27+
$t_result = '';
28+
29+
// if( $p_time % (Calendar::$min_segment_time_in_hour * 2) == 0 ) {
30+
// $t_result .= gmdate( "H:i", $p_time );
31+
// }
32+
if( self::$intervals_per_hour % 2 == 0 ) {
33+
if( ( $p_time / self::$min_segment_time_in_hour ) % 2 == 0 ) {
34+
$t_result .= gmdate( "H:i", $p_time );
35+
}
36+
} elseif( ( $p_time / self::$min_segment_time_in_hour ) % 2 != 0 ) {
37+
$t_result .= gmdate( "H:i", $p_time );
38+
}
39+
return $t_result;
40+
}
41+
42+
}

0 commit comments

Comments
 (0)