aboutsummaryrefslogtreecommitdiff
path: root/plugins/video_upload
diff options
context:
space:
mode:
authorFabio Varesano <fax8@13637.no-reply.drupal.org>2006-06-24 17:36:59 +0000
committerFabio Varesano <fax8@13637.no-reply.drupal.org>2006-06-24 17:36:59 +0000
commitca54d95de4b11a952a658335ae13cbc75841cc16 (patch)
treec9ef0fb6c74d3c94c2638a72a65398f8dc50cadb /plugins/video_upload
parent31a14e3c82914cfc68a605ecfc0c52a49a2d9c3b (diff)
downloadvideo-ca54d95de4b11a952a658335ae13cbc75841cc16.tar.gz
video-ca54d95de4b11a952a658335ae13cbc75841cc16.tar.bz2
Small change to video_upload prepare to check for permissions
before writing 'A file must be provided'. Corected a bug which was making impossible to reedit the custom fileds values after node creation. Thanks pancapangrawit (http://drupal.org/user/59924) for pointing this out.
Diffstat (limited to 'plugins/video_upload')
-rw-r--r--plugins/video_upload/video_upload.module11
1 files changed, 6 insertions, 5 deletions
diff --git a/plugins/video_upload/video_upload.module b/plugins/video_upload/video_upload.module
index e85e334..7008690 100644
--- a/plugins/video_upload/video_upload.module
+++ b/plugins/video_upload/video_upload.module
@@ -70,11 +70,9 @@ 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);
- return $output;
- }
- else {
- return NULL;
}
+ return $output;
+
case 'prepare':
_video_upload_prepare($node);
break;
@@ -150,6 +148,9 @@ function video_upload_form_alter($form_id, &$form) {
function _video_upload_load(&$node) {
if ($node->vid) {
$result = db_query('SELECT * FROM {files} f INNER JOIN {file_revisions} r ON f.fid = r.fid WHERE r.vid = %d ORDER BY f.fid DESC', $node->vid);
+ //while($item = db_fetch_object($result)) {
+ // print_r($item);
+ //}
return db_fetch_object($result);
}
}
@@ -160,7 +161,7 @@ function _video_upload_load(&$node) {
*/
function _video_upload_validate(&$node) {
// if we override the default video module vidfile field and we don't have a file uploaded set error
- if (variable_get('video_upload_override_vidfile', false) && !isset($node->video_upload_file) && !isset($_SESSION['video_upload_file'])) {
+ if (user_access('upload video files') && variable_get('video_upload_override_vidfile', false) && !isset($node->video_upload_file) && !isset($_SESSION['video_upload_file'])) {
form_set_error('video_upload_file', t('A file must be provided.'));
return;
}