";
foreach ($unit_arr as $value) {
$selected=($value=="$unit")? " selected='selected' " : "" ;
$select_field.="\n";
}
$select_field.="";
return $select_field;
}
/**************************************
** function: SaveCheckboxToDB
**
** Update the checkbox setting in the database.
**
** Parameters:
** $boxname (string, required) - the name of the checkbox (db option name)
** $prefix (string, optional) - defaults to SLPLUS_PREFIX, can be ''
**/
function SaveCheckboxToDB($boxname,$prefix = SLPLUS_PREFIX) {
$whichbox = $prefix.$boxname;
$_POST[$whichbox] = isset($_POST[$whichbox])?1:0;
update_option($whichbox,$_POST[$whichbox]);
}
/**************************************
** function: CreateCheckboxDiv
**
** Update the checkbox setting in the database.
**
** Parameters:
** $boxname (string, required) - the name of the checkbox (db option name)
** $label (string, optional) - default '', the label to go in front of the checkbox
** $message (string, optional) - default '', the help message
** $prefix (string, optional) - defaults to SLPLUS_PREFIX, can be ''
**/
function CreateCheckboxDiv($boxname,$label='',$msg='',$prefix=SLPLUS_PREFIX) {
$whichbox = $prefix.$boxname;
return
"
".
"".
"".
slp_createhelpdiv($boxname,$msg).
"
"
;
}
//===========================================================================
// Main Processing
//===========================================================================
$update_msg ='';
if (!$_POST) {
move_upload_directories();
} else {
if (isset($_POST['sl_language'])) {
update_option('sl_language', $_POST['sl_language']);
}
$sl_google_map_arr=explode(":", $_POST['google_map_domain']);
update_option('sl_google_map_country', $sl_google_map_arr[0]);
update_option('sl_google_map_domain', $sl_google_map_arr[1]);
update_option('sl_map_character_encoding', $_POST['sl_map_character_encoding']);
$_POST['height']=ereg_replace("[^0-9]", "", $_POST['height']);
$_POST['width']=ereg_replace("[^0-9]", "", $_POST['width']);
// Height if % set range 0..100
if ($_POST['height_units'] == '%') {
$_POST['height'] = max(0,min($_POST['height'],100));
}
update_option('sl_map_height_units', $_POST['height_units']);
update_option('sl_map_height', $_POST['height']);
// Width if % set range 0..100
if ($_POST['width_units'] == '%') {
$_POST['width'] = max(0,min($_POST['width'],100));
}
update_option('sl_map_width_units', $_POST['width_units']);
update_option('sl_map_width', $_POST['width']);
update_option('sl_map_radii', $_POST['radii']);
update_option('sl_map_home_icon', $_POST['icon']);
update_option('sl_map_end_icon', $_POST['icon2']);
update_option('sl_search_label', $_POST['search_label']);
update_option('sl_radius_label', $_POST['sl_radius_label']);
update_option('sl_website_label', $_POST['sl_website_label']);
update_option('sl_instruction_message', $_POST['sl_instruction_message']);
update_option('sl_zoom_level', $_POST['zoom_level']);
update_option('sl_zoom_tweak', $_POST['zoom_tweak']);
update_option('sl_map_type', $_POST['sl_map_type']);
update_option('sl_num_initial_displayed', $_POST['sl_num_initial_displayed']);
update_option('sl_distance_unit', $_POST['sl_distance_unit']);
if (function_exists('execute_and_output_plustemplate')) {
update_option('sl_starting_image', $_POST['sl_starting_image']);
update_option(SLPLUS_PREFIX.'_search_tag_label', $_POST[SLPLUS_PREFIX.'_search_tag_label']);
update_option(SLPLUS_PREFIX.'_tag_search_selections', $_POST[SLPLUS_PREFIX.'_tag_search_selections']);
update_option(SLPLUS_PREFIX.'_state_pd_label', $_POST[SLPLUS_PREFIX.'_state_pd_label']);
update_option(SLPLUS_PREFIX.'_map_center', $_POST[SLPLUS_PREFIX.'_map_center']);
update_option(SLPLUS_PREFIX.'_maxreturned', $_POST[SLPLUS_PREFIX.'_maxreturned']);
}
# Checkbox settings - can set to issset and save that because the
# post variable is only set if it is checked, if not checked it is
# false (0).
#
$_POST['sl_use_city_search']=isset($_POST['sl_use_city_search'])?1:0;
update_option('sl_use_city_search',$_POST['sl_use_city_search']);
$_POST['slplus_show_state_pd']=isset($_POST['slplus_show_state_pd'])?1:0;
update_option('slplus_show_state_pd',$_POST['slplus_show_state_pd']);
$_POST['sl_use_country_search']=isset($_POST['sl_use_country_search'])?1:0;
update_option('sl_use_country_search',$_POST['sl_use_country_search']);
$_POST['sl_remove_credits']=isset($_POST['sl_remove_credits'])?1:0;
update_option('sl_remove_credits',$_POST['sl_remove_credits']);
$_POST['sl_load_locations_default']=isset($_POST['sl_load_locations_default'])?1:0;
update_option('sl_load_locations_default',$_POST['sl_load_locations_default']);
$_POST['sl_map_overview_control'] = isset($_POST['sl_map_overview_control'])?1:0;
update_option('sl_map_overview_control',$_POST['sl_map_overview_control']);
$BoxesToHit = array(
'_show_tag_search',
'_show_tag_any',
'_email_form',
'_show_tags',
'_disable_scrollwheel',
'_disable_initialdirectory',
'_disable_largemapcontrol3d',
'_disable_scalecontrol',
'_disable_maptypecontrol',
'_hide_radius_selections',
'_hide_address_entry',
'_disable_search'
);
foreach ($BoxesToHit as $JustAnotherBox) {
SaveCheckBoxToDB($JustAnotherBox);
}
$update_msg = "