=================================================================== RCS file: /home/cvsd/home/cvs/Metafox/rewrite.php,v retrieving revision 1.2 retrieving revision 1.5 diff -u -p -r1.2 -r1.5 --- Metafox/rewrite.php 2012/05/17 08:57:16 1.2 +++ Metafox/rewrite.php 2012/10/07 15:45:58 1.5 @@ -1,7 +1,7 @@ $id_param)); + if (isset($ar['redirect']) + && $ar['redirect']) + { + ezin_redirect_auto($ar); + } + } + // end redirect for old access-key + require_once $link; } } @@ -117,7 +135,7 @@ if (in_array($link, array('section.php', if ( $ezin_cfg['link_file_type'] != 1 && $ezin_cfg['link_redirect'] > 0) { // redirect - ezin_cgi_parse(); + switch ($link) { case 'section.php': $section_id = Platon::parse_id_param(); @@ -139,6 +157,25 @@ if (in_array($link, array('section.php', } } else { // normal + // redirect for old access-key + $id_param = Platon::parse_id_param(); + switch($link) { + case 'article.php': + $ar = ezin_validate_IDs(array('article_id' => $id_param)); + break; + case 'section.php': + $ar = ezin_validate_IDs(array('section_id' => $id_param)); + break; + case 'author.php': + $ar = ezin_validate_IDs(array('author_id' => $id_param)); + break; + } + if (isset($ar['redirect']) + && $ar['redirect']) + { + ezin_redirect_auto($ar); + } + // end redirect for old access-key require_once $link; } } @@ -159,7 +196,15 @@ if (strlen($link) > 0 if (count($args) == 1 && strlen($args[0]) > 0) { - ezin_redirect_section($args[0]); + $ar = ezin_validate_IDs(array('section_id' => $args[0])); + if (intval($ar['section_id']) > 0) { + ezin_redirect_section($args[0]); + } else { + $ar = ezin_validate_IDs(array('article_id' => $args[0])); + if (intval($ar['article_id']) > 0) { + ezin_redirect_article($args[0]); + } + } } // others, default: article @@ -196,8 +241,22 @@ if (strlen($link) > 0 && strlen($args[0]) > 0) { require_once 'cfgldr.inc.php'; - $ezin_cgi['query_string'][] = $args[0]; - $ezin_cgi['input'] = 'section'; + // redirect for old access-key + $ar = ezin_validate_IDs(array('article_id' => $args[0])); + if (isset($ar['redirect']) + && $ar['redirect']) + { + ezin_redirect_auto($ar); + } + // end redirect for old access-key + + if (intval($ar['article_id']) > 0) { + $ezin_cgi['query_string'] = $args; + $ezin_cgi['input'] = 'article'; + } else { + $ezin_cgi['query_string'] = $args; + $ezin_cgi['input'] = 'section'; + } require_once 'index.php'; } @@ -209,17 +268,36 @@ if (strlen($link) > 0 $showed = false; if (ezin_get_rewrite_key($args[0]) == 'author') { - $ezin_cgi['query_string'][] = $args[1]; + array_shift($args); + // redirect for old access-key + $ar = ezin_validate_IDs(array('author_id' => $args[0])); + if (isset($ar['redirect']) + && $ar['redirect']) + { + ezin_redirect_auto($ar); + } + // end redirect for old access-key + $ezin_cgi['query_string'] = $args; $ezin_cgi['input'] = 'author'; $showed = true; } if (ezin_get_rewrite_key($args[0]) == 'print') { - $ezin_cgi['query_string'][] = $args[1]; + array_shift($args); + $ezin_cgi['query_string'] = $args; $ezin_cgi['input'] = 'print'; $showed = true; } if (!$showed) { - $ezin_cgi['query_string'][] = $args[1]; + array_shift($args); + // redirect for old access-key + $ar = ezin_validate_IDs(array('article_id' => $args[0])); + if (isset($ar['redirect']) + && $ar['redirect']) + { + ezin_redirect_auto($ar); + } + // end redirect for old access-key + $ezin_cgi['query_string'] = $args; $ezin_cgi['input'] = 'article'; }