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;
}
Beispiel #2
0
 /**
  * Vydumpovat hodnotu
  *
  * @param mixed $value
  * @param int $level
  * @return string
  */
 protected function dump($value, $level = 0)
 {
     if (is_object($value)) {
         return 'object(' . get_class($value) . ')';
     } elseif (is_array($value)) {
         if ($level > 9) {
             return 'array(' . sizeof($value) . ')';
         }
         $out = "array(" . sizeof($value) . ") {\n";
         $padding = str_repeat('    ', $level + 1);
         foreach ($value as $key => $val) {
             $out .= $padding . _htmlStr($key) . ' => ' . $this->dump($val, $level + 1) . "\n";
         }
         $out .= '}';
         return $out;
     } elseif (is_string($value)) {
         return 'string(' . strlen($value) . ') &quot;' . _htmlStr(_cutStr($value, 192)) . "&quot;";
     } elseif (is_int($value)) {
         return 'int(' . $value . ')';
     } elseif (is_float($value)) {
         return 'float(' . $value . ')';
     } elseif (is_bool($value)) {
         return 'bool(' . ($value ? 'true' : 'false') . ')';
     } else {
         return gettype($value);
     }
 }
Beispiel #3
0
                     } else {
                         $link = 'index.php?m=topic&amp;id=' . $r['id'];
                         $title = $r['subject'];
                         $post_anchor = false;
                     }
                     break;
             }
             // sestaveni infa
             if ($r['author'] == -1) {
                 $info = "<span class='post-author-guest'>" . $r['guest'] . '</span>';
             } else {
                 $info = _linkUser($r['author'], null, true, true);
             }
             $info .= ', ' . _formatTime($r['time']);
             // pridani do vysledku
             $results[] = array((isset($page) ? _addGetToLink($link, 'page=' . $page) : $link) . ($post_anchor ? '#post-' . $r['id'] : ''), $title, _cutStr(strip_tags(_parsePost($r['text'])), 255), $info);
         }
         DB::free($q);
     }
 }
 // vyhledani obrazku
 if ($image) {
     // zaklad dotazu
     $sql = 'SELECT img.id,img.prev,img.full,img.ord,img.home,img.title,gal.title AS gal_title,gal.title_seo,gal.var2 FROM `' . _mysql_prefix . '-images` AS img';
     // join na galerii
     $sql .= ' JOIN `' . _mysql_prefix . '-root` AS gal ON(gal.id=img.home)';
     // podminky
     $sql .= ' WHERE gal.visible=1';
     if ($public) {
         $sql .= ' AND gal.public=1';
     }
Beispiel #4
0
                    case 3:
                        $homelink = _linkRoot($item['home']);
                        break;
                    case 2:
                        $homelink = _linkArticle($item['home']);
                        break;
                    case 5:
                        if ($item['xhome'] == -1) {
                            $homelink = "index.php?m=topic&amp;id=" . $item['id'];
                        } else {
                            $homelink = "index.php?m=topic&amp;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) {
    $iteminfo = pathinfo($item);
    $image = false;
    if (!isset($iteminfo['extension'])) {
        $iteminfo['extension'] = "";
    }
    $ext = mb_strtolower($iteminfo['extension']);
    if (in_array($ext, array("rar", "zip", "tar", "gz", "tgz", "7z", "cab", "xar", "xla", "777", "alz", "arc", "arj", "bz", "bz2", "bza", "bzip2", "dz", "gza", "gzip", "lzma", "lzs", "lzo", "s7z", "taz", "tbz", "tz", "tzip"))) {
        $icon = "archive";
    } elseif (in_array($ext, array("jpg", "jpeg", "png", "gif", "bmp", "jp2", "tga", "pcx", "tif", "ppf", "pct", "pic", "ai", "ico"))) {
        $icon = "image";
        $image = true;
    } elseif (in_array($ext, array("sql", "php", "php3", "php4", "php5", "phtml", "py", "asp", "cgi", "shtml", "htaccess", "txt", "nfo", "rtf", "html", "htm", "xhtml", "css", "js", "ini", "bat", "inf", "me", "inc", "xml"))) {
        $icon = "editable";
    } elseif (in_array($ext, array("wav", "mp3", "mid", "rmi", "wma", "mpeg", "mpg", "wmv", "3gp", "mp4", "m4a", "xac", "aif", "au", "avi", "voc", "snd", "vox", "ogg", "flac", "mov", "aac", "vob", "amr", "asf", "rm", "ra", "ac3", "swf", "flv"))) {
        $icon = "media";
    } elseif (in_array($ext, array("exe", "com", "bat", "dll"))) {
        $icon = "executable";
    } elseif (in_array($ext, array("sld"))) {
        $icon = "sl";
    } else {
        $icon = "other";
    }
    if ($highlight) {
        $hl_class = " class='hl'";
    } else {
        $hl_class = "";
    }
    print "\n<tr" . $hl_class . ">\n<td" . (!$image ? ' class="noimage" colspan="2"' : '') . "><a" . ($image ? ' href="../' . _htmlStr(mb_substr($dir . $item, mb_strlen(_indexroot))) . '" class="lightbox" data-fancybox-group="galbr" title="' . round(@filesize($dir . $item) / 1024) . 'kB" target="_blank"' : '') . "><img src='images/icons/fman/" . $icon . ".png' alt='file' class='icon' />" . _htmlStr(_cutStr($item, 32, false)) . "</a></td>\n" . ($image ? '<td><a href="#" onclick="return _sysGalSelect(\'' . _htmlStr(mb_substr($dir . $item, mb_strlen(_indexroot))) . '\')">' . $_lang['admin.content.manageimgs.insert.browser.use'] . '</a></td>' : '') . "\n</tr>\n";
    $highlight = !$highlight;
}
print '</table>';
}
/* ---  modul  --- */
$list = false;
$mod_title = 'mod.messages';
// obsah
switch ($a) {
    /* ---  nova zprava  --- */
    case 'new':
        // titulek
        $mod_title = 'mod.messages.new';
        // odeslani
        if (isset($_POST['receiver'])) {
            // nacteni dat
            $receiver = _post('receiver');
            $subject = _htmlStr(_wsTrim(_cutStr(_post('subject'), 22, false)));
            $text = _htmlStr(_wsTrim(_cutStr(_post('text'), 16384, false)));
            // kontrola a odeslani
            do {
                /* ---  kontrola  --- */
                // text
                if ($text === '') {
                    $message = _formMessage(2, $_lang['mod.messages.error.notext']);
                    break;
                }
                // predmet
                if ($subject === '') {
                    $message = _formMessage(2, $_lang['mod.messages.error.nosubject']);
                    break;
                }
                // prijemce
                if ($receiver !== '') {
    $handle = opendir($backup_dir);
    while (false !== ($item = readdir($handle))) {
        if ($item === '.' || $item === '..' || !is_file($backup_dir . $item)) {
            continue;
        }
        $backups[] = $item;
    }
    // serazeni a vypis
    if (!empty($backups)) {
        natsort($backups);
        $output .= "<table class='list'>\n<thead><tr><td>" . $_lang['admin.other.backup.restore.item'] . "</td><td>" . $_lang['global.type'] . "</td><td>" . $_lang['global.time'] . "</td><td>" . $_lang['global.note'] . "</td><td>" . $_lang['global.size'] . "</td><td>" . $_lang['global.extra'] . "</td></tr></thead>\n<tbody>\n";
        foreach ($backups as $file) {
            // info o archivu
            $file_err = false;
            $file_vars = _backupCheckFile($backup_dir . $file, array(_backup_db, _backup_partial), true);
            if (!is_array($file_vars)) {
                $file_err = true;
            }
            $file_h = _htmlStr($file);
            // polozka
            $output .= "<tr>\n<td><label><input type='radio' name='fname' value='" . $file_h . "'" . ($file_err ? " disabled='disabled'" : '') . " /> " . $file_h . "</label></td>\n<td>" . ($file_err ? '-' : $_lang['admin.other.backup.backup.' . ($file_vars['type'] === _backup_db ? 'db' : 'partial')]) . "</td>\n<td>" . ($file_err ? '-' : _formatTime($file_vars['time'])) . "</td>\n<td>" . ($file_err ? "<img src='images/icons/warn.png' alt='err' /> " . $_lang['global.error'] : (empty($file_vars['note']) ? '-' : _htmlStr(_cutStr($file_vars['note'], 48, false)))) . "</td>\n<td>" . number_format(filesize($backup_dir . $file) / 1024, 0, '.', ' ') . "kB</td>\n<td><a href='" . $backup_dir . $file_h . "'>" . $_lang['global.download'] . "</a></td>\n</tr>\n";
        }
        $output .= "</tbody></table><br />\n\n<p><strong>" . $_lang['global.action'] . ":</strong> &nbsp;\n<select name='sub_action'>\n    <option value='-1'>...</option>\n    <option value='1'>" . $_lang['admin.other.backup.restore.do'] . "</option>\n    <option value='2'>" . $_lang['global.delete'] . "</option>\n</select> &nbsp;\n<input type='submit' value='" . $_lang['global.do'] . "' onclick='return _sysConfirm();' />&nbsp;\n<a href='index.php?p=fman&amp;dir=" . urlencode('../data/backup/') . "'><img src='images/icons/list.png' class='icon' alt='fman' />" . $_lang['admin.other.backup.restore.fman'] . "</a>\n</p>\n\n" . _admin_smallNote($_lang['admin.other.backup.restore.warning'], true, 'warn');
    } else {
        $output .= '<p>' . $_lang['admin.other.backup.restore.none'] . '</p>';
    }
    $output .= "\n</fieldset>\n" . _xsrfProtect() . "</form>\n";
} else {
    /* ----- volba akce ----- */
    $output .= (_loginright_adminbackup ? "\n<fieldset>\n<legend>" . $_lang['admin.other.backup.backup'] . "</legend>\n<form action='index.php?p=other-backup' method='post'>\n<p>" . $_lang['admin.other.backup.backup.p'] . "</p>\n\n<input type='hidden' name='do_backup' value='1' />\n<p><input type='submit' value='" . $_lang['admin.other.backup.backup.db'] . "' name='type_db' />&nbsp; <small class='note'>(" . $_lang['admin.other.backup.backup.db.hint'] . ")</small></p>\n<p><input type='submit' value='" . $_lang['admin.other.backup.backup.partial'] . "' name='type_partial' />&nbsp; <small class='note'>(" . $_lang['admin.other.backup.backup.partial.hint'] . ")</small></p>\n<p><input type='submit' value='" . $_lang['admin.other.backup.backup.full'] . "' name='type_full' />&nbsp; <small class='note'>(" . $_lang['admin.other.backup.backup.full.hint'] . ")</small></p>\n\n" . _xsrfProtect() . "</form>\n</fieldset>" : '') . (_loginright_adminrestore ? "\n\n<fieldset>\n<legend>" . $_lang['admin.other.backup.restore'] . "</legend>\n<form class='cform' method='post'>\n<p>" . $_lang['admin.other.backup.restore.p'] . "</p>\n<p><input type='submit' name='do_restore' value='" . $_lang['global.continue'] . "' /></p>\n" . _xsrfProtect() . "</form>\n</fieldset>\n" : '');
}
/**
 * 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;
}
/**
 * [ADMIN] Sestavit <select> pro vyber stranky
 * @param string $name nazev selectu
 * @param int|null $typ stranky nebo null (= vsechny)
 * @param int $selected id zvolene stranky
 * @param bool $allowempty povolit vyber zadne polozky (-1) 1/0
 * @param string|null $emptycustomcaption vlastni popisek zadne polozky nebo null (= vychozi)
 * @param int|null $maxlength maximalni delka zobrazeneho titulku stranky (null = deaktivovat)
 * @return string
 */
function _admin_rootSelect($name, $type, $selected, $allowempty, $emptycustomcaption = null, $maxlength = 22)
{
    global $_lang;
    $return = "<select name='" . $name . "' class='ae-artselect'>\n";
    $items = DB::query("SELECT id,title,type FROM `" . _mysql_prefix . "-root` WHERE " . (isset($type) ? "(type=" . $type . " OR type=7)" : 'type!=4') . " AND intersection=-1 ORDER BY ord");
    if (DB::result(DB::query("SELECT COUNT(id) FROM `" . _mysql_prefix . "-root`" . (isset($type) ? " WHERE type=" . $type : '')), 0) != 0) {
        if ($allowempty) {
            if ($emptycustomcaption == null) {
                $emptycustomcaption = $_lang['admin.content.form.category.none'];
            }
            $return .= "<option value='-1' class='special'>" . $emptycustomcaption . "</option>";
        }
        while ($item = DB::row($items)) {
            if ($item['type'] != 7 || $type == 7) {
                if ($item['id'] == $selected) {
                    $sel = " selected='selected'";
                } else {
                    $sel = "";
                }
                $return .= "<option value='" . $item['id'] . "'" . $sel . ">" . _cutStr($item['title'], $maxlength) . "</option>\n";
            }
            if ($item['type'] == 7 && $type != 7) {
                $iitems = DB::query("SELECT id,title,type FROM `" . _mysql_prefix . "-root` WHERE " . (isset($type) ? "type=" . $type . "" : 'type!=4') . " AND intersection=" . $item['id'] . " ORDER BY ord");
                if (!isset($type) || DB::size($iitems) != 0) {
                    $return .= "<optgroup label='" . $item['title'] . "'>\n";
                    if (!isset($type)) {
                        $return .= '<option value=\'' . $item['id'] . '\'' . ($item['id'] == $selected ? ' selected=\'selected\'' : '') . ' class=\'special\'>' . $_lang['admin.content.form.thisintersec'] . "</option>\n";
                    }
                    while ($iitem = DB::row($iitems)) {
                        if ($iitem['id'] == $selected) {
                            $sel = " selected='selected'";
                        } else {
                            $sel = "";
                        }
                        $return .= "<option value='" . $iitem['id'] . "'" . $sel . ">" . _cutStr($iitem['title'], 22) . "</option>\n";
                    }
                    $return .= "</optgroup>\n";
                }
            }
        }
    } else {
        $return .= "\n<option value='-1'>" . $_lang['global.nokit'] . "</option>\n";
    }
    $return .= "\n</select>\n";
    return $return;
}
Beispiel #10
0
}
// typ, domov, text
$posttarget = intval($_POST['_posttarget']);
$posttype = intval($_POST['_posttype']);
$text = DB::esc(_htmlStr(_wsTrim(_cutStr($_POST['text'], $posttype != 4 ? 16384 : 255, false))));
// domovsky prispevek
if ($posttype != 4) {
    _checkKeys('_POST', array('_xhome'));
    $xhome = intval($_POST['_xhome']);
} else {
    $xhome = -1;
}
// predmet
if ($xhome == -1 and $posttype != 4) {
    _checkKeys('_POST', array('subject'));
    $subject = DB::esc(_htmlStr(_wsTrim(_cutStr($_POST['subject'], $posttype == 5 ? 48 : 22, false))));
} else {
    $subject = "";
}
// plugin flag
if ($posttype == 8) {
    if (!isset($_POST['_pluginflag'])) {
        die;
    }
    $pluginflag = intval($_POST['_pluginflag']);
} else {
    $pluginflag = 0;
}
// vyplneni prazdnych poli
if ($subject == "" and $xhome == -1 and $posttype != 4) {
    $subject = "-";
    $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>";
}
$output .= "\n</tbody>\n</table>\n\n<br />\n<form class='cform' action='index.php' method='get'>\n<input type='hidden' name='p' value='content-polls-edit' />\n" . $_lang['admin.content.polls.openid'] . ": <input type='text' name='id' class='inputmini' /> <input type='submit' value='" . $_lang['global.open'] . "' />\n</form>\n";
Beispiel #12
0
        // odkaz na prispevky uzivatele
        $posts_count = DB::result(DB::query("SELECT COUNT(id) FROM `" . _mysql_prefix . "-posts` WHERE author=" . $query['id'] . ' AND `type`!=6 AND `type`!=4'), 0);
        if ($posts_count > 0) {
            $posts_viewlink = ", <a href='index.php?m=profile-posts&amp;id=" . $id . "'>" . $_lang['global.show'] . " &gt;</a>";
        } else {
            $posts_viewlink = "";
        }
    } else {
        $message = _formMessage(2, $_lang['global.baduser']);
        $found = false;
    }
}
/* ---  modul  --- */
// titulek
if (_template_autoheadings == 1) {
    $module .= "<h1>" . $_lang['mod.profile'] . "</h1><br />";
}
// vyhledavaci pole
$module .= "\n  <form action='index.php' method='get' class='profileform'>\n  <input type='hidden' name='m' value='profile' />\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 ($form == true) {
    // poznamka o blokovani
    if ($query['blocked'] == 1 or $groupdata['blocked'] == 1) {
        $module .= "\n<strong class='important'>" . $_lang['mod.profile.blockednote'] . "</strong><br /><br />\n";
    }
    $module .= "\n  <table>\n\n  <tr class='valign-top'>\n\n  <td class='avatartd'>\n  <div class='avatar'>\n  <img src='" . $query['avatar'] . "' alt='avatar' />\n  </div>\n  </td>\n\n  <td>\n    <table class='profiletable'>\n\n    <tr>\n    <td><strong>" . $_lang['login.username'] . "</strong></td>\n    <td>" . $query['username'] . "</td>\n    </tr>\n\n    " . ($query['publicname'] != "" ? "<tr><td><strong>" . $_lang['mod.settings.publicname'] . "</strong></td><td>" . $query['publicname'] . "</td></tr>" : '') . "\n\n    <tr>\n    <td><strong>" . $_lang['global.group'] . "</strong></td>\n    <td>" . ($groupdata['icon'] != "" ? "<img src='" . _indexroot . "pictures/groupicons/" . $groupdata['icon'] . "' alt='icon' class='icon' /> " : '') . ($groupdata['color'] !== '' ? '<span style="color:' . $groupdata['color'] . ';">' . $groupdata['title'] . '</span>' : $groupdata['title']) . "</td>\n    </tr>\n\n    " . ($groupdata['descr'] !== '' ? "<tr>\n    <td><strong>" . $_lang['mod.profile.groupdescr'] . "</strong></td>\n    <td>" . $groupdata['descr'] . "</td>\n    </tr>" : '') . "\n\n    <tr>\n    <td><strong>" . $_lang['mod.profile.lastact'] . "</strong></td>\n    <td>" . _formatTime($query['activitytime']) . "</td>\n    </tr>\n\n    </table>\n  </td>\n\n  </tr>\n  </table>\n\n  <div class='hr'><hr /></div>\n\n  <div class='wlimiter'>\n  <table class='profiletable'>\n\n  <tr><td><strong>" . $_lang['mod.profile.regtime'] . "</strong></td><td>" . _formatTime($query['registertime']) . "</td></tr>\n  " . (_profileemail ? "<tr><td><strong>" . $_lang['global.email'] . "</strong></td><td>" . _mailto($query['email']) . "</td></tr>" : '') . "\n  " . ($query['icq'] != 0 ? "<tr><td><strong>" . $_lang['global.icq'] . "</strong></td><td>" . $query['icq'] . " <img src='http://status.icq.com/online.gif?icq=" . $query['icq'] . "&amp;img=5' alt='icq status' class='icon' /></td></tr>" : '') . "\n  " . ($query['skype'] != "" ? "<tr><td><strong>" . $_lang['global.skype'] . "</strong></td><td>" . $query['skype'] . "</td></tr>" : '') . "\n  " . ($query['msn'] != "" ? "<tr><td><strong>" . $_lang['global.msn'] . "</strong></td><td>" . _mailto(_htmlStr($query['msn'])) . "</td></tr>" : '') . "\n  " . ($query['jabber'] != "" ? "<tr><td><strong>" . $_lang['global.jabber'] . "</strong></td><td>" . _mailto(_htmlStr($query['jabber'])) . "</td></tr>" : '') . "\n  " . ($query['web'] != "" ? "<tr><td><strong>" . $_lang['global.web'] . "</strong></td><td><a href='http://" . $query['web'] . "' target='_blank' rel='nofollow'>" . _cutStr($query['web'], 32) . "</a></td></tr>" : '') . "\n\n  <tr>\n  <td><strong>" . $_lang['global.postsnum'] . "</strong></td>\n  <td>" . $posts_count . $posts_viewlink . "</td>\n  </tr>\n\n  " . $arts . "\n  " . $note . "\n\n  <tr>\n  <td><strong>" . $_lang['mod.profile.logincounter'] . "</strong></td>\n  <td>" . $query['logincounter'] . "</td>\n  </tr>\n\n  </table>\n  </div>\n  ";
    // odkaz na zaslani vzkazu
    if (_loginindicator and _messages and $query['id'] != _loginid and $query['blocked'] == 0 and $groupdata['blocked'] == 0) {
        $module .= "<p><img src='" . _templateImage("icons/bubble.png") . "' alt='msg' class='icon' /> <a href='index.php?m=messages&amp;a=new&amp;receiver=" . $query['username'] . "'>" . $_lang['mod.messages.new'] . " &gt;</a></p>";
    }
}
 if (!_checkboxLoad("delete")) {
     /* -  uprava  - */
     // nacteni promennych
     // jmeno hosta
     if ($query['guest'] != "") {
         $guest = $_POST['guest'];
         if (mb_strlen($guest) > 24) {
             $guest = mb_substr($guest, 0, 24);
         }
         $guest = _anchorStr($guest, false);
     } else {
         $guest = "";
     }
     $text = DB::esc(_htmlStr(_wsTrim(_cutStr($_POST['text'], $query['type'] != 4 ? 16384 : 255, false))));
     if ($query['xhome'] == -1 and $query['type'] != 4) {
         $subject = DB::esc(_htmlStr(_wsTrim(_cutStr($_POST['subject'], $query['type'] == 5 ? 48 : 22, false))));
     } else {
         $subject = "";
     }
     // vyplneni prazdnych poli
     if ($subject == "" and $query['xhome'] == -1 and $query['type'] != 4) {
         $subject = "-";
     }
     if ($guest == null and $query['guest'] != "") {
         $guest = $_lang['posts.anonym'];
     }
     // ulozeni
     if ($text != "") {
         DB::query("UPDATE `" . _mysql_prefix . "-posts` SET text='" . $text . "',subject='" . $subject . "'" . (isset($guest) ? ",guest='" . $guest . "'" : '') . " WHERE id=" . $id);
         define('_redirect_to', 'index.php?m=editpost&id=' . $id . '&saved');
         return;
}
/* ---  vystup  --- */
if ($continue != true) {
    $output .= _formMessage(3, $_lang['global.badinput']);
} else {
    // vyber rozcestniku
    if ($type != 7) {
        $intersection_select = "<select name='intersection' class='selectmedium'><option value='-1' class='special'>" . $_lang['admin.content.form.intersection.none'] . "</option>";
        $isquery = DB::query("SELECT id,title FROM `" . _mysql_prefix . "-root` WHERE type=7 ORDER BY ord");
        while ($item = DB::row($isquery)) {
            if ($item['id'] == $query['intersection']) {
                $selected = " selected='selected'";
            } else {
                $selected = "";
            }
            $intersection_select .= "<option value='" . $item['id'] . "'" . $selected . ">" . _cutStr($item['title'], 22) . "</option>";
        }
        $intersection_select .= "</select>";
        $intersection_row = "<td class='rpad'><strong>" . $_lang['admin.content.form.intersection'] . "</strong></td><td>" . $intersection_select . "</td>";
    } else {
        $intersection_select = "";
        $intersection_row = "";
    }
    // wysiwyg editor
    $output .= _admin_wysiwyg();
    // stylove oddeleni individualniho nastaveni
    if ($custom_settings != "") {
        $custom_settings = "<span class='customsettings'>" . $custom_settings . "</span>";
    }
    // formular
    $output .= "<div class='hr'><hr /></div><br />" . (isset($_GET['saved']) ? _formMessage(1, $_lang['global.saved'] . "&nbsp;&nbsp;<small>(" . _formatTime(time()) . ")</small>") : '') . "\n\n" . (!$new && $type != 4 && DB::result(DB::query('SELECT COUNT(*) FROM `' . _mysql_prefix . '-root` WHERE `id`!=' . $query['id'] . ' AND `title_seo`=\'' . $query['title_seo'] . '\''), 0) != 0 ? _formMessage(2, $_lang['admin.content.form.title_seo.collision']) : '') . "\n" . (!$new && $id == _index_page_id ? _admin_smallNote($_lang['admin.content.form.indexnote']) : '') . "\n<form" . ($type != 4 ? " class='cform'" : '') . " action='index.php?p=content-edit" . $type_array[$type] . (!$new ? "&amp;id=" . $id : '') . ($type == 9 && $new ? '&amp;idt=' . $type_idt : '') . "' method='post'>\n\n\n" . $editscript_extra . "\n" . (!$new && $type == 5 ? "<p><a href='index.php?p=content-manageimgs&amp;g=" . $id . "'><img src='images/icons/edit.png' alt='edit' class='icon' /><big>" . $_lang['admin.content.form.manageimgs'] . " &gt;</big></a></p>" : '') . "\n\n<table class='formtable'>\n\n<tr>\n<td class='rpad'><strong>" . $_lang['admin.content.form.title'] . "</strong></td>\n<td><input type='text' name='title' value='" . $query['title'] . "' class='inputmedium' maxlength='96' /></td>\n\n" . ($type != 4 ? "<td class='rpad'><strong>" . $_lang['admin.content.form.title_seo'] . "</strong></td>\n<td><input type='text' name='title_seo' value='" . $query['title_seo'] . "' maxlength='255' class='inputmedium' /></td>" : $intersection_row) . "\n</tr>\n\n<tr>\n<td class='rpad'><strong>" . $_lang['admin.content.form.ord'] . "</strong></td>\n<td><input type='text' name='ord' value='" . $query['ord'] . "' class='inputmedium' /></td>\n\n" . ($type != 4 ? $intersection_row : '') . "\n</tr>\n\n" . ($type != 4 ? "\n<tr>\n<td class='rpad'><strong>" . $_lang['admin.content.form.description'] . "</strong></td>\n<td><input type='text' name='description' value='" . $query['description'] . "' maxlength='128' class='inputmedium' /></td>\n\n<td class='rpad'><strong>" . $_lang['admin.content.form.keywords'] . "</strong></td>\n<td><input type='text' name='keywords' value='" . $query['keywords'] . "' maxlength='128' class='inputmedium' /></td>\n</tr>\n\n<tr class='valign-top'>\n<td class='rpad'><strong>" . $_lang['admin.content.form.intersectionperex'] . "</strong></td>\n<td colspan='3'><textarea name='intersectionperex' rows='2' cols='94' class='arealine codemirror'>" . _htmlStr($query['intersectionperex']) . "</textarea></td>\n</tr>\n\n" . ($editscript_enable_content ? "\n<tr class='valign-top'>\n<td class='rpad'><strong>" . $_lang['admin.content.form.' . ($type != 6 ? 'content' : 'url')] . "</strong>" . (!$new ? " <a href='" . _indexroot . _linkRoot($query['id'], $query['title_seo']) . "' target='_blank'><img src='images/icons/loupe.png' alt='prev' /></a>" : '') . "</td>\n<td colspan='3'>\n" . ($type != 6 ? "<textarea name='content' rows='25' cols='94' class='areabig wysiwyg_editor" . (!_wysiwyg || !_loginwysiwyg ? ' codemirror' : '') . "'>" . _htmlStr($query['content']) . "</textarea>" : "<input type='text' name='content' value='" . _htmlStr($query['content']) . "' class='inputbig' />") . "\n</td>\n</tr>\n" : '') . "\n\n" . $editscript_extra_row . "\n\n<tr>\n<td class='rpad'><strong>" . $_lang['admin.content.form.settings'] . "</strong></td>\n<td colspan='3'>\n<label><input type='checkbox' name='visible' value='1'" . _checkboxActivate($query['visible']) . " /> " . $_lang['admin.content.form.visible'] . "</label>&nbsp;&nbsp;\n" . ($type != 6 ? "<label><input type='checkbox' name='autotitle' value='1'" . _checkboxActivate($query['autotitle']) . " /> " . $_lang['admin.content.form.autotitle'] . "</label>&nbsp;&nbsp;" : '') . "\n" . $custom_settings . "\n</td>\n</tr>\n\n<tr>\n<td class='rpad'><strong>" . $_lang['global.access'] . "</strong></td>\n<td>\n<label><input type='checkbox' name='public' value='1'" . _checkboxActivate($query['public']) . " /> " . $_lang['admin.content.form.public'] . "</label>&nbsp;&nbsp;\n<input type='text' name='level' value='" . $query['level'] . "' class='inputsmaller' maxlength='5' /> " . $_lang['admin.content.form.level'] . "\n</td>\n\n" . ($type != 4 ? "<td class='rpad'><strong>" . $_lang['admin.content.form.events'] . "</strong></td>\n<td><input type='text' name='events' value='" . (isset($query['events']) ? _htmlStr($query['events']) : '') . "' class='inputmedium' maxlength='255' /></td>" : '') . "\n</tr>\n\n" : '') . "\n\n\n<tr><td></td><td colspan='3'><br />\n<input type='submit' value='" . ($new ? $_lang['global.create'] : $_lang['global.savechanges']) . "' />" . (!$new ? "&nbsp;&nbsp;<small>" . $_lang['admin.content.form.thisid'] . " " . $query['id'] . "</small>" : '') . "\n</td></tr>\n\n</table>\n" . _xsrfProtect() . "</form>\n";
/**
 * Sestaveni kodu odkazu na uzivatele
 * @param int $id id uzivatele
 * @param string|null $class trida na odkazu nebo null
 * @param bool $plain nezobrazovat ikonu ani barvu 1/0
 * @param bool $onlyname zobrazit jen jmeno bez odkazu 1/0
 * @param int|null $namelengthlimit limit delky zobrazeneho jmena nebo null
 * @param string $namesuffix retezec vlozeny za jmeno
 * @param bool $ignore_publicname zcela ignorovat publicname (vzdy pouzit username) 1/0
 * @return string
 */
function _linkUser($id, $class = null, $plain = false, $onlyname = false, $namelengthlimit = null, $namesuffix = "", $ignore_publicname = false)
{
    // nacteni dat uzivatele a skupiny
    $data = _userDataCache($id);
    if ($onlyname == false) {
        // ikona
        if ($plain == false) {
            $icon = $data['icon'] != "" ? "<img src='" . _indexroot . "pictures/groupicons/" . $data['icon'] . "' alt='icon' class='icon' /> " : '';
        } else {
            $icon = "";
        }
        // vyber zobrazovaneho jmena
        if ($data['publicname'] != "" && !$ignore_publicname) {
            $publicname = $data['publicname'];
        } else {
            $publicname = $data['username'];
        }
        // trida
        $class = " class='user-link-" . $id . " user-link-group-" . $data['group'] . (isset($class) ? ' ' . $class : '') . "'";
        // kod odkazu
        if ($namelengthlimit != null) {
            $publicname = _cutStr($publicname, $namelengthlimit);
        }
        $link = "<a href='" . _indexroot . "index.php?m=profile&amp;id=" . $data['username'] . "'" . $class . (_administration ? " target='_blank'" : '') . ($data['color'] !== '' && !$plain ? " style='color:" . $data['color'] . ";'" : '') . ">" . $publicname . $namesuffix . "</a>";
    } else {
        $icon = "";
        if ($data['publicname'] != "" && !$ignore_publicname) {
            $link = $data['publicname'] . $namesuffix;
        } else {
            $link = $data['username'] . $namesuffix;
        }
    }
    return $icon . $link;
}
Beispiel #16
0
        $ext = mb_strtolower($iteminfo['extension']);
        $image = false;
        if (in_array($ext, array("rar", "zip", "tar", "gz", "tgz", "7z", "cab", "xar", "xla", "777", "alz", "arc", "arj", "bz", "bz2", "bza", "bzip2", "dz", "gza", "gzip", "lzma", "lzs", "lzo", "s7z", "taz", "tbz", "tz", "tzip"))) {
            $icon = "archive";
        } elseif (in_array($ext, array("jpg", "jpeg", "png", "gif", "bmp", "jp2", "tga", "pcx", "tif", "ppf", "pct", "pic", "ai", "ico"))) {
            $icon = "image";
            $image = true;
        } elseif (in_array($ext, array("sql", "php", "php3", "php4", "php5", "phtml", "py", "asp", "cgi", "shtml", "htaccess", "txt", "nfo", "rtf", "html", "htm", "xhtml", "css", "js", "ini", "bat", "inf", "me", "inc", "xml"))) {
            $icon = "editable";
        } elseif (in_array($ext, array("wav", "mp3", "mid", "rmi", "wma", "mpeg", "mpg", "wmv", "3gp", "mp4", "m4a", "xac", "aif", "au", "avi", "voc", "snd", "vox", "ogg", "flac", "mov", "aac", "vob", "amr", "asf", "rm", "ra", "ac3", "swf", "flv"))) {
            $icon = "media";
        } elseif (in_array($ext, array("exe", "com", "bat", "dll"))) {
            $icon = "executable";
        } elseif (in_array($ext, array("sld", "slp", "sle"))) {
            $icon = "sl";
        } else {
            $icon = "other";
        }
        $filesize = @filesize($dir . $item);
        if ($highlight) {
            $row_classes[] = 'hl';
        }
        if (isset($uploaded[$item])) {
            $row_classes[] = 'fman-uploaded';
        }
        $output .= "\n      <tr class='" . implode(' ', $row_classes) . "'>\n      <td><input type='checkbox' name='f" . $filecounter . "' id='f" . $filecounter . "' value='" . _admin_mparam($item, false) . "' /> <a href='" . _htmlStr($dir . $item) . "' target='_blank'" . ($image ? ' class="lightbox" data-fancybox-group="fman"' : '') . "><img src='images/icons/fman/" . $icon . ".png' alt='file' class='icon' />" . _htmlStr(_cutStr($item, 64, false)) . "</a></td>\n      <td>" . round($filesize / 1024) . "kB</td>\n      <td class='actions'>" . (_admin_issafefile($item) ? "<a href='" . $url . "&amp;a=delete&amp;name=" . _admin_mparam($item) . "'>" . $_lang['global.delete'] . "</a> | <a href='" . $url . "&amp;a=rename&amp;name=" . _admin_mparam($item) . "'>" . $_lang['admin.fman.rename'] . "</a>" . ($icon == "editable" ? " | <a href='" . $url . "&amp;a=edit&amp;name=" . _admin_mparam($item) . "'>" . $_lang['admin.fman.edit'] . "</a>" : '') : '') . "</td>\n      </tr>\n      ";
        $sizecounter += $filesize;
        $highlight = !$highlight;
    }
    $output .= "\n    </table>\n    " . _xsrfProtect() . "</form>\n\n    <p class='fman-menu'>\n    <span><strong>" . $_lang['admin.fman.filecounter'] . ":</strong> " . $filecounter . " <small>(" . round($sizecounter / 1024) . "kB)</small></span>\n    <a href='#' onclick='return _sysFmanSelect(" . $filecounter . ", 1)'>" . $_lang['admin.fman.selectall'] . "</a>\n    <a href='#' onclick='return _sysFmanSelect(" . $filecounter . ", 2)'>" . $_lang['admin.fman.deselectall'] . "</a>\n    <a href='#' onclick='return _sysFmanSelect(" . $filecounter . ", 3)'>" . $_lang['admin.fman.inverse'] . "</a>\n    <strong>" . $_lang['admin.fman.selected'] . ":</strong>&nbsp;&nbsp;\n    <a href='#' onclick='return _sysFmanMoveSelected()'>" . $_lang['admin.fman.selected.move'] . "</a>\n    <a href='#' onclick='return _sysFmanDeleteSelected()'>" . $_lang['admin.fman.selected.delete'] . "</a>\n    <a href='#top'><big>&uarr;</big></a>\n    </p>\n    ";
}