Exemple #1
0
function hottags_recache()
{
    global $DMC, $DBPrefix, $settingInfo, $strTagsCount, $strHotTags, $arrSideModule;
    //取得标签数量
    $arr_result = $DMC->fetchArray($DMC->query("select count(id) as count from " . $DBPrefix . "tags"));
    $tags_count = $arr_result['count'];
    //取得显示标签数量
    if ($settingInfo['tagNums'] < $tags_count) {
        $limit = $settingInfo['tagNums'];
    } else {
        $limit = $tags_count;
    }
    if ($limit < 1) {
        $limit = 50;
    }
    //保存标签最大最小数
    $arr_result = $DMC->fetchArray($DMC->query("select max(logNums) as max,min(logNums) as min from " . $DBPrefix . "tags"));
    if ($arr_result['max'] == "") {
        $arr_result['max'] = 0;
    }
    if ($arr_result['min'] == "") {
        $arr_result['min'] = 0;
    }
    if ($settingInfo['rewrite'] == 0) {
        $gourl = "index.php?job=tags&amp;seekname=";
    }
    if ($settingInfo['rewrite'] == 1) {
        $gourl = "rewrite.php/tags-";
    }
    if ($settingInfo['rewrite'] == 2) {
        $gourl = "tags-";
    }
    foreach ($arrSideModule as $key => $value) {
        if (!empty($value['name']) && $value['name'] == "hotTags") {
            $sidename = $value['name'];
            $sidetitle = $value['modTitle'];
            $isInstall = $value['isInstall'];
            break;
        }
    }
    $out_contents = create_sidebar_header("HotTags", $arrSideModule["hotTags"]["modTitle"], $arrSideModule["hotTags"]["isInstall"]);
    $result = $DMC->query("select * from " . $DBPrefix . "tags order by logNums desc limit 0,{$limit}");
    while ($my = $DMC->fetchArray($result)) {
        $curColor = getTagHot($my['logNums'], $arr_result['max'], $arr_result['min']);
        $strDayLog = $strTagsCount . ": " . $my['logNums'];
        $out_contents .= "\t<a href=\"{$gourl}" . urlencode($my['name']) . "{$settingInfo['stype']}\" style=\"color:{$curColor}\" title=\"{$strDayLog}\">" . $my['name'] . "</a> \n";
    }
    $out_contents .= create_sidebar_footer();
    writetocache("hotTags", $out_contents, "html");
}
function side_hotTags($sidename, $sidetitle, $isInstall)
{
    global $strTagsCount, $PHP_SELF;
    if (isset($_COOKIE["content_{$sidename}"])) {
        $display = $_COOKIE["content_{$sidename}"];
    } else {
        $display = $isInstall > 0 ? "none" : "";
    }
    ?>
<!--标签-->
<div class="sidepanel" id="Side_HotTags">
  <h4 class="Ptitle" style="cursor: pointer;" onclick="sidebarTools('<?php 
    echo "content_{$sidename}";
    ?>
')"><?php 
    echo $sidetitle;
    ?>
</h4>
  <div class="Pcontent" id="<?php 
    echo "content_{$sidename}";
    ?>
" style="display:<?php 
    echo $display;
    ?>
">
	<div id="HotTags_Body">
		<?php 
    list($maxTag, $minTag) = getTagRange();
    require "cache/cache_hottags.php";
    for ($i = 0; $i < count($tagscache); $i++) {
        $curColor = getTagHot($tagscache[$i]['logNums'], $maxTag, $minTag);
        $strDayLog = $strTagsCount . ": " . $tagscache[$i]['logNums'];
        echo "<a href=\"{$PHP_SELF}?job=tag&seekname=" . $tagscache[$i]['name'] . "\" style=\"color:{$curColor}\" title=\"{$strDayLog}\">" . $tagscache[$i]['name'] . "</a> \n";
    }
    ?>
	</div>
  </div>
  <div class="Pfoot"></div>
</div>
<?php 
}
<div id="Content_ContentList" class="content-width">
	<div class="Content">
	  <div class="Content-top">
		<div class="ContentLeft"></div>
		<div class="ContentRight"></div>
		<h1 class="ContentTitle"><b><?php 
echo $strHotTags;
?>
</b></h1>
		<h2 class="ContentAuthor">Tags Cloud</h2>
	  </div>
	  <div class="Content-body">
		<?php 
list($maxTag, $minTag) = getTagRange();
//require("cache/cache_hottags.php");
$tagscache = $DMF->fetchQueryAll($DMF->query("select * from " . $DBPrefix . "tags order by logNums desc"));
for ($i = 0; $i < count($tagscache); $i++) {
    $curColor = getTagHot($tagscache[$i]['logNums'], $maxTag, $minTag);
    $strDayLog = $strTagsCount . ": " . $tagscache[$i]['logNums'];
    echo "<a href=\"{$PHP_SELF}?job=tag&seekname=" . $tagscache[$i]['name'] . "\" style=\"color:{$curColor}\" title=\"{$strDayLog}\"><span style=\"font-size:13px\">" . $tagscache[$i]['name'] . "</span></a>&nbsp;&nbsp; \n";
}
?>
	  </div>
	</div>
</div>
    }
}
if ($settingInfo['rewrite'] == 0) {
    $gourl = "index.php?job=tags&amp;seekname=";
}
if ($settingInfo['rewrite'] == 1) {
    $gourl = "rewrite.php/tags-";
}
if ($settingInfo['rewrite'] == 2) {
    $gourl = "tags-";
}
$arr_result = $DMC->fetchArray($DMC->query("select max(logNums) as max,min(logNums) as min from " . $DBPrefix . "tags"));
if ($arr_result['max'] == "") {
    $arr_result['max'] = 0;
}
if ($arr_result['min'] == "") {
    $arr_result['min'] = 0;
}
$tagsmaxnumber = $arr_result['max'];
$tagsminnumber = $arr_result['min'];
$tagscache = $DMC->fetchQueryAll($DMC->query("select * from " . $DBPrefix . "tags order by logNums desc"));
foreach ($tagscache as $key => $value) {
    $curColor = getTagHot($value['logNums'], $tagsmaxnumber, $tagsminnumber);
    $curSize = getTagSize($value['logNums'], $tagsmaxnumber, $tagsminnumber);
    $strDayLog = $strTagsCount . ": " . $value['logNums'];
    echo "<a href=\"{$gourl}" . urlencode($value['name']) . $settingInfo['stype'] . "\" style=\"color:{$curColor};font-size:{$curSize};line-height:35px;\" title=\"{$strDayLog}\">" . $value['name'] . "(" . $value['logNums'] . ")</a>&nbsp;&nbsp;&nbsp; \n";
}
?>
	  </div>
	</div>
</div>