database error: SELECT i.id, i.iid, i.cid, i.title, i.body, unix_timestamp(i.last_mod) as last_mod_ts FROM content_items as i, content_item_properties as p, content_categories as c where i.cid=c.id and i.iid=p.iid and i.active='1' and c.active='1' and c.public_cat='1' and c.cid != '$_title = html_entity_decode(urldecode($_search . " " . $nav_title . " " . $thisPageTitle . " " . strip_tags($trailnav)));
$pre_tag= "";
// pseudo-pre-tag
if (strlen($pre_tag) == 0 && false) {
$_tagsRaw = preg_split("/\s+/", strtolower(trim($_title)));
for ($x = 0; $x < sizeof($_tagsRaw); $x++) {
if (strlen($_tagsRaw[$x]) > 1)
$_tags[ $_tagsRaw[$x] ]++;
}
reset($_tags);
while (list($k, $v) = each($_tags)) {
if ($v <= 1) unset($_tags[$k]);
}
if (sizeof($_tags)) {
arsort($_tags);
reset($_tags);
}
}
// major topics
$_majors['art'] = array('art', 'artist', 'sculpture', 'fine art', 'artists');
$_majors['auto'] = array('automotive', 'automobile', 'car', 'truck', 'cars', 'trucks');
$_majors['beauty'] = array('beautiful', 'beauty', 'hair care', 'skin care');
$_majors['business'] = array('business', 'biz', 'b2b', 'b2c', 'ceo', 'chairmain', 'corporate');
$_majors['educate'] = array('educate', 'education', 'teaching', 'learning', 'school');
$_majors['entertain'] = array('entertainer', 'entertainment', 'movie', 'film', 'actor', 'actress', 'celebrity', 'celeb');
$_majors['family'] = array('family', 'parents', 'children', 'parent', 'child');
$_majors['finance'] = array('finance', 'money', 'investing', 'investment', 'stock', 'stocks');
$_majors['gaming'] = array('video game', 'console game', 'x-box', 'xbox', 'ps3', 'wii', 'ps2');
$_majors['geo'] = array('geographical', 'city', 'state', 'country');
$_majors['health'] = array('health', 'doctor', 'medical', 'wellness', 'healthy', 'nutrition', 'diet');
$_majors['home'] = array('home', 'kitchen', 'bathroom', 'bedroom', 'appliance');
$_majors['insure'] = array('insurance', 'insured');
$_majors['job'] = array('job', 'employment', 'employer', 'resume');
$_majors['legal'] = array('legal', 'lawyer', 'law', 'lawyers');
$_majors['music'] = array('music', 'band', 'concert', 'radio');
$_majors['news'] = array('news', 'top story', 'breaking');
$_majors['personal'] = array('personal', 'lifestyle');
$_majors['real'] = array('realtor', 'real estate', 'realty', 'realtors');
$_majors['shop'] = array('shop', 'shopping', 'store', 'sale', 'discount', 'retail', 'shops', 'stores');
$_majors['sports'] = array('sport', 'sports', 'baseball', 'basketball', 'hockey', 'soccer', 'football', 'nba', 'nhl', 'nfl', 'mlb', 'player');
$_majors['tech'] = array('technology', 'computer', 'internet', 'computers', 'tech', 'web');
$_majors['travel'] = array('travel', 'vacation', 'trip', 'cruise', 'resort');
$_majors['local'] = array('local', 'town', 'community', 'city');
while (list($k, $v) = each($_majors)) {
$score = 0;
for ($x = 0; $x < sizeof($v); $x++) {
preg_match_all("/\W".$v[$x]."\W/mi", $_title, $matches);
$score = sizeof($matches[0]);
if ($score) {
//$scores[$k] = $scores[$k] + $score;
$scores[$k] = $scores[$k] + ($score/sizeof($v));
$match[$x][] = $v[$x];
}
}
}
// advertisement source
$adsource = array(
"http://del.icio.us/rss/aybabtu/[tag]",
"http://bookmarks.aybabtu.org/rss.php/m3dia/[tag]",
"http://bookmarks.aybabtu.org/rss.php/mikehernz/[tag]",
"http://del.icio.us/rss/aybabtu/[tag]",
);
shuffle($adsource);
reset($adsource);
if (is_array($scores)) {
arsort($scores);
reset($scores);
list($tag, $array) = each($scores);
}
// fetch ad
require_once(FS_CLASSES.'xmlparse.php');
if (!is_object($objCache)) {
$cacheOptions = array(
"cacheDir" => FS_CACHE,
"lifeTime" => 86400
);
require_once("Cache/Lite.php");
$objCache = new Cache_Lite($cacheOptions);
}
$url = str_replace("[tag]", $tag, $adsource[0]);
$cache_key = "ads:".$url;
if (($data = $objCache->get($cache_key)) && false) {
$data = unserialize($data);
}
if (!is_array($data)) {
$rss = GetXMLTree($url);
if (strstr($url, 'del.icio.us'))
$data = $rss['item'];
else
$data = $rss['channel'][0]['item'];
}
if (!is_array($data) || sizeof($data) == 1) {
$url = str_replace("[tag]", $tag, "http://bookmarks.aybabtu.org/rss.php/all/[tag]");
$cache_key = "ads:".$url;
$rss = GetXMLTree($url);
$data = $rss['channel'][0]['item'];
}
if (sizeof($data) > 1) {
$objCache->save(serialize($data), $cache_key);
}
if (is_array($data) && sizeof($data) > 1) {
shuffle($data);
reset($data);
$_text_ad = "".$data[0]['title']."
".$data[0]['description'];
}
echo "