[ Index ]
 

Code source de IMP H3 (4.1.5)

Accédez au Source d'autres logiciels libres

Classes | Fonctions | Variables | Constantes | Tables

title

Body

[fermer]

/templates/login/ -> login.inc (source)

   1  <?php
   2  $server_key = IMP::getAutoLoginServer(true);
   3  $rightAlign = empty($nls['rtl'][$language]) ? 'right' : 'left';
   4  $leftAlign = empty($nls['rtl'][$language]) ? 'left' : 'right';
   5  $tabindex = 1;
   6  
   7  /* Build the <select> widget for the servers and hordeauth servers lists. */
   8  $show_list = ($conf['server']['server_list'] == 'shown');
   9  if ($show_list) {
  10      $hordeauth_servers_list = $servers_list = '';
  11      $isAuth = Auth::isAuthenticated();
  12      foreach ($servers as $key => $val) {
  13          $sel = (IMP::isPreferredServer($val, $key)) ? ' selected="selected"' : '';
  14          $servers_option = "<option value=\"$key\"$sel>" . $val['name'] . '</option>';
  15  
  16          if (empty($curServer['hordeauth']) || !$isAuth) {
  17              $servers_list .= $servers_option;
  18          } elseif ($isAuth) {
  19              $hordeauth_servers_list .= $servers_option;
  20          }
  21      }
  22  }
  23  
  24  /* Build the <select> widget containing the available languages. */
  25  if (!$prefs->isLocked('language')) {
  26      $_SESSION['horde_language'] = NLS::select();
  27      $langs = '';
  28      foreach ($nls['languages'] as $key => $val) {
  29          $sel = ($key == $_SESSION['horde_language']) ? ' selected="selected"' : '';
  30          $langs .= "<option value=\"$key\"$sel>$val</option>";
  31      }
  32  }
  33  ?>
  34  
  35  <script type="text/javascript">
  36  <!--
  37  
  38  function setFocus()
  39  {
  40      if (document.imp_login.imapuser.value == "") {
  41          document.imp_login.imapuser.focus();
  42      } else {
  43          document.imp_login.pass.focus();
  44      }
  45  }
  46  
  47  <?php if ($show_list && !empty($hordeauth_servers_list)): ?>
  48  <?php $reloadurl = Util::addParameter(Horde::selfUrl(), array('autologin' => $autologin, 'server_key' => '')); ?>
  49  function imp_reload()
  50  {
  51      window.top.document.location = '<?php echo $reloadurl ?>' + document.imp_login.server_key[document.imp_login.server_key.selectedIndex].value;
  52  }
  53  <?php endif; ?>
  54  
  55  function submit_login(e)
  56  {
  57      if (typeof e != 'undefined' && !enter_key_trap(e)) {
  58          return;
  59      }
  60  
  61  <?php if ($show_list): ?>
  62      if (document.imp_login.server[document.imp_login.server.selectedIndex].value.substr(0, 1) == "_") {
  63          return false;
  64      }
  65  <?php endif; ?>
  66      if (document.imp_login.imapuser.value == "") {
  67          alert('<?php echo addslashes(_("Please provide your username.")) ?>');
  68          document.imp_login.imapuser.focus();
  69          return false;
  70      } else if (document.imp_login.pass.value == "") {
  71          alert('<?php echo addslashes(_("Please provide your password.")) ?>');
  72          document.imp_login.pass.focus();
  73          return false;
  74      } else {
  75          document.imp_login.loginButton.disabled = true;
  76  <?php if (!empty($ie_clientcaps)): ?>
  77          try {
  78              document.imp_login.ie_version.value = objCCaps.getComponentVersion("{89820200-ECBD-11CF-8B85-00AA005B4383}","componentid");
  79          } catch (e) {
  80          }
  81  <?php endif; ?>
  82          document.imp_login.submit();
  83          return true;
  84      }
  85  }
  86  //-->
  87  </script>
  88  
  89  <form name="imp_login" action="<?php echo $formAction ?>" method="post"<?php echo $imp_auth ? ' target="_parent"' : '' ?>>
  90  <?php Util::pformInput() ?>
  91  <input type="hidden" name="actionID" value="<?php echo htmlspecialchars($actionID) ?>" />
  92  <input type="hidden" name="url" value="<?php echo htmlspecialchars(Util::getFormData('url')) ?>" />
  93  <input type="hidden" name="load_frameset" value="<?php echo $imp_auth ? 1 : 0 ?>" />
  94  <input type="hidden" name="autologin" value="<?php echo $autologin ? 1 : 0 ?>" />
  95  <?php if (!empty($formData)): ?>
  96  <input type="hidden" name="formData" value="<?php echo htmlspecialchars($formData) ?>" />
  97  <?php endif; ?>
  98  <?php if (!empty($ie_clientcaps)): ?>
  99  <input type="hidden" name="ie_version" value="" />
 100  <?php endif; ?>
 101  <?php if (!($show_list && !empty($hordeauth_servers_list))): ?>
 102  <input type="hidden" name="server_key" value="<?php echo htmlspecialchars($server_key) ?>" />
 103  <?php endif; ?>
 104  <?php $args = IMP::getComposeArgs(); foreach ($args as $arg => $value): ?>
 105  <input type="hidden" name="<?php echo htmlspecialchars($arg) ?>" value="<?php echo htmlspecialchars($value) ?>" />
 106  <?php endforeach; ?>
 107  
 108  <div id="menu">
 109  <?php
 110  $menu = &new Menu(HORDE_MENU_MASK_NONE);
 111  $imenu = $menu->render();
 112  if ($imenu): ?>
 113   <span style="float:<?php echo $rightAlign ?>"><?php echo $imenu ?></span>
 114  <?php endif; ?>
 115   <h1 align="center"><?php echo $title ?></h1>
 116  </div>
 117  <?php $notification->notify(array('listeners' => 'status')) ?>
 118  
 119  <table width="100%">
 120   <tr>
 121    <td align="center">
 122     <table align="center">
 123  
 124  <?php if (!empty($reason)): ?>
 125      <tr>
 126       <td colspan="2" class="notice"><?php echo $reason ?></td>
 127      </tr>
 128  <?php endif; ?>
 129  
 130  <?php if ($show_list && !empty($hordeauth_servers_list)): ?>
 131      <tr>
 132       <td align="<?php echo $rightAlign ?>" class="light"><strong><?php echo _("Server") ?></strong></td>
 133       <td class="light" align="<?php echo $leftAlign ?>">
 134        <select tabindex="<?php echo $tabindex++ ?>" name="server_key" onchange="imp_reload();">
 135  <?php echo $hordeauth_servers_list ?>
 136        </select>
 137        <input tabindex="<?php echo $tabindex++ ?>" type="button" class="button" onclick="imp_reload();" value="<?php echo _("Login") ?>" />
 138       </td>
 139      </tr>
 140  <?php endif; ?>
 141  
 142  <?php if ($show_list && !empty($servers_list)): ?>
 143      <tr>
 144       <td align="<?php echo $rightAlign ?>" class="light"><strong><?php echo _("Server") ?></strong></td>
 145       <td class="light" align="<?php echo $leftAlign ?>">
 146        <select tabindex="<?php echo $tabindex++ ?>" name="server"><?php echo $servers_list ?></select>
 147       </td>
 148      </tr>
 149  <?php elseif (!empty($conf['server']['change_server'])): ?>
 150      <tr>
 151       <td align="<?php echo $rightAlign ?>" class="light"><strong><?php echo _("Server") ?></strong></td>
 152       <td align="<?php echo $leftAlign ?>" class="light">
 153        <input type="text" tabindex="<?php echo $tabindex++ ?>" name="server" value="<?php echo Util::getFormData('server', $server_key) ?>" onchange="serverChangeHandler()" style="direction:ltr" />
 154  
 155  <?php if (!empty($conf['server']['change_port'])): ?>
 156        <input type="text" size="4" name="port" tabindex="<?php echo $tabindex++ ?>" value="<?php echo Util::getFormData('port', $servers[$server_key]['port']) ?>" style="direction:ltr" />
 157  <?php endif; ?>
 158  
 159  <?php if (!empty($conf['server']['change_protocol'])): ?>
 160  <?php $protocol = Util::getFormData('protocol', $servers[$server_key]['protocol']) ?>
 161        <select tabindex="<?php echo $tabindex++ ?>" name="protocol" onchange="updatePort();">
 162         <option value="imap"<?php if ($protocol == 'imap') echo ' selected="selected"' ?>>IMAP</option>
 163         <option value="imap/notls"<?php if ($protocol == 'imap/notls') echo ' selected="selected"' ?>><?php echo _("IMAP, no TLS") ?></option>
 164         <option value="imap/ssl"<?php if ($protocol == 'imap/ssl') echo ' selected="selected"' ?>><?php echo _("IMAP over SSL") ?></option>
 165         <option value="imap/ssl/novalidate-cert"<?php if ($protocol == 'imap/ssl/novalidate-cert') echo ' selected="selected"' ?>><?php echo _("IMAP over SSL (self-signed)") ?></option>
 166         <option value="pop3"<?php if ($protocol == 'pop3') echo ' selected="selected"' ?>>POP3</option>
 167         <option value="pop3/ssl/novalidate-cert"<?php if ($protocol == 'pop3/ssl/novalidate-cert') echo ' selected="selected"' ?>><?php echo _("POP3 over SSL (self-signed)") ?></option>
 168        </select>
 169  <?php endif; ?>
 170  
 171       </td>
 172      </tr>
 173  <?php endif; ?>
 174      <tr>
 175       <td align="<?php echo $rightAlign ?>" class="light"><strong><?php echo _("Username") ?></strong></td>
 176       <td align="<?php echo $leftAlign ?>" class="light" nowrap="nowrap">
 177        <input type="text" tabindex="<?php echo $tabindex++ ?>" name="imapuser" value="<?php echo htmlspecialchars(Util::getFormData('imapuser')) ?>" style="direction:ltr" />
 178  <?php
 179      if (!empty($conf['hooks']['vinfo'])) {
 180          @include_once HORDE_BASE . '/config/hooks.php';
 181          if (function_exists('_imp_hook_vinfo')) {
 182              echo '<strong>@' . call_user_func('_imp_hook_vinfo', 'vdomain') . '</strong>';
 183          }
 184      }
 185  ?>
 186       </td>
 187      </tr>
 188  
 189      <tr>
 190       <td align="<?php echo $rightAlign ?>" class="light"><strong><?php echo _("Password") ?></strong></td>
 191       <td align="<?php echo $leftAlign ?>">
 192        <input type="password" tabindex="<?php echo $tabindex++ ?>" name="pass" style="direction:ltr" />
 193       </td>
 194      </tr>
 195  
 196  <?php if (!empty($conf['server']['change_smtphost'])): ?>
 197      <tr style="height: 1em;"><td colspan="2"></td></tr>
 198      <tr>
 199       <td align="<?php echo $rightAlign ?>" class="light"><strong><?php echo _("Outbound Server") ?></strong></td>
 200       <td align="<?php echo $leftAlign ?>" class="light">
 201        <input type="text" tabindex="<?php echo $tabindex++ ?>" name="smtphost" value="<?php echo Util::getFormData('smtphost', $server_key) ?>" style="direction:ltr" />
 202  <?php if (!empty($conf['server']['change_smtpport'])): ?>
 203        <input type="text" size="4" name="smtpport" tabindex="<?php echo $tabindex++ ?>" value="<?php echo Util::getFormData('smtpport', $servers[$server_key]['smtpport']) ?>" style="direction:ltr" /> <?php echo _("SMTP"); ?>
 204  <?php endif; ?>
 205       </td>
 206      </tr>
 207  <?php endif; ?>
 208  
 209  <?php if (!empty($conf['server']['change_smtphost'])): ?>
 210      <tr style="height: 1em;"><td colspan="2"></td></tr>
 211  <?php endif; ?>
 212  <?php if (!$prefs->isLocked('language')): ?>
 213      <tr>
 214       <td align="<?php echo $rightAlign ?>" class="light"><strong><?php echo _("Language") ?></strong></td>
 215       <td align="<?php echo $leftAlign ?>" class="light">
 216        <select tabindex="<?php echo $tabindex++ ?>" name="new_lang" onchange="selectLang()" style="direction:ltr"><?php echo $langs ?></select> </td>
 217      </tr>
 218  <?php endif; ?>
 219  
 220      <tr>
 221       <td>&nbsp;</td>
 222       <td align="<?php echo $leftAlign ?>" class="light">
 223        <input type="submit" class="button" name="loginButton" tabindex="<?php echo $tabindex++ ?>" value="<?php echo _("Log in") ?>" onclick="return submit_login();" />
 224       </td>
 225      </tr>
 226  
 227  <?php if ($conf['signup']['allow'] && isset($auth) && $auth->hasCapability('add')): ?>
 228      <tr>
 229       <td>&nbsp;</td>
 230       <td class="light"><?php echo Horde::link(Util::addParameter(Horde::url($registry->get('webroot', 'horde') . '/signup.php'), 'url', Util::getFormData('url')), _("Don't have an account? Sign up."), 'light') . _("Don't have an account? Sign up.") ?></a></td>
 231      </tr>
 232  <?php endif; ?>
 233  
 234     </table>
 235    </td>
 236   </tr>
 237  </table>
 238  </form>
 239  
 240  <script type="text/javascript">
 241  <!--
 242  
 243  <?php if (!empty($conf['server']['change_protocol'])): ?>
 244  function updatePort()
 245  {
 246  <?php if (!empty($conf['server']['change_port'])): ?>
 247      if (document.imp_login.protocol.options[document.imp_login.protocol.selectedIndex].value == 'imap') {
 248          document.imp_login.port.value = 143;
 249      } else if (document.imp_login.protocol.options[document.imp_login.protocol.selectedIndex].value == 'imap/ssl' ||
 250                 document.imp_login.protocol.options[document.imp_login.protocol.selectedIndex].value == 'imap/ssl/novalidate-cert') {
 251          document.imp_login.port.value = 993;
 252      } else if (document.imp_login.protocol.options[document.imp_login.protocol.selectedIndex].value == 'pop3') {
 253          document.imp_login.port.value = 110;
 254      } else if (document.imp_login.protocol.options[document.imp_login.protocol.selectedIndex].value == 'pop3/ssl' ||
 255                 document.imp_login.protocol.options[document.imp_login.protocol.selectedIndex].value == 'pop3/ssl/novalidate-cert') {
 256          document.imp_login.port.value = 995;
 257      }
 258  <?php endif; ?>
 259  }
 260  <?php endif; ?>
 261  
 262  <?php if (!empty($conf['server']['change_server'])): ?>
 263  function serverChangeHandler(ctl)
 264  {
 265  <?php if (!empty($conf['server']['change_smtphost'])): ?>
 266      document.imp_login.smtphost.value = document.imp_login.server.value;
 267  <?php endif; ?>
 268  }
 269  <?php endif; ?>
 270  
 271  <?php if (!$prefs->isLocked('language')): ?>
 272  function selectLang()
 273  {
 274      // We need to reload the login page here, but only if the user hasn't
 275      // already entered a username and password.
 276      if (document.imp_login.imapuser.value == '' &&
 277          document.imp_login.pass.value == '') {
 278          var lang_page = 'login.php?new_lang=' + document.imp_login.new_lang[document.imp_login.new_lang.selectedIndex].value;
 279  <?php
 280      $url = Util::getFormData('url');
 281      if (!empty($url)) {
 282          echo "lang_page += '&url=" . urlencode($url) . "';";
 283      }
 284  ?>
 285          self.location = lang_page;
 286      }
 287  }
 288  <?php endif; ?>
 289  
 290  <?php if ($imp_auth): ?>
 291  if (parent.frames.horde_main) {
 292      document.imp_login.target = '_parent';
 293  }
 294  <?php endif; ?>
 295  
 296  // Set up the enter keytrap code.
 297  if (typeof document.captureEvents != 'undefined') {
 298      document.captureEvents(Event.KEYPRESS);
 299      document.onkeypress = submit_login;
 300  }
 301  //-->
 302  </script>


Généré le : Thu Nov 29 12:30:07 2007 par Balluche grâce à PHPXref 0.7
  Clicky Web Analytics