require_once $_SERVER['DOCUMENT_ROOT'].'/_framework.inc'; require_once $_SERVER['DOCUMENT_ROOT'].'/zoas.inc'; # Remove any extraneous spaces right up front foreach($_GET as $key => $value) { $_GET[$key] = trim($value); } # Set up our constants define('ZOAS_PER_PAGE', 12); define('MAX_PAGES', 100); if (empty($_GET['page']) || !is_numeric($_GET['page'])) { define('PAGE_NUM', 1); } else { define('PAGE_NUM', intval(trim($_GET['page']))); } # Set up our search parameters // The params string looks like this: // red-green-skirt-blue-inner-purple-outer-yellow-ring-zoas.htm $sParams = $_GET['params'] . '-'; preg_match('|([^-.]*)-skirt|', $sParams, $aMatches); $_GET['skirt-color'] = $aMatches[1]; $sParams = str_replace($_GET['skirt-color'].'-skirt', '', $sParams); preg_match('|([^-.]*)-inner|', $sParams, $aMatches); $_GET['inner-color'] = $aMatches[1]; $sParams = str_replace($_GET['inner-color'].'-inner', '', $sParams); preg_match('|([^-.]*)-outer|', $sParams, $aMatches); $_GET['outer-color'] = $aMatches[1]; $sParams = str_replace($_GET['outer-color'].'-outer', '', $sParams); preg_match('|([^-.]*)-ring|', $sParams, $aMatches); $_GET['ring-color'] = $aMatches[1]; $sParams = str_replace($_GET['ring-color'].'-ring', '', $sParams); preg_match('|([^-.]*)-|', $sParams, $aMatches); $_GET['primary-color'] = $aMatches[1]; //print_r($aMatches); //echo "\n$sParams\n\n"; //print_r($_GET); die(); if (!LCL_ConvertURLParamsToFriendlyNames()) { header('HTTP/1.1 404 Not Found'); $aPageElements = array( 'content_group' => 'zoas', 'page_id' => 'four-oh-four', 'page_title' => 'No Zoas Found :(' ); _ShowHeader($aPageElements); ?>
We’re sorry, but we don’t currently have any zoas indexed that match that criteria. Would you like to start a new search?
echo "\n"; _ShowFooter($aPageElements); } else { if (ISME) echo '\n\n"; # Make sure we only serve results under the canonical URL $sCanonicalURL = UTL_GetURL($_GET['primary-color'], $_GET['skirt-color'], $_GET['inner-color'], $_GET['outer-color'], $_GET['ring-color']); if ($sCanonicalURL=='/') { // This is the list of *all* zoas with no filters $bIsFullList = true; } if (ISME) echo "\n"; if (PAGE_NUM != '1') $sCanonicalURL = UTL_AppendQuerystringParameter($sCanonicalURL, 'page='.PAGE_NUM); # Strip any querystring vars that we're fine being there // - Google Analytics $_SERVER['REQUEST_URI'] = preg_replace('|utm_source=[\w\+]*&?|i', '', $_SERVER['REQUEST_URI']); $_SERVER['REQUEST_URI'] = preg_replace('|utm_medium=[\w\+]*&?|i', '', $_SERVER['REQUEST_URI']); $_SERVER['REQUEST_URI'] = preg_replace('|utm_campaign=[\w\+]*&?|i', '', $_SERVER['REQUEST_URI']); $_SERVER['REQUEST_URI'] = preg_replace('|utm_term=[\w\+]*&?|i', '', $_SERVER['REQUEST_URI']); # Now clean up the URL if (substr($_SERVER['REQUEST_URI'], -1) == '?') $_SERVER['REQUEST_URI'] = substr($_SERVER['REQUEST_URI'], 0, strlen($_SERVER['REQUEST_URI'])-1); if (substr($_SERVER['REQUEST_URI'], -1) == '&') $_SERVER['REQUEST_URI'] = substr($_SERVER['REQUEST_URI'], 0, strlen($_SERVER['REQUEST_URI'])-1); # Now 301 if we need to if ($_SERVER['REQUEST_URI'] <> $sCanonicalURL) { UTL_Redirect($sCanonicalURL, 301); die(); } # Determine how many total zoas match the search $db = &UTL_GetDBConnection(); if (ZOAS_GetZoas($aZoaResults, $aColors, $bIsFullList, $sErrMsg, $iTotalMatchingCount, $db)) { //print_r($aZoaResults); # Make sure they're not requesting a page number that is past the last page of jobs $iTotalPages = ceil($iTotalMatchingCount/ZOAS_PER_PAGE); //die("$iTotalPages|$iTotalMatchingCount|".ZOAS_PER_PAGE); $iTotalPages = min($iTotalPages, MAX_PAGES); if ($iTotalPages > 0 && PAGE_NUM > $iTotalPages) { # Redirect to the last page of zoas if ($iTotalPages == '1') { $sRedirectURL = UTL_GetURL($_GET['primary-color'], $_GET['skirt-color'], $_GET['inner-color'], $_GET['outer-color'], $_GET['ring-color']); } else { $sRedirectURL = str_replace('page=' . PAGE_NUM, 'page=' . $iTotalPages, $_SERVER['REQUEST_URI']); } UTL_Redirect($sRedirectURL, 301); } else { $sPageTitle = LCL_GetPageDescription(); if ($sPageTitle == 'Zoas') $sPageTitle = 'Zoa Identifier | ZoaID.org'; # This is the homepage $aPageElements = array( 'content_group' => 'zoas', 'page_id' => 'results', 'page_title' => $sPageTitle, 'featured_img' => 'https://www.zoaid.org/img/featured-img.jpg' ); # Return a 404 if this a combination that doesn't have any matches if ($iTotalMatchingCount < 1) { header('HTTP/1.1 404 Not Found'); } _ShowHeader($aPageElements); LCL_ShowFilters($aZoaResults, $aColors); ?>if ($iTotalMatchingCount > 0) { if ($iTotalMatchingCount > 1) $sS = 's'; echo $iTotalMatchingCount; if ($bIsFullList) echo " different zoa$sS"; else echo ' photos'; echo " indexed so far"; } else { ?> We haven’t indexed any zoas like that yet, but stay tuned! We’re still busy working on it. } ?>Filters