Gollem::changeDir PHP Method

changeDir() public static method

Changes the current directory of the Gollem session based on the 'dir' form field.
public static changeDir ( )
    public static function changeDir()
    {
        $dir = Horde_Util::getFormData('dir');
        if (is_null($dir)) {
            self::_setLabel();
        } else {
            if (strpos($dir, '/') !== 0) {
                $dir = self::$backend['dir'] . '/' . $dir;
            }
            self::setDir($dir);
        }
    }

Usage Example

Ejemplo n.º 1
0
 * did not receive this file, see http://www.horde.org/licenses/gpl.
 *
 * @author   Max Kalika <*****@*****.**>
 * @author   Chuck Hagenbuch <*****@*****.**>
 * @category Horde
 * @license  http://www.horde.org/licenses/gpl GPL
 * @package  Gollem
 */
require_once __DIR__ . '/lib/Application.php';
Horde_Registry::appInit('gollem', array('session_control' => 'readonly'));
$vars = Horde_Variables::getDefaultVariables();
if ($vars->driver != Gollem::$backend['driver']) {
    Horde::url('login.php')->add(array('backend_key' => $vars->driver, 'url' => Horde::selfUrl(true)))->redirect();
}
try {
    Gollem::changeDir();
} catch (Horde_Vfs_Exception $e) {
    $notification->push($e);
}
$gollem_vfs = $injector->getInstance('Gollem_Vfs');
$stream = null;
$data = '';
try {
    if (is_callable(array($gollem_vfs, 'readStream'))) {
        $stream = $gollem_vfs->readStream($vars->dir, $vars->file);
    } else {
        $data = $gollem_vfs->read($vars->dir, $vars->file);
    }
} catch (Horde_Vfs_Exception $e) {
    Horde::log($e, 'NOTICE');
    throw $e;