aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--plugins/video_upload/video_upload.module8
-rw-r--r--video.module4
2 files changed, 10 insertions, 2 deletions
diff --git a/plugins/video_upload/video_upload.module b/plugins/video_upload/video_upload.module
index 7b60ef4..e467d7e 100644
--- a/plugins/video_upload/video_upload.module
+++ b/plugins/video_upload/video_upload.module
@@ -63,6 +63,8 @@ function video_upload_nodeapi(&$node, $op, $teaser) {
$output['video_upload_file'] = _video_upload_load($node);
if($node->vidfile == '') { // we will disable uploaded file if a path is already live
$output['vidfile'] = file_create_url($output['video_upload_file']->filepath);
+ // set the filesize - this seems not to work.. why???
+ $output['size'] = $output['video_upload_file']->filesize;
}
return $output;
@@ -181,11 +183,17 @@ function _video_upload_prepare(&$node) {
file_check_directory($temppath, TRUE);
$node->video_upload_file = file_save_upload($file, $temppath .'/'. $file->filename, FILE_EXISTS_REPLACE);
$node->video_upload_file->newfile = TRUE;
+
+ // set video size
+ $node->size = $node->video_upload_file->filesize;
$_SESSION['video_upload_file'] = $node->video_upload_file;
}
else if (!empty($_SESSION['video_upload_file'])) {
$node->video_upload_file = $_SESSION['video_upload_file'];
+ // set video size
+ $node->size = $node->video_upload_file->filesize;
+
} else {
$_SESSION['video_upload_file'] = $node->video_upload_file;
}
diff --git a/video.module b/video.module
index b17d33e..e16868a 100644
--- a/video.module
+++ b/video.module
@@ -584,7 +584,7 @@ function video_validate($node) {
}
//Make sure file size is valid.
$path = getcwd() . '/' . $node->vidfile; //Local path to video file.
- if (!isset($node->size) || !is_numeric($node->size) || $node->size < 0) { //If the file is not local or a number then set error.
+ if ((!isset($node->size) || !is_numeric($node->size) || $node->size < 0) && !$_SESSION['video_upload_file']) { //If the file is not local or not a valid number then set error. $_SESSION check needed for video_upload functionality
form_set_error('size', t('You have to insert a valid file size for this video.'));
}
@@ -749,7 +749,7 @@ function video_block_list($delta = 0) {
$orderby = 'RAND()';
break;
}
- return node_title_list(db_query_range(db_rewrite_sql("SELECT n.nid, n.title FROM {node} n, {video} v WHERE n.vid = v.vid AND n.type = 'video' AND n.status = 1 AND n.moderate = 0 ORDER BY $orderby DESC"),0, $count));
+ return node_title_list(db_query_range(db_rewrite_sql("SELECT n.nid, n.title FROM {node} n INNER JOIN {video} v ON n.vid = v.vid WHERE n.type = 'video' AND n.status = 1 AND n.moderate = 0 ORDER BY $orderby DESC"),0, $count));
}
/****************************************************