function print_story($sid, $ipos = "right") { global $server_name; global $auth_user; $story = db_get_rec("story", $sid); $pipe = db_get_rec("pipe", $story["pid"]); $topic = db_get_rec("topic", $story["tid"]); $a["story"] = $story["story"]; $a["time"] = $story["time"]; $a["sid"] = $sid; $a["ipos"] = $ipos; $a["topic"] = $topic["topic"]; $a["icon"] = $story["icon"]; $a["title"] = $story["title"]; $a["pid"] = $story["pid"]; $a["ipos"] = $ipos; $a["zid"] = $pipe["zid"]; if ($sid > 0) { $row = run_sql("select count(cid) as comments from comment where sid = ?", array($sid)); $a["comments"] = $row[0]["comments"]; } else { $a["comments"] = 0; } print_article($a); }
function get_head() { global $page; global $key; global $desc; $_TITLE = get_title(); if (isset($_REQUEST['id'])) { $desc = print_article("meta_description"); $key = print_article("meta_key_words"); } elseif ($page == 'static') { $desc = print_static("meta_description"); $key = print_static("meta_key_words"); } if ($page == 'crt_artcl' || $page == 'game_redactor' || $page == 'admin') { $ckeditor = '<script type="text/javascript" src="' . ENGINE_URL . '/lib/ckeditor/ckeditor.js"></script>'; } else { $ckeditor = ''; } $_TITLE = array_reverse($_TITLE); $title = implode(' | ', $_TITLE); $r = ' <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <meta name="description" content="' . $desc . '" /> <meta name="keywords" content="' . $key . '" /> <meta name="generator" content="Tractor Engine"> <meta name="htotutunas" content="' . ENGINE_URL . '"> <title>' . $title . '</title> <link href="' . ENGINE_URL . '/lib/geshi/code_style.css" rel="stylesheet" type="text/css" media="all" /> <link title="' . my_lang('feed_desc') . '" href="' . SITE_RSS . '" type=application/rss+xml rel=alternate> <link rel="icon" href="' . SITE_URL . '/favicon.png" type="image/x-icon" /> ' . $ckeditor; return $r; }
function print_pipe($pid) { global $server_name; $pipe = db_get_rec("pipe", $pid); $date = date("Y-m-d H:i", $pipe["time"]); $topic = db_get_rec("topic", $pipe["tid"]); $a["zid"] = $pipe["zid"]; $a["title"] = $pipe["title"]; $a["icon"] = $pipe["icon"]; $a["pid"] = $pipe["pid"]; $a["topic"] = $topic["topic"]; $a["story"] = $pipe["story"]; $a["ipos"] = "middle"; $row = run_sql("select count(cid) as comments from comment where pid = ?", array($pid)); $a["comments"] = $row[0]["comments"]; $row = run_sql("select sum(value) as score from pipe_vote where pid = ?", array($pid)); $a["score"] = (int) $row[0]["score"]; if ($a["score"] > 0) { $a["score"] = "+" . $a["score"]; } print_article($a); }
function print_submit_box($title, $body, $story, $tid, $preview) { global $auth_zid; global $auth_user; print_header("Submit Story"); writeln('<table class="fill">'); writeln('<tr>'); writeln('<td class="left_col">'); print_left_bar("main", "pipe"); writeln('</td>'); writeln('<td class="fill">'); if ($preview) { $a["zid"] = $auth_zid; $topic = db_get_rec("topic", $tid); $a["title"] = $title; $a["topic"] = $topic["topic"]; $a["icon"] = $topic["icon"]; $a["story"] = $story; writeln('<h1>Preview</h1>'); writeln('<p>Check your links before you post!</p>'); print_article($a); } writeln('<form method="post">'); writeln('<div class="dialog_title">Submit Story</div>'); writeln('<div class="dialog_body">'); writeln('<table class="fill" style="padding: 0px">'); writeln(' <tr>'); writeln(' <td style="width: 80px">Title</td>'); writeln(' <td colspan="2"><input name="title" type="text" value="' . $title . '" required="required"/></td>'); writeln(' </tr>'); writeln(' <tr>'); writeln(' <td style="width: 80px">Topic</td>'); writeln(' <td colspan="2">'); writeln(' <select name="tid">'); $topics = db_get_list("topic", "topic", array("promoted" => 1)); $k = array_keys($topics); for ($i = 0; $i < count($topics); $i++) { $topic = $topics[$k[$i]]; if ($topic["tid"] == $tid) { writeln(' <option value="' . $topic["tid"] . '" selected="selected">' . $topic["topic"] . '</option>'); } else { writeln(' <option value="' . $topic["tid"] . '">' . $topic["topic"] . '</option>'); } } writeln(' </select>'); writeln(' </td>'); writeln(' </tr>'); writeln(' <tr>'); writeln(' <td style="width: 80px; vertical-align: top; padding-top: 12px">Story</td>'); writeln(' <td colspan="2"><textarea name="story" style="height: 200px" required="required">' . $body . '</textarea></td>'); writeln(' </tr>'); writeln(' <tr>'); $question = captcha_challenge(); writeln(' <td>Captcha</td>'); writeln(' <td><table><tr><td>' . $question . '</td><td><input name="answer" type="text" style="margin-left: 8px; width: 100px"/></td></tr></table></td>'); writeln(' <td class="right"><input type="submit" value="Submit"/> <input name="preview" type="submit" value="Preview"/></td>'); writeln(' </tr>'); writeln('</table>'); writeln('</div>'); writeln('</form>'); writeln('</td>'); writeln('</tr>'); writeln('</table>'); print_footer(); }
<td colspan="2"><div align="center">AJOUTER</div></td> </tr> <form action="../../mod/prod.php" method="post"> <tr> <td> <select name="qte1"> <?php for ($i = 1; $i <= 100; $i++) { echo '<option>' . $i . '</option>'; } ?> </select> </td> <td colspan="5"> <select name="desc" id="" data-rel="chosen"> <option>Sélectionner un article</option> <?php print_r(print_article()); ?> </select> </td> <td colspan="2"> </td> <td colspan="2"><input type="submit"></td> </tr> </form> <span> <a href="proformat_bon.php" style="border-radius: 2px;border: 1px solid #bb1813;text-decoration: none;background-color: #0063DC;font-size:22px;color: #fff0eb"> Génèrer la PROFORMA </a> <br><br> </span>
BSD License for more details. ############################################################## */ error_reporting(E_ALL & ~E_NOTICE); @set_magic_quotes_runtime(0); require_once 'global.php'; require_once 'language/default/frontend_main.php'; switch ($_REQUEST['do']) { case 'viewarticle': $location = $LANG['loc_news']; view_article(); break; case 'printarticle': print_article(); break; default: index_main(); break; } function index_main() { global $db; do_header(); require_once "templates/indexFrontpage.html.php"; do_footer(); } function view_article() { do_header();
$a = fs_dir("{$doc_root}/images"); for ($i = 0; $i < count($a); $i++) { if (substr($a[$i], -7) == "-64.png") { $icon_list[] = substr($a[$i], 0, -7); } } writeln('<h1>Preview</h1>'); $a = array(); $a["title"] = $title; $a["time"] = $story["time"]; $a["pid"] = $story["pid"]; $a["zid"] = $zid; $a["topic"] = $topic; $a["icon"] = $icon; $a["story"] = $new_body; print_article($a); writeln('<h1>Edit</h1>'); beg_tab(); print_row(array("caption" => "Title", "text_key" => "title", "text_value" => $title)); print_row(array("caption" => "Topic", "option_key" => "tid", "option_value" => $tid, "option_list" => $topic_list, "option_keys" => $topic_keys)); print_row(array("caption" => "Icon", "option_key" => "icon", "option_value" => $icon, "option_list" => $icon_list)); print_row(array("caption" => "Story", "textarea_key" => "story", "textarea_value" => $body, "textarea_height" => "400")); end_tab(); writeln('<table class="fill">'); writeln(' <tr>'); writeln(' <td><a href="/icons">Icons</a></td>'); writeln(' <td style="text-align: right"><input name="publish" type="submit" value="Publish"/> <input name="preview" type="submit" value="Preview"/></td>'); writeln(' </tr>'); writeln('</table>'); //right_box("Publish,Preview"); writeln('</form>');
function sp_get_macros() { global $page, $mod_comments, $_CATEGORIES, $ver, $categories, $my_lang_profile, $ENGINE_URL, $SITE_URL; $tmpl_list = array(); // staff $tmpl_list['index']['site_name'] = SITE_NAME; $tmpl_list['index']['main'] = my_lang('main'); $tmpl_list['index']['url'] = SITE_URL; $tmpl_list['index']['crumbs'] = get_crumbs(); $tmpl_list['index']['header'] = get_head(); //Заголовки [модуль headers] $tmpl_list['index']['path'] = ENGINE_URL . '/themes/' . THEME; $tmpl_list['index']['site_description'] = SITE_DESC; //подзаголовок $tmpl_list['index']['Y'] = date("Y"); $tmpl_list['index']['te_version'] = $ver; $tmpl_list['index']['rss'] = SITE_RSS; $tmpl_list['index']['auth_menu'] = bc_auth_menu(); //<li> меню авторизации if (isset($_SESSION['name'])) { $tmpl_list['index']['user'] = $_SESSION['name']; /* $tmpl_list['index']['profile_link'] = <<<_MPF <a href="$SITE_URL/lib/window/profile.php" onclick="window.open(this.href, '', 'resizable=yes,status=no,location=no,toolbar=no,menubar=no,fullscreen=no,scrollbars=no,dependent=no,width=500,left=150,height=500,top=10'); return false;">$my_lang_profile</a> _MPF; */ } //рубрики <li> foreach ($categories as $cat) { if ($cat['cat_count'] !== "0") { $tmpl_list['index']['cat_list'] .= ' <li><a href="' . get_link('category', $cat['category_id']) . '">' . $cat['name'] . ' <small>(' . $cat['cat_count'] . ')</small></a></li> '; } } //список страниц <li> $menu = get_static_list_rank(); foreach ($menu as $link) { $tmpl_list['index']['menu'] .= '<li><a href="' . SITE_URL . '/' . $link['sef'] . '">' . $link['title'] . '</a></li>'; } ## Cтраница if ($page == 'static' || isset($_REQUEST['s'])) { $tmpl_list['static']['title'] = print_static("title"); $tmpl_list['static']['static'] = print_static("content"); $f = TE_DIR . '/themes/' . THEME . '/static.html'; if (is_file($f)) { $tmpl_list['index']['content'] .= sp_get_skin($f, $tmpl_list['static']); } } elseif (($page == 'article' || $page == 'main') && !isset($_REQUEST['id'])) { //список записей $DB = get_article_list(); if (!empty($DB)) { if (isset($_REQUEST['category_id'])) { $tmpl_list['index']['title'] = $_CATEGORIES[$_REQUEST['category_id']]['name']; } foreach ($DB as $p) { if ($p['approve'] == 1) { //формируем ссылку if (!USE_SEF) { $link = SITE_URL . '/?id=' . $p['id']; } elseif (SEF_TYPE == 1) { $link = SITE_URL . '/article/' . $_CATEGORIES[$p['category_id']]['sef'] . '/' . $p['sef']; } elseif (SEF_TYPE == 2) { $link = SITE_URL . '/' . $_CATEGORIES[$p['category_id']]['sef'] . '/' . $p['sef']; } } if (@$_SESSION['status'] == 'admin') { $tmpl_list['post_list']['post_edit_link'] = <<<_le <a href="{$SITE_URL}/window/ca/?id={$p['id']}&action=edit" onclick="window.open(this.href, '', 'resizable=yes,status=no,location=no,toolbar=no,menubar=no,fullscreen=no,scrollbars=no,dependent=no,width=850,left=150,height=640,top=10'); return false;">Редактор</a> _le; $tmpl_list['post_list']['post_edit_url'] = "{$SITE_URL}/window/ca/?id={$p['id']}&action=edit"; } $tmpl_list['post_list']['title'] = $p['title']; if ($p['description'] !== '') { $tmpl_list['post_list']['post'] = $p['description'] . ' <a href="' . $link . '">' . my_lang("article_more") . '</a>'; } else { $tmpl_list['post_list']['post'] = $p['content']; } $tmpl_list['post_list']['post_url'] = $link; $tmpl_list['post_list']['post_date'] = date(DATE_FORMAT, gm2local($p['stamp'], TZ)); $tmpl_list['post_list']['post_category_url'] = get_link('category', $p['category_id']); $tmpl_list['post_list']['post_category'] = $_CATEGORIES[$p['category_id']]['name']; $tmpl_list['post_list']['post_author'] = $p['author']; $f = TE_DIR . '/themes/' . THEME . '/post_list.html'; if (is_file($f)) { $tmpl_list['index']['content'] .= sp_get_skin($f, $tmpl_list['post_list']); } } $tmpl_list['index']['navi'] = get_navi(get_artcl_sum(), ARTCLS_PER_PAGE); } } elseif (isset($_REQUEST['id'])) { //$tmpl_post = array_merge($tmpl_list, $tmpl_post); $profile = get_profile(print_article('author_id')); ## тело записи $tmpl_list['post']['title'] = print_article("title"); $tmpl_list['post']['post'] = print_article("content"); $tmpl_list['post']['post_category_url'] = get_link('category'); $tmpl_list['post']['post_author'] = $profile['name']; $a_id = print_article("author_id"); $tmpl_list['post']['post_author_link'] = <<<_APF <a href="{$SITE_URL}/window/profile/?author_id={$a_id}" onclick="window.open(this.href, '', 'resizable=yes,status=no,location=no,toolbar=no,menubar=no,fullscreen=no,scrollbars=no,dependent=no,width=500,left=150,height=250,top=10'); return false;">{$profile["name"]}</a> _APF; if (@$_SESSION['status'] == 'admin') { $tmpl_list['post']['post_edit_link'] = <<<_APE <a href="{$SITE_URL}/window/ca/?id={$_REQUEST['id']}&action=edit" onclick="window.open(this.href, '', 'resizable=yes,status=no,location=no,toolbar=no,menubar=no,fullscreen=no,scrollbars=no,dependent=no,width=850,left=150,height=640,top=10'); return false;">Редактор</a> _APE; $tmpl_list['post']['post_edit_url'] = "{$SITE_URL}/window/ca/?id={$_REQUEST['id']}&action=edit"; } $tmpl_list['post']['post_date'] = date(DATE_FORMAT, gm2local(print_article('stamp'), TZ)); $tmpl_list['post']['post_category'] = $_CATEGORIES[$_REQUEST['category_id']]['name']; $f = TE_DIR . '/themes/' . THEME . '/post.html'; $tmpl_list['index']['content'] .= sp_get_skin($f, $tmpl_list['post']); ## комментарии if ($mod_comments) { //если модуль "вкл" function del_link($id) { if ($_SESSION['status'] == 'admin') { return ' <a href="' . SITE_URL . '/?id=' . $_REQUEST['id'] . '&cid=' . $id . '&com_act=del">X</a>'; } else { return ''; } } $comm_data = get_comments(); //получаем список комментов и начинаем обходить шаблон комментария if (isset($comm_data[0])) { foreach ($comm_data as $p) { $profile = get_profile($p['author_id']); //комментатор не зарег-н if (empty($p['author_id'])) { $tmpl_list['comment']['name'] = $p['author']; //if (!empty($p['email'])) { $gra = get_gravatar($p['email'], $size = 35); //} } else { $gra = get_gravatar($profile['email'], $size = 35); $tmpl_list['comment']['name'] = <<<_PF <a href="{$SITE_URL}/window/profile?author_id={$p["author_id"]}" onclick="window.open(this.href, '', 'resizable=yes,status=no,location=no,toolbar=no,menubar=no,fullscreen=no,scrollbars=no,dependent=no,width=500,left=150,height=250,top=10'); return false;">{$profile['name']}</a> _PF; } $tmpl_list['comment']['name'] .= del_link($p['id']); $tmpl_list['comment']['gravatar'] = $gra['img']; $tmpl_list['comment']['gravatar_url'] = $gra['url']; $tmpl_list['comment']['date'] = date(DATE_FORMAT, gm2local($p['date'], TZ)); //[lib.php, date = stamp] $tmpl_list['comment']['comment'] = $p['content']; $f = TE_DIR . '/themes/' . THEME . '/comment.html'; $tmpl_list['comment_list']['comments'] .= sp_get_skin($f, $tmpl_list['comment']); } } $tmpl_list['comment_list']['comments_form'] = print_comments_form(); //и вставляем полученный список комментариев в шаблон списка комментариев (вот неожиданность:) if (is_file(TE_DIR . '/themes/' . THEME . '/comment_list.html')) { $tmpl_list['index']['content'] .= sp_get_skin(TE_DIR . '/themes/' . THEME . '/comment_list.html', $tmpl_list['comment_list']); } } } elseif ($page == "album") { if (is_file(TE_DIR . '/themes/' . THEME . '/album.html')) { $album = get_album(); if (!empty($album)) { foreach ($album as $img) { $tmpl_list['album']['album'] .= '<a target="_blank" href="' . $img['url'] . '"> <img src="' . $img['url'] . '" HSPACE="0" VSPACE="0" border="0" title="Добавлена ' . date("d.m.Y H:i:s", $img['time']) . '" style="max-height: 70px;"> </a>'; } } else { $tmpl_list['album']['album'] .= my_lang('album_empty'); } $tmpl_list['index']['content'] .= sp_get_skin(TE_DIR . '/themes/' . THEME . '/album.html', $tmpl_list['album']); } else { $tmpl_list['index']['content'] .= 'Не обнаружено файла-шаблона для альбома('; } } elseif ($page == "feedback") { if (is_file(TE_DIR . '/themes/' . THEME . '/feedback.html')) { $tmpl_list['feedback']['sid'] = get_sid(); $reg = Registry::instance(); $tmpl_list['feedback']['feedback_msg'] = $reg->get('feedback_msg'); $tmpl_list['index']['content'] .= sp_get_skin(TE_DIR . '/themes/' . THEME . '/feedback.html', $tmpl_list['feedback']); } } //список последних записей <li><a>link</a></li> $tmpl_list['index']['post_list'] = bc_postlist(7); $tmpl_list['index']['theme_list'] = bc_theme_list(); $tmpl_list['index']['time'] = microtime(true) - ST; return $tmpl_list; }
function get_link($p, $id = '') { global $_URL; global $page; global $_CATEGORIES; if ($id !== '') { $category_id = $id; } else { $category_id = $_REQUEST['category_id']; } switch ($p) { case 'main': return SITE_URL; break; case 'page': return SITE_URL . '/' . $page; break; case 'category': switch (SEF_TYPE) { case 0: return SITE_URL . '/?category_id=' . $category_id; break; case 1: return SITE_URL . '/article/' . $_CATEGORIES[$category_id]['sef']; break; case 2: return SITE_URL . '/' . $_CATEGORIES[$category_id]['sef']; break; break; } case 'article': switch (SEF_TYPE) { case 0: return SITE_URL . '/?id=' . $_REQUEST['id']; break; case 1: return SITE_URL . '/article/' . $_CATEGORIES[$_REQUEST['category_id']]['sef'] . '/' . print_article('sef'); break; case 2: return SITE_URL . '/' . $_CATEGORIES[$_REQUEST['category_id']]['sef'] . '/' . print_article('sef'); break; break; } case 'del_comment': switch (SEF_TYPE) { case 0: return SITE_URL . '/?id=' . $_REQUEST['id'] . '&cid=' . $id . '&com_act=del#down'; break; case 1: return SITE_URL . '/article/' . $_CATEGORIES[$_REQUEST['category_id']]['sef'] . '/' . print_article('sef') . '/?cid=' . $id . '&com_act=del#down'; break; case 2: return SITE_URL . '/' . $_CATEGORIES[$_REQUEST['category_id']]['sef'] . '/' . print_article('sef') . '/?cid=' . $id . '&com_act=del#down'; break; break; } case 'static': if (SEF_TYPE == 0) { return SITE_URL . '/?s=' . $_REQUEST['s']; } else { return SITE_URL . '/' . print_static('sef'); } } }