Repository is temporary not responding. Try again later."); fwrite($handle, emergency_html()); fclose($handle); readfile($cacheFile); return; } $items = publish_rss20($repository, $contents, $rss); $handle = fopen($cacheFile, "w+"); for($i = 0; $i < count($items) && $i < 3; $i++) { fwrite($handle, $items[count($items) - $i - 1]["html_description"]); } if (count($items) == 0) { fwrite($handle, "repository is temporary not responding. try again later."); } fclose($handle); readfile($cacheFile); } function publish_rss20($repository, $contents, $rss) { if (preg_match_all("/
  • (.*\..*\..*)(<\/a>)<\/li>/", $contents, $matches)) { $items = array(); $index = 0; for($i = 0; $i < count($matches[1]); $i++) { $build = $matches[1][$i]; $changelog_url = $repository . $build . "/changelog.txt"; $changelog = read_contents($changelog_url); if (!$changelog) { continue; } $standalone_name = "org.tmatesoft.svn_" . $build . ".standalone.zip"; $eclipse_name = "org.tmatesoft.svn_" . $build . ".eclipse.zip"; $src_name = "org.tmatesoft.svn_" . $build . ".src.zip"; $standalone_file = $_SERVER["DOCUMENT_ROOT"] . "/svn/" . $standalone_name; if (!file_exists($standalone_file)) { continue; } $svn_url = $repository . $build . "/"; $standalone_link = $rss . $standalone_name; $src_url = $rss . $src_name; $eclipse_url = $rss . $eclipse_name; $eclipse_update_url = $rss; ereg("^=[^\n]+\n([^=]+).*$", $changelog, $m); $changelog_str = trim($m[1]); $date_string = date("j M Y, H:i", filemtime($standalone_file)); $item_description = "" . $date_string . ", build: " . $build . "

    "; $item_description .= ""; $item_description .= ""; $item_description .= ""; $item_description .= ""; $item_description .= "
    standalone version: " . $standalone_name . "
    source code archive: " . $src_name . "
    source code: @svn repository
    eclipse update site archive: " . $eclipse_name . "
    eclipse update site location: " . $eclipse_update_url . "

    "; $item_description .= "
    ChangeLog
    " . $changelog_str . "
    "; $item_description .= "
    full changelog up to this build"; $item_description .= "
    Contact

    Your questions and feedback are welcome at support@tmatesoft.com

    "; $html_description = " " . $date_string . ", build " . $build . ""; $html_description .= " Changelog:"; $html_description .= "
    " . $changelog_str . "
    "; $html_description .= "full changelog up to this build"; $html_description .= " Standalone Version " . $standalone_name . ""; $html_description .= " Source Code Archive " . $src_name . " "; $html_description .= " Eclipse Update Site Archive " . $eclipse_name . ""; $html_description .= " Eclipse Update Site Location   " . $eclipse_update_url . ""; $html_description .= " Source Code @svn repository"; $html_description .= ""; $item = array(); $item["title"] = "Build '" . $build . "' published"; $item["source"] = "http://tmate.org/svn/"; $item["link"] = "http://tmate.org/svn/"; $item["author"] = "TMate Software"; $item["date"] = filemtime($standalone_file); $item["rss_description"] = $item_description; $item["html_description"] = $html_description; $items[$index++] = $item; } } return $items; } function read_contents($url) { $fp = fsockopen("72.9.228.230", 8080, $errno, $errstr, 1); if (!$fp) { return false; } fclose($fp); $handle = fopen($url, "rb"); if (!$handle) { return false; } $contents = ''; while (!feof($handle)) { $contents .= fread($handle, 8192); } fclose($handle); return $contents; } function emergency_html() { // Open a known directory, and proceed to read its contents $dir = $_SERVER["DOCUMENT_ROOT"] . "/svn/"; $result = ""; if (is_dir($dir)) { if ($dh = opendir($dir)) { $entries = array(); $index = 0; while (($file = readdir($dh)) !== false) { $matches = array(); ereg("^.+_([0-9]+)\.standalone\.zip$", $file, $matches); if (count($matches) > 1) { $entries[$index++] = $matches[1]; } } closedir($dh); sort($entries); if (count($entries) > 0) { $result = $entries[count($entries) - 1]; $result = "Latest binary version is org.tmatesoft.svn_" . $result .".standalone.zip"; } } } return $result; } function publish_examples($url){ $docURL = "http://72.9.228.230:8080/svn/jsvn/branches/0.9.0/doc/examples/src/org/tmatesoft/svn/examples"; $examplesPath = array($docURL."/repository/",$docURL."/wc/"); $result = array(); for($k = 0; $k < count($examplesPath); $k++){ $result[$examplesPath[$k]] = collect_examples($examplesPath[$k]); } if(count($result)<1){ return $url; } $examplesListFrameFile = $_SERVER["DOCUMENT_ROOT"] . "/svn/feed/ExamplesList.html"; $fhandle = fopen($examplesListFrameFile, "w+"); fwrite($fhandle, "Example Programs :: Documentation :: Pure Java Subversion (SVN) Client Library". "
    Home :: Documentation :: Example Programs". "

    Example Programs

    ". "The following examples may help you
    ". "to become more familiar with the
    ". "JavaSVN API:


    "); for($k = 0; $k < count($examplesPath); $k++) { $matches = array(); $exampleDirectory = $examplesPath[$k]; if(ereg("org/tmatesoft/svn/examples/[^/]+", $examplesPath[$k], $matches)){ $exampleDirectory = str_replace("/", ".", $matches[0]); } fwrite($fhandle, "
    "); fwrite($fhandle, "
    ".$exampleDirectory.""); for($l = 0; $l < count($result[$examplesPath[$k]][$examplesPath[$k]]); $l++){ fwrite($fhandle, "
       ...".$result[$examplesPath[$k]][$examplesPath[$k]][$l].""); } fwrite($fhandle, "
    "); } fwrite($fhandle, "
    (c) 2004-2005 TMate Software. All rights reserved.
    "); fclose($fhandle); echo "Example Programs :: Documentation :: Pure Java Subversion (SVN) Client Library"; } function collect_examples($examplesPath) { $handle = fopen($examplesPath, "rt"); if (!$handle) { return false; } $contents = ''; while (!feof($handle)) { $contents .= fread($handle, 8192); } fclose($handle); if (preg_match_all("||U", $contents, $matches, PREG_PATTERN_ORDER)) { $entries = array(); $index=0; for($i = 0; $i < count($matches[0]); $i++) { $entries[$index++] = $matches[1][$i]; } $directoryEntries = array(); $directoryEntries[$examplesPath] = $entries; return $directoryEntries; } return false; } function display_file($fileURL){ $handle = fopen($fileURL, "rt"); if (!$handle) { return false; } $contents = ''; while (!feof($handle)) { $contents .= fread($handle, 8192); } fclose($handle); $fileName = $fileURL; if(ereg("[^/]+\.java", $fileURL, $matches)){ $fileName = $matches[0]; } include_once 'geshi/geshi.php'; $geshi = new GeSHi($contents, 'java'); $geshi->set_header_type(GESHI_HEADER_PRE); $geshi->set_numbers_highlighting(false); $geshi->set_overall_style('color: rgb(0,0,0); border: 1px solid #d0d0d0; background-color: #f0f0f0;', true); // Note the use of set_code_style to revert colours... $geshi->set_line_style('font: normal normal 95% \'Courier New\', Courier, monospace; color: black;', 'font-weight: bold; color: blue;', true); //for methods $geshi->set_methods_style(1, "color: black;", false); //for multi-line comments /**/ $geshi->set_comments_style('MULTI','color: rgb(63,127,95); font-style: code;', false); //for 'import' keyword $geshi->set_comments_style(2,'color: rgb(127,0,85); font-weight: bold;', false); //for string constants $geshi->set_strings_style('color: rgb(42,0,255);', true); //for links (standard classes, etc.) $geshi->set_link_styles(GESHI_LINK, 'color: #000060;'); $geshi->set_link_styles(GESHI_HOVER, 'background-color: #f0f000;'); //for keywords $geshi->set_keyword_group_style(1,'color: rgb(127,0,85); font-weight: bold;', false); $geshi->set_keyword_group_style(2,'color: rgb(127,0,85); font-weight: bold;', false); $geshi->set_keyword_group_style(4,'color: rgb(127,0,85); font-weight: bold;', false); //new keyword group for 'package' $geshi->add_keyword_group(5, 'color: rgb(127,0,85); font-weight: bold;', true, array('package', 'import')); $geshi->set_header_content('JavaSVN API examlpe: '.$fileName); $geshi->set_header_content_style('font-family: Verdana, Arial, sans-serif; color: #808080; font-size: 70%; font-weight: bold; background-color: #f0f0ff; border-bottom: 1px solid #d0d0d0; padding: 2px;'); $geshi->set_symbols_highlighting(false); $geshi->set_footer_content_style('font-family: Verdana, Arial, sans-serif; color: #808080; font-size: 70%; font-weight: bold; background-color: #f0f0ff; border-top: 1px solid #d0d0d0; padding: 2px;'); $code = $geshi->parse_code(); echo "".$code."
    (c) 2004-2005 TMate Software. All rights reserved.
    "; } ?>