summaryrefslogtreecommitdiffstats
path: root/apps
diff options
context:
space:
mode:
authorJan-Christoph Borchardt <JanCBorchardt@fsfe.org>2011-08-08 13:19:22 +0200
committerJan-Christoph Borchardt <JanCBorchardt@fsfe.org>2011-08-08 13:19:22 +0200
commit544c61f983571c87e0753775b53dcf2866848ed2 (patch)
tree022aeb17860b08e1db870d6f52fdef1e84018d3d /apps
parentecd2738e8397e8773c13a8bc4bf4ebfb360442ba (diff)
downloadnextcloud-server-544c61f983571c87e0753775b53dcf2866848ed2.tar.gz
nextcloud-server-544c61f983571c87e0753775b53dcf2866848ed2.zip
updated public link fix
Diffstat (limited to 'apps')
-rw-r--r--apps/files_publiclink/ajax/makelink.php10
-rw-r--r--apps/files_publiclink/js/admin.js2
-rw-r--r--apps/files_publiclink/lib_public.php8
-rw-r--r--apps/files_publiclink/templates/admin.php29
4 files changed, 16 insertions, 33 deletions
diff --git a/apps/files_publiclink/ajax/makelink.php b/apps/files_publiclink/ajax/makelink.php
index 5abd1e829c5..685feb2fb89 100644
--- a/apps/files_publiclink/ajax/makelink.php
+++ b/apps/files_publiclink/ajax/makelink.php
@@ -6,14 +6,8 @@ require_once '../../../lib/base.php';
require_once '../lib_public.php';
$path=$_GET['path'];
-$expire=(isset($_GET['expire']))?$_GET['expire']:0;
-if($expire!==0){
-
- $expire=strtotime($expire);
-}
-// echo $expire;
-// die();
+$expire=0;
$link=new OC_PublicLink($path,$expire);
echo $link->getToken();
-?> \ No newline at end of file
+?>
diff --git a/apps/files_publiclink/js/admin.js b/apps/files_publiclink/js/admin.js
index 7052992e36d..20eae19c5d8 100644
--- a/apps/files_publiclink/js/admin.js
+++ b/apps/files_publiclink/js/admin.js
@@ -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><input type='submit' class='delete' data-token='"+token+" value='Delete' /></td>"
html+="</tr>"
- $(html).insertBefore($('#newlink_row'));
+ $(html).insertAfter($('#newlink_row'));
$('#path').val('');
}
}
diff --git a/apps/files_publiclink/lib_public.php b/apps/files_publiclink/lib_public.php
index ff1df130834..22f06156e17 100644
--- a/apps/files_publiclink/lib_public.php
+++ b/apps/files_publiclink/lib_public.php
@@ -24,11 +24,7 @@ class OC_PublicLink{
/**
* get the path of that shared file
*/
- 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()));
-
+ public static function getPath($token) {
//get the path and the user
$query=OC_DB::prepare("SELECT user,path FROM *PREFIX*publiclink WHERE token=?");
$result=$query->execute(array($token));
@@ -77,4 +73,4 @@ class OC_PublicLink{
private $token;
}
-?> \ No newline at end of file
+?>
diff --git a/apps/files_publiclink/templates/admin.php b/apps/files_publiclink/templates/admin.php
index 9ee5e0d0ea1..4608877e5b8 100644
--- a/apps/files_publiclink/templates/admin.php
+++ b/apps/files_publiclink/templates/admin.php
@@ -1,25 +1,18 @@
-<input type='hidden' id='baseUrl' value='<?php echo $_['baseUrl'];?>'/>
-<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>
+<input type="hidden" id="baseUrl" value="<?php echo $_['baseUrl'];?>"/>
+<table id="linklist">
<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):?>
- <tr class='link' id='<?php echo $link['token'];?>'>
- <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>
+ <tr class="link" id="<?php echo $link['token'];?>">
+ <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><input type="submit" class="delete" data-token="<?php echo $link['token'];?>" value="<?php echo $l->t( 'Delete' ); ?>" /></td>
</tr>
<?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>
</table>