| 1 |
<?php |
<?php |
| 2 |
// $Id: rotor.module,v 1.2.2.18.2.31 2009/11/05 10:27:29 mrfelton Exp $ |
// $Id: rotor.module,v 1.2.2.18.2.32 2009/11/05 10:55:18 mrfelton Exp $ |
| 3 |
|
|
| 4 |
/** |
/** |
| 5 |
* @file |
* @file |
| 125 |
|
|
| 126 |
|
|
| 127 |
if (module_exists('upload')) { |
if (module_exists('upload')) { |
| 128 |
$upload_uploadsize_default = variable_get('upload_uploadsize_default', 1) * 1048576; |
$file_limit = variable_get('upload_uploadsize_default', 1); |
| 129 |
$max_size = variable_get('upload_uploadsize_'. $user->rid, $upload_uploadsize_default); |
foreach ($user->roles as $rid => $name) { |
| 130 |
|
// A zero value indicates no limit, take the least restrictive limit. |
| 131 |
|
$file_size = variable_get("upload_uploadsize_$rid", variable_get('upload_uploadsize_default', 1)) * 1024 * 1024; |
| 132 |
|
$file_limit = ($file_limit && $file_size) ? max($file_limit, $file_size) : 0; |
| 133 |
|
} |
| 134 |
} |
} |
| 135 |
|
|
| 136 |
$form['image']['rotor_image'] = array( |
$form['image']['rotor_image'] = array( |
| 138 |
'#title' => t('Rotor image'), |
'#title' => t('Rotor image'), |
| 139 |
'#default_value' => $node->fid, |
'#default_value' => $node->fid, |
| 140 |
'#file_validators' => array( |
'#file_validators' => array( |
| 141 |
'file_validate_size' => !empty($max_size)? array($max_size) : NULL, |
'file_validate_size' => !empty($file_limit)? array($file_limit) : NULL, |
| 142 |
), |
), |
| 143 |
); |
); |
| 144 |
$form['image']['alt_text'] = array( |
$form['image']['alt_text'] = array( |