\n"; echo "\n"; echo "\n"; echo " \n"; $toc_title_mode = 1; $toc_title_content = "dvdisaster"; require("toc.php"); echo " $toc_title_content\n"; $toc_title_mode = 0; echo " \n"; if(!strcmp($script_name, "index")) { echo "\n"; $create_feed=1; } echo "\n"; echo "\n"; } ### ### Head bar ------------------------------------------------------------------------ ### # This includes the "dvdisaster version ..." header. Depending on the mode we # - provide the link to the online version for local documentation, or # - create the language switch for the online publication. function lang_link($lang_name, $lang, $spacing) { global $script_file; global $script_lang; if($spacing) $space="   "; else $space=""; if(strcmp($lang, $script_lang)) echo " $lang_name $space\n"; else echo " $lang_name $space\n"; } function begin_page() { global $cooked_version; global $have_experimental; global $stable_version; global $trans_to_hoster; global $trans_to_internet; global $trans_version; global $project_at_hoster; global $script_lang; global $mode; # Begin HTML file start_html(); # Write the title header echo "\n\n"; echo "\n"; echo " \n"; echo " \n"; echo " \n"; echo " \n"; echo "
\n"; echo " dvdisaster\n"; if(!strcmp($have_experimental, "no")) echo " $trans_version $cooked_version\n"; else echo " $trans_version $stable_version / $cooked_version\n"; if(!strcmp($mode, "local")) { echo " \n"; echo "  $trans_to_internet\n"; lang_link("", "cs", 0); # TODO: This is a quick hack lang_link("", "de", 0); # lang_link("", "en", 0); # to produce all locales for lang_link("", "ru", 0); # Windows. Do it better! } echo "
\n"; # Write the language chooser depending on mode echo "\n\n"; echo "\n"; echo " \n"; echo " \n"; echo " \n"; if(strcmp($mode, "local")) { echo " \n"; echo " \n"; echo " \n"; echo " \n"; echo " \n"; echo " \n"; echo " \n"; } # Both modes get the separator echo " \n"; echo "
$trans_to_hoster\n"; lang_link("Česky", "cs", 1); lang_link("Deutsch", "de", 1); lang_link("English", "en", 1); lang_link("Русский", "ru", 0); echo "
\n"; echo "
\n"; # Insert the navigation column create_navigation(); } ### ### Navigation column ---------------------------------------------------------------- ### # # Helper functions for creating the table of contents # function section($section_name) { global $toc_section; global $toc_mode; $toc_section = $section_name; $toc_mode = "section"; } function subsection($subsection_name) { global $toc_subsection; global $toc_mode; $toc_subsection = $subsection_name; $toc_mode = "subsection"; } function subsubsection($subsubsection_name) { global $toc_subsubsection; global $toc_mode; $toc_subsubsection = $subsubsection_name; $toc_mode = "subsubsection"; } function toc_title($msg, $lang) { global $script_lang; global $script_name; global $toc_mode; global $toc_section; global $toc_subsection; global $toc_subsubsection; global $toc_title_content; if(strcmp($lang, $script_lang)) return; # wrong locale if(!strcmp($toc_mode, "section") && !strcmp($toc_section, $script_name)) $toc_title_content = $msg; if(!strcmp($toc_mode, "subsection") && !strcmp($toc_subsection, $script_name)) $toc_title_content = $msg; if(!strcmp($toc_mode, "subsubsection") && !strcmp($toc_subsubsection, $script_name)) $toc_title_content = $msg; } function toc_link($msg, $lang) { static $separator=0; global $script_lang; global $script_name; global $toc_section; global $toc_subsection; global $toc_subsubsection; global $toc_mode; if(strcmp($lang, $script_lang)) return; # wrong locale # Decide whether this is the currently unfolded section # and render it accordingly if(!strcmp($toc_mode, "section")) { $target=$toc_section . ".php"; # Draw the separator between sections (except for the first one) if(!$separator) $separator=1; else echo " \n"; if(!strcmp($toc_section, $script_name)) echo " $msg\n"; else echo " $msg\n"; } if( !strcmp($toc_mode, "subsection") && !strncmp($toc_section, $script_name, strlen($toc_section))) { $target=$toc_subsection . ".php"; if(!strcmp($toc_subsection, $script_name)) echo " ·$msg\n"; else echo " ·$msg\n"; } # Using strlen($toc_section)+1 is inconvenient as it hardcodes the # section/subsection10/subsubsection11 scheme. Improve! if( !strcmp($toc_mode, "subsubsection") && !strncmp($toc_subsection, $script_name, strlen($toc_section)+1)) { $target=$toc_subsubsection . ".php"; if(!strcmp($toc_subsubsection, $script_name)) echo " -${msg}\n"; else echo " -$msg\n"; } } # # Helper functions for creating the news pages and -flash # function news_headline($headline) { global $news_flash; global $atom_handle; global $create_feed; global $script_lang; global $doc_dir; global $trans_atom_title; if(!$news_flash) echo "

$headline

\n"; if($create_feed != 1) return; # Prodoce atom feed xml file $atom_name="atom.xml"; $atom_handle=fopen("$doc_dir/$script_lang/feed/$atom_name","w"); fwrite($atom_handle, "\n"); fwrite($atom_handle, "\n"); fwrite($atom_handle, "tag:dvdisaster.net,2009-10-02:/$script_lang/feeds/$atom_name\n"); fwrite($atom_handle, "$trans_atom_title\n"); $updated=date(DATE_ATOM); fwrite($atom_handle, "$updated\n"); fwrite($atom_handle, "\n"); fwrite($atom_handle, "\n"); fwrite($atom_handle, " Carsten Gnörlich\n"); fwrite($atom_handle, " http://www.dvdisaster.org\n"); fwrite($atom_handle, "\n"); } function news_finalize() { global $atom_handle; global $create_feed; if($create_feed != 1) return; fwrite($atom_handle, "\n"); fclose($atom_handle); } function news_item($date, $headline, $body, $atom_tag, $atom_created, $atom_updated) { global $news_flash; global $news_counter; global $max_news_flash_items; global $atom_handle; global $create_feed; global $script_lang; $news_counter++; if($create_feed == 1) { $stripped=strtr(strip_tags($body),"\n"," "); $summary=substr($stripped, 0, 240); $cutpos=240-strlen(strrchr($summary, " ")); $summary=substr($stripped, 0, $cutpos)." [...]"; fwrite($atom_handle,"\n"); fwrite($atom_handle,"$headline\n"); fwrite($atom_handle,"\n"); $created=substr($atom_created,0,10); fwrite($atom_handle,"tag:dvdisaster.net,$created:/$script_lang/news.html/$atom_tag\n"); fwrite($atom_handle,"$atom_created\n"); fwrite($atom_handle,"$atom_updated\n"); fwrite($atom_handle,"\n"); fwrite($atom_handle,"$summary\n"); fwrite($atom_handle,"\n"); } if($news_flash) { if($news_counter > $max_news_flash_items) return; echo " $date
\n"; echo " \n"; echo " $headline\n"; echo "

\n"; } else { echo " \n"; echo " \n"; echo " \n"; echo " \n"; echo " \n"; echo "
${headline}$date
\n"; ?>
\n"; echo " \n"; echo "$body\n"; echo " \n"; echo " \n"; echo "

 
\n"; } } # # Actual navigation assembly # function create_navigation() { global $trans_contents; global $script_file; global $mode; if(!strcmp($script_file, "index.php")) $body_width = "57%"; else $body_width = "77%"; ?> \n"; # body contents must be appended here from calling page } ### ### Footer ---------------------------------------------------------------------------- ### # Closes the body table. Optionally includes the news flash. # Appends the copyright and redistribution terms. # function end_page() { global $script_file; global $trans_copyright; global $trans_news; global $trans_fdl; global $trans_hosting; global $news_flash; global $news_counter; global $script_lang; # Close the body table echo " \n"; # Insert news flash if(!strcmp($script_file, "index.php")) { ?> */ ?>
$trans_contents\n"; ?>

$trans_news\n"; echo " \"Subscribe\n"; ?>

$trans_hosting
\n"; ?> insider
$trans_copyright
\n"; echo " $trans_fdl\n"; ?>
\n"; echo "$headline\n"; echo "\"\"\n"; echo "$subtitle\n"; echo "

\n"; } ?>