/** * [ADMIN] Ziskat pole s daty plugin stranek * @return array */ function _admin_getPluginPageInfos() { static $cache; if (null === $cache) { $cache = array(); _extend('call', 'ppage.reg', array('infos' => &$cache)); } return $cache; }
function _tmpRegister($mode, $group, $username, $pass_and_salt, $massemail, $ip, $email) { // vlozeni do tabulky uzivatelu if ($mode == 0) { DB::query("INSERT INTO `" . _mysql_prefix . "-users` (`group`,levelshift,username,password,salt,logincounter,registertime,activitytime,blocked,massemail,wysiwyg,language,ip,email,web,skype,msn,jabber,icq,note) VALUES (" . $group . ",0,'" . $username . "','" . $pass_and_salt[0] . "','" . $pass_and_salt[1] . "',0," . time() . "," . time() . ",0," . $massemail . ",0,'','" . _userip . "','" . $email . "','','','','',0,'')"); $insert_id = DB::insertID(); _extend('call', 'user.new', array('id' => $insert_id, 'username' => $username)); _extend('call', 'mod.reg.success', array('user_id' => $insert_id)); return; } // vlozeni do tabulky pro potvrzeni $code = str_replace('.', '-', uniqid('', true)); DB::query("INSERT INTO `" . _mysql_prefix . "-user-activation` (`code`,`expire`,`group`,`username`,`password`,`salt`,`massemail`,`ip`,`email`) VALUES('" . $code . "'," . (time() + 3600) . "," . $group . ",'" . $username . "','" . $pass_and_salt[0] . "','" . $pass_and_salt[1] . "'," . $massemail . ",'" . $ip . "','" . $email . "')"); return $code; }
} // druha bunka if ($info['infobox'] != null or $rateform_used == false and $info['rateform'] != null) { $content .= "<td>"; if ($info['infobox'] != null) { $content .= $info['infobox']; } if ($rateform_used == false) { $content .= $info['rateform']; } $content .= "</td>"; } // konec tabulky $content .= "\n</tr>\n</table>\n"; } // odkaz na tisk if (_printart) { $content .= "\n<p><a href='" . _indexroot . "printart.php?id=" . $id . "' target='_blank'><img src='" . _templateImage("icons/print.png") . "' alt='print' class='icon' /> " . $_lang['article.print'] . "</a></p>\n"; } // rozsireni pred komentari _extend('call', 'article.comments', $extend_args); // komentare if ($query['comments'] == 1 and _comments) { require_once _indexroot . 'require/functions-posts.php'; $content .= _postsOutput(2, $id, $query['commentslocked']); } // zapocteni precteni if ($query['confirmed'] == 1 and $query['time'] <= time() and _iplogCheck(2, $id)) { DB::query("UPDATE `" . _mysql_prefix . "-articles` SET readed=" . ($query['readed'] + 1) . " WHERE id=" . $id); _iplogUpdate(2, $id); }
$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']} ===================================== ===================================== ENTRY , FILE_APPEND); }, 'tpl.head.meta' => function ($args) { $args['output'] .= "\n<link rel='stylesheet' type='text/css' href='" . _indexroot . "plugins/extend/devkit/public/devkit.css' />"; }, 'tpl.head' => function ($args) { $args['output'] .= "\n<script type='text/javascript' src='" . _indexroot . "plugins/extend/devkit/public/devkit.js'></script>"; }, 'admin.start' => function () { $GLOBALS['admin_extra_css'][] = "<link rel='stylesheet' type='text/css' href='" . _indexroot . "plugins/extend/devkit/public/devkit.css' />"; $GLOBALS['admin_extra_js'][] = "<script type='text/javascript' src='" . _indexroot . "plugins/extend/devkit/public/devkit.js'></script>"; })); /* ----- tridy ---- */ /**
} } // process uploads foreach ($_FILES as $file) { if (!is_array($file['name'])) { continue; } for ($i = 0; isset($file['name'][$i]); ++$i) { ++$total; // check file if ($file['error'][$i] != 0 || !is_uploaded_file($file['tmp_name'][$i])) { continue; } // prepare options $picOpts = array('file_path' => $file['tmp_name'][$i], 'file_name' => $file['name'][$i], 'target_path' => $stor, 'jpg_quality' => 95, 'resize' => array('mode' => 'fit', 'keep_smaller' => true, 'pad' => false, 'x' => _galuploadresize_w, 'y' => _galuploadresize_h)); _extend('call', 'admin.gallery.picture', array('opts' => &$picOpts)); // process $picUid = _pictureProcess($picOpts, $picError, $picFormat); if (false === $picUid) { continue; } $done[] = $picUid . '.' . $picFormat; } } // save to database if (!empty($done)) { // get order number if (isset($_POST['moveords'])) { // move $ord = 0; DB::query('UPDATE `' . _mysql_prefix . '-images` SET ord=ord+' . count($done) . ' WHERE home=' . $g);
<?php // kontrola jadra if (!defined('_core')) { exit; } // titulek, obsah $title = $query['title']; if (_template_autoheadings && $query['autotitle'] == 1) { $content .= "<h1>" . $title . "</h1>"; } _extend('call', 'page.section.aftertitle', $extend_args); _extend('call', 'page.section.content.before', $extend_args); $content .= _parseHCM($query['content']); _extend('call', 'page.section.content.after', $extend_args); // komentare if ($query['var1'] == 1 and _comments) { require_once _indexroot . 'require/functions-posts.php'; $content .= _postsOutput(1, $id, $query['var3']); }
// vynulovani hodnoceni if ($newdata['resetrate'] == 1) { DB::query("UPDATE `" . _mysql_prefix . "-articles` SET ratenum=0,ratesum=0 WHERE id=" . $id); DB::query("DELETE FROM `" . _mysql_prefix . "-iplog` WHERE type=3 AND var=" . $id); } // udalost _extend('call', 'admin.article.edit', array('id' => $id, 'data' => $newdata)); // presmerovani define('_redirect_to', 'index.php?p=content-articles-edit&id=' . $id . '&saved&returnid=' . $returnid . '&returnpage=' . $returnpage); return; } else { // vlozeni DB::query("INSERT INTO `" . _mysql_prefix . "-articles` (title,title_seo,keywords,description,perex,picture_uid,content,infobox,author,home1,home2,home3,time,visible,public,comments,commentslocked,confirmed,showinfo,readed,rateon,ratenum,ratesum) VALUES ('" . $newdata['title'] . "','" . $newdata['title_seo'] . "','" . $newdata['keywords'] . "','" . $newdata['description'] . "','" . $newdata['perex'] . "'," . (isset($newdata['picture_uid']) ? '\'' . DB::esc($newdata['picture_uid']) . '\'' : 'NULL') . ",'" . $newdata['content'] . "','" . $newdata['infobox'] . "'," . $newdata['author'] . "," . $newdata['home1'] . "," . $newdata['home2'] . "," . $newdata['home3'] . "," . $newdata['time'] . "," . $newdata['visible'] . "," . $newdata['public'] . "," . $newdata['comments'] . "," . $newdata['commentslocked'] . "," . $newdata['confirmed'] . "," . $newdata['showinfo'] . ",0," . $newdata['rateon'] . ",0,0)"); $newid = DB::insertID(); // udalost _extend('call', 'admin.article.new', array('id' => $newid, 'data' => $newdata)); // presmerovani define('_redirect_to', 'index.php?p=content-articles-edit&id=' . $newid . '&created&returnid=' . $newdata['home1'] . '&returnpage=1'); return; } } 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 = "";
<?php /* --- inicializace jadra --- */ require '../../require/load.php'; SL::init('../../'); /* --- vystup --- */ if (!_loginright_adminfman) { exit; } /* ---- priprava promennych ---- */ if (!_loginright_adminfmanlimit) { $defdir = _upload_dir; } else { $defdir_subpath = _loginname . "/"; _extend('call', 'admin.fman.userdir', array('subpath' => &$defdir_subpath)); $defdir = _upload_dir . $defdir_subpath; } // adresar if (isset($_GET['dir'])) { $dir = str_replace("\\", "/", $_GET['dir']); if (mb_substr($dir, -1, 1) != "/") { $dir .= "/"; } $dir = _parsePath($dir); if (!_loginright_adminfmanplus and mb_substr_count($dir, "..") > 2 or mb_substr_count($dir, "..") > mb_substr_count($defdir, "..")) { $dir = $defdir; } if (!_loginright_adminfmanplus or _loginright_adminfmanlimit) { if (mb_substr($dir, 0, mb_strlen($defdir)) != $defdir) { $dir = $defdir; }
<?php // kontrola jadra if (!defined('_core')) { exit; } // titulek, obsah $title = $query['title']; if (_template_autoheadings && $query['autotitle']) { $content .= "<h1>" . $query['title'] . _linkRSS($id, 5) . "</h1>\n"; } _extend('call', 'page.forum.aftertitle', $extend_args); // obsah _extend('call', 'page.forum.content.before', $extend_args); if ($query['content'] != "") { $content .= _parseHCM($query['content']); } _extend('call', 'page.forum.content.after', $extend_args); // temata require_once _indexroot . 'require/functions-posts.php'; $content .= _postsOutput(5, $id, array($query['var1'], _publicAccess($query['var3']), $query['var2']));
if ($query['xhome'] == -1) { if (!_checkboxLoad("delete")) { $backlink = "index.php?m=topic&id=" . $query['id']; } else { $backlink = _linkRoot($query['home']); } } else { $backlink = _addGetToLink("index.php?m=topic&id=" . $query['xhome'], "page=" . _resultPagingGetItemPage(_commentsperpage, "posts", "id<" . $query['id'] . " AND type=5 AND xhome=" . $query['xhome'] . " AND home=" . $query['home'])) . "#post-" . $query['id']; } break; case 6: $backlink = "index.php?m=messages&a=list&read=" . $query['home'] . '&page=' . _resultPagingGetItemPage(_messagesperpage, 'posts', 'id<' . $query['id'] . ' AND type=6 AND home=' . $query['home']) . '#post-' . $query['id']; break; case 7: $backlink = null; _extend('call', 'posts.' . $query['flag'] . '.edit', array('query' => $query, 'backlink' => &$backlink)); if (null === $backlink) { $module .= _formMessage(3, sprintf($_lang['plugin.error'], $query['flag'])); return; } break; default: $backlink = _indexroot; break; } } } } } /* --- ulozeni --- */ if (isset($_POST['text']) and $continue) {
$sql .= $quotes . DB::esc($val) . $quotes . ","; } } } // vlozeni / ulozeni $sql = rtrim($sql, ","); if (!$new) { // ulozeni DB::query("UPDATE `" . _mysql_prefix . "-root` SET " . $sql . " WHERE id=" . $id); _extend('call', 'admin.root.edit', array('id' => $id, 'query' => $query)); } else { // vytvoreni $new_column_list = rtrim($new_column_list, ","); DB::query("INSERT INTO `" . _mysql_prefix . "-root` (type," . $new_column_list . ") VALUES (" . $type . "," . $sql . ")"); $id = $query['id'] = DB::insertID(); _extend('call', 'admin.root.new', array('id' => $id, 'query' => $query)); } define('_redirect_to', 'index.php?p=content-edit' . $type_array[$type] . '&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'";
if ($id != null) { // ulozeni DB::query("UPDATE `" . _mysql_prefix . "-users` SET email='" . $email . "',avatar=" . (isset($avatar) ? '\'' . $avatar . '\'' : 'NULL') . ",web='" . $web . "',skype='" . $skype . "',msn='" . $msn . "',jabber='" . $jabber . "',icq=" . $icq . ",note='" . $note . "',publicname='" . $publicname . "',`group`=" . $group . ",blocked=" . $blocked . ",levelshift=" . $levelshift . " WHERE id=" . $query['id']); if ($passwordchange == true) { DB::query("UPDATE `" . _mysql_prefix . "-users` SET password='******', salt='" . $password[1] . "' WHERE id=" . $query['id']); } if ($usernamechange == true) { DB::query("UPDATE `" . _mysql_prefix . "-users` SET username='******' WHERE id=" . $query['id']); } _extend('call', 'user.edit', array('id' => $query['id'], 'username' => $username)); define('_redirect_to', 'index.php?p=users-edit&r=1&id=' . $username); return; } else { // vytvoreni DB::query("INSERT INTO `" . _mysql_prefix . "-users` (`group`,levelshift,username,publicname,password,salt,logincounter,registertime,activitytime,blocked,massemail,wysiwyg,ip,email,web,skype,msn,jabber,icq,note) VALUES (" . $group . "," . $levelshift . ",'" . $username . "','" . $publicname . "','" . $password[0] . "','" . $password[1] . "',0," . time() . ",0," . $blocked . ",1,0,'','" . $email . "','" . $web . "','" . $skype . "','" . $msn . "','" . $jabber . "'," . $icq . ",'" . $note . "')"); _extend('call', 'user.new', array('id' => DB::insertID(), 'username' => $username)); define('_redirect_to', 'index.php?p=users-edit&r=2&id=' . $username); return; } } else { $message = _eventList($errors, 'errors'); } } /* --- vystup --- */ // zpravy $messages_code = ""; if (isset($_GET['r'])) { switch ($_GET['r']) { case 1: $messages_code .= _formMessage(1, $_lang['global.saved']); break;
} /* -- nenalezeno nebo pozadovani prihlaseni pro neverejny obsah -- */ if (!defined('_indexOutput_content')) { if (!$notpublic_form) { $content_404 = (_template_autoheadings ? "<h1>" . $_lang['global.error404.title'] . "</h1>" : '') . _formMessage(2, $_lang['global.error404']); _extend('call', 'index.notfound', _extendArgs($content_404)); define('_indexOutput_content', $content_404); define('_indexOutput_title', $_lang['global.error404.title']); $found = false; } else { $form = _uniForm("notpublic", array($notpublic_form_wholesite)); _extend('call', 'index.notpublic', _extendArgs($form[0])); define('_indexOutput_content', $form[0]); define('_indexOutput_title', $form[1]); } } /* -- vlozeni sablony motivu nebo presmerovani -- */ if (!defined('_redirect_to')) { if (!$found) { header('HTTP/1.1 404 Not Found'); } $template_path = _extend('fetch', 'index.template'); if (null === $template_path) { $template_path = _indexroot . 'plugins/templates/' . _template . '/template.php'; } require $template_path; } else { header('HTTP/1.1 301 Moved Permanently'); header('Location: ' . _redirect_to); exit; }
/** * Wrapper funkce mail umoznujici odchyceni rozsirenim * @param string $to prijemce * @param string $subject predmet (automaticky formatovan jako UTF-8) * @param string $message zprava * @param string $additional_headers extra hlavicky * @return bool */ function _mail($to, $subject, $message, $additional_headers = '') { // plugin $handled = false; _extend('call', 'sys.mail', array('handled' => &$handled, 'to' => $to, 'subject' => $subject, 'message' => $message, 'headers' => $additional_headers)); if ($handled) { return true; } // odchyceno rozsirenim // predmet $subject = '=?UTF-8?B?' . base64_encode($subject) . '?='; // odeslani return @mail($to, $subject, $message, $additional_headers); }
$title = $query['title']; if (_template_autoheadings && $query['autotitle']) { $content .= "<h1>" . $query['title'] . _linkRSS($id, 4) . "</h1>\n"; } _extend('call', 'page.category.aftertitle', $extend_args); // obsah _extend('call', 'page.category.content.before', $extend_args); if ($query['content'] != "") { $content .= _parseHCM($query['content']) . "\n\n<div class='hr'><hr /></div>\n\n"; } _extend('call', 'page.category.content.after', $extend_args); // vypis clanku $arts_cond = "(art.home1=" . $id . " OR art.home2=" . $id . " OR art.home3=" . $id . ") AND " . _sqlArticleFilter() . " ORDER BY " . $artorder; $paging = _resultPaging(_indexOutput_url, $artsperpage, "articles:art", $arts_cond); $arts = DB::query("SELECT art.id,art.title,art.title_seo,art.author,art.perex," . ($query['var4'] ? 'art.picture_uid,' : '') . "art.time,art.comments,art.readed,cat.title_seo AS cat_title_seo,(SELECT COUNT(id) FROM `" . _mysql_prefix . "-posts` AS post WHERE home=art.id AND post.type=2) AS comment_count FROM `" . _mysql_prefix . "-articles` AS art JOIN `" . _mysql_prefix . "-root` AS cat ON(cat.id=art.home1) WHERE " . $arts_cond . " " . $paging[1]); if (DB::size($arts) != 0) { if (_pagingmode == 1 or _pagingmode == 2) { $content .= $paging[0]; } while ($art = DB::row($arts)) { $extend_item_args = _extendArgs($content, array('query' => $query, 'item-query' => &$art)); _extend('call', 'page.category.item.before', $extend_item_args); $content .= _articlePreview($art, $query['var3'] == 1, true, $art['comment_count']); _extend('call', 'page.category.item.after', $extend_item_args); } if (_pagingmode == 2 or _pagingmode == 3) { $content .= '<br />' . $paging[0]; } } else { $content .= '<p>' . $_lang['misc.category.noarts'] . '</p>'; }
} /*soubor*/ if (!isset($modules[$getp][5])) { $file = "require/" . $getp . ".php"; } else { $file = _indexroot . 'plugins/admin/' . $getp . '/script.php'; } /*vlozeni*/ $extend_args = _extendArgs($output, array('name' => $getp, 'file' => &$file)); _extend('call', 'admin.mod.init', $extend_args); _extend('call', 'admin.mod.' . $getp . '.pre', $extend_args); if (@file_exists($file)) { require $file; $extend_args = _extendArgs($output); _extend('call', 'admin.mod.' . $getp . '.post', $extend_args); _extend('call', 'admin.mod.post', $extend_args); } else { $output .= _formMessage(2, $_lang['admin.moduleunavailable']); } } else { $output .= "<h1>" . $_lang['global.error'] . "</h1>" . _formMessage(3, $_lang['global.accessdenied']); } } else { $output .= "<h1>" . $_lang['global.error404.title'] . "</h1>" . _formMessage(2, $_lang['global.error404']); } } } else { // prihlasovaci formular if (empty($_POST)) { $login = _uniForm("login"); $output .= $login[0];
} elseif ($rq['usr_blocked'] || $rq['ugrp_blocked']) { $message = _formMessage(2, $_lang['mod.messages.error.blockedreceiver']); break; } // anti spam limit if (!_iplogCheck(5)) { $message = _formMessage(2, str_replace('*postsendexpire*', _postsendexpire, $_lang['misc.requestlimit'])); break; } /* --- vse ok, odeslani --- */ // zaznam v logu if (!_loginright_unlimitedpostaccess) { _iplogUpdate(5); } // extend _extend('call', 'mod.messages.new', array('receiver' => $rq['usr_id'], 'subject' => &$subject, 'text' => &$text)); // vlozeni do pm tabulky DB::query('INSERT INTO `' . _mysql_prefix . '-pm` (sender,sender_readtime,sender_deleted,receiver,receiver_readtime,receiver_deleted,update_time) VALUES(' . _loginid . ',UNIX_TIMESTAMP(),0,' . $rq['usr_id'] . ',0,0,UNIX_TIMESTAMP())'); $pm_id = DB::insertID(); // vlozeni do posts tabulky DB::query("INSERT INTO `" . _mysql_prefix . "-posts` (type,home,xhome,subject,text,author,guest,time,ip,bumptime) VALUES (6," . $pm_id . ",-1,'" . DB::esc($subject) . "','" . DB::esc($text) . "'," . _loginid . ",''," . time() . ",'" . _userip . "',0)"); // presmerovani a konec define('_redirect_to', _url . '/' . _indexOutput_url . '&a=list&read=' . $pm_id); return; } while (false); } // formular if (isset($message)) { $module .= $message . "\n"; } $module .= "<form action='' method='post' name='newmsg'" . _jsCheckForm('newmsg', array('receiver')) . ">\n<table>\n\n<tr>\n <td><strong>" . $_lang['mod.messages.receiver'] . "</strong></td>\n <td><input type='text' name='receiver' class='inputsmall' maxlength='24'" . _restorePostValue("receiver", _get('receiver')) . " /></td>\n</tr>\n\n<tr>\n <td><strong>" . $_lang['posts.subject'] . "</strong></td>\n <td><input type='text' name='subject' class='inputsmall' maxlength='22'" . _restorePostValue("subject", _get('subject')) . " /></td>\n</tr>\n\n<tr class='valign-top'>\n <td><strong>" . $_lang['mod.messages.message'] . "</strong></td>\n <td><textarea name='text' class='areamedium' rows='5' cols='33'>" . _restorePostValue("text", null, true) . "</textarea></td>\n</tr>\n\n<tr>\n <td></td>\n <td><input type='submit' value='" . $_lang['global.send'] . "' />" . _getPostFormControls('newmsg', 'text') . "</td>\n</tr>\n\n</table>\n\n" . _jsLimitLength(16384, 'newmsg', 'text') . "\n\n" . _xsrfProtect() . "</form>\n";
/** * Vypis kodu uzivatelskeho menu * @param bool $return navratit namisto vypsani 1/0 */ function _templateUserMenu($return = false) { global $_lang; $output = ""; if (_template_usermenu_parent != "") { $output .= "<" . _template_usermenu_parent . ">\n"; } $extend_args = _extendArgs($output); _extend('call', 'tpl.usermenu.first', $extend_args); if (!_loginindicator) { /*prihlaseni*/ $output .= _template_usermenu_item_start . "<a href='" . _indexroot . "index.php?m=login&login_form_return=" . urlencode($_SERVER['REQUEST_URI']) . "' class='usermenu-item-login'>" . $_lang['usermenu.login'] . "</a>" . _template_usermenu_item_end . "\n"; if (_registration) { /*registrace*/ $output .= _template_usermenu_item_start . "<a href='" . _indexroot . "index.php?m=reg' class='usermenu-item-reg'>" . $_lang['usermenu.registration'] . "</a>" . _template_usermenu_item_end . "\n"; } } else { /*vzkazy*/ if (_messages) { $messages_count = DB::result(DB::query("SELECT COUNT(id) FROM `" . _mysql_prefix . "-pm` WHERE (receiver=" . _loginid . " AND receiver_deleted=0 AND receiver_readtime<update_time) OR (sender=" . _loginid . " AND sender_deleted=0 AND sender_readtime<update_time)"), 0); if ($messages_count != 0) { $messages_count = " [" . $messages_count . "]"; } else { $messages_count = ""; } $output .= _template_usermenu_item_start . "<a href='" . _indexroot . "index.php?m=messages' class='usermenu-item-messages'>" . $_lang['usermenu.messages'] . $messages_count . "</a>" . _template_usermenu_item_end . "\n"; } /*nastaveni*/ $output .= _template_usermenu_item_start . "<a href='" . _indexroot . "index.php?m=settings' class='usermenu-item-settings'>" . $_lang['usermenu.settings'] . "</a>" . _template_usermenu_item_end . "\n"; _extend('call', 'tpl.usermenu.beforelogout', $extend_args); /*odhlaseni*/ $output .= _template_usermenu_item_start . "<a href='" . _xsrfLink(_indexroot . "remote/logout.php?_return=" . urlencode($_SERVER['REQUEST_URI'])) . "' class='usermenu-item-logout'>" . $_lang['usermenu.logout'] . (_template_usermenu_showusername ? " [" . _loginname . "]" : '') . "</a>" . _template_usermenu_item_end . "\n"; } if (_ulist and (!_notpublicsite or _loginindicator)) { /*uziv. menu*/ $output .= _template_usermenu_item_start . "<a href='" . _indexroot . "index.php?m=ulist' class='usermenu-item-ulist'>" . $_lang['usermenu.ulist'] . "</a>" . _template_usermenu_item_end . "\n"; } _extend('call', 'tpl.usermenu.last', $extend_args); if (_template_usermenu_parent != "") { $output .= "</" . _template_usermenu_parent . ">\n"; } if (_template_usermenu_trim == 1) { $output = trim($output); $output = trim($output, _template_usermenu_item_start); $output = trim($output, _template_usermenu_item_end); } // vratit nebo vypsat if ($return) { return $output; } echo $output; }
} /* --- nacteni promennych --- */ $continue = false; if (isset($_GET['id']) and isset($_GET['returnid']) and isset($_GET['returnpage'])) { $id = intval($_GET['id']); $returnid = intval($_GET['returnid']); $returnpage = intval($_GET['returnpage']); $query = DB::query("SELECT title FROM `" . _mysql_prefix . "-articles` WHERE id=" . $id . _admin_artAccess()); if (DB::size($query) != 0) { $query = DB::row($query); $continue = true; } } /* --- ulozeni --- */ if (isset($_POST['confirm'])) { // smazani komentaru DB::query("DELETE FROM `" . _mysql_prefix . "-posts` WHERE type=2 AND home=" . $id); // smazani clanku DB::query("DELETE FROM `" . _mysql_prefix . "-articles` WHERE id=" . $id); // udalost _extend('call', 'admin.article.delete', array('id' => $id)); // presmerovani define('_redirect_to', 'index.php?p=content-articles-list&cat=' . $returnid . '&page=' . $returnpage . '&artdeleted'); return; } /* --- vystup --- */ if ($continue) { $output .= "\n<a href='index.php?p=content-articles-list&cat=" . $returnid . "&page=" . $returnpage . "' class='backlink'>< " . $_lang['global.return'] . "</a>\n<h1>" . $_lang['admin.content.articles.delete.title'] . "</h1>\n<p class='bborder'>" . str_replace("*arttitle*", $query['title'], $_lang['admin.content.articles.delete.p']) . "</p>\n<form class='cform' action='index.php?p=content-articles-delete&id=" . $id . "&returnid=" . $returnid . "&returnpage=" . $returnpage . "' method='post'>\n<input type='hidden' name='confirm' value='1' />\n<input type='submit' value='" . $_lang['admin.content.articles.delete.confirmbox'] . "' />\n" . _xsrfProtect() . "</form>\n"; } else { $output .= _formMessage(3, $_lang['global.badinput']); }
if ($continue and $continue2 and $text != "" and $posttype == 4 || _captchaCheck()) { if (_xsrfCheck()) { if ($posttype == 4 or _loginright_unlimitedpostaccess or _iplogCheck(5)) { if ($guest === '' || DB::result(DB::query('SELECT COUNT(*) FROM `' . _mysql_prefix . '-users` WHERE username=\'' . DB::esc($guest) . '\' OR publicname=\'' . DB::esc($guest) . '\''), 0) == 0) { // zpracovani pluginem $allow = true; _extend('call', 'posts.submit', array('allow' => &$allow, 'posttype' => $posttype, 'posttarget' => $posttarget, 'xhome' => $xhome, 'subject' => &$subject, 'text' => &$text, 'author' => $author, 'guest' => $guest)); if ($allow) { // ulozeni DB::query("INSERT INTO `" . _mysql_prefix . "-posts` (type,home,xhome,subject,text,author,guest,time,ip,bumptime,flag) VALUES (" . $posttype . "," . $posttarget . "," . $xhome . ",'" . $subject . "','" . $text . "'," . $author . ",'" . $guest . "'," . time() . ",'" . _userip . "'," . ($posttype == 5 && $xhome == -1 ? 'UNIX_TIMESTAMP()' : '0') . "," . $pluginflag . ")"); $insert_id = DB::insertID(); if (!_loginright_unlimitedpostaccess and $posttype != 4) { _iplogUpdate(5); } $return = 1; _extend('call', 'posts.new', array('id' => $insert_id, 'posttype' => $posttype)); // topicy - aktualizace bumptime if ($posttype == 5 && $xhome != -1) { DB::query("UPDATE `" . _mysql_prefix . "-posts` SET bumptime=UNIX_TIMESTAMP() WHERE id=" . $xhome); } // zpravy - aktualizace casu zmeny a precteni if ($posttype == 6) { $role = $tdata['sender'] == _loginid ? 'sender' : 'receiver'; DB::query('UPDATE `' . _mysql_prefix . '-pm` SET update_time=UNIX_TIMESTAMP(),' . $role . '_readtime=UNIX_TIMESTAMP() WHERE id=' . $posttarget); } // shoutboxy - odstraneni prispevku za hranici limitu if ($posttype == 4) { $pnum = DB::result(DB::query("SELECT COUNT(id) FROM `" . _mysql_prefix . "-posts` WHERE type=4 AND home=" . $posttarget), 0); if ($pnum > _sboxmemory) { $dnum = $pnum - _sboxmemory; $dposts = DB::query("SELECT id FROM `" . _mysql_prefix . "-posts` WHERE type=4 AND home=" . $posttarget . " ORDER BY id LIMIT " . $dnum);
} /* --- vystup --- */ // pole souvisejicich polozek $content_array = array(); switch ($query['type']) { case 1: $content_array[] = DB::result(DB::query("SELECT COUNT(id) FROM `" . _mysql_prefix . "-posts` WHERE type=1 AND home=" . $id), 0) . " " . $_lang['admin.content.delete.comments']; break; case 2: $content_array[] = DB::result(DB::query("SELECT COUNT(id) FROM `" . _mysql_prefix . "-articles` WHERE home1=" . $id . " AND home2=-1 AND home3=-1"), 0) . " " . $_lang['admin.content.delete.articles']; break; case 3: $content_array[] = DB::result(DB::query("SELECT COUNT(id) FROM `" . _mysql_prefix . "-posts` WHERE type=3 AND home=" . $id), 0) . " " . $_lang['admin.content.delete.posts']; break; case 5: case 3: $content_array[] = DB::result(DB::query("SELECT COUNT(id) FROM `" . _mysql_prefix . "-images` WHERE home=" . $id), 0) . " " . $_lang['admin.content.delete.images']; break; case 8: $content_array[] = DB::result(DB::query("SELECT COUNT(id) FROM `" . _mysql_prefix . "-posts` WHERE type=5 AND home=" . $id), 0) . " " . $_lang['admin.content.delete.posts']; break; case 9: _extend('call', 'ppage.' . $query['type_idt'] . '.delete.confirm', array('contents' => &$content_array, 'query' => $query)); break; default: $content_array[] = $_lang['admin.content.delete.norelated']; } $output .= "\n <p class='bborder'>" . $_lang['admin.content.delete.p'] . "</p>\n <h2>" . $_lang['global.item'] . " <em>" . $query['title'] . "</em></h2><br />\n " . (!empty($content_array) ? "<p>" . $_lang['admin.content.delete.contentlist'] . ":</p>" . _eventList($content_array) . "<div class='hr'><hr /></div>" : '') . "\n\n <form class='cform' action='index.php?p=content-delete&id=" . $id . "' method='post'>\n <input type='hidden' name='confirm' value='1' />\n <input type='submit' value='" . $_lang['admin.content.delete.confirm'] . "' />\n " . _xsrfProtect() . "</form>\n "; } else { $output .= _formMessage(3, $_lang['global.badinput']); }
/** * 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; }
<?php // kontrola jadra if (!defined('_core')) { exit; } // titulek $title = $query['title']; if (_template_autoheadings && $query['autotitle']) { $content .= "<h1>" . $query['title'] . _linkRSS($id, 3) . "</h1>\n"; } _extend('call', 'page.book.aftertitle', $extend_args); // obsah _extend('call', 'page.book.content.before', $extend_args); if ($query['content'] != "") { $content .= _parseHCM($query['content']); } _extend('call', 'page.book.content.after', $extend_args); // prispevky require_once _indexroot . 'require/functions-posts.php'; $content .= _postsOutput(3, $id, array($query['var2'], _publicAccess($query['var1']), $query['var3']));
$item = pathinfo($item); if (!isset($item['extension']) or $item['extension'] != "php") { continue; } $item = mb_substr($item['basename'], 0, mb_strrpos($item['basename'], ".")); if ($item == _loginlanguage) { $selected = ' selected="selected"'; } else { $selected = ""; } $language_select .= '<option value="' . $item . '"' . $selected . '>' . $item . '</option>'; } closedir($handle); $language_select .= '</select></td></tr>'; } else { $language_select = ""; } // wysiwyg if (_loginright_administration) { $admin = "\n\n\n\n <tr>\n <td><strong>" . $_lang['mod.settings.wysiwyg'] . "</strong></td>\n <td><label><input type='checkbox' name='wysiwyg' value='1'" . _checkboxActivate($query['wysiwyg']) . " /> " . $_lang['mod.settings.wysiwyg.label'] . "</label></td>\n </tr>\n\n "; } else { $admin = ""; } $module .= "\n<p><a href='index.php?m=profile&id=" . _loginname . "'>" . $_lang['mod.settings.profilelink'] . " ></a></p>\n<p>" . $_lang['mod.settings.p'] . "</p>" . $message . "\n<form action='index.php?m=settings' method='post' name='setform' enctype='multipart/form-data'>\n\n" . _jsLimitLength(1024, "setform", "note") . "\n\n <fieldset>\n <legend>" . $_lang['mod.settings.userdata'] . "</legend>\n <table class='profiletable'>\n\n <tr>\n <td><strong>" . $_lang['login.username'] . "</strong> <span class='important'>*</span></td>\n <td><input type='text' name='username'" . _restorePostValue('username', _loginname) . " class='inputsmall' maxlength='24' />" . (!_loginright_changeusername ? "<span class='hint'>(" . $_lang['mod.settings.namechangenote'] . ")</span>" : '') . "</td>\n </tr>\n\n <tr>\n <td><strong>" . $_lang['mod.settings.publicname'] . "</strong></td>\n <td><input type='text' name='publicname'" . _restorePostValue('publicname', $query['publicname']) . " class='inputsmall' maxlength='24' /></td>\n </tr>\n\n <tr class='valign-top'>\n <td><strong>" . $_lang['global.email'] . "</strong> <span class='important'>*</span></td>\n <td><input type='text' name='email'" . _restorePostValue('email', $query['email']) . " class='inputsmall'/></td>\n </tr>\n\n " . $language_select . "\n\n <tr>\n <td><strong>" . $_lang['mod.settings.massemail'] . "</strong></td>\n <td><label><input type='checkbox' name='massemail' value='1'" . _checkboxActivate($query['massemail']) . " /> " . $_lang['mod.settings.massemail.label'] . "</label></td>\n </tr>\n\n " . $admin . "\n </table>\n </fieldset>\n\n\n <fieldset>\n <legend>" . $_lang['mod.settings.password'] . "</legend>\n <p class='minip'>" . $_lang['mod.settings.password.hint'] . "</p>\n <table class='profiletable'>\n\n <tr>\n <td><strong>" . $_lang['mod.settings.password.current'] . "</strong></td>\n <td><input type='password' name='currentpassword' class='inputsmall' autocomplete='off' /></td>\n </tr>\n\n <tr>\n <td><strong>" . $_lang['mod.settings.password.new'] . "</strong></td>\n <td><input type='password' name='newpassword' class='inputsmall' autocomplete='off' /></td>\n </tr>\n\n <tr>\n <td><strong>" . $_lang['mod.settings.password.new'] . " (" . $_lang['global.check'] . ")</strong></td>\n <td><input type='password' name='newpassword-confirm' class='inputsmall' autocomplete='off' /></td>\n </tr>\n\n </table>\n </fieldset>\n\n " . _extend('buffer', 'mod.settings.form') . "\n\n\n <fieldset>\n <legend>" . $_lang['mod.settings.info'] . "</legend>\n\n <table class='profiletable'>\n\n <tr>\n <td><strong>" . $_lang['global.icq'] . "</strong></td>\n <td><input type='text' name='icq'" . _restorePostValue('icq', $query['icq']) . " class='inputsmall' /></td>\n </tr>\n\n <tr>\n <td><strong>" . $_lang['global.skype'] . "</strong></td>\n <td><input type='text' name='skype'" . _restorePostValue('skype', $query['skype']) . " class='inputsmall' /></td>\n </tr>\n\n <tr>\n <td><strong>" . $_lang['global.msn'] . "</strong></td>\n <td><input type='text' name='msn'" . _restorePostValue('msn', $query['msn']) . " class='inputsmall' /></td>\n </tr>\n\n <tr>\n <td><strong>" . $_lang['global.jabber'] . "</strong></td>\n <td><input type='text' name='jabber'" . _restorePostValue('jabber', $query['jabber']) . " class='inputsmall' /></td>\n </tr>\n\n <tr>\n <td><strong>" . $_lang['global.web'] . "</strong></td>\n <td><input type='text' name='web' value='" . $query['web'] . "' class='inputsmall' /><span class='hint'>" . $_lang['mod.settings.web.hint'] . "</span></td>\n </tr>\n\n <tr class='valign-top'>\n <td><strong>" . $_lang['global.note'] . "</strong></td>\n <td><textarea name='note' class='areasmall' rows='9' cols='33'>" . _restorePostValue('note', $query['note'], true) . "</textarea></td>\n </tr>\n\n <tr><td></td>\n <td>" . _getPostFormControls("setform", "note") . "</td>\n </tr>\n\n </table>\n\n </fieldset>\n"; if (_uploadavatar) { $module .= "\n <fieldset>\n <legend>" . $_lang['mod.settings.avatar'] . "</legend>\n " . _extend('buffer', 'mod.settings.avatar', array('extra' => array('query' => $query))) . "\n <p><strong>" . $_lang['mod.settings.avatar.upload'] . ":</strong> <input type='file' name='avatar' /></p>\n <table>\n <tr class='valign-top'>\n <td width='106'><div class='avatar'><img src='" . $avatar_path . "' alt='avatar' /></div></td>\n <td><p class='minip'>" . $_lang['mod.settings.avatar.hint'] . "</p><p><label><input type='checkbox' name='removeavatar' value='1' /> " . $_lang['mod.settings.avatar.remove'] . "</label></p></td>\n </tr>\n </table>\n </fieldset>\n"; } if (_loginright_selfdestruction and _loginid != 0) { $module .= "\n\n <fieldset>\n <legend>" . $_lang['mod.settings.selfremove'] . "</legend>\n <label><input type='checkbox' name='selfremove' value='1' onclick='if (this.checked==true) {return _sysConfirm();}' /> " . $_lang['mod.settings.selfremove.box'] . "</label><br /><br />\n <div class='lpad'><strong>" . $_lang['mod.settings.selfremove.confirm'] . ":</strong> <input type='password' name='selfremove-confirm' class='inputsmall' /></div>\n </fieldset>\n\n"; } $module .= "\n<br />\n<input type='submit' value='" . $_lang['mod.settings.submit'] . "' />\n<input type='reset' value='" . $_lang['global.reset'] . "' onclick='return _sysConfirm();' />\n\n" . _xsrfProtect() . "</form>\n";
// podminky $sql .= ' WHERE gal.visible=1'; if ($public) { $sql .= ' AND gal.public=1'; } $sql .= ' AND ' . _tmpSearchQuery('img', array('title')); // vykonani a nacteni vysledku $q = DB::query($sql . ' LIMIT 20'); while ($r = DB::row($q)) { $link = _addGetToLink(_linkRoot($r['home'], $r['title_seo']), 'page=' . _resultPagingGetItemPage($r['var2'], "images", "ord<" . $r['ord'] . " AND home=" . $r['home'])); $results[] = array($link, $r['gal_title'], ($r['title'] !== '' ? $r['title'] . '<br />' : '') . _galleryImage($r, 'search', 128, 128)); } DB::free($q); } // extend _extend('call', 'mod.search.results', array('results' => &$results, 'query' => $search_query, 'query_sql' => $search_query_sql)); // vypis vysledku if (count($results) != 0) { foreach ($results as $item) { $module .= "\n<h2 class='list-title'><a href='" . $item[0] . "'>" . $item[1] . "</a></h2>\n<p class='list-perex'>" . $item[2] . "</p>\n"; if (isset($item[3])) { $module .= "<div class='list-info'>" . $item[3] . "</div>\n"; } } } else { $module .= "<br />" . _formMessage(1, $_lang['mod.search.noresult']); } } else { $module .= "<br />" . _formMessage(2, $_lang['mod.search.minlength']); } }
/** * Spustit CRON */ public static function runCron() { $cronNow = time(); $cronUpdate = false; $cronLockFile = null; $cronTimes = unserialize(self::$settings['cron_times']); if (false === $cronTimes) { $cronTimes = array(); $cronUpdate = true; } // zkontrolovat intervaly foreach (self::$cronIntervals as $cronIntervalName => $cronIntervalSeconds) { if (isset($cronTimes[$cronIntervalName])) { // posledni cas je zaznamenan if ($cronNow - $cronTimes[$cronIntervalName] >= $cronIntervalSeconds) { // kontrola lock file if (null === $cronLockFile) { $cronLockFilePath = _indexroot . 'data/cron.lock'; $cronLockFile = fopen($cronLockFilePath, 'r'); if (!flock($cronLockFile, LOCK_EX | LOCK_NB)) { // lock file je nepristupny fclose($cronLockFile); $cronLockFile = null; $cronUpdate = false; break; } } // udalost $cronEventArgs = array('last' => $cronTimes[$cronIntervalName], 'name' => $cronIntervalName, 'seconds' => $cronIntervalSeconds, 'delay' => $cronNow - $cronTimes[$cronIntervalName]); _extend('call', 'sys.cron', $cronEventArgs); _extend('call', 'sys.cron.' . $cronIntervalName, $cronEventArgs); // aktualizovat posledni cas $cronTimes[$cronIntervalName] = $cronNow; $cronUpdate = true; } } else { // posledni cas neni zaznamenan $cronTimes[$cronIntervalName] = $cronNow; $cronUpdate = true; } } // aktualizovat casy if ($cronUpdate) { DB::update(_mysql_prefix . '-settings', '`var`=".cron_times"', array('val' => serialize($cronTimes))); } // uvolnit lockfile if (null !== $cronLockFile) { flock($cronLockFile, LOCK_UN); fclose($cronLockFile); } }
<?php /* --- incializace jadra --- */ require '../require/load.php'; define('_header', 'Content-Type: text/plain; charset=UTF-8'); SL::init('../', null, true, false, true, false); /* --- autorizace --- */ $auth = explode(':', SL::$settings['cron_auth'], 2); if (2 !== sizeof($auth) || !isset($_GET['user'], $_GET['password']) || $_GET['user'] !== $auth[0] || $_GET['password'] !== $auth[1]) { header('HTTP/1.0 401 Unauthorized'); echo 'Unauthorized'; exit(1); } /* --- spusteni cronu --- */ // priprava $start = microtime(true); $names = array(); function cron_log_name($args) { $GLOBALS['names'][] = $args['name']; } _extend('reg', 'sys.cron', 'cron_log_name'); // spusteni SL::runCron(); // vysledek echo 'OK(', round((microtime(true) - $start) * 1000), 'ms) ', implode(', ', $names);
} } else { $lastpost = "-"; } $iteminfo .= "<span>" . $_lang['global.postsnum'] . ":</span> " . DB::result(DB::query("SELECT COUNT(id) FROM `" . _mysql_prefix . "-posts` WHERE type=3 AND home=" . $item['id']), 0) . _template_listinfoseparator . "<span>" . $_lang['global.lastpost'] . ":</span> " . $lastpost; break; // galerie // galerie case 5: $iteminfo .= "<span>" . $_lang['global.imgsnum'] . ":</span> " . DB::result(DB::query("SELECT COUNT(id) FROM `" . _mysql_prefix . "-images` WHERE home=" . $item['id']), 0); break; // forum // forum case 8: $iteminfo .= "<span>" . $_lang['global.topicsnum'] . ":</span> " . DB::result(DB::query("SELECT COUNT(id) FROM `" . _mysql_prefix . "-posts` WHERE type=5 AND home=" . $item['id'] . " AND xhome=-1"), 0) . _template_listinfoseparator . "<span>" . $_lang['global.answersnum'] . ":</span> " . DB::result(DB::query("SELECT COUNT(id) FROM `" . _mysql_prefix . "-posts` WHERE type=5 AND home=" . $item['id'] . " AND xhome!=-1"), 0); break; // plugin stranka // plugin stranka case 9: $iteminfo = _extend('buffer', 'ppage.' . $item['type_idt'] . '.interinfo', array('item' => $item)); break; } if ($iteminfo != "") { $content .= "<div class='list-info'>" . $iteminfo . "</div>\n"; } } $content .= "\n"; } } else { $content .= $_lang['global.nokit']; }
// kontrola jadra if (!defined('_core')) { exit; } // titulek $title = $query['title']; if (_template_autoheadings && $query['autotitle']) { $content .= "<h1>" . $query['title'] . "</h1>\n"; _extend('call', 'page.gallery.aftertitle', $extend_args); } // obsah _extend('call', 'page.gallery.content.before', $extend_args); if ($query['content'] != "") { $content .= _parseHCM($query['content']) . "\n\n<div class='hr'><hr /></div>\n\n"; } _extend('call', 'page.gallery.content.after', $extend_args); // obrazky $paging = _resultPaging(_indexOutput_url, $query['var2'], "images", "home=" . $id); $images = DB::query("SELECT * FROM `" . _mysql_prefix . "-images` WHERE home=" . $id . " ORDER BY ord " . $paging[1]); $images_number = DB::size($images); if ($images_number != 0) { $usetable = $query['var1'] != -1; if (_pagingmode == 1 or _pagingmode == 2) { $content .= $paging[0]; } if ($usetable) { $content .= "<table class='gallery'>\n"; } else { $content .= "<div class='gallery'>\n"; } // obrazky
function _admin_rootItemOutput($item, $itr) { global $_lang, $counter, $highlight, $ppages; $type_array = _admin_getTypeArray(); // pristup k polozce if (!constant('_loginright_admin' . $type_array[$item['type']])) { $denied = true; } else { $denied = false; } // trida pro neviditelnost anebo neverejnost $sclass = ""; if ($item['visible'] == 0 xor $item['public'] == 0) { if ($item['visible'] == 0) { $sclass = " class='invisible'"; } if ($item['public'] == 0) { $sclass = " class='notpublic'"; } } else { if ($item['visible'] == 0 and $item['public'] == 0) { $sclass = " class='invisible-notpublic'"; } else { $sclass = " class='normal'"; } } // pozadi oddelovace if ($item['type'] == 4) { $sepbg_start = "<div class='sep'" . ($counter == 0 ? " style='padding-top:0;'" : '') . "><div class='sepbg'>"; $sepbg_end = "</div></div>"; $highlight = false; } else { $sepbg_start = ""; $sepbg_end = ""; $sepbg_start_sub = ""; $sepbg_end_sub = ""; } // kod radku $dclass = ""; if ($itr == true) { if ($highlight) { $dclass = " class='intersecpad-hl'"; } else { $dclass = " class='intersecpad'"; } } else { if ($highlight) { $dclass = " class='hl'"; } } $extra_actions = ''; if (!$denied) { if ($item['type'] == 5) { $extra_actions = " <a href='index.php?p=content-manageimgs&g=" . $item['id'] . "'><img src='images/icons/list.png' alt='images' class='contenttable-icon' />" . $_lang['admin.content.form.showpics'] . "</a>"; } _extend('call', 'admin.root.actions', array('item' => $item, 'extra_actions' => &$extra_actions)); } $extendOutput = _extend('buffer', 'admin.root.item', array('item' => $item, 'denied' => $denied, 'extra_actions' => $extra_actions, 'class' => $dclass)); if ('' !== $extendOutput) { if (false === $extendOutput) { return ''; } return $extendOutput; } return "\n <tr" . $dclass . ">\n <td class='name'>" . $sepbg_start . "<input type='text' name='" . $item['id'] . "' value='" . $item['ord'] . "' />" . ($item['id'] == _index_page_id ? "<img src='images/icons/tag.png' alt='index' class='contenttable-icon' />" : '') . "<a" . ($item['type'] != 4 ? " href='" . _indexroot . _linkRoot($item['id'], $item['title_seo']) . "' target='_blank'" . $sclass : '') . ">" . $item['title'] . "</a>" . $sepbg_end . "</td>\n <td class='type'" . ($denied ? " colspan='2'" : '') . ">" . $sepbg_start . "<div class='tpad'>" . ($item['type'] != 9 ? $_lang['admin.content.' . $type_array[$item['type']]] : (isset($ppages[$item['type_idt']]) ? $ppages[$item['type_idt']] : _htmlStr($item['type_idt']))) . " <small>(" . $item['id'] . ")</small></div>" . $sepbg_end . "</td>\n " . (!$denied ? "<td class='actions'>" . $sepbg_start . "<div class='tpad'><a href='index.php?p=content-edit" . $type_array[$item['type']] . "&id=" . $item['id'] . "'><img src='images/icons/edit.png' alt='edit' class='contenttable-icon' />" . $_lang['global.edit'] . "</a> <a href='index.php?p=content-delete&id=" . $item['id'] . "'><img src='images/icons/delete.png' alt='del' class='contenttable-icon' />" . $_lang['global.delete'] . "</a>" . $extra_actions . "</div>" . $sepbg_end . "</td>" : '') . "\n </tr>\n\n "; }