function _HCM_countart($kategorie = null)
{
    if (isset($kategorie) and $kategorie != "") {
        $cond = " AND " . _sqlArticleWhereCategories($kategorie);
    } else {
        $cond = "";
    }
    return DB::result(DB::query("SELECT COUNT(id) FROM `" . _mysql_prefix . "-articles` AS art WHERE " . _sqlArticleFilter() . $cond), 0);
}
Exemple #2
0
                    case 5:
                        if ($item['xhome'] == -1) {
                            $homelink = "index.php?m=topic&id=" . $item['id'];
                        } else {
                            $homelink = "index.php?m=topic&id=" . $item['xhome'];
                        }
                        break;
                }
                // ulozeni zaznamu
                $feeditems[] = array($author . ": " . $item['subject'], $homelink . "#posts", _cutStr(strip_tags(_parsePost($item['text'])), 255, false), $item['time']);
            }
            break;
            // nejnovejsi clanky
        // nejnovejsi clanky
        case 4:
            $items = DB::query("SELECT art.id,art.time,art.confirmed,art.public,art.home1,art.home2,art.home3,art.title,art.title_seo,art.perex,cat.title_seo AS cat_title_seo FROM `" . _mysql_prefix . "-articles` AS art JOIN `" . _mysql_prefix . "-root` AS cat ON(cat.id=art.home1) WHERE " . _sqlArticleFilter(true) . $catlimit . " ORDER BY art.time DESC LIMIT " . _rsslimit);
            while ($item = DB::row($items)) {
                $feeditems[] = array($item['title'], _linkArticle($item['id'], $item['title_seo'], $item['cat_title_seo']), strip_tags($item['perex']), $item['time']);
            }
            break;
    }
    $continue = true;
}
/* ---  vystup  --- */
if ($continue) {
    header("Content-Type: application/xml; charset=UTF-8");
    $maintitle = _title . ' ' . _titleseparator . ($pagetitle != null ? ' ' . $pagetitle . ' ' . _titleseparator : '') . ' ' . $feedtitle;
    echo '<?xml version="1.0" encoding="UTF-8"?' . '>
<rss version="0.91">
  <channel>
    <title>' . $maintitle . '</title>
     $content .= "<p class='list-perex'>" . $item['intersectionperex'] . "</p>\n";
 }
 // informace
 if ($query['var1'] == 1) {
     $iteminfo = "";
     switch ($item['type']) {
         // sekce
         case 1:
             if ($item['var1'] == 1) {
                 $iteminfo .= "<span>" . $_lang['article.comments'] . ":</span> " . DB::result(DB::query("SELECT COUNT(id) FROM `" . _mysql_prefix . "-posts` WHERE type=1 AND home=" . $item['id']), 0);
             }
             break;
             // kategorie
         // kategorie
         case 2:
             $iteminfo .= "<span>" . $_lang['global.articlesnum'] . ":</span> " . DB::result(DB::query("SELECT COUNT(id) FROM `" . _mysql_prefix . "-articles` AS art WHERE (home1=" . $item['id'] . " OR home2=" . $item['id'] . " OR home3=" . $item['id'] . ") AND " . _sqlArticleFilter()), 0);
             break;
             // kniha
         // kniha
         case 3:
             // nacteni jmena autora posledniho prispevku
             $lastpost = DB::query("SELECT author,guest FROM `" . _mysql_prefix . "-posts` WHERE home=" . $item['id'] . " ORDER BY id DESC LIMIT 1");
             if (DB::size($lastpost) != 0) {
                 $lastpost = DB::row($lastpost);
                 if ($lastpost['author'] != -1) {
                     $lastpost = _linkUser($lastpost['author'], null, true, true);
                 } else {
                     $lastpost = $lastpost['guest'];
                 }
             } else {
                 $lastpost = "-";
 $id = DB::esc($_GET['id']);
 $query = DB::query("SELECT * FROM `" . _mysql_prefix . "-users` WHERE username='******'");
 if (DB::size($query) != 0) {
     $query = DB::row($query);
     $groupdata = DB::query_row("SELECT title,descr,icon,color,blocked FROM `" . _mysql_prefix . "-groups` WHERE id=" . $query['group']);
     $form = true;
     // promenne
     if ($query['note'] == "") {
         $note = "";
     } else {
         $note = "<tr class='valign-top'><td><strong>" . $_lang['global.note'] . "</strong></td><td><div class='note'>" . _parsePost($query['note']) . "</div></td></tr>";
     }
     // cesta k avataru
     $query['avatar'] = _getAvatar($query['id'], true, false, true);
     // clanky autora
     $arts = DB::result(DB::query("SELECT COUNT(*) FROM `" . _mysql_prefix . "-articles` AS art WHERE author=" . $query['id'] . " AND " . _sqlArticleFilter()), 0);
     if ($arts != 0) {
         // zjisteni prumerneho hodnoceni
         $avgrate = DB::result(DB::query("SELECT ROUND(SUM(ratesum)/SUM(ratenum)) FROM `" . _mysql_prefix . "-articles` WHERE rateon=1 AND ratenum!=0 AND confirmed=1 AND author=" . $query['id']), 0);
         if ($avgrate === null) {
             $avgrate = $_lang['article.rate.nodata'];
         } else {
             $avgrate = "&Oslash; " . $avgrate . "%";
         }
         // sestaveni kodu
         $arts = "\n<tr><td><strong>" . $_lang['global.articlesnum'] . "</strong></td><td>" . $arts . ", <a href='index.php?m=profile-arts&amp;id=" . $id . "'>" . $_lang['global.show'] . " &gt;</a></td></tr>\n";
         if (_ratemode != 0) {
             $arts .= "\n<tr><td><strong>" . $_lang['article.rate'] . "</strong></td><td>" . $avgrate . "</td></tr>\n";
         }
     } else {
         $arts = "";
function _HCM_articles($typ = 1, $pocet = null, $perex = true, $info = true, $kategorie = null)
{
    // priprava
    $result = "";
    $typ = intval($typ);
    if ($typ < 1 or $typ > 9) {
        $typ = 1;
    }
    $pocet = intval($pocet);
    if ($pocet < 1) {
        $pocet = 1;
    }
    $perex = intval($perex);
    $info = _boolean($info);
    // limitovani na kategorie
    $rcats = _sqlArticleWhereCategories($kategorie);
    // priprava casti sql dotazu
    switch ($typ) {
        case 1:
            $rorder = "art.time DESC";
            $rcond = "";
            break;
        case 2:
            $rorder = "art.readed DESC";
            $rcond = "art.readed!=0";
            break;
        case 3:
            $rorder = "art.ratesum/art.ratenum DESC";
            $rcond = "art.ratenum!=0";
            break;
        case 4:
            $rorder = "art.ratenum DESC";
            $rcond = "art.ratenum!=0";
            break;
        case 5:
            $rorder = "RAND()";
            $rcond = "";
            break;
        case 6:
            $rorder = "(SELECT time FROM `" . _mysql_prefix . "-iplog` WHERE type=2 AND var=art.id AND art.visible=1 AND art.time<=" . time() . " AND art.confirmed=1 ORDER BY id DESC LIMIT 1) DESC";
            $rcond = "art.readed!=0";
            break;
        case 7:
            $rorder = "(SELECT time FROM `" . _mysql_prefix . "-iplog` WHERE type=3 AND var=art.id AND art.visible=1 AND art.time<=" . time() . " AND art.confirmed=1 ORDER BY id DESC LIMIT 1) DESC";
            $rcond = "art.ratenum!=0";
            break;
        case 8:
            $rorder = "(SELECT time FROM `" . _mysql_prefix . "-posts` WHERE home=art.id AND type=2 ORDER BY time DESC LIMIT 1) DESC";
            $rcond = "(SELECT COUNT(id) FROM `" . _mysql_prefix . "-posts` WHERE home=art.id AND type=2)!=0";
            break;
        case 9:
            $rorder = "(SELECT COUNT(id) FROM `" . _mysql_prefix . "-posts` WHERE home=art.id AND type=2) DESC";
            $rcond = "(SELECT COUNT(id) FROM `" . _mysql_prefix . "-posts` WHERE home=art.id AND type=2)!=0";
            break;
    }
    // pripojeni casti
    if ($rcond != "") {
        $rcond = " AND " . $rcond;
    }
    $rcond = " WHERE " . _sqlArticleFilter(true) . $rcond;
    if ($rcats != "") {
        $rcond .= " AND " . $rcats;
    }
    // vypis
    $query = DB::query("SELECT art.id,art.title,art.title_seo,art.perex," . ($perex === 2 ? 'art.picture_uid,' : '') . "art.author,art.time,art.readed,art.comments,cat.title_seo AS cat_title_seo" . ($info !== 0 ? ",(SELECT COUNT(id) FROM `" . _mysql_prefix . "-posts` AS post WHERE home=art.id AND post.type=2) AS comment_count" : '') . " FROM `" . _mysql_prefix . "-articles` AS art JOIN `" . _mysql_prefix . "-root` AS cat ON(cat.id=art.home1)" . $rcond . " ORDER BY " . $rorder . " LIMIT " . $pocet);
    while ($item = DB::row($query)) {
        $result .= _articlePreview($item, $info, $perex !== 0, $info !== 0 ? $item['comment_count'] : null);
    }
    return $result;
}
    }
}
/* ---  modul  --- */
// titulek
if (_template_autoheadings == 1) {
    $module .= "<h1>" . $_lang['mod.profile.arts'] . "</h1><br />";
}
// vyhledavaci pole
// odkaz zpet na profil
if ($list) {
    $module .= "\n<a href='index.php?m=profile&amp;id=" . $id . "' class='backlink'>&lt; " . $_lang['global.return'] . "</a>\n";
}
$module .= "\n  <form action='index.php' method='get'>\n  <input type='hidden' name='m' value='profile-arts' />\n  <input type='text' name='id'" . ($id != null ? " value='" . $id . "'" : '') . " class='inputmedium' /> <input type='submit' value='" . $_lang['global.open'] . "' />\n  </form><br />\n  " . $message;
// tabulka
if ($list == true) {
    $cond = "art.author=" . $query['id'] . " AND " . _sqlArticleFilter(true);
    $paging = _resultPaging("index.php?m=profile-arts&amp;id=" . $id, 15, "articles:art", $cond);
    if (_pagingmode == 1 or _pagingmode == 2) {
        $module .= $paging[0];
    }
    $arts = DB::query("SELECT art.id,art.title,art.title_seo,art.author,art.perex,art.picture_uid,art.time,art.comments,art.public,art.readed,cat.title_seo AS cat_title_seo,(SELECT COUNT(id) FROM `" . _mysql_prefix . "-posts` AS post WHERE home=art.id AND post.type=2) AS comment_count FROM `" . _mysql_prefix . "-articles` AS art JOIN `" . _mysql_prefix . "-root` AS cat ON(cat.id=art.home1) WHERE " . $cond . " ORDER BY art.time DESC " . $paging[1]);
    if (DB::size($arts) != 0) {
        while ($art = DB::row($arts)) {
            $module .= _articlePreview($art, true, true, $art['comment_count']);
        }
        if (_pagingmode == 2 or _pagingmode == 3) {
            $module .= '<br />' . $paging[0];
        }
    } else {
        $module .= $_lang['global.nokit'];
    }
        break;
}
// titulek
$title = $query['title'];
if (_template_autoheadings && $query['autotitle']) {
    $content .= "<h1>" . $query['title'] . _linkRSS($id, 4) . "</h1>\n";
}
_extend('call', 'page.category.aftertitle', $extend_args);
// obsah
_extend('call', 'page.category.content.before', $extend_args);
if ($query['content'] != "") {
    $content .= _parseHCM($query['content']) . "\n\n<div class='hr'><hr /></div>\n\n";
}
_extend('call', 'page.category.content.after', $extend_args);
// vypis clanku
$arts_cond = "(art.home1=" . $id . " OR art.home2=" . $id . " OR art.home3=" . $id . ") AND " . _sqlArticleFilter() . " ORDER BY " . $artorder;
$paging = _resultPaging(_indexOutput_url, $artsperpage, "articles:art", $arts_cond);
$arts = DB::query("SELECT art.id,art.title,art.title_seo,art.author,art.perex," . ($query['var4'] ? 'art.picture_uid,' : '') . "art.time,art.comments,art.readed,cat.title_seo AS cat_title_seo,(SELECT COUNT(id) FROM `" . _mysql_prefix . "-posts` AS post WHERE home=art.id AND post.type=2) AS comment_count FROM `" . _mysql_prefix . "-articles` AS art JOIN `" . _mysql_prefix . "-root` AS cat ON(cat.id=art.home1) WHERE " . $arts_cond . " " . $paging[1]);
if (DB::size($arts) != 0) {
    if (_pagingmode == 1 or _pagingmode == 2) {
        $content .= $paging[0];
    }
    while ($art = DB::row($arts)) {
        $extend_item_args = _extendArgs($content, array('query' => $query, 'item-query' => &$art));
        _extend('call', 'page.category.item.before', $extend_item_args);
        $content .= _articlePreview($art, $query['var3'] == 1, true, $art['comment_count']);
        _extend('call', 'page.category.item.after', $extend_item_args);
    }
    if (_pagingmode == 2 or _pagingmode == 3) {
        $content .= '<br />' . $paging[0];
    }