1<?php
2/**
3 * This class extends the base LoginTasks class in order to ensure Horde
4 * tasks are always run first.
5 *
6 * Copyright 2011-2017 Horde LLC (http://www.horde.org/)
7 *
8 * See the enclosed file COPYING for license information (LGPL). If you
9 * did not receive this file, see http://www.horde.org/licenses/lgpl21.
10 *
11 * @author   Michael Slusarz <slusarz@horde.org>
12 * @category Horde
13 * @license  http://www.horde.org/licenses/lgpl21 LGPL 2.1
14 * @package  Core
15 */
16class Horde_Core_LoginTasks extends Horde_LoginTasks
17{
18    /**
19     * Horde application to run login tasks for.
20     *
21     * @var string
22     */
23    protected $_app;
24
25    /**
26     * @param string $app  Horde application string.
27     */
28    public function __construct(Horde_LoginTasks_Backend $backend, $app)
29    {
30        $this->_app = $app;
31
32        parent::__construct($backend);
33    }
34
35    /**
36     */
37    public function runTasks(array $opts = array())
38    {
39        if (!isset($opts['url'])) {
40            $opts['url'] = Horde::selfUrl(true, true, true);
41        }
42
43        if (($this->_app != 'horde') &&
44            ($GLOBALS['session']->get('horde', 'logintasks') !== true)) {
45            $GLOBALS['injector']->getInstance('Horde_Core_Factory_LoginTasks')->create('horde')->runTasks($opts);
46        }
47
48        parent::runTasks($opts);
49    }
50
51}
52