Changeset 2260 for trunk/admin
- Timestamp:
- Mar 7, 2008, 3:07:55 AM (16 years ago)
- Location:
- trunk/admin
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/admin/upload.php
r1915 r2260 3 3 // | PhpWebGallery - a PHP based picture gallery | 4 4 // | Copyright (C) 2002-2003 Pierrick LE GALL - pierrick@phpwebgallery.net | 5 // | Copyright (C) 2003-200 7PhpWebGallery Team - http://phpwebgallery.net |5 // | Copyright (C) 2003-2008 PhpWebGallery Team - http://phpwebgallery.net | 6 6 // +-----------------------------------------------------------------------+ 7 7 // | file : $Id$ … … 144 144 waiting_tabsheet(); 145 145 146 $template->assign _vars(array(146 $template->assign(array( 147 147 'F_ACTION'=>str_replace( '&', '&', $_SERVER['REQUEST_URI']) 148 148 )); … … 157 157 $query.= ';'; 158 158 $result = pwg_query( $query ); 159 $i = 0;160 159 while ( $row = mysql_fetch_array( $result ) ) 161 160 { … … 170 169 } 171 170 $preview_url = PHPWG_ROOT_PATH.$cat_names[$row['storage_category_id']]['dir'].$row['file']; 172 $class='row1'; 173 if ( $i++ % 2== 0 ) $class='row2'; 174 175 $template->assign_block_vars( 176 'picture', 171 172 $tpl_var = 177 173 array( 178 'WAITING_CLASS'=>$class,179 174 'CATEGORY_IMG'=>$cat_names[$row['storage_category_id']]['display_name'], 180 175 'ID_IMG'=>$row['id'], … … 187 182 'UPLOAD_EMAIL'=>get_email_address_as_display_text($row['mail_address']), 188 183 'UPLOAD_USERNAME'=>$row['username'] 189 )190 184 ); 191 185 … … 199 193 $url.= 'thumbnail/'.$thumbnail; 200 194 201 $template->assign_block_vars( 202 'picture.thumbnail', 195 $tpl_var['thumbnail'] = 203 196 array( 204 197 'PREVIEW_URL_TN_IMG' => $url, … … 207 200 (substr($thumbnail, 0, 10)).'...' : $thumbnail, 208 201 'FILE_TN_TITLE' => $thumbnail 209 )210 202 ); 211 203 } 212 204 $template->append('pictures', $tpl_var); 213 205 array_push($list, $row['id']); 214 206 } 215 207 216 $template->assign_vars( 217 array( 218 'LIST' => implode(',', $list) 219 ) 220 ); 208 $template->assign('LIST',implode(',', $list) ); 221 209 222 210 //----------------------------------------------------------- sending html code -
trunk/admin/ws_checker.php
r2201 r2260 3 3 // | PhpWebGallery - a PHP based picture gallery | 4 4 // | Copyright (C) 2002-2003 Pierrick LE GALL - pierrick@phpwebgallery.net | 5 // | Copyright (C) 2003-2007 PhpWebGallery Team - http://phpwebgallery.net | 6 // +-----------------------------------------------------------------------+ 7 // | branch : BSF (Best So Far) 8 // | file : $RCSfile$ 5 // | Copyright (C) 2003-2008 PhpWebGallery Team - http://phpwebgallery.net | 6 // +-----------------------------------------------------------------------+ 7 // | file : $Id$ 9 8 // | last update : $Date$ 10 9 // | last modifier : $Author$ … … 155 154 $chk_partner = $add_partner; 156 155 157 $template->assign_block_vars( 158 'update_result', 159 array( 160 'UPD_ELEMENT'=> l10n('ws_adding_legend').l10n('ws_success_upd'), 161 ) 156 $template->append( 157 'update_results', 158 l10n('ws_adding_legend').l10n('ws_success_upd') 162 159 ); 163 160 } … … 177 174 WHERE id = '.$uid.'; '; 178 175 pwg_query($query); 179 $template->assign_block_vars( 180 'update_result', 181 array( 182 'UPD_ELEMENT'=> l10n('ws_update_legend').l10n('ws_success_upd'), 183 ) 176 $template->append( 177 'update_results', 178 l10n('ws_update_legend').l10n('ws_success_upd') 184 179 ); 185 180 } else { 186 $template->assign_block_vars( 187 'update_result', 188 array( 189 'UPD_ELEMENT'=> l10n('ws_update_legend').l10n('ws_failed_upd'), 190 ) 181 $template->append( 182 'update_results', 183 l10n('ws_update_legend').l10n('ws_failed_upd') 191 184 ); 192 185 } … … 203 196 WHERE id = '.$uid.'; '; 204 197 pwg_query($query); 205 $template->assign_block_vars( 206 'update_result', 207 array( 208 'UPD_ELEMENT'=> l10n('ws_delete_legend').l10n('ws_success_upd'), 209 ) 198 $template->append( 199 'update_results', 200 l10n('ws_delete_legend').l10n('ws_success_upd') 210 201 ); 211 202 } else { 212 $template->assign_block_vars( 213 'update_result', 214 array( 215 'UPD_ELEMENT'=> l10n('Not selected / Not confirmed') 216 .l10n('ws_failed_upd'), 217 ) 203 $template->append( 204 'update_results', 205 l10n('Not selected / Not confirmed').l10n('ws_failed_upd') 218 206 ); 219 207 } … … 253 241 ); 254 242 255 $selected = 'selected="selected"';256 $num=0;257 if ( $acc_list > 0 )258 {259 $template->assign_block_vars(260 'acc_list', array() );261 }262 243 263 244 // Access List 264 245 while ($row = mysql_fetch_array($result)) 265 246 { 266 $num++;267 247 $chk_partner = ( $chk_partner == '' ) ? $row['name'] : $chk_partner; 268 $template->a ssign_block_vars(269 'acc _list.access',248 $template->append( 249 'access_list', 270 250 array( 271 'CLASS' => ($num % 2 == 1) ? 'row1' : 'row2',272 251 'ID' => $row['id'], 273 252 'NAME' => … … 278 257 'LIMIT' => $row['limit'], 279 258 'COMMENT' => $row['comment'], 280 'SELECTED' => '',281 259 ) 282 260 ); 283 261 } 284 262 285 $template->assign_block_vars( 286 'add_request', 287 array( 288 'VALUE'=> '', 289 'CONTENT' => '', 290 'SELECTED' => $selected, 291 ) 292 ); 293 foreach ($req_type_list as $value) { 294 295 $template->assign_block_vars( 296 'add_request', 297 array( 298 'VALUE'=> $value, 299 'CONTENT' => $value, 300 'SELECTED' => '', 301 ) 302 ); 303 } 304 305 foreach ($conf['ws_allowed_limit'] as $value) { 306 $template->assign_block_vars( 307 'add_limit', 308 array( 309 'VALUE'=> $value, 310 'CONTENT' => $value, 311 'SELECTED' => ($conf['ws_allowed_limit'][0] == $value) ? $selected:'', 312 ) 313 ); 314 } 263 $template->assign('add_requests', $req_type_list); 264 265 $template->assign('add_limits', $conf['ws_allowed_limit'] ); 315 266 316 267 // Postponed Start Date 317 268 // By default 0, 1, 2, 3, 5, 7, 14 or 30 days 318 foreach ($conf['ws_postponed_start'] as $value) {269 /*foreach ($conf['ws_postponed_start'] as $value) { 319 270 $template->assign_block_vars( 320 271 'add_start', … … 325 276 ) 326 277 ); 327 } 278 }*/ 328 279 329 280 // Durations (Allowed Web Services Period) 330 281 // By default 10, 5, 2, 1 year(s) or 6, 3, 1 month(s) or 15, 10, 7, 5, 1, 0 day(s) 331 foreach ($conf['ws_durations'] as $value) { 332 $template->assign_block_vars( 333 'add_end', 334 array( 335 'VALUE'=> $value, 336 'CONTENT' => $value, 337 'SELECTED' => ($conf['ws_durations'][3] == $value) ? $selected:'', 338 ) 339 ); 340 if ( $acc_list > 0 ) 341 { 342 $template->assign_block_vars( 343 'acc_list.upd_end', 344 array( 345 'VALUE'=> $value, 346 'CONTENT' => $value, 347 'SELECTED' => ($conf['ws_durations'][3] == $value) ? $selected:'', 348 ) 349 ); 350 } 351 } 282 $template->assign('add_ends', $conf['ws_durations']); 283 352 284 if ( $chk_partner !== '' ) 353 285 { 354 $request = get_absolute_root_url().'ws.php?method=pwg.getVersion&format=rest&' 355 . "partner=$chk_partner" ; 356 $session = curl_init($request); 357 curl_setopt ($session, CURLOPT_POST, true); 358 curl_setopt($session, CURLOPT_HEADER, true); 359 curl_setopt($session, CURLOPT_RETURNTRANSFER, true); 360 $response = curl_exec($session); 361 curl_close($session); 362 $status_code = array(); 363 preg_match('/\d\d\d/', $response, $status_code); 364 switch( $status_code[0] ) { 365 case 200: 366 $ws_status = l10n('Web Services under control'); 367 break; 368 case 503: 369 $ws_status = 'PhpWebGallery Web Services failed and returned an ' 370 . 'HTTP status of 503. Service is unavailable. An internal ' 371 . 'problem prevented us from returning data to you.'; 372 break; 373 case 403: 374 $ws_status = 'PhpWebGallery Web Services failed and returned an ' 375 . 'HTTP status of 403. Access is forbidden. You do not have ' 376 . 'permission to access this resource, or are over ' 377 . 'your rate limit.'; 378 break; 379 case 400: 380 // You may want to fall through here and read the specific XML error 381 $ws_status = 'PhpWebGallery Web Services failed and returned an ' 382 . 'HTTP status of 400. Bad request. The parameters passed ' 383 . 'to the service did not match as expected. The exact ' 384 . 'error is returned in the XML response.'; 385 break; 386 default: 387 $ws_status = 'PhpWebGallery Web Services returned an unexpected HTTP ' 388 . 'status of:' . $status_code[0]; 389 } 390 $template->assign_block_vars( 391 'acc_list.ws_status', 392 array( 393 'VALUE'=> $ws_status, 394 ) 395 ); 286 if (function_exists('curl_init')) 287 { 288 $request = get_absolute_root_url().'ws.php?method=pwg.getVersion&format=rest&' 289 . "partner=$chk_partner" ; 290 $session = curl_init($request); 291 curl_setopt ($session, CURLOPT_POST, true); 292 curl_setopt($session, CURLOPT_HEADER, true); 293 curl_setopt($session, CURLOPT_RETURNTRANSFER, true); 294 $response = curl_exec($session); 295 curl_close($session); 296 $status_code = array(); 297 preg_match('/\d\d\d/', $response, $status_code); 298 switch( $status_code[0] ) { 299 case 200: 300 $ws_status = l10n('Web Services under control'); 301 break; 302 case 503: 303 $ws_status = 'PhpWebGallery Web Services failed and returned an ' 304 . 'HTTP status of 503. Service is unavailable. An internal ' 305 . 'problem prevented us from returning data to you.'; 306 break; 307 case 403: 308 $ws_status = 'PhpWebGallery Web Services failed and returned an ' 309 . 'HTTP status of 403. Access is forbidden. You do not have ' 310 . 'permission to access this resource, or are over ' 311 . 'your rate limit.'; 312 break; 313 case 400: 314 // You may want to fall through here and read the specific XML error 315 $ws_status = 'PhpWebGallery Web Services failed and returned an ' 316 . 'HTTP status of 400. Bad request. The parameters passed ' 317 . 'to the service did not match as expected. The exact ' 318 . 'error is returned in the XML response.'; 319 break; 320 default: 321 $ws_status = 'PhpWebGallery Web Services returned an unexpected HTTP ' 322 . 'status of:' . $status_code[0]; 323 } 324 } 325 else 326 { 327 $ws_status = 'Cannot check - curl not installed'; 328 } 329 $template->assign( 'WS_STATUS', $ws_status ); 396 330 } 397 331
Note: See TracChangeset
for help on using the changeset viewer.