From 30c63c7382a3c62c23063c679445451a2c736a08 Mon Sep 17 00:00:00 2001 From: labby Date: Thu, 17 Sep 2015 09:45:10 +0200 Subject: [PATCH] sourced from LEPTON package --- README.md | 24 +- add.php | 59 +++++ add_field.php | 64 +++++ backend.css | 41 ++++ delete.php | 38 +++ delete_field.php | 59 +++++ delete_submission.php | 59 +++++ frontend.css | 62 +++++ icon.png | Bin 0 -> 1239 bytes index.php | 34 +++ info.php | 43 ++++ install.php | 118 +++++++++ languages/DA.php | 40 ++++ languages/DE.php | 40 ++++ languages/EN.php | 40 ++++ languages/FR.php | 41 ++++ languages/IT.php | 40 ++++ languages/NL.php | 41 ++++ languages/NO.php | 40 ++++ languages/PL.php | 40 ++++ languages/RU.php | 40 ++++ languages/index.php | 34 +++ modify.php | 216 +++++++++++++++++ modify_field.php | 228 ++++++++++++++++++ modify_settings.php | 254 ++++++++++++++++++++ move_down.php | 59 +++++ move_up.php | 59 +++++ precheck.php | 33 +++ register_class_secure.php | 36 +++ save_field.php | 105 ++++++++ save_settings.php | 87 +++++++ search.php | 73 ++++++ uninstall.php | 41 ++++ upgrade.php | 35 +++ view.php | 491 ++++++++++++++++++++++++++++++++++++++ view_submission.php | 98 ++++++++ 36 files changed, 2810 insertions(+), 2 deletions(-) create mode 100644 add.php create mode 100644 add_field.php create mode 100644 backend.css create mode 100644 delete.php create mode 100644 delete_field.php create mode 100644 delete_submission.php create mode 100644 frontend.css create mode 100644 icon.png create mode 100644 index.php create mode 100644 info.php create mode 100644 install.php create mode 100644 languages/DA.php create mode 100644 languages/DE.php create mode 100644 languages/EN.php create mode 100644 languages/FR.php create mode 100644 languages/IT.php create mode 100644 languages/NL.php create mode 100644 languages/NO.php create mode 100644 languages/PL.php create mode 100644 languages/RU.php create mode 100644 languages/index.php create mode 100644 modify.php create mode 100644 modify_field.php create mode 100644 modify_settings.php create mode 100644 move_down.php create mode 100644 move_up.php create mode 100644 precheck.php create mode 100644 register_class_secure.php create mode 100644 save_field.php create mode 100644 save_settings.php create mode 100644 search.php create mode 100644 uninstall.php create mode 100644 upgrade.php create mode 100644 view.php create mode 100644 view_submission.php diff --git a/README.md b/README.md index ebc7450..1f1d1e2 100644 --- a/README.md +++ b/README.md @@ -1,2 +1,22 @@ -# form -LEPTON Form Module +### Form +============ + +Form creates - as the name says - forms and is a helpful addon for Content Management System [LEPTON CMS][1]
+ + +#### Requirements + +* [LEPTON CMS][1] 2.x + +#### Installation + +* download latest [form.zip] [2] installation archive +* in CMS backend select the file from "Add-ons" -> "Modules" -> "Install module" + +#### Notice +This addon reached end of life. +It is replaced with the miniform addon that grants easy and flexible handling (template engine) and will be delivered with LEPTON package. + + +[1]: http://lepton-cms.org "LEPTON CMS" +[2]: http://www.lepton-cms.com/lepador/modules/form.php diff --git a/add.php b/add.php new file mode 100644 index 0000000..98f98f3 --- /dev/null +++ b/add.php @@ -0,0 +1,59 @@ +%s ] Can't include class.secure.php!", $_SERVER['SCRIPT_NAME']), E_USER_ERROR); + } +} +// end include class.secure.php + + + +// Insert an extra rows into the database +$header = ''; +$field_loop = ''; +$footer = ' + + +
{TITLE}{REQUIRED}:{FIELD}
  + +
'; +$email_to = $admin->get_email(); +$email_from = ''; +$email_fromname = ''; +$email_subject = 'Results from form on website...'; +$success_page = 'none'; +$success_email_to = ''; +$success_email_from = $admin->get_email(); +$success_email_fromname = ''; +$success_email_text = 'Thank you for submitting your form on '.WEBSITE_TITLE; +$success_email_text = addslashes($success_email_text); +$success_email_subject = 'You have submitted a form'; +$max_submissions = 50; +$stored_submissions = 50; +$use_captcha = true; +$database->query("INSERT INTO ".TABLE_PREFIX."mod_form_settings (page_id,section_id,header,field_loop,footer,email_to,email_from,email_fromname,email_subject,success_page,success_email_to,success_email_from,success_email_fromname,success_email_text,success_email_subject,max_submissions,stored_submissions,use_captcha) VALUES ('$page_id','$section_id','$header','$field_loop','$footer','$email_to','$email_from','$email_fromname','$email_subject','$success_page','$success_email_to','$success_email_from','$success_email_fromname','$success_email_text','$success_email_subject','$max_submissions','$stored_submissions','$use_captcha')"); + +?> \ No newline at end of file diff --git a/add_field.php b/add_field.php new file mode 100644 index 0000000..95836f3 --- /dev/null +++ b/add_field.php @@ -0,0 +1,64 @@ +%s ] Can't include class.secure.php!", $_SERVER['SCRIPT_NAME']), E_USER_ERROR); + } +} +// end include class.secure.php + +global $database, $admin, $page_id, $section_id, $TEXT; + +// Include admin wrapper script +require(LEPTON_PATH.'/modules/admin.php'); + +// Include the ordering class +require(LEPTON_PATH.'/framework/class.order.php'); +// Get new order +$order = new order(TABLE_PREFIX.'mod_form_fields', 'position', 'field_id', 'section_id'); +$position = $order->get_new($section_id); + +// Insert new row into database +$database->query("INSERT INTO ".TABLE_PREFIX."mod_form_fields (`section_id` ,`page_id`, `position`, `required`, `value`, `extra`) VALUES ('$section_id', '$page_id', '$position', '0', '', '')"); + +// Get the id +$field_id = $database->get_one("SELECT LAST_INSERT_ID()"); + +// Say that a new record has been added, then redirect to modify page +if($database->is_error()) { + $admin->print_error($database->get_error(), LEPTON_URL.'/modules/form/modify_field.php?page_id='.$page_id.'§ion_id='.$section_id.'&field_id='.$field_id); +} else { + //$admin->print_success($TEXT['SUCCESS'], LEPTON_URL.'/modules/form/modify_field.php?page_id='.$page_id.'§ion_id='.$section_id.'&field_id='.$field_id); +?> + +print_footer(); + +?> \ No newline at end of file diff --git a/backend.css b/backend.css new file mode 100644 index 0000000..864b684 --- /dev/null +++ b/backend.css @@ -0,0 +1,41 @@ +/** + * @module form + * @version see info.php of this module + * @authors Ryan Djurovich, Rudolph Lartey, John Maats, Dietrich Roland Pehlke, LEPTON project + * @copyright 2004-2010 Ryan Djurovich, Rudolph Lartey, John Maats, Dietrich Roland Pehlke + * @copyright 2010-2014 LEPTON project + * @license see info.php of this module + * @license terms see info.php of this module + */ + + +.setting_name { + vertical-align: top; + width: 30%; +} +.setting_value { + vertical-align: top; + width: 70%; +} +.newsection { + border-top: 1px dashed #fff; +} + +/* + The definitions below provide the style for the edit CSS button + Required CSS class name: input.mod_moduledirectory_edit_css +*/ +input.mod_form_edit_css { + padding: 2px; + border: 1px solid #aaa; + border-radius: 4px; + background-color: #ddd; + background-image: none; + cursor: pointer; + border: 1px solid #999; + border-radius: 5px; + position: relative; + top: -39px; + width: 110px; + float: right; +} \ No newline at end of file diff --git a/delete.php b/delete.php new file mode 100644 index 0000000..d25446a --- /dev/null +++ b/delete.php @@ -0,0 +1,38 @@ +%s ] Can't include class.secure.php!", $_SERVER['SCRIPT_NAME']), E_USER_ERROR); + } +} +// end include class.secure.php + + + +// Delete page +$database->query("DELETE FROM ".TABLE_PREFIX."mod_form_fields WHERE page_id = '$page_id' AND section_id='$section_id'"); +$database->query("DELETE FROM ".TABLE_PREFIX."mod_form_settings WHERE page_id = '$page_id' AND section_id='$section_id'"); + +?> \ No newline at end of file diff --git a/delete_field.php b/delete_field.php new file mode 100644 index 0000000..303f711 --- /dev/null +++ b/delete_field.php @@ -0,0 +1,59 @@ +%s ] Can't include class.secure.php!", $_SERVER['SCRIPT_NAME']), E_USER_ERROR); + } +} +// end include class.secure.php + + + +// Get id +if(!isset($_GET['field_id']) OR !is_numeric($_GET['field_id'])) { + header("Location: ".ADMIN_URL."/pages/index.php"); + exit(0); +} else { + $field_id = $_GET['field_id']; +} + +// Include admin wrapper script +$update_when_modified = true; // Tells script to update when this page was last updated +require(LEPTON_PATH.'/modules/admin.php'); + +// Delete row +$database->query("DELETE FROM ".TABLE_PREFIX."mod_form_fields WHERE field_id = '$field_id'"); + +// Check if there is a db error, otherwise say successful +if($database->is_error()) { + $admin->print_error($database->get_error(), ADMIN_URL.'/pages/modify.php?page_id='.$page_id); +} else { + $admin->print_success($TEXT['SUCCESS'], ADMIN_URL.'/pages/modify.php?page_id='.$page_id); +} + +// Print admin footer +$admin->print_footer(); + +?> \ No newline at end of file diff --git a/delete_submission.php b/delete_submission.php new file mode 100644 index 0000000..3862bb5 --- /dev/null +++ b/delete_submission.php @@ -0,0 +1,59 @@ +%s ] Can't include class.secure.php!", $_SERVER['SCRIPT_NAME']), E_USER_ERROR); + } +} +// end include class.secure.php + + + +// Get id +if(!isset($_GET['submission_id']) OR !is_numeric($_GET['submission_id'])) { + header("Location: ".ADMIN_URL."/pages/index.php"); + exit(0); +} else { + $submission_id = $_GET['submission_id']; +} + +// Include admin wrapper script +$update_when_modified = true; // Tells script to update when this page was last updated +require(LEPTON_PATH.'/modules/admin.php'); + +// Delete row +$database->query("DELETE FROM ".TABLE_PREFIX."mod_form_submissions WHERE submission_id = '$submission_id'"); + +// Check if there is a db error, otherwise say successful +if($database->is_error()) { + $admin->print_error($database->get_error(), ADMIN_URL.'/pages/modify.php?page_id='.$page_id); +} else { + $admin->print_success($TEXT['SUCCESS'], ADMIN_URL.'/pages/modify.php?page_id='.$page_id); +} + +// Print admin footer +$admin->print_footer(); + +?> \ No newline at end of file diff --git a/frontend.css b/frontend.css new file mode 100644 index 0000000..11263b4 --- /dev/null +++ b/frontend.css @@ -0,0 +1,62 @@ +/** + * @module form + * @version see info.php of this module + * @authors Ryan Djurovich, Rudolph Lartey, John Maats, Dietrich Roland Pehlke, LEPTON project + * @copyright 2004-2010 Ryan Djurovich, Rudolph Lartey, John Maats, Dietrich Roland Pehlke + * @copyright 2010-2014 LEPTON project + * @license see info.php of this module + * @license terms see info.php of this module + */ + +.required { + color: #FF0000; +} +.field_title { + font-size: 12px; + width: 140px; + vertical-align: top; + text-align:right; +} +.textfield { + font-size: 12px; + width: 343px; +} +.textarea { + font-size: 12px; + width: 344px; +margin-left:10px; +border:1px solid #5B9ACF; + height: 100px; +} +.field_heading { + font-size: 12px; + font-weight: bold; + border-bottom-width: 2px; + border-bottom-style: solid; + border-bottom-color: #666666; + padding-top: 10px; + color: #666666; +} +.select { + font-size: 12px; + width: 344px; +margin-left:10px; +border:1px solid #5B9ACF; +margin-top:2px; +} +.checkbox_label { + font-size: 11px; + cursor: pointer; +} +.radio_label { + font-size: 11px; + cursor: pointer; +} +.email { + font-size: 12px; + width: 343px; +} +/*** Don't remove the class nixhier, this is required for ASP ***/ +.nixhier { + display:none; +} \ No newline at end of file diff --git a/icon.png b/icon.png new file mode 100644 index 0000000000000000000000000000000000000000..fb1a50ce278288e3f48da6e37e9272e1089fe5b2 GIT binary patch literal 1239 zcmeAS@N?(olHy`uVBq!ia0vp^3LwnE3?yBabRA=0U}gyL332`L`$y-2PJt!?#s)@? zMh=b18W&$&Y~0hxP{E+kr6AEIVK~EZ=E<2iUf#Iy?81o$C#>gKA9--3a9d&a#_ZMu zt>>Peb6()gP{6S6%DUcTy%jqu*qhm>o|x*jz-#Hnr5x292ksu&czvVRWG(ec>UI0- zcHG)gx}#LAON=3xfxnGEWo?RdkFPbCKC0>*fFv10$;Y*FHd2gUk+D zcgI=c!a|@BV@Z%-FoVOh8)-leXMsm#F#`j)5C}6~x?2Z~QpN&L7srr_TT>^+RyP^& zv<3$&h;4WzQ7Y>C{EF|kzyIfNU)C`HX;QmbRpC76duj{{Y7&!rl0JB;^k%%0W%69= z=;?J+!P7B9GVz_=jh{@j1hevI^hdx_5Psf-zit}8AyI<|jj+2iez z_f*exDm6@5H{BsWXNOA1$t5fsic|}q%1v4ECDtiG>c8Veb+hmJ(ce~o6Pez!)$ppr z#gjP;9Om$HzGP-ioP6+FfQ`zOps07*>oqiYbhKXT7pYuu&ETls#zhi5K8d!irA6Xw zvsdbu>}yTuI&AK>E^2${H1oX`>0F(BX~{C~A#Wws-wCf-{v#trnL(uZm`#AkYX|)@ zyZsHbnp6Jy1PU#krSBlGvWVgT_h{M9RsSlKwgd>uZC+h-Xx{!pU6o1JOOEwN?k~HO zs%s ] Can't include class.secure.php!", $_SERVER['SCRIPT_NAME']), E_USER_ERROR); + } +} +// end include class.secure.php + + + +?> \ No newline at end of file diff --git a/info.php b/info.php new file mode 100644 index 0000000..359b897 --- /dev/null +++ b/info.php @@ -0,0 +1,43 @@ +%s ] Can't include class.secure.php!", $_SERVER['SCRIPT_NAME']), E_USER_ERROR); + } +} +// end include class.secure.php + +$module_directory = 'form'; +$module_name = 'Form'; +$module_function = 'page'; +$module_version = '3.2.0'; +$module_platform = '2.x'; +$module_author = 'Ryan Djurovich, Rudolph Lartey, John Maats, Dietrich Roland Pehlke '; +$module_license = 'GNU General Public License'; +$module_description = 'This module allows you to create customised online forms, such as a feedback form.'; +$module_guid = 'ad71cc7f-8c40-4b53-812c-4594ec0129aa'; +$module_home = 'http://lepton-cms.org'; + +?> \ No newline at end of file diff --git a/install.php b/install.php new file mode 100644 index 0000000..6ef0aa5 --- /dev/null +++ b/install.php @@ -0,0 +1,118 @@ +%s ] Can't include class.secure.php!", $_SERVER['SCRIPT_NAME']), E_USER_ERROR); + } +} +// end include class.secure.php + + + + +if(defined('LEPTON_URL')) +{ + + // Create tables + $mod_form = 'CREATE TABLE IF NOT EXISTS `'.TABLE_PREFIX.'mod_form_fields` ( `field_id` INT NOT NULL AUTO_INCREMENT,' + . ' `section_id` INT NOT NULL DEFAULT \'0\' ,' + . ' `page_id` INT NOT NULL DEFAULT \'0\' ,' + . ' `position` INT NOT NULL DEFAULT \'0\' ,' + . ' `title` VARCHAR(255) NOT NULL DEFAULT \'\' ,' + . ' `type` VARCHAR(255) NOT NULL DEFAULT \'\' ,' + . ' `required` INT NOT NULL DEFAULT \'0\' ,' + . ' `value` TEXT NOT NULL ,' + . ' `extra` TEXT NOT NULL ,' + . ' PRIMARY KEY ( `field_id` ) ' + . ' )'; + $database->query($mod_form); + + $mod_form = 'CREATE TABLE IF NOT EXISTS `'.TABLE_PREFIX.'mod_form_settings` (' + . ' `section_id` INT NOT NULL DEFAULT \'0\' ,' + . ' `page_id` INT NOT NULL DEFAULT \'0\' ,' + . ' `header` TEXT NOT NULL ,' + . ' `field_loop` TEXT NOT NULL ,' + . ' `footer` TEXT NOT NULL ,' + . ' `email_to` TEXT NOT NULL ,' + . ' `email_from` VARCHAR(255) NOT NULL DEFAULT \'\' ,' + . ' `email_fromname` VARCHAR(255) NOT NULL DEFAULT \'\' ,' + . ' `email_subject` VARCHAR(255) NOT NULL DEFAULT \'\' ,' + . ' `success_page` TEXT NOT NULL ,' + . ' `success_email_to` TEXT NOT NULL ,' + . ' `success_email_from` VARCHAR(255) NOT NULL DEFAULT \'\' ,' + . ' `success_email_fromname` VARCHAR(255) NOT NULL DEFAULT \'\' ,' + . ' `success_email_text` TEXT NOT NULL ,' + . ' `success_email_subject` VARCHAR(255) NOT NULL DEFAULT \'\' ,' + . ' `stored_submissions` INT NOT NULL DEFAULT \'0\' ,' + . ' `max_submissions` INT NOT NULL DEFAULT \'0\' ,' + . ' `use_captcha` INT NOT NULL DEFAULT \'0\' ,' + . ' PRIMARY KEY ( `section_id` ) ' + . ' )'; + $database->query($mod_form); + + $mod_form = 'CREATE TABLE IF NOT EXISTS `'.TABLE_PREFIX.'mod_form_submissions` ( `submission_id` INT NOT NULL AUTO_INCREMENT,' + . ' `section_id` INT NOT NULL DEFAULT \'0\' ,' + . ' `page_id` INT NOT NULL DEFAULT \'0\' ,' + . ' `submitted_when` INT NOT NULL DEFAULT \'0\' ,' + . ' `submitted_by` INT NOT NULL DEFAULT \'0\',' + . ' `body` TEXT NOT NULL,' + . ' PRIMARY KEY ( `submission_id` ) ' + . ' )'; + $database->query($mod_form); + + $mod_search = "SELECT * FROM ".TABLE_PREFIX."search WHERE value = 'form'"; + $insert_search = $database->query($mod_search); + if( $insert_search->numRows() == 0 ) + { + // Insert info into the search table + // Module query info + $field_info = array(); + $field_info['page_id'] = 'page_id'; + $field_info['title'] = 'page_title'; + $field_info['link'] = 'link'; + $field_info['description'] = 'description'; + $field_info['modified_when'] = 'modified_when'; + $field_info['modified_by'] = 'modified_by'; + $field_info = serialize($field_info); + $database->query("INSERT INTO ".TABLE_PREFIX."search (name,value,extra) VALUES ('module', 'form', '$field_info')"); + // Query start + $query_start_code = "SELECT [TP]pages.page_id, [TP]pages.page_title, [TP]pages.link, [TP]pages.description, [TP]pages.modified_when, [TP]pages.modified_by FROM [TP]mod_form_fields, [TP]mod_form_settings, [TP]pages WHERE "; + $database->query("INSERT INTO ".TABLE_PREFIX."search (name,value,extra) VALUES ('query_start', '$query_start_code', 'form')"); + // Query body + $query_body_code = " [TP]pages.page_id = [TP]mod_form_settings.page_id AND [TP]mod_form_settings.header LIKE \'%[STRING]%\' + OR [TP]pages.page_id = [TP]mod_form_settings.page_id AND [TP]mod_form_settings.footer LIKE \'%[STRING]%\' + OR [TP]pages.page_id = [TP]mod_form_fields.page_id AND [TP]mod_form_fields.title LIKE \'%[STRING]%\' "; + $database->query("INSERT INTO ".TABLE_PREFIX."search (name,value,extra) VALUES ('query_body', '$query_body_code', 'form')"); + // Query end + $query_end_code = ""; + $database->query("INSERT INTO ".TABLE_PREFIX."search (name,value,extra) VALUES ('query_end', '$query_end_code', 'form')"); + + // Insert blank row (there needs to be at least on row for the search to work) + $database->query("INSERT INTO ".TABLE_PREFIX."mod_form_fields (`page_id`, `section_id`, `value`, `extra`) VALUES ('0','0', '', '')"); + + } +} + +?> \ No newline at end of file diff --git a/languages/DA.php b/languages/DA.php new file mode 100644 index 0000000..f929cb3 --- /dev/null +++ b/languages/DA.php @@ -0,0 +1,40 @@ +%s ] Can't include class.secure.php!", $_SERVER['SCRIPT_NAME']), E_USER_ERROR); + } +} +// end include class.secure.php + + + +//Modul Description +$module_description = 'Dette modul giver mulighed for at lave tilpassede online formularer, f.eks. en kontaktformular. Tak til Rudolph Lartey som har hjulpet med at forbedre dette modul ved at lave kode for ekstra felttyper osv.'; + +//Variables for the backend +$MOD_FORM['SETTINGS'] = 'Formularindstillinger'; + +?> diff --git a/languages/DE.php b/languages/DE.php new file mode 100644 index 0000000..a5430d8 --- /dev/null +++ b/languages/DE.php @@ -0,0 +1,40 @@ +%s ] Can't include class.secure.php!", $_SERVER['SCRIPT_NAME']), E_USER_ERROR); + } +} +// end include class.secure.php + + + +//Modulbeschreibung +$module_description = 'Mit diesem Modul können sie ein beliebiges Formular für ihre Seite erzeugen'; + +//Variablen fuer backend Texte +$MOD_FORM['SETTINGS'] = 'Formular Einstellungen'; + +?> \ No newline at end of file diff --git a/languages/EN.php b/languages/EN.php new file mode 100644 index 0000000..8bdd118 --- /dev/null +++ b/languages/EN.php @@ -0,0 +1,40 @@ +%s ] Can't include class.secure.php!", $_SERVER['SCRIPT_NAME']), E_USER_ERROR); + } +} +// end include class.secure.php + + + +//Modul Description +$module_description = 'This module allows you to create customised online forms, such as a feedback form.'; + +//Variables for the backend +$MOD_FORM['SETTINGS'] = 'Form Settings'; + +?> \ No newline at end of file diff --git a/languages/FR.php b/languages/FR.php new file mode 100644 index 0000000..18dd39c --- /dev/null +++ b/languages/FR.php @@ -0,0 +1,41 @@ +%s ] Can't include class.secure.php!", $_SERVER['SCRIPT_NAME']), E_USER_ERROR); + } +} +// end include class.secure.php + + + + +//Module Description +$module_description = 'This module allows you to create customised online forms, such as a feedback form. Thank-you to Rudolph Lartey who help enhance this module, providing code for extra field types, etc.'; + +//Variables for the backend +$MOD_FORM['SETTINGS'] = 'Configurations du formulaire'; + +?> \ No newline at end of file diff --git a/languages/IT.php b/languages/IT.php new file mode 100644 index 0000000..19227b5 --- /dev/null +++ b/languages/IT.php @@ -0,0 +1,40 @@ +%s ] Can't include class.secure.php!", $_SERVER['SCRIPT_NAME']), E_USER_ERROR); + } +} +// end include class.secure.php + + + +//Modul Description +$module_description = 'Questo modulo permette la creazione di form personalizzati, come un form di contatto.'; + +//Variables for the backend +$MOD_FORM['SETTINGS'] = 'Configurazione Form'; + +?> \ No newline at end of file diff --git a/languages/NL.php b/languages/NL.php new file mode 100644 index 0000000..d05b18e --- /dev/null +++ b/languages/NL.php @@ -0,0 +1,41 @@ +%s ] Can't include class.secure.php!", $_SERVER['SCRIPT_NAME']), E_USER_ERROR); + } +} +// end include class.secure.php + + + + +//Modul Description +$module_description = 'Deze module makt het mogelijk om aangepaste online formulieren te maken zoals een feedback formulier. Met dank aan Rudolph Lartey voor het aanpassen van deze module.'; + +//Variables for the backend +$MOD_FORM['SETTINGS'] = 'Formulier instellingen'; + +?> \ No newline at end of file diff --git a/languages/NO.php b/languages/NO.php new file mode 100644 index 0000000..9ea66ed --- /dev/null +++ b/languages/NO.php @@ -0,0 +1,40 @@ +%s ] Can't include class.secure.php!", $_SERVER['SCRIPT_NAME']), E_USER_ERROR); + } +} +// end include class.secure.php + + + +//Modul Description +$module_description = 'Med denne modulen kan du lage díne egne spesialtilpassede elektroniske skjemaer, som for eksempe et tilbakemeldings skjema. En stor takk til Rudolph Lartey for hjelpen med å videreutvikkle denne modulen, og for bidrag med koding av ekstra felt typer , osv.'; + +//Variables for the backend +$MOD_FORM['SETTINGS'] = 'Skjema Innstillinger'; + +?> \ No newline at end of file diff --git a/languages/PL.php b/languages/PL.php new file mode 100644 index 0000000..2205570 --- /dev/null +++ b/languages/PL.php @@ -0,0 +1,40 @@ +%s ] Can't include class.secure.php!", $_SERVER['SCRIPT_NAME']), E_USER_ERROR); + } +} +// end include class.secure.php + + + +//Modul Description +$module_description = 'Moduł ten pozwala na tworzenie własnych formularzy online, takich jak formularz zwrotny.'; + +//Variables for the backend +$MOD_FORM['SETTINGS'] = 'Ustawienia formy'; + +?> \ No newline at end of file diff --git a/languages/RU.php b/languages/RU.php new file mode 100644 index 0000000..a9e10b4 --- /dev/null +++ b/languages/RU.php @@ -0,0 +1,40 @@ +%s ] Can't include class.secure.php!", $_SERVER['SCRIPT_NAME']), E_USER_ERROR); + } +} +// end include class.secure.php + + + +//Modul Description +$module_description = 'Модуль позволяет создавать различные настраиваемые формы, например формы обратной связи. Rudolph Lartey помог улучшить данный модуль.'; + +//Variables for the backend +$MOD_FORM['SETTINGS'] = 'Настройки формы'; + +?> diff --git a/languages/index.php b/languages/index.php new file mode 100644 index 0000000..cacb7b0 --- /dev/null +++ b/languages/index.php @@ -0,0 +1,34 @@ +%s ] Can't include class.secure.php!", $_SERVER['SCRIPT_NAME']), E_USER_ERROR); + } +} +// end include class.secure.php + + + +?> \ No newline at end of file diff --git a/modify.php b/modify.php new file mode 100644 index 0000000..ccd08e4 --- /dev/null +++ b/modify.php @@ -0,0 +1,216 @@ +%s ] Can't include class.secure.php!", $_SERVER['SCRIPT_NAME']), E_USER_ERROR); + } +} +// end include class.secure.php + + + +//overwrite php.ini on Apache servers for valid SESSION ID Separator +if(function_exists('ini_set')) { + ini_set('arg_separator.output', '&'); +} + +//Delete all form fields with no title +$database->query("DELETE FROM ".TABLE_PREFIX."mod_form_fields WHERE page_id = '$page_id' and section_id = '$section_id' and title=''"); + +?> +
+ + + + + +
+ + + +
+ +
+ +

+query("SELECT * FROM `".TABLE_PREFIX."mod_form_fields` WHERE section_id = '$section_id' ORDER BY position ASC"); +if($query_fields->numRows() > 0) { + $num_fields = $query_fields->numRows(); + $row = 'a'; + ?> + + fetchRow()) { + ?> + + + + + + + + + + + +
+ + ^ + + + + + + + + + + + + + + + ^ + + + + + + v + + + + + X + +
+ + +

+ +

+ +query("SELECT * FROM `".TABLE_PREFIX."mod_form_submissions` WHERE section_id = '$section_id' ORDER BY submitted_when DESC"); +if($query_submissions->numRows() > 0) { + ?> + + fetchRow()) { + ?> + + + + + + + +
+ + <?php echo $TEXT['OPEN']; ?> + + + + X + +
+ \ No newline at end of file diff --git a/modify_field.php b/modify_field.php new file mode 100644 index 0000000..971a0c3 --- /dev/null +++ b/modify_field.php @@ -0,0 +1,228 @@ +%s ] Can't include class.secure.php!", $_SERVER['SCRIPT_NAME']), E_USER_ERROR); + } +} +// end include class.secure.php + + + +// Get id +if(!isset($_GET['field_id']) OR !is_numeric($_GET['field_id'])) { + header("Location: ".ADMIN_URL."/pages/index.php"); + exit(0); +} else { + $field_id = $_GET['field_id']; +} + +// Include admin wrapper script +require(LEPTON_PATH.'/modules/admin.php'); + +// Get header and footer +$query_content = $database->query("SELECT * FROM ".TABLE_PREFIX."mod_form_fields WHERE field_id = '$field_id'"); +$form = $query_content->fetchRow(); +$type = $form['type']; +if($type == '') { + $type = 'none'; +} + +// Set raw html <'s and >'s to be replaced by friendly html code +$raw = array('<', '>'); +$friendly = array('<', '>'); +?> +
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
: + +
: + +
: + +
: + +
: + +
: + +
: + + + + + + +
: + +
+ + + + + + +
: + +
+ + +
: + + +
: + /> + + + +   + /> + + + +
: + +
: + /> + + + +   + /> + + + +
+ + + + + +
+ + + + 'none') { + ?> + + +
+
+print_footer(); + +?> \ No newline at end of file diff --git a/modify_settings.php b/modify_settings.php new file mode 100644 index 0000000..0c0294a --- /dev/null +++ b/modify_settings.php @@ -0,0 +1,254 @@ +%s ] Can't include class.secure.php!", $_SERVER['SCRIPT_NAME']), E_USER_ERROR); + } +} +// end include class.secure.php + + + +// Include admin wrapper script +require(LEPTON_PATH.'/modules/admin.php'); + +// include core functions to edit the optional module CSS files (frontend.css, backend.css) +include_once(LEPTON_PATH .'/framework/summary.module_edit_css.php'); + + +// Load Language file +$lang = (dirname(__FILE__))."/languages/". LANGUAGE .".php"; +require_once ( !file_exists($lang) ? (dirname(__FILE__))."/languages/EN.php" : $lang ); + +// Get header and footer +$query_content = $database->query("SELECT * FROM ".TABLE_PREFIX."mod_form_settings WHERE section_id = '$section_id'"); +$setting = $query_content->fetchRow(); + +// Set raw html <'s and >'s to be replace by friendly html code +$raw = array('<', '>'); +$friendly = array('<', '>'); + +?> +
+

+ construct!!! +if(function_exists('edit_module_css')) { + edit_module_css('form'); +} +?> + +
+ + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + +
: + /> + + /> + +
: + +
: + +
: + +
: + +
: + +
+
+
+ + + + + + + + + + + + + + + + + + + + +
: + +
: + + +
: + +
: + +
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + +
: + +
: + +
: + +
: + +
: + +
: + +
+
+ + + + +
+ + +
+
+
+print_footer(); + +?> \ No newline at end of file diff --git a/move_down.php b/move_down.php new file mode 100644 index 0000000..8f3b04b --- /dev/null +++ b/move_down.php @@ -0,0 +1,59 @@ +%s ] Can't include class.secure.php!", $_SERVER['SCRIPT_NAME']), E_USER_ERROR); + } +} +// end include class.secure.php + + + +// Get id +if(!isset($_GET['field_id']) OR !is_numeric($_GET['field_id'])) { + header("Location: index.php"); + exit(0); +} else { + $field_id = $_GET['field_id']; +} + +// Include admin wrapper script +require(LEPTON_PATH.'/modules/admin.php'); + +// Include the ordering class +require(LEPTON_PATH.'/framework/class.order.php'); + +// Create new order object an reorder +$order = new order(TABLE_PREFIX.'mod_form_fields', 'position', 'field_id', 'section_id'); +if($order->move_down($field_id)) { + $admin->print_success($TEXT['SUCCESS'], ADMIN_URL.'/pages/modify.php?page_id='.$page_id); +} else { + $admin->print_error($TEXT['ERROR'], ADMIN_URL.'/pages/modify.php?page_id='.$page_id); +} + +// Print admin footer +$admin->print_footer(); + +?> \ No newline at end of file diff --git a/move_up.php b/move_up.php new file mode 100644 index 0000000..91dff7e --- /dev/null +++ b/move_up.php @@ -0,0 +1,59 @@ +%s ] Can't include class.secure.php!", $_SERVER['SCRIPT_NAME']), E_USER_ERROR); + } +} +// end include class.secure.php + + + +// Get id +if(!isset($_GET['field_id']) OR !is_numeric($_GET['field_id'])) { + header("Location: index.php"); + exit(0); +} else { + $field_id = $_GET['field_id']; +} + +// Include admin wrapper script +require(LEPTON_PATH.'/modules/admin.php'); + +// Include the ordering class +require(LEPTON_PATH.'/framework/class.order.php'); + +// Create new order object an reorder +$order = new order(TABLE_PREFIX.'mod_form_fields', 'position', 'field_id', 'section_id'); +if($order->move_up($field_id)) { + $admin->print_success($TEXT['SUCCESS'], ADMIN_URL.'/pages/modify.php?page_id='.$page_id); +} else { + $admin->print_error($TEXT['ERROR'], ADMIN_URL.'/pages/modify.php?page_id='.$page_id); +} + +// Print admin footer +$admin->print_footer(); + +?> \ No newline at end of file diff --git a/precheck.php b/precheck.php new file mode 100644 index 0000000..edead22 --- /dev/null +++ b/precheck.php @@ -0,0 +1,33 @@ +%s ] Can't include class.secure.php!", $_SERVER['SCRIPT_NAME']), E_USER_ERROR); +} +// end include class.secure.php + +// Checking Requirements +$PRECHECK['LEPTON_VERSION'] = array('VERSION' => '2.0.0', 'OPERATOR' => '>='); + +?> \ No newline at end of file diff --git a/register_class_secure.php b/register_class_secure.php new file mode 100644 index 0000000..8938cbc --- /dev/null +++ b/register_class_secure.php @@ -0,0 +1,36 @@ +register( $form_backend_files ); + +?> \ No newline at end of file diff --git a/save_field.php b/save_field.php new file mode 100644 index 0000000..e2cee19 --- /dev/null +++ b/save_field.php @@ -0,0 +1,105 @@ +%s ] Can't include class.secure.php!", $_SERVER['SCRIPT_NAME']), E_USER_ERROR); + } +} +// end include class.secure.php + + + +// Get id +if(!isset($_POST['field_id']) OR !is_numeric($_POST['field_id'])) { + header("Location: ".ADMIN_URL."/pages/index.php"); + exit(0); +} else { + $field_id = $_POST['field_id']; +} + +// Include admin wrapper script +$update_when_modified = true; // Tells script to update when this page was last updated +require(LEPTON_PATH.'/modules/admin.php'); + +// Validate all fields +if($admin->get_post('title') == '' OR $admin->get_post('type') == '') { + $admin->print_error($MESSAGE['GENERIC']['FILL_IN_ALL'], LEPTON_URL.'/modules/form/modify_field.php?page_id='.$page_id.'§ion_id='.$section_id.'&field_id='.$field_id); +} else { + $title = str_replace(array("[[", "]]"), '', htmlspecialchars($admin->get_post('title'), ENT_QUOTES)); + $type = addslashes($admin->get_post('type')); + $required = (int) addslashes($admin->get_post('required')); +} +$value = ''; + +// Update row +$database->query("UPDATE ".TABLE_PREFIX."mod_form_fields SET title = '$title', type = '$type', required = '$required' WHERE field_id = '$field_id'"); + +// If field type has multiple options, get all values and implode them +$list_count = $admin->get_post('list_count'); +if(is_numeric($list_count)) { + $values = array(); + for($i = 1; $i <= $list_count; $i++) { + if($admin->get_post('value'.$i) != '') { + $values[] = str_replace(",",",",$admin->get_post('value'.$i)); + } + } + $value = implode(',', $values); +} + +// Get extra fields for field-type-specific settings +if($admin->get_post('type') == 'textfield') { + $length = $admin->get_post_escaped('length'); + $value = str_replace(array("[[", "]]"), '', $admin->get_post_escaped('value')); + $database->query("UPDATE ".TABLE_PREFIX."mod_form_fields SET value = '$value', extra = '$length' WHERE field_id = '$field_id'"); +} elseif($admin->get_post('type') == 'textarea') { + $value = str_replace(array("[[", "]]"), '', $admin->get_post_escaped('value')); + $database->query("UPDATE ".TABLE_PREFIX."mod_form_fields SET value = '$value', extra = '' WHERE field_id = '$field_id'"); +} elseif($admin->get_post('type') == 'heading') { + $extra = str_replace(array("[[", "]]"), '', $admin->get_post('template')); + if(trim($extra) == '') $extra = '{TITLE}{FIELD}'; + $extra = addslashes($extra); + $database->query("UPDATE ".TABLE_PREFIX."mod_form_fields SET value = '', extra = '$extra' WHERE field_id = '$field_id'"); +} elseif($admin->get_post('type') == 'select') { + $extra = $admin->get_post_escaped('size').','.$admin->get_post_escaped('multiselect'); + $database->query("UPDATE ".TABLE_PREFIX."mod_form_fields SET value = '$value', extra = '$extra' WHERE field_id = '$field_id'"); +} elseif($admin->get_post('type') == 'checkbox') { + $extra = str_replace(array("[[", "]]"), '', $admin->get_post_escaped('seperator')); + $database->query("UPDATE ".TABLE_PREFIX."mod_form_fields SET value = '$value', extra = '$extra' WHERE field_id = '$field_id'"); +} elseif($admin->get_post('type') == 'radio') { + $extra = str_replace(array("[[", "]]"), '', $admin->get_post_escaped('seperator')); + $database->query("UPDATE ".TABLE_PREFIX."mod_form_fields SET value = '$value', extra = '$extra' WHERE field_id = '$field_id'"); +} + +// Check if there is a db error, otherwise say successful +if($database->is_error()) { + $admin->print_error($database->get_error(), LEPTON_URL.'/modules/form/modify_field.php?page_id='.$page_id.'§ion_id='.$section_id.'&field_id='.$field_id); +} else { + $admin->print_success($TEXT['SUCCESS'], LEPTON_URL.'/modules/form/modify_field.php?page_id='.$page_id.'§ion_id='.$section_id.'&field_id='.$field_id); +} + +// Print admin footer +$admin->print_footer(); + +?> \ No newline at end of file diff --git a/save_settings.php b/save_settings.php new file mode 100644 index 0000000..258446f --- /dev/null +++ b/save_settings.php @@ -0,0 +1,87 @@ +%s ] Can't include class.secure.php!", $_SERVER['SCRIPT_NAME']), E_USER_ERROR); + } +} +// end include class.secure.php + + + +// Include admin wrapper script +$update_when_modified = true; // Tells script to update when this page was last updated +require(LEPTON_PATH.'/modules/admin.php'); + +// This code removes any ', ''); +$header = addslashes($_POST['header']); +$field_loop = addslashes($_POST['field_loop']); +$footer = addslashes($_POST['footer']); +$email_to = addslashes($_POST['email_to']); +$use_captcha = addslashes($_POST['use_captcha']); +if($_POST['email_from_field'] == '') { + $email_from = addslashes($_POST['email_from']); +} else { + $email_from = addslashes($_POST['email_from_field']); +} +$email_fromname = addslashes($_POST['email_fromname']); +$email_subject = addslashes($_POST['email_subject']); +$success_page = addslashes($_POST['success_page']); +$success_email_to = addslashes($_POST['success_email_to']); +$success_email_from = addslashes($_POST['success_email_from']); +$success_email_fromname = addslashes($_POST['success_email_fromname']); +$success_email_text = addslashes($_POST['success_email_text']); +$success_email_subject = addslashes($_POST['success_email_subject']); +if(!is_numeric($_POST['max_submissions'])) { + $max_submissions = 50; +} else { + $max_submissions = $_POST['max_submissions']; +} +if(!is_numeric($_POST['stored_submissions'])) { + $stored_submissions = 1000; +} else { + $stored_submissions = $_POST['stored_submissions']; +} +// Make sure max submissions is not greater than stored submissions if stored_submissions <>0 +if($max_submissions > $stored_submissions) { + $max_submissions = $stored_submissions; +} + +// Update settings +$database->query("UPDATE ".TABLE_PREFIX."mod_form_settings SET header = '$header', field_loop = '$field_loop', footer = '$footer', email_to = '$email_to', email_from = '$email_from', email_fromname = '$email_fromname', email_subject = '$email_subject', success_page = '$success_page', success_email_to = '$success_email_to', success_email_from = '$success_email_from', success_email_fromname = '$success_email_fromname', success_email_text = '$success_email_text', success_email_subject = '$success_email_subject', max_submissions = '$max_submissions', stored_submissions = '$stored_submissions', use_captcha = '$use_captcha' WHERE section_id = '$section_id'"); + +// Check if there is a db error, otherwise say successful +if($database->is_error()) { + $admin->print_error($database->get_error(), ADMIN_URL.'/pages/modify.php?page_id='.$page_id); +} else { + $admin->print_success($TEXT['SUCCESS'], ADMIN_URL.'/pages/modify.php?page_id='.$page_id); +} + +// Print admin footer +$admin->print_footer(); + +?> \ No newline at end of file diff --git a/search.php b/search.php new file mode 100644 index 0000000..44dba40 --- /dev/null +++ b/search.php @@ -0,0 +1,73 @@ +%s ] Can't include class.secure.php!", $_SERVER['SCRIPT_NAME']), E_USER_ERROR); + } +} +// end include class.secure.php + + + +function form_search($func_vars) { + extract($func_vars, EXTR_PREFIX_ALL, 'func'); + + // how many lines of excerpt we want to have at most + $max_excerpt_num = $func_default_max_excerpt; + $divider = "."; + $result = false; + + // fetch all form-fields on this page + $table = TABLE_PREFIX."mod_form_fields"; + $query = $func_database->query(" + SELECT title, value + FROM $table + WHERE section_id='$func_section_id' + ORDER BY position ASC + "); + // now call print_excerpt() only once for all items + if($query->numRows() > 0) { + $text=""; + while($res = $query->fetchRow()) { + $text .= $res['title'].$divider.$res['value'].$divider; + } + $mod_vars = array( + 'page_link' => $func_page_link, + 'page_link_target' => "#".SEC_ANCHOR."section_".$func_section_id, + 'page_title' => $func_page_title, + 'page_description' => $func_page_description, + 'page_modified_when' => $func_page_modified_when, + 'page_modified_by' => $func_page_modified_by, + 'text' => $text, + 'max_excerpt_num' => $max_excerpt_num + ); + if(print_excerpt2($mod_vars, $func_vars)) { + $result = true; + } + } + return $result; +} + +?> diff --git a/uninstall.php b/uninstall.php new file mode 100644 index 0000000..23eae6b --- /dev/null +++ b/uninstall.php @@ -0,0 +1,41 @@ +%s ] Can't include class.secure.php!", $_SERVER['SCRIPT_NAME']), E_USER_ERROR); + } +} +// end include class.secure.php + + + +$database->query("DELETE FROM ".TABLE_PREFIX."search WHERE name = 'module' AND value = 'form'"); +$database->query("DELETE FROM ".TABLE_PREFIX."search WHERE extra = 'form'"); + +$database->query("DROP TABLE IF EXISTS `".TABLE_PREFIX."mod_form_fields`"); +$database->query("DROP TABLE IF EXISTS `".TABLE_PREFIX."mod_form_settings`"); +$database->query("DROP TABLE IF EXISTS `".TABLE_PREFIX."mod_form_submissions`"); + +?> \ No newline at end of file diff --git a/upgrade.php b/upgrade.php new file mode 100644 index 0000000..171ceb0 --- /dev/null +++ b/upgrade.php @@ -0,0 +1,35 @@ +%s ] Can't include class.secure.php!", $_SERVER['SCRIPT_NAME']), E_USER_ERROR); + } +} +// end include class.secure.php + + + + +?> \ No newline at end of file diff --git a/view.php b/view.php new file mode 100644 index 0000000..170c0dc --- /dev/null +++ b/view.php @@ -0,0 +1,491 @@ +%s ] Can't include class.secure.php!", $_SERVER['SCRIPT_NAME']), E_USER_ERROR); + } +} +// end include class.secure.php + + +require_once(LEPTON_PATH.'/modules/captcha_control/captcha/captcha.php'); + +// obtain the settings of the output filter module +if(file_exists(LEPTON_PATH.'/modules/output_filter/filter-routines.php')) { + include_once(LEPTON_PATH.'/modules/output_filter/filter-routines.php'); + $filter_settings = get_output_filter_settings(); +} else { + // no output filter used, define default settings + $filter_settings['email_filter'] = 0; +} + +// Function for generating an optionsfor a select field +if (!function_exists('make_option')) { +function make_option(&$n, $k, $values) { + // start option group if it exists + if (substr($n,0,2) == '[=') { + $n = ''; + } elseif ($n == ']') { + $n = ''; + } else { + if(in_array($n, $values)) { + $n = ''; + } else { + $n = ''; + } + } +} +} +// Function for generating a checkbox +if (!function_exists('make_checkbox')) { +function make_checkbox(&$n, $idx, $params) { + $field_id = $params[0][0]; + $seperator = $params[0][1]; + $label_id = SEC_ANCHOR.str_replace(" ", "_", $n); + if(in_array($n, $params[1])) { + $n = ''.'