77 // database then set the user-agent header to the database prefix so that any |
77 // database then set the user-agent header to the database prefix so that any |
78 // calls to other Drupal pages will run the SimpleTest prefixed database. The |
78 // calls to other Drupal pages will run the SimpleTest prefixed database. The |
79 Index: modules/system/system.admin.inc |
79 Index: modules/system/system.admin.inc |
80 --- modules/system/system.admin.inc.orig 2008-03-25 12:58:16 +0100 |
80 --- modules/system/system.admin.inc.orig 2008-03-25 12:58:16 +0100 |
81 +++ modules/system/system.admin.inc 2008-04-24 11:43:07 +0200 |
81 +++ modules/system/system.admin.inc 2008-04-24 11:43:07 +0200 |
82 @@ -1766,6 +1766,124 @@ |
82 @@ -1766,6 +1766,165 @@ |
83 } |
83 } |
84 |
84 |
85 /** |
85 /** |
86 + * Form builder; Configure the site proxy settings. |
|
87 + * |
|
88 + * @ingroup forms |
|
89 + * @see system_settings_form() |
|
90 + */ |
|
91 +function system_proxy_settings() { |
|
92 + |
|
93 + $form['forward_proxy'] = array( |
|
94 + '#type' => 'fieldset', |
|
95 + '#title' => t('Forward proxy settings'), |
|
96 + '#description' => t('The proxy server used when Drupal needs to connect to other sites on the Internet.'), |
|
97 + ); |
|
98 + $form['forward_proxy']['proxy_server'] = array( |
|
99 + '#type' => 'textfield', |
|
100 + '#title' => t('Proxy host name'), |
|
101 + '#default_value' => variable_get('proxy_server', ''), |
|
102 + '#description' => t('The host name of the proxy server, eg. localhost. If this is empty Drupal will connect directly to the internet.') |
|
103 + ); |
|
104 + $form['forward_proxy']['proxy_port'] = array( |
|
105 + '#type' => 'textfield', |
|
106 + '#title' => t('Proxy port number'), |
|
107 + '#default_value' => variable_get('proxy_port', 8080), |
|
108 + '#description' => t('The port number of the proxy server, eg. 8080'), |
|
109 + ); |
|
110 + $form['forward_proxy']['proxy_username'] = array( |
|
111 + '#type' => 'textfield', |
|
112 + '#title' => t('Proxy username'), |
|
113 + '#default_value' => variable_get('proxy_username', ''), |
|
114 + '#description' => t('The username used to authenticate with the proxy server.'), |
|
115 + ); |
|
116 + $form['forward_proxy']['proxy_password'] = array( |
|
117 + '#type' => 'textfield', |
|
118 + '#title' => t('Proxy password'), |
|
119 + '#default_value' => variable_get('proxy_password', ''), |
|
120 + '#description' => t('The password used to connect to the proxy server. This is kept as plain text.', '') |
|
121 + ); |
|
122 + $form['#validate'][] = 'system_proxy_settings_validate'; |
|
123 + |
|
124 + return system_settings_form($form); |
|
125 +} |
|
126 + |
|
127 +/** |
|
128 + * Validate the submitted proxy form. |
|
129 + */ |
|
130 +function system_proxy_settings_validate($form, &$form_state) { |
|
131 + // Validate the proxy settings |
|
132 + $form_state['values']['proxy_server'] = trim($form_state['values']['proxy_server']); |
|
133 + if ($form_state['values']['proxy_server'] != '') { |
|
134 + // TCP allows the port to be between 0 and 65536 inclusive |
|
135 + if (!is_numeric($form_state['values']['proxy_port'])) { |
|
136 + form_set_error('proxy_port', t('The proxy port is invalid. It must be a number between 0 and 65535.')); |
|
137 + } |
|
138 + elseif ($form_state['values']['proxy_port'] < 0 || $form_state['values']['proxy_port'] >= 65536) { |
|
139 + form_set_error('proxy_port', t('The proxy port is invalid. It must be between 0 and 65535.')); |
|
140 + } |
|
141 + } |
|
142 +} |
|
143 + |
|
144 +/** |
|
145 + * Form builder; Configure the site proxy settings. |
86 + * Form builder; Configure the site proxy settings. |
146 + * |
87 + * |
147 + * @ingroup forms |
88 + * @ingroup forms |
148 + * @see system_settings_form() |
89 + * @see system_settings_form() |
149 + */ |
90 + */ |