$date = date('Ymd'); if ($mdate === $date) { return true; } else { return false; } } } function delete_cache($cache_path) { if (file_exists($cache_path)) { unlink($cache_path); } } function create_cache($cache_path, $rss_url) { $rss_data = file_get_contents($rss_url); $xml = simplexml_load_string($rss_data); $json = json_encode($xml); $object = json_decode($json); $image_tag = $object->entry[0]->content; preg_match('/src="([^"]+)"/', $image_tag, $m); $image_url = $m[1]; file_put_contents($cache_path, file_get_contents($image_url)); } if (!cache_exists($cache_path)) { delete_cache($cache_path); create_cache($cache_path, $rss_url); } header('Content-Type: image/gif'); echo file_get_contents($cache_path);
function custom_print($custom_category, $custom_template, $aviable, $custom_from, $custom_limit, $custom_cache, $do) { global $db, $is_logged, $member_id, $xf_inited, $cat_info, $config, $user_group, $category_id, $_TIME, $lang, $smartphone_detected, $dle_module, $PHP_SELF; $do = $do ? $do : "main"; $aviable = explode('|', $aviable); if (!in_array($do, $aviable) and $aviable[0] != "global") { return ""; } $custom_category = $db->safesql(str_replace(',', '|', $custom_category)); $custom_from = intval($custom_from); $custom_limit = intval($custom_limit); $thisdate = date("Y-m-d H:i:s", time() + $config['date_adjust'] * 60); if ($config['no_date'] and !$config['news_future']) { $where_date = " AND date < '" . $thisdate . "'"; } else { $where_date = ""; } $tpl = new dle_template(); $tpl->dir = TEMPLATE_DIR; if ($custom_cache == "yes") { $config['allow_cache'] = "yes"; } else { $config['allow_cache'] = false; } if ($is_logged and ($user_group[$member_id['user_group']]['allow_edit'] and !$user_group[$member_id['user_group']]['allow_all_edit'])) { $config['allow_cache'] = false; } $custom_cache_id = "custom_cat_" . $custom_category . "template_" . $custom_template . "from_" . $custom_from . "limit_" . $custom_limit; $content = dle_cache("news", $custom_cache_id, true); if ($content) { return $content; } else { $allow_list = explode(',', $user_group[$member_id['user_group']]['allow_cats']); if ($allow_list[0] != "all") { if ($config['allow_multi_category']) { $stop_list = "category regexp '[[:<:]](" . implode('|', $allow_list) . ")[[:>:]]' AND "; } else { $stop_list = "category IN ('" . implode("','", $allow_list) . "') AND "; } } else { $stop_list = ""; } if ($user_group[$member_id['user_group']]['allow_short']) { $stop_list = ""; } if ($cat_info[$custom_category]['news_sort'] != "") { $news_sort = $cat_info[$custom_category]['news_sort']; } else { $news_sort = $config['news_sort']; } if ($cat_info[$custom_category]['news_msort'] != "") { $news_msort = $cat_info[$custom_category]['news_msort']; } else { $news_msort = $config['news_msort']; } if ($config['allow_multi_category']) { $where_category = "category regexp '[[:<:]](" . $custom_category . ")[[:>:]]'"; } else { $custom_category = str_replace("|", "','", $custom_category); $where_category = "category IN ('" . $custom_category . "')"; } if ($config['allow_fixed']) { $fixed = "fixed desc, "; } else { $fixed = ""; } $sql_select = "SELECT p.id, p.autor, p.date, p.short_story, SUBSTRING(p.full_story, 1, 15) as full_story, p.xfields, p.title, p.category, p.alt_name, p.comm_num, p.allow_comm, p.fixed, p.tags, e.news_read, e.allow_rate, e.rating, e.vote_num, e.votes, e.view_edit, e.editdate, e.editor, e.reason FROM " . PREFIX . "_post p LEFT JOIN " . PREFIX . "_post_extras e ON (p.id=e.news_id) WHERE " . $stop_list . $where_category . " AND approve=1" . $where_date . " ORDER BY " . $fixed . $news_sort . " " . $news_msort . " LIMIT " . $custom_from . "," . $custom_limit; include ENGINE_DIR . '/modules/show.custom.php'; if ($config['files_allow'] == "yes") { if (strpos($tpl->result['content'], "[attachment=") !== false) { $tpl->result['content'] = show_attach($tpl->result['content'], $attachments); } } create_cache("news", $tpl->result['content'], $custom_cache_id, true); } return $tpl->result['content']; }
function build_comments($template, $area, $allow_cache = false) { global $config, $tpl, $is_logged, $member_id, $user_group, $lang, $dle_login_hash, $_TIME, $allow_comments_ajax, $ajax_adds; $tpl->load_template($template); $tpl->copy_template = "<div id='comment-id-{id}'>" . $tpl->copy_template . "</div>"; $tpl->template = "<div id='comment-id-{id}'>" . $tpl->template . "</div>"; if (strpos($tpl->copy_template, "[xfvalue_") !== false) { $xfound = true; } else { $xfound = false; } if ($xfound) { $xfields = xfieldsload(true); } if ($area != 'ajax' and $config['comm_msort'] == "DESC") { $tpl->copy_template = "\n<div id=\"dle-ajax-comments\"></div>\n" . $tpl->copy_template; } if ($area != 'ajax') { $tpl->copy_template = "<form method=\"post\" action=\"\" name=\"dlemasscomments\" id=\"dlemasscomments\"><div id=\"dle-comments-list\">\n" . $tpl->copy_template; } if ($area != 'ajax') { $tpl->copy_template = "<a name=\"comment\"></a>" . $tpl->copy_template; } $rows = false; if ($allow_cache) { $rows = dle_cache("comm_" . $allow_cache, $this->query . " LIMIT " . $this->cstart . "," . $this->comments_per_pages); } if ($rows) { $rows = unserialize($rows); $full_cache = true; } else { $rows = $this->db->super_query($this->query . " LIMIT " . $this->cstart . "," . $this->comments_per_pages, true); if ($allow_cache) { create_cache("comm_" . $allow_cache, serialize($rows), $this->query . " LIMIT " . $this->cstart . "," . $this->comments_per_pages); } } if (count($rows)) { foreach ($rows as $row) { $this->intern_count++; $row['date'] = strtotime($row['date']); $row['gast_name'] = stripslashes($row['gast_name']); $row['gast_email'] = stripslashes($row['gast_email']); $row['name'] = stripslashes($row['name']); if (!$row['is_register'] or $row['name'] == '') { if ($row['gast_email'] != "") { $tpl->set('{author}', "<a href=\"mailto:" . htmlspecialchars($row['gast_email'], ENT_QUOTES) . "\">" . $row['gast_name'] . "</a>"); } else { $tpl->set('{author}', $row['gast_name']); } $tpl->set('{login}', $row['gast_name']); $tpl->set('[profile]', ""); $tpl->set('[/profile]', ""); } else { if ($config['allow_alt_url'] == "yes") { $go_page = $config['http_home_url'] . "user/" . urlencode($row['name']) . "/"; $tpl->set('[profile]', "<a href=\"" . $config['http_home_url'] . "user/" . urlencode($row['name']) . "/\">"); } else { $go_page = "{$PHP_SELF}?subaction=userinfo&user="******"<a href=\"{$PHP_SELF}?subaction=userinfo&user="******"\">"); } $go_page = "onclick=\"ShowProfile('" . urlencode($row['name']) . "', '" . htmlspecialchars($go_page) . "', '" . $user_group[$member_id['user_group']]['admin_editusers'] . "'); return false;\""; if ($config['allow_alt_url'] == "yes") { $tpl->set('{author}', "<a {$go_page} href=\"" . $config['http_home_url'] . "user/" . urlencode($row['name']) . "/\">" . $row['name'] . "</a>"); } else { $tpl->set('{author}', "<a {$go_page} href=\"{$PHP_SELF}?subaction=userinfo&user="******"\">" . $row['name'] . "</a>"); } $tpl->set('{login}', $row['name']); $tpl->set('[/profile]', "</a>"); } if ($is_logged and $member_id['user_group'] == '1') { $tpl->set('{ip}', "IP: <a onclick=\"return dropdownmenu(this, event, IPMenu('" . $row['ip'] . "', '" . $lang['ip_info'] . "', '" . $lang['ip_tools'] . "', '" . $lang['ip_ban'] . "'), '190px')\" href=\"https://www.nic.ru/whois/?ip={$row['ip']}\" target=\"_blank\">{$row['ip']}</a>"); } else { $tpl->set('{ip}', ''); } $edit_limit = false; if (!$user_group[$member_id['user_group']]['edit_limit']) { $edit_limit = true; } elseif ($row['date'] + $user_group[$member_id['user_group']]['edit_limit'] * 60 > $_TIME) { $edit_limit = true; } if ($is_logged and $edit_limit and ($member_id['name'] == $row['name'] and $row['is_register'] and $user_group[$member_id['user_group']]['allow_editc'] or $user_group[$member_id['user_group']]['edit_allc'])) { $tpl->set('[com-edit]', "<a onclick=\"ajax_comm_edit('" . $row['id'] . "', '" . $area . "'); return false;\" href=\"" . $config['http_home_url'] . "index.php?do=comments&action=comm_edit&id=" . $row['id'] . "&area=" . $area . "\">"); $tpl->set('[/com-edit]', "</a>"); $allow_comments_ajax = true; } else { $tpl->set_block("'\\[com-edit\\](.*?)\\[/com-edit\\]'si", ""); } if ($is_logged and $edit_limit and ($member_id['name'] == $row['name'] and $row['is_register'] and $user_group[$member_id['user_group']]['allow_delc'] or $member_id['user_group'] == '1' or $user_group[$member_id['user_group']]['del_allc'])) { $tpl->set('[com-del]', "<a href=\"javascript:DeleteComments('{$row['id']}', '{$dle_login_hash}')\">"); $tpl->set('[/com-del]', "</a>"); } else { $tpl->set_block("'\\[com-del\\](.*?)\\[/com-del\\]'si", ""); } if ($user_group[$member_id['user_group']]['del_allc'] and !$user_group[$member_id['user_group']]['edit_limit']) { $tpl->set('{mass-action}', "<input name=\"selected_comments[]\" value=\"{$row['id']}\" type=\"checkbox\" />"); } else { $tpl->set('{mass-action}', ""); } if ($area == 'lastcomments') { $tpl->set_block("'\\[fast\\](.*?)\\[/fast\\]'si", ""); } else { if ($user_group[$member_id['user_group']]['allow_addc'] and $config['allow_comments'] == "yes") { if (!$row['is_register'] or $row['name'] == '') { $row['name'] = $row['gast_name']; } else { $row['name'] = $row['name']; } $tpl->set('[fast]', "<a onmouseover=\"dle_copy_quote('" . str_replace(array(" ", "'"), array(" ", "&#039;"), $row['name']) . "');\" href=\"#\" onclick=\"dle_ins('" . str_replace(array(" ", "'"), array(" ", "&#039;"), $row['name']) . "'); return false;\">"); $tpl->set('[/fast]', "</a>"); } else { $tpl->set_block("'\\[fast\\](.*?)\\[/fast\\]'si", ""); } } $tpl->set('{mail}', $row['email']); $tpl->set('{id}', $row['id']); if (date('Ymd', $row['date']) == date('Ymd', $_TIME)) { $tpl->set('{date}', $lang['time_heute'] . langdate(", H:i", $row['date'])); } elseif (date('Ymd', $row['date']) == date('Ymd', $_TIME - 86400)) { $tpl->set('{date}', $lang['time_gestern'] . langdate(", H:i", $row['date'])); } else { $tpl->set('{date}', langdate($config['timestamp_comment'], $row['date'])); } $tpl->copy_template = preg_replace("#\\{date=(.+?)\\}#ie", "langdate('\\1', '{$row['date']}')", $tpl->copy_template); if ($area == 'lastcomments') { $row['category'] = intval($row['category']); if ($config['allow_alt_url'] == "yes") { if ($config['seo_type'] == 1 or $config['seo_type'] == 2) { if ($row['category'] and $config['seo_type'] == 2) { $full_link = $config['http_home_url'] . get_url($row['category']) . "/" . $row['post_id'] . "-" . $row['alt_name'] . ".html"; } else { $full_link = $config['http_home_url'] . $row['post_id'] . "-" . $row['alt_name'] . ".html"; } } else { $full_link = $config['http_home_url'] . date('Y/m/d/', strtotime($row['newsdate'])) . $row['alt_name'] . ".html"; } } else { $full_link = $config['http_home_url'] . "index.php?newsid=" . $row['post_id']; } $tpl->set('{news_title}', "<a href=\"" . $full_link . "\">" . stripslashes($row['title']) . "</a>"); } else { $tpl->set('{news_title}', ""); } if ($xfound) { $xfieldsdata = xfieldsdataload($row['xfields']); foreach ($xfields as $value) { $preg_safe_name = preg_quote($value[0], "'"); if ($value[5] != 1 or $member_id['user_group'] == 1 or $is_logged and $row['is_register'] and $member_id['name'] == $row['name']) { if (empty($xfieldsdata[$value[0]])) { $tpl->copy_template = preg_replace("'\\[xfgiven_{$preg_safe_name}\\](.*?)\\[/xfgiven_{$preg_safe_name}\\]'is", "", $tpl->copy_template); $tpl->copy_template = str_replace("[xfnotgiven_{$preg_safe_name}]", "", $tpl->copy_template); $tpl->copy_template = str_replace("[/xfnotgiven_{$preg_safe_name}]", "", $tpl->copy_template); } else { $tpl->copy_template = preg_replace("'\\[xfnotgiven_{$preg_safe_name}\\](.*?)\\[/xfnotgiven_{$preg_safe_name}\\]'is", "", $tpl->copy_template); $tpl->copy_template = str_replace("[xfgiven_{$preg_safe_name}]", "", $tpl->copy_template); $tpl->copy_template = str_replace("[/xfgiven_{$preg_safe_name}]", "", $tpl->copy_template); } $tpl->copy_template = preg_replace("'\\[xfvalue_{$preg_safe_name}\\]'i", stripslashes($xfieldsdata[$value[0]]), $tpl->copy_template); } else { $tpl->copy_template = preg_replace("'\\[xfgiven_{$preg_safe_name}\\](.*?)\\[/xfgiven_{$preg_safe_name}\\]'is", "", $tpl->copy_template); $tpl->copy_template = preg_replace("'\\[xfvalue_{$preg_safe_name}\\]'i", "", $tpl->copy_template); $tpl->copy_template = preg_replace("'\\[xfnotgiven_{$preg_safe_name}\\](.*?)\\[/xfnotgiven_{$preg_safe_name}\\]'is", "", $tpl->copy_template); } } } if ($area == 'ajax' and isset($ajax_adds)) { $tpl->set('{comment-id}', "--"); } elseif ($area == 'lastcomments') { $tpl->set('{comment-id}', $this->total_comments - $this->cstart - $this->intern_count + 1); } else { if ($config['comm_msort'] == "ASC") { $tpl->set('{comment-id}', $this->cstart + $this->intern_count); } else { $tpl->set('{comment-id}', $this->total_comments - $this->cstart - $this->intern_count + 1); } } if ($row['foto']) { $tpl->set('{foto}', $config['http_home_url'] . "uploads/fotos/" . $row['foto']); } else { $tpl->set('{foto}', "{THEME}/images/noavatar.png"); } if ($row['is_register'] and $row['fullname']) { $tpl->set('[fullname]', ""); $tpl->set('[/fullname]', ""); $tpl->set('{fullname}', stripslashes($row['fullname'])); $tpl->set_block("'\\[not-fullname\\](.*?)\\[/not-fullname\\]'si", ""); } else { $tpl->set_block("'\\[fullname\\](.*?)\\[/fullname\\]'si", ""); $tpl->set('{fullname}', ""); $tpl->set('[not-fullname]', ""); $tpl->set('[/not-fullname]', ""); } if ($row['is_register'] and $row['icq']) { $tpl->set('[icq]', ""); $tpl->set('[/icq]', ""); $tpl->set('{icq}', stripslashes($row['icq'])); $tpl->set_block("'\\[not-icq\\](.*?)\\[/not-icq\\]'si", ""); } else { $tpl->set_block("'\\[icq\\](.*?)\\[/icq\\]'si", ""); $tpl->set('{icq}', ""); $tpl->set('[not-icq]', ""); $tpl->set('[/not-icq]', ""); } if ($row['is_register'] and $row['land']) { $tpl->set('[land]', ""); $tpl->set('[/land]', ""); $tpl->set('{land}', stripslashes($row['land'])); $tpl->set_block("'\\[not-land\\](.*?)\\[/not-land\\]'si", ""); } else { $tpl->set_block("'\\[land\\](.*?)\\[/land\\]'si", ""); $tpl->set('{land}', ""); $tpl->set('[not-land]', ""); $tpl->set('[/not-land]', ""); } if ($row['comm_num']) { $tpl->set('[comm-num]', ""); $tpl->set('[/comm-num]', ""); $tpl->set('{comm-num}', $row['comm_num']); $tpl->set_block("'\\[not-comm-num\\](.*?)\\[/not-comm-num\\]'si", ""); } else { $tpl->set('{comm-num}', 0); $tpl->set('[not-comm-num]', ""); $tpl->set('[/not-comm-num]', ""); $tpl->set_block("'\\[comm-num\\](.*?)\\[/comm-num\\]'si", ""); } if ($row['news_num']) { $tpl->set('[news-num]', ""); $tpl->set('[/news-num]', ""); $tpl->set('{news-num}', $row['news_num']); $tpl->set_block("'\\[not-news-num\\](.*?)\\[/not-news-num\\]'si", ""); } else { $tpl->set('{news-num}', 0); $tpl->set('[not-news-num]', ""); $tpl->set('[/not-news-num]', ""); $tpl->set_block("'\\[news-num\\](.*?)\\[/news-num\\]'si", ""); } if ($row['is_register'] and $row['reg_date']) { $tpl->set('{registration}', langdate("j.m.Y", $row['reg_date'])); } else { $tpl->set('{registration}', '--'); } if ($row['is_register'] and $row['lastdate']) { $tpl->set('{lastdate}', langdate("j.m.Y", $row['lastdate'])); if ($row['lastdate'] + 1200 > $_TIME or $row['user_id'] and $row['user_id'] == $member_id['user_id']) { $tpl->set('[online]', ""); $tpl->set('[/online]', ""); $tpl->set_block("'\\[offline\\](.*?)\\[/offline\\]'si", ""); } else { $tpl->set('[offline]', ""); $tpl->set('[/offline]', ""); $tpl->set_block("'\\[online\\](.*?)\\[/online\\]'si", ""); } } else { $tpl->set('{lastdate}', '--'); $tpl->set_block("'\\[offline\\](.*?)\\[/offline\\]'si", ""); $tpl->set_block("'\\[online\\](.*?)\\[/online\\]'si", ""); } if ($row['is_register'] and $row['signature'] and $user_group[$row['user_group']]['allow_signature']) { $tpl->set_block("'\\[signature\\](.*?)\\[/signature\\]'si", "\\1"); $tpl->set('{signature}', stripslashes($row['signature'])); } else { $tpl->set_block("'\\[signature\\](.*?)\\[/signature\\]'si", ""); } if ($is_logged) { $tpl->set('[complaint]', "<a href=\"javascript:AddComplaint('" . $row['id'] . "', 'comments')\">"); $tpl->set('[/complaint]', "</a>"); } else { $tpl->set_block("'\\[complaint\\](.*?)\\[/complaint\\]'si", ""); } if (!$row['user_group']) { $row['user_group'] = 5; } if ($user_group[$row['user_group']]['icon']) { $tpl->set('{group-icon}', "<img src=\"" . $user_group[$row['user_group']]['icon'] . "\" alt=\"\" />"); } else { $tpl->set('{group-icon}', ""); } $tpl->set('{group-name}', $user_group[$row['user_group']]['group_prefix'] . $user_group[$row['user_group']]['group_name'] . $user_group[$row['user_group']]['group_suffix']); if (count($this->extras_rules)) { foreach ($this->extras_rules as $rules) { if ($rules[0] == 'set') { $tpl->set($rules[1], $rules[2]); } else { $tpl->set_block($rules[1], $rules[2]); } } } if ($user_group[$member_id['user_group']]['allow_hide']) { $row['text'] = str_ireplace("[hide]", "", str_ireplace("[/hide]", "", $row['text'])); } else { $row['text'] = preg_replace("#\\[hide\\](.+?)\\[/hide\\]#is", "<div class=\"quote\">" . $lang['news_regus'] . "</div>", $row['text']); } $tpl->set('{comment}', "<div id='comm-id-" . $row['id'] . "'>" . stripslashes($row['text']) . "</div>"); $tpl->compile('comments'); } } else { $tpl->result['comments'] = ""; if ($area != 'ajax' and $config['comm_msort'] == "DESC") { $tpl->result['comments'] = "\n<div id=\"dle-ajax-comments\"></div>\n"; } if ($area != 'ajax') { $tpl->result['comments'] = "<form method=\"post\" action=\"\" name=\"dlemasscomments\" id=\"dlemasscomments\"><div id=\"dle-comments-list\">\n" . $tpl->result['comments']; } if ($area != 'ajax') { $tpl->result['comments'] = "<a name=\"comment\"></a>" . $tpl->result['comments']; } } $tpl->clear(); if ($area != 'ajax' and $config['comm_msort'] == "ASC") { $tpl->result['comments'] .= "\n<div id=\"dle-ajax-comments\"></div>\n"; } if ($area != 'ajax' and $user_group[$member_id['user_group']]['del_allc'] and !$user_group[$member_id['user_group']]['edit_limit']) { $tpl->result['comments'] .= "\n<div class=\"mass_comments_action\">{$lang['mass_comments']} <select name=\"mass_action\"><option value=\"\">{$lang['edit_selact']}</option><option value=\"mass_combine\">{$lang['edit_selcomb']}</option><option value=\"mass_delete\">{$lang['edit_seldel']}</option></select> <input type=\"submit\" class=\"bbcodes\" value=\"{$lang['b_start']}\" /></div>\n<input type=\"hidden\" name=\"do\" value=\"comments\" /><input type=\"hidden\" name=\"dle_allow_hash\" value=\"{$dle_login_hash}\" /><input type=\"hidden\" name=\"area\" value=\"{$area}\" />"; } if ($area != 'ajax') { $tpl->result['comments'] .= "</div></form>\n"; } if (strpos($tpl->result['content'], "<!--dlecomments-->") !== false) { $tpl->result['content'] = str_replace("<!--dlecomments-->", $tpl->result['comments'], $tpl->result['content']); } else { $tpl->result['content'] .= $tpl->result['comments']; } }
public function lastTopics(dle_template $tpl) { if (!$this->config['allow_forum_block'] || !$this->config['allow_module']) { return ''; } if ((int) $this->config['block_cache_time']) { $cache = dle_cache('xen_block_cache_time'); if ($cache) { $cache = unserialize($cache); if (!empty($cache['time']) && $cache['time'] > time() - $this->config['block_cache_time']) { return $cache['data']; } } } $forum_id = ""; if ($this->config['bad_forum_for_block'] && !$this->config['good_forum_for_block']) { $forum_bad = explode(",", $this->config['bad_forum_for_block']); $forum_id = " AND t.node_id NOT IN('" . implode("','", $forum_bad) . "')"; } elseif (!$this->config['bad_forum_for_block'] && $this->config['good_forum_for_block']) { $forum_good = explode(",", $this->config['good_forum_for_block']); $forum_id = " AND t.node_id IN('" . implode("','", $forum_good) . "')"; } if (!(int) $this->config['count_post']) { $this->config['count_post'] = 10; } $sth = $this->db->query('SELECT t.title, t.thread_id, t.last_post_date, t.reply_count, t.view_count, f.title as forum_title, t.node_id, t.last_post_username, t.last_post_user_id FROM ' . F_PREFIX . 'thread AS t LEFT JOIN ' . F_PREFIX . 'node AS f ON f.node_id = t.node_id WHERE discussion_state="visible"' . $forum_id . ' ORDER BY t.last_post_date DESC LIMIT 0, ' . intval($this->config['count_post'])); $forum_url = rtrim($this->options['boardUrl'], "/") . "/"; if (!$this->config['block_rewrite_url']) { $forum_url .= "index.php?"; } $tpl->load_template('block_forum_posts.tpl'); preg_match("'\\[row\\](.*?)\\[/row\\]'si", $tpl->copy_template, $matches); $block_content = ''; while ($row = $sth->fetch(PDO::FETCH_ASSOC)) { $short_name = $title = $this->_convert_encoding($row["title"], true); $row['last_post_username'] = $this->_convert_encoding($row['last_post_username'], true); if (!empty($this->config['length_name']) && dle_strlen($title, $this->DLEConfig['charset']) > $this->config['length_name']) { $short_name = dle_substr($title, 0, $this->config['length_name'], $this->DLEConfig['charset']) . " ..."; } switch (date("d.m.Y", $row["last_post_date"])) { case date("d.m.Y"): $date = date($this->lang['today_in'] . "H:i", $row["last_post_date"]); break; case date("d.m.Y", time() - 86400): $date = date($this->lang['yesterday_in'] . "H:i", $row["last_post_date"]); break; default: $date = date("d.m.Y H:i", $row["last_post_date"]); } $replace = array('{user}' => $this->_convert_encoding($row['last_post_username'], true), '{user_url}' => $forum_url . "members/" . $this->getTitleForUrl($row['last_post_username']) . "." . $row['last_post_user_id'] . "/", '{reply_count}' => $row["reply_count"], '{view_count}' => $row["view_count"], '{full_name}' => $title, '{post_url}' => $forum_url . "threads/" . $this->getTitleForUrl($row['title']) . "." . $row["thread_id"] . "/", '{shot_name_post}' => $short_name, '{forum_name}' => $this->_convert_encoding($row['forum_title'], true), '{forum_url}' => $forum_url . "forums/" . $this->getTitleForUrl($row['forum_title']) . "." . $row["node_id"] . "/", '{date}' => $date); $block_content .= strtr($matches[1], $replace); } $tpl->set_block("'\\[row\\](.*?)\\[/row\\]'si", $block_content); $tpl->compile('block_forum_posts'); $tpl->clear(); if ((int) $this->config['block_cache_time']) { create_cache('xen_block_cache_time', serialize(array('time' => time(), 'data' => $tpl->result['block_forum_posts']))); } return $tpl->result['block_forum_posts']; }
} foreach ($tags as $tag => $value) { $list[$tag]['tag'] = $tag; $list[$tag]['size'] = $sizes[sprintf("%d", ($value - $min) / $range * 4)]; $list[$tag]['count'] = $value; } usort($list, "compare_tags"); $tags = array(); foreach ($list as $value) { if (trim($value['tag']) != "") { if ($config['allow_alt_url'] == "yes") { $tags[] = "<a href=\"" . $config['http_home_url'] . "tags/" . urlencode($value['tag']) . "/\" class=\"{$value['size']}\" title=\"" . $lang['tags_count'] . " " . $value['count'] . "\">" . $value['tag'] . "</a>"; } else { $tags[] = "<a href=\"{$PHP_SELF}?do=tags&tag=" . urlencode($value['tag']) . "\" class=\"{$value['size']}\" title=\"" . $lang['tags_count'] . " " . $value['count'] . "\">" . $value['tag'] . "</a>"; } } } $tags = implode(", ", $tags); if ($limit) { $tpl->set($matches[0], $tags); } else { $tpl->set('{tags}', $tags); } $tpl->compile('content'); $tpl->clear(); create_cache("alltagscloud", $tpl->result['content'], $config['skin']); } } if ($is_change) { $config['allow_cache'] = false; }
$tplb->set('[edit]', "<a onclick=\"return dropdownmenu(this, event, MenuNewsBuild('" . $rowb['id'] . "', 'short'), '170px')\" href=\"#\">"); $tplb->set('[/edit]', "</a>"); $allow_comments_ajax = true; } else { $tplb->set_block("'\\[edit\\](.*?)\\[/edit\\]'si", ""); } /* конец кучки тегов */ $tplb->compile('blockpro'); } $blockpro = $tplb->result['blockpro']; } else { $blockpro = 'Извини дружище, но без шаблона я не умею работать, советую в строке подключения указать: <strong style="color: red;">&template=blockpro</strong> <br />Только не забудь почистить кеш DLE!'; } unset($tplb); $db->free(); create_cache("news_bp_" . $block_id, $blockpro, $config['skin']); } if (!$relatedpro && !$blockpro) { $blockpro = '<div class="blockpro">Где то косяк! Проверь правильность строки подключения. Возможно просто нет новостей за последние 30 дней.</div>'; } if ($relatedpro) { if ($blockpro) { $tpl->set('[related-news]', ""); $tpl->set('[/related-news]', ""); } else { $tpl->set_block("'\\[related-news\\](.*?)\\[/related-news\\]'si", ""); } $tpl->set('{related-news}', $blockpro); } if (!$relatedpro) { echo $blockpro;
} else { create_cache($mem_name, $mess); } } echo $mess; #****** Удаление ******# } elseif ($_POST['edit'] == 3 && $is_logged) { $moder_usr = in_array($member_id['user_group'], explode(",", $memchat_conf['moder_grp'])); if ($moder_usr) { $mid = intval($_POST['mid']); $db->query("DELETE FROM " . PREFIX . "_mchat WHERE id='{$mid}'"); #*** Тип кеширования if ($memchat_conf['cache'] == "mem") { $memcache->set($mem_name, ""); } else { create_cache($mem_name, ""); } } #****** Вывод модуля ******# } else { #*** Тип кеширования if ($memchat_conf['cache'] == "mem") { $mess = $memcache->get($mem_name); } else { $mess = dle_cache($mem_name); } if ($is_logged) { if (time() - $member_id['reg_date'] < $memchat_conf['time_readonly'] * 86400) { $send_js = ""; $send_fr = "<div id=\"mchat-style\" style=\"padding: 1px; text-align: center;\">Писать в чате можно по истечению {$memchat_conf['time_readonly']} дней после даты регистрации.</div>"; } elseif ($memchat_conf['restricted'] == "yes" && $member_id['restricted'] > 0) {
function saveNav($do_action) { global $db; $title = trim(HtmlReplace($_GET["title"])); $keywords = HtmlReplace($_GET["keywords"]); $sort_id = HtmlReplace($_GET["sort_id"]); $array = array('title' => $title, 'keywords' => $keywords, 'sort_id' => $sort_id); if ($do_action == "savemodify") { $nav_id = intval($_GET["nav_id"]); $db->update("ve123_nav", $array, "nav_id='" . $nav_id . "'"); } else { if (!empty($title)) { $db->insert("ve123_nav", $array); } } create_cache(); header("location:" . $_SERVER["HTTP_REFERER"]); }
public function runBlockPro() { // Защита от фашистов )))) (НУЖНА ЛИ? ) $this->config['post_id'] = @$this->db->safesql(strip_tags(str_replace('/', '', $this->config['post_id']))); $this->config['not_post_id'] = @$this->db->safesql(strip_tags(str_replace('/', '', $this->config['not_post_id']))); $this->config['author'] = @$this->db->safesql(strip_tags(str_replace('/', '', $this->config['author']))); $this->config['not_author'] = @$this->db->safesql(strip_tags(str_replace('/', '', $this->config['not_author']))); $this->config['xfilter'] = @$this->db->safesql(strip_tags(str_replace('/', '', $this->config['xfilter']))); $this->config['not_xfilter'] = @$this->db->safesql(strip_tags(str_replace('/', '', $this->config['not_xfilter']))); // Определяем сегодняшнюю дату $tooday = date( "Y-m-d H:i:s", (time() + $this->dle_config['date_adjust'] * 60) ); // Проверка версии DLE if ($this->dle_config['version_id'] >= 9.6) $newVersion = true; // Пробуем подгрузить содержимое модуля из кэша $output = false; // Если установлено время жизи кеша - убираем префикс news_ чтобы кеш не чистился автоматом // и задаём настройки времени жизни кеша в секундах (надо доработать, где то косяк) if ($this->config['cache_live']) { $this->config['prefix'] = ''; $filedate = ENGINE_DIR.'/cache/'.$this->config['prefix'].'bp_'.md5(implode('_', $this->config)).'.tmp'; if(@file_exists($filedate)) $cache_time=time()-@filemtime ($filedate); else $cache_time = $this->config['cache_live']*60; if ($cache_time>=$this->config['cache_live']*60) $clear_time_cache = 1; } // Если nocache не установлен - добавляем префикс (по умолчанию news_) к файлу кеша. if( !$this->config['nocache']) { $output = dle_cache($this->config['prefix'].'bp_'.md5(implode('_', $this->config))); } if ($clear_time_cache) { $output = false; } // Если значение кэша для данной конфигурации получено, выводим содержимое кэша if($output !== false) { $this->showOutput($output); return; } // Если в кэше ничего не найдено, генерируем модуль заново $wheres = array(); // Условие для отображения только постов, прошедших модерацию $wheres[] = 'approve'; // Разбираемся с временными рамками отбора новостей, если кол-во дней указано - ограничиваем выборку, если нет - выводим без ограничения даты // if ($this->config['day']) // { // $interval = $this->config['day']; // $dateStart = 'AND date >= "'.$tooday.'" - INTERVAL "'.$interval.'" DAY'; // } // if (!$this->config['day']) // { // $dateStart = ''; // } // Фильтрация КАТЕГОРИЙ по их ID if ($this->config['cat_id'] == 'this') $this->config['cat_id'] = $this->category_id; if ($this->config['not_cat_id'] == 'this') $this->config['not_cat_id'] = $this->category_id; if ($this->config['cat_id'] || $this->config['not_cat_id']) { $ignore = ($this->config['not_cat_id']) ? 'NOT ' : ''; $catArr = ($this->config['not_cat_id']) ? $this->config['not_cat_id'] : $this->config['cat_id']; $wheres[] = $ignore.'category regexp "[[:<:]]('.str_replace(',', '|', $catArr).')[[:>:]]"'; } // Фильтрация НОВОСТЕЙ по их ID if ($this->config['post_id'] == 'this') $this->config['post_id'] = $_REQUEST["newsid"]; if ($this->config['not_post_id'] == 'this') $this->config['not_post_id'] = $_REQUEST["newsid"]; if ($this->config['post_id'] || $this->config['not_post_id']) { $ignorePosts = ($this->config['not_post_id']) ? 'NOT ' : ''; $postsArr = ($this->config['not_post_id']) ? $this->config['not_post_id'] : $this->config['post_id']; $wheres[] = $ignorePosts.'id regexp "[[:<:]]('.str_replace(',', '|', $postsArr).')[[:>:]]"'; } // Фильтрация новостей по АВТОРАМ if ($this->config['author'] == 'this') $this->config['author'] = $_REQUEST["user"]; if ($this->config['not_author'] == 'this') $this->config['not_author'] = $_REQUEST["user"]; if ($this->config['author'] || $this->config['not_author']) { $ignoreAuthors = ($this->config['not_author']) ? 'NOT ' : ''; $authorsArr = ($this->config['not_author']) ? $this->config['not_author'] : $this->config['author']; $wheres[] = $ignoreAuthors.'autor regexp "[[:<:]]('.str_replace(',', '|', $authorsArr).')[[:>:]]"'; } // Фильтрация новостей по ДОПОЛНИТЕЛЬНЫМ ПОЛЯМ if ($this->config['xfilter'] || $this->config['not_xfilter']) { $ignoreXfilters = ($this->config['not_xfilter']) ? 'NOT ' : ''; $xfiltersArr = ($this->config['not_xfilter']) ? $this->config['not_xfilter'] : $this->config['xfilter']; $wheres[] = $ignoreXfilters.'xfields regexp "[[:<:]]('.str_replace(',', '|', $xfiltersArr).')[[:>:]]"'; } // Разбираемся с временными рамками отбора новостей, если кол-во дней указано - ограничиваем выборку, если нет - выводим без ограничения даты if(intval($this->config['day'])) $wheres[] = 'date >= "'.$tooday.'" - INTERVAL ' . intval($this->config['day']) . ' DAY'; // Условие для отображения только тех постов, дата публикации которых уже наступила $wheres[] = 'date < "'.$tooday.'"'; // Условие для фильтрации текущего id // $wheres[] = 'id != '.$this->config['postId']; // Складываем условия $where = implode(' AND ', $wheres); // Направление сортировки по убыванию или возрастанию $ordering = $this->config['order'] == 'new'?'DESC':'ASC'; // Сортировка новостей switch ($this->config['sort']) { case 'date': // Дата $sort = 'date '; break; case 'rating': // Рейтинг $sort = 'rating '; break; case 'comms': // Комментарии $sort = 'comm_num '; break; case 'views': // Просмотры $sort = 'news_read '; break; case 'random': // Случайные $sort = 'RAND() '; break; default: // Топ как в DLE (сортировка по умолчанию) $sort = 'rating '.$ordering.', comm_num '.$ordering.', news_read '; break; } // Формирование запроса в зависимости от версии движка if ($newVersion) { // 9.6 и выше $selectRows = 'p.id, p.autor, p.date, p.short_story, p.full_story, p.xfields, p.title, p.category, p.alt_name, p.allow_comm, p.comm_num, e.news_read, e.allow_rate, e.rating, e.vote_num, e.votes'; } else { // старые версии $selectRows = '*'; //пока старые версии курят в сторонке } /** * Service function - take params from table * @param $table string - название таблицы * @param $fields string - необходимые поля через запятйю или * для всех * @param $where string - условие выборки * @param $multirow bool - забирать ли один ряд или несколько * @param $start int - начальное значение выборки * @param $limit int - количество записей для выборки, 0 - выбрать все * @param $sort string - поле, по которому осуществляется сортировка * @param $sort_order - направление сортировки * @return array с данными или false если mysql вернуль 0 рядов */ //$news = $this->load_table (PREFIX."_post", $fields = "*", $where = '1', $multirow = false, $start = 0, $limit = 10, $sort = '', $sort_order = 'desc'); $news = $this->load_table (PREFIX . '_post p LEFT JOIN ' . PREFIX . '_post_extras e ON (p.id=e.news_id)', $selectRows, $where, true, $this->config['start_from'], $this->config['limit'], $sort, $ordering); if(empty($news)) $news = array(); // Задаём переменную, в котоую будем всё складывать $output = ''; // Если в выборке нет новостей - сообщаем об этом if (empty($news)) { $output .= '<span style="color: #f00">По заданным критериям материалов нет, попробуйте изменить параметры строки подключения</span>'; return; } // Пробегаем по массиву с новостями и формируем список foreach ($news as $newsItem) { $xfields = xfieldsload(); $newsItem['date'] = strtotime($newsItem['date']); // Формируем ссылки на категории и иконки категорий $my_cat = array(); $my_cat_icon = array(); $my_cat_link = array(); $cat_list = explode(',', $newsItem['category']); foreach($cat_list as $element) { if(isset($this->cat_info[$element])) { $my_cat[] = $this->cat_info[$element]['name']; if ($this->cat_info[$element]['icon']) $my_cat_icon[] = '<img class="bp-cat-icon" src="'.$this->cat_info[$element]['icon'].'" alt="'.$this->cat_info[$element]['name'].'" />'; else $my_cat_icon[] = '<img class="bp-cat-icon" src="{THEME}/blockpro/'.$this->config['noicon'].'" alt="'.$this->cat_info[$element]['name'].'" />'; if( $this->dle_config['allow_alt_url'] == 'yes' ) $my_cat_link[] = '<a href="'.$this->dle_config['http_home_url'].get_url($element).'/">'.$this->cat_info[$element]['name'].'</a>'; else $my_cat_link[] = '<a href="'.$PHP_SELF.'?do=cat&category='.$this->cat_info[$element]['alt_name'].'">'.$this->cat_info[$element]['name'].'</a>'; } } $categoryUrl = ($newsItem['category']) ? $this->dle_config['http_home_url'] . get_url(intval($newsItem['category'])) . '/' : '/' ; // Ссылка на профиль юзера if( $this->dle_config['allow_alt_url'] == 'yes' ) { $go_page = $config['http_home_url'].'user/'.urlencode($newsItem['autor']).'/'; } else { $go_page = $PHP_SELF.'?subaction=userinfo&user='******'autor']); } // Выводим картинку switch($this->config['image']) { // Изображение из дополнительного поля case 'short_story': $imgArray = $this->getImage($newsItem['short_story'], $newsItem['date']); break; // Первое изображение из полного описания case 'full_story': $imgArray = $this->getImage($newsItem['full_story'], $newsItem['date']); break; // По умолчанию - первое изображение из краткой новости default: $xfieldsdata = xfieldsdataload($newsItem['xfields'], $newsItem['date']); if(!empty($xfieldsdata) && !empty($xfieldsdata[$this->config['image']])) { $imgArray = getImage($xfieldsdata[$this->config['image']]); } break; } // Определяем переменные, выводящие картинку $image = ($imgArray['imgResized']) ? $imgArray['imgResized'] : '{THEME}/blockpro/'.$this->config['noimage']; if (!$imgArray['imgResized']) { $imageFull = '{THEME}/blockpro/'.$this->config['noimage_full']; } else { $imageFull = $imgArray['imgOriginal']; } // Формируем вид даты новости для вывода в шаблон if(date('Ymd', $newsItem['date']) == date('Ymd')) { $showDate = $this->dle_lang['time_heute'].langdate(', H:i', $newsItem['date']); } elseif(date('Ymd', $newsItem['date']) == date('Ymd') - 1) { $showDate = $this->dle_lang['time_gestern'].langdate(', H:i', $newsItem['date']); } else { $showDate = langdate($this->dle_config['timestamp_active'], $newsItem['date']); } /** * Код, формирующий вывод шаблона новости */ $tpl->copy_template = preg_replace("#\{date=(.+?)\}#ie", "langdate('\\1', '{$newsItem['date']}')", $tpl->copy_template ); $output .= $this->applyTemplate($this->config['template'], array( '{title}' => $newsItem['title'], '{full-link}' => $this->getPostUrl($newsItem), '{image}' => $image, '{image_full}' => $imageFull, '{short-story}' => $this->textLimit($newsItem['short_story'], $this->config['text_limit']), '{full-story}' => $this->textLimit($newsItem['full_story'], $this->config['text_limit']), '{link-category}' => implode(', ', $my_cat_link), '{category}' => implode(', ', $my_cat), '{category-icon}' => implode('', $my_cat_icon), '{category-url}' => $categoryUrl, '{news-id}' => $newsItem['id'], '{author}' => "<a onclick=\"ShowProfile('" . urlencode( $newsItem['autor'] ) . "', '" . $go_page . "', '" . $user_group[$member_id['user_group']]['admin_editusers'] . "'); return false;\" href=\"" . $go_page . "\">" . $newsItem['autor'] . "</a>", '{login}' => $newsItem['autor'], '[profile]' => '<a href="'.$go_page.'">', '[/profile]' => '</a>', '[com-link]' => $newsItem['allow_comm']?'<a href="'.$this->getPostUrl($newsItem).'#comment">':'', '[/com-link]' => $newsItem['allow_comm']?'</a>':'', '{comments-num}' => $newsItem['allow_comm']?$newsItem['comm_num']:'', '{views}' => $newsItem['news_read'], '{date}' => $showDate, '{rating}' => $newsItem['allow_rate']?ShowRating( $newsItem['id'], $newsItem['rating'], $newsItem['vote_num'], 0 ):'', '{vote-num}' => $newsItem['allow_rate']?$newsItem['vote_num']:'', ), array( // "'\[show_name\\](.*?)\[/show_name\]'si" => !empty($name)?"\\1":'', // "'\[show_description\\](.*?)\[/show_description\]'si" => !empty($description)?"\\1":'', "'\[comments\\](.*?)\[/comments\]'si" => $newsItem['comm_num']!=='0'?'\\1':'', "'\[not-comments\\](.*?)\[/not-comments\]'si" => $newsItem['comm_num']=='0'?'\\1':'', "'\[rating\\](.*?)\[/rating\]'si" => $newsItem['allow_rate']?'\\1':'', "'\[allow-comm\\](.*?)\[/allow-comm\]'si" => $newsItem['allow_comm']?'\\1':'', "'\[not-allow-comm\\](.*?)\[/not-allow-comm\]'si" => !$newsItem['allow_comm']?'\\1':'', // не уверен, но можно попробовать //"'{title limit=\"(.*?)\"}'esi" => 'dle_substr(striptags($newsItem[\'title\']),0,\\1,$this->config[\'charset\'])', ) ); } // Cохраняем в кэш по данной конфигурации если nocache false if(!$this->config['nocache']) { create_cache($this->config['prefix'].'bp_'.md5(implode('_', $this->config)), $output); } // Выводим содержимое модуля $this->showOutput($output); }
function custom_print($matches = array()) { global $db, $is_logged, $member_id, $xf_inited, $cat_info, $config, $user_group, $category_id, $_TIME, $lang, $smartphone_detected, $dle_module, $allow_comments_ajax, $PHP_SELF, $news_date; if (!count($matches)) { return ""; } $param_str = trim($matches[1]); $aviable = array(); $thisdate = date("Y-m-d H:i:s", $_TIME); $sql_select = "SELECT p.id, p.autor, p.date, p.short_story, CHAR_LENGTH(p.full_story) as full_story, p.xfields, p.title, p.category, p.alt_name, p.comm_num, p.allow_comm, p.fixed, p.tags, e.news_read, e.allow_rate, e.rating, e.vote_num, e.votes, e.view_edit, e.editdate, e.editor, e.reason FROM " . PREFIX . "_post p LEFT JOIN " . PREFIX . "_post_extras e ON (p.id=e.news_id)"; $where = array(); $allow_cache = $config['allow_cache']; if (preg_match("#aviable=['\"](.+?)['\"]#i", $param_str, $match)) { $aviable = explode('|', $match[1]); } else { $aviable[] = "global"; } $do = $dle_module ? $dle_module : "main"; if (!in_array($do, $aviable) and $aviable[0] != "global") { return ""; } if (preg_match("#id=['\"](.+?)['\"]#i", $param_str, $match)) { $temp_array = array(); $where_id = array(); $match[1] = explode(',', trim($match[1])); foreach ($match[1] as $value) { if (count(explode('-', $value)) == 2) { $value = explode('-', $value); $where_id[] = "id >= '" . intval($value[0]) . "' AND id <= '" . intval($value[1]) . "'"; } else { $temp_array[] = intval($value); } } if (count($temp_array)) { $where_id[] = "id IN ('" . implode("','", $temp_array) . "')"; } if (count($where_id)) { $custom_id = implode(' OR ', $where_id); $where[] = $custom_id; } } $allow_list = explode(',', $user_group[$member_id['user_group']]['allow_cats']); if ($allow_list[0] != "all" and !$user_group[$member_id['user_group']]['allow_short']) { if ($config['allow_multi_category']) { $where[] = "category regexp '[[:<:]](" . implode('|', $allow_list) . ")[[:>:]]'"; } else { $where[] = "category IN ('" . implode("','", $allow_list) . "')"; } } if (preg_match("#category=['\"](.+?)['\"]#i", $param_str, $match)) { $temp_array = array(); $match[1] = explode(',', $match[1]); foreach ($match[1] as $value) { if (count(explode('-', $value)) == 2) { $temp_array[] = get_mass_cats($value); } else { $temp_array[] = intval($value); } } $temp_array = implode(',', $temp_array); $custom_category = $db->safesql(trim(str_replace(',', '|', $temp_array))); if ($config['allow_multi_category']) { $where[] = "category regexp '[[:<:]](" . $custom_category . ")[[:>:]]'"; } else { $custom_category = str_replace("|", "','", $custom_category); $where[] = "category IN ('" . $custom_category . "')"; } } if (preg_match("#days=['\"](.+?)['\"]#i", $param_str, $match)) { $days = intval(trim($match[1])); $where[] = "p.date >= '{$thisdate}' - INTERVAL {$days} DAY AND p.date < '{$thisdate}'"; } else { $days = 0; } if (preg_match("#author=['\"](.+?)['\"]#i", $param_str, $match)) { $author = $db->safesql(trim($match[1])); $where[] = "p.autor like '{$author}'"; } else { $author = ""; } $where[] = "approve=1"; if ($config['no_date'] and !$config['news_future'] and !$days) { $where[] = "date < '" . $thisdate . "'"; } if (preg_match("#template=['\"](.+?)['\"]#i", $param_str, $match)) { $custom_template = trim($match[1]); } else { $custom_template = "shortstory"; } if (preg_match("#from=['\"](.+?)['\"]#i", $param_str, $match)) { $custom_from = intval($match[1]); } else { $custom_from = 0; } if (preg_match("#limit=['\"](.+?)['\"]#i", $param_str, $match)) { $custom_limit = intval($match[1]); } else { $custom_limit = $config['news_number']; } if (preg_match("#cache=['\"](.+?)['\"]#i", $param_str, $match)) { if ($match[1] == "yes") { $config['allow_cache'] = "yes"; } else { $config['allow_cache'] = false; } } if (preg_match("#fixed=['\"](.+?)['\"]#i", $param_str, $match)) { $fixed = ""; $fixedcache = "fixed yes"; if ($match[1] == "yes") { $fixed = "fixed DESC, "; } elseif ($match[1] == "only") { $where[] = "fixed='1'"; $fixedcache = "fixed only"; } } else { $fixed = ""; $fixedcache = ""; } if ($is_logged and ($user_group[$member_id['user_group']]['allow_edit'] and !$user_group[$member_id['user_group']]['allow_all_edit'])) { $config['allow_cache'] = false; } if ($cat_info[$custom_category]['news_sort'] != "") { $news_sort = $cat_info[$custom_category]['news_sort']; } else { $news_sort = $config['news_sort']; } if ($cat_info[$custom_category]['news_msort'] != "") { $news_msort = $cat_info[$custom_category]['news_msort']; } else { $news_msort = $config['news_msort']; } if (preg_match("#order=['\"](.+?)['\"]#i", $param_str, $match)) { $allowed_sort = array('date' => 'date', 'rating' => 'rating', 'reads' => 'news_read', 'comments' => 'comm_num', 'title' => 'title', 'rand' => 'RAND()'); if ($allowed_sort[$match[1]]) { $news_sort = $allowed_sort[$match[1]]; } if ($match[1] == "rand") { $fixed = ""; $news_msort = ""; } else { $news_msort = "DESC"; } if ($match[1] == "title") { $news_msort = "ASC"; } } $sql_select .= " WHERE " . implode(' AND ', $where) . " ORDER BY " . $fixed . $news_sort . " " . $news_msort . " LIMIT " . $custom_from . "," . $custom_limit; $custom_cache_id = $custom_id . $custom_category . $user_group[$member_id['user_group']]['allow_cats'] . $custom_from . $custom_limit . $news_sort . $news_msort . $custom_template . $days . $author . $fixedcache; $content = dle_cache("news", $custom_cache_id, true); if ($content !== false) { $config['allow_cache'] = $allow_cache; return $content; } else { $tpl = new dle_template(); $tpl->dir = TEMPLATE_DIR; $tpl->load_template($custom_template . '.tpl'); $sql_result = $db->query($sql_select); include ENGINE_DIR . '/modules/show.custom.php'; if ($config['files_allow'] == "yes") { if (strpos($tpl->result['content'], "[attachment=") !== false) { $tpl->result['content'] = show_attach($tpl->result['content'], $attachments); } } create_cache("news", $tpl->result['content'], $custom_cache_id, true); $config['allow_cache'] = $allow_cache; return $tpl->result['content']; } }
$action = $_GET["action"]; switch ($action) { case "saveform": saveform(); break; case "add": addform($action); break; case "modify": addform($action); break; case "del": $db->query("delete from ve123_categories where cate_id='" . intval($_GET["cate_id"]) . "'"); break; case "create_cache": create_cache(); break; } ?> <style type="text/css"> <!-- .Menu { COLOR:#000000; FONT-SIZE: 12px; CURSOR: hand;} </style> <script type="text/javascript"> function ShowMenu(MenuID) { if(MenuID.style.display=="none") { MenuID.style.display=""; } else
function custom_print($matches = array()) { global $db, $is_logged, $member_id, $xf_inited, $cat_info, $config, $user_group, $category_id, $_TIME, $lang, $smartphone_detected, $dle_module, $allow_comments_ajax, $PHP_SELF, $news_date, $banners, $banner_in_news, $url_page, $user_query, $custom_news, $global_news_count; if (!count($matches)) { return ""; } $param_str = trim($matches[1]); $aviable = array("global"); $thisdate = date("Y-m-d H:i:s", $_TIME); $sql_select = "SELECT p.id, p.autor, p.date, p.short_story, CHAR_LENGTH(p.full_story) as full_story, p.xfields, p.title, p.category, p.alt_name, p.comm_num, p.allow_comm, p.fixed, p.tags, e.news_read, e.allow_rate, e.rating, e.vote_num, e.votes, e.view_edit, e.editdate, e.editor, e.reason FROM " . PREFIX . "_post p LEFT JOIN " . PREFIX . "_post_extras e ON (p.id=e.news_id)"; $where = array(); $allow_cache = $config['allow_cache']; if (preg_match("#aviable=['\"](.+?)['\"]#i", $param_str, $match)) { $aviable = explode('|', $match[1]); } if (preg_match("#available=['\"](.+?)['\"]#i", $param_str, $match)) { $aviable = explode('|', $match[1]); } $do = $dle_module ? $dle_module : "main"; if (!in_array($do, $aviable) and $aviable[0] != "global") { return ""; } if (preg_match("#id=['\"](.+?)['\"]#i", $param_str, $match)) { $temp_array = array(); $where_id = array(); $match[1] = explode(',', trim($match[1])); foreach ($match[1] as $value) { if (count(explode('-', $value)) == 2) { $value = explode('-', $value); $where_id[] = "id >= '" . intval($value[0]) . "' AND id <= '" . intval($value[1]) . "'"; } else { $temp_array[] = intval($value); } } if (count($temp_array)) { $where_id[] = "id IN ('" . implode("','", $temp_array) . "')"; } if (count($where_id)) { $custom_id = implode(' OR ', $where_id); $where[] = $custom_id; } } if (preg_match("#tags=['\"](.+?)['\"]#i", $param_str, $match)) { $temp_array = array(); $tagscache = $match[1]; $match[1] = explode(',', trim($match[1])); foreach ($match[1] as $value) { $value = $db->safesql(trim($value)); if ($value) { $temp_array[] = "tag='{$value}'"; } } if (count($temp_array)) { $temp_array = implode(" OR ", $temp_array); $db->query("SELECT news_id FROM " . PREFIX . "_tags WHERE {$temp_array}"); $temp_array = array(); while ($row = $db->get_row()) { if (!in_array($row['news_id'], $temp_array)) { $temp_array[] = $row['news_id']; } } if (count($temp_array)) { $where[] = "id IN ('" . implode("','", $temp_array) . "')"; } else { $where[] = "id IN ('0')"; } } } else { $tagscache = ""; } if (preg_match("#idexclude=['\"](.+?)['\"]#i", $param_str, $match)) { $temp_array = array(); $where_id = array(); $match[1] = explode(',', trim($match[1])); foreach ($match[1] as $value) { if (count(explode('-', $value)) == 2) { $value = explode('-', $value); $where_id[] = "(id < '" . intval($value[0]) . "' OR id > '" . intval($value[1]) . "')"; } else { $temp_array[] = intval($value); } } if (count($temp_array)) { $where_id[] = "id NOT IN ('" . implode("','", $temp_array) . "')"; } if (count($where_id)) { $custom_id = implode(' AND ', $where_id); $where[] = $custom_id; } } $allow_list = explode(',', $user_group[$member_id['user_group']]['allow_cats']); if ($allow_list[0] != "all" and !$user_group[$member_id['user_group']]['allow_short']) { if ($config['allow_multi_category']) { $where[] = "category regexp '[[:<:]](" . implode('|', $allow_list) . ")[[:>:]]'"; } else { $where[] = "category IN ('" . implode("','", $allow_list) . "')"; } } if (preg_match("#category=['\"](.+?)['\"]#i", $param_str, $match)) { $temp_array = array(); $match[1] = explode(',', $match[1]); foreach ($match[1] as $value) { if (count(explode('-', $value)) == 2) { $temp_array[] = get_mass_cats($value); } else { $temp_array[] = intval($value); } } $temp_array = implode(',', $temp_array); $custom_category = $db->safesql(trim(str_replace(',', '|', $temp_array))); if ($config['allow_multi_category']) { $where[] = "category regexp '[[:<:]](" . $custom_category . ")[[:>:]]'"; } else { $custom_category = str_replace("|", "','", $custom_category); $where[] = "category IN ('" . $custom_category . "')"; } } if (preg_match("#categoryexclude=['\"](.+?)['\"]#i", $param_str, $match)) { $temp_array = array(); $match[1] = explode(',', $match[1]); foreach ($match[1] as $value) { if (count(explode('-', $value)) == 2) { $temp_array[] = get_mass_cats($value); } else { $temp_array[] = intval($value); } } $temp_array = implode(',', $temp_array); $custom_category = $db->safesql(trim(str_replace(',', '|', $temp_array))); if ($config['allow_multi_category']) { $where[] = "category NOT REGEXP '[[:<:]](" . $custom_category . ")[[:>:]]'"; } else { $custom_category = str_replace("|", "','", $custom_category); $where[] = "category NOT IN ('" . $custom_category . "')"; } } if (preg_match("#days=['\"](.+?)['\"]#i", $param_str, $match)) { $days = intval(trim($match[1])); $where[] = "p.date >= '{$thisdate}' - INTERVAL {$days} DAY AND p.date < '{$thisdate}'"; } else { $days = 0; } if (preg_match("#author=['\"](.+?)['\"]#i", $param_str, $match)) { $author = $match[1]; $match[1] = explode(',', $match[1]); $temp_array = array(); foreach ($match[1] as $value) { $value = $db->safesql(trim($value)); $temp_array[] = "p.autor = '{$value}'"; } $where[] = implode(' OR ', $temp_array); } else { $author = ""; } if (preg_match("#authorexclude=['\"](.+?)['\"]#i", $param_str, $match)) { $author = $match[1]; $match[1] = explode(',', $match[1]); $temp_array = array(); foreach ($match[1] as $value) { $value = $db->safesql(trim($value)); $temp_array[] = "p.autor != '{$value}'"; } $where[] = implode(' AND ', $temp_array); } else { $author = ""; } if (preg_match("#catalog=['\"](.+?)['\"]#i", $param_str, $match)) { $catalog = $match[1]; $match[1] = explode(',', $match[1]); $temp_array = array(); foreach ($match[1] as $value) { $value = $db->safesql(trim($value)); $temp_array[] = "p.symbol = '{$value}'"; } $where[] = implode(' OR ', $temp_array); } else { $catalog = ""; } if (preg_match("#catalogexclude=['\"](.+?)['\"]#i", $param_str, $match)) { $catalog = $match[1]; $match[1] = explode(',', $match[1]); $temp_array = array(); foreach ($match[1] as $value) { $value = $db->safesql(trim($value)); $temp_array[] = "p.symbol != '{$value}'"; } $where[] = implode(' AND ', $temp_array); } else { $catalog = ""; } if (preg_match("#xfields=['\"](.+?)['\"]#i", $param_str, $match)) { $xf = $match[1]; $match[1] = explode(',', $match[1]); $temp_array = array(); foreach ($match[1] as $value) { $value = @$db->safesql(htmlspecialchars(strip_tags(stripslashes(trim($value))), ENT_QUOTES, $config['charset'])); $temp_array[] = "p.xfields LIKE '%{$value}%'"; } $where[] = implode(' OR ', $temp_array); } else { $xf = ""; } if (preg_match("#xfieldsexclude=['\"](.+?)['\"]#i", $param_str, $match)) { $notxf = $match[1]; $match[1] = explode(',', $match[1]); $temp_array = array(); foreach ($match[1] as $value) { $value = @$db->safesql(htmlspecialchars(strip_tags(stripslashes(trim($value))), ENT_QUOTES, $config['charset'])); $temp_array[] = "p.xfields NOT LIKE '%{$value}%'"; } $where[] = implode(' AND ', $temp_array); } else { $notxf = ""; } $where[] = "approve=1"; if ($config['no_date'] and !$config['news_future'] and !$days) { $where[] = "date < '" . $thisdate . "'"; } if (preg_match("#template=['\"](.+?)['\"]#i", $param_str, $match)) { $custom_template = trim($match[1]); } else { $custom_template = "shortstory"; } if (preg_match("#from=['\"](.+?)['\"]#i", $param_str, $match)) { $custom_from = intval($match[1]); $custom_all = $custom_from; } else { $custom_from = 0; $custom_all = 0; } if (preg_match("#limit=['\"](.+?)['\"]#i", $param_str, $match)) { $custom_limit = intval($match[1]); } else { $custom_limit = $config['news_number']; } if (preg_match("#cache=['\"](.+?)['\"]#i", $param_str, $match)) { if ($match[1] == "yes") { $config['allow_cache'] = 1; } else { $config['allow_cache'] = false; } } if ($config['allow_cache']) { $short_news_cache = true; } else { $short_news_cache = false; } if (preg_match("#fixed=['\"](.+?)['\"]#i", $param_str, $match)) { $fixed = ""; $fixedcache = "fixed yes"; if ($match[1] == "yes") { $fixed = "fixed DESC, "; } elseif ($match[1] == "only") { $where[] = "fixed='1'"; $fixedcache = "fixed only"; } elseif ($match[1] == "without") { $where[] = "fixed='0'"; $fixedcache = "without fixed"; } } else { $fixed = ""; $fixedcache = ""; } if ($is_logged and ($user_group[$member_id['user_group']]['allow_edit'] and !$user_group[$member_id['user_group']]['allow_all_edit'])) { $config['allow_cache'] = false; } if ($cat_info[$custom_category]['news_sort'] != "") { $news_sort = $cat_info[$custom_category]['news_sort']; } else { $news_sort = $config['news_sort']; } if ($cat_info[$custom_category]['news_msort'] != "") { $news_msort = $cat_info[$custom_category]['news_msort']; } else { $news_msort = $config['news_msort']; } if (preg_match("#sort=['\"](.+?)['\"]#i", $param_str, $match)) { $allowed_sort = array('asc' => 'ASC', 'desc' => 'DESC'); $match[1] = strtolower($match[1]); if ($allowed_sort[$match[1]]) { $news_msort = $allowed_sort[$match[1]]; } } if (preg_match("#order=['\"](.+?)['\"]#i", $param_str, $match)) { $allowed_sort = array('date' => 'date', 'rating' => 'rating', 'reads' => 'news_read', 'comments' => 'comm_num', 'title' => 'title', 'rand' => 'RAND()'); $match[1] = strtolower($match[1]); if ($allowed_sort[$match[1]]) { $news_sort = $allowed_sort[$match[1]]; } if ($match[1] == "rand") { $fixed = ""; $news_msort = ""; } } if (preg_match("#navigation=['\"](.+?)['\"]#i", $param_str, $match)) { if ($match[1] == "yes" and $url_page !== false) { $build_navigation = true; if (isset($_GET['cstart'])) { $cstart = intval($_GET['cstart']); } else { $cstart = 0; } if ($cstart > 10) { $config['allow_cache'] = false; } if ($cstart) { $cstart = $cstart - 1; $cstart = $cstart * $custom_limit + $custom_from; $custom_from = $cstart; } } else { $build_navigation = false; } } else { $build_navigation = false; } $custom_cache_id = $custom_id . $custom_category . $user_group[$member_id['user_group']]['allow_cats'] . $custom_from . $custom_limit . $news_sort . $news_msort . $custom_template . $days . $author . $catalog . $xf . $notxf . $fixedcache . $tagscache; $content = dle_cache("news", $custom_cache_id, true); if ($content !== false) { $config['allow_cache'] = $allow_cache; $custom_news = true; return $content; } else { if ($build_navigation) { $count_all = $db->super_query("SELECT COUNT(*) as count FROM " . PREFIX . "_post p WHERE " . implode(' AND ', $where)); $count_all = $count_all['count'] - $custom_all; } $tpl = new dle_template(); $tpl->dir = TEMPLATE_DIR; $tpl->load_template($custom_template . '.tpl'); $sql_select .= " WHERE " . implode(' AND ', $where) . " ORDER BY " . $fixed . $news_sort . " " . $news_msort . " LIMIT " . $custom_from . "," . $custom_limit; $sql_result = $db->query($sql_select); include ENGINE_DIR . '/modules/show.custom.php'; if ($config['files_allow']) { if (strpos($tpl->result['content'], "[attachment=") !== false) { $tpl->result['content'] = show_attach($tpl->result['content'], $attachments); } } if ($custom_news) { create_cache("news", $tpl->result['content'], $custom_cache_id, true); } $config['allow_cache'] = $allow_cache; return $tpl->result['content']; } }
public function block_online(dle_template &$tpl) { if (!$this->config['allow_module'] || !$this->config['allow_online_block']) { return false; } if ((int) $this->config['block_online_cache_time'] && file_exists(ENGINE_DIR . "/cache/block_online.tmp") && time() - filemtime(ENGINE_DIR . "/cache/block_online.tmp") > (int) $this->config['block_online_cache_time'] && ($cache = dle_cache("block_online"))) { $tpl->result['block_online'] = $cache; return true; } $this->_db_connect(); $this->db->query("SELECT member_id, ip_address, running_time, location_1_type, browser, member_name FROM " . IPB_PREFIX . "sessions WHERE running_time>" . (time() - $this->config['online_time'])); $users = $robots = $onl_onlinebots = array(); $guests = $count_user = $count_robots = 0; while ($user = $this->db->get_row()) { foreach ($user as &$value) { $this->_convert_charset($value, true); } if ($user['member_id'] == 0) { $current_robot = $this->robots($user['browser']); if ($current_robot != "") { if ($onl_onlinebots[$current_robot]['lastactivity'] < $user['running_time']) { $robots[$current_robot]['name'] = $current_robot; $robots[$current_robot]['lastactivity'] = $user['running_time']; $robots[$current_robot]['host'] = $user['ip_address']; $robots[$current_robot]['location'] = $user['location_1_type']; } } else { $guests++; } } else { if ($users[$user['member_id']]['lastactivity'] < $user['running_time']) { $users[$user['member_id']]['username'] = $user['member_name']; $users[$user['member_id']]['lastactivity'] = $user['running_time']; $users[$user['member_id']]['useragent'] = $user['browser']; $users[$user['member_id']]['host'] = $user['ip_address']; $users[$user['member_id']]['location'] = $user['location_1_type']; } } } $location_array = array("%addcomments%" => $this->lang['paddcomments'], "%readnews%" => $this->lang['preadnews'], "%incategory%" => $this->lang['pincategory'], "%posin%" => $this->lang['pposin'], "%mainpage%" => $this->lang['pmainpage'], "%view_pofile%" => $this->lang['view_profile'], "%newposts%" => $this->lang['newposts'], "%view_stats%" => $this->lang['view_stats']); if (count($users)) { foreach ($users as $id => $value) { $user_array[$value['username']]['desc'] = ''; if (@$GLOBALS['member_id']['user_group'] == 1) { $user_array[$value['username']]['desc'] .= $this->lang['os'] . $this->os($value['useragent']) . '<br />' . $this->lang['browser'] . $this->browser($users[$id]['useragent']) . '<br />' . '<b>IP:</b> ' . $users[$id]['host'] . '<br />'; } $user_array[$value['username']]['desc'] .= $this->lang['was'] . $this->timeagos($users[$id]['lastactivity']) . $this->lang['back'] . '<br />' . $this->lang['location']; if (preg_match("'%(.*?)%'si", $users[$id]['location'])) { foreach ($location_array as $find => $replace) { $users[$id]['location'] = str_replace($find, $replace, $users[$id]['location']); } } else { $users[$id]['location'] = $this->lang['pforum']; } $user_array[$value['username']]['desc'] .= $users[$id]['location'] . "<br/>"; $user_array[$value['username']]['id'] = $id; $count_user++; } } if (count($robots)) { foreach ($robots as $name => $value) { if (!empty($GLOBALS['member_id']['user_group']) && $GLOBALS['member_id']['user_group'] == 1) { $robot_array[$name] = $this->lang['os'] . $this->os($robots[$name]['useragent']) . '<br />' . $this->lang['browser'] . $this->browser($robots[$name]['useragent']) . '<br />' . '<b>IP:</b> ' . $robots[$name]['host'] . '<br />'; } $robot_array[$name] .= $this->lang['was'] . $this->timeagos($robots[$name]['lastactivity']) . $this->lang['back'] . '<br />' . $this->lang['location']; if (preg_match("'%(.*?)%'si", $robots[$name]['location'])) { foreach ($location_array as $find => $replace) { $robots[$name]['location'] = str_replace($find, $replace, $robots[$name]['location']); } } else { $robots[$name]['location'] = $this->lang['pforum']; } $robot_array[$name] .= $robots[$name]['location'] . "<br/>"; $count_robots++; } } $users = ""; $i = 0; if (count($user_array)) { foreach ($user_array as $name => $desc) { if ($i) { $users .= $this->config['separator']; } $desc['desc'] = htmlspecialchars($desc['desc'], ENT_QUOTES); $users .= "<a onmouseover=\"showhint('{$desc['desc']}', this, event, '180px');\" href=\"{$this->ipb_config['board_url']}/index.php?showuser={$desc['id']}\" >" . $name . "</a>"; $i++; } } else { $users = $this->lang['notusers']; } $robots = ""; $i = 0; if (count($robot_array)) { foreach ($robot_array as $name => $desc) { if ($i) { $robots .= $this->config['separator']; } $desc = htmlspecialchars($desc, ENT_QUOTES); $robots .= "<span onmouseover=\"showhint('{$desc}', this, event, '180px');\" style=\"cursor:hand;\" >" . $name . "</span>"; $i++; } } else { $robots = $this->lang['notbots']; } $tpl->load_template('block_online.tpl'); $tpl->set('{users}', $count_user); $tpl->set('{guest}', $guests); $tpl->set('{robots}', $count_robots); $tpl->set('{all}', $count_user + $guests + $count_robots); $tpl->set('{userlist}', $users); $tpl->set('{botlist}', $robots); /* $tpl->copy_template = "\n<script type=\"text/javascript\" src=\"".$GLOBALS['config']['http_home_url']."engine/skins/default.js\"></script>\n <style type=\"text/css\" media=\"all\"> @import url(/templates/".$GLOBALS['config']['skin']."/css/block_online.css); </style>" .$tpl->copy_template;*/ $tpl->compile('block_online'); $tpl->clear(); $this->_db_disconnect(); if ((int) $this->config['block_online_cache_time']) { create_cache("block_online", $tpl->result['block_online']); } return true; }
function build_comments($template, $area, $allow_cache = false, $re_url = false) { global $config, $tpl, $is_logged, $member_id, $user_group, $lang, $ajax_adds, $dle_tree_comments, $dle_login_hash; $tpl->load_template($template); if ($area == "news" or $area == 'ajax' and !isset($ajax_adds)) { $build_full_news = true; } else { $build_full_news = false; } $tpl->copy_template = "<div id='comment-id-{id}'>" . $tpl->copy_template . "</div>"; $tpl->template = "<div id='comment-id-{id}'>" . $tpl->template . "</div>"; if (strpos($tpl->copy_template, "[xfvalue_") !== false) { $this->xfound = true; } else { $this->xfound = false; } if ($this->xfound) { $this->xfields = xfieldsload(true); } $rows = false; if ($allow_cache) { $rows = dle_cache("comm_" . $allow_cache, $this->query); } if ($rows) { $rows = unserialize($rows); if (!is_array($rows)) { die("Cache data not correct"); } $full_cache = true; } else { $rows = array(); if ($build_full_news) { $sql_result = $this->db->query($this->query); } else { $sql_result = $this->db->query($this->query . " LIMIT " . $this->cstart . "," . $this->comments_per_pages); } while ($row = $this->db->get_row($sql_result)) { $rows[$row['id']] = array(); foreach ($row as $key => $value) { if ($key == "parent" and $value == 0) { $value = false; } $rows[$row['id']][$key] = $value; } } $this->db->free($sql_result); unset($row); if ($build_full_news and $config['tree_comments']) { $rows = $this->build_tree($rows); if ($config['comm_msort'] == "DESC") { $rows = array_reverse($rows, true); } } if ($allow_cache) { create_cache("comm_" . $allow_cache, serialize($rows), $this->query); } } if ($build_full_news and count($rows)) { $this->total_comments = count($rows); if ($this->cstart < $this->total_comments) { $rows = array_slice($rows, $this->cstart, $this->comments_per_pages, true); } else { $rows = array(); } } if (count($rows)) { if ($build_full_news and $config['tree_comments']) { $dle_tree_comments = 1; $tpl->result['comments'] = "<ol class=\"comments-tree-list\">" . $this->compile_tree($rows, $area) . "</ol>"; } else { $tpl->result['comments'] = $this->compile_comments($rows, $area); } } else { if ($config['seo_control'] and $_GET['cstart'] and $re_url) { $re_url = str_replace($config['http_home_url'], "/", $re_url); header("HTTP/1.0 301 Moved Permanently"); header("Location: {$re_url}"); die("Redirect"); } $tpl->result['comments'] = ""; } $tpl->clear(); if ($area != 'ajax') { $tpl->result['comments'] = "<a name=\"comment\"></a>" . $tpl->result['comments']; } if ($config['comments_lazyload'] and $area != 'ajax' and $this->total_comments > $this->comments_per_pages) { $tpl->result['comments'] .= "\n<div class=\"ajax_comments_area\"><div class=\"ajax_loaded_comments\"></div><div class=\"ajax_comments_next\"></div></div>\n"; } if ($area == 'news' and $config['comm_msort'] == "DESC") { $tpl->result['comments'] = "\n<div id=\"dle-ajax-comments\"></div>\n" . $tpl->result['comments']; } if ($area == 'news' and $config['comm_msort'] == "ASC") { $tpl->result['comments'] .= "\n<div id=\"dle-ajax-comments\"></div>\n"; } if ($area != 'ajax' and $user_group[$member_id['user_group']]['del_allc'] and !$user_group[$member_id['user_group']]['edit_limit']) { $tpl->result['comments'] .= "\n<div class=\"mass_comments_action\">{$lang['mass_comments']} <select name=\"mass_action\"><option value=\"\">{$lang['edit_selact']}</option><option value=\"mass_combine\">{$lang['edit_selcomb']}</option><option value=\"mass_delete\">{$lang['edit_seldel']}</option></select> <input type=\"submit\" class=\"bbcodes\" value=\"{$lang['b_start']}\" /></div>\n<input type=\"hidden\" name=\"do\" value=\"comments\" /><input type=\"hidden\" name=\"dle_allow_hash\" value=\"{$dle_login_hash}\" /><input type=\"hidden\" name=\"area\" value=\"{$area}\" />"; } if ($area != 'ajax') { $tpl->result['comments'] = "<form method=\"post\" action=\"\" name=\"dlemasscomments\" id=\"dlemasscomments\"><div id=\"dle-comments-list\">\n" . $tpl->result['comments'] . "</div></form>\n"; } if (strpos($tpl->result['content'], "<!--dlecomments-->") !== false) { $tpl->result['content'] = str_replace("<!--dlecomments-->", $tpl->result['comments'], $tpl->result['content']); } else { $tpl->result['content'] .= $tpl->result['comments']; } }
$name = "stats"; $uvalue = 1; if (!$total_conf['allow_cache'] || !($array = @unserialize(dle_cache('totalizator_stats_' . $start)))) { $total->db->query("SELECT *, name AS username FROM " . PREFIX . "_users WHERE points!=0 ORDER BY points DESC LIMIT {$start}, {$per_page}"); while ($row = $total->db->get_row()) { $array[$row['user_id']] = $row; } if ($total_conf['allow_cache']) { create_cache("totalizator_stats_" . $start, @serialize($array)); } } if (!$total_conf['allow_cache'] || !($count_all = intval(dle_cache("totalizator_stats_count")))) { $count = $total->db->super_query("SELECT COUNT(*) AS count FROM " . PREFIX . "_users WHERE points!=0"); $count_all = $count['count']; if ($total_conf['allow_cache']) { create_cache("totalizator_stats_count", $count_all); } } } else { if ($tournament) { $where['tournament_id'] = $tournament; } switch ($action) { case "new_matche": $where['calculate'] = 0; $title = $lang_total['new_matche']; $desc = $lang_total['new_matche_desc']; break; case "old_matche": $where['calculate'] = 1; $title = $lang_total['old_matche'];
if (!$config['allow_quick_wysiwyg']) { $allow_comments_ajax = false; } if ($config['files_allow'] == "yes") { if (strpos($tpl->result['content'], "[attachment=") !== false) { $tpl->result['content'] = show_attach($tpl->result['content'], $attachments); } } if (isset($view_template) and $view_template == "rss" and $news_found) { if ($catalog) { create_cache("rss", $tpl->result['content'], $catalog, false); } else { create_cache("rss", $tpl->result['content'], $category_id, false); } } elseif ($news_found and $cache_id < 6) { create_cache("news", $tpl->result['content'], $cache_id . $cache_prefix, true); } } } } /* ===================================================== Вывод заголовка страницы ===================================================== */ $titl_e = ''; $nam_e = ''; $rss_url = ''; if ($do == "cat" and $category != '' and $subaction == '') { $metatags['description'] = $cat_info[$category_id]['descr'] != '' ? $cat_info[$category_id]['descr'] : $metatags['description']; $metatags['keywords'] = $cat_info[$category_id]['keywords'] != '' ? $cat_info[$category_id]['keywords'] : $metatags['keywords'];
if ($value['dmax'] and dle_strlen($content['description'], $config['charset']) > $value['dmax']) { $content['description'] = dle_substr($content['description'], 0, $value['dmax'], $config['charset']); if ($temp_dmax = dle_strrpos($content['description'], ' ', $config['charset'])) { $content['description'] = dle_substr($content['description'], 0, $temp_dmax, $config['charset']); } $content['description'] .= " ..."; } $content['link'] = htmlspecialchars($content['link'], ENT_QUOTES, $config['charset']); $tpl->set('{title}', $content['title']); $tpl->set('{news}', $content['description']); $tpl->set('[link]', "<a href=\"{$content['link']}\" target=\"_blank\">"); $tpl->set('[/link]', "</a>"); $tpl->set('{link}', $content['link']); $tpl->set('{category}', $content['category']); $tpl->set('{author}', $content['author']); $tpl->set('{date}', langdate($value['rss_date_format'], $content['date'])); $news_date = $content['date']; $tpl->copy_template = preg_replace_callback("#\\{date=(.+?)\\}#i", "formdate", $tpl->copy_template); $tpl->compile('rss_info'); } $buffer = $tpl->result['rss_info']; $tpl->result['rss_info'] = ""; $tpl->clear(); create_cache("informer_" . $value['id'], $buffer, $config['skin']); } $informers[$value['tag']] = $buffer; } } $temp = array(); unset($temp); $config['allow_cache'] = $allow_cache;
public function Start($CommCfg) { $this->New_Cfg($CommCfg); // создаем новый конфиг $where = array(); // проверка некоторых параметров конфига по версиях $allow_alt_url = $this->config['version_id'] >= '10.2' ? $this->config['allow_alt_url'] == '1' : $this->config['allow_alt_url'] == "yes"; $allow_cache = $this->config['version_id'] >= '10.2' ? $this->config['allow_cache'] == '1' : $this->config['allow_cache'] == "yes"; $allow_multi_category = $this->config['version_id'] >= '10.2' ? $this->config['allow_multi_category'] == '1' : $this->config['allow_multi_category'] == "yes"; if ($this->config['version_id'] >= '10.4' and $this->comm_cfg['rating_comm']) { // рейтинг комментариев только для DLE 10.4 и выще $where[] = "c.rating > {$this->comm_cfg[rating_comm]}"; } // работа с категориями if ($allow_multi_category) { if ($this->comm_cfg['stop_category']) { $where[] = "category NOT REGEXP '[[:<:]](" . $this->Explode_Category($this->comm_cfg['stop_category'], "multi") . ")[[:>:]]'"; } if ($this->comm_cfg['from_category']) { $where[] = "category REGEXP '[[:<:]](" . $this->Explode_Category($this->comm_cfg['from_category'], "multi") . ")[[:>:]]'"; } } else { if ($this->comm_cfg['stop_category']) { $where[] = "category NOT IN ('" . $this->Explode_Category($this->comm_cfg['stop_category']) . "')"; } if ($this->comm_cfg['from_category']) { $where[] = "category IN ('" . $this->Explode_Category($this->comm_cfg['from_category']) . "')"; } } if ($this->comm_cfg['news_xfield']) { // работа с доп полями новостей $where[] = $this->Explode_xField($this->comm_cfg['news_xfield'], "p.xfields"); } if ($this->comm_cfg['user_xfield']) { // работа с доп полями пользователей $where[] = $this->Explode_xField($this->comm_cfg['user_xfield'], "u.xfields"); } // работа с новостями if ($this->comm_cfg['stop_id']) { $where[] = $this->Explode_NewsID($this->comm_cfg['stop_id']); } if ($this->comm_cfg['from_id']) { $where[] = $this->Explode_NewsID($this->comm_cfg['from_id']); } if ($this->comm_cfg['ncomm']) { // выводим только с комментариями у новостей больше чем $where[] = "p.comm_num > {$this->comm_cfg[ncomm]}"; } if ($this->comm_cfg['fixed']) { // выводим только с зафиксированых новостей $where[] = "p.fixed = 1"; } if ($this->comm_cfg['tags']) { $t = explode(',', $this->comm_cfg['tags']); $t = implode('|', $t); $where[] = "p.tags regexp '[[:<:]](" . $t . ")[[:>:]]'"; } if ($this->comm_cfg['news_read']) { // выводим только с комментариями у новостей больше чем $where[] = "e.news_read > {$this->comm_cfg[news_read]}"; } if ($this->comm_cfg['rating_news']) { // выводим только с комментариями у новостей больше чем $where[] = "e.rating > {$this->comm_cfg[rating_news]}"; } if ($this->comm_cfg['only_avatar']) { // выводим только с аватарами $where[] = "u.foto != ''"; } if ($this->comm_cfg['only_news']) { // выводим только с новостями $where[] = "u.news_num > 0"; } if ($this->comm_cfg['only_fav']) { // выводим только с закладками $where[] = "u.favorites != ''"; } if ($this->comm_cfg['only_fullname']) { // выводим только с полным именем $where[] = "u.fullname != ''"; } if ($this->comm_cfg['only_land']) { // выводим только с место жительством $where[] = "u.land != ''"; } if ($this->comm_cfg['news_user']) { // выводим только если новостей больше чем $where[] = "u.news_num > {$this->comm_cfg[news_user]}"; } if ($this->comm_cfg['comm']) { // выводим только если комментариев больше чем $where[] = "u.comm_num > {$this->comm_cfg[comm]}"; } // префикс кэша $Comm_hash = md5($this->comm_cfg['max_comm'] . $this->comm_cfg['max_text'] . $this->comm_cfg['max_title'] . $this->comm_cfg['check_guest'] . $this->comm_cfg['stop_category'] . $this->comm_cfg['from_category'] . $this->comm_cfg['stop_id'] . $this->comm_cfg['from_id'] . $this->comm_cfg['only_avatar'] . $this->comm_cfg['only_news'] . $this->comm_cfg['news_user'] . $this->comm_cfg['comm'] . $this->comm_cfg['only_fav'] . $this->comm_cfg['only_fullname'] . $this->comm_cfg['only_land']); $is_change = false; if (!$allow_cache) { if ($this->config['version_id'] >= '10.2') { $this->config['allow_cache'] = '1'; } else { $this->config['allow_cache'] = "yes"; } $is_change = true; } $Comm = dle_cache("Comm_", $this->config['skin'] . $Comm_hash); // подгружаем из кэша if (!$Comm) { if (count($where) > 0) { $where = " AND " . implode(" AND ", $where); } else { $where = ""; } $sql = $this->db->query("SELECT c.id as comid, c.post_id, c.date, c.user_id, c.is_register, c.text, c.autor, c.email, c.approve, p.id, p.date as newsdate, p.title, p.category, p.comm_num, p.alt_name, e.news_id, e.news_read, e.rating, u.foto, u.user_group, u.user_id FROM " . PREFIX . "_comments as c, " . PREFIX . "_post as p, " . PREFIX . "_post_extras as e, " . PREFIX . "_users as u WHERE p.id=c.post_id AND e.news_id=c.post_id AND c.approve = 1 AND c.user_id = u.user_id {$where} ORDER BY c.date DESC LIMIT 0, " . $this->comm_cfg['max_comm']); $tpl = new dle_template(); $tpl->dir = TEMPLATE_DIR; $tpl->load_template('comm/comm.tpl'); $count_rows = $sql->num_rows; if ($count_rows > 0) { while ($row = $this->db->get_row($sql)) { $row['date'] = strtotime($row['date']); $row['category'] = intval($row['category']); // Обработка ссылки на комментарий $on_page = FALSE; if ($row['comm_num'] > $this->config['comm_nummers']) { $on_page = 'page,1,' . ceil($row['comm_num'] / $this->config['comm_nummers']) . ','; } if ($allow_alt_url) { if ($condition = $this->config['seo_type'] == 1 or $this->config['seo_type'] == 2) { if ($row['category'] and $this->config['seo_type'] == 2) { $full_link = $this->config['http_home_url'] . get_url($row['category']) . "/" . $on_page . $row['id'] . "-" . $row['alt_name'] . ".html"; } else { $full_link = $this->config['http_home_url'] . $on_page . $row['id'] . "-" . $row['alt_name'] . ".html"; } } else { $full_link = $this->config['http_home_url'] . date('Y/m/d/', $row['date']) . $on_page . $row['alt_name'] . ".html"; } } else { $full_link = $this->config['http_home_url'] . "index.php?newsid=" . $row['id']; } $full_link = $full_link . '#comment-id-' . $row['comid']; // Обработка текста комментария if (dle_strlen($row['text'], $this->config['charset']) > $this->comm_cfg['max_text']) { $text = stripslashes(dle_substr($row['text'], 0, $this->comm_cfg['max_text'], $this->config['charset']) . " ..."); } else { $text = stripslashes($row['text']); } // Обработка заголовка новости (title) if (dle_strlen($row['title'], $this->config['charset']) > $this->comm_cfg['max_title']) { $title = stripslashes(dle_substr($row['title'], 0, $this->comm_cfg['max_title'], $this->config['charset']) . " ..."); } else { $title = stripslashes($row['title']); } // Обработка ника автора комментария if ($row['is_register'] == 1) { if ($allow_alt_url) { $go_page = $this->config['http_home_url'] . "user/" . urlencode($row['autor']) . "/"; } else { $go_page = "{$PHP_SELF}?subaction=userinfo&user="******"onclick=\"ShowProfile('" . urlencode($row['autor']) . "', '" . htmlspecialchars($go_page, ENT_QUOTES, $this->config['charset']) . "', '" . $this->group[$this->member['user_group']]['admin_editusers'] . "'); return false;\""; } else { $go_page = "onclick=\"ShowProfile('" . urlencode($row['autor']) . "', '" . $go_page . "'); return false;\""; } if ($allow_alt_url) { $author = "<a {$go_page} href=\"" . $this->config['http_home_url'] . "user/" . urlencode($row['autor']) . "/\">" . $row['autor'] . "</a>"; } else { $author = "<a {$go_page} href=\"{$PHP_SELF}?subaction=userinfo&user="******"\">" . $row['autor'] . "</a>"; } } else { $author = strip_tags($row['autor']); } // Обработка фото автора комментария if ($row['foto'] and $row['is_register'] == 1) { if (count(explode("@", $row['foto'])) == 2) { $tpl->set('{foto}', '//www.gravatar.com/avatar/' . md5(trim($row['foto'])) . '?s=' . intval($this->group[$row['user_group']]['max_foto'])); } else { if ($this->config['version_id'] >= '10.5') { if (strpos($row['foto'], "//") === 0) { $avatar = "http:" . $row['foto']; } else { $avatar = $row['foto']; } $avatar = @parse_url($avatar); if ($avatar['host']) { $tpl->set('{foto}', $row['foto']); } else { $tpl->set('{foto}', $this->config['http_home_url'] . "uploads/fotos/" . $row['foto']); } } else { if ($row['foto'] and file_exists(ROOT_DIR . "/uploads/fotos/" . $row['foto'])) { $tpl->set('{foto}', $this->config['http_home_url'] . "uploads/fotos/" . $row['foto']); } } } } else { $tpl->set('{foto}', "{THEME}/dleimages/noavatar.png"); } // Обработка ссылки автора комментария if ($allow_alt_url) { $user_url = $this->config['http_home_url'] . "user/" . urlencode($row['autor']) . "/"; } else { $user_url = "{$PHP_SELF}?subaction=userinfo&user="******", H:i", $row['date'])); } elseif (date('Ymd', $row['date']) == date('Ymd', $_TIME - 86400)) { $tpl->set('{date}', $lang['time_gestern'] . langdate(", H:i", $row['date'])); } else { $tpl->set('{date}', langdate($this->config['timestamp_active'], $row['date'])); } $tpl->copy_template = preg_replace("#\\{date=(.+?)\\}#ie", "langdate('\\1', '{$row['date']}')", $tpl->copy_template); $tpl->set('{text}', $text); //текст комментария $tpl->set('{user_url}', $user_url); // ссылка на автора $tpl->set('{user_name}', $row['autor']); // просто ник автора $tpl->set('[user_url]', "<a href=\"" . $user_url . "\">"); // оборачиваем в ссылку $tpl->set('[/user_url]', "</a>"); // оборачиваем в ссылку $tpl->set('{author}', $author); // автор с ссылкой на профиль с модальным окном $tpl->set('[color]', $this->group[$row['user_group']]['group_prefix']); // префикс цвета группы $tpl->set('[/color]', $this->group[$row['user_group']]['group_suffix']); // суфикс цвета группы $tpl->set('{title}', $title); // укороченный заголовок $tpl->set('{long_title}', stripslashes($row['title'])); // полный заголовок $tpl->set('{rating}', $row['rating']); // рейтинг новости $tpl->set('{views}', $row['news_read']); // просмотров новости $tpl->set('{full_link}', $full_link); // линк на комментарий $tpl->set('{comm_num}', $row['comm_num']); // кол-во комментариев новости $tpl->set("{error}", ""); $tpl->set('[comm]', ""); $tpl->set('[/comm]', ""); $tpl->set_block("'\\[not-comm\\](.*?)\\[/not-comm\\]'si", ""); $tpl->compile('comm'); //компиляция шаблона } $this->db->free($sql); //очищаем от запросов } else { $tpl->set("{error}", "Комментариев нету!"); $tpl->set_block("'\\[comm\\](.*?)\\[/comm\\]'si", ""); $tpl->set('[not-comm]', ""); $tpl->set('[/not-comm]', ""); $tpl->compile('comm'); } $tpl->clear(); //очищаем шаблон $Comm = $tpl->result['comm']; if (preg_match_all('/<!--dle_spoiler(.*?)<!--\\/dle_spoiler-->/is', $Comm, $spoilers)) { foreach ($spoilers as $spoiler) { $Comm = str_replace($spoiler, '<div class="quote">Для просмотра содержимого спойлера, перейдите к выбранному комментарию.</div>', $Comm); } } if ($this->group[$this->member['user_group']]['allow_hide']) { $Comm = preg_replace("'\\[hide\\](.*?)\\[/hide\\]'si", "\\1", $Comm); } else { $Comm = preg_replace("'\\[hide\\](.*?)\\[/hide\\]'si", "<div class=\"quote\"> Для вашей группы скрытый текст не виден </div>", $Comm); } create_cache("Comm_", $Comm, $this->config['skin'] . $Comm_hash); //создаем кэш if ($is_change) { $this->config['allow_cache'] = false; } //выключаем кэш принудительно (возвращаем назад) } echo '<div class="iComm" id="iComm"><ul class="lastcomm">' . $Comm . '</ul> <!-- .lastcomm --></div>'; }
?> </table> </td></tr> </table> </td></tr> </table> <?php admin_footer(); exit; } elseif ($admin_action == 'setting_edit') { if (isset($_POST['edit_submit'])) { $query = $dblink->query("SELECT * FROM {$dbprefix}set"); while ($row = $dblink->fetch_array($query)) { $dblink->query("UPDATE {$dbprefix}set SET value='" . $_POST[$row[variable]] . "' WHERE variable='" . $row[variable] . "'"); } create_cache('variable'); header("location:admin.php?admin_action=var_setting"); } else { $query = $dblink->query("SELECT * FROM {$dbprefix}set"); admin_header(); ?> <table cellspacing="1" cellpadding="0" width="800" align="center" class="tableborder"> <tr><td> <table border="0" cellspacing="0" cellpadding="3" width="100%"> <tr class="header"><td height="22"><?php echo $lang['set_mod']; ?> </td></tr> <tr bgcolor="#f8f8f8"><td> <table border="1" bordercolor="#cccccc" cellspacing="0" cellpadding="0" width="100%"> <form name="settingform" action="admin.php" method="post">
} } } $tpl2->compile('content'); } $related_buffer = $tpl2->result['content']; unset($tpl2); $db->free(); if ($first_show) { if (count($related_ids)) { $related_ids = implode(",", $related_ids); $db->query("UPDATE " . PREFIX . "_post_extras SET related_ids='{$related_ids}' WHERE news_id='{$row['id']}'"); } } if ($allow_full_cache) { create_cache("related", $related_buffer, $row['id'] . $config['skin'], true); } } if ($related_buffer) { $tpl->set('[related-news]', ""); $tpl->set('[/related-news]', ""); } else { $tpl->set_block("'\\[related-news\\](.*?)\\[/related-news\\]'si", ""); } $tpl->set('{related-news}', $related_buffer); } if ($is_logged) { $fav_arr = explode(',', $member_id['favorites']); if (!in_array($row['id'], $fav_arr)) { $tpl->set('{favorites}', "<a id=\"fav-id-" . $row['id'] . "\" href=\"{$PHP_SELF}?do=favorites&doaction=add&id=" . $row['id'] . "\"><img src=\"" . $config['http_home_url'] . "templates/{$config['skin']}/dleimages/plus_fav.gif\" onclick=\"doFavorites('" . $row['id'] . "', 'plus', 0); return false;\" title=\"" . $lang['news_addfav'] . "\" style=\"vertical-align: middle;border: none;\" alt=\"\" /></a>"); $tpl->set('[add-favorites]', "<a id=\"fav-id-" . $row['id'] . "\" onclick=\"doFavorites('" . $row['id'] . "', 'plus', 1); return false;\" href=\"{$PHP_SELF}?do=favorites&doaction=add&id=" . $row['id'] . "\">");
$tpl->copy_template = str_replace("[/xfnotgiven_{$value[0]}]", "", $tpl->copy_template); } else { $tpl->copy_template = preg_replace("'\\[xfnotgiven_{$preg_safe_name}\\](.*?)\\[/xfnotgiven_{$preg_safe_name}\\]'is", "", $tpl->copy_template); $tpl->copy_template = str_replace("[xfgiven_{$value[0]}]", "", $tpl->copy_template); $tpl->copy_template = str_replace("[/xfgiven_{$value[0]}]", "", $tpl->copy_template); } $xfieldsdata[$value[0]] = stripslashes($xfieldsdata[$value[0]]); if (preg_match("#\\[xfvalue_{$preg_safe_name} limit=['\"](.+?)['\"]\\]#i", $tpl->copy_template, $matches)) { $count = intval($matches[1]); $xfieldsdata[$value[0]] = str_replace("</p><p>", " ", $xfieldsdata[$value[0]]); $xfieldsdata[$value[0]] = strip_tags($xfieldsdata[$value[0]], "<br>"); $xfieldsdata[$value[0]] = trim(str_replace("<br>", " ", str_replace("<br />", " ", str_replace("\n", " ", str_replace("\r", "", $xfieldsdata[$value[0]]))))); if ($count and dle_strlen($xfieldsdata[$value[0]], $config['charset']) > $count) { $xfieldsdata[$value[0]] = dle_substr($xfieldsdata[$value[0]], 0, $count, $config['charset']); if ($temp_dmax = dle_strrpos($xfieldsdata[$value[0]], ' ', $config['charset'])) { $xfieldsdata[$value[0]] = dle_substr($xfieldsdata[$value[0]], 0, $temp_dmax, $config['charset']); } } $tpl->set($matches[0], $xfieldsdata[$value[0]]); } else { $tpl->copy_template = str_replace("[xfvalue_{$value[0]}]", $xfieldsdata[$value[0]], $tpl->copy_template); } } } // Обработка дополнительных полей $tpl->compile('topnews'); } $tpl->clear(); $db->free(); create_cache("topnews", $tpl->result['topnews'], $config['skin'], true); }
} $db->query("SELECT DATE_FORMAT(date,'%b %Y') AS m_date, COUNT(id) AS cnt FROM " . PREFIX . "_post WHERE approve=1" . $where_date . " GROUP BY m_date ORDER BY date desc"); $news_archive = array(); while ($row = $db->get_row()) { $arch_title['ru'] = str_replace($f3, $r, $row['m_date']); $arch_title['en'] = str_replace($f3, $f2, $row['m_date']); $arch_url = explode(" ", $arch_title['en']); $arch_title['en'] = $arch_url[1] . "/" . $arch_url[0]; if ($config['allow_alt_url'] == "yes") { $news_archive[] = '<a class="archives" href="' . $config['http_home_url'] . $arch_title['en'] . '/"><b>' . $arch_title['ru'] . ' (' . $row['cnt'] . ')</b></a>'; } else { $news_archive[] = "<a class=\"archives\" href=\"{$PHP_SELF}?year={$arch_url['1']}&month={$arch_url['0']}\"><b>" . $arch_title['ru'] . " (" . $row['cnt'] . ")</b></a>"; } } $db->free(); $i = count($news_archive); if ($i > 6) { $news_archive[6] = "<div id=\"dle_news_archive\" style=\"display:none;\">" . $news_archive[6]; $news_archive[] = "</div><div id=\"dle_news_archive_link\" ><br /><a class=\"archives\" onclick=\"\$('#dle_news_archive').toggle('blind',{},700); return false;\" href=\"#\">" . $lang['show_archive'] . "</a></div>"; } if ($i) { $tpl->result['archive'] = implode("<br />", $news_archive); } else { $tpl->result['archive'] = ""; } create_cache("archives", $tpl->result['archive'], $config['skin']); } } if ($is_change) { $config['allow_cache'] = false; }
function RatesUsers() { global $config, $total_conf, $tpl, $db; if (!$total_conf['allow_cache'] || !($cache = dle_cache("RatesUsers"))) { $limit = intval($total_conf['user_limit']) ? intval($total_conf['user_limit']) : 10; $db->query("SELECT name, points FROM " . PREFIX . "_users WHERE points!=0 AND points!='' ORDER BY points DESC LIMIT 0, " . $limit); $tpl->load_template("totalizator/rates_users.tpl"); preg_match("'\\[row\\](.*?)\\[/row\\]'si", $tpl->copy_template, $matches); while ($row = $db->get_row()) { $replace = array("{name}" => $row['name'], "{points}" => $row['points'], "{profile_url}" => $config['http_home_url'] . ($config['allow_alt_url'] == "yes") ? "user/{$row['name']}/" : "?subaction=userinfo&user="******"{user_url}" => GetUrl("user", $row['name'], false, false)); $tpl->copy_template = strtr($tpl->copy_template, $replace); $tpl->copy_template = preg_replace("'\\[row\\](.*?)\\[/row\\]'si", "\\1\n" . $matches[0], $tpl->copy_template); } $tpl->set_block("'\\[row\\](.*?)\\[/row\\]'si", ""); $tpl->compile('RatesUsers'); $tpl->clear(); $db->free(); if ($total_conf['allow_cache']) { create_cache('RatesUsers', $tpl->result['RatesUsers']); } } else { $tpl->resilt['RatesUsers'] = $cache; } }
$groupid = $members['groupid']; $cyask_adminid = $adminid == 1 || $groupid == 3 ? 1 : 0; } } $cache_variable_file = CYASK_ROOT . './askdata/cache/cache_variable.php'; if (file_exists($cache_variable_file)) { include_once $cache_variable_file; } else { create_cache('variable'); include_once $cache_variable_file; } $cache_style_file = CYASK_ROOT . './askdata/cache/cache_style.php'; if (file_exists($cache_style_file)) { include_once $cache_style_file; } else { create_cache('style'); include_once $cache_style_file; } $tpldir = $_DCACHE['style'][$styleid]['tpldir']; $styledir = $_DCACHE['style'][$styleid]['styledir']; if (!defined('CURSCRIPT') || CURSCRIPT != 'wap') { if (!$headercache) { @header("Expires: 0"); @header("Cache-Control: private, post-check=0, pre-check=0, max-age=0", FALSE); @header("Pragma: no-cache"); } if ($headercharset && !defined('TEXTXML')) { @header('Content-Type: text/html; charset=' . $charset); } if (empty($_DCOOKIE['sid']) || $sid != $_DCOOKIE['sid']) { set_cookie('sid', $sid, 604800);
private function _online_block(dle_template &$tpl) { global $PHP_SELF; $cache = ''; if ($this->config['vb_block_online_cache_time'] && function_exists('dle_cache')) { $block_time = get_vars('vb_block_online_cache_time'); if (time() - $block_time < $this->config['vb_block_online_cache_time']) { $cache = dle_cache('vb_block_online_cache'); } } if (!$cache) { $this->_db_connect(); if (!$this->vb_config['refresh']) { $this->vb_config['refresh'] = 15; } $this->db->query("SELECT s.userid, s.host, s.lastactivity, s.location, s.useragent, u.username FROM " . VB_PREFIX . "session AS s\n LEFT OUTER JOIN " . VB_PREFIX . "user AS u\n ON u.userid=s.userid\n WHERE s.lastactivity>" . (time() - $this->vb_config['refresh'] * 60)); $users = $robots = array(); $guests = $count_user = $count_robots = 0; while ($user = $this->db->get_row()) { if (VB_CHARSET && VB_CHARSET != DLE_CHARSET) { $user['useragent'] = iconv(VB_CHARSET, DLE_CHARSET, $user['useragent']); $user['location'] = iconv(VB_CHARSET, DLE_CHARSET, $user['location']); $user['username'] = iconv(VB_CHARSET, DLE_CHARSET, $user['username']); } if ($user['userid'] == 0) { $current_robot = $this->_robots($user['useragent']); if ($current_robot != "") { $robots[$current_robot]['name'] = $current_robot; $robots[$current_robot]['lastactivity'] = $user['lastactivity']; $robots[$current_robot]['host'] = $user['host']; $robots[$current_robot]['location'] = $user['location']; } else { $guests++; } } else { $users[$user['userid']]['username'] = $user['username']; $users[$user['userid']]['lastactivity'] = $user['lastactivity']; $users[$user['userid']]['useragent'] = $user['useragent']; $users[$user['userid']]['host'] = $user['host']; $users[$user['userid']]['location'] = $user['location']; } } $location_array = array("%addcomments%" => $this->lang['paddcomments'], "%readnews%" => $this->lang['preadnews'], "%incategory%" => $this->lang['pincategory'], "%posin%" => $this->lang['pposin'], "%mainpage%" => $this->lang['pmainpage'], "%view_pofile%" => $this->lang['view_profile'], "%newposts%" => $this->lang['newposts'], "%view_stats%" => $this->lang['view_stats']); if (count($users)) { foreach ($users as $id => $value) { if ($GLOBALS['member_id']['user_group'] == 1) { $user_array[$value['username']] = $this->lang['os'] . $this->_os($users[$id]['useragent']) . '<br />' . $this->lang['browser'] . $this->_browser($users[$id]['useragent']) . '<br />' . '<b>IP:</b> ' . $users[$id]['host'] . '<br />'; } $user_array[$value['username']] .= $this->lang['was'] . $this->_timeagos($users[$id]['lastactivity']) . $this->lang['back'] . '<br />' . $this->lang['location']; if (preg_match("'%(.*?)%'si", $users[$id]['location'])) { foreach ($location_array as $find => $replace) { $users[$id]['location'] = str_replace($find, $replace, $users[$id]['location']); } } else { $users[$id]['location'] = $this->lang['pforum']; } $user_array[$value['username']] .= $users[$id]['location'] . "<br/>"; $descr = $user_array[$value['username']]; $user_array[$value['username']] = array(); $user_array[$value['username']]['descr'] = $descr; $user_array[$value['username']]['id'] = $id; $count_user++; } } if (count($robots)) { foreach ($robots as $name => $value) { if ($GLOBALS['member_id']['user_group'] == 1) { $robot_array[$name] = $this->lang['os'] . $this->_os($robots[$name]['useragent']) . '<br />' . $this->lang['browser'] . $this->_browser($robots[$name]['useragent']) . '<br />' . '<b>IP:</b> ' . $robots[$name]['host'] . '<br />'; } $robot_array[$name] .= $this->lang['was'] . $this->_timeagos($robots[$name]['lastactivity']) . $this->lang['back'] . '<br />' . $this->lang['location']; if (preg_match("'%(.*?)%'si", $robots[$name]['location'])) { foreach ($location_array as $find => $replace) { $robots[$name]['location'] = str_replace($find, $replace, $robots[$name]['location']); } } else { $robots[$name]['location'] = $this->lang['pforum']; } $robot_array[$name] .= $robots[$name]['location'] . "<br/>"; $count_robots++; } } $users = ""; $i = 0; if (count($user_array)) { foreach ($user_array as $name => $a) { $desc = $a['descr']; $id = $a['id']; if ($i) { $users .= $this->config['separator']; } $desc = htmlspecialchars($desc, ENT_QUOTES); if (!$this->config['vb_block_online_user_link_forum']) { $user_url = $GLOBALS['config']['allow_alt_url'] == "yes" ? $GLOBALS['config']['http_home_url'] . "user/" . urlencode($name) . "/" : $PHP_SELF . "?subaction=userinfo&user="******"/member.php?u=" . $id; } $users .= "<a onmouseover=\"showhint('{$desc}', this, event, '180px');\" href=\"" . $user_url . "\" >" . $name . "</a>"; $i++; } } else { $users = $this->lang['notusers']; } $robots = ""; $i = 0; if (count($robot_array)) { foreach ($robot_array as $name => $desc) { if ($i) { $robots .= $this->config['separator']; } $desc = htmlspecialchars($desc, ENT_QUOTES); $robots .= "<span onmouseover=\"showhint('{$desc}', this, event, '180px');\" style=\"cursor:hand;\" >" . $name . "</span>"; $i++; } } else { $robots = $this->lang['notbots']; } $tpl->load_template('block_online.tpl'); $tpl->set('{users}', $count_user); $tpl->set('{guest}', $guests); $tpl->set('{robots}', $count_robots); $tpl->set('{all}', $count_user + $guests + $count_robots); $tpl->set('{userlist}', $users); $tpl->set('{botlist}', $robots); $tpl->compile('block_online'); $tpl->clear(); if ($this->config['block_online_cache_time'] && function_exists('create_cache')) { create_cache("vb_block_online_cache", $tpl->result['block_online']); set_vars('vb_block_online_cache_time', time()); } } else { $tpl->result['block_online'] = $cache; } }
$tpl->set('{news_week}', $stats_week); $tpl->set('{news_month}', $stats_month); $tpl->set('{comm_day}', $comments_day); $tpl->set('{comm_week}', $comments_week); $tpl->set('{comm_month}', $comments_month); $tpl->set('{user_day}', $user_day); $tpl->set('{user_week}', $user_week); $tpl->set('{user_month}', $user_month); $db->query("SELECT user_id, name, user_group, reg_date, lastdate, news_num, comm_num FROM " . USERPREFIX . "_users WHERE news_num > '0' ORDER BY news_num DESC LIMIT 0,10"); $top_table = "<thead><tr><td>{$lang['top_name']}</td><td align=\"center\">{$lang['top_status']}</td><td align=\"center\">{$lang['top_reg']}</td><td align=\"center\">{$lang['top_last']}</td><td align=\"center\">{$lang['top_nnum']}</td><td align=\"center\">{$lang['top_cnum']}</td><td align=\"center\">{$lang['top_pm']}</td></tr></thead>"; while ($row = $db->get_row()) { $registration = langdate($config['timestamp_active'], $row['reg_date']); $last = langdate($config['timestamp_active'], $row['lastdate']); if ($config['allow_alt_url']) { $user_name = $config['http_home_url'] . "user/" . urlencode($row['name']) . "/"; $user_name = "onclick=\"ShowProfile('" . urlencode($row['name']) . "', '" . htmlspecialchars($user_name, ENT_QUOTES, $config['charset']) . "', '" . $user_group[$member_id['user_group']]['admin_editusers'] . "'); return false;\""; $user_name = "<a {$user_name} class=\"pm_list\" href=\"" . $config['http_home_url'] . "user/" . urlencode($row['name']) . "/\">" . $row['name'] . "</a>"; } else { $user_name = "{$PHP_SELF}?subaction=userinfo&user="******"onclick=\"ShowProfile('" . urlencode($row['name']) . "', '" . htmlspecialchars($user_name, ENT_QUOTES, $config['charset']) . "', '" . $user_group[$member_id['user_group']]['admin_editusers'] . "'); return false;\""; $user_name = "<a {$user_name} class=\"pm_list\" href=\"{$PHP_SELF}?subaction=userinfo&user="******"\">" . $row['name'] . "</a>"; } $user_pm = "<a href=\"{$PHP_SELF}?do=pm&doaction=newpm&user="******"\">{$lang['top_pm']}</a>"; $top_table .= "<tr><td>{$user_name}</td><td align=\"center\">{$user_group[$row['user_group']]['group_prefix']}{$user_group[$row['user_group']]['group_name']}{$user_group[$row['user_group']]['group_suffix']}</td><td align=\"center\">{$registration}</td><td align=\"center\">{$last}</td><td align=\"center\">{$row['news_num']}</td><td align=\"center\">{$row['comm_num']}</td><td align=\"center\">[ {$user_pm} ]</td></tr>"; } $db->free(); $tpl->set('{topusers}', $top_table); $tpl->compile('content'); $tpl->clear(); create_cache("stats", $tpl->result['content'], $config['skin'], true); }
function custom_users($matches = array()) { global $db, $_TIME, $config, $lang, $user_group, $user_conf, $news_date, $member_id, $nav; if (!count($matches)) { return ""; } $yes_no_map = array("yes" => "1", "no" => "0"); $param_str = trim($matches[1]); $thisdate = strtotime(date("Y-m-d H:i:s", $_TIME)); $where = array(); if (preg_match("#template=['\"](.+?)['\"]#i", $param_str, $match)) { $comm_tpl = trim($match[1]); } else { return ""; } if (preg_match("#id=['\"](.+?)['\"]#i", $param_str, $match)) { $temp_array = array(); $where_id = array(); $match[1] = explode(',', trim($match[1])); foreach ($match[1] as $value) { if (count(explode('-', $value)) == 2) { $value = explode('-', $value); $where_id[] = "u.user_id >= '" . intval($value[0]) . "' AND u.user_id <= '" . intval($value[1]) . "'"; } else { $temp_array[] = intval($value); } } if (count($temp_array)) { $where_id[] = "u.user_id IN ('" . implode("','", $temp_array) . "')"; } if (count($where_id)) { $custom_id = implode(' OR ', $where_id); $where[] = $custom_id; } } if (preg_match("#group=['\"](.+?)['\"]#i", $param_str, $match)) { $temp_array = array(); $where_id = array(); $match[1] = explode(',', trim($match[1])); foreach ($match[1] as $value) { if (count(explode('-', $value)) == 2) { $value = explode('-', $value); $where_id[] = "u.user_group >= '" . intval($value[0]) . "' AND u.user_group <= '" . intval($value[1]) . "'"; } else { $temp_array[] = intval($value); } } if (count($temp_array)) { $where_id[] = "u.user_group IN ('" . implode("','", $temp_array) . "')"; } if (count($where_id)) { $custom_id = implode(' OR ', $where_id); $where[] = $custom_id; } } if (preg_match("#online=['\"](.+?)['\"]#i", $param_str, $match)) { if ($match[1] == "yes") { $where[] = "u.lastdate+1200 > {$_TIME} "; } else { $where[] = "u.lastdate+1200 <= {$_TIME} "; } } if (preg_match("#from=['\"](.+?)['\"]#i", $param_str, $match)) { $user_from = intval($match[1]); $custom_all = $custom_from; } else { $user_from = 0; $custom_all = 0; } if (preg_match("#limit=['\"](.+?)['\"]#i", $param_str, $match)) { $user_limit = intval($match[1]); } else { $user_limit = $config['comm_nummers']; } if (preg_match("#order=['\"](.+?)['\"]#i", $param_str, $match)) { $allowed_order = array('news' => 'news_num', 'comment' => 'comm_num', 'group' => 'user_group', 'lastdate' => 'lastdate', 'regdate' => 'reg_date', 'nick' => 'name', 'rand' => 'RAND()'); if ($allowed_order[$match[1]]) { $user_order = $allowed_order[$match[1]]; } } if (!$user_order) { $user_order = "reg_date"; } if (preg_match("#sort=['\"](.+?)['\"]#i", $param_str, $match)) { $allowed_sort = array('asc' => 'ASC', 'desc' => 'DESC'); if ($allowed_sort[$match[1]]) { $user_sort = $allowed_sort[$match[1]]; } } if (!$user_sort) { $user_order = "ASC"; } if (preg_match("#cache=['\"](.+?)['\"]#i", $param_str, $match)) { $user_cache = $yes_no_map[$match[1]]; } else { $user_cache = "0"; } if (preg_match("#not=['\"](.+?)['\"]#i", $param_str, $match)) { $not_found = $db->safesql($match[1]); } else { $not_found = ""; } if (preg_match("#friends=['\"](.+?)['\"]#i", $param_str, $match)) { $fids = array(); if ($match[1] == "current") { $friend_que = $db->query("SELECT friend_id FROM " . PREFIX . "_users_friends WHERE user_id = '{$member_id['user_id']}' AND approve = '1'"); while ($row = $db->get_row($friend_que)) { $fids[] = $row['friend_id']; } } else { if ($match[1] == "profile") { $friend_que = $db->query("SELECT f.friend_id FROM " . PREFIX . "_users_friends f LEFT JOIN " . PREFIX . "_users u ON ( u.user_id = f.user_id ) WHERE u.name = '{$_REQUEST['user']}' AND f.approve = '1'"); while ($row = $db->get_row($friend_que)) { $fids[] = $row['friend_id']; } } } if (count($fids) > 0) { $where[] = "u.user_id IN ('" . implode("','", $fids) . "')"; } else { $where[] = "u.user_id = '0'"; } } else { $user_friends = false; } if (preg_match("#xfield=['\"](.+?)['\"]#i", $param_str, $match)) { $_temp = explode(",", $match[1]); $_rules = array(); foreach ($_temp as $_temp2) { if (strpos($_temp2, "this.") !== False && isset($member_id)) { $_temp3 = explode(":", $_temp2); $_temp4 = trim(str_replace("this.", "", $_temp3[1])); unset($_temp3); $_thisxf = xfieldsdataload($member_id['xfields']); if (array_key_exists($_temp4, $_thisxf)) { $_rules[] = "u.xfields LIKE '%" . $_temp4 . "|" . $_thisxf[$_temp4] . "%'"; } } else { $_rules[] = "u.xfields LIKE '%" . str_replace(":", "|", $_temp2) . "%'"; } } if (count($_rules) > 0) { $where[] = "( " . implode(" AND ", $_rules) . " )"; $use_xfield = True; } } else { $use_xfield = False; } $user_yes = false; $user_cols = array("email", "name", "user_id", "news_num", "comm_num", "user_group", "lastdate", "reg_date", "signature", "foto", "fullname", "land", "logged_ip"); if ($user_conf['sel_xfields']) { $user_cols[] = "xfields"; } $_WHERE = count($where) > 0 ? " WHERE " . implode(' AND ', $where) : ""; $build_navigation = false; if (isset($_GET['cstart'])) { $cstart = intval($_GET['cstart']); } else { $cstart = 0; } if (preg_match("#navigation=['\"](.+?)['\"]#i", $param_str, $match)) { if ($match[1] == "yes" and $url_page !== false) { $build_navigation = true; $custom_limit = $user_limit; //if ( $cstart > 10 ) $config['allow_cache'] = false; if ($cstart) { $cstart = $cstart - 1; $cstart = $cstart * $custom_limit + $user_from; $user_from = $cstart; } $count_que = $db->super_query("SELECT COUNT(u.name) as total FROM " . PREFIX . "_users u{$_WHERE} ORDER BY {$user_order} {$user_sort}"); $count_all = $count_que['total']; } else { $build_navigation = false; } } else { $build_navigation = false; } $user_sql = "SELECT u." . implode(", u.", $user_cols) . " FROM " . PREFIX . "_users u{$_WHERE} ORDER BY {$user_order} {$user_sort} LIMIT {$user_from},{$user_limit}"; $user_que = $db->query($user_sql); if ($user_cache) { $user_cacheid = $param_str . $user_sql . $member_id['user_group'] . $build_navigation . $cstart . implode("|", $user_conf); $cache_content = dle_cache("news_ucustom", $user_cacheid, true); } else { $cache_content = false; } if (!$cache_content) { $tpl = new dle_template(); $tpl->dir = TEMPLATE_DIR; // Build navigation - start $url_page =& $nav['url_page']; $user_query =& $nav['user_query']; if ($build_navigation and $count_all) { $tpl->load_template('navigation.tpl'); $no_prev = false; $no_next = false; if (isset($_GET['cstart'])) { $cstart = intval($_GET['cstart']); } else { $cstart = 1; } if (isset($cstart) and $cstart != "" and $cstart > 1) { $prev = $cstart - 1; if ($config['allow_alt_url']) { $prev_page = $prev == 1 ? $url_page . "/" : $url_page . "/page/" . $prev . "/"; $tpl->set_block("'\\[prev-link\\](.*?)\\[/prev-link\\]'si", "<a href=\"" . $prev_page . "\">\\1</a>"); } else { $prev_page = $prev == 1 ? $PHP_SELF . "?" . $user_query : $PHP_SELF . "?cstart=" . $prev . "&" . $user_query; $tpl->set_block("'\\[prev-link\\](.*?)\\[/prev-link\\]'si", "<a href=\"" . $prev_page . "\">\\1</a>"); } } else { $tpl->set_block("'\\[prev-link\\](.*?)\\[/prev-link\\]'si", "<span>\\1</span>"); $no_prev = TRUE; } if ($custom_limit) { $pages = ""; if ($count_all > $custom_limit) { $enpages_count = @ceil($count_all / $custom_limit); if ($enpages_count <= 10) { for ($j = 1; $j <= $enpages_count; $j++) { if ($j != $cstart) { if ($config['allow_alt_url']) { $pages .= $j == 1 ? "<a href=\"" . $url_page . "/\">{$j}</a> " : "<a href=\"" . $url_page . "/page/" . $j . "/\">{$j}</a>"; } else { $pages .= $j == 1 ? "<a href=\"{$PHP_SELF}?{$user_query}\">{$j}</a> " : "<a href=\"{$PHP_SELF}?{$user_query}&cstart={$j}\">{$j}</a>"; } } else { $pages .= "<span>{$j}</span> "; } } } else { $start = 1; $end = 10; $nav_prefix = "<span class=\"nav_ext\">{$lang['nav_trennen']}</span> "; if ($cstart > 0) { if ($cstart > 6) { $start = $cstart - 4; $end = $start + 8; if ($end >= $enpages_count) { $start = $enpages_count - 9; $end = $enpages_count - 1; $nav_prefix = ""; } else { $nav_prefix = "<span class=\"nav_ext\">{$lang['nav_trennen']}</span> "; } } } if ($start >= 2) { $pages .= $config['allow_alt_url'] ? "<a href=\"" . $url_page . "/\">1</a> <span class=\"nav_ext\">{$lang['nav_trennen']}</span> " : "<a href=\"{$PHP_SELF}?{$user_query}\">1</a> <span class=\"nav_ext\">{$lang['nav_trennen']}</span> "; } for ($j = $start; $j <= $end; $j++) { if ($j != $cstart) { if ($config['allow_alt_url']) { $pages .= $j == 1 ? "<a href=\"" . $url_page . "/\">{$j}</a> " : "<a href=\"" . $url_page . "/page/" . $j . "/\">{$j}</a> "; } else { $pages .= $j == 1 ? "<a href=\"{$PHP_SELF}?{$user_query}\">{$j}</a> " : "<a href=\"{$PHP_SELF}?{$user_query}&cstart={$j}\">{$j}</a> "; } } else { $pages .= "<span>{$j}</span> "; } } if ($cstart != $enpages_count) { $pages .= $config['allow_alt_url'] ? $nav_prefix . "<a href=\"" . $url_page . "/page/{$enpages_count}/\">{$enpages_count}</a>" : $nav_prefix . "<a href=\"{$PHP_SELF}?{$user_query}&cstart={$enpages_count}\">{$enpages_count}</a>"; } else { $pages .= "<span>{$enpages_count}</span> "; } } } $tpl->set('{pages}', $pages); } if ($custom_limit and $custom_limit < $count_all and $cstart < $enpages_count) { $next_page = $cstart + 1; $next = $config['allow_alt_url'] ? $url_page . '/page/' . $next_page . '/' : $PHP_SELF . "?" . $user_query . "&cstart=" . $next_page; $tpl->set_block("'\\[next-link\\](.*?)\\[/next-link\\]'si", "<a href=\"" . $next . "\">\\1</a>"); } else { $tpl->set_block("'\\[next-link\\](.*?)\\[/next-link\\]'si", "<span>\\1</span>"); $no_next = TRUE; } if (!$no_prev or !$no_next) { $tpl->compile('navi'); } $tpl->clear(); } // Build navigation - end $tpl->load_template($comm_tpl . '.tpl'); while ($user_row = $db->get_row($user_que)) { $user_yes = true; $news_row = false; if ($user_conf['sel_news_info']) { $news_row = $db->super_query("SELECT id, title, category, alt_name, date FROM " . PREFIX . "_post WHERE autor = '{$user_row['name']}' ORDER BY date DESC LIMIT 0,1"); if ($news_row) { if (preg_match("#\\{news-title limit=['\"](.+?)['\"]\\}#i", $tpl->copy_template, $matches)) { $count = intval($matches[1]); $tpl->set($matches[0], user_title($count, $news_row['title'])); } else { $tpl->set('{news-title}', strip_tags(stripslashes($news_row['title']))); } $tpl->set('{news-link}', user_fulllink($news_row['post_id'], $news_row['category'], $news_row['alt_name'], $news_row['pdate'])); $tpl->set('{news-cat}', get_categories($news_row['category'])); $news_date = strtotime($news_row['date']); $tpl->copy_template = preg_replace_callback("#\\{news-date=(.+?)\\}#i", "user_formdate", $tpl->copy_template); $tpl->set('{news-date}', $news_row['date']); $tpl->set('{news-id}', $news_row['id']); } } if ($user_row['lastdate'] + 1200 > $_TIME) { $tpl->set('[online]', ""); $tpl->set('[/online]', ""); $tpl->set_block("'\\[offline\\](.*?)\\[/offline\\]'si", ""); } else { $tpl->set('[offline]', ""); $tpl->set('[/offline]', ""); $tpl->set_block("'\\[online\\](.*?)\\[/online\\]'si", ""); } $news_date = $user_row['reg_date']; $tpl->copy_template = preg_replace_callback("#\\{reg-date=(.+?)\\}#i", "user_formdate", $tpl->copy_template); $tpl->set('{reg-date}', date("d.m.Y H:i:s", $news_date)); $news_date = $user_row['lastdate']; $tpl->copy_template = preg_replace_callback("#\\{last-date=(.+?)\\}#i", "user_formdate", $tpl->copy_template); $tpl->set('{last-date}', date("d.m.Y H:i:s", $news_date)); if (count(explode("@", $user_row['foto'])) == 2) { $tpl->set('{foto}', 'http://www.gravatar.com/avatar/' . md5(trim($user_row['foto'])) . '?s=' . intval($user_group[$user_row['user_group']]['max_foto'])); } else { if ($user_row['foto'] && $config['version_id'] < "10.5") { if (file_exists(ROOT_DIR . "/uploads/fotos/" . $user_row['foto'])) { $tpl->set('{foto}', $config['http_home_url'] . "uploads/fotos/" . $comm_row['foto']); } else { $tpl->set('{foto}', "{THEME}/dleimages/noavatar.png"); } } else { if ($user_row['foto'] && $config['version_id'] >= "10.5") { $tpl->set('{foto}', $user_row['foto']); } else { $tpl->set('{foto}', "{THEME}/dleimages/noavatar.png"); } } } if ($user_conf['sel_xfields']) { $xf = xfieldsdataload($user_row['xfields']); foreach ($xf as $xf_key => $xf_val) { $xf_key = preg_quote($xf_key, "'"); $tpl->set("{xfield-" . $xf_key . "}", $xf_val); } } else { $tpl->set_block("'{xfield-(.*?)}'si", ""); } $tpl->set("{name}", $user_row['name']); $tpl->set("{name-colored}", $user_group[$user_row['user_group']]['group_prefix'] . $user_row['name'] . $user_group[$user_row['user_group']]['group_suffix']); $tpl->set("{name-url}", $config['allow_alt_url'] ? $config['http_home_url'] . "user/" . urlencode($user_row['name']) : $config['http_home_url'] . "index.php?subaction=userinfo&user="******"{name-popup}", $config['allow_alt_url'] ? "ShowProfile('" . urlencode($user_row['name']) . "', '" . $config['http_home_url'] . "user/" . urlencode($user_row['name']) . "/', '1'); return false;" : "ShowProfile('" . urlencode($user_row['name']) . "', '" . $config['http_home_url'] . "index.php?subaction=userinfo&user="******"', '0'); return false;"); $tpl->set("{allnews-url}", $config['allow_alt_url'] ? $config['http_home_url'] . "user/" . urlencode($user_row['name']) . "/news/" : $config['http_home_url'] . "index.php?subaction=allnews&user="******"{allcomm-url}", $config['http_home_url'] . "index.php?do=lastcomments&userid=" . urlencode($user_row['user_id'])); $tpl->set("{pm-url}", $config['http_home_url'] . "index.php?do=pm&doaction=newpm&user="******"{email-url}", $config['http_home_url'] . "index.php?do=feedback&user="******"{news-num}", intval($user_row['news_num'])); $tpl->set("{comm-num}", intval($user_row['comm_num'])); $tpl->set("{email}", $user_row['email']); $tpl->set("{ip}", $user_row['logged_ip']); $tpl->set("{id}", $user_row['user_id']); $tpl->set("{land}", $user_row['land']); $tpl->set('{info}', $user_row['info']); $tpl->set('{sign}', $user_row['signature']); $tpl->set("{full-name}", $user_row['fullname']); $tpl->set("{group}", $user_group[$user_row['user_group']]['group_name']); $tpl->set("{group-id}", $user_group[$user_row['user_group']]['id']); $tpl->set("{group-colored}", $user_group[$user_row['user_group']]['group_prefix'] . $user_group[$user_row['user_group']]['group_name'] . $user_group[$user_row['user_group']]['group_suffix']); $tpl->set("{group-icon}", $user_group[$user_row['user_group']]['icon']); $tpl->compile("content"); $tpl->result['content'] = preg_replace("#\\{xfield-(.*?)\\}#is", "", $tpl->result['content']); $tpl->result['content'] = preg_replace("#\\[user-group=" . $user_row['user_group'] . "\\](.*?)\\[/user-group\\]#is", "\\1", $tpl->result['content']); $tpl->result['content'] = preg_replace("#\\[user-group=([0-9])\\](.*?)\\[/user-group\\]#is", "", $tpl->result['content']); $tpl->result['content'] = preg_replace("#\\[news\\](.*?)\\[/news\\]#is", $news_row != false ? "\\1" : "", $tpl->result['content']); } if (!$user_yes) { $tpl->result['content'] = $not_found; } if ($build_navigation) { $tpl->result['content'] = $tpl->result['content'] . $tpl->result['navi']; } $tpl->result['content'] = str_replace("{THEME}", $config['http_home_url'] . "templates/" . $config['skin'] . "/", $tpl->result['content']); if ($user_cache) { create_cache("news_ucustom", $tpl->result['content'], $user_cacheid, true); } return $tpl->result['content']; } else { return $cache_content; } }