Indefero

Indefero Commit Details


Date:2008-08-05 12:58:21 (16 years 4 months ago)
Author:Loic d'Anterroches
Branch:dev, 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, master, release-1.1, release-1.2, release-1.3, svn
Commit:3990098e4b124ae065cb819dd633551fea56f8ea
Parents: 5e3b2bac28da61363c59f2bddde2210645064183
Message:Added better control that the issue/download are in the project.

When you view/edit a download or issue, if the download/issue is not in
the current project a 404 page is returned.
Changes:

File differences

src/IDF/Project.php
319319
320320
321321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
322338
// containing a series of git repositories
return $gitrep.'/'.$this->shortname.'.git';
}
/**
* Check that the object belongs to the project or rise a 404
* error.
*
* By convention, all the objects belonging to a project have the
* 'project' property set, so this is easy to check.
*
* @param Pluf_Model
*/
public function inOr404($obj)
{
if ($obj->project != $this->id) {
throw new Pluf_HTTP_Error404();
}
}
}
src/IDF/Views/Download.php
7777
7878
7979
80
81
82
80
8381
8482
8583
......
121119
122120
123121
124
125
126
122
127123
128124
129125
......
199195
200196
201197
202
203
204198
205199
206200
{
$prj = $request->project;
$upload = Pluf_Shortcuts_GetObjectOr404('IDF_Upload', $match[2]);
if ($upload->project != $prj->id) {
throw new Pluf_HTTP_Error404();
}
$prj->inOr404($upload);
$title = sprintf(__('Download %s'), $upload->summary);
$form = false;
if ($request->method == 'POST' and
{
$prj = $request->project;
$upload = Pluf_Shortcuts_GetObjectOr404('IDF_Upload', $match[2]);
if ($upload->project != $prj->id) {
throw new Pluf_HTTP_Error404();
}
$prj->inOr404($upload);
$upload->downloads += 1;
$upload->update();
return new Pluf_HTTP_Response_Redirect($upload->getAbsoluteUrl($prj));
*/
function IDF_Views_Download_SummaryAndLabels($field, $down, $extra='')
{
//$edit = Pluf_HTTP_URL_urlForView('IDF_Views_Download::view',
// array($down->shortname, $down->id));
$tags = array();
foreach ($down->get_tags_list() as $tag) {
$tags[] = sprintf('<span class="label">%s</span>', Pluf_esc((string) $tag));
src/IDF/Views/Issue.php
161161
162162
163163
164
165
166
164
167165
168166
169167
{
$prj = $request->project;
$issue = Pluf_Shortcuts_GetObjectOr404('IDF_Issue', $match[2]);
if ($issue->project != $prj->id) {
throw new Pluf_HTTP_Error404();
}
$prj->inOr404($issue);
$comments = $issue->get_comments_list(array('order' => 'id ASC'));
$url = Pluf_HTTP_URL_urlForView('IDF_Views_Issue::view',
array($prj->shortname, $issue->id));

Archive Download the corresponding diff file

Page rendered in 0.08818s using 13 queries.