Login.template.php 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308
  1. <?php
  2. /**
  3. * Simple Machines Forum (SMF)
  4. *
  5. * @package SMF
  6. * @author Simple Machines
  7. * @copyright 2011 Simple Machines
  8. * @license http://www.simplemachines.org/about/smf/license.php BSD
  9. *
  10. * @version 2.0
  11. */
  12. // This is just the basic "login" form.
  13. function template_login()
  14. {
  15. global $context, $settings, $options, $scripturl, $modSettings, $txt;
  16. echo '
  17. <script type="text/javascript" src="', $settings['default_theme_url'], '/scripts/sha1.js"></script>
  18. <form action="', $scripturl, '?action=login2" name="frmLogin" id="frmLogin" method="post" accept-charset="', $context['character_set'], '" ', empty($context['disable_login_hashing']) ? ' onsubmit="hashLoginPassword(this, \'' . $context['session_id'] . '\');"' : '', '>
  19. <div class="tborder login">
  20. <div class="cat_bar">
  21. <h3 class="catbg">
  22. <span class="ie6_header floatleft"><img src="', $settings['images_url'], '/icons/login_sm.gif" alt="" class="icon" /> ', $txt['login'], '</span>
  23. </h3>
  24. </div>
  25. <span class="upperframe"><span></span></span>
  26. <div class="roundframe"><br class="clear" />';
  27. // Did they make a mistake last time?
  28. if (!empty($context['login_errors']))
  29. foreach ($context['login_errors'] as $error)
  30. echo '
  31. <p class="error">', $error, '</p>';
  32. // Or perhaps there's some special description for this time?
  33. if (isset($context['description']))
  34. echo '
  35. <p class="description">', $context['description'], '</p>';
  36. // Now just get the basic information - username, password, etc.
  37. echo '
  38. <dl>
  39. <dt>', $txt['username'], ':</dt>
  40. <dd><input type="text" name="user" size="20" value="', $context['default_username'], '" class="input_text" /></dd>
  41. <dt>', $txt['password'], ':</dt>
  42. <dd><input type="password" name="passwrd" value="', $context['default_password'], '" size="20" class="input_password" /></dd>
  43. </dl>';
  44. if (!empty($modSettings['enableOpenID']))
  45. echo '<p><strong>&mdash;', $txt['or'], '&mdash;</strong></p>
  46. <dl>
  47. <dt>', $txt['openid'], ':</dt>
  48. <dd><input type="text" name="openid_identifier" class="input_text openid_login" size="17" />&nbsp;<em><a href="', $scripturl, '?action=helpadmin;help=register_openid" onclick="return reqWin(this.href);" class="help">(?)</a></em></dd>
  49. </dl><hr />';
  50. echo '
  51. <dl>
  52. <dt>', $txt['mins_logged_in'], ':</dt>
  53. <dd><input type="text" name="cookielength" size="4" maxlength="4" value="', $modSettings['cookieTime'], '"', $context['never_expire'] ? ' disabled="disabled"' : '', ' class="input_text" /></dd>
  54. <dt>', $txt['always_logged_in'], ':</dt>
  55. <dd><input type="checkbox" name="cookieneverexp"', $context['never_expire'] ? ' checked="checked"' : '', ' class="input_check" onclick="this.form.cookielength.disabled = this.checked;" /></dd>';
  56. // If they have deleted their account, give them a chance to change their mind.
  57. if (isset($context['login_show_undelete']))
  58. echo '
  59. <dt class="alert">', $txt['undelete_account'], ':</dt>
  60. <dd><input type="checkbox" name="undelete" class="input_check" /></dd>';
  61. echo '
  62. </dl>
  63. <p><input type="submit" value="', $txt['login'], '" class="button_submit" /></p>
  64. <p class="smalltext"><a href="', $scripturl, '?action=reminder">', $txt['forgot_your_password'], '</a></p>
  65. <input type="hidden" name="hash_passwrd" value="" />
  66. </div>
  67. <span class="lowerframe"><span></span></span>
  68. </div></form>';
  69. // Focus on the correct input - username or password.
  70. echo '
  71. <script type="text/javascript"><!-- // --><![CDATA[
  72. document.forms.frmLogin.', isset($context['default_username']) && $context['default_username'] != '' ? 'passwrd' : 'user', '.focus();
  73. // ]]></script>';
  74. }
  75. // Tell a guest to get lost or login!
  76. function template_kick_guest()
  77. {
  78. global $context, $settings, $options, $scripturl, $modSettings, $txt;
  79. // This isn't that much... just like normal login but with a message at the top.
  80. echo '
  81. <script type="text/javascript" src="', $settings['default_theme_url'], '/scripts/sha1.js"></script>
  82. <form action="', $scripturl, '?action=login2" method="post" accept-charset="', $context['character_set'], '" name="frmLogin" id="frmLogin"', empty($context['disable_login_hashing']) ? ' onsubmit="hashLoginPassword(this, \'' . $context['session_id'] . '\');"' : '', '>
  83. <div class="tborder login">
  84. <div class="cat_bar">
  85. <h3 class="catbg">', $txt['warning'], '</h3>
  86. </div>';
  87. // Show the message or default message.
  88. echo '
  89. <p class="information centertext">
  90. ', empty($context['kick_message']) ? $txt['only_members_can_access'] : $context['kick_message'], '<br />
  91. ', $txt['login_below'], ' <a href="', $scripturl, '?action=register">', $txt['register_an_account'], '</a> ', sprintf($txt['login_with_forum'], $context['forum_name_html_safe']), '
  92. </p>';
  93. // And now the login information.
  94. echo '
  95. <div class="cat_bar">
  96. <h3 class="catbg">
  97. <img src="', $settings['images_url'], '/icons/login_sm.gif" alt="" class="icon" /> ', $txt['login'], '
  98. </h3>
  99. </div>
  100. <span class="upperframe"><span></span></span>
  101. <div class="roundframe">
  102. <dl>
  103. <dt>', $txt['username'], ':</dt>
  104. <dd><input type="text" name="user" size="20" class="input_text" /></dd>
  105. <dt>', $txt['password'], ':</dt>
  106. <dd><input type="password" name="passwrd" size="20" class="input_password" /></dd>';
  107. if (!empty($modSettings['enableOpenID']))
  108. echo '
  109. </dl>
  110. <p><strong>&mdash;', $txt['or'], '&mdash;</strong></p>
  111. <dl>
  112. <dt>', $txt['openid'], ':</dt>
  113. <dd><input type="text" name="openid_identifier" class="input_text openid_login" size="17" /></dd>
  114. </dl>
  115. <hr />
  116. <dl>';
  117. echo '
  118. <dt>', $txt['mins_logged_in'], ':</dt>
  119. <dd><input type="text" name="cookielength" size="4" maxlength="4" value="', $modSettings['cookieTime'], '" class="input_text" /></dd>
  120. <dt>', $txt['always_logged_in'], ':</dt>
  121. <dd><input type="checkbox" name="cookieneverexp" class="input_check" onclick="this.form.cookielength.disabled = this.checked;" /></dd>
  122. </dl>
  123. <p class="centertext"><input type="submit" value="', $txt['login'], '" class="button_submit" /></p>
  124. <p class="centertext smalltext"><a href="', $scripturl, '?action=reminder">', $txt['forgot_your_password'], '</a></p>
  125. </div>
  126. <span class="lowerframe"><span></span></span>
  127. <input type="hidden" name="hash_passwrd" value="" />
  128. </div>
  129. </form>';
  130. // Do the focus thing...
  131. echo '
  132. <script type="text/javascript"><!-- // --><![CDATA[
  133. document.forms.frmLogin.user.focus();
  134. // ]]></script>';
  135. }
  136. // This is for maintenance mode.
  137. function template_maintenance()
  138. {
  139. global $context, $settings, $options, $scripturl, $txt, $modSettings;
  140. // Display the administrator's message at the top.
  141. echo '
  142. <script type="text/javascript" src="', $settings['default_theme_url'], '/scripts/sha1.js"></script>
  143. <form action="', $scripturl, '?action=login2" method="post" accept-charset="', $context['character_set'], '"', empty($context['disable_login_hashing']) ? ' onsubmit="hashLoginPassword(this, \'' . $context['session_id'] . '\');"' : '', '>
  144. <div class="tborder login" id="maintenance_mode">
  145. <div class="cat_bar">
  146. <h3 class="catbg">', $context['title'], '</h3>
  147. </div>
  148. <p class="description">
  149. <img class="floatleft" src="', $settings['images_url'], '/construction.png" width="40" height="40" alt="', $txt['in_maintain_mode'], '" />
  150. ', $context['description'], '<br class="clear" />
  151. </p>
  152. <div class="title_bar">
  153. <h4 class="titlebg">', $txt['admin_login'], '</h4>
  154. </div>
  155. <span class="upperframe"><span></span></span>
  156. <div class="roundframe">
  157. <dl>
  158. <dt>', $txt['username'], ':</dt>
  159. <dd><input type="text" name="user" size="20" class="input_text" /></dd>
  160. <dt>', $txt['password'], ':</dt>
  161. <dd><input type="password" name="passwrd" size="20" class="input_password" /></dd>
  162. <dt>', $txt['mins_logged_in'], ':</dt>
  163. <dd><input type="text" name="cookielength" size="4" maxlength="4" value="', $modSettings['cookieTime'], '" class="input_text" /></dd>
  164. <dt>', $txt['always_logged_in'], ':</dt>
  165. <dd><input type="checkbox" name="cookieneverexp" class="input_check" /></dd>
  166. </dl>
  167. <p class="centertext"><input type="submit" value="', $txt['login'], '" class="button_submit" /></p>
  168. </div>
  169. <span class="lowerframe"><span></span></span>
  170. <input type="hidden" name="hash_passwrd" value="" />
  171. </div>
  172. </form>';
  173. }
  174. // This is for the security stuff - makes administrators login every so often.
  175. function template_admin_login()
  176. {
  177. global $context, $settings, $options, $scripturl, $txt;
  178. // Since this should redirect to whatever they were doing, send all the get data.
  179. echo '
  180. <script type="text/javascript" src="', $settings['default_theme_url'], '/scripts/sha1.js"></script>
  181. <form action="', $scripturl, $context['get_data'], '" method="post" accept-charset="', $context['character_set'], '" name="frmLogin" id="frmLogin" onsubmit="hashAdminPassword(this, \'', $context['user']['username'], '\', \'', $context['session_id'], '\');">
  182. <div class="tborder login" id="admin_login">
  183. <div class="cat_bar">
  184. <h3 class="catbg">
  185. <span class="ie6_header floatleft"><img src="', $settings['images_url'], '/icons/login_sm.gif" alt="" class="icon" /> ', $txt['login'], '</span>
  186. </h3>
  187. </div>
  188. <span class="upperframe"><span></span></span>
  189. <div class="roundframe centertext">';
  190. if (!empty($context['incorrect_password']))
  191. echo '
  192. <div class="error">', $txt['admin_incorrect_password'], '</div>';
  193. echo '
  194. <strong>', $txt['password'], ':</strong>
  195. <input type="password" name="admin_pass" size="24" class="input_password" />
  196. <a href="', $scripturl, '?action=helpadmin;help=securityDisable_why" onclick="return reqWin(this.href);" class="help"><img src="', $settings['images_url'], '/helptopics.gif" alt="', $txt['help'], '" /></a><br />
  197. <input type="submit" style="margin-top: 1em;" value="', $txt['login'], '" class="button_submit" />';
  198. // Make sure to output all the old post data.
  199. echo $context['post_data'], '
  200. </div>
  201. <span class="lowerframe"><span></span></span>
  202. </div>
  203. <input type="hidden" name="admin_hash_pass" value="" />
  204. </form>';
  205. // Focus on the password box.
  206. echo '
  207. <script type="text/javascript"><!-- // --><![CDATA[
  208. document.forms.frmLogin.admin_pass.focus();
  209. // ]]></script>';
  210. }
  211. // Activate your account manually?
  212. function template_retry_activate()
  213. {
  214. global $context, $settings, $options, $txt, $scripturl;
  215. // Just ask them for their code so they can try it again...
  216. echo '
  217. <form action="', $scripturl, '?action=activate;u=', $context['member_id'], '" method="post" accept-charset="', $context['character_set'], '">
  218. <div class="title_bar">
  219. <h3 class="titlebg">', $context['page_title'], '</h3>
  220. </div>
  221. <span class="upperframe"><span></span></span>
  222. <div class="roundframe">';
  223. // You didn't even have an ID?
  224. if (empty($context['member_id']))
  225. echo '
  226. <dl>
  227. <dt>', $txt['invalid_activation_username'], ':</dt>
  228. <dd><input type="text" name="user" size="30" class="input_text" /></dd>';
  229. echo '
  230. <dt>', $txt['invalid_activation_retry'], ':</dt>
  231. <dd><input type="text" name="code" size="30" class="input_text" /></dd>
  232. </dl>
  233. <p><input type="submit" value="', $txt['invalid_activation_submit'], '" class="button_submit" /></p>
  234. </div>
  235. <span class="lowerframe"><span></span></span>
  236. </form>';
  237. }
  238. // Activate your account manually?
  239. function template_resend()
  240. {
  241. global $context, $settings, $options, $txt, $scripturl;
  242. // Just ask them for their code so they can try it again...
  243. echo '
  244. <form action="', $scripturl, '?action=activate;sa=resend" method="post" accept-charset="', $context['character_set'], '">
  245. <div class="title_bar">
  246. <h3 class="titlebg">', $context['page_title'], '</h3>
  247. </div>
  248. <span class="upperframe"><span></span></span>
  249. <div class="roundframe">
  250. <dl>
  251. <dt>', $txt['invalid_activation_username'], ':</dt>
  252. <dd><input type="text" name="user" size="40" value="', $context['default_username'], '" class="input_text" /></dd>
  253. </dl>
  254. <p>', $txt['invalid_activation_new'], '</p>
  255. <dl>
  256. <dt>', $txt['invalid_activation_new_email'], ':</dt>
  257. <dd><input type="text" name="new_email" size="40" class="input_text" /></dd>
  258. <dt>', $txt['invalid_activation_password'], ':</dt>
  259. <dd><input type="password" name="passwd" size="30" class="input_password" /></dd>
  260. </dl>';
  261. if ($context['can_activate'])
  262. echo '
  263. <p>', $txt['invalid_activation_known'], '</p>
  264. <dl>
  265. <dt>', $txt['invalid_activation_retry'], ':</dt>
  266. <dd><input type="text" name="code" size="30" class="input_text" /></dd>
  267. </dl>';
  268. echo '
  269. <p><input type="submit" value="', $txt['invalid_activation_resend'], '" class="button_submit" /></p>
  270. </div>
  271. <span class="lowerframe"><span></span></span>
  272. </form>';
  273. }
  274. ?>