1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155
| <html>
<head>
<title><? echo $lang[0]; ?></title>
</head>
<body onContextMenu="return true">
<form name="form" method="post" action="">
<link href="../style.css" rel="stylesheet" type="text/css">
<link href="../style_inputtext.css" rel="stylesheet" type="text/css">
<script language="JavaScript" src="../fonctions.js"></script>
<script language="JavaScript" src="fonctions.js"></script>
<script language="JavaScript">
<!--
if (top.location.href == self.location.href) window.location.href = 'frames.php';
//-->
</script>
<h3 align=center><? echo $lang[0]; ?></h3>
<p align=center class=10><a href="photos_form.php?act=0" OnClick="photos_form=open_photos_form('');" target="photos_form"><? echo $lang[11]; ?></a></p>
<?
if ($_GET[act]==2 && isset($_GET[pid]))
{
$sql="SELECT count(photo_id) as compte FROM $tables[news_photos] WHERE photo_id=".$_GET[pid];
$result=mysql_query($sql);
$row0=mysql_fetch_array($result);
$sql="SELECT count(photo_id) as compte FROM $tables[videos_photos] WHERE photo_id=".$_GET[pid];
$result=mysql_query($sql);
$row1=mysql_fetch_array($result);
$compte=$row0[compte]+$row1[compte];
if ($compte==0)
{
$sql="SELECT * FROM $tables[photos] WHERE photo_id='$_GET[pid]'";
$result=mysql_query($sql);
if ($del=mysql_fetch_array($result))
{
$nomfic=$del[fichier];
$ext=strtolower(strstr($nomfic,"."));
$fichierr=SITEDIRROOT . '/' . IMAGESDIR . "/" . $nomfic;
$fichierv=SITEDIRROOT . '/' . IMAGESDIR . "/" . eregi_replace($ext, "-thb".$ext,$nomfic);
delete($fichierr);
delete($fichierv);
$sql="DELETE FROM $tables[photos] WHERE photo_id='$_GET[pid]'";
$result=mysql_query($sql);
}
}
else
{
$erreurs[]=$msg_lang[20];
echo js_errors($erreurs);
}
}
$col=5;
$lig=10;
$par_page=bcmul($col,$lig);
if (!isset($_GET[p])) $p=1;
else $p=$_GET[p];
$debut=($p-1)*$par_page;
$sql="SELECT * FROM $tables[photos]";
$result=mysql_query($sql);
$nb_photos=mysql_num_rows($result);
$nb_pages=ceil($nb_photos/$par_page);
if ($nb_pages>1)
{
$str_pages="Pages : ";
for ($i=1;$i<=$nb_pages;$i++)
{
if ($i!=$p) $str_pages.="<a href=\"?p=$i\">$i</a> ";
else $str_pages.=" $i ";
}
}
$sql="SELECT * FROM $tables[photos] ORDER BY date DESC LIMIT $debut,$par_page";
$result=mysql_query($sql);
echo "<p align=center>$str_pages </p>";
?>
<table border="0" align="center" cellpadding="0" cellspacing="0" class=TABLEBORDER width="70%">
<tr>
<td><? // bordure ?><table width="100%" border=0 cellspacing=1 cellpadding=3 align=center>
<?
for ($i=1;$result && $row=mysql_fetch_array($result);$i++)
{
$date=mysql2date($row[date]);
$nomfic=SITEDIRROOT . '/' . IMAGESDIR . "/" . $row[fichier];
$ext=strtolower(strstr($nomfic,"."));
$nomficv = eregi_replace($ext, "-thb".$ext,$nomfic);
if ($ficv=glob($nomficv))
{
$LVIG=120;
$HVIG=90;
$cell=160;
$nomficv=str_replace(SITEDIRROOT . '/' . IMAGESDIR . '/',"",$ficv[0]);
$dimv=getimagesize($ficv[0]);
if ($dimv[0]>$dimv[1])
{
if ($dimv[0]!=$LVIG || $dimv[1]!=$HVIG) $badthb="<a href=\"recadrer_form.php?pid=$row[photo_id]\" OnClick=\"recadrer_form=open_photos_form('recadrer_form.php?pid=$row[photo_id]');\" target=\"photos_form\"><img src=\"". WWWROOT . "/" . IMAGESDIR ."/warning.gif\" alt=\"".$msg_lang[22]."\" align=absmiddle border=0></a>";
else $badthb="";
}
if ($dimv[0]<$dimv[1])
{
if ($dimv[0]!=$HVIG || $dimv[1]!=$LVIG) $badthb="<a href=\"recadrer_form.php?pid=$row[photo_id]\" OnClick=\"recadrer_form=open_photos_form('recadrer_form.php?pid=$row[photo_id]');\" target=\"photos_form\"><img src=\"". WWWROOT . "/" . IMAGESDIR ."/warning.gif\" alt=\"".$msg_lang[22]."\" align=absmiddle border=0></a>";
else $badthb="";
}
}
$dimv[0]=$dimv[0]/2;
$dimv[1]=$dimv[1]/2;
$tablo.="<td align=center><img src=\"". SITEWWWROOT . '/' . IMAGESDIR . '/' . $nomficv . "\" alt=\"$row[titre] $row[description]\" width=\"$dimv[0]\" height=\"$dimv[1]\" class=\"thb\"><div>$badthb <a href=\"photos_form.php?act=1&pid=$row[photo_id]\" OnClick=\"photos_form=open_photos_form('');\" target=\"photos_form\"><img src=\"../images/editer.gif\" border=0 alt=\"$bt_lang[1]\"></a> <a href=\"?act=2&pid=$row[photo_id]\" OnClick=\"if (confirm('$msg_lang[3]')) return true; else return false;\"><img src=\"../images/supprimer.gif\" border=0 alt=\"$bt_lang[2]\"></a></div></td>";
if (bcmod($i,$col)==0) $tablo.="</tr>\n<tr class=TABLEDATA1 height=$cell>";
}
$tablo.="</tr></table>";
$tablo=ereg_replace("<tr class=TABLEDATA1 height=$cell></tr>","",$tablo);
$tablo="<table border=0 width=100%><tr class=TABLEDATA1 height=$cell>".$tablo;
echo $tablo;
?>
</table><? // bordure ?></td>
</tr>
</table>
<? echo "<p align=center>$str_pages </p>"; ?>
<p align=center class=10><a href="photos_form.php?act=0" OnClick="photos_form=open_photos_form('');" target="photos_form"><? echo $lang[11]; ?></a></p>
</form>
</body>
</html> |
Partager