]> CyberLeo.Net >> Repos - SourceForge/phpwiki.git/blob - themes/default/templates/login.tmpl
fixed PersonalPage warning: check if isset($user->_prefs->_select)
[SourceForge/phpwiki.git] / themes / default / templates / login.tmpl
1 <?php // -*-php-*- ?>
2 <!-- $Id: login.tmpl,v 1.31 2004-05-02 14:17:21 rurban Exp $ -->
3 <!-- The login form -->
4
5 <?php if ($fail_message) { ?>
6   <p><strong><?=$fail_message?></strong></p>
7   <hr noshade="noshade" />
8 <?php } ?>
9 <?php /* br past the logo */ ?>
10 <br class="clear-floats" />
11
12 <?php 
13 if (DEBUG) {
14   $t = sprintf("  DEBUG: ALLOW_ANON_EDIT = %s, ALLOW_BOGO_LOGIN = %s, ALLOW_USER_PASSWORDS = %s", 
15                ALLOW_ANON_EDIT ? "true" : "false",
16                ALLOW_BOGO_LOGIN ? "true" : "false",
17                ALLOW_USER_PASSWORDS ? "true" : "false");
18   if (ALLOW_USER_PASSWORDS) {
19     $t .= sprintf("  USER_AUTH_ORDER: %s",join(" => ",$GLOBALS['USER_AUTH_ORDER'])) .
20          sprintf(",  USER_AUTH_POLICY: %s",USER_AUTH_POLICY) .
21          sprintf(",  PASSWORD_LENGTH_MINIMUM: %s",PASSWORD_LENGTH_MINIMUM);
22   }
23   echo asXML(HTML::div(array('class' => 'debug'),$t));
24   echo "<br />\n";
25 }
26 if (ALLOW_BOGO_LOGIN && $require_level <= WIKIAUTH_BOGO) {
27   require_once("lib/BlockParser.php");
28   // This iso-8859-1 sample covers French, Spanish, Italian, German, and probably others
29   if (check_php_version(4,3))
30     $examplechars = htmlentities("ÀñíçéàÖãæôßøü", ENT_QUOTES, $charset);
31   elseif (check_php_version(4,0,3))
32     $examplechars = htmlentities("ÀñíçéàÖãæôßøü", ENT_QUOTES);
33   else
34     $examplechars = htmlentities("ÀñíçéàÖãæôßøü");
35   // Japanese login requires utf-8 and ALLOW_NONWIKIWORD_LOGINS
36   if (($charset == 'utf-8') && defined('ALLOW_NONWIKIWORD_LOGINS') && ALLOW_NONWIKIWORD_LOGINS) {
37     //sample Japanese login name in unicode
38     $examplechars = $examplechars . "&#22825;&#36947;&#12354;&#12363;&#12397;";
39   }
40   $t = asXML(TransformText(_("You may sign in using any [WikiWord|AddingPages] as a user id. (Any characters in %s etc. may be used too). The user id will be used as a link in RecentChanges to your home page."), 2.0, true));
41   if (substr_count($t,"%s") == 1) {
42       $s = @sprintf($t, $examplechars);
43       // FIXME: Workaround gettext or sprintf problem
44       if (empty($s)) echo $t;
45       else echo sprintf($t, $examplechars);
46   } else {
47       echo $t;
48   }
49   /* On disabled DbPrefs (PagePrefs only) note the user to create his PersonalPage. */
50   // don't understand why I put this in --rurban
51   if (!isset($user->_prefs->_select)) {
52     echo asXML(TransformText(_("Note: Only if you create your personal HomePage with same the pagename as your user id, you will be able to store your UserPreferences. Otherwise not.")));
53   }
54   if (empty($pass_required)) ?>
55   <p><?= _("New users may use an empty password.") ?></p>
56 <?php } ?>
57
58 <form method="post" action="<?= $request->getPostURL() ?>" accept-charset="<?=CHARSET?>" name="login">
59
60 <table cellspacing="4">
61 <tr>
62   <td align="right"><?= _("UserId:") ?></td>
63   <td><input type="text" name="auth[userid]" size="12" maxlength="256" value="<?=$userid?>" /></td>
64 </tr>
65 <tr>
66   <td align="right"><?= _("Password:") ?></td>
67   <td><input type="password" name="auth[passwd]" size="12" maxlength="256" /></td>
68 </tr>
69 <tr><td align="center" colspan="2">
70   <?=Button("submit:", _("Sign In"), 'wikiaction')?>
71   <?php if (!$require_level) { ?>
72     <?=Button("submit:auth[cancel]", _("Cancel"), 'button')?>
73   <?php } ?>
74 </td></tr>
75 </table>
76
77 <input type="hidden" name="auth[require_level]" value="<?=$require_level?>" />
78 <input type="hidden" name="auth[login]" value="1" />
79 <?= HiddenInputs($request->getArgs(), false, array('auth')) ?>
80 </form>
81
82 <script language="JavaScript" type="text/javascript">
83 <!-- // Really there's got to be a simpler way to do this....
84 function select_input (type) {
85     var elements = document.forms['login'].elements;
86     for (var i = 0; i < elements.length; i++) {
87         if (elements[i].type == type) {
88             elements[i].focus();
89             return;
90         }
91     }
92 }
93 select_input('<?= $userid ? "password" : "text" ?>');
94 //-->
95 </script>