Skip to content

Commit 6192f98

Browse files
committed
Merge pull request #2 from TamerZorba/fixing-upload-sql-error
Fixes #1
2 parents dfda77a + 8f9e8e6 commit 6192f98

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

system/module/Upload.php

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -280,8 +280,12 @@ public static function push($arr=array()){
280280
array_push($arr['tags'], $arr['folder']);
281281
array_push($arr['tags'], $ext);
282282

283+
if(!isset($arr['author'])){
284+
$user = User::info();
285+
$arr['author'] = $user->status?$user->data[0]['id']:0;
286+
}
287+
283288
Module::import("Query");
284-
$user = User::info();
285289
$q = Query::set('library',array(
286290
'data' => array(
287291
'name' => $filename,
@@ -290,7 +294,7 @@ public static function push($arr=array()){
290294
'extension' => $ext,
291295
'size' => File::format(filesize($file['original'])),
292296
'tags' => implode(",", $arr['tags']),
293-
'author' => $user->data[0]['id'],
297+
'author' => $arr['author'],
294298
// 'taxonomy' => isset($arr['taxonomy'])?$arr['taxonomy']:''
295299
)
296300
));

0 commit comments

Comments
 (0)