$word) { $words[$index] = strtolower(removeAccents($word)); // Remove empty string introduced by multiple spaces if (empty($words[$index])) unset($words[$index]); } if (empty($page)) $page = 1; // If searching, display all the results if ($dosearch) $all = true; $maxperpage = 20; // Make sure that we have a repository if (!isset($rep)) { echo $lang["NOREP"]; exit; } $svnrep = new SVNRepository($rep); $passrev = $rev; // If there's no revision info, go to the lastest revision for this path $history = $svnrep->getLog($path, $startrev, $endrev, true); if (is_string($history)) { echo $history; exit; } $youngest = isset($history->entries[0]) ? $history->entries[0]->rev : 0; if (empty($rev)) { $rev = $youngest; } // make sure path is prefixed by a / $ppath = $path; if ($path == "" || $path{0} != "/") { $ppath = "/".$path; } $vars["action"] = $lang["LOG"]; $vars["repname"] = htmlentities($rep->getDisplayName(), ENT_QUOTES, 'UTF-8'); $vars["rev"] = $rev; $vars["path"] = htmlentities($ppath, ENT_QUOTES, 'UTF-8'); createDirLinks($rep, $ppath, $passrev); $vars['indexurl'] = $config->getURL($rep, '', 'index'); $vars['repurl'] = $config->getURL($rep, '', 'dir'); if (!$isDir) { $url = $config->getURL($rep, $path, "file"); $vars["filedetaillink"] = "${lang["FILEDETAIL"]}"; $url = $config->getURL($rep, $path, "diff"); $vars["prevdifflink"] = "${lang["DIFFPREV"]}"; $url = $config->getURL($rep, $path, "blame"); $vars["blamelink"] = "${lang["BLAME"]}"; } $logurl = $config->getURL($rep, $path, "log"); if ($rev != $youngest) { $vars["goyoungestlink"] = "${lang["GOYOUNGEST"]}"; } else { $vars["goyoungestlink"] = ""; } // We get the bugtraq variable just once based on the HEAD $bugtraq = new Bugtraq($rep, $svnrep, $ppath); if ($startrev != "HEAD" && $startrev != "BASE" && $startrev != "PREV" && $startrev != "COMMITTED") $startrev = (int)$startrev; if ($endrev != "HEAD" && $endrev != "BASE" && $endrev != "PREV" && $endrev != "COMMITTED") $endrev = (int)$endrev; if (empty($startrev)) $startrev = $rev; if (empty($endrev)) $endrev = 1; if ($max === false) { $max = $dosearch ? 0 : 30; } else { if ($max < 0) $max = 30; } $history = $svnrep->getLog($path, $startrev, $endrev, true, $max); if (is_string($history)) { echo $history; exit; } $vars["logsearch_moreresultslink"] = ""; $vars["pagelinks"] = ""; $vars["showalllink"] = ""; $listing = array(); if (!empty($history)) { // Get the number of separate revisions $revisions = count($history->entries); if ($all) { $firstrevindex = 0; $lastrevindex = $revisions - 1; $pages = 1; } else { // Calculate the number of pages $pages = floor($revisions / $maxperpage); if (($revisions % $maxperpage) > 0) $pages++; if ($page > $pages) $page = $pages; // Word out where to start and stop $firstrevindex = ($page - 1) * $maxperpage; $lastrevindex = $firstrevindex + $maxperpage - 1; if ($lastrevindex > $revisions - 1) $lastrevindex = $revisions - 1; } $brev = isset($history->entries[$firstrevindex ]) ? $history->entries[$firstrevindex ]->rev : false; $erev = isset($history->entries[$lastrevindex]) ? $history->entries[$lastrevindex]->rev : false; $entries = array(); if ($brev && $erev) { $history = $svnrep->getLog($path, $brev, $erev, false, 0); if (is_string($history)) { echo $history; exit; } $entries = $history->entries; } $row = 0; $index = 0; $listing = array(); $found = false; foreach ($entries as $r) { // Assume a good match $match = true; $thisrev = $r->rev; // Check the log for the search words, if searching if ($dosearch) { if ((empty($fromRev) || $fromRev > $thisrev)) { // Turn all the HTML entities into real characters. // Make sure that each word in the search in also in the log foreach ($words as $word) { if (strpos(strtolower(removeAccents($r->msg)), $word) === false && strpos(strtolower(removeAccents($r->author)), $word) === false) { $match = false; break; } } if ($match) { $numSearchResults--; $found = true; } } else { $match = false; } } if ($match) { // Add the trailing slash if we need to (svnlook history doesn't return trailing slashes!) $rpath = $r->path; if (empty($rpath)) { $rpath = "/"; } else if ($isDir && $rpath{strlen($rpath) - 1} != "/") { $rpath .= "/"; } // Find the parent path (or the whole path if it's already a directory) $pos = strrpos($rpath, "/"); $parent = substr($rpath, 0, $pos + 1); $url = $config->getURL($rep, $parent, "revision"); $listing[$index]["revlink"] = "$thisrev"; if ($isDir) { $listing[$index]["compare_box"] = ""; $url = $config->getURL($rep, $rpath, "dir"); $listing[$index]["revpathlink"] = "$rpath"; } else { $listing[$index]["compare_box"] = ""; $url = $config->getURL($rep, $rpath, "file"); $listing[$index]["revpathlink"] = "$rpath"; } $listing[$index]["revauthor"] = $r->author; $listing[$index]["date"] = $r->date; $listing[$index]["revage"] = $r->age; $listing[$index]["revlog"] = nl2br($bugtraq->replaceIDs(create_anchors($r->msg))); $listing[$index]["rowparity"] = $row; $row = 1 - $row; $index++; } // If we've reached the search limit, stop here... if (!$numSearchResults) { $url = $config->getURL($rep, $path, "log"); $vars["logsearch_moreresultslink"] = "${lang["MORERESULTS"]}"; break; } } $vars["logsearch_resultsfound"] = true; if ($dosearch && !$found) { if ($fromRev == 0) { $vars["logsearch_nomatches"] = true; $vars["logsearch_resultsfound"] = false; } else { $vars["logsearch_nomorematches"] = true; } } else if ($dosearch && $numSearchResults > 0) { $vars["logsearch_nomorematches"] = true; } // Work out the paging options if ($pages > 1) { $prev = $page - 1; $next = $page + 1; if ($page > 1) $vars["pagelinks"] .= "< ${lang["PREV"]} "; for ($p = 1; $p <= $pages; $p++) { if ($p != $page) { $vars["pagelinks"].= "$p "; } else { $vars["pagelinks"] .= "$p "; } } if ($page < $pages) $vars["pagelinks"] .=" ${lang["NEXT"]} >"; $vars["showalllink"] = "${lang["SHOWALL"]}"; } } // Create the project change combo box $url = $config->getURL($rep, $path, "log"); // XXX: forms don't have the name attribute, but _everything_ has the id attribute, // so what you're trying to do (if anything?) should be done via that ~J $vars["logsearch_form"] = "
"; if ($page !== 1 || $all || $dosearch || $fromRev || $startrev !== $rev || $endrev !== 1 || $max !== 30) { $url = $config->getURL($rep, $path, "log"); $vars["logsearch_clearloglink"] = "${lang["CLEARLOG"]}"; } $url = $config->getURL($rep, "/", "comp"); $vars["compare_form"] = ""; $vars['showageinsteadofdate'] = $config->showAgeInsteadOfDate; $vars["version"] = $version; if (!$rep->hasReadAccess($path, false)) { $vars["noaccess"] = true; } parseTemplate($rep->getTemplatePath()."header.tmpl", $vars, $listing); parseTemplate($rep->getTemplatePath()."log.tmpl", $vars, $listing); parseTemplate($rep->getTemplatePath()."footer.tmpl", $vars, $listing); $word) { $words[$index] = strtolower(removeAccents($word)); // Remove empty string introduced by multiple spaces if (empty($words[$index])) unset($words[$index]); } if (empty($page)) $page = 1; // If searching, display all the results if ($dosearch) $all = true; $maxperpage = 20; // Make sure that we have a repository if (!isset($rep)) { echo $lang["NOREP"]; exit; } $svnrep = new SVNRepository($rep); $passrev = $rev; // If there's no revision info, go to the lastest revision for this path $history = $svnrep->getLog($path, "", "", true); $youngest = isset($history->entries[0]) ? $history->entries[0]->rev : 0; if (empty($rev)) { $rev = $youngest; } // make sure path is prefixed by a / $ppath = $path; if ($path == "" || $path{0} != "/") { $ppath = "/".$path; } $vars["action"] = $lang["LOG"]; $vars["repname"] = htmlentities($rep->getDisplayName(), ENT_QUOTES, 'UTF-8'); $vars["rev"] = $rev; $vars["path"] = htmlentities($ppath, ENT_QUOTES, 'UTF-8'); createDirLinks($rep, $ppath, $passrev); $vars['indexurl'] = $config->getURL($rep, '', 'index'); $vars['repurl'] = $config->getURL($rep, '', 'dir'); if (!$isDir) { $url = $config->getURL($rep, $path, "file"); $vars["filedetaillink"] = "${lang["FILEDETAIL"]}"; $url = $config->getURL($rep, $path, "diff"); $vars["prevdifflink"] = "${lang["DIFFPREV"]}"; $url = $config->getURL($rep, $path, "blame"); $vars["blamelink"] = "${lang["BLAME"]}"; } $logurl = $config->getURL($rep, $path, "log"); if ($rev != $youngest) { $vars["goyoungestlink"] = "${lang["GOYOUNGEST"]}"; } else { $vars["goyoungestlink"] = ""; } // We get the bugtraq variable just once based on the HEAD $bugtraq = new Bugtraq($rep, $svnrep, $ppath); if ($startrev != "HEAD" && $startrev != "BASE" && $startrev != "PREV" && $startrev != "COMMITTED") $startrev = (int)$startrev; if ($endrev != "HEAD" && $endrev != "BASE" && $endrev != "PREV" && $endrev != "COMMITTED") $endrev = (int)$endrev; if (empty($startrev)) $startrev = $rev; if (empty($endrev)) $endrev = 1; if ($max === false) { $max = $dosearch ? 0 : 30; } else { if ($max < 0) $max = 30; } $history = $svnrep->getLog($path, $startrev, $endrev, true, $max); $vars["logsearch_moreresultslink"] = ""; $vars["pagelinks"] = ""; $vars["showalllink"] = ""; $listing = array(); if (!empty($history)) { // Get the number of separate revisions $revisions = count($history->entries); if ($all) { $firstrevindex = 0; $lastrevindex = $revisions - 1; $pages = 1; } else { // Calculate the number of pages $pages = floor($revisions / $maxperpage); if (($revisions % $maxperpage) > 0) $pages++; if ($page > $pages) $page = $pages; // Word out where to start and stop $firstrevindex = ($page - 1) * $maxperpage; $lastrevindex = $firstrevindex + $maxperpage - 1; if ($lastrevindex > $revisions - 1) $lastrevindex = $revisions - 1; } $brev = isset($history->entries[$firstrevindex ]) ? $history->entries[$firstrevindex ]->rev : false; $erev = isset($history->entries[$lastrevindex]) ? $history->entries[$lastrevindex]->rev : false; $entries = array(); if ($brev && $erev) { $history = $svnrep->getLog($path, $brev, $erev, false, 0); $entries = $history->entries; } $row = 0; $index = 0; $listing = array(); $found = false; foreach ($entries as $r) { // Assume a good match $match = true; $thisrev = $r->rev; // Check the log for the search words, if searching if ($dosearch) { if ((empty($fromRev) || $fromRev > $thisrev)) { // Turn all the HTML entities into real characters. // Make sure that each word in the search in also in the log foreach ($words as $word) { if (strpos(strtolower(removeAccents($r->msg)), $word) === false && strpos(strtolower(removeAccents($r->author)), $word) === false) { $match = false; break; } } if ($match) { $numSearchResults--; $found = true; } } else { $match = false; } } if ($match) { // Add the trailing slash if we need to (svnlook history doesn't return trailing slashes!) $rpath = $r->path; if (empty($rpath)) { $rpath = "/"; } else if ($isDir && $rpath{strlen($rpath) - 1} != "/") { $rpath .= "/"; } // Find the parent path (or the whole path if it's already a directory) $pos = strrpos($rpath, "/"); $parent = substr($rpath, 0, $pos + 1); $url = $config->getURL($rep, $parent, "revision"); $listing[$index]["revlink"] = "$thisrev"; if ($isDir) { $listing[$index]["compare_box"] = ""; $url = $config->getURL($rep, $rpath, "dir"); $listing[$index]["revpathlink"] = "$rpath"; } else { $listing[$index]["compare_box"] = ""; $url = $config->getURL($rep, $rpath, "file"); $listing[$index]["revpathlink"] = "$rpath"; } $listing[$index]["revauthor"] = $r->author; $listing[$index]["revage"] = $r->age; $listing[$index]["revlog"] = nl2br($bugtraq->replaceIDs(create_anchors($r->msg))); $listing[$index]["rowparity"] = $row; $row = 1 - $row; $index++; } // If we've reached the search limit, stop here... if (!$numSearchResults) { $url = $config->getURL($rep, $path, "log"); $vars["logsearch_moreresultslink"] = "${lang["MORERESULTS"]}"; break; } } $vars["logsearch_resultsfound"] = true; if ($dosearch && !$found) { if ($fromRev == 0) { $vars["logsearch_nomatches"] = true; $vars["logsearch_resultsfound"] = false; } else { $vars["logsearch_nomorematches"] = true; } } else if ($dosearch && $numSearchResults > 0) { $vars["logsearch_nomorematches"] = true; } // Work out the paging options if ($pages > 1) { $prev = $page - 1; $next = $page + 1; if ($page > 1) $vars["pagelinks"] .= "< ${lang["PREV"]} "; for ($p = 1; $p <= $pages; $p++) { if ($p != $page) { $vars["pagelinks"].= "$p "; } else { $vars["pagelinks"] .= "$p "; } } if ($page < $pages) $vars["pagelinks"] .=" ${lang["NEXT"]} >"; $vars["showalllink"] = "${lang["SHOWALL"]}"; } } // Create the project change combo box $url = $config->getURL($rep, $path, "log"); // XXX: forms don't have the name attribute, but _everything_ has the id attribute, // so what you're trying to do (if anything?) should be done via that ~J $vars["logsearch_form"] = ""; $url = $config->getURL($rep, $path, "log"); $vars["logsearch_clearloglink"] = "${lang["CLEARLOG"]}"; $url = $config->getURL($rep, "/", "comp"); $vars["compare_form"] = ""; $vars["version"] = $version; if (!$rep->hasReadAccess($path, false)) { $vars["noaccess"] = true; } parseTemplate($rep->getTemplatePath()."header.tmpl", $vars, $listing); parseTemplate($rep->getTemplatePath()."log.tmpl", $vars, $listing); parseTemplate($rep->getTemplatePath()."footer.tmpl", $vars, $listing);websvn |
Subversion Repositories: |
Rev 1 | Rev 3 |
---|