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