diff options
-rw-r--r-- | plugins/video_multidownload/video_multidownload.module | 31 | ||||
-rw-r--r-- | plugins/video_upload/video_upload.module | 2 | ||||
-rw-r--r-- | video.module | 23 |
3 files changed, 36 insertions, 20 deletions
diff --git a/plugins/video_multidownload/video_multidownload.module b/plugins/video_multidownload/video_multidownload.module index e912c19..b936224 100644 --- a/plugins/video_multidownload/video_multidownload.module +++ b/plugins/video_multidownload/video_multidownload.module @@ -38,7 +38,9 @@ function video_multidownload_menu($may_cache) { if (arg(0) == 'node' && is_numeric(arg(1))) { if ($node = node_load(arg(1)) and $node->type == 'video') { if(isset($node->disable_multidownload) && - !$node->disable_multidownload) { + !$node->disable_multidownload && + ($node->use_play_folder || $node->download_folder!='') + ) { $items[] = array('path' => 'node/'.arg(1).'/multidownload', 'title' => t('download other formats'), 'callback' => 'video_multidownload_download', @@ -62,6 +64,31 @@ function video_multidownload_perm() { /** + * Implementation of hook_settings() + */ +function video_multidownload_settings() { + $form = array(); + + $options = array(1 => 'Yes', 0 => 'No'); + + $form['multifile'] = array('#type' => 'fieldset', '#title' => t('Multi-file download options'), '#description' => t('Allows a list of files to be shown on the download page. The list is usually gotten from a specified folder. This ability is useful for providing different sizes and video types for download.')); + $form['multifile']['video_multidownload'] = array( + '#type' => 'radios', + '#title' => t('Allow Multi-file Downloads'), + '#options' => $options, + '#default_value' => variable_get('video_multidownload', 0), + '#description' => t('This feature can be disabled separately for each node. If turned on make sure you set the permissions so users can use this feature.') . ' ' . l(t('access control'), 'admin/access')); + $form['multifile']['video_download_ext'] = array( + '#type' => 'textfield', + '#title' => t('File extensions to show'), + '#default_value' => variable_get('video_download_ext', 'mov,wmv,rm,flv,avi,divx,mpg,mpeg,mp4,zip'), + '#description' => t('The extensions of files to list from the multi-file download folder on the download page. Extensions should be comma seperated with no spaces, for example (mov,wmv,rm).')); + + return $form; +} + + +/** * Implementation of hook_form_alter() * We use this to add multidownload fields to the video creation form. */ @@ -148,7 +175,7 @@ function video_multidownload_download() { $play_dir_stub = str_replace(basename($node->vidfile), "", $node->vidfile); //Remove the filename from the play file to get directory. $play_dir = getcwd() . '/' . $play_dir_stub; //Get the local directory path where the file is kept. if ($node->use_play_folder == 1 and file_exists($play_dir) and $play_dir_stub != '/') { //Make sure play stub won't allow scanning base drupal directory. - $scan_play_folder = _video_scandir($play_dir); + $scan_play_folder = _video_multidownload_scandir($play_dir); $scan_play_folder['local_dir'] = $play_dir; //For getting filesize. $scan_play_folder['dir_stub'] = $play_dir_stub; //To put in the URL. $folder_array[] = $scan_play_folder; diff --git a/plugins/video_upload/video_upload.module b/plugins/video_upload/video_upload.module index 832cf3f..34515a3 100644 --- a/plugins/video_upload/video_upload.module +++ b/plugins/video_upload/video_upload.module @@ -36,7 +36,7 @@ function video_upload_settings() { $form['video_upload_override_vidfile'] = array( '#type' => 'checkbox', '#title' => t('override video file'), - '#description' => t('Check this if your users must only submit videos throught uploading. This disable path insertion.'), + '#description' => t('Check this if your users must only submit videos through uploading. This disables path insertion.'), '#default_value' => variable_get('video_upload_override_vidfile', false), ); $form['video_upload_uploadable_extensions'] = array( diff --git a/video.module b/video.module index cbc0251..bb9d86c 100644 --- a/video.module +++ b/video.module @@ -297,19 +297,6 @@ function video_settings() { '#default_value' => variable_get('video_downloadcounter', 1), '#description' => t('Counts a hit everytime someone downloads a video.')); - $form['multifile'] = array('#type' => 'fieldset', '#title' => t('Multi-file download options'), '#description' => t('Allows a list of files to be shown on the download page. The list is usually gotten from a specified folder. This ability is useful for providing different sizes and video types for download.')); - $form['multifile']['video_multidownload'] = array( - '#type' => 'radios', - '#title' => t('Allow Multi-file Downloads'), - '#options' => $options, - '#default_value' => variable_get('video_multidownload', 0), - '#description' => t('This feature can be disabled separately for each node. If turned on make sure you set the permissions so users can use this feature.') . ' ' . l(t('access control'), 'admin/access')); - $form['multifile']['video_download_ext'] = array( - '#type' => 'textfield', - '#title' => t('File extensions to show'), - '#default_value' => variable_get('video_download_ext', 'mov,wmv,rm,flv,avi,divx,mpg,mpeg,mp4,zip'), - '#description' => t('The extensions of files to list from the multi-file download folder on the download page. Extensions should be comma seperated with no spaces, for example (mov,wmv,rm).')); - return $form; } @@ -332,6 +319,8 @@ function video_node_info() { * access hook */ function video_access($op, $node) { + global $user; + switch($op) { case 'view': return $node->status; // see book.module for reference @@ -1351,11 +1340,11 @@ function _video_get_fileurl($video_file) { global $base_url; //creation of absolute url - if (!preg_match("/^(http|ftp|mm|rstp)(s?):\/\//", $video_file)) { //If path is relative to drupal. - return check_url($base_url . '/' . $video_file); + if (preg_match("/^(http|ftp|mm|rstp)(s?):\/\//", $video_file)) { //If path is absolute + return check_plain($video_file); } - else { // path is absolute - return check_url($video_file); + else { // path is relative to drupal install + return check_plain($base_url . '/' . $video_file); } } |