X-Git-Url: https://git.harvie.cz/?a=blobdiff_plain;f=index.php;h=caf25a0ef3039c92e95f2ea419b87abbc7565589;hb=042a49887f093945b7ef913556e506c30ce2bbda;hp=6f7392ce1b30b04443e55acec61947f3359f6715;hpb=5469411711b7ac51190a64bf252aecb6a3f43f89;p=mirrors%2FSokoMan.git diff --git a/index.php b/index.php index 6f7392c..caf25a0 100755 --- a/index.php +++ b/index.php @@ -20,7 +20,7 @@ require_once('sklad.conf.php'); set_include_path(DIR_LIB.PATH_SEPARATOR.get_include_path()); -require_once('Sklad_LMS-fake.class.php'); +require_once('Sklad_Auth.class/common.php'); require_once('HTTP_Auth.class.php'); require_once('Locale.class.php'); require_once('Barcode.class.php'); @@ -34,25 +34,33 @@ require_once('Barcode.class.php'); * @author Tomas Mudrunka */ class HTML { - function row($row) { - $html=''; + function row($row,$type=false,$class=false) { + $html = ''; + $class = $class ? $class=" class='$class' " : ''; + if($type) $html.="<$type>"; + $html.=""; + $td = $type == 'thead' ? 'th' : 'td'; foreach($row as $var) { if(trim($var) == '') $var = ' '; - $html.="$var"; + $html.="<$td>$var"; } $html.=''; + if($type) $html.=""; return $html; } - function table(&$table, $params='border=1') { + function table(&$table, $parity_class=array('tr_odd','tr_even'), $params='border=1') { $html=""; $header=true; + $even=false; foreach($table as $row) { if($header) { - $html.=$this->row(array_keys($row)); + $html.=$this->row(array_keys($row),'thead'); $header=false; } - $html.=$this->row($row); + $class = $parity_class ? $parity_class[$even] : false; + $html.=$this->row($row,false,$class); + $even = !$even; } $html.='
'; return $html; @@ -69,7 +77,21 @@ class HTML { return "$title"; } + function img_link($src, $link='#void', $title='img_link', $internal=true, $translate=true, $options='width=64') { + return $this->link($this->img($src,$title,$options),$link,$internal,$translate); + } + + function textarea($name=false, $value='', $placeholder=false, $options=false, $prefix='') { + $html = T($prefix)."textarea($name, $value, $placeholder, $options, $prefix); $html = T($prefix)."$html"; } + function favicon($url='/favicon.ico') { + return ''; + + } + function head($title=false,$charset='UTF-8',$more='') { $title = $title ? "\n$title" : ''; $html= ''; $html.= ''.$title.$more; + $html.= $this->favicon(dirname($_SERVER['SCRIPT_NAME']).'/favicon.ico'); $html.= ''; return $html; } @@ -147,20 +175,34 @@ class HTML { * @author Tomas Mudrunka */ class Sklad_HTML extends HTML { //TODO: Split into few more methods - function header($title='') { + function header($title='', $user=array()) { $home = URL_HOME; $script = $_SERVER['SCRIPT_NAME']; $search = htmlspecialchars(@trim($_GET['q'])); - $message = strip_tags(@trim($_GET['message']),''); + $message = strip_tags(@trim($_GET['message']),'
'); + $fortune = 'test'; $instance = INSTANCE_ID != '' ? '/'.INSTANCE_ID : ''; + $user_id = htmlspecialchars($user['id']); + $user_gid = htmlspecialchars($user['gid']); + $user_name = htmlspecialchars($user['name']); + $time = date('r'); //$title = T($title); //TODO $html = $this->head("SōkoMan$title"); $html .= <<
SōkoMan$instance$title +

SōkoMan$instance$title

+
+ Logged in as $user_name [UID: $user_id; GID: $user_gid]
+ Page loaded at $time +