本文整理汇总了PHP中dle_cache函数的典型用法代码示例。如果您正苦于以下问题:PHP dle_cache函数的具体用法?PHP dle_cache怎么用?PHP dle_cache使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了dle_cache函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: RatesUsers
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=" . $row['name'], "{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;
}
}
示例2: implode
}
}
}
$tpl->result['tags_cloud'] = implode(", ", $tags);
$row = $db->super_query("SELECT FOUND_ROWS() as count");
if ($row['count'] >= 40) {
if ($config['allow_alt_url'] == "yes") {
$tpl->result['tags_cloud'] .= "<br /><br /><a href=\"" . $config['http_home_url'] . "tags/\">" . $lang['all_tags'] . "</a>";
} else {
$tpl->result['tags_cloud'] .= "<br /><br /><a href=\"{$PHP_SELF}?do=tags\">" . $lang['all_tags'] . "</a>";
}
}
create_cache("tagscloud", $tpl->result['tags_cloud'], $config['skin']);
}
if ($do == "alltags") {
$tpl->result['content'] = dle_cache("alltagscloud", $config['skin']);
if (!$tpl->result['content']) {
$tpl->load_template('tagscloud.tpl');
$counts = array();
$tags = array();
$list = array();
$sizes = array("clouds_xsmall", "clouds_small", "clouds_medium", "clouds_large", "clouds_xlarge");
$min = 1;
$max = 1;
$range = 1;
$limit = false;
if (preg_match("#\\{tags limit=['\"](.+?)['\"]\\}#i", $tpl->copy_template, $matches)) {
$limit = true;
$sql_select = "SELECT tag, COUNT(*) AS count FROM " . PREFIX . "_tags GROUP BY tag ORDER BY count DESC LIMIT 0," . intval($matches[1]);
} else {
$sql_select = "SELECT tag, COUNT(*) AS count FROM " . PREFIX . "_tags GROUP BY tag";
示例3: Start
//.........这里部分代码省略.........
$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 {
示例4: dle_cache
$active = dle_cache("rss", $category_id, false);
}
} else {
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 (isset($_SESSION['dle_no_cache']) and $_SESSION['dle_no_cache']) {
$config['allow_cache'] = false;
}
if ($cstart) {
$cache_id = $cstart / $config['news_number'] + 1;
} else {
$cache_id = "1";
}
if ($cache_id < 6 and !isset($_POST['login'])) {
$active = dle_cache("news", $cache_id . $cache_prefix, true);
} else {
$active = false;
}
}
if ($active) {
$tpl->result['content'] .= $active;
$active = null;
if ($config['allow_quick_wysiwyg'] and ($user_group[$member_id['user_group']]['allow_edit'] or $user_group[$member_id['user_group']]['allow_all_edit'])) {
$allow_comments_ajax = true;
} else {
$allow_comments_ajax = false;
}
} else {
include_once ENGINE_DIR . '/modules/show.short.php';
if (!$config['allow_quick_wysiwyg']) {
示例5: build_comments
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";
}
//.........这里部分代码省略.........
示例6: block_online
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++;
//.........这里部分代码省略.........
示例7: lastTopics
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'];
}
示例8: DAYOFMONTH
$sql = "SELECT DISTINCT DAYOFMONTH(date) as day FROM " . PREFIX . "_post WHERE date >= '{$this_year}-{$this_month}-01' AND date < '{$this_year}-{$this_month}-01' + INTERVAL 1 MONTH AND approve=1" . $where_date;
}
if ($sql != "") {
$db->query($sql);
while ($row = $db->get_row()) {
$events[$row['day']] = strtotime($this_year . "-" . $this_month . "-" . $row['day']);
}
$db->free();
}
$tpl->result['calendar'] = cal($this_month, $this_year, $events);
create_cache("calendar", $tpl->result['calendar'], $cache_id);
}
}
# Выводим архивы
if ($config['allow_archives'] == "yes") {
$tpl->result['archive'] = dle_cache("archives", $config['skin']);
if (!$tpl->result['archive']) {
$f2 = array('01', '02', '03', '04', '05', '06', '07', '08', '09', '10', '11', '12');
$f3 = array('Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec');
if ($config['no_date'] and !$config['news_future']) {
$thisdate = date("Y-m-d H:i:s", $_TIME);
$where_date = " AND date < '" . $thisdate . "'";
} else {
$where_date = "";
}
$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']);
示例9: Copyright
-----------------------------------------------------
http://dle-news.ru/
-----------------------------------------------------
Copyright (c) 2004,2015 SoftNews Media Group
=====================================================
Данный код защищен авторскими правами
=====================================================
Файл: topnews.php
-----------------------------------------------------
Назначение: вывод рейтинговых статей
=====================================================
*/
if (!defined('DATALIFEENGINE')) {
die("Hacking attempt!");
}
$tpl->result['topnews'] = dle_cache("topnews", $config['skin'], true);
if ($tpl->result['topnews'] === false) {
$this_month = date('Y-m-d H:i:s', $_TIME);
$tpl->load_template('topnews.tpl');
if (strpos($tpl->copy_template, "[xfvalue_") !== false or strpos($tpl->copy_template, "[xfgiven_") !== false) {
$xfound = true;
$xfields = xfieldsload();
} else {
$xfound = false;
}
$config['top_number'] = intval($config['top_number']);
if ($config['top_number'] < 1) {
$config['top_number'] = 10;
}
$db->query("SELECT p.id, p.date, p.short_story, p.xfields, p.title, p.category, p.alt_name FROM " . PREFIX . "_post p LEFT JOIN " . PREFIX . "_post_extras e ON (p.id=e.news_id) WHERE p.approve=1 AND p.date >= '{$this_month}' - INTERVAL 1 MONTH AND p.date < '{$this_month}' ORDER BY rating DESC, comm_num DESC, news_read DESC, date DESC LIMIT 0,{$config['top_number']}");
while ($row = $db->get_row()) {
示例10: foreach
$temp[$value['tag']][$i]['dmax'] = $value['dmax'];
$temp[$value['tag']][$i]['rss_date_format'] = $value['rss_date_format'];
}
$i++;
}
foreach ($temp as $key => $value) {
$r_key = array_rand($temp[$key]);
$temp[$key] = $temp[$key][$r_key];
}
$informers = array();
foreach ($temp as $key => $value) {
if ($value['url'] == "") {
$informers[$value['tag']] = "";
continue;
}
$buffer = dle_cache("informer_" . $value['id'], $config['skin']);
if ($buffer !== false) {
$file_date = @filemtime(ENGINE_DIR . '/cache/informer_' . $value['id'] . '_' . md5($config['skin']) . '.tmp');
if ($file_date) {
if (date("d-H", $file_date) != date("d-H")) {
$buffer = false;
@unlink(ENGINE_DIR . '/cache/informer_' . $value['id'] . '_' . md5($config['skin']) . '.tmp');
}
}
}
if ($buffer === false) {
include_once ENGINE_DIR . '/classes/rss.class.php';
$xml = new xmlParser(stripslashes($value['url']), $value['news_max']);
$xml->pre_parse(0);
$tpl->load_template($value['template'] . '.tpl');
foreach ($xml->content as $content) {
示例11: elseif
$name = "komanda";
$uvalue = $komanda;
$count_all = $total->GetCount("(komanda1='{$komanda}' OR komanda2='{$komanda}')", "matches");
} elseif ($stats) {
$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'];
示例12: intval
$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) {
$send_js = "";
if ($member_id['restricted_days'] > 0) {
$end_restricted = langdate("j M Y H:i", $member_id['restricted_date']);
} else {
$end_restricted = "пожизнено";
}
$send_fr = "<div id=\"mchat-style\" style=\"padding: 1px; text-align: center;\">Режим \"Только чтение\" до:<br>{$end_restricted}</div>";
} else {
$send_js = <<<HTML
示例13: custom_print
//.........这里部分代码省略.........
$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'];
}
}
示例14: runBlockPro
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 ' : '';
//.........这里部分代码省略.........
示例15: custom_print
//.........这里部分代码省略.........
$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'];
}
}