Indefero

Indefero Commit Details


Date:2011-03-03 16:42:21 (13 years 9 months ago)
Author:Thomas Keller
Branch:develop, feature-issue_links, feature.better-home, feature.content-md5, feature.diff-whitespace, feature.download-md5, feature.issue-links, feature.issue-of-others, feature.issue-summary, feature.search-filter, feature.webrepos, feature.wiki-default-page, release-1.1, release-1.2, release-1.3
Commit:f63bfcb4f64642ddf321deedf63638aaf57829a7
Parents: 177cf836b4bc3688baa5a02261932960fde75a35
Message:Raise PCRE's backtrack_limit for our regex callback usage to avoid spurious errors on weird input (fixes issue 618).

Changes:

File differences

src/IDF/Template/IssueComment.php
3434
3535
3636
37
38
39
40
41
3742
3843
3944
......
6772
6873
6974
75
76
7077
7178
7279
......
234241
235242
236243
237
244
238245
239246
240247
......
248255
249256
250257
251
258
252259
253260
254261
function start($text, $request, $echo=true, $wordwrap=true, $esc=true, $autolink=true, $nl2br=false)
{
// PHP sets the backtrack limit quite low, so some regexes may
// fail unexpectedly on large inputs or weird cornercases (see issue 618)
$pcre_backtrack_limit = ini_get('pcre.backtrack_limit');
ini_set('pcre.backtrack_limit', 10000000);
$this->project = $request->project;
$this->request = $request;
$this->scm = IDF_Scm::get($request->project);
} else {
return $text;
}
ini_set('pcre.backtrack_limit', $pcre_backtrack_limit);
}
/**
public function linkIssue($issue, $title, $anchor='')
{
$ic = (in_array($issue->status, $this->project->getTagIdsByStatus('closed'))) ? 'issue-c' : 'issue-o';
return '<a href="'.Pluf_HTTP_URL_urlForView('IDF_Views_Issue::view',
return '<a href="'.Pluf_HTTP_URL_urlForView('IDF_Views_Issue::view',
array($this->project->shortname, $issue->id)).$anchor.'" class="'.$ic.'" title="'.Pluf_esc($issue->summary).'">'.Pluf_esc($title).'</a>';
}
public function linkReview($review, $title, $anchor='')
{
$ic = (in_array($review->status, $this->project->getTagIdsByStatus('closed'))) ? 'issue-c' : 'issue-o';
return '<a href="'.Pluf_HTTP_URL_urlForView('IDF_Views_Review::view',
return '<a href="'.Pluf_HTTP_URL_urlForView('IDF_Views_Review::view',
array($this->project->shortname, $review->id)).$anchor.'" class="'.$ic.'" title="'.Pluf_esc($review->summary).'">'.Pluf_esc($title).'</a>';
}
}
src/IDF/Template/Markdown.php
3434
3535
3636
37
38
39
40
41
3742
3843
3944
......
4348
4449
4550
46
51
4752
4853
4954
......
5661
5762
5863
64
65
5966
6067
6168
......
6673
6774
6875
69
76
7077
7178
7279
......
7885
7986
8087
81
88
8289
8390
8491
......
94101
95102
96103
97
104
98105
99106
100107
function start($text, $request)
{
// PHP sets the backtrack limit quite low, so some regexes may
// fail unexpectedly on large inputs or weird cornercases (see issue 618)
$pcre_backtrack_limit = ini_get('pcre.backtrack_limit');
ini_set('pcre.backtrack_limit', 10000000);
$this->project = $request->project;
$this->request = $request;
// Replace like in the issue text
// the content of the file into the wki page
if ($this->request->rights['hasSourceAccess']) {
$text = preg_replace_callback('#\[\[\[([^\,]+)(?:, ([^/]+))?\]\]\]#im',
array($this, 'callbackEmbeddedDoc'),
array($this, 'callbackEmbeddedDoc'),
$text);
}
// Replace [Page]([[PageName]]) with corresponding link to the page, with link text being Page.
$text);
$filter = new IDF_Template_MarkdownPrefilter();
echo $filter->go(Pluf_Text_MarkDown_parse($text));
ini_set('pcre.backtrack_limit', $pcre_backtrack_limit);
}
function callbackWikiPageNoName($m)
function callbackWikiPage($m)
{
$sql = new Pluf_SQL('project=%s AND title=%s',
$sql = new Pluf_SQL('project=%s AND title=%s',
array($this->project->id, $m[2]));
$pages = Pluf::factory('IDF_WikiPage')->getList(array('filter'=>$sql->gen()));
if ($pages->count() != 1 and $this->request->rights['hasWikiAccess']
}
return '<a href="'.Pluf_HTTP_URL_urlForView('IDF_Views_Wiki::view', array($this->project->shortname, $pages[0]->title)).'" title="'.Pluf_esc($pages[0]->summary).'">'.$m[1].'</a>';
}
function callbackEmbeddedDoc($m)
{
$scm = IDF_Scm::get($this->request->project);
return $m[0];
}
$info = pathinfo($m[1]);
$fileinfo = array($res->headers['Content-Type'], $m[1],
$fileinfo = array($res->headers['Content-Type'], $m[1],
isset($info['extension']) ? $info['extension'] : 'bin');
if (!IDF_FileUtil::isText($fileinfo)) {
return $m[0];

Archive Download the corresponding diff file

Page rendered in 0.11712s using 14 queries.