function _HCM_countusers($kategorie = null)
{
    if (isset($kategorie)) {
        $cond = " WHERE " . _sqlWhereColumn("`group`", $kategorie);
    } else {
        $cond = "";
    }
    return DB::result(DB::query("SELECT COUNT(id) FROM `" . _mysql_prefix . "-users`" . $cond), 0);
}
function _HCM_recentposts($limit = null, $stranky = "", $typ = null)
{
    // priprava
    $result = "";
    if (isset($limit) and intval($limit) >= 1) {
        $limit = abs(intval($limit));
    } else {
        $limit = 10;
    }
    // filtr cisel sekci, knih nebo clanku
    if (isset($stranky) and isset($typ)) {
        $rtype = intval($typ);
        if ($rtype < 1 or $rtype > 3) {
            $rtype = 1;
        }
        $rroots = "(" . _sqlWhereColumn("home", $stranky) . ") AND type=" . $rtype;
    } else {
        $rroots = "type!=4 AND type!=6 AND type!=7";
    }
    $query = DB::query("SELECT id,type,home,xhome,subject,author,guest,time,text FROM `" . _mysql_prefix . "-posts` WHERE " . $rroots . " ORDER BY id DESC LIMIT " . $limit);
    while ($item = DB::row($query)) {
        // nacteni titulku a odkazu na stranku
        switch ($item['type']) {
            case 1:
            case 3:
                $hometitle = DB::query_row("SELECT title,title_seo FROM `" . _mysql_prefix . "-root` WHERE id=" . $item['home']);
                $homelink = _linkRoot($item['home'], $hometitle['title_seo']);
                break;
            case 2:
                $hometitle = DB::query_row("SELECT art.title,art.title_seo,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 art.id=" . $item['home']);
                $homelink = _linkArticle($item['home'], $hometitle['title_seo'], $hometitle['cat_title_seo']);
                break;
            case 5:
                if ($item['xhome'] == -1) {
                    $tid = $item['id'];
                    $hometitle = array("title" => $item['subject']);
                } else {
                    $tid = $item['xhome'];
                    $hometitle = DB::query_row("SELECT subject FROM `" . _mysql_prefix . "-posts` WHERE id=" . $item['xhome']);
                    $hometitle = array("title" => $hometitle['subject']);
                }
                $homelink = "index.php?m=topic&amp;id=" . $tid;
                break;
        }
        // nacteni jmena autora
        if ($item['author'] != -1) {
            $authorname = _linkUser($item['author'], null, true, true);
        } else {
            $authorname = $item['guest'];
        }
        $hometitle = $hometitle['title'];
        $result .= "\n<h2 class='list-title'><a href='" . $homelink . "'>" . $hometitle . "</a></h2>\n<p class='list-perex'>" . _cutStr(strip_tags(_parsePost($item['text'])), 256) . "</p>\n<div class='list-info'>\n<span>" . $GLOBALS['_lang']['global.postauthor'] . ":</span> " . $authorname . _template_listinfoseparator . "\n<span>" . $GLOBALS['_lang']['global.time'] . ":</span> " . _formatTime($item['time']) . "\n</div>\n\n";
    }
    return $result;
}
Example #3
0
function _HCM_galimg($galerie = "", $typ = 1, $rozmery = null, $limit = null)
{
    // nacteni parametru
    $result = "";
    $galerie = _sqlWhereColumn("home", $galerie);
    if (isset($limit)) {
        $limit = abs(intval($limit));
    } else {
        $limit = 1;
    }
    // rozmery
    if (isset($rozmery)) {
        $rozmery = explode('/', $rozmery, 2);
        if (sizeof($rozmery) === 2) {
            // sirka i vyska
            $x = intval($rozmery[0]);
            $y = intval($rozmery[1]);
        } else {
            // pouze vyska
            $x = null;
            $y = intval($rozmery[0]);
        }
    } else {
        // neuvedeno
        $x = null;
        $y = 128;
    }
    // urceni razeni
    switch ($typ) {
        case 2:
            $razeni = "RAND()";
            break;
        default:
            $razeni = "id DESC";
    }
    // vypis obrazku
    $rimgs = DB::query("SELECT id,title,prev,full FROM `" . _mysql_prefix . "-images` WHERE " . $galerie . " ORDER BY " . $razeni . " LIMIT " . $limit);
    while ($rimg = DB::row($rimgs)) {
        $result .= _galleryImage($rimg, "hcm" . SL::$hcmUid, $x, $y);
    }
    return $result;
}
 $errors = array();
 if ($text == "" and !$maillist) {
     $errors[] = $_lang['admin.other.massemail.notext'];
 }
 if (count($receivers) == 0) {
     $errors[] = $_lang['admin.other.massemail.noreceivers'];
 }
 if ($subject == "" and !$maillist) {
     $errors[] = $_lang['admin.other.massemail.nosubject'];
 }
 if (!_validateEmail($sender) and !$maillist) {
     $errors[] = $_lang['admin.other.massemail.badsender'];
 }
 if (count($errors) == 0) {
     // sestaveni casti sql dotazu - 'where'
     $groups = _sqlWhereColumn("`group`", implode("-", $receivers));
     // hlavicky
     $headers = "Content-Type: " . ($ctype == 1 ? 'text/plain' : 'text/html') . "; charset=UTF-8\n" . (_mailerusefrom ? "From: " . mb_substr($sender, 0, mb_strpos($sender, "@")) . " <" . $sender . ">" : "Reply-To: " . $sender . "") . "\n";
     // nacteni prijemcu
     $query = DB::query("SELECT email FROM `" . _mysql_prefix . "-users` WHERE massemail=1 AND (" . $groups . ")");
     // odeslani nebo zobrazeni adres
     if (!$maillist) {
         // priprava
         $rec_buffer = array();
         $rec_buffer_size = 20;
         $rec_buffer_counter = 0;
         $item_counter = 0;
         $item_total = DB::size($query);
         // poznamka na konci zpravy
         $notice = str_replace('*domain*', _getDomain(), $_lang['admin.other.massemail.emailnotice']);
         if ($ctype == 1) {