updated public link fix
This commit is contained in:
parent
ecd2738e83
commit
544c61f983
4 changed files with 16 additions and 33 deletions
|
@ -6,14 +6,8 @@ require_once '../../../lib/base.php';
|
||||||
require_once '../lib_public.php';
|
require_once '../lib_public.php';
|
||||||
|
|
||||||
$path=$_GET['path'];
|
$path=$_GET['path'];
|
||||||
$expire=(isset($_GET['expire']))?$_GET['expire']:0;
|
$expire=0;
|
||||||
if($expire!==0){
|
|
||||||
|
|
||||||
$expire=strtotime($expire);
|
|
||||||
}
|
|
||||||
// echo $expire;
|
|
||||||
// die();
|
|
||||||
|
|
||||||
$link=new OC_PublicLink($path,$expire);
|
$link=new OC_PublicLink($path,$expire);
|
||||||
echo $link->getToken();
|
echo $link->getToken();
|
||||||
?>
|
?>
|
||||||
|
|
|
@ -34,7 +34,7 @@ $(document).ready(function() {
|
||||||
html+="<td class='link'><a href='get.php?token="+token+"'>"+$('#baseUrl').val()+"?token="+token+"</a></td>"
|
html+="<td class='link'><a href='get.php?token="+token+"'>"+$('#baseUrl').val()+"?token="+token+"</a></td>"
|
||||||
html+="<td><input type='submit' class='delete' data-token='"+token+" value='Delete' /></td>"
|
html+="<td><input type='submit' class='delete' data-token='"+token+" value='Delete' /></td>"
|
||||||
html+="</tr>"
|
html+="</tr>"
|
||||||
$(html).insertBefore($('#newlink_row'));
|
$(html).insertAfter($('#newlink_row'));
|
||||||
$('#path').val('');
|
$('#path').val('');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -24,11 +24,7 @@ class OC_PublicLink{
|
||||||
/**
|
/**
|
||||||
* get the path of that shared file
|
* get the path of that shared file
|
||||||
*/
|
*/
|
||||||
public static function getPath($token){
|
public static function getPath($token) {
|
||||||
//remove expired links
|
|
||||||
$query=OC_DB::prepare("DELETE FROM *PREFIX*publiclink WHERE expire_time < ? AND expire_time!=0");
|
|
||||||
$query->execute(array(time()));
|
|
||||||
|
|
||||||
//get the path and the user
|
//get the path and the user
|
||||||
$query=OC_DB::prepare("SELECT user,path FROM *PREFIX*publiclink WHERE token=?");
|
$query=OC_DB::prepare("SELECT user,path FROM *PREFIX*publiclink WHERE token=?");
|
||||||
$result=$query->execute(array($token));
|
$result=$query->execute(array($token));
|
||||||
|
@ -77,4 +73,4 @@ class OC_PublicLink{
|
||||||
|
|
||||||
private $token;
|
private $token;
|
||||||
}
|
}
|
||||||
?>
|
?>
|
||||||
|
|
|
@ -1,25 +1,18 @@
|
||||||
<input type='hidden' id='baseUrl' value='<?php echo $_['baseUrl'];?>'/>
|
<input type="hidden" id="baseUrl" value="<?php echo $_['baseUrl'];?>"/>
|
||||||
<table id='linklist'>
|
<table id="linklist">
|
||||||
<thead>
|
|
||||||
<tr>
|
|
||||||
<td class='path'><?php echo $l->t( 'Path' ); ?></td>
|
|
||||||
<td class='link'><?php echo $l->t( 'Link' ); ?></td>
|
|
||||||
</tr>
|
|
||||||
</thead>
|
|
||||||
<tbody>
|
<tbody>
|
||||||
|
<tr id="newlink_row">
|
||||||
|
<form action="#" id="newlink">
|
||||||
|
<td class="path"><input placeholder="Path" id="path"/></td>
|
||||||
|
<td><input type="submit" value="Share" /></td>
|
||||||
|
</form>
|
||||||
|
</tr>
|
||||||
<?php foreach($_['links'] as $link):?>
|
<?php foreach($_['links'] as $link):?>
|
||||||
<tr class='link' id='<?php echo $link['token'];?>'>
|
<tr class="link" id="<?php echo $link['token'];?>">
|
||||||
<td class='path'><?php echo $link['path'];?></td>
|
<td class="path"><?php echo $link['path'];?></td>
|
||||||
<td class='link'><a href='get.php?token=<?php echo $link['token'];?>'><?php echo $_['baseUrl'];?>?token=<?php echo $link['token'];?></a></td>
|
<td class="link"><a href="get.php?token=<?php echo $link['token'];?>"><?php echo $_['baseUrl'];?>?token=<?php echo $link['token'];?></a></td>
|
||||||
<td><input type="submit" class="delete" data-token="<?php echo $link['token'];?>" value="<?php echo $l->t( 'Delete' ); ?>" /></td>
|
<td><input type="submit" class="delete" data-token="<?php echo $link['token'];?>" value="<?php echo $l->t( 'Delete' ); ?>" /></td>
|
||||||
</tr>
|
</tr>
|
||||||
<?php endforeach;?>
|
<?php endforeach;?>
|
||||||
<tr id='newlink_row'>
|
|
||||||
<form action='#' id='newlink'>
|
|
||||||
<input type='hidden' id='expire_time'/>
|
|
||||||
<td class='path'><input placeholder='Path' id='path'/></td>
|
|
||||||
<td><input type='submit' value='Share'/></td>
|
|
||||||
</form>
|
|
||||||
</tr>
|
|
||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
|
|
Loading…
Reference in a new issue