| 1 |
<?php |
<?php |
| 2 |
// $Id: upload.module,v 1.4 2004/07/09 09:42:00 jseng Exp $ |
// $Id: upload.module,v 1.5 2004/07/11 14:05:56 jseng Exp $ |
| 3 |
|
|
| 4 |
function upload_help($section) { |
function upload_help($section) { |
| 5 |
$output = ""; |
$output = ""; |
| 19 |
} |
} |
| 20 |
|
|
| 21 |
function upload_perm() { |
function upload_perm() { |
| 22 |
return array("upload files (simple)", |
return array('upload files (simple)', |
| 23 |
"maintain files (simple)", |
'maintain files (simple)', |
| 24 |
"download files (simple)"); |
'download files (simple)'); |
| 25 |
} |
} |
| 26 |
|
|
| 27 |
function upload_settings() { |
function upload_settings() { |
| 28 |
if (!file_check_directory(file_create_path(variable_get('upload_path', 'public')))) |
if (!file_check_directory(file_create_path(variable_get('upload_path', 'public')))) |
| 29 |
$error['upload_path'] = theme('error', t('Directory does not exists, or is not writable.')); |
$error['upload_path'] = theme('error', t('Directory does not exists, or is not writable.')); |
| 30 |
|
|
| 31 |
$output = ""; |
$output = ''; |
| 32 |
|
|
| 33 |
$output .= form_textfield(t("Upload path"), "upload_path", variable_get("upload_path", "public"), 30, 255, t("Subdirectory in the directory '%dir' where upload files will be stored.", array('%dir' => variable_get("file_directory_path", "files") . FILE_SEPARATOR)) . $error['upload_path']); |
$output .= form_textfield(t("Upload path"), "upload_path", variable_get("upload_path", "public"), 30, 255, t("Subdirectory in the directory '%dir' where upload files will be stored.", array('%dir' => variable_get("file_directory_path", "files") . FILE_SEPARATOR)) . $error['upload_path']); |
| 34 |
|
|
| 37 |
return $output; |
return $output; |
| 38 |
} |
} |
| 39 |
|
|
| 40 |
function upload_link($type, $node = 0, $main) { |
/** |
| 41 |
if ($type == 'system') { |
* Implementation of hook_menu(). |
| 42 |
if (user_access('upload files (simple)')) |
*/ |
| 43 |
menu('upload', t('quick upload'), 'upload_page', 0, MENU_HIDE); |
function upload_menu() { |
| 44 |
if (user_access('maintain files (simple)')) |
$items = array(); |
| 45 |
menu('admin/upload', t('manage files'), 'upload_admin', 0); |
|
| 46 |
} |
$items[] = array('path' => 'upload', 'title' => t('quick upload'), |
| 47 |
|
'access' => user_access('upload files (simple)'), |
| 48 |
|
'callback' => 'upload_page', |
| 49 |
|
'type' => MENU_CALLBACK); |
| 50 |
|
$items[] = array('path' => 'admin/upload', 'title' => t('manage files'), |
| 51 |
|
'access' => user_access('maintain files (simple)'), |
| 52 |
|
'callback' => 'upload_admin'); |
| 53 |
|
|
| 54 |
|
return $items; |
| 55 |
} |
} |
| 56 |
|
|
| 57 |
function upload_page() { |
function upload_page() { |
| 75 |
function _upload_form() { |
function _upload_form() { |
| 76 |
drupal_set_title(t('Quick upload file')); |
drupal_set_title(t('Quick upload file')); |
| 77 |
$output .= "<div class=\"standard\">"; |
$output .= "<div class=\"standard\">"; |
| 78 |
$output .= form_file(t("Upload file"), "upload_file", 30, |
$output .= form_file(t("Upload file"), 'upload_file', 30, |
| 79 |
"You need to specify a file to upload."); |
"You need to specify a file to upload."); |
| 80 |
$output .= form_submit(t('Upload')); |
$output .= form_submit(t('Upload')); |
| 81 |
$output .= form_submit(t('Replace')); |
$output .= form_submit(t('Replace')); |