Added a page to display details about a source
Placeholder source detail page which checks that the source is valid and lies below the configured rips.source_dir.
This commit is contained in:
24
pages/browse/source-details.php
Normal file
24
pages/browse/source-details.php
Normal file
@@ -0,0 +1,24 @@
|
||||
<?php
|
||||
|
||||
$main = HandBrakeCluster_Main::instance();
|
||||
$req = $main->request();
|
||||
$config = $main->config();
|
||||
|
||||
// Grab the name of this source
|
||||
$source_id = $req->get('id');
|
||||
$source = base64_decode(str_replace('-', '/', $source_id));
|
||||
$real_source = realpath($source);
|
||||
|
||||
// Ensure the source is a valid directory, and lies below the configured source_dir
|
||||
if (!is_dir($source)) {
|
||||
return;
|
||||
}
|
||||
|
||||
$real_source_dir = realpath($config->get('rips.source_dir'));
|
||||
if (substr($real_source, 0, strlen($real_source_dir)) != $real_source_dir) {
|
||||
return;
|
||||
}
|
||||
|
||||
$this->smarty->assign('source', $source);
|
||||
|
||||
?>
|
||||
23
templates/browse/source-details.tpl
Normal file
23
templates/browse/source-details.tpl
Normal file
@@ -0,0 +1,23 @@
|
||||
<h2>Source details</h2>
|
||||
|
||||
{if $source}
|
||||
<table class="source-details">
|
||||
<colgroup class="header">
|
||||
<col />
|
||||
</colgroup>
|
||||
<colgroup>
|
||||
<col />
|
||||
</colgroup>
|
||||
|
||||
<tbody>
|
||||
<tr>
|
||||
<th>Source</th>
|
||||
<td>{$source|escape:"html"}</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
{else}
|
||||
<p>
|
||||
<em>This is not a valid source.</em>
|
||||
</p>
|
||||
{/if}
|
||||
@@ -6,7 +6,7 @@
|
||||
</p>
|
||||
<ul>
|
||||
{foreach from=$sources item=source}
|
||||
<li>{$source|escape:'html'}</li>
|
||||
<li><a href="{$base_uri}browse/source-details/id/{$source|base64_encode|replace:"/":"-"}" title="View source details">{$source|escape:'html'}</a></li>
|
||||
{/foreach}
|
||||
</ul>
|
||||
{else}
|
||||
|
||||
Reference in New Issue
Block a user