{$string_hsc} downloads{$platform_hsc}{$category_hsc}{$sort_hsc} - DownloadPipe ENDH; $header_text = "$string_hsc downloads{$sort_hsc}{$mode}"; include_once('header3.php'); $smarty = newSmarty(); $smarty->assign( 'string', $string ); if ($category != '') { $smarty->assign( 'category', $category ); } $smarty->assign( 'platform', $platform ); if ($string <> '') $smarty->assign( 'page', "Search software downloads for \"$string\" " ); else $smarty->assign( 'page', "Search $platform $category" ); // $res = $smarty->fetch( 'breadcrumbs.tpl' ); echo reduce_text($res); echo << ENDH; //
} //do header //now check for recent cache - use cache exclusively if we cannot access db cache_lite_create( $cache, 'search', 24*60*60 ); $waiting = 0; $res = ''; if ( (isset($_GET['force']) && ($_GET['force'] == '') ) || (isset($_GET['nocache']) && ($_GET['nocache'] == '1') ) ) while(1) { $res = $cache->get( "{$string}, {$search}, {$match}, {$platform}, {$category}, {$sort}{$page}{$display}" ); if ($res == 'pending') { //check how old it is - might have timed out before completing $seconds_ago = time() - $cache->lastModified(); if ($seconds_ago > 3*60) { $res = ''; break; } //wait for longer if result is still pending $waiting++; if ($waiting > 10) { $res = ''; break; } echo "Waiting for results...
\n"; flush(); sleep(1); } else break; } try { // get_db_slave( $link_id_slave ); get_db( $link_id_slave ); $link_id = $link_id_slave; $db_failed = 0; } catch (Exception $e) { $db_failed = 24*60*60; } if (($res != '') && ($_GET['nocache'] == '') && ($_GET['force'] == '')) { header("Last-Modified: " . gmdate("D, d M Y H:i:s", $cache->lastModified() ) . " GMT", true); header("x-from-cache: true" ); do_header(); echo $res; //only update search stats if we have a db connection if ($db_failed == 0) { if ( empty($page) && !is_robot() && ($string <> '') ) record_search( 'searches', $string, $link_id ); } } else if ($db_failed == 0) { header("Last-Modified: " . gmdate("D, d M Y H:i:s", time() ) . " GMT", true); header("x-from-cache: false" ); do_header(); $cache->save('pending'); $res = searchresults( $string, $search, $match, $platform, $category, $sort ); $res = reduce_text($res); $cache->save($res); $res = substitute_before_display( $res ); substitute_header_code_into_text( $res ); } else { do_header(); echo "

DB under heavy load - please try again shortly

"; } // if (is_resource($link_id)) // mysql_close($link_id); include_once('footer2.php'); ?>