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