$search = array ("/index.php\?pid=([0-9]+)((&)|(&)){0,1}([^>]+>)(.*?)<\/a>/e",
'@index.php\?ind=downloads&op=section_view&idev=([0-9]+)&order=&st=([0-9]+)@si',
'@index.php\?ind=downloads&op=section_view&idev=([0-9]+)@si',
'@index.php\?ind=downloads&op=entry_view&iden=([0-9]+)@si',
'@index.php\?ind=downloads&op=submit_file@si',
'@index.php\?ind=downloads&op=add_file@si',
'@index.php\?ind=downloads&op=update_file&iden=([0-9]+)@si',
'@index.php\?ind=downloads&op=search@si',
'@index.php\?ind=downloads&op=result_search@si',
'@index.php\?ind=downloads&op=submit_comment&ide=([0-9]+)@si',
'@index.php\?ind=downloads&op=submit_rate&ide=([0-9]+)@si',
'@index.php\?ind=downloads&op=edit_file&iden=([0-9]+)@si',
'@index.php\?ind=downloads&op=del_file&iden=([0-9]+)@si',
'@index.php\?ind=gallery&op=section_view&idev=([0-9]+)&order=&st=([0-9]+)@si',
'@index.php\?ind=gallery&op=section_view&idev=([0-9]+)@si',
'@index.php\?ind=gallery&op=foto_show&ida=([0-9]+)@si',
'@index.php\?ind=gallery&op=search@si',
'@index.php\?ind=gallery&op=result_search@si',
'@index.php\?ind=gallery&op=slide_start@si',
'@index.php\?ind=gallery&op=add_file@si',
'@index.php\?ind=gallery&op=update_file&iden=([0-9]+)@si',
'@index.php\?ind=gallery&op=submit_file@si',
'@index.php\?ind=gallery&op=submit_postcard&ide=([0-9]+)@si',
'@index.php\?ind=gallery&op=submit_comment&ide=([0-9]+)@si',
'@index.php\?ind=gallery&op=submit_rate&ide=([0-9]+)@si',
'@index.php\?ind=gallery&op=edit_file&iden=([0-9]+)@si',
'@index.php\?ind=gallery&op=del_file&iden=([0-9]+)@si',
'@index.php\?ind=news&op=news_show_category&idc=([0-9]+)&st=([0-9]+)@si',
'@index.php\?ind=news&op=news_show_category&idc=([0-9]+)@si',
'@index.php\?ind=news&op=news_show_single&ide=([0-9]+)@si',
'@index.php\?ind=news&op=submit_news@si',
'@index.php\?ind=news&op=reg_data@si',
'@index.php\?ind=news&op=update_news&idnews=([0-9]+)@si',
'@index.php\?ind=news&op=search@si',
'@index.php\?ind=news&op=result_search@si',
'@index.php\?ind=news&op=edit&idnews=([0-9]+)@si',
'@index.php\?ind=news&op=delete&idnews=([0-9]+)@si',
'@index.php\?ind=news&op=submit_comment&idnews=([0-9]+)@si',
'@index.php\?ind=topsite&op=click_site&idb=([0-9]+)@si',
'@index.php\?ind=topsite&op=submit_rate&ide=([0-9]+)@si',
'@index.php\?ind=topsite&op=submit_site@si',
'@index.php\?ind=reviews&op=section_view&idev=([0-9]+)&order=&st=([0-9]+)@si',
'@index.php\?ind=reviews&op=section_view&idev=([0-9]+)@si',
'@index.php\?ind=reviews&op=entry_view&iden=([0-9]+)@si',
'@index.php\?ind=reviews&op=result_search@si',
'@index.php\?ind=reviews&op=search@si',
'@index.php\?ind=reviews&op=add_file@si',
'@index.php\?ind=reviews&op=update_file&iden=([0-9]+)@si',
'@index.php\?ind=reviews&op=submit_file1@si',
'@index.php\?ind=reviews&op=submit_file@si',
'@index.php\?ind=reviews&op=submit_rate&ide=([0-9]+)@si',
'@index.php\?ind=reviews&op=edit_file&iden=([0-9]+)@si',
'@index.php\?ind=reviews&op=del_file&iden=([0-9]+)@si',
'@index.php\?ind=reviews&op=submit_comment&ide=([0-9]+)@si',
'@index.php\?ind=reviews&order=([0-9]+)@si',
'@index.php\?ind=blog&op=home&idu=([0-9]+)@si',
'@index.php\?ind=poll&op=poll_show&poll_id=([0-9]+)@si',
'@index.php\?ind=poll&op=poll_result&poll_id=([0-9]+)@si',
'@index.php\?ind=poll&op=del_comment&idcomm=([0-9]+)&ide=([0-9]+)@si',
'@index.php\?ind=poll&op=add_comment@si',
'@index.php\?ind=poll&op=poll_save@si',
'@index.php\?ind=poll@si',
);
$replace = array ("rewrite_url('\\6').'-page-\\1.html'. stripslashes('\\5\\6') . '</a>'",
'downloads-section-\\1-\\2.html',
'downloads-section-\\1.html',
'downloads-file-\\1.html',
'downloads-submit.html',
'downloads-addfile.html',
'downloads-editfile-\\1.html',
'downloads-search.html',
'downloads-searchresult.html',
'downloads-comment-\\1.html',
'downloads-rate-\\1.html',
'downloads-edit-\\1.html',
'downloads-delete-\\1.html',
'gallery-section-\\1-\\2.html',
'gallery-section-\\1.html',
'gallery-image-\\1.html',
'gallery-search.html',
'gallery-searchresult.html',
'gallery-present.html',
'gallery-addfile.html',
'gallery-editfile-\\1.html',
'gallery-submit.html',
'gallery-ecard-\\1.html',
'gallery-comment-\\1.html',
'gallery-rate-\\1.html',
'gallery-edit-\\1.html',
'gallery-delete-\\1.html',
'news-section-\\1-\\2.html',
'news-section-\\1.html',
'news-\\1.html',
'news-submit.html',
'news-addnews.html',
'news-editnews-\\1.html',
'news-search.html',
'news-searchresult.html',
'news-edit-\\1.html',
'news-delete-\\1.html',
'news-comment-\\1.html',
'site-\\1.html',
'rate-site-\\1.html',
'topsite-submit.html',
'reviews-section-\\1-\\2.html',
'reviews-section-\\1.html',
'reviews-\\1.html',
'reviews-searchresult.html',
'reviews-search.html',
'reviews-addfile.html',
'reviews-editfile-\\1.html',
'reviews-submitfile.html',
'reviews-submit.html',
'reviews-rate-\\1.html',
'reviews-edit-\\1.html',
'reviews-delete-\\1.html',
'reviews-comment-\\1.html',
'reviews-sectionorder-\\1.html',
'blog-\\1.html',
'poll-show-\\1.html',
'poll-result-\\1.html',
'poll-deletecom-\\1-\\2.html',
'poll-addcoment.html',
'poll-save.html',
'poll\\1.html',
);
$output = preg_replace($search, $replace, $content);
return $output;