Skip to content

Commit

Permalink
Merge pull request #82 from burnacid/development
Browse files Browse the repository at this point in the history
Merge 2.4.1
  • Loading branch information
burnacid authored Feb 12, 2018
2 parents 40ffef8 + 17e1f38 commit fcdd535
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 17 deletions.
23 changes: 11 additions & 12 deletions form.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,10 @@
$formcreator->get_fields();

if ($mybb->request_method == "post") {

$error_array = array();

$files = array();

foreach ($formcreator->fields as $field) {
$field->default = $mybb->input["field_" . $field->fieldid];

Expand All @@ -57,8 +59,6 @@

}

$files = array();

if ($field->type == 12) {
$captcha = new captcha();
if ($captcha->validate_captcha() == false) {
Expand All @@ -68,16 +68,15 @@
}
}
}elseif($field->type == 13 or $field->type == 14){
if($field->required){
if(!empty($_FILES["field_" . $field->fieldid]["name"]) && $field->type == 13){
$files = $_FILES;
}elseif(!empty($_FILES["field_" . $field->fieldid]["name"][0]) && $field->type == 14){
$files = reArrayFiles($_FILES["field_" . $field->fieldid]);
}else{
$error_array[] = $lang->fc_no_attachment;
}
if(!empty($_FILES["field_" . $field->fieldid]["name"]) && $field->type == 13){
$files[count($files)] = $_FILES["field_".$field->fieldid];
}elseif(!empty($_FILES["field_" . $field->fieldid]["name"][0]) && $field->type == 14){
$files = array_merge($files, reArrayFiles($_FILES["field_" . $field->fieldid], count($files)));
}elseif($field->required){
$error_array[] = $lang->fc_no_attachment;
}else{
$error_array[] = $lang->fc_oops;
}

}
}

Expand Down
1 change: 1 addition & 0 deletions inc/languages/english/formcreator.lang.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,5 +16,6 @@
$l['fc_test'] = "Test";
$l['fc_select_option'] = "Select option";
$l['fc_no_option_selected'] = "no option was selected";
$l['fc_oops'] = "Oops something went wrong. Please try again later or contact your system administrator.";

?>
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,6 @@
$l['fc_class_desc'] = "Configure a Classe da Tabela contendo o Formulário";
$l['fc_update_form'] = "Atualizar Formulário";
$l['fc_create_form'] = "Criar Formulário";

$l['fc_user_info'] = "Informação de usuário";
$l['fc_username'] = "Nome de Usuário";
$l['fc_other'] = "Outro";
Expand Down Expand Up @@ -186,4 +185,10 @@
$l['admin_log_config_formcreator_delete'] = 'Formulário Deletado #{1} ({2})';
$l['admin_log_config_formcreator_addfield'] = 'Campo Adicionado #{2} ({3}) no Formulário #{1}';
$l['admin_log_config_formcreator_editfield'] = 'Campo Editado #{2} ({3}) no Formulário #{1}';
$l['admin_log_config_formcreator_deletefield'] = 'Campo Deletado #{2} ({3}) no Formulário #{1}';
$l['admin_log_config_formcreator_deletefield'] = 'Campo Deletado #{2} ({3}) no Formulário #{1}';
$l['fc_process_signature'] = "Assinatura da Postagem";
$l['fc_process_signature_desc'] = "Defina se a assinatura dos usuários aparecerá ou não no tópico ou postagem.";
$l['fc_process_posticon'] = "Ícone de Postagem";
$l['fc_process_posticon_desc'] = "Selecione qual ícone de postagem será usado para a postagem / tópico.";
$l['fc_resize'] = "Permitir redimensionar";
$l['fc_field_resize_desc'] = "Defina se o usuário pode ou não redimensionar o campo";
6 changes: 3 additions & 3 deletions inc/plugins/formcreator.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ function formcreator_info()
'website' => 'https://community.mybb.com/mods.php?action=view&pid=975',
'author' => 'S. Lenders (burnacid)',
'authorsite' => 'http://lenders-it.nl',
'version' => '2.4.0',
'version' => '2.4.1',
'compatibility' => '18*',
'codename' => 'formcreator');
}
Expand Down Expand Up @@ -593,15 +593,15 @@ function get_usergroup_users($gid)
}
}

function reArrayFiles(&$file_post) {
function reArrayFiles(&$file_post, $current = 0) {

$file_ary = array();
$file_count = count($file_post['name']);
$file_keys = array_keys($file_post);

for ($i=0; $i<$file_count; $i++) {
foreach ($file_keys as $key) {
$file_ary[$i][$key] = $file_post[$key][$i];
$file_ary[$i + $current][$key] = $file_post[$key][$i];
}
}

Expand Down

0 comments on commit fcdd535

Please sign in to comment.