Changeset 16588
- Timestamp:
- 06/13/08 08:18:45 (1 year ago)
- Files:
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
branches/MidCOM_2_8/org.routamc.photostream/handler/feed.php
r15371 r16588 63 63 function _can_handle_dispatcher($handler_id, $args) 64 64 { 65 if (!array_key_exists($args[0], $this->_supported_types)) 66 { 65 $args_copy = $args; 66 $type = array_pop($args_copy); 67 $type = str_replace('.xml', '', $type); 68 if (!array_key_exists($type, $this->_supported_types)) 69 { 70 debug_push_class(__CLASS__, __FUNCTION__); 71 debug_add("feed type {$type} is not supported", MIDCOM_LOG_WARN); 72 debug_print_r('$args: ', $args); 73 debug_print_r('$this->_supported_types: ', $this->_supported_types); 74 debug_pop(); 67 75 return false; 68 76 } branches/MidCOM_2_8/org.routamc.photostream/viewer.php
r15522 r16588 361 361 'variable_args' => 0, 362 362 ); 363 364 $this->_request_switch['api-email'] = Array365 (366 'handler' => Array('org_routamc_photostream_handler_api_email', 'import'),367 'fixed_args' => Array('api', 'email'),368 );369 363 370 364 // Handle /sort/<property>/ … … 382 376 'fixed_args' => array('sort'), 383 377 'variable_args' => 2, 378 ); 379 380 // Handle /api/email 381 $this->_request_switch['api-email'] = Array 382 ( 383 'handler' => Array('org_routamc_photostream_handler_api_email', 'import'), 384 'fixed_args' => Array('api', 'email'), 384 385 ); 385 386 … … 504 505 unset($new_id, $new_switch); 505 506 } 507 /* 508 debug_push_class(__CLASS__, __FUNCTION__); 509 debug_print_r('new $this->_request_switch: ', $this->_request_switch); 510 debug_pop(); 511 */ 506 512 } 507 513 … … 509 515 { 510 516 debug_push_class(__CLASS__, __FUNCTION__); 517 debug_print_r('Checking $new_switch: ', $new_switch); 518 if ( ( !isset($new_switch['fixed_args']) 519 || empty($new_switch['fixed_args']) 520 && $new_switch['variable_args'] == 1) 521 ) 522 { 523 // Since we do not want to make hugely elaborate can_handle we just disallow feed handler that would trap the /<feedtype> (preventing subfolders etc) 524 debug_add('$new_switch would trap /<anything>, which is bad, rewriting to /feed/index/<anything>', MIDCOM_LOG_INFO); 525 array_unshift($new_switch['fixed_args'], 'feed', 'index'); 526 debug_print_r('$new_switch after rewrite: ', $new_switch); 527 debug_pop(); 528 return true; 529 } 511 530 foreach ($this->_request_switch as $handler_id => $switch_data) 512 531 {
