I'm no programmer. I was using phpnuke but got sick of all the little bugs and recently switched to postnuke. I have this block that is for phpnuke, it lists the catagories, albums, and number of pictures in a gallery. How do I get it working in postnuke? Whats the difference? I tried pasting it into a php block but the site wouldn't work. Like I said, I'm no programmer and I can't find much info on this. Anyone know? Or does anyone have a block like this that works for postnuke?
<?php
/************************************************************************/
/* PHP-NUKE: Web Portal System */
/* =========================== */
/* */
/* Copyright (c) 2002 by Francisco Burzi */
/* http://phpnuke.org */
/* */
/* This program is free software. You can redistribute it and/or modify */
/* it under the terms of the GNU General Public License as published by */
/* the Free Software Foundation; either version 2 of the License. */
/************************************************************************/
/* Block_Gallery_Categories */
/* */
/* zeigt alle Kategorien der Coppermine-Galerie an, die eine bestimmte */
/* Kategorie als "Parent" eingetragen haben */
/* */
/* shows all Categories where "Parent" is set to a specific Number */
/************************************************************************/
/* */
/* written by Siegfried Schlossser (sigi) */
/* for PhpNuke-Community (http://www.phpnuke-community.de) */
/* email me at sigi@sigiberlin.de */
/* */
/************************************************************************/
if (eregi("block-Gallery_Categories.php", $PHP_SELF)) {
Header("Location: index.php");
die();
}
global $currentlang,$piccount;
switch($currentlang)
{
case "english":
define("_KATTITEL1","Pictures");
define("_KATTITEL2","Wallpaper");
define("_GALLINK","go to gallery");
define("_NOPICS","no pictures...");
define("_STATSUP","update stats");
define("_STATSSUM","total");
break;
default:
define("_KATTITEL1","Bilder");
define("_KATTITEL2","Wallpaper");
define("_GALLINK","Zur Galerie");
define("_NOPICS","keine Bilder...");
define("_STATSUP","Stats updaten");
define("_STATSSUM","Summe");
break;
}
function GetCat($c)
{
global $prefix,$dbi,$piccount;
###################################################
#
# change the following line if you didn't add the
# PhpNuke $prefix to your cpg tables ...
#
###################################################
$result4 = sql_query("SELECT aid, title, pos FROM cpg_albums WHERE category = 0 ORDER BY pos ", $dbi);
while ($row4 = sql_fetch_array($result4, $dbi))
{
$aid = $row4["aid"];
$result5 = sql_query("SELECT pid FROM cpg_pictures WHERE aid = '$aid' ", $dbi);
$albumRows = sql_num_rows($result5, $dbi);
$content .="<tr><td><a href=\"modules.php?name=coppermine&file=thumbnails&album=".$row4["aid"]."\">" .$row4['title'] . "</a></td><td align=\"right\"> ".$albumRows." </td></tr>\n";
}
$result = sql_query("SELECT cid, namee, pic_count, pos FROM cpg_categories where parent = '".$c."' ORDER BY pos ", $dbi);
if (sql_num_rows($result,$dbi) <= 0)
{
$content = _NOPICS;
return false;
}
while ($row = sql_fetch_array($result,$dbi))
{
if ($row["cid"] != 1) // make sure it's not "user albums"
{
$content .="<td><a href=\"modules.php?name=coppermine&cat=".$row["cid"]."\"><b>" .$row['namee'] . "</b></a></td></tr>\n";
$piccount=$piccount+$row["pic_count"];
}
//albums
$cid = $row["cid"]; //get num of albums in category
$result2 = sql_query("SELECT aid, title, pos FROM cpg_albums where category = '$cid' ORDER BY pos ", $dbi);
while ($row2 = sql_fetch_array($result2,$dbi))
{
$aid = $row2["aid"]; //correct count of pics in album
$result3 = sql_query("SELECT pid FROM cpg_pictures WHERE aid = '$aid' ", $dbi);
$albumRows = sql_num_rows($result3, $dbi);
$content .="<tr><td><a href=\"modules.php?name=coppermine&file=thumbnails&album=".$row2["aid"]."\"> " .$row2['title'] . "</a></td><td align=\"right\"> ".$albumRows." </td></tr>\n";
}
}
return $content;
}
$content.="<table width=\"100%\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\" style=\"border: 0px; margin-bottom: 5px;\">\n";
$content.="<tr>";
################# v hier die Nummer der Kategorie eingeben / put the Catid of the Parent category here
$content.=GetCat("0");
$content.="</table>";
/*
global $admin;
if (is_admin($admin))
# wenn Du bist Admin, Du darfst die Statistik updaten :-)
# you are admin: then you may update the stats :-)
{
$content .= "<center><a href=\"modules.php?name=coppermine&file=updatestats\">"._STATSUP."</a></center>";
}
*/
//$content .= "<center><a href=\"modules.php?name=coppermine\">"._GALLINK."</a></center>";
?>