Location: PHPKode > projects > WB News > admin/emoticons.php
<?php

/*========================================================*\
||########################################################||
||#                                                      #||
||#     WB News v2.0.0                                   #||
||# ---------------------------------------------------- #||
||#     Copyright (c) 2004-2008                          #||
||#     Created: 18th August 2005                        #||
||#     Filename: emoticons.php                          #||
||#                                                      #||
||########################################################||
/*========================================================*/

/**
 *  @author $Author: pmcilwaine $
 *	@version $Id: emoticons.php,v 1.4.2.4.2.1 2008/07/14 11:04:05 pmcilwaine Exp $
 */

require_once( "global.php" );
$auth->login_if( !$auth->has_perm( "canadmin" ) );

$_SESSION["return_page"] = make_url( array("ajax"=>FALSE) );

$page = new PageTemplateEngine( BuildPath("admin/main-page.ihtml") );
$tmpl->SetFilename( USE_AJAX ? BuildPath("admin/ajax/emoticons.ixml") : BuildPath("admin/emoticons.ihtml") );

$params = array(
	"entry" => "\t<li>%s</li>\n\t",
	"separator" => FALSE,
	"class_open" => "open",
	"links" => toolbarmenu()
	);
$toolbar = include( INCDIR . "/page-menu.php" );

$page->AddParam( "toolbar", $toolbar );
$page->AddParam( "userinfo", $userinfo );

$rows =& $tmpl->AddParam( "rows", array() );

$offset = 0;
if ( isset($_GET["ajax"]) && $_GET["ajax"] == 1 )
{
	if ( isset($_GET["offset"]) )
	{
		$offset = intval( $_GET["offset"] );
	}
}
else
{
	$offset = isset($_REQUEST["offset"]) ? intval( $_REQUEST["offset"] ) : 0 ;
}

$ids = $DB->ListBy( TBL_EMOTICON, NULL, array("id","name","image"), "\"name\"", 10, $offset );
$count_ids = $DB->CountBy( TBL_EMOTICON );

if ( is_array($ids) && count($ids) != 0 )
{
	foreach ( $ids as $id )
	{
		$rows[$id["id"]] = array(
			"name" => htmlspecialchars( $id["name"] ),
			"image" => htmlspecialchars( $id["image"] ),
			"edit-link" => make_url_html( array("id"=>$id["id"]), MAIN_SERVER . "/admin/edit-emoticon" )
			);
	}
}

$pagemenu =& $tmpl->AddParam( "pagemenu", array() );
$page->BindParam( "pagemenu", $tmpl );

$params = array(
	"entry" => "\t<li>%s</li>\n\t",
	"separator" => "\t<li>|</li>\n\t",
	"links" => buildmenu( $theme_info["pagemenu_build"] )
	);
$params = array_merge( $params, $theme_info["pagemenu"] );
$pagemenu = include( INCDIR . "/page-menu.php" );

$tmpl->Pagination( $count_ids, $offset, 10 );

if ( USE_AJAX )
{
	header( "Content-Type: text/xml" );
	echo $tmpl->GetHTML();
	return;
}

$page->ParseContent( $tmpl->GetHTML() );
$page->ShowPage();

return;

?>
Return current item: WB News