Introduced PasswordField.class.php to keep things simple.
authoranuko <support@anuko.com>
Wed, 1 Mar 2017 21:42:08 +0000 (21:42 +0000)
committeranuko <support@anuko.com>
Wed, 1 Mar 2017 21:42:08 +0000 (21:42 +0000)
WEB-INF/lib/form/Form.class.php
WEB-INF/lib/form/PasswordField.class.php [new file with mode: 0644]
WEB-INF/lib/form/TextField.class.php
WEB-INF/templates/footer.tpl
login.php

index f8a32ec..868a3b3 100644 (file)
@@ -62,6 +62,12 @@ class Form {
         if (isset($arguments['aspassword'])) $el->setAsPassword($arguments['aspassword']);
         break;
 
+      case 'password':
+        import('form.PasswordField');
+        $el = new PasswordField($arguments['name']);
+        $el->setMaxLength(@$arguments['maxlength']);
+        break;
+
 // TODO: refactoring ongoing down from here.
 // aspassword - change this name to something better? Perhaps.
 // Change $arguments to something better too (maybe). $args or $params?
diff --git a/WEB-INF/lib/form/PasswordField.class.php b/WEB-INF/lib/form/PasswordField.class.php
new file mode 100644 (file)
index 0000000..7fd6624
--- /dev/null
@@ -0,0 +1,63 @@
+<?php
+// +----------------------------------------------------------------------+
+// | Anuko Time Tracker
+// +----------------------------------------------------------------------+
+// | Copyright (c) Anuko International Ltd. (https://www.anuko.com)
+// +----------------------------------------------------------------------+
+// | LIBERAL FREEWARE LICENSE: This source code document may be used
+// | by anyone for any purpose, and freely redistributed alone or in
+// | combination with other software, provided that the license is obeyed.
+// |
+// | There are only two ways to violate the license:
+// |
+// | 1. To redistribute this code in source form, with the copyright
+// |    notice or license removed or altered. (Distributing in compiled
+// |    forms without embedded copyright notices is permitted).
+// |
+// | 2. To redistribute modified versions of this code in *any* form
+// |    that bears insufficient indications that the modifications are
+// |    not the work of the original author(s).
+// |
+// | This license applies to this document only, not any other software
+// | that it may be combined with.
+// |
+// +----------------------------------------------------------------------+
+// | Contributors:
+// | https://www.anuko.com/time_tracker/credits.htm
+// +----------------------------------------------------------------------+
+
+import('form.FormElement');
+
+class PasswordField extends FormElement {
+
+  function __construct($name, $value='')
+  {
+    $this->class = 'PasswordField';
+    $this->name = $name;
+    $this->value = $value;
+  }
+
+  function getHtml() {
+    if ($this->id == '') $this->id = $this->name;
+
+    $html = "\n\t<input type=\"password\"";
+    $html.= ' id="'.$this->id.'"';
+    $html.= ' name="'.$this->name.'"';
+
+    if ($this->size != '')
+      $html.= ' size="'.$this->size.'"';
+
+    if ($this->style != '')
+      $html.= ' style="'.$this->style.'"';
+
+    if ($this->max_length != '')
+      $html.= ' maxlength="'.$this->max_length.'"';
+
+    if ($this->on_change != '')
+      $html.= ' onchange="'.$this->on_change.'"';
+
+    $html.= ' value="'.htmlspecialchars($this->getValue()).'"';
+    $html.= '>';
+    return $html;
+  }
+}
index c9ffaae..b4b1c5d 100644 (file)
@@ -30,10 +30,11 @@ import('form.FormElement');
        
 class TextField extends FormElement {
     var $mPassword     = false;
-    var $class = 'TextField';
+    //var $class = 'TextField';
 
        function __construct($name,$value="")
        {
+            $this->class = 'TextField';
                $this->name = $name;
                $this->value = $value;
        }
index 635abc3..69c06a3 100644 (file)
@@ -12,7 +12,7 @@
       <br>
       <table cellspacing="0" cellpadding="4" width="100%" border="0">
         <tr>
-          <td align="center">&nbsp;Anuko Time Tracker 1.10.38.3613 | Copyright &copy; <a href="https://www.anuko.com/lp/tt_3.htm" target="_blank">Anuko</a> |
+          <td align="center">&nbsp;Anuko Time Tracker 1.10.38.3614 | Copyright &copy; <a href="https://www.anuko.com/lp/tt_3.htm" target="_blank">Anuko</a> |
             <a href="https://www.anuko.com/lp/tt_4.htm" target="_blank">{$i18n.footer.credits}</a> |
             <a href="https://www.anuko.com/lp/tt_5.htm" target="_blank">{$i18n.footer.license}</a> |
             <a href="https://www.anuko.com/lp/tt_7.htm" target="_blank">{$i18n.footer.improve}</a>
index d578ae9..b0c583f 100644 (file)
--- a/login.php
+++ b/login.php
@@ -38,7 +38,7 @@ if ($cl_login == null && $request->getMethod() == 'GET')
 
 $form = new Form('loginForm');
 $form->addInput(array('type'=>'text','size'=>'25','maxlength'=>'100','name'=>'login','style'=>'width: 220px;','value'=>$cl_login));
-$form->addInput(array('type'=>'text','size'=>'25','maxlength'=>'50','name'=>'password','style'=>'width: 220px;','aspassword'=>true,'value'=>$cl_password));
+$form->addInput(array('type'=>'password','size'=>'25','maxlength'=>'50','name'=>'password','style'=>'width: 220px;','value'=>$cl_password));
 $form->addInput(array('type'=>'hidden','name'=>'browser_today','value'=>'')); // User current date, which gets filled in on btn_login click.
 $form->addInput(array('type'=>'submit','name'=>'btn_login','onclick'=>'browser_today.value=get_date()','value'=>$i18n->getKey('button.login')));