Location: PHPKode > projects > Tagging manager > version 1.02/index.php
<?php
/*  ============================================================
*                              index.php
*                              -------------------
*     Date                 : 23 june 2006
*     E-mail               : hide@address.com
*
*     Version              : 1.0.1 (20/07/2006 - 13:35)
*
*     This a free software
*     licensed under GPL (General public license)
*
============================================================ */

/**
 *	index.php lists latest urls, users, taxonomy, tags ..
 *	It uses index.tpl and body_list.tpl, body_tags.tpl, body_users.tpl, body_taxonomy.tpl as it's main templates
 *
 *	@version 1.0.1
 * 	@package TaggingManager
 */


// header caching fix
header("Cache-Control: no-store, no-cache, must-revalidate");

if(!file_exists( "./config.php" ) ) {
	die( 'Please rename config.new to config.php and fill in the data' );
}

define('root_path',"./");
$db_name = "";
$paglimit = "";
$location= "";
$language= "";

include_once(root_path.'config.php');
if($db_name=='') 	die( 'Please fill in the correct mysql data in config.php' );
require_once(root_path.'includes/dbconn.php');
require_once(root_path.'includes/functions.php');
require_once(root_path.'includes/template.php');
require_once(root_path.'includes/metadata.php');
require_once(root_path.'includes/user.php');


// GET tag,lang, page ... by url
isset($_GET['pag']) ? $pag=$_GET['pag'] : $pag = 1;
$paging=($pag-1)*$paglimit;

!isset($_GET["search"])? $search = "AND" :  $search = $_GET["search"];
$search .= " ";

$valid_columns = Array("tag_name","lang", "taxonomy", "userName"); //Valid columns for search


foreach ($_GET as $key=>$val)
{
	if (in_array($key,$valid_columns))
	$str .= "$key = '$val' ". $search;
}
if (count($_GET) > 0)
$str  = substr($str, 0,-strlen($search));
else
$str ="";

$where = "";
if (strlen($str) > 0) $where = "WHERE " . $str;
$ids = urlIDs($where,$paging,$paglimit); //returns an array of id's for this search

isset($_GET['style']) ? $template=$_GET['style'] : $template=$template;


//start templatebuilding
$tpl = & new Template();
$tpl->set('tagg', $_GET['tag_name']);
$tpl->set('taxonomy', $_GET['taxonomy']);
$tpl->set('location', $location);


if (isset($_COOKIE["user"]) AND isset($_COOKIE["secret"])) {
	$myUser = new User;
	$myUser->userName = $_COOKIE["user"];
	$myUser->userPassword = $_COOKIE["secret"];
	$myUser->verifyPassword();
	$tpl->set('user_id', $myUser->user_id);
	$tpl->set('username', $myUser->userName);
}



foreach($ids as $id){
	$link = new Link($id);
	$bdy = & new Template();
	$bdy->set('url', $link->url);
	$bdy->set('link_title', $link->title);
	$bdy->set('link_description', $link->description);
	$bdy->set('link_snipset', $link->snipset);
	$bdy->set('link_taxonomy', $link->taxonomy);
	$bdy->set('link_id', $link->meta_id);
	$bdy->set('location', $location);
	$tagList = tagList($link->meta_id); //this is an array with all the tags for this url
	$bdy->set('link_taglist', $tagList);
	$body .= $bdy->fetch(root_path.'template/'.$template.'/body_list.tpl',$language);
}


$tpl->set('paging', $paging);
$tpl->set('body', $body);

if ($_GET['style'] == 'rss') header('Content-type: text/xml');

echo $tpl->fetch(root_path.'template/'.$template.'/index.tpl',$language);
?>
Return current item: Tagging manager