forked from GNUsocial/gnu-social
strip some whitespace
darcs-hash:20080620065619-84dde-9c207b2a898ff0a16b45f5f1b28565aaa85f9e65.gz
This commit is contained in:
parent
6f74a091e1
commit
2025169b50
32
lib/util.php
32
lib/util.php
@ -124,14 +124,14 @@ function common_end_xml() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
define('PAGE_TYPE_PREFS', 'application/xhtml+xml,text/html;q=0.7,application/xml;q=0.3,text/xml;q=0.2');
|
define('PAGE_TYPE_PREFS', 'application/xhtml+xml,text/html;q=0.7,application/xml;q=0.3,text/xml;q=0.2');
|
||||||
|
|
||||||
function common_show_header($pagetitle, $callable=NULL, $data=NULL, $headercall=NULL) {
|
function common_show_header($pagetitle, $callable=NULL, $data=NULL, $headercall=NULL) {
|
||||||
global $config, $xw;
|
global $config, $xw;
|
||||||
|
|
||||||
$httpaccept = isset($_SERVER['HTTP_ACCEPT']) ? $_SERVER['HTTP_ACCEPT'] : NULL;
|
$httpaccept = isset($_SERVER['HTTP_ACCEPT']) ? $_SERVER['HTTP_ACCEPT'] : NULL;
|
||||||
|
|
||||||
# XXX: allow content negotiation for RDF, RSS, or XRDS
|
# XXX: allow content negotiation for RDF, RSS, or XRDS
|
||||||
|
|
||||||
$type = common_negotiate_type(common_accept_to_prefs($httpaccept),
|
$type = common_negotiate_type(common_accept_to_prefs($httpaccept),
|
||||||
common_accept_to_prefs(PAGE_TYPE_PREFS));
|
common_accept_to_prefs(PAGE_TYPE_PREFS));
|
||||||
|
|
||||||
@ -139,7 +139,7 @@ function common_show_header($pagetitle, $callable=NULL, $data=NULL, $headercall=
|
|||||||
common_client_error(_t('This page is not available in a media type you accept'), 406);
|
common_client_error(_t('This page is not available in a media type you accept'), 406);
|
||||||
exit(0);
|
exit(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
header('Content-Type: '.$type);
|
header('Content-Type: '.$type);
|
||||||
|
|
||||||
common_start_xml('html',
|
common_start_xml('html',
|
||||||
@ -166,11 +166,11 @@ function common_show_header($pagetitle, $callable=NULL, $data=NULL, $headercall=
|
|||||||
'href="'.theme_path('ie'.$ver.'.css').' /><![endif]');
|
'href="'.theme_path('ie'.$ver.'.css').' /><![endif]');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
common_element('script', array('type' => 'text/javascript',
|
common_element('script', array('type' => 'text/javascript',
|
||||||
'src' => common_path('js/jquery.min.js')),
|
'src' => common_path('js/jquery.min.js')),
|
||||||
' ');
|
' ');
|
||||||
|
|
||||||
if ($callable) {
|
if ($callable) {
|
||||||
if ($data) {
|
if ($data) {
|
||||||
call_user_func($callable, $data);
|
call_user_func($callable, $data);
|
||||||
@ -198,9 +198,9 @@ function common_show_header($pagetitle, $callable=NULL, $data=NULL, $headercall=
|
|||||||
$config['site']['name']);
|
$config['site']['name']);
|
||||||
common_element_end('p');
|
common_element_end('p');
|
||||||
}
|
}
|
||||||
|
|
||||||
common_element('h1', 'pagetitle', $pagetitle);
|
common_element('h1', 'pagetitle', $pagetitle);
|
||||||
|
|
||||||
if ($headercall) {
|
if ($headercall) {
|
||||||
if ($data) {
|
if ($data) {
|
||||||
call_user_func($headercall, $data);
|
call_user_func($headercall, $data);
|
||||||
@ -417,12 +417,12 @@ function common_set_user($nickname) {
|
|||||||
function common_current_user() {
|
function common_current_user() {
|
||||||
$user = NULL;
|
$user = NULL;
|
||||||
if (common_have_session()) {
|
if (common_have_session()) {
|
||||||
$id = $_SESSION['userid'];
|
$id = $_SESSION['userid'];
|
||||||
if ($id) {
|
if ($id) {
|
||||||
$user = User::staticGet($id);
|
$user = User::staticGet($id);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return $user;
|
return $user;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -552,7 +552,7 @@ function common_fancy_url($action, $args=NULL) {
|
|||||||
return common_path('notice/new');
|
return common_path('notice/new');
|
||||||
case 'shownotice':
|
case 'shownotice':
|
||||||
return common_path('notice/'.$args['notice']);
|
return common_path('notice/'.$args['notice']);
|
||||||
case 'xrds':
|
case 'xrds':
|
||||||
case 'foaf':
|
case 'foaf':
|
||||||
return common_path($args['nickname'].'/'.$action);
|
return common_path($args['nickname'].'/'.$action);
|
||||||
case 'subscriptions':
|
case 'subscriptions':
|
||||||
@ -616,7 +616,7 @@ function common_redirect($url, $code=307) {
|
|||||||
307 => "Temporary Redirect");
|
307 => "Temporary Redirect");
|
||||||
header("Status: ${code} $status[$code]");
|
header("Status: ${code} $status[$code]");
|
||||||
header("Location: $url");
|
header("Location: $url");
|
||||||
|
|
||||||
common_start_xml('a',
|
common_start_xml('a',
|
||||||
'-//W3C//DTD XHTML 1.0 Strict//EN',
|
'-//W3C//DTD XHTML 1.0 Strict//EN',
|
||||||
'http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd');
|
'http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd');
|
||||||
@ -777,17 +777,17 @@ function common_valid_tag($tag) {
|
|||||||
|
|
||||||
# Does a little before-after block for next/prev page
|
# Does a little before-after block for next/prev page
|
||||||
|
|
||||||
function common_pagination($have_before, $have_after, $page, $action, $args=NULL) {
|
function common_pagination($have_before, $have_after, $page, $action, $args=NULL) {
|
||||||
|
|
||||||
if ($have_before || $have_after) {
|
if ($have_before || $have_after) {
|
||||||
common_element_start('div', array('id' => 'pagination'));
|
common_element_start('div', array('id' => 'pagination'));
|
||||||
common_element_start('ul', array('id' => 'nav_pagination'));
|
common_element_start('ul', array('id' => 'nav_pagination'));
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($have_before) {
|
if ($have_before) {
|
||||||
$pargs = array('page' => $page-1);
|
$pargs = array('page' => $page-1);
|
||||||
$newargs = ($args) ? array_merge($args,$pargs) : $pargs;
|
$newargs = ($args) ? array_merge($args,$pargs) : $pargs;
|
||||||
|
|
||||||
common_element_start('li', 'before');
|
common_element_start('li', 'before');
|
||||||
common_element('a', array('href' => common_local_url($action, $newargs)),
|
common_element('a', array('href' => common_local_url($action, $newargs)),
|
||||||
_t('« After'));
|
_t('« After'));
|
||||||
@ -802,7 +802,7 @@ function common_pagination($have_before, $have_after, $page, $action, $args=NULL
|
|||||||
_t('Before »'));
|
_t('Before »'));
|
||||||
common_element_end('li');
|
common_element_end('li');
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($have_before || $have_after) {
|
if ($have_before || $have_after) {
|
||||||
common_element_end('ul');
|
common_element_end('ul');
|
||||||
common_element_end('div');
|
common_element_end('div');
|
||||||
|
Loading…
x
Reference in New Issue
Block a user