Caravel CMS PHP Cross Reference Content Management Systems

Source: /apps/Login/Login.php - 81 lines - 2703 bytes - Summary - Text - Print

   1  <?php
   2  class Login extends App
   3      {
   4  	function getContent()
   5          {
   6          if (Auth::isLoggedIn())
   7              {
   8              $f = FormWidget::init(Utility::link($this->sectionPathArray, array('logout' => 1)), 'form.nonsettings.tpl.html');
   9              $msg = str_replace('|T_USER|', T_USER, $this->settingsVars['msg']);
  10              $f->html('<h2>' . $msg . '</h2>');
  11              if ($this->settingsVars['logout'])
  12                  {
  13                  $f->section();
  14                  $f->submit('logout', 'Logout');
  15                  }
  16              return $f->get();
  17              }
  18  
  19          $link = Utility::link($this->sectionPathArray, array('id' => T_SITE_ID), true);
  20          $f = FormWidget::init($link, "form.nonsettings.tpl.html");
  21          $f->html('<table style="width: 100%;"><tr style="width: 100%;"><td style="width: 60px;">Username:</td><td>');
  22          $f->text('uid','','', array('style' => 'max-width: 220px; width: 90%;'));
  23          $f->html('</td></tr><tr><td>Password:</td><td>');
  24          $f->password('password','','', array('style' => 'max-width: 220px; width: 90%;'));
  25          $f->html('</td></tr></table>');
  26          $f->html('<div id="' . $this->paramName("cv_login_text") . '">');
  27          $f->checkbox('remember', 0, 'Remember me?');
  28          $f->html("</div>");
  29                  $f->html('<div id="' . $this->paramName("cv_login_button") . '">');
  30          $f->submit('login', 'Log in');
  31          $f->html("</div>");
  32          $f->hidden('target', $this->settingsVars['target']);
  33          
  34          $m = @$this->httpVars['loginMsg'];
  35                  
  36          return $m . str_replace($this->paramName(''), '', $f->get());
  37          }
  38  
  39  	function onInit()
  40          {
  41          if (!isset($this->settingsVars['msg'])) $this->settingsVars['msg'] = 'Welcome!';
  42          if (!isset($this->settingsVars['logout'])) $this->settingsVars['logout'] = 1;
  43          if (!isset($this->settingsVars['target'])) $this->settingsVars['target'] = '';
  44          }
  45  
  46  	function getConfig()
  47          {
  48          $f = FormWidget::init();
  49          $f->section();
  50          
  51          $f->field('Welcome Message');
  52          $f->text('msg', $this->settingsVars['msg'], null, array('style' => 'width: 100%'));
  53          $f->html('<br />(This message will be shown when the user is logged in.)');
  54          
  55          $f->field();
  56          $f->checkbox('logout', $this->settingsVars['logout'], 'Display logout button when user is logged in.');
  57          
  58          $f->field('Redirect to:');
  59          $f->pageList('target', $this->settingsVars['target'], '(this page)');
  60          
  61          $f->field();
  62          $f->defaultButtons();
  63          return $f->get();
  64          }
  65          
  66  	function onSave()
  67          {
  68          $this->settingsVars['msg'] = $this->httpVars['msg'];
  69          $this->settingsVars['logout'] = isset($this->httpVars['logout']) ? 1 : 0;
  70          $this->settingsVars['target'] = $this->httpVars['target'];
  71          $this->saveSettings($this->settingsVars);
  72          }
  73  
  74  	function getLogin()
  75          {
  76          $appTitle = $GLOBALS['apps'][$this->appID]['name'];
  77          $this->httpVars['loginMsg'] = "You must log in before using this.";
  78          return $m . Login::getContent();
  79          }
  80      }
  81  ?>

title

Description

title

Description

title

Description

title

title

Body