当前位置: 首页>>代码示例>>PHP>>正文


PHP create_cache函数代码示例

本文整理汇总了PHP中create_cache函数的典型用法代码示例。如果您正苦于以下问题:PHP create_cache函数的具体用法?PHP create_cache怎么用?PHP create_cache使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了create_cache函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: date

        $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);
开发者ID:jeppester,项目名称:dilbert-proxy,代码行数:31,代码来源:dilbert-proxy.php

示例2: custom_print

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'];
}
开发者ID:Hadryan,项目名称:L2LWEB,代码行数:77,代码来源:functions.php

示例3: build_comments

 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=" . urlencode($row['name']);
                     $tpl->set('[profile]', "<a href=\"{$PHP_SELF}?subaction=userinfo&amp;user=" . urlencode($row['name']) . "\">");
                 }
                 $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&amp;user=" . urlencode($row['name']) . "\">" . $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&amp;action=comm_edit&amp;id=" . $row['id'] . "&amp;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", "");
//.........这里部分代码省略.........
开发者ID:Hadryan,项目名称:L2LWEB,代码行数:101,代码来源:comments.class.php

示例4: 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'];
 }
开发者ID:dautushenka,项目名称:dle-xenforo,代码行数:66,代码来源:XenIntegration.php

示例5: foreach

        }
        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&amp;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;
}
开发者ID:Hadryan,项目名称:L2LWEB,代码行数:31,代码来源:tagscloud.php

示例6: dropdownmenu

                $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;
开发者ID:n0wheremany,项目名称:Block.Pro.2,代码行数:31,代码来源:block.pro.2.php

示例7: create_cache

        } 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) {
开发者ID:skypach,项目名称:skypach.ru,代码行数:31,代码来源:mchat.php

示例8: saveNav

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"]);
}
开发者ID:tanny2015,项目名称:DataStructure,代码行数:18,代码来源:nav.php

示例9: runBlockPro


//.........这里部分代码省略.........
					$go_page = $PHP_SELF.'?subaction=userinfo&amp;user='.urlencode($newsItem['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);

			
		}
开发者ID:n0wheremany,项目名称:Block.Pro.3,代码行数:101,代码来源:block.pro.3.php

示例10: 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'];
    }
}
开发者ID:Banych,项目名称:SiteCreate,代码行数:101,代码来源:functions.php

示例11: switch

$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 
开发者ID:tanny2015,项目名称:DataStructure,代码行数:31,代码来源:categories.php

示例12: 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'];
    }
}
开发者ID:Gordondalos,项目名称:union,代码行数:101,代码来源:functions.php

示例13: block_online


//.........这里部分代码省略.........
                 }
             } 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>&nbsp;' . $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>&nbsp;' . $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;
 }
开发者ID:dautushenka,项目名称:dle-ipb3,代码行数:101,代码来源:dle_vs_ipb3.php

示例14: 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']}&nbsp;<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>&nbsp;&nbsp;<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";
     }
//.........这里部分代码省略.........
开发者ID:Gordondalos,项目名称:union,代码行数:101,代码来源:comments.class.php

示例15: while

    $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'];
开发者ID:dautushenka,项目名称:Totalizator,代码行数:31,代码来源:totalizator.php


注:本文中的create_cache函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。