[3733] | 1 | <?php |
---|
| 2 | |
---|
| 3 | if ( !isset($c->page_title) ) { |
---|
| 4 | $c->page_title = translate('DAViCal CalDAV Server'); |
---|
| 5 | } |
---|
| 6 | |
---|
| 7 | function make_help_link($matches) |
---|
| 8 | { |
---|
| 9 | global $c; |
---|
| 10 | |
---|
| 11 | // as usual: $matches[0] is the complete match |
---|
| 12 | // $matches[1] the match for the first subpattern |
---|
| 13 | // enclosed in '##...##' and so on |
---|
| 14 | // Use like: $s = preg_replace_callback('/##([^#]+)##', 'make_help_link', $s); |
---|
| 15 | // $help_topic = preg_replace( '/^##(.+)##$/', '$1', $matches[1]); |
---|
| 16 | $help_topic = $matches[1]; |
---|
| 17 | $display_url = $help_topic; |
---|
| 18 | if ( $GLOBALS['session']->AllowedTo('Admin') || $GLOBALS['session']->AllowedTo('Support') ) { |
---|
| 19 | if ( strlen($display_url) > 30 ) { |
---|
| 20 | $display_url = substr( $display_url, 0, 28 ) . '...' ; |
---|
| 21 | } |
---|
| 22 | } |
---|
| 23 | else { |
---|
| 24 | $display_url = 'help'; |
---|
| 25 | } |
---|
| 26 | return ' <a class="help" href="'.$c->base_url.'/help.php?h='.$help_topic.'" title="'.translate('Show help on').' &39;'.$help_topic.'&39;" target="_new">['.$display_url.']</a> '; |
---|
| 27 | } |
---|
| 28 | |
---|
| 29 | |
---|
| 30 | if ( !function_exists('send_page_header') ) { |
---|
| 31 | function send_page_header() { |
---|
| 32 | global $session, $c, $main_menu, $related_menu; |
---|
| 33 | |
---|
| 34 | header( 'Content-type: text/html; charset="utf-8"' ); |
---|
| 35 | |
---|
| 36 | echo '<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">'; |
---|
| 37 | echo <<<EOHDR |
---|
| 38 | <html> |
---|
| 39 | <head> |
---|
| 40 | <meta http-equiv="Content-Type" content="text/html;charset=utf-8"> |
---|
| 41 | <title>$c->page_title</title> |
---|
| 42 | |
---|
| 43 | EOHDR; |
---|
| 44 | |
---|
| 45 | foreach ( $c->stylesheets AS $stylesheet ) { |
---|
| 46 | echo '<link rel="stylesheet" type="text/css" href="'.$stylesheet.'">'; |
---|
| 47 | } |
---|
| 48 | if ( isset($c->local_styles) ) { |
---|
| 49 | // Always load local styles last, so they can override prior ones... |
---|
| 50 | foreach ( $c->local_styles AS $stylesheet ) { |
---|
| 51 | echo '<link rel="stylesheet" type="text/css" href="'.$stylesheet.'">'; |
---|
| 52 | } |
---|
| 53 | } |
---|
| 54 | |
---|
| 55 | if ( isset($c->print_styles) ) { |
---|
| 56 | // Finally, load print styles last, so they can override all of the above... |
---|
| 57 | foreach ( $c->print_styles AS $stylesheet ) { |
---|
| 58 | echo "<link rel=\"stylesheet\" type=\"text/css\" href=\"$stylesheet\" media=\"print\">\n"; |
---|
| 59 | } |
---|
| 60 | } |
---|
| 61 | |
---|
| 62 | echo "</head>\n<body>\n"; |
---|
| 63 | echo "<div id=\"pageheader\">\n"; |
---|
| 64 | |
---|
| 65 | if ( isset($main_menu) ) echo $main_menu->RenderAsCSS(); |
---|
| 66 | if ( isset($related_menu) && $related_menu->Size() > 0 ) { |
---|
| 67 | echo $related_menu->Render( true ); |
---|
| 68 | } |
---|
| 69 | |
---|
| 70 | echo "</div>\n"; |
---|
| 71 | |
---|
| 72 | if ( isset($c->messages) && is_array($c->messages) && count($c->messages) > 0 ) { |
---|
| 73 | echo "<div id=\"messages\"><ul class=\"messages\">\n"; |
---|
| 74 | foreach( $c->messages AS $i => $msg ) { |
---|
| 75 | // ##HelpTextKey## gets converted to a "/help.phph=HelpTextKey" link |
---|
| 76 | $msg = preg_replace_callback("/##([^#]+)##/", "make_help_link", translate($msg)); |
---|
| 77 | echo "<li class=\"messages\">$msg</li>\n"; |
---|
| 78 | } |
---|
| 79 | echo "</ul>\n</div>\n"; |
---|
| 80 | } |
---|
| 81 | |
---|
| 82 | } |
---|
| 83 | } |
---|
| 84 | |
---|
| 85 | send_page_header(); |
---|
| 86 | |
---|