From: <gem...@li...> - 2012-03-28 09:27:48
|
Revision: 568 http://gemstracker.svn.sourceforge.net/gemstracker/?rev=568&view=rev Author: matijsdejong Date: 2012-03-28 09:27:38 +0000 (Wed, 28 Mar 2012) Log Message: ----------- Adjusted for case where error reporting went wrong. Plus patch for situation were users are added with NoLogin but as active. Modified Paths: -------------- trunk/library/classes/GemsEscort.php trunk/library/configs/db/patches.sql trunk/library/configs/db/tables/gems__user_logins.10.sql Modified: trunk/library/classes/GemsEscort.php =================================================================== --- trunk/library/classes/GemsEscort.php 2012-03-27 16:39:04 UTC (rev 567) +++ trunk/library/classes/GemsEscort.php 2012-03-28 09:27:38 UTC (rev 568) @@ -736,20 +736,23 @@ { $user = $this->getLoader()->getCurrentUser(); - $div = MUtil_Html::create('div', array('id' => 'login'), $args); + // During error reporting the user or menu are not always known. + if ($user && $this->menu) { + $div = MUtil_Html::create('div', array('id' => 'login'), $args); - $p = $div->p(); - if ($user->isActive()) { - $p->append(sprintf($this->_('You are logged in as %s'), $user->getFullName())); - $item = $this->menu->findController('index', 'logoff'); - $p->a($item->toHRefAttribute(), $this->_('Logoff'), array('class' => 'logout')); - } else { - $item = $this->menu->findController('index', 'login'); - $p->a($item->toHRefAttribute(), $this->_('You are not logged in'), array('class' => 'logout')); + $p = $div->p(); + if ($user->isActive()) { + $p->append(sprintf($this->_('You are logged in as %s'), $user->getFullName())); + $item = $this->menu->findController('index', 'logoff'); + $p->a($item->toHRefAttribute(), $this->_('Logoff'), array('class' => 'logout')); + } else { + $item = $this->menu->findController('index', 'login'); + $p->a($item->toHRefAttribute(), $this->_('You are not logged in'), array('class' => 'logout')); + } + $item->set('visible', false); + + return $div; } - $item->set('visible', false); - - return $div; } /** Modified: trunk/library/configs/db/patches.sql =================================================================== --- trunk/library/configs/db/patches.sql 2012-03-27 16:39:04 UTC (rev 567) +++ trunk/library/configs/db/patches.sql 2012-03-28 09:27:38 UTC (rev 568) @@ -386,3 +386,6 @@ -- PATCH: Add block until to ALTER TABLE gems__user_login_attempts ADD gula_block_until timestamp null AFTER gula_last_failed; + +-- PATCH: logins are sometimes added autmatically as part of outer join +ALTER TABLE gems__user_logins CHANGE gul_can_login gul_can_login boolean not null default 0; Modified: trunk/library/configs/db/tables/gems__user_logins.10.sql =================================================================== --- trunk/library/configs/db/tables/gems__user_logins.10.sql 2012-03-27 16:39:04 UTC (rev 567) +++ trunk/library/configs/db/tables/gems__user_logins.10.sql 2012-03-28 09:27:38 UTC (rev 568) @@ -8,7 +8,7 @@ gul_id_organization bigint not null references gems__organizations (gor_id_organization), gul_user_class varchar(30) CHARACTER SET 'utf8' COLLATE 'utf8_general_ci' not null default 'NoLogin', - gul_can_login boolean not null default 1, + gul_can_login boolean not null default 0, gul_changed timestamp not null default current_timestamp on update current_timestamp, gul_changed_by bigint unsigned not null, This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |