summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorEvan Prodromou <evan@controlyourself.ca>2008-09-18 09:56:08 -0400
committerEvan Prodromou <evan@controlyourself.ca>2008-09-18 09:56:08 -0400
commit054b4d0be6f3d524a602d787380d9da5986c1f9f (patch)
treee7beef43174510044f6a0d8a2b2a0cfba3cf1589 /lib
parentfbe15efde4c8ae6226bc6bc90a28e29668f744f1 (diff)
if favor/disfavor submitted through ajax, return micro-html of form
darcs-hash:20080918135608-5ed1f-d753cb01f96e04871eb4f503ccd258674a03623a.gz
Diffstat (limited to 'lib')
-rw-r--r--lib/util.php60
1 files changed, 34 insertions, 26 deletions
diff --git a/lib/util.php b/lib/util.php
index 69fe2a898..48dd1a1b4 100644
--- a/lib/util.php
+++ b/lib/util.php
@@ -151,34 +151,11 @@ function common_init_language() {
define('PAGE_TYPE_PREFS', 'text/html,application/xhtml+xml,application/xml;q=0.3,text/xml;q=0.2');
function common_show_header($pagetitle, $callable=NULL, $data=NULL, $headercall=NULL) {
+
global $config, $xw;
- $httpaccept = isset($_SERVER['HTTP_ACCEPT']) ? $_SERVER['HTTP_ACCEPT'] : NULL;
-
- # XXX: allow content negotiation for RDF, RSS, or XRDS
-
- $type = common_negotiate_type(common_accept_to_prefs($httpaccept),
- common_accept_to_prefs(PAGE_TYPE_PREFS));
-
- if (!$type) {
- common_user_error(_('This page is not available in a media type you accept'), 406);
- exit(0);
- }
-
- header('Content-Type: '.$type);
-
- common_start_xml('html',
- '-//W3C//DTD XHTML 1.0 Strict//EN',
- 'http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd');
-
- # FIXME: correct language for interface
-
- $language = common_language();
-
- common_element_start('html', array('xmlns' => 'http://www.w3.org/1999/xhtml',
- 'xml:lang' => $language,
- 'lang' => $language));
-
+ common_start_html();
+
common_element_start('head');
common_element('title', NULL,
$pagetitle . " - " . $config['site']['name']);
@@ -252,6 +229,37 @@ function common_show_header($pagetitle, $callable=NULL, $data=NULL, $headercall=
common_element_start('div', array('id' => 'content'));
}
+function common_start_html($type=NULL) {
+
+ if (!$type) {
+ $httpaccept = isset($_SERVER['HTTP_ACCEPT']) ? $_SERVER['HTTP_ACCEPT'] : NULL;
+
+ # XXX: allow content negotiation for RDF, RSS, or XRDS
+
+ $type = common_negotiate_type(common_accept_to_prefs($httpaccept),
+ common_accept_to_prefs(PAGE_TYPE_PREFS));
+
+ if (!$type) {
+ common_user_error(_('This page is not available in a media type you accept'), 406);
+ exit(0);
+ }
+ }
+
+ header('Content-Type: '.$type);
+
+ common_start_xml('html',
+ '-//W3C//DTD XHTML 1.0 Strict//EN',
+ 'http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd');
+
+ # FIXME: correct language for interface
+
+ $language = common_language();
+
+ common_element_start('html', array('xmlns' => 'http://www.w3.org/1999/xhtml',
+ 'xml:lang' => $language,
+ 'lang' => $language));
+}
+
function common_show_footer() {
global $xw, $config;
common_element_end('div'); # content div