* @package Gollem
*/
-require_once dirname(__FILE__) . '/lib/base.php';
+require_once dirname(__FILE__) . '/lib/Application.php';
+new Gollem_Application(array('init' => true));
$dir = Horde_Util::getFormData('dir');
* @package Gollem
*/
-require_once dirname(__FILE__) . '/lib/base.php';
+require_once dirname(__FILE__) . '/lib/Application.php';
+new Gollem_Application(array('init' => true));
$actionID = Horde_Util::getFormData('actionID');
$driver = Horde_Util::getFormData('driver');
*/
public function browse($path = '', $properties = array())
{
- $GLOBALS['gollem_authentication'] = 'none';
- require_once dirname(__FILE__) . '/base.php';
- require GOLLEM_BASE . '/config/backends.php';
- require GOLLEM_BASE . '/config/credentials.php';
-
$path = Gollem::stripAPIPath($path);
// Default properties.
*/
public function put($path, $content, $content_type)
{
- // Gollem does not handle authentication
- $GLOBALS['gollem_authentication'] = 'none';
-
- // Include Gollem base libraries
- require_once dirname(__FILE__) . '/base.php';
- require GOLLEM_BASE . '/config/backends.php';
- require GOLLEM_BASE . '/config/credentials.php';
-
// Clean off the irrelevant portions of the path
$path = Gollem::stripAPIPath($path);
*/
public function mkcol($path)
{
- // Gollem does not handle authentication
- $GLOBALS['gollem_authentication'] = 'none';
-
- // Include Gollem base libraries
- require_once dirname(__FILE__) . '/base.php';
- require GOLLEM_BASE . '/config/backends.php';
- require GOLLEM_BASE . '/config/credentials.php';
-
// Clean off the irrelevant portions of the path
$path = Gollem::stripAPIPath($path);
*/
public function move($path, $dest)
{
- // Gollem does not handle authentication
- $GLOBALS['gollem_authentication'] = 'none';
-
- // Include Gollem base libraries
- require_once dirname(__FILE__) . '/base.php';
- require GOLLEM_BASE . '/config/backends.php';
- require GOLLEM_BASE . '/config/credentials.php';
-
// Clean off the irrelevant portions of the path
$path = Gollem::stripAPIPath($path);
$dest = Gollem::stripAPIPath($dest);
*/
public function path_delete($path)
{
- // Gollem does not handle authentication
- $GLOBALS['gollem_authentication'] = 'none';
-
- // Include Gollem base libraries
- require_once dirname(__FILE__) . '/base.php';
- require GOLLEM_BASE . '/config/backends.php';
- require GOLLEM_BASE . '/config/credentials.php';
-
// Clean off the irrelevant portions of the path
$path = Gollem::stripAPIPath($path);
*/
public function getViewLink($dir, $file, $backend = '')
{
- require_once dirname(__FILE__) . '/base.php';
-
if (empty($backend)) {
$backend = Gollem::getPreferredBackend();
}
* @return string The URL string.
*/
public function selectlistLink($link_text, $link_style, $formid,
- $icon = false, $selectid = '')
+ $icon = false, $selectid = '')
{
$link = Horde::link('#', $link_text, $link_style, '_blank', Horde::popupJs(Horde::applicationUrl('selectlist.php'), array('params' => array('formid' => $formid, 'cacheid' => $selectid), 'height' => 500, 'width' => 300, 'urlencode' => true)) . 'return false;');
if ($icon) {
{
if (!isset($_SESSION['gollem']['selectlist'][$selectid]['files'])) {
return null;
- } else {
- $list = array();
- foreach ($_SESSION['gollem']['selectlist'][$selectid]['files'] as $val) {
- list($dir, $filename) = explode('|', $val);
- $list[] = array($dir => $filename);
- }
- return $list;
}
+
+ $list = array();
+ foreach ($_SESSION['gollem']['selectlist'][$selectid]['files'] as $val) {
+ list($dir, $filename) = explode('|', $val);
+ $list[] = array($dir => $filename);
+ }
+
+ return $list;
}
/**
*/
public function returnFromSelectlist($selectid, $index)
{
- require_once dirname(__FILE__) . '/base.php';
-
if (!isset($_SESSION['gollem']['selectlist'][$selectid]['files'][$index])) {
return null;
}
*/
public function setSelectlist($selectid = '', $files = array())
{
- require_once dirname(__FILE__) . '/base.php';
-
if (empty($selectid)) {
$selectid = uniqid(mt_rand(), true);
}
<?php
+/* Determine the base directories. */
+if (!defined('GOLLEM_BASE')) {
+ define('GOLLEM_BASE', dirname(__FILE__) . '/..');
+}
+
+if (!defined('HORDE_BASE')) {
+ /* If Horde does not live directly under the app directory, the HORDE_BASE
+ * constant should be defined in config/horde.local.php. */
+ if (file_exists(GOLLEM_BASE . '/config/horde.local.php')) {
+ include GOLLEM_BASE . '/config/horde.local.php';
+ } else {
+ define('HORDE_BASE', GOLLEM_BASE . '/..');
+ }
+}
+
+/* Load the Horde Framework core (needed to autoload
+ * Horde_Registry_Application::). */
+require_once HORDE_BASE . '/lib/core.php';
+
/**
* Gollem application API.
*
public $version = 'H4 (2.0-git)';
/**
+ * The auth type to use.
+ *
+ * @var string
+ */
+ static public $authType = null;
+
+ /**
+ * Disable compression of pages?
+ *
+ * @var boolean
+ */
+ static public $noCompress = false;
+
+ /**
+ * Constructor.
+
+ * @param array $args The following entries:
+ * <pre>
+ * 'init' - (boolean|array) If true, perform application init. If an
+ * array, perform application init and pass the array to init().
+ * </pre>
+ */
+ public function __construct($args = array())
+ {
+ if (!empty($args['init'])) {
+ $this->init(is_array($args['init']) ? $args['init'] : array());
+ }
+ }
+
+ /**
+ * Gollem base initialization.
+ *
+ * Global variables defined:
+ * $gollem_backends - A link to the current list of available backends
+ * $gollem_be - A link to the current backend parameters in the session
+ * $gollem_vfs - A link to the current VFS object for the active backend
+ *
+ * @param array $args Optional arguments:
+ * <pre>
+ * 'authentication' - (string) The type of authentication to use:
+ * 'horde' - Only use horde authentication
+ * 'none' - Do not authenticate
+ * [DEFAULT] - Authenticate to backend; on no auth redirect to
+ * login screen
+ * 'nocompress' - (boolean) Controls whether the page should be
+ * compressed.
+ * 'session_control' - (string) Sets special session control limitations:
+ * 'readonly' - Start session readonly
+ * [DEFAULT] - Start read/write session
+ * </pre>
+ */
+ public function init($args = array())
+ {
+ $args = array_merge(array(
+ 'authentication' => null,
+ 'nocompress' => false,
+ 'session_control' => null
+ ), $args);
+
+ self::$authType = $args['authentication'];
+ self::$noCompress = $args['nocompress'];
+
+ // Registry.
+ $s_ctrl = 0;
+ switch ($args['session_control']) {
+ case 'readonly':
+ $s_ctrl = Horde_Registry::SESSION_READONLY;
+ break;
+ }
+
+ $GLOBALS['registry'] = Horde_Registry::singleton($s_ctrl);
+
+ try {
+ $GLOBALS['registry']->pushApp('gollem', array('check_perms' => ($args['authentication'] != 'none'), 'logintasks' => true));
+ } catch (Horde_Exception $e) {
+ Horde_Auth::authenticateFailure('gollem', $e);
+ }
+
+ if (!defined('GOLLEM_TEMPLATES')) {
+ define('GOLLEM_TEMPLATES', $GLOBALS['registry']->get('templates'));
+ }
+
+ // Notification system.
+ $notification = Horde_Notification::singleton();
+ $notification->attach('status');
+
+ // Start compression.
+ if (!self::$noCompress) {
+ Horde::compressOutput();
+ }
+
+ // Set the global $gollem_be variable to the current backend's
+ // parameters.
+ $GLOBALS['gollem_be'] = empty($_SESSION['gollem']['backend_key'])
+ ? null
+ : $_SESSION['gollem']['backends'][$_SESSION['gollem']['backend_key']];
+
+ // Load the backend list.
+ Gollem::loadBackendList();
+ }
+
+ /**
* Returns a list of available permissions.
*
* @return array An array describing all available permissions.
}
}
+ /**
+ * Check Gollem authentication and change to the currently active
+ * directory. Redirects to login page on authentication/session failure.
+ *
+ * @param string $mode The authentication mode we are using.
+ * @param boolean $redirect Redirect to the logout page if authentication
+ * is unsuccessful?
+ *
+ * @return boolean True on success, false on failure.
+ */
+ static public function checkAuthentication($mode = null, $redirect = true)
+ {
+ $auth_gollem = new Gollem_Auth();
+ $reason = $auth_gollem->authenticate();
+
+ if ($reason !== true) {
+ if ($redirect) {
+ if ($mode = 'selectlist') {
+ $url = Horde_Util::addParameter($GLOBALS['registry']->get('webroot', 'gollem') . '/login.php', 'selectlist_login', 1, false);
+ } else {
+ $url = Horde_Auth::addLogoutParameters(self::logoutUrl());
+ }
+ $url = Horde_Util::addParameter($url, 'url', Horde::selfUrl(true, true, true), false);
+ header('Location: ' . $url);
+ exit;
+ } else {
+ return false;
+ }
+ }
+
+ return true;
+ }
+
+ /**
+ * Can we log in without a login screen for the requested backend key?
+ *
+ * @param string $key The backend key to check. Defaults to
+ * self::getPreferredBackend().
+ * @param boolean $force If true, check the backend key even if there is
+ * more than one backend.
+ *
+ * @return boolean True if autologin possible, false if not.
+ */
+ static public function canAutoLogin($key = null, $force = false)
+ {
+ $auto_server = self::getPreferredBackend();
+ if ($key === null) {
+ $key = $auto_server;
+ }
+
+ return (((count($auto_server) == 1) || $force) &&
+ Horde_Auth::getAuth() &&
+ empty($GLOBALS['gollem_backends'][$key]['loginparams']) &&
+ !empty($GLOBALS['gollem_backends'][$key]['hordeauth']));
+ }
+
+ /**
+ * Take information posted from a login attempt and try setting up
+ * an initial Gollem session. Handle Horde authentication, if
+ * required, and only do enough work to see if the user can log
+ * in. This function should only be called once, when the user first logs
+ * into Gollem.
+ *
+ * Creates the $gollem session variable with the following entries:
+ * 'backend_key' -- The current backend
+ * 'be_list' -- The cached list of available backends
+ * 'selectlist' -- Stores file selections from the API call
+ *
+ * Each backend is stored by its name in the 'backends' array. Each
+ * backend contains the following entries:
+ * 'attributes' -- See config/backends.php
+ * 'autologin' -- Whether this backend supports autologin
+ * 'clipboard' -- The clipboard for the current backend
+ * 'createhome' -- See config/backends.php
+ * 'dir' -- The current directory
+ * 'driver' -- See config/backends.php
+ * 'filter' -- See config/backends.php
+ * 'home' -- The user's home directory
+ * 'hordeauth' -- See config/backends.php
+ * 'hostspec' -- See config/backends.php
+ * 'label' -- The label to use
+ * 'name' -- See config/backends.php
+ * 'params' -- See config/backends.php
+ * 'preferred' -- See config/backends.php
+ * 'root' -- The root directory
+ *
+ * @param string $key The backend key to initialize.
+ * @param string $user The username to use for authentication.
+ * @param string $pass The password to use for authentication.
+ * @param array $args Any additional parameters the backend needs.
+ *
+ * @return boolean True on success, false on failure.
+ */
+ function createSession($key, $user = null, $pass = null, $args = array())
+ {
+ global $conf;
+
+ /* Make sure we have a key and that it is valid. */
+ if (empty($key) || (substr($key, 0, 1) == '_')) {
+ return false;
+ }
+
+ /* We might need to override some of the defaults with
+ * environment-wide settings. Do NOT use the global $backends
+ * variable as it may not exist. */
+ require GOLLEM_BASE . '/config/backends.php';
+ if (empty($backends[$key])) {
+ $entry = sprintf('Invalid server key from client [%s]', $_SERVER['REMOTE_ADDR']);
+ Horde::logMessage($entry, __FILE__, __LINE__, PEAR_LOG_INFO);
+ return false;
+ }
+
+ /* Create gollem session object if it doesn't already exist. */
+ if (!isset($_SESSION['gollem'])) {
+ $_SESSION['gollem'] = array();
+ $_SESSION['gollem']['backends'] = array();
+ $_SESSION['gollem']['selectlist'] = array();
+ }
+ $_SESSION['gollem']['backends'][$key] = $backends[$key];
+ $GLOBALS['gollem_be'] = &$_SESSION['gollem']['backends'][$key];
+ $ptr = &$_SESSION['gollem']['backends'][$key];
+ $ptr['params'] = array_merge($ptr['params'], $args);
+
+ /* Set the current backend as active. */
+ $_SESSION['gollem']['backend_key'] = $key;
+
+ /* Set username now. Don't set the current username if the backend
+ * already has a username defined. */
+ if (empty($ptr['params']['username'])) {
+ $ptr['params']['username'] = ($user === null) ? Horde_Auth::getBareAuth() : $user;
+ }
+
+ /* Set password now. The password should always be encrypted within
+ * the session. */
+ if (!empty($ptr['params']['password'])) {
+ $pass = $ptr['params']['password'];
+ }
+ if ($pass === null) {
+ $ptr['params']['password'] = null;
+ } else {
+ $ptr['params']['password'] = Horde_Secret::write(Horde_Secret::getKey('gollem'), $pass);
+ }
+
+ /* Try to authenticate with the given information. */
+ $auth_gollem = new Gollem_Auth();
+ if ($auth_gollem->authenticate(null, null, true) !== true) {
+ unset($_SESSION['gollem']['backends'][$key]);
+ $_SESSION['gollem']['backend_key'] = null;
+ return false;
+ }
+
+ // Make sure we have a 'root' parameter.
+ if (empty($ptr['root'])) {
+ $ptr['root'] = '/';
+ }
+ $ptr['root'] = Horde_Util::realPath($ptr['root']);
+
+ // Make sure we have a 'home' parameter.
+ if (empty($ptr['home'])) {
+ $ptr['home'] = (!empty($ptr['params']['home'])) ? $ptr['params']['home'] : $GLOBALS['gollem_vfs']->getCurrentDirectory();
+ if (empty($ptr['home'])) {
+ $ptr['home'] = $ptr['root'];
+ }
+ }
+
+ // Make sure the home parameter lives under root if it is a relative
+ // directory.
+ if (strpos($ptr['home'], '/') !== 0) {
+ $ptr['home'] = $ptr['root'] . '/' . $ptr['home'];
+ }
+ $ptr['home'] = Horde_Util::realPath($ptr['home']);
+ $ptr['dir'] = $ptr['home'];
+
+ // Verify that home is below root.
+ if (!Gollem::verifyDir($ptr['home'])) {
+ $error_msg = 'Backend Configuration Error: Home directory not below root.';
+ $auth_gollem->gollemSetAuthErrorMsg($error_msg);
+ Horde::logMessage(PEAR::raiseError($error_msg), __FILE__, __LINE__, PEAR_LOG_ERR);
+ unset($_SESSION['gollem']['backends'][$key]);
+ $_SESSION['gollem']['backend_key'] = null;
+ return false;
+ }
+
+ /* Create the home directory if it doesn't already exist. */
+ if (($ptr['home'] != '/') && !empty($ptr['createhome'])) {
+ $pos = strrpos($ptr['home'], '/');
+ $cr_dir = substr($ptr['home'], 0, $pos);
+ $cr_file = substr($ptr['home'], $pos + 1);
+ if (!$GLOBALS['gollem_vfs']->exists($cr_dir, $cr_file)) {
+ $res = Gollem::createFolder($cr_dir, $cr_file);
+ if (is_a($res, 'PEAR_Error')) {
+ $error_msg = 'Backend Configuration Error: Could not create home directory ' . $ptr['home'] . '.';
+ $auth_gollem->gollemSetAuthErrorMsg($error_msg);
+ Horde::logMessage(PEAR::raiseError($error_msg), __FILE__, __LINE__, PEAR_LOG_ERR);
+ unset($_SESSION['gollem']['backends'][$key]);
+ $_SESSION['gollem']['backend_key'] = null;
+ return false;
+ }
+ }
+ }
+
+ /* Does this driver support autologin? */
+ $ptr['autologin'] = Gollem::canAutoLogin(true);
+
+ /* Cache the backend_list in the session. */
+ if (empty($_SESSION['gollem']['be_list'])) {
+ Gollem::loadBackendList();
+ $_SESSION['gollem']['be_list'] = $GLOBALS['gollem_backends'];
+ }
+
+ /* Initialize clipboard. */
+ if (!isset($_SESSION['gollem']['clipboard'])) {
+ $_SESSION['gollem']['clipboard'] = array();
+ }
+
+ /* Call Gollem::changeDir() to make sure the label is set. */
+ Gollem::changeDir();
+
+ return true;
+ }
+
+ /**
+ * Change the currently active backend.
+ *
+ * @param string $key The ID of the backend to set as active.
+ */
+ function changeBackend($key)
+ {
+ $_SESSION['gollem']['backend_key'] = $key;
+ $GLOBALS['gollem_be'] = &$_SESSION['gollem']['backends'][$key];
+ }
+
}
const SORT_DESCEND = 1;
/**
- * Check Gollem authentication and change to the currently active
- * directory. Redirects to login page on authentication/session failure.
- *
- * @param string $mode The authentication mode we are using.
- * @param boolean $redirect Redirect to the logout page if authentication
- * is unsuccessful?
- *
- * @return boolean True on success, false on failure.
- */
- static public function checkAuthentication($mode = null, $redirect = true)
- {
- $auth_gollem = new Gollem_Auth();
- $reason = $auth_gollem->authenticate();
-
- if ($reason !== true) {
- if ($redirect) {
- if ($mode = 'selectlist') {
- $url = Horde_Util::addParameter($GLOBALS['registry']->get('webroot', 'gollem') . '/login.php', 'selectlist_login', 1, false);
- } else {
- $url = Horde_Auth::addLogoutParameters(self::logoutUrl());
- }
- $url = Horde_Util::addParameter($url, 'url', Horde::selfUrl(true, true, true), false);
- header('Location: ' . $url);
- exit;
- } else {
- return false;
- }
- }
-
- return true;
- }
-
- /**
- * Can we log in without a login screen for the requested backend key?
- *
- * @param string $key The backend key to check. Defaults to
- * self::getPreferredBackend().
- * @param boolean $force If true, check the backend key even if there is
- * more than one backend.
- *
- * @return boolean True if autologin possible, false if not.
- */
- static public function canAutoLogin($key = null, $force = false)
- {
- $auto_server = self::getPreferredBackend();
- if ($key === null) {
- $key = $auto_server;
- }
-
- return (((count($auto_server) == 1) || $force) &&
- Horde_Auth::getAuth() &&
- empty($GLOBALS['gollem_backends'][$key]['loginparams']) &&
- !empty($GLOBALS['gollem_backends'][$key]['hordeauth']));
- }
-
- /**
* Changes the current directory of the Gollem session to the supplied
* value.
*
+++ /dev/null
-<?php
-/**
- * Functions required to start a Gollem session.
- *
- * Copyright 1999-2009 The Horde Project (http://www.horde.org/)
- *
- * See the enclosed file COPYING for license information (GPL). If you
- * did not receive this file, see http://www.fsf.org/copyleft/gpl.html.
- *
- * @author Chuck Hagenbuch <chuck@horde.org>
- * @author Max Kalika <max@horde.org>
- * @author Michael Slusarz <slusarz@horde.org>
- * @package Gollem
- */
-class Gollem_Session {
-
- /**
- * Take information posted from a login attempt and try setting up
- * an initial Gollem session. Handle Horde authentication, if
- * required, and only do enough work to see if the user can log
- * in. This function should only be called once, when the user first logs
- * into Gollem.
- *
- * Creates the $gollem session variable with the following entries:
- * 'backend_key' -- The current backend
- * 'be_list' -- The cached list of available backends
- * 'selectlist' -- Stores file selections from the API call
- *
- * Each backend is stored by its name in the 'backends' array. Each
- * backend contains the following entries:
- * 'attributes' -- See config/backends.php
- * 'autologin' -- Whether this backend supports autologin
- * 'clipboard' -- The clipboard for the current backend
- * 'createhome' -- See config/backends.php
- * 'dir' -- The current directory
- * 'driver' -- See config/backends.php
- * 'filter' -- See config/backends.php
- * 'home' -- The user's home directory
- * 'hordeauth' -- See config/backends.php
- * 'hostspec' -- See config/backends.php
- * 'label' -- The label to use
- * 'name' -- See config/backends.php
- * 'params' -- See config/backends.php
- * 'preferred' -- See config/backends.php
- * 'root' -- The root directory
- *
- * @param string $key The backend key to initialize.
- * @param string $user The username to use for authentication.
- * @param string $pass The password to use for authentication.
- * @param array $args Any additional parameters the backend needs.
- *
- * @return boolean True on success, false on failure.
- */
- function createSession($key, $user = null, $pass = null, $args = array())
- {
- global $conf;
-
- /* Make sure we have a key and that it is valid. */
- if (empty($key) || (substr($key, 0, 1) == '_')) {
- return false;
- }
-
- /* We might need to override some of the defaults with
- * environment-wide settings. Do NOT use the global $backends
- * variable as it may not exist. */
- require GOLLEM_BASE . '/config/backends.php';
- if (empty($backends[$key])) {
- $entry = sprintf('Invalid server key from client [%s]', $_SERVER['REMOTE_ADDR']);
- Horde::logMessage($entry, __FILE__, __LINE__, PEAR_LOG_INFO);
- return false;
- }
-
- /* Create gollem session object if it doesn't already exist. */
- if (!isset($_SESSION['gollem'])) {
- $_SESSION['gollem'] = array();
- $_SESSION['gollem']['backends'] = array();
- $_SESSION['gollem']['selectlist'] = array();
- }
- $_SESSION['gollem']['backends'][$key] = $backends[$key];
- $GLOBALS['gollem_be'] = &$_SESSION['gollem']['backends'][$key];
- $ptr = &$_SESSION['gollem']['backends'][$key];
- $ptr['params'] = array_merge($ptr['params'], $args);
-
- /* Set the current backend as active. */
- $_SESSION['gollem']['backend_key'] = $key;
-
- /* Set username now. Don't set the current username if the backend
- * already has a username defined. */
- if (empty($ptr['params']['username'])) {
- $ptr['params']['username'] = ($user === null) ? Horde_Auth::getBareAuth() : $user;
- }
-
- /* Set password now. The password should always be encrypted within
- * the session. */
- if (!empty($ptr['params']['password'])) {
- $pass = $ptr['params']['password'];
- }
- if ($pass === null) {
- $ptr['params']['password'] = null;
- } else {
- $ptr['params']['password'] = Horde_Secret::write(Horde_Secret::getKey('gollem'), $pass);
- }
-
- /* Try to authenticate with the given information. */
- $auth_gollem = new Gollem_Auth();
- if ($auth_gollem->authenticate(null, null, true) !== true) {
- unset($_SESSION['gollem']['backends'][$key]);
- $_SESSION['gollem']['backend_key'] = null;
- return false;
- }
-
- // Make sure we have a 'root' parameter.
- if (empty($ptr['root'])) {
- $ptr['root'] = '/';
- }
- $ptr['root'] = Horde_Util::realPath($ptr['root']);
-
- // Make sure we have a 'home' parameter.
- if (empty($ptr['home'])) {
- $ptr['home'] = (!empty($ptr['params']['home'])) ? $ptr['params']['home'] : $GLOBALS['gollem_vfs']->getCurrentDirectory();
- if (empty($ptr['home'])) {
- $ptr['home'] = $ptr['root'];
- }
- }
-
- // Make sure the home parameter lives under root if it is a relative
- // directory.
- if (strpos($ptr['home'], '/') !== 0) {
- $ptr['home'] = $ptr['root'] . '/' . $ptr['home'];
- }
- $ptr['home'] = Horde_Util::realPath($ptr['home']);
- $ptr['dir'] = $ptr['home'];
-
- // Verify that home is below root.
- if (!Gollem::verifyDir($ptr['home'])) {
- $error_msg = 'Backend Configuration Error: Home directory not below root.';
- $auth_gollem->gollemSetAuthErrorMsg($error_msg);
- Horde::logMessage(PEAR::raiseError($error_msg), __FILE__, __LINE__, PEAR_LOG_ERR);
- unset($_SESSION['gollem']['backends'][$key]);
- $_SESSION['gollem']['backend_key'] = null;
- return false;
- }
-
- /* Create the home directory if it doesn't already exist. */
- if (($ptr['home'] != '/') && !empty($ptr['createhome'])) {
- $pos = strrpos($ptr['home'], '/');
- $cr_dir = substr($ptr['home'], 0, $pos);
- $cr_file = substr($ptr['home'], $pos + 1);
- if (!$GLOBALS['gollem_vfs']->exists($cr_dir, $cr_file)) {
- $res = Gollem::createFolder($cr_dir, $cr_file);
- if (is_a($res, 'PEAR_Error')) {
- $error_msg = 'Backend Configuration Error: Could not create home directory ' . $ptr['home'] . '.';
- $auth_gollem->gollemSetAuthErrorMsg($error_msg);
- Horde::logMessage(PEAR::raiseError($error_msg), __FILE__, __LINE__, PEAR_LOG_ERR);
- unset($_SESSION['gollem']['backends'][$key]);
- $_SESSION['gollem']['backend_key'] = null;
- return false;
- }
- }
- }
-
- /* Does this driver support autologin? */
- $ptr['autologin'] = Gollem::canAutoLogin(true);
-
- /* Cache the backend_list in the session. */
- if (empty($_SESSION['gollem']['be_list'])) {
- Gollem::loadBackendList();
- $_SESSION['gollem']['be_list'] = $GLOBALS['gollem_backends'];
- }
-
- /* Initialize clipboard. */
- if (!isset($_SESSION['gollem']['clipboard'])) {
- $_SESSION['gollem']['clipboard'] = array();
- }
-
- /* Call Gollem::changeDir() to make sure the label is set. */
- Gollem::changeDir();
-
- return true;
- }
-
- /**
- * Change the currently active backend.
- *
- * @param string $key The ID of the backend to set as active.
- */
- function changeBackend($key)
- {
- $_SESSION['gollem']['backend_key'] = $key;
- $GLOBALS['gollem_be'] = &$_SESSION['gollem']['backends'][$key];
- }
-
-}
+++ /dev/null
-<?php
-/**
- * Script to determine the correct *_BASE values.
- *
- * Copyright 2009 The Horde Project (http://www.horde.org/)
- *
- * See the enclosed file COPYING for license information (GPL). If you
- * did not receive this file, see http://www.fsf.org/copyleft/gpl.html.
- *
- * @package Gollem
- */
-
-if (!defined('GOLLEM_BASE')) {
- define('GOLLEM_BASE', dirname(__FILE__) . '/..');
-}
-
-if (!defined('HORDE_BASE')) {
- /* If horde does not live directly under the app directory, the HORDE_BASE
- * constant should be defined in lib/horde.local.php. */
- if (file_exists(GOLLEM_BASE . '/config/horde.local.php')) {
- include GOLLEM_BASE . '/config/horde.local.php';
- } else {
- define('HORDE_BASE', GOLLEM_BASE . '/..');
- }
-}
+++ /dev/null
-<?php
-/**
- * Gollem base inclusion file. This file brings in all of the
- * dependencies that every Gollem script will need, and sets up
- * objects that all scripts use.
- *
- * The following variables, defined in the script that calls this one, are
- * used:
- * $gollem_authentication - The authentication mode to use.
- * $gollem_session_control - Sets special session control limitations.
- *
- * This file creates the following global variables:
- * $gollem_backends - A link to the current list of available backends
- * $gollem_be - A link to the current backend parameters in the session
- * $gollem_vfs - A link to the current VFS object for the active backend
- *
- * See the enclosed file COPYING for license information (GPL). If you
- * did not receive this file, see http://www.fsf.org/copyleft/gpl.html.
- */
-
-// Determine BASE directories.
-require_once dirname(__FILE__) . '/base.load.php';
-
-// Load the Horde Framework core, and set up inclusion paths.
-require_once HORDE_BASE . '/lib/core.php';
-
-// Registry.
-if (Horde_Util::nonInputVar('gollem_session_control') == 'readonly') {
- $registry = Horde_Registry::singleton(Horde_Registry::SESSION_READONLY);
-} else {
- $registry = Horde_Registry::singleton();
-}
-
-try {
- $registry->pushApp('gollem', array('check_perms' => (Horde_Util::nonInputVar('gollem_authentication') != 'none'), 'logintasks' => true));
-} catch (Horde_Exception $e) {
- Horde_Auth::authenticateFailure('gollem', $e);
-}
-$conf = &$GLOBALS['conf'];
-define('GOLLEM_TEMPLATES', $registry->get('templates'));
-
-// Notification system.
-$notification = Horde_Notification::singleton();
-$notification->attach('status');
-
-// Start compression.
-Horde::compressOutput();
-
-// Set the global $gollem_be variable to the current backend's parameters.
-if (empty($_SESSION['gollem']['backend_key'])) {
- $GLOBALS['gollem_be'] = null;
-} else {
- $GLOBALS['gollem_be'] = &$_SESSION['gollem']['backends'][$_SESSION['gollem']['backend_key']];
-}
-
-// Load the backend list.
-Gollem::loadBackendList();
* @package Gollem
*/
-require_once dirname(__FILE__) . '/lib/base.php';
+require_once dirname(__FILE__) . '/lib/Application.php';
+new Gollem_Application(array('init' => true));
$actionID = Horde_Util::getFormData('actionID');
$backkey = $_SESSION['gollem']['backend_key'];
* did not receive this file, see http://www.fsf.org/copyleft/gpl.html.
*/
-require_once dirname(__FILE__) . '/lib/base.php';
+require_once dirname(__FILE__) . '/lib/Application.php';
+new Gollem_Application(array('init' => true));
if (!Horde_Auth::isAdmin()) {
Horde::authenticationFailureRedirect('gollem');
* @author Michael Slusarz <slusarz@horde.org>
*/
-require_once dirname(__FILE__) . '/lib/base.php';
+require_once dirname(__FILE__) . '/lib/Application.php';
+new Gollem_Application(array('init' => true));
/* Is this a popup window? */
$isPopup = $browser->hasFeature('javascript');
* @author Michael Slusarz <slusarz@horde.org>
*/
-$gollem_authentication = 'selectlist';
-require_once dirname(__FILE__) . '/lib/base.php';
+require_once dirname(__FILE__) . '/lib/Application.php';
+new IMP_Application(array('init' => array('authentication' => 'selectlist'));
/* Set directory. */
if (is_a($result = Gollem::changeDir(), 'PEAR_Error')) {
*/
/* Include Horde's core.php file. */
-require_once dirname(__FILE__) . '/lib/base.load.php';
-require_once '../lib/core.php';
+require_once dirname(__FILE__) . '/lib/Application.php';
/* We should have loaded the String class, from the Horde_Util
package, in core.php. If Horde_String:: isn't defined, then we're not
/* Gollem version. */
$module = 'Gollem';
-require_once dirname(__FILE__) . '/lib/Application.php';
$app = new Gollem_Application();
$module_version = $app->version;
* @author Chuck Hagenbuch <chuck@horde.org>
*/
-$gollem_session_control = 'readonly';
-require_once dirname(__FILE__) . '/lib/base.php';
+require_once dirname(__FILE__) . '/lib/Application.php';
+new IMP_Application(array('init' => array('session_control' => 'readonly'));
$actionID = Horde_Util::getFormData('actionID');
$driver = Horde_Util::getFormData('driver');