Modified: web/php/trunk/include/layout.inc =================================================================== --- web/php/trunk/include/layout.inc 2009-10-31 18:18:06 UTC (rev 290110) +++ web/php/trunk/include/layout.inc 2009-10-31 18:19:21 UTC (rev 290111) @@ -25,10 +25,10 @@ $highlighted = ob_get_contents(); ob_end_clean(); - // This should eventually be a php_syntax_check() call when we move to PHP5 - // But use this ugly hack for now to avoid code snippets with bad syntax screwing up the highlighter - if(strstr($highlighted,"include/layout.inc")) $highlighted = ''.nl2br(htmlentities($code)).""; - + // This should eventually be a php_syntax_check() call when we move to PHP5 + // But use this ugly hack for now to avoid code snippets with bad syntax screwing up the highlighter + if(strstr($highlighted,"include/layout.inc")) $highlighted = ''.nl2br(htmlentities($code)).""; + // Fix output to use CSS classes and wrap well $highlighted = '
' . str_replace( array( @@ -53,7 +53,7 @@ ), $highlighted ) . '
'; - + if ($return) { return $highlighted; } else { echo $highlighted; } } @@ -64,20 +64,20 @@ function site_header($title = '', $config = array()) { global $EXPL_LANG, $SIDEBAR_DATA, $RSIDEBAR_DATA, $PAGE_COLUMNS, $PGI; - + // Default to empty array if improper parameter passed if (!is_array($config)) { $config = array(); } - + // String defaults $lang_input = $canonical = $base = $meta = $layout_helper = ''; - + // Count number of columns for layout. The number identifies // the layout precisely, as we have no page having a right // sidebar and no left sidebar $PAGE_COLUMNS = 1; if (!empty($SIDEBAR_DATA)) { $PAGE_COLUMNS++; } if (!empty($RSIDEBAR_DATA)) { $PAGE_COLUMNS++; } - + // Check which language we are presenting, default to english $lang = "en"; if (isset($config["lang"])) { @@ -104,22 +104,22 @@ header(sprintf("%s: %s", $key, $value)); } } - + if (!empty($title)) { $title = ": $title"; } - + // This page should not be indexed by robots if (in_array("noindex", $config)) { $meta .= "\n "; } - + // Set onload handler if required $onload = (isset($config['onload']) ? ' onload="' . $config['onload'] . '"' : ''); - + // Explicit language setting means that we should put that into the form if (isset($EXPL_LANG)) { $lang_input = "\n "; } - + // Link tags $link = ""; if (isset($config['link']) && is_array($config['link'])) { @@ -141,15 +141,15 @@ $base = "\n "; $canonical = ''; } - + // Define layout helper in case we need it if ($PAGE_COLUMNS > 2) { $layout_helper = "
"; } - + // Choose name of mirror site specific CSS file $mirror_specific_style = ($_SERVER['STATIC_ROOT'] ? 'phpnet' : 'mirror'); - + // Support for more header tags $moreheadtags = ''; if (isset($config['headtags'])) { @@ -158,7 +158,7 @@ } else { $moreheadtags = "\n " . ((string)$config['headtags']); } - } + } $classname = "default"; if(isset($_SERVER['BASE_PAGE'])) { $classname = dirname($_SERVER['BASE_PAGE']); @@ -186,8 +186,8 @@ } $profile .= '"'; } - + print << @@ -266,7 +266,7 @@ if ($PAGE_COLUMNS > 1) { echo "\n
\n$SIDEBAR_DATA\n
"; } - + // Print out right column if ($PAGE_COLUMNS > 2) { echo "\n
\n$RSIDEBAR_DATA\n
"; @@ -287,7 +287,7 @@ function site_footer($config = array()) { global $LAST_UPDATED, $PAGE_COLUMNS; - + $stats = (have_stats() ? "\n stats |" : ""); $rsslink = (isset($config["rss"]) ? "RSS |" : @@ -302,11 +302,11 @@ $provider_name = mirror_provider(); $mirror_text = (is_official_mirror() ? "This mirror generously provided by:" : - "This unofficial mirror is operated at:"); + "This unofficial mirror is operated at:"); $last_updated = strftime("%c %Z", $LAST_UPDATED); $layout_helper = ($PAGE_COLUMNS > 2 ? "
" : ""); //$functionsjs = (in_array("functionsjs", $config) ? "\n' : ''); - + print << @@ -347,7 +347,7 @@ // Drop width and height values from image if available $str = preg_replace('!width=\"([0-9]+?)\"!i', '', $img); $str = preg_replace('!height=\"([0-9]+?)\"!i', '', $str); - + // Return image with new width and height added return preg_replace( '!/?>$!', @@ -369,7 +369,7 @@ } else { $sizeparams = ''; } - + // Convert right or left alignment to CSS float, // but leave other alignments intact (for now) if (in_array($align, array("right", "left"))) { @@ -379,7 +379,7 @@ } else { $align = ''; } - + // Return with image built up return sprintf('%s', $webdir, @@ -400,7 +400,7 @@ } // Shortcut to usual news image printing (right floating -// image from the news dir with an alt and an URL) +// image from the news dir with an alt and an URL) function news_image($URL, $image, $alt, $print = true) { $str = "" . make_image("news/$image", $alt, "right") . ""; @@ -449,22 +449,22 @@ // return a hyperlink to something, within the site, that pops up a new window // function make_popup_link ($url, $linktext=false, $target=false, $windowprops="", $extras=false) { - return sprintf("%s", - htmlspecialchars($url, ENT_QUOTES), - ($target ? $target : "_new"), - htmlspecialchars($url, ENT_QUOTES), - ($target ? $target : "_new"), + return sprintf("%s", + htmlspecialchars($url, ENT_QUOTES), + ($target ? $target : "_new"), + htmlspecialchars($url, ENT_QUOTES), + ($target ? $target : "_new"), $windowprops, - ($extras ? ' '.$extras : ''), - ($linktext ? $linktext : $url) - ); + ($extras ? ' '.$extras : ''), + ($linktext ? $linktext : $url) + ); } // print_popup_link() // print a hyperlink to something, within the site, that pops up a new window // function print_popup_link($url, $linktext=false, $windowprops="", $target=false, $extras=false) { - echo make_popup_link($url, $linktext, $windowprops, $target, $extras); + echo make_popup_link($url, $linktext, $windowprops, $target, $extras); } // Print a link for a downloadable file (including filesize) @@ -509,18 +509,18 @@ } function sect_to_file($string) { - $string = strtolower($string); - $string = str_replace(' ','-',$string); - $string = str_replace('_','-',$string); - $func = "function.$string.php"; - $chap = "ref.$string.php"; - $feat = "features.$string.php"; - $struct = "control-structures.$string.php"; - if(@is_file($func)) return $func; - else if(@is_file($chap)) return $chap; - else if(@is_file($feat)) return $feat; - else if(@is_file($struct)) return $struct; - else return "$string.php"; + $string = strtolower($string); + $string = str_replace(' ','-',$string); + $string = str_replace('_','-',$string); + $func = "function.$string.php"; + $chap = "ref.$string.php"; + $feat = "features.$string.php"; + $struct = "control-structures.$string.php"; + if(@is_file($func)) return $func; + else if(@is_file($chap)) return $chap; + else if(@is_file($feat)) return $feat; + else if(@is_file($struct)) return $struct; + else return "$string.php"; } function clean($var) { @@ -539,24 +539,24 @@ '\1\4', $text ); - + return $text; } function display_errors($errors) -{ - echo '
'; - if (count($errors) > 1) { - echo "You need to do the following before your submission will be accepted:"; - } - else { - echo $errors[0]; - } - echo '
'; +{ + echo '
'; + if (count($errors) > 1) { + echo "You need to do the following before your submission will be accepted:"; + } + else { + echo $errors[0]; + } + echo '
'; } // Displays an event. Used in event submission @@ -568,7 +568,7 @@ global $cm; // Current year (int)($_GET['cy'] ?: 0) global $cy; - + // Weekday names array for ($i = 1; $i <= 7; $i++) { $days[$i] = strftime('%A', mktime(12, 0, 0, 4, $i, 2001)); @@ -591,19 +591,19 @@
", date("F j, Y", $sday), "\n"; } - + // Print link in case we have one if ($event['url']) { echo ''; } // Print event description echo "", stripslashes(htmlentities($event['sdesc'])), ""; // End link if ($event['url']) { echo ""; } - + // Print extra date info for recurring and multiday events switch ($event['type']) { case 2: @@ -623,13 +623,13 @@ echo ' (Every ', $days, " of the month)"; break; } - + // Event category - if(isset($event['category']) && $event['category']) { - $cat = array("unknown", "User Group Event", "Conference", "Training"); - echo ' [' . $cat[$event['category']] . '] '; - } - + if(isset($event['category']) && $event['category']) { + $cat = array("unknown", "User Group Event", "Conference", "Training"); + echo ' [' . $cat[$event['category']] . '] '; + } + // Print out country information echo ' (' , $COUNTRIES[$event['country']] , ')'; ?>