function SetPanelSettings() { $output = ""; if (GetConfig('HomeBlogPosts') > 0) { $query = "select newsid, newstitle from [|PREFIX|]news where newsvisible='1' order by newsid desc"; $query .= $GLOBALS['ISC_CLASS_DB']->AddLimit(0, GetConfig('HomeBlogPosts')); $result = $GLOBALS['ISC_CLASS_DB']->Query($query); if ($GLOBALS['ISC_CLASS_DB']->CountResult($result) > 0) { while ($row = $GLOBALS['ISC_CLASS_DB']->Fetch($result)) { $GLOBALS['BlogText'] = isc_html_escape($row['newstitle']); $GLOBALS['BlogLink'] = BlogLink($row['newsid'], $row['newstitle']); $output .= $GLOBALS['ISC_CLASS_TEMPLATE']->GetSnippet("RecentBlog"); } $GLOBALS['SNIPPETS']['RecentBlogs'] = $output; // Showing the syndication option? if (GetConfig('RSSLatestBlogEntries') != 0 && GetConfig('RSSSyndicationIcons') != 0) { $GLOBALS['SNIPPETS']['HomeRecentBlogsFeed'] = $GLOBALS['ISC_CLASS_TEMPLATE']->GetSnippet("HomeRecentBlogsFeed"); } } else { $this->DontDisplay = true; $GLOBALS['HideHomeRecentBlogsPanel'] = "none"; } } else { $this->DontDisplay = true; $GLOBALS['HideHomeRecentBlogsPanel'] = "none"; } }
public function NewBlogs() { // Feed enabled? if (!GetConfig('RSSLatestBlogEntries')) { exit; } $this->_SetFeedDetails(); $feed = new ISC_FEED_GENERATOR('blogs', $this->_type, (int) GetConfig('RSSCacheTime') * 60); $channel = array("title" => sprintf(GetLang('RSSLatestNews'), GetConfig('StoreName')), "description" => sprintf(GetLang('RSSLatestNewsDesc'), GetConfig('StoreName')), "link" => $GLOBALS['ShopPath']); $feed->SetChannel($channel); $query = "select newsid, newstitle, newscontent, newsdate from [|PREFIX|]news where newsvisible='1' order by newsid desc"; // Run the query $query .= $GLOBALS['ISC_CLASS_DB']->AddLimit(0, (int) GetConfig('RSSItemsLimit')); $result = $GLOBALS['ISC_CLASS_DB']->Query($query); while ($item = $GLOBALS['ISC_CLASS_DB']->Fetch($result)) { // Add the item to the feed $item = array("title" => $item['newstitle'], "description" => $item['newscontent'], "link" => BlogLink($item['newsid'], $item['newstitle']), "date" => $item['newsdate']); $feed->AddItem($item); } // Send the feed to the browser $feed->OutputFeed(); }
$url = str_replace("'", ''', $url); echo '<url>', "\n"; echo '<loc>', $url, '</loc>', "\n"; echo '</url>', "\n"; } $query = "\n\t\tSELECT brandname\n\t\tFROM [|PREFIX|]brands\n\t\tLIMIT " . $GLOBALS['ISC_CLASS_DB']->Quote((int) $limit); $result = $GLOBALS['ISC_CLASS_DB']->Query($query); while ($row = $GLOBALS['ISC_CLASS_DB']->Fetch($result)) { $limit--; // We can't just pass ENT_QUOTES to htmlspecialchars because that converts a ' to ' rather than ' // Google sitemaps requires ' to be encoded as ' so we have to do things a little differently $url = htmlspecialchars(BrandLink($row['brandname']), ENT_COMPAT, 'UTF-8'); $url = str_replace("'", ''', $url); echo '<url>', "\n"; echo '<loc>', $url, '</loc>', "\n"; echo '</url>', "\n"; } $query = "\n\t\tSELECT newsid, newstitle\n\t\tFROM [|PREFIX|]news\n\t\tWHERE newsvisible=1\n\t\tLIMIT " . $GLOBALS['ISC_CLASS_DB']->Quote((int) $limit); $result = $GLOBALS['ISC_CLASS_DB']->Query($query); while ($row = $GLOBALS['ISC_CLASS_DB']->Fetch($result)) { $limit--; // We can't just pass ENT_QUOTES to htmlspecialchars because that converts a ' to ' rather than ' // Google sitemaps requires ' to be encoded as ' so we have to do things a little differently $url = htmlspecialchars(BlogLink($row['newsid'], $row['newstitle']), ENT_COMPAT, 'UTF-8'); $url = str_replace("'", ''', $url); echo '<url>', "\n"; echo '<loc>', $url, '</loc>', "\n"; echo '</url>', "\n"; } echo '</urlset>', "\n"; ob_end_flush();
/** * Build the array of searched item results for the AJAX request * * Method will build an array of searched item results for the AJAX request. Method will work with the ISC_SEARCH * class to get the results so make sure that the object is initialised and the DoSearch executed. * * Each key in the array will be the 'score' value (as a string) so it can be merged in with other results and can * then be further sorted using any PHP array sorting functions, so output would be something like this: * * EG: return = array(10, // result count * array( * "12.345" => array( * 0 => [page HTML] * 1 => [page HTML] * 2 => [page HTML] * ), * "2.784" => array( * 0 => [page HTML] * ), * "6.242" => array( * 0 => [page HTML] * 1 => [page HTML] * ) * ) * ); * * @access public * @return array An array with two values, first is total number of search results. Other is the search item results AJAX array on success, empty array on error */ static public function buildSearchResultsAJAX() { if (!isset($GLOBALS["ISC_CLASS_SEARCH"]) || !is_object($GLOBALS["ISC_CLASS_SEARCH"])) { return array(0, array()); } $totalRecords = $GLOBALS["ISC_CLASS_SEARCH"]->GetNumResults("news"); if ($totalRecords == 0) { return array(0, array()); } $results = $GLOBALS["ISC_CLASS_SEARCH"]->GetResults("news"); $ajaxArray = array(); if (!array_key_exists("results", $results) || !is_array($results["results"])) { return array(); } foreach ($results["results"] as $news) { if (!isset($news["score"])) { $news["score"] = 0; } $normalContent = strip_tags($news["newscontent"]); $smallContent = substr($normalContent, 0, 49); if (strlen($normalContent) > 50 && substr($smallContent, -1, 1) !== ".") { $smallContent .= " ..."; } $GLOBALS["NewsTitle"] = isc_html_escape($news["newstitle"]); $GLOBALS["NewsURL"] = BlogLink($news["newsid"], $news["newstitle"]); $GLOBALS["NewsSmallContent"] = isc_html_escape($smallContent); $sortKey = (string)$news["score"]; $ajaxArray[$sortKey][] = $GLOBALS["ISC_CLASS_TEMPLATE"]->GetSnippet("SearchResultAJAXNews"); } return array($totalRecords, $ajaxArray); }
echo '<url>',"\n"; echo '<loc>',$url,'</loc>',"\n"; echo '</url>',"\n"; } $query = " SELECT newsid, newstitle FROM [|PREFIX|]news WHERE newsvisible=1 LIMIT ".$GLOBALS['ISC_CLASS_DB']->Quote((int)$limit); $result = $GLOBALS['ISC_CLASS_DB']->Query($query); while ($row = $GLOBALS['ISC_CLASS_DB']->Fetch($result)) { $limit--; $url = makeSafeUrl(BlogLink($row['newsid'], $row['newstitle'])); echo '<url>',"\n"; echo '<loc>',$url,'</loc>',"\n"; echo '</url>',"\n"; } echo '</urlset>',"\n"; ob_end_flush(); function makeSafeUrl($url) { // We can't just pass ENT_QUOTES to htmlspecialchars because that converts a ' to ' rather than ' // Google sitemaps requires ' to be encoded as ' so we have to do things a little differently $url = htmlspecialchars($url, ENT_COMPAT, 'UTF-8'); $url = str_replace("'", ''', $url);