diff options
Diffstat (limited to 'app')
-rw-r--r-- | app/Core/Helper.php | 32 | ||||
-rw-r--r-- | app/Helper/Url.php | 4 | ||||
-rw-r--r-- | app/Model/TaskFilter.php | 6 |
3 files changed, 33 insertions, 9 deletions
diff --git a/app/Core/Helper.php b/app/Core/Helper.php index 53084a7e..e4f225b0 100644 --- a/app/Core/Helper.php +++ b/app/Core/Helper.php @@ -2,6 +2,8 @@ namespace Core; +use Pimple\Container; + /** * Helper base class * @@ -19,16 +21,34 @@ namespace Core; * @property \Helper\Url $url * @property \Helper\User $user */ -class Helper extends Base +class Helper { /** * Helper instances * - * @static * @access private * @var array */ - private static $helpers = array(); + private $helpers = array(); + + /** + * Container instance + * + * @access protected + * @var \Pimple\Container + */ + protected $container; + + /** + * Constructor + * + * @access public + * @param \Pimple\Container $container + */ + public function __construct(Container $container) + { + $this->container = $container; + } /** * Load automatically helpers @@ -39,12 +59,12 @@ class Helper extends Base */ public function __get($name) { - if (! isset(self::$helpers[$name])) { + if (! isset($this->helpers[$name])) { $class = '\Helper\\'.ucfirst($name); - self::$helpers[$name] = new $class($this->container); + $this->helpers[$name] = new $class($this->container); } - return self::$helpers[$name]; + return $this->helpers[$name]; } /** diff --git a/app/Helper/Url.php b/app/Helper/Url.php index e133f195..8de63f8d 100644 --- a/app/Helper/Url.php +++ b/app/Helper/Url.php @@ -99,6 +99,10 @@ class Url extends \Core\Base */ public function server() { + if (empty($_SERVER['SERVER_NAME'])) { + return 'http://localhost/'; + } + $self = str_replace('\\', '/', dirname($_SERVER['PHP_SELF'])); $url = Request::isHTTPS() ? 'https://' : 'http://'; diff --git a/app/Model/TaskFilter.php b/app/Model/TaskFilter.php index c88be830..082318f1 100644 --- a/app/Model/TaskFilter.php +++ b/app/Model/TaskFilter.php @@ -716,11 +716,11 @@ class TaskFilter extends Base $vEvent->setSummary(t('#%d', $task['id']).' '.$task['title']); $vEvent->setUrl($this->helper->url->base().$this->helper->url->to('task', 'show', array('task_id' => $task['id'], 'project_id' => $task['project_id']))); - if (! empty($task['creator_id'])) { - $vEvent->setOrganizer('MAILTO:'.($task['creator_email'] ?: $task['creator_username'].'@kanboard.local')); + if (! empty($task['owner_id'])) { + $vEvent->setOrganizer('MAILTO:'.($task['assignee_email'] ?: $task['assignee_username'].'@kanboard.local')); } - if (! empty($task['owner_id'])) { + if (! empty($task['creator_id'])) { $attendees = new Attendees; $attendees->add('MAILTO:'.($task['creator_email'] ?: $task['creator_username'].'@kanboard.local')); $vEvent->setAttendees($attendees); |