Location: PHPKode > projects > PHP Minimus Blog > up_to_101/modules/Tags/includes/tag.php
<?php
/************************************************************************/
/* Minimus Blog: Web Portal System                                      */
/* ===============================                                      */
/* Write by Cyril Levert                                                */
/* Copyright (c) 2009-2010                                              */
/* http://www.php-minimus.org                                           */
/* hide@address.com                                                  */
/*                                                                      */
/* This program is free software.                                       */
/************************************************************************/
/* Based on PHP-Maximus: Web Portal System                              */
/************************************************************************/
defined('MAXIMUS') or Header("Location: index.php");

isset( $tag ) ? $tag = html_entity_decode( secure( $tag, '', '', 'xss') ): $tag = '';
$pagetitle = '- '._TAGS_TITLE.' '.$tag;
incoh( 'TagTag'.$tag, 'html', $timecache, 1);

echo '<h1>'._TAGS_EXISTANTS.'</h1>';

$result = $GLOBALS['db']->get_list_object("SELECT `tag` FROM `".TABLE_TAGS."` GROUP BY `tag` LIMIT 50");
echo "<div class='tagsbox'>"
    ."<img src='images/tag.gif' border='0' alt='Tags' title='Tags' /> ";
foreach ($result as $row) {
	$row->tag = secure( $row->tag, 'strip', 'clean');
	$num = $GLOBALS['db']->get_num("SELECT `tag` FROM `".TABLE_TAGS."` WHERE `tag`='".addslashes($row->tag)."'");
	if ($num<=1) {
		$dim = 'xs';
	} elseif ($num<=5) {
		$dim = 's';
	} elseif ($num<=20) {
		$dim = 'm';
	} elseif ($num<=50) {
		$dim = 'l';
	} else {
		$dim = 'xl';
	}
	echo "<span style='padding: 0 2px;' class='$dim'>";
	( $rewrite == 1 ) ? $url = GTv2_pref.'_Tag_'.urlencode($row->tag).'.html' : $url = 'index.php?name=Tags&amp;op=tag&amp;tag='.urlencode( $row->tag );
	echo "<a href='".$url."'>".str_replace('-', ' ', $row->tag)."</a>";
	echo "</span>\n";
}
br('2');

( $rewrite == 1 ) ? $url = GTv2_pref.'_Tags_alltags.html' : $url = 'index.php?name=Tags&amp;op=alltags';
echo '</div>';

/** Blogs */
if ( is_module('Blogs') ) {
	if ( $result = $GLOBALS['db']->get_list_object("SELECT `cid` FROM `".TABLE_TAGS."` WHERE `tag`='$tag' AND `module`='Blog' ORDER BY `cid` DESC LIMIT 50") ) {
		echo "<div class='tagsbox'>"
		."<img src='images/tag.gif' border='0' alt='Tags' title='Tags' />&nbsp;"._TAGS_BLOGS."<br/>"
		."<ul class='tags'>";
		foreach ($result as $row) {
			$row->cid = secure( $row->cid, 'num');
			$row1 = $GLOBALS['db']->get_object("SELECT `id`, `titre`, `titre_seo` FROM `".TABLE_BLOGS."` WHERE `id`='".$row->cid."' ");
			$row1->id        = secure( $row1->id, 'num');
			$row1->titre     = secure( $row1->titre, 'strip', 'clean');
			$row1->titre_seo = secure( $row1->titre_seo, 'strip', 'clean');
			( $rewrite == 1 ) ? $url = 'blog_'.$row1->titre_seo.'-'.$row1->id.'.html' : $url = 'index.php?name=Blogs&amp;op=billet&amp;bid='.$row1->id.'#billet';
			echo "<li><a href='".$url."' title='".$row1->titre."'>".$row1->titre."</a></li>\n";
		}
		echo '</ul></div>';
	}
	if ( $result = $GLOBALS['db']->get_list_object("SELECT `cid` FROM `".TABLE_TAGS."` WHERE `tag`='$tag' AND `module`='BlogPage' ORDER BY `cid` DESC LIMIT 50") ) {
		echo "<div class='tagsbox'>"
		."<img src='images/tag.gif' border='0' alt='Tags' title='Tags' />&nbsp;"._TAGS_BLOGS_PAGES_LIBRES."<br/>"
		."<ul class='tags'>";
		foreach ($result as $row) {
			$row->cid = secure( $row->cid, 'num');
			$row1 = $GLOBALS['db']->get_object("SELECT `pid`, `pagename`, `titre_seo` FROM `".TABLE_BLOGS_PAGES."` WHERE `pid`='".$row->cid."' ");
			$row1->pid       = secure( $row1->pid, 'num');
			$row1->pagename  = secure( $row1->pagename, 'strip', 'clean');
			$row1->titre_seo = secure( $row1->titre_seo, 'strip', 'clean');
			( $rewrite == 1 ) ? $url = 'blog_page_'.$row1->titre_seo.'-'.$row1->pid.'.html' : $url = 'index.php?name=Blogs&amp;op=page&amp;id='.$row1->pid.'#billet';
			echo "<li><a href='".$url."' title='".$row1->pagename."'>".$row1->pagename."</a></li>\n";
		}
		echo '</ul></div>';
	}
}

incof( 'TagTag'.$tag, 'html', $timecache, 1 );
Return current item: PHP Minimus Blog