mirror of
https://github.com/renbaoshuo/S2OJ.git
synced 2024-11-22 07:38:42 +00:00
This commit is contained in:
parent
08624f88e0
commit
387fdf968b
@ -10,7 +10,7 @@ class HTML {
|
|||||||
public static function avatar_addr($user, $size) {
|
public static function avatar_addr($user, $size) {
|
||||||
return '//gravatar.loli.net/avatar/' . md5(strtolower(trim($user['email']))) . "?d=mm&s=$size";
|
return '//gravatar.loli.net/avatar/' . md5(strtolower(trim($user['email']))) . "?d=mm&s=$size";
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function tablist($tabs_info, $cur, $type = 'nav-tabs') {
|
public static function tablist($tabs_info, $cur, $type = 'nav-tabs') {
|
||||||
$html = '<ul class="nav '.$type.'" role="tablist">';
|
$html = '<ul class="nav '.$type.'" role="tablist">';
|
||||||
foreach ($tabs_info as $id => $tab) {
|
foreach ($tabs_info as $id => $tab) {
|
||||||
@ -53,8 +53,7 @@ class HTML {
|
|||||||
$url = UOJConfig::$data['web']['blog']['protocol'].'://'.UOJConfig::$data['web']['blog']['host'].$port.'/'.blog_name_encode($username);
|
$url = UOJConfig::$data['web']['blog']['protocol'].'://'.UOJConfig::$data['web']['blog']['host'].$port.'/'.blog_name_encode($username);
|
||||||
break;
|
break;
|
||||||
case 3:
|
case 3:
|
||||||
$port = ((UOJConfig::$data['web']['main']['protocol'] === "http" && UOJConfig::$data['web']['main']['port'] == 80) || (UOJConfig::$data['web']['main']['protocol'] === "https" && UOJConfig::$data['web']['main']['port'] == 443)) ? '' : (':'.UOJConfig::$data['web']['main']['port']);
|
$url = HTML::url('/blog/'.blog_name_encode($username));
|
||||||
$url = '/blog/'.blog_name_encode($username);
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
$url .= $uri;
|
$url .= $uri;
|
||||||
@ -69,19 +68,18 @@ class HTML {
|
|||||||
$url = UOJConfig::$data['web']['blog']['protocol'].'://'.UOJConfig::$data['web']['blog']['host'].$port;
|
$url = UOJConfig::$data['web']['blog']['protocol'].'://'.UOJConfig::$data['web']['blog']['host'].$port;
|
||||||
break;
|
break;
|
||||||
case 3:
|
case 3:
|
||||||
$port = ((UOJConfig::$data['web']['main']['protocol'] === "http" && UOJConfig::$data['web']['main']['port'] == 80) || (UOJConfig::$data['web']['main']['protocol'] === "https" && UOJConfig::$data['web']['main']['port'] == 443)) ? '' : (':'.UOJConfig::$data['web']['main']['port']);
|
$url = HTML::url('/blogs');
|
||||||
$url = '/blogs';
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
return HTML::escape(rtrim($url, '/'));
|
return HTML::escape(rtrim($url, '/'));
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function url($uri, $config = array()) {
|
public static function url($uri, $config = array()) {
|
||||||
$config = array_merge(array(
|
$config = array_merge(array(
|
||||||
'location' => 'main',
|
'location' => 'main',
|
||||||
'params' => null
|
'params' => null
|
||||||
), $config);
|
), $config);
|
||||||
|
|
||||||
$path = strtok($uri, '?');
|
$path = strtok($uri, '?');
|
||||||
$qs = strtok('?');
|
$qs = strtok('?');
|
||||||
parse_str($qs, $param);
|
parse_str($qs, $param);
|
||||||
@ -89,18 +87,12 @@ class HTML {
|
|||||||
if ($config['params'] != null) {
|
if ($config['params'] != null) {
|
||||||
$param = array_merge($param, $config['params']);
|
$param = array_merge($param, $config['params']);
|
||||||
}
|
}
|
||||||
|
|
||||||
// $url = UOJConfig::$data['web'][$config['location']]['protocol'].'://'.UOJConfig::$data['web'][$config['location']]['host'];
|
$url = '//'.UOJConfig::$data['web'][$config['location']]['host'];
|
||||||
// if ((UOJConfig::$data['web'][$config['location']]['protocol'] === "http" && UOJConfig::$data['web'][$config['location']]['port'] == 80) || (UOJConfig::$data['web'][$config['location']]['protocol'] === "https" && UOJConfig::$data['web'][$config['location']]['port'] == 443)) {
|
|
||||||
// } else {
|
|
||||||
// $url .= ':'.UOJConfig::$data['web'][$config['location']]['port'];
|
|
||||||
// }
|
|
||||||
if ($param) {
|
if ($param) {
|
||||||
$url .= $path.'?'.HTML::query_string_encode($param);
|
$url .= $path.'?'.HTML::query_string_encode($param);
|
||||||
} elseif ($path != '/') {
|
|
||||||
$url .= rtrim($path, '/');
|
|
||||||
} else {
|
} else {
|
||||||
$url = $path;
|
$url .= rtrim($path, '/');
|
||||||
}
|
}
|
||||||
return HTML::escape($url);
|
return HTML::escape($url);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user