require_once dirname(__FILE__) . '/lib/Application.php';
Horde_Registry::appInit('agora');
-/* Only authenticated users should be using this. */
-if (!Horde_Auth::isAuthenticated()) {
- $notification->push(_("You are not authorised for this action."), 'horde.warning');
- Horde_Auth::authenticateFailure('agora');
-}
-
/* Default to agora and current user if is not an admin. */
$scope = Horde_Util::getGet('scope', 'agora');
$owner = $registry->isAdmin() ? Horde_Util::getGet('owner', Horde_Auth::getAuth()) : Horde_Auth::getAuth();
: '__noselection');
}
- if ($conf['faces']['driver'] && Horde_Auth::isAuthenticated()) {
+ if ($conf['faces']['driver'] && $registry->isAuthenticated()) {
$menu->add(Horde::applicationUrl('faces/search/all.php'), _("_Faces"), 'user.png', Horde_Themes::img(null, 'horde'));
}
return true;
case 'authenticated':
- return Horde_Auth::isAuthenticated();
+ return $GLOBALS['registry']->isAuthenticated();
case 'edit':
return $this->hasPermission(Horde_Auth::getAuth(), Horde_Perms::EDIT);
}
// Can we hook user's age?
- if ($GLOBALS['conf']['ages']['hook'] && Horde_Auth::isAuthenticated()) {
+ if ($GLOBALS['conf']['ages']['hook'] &&
+ $GLOBALS['registry']->isAuthenticated()) {
$result = Horde::callHook('_ansel_hook_user_age');
if (is_int($result)) {
$_SESSION['ansel']['user_age'] = $result;
/**
* The current page we are viewing
- *
+ *
* @var integer
*/
public $page = 0;
/* Don't show action widget if no actions */
if (Horde_Auth::getAuth() ||
!empty($conf['report_content']['driver']) &&
- (($conf['report_content']['allow'] == 'authenticated' && Horde_Auth::isAuthenticated()) ||
+ (($conf['report_content']['allow'] == 'authenticated' &&
+ $GLOBALS['registry']->isAuthenticated()) ||
$conf['report_content']['allow'] == 'all')) {
$this->view->addWidget(Ansel_Widget::factory('Actions'));
}
/**
- *
+ *
* @see ansel/lib/Widget/Ansel_Widget_Base#html()
*/
public function html()
$this->_view->gallery->get('owner') == Horde_Auth::getAuth()) {
$html .= '<li>' . Horde::link('#', '', 'popup widget', '', Horde::popupJs(Horde::applicationUrl('perms.php'), array('params' => array('cid' => $this->_view->gallery->id), 'urlencode' => true)) . 'return false;') . Horde::img('perms.png') . ' ' . _("Set permissions") . '</a></li>';
} elseif (!empty($conf['report_content']['driver']) &&
- (($conf['report_content']['allow'] == 'authenticated' && Horde_Auth::isAuthenticated()) ||
+ (($conf['report_content']['allow'] == 'authenticated' &&
+ $registry->isAuthenticated()) ||
$conf['report_content']['allow'] == 'all')) {
$reporturl = Horde_Util::addParameter(Horde::applicationUrl('report.php'),
$this->gallery->get('owner') != Horde_Auth::getAuth()) &&
!empty($GLOBALS['conf']['report_content']['driver']) &&
(($conf['report_content']['allow'] == 'authenticated' &&
- Horde_Auth::isAuthenticated()) ||
+ $GLOBALS['registry']->isAuthenticated()) ||
$conf['report_content']['allow'] == 'all')) {
$actionHTML .= ($needSeperator ? ' | ' : '' ) . Horde::link($this->_urls['report']) . _("Report") . '</a>';
}
// If we don't have a valid login, print the login form.
-if (!Horde_Auth::isAuthenticated()) {
+if (!$registry->isAuthenticated()) {
$PUBLISH_ONNEXT = 'login.submit();';
$PUBLISH_CMD = 'login.username.focus();';
require ANSEL_TEMPLATES . '/xppublish/login.inc';
}
// We are already logged
-if (Horde_Auth::isAuthenticated()) {
+if ($registry->isAuthenticated()) {
header('Location: ' . Folks::getUrlFor('user', Horde_Auth::getAuth()));
exit;
}
require_once dirname(__FILE__) . '/../../lib/base.php';
require_once FOLKS_BASE . '/lib/Friends.php';
-if (!Horde_Auth::isAuthenticated()) {
+if (!$registry->isAuthenticated()) {
Horde_Auth::authenticateFailure('folks');
}
require_once dirname(__FILE__) . '/../../lib/base.php';
require_once FOLKS_BASE . '/lib/Friends.php';
-if (!Horde_Auth::isAuthenticated()) {
+if (!$registry->isAuthenticated()) {
Horde_Auth::authenticateFailure('folks');
}
* @package Folks
*/
-if (!Horde_Auth::isAuthenticated()) {
+if (!$registry->isAuthenticated()) {
Horde_Auth::authenticateFailure('folks');
}
require_once dirname(__FILE__) . '/lib/base.php';
require_once FOLKS_BASE . '/lib/Forms/Activity.php';
-if (!Horde_Auth::isAuthenticated()) {
+if (!$registry->isAuthenticated()) {
Horde_Auth::authenticateFailure('folks');
}
*/
function _content()
{
- if (!Horde_Auth::isAuthenticated()) {
+ if (!$GLOBALS['registry']->isAuthenticated()) {
return '';
}
$this->_updateOnlineStatus();
// Update profile
- if (Horde_Auth::isAuthenticated()) {
+ if ($GLOBALS['registry']->isAuthenticated()) {
$this->_saveProfile(array('last_online_on' => $_SERVER['REQUEST_TIME']), Horde_Auth::getAuth());
}
}
*/
function logView($id)
{
- if (!Horde_Auth::isAuthenticated() || Horde_Auth::getAUth() == $id) {
+ if (!$GLOBALS['registry']->isAuthenticated() || Horde_Auth::getAUth() == $id) {
return false;
}
// If there is no email set use the registration one
if (empty($email)) {
- if (Horde_Auth::isAuthenticated()) {
+ if ($GLOBALS['registry']->isAuthenticated()) {
$profile = $GLOBALS['folks_driver']->getProfile($user);
} else {
$profile = $GLOBALS['folks_driver']->getRawProfile($user);
$result = false;
if (empty($user)) {
- if (Horde_Auth::isAuthenticated()) {
+ if ($GLOBALS['registry']->isAuthenticated()) {
$user = Horde_Auth::getAuth();
} else {
return true;
$result = false;
if (empty($user)) {
- if (Horde_Auth::isAuthenticated()) {
+ if ($GLOBALS['registry']->isAuthenticated()) {
$user = Horde_Auth::getAuth();
} else {
return true;
/*
* We are already logged in?
*/
-if (Horde_Auth::isAuthenticated()) {
+if ($registry->isAuthenticated()) {
if (empty($url_param)) {
$url_param = Folks::getUrlFor('user', Horde_Auth::getAuth());
}
$users = array();
}
-if (Horde_Auth::isAuthenticated()) {
+if ($registry->isAuthenticated()) {
$queries = $folks_driver->getSavedSearch();
if ($queries instanceof PEAR_Error) {
$notification->push($queries);
echo '<br />';
$form->renderActive(null, null, null, 'post');
-if (Horde_Auth::isAuthenticated()) {
+if ($registry->isAuthenticated()) {
require FOLKS_TEMPLATES . '/list/search.php';
}
<title><?php echo htmlspecialchars($page_title) ?></title>
<link href="<?php echo Horde_Themes::img('favicon.ico', array('nohorde' => true)) ?>" rel="SHORTCUT ICON" />
<link rel="alternate" type="application/rss+xml" href="<?php echo Folks::getUrlFor('feed', 'online') ?>" title="<?php echo _("Online users") ?>" />
-<?php if (Horde_Auth::isAuthenticated()): ?>
+<?php if ($GLOBALS['registry']->isAuthenticated()): ?>
<link rel="alternate" type="application/rss+xml" href="<?php echo Folks::getUrlFor('feed', 'friends') ?>" title="<?php echo _("Online friends") ?>" />
<link rel="alternate" type="application/rss+xml" href="<?php echo Folks::getUrlFor('feed', 'activity') ?>" title="<?php echo _("Friends activity") ?>" />
<link rel="alternate" type="application/rss+xml" href="<?php echo Folks::getUrlFor('feed', 'know') ?>" title="<?php echo _("People you might know") ?>" />
echo '<span class="offline">' . _("Offline") . '</span>';
if ($profile['last_online_on'] &&
($profile['last_online'] == 'all' ||
- Horde_Auth::isAuthenticated() && (
+ $GLOBALS['registry']->isAuthenticated() && (
$profile['last_online'] == 'authenticated' ||
$profile['last_online'] == 'friends' && $friends_driver->isFriend(Horde_Auth::getAuth())))
) {
break;
case 'authenticated':
- $allow_comments = Horde_Auth::isAuthenticated();
+ $allow_comments = $GLOBALS['registry']->isAuthenticated();
if ($allow_comments) {
if ($friends_driver->isBlacklisted(Horde_Auth::getAuth())) {
$allow_comments = false;
default:
$allow_comments = true;
- if (Horde_Auth::isAuthenticated() && $friends_driver->isBlacklisted(Horde_Auth::getAuth())) {
+ if ($GLOBALS['registry']->isAuthenticated() && $friends_driver->isBlacklisted(Horde_Auth::getAuth())) {
$allow_comments = false;
$comments_reason = sprintf(_("You are on %s blacklist."), $user);
}
// Get user activity
if ($profile['activity_log'] == 'all' ||
- Horde_Auth::isAuthenticated() && (
+ $registry->isAuthenticated() && (
$profile['activity_log'] == 'authenticated' ||
$profile['activity_log'] == 'friends' && $friends_driver->isFriend($user))
) {
break;
case 'public_authenticated':
- if (Horde_Auth::isAuthenticated()) {
+ if ($registry->isAuthenticated()) {
require FOLKS_TEMPLATES . '/user/user.php';
} else {
require FOLKS_TEMPLATES . '/user/authenticated.php';
}
/**
- * Checks if there is a session with valid auth information. If there
- * isn't, but the configured Auth driver supports transparent
- * authentication, then we try that.
- *
- * @params array $options Additional options:
- * <pre>
- * 'app' - (string) Check authentication for this app.
- * DEFAULT: Checks horde-wide authentication.
- * </pre>
- *
- * @return boolean Whether or not the user is authenticated.
- * @throws Horde_Auth_Exception
- */
- static public function isAuthenticated($options = array())
- {
- /* Check for cached authentication results. */
- if (self::getAuth()) {
- $driver = (empty($options['app']) || ($options['app'] == 'horde'))
- ? $GLOBALS['conf']['auth']['driver']
- : $options['app'];
-
- if (($_SESSION['horde_auth']['driver'] == $driver) ||
- isset($_SESSION['horde_auth']['app'][$driver])) {
- return self::checkExistingAuth();
- }
- }
-
- /* Try transparent authentication. */
- $auth = (empty($options['app']) || ($options['app'] == 'horde'))
- ? $GLOBALS['injector']->getInstance('Horde_Auth')->getOb()
- : $GLOBALS['injector']->getInstance('Horde_Auth')->getOb('application', array('app' => $options['app']));
-
- return $auth->transparent();
- }
-
- /**
* Check existing auth for triggers that might invalidate it.
*
* @return boolean Is existing auth valid?
throw new Horde_Exception('User is not authorized', self::AUTH_FAILURE);
}
if (!$this->hasPermission($app, Horde_Perms::READ)) {
- if (!Horde_Auth::isAuthenticated(array('app' => $app))) {
+ if (!$this->isAuthenticated(array('app' => $app))) {
throw new Horde_Exception('User is not authorized', self::AUTH_FAILURE);
}
/* Always do isAuthenticated() check first. You can be an admin, but
* application auth != Horde admin auth. And there can *never* be
* non-SHOW access to an application that requires authentication. */
- if (!Horde_Auth::isAuthenticated(array('app' => $app)) &&
+ if (!$this->isAuthenticated(array('app' => $app)) &&
$this->requireAuth($app) &&
($perms != Horde_Perms::SHOW)) {
return false;
: $GLOBALS['injector']->getInstance('Horde_Auth')->getOb('application', array('app' => $app))->requireAuth();
}
+ /**
+ * Checks if there is a session with valid auth information. If there
+ * isn't, but the configured Auth driver supports transparent
+ * authentication, then we try that.
+ *
+ * @params array $options Additional options:
+ * <pre>
+ * 'app' - (string) Check authentication for this app.
+ * DEFAULT: Checks horde-wide authentication.
+ * </pre>
+ *
+ * @return boolean Whether or not the user is authenticated.
+ */
+ public function isAuthenticated($options = array())
+ {
+ /* Check for cached authentication results. */
+ if (Horde_Auth::getAuth()) {
+ $driver = (empty($options['app']) || ($options['app'] == 'horde'))
+ ? $GLOBALS['conf']['auth']['driver']
+ : $options['app'];
+
+ if (($_SESSION['horde_auth']['driver'] == $driver) ||
+ isset($_SESSION['horde_auth']['app'][$driver])) {
+ return Horde_Auth::checkExistingAuth();
+ }
+ }
+
+ /* Try transparent authentication. */
+ $auth = (empty($options['app']) || ($options['app'] == 'horde'))
+ ? $GLOBALS['injector']->getInstance('Horde_Auth')->getOb()
+ : $GLOBALS['injector']->getInstance('Horde_Auth')->getOb('application', array('app' => $options['app']));
+
+ return $auth->transparent();
+ }
+
}
}
// Be authenticated or call system.login.
- $authenticated = Horde_Auth::isAuthenticated() || $method== "phpgw/system/login";
+ $authenticated = $registry->isAuthenticated() || $method== "phpgw/system/login";
if ($authenticated) {
Horde::logMessage("rpc call $method allowed", 'NOTICE');
} catch (Horde_Exception $e) {}
$app = Horde_Util::getFormData('app');
-$is_auth = Horde_Auth::isAuthenticated();
+$is_auth = $registry->isAuthenticated();
/* This ensures index.php doesn't pick up the 'url' parameter. */
$horde_login_url = '';
}
// Is logged it?
-if (!Horde_Auth::isAuthenticated()) {
+if (!$registry->isAuthenticated()) {
$notification->push(_("Only authenticated users can post news."), 'horde.warning');
Horde_Auth::authenticateFailure('news');
}
*/
function _content()
{
- if (!Horde_Auth::isAuthenticated()) {
+ if (!$GLOBALS['registry']->isAuthenticated()) {
return '';
}
exit;
}
-if (!Horde_Auth::isAuthenticated()) {
+if (!$registry->isAuthenticated()) {
_error(_("Only authenticated users can send mails."));
}
require_once dirname(__FILE__) . '/lib/base.php';
-if (!Horde_Auth::isAuthenticated()) {
+if (!$registry->isAuthenticated()) {
Horde_Auth::authenticateFailure('news');
}
// block set for guests.
$mybugs_layout = @unserialize($prefs->getValue('mybugs_layout'));
if (!$mybugs_layout) {
- if (Horde_Auth::isAuthenticated()) {
+ if ($registry->isAuthenticated()) {
$mybugs_layout = array(
array(array('app' => 'whups', 'params' => array('type' => 'mytickets', 'params' => false), 'height' => 1, 'width' => 1)),
array(array('app' => 'whups', 'params' => array('type' => 'myrequests', 'params' => false), 'height' => 1, 'width' => 1)),