case 3:
            $artorder = "art.title";
            break;
        case 4:
            $artorder = "art.title DESC";
            break;
    }
    // titulek kategorie
    $output .= "<h2>" . $catdata['title'] . " &nbsp; <a href='index.php?p=content-articles-edit&amp;new_cat=" . $cid . "'><img src='images/icons/new.png' alt='new' class='icon' />" . $_lang['admin.content.articles.create'] . "</a></h2>\n";
    // vypis clanku
    // zprava
    $message = "";
    if (isset($_GET['artdeleted'])) {
        $message = _formMessage(1, $_lang['admin.content.articles.delete.done']);
    }
    $cond = "(art.home1=" . $cid . " OR art.home2=" . $cid . " OR art.home3=" . $cid . ")" . _admin_artAccess('art');
    $paging = _resultPaging("index.php?p=content-articles-list&amp;cat=" . $cid, $catdata['var2'], "articles:art", $cond);
    $s = $paging[2];
    $output .= $paging[0] . "<div class='hr'><hr /></div>\n" . $message . "\n<table class='list'>\n<thead><tr><td>" . $_lang['global.article'] . "</td><td>" . $_lang['article.author'] . "</td><td>" . $_lang['article.posted'] . "</td><td>" . $_lang['global.action'] . "</td></tr></thead>\n<tbody>";
    $arts = DB::query("SELECT art.id,art.title,art.title_seo,art.time,art.author,art.confirmed,art.visible,art.public,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 " . $cond . " ORDER BY " . $artorder . " " . $paging[1]);
    if (DB::size($arts) != 0) {
        while ($art = DB::row($arts)) {
            $output .= "<tr><td>" . _admin_articleEditLink($art) . "</td><td>" . _linkUser($art['author']) . "</td><td>" . _formatTime($art['time']) . "</td><td><a href='index.php?p=content-articles-edit&amp;id=" . $art['id'] . "&amp;returnid=" . $cid . "&amp;returnpage=" . $s . "'><img src='images/icons/edit.png' alt='edit' class='icon' />" . $_lang['global.edit'] . "</a>&nbsp;&nbsp;&nbsp;<a href='index.php?p=content-articles-delete&amp;id=" . $art['id'] . "&amp;returnid=" . $cid . "&amp;returnpage=" . $s . "'><img src='images/icons/delete.png' alt='del' class='icon' />" . $_lang['global.delete'] . "</a></td></tr>\n";
        }
    } else {
        $output .= "<tr><td colspan='4'>" . $_lang['global.nokit'] . "</td></tr>";
    }
    $output .= "</tbody></table>";
} else {
    $output .= _formMessage(3, $_lang['global.badinput']);
}
Exemplo n.º 2
0
    exit;
}
// titulek
$title = $query['title'];
if (_template_autoheadings && $query['autotitle']) {
    $content .= "<h1>" . $query['title'] . "</h1>\n";
    _extend('call', 'page.gallery.aftertitle', $extend_args);
}
// obsah
_extend('call', 'page.gallery.content.before', $extend_args);
if ($query['content'] != "") {
    $content .= _parseHCM($query['content']) . "\n\n<div class='hr'><hr /></div>\n\n";
}
_extend('call', 'page.gallery.content.after', $extend_args);
// obrazky
$paging = _resultPaging(_indexOutput_url, $query['var2'], "images", "home=" . $id);
$images = DB::query("SELECT * FROM `" . _mysql_prefix . "-images` WHERE home=" . $id . " ORDER BY ord " . $paging[1]);
$images_number = DB::size($images);
if ($images_number != 0) {
    $usetable = $query['var1'] != -1;
    if (_pagingmode == 1 or _pagingmode == 2) {
        $content .= $paging[0];
    }
    if ($usetable) {
        $content .= "<table class='gallery'>\n";
    } else {
        $content .= "<div class='gallery'>\n";
    }
    // obrazky
    $counter = 0;
    $cell_counter = 0;
Exemplo n.º 3
0
  <td>
  <form class="cform" action="index.php" method="get">
  <input type="hidden" name="p" value="users-list" />
  <input type="hidden" name="group" value="' . $group . '" />
  <strong>' . $_lang['admin.users.list.search'] . ':</strong> <input type="text" name="search" class="inputsmall"' . _restoreGetValue('search') . ' /> <input type="submit" value="' . $_lang['mod.search.submit'] . '" />
  ' . ($search ? '&nbsp;<a href="index.php?p=users-list&amp;group=' . $group . '">' . $_lang['global.cancel'] . '</a>' : '') . '
  </form>
  </td>

  </tr>
  </table>
  ';
// tabulka
// priprava strankovani
if (!$search) {
    $paging = _resultPaging("index.php?p=users-list&amp;group=" . $group, 50, "users", $grouplimit2);
    $output .= $paging[0];
}
// tabulka
$output .= "<br />\n  <table class='list'>\n  <thead><tr><td>ID</td><td>" . $_lang['login.username'] . "</td><td>" . $_lang['global.email'] . "</td><td>" . $_lang['mod.settings.publicname'] . "</td><td colspan='2'>" . $_lang['global.group'] . "</td></tr></thead>\n  <tbody>\n  ";
// dotaz na db
if (!$search) {
    $query = DB::query("SELECT `" . _mysql_prefix . "-users`.id, `" . _mysql_prefix . "-users`.username, `" . _mysql_prefix . "-users`.publicname, `" . _mysql_prefix . "-users`.levelshift, `" . _mysql_prefix . "-users`.email, `" . _mysql_prefix . "-groups`.title, `" . _mysql_prefix . "-groups`.icon, `" . _mysql_prefix . "-users`.id FROM `" . _mysql_prefix . "-users`, `" . _mysql_prefix . "-groups` WHERE `" . _mysql_prefix . "-users`.`group`=`" . _mysql_prefix . "-groups`.id" . $grouplimit . " ORDER BY `" . _mysql_prefix . "-groups`.level DESC,`" . _mysql_prefix . "-users`.id " . $paging[1]);
} else {
    $query = DB::query("SELECT `" . _mysql_prefix . "-users`.username, `" . _mysql_prefix . "-users`.publicname, `" . _mysql_prefix . "-users`.levelshift, `" . _mysql_prefix . "-users`.email, `" . _mysql_prefix . "-groups`.title, `" . _mysql_prefix . "-groups`.icon, `" . _mysql_prefix . "-users`.id FROM `" . _mysql_prefix . "-users`, `" . _mysql_prefix . "-groups` WHERE `" . _mysql_prefix . "-users`.`group`=`" . _mysql_prefix . "-groups`.id AND (`" . _mysql_prefix . "-users`.username LIKE '%" . $searchword . "%' OR `" . _mysql_prefix . "-users`.publicname LIKE '%" . $searchword . "%' OR `" . _mysql_prefix . "-users`.email LIKE '%" . $searchword . "%' OR `" . _mysql_prefix . "-users`.ip LIKE '%" . $searchword . "%')" . $grouplimit . " ORDER BY `" . _mysql_prefix . "-groups`.level DESC,`" . _mysql_prefix . "-users`.id LIMIT 100");
}
// vypis
if (DB::size($query) != 0) {
    while ($item = DB::row($query)) {
        $output .= "<tr><td>" . $item['id'] . "</td><td>" . ($item['icon'] != "" ? "<img src='" . _indexroot . "pictures/groupicons/" . $item['icon'] . "' alt='icon' class='groupicon' /> " : '') . "<a href='index.php?p=users-edit&amp;id=" . $item['username'] . "'>" . ($item['levelshift'] == 1 ? "<strong>" : '') . $item['username'] . ($item['levelshift'] == 1 ? "</strong>" : '') . "</a></td><td>" . $item['email'] . "</td><td>" . ($item['publicname'] != "" ? $item['publicname'] : "-") . "</td><td>" . $item['title'] . "</td><td><a href='" . _xsrfLink("index.php?p=users-delete&amp;id=" . $item['username']) . "' onclick='return _sysConfirm();'><img src='images/icons/delete.png' alt='del' class='icon' />" . $_lang['global.delete'] . "</a></td></tr>\n";
    }
    }
}
/* ---  odstraneni obrazku  --- */
if (isset($_GET['del']) && _xsrfCheck(true) && $continue) {
    $del = intval($_GET['del']);
    _tmpGalStorageCleanOnDel('id=' . $del . ' AND home=' . $g);
    DB::query("DELETE FROM `" . _mysql_prefix . "-images` WHERE id=" . $del . " AND home=" . $g);
    if (DB::affectedRows() === 1) {
        $message = _formMessage(1, $_lang['global.done']);
    }
}
/* ---  vystup  --- */
if ($continue) {
    $output .= "\n<a href='index.php?p=content-editgallery&amp;id=" . $g . "' class='backlink'>&lt; návrat zpět</a>\n<h1>" . $_lang['admin.content.manageimgs.title'] . "</h1>\n<p class='bborder'>" . str_replace("*galtitle*", $galdata['title'], $_lang['admin.content.manageimgs.p']) . "</p>\n\n" . $message . "\n\n<script type='text/javascript'>\n/* <![CDATA[ */\n\$(document).ready(function(){\n    \$('.hs_fieldset').each(function(){\n        var fieldset = this;\n        var link = \$(fieldset).find('legend > a').get(0);\n        var form = \$(fieldset).children('form');\n        \$(form).hide();\n        \$(link).click(function(){\n            \$(form).slideToggle('fast');\n\n            return false;\n        });\n    });\n});\n/* ]]> */\n</script>\n\n<fieldset>\n<legend>" . $_lang['admin.content.manageimgs.upload'] . "</legend>\n<form action='index.php?p=content-manageimgs&amp;g=" . $g . "' method='post' enctype='multipart/form-data'>\n    <p>" . sprintf($_lang['admin.content.manageimgs.upload.text'], _galuploadresize_w, _galuploadresize_h) . "</p>\n    <input type='hidden' name='xaction' value='7' />\n    <div id='fmanFiles'><input type='file' name='uf0[]' multiple='multiple' />&nbsp;&nbsp;<a href='#' onclick='return _sysFmanAddFile();'>" . $_lang['admin.fman.upload.addfile'] . "</a></div>\n    <div class='hr'><hr /></div>\n    <p>\n        <input type='submit' value='" . $_lang['admin.content.manageimgs.upload.submit'] . "' />" . (($uplimit = _getUploadLimit(true)) !== null ? " &nbsp;<small>" . $_lang['global.uploadlimit'] . ": <em>" . _getUploadLimit() . "MB</em>, " . $_lang['global.uploadext'] . ": <em>" . implode(', ', SL::$imageExt) . "</em></small>" : '') . "<br />\n        <label><input type='checkbox' value='1' name='moveords' checked='checked' /> " . $_lang['admin.content.manageimgs.moveords'] . "</label>\n    </p>\n" . _xsrfProtect() . "</form>\n</fieldset>\n\n<fieldset class='hs_fieldset'>\n<legend><a href='#'>" . $_lang['admin.content.manageimgs.insert'] . "</a> &nbsp;<small>(" . $_lang['admin.content.manageimgs.insert.tip'] . ")</small></legend>\n<form action='index.php?p=content-manageimgs&amp;g=" . $g . "' method='post' name='addform' onsubmit='_sysGalTransferPath(this);'>\n<input type='hidden' name='xaction' value='1' />\n\n<table>\n<tr class='valign-top'>\n\n<td>\n    <table>\n    <tr>\n    <td class='rpad'><strong>" . $_lang['admin.content.form.title'] . "</strong></td>\n    <td><input type='text' name='title' class='inputmedium' maxlength='64' /></td>\n    </tr>\n\n    <tr>\n    <td class='rpad'><strong>" . $_lang['admin.content.form.ord'] . "</strong></td>\n    <td><input type='text' name='ord' class='inputsmall' disabled='disabled' />&nbsp;&nbsp;<label><input type='checkbox' name='moveords' value='1' checked='checked' onclick=\"_sysDisableField(this.checked, 'addform', 'ord');\" /> " . $_lang['admin.content.manageimgs.moveords'] . "</label></td>\n    </tr>\n\n    <tr>\n    <td class='rpad'><strong>" . $_lang['admin.content.manageimgs.prev'] . "</strong></td>\n    <td><input type='text' name='prev' class='inputsmall' disabled='disabled' />&nbsp;&nbsp;<label><input type='checkbox' name='autoprev' value='1' checked='checked' onclick=\"_sysDisableField(this.checked, 'addform', 'prev');\" /> " . $_lang['admin.content.manageimgs.autoprev'] . "</label></td>\n    </tr>\n\n    <tr>\n    <td class='rpad'><strong>" . $_lang['admin.content.manageimgs.full'] . "</strong></td>\n    <td><input type='text' name='full' class='inputmedium' /></td>\n    </tr>\n\n    <tr>\n    <td></td>\n    <td><input type='submit' value='" . $_lang['global.insert'] . "' /></td>\n    </tr>\n\n    </table>\n</td>\n\n<td>\n" . (_loginright_adminfman ? "<div id='gallery-browser'>\n    " . (!isset($_GET['browserpath']) ? "<a href='#' onclick=\"return _sysGalBrowse('" . urlencode(_upload_dir) . (_loginright_adminfmanlimit ? _loginname . '%2F' : '') . "');\"><img src='images/icons/loupe.png' alt='browse' class='icon' />" . $_lang['admin.content.manageimgs.insert.browser.link'] . "</a>" : "<script type='text/javascript'>_sysGalBrowse('" . _htmlStr($_GET['browserpath']) . "');</script>") . "\n</div>" : '') . "\n</td>\n\n</tr>\n</table>\n\n" . _xsrfProtect() . "</form>\n</fieldset>\n\n";
    // strankovani
    $paging = _resultPaging("index.php?p=content-manageimgs&amp;g=" . $g, $galdata['var2'], "images", "home=" . $g);
    $s = $paging[2];
    $output .= "\n<fieldset>\n<legend>" . $_lang['admin.content.manageimgs.current'] . "</legend>\n<form action='index.php?p=content-manageimgs&amp;g=" . $g . "&amp;page=" . $s . "' method='post' name='editform'>\n<input type='hidden' name='xaction' value='4' />\n\n<input type='submit' value='" . $_lang['admin.content.manageimgs.savechanges'] . "' class='gallery-savebutton' />\n" . $paging[0] . "\n<div class='cleaner'></div>";
    // vypis obrazku
    $images = DB::query("SELECT * FROM `" . _mysql_prefix . "-images` WHERE home=" . $g . " ORDER BY ord " . $paging[1]);
    $images_forms = array();
    if (DB::size($images) != 0) {
        // sestaveni formularu
        while ($image = DB::row($images)) {
            // kod nahledu
            $preview = _galleryImage($image, "1", $galdata['var4'], $galdata['var3']);
            // kod formulare
            $images_forms[] .= "\n<table>\n\n<tr>\n<td class='rpad'><strong>" . $_lang['admin.content.form.title'] . "</strong></td>\n<td><input type='text' name='i" . $image['id'] . "_title' class='inputmedium' value='" . $image['title'] . "' maxlength='64' /></td>\n</tr>\n\n<tr>\n<td class='rpad'><strong>" . $_lang['admin.content.form.ord'] . "</strong></td>\n<td><input type='text' name='i" . $image['id'] . "_ord' class='inputmedium' value='" . $image['ord'] . "' /></td>\n</tr>\n\n" . (!$image['in_storage'] ? "<tr>\n<td class='rpad'><strong>" . $_lang['admin.content.manageimgs.prev'] . "</strong></td>\n<td><input type='hidden' name='i" . $image['id'] . "_prevtrigger' value='1' /><input type='text' name='i" . $image['id'] . "_prev' class='inputsmall' value='" . $image['prev'] . "'" . _inputDisable($image['prev'] != "") . " />&nbsp;&nbsp;<label><input type='checkbox' name='i" . $image['id'] . "_autoprev' value='1' onclick=\"_sysDisableField(checked, 'editform', 'i" . $image['id'] . "_prev');\"" . _checkboxActivate($image['prev'] == "") . " /> " . $_lang['admin.content.manageimgs.autoprev'] . "</label></td>\n</tr>\n\n<tr>\n<td class='rpad'><strong>" . $_lang['admin.content.manageimgs.full'] . "</strong></td>\n<td><input type='text' name='i" . $image['id'] . "_full' class='inputmedium' value='" . $image['full'] . "' /></td>\n</tr>" : '') . "\n\n<tr class='valign-top'>\n<td class='rpad'><strong>" . $_lang['global.preview'] . "</strong></td>\n<td>" . $preview . "<br /><br /><a href='" . _xsrfLink("index.php?p=content-manageimgs&amp;g=" . $g . "&amp;page=" . $s . "&amp;del=" . $image['id']) . "' onclick='return _sysConfirm();'><img src='images/icons/delete.png' alt='del' class='icon' />" . $_lang['admin.content.manageimgs.delete'] . "</a></td>\n</tr>\n\n</table>\n    ";
        }
        // sestaveni tabulky formularu po dvou
        $output .= "\n<table id='gallery-edittable'>";
Exemplo n.º 5
0
 /**
  * List action
  * @param  array      $params
  * @param  array      $action
  * @param  AdminBread $bread
  * @return array
  */
 public static function listAction(array $params, array $action, AdminBread $bread)
 {
     /* ----- prepare query ----- */
     // format condition
     if ('1' !== $action['query_cond']) {
         $cond = $bread->formatSql($action['query_cond'], $action['query_cond_params']);
     } else {
         $cond = $action['query_cond'];
     }
     // format sql
     $sql = $bread->formatSql($action['query'], array('columns' => $action['columns'], 'table' => '`' . $bread->formatTable($bread->table) . "`", 'table_alias' => $bread->tableAlias, 'cond' => $cond));
     // add order by
     if (!empty($action['query_orderby'])) {
         $sql .= " ORDER BY {$action['query_orderby']}";
     }
     /* ----- init paginator ----- */
     if ($action['paginator']) {
         $total = DB::query_row('SELECT COUNT(*) total FROM `' . $bread->formatTable($bread->table) . '` ' . $bread->tableAlias . ' WHERE ' . $cond);
         $paging = _resultPaging(_htmlStr($params['url']), $action['paginator_size'], intval($total['total']));
         $sql .= " {$paging[1]}";
     } else {
         $paging = null;
     }
     /* ----- fetch data ----- */
     $result = DB::query($sql);
     if (false === $result) {
         return array(null, self::ACTION_ERR);
     }
     /* ----- render ----- */
     $out = $bread->render($action['template'], array('result' => $result, 'count' => DB::size($result), 'paging' => $paging, 'self' => $params['action']));
     DB::free($result);
     // return
     return array(null, $out);
 }
Exemplo n.º 6
0
function _HCM_gallery($cesta = "", $rozmery = null, $strankovani = null, $lightbox = 1)
{
    // priprava
    $result = "";
    $cesta = _indexroot . $cesta;
    $cesta_noroot = $cesta;
    if (mb_substr($cesta, -1, 1) != "/") {
        $cesta .= "/";
    }
    if (mb_substr($cesta_noroot, -1, 1) != "/") {
        $cesta_noroot .= "/";
    }
    if (isset($strankovani) and $strankovani > 0) {
        $strankovat = true;
        $strankovani = intval($strankovani);
        if ($strankovani <= 0) {
            $strankovani = 1;
        }
    } else {
        $strankovat = false;
    }
    $lightbox = _boolean($lightbox);
    if (isset($rozmery)) {
        $rozmery = explode('/', $rozmery);
        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;
    }
    if (@file_exists($cesta) and @is_dir($cesta)) {
        $handle = @opendir($cesta);
        // nacteni polozek
        $items = array();
        while (false !== ($item = @readdir($handle))) {
            $ext = pathinfo($item);
            if (isset($ext['extension'])) {
                $ext = mb_strtolower($ext['extension']);
            } else {
                $ext = "";
            }
            if (@is_dir($item) or $item == "." or $item == ".." or !in_array($ext, SL::$imageExt)) {
                continue;
            }
            $items[] = $item;
        }
        @closedir($handle);
        natsort($items);
        // priprava strankovani
        if ($strankovat) {
            $count = count($items);
            $paging = _resultPaging(_indexOutput_url, $strankovani, $count, "", "#hcm_gal" . SL::$hcmUid, "hcm_gal" . SL::$hcmUid . "p");
        }
        // vypis
        $result = "<div class='anchor'><a name='hcm_gal" . SL::$hcmUid . "'></a></div>\n<div class='gallery'>\n";
        $counter = 0;
        foreach ($items as $item) {
            if ($strankovat and $counter > $paging[6]) {
                break;
            }
            if (!$strankovat or $strankovat and _resultPagingIsItemInRange($paging, $counter)) {
                $thumb = _pictureThumb($cesta_noroot . $item, array('x' => $x, 'y' => $y));
                $result .= "<a href='" . $cesta . _htmlStr($item) . "' target='_blank'" . ($lightbox ? " class='lightbox' data-fancybox-group='lb_hcm" . SL::$hcmUid . "'" : '') . "><img src='" . $thumb . "' alt='" . $item . "' /></a>\n";
            }
            $counter++;
        }
        $result .= "</div>\n";
        if ($strankovat) {
            $result .= $paging[0];
        }
    }
    return $result;
}
Exemplo n.º 7
0
}
/* ---  modul  --- */
// titulek
if (_template_autoheadings == 1) {
    $module .= "<h1>" . $_lang['mod.profile.posts'] . "</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-posts' />\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 = "author=" . $query['id'] . " AND `type`!=4 AND `type`!=6 AND `type`!=7";
    $paging = _resultPaging("index.php?m=profile-posts&amp;id=" . $id, 15, "posts", $cond);
    if (_pagingmode == 1 or _pagingmode == 2) {
        $module .= $paging[0];
    }
    $posts = DB::query("SELECT id,type,home,xhome,subject,text,author,time FROM `" . _mysql_prefix . "-posts` WHERE " . $cond . " ORDER BY time DESC " . $paging[1]);
    if (DB::size($posts) != 0) {
        while ($post = DB::row($posts)) {
            switch ($post['type']) {
                case 1:
                case 3:
                    $hometitle = DB::query_row("SELECT title,title_seo FROM `" . _mysql_prefix . "-root` WHERE id=" . $post['home']);
                    $homelink = _linkRoot($post['home'], $hometitle['title_seo']);
                    $hometitle = $hometitle['title'];
                    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=" . $post['home']);
Exemplo n.º 8
0
                 $del_list[] = $r['id'];
             } else {
                 // pouze oznacit
                 DB::query('UPDATE `' . _mysql_prefix . '-pm` SET ' . $role . '_deleted=1 WHERE id=' . $r['id']);
             }
         }
         // fyzicke vymazani
         if (!empty($del_list)) {
             DB::query('DELETE `' . _mysql_prefix . '-pm`,post FROM `' . _mysql_prefix . '-pm` JOIN `' . _mysql_prefix . '-posts` AS post ON (post.type=6 AND post.home=`' . _mysql_prefix . '-pm`.id) WHERE `' . _mysql_prefix . '-pm`.id IN(' . implode(',', $del_list) . ')');
         }
         // info
         $module .= _formMessage(1, $_lang['mod.messages.delete.done']);
     }
 }
 // strankovani
 $paging = _resultPaging(_indexOutput_url, _messagesperpage, 'pm', 'sender=' . _loginid . ' OR receiver=' . _loginid, '&amp;a=' . $a);
 if (_pagingmode == 1 or _pagingmode == 2) {
     $module .= $paging[0];
 }
 // tabulka
 $module .= "\n        <form method='post' action=''>\n<p class='messages-menu'>\n    <img src='" . _templateImage('icons/bubble.png') . "' alt='new' class='icon' /><a href='" . _indexOutput_url . "&amp;a=new'>" . $_lang['mod.messages.new'] . "</a>\n</p>\n\n<table class='messages-table'>\n<tr><td width='10'><input type='checkbox' name='selector' onchange=\"var that=this;\$('table.messages-table input').each(function(){this.checked=that.checked;});\" /></td><td><strong>" . $_lang['mod.messages.message'] . "</strong></td><td><strong>" . $_lang['global.user'] . "</strong></td><td><strong>" . $_lang['mod.messages.time.update'] . "</strong></td></tr>\n";
 $q = DB::query('SELECT pm.id,pm.sender,pm.receiver,pm.sender_readtime,pm.receiver_readtime,pm.update_time,post.subject,(SELECT COUNT(*) FROM `' . _mysql_prefix . '-posts` AS countpost WHERE countpost.home=pm.id AND countpost.type=6 AND (pm.sender=' . _loginid . ' AND countpost.time>pm.receiver_readtime OR pm.receiver=' . _loginid . ' AND countpost.time>pm.sender_readtime)) AS unread_counter FROM `' . _mysql_prefix . '-pm` AS pm JOIN `' . _mysql_prefix . '-posts` AS post ON (post.home=pm.id AND post.type=6 AND post.xhome=-1) WHERE pm.sender=' . _loginid . ' AND pm.sender_deleted=0 OR pm.receiver=' . _loginid . ' AND pm.receiver_deleted=0 ORDER BY pm.update_time DESC ' . $paging[1]);
 while ($r = DB::row($q)) {
     $read = $r['sender'] == _loginid && $r['sender_readtime'] >= $r['update_time'] || $r['receiver'] == _loginid && $r['receiver_readtime'] >= $r['update_time'];
     $module .= "<tr><td><input type='checkbox' name='msg[]' value='" . $r['id'] . "' /></td><td><a href='" . _indexOutput_url . "&amp;a=list&amp;read=" . $r['id'] . "'" . ($read ? '' : ' class="notreaded"') . ">" . $r['subject'] . "</a></td><td>" . _linkUser($r['sender'] == _loginid ? $r['receiver'] : $r['sender']) . " <small>(" . $r['unread_counter'] . ")</small></td><td>" . _formatTime($r['update_time']) . "</td></tr>\n";
 }
 if (!isset($read)) {
     $module .= "<tr><td colspan='4'>" . $_lang['mod.messages.nokit'] . "</td></tr>\n";
 }
 $module .= "\n<tr><td colspan='4'>\n    <div class='hr'><hr /></div>\n    <select name='action'>\n    <option value='1'>" . $_lang['mod.messages.delete.selected'] . "</option>\n    <option value='2'>" . $_lang['mod.messages.delete.readed'] . "</option>\n    <option value='3'>" . $_lang['mod.messages.delete.all'] . "</option>\n    </select>\n    <input type='submit' value='" . $_lang['global.do'] . "' onclick='return _sysConfirm();' />\n</td></tr>\n\n</table>\n" . _xsrfProtect() . "</form>\n";
 // strankovani dole
/**
 * Vytvoreni vypisu prispevku
 *
 * Type Popis               Vars
 * 1    komentare sekce     zamknute komentare 1/0
 * 2    komentare článku    zamknute komentare 1/0
 * 3    prispevky v knize   [polozek na stranu, povoleno prispivani 1/0, zamknuto 1/0]
 * 5    temata ve foru      [polozek na stranu, povoleno prispivani 1/0, zamknuto 1/0]
 * 6    odpovedi na tema    [polozek na stranu, povoleno prispivani 1/0, zamknuto 1/0, id tematu]
 * 7    vypis vzkazu        [zamknuto 1/0]
 * 8    vypis pluginpostu   [polozek na stranu, povoleno prispivani 1/0, zamknuto 1/0, plugin flag, radit sestupne 1/0, [titulek / null]]
 *
 * @param int $type typ prispevku
 * @param int $home id polozky asociovane s komentari
 * @param mixed $vars promenna nastaveni podle typu
 * @param bool $force_locked vynutit zamknuty stav
 * @param string|null $url vlastni url nebo null (= automaticky)
 * @return string
 */
function _postsOutput($type, $home, $vars, $force_locked = false, $url = null)
{
    global $_lang;
    /* ---  typ  --- */
    // vychozi hodnoty
    $desc = "DESC ";
    $ordercol = 'id';
    $countcond = "type=" . $type . " AND xhome=-1 AND home=" . $home;
    $locked_textid = '';
    $autolast = false;
    $postlink = false;
    $pluginflag = null;
    // url
    if (!isset($url)) {
        $url = _indexOutput_url;
    }
    $url_html = _htmlStr($url);
    switch ($type) {
        // komentare v sekci
        case 1:
            $posttype = 1;
            $xhome = -1;
            $subclass = "comments";
            $title = $_lang['posts.comments'];
            $addlink = $_lang['posts.addcomment'];
            $nopostsmessage = $_lang['posts.nocomments'];
            $postsperpage = _commentsperpage;
            $canpost = _loginright_postcomments;
            $locked = _boolean($vars);
            $replynote = true;
            break;
            // komentare u clanku
        // komentare u clanku
        case 2:
            $posttype = 2;
            $xhome = -1;
            $subclass = "comments";
            $title = $_lang['posts.comments'];
            $addlink = $_lang['posts.addcomment'];
            $nopostsmessage = $_lang['posts.nocomments'];
            $postsperpage = _commentsperpage;
            $canpost = _loginright_postcomments;
            $locked = _boolean($vars);
            $replynote = true;
            break;
            // prispevky v knize
        // prispevky v knize
        case 3:
            $posttype = 3;
            $xhome = -1;
            $subclass = "book";
            $title = null;
            $addlink = $_lang['posts.addpost'];
            $nopostsmessage = $_lang['posts.noposts'];
            $postsperpage = $vars[0];
            $canpost = $vars[1];
            $locked = _boolean($vars[2]);
            $replynote = true;
            break;
            // temata ve foru
        // temata ve foru
        case 5:
            $posttype = 5;
            $xhome = -1;
            $subclass = "book";
            $title = null;
            $addlink = $_lang['posts.addtopic'];
            $nopostsmessage = $_lang['posts.notopics'];
            $postsperpage = $vars[0];
            $canpost = $vars[1];
            $locked = _boolean($vars[2]);
            $replynote = true;
            $ordercol = 'bumptime';
            $locked_textid = '3';
            break;
            // odpovedi v tematu
        // odpovedi v tematu
        case 6:
            $posttype = 5;
            $xhome = $vars[3];
            $subclass = "book";
            $title = null;
            $addlink = $_lang['posts.addanswer'];
            $nopostsmessage = $_lang['posts.noanswers'];
            $postsperpage = $vars[0];
            $canpost = $vars[1];
            $locked = _boolean($vars[2]);
            $replynote = false;
            $desc = "";
            $countcond = "type=5 AND xhome=" . $xhome . " AND home=" . $home;
            $autolast = isset($_GET['autolast']);
            $postlink = true;
            break;
            // odpovedi v konverzaci
        // odpovedi v konverzaci
        case 7:
            $posttype = 6;
            $xhome = null;
            $subclass = "book";
            $title = null;
            $addlink = $_lang['posts.addanswer'];
            $nopostsmessage = $_lang['posts.noanswers'];
            $postsperpage = _messagesperpage;
            $canpost = true;
            $locked = _boolean($vars[0]);
            $replynote = false;
            $desc = "";
            $countcond = "type=6 AND home=" . $home;
            $locked_textid = '4';
            $autolast = true;
            break;
            // plugin posty
        // plugin posty
        case 8:
            $posttype = 7;
            $xhome = -1;
            $subclass = "book";
            $title = isset($vars[5]) ? $vars[5] : null;
            $addlink = $_lang['posts.addpost'];
            $nopostsmessage = $_lang['posts.noposts'];
            $postsperpage = $vars[0];
            $canpost = $vars[1];
            $locked = _boolean($vars[2]);
            $replynote = true;
            $pluginflag = $vars[3];
            $countcond .= " AND flag=" . $pluginflag;
            if (!$vars[4]) {
                $desc = '';
            }
            break;
    }
    // vynutit uzamceni parametrem
    if ($force_locked) {
        $locked = true;
    }
    // extend
    $callback = null;
    _extend('call', 'posts.output', array('type' => $type, 'home' => $home, 'xhome' => $xhome, 'vars' => $vars, 'post_type' => $posttype, 'plugin_flag' => $pluginflag, 'canpost' => &$canpost, 'locked' => &$locked, 'autolast' => &$autolast, 'post_link' => &$postlink, 'posts_per_page' => &$postsperpage, 'sql_desc' => &$desc, 'sql_ordercol' => &$ordercol, 'sql_countcond' => &$countcond, 'callback' => &$callback));
    /* ---  vystup  --- */
    $output = "\n  <div class='anchor'><a name='posts'></a></div>\n  <div class='posts-" . $subclass . "'>\n  ";
    if ($title != null) {
        $output .= "<h2>" . $title . _linkRss($home, $posttype) . "</h2>\n";
    }
    $output .= "<div class='posts-form' id='post-form'>\n";
    /* ---  priprava strankovani  --- */
    $paging = _resultPaging($url_html, $postsperpage, "posts", $countcond, "#posts", null, $autolast);
    /* ---  zprava  --- */
    if (isset($_GET['r'])) {
        switch ($_GET['r']) {
            case 0:
                $output .= _formMessage(2, $_lang['posts.failed']);
                break;
            case 1:
                $output .= _formMessage(1, $_lang[$type != 5 ? 'posts.added' : 'posts.topicadded']);
                break;
            case 2:
                $output .= _formMessage(2, str_replace("*postsendexpire*", _postsendexpire, $_lang['misc.requestlimit']));
                break;
            case 3:
                $output .= _formMessage(2, $_lang['posts.guestnamedenied']);
                break;
            case 4:
                $output .= _formMessage(2, $_lang['xsrf.msg']);
                break;
        }
    }
    /* ---  formular nebo odkaz na pridani  --- */
    if (!$locked and (isset($_GET['addpost']) or isset($_GET['replyto']))) {
        // nacteni cisla prispevku pro odpoved
        if ($xhome == -1) {
            if (isset($_GET['replyto']) and $_GET['replyto'] != -1) {
                $reply = intval($_GET['replyto']);
                if ($replynote) {
                    $output .= "<p>" . $_lang['posts.replynote'] . " (<a href='" . $url_html . "#posts'>" . $_lang['global.cancel'] . "</a>).</p>";
                }
            } else {
                $reply = -1;
            }
        } else {
            $reply = $xhome;
        }
        // formular nebo prihlaseni
        if ($canpost) {
            $form = _uniForm("postform", array('posttype' => $type, 'pluginflag' => $pluginflag, 'posttarget' => $home, 'xhome' => $reply, 'url' => $url));
            $output .= $form[0];
        } else {
            $loginform = _uniForm("login", array(), true);
            $output .= "<p>" . $_lang['posts.loginrequired'] . "</p>" . $loginform[0];
        }
    } else {
        if (!$locked) {
            $output .= "<a href='" . _addGetToLink($url_html, "addpost&amp;page=" . $paging[2]) . "#posts'><strong>" . $addlink . " &gt;</strong></a>";
        } else {
            $output .= "<img src='" . _templateImage("icons/lock.png") . "' alt='stop' class='icon' /> <strong>" . $_lang['posts.locked' . $locked_textid] . "</strong>";
        }
    }
    $output .= "</div>\n<div class='hr'><hr /></div>\n\n";
    /* ---  vypis  --- */
    if (_pagingmode == 1 or _pagingmode == 2) {
        $output .= $paging[0];
    }
    // zaklad query
    if ($type == 5) {
        $sql = "SELECT id,author,guest,subject,time,ip,locked,bumptime,sticky,(SELECT COUNT(id) FROM `" . _mysql_prefix . "-posts` WHERE type=5 AND xhome=post.id) AS answer_count";
    } else {
        $sql = "SELECT id,xhome,subject,text,author,guest,time,ip" . _extend('buffer', 'posts.columns');
    }
    $sql .= " FROM `" . _mysql_prefix . "-posts` AS post";
    // podminky a razeni
    $sql .= " WHERE post.type=" . $posttype . (isset($xhome) ? " AND post.xhome=" . $xhome : '') . " AND post.home=" . $home . (isset($pluginflag) ? " AND post.flag=" . $pluginflag : '');
    $sql .= " ORDER BY " . ($type == 5 ? 'sticky DESC,' : '') . $ordercol . ' ' . $desc . $paging[1];
    // dotaz
    $query = DB::query($sql);
    unset($sql);
    // nacteni prispevku do pole
    $items = array();
    if ($type == 5) {
        $item_ids_with_answers = array();
    }
    while ($item = DB::row($query)) {
        $items[$item['id']] = $item;
        if ($type == 5 && $item['answer_count'] != 0) {
            $item_ids_with_answers[] = $item['id'];
        }
    }
    // uvolneni dotazu
    DB::free($query);
    if ($type == 5) {
        // posledni prispevek (pro vypis temat)
        if (!empty($item_ids_with_answers)) {
            $topicextra = DB::query("SELECT * FROM (SELECT id,xhome,author,guest FROM `" . _mysql_prefix . "-posts` AS reply WHERE type=5 AND home=" . $home . " AND xhome IN(" . implode(',', $item_ids_with_answers) . ") ORDER BY reply.id DESC) AS replies GROUP BY xhome");
            while ($item = DB::row($topicextra)) {
                if (!isset($items[$item['xhome']])) {
                    if (_dev) {
                        trigger_error('Nenalezen domovsky prispevek pro odpoved #' . $item['id'], E_USER_WARNING);
                    }
                    continue;
                }
                $items[$item['xhome']]['_lastpost'] = $item;
            }
        }
    } elseif (!empty($items)) {
        // odpovedi (pro komentare)
        $answers = DB::query("SELECT id,xhome,text,author,guest,time,ip FROM `" . _mysql_prefix . "-posts` WHERE type=" . $posttype . " AND home=" . $home . (isset($pluginflag) ? " AND flag=" . $pluginflag : '') . " AND xhome IN(" . implode(',', array_keys($items)) . ") ORDER BY id");
        while ($item = DB::row($answers)) {
            if (!isset($items[$item['xhome']])) {
                if (_dev) {
                    trigger_error('Nenalezen domovsky prispevek pro odpoved #' . $item['id'], E_USER_WARNING);
                }
                continue;
            }
            if (!isset($items[$item['xhome']]['_answers'])) {
                $items[$item['xhome']]['_answers'] = array();
            }
            $items[$item['xhome']]['_answers'][] = $item;
        }
        DB::free($answers);
    }
    // vypis
    if (!empty($items)) {
        // vypis prispevku nebo temat
        if ($type != 5) {
            $hl = true;
            foreach ($items as $item) {
                // nacteni autora
                if ($item['guest'] == "") {
                    $author = _linkUser($item['author'], "post-author");
                } else {
                    $author = "<span class='post-author-guest' title='" . _showIP($item['ip']) . "'>" . $item['guest'] . "</span>";
                }
                // odkazy pro spravu
                $post_access = _postAccess($item);
                if ($type < 6 or $type > 7 or $post_access) {
                    $actlinks = " <span class='post-actions'>";
                    if (($type < 6 or $type > 7) && !$locked) {
                        $actlinks .= "<a href='" . _addGetToLink($url_html, "replyto=" . $item['id']) . "#posts'>" . $_lang['posts.reply'] . "</a>";
                    }
                    if ($post_access) {
                        $actlinks .= (($type < 6 or $type > 7) ? " " : '') . "<a href='index.php?m=editpost&amp;id=" . $item['id'] . "'>" . $_lang['global.edit'] . "</a>";
                    }
                    $actlinks .= "</span>";
                } else {
                    $actlinks = "";
                }
                // avatar
                if (_show_avatars) {
                    $avatar = _getAvatar($item['author']);
                } else {
                    $avatar = null;
                }
                // prispevek
                $hl = !$hl;
                _extend('call', 'posts.post', array('item' => &$item, 'avatar' => &$avatar, 'type' => $type));
                if (null === $callback) {
                    $output .= "<div id='post-" . $item['id'] . "' class='post" . ($hl ? ' post-hl' : '') . (isset($avatar) ? ' post-withavatar' : '') . "'><div class='post-head'>" . $author;
                    if ($type < 6 || $type > 7) {
                        $output .= ", <span class='post-subject'>" . $item['subject'] . "</span> ";
                    }
                    $output .= "<span class='post-info'>(" . _formatTime($item['time']) . ")</span>" . $actlinks . ($postlink ? "<a class='post-postlink' href='" . _addGetToLink($url_html, 'page=' . $paging[2]) . "#post-" . $item['id'] . "'><span>#" . str_pad($item['id'], 6, '0', STR_PAD_LEFT) . "</span></a>" : '') . "</div><div class='post-body" . (isset($avatar) ? ' post-body-withavatar' : '') . "'>" . $avatar . '<div class="post-body-text">' . _parsePost($item['text']) . "</div></div></div>\n";
                } else {
                    $output .= call_user_func($callback, array('item' => $item, 'avatar' => $avatar, 'author' => $author, 'actlinks' => $actlinks, 'page' => $paging[2], 'postlink' => $postlink));
                }
                // odpovedi
                if (($type < 6 || $type > 7) && isset($item['_answers'])) {
                    foreach ($item['_answers'] as $answer) {
                        // jmeno autora
                        if ($answer['guest'] == "") {
                            $author = _linkUser($answer['author'], "post-author");
                        } else {
                            $author = "<span class='post-author-guest' title='" . _showIP($answer['ip']) . "'>" . $answer['guest'] . "</span>";
                        }
                        // odkazy pro spravu
                        if (_postAccess($answer)) {
                            $actlinks = " <span class='post-actions'><a href='index.php?m=editpost&amp;id=" . $answer['id'] . "'>" . $_lang['global.edit'] . "</a></span>";
                        } else {
                            $actlinks = "";
                        }
                        // avatar
                        if (_show_avatars) {
                            $avatar = _getAvatar($answer['author']);
                        } else {
                            $avatar = null;
                        }
                        _extend('call', 'posts.post', array('item' => &$answer, 'avatar' => &$avatar, 'type' => $type));
                        if (null === $callback) {
                            $output .= "<div id='post-" . $answer['id'] . "' class='post-answer" . (isset($avatar) ? ' post-answer-withavatar' : '') . "'><div class='post-head'>" . $author . " " . $_lang['posts.replied'] . " <span class='post-info'>(" . _formatTime($answer['time']) . ")</span>" . $actlinks . "</div><div class='post-body" . (isset($avatar) ? ' post-body-withavatar' : '') . "'>" . $avatar . '<div class="post-body-text">' . _parsePost($answer['text']) . "</div></div></div>\n";
                        } else {
                            $output .= call_user_func($callback, array('item' => $answer, 'avatar' => $avatar, 'author' => $author, 'actlinks' => $actlinks, 'page' => $paging[2], 'postlink' => $postlink));
                        }
                    }
                }
            }
            if (_pagingmode == 2 or _pagingmode == 3) {
                $output .= "<br />" . $paging[0];
            }
        } else {
            // tabulka s tematy
            $hl = false;
            $output .= "\n<table class='topic-table'>\n<thead><tr><td colspan='2'><strong>" . $_lang['posts.topic'] . "</strong></td><td><strong>" . $_lang['global.answersnum'] . "</strong></td><td><strong>" . $_lang['global.lastanswer'] . "</strong></td></tr></thead>\n<tbody>\n";
            foreach ($items as $item) {
                // nacteni autora
                if ($item['guest'] == "") {
                    $author = _linkUser($item['author'], "post-author", false, false, 16);
                } else {
                    $author = "<span class='post-author-guest' title='" . _showIP($item['ip']) . "'>" . _cutStr($item['guest'], 16) . "</span>";
                }
                // nacteni jmena autora posledniho prispevku
                if (isset($item['_lastpost'])) {
                    if ($item['_lastpost']['author'] != -1) {
                        $lastpost = _linkUser($item['_lastpost']['author'], "post-author", false, false, 16);
                    } else {
                        $lastpost = "<span class='post-author-guest'>" . _cutStr($item['_lastpost']['guest'], 16) . "</span>";
                    }
                } else {
                    $lastpost = "-";
                }
                // vyber ikony
                if ($item['sticky']) {
                    $icon = 'sticky';
                } elseif ($item['locked']) {
                    $icon = 'locked';
                } elseif ($item['answer_count'] == 0) {
                    $icon = 'new';
                } elseif ($item['answer_count'] < _topic_hot_ratio) {
                    $icon = 'normal';
                } else {
                    $icon = 'hot';
                }
                // mini strankovani
                $tpages = '';
                $tpages_num = ceil($item['answer_count'] / _commentsperpage);
                if ($tpages_num == 0) {
                    $tpages_num = 1;
                }
                if ($tpages_num > 1) {
                    $tpages .= '<span class=\'topic-pages\'>';
                    for ($i = 1; $i <= 3 && $i <= $tpages_num; ++$i) {
                        $tpages .= "<a href='index.php?m=topic&amp;id=" . $item['id'] . "&amp;page=" . $i . "#posts'>" . $i . '</a>';
                    }
                    if ($tpages_num > 3) {
                        $tpages .= "<a href='index.php?m=topic&amp;id=" . $item['id'] . "&amp;page=" . $tpages_num . "'>" . $tpages_num . ' &rarr;</a>';
                    }
                    $tpages .= '</span>';
                }
                // vystup radku
                $output .= "<tr class='topic-" . $icon . ($hl ? ' topic-hl' : '') . "'><td class='topic-icon-cell'><a href='index.php?m=topic&amp;id=" . $item['id'] . "'><img src='" . _templateImage('icons/topic-' . $icon . '.png') . "' alt='" . $_lang['posts.topic.' . $icon] . "' /></a></td><td class='topic-main-cell'><a href='index.php?m=topic&amp;id=" . $item['id'] . "'>" . $item['subject'] . "</a>" . $tpages . "<br />" . $author . " <small class='post-info'>(" . _formatTime($item['time']) . ")</small></td><td>" . $item['answer_count'] . "</td><td>" . $lastpost . ($item['answer_count'] != 0 ? "<br /><small class='post-info'>(" . _formatTime($item['bumptime']) . ")</small>" : '') . "</td></tr>\n";
                $hl = !$hl;
            }
            $output .= "</tbody></table><br />\n\n";
            if (_pagingmode == 2 or _pagingmode == 3) {
                $output .= $paging[0] . "<br />";
            }
            // posledni odpovedi
            $output .= "\n<div class='hr'><hr /></div><br />\n<h3>" . $_lang['posts.forum.lastact'] . "</h3>\n";
            $query = DB::query("SELECT topic.id AS topic_id,topic.subject AS topic_subject,answer.author,answer.guest,answer.time FROM `" . _mysql_prefix . "-posts` AS answer JOIN `" . _mysql_prefix . "-posts` AS topic ON(topic.type=5 AND topic.id=answer.xhome) WHERE answer.type=5 AND answer.home=" . $home . " AND answer.xhome!=-1 ORDER BY answer.id DESC LIMIT " . _extratopicslimit);
            if (DB::size($query) != 0) {
                $output .= "<ul>\n";
                while ($item = DB::row($query)) {
                    if ($item['guest'] == "") {
                        $author = _linkUser($item['author']);
                    } else {
                        $author = "<span class='post-author-guest'>" . $item['guest'] . "</span>";
                    }
                    $output .= "<li><a href='index.php?m=topic&amp;id=" . $item['topic_id'] . "'>" . $item['topic_subject'] . "</a>&nbsp;&nbsp;<small>(" . $_lang['global.postauthor'] . " " . $author . " " . _formatTime($item['time']) . ")</small></li>\n";
                }
                $output .= "</ul>\n\n";
            } else {
                $output .= "<p>" . $_lang['global.nokit'] . "</p>";
            }
        }
    } else {
        $output .= "<p>" . $nopostsmessage . "</p>";
    }
    $output .= "</div>";
    return $output;
}
Exemplo n.º 10
0
if (_loginright_adminpollall and isset($_GET['author']) and $_GET['author'] != -1) {
    $pasep = true;
    $author_filter_id = intval($_GET['author']);
    $author_filter = "author=" . intval($_GET['author']);
} else {
    $pasep = false;
    $author_filter = "";
    $author_filter_id = -1;
}
$output .= "\n<p class='bborder'>" . $_lang['admin.content.polls.p'] . "</p>\n<p><img src='images/icons/new.png' class='icon' alt='new' /><a href='index.php?p=content-polls-edit'>" . $_lang['admin.content.polls.new'] . "</a></p>\n";
// filtr
if (_loginright_adminpollall) {
    $output .= "\n  <form class='cform' action='index.php' method='get'>\n  <input type='hidden' name='p' value='content-polls' />\n  <strong>" . $_lang['admin.content.polls.filter'] . ":</strong> " . _admin_authorSelect("author", $author_filter_id, "adminpoll=1", null, $_lang['global.all2']) . " <input type='submit' value='" . $_lang['global.apply'] . "' />\n  </form>\n  ";
}
// strankovani
$paging = _resultPaging("index.php?p=content-polls", 25, "polls", $author_filter . _admin_pollAccess($pasep), "&amp;filter=" . $author_filter_id);
$output .= $paging[0] . "<br />";
$output .= $message . "\n<table class='list'>\n<thead><tr><td>" . $_lang['admin.content.form.question'] . "</td>" . (_loginright_adminpollall ? "<td>" . $_lang['article.author'] . "</td>" : '') . "<td>" . $_lang['global.id'] . "</td><td>" . $_lang['global.action'] . "</td></tr></thead>\n<tbody>\n";
// vypis anket
$query = DB::query("SELECT question,id,author,locked FROM `" . _mysql_prefix . "-polls` WHERE " . $author_filter . _admin_pollAccess($pasep) . " ORDER BY id DESC " . $paging[1]);
if (DB::size($query) != 0) {
    while ($item = DB::row($query)) {
        if (_loginright_adminpollall) {
            $username = "******" . _linkUser($item['author']) . "</td>";
        } else {
            $username = "";
        }
        $output .= "<tr><td><a href='index.php?p=content-polls-edit&amp;id=" . $item['id'] . "' class='block'>" . _cutStr($item['question'], 64) . "</a>" . ($item['locked'] == 1 ? " (" . $_lang['admin.content.form.locked'] . ")" : '') . "</td>" . $username . "<td>" . $item['id'] . "</td><td><a href='" . _xsrfLink("index.php?p=content-polls&amp;author=" . $author_filter_id . "&amp;page=" . $paging[2] . "&amp;del=" . $item['id']) . "' onclick='return _sysConfirm();'><img src='images/icons/delete.png' class='icon' alt='del' /> " . $_lang['global.delete'] . "</a></td></tr>\n";
    }
} else {
    $output .= "<tr><td colspan='" . (_loginright_adminpollall ? "4" : "3") . "'>" . $_lang['global.nokit'] . "</td></tr>";
Exemplo n.º 11
0
function _HCM_xlist($adresar = "", $maska_souboru = "", $razeni = 0, $strankovani = 0, $maska = "", $zobrazeni_strankovani = null, $kod_pred = null, $kod_za = null)
{
    //nacteni parametru
    $output = "";
    $rdir = _removeSlashesFromEnd($adresar);
    $rdirs = $rdir . "/";
    $rmask = $maska_souboru;
    if ($rmask == "*") {
        $rmask = 1;
    } elseif ($rmask == "%") {
        $rmask = 2;
    } else {
        $rmask = explode(";", $rmask);
    }
    $rsort = $razeni;
    $rpaging = intval($strankovani);
    if ($rpaging <= 0) {
        $rpaging = false;
    }
    $rtemplate = $maska;
    //nepovinne
    if (isset($zobrazeni_strankovani)) {
        $rpaging_pos = intval($zobrazeni_strankovani);
        if ($rpaging_pos < 0 or $rpaging_pos > 3) {
            $rpaging_pos = 0;
        }
    } else {
        $rpaging_pos = 0;
    }
    if (isset($kod_pred)) {
        $rcover_top = $kod_pred . "\n";
    } else {
        $rcover_top = "";
    }
    if ($rpaging != false) {
        $rcover_top = "<div class='anchor'><a name='hcm_xlist" . SL::$hcmUid . "'></a></div>\n" . $rcover_top;
    }
    if (isset($kod_za)) {
        $rcover_bottom = $kod_za . "\n";
    } else {
        $rcover_bottom = "";
    }
    //otevreni adresare
    $rhandle = @opendir($rdir);
    if ($rhandle) {
        //nacteni polozek
        $ritems = array();
        $rsort_data = array();
        while (false !== ($item = readdir($rhandle))) {
            $rinfo = pathinfo($item);
            if (isset($rinfo['extension'])) {
                $rext = $rinfo['extension'];
            } else {
                $rext = "";
            }
            if ($item == "." or $item == ".." or $rmask != "*" and ($rmask == 2 and !@is_dir($rdirs . $item) or is_array($rmask) and !in_array(mb_strtolower($rext), $rmask))) {
                continue;
            }
            $ritems[] = $item;
            if ($rsort == 3 or $rsort == 4) {
                $rsort_data[] = @filemtime($rdirs . $item);
            }
        }
        closedir($rhandle);
        $count = count($ritems);
        //serazeni polozek
        switch ($rsort) {
            case 1:
                natsort($ritems);
                break;
            case 2:
                natsort($ritems);
                $ritems = array_reverse($ritems, false);
                break;
            case 3:
                asort($rsort_data);
                break;
            case 4:
                arsort($rsort_data);
                break;
            case 5:
                $rrandom = array_rand($ritems, $count);
                $rsort_data = array();
                foreach ($rrandom as $key) {
                    $rsort_data[$key] = null;
                }
                break;
        }
        //sjednoceni poli pri razeni podle $rsort_data
        if ($rsort == 3 or $rsort == 4 or $rsort == 5) {
            $ritems_new = array();
            foreach ($rsort_data as $key => $val) {
                $ritems_new[] = $ritems[$key];
            }
            $ritems = $ritems_new;
        }
        //inicializace strankovani
        if ($rpaging != false) {
            $rpaging_data = _resultPaging(_indexOutput_url, $rpaging, $count, "", "#hcm_xlist" . SL::$hcmUid, "hcm_xlist" . SL::$hcmUid . "p");
        }
        //vypis horniho strankovani a obalu
        if ($rpaging != false and ($rpaging_pos == 1 or $rpaging_pos == 2)) {
            $output .= $rpaging_data[0];
        }
        $output .= $rcover_top;
        //vypis polozek
        $counter = 0;
        if ($rpaging == false) {
            $end = $count - 1;
        }
        foreach ($ritems as $item) {
            //efekty strankovani
            if ($rpaging != false) {
                $end = $rpaging_data[6];
                if ($counter > $end) {
                    break;
                }
                if (!_resultPagingIsItemInRange($rpaging_data, $counter)) {
                    $counter++;
                    continue;
                }
            }
            //odrezani pripony
            if (!is_array($rmask) and $rmask == "%") {
                $dotpos = false;
            } else {
                $dotpos = mb_strrpos($item, ".");
            }
            if ($dotpos == false) {
                $item_noext = $item;
            } else {
                $item_noext = mb_substr($item, 0, $dotpos);
            }
            //nahrazeni znacek, vypis kodu
            $GLOBALS['_hcm_xlist_data'] = array(SL::$hcmUid, $rdirs, $item, $item_noext, $counter, $count, $end);
            $output .= preg_replace_callback('|\\[tag\\](.*?)\\[/tag\\]|s', '_tmp_hcm_xlistReplaceTemplateMatch', $rtemplate) . "\n";
            $counter++;
        }
        unset($GLOBALS['_hcm_xlist_data']);
        //vypis dolniho obalu a strankovani
        $output .= $rcover_bottom;
        if ($rpaging != false and ($rpaging_pos == 0 or $rpaging_pos == 2)) {
            $output .= $rpaging_data[0];
        }
    } else {
        $output = "Nelze otevrit adresar.";
    }
    return $output;
}
Exemplo n.º 12
0
}
/* ---  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'];
    }
}
Exemplo n.º 13
0
}
// 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];
    }
} else {