Changeset 7780 for extensions
- Timestamp:
- Nov 14, 2010, 9:50:00 PM (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
extensions/pwg_images_addSimple/main.inc.php
r7566 r7780 90 90 } 91 91 92 prepare_upload_configuration(); 93 92 94 include_once(PHPWG_ROOT_PATH.'admin/include/functions_upload.inc.php'); 93 95 94 96 $image_id = add_uploaded_file( 95 97 $_FILES['image']['tmp_name'], … … 162 164 ), 163 165 ); 166 } 167 168 // this function should not be here, this is a code duplication from 169 // admin/photos_add.php, unfortunately pwg.images.addSimple needs upload 170 // settings to be defined 171 function prepare_upload_configuration() 172 { 173 global $conf; 174 175 // automatic fill of configuration parameters 176 $upload_form_config = array( 177 'websize_resize' => array( 178 'default' => true, 179 'can_be_null' => false, 180 ), 181 182 'websize_maxwidth' => array( 183 'default' => 800, 184 'min' => 100, 185 'max' => 1600, 186 'pattern' => '/^\d+$/', 187 'can_be_null' => true, 188 'error_message' => l10n('The websize maximum width must be a number between %d and %d'), 189 ), 190 191 'websize_maxheight' => array( 192 'default' => 600, 193 'min' => 100, 194 'max' => 1200, 195 'pattern' => '/^\d+$/', 196 'can_be_null' => true, 197 'error_message' => l10n('The websize maximum height must be a number between %d and %d'), 198 ), 199 200 'websize_quality' => array( 201 'default' => 95, 202 'min' => 50, 203 'max' => 100, 204 'pattern' => '/^\d+$/', 205 'can_be_null' => false, 206 'error_message' => l10n('The websize image quality must be a number between %d and %d'), 207 ), 208 209 'thumb_maxwidth' => array( 210 'default' => 128, 211 'min' => 50, 212 'max' => 300, 213 'pattern' => '/^\d+$/', 214 'can_be_null' => false, 215 'error_message' => l10n('The thumbnail maximum width must be a number between %d and %d'), 216 ), 217 218 'thumb_maxheight' => array( 219 'default' => 96, 220 'min' => 50, 221 'max' => 300, 222 'pattern' => '/^\d+$/', 223 'can_be_null' => false, 224 'error_message' => l10n('The thumbnail maximum height must be a number between %d and %d'), 225 ), 226 227 'thumb_quality' => array( 228 'default' => 95, 229 'min' => 50, 230 'max' => 100, 231 'pattern' => '/^\d+$/', 232 'can_be_null' => false, 233 'error_message' => l10n('The thumbnail image quality must be a number between %d and %d'), 234 ), 235 ); 236 237 $inserts = array(); 238 239 foreach ($upload_form_config as $param_shortname => $param) 240 { 241 $param_name = 'upload_form_'.$param_shortname; 242 243 if (!isset($conf[$param_name])) 244 { 245 $param_value = boolean_to_string($param['default']); 246 247 array_push( 248 $inserts, 249 array( 250 'param' => $param_name, 251 'value' => $param_value, 252 ) 253 ); 254 $conf[$param_name] = $param_value; 255 } 256 } 257 258 if (count($inserts) > 0) 259 { 260 include_once(PHPWG_ROOT_PATH.'admin/include/functions.php'); 261 mass_inserts( 262 CONFIG_TABLE, 263 array_keys($inserts[0]), 264 $inserts 265 ); 266 } 164 267 } 165 268
Note: See TracChangeset
for help on using the changeset viewer.