├── _config.yml ├── images ├── formcreator │ └── fields │ │ ├── 1.jpg │ │ ├── 10.jpg │ │ ├── 11.jpg │ │ ├── 12.jpg │ │ ├── 13.jpg │ │ ├── 14.jpg │ │ ├── 15.jpg │ │ ├── 16.jpg │ │ ├── 2.jpg │ │ ├── 3.jpg │ │ ├── 4.jpg │ │ ├── 5.jpg │ │ ├── 6.jpg │ │ ├── 7.jpg │ │ ├── 8.jpg │ │ └── 9.jpg ├── ui-icons_444444_256x240.png ├── ui-icons_555555_256x240.png ├── ui-icons_777620_256x240.png ├── ui-icons_777777_256x240.png ├── ui-icons_cc0000_256x240.png └── ui-icons_ffffff_256x240.png ├── .gitignore ├── README.md ├── .github └── ISSUE_TEMPLATE │ ├── feature_request.md │ └── bug_report.md ├── inc ├── languages │ ├── polish │ │ ├── formcreator.lang.php │ │ └── admin │ │ │ └── config_formcreator.lang.php │ ├── dutch │ │ ├── formcreator.lang.php │ │ └── admin │ │ │ └── config_formcreator.lang.php │ ├── english │ │ ├── formcreator.lang.php │ │ └── admin │ │ │ └── config_formcreator.lang.php │ └── portugues_brasil │ │ ├── formcreator.lang.php │ │ └── admin │ │ └── config_formcreator.lang.php ├── plugins │ ├── formcreator │ │ └── jquery-ui.css │ └── formcreator.php └── class_formcreator.php ├── CODE_OF_CONDUCT.md ├── form.php └── LICENSE /_config.yml: -------------------------------------------------------------------------------- 1 | theme: jekyll-theme-cayman -------------------------------------------------------------------------------- /images/formcreator/fields/1.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/burnacid/MyBB-Form-Creator/HEAD/images/formcreator/fields/1.jpg -------------------------------------------------------------------------------- /images/formcreator/fields/10.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/burnacid/MyBB-Form-Creator/HEAD/images/formcreator/fields/10.jpg -------------------------------------------------------------------------------- /images/formcreator/fields/11.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/burnacid/MyBB-Form-Creator/HEAD/images/formcreator/fields/11.jpg -------------------------------------------------------------------------------- /images/formcreator/fields/12.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/burnacid/MyBB-Form-Creator/HEAD/images/formcreator/fields/12.jpg -------------------------------------------------------------------------------- /images/formcreator/fields/13.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/burnacid/MyBB-Form-Creator/HEAD/images/formcreator/fields/13.jpg -------------------------------------------------------------------------------- /images/formcreator/fields/14.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/burnacid/MyBB-Form-Creator/HEAD/images/formcreator/fields/14.jpg -------------------------------------------------------------------------------- /images/formcreator/fields/15.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/burnacid/MyBB-Form-Creator/HEAD/images/formcreator/fields/15.jpg -------------------------------------------------------------------------------- /images/formcreator/fields/16.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/burnacid/MyBB-Form-Creator/HEAD/images/formcreator/fields/16.jpg -------------------------------------------------------------------------------- /images/formcreator/fields/2.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/burnacid/MyBB-Form-Creator/HEAD/images/formcreator/fields/2.jpg -------------------------------------------------------------------------------- /images/formcreator/fields/3.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/burnacid/MyBB-Form-Creator/HEAD/images/formcreator/fields/3.jpg -------------------------------------------------------------------------------- /images/formcreator/fields/4.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/burnacid/MyBB-Form-Creator/HEAD/images/formcreator/fields/4.jpg -------------------------------------------------------------------------------- /images/formcreator/fields/5.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/burnacid/MyBB-Form-Creator/HEAD/images/formcreator/fields/5.jpg -------------------------------------------------------------------------------- /images/formcreator/fields/6.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/burnacid/MyBB-Form-Creator/HEAD/images/formcreator/fields/6.jpg -------------------------------------------------------------------------------- /images/formcreator/fields/7.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/burnacid/MyBB-Form-Creator/HEAD/images/formcreator/fields/7.jpg -------------------------------------------------------------------------------- /images/formcreator/fields/8.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/burnacid/MyBB-Form-Creator/HEAD/images/formcreator/fields/8.jpg -------------------------------------------------------------------------------- /images/formcreator/fields/9.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/burnacid/MyBB-Form-Creator/HEAD/images/formcreator/fields/9.jpg -------------------------------------------------------------------------------- /images/ui-icons_444444_256x240.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/burnacid/MyBB-Form-Creator/HEAD/images/ui-icons_444444_256x240.png -------------------------------------------------------------------------------- /images/ui-icons_555555_256x240.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/burnacid/MyBB-Form-Creator/HEAD/images/ui-icons_555555_256x240.png -------------------------------------------------------------------------------- /images/ui-icons_777620_256x240.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/burnacid/MyBB-Form-Creator/HEAD/images/ui-icons_777620_256x240.png -------------------------------------------------------------------------------- /images/ui-icons_777777_256x240.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/burnacid/MyBB-Form-Creator/HEAD/images/ui-icons_777777_256x240.png -------------------------------------------------------------------------------- /images/ui-icons_cc0000_256x240.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/burnacid/MyBB-Form-Creator/HEAD/images/ui-icons_cc0000_256x240.png -------------------------------------------------------------------------------- /images/ui-icons_ffffff_256x240.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/burnacid/MyBB-Form-Creator/HEAD/images/ui-icons_ffffff_256x240.png -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | * 2 | !.gitignore 3 | !inc\class_formcreator.php 4 | !inc\plugins\formcreator.php 5 | !inc\languages\*\formcreator.lang.php 6 | !inc\languages\*\admin\config_formcreator.lang.php 7 | !inc\plugins\formcreator\jquery-ui.css 8 | !admin\modules\config\formcreator.php 9 | !admin\jscripts\formcreator.js 10 | !images\ui-icons_444444_256x240.png 11 | !images\ui-icons_555555_256x240.png 12 | !images\ui-icons_777620_256x240.png 13 | !images\ui-icons_777777_256x240.png 14 | !images\ui-icons_cc0000_256x240.png 15 | !images\ui-icons_ffffff_256x240.png 16 | !images\formcreator\* 17 | !form.php -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # MyBB Form Creator 2 | Form Creator feature for MyBB 1.8.x 3 | 4 | This plugin for MyBB lets forum administrators create fillable forms that can be send through PM or create a new thread in a forum. 5 | 6 | ## Features 7 | Able to create forms with the following types of fields 8 | * Single line textbox 9 | * Multiple line textarea 10 | * Single select box 11 | * Multi select box 12 | * Radio buttons 13 | * Checkboxes 14 | * Attachments 15 | * MyBB Editor 16 | * Captcha 17 | 18 | Submitted forms actions 19 | * PM single users 20 | * PM group users 21 | * Create new theard in forum 22 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/feature_request.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Feature request 3 | about: Suggest an idea for this project 4 | title: '' 5 | labels: Request 6 | assignees: '' 7 | 8 | --- 9 | 10 | **Is your feature request related to a problem? Please describe.** 11 | A clear and concise description of what the problem is. Ex. I'm always frustrated when [...] 12 | 13 | **Describe the solution you'd like** 14 | A clear and concise description of what you want to happen. 15 | 16 | **Describe alternatives you've considered** 17 | A clear and concise description of any alternative solutions or features you've considered. 18 | 19 | **Additional context** 20 | Add any other context or screenshots about the feature request here. 21 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/bug_report.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Bug report 3 | about: Create a report to help us improve 4 | title: '' 5 | labels: bug 6 | assignees: '' 7 | 8 | --- 9 | 10 | **Describe the bug** 11 | A clear and concise description of what the bug is. 12 | 13 | **To Reproduce** 14 | Steps to reproduce the behavior: 15 | 1. Go to '...' 16 | 2. Click on '....' 17 | 3. Scroll down to '....' 18 | 4. See error 19 | 20 | **Expected behavior** 21 | A clear and concise description of what you expected to happen. 22 | 23 | **Desktop (please complete the following information):** 24 | - MyBB version: 25 | - Plugin version: 26 | - PHP version: 27 | - MySQL version: 28 | 29 | **Please add an export of your form if the issue is within processing the form** 30 | -------------------------------------------------------------------------------- /inc/languages/polish/formcreator.lang.php: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /inc/languages/dutch/formcreator.lang.php: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /inc/languages/portugues_brasil/formcreator.lang.php: -------------------------------------------------------------------------------- 1 | 26 | -------------------------------------------------------------------------------- /CODE_OF_CONDUCT.md: -------------------------------------------------------------------------------- 1 | # Contributor Covenant Code of Conduct 2 | 3 | ## Our Pledge 4 | 5 | In the interest of fostering an open and welcoming environment, we as 6 | contributors and maintainers pledge to making participation in our project and 7 | our community a harassment-free experience for everyone, regardless of age, body 8 | size, disability, ethnicity, sex characteristics, gender identity and expression, 9 | level of experience, education, socio-economic status, nationality, personal 10 | appearance, race, religion, or sexual identity and orientation. 11 | 12 | ## Our Standards 13 | 14 | Examples of behavior that contributes to creating a positive environment 15 | include: 16 | 17 | * Using welcoming and inclusive language 18 | * Being respectful of differing viewpoints and experiences 19 | * Gracefully accepting constructive criticism 20 | * Focusing on what is best for the community 21 | * Showing empathy towards other community members 22 | 23 | Examples of unacceptable behavior by participants include: 24 | 25 | * The use of sexualized language or imagery and unwelcome sexual attention or 26 | advances 27 | * Trolling, insulting/derogatory comments, and personal or political attacks 28 | * Public or private harassment 29 | * Publishing others' private information, such as a physical or electronic 30 | address, without explicit permission 31 | * Other conduct which could reasonably be considered inappropriate in a 32 | professional setting 33 | 34 | ## Our Responsibilities 35 | 36 | Project maintainers are responsible for clarifying the standards of acceptable 37 | behavior and are expected to take appropriate and fair corrective action in 38 | response to any instances of unacceptable behavior. 39 | 40 | Project maintainers have the right and responsibility to remove, edit, or 41 | reject comments, commits, code, wiki edits, issues, and other contributions 42 | that are not aligned to this Code of Conduct, or to ban temporarily or 43 | permanently any contributor for other behaviors that they deem inappropriate, 44 | threatening, offensive, or harmful. 45 | 46 | ## Scope 47 | 48 | This Code of Conduct applies both within project spaces and in public spaces 49 | when an individual is representing the project or its community. Examples of 50 | representing a project or community include using an official project e-mail 51 | address, posting via an official social media account, or acting as an appointed 52 | representative at an online or offline event. Representation of a project may be 53 | further defined and clarified by project maintainers. 54 | 55 | ## Enforcement 56 | 57 | Instances of abusive, harassing, or otherwise unacceptable behavior may be 58 | reported by contacting the project team at github[at]lenders-it.nl. All 59 | complaints will be reviewed and investigated and will result in a response that 60 | is deemed necessary and appropriate to the circumstances. The project team is 61 | obligated to maintain confidentiality with regard to the reporter of an incident. 62 | Further details of specific enforcement policies may be posted separately. 63 | 64 | Project maintainers who do not follow or enforce the Code of Conduct in good 65 | faith may face temporary or permanent repercussions as determined by other 66 | members of the project's leadership. 67 | 68 | ## Attribution 69 | 70 | This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4, 71 | available at https://www.contributor-covenant.org/version/1/4/code-of-conduct.html 72 | 73 | [homepage]: https://www.contributor-covenant.org 74 | 75 | For answers to common questions about this code of conduct, see 76 | https://www.contributor-covenant.org/faq 77 | -------------------------------------------------------------------------------- /inc/languages/polish/admin/config_formcreator.lang.php: -------------------------------------------------------------------------------- 1 | dateformat)"; 127 | $l['fc_default'] = "Domyślnie"; 128 | $l['fc_field_default_desc'] = "Podaj domyślną wartość pola"; 129 | $l['fc_required'] = "Wymagane"; 130 | $l['fc_field_required_desc'] = "Zaznacz jeśli to pole jest wymagane."; 131 | $l['fc_regex'] = "Wyrażenie regularne"; 132 | $l['fc_field_regex_desc'] = "Podaj wyrażenia regularne"; 133 | $l['fc_regex_error'] = "Zły format danych"; 134 | $l['fc_field_regex_error_desc'] = "Podaj wiadomość jaka ma się wyświetlić, gdy podano niewłaściwy format danych."; 135 | $l['fc_size'] = "Wielkość"; 136 | $l['fc_field_size_desc'] = "Podaj wielkość pola"; 137 | $l['fc_cols'] = "Kolumny"; 138 | $l['fc_field_cols_desc'] = "Podaj wielkość w kolumnach dla tego pola"; 139 | $l['fc_rows'] = "Wiersze"; 140 | $l['fc_field_rows_desc'] = "Podaj wielkość w wierszach dla tego pola"; 141 | $l['fc_resize'] = "Pozwalaj zmieniać wielkość"; 142 | $l['fc_field_resize_desc'] = "Czy użytkownik może zmienić rozmiar pola?"; 143 | $l['fc_class'] = "Klasa"; 144 | $l['fc_field_class_desc'] = "Enter a class for the field container"; 145 | $l['fc_html_block'] = "Blok HTML"; 146 | $l['fc_field_html_block_desc'] = "Wpisz kod HTML, które chcesz wyświetlić"; 147 | $l['fc_field_type'] = "Typ pola"; 148 | $l['fc_field_example'] = "Przykład pola"; 149 | $l['fc_field_type_desc'] = "Wybierz typ pola, które chcesz dodać."; 150 | $l['fc_button_update_field'] = "Aktualizuj pole"; 151 | $l['fc_button_create_field'] = "Stwórz pole"; 152 | $l['fc_add_field_unknown_form'] = "Próbujesz dodać pole do formularza, który nie istnieje!"; 153 | $l['fc_delete_field_unknown'] = "Pole, które chcesz usunąć nie istnieje"; 154 | $l['fc_delete_field_form_unknown'] = "Pole formularza, które chcesz usunąć nie istnieje"; 155 | $l['fc_delete_field_success'] = "Pole pomyślnie usunięte"; 156 | $l['fc_confirmation_delete_field'] = "Czy jesteś pewien, że chcesz to usunąć?"; 157 | $l['fc_save_order'] = "Zapisz"; 158 | $l['fc_order_saved'] = "Zapisano"; 159 | $l['fc_order'] = "Order"; 160 | $l['fc_type'] = "Typ"; 161 | $l['fc_form_info'] = "Informacja o formularzu"; 162 | $l['fc_send_mail_to'] = "Wyślij maila do"; 163 | $l['fc_no_mail_selected'] = "Nie wybrano maili"; 164 | $l['fc_export_form'] = "Eksportuj formularze"; 165 | $l['fc_export_description'] = "Kopiuj i zapisz do pliku lub użyj, aby importować w innym miejscu."; 166 | $l['fc_no_forms_to_export'] = "Nie masz żadnych formularzy, które można eksportować!"; 167 | $l['fc_forms'] = "Formularze"; 168 | $l['fc_no_forms'] = "Brak formularzy"; 169 | $l['fc_field_forms_desc'] = "Które formularze chcesz eksportować ?"; 170 | $l['fc_export_perms'] = "Eksportuj uprawnieniaExport Permissions"; 171 | $l['fc_export_perms_desc'] = "Czy chcesz eksportować uprawnienia ? Ustaw NIE jeśli będziesz importował na inne forum."; 172 | $l['fc_export_process_options'] = "Export Process Options"; 173 | $l['fc_export_process_options_desc'] = "Do you like to export the process options? Set this to 'OFF' if you are going to import this on other forums."; 174 | $l['fc_export_usagelog'] = "Export Usage Log"; 175 | $l['fc_export_usagelog_desc'] = "Do you like to export the usage history? Set this to 'OFF' if you are going to import this on other forums."; 176 | $l['fc_create_thread_in_forum'] = "Stwórz temat na forum"; 177 | $l['fc_forum_doesnt_exist'] = "Forum nie istnieje"; 178 | $l['fc_no_forum_selected'] = "(Nie wybrano żadnego forum)"; 179 | $l['fc_send_pm_to_usergroups'] = "Wyślij PW do grupy"; 180 | $l['fc_no_groups_selected'] = "(Nie wybrano żadnej grupy)"; 181 | $l['fc_send_pm_to_users'] = "Wyślij PW do użytkowników"; 182 | $l['fc_no_users_selected'] = "(Nie wybrano żadnych użytkowników)"; 183 | $l['fc_import_form'] = "Importuj formularz"; 184 | $l['fc_import_code'] = "Importuj kod"; 185 | $l['fc_import_code_desc'] = "Podaj kod do importowania"; 186 | $l['fc_no_forms_imported'] = "Nie znaleziono formularzy do zaimportowania"; 187 | $l['fc_forms_imported'] = "Zaimportowano formularz ({1} forms i {2} pola)"; 188 | $l['fc_url'] = "Link / URL"; 189 | $l['admin_log_config_formcreator_add'] = 'Stworzono formularz #{1} ({2})'; 190 | $l['admin_log_config_formcreator_edit'] = 'Edytowano formularz #{1} ({2})'; 191 | $l['admin_log_config_formcreator_delete'] = 'Usunięto formularz #{1} ({2})'; 192 | $l['admin_log_config_formcreator_addfield'] = 'Dodano pole #{2} ({3}) w formularzu #{1}'; 193 | $l['admin_log_config_formcreator_editfield'] = 'Edytowano pole #{2} ({3}) w formularzu #{1}'; 194 | $l['admin_log_config_formcreator_deletefield'] = 'Usunięto pole #{2} ({3}) w formularzu #{1}'; 195 | -------------------------------------------------------------------------------- /inc/languages/english/admin/config_formcreator.lang.php: -------------------------------------------------------------------------------- 1 | dateformat)"; 136 | $l['fc_default'] = "Default"; 137 | $l['fc_field_default_desc'] = "Enter the default value for this field"; 138 | $l['fc_required'] = "Required"; 139 | $l['fc_field_required_desc'] = "Select if the field is required to fill."; 140 | $l['fc_regex'] = "Regex"; 141 | $l['fc_field_regex_desc'] = "Enter a Regex to check the entered value is to the requested format"; 142 | $l['fc_regex_error'] = "Regex Error Message"; 143 | $l['fc_field_regex_error_desc'] = "Enter the error message that should be shown when the regex fails."; 144 | $l['fc_size'] = "Size"; 145 | $l['fc_field_size_desc'] = "Enter the size of the field"; 146 | $l['fc_cols'] = "Cols"; 147 | $l['fc_field_cols_desc'] = "Enter the size in cols of the field"; 148 | $l['fc_rows'] = "Rows"; 149 | $l['fc_field_rows_desc'] = "Enter the size in rows of the field"; 150 | $l['fc_resize'] = "Allow resize"; 151 | $l['fc_field_resize_desc'] = "Set whether or not the user can resize the field"; 152 | $l['fc_class'] = "Class"; 153 | $l['fc_field_class_desc'] = "Enter a class for the field container"; 154 | $l['fc_html_block'] = "HTML Block"; 155 | $l['fc_field_html_block_desc'] = "Enter the HTML code you would like to display"; 156 | $l['fc_field_type'] = "Field type"; 157 | $l['fc_field_example'] = "Field example"; 158 | $l['fc_field_type_desc'] = "Select what type of field you would like to add."; 159 | $l['fc_button_update_field'] = "Update Field"; 160 | $l['fc_button_create_field'] = "Create Field"; 161 | $l['fc_add_field_unknown_form'] = "You are trying to add a field to a form that doesn't exist!"; 162 | $l['fc_delete_field_unknown'] = "The field you are trying to delete doesn't exist"; 163 | $l['fc_delete_field_form_unknown'] = "The field's form you are trying to delete doesn't exist"; 164 | $l['fc_delete_field_success'] = "The field was succesfully deleted"; 165 | $l['fc_confirmation_delete_field'] = "Are you sure you would like to delete"; 166 | $l['fc_save_order'] = "Save"; 167 | $l['fc_order_saved'] = "Order saved"; 168 | $l['fc_order'] = "Order"; 169 | $l['fc_type'] = "Type"; 170 | $l['fc_form_info'] = "Form Info"; 171 | $l['fc_send_mail_to'] = "Send Mail to"; 172 | $l['fc_no_mail_selected'] = "No mail selected"; 173 | $l['fc_export_form'] = "Export Forms"; 174 | $l['fc_export_description'] = "Copy and save this to a file or use this to import it else where."; 175 | $l['fc_no_forms_to_export'] = "You have no forms that can be exported!"; 176 | $l['fc_forms'] = "Forms"; 177 | $l['fc_no_forms'] = "No forms"; 178 | $l['fc_field_forms_desc'] = "Which forms do you like to export?"; 179 | $l['fc_export_perms'] = "Export Permissions"; 180 | $l['fc_export_perms_desc'] = "Do you like to export the permissions? Set this to 'OFF' if you are going to import this on other forums."; 181 | $l['fc_export_process_options'] = "Export Process Options"; 182 | $l['fc_export_process_options_desc'] = "Do you like to export the process options? Set this to 'OFF' if you are going to import this on other forums."; 183 | $l['fc_export_usagelog'] = "Export Usage Log"; 184 | $l['fc_export_usagelog_desc'] = "Do you like to export the usage history? Set this to 'OFF' if you are going to import this on other forums."; 185 | $l['fc_create_thread_in_forum'] = "Create Thread in Forum"; 186 | $l['fc_forum_doesnt_exist'] = "Forum doesn't exist"; 187 | $l['fc_no_forum_selected'] = "(No forum selected)"; 188 | $l['fc_send_pm_to_usergroups'] = "Send PM to Usergroups"; 189 | $l['fc_no_groups_selected'] = "(No groups selected)"; 190 | $l['fc_send_pm_to_users'] = "Send PM to Users"; 191 | $l['fc_no_users_selected'] = "(No users selected)"; 192 | $l['fc_import_form'] = "Import Forms"; 193 | $l['fc_import_code'] = "Import code"; 194 | $l['fc_import_code_desc'] = "Enter the import code"; 195 | $l['fc_no_forms_imported'] = "No forms found to import"; 196 | $l['fc_forms_imported'] = "Forms imported ({1} forms and {2} fields)"; 197 | $l['fc_url'] = "Link / URL"; 198 | $l['admin_log_config_formcreator_add'] = 'Created form #{1} ({2})'; 199 | $l['admin_log_config_formcreator_edit'] = 'Edited form #{1} ({2})'; 200 | $l['admin_log_config_formcreator_delete'] = 'Deleted form #{1} ({2})'; 201 | $l['admin_log_config_formcreator_addfield'] = 'Added field #{2} ({3}) in form #{1}'; 202 | $l['admin_log_config_formcreator_editfield'] = 'Edited field #{2} ({3}) in form #{1}'; 203 | $l['admin_log_config_formcreator_deletefield'] = 'Deleted field #{2} ({3}) in form #{1}'; 204 | $l['fc_summary_parsed'] = "Used parsed output as summary (preview output)?"; 205 | $l['fc_summary_parsed_desc'] = "Parse the data as the output used to create a thread, post or PM"; 206 | $l['fc_error_missing_template'] = "You are missing a template. Please deactivate the Form Creator and reactivate it to update the templates."; 207 | 208 | ?> -------------------------------------------------------------------------------- /inc/languages/dutch/admin/config_formcreator.lang.php: -------------------------------------------------------------------------------- 1 | dateformat gebruiken)"; 118 | $l['fc_default'] = "Standaard"; 119 | $l['fc_field_default_desc'] = "Geef de standaard waarde op voor het veld"; 120 | $l['fc_required'] = "Verplicht"; 121 | $l['fc_field_required_desc'] = "Selecteer of het veld verplicht is om in te vullen."; 122 | $l['fc_regex'] = "Reguliere expressie (Regex)"; 123 | $l['fc_field_regex_desc'] = "Vul een Regex in waarmee de waarde van het veld gecontroleerd wordt tegen het verwachte format"; 124 | $l['fc_regex_error'] = "Regex Foutmelding"; 125 | $l['fc_field_regex_error_desc'] = "Vul een foutmeldingsbericht in welke getoont wordt wanneer de waarde niet aan de regex voldoet."; 126 | $l['fc_size'] = "Grootte"; 127 | $l['fc_field_size_desc'] = "Vul de grootte van het veld in"; 128 | $l['fc_cols'] = "Kolommen (cols)"; 129 | $l['fc_field_cols_desc'] = "Vul het aantal kolommen in voor het veld"; 130 | $l['fc_rows'] = "Rijen (rows)"; 131 | $l['fc_field_rows_desc'] = "Vul het aantal rijen in voor het veld"; 132 | $l['fc_class'] = "Class"; 133 | $l['fc_field_class_desc'] = "Vul de HTML class in voor het veld"; 134 | $l['fc_html_block'] = "HTML blok"; 135 | $l['fc_field_html_block_desc'] = "Vul de HTML code in die u wilt weergeven"; 136 | $l['fc_field_type'] = "Type veld"; 137 | $l['fc_field_example'] = "Veld voorbeeld"; 138 | $l['fc_field_type_desc'] = "Selecteer welk type veld u wilt toevoegen."; 139 | $l['fc_button_update_field'] = "Veld aanpassen"; 140 | $l['fc_button_create_field'] = "Veld Toevoegen"; 141 | $l['fc_add_field_unknown_form'] = "U probeert een veld toe te voegen aan een formulier wat niet bestaat!"; 142 | $l['fc_delete_field_unknown'] = "Het veld wat u wilt verwijderen bestaat niet"; 143 | $l['fc_delete_field_form_unknown'] = "Het formulier van het veld dat u probeert te verwijderen bestaat niet"; 144 | $l['fc_delete_field_success'] = "Het veld was succesvol verwijderd"; 145 | $l['fc_confirmation_delete_field'] = "Weet u zeker dat u dit wilt verwijderen"; 146 | $l['fc_save_order'] = "Opslaan"; 147 | $l['fc_order_saved'] = "Volgorde opgeslagen"; 148 | $l['fc_order'] = "Volgorde"; 149 | $l['fc_type'] = "Type"; 150 | $l['fc_form_info'] = "Formulier Informatie"; 151 | $l['fc_send_mail_to'] = "Mail verzenden aan"; 152 | $l['fc_no_mail_selected'] = "Geen email geselecteerd"; 153 | $l['fc_export_form'] = "Exporteer Formulieren"; 154 | $l['fc_export_description'] = "Kopieer en sla dit op naar een bestand of gebruik dit om ergens anders te importeren."; 155 | $l['fc_no_forms_to_export'] = "U heeft geen formulieren om te exporteren!"; 156 | $l['fc_forms'] = "Formulieren"; 157 | $l['fc_no_forms'] = "Geen formulieren"; 158 | $l['fc_field_forms_desc'] = "Welke formulieren wilt u graag exporteren?"; 159 | $l['fc_export_perms'] = "Exporteer Rechten"; 160 | $l['fc_export_perms_desc'] = "Wilt u de rechten exporteren? Zet dit op 'UIT' als je dit formulier in een ander forum gaat inporteren."; 161 | $l['fc_export_process_options'] = "Exporteer Verwerkingsopties"; 162 | $l['fc_export_process_options_desc'] = "Wilt u de verwerkingsopties exporteren? Zet dit op 'UIT' als je dit formulier in een ander forum gaat inporteren."; 163 | $l['fc_export_usagelog'] = "Exporteer Gebruik Logboek"; 164 | $l['fc_export_usagelog_desc'] = "Wilt u het gebruik verleden exporteren? Zet dit op 'UIT' als je dit formulier in een ander forum gaat inporteren."; 165 | $l['fc_create_thread_in_forum'] = "Maak een discussie in een Forum"; 166 | $l['fc_forum_doesnt_exist'] = "Forum bestaat niet"; 167 | $l['fc_no_forum_selected'] = "(Geen forum geselecteerd)"; 168 | $l['fc_send_pm_to_usergroups'] = "Verzend een DM naar een gebruikersgroep"; 169 | $l['fc_no_groups_selected'] = "(Geen groepen geselecteerd)"; 170 | $l['fc_send_pm_to_users'] = "Zend DM naar gebruikers"; 171 | $l['fc_no_users_selected'] = "(Geen gebruikers geselecteerd)"; 172 | $l['fc_import_form'] = "Importeer Formulieren"; 173 | $l['fc_import_code'] = "Importeer code"; 174 | $l['fc_import_code_desc'] = "Vul een importeer code in"; 175 | $l['fc_no_forms_imported'] = "Geen formulieren gevonden om te importeren"; 176 | $l['fc_forms_imported'] = "Formulieren geimporteerd ({1} formulieren en {2} velden)"; 177 | $l['fc_url'] = "Link / URL"; 178 | $l['admin_log_config_formcreator_add'] = 'Formulier gemaakt #{1} ({2})'; 179 | $l['admin_log_config_formcreator_edit'] = 'Formulier bewerkt #{1} ({2})'; 180 | $l['admin_log_config_formcreator_delete'] = 'Formulier verwijderd #{1} ({2})'; 181 | $l['admin_log_config_formcreator_addfield'] = 'Veld toegevoegd #{2} ({3}) in formulier #{1}'; 182 | $l['admin_log_config_formcreator_editfield'] = 'Veld bewerkt #{2} ({3}) in formulier #{1}'; 183 | $l['admin_log_config_formcreator_deletefield'] = 'Veld verwijderd #{2} ({3}) in formulier #{1}'; 184 | $l['fc_process_signature'] = "Gebruik Handtekening"; 185 | $l['fc_process_signature_desc'] = "Kies of de gebruiker's handtekening geplaatst wordt onder de discussie of bericht."; 186 | $l['fc_process_posticon'] = "Bericht Icoon"; 187 | $l['fc_process_posticon_desc'] = "Selecteer welk bericht icon gebruikt wordt voor het bericht of discussie."; 188 | $l['fc_resize'] = "Vergroten/verkleinen toestaan"; 189 | $l['fc_field_resize_desc'] = "Stel in of the gebruiker het veld kan vergroten / verkleinen"; 190 | $l['fc_prefixes'] = "Beschikbare voor voegingen"; 191 | $l['fc_no_prefixes'] = "- Geen voorvoeging beschikbaar -"; 192 | $l['fc_field_prefixes_desc'] = "Selecteer de voor voegingen die beschikbaar worden gemaakt voor de gebruiker. Zorg er voor dat de voor voegingen gebruikt mogen worden op het specifieke onderwerp of forum!"; 193 | $l['fc_custom_denied_message'] = "Aangepaste toegang geweigerd bericht"; 194 | $l['fc_custom_denied_message_desc'] = "Vul een aangepast bericht in voor gebruikers die geen toegang hebben om het formulier te openen. Laat dit leeg om het standaard bericht te gebruiken (HTML is ingeschakeld)"; 195 | -------------------------------------------------------------------------------- /inc/languages/portugues_brasil/admin/config_formcreator.lang.php: -------------------------------------------------------------------------------- 1 | dateformat)"; 136 | $l['fc_default'] = "Padrão"; 137 | $l['fc_field_default_desc'] = "Digite o Valor Padrão para este Campo"; 138 | $l['fc_required'] = "Obrigatório"; 139 | $l['fc_field_required_desc'] = "Selecione se o preenchimento do Campo será Obrigatório."; 140 | $l['fc_regex'] = "Expressão Regular (Regex)"; 141 | $l['fc_field_regex_desc'] = "Digite uma Regex para verificar se o valor inserido corresponde ao formato solicitado"; 142 | $l['fc_regex_error'] = "Mensagem de erro Regex"; 143 | $l['fc_field_regex_error_desc'] = "Digite a mensagem de erro que deve ser exibida quando o Regex falhar."; 144 | $l['fc_size'] = "Tamanho"; 145 | $l['fc_field_size_desc'] = "Digite o tamanho do do Campo (Exemplo: 25)"; 146 | $l['fc_cols'] = "Cols"; 147 | $l['fc_field_cols_desc'] = "Digite o tamanho do Campo em Colunas(Cols)"; 148 | $l['fc_rows'] = "Linhas (Rows)"; 149 | $l['fc_field_rows_desc'] = "Digite o tamanho do Campo em Linhas(Rows)"; 150 | $l['fc_resize'] = "Permitir redimensionar"; 151 | $l['fc_field_resize_desc'] = "Defina se o usuário pode ou não redimensionar o campo"; 152 | $l['fc_class'] = "Classe"; 153 | $l['fc_field_class_desc'] = "Insira uma Classe para o contêiner de Campo"; 154 | $l['fc_html_block'] = "Bloco HTML"; 155 | $l['fc_field_html_block_desc'] = "Digite o código HTML que você gostaria de exibir"; 156 | $l['fc_field_type'] = "Tipo de Campo"; 157 | $l['fc_field_example'] = "Exemplo de Campo"; 158 | $l['fc_field_type_desc'] = "Selecione o tipo de Campo que você gostaria de adicionar."; 159 | $l['fc_button_update_field'] = "Atualizar Campo"; 160 | $l['fc_button_create_field'] = "Criar Campo"; 161 | $l['fc_add_field_unknown_form'] = "Você está tentando adicionar um Campo a um Formulário que não existe!"; 162 | $l['fc_delete_field_unknown'] = "O Campo que você está tentando excluir não existe"; 163 | $l['fc_delete_field_form_unknown'] = "O Campo do Formulário que você está tentando excluir não existe"; 164 | $l['fc_delete_field_success'] = "O Campo foi deletado com sucesso"; 165 | $l['fc_confirmation_delete_field'] = "Você tem certeza que gostaria de deletar"; 166 | $l['fc_save_order'] = "Salvar"; 167 | $l['fc_order_saved'] = "Ordem Salva"; 168 | $l['fc_order'] = "Ordem"; 169 | $l['fc_type'] = "Tipo"; 170 | $l['fc_form_info'] = "Informação de Formulário"; 171 | $l['fc_send_mail_to'] = "Enviar Email para"; 172 | $l['fc_no_mail_selected'] = "Nenhum Email selecionado"; 173 | $l['fc_export_form'] = "Exportar Formulários"; 174 | $l['fc_export_description'] = "Copie e guarde em um arquivo ou use-o para importá-lo em outro lugar."; 175 | $l['fc_no_forms_to_export'] = "Você não possui nenhum Formulário que possa ser exportado!"; 176 | $l['fc_forms'] = "Formulários"; 177 | $l['fc_no_forms'] = "Sem Formulários"; 178 | $l['fc_field_forms_desc'] = "Quais Formulários você deseja exportar?"; 179 | $l['fc_export_perms'] = "Permissões de Exportação"; 180 | $l['fc_export_perms_desc'] = "Você gostaria de exportar as permissões? Selecione 'OFF' se você for importar em outros fóruns."; 181 | $l['fc_export_process_options'] = "Opções do Processo de Exportação"; 182 | $l['fc_export_process_options_desc'] = "Você gostaria de exportar as opções do processo? Selecione 'OFF' se você for importar em outros fóruns."; 183 | $l['fc_export_usagelog'] = "Exportar Log de uso"; 184 | $l['fc_export_usagelog_desc'] = "Você gostaria de exportar o histórico de uso? Selecione 'OFF' se você for importar em outros fóruns."; 185 | $l['fc_create_thread_in_forum'] = "Criar Tópico em um Fórum"; 186 | $l['fc_forum_doesnt_exist'] = "Este Fórum não existe"; 187 | $l['fc_no_forum_selected'] = "(Nenhum Fórum selecionado)"; 188 | $l['fc_send_pm_to_usergroups'] = "Enviar MP para Usuários de Grupos"; 189 | $l['fc_no_groups_selected'] = "(Nenhum Grupo selecionado)"; 190 | $l['fc_send_pm_to_users'] = "Enviar MP para Usuários"; 191 | $l['fc_no_users_selected'] = "(Nenhum Usuário selecionado)"; 192 | $l['fc_import_form'] = "Importar Formulários"; 193 | $l['fc_import_code'] = "Código de Importação"; 194 | $l['fc_import_code_desc'] = "Digite o código de importação"; 195 | $l['fc_no_forms_imported'] = "Nenhum Formulário encontrado para importar"; 196 | $l['fc_forms_imported'] = "Formulários Importados ({1} Formulários e {2} Campos)"; 197 | $l['fc_url'] = "Link / URL"; 198 | $l['admin_log_config_formcreator_add'] = 'Formulário Criado #{1} ({2})'; 199 | $l['admin_log_config_formcreator_edit'] = 'Formulário Editado #{1} ({2})'; 200 | $l['admin_log_config_formcreator_delete'] = 'Formulário Deletado #{1} ({2})'; 201 | $l['admin_log_config_formcreator_addfield'] = 'Campo Adicionado #{2} ({3}) no Formulário #{1}'; 202 | $l['admin_log_config_formcreator_editfield'] = 'Campo Editado #{2} ({3}) no Formulário #{1}'; 203 | $l['admin_log_config_formcreator_deletefield'] = 'Campo Deletado #{2} ({3}) no Formulário #{1}'; 204 | $l['fc_summary_parsed'] = "Usou saída analisada como resumo (previzualizar saída)?"; 205 | $l['fc_summary_parsed_desc'] = "Analisar os dados como a saída usada para criar um tópico, postagem ou PM"; 206 | $l['fc_error_missing_template'] = "Está faltando um modelo. Por favor, desative o Form Creator e reative-o para atualizar os modelos."; 207 | 208 | ?> 209 | -------------------------------------------------------------------------------- /form.php: -------------------------------------------------------------------------------- 1 | load("formcreator"); 14 | 15 | $formcreator = new formcreator(); 16 | 17 | if ($formcreator->get_form($mybb->input['formid'])) { 18 | 19 | if ($formcreator->check_allowed() && $formcreator->active == 1) { 20 | 21 | if (!$formcreator->check_usage_limit_reached()) { 22 | 23 | add_breadcrumb($formcreator->name, "form.php?formid=" . $formcreator->formid); 24 | $display = true; 25 | 26 | if ($formcreator->settings['width']) { 27 | $stylewidth = "width:" . $formcreator->settings['width'] . ";"; 28 | } 29 | 30 | if ($formcreator->settings['labelwidth']) { 31 | $stylelabelwidth = "width:" . $formcreator->settings['labelwidth'] . ";"; 32 | } 33 | 34 | if ($formcreator->class) { 35 | $styleclass = $formcreator->class; 36 | } 37 | 38 | $formcreator->get_fields(); 39 | 40 | if ($mybb->request_method == "post") { 41 | 42 | $errors = ""; 43 | $error_array = array(); 44 | $files = array(); 45 | $prefix = ""; 46 | $posthash = ""; 47 | 48 | if ($formcreator->check_summary() == 0) { 49 | $forminput = json_decode($mybb->input['formdata']['data']); 50 | 51 | if (isset($forminput['posthash'])) { 52 | remove_attachments(0, $forminput['posthash']); 53 | } 54 | $error_array[] = $lang->fc_summary_error; 55 | } elseif ($formcreator->check_summary() == 1 && $formcreator->settings['showsummary'] == 1) { 56 | $forminput = json_decode($mybb->input['formdata']['data']); 57 | 58 | foreach ($forminput as $key => $value) { 59 | if (is_array($value)) { 60 | foreach ($value as $ikey => $ivalue) { 61 | $value[$ikey] = urldecode($ivalue); 62 | } 63 | $mybb->input[$key] = $value; 64 | } elseif ($key == "posthash") { 65 | $posthash = $value; 66 | } else { 67 | $mybb->input[$key] = urldecode($value); 68 | } 69 | } 70 | } 71 | 72 | foreach ($formcreator->fields as $field) { 73 | $field->default = $mybb->input["field_" . $field->fieldid]; 74 | 75 | if ($field->required && empty($mybb->input["field_" . $field->fieldid]) && $field->type != 13 && $field->type != 14) { 76 | $error_array[] = "'" . $field->name . "' " . $lang->fc_is_empty; 77 | } elseif ($field->required && $field->type == 3 && empty($mybb->input["field_" . $field->fieldid][0])) { 78 | $error_array[] = "'" . $field->name . "' " . $lang->fc_no_option_selected; 79 | } 80 | 81 | if ($field->settings['regex'] && !preg_match("/" . $field->settings['regex'] . "/", $mybb->input["field_" . $field->fieldid])) { 82 | if (!empty($field->settings['regexerror'])) { 83 | $error_array[] = $field->settings['regexerror']; 84 | } else { 85 | $error_array[] = $lang->fc_no_match_regex; 86 | } 87 | 88 | } 89 | 90 | if ($field->type == 12) { 91 | $captcha = new captcha(); 92 | if ($captcha->validate_captcha() == false) { 93 | // CAPTCHA validation failed 94 | foreach ($captcha->get_errors() as $error) { 95 | $error_array[] = $error; 96 | } 97 | } 98 | } elseif (($field->type == 13 or $field->type == 14) and ($formcreator->check_summary() != 1 or $formcreator->settings['showsummary'] == 0)) { 99 | if (!empty($_FILES["field_" . $field->fieldid]["name"]) && $field->type == 13) { 100 | $files[count($files)] = $_FILES["field_" . $field->fieldid]; 101 | } elseif (!empty($_FILES["field_" . $field->fieldid]["name"][0]) && $field->type == 14) { 102 | $files = array_merge($files, reArrayFiles($_FILES["field_" . $field->fieldid], count($files))); 103 | } elseif ($field->required) { 104 | $error_array[] = $lang->fc_no_attachment; 105 | } elseif (empty($_FILES["field_" . $field->fieldid]["name"]) && $field->type == 13 && !$field->required) { 106 | # No action if no files are submitted 107 | } elseif (empty($_FILES["field_" . $field->fieldid]["name"][0]) && $field->type == 14 && !$field->required) { 108 | # No action if no files are submitted 109 | } else { 110 | $error_array[] = $lang->fc_oops; 111 | } 112 | } elseif ($field->type == 16) { 113 | $prefix = intval($mybb->input["field_" . $field->fieldid]); 114 | } 115 | } 116 | 117 | if (count($files) != 0) { 118 | if ($formcreator->fid != 0) { 119 | $fid = $formcreator->fid; 120 | } elseif ($formcreator->tid != 0) { 121 | $t = get_thread($formcreator->tid); 122 | $fid = $t['fid']; 123 | $tid = $formcreator->tid; 124 | } 125 | $forum['fid'] = $fid; 126 | 127 | $posthash = sha1(time() + (rand(1, 1000) / 1000)); 128 | $mybb->input['posthash'] = $posthash; 129 | foreach ($files as $file) { 130 | $attach_result = upload_attachment($file); 131 | if (!empty($attach_result["error"])) { 132 | $error_array[] = $attach_result["error"]; 133 | } 134 | } 135 | } 136 | 137 | if (count($error_array) != 0) { 138 | $errors = inline_error($error_array); 139 | if (count($files) != 0) { 140 | remove_attachments(0, $posthash); 141 | } 142 | } elseif ($formcreator->settings['showsummary'] == 1 && $formcreator->check_summary() == 2) { 143 | $display = false; 144 | $formtitle = $formcreator->name; 145 | 146 | $input = array(); 147 | foreach ($formcreator->fields as $field) { 148 | if (is_array($field->default)) { 149 | foreach ($field->default as $key => $value) { 150 | $field->default[$key] = urlencode($value); 151 | } 152 | 153 | $input['field_' . $field->fieldid] = $field->default; 154 | } else { 155 | $input['field_' . $field->fieldid] = urlencode($field->default); 156 | } 157 | } 158 | 159 | // Send post hash for attachments 160 | if ($posthash != "") { 161 | $input['posthash'] = $posthash; 162 | } 163 | 164 | $json_data = json_encode($input); 165 | $checksum = hash("SHA256", $json_data); 166 | 167 | $formcontent = ""; 168 | 169 | if (!empty($formcreator->settings['customsummary'])) { 170 | $formcontent .= '' . $formcreator->settings['customsummary'] . ''; 171 | } 172 | 173 | $formcontent .= '' . $formcreator->build_summary() . ''; 174 | eval("\$formcontent .= \"" . $templates->get("formcreator_summary_buttons") . "\";"); 175 | 176 | 177 | } else { 178 | $display = false; 179 | $ref = $formcreator->get_next_ref(); 180 | $post_errors = array(); 181 | 182 | $subject = $formcreator->parse_subject(); 183 | $message = $formcreator->parse_output(); 184 | 185 | $formcreator->log_usage(); 186 | $uid = $mybb->user['uid']; 187 | $username = $mybb->user['username']; 188 | 189 | if ($mybb->user['usergroup'] == 1 || empty($username)) { 190 | $username = "Guest"; 191 | } 192 | 193 | if (!empty($formcreator->settings['uid'])) { 194 | if ($user = get_user($formcreator->settings['uid'])) { 195 | $uid = $user['uid']; 196 | $username = $user['username']; 197 | } elseif ($formcreator->settings['uid'] == -1) { 198 | $uid = -1; 199 | $username = "Form Creator Bot"; 200 | } 201 | } 202 | 203 | // Send PM single user 204 | if ($formcreator->settings['pmusers']) { 205 | $users = explode(",", $formcreator->settings['pmusers']); 206 | 207 | foreach ($users as $user) { 208 | if ($user_data = get_user($user)) { 209 | $pmhandler = new PMDataHandler(); 210 | $pmhandler->admin_override = true; 211 | 212 | $pm = array( 213 | "subject" => $subject, 214 | "message" => $message, 215 | "icon" => $formcreator->settings['posticon'], 216 | "toid" => $user_data['uid'], 217 | "fromid" => $uid, 218 | "do" => '', 219 | "pmid" => ''); 220 | $pm['options'] = array( 221 | "signature" => $formcreator->settings['signature'], 222 | "disablesmilies" => "0", 223 | "savecopy" => "0", 224 | "readreceipt" => "0", 225 | "allow_html" => 1); 226 | 227 | $pmhandler->set_data($pm); 228 | if ($pmhandler->validate_pm()) { 229 | $pmhandler->insert_pm(); 230 | } else { 231 | $post_errors = array_merge($post_errors, $pmhandler->get_friendly_errors()); 232 | } 233 | } 234 | } 235 | } 236 | 237 | // Send PM groups 238 | if (count($formcreator->settings['pmgroups']) != 0 and !empty($formcreator->settings['pmgroups'][0])) { 239 | $group_members = get_usergroup_users_uid($formcreator->settings['pmgroups']); 240 | 241 | $pmhandler = new PMDataHandler(); 242 | 243 | $pm = array( 244 | "subject" => $subject, 245 | "message" => $message, 246 | "icon" => $formcreator->settings['posticon'], 247 | "toid" => $group_members, 248 | "fromid" => $uid, 249 | "do" => '', 250 | "pmid" => '' 251 | ); 252 | $pm['options'] = array( 253 | "signature" => $formcreator->settings['signature'], 254 | "disablesmilies" => "0", 255 | "savecopy" => "0", 256 | "readreceipt" => "0", 257 | "allow_html" => 1); 258 | 259 | $pmhandler->set_data($pm); 260 | //verify_pm_flooding() is called in validate_pm 261 | //$pmhandler->verify_pm_flooding(); 262 | 263 | if ($pmhandler->validate_pm()) { 264 | $pmhandler->insert_pm(); 265 | } else { 266 | $post_errors = array_merge($post_errors, $pmhandler->get_friendly_errors()); 267 | } 268 | 269 | } 270 | 271 | 272 | // Mail content 273 | /* 274 | if ($formcreator->settings['mail']) { 275 | if ($mybb->user['uid']) { 276 | $mybb->input['fromemail'] = $mybb->user['email']; 277 | $mybb->input['fromname'] = $mybb->user['username']; 278 | } else { 279 | $mybb->input['fromemail'] = $mybb->user['email']; 280 | //$mybb->input['fromname'] = $mybb->settings['']; 281 | } 282 | 283 | if ($mybb->settings['mail_handler'] == 'smtp') { 284 | $from = $mybb->input['fromemail']; 285 | } else { 286 | $from = "{$mybb->input['fromname']} <{$mybb->input['fromemail']}>"; 287 | } 288 | 289 | $message = $lang->sprintf($lang->email_emailuser, $to_user['username'], $mybb->input['fromname'], $mybb->settings['bbname'], $mybb->settings['bburl'], 290 | $mybb->get_input('message')); 291 | my_mail($to_user['email'], $mybb->get_input('subject'), $message, $from, "", "", false, "text", "", $mybb->input['fromemail']); 292 | 293 | if ($mybb->settings['mail_logging'] > 0) { 294 | // Log the message 295 | $log_entry = array( 296 | "subject" => $db->escape_string($mybb->get_input('subject')), 297 | "message" => $db->escape_string($mybb->get_input('message')), 298 | "dateline" => TIME_NOW, 299 | "fromuid" => $mybb->user['uid'], 300 | "fromemail" => $db->escape_string($mybb->input['fromemail']), 301 | "touid" => $to_user['uid'], 302 | "toemail" => $db->escape_string($to_user['email']), 303 | "tid" => 0, 304 | "ipaddress" => $db->escape_binary($session->packedip), 305 | "type" => 1); 306 | $db->insert_query("maillogs", $log_entry); 307 | } 308 | } 309 | */ 310 | 311 | // Post in Thread 312 | if ($formcreator->settings) { 313 | if ($thread = get_thread($formcreator->tid)) { 314 | 315 | $mybb->input['action'] = "do_newreply"; 316 | 317 | $posthandler = new PostDataHandler(); 318 | $posthandler->action = "post"; 319 | $posthandler->admin_override = false; 320 | 321 | $new_post = array( 322 | "fid" => $thread['fid'], 323 | "tid" => $thread['tid'], 324 | "subject" => $subject, 325 | "icon" => $formcreator->settings['posticon'], 326 | "uid" => $uid, 327 | "username" => $username, 328 | "message" => $message, 329 | "ipaddress" => $session->packedip, 330 | "posthash" => $posthash); 331 | 332 | // Set up the thread options 333 | $new_post['options'] = array( 334 | "signature" => $formcreator->settings['signature'], 335 | "emailnotify" => '', 336 | "disablesmilies" => '0'); 337 | 338 | $posthandler->set_data($new_post); 339 | $posthandler->verify_post_flooding(); 340 | 341 | if ($posthandler->validate_post()) { 342 | $post_info = $posthandler->insert_post(); 343 | $pid = $post_info['pid']; 344 | 345 | $post = get_post($pid); 346 | 347 | $forumpermissions = forum_permissions($thread['fid']); 348 | 349 | if ($forumpermissions['canviewthreads'] == 1 && $post['visible'] == 1) { 350 | $url = get_post_link($pid, $thread['tid']); 351 | } 352 | } else { 353 | $post_errors = array_merge($post_errors, $posthandler->get_friendly_errors()); 354 | } 355 | } 356 | } 357 | 358 | // Thread in Forum 359 | if ($formcreator->fid) { 360 | if ($forum = get_forum($formcreator->fid)) { 361 | 362 | $mybb->input['action'] = "do_newthread"; 363 | $fid = $forum['fid']; 364 | 365 | $posthandler = new PostDataHandler(); 366 | $posthandler->action = "thread"; 367 | 368 | if (empty($prefix)) { 369 | $prefix = $formcreator->settings['prefix']; 370 | } 371 | 372 | $new_thread = array( 373 | "fid" => $forum['fid'], 374 | "subject" => $subject, 375 | "prefix" => $prefix, 376 | "icon" => $formcreator->settings['posticon'], 377 | "uid" => $uid, 378 | "username" => $username, 379 | "message" => $message, 380 | "ipaddress" => $session->packedip, 381 | "posthash" => $posthash); 382 | 383 | // Set up the thread options 384 | $new_thread['options'] = array( 385 | "signature" => $formcreator->settings['signature'], 386 | "emailnotify" => '', 387 | "disablesmilies" => '0'); 388 | 389 | $posthandler->set_data($new_thread); 390 | $posthandler->verify_post_flooding(); 391 | 392 | if ($posthandler->validate_thread()) { 393 | $thread_info = $posthandler->insert_thread(); 394 | $tid = $thread_info['tid']; 395 | 396 | $thread = get_thread($tid); 397 | $post = get_post($thread['firstpost']); 398 | 399 | $forumpermissions = forum_permissions($forum['fid']); 400 | 401 | if ($forumpermissions['canviewthreads'] == 1 && $post['visible'] == 1) { 402 | $url = get_thread_link($tid); 403 | } 404 | } else { 405 | $post_errors = array_merge($post_errors, $posthandler->get_friendly_errors()); 406 | } 407 | } 408 | } 409 | 410 | if (count($post_errors) != 0) { 411 | $errors .= inline_error($post_errors); 412 | } elseif (!empty($formcreator->settings['customsuccess'])) { 413 | redirect($formcreator->settings['customsuccess'], $lang->fc_submitted, "", false); 414 | } elseif ($url) { 415 | redirect($url, $lang->fc_submitted, "", false); 416 | } else { 417 | redirect($mybb->settings['bburl'], $lang->fc_submitted, "", false); 418 | } 419 | 420 | } 421 | } 422 | 423 | if ($display && count($formcreator->fields) != 0) { 424 | $formtitle = $formcreator->name; 425 | 426 | $formcontent = $formcreator->build_form(); 427 | } elseif (count($formcreator->fields) == 0) { 428 | $formtitle = $formcreator->name; 429 | 430 | $formcontent = '' . $lang->fc_no_fields . ''; 431 | } 432 | 433 | } else { 434 | add_breadcrumb($formcreator->name, "form.php?formid=" . $formcreator->formid); 435 | 436 | $formtitle = $lang->fc_limit_reached_title; 437 | 438 | $formcontent = '' . $lang->fc_limit_reached . ''; 439 | } 440 | } elseif ($formcreator->active == 0) { 441 | add_breadcrumb($formcreator->name, "form.php?formid=" . $formcreator->formid); 442 | 443 | $formtitle = $lang->fc_form_disabled_title; 444 | 445 | $formcontent = '' . $lang->fc_form_disabled . ''; 446 | } else { 447 | add_breadcrumb($formcreator->name, "form.php?formid=" . $formcreator->formid); 448 | 449 | $formtitle = $lang->fc_access_denied; 450 | 451 | $custommsg = trim($formcreator->settings['customdenied']); 452 | if (empty($custommsg)) { 453 | $deniedtext = $lang->fc_form_no_permissions; 454 | } else { 455 | $deniedtext = $formcreator->settings['customdenied']; 456 | } 457 | 458 | $formcontent = '' . $deniedtext . ''; 459 | } 460 | } else { 461 | add_breadcrumb($lang->formcreator, "form.php"); 462 | 463 | $formtitle = $lang->formcreator; 464 | $formcontent = '' . $lang->fc_no_form_found . ''; 465 | } 466 | 467 | eval("\$form = \"" . $templates->get("formcreator_container") . "\";"); 468 | 469 | eval("\$html = \"" . $templates->get("formcreator") . "\";"); 470 | 471 | output_page($html); 472 | 473 | ?> -------------------------------------------------------------------------------- /inc/plugins/formcreator/jquery-ui.css: -------------------------------------------------------------------------------- 1 | /*! jQuery UI - v1.12.1 - 2017-04-14 2 | * http://jqueryui.com 3 | * Includes: core.css, datepicker.css, theme.css 4 | * To view and modify this theme, visit http://jqueryui.com/themeroller/?scope=&folderName=base&cornerRadiusShadow=8px&offsetLeftShadow=0px&offsetTopShadow=0px&thicknessShadow=5px&opacityShadow=30&bgImgOpacityShadow=0&bgTextureShadow=flat&bgColorShadow=666666&opacityOverlay=30&bgImgOpacityOverlay=0&bgTextureOverlay=flat&bgColorOverlay=aaaaaa&iconColorError=cc0000&fcError=5f3f3f&borderColorError=f1a899&bgTextureError=flat&bgColorError=fddfdf&iconColorHighlight=777620&fcHighlight=777620&borderColorHighlight=dad55e&bgTextureHighlight=flat&bgColorHighlight=fffa90&iconColorActive=ffffff&fcActive=ffffff&borderColorActive=003eff&bgTextureActive=flat&bgColorActive=007fff&iconColorHover=555555&fcHover=2b2b2b&borderColorHover=cccccc&bgTextureHover=flat&bgColorHover=ededed&iconColorDefault=777777&fcDefault=454545&borderColorDefault=c5c5c5&bgTextureDefault=flat&bgColorDefault=f6f6f6&iconColorContent=444444&fcContent=333333&borderColorContent=dddddd&bgTextureContent=flat&bgColorContent=ffffff&iconColorHeader=444444&fcHeader=333333&borderColorHeader=dddddd&bgTextureHeader=flat&bgColorHeader=e9e9e9&cornerRadius=3px&fwDefault=normal&fsDefault=1em&ffDefault=Arial%2CHelvetica%2Csans-serif 5 | * Copyright jQuery Foundation and other contributors; Licensed MIT */ 6 | 7 | /* Layout helpers 8 | ----------------------------------*/ 9 | .ui-helper-hidden { 10 | display: none; 11 | } 12 | .ui-helper-hidden-accessible { 13 | border: 0; 14 | clip: rect(0 0 0 0); 15 | height: 1px; 16 | margin: -1px; 17 | overflow: hidden; 18 | padding: 0; 19 | position: absolute; 20 | width: 1px; 21 | } 22 | .ui-helper-reset { 23 | margin: 0; 24 | padding: 0; 25 | border: 0; 26 | outline: 0; 27 | line-height: 1.3; 28 | text-decoration: none; 29 | font-size: 100%; 30 | list-style: none; 31 | } 32 | .ui-helper-clearfix:before, 33 | .ui-helper-clearfix:after { 34 | content: ""; 35 | display: table; 36 | border-collapse: collapse; 37 | } 38 | .ui-helper-clearfix:after { 39 | clear: both; 40 | } 41 | .ui-helper-zfix { 42 | width: 100%; 43 | height: 100%; 44 | top: 0; 45 | left: 0; 46 | position: absolute; 47 | opacity: 0; 48 | filter:Alpha(Opacity=0); /* support: IE8 */ 49 | } 50 | 51 | .ui-front { 52 | z-index: 100; 53 | } 54 | 55 | 56 | /* Interaction Cues 57 | ----------------------------------*/ 58 | .ui-state-disabled { 59 | cursor: default !important; 60 | pointer-events: none; 61 | } 62 | 63 | 64 | /* Icons 65 | ----------------------------------*/ 66 | .ui-icon { 67 | display: inline-block; 68 | vertical-align: middle; 69 | margin-top: -.25em; 70 | position: relative; 71 | text-indent: -99999px; 72 | overflow: hidden; 73 | background-repeat: no-repeat; 74 | } 75 | 76 | .ui-widget-icon-block { 77 | left: 50%; 78 | margin-left: -8px; 79 | display: block; 80 | } 81 | 82 | /* Misc visuals 83 | ----------------------------------*/ 84 | 85 | /* Overlays */ 86 | .ui-widget-overlay { 87 | position: fixed; 88 | top: 0; 89 | left: 0; 90 | width: 100%; 91 | height: 100%; 92 | } 93 | .ui-datepicker { 94 | width: 17em; 95 | padding: .2em .2em 0; 96 | display: none; 97 | } 98 | .ui-datepicker .ui-datepicker-header { 99 | position: relative; 100 | padding: .2em 0; 101 | } 102 | .ui-datepicker .ui-datepicker-prev, 103 | .ui-datepicker .ui-datepicker-next { 104 | position: absolute; 105 | top: 2px; 106 | width: 1.8em; 107 | height: 1.8em; 108 | } 109 | .ui-datepicker .ui-datepicker-prev-hover, 110 | .ui-datepicker .ui-datepicker-next-hover { 111 | top: 1px; 112 | } 113 | .ui-datepicker .ui-datepicker-prev { 114 | left: 2px; 115 | } 116 | .ui-datepicker .ui-datepicker-next { 117 | right: 2px; 118 | } 119 | .ui-datepicker .ui-datepicker-prev-hover { 120 | left: 1px; 121 | } 122 | .ui-datepicker .ui-datepicker-next-hover { 123 | right: 1px; 124 | } 125 | .ui-datepicker .ui-datepicker-prev span, 126 | .ui-datepicker .ui-datepicker-next span { 127 | display: block; 128 | position: absolute; 129 | left: 50%; 130 | margin-left: -8px; 131 | top: 50%; 132 | margin-top: -8px; 133 | } 134 | .ui-datepicker .ui-datepicker-title { 135 | margin: 0 2.3em; 136 | line-height: 1.8em; 137 | text-align: center; 138 | } 139 | .ui-datepicker .ui-datepicker-title select { 140 | font-size: 1em; 141 | margin: 1px 0; 142 | } 143 | .ui-datepicker select.ui-datepicker-month, 144 | .ui-datepicker select.ui-datepicker-year { 145 | width: 45%; 146 | } 147 | .ui-datepicker table { 148 | width: 100%; 149 | font-size: .9em; 150 | border-collapse: collapse; 151 | margin: 0 0 .4em; 152 | } 153 | .ui-datepicker th { 154 | padding: .7em .3em; 155 | text-align: center; 156 | font-weight: bold; 157 | border: 0; 158 | } 159 | .ui-datepicker td { 160 | border: 0; 161 | padding: 1px; 162 | } 163 | .ui-datepicker td span, 164 | .ui-datepicker td a { 165 | display: block; 166 | padding: .2em; 167 | text-align: right; 168 | text-decoration: none; 169 | } 170 | .ui-datepicker .ui-datepicker-buttonpane { 171 | background-image: none; 172 | margin: .7em 0 0 0; 173 | padding: 0 .2em; 174 | border-left: 0; 175 | border-right: 0; 176 | border-bottom: 0; 177 | } 178 | .ui-datepicker .ui-datepicker-buttonpane button { 179 | float: right; 180 | margin: .5em .2em .4em; 181 | cursor: pointer; 182 | padding: .2em .6em .3em .6em; 183 | width: auto; 184 | overflow: visible; 185 | } 186 | .ui-datepicker .ui-datepicker-buttonpane button.ui-datepicker-current { 187 | float: left; 188 | } 189 | 190 | /* with multiple calendars */ 191 | .ui-datepicker.ui-datepicker-multi { 192 | width: auto; 193 | } 194 | .ui-datepicker-multi .ui-datepicker-group { 195 | float: left; 196 | } 197 | .ui-datepicker-multi .ui-datepicker-group table { 198 | width: 95%; 199 | margin: 0 auto .4em; 200 | } 201 | .ui-datepicker-multi-2 .ui-datepicker-group { 202 | width: 50%; 203 | } 204 | .ui-datepicker-multi-3 .ui-datepicker-group { 205 | width: 33.3%; 206 | } 207 | .ui-datepicker-multi-4 .ui-datepicker-group { 208 | width: 25%; 209 | } 210 | .ui-datepicker-multi .ui-datepicker-group-last .ui-datepicker-header, 211 | .ui-datepicker-multi .ui-datepicker-group-middle .ui-datepicker-header { 212 | border-left-width: 0; 213 | } 214 | .ui-datepicker-multi .ui-datepicker-buttonpane { 215 | clear: left; 216 | } 217 | .ui-datepicker-row-break { 218 | clear: both; 219 | width: 100%; 220 | font-size: 0; 221 | } 222 | 223 | /* RTL support */ 224 | .ui-datepicker-rtl { 225 | direction: rtl; 226 | } 227 | .ui-datepicker-rtl .ui-datepicker-prev { 228 | right: 2px; 229 | left: auto; 230 | } 231 | .ui-datepicker-rtl .ui-datepicker-next { 232 | left: 2px; 233 | right: auto; 234 | } 235 | .ui-datepicker-rtl .ui-datepicker-prev:hover { 236 | right: 1px; 237 | left: auto; 238 | } 239 | .ui-datepicker-rtl .ui-datepicker-next:hover { 240 | left: 1px; 241 | right: auto; 242 | } 243 | .ui-datepicker-rtl .ui-datepicker-buttonpane { 244 | clear: right; 245 | } 246 | .ui-datepicker-rtl .ui-datepicker-buttonpane button { 247 | float: left; 248 | } 249 | .ui-datepicker-rtl .ui-datepicker-buttonpane button.ui-datepicker-current, 250 | .ui-datepicker-rtl .ui-datepicker-group { 251 | float: right; 252 | } 253 | .ui-datepicker-rtl .ui-datepicker-group-last .ui-datepicker-header, 254 | .ui-datepicker-rtl .ui-datepicker-group-middle .ui-datepicker-header { 255 | border-right-width: 0; 256 | border-left-width: 1px; 257 | } 258 | 259 | /* Icons */ 260 | .ui-datepicker .ui-icon { 261 | display: block; 262 | text-indent: -99999px; 263 | overflow: hidden; 264 | background-repeat: no-repeat; 265 | left: .5em; 266 | top: .3em; 267 | } 268 | 269 | /* Component containers 270 | ----------------------------------*/ 271 | .ui-widget { 272 | font-family: Arial,Helvetica,sans-serif; 273 | font-size: 1em; 274 | } 275 | .ui-widget .ui-widget { 276 | font-size: 1em; 277 | } 278 | .ui-widget input, 279 | .ui-widget select, 280 | .ui-widget textarea, 281 | .ui-widget button { 282 | font-family: Arial,Helvetica,sans-serif; 283 | font-size: 1em; 284 | } 285 | .ui-widget.ui-widget-content { 286 | border: 1px solid #c5c5c5; 287 | } 288 | .ui-widget-content { 289 | border: 1px solid #dddddd; 290 | background: #ffffff; 291 | color: #333333; 292 | } 293 | .ui-widget-content a { 294 | color: #333333; 295 | } 296 | .ui-widget-header { 297 | border: 1px solid #dddddd; 298 | background: #e9e9e9; 299 | color: #333333; 300 | font-weight: bold; 301 | } 302 | .ui-widget-header a { 303 | color: #333333; 304 | } 305 | 306 | /* Interaction states 307 | ----------------------------------*/ 308 | .ui-state-default, 309 | .ui-widget-content .ui-state-default, 310 | .ui-widget-header .ui-state-default, 311 | .ui-button, 312 | 313 | /* We use html here because we need a greater specificity to make sure disabled 314 | works properly when clicked or hovered */ 315 | html .ui-button.ui-state-disabled:hover, 316 | html .ui-button.ui-state-disabled:active { 317 | border: 1px solid #c5c5c5; 318 | background: #f6f6f6; 319 | font-weight: normal; 320 | color: #454545; 321 | } 322 | .ui-state-default a, 323 | .ui-state-default a:link, 324 | .ui-state-default a:visited, 325 | a.ui-button, 326 | a:link.ui-button, 327 | a:visited.ui-button, 328 | .ui-button { 329 | color: #454545; 330 | text-decoration: none; 331 | } 332 | .ui-state-hover, 333 | .ui-widget-content .ui-state-hover, 334 | .ui-widget-header .ui-state-hover, 335 | .ui-state-focus, 336 | .ui-widget-content .ui-state-focus, 337 | .ui-widget-header .ui-state-focus, 338 | .ui-button:hover, 339 | .ui-button:focus { 340 | border: 1px solid #cccccc; 341 | background: #ededed; 342 | font-weight: normal; 343 | color: #2b2b2b; 344 | } 345 | .ui-state-hover a, 346 | .ui-state-hover a:hover, 347 | .ui-state-hover a:link, 348 | .ui-state-hover a:visited, 349 | .ui-state-focus a, 350 | .ui-state-focus a:hover, 351 | .ui-state-focus a:link, 352 | .ui-state-focus a:visited, 353 | a.ui-button:hover, 354 | a.ui-button:focus { 355 | color: #2b2b2b; 356 | text-decoration: none; 357 | } 358 | 359 | .ui-visual-focus { 360 | box-shadow: 0 0 3px 1px rgb(94, 158, 214); 361 | } 362 | .ui-state-active, 363 | .ui-widget-content .ui-state-active, 364 | .ui-widget-header .ui-state-active, 365 | a.ui-button:active, 366 | .ui-button:active, 367 | .ui-button.ui-state-active:hover { 368 | border: 1px solid #003eff; 369 | background: #007fff; 370 | font-weight: normal; 371 | color: #ffffff; 372 | } 373 | .ui-icon-background, 374 | .ui-state-active .ui-icon-background { 375 | border: #003eff; 376 | background-color: #ffffff; 377 | } 378 | .ui-state-active a, 379 | .ui-state-active a:link, 380 | .ui-state-active a:visited { 381 | color: #ffffff; 382 | text-decoration: none; 383 | } 384 | 385 | /* Interaction Cues 386 | ----------------------------------*/ 387 | .ui-state-highlight, 388 | .ui-widget-content .ui-state-highlight, 389 | .ui-widget-header .ui-state-highlight { 390 | border: 1px solid #dad55e; 391 | background: #fffa90; 392 | color: #777620; 393 | } 394 | .ui-state-checked { 395 | border: 1px solid #dad55e; 396 | background: #fffa90; 397 | } 398 | .ui-state-highlight a, 399 | .ui-widget-content .ui-state-highlight a, 400 | .ui-widget-header .ui-state-highlight a { 401 | color: #777620; 402 | } 403 | .ui-state-error, 404 | .ui-widget-content .ui-state-error, 405 | .ui-widget-header .ui-state-error { 406 | border: 1px solid #f1a899; 407 | background: #fddfdf; 408 | color: #5f3f3f; 409 | } 410 | .ui-state-error a, 411 | .ui-widget-content .ui-state-error a, 412 | .ui-widget-header .ui-state-error a { 413 | color: #5f3f3f; 414 | } 415 | .ui-state-error-text, 416 | .ui-widget-content .ui-state-error-text, 417 | .ui-widget-header .ui-state-error-text { 418 | color: #5f3f3f; 419 | } 420 | .ui-priority-primary, 421 | .ui-widget-content .ui-priority-primary, 422 | .ui-widget-header .ui-priority-primary { 423 | font-weight: bold; 424 | } 425 | .ui-priority-secondary, 426 | .ui-widget-content .ui-priority-secondary, 427 | .ui-widget-header .ui-priority-secondary { 428 | opacity: .7; 429 | filter:Alpha(Opacity=70); /* support: IE8 */ 430 | font-weight: normal; 431 | } 432 | .ui-state-disabled, 433 | .ui-widget-content .ui-state-disabled, 434 | .ui-widget-header .ui-state-disabled { 435 | opacity: .35; 436 | filter:Alpha(Opacity=35); /* support: IE8 */ 437 | background-image: none; 438 | } 439 | .ui-state-disabled .ui-icon { 440 | filter:Alpha(Opacity=35); /* support: IE8 - See #6059 */ 441 | } 442 | 443 | /* Icons 444 | ----------------------------------*/ 445 | 446 | /* states and images */ 447 | .ui-icon { 448 | width: 16px; 449 | height: 16px; 450 | } 451 | .ui-icon, 452 | .ui-widget-content .ui-icon { 453 | background-image: url("images/ui-icons_444444_256x240.png"); 454 | } 455 | .ui-widget-header .ui-icon { 456 | background-image: url("images/ui-icons_444444_256x240.png"); 457 | } 458 | .ui-state-hover .ui-icon, 459 | .ui-state-focus .ui-icon, 460 | .ui-button:hover .ui-icon, 461 | .ui-button:focus .ui-icon { 462 | background-image: url("images/ui-icons_555555_256x240.png"); 463 | } 464 | .ui-state-active .ui-icon, 465 | .ui-button:active .ui-icon { 466 | background-image: url("images/ui-icons_ffffff_256x240.png"); 467 | } 468 | .ui-state-highlight .ui-icon, 469 | .ui-button .ui-state-highlight.ui-icon { 470 | background-image: url("images/ui-icons_777620_256x240.png"); 471 | } 472 | .ui-state-error .ui-icon, 473 | .ui-state-error-text .ui-icon { 474 | background-image: url("images/ui-icons_cc0000_256x240.png"); 475 | } 476 | .ui-button .ui-icon { 477 | background-image: url("images/ui-icons_777777_256x240.png"); 478 | } 479 | 480 | /* positioning */ 481 | .ui-icon-blank { background-position: 16px 16px; } 482 | .ui-icon-caret-1-n { background-position: 0 0; } 483 | .ui-icon-caret-1-ne { background-position: -16px 0; } 484 | .ui-icon-caret-1-e { background-position: -32px 0; } 485 | .ui-icon-caret-1-se { background-position: -48px 0; } 486 | .ui-icon-caret-1-s { background-position: -65px 0; } 487 | .ui-icon-caret-1-sw { background-position: -80px 0; } 488 | .ui-icon-caret-1-w { background-position: -96px 0; } 489 | .ui-icon-caret-1-nw { background-position: -112px 0; } 490 | .ui-icon-caret-2-n-s { background-position: -128px 0; } 491 | .ui-icon-caret-2-e-w { background-position: -144px 0; } 492 | .ui-icon-triangle-1-n { background-position: 0 -16px; } 493 | .ui-icon-triangle-1-ne { background-position: -16px -16px; } 494 | .ui-icon-triangle-1-e { background-position: -32px -16px; } 495 | .ui-icon-triangle-1-se { background-position: -48px -16px; } 496 | .ui-icon-triangle-1-s { background-position: -65px -16px; } 497 | .ui-icon-triangle-1-sw { background-position: -80px -16px; } 498 | .ui-icon-triangle-1-w { background-position: -96px -16px; } 499 | .ui-icon-triangle-1-nw { background-position: -112px -16px; } 500 | .ui-icon-triangle-2-n-s { background-position: -128px -16px; } 501 | .ui-icon-triangle-2-e-w { background-position: -144px -16px; } 502 | .ui-icon-arrow-1-n { background-position: 0 -32px; } 503 | .ui-icon-arrow-1-ne { background-position: -16px -32px; } 504 | .ui-icon-arrow-1-e { background-position: -32px -32px; } 505 | .ui-icon-arrow-1-se { background-position: -48px -32px; } 506 | .ui-icon-arrow-1-s { background-position: -65px -32px; } 507 | .ui-icon-arrow-1-sw { background-position: -80px -32px; } 508 | .ui-icon-arrow-1-w { background-position: -96px -32px; } 509 | .ui-icon-arrow-1-nw { background-position: -112px -32px; } 510 | .ui-icon-arrow-2-n-s { background-position: -128px -32px; } 511 | .ui-icon-arrow-2-ne-sw { background-position: -144px -32px; } 512 | .ui-icon-arrow-2-e-w { background-position: -160px -32px; } 513 | .ui-icon-arrow-2-se-nw { background-position: -176px -32px; } 514 | .ui-icon-arrowstop-1-n { background-position: -192px -32px; } 515 | .ui-icon-arrowstop-1-e { background-position: -208px -32px; } 516 | .ui-icon-arrowstop-1-s { background-position: -224px -32px; } 517 | .ui-icon-arrowstop-1-w { background-position: -240px -32px; } 518 | .ui-icon-arrowthick-1-n { background-position: 1px -48px; } 519 | .ui-icon-arrowthick-1-ne { background-position: -16px -48px; } 520 | .ui-icon-arrowthick-1-e { background-position: -32px -48px; } 521 | .ui-icon-arrowthick-1-se { background-position: -48px -48px; } 522 | .ui-icon-arrowthick-1-s { background-position: -64px -48px; } 523 | .ui-icon-arrowthick-1-sw { background-position: -80px -48px; } 524 | .ui-icon-arrowthick-1-w { background-position: -96px -48px; } 525 | .ui-icon-arrowthick-1-nw { background-position: -112px -48px; } 526 | .ui-icon-arrowthick-2-n-s { background-position: -128px -48px; } 527 | .ui-icon-arrowthick-2-ne-sw { background-position: -144px -48px; } 528 | .ui-icon-arrowthick-2-e-w { background-position: -160px -48px; } 529 | .ui-icon-arrowthick-2-se-nw { background-position: -176px -48px; } 530 | .ui-icon-arrowthickstop-1-n { background-position: -192px -48px; } 531 | .ui-icon-arrowthickstop-1-e { background-position: -208px -48px; } 532 | .ui-icon-arrowthickstop-1-s { background-position: -224px -48px; } 533 | .ui-icon-arrowthickstop-1-w { background-position: -240px -48px; } 534 | .ui-icon-arrowreturnthick-1-w { background-position: 0 -64px; } 535 | .ui-icon-arrowreturnthick-1-n { background-position: -16px -64px; } 536 | .ui-icon-arrowreturnthick-1-e { background-position: -32px -64px; } 537 | .ui-icon-arrowreturnthick-1-s { background-position: -48px -64px; } 538 | .ui-icon-arrowreturn-1-w { background-position: -64px -64px; } 539 | .ui-icon-arrowreturn-1-n { background-position: -80px -64px; } 540 | .ui-icon-arrowreturn-1-e { background-position: -96px -64px; } 541 | .ui-icon-arrowreturn-1-s { background-position: -112px -64px; } 542 | .ui-icon-arrowrefresh-1-w { background-position: -128px -64px; } 543 | .ui-icon-arrowrefresh-1-n { background-position: -144px -64px; } 544 | .ui-icon-arrowrefresh-1-e { background-position: -160px -64px; } 545 | .ui-icon-arrowrefresh-1-s { background-position: -176px -64px; } 546 | .ui-icon-arrow-4 { background-position: 0 -80px; } 547 | .ui-icon-arrow-4-diag { background-position: -16px -80px; } 548 | .ui-icon-extlink { background-position: -32px -80px; } 549 | .ui-icon-newwin { background-position: -48px -80px; } 550 | .ui-icon-refresh { background-position: -64px -80px; } 551 | .ui-icon-shuffle { background-position: -80px -80px; } 552 | .ui-icon-transfer-e-w { background-position: -96px -80px; } 553 | .ui-icon-transferthick-e-w { background-position: -112px -80px; } 554 | .ui-icon-folder-collapsed { background-position: 0 -96px; } 555 | .ui-icon-folder-open { background-position: -16px -96px; } 556 | .ui-icon-document { background-position: -32px -96px; } 557 | .ui-icon-document-b { background-position: -48px -96px; } 558 | .ui-icon-note { background-position: -64px -96px; } 559 | .ui-icon-mail-closed { background-position: -80px -96px; } 560 | .ui-icon-mail-open { background-position: -96px -96px; } 561 | .ui-icon-suitcase { background-position: -112px -96px; } 562 | .ui-icon-comment { background-position: -128px -96px; } 563 | .ui-icon-person { background-position: -144px -96px; } 564 | .ui-icon-print { background-position: -160px -96px; } 565 | .ui-icon-trash { background-position: -176px -96px; } 566 | .ui-icon-locked { background-position: -192px -96px; } 567 | .ui-icon-unlocked { background-position: -208px -96px; } 568 | .ui-icon-bookmark { background-position: -224px -96px; } 569 | .ui-icon-tag { background-position: -240px -96px; } 570 | .ui-icon-home { background-position: 0 -112px; } 571 | .ui-icon-flag { background-position: -16px -112px; } 572 | .ui-icon-calendar { background-position: -32px -112px; } 573 | .ui-icon-cart { background-position: -48px -112px; } 574 | .ui-icon-pencil { background-position: -64px -112px; } 575 | .ui-icon-clock { background-position: -80px -112px; } 576 | .ui-icon-disk { background-position: -96px -112px; } 577 | .ui-icon-calculator { background-position: -112px -112px; } 578 | .ui-icon-zoomin { background-position: -128px -112px; } 579 | .ui-icon-zoomout { background-position: -144px -112px; } 580 | .ui-icon-search { background-position: -160px -112px; } 581 | .ui-icon-wrench { background-position: -176px -112px; } 582 | .ui-icon-gear { background-position: -192px -112px; } 583 | .ui-icon-heart { background-position: -208px -112px; } 584 | .ui-icon-star { background-position: -224px -112px; } 585 | .ui-icon-link { background-position: -240px -112px; } 586 | .ui-icon-cancel { background-position: 0 -128px; } 587 | .ui-icon-plus { background-position: -16px -128px; } 588 | .ui-icon-plusthick { background-position: -32px -128px; } 589 | .ui-icon-minus { background-position: -48px -128px; } 590 | .ui-icon-minusthick { background-position: -64px -128px; } 591 | .ui-icon-close { background-position: -80px -128px; } 592 | .ui-icon-closethick { background-position: -96px -128px; } 593 | .ui-icon-key { background-position: -112px -128px; } 594 | .ui-icon-lightbulb { background-position: -128px -128px; } 595 | .ui-icon-scissors { background-position: -144px -128px; } 596 | .ui-icon-clipboard { background-position: -160px -128px; } 597 | .ui-icon-copy { background-position: -176px -128px; } 598 | .ui-icon-contact { background-position: -192px -128px; } 599 | .ui-icon-image { background-position: -208px -128px; } 600 | .ui-icon-video { background-position: -224px -128px; } 601 | .ui-icon-script { background-position: -240px -128px; } 602 | .ui-icon-alert { background-position: 0 -144px; } 603 | .ui-icon-info { background-position: -16px -144px; } 604 | .ui-icon-notice { background-position: -32px -144px; } 605 | .ui-icon-help { background-position: -48px -144px; } 606 | .ui-icon-check { background-position: -64px -144px; } 607 | .ui-icon-bullet { background-position: -80px -144px; } 608 | .ui-icon-radio-on { background-position: -96px -144px; } 609 | .ui-icon-radio-off { background-position: -112px -144px; } 610 | .ui-icon-pin-w { background-position: -128px -144px; } 611 | .ui-icon-pin-s { background-position: -144px -144px; } 612 | .ui-icon-play { background-position: 0 -160px; } 613 | .ui-icon-pause { background-position: -16px -160px; } 614 | .ui-icon-seek-next { background-position: -32px -160px; } 615 | .ui-icon-seek-prev { background-position: -48px -160px; } 616 | .ui-icon-seek-end { background-position: -64px -160px; } 617 | .ui-icon-seek-start { background-position: -80px -160px; } 618 | /* ui-icon-seek-first is deprecated, use ui-icon-seek-start instead */ 619 | .ui-icon-seek-first { background-position: -80px -160px; } 620 | .ui-icon-stop { background-position: -96px -160px; } 621 | .ui-icon-eject { background-position: -112px -160px; } 622 | .ui-icon-volume-off { background-position: -128px -160px; } 623 | .ui-icon-volume-on { background-position: -144px -160px; } 624 | .ui-icon-power { background-position: 0 -176px; } 625 | .ui-icon-signal-diag { background-position: -16px -176px; } 626 | .ui-icon-signal { background-position: -32px -176px; } 627 | .ui-icon-battery-0 { background-position: -48px -176px; } 628 | .ui-icon-battery-1 { background-position: -64px -176px; } 629 | .ui-icon-battery-2 { background-position: -80px -176px; } 630 | .ui-icon-battery-3 { background-position: -96px -176px; } 631 | .ui-icon-circle-plus { background-position: 0 -192px; } 632 | .ui-icon-circle-minus { background-position: -16px -192px; } 633 | .ui-icon-circle-close { background-position: -32px -192px; } 634 | .ui-icon-circle-triangle-e { background-position: -48px -192px; } 635 | .ui-icon-circle-triangle-s { background-position: -64px -192px; } 636 | .ui-icon-circle-triangle-w { background-position: -80px -192px; } 637 | .ui-icon-circle-triangle-n { background-position: -96px -192px; } 638 | .ui-icon-circle-arrow-e { background-position: -112px -192px; } 639 | .ui-icon-circle-arrow-s { background-position: -128px -192px; } 640 | .ui-icon-circle-arrow-w { background-position: -144px -192px; } 641 | .ui-icon-circle-arrow-n { background-position: -160px -192px; } 642 | .ui-icon-circle-zoomin { background-position: -176px -192px; } 643 | .ui-icon-circle-zoomout { background-position: -192px -192px; } 644 | .ui-icon-circle-check { background-position: -208px -192px; } 645 | .ui-icon-circlesmall-plus { background-position: 0 -208px; } 646 | .ui-icon-circlesmall-minus { background-position: -16px -208px; } 647 | .ui-icon-circlesmall-close { background-position: -32px -208px; } 648 | .ui-icon-squaresmall-plus { background-position: -48px -208px; } 649 | .ui-icon-squaresmall-minus { background-position: -64px -208px; } 650 | .ui-icon-squaresmall-close { background-position: -80px -208px; } 651 | .ui-icon-grip-dotted-vertical { background-position: 0 -224px; } 652 | .ui-icon-grip-dotted-horizontal { background-position: -16px -224px; } 653 | .ui-icon-grip-solid-vertical { background-position: -32px -224px; } 654 | .ui-icon-grip-solid-horizontal { background-position: -48px -224px; } 655 | .ui-icon-gripsmall-diagonal-se { background-position: -64px -224px; } 656 | .ui-icon-grip-diagonal-se { background-position: -80px -224px; } 657 | 658 | 659 | /* Misc visuals 660 | ----------------------------------*/ 661 | 662 | /* Corner radius */ 663 | .ui-corner-all, 664 | .ui-corner-top, 665 | .ui-corner-left, 666 | .ui-corner-tl { 667 | border-top-left-radius: 3px; 668 | } 669 | .ui-corner-all, 670 | .ui-corner-top, 671 | .ui-corner-right, 672 | .ui-corner-tr { 673 | border-top-right-radius: 3px; 674 | } 675 | .ui-corner-all, 676 | .ui-corner-bottom, 677 | .ui-corner-left, 678 | .ui-corner-bl { 679 | border-bottom-left-radius: 3px; 680 | } 681 | .ui-corner-all, 682 | .ui-corner-bottom, 683 | .ui-corner-right, 684 | .ui-corner-br { 685 | border-bottom-right-radius: 3px; 686 | } 687 | 688 | /* Overlays */ 689 | .ui-widget-overlay { 690 | background: #aaaaaa; 691 | opacity: .3; 692 | filter: Alpha(Opacity=30); /* support: IE8 */ 693 | } 694 | .ui-widget-shadow { 695 | -webkit-box-shadow: 0px 0px 5px #666666; 696 | box-shadow: 0px 0px 5px #666666; 697 | } 698 | 699 | #ui-datepicker-div { 700 | z-index: 5!important; 701 | } 702 | -------------------------------------------------------------------------------- /inc/plugins/formcreator.php: -------------------------------------------------------------------------------- 1 | 11 | 12 | 13 | 14 | 15 | 16 | '; 17 | 18 | return array( 19 | 'name' => 'Form Creator', 20 | 'description' => 'Plugin for creating fillable forms to be send as PM or to be created as a new thread

Although this plugin is completly free donations are greatly appreciated to keep the plugin updated. ' . 21 | $donate . '

', 22 | 'website' => 'https://community.mybb.com/mods.php?action=view&pid=975', 23 | 'author' => 'S. Lenders (burnacid)', 24 | 'authorsite' => 'http://lenders-it.nl', 25 | 'version' => '2.6.7', 26 | 'compatibility' => '18*', 27 | 'codename' => 'formcreator'); 28 | } 29 | 30 | function formcreator_get_templates(){ 31 | $templatearray = array( 32 | '' => " 33 | 34 | {\$mybb->settings['bbname']} 35 | {\$headerinclude} 36 | 37 | 38 | 39 | {\$header} 40 | 41 | {\$form} 42 | {\$boardstats} 43 | 44 |
45 | {\$footer} 46 | 47 | ", 48 | 'container' => '
49 | {$errors} 50 | 51 | 52 | 53 | 54 | {$formcontent} 55 |
{$formtitle}
56 | 57 |
', 58 | 'field' => ' 59 | {$fieldname}{$fielddescription} 60 | {$fieldoutput} 61 | ', 62 | 'field_html' => ' 63 | {$fieldoutput} 64 | ', 65 | 'field_header' => ' 66 | {$fieldoutput} 67 | ', 68 | 'field_submit' => ' 69 | {$fieldoutput} 70 | ', 71 | 'field_captcha' => ' 72 | {$fieldoutput} 73 | ', 74 | 'field_seperator' => '
75 | {$fieldoutput} 76 | 77 | ', 78 | 'thread_button' => '{$lang->post_thread}', 79 | 'thread_newreply' => '{$lang->new_reply} ', 80 | 'thread_newreply_closed' => '{$lang->thread_closed} ', 81 | 'thread_newthread' => '{$lang->post_thread} ', 82 | 'captcha' => '
83 | 88 | 89 | {$lang->image_verification} 90 |
91 | 92 | 93 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | 110 |
{$lang->verification_note}{$lang->image_verification}
{$lang->verification_subnote} 94 | 102 |
111 | ', 112 | 'nocaptcha' => '
113 | {$lang->human_verification} 114 | 115 | 116 | 117 | 118 | 119 | 120 | 121 |
{$lang->verification_note_nocaptcha}
122 |
', 123 | 'recaptcha' => ' 130 |
131 | {$lang->image_verification} 132 | 133 | 134 | 135 | 136 | 137 | 138 | 139 |
{$lang->verification_note}
140 |
', 141 | "summary_buttons"=>' 142 | 143 |
144 | 145 | 146 | 147 |
148 | 149 | '); 150 | 151 | return $templatearray; 152 | } 153 | 154 | function formcreator_activate() 155 | { 156 | global $db, $mybb; 157 | 158 | $templatearray = formcreator_get_templates(); 159 | 160 | change_admin_permission('config', 'formcreator', 1); 161 | 162 | $group = array('prefix' => $db->escape_string('formcreator'), 'title' => $db->escape_string('Form Creator')); 163 | 164 | // Update or create template group: 165 | $query = $db->simple_select('templategroups', 'prefix', "prefix='{$group['prefix']}'"); 166 | 167 | if ($db->fetch_field($query, 'prefix')) { 168 | $db->update_query('templategroups', $group, "prefix='{$group['prefix']}'"); 169 | } else { 170 | $db->insert_query('templategroups', $group); 171 | } 172 | 173 | // Query already existing templates. 174 | $query = $db->simple_select('templates', 'tid,title,template', "sid=-2 AND (title='{$group['prefix']}' OR title LIKE '{$group['prefix']}=_%' ESCAPE '=')"); 175 | 176 | $templates = $duplicates = array(); 177 | 178 | while ($row = $db->fetch_array($query)) { 179 | $title = $row['title']; 180 | $row['tid'] = (int)$row['tid']; 181 | 182 | if (isset($templates[$title])) { 183 | // PluginLibrary had a bug that caused duplicated templates. 184 | $duplicates[] = $row['tid']; 185 | $templates[$title]['template'] = false; // force update later 186 | } else { 187 | $templates[$title] = $row; 188 | } 189 | } 190 | 191 | // Delete duplicated master templates, if they exist. 192 | if ($duplicates) { 193 | $db->delete_query('templates', 'tid IN (' . implode(",", $duplicates) . ')'); 194 | } 195 | 196 | // Update or create templates. 197 | foreach ($templatearray as $name => $code) { 198 | if (strlen($name)) { 199 | $name = "formcreator_{$name}"; 200 | } else { 201 | $name = "formcreator"; 202 | } 203 | 204 | $template = array( 205 | 'title' => $db->escape_string($name), 206 | 'template' => $db->escape_string($code), 207 | 'version' => 1, 208 | 'sid' => -2, 209 | 'dateline' => TIME_NOW); 210 | 211 | // Update 212 | if (isset($templates[$name])) { 213 | if ($templates[$name]['template'] !== $code) { 214 | // Update version for custom templates if present 215 | $db->update_query('templates', array('version' => 0), "title='{$template['title']}'"); 216 | 217 | // Update master template 218 | $db->update_query('templates', $template, "tid={$templates[$name]['tid']}"); 219 | } 220 | } 221 | // Create 222 | else { 223 | $db->insert_query('templates', $template); 224 | } 225 | 226 | // Remove this template from the earlier queried list. 227 | unset($templates[$name]); 228 | } 229 | 230 | // Remove no longer used templates. 231 | foreach ($templates as $name => $row) { 232 | $db->delete_query('templates', "title='" . $db->escape_string($name) . "'"); 233 | } 234 | 235 | // Add stylesheet 236 | $tid = 1; // MyBB Master Style 237 | $name = "formcreator.datepicker.css"; 238 | $styles = file_get_contents(MYBB_ROOT . 'inc/plugins/formcreator/jquery-ui.css'); 239 | $attachedto = "form.php"; 240 | 241 | $stylesheet = array( 242 | 'name' => $name, 243 | 'tid' => $tid, 244 | 'attachedto' => $attachedto, 245 | 'stylesheet' => $styles, 246 | 'cachefile' => $name, 247 | 'lastmodified' => TIME_NOW, 248 | ); 249 | 250 | $dbstylesheet = array_map(array($db, 'escape_string'), $stylesheet); 251 | 252 | // Activate children, if present. 253 | $db->update_query('themestylesheets', array('attachedto' => $dbstylesheet['attachedto']), "name='{$dbstylesheet['name']}'"); 254 | 255 | // Update or insert parent stylesheet. 256 | $query = $db->simple_select('themestylesheets', 'sid', "tid='{$tid}' AND cachefile='{$name}'"); 257 | $sid = intval($db->fetch_field($query, 'sid')); 258 | 259 | if ($sid) { 260 | $db->update_query('themestylesheets', $dbstylesheet, "sid='$sid'"); 261 | } else { 262 | $sid = $db->insert_query('themestylesheets', $dbstylesheet); 263 | $stylesheet['sid'] = intval($sid); 264 | } 265 | 266 | require_once MYBB_ROOT . $mybb->config['admin_dir'] . '/inc/functions_themes.php'; 267 | 268 | if ($stylesheet) { 269 | cache_stylesheet($stylesheet['tid'], $stylesheet['cachefile'], $stylesheet['stylesheet']); 270 | } 271 | 272 | update_theme_stylesheet_list($tid, false, true); // includes all children 273 | 274 | } 275 | 276 | function formcreator_deactivate() 277 | { 278 | change_admin_permission('config', 'formcreator', -1); 279 | } 280 | 281 | function formcreator_install() 282 | { 283 | global $db, $mybb; 284 | 285 | if (!$db->table_exists('fc_forms')) { 286 | $db->write_query("CREATE TABLE IF NOT EXISTS `" . TABLE_PREFIX . "fc_forms` ( 287 | ".formcreator_generate_table_fields("fc_forms")." 288 | PRIMARY KEY (`formid`) 289 | ) ENGINE=MyISAM DEFAULT CHARSET=utf8; 290 | "); 291 | } 292 | 293 | if (!$db->table_exists('fc_fields')) { 294 | $db->write_query("CREATE TABLE IF NOT EXISTS `" . TABLE_PREFIX . "fc_fields` ( 295 | ".formcreator_generate_table_fields("fc_fields")." 296 | PRIMARY KEY (`fieldid`) 297 | ) ENGINE=MyISAM DEFAULT CHARSET=utf8; 298 | "); 299 | } 300 | 301 | if (!$db->table_exists('fc_formusage')) { 302 | $db->write_query("CREATE TABLE IF NOT EXISTS `" . TABLE_PREFIX . "fc_formusage` ( 303 | ".formcreator_generate_table_fields("fc_formusage")." 304 | PRIMARY KEY (`formid`,`uid`,`ref`) 305 | ) ENGINE=MyISAM DEFAULT CHARSET=utf8; 306 | "); 307 | } 308 | } 309 | 310 | function formcreator_generate_table_fields($table) 311 | { 312 | require_once MYBB_ROOT . 'inc/class_formcreator.php'; 313 | 314 | global $fields; 315 | 316 | $formcreator = new formcreator(); 317 | 318 | $fields = $formcreator->formcreator_fields; 319 | 320 | $output = ""; 321 | 322 | foreach($fields[$table] as $field){ 323 | $output .= "`".$field['Field']."` ".$field['Type']; 324 | 325 | if($field['NULL'] == 1){ 326 | $output .= " DEFAULT NULL"; 327 | }else{ 328 | $output .= " NOT NULL"; 329 | } 330 | 331 | if($field['AI'] == 1){ 332 | $output .= " AUTO_INCREMENT"; 333 | } 334 | 335 | $output .= ",\n"; 336 | } 337 | 338 | return $output; 339 | } 340 | 341 | function formcreator_check_database() 342 | { 343 | require_once MYBB_ROOT . 'inc/class_formcreator.php'; 344 | 345 | global $db; 346 | 347 | $formcreator = new formcreator(); 348 | $fields = $formcreator->formcreator_fields; 349 | 350 | #check if MySQL instead of MariaDB. If so Temp Skip this check untill time to develop a real fix 351 | if(!preg_match("/.*MariaDB.*/",$db->read_link->server_info)){ 352 | return array(true); 353 | } 354 | 355 | $errors = 0; 356 | 357 | if($db->table_exists('fc_fields') && $db->table_exists('fc_forms') && $db->table_exists('fc_formusage')){ 358 | $query = $db->query("SHOW COLUMNS FROM ".TABLE_PREFIX."fc_forms"); 359 | 360 | while($row = $db->fetch_array($query)){ 361 | $cols_db[$row['Field']] = $row; 362 | } 363 | 364 | foreach($fields['fc_forms'] as $field){ 365 | if($cols_db[$field['Field']]['Type'] != $field['Type']){ 366 | echo $field['Field'] ."-". $cols_db[$field['Field']]['Type'] ."
"; 367 | $error++; 368 | } 369 | } 370 | 371 | $query = $db->query("SHOW COLUMNS FROM ".TABLE_PREFIX."fc_fields"); 372 | $cols_db = array(); 373 | 374 | while($row = $db->fetch_array($query)){ 375 | $cols_db[$row['Field']] = $row; 376 | } 377 | 378 | foreach($fields['fc_fields'] as $field){ 379 | if($cols_db[$field['Field']]['Type'] != $field['Type']){ 380 | echo $field['Field'] ."-". $field['Type'] ."
"; 381 | $error++; 382 | } 383 | } 384 | 385 | $query = $db->query("SHOW COLUMNS FROM ".TABLE_PREFIX."fc_formusage"); 386 | 387 | while($row = $db->fetch_array($query)){ 388 | $cols_db[$row['Field']] = $row; 389 | } 390 | 391 | foreach($fields['fc_formusage'] as $field){ 392 | if($cols_db[$field['Field']]['Type'] != $field['Type']){ 393 | echo $field['Field'] ."-". $field['Type'] ."
"; 394 | $error++; 395 | } 396 | } 397 | 398 | if($error == 0){ 399 | return array(true); 400 | }else{ 401 | return array(false,"The table structures have changed. It is adviced to create an export of your forms and reinstall the plugin!"); 402 | } 403 | 404 | 405 | }else{ 406 | return array(false,"The database structure doesn't contain the needed tables. Please repair the plugin by reinstalling"); 407 | } 408 | } 409 | 410 | function formcreator_is_installed() 411 | { 412 | global $db; 413 | 414 | // If the table exists then it means the plugin is installed because we only drop it on uninstallation 415 | return $db->table_exists('fc_fields') && $db->table_exists('fc_forms'); 416 | } 417 | 418 | 419 | function formcreator_uninstall() 420 | { 421 | global $db, $mybb; 422 | 423 | if ($mybb->request_method != 'post') { 424 | global $page; 425 | 426 | $page->output_confirm_action('index.php?module=config-plugins&action=deactivate&uninstall=1&plugin=formcreator', 427 | "Are you sure you want to uninstall Form Creator? This will delete all existing forms!", "Uninstall Form Creator"); 428 | } 429 | 430 | // This is required so it updates the settings.php file as well and not only the database - they must be synchronized! 431 | rebuild_settings(); 432 | 433 | // Drop tables if desired 434 | if (!isset($mybb->input['no'])) { 435 | $db->drop_table('fc_forms'); 436 | $db->drop_table('fc_fields'); 437 | $db->drop_table('fc_formusage'); 438 | 439 | // Delete template groups. 440 | $db->delete_query('templategroups', "prefix='formcreator'"); 441 | 442 | // Delete templates belonging to template groups. 443 | $db->delete_query('templates', "title='formcreator' OR title LIKE 'formcreator_%'"); 444 | } 445 | } 446 | 447 | $plugins->add_hook('admin_load', 'formcreator_admin_load'); 448 | function formcreator_admin_load() 449 | { 450 | global $page,$lang,$templatearray; 451 | 452 | $lang->load('config_formcreator'); 453 | 454 | require_once MYBB_ROOT . 'inc/class_formcreator.php'; 455 | 456 | $formcreator = new formcreator(); 457 | 458 | $error = formcreator_check_database($formcreator); 459 | 460 | if($error[0] == false){ 461 | $page->extra_messages[] = array("type" => "error", "message" => "Form Creator: ". $error[1]); 462 | } 463 | 464 | $missing = check_missing_templates(); 465 | if($missing != 0){ 466 | $page->extra_messages[] = array("type" => "error", "message" => "Form Creator: ". $lang->fc_error_missing_template); 467 | } 468 | } 469 | 470 | $plugins->add_hook('admin_config_menu', 'formcreator_admin_config_menu'); 471 | function formcreator_admin_config_menu(&$sub_menu) 472 | { 473 | $sub_menu[] = array( 474 | 'id' => 'formcreator', 475 | 'title' => 'Form Creator', 476 | 'link' => 'index.php?module=config-formcreator'); 477 | } 478 | 479 | $plugins->add_hook('admin_config_permissions', 'formcreator_admin_config_permissions'); 480 | function formcreator_admin_config_permissions(&$admin_permissions) 481 | { 482 | $admin_permissions['formcreator'] = "Form Creator: Can edit forms?"; 483 | } 484 | 485 | $plugins->add_hook('admin_config_action_handler', 'formcreator_admin_config_action_handler'); 486 | function formcreator_admin_config_action_handler(&$actions) 487 | { 488 | $actions['formcreator'] = array( 489 | 'active' => 'formcreator', 490 | 'file' => 'formcreator.php', 491 | ); 492 | } 493 | 494 | $plugins->add_hook('admin_tools_get_admin_log_action', 'formcreator_admin_tools_get_admin_log_action'); 495 | function formcreator_admin_tools_get_admin_log_action() 496 | { 497 | global $lang; 498 | 499 | $lang->load('config_formcreator'); 500 | } 501 | 502 | $plugins->add_hook("build_friendly_wol_location_end", "formcreator_location_end"); 503 | function formcreator_location_end(&$plugin_array) 504 | { 505 | require_once MYBB_ROOT . 'inc/class_formcreator.php'; 506 | 507 | 508 | if (preg_match("/form\.php/", $plugin_array['user_activity']['location'])) { 509 | $url = explode("?", $plugin_array['user_activity']['location']); 510 | $get_data = explode("&", $url[1]); 511 | $get_array = array(); 512 | foreach ($get_data as $var) { 513 | $keyvalue = explode("=", $var); 514 | $get_array[$keyvalue[0]] = $keyvalue[1]; 515 | } 516 | 517 | $formcreator = new formcreator(); 518 | 519 | if ($formcreator->get_form($get_array['formid'])) { 520 | $plugin_array['user_activity']['activity'] = "Form"; 521 | $plugin_array['location_name'] = "Form: " . $formcreator->name . ""; 522 | } 523 | } 524 | } 525 | 526 | $plugins->add_hook("forumdisplay_get_threads", "formcreator_forumdisplay_get_threads"); 527 | function formcreator_forumdisplay_get_threads() 528 | { 529 | global $foruminfo, $fpermissions, $mybb, $db, $newthread, $lang, $templates; 530 | 531 | $query = $db->simple_select("fc_forms", "*", "fid=" . $foruminfo['fid'] . " AND overridebutton=1"); 532 | if ($db->num_rows($query) == 1) { 533 | 534 | $form = $db->fetch_array($query); 535 | $formid = $form['formid']; 536 | 537 | if ($foruminfo['type'] == "f" && $foruminfo['open'] != 0 && $fpermissions['canpostthreads'] != 0 && $mybb->user['suspendposting'] == 0) { 538 | eval("\$newthread = \"" . $templates->get("formcreator_thread_button") . "\";"); 539 | } 540 | } 541 | } 542 | 543 | $plugins->add_hook("showthread_threaded", "formcreator_showthread_buttons"); 544 | $plugins->add_hook("showthread_linear", "formcreator_showthread_buttons"); 545 | function formcreator_showthread_buttons() 546 | { 547 | global $forum, $thread, $forumpermissions, $mybb, $db, $newthread, $newreply, $lang, $templates; 548 | 549 | $query = $db->simple_select("fc_forms", "*", "tid=" . $thread['tid'] . " AND overridebutton=1"); 550 | if ($db->num_rows($query) == 1) { 551 | 552 | $form = $db->fetch_array($query); 553 | $formid = $form['formid']; 554 | 555 | if ($forum['open'] != 0 && $forum['type'] == "f") { 556 | if ($forumpermissions['canpostthreads'] != 0 && $mybb->user['suspendposting'] != 1) { 557 | eval("\$newthread = \"" . $templates->get("formcreator_thread_newthread") . "\";"); 558 | } 559 | 560 | // Show the appropriate reply button if this thread is open or closed 561 | if ($forumpermissions['canpostreplys'] != 0 && $mybb->user['suspendposting'] != 1 && ($thread['closed'] != 1 || is_moderator($forum['fid'], 562 | "canpostclosedthreads")) && ($thread['uid'] == $mybb->user['uid'] || $forumpermissions['canonlyreplyownthreads'] != 1)) { 563 | eval("\$newreply = \"" . $templates->get("formcreator_thread_newreply") . "\";"); 564 | } elseif ($thread['closed'] == 1) { 565 | eval("\$newreply = \"" . $templates->get("formcreator_thread_newreply_closed") . "\";"); 566 | } 567 | } 568 | } 569 | } 570 | 571 | $plugins->add_hook("showthread_end", "formcreator_showthread_end"); 572 | function formcreator_showthread_end() 573 | { 574 | global $thread, $forumpermissions, $db, $quickreply; 575 | 576 | $query = $db->simple_select("fc_forms", "*", "tid=" . $thread['tid'] . " AND overridebutton=1"); 577 | if ($db->num_rows($query) == 1) { 578 | 579 | $form = $db->fetch_array($query); 580 | $formid = $form['formid']; 581 | 582 | //Remove quick reply if override is enabled 583 | $quickreply = ""; 584 | } 585 | } 586 | 587 | function get_usergroup($gid) 588 | { 589 | global $db; 590 | 591 | $query = $db->simple_select("usergroups", "*", "gid = " . intval($gid)); 592 | 593 | if ($db->num_rows($query) == 1) { 594 | return $db->fetch_array($query); 595 | } else { 596 | return false; 597 | } 598 | } 599 | 600 | /* 601 | * @param $gid int|array 602 | * @return array|bool 603 | * @description Returns an array of uid's that are in the usergroup(s) specified by $gid 604 | * Called by form.php when sending PM's to a group 605 | */ 606 | function get_usergroup_users_uid($gid) 607 | { 608 | global $db; 609 | 610 | if (is_array($gid)) { 611 | $additionwhere = ""; 612 | foreach ($gid as $groupid) { 613 | $additionwhere .= " OR CONCAT(',',additionalgroups,',') LIKE '%," . intval($groupid) . ",%'"; 614 | } 615 | 616 | $query = $db->simple_select("users", "uid", "usergroup IN (" . implode(",", $gid) . ")" . $additionwhere); 617 | } else { 618 | $query = $db->simple_select("users", "uid", "usergroup IN (" . intval($gid) . ") OR CONCAT(',',additionalgroups,',') LIKE '%," . intval($gid) . ",%'"); 619 | } 620 | 621 | if ($db->num_rows($query)) { 622 | $rownum = 0; 623 | while ($user = $db->fetch_array($query)) { 624 | $userarray[$rownum] = $user['uid']; 625 | $rownum++; 626 | } 627 | return $userarray; 628 | } else { 629 | return false; 630 | } 631 | } 632 | 633 | function reArrayFiles(&$file_post, $current = 0) { 634 | 635 | $file_ary = array(); 636 | $file_count = count($file_post['name']); 637 | $file_keys = array_keys($file_post); 638 | 639 | for ($i=0; $i<$file_count; $i++) { 640 | foreach ($file_keys as $key) { 641 | $file_ary[$i + $current][$key] = $file_post[$key][$i]; 642 | } 643 | } 644 | 645 | return $file_ary; 646 | } 647 | 648 | function check_missing_templates(){ 649 | 650 | global $db; 651 | 652 | $templatearray = formcreator_get_templates(); 653 | 654 | $group = array('prefix' => $db->escape_string('formcreator'), 'title' => $db->escape_string('Form Creator')); 655 | 656 | // Query already existing templates. 657 | $query = $db->simple_select('templates', 'tid,title,template', "sid=-2 AND (title='{$group['prefix']}' OR title LIKE '{$group['prefix']}=_%' ESCAPE '=')"); 658 | 659 | $templates = $duplicates = array(); 660 | 661 | while ($row = $db->fetch_array($query)) { 662 | $existingtemplates[] = $row['title']; 663 | } 664 | 665 | $missing = 0; 666 | $templatetitles = array_keys($templatearray); 667 | foreach($templatetitles as $key){ 668 | if(!(in_array($group['prefix']."_".$key,$existingtemplates) || (empty($key) && in_array($group['prefix'],$existingtemplates)))){ 669 | $missing++; 670 | } 671 | } 672 | 673 | return $missing; 674 | } 675 | 676 | ?> -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | GNU GENERAL PUBLIC LICENSE 2 | Version 3, 29 June 2007 3 | 4 | Copyright (C) 2007 Free Software Foundation, Inc. 5 | Everyone is permitted to copy and distribute verbatim copies 6 | of this license document, but changing it is not allowed. 7 | 8 | Preamble 9 | 10 | The GNU General Public License is a free, copyleft license for 11 | software and other kinds of works. 12 | 13 | The licenses for most software and other practical works are designed 14 | to take away your freedom to share and change the works. By contrast, 15 | the GNU General Public License is intended to guarantee your freedom to 16 | share and change all versions of a program--to make sure it remains free 17 | software for all its users. We, the Free Software Foundation, use the 18 | GNU General Public License for most of our software; it applies also to 19 | any other work released this way by its authors. You can apply it to 20 | your programs, too. 21 | 22 | When we speak of free software, we are referring to freedom, not 23 | price. Our General Public Licenses are designed to make sure that you 24 | have the freedom to distribute copies of free software (and charge for 25 | them if you wish), that you receive source code or can get it if you 26 | want it, that you can change the software or use pieces of it in new 27 | free programs, and that you know you can do these things. 28 | 29 | To protect your rights, we need to prevent others from denying you 30 | these rights or asking you to surrender the rights. Therefore, you have 31 | certain responsibilities if you distribute copies of the software, or if 32 | you modify it: responsibilities to respect the freedom of others. 33 | 34 | For example, if you distribute copies of such a program, whether 35 | gratis or for a fee, you must pass on to the recipients the same 36 | freedoms that you received. You must make sure that they, too, receive 37 | or can get the source code. And you must show them these terms so they 38 | know their rights. 39 | 40 | Developers that use the GNU GPL protect your rights with two steps: 41 | (1) assert copyright on the software, and (2) offer you this License 42 | giving you legal permission to copy, distribute and/or modify it. 43 | 44 | For the developers' and authors' protection, the GPL clearly explains 45 | that there is no warranty for this free software. For both users' and 46 | authors' sake, the GPL requires that modified versions be marked as 47 | changed, so that their problems will not be attributed erroneously to 48 | authors of previous versions. 49 | 50 | Some devices are designed to deny users access to install or run 51 | modified versions of the software inside them, although the manufacturer 52 | can do so. This is fundamentally incompatible with the aim of 53 | protecting users' freedom to change the software. The systematic 54 | pattern of such abuse occurs in the area of products for individuals to 55 | use, which is precisely where it is most unacceptable. Therefore, we 56 | have designed this version of the GPL to prohibit the practice for those 57 | products. If such problems arise substantially in other domains, we 58 | stand ready to extend this provision to those domains in future versions 59 | of the GPL, as needed to protect the freedom of users. 60 | 61 | Finally, every program is threatened constantly by software patents. 62 | States should not allow patents to restrict development and use of 63 | software on general-purpose computers, but in those that do, we wish to 64 | avoid the special danger that patents applied to a free program could 65 | make it effectively proprietary. To prevent this, the GPL assures that 66 | patents cannot be used to render the program non-free. 67 | 68 | The precise terms and conditions for copying, distribution and 69 | modification follow. 70 | 71 | TERMS AND CONDITIONS 72 | 73 | 0. Definitions. 74 | 75 | "This License" refers to version 3 of the GNU General Public License. 76 | 77 | "Copyright" also means copyright-like laws that apply to other kinds of 78 | works, such as semiconductor masks. 79 | 80 | "The Program" refers to any copyrightable work licensed under this 81 | License. Each licensee is addressed as "you". "Licensees" and 82 | "recipients" may be individuals or organizations. 83 | 84 | To "modify" a work means to copy from or adapt all or part of the work 85 | in a fashion requiring copyright permission, other than the making of an 86 | exact copy. The resulting work is called a "modified version" of the 87 | earlier work or a work "based on" the earlier work. 88 | 89 | A "covered work" means either the unmodified Program or a work based 90 | on the Program. 91 | 92 | To "propagate" a work means to do anything with it that, without 93 | permission, would make you directly or secondarily liable for 94 | infringement under applicable copyright law, except executing it on a 95 | computer or modifying a private copy. Propagation includes copying, 96 | distribution (with or without modification), making available to the 97 | public, and in some countries other activities as well. 98 | 99 | To "convey" a work means any kind of propagation that enables other 100 | parties to make or receive copies. Mere interaction with a user through 101 | a computer network, with no transfer of a copy, is not conveying. 102 | 103 | An interactive user interface displays "Appropriate Legal Notices" 104 | to the extent that it includes a convenient and prominently visible 105 | feature that (1) displays an appropriate copyright notice, and (2) 106 | tells the user that there is no warranty for the work (except to the 107 | extent that warranties are provided), that licensees may convey the 108 | work under this License, and how to view a copy of this License. If 109 | the interface presents a list of user commands or options, such as a 110 | menu, a prominent item in the list meets this criterion. 111 | 112 | 1. Source Code. 113 | 114 | The "source code" for a work means the preferred form of the work 115 | for making modifications to it. "Object code" means any non-source 116 | form of a work. 117 | 118 | A "Standard Interface" means an interface that either is an official 119 | standard defined by a recognized standards body, or, in the case of 120 | interfaces specified for a particular programming language, one that 121 | is widely used among developers working in that language. 122 | 123 | The "System Libraries" of an executable work include anything, other 124 | than the work as a whole, that (a) is included in the normal form of 125 | packaging a Major Component, but which is not part of that Major 126 | Component, and (b) serves only to enable use of the work with that 127 | Major Component, or to implement a Standard Interface for which an 128 | implementation is available to the public in source code form. A 129 | "Major Component", in this context, means a major essential component 130 | (kernel, window system, and so on) of the specific operating system 131 | (if any) on which the executable work runs, or a compiler used to 132 | produce the work, or an object code interpreter used to run it. 133 | 134 | The "Corresponding Source" for a work in object code form means all 135 | the source code needed to generate, install, and (for an executable 136 | work) run the object code and to modify the work, including scripts to 137 | control those activities. However, it does not include the work's 138 | System Libraries, or general-purpose tools or generally available free 139 | programs which are used unmodified in performing those activities but 140 | which are not part of the work. For example, Corresponding Source 141 | includes interface definition files associated with source files for 142 | the work, and the source code for shared libraries and dynamically 143 | linked subprograms that the work is specifically designed to require, 144 | such as by intimate data communication or control flow between those 145 | subprograms and other parts of the work. 146 | 147 | The Corresponding Source need not include anything that users 148 | can regenerate automatically from other parts of the Corresponding 149 | Source. 150 | 151 | The Corresponding Source for a work in source code form is that 152 | same work. 153 | 154 | 2. Basic Permissions. 155 | 156 | All rights granted under this License are granted for the term of 157 | copyright on the Program, and are irrevocable provided the stated 158 | conditions are met. This License explicitly affirms your unlimited 159 | permission to run the unmodified Program. The output from running a 160 | covered work is covered by this License only if the output, given its 161 | content, constitutes a covered work. This License acknowledges your 162 | rights of fair use or other equivalent, as provided by copyright law. 163 | 164 | You may make, run and propagate covered works that you do not 165 | convey, without conditions so long as your license otherwise remains 166 | in force. You may convey covered works to others for the sole purpose 167 | of having them make modifications exclusively for you, or provide you 168 | with facilities for running those works, provided that you comply with 169 | the terms of this License in conveying all material for which you do 170 | not control copyright. Those thus making or running the covered works 171 | for you must do so exclusively on your behalf, under your direction 172 | and control, on terms that prohibit them from making any copies of 173 | your copyrighted material outside their relationship with you. 174 | 175 | Conveying under any other circumstances is permitted solely under 176 | the conditions stated below. Sublicensing is not allowed; section 10 177 | makes it unnecessary. 178 | 179 | 3. Protecting Users' Legal Rights From Anti-Circumvention Law. 180 | 181 | No covered work shall be deemed part of an effective technological 182 | measure under any applicable law fulfilling obligations under article 183 | 11 of the WIPO copyright treaty adopted on 20 December 1996, or 184 | similar laws prohibiting or restricting circumvention of such 185 | measures. 186 | 187 | When you convey a covered work, you waive any legal power to forbid 188 | circumvention of technological measures to the extent such circumvention 189 | is effected by exercising rights under this License with respect to 190 | the covered work, and you disclaim any intention to limit operation or 191 | modification of the work as a means of enforcing, against the work's 192 | users, your or third parties' legal rights to forbid circumvention of 193 | technological measures. 194 | 195 | 4. Conveying Verbatim Copies. 196 | 197 | You may convey verbatim copies of the Program's source code as you 198 | receive it, in any medium, provided that you conspicuously and 199 | appropriately publish on each copy an appropriate copyright notice; 200 | keep intact all notices stating that this License and any 201 | non-permissive terms added in accord with section 7 apply to the code; 202 | keep intact all notices of the absence of any warranty; and give all 203 | recipients a copy of this License along with the Program. 204 | 205 | You may charge any price or no price for each copy that you convey, 206 | and you may offer support or warranty protection for a fee. 207 | 208 | 5. Conveying Modified Source Versions. 209 | 210 | You may convey a work based on the Program, or the modifications to 211 | produce it from the Program, in the form of source code under the 212 | terms of section 4, provided that you also meet all of these conditions: 213 | 214 | a) The work must carry prominent notices stating that you modified 215 | it, and giving a relevant date. 216 | 217 | b) The work must carry prominent notices stating that it is 218 | released under this License and any conditions added under section 219 | 7. This requirement modifies the requirement in section 4 to 220 | "keep intact all notices". 221 | 222 | c) You must license the entire work, as a whole, under this 223 | License to anyone who comes into possession of a copy. This 224 | License will therefore apply, along with any applicable section 7 225 | additional terms, to the whole of the work, and all its parts, 226 | regardless of how they are packaged. This License gives no 227 | permission to license the work in any other way, but it does not 228 | invalidate such permission if you have separately received it. 229 | 230 | d) If the work has interactive user interfaces, each must display 231 | Appropriate Legal Notices; however, if the Program has interactive 232 | interfaces that do not display Appropriate Legal Notices, your 233 | work need not make them do so. 234 | 235 | A compilation of a covered work with other separate and independent 236 | works, which are not by their nature extensions of the covered work, 237 | and which are not combined with it such as to form a larger program, 238 | in or on a volume of a storage or distribution medium, is called an 239 | "aggregate" if the compilation and its resulting copyright are not 240 | used to limit the access or legal rights of the compilation's users 241 | beyond what the individual works permit. Inclusion of a covered work 242 | in an aggregate does not cause this License to apply to the other 243 | parts of the aggregate. 244 | 245 | 6. Conveying Non-Source Forms. 246 | 247 | You may convey a covered work in object code form under the terms 248 | of sections 4 and 5, provided that you also convey the 249 | machine-readable Corresponding Source under the terms of this License, 250 | in one of these ways: 251 | 252 | a) Convey the object code in, or embodied in, a physical product 253 | (including a physical distribution medium), accompanied by the 254 | Corresponding Source fixed on a durable physical medium 255 | customarily used for software interchange. 256 | 257 | b) Convey the object code in, or embodied in, a physical product 258 | (including a physical distribution medium), accompanied by a 259 | written offer, valid for at least three years and valid for as 260 | long as you offer spare parts or customer support for that product 261 | model, to give anyone who possesses the object code either (1) a 262 | copy of the Corresponding Source for all the software in the 263 | product that is covered by this License, on a durable physical 264 | medium customarily used for software interchange, for a price no 265 | more than your reasonable cost of physically performing this 266 | conveying of source, or (2) access to copy the 267 | Corresponding Source from a network server at no charge. 268 | 269 | c) Convey individual copies of the object code with a copy of the 270 | written offer to provide the Corresponding Source. This 271 | alternative is allowed only occasionally and noncommercially, and 272 | only if you received the object code with such an offer, in accord 273 | with subsection 6b. 274 | 275 | d) Convey the object code by offering access from a designated 276 | place (gratis or for a charge), and offer equivalent access to the 277 | Corresponding Source in the same way through the same place at no 278 | further charge. You need not require recipients to copy the 279 | Corresponding Source along with the object code. If the place to 280 | copy the object code is a network server, the Corresponding Source 281 | may be on a different server (operated by you or a third party) 282 | that supports equivalent copying facilities, provided you maintain 283 | clear directions next to the object code saying where to find the 284 | Corresponding Source. Regardless of what server hosts the 285 | Corresponding Source, you remain obligated to ensure that it is 286 | available for as long as needed to satisfy these requirements. 287 | 288 | e) Convey the object code using peer-to-peer transmission, provided 289 | you inform other peers where the object code and Corresponding 290 | Source of the work are being offered to the general public at no 291 | charge under subsection 6d. 292 | 293 | A separable portion of the object code, whose source code is excluded 294 | from the Corresponding Source as a System Library, need not be 295 | included in conveying the object code work. 296 | 297 | A "User Product" is either (1) a "consumer product", which means any 298 | tangible personal property which is normally used for personal, family, 299 | or household purposes, or (2) anything designed or sold for incorporation 300 | into a dwelling. In determining whether a product is a consumer product, 301 | doubtful cases shall be resolved in favor of coverage. For a particular 302 | product received by a particular user, "normally used" refers to a 303 | typical or common use of that class of product, regardless of the status 304 | of the particular user or of the way in which the particular user 305 | actually uses, or expects or is expected to use, the product. A product 306 | is a consumer product regardless of whether the product has substantial 307 | commercial, industrial or non-consumer uses, unless such uses represent 308 | the only significant mode of use of the product. 309 | 310 | "Installation Information" for a User Product means any methods, 311 | procedures, authorization keys, or other information required to install 312 | and execute modified versions of a covered work in that User Product from 313 | a modified version of its Corresponding Source. The information must 314 | suffice to ensure that the continued functioning of the modified object 315 | code is in no case prevented or interfered with solely because 316 | modification has been made. 317 | 318 | If you convey an object code work under this section in, or with, or 319 | specifically for use in, a User Product, and the conveying occurs as 320 | part of a transaction in which the right of possession and use of the 321 | User Product is transferred to the recipient in perpetuity or for a 322 | fixed term (regardless of how the transaction is characterized), the 323 | Corresponding Source conveyed under this section must be accompanied 324 | by the Installation Information. But this requirement does not apply 325 | if neither you nor any third party retains the ability to install 326 | modified object code on the User Product (for example, the work has 327 | been installed in ROM). 328 | 329 | The requirement to provide Installation Information does not include a 330 | requirement to continue to provide support service, warranty, or updates 331 | for a work that has been modified or installed by the recipient, or for 332 | the User Product in which it has been modified or installed. Access to a 333 | network may be denied when the modification itself materially and 334 | adversely affects the operation of the network or violates the rules and 335 | protocols for communication across the network. 336 | 337 | Corresponding Source conveyed, and Installation Information provided, 338 | in accord with this section must be in a format that is publicly 339 | documented (and with an implementation available to the public in 340 | source code form), and must require no special password or key for 341 | unpacking, reading or copying. 342 | 343 | 7. Additional Terms. 344 | 345 | "Additional permissions" are terms that supplement the terms of this 346 | License by making exceptions from one or more of its conditions. 347 | Additional permissions that are applicable to the entire Program shall 348 | be treated as though they were included in this License, to the extent 349 | that they are valid under applicable law. If additional permissions 350 | apply only to part of the Program, that part may be used separately 351 | under those permissions, but the entire Program remains governed by 352 | this License without regard to the additional permissions. 353 | 354 | When you convey a copy of a covered work, you may at your option 355 | remove any additional permissions from that copy, or from any part of 356 | it. (Additional permissions may be written to require their own 357 | removal in certain cases when you modify the work.) You may place 358 | additional permissions on material, added by you to a covered work, 359 | for which you have or can give appropriate copyright permission. 360 | 361 | Notwithstanding any other provision of this License, for material you 362 | add to a covered work, you may (if authorized by the copyright holders of 363 | that material) supplement the terms of this License with terms: 364 | 365 | a) Disclaiming warranty or limiting liability differently from the 366 | terms of sections 15 and 16 of this License; or 367 | 368 | b) Requiring preservation of specified reasonable legal notices or 369 | author attributions in that material or in the Appropriate Legal 370 | Notices displayed by works containing it; or 371 | 372 | c) Prohibiting misrepresentation of the origin of that material, or 373 | requiring that modified versions of such material be marked in 374 | reasonable ways as different from the original version; or 375 | 376 | d) Limiting the use for publicity purposes of names of licensors or 377 | authors of the material; or 378 | 379 | e) Declining to grant rights under trademark law for use of some 380 | trade names, trademarks, or service marks; or 381 | 382 | f) Requiring indemnification of licensors and authors of that 383 | material by anyone who conveys the material (or modified versions of 384 | it) with contractual assumptions of liability to the recipient, for 385 | any liability that these contractual assumptions directly impose on 386 | those licensors and authors. 387 | 388 | All other non-permissive additional terms are considered "further 389 | restrictions" within the meaning of section 10. If the Program as you 390 | received it, or any part of it, contains a notice stating that it is 391 | governed by this License along with a term that is a further 392 | restriction, you may remove that term. If a license document contains 393 | a further restriction but permits relicensing or conveying under this 394 | License, you may add to a covered work material governed by the terms 395 | of that license document, provided that the further restriction does 396 | not survive such relicensing or conveying. 397 | 398 | If you add terms to a covered work in accord with this section, you 399 | must place, in the relevant source files, a statement of the 400 | additional terms that apply to those files, or a notice indicating 401 | where to find the applicable terms. 402 | 403 | Additional terms, permissive or non-permissive, may be stated in the 404 | form of a separately written license, or stated as exceptions; 405 | the above requirements apply either way. 406 | 407 | 8. Termination. 408 | 409 | You may not propagate or modify a covered work except as expressly 410 | provided under this License. Any attempt otherwise to propagate or 411 | modify it is void, and will automatically terminate your rights under 412 | this License (including any patent licenses granted under the third 413 | paragraph of section 11). 414 | 415 | However, if you cease all violation of this License, then your 416 | license from a particular copyright holder is reinstated (a) 417 | provisionally, unless and until the copyright holder explicitly and 418 | finally terminates your license, and (b) permanently, if the copyright 419 | holder fails to notify you of the violation by some reasonable means 420 | prior to 60 days after the cessation. 421 | 422 | Moreover, your license from a particular copyright holder is 423 | reinstated permanently if the copyright holder notifies you of the 424 | violation by some reasonable means, this is the first time you have 425 | received notice of violation of this License (for any work) from that 426 | copyright holder, and you cure the violation prior to 30 days after 427 | your receipt of the notice. 428 | 429 | Termination of your rights under this section does not terminate the 430 | licenses of parties who have received copies or rights from you under 431 | this License. If your rights have been terminated and not permanently 432 | reinstated, you do not qualify to receive new licenses for the same 433 | material under section 10. 434 | 435 | 9. Acceptance Not Required for Having Copies. 436 | 437 | You are not required to accept this License in order to receive or 438 | run a copy of the Program. Ancillary propagation of a covered work 439 | occurring solely as a consequence of using peer-to-peer transmission 440 | to receive a copy likewise does not require acceptance. However, 441 | nothing other than this License grants you permission to propagate or 442 | modify any covered work. These actions infringe copyright if you do 443 | not accept this License. Therefore, by modifying or propagating a 444 | covered work, you indicate your acceptance of this License to do so. 445 | 446 | 10. Automatic Licensing of Downstream Recipients. 447 | 448 | Each time you convey a covered work, the recipient automatically 449 | receives a license from the original licensors, to run, modify and 450 | propagate that work, subject to this License. You are not responsible 451 | for enforcing compliance by third parties with this License. 452 | 453 | An "entity transaction" is a transaction transferring control of an 454 | organization, or substantially all assets of one, or subdividing an 455 | organization, or merging organizations. If propagation of a covered 456 | work results from an entity transaction, each party to that 457 | transaction who receives a copy of the work also receives whatever 458 | licenses to the work the party's predecessor in interest had or could 459 | give under the previous paragraph, plus a right to possession of the 460 | Corresponding Source of the work from the predecessor in interest, if 461 | the predecessor has it or can get it with reasonable efforts. 462 | 463 | You may not impose any further restrictions on the exercise of the 464 | rights granted or affirmed under this License. For example, you may 465 | not impose a license fee, royalty, or other charge for exercise of 466 | rights granted under this License, and you may not initiate litigation 467 | (including a cross-claim or counterclaim in a lawsuit) alleging that 468 | any patent claim is infringed by making, using, selling, offering for 469 | sale, or importing the Program or any portion of it. 470 | 471 | 11. Patents. 472 | 473 | A "contributor" is a copyright holder who authorizes use under this 474 | License of the Program or a work on which the Program is based. The 475 | work thus licensed is called the contributor's "contributor version". 476 | 477 | A contributor's "essential patent claims" are all patent claims 478 | owned or controlled by the contributor, whether already acquired or 479 | hereafter acquired, that would be infringed by some manner, permitted 480 | by this License, of making, using, or selling its contributor version, 481 | but do not include claims that would be infringed only as a 482 | consequence of further modification of the contributor version. For 483 | purposes of this definition, "control" includes the right to grant 484 | patent sublicenses in a manner consistent with the requirements of 485 | this License. 486 | 487 | Each contributor grants you a non-exclusive, worldwide, royalty-free 488 | patent license under the contributor's essential patent claims, to 489 | make, use, sell, offer for sale, import and otherwise run, modify and 490 | propagate the contents of its contributor version. 491 | 492 | In the following three paragraphs, a "patent license" is any express 493 | agreement or commitment, however denominated, not to enforce a patent 494 | (such as an express permission to practice a patent or covenant not to 495 | sue for patent infringement). To "grant" such a patent license to a 496 | party means to make such an agreement or commitment not to enforce a 497 | patent against the party. 498 | 499 | If you convey a covered work, knowingly relying on a patent license, 500 | and the Corresponding Source of the work is not available for anyone 501 | to copy, free of charge and under the terms of this License, through a 502 | publicly available network server or other readily accessible means, 503 | then you must either (1) cause the Corresponding Source to be so 504 | available, or (2) arrange to deprive yourself of the benefit of the 505 | patent license for this particular work, or (3) arrange, in a manner 506 | consistent with the requirements of this License, to extend the patent 507 | license to downstream recipients. "Knowingly relying" means you have 508 | actual knowledge that, but for the patent license, your conveying the 509 | covered work in a country, or your recipient's use of the covered work 510 | in a country, would infringe one or more identifiable patents in that 511 | country that you have reason to believe are valid. 512 | 513 | If, pursuant to or in connection with a single transaction or 514 | arrangement, you convey, or propagate by procuring conveyance of, a 515 | covered work, and grant a patent license to some of the parties 516 | receiving the covered work authorizing them to use, propagate, modify 517 | or convey a specific copy of the covered work, then the patent license 518 | you grant is automatically extended to all recipients of the covered 519 | work and works based on it. 520 | 521 | A patent license is "discriminatory" if it does not include within 522 | the scope of its coverage, prohibits the exercise of, or is 523 | conditioned on the non-exercise of one or more of the rights that are 524 | specifically granted under this License. You may not convey a covered 525 | work if you are a party to an arrangement with a third party that is 526 | in the business of distributing software, under which you make payment 527 | to the third party based on the extent of your activity of conveying 528 | the work, and under which the third party grants, to any of the 529 | parties who would receive the covered work from you, a discriminatory 530 | patent license (a) in connection with copies of the covered work 531 | conveyed by you (or copies made from those copies), or (b) primarily 532 | for and in connection with specific products or compilations that 533 | contain the covered work, unless you entered into that arrangement, 534 | or that patent license was granted, prior to 28 March 2007. 535 | 536 | Nothing in this License shall be construed as excluding or limiting 537 | any implied license or other defenses to infringement that may 538 | otherwise be available to you under applicable patent law. 539 | 540 | 12. No Surrender of Others' Freedom. 541 | 542 | If conditions are imposed on you (whether by court order, agreement or 543 | otherwise) that contradict the conditions of this License, they do not 544 | excuse you from the conditions of this License. If you cannot convey a 545 | covered work so as to satisfy simultaneously your obligations under this 546 | License and any other pertinent obligations, then as a consequence you may 547 | not convey it at all. For example, if you agree to terms that obligate you 548 | to collect a royalty for further conveying from those to whom you convey 549 | the Program, the only way you could satisfy both those terms and this 550 | License would be to refrain entirely from conveying the Program. 551 | 552 | 13. Use with the GNU Affero General Public License. 553 | 554 | Notwithstanding any other provision of this License, you have 555 | permission to link or combine any covered work with a work licensed 556 | under version 3 of the GNU Affero General Public License into a single 557 | combined work, and to convey the resulting work. The terms of this 558 | License will continue to apply to the part which is the covered work, 559 | but the special requirements of the GNU Affero General Public License, 560 | section 13, concerning interaction through a network will apply to the 561 | combination as such. 562 | 563 | 14. Revised Versions of this License. 564 | 565 | The Free Software Foundation may publish revised and/or new versions of 566 | the GNU General Public License from time to time. Such new versions will 567 | be similar in spirit to the present version, but may differ in detail to 568 | address new problems or concerns. 569 | 570 | Each version is given a distinguishing version number. If the 571 | Program specifies that a certain numbered version of the GNU General 572 | Public License "or any later version" applies to it, you have the 573 | option of following the terms and conditions either of that numbered 574 | version or of any later version published by the Free Software 575 | Foundation. If the Program does not specify a version number of the 576 | GNU General Public License, you may choose any version ever published 577 | by the Free Software Foundation. 578 | 579 | If the Program specifies that a proxy can decide which future 580 | versions of the GNU General Public License can be used, that proxy's 581 | public statement of acceptance of a version permanently authorizes you 582 | to choose that version for the Program. 583 | 584 | Later license versions may give you additional or different 585 | permissions. However, no additional obligations are imposed on any 586 | author or copyright holder as a result of your choosing to follow a 587 | later version. 588 | 589 | 15. Disclaimer of Warranty. 590 | 591 | THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY 592 | APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT 593 | HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY 594 | OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, 595 | THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 596 | PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM 597 | IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF 598 | ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 599 | 600 | 16. Limitation of Liability. 601 | 602 | IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING 603 | WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS 604 | THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY 605 | GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE 606 | USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF 607 | DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD 608 | PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), 609 | EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF 610 | SUCH DAMAGES. 611 | 612 | 17. Interpretation of Sections 15 and 16. 613 | 614 | If the disclaimer of warranty and limitation of liability provided 615 | above cannot be given local legal effect according to their terms, 616 | reviewing courts shall apply local law that most closely approximates 617 | an absolute waiver of all civil liability in connection with the 618 | Program, unless a warranty or assumption of liability accompanies a 619 | copy of the Program in return for a fee. 620 | 621 | END OF TERMS AND CONDITIONS 622 | 623 | How to Apply These Terms to Your New Programs 624 | 625 | If you develop a new program, and you want it to be of the greatest 626 | possible use to the public, the best way to achieve this is to make it 627 | free software which everyone can redistribute and change under these terms. 628 | 629 | To do so, attach the following notices to the program. It is safest 630 | to attach them to the start of each source file to most effectively 631 | state the exclusion of warranty; and each file should have at least 632 | the "copyright" line and a pointer to where the full notice is found. 633 | 634 | {one line to give the program's name and a brief idea of what it does.} 635 | Copyright (C) {year} {name of author} 636 | 637 | This program is free software: you can redistribute it and/or modify 638 | it under the terms of the GNU General Public License as published by 639 | the Free Software Foundation, either version 3 of the License, or 640 | (at your option) any later version. 641 | 642 | This program is distributed in the hope that it will be useful, 643 | but WITHOUT ANY WARRANTY; without even the implied warranty of 644 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 645 | GNU General Public License for more details. 646 | 647 | You should have received a copy of the GNU General Public License 648 | along with this program. If not, see . 649 | 650 | Also add information on how to contact you by electronic and paper mail. 651 | 652 | If the program does terminal interaction, make it output a short 653 | notice like this when it starts in an interactive mode: 654 | 655 | {project} Copyright (C) {year} {fullname} 656 | This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. 657 | This is free software, and you are welcome to redistribute it 658 | under certain conditions; type `show c' for details. 659 | 660 | The hypothetical commands `show w' and `show c' should show the appropriate 661 | parts of the General Public License. Of course, your program's commands 662 | might be different; for a GUI interface, you would use an "about box". 663 | 664 | You should also get your employer (if you work as a programmer) or school, 665 | if any, to sign a "copyright disclaimer" for the program, if necessary. 666 | For more information on this, and how to apply and follow the GNU GPL, see 667 | . 668 | 669 | The GNU General Public License does not permit incorporating your program 670 | into proprietary programs. If your program is a subroutine library, you 671 | may consider it more useful to permit linking proprietary applications with 672 | the library. If this is what you want to do, use the GNU Lesser General 673 | Public License instead of this License. But first, please read 674 | . 675 | -------------------------------------------------------------------------------- /inc/class_formcreator.php: -------------------------------------------------------------------------------- 1 | array( 37 | array( 38 | "Field" => "formid", 39 | "Type" => "int(11)", 40 | "NULL" => 0, 41 | "AI" => 1), 42 | array( 43 | "Field" => "name", 44 | "Type" => "varchar(255)", 45 | "NULL" => 0), 46 | array( 47 | "Field" => "active", 48 | "Type" => "tinyint(1)", 49 | "NULL" => 0), 50 | array( 51 | "Field" => "fid", 52 | "Type" => "int(11)", 53 | "NULL" => 0), 54 | array( 55 | "Field" => "tid", 56 | "Type" => "int(11)", 57 | "NULL" => 0), 58 | array( 59 | "Field" => "overridebutton", 60 | "Type" => "tinyint(1)", 61 | "NULL" => 0), 62 | array( 63 | "Field" => "class", 64 | "Type" => "varchar(255)", 65 | "NULL" => 1), 66 | array( 67 | "Field" => "subjecttemplate", 68 | "Type" => "varchar(255)", 69 | "NULL" => 1), 70 | array( 71 | "Field" => "messagetemplate", 72 | "Type" => "text", 73 | "NULL" => 1), 74 | array("Field" => "settings", "Type" => "text")), 75 | "fc_fields" => array( 76 | array( 77 | "Field" => "fieldid", 78 | "Type" => "int(11)", 79 | "NULL" => 0, 80 | "AI" => 1), 81 | array( 82 | "Field" => "formid", 83 | "Type" => "int(11)", 84 | "NULL" => 0), 85 | array( 86 | "Field" => "name", 87 | "Type" => "varchar(255)", 88 | "NULL" => 0), 89 | array( 90 | "Field" => "description", 91 | "Type" => "varchar(2000)", 92 | "NULL" => 1), 93 | array( 94 | "Field" => "type", 95 | "Type" => "int(11)", 96 | "NULL" => 0), 97 | array( 98 | "Field" => "default", 99 | "Type" => "varchar(2000)", 100 | "NULL" => 1), 101 | array( 102 | "Field" => "required", 103 | "Type" => "tinyint(1)", 104 | "NULL" => 1), 105 | array( 106 | "Field" => "order", 107 | "Type" => "int(11)", 108 | "NULL" => 1), 109 | array( 110 | "Field" => "class", 111 | "Type" => "varchar(50)", 112 | "NULL" => 1), 113 | array("Field" => "settings", "Type" => "text")), 114 | 115 | "fc_formusage" => array( 116 | array( 117 | "Field" => "formid", 118 | "Type" => "int(11)", 119 | "NULL" => 0), 120 | array( 121 | "Field" => "uid", 122 | "Type" => "int(11)", 123 | "NULL" => 0), 124 | array( 125 | "Field" => "ref", 126 | "Type" => "int(11)", 127 | "NULL" => 0), 128 | array( 129 | "Field" => "datetime", 130 | "Type" => "timestamp", 131 | "NULL" => 0))); 132 | 133 | public $types = array( 134 | 1 => "Textbox (single line)", 135 | 2 => "Textarea (multi line)", 136 | 3 => "Select (single)", 137 | 4 => "Select (multiple)", 138 | 5 => "Radio Buttons", 139 | 6 => "Checkboxes", 140 | 7 => "Date", 141 | 16 => "Prefix Selection", 142 | 143 | 13 => "Attachment", 144 | 14 => "Multiple Attachments", 145 | 15 => "MyBB Editor", 146 | 147 | 8 => "Seperator", 148 | 9 => "Header", 149 | 10 => "HTML block", 150 | 151 | 12 => "Captcha", 152 | 153 | 11 => "Submit button"); 154 | public function get_form($formid) 155 | { 156 | global $db; 157 | $query = $db->simple_select("fc_forms", "*", "formid = " . intval($formid)); 158 | if ($db->num_rows($query) == 1) { 159 | $formdata = $db->fetch_array($query); 160 | $formdata['allowedgid'] = explode(",", $formdata['allowedgid']); 161 | $formdata['pmgroups'] = explode(",", $formdata['pmgroups']); 162 | $this->load_data($formdata); 163 | return $formdata; 164 | } else { 165 | return false; 166 | } 167 | } 168 | 169 | public function field_in_table($table, $fieldname) 170 | { 171 | $tabledata = $this->formcreator_fields[$table]; 172 | 173 | foreach ($tabledata as $field) { 174 | if ($field['Field'] == $fieldname) { 175 | return true; 176 | } 177 | } 178 | 179 | return false; 180 | } 181 | 182 | public function build_summary() 183 | { 184 | global $templates, $stylelabelwidth; 185 | $output = ""; 186 | 187 | if($this->settings['summaryparsed']){ 188 | $parser = new postParser; 189 | 190 | $parser_options = array( 191 | 'allow_html' => 'no', 192 | 'allow_mycode' => 'yes', 193 | 'allow_smilies' => 'yes', 194 | 'allow_imgcode' => 'yes', 195 | 'filter_badwords' => 'yes', 196 | 'nl2br' => 1); 197 | 198 | $output = $parser->parse_message($this->parse_output(), $parser_options);; 199 | }else{ 200 | foreach ($this->fields as $field) { 201 | $fieldname = $field->name; 202 | $fieldoutput = ""; 203 | if ($field->required) { 204 | $fieldname .= "*"; 205 | } 206 | 207 | if ($field->description) { 208 | $fielddescription = "
" . $field->description . ""; 209 | } else { 210 | $fielddescription = ""; 211 | } 212 | 213 | if(is_array($field->default)){ 214 | $fieldoutput = implode(", ", $field->default); 215 | }else{ 216 | $fieldoutput = $field->default; 217 | } 218 | 219 | 220 | if(!in_array($field->type,array(8,9,10,11,12,13,14))){ 221 | eval('$output .= "' . $templates->get("formcreator_field") . '";'); 222 | } 223 | 224 | } 225 | } 226 | 227 | return $output; 228 | } 229 | 230 | public function build_form() 231 | { 232 | global $templates, $stylelabelwidth; 233 | $output = ""; 234 | foreach ($this->fields as $field) { 235 | $fieldname = $field->name; 236 | $fieldoutput = ""; 237 | if ($field->required) { 238 | $fieldname .= "*"; 239 | } 240 | 241 | if ($field->description) { 242 | $fielddescription = "
" . $field->description . ""; 243 | } else { 244 | $fielddescription = ""; 245 | } 246 | 247 | switch ($field->type) { 248 | case 1: 249 | $fieldoutput = $field->output_textbox(); 250 | eval('$output .= "' . $templates->get("formcreator_field") . '";'); 251 | break; 252 | case 2: 253 | $fieldoutput = $field->output_textarea(); 254 | eval('$output .= "' . $templates->get("formcreator_field") . '";'); 255 | break; 256 | case 3: 257 | $fieldoutput = $field->output_select(); 258 | eval('$output .= "' . $templates->get("formcreator_field") . '";'); 259 | break; 260 | case 4: 261 | $fieldoutput = $field->output_select(true); 262 | eval('$output .= "' . $templates->get("formcreator_field") . '";'); 263 | break; 264 | case 5: 265 | $fieldoutput = $field->output_radio(); 266 | eval('$output .= "' . $templates->get("formcreator_field") . '";'); 267 | break; 268 | case 6: 269 | $fieldoutput = $field->output_checkbox(); 270 | eval('$output .= "' . $templates->get("formcreator_field") . '";'); 271 | break; 272 | case 7: 273 | $fieldoutput = $field->output_dateselect(); 274 | eval('$output .= "' . $templates->get("formcreator_field") . '";'); 275 | break; 276 | case 8: 277 | if ($this->settings['width']) { 278 | $stylewidth = "width:" . $this->settings['width'] . ";"; 279 | } 280 | 281 | if ($this->class) { 282 | $styleclass = $this->class; 283 | } 284 | 285 | eval('$output .= "' . $templates->get("formcreator_field_seperator") . '";'); 286 | break; 287 | case 9: 288 | $fieldoutput = $field->output_header(); 289 | eval('$output .= "' . $templates->get("formcreator_field_header") . '";'); 290 | break; 291 | case 10: 292 | $fieldoutput = $field->settings['html']; 293 | eval('$output .= "' . $templates->get("formcreator_field_html") . '";'); 294 | break; 295 | case 11: 296 | $fieldoutput = $field->output_submit(); 297 | eval('$output .= "' . $templates->get("formcreator_field_submit") . '";'); 298 | break; 299 | case 12: 300 | $fieldoutput = $field->output_captcha(); 301 | eval('$output .= "' . $templates->get("formcreator_field_captcha") . '";'); 302 | break; 303 | case 13: 304 | $fieldoutput = $field->output_attachment(); 305 | eval('$output .= "' . $templates->get("formcreator_field") . '";'); 306 | break; 307 | case 14: 308 | $fieldoutput = $field->output_attachments(); 309 | eval('$output .= "' . $templates->get("formcreator_field") . '";'); 310 | break; 311 | case 15: 312 | $fieldoutput = $field->output_editor(); 313 | eval('$output .= "' . $templates->get("formcreator_field") . '";'); 314 | break; 315 | case 16: 316 | $fieldoutput = $field->output_prefix(); 317 | eval('$output .= "' . $templates->get("formcreator_field") . '";'); 318 | break; 319 | } 320 | } 321 | 322 | return $output; 323 | } 324 | 325 | public function check_allowed() 326 | { 327 | global $mybb; 328 | if ($this->settings['allowedgidtype'] == -1) { 329 | return true; 330 | } 331 | 332 | if (!empty($mybb->user['additionalgroups'])) { 333 | $current_groups = $mybb->user['additionalgroups'] . "," . $mybb->user['usergroup']; 334 | } else { 335 | $current_groups = $mybb->user['usergroup']; 336 | } 337 | 338 | $current_groups = explode(",", $current_groups); 339 | if (array_intersect($this->settings['allowedgid'], $current_groups)) { 340 | if ($this->settings['allowedgidtype'] == 0) { 341 | return true; 342 | } else { 343 | return false; 344 | } 345 | } else { 346 | if ($this->settings['allowedgidtype'] == 0) { 347 | return false; 348 | } else { 349 | return true; 350 | } 351 | } 352 | } 353 | 354 | public function check_summary() 355 | { 356 | global $mybb; 357 | 358 | if($this->settings['showsummary'] == 1){ 359 | if(empty($mybb->input['formdata']['data']) or empty($mybb->input['formdata']['checksum'])){ 360 | return 2; 361 | }else{ 362 | if (hash("SHA256",$mybb->input['formdata']['data']) == $mybb->input['formdata']['checksum']){ 363 | return 1; 364 | }else{ 365 | return 0; 366 | } 367 | } 368 | }else{ 369 | return 1; 370 | } 371 | 372 | if(!empty($mybb->input['formdata']['data']) && !empty($mybb->input['formdata']['checksum'])){ 373 | 374 | }elseif($this->settings['showsummary'] == 0){ 375 | return 1; 376 | }else{ 377 | return 2; 378 | } 379 | } 380 | 381 | public function get_type_name($type) 382 | { 383 | if (key_exists(intval($type), $this->types)) { 384 | return $this->types[intval($type)]; 385 | } else { 386 | return false; 387 | } 388 | } 389 | 390 | public function insert_form() 391 | { 392 | global $db; 393 | if ($this->settings['allowedgid'] && is_array($this->settings['allowedgid'])) { 394 | $this->settings['allowedgid'] = implode(",", $this->settings['allowedgid']); 395 | } 396 | 397 | if ($this->settings['pmgroups'] && is_array($this->settings['pmgroups'])) { 398 | $this->settings['pmgroups'] = implode(",", $this->settings['pmgroups']); 399 | } 400 | 401 | $this->escape_data(); 402 | $result = $db->insert_query("fc_forms", $this->get_data()); 403 | if ($result) { 404 | $this->formid = $result; 405 | return $result; 406 | } else { 407 | return false; 408 | } 409 | } 410 | 411 | public function update_template() 412 | { 413 | global $db; 414 | 415 | if (!is_array($this->settings)) { 416 | $this->settings = json_decode($this->settings); 417 | } 418 | 419 | if ($this->settings['allowedgid'] && is_array($this->settings['allowedgid'])) { 420 | $this->settings['allowedgid'] = implode(",", $this->settings['allowedgid']); 421 | } 422 | 423 | if ($this->settings['pmgroups'] && is_array($this->settings['pmgroups'])) { 424 | $this->settings['pmgroups'] = implode(",", $this->settings['pmgroups']); 425 | } 426 | 427 | $this->escape_data(); 428 | if (empty($this->subjecttemplate)) { 429 | $this->subjecttemplate = ""; 430 | } 431 | 432 | if (empty($this->messagetemplate)) { 433 | $this->messagetemplate = ""; 434 | } 435 | 436 | $template_data = array("subjecttemplate" => $this->subjecttemplate, 437 | "messagetemplate" => $this->messagetemplate); 438 | $result = $db->update_query("fc_forms", $template_data, "formid = " . $this-> 439 | formid); 440 | return $result; 441 | } 442 | 443 | public function update_form() 444 | { 445 | global $db; 446 | if ($this->settings['allowedgid']) { 447 | $this->settings['allowedgid'] = implode(",", $this->settings['allowedgid']); 448 | } 449 | 450 | if ($this->settings['pmgroups']) { 451 | $this->settings['pmgroups'] = implode(",", $this->settings['pmgroups']); 452 | } 453 | 454 | $this->escape_data(); 455 | $result = $db->update_query("fc_forms", $this->get_data(), "formid = " . $this-> 456 | formid); 457 | return $result; 458 | } 459 | 460 | public function delete_form() 461 | { 462 | global $db; 463 | if ($db->delete_query("fc_fields", "formid = " . $this->formid)) { 464 | if ($db->delete_query("fc_forms", "formid = " . $this->formid)) { 465 | $db->delete_query("fc_formusage", "formid = " . $this->formid); 466 | return true; 467 | } else { 468 | return false; 469 | } 470 | } else { 471 | return false; 472 | } 473 | 474 | } 475 | 476 | public function escape_data() 477 | { 478 | global $db; 479 | $this->formid = intval($this->formid); 480 | $this->name = $db->escape_string($this->name); 481 | $this->active = intval($this->active); 482 | $this->fid = intval($this->fid); 483 | $this->tid = intval($this->tid); 484 | $this->overridebutton = intval($this->overridebutton); 485 | $this->class = $db->escape_string($this->class); 486 | $this->subjecttemplate = $db->escape_string($this->subjecttemplate); 487 | $this->messagetemplate = $db->escape_string($this->messagetemplate); 488 | $this->settings = $db->escape_string(json_encode($this->settings)); 489 | } 490 | 491 | public function load_data($data) 492 | { 493 | $this->formid = $data['formid']; 494 | $this->name = $data['name']; 495 | $this->active = $data['active']; 496 | $this->tid = $data['tid']; 497 | $this->fid = $data['fid']; 498 | $this->overridebutton = $data['overridebutton']; 499 | $this->class = $data['class']; 500 | $this->subjecttemplate = $data['subjecttemplate']; 501 | $this->messagetemplate = $data['messagetemplate']; 502 | 503 | if (!is_array($data['settings'])) { 504 | $this->settings = json_decode($data['settings'], true); 505 | } else { 506 | $this->settings = $data['settings']; 507 | } 508 | 509 | if (!is_array($this->settings['allowedgid'])) { 510 | $this->settings['allowedgid'] = explode(',', $this->settings['allowedgid']); 511 | } 512 | 513 | if (!is_array($this->settings['pmgroups'])) { 514 | $this->settings['pmgroups'] = explode(',', $this->settings['pmgroups']); 515 | } 516 | } 517 | 518 | public function get_data() 519 | { 520 | if ($this->formid) { 521 | $data['formid'] = $this->formid; 522 | } 523 | 524 | $data['name'] = $this->name; 525 | $data['active'] = $this->active; 526 | $data['fid'] = $this->fid; 527 | $data['tid'] = $this->tid; 528 | $data['overridebutton'] = $this->overridebutton; 529 | $data['class'] = $this->class; 530 | $data['settings'] = $this->settings; 531 | return $data; 532 | } 533 | 534 | public function get_fields() 535 | { 536 | global $db; 537 | $query = $db->simple_select("fc_fields", "*", "formid = " . intval($this-> 538 | formid), array("order_by" => "`order`")); 539 | 540 | $this->fields = array(); 541 | 542 | while ($field_data = $db->fetch_array($query)) { 543 | $field = new formcreator_field(); 544 | $field->load_data($field_data); 545 | $this->fields[] = $field; 546 | } 547 | 548 | if (count($this->fields) != 0) { 549 | return $this->fields; 550 | } else { 551 | return false; 552 | } 553 | } 554 | 555 | public function clear_error() 556 | { 557 | $this->error = ""; 558 | } 559 | 560 | public function is_error() 561 | { 562 | if (empty($this->error)) { 563 | return false; 564 | } else { 565 | return $this->error; 566 | } 567 | } 568 | 569 | public function add_error($string) 570 | { 571 | if ($this->error == "") { 572 | $this->error = $string; 573 | } else { 574 | $this->error .= "
" . $string; 575 | } 576 | } 577 | 578 | public function order_field($fieldid, $order) 579 | { 580 | global $db; 581 | return $db->update_query("fc_fields", array("order" => intval($order)), 582 | "fieldid = " . intval($fieldid) . " and formid = " . $this->formid); 583 | } 584 | 585 | public function get_field_names() 586 | { 587 | $result = array(); 588 | foreach ($this->fields as $field) { 589 | $result[$field->fieldid] = $field->name; 590 | } 591 | 592 | return $result; 593 | } 594 | 595 | public function get_field_values() 596 | { 597 | global $mybb; 598 | $result = array(); 599 | foreach ($this->fields as $field) { 600 | $value = $mybb->input['field_' . $field->fieldid]; 601 | if (is_array($value)) { 602 | $value = implode(",", $value); 603 | } 604 | 605 | if (empty($value)) { 606 | $value = "Unknown"; 607 | } 608 | 609 | $result[$field->fieldid] = $value; 610 | } 611 | 612 | return $result; 613 | } 614 | 615 | public function parse_subject() 616 | { 617 | global $templates, $mybb, $ref; 618 | if (empty($this->subjecttemplate)) { 619 | $output = "Form submission: " . $this->name; 620 | } else { 621 | $this->subjecttemplate = str_replace('"', '\"', $this->subjecttemplate); 622 | $username = $mybb->user['username']; 623 | $uid = $mybb->user['uid']; 624 | $formname = $this->name; 625 | $fieldname = $this->get_field_names(); 626 | $fieldvalue = $this->get_field_values(); 627 | eval("\$output = \"" . $this->subjecttemplate . "\";"); 628 | } 629 | 630 | return substr($output, 0, 120); 631 | } 632 | 633 | public function parse_output() 634 | { 635 | global $db, $mybb, $ref; 636 | $output = ""; 637 | if (empty($this->messagetemplate)) { 638 | foreach ($this->fields as $field) { 639 | if (in_array($field->type, array( 640 | 1, 641 | 2, 642 | 5, 643 | 7, 644 | 15))) { 645 | $output .= "[b]" . $field->name . "[/b]: " . $mybb->input["field_" . $field-> 646 | fieldid] . "\n[hr]"; 647 | } elseif (in_array($field->type, array( 648 | 4, 649 | 6, 650 | 3))) { 651 | $output .= "[b]" . $field->name . "[/b]: " . implode(",", $mybb->input["field_" . 652 | $field->fieldid]) . "\n[hr]"; 653 | } 654 | } 655 | } else { 656 | $user = $mybb->user; 657 | unset($user['password']); 658 | unset($user['salt']); 659 | unset($user['loginkey']); 660 | 661 | $username = $mybb->user['username']; 662 | $uid = $mybb->user['uid']; 663 | $fieldname = $this->get_field_names(); 664 | $fieldvalue = $this->get_field_values(); 665 | $this->messagetemplate = str_replace('"', '\"', $this->messagetemplate); 666 | eval("\$output = \"" . $this->messagetemplate . "\";"); 667 | } 668 | 669 | return $output; 670 | } 671 | 672 | public function get_next_ref() 673 | { 674 | global $db; 675 | 676 | $query = $db->simple_select("fc_formusage", "*", "formid = '" . $this->formid . 677 | "'", array( 678 | "order_by" => "ref", 679 | "order_dir" => "DESC", 680 | "LIMIT" => 1)); 681 | if ($db->num_rows($query) != 0) { 682 | $lastrow = $db->fetch_array($query); 683 | } else { 684 | $lastrow = 0; 685 | } 686 | 687 | return $lastrow['ref'] + 1; 688 | } 689 | 690 | public function log_usage() 691 | { 692 | global $db, $mybb; 693 | 694 | $data = array( 695 | "formid" => $this->formid, 696 | "uid" => $mybb->user['uid'], 697 | "ref" => $this->get_next_ref()); 698 | 699 | $db->insert_query("fc_formusage", $data); 700 | } 701 | 702 | public function check_usage_limit_reached() 703 | { 704 | global $db, $mybb; 705 | 706 | if ($this->settings['limitusage'] == 0) { 707 | return false; 708 | } 709 | 710 | $query = $db->simple_select("fc_formusage", "*", "formid = '" . $this->formid . 711 | "' AND uid = '" . $mybb->user['uid'] . "'"); 712 | $timesused = $db->num_rows($query); 713 | 714 | if ($timesused >= $this->settings['limitusage']) { 715 | return true; 716 | } else { 717 | return false; 718 | } 719 | } 720 | } 721 | 722 | class formcreator_field 723 | { 724 | public $fieldid; 725 | public $formid; 726 | public $name; 727 | public $description; 728 | public $placeholder; 729 | public $maxlength; 730 | public $type; 731 | public $options; 732 | public $default; 733 | public $required; 734 | public $regex; 735 | public $regexerror; 736 | public $order; 737 | public $size; 738 | public $cols; 739 | public $rows; 740 | public $class; 741 | public $format; 742 | public $settings; 743 | 744 | public function escape_data() 745 | { 746 | global $db; 747 | $this->fieldid = intval($this->fieldid); 748 | $this->formid = intval($this->formid); 749 | $this->name = $db->escape_string($this->name); 750 | $this->description = $db->escape_string($this->description); 751 | $this->type = intval($this->type); 752 | $this->default = $db->escape_string($this->default); 753 | $this->required = intval($this->required); 754 | $this->order = intval($this->order); 755 | $this->class = $db->escape_string($this->class); 756 | $this->settings = $db->escape_string(json_encode($this->settings)); 757 | } 758 | 759 | public function load_data($data) 760 | { 761 | $this->fieldid = $data['fieldid']; 762 | $this->formid = $data['formid']; 763 | $this->name = $data['name']; 764 | $this->description = $data['description']; 765 | $this->type = $data['type']; 766 | $this->default = $data['default']; 767 | $this->required = $data['required']; 768 | $this->order = $data['order']; 769 | $this->class = $data['class']; 770 | 771 | if (!is_array($data['settings'])) { 772 | $this->settings = json_decode($data['settings'], true); 773 | } else { 774 | $this->settings = $data['settings']; 775 | } 776 | } 777 | 778 | public function get_data() 779 | { 780 | if ($this->fieldid) { 781 | $data['fieldid'] = $this->fieldid; 782 | } 783 | 784 | $data['formid'] = $this->formid; 785 | $data['name'] = $this->name; 786 | $data['description'] = $this->description; 787 | $data['type'] = $this->type; 788 | $data['default'] = $this->default; 789 | $data['required'] = $this->required; 790 | $data['order'] = $this->order; 791 | $data['class'] = $this->class; 792 | $data['settings'] = $this->settings; 793 | return $data; 794 | } 795 | 796 | public function show_admin_field($name) 797 | { 798 | if ($this->type) { 799 | if ($this->type == 1) { 800 | $show = array( 801 | "name", 802 | "description", 803 | "placeholder", 804 | "maxlength", 805 | "default", 806 | "required", 807 | "regex", 808 | "size", 809 | "class"); 810 | } elseif ($this->type == 2) { 811 | $show = array( 812 | "name", 813 | "description", 814 | "placeholder", 815 | "maxlength", 816 | "default", 817 | "required", 818 | "regex", 819 | "cols", 820 | "rows", 821 | "resize", 822 | "class"); 823 | } elseif ($this->type == 3) { 824 | $show = array( 825 | "name", 826 | "description", 827 | "options", 828 | "required", 829 | "class"); 830 | } elseif ($this->type == 4) { 831 | $show = array( 832 | "name", 833 | "description", 834 | "options", 835 | "required", 836 | "class", 837 | "size"); 838 | } elseif ($this->type == 5) { 839 | $show = array( 840 | "name", 841 | "description", 842 | "options", 843 | "required", 844 | "class"); 845 | } elseif ($this->type == 6) { 846 | $show = array( 847 | "name", 848 | "description", 849 | "options", 850 | "required", 851 | "class"); 852 | } elseif ($this->type == 7) { 853 | $show = array( 854 | "name", 855 | "description", 856 | "format", 857 | "default", 858 | "required", 859 | "class"); 860 | } elseif ($this->type == 8) { 861 | $show = array("name"); 862 | } elseif ($this->type == 9) { 863 | $show = array("name", "description"); 864 | } elseif ($this->type == 10) { 865 | $show = array( 866 | "name", 867 | "html", 868 | "class"); 869 | } elseif ($this->type == 11) { 870 | $show = array("name", "class"); 871 | } elseif ($this->type == 12) { 872 | $show = array("name"); 873 | } elseif ($this->type == 13) { 874 | $show = array( 875 | "name", 876 | "description", 877 | "required", 878 | "class"); 879 | } elseif ($this->type == 14) { 880 | $show = array( 881 | "name", 882 | "description", 883 | "required", 884 | "class"); 885 | } elseif ($this->type == 15) { 886 | $show = array( 887 | "name", 888 | "description", 889 | "required", 890 | "rows"); 891 | } elseif ($this->type == 16) { 892 | $show = array( 893 | "name", 894 | "description", 895 | "selector", 896 | "required", 897 | "class"); 898 | } else { 899 | $show = array(); 900 | } 901 | 902 | return in_array($name, $show); 903 | } else { 904 | return false; 905 | } 906 | } 907 | 908 | public function clear_error() 909 | { 910 | $this->error = ""; 911 | } 912 | 913 | public function is_error() 914 | { 915 | if (empty($this->error)) { 916 | return false; 917 | } else { 918 | return $this->error; 919 | } 920 | } 921 | 922 | public function add_error($string) 923 | { 924 | if ($this->error == "") { 925 | $this->error = $string; 926 | } else { 927 | $this->error .= "
" . $string; 928 | } 929 | } 930 | 931 | public function insert_field() 932 | { 933 | global $db; 934 | $this->escape_data(); 935 | $query = $db->simple_select("fc_fields", "`order`", "formid = " . $this->formid, 936 | array("order_by" => "`order`", "order_dir" => "DESC")); 937 | if ($db->num_rows($query) == 0) { 938 | $this->order = 0; 939 | } else { 940 | $lastfield = $db->fetch_array($query); 941 | $this->order = $lastfield['order'] + 1; 942 | } 943 | 944 | $result = $db->insert_query("fc_fields", $this->get_data()); 945 | if ($result) { 946 | $this->fieldid = $result; 947 | return $result; 948 | } else { 949 | return false; 950 | } 951 | } 952 | 953 | public function update_field() 954 | { 955 | global $db; 956 | $this->escape_data(); 957 | $old = new formcreator_field(); 958 | $old_data = $old->get_field($this->fieldid); 959 | $this->order = $old_data['order']; 960 | $result = $db->update_query("fc_fields", $this->get_data(), "fieldid = " . $this-> 961 | fieldid); 962 | return $result; 963 | } 964 | 965 | public function delete_field() 966 | { 967 | global $db; 968 | if ($db->delete_query("fc_fields", "fieldid = " . $this->fieldid)) { 969 | return true; 970 | } else { 971 | return false; 972 | } 973 | 974 | } 975 | 976 | public function get_field($fieldid) 977 | { 978 | global $db; 979 | $query = $db->simple_select("fc_fields", "*", "fieldid = " . intval($fieldid)); 980 | if ($db->num_rows($query) == 1) { 981 | $fielddata = $db->fetch_array($query); 982 | $this->load_data($fielddata); 983 | return $fielddata; 984 | } else { 985 | return false; 986 | } 987 | } 988 | 989 | public function output_textbox() 990 | { 991 | if ($this->settings['size']) { 992 | $size = "size='" . $this->settings['size'] . "'"; 993 | } 994 | 995 | if ($this->settings['placeholder']) { 996 | $placeholder = "placeholder ='" . $this->settings['placeholder'] . "'"; 997 | } 998 | 999 | if ($this->settings['maxlength'] != 0) { 1000 | $maxlength = "maxlength ='" . $this->settings['maxlength'] . "'"; 1001 | } 1002 | 1003 | return ""; 1006 | } 1007 | 1008 | public function output_textarea() 1009 | { 1010 | if ($this->class) { 1011 | $class = "class='" . $this->class . "'"; 1012 | } 1013 | 1014 | if ($this->settings['rows']) { 1015 | $rows = "rows='" . $this->settings['rows'] . "'"; 1016 | } 1017 | 1018 | if ($this->settings['cols']) { 1019 | $cols = "cols='" . $this->settings['cols'] . "'"; 1020 | } 1021 | 1022 | if ($this->settings['placeholder']) { 1023 | $placeholder = "placeholder ='" . $this->settings['placeholder'] . "'"; 1024 | } 1025 | 1026 | if ($this->settings['maxlength'] != 0) { 1027 | $maxlength = "maxlength ='" . $this->settings['maxlength'] . "'"; 1028 | } 1029 | 1030 | 1031 | if ($this->settings['resize'] == 1) { 1032 | $resize = "style='resize: both;'"; 1033 | } else { 1034 | $resize = "style='resize: none;'"; 1035 | } 1036 | 1037 | return ""; 1040 | } 1041 | 1042 | public function output_select($multi = false) 1043 | { 1044 | global $lang; 1045 | 1046 | $options = explode("\n", $this->settings['options']); 1047 | if ($this->class) { 1048 | $class = "class='" . $this->class . "'"; 1049 | } 1050 | 1051 | if ($multi) { 1052 | $multi = "multiple='multiple'"; 1053 | } 1054 | 1055 | if ($this->settings['size'] != 0) { 1056 | $size = "size='" . $this->settings['size'] . "'"; 1057 | } 1058 | 1059 | $output = ""; 1079 | return $output; 1080 | } 1081 | 1082 | public function output_prefix() 1083 | { 1084 | global $lang; 1085 | 1086 | if ($this->class) { 1087 | $class = "class='" . $this->class . "'"; 1088 | } 1089 | 1090 | if ($this->settings['size'] != 0) { 1091 | $size = "size='" . $this->settings['size'] . "'"; 1092 | } 1093 | 1094 | $output = ""; 1116 | return $output; 1117 | } 1118 | 1119 | public function output_dateselect() 1120 | { 1121 | if ($this->class) { 1122 | $class = $this->class; 1123 | } 1124 | 1125 | $output = ""; 1128 | if (empty($this->settings['format'])) { 1129 | $output .= ""; 1134 | } else { 1135 | $output .= ""; 1142 | } 1143 | 1144 | 1145 | return $output; 1146 | } 1147 | 1148 | public function output_header() 1149 | { 1150 | if ($this->description) { 1151 | return "" . $this->name . "
" . $this->description . 1152 | ""; 1153 | } else { 1154 | return "" . $this->name . ""; 1155 | } 1156 | } 1157 | 1158 | public function output_radio() 1159 | { 1160 | $options = explode("\n", $this->settings['options']); 1161 | if ($this->class) { 1162 | $class = "class='" . $this->class . "'"; 1163 | } 1164 | 1165 | $output = ""; 1166 | foreach ($options as $option) { 1167 | if ($this->default == trim($option)) { 1168 | $checked = "checked='checked'"; 1169 | } else { 1170 | $checked = ""; 1171 | } 1172 | 1173 | $output .= "
"; 1177 | } 1178 | 1179 | return $output; 1180 | } 1181 | 1182 | public function output_checkbox() 1183 | { 1184 | $options = explode("\n", $this->settings['options']); 1185 | if ($this->class) { 1186 | $class = "class='" . $this->class . "'"; 1187 | } 1188 | 1189 | $output = ""; 1190 | foreach ($options as $option) { 1191 | if (is_array($this->default)) { 1192 | if (in_array(trim($option), $this->default)) { 1193 | $checked = "checked='checked'"; 1194 | } else { 1195 | $checked = ""; 1196 | } 1197 | } 1198 | 1199 | $output .= "
"; 1203 | } 1204 | 1205 | return $output; 1206 | } 1207 | 1208 | public function output_submit() 1209 | { 1210 | if ($this->class) { 1211 | $class = "class='" . $this->class . "'"; 1212 | } 1213 | 1214 | return ""; 1215 | } 1216 | 1217 | public function output_captcha() 1218 | { 1219 | global $mybb; 1220 | if ($this->class) { 1221 | $class = "class='" . $this->class . "'"; 1222 | } 1223 | 1224 | $captcha = new captcha(); 1225 | $captcha->type = $mybb->settings['captchaimage']; 1226 | if ($captcha->type == 1) { 1227 | $captcha->captcha_template = "formcreator_captcha"; 1228 | $captcha->build_captcha(); 1229 | } elseif ($captcha->type == 2 || $captcha->type == 4) { 1230 | if ($captcha->type == 2) { 1231 | $captcha->captcha_template = "formcreator_recaptcha"; 1232 | } elseif ($captcha->type == 4) { 1233 | $captcha->captcha_template = "formcreator_nocaptcha"; 1234 | } 1235 | 1236 | $captcha->build_recaptcha(); 1237 | } else { 1238 | echo "error"; 1239 | } 1240 | 1241 | return $captcha->html; 1242 | } 1243 | 1244 | public function output_attachment() 1245 | { 1246 | return ""; 1248 | } 1249 | 1250 | public function output_attachments() 1251 | { 1252 | return ""; 1254 | } 1255 | 1256 | public function output_editor() 1257 | { 1258 | if ($this->settings['rows']) { 1259 | $rows = "rows='" . $this->settings['rows'] . "'"; 1260 | } else { 1261 | $rows = "rows='20'"; 1262 | } 1263 | 1264 | if ($this->settings['resiz'] == 1) { 1265 | $resize = "style='resize: both;'"; 1266 | } else { 1267 | $resize = "style='resize: none;'"; 1268 | } 1269 | 1270 | $code = build_mycode_inserter("field_" . $this->fieldid, true); 1271 | 1272 | return "\n" . $code; 1274 | } 1275 | } 1276 | 1277 | ?> 1278 | --------------------------------------------------------------------------------