| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
package PHP::MySource::Session; |
|
2
|
|
|
|
|
|
|
$VERSION = 0.03; |
|
3
|
|
|
|
|
|
|
|
|
4
|
1
|
|
|
1
|
|
29401
|
use strict; |
|
|
1
|
|
|
|
|
1
|
|
|
|
1
|
|
|
|
|
40
|
|
|
5
|
1
|
|
|
1
|
|
4
|
use vars qw( $AUTOLOAD ); |
|
|
1
|
|
|
|
|
2
|
|
|
|
1
|
|
|
|
|
59
|
|
|
6
|
|
|
|
|
|
|
|
|
7
|
1
|
|
|
1
|
|
6
|
use Carp; |
|
|
1
|
|
|
|
|
6
|
|
|
|
1
|
|
|
|
|
89
|
|
|
8
|
1
|
|
|
1
|
|
1040
|
use Data::Dumper; |
|
|
1
|
|
|
|
|
10139
|
|
|
|
1
|
|
|
|
|
66
|
|
|
9
|
1
|
|
|
1
|
|
687
|
use PHP::Session; |
|
|
1
|
|
|
|
|
17149
|
|
|
|
1
|
|
|
|
|
16
|
|
|
10
|
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
sub new |
|
12
|
|
|
|
|
|
|
{ |
|
13
|
0
|
|
|
0
|
0
|
|
my ($class, %args) = @_; |
|
14
|
|
|
|
|
|
|
|
|
15
|
0
|
|
0
|
|
|
|
bless |
|
|
|
|
0
|
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
16
|
|
|
|
|
|
|
{ _mysource_root => $args{'mysource_root'} || croak('You must supply your MySource installation directory.'), |
|
17
|
|
|
|
|
|
|
_mysource_cache => $args{'mysource_cache'} || $args{'mysource_root'} . '/cache', |
|
18
|
|
|
|
|
|
|
_session_id => $args{'session_id'} || croak('You must supply a MySource session id.'), |
|
19
|
|
|
|
|
|
|
_session_obj => new PHP::Session($args{'session_id'}, {save_path=>$args{'mysource_cache'} || $args{'mysource_root'} . '/cache'}) |
|
20
|
|
|
|
|
|
|
}, $class; |
|
21
|
|
|
|
|
|
|
} |
|
22
|
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
{ |
|
24
|
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
my %_attrs = |
|
26
|
|
|
|
|
|
|
( _mysource_root => 'read', |
|
27
|
|
|
|
|
|
|
_mysource_cache => 'read', |
|
28
|
|
|
|
|
|
|
_session_id => 'read' |
|
29
|
|
|
|
|
|
|
); |
|
30
|
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
sub _accessible |
|
32
|
|
|
|
|
|
|
{ |
|
33
|
0
|
|
|
0
|
|
|
my ($self, $attr, $mode) = @_; |
|
34
|
1
|
|
|
1
|
|
163
|
no warnings; |
|
|
1
|
|
|
|
|
2
|
|
|
|
1
|
|
|
|
|
55
|
|
|
35
|
0
|
|
|
|
|
|
$_attrs{$attr} =~ /$mode/; |
|
36
|
1
|
|
|
1
|
|
6
|
use warnings; |
|
|
1
|
|
|
|
|
1
|
|
|
|
1
|
|
|
|
|
100
|
|
|
37
|
|
|
|
|
|
|
} |
|
38
|
|
|
|
|
|
|
} |
|
39
|
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
{ |
|
41
|
|
|
|
|
|
|
my %_parent_attrs = |
|
42
|
|
|
|
|
|
|
( |
|
43
|
|
|
|
|
|
|
registered_name => 'read', |
|
44
|
|
|
|
|
|
|
editor_pages => 'read', |
|
45
|
|
|
|
|
|
|
print_errors => 'read', |
|
46
|
|
|
|
|
|
|
result_message => 'read', |
|
47
|
|
|
|
|
|
|
user => 'read', |
|
48
|
|
|
|
|
|
|
external_vars => 'read', |
|
49
|
|
|
|
|
|
|
error_call => 'read', |
|
50
|
|
|
|
|
|
|
login_attempts => 'read', |
|
51
|
|
|
|
|
|
|
access_groups => 'read', |
|
52
|
|
|
|
|
|
|
error_msg => 'read', |
|
53
|
|
|
|
|
|
|
login_key => 'read', |
|
54
|
|
|
|
|
|
|
last_access => 'read' |
|
55
|
|
|
|
|
|
|
); |
|
56
|
|
|
|
|
|
|
|
|
57
|
|
|
|
|
|
|
sub _parent_accessible |
|
58
|
|
|
|
|
|
|
{ |
|
59
|
0
|
|
|
0
|
|
|
my ($self, $attr, $mode) = @_; |
|
60
|
1
|
|
|
1
|
|
5
|
no warnings; |
|
|
1
|
|
|
|
|
3
|
|
|
|
1
|
|
|
|
|
45
|
|
|
61
|
0
|
|
|
|
|
|
$_parent_attrs{$attr} =~ /$mode/; |
|
62
|
1
|
|
|
1
|
|
4
|
use warnings; |
|
|
1
|
|
|
|
|
2
|
|
|
|
1
|
|
|
|
|
160
|
|
|
63
|
|
|
|
|
|
|
} |
|
64
|
|
|
|
|
|
|
} |
|
65
|
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
sub is_logged_in |
|
67
|
|
|
|
|
|
|
{ |
|
68
|
0
|
|
|
0
|
0
|
|
my $self = shift; |
|
69
|
|
|
|
|
|
|
|
|
70
|
0
|
|
|
|
|
|
$self->{'_session_obj'}->{'_data'}->{'SESSION'}->{'user'}; |
|
71
|
|
|
|
|
|
|
} |
|
72
|
|
|
|
|
|
|
|
|
73
|
|
|
|
|
|
|
# Just dump out all of the Session variables |
|
74
|
|
|
|
|
|
|
sub dump |
|
75
|
|
|
|
|
|
|
{ |
|
76
|
0
|
|
|
0
|
0
|
|
my $self = shift; |
|
77
|
|
|
|
|
|
|
|
|
78
|
0
|
|
|
|
|
|
Dumper($self->{'_session_obj'}->{'_data'}->{'SESSION'}); |
|
79
|
|
|
|
|
|
|
} |
|
80
|
|
|
|
|
|
|
|
|
81
|
|
|
|
|
|
|
sub AUTOLOAD |
|
82
|
|
|
|
|
|
|
{ |
|
83
|
1
|
|
|
1
|
|
5
|
no strict "refs"; |
|
|
1
|
|
|
|
|
2
|
|
|
|
1
|
|
|
|
|
451
|
|
|
84
|
0
|
|
|
0
|
|
|
my ($self, $newval) = @_; |
|
85
|
|
|
|
|
|
|
|
|
86
|
|
|
|
|
|
|
# was a get method called? |
|
87
|
0
|
0
|
0
|
|
|
|
if ($AUTOLOAD =~ /.*::get(_\w+)/ && $self->_accessible($1, 'read')) |
|
88
|
|
|
|
|
|
|
{ |
|
89
|
0
|
|
|
|
|
|
my $attr_name = $1; |
|
90
|
0
|
|
|
0
|
|
|
*{$AUTOLOAD} = sub { return $_[0]->{$attr_name} }; |
|
|
0
|
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
91
|
0
|
|
|
|
|
|
return $self->{$attr_name}; |
|
92
|
|
|
|
|
|
|
} |
|
93
|
|
|
|
|
|
|
|
|
94
|
|
|
|
|
|
|
# was a set method called? |
|
95
|
0
|
0
|
0
|
|
|
|
if ($AUTOLOAD =~ /.*::set(_\w+)/ && $self->_accessible($1, 'write')) |
|
96
|
|
|
|
|
|
|
{ |
|
97
|
0
|
|
|
|
|
|
my $attr_name = $1; |
|
98
|
0
|
|
|
0
|
|
|
*{$AUTOLOAD} = sub { $_[0]->{$attr_name} = $_[1]; return }; |
|
|
0
|
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
99
|
0
|
|
|
|
|
|
$self->{$1} = $newval; |
|
100
|
|
|
|
|
|
|
return |
|
101
|
0
|
|
|
|
|
|
} |
|
102
|
|
|
|
|
|
|
|
|
103
|
|
|
|
|
|
|
# was a get method called on the parent obj? |
|
104
|
0
|
0
|
0
|
|
|
|
if ($AUTOLOAD =~ /.*::get_(\w+)/ && $self->_parent_accessible($1, 'read')) |
|
105
|
|
|
|
|
|
|
{ |
|
106
|
0
|
|
|
|
|
|
my $attr_name = $1; |
|
107
|
|
|
|
|
|
|
#print $self->{'_session_obj'}->{"_data"}->{'SESSION'}->{$attr_name}; |
|
108
|
0
|
|
|
0
|
|
|
*{$AUTOLOAD} = sub { return $_[0]->{'_session_obj'}->{'_data'}->{'SESSION'}->{$attr_name} }; |
|
|
0
|
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
109
|
0
|
|
|
|
|
|
return $self->{'_session_obj'}->{'_data'}->{'SESSION'}->{$attr_name}; |
|
110
|
|
|
|
|
|
|
} |
|
111
|
|
|
|
|
|
|
|
|
112
|
|
|
|
|
|
|
# was a set method called on the parent obj? |
|
113
|
0
|
0
|
0
|
|
|
|
if ($AUTOLOAD =~ /.*::set_(\w+)/ && $self->_parent_accessible($1, 'write')) |
|
114
|
|
|
|
|
|
|
{ |
|
115
|
0
|
|
|
|
|
|
my $attr_name = $1; |
|
116
|
0
|
|
|
0
|
|
|
*{$AUTOLOAD} = sub { $_[0]->{'_session_obj'}->{'_data'}->{'SESSION'}->{$attr_name} = $_[1]; return }; |
|
|
0
|
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
117
|
0
|
|
|
|
|
|
$self->{'_session_obj'}->{'_data'}->{'SESSION'}->{$1} = $newval; |
|
118
|
|
|
|
|
|
|
return |
|
119
|
0
|
|
|
|
|
|
} |
|
120
|
|
|
|
|
|
|
|
|
121
|
0
|
|
|
|
|
|
croak ("No such method: $AUTOLOAD"); |
|
122
|
|
|
|
|
|
|
|
|
123
|
|
|
|
|
|
|
} |
|
124
|
|
|
|
|
|
|
|
|
125
|
|
|
|
|
|
|
sub DESTROY |
|
126
|
0
|
|
|
0
|
|
|
{ |
|
127
|
|
|
|
|
|
|
# nothing to do but make AUTOLOAD happy |
|
128
|
|
|
|
|
|
|
} |
|
129
|
|
|
|
|
|
|
|
|
130
|
|
|
|
|
|
|
1; |
|
131
|
|
|
|
|
|
|
__END__ |