Skip to content
This repository has been archived by the owner on Jun 13, 2018. It is now read-only.

Commit

Permalink
sourced from LEPTON package
Browse files Browse the repository at this point in the history
  • Loading branch information
labby committed Sep 17, 2015
1 parent d6a2019 commit 30c63c7
Show file tree
Hide file tree
Showing 36 changed files with 2,810 additions and 2 deletions.
24 changes: 22 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -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]<br />


#### 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
59 changes: 59 additions & 0 deletions add.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
<?php

/**
* @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
*/

// include class.secure.php to protect this file and the whole CMS!
if (defined('LEPTON_PATH')) {
include(LEPTON_PATH.'/framework/class.secure.php');
} else {
$oneback = "../";
$root = $oneback;
$level = 1;
while (($level < 10) && (!file_exists($root.'/framework/class.secure.php'))) {
$root .= $oneback;
$level += 1;
}
if (file_exists($root.'/framework/class.secure.php')) {
include($root.'/framework/class.secure.php');
} else {
trigger_error(sprintf("[ <b>%s</b> ] 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 = '<table cellpadding=\"2\" cellspacing=\"0\" border=\"0\" width=\"98%\">';
$field_loop = '<tr><td class=\"field_title\">{TITLE}{REQUIRED}:</td><td>{FIELD}</td></tr>';
$footer = '<tr><td>&nbsp;</td>
<td>
<input type=\"submit\" name=\"submit\" value=\"Submit Form\" />
</td>
</tr>
</table>';
$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')");

?>
64 changes: 64 additions & 0 deletions add_field.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
<?php

/**
* @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
*/

// include class.secure.php to protect this file and the whole CMS!
if (defined('LEPTON_PATH')) {
include(LEPTON_PATH.'/framework/class.secure.php');
} else {
$oneback = "../";
$root = $oneback;
$level = 1;
while (($level < 10) && (!file_exists($root.'/framework/class.secure.php'))) {
$root .= $oneback;
$level += 1;
}
if (file_exists($root.'/framework/class.secure.php')) {
include($root.'/framework/class.secure.php');
} else {
trigger_error(sprintf("[ <b>%s</b> ] 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.'&section_id='.$section_id.'&field_id='.$field_id);
} else {
//$admin->print_success($TEXT['SUCCESS'], LEPTON_URL.'/modules/form/modify_field.php?page_id='.$page_id.'&section_id='.$section_id.'&field_id='.$field_id);
?>
<script type="text/javascript">
setTimeout("top.location.href ='<?php echo LEPTON_URL; ?>/modules/form/modify_field.php?page_id=<?php echo $page_id; ?>&section_id=<?php echo $section_id; ?>&field_id=<?php echo $field_id; ?>'", 0);
</script>
<?php
}

// Print admin footer
$admin->print_footer();

?>
41 changes: 41 additions & 0 deletions backend.css
Original file line number Diff line number Diff line change
@@ -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;
}
38 changes: 38 additions & 0 deletions delete.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
<?php

/**
* @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
*/

// include class.secure.php to protect this file and the whole CMS!
if (defined('LEPTON_PATH')) {
include(LEPTON_PATH.'/framework/class.secure.php');
} else {
$oneback = "../";
$root = $oneback;
$level = 1;
while (($level < 10) && (!file_exists($root.'/framework/class.secure.php'))) {
$root .= $oneback;
$level += 1;
}
if (file_exists($root.'/framework/class.secure.php')) {
include($root.'/framework/class.secure.php');
} else {
trigger_error(sprintf("[ <b>%s</b> ] 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'");

?>
59 changes: 59 additions & 0 deletions delete_field.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
<?php

/**
* @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
*/

// include class.secure.php to protect this file and the whole CMS!
if (defined('LEPTON_PATH')) {
include(LEPTON_PATH.'/framework/class.secure.php');
} else {
$oneback = "../";
$root = $oneback;
$level = 1;
while (($level < 10) && (!file_exists($root.'/framework/class.secure.php'))) {
$root .= $oneback;
$level += 1;
}
if (file_exists($root.'/framework/class.secure.php')) {
include($root.'/framework/class.secure.php');
} else {
trigger_error(sprintf("[ <b>%s</b> ] 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();

?>
59 changes: 59 additions & 0 deletions delete_submission.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
<?php

/**
* @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
*/

// include class.secure.php to protect this file and the whole CMS!
if (defined('LEPTON_PATH')) {
include(LEPTON_PATH.'/framework/class.secure.php');
} else {
$oneback = "../";
$root = $oneback;
$level = 1;
while (($level < 10) && (!file_exists($root.'/framework/class.secure.php'))) {
$root .= $oneback;
$level += 1;
}
if (file_exists($root.'/framework/class.secure.php')) {
include($root.'/framework/class.secure.php');
} else {
trigger_error(sprintf("[ <b>%s</b> ] 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();

?>
Loading

0 comments on commit 30c63c7

Please sign in to comment.