public function auth($level = 1, $return = false) { if (isset($_SESSION['auth']) && $_SESSION['auth'] >= $level) { return true; } else { if ($return) { return false; } sendMsg('/', textid('system/messages/no_permission')); } die('foo'); }
/** * Check string for valid length * Return true if the string is valid. * Else return false and put a error mark in $error variable * * @param string id identifier * @param int min minimum amount of chars * @param int max maximum amount of chars */ public function length($id, $min = 0, $max = 65535) { $str = $this->getStr($id); if (strlen($str) > $max || strlen($str) < $min) { //echo 'im here ok! max: '.$max.' min: '.$min.' and id: '.$id; $this->error[$id] = textid('system/validate/use') . ' ' . $min . ' -> ' . $max . ' ' . textid('system/validate/chars') . '.'; return false; } else { return true; } }
public function selectDate($name = '', $p = array()) { $value_y = 1970; $value_m = 1; $value_d = 1; $fieldname = $this->fixName($name); $class = isset($p['class']) ? 'class="' . $p['class'] . '"' : ''; $value = isset($this->v[$name]) ? $this->v[$name] : ''; $str = $this->hidden($name, array('id' => $name)); if (!empty($value)) { $exp = explode('/', date('Y/m/d', strtotime($value))); $value_y = $exp[0]; $value_m = $exp[1]; $value_d = $exp[2]; } $str .= $this->select_num($name . '_y', array('from' => '1994', 'to' => '2030', 'class' => 'year', 'id' => $name . '_y', 'force_value' => $value_y, 'onchange' => 'updateDate(\'' . $name . '\');')); $months = array(1 => textid('system/general/january'), 2 => textid('system/general/february'), 3 => textid('system/general/march'), 4 => textid('system/general/april'), 5 => textid('system/general/may'), 6 => textid('system/general/june'), 7 => textid('system/general/july'), 8 => textid('system/general/august'), 9 => textid('system/general/september'), 10 => textid('system/general/october'), 11 => textid('system/general/november'), 12 => textid('system/general/december')); //printArr($months); $str .= ' ' . $this->select($name . '_m', array('id' => $name . '_m', 'force_value' => $value_m, 'onchange' => 'updateDate(\'' . $name . '\');', 'fields' => $months)); /*$str .= ' '.$this->select_num($name.'_m',array( 'from' => '1', 'to' => '12','id' => $name.'_m', 'class' => 'short', 'force_value' => $value_m, 'onchange' => 'updateDate(\''.$name.'\');' ));*/ $str .= ' ' . $this->select_num($name . '_d', array('from' => '1', 'to' => '31', 'id' => $name . '_d', 'class' => 'short', 'force_value' => $value_d, 'onchange' => 'updateDate(\'' . $name . '\');')); return $str; }