private function parseQ () { if (empty ($this->q) || $this->q == '*') { $this->displaySearchStr = CLUtil::getLabelForType ($this->type); $this->clVars['query'] = null; } else { $tokens = StringUtil::tokenize ($this->q); $qParts = array (); foreach ($tokens as $token) { if (preg_match ('/^(srchType|minAsk|maxAsk|hasPic|addTwo):(.*)/i', $token, $matches)) { $this->clVars[strtolower ($matches[1])] = $matches[2]; } else { $qParts[] = $token; } } $this->displaySearchStr = implode (' ' , $qParts); $this->clVars['query'] = trim (preg_replace ('/ {2,}/', ' ', strtolower (implode (' ' , $qParts)))); } }
public function saveCityConfig () { $domains = array_keys ($_POST['city']); if (! empty ($domains)) { CLUtil::cookieDomains ($domains); } }
private function injectNewCity ($domain) { if (! $domain) return; $used = CLUtil::getUsedCities (); $found = array_search ($domain, $used); if ($found === false) { $used[] = $domain; sort ($used); $this->cities = $used; CLUtil::cookieDomains ($used); } }
public function translate () { if ($this->path == '/') { $this->path = "/home"; return; } // custom search URL's $types = array_keys (CLUtil::getLabelForType ()); $str = implode('|', $types); if (preg_match ("/^\/($str)(.*)/i", $this->path, $matches)) { $this->path = "/search/{$matches[1]}{$matches[2]}"; return; } else if (preg_match ('/^\/search(.*)/i', $this->path, $matches)) // generic search { $this->path = "/search/all{$macthes[0]}"; return; } }
public function render404 () { header ('HTTP/1.0 404 Not Found'); $data = array ('url' => $_SERVER['REQUEST_URI']); $data['q'] = $_REQUEST['q']; $data['searchOptions'] = CLUtil::getSearchOptions($_GET['type'], $_GET['q']); $data['meta'] = array ('h1' => 'Page Not Found', 'h2' => 'This craigslist ad may have been removed.'); $data['sections'] = CLUtil::getLabelForType (); asort ($data['sections']); $t = new Duckk_Template ('status/404.php', $data); $t->setWrapper ('chrome.php'); $t->render (); }
?> | <?php echo CLUtil::getCityForClDomain($result['clb']['clDomain']); ?> (<?php echo $result['clb']['location']; ?> ) <?php echo $result['clb']['price'] ? ' | $' . $result['clb']['price'] : ''; ?> </title> <meta name="description" content="<?php echo htmlentities($result['title']); ?> | <?php echo CLUtil::getCityForClDomain($result['clb']['clDomain']); ?> (<?php echo $result['clb']['location']; ?> ) <?php echo $result['clb']['price'] ? ' | $' . $result['clb']['price'] : ''; ?> " /> <? $this->inc ('common/ga.php'); ?> </head> <frameset rows="100px,*"> <frame src="/fs/?<?php echo $_SERVER['QUERY_STRING']; ?>
protected function getSearchOptions () { return CLUtil::getSearchOptions ($this->searchType, $_GET['q'], $this->getPage (), CLUtil::getUsedCities()); }
<div id="nav"> <div class="navLinks"> <? $types = array_slice (CLUtil::getLabelForType (), 0, 11); if ($searchType && ! array_search (CLUtil::getLabelForType ($searchType), $types)) { //unset ($types['instruments']); $types[$searchType] = CLUtil::getLabelForType ($searchType); } foreach ($types as $k => $v) { echo ($searchType != $k) ? "<a href=\"/$k\">$v</a>" : "<span>$v</span>"; } ?> <a href="/home/sitemap">more »</a> </div> <!-- <div class="userLinks"> <a href="/" style="margin-left: 0px">Home</a> <a href="#">Sign Up</a> <a href="#">Login</a> </div> --> </div>
protected function setupVars () { $this->searchOptions = new Stub; $this->searchOptions->cities = CLUtil::getUsedCities (); }
<? if ($searchType == 'search') : ?> <? $cat = CLUtil::getCategoryFromUrl ($result['link']); ?> <b>Category:</b> <a href="/<?php echo $cat; ?> ?q=<?php echo urlencode($searchOptions->q); ?> &sort=<?php echo urlencode($sort); ?> "> <?php echo CLUtil::getLabelForType($cat); ?> </a> <? endif; ?> </div> <? if (! empty ($result['description'])) : ?> <div class="description" id="desc_<?php echo $i++; ?> "> <? if (! empty ($result['clb']['images'])) : ?> <div class="thumb" id="thumb_<?php echo $i; ?> ">
<div id="cityDialog"> <div class="hd">Pick Which Cities You Wanna Search</div> <div class="bd"> <form name="cityDialogForm" method="POST" action="/ajax/saveCityConfig"> <div class="controls"> <a id="cityDialogCheckAll" href="javascript: checkAll ('cityDialogForm', 'cityDialogCheckAll')">select all</a> <a href="javascript: checkDefault ()">restore default</a><br /> </div> <div class="cityHolder"> <? $allCities = CLUtil::getAllCities (); $usedCities = CLUtil::getUsedCities (); $defaultCities = CLUtil::getDefaultCities (); foreach ($allCities as $domain => $label) { $sel = (array_search ($domain, $usedCities) !== false) ? 'checked="true"' : ''; $class = ($defaultCities[$domain]) ? 'bold' : ''; echo "<div class=\"dialogCity\">", "<input type=\"checkbox\" id=\"cityDialog_{$domain}\" name=\"city[$domain]\" value=\"$domain\" $sel> ", "<label class=\"{$class}\" for=\"cityDialog_{$domain}\">{$label}</label>", "</div>"; } ?> <br class="clear" /> </div> </form>
?> &q=<?php echo urlencode($searchOptions->q); ?> ">Search</a> » <a target="_parent" href="/<?php echo $searchType; ?> ?sort=<?php echo $sort; ?> &q=<?php echo urlencode($searchOptions->q); ?> "><?php echo CLUtil::getLabelForType($searchType); ?> </a> » <? endif; ?> <a target="_parent" href="<?php echo $result['link']; ?> ">this ad</a> </span> <div class="dude l"> <a href="<?php echo $url; ?> "><img src="/_/images/logo/littleDude.gif" /></a>
$url = "#{$k}"; } else { $url = "{$baseUrl}&city={$k}"; $onClick = 'onclick="showLoading ();"'; } ?> <a <?php echo $onClick; ?> class="<?php echo $class; ?> " style="font-size: <?php echo $size; ?> %;" href="<?php echo $url; ?> "> <?php echo str_replace('/', ' ', strtolower(CLUtil::getCityForClDomain($k))); ?> </a> <? endforeach; ?> </div> <pre> <? //print_r ($countByDomain) ?> </pre>