/* Check post permissions. */
if (!$messages->hasPermission(Horde_Perms::EDIT)) {
- $message = sprintf(_("You don't have permission to post messages in forum %s."), $params['forum_id']);
- if (!empty($GLOBALS['conf']['hooks']['permsdenied'])) {
- $message = Horde::callHook('perms_denied', array('agora'), 'horde', $message);
+ try {
+ return Horde::callHook('perms_denied', array('agora'));
+ } catch (Horde_Exception_HookNotSet $e) {
+ return sprintf(_("You don't have permission to post messages in forum %s."), $params['forum_id']);
}
- return $message;
}
if (isset($params['message_id'])) {
/* Display an edit-dialogue if the thread is not locked and we can edit messages in them. */
if (!$messages->hasPermission(Horde_Perms::EDIT)) {
- $message = sprintf(_("You don't have permission to post messages in forum %s."), $forum['forum_name']);
- if (!empty($conf['hooks']['permsdenied'])) {
- $message = Horde::callHook('perms_denied', array('agora'), 'horde', $message);
+ try {
+ $message = Horde::callHook('perms_denied', array('agora'), 'horde');
+ } catch (Horde_Exception_HookNotset $e) {
+ $message = sprintf(_("You don't have permission to post messages in forum %s."), $forum['forum_name']);
}
$view->form = $message;
} elseif ($message['locked']) {
libpuzzle pecl extension to use this feature." >7</configstring>
</configsection>
</configtab>
-
- <configtab name="hooks" desc="Custom Hooks">
- <configsection name="hooks">
- <configboolean name="postupload" required="false" desc="Should we use a
- custom post upload hook? If so, make sure you define _ansel_hook_postupload()
- in hooks.php. The hook will be called after the user successfully uploads
- a set of images and can be used for things like sending notifications to
- external websites/APIs.">false</configboolean>
- </configsection>
- </configtab>
</configuration>
$image_id = $gallery->addImage($image_data, !empty($params['default']));
/* Call the postupload hook if needed */
- if (!empty($GLOBALS['conf']['hooks']['postupload']) && empty($params['skiphook'])) {
- try {
- Horde::callHook('postupload', array($image_id));
- } catch (Horde_Exception_HookNotSet $e) {}
+ if (empty($params['skiphook'])) {
+ $this->postBatchUpload($image_id);
}
return array('image_id' => (int)$image_id,
*/
public function postBatchUpload($image_ids)
{
- if (!empty($conf['hooks']['postupload'])) {
- return Horde::callHook('_ansel_hook_postupload', array($image_ids), 'ansel');
- }
+ try {
+ Horde::callHook('postupload', array($image_ids), 'ansel');
+ } catch (Horde_Exception_HookNotSet $e) {}
}
/**
$comments_reason = sprintf(_("You are on %s blacklist."), $user);
}
} else {
- $comments_reason = _("Only authenticated users can post comments.");
- if ($conf['hooks']['permsdenied']) {
+ try {
$comments_reason = Horde::callHook('perms_denied', array('folks'));
+ } catch (Horde_Exception_HookNotSet $e) {
+ $comments_reason = _("Only authenticated users can post comments.");
}
}
break;
$rows = $layout->rows();
$max_blocks = $GLOBALS['injector']->getInstance('Horde_Perms')->hasAppPermission('max_blocks');
list($current_row, $current_col) = $layout->getCurrentBlock();
-$allow_add = !empty($conf['hooks']['permsdenied']) ||
- ($max_blocks === true) ||
- ($max_blocks > $layout->count());
+$allow_add = ($max_blocks === true) || ($max_blocks > $layout->count());
$columns = 0;
for ($row = 0; $row < $rows; ++$row):
?>
$a_template->set('go', _("Go"));
}
-$a_template->set('create_folder', !empty($conf['hooks']['permsdenied']) || ($injector->getInstance('Horde_Perms')->hasAppPermission('create_folders') && $injector->getInstance('Horde_Perms')->hasAppPermission('max_folders')));
+$a_template->set('create_folder', $injector->getInstance('Horde_Perms')->hasAppPermission('create_folders') && $injector->getInstance('Horde_Perms')->hasAppPermission('max_folders'));
if ($prefs->getValue('subscribe')) {
$a_template->set('subscribe', true);
$subToggleText = ($showAll) ? _("Hide Unsubscribed") : _("Show Unsubscribed");
/* New folder entry. */
if ($this->getOption('new_folder') &&
- (!empty($conf['hooks']['permsdenied']) ||
- ($injector->getInstance('Horde_Perms')->hasAppPermission('create_folders') &&
- $injector->getInstance('Horde_Perms')->hasAppPermission('max_folders')))) {
+ ($injector->getInstance('Horde_Perms')->hasAppPermission('create_folders') &&
+ $injector->getInstance('Horde_Perms')->hasAppPermission('max_folders'))) {
$t->set('new_mbox', true);
}
/* Create copy link. */
if (!is_null($copyurl) &&
- (!empty($conf['hooks']['permsdenied']) ||
- $perms->hasAppPermission('max_rules') === true ||
+ ($perms->hasAppPermission('max_rules') === true ||
$perms->hasAppPermission('max_rules') > count($filter_list))) {
$entry['copylink'] = Horde::link($copyurl, sprintf(_("Copy %s"), $name));
$entry['copyimg'] = Horde::img('copy.png', sprintf(_("Copy %s"), $name));
$actions = $ingo_script->availableActions();
$createrule = (!empty($actions) &&
- (!empty($conf['hooks']['permsdenied']) ||
- ($perms->hasAppPermission('allow_rules') &&
- ($perms->hasAppPermission('max_rules') === true ||
- $perms->hasAppPermission('max_rules') > count($filter_list)))));
+ ($perms->hasAppPermission('allow_rules') &&
+ ($perms->hasAppPermission('max_rules') === true ||
+ $perms->hasAppPermission('max_rules') > count($filter_list))));
$canapply = $ingo_script->canApply();
require INGO_TEMPLATES . '/filters/footer.inc';
if ($on_demand && $edit_allowed) {
$menu->add(Horde::url($prefs->getValue('defaultview') . '.php'), _("_Today"), 'today.png', null, null, null, '__noselection');
if (Kronolith::getDefaultCalendar(Horde_Perms::EDIT) &&
- (!empty($conf['hooks']['permsdenied']) ||
- $injector->getInstance('Horde_Perms')->hasAppPermission('max_events') === true ||
+ ($injector->getInstance('Horde_Perms')->hasAppPermission('max_events') === true ||
$injector->getInstance('Horde_Perms')->hasAppPermission('max_events') > self::countEvents())) {
$menu->add(Horde::url('new.php')->add('url', Horde::selfUrl(true, false, true)), _("_New Event"), 'new.png');
}
$started = false;
$first_row = true;
$addLinks = Kronolith::getDefaultCalendar(Horde_Perms::EDIT) &&
- (!empty($GLOBALS['conf']['hooks']['permsdenied']) ||
- $GLOBALS['injector']->getInstance('Horde_Perms')->hasAppPermission('max_events') === true ||
+ ($GLOBALS['injector']->getInstance('Horde_Perms')->hasAppPermission('max_events') === true ||
$GLOBALS['injector']->getInstance('Horde_Perms')->hasAppPermission('max_events') > Kronolith::countEvents());
$showLocation = Kronolith::viewShowLocation();
$showTime = Kronolith::viewShowTime();
$buttons = array();
if (!$this->event->hasPermission(Horde_Perms::EDIT) &&
- (!empty($GLOBALS['conf']['hooks']['permsdenied']) ||
- $GLOBALS['injector']->getInstance('Horde_Perms')->hasAppPermission('max_events') === true ||
+ ($GLOBALS['injector']->getInstance('Horde_Perms')->hasAppPermission('max_events') === true ||
$GLOBALS['injector']->getInstance('Horde_Perms')->hasAppPermission('max_events') > Kronolith::countEvents())) {
$buttons[] = '<input type="submit" class="button" name="saveAsNew" value="' . _("Save As New") . '" />';
} else {
}
if ($this->event->initialized) {
if (!$this->event->recurs() &&
- (!empty($conf['hooks']['permsdenied']) ||
- $GLOBALS['injector']->getInstance('Horde_Perms')->hasAppPermission('max_events') === true ||
+ ($GLOBALS['injector']->getInstance('Horde_Perms')->hasAppPermission('max_events') === true ||
$GLOBALS['injector']->getInstance('Horde_Perms')->hasAppPermission('max_events') > Kronolith::countEvents())) {
$buttons[] = '<input type="submit" class="button" name="saveAsNew" value="' . _("Save As New") . '" />';
}
$sidebyside = $prefs->getValue('show_shared_side_by_side');
$twentyFour = $prefs->getValue('twentyFour');
$addLinks = Kronolith::getDefaultCalendar(Horde_Perms::EDIT) &&
- (!empty($GLOBALS['conf']['hooks']['permsdenied']) ||
- $GLOBALS['injector']->getInstance('Horde_Perms')->hasAppPermission('max_events') === true ||
+ ($GLOBALS['injector']->getInstance('Horde_Perms')->hasAppPermission('max_events') === true ||
$GLOBALS['injector']->getInstance('Horde_Perms')->hasAppPermission('max_events') > Kronolith::countEvents());
if ($sidebyside) {
<table class="striped" cellspacing="0">
<?php if ($event->recurs() &&
- (!empty($conf['hooks']['permsdenied']) ||
- $GLOBALS['injector']->getInstance('Horde_Perms')->hasAppPermission('max_events') === true ||
+ ($GLOBALS['injector']->getInstance('Horde_Perms')->hasAppPermission('max_events') === true ||
$GLOBALS['injector']->getInstance('Horde_Perms')->hasAppPermission('max_events') > Kronolith::countEvents())): ?>
<!-- recurrence editing -->
<tr>
<th class="nowrap <?php echo ($day->isToday() ? 'selected-control' : 'control') ?>" width="<?php echo $colwidth ?>%" colspan="<?php echo $day->_totalspan ?>">
<?php
if (Kronolith::getDefaultCalendar(Horde_Perms::EDIT) &&
- (!empty($conf['hooks']['permsdenied']) ||
- $GLOBALS['injector']->getInstance('Horde_Perms')->hasAppPermission('max_events') === true ||
+ ($GLOBALS['injector']->getInstance('Horde_Perms')->hasAppPermission('max_events') === true ||
$GLOBALS['injector']->getInstance('Horde_Perms')->hasAppPermission('max_events') > Kronolith::countEvents())) {
echo Horde::url('new.php')
->add(array('date' => $day->dateString(),
);
if ($GLOBALS['injector']->getInstance('Horde_Perms')->hasAppPermission('max_notes') !== true &&
$GLOBALS['injector']->getInstance('Horde_Perms')->hasAppPermission('max_notes') <= Mnemo::countMemos()) {
- $message = htmlspecialchars(sprintf(_("You are not allowed to create more than %d notes."), $GLOBALS['injector']->getInstance('Horde_Perms')->hasAppPermission('max_notes')));
- if (!empty($conf['hooks']['permsdenied'])) {
- $message = Horde::callHook('_perms_hook_denied', array('mnemo:max_notes'), 'horde', $message);
+ try {
+ $message = Horde::callHook('perms_denied', array('mnemo:max_notes'));
+ } catch (Horde_Exception_HookNotSet $e) {
+ $message = htmlspecialchars(sprintf(_("You are not allowed to create more than %d notes."), $GLOBALS['injector']->getInstance('Horde_Perms')->hasAppPermission('max_notes')));
}
$notification->push($message, 'horde.warning', array('content.raw'));
$templates[Horde_Data::IMPORT_FILE] = array(MNEMO_TEMPLATES . '/data/export.inc');
$num_memos = Mnemo::countMemos();
foreach ($next_step as $row) {
if ($max_memos !== true && $num_memos >= $max_memos) {
- $message = htmlspecialchars(sprintf(_("You are not allowed to create more than %d notes."), $GLOBALS['injector']->getInstance('Horde_Perms')->hasAppPermission('max_notes')));
- if (!empty($conf['hooks']['permsdenied'])) {
- $message = Horde::callHook('_perms_hook_denied', array('mnemo:max_notes'), 'horde', $message);
+ try {
+ $message = Horde::callHook('perms_denied', array('mnemo:max_notes'));
+ } catch (Horde_Exception_HookNotSet $e) {
+ $message = htmlspecialchars(sprintf(_("You are not allowed to create more than %d notes."), $GLOBALS['injector']->getInstance('Horde_Perms')->hasAppPermission('max_notes')));
}
$notification->push($message, 'horde.error', array('content.raw'));
break;
$menu->add(Horde::url('list.php'), _("_List Notes"), 'mnemo.png', null, null, null, basename($_SERVER['PHP_SELF']) == 'index.php' ? 'current' : null);
if (Mnemo::getDefaultNotepad(Horde_Perms::EDIT) &&
- (!empty($conf['hooks']['permsdenied']) ||
- $injector->getInstance('Horde_Perms')->hasAppPermission('max_notes') === true ||
+ ($injector->getInstance('Horde_Perms')->hasAppPermission('max_notes') === true ||
$injector->getInstance('Horde_Perms')->hasAppPermission('max_notes') > Mnemo::countMemos())) {
$menu->add(Horde::url(Horde_Util::addParameter('memo.php', 'actionID', 'add_memo')), _("_New Note"), 'add.png', null, null, null, Horde_Util::getFormData('memo') ? '__noselection' : null);
}
/* Check permissions. */
if ($injector->getInstance('Horde_Perms')->hasAppPermission('max_notes') !== true &&
$injector->getInstance('Horde_Perms')->hasAppPermission('max_notes') <= Mnemo::countMemos()) {
- $message = htmlspecialchars(sprintf(_("You are not allowed to create more than %d notes."), $injector->getInstance('Horde_Perms')->hasAppPermission('max_notes')));
- if (!empty($conf['hooks']['permsdenied'])) {
- $message = Horde::callHook('_perms_hook_denied', array('mnemo:max_notes'), 'horde', $message);
+
+ try {
+ $message = Horde::callHook('perms_denied', array('mnemo:max_notes'));
+ } catch (Horde_Exception_HookNotSet $e) {
+ $message = htmlspecialchars(sprintf(_("You are not allowed to create more than %d notes."), $injector->getInstance('Horde_Perms')->hasAppPermission('max_notes')));
}
$notification->push($message, 'horde.error', array('content.raw'));
Horde::url('list.php', true)->redirect();
$menu->add(Horde::url('list.php'), _("_List Tasks"), 'nag.png', null, null, null, basename($_SERVER['PHP_SELF']) == 'index.php' ? 'current' : null);
if (Nag::getDefaultTasklist(Horde_Perms::EDIT) &&
- (!empty($conf['hooks']['permsdenied']) ||
- $injector->getInstance('Horde_Perms')->hasAppPermission('max_tasks') === true ||
+ ($injector->getInstance('Horde_Perms')->hasAppPermission('max_tasks') === true ||
$injector->getInstance('Horde_Perms')->hasAppPermission('max_tasks') > Nag::countTasks())) {
$menu->add(Horde::url('task.php')->add('actionID', 'add_task'), _("_New Task"), 'add.png', null, null, null, Horde_Util::getFormData('task') ? '__noselection' : null);
if ($GLOBALS['browser']->hasFeature('dom')) {
'shown', 'hidden'. If the backend list is hidden then you can use the
'preferred' mechanism to auto-select from it based on an HTTP virtualhost or
another piece of data. If it is shown, the user will be able to pick from
- any of the options.">hidden
+ any of the options.">hidden
<values>
<value>shown</value>
<value>hidden</value>
<configboolean name="strengthtests" desc="Should strength tests be done on
the new password">false</configboolean>
</configsection>
-
- <configsection name="hooks">
- <configboolean name="full_name" desc="If this is checked, the full user name
- is used to change the password, the user name without the domain part
- otherwise. This setting is overridden by enabling the hook
- below.">true</configboolean>
- <configboolean name="default_username" desc="Use a custom hook for
- determining the default username">false</configboolean>
- <configboolean name="username" desc="Use a custom hook to translate the
- username for the backend">false</configboolean>
- <configboolean name="userdn" desc="If we are using the LDAP driver, use a
- custom hook to provide a userdn for binding. By default the LDAP driver
- finds out the correct userdn for binding by searching for the uid with the
- configured base or binds with admindn if set.">false</configboolean>
- </configsection>
</configuration>
*
* For more information please see the horde/config/hooks.php.dist file.
*
- * $Horde: passwd/config/hooks.php.dist,v 1.1.2.2 2009/06/12 08:43:47 jan Exp $
+ * $Id$
*/
-
-// Here is an example _passwd_hook_username function to translate what the
-// user enters, in the username box, into what the backend expects. If we want
-// to add @example.com to the end of the username then enable the hook and use
-// this function.
-
-// if (!function_exists('_passwd_hook_username')) {
-// function _passwd_hook_username($userid, &$driver)
-// {
-// return $userid . '@example.com';
-// }
-// }
-
-// Here is another, more involed example of _passwd_hook_username. This one
-// demonstrates how to return a different $userid based on the driver type. It
-// also demonstrates how to do this using the composite driver.
-
-//if (!function_exists('_passwd_hook_username')) {
-// function _passwd_hook_username($userid, &$driver)
-// {
-// if (is_a($driver, 'Passwd_Driver_http')) {
+class Passwd_Hooks
+{
+ /**
+ * Username hook.
+ *
+ * @param string $userid The username.
+ * @param TODO $driver TODO
+ *
+ * @return string TODO
+ */
+// public function username($userid, $driver)
+// {
+// // Example #1: Translate what the user enters, in the username box,
+// // into what the backend expects.
+// return $userid . '@example.com';
+//
+//
+// // Example #2: Return a different $userid based on the driver type.
+// // Uses the composite driver.
+// if ($driver instanceof Passwd_Driver_http) {
// return $userid . '@example.com';
-// } elseif (is_a($driver, 'Passwd_Driver_composite')) {
+// }
+//
+// if ($driver instanceof Passwd_Driver_composite) {
// foreach ($driver->_params['drivers'] as $backend => $config) {
// if ($backend == 'http') {
// $driver->_params['drivers']['http']['params']['be_username'] = $userid . '@example.com';
// break;
// }
// }
- // Return the userid unmodified by default.
-// return $userid;
-// } else {
-// return $userid;
// }
-// }
-//}
+//
+// return $userid;
+// }
+
+
+ /**
+ * Default username hook.
+ *
+ * @param string $userid The username.
+ *
+ * @return string TODO
+ */
+// public function default_username($userid)
+// {
+// // Example: Set the username the passwd module sees when resetting
+// // passwords based on userid and realm. The default is to take a
+// // username of user@domain.tld and change it to user. If we want to
+// // leave it untouched, enable the hook and use this function.
+// return $userid;
+// }
-// Here is an example _passwd_hook_default_username function to set the
-// username the passwd module sees when resetting passwords based on userid
-// and realm. The default is to take a username of user@domain.tld and change
-// it to user. If we want to leave it untouched, enable the hook and use this
-// function.
-// if (!function_exists('_passwd_hook_default_username')) {
-// function _passwd_hook_default_username($userid)
-// {
-// return $userid;
-// }
-// }
+ /**
+ * Userdn hook.
+ *
+ * @param string $authid The authenticated username.
+ *
+ * @return string TODO
+ */
+// public function userdn($authid)
+// {
+// // Example: Provide LDAP server with a userdn so that you do not have
+// // to perform anonymous binds.
+// return 'uid=' . $authid . ',o=example.com';
+// }
-// Here is an example _passwd_hook_userdn function that you can use to provide
-// your ldap server with a userdn so that you do not have to perform anonymous
-// binds. The function takes Auth::getAuth() as a parameter
-// if (!function_exists('_passwd_hook_userdn')) {
-// function _passwd_hook_userdn($auth)
-// {
-// return 'uid=' . $auth . ',o=example.com';
-// }
-// }
+ /**
+ * TODO
+ */
+// function password_changed($user, $oldpassword, $newpassword)
+// {
+// Horde::logMessage(sprintf('User %s has changed his password.', $user), 'NOTICE');
+// }
-// if (!function_exists('_passwd_password_changed')) {
-// function _passwd_password_changed($user, $oldpassword, $newpassword)
-// {
-// Horde::logMessage(sprintf('User %s has changed his password.', $user), __FILE__, __LINE__, PEAR_LOG_NOTICE);
-// }
-// }
+}
}
// Get the user's dn.
- if ($GLOBALS['conf']['hooks']['userdn']) {
- $this->_userdn = Horde::callHook('_passwd_hook_userdn',
- array($username),
- 'passwd');
- } else {
+ try {
+ $this->_userdn = Horde::callHook('userdn', array($username), 'passwd');
+ } catch (Horde_Exception_HookNotSet $e) {
$this->_userdn = $this->_lookupdn($username, $old_password);
- if (is_a($this->_userdn, 'PEAR_Error')) {
+ if ($this->_userdn instanceof PEAR_Error) {
return $this->_userdn;
}
}
if ($conf['user']['change'] === true) {
$userid = Horde_Util::getFormData('userid');
} else {
- if ($conf['hooks']['default_username']) {
- $userid = Horde::callHook('_passwd_hook_default_username',
- array(Auth::getAuth()),
- 'passwd');
- } else {
- $userid = $registry->getAuth($conf['hooks']['full_name'] ? null : 'bare');
+ try {
+ $userid = Horde::callHook('default_username', array($registry->getAuth()), 'passwd');
+ } catch (Horde_Exception_HookNotSet $e) {
+ $userid = $registry->getAuth();
}
}
break;
}
- $backend_userid = $userid;
-
- if ($conf['hooks']['username']) {
- $backend_userid = Horde::callHook('_passwd_hook_username',
- array($userid, &$daemon),
- 'passwd');
- if (is_a($backend_userid, 'PEAR_Error')) {
- $notification->push($backend_userid, 'horde.error');
- break;
- }
+ try {
+ $backend_userid = Horde::callHook('username', array($userid, $daemon), 'passwd');
+ } catch (Horde_Exception_HookNotSet $e) {
+ $backend_userid = $userid;
}
$res = $daemon->changePassword($backend_userid, $old_password,
$notification->push(sprintf(_("Password changed on %s."),
$backends[$backend_key]['name']), 'horde.success');
- Horde::callHook('_passwd_password_changed',
- array($backend_userid, $old_password, $new_password0),
- 'passwd');
+ try {
+ Horde::callHook('password_changed', array($backend_userid, $old_password, $new_password0), 'passwd');
+ } catch (Horde_Exception_HookNotSet $e) {}
$return_to = Horde_Util::getFormData('return_to');
if (!empty($return_to)) {
// Extract userid to be shown in the username field.
if (empty($userid)) {
- if ($conf['hooks']['default_username']) {
- $userid = Horde::callHook('_passwd_hook_default_username',
- array(Auth::getAuth()),
- 'passwd');
- } else {
- $userid = $registry->getAuth($conf['hooks']['full_name'] ? null : 'bare');
+ try {
+ $userid = Horde::callHook('default_username', array($registry->getAuth()), 'passwd');
+ } catch (Horde_Exception_HookNotSet $e) {
+ $userid = $registry->getAuth();
}
}
/* Check permissions. */
if (Trean::hasPermission('max_bookmarks') !== true &&
Trean::hasPermission('max_bookmarks') <= $trean_shares->countBookmarks()) {
- $message = htmlspecialchars(sprintf(_("You are not allowed to create more than %d bookmarks."), Trean::hasPermission('max_bookmarks')));
- if (!empty($conf['hooks']['permsdenied'])) {
- $message = Horde::callHook('_perms_hook_denied', array('trean:max_bookmarks'), 'horde', $message);
+ try {
+ $message = Horde::callHook('perms_denied', array('trean:max_bookmarks'));
+ } catch (Horde_Exception_HookNotSet $e) {
+ $message = htmlspecialchars(sprintf(_("You are not allowed to create more than %d bookmarks."), Trean::hasPermission('max_bookmarks')));
}
$notification->push($message, 'horde.error', array('content.raw'));
Horde::url('browse.php', true)->redirect();
/* Check permissions. */
if (Trean::hasPermission('max_folders') !== true &&
Trean::hasPermission('max_folders') <= Trean::countFolders()) {
- $message = htmlspecialchars(sprintf(_("You are not allowed to create more than %d folders."), Trean::hasPermission('max_folders')));
- if (!empty($conf['hooks']['permsdenied'])) {
- $message = Horde::callHook('_perms_hook_denied', array('trean:max_folders'), 'horde', $message);
+ try {
+ $message = Horde::callHook('perms_denied', array('trean:max_folders'));
+ } catch (Horde_Exception_HookNotSet $e) {
+ $message = htmlspecialchars(sprintf(_("You are not allowed to create more than %d folders."), Trean::hasPermission('max_folders')));
}
$notification->push($message, 'horde.error', array('content.raw'));
Horde::url('browse.php', true)
$folders_exceeded = Trean::hasPermission('max_folders') !== true &&
Trean::hasPermission('max_folders') <= Trean::countFolders();
if ($folders_exceeded) {
- $message = htmlspecialchars(sprintf(_("You are not allowed to create more than %d folders."), Trean::hasPermission('max_folders')));
- if (!empty($conf['hooks']['permsdenied'])) {
- $message = Horde::callHook('_perms_hook_denied', array('trean:max_folders'), 'horde', $message);
+ try {
+ $message = Horde::callHook('perms_denied', array('trean:max_folders'));
+ } catch (Horde_Exception_HookNotSet $e) {
+ $message = htmlspecialchars(sprintf(_("You are not allowed to create more than %d folders."), Trean::hasPermission('max_folders')));
}
$notification->push($message, 'horde.warning', array('content.raw'));
}
$bookmarks_exceeded = Trean::hasPermission('max_bookmarks') !== true &&
Trean::hasPermission('max_bookmarks') <= $trean_shares->countBookmarks();
if ($bookmarks_exceeded) {
- $message = htmlspecialchars(sprintf(_("You are not allowed to create more than %d bookmarks."), Trean::hasPermission('max_bookmarks')));
- if (!empty($conf['hooks']['permsdenied'])) {
- $message = Horde::callHook('_perms_hook_denied', array('trean:max_bookmarks'), 'horde', $message);
+ try {
+ $message = Horde::callHook('perms_denied', array('trean:max_bookmarks'),);
+ } catch (Horde_Exception_HookNotSet $e) {
+ $message = htmlspecialchars(sprintf(_("You are not allowed to create more than %d bookmarks."), Trean::hasPermission('max_bookmarks')));
}
$notification->push($message, 'horde.warning', array('content.raw'));
}
continue;
}
if ($max_folders !== true && $num_folders >= $max_folders) {
- $message = htmlspecialchars(sprintf(_("You are not allowed to create more than %d folders."), Trean::hasPermission('max_folders')));
- if (!empty($conf['hooks']['permsdenied'])) {
- $message = Horde::callHook('_perms_hook_denied', array('trean:max_folders'), 'horde', $message);
+ try {
+ $message = Horde::callHook('perms_denied', array('trean:max_folders'));
+ } catch (Horde_Exception_HookNotSet $e) {
+ $message = htmlspecialchars(sprintf(_("You are not allowed to create more than %d folders."), Trean::hasPermission('max_folders')));
}
$notification->push($message, 'horde.error', array('content.raw'));
$stop_folders = true;
$line, $temp)) {
/* A bookmark. */
if ($max_bookmarks !== true && $num_bookmarks >= $max_bookmarks) {
- $message = htmlspecialchars(sprintf(_("You are not allowed to create more than %d bookmarks."), Trean::hasPermission('max_bookmarks')));
- if (!empty($conf['hooks']['permsdenied'])) {
- $message = Horde::callHook('_perms_hook_denied', array('trean:max_bookmarks'), 'horde', $message);
+ try {
+ $message = Horde::callHook('perms_denied', array('trean:max_bookmarks'));
+ } catch (Horde_Exception_HookNotSet $e) {
+ $message = htmlspecialchars(sprintf(_("You are not allowed to create more than %d bookmarks."), Trean::hasPermission('max_bookmarks')));
}
$notification->push($message, 'horde.error', array('content.raw'));
$stop_bookmarks = true;
<?php
$option_move = Trean::countFolders(Horde_Perms::EDIT);
$option_copy = $option_move
- && (!empty($conf['hooks']['permsdenied'])
- || Trean::hasPermission('max_bookmarks') === true
+ && (Trean::hasPermission('max_bookmarks') === true
|| Trean::hasPermission('max_bookmarks') > $GLOBALS['trean_shares']->countBookmarks());
$option_edit = (!empty($GLOBALS['folder']) ? $GLOBALS['folder']->hasPermission($GLOBALS['registry']->getAuth(), Horde_Perms::EDIT) : false);
<a id="faShow" href="#" onclick="faToggle(); return false;"><?php echo _("Folder Actions") ?></a>
<a id="faHide" href="#" onclick="faToggle(); return false;"><?php echo _("Folder Actions") ?></a>
<div id="folderActionsInner">
- <?php if (!empty($conf['hooks']['permsdenied']) ||
- Trean::hasPermission('max_folders') === true ||
+ <?php if (Trean::hasPermission('max_folders') === true ||
Trean::hasPermission('max_folders') > Trean::countFolders()): ?>
<form name="trean_new_subfolder" action="add.php" method="post">
<?php echo Horde_Util::formInput() ?>