Changeset 20162 for extensions/Piwecard/admin/admin_configuration.php
- Timestamp:
- Jan 15, 2013, 12:41:50 AM (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
extensions/Piwecard/admin/admin_configuration.php
r20103 r20162 10 10 $configuration = array(); 11 11 12 $configuration['validity_default'] = $_POST['ecard_validity_default']; 13 $configuration['sender_copy'] = isset($_POST['ecard_sender_copy']); 12 $configuration['validity'] = $_POST['ecard_validity_list']; 13 $configuration['validity'] = explode(',', $configuration['validity']); 14 15 $configuration['validity_default'] = isset($_POST['ecard_validity_default']) ? $_POST['ecard_validity_default'] : null; 16 17 if ($configuration['validity'][0] == null) { 18 $errors['validity'] = array( 19 'style_error_text' => 'display: block;', 20 'style_error_input' => 'class="ecard_error_input"', 21 ); 22 } elseif (!in_array($configuration['validity_default'], $configuration['validity'])) { 23 $configuration['validity_default'] = $configuration['validity']; 24 } 25 $conf_validity = array(); 26 foreach ($configuration['validity'] as $validity) { 27 array_push($conf_validity, intval($validity)); 28 } 29 $configuration['validity'] = array_unique($conf_validity, SORT_NUMERIC); 30 asort($configuration['validity']); 31 32 $configuration['validity_choice'] = ((isset($_POST['ecard_validity_choice']) && $_POST['ecard_validity_choice'] == '1') ? true : false); 33 $configuration['sender_copy'] = ((isset($_POST['ecard_sender_copy']) && $_POST['ecard_sender_copy'] == '1') ? true : false); 14 34 $configuration['image_size'] = $_POST['ecard_image_size']; 15 $configuration['sender_email_change'] = isset($_POST['ecard_sender_email_change']);35 $configuration['sender_email_change'] = ((isset($_POST['ecard_sender_email_change']) && $_POST['ecard_sender_email_change'] == '1') ? true : false); 16 36 17 37 $ecard_email_format_array = array(); … … 23 43 if (!in_array($configuration['email_format_default'], $configuration['email_format_authorized'])) 24 44 $errors['email_format_default'] = array( 25 'style_error_text' => 'display: inline;',45 'style_error_text' => 'display: block;', 26 46 ); 27 $configuration['show_image_infos'] = ((isset($_POST['ecard_show_image_infos']) && $_POST['ecard_show_image_infos'] == '1') ? '1' : '0');47 $configuration['show_image_infos'] = ((isset($_POST['ecard_show_image_infos']) && $_POST['ecard_show_image_infos'] == '1') ? true : false); 28 48 $configuration['default_guest_email'] = $_POST['ecard_default_guest_email']; 29 if ($configuration['default_guest_email'] != '' && !$piwecard->is_valid_email($configuration['default_guest_email']))49 if ($configuration['default_guest_email'] != '' && !$piwecard->is_valid_email($configuration['default_guest_email'])) 30 50 $errors['default_guest_email'] = array( 31 'style_error_text' => 'display: inline;',32 'style_error_input' => 'class="ecard_ admin_error_input"',51 'style_error_text' => 'display: block;', 52 'style_error_input' => 'class="ecard_error_input"', 33 53 ); 34 54 $configuration['email_subject'] = htmlspecialchars($_POST['ecard_email_subject']); 35 55 if ($configuration['email_subject'] == '') 36 56 $errors['email_subject'] = array( 37 'style_error_text' => 'display: inline;',38 'style_error_input' => 'class="ecard_ admin_error_input"',57 'style_error_text' => 'display: block;', 58 'style_error_input' => 'class="ecard_error_input"', 39 59 ); 40 60 $configuration['email_message']['text'] = htmlspecialchars($_POST['ecard_email_message_text']); 41 61 if ($configuration['email_message']['text'] == '') 42 62 $errors['email_message']['text'] = array( 43 'style_error_text' => 'display: inline;',44 'style_error_input' => 'class="ecard_ admin_error_input"',63 'style_error_text' => 'display: block;', 64 'style_error_input' => 'class="ecard_error_input"', 45 65 ); 46 66 $configuration['email_message']['html'] = stripslashes($_POST['ecard_email_message_html']); 47 67 if ($configuration['email_message']['html'] == '') 48 68 $errors['email_message']['html'] = array( 49 'style_error_text' => 'display: inline;',50 'style_error_input' => 'class="ecard_ admin_error_input"',69 'style_error_text' => 'display: block;', 70 'style_error_input' => 'class="ecard_error_input"', 51 71 ); 52 72 … … 66 86 } 67 87 88 if (isset($_POST['reset'])) { 89 require(PIWECARD_INSTALL_PATH.'default_values.inc.php'); 90 91 $piwecard->config['email_subject'] = $ecard_default_values['email_subject']; 92 $piwecard->config['email_message']['text'] = $ecard_default_values['email_message']['text']; 93 $piwecard->config['email_message']['html'] = $ecard_default_values['email_message']['html']; 94 95 $piwecard->set_config(); 96 97 array_push($page['infos'], l10n('Information data registered in database')); 98 } 99 100 if (isset($errors['validity'])) { 101 $piwecard->config['validity'] = null; 102 $configuration['validity'] = null; 103 } 104 $template->assign('ecard_validity_list',((isset($configuration['validity'])) ? $configuration['validity'] : $piwecard->config['validity'])); 105 106 if (isset($piwecard->config['validity'])) { 107 foreach($piwecard->config['validity'] as $validity) { 108 $template->append('ecard_validity', array( 109 'id' => $validity, 110 'name' => ($validity == 0) ? l10n('piwecard_nolimit') : $validity.' '.l10n('piwecard_days'), 111 'selected' => (($piwecard->config['validity_default'] == $validity) ? 'selected' : ''), 112 ) 113 ); 114 } 115 } 116 $template->assign('ecard_validity_choice', $piwecard->config['validity_choice'] ? 'checked="checked"' : ''); 117 68 118 $derivative_map = array(); 69 119 foreach(ImageStdParams::get_defined_type_map() as $params) { … … 76 126 $template->assign('generate_derivatives_types', $derivative_map); 77 127 78 foreach($piwecard->config['validity'] as $validity) {79 $template->append('ecard_validity', array(80 'id' => $validity,81 'name' => ($validity == 0) ? l10n('piwecard_nolimit') : $validity.' '.l10n('piwecard_days'),82 'selected' => (($piwecard->config['validity_default'] == $validity) ? 'selected' : ''),83 )84 );85 }86 128 $template->assign('ecard_sender_copy', $piwecard->config['sender_copy'] ? 'checked="checked"' : ''); 87 129 $template->assign('ecard_sender_email_change', $piwecard->config['sender_email_change'] ? 'checked="checked"' : '');
Note: See TracChangeset
for help on using the changeset viewer.