_FIELDURL, "2" => _FIELDSELECT, "3" => _FIELDYESNO, "4" => _FIELDIDURL, "5" => _FIELDCUSTOM, "6" => _TEXT); if(!empty($_GET['delete'])) { $delete = $_GET['delete']; $confirm = isset($_GET['confirm']) ? $_GET['confirm'] : false; if($confirm == "yes" && isNumber($delete)) { $result = dbquery("DELETE FROM ".TABLEPREFIX."fanfiction_authorfields WHERE field_id = '$delete' LIMIT 1"); if($result) $output .= write_message(_ACTIONSUCCESSFUL); else $output .= write_error(_ERROR); } else if($confirm == "no") { $output .= write_message(_ACTIONCANCELLED); } else { $output .= write_message(_CONFIRMDELETE."

[ "._YES." | "._NO." ]"); } } if(!empty($_GET['edit'])) { $new = $_GET['edit'] == "new" ? true : false; if(isset($_POST['submit'])) { $field_name = isset($_POST['field_name']) ? descript($_POST['field_name']) : ""; $field_title = isset($_POST['field_title']) ? descript($_POST['field_title']) : ""; $field_type = isset($_POST['field_type']) && isNumber($_POST['field_type'])? $_POST['field_type'] : "0"; $field_on = isset($_POST['field_on']) && $_POST['field_on'] == "on" ? "1" : "0"; $field_options = ""; $code_in = ""; $code_out = ""; if(!$field_type) { $output .= write_error(_NOFIELDTYPE); } else { if($field_type == 4) $field_options = isset($_POST['options_4']) ? descript($_POST['options_4']) : ""; if($field_type == 2) $field_options = implode("|#|", explode("\r\n", ltrim(strip_tags(preg_replace( '!

!iU', "\r\n", stripslashes(trim($_POST['options_2']))), preg_replace("!

!iu", "", $allowed_tags))))); if($field_type == 5) { $code_in = isset($_POST['code_in']) ? descript($_POST['code_in']) : ""; $code_out = isset($_POST['code_out']) ? descript($_POST['code_out']) : ""; } if($new) { $result = dbquery("INSERT INTO ".TABLEPREFIX."fanfiction_authorfields(`field_name`, `field_title`, `field_type`, `field_options`, `field_code_in`, `field_code_out`, `field_on`) VALUES('".escapestring($field_name)."', '".escapestring($field_title)."', '$field_type', '".escapestring($field_options)."', '".escapestring($code_in)."', '".escapestring($code_out)."', '$field_on');"); } else { $result = dbquery("UPDATE ".TABLEPREFIX."fanfiction_authorfields SET field_type = '$field_type', field_name = '".escapestring($field_name)."', field_title = '".escapestring($field_title)."', field_options = '".escapestring($field_options)."', field_code_in = '".escapestring($code_in)."', field_code_out = '".escapestring($code_out)."', field_on = '$field_on' WHERE field_id = '".$_GET['edit']."'"); } if($result) $output .= write_message(_ACTIONSUCCESSFUL); else $output .= write_error(_ERROR); } } else { if($new) { $fieldinfo = array("field_type" => "", "field_id" => "", "field_name" => "", "field_title" => "", "field_options" => "", "field_code_in" => "", "field_code_out" => "", "field_on" => "0"); } else { $fieldinfo = dbassoc(dbquery("SELECT * FROM ".TABLEPREFIX."fanfiction_authorfields WHERE field_id = '".$_GET['edit']."' LIMIT 1")); } $output .= "

".($new ? _ADDFIELD : _EDITFIELD)."


[?]"._HELP_FIELDTYPE."
[?]"._HELP_FIELDSELECT."
"; if($tinyMCE) $output .= "
"; $output .= "
[?]"._HELP_FIELDIDURL."
[?]"._HELP_FIELDCODEIN."
"; $output .= "
[?]"._HELP_FIELDCODEOUT."
"; $output .= "
 
"; $list = false; } } else if(!empty($_GET['delete'])) { } if($list) { $fields = dbquery("SELECT * FROM ".TABLEPREFIX."fanfiction_authorfields"); if(dbnumrows($fields) > 0) { $output .= ""; while($field = dbassoc($fields)) { $output .= ""; } $output .= "
"._NAME.""._STATUS.""._OPTIONS."
".(empty($field['field_title']) ? $field['field_name'] : $field['field_title'])."".($field['field_on'] ? _ON : _OFF).""._EDIT." | "._DELETE."
"._ADDNEWFIELD."
"; } } ?>