Backend\Core\Engine\Authentication::getUser PHP Méthode

getUser() public static méthode

Returns the current authenticated user
public static getUser ( ) : User
Résultat User
    public static function getUser()
    {
        // if the user-object doesn't exist create a new one
        if (self::$user === null) {
            self::$user = new User();
        }
        return self::$user;
    }

Usage Example

Exemple #1
0
 /**
  * Load the form
  */
 private function loadForm()
 {
     $this->isGod = BackendAuthentication::getUser()->isGod();
     $this->frm = new BackendForm('settingsEmail');
     // email settings
     $mailerFrom = $this->get('fork.settings')->get('Core', 'mailer_from');
     $this->frm->addText('mailer_from_name', isset($mailerFrom['name']) ? $mailerFrom['name'] : '');
     $this->frm->addText('mailer_from_email', isset($mailerFrom['email']) ? $mailerFrom['email'] : '')->setAttribute('type', 'email');
     $mailerTo = $this->get('fork.settings')->get('Core', 'mailer_to');
     $this->frm->addText('mailer_to_name', isset($mailerTo['name']) ? $mailerTo['name'] : '');
     $this->frm->addText('mailer_to_email', isset($mailerTo['email']) ? $mailerTo['email'] : '')->setAttribute('type', 'email');
     $mailerReplyTo = $this->get('fork.settings')->get('Core', 'mailer_reply_to');
     $this->frm->addText('mailer_reply_to_name', isset($mailerReplyTo['name']) ? $mailerReplyTo['name'] : '');
     $this->frm->addText('mailer_reply_to_email', isset($mailerReplyTo['email']) ? $mailerReplyTo['email'] : '')->setAttribute('type', 'email');
     if ($this->isGod) {
         $mailerType = $this->get('fork.settings')->get('Core', 'mailer_type', 'mail');
         $this->frm->addDropdown('mailer_type', array('mail' => 'PHP\'s mail', 'smtp' => 'SMTP'), $mailerType);
         // smtp settings
         $this->frm->addText('smtp_server', $this->get('fork.settings')->get('Core', 'smtp_server', ''));
         $this->frm->addText('smtp_port', $this->get('fork.settings')->get('Core', 'smtp_port', 25));
         $this->frm->addText('smtp_username', $this->get('fork.settings')->get('Core', 'smtp_username', ''));
         $this->frm->addPassword('smtp_password', $this->get('fork.settings')->get('Core', 'smtp_password', ''));
         $this->frm->addDropdown('smtp_secure_layer', array('no' => ucfirst(BL::lbl('None')), 'ssl' => 'SSL', 'tls' => 'TLS'), $this->get('fork.settings')->get('Core', 'smtp_secure_layer', 'no'));
     }
     $this->tpl->assign('isGod', $this->isGod);
 }
All Usage Examples Of Backend\Core\Engine\Authentication::getUser