Пример #1
0
     } else {
         $smarty->display('noaccess.tpl');
     }
     // Smarty template
 } else {
     /*
      * Grab a list of active news articles
      */
     $newsResult = mysqli_query($db, "\r\n\t\t\t\tSELECT *\r\n\t\t\t\tFROM {$dbinfo[pre]}news\r\n\t\t\t\tWHERE active = 1\r\n\t\t\t\tAND add_date < '{$nowGMT}'\r\n\t\t\t\tAND (expire_type = 0 OR expire_date > '{$nowGMT}') \r\n\t\t\t\tORDER BY sortorder,add_date DESC\r\n\t\t\t\t");
     if ($returnRows = mysqli_num_rows($newsResult)) {
         while ($news = mysqli_fetch_assoc($newsResult)) {
             $news['title'] = $news['title_' . $selectedLanguage] ? $news['title_' . $selectedLanguage] : $news['title'];
             // Choose the correct language
             $news['short'] = $news['short_' . $selectedLanguage] ? $news['short_' . $selectedLanguage] : $news['short'];
             // Choose the correct language
             $news['seoTitle'] = cleanForSEO($news['title']);
             // Name cleaned for SEO usage
             $parms['page'] = "news.php?id={$news[news_id]}";
             // Link to page
             if ($modRewrite) {
                 $parms['page'] .= "&seoTitle={$news[seoTitle]}";
             }
             // Link to page with seoName added
             $news['linkto'] = linkto($parms);
             // Create the link using SEO if needed
             $news['display_date'] = $customNewsDate->showdate($news['add_date']);
             // Create a local time and date
             $newsArray[] = $news;
         }
         $smarty->assign('newsRows', $returnRows);
         $smarty->assign('news', $newsArray);
Пример #2
0
}
/*
 * Homepage news
 */
if ($config['settings']['hpnews']) {
    try {
        $featuredNewsResult = mysqli_query($db, "\r\n\t\t\t\tSELECT *\r\n\t\t\t\tFROM {$dbinfo[pre]}news\r\n\t\t\t\tWHERE homepage = 1\r\n\t\t\t\tAND active = 1\r\n\t\t\t\tAND add_date < '{$nowGMT}'\r\n\t\t\t\tAND (expire_type = 0 OR expire_date > '{$nowGMT}') \r\n\t\t\t\tORDER BY sortorder,add_date DESC\r\n\t\t\t\t");
        $customNewsDate = new kdate();
        $customNewsDate->setMemberSpecificDateInfo();
        $customNewsDate->distime = 0;
        while ($featuredNews = mysqli_fetch_assoc($featuredNewsResult)) {
            $featuredNews['title'] = $featuredNews['title_' . $selectedLanguage] ? $featuredNews['title_' . $selectedLanguage] : $featuredNews['title'];
            // Choose the correct language
            $featuredNews['short'] = $featuredNews['short_' . $selectedLanguage] ? $featuredNews['short_' . $selectedLanguage] : $featuredNews['short'];
            // Choose the correct language
            $featuredNews['seoTitle'] = cleanForSEO($featuredNews['title']);
            // Name cleaned for SEO usage
            $parms['page'] = "news.php?id={$featuredNews[news_id]}";
            // Link to page
            if ($modRewrite) {
                $parms['page'] .= "&seoTitle={$featuredNews[seoTitle]}";
            }
            // Link to page with seoName added
            $featuredNews['linkto'] = linkto($parms);
            // Create the link using SEO if needed
            $featuredNews['display_date'] = $customNewsDate->showdate($featuredNews['add_date']);
            // Create a local time and date
            $featuredNewsArray[] = $featuredNews;
        }
        $smarty->assign('featuredNewsRows', count($featuredNewsArray));
        $smarty->assign('featuredNews', $featuredNewsArray);