|
Foros
Problemas con displayCategory en Caricaturas
|
Autor
|
Fecha: 30 de Septiembre del 2007 a las 04:59:10
Descripción: Ninguna
|
Sexo: Masculino
Mensajes: 344
|
Hola, me gustaría solucionar este problema que tengo, en Firefox, cuando me voy a una categoría de las caricaturas, salen todas, pero si lo pruebo en safari o internet explorer, sale esto:
http://img219.imageshack.us/img219/4926/imagen2fp3.png
Cuando en Firefox, sale así:
http://img219.imageshack.us/img219/5451/imagen3kp2.png
Probé a revisar los cierres de las functions, para ver si era eso, y no lo es, que puede ser?
Este es el código de displaycategory.php:
Código 
<?php
// Adaptaci贸n del m贸duio al NukeET 3.2 y mejoras de seguridad por truzone http://www.truzone.org
if(!defined('NUKE_ET')){
Header("Location: ../error.php?op=e403");
die();
}
if(isset($_GET[basepath]) || isset($_GET[baseurl]) || isset($_GET[adminurl]) || isset($_GET[adminpath]) || isset($_GET[ModName]) || isset($_GET[tmppath]) || isset($_GET[languagepath]) || isset($_GET[imagepath]) || isset($_GET[gallerypath])){ die("perraco"); }
include ("$basepath/public/imageFunctions.php");
include ("$adminpath/fileFunctions.php");
function getThumbnail($img, $galloc) {
global
$gallerypath,
$imagepath,
$prefix, $db
;
$ext = substr($img, (strrpos($img,'.') + 1));
$name_gif = str_replace(".$ext", ".gif", $img);
$name_jpg = str_replace(".$ext", ".jpg", $img);
if (file_exists("$gallerypath/$galloc/thumb/$name_gif")) {
$thumb = "$gallerypath/$galloc/thumb/$name_gif";
}
elseif (file_exists("$gallerypath/$galloc/thumb/$name_jpg")) {
$thumb = "$gallerypath/$galloc/thumb/$name_jpg";
}
else {
$row = $db->sql_fetchrow($db->sql_query("SELECT thumbnail from $prefix"._gallery_media_types." where extension='$ext'"));
$thumbnail = $row[thumbnail];
$thumb = "$imagepath/$thumbnail";
}
//echo $thumb;
return $thumb;
}
function displayPictureGall($filetype, $gid, $pid, $thumbwidth, $galloc, $name, $img, $orderby) {
global
$gallerypath,
$font,
$adminurl,
$baseurl,
$adminpath,
$imagepath,
$galleryvar,
$admin
;
$image = "$gallerypath/$galloc/$img";
$thumb_dir = "$gallerypath/$galloc/thumb";
$thumb = "$thumb_dir/$img";
// create the thumbnail if missing
if(!file_exists($thumb))
{
if(!file_exists($thumb_dir) && $galleryvar['imageSoftware']!="browser")
{
makeDir("$gallerypath/$galloc", "thumb");
}
if ($filetype==1) {
$thumb = RatioResizeImg("$gallerypath/$galloc/$img", $thumb, $gid);
}
if ($thumb=="browser")
$thumb = $image;
else
$thumb = getThumbnail($img, $galloc);
}
if (is_admin($admin))
$out = " <a class='".$font['normal']."' href="$adminurl&do=editmedia&type=edit&category=$gid&pid=$pid&gid=$gid"><img src="$imagepath/edit.gif" alt="Edit" border="0"></a>";
$transfertitle = str_replace (" ", "-", $name);
return "<a class="".$font['normal']."" href="caricaturas-caricatura-$pid-$transfertitle.html">"
."<center><img src="$thumb" width="$thumbwidth" alt="".underscoreTospace($name)."" border="0" align="center>">"
.'</a>'.$out
;
}
function displayDescriptionGall($row, $crow) {
global $font;
$m = 90 / $crow[numcol];
if(strlen($row[description]) > $m) {
$row[description] = trim(substr($row[description],0,$m));
$p = strrpos($row[description], ' ');
$row[description] = trim(substr($row[description],0,$p)).'...';
}
return "<font color='green' background-color='green' class="".$font['tiny'].""><strong><style>$row[description]</strong></font>n";
}
function displayNewGall($row) {
global
$imagepath
;
if($row[new_day] == 0) {
return "<img src="$imagepath/newred.gif" border="0" width="34" height="14" alt=""._GALNEWMEDIA1.'">';
}
elseif($row[new_day] < 3) {
return "<img src="$imagepath/newgreen.gif" border="0" width="34" height="14" alt="".sprintf(_GALNEWMEDIA2, $row[new_day]).'">';
}
elseif($row[new_day] < 7) {
return "<img src="$imagepath/newblue.gif" border="0" width="34" height="14" alt="".sprintf(_GALNEWMEDIA2, $row[new_day]).'">';
}
}
function displaySizeGall($row, $crow) {
global $font;
if($row[imginfo][2]) {
$size = $row[imginfo];
return "<font class="".$font['tiny'].""><b>"._GALSIZE."</b>: $size[0]x$size[1]</font>";
}
else {
return "<font class="".$font['tiny'].""><b>"._GALSIZE."</b>: "._GALUNKNOWN."</font>";
}
}
function displayFormatGall($row) {
global $font;
$ext = $row[imginfo][2];
switch($ext) {
case 1: $type = 'GIF'; break;
case 2: $type = 'JPEG'; break;
case 3: $type = 'PNG'; break;
case 4: $type = 'WBMP'; break;
default:
$type = $ext; break;
}
return "<font class="".$font['tiny'].""><b>Format</b>: $type</font>";
}
function displayNumCommentsGall($row) {
global
$galleryvar,
$prefix, $db,
$font
;
$numcomments = $db->sql_fetchrow($db->sql_query("SELECT COUNT(cid) AS total FROM $prefix"._gallery_comments." WHERE pid=$row[pid]"));
if($galleryvar['allowcomments']) {
return "<font class="".$font['tiny'].""><b>"._GALNBCOMMENTS."</b>: $numcomments[total]</font>";
}
}
function displayHitsGall($row) {
global $font;
return "<font class="".$font['normal'].""><b>"._GALHITS."</b><br>$row[counter]</font>";
}
function displayRateGall($row) {
global
$galleryvar, $font;
;
if($allowrate) {
return "<font class="".$font['normal'].""><b>"._GALRATING."</b><br>$row[rate]</font>";
}
}
function displayDateAddedGall($row) {
global $font;
return "<font class="".$font['normal'].""><b>"._GALADDED.'</b></font><br><font class="'.$font['tiny'].'">'.strftime(_GALDATEBRIEF,$row[unix_date]).'</font>';
}
function displayName($row) {
global $font;
return "<font class="".$font['normal'].""><b>$row[name]</b></font>";
}
function navigationCat($gid, $offset, $orderby) {
global
$font,
$galleryvar,
$baseurl,
$prefix, $db
;
$limit = $galleryvar['maxNumberMedia'];
$orderby = convertorderbyout($orderby);
$numresults = $db->sql_query("select * from $prefix"._gallery_pictures." where gid=$gid");
$numrows=$db->sql_numrows($numresults);
$nav = '';
$pages=intval($numrows/$limit);
if ($numrows>0 & $pages>=1) {
if ($offset!=0) {
$prevoffset=$offset-$limit;
$nav = "<a class="".$font['normal']."" href="$baseurl&do=showgall&gid=$gid&offset=$prevoffset&orderby=$orderby">[<<]</a> . ";
}
if ($numrows%$limit) {
$pages++;
}
for ($i=1;$i<=$pages; $i++) {
$newoffset=$limit*($i-1);
if ($newoffset==$offset) {
$nav .= "<font class="".$font['normal']."">";
if ($i==1)
if ($pages==1)
$nav .= "[<<] . ".$i." . [>>]";
else
$nav .= "[<<] . ".$i." . ";
elseif ($i==$pages)
$nav .= $i." . [>>]";
else
$nav .= $i." . ";
$nav .= "</font>";
}
else {
$nav .= "<a class="".$font['normal']."" href="$baseurl&do=showgall&gid=$gid&offset=$newoffset&orderby=$orderby">$i</a> . ";
}
}
if (!(($offset/$limit)==($pages-1)) && $pages!=1) {
$newoffset=$offset+$limit;
$nav .= "<a class="".$font['normal']."" href="$baseurl&do=showgall&gid=$gid&offset=$newoffset&orderby=$orderby">[>>]</a>";
}
}
return $nav;
}
function navigationSubCat($gid) {
global
$baseurl,
$adminurl,
$imagepath,
$admin,
$user,
$prefix, $db,
$gallerypath,
$galleryvar,
$font
;
//$userRank = getUserRank();
//$result = $db->sql_query("SELECT gallid, gallname, description, total, (TO_DAYS(NOW()) - TO_DAYS(lastadd)) AS new_day FROM gallery_categories WHERE parent=$gid AND visible>=$userRank");
if (is_admin($admin))
$result = $db->sql_query("SELECT gallid, gallname, galloc, gallimg, description, visible, total, (TO_DAYS(NOW()) - TO_DAYS(lastadd)) AS new_day FROM $prefix"._gallery_categories." WHERE parent=$gid AND visible>=0 ORDER by gallname");
else
$result = $db->sql_query("SELECT gallid, gallname, galloc, gallimg, description, visible, total, (TO_DAYS(NOW()) - TO_DAYS(lastadd)) AS new_day FROM $prefix"._gallery_categories." WHERE parent=$gid AND visible>0 ORDER by gallname");
$nb = $db->sql_numrows($result);
if(!$nb) {
return false;
}
$c = 0;
$out .= '<table border="0" width="50%" align="center" cellpadding="2"><tr>';
$pc = ceil(100/3);
$isuser = is_user($user);
$isadmin = is_admin($admin);
while($row = $db->sql_fetchrow($result)) {
$vis='';
if ($row[visible]==1 && !$isuser)
$vis = '(*)';
if ($isadmin) {
switch ($row[visible])
{
case 0:
$vis .= " <a class="".$font['normal']."" href="$adminurl&do=editcategory&type=status&visible=1&category=".$row[gallid]."" title=""._GALVISIBLEADMIN.""><img src="$imagepath/red_dot.gif" border="0" width="10" height="10" alt=""._GALVISIBLEADMIN.'"></a> ';
break;
case 1:
$vis .= " <a class="".$font['normal']."" href="$adminurl&do=editcategory&type=status&visible=2&category=".$row[gallid]."" title=""._GALVISIBLEMEMBER.""><img src="$imagepath/yellow_dot.gif" border="0" width="10" height="10" alt=""._GALVISIBLEMEMBER.'"></a> ';
break;
default:
$vis .= " <a class="".$font['normal']."" href="$adminurl&do=editcategory&type=status&visible=0&category=".$row[gallid]."" title=""._GALVISIBLEPUBLIC.""><img src="$imagepath/green_dot.gif" border="0" width="10" height="10" alt=""._GALVISIBLEPUBLIC.'"></a> ';
break;
}
}
if ($galleryvar['displaySubCatIcon']) {
if (isset($galleryvar['SubCatIconwidth']) && $galleryvar['SubCatIconwidth']!="")
$icon = "<img src="$gallerypath/".$row[galloc]."/".$row[gallimg]."" width="".$galleryvar['SubCatIconwidth']."" border="0" alt="$row[description]">";
else
$icon = "<img src="$gallerypath/".$row[galloc]."/".$row[gallimg]."" border="0" alt="$row[description]"></a>";
}
$out .= "<td width="$pc%">";
$out .= "<font class="".$font['tiny'].""><img src="$imagepath/folder.gif" width="15" height="13" border="0" alt=""> ";
if ($row[visible]==1 && !$isuser && !$isadmin) {
$out .= underscoreTospace($row[gallname])." ($row[total]) $vis";
}
else {
$out .= "<a class="".$font['normal']."" href="caricaturas-categoria-$row[gallid]-".underscoreTospace($row[gallname]).".html">".underscoreTospace($row[gallname])."</a> ($row[total]) $vis";
$icon = "<a class="".$font['normal']."" href="caricaturas-categoria-$row[gallid]-".underscoreTospace($row[gallname]).".html">".$icon."</a>";
}
if($row[new_day] == 0) {
$out .= "<img src="$imagepath/newred.gif" border="0" width="34" height="14" alt=""._GALNEWMEDIA1.'">';
}
elseif($row[new_day] < 3) {
$out .= "<img src="$imagepath/newgreen.gif" border="0" width="34" height="14" alt="".sprintf(_GALNEWMEDIA2, $row[new_day]).'">';
}
elseif($row[new_day] < 7) {
$out .= "<img src="$imagepath/newblue.gif" border="0" width="34" height="14" alt="".sprintf(_GALNEWMEDIA2, $row[new_day]).'">';
}
$out .= "n</font>n";
$out .= "<br>".$icon;
$out .= "</td>";
$c++;
if($c == 3 && $nb != 3) {
$out .= '</tr><tr>';
$c = 0;
}
}
$out .= '</tr></table>';
return $out;
}
function convertorderbytrans($orderby) {
if ($orderby == "counter ASC") $orderbyTrans = ""._GALPOPULARITY1."";
if ($orderby == "counter DESC") $orderbyTrans = ""._GALPOPULARITY2."";
if ($orderby == "name ASC") $orderbyTrans = ""._GALNAMEAZ."";
if ($orderby == "name DESC") $orderbyTrans = ""._GALNAMEZA."";
if ($orderby == "date ASC") $orderbyTrans = ""._GALDATE1."";
if ($orderby == "date DESC") $orderbyTrans = ""._GALDATE2."";
if ($orderby == "rate ASC") $orderbyTrans = ""._GALRATING1."";
if ($orderby == "rate DESC") $orderbyTrans = ""._GALRATING2."";
return $orderbyTrans;
}
function showgall($gid, $offset, $orderby) {
global
$galleryvar,
$basepath,
$font,
$adminpath,
$prefix, $db,
$user,
$admin
;
include "$adminpath/config.php";
$res = $db->sql_fetchrow($db->sql_query("SELECT count(*) as total FROM $prefix"._gallery_categories." WHERE parent=$gid AND visible=1"));
$crow = $db->sql_fetchrow($db->sql_query("SELECT c.galloc, c.numcol, c.description, c.visible, c.thumbwidth, t.templateCategory, t.templateCSS FROM $prefix"._gallery_categories." AS c LEFT JOIN $prefix"._gallery_template_types." AS t ON t.id=c.template WHERE gallid=$gid"));
$ok=0;
switch ($crow[visible]) {
case 0:
if (is_admin($admin))
$ok=1;
break;
case 1:
if (is_user($user) || is_admin($admin))
$ok=1;
break;
default:
$ok=1;
break;
}
if ($ok) {
galleryHeader();
OpenTable();
if(isset($orderby)) {
$orderby = convertorderbyin($orderby);
}
else {
$orderby = convertorderbyin($galleryvar['defaultsortmedia']);
}
if(!$gid) {
header("Location: $baseurl");
exit;
}
$limit = $galleryvar['maxNumberMedia'];
if(empty($offset)) {
$offset = 0;
}
$orderbyTrans = convertorderbytrans($orderby);
$navtree = navigationTree($gid, false);
$nav = navigationCat($gid, $offset, $orderby);
$subcats = navigationSubCat($gid);
$navgall = navigationGall();
$result = $db->sql_query("SELECT m.*, UNIX_TIMESTAMP(m.date) AS unix_date, (TO_DAYS(NOW()) - TO_DAYS(m.date)) AS new_day, f.displaytag, f.thumbnail, f.filetype, f.description AS description_media FROM $prefix"._gallery_pictures." AS m LEFT JOIN $prefix"._gallery_media_types." AS f ON f.extension=m.extension WHERE gid=$gid ORDER BY $orderby LIMIT $offset,$limit");
$nb = $db->sql_numrows($result);
$pc = ceil(100/$crow[numcol]);
$c = 0;
print '<p align="center">'.$navgall.'</p>';
print '<p align="center">'.$navtree.'</p>';
if($subcats != -1) {
print "<p align="center">$subcats<hr></p>";
}
print "<p align="center"><font class="".$font['normal'].""><br>$crow[description]</font></p>n";
if($displaysortbar) {
print '<p align="center"><font class="tiny">'._GALSORTMEDIABY.': '
._NAME." (<a class="".$font['tiny']."" href="$baseurl&do=showgall&gid=$gid&offset=$newoffset&orderby=titleA">"._GALASC."</a><a href="$baseurl&do=showgall&gid=$gid&offset=$newoffset&orderby=titleD">"._GALDESC.'</a>) '
._DATE." (<a class="".$font['tiny']."" href="$baseurl&do=showgall&gid=$gid&offset=$newoffset&orderby=dateA">"._GALASC."</a><a href="$baseurl&do=showgall&gid=$gid&offset=$newoffset&orderby=dateD">"._GALDESC.'</a>) '
._RATING." (<a class="".$font['tiny']."" href="$baseurl&do=showgall&gid=$gid&offset=$newoffset&orderby=ratingA">"._GALASC."</a><a href="$baseurl&do=showgall&gid=$gid&offset=$newoffset&orderby=ratingD">"._GALDESC.'</a>) '
._POPULARITY." (<a class="".$font['tiny']."" href="$baseurl&do=showgall&gid=$gid&offset=$newoffset&orderby=hitsA">"._GALASC."</a><a href="$baseurl&do=showgall&gid=$gid&offset=$newoffset&orderby=hitsD">"._GALDESC.'</a>) '
.'<br>'._GALMEDIASORTED.": $orderbyTrans</font></p>"
;
}
print '<p align="center">'.$nav.'</p>';
print '<table border="0" width="100%" align="center" cellpadding="2"><tr>';
while($row = $db->sql_fetchrow($result)) {
$template = $crow[templateCategory];
$template = str_replace('<:IMAGE:>', displayPictureGall($row[filetype], $row[gid], $row[pid], $crow[thumbwidth], $crow[galloc], $row[name], $row[imagen], convertorderbyout($orderby)), $template);
// get some image info stuff out of the way here
if($row[filetype] == 1) {
$row[imginfo] = @getimagesize("$gallerypath/$crow[galloc]/$row[imagen]");
}
else {
$row[imginfo] = false;
$row[imginfo][0] = $row[width];
$row[imginfo][1] = $row[height];
$row[imginfo][2] = $row[description_media];
$row[imginfo][3] = "width="$row[width]" height="$row[height]"";
}
// ok, back to what we were doing
$val_description = displayDescriptionGall($row, $crow);
$val_rate = displayRateGall($row);
$val_format = displayFormatGall($row);
$val_size = displaySizeGall($row, $crow);
$val_nmbComments = displayNumCommentsGall($row);
$val_new = displayNewGall($row);
$val_hits = displayHitsGall($row);
$val_date = displayDateAddedGall($row);
$val_name = displayName($row);
$template = str_replace('<:DESCRIPTION:>', $val_description, $template);
$template = str_replace('<:RATE:>', $val_rate, $template);
$template = str_replace('<:FORMAT:>', $val_format, $template);
$template = str_replace('<:SIZE:>', $val_size, $template);
$template = str_replace('<:NBCOMMENTS:>', $val_nmbComments, $template);
$template = str_replace('<:NEW:>', $val_new, $template);
$template = str_replace('<:HITS:>', $val_hits, $template);
$template = str_replace('<:DATE:>', $val_date, $template);
$template = str_replace('<:NAME:>', $val_name, $template);
print '<td width="'.$pc.'%">'.$template.'</td>';
$c++;
if($c == $crow[numcol] && $nb != $crow[numcol]) {
print '</tr><tr>';
$c = 0;
}
}
print '</tr></table>'
."<center><br>$nav<br>";
if ($galleryvar['displaySearchForm']) {
include("$basepath/public/search.php");
print search_form($GLOBALS[HTTP_POST_VARS]);
}
print '</center>';
if ($res[total]>0 && !is_user($user))
print '<br><center><font class="'.$font['tiny'].'"><i>'._GALCATMEMBERS.'</i></font></center>';
CloseTable();
galleryFooter();
} // If Ok
else {
}
}
?>
Saludos.
|
|
|
|
Autor
|
Fecha: 07 de Octubre del 2007 a las 10:04:48
Descripción: Ninguna
|
Sexo: Masculino
Edad: 21 años
Ubicación: Poza Rica, Veracruz
País:
Mensajes: 1278
|
No es por nada, pero el problema esta, en que no sabes html. Colocas etiquetas donde no deberian, no cierras otras, o las cierras mal.
Ahi esta las funciones correctas, solo tienes que sustituirlas por las que tienes; sería todo lo que hay de la línea 42 a la 93:
Código PHP 
<?php
function displayPictureGall($filetype, $gid, $pid, $thumbwidth, $galloc, $name, $img, $orderby) {
global
$gallerypath,
$font,
$adminurl,
$baseurl,
$adminpath,
$imagepath,
$galleryvar,
$admin
;
$image = "$gallerypath/$galloc/$img";
$thumb_dir = "$gallerypath/$galloc/thumb";
$thumb = "$thumb_dir/$img";
// create the thumbnail if missing
if(!file_exists($thumb))
{
if(!file_exists($thumb_dir) && $galleryvar['imageSoftware']!="browser")
{
makeDir("$gallerypath/$galloc", "thumb");
}
if ($filetype==1) {
$thumb = RatioResizeImg("$gallerypath/$galloc/$img", $thumb, $gid);
}
if ($thumb=="browser")
$thumb = $image;
else
$thumb = getThumbnail($img, $galloc);
}
if (is_admin($admin))
$out = " <a class='".$font['normal']."' href="$adminurl&amp;do=editmedia&amp;type=edit&amp;category=$gid&amp;pid=$pid&amp;gid=$gid"><img src="$imagepath/edit.gif" alt="Edit" border="0"></a>";
$transfertitle = str_replace (" ", "-", $name);
return "<a class="".$font['normal']."" href="caricaturas-caricatura-$pid-$transfertitle.html">"
."<center><img src="$thumb" width="$thumbwidth" alt="".underscoreTospace($name)."" border="0" align="center">"
.'</a>'.$out
;
}
function displayDescriptionGall($row, $crow) {
global $font;
$m = 90 / $crow[numcol];
if(strlen($row[description]) > $m) {
$row[description] = trim(substr($row[description],0,$m));
$p = strrpos($row[description], ' ');
$row[description] = trim(substr($row[description],0,$p)).'...';
}
return "<font color='green' background-color='green' class="".$font['tiny'].""><strong>$row[description]</strong></font>n";
}
?>
Y para no dejar la incógnita del problema, pondré ejemplos de códigos erroneos:
Código 
<a class="V" href="caricaturas-caricatura-27-Antonio-Banderas.html"><center><img src="modules/My_eGallery/gallery/Actores/ban.gif" width="70" alt="Antonio Banderas" border="0" align="center>"></a>
No estas cerrando correctamente la etiqueta de la imagen.
Código 
<font color='green' background-color='green' class="V"><strong><style>Antonio Banderas</strong></font>
La etiqueta style no se usa para darle formato al texto directamente, como sería el caso de center, bold, etc. Dicha etiqueta solo se deberia colocar entre las etiquetas head.
Bueno, saludos
|
|
|
|