Changeset 858 for trunk/admin
- Timestamp:
- Sep 3, 2005, 6:36:05 PM (19 years ago)
- Location:
- trunk/admin
- Files:
-
- 1 deleted
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/admin/configuration.php
r849 r858 61 61 case 'general' : 62 62 { 63 // thumbnail prefix must only contain simple ASCII characters64 if (!preg_match('/^[\w-]*$/', $_POST['prefix_thumbnail']))65 {66 array_push($page['errors'], $lang['conf_prefix_thumbnail_error']);67 }68 // mail must be formatted as follows : name@server.com69 $pattern = '/^[\w-]+(\.[\w-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)+$/';70 if (!preg_match($pattern, $_POST['mail_webmaster']))71 {72 array_push($page['errors'], $lang['conf_mail_webmaster_error']);73 }74 63 break; 75 64 } … … 93 82 { 94 83 array_push($page['errors'], $lang['periods_error']); 95 }96 break;97 }98 case 'upload' :99 {100 // the maximum upload filesize must be an integer between 10 and 1000101 if (!preg_match($int_pattern, $_POST['upload_maxfilesize'])102 or $_POST['upload_maxfilesize'] < 10103 or $_POST['upload_maxfilesize'] > 1000)104 {105 array_push($page['errors'], $lang['conf_upload_maxfilesize_error']);106 }107 108 foreach (array('upload_maxwidth',109 'upload_maxheight',110 'upload_maxwidth_thumbnail',111 'upload_maxheight_thumbnail')112 as $field)113 {114 if (!preg_match($int_pattern, $_POST[$field])115 or $_POST[$field] < 10)116 {117 array_push($page['errors'], $lang['conf_'.$field.'_error']);118 }119 84 } 120 85 break; … … 155 120 'L_SUBMIT'=>$lang['submit'], 156 121 'L_RESET'=>$lang['reset'], 122 123 'U_HELP' => PHPWG_ROOT_PATH.'/popuphelp.php?page=configuration', 157 124 158 125 'F_ACTION'=>add_session_id($action) … … 171 138 'general', 172 139 array( 173 'L_CONF_TITLE'=>$lang['conf_general_title'],174 'L_CONF_MAIL'=>$lang['conf_mail_webmaster'],175 'L_CONF_MAIL_INFO'=>$lang['conf_mail_webmaster_info'],176 'L_CONF_TN_PREFIX'=>$lang['conf_prefix'],177 'L_CONF_TN_PREFIX_INFO'=>$lang['conf_prefix_info'],178 'L_CONF_HISTORY'=>$lang['history'],179 'L_CONF_HISTORY_INFO'=>$lang['conf_log_info'],180 'L_CONF_GALLERY_LOCKED'=>$lang['conf_gallery_locked'],181 'L_CONF_GALLERY_LOCKED_INFO'=>$lang['conf_gallery_locked_info'],182 183 'ADMIN_MAIL'=>$conf['mail_webmaster'],184 'THUMBNAIL_PREFIX'=>$conf['prefix_thumbnail'],185 140 'HISTORY_YES'=>$history_yes, 186 141 'HISTORY_NO'=>$history_no, … … 200 155 'comments', 201 156 array( 202 'L_CONF_TITLE'=>$lang['conf_comments_title'],203 'L_CONF_COMMENTS_ALL'=>$lang['conf_comments_forall'],204 'L_CONF_COMMENTS_ALL_INFO'=>$lang['conf_comments_forall_info'],205 'L_CONF_NB_COMMENTS_PAGE'=>$lang['conf_nb_comment_page'],206 'L_CONF_NB_COMMENTS_PAGE_INFO'=>$lang['conf_nb_comment_page'],207 'L_CONF_VALIDATE'=>$lang['conf_comments_validation'],208 'L_CONF_VALIDATE_INFO'=>$lang['conf_comments_validation_info'],209 210 157 'NB_COMMENTS_PAGE'=>$conf['nb_comment_page'], 211 158 'COMMENTS_ALL_YES'=>$all_yes, … … 226 173 'default', 227 174 array( 228 'L_CONF_TITLE'=>$lang['conf_default_title'],229 'L_CONF_LANG'=>$lang['language'],230 'L_CONF_LANG_INFO'=>$lang['conf_default_language_info'],231 'L_NB_IMAGE_LINE'=>$lang['nb_image_per_row'],232 'L_NB_IMAGE_LINE_INFO'=>$lang['conf_nb_image_line_info'],233 'L_NB_ROW_PAGE'=>$lang['nb_row_per_page'],234 'L_NB_ROW_PAGE_INFO'=>$lang['conf_nb_line_page_info'],235 'L_CONF_STYLE'=>$lang['theme'],236 'L_CONF_STYLE_INFO'=>$lang['conf_default_theme_info'],237 'L_CONF_RECENT'=>$lang['recent_period'],238 'L_CONF_RECENT_INFO'=>$lang['conf_recent_period_info'],239 'L_CONF_EXPAND'=>$lang['auto_expand'],240 'L_CONF_EXPAND_INFO'=>$lang['conf_default_expand_info'],241 'L_NB_COMMENTS'=>$lang['show_nb_comments'],242 'L_NB_COMMENTS_INFO'=>$lang['conf_show_nb_comments_info'],243 'L_MAXWIDTH'=>$lang['maxwidth'],244 'L_MAXHEIGHT'=>$lang['maxheight'],245 246 'CONF_LANG_SELECT'=>language_select($conf['default_language'], 'default_language'),247 175 'NB_IMAGE_LINE'=>$conf['nb_image_line'], 248 176 'NB_ROW_PAGE'=>$conf['nb_line_page'], 249 'CONF_STYLE_SELECT'=>style_select($conf['default_template'], 'default_template'),250 177 'CONF_RECENT'=>$conf['recent_period'], 251 178 'NB_COMMENTS_PAGE'=>$conf['nb_comment_page'], … … 255 182 'SHOW_COMMENTS_NO'=>$show_no 256 183 )); 257 break; 258 } 259 case 'upload' : 260 { 261 $template->assign_block_vars( 262 'upload', 263 array( 264 'L_CONF_TITLE'=>$lang['conf_upload_title'], 265 'L_CONF_MAXSIZE'=>$lang['conf_upload_maxfilesize'], 266 'L_CONF_MAXSIZE_INFO'=>$lang['conf_upload_maxfilesize_info'], 267 'L_CONF_MAXWIDTH'=>$lang['conf_upload_maxwidth'], 268 'L_CONF_MAXWIDTH_INFO'=>$lang['conf_upload_maxwidth_info'], 269 'L_CONF_MAXHEIGHT'=>$lang['conf_upload_maxheight'], 270 'L_CONF_MAXHEIGHT_INFO'=>$lang['conf_upload_maxheight_info'], 271 'L_CONF_TN_MAXWIDTH'=>$lang['conf_upload_tn_maxwidth'], 272 'L_CONF_TN_MAXWIDTH_INFO'=>$lang['conf_upload_tn_maxwidth_info'], 273 'L_CONF_TN_MAXHEIGHT'=>$lang['conf_upload_tn_maxheight'], 274 'L_CONF_TN_MAXHEIGHT_INFO'=>$lang['conf_upload_tn_maxheight_info'], 275 276 'UPLOAD_MAXSIZE'=>$conf['upload_maxfilesize'], 277 'UPLOAD_MAXWIDTH'=>$conf['upload_maxwidth'], 278 'UPLOAD_MAXHEIGHT'=>$conf['upload_maxheight'], 279 'TN_UPLOAD_MAXWIDTH'=>$conf['upload_maxwidth_thumbnail'], 280 'TN_UPLOAD_MAXHEIGHT'=>$conf['upload_maxheight_thumbnail'], 281 )); 282 break; 283 } 284 case 'session' : 285 { 286 $authorize_remembering_yes = 287 ($conf['authorize_remembering']=='true')?'checked="checked"':''; 288 $authorize_remembering_no = 289 ($conf['authorize_remembering']=='false')?'checked="checked"':''; 290 291 $template->assign_block_vars( 292 'session', 293 array( 294 'L_CONF_TITLE'=>$lang['conf_session_title'], 295 'L_CONF_AUTHORIZE_REMEMBERING'=>$lang['conf_authorize_remembering'], 296 'L_CONF_AUTHORIZE_REMEMBERING_INFO' => 297 $lang['conf_authorize_remembering_info'], 298 299 'AUTHORIZE_REMEMBERING_YES'=>$authorize_remembering_yes, 300 'AUTHORIZE_REMEMBERING_NO'=>$authorize_remembering_no 301 )); 302 break; 303 } 304 case 'metadata' : 305 { 306 $exif_yes = ($conf['use_exif']=='true')?'checked="checked"':''; 307 $exif_no = ($conf['use_exif']=='false')?'checked="checked"':''; 308 $iptc_yes = ($conf['use_iptc']=='true')?'checked="checked"':''; 309 $iptc_no = ($conf['use_iptc']=='false')?'checked="checked"':''; 310 $show_exif_yes = ($conf['show_exif']=='true')?'checked="checked"':''; 311 $show_exif_no = ($conf['show_exif']=='false')?'checked="checked"':''; 312 $show_iptc_yes = ($conf['show_iptc']=='true')?'checked="checked"':''; 313 $show_iptc_no = ($conf['show_iptc']=='false')?'checked="checked"':''; 314 315 $template->assign_block_vars( 316 'metadata', 317 array( 318 'L_CONF_TITLE'=>$lang['conf_metadata_title'], 319 'L_CONF_EXIF'=>$lang['conf_use_exif'], 320 'L_CONF_EXIF_INFO'=>$lang['conf_use_exif_info'], 321 'L_CONF_IPTC'=>$lang['conf_use_iptc'], 322 'L_CONF_IPTC_INFO'=>$lang['conf_use_iptc_info'], 323 'L_CONF_SHOW_EXIF'=>$lang['conf_show_exif'], 324 'L_CONF_SHOW_EXIF_INFO'=>$lang['conf_show_exif_info'], 325 'L_CONF_SHOW_IPTC'=>$lang['conf_show_iptc'], 326 'L_CONF_SHOW_IPTC_INFO'=>$lang['conf_show_iptc_info'], 327 328 'USE_EXIF_YES'=>$exif_yes, 329 'USE_EXIF_NO'=>$exif_no, 330 'USE_IPTC_YES'=>$iptc_yes, 331 'USE_IPTC_NO'=>$iptc_no, 332 'SHOW_EXIF_YES'=>$show_exif_yes, 333 'SHOW_EXIF_NO'=>$show_exif_no, 334 'SHOW_IPTC_YES'=>$show_iptc_yes, 335 'SHOW_IPTC_NO'=>$show_iptc_no 336 )); 184 185 $blockname = 'default.language_option'; 186 187 foreach (get_languages() as $language_code => $language_name) 188 { 189 if (isset($_POST['submit'])) 190 { 191 $selected = 192 $_POST['default_language'] == $language_code 193 ? 'selected="selected"' : ''; 194 } 195 else if ($conf['default_language'] == $language_code) 196 { 197 $selected = 'selected="selected"'; 198 } 199 else 200 { 201 $selected = ''; 202 } 203 204 $template->assign_block_vars( 205 $blockname, 206 array( 207 'VALUE'=> $language_code, 208 'CONTENT' => $language_name, 209 'SELECTED' => $selected 210 )); 211 } 212 213 $blockname = 'default.template_option'; 214 215 foreach (get_templates() as $pwg_template) 216 { 217 if (isset($_POST['submit'])) 218 { 219 $selected = 220 $_POST['default_template'] == $pwg_template 221 ? 'selected="selected"' : ''; 222 } 223 else if ($conf['default_template'] == $pwg_template) 224 { 225 $selected = 'selected="selected"'; 226 } 227 else 228 { 229 $selected = ''; 230 } 231 232 $template->assign_block_vars( 233 $blockname, 234 array( 235 'VALUE'=> $pwg_template, 236 'CONTENT' => $pwg_template, 237 'SELECTED' => $selected 238 ) 239 ); 240 } 241 242 337 243 break; 338 244 } -
trunk/admin/include/functions.php
r833 r858 365 365 // deletion of calculated permissions linked to the user 366 366 $query = ' 367 DELETE FROM '.USER_ FORBIDDEN_TABLE.'367 DELETE FROM '.USER_CACHE_TABLE.' 368 368 WHERE user_id = '.$user_id.' 369 369 ;'; -
trunk/admin/include/functions_metadata.php
r825 r858 28 28 include_once(PHPWG_ROOT_PATH.'/include/functions_metadata.inc.php'); 29 29 30 $page['datefields'] = array('date_creation', 'date_available'); 31 30 32 function get_sync_iptc_data($file) 31 33 { 32 global $conf ;34 global $conf, $page; 33 35 34 36 $map = $conf['use_iptc_mapping']; 35 $datefields = array('date_creation', 'date_available');36 37 37 38 $iptc = get_iptc_data($file, $map); … … 39 40 foreach ($iptc as $pwg_key => $value) 40 41 { 41 if (in_array($pwg_key, $ datefields))42 if (in_array($pwg_key, $page['datefields'])) 42 43 { 43 44 if (preg_match('/(\d{4})(\d{2})(\d{2})/', $value, $matches)) … … 60 61 } 61 62 63 function get_sync_exif_data($file) 64 { 65 global $conf, $page; 66 67 $exif = get_exif_data($file, $conf['use_exif_mapping']); 68 69 foreach ($exif as $pwg_key => $value) 70 { 71 if (in_array($pwg_key, $page['datefields'])) 72 { 73 if (preg_match('/^(\d{4}).(\d{2}).(\d{2})/', $value, $matches)) 74 { 75 $exif[$pwg_key] = $matches[1].'-'.$matches[2].'-'.$matches[3]; 76 } 77 } 78 } 79 80 return $exif; 81 } 82 62 83 function update_metadata($files) 63 84 { … … 85 106 if ($conf['use_exif']) 86 107 { 87 if (!function_exists('read_exif_data')) 88 { 89 die('Exif extension not available, admin should disable exif use'); 90 } 91 92 if ($exif = @read_exif_data($file)) 93 { 94 if (isset($exif['DateTime'])) 108 $exif = get_sync_exif_data($file); 109 110 if (count($exif) > 0) 111 { 112 foreach (array_keys($exif) as $key) 95 113 { 96 preg_match('/^(\d{4}).(\d{2}).(\d{2})/',$exif['DateTime'],$matches); 97 $data['date_creation'] = $matches[1].'-'.$matches[2].'-'.$matches[3]; 114 $data[$key] = addslashes($exif[$key]); 98 115 } 99 116 } … … 129 146 array_keys($conf['use_iptc_mapping'])); 130 147 } 131 148 132 149 $fields = array('primary' => array('id'), 133 150 'update' => array_unique($update_fields)); -
trunk/admin/maintenance.php
r833 r858 104 104 'U_MAINT_SESSIONS' => add_session_id($start_url.'sessions'), 105 105 'U_MAINT_FEEDS' => add_session_id($start_url.'feeds'), 106 'U_HELP' => PHPWG_ROOT_PATH.'/popuphelp.php?page=maintenance', 106 107 ) 107 108 ); -
trunk/admin/remote_site.php
r801 r858 513 513 'L_REMOTE_SITE_LOCAL_NEW'=>$lang['remote_site_local_new'], 514 514 'L_REMOTE_SITE_LOCAL_UPDATE'=>$lang['remote_site_local_update'], 515 516 'U_HELP' => PHPWG_ROOT_PATH.'/popuphelp.php?page=remote_site', 515 517 516 518 'F_ACTION'=>add_session_id(PHPWG_ROOT_PATH.'admin.php?page=remote_site') 517 519 ) 518 520 ); 521 519 522 // +-----------------------------------------------------------------------+ 520 523 // | new site creation form | -
trunk/admin/update.php
r801 r858 574 574 'METADATA_LIST' => $used_metadata 575 575 )); 576 577 $template->assign_vars( 578 array( 579 'U_HELP' => PHPWG_ROOT_PATH.'/popuphelp.php?page=synchronize' 580 ) 581 ); 576 582 // +-----------------------------------------------------------------------+ 577 583 // | introduction : choices | -
trunk/admin/user_list.php
r850 r858 50 50 51 51 // +-----------------------------------------------------------------------+ 52 // | preferences form submission|53 // +-----------------------------------------------------------------------+ 54 55 if (isset($_POST[' pref_submit']))52 // | selected users | 53 // +-----------------------------------------------------------------------+ 54 55 if (isset($_POST['delete']) or isset($_POST['pref_submit'])) 56 56 { 57 57 $collection = array(); … … 79 79 } 80 80 81 if (count($collection) > 0) 82 { 83 if (-1 != $_POST['associate']) 84 { 85 $datas = array(); 86 87 $query = ' 81 if (count($collection) == 0) 82 { 83 array_push($page['errors'], l10n('Select at least one user')); 84 } 85 } 86 87 // +-----------------------------------------------------------------------+ 88 // | delete users | 89 // +-----------------------------------------------------------------------+ 90 91 if (isset($_POST['delete']) and count($collection) > 0) 92 { 93 if (in_array($conf['webmaster_id'], $collection)) 94 { 95 array_push($page['errors'], l10n('Webmaster cannot be deleted')); 96 } 97 else 98 { 99 if (isset($_POST['confirm_deletion']) and 1 == $_POST['confirm_deletion']) 100 { 101 foreach ($collection as $user_id) 102 { 103 delete_user($user_id); 104 } 105 array_push( 106 $page['infos'], 107 sprintf( 108 l10n('%d users deleted'), 109 count($collection) 110 ) 111 ); 112 } 113 else 114 { 115 array_push($page['errors'], l10n('You need to confirm deletion')); 116 } 117 } 118 } 119 120 // +-----------------------------------------------------------------------+ 121 // | preferences form submission | 122 // +-----------------------------------------------------------------------+ 123 124 if (isset($_POST['pref_submit']) and count($collection) > 0) 125 { 126 if (-1 != $_POST['associate']) 127 { 128 $datas = array(); 129 130 $query = ' 88 131 SELECT user_id 89 132 FROM '.USER_GROUP_TABLE.' 90 133 WHERE group_id = '.$_POST['associate'].' 91 134 ;'; 92 $associated = array_from_query($query, 'user_id'); 93 94 $associable = array_diff($collection, $associated); 95 96 if (count($associable) > 0) 135 $associated = array_from_query($query, 'user_id'); 136 137 $associable = array_diff($collection, $associated); 138 139 if (count($associable) > 0) 140 { 141 foreach ($associable as $item) 97 142 { 98 foreach ($associable as $item) 99 { 100 array_push($datas, 101 array('group_id'=>$_POST['associate'], 102 'user_id'=>$item)); 103 } 143 array_push($datas, 144 array('group_id'=>$_POST['associate'], 145 'user_id'=>$item)); 146 } 104 147 105 106 107 108 109 110 111 112 113 148 mass_inserts(USER_GROUP_TABLE, 149 array('group_id', 'user_id'), 150 $datas); 151 } 152 } 153 154 if (-1 != $_POST['dissociate']) 155 { 156 $query = ' 114 157 DELETE FROM '.USER_GROUP_TABLE.' 115 158 WHERE group_id = '.$_POST['dissociate'].' 116 159 AND user_id IN ('.implode(',', $collection).') 117 160 '; 118 pwg_query($query); 119 } 120 121 // properties to set for the collection (a user list) 161 pwg_query($query); 162 } 163 164 // properties to set for the collection (a user list) 165 $datas = array(); 166 $dbfields = array('primary' => array('user_id'), 'update' => array()); 167 168 $formfields = 169 array('nb_image_line', 'nb_line_page', 'template', 'language', 170 'recent_period', 'maxwidth', 'expand', 'show_nb_comments', 171 'maxheight', 'status'); 172 173 $true_false_fields = array('expand', 'show_nb_comments'); 174 175 foreach ($formfields as $formfield) 176 { 177 // special for true/false fields 178 if (in_array($formfield, $true_false_fields)) 179 { 180 $test = $formfield; 181 } 182 else 183 { 184 $test = $formfield.'_action'; 185 } 186 187 if ($_POST[$test] != 'leave') 188 { 189 array_push($dbfields['update'], $formfield); 190 } 191 } 192 193 // updating elements is useful only if needed... 194 if (count($dbfields['update']) > 0) 195 { 122 196 $datas = array(); 123 $dbfields = array('primary' => array('user_id'), 'update' => array()); 124 125 $formfields = 126 array('nb_image_line', 'nb_line_page', 'template', 'language', 127 'recent_period', 'maxwidth', 'expand', 'show_nb_comments', 128 'maxheight', 'status'); 129 130 $true_false_fields = array('expand', 'show_nb_comments'); 131 132 foreach ($formfields as $formfield) 133 { 134 // special for true/false fields 135 if (in_array($formfield, $true_false_fields)) 197 198 foreach ($collection as $user_id) 199 { 200 $data = array(); 201 $data['user_id'] = $user_id; 202 203 // TODO : verify if submited values are semanticaly correct 204 foreach ($dbfields['update'] as $dbfield) 136 205 { 137 $test = $formfield; 206 // if the action is 'unset', the key won't be in row and 207 // mass_updates function will set this field to NULL 208 if (in_array($dbfield, $true_false_fields) 209 or 'set' == $_POST[$dbfield.'_action']) 210 { 211 $data[$dbfield] = $_POST[$dbfield]; 212 } 138 213 } 139 else 214 215 // Webmaster status must not be changed 216 if ($conf['webmaster_id'] == $user_id and isset($data['status'])) 140 217 { 141 $ test = $formfield.'_action';218 $data['status'] = 'admin'; 142 219 } 143 144 if ($_POST[$test] != 'leave')145 {146 array_push($dbfields['update'], $formfield);147 }148 }149 150 // updating elements is useful only if needed...151 if (count($dbfields['update']) > 0)152 {153 $datas = array();154 220 155 foreach ($collection as $user_id) 156 { 157 $data = array(); 158 $data['user_id'] = $user_id; 159 160 // TODO : verify if submited values are semanticaly correct 161 foreach ($dbfields['update'] as $dbfield) 162 { 163 // if the action is 'unset', the key won't be in row and 164 // mass_updates function will set this field to NULL 165 if (in_array($dbfield, $true_false_fields) 166 or 'set' == $_POST[$dbfield.'_action']) 167 { 168 $data[$dbfield] = $_POST[$dbfield]; 169 } 170 } 171 172 // Webmaster (user_id = 1) status must not be changed 173 if (1 == $user_id and isset($data['status'])) 174 { 175 $data['status'] = 'admin'; 176 } 177 178 array_push($datas, $data); 179 } 180 221 array_push($datas, $data); 222 } 223 181 224 // echo '<pre>'; 182 225 // print_r($datas); 183 226 // echo '</pre>'; 184 185 mass_updates(USER_INFOS_TABLE, $dbfields, $datas); 186 } 187 } 188 else 189 { 190 array_push($page['errors'], l10n('Select at least one user')); 227 228 mass_updates(USER_INFOS_TABLE, $dbfields, $datas); 191 229 } 192 230 }
Note: See TracChangeset
for help on using the changeset viewer.