Beispiel #1
0
 /**
  * generates a check box
  */
 public function iCheckBox($key, $label = '')
 {
     $str = '<input type="checkbox" id="i_' . $key . '" name="' . $key . '"';
     if ($this->_value($key)) {
         $str .= ' checked="checked"';
     }
     $str .= ' value="1" />';
     if (empty($label)) {
         $options = $this->obj->getPropertyOptions($key);
         if (!empty($options['label'])) {
             // -TODO- translate
             $label = $options['label'];
         }
     }
     if (!empty($label)) {
         $str .= '<label for="_' . $key . '" class="inline">' . VarStr::html($label) . '</label>';
     }
     if ($err = $this->_htmlError($key)) {
         $str .= $err;
     }
     return $str;
 }
Beispiel #2
0
 public static function html($val, $cut = 0)
 {
     if ($cut && $cut < strlen($val)) {
         $val = substr($val, 0, $cut) . ' [...]';
     }
     return str_replace(array("\r\n", "\r", "\n"), "<br />", VarStr::specialchars($val));
 }
Beispiel #3
0
 public static function html($section, $label, $field = '')
 {
     return VarStr::html(self::getTranslation($section, $label, $field));
 }
Beispiel #4
0
 /**
  * Is there a cookie for AutoLogin ??
  */
 public function checkAutoLogin($forReal = true)
 {
     if (empty($_COOKIE['auto_login'])) {
         return false;
     }
     $arrVal = explode(":", $_COOKIE['auto_login']);
     $id = VarUid::sanitize($arrVal[0]);
     $salt = VarStr::sanitize($arrVal[1]);
     if (!$id || !$salt) {
         return false;
     }
     if ($this->obj->load($this->dbUid(true) . "='" . $id . "' AND " . $this->dbField('salt', $salt) . " AND " . $this->dbField('auto_login', 1) . " AND " . $this->dbField('enabled', 1))) {
         if (!$forReal) {
             return true;
         }
         setCookie('auto_login', $this->obj->getUid() . ":" . $this->obj->get('salt'), time() + 3600 * 24 * 30);
         $this->activateLogin();
         return true;
     } else {
         return false;
     }
 }
Beispiel #5
0
 public static function log_any($mode, $head, $str)
 {
     switch ($mode) {
         case 1:
             $arr = explode("\n", trim($str));
             foreach ($arr as $s) {
                 error_log($GLOBALS['config']['log_signature'] . " {$head} : {$s}");
             }
             break;
         case 2:
             echo VarStr::html($GLOBALS['config']['log_signature'] . " {$head} : " . nl2br($str));
             break;
     }
 }