* TURAnsel
*
* Copyright 2009 The Horde Project (http://www.horde.org)
- *
+ *
* @license http://opensource.org/licenses/bsd-license.php
* @author Michael J. Rubinsky <mrubinsk@horde.org>
*/
@interface TURAnsel : NSObject <NSComboBoxDataSource>
#else
@interface TURAnsel : NSObject
-#endif
+#endif
{
NSString *userAgent;
NSString *rpcEndPoint;
* Main class for interacting with a remote Ansel server.
*
* Copyright 2009 The Horde Project (http://www.horde.org)
- *
+ *
* @license http://opensource.org/licenses/bsd-license.php
* @author Michael J. Rubinsky <mrubinsk@horde.org>
*/
{
[super init];
galleryList = [[NSMutableArray alloc] init];
-
+
// Initialize the connection properties, KVC style
- [self setValue:[params objectForKey:@"endpoint"]
+ [self setValue:[params objectForKey:@"endpoint"]
forKey: @"rpcEndPoint"];
[self setValue: [params objectForKey:@"username"]
forKey: @"username"];
forKey: @"password"];
[self setValue: @"The Ansel Cocoa XML-RPC Client"
forKey: @"userAgent"];
-
+
return self;
}
-(void) dealloc
{
- NSLog(@"TURAnsel dealloc");
+ NSLog(@"TURAnsel dealloc");
[galleryList removeAllObjects];
[galleryList release];
[rpcEndPoint release];
#pragma mark -
#pragma mark Actions
-- (void)connect
+- (void)connect
{
[self doLogin];
}
*/
- (NSDictionary *)createNewGallery: (NSDictionary *)params
{
- NSArray *apiparams = [NSArray arrayWithObjects: @"ansel", params, nil];
+ NSArray *apiparams = [NSArray arrayWithObjects: @"ansel", params, nil];
NSArray *order = [NSArray arrayWithObjects: kTURAnselAPIParamScope, kTURAnselAPIParamGaleryParams, nil];
-
+
NSDictionary *response = [self callRPCMethod: @"images.createGallery"
withParams: apiparams
withOrder: order];
-
+
if (response) {
- NSNumber *gallery_id = [response objectForKey: (NSString *)kWSMethodInvocationResult];
+ NSNumber *gallery_id = [response objectForKey: (NSString *)kWSMethodInvocationResult];
NSDictionary *results = [NSDictionary dictionaryWithObjectsAndKeys:
gallery_id, kTURAnselGalleryKeyId,
[params valueForKey: @"name"], kTURAnselGalleryKeyName,
@"", kTURAnselGalleryKeyDescription,
[NSNumber numberWithInt: 0], kTURAnselGalleryKeyImages,
[NSNumber numberWithInt: 0], kTURAnselGalleryKeyDefaultImage, nil];
-
+
TURAnselGallery *newGallery = [[TURAnselGallery alloc] initWithObject: results
controller: self];
[galleryList addObject: newGallery];
[newGallery release];
-
+
return results;
}
-
+
return nil;
}
/**
- * Entry point for calling RPC methods on the Horde server.
- *
+ * Entry point for calling RPC methods on the Horde server.
+ *
* @param NSString methodName The method to call (e.g. images.listGalleries)
* @param NSArray params All the method's parameters
* @param NSArray order Keys for the params array, needed because of how
withOrder: (NSArray *) order
{
NSLog(@"Initiating connection for %@", methodName);
-
+
// Get a URL object
NSURL *url = [NSURL URLWithString: [self valueForKey: @"rpcEndPoint"]];
NSDictionary *values = [NSDictionary dictionaryWithObjects: params forKeys:order];
-
+
// Credentials
NSString *user = [self valueForKey:@"username"];
NSString *pass = [self valueForKey:@"password"];
-
+
if (user != nil && [user length] && pass != nil && [pass length]) {
// Create a custom http request with authorization
CFHTTPMessageRef request = CFHTTPMessageCreateRequest(kCFAllocatorDefault,
(CFStringRef)pass,
kCFHTTPAuthenticationSchemeBasic,
false);
-
+
NSLog(@"Results adding credentials to request: %d", success);
if (!success) {
NSLog(@"Unable to authenticate");
-
+
if ([[self delegate] respondsToSelector: @selector(TURAnselHadError:)]) {
NSError *error = [NSError errorWithDomain:@"TURAnsel"
code: 1
userInfo:[NSDictionary dictionaryWithObjectsAndKeys: @"Authentication failure.", @"message", nil]];
-
+
[[self delegate] TURAnselHadError: error];
}
-
+
return nil;
-
+
} else {
// Build a new invocation
[self setState:TURAnselStateWaiting];
WSMethodInvocationRef rpcCall;
- rpcCall = WSMethodInvocationCreate((CFURLRef)url, (CFStringRef)methodName, kWSXMLRPCProtocol);
+ rpcCall = WSMethodInvocationCreate((CFURLRef)url, (CFStringRef)methodName, kWSXMLRPCProtocol);
WSMethodInvocationSetParameters(rpcCall, (CFDictionaryRef)values, (CFArrayRef)order);
WSMethodInvocationSetProperty(rpcCall, kWSHTTPMessage, request);
NSDictionary *result = (NSDictionary *)WSMethodInvocationInvoke(rpcCall);
error = [NSError errorWithDomain: @"TURAnsel"
code: [faultCode intValue]
userInfo: [NSDictionary dictionaryWithObjectsAndKeys: [NSString stringWithFormat: @"There was an error contacting the Ansel server: %@, %@", resStatusLine, faultString], @"NSLocalizedDescriptionKey", nil]];
-
-
- }
+
+
+ }
[resStatusLine release];
} else {
// No response
userInfo: [NSDictionary dictionaryWithObjectsAndKeys: [NSString stringWithFormat: @"There was an error contacting the Ansel server: %@", faultString], @"NSLocalizedDescriptionKey", nil]];
}
-
+
if ([[self delegate] respondsToSelector: @selector(TURAnselHadError:)]) {
[[self delegate] TURAnselHadError: error];
}
[result autorelease];
return nil;
-
+
}
CFHTTPMessageRef response = (CFHTTPMessageRef)[result objectForKey:(id)kWSHTTPResponseMessage];
int resStatusCode = CFHTTPMessageGetResponseStatusCode(response);
NSLog(@"ResponseCode: %d", resStatusCode);
[self setState:TURAnselStateConnected];
return [result autorelease];
- }
+ }
}
-
+
NSLog(@"No authentication information present.");
return nil;
-
+
}
#pragma mark -
return g;
}
}
-
+
return nil;
}
}
- (id)delegate {
- return delegate;
+ return delegate;
}
- (void)setDelegate:(id)newDelegate {
- (void)doLogin
{
NSArray *params = [[NSArray alloc] initWithObjects:
- @"ansel", // Scope
+ @"ansel", // Scope
[NSNumber numberWithInt: PERMS_EDIT], // Perms
@"", // No parent
[NSNumber numberWithBool:YES], // allLevels
[NSNumber numberWithInt: 0], // Offset
[NSNumber numberWithInt: 0], // Count
[self valueForKey:@"username"], nil]; // Restrict to user (This should be an option eventually).
-
+
NSArray *order = [NSArray arrayWithObjects: kTURAnselAPIParamScope, kTURAnselAPIParamPerms,
kTURAnselAPIParamParent, kTURAnselAPIParamAllLevels,
kTURAnselAPIParamOffset, kTURAnselAPIParamCount,
kTURAnselAPIParamUserOnly, nil];
-
+
NSDictionary *results = [self callRPCMethod: @"images.listGalleries"
withParams: params
withOrder: order];
-
+
if (results) {
NSDictionary *galleries = [results objectForKey: (id)kWSMethodInvocationResult];
for (NSString *gal in galleries) {
[theGallery release];
theGallery = nil;
}
-
+
if ([delegate respondsToSelector:@selector(TURAnselDidInitialize)]) {
[delegate performSelectorOnMainThread:@selector(TURAnselDidInitialize)
withObject:self
waitUntilDone: NO];
}
-
+
}
-
+
[params release];
}
-@end
\ No newline at end of file
+@end
* TURAnselGallery.m
*
* Copyright 2009 The Horde Project (http://www.horde.org)
- *
+ *
* @license http://opensource.org/licenses/bsd-license.php
* @author Michael J. Rubinsky <mrubinsk@horde.org>
*/
[self setValue:[galleryData valueForKey: kTURAnselGalleryKeyName]
forKey:@"galleryName"];
[self setValue: [galleryData valueForKey: kTURAnselGalleryKeyImages]
- forKey:@"galleryImageCount"];
+ forKey:@"galleryImageCount"];
[self setValue: [galleryData valueForKey: kTURAnselGalleryKeyDefaultImage]
forKey:@"galleryKeyImage"];
[self setAnselController: controller];
NSLog(@"TURAnselGallery dealloc called on Gallery %@", self);
[anselController release];
anselController = nil;
-
+
[galleryKeyImageURL release];
galleryKeyImageURL = nil;
-
+
[imageList release];
imageList = nil;
-
+
[super dealloc];
}
-- (id)description
+- (id)description
{
NSString *text = [NSString stringWithFormat:@"Description: %@ Id: %d has: %d images", galleryName, _galleryId, galleryImageCount];
return text;
/**
* Requests the gallery's key image url to be fetched from the server
* (This information is not present in the gallery definition array returned
- * from the images.listGalleries call).
+ * from the images.listGalleries call).
*/
- (NSURL *)galleryKeyImageURL
{
kTURAnselAPIParamImageId,
kTURAnselAPIParamThumbnailStyle,
kTURAnselAPIParamFullPath, nil];
-
+
NSDictionary *response = [anselController callRPCMethod: @"images.getImageUrl"
withParams: params
withOrder: order];
-
+
if (response) {
NSDictionary *url = [response objectForKey:(id)kWSMethodInvocationResult];
[galleryKeyImageURL autorelease];
galleryKeyImageURL = [[NSURL URLWithString: [NSString stringWithFormat: @"%@", url]] retain];
NSLog(@"galleryKeyImageURL: %@", galleryKeyImageURL);
return galleryKeyImageURL;
- }
-
+ }
+
return nil;
}
}
kTURAnselAPIParamPerms,
kTURAnselAPIParamThumbnailStyle,
kTURAnselAPIParamFullPath, nil];
-
+
NSDictionary *response = [anselController callRPCMethod: @"images.listImages"
withParams: params
withOrder: order];
if (response) {
[imageList autorelease];
imageList = [[response objectForKey: (id)kWSMethodInvocationResult] retain];
-
+
NSLog(@"listImages: %@", imageList);
}
}
-
+
return imageList;;
}
-
+
/**
* Upload the provided image to this gallery.
*/
NSArray *params = [[NSArray alloc] initWithObjects:
@"ansel", // app
[NSNumber numberWithInt: _galleryId], // gallery_id
- [imageParameters valueForKey: @"data"], // image data array
+ [imageParameters valueForKey: @"data"], // image data array
[imageParameters valueForKey: @"default"], // set as default?
- @"", // Additional gallery data to set?
- @"base64", // Image data encoding
+ @"", // Additional gallery data to set?
+ @"base64", // Image data encoding
nil];
NSArray *order = [NSArray arrayWithObjects: kTURAnselAPIParamScope,
kTURAnselAPIParamGalleryId,
kTURAnselAPIParamSetAsDefault,
kTURAnselAPIParamAdditionalData,
kTURAnselAPIParamEncoding, nil];
-
+
// Send the request up to the controller
NSDictionary *result = [anselController callRPCMethod: @"images.saveImage"
withParams: params
withOrder: order];
-
+
if (result) {
if ([delegate respondsToSelector:@selector(TURAnselGalleryDidUploadImage:)]) {
[delegate performSelectorOnMainThread: @selector(TURAnselGalleryDidUploadImage:)
- withObject: self
+ withObject: self
waitUntilDone: NO];
}
}
-
+
[params release];
}
@end
/* If we have a single gallery, check perms now */
if (!empty($gallery_id)) {
$gallery = $ansel_storage->getGallery($gallery_id);
- if (!$gallery->hasPermission(Horde_Auth::getAuth(), PERMS_EDIT)) {
+ if (!$gallery->hasPermission(Horde_Auth::getAuth(), Horde_Perms::EDIT)) {
$notification->push(_("You are not allowed to edit these photos."), 'horde.error');
Horde_Util::closeWindowJS('window.opener.location.href = window.opener.location.href; window.close();');
exit;
// Images might be from different galleries
$gallery = $ansel_storage->getGallery($image->gallery);
if (is_a($gallery, 'PEAR_Error') ||
- !$gallery->hasPermission(Horde_Auth::getAuth(), PERMS_EDIT)) {
+ !$gallery->hasPermission(Horde_Auth::getAuth(), Horde_Perms::EDIT)) {
continue;
}
}
}
$gallery = $ansel_storage->getGallery($image->gallery);
-if (!$gallery->hasPermission(Horde_Auth::getAuth(), PERMS_EDIT)) {
+if (!$gallery->hasPermission(Horde_Auth::getAuth(), Horde_Perms::EDIT)) {
$notification->push(_("Access denied editing the photo."));
header('Location: ' . Ansel::getUrlFor('view', array('gallery' => $image->gallery)));
exit;
}
$gallery = &$ansel_storage->getGallery($image->gallery);
-if (!$gallery->hasPermission(Horde_Auth::getAuth(), PERMS_EDIT)) {
+if (!$gallery->hasPermission(Horde_Auth::getAuth(), Horde_Perms::EDIT)) {
die(_("Access denied editing the photo."));
}
$notification->push($gallery->getMessage(), 'horde.error');
header('Location: ' . Ansel::getUrlFor('view', array('gallery' => $gallery_id)));
exit;
-} elseif (!$gallery->hasPermission(Horde_Auth::getAuth(), PERMS_EDIT)) {
+} elseif (!$gallery->hasPermission(Horde_Auth::getAuth(), Horde_Perms::EDIT)) {
$notification->push(sprintf(_("Access denied editing gallery \"%s\"."), $gallery->get('name')), 'horde.error');
header('Location: ' . Ansel::getUrlFor('view', array('gallery' => $gallery_id)));
exit;
$image = &$ansel_storage->getImage($image_id);
$gallery = &$ansel_storage->getGallery($image->gallery);
-if (!$gallery->hasPermission(Horde_Auth::getAuth(), PERMS_EDIT)) {
+if (!$gallery->hasPermission(Horde_Auth::getAuth(), Horde_Perms::EDIT)) {
throw new Horde_Exception('Access denied editing the photo.');
}
$faces = Ansel_Faces::factory();
-$result = $faces->setName($face_id, $name);
\ No newline at end of file
+$result = $faces->setName($face_id, $name);
$notification->push($parent->getMessage(), 'horde.error');
header('Location: ' . Horde::applicationUrl('view.php?view=List', true));
exit;
- } elseif (!$parent->hasPermission(Horde_Auth::getAuth(), PERMS_EDIT)) {
+ } elseif (!$parent->hasPermission(Horde_Auth::getAuth(), Horde_Perms::EDIT)) {
$notification->push(
sprintf(_("Access denied adding a gallery to \"%s\"."),
$parent->get('name')), 'horde.error');
$galleryId = Horde_Util::getFormData('gallery');
$gallery = $ansel_storage->getGallery($galleryId);
if (!Horde_Auth::getAuth() || is_a($gallery, 'PEAR_Error') ||
- !$gallery->hasPermission(Horde_Auth::getAuth(), PERMS_READ)) {
+ !$gallery->hasPermission(Horde_Auth::getAuth(), Horde_Perms::READ)) {
$name = is_a($gallery, 'PEAR_Error')
? $galleryId
// Check general permissions.
if (!Horde_Auth::isAdmin() &&
($GLOBALS['perms']->exists('ansel') &&
- !$GLOBALS['perms']->hasPermission('ansel', Horde_Auth::getAuth(), PERMS_EDIT))) {
+ !$GLOBALS['perms']->hasPermission('ansel', Horde_Auth::getAuth(), Horde_Perms::EDIT))) {
$notification->push(_("Access denied editing galleries."), 'horde.error');
header('Location: ' . Horde::applicationUrl('view.php?view=List', true));
exit;
// Modifying an existing gallery.
$gallery = $ansel_storage->getGallery($galleryId);
if (is_a($gallery, 'PEAR_Error') ||
- !$gallery->hasPermission(Horde_Auth::getAuth(), PERMS_EDIT)) {
+ !$gallery->hasPermission(Horde_Auth::getAuth(), Horde_Perms::EDIT)) {
$name = is_a($gallery, 'PEAR_Error')
? $galleryId
header('Location: ' . Horde::applicationUrl(
Ansel::getUrlFor('view', array('view' => 'List'), true)));
exit;
- } elseif (!$parent->hasPermission(Horde_Auth::getAuth(), PERMS_EDIT)) {
+ } elseif (!$parent->hasPermission(Horde_Auth::getAuth(), Horde_Perms::EDIT)) {
$notification->push(sprintf(
_("You do not have permission to add children to %s."),
$parent->get('name')), 'horde.error');
exit;
}
-if (!$gallery->hasPermission(Horde_Auth::getAuth(), PERMS_EDIT)) {
+if (!$gallery->hasPermission(Horde_Auth::getAuth(), Horde_Perms::EDIT)) {
$notification->push(sprintf(_("Access denied setting captions for %s."), $gallery->get('name')), 'horde.error');
header('Location: ' . Ansel::getUrlFor('view', array('view' => 'List'),
true));
case 'delete':
if (is_a($gallery, 'PEAR_Error')) {
$notification->push($gallery->getMessage(), 'horde.error');
- } elseif (!$gallery->hasPermission(Horde_Auth::getAuth(), PERMS_DELETE)) {
+ } elseif (!$gallery->hasPermission(Horde_Auth::getAuth(), Horde_Perms::DELETE)) {
$notification->push(sprintf(_("Access denied deleting gallery \"%s\"."),
$gallery->get('name')), 'horde.error');
} else {
case 'empty':
if (is_a($gallery, 'PEAR_Error')) {
$notification->push($gallery->getMessage(), 'horde.error');
- } elseif (!$gallery->hasPermission(Horde_Auth::getAuth(), PERMS_DELETE)) {
+ } elseif (!$gallery->hasPermission(Horde_Auth::getAuth(), Horde_Perms::DELETE)) {
$notification->push(sprintf(_("Access denied deleting gallery \"%s\"."),
$gallery->get('name')),
'horde.error');
header('Location: ' . Ansel::getUrlFor('view', array('view' => 'List'),
true));
exit;
-} elseif (!$gallery->hasPermission(Horde_Auth::getAuth(), PERMS_EDIT)) {
+} elseif (!$gallery->hasPermission(Horde_Auth::getAuth(), Horde_Perms::EDIT)) {
$notification->push(sprintf(_("Access denied editing gallery \"%s\"."), $gallery->get('name')), 'horde.error');
header('Location: ' . Ansel::getUrlFor('view', array('view' => 'List'),
true));
switch ($groupby) {
case 'category':
- $num_groups = $ansel_storage->countCategories(PERMS_SHOW);
+ $num_groups = $ansel_storage->countCategories(Horde_Perms::SHOW);
if (is_a($num_groups, 'PEAR_Error')) {
$notification->push($num_groups);
$num_groups = 0;
$groups = array();
} elseif ($num_groups) {
- $groups = $ansel_storage->listCategories(PERMS_SHOW,
+ $groups = $ansel_storage->listCategories(Horde_Perms::SHOW,
$gbpage * $groups_perpage,
$groups_perpage);
} else {
break;
case 'owner':
- $num_groups = $ansel_storage->shares->countOwners(PERMS_SHOW, null,
+ $num_groups = $ansel_storage->shares->countOwners(Horde_Perms::SHOW, null,
false);
if (is_a($num_groups, 'PEAR_Error')) {
$notification->push($num_groups);
$num_groups = 0;
$groups = array();
} elseif ($num_groups) {
- $groups = $ansel_storage->shares->listOwners(PERMS_SHOW, null,
+ $groups = $ansel_storage->shares->listOwners(Horde_Perms::SHOW, null,
false,
$gbpage * $groups_perpage,
$groups_perpage);
case 'saveclose':
case 'save':
$title = _("Save Photo");
- if (!$gallery->hasPermission(Horde_Auth::getAuth(), PERMS_EDIT)) {
+ if (!$gallery->hasPermission(Horde_Auth::getAuth(), Horde_Perms::EDIT)) {
$notification->push(sprintf(_("Access denied saving photo to \"%s\"."), $gallery->get('name')),
'horde.error');
$imageurl = Ansel::getUrlFor('view', array_merge(
'slug' => $gallery->get('slug')),
$date));
- if (!$gallery->hasPermission(Horde_Auth::getAuth(), PERMS_EDIT)) {
+ if (!$gallery->hasPermission(Horde_Auth::getAuth(), Horde_Perms::EDIT)) {
$notification->push(_("Access denied editing the photo."),
'horde.error');
exit;
case 'watermark':
- if (!$gallery->hasPermission(Horde_Auth::getAuth(), PERMS_EDIT)) {
+ if (!$gallery->hasPermission(Horde_Auth::getAuth(), Horde_Perms::EDIT)) {
$notification->push(sprintf(_("Access denied saving photo to \"%s\"."),
$gallery->get('name')),
'horde.error');
case 'grayscale':
case 'crop':
case 'resize':
- if (!$gallery->hasPermission(Horde_Auth::getAuth(), PERMS_EDIT)) {
+ if (!$gallery->hasPermission(Horde_Auth::getAuth(), Horde_Perms::EDIT)) {
$notification->push(sprintf(_("Access denied saving photo to \"%s\"."),
$gallery->get('name')),
'horde.error');
/* Delete the images if we're provided with a valid image ID. */
if (count($images)) {
- if (!$gallery->hasPermission(Horde_Auth::getAuth(), PERMS_DELETE)) {
+ if (!$gallery->hasPermission(Horde_Auth::getAuth(), Horde_Perms::DELETE)) {
$notification->push(sprintf(_("Access denied deleting photos from \"%s\"."), $gallery->get('name')), 'horde.error');
} else {
foreach ($images as $image) {
}
/* Recalculate the number of pages, since it might have changed */
- $children = $gallery->countGalleryChildren(PERMS_SHOW);
+ $children = $gallery->countGalleryChildren(Horde_Perms::SHOW);
$perpage = min($prefs->getValue('tilesperpage'),
$conf['thumbnail']['perpage']);
$pages = ceil($children / $perpage);
}
/* Recalculate the number of pages, since it might have changed */
- $children = $gallery->countGalleryChildren(PERMS_SHOW);
+ $children = $gallery->countGalleryChildren(Horde_Perms::SHOW);
$perpage = min($prefs->getValue('tilesperpage'),
$conf['thumbnail']['perpage']);
$pages = ceil($children / $perpage);
if ($galleryId) {
$gallery = $ansel_storage->getGallery($galleryId);
if (!Horde_Auth::getAuth() || is_a($gallery, 'PEAR_Error') ||
- !$gallery->hasPermission(Horde_Auth::getAuth(), PERMS_READ) ||
+ !$gallery->hasPermission(Horde_Auth::getAuth(), Horde_Perms::READ) ||
$gallery->hasPasswd() || !$gallery->isOldEnough()) {
$name = is_a($gallery, 'PEAR_Error') ? $galleryId : $gallery->get('name');
case 'previewcrop':
- if (!$gallery->hasPermission(Horde_Auth::getAuth(), PERMS_EDIT)) {
+ if (!$gallery->hasPermission(Horde_Auth::getAuth(), Horde_Perms::EDIT)) {
$notification->push(_("Access denied editing the photo."), 'horde.error');
$imageurl = Ansel::getUrlFor(
'view', array('gallery' => $gallery_id,
exit;
case 'imagecrop':
- if ($gallery->hasPermission(Horde_Auth::getAuth(), PERMS_EDIT)) {
+ if ($gallery->hasPermission(Horde_Auth::getAuth(), Horde_Perms::EDIT)) {
$params = Horde_Util::getFormData('params');
list($x1, $y1, $x2, $y2) = explode('.', $params);
$image = &$ansel_storage->getImage($image_id);
if (is_a($gallery, 'PEAR_Error')) {
Horde::fatal($gallery, __FILE__, __LINE__);
}
-if (!$gallery->hasPermission(Horde_Auth::getAuth(), PERMS_READ) ||
+if (!$gallery->hasPermission(Horde_Auth::getAuth(), Horde_Perms::READ) ||
!$gallery->canDownload()) {
Horde::fatal(_("Access denied viewing this photo."), __FILE__, __LINE__);
}
if (is_a($gallery, 'PEAR_Error')) {
Horde::fatal($gallery, __FILE__, __LINE__);
}
-if (!$gallery->hasPermission(Horde_Auth::getAuth(), PERMS_READ) ||
+if (!$gallery->hasPermission(Horde_Auth::getAuth(), Horde_Perms::READ) ||
!$gallery->canDownload()) {
Horde::fatal(_("Access denied viewing this photo."), __FILE__, __LINE__);
}
if (is_a($gallery, 'PEAR_Error')) {
Horde::fatal($gallery, __FILE__, __LINE__);
}
-if (!$gallery->hasPermission(Horde_Auth::getAuth(), PERMS_READ)) {
+if (!$gallery->hasPermission(Horde_Auth::getAuth(), Horde_Perms::READ)) {
Horde::fatal(_("Access denied viewing this photo."), __FILE__, __LINE__);
}
if (is_a($gallery, 'PEAR_Error')) {
Horde::fatal($gallery, __FILE__, __LINE__);
}
-if (!$gallery->hasPermission(Horde_Auth::getAuth(), PERMS_READ)) {
+if (!$gallery->hasPermission(Horde_Auth::getAuth(), Horde_Perms::READ)) {
Horde::fatal(_("Access denied viewing this photo."), __FILE__, __LINE__);
}
if (is_a($gallery, 'PEAR_Error')) {
Horde::fatal($gallery, __FILE__, __LINE__);
}
-if (!$gallery->hasPermission(Horde_Auth::getAuth(), PERMS_READ)) {
+if (!$gallery->hasPermission(Horde_Auth::getAuth(), Horde_Perms::READ)) {
Horde::fatal(_("Access denied viewing this photo."), __FILE__, __LINE__);
}
if (is_a($gallery, 'PEAR_Error')) {
Horde::fatal($gallery, __FILE__, __LINE__);
}
-if (!$gallery->hasPermission(Horde_Auth::getAuth(), PERMS_READ)) {
+if (!$gallery->hasPermission(Horde_Auth::getAuth(), Horde_Perms::READ)) {
Horde::fatal(_("Access denied viewing this photo."), __FILE__, __LINE__);
}
if (is_a($gallery, 'PEAR_Error')) {
Horde::fatal($gallery, __FILE__, __LINE__);
}
-if (!$gallery->hasPermission(Horde_Auth::getAuth(), PERMS_READ)) {
+if (!$gallery->hasPermission(Horde_Auth::getAuth(), Horde_Perms::READ)) {
Horde::fatal(_("Access denied viewing this photo."), __FILE__, __LINE__);
}
$gallery_id = (int)Horde_Util::getFormData('gallery');
$gallery = $ansel_storage->getGallery($gallery_id);
if (is_a($gallery, 'PEAR_Error') ||
- !$gallery->hasPermission(Horde_Auth::getAuth(), PERMS_READ)) {
+ !$gallery->hasPermission(Horde_Auth::getAuth(), Horde_Perms::READ)) {
die(sprintf(_("Gallery %s not found."), $gallery_id));
}
// deletion is successful
// .clickHandler - optional callback to handle click events on the mainMap
- // .hasEdit - Has PERMS_EDIT on the image
+ // .hasEdit - Has Horde_Perms::EDIT on the image
// .calculateMaxZoom - call Google's getMaxZoomAtLatLng() method to
// avoid autozooming in to a level with no detail.
// Performance penalty because we make another
anselGOverlay.prototype.getLatLng = function() {
return this.latlng_;
}
-});
\ No newline at end of file
+});
$id = $args['id'];
$image = $GLOBALS['ansel_storage']->getImage($id);
$g = $GLOBALS['ansel_storage']->getGallery($image->gallery);
- if ($g->hasPermission(Horde_Auth::getAuth(), PERMS_EDIT)) {
+ if ($g->hasPermission(Horde_Auth::getAuth(), Horde_Perms::EDIT)) {
$image->caption = $pref_value;
$result = $image->save();
if (is_a($result, 'PEAR_Error')) {
$face_id = (int)$post['face'];
$image = &$GLOBALS['ansel_storage']->getImage($image_id);
$gallery = &$GLOBALS['ansel_storage']->getGallery($image->gallery);
- if (!$gallery->hasPermission(Horde_Auth::getAuth(), PERMS_EDIT)) {
+ if (!$gallery->hasPermission(Horde_Auth::getAuth(), Horde_Perms::EDIT)) {
throw new Horde_Exception('Access denied editing the photo.');
}
$name = $post['facename'];
$image = &$GLOBALS['ansel_storage']->getImage($image_id);
$gallery = &$GLOBALS['ansel_storage']->getGallery($image->gallery);
- if (!$gallery->hasPermission(Horde_Auth::getAuth(), PERMS_EDIT)) {
+ if (!$gallery->hasPermission(Horde_Auth::getAuth(), Horde_Perms::EDIT)) {
throw new Horde_Exception('You are not allowed to edit this photo');
}
return array('response' => 0);
}
// Bail out if no perms on the image.
- if (!$gallery->hasPermission(Horde_Auth::getAuth(), PERMS_EDIT)) {
+ if (!$gallery->hasPermission(Horde_Auth::getAuth(), Horde_Perms::EDIT)) {
return array('response' => 0);
}
switch ($type) {
return array('response' => 1,
'message' => $this->_getTagHtml($newTags, $owner,
- $parent->hasPermission(Horde_Auth::getAuth(), PERMS_EDIT)));
+ $parent->hasPermission(Horde_Auth::getAuth(), Horde_Perms::EDIT)));
}
break;
return array('response' => 1,
'message' => $this->_getTagHtml($newTags, $owner,
- $parent->hasPermission(Horde_Auth::getAuth(), PERMS_EDIT)));
+ $parent->hasPermission(Horde_Auth::getAuth(), Horde_Perms::EDIT)));
break;
}
*
* @return string The <option> list.
*/
- static public function selectGalleries($selected = null, $perm = PERMS_SHOW,
+ static public function selectGalleries($selected = null, $perm = Horde_Perms::SHOW,
$attributes = null, $parent = null,
$allLevels = true, $from = 0, $count = 0,
$ignore = null)
/* Let authenticated users create new galleries. */
if (Horde_Auth::isAdmin() ||
(!$GLOBALS['perms']->exists('ansel') && Horde_Auth::getAuth()) ||
- $GLOBALS['perms']->hasPermission('ansel', Horde_Auth::getAuth(), PERMS_EDIT)) {
+ $GLOBALS['perms']->hasPermission('ansel', Horde_Auth::getAuth(), Horde_Perms::EDIT)) {
$menu->add(Horde::applicationUrl(Horde_Util::addParameter('gallery.php', 'actionID', 'add')),
_("_New Gallery"), 'add.png', null, null, null,
(basename($_SERVER['PHP_SELF']) == 'gallery.php' &&
if (empty($path)) {
$owners = array();
- $galleries = $GLOBALS['ansel_storage']->listGalleries(PERMS_SHOW, null, null, false);
+ $galleries = $GLOBALS['ansel_storage']->listGalleries(Horde_Perms::SHOW, null, null, false);
foreach ($galleries as $gallery) {
$owners[$gallery->data['share_owner']] = true;
}
if (count($parts) == 1) {
// This request is for all galleries owned by the requested user.
$galleries = $GLOBALS['ansel_storage']->listGalleries(
- PERMS_SHOW, $parts[0], null, false);
+ Horde_Perms::SHOW, $parts[0], null, false);
$images = array();
} elseif ($this->galleryExists(null, end($parts))) {
// This request if for a certain gallery, list all sub-galleries
array($gallery_id));
if (!isset($galleries[$gallery_id]) ||
!$galleries[$gallery_id]->hasPermission(Horde_Auth::getAuth(),
- PERMS_READ)) {
+ Horde_Perms::READ)) {
return PEAR::raiseError(_("Invalid gallery specified."), 404);
}
$galleries = $GLOBALS['ansel_storage']->listGalleries(
- PERMS_SHOW, null, $gallery_id, false);
+ Horde_Perms::SHOW, null, $gallery_id, false);
- $images = $this->listImages(null, $gallery_id, PERMS_SHOW, 'mini');
+ $images = $this->listImages(null, $gallery_id, Horde_Perms::SHOW, 'mini');
} elseif (count($parts) > 2 &&
$this->galleryExists(null, $parts[count($parts) - 2]) &&
!is_a($image = $GLOBALS['ansel_storage']->getImage(end($parts)), 'PEAR_Error')) {
}
if (in_array('browseable', $properties)) {
$results[$retpath]['browseable'] = $gallery->hasPermission(
- Horde_Auth::getAuth(), PERMS_READ);
+ Horde_Auth::getAuth(), Horde_Perms::READ);
}
if (in_array('contenttype', $properties)) {
$results[$retpath]['contenttype'] = 'httpd/unix-directory';
return PEAR::raiseError("Gallery does not exist");
}
$gallery = $GLOBALS['ansel_storage']->getGallery($gallery_id);
- if (!$gallery->hasPermission(Horde_Auth::getAuth(), PERMS_EDIT)) {
+ if (!$gallery->hasPermission(Horde_Auth::getAuth(), Horde_Perms::EDIT)) {
return PEAR::raiseError(_("Access denied adding photos to \"%s\"."));
}
return $gallery;
}
}
- if (!$gallery->hasPermission(Horde_Auth::getAuth(), PERMS_EDIT)) {
+ if (!$gallery->hasPermission(Horde_Auth::getAuth(), Horde_Perms::EDIT)) {
return PEAR::raiseError(sprintf(_("Access denied adding photos to \"%s\"."), $gallery->get('name')));
}
if (!empty($gallery_data)) {
}
$gallery = $GLOBALS['ansel_storage']->getGallery($image->gallery);
if (is_a($gallery, 'PEAR_Error') ||
- !$gallery->hasPermission(Horde_Auth::getAuth(), PERMS_DELETE)) {
+ !$gallery->hasPermission(Horde_Auth::getAuth(), Horde_Perms::DELETE)) {
return PEAR::raiseError(sprintf(_("Access denied deleting photos from \"%s\"."), $gallery->get('name')));
}
* (@see Ansel_Storage::createGallery).
* @param array $perm An array of permission data if Ansel's defaults
* are not desired. Takes an array like:
- * array('guest' => PERMS_SHOW | PERMS_READ,
- * 'default' => PERMS_SHOW | PERMS_READ);
+ * array('guest' => Horde_Perms::SHOW | Horde_Perms::READ,
+ * 'default' => Horde_Perms::SHOW | Horde_Perms::READ);
* @param integer $parent The gallery id of the parent gallery, if any.
*
* @return mixed The gallery id of the new gallery | PEAR_Error
if (!(Horde_Auth::isAdmin() ||
(!$GLOBALS['perms']->exists('ansel') && Horde_Auth::getAuth()) ||
- $GLOBALS['perms']->hasPermission('ansel', Horde_Auth::getAuth(), PERMS_EDIT))) {
+ $GLOBALS['perms']->hasPermission('ansel', Horde_Auth::getAuth(), Horde_Perms::EDIT))) {
return PEAR::raiseError(_("Access denied creating new galleries."));
}
if (is_a($gallery, 'PEAR_Error')) {
return PEAR::raiseError(sprintf(_("Access denied deleting gallery \"%s\"."),
$gallery->getMessage()));
- } elseif (!$gallery->hasPermission(Horde_Auth::getAuth(), PERMS_DELETE)) {
+ } elseif (!$gallery->hasPermission(Horde_Auth::getAuth(), Horde_Perms::DELETE)) {
return PEAR::raiseError(sprintf(_("Access denied deleting gallery \"%s\"."),
$gallery->get('name')));
} else {
*
* @return array An array of gallery information.
*/
- public function listGalleries($app = null, $perm = PERMS_SHOW,
+ public function listGalleries($app = null, $perm = Horde_Perms::SHOW,
$parent = null,
$allLevels = true, $from = 0, $count = 0,
$attributes = null, $sort_by = null, $direction = 0)
}
/* We can't just return the results of the getGalleries call - we need to
- ensure the caller has at least PERMS_READ on the galleries. */
+ ensure the caller has at least Horde_Perms::READ on the galleries. */
$galleries = array();
foreach ($results as $gallery) {
- if ($gallery->hasPermission(Horde_Auth::getAuth(), PERMS_READ)) {
+ if ($gallery->hasPermission(Horde_Auth::getAuth(), Horde_Perms::READ)) {
$galleries[$gallery->id] = array_merge($gallery->data, array('crumbs' => $gallery->getGalleryCrumbData()));
}
}
* selected by default in the returned option
* list.
*/
- public function selectGalleries($app = null, $perm = PERMS_SHOW,
+ public function selectGalleries($app = null, $perm = Horde_Perms::SHOW,
$parent = null,
$allLevels = true, $from = 0, $count = 0,
$default = null)
*
* @return array Two dimensional array with image names ids (key) and urls.
*/
- public function listImages($app = null, $gallery_id = null, $perm = PERMS_SHOW,
+ public function listImages($app = null, $gallery_id = null, $perm = Horde_Perms::SHOW,
$view = 'screen', $full = false, $from = 0,
$count = 0, $style = null, $slug = '')
{
* @param array $galleries An array of gallery ids to check. If left empty,
* will search all galleries with the given
* permissions for the current user.
- * @param integer $perms PERMS_* constant
+ * @param integer $perms Horde_Perms::* constant.
* @param string $view The type of image view to return.
* @param boolean $full Return a full URL if this is true.
* @param integer $limit The maximum number of images to return.
* @return array An array of image objects.
*/
public function getRecentImages($app = null, $galleries = array(),
- $perms = PERMS_SHOW, $view = 'screen',
+ $perms = Horde_Perms::SHOW, $view = 'screen',
$full = false, $limit = 10, $style = null,
$slugs = array())
{
*
* @return integer Returns the number of matching galleries.
*/
- public function countGalleries($app = null, $perm = PERMS_SHOW, $attributes = null,
+ public function countGalleries($app = null, $perm = Horde_Perms::SHOW, $attributes = null,
$parent = null, $allLevels = true)
{
require_once dirname(__FILE__) . '/base.php';
'type' => 'checkbox',
'default' => true));
- if ($GLOBALS['ansel_storage']->countGalleries(Horde_Auth::getAuth(), PERMS_READ) < $GLOBALS['conf']['gallery']['listlimit']) {
+ if ($GLOBALS['ansel_storage']->countGalleries(Horde_Auth::getAuth(), Horde_Perms::READ) < $GLOBALS['conf']['gallery']['listlimit']) {
foreach ($GLOBALS['ansel_storage']->listGalleries() as $gal) {
$params['gallery']['values'][$gal->id] = $gal->get('name');
}
$gallery->get('name')));
if ($iid = $gallery->getDefaultImage('ansel_default') &&
- $gallery->hasPermission(Horde_Auth::getAuth(), PERMS_READ)) {
+ $gallery->hasPermission(Horde_Auth::getAuth(), Horde_Perms::READ)) {
$html .= '<img src="' . Ansel::getImageUrl($gallery->getDefaultImage('ansel_default'), 'thumb', true) . '" alt="' . htmlspecialchars($gallery->get('name')) . '" />';
} else {
if (empty($this->_gallery)) {
return PEAR::raiseError(_("Gallery does not exist."));
} elseif (is_a($this->_gallery, 'PEAR_Error') ||
- !$this->_gallery->hasPermission(Horde_Auth::getAuth(), PERMS_SHOW) ||
+ !$this->_gallery->hasPermission(Horde_Auth::getAuth(), Horde_Perms::SHOW) ||
!$this->_gallery->isOldEnough() || $this->_gallery->hasPasswd()) {
return PEAR::raiseError(_("Access denied viewing this gallery."));
}
Horde::addScriptFile('ToolTips.js', 'horde');
/* Get the top level galleries */
$galleries = $GLOBALS['ansel_storage']->listGalleries(
- PERMS_EDIT, Horde_Auth::getAuth(), null, false, 0,
+ Horde_Perms::EDIT, Horde_Auth::getAuth(), null, false, 0,
empty($this->_params['limit']) ? 0 : $this->_params['limit'],
'last_modified', 1);
'default' => '__random',
'values' => array('all' => 'All')));
- if ($GLOBALS['ansel_storage']->countGalleries(Horde_Auth::getAuth(), PERMS_READ) < $GLOBALS['conf']['gallery']['listlimit']) {
- foreach ($GLOBALS['ansel_storage']->listGalleries(PERMS_READ) as $id => $gal) {
+ if ($GLOBALS['ansel_storage']->countGalleries(Horde_Auth::getAuth(), Horde_Perms::READ) < $GLOBALS['conf']['gallery']['listlimit']) {
+ foreach ($GLOBALS['ansel_storage']->listGalleries(Horde_Perms::READ) as $id => $gal) {
$params['gallery']['values'][$id] = $gal->get('name');
}
}
if (empty($this->_gallery)) {
return PEAR::raiseError(_("Gallery does not exist."));
} elseif (is_a($this->_gallery, 'PEAR_Error') ||
- !$this->_gallery->hasPermission(Horde_Auth::getAuth(), PERMS_READ)) {
+ !$this->_gallery->hasPermission(Horde_Auth::getAuth(), Horde_Perms::READ)) {
return PEAR::raiseError(_("Access denied viewing this gallery."));
}
'default' => 10),
);
- if ($GLOBALS['ansel_storage']->countGalleries(Horde_Auth::getAuth(), PERMS_READ) < $GLOBALS['conf']['gallery']['listlimit']) {
- foreach ($GLOBALS['ansel_storage']->listGalleries(PERMS_READ) as $id => $gal) {
+ if ($GLOBALS['ansel_storage']->countGalleries(Horde_Auth::getAuth(), Horde_Perms::READ) < $GLOBALS['conf']['gallery']['listlimit']) {
+ foreach ($GLOBALS['ansel_storage']->listGalleries(Horde_Perms::READ) as $id => $gal) {
if (!$gal->hasPasswd() && $gal->isOldEnough()) {
$params['gallery']['values'][$id] = $gal->get('name');
}
if (empty($this->_gallery)) {
return PEAR::raiseError(_("Gallery does not exist."));
} elseif (is_a($this->_gallery, 'PEAR_Error') ||
- !$this->_gallery->hasPermission(Horde_Auth::getAuth(), PERMS_READ)) {
+ !$this->_gallery->hasPermission(Horde_Auth::getAuth(), Horde_Perms::READ)) {
return PEAR::raiseError(_("Access denied viewing this gallery."));
}
'default' => 250),
);
- if ($GLOBALS['ansel_storage']->countGalleries(Horde_Auth::getAuth(), PERMS_READ) < $GLOBALS['conf']['gallery']['listlimit']) {
- foreach ($GLOBALS['ansel_storage']->listGalleries(PERMS_READ) as $id => $gal) {
+ if ($GLOBALS['ansel_storage']->countGalleries(Horde_Auth::getAuth(), Horde_Perms::READ) < $GLOBALS['conf']['gallery']['listlimit']) {
+ foreach ($GLOBALS['ansel_storage']->listGalleries(Horde_Perms::READ) as $id => $gal) {
if (!$gal->hasPasswd() && $gal->isOldEnough()) {
$params['gallery']['values'][$id] = $gal->get('name');
}
if (empty($this->_gallery)) {
return PEAR::raiseError(_("Gallery does not exist."));
} elseif (is_a($this->_gallery, 'PEAR_Error') ||
- !$this->_gallery->hasPermission(Horde_Auth::getAuth(), PERMS_READ)) {
+ !$this->_gallery->hasPermission(Horde_Auth::getAuth(), Horde_Perms::READ)) {
return PEAR::raiseError(_("Access denied viewing this gallery."));
}
// an internally generated query string fragment. Will need to split
// this out into two seperate operations somehow.
$share = substr($GLOBALS['ansel_storage']->shares->_getShareCriteria(
- Horde_Auth::getAuth(), PERMS_READ), 5);
+ Horde_Auth::getAuth(), Horde_Perms::READ), 5);
$sql = 'SELECT f.face_id, f.gallery_id, f.image_id, f.face_name FROM ansel_faces f, '
. str_replace('WHERE', 'WHERE (', $share)
// add gallery permission
// FIXME: Ditto on the REALLY ugly hack comment from above!
$share = substr($GLOBALS['ansel_storage']->shares->_getShareCriteria(
- Horde_Auth::getAuth(), PERMS_READ), 5);
+ Horde_Auth::getAuth(), Horde_Perms::READ), 5);
$sql = 'SELECT COUNT(*) FROM ansel_faces f, '
. str_replace('WHERE', 'WHERE (', $share)
{
$image = &$GLOBALS['ansel_storage']->getImage($image);
$gallery = $GLOBALS['ansel_storage']->getGallery($image->gallery);
- if (!$gallery->hasPermission(Horde_Auth::getAuth(), PERMS_EDIT)) {
+ if (!$gallery->hasPermission(Horde_Auth::getAuth(), Horde_Perms::EDIT)) {
//TODO: Do we throw exceptions for access denied?
throw new Horde_Exception('Access denied editing the photo.');
}
if (!is_a($image, 'Ansel_Image')) {
$image = &$GLOBALS['ansel_storage']->getImage($image);
$gallery = $GLOBALS['ansel_storage']->getGallery($image->gallery);
- if (!$gallery->hasPermission(Horde_Auth::getAuth(), PERMS_EDIT)) {
+ if (!$gallery->hasPermission(Horde_Auth::getAuth(), Horde_Perms::EDIT)) {
throw new Horde_Exception('Access denied editing the photo.');
}
}
public function getFromGallery($gallery_id, $create = false, $force = false)
{
$gallery = $GLOBALS['ansel_storage']->getGallery($gallery_id);
- if (!$gallery->hasPermission(Horde_Auth::getAuth(), PERMS_EDIT)) {
+ if (!$gallery->hasPermission(Horde_Auth::getAuth(), Horde_Perms::EDIT)) {
throw new Horde_Exception(sprintf("Access denied editing gallery \"%s\".", $gallery->get('name')));
}
return Horde_Auth::isAuthenticated();
case 'edit':
- return $this->hasPermission(Horde_Auth::getAuth(), PERMS_EDIT);
+ return $this->hasPermission(Horde_Auth::getAuth(), Horde_Perms::EDIT);
case 'hook':
return Horde::callHook('_ansel_hook_can_download', array($this->id));
*/
public function copyImagesTo($images, $gallery)
{
- if (!$gallery->hasPermission(Horde_Auth::getAuth(), PERMS_EDIT)) {
+ if (!$gallery->hasPermission(Horde_Auth::getAuth(), Horde_Perms::EDIT)) {
throw new Horde_Exception(sprintf(_("Access denied copying photos to \"%s\"."), $gallery->get('name')));
}
* @return A mixed array of Ansel_Gallery and Ansel_Image objects that are
* children of this gallery.
*/
- public function getGalleryChildren($perm = PERMS_SHOW, $from = 0, $to = 0, $noauto = true)
+ public function getGalleryChildren($perm = Horde_Perms::SHOW, $from = 0, $to = 0, $noauto = true)
{
return $this->_modeHelper->getGalleryChildren($perm, $from, $to, $noauto);
}
*
* @return integer The count of this gallery's children.
*/
- public function countGalleryChildren($perm = PERMS_SHOW, $galleries_only = false, $noauto = true)
+ public function countGalleryChildren($perm = Horde_Perms::SHOW, $galleries_only = false, $noauto = true)
{
return $this->_modeHelper->countGalleryChildren($perm, $galleries_only, $noauto);
}
if ($this->hasSubGalleries()) {
// Fall through to a default image of a sub gallery.
try {
- $galleries = $GLOBALS['ansel_storage']->listGalleries(PERMS_SHOW, null, $this, false);
+ $galleries = $GLOBALS['ansel_storage']->listGalleries(Horde_Perms::SHOW, null, $this, false);
} catch (Horde_Exception $e) {
return false;
}
* @throws Horde_Exception
*/
public function getTags() {
- if ($this->hasPermission(Horde_Auth::getAuth(), PERMS_READ)) {
+ if ($this->hasPermission(Horde_Auth::getAuth(), Horde_Perms::READ)) {
return Ansel_Tags::readTags($this->id, 'gallery');
} else {
throw new Horde_Exception(_("Access denied viewing this gallery."));
*/
public function setTags($tags)
{
- if ($this->hasPermission(Horde_Auth::getAuth(), PERMS_EDIT)) {
+ if ($this->hasPermission(Horde_Auth::getAuth(), Horde_Perms::EDIT)) {
return Ansel_Tags::writeTags($this->id, $tags, 'gallery');
} else {
throw new Horde_Exception(_("Access denied adding tags to this gallery."));
* Checks to see if a user has a given permission.
*
* @param string $userid The userid of the user.
- * @param integer $permission A PERMS_* constant to test for.
+ * @param integer $permission A Horde_Perms::* constant to test for.
* @param string $creator The creator of the event.
*
* @return boolean Whether or not $userid has $permission.
$old = $this->getParent();
$reset_has_subgalleries = false;
if (!is_null($old)) {
- $cnt = $old->countGalleryChildren(PERMS_READ, true);
+ $cnt = $old->countGalleryChildren(Horde_Perms::READ, true);
if ($cnt == 1) {
/* Count is 1, and we are about to delete it */
$reset_has_subgalleries = true;
{
if (!is_array($this->_subGalleries)) {
/* Get a list of all the subgalleries */
- $subs = $GLOBALS['ansel_storage']->listGalleries(PERMS_SHOW, null, $this->_gallery);
+ $subs = $GLOBALS['ansel_storage']->listGalleries(Horde_Perms::SHOW, null, $this->_gallery);
if (is_a($subs, 'PEAR_Error')) {
return $subs;
}
*
* @return A mixed array of Ansel_Gallery_Date and Ansel_Image objects.
*/
- function getGalleryChildren($perm = PERMS_SHOW, $from = 0, $to = 0, $noauto = false)
+ function getGalleryChildren($perm = Horde_Perms::SHOW, $from = 0, $to = 0, $noauto = false)
{
global $ansel_db, $ansel_storage;
* etc..) that need to be displayed, or a count of all the
* images in the current date grouping (for a specific day).
*/
- function countGalleryChildren($perm = PERMS_SHOW, $galleries_only = false, $noauto = true)
+ function countGalleryChildren($perm = Horde_Perms::SHOW, $galleries_only = false, $noauto = true)
{
$results = $this->getGalleryChildren($this->_date, 0, 0, $noauto);
if (is_a($results, 'PEAR_Error')) {
*/
function moveImagesTo($images, $gallery)
{
- if (!$gallery->hasPermission(Horde_Auth::getAuth(), PERMS_EDIT)) {
+ if (!$gallery->hasPermission(Horde_Auth::getAuth(), Horde_Perms::EDIT)) {
return PEAR::raiseError(sprintf(_("Access denied moving photos to \"%s\"."), $newGallery->get('name')));
- } elseif (!$this->_gallery->hasPermission(Horde_Auth::getAuth(), PERMS_DELETE)) {
+ } elseif (!$this->_gallery->hasPermission(Horde_Auth::getAuth(), Horde_Perms::DELETE)) {
return PEAR::raiseError(sprintf(_("Access denied removing photos from \"%s\"."), $gallery->get('name')));
}
function getImages($from = 0, $count = 0)
{
/* Get all of this grouping's children. */
- $children = $this->getGalleryChildren(PERMS_SHOW);
+ $children = $this->getGalleryChildren(Horde_Perms::SHOW);
/* At day level, these are all Ansel_Images, otherwise they are
* Ansel_Gallery_Date objects.
* @return A mixed array of Ansel_Gallery and Ansel_Image objects that are
* children of this gallery.
*/
- function getGalleryChildren($perm = PERMS_SHOW, $from = 0, $to = 0, $noauto = false)
+ function getGalleryChildren($perm = Horde_Perms::SHOW, $from = 0, $to = 0, $noauto = false)
{
return $this->_modeHelper->getGalleryChildren($perm, $from, $to, $noauto);
}
*
* @return integer The count of this gallery's children.
*/
- function countGalleryChildren($perm = PERMS_SHOW, $galleries_only = false, $noauto = true)
+ function countGalleryChildren($perm = Horde_Perms::SHOW, $galleries_only = false, $noauto = true)
{
// Need to force the date helper to not auto drill down when counting
// from this method, since we are only called here when we are not
* Checks to see if a user has a given permission.
*
* @param string $userid The userid of the user.
- * @param integer $permission A PERMS_* constant to test for.
+ * @param integer $permission A Horde_Perms::* constant to test for.
* @param string $creator The creator of the event.
*
* @return boolean Whether or not $userid has $permission.
/**
* Return a count of the number of children this share has
*
- * @param integer $perm A PERMS_* constant
+ * @param integer $perm A Horde_Perms::* constant
* @param boolean $allLevels Count grandchildren or just children
*
* @return mixed The number of child shares || PEAR_Error
*/
- function countChildren($perm = PERMS_SHOW, $allLevels = true)
+ function countChildren($perm = Horde_Perms::SHOW, $allLevels = true)
{
return $this->_gallery->_shareOb->countShares(Horde_Auth::getAuth(), $perm, null, $this, $allLevels);
}
/**
* Get all children of this share.
*
- * @param int $perm PERMS_* constant. If NULL will return all
- * shares regardless of permissions.
+ * @param int $perm Horde_Perms::* constant. If NULL will return
+ * all shares regardless of permissions.
* @param boolean $allLevels Return all levels.
*
* @return mixed An array of Horde_Share_Object objects || PEAR_Error
*/
- function getChildren($perm = PERMS_SHOW, $allLevels = true)
+ function getChildren($perm = Horde_Perms::SHOW, $allLevels = true)
{
return $this->_gallery->getChildren($perm, $allLevels);
}
* @return A mixed array of Ansel_Gallery and Ansel_Image objects that are
* children of this gallery.
*/
- function getGalleryChildren($perm = PERMS_SHOW, $from = 0, $to = 0)
+ function getGalleryChildren($perm = Horde_Perms::SHOW, $from = 0, $to = 0)
{
$galleries = array();
$num_galleries = 0;
/* Get the number of images and galleries */
$numimages = $this->countImages();
$num_galleries = $GLOBALS['ansel_storage']->countGalleries(
- Horde_Auth::getAuth(), PERMS_SHOW, null, $this->_gallery, false);
+ Horde_Auth::getAuth(), Horde_Perms::SHOW, null, $this->_gallery, false);
/* Now fetch the subgalleries, but only if we need to */
if ($num_galleries > $from) {
$galleries = $GLOBALS['ansel_storage']->listGalleries(
- PERMS_SHOW, null, $this->_gallery, false, $from, $to);
+ Horde_Perms::SHOW, null, $this->_gallery, false, $from, $to);
}
}
*
* @return integer The count of this gallery's children.
*/
- function countGalleryChildren($perm = PERMS_SHOW, $galleries_only = false)
+ function countGalleryChildren($perm = Horde_Perms::SHOW, $galleries_only = false)
{
if (!$galleries_only && !$this->hasSubGalleries()) {
return $this->_gallery->data['attribute_images'];
function moveImagesTo($images, $gallery)
{
- if (!$gallery->hasPermission(Horde_Auth::getAuth(), PERMS_EDIT)) {
+ if (!$gallery->hasPermission(Horde_Auth::getAuth(), Horde_Perms::EDIT)) {
return PEAR::raiseError(sprintf(_("Access denied moving photos to \"%s\"."), $newGallery->get('name')));
- } elseif (!$this->_gallery->hasPermission(Horde_Auth::getAuth(), PERMS_DELETE)) {
+ } elseif (!$this->_gallery->hasPermission(Horde_Auth::getAuth(), Horde_Perms::DELETE)) {
return PEAR::raiseError(sprintf(_("Access denied removing photos from \"%s\"."), $gallery->get('name')));
}
{
if ($subgalleries && $this->hasSubGalleries()) {
$count = $this->countImages(false);
- $galleries = $GLOBALS['ansel_storage']->listGalleries(PERMS_SHOW,
+ $galleries = $GLOBALS['ansel_storage']->listGalleries(Horde_Perms::SHOW,
false,
$this->_gallery,
true);
if (is_a($gallery, 'PEAR_Error')) {
return $gallery;
}
- if ($gallery->hasPermission(Horde_Auth::getAuth(), PERMS_READ)) {
+ if ($gallery->hasPermission(Horde_Auth::getAuth(), Horde_Perms::READ)) {
$res = Ansel_Tags::readTags($this->id);
if (!is_a($res, 'PEAR_Error')) {
$this->_tags = $res;
global $ansel_storage;
$gallery = $ansel_storage->getGallery(abs($this->gallery));
- if ($gallery->hasPermission(Horde_Auth::getAuth(), PERMS_EDIT)) {
+ if ($gallery->hasPermission(Horde_Auth::getAuth(), Horde_Perms::EDIT)) {
// Clear the local cache.
$this->_tags = array();
return Ansel_Tags::writeTags($this->id, $tags);
function _getGalleryWithImages($parent)
{
$galleries = $GLOBALS['ansel_storage']->listGalleries(
- PERMS_SHOW,
+ Horde_Perms::SHOW,
null,
$parent,
false);
/* Default permissions for logged in users */
switch ($GLOBALS['prefs']->getValue('default_permissions')) {
case 'read':
- $perms = PERMS_SHOW | PERMS_READ;
+ $perms = Horde_Perms::SHOW | Horde_Perms::READ;
break;
case 'edit':
- $perms = PERMS_SHOW | PERMS_READ | PERMS_EDIT;
+ $perms = Horde_Perms::SHOW | Horde_Perms::READ | Horde_Perms::EDIT;
break;
case 'none':
$perms = 0;
/* Default guest permissions */
switch ($GLOBALS['prefs']->getValue('guest_permissions')) {
case 'read':
- $perms = PERMS_SHOW | PERMS_READ;
+ $perms = Horde_Perms::SHOW | Horde_Perms::READ;
break;
case 'none':
default:
/* Default user groups permissions */
switch ($GLOBALS['prefs']->getValue('group_permissions')) {
case 'read':
- $perms = PERMS_SHOW | PERMS_READ;
+ $perms = Horde_Perms::SHOW | Horde_Perms::READ;
break;
case 'edit':
- $perms = PERMS_SHOW | PERMS_READ | PERMS_EDIT;
+ $perms = Horde_Perms::SHOW | Horde_Perms::READ | Horde_Perms::EDIT;
break;
case 'delete':
- $perms = PERMS_SHOW | PERMS_READ | PERMS_EDIT | PERMS_DELETE;
+ $perms = Horde_Perms::SHOW | Horde_Perms::READ | Horde_Perms::EDIT | Horde_Perms::DELETE;
break;
case 'none':
default:
/* See if we need to clear the has_subgalleries field */
if ($parent instanceof Ansel_Gallery) {
- if (!$parent->countChildren(PERMS_SHOW, false)) {
+ if (!$parent->countChildren(Horde_Perms::SHOW, false)) {
$parent->set('has_subgalleries', 0, true);
if ($GLOBALS['conf']['ansel_cache']['usecache']) {
$GLOBALS['cache']->expire('Ansel_Gallery' . $parent->id);
*
* @param array $galleries An array of gallery ids to search in. If
* left empty, will search all galleries
- * with PERMS_SHOW.
+ * with Horde_Perms::SHOW.
* @param integer $limit The maximum number of images to return
* @param string $slugs An array of gallery slugs.
* @param string $where Additional where clause
* @return array List of categories
* @throws Horde_Exception
*/
- public function listCategories($perm = PERMS_SHOW, $from = 0, $count = 0)
+ public function listCategories($perm = Horde_Perms::SHOW, $from = 0, $count = 0)
{
$sql = 'SELECT DISTINCT attribute_category FROM '
. $this->_shares->_table;
*
* @return int The count of categories
*/
- public function countCategories($perms = PERMS_SHOW)
+ public function countCategories($perms = Horde_Perms::SHOW)
{
return count($this->listCategories($perms));
}
* @return int The count
* @throws Horde_Exception
*/
- public function countGalleries($userid, $perm = PERMS_SHOW, $attributes = null,
+ public function countGalleries($userid, $perm = Horde_Perms::SHOW, $attributes = null,
$parent = null, $allLevels = true)
{
static $counts;
* @return array of Ansel_Gallery objects
* @throws Horde_Exception
*/
- public function listGalleries($perm = PERMS_SHOW,
+ public function listGalleries($perm = Horde_Perms::SHOW,
$attributes = null,
$parent = null,
$allLevels = true,
// image will not be incldued in the output.
if (!isset($galleries[$gallery_id]['perm'])) {
$galleries[$gallery_id]['perm'] =
- ($galleries[$gallery_id]['gallery']->hasPermission(Horde_Auth::getAuth(), PERMS_READ) &&
+ ($galleries[$gallery_id]['gallery']->hasPermission(Horde_Auth::getAuth(), Horde_Perms::READ) &&
$galleries[$gallery_id]['gallery']->isOldEnough() &&
!$galleries[$gallery_id]['gallery']->hasPasswd());
}
*
* @see Ansel_Storage::listGalleries()
*/
- public function getRandomGallery($perm = PERMS_SHOW, $attributes = null,
+ public function getRandomGallery($perm = Horde_Perms::SHOW, $attributes = null,
$parent = null, $allLevels = true)
{
$num_galleries = $this->countGalleries(Horde_Auth::getAuth(), $perm,
*/
public function getRecentImagesGeodata($user = null, $start = 0, $count = 8)
{
- $galleries = $this->listGalleries('PERMS_EDIT', $user);
+ $galleries = $this->listGalleries('Horde_Perms::EDIT', $user);
$where = 'gallery_id IN(' . implode(',', array_keys($galleries)) . ') AND LENGTH(image_latitude) > 0 GROUP BY image_latitude, image_longitude';
return $this->listImages(0, $start, $count, array('image_id as id', 'image_id', 'gallery_id', 'image_latitude', 'image_longitude', 'image_location'), $where, 'image_geotag_date DESC');
}
$gal = $GLOBALS['ansel_storage']->getGallery($img->gallery);
if (!is_a($gal, 'PEAR_Error')) {
$owner = $gal->get('owner');
- if ($gal->hasPermission(Horde_Auth::getAuth(), PERMS_SHOW) &&
+ if ($gal->hasPermission(Horde_Auth::getAuth(), Horde_Perms::SHOW) &&
(!isset($user) || (isset($user) && $owner == $user))) {
$imgs[] = $id;
}
Horde::logMessage($gallery, __FILE__, __LINE__, PEAR_LOG_ERR);
continue;
}
- if ($gallery->hasPermission(Horde_Auth::getAuth(), PERMS_SHOW) && (!isset($user) || (isset($user) && $gallery->get('owner') == $user))) {
+ if ($gallery->hasPermission(Horde_Auth::getAuth(), Horde_Perms::SHOW) && (!isset($user) || (isset($user) && $gallery->get('owner') == $user))) {
$results['galleries'][] = $id;
}
}
//$view = Horde_Util::getFormData('view', 'Gallery');
/* Check permissions on the gallery and get appropriate tile image */
- if ($dgallery->hasPermission(Horde_Auth::getAuth(), PERMS_READ)) {
+ if ($dgallery->hasPermission(Horde_Auth::getAuth(), Horde_Perms::READ)) {
if (is_null($style)) {
$style = $dgallery->getStyle();
}
}
/* Check gallery permissions and get appropriate tile image */
- if ($gallery->hasPermission(Horde_Auth::getAuth(), PERMS_READ)) {
+ if ($gallery->hasPermission(Horde_Auth::getAuth(), Horde_Perms::READ)) {
if (is_null($style)) {
$style = $gallery->getStyle();
}
$text_link = $view_link . htmlspecialchars($gallery->get('name'), ENT_COMPAT, Horde_Nls::getCharset())
. '</a>';
- if ($gallery->hasPermission(Horde_Auth::getAuth(), PERMS_EDIT) && !$mini) {
+ if ($gallery->hasPermission(Horde_Auth::getAuth(), Horde_Perms::EDIT) && !$mini) {
$properties_link = Horde_Util::addParameter(
Horde::applicationUrl('gallery.php', true),
array('gallery' => $gallery->id,
}
$thumb_url = Ansel::getImageUrl($image->id, $thumbstyle, true, $style['name']);
- $option_select = $parent->hasPermission(Horde_Auth::getAuth(), PERMS_DELETE);
- $option_edit = $parent->hasPermission(Horde_Auth::getAuth(), PERMS_EDIT);
+ $option_select = $parent->hasPermission(Horde_Auth::getAuth(), Horde_Perms::DELETE);
+ $option_edit = $parent->hasPermission(Horde_Auth::getAuth(), Horde_Perms::EDIT);
$imgAttributes = (!empty($params['image_view_attributes'])
? $params['image_view_attributes'] : array());
}
ob_start();
- // In-line caption editing if we have PERMS_EDIT
+ // In-line caption editing if we have Horde_Perms::EDIT
if ($option_edit) {
$imple = Horde_Ajax_Imple::factory(array('ansel', 'EditCaption'),
array('id' => $image->id,
}
if (is_a($gallery, 'PEAR_Error')) {
throw new Horde_Exception($gallery->getMessage());
- } elseif (!$gallery->hasPermission(Horde_Auth::getAuth(), PERMS_READ)) {
+ } elseif (!$gallery->hasPermission(Horde_Auth::getAuth(), Horde_Perms::READ)) {
throw new Horde_Exception(sprintf(_("Access denied to gallery \"%s\"."), $gallery->get('name')));
}
Horde::logMessage($e->getMessage(), __FILE__, __LINE__, PEAR_LOG_ERR);
exit;
}
- if (!$gallery->hasPermission(Horde_Auth::getAuth(), PERMS_READ)) {
+ if (!$gallery->hasPermission(Horde_Auth::getAuth(), Horde_Perms::READ)) {
return '';
}
// We don't allow age restricted or password locked galleries to be
// viewed via the mini embedded view since it shows *all* the images
- if (!$this->gallery->hasPermission(Horde_Auth::getAuth(), PERMS_READ) ||
+ if (!$this->gallery->hasPermission(Horde_Auth::getAuth(), Horde_Perms::READ) ||
!$this->gallery->isOldEnough() ||
$this->gallery->hasPasswd()) {
exit;
}
- if (!$this->gallery->hasPermission(Horde_Auth::getAuth(), PERMS_READ)) {
+ if (!$this->gallery->hasPermission(Horde_Auth::getAuth(), Horde_Perms::READ)) {
throw new Horde_Exception('Access denied viewing this gallery.');
}
public function fetchChildren($noauto)
{
/* Total number of tiles for this gallery view */
- $this->numTiles = $this->view->gallery->countGalleryChildren(PERMS_SHOW, false, $noauto);
+ $this->numTiles = $this->view->gallery->countGalleryChildren(Horde_Perms::SHOW, false, $noauto);
/* Children to display on this page */
$this->children = $this->view->gallery->getGalleryChildren(
- PERMS_SHOW,
+ Horde_Perms::SHOW,
$this->page * $this->perpage,
$this->perpage,
!empty($this->view->force_grouping));
/* Only need these if not being called via the api */
if (empty($this->view->api)) {
- $option_edit = $this->view->gallery->hasPermission(Horde_Auth::getAuth(), PERMS_EDIT);
- $option_select = $option_delete = $this->view->gallery->hasPermission(Horde_Auth::getAuth(), PERMS_DELETE);
- $option_move = ($option_delete && $GLOBALS['ansel_storage']->countGalleries(PERMS_EDIT));
- $option_copy = ($option_edit && $GLOBALS['ansel_storage']->countGalleries(PERMS_EDIT));
+ $option_edit = $this->view->gallery->hasPermission(Horde_Auth::getAuth(), Horde_Perms::EDIT);
+ $option_select = $option_delete = $this->view->gallery->hasPermission(Horde_Auth::getAuth(), Horde_Perms::DELETE);
+ $option_move = ($option_delete && $GLOBALS['ansel_storage']->countGalleries(Horde_Perms::EDIT));
+ $option_copy = ($option_edit && $GLOBALS['ansel_storage']->countGalleries(Horde_Perms::EDIT));
/* See if we requested a show_actions change */
if (Horde_Util::getFormData('actionID', '') == 'show_actions') {
$prefs->setValue('show_actions', (int)!$prefs->getValue('show_actions'));
/* Don't bother if we are being called from the api */
if (empty($this->view->api)) {
$option_edit = $this->view->gallery->hasPermission(Horde_Auth::getAuth(),
- PERMS_EDIT);
+ Horde_Perms::EDIT);
$option_select = $option_delete = $this->view->gallery->hasPermission(
- Horde_Auth::getAuth(), PERMS_DELETE);
- $option_move = ($option_delete && $GLOBALS['ansel_storage']->countGalleries(PERMS_EDIT));
- $option_copy = ($option_edit && $GLOBALS['ansel_storage']->countGalleries(PERMS_EDIT));
+ Horde_Auth::getAuth(), Horde_Perms::DELETE);
+ $option_move = ($option_delete && $GLOBALS['ansel_storage']->countGalleries(Horde_Perms::EDIT));
+ $option_copy = ($option_edit && $GLOBALS['ansel_storage']->countGalleries(Horde_Perms::EDIT));
/* See if we requested a show_actions change (fallback for non-js) */
if (Horde_Util::getFormData('actionID', '') == 'show_actions') {
$prefs->setValue('show_actions', (int)!$prefs->getValue('show_actions'));
$this->addWidget(Ansel_Widget::factory('Links', array()));
/* In line caption editing */
- if ($this->gallery->hasPermission(Horde_Auth::getAuth(), PERMS_EDIT)) {
+ if ($this->gallery->hasPermission(Horde_Auth::getAuth(), Horde_Perms::EDIT)) {
$imple = Horde_Ajax_Imple::factory(array('ansel', 'EditCaption'),
array('id' => $this->resource->id,
'domid' => "Caption",
$try = $ansel_storage->getGalleries($getThese);
$gallerylist = array();
foreach ($try as $id => $gallery) {
- if ($gallery->hasPermission(Horde_Auth::getAuth(), PERMS_SHOW)) {
+ if ($gallery->hasPermission(Horde_Auth::getAuth(), Horde_Perms::SHOW)) {
$gallerylist[$id] = $gallery;
}
}
}
$num_galleries = $ansel_storage->countGalleries(
- Horde_Auth::getAuth(), PERMS_SHOW, $filter, null, false);
+ Horde_Auth::getAuth(), Horde_Perms::SHOW, $filter, null, false);
if (is_a($num_galleries, 'PEAR_Error')) {
return $num_galleries->getMessage();
}
$gallerylist = array();
} else {
$gallerylist = $ansel_storage->listGalleries(
- PERMS_SHOW, $filter, null, false, $page * $galleries_perpage,
+ Horde_Perms::SHOW, $filter, null, false, $page * $galleries_perpage,
$galleries_perpage, $sortby, $sortdir);
}
// the image object to get the gallery.
$img = $ansel_storage->getImage($image);
$gallery = $ansel_storage->getgallery($img->gallery);
- if (!$gallery->hasPermission(Horde_Auth::getAuth(), PERMS_DELETE)) {
+ if (!$gallery->hasPermission(Horde_Auth::getAuth(), Horde_Perms::DELETE)) {
$GLOBALS['notification']->push(
sprintf(_("Access denied deleting photos from \"%s\"."), $image),
'horde.error');
'actionID' => 'add'));
$vars = Horde_Variables::getDefaultVariables();
- $option_move = $option_copy = $ansel_storage->countGalleries(PERMS_EDIT);
+ $option_move = $option_copy = $ansel_storage->countGalleries(Horde_Perms::EDIT);
$pagestart = ($page * $perpage) + 1;
}
$html .= '<li>' . Horde::link($slideshow_url, '', 'widget') . Horde::img('slideshow_play.png', _("Start Slideshow")) . ' ' . _("Start Slideshow") . '</a></li>';
}
- if (!empty($uploadurl) && $this->_view->gallery->hasPermission(Horde_Auth::getAuth(), PERMS_EDIT)) {
+ if (!empty($uploadurl) && $this->_view->gallery->hasPermission(Horde_Auth::getAuth(), Horde_Perms::EDIT)) {
$html .= '<li>' . Horde::link($uploadurl, '', 'widget') . Horde::img('image_add.png') . ' ' . _("Upload photos") . '</a></li>';
/* Subgalleries */
}
/* Image upload, subgalleries, captions etc... */
- if ($this->_view->gallery->hasPermission(Horde_Auth::getAuth(), PERMS_EDIT)) {
+ if ($this->_view->gallery->hasPermission(Horde_Auth::getAuth(), Horde_Perms::EDIT)) {
/* Properties */
$html .= '<li>' . Horde::link(Horde_Util::addParameter($galleryurl, array('actionID' => 'modify', 'url' => $selfurl)), '', 'widget') . Horde::img('edit.png', '', '', $GLOBALS['registry']->getImageDir('horde')) . ' ' . _("Change properties") . '</a></li>';
if ($count) {
$html .= '<li>' . Horde::link($reporturl, '', 'widget') . ' ' . _("Report") . "</a></li>\n";
}
- if ($this->_view->gallery->hasPermission(Horde_Auth::getAuth(), PERMS_DELETE)) {
+ if ($this->_view->gallery->hasPermission(Horde_Auth::getAuth(), Horde_Perms::DELETE)) {
$html .= '<li>' . Horde::link(Horde_Util::addParameter($galleryurl, 'actionID', 'empty'), '', 'widget') . Horde::img('delete.png', '', '', $GLOBALS['registry']->getImageDir('horde')) . ' ' . _("Delete All Photos") . '</a></li>';
$html .= '<li>' . Horde::link(Horde_Util::addParameter($galleryurl, 'actionID', 'delete'), '', 'widget') . Horde::img('delete.png', '', '', $GLOBALS['registry']->getImageDir('horde')) . ' ' . _("Delete Entire Gallery") . '</a></li>';
}
$images = $faces->getGalleryFaces($this->_view->resource->id);
- if ($this->_view->gallery->hasPermission(Horde_Auth::getAuth(), PERMS_EDIT)) {
+ if ($this->_view->gallery->hasPermission(Horde_Auth::getAuth(), Horde_Perms::EDIT)) {
$link_text = (empty($images) ? _("Find faces") : _("Edit faces"));
$html .= '<a id="edit_faces" href="' . Horde_Util::addParameter(Horde::applicationUrl('faces/gallery.php'), 'gallery', $this->_view->gallery->id)
. '" class="widget">' . $link_text . '</a>';
$imple = Horde_Ajax_Imple::factory(array('ansel', 'ImageSaveGeotag'), array());
$impleUrl = $imple->getUrl();
- $permsEdit = $this->_view->gallery->hasPermission(Horde_Auth::getAuth(), PERMS_EDIT);
+ $permsEdit = $this->_view->gallery->hasPermission(Horde_Auth::getAuth(), Horde_Perms::EDIT);
$viewType = $this->_view->viewType();
if (count($geodata) == 0 && $viewType != 'Image') {
// back on going to the find all faces in gallery page if no js...
// although, currently, *that* page requires js as well so...
// TODO: A way to 'close', or go back to, the normal widget view.
- if ($this->_view->gallery->hasPermission(Horde_Auth::getAuth(), PERMS_EDIT)) {
+ if ($this->_view->gallery->hasPermission(Horde_Auth::getAuth(), Horde_Perms::EDIT)) {
$link_text = (empty($images) ? _("Find faces") : _("Edit faces"));
$html .= '<a id="edit_faces" href="' . Horde_Util::addParameter(Horde::applicationUrl('faces/gallery.php'), 'gallery', $this->_view->gallery->id)
. '" class="widget">' . $link_text . '</a> | '
/* Set up the tree */
$tree = Horde_Tree::singleton('otherAnselGalleries_' . md5($owner), 'javascript');
$tree->setOption(array('class' => 'anselWidgets'));
- $gals = $GLOBALS['ansel_storage']->listGalleries(PERMS_SHOW, $owner,
+ $gals = $GLOBALS['ansel_storage']->listGalleries(Horde_Perms::SHOW, $owner,
null, true, 0, 0,
'name', 0);
/* Build the tag widget */
$html = $this->_htmlBegin();
$html .= '<div id="tags">' . $this->_getTagHTML() . '</div>';
- if ($this->_view->gallery->hasPermission(Horde_Auth::getAuth(), PERMS_EDIT)) {
+ if ($this->_view->gallery->hasPermission(Horde_Auth::getAuth(), Horde_Perms::EDIT)) {
ob_start();
/* Attach the Ajax action */
$imple = Horde_Ajax_Imple::factory(array('ansel', 'TagActions'),
}
$hasEdit = $this->_view->gallery->hasPermission(Horde_Auth::getAuth(),
- PERMS_EDIT);
+ Horde_Perms::EDIT);
$owner = $this->_view->gallery->get('owner');
$tags = $this->_view->resource->getTags();
if (count($tags)) {
if (is_a($gallery, 'PEAR_Error')) {
Horde::fatal(_("An error has occured retrieving the image. Details have been logged."), __FILE__, __LINE__, true);
}
-if (!$gallery->hasPermission(Horde_Auth::getAuth(), PERMS_EDIT)) {
+if (!$gallery->hasPermission(Horde_Auth::getAuth(), Horde_Perms::EDIT)) {
Horde::fatal(_("Not Authorized. Details have been logged for the server administrator."), __FILE__, __LINE__, true);
}
$share->set('owner', $new_owner);
$share->save();
if (Horde_Util::getFormData('owner_show')) {
- $perm->addUserPermission($new_owner, PERMS_SHOW, false);
+ $perm->addUserPermission($new_owner, Horde_Perms::SHOW, false);
} else {
- $perm->removeUserPermission($new_owner, PERMS_SHOW, false);
+ $perm->removeUserPermission($new_owner, Horde_Perms::SHOW, false);
}
if (Horde_Util::getFormData('owner_read')) {
- $perm->addUserPermission($new_owner, PERMS_READ, false);
+ $perm->addUserPermission($new_owner, Horde_Perms::READ, false);
} else {
- $perm->removeUserPermission($new_owner, PERMS_READ, false);
+ $perm->removeUserPermission($new_owner, Horde_Perms::READ, false);
}
if (Horde_Util::getFormData('owner_edit')) {
- $perm->addUserPermission($new_owner, PERMS_EDIT, false);
+ $perm->addUserPermission($new_owner, Horde_Perms::EDIT, false);
} else {
- $perm->removeUserPermission($new_owner, PERMS_EDIT, false);
+ $perm->removeUserPermission($new_owner, Horde_Perms::EDIT, false);
}
if (Horde_Util::getFormData('owner_delete')) {
- $perm->addUserPermission($new_owner, PERMS_DELETE, false);
+ $perm->addUserPermission($new_owner, Horde_Perms::DELETE, false);
} else {
- $perm->removeUserPermission($new_owner, PERMS_DELETE, false);
+ $perm->removeUserPermission($new_owner, Horde_Perms::DELETE, false);
}
}
}
// Process default permissions.
if (Horde_Util::getFormData('default_show')) {
- $perm->addDefaultPermission(PERMS_SHOW, false);
+ $perm->addDefaultPermission(Horde_Perms::SHOW, false);
} else {
- $perm->removeDefaultPermission(PERMS_SHOW, false);
+ $perm->removeDefaultPermission(Horde_Perms::SHOW, false);
}
if (Horde_Util::getFormData('default_read')) {
- $perm->addDefaultPermission(PERMS_READ, false);
+ $perm->addDefaultPermission(Horde_Perms::READ, false);
} else {
- $perm->removeDefaultPermission(PERMS_READ, false);
+ $perm->removeDefaultPermission(Horde_Perms::READ, false);
}
if (Horde_Util::getFormData('default_edit')) {
- $perm->addDefaultPermission(PERMS_EDIT, false);
+ $perm->addDefaultPermission(Horde_Perms::EDIT, false);
} else {
- $perm->removeDefaultPermission(PERMS_EDIT, false);
+ $perm->removeDefaultPermission(Horde_Perms::EDIT, false);
}
if (Horde_Util::getFormData('default_delete')) {
- $perm->addDefaultPermission(PERMS_DELETE, false);
+ $perm->addDefaultPermission(Horde_Perms::DELETE, false);
} else {
- $perm->removeDefaultPermission(PERMS_DELETE, false);
+ $perm->removeDefaultPermission(Horde_Perms::DELETE, false);
}
// Process guest permissions.
if (Horde_Util::getFormData('guest_show')) {
- $perm->addGuestPermission(PERMS_SHOW, false);
+ $perm->addGuestPermission(Horde_Perms::SHOW, false);
} else {
- $perm->removeGuestPermission(PERMS_SHOW, false);
+ $perm->removeGuestPermission(Horde_Perms::SHOW, false);
}
if (Horde_Util::getFormData('guest_read')) {
- $perm->addGuestPermission(PERMS_READ, false);
+ $perm->addGuestPermission(Horde_Perms::READ, false);
} else {
- $perm->removeGuestPermission(PERMS_READ, false);
+ $perm->removeGuestPermission(Horde_Perms::READ, false);
}
if (Horde_Util::getFormData('guest_edit')) {
- $perm->addGuestPermission(PERMS_EDIT, false);
+ $perm->addGuestPermission(Horde_Perms::EDIT, false);
} else {
- $perm->removeGuestPermission(PERMS_EDIT, false);
+ $perm->removeGuestPermission(Horde_Perms::EDIT, false);
}
if (Horde_Util::getFormData('guest_delete')) {
- $perm->addGuestPermission(PERMS_DELETE, false);
+ $perm->addGuestPermission(Horde_Perms::DELETE, false);
} else {
- $perm->removeGuestPermission(PERMS_DELETE, false);
+ $perm->removeGuestPermission(Horde_Perms::DELETE, false);
}
// Process creator permissions.
if (Horde_Util::getFormData('creator_show')) {
- $perm->addCreatorPermission(PERMS_SHOW, false);
+ $perm->addCreatorPermission(Horde_Perms::SHOW, false);
} else {
- $perm->removeCreatorPermission(PERMS_SHOW, false);
+ $perm->removeCreatorPermission(Horde_Perms::SHOW, false);
}
if (Horde_Util::getFormData('creator_read')) {
- $perm->addCreatorPermission(PERMS_READ, false);
+ $perm->addCreatorPermission(Horde_Perms::READ, false);
} else {
- $perm->removeCreatorPermission(PERMS_READ, false);
+ $perm->removeCreatorPermission(Horde_Perms::READ, false);
}
if (Horde_Util::getFormData('creator_edit')) {
- $perm->addCreatorPermission(PERMS_EDIT, false);
+ $perm->addCreatorPermission(Horde_Perms::EDIT, false);
} else {
- $perm->removeCreatorPermission(PERMS_EDIT, false);
+ $perm->removeCreatorPermission(Horde_Perms::EDIT, false);
}
if (Horde_Util::getFormData('creator_delete')) {
- $perm->addCreatorPermission(PERMS_DELETE, false);
+ $perm->addCreatorPermission(Horde_Perms::DELETE, false);
} else {
- $perm->removeCreatorPermission(PERMS_DELETE, false);
+ $perm->removeCreatorPermission(Horde_Perms::DELETE, false);
}
// Process user permissions.
}
if (!empty($u_show[$key])) {
- $perm->addUserPermission($user, PERMS_SHOW, false);
+ $perm->addUserPermission($user, Horde_Perms::SHOW, false);
} else {
- $perm->removeUserPermission($user, PERMS_SHOW, false);
+ $perm->removeUserPermission($user, Horde_Perms::SHOW, false);
}
if (!empty($u_read[$key])) {
- $perm->addUserPermission($user, PERMS_READ, false);
+ $perm->addUserPermission($user, Horde_Perms::READ, false);
} else {
- $perm->removeUserPermission($user, PERMS_READ, false);
+ $perm->removeUserPermission($user, Horde_Perms::READ, false);
}
if (!empty($u_edit[$key])) {
- $perm->addUserPermission($user, PERMS_EDIT, false);
+ $perm->addUserPermission($user, Horde_Perms::EDIT, false);
} else {
- $perm->removeUserPermission($user, PERMS_EDIT, false);
+ $perm->removeUserPermission($user, Horde_Perms::EDIT, false);
}
if (!empty($u_delete[$key])) {
- $perm->addUserPermission($user, PERMS_DELETE, false);
+ $perm->addUserPermission($user, Horde_Perms::DELETE, false);
} else {
- $perm->removeUserPermission($user, PERMS_DELETE, false);
+ $perm->removeUserPermission($user, Horde_Perms::DELETE, false);
}
}
}
if (!empty($g_show[$key])) {
- $perm->addGroupPermission($group, PERMS_SHOW, false);
+ $perm->addGroupPermission($group, Horde_Perms::SHOW, false);
} else {
- $perm->removeGroupPermission($group, PERMS_SHOW, false);
+ $perm->removeGroupPermission($group, Horde_Perms::SHOW, false);
}
if (!empty($g_read[$key])) {
- $perm->addGroupPermission($group, PERMS_READ, false);
+ $perm->addGroupPermission($group, Horde_Perms::READ, false);
} else {
- $perm->removeGroupPermission($group, PERMS_READ, false);
+ $perm->removeGroupPermission($group, Horde_Perms::READ, false);
}
if (!empty($g_edit[$key])) {
- $perm->addGroupPermission($group, PERMS_EDIT, false);
+ $perm->addGroupPermission($group, Horde_Perms::EDIT, false);
} else {
- $perm->removeGroupPermission($group, PERMS_EDIT, false);
+ $perm->removeGroupPermission($group, Horde_Perms::EDIT, false);
}
if (!empty($g_delete[$key])) {
- $perm->addGroupPermission($group, PERMS_DELETE, false);
+ $perm->addGroupPermission($group, Horde_Perms::DELETE, false);
} else {
- $perm->removeGroupPermission($group, PERMS_DELETE, false);
+ $perm->removeGroupPermission($group, Horde_Perms::DELETE, false);
}
}
if (is_a($share, 'PEAR_Error')) {
$title = _("Edit Permissions");
} else {
- $children = $GLOBALS['ansel_storage']->listGalleries(PERMS_READ, false,
+ $children = $GLOBALS['ansel_storage']->listGalleries(Horde_Perms::READ, false,
$share);
$title = sprintf(_("Edit Permissions for %s"), $share->get('name'));
}
}
$img = Ansel::getImageUrl($imageId, 'thumb', false);
if (!is_a($img, 'PEAR_Error') &&
- $gal->hasPermission(Horde_Auth::getAuth(), PERMS_SHOW) &&
+ $gal->hasPermission(Horde_Auth::getAuth(), Horde_Perms::SHOW) &&
!$gal->hasPasswd() &&
$gal->isOldEnough()) {
echo '<img src="' . $img . '" alt="' . htmlspecialchars($image->filename) . '" />';
$gallery = $ansel_storage->getGallery($id);
}
if (!is_a($gallery, 'PEAR_Error') &&
- $gallery->hasPermission(Horde_Auth::getAuth(), PERMS_SHOW) &&
+ $gallery->hasPermission(Horde_Auth::getAuth(), Horde_Perms::SHOW) &&
!$gallery->hasPasswd() && $gallery->isOldEnough()) {
if (!$gallery->countImages() && $gallery->hasSubGalleries()) {
- $subgalleries = $ansel_storage->listGalleries(PERMS_SHOW,
+ $subgalleries = $ansel_storage->listGalleries(Horde_Perms::SHOW,
null,
$gallery);
$subs = array();
break;
case 'user':
- $shares = $ansel_storage->listGalleries(PERMS_SHOW, $id);
+ $shares = $ansel_storage->listGalleries(Horde_Perms::SHOW, $id);
if (!is_a($shares, 'PEAR_Error')) {
$galleries = array();
foreach ($shares as $gallery) {
}
if (!isset($galleries[$gallery_id]['perm'])) {
$galleries[$gallery_id]['perm'] =
- ($galleries[$gallery_id]['gallery']->hasPermission(Horde_Auth::getAuth(), PERMS_READ) &&
+ ($galleries[$gallery_id]['gallery']->hasPermission(Horde_Auth::getAuth(), Horde_Perms::READ) &&
$galleries[$gallery_id]['gallery']->isOldEnough() &&
!$galleries[$gallery_id]['gallery']->hasPasswd());
}
} else {
$gallery = $ansel_storage->getGallery($galleryId);
if (is_a($gallery, 'PEAR_Error') ||
- !$gallery->hasPermission(Horde_Auth::getAuth(), PERMS_EDIT)) {
+ !$gallery->hasPermission(Horde_Auth::getAuth(), Horde_Perms::EDIT)) {
$error = sprintf(_("Access denied adding photos to \"%s\"."),
$galleryId);
Horde::logMessage($error, __FILE__, __LINE__, PEAR_LOG_WARNING);
function emptyGalleryCheck($gallery)
{
if ($gallery->hasSubGalleries()) {
- $children = $GLOBALS['ansel_storage']->listGalleries(PERMS_SHOW, null, $gallery, false);
+ $children = $GLOBALS['ansel_storage']->listGalleries(Horde_Perms::SHOW, null, $gallery, false);
foreach ($children as $child) {
// First check all children to see if they are empty...
emptyGalleryCheck($child);
function emptyGalleryCheck($gallery)
{
if ($gallery->hasSubGalleries()) {
- $children = $GLOBALS['ansel_storage']->listGalleries(PERMS_SHOW, null, $gallery, false);
+ $children = $GLOBALS['ansel_storage']->listGalleries(Horde_Perms::SHOW, null, $gallery, false);
foreach ($children as $child) {
// First check all children to see if they are empty...
emptyGalleryCheck($child);
<td>
<select name="gallery_parent" id="gallery_parent">
<option value=""><?php echo _("Top Level Gallery") ?></option>
- <?php echo Ansel::selectGalleries($gallery_parent, PERMS_EDIT, null, null, true, 0, 0, $galleryId) ?>
+ <?php echo Ansel::selectGalleries($gallery_parent, Horde_Perms::EDIT, null, null, true, 0, 0, $galleryId) ?>
</select>
</td>
</tr>
<?php
$num_galleries = $GLOBALS['ansel_storage']->countGalleries(
- Horde_Auth::getAuth(), PERMS_SHOW, array('category' => $group), null, false);
+ Horde_Auth::getAuth(), Horde_Perms::SHOW, array('category' => $group), null, false);
if (empty($group)) {
$category_title = _("Unfiled");
$preview_gallery = array();
if ($num_galleries < 5) {
$preview_gallery = $GLOBALS['ansel_storage']->listGalleries(
- PERMS_SHOW, array('category' => $group), null, false);
+ Horde_Perms::SHOW, array('category' => $group), null, false);
} else {
$preview_gallery = $GLOBALS['ansel_storage']->listGalleries(
- PERMS_SHOW, array('category' => $group), null,
+ Horde_Perms::SHOW, array('category' => $group), null,
false, rand(0, $num_galleries - 4), 4);
}
$mini_count = 0;
'owner' => $group,
'view' => 'List')));
-$num_galleries = $ansel_storage->countGalleries(Horde_Auth::getAuth(), PERMS_SHOW,
+$num_galleries = $ansel_storage->countGalleries(Horde_Auth::getAuth(), Horde_Perms::SHOW,
$group, null, false);
if ($num_galleries < 5) {
- $mini_galleries = $ansel_storage->listGalleries(PERMS_SHOW,
+ $mini_galleries = $ansel_storage->listGalleries(Horde_Perms::SHOW,
$group, null, false);
} else {
$mini_galleries = $GLOBALS['ansel_storage']->listGalleries(
- PERMS_SHOW, $group, null, false, rand(0, $num_galleries - 4), 4);
+ Horde_Perms::SHOW, $group, null, false, rand(0, $num_galleries - 4), 4);
}
$mini_galleries = array_values($mini_galleries);
?>
?>
<div class="control anselActions" style="text-align:center;">
<?php
-if ($gallery->hasPermission(Horde_Auth::getAuth(), PERMS_EDIT)) {
+if ($gallery->hasPermission(Horde_Auth::getAuth(), Horde_Perms::EDIT)) {
echo Horde::link(Horde::applicationUrl($save_url), _("Save Change"))
. Horde::img('save.png', '', '', $registry->getImageDir('horde')) . ' ' . _("Save Change") . '</a> ';
}
-if ($gallery->hasPermission(Horde_Auth::getAuth(), PERMS_EDIT)) {
+if ($gallery->hasPermission(Horde_Auth::getAuth(), Horde_Perms::EDIT)) {
echo Horde::link(Horde::applicationUrl($edit_url), _("Cancel Change"))
. Horde::img('delete.png', '', '', $registry->getImageDir('horde')) . ' ' . _("Cancel Change") . '</a>';
}
?>
<div class="control anselActions" style="text-align:center;">
<?php
-if ($gallery->hasPermission(Horde_Auth::getAuth(), PERMS_EDIT)) {
+if ($gallery->hasPermission(Horde_Auth::getAuth(), Horde_Perms::EDIT)) {
echo Horde::link(Horde::applicationUrl($save_url), _("Save Change"))
. Horde::img('save.png', '', '', $registry->getImageDir('horde')) . ' ' . _("Save Change") . '</a> ';
}
-if ($gallery->hasPermission(Horde_Auth::getAuth(), PERMS_EDIT)) {
+if ($gallery->hasPermission(Horde_Auth::getAuth(), Horde_Perms::EDIT)) {
echo Horde::link(Horde::applicationUrl($edit_url), _("Cancel Change"))
. Horde::img('delete.png', '', '', $registry->getImageDir('horde')) . ' ' . _("Cancel Change") . '</a>';
}
</td>
<td align="right">
<?php echo implode(' | ', $action_links); ?>
- <select name="new_gallery"><option value="-1"><?php echo _("Selected photos to") ?></option><?php echo Ansel::selectGalleries(null, PERMS_EDIT) ?></select>
+ <select name="new_gallery"><option value="-1"><?php echo _("Selected photos to") ?></option><?php echo Ansel::selectGalleries(null, Horde_Perms::EDIT) ?></select>
</td></tr></table>
<?php endif; ?>
<?php if (!$this->numTiles): ?>
<?php if ($option_copy): ?>
| <?php echo Horde::link('#', _("Copy"), 'widget', '', 'copySelected(); return false;') . _("Copy"); ?></a>
<?php endif; ?>
- <select name="new_gallery"><option value="-1"><?php echo _("Selected photos to") ?></option><?php echo Ansel::selectGalleries($this->galleryId, PERMS_EDIT) ?></select>
+ <select name="new_gallery"><option value="-1"><?php echo _("Selected photos to") ?></option><?php echo Ansel::selectGalleries($this->galleryId, Horde_Perms::EDIT) ?></select>
</td></tr></table>
<?php endif; ?>
<?php if (!$this->numTiles): ?>
<?php
$needSeperator = false;
$actionHTML = '';
- if ($this->gallery->hasPermission(Horde_Auth::getAuth(), PERMS_EDIT) && empty($this->_params['api'])) {
+ if ($this->gallery->hasPermission(Horde_Auth::getAuth(), Horde_Perms::EDIT) && empty($this->_params['api'])) {
$needSeperator = true;
$actionHTML .= Horde::link('#', '', '', '_blank', $this->_urls['prop_popup'] . 'return false;', '', '', array('id' => 'image_properties_link')) . _("Properties") . '</a>';
$actionHTML .= ' | ' . Horde::link($this->_urls['edit'], '', '', '', '', '', '', array('id' => 'image_edit_link')) . _("Edit") . '</a>';
}
- if ($this->gallery->hasPermission(Horde_Auth::getAuth(), PERMS_DELETE) && empty($this->_params['api'])) {
+ if ($this->gallery->hasPermission(Horde_Auth::getAuth(), Horde_Perms::DELETE) && empty($this->_params['api'])) {
$actionHTML .= ' | ' . Horde::link($this->_urls['delete'], '', '', '', 'return window.confirm(\'' . addslashes(sprintf(_("Do you want to permanently delete ''%s''?"), $this->resource->filename)) . '\');', '', '', array('id' => 'image_delete_link')) . _("Delete") . '</a>';
}
if (!empty($conf['ecard']['enable']) && !empty($this->_urls['ecard'])) {
<?php if ($option_copy): ?>
| <?php echo Horde::link('#', _("Copy"), 'widget', '', 'copySelected(); return false;') . _("Copy"); ?></a>
<?php endif; ?>
- <select name="new_gallery"><option value="-1"><?php echo _("Selected photos to") ?></option><?php echo Ansel::selectGalleries(null, PERMS_EDIT) ?></select>
+ <select name="new_gallery"><option value="-1"><?php echo _("Selected photos to") ?></option><?php echo Ansel::selectGalleries(null, Horde_Perms::EDIT) ?></select>
</td>
</tr>
</table>
<table width="100%" cellspacing="0">
<tr class="control">
<td>
- <?php if ($this->gallery->hasPermission(Horde_Auth::getAuth(), PERMS_EDIT)): ?>
+ <?php if ($this->gallery->hasPermission(Horde_Auth::getAuth(), Horde_Perms::EDIT)): ?>
<?php echo Horde::link('#', '', '', '_blank', 'SlideController.pause();' . $this->_urls['prop_popup'], '', '', array('id' => 'image_properties_link')) . _("Properties") ?></a>
| <?php echo Horde::link(Horde::applicationUrl($this->_urls['edit']), '', '', '', '', '', '', array('id' => 'image_edit_link')) . _("Edit") ?></a>
<?php endif; ?>
- <?php if ($this->gallery->hasPermission(Horde_Auth::getAuth(), PERMS_DELETE)): ?>
+ <?php if ($this->gallery->hasPermission(Horde_Auth::getAuth(), Horde_Perms::DELETE)): ?>
| <?php echo Horde::link($this->_urls['delete'], '', '', '', 'return window.confirm(\'' . addslashes(sprintf(_("Do you want to permanently delete \"%s\"?"), $this->resource->filename)) . '\');', '', '', array('id' => 'image_delete_link')) . _("Delete") ?></a>
<?php endif; ?>
</td>
<p>
<label style="font-weight:bold" for="gallery"><?php echo _("Existing galleries:") ?></label><br />
<select id="gallery" name="gallery">
- <?php echo Ansel::selectGalleries(null, PERMS_EDIT) ?>
+ <?php echo Ansel::selectGalleries(null, Horde_Perms::EDIT) ?>
</select>
</p>
<p>
$error = _("Invalid gallery specified.") . "<br />\n";
} else {
$gallery = $ansel_storage->getGallery($galleryId);
- if (is_a($gallery, 'PEAR_ERROR') || !$gallery->hasPermission(Horde_Auth::getAuth(), PERMS_EDIT)) {
+ if (is_a($gallery, 'PEAR_ERROR') || !$gallery->hasPermission(Horde_Auth::getAuth(), Horde_Perms::EDIT)) {
$error = sprintf(_("Access denied adding photos to \"%s\"."), $gallery->get('name'));
} else {
$error = false;
$form->renderActive($renderer, $vars, Horde::selfURL(), 'post');
} else {
- if (Babel::hasPermission('view', 'tabs', PERMS_EDIT)) {
+ if (Babel::hasPermission('view', 'tabs', Horde_Perms::EDIT)) {
$hmenu_desc = _("Edit Header");
$url = Horde::applicationUrl('edit.php');
$url = Horde_Util::addParameter($url, array('module' => $app,
$sfile = $m[1];
$sline = $m[2];
- if (Babel::hasPermission('viewsource', 'tabs', PERMS_EDIT)) {
+ if (Babel::hasPermission('viewsource', 'tabs', Horde_Perms::EDIT)) {
$surl = Horde::applicationUrl('viewsource.php');
$surl = Horde_Util::addParameter($surl, array('module' => $app,
'file' => $sfile,
if ($locked) {
echo Horde::img('locked.png') . ' ' . sprintf(_("Locked by %s"), $locked);
} else {
- if (Babel::hasPermission('view', 'tabs', PERMS_EDIT)) {
+ if (Babel::hasPermission('view', 'tabs', Horde_Perms::EDIT)) {
if (!$editmode || $cstring != $encstr) {
$surl = Horde::applicationUrl('view.php');
$surl = Horde_Util::addParameter($surl, array('module' => $app, 'cstring' => $encstr, 'editmode' => 1, 'page' => $page, 'filter' => $filter, 'search' => $search));
return true;
}
- $perms = Perms::singleton();
+ $perms = Horde_Perms::singleton();
if ($permmask === null) {
- $permmask = PERMS_SHOW|PERMS_READ;
+ $permmask = Horde_Perms::SHOW|Horde_Perms::READ;
}
# Default deny all permissions
*
* @return array Possibly empty array of domain information
*/
- function getDomains($perms = PERMS_SHOW)
+ function getDomains($perms = Horde_Perms::SHOW)
{
$domains = $this->_getDomains();
if (is_a($domains, 'PEAR_Error')) {
*/
function getDomain($domainname)
{
- $domains = $this->getDomains(PERMS_SHOW | PERMS_READ);
+ $domains = $this->getDomains(Horde_Perms::SHOW | Horde_Perms::READ);
foreach ($domains as $domain) {
if ($domain['zonename'] == $domainname) {
// Check to see if this is a new domain
if ($info['rectype'] == 'soa' && $info['zonename'] != $_SESSION['beatnik']['curdomain']['zonename']) {
// Make sure the user has permissions to add domains
- if (!Beatnik::hasPermission('beatnik:domains', PERMS_EDIT)) {
+ if (!Beatnik::hasPermission('beatnik:domains', Horde_Perms::EDIT)) {
return PEAR::raiseError(_('You do not have permission to create new domains.'));
}
// Check for permissions to edit the record in question
if ($info['rectype'] == 'soa') {
$node = 'beatnik:domains:' . $info['zonename'];
- if (!Beatnik::hasPermission($node, PERMS_EDIT, 1)) {
+ if (!Beatnik::hasPermission($node, Horde_Perms::EDIT, 1)) {
return PEAR::raiseError(_('You do not have permssion to edit the SOA of this zone.'));
}
} else {
$node = 'beatnik:domains:' . $_SESSION['beatnik']['curdomain']['zonename'] . ':' . $info['id'];
- if (!Beatnik::hasPermission($node, PERMS_EDIT, 2)) {
+ if (!Beatnik::hasPermission($node, Horde_Perms::EDIT, 2)) {
return PEAR::raiseError(_('You do not have permssion to edit this record.'));
}
}
static public function checkPerms($key)
{
return (!$GLOBALS['perms']->exists('chora:sourceroots:' . $key) ||
- $GLOBALS['perms']->hasPermission('chora:sourceroots:' . $key, Horde_Auth::getAuth(), PERMS_READ | PERMS_SHOW));
+ $GLOBALS['perms']->hasPermission('chora:sourceroots:' . $key, Horde_Auth::getAuth(), Horde_Perms::READ | Horde_Perms::SHOW));
}
/**
case 'modify_account':
$account_id = $vars->get('account');
- if (!$share->hasPermission(Horde_Auth::getAuth(), PERMS_EDIT)) {
+ if (!$share->hasPermission(Horde_Auth::getAuth(), Horde_Perms::EDIT)) {
$notification->push(_("Access denied editing account."), 'horde.error');
} else {
$account = Fima::getAccount($account_id);
$vars = new Horde_Variables($account);
$vars->set('actionID', 'save_account');
$vars->set('number_new', $vars->get('number'));
- $form = new Fima_AccountForm($vars, sprintf(_("Edit: %s"), trim($account['number'] . ' ' . $account['name'])), $share->hasPermission(Horde_Auth::getAuth(), PERMS_DELETE));
+ $form = new Fima_AccountForm($vars, sprintf(_("Edit: %s"), trim($account['number'] . ' ' . $account['name'])), $share->hasPermission(Horde_Auth::getAuth(), Horde_Perms::DELETE));
break;
}
}
}
$form->getInfo($vars, $info);
- if (!$share->hasPermission(Horde_Auth::getAuth(), PERMS_EDIT)) {
+ if (!$share->hasPermission(Horde_Auth::getAuth(), Horde_Perms::EDIT)) {
$notification->push(sprintf(_("Access denied saving account to %s."), $share->get('name')), 'horde.error');
header('Location: ' . Horde::applicationUrl('accounts.php', true));
exit;
case 'delete_account':
$account_id = $vars->get('account');
- if (!$share->hasPermission(Horde_Auth::getAuth(), PERMS_DELETE)) {
+ if (!$share->hasPermission(Horde_Auth::getAuth(), Horde_Perms::DELETE)) {
$notification->push(_("Access denied deleting account."), 'horde.error');
} else {
$account = Fima::getAccount($account_id);
$vars->set('actionID', 'purge_account');
$vars->set('dssubaccounts', array('type' => 'none', 'account' => $account_id));
$vars->set('dspostings', array('type' => 'delete', 'account' => $account_id));
- $form = new Fima_AccountDeleteForm($vars, sprintf(_("Delete: %s"), trim($account['number'] . ' ' . $account['name'])), $share->hasPermission(Horde_Auth::getAuth(), PERMS_EDIT));
+ $form = new Fima_AccountDeleteForm($vars, sprintf(_("Delete: %s"), trim($account['number'] . ' ' . $account['name'])), $share->hasPermission(Horde_Auth::getAuth(), Horde_Perms::EDIT));
break;
}
}
}
$form->getInfo($vars, $info);
- if (!$share->hasPermission(Horde_Auth::getAuth(), PERMS_DELETE)) {
+ if (!$share->hasPermission(Horde_Auth::getAuth(), Horde_Perms::DELETE)) {
$notification->push(sprintf(_("Access denied deleting account from %s."), $share->get('name')), 'horde.error');
header('Location: ' . Horde::applicationUrl('accounts.php', true));
exit;
$actionID = Horde_Util::getFormData('actionID');
switch ($actionID) {
case 'delete_all':
- if (!$share->hasPermission(Horde_Auth::getAuth(), PERMS_DELETE)) {
+ if (!$share->hasPermission(Horde_Auth::getAuth(), Horde_Perms::DELETE)) {
$notification->push(_("Access denied deleting all accounts and postings."), 'horde.error');
} else {
$storage = &Fima_Driver::singleton($ledger);
*
* @return array The list of ledgers.
*/
- function listLedgers($owneronly = false, $permission = PERMS_SHOW)
+ function listLedgers($owneronly = false, $permission = Horde_Perms::SHOW)
{
$ledgers = $GLOBALS['fima_shares']->listShares(Horde_Auth::getAuth(), $permission, $owneronly ? Horde_Auth::getAuth() : null);
if (is_a($ledgers, 'PEAR_Error')) {
/**
* Returns the active ledger for the current user.
*/
- function getActiveLedger($permission = PERMS_SHOW)
+ function getActiveLedger($permission = Horde_Perms::SHOW)
{
global $prefs;
$GLOBALS['display_ledgers'] = array_keys($ledgers);
} else {
/* Make sure at least the active ledger is visible. */
- $active_ledger = Fima::getActiveLedger(PERMS_READ);
+ $active_ledger = Fima::getActiveLedger(Horde_Perms::READ);
if ($active_ledger) {
$GLOBALS['display_ledgers'] = array($active_ledger);
}
$postingset = Horde_Util::getFormData('posting_id');
$share = &$GLOBALS['fima_shares']->getShare($ledger);
- if (!$share->hasPermission(Horde_Auth::getAuth(), PERMS_EDIT)) {
+ if (!$share->hasPermission(Horde_Auth::getAuth(), Horde_Perms::EDIT)) {
$notification->push(sprintf(_("Access denied saving postings to %s."), $share->get('name')), 'horde.error');
header('Location: ' . Horde::applicationUrl('postings.php', true));
exit;
$postingset = Horde_Util::getFormData('indices');
$share = &$GLOBALS['fima_shares']->getShare($ledger);
- if (!$share->hasPermission(Horde_Auth::getAuth(), PERMS_DELETE)) {
+ if (!$share->hasPermission(Horde_Auth::getAuth(), Horde_Perms::DELETE)) {
$notification->push(sprintf(_("Access denied deleting postings from %s."), $share->get('name')), 'horde.error');
header('Location: ' . Horde::applicationUrl('postings.php', true));
exit;
$postingset = Horde_Util::getFormData('posting_id');
$share = &$GLOBALS['fima_shares']->getShare($ledger);
- if (!$share->hasPermission(Horde_Auth::getAuth(), PERMS_EDIT)) {
+ if (!$share->hasPermission(Horde_Auth::getAuth(), Horde_Perms::EDIT)) {
$notification->push(sprintf(_("Access denied shifting postings in %s."), $share->get('name')), 'horde.error');
header('Location: ' . Horde::applicationUrl('postings.php', true));
exit;
case 'copymove_postings':
$share = &$GLOBALS['fima_shares']->getShare($ledger);
- if (!$share->hasPermission(Horde_Auth::getAuth(), PERMS_EDIT)) {
+ if (!$share->hasPermission(Horde_Auth::getAuth(), Horde_Perms::EDIT)) {
$notification->push(sprintf(_("Access denied transfering postings in %s."), $share->get('name')), 'horde.error');
header('Location: ' . Horde::applicationUrl('postings.php', true));
exit;
- } elseif (!$share->hasPermission(Horde_Auth::getAuth(), PERMS_DELETE) && (!Horde_Util::getFormData('keep') || Horde_Util::getFormData('delete'))) {
+ } elseif (!$share->hasPermission(Horde_Auth::getAuth(), Horde_Perms::DELETE) && (!Horde_Util::getFormData('keep') || Horde_Util::getFormData('delete'))) {
$notification->push(sprintf(_("Access denied transfering postings in %s."), $share->get('name')), 'horde.error');
header('Location: ' . Horde::applicationUrl('postings.php', true));
exit;
<?php
-$perm_edit = $share->hasPermission(Horde_Auth::getAuth(), PERMS_EDIT);
-$perm_delete = $share->hasPermission(Horde_Auth::getAuth(), PERMS_DELETE);
+$perm_edit = $share->hasPermission(Horde_Auth::getAuth(), Horde_Perms::EDIT);
+$perm_delete = $share->hasPermission(Horde_Auth::getAuth(), Horde_Perms::DELETE);
?>
<script type="text/javascript">
return count($result);
case 'galleries':
- return $GLOBALS['registry']->callByPackage('ansel', 'countGalleries', array('ansel', PERMS_SHOW, $user));
+ return $GLOBALS['registry']->callByPackage('ansel', 'countGalleries', array('ansel', Horde_Perms::SHOW, $user));
case 'blogs':
return $GLOBALS['registry']->callByPackage('thomas', 'countPosts', array(array('user' => $user)));
return $GLOBALS['registry']->callByPackage('genie', 'listUserItems', array($user));
case 'galleries':
- return $GLOBALS['registry']->callByPackage('ansel', 'listGalleries', array('ansel', PERMS_SHOW, null, true, 0, 3, $user));
+ return $GLOBALS['registry']->callByPackage('ansel', 'listGalleries', array('ansel', Horde_Perms::SHOW, null, true, 0, 3, $user));
case 'blogs':
return $GLOBALS['registry']->callByPackage('thomas', 'getRecentPosts', array($user, Horde_Auth::getAuth(), '', 3));
// Delete groups
if ($GLOBALS['conf']['friends']) {
$shares = Horde_Share::singleton('folks');
- $groups = $shares->listShares(Horde_Auth::getAuth(), PERMS_SHOW, true);
+ $groups = $shares->listShares(Horde_Auth::getAuth(), Horde_Perms::SHOW, true);
foreach ($groups as $share) {
$result = $shares->removeShare($share);
if ($result instanceof PEAR_Error) {
{
$GLOBALS['folks_shares'] = Horde_Share::singleton('folks');
- $groups = $GLOBALS['folks_shares']->listShares($this->_user, PERMS_READ);
+ $groups = $GLOBALS['folks_shares']->listShares($this->_user, Horde_Perms::READ);
if ($groups instanceof PEAR_Error) {
return $groups;
}
if ($permission instanceof PEAR_Error) {
return $permission;
} else {
- $admins = $permission->getUserPermissions(PERMS_DELETE);
+ $admins = $permission->getUserPermissions(Horde_Perms::DELETE);
if ($admins instanceof PEAR_Error) {
return $admins;
}
// Process default permissions.
if (Horde_Util::getFormData('default_show')) {
- $perm->addDefaultPermission(PERMS_SHOW, false);
+ $perm->addDefaultPermission(Horde_Perms::SHOW, false);
} else {
- $perm->removeDefaultPermission(PERMS_SHOW, false);
+ $perm->removeDefaultPermission(Horde_Perms::SHOW, false);
}
if (Horde_Util::getFormData('default_read')) {
- $perm->addDefaultPermission(PERMS_READ, false);
+ $perm->addDefaultPermission(Horde_Perms::READ, false);
} else {
- $perm->removeDefaultPermission(PERMS_READ, false);
+ $perm->removeDefaultPermission(Horde_Perms::READ, false);
}
if (Horde_Util::getFormData('default_edit')) {
- $perm->addDefaultPermission(PERMS_EDIT, false);
+ $perm->addDefaultPermission(Horde_Perms::EDIT, false);
} else {
- $perm->removeDefaultPermission(PERMS_EDIT, false);
+ $perm->removeDefaultPermission(Horde_Perms::EDIT, false);
}
if (Horde_Util::getFormData('default_delete')) {
- $perm->addDefaultPermission(PERMS_DELETE, false);
+ $perm->addDefaultPermission(Horde_Perms::DELETE, false);
} else {
- $perm->removeDefaultPermission(PERMS_DELETE, false);
+ $perm->removeDefaultPermission(Horde_Perms::DELETE, false);
}
// Process guest permissions.
if (Horde_Util::getFormData('guest_show')) {
- $perm->addGuestPermission(PERMS_SHOW, false);
+ $perm->addGuestPermission(Horde_Perms::SHOW, false);
} else {
- $perm->removeGuestPermission(PERMS_SHOW, false);
+ $perm->removeGuestPermission(Horde_Perms::SHOW, false);
}
if (Horde_Util::getFormData('guest_read')) {
- $perm->addGuestPermission(PERMS_READ, false);
+ $perm->addGuestPermission(Horde_Perms::READ, false);
} else {
- $perm->removeGuestPermission(PERMS_READ, false);
+ $perm->removeGuestPermission(Horde_Perms::READ, false);
}
if (Horde_Util::getFormData('guest_edit')) {
- $perm->addGuestPermission(PERMS_EDIT, false);
+ $perm->addGuestPermission(Horde_Perms::EDIT, false);
} else {
- $perm->removeGuestPermission(PERMS_EDIT, false);
+ $perm->removeGuestPermission(Horde_Perms::EDIT, false);
}
if (Horde_Util::getFormData('guest_delete')) {
- $perm->addGuestPermission(PERMS_DELETE, false);
+ $perm->addGuestPermission(Horde_Perms::DELETE, false);
} else {
- $perm->removeGuestPermission(PERMS_DELETE, false);
+ $perm->removeGuestPermission(Horde_Perms::DELETE, false);
}
// Process creator permissions.
if (Horde_Util::getFormData('creator_show')) {
- $perm->addCreatorPermission(PERMS_SHOW, false);
+ $perm->addCreatorPermission(Horde_Perms::SHOW, false);
} else {
- $perm->removeCreatorPermission(PERMS_SHOW, false);
+ $perm->removeCreatorPermission(Horde_Perms::SHOW, false);
}
if (Horde_Util::getFormData('creator_read')) {
- $perm->addCreatorPermission(PERMS_READ, false);
+ $perm->addCreatorPermission(Horde_Perms::READ, false);
} else {
- $perm->removeCreatorPermission(PERMS_READ, false);
+ $perm->removeCreatorPermission(Horde_Perms::READ, false);
}
if (Horde_Util::getFormData('creator_edit')) {
- $perm->addCreatorPermission(PERMS_EDIT, false);
+ $perm->addCreatorPermission(Horde_Perms::EDIT, false);
} else {
- $perm->removeCreatorPermission(PERMS_EDIT, false);
+ $perm->removeCreatorPermission(Horde_Perms::EDIT, false);
}
if (Horde_Util::getFormData('creator_delete')) {
- $perm->addCreatorPermission(PERMS_DELETE, false);
+ $perm->addCreatorPermission(Horde_Perms::DELETE, false);
} else {
- $perm->removeCreatorPermission(PERMS_DELETE, false);
+ $perm->removeCreatorPermission(Horde_Perms::DELETE, false);
}
// Process user permissions.
}
if (!empty($u_show[$key])) {
- $perm->addUserPermission($user, PERMS_SHOW, false);
+ $perm->addUserPermission($user, Horde_Perms::SHOW, false);
} else {
- $perm->removeUserPermission($user, PERMS_SHOW, false);
+ $perm->removeUserPermission($user, Horde_Perms::SHOW, false);
}
if (!empty($u_read[$key])) {
- $perm->addUserPermission($user, PERMS_READ, false);
+ $perm->addUserPermission($user, Horde_Perms::READ, false);
} else {
- $perm->removeUserPermission($user, PERMS_READ, false);
+ $perm->removeUserPermission($user, Horde_Perms::READ, false);
}
if (!empty($u_edit[$key])) {
- $perm->addUserPermission($user, PERMS_EDIT, false);
+ $perm->addUserPermission($user, Horde_Perms::EDIT, false);
} else {
- $perm->removeUserPermission($user, PERMS_EDIT, false);
+ $perm->removeUserPermission($user, Horde_Perms::EDIT, false);
}
if (!empty($u_delete[$key])) {
- $perm->addUserPermission($user, PERMS_DELETE, false);
+ $perm->addUserPermission($user, Horde_Perms::DELETE, false);
} else {
- $perm->removeUserPermission($user, PERMS_DELETE, false);
+ $perm->removeUserPermission($user, Horde_Perms::DELETE, false);
}
}
}
if (!empty($g_show[$key])) {
- $perm->addGroupPermission($group, PERMS_SHOW, false);
+ $perm->addGroupPermission($group, Horde_Perms::SHOW, false);
} else {
- $perm->removeGroupPermission($group, PERMS_SHOW, false);
+ $perm->removeGroupPermission($group, Horde_Perms::SHOW, false);
}
if (!empty($g_read[$key])) {
- $perm->addGroupPermission($group, PERMS_READ, false);
+ $perm->addGroupPermission($group, Horde_Perms::READ, false);
} else {
- $perm->removeGroupPermission($group, PERMS_READ, false);
+ $perm->removeGroupPermission($group, Horde_Perms::READ, false);
}
if (!empty($g_edit[$key])) {
- $perm->addGroupPermission($group, PERMS_EDIT, false);
+ $perm->addGroupPermission($group, Horde_Perms::EDIT, false);
} else {
- $perm->removeGroupPermission($group, PERMS_EDIT, false);
+ $perm->removeGroupPermission($group, Horde_Perms::EDIT, false);
}
if (!empty($g_delete[$key])) {
- $perm->addGroupPermission($group, PERMS_DELETE, false);
+ $perm->addGroupPermission($group, Horde_Perms::DELETE, false);
} else {
- $perm->removeGroupPermission($group, PERMS_DELETE, false);
+ $perm->removeGroupPermission($group, Horde_Perms::DELETE, false);
}
}
const EXTEND_PERMS_UPLOADPHOTO = 'photo_upload';
const EXTEND_PERMS_PUBLISHSTREAM = 'publish_stream';
- const EXTEND_PERMS_READSTREAM = 'read_stream';
+ const EXTEND_Horde_Perms::READSTREAM = 'read_stream';
// We are at the root of gollem. Return a set of folders, one for
// each backend available.
foreach ($backends as $backend => $curBackend) {
- if (Gollem::checkPermissions('backend', PERMS_SHOW, $backend)) {
+ if (Gollem::checkPermissions('backend', Horde_Perms::SHOW, $backend)) {
$results['gollem/' . $backend]['name'] = $curBackend['name'];
$results['gollem/' . $backend]['browseable'] = true;
}
if (!Gollem_Session::createSession($backend_key)) {
return PEAR::raiseError(_("Unable to create Gollem session"));
}
- if (!Gollem::checkPermissions('backend', PERMS_READ)) {
+ if (!Gollem::checkPermissions('backend', Horde_Perms::READ)) {
return PEAR::raiseError(_("Permission denied to this backend."));
}
if (!Gollem_Session::createSession($backend_key)) {
return PEAR::raiseError(_("Unable to create Gollem session"));
}
- if (!Gollem::checkPermissions('backend', PERMS_EDIT)) {
+ if (!Gollem::checkPermissions('backend', Horde_Perms::EDIT)) {
return PEAR::raiseError(_("Permission denied to this backend."));
}
if (!Gollem_Session::createSession($backend_key)) {
return PEAR::raiseError(_("Unable to create Gollem session"));
}
- if (!Gollem::checkPermissions('backend', PERMS_EDIT)) {
+ if (!Gollem::checkPermissions('backend', Horde_Perms::EDIT)) {
return PEAR::raiseError(_("Permission denied to this backend."));
}
if (!Gollem_Session::createSession($backend_key)) {
return PEAR::raiseError(_("Unable to create Gollem session"));
}
- if (!Gollem::checkPermissions('backend', PERMS_EDIT)) {
+ if (!Gollem::checkPermissions('backend', Horde_Perms::EDIT)) {
return PEAR::raiseError(_("Permission denied to this backend."));
}
if (!Gollem_Session::createSession($backend_key)) {
return PEAR::raiseError(_("Unable to create Gollem session"));
}
- if (!Gollem::checkPermissions('backend', PERMS_EDIT)) {
+ if (!Gollem::checkPermissions('backend', Horde_Perms::EDIT)) {
return PEAR::raiseError(_("Permission denied to this backend."));
}
$login_url = Horde::applicationUrl('login.php');
foreach ($GLOBALS['gollem_backends'] as $key => $val) {
- if (Gollem::checkPermissions('backend', PERMS_SHOW, $key)) {
+ if (Gollem::checkPermissions('backend', Horde_Perms::SHOW, $key)) {
$tree->addNode($parent . $key,
$parent,
$val['name'],
* @return boolean Returns true if the user has permission, false if
* they do not.
*/
- static public function checkPermissions($filter, $permission = PERMS_READ,
+ static public function checkPermissions($filter, $permission = Horde_Perms::READ,
$backend = null)
{
$userID = Horde_Auth::getAuth();
require GOLLEM_BASE . '/config/backends.php';
$GLOBALS['gollem_backends'] = array();
foreach ($backends as $key => $val) {
- if (Gollem::checkPermissions('backend', PERMS_SHOW, $key)) {
+ if (Gollem::checkPermissions('backend', Horde_Perms::SHOW, $key)) {
$GLOBALS['gollem_backends'][$key] = $val;
}
}
$old_dir = Gollem::getDir();
/* Get permissions. */
-$delete_perms = Gollem::checkPermissions('backend', PERMS_DELETE);
-$edit_perms = Gollem::checkPermissions('backend', PERMS_EDIT);
-$read_perms = Gollem::checkPermissions('backend', PERMS_READ);
+$delete_perms = Gollem::checkPermissions('backend', Horde_Perms::DELETE);
+$edit_perms = Gollem::checkPermissions('backend', Horde_Perms::EDIT);
+$read_perms = Gollem::checkPermissions('backend', Horde_Perms::READ);
/* Set directory. */
if (is_a($result = Gollem::changeDir(), 'PEAR_Error')) {
if (is_array($list) &&
count($list) &&
- Gollem::checkPermissions('backend', PERMS_READ)) {
+ Gollem::checkPermissions('backend', Horde_Perms::READ)) {
$entry = $icon_cache = array();
$rowct = 0;
$application_folders = array();
foreach (IMP_Dimp::menuList() as $app) {
if ($registry->get('status', $app) != 'inactive' &&
- $registry->hasPermission($app, PERMS_SHOW)) {
+ $registry->hasPermission($app, Horde_Perms::SHOW)) {
$application_folders[] = array(
'name' => htmlspecialchars($registry->get('name', $app)),
'icon' => $registry->get('icon', $app),
if (!empty($options['inc_tasklists']) &&
!empty($_SESSION['imp']['tasklistavail'])) {
try {
- $tasklists = $GLOBALS['registry']->call('tasks/listTasklists', array(false, PERMS_EDIT));
+ $tasklists = $GLOBALS['registry']->call('tasks/listTasklists', array(false, Horde_Perms::EDIT));
if (count($tasklists)) {
$text .= '<option value="" disabled="disabled"> </option><option value="" disabled="disabled">- - ' . _("Task Lists") . ' - -</option>' . "\n";
if (!empty($options['inc_notepads']) &&
!empty($_SESSION['imp']['notepadavail'])) {
try {
- $notepads = $GLOBALS['registry']->call('notes/listNotepads', array(false, PERMS_EDIT));
+ $notepads = $GLOBALS['registry']->call('notes/listNotepads', array(false, Horde_Perms::EDIT));
if (count($notepads)) {
$text .= '<option value="" disabled="disabled"> </option><option value="" disabled="disabled">- - ' . _("Notepads") . " - -</option>\n";
/* Get the list of editable tasklists. */
try {
- $lists = $registry->call('tasks/listTasklists', array(false, PERMS_EDIT));
+ $lists = $registry->call('tasks/listTasklists', array(false, Horde_Perms::EDIT));
} catch (Horde_Exception $e) {
$lists = null;
$notification->push($e, $e->getCode());
/* Get the list of editable notepads. */
try {
- $lists = $registry->call('notes/listNotepads', array(false, PERMS_EDIT));
+ $lists = $registry->call('notes/listNotepads', array(false, Horde_Perms::EDIT));
} catch (Horde_Exception $e) {
$lists = null;
$notification->push($e, $e->getCode());
$t->set('image_img', Horde::img('mime/image.png', _("Image"), null, $registry->getImageDir('horde')));
/* Build the list of galleries. */
-$t->set('gallerylist', $registry->call('images/selectGalleries', array(null, PERMS_EDIT)));
+$t->set('gallerylist', $registry->call('images/selectGalleries', array(null, Horde_Perms::EDIT)));
$title = _("Save Image");
require IMP_TEMPLATES . '/common-header.inc';
$id = Horde_Util::getFormData('rulenumber');
/* Get permissions. */
-$edit_allowed = Ingo::hasPermission('shares', PERMS_EDIT);
-$delete_allowed = Ingo::hasPermission('shares', PERMS_DELETE);
+$edit_allowed = Ingo::hasPermission('shares', Horde_Perms::EDIT);
+$delete_allowed = Ingo::hasPermission('shares', Horde_Perms::DELETE);
/* Perform requested actions. */
switch ($actionID) {
/* Get a list of all shares this user owns and has perms to delete
* and remove them. */
- $shares = $GLOBALS['ingo_shares']->listShares($user, PERMS_DELETE, $user);
+ $shares = $GLOBALS['ingo_shares']->listShares($user, Horde_Perms::DELETE, $user);
if (is_a($shares, 'PEAR_Error')) {
Horde::logMessage($shares, __FILE__, __LINE__, PEAR_LOG_ERR);
return $shares;
* @return array The ruleset list.
*/
static public function listRulesets($owneronly = false,
- $permission = PERMS_SHOW)
+ $permission = Horde_Perms::SHOW)
{
$rulesets = $GLOBALS['ingo_shares']->listShares(Horde_Auth::getAuth(), $permission, $owneronly ? Horde_Auth::getAuth() : null);
if (is_a($rulesets, 'PEAR_Error')) {
$_SESSION['ingo']['current_share'] = Horde_Util::getFormData('ruleset', @$_SESSION['ingo']['current_share']);
if (empty($_SESSION['ingo']['current_share']) ||
empty($GLOBALS['all_rulesets'][$_SESSION['ingo']['current_share']]) ||
- !$GLOBALS['all_rulesets'][$_SESSION['ingo']['current_share']]->hasPermission(Horde_Auth::getAuth(), PERMS_READ)) {
+ !$GLOBALS['all_rulesets'][$_SESSION['ingo']['current_share']]->hasPermission(Horde_Auth::getAuth(), Horde_Perms::READ)) {
$_SESSION['ingo']['current_share'] = $signature;
}
} else {
case 'rule_save':
case 'rule_update':
case 'rule_delete':
- if (!Ingo::hasPermission('shares', PERMS_EDIT)) {
+ if (!Ingo::hasPermission('shares', Horde_Perms::EDIT)) {
$notification->push(_("You do not have permission to edit filter rules."), 'horde.error');
header('Location: ' . Horde::applicationUrl('filters.php', true));
exit;
header('Location: ' . Horde::applicationUrl('filters.php'));
exit;
} elseif ($actionID == 'rule_delete') {
- if (!Ingo::hasPermission('shares', PERMS_DELETE)) {
+ if (!Ingo::hasPermission('shares', Horde_Perms::DELETE)) {
$notification->push(_("You do not have permission to delete filter rules."), 'horde.error');
header('Location: ' . Horde::applicationUrl('filters.php', true));
exit;
break;
default:
- if (!Ingo::hasPermission('shares', PERMS_EDIT)) {
+ if (!Ingo::hasPermission('shares', Horde_Perms::EDIT)) {
$notification->push(_("You do not have permission to edit filter rules."), 'horde.error');
header('Location: ' . Horde::applicationUrl('filters.php', true));
exit;
echo Horde_Auth::getAuth();
-echo $registry->hasPermission(Horde_Auth::getAuth(), PERMS_EDIT);
-if($registry->hasPermission(Horde_Auth::getAuth(), PERMS_EDIT)) {
+echo $registry->hasPermission(Horde_Auth::getAuth(), Horde_Perms::EDIT);
+if($registry->hasPermission(Horde_Auth::getAuth(), Horde_Perms::EDIT)) {
echo "TASTA";
exit(0);
}
{
global $registry, $notification, $browser;
- /* Horde core classes that aren't autoloaded. */
- include_once 'Horde/Perms.php';
-
$registry = Horde_Registry::singleton();
$notification = Horde_Notification::singleton();
if (is_a($share, 'PEAR_Error')) {
$notification->push(sprintf(_("There was an error accessing the calendar: %s"), $share->getMessage()), 'horde.error');
} elseif ($user != Horde_Auth::getAuth() &&
- !$share->hasPermission(Horde_Auth::getAuth(), PERMS_DELEGATE, Horde_Auth::getAuth())) {
+ !$share->hasPermission(Horde_Auth::getAuth(), Kronolith::PERMS_DELEGATE, Horde_Auth::getAuth())) {
$notification->push(sprintf(_("You do not have permission to delegate events to %s."), Kronolith::getUserName($user)), 'horde.warning');
} elseif ($user == Horde_Auth::getAuth() &&
- !$share->hasPermission(Horde_Auth::getAuth(), PERMS_EDIT, Horde_Auth::getAuth())) {
+ !$share->hasPermission(Horde_Auth::getAuth(), Horde_Perms::EDIT, Horde_Auth::getAuth())) {
$notification->push(sprintf(_("You do not have permission to add events to %s."), $share->get('name')), 'horde.warning');
} elseif (Kronolith::hasPermission('max_events') === true ||
Kronolith::hasPermission('max_events') > Kronolith::countEvents()) {
switch ($driver) {
case 'internal':
if (!array_key_exists($calendar,
- Kronolith::listCalendars(false, PERMS_SHOW))) {
+ Kronolith::listCalendars(false, Horde_Perms::SHOW))) {
$GLOBALS['notification']->push(_("Permission Denied"), 'horde.error');
return false;
}
$notification->push(_("The requested event was not found."), 'horde.error');
break;
}
- if (!$event->hasPermission(PERMS_EDIT)) {
+ if (!$event->hasPermission(Horde_Perms::EDIT)) {
$notification->push(_("You do not have permission to edit this event."), 'horde.warning');
break;
}
$kronolith_driver = Kronolith::getDriver();
try {
$event = Kronolith::quickAdd(Horde_Util::getFormData('text'),
- Kronolith::getDefaultCalendar(PERMS_EDIT));
+ Kronolith::getDefaultCalendar(Horde_Perms::EDIT));
if (is_a($event, 'PEAR_Error')) {
$notification->push($event, 'horde.error');
break;
$notification->push(_("The requested event was not found."), 'horde.error');
break;
}
- if (!$event->hasPermission(PERMS_EDIT)) {
+ if (!$event->hasPermission(Horde_Perms::EDIT)) {
$notification->push(_("You do not have permission to edit this event."), 'horde.warning');
break;
}
$notification->push(_("The requested event was not found."), 'horde.error');
break;
}
- if (!$event->hasPermission(PERMS_DELETE)) {
+ if (!$event->hasPermission(Horde_Perms::DELETE)) {
$notification->push(_("You do not have permission to delete this event."), 'horde.warning');
break;
}
if (is_a($share, 'PEAR_Error')) {
$notification->push(_("You have specified an invalid calendar."), 'horde.error');
$next_step = $data->cleanup();
- } elseif (!$share->hasPermission(Horde_Auth::getAuth(), PERMS_EDIT)) {
+ } elseif (!$share->hasPermission(Horde_Auth::getAuth(), Horde_Perms::EDIT)) {
$notification->push(_("You do not have permission to add events to the selected calendar."), 'horde.error');
$next_step = $data->cleanup();
} else {
}
if ($driver != 'Resource') {
$share = &$kronolith_shares->getShare($event->getCalendar());
- if (!$share->hasPermission(Horde_Auth::getAuth(), PERMS_DELETE, $event->getCreatorID())) {
+ if (!$share->hasPermission(Horde_Auth::getAuth(), Horde_Perms::DELETE, $event->getCreatorID())) {
$notification->push(_("You do not have permission to delete this event."), 'horde.warning');
} else {
$have_perms = true;
[jan] Speed up listing alarms (patrick.abiven@apitech.fr, Request #8638).
[jan] Simplify and improve portability of listing events without date limits
in the SQL driver (Bug #8590).
-[mjr] Fix issue that caused the default alarm time to be applied to
+[mjr] Fix issue that caused the default alarm time to be applied to
listTimeObjects events (Bug #8588).
$sourceShare = Kronolith::getInternalCalendar($source);
if (!is_a($share, 'PEAR_Error') &&
!is_a($sourceShare, 'PEAR_Error') &&
- $sourceShare->hasPermission(Horde_Auth::getAuth(), PERMS_DELETE) &&
+ $sourceShare->hasPermission(Horde_Auth::getAuth(), Horde_Perms::DELETE) &&
(($user == Horde_Auth::getAuth() &&
- $share->hasPermission(Horde_Auth::getAuth(), PERMS_EDIT)) ||
+ $share->hasPermission(Horde_Auth::getAuth(), Horde_Perms::EDIT)) ||
($user != Horde_Auth::getAuth() &&
- $share->hasPermission(Horde_Auth::getAuth(), PERMS_DELEGATE)))) {
+ $share->hasPermission(Horde_Auth::getAuth(), Kronolith::PERMS_DELEGATE)))) {
$kronolith_driver->open($source);
$res = $kronolith_driver->move(Horde_Util::getFormData('eventID'), $target);
if (is_a($res, 'PEAR_Error')) {
if ($event && !is_a($event, 'PEAR_Error')) {
if (isset($sourceShare) && !is_a($sourceShare, 'PEAR_Error')
- && !$sourceShare->hasPermission(Horde_Auth::getAuth(), PERMS_DELETE)) {
+ && !$sourceShare->hasPermission(Horde_Auth::getAuth(), Horde_Perms::DELETE)) {
$notification->push(_("You do not have permission to move this event."), 'horde.warning');
} elseif ($user != Horde_Auth::getAuth() &&
- !$share->hasPermission(Horde_Auth::getAuth(), PERMS_DELEGATE, $event->getCreatorID())) {
+ !$share->hasPermission(Horde_Auth::getAuth(), Kronolith::PERMS_DELEGATE, $event->getCreatorID())) {
$notification->push(sprintf(_("You do not have permission to delegate events to %s."), Kronolith::getUserName($user)), 'horde.warning');
} elseif ($user == Horde_Auth::getAuth() &&
- !$share->hasPermission(Horde_Auth::getAuth(), PERMS_EDIT, $event->getCreatorID())) {
+ !$share->hasPermission(Horde_Auth::getAuth(), Horde_Perms::EDIT, $event->getCreatorID())) {
$notification->push(_("You do not have permission to edit this event."), 'horde.warning');
} else {
$event->readForm();
sprintf(_("The requested feed (%s) was not found on this server."),
htmlspecialchars($calendar)));
}
-if (!$share->hasPermission(Horde_Auth::getAuth(), PERMS_READ)) {
+if (!$share->hasPermission(Horde_Auth::getAuth(), Horde_Perms::READ)) {
if (Horde_Auth::getAuth()) {
_no_access(403, 'Forbidden',
sprintf(_("Permission denied for the requested feed (%s)."),
// Check perms
if ($post['type'] == 'calendar') {
$cal = $GLOBALS['kronolith_shares']->getShare($post['resource']);
- $perm = $cal->hasPermission(Horde_Auth::getAuth(), PERMS_EDIT);
+ $perm = $cal->hasPermission(Horde_Auth::getAuth(), Horde_Perms::EDIT);
} elseif($post['type'] == 'event') {
$event = Kronolith::getDriver()->getByUID($post['resource']);
- $perm = $event->hasPermission(PERMS_EDIT, Horde_Auth::getAuth());
+ $perm = $event->hasPermission(Horde_Perms::EDIT, Horde_Auth::getAuth());
}
if ($perm) {
if ($type == 'calendar') {
$cal = $GLOBALS['kronolith_shares']->getShare($id);
- $hasEdit = $cal->hasPermission(Horde_Auth::getAuth(), PERMS_EDIT);
+ $hasEdit = $cal->hasPermission(Horde_Auth::getAuth(), Horde_Perms::EDIT);
} elseif ($type == 'event') {
$event = Kronolith::getDriver()->getByUID($id);
- $hasEdit = $event->hasPermission(PERMS_EDIT, Horde_Auth::getAuth());
+ $hasEdit = $event->hasPermission(Horde_Perms::EDIT, Horde_Auth::getAuth());
}
foreach ($tags as $tag_id => $tag) {
if (empty($path)) {
// This request is for a list of all users who have calendars
// visible to the requesting user.
- $calendars = Kronolith::listCalendars(false, PERMS_READ);
+ $calendars = Kronolith::listCalendars(false, Horde_Perms::READ);
$owners = array();
foreach ($calendars as $calendar) {
$owners[$calendar->get('owner')] = true;
} elseif (count($parts) == 1) {
// This request is for all calendars owned by the requested user
$calendars = $GLOBALS['kronolith_shares']->listShares(Horde_Auth::getAuth(),
- PERMS_SHOW,
+ Horde_Perms::SHOW,
$parts[0]);
$results = array();
foreach ($calendars as $calendarId => $calendar) {
$results[$retpath . '.ics']['icon'] = $registry->getImageDir() . '/mime/icalendar.png';
}
if (in_array('browseable', $properties)) {
- $results[$retpath]['browseable'] = $calendar->hasPermission(Horde_Auth::getAuth(), PERMS_READ);
+ $results[$retpath]['browseable'] = $calendar->hasPermission(Horde_Auth::getAuth(), Horde_Perms::READ);
$results[$retpath . '.ics']['browseable'] = false;
}
if (in_array('contenttype', $properties)) {
return $results;
} elseif (count($parts) == 2 &&
- array_key_exists($parts[1], Kronolith::listCalendars(false, PERMS_READ))) {
+ array_key_exists($parts[1], Kronolith::listCalendars(false, Horde_Perms::READ))) {
// This request is browsing into a specific calendar. Generate
// the list of items and represent them as files within the
// directory.
// The only valid request left is for either a specific event or
// for the entire calendar.
if (count($parts) == 3 &&
- array_key_exists($parts[1], Kronolith::listCalendars(false, PERMS_READ))) {
+ array_key_exists($parts[1], Kronolith::listCalendars(false, Horde_Perms::READ))) {
// This request is for a specific item within a given calendar.
$event = Kronolith::getDriver(null, $parts[1])->getEvent($parts[2]);
if (is_a($event, 'PEAR_Error')) {
return $result;
} elseif (count($parts) == 2 &&
substr($parts[1], -4, 4) == '.ics' &&
- array_key_exists(substr($parts[1], 0, -4), Kronolith::listCalendars(false, PERMS_READ))) {
+ array_key_exists(substr($parts[1], 0, -4), Kronolith::listCalendars(false, Horde_Perms::READ))) {
// This request is for an entire calendar (calendar.ics).
$ical_data = $this->exportCalendar(substr($parts[1], 0, -4), 'text/calendar');
$result = array('data' => $ical_data,
return PEAR::raiseError("Invalid calendar data supplied.");
}
- if (!array_key_exists($calendar, Kronolith::listCalendars(false, PERMS_EDIT))) {
+ if (!array_key_exists($calendar, Kronolith::listCalendars(false, Horde_Perms::EDIT))) {
// FIXME: Should we attempt to create a calendar based on the
// filename in the case that the requested calendar does not
// exist?
return PEAR::raiseError(sprintf(_("Unsupported Content-Type: %s"), $content_type));
}
- if (array_key_exists($calendar, Kronolith::listCalendars(false, PERMS_DELETE))) {
+ if (array_key_exists($calendar, Kronolith::listCalendars(false, Horde_Perms::DELETE))) {
foreach (array_keys($uids_remove) as $uid) {
$this->delete($uid);
}
}
if (!(count($parts) == 2 || count($parts) == 3) ||
- !array_key_exists($calendarId, Kronolith::listCalendars(false, PERMS_DELETE))) {
+ !array_key_exists($calendarId, Kronolith::listCalendars(false, Horde_Perms::DELETE))) {
return PEAR::raiseError("Calendar does not exist or no permission to delete");
}
$no_maint = true;
require_once dirname(__FILE__) . '/base.php';
if (is_null($permission)) {
- $permission = PERMS_SHOW;
+ $permission = Horde_Perms::SHOW;
}
return array_keys(Kronolith::listCalendars($owneronly, $permission));
}
$calendar = Kronolith::getDefaultCalendar();
}
if (!array_key_exists($calendar,
- Kronolith::listCalendars(false, PERMS_READ))) {
+ Kronolith::listCalendars(false, Horde_Perms::READ))) {
return PEAR::raiseError(_("Permission Denied"));
}
}
if (!array_key_exists($calendar,
- Kronolith::listCalendars(false, PERMS_READ))) {
+ Kronolith::listCalendars(false, Horde_Perms::READ))) {
return PEAR::raiseError(_("Permission Denied"));
}
}
if (!array_key_exists($calendar,
- Kronolith::listCalendars(false, PERMS_READ))) {
+ Kronolith::listCalendars(false, Horde_Perms::READ))) {
return PEAR::raiseError(_("Permission Denied"));
}
require_once dirname(__FILE__) . '/base.php';
if (!isset($calendar)) {
- $calendar = Kronolith::getDefaultCalendar(PERMS_EDIT);
+ $calendar = Kronolith::getDefaultCalendar(Horde_Perms::EDIT);
}
if (!array_key_exists($calendar,
- Kronolith::listCalendars(false, PERMS_EDIT))) {
+ Kronolith::listCalendars(false, Horde_Perms::EDIT))) {
return PEAR::raiseError(_("Permission Denied"));
}
$match->end == $event->end &&
$match->title == $event->title &&
$match->location == $event->location &&
- $match->hasPermission(PERMS_EDIT)) {
+ $match->hasPermission(Horde_Perms::EDIT)) {
return PEAR::raiseError(_("Already Exists"), 'horde.message', null, null, $match->getUID());
}
}
global $kronolith_shares;
if (!isset($calendar)) {
- $calendar = Kronolith::getDefaultCalendar(PERMS_EDIT);
+ $calendar = Kronolith::getDefaultCalendar(Horde_Perms::EDIT);
}
if (!array_key_exists($calendar,
- Kronolith::listCalendars(false, PERMS_EDIT))) {
+ Kronolith::listCalendars(false, Horde_Perms::EDIT))) {
return PEAR::raiseError(_("Permission Denied"));
}
if (is_a($event, 'PEAR_Error')) {
return $event;
}
- if (!$event->hasPermission(PERMS_READ)) {
+ if (!$event->hasPermission(Horde_Perms::READ)) {
return PEAR::raiseError(_("Permission Denied"));
}
global $kronolith_shares;
if (!array_key_exists($calendar,
- Kronolith::listCalendars(false, PERMS_READ))) {
+ Kronolith::listCalendars(false, Horde_Perms::READ))) {
return PEAR::raiseError(_("Permission Denied"));
}
// First try the user's own calendars.
if (empty($event)) {
- $ownerCalendars = Kronolith::listCalendars(true, PERMS_DELETE);
+ $ownerCalendars = Kronolith::listCalendars(true, Horde_Perms::DELETE);
foreach ($events as $ev) {
if (Horde_Auth::isAdmin() || isset($ownerCalendars[$ev->getCalendar()])) {
$event = $ev;
// If not successful, try all calendars the user has access to.
if (empty($event)) {
- $deletableCalendars = Kronolith::listCalendars(false, PERMS_DELETE);
+ $deletableCalendars = Kronolith::listCalendars(false, Horde_Perms::DELETE);
foreach ($events as $ev) {
if (isset($deletableCalendars[$ev->getCalendar()])) {
$kronolith_driver->open($ev->getCalendar());
return $event;
}
- if (!$event->hasPermission(PERMS_EDIT) ||
+ if (!$event->hasPermission(Horde_Perms::EDIT) ||
($event->isPrivate() && $event->getCreatorId() != Horde_Auth::getAuth())) {
return PEAR::raiseError(_("Permission Denied"));
}
if (is_a($event, 'PEAR_Error')) {
return $event;
}
- if (!$event->hasPermission(PERMS_SHOW)) {
+ if (!$event->hasPermission(Horde_Perms::SHOW)) {
return PEAR::raiseError(_("Permission Denied"));
}
}
/* First try the user's own calendars. */
- $ownerCalendars = Kronolith::listCalendars(true, PERMS_EDIT);
+ $ownerCalendars = Kronolith::listCalendars(true, Horde_Perms::EDIT);
$event = null;
foreach ($events as $ev) {
if (isset($ownerCalendars[$ev->getCalendar()])) {
/* If not successful, try all calendars the user has access to. */
if (empty($event)) {
- $editableCalendars = Kronolith::listCalendars(false, PERMS_EDIT);
+ $editableCalendars = Kronolith::listCalendars(false, Horde_Perms::EDIT);
foreach ($events as $ev) {
if (isset($editableCalendars[$ev->getCalendar()])) {
$event = $ev;
} elseif (!is_array($calendars)) {
$calendars = array($calendars);
}
- $allowed_calendars = Kronolith::listCalendars(false, PERMS_READ);
+ $allowed_calendars = Kronolith::listCalendars(false, Horde_Perms::READ);
foreach ($calendars as $calendar) {
if (!array_key_exists($calendar, $allowed_calendars)) {
return PEAR::raiseError(_("Permission Denied"));
continue;
}
if (empty($user)) {
- $users = $share->listUsers(PERMS_READ);
- $groups = $share->listGroups(PERMS_READ);
+ $users = $share->listUsers(Horde_Perms::READ);
+ $groups = $share->listGroups(Horde_Perms::READ);
foreach ($groups as $gid) {
$group_users = $group->listUsers($gid);
if (!is_a($group_users, 'PEAR_Error')) {
require_once dirname(__FILE__) . '/base.php';
if (!array_key_exists($calendar,
- Kronolith::listCalendars(false, PERMS_EDIT))) {
+ Kronolith::listCalendars(false, Horde_Perms::EDIT))) {
return PEAR::raiseError(_("Permission Denied"));
}
require_once dirname(__FILE__) . '/base.php';
if (!array_key_exists($calendar,
- Kronolith::listCalendars(false, PERMS_EDIT))) {
+ Kronolith::listCalendars(false, Horde_Perms::EDIT))) {
return PEAR::raiseError(_("Permission Denied"));
}
require_once dirname(__FILE__) . '/base.php';
if (!array_key_exists($calendar,
- Kronolith::listCalendars(false, PERMS_READ))) {
+ Kronolith::listCalendars(false, Horde_Perms::READ))) {
return PEAR::raiseError(_("Permission Denied"));
}
if (is_a($this->_share, 'PEAR_Error')) {
return $this->_share;
}
- if (!$this->_share->hasPermission(Horde_Auth::getAuth(), PERMS_SHOW)) {
+ if (!$this->_share->hasPermission(Horde_Auth::getAuth(), Horde_Perms::SHOW)) {
return _("Permission Denied");
}
}
if (isset($this->_params['calendar']) && $this->_params['calendar'] != '__all') {
$calendar = $GLOBALS['kronolith_shares']->getShare($this->_params['calendar']);
- if (!is_a($calendar, 'PEAR_Error') && !$calendar->hasPermission(Horde_Auth::getAuth(), PERMS_SHOW)) {
+ if (!is_a($calendar, 'PEAR_Error') && !$calendar->hasPermission(Horde_Auth::getAuth(), Horde_Perms::SHOW)) {
return _("Permission Denied");
}
$all_events = Kronolith::listEvents($startDate, $endDate, array($this->_params['calendar']), true, false, false);
if (isset($this->_params['calendar']) && $this->_params['calendar'] != '__all') {
$calendar = $GLOBALS['kronolith_shares']->getShare($this->_params['calendar']);
- if (!is_a($calendar, 'PEAR_Error') && !$calendar->hasPermission(Horde_Auth::getAuth(), PERMS_SHOW)) {
+ if (!is_a($calendar, 'PEAR_Error') && !$calendar->hasPermission(Horde_Auth::getAuth(), Horde_Perms::SHOW)) {
return _("Permission Denied");
}
$all_events = Kronolith::listEvents($startDate, $endDate, array($this->_params['calendar']), true, false, false);
$this->_params['calendar'] != '__all') {
$calendar = $GLOBALS['kronolith_shares']->getShare($this->_params['calendar']);
- if (!is_a($calendar, 'PEAR_Error') && !$calendar->hasPermission(Horde_Auth::getAuth(), PERMS_SHOW)) {
+ if (!is_a($calendar, 'PEAR_Error') && !$calendar->hasPermission(Horde_Auth::getAuth(), Horde_Perms::SHOW)) {
return _("Permission Denied");
}
public function getByUID($uid, $calendars = null, $getAll = false)
{
if (!is_array($calendars)) {
- $calendars = array_keys(Kronolith::listCalendars(true, PERMS_READ));
+ $calendars = array_keys(Kronolith::listCalendars(true, Horde_Perms::READ));
}
foreach ($calendars as $calendar) {
/**
* Return a list of Kronolith_Resources
*
- * Right now, all users have PERMS_READ, but only system admins have
- * PERMS_EDIT | PERMS_DELETE
+ * Right now, all users have Horde_Perms::READ, but only system admins have
+ * Horde_Perms::EDIT | Horde_Perms::DELETE
*
- * @param int $perms A PERMS_* constant.
+ * @param int $perms A Horde_Perms::* constant.
* @param array $filter A hash of field/values to filter on.
*
* @return an array of Kronolith_Resource objects.
*/
- public function listResources($perms = PERMS_READ, $filter = array())
+ public function listResources($perms = Horde_Perms::READ, $filter = array())
{
- if (($perms & (PERMS_EDIT | PERMS_DELETE)) && !Horde_Auth::isAdmin()) {
+ if (($perms & (Horde_Perms::EDIT | Horde_Perms::DELETE)) && !Horde_Auth::isAdmin()) {
return array();
}
*/
public function getGroupMemberships($resource_id)
{
- $groups = $this->listResources(PERMS_READ, array('type' => Kronolith_Resource::TYPE_GROUP));
+ $groups = $this->listResources(Horde_Perms::READ, array('type' => Kronolith_Resource::TYPE_GROUP));
$in = array();
foreach ($groups as $group) {
$members = $group->get('members');
}
/* First try the user's own calendars. */
- $ownerCalendars = Kronolith::listCalendars(true, PERMS_READ);
+ $ownerCalendars = Kronolith::listCalendars(true, Horde_Perms::READ);
$event = null;
foreach ($eventArray as $ev) {
if (isset($ownerCalendars[$ev->getCalendar()])) {
/* If not successful, try all calendars the user has access too. */
if (empty($event)) {
- $readableCalendars = Kronolith::listCalendars(false, PERMS_READ);
+ $readableCalendars = Kronolith::listCalendars(false, Horde_Perms::READ);
foreach ($eventArray as $ev) {
if (isset($readableCalendars[$ev->getCalendar()])) {
$event = $ev;
return PEAR::raiseError(_("Permission Denied"));
}
- $shares = $GLOBALS['kronolith_shares']->listShares($user, PERMS_EDIT);
+ $shares = $GLOBALS['kronolith_shares']->listShares($user, Horde_Perms::EDIT);
if (is_a($shares, 'PEAR_Error')) {
return $shares;
}
if ($this->remoteCal) {
switch ($permission) {
- case PERMS_SHOW:
- case PERMS_READ:
- case PERMS_EDIT:
+ case Horde_Perms::SHOW:
+ case Horde_Perms::READ:
+ case Horde_Perms::EDIT:
return true;
default:
$json->al = is_null($allDay) ? $this->isAllDay() : $allDay;
$json->bg = $this->_backgroundColor;
$json->fg = $this->_foregroundColor;
- $json->pe = $this->hasPermission(PERMS_EDIT);
- $json->pd = $this->hasPermission(PERMS_DELETE);
+ $json->pe = $this->hasPermission(Horde_Perms::EDIT);
+ $json->pd = $this->hasPermission(Horde_Perms::DELETE);
if ($this->alarm) {
if ($this->alarm % 10080 == 0) {
$alarm_value = $this->alarm / 10080;
if (!Horde_Auth::isAdmin() && $this->isPrivate() &&
$this->getCreatorId() != $user) {
return _("busy");
- } elseif (Horde_Auth::isAdmin() || $this->hasPermission(PERMS_READ, $user)) {
+ } elseif (Horde_Auth::isAdmin() || $this->hasPermission(Horde_Perms::READ, $user)) {
return strlen($this->title) ? $this->title : _("[Unnamed event]");
} else {
return _("busy");
$event_title = $this->getTitle();
$view_url = $this->getViewUrl(array('datetime' => $datetime->strftime('%Y%m%d%H%M%S'), 'url' => $from_url), $full);
- $read_permission = $this->hasPermission(PERMS_READ);
+ $read_permission = $this->hasPermission(Horde_Perms::READ);
$link = '';
if (isset($this->external) && !empty($this->external_link)) {
$edit = '';
$delete = '';
if ((!$this->isPrivate() || $this->getCreatorId() == Horde_Auth::getAuth())
- && $this->hasPermission(PERMS_EDIT)) {
+ && $this->hasPermission(Horde_Perms::EDIT)) {
$editurl = Horde_Util::addParameter($view_url, 'view', 'EditEvent', !$full);
$edit = Horde::link($editurl, sprintf(_("Edit %s"), $event_title), 'iconEdit')
. Horde::fullSrcImg('edit-' . $icon_color . '.png', array('attr' => 'alt="' . _("Edit") . '"'))
. '</a>';
}
- if ($this->hasPermission(PERMS_DELETE)) {
+ if ($this->hasPermission(Horde_Perms::DELETE)) {
$delurl = Horde_Util::addParameter($view_url, 'view', 'DeleteEvent', !$full);
$delete = Horde::link($delurl, sprintf(_("Delete %s"), $event_title), 'iconDelete')
. Horde::fullSrcImg('delete-' . $icon_color . '.png', array('attr' => 'alt="' . _("Delete") . '"'))
/* Get a list of available resource groups */
$driver = Kronolith::getDriver('Resource');
- $groups = $driver->listResources(PERMS_READ, array('type' => Kronolith_Resource::TYPE_GROUP));
+ $groups = $driver->listResources(Horde_Perms::READ, array('type' => Kronolith_Resource::TYPE_GROUP));
foreach ($groups as $id => $group) {
$enum[$id] = $group->get('name');
}
{
parent::Horde_Form($vars, _("Create Resource"));
- $resources = Kronolith::getDriver('Resource')->listResources(PERMS_READ, array('type' => Kronolith_Resource::TYPE_SINGLE));
+ $resources = Kronolith::getDriver('Resource')->listResources(Horde_Perms::READ, array('type' => Kronolith_Resource::TYPE_SINGLE));
$enum = array();
foreach ($resources as $resource) {
$enum[$resource->getId()] = htmlspecialchars($resource->get('name'));
return false;
}
- if (!($this->_resource->hasPermission(Horde_Auth::getAuth(), PERMS_DELETE))) {
+ if (!($this->_resource->hasPermission(Horde_Auth::getAuth(), Horde_Perms::DELETE))) {
return PEAR::raiseError(_("Permission denied"));
}
return false;
}
- if (!($this->_resource->hasPermission(Horde_Auth::getAuth(), PERMS_DELETE))) {
+ if (!($this->_resource->hasPermission(Horde_Auth::getAuth(), Horde_Perms::DELETE))) {
return PEAR::raiseError(_("Permission denied"));
}
/* Get a list of available resource groups */
$driver = Kronolith::getDriver('Resource');
- $groups = $driver->listResources(PERMS_READ, array('type' => Kronolith_Resource::TYPE_GROUP));
+ $groups = $driver->listResources(Horde_Perms::READ, array('type' => Kronolith_Resource::TYPE_GROUP));
$enum = array();
foreach ($groups as $id => $group) {
$enum[$id] = $group->get('name');
{
$this->_resource = &$resource;
parent::Horde_Form($vars, sprintf(_("Edit %s"), $resource->get('name')));
- $resources = Kronolith::getDriver('Resource')->listResources(PERMS_READ, array('type' => Kronolith_Resource::TYPE_SINGLE));
+ $resources = Kronolith::getDriver('Resource')->listResources(Horde_Perms::READ, array('type' => Kronolith_Resource::TYPE_SINGLE));
$enum = array();
foreach ($resources as $r) {
$enum[$r->getId()] = htmlspecialchars($r->get('name'));
* @package Kronolith
*/
-/** The event can be delegated. */
-define('PERMS_DELEGATE', 1024);
-
/**
* The Kronolith:: class provides functionality common to all of Kronolith.
*
/** Free/Busy not found */
const ERROR_FB_NOT_FOUND = 1;
+ /** The event can be delegated. */
+ const PERMS_DELEGATE = 1024;
+
/**
* Driver singleton instances.
*
'name' => $registry->get('name'),
'is_ie6' => ($browser->isBrowser('msie') && ($browser->getMajor() < 7)),
'login_view' => $prefs->getValue('defaultview'),
- 'default_calendar' => 'internal|' . self::getDefaultCalendar(PERMS_EDIT),
+ 'default_calendar' => 'internal|' . self::getDefaultCalendar(Horde_Perms::EDIT),
'week_start' => (int)$prefs->getValue('week_start_monday'),
'date_format' => str_replace(array('%e', '%d', '%a', '%A', '%m', '%h', '%b', '%B', '%y', '%Y'),
array('d', 'dd', 'ddd', 'dddd', 'MM', 'MMM', 'MMM', 'MMMM', 'yy', 'yyyy'),
'fg' => self::foregroundColor($calendar),
'bg' => self::backgroundColor($calendar),
'show' => in_array($id, $GLOBALS['display_calendars']),
- 'edit' => $calendar->hasPermission(Horde_Auth::getAuth(), PERMS_EDIT));
+ 'edit' => $calendar->hasPermission(Horde_Auth::getAuth(), Horde_Perms::EDIT));
}
}
if (!$has_tasks) {
continue;
}
- foreach ($GLOBALS['registry']->tasks->listTasklists($my, PERMS_SHOW) as $id => $tasklist) {
+ foreach ($GLOBALS['registry']->tasks->listTasklists($my, Horde_Perms::SHOW) as $id => $tasklist) {
$owner = $tasklist->get('owner') == Horde_Auth::getAuth();
if (($my && $owner) || (!$my && !$owner)) {
$code['conf']['calendars']['tasklists']['tasks/' . $id] = array(
'fg' => self::foregroundColor($tasklist),
'bg' => self::backgroundColor($tasklist),
'show' => in_array('tasks/' . $id, $GLOBALS['display_external_calendars']),
- 'edit' => $tasklist->hasPermission(Horde_Auth::getAuth(), PERMS_EDIT));
+ 'edit' => $tasklist->hasPermission(Horde_Auth::getAuth(), Horde_Perms::EDIT));
}
}
}
}
$kronolith_driver = self::getDriver();
- $calendars = self::listCalendars(true, PERMS_ALL);
+ $calendars = self::listCalendars(true, Horde_Perms::ALL);
$current_calendar = $kronolith_driver->getCalendar();
$count = 0;
$perm_value = 0;
switch ($GLOBALS['conf']['autoshare']['shareperms']) {
case 'read':
- $perm_value = PERMS_READ | PERMS_SHOW;
+ $perm_value = Horde_Perms::READ | Horde_Perms::SHOW;
break;
case 'edit':
- $perm_value = PERMS_READ | PERMS_SHOW | PERMS_EDIT;
+ $perm_value = Horde_Perms::READ | Horde_Perms::SHOW | Horde_Perms::EDIT;
break;
case 'full':
- $perm_value = PERMS_READ | PERMS_SHOW | PERMS_EDIT | PERMS_DELETE;
+ $perm_value = Horde_Perms::READ | Horde_Perms::SHOW | Horde_Perms::EDIT | Horde_Perms::DELETE;
break;
}
$groups = &Group::singleton();
if (!is_a($group_list, 'PEAR_Error') && count($group_list)) {
$perm = $share->getPermission();
// Add the default perm, not added otherwise
- $perm->addUserPermission(Horde_Auth::getAuth(), PERMS_ALL, false);
+ $perm->addUserPermission(Horde_Auth::getAuth(), Horde_Perms::ALL, false);
foreach ($group_list as $group_id => $group_name) {
$perm->addGroupPermission($group_id, $perm_value, false);
}
*
* @return array The calendar list.
*/
- public static function listCalendars($owneronly = false, $permission = PERMS_SHOW)
+ public static function listCalendars($owneronly = false, $permission = Horde_Perms::SHOW)
{
$calendars = $GLOBALS['kronolith_shares']->listShares(Horde_Auth::getAuth(), $permission, $owneronly ? Horde_Auth::getAuth() : null, 0, 0, 'name');
if (is_a($calendars, 'PEAR_Error')) {
* Returns the default calendar for the current user at the specified
* permissions level.
*/
- public static function getDefaultCalendar($permission = PERMS_SHOW)
+ public static function getDefaultCalendar($permission = Horde_Perms::SHOW)
{
global $prefs;
$owner = $share->get('owner');
$recipients[$owner] = self::_notificationPref($owner, 'owner');
- foreach ($share->listUsers(PERMS_READ) as $user) {
+ foreach ($share->listUsers(Horde_Perms::READ) as $user) {
if (!isset($recipients[$user])) {
$recipients[$user] = self::_notificationPref($user, 'read', $calendar);
}
}
- foreach ($share->listGroups(PERMS_READ) as $group) {
+ foreach ($share->listGroups(Horde_Perms::READ) as $group) {
$group = $groups->getGroupById($group);
if (is_a($group, 'PEAR_Error')) {
continue;
'onclick' => 'return ShowTab(\'Event\');'));
if ((!$event->isPrivate() ||
$event->getCreatorId() == Horde_Auth::getAuth()) &&
- $event->hasPermission(PERMS_EDIT)) {
+ $event->hasPermission(Horde_Perms::EDIT)) {
$tabs->addTab(
$event->isRemote() ? _("Save As New") : _("_Edit"),
$event->getEditUrl(),
'id' => 'tabEditEvent',
'onclick' => 'return ShowTab(\'EditEvent\');'));
}
- if ($event->hasPermission(PERMS_DELETE)) {
+ if ($event->hasPermission(Horde_Perms::DELETE)) {
$tabs->addTab(
_("De_lete"),
$event->getDeleteUrl(array('confirm' => 1)),
->getEvent(Horde_Util::getFormData('eventID'));
}
if (!is_a($event, 'PEAR_Error') &&
- !$event->hasPermission(PERMS_READ)) {
+ !$event->hasPermission(Horde_Perms::READ)) {
$event = PEAR::raiseError(_("Permission Denied"));
}
->getEvent(Horde_Util::getFormData('eventID'));
}
if (!is_a($event, 'PEAR_Error') &&
- !$event->hasPermission(PERMS_EDIT)) {
+ !$event->hasPermission(Horde_Perms::EDIT)) {
$event = PEAR::raiseError(_("Permission Denied"));
}
->getEvent(Horde_Util::getFormData('eventID'));
}
if (!is_a($event, 'PEAR_Error') &&
- !$event->hasPermission(PERMS_DELETE)) {
+ !$event->hasPermission(Horde_Perms::DELETE)) {
$event = PEAR::raiseError(_("Permission Denied"));
}
->getEvent(Horde_Util::getFormData('eventID'));
}
if (!is_a($event, 'PEAR_Error') &&
- !$event->hasPermission(PERMS_READ)) {
+ !$event->hasPermission(Horde_Perms::READ)) {
$event = PEAR::raiseError(_("Permission Denied"));
}
$menu = new Horde_Menu();
$menu->add(Horde::applicationUrl($prefs->getValue('defaultview') . '.php'), _("_Today"), 'today.png', null, null, null, '__noselection');
- if (self::getDefaultCalendar(PERMS_EDIT) &&
+ if (self::getDefaultCalendar(Horde_Perms::EDIT) &&
(!empty($conf['hooks']['permsdenied']) ||
self::hasPermission('max_events') === true ||
self::hasPermission('max_events') > self::countEvents())) {
$del_time = new Horde_Date($_SERVER['REQUEST_TIME']);
$del_time->mday -= $GLOBALS['prefs']->getValue('purge_events_keep');
- /* Need to have PERMS_DELETE on a calendar to delete events from it */
- $calendars = Kronolith::listCalendars(false, PERMS_DELETE);
+ /* Need to have Horde_Perms::DELETE on a calendar to delete events from it */
+ $calendars = Kronolith::listCalendars(false, Horde_Perms::DELETE);
/* Start building an event object to use for the search */
$kronolith_driver = Kronolith::getDriver();
* @param $restrict
* @return unknown_type
*/
- public function hasPermission($user, $permission = PERMS_READ, $restrict = null)
+ public function hasPermission($user, $permission = Horde_Perms::READ, $restrict = null)
{
if (Horde_Auth::isAdmin()) {
return true;
$started = false;
$first_row = true;
- $addLinks = Kronolith::getDefaultCalendar(PERMS_EDIT) &&
+ $addLinks = Kronolith::getDefaultCalendar(Horde_Perms::EDIT) &&
(!empty($GLOBALS['conf']['hooks']['permsdenied']) ||
Kronolith::hasPermission('max_events') === true ||
Kronolith::hasPermission('max_events') > Kronolith::countEvents());
echo '</div>';
if ($active && $GLOBALS['browser']->hasFeature('dom')) {
- if ($this->event->hasPermission(PERMS_READ)) {
+ if ($this->event->hasPermission(Horde_Perms::READ)) {
$view = new Kronolith_View_Event($this->event);
$view->html(false);
}
- if ($this->event->hasPermission(PERMS_EDIT)) {
+ if ($this->event->hasPermission(Horde_Perms::EDIT)) {
$edit = new Kronolith_View_EditEvent($this->event);
$edit->html(false);
}
}
if ($this->event->isRemote()) {
- $calendar_id = Kronolith::getDefaultCalendar(PERMS_EDIT);
+ $calendar_id = Kronolith::getDefaultCalendar(Horde_Perms::EDIT);
} else {
$calendar_id = $this->event->getCalendar();
}
- if (!$this->event->hasPermission(PERMS_EDIT) &&
+ if (!$this->event->hasPermission(Horde_Perms::EDIT) &&
!is_a($share = &$this->event->getShare(), 'PEAR_Error')) {
$calendar_id .= ':' . $share->get('owner');
}
}
$url = Horde_Util::getFormData('url');
- $perms = PERMS_EDIT;
+ $perms = Horde_Perms::EDIT;
if ($this->event->getCreatorId() == Horde_Auth::getAuth()) {
- $perms |= PERMS_DELEGATE;
+ $perms |= Kronolith::PERMS_DELEGATE;
}
$calendars = Kronolith::listCalendars(false, $perms);
$buttons = array();
if (($this->event->isRemote() ||
- !$this->event->hasPermission(PERMS_EDIT)) &&
+ !$this->event->hasPermission(Horde_Perms::EDIT)) &&
(!empty($GLOBALS['conf']['hooks']['permsdenied']) ||
Kronolith::hasPermission('max_events') === true ||
Kronolith::hasPermission('max_events') > Kronolith::countEvents())) {
echo '</div>';
if ($active && $GLOBALS['browser']->hasFeature('dom')) {
- if ($this->event->hasPermission(PERMS_READ)) {
+ if ($this->event->hasPermission(Horde_Perms::READ)) {
$view = new Kronolith_View_Event($this->event);
$view->html(false);
}
- if ($this->event->hasPermission(PERMS_DELETE)) {
+ if ($this->event->hasPermission(Horde_Perms::DELETE)) {
$delete = new Kronolith_View_DeleteEvent($this->event);
$delete->html(false);
}
echo '</div>';
if ($active && $GLOBALS['browser']->hasFeature('dom')) {
- if ($this->event->hasPermission(PERMS_EDIT)) {
+ if ($this->event->hasPermission(Horde_Perms::EDIT)) {
$edit = new Kronolith_View_EditEvent($this->event);
$edit->html(false);
}
- if ($this->event->hasPermission(PERMS_DELETE)) {
+ if ($this->event->hasPermission(Horde_Perms::DELETE)) {
$delete = new Kronolith_View_DeleteEvent($this->event);
$delete->html(false);
}
$sidebyside = $prefs->getValue('show_shared_side_by_side');
$twentyFour = $prefs->getValue('twentyFour');
- $addLinks = Kronolith::getDefaultCalendar(PERMS_EDIT) &&
+ $addLinks = Kronolith::getDefaultCalendar(Horde_Perms::EDIT) &&
(!empty($GLOBALS['conf']['hooks']['permsdenied']) ||
Kronolith::hasPermission('max_events') === true ||
Kronolith::hasPermission('max_events') > Kronolith::countEvents());
exit;
}
-$calendar_id = Horde_Util::getFormData('calendar', Kronolith::getDefaultCalendar(PERMS_EDIT));
+$calendar_id = Horde_Util::getFormData('calendar', Kronolith::getDefaultCalendar(Horde_Perms::EDIT));
if (!$calendar_id) {
$url = Horde_Util::addParameter($prefs->getValue('defaultview') . '.php', array('month' => Horde_Util::getFormData('month'),
'year' => Horde_Util::getFormData('year')));
}
$title = _("Add a new event");
-$calendars = Kronolith::listCalendars(false, PERMS_EDIT | PERMS_DELEGATE);
+$calendars = Kronolith::listCalendars(false, Horde_Perms::EDIT | Kronolith::PERMS_DELEGATE);
Horde::addScriptFile('popup.js', 'horde');
require KRONOLITH_TEMPLATES . '/common-header.inc';
require KRONOLITH_TEMPLATES . '/menu.inc';
// Process default permissions.
if (Horde_Util::getFormData('default_show')) {
- $perm->addDefaultPermission(PERMS_SHOW, false);
+ $perm->addDefaultPermission(Horde_Perms::SHOW, false);
} else {
- $perm->removeDefaultPermission(PERMS_SHOW, false);
+ $perm->removeDefaultPermission(Horde_Perms::SHOW, false);
}
if (Horde_Util::getFormData('default_read')) {
- $perm->addDefaultPermission(PERMS_READ, false);
+ $perm->addDefaultPermission(Horde_Perms::READ, false);
} else {
- $perm->removeDefaultPermission(PERMS_READ, false);
+ $perm->removeDefaultPermission(Horde_Perms::READ, false);
}
if (Horde_Util::getFormData('default_edit')) {
- $perm->addDefaultPermission(PERMS_EDIT, false);
+ $perm->addDefaultPermission(Horde_Perms::EDIT, false);
} else {
- $perm->removeDefaultPermission(PERMS_EDIT, false);
+ $perm->removeDefaultPermission(Horde_Perms::EDIT, false);
}
if (Horde_Util::getFormData('default_delete')) {
- $perm->addDefaultPermission(PERMS_DELETE, false);
+ $perm->addDefaultPermission(Horde_Perms::DELETE, false);
} else {
- $perm->removeDefaultPermission(PERMS_DELETE, false);
+ $perm->removeDefaultPermission(Horde_Perms::DELETE, false);
}
if (Horde_Util::getFormData('default_delegate')) {
- $perm->addDefaultPermission(PERMS_DELEGATE, false);
+ $perm->addDefaultPermission(Kronolith::PERMS_DELEGATE, false);
} else {
- $perm->removeDefaultPermission(PERMS_DELEGATE, false);
+ $perm->removeDefaultPermission(Kronolith::PERMS_DELEGATE, false);
}
// Process guest permissions.
if (Horde_Util::getFormData('guest_show')) {
- $perm->addGuestPermission(PERMS_SHOW, false);
+ $perm->addGuestPermission(Horde_Perms::SHOW, false);
} else {
- $perm->removeGuestPermission(PERMS_SHOW, false);
+ $perm->removeGuestPermission(Horde_Perms::SHOW, false);
}
if (Horde_Util::getFormData('guest_read')) {
- $perm->addGuestPermission(PERMS_READ, false);
+ $perm->addGuestPermission(Horde_Perms::READ, false);
} else {
- $perm->removeGuestPermission(PERMS_READ, false);
+ $perm->removeGuestPermission(Horde_Perms::READ, false);
}
if (Horde_Util::getFormData('guest_edit')) {
- $perm->addGuestPermission(PERMS_EDIT, false);
+ $perm->addGuestPermission(Horde_Perms::EDIT, false);
} else {
- $perm->removeGuestPermission(PERMS_EDIT, false);
+ $perm->removeGuestPermission(Horde_Perms::EDIT, false);
}
if (Horde_Util::getFormData('guest_delete')) {
- $perm->addGuestPermission(PERMS_DELETE, false);
+ $perm->addGuestPermission(Horde_Perms::DELETE, false);
} else {
- $perm->removeGuestPermission(PERMS_DELETE, false);
+ $perm->removeGuestPermission(Horde_Perms::DELETE, false);
}
if (Horde_Util::getFormData('guest_delegate')) {
- $perm->addGuestPermission(PERMS_DELEGATE, false);
+ $perm->addGuestPermission(Kronolith::PERMS_DELEGATE, false);
} else {
- $perm->removeGuestPermission(PERMS_DELEGATE, false);
+ $perm->removeGuestPermission(Kronolith::PERMS_DELEGATE, false);
}
// Process creator permissions.
if (Horde_Util::getFormData('creator_show')) {
- $perm->addCreatorPermission(PERMS_SHOW, false);
+ $perm->addCreatorPermission(Horde_Perms::SHOW, false);
} else {
- $perm->removeCreatorPermission(PERMS_SHOW, false);
+ $perm->removeCreatorPermission(Horde_Perms::SHOW, false);
}
if (Horde_Util::getFormData('creator_read')) {
- $perm->addCreatorPermission(PERMS_READ, false);
+ $perm->addCreatorPermission(Horde_Perms::READ, false);
} else {
- $perm->removeCreatorPermission(PERMS_READ, false);
+ $perm->removeCreatorPermission(Horde_Perms::READ, false);
}
if (Horde_Util::getFormData('creator_edit')) {
- $perm->addCreatorPermission(PERMS_EDIT, false);
+ $perm->addCreatorPermission(Horde_Perms::EDIT, false);
} else {
- $perm->removeCreatorPermission(PERMS_EDIT, false);
+ $perm->removeCreatorPermission(Horde_Perms::EDIT, false);
}
if (Horde_Util::getFormData('creator_delete')) {
- $perm->addCreatorPermission(PERMS_DELETE, false);
+ $perm->addCreatorPermission(Horde_Perms::DELETE, false);
} else {
- $perm->removeCreatorPermission(PERMS_DELETE, false);
+ $perm->removeCreatorPermission(Horde_Perms::DELETE, false);
}
if (Horde_Util::getFormData('creator_delegate')) {
- $perm->addCreatorPermission(PERMS_DELEGATE, false);
+ $perm->addCreatorPermission(Kronolith::PERMS_DELEGATE, false);
} else {
- $perm->removeCreatorPermission(PERMS_DELEGATE, false);
+ $perm->removeCreatorPermission(Kronolith::PERMS_DELEGATE, false);
}
// Process user permissions.
}
if (!empty($u_show[$key])) {
- $perm->addUserPermission($user, PERMS_SHOW, false);
+ $perm->addUserPermission($user, Horde_Perms::SHOW, false);
} else {
- $perm->removeUserPermission($user, PERMS_SHOW, false);
+ $perm->removeUserPermission($user, Horde_Perms::SHOW, false);
}
if (!empty($u_read[$key])) {
- $perm->addUserPermission($user, PERMS_READ, false);
+ $perm->addUserPermission($user, Horde_Perms::READ, false);
} else {
- $perm->removeUserPermission($user, PERMS_READ, false);
+ $perm->removeUserPermission($user, Horde_Perms::READ, false);
}
if (!empty($u_edit[$key])) {
- $perm->addUserPermission($user, PERMS_EDIT, false);
+ $perm->addUserPermission($user, Horde_Perms::EDIT, false);
} else {
- $perm->removeUserPermission($user, PERMS_EDIT, false);
+ $perm->removeUserPermission($user, Horde_Perms::EDIT, false);
}
if (!empty($u_delete[$key])) {
- $perm->addUserPermission($user, PERMS_DELETE, false);
+ $perm->addUserPermission($user, Horde_Perms::DELETE, false);
} else {
- $perm->removeUserPermission($user, PERMS_DELETE, false);
+ $perm->removeUserPermission($user, Horde_Perms::DELETE, false);
}
if (!empty($u_delegate[$key])) {
- $perm->addUserPermission($user, PERMS_DELEGATE, false);
+ $perm->addUserPermission($user, Kronolith::PERMS_DELEGATE, false);
} else {
- $perm->removeUserPermission($user, PERMS_DELEGATE, false);
+ $perm->removeUserPermission($user, Kronolith::PERMS_DELEGATE, false);
}
}
}
if (!empty($g_show[$key])) {
- $perm->addGroupPermission($group, PERMS_SHOW, false);
+ $perm->addGroupPermission($group, Horde_Perms::SHOW, false);
} else {
- $perm->removeGroupPermission($group, PERMS_SHOW, false);
+ $perm->removeGroupPermission($group, Horde_Perms::SHOW, false);
}
if (!empty($g_read[$key])) {
- $perm->addGroupPermission($group, PERMS_READ, false);
+ $perm->addGroupPermission($group, Horde_Perms::READ, false);
} else {
- $perm->removeGroupPermission($group, PERMS_READ, false);
+ $perm->removeGroupPermission($group, Horde_Perms::READ, false);
}
if (!empty($g_edit[$key])) {
- $perm->addGroupPermission($group, PERMS_EDIT, false);
+ $perm->addGroupPermission($group, Horde_Perms::EDIT, false);
} else {
- $perm->removeGroupPermission($group, PERMS_EDIT, false);
+ $perm->removeGroupPermission($group, Horde_Perms::EDIT, false);
}
if (!empty($g_delete[$key])) {
- $perm->addGroupPermission($group, PERMS_DELETE, false);
+ $perm->addGroupPermission($group, Horde_Perms::DELETE, false);
} else {
- $perm->removeGroupPermission($group, PERMS_DELETE, false);
+ $perm->removeGroupPermission($group, Horde_Perms::DELETE, false);
}
if (!empty($g_delegate[$key])) {
- $perm->addGroupPermission($group, PERMS_DELEGATE, false);
+ $perm->addGroupPermission($group, Kronolith::PERMS_DELEGATE, false);
} else {
- $perm->removeGroupPermission($group, PERMS_DELEGATE, false);
+ $perm->removeGroupPermission($group, Kronolith::PERMS_DELEGATE, false);
}
}
$notification->push($resoruce, 'horde.error');
header('Location: ' . Horde::applicationUrl('resources/', true));
exit;
-} elseif (!$resource->hasPermission(Horde_Auth::getAuth(), PERMS_DELETE)) {
+} elseif (!$resource->hasPermission(Horde_Auth::getAuth(), Horde_Perms::DELETE)) {
$notification->push(_("You are not allowed to delete this resource."), 'horde.error');
header('Location: ' . Horde::applicationUrl('resources/', true));
exit;
$notification->push($resource, 'horde.error');
header('Location: ' . Horde::applicationUrl('resources/', true));
exit;
-} elseif (!$resource->hasPermission(Horde_Auth::getAuth(), PERMS_EDIT)) {
+} elseif (!$resource->hasPermission(Horde_Auth::getAuth(), Horde_Perms::EDIT)) {
$notification->push(_("You are not allowed to change this resource."), 'horde.error');
header('Location: ' . Horde::applicationUrl('resources/', true));
exit;
$notification->push($resoruce, 'horde.error');
header('Location: ' . Horde::applicationUrl('resources/groups/', true));
exit;
-} elseif (!$resource->hasPermission(Horde_Auth::getAuth(), PERMS_DELETE)) {
+} elseif (!$resource->hasPermission(Horde_Auth::getAuth(), Horde_Perms::DELETE)) {
$notification->push(_("You are not allowed to delete this resource group."), 'horde.error');
header('Location: ' . Horde::applicationUrl('resources/groups/', true));
exit;
$notification->push($group, 'horde.error');
header('Location: ' . Horde::applicationUrl('resources/groups/', true));
exit;
-} elseif (!$group->hasPermission(Horde_Auth::getAuth(), PERMS_EDIT)) {
+} elseif (!$group->hasPermission(Horde_Auth::getAuth(), Horde_Perms::EDIT)) {
$notification->push(_("You are not allowed to change this resource."), 'horde.error');
header('Location: ' . Horde::applicationUrl('resources/groups/', true));
exit;
$edit_url_base = Horde::applicationUrl('resources/groups/edit.php');
$edit_img = Horde::img('edit.png', _("Edit"), null, $registry->getImageDir('horde'));
-$resources = Kronolith::getDriver('Resource')->listResources(PERMS_EDIT, array('type' => Kronolith_Resource::TYPE_GROUP));
+$resources = Kronolith::getDriver('Resource')->listResources(Horde_Perms::EDIT, array('type' => Kronolith_Resource::TYPE_GROUP));
//$display_url_base = Horde::applicationUrl('month.php', true, -1);
$delete_url_base = Horde::applicationUrl('resources/groups/delete.php');
$delete_img = Horde::img('delete.png', _("Delete"), null, $registry->getImageDir('horde'));
}
$edit_url_base = Horde::applicationUrl('resources/edit.php');
$edit_img = Horde::img('edit.png', _("Edit"), null, $registry->getImageDir('horde'));
-$resources = Kronolith::getDriver('Resource')->listResources(PERMS_READ, array('type' => Kronolith_Resource::TYPE_SINGLE));
+$resources = Kronolith::getDriver('Resource')->listResources(Horde_Perms::READ, array('type' => Kronolith_Resource::TYPE_SINGLE));
$display_url_base = Horde::applicationUrl('month.php', true, -1);
$delete_url_base = Horde::applicationUrl('resources/delete.php');
$delete_img = Horde::img('delete.png', _("Delete"), null, $registry->getImageDir('horde'));
if (is_a($calendar, 'PEAR_Error')) {
continue;
}
- $users = array_merge($users, $calendar->listUsers(PERMS_READ));
+ $users = array_merge($users, $calendar->listUsers(Horde_Perms::READ));
}
// Remove duplicates.
// If we found an email address, generate the agenda.
switch ($agenda_calendars) {
case 'owner':
- $calendars = $GLOBALS['shares']->listShares($user, PERMS_SHOW, $user);
+ $calendars = $GLOBALS['shares']->listShares($user, Horde_Perms::SHOW, $user);
break;
case 'read':
- $calendars = $GLOBALS['shares']->listShares($user, PERMS_SHOW, null);
+ $calendars = $GLOBALS['shares']->listShares($user, Horde_Perms::SHOW, null);
break;
case 'show':
default:
$calendars = array();
$shown_calendars = unserialize($prefs->getValue('display_cals'));
- $cals = $GLOBALS['shares']->listShares($user, PERMS_SHOW, null);
+ $cals = $GLOBALS['shares']->listShares($user, Horde_Perms::SHOW, null);
foreach ($cals as $calId => $cal) {
if (in_array($calId, $shown_calendars)) {
$calendars[$calId] = $cal;
$cli->fatal($result->toString());
}
while ($perm_row = $result->fetchRow()) {
- $permissions[$perm_row[0]] = PERMS_READ | PERMS_SHOW;
+ $permissions[$perm_row[0]] = Horde_Perms::READ | Horde_Perms::SHOW;
}
$result = $db->execute($write_stmt, array($row['id']));
if (is_a($result, 'PEAR_Error')) {
}
while ($perm_row = $result->fetchRow()) {
if (isset($permissions[$perm_row[0]])) {
- $permissions[$perm_row[0]] |= PERMS_EDIT;
+ $permissions[$perm_row[0]] |= Horde_Perms::EDIT;
} else {
- $permissions[$perm_row[0]] = PERMS_EDIT;
+ $permissions[$perm_row[0]] = Horde_Perms::EDIT;
}
}
if (count($permissions)) {
$perm = $share->getPermission();
- $perm->addUserPermission($user, PERMS_ALL, false);
+ $perm->addUserPermission($user, Horde_Perms::ALL, false);
foreach ($permissions as $key => $value) {
$perm->addUserPermission($key, $value, false);
}
$optgroup = $GLOBALS['browser']->hasFeature('optgroup');
$current_user = Horde_Auth::getAuth();
$calendars = array();
- foreach (Kronolith::listCalendars(false, PERMS_READ) as $id => $cal) {
+ foreach (Kronolith::listCalendars(false, Horde_Perms::READ) as $id => $cal) {
if ($cal->get('owner') == $current_user) {
$calendars[_("My Calendars:")]['|' . $id] = $cal->get('name');
} else {
<option value="<?php echo Horde_Data::EXPORT_ICALENDAR ?>">iCalendar</option>
</select><br /><br />
- <?php if (count($calendars = Kronolith::listCalendars(false, PERMS_READ)) > 1): ?>
+ <?php if (count($calendars = Kronolith::listCalendars(false, Horde_Perms::READ)) > 1): ?>
<?php echo Horde::label('exportCal', _("Select the calendar(s) to export from")) ?><br />
<select id="exportCal" name="exportCal[]" multiple="multiple">
<?php foreach ($calendars as $id => $cal) {
} ?>
</select><br /><br />
<?php else: ?>
- <input type="hidden" name="exportCal[]" value="<?php echo htmlspecialchars(Kronolith::getDefaultCalendar(PERMS_READ)) ?>" />
+ <input type="hidden" name="exportCal[]" value="<?php echo htmlspecialchars(Kronolith::getDefaultCalendar(Horde_Perms::READ)) ?>" />
<?php endif; ?>
<?php echo _("Limit the time span to export:") ?><br />
<option value="icalendar"><?php echo _("vCalendar/iCalendar") ?></option>
</select><br />
- <?php if (!$prefs->isLocked('default_share') && count($calendars = Kronolith::listCalendars(false, PERMS_EDIT)) > 1): ?>
+ <?php if (!$prefs->isLocked('default_share') && count($calendars = Kronolith::listCalendars(false, Horde_Perms::EDIT)) > 1): ?>
<?php echo Horde::label('importCal', _("Select the calendar to import to:")) ?><br />
<select id="importCal" name="importCal">
<?php foreach ($calendars as $id => $cal) {
} ?>
</select><br /><br />
<?php else: ?>
- <input type="hidden" name="importCal" value="<?php echo htmlspecialchars(Kronolith::getDefaultCalendar(PERMS_EDIT)) ?>" />
+ <input type="hidden" name="importCal" value="<?php echo htmlspecialchars(Kronolith::getDefaultCalendar(Horde_Perms::EDIT)) ?>" />
<?php endif; ?>
<?php echo Horde::label('import_file', _("Select the file to import:")) ?><br />
<input type="file" id="import_file" name="import_file" size="40" />
// Normal view
foreach ($calendars as $id => $cal) {
$delegates = array();
- if ($cal->hasPermission(Horde_Auth::getAuth(), PERMS_EDIT, $creator)) {
+ if ($cal->hasPermission(Horde_Auth::getAuth(), Horde_Perms::EDIT, $creator)) {
$delegates[$id] = htmlspecialchars($cal->get('name'));
} else {
$delegates[$id . ':' . $cal->get('owner')] = htmlspecialchars($cal->get('name'). ' (' . sprintf(_("as %s"), Kronolith::getUserName($cal->get('owner'))) . ')');
<li class="panel-tags">
<?php
echo $tag;
-if ($cal->hasPermission(Horde_Auth::getAuth(), PERMS_EDIT)) {
+if ($cal->hasPermission(Horde_Auth::getAuth(), Horde_Perms::EDIT)) {
echo '<a href="#" id="remove' . md5($id . $tag_id) . '">'
. Horde::img('delete-small.png', _("Remove Tag"), '', $registry->getImageDir('horde'))
. '</a>';
<tr>
<td class="light"> </td>
<td align="center">
- <input type="checkbox" id="default_show" name="default_show"<?php echo ($dperm & PERMS_SHOW) ? ' checked="checked"' : '' ?> />
+ <input type="checkbox" id="default_show" name="default_show"<?php echo ($dperm & Horde_Perms::SHOW) ? ' checked="checked"' : '' ?> />
<label for="default_show" class="hidden"><?php echo _("Show") ?></label>
</td>
<td align="center">
- <input type="checkbox" id="default_read" name="default_read"<?php echo ($dperm & PERMS_READ) ? ' checked="checked"' : '' ?> />
+ <input type="checkbox" id="default_read" name="default_read"<?php echo ($dperm & Horde_Perms::READ) ? ' checked="checked"' : '' ?> />
<label for="default_read" class="hidden"><?php echo _("Read") ?></label>
</td>
<td align="center">
- <input type="checkbox" id="default_edit" name="default_edit"<?php echo ($dperm & PERMS_EDIT) ? ' checked="checked"' : '' ?> />
+ <input type="checkbox" id="default_edit" name="default_edit"<?php echo ($dperm & Horde_Perms::EDIT) ? ' checked="checked"' : '' ?> />
<label for="default_edit" class="hidden"><?php echo _("Edit") ?></label>
</td>
<td align="center">
- <input type="checkbox" id="default_delete" name="default_delete"<?php echo ($dperm & PERMS_DELETE) ? ' checked="checked"' : '' ?> />
+ <input type="checkbox" id="default_delete" name="default_delete"<?php echo ($dperm & Horde_Perms::DELETE) ? ' checked="checked"' : '' ?> />
<label for="default_delete" class="hidden"><?php echo _("Delete") ?></label>
</td>
<td align="center">
- <input type="checkbox" id="default_delegate" name="default_delegate"<?php echo ($dperm & PERMS_DELEGATE) ? ' checked="checked"' : '' ?> />
+ <input type="checkbox" id="default_delegate" name="default_delegate"<?php echo ($dperm & Kronolith::PERMS_DELEGATE) ? ' checked="checked"' : '' ?> />
<label for="default_delegate" class="hidden"><?php echo _("Delegate") ?></label>
</td>
<td> </td>
<tr>
<td class="light"> </td>
<td align="center">
- <input type="checkbox" id="guest_show" name="guest_show"<?php echo ($gperm & PERMS_SHOW) ? ' checked="checked"' : '' ?> />
+ <input type="checkbox" id="guest_show" name="guest_show"<?php echo ($gperm & Horde_Perms::SHOW) ? ' checked="checked"' : '' ?> />
<label for="guest_show" class="hidden"><?php echo _("Show") ?></label>
</td>
<td align="center">
- <input type="checkbox" id="guest_read" name="guest_read"<?php echo ($gperm & PERMS_READ) ? ' checked="checked"' : '' ?> />
+ <input type="checkbox" id="guest_read" name="guest_read"<?php echo ($gperm & Horde_Perms::READ) ? ' checked="checked"' : '' ?> />
<label for="guest_read" class="hidden"><?php echo _("Read") ?></label>
</td>
<td align="center">
- <input type="checkbox" id="guest_edit" name="guest_edit"<?php echo ($gperm & PERMS_EDIT) ? ' checked="checked"' : '' ?> />
+ <input type="checkbox" id="guest_edit" name="guest_edit"<?php echo ($gperm & Horde_Perms::EDIT) ? ' checked="checked"' : '' ?> />
<label for="guest_edit" class="hidden"><?php echo _("Edit") ?></label>
</td>
<td align="center">
- <input type="checkbox" id="guest_delete" name="guest_delete"<?php echo ($gperm & PERMS_DELETE) ? ' checked="checked"' : '' ?> />
+ <input type="checkbox" id="guest_delete" name="guest_delete"<?php echo ($gperm & Horde_Perms::DELETE) ? ' checked="checked"' : '' ?> />
<label for="guest_delete" class="hidden"><?php echo _("Delete") ?></label>
</td>
<td align="center">
- <input type="checkbox" id="guest_delegate" name="guest_delegate"<?php echo ($gperm & PERMS_DELEGATE) ? ' checked="checked"' : '' ?> />
+ <input type="checkbox" id="guest_delegate" name="guest_delegate"<?php echo ($gperm & Kronolith::PERMS_DELEGATE) ? ' checked="checked"' : '' ?> />
<label for="guest_delegate" class="hidden"><?php echo _("Delegate") ?></label>
</td>
<td> </td>
<tr>
<td class="light"> </td>
<td align="center">
- <input type="checkbox" id="creator_show" name="creator_show"<?php echo ($cperm & PERMS_SHOW) ? ' checked="checked"' : '' ?> />
+ <input type="checkbox" id="creator_show" name="creator_show"<?php echo ($cperm & Horde_Perms::SHOW) ? ' checked="checked"' : '' ?> />
<label for="creator_show" class="hidden"><?php echo _("Show") ?></label>
</td>
<td align="center">
- <input type="checkbox" id="creator_read" name="creator_read"<?php echo ($cperm & PERMS_READ) ? ' checked="checked"' : '' ?> />
+ <input type="checkbox" id="creator_read" name="creator_read"<?php echo ($cperm & Horde_Perms::READ) ? ' checked="checked"' : '' ?> />
<label for="creator_read" class="hidden"><?php echo _("Read") ?></label>
</td>
<td align="center">
- <input type="checkbox" id="creator_edit" name="creator_edit"<?php echo ($cperm & PERMS_EDIT) ? ' checked="checked"' : '' ?> />
+ <input type="checkbox" id="creator_edit" name="creator_edit"<?php echo ($cperm & Horde_Perms::EDIT) ? ' checked="checked"' : '' ?> />
<label for="creator_edit" class="hidden"><?php echo _("Edit") ?></label>
</td>
<td align="center">
- <input type="checkbox" id="creator_delete" name="creator_delete"<?php echo ($cperm & PERMS_DELETE) ? ' checked="checked"' : '' ?> />
+ <input type="checkbox" id="creator_delete" name="creator_delete"<?php echo ($cperm & Horde_Perms::DELETE) ? ' checked="checked"' : '' ?> />
<label for="creator_delete" class="hidden"><?php echo _("Delete") ?></label>
</td>
<td align="center">
- <input type="checkbox" id="creator_delegate" name="creator_delegate"<?php echo ($cperm & PERMS_DELEGATE) ? ' checked="checked"' : '' ?> />
+ <input type="checkbox" id="creator_delegate" name="creator_delegate"<?php echo ($cperm & Kronolith::PERMS_DELEGATE) ? ' checked="checked"' : '' ?> />
<label for="creator_delegate" class="hidden"><?php echo _("Delegate") ?></label>
</td>
<td> </td>
<tr>
<td class="light"><?php echo htmlspecialchars($user) ?><input type="hidden" name="u_names[<?php echo htmlspecialchars($user) ?>]" value="<?php echo htmlspecialchars($user) ?>" /></td>
<td align="center">
- <input type="checkbox" id="u_show_<?php echo str_replace('@', '_', htmlspecialchars($user)) ?>" name="u_show[<?php echo htmlspecialchars($user) ?>]"<?php echo ($uperm & PERMS_SHOW) ? ' checked="checked"' : '' ?> />
+ <input type="checkbox" id="u_show_<?php echo str_replace('@', '_', htmlspecialchars($user)) ?>" name="u_show[<?php echo htmlspecialchars($user) ?>]"<?php echo ($uperm & Horde_Perms::SHOW) ? ' checked="checked"' : '' ?> />
<label for="u_show_<?php echo str_replace('@', '_', htmlspecialchars($user)) ?>" class="hidden"><?php echo _("Show") ?></label>
</td>
<td align="center">
- <input type="checkbox" id="u_read_<?php echo str_replace('@', '_', htmlspecialchars($user)) ?>" name="u_read[<?php echo htmlspecialchars($user) ?>]"<?php echo ($uperm & PERMS_READ) ? ' checked="checked"' : '' ?> />
+ <input type="checkbox" id="u_read_<?php echo str_replace('@', '_', htmlspecialchars($user)) ?>" name="u_read[<?php echo htmlspecialchars($user) ?>]"<?php echo ($uperm & Horde_Perms::READ) ? ' checked="checked"' : '' ?> />
<label for="u_read_<?php echo str_replace('@', '_', htmlspecialchars($user)) ?>" class="hidden"><?php echo _("Read") ?></label>
</td>
<td align="center">
- <input type="checkbox" id="u_edit_<?php echo str_replace('@', '_', htmlspecialchars($user)) ?>" name="u_edit[<?php echo htmlspecialchars($user) ?>]"<?php echo ($uperm & PERMS_EDIT) ? ' checked="checked"' : '' ?> />
+ <input type="checkbox" id="u_edit_<?php echo str_replace('@', '_', htmlspecialchars($user)) ?>" name="u_edit[<?php echo htmlspecialchars($user) ?>]"<?php echo ($uperm & Horde_Perms::EDIT) ? ' checked="checked"' : '' ?> />
<label for="u_edit_<?php echo str_replace('@', '_', htmlspecialchars($user)) ?>" class="hidden"><?php echo _("Edit") ?></label>
</td>
<td align="center">
- <input type="checkbox" id="u_delete_<?php echo str_replace('@', '_', htmlspecialchars($user)) ?>" name="u_delete[<?php echo htmlspecialchars($user) ?>]"<?php echo ($uperm & PERMS_DELETE) ? ' checked="checked"' : '' ?> />
+ <input type="checkbox" id="u_delete_<?php echo str_replace('@', '_', htmlspecialchars($user)) ?>" name="u_delete[<?php echo htmlspecialchars($user) ?>]"<?php echo ($uperm & Horde_Perms::DELETE) ? ' checked="checked"' : '' ?> />
<label for="u_delete_<?php echo str_replace('@', '_', htmlspecialchars($user)) ?>" class="hidden"><?php echo _("Delete") ?></label>
</td>
<td align="center">
- <input type="checkbox" id="u_delegate_<?php echo str_replace('@', '_', htmlspecialchars($user)) ?>" name="u_delegate[<?php echo htmlspecialchars($user) ?>]"<?php echo ($uperm & PERMS_DELEGATE) ? ' checked="checked"' : '' ?> />
+ <input type="checkbox" id="u_delegate_<?php echo str_replace('@', '_', htmlspecialchars($user)) ?>" name="u_delegate[<?php echo htmlspecialchars($user) ?>]"<?php echo ($uperm & Kronolith::PERMS_DELEGATE) ? ' checked="checked"' : '' ?> />
<label for="u_delegate_<?php echo str_replace('@', '_', htmlspecialchars($user)) ?>" class="hidden"><?php echo _("Delegate") ?></label>
</td>
<td> </td>
<tr>
<td class="light"><?php echo htmlspecialchars($groups->getGroupName($group)) ?><input type="hidden" name="g_names[<?php echo htmlspecialchars($group) ?>]" value="<?php echo htmlspecialchars($group) ?>" /></td>
<td align="center">
- <input type="checkbox" id="g_show_<?php echo htmlspecialchars($group) ?>" name="g_show[<?php echo htmlspecialchars($group) ?>]"<?php echo ($gperm & PERMS_SHOW) ? ' checked="checked"' : '' ?> />
+ <input type="checkbox" id="g_show_<?php echo htmlspecialchars($group) ?>" name="g_show[<?php echo htmlspecialchars($group) ?>]"<?php echo ($gperm & Horde_Perms::SHOW) ? ' checked="checked"' : '' ?> />
<label for="g_show_<?php echo htmlspecialchars($group) ?>" class="hidden"><?php echo _("Show") ?></label>
</td>
<td align="center">
- <input type="checkbox" id="g_read_<?php echo htmlspecialchars($group) ?>" name="g_read[<?php echo htmlspecialchars($group) ?>]"<?php echo ($gperm & PERMS_READ) ? ' checked="checked"' : '' ?> />
+ <input type="checkbox" id="g_read_<?php echo htmlspecialchars($group) ?>" name="g_read[<?php echo htmlspecialchars($group) ?>]"<?php echo ($gperm & Horde_Perms::READ) ? ' checked="checked"' : '' ?> />
<label for="g_read_<?php echo htmlspecialchars($group) ?>" class="hidden"><?php echo _("Read") ?></label>
</td>
<td align="center">
- <input type="checkbox" id="g_edit_<?php echo htmlspecialchars($group) ?>" name="g_edit[<?php echo htmlspecialchars($group) ?>]"<?php echo ($gperm & PERMS_EDIT) ? ' checked="checked"' : '' ?> />
+ <input type="checkbox" id="g_edit_<?php echo htmlspecialchars($group) ?>" name="g_edit[<?php echo htmlspecialchars($group) ?>]"<?php echo ($gperm & Horde_Perms::EDIT) ? ' checked="checked"' : '' ?> />
<label for="g_edit_<?php echo htmlspecialchars($group) ?>" class="hidden"><?php echo _("Edit") ?></label>
</td>
<td align="center">
- <input type="checkbox" id="g_delete_<?php echo htmlspecialchars($group) ?>" name="g_delete[<?php echo htmlspecialchars($group) ?>]"<?php echo ($gperm & PERMS_DELETE) ? ' checked="checked"' : '' ?> />
+ <input type="checkbox" id="g_delete_<?php echo htmlspecialchars($group) ?>" name="g_delete[<?php echo htmlspecialchars($group) ?>]"<?php echo ($gperm & Horde_Perms::DELETE) ? ' checked="checked"' : '' ?> />
<label for="g_delete_<?php echo htmlspecialchars($group) ?>" class="hidden"><?php echo _("Delete") ?></label>
</td>
<td align="center">
- <input type="checkbox" id="g_delegate_<?php echo htmlspecialchars($group) ?>" name="g_delegate[<?php echo htmlspecialchars($group) ?>]"<?php echo ($gperm & PERMS_DELEGATE) ? ' checked="checked"' : '' ?> />
+ <input type="checkbox" id="g_delegate_<?php echo htmlspecialchars($group) ?>" name="g_delegate[<?php echo htmlspecialchars($group) ?>]"<?php echo ($gperm & Kronolith::PERMS_DELEGATE) ? ' checked="checked"' : '' ?> />
<label for="g_delegate_<?php echo htmlspecialchars($group) ?>" class="hidden"><?php echo _("Delegate") ?></label>
</td>
<td> </td>
<th class="control" width="1%"> </th>
<th class="nowrap <?php echo ($day->isToday() ? 'selected-control' : 'control') ?>" width="<?php echo $colwidth ?>%" colspan="<?php echo $day->_totalspan ?>">
<?php
-if (Kronolith::getDefaultCalendar(PERMS_EDIT) &&
+if (Kronolith::getDefaultCalendar(Horde_Perms::EDIT) &&
(!empty($conf['hooks']['permsdenied']) ||
Kronolith::hasPermission('max_events') === true ||
Kronolith::hasPermission('max_events') > Kronolith::countEvents())) {
}
// First try guest permissions.
-if (!$share->hasPermission('', PERMS_READ)) {
+if (!$share->hasPermission('', Horde_Perms::READ)) {
// Authenticate.
$auth = Horde_Auth::singleton($conf['auth']['driver']);
if (!isset($_SERVER['PHP_AUTH_USER']) ||
!$auth->authenticate($_SERVER['PHP_AUTH_USER'],
array('password' => isset($_SERVER['PHP_AUTH_PW']) ? $_SERVER['PHP_AUTH_PW'] : null)) ||
- !$share->hasPermission(Horde_Auth::getAuth(), PERMS_READ)) {
+ !$share->hasPermission(Horde_Auth::getAuth(), Horde_Perms::READ)) {
header('WWW-Authenticate: Basic realm="Nag iCalendar Interface"');
header('HTTP/1.0 401 Unauthorized');
echo '401 Unauthorized';
// This request is for a list of all users who have tasklists visible
// to the requesting user.
//
- $tasklists = Nag::listTasklists(false, PERMS_READ);
+ $tasklists = Nag::listTasklists(false, Horde_Perms::READ);
$owners = array();
foreach ($tasklists as $tasklist) {
$owners[$tasklist->get('owner')] = true;
// This request is for all tasklists owned by the requested user
//
$tasklists = $GLOBALS['nag_shares']->listShares($parts[0],
- PERMS_SHOW,
+ Horde_Perms::SHOW,
$parts[0]);
// The last check returns all addressbooks for the requested user,
$results[$retpath . '.ics']['icon'] = $registry->getImageDir() . '/mime/icalendar.png';
}
if (in_array('browseable', $properties)) {
- $results[$retpath]['browseable'] = $tasklist->hasPermission(Horde_Auth::getAuth(), PERMS_READ);
+ $results[$retpath]['browseable'] = $tasklist->hasPermission(Horde_Auth::getAuth(), Horde_Perms::READ);
$results[$retpath . '.ics']['browseable'] = false;
}
if (in_array('contenttype', $properties)) {
// This is a request for the entire tasklist in iCalendar format.
//
$tasklist = substr($parts[1], 0, -4);
- if (!array_key_exists($tasklist, Nag::listTasklists(false, PERMS_READ))) {
+ if (!array_key_exists($tasklist, Nag::listTasklists(false, Horde_Perms::READ))) {
return PEAR::raiseError(_("Invalid tasklist file requested."), 404);
}
$ical_data = $this->exportTasklist($tasklist, 'text/calendar');
// This request is browsing into a specific tasklist. Generate the list
// of items and represent them as files within the directory.
//
- if (!array_key_exists($parts[1], Nag::listTasklists(false, PERMS_READ))) {
+ if (!array_key_exists($parts[1], Nag::listTasklists(false, Horde_Perms::READ))) {
return PEAR::raiseError(_("Invalid tasklist requested."), 404);
}
$storage = Nag_Driver::singleton($parts[1]);
//
if (count($parts) == 3 &&
array_key_exists($parts[1], Nag::listTasklists(false,
- PERMS_READ))) {
+ Horde_Perms::READ))) {
//
// This request is for a specific item within a given task list.
//
return $result;
} elseif (count($parts) == 2 &&
substr($parts[1], -4) == '.ics' &&
- array_key_exists(substr($parts[1], 0, -4), Nag::listTasklists(false, PERMS_READ))) {
+ array_key_exists(substr($parts[1], 0, -4), Nag::listTasklists(false, Horde_Perms::READ))) {
} else {
//
// All other requests are a 404: Not Found
return PEAR::raiseError(_("Invalid tasklist name supplied."), 403);
}
- if (!array_key_exists($tasklist, Nag::listTasklists(false, PERMS_EDIT))) {
+ if (!array_key_exists($tasklist, Nag::listTasklists(false, Horde_Perms::EDIT))) {
// FIXME: Should we attempt to create a tasklist based on the filename
// in the case that the requested tasklist does not exist?
return PEAR::raiseError(_("Tasklist does not exist or no permission to edit"), 403);
return PEAR::raiseError(sprintf(_("Unsupported Content-Type: %s"), $content_type), 400);
}
- if (array_key_exists($tasklist, Nag::listTasklists(false, PERMS_DELETE))) {
+ if (array_key_exists($tasklist, Nag::listTasklists(false, Horde_Perms::DELETE))) {
foreach (array_keys($uids_remove) as $uid) {
$this->delete($uid);
}
}
if (!(count($parts) == 2 || count($parts) == 3) ||
- !array_key_exists($tasklistID, Nag::listTasklists(false, PERMS_DELETE))) {
+ !array_key_exists($tasklistID, Nag::listTasklists(false, Horde_Perms::DELETE))) {
return PEAR::raiseError(_("Tasklist does not exist or no permission to delete"), 403);
}
}
if ($tasklist === null) {
- $tasklist = Nag::getDefaultTasklist(PERMS_READ);
+ $tasklist = Nag::getDefaultTasklist(Horde_Perms::READ);
}
if (!array_key_exists($tasklist,
- Nag::listTasklists(false, PERMS_READ))) {
+ Nag::listTasklists(false, Horde_Perms::READ))) {
return PEAR::raiseError(_("Permission Denied"));
}
require_once dirname(__FILE__) . '/base.php';
if ($tasklist === null) {
- $tasklist = Nag::getDefaultTasklist(PERMS_READ);
+ $tasklist = Nag::getDefaultTasklist(Horde_Perms::READ);
}
if (!array_key_exists($tasklist,
- Nag::listTasklists(false, PERMS_READ))) {
+ Nag::listTasklists(false, Horde_Perms::READ))) {
return PEAR::raiseError(_("Permission Denied"));
}
require_once dirname(__FILE__) . '/base.php';
if ($tasklist === null) {
- $tasklist = Nag::getDefaultTasklist(PERMS_READ);
+ $tasklist = Nag::getDefaultTasklist(Horde_Perms::READ);
}
if (!array_key_exists($tasklist,
- Nag::listTasklists(false, PERMS_READ))) {
+ Nag::listTasklists(false, Horde_Perms::READ))) {
return PEAR::raiseError(_("Permission Denied"));
}
require_once dirname(__FILE__) . '/base.php';
if ($tasklist === null) {
- $tasklist = Nag::getDefaultTasklist(PERMS_EDIT);
+ $tasklist = Nag::getDefaultTasklist(Horde_Perms::EDIT);
}
- if (!array_key_exists($tasklist, Nag::listTasklists(false, PERMS_EDIT))) {
+ if (!array_key_exists($tasklist, Nag::listTasklists(false, Horde_Perms::EDIT))) {
return PEAR::raiseError(_("Permission Denied"));
}
require_once dirname(__FILE__) . '/base.php';
if ($tasklist === null) {
- $tasklist = Nag::getDefaultTasklist(PERMS_EDIT);
+ $tasklist = Nag::getDefaultTasklist(Horde_Perms::EDIT);
}
- if (!array_key_exists($tasklist, Nag::listTasklists(false, PERMS_EDIT))) {
+ if (!array_key_exists($tasklist, Nag::listTasklists(false, Horde_Perms::EDIT))) {
return PEAR::raiseError(_("Permission Denied"));
}
require_once dirname(__FILE__) . '/base.php';
if (!array_key_exists($tasklist_id,
- Nag::listTasklists(false, PERMS_EDIT))) {
+ Nag::listTasklists(false, Horde_Perms::EDIT))) {
return PEAR::raiseError(_("Permission Denied"));
}
}
if (!array_key_exists($task->tasklist,
- Nag::listTasklists(false, PERMS_READ))) {
+ Nag::listTasklists(false, Horde_Perms::READ))) {
return PEAR::raiseError(_("Permission Denied"));
}
require_once dirname(__FILE__) . '/base.php';
if (!array_key_exists($tasklist,
- Nag::listTasklists(false, PERMS_READ))) {
+ Nag::listTasklists(false, Horde_Perms::READ))) {
return PEAR::raiseError(_("Permission Denied"));
}
require_once dirname(__FILE__) . '/base.php';
if (!array_key_exists($tasklist,
- Nag::listTasklists(false, PERMS_READ))) {
+ Nag::listTasklists(false, Horde_Perms::READ))) {
return PEAR::raiseError(_("Permission Denied"));
}
if (!Horde_Auth::isAdmin() &&
!array_key_exists($task->tasklist,
- Nag::listTasklists(false, PERMS_DELETE))) {
+ Nag::listTasklists(false, Horde_Perms::DELETE))) {
return PEAR::raiseError(_("Permission Denied"));
}
if (!Horde_Auth::isAdmin() &&
!array_key_exists($tasklist,
- Nag::listTasklists(false, PERMS_DELETE))) {
+ Nag::listTasklists(false, Horde_Perms::DELETE))) {
return PEAR::raiseError(_("Permission Denied"));
}
}
$taskId = $existing->id;
- if (!array_key_exists($existing->tasklist, Nag::listTasklists(false, PERMS_EDIT))) {
+ if (!array_key_exists($existing->tasklist, Nag::listTasklists(false, Horde_Perms::EDIT))) {
return PEAR::raiseError(_("Permission Denied"));
}
if (!Horde_Auth::isAdmin() &&
!array_key_exists($tasklist,
- Nag::listTasklists(false, PERMS_EDIT))) {
+ Nag::listTasklists(false, Horde_Perms::EDIT))) {
return PEAR::raiseError(_("Permission Denied"));
}
require_once dirname(__FILE__) . '/base.php';
$categories = array();
- $tasklists = Nag::listTasklists(false, PERMS_SHOW | PERMS_READ);
+ $tasklists = Nag::listTasklists(false, Horde_Perms::SHOW | Horde_Perms::READ);
foreach ($tasklists as $tasklistId => $tasklist) {
$categories[$tasklistId] = $tasklist->get('name');
}
{
require_once dirname(__FILE__) . '/base.php';
- $allowed_tasklists = Nag::listTasklists(false, PERMS_READ);
+ $allowed_tasklists = Nag::listTasklists(false, Horde_Perms::READ);
foreach ($categories as $tasklist) {
if (!array_key_exists($tasklist, $allowed_tasklists)) {
return PEAR::raiseError(_("Permission Denied"));
continue;
}
if (empty($user)) {
- $users = $share->listUsers(PERMS_READ);
- $groups = $share->listGroups(PERMS_READ);
+ $users = $share->listUsers(Horde_Perms::READ);
+ $groups = $share->listGroups(Horde_Perms::READ);
foreach ($groups as $gid) {
$users = array_merge($users, $group->listUsers($gid));
}
null, null, null,
isset($this->_params['show_tasklists'])
? $this->_params['show_tasklists']
- : array_keys(Nag::listTasklists(false, PERMS_READ)),
+ : array_keys(Nag::listTasklists(false, Horde_Perms::READ)),
empty($this->_params['show_completed']) ? 0 : 1);
if (is_a($tasks, 'PEAR_Error')) {
return '<em>' . htmlspecialchars($tasks->getMessage()) . '</em>';
return $share;
}
- if (!$share->hasPermission(Horde_Auth::getAuth(), PERMS_DELETE)) {
+ if (!$share->hasPermission(Horde_Auth::getAuth(), Horde_Perms::DELETE)) {
$GLOBALS['notification']->push(sprintf(_("Access denied removing task from %s."), $share->get('name')), 'horde.error');
return false;
}
return $share;
}
- if (!$share->hasPermission(Horde_Auth::getAuth(), PERMS_EDIT)) {
+ if (!$share->hasPermission(Horde_Auth::getAuth(), Horde_Perms::EDIT)) {
$GLOBALS['notification']->push(sprintf(_("Access denied moving the task to %s."), $share->get('name')), 'horde.error');
}
parent::Horde_Form($vars, $title);
$this->delete = $delete;
- $tasklists = Nag::listTasklists(false, PERMS_EDIT);
+ $tasklists = Nag::listTasklists(false, Horde_Perms::EDIT);
$tasklist_enums = array();
foreach ($tasklists as $tl_id => $tl) {
$tasklist_enums[$tl_id] = $tl->get('name');
$users = array();
$share = &$GLOBALS['nag_shares']->getShare($tasklist);
if (!is_a($share, 'PEAR_Error')) {
- $users = $share->listUsers(PERMS_READ);
- $groups = $share->listGroups(PERMS_READ);
+ $users = $share->listUsers(Horde_Perms::READ);
+ $groups = $share->listGroups(Horde_Perms::READ);
if (count($groups)) {
require_once 'Horde/Group.php';
$horde_group = &Group::singleton();
return $count;
}
- $tasklists = Nag::listTasklists(true, PERMS_ALL);
+ $tasklists = Nag::listTasklists(true, Horde_Perms::ALL);
$count = 0;
foreach (array_keys($tasklists) as $tasklist) {
public static function createTasksFromText($text, $tasklist = null)
{
if ($tasklist === null) {
- $tasklist = Nag::getDefaultTasklist(PERMS_EDIT);
+ $tasklist = Nag::getDefaultTasklist(Horde_Perms::EDIT);
}
- if (!array_key_exists($tasklist, Nag::listTasklists(false, PERMS_EDIT))) {
+ if (!array_key_exists($tasklist, Nag::listTasklists(false, Horde_Perms::EDIT))) {
return PEAR::raiseError(_("Permission Denied"));
}
*
* @return array The task lists.
*/
- function listTasklists($owneronly = false, $permission = PERMS_SHOW)
+ function listTasklists($owneronly = false, $permission = Horde_Perms::SHOW)
{
$tasklists = $GLOBALS['nag_shares']->listShares(Horde_Auth::getAuth(), $permission, $owneronly ? Horde_Auth::getAuth() : null, 0, 0, 'name');
if (is_a($tasklists, 'PEAR_Error')) {
*
* @param array $in The data we want filtered.
* @param string $filter What type of data we are filtering.
- * @param integer $permission The PERMS_* constant we will filter on.
+ * @param integer $permission The Horde_Perms::* constant we will filter
+ * on.
*
* @return array The filtered data.
*/
- function permissionsFilter($in, $permission = PERMS_READ)
+ function permissionsFilter($in, $permission = Horde_Perms::READ)
{
// FIXME: Must find a way to check individual tasklists for
// permission. Can't specify attributes as it does not check for the
* Returns the default tasklist for the current user at the specified
* permissions level.
*/
- function getDefaultTasklist($permission = PERMS_SHOW)
+ function getDefaultTasklist($permission = Horde_Perms::SHOW)
{
global $prefs;
$GLOBALS['display_tasklists'] = array_keys($lists);
} else {
/* Make sure at least the default tasklist is visible. */
- $default_tasklist = Nag::getDefaultTasklist(PERMS_READ);
+ $default_tasklist = Nag::getDefaultTasklist(Horde_Perms::READ);
if ($default_tasklist) {
$GLOBALS['display_tasklists'] = array($default_tasklist);
}
$menu = new Horde_Menu();
$menu->add(Horde::applicationUrl('list.php'), _("_List Tasks"), 'nag.png', null, null, null, basename($_SERVER['PHP_SELF']) == 'index.php' ? 'current' : null);
- if (Nag::getDefaultTasklist(PERMS_EDIT) &&
+ if (Nag::getDefaultTasklist(Horde_Perms::EDIT) &&
(!empty($conf['hooks']['permsdenied']) ||
Nag::hasPermission('max_tasks') === true ||
Nag::hasPermission('max_tasks') > Nag::countTasks())) {
$owner = $share->get('owner');
$recipients[$owner] = Nag::_notificationPref($owner, 'owner');
- foreach ($share->listUsers(PERMS_READ) as $user) {
+ foreach ($share->listUsers(Horde_Perms::READ) as $user) {
if (empty($recipients[$user])) {
$recipients[$user] = Nag::_notificationPref($user, 'read', $task->tasklist);
}
}
- foreach ($share->listGroups(PERMS_READ) as $group) {
+ foreach ($share->listGroups(Horde_Perms::READ) as $group) {
$group = $groups->getGroupById($group);
if (is_a($group, 'PEAR_Error')) {
continue;
} else {
$share = $GLOBALS['nag_shares']->getShare($tasklist_id);
if (is_a($share, 'PEAR_Error') ||
- !$share->hasPermission(Horde_Auth::getAuth(), PERMS_DELETE)) {
+ !$share->hasPermission(Horde_Auth::getAuth(), Horde_Perms::DELETE)) {
$GLOBALS['notification']->push(
_("Access denied deleting task."), 'horde.error');
} else {
$vars->set('actionID', 'save_task');
if (!$vars->exists('tasklist_id')) {
- $vars->set('tasklist_id', Nag::getDefaultTasklist(PERMS_EDIT));
+ $vars->set('tasklist_id', Nag::getDefaultTasklist(Horde_Perms::EDIT));
}
$form = new Nag_TaskForm($vars, _("New Task"));
break;
$share = $GLOBALS['nag_shares']->getShare($tasklist_id);
if (is_a($share, 'PEAR_Error')) {
$notification->push(sprintf(_("Access denied editing task: %s"), $share->getMessage()), 'horde.error');
- } elseif (!$share->hasPermission(Horde_Auth::getAuth(), PERMS_EDIT)) {
+ } elseif (!$share->hasPermission(Horde_Auth::getAuth(), Horde_Perms::EDIT)) {
$notification->push(_("Access denied editing task."), 'horde.error');
} else {
$task = Nag::getTask($tasklist_id, $task_id);
$vars = new Horde_Variables($task->toHash());
$vars->set('actionID', 'save_task');
$vars->set('old_tasklist', $task->tasklist);
- $form = new Nag_TaskForm($vars, sprintf(_("Edit: %s"), $task->name), $share->hasPermission(Horde_Auth::getAuth(), PERMS_DELETE));
+ $form = new Nag_TaskForm($vars, sprintf(_("Edit: %s"), $task->name), $share->hasPermission(Horde_Auth::getAuth(), Horde_Perms::DELETE));
break;
}
}
$form->getInfo($vars, $info);
if ($prefs->isLocked('default_tasklist') ||
- count(Nag::listTasklists(false, PERMS_EDIT)) <= 1) {
- $info['tasklist_id'] = $info['old_tasklist'] = Nag::getDefaultTasklist(PERMS_EDIT);
+ count(Nag::listTasklists(false, Horde_Perms::EDIT)) <= 1) {
+ $info['tasklist_id'] = $info['old_tasklist'] = Nag::getDefaultTasklist(Horde_Perms::EDIT);
}
$share = $GLOBALS['nag_shares']->getShare($info['tasklist_id']);
if (is_a($share, 'PEAR_Error')) {
$notification->push(sprintf(_("Access denied saving task: %s"), $share->getMessage()), 'horde.error');
header('Location: ' . Horde::applicationUrl('list.php', true));
exit;
- } elseif (!$share->hasPermission(Horde_Auth::getAuth(), PERMS_EDIT)) {
+ } elseif (!$share->hasPermission(Horde_Auth::getAuth(), Horde_Perms::EDIT)) {
$notification->push(sprintf(_("Access denied saving task to %s."), $share->get('name')), 'horde.error');
header('Location: ' . Horde::applicationUrl('list.php', true));
exit;
if (isset($task_id)) {
$share = $GLOBALS['nag_shares']->getShare($tasklist_id);
$task = Nag::getTask($tasklist_id, $task_id);
- if (is_a($share, 'PEAR_Error') || !$share->hasPermission(Horde_Auth::getAuth(), PERMS_EDIT)) {
+ if (is_a($share, 'PEAR_Error') || !$share->hasPermission(Horde_Auth::getAuth(), Horde_Perms::EDIT)) {
$notification->push(sprintf(_("Access denied completing task %s."), $task->name), 'horde.error');
} else {
$task->completed = !$task->completed;
</select>
</p>
- <?php if (count($tasklists = Nag::listTasklists(false, PERMS_READ)) > 1): ?>
+ <?php if (count($tasklists = Nag::listTasklists(false, Horde_Perms::READ)) > 1): ?>
<p>
<?php echo Horde::label('exportList', _("Select the task list(s) to export from:")) ?><br />
<select id="exportList" name="exportList[]" multiple="multiple">
</select>
</p>
<?php else: ?>
- <input type="hidden" name="exportList[]" value="<?php echo htmlspecialchars(Nag::getDefaultTasklist(PERMS_READ)) ?>" />
+ <input type="hidden" name="exportList[]" value="<?php echo htmlspecialchars(Nag::getDefaultTasklist(Horde_Perms::READ)) ?>" />
<?php endif; ?>
<p>
</select>
</p>
-<?php if (!$prefs->isLocked('default_tasklist') && count($tasklists = Nag::listTasklists(false, PERMS_EDIT)) > 1): ?>
+<?php if (!$prefs->isLocked('default_tasklist') && count($tasklists = Nag::listTasklists(false, Horde_Perms::EDIT)) > 1): ?>
<p>
<?php echo Horde::label('tasklist_target', _("Which tasklist should the tasks be added to?")) ?><br />
<select id="tasklist_target" name="tasklist_target">
<?php
- $default = Nag::getDefaultTasklist(PERMS_EDIT);
+ $default = Nag::getDefaultTasklist(Horde_Perms::EDIT);
foreach ($tasklists as $id => $tasklist) {
$sel = ($id == $default) ? ' selected="selected"' : '';
printf('<option value="%s"%s>%s</option>',
</select>
</p>
<?php else: ?>
- <input type="hidden" name="tasklist_target" value="<?php echo htmlspecialchars(Nag::getDefaultTasklist(PERMS_EDIT)) ?>" />
+ <input type="hidden" name="tasklist_target" value="<?php echo htmlspecialchars(Nag::getDefaultTasklist(Horde_Perms::EDIT)) ?>" />
<?php endif; ?>
<p>
<?php echo Horde::label('import_file', _("Select the file to import:")) ?><br />
<td>
<?php
if (!is_a($share, 'PEAR_Error') &&
- $share->hasPermission(Horde_Auth::getAuth(), PERMS_EDIT)) {
+ $share->hasPermission(Horde_Auth::getAuth(), Horde_Perms::EDIT)) {
if (!$task->completed) {
if (!$task->childrenCompleted()) {
$label = _("Incomplete sub tasks, complete them first");
<td>
<?php
if (!is_a($share, 'PEAR_Error') &&
- $share->hasPermission(Horde_Auth::getAuth(), PERMS_EDIT) &&
+ $share->hasPermission(Horde_Auth::getAuth(), Horde_Perms::EDIT) &&
(!$task->private || $task->owner == Horde_Auth::getAuth())) {
$label = sprintf(_("Edit \"%s\""), $task->name);
echo Horde::link($task->edit_link, $label) . Horde::img('edit.png', $label, null, $registry->getImageDir('horde')) . '</a>';
? htmlspecialchars($task->name)
: _("[none]");
if (!is_a($share, 'PEAR_Error') &&
- $share->hasPermission(Horde_Auth::getAuth(), PERMS_READ)) {
+ $share->hasPermission(Horde_Auth::getAuth(), Horde_Perms::READ)) {
echo Horde::link($task->view_link, '', '', '', '', $task->desc)
. $task_name . '</a>';
} else {
<tr>
<td class="rightAlign" valign="top"><strong><?php echo _("Completed?") ?></strong></td>
<td>
- <?php if (!is_a($share, 'PEAR_Error') && $share->hasPermission(Horde_Auth::getAuth(), PERMS_EDIT)) {
+ <?php if (!is_a($share, 'PEAR_Error') && $share->hasPermission(Horde_Auth::getAuth(), Horde_Perms::EDIT)) {
if (empty($task->completed)) {
echo Horde::link(Horde::applicationUrl(Horde_Util::addParameter($taskurl, 'actionID', 'complete_task')), _("Complete Task"), 'widget') . Horde::img('unchecked.png', _("Complete Task")) . '</a>';
} else {
/* Check permissions on $tasklist_id. */
$share = $GLOBALS['nag_shares']->getShare($tasklist_id);
-if (is_a($share, 'PEAR_Error') || !$share->hasPermission(Horde_Auth::getAuth(), PERMS_READ)) {
+if (is_a($share, 'PEAR_Error') || !$share->hasPermission(Horde_Auth::getAuth(), Horde_Perms::READ)) {
$notification->push(_("You do not have permission to view this tasklist."), 'horde.error');
header('Location: ' . Horde::applicationUrl('list.php', true));
exit;
$share = $GLOBALS['nag_shares']->getShare($tasklist_id);
if (!is_a($share, 'PEAR_Error')) {
- if ($share->hasPermission(Horde_Auth::getAuth(), PERMS_EDIT)) {
+ if ($share->hasPermission(Horde_Auth::getAuth(), Horde_Perms::EDIT)) {
if (!$task->completed) {
$links[] = Horde::widget(Horde::applicationUrl(Horde_Util::addParameter($taskurl, 'actionID', 'complete_task')), _("Complete"), 'smallheader', '', '', _("_Complete"));
}
$links[] = Horde::widget(Horde::applicationUrl(Horde_Util::addParameter($taskurl, 'actionID', 'modify_task')), _("Edit"), 'smallheader', '', '', _("_Edit"));
}
}
- if ($share->hasPermission(Horde_Auth::getAuth(), PERMS_DELETE)) {
+ if ($share->hasPermission(Horde_Auth::getAuth(), Horde_Perms::DELETE)) {
$links[] = Horde::widget(Horde::applicationUrl(Horde_Util::addParameter($taskurl, 'actionID', 'delete_tasks')), _("Delete"), 'smallheader', '', $prefs->getValue('delete_opt') ? 'return window.confirm(\'' . addslashes(_("Really delete this task?")) . '\');' : '', _("_Delete"));
}
}
if ($form->validate()) {
$status_inserted = false;
- $allowed_cats = $news_cat->getAllowed(PERMS_DELETE);
+ $allowed_cats = $news_cat->getAllowed(Horde_Perms::DELETE);
$form->getInfo(null, $info);
// Check permissions
require_once dirname(__FILE__) . '/lib/base.php';
// redirect if not an admin
-$allowed_cats = $news_cat->getAllowed(PERMS_DELETE);
+$allowed_cats = $news_cat->getAllowed(Horde_Perms::DELETE);
if (empty($allowed_cats)) {
$notification->push(_("You have not editor permission on any category."));
header('Location: ' . Horde::applicationUrl('add.php'));
$form->getInfo(null, $info);
/* prepare query */
-$binds = $news->buildQuery(PERMS_DELETE, $info);
+$binds = $news->buildQuery(Horde_Perms::DELETE, $info);
$sql = 'SELECT n.id, n.sortorder, n.category1, n.category2, n.source, n.status, n.editor, n.publish, ' .
'n.user, n.comments, n.unpublish, n.picture, n.chars, n.view_count, n.attachments, l.title, n.selling '
. $binds[0];
$sql .= ' ORDER BY ' . $info['sort_by'] . ' ' . $info['sort_dir'];
// Count rows
-$count = $news->countNews($info, PERMS_DELETE);
+$count = $news->countNews($info, Horde_Perms::DELETE);
if ($count instanceof PEAR_Error) {
echo $count->getMessage() . ': ' . $count->getDebugInfo();
exit;
*
* @return array | PEAR_Error True on success, PEAR_Error on failure.
*/
- public function listNews($criteria = array(), $from = 0, $count = 0, $perms = PERMS_READ)
+ public function listNews($criteria = array(), $from = 0, $count = 0, $perms = Horde_Perms::READ)
{
require_once dirname(__FILE__) . '/base.php';
*
* @return integer | PEAR_Error True on success, PEAR_Error on failure.
*/
- public function countNews($criteria = array(), $perms = PERMS_READ)
+ public function countNews($criteria = array(), $perms = Horde_Perms::READ)
{
require_once dirname(__FILE__) . '/base.php';
*
* @return string The current language.
*/
- public function getAllowed($perm = PERMS_SHOW)
+ public function getAllowed($perm = Horde_Perms::SHOW)
{
$cats = $this->getCategories();
if (Horde_Auth::isAdmin('news:admin') ||
/**
* Build whare search
*/
- public function buildQuery($perms = PERMS_READ, $criteria = array())
+ public function buildQuery($perms = Horde_Perms::READ, $criteria = array())
{
static $parts;
. ' WHERE n.id = l.id AND l.lang = ?';
$params = array('_lang' => Horde_Nls::select());
- if ($perms == PERMS_READ) {
+ if ($perms == Horde_Perms::READ) {
$sql .= ' AND n.publish <= ? ';
$params['_perms'] = date('Y-m-d H:i:s');
$sql .= ' AND n.status = ? ';
*
* @return Nimber of news
*/
- public function countNews($criteria = array(), $perms = PERMS_READ)
+ public function countNews($criteria = array(), $perms = Horde_Perms::READ)
{
$binds = $this->buildQuery($perms, $criteria);
$binds[0] = 'SELECT COUNT(*) ' . $binds[0];
*
* @return array of news data
*/
- public function listNews($criteria = array(), $from = 0, $count = 0, $perms = PERMS_READ)
+ public function listNews($criteria = array(), $from = 0, $count = 0, $perms = Horde_Perms::READ)
{
$binds = $this->buildQuery($perms, $criteria);
News::LOCKED => _("Locked"));
$this->addVariable(_("Status"), 'status', 'enum', false, false, false, array($s, _("-- select --")));
- $allowed_cats = $GLOBALS['news_cat']->getAllowed(PERMS_DELETE);
+ $allowed_cats = $GLOBALS['news_cat']->getAllowed(Horde_Perms::DELETE);
$this->addVariable(_("Category"), 'category', 'enum', false, false, false, array($allowed_cats, _("-- select --")));
$sources = $GLOBALS['news']->getSources();
return unserialize($images);
}
- $images = $GLOBALS['registry']->call('images/listImages', array('ansel', $id, PERMS_SHOW, 'thumb'));
+ $images = $GLOBALS['registry']->call('images/listImages', array('ansel', $id, Horde_Perms::SHOW, 'thumb'));
$GLOBALS['cache']->set("news_gallery_$id", serialize($images));
return $images;
News::LOCKED => _("Locked"));
$this->addVariable(_("Status"), 'status', 'enum', false, false, false, array($s, _("-- select --")));
- $allowed_cats = $GLOBALS['news_cat']->getAllowed(PERMS_DELETE);
+ $allowed_cats = $GLOBALS['news_cat']->getAllowed(Horde_Perms::DELETE);
$this->addVariable(_("Category"), 'category', 'enum', false, false, false, array($allowed_cats, _("-- select --")));
$sources = $GLOBALS['news']->getSources();
require_once SKOLI_BASE . '/lib/Forms/Entry.php';
/* Redirect to create a new class if we don't have access to any class */
-if (count(Skoli::listClasses(false, PERMS_EDIT)) == 0 && Horde_Auth::getAuth()) {
+if (count(Skoli::listClasses(false, Horde_Perms::EDIT)) == 0 && Horde_Auth::getAuth()) {
$notification->push(_("Please create a new Class first."), 'horde.message');
header('Location: ' . Horde::applicationUrl('classes/create.php', true));
exit;
$notification->push($class, 'horde.error');
header('Location: ' . Horde::applicationUrl('classes/', true));
exit;
-} elseif (!$class->hasPermission(Horde_Auth::getAuth(), PERMS_DELETE)) {
+} elseif (!$class->hasPermission(Horde_Auth::getAuth(), Horde_Perms::DELETE)) {
$notification->push(_("You are not allowed to delete this class."), 'horde.error');
header('Location: ' . Horde::applicationUrl('classes/', true));
exit;
$notification->push($class, 'horde.error');
header('Location: ' . Horde::applicationUrl('classes/', true));
exit;
-} elseif (!$class->hasPermission(Horde_Auth::getAuth(), PERMS_EDIT)) {
+} elseif (!$class->hasPermission(Horde_Auth::getAuth(), Horde_Perms::EDIT)) {
$notification->push(_("You are not allowed to change this class."), 'horde.error');
header('Location: ' . Horde::applicationUrl('classes/', true));
exit;
$share = $GLOBALS['skoli_shares']->getShare($entry['class_id']);
// Check permissions
-if (!$share->hasPermission(Horde_Auth::getAuth(), PERMS_READ)) {
+if (!$share->hasPermission(Horde_Auth::getAuth(), Horde_Perms::READ)) {
$notification->push(_("You are not allowed to view this entry."), 'horde.error');
header('Location: ' . Horde_Util::addParameter(Horde::applicationUrl('search.php', true), 'actionID', 'search'));
exit;
$url = Horde_Util::addParameter(Horde::applicationUrl('entry.php'), 'entry', $entry['object_id']);
$tabs = new Horde_Ui_Tabs('view', $vars);
$tabs->addTab(_("View"), $url, array('tabname' => 'Entry', 'id' => 'tabEntry'));
-if ($share->hasPermission(Horde_Auth::getAuth(), PERMS_EDIT)) {
+if ($share->hasPermission(Horde_Auth::getAuth(), Horde_Perms::EDIT)) {
$tabs->addTab(_("Edit"), $url, array('tabname' => 'EditEntry', 'id' => 'tabEditEntry'));
}
-if ($share->hasPermission(Horde_Auth::getAuth(), PERMS_DELETE)) {
+if ($share->hasPermission(Horde_Auth::getAuth(), Horde_Perms::DELETE)) {
$tabs->addTab(_("Delete"), $url, array('tabname' => 'DeleteEntry', 'id' => 'tabDeleteEntry'));
}
$add = Horde::applicationUrl('add.php');
$icondir = $registry->getImageDir();
- $classes = Skoli::listClasses(false, PERMS_EDIT);
+ $classes = Skoli::listClasses(false, Horde_Perms::EDIT);
if (count($classes) > 0) {
$tree->addNode($parent . '__new',
$this->addHidden('', 'view', 'text', true);
}
- $classes = Skoli::listClasses(false, PERMS_EDIT);
+ $classes = Skoli::listClasses(false, Horde_Perms::EDIT);
$classes_enums = array();
foreach ($classes as $class) {
- if ($class->hasPermission(Horde_Auth::getAuth(), PERMS_EDIT)) {
+ if ($class->hasPermission(Horde_Auth::getAuth(), Horde_Perms::EDIT)) {
$classes_enums[$class->getName()] = $class->get('name');
}
}
*
* @return array The class list.
*/
- function listClasses($owneronly = false, $permission = PERMS_SHOW)
+ function listClasses($owneronly = false, $permission = Horde_Perms::SHOW)
{
global $registry;
$share = $GLOBALS['skoli_shares']->getShare($class);
/* Check permissions */
- if (!$share->hasPermission(Horde_Auth::getAuth(), PERMS_READ) || !isset($addressbooks[$share->get('address_book')])) {
+ if (!$share->hasPermission(Horde_Auth::getAuth(), Horde_Perms::READ) || !isset($addressbooks[$share->get('address_book')])) {
continue;
}
$list[$i] = $share->datatreeObject->data;
$list[$i]['_id'] = $class;
- $list[$i]['_edit'] = $share->hasPermission(Horde_Auth::getAuth(), PERMS_EDIT);
+ $list[$i]['_edit'] = $share->hasPermission(Horde_Auth::getAuth(), Horde_Perms::EDIT);
/* Add all students to the list */
$driver = &Skoli_Driver::singleton($class);
$addressbooks = $registry->call('contacts/sources');
foreach ($classes as $class_id=>$share) {
/* Check permissions */
- if (!$share->hasPermission(Horde_Auth::getAuth(), PERMS_READ) || !isset($addressbooks[$share->get('address_book')])) {
+ if (!$share->hasPermission(Horde_Auth::getAuth(), Horde_Perms::READ) || !isset($addressbooks[$share->get('address_book')])) {
continue;
}
- $share_permissions_edit = $share->hasPermission(Horde_Auth::getAuth(), PERMS_EDIT);
- $share_permissions_delete = $share->hasPermission(Horde_Auth::getAuth(), PERMS_DELETE);
+ $share_permissions_edit = $share->hasPermission(Horde_Auth::getAuth(), Horde_Perms::EDIT);
+ $share_permissions_delete = $share->hasPermission(Horde_Auth::getAuth(), Horde_Perms::DELETE);
$driver = &Skoli_Driver::singleton($class_id);
$entries = $driver->getEntries($studentid, $type, $searchparams);
$menu = new Horde_Menu(Horde_Menu::MASK_ALL);
$menu->add(Horde::applicationUrl('list.php'), _("List Classes"), 'skoli.png', null, null, null, basename($_SERVER['PHP_SELF']) == 'index.php' ? 'current' : null);
- if (count(Skoli::listClasses(false, PERMS_EDIT))) {
+ if (count(Skoli::listClasses(false, Horde_Perms::EDIT))) {
$menu->add(Horde::applicationUrl('add.php'), _("_New Entry"), 'add.png', null, null, null, Horde_Util::getFormData('entry') ? '__noselection' : null);
}
/* Timetable.
* Show this item only if an application provides 'calendar/show' and we have permissions to view it.
$app = $registry->hasMethod('calendar/show');
- if ($app !== false && $registry->get('status', $app) != 'inactive' && $registry->hasPermission($app, PERMS_EDIT)) {
+ if ($app !== false && $registry->get('status', $app) != 'inactive' && $registry->hasPermission($app, Horde_Perms::EDIT)) {
$menu->add(Horde::applicationUrl(Horde_Util::addParameter('timetable.php', 'actionID', 'new_timetable')), _("_New Timetable"), 'timetable.png');
}
*/
/* Check if we have access to an application who provides contacts/getContact */
$app = $registry->hasMethod('contacts/getContact');
-if ($app == false || $registry->get('status', $app) == 'inactive' || !$registry->hasPermission($app, PERMS_SHOW)) {
+if ($app == false || $registry->get('status', $app) == 'inactive' || !$registry->hasPermission($app, Horde_Perms::SHOW)) {
$notification->push(_("Skoli needs an applications who provides contacts (e.g. turba)."), 'horde.warning');
}
$tabs = new Horde_Ui_Tabs('view', $vars);
$tabs->addTab(_("_View"), $url,
array('tabname' => 'Contact', 'id' => 'tabContact', 'onclick' => 'return ShowTab(\'Contact\');'));
-if ($contact->hasPermission(PERMS_EDIT)) {
+if ($contact->hasPermission(Horde_Perms::EDIT)) {
$tabs->addTab(_("_Edit"), $url,
array('tabname' => 'EditContact', 'id' => 'tabEditContact', 'onclick' => 'return ShowTab(\'EditContact\');'));
}
-if ($contact->hasPermission(PERMS_DELETE)) {
+if ($contact->hasPermission(Horde_Perms::DELETE)) {
$tabs->addTab(_("De_lete"), $url,
array('tabname' => 'DeleteContact', 'id' => 'tabDeleteContact', 'onclick' => 'return ShowTab(\'DeleteContact\');'));
}
$unique_dest = '';
$dest_options = array();
$hasWriteable = false;
- foreach (Turba::getAddressBooks(PERMS_EDIT) as $key => $entry) {
+ foreach (Turba::getAddressBooks(Horde_Perms::EDIT) as $key => $entry) {
$selected = ($key == $default_source) ? ' selected="selected"' : '';
$dest_options[] = '<option value="' . htmlspecialchars($key) . '" ' . $selected . '>' .
htmlspecialchars($entry['title']) . "</option>\n";
}
/* Check permissions on this contact. */
-if (!$contact->hasPermission(PERMS_EDIT)) {
- if (!$contact->hasPermission(PERMS_READ)) {
+if (!$contact->hasPermission(Horde_Perms::EDIT)) {
+ if (!$contact->hasPermission(Horde_Perms::READ)) {
$notification->push(_("You do not have permission to view this contact."), 'horde.error');
header('Location: ' . Horde::applicationUrl($prefs->getValue('initial_page'), true));
exit;
{
require_once dirname(__FILE__) . '/base.php';
- $addressbooks = Turba::getAddressBooks($writeable ? PERMS_EDIT : PERMS_READ);
+ $addressbooks = Turba::getAddressBooks($writeable ? Horde_Perms::EDIT : Horde_Perms::READ);
foreach ($addressbooks as $addressbook => $config) {
$addressbooks[$addressbook] = $config['title'];
}
return array();
}
$addressbooks = $GLOBALS['turba_shares']->listShares($parts[0],
- PERMS_READ,
+ Horde_Perms::READ,
$parts[0]);
// The last check returns all addressbooks for the requested user,
// but that does not mean the requesting user has access to them.
/* On new installations default_dir is not set, use first source
* instead. */
if (empty($import_source)) {
- $import_source = key(Turba::getAddressBooks(PERMS_EDIT));
+ $import_source = key(Turba::getAddressBooks(Horde_Perms::EDIT));
}
}
return PEAR::raiseError(sprintf(_("Connection failed: %s"), $driver->getMessage()), 'horde.error', null, null, $import_source);
}
- if (!$driver->hasPermission(PERMS_EDIT)) {
+ if (!$driver->hasPermission(Horde_Perms::EDIT)) {
return PEAR::raiseError(_("Permission denied"), 'horde.error', null, null, $import_source);
}
return PEAR::raiseError(sprintf(_("Connection failed: %s"), $driver->getMessage()), 'horde.error', null, null, $source);
}
- if (!$driver->hasPermission(PERMS_READ)) {
+ if (!$driver->hasPermission(Horde_Perms::READ)) {
continue;
}
return PEAR::raiseError(sprintf(_("Connection failed: %s"), $driver->getMessage()));
}
- if (!$driver->hasPermission(PERMS_READ)) {
+ if (!$driver->hasPermission(Horde_Perms::READ)) {
return PEAR::raiseError(_("You don't have sufficient permissions to read the address book that contains your own contact."));
}
return PEAR::raiseError(sprintf(_("Connection failed: %s"), $driver->getMessage()), 'horde.error', null, null, $source);
}
- if (!Horde_Auth::isAdmin() && !$driver->hasPermission(PERMS_DELETE)) {
+ if (!Horde_Auth::isAdmin() && !$driver->hasPermission(Horde_Perms::DELETE)) {
continue;
}
if (is_a($driver, 'PEAR_Error')) {
return PEAR::raiseError(sprintf(_("Connection failed: %s"), $driver->getMessage()), 'horde.error', null, null, $source);
}
- if (!$driver->hasPermission(PERMS_EDIT)) {
+ if (!$driver->hasPermission(Horde_Perms::EDIT)) {
continue;
}
$result = $driver->search(array('__uid' => $uid));
return PEAR::raiseError(sprintf(_("Connection failed: %s"), $driver->getMessage()), 'horde.error', null, null, $source);
}
- if (!$driver->hasPermission(PERMS_EDIT)) {
+ if (!$driver->hasPermission(Horde_Perms::EDIT)) {
return PEAR::raiseError(_("Permission denied"), 'horde.error', null, null, $source);
}
if (is_a($driver, 'PEAR_Error')) {
continue;
}
- if (!$driver->hasPermission(PERMS_EDIT)) {
+ if (!$driver->hasPermission(Horde_Perms::EDIT)) {
continue;
}
/* Only attempt share removal if we have shares configured */
if (!empty($_SESSION['turba']['has_share'])) {
$shares = &$GLOBALS['turba_shares']->listShares(
- $user, PERMS_EDIT, $user);
+ $user, Horde_Perms::EDIT, $user);
/* Look for the deleted user's default share and remove it */
foreach ($shares as $share) {
return $object;
}
- if (!$object->hasPermission(PERMS_DELETE)) {
+ if (!$object->hasPermission(Horde_Perms::DELETE)) {
return PEAR::raiseError(_("Permission denied"));
}
function hasPermission($perm)
{
switch ($perm) {
- case PERMS_EDIT: return false;
- case PERMS_DELETE: return false;
+ case Horde_Perms::EDIT: return false;
+ case Horde_Perms::DELETE: return false;
default: return true;
}
}
function hasPermission($perm)
{
switch ($perm) {
- case PERMS_EDIT: return false;
- case PERMS_DELETE: return false;
+ case Horde_Perms::EDIT: return false;
+ case Horde_Perms::DELETE: return false;
default: return true;
}
}
function hasPermission($perm)
{
switch ($perm) {
- case PERMS_EDIT:
- case PERMS_DELETE:
+ case Horde_Perms::EDIT:
+ case Horde_Perms::DELETE:
return false;
default:
{
$hPerms = 0;
if (strpos($acl, 'w') !== false) {
- $hPerms |= PERMS_EDIT;
+ $hPerms |= Horde_Perms::EDIT;
}
if (strpos($acl, 'r') !== false) {
- $hPerms |= PERMS_READ;
+ $hPerms |= Horde_Perms::READ;
}
if (strpos($acl, 'd') !== false) {
- $hPerms |= PERMS_DELETE;
+ $hPerms |= Horde_Perms::DELETE;
}
if (strpos($acl, 'l') !== false) {
- $hPerms |= PERMS_SHOW;
+ $hPerms |= Horde_Perms::SHOW;
}
return $hPerms;
}
$hasEdit = false;
$hasExport = false;
if (!is_a($driver, 'PEAR_Error')) {
- if ($driver->hasPermission(PERMS_DELETE)) {
+ if ($driver->hasPermission(Horde_Perms::DELETE)) {
$hasDelete = true;
}
- if ($driver->hasPermission(PERMS_EDIT)) {
+ if ($driver->hasPermission(Horde_Perms::EDIT)) {
$hasEdit = true;
}
if ($GLOBALS['conf']['menu']['import_export']
*/
function isEditable()
{
- return $this->driver->hasPermission(PERMS_EDIT);
+ return $this->driver->hasPermission(Horde_Perms::EDIT);
}
/**
* Get all the address books the user has the requested permissions to and
* return them in the user's preferred order.
*
- * @param integer $permission The PERMS_* constant to filter on.
+ * @param integer $permission The Horde_Perms::* constant to filter on.
* @param array $options Any additional options.
*
* @return array The filtered, ordered $cfgSources entries.
*/
- function getAddressBooks($permission = PERMS_READ, $options = array())
+ function getAddressBooks($permission = Horde_Perms::READ, $options = array())
{
$addressbooks = array();
foreach (array_keys(Turba::getAddressBookOrder()) as $addressbook) {
*
* @param array $in The data we want filtered.
* @param string $filter What type of data we are filtering.
- * @param integer $permission The PERMS_* constant we will filter on.
+ * @param integer $permission The Horde_Perms::* constant we will filter
+ * on.
* @param array $options Additional options.
*
* @return array The filtered data.
*/
- function permissionsFilter($in, $permission = PERMS_READ, $options = array())
+ function permissionsFilter($in, $permission = Horde_Perms::READ, $options = array())
{
$out = array();
*
* @return array Shares the user has the requested permissions to.
*/
- function listShares($owneronly = false, $permission = PERMS_READ)
+ function listShares($owneronly = false, $permission = Horde_Perms::READ)
{
if (empty($_SESSION['turba']['has_share'])) {
// No backends are configured to provide shares
{
global $conf, $prefs, $registry;
- if (!$this->contact || is_a($this->contact, 'PEAR_Error') || !$this->contact->hasPermission(PERMS_READ)) {
+ if (!$this->contact || is_a($this->contact, 'PEAR_Error') || !$this->contact->hasPermission(Horde_Perms::READ)) {
echo '<h3>' . _("The requested contact was not found.") . '</h3>';
return;
}
echo '</div>';
if ($active && $GLOBALS['browser']->hasFeature('dom')) {
- if ($this->contact->hasPermission(PERMS_EDIT)) {
+ if ($this->contact->hasPermission(Horde_Perms::EDIT)) {
$edit = new Turba_View_EditContact($this->contact);
$edit->html(false);
}
- if ($this->contact->hasPermission(PERMS_DELETE)) {
+ if ($this->contact->hasPermission(Horde_Perms::DELETE)) {
$delete = new Turba_View_DeleteContact($this->contact);
$delete->html(false);
}
return;
}
- if (!$this->contact->hasPermission(PERMS_DELETE)) {
- if (!$this->contact->hasPermission(PERMS_READ)) {
+ if (!$this->contact->hasPermission(Horde_Perms::DELETE)) {
+ if (!$this->contact->hasPermission(Horde_Perms::READ)) {
echo '<h3>' . _("You do not have permission to view this contact.") . '</h3>';
return;
} else {
</div>
<?php
if ($active && $GLOBALS['browser']->hasFeature('dom')) {
- if ($this->contact->hasPermission(PERMS_READ)) {
+ if ($this->contact->hasPermission(Horde_Perms::READ)) {
$view = new Turba_View_Contact($this->contact);
$view->html(false);
}
- if ($this->contact->hasPermission(PERMS_EDIT)) {
+ if ($this->contact->hasPermission(Horde_Perms::EDIT)) {
$delete = new Turba_View_EditContact($this->contact);
$delete->html(false);
}
return;
}
- if (!$this->contact->hasPermission(PERMS_EDIT)) {
- if (!$this->contact->hasPermission(PERMS_READ)) {
+ if (!$this->contact->hasPermission(Horde_Perms::EDIT)) {
+ if (!$this->contact->hasPermission(Horde_Perms::READ)) {
echo '<h3>' . _("You do not have permission to view this contact.") . '</h3>';
return;
} else {
echo '</div>';
if ($active && $GLOBALS['browser']->hasFeature('dom')) {
- if ($this->contact->hasPermission(PERMS_READ)) {
+ if ($this->contact->hasPermission(Horde_Perms::READ)) {
$view = new Turba_View_Contact($this->contact);
$view->html(false);
}
- if ($this->contact->hasPermission(PERMS_DELETE)) {
+ if ($this->contact->hasPermission(Horde_Perms::DELETE)) {
$delete = new Turba_View_DeleteContact($this->contact);
$delete->html(false);
}
// Only set $add_source_options if there is at least one editable address book
// that is not the current address book.
-$addSources = Turba::getAddressBooks(PERMS_EDIT, array('require_add' => true));
+$addSources = Turba::getAddressBooks(Horde_Perms::EDIT, array('require_add' => true));
$copymove_source_options = '';
$copymoveSources = $addSources;
unset($copymoveSources[$default_source]);
}
$share->set('owner', $owner);
$share->set('name', $title);
-$share->set('perm_default', PERMS_SHOW | PERMS_READ);
+$share->set('perm_default', Horde_Perms::SHOW | Horde_Perms::READ);
$result = $turba_shares->addShare($share);
if (is_a($result, 'PEAR_Error')) {
var_dump($result);
. '</a>';
$cell = Horde::link($ob->url()) . $link_text . '</a>';
- if ($ob->hasPermission(PERMS_EDIT)) {
+ if ($ob->hasPermission(Horde_Perms::EDIT)) {
$edit_url = Horde_Util::addParameter(
'contact.php',
array('view' => 'EditContact',
}
/* Check permissions on this contact. */
-if (!$object->hasPermission(PERMS_READ)) {
+if (!$object->hasPermission(Horde_Perms::READ)) {
$notification->push(_("You do not have permission to view this object."), 'horde.error');
header('Location: ' . Horde::applicationUrl($prefs->getValue('initial_page'), true));
exit;
}
/* Check permissions. */
-if (!$object->hasPermission(PERMS_READ)) {
+if (!$object->hasPermission(Horde_Perms::READ)) {
throw new Horde_Exception(_("You do not have permission to view this contact."));
}
}
if ($permmask === null) {
- $permmask = PERMS_SHOW|PERMS_READ;
+ $permmask = Horde_Perms::SHOW|Horde_Perms::READ;
}
# Default deny all permissions