/** * Vytvoreni nahledu clanku pro vypis * @param array $art pole s daty clanku vcetne cat_title_seo * @param bool $info vypisovat radek s informacemi 1/0 * @param bool $perex vypisovat perex 1/0 * @param int|null pocet komentaru (null = nezobrazi se) * @return string */ function _articlePreview($art, $info = true, $perex = true, $comment_count = null) { // podpora nahrazeni static $overload; if (null === $overload) { _extend('call', 'article.preview', array('callback' => &$overload)); if (null === $overload) { $overload = false; } } if (false !== $overload) { return call_user_func($overload, $art, $info, $perex, $comment_count); } global $_lang; // titulek $link = _linkArticle($art['id'], $art['title_seo'], $art['cat_title_seo']); $output = "<h2 class='list-title'><a href='" . $link . "'>" . $art['title'] . "</a></h2>"; // perex a obrazek if ($perex == true) { $output .= "<p class='list-perex'>" . (isset($art['picture_uid']) ? "<a href='" . $link . "'><img class='list-perex-image' src='" . _pictureStorageGet(_indexroot . 'pictures/articles/', null, $art['picture_uid'], 'jpg') . "' alt='" . $art['title'] . "' /></a>" : '') . $art['perex'] . "</p>"; } // info if ($info == true) { // pocet komentaru if ($art['comments'] == 1 and _comments and $comment_count !== null) { $info_comments = _template_listinfoseparator . "<span>" . $_lang['article.comments'] . ":</span> " . $comment_count; } else { $info_comments = ""; } $output .= "\n <div class='list-info'>\n <span>" . $_lang['article.author'] . ":</span> " . _linkUser($art['author'], null, true) . _template_listinfoseparator . "<span>" . $_lang['article.posted'] . ":</span> " . _formatTime($art['time']) . _template_listinfoseparator . "<span>" . $_lang['article.readed'] . ":</span> " . $art['readed'] . "x" . $info_comments . "</div>"; } elseif ($perex && isset($art['picture_uid'])) { $output .= "<div class='cleaner'></div>\n"; } return $output . "\n"; }
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&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; }
} } else { $message = _formMessage(2, _eventList($error_log, 'errors')); } } /* --- vystup --- */ if ($continue) { // vyber autora if (_loginright_adminchangeartauthor) { $author_select = _admin_authorSelect("author", $query['author'], "adminart=1", "selectmedium"); } else { $author_select = ""; } // zprava if (isset($_GET['saved'])) { $message = _formMessage(1, $_lang['global.saved'] . " <small>(" . _formatTime(time()) . ")</small>"); } if (isset($_GET['created'])) { $message = _formMessage(1, $_lang['global.created']); } // wysiwyg editor $output .= _admin_wysiwyg(); // vypocet hodnoceni if (!$new) { if ($query['ratenum'] != 0) { $rate = DB::result(DB::query("SELECT ROUND(ratesum/ratenum) FROM `" . _mysql_prefix . "-articles` WHERE id=" . $query['id']), 0) . "%, " . $query['ratenum'] . "x"; } else { $rate = $_lang['article.rate.nodata']; } } else { $rate = "";
$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> \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> \n<input type='submit' value='" . $_lang['global.do'] . "' onclick='return _sysConfirm();' /> \n<a href='index.php?p=fman&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' /> <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' /> <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' /> <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" : ''); }
} // info $module .= _formMessage(1, $_lang['mod.messages.delete.done']); } } // strankovani $paging = _resultPaging(_indexOutput_url, _messagesperpage, 'pm', 'sender=' . _loginid . ' OR receiver=' . _loginid, '&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 . "&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 . "&a=list&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 if (_pagingmode == 2 or _pagingmode == 3) { $module .= '<br />' . $paging[0]; } break; } // zpetny odkaz, titulek $start = ''; if (!$list) { $start .= "<a href='" . _indexOutput_url . "' class='backlink'>< " . $_lang['global.return'] . "</a>\n";
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']); $homelink = _linkArticle($post['home'], $hometitle['title_seo']); $hometitle = $hometitle['title']; break; case 5: $homelink = 'index.php?m=topic&id=' . $post[$post['xhome'] == '-1' ? 'id' : 'xhome']; if ($post['xhome'] == '-1') { $hometitle = $post['subject']; } else { $hometitle = DB::query_row("SELECT subject FROM `" . _mysql_prefix . "-posts` WHERE id=" . $post['xhome']); $hometitle = $hometitle['subject']; } break; } $module .= "<div class='post-head'><a href='" . $homelink . "#post-" . $post['id'] . "' class='post-author'>" . $hometitle . "</a> <span class='post-info'>(" . _formatTime($post['time']) . ")</span></div><p class='post-body'>" . _parsePost($post['text']) . "</p>\n"; } if (_pagingmode == 2 or _pagingmode == 3) { $module .= '<br />' . $paging[0]; } } else { $module .= $_lang['global.nokit']; } }
} else { $message = _formMessage(2, $_lang['admin.fman.msg.exists']); } } break; // uprava // uprava case "edit": $name = _admin_cparam($_POST['name'], false); $content = $_POST['content']; if (_admin_issafefile($name)) { $file = @fopen($dir . $name, "w"); if ($file) { @fwrite($file, $content); fclose($file); $message = _formMessage(1, $_lang['admin.fman.msg.edit.done'] . " <small>(" . _formatTime(time()) . ")</small>"); } else { $message = _formMessage(2, $_lang['admin.fman.msg.edit.failure']); } } else { $message = _formMessage(2, $_lang['admin.fman.msg.disallowedextension']); } break; // presun // presun case "move": $newdir = _arrayRemoveValue(explode("/", $_POST['param']), ""); $newdir = implode("/", $newdir); if (mb_substr($newdir, -1, 1) != "/") { $newdir .= "/"; }
_iplogUpdate(5); } else { // prekroceno echo str_replace('*postsendexpire*', _postsendexpire, $_lang['misc.requestlimit']); die; } // odeslani if (_xsrfCheck()) { if (_validateEmail($sender) and $text != "" and _captchaCheck()) { // pridani informacniho textu do tela $info_ip = _userip; if (_loginindicator) { $info_ip .= ' (' . _loginname . ')'; } $info_from = array("*domain*", "*time*", "*ip*", "*sender*"); $info_to = array(_getDomain(), _formatTime(time()), $info_ip, $sender); $text .= "\n\n" . str_repeat("-", 16) . "\n" . str_replace($info_from, $info_to, $_lang['hcm.mailform.info']); // prilozeni souboru if (isset($_FILES['att']['tmp_name']) and is_uploaded_file($_FILES['att']['tmp_name'])) { $att = true; $att_name = $_FILES['att']['name']; $att_tmpname = $_FILES['att']['tmp_name']; $att_content = @file_get_contents($att_tmpname); $att_content = @chunk_split(@base64_encode($att_content)); } else { $att = false; } // sestaveni emailu // hlavicka, kodovani, odesilatel, boundary // odesilatel if (!_mailerusefrom) {
case 3: $artorder = "art.title"; break; case 4: $artorder = "art.title DESC"; break; } // titulek kategorie $output .= "<h2>" . $catdata['title'] . " <a href='index.php?p=content-articles-edit&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&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&id=" . $art['id'] . "&returnid=" . $cid . "&returnpage=" . $s . "'><img src='images/icons/edit.png' alt='edit' class='icon' />" . $_lang['global.edit'] . "</a> <a href='index.php?p=content-articles-delete&id=" . $art['id'] . "&returnid=" . $cid . "&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']); }
// 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&id=" . $id . "'>" . $_lang['global.show'] . " ></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'] . "&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&a=new&receiver=" . $query['username'] . "'>" . $_lang['mod.messages.new'] . " ></a></p>"; } }
/* --- 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'] . " <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 ? "&id=" . $id : '') . ($type == 9 && $new ? '&idt=' . $type_idt : '') . "' method='post'>\n\n\n" . $editscript_extra . "\n" . (!$new && $type == 5 ? "<p><a href='index.php?p=content-manageimgs&g=" . $id . "'><img src='images/icons/edit.png' alt='edit' class='icon' /><big>" . $_lang['admin.content.form.manageimgs'] . " ></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> \n" . ($type != 6 ? "<label><input type='checkbox' name='autotitle' value='1'" . _checkboxActivate($query['autotitle']) . " /> " . $_lang['admin.content.form.autotitle'] . "</label> " : '') . "\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> \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 ? " <small>" . $_lang['admin.content.form.thisid'] . " " . $query['id'] . "</small>" : '') . "\n</td></tr>\n\n</table>\n" . _xsrfProtect() . "</form>\n"; }
function _tmp_hcm_xlistReplaceTemplateMatch($match) { list(SL::$hcmUid, $rdirs, $item, $item_noext, $counter, $count, $end) = $GLOBALS['_hcm_xlist_data']; $params = _parseStr($match[1]); $return = ""; switch ($params[0]) { case "dir": $return = $rdirs; break; case "link": $return = _htmlStr($rdirs . $item); break; case "link64": $return = urlencode(base64_encode($rdirs . $item)); break; case "text64": if (isset($params[1])) { $return = urlencode(base64_encode(_tmp_hcm_xlistReplaceParamTags($params[1]))); } break; case "name": $return = $item_noext; break; case "filename": $return = $item; break; case "filesize": if (isset($params[1])) { $fname = $rdirs . _tmp_hcm_xlistReplaceParamTags($params[1]); } else { $fname = $rdirs . $item; } $return = round(@filesize($fname) / 1024); break; case "filetime": if (isset($params[1])) { $fname = $rdirs . _tmp_hcm_xlistReplaceParamTags($params[1]); } else { $fname = $rdirs . $item; } $return = _formatTime(@filemtime($fname)); break; case "uid": $return = SL::$hcmUid; break; case "preg": if (count($params) == 4) { $return = @preg_replace($params[1], $params[2], _tmp_hcm_xlistReplaceParamTags($params[3])); } break; case "data": if (isset($params[1])) { $fname = $rdirs . _tmp_hcm_xlistReplaceParamTags($params[1]) . ".txt"; if (@file_exists($fname)) { $return = @file_get_contents($fname); } } break; case "step": if (count($params) > 2 and $params[1] != 0) { $divide = ($counter + 1) / $params[1]; if ($counter != $end and intval($divide) == $divide) { $return = $params[2]; } elseif (isset($params[3]) and $counter != $end) { $return = $params[3]; } elseif ($counter == $end and isset($params[4])) { $return = $params[4]; } } break; } return $return; }
} else { $catlimit = -1; $condplus = ""; } $output .= "\n<p class='bborder'>" . $_lang['admin.content.confirm.p'] . "</p>\n\n<form class='cform' action='index.php' method='get'>\n<input type='hidden' name='p' value='content-confirm' />\n" . $_lang['admin.content.confirm.filter'] . ": " . _admin_rootSelect("limit", 2, $catlimit, true, $_lang['global.all']) . " <input type='submit' value='" . $_lang['global.do'] . "' />\n</form>\n<div class='hr'><hr /></div>\n\n" . $message . "\n\n<table class='list'>\n<thead><tr><td>" . $_lang['global.article'] . "</td><td>" . $_lang['article.category'] . "</td><td>" . $_lang['article.posted'] . "</td><td>" . $_lang['article.author'] . "</td><td>" . $_lang['global.action'] . "</td></tr></thead>\n<tbody>"; // vypis $query = DB::query("SELECT art.id,art.title,art.title_seo,art.home1,art.home2,art.home3,art.author,art.time,art.visible,art.confirmed,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 art.confirmed=0" . $condplus . " ORDER BY art.time DESC"); if (DB::size($query) != 0) { while ($item = DB::row($query)) { // seznam kategorii $cats = ""; for ($i = 1; $i <= 3; $i++) { if ($item['home' . $i] != -1) { $hometitle = DB::query_row("SELECT title FROM `" . _mysql_prefix . "-root` WHERE id=" . $item['home' . $i]); $cats .= $hometitle['title']; } if ($i != 3 and $item['home' . ($i + 1)] != -1) { $cats .= ", "; } } if (DB::result(DB::query("SELECT COUNT(id) FROM `" . _mysql_prefix . "-articles` WHERE id=" . $item['id'] . _admin_artAccess()), 0) != 0) { $editlink = " / <a href='index.php?p=content-articles-edit&id=" . $item['id'] . "&returnid=load&returnpage=1' class='small'>" . $_lang['global.edit'] . "</a>"; } else { $editlink = ""; } $output .= "<tr><td>" . _admin_articleEditLink($item, false) . "</td><td>" . $cats . "</td><td>" . _formatTime($item['time']) . "</td><td>" . _linkUser($item['author']) . "</td><td><a href='index.php?p=content-confirm&id=" . $item['id'] . "&limit=" . $catlimit . "' class='small'>" . $_lang['admin.content.confirm.confirm'] . "</a>" . $editlink . "</td></tr>\n"; } } else { $output .= "<tr><td colspan='5'>" . $_lang['global.nokit'] . "</td></tr>"; } $output .= "</tbody></table>";
$avatar = ''; } else { $author_name = _userDataCache($query['author']); if ('' !== $author_name['publicname']) { $author_name = $author_name['publicname']; } else { $author_name = $author_name['username']; } $avatar = "<img src='" . $avatar . "' alt='" . $author_name . "' class='topic-avatar' />"; } } } else { $author = "<span class='post-author-guest' title='" . _showIP($query['ip']) . "'>" . $query['guest'] . "</span>"; } // vystup $module .= "\n<h2>" . $_lang['posts.topic'] . ": " . $query['subject'] . _linkRSS($id, 6) . "</h2>\n<p><small>" . $_lang['global.postauthor'] . " " . $author . " " . _formatTime($query['time']) . "</small>" . $editlink . "</p>\n<p>" . $avatar . _parsePost($query['text']) . "</p>\n<div class='cleaner'></div>\n"; // odpovedi require_once _indexroot . 'require/functions-posts.php'; $module .= _postsOutput(6, $homedata['id'], array(_commentsperpage, _publicAccess($homedata['var3']), $homedata['var2'], $id), $query['locked'] == 1); } else { $form = _uniForm("notpublic"); $module .= $form[0]; } } else { define('_indexOutput_url', "index.php?m=topic"); if (_template_autoheadings) { $module .= "<h1>" . $_lang['global.error404.title'] . "</h1>\n"; } $module .= _formMessage(2, $_lang['posts.topic.notfound']); $found = false; }
_extend('call', 'article.perex.before', $extend_args); // rozsireni pred perexem $content .= "<p class='article-perex'>" . (isset($query['picture_uid']) ? "<img class='article-perex-image' src='" . _pictureStorageGet(_indexroot . 'pictures/articles/', null, $query['picture_uid'], 'jpg') . "' alt='" . $query['title'] . "' />" : '') . $query['perex'] . "</p>\n"; // if (isset($query['picture_uid'])) $content .= "<div class='cleaner'></div>\n"; _extend('call', 'article.perex.after', $extend_args); // rozsireni za perexem /* -- obsah -- */ $content .= "<div class='article-content'>\n" . _parseHCM($query['content']) . "\n</div>\n"; /* -- informacni tabulka -- */ // zalomeni $content .= "<div class='cleaner'></div>\n"; // priprava $info = array("basicinfo" => null, "idlink" => null, "rateresults" => null, "rateform" => null, "infobox" => null); // zakladni informace if ($query['showinfo'] == 1 && (!isset($cat_showinfo) || $cat_showinfo === true)) { $info['basicinfo'] = "\n <strong>" . $_lang['article.author'] . ":</strong> " . _linkUser($query['author']) . "<br />\n <strong>" . $_lang['article.posted'] . ":</strong> " . _formatTime($query['time']) . "<br />\n <strong>" . $_lang['article.readed'] . ":</strong> " . $query['readed'] . "x\n "; } // ID clanku if (_loginright_adminart) { $info['idlink'] = ($info['basicinfo'] != null ? "<br />" : '') . "<strong>" . $_lang['global.id'] . ":</strong> <a href='admin/index.php?p=content-articles-edit&id=" . $id . "&returnid=load&returnpage=1'>" . $id . " <img src='" . _templateImage("icons/edit.png") . "' alt='edit' class='icon' /></a>"; } // vysledky hodnoceni if ($query['rateon'] == 1 and _ratemode != 0) { if ($query['ratenum'] != 0) { /*procenta*/ if (_ratemode == 1) { $rate = round($query['ratesum'] / $query['ratenum']) . "%"; } else { $rate = round(-0.04 * ($query['ratesum'] / $query['ratenum']) + 5); } $rate .= " (" . $_lang['article.rate.num'] . " " . $query['ratenum'] . "x)";
} } else { $group = _defaultgroup; } if (SL::$settings['rules'] != "" and !_checkboxLoad("agreement")) { $errors[] = $_lang['mod.reg.rules.disagreed']; } // vlozeni do databaze nebo seznam chyb if (count($errors) == 0) { _iplogUpdate(5); $code = _tmpRegister(_registration_confirm, $group, $username, $password, $massemail, _userip, $email); if (isset($code)) { // poslat potvrzeni $phase = 2; $domain = _getDomain(); $mail = _mail($email, str_replace('*domain*', $domain, $_lang['mod.reg.confirm.subject']), str_replace(array('*username*', '*domain*', '*url*', '*ip*', '*date*', '*code*'), array($username, $domain, _url, _userip, _formatTime(time()), $code), $_lang['mod.reg.confirm.text']), "Content-Type: text/plain; charset=UTF-8\n" . _sysMailHeader()); } else { // registrace ok $phase = 1; } } else { $message = _formMessage(2, _eventList($errors, 'errors')); } } /* --- modul --- */ if (_template_autoheadings == 1) { $module .= "<h1>" . $_lang['mod.reg'] . "</h1>"; } switch ($phase) { // registracni formular case 0:
$page = _resultPagingGetItemPage(_commentsperpage, "posts", "id<" . $r['id'] . " AND type=5 AND xhome=" . $r['xhome'] . " AND home=" . $r['home']); $title = $r['topic_subject']; } else { $link = 'index.php?m=topic&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) {
echo _indexroot; ?> plugins/templates/<?php echo _template; ?> /style/system.css" type="text/css" rel="stylesheet" /> <title><?php echo $query['title'] . " " . _titleseparator . " " . _title; ?> </title> </head> <body onload="setTimeout('this.print();', 500);"> <p id="informations"><?php echo "<strong>" . $_lang['global.source'] . ":</strong> <a href='" . $url . "'>" . $url . "</a>" . _template_listinfoseparator . "<strong>" . $_lang['article.posted'] . ":</strong> " . _formatTime($query['time']) . _template_listinfoseparator . "<strong>" . $_lang['article.author'] . ":</strong> " . _linkUser($query['author'], null, true, true); ?> </p> <h1><?php echo $query['title']; ?> </h1> <p><?php echo (isset($query['picture_uid']) ? "<img class='list-perex-image' src='" . _pictureStorageGet(_indexroot . 'pictures/articles/', null, $query['picture_uid'], 'jpg') . "' alt='" . $query['title'] . "' />" : '') . $query['perex']; ?> </p> <?php echo _parseHCM($query['content']); ?>
SL::$classLoader->registerBaseNamespace('Devkit', __DIR__ . DIRECTORY_SEPARATOR . 'class', true); // vytvorit sql logger $sqlLogger = new DevkitDebuggerSqlLogger(); // napojit sql logger DB::$logger = array($sqlLogger, 'log'); // vytvorit event dispatcher $eventDispatcher = new Devkit\Component\Event\EventDispatcher(); // vytvorit error handler $errorHandler = new Devkit\Component\ErrorHandler\ErrorHandler(); $errorHandler->setRoot(realpath(_indexroot))->setEventDispatcher($eventDispatcher)->setDebug(true)->register(); SL::$registry['devkit_error_handler'] = $errorHandler; // zaregistrovat sql logger $eventDispatcher->addCallback('error_handler.web.debug.extras', array($sqlLogger, 'showInDebugScreen')); /* ----- extend ----- */ _extend('regm', array('sys.mail' => function ($args) { $time = _formatTime(time()); $args['handled'] = true; file_put_contents(_indexroot . 'mail.log', <<<ENTRY Time: {$time} Recipient: {$args['to']} Subject: {$args['subject']} {$args['headers']} {$args['message']} ===================================== =====================================
/** * 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&page=" . $paging[2]) . "#posts'><strong>" . $addlink . " ></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&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&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&id=" . $item['id'] . "&page=" . $i . "#posts'>" . $i . '</a>'; } if ($tpages_num > 3) { $tpages .= "<a href='index.php?m=topic&id=" . $item['id'] . "&page=" . $tpages_num . "'>" . $tpages_num . ' →</a>'; } $tpages .= '</span>'; } // vystup radku $output .= "<tr class='topic-" . $icon . ($hl ? ' topic-hl' : '') . "'><td class='topic-icon-cell'><a href='index.php?m=topic&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&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&id=" . $item['topic_id'] . "'>" . $item['topic_subject'] . "</a> <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; }
// kontrola promennych, odeslani emailu $sent = false; if (isset($_POST['username'])) { if (_iplogCheck(7)) { // nacteni promennych $username = _anchorStr($_POST['username'], false); $email = DB::esc($_POST['email']); // kontrola promennych if (_captchaCheck()) { $userdata = DB::query("SELECT email,password,salt,username FROM `" . _mysql_prefix . "-users` WHERE username='******' AND email='" . $email . "'"); if (DB::size($userdata) != 0) { // odeslani emailu $userdata = DB::row($userdata); $link = _url . "/index.php?m=lostpass&link&user="******"&hash=" . md5($userdata['email'] . $userdata['salt'] . $userdata['password']); $text_tags = array("*domain*", "*username*", "*link*", "*date*", "*ip*"); $text_contents = array(_getDomain(), $userdata['username'], $link, _formatTime(time()), _userip); if (_mail($userdata['email'], str_replace('*domain*', _getDomain(), $_lang['mod.lostpass.mail.subject']), str_replace($text_tags, $text_contents, $_lang['mod.lostpass.mail.text']), "Content-Type: text/plain; charset=UTF-8\n" . _sysMailHeader())) { $module .= _formMessage(1, $_lang['mod.lostpass.cmailsent']); _iplogUpdate(7); $sent = true; } else { $module .= _formMessage(3, $_lang['hcm.mailform.msg.failure2']); } } else { $module .= _formMessage(2, $_lang['mod.lostpass.notfound']); } } else { $module .= _formMessage(2, $_lang['captcha.failure2']); } } else { $module .= _formMessage(3, str_replace('*limit*', _lostpassexpire / 60, $_lang['mod.lostpass.limit']));
function _HCM_sbox($id = null) { // priprava $result = ""; $id = intval($id); // nacteni dat shoutboxu $sboxdata = DB::query("SELECT * FROM `" . _mysql_prefix . "-sboxes` WHERE id=" . $id); if (DB::size($sboxdata) != 0) { $sboxdata = DB::row($sboxdata); $rcontinue = true; } else { $rcontinue = false; } // sestaveni kodu if ($rcontinue) { $result = "\n <div class='anchor'><a name='hcm_sbox_" . SL::$hcmUid . "'></a></div>\n <div class='sbox'>\n <div class='sbox-content'>\n " . ($sboxdata['title'] != "" ? "<div class='sbox-title'>" . $sboxdata['title'] . "</div>" : '') . "<div class='sbox-item'" . ($sboxdata['title'] == "" ? " style='border-top:none;'" : '') . ">"; // formular na pridani if ($sboxdata['locked'] != 1 and _publicAccess($sboxdata['public'])) { // priprava bunek // $captcha = _captchaInit(); if (!_loginindicator) { $inputs[] = array($GLOBALS['_lang']['posts.guestname'], "<input type='text' name='guest' class='sbox-input' maxlength='22' />"); } $inputs[] = array($GLOBALS['_lang']['posts.text'], "<input type='text' name='text' class='sbox-input' maxlength='255' /><input type='hidden' name='_posttype' value='4' /><input type='hidden' name='_posttarget' value='" . $id . "' />"); if (!_loginindicator) { $inputs[1][2] = true; // $inputs[] = $captcha; } $result .= _formOutput("hcm_sboxform_" . SL::$hcmUid, _indexroot . "remote/post.php?_return=" . urlencode(_indexOutput_url . "#hcm_sbox_" . SL::$hcmUid), $inputs, null, null); } else { if ($sboxdata['locked'] != 1) { $result .= $GLOBALS['_lang']['posts.loginrequired']; } else { $result .= "<img src='" . _templateImage("icons/lock.png") . "' alt='locked' class='icon' /> " . $GLOBALS['_lang']['posts.locked2']; } } $result .= "\n</div>\n<div class='sbox-posts'>"; // vypis prispevku $sposts = DB::query("SELECT id,text,author,guest,time,ip FROM `" . _mysql_prefix . "-posts` WHERE home=" . $id . " AND type=4 ORDER BY id DESC"); if (DB::size($sposts) != 0) { while ($spost = DB::row($sposts)) { // nacteni autora if ($spost['author'] != -1) { $author = _linkUser($spost['author'], "post-author' title='" . _formatTime($spost['time']), false, false, 16, ":"); } else { $author = "<span class='post-author-guest' title='" . _formatTime($spost['time']) . ", ip=" . _showIP($spost['ip']) . "'>" . $spost['guest'] . ":</span>"; } // odkaz na spravu if (_postAccess($spost)) { $alink = " <a href='index.php?m=editpost&id=" . $spost['id'] . "'><img src='" . _templateImage("icons/edit.png") . "' alt='edit' class='icon' /></a>"; } else { $alink = ""; } // kod polozky $result .= "<div class='sbox-item'>" . $author . $alink . " " . _parsePost($spost['text'], true, false, false) . "</div>\n"; } } else { $result .= "\n<div class='sbox-item'>" . $GLOBALS['_lang']['posts.noposts'] . "</div>\n"; } $result .= "\n </div>\n </div>\n </div>\n "; } return $result; }