Skip to content
Snippets Groups Projects
Commit 74389601 authored by Robin Appelman's avatar Robin Appelman
Browse files

use better tokens for public links

parent 8a7f2361
No related branches found
No related tags found
No related merge requests found
......@@ -6,9 +6,9 @@ class OC_PublicLink{
* @param int (optional) expiretime time the link expires, as timestamp
*/
public function __construct($path,$expiretime=0){
if($path && OC_FILESYSTEM::file_exists($path)){
$token=sha1("$path-$expiretime");
if($path and OC_FILESYSTEM::file_exists($path) and OC_FILESYSTEM::is_readable($path)){
$user=$_SESSION['user_id'];
$token=sha1("$user-$path-$expiretime");
$query=OC_DB::prepare("INSERT INTO *PREFIX*publiclink VALUES(?,?,?,?)");
$result=$query->execute(array($token,$path,$user,$expiretime));
if( PEAR::isError($result)) {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment