File: anonymousUser.inc.php

package info (click to toggle)
zoph 1.0.1-3
  • links: PTS
  • area: main
  • in suites: bookworm
  • size: 16,480 kB
  • sloc: php: 27,195; javascript: 10,374; sql: 416; sh: 152; makefile: 4
file content (241 lines) | stat: -rw-r--r-- 5,700 bytes parent folder | download
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
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
<?php
/**
 * A class representing an anonymous user of Zoph.
 * An anonymous user is a user that is not logged in
 * it is currently used for the 'share this photo' feature.
 * This is basicly a wrapper around the user object returning
 * null or false to prevent an anonymous user to gain extra
 * privileges.
 *
 * This file is part of Zoph.
 *
 * Zoph is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2 of the License, or
 * (at your option) any later version.
 *
 * Zoph is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 * You should have received a copy of the GNU General Public License
 * along with Zoph; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
 *
 * @package Zoph
 * @author Jeroen Roos
 */

use user\prefs;
/**
 * @todo These requires should be removed once all classes can be autoloaded
 */
require_once "variables.inc.php";

/**
 * A class representing an anonymous user of Zoph.
 * An anonymous user is a user that is not logged in
 * it is currently used for the 'share this photo' feature.
 * This is basicly a wrapper around the user object returning
 * null or false to prevent an anonymous user to gain extra
 * privileges
 *
 * @package Zoph
 * @author Jeroen Roos
 */
final class anonymousUser extends user {

    /**
     * Create a new anonymousUser object
     * Fill 'prefs' with empty prefs object to prevent
     * lookups to go wrong.
     */
    public function __construct() {
        $this->prefs=new prefs();
    }

    /**
     * Return a bogus id
     */
    public function getId() {
        return 0;
    }

    /**
     * Fake lookup
     */
    public function lookup() {
        return false;
    }

    /**
     * Fake update
     */
    public function update() {
        return false;
    }

    /**
     * Return a bogus person id
     */
    public function lookupPerson() {
        return false;
    }

    /**
     * Anonymous users never have a lightbox
     */
    public function getLightbox() {
        return false;
    }

    /**
     * Fake preferences lookup
     */
    public function lookupPrefs() {
        return false;
    }

    /**
     * Anonymous user is never admin
     */
    public function isAdmin() {
        return false;
    }

    /**
     * Anonymous user can never view all photos
     */
    public function canSeeAllPhotos() {
        return false;
    }

    /**
     * Anonymous user can never edit organizers
     * @return bool user can add, edit and delete albums, categories, places and people
     */
    public function canEditOrganizers() {
        return false;
    }

    /**
     * Anonymous users are never allowed to delete photos
     * @return bool user can delete photos
     */
    public function canDeletePhotos() {
        return false;
    }


    /**
     * Anonymous user can never browse people
     * @return bool user can see the list of people that are in photos this user can see
     */
    public function canBrowsePeople() {
        return false;
    }

    /**
     * Anonymous user can never see people details
     * @return bool user can see details of people
     */
    public function canSeePeopleDetails() {
        return false;
    }

    /**
     * Anonymous user can never browse places
     * @return bool user can see the list of places where photos this user can see were taken
     */
    public function canBrowsePlaces() {
        return false;
    }

    /**
     * Anonymous user can never browse tracks
     * @return bool user can see tracks
     */
    public function canBrowseTracks() {
        return false;
    }

    /**
     * Anonymous user can never see details of places
     * @return bool user can see details of places
     */
    public function canSeePlaceDetails() {
        return false;
    }

    /**
     * Anonymous users don't get notified.
     */
    function getLastNotify() {
        return 0;
    }

    /**
     * No link for anonymous users.
     */
    function getLink() {
        return false;
    }

    /**
     * No URL for anonymous users.
     */
    function getURL() {
        return false;
    }

    /**
     * Return a standard name
     * at this moment this is used nowhere...
     */
    function getName() {
        return("Anonymous User");
    }

    /**
     * No groups for user
     */
    function getGroups() {
        return 0;
    }

    /**
     * Get albums user can see
     * Anonymous user has no albums permissions
     * always return null
     * @param album unused, only for compatibility with @see user object
     */
    function getAlbumPermissions(album $album) {
        return null;
    }

    /**
     * Get permissions for specific photo.
     * No permissions for anonymous user
     * @param photo unused, only for compatibility with @see user object
     */
    function getPhotoPermissions(photo $photo) {
        return new permissions(0,0);
    }

    /**
     * Get array for display
     * Anonymous user doesn't get displayed, so return empty array.
     */
    function getDisplayArray() {
        return array();
    }

    /**
     * At this moment, anonynmous users only get photos
     * and no text, so no need load any language strings
     * @param bool Force loading - unused, only for compatibility with @see user object
     */
    function loadLanguage($force = 0) {
        return null;
    }
}