Loading auc.module +37 −36 Changes for auc.module: 37 added lines, 36 removed lines. Original line number Diff line number Diff line Loading @@ -13,8 +13,40 @@ function auc_init() { if (empty($_FILES)) { return; } module_load_include('inc', 'auc', 'auc.under_hood'); if (!empty($_FILES['file']['name']) && $_FILES['file']['size'] > 16 && $_FILES['file']['error'] == UPLOAD_ERR_OK && is_uploaded_file($_FILES['file']['tmp_name']) ) { auc_process_wrapper_init($_FILES['file']['name']); } if (!empty($_FILES['files']['name'])) { foreach ($_FILES['files']['name'] as $field_name => $value) { // Quick skip here. if ($_FILES['files']['size'][$field_name] < 16) { continue; } if ($_FILES['files']['error'][$field_name] != UPLOAD_ERR_OK) { continue; } if (!is_uploaded_file($_FILES['files']['tmp_name'][$field_name])) { continue; } auc_process_wrapper_init($_FILES['files']['name'][$field_name], $field_name); } } } /** * Get file extension and conversion process. * * @param string $file_name * @param string $field_name */ function auc_process_wrapper_init($file_name, $field_name = '') { // Eventually have configuration for this. $conversion_lut = array( // This will be processed with the imagemagick tool. Loading Loading @@ -86,47 +118,16 @@ function auc_init() { ], ); if (!empty($_FILES['file']['name']) && $_FILES['file']['size'] > 16 && $_FILES['file']['error'] == UPLOAD_ERR_OK && is_uploaded_file($_FILES['file']['tmp_name']) ) { $path_parts = pathinfo($_FILES['file']['name']); // Lowercase for file extension. if (!empty($path_parts['extension']) && is_string($path_parts['extension'])) { $path_parts['extension'] = strtolower($path_parts['extension']); } if (!empty($conversion_lut[$path_parts['extension']])) { auc_process_wrapper($conversion_lut, $path_parts); } } if (!empty($_FILES['files']['name'])) { foreach ($_FILES['files']['name'] as $form_field_name => $value) { $path_parts = pathinfo($file_name); // Quick skip here. if ($_FILES['files']['size'][$form_field_name] < 16) { continue; } if ($_FILES['files']['error'][$form_field_name] != UPLOAD_ERR_OK) { continue; } if (!is_uploaded_file($_FILES['files']['tmp_name'][$form_field_name])) { continue; } $path_parts = pathinfo($_FILES['files']['name'][$form_field_name]); // Lowercase for file extension. if (!empty($path_parts['extension']) && is_string($path_parts['extension'])) { $path_parts['extension'] = strtolower($path_parts['extension']); } if (empty($conversion_lut[$path_parts['extension']])) { continue; } auc_process_wrapper($conversion_lut, $path_parts, $form_field_name); } if (!empty($path_parts['extension']) && !empty($conversion_lut[$path_parts['extension']])) { module_load_include('inc', 'auc', 'auc.under_hood'); return auc_process_wrapper($conversion_lut, $path_parts, $field_name); } } Loading Loading
auc.module +37 −36 Changes for auc.module: 37 added lines, 36 removed lines. Original line number Diff line number Diff line Loading @@ -13,8 +13,40 @@ function auc_init() { if (empty($_FILES)) { return; } module_load_include('inc', 'auc', 'auc.under_hood'); if (!empty($_FILES['file']['name']) && $_FILES['file']['size'] > 16 && $_FILES['file']['error'] == UPLOAD_ERR_OK && is_uploaded_file($_FILES['file']['tmp_name']) ) { auc_process_wrapper_init($_FILES['file']['name']); } if (!empty($_FILES['files']['name'])) { foreach ($_FILES['files']['name'] as $field_name => $value) { // Quick skip here. if ($_FILES['files']['size'][$field_name] < 16) { continue; } if ($_FILES['files']['error'][$field_name] != UPLOAD_ERR_OK) { continue; } if (!is_uploaded_file($_FILES['files']['tmp_name'][$field_name])) { continue; } auc_process_wrapper_init($_FILES['files']['name'][$field_name], $field_name); } } } /** * Get file extension and conversion process. * * @param string $file_name * @param string $field_name */ function auc_process_wrapper_init($file_name, $field_name = '') { // Eventually have configuration for this. $conversion_lut = array( // This will be processed with the imagemagick tool. Loading Loading @@ -86,47 +118,16 @@ function auc_init() { ], ); if (!empty($_FILES['file']['name']) && $_FILES['file']['size'] > 16 && $_FILES['file']['error'] == UPLOAD_ERR_OK && is_uploaded_file($_FILES['file']['tmp_name']) ) { $path_parts = pathinfo($_FILES['file']['name']); // Lowercase for file extension. if (!empty($path_parts['extension']) && is_string($path_parts['extension'])) { $path_parts['extension'] = strtolower($path_parts['extension']); } if (!empty($conversion_lut[$path_parts['extension']])) { auc_process_wrapper($conversion_lut, $path_parts); } } if (!empty($_FILES['files']['name'])) { foreach ($_FILES['files']['name'] as $form_field_name => $value) { $path_parts = pathinfo($file_name); // Quick skip here. if ($_FILES['files']['size'][$form_field_name] < 16) { continue; } if ($_FILES['files']['error'][$form_field_name] != UPLOAD_ERR_OK) { continue; } if (!is_uploaded_file($_FILES['files']['tmp_name'][$form_field_name])) { continue; } $path_parts = pathinfo($_FILES['files']['name'][$form_field_name]); // Lowercase for file extension. if (!empty($path_parts['extension']) && is_string($path_parts['extension'])) { $path_parts['extension'] = strtolower($path_parts['extension']); } if (empty($conversion_lut[$path_parts['extension']])) { continue; } auc_process_wrapper($conversion_lut, $path_parts, $form_field_name); } if (!empty($path_parts['extension']) && !empty($conversion_lut[$path_parts['extension']])) { module_load_include('inc', 'auc', 'auc.under_hood'); return auc_process_wrapper($conversion_lut, $path_parts, $field_name); } } Loading