933 * @access private |
933 * @access private |
934 */ |
934 */ |
935 |
935 |
936 function _handle_redirect($page_id, $namespace) |
936 function _handle_redirect($page_id, $namespace) |
937 { |
937 { |
|
938 global $db, $session, $paths, $template, $plugins; // Common objects |
938 $arr_pid = array($this->page_id, $this->namespace); |
939 $arr_pid = array($this->page_id, $this->namespace); |
939 if ( $namespace == 'Special' || $namespace == 'Admin' ) |
940 if ( $namespace == 'Special' || $namespace == 'Admin' ) |
940 { |
941 { |
941 return 'This page redirects to a Special or Administration page, which is not allowed.'; |
942 return 'This page redirects to a Special or Administration page, which is not allowed.'; |
942 } |
943 } |
943 if ( in_array($this->redirect_stack, $arr_pid) ) |
944 if ( in_array($this->redirect_stack, $arr_pid) ) |
944 { |
945 { |
945 return 'This page infinitely redirects with another page (or another series of pages), and the infinite redirect was trapped.'; |
946 return 'This page infinitely redirects with another page (or another series of pages), and the infinite redirect was trapped.'; |
946 } |
947 } |
947 $page_id_key = $paths->nslist[ $namespace ] . $page_id; |
948 $page_id_key = $paths->nslist[ $namespace ] . sanitize_page_id($page_id); |
948 if ( !isset($paths->pages[$page_id_key]) ) |
949 if ( !isset($paths->pages[$page_id_key]) ) |
949 { |
950 { |
950 return 'This page redirects to another page that doesn\'t exist.'; |
951 return 'This page redirects to another page that doesn\'t exist.'; |
951 } |
952 } |
952 $this->redirect_stack[] = $arr_pid; |
953 $this->redirect_stack[] = $arr_pid; |