Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- // -------------------------------------------------------------------------//
- // Nuked-KlaN - PHP Portal //
- // http://www.nuked-klan.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. //
- // -------------------------------------------------------------------------//
- if (!defined("INDEX_CHECK"))
- {
- die ("<div style=\"text-align: center;\">You cannot open this page directly</div>");
- }
- global $nuked, $language, $user;
- translate("modules/Divers_Gallery/lang/" . $language . ".lang.php");
- include("modules/Divers_Gallery/config.php");
- if (!$user)
- {
- $visiteur = 0;
- }
- else
- {
- $visiteur = $user[1];
- }
- $ModName = basename(dirname(__FILE__));
- $level_access = nivo_mod($ModName);
- if ($visiteur >= $level_access && $level_access > -1)
- {
- compteur("Divers_Gallery");
- function view_screen($sid)
- {
- global $nuked;
- $sql = mysql_query("SELECT titre, url FROM " . DIVERS_GALLERY_TABLE . " WHERE sid = '" . $sid . "'");
- list($titre, $url) = mysql_fetch_array($sql);
- $titre = stripslashes($titre);
- $titre = htmlentities($titre);
- $name = strrchr($url, '/');
- $name = substr($name, 1);
- $name_enc = rawurlencode($name);
- $url = str_replace($name, $name_enc, $url);
- echo "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Strict//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd\">\n"
- . "<html xmlns=\"http://www.w3.org/1999/xhtml\" xml:lang=\"fr\">\n"
- . "<head><title>" . $titre . "</title>\n"
- . "<meta http-equiv=\"Content-Type\" content=\"text/html; charset=iso-8859-1\" />\n"
- . "<meta http-equiv=\"content-style-type\" content=\"text/css\" />\n"
- . "<link title=\"style\" type=\"text/css\" rel=\"stylesheet\" href=\"themes/" . $theme . "/style.css\" /></head>\n"
- . "<body style=\"background: " . $bgcolor2 . ";margin-top: 0px;margin-bottom: 0px;margin-left: 0px;margin-right: 0px;\">\n"
- . "<div style=\"text-align: center;\"><a href=\"javascript: self.close()\"><img style=\"border: 0;\" src=\"" . $url . "\" alt=\"\" title=\"" . _CLICTOCLOSE . "\" /></a></div></body></html>";
- }
- function cat($cat)
- {
- global $nuked, $bgcolor1, $bgcolor2, $bgcolor3, $img_cat, $img_none, $image_resize, $image_gd;
- $counter = 0;
- $sql = mysql_query("SELECT cid, titre, description FROM " . DIVERS_GALLERY_CAT_TABLE . " WHERE parentid = '" . $cat . "'");
- $nb_subcat = mysql_num_rows($sql);
- if ($nb_subcat > 0)
- {
- echo "<table width=\"100%\" cellspacing=\"5\" cellpadding=\"0\" border=\"0\">\n";
- $sql = mysql_query("SELECT cid, titre, description FROM " . Divers_Gallery_CAT_TABLE . " WHERE parentid = '" . $cat . "' ORDER BY position, titre");
- while (list($catid, $parentcat, $parentdesc) = mysql_fetch_array($sql))
- {
- $parentcat = stripslashes($parentcat);
- $parentdesc = stripslashes($parentdesc);
- $parentcat = htmlentities($parentcat);
- $parentdesc = htmlentities($parentdesc);
- $parentdesc = BBcode($parentdesc);
- $parentdesc = icon($parentdesc);
- $sql_img = mysql_query("SELECT sid, url, url2, date FROM " . DIVERS_GALLERY_TABLE . " WHERE cat = '" . $catid . "' ORDER BY sid DESC");
- $nb_imgcat = mysql_num_rows($sql_img);
- list($sid, $url, $url2, $date) = mysql_fetch_array($sql_img);
- if ($url2 != "" && $url2 != "http://")
- {
- $image = $url2;
- }
- else if ($url2 == "" && $image_gd == "on" && @extension_loaded('gd') && !eregi("http://", $url) && is_file($url))
- {
- $org = $rep_img;
- $dest = $rep_img_gd;
- $name = str_replace ($org,'',$url);
- // instanciation de l'objet
- $thb = new thb;
- // appel du constructeur
- // nim de la source: image.jpeg
- // chemin source: ./ (dossier courant)
- // destianation: ./ (dossier courant)
- $thb->doImg($name, $org, $dest);
- // Config des parametres
- // prefix
- // taille du + grd coté
- // qualité
- $thb->SetParam('_tmb', $img_screen1, 90);
- // pour connaitre le nom et chemin de l'image réduite
- // résultat: ./image_thb.jpeg
- $thumb = $thb->GetThbName();
- // pour connaitre le nom et chemin de l'image d'origine
- // résultat: ./image.jpeg
- $source = $thb->GetOrigine();
- // Lance le redimensionenemt
- $thb->doThb();
- if ($thumb) $sql_insert = mysql_query ("UPDATE " . $nuked['prefix'] . "_divers_gallery SET url2 = '" . $thumb . "' WHERE sid = '" . $sid . "'");
- $image = $thumb;
- }
- if (!$image) $image = $url;
- $name = strrchr($image, '/');
- $name = substr($name, 1);
- $name_enc = rawurlencode($name);
- $image = str_replace($name, $name_enc, $image);
- if ($date)
- {
- $date = strftime("%x", $date);
- $last_date = _LASTADD . " " . $date;
- }
- else
- {
- $last_date = "";
- }
- if ($catid != $last_catid)
- {
- $counter++;
- if ($counter == 1)
- {
- echo "<tr>";
- }
- echo "<td style=\"width: 50%;\" valign=\"top\">\n"
- . "<table style=\"background: " . $bgcolor1 . ";border: 1px solid " . $bgcolor3 . ";\" width=\"100%\" cellspacing=\"1\" cellpadding=\"5\" border=\"0\">\n"
- . "<tr><td colspan=\"2\"><a href=\"index.php?file=Divers_Gallery&op=categorie&cat=" . $catid . "\"><b>" . $parentcat . "</b></a></td></tr>\n"
- . "<tr><td style=\"width: 50px;background: " . $bgcolor2 . ";\" align=\"center\" valign=\"middle\">";
- if ($image != "")
- {
- echo "<a href=\"index.php?file=Divers_Gallery&op=categorie&cat=" . $catid . "\">" . img_size($image, $img_cat, $parentcat, $image_resize) . "</a>";
- }
- else
- {
- echo "<a href=\"index.php?file=Divers_Gallery&op=categorie&cat=" . $catid . "\">" . img_size($img_none, $img_cat, $parentcat, $image_resize) . "</a>";
- }
- echo "</td><td style=\"height: 100%;background: " . $bgcolor2 . ";\">\n"
- . "<table cellspacing=\"0\" cellpadding=\"0\" border=\"0\">\n";
- if ($parentdesc != "") echo "<tr><td>" . $parentdesc . "</td></tr>\n";
- echo "<tr><td>" . $nb_imgcat . " " . _SCREENINDB;
- if ($last_date != "") echo "<br />" . $last_date;
- echo "</td></tr></table></td></tr></table></td>\n";
- if ($counter == 2)
- {
- $counter = 0;
- echo "</tr>";
- }
- $last_catid = $catid;
- }
- }
- if ($counter == 1) echo "<td style=\"width: 50%;border: 1px solid " . $bgcolor3 . ";\"> </td></tr>\n";
- echo "</table>\n";
- }
- }
- function categorie($cat)
- {
- global $nuked;
- opentable();
- if ($nuked['divers_gallery_title'] != "")
- {
- $title = $nuked['divers_gallery_title'];
- }
- else
- {
- $title = _divers_gallery;
- }
- $sql = mysql_query("SELECT titre, description, parentid FROM " . DIVERS_GALLERY_CAT_TABLE . " WHERE cid = '" . $cat . "'");
- list($cat_titre, $cat_desc, $parentid) = mysql_fetch_array($sql);
- $cat_titre = stripslashes($cat_titre);
- $cat_desc = stripslashes($cat_desc);
- $cat_titre = htmlentities($cat_titre);
- $cat_desc = htmlentities($cat_desc);
- $cat_desc = BBcode($cat_desc);
- $cat_desc = icon($cat_desc);
- if ($parentid > 0)
- {
- $sql_parent = mysql_query("SELECT titre FROM " . DIVERS_GALLERY_CAT_TABLE . " WHERE cid = '" . $parentid . "'");
- list($parent_titre) = mysql_fetch_array($sql_parent);
- $parent_titre = stripslashes($parent_titre);
- $parent_titre = htmlentities($parent_titre);
- echo "<br /><div style=\"text-align: center;\"><a href=\"index.php?file=Divers_Gallery\" style=\"text-decoration:none\"><big><b>" . $title . "</b></big></a> > <a href=\"index.php?file=Divers_Gallery&op=categorie&cat=" . $parentid . "\" style=\"text-decoration:none\"><big><b>" . $parent_titre . "</b></big></a> > <big><b>" . $cat_titre . "</b></big></div><br />\n";
- }
- else
- {
- echo "<br /><div style=\"text-align: center;\"><a href=\"index.php?file=Divers_Gallery\" style=\"text-decoration:none\"><big><b>" . $title . "</b></big></a> > <big><b>" . $cat_titre . "</b></big></div><br />\n";
- }
- if ($cat_desc != "")
- {
- echo "<div style=\"text-align: center;\">" . $cat_desc . "</div><br />\n";
- }
- cat($cat);
- classe($cat);
- closetable();
- }
- function description($sid)
- {
- global $nuked, $user, $visiteur, $orderby, $bgcolor1, $bgcolor2, $bgcolor3, $img_width, $image_resize;
- if ($nuked['divers_gallery_title'] != "")
- {
- $title = $nuked['divers_gallery_title'];
- }
- else
- {
- $title = _divers_gallery;
- }
- opentable();
- $upd = mysql_query("UPDATE " . DIVERS_GALLERY_TABLE . " SET count = count + 1 WHERE sid = '" . $sid . "'");
- $sql = mysql_query("SELECT cat, titre, description, autor, url, url_file, date, count FROM " . DIVERS_GALLERY_TABLE . " WHERE sid = '" . $sid . "'");
- list($cat, $titre, $description, $autor, $url, $url_file, $date, $count) = mysql_fetch_array($sql);
- $titre = stripslashes($titre);
- $description = stripslashes($description);
- $autor = stripslashes($autor);
- $titre = htmlentities($titre);
- $description = htmlentities($description);
- $autor = htmlentities($autor);
- $name = strrchr($url, '/');
- $name = substr($name, 1);
- $name_enc = rawurlencode($name);
- $url = str_replace($name, $name_enc, $url);
- if (!$name) $name = "N/A";
- if ($date) $date = strftime("%x %H:%M", $date);
- else $date = "N/A";
- if ($url_file != "")
- {
- $button = "<br /><div style=\"text-align: center;\"><input type=\"button\" value=\"" . _DOWNFILE . "\" onclick=\"window.open('" . $url_file . "')\" /><div><br />\n";
- }
- else
- {
- $button = "<br />\n";
- }
- $sql2 = mysql_query("SELECT titre, parentid FROM " . DIVERS_GALLERY_CAT_TABLE . " WHERE cid = '" . $cat . "'");
- list($cat_name, $parentid) = mysql_fetch_array($sql2);
- $cat_name = stripslashes($cat_name);
- $cat_name = htmlentities($cat_name);
- if ($cat == 0)
- {
- $category = _NONE;
- }
- else if ($parentid > 0)
- {
- $sql3 = mysql_query("SELECT titre FROM " . DIVERS_GALLERY_CAT_TABLE . " WHERE cid = '" . $parentid . "'");
- list($parent_name) = mysql_fetch_array($sql3);
- $parent_name = stripslashes($parent_name);
- $parent_name = htmlentities($parent_name);
- $category = "<a href=\"index.php?file=Divers_Gallery&op=categorie&cat=" . $parentid . "\">" . $parent_name . "</a> -> <a href=\"index.php?file=Divers_Gallery&op=categorie&cat=" . $cat . "\">" . $cat_name . "</a>";
- }
- else
- {
- $category = "<a href=\"index.php?file=Divers_Gallery&op=categorie&cat=" . $cat . "\">" . $cat_name . "</a>";
- }
- if ($orderby == "name")
- {
- $sql_next = mysql_query("SELECT sid FROM " . DIVERS_GALLERY_TABLE . " WHERE cat = '" . $cat . "' AND titre > '" . $titre . "' ORDER BY titre LIMIT 0, 1");
- list($nextid) = mysql_fetch_array($sql_next);
- $sql_last = mysql_query("SELECT sid FROM " . DIVERS_GALLERY_TABLE . " WHERE cat = '" . $cat . "' AND titre < '" . $titre . "' ORDER BY titre DESC LIMIT 0, 1");
- list($lastid) = mysql_fetch_array($sql_last);
- }
- else if ($orderby == "count")
- {
- $sql_next = mysql_query("SELECT sid FROM " . DIVERS_GALLERY_TABLE . " WHERE cat = '" . $cat . "' AND count < '" . $count . "' ORDER BY count DESC LIMIT 0, 1");
- list($nextid) = mysql_fetch_array($sql_next);
- $sql_last = mysql_query("SELECT sid FROM " . DIVERS_GALLERY_TABLE . " WHERE cat = '" . $cat . "' AND count > '" . $count . "' ORDER BY count LIMIT 0, 1");
- list($lastid) = mysql_fetch_array($sql_last);
- }
- else if ($orderby == "note")
- {
- $sql_note = mysql_query("SELECT AVG(vote) FROM " . VOTE_TABLE . " WHERE vid = '" . $sid . "' AND module = 'Divers_Gallery'");
- list($note) = mysql_fetch_array($sql_note);
- $sql_next = mysql_query("SELECT L.sid, AVG(V.vote) AS note FROM " . DIVERS_GALLERY_TABLE . " AS L LEFT JOIN " . VOTE_TABLE . " AS V ON L.sid = V.vid AND V.module = 'Divers_Gallery' WHERE L.cat = '" . $cat . "' GROUP BY L.sid HAVING note < '" . $note . "' ORDER BY note DESC LIMIT 0, 1");
- list($nextid) = mysql_fetch_array($sql_next);
- $sql_last = mysql_query("SELECT L.sid, AVG(V.vote) AS note FROM " . DIVERS_GALLERY_TABLE . " AS L LEFT JOIN " . VOTE_TABLE . " AS V ON L.sid = V.vid AND V.module = 'Divers_Gallery' WHERE L.cat = '" . $cat . "' GROUP BY L.sid HAVING note > '" . $note . "' ORDER BY note LIMIT 0, 1");
- list($lastid) = mysql_fetch_array($sql_last);
- }
- else
- {
- $orderby = "news";
- $sql_next = mysql_query("SELECT sid FROM " . DIVERS_GALLERY_TABLE . " WHERE cat = '" . $cat . "' AND sid < '" . $sid . "' ORDER BY sid DESC LIMIT 0, 1");
- list($nextid) = mysql_fetch_array($sql_next);
- $sql_last = mysql_query("SELECT sid FROM " . DIVERS_GALLERY_TABLE . " WHERE cat = '" . $cat . "' AND sid > '" . $sid . "' ORDER BY sid LIMIT 0, 1");
- list($lastid) = mysql_fetch_array($sql_last);
- }
- if ($nextid != "")
- {
- $next = "<small><a href=\"index.php?file=Divers_Gallery&op=description&sid=" . $nextid . "&orderby=" . $orderby . "\">" . _NEXTIMG . "</a> ></small>";
- }
- if ($lastid != "")
- {
- $prev = "<small>< <a href=\"index.php?file=Divers_Gallery&op=description&sid=" . $lastid . "&orderby=" . $orderby . "\">" . _LASTIMG . "</a> </small>";
- }
- echo "<br />\n";
- if ($visiteur >= admin_mod("Divers_Gallery"))
- {
- echo"<script type=\"text/javascript\">\n"
- ."<!--\n"
- ."\n"
- . "function delimg(titre, id)\n"
- . "{\n"
- . "if (confirm('" . _SCREENDELETE . " '+titre+' ! " . _CONFIRM . "'))\n"
- . "{document.location.href = 'index.php?file=Divers_Gallery&page=admin&op=del_screen&sid='+id;}\n"
- . "}\n"
- . "\n"
- . "// -->\n"
- . "</script>\n";
- echo "<div style=\"text-align: right;\"><a href=\"index.php?file=Divers_Gallery&page=admin&op=edit_screen&sid=" . $sid . "\"><img style=\"border: 0;\" src=\"images/edition.gif\" alt=\"\" title=\"" . _EDIT . "\" /></a>"
- . " <a href=\"javascript:delimg('" . addslashes($titre) . "', '" . $sid . "');\"><img style=\"border: 0;\" src=\"images/delete.gif\" alt=\"\" title=\"" . _DEL . "\" /></a></div>\n";
- }
- echo "<br /><div style=\"text-align: center;\"><a href=\"index.php?file=Divers_Gallery\" style=\"text-decoration:none\"><big><b>" . $title . "</b></big></a></div><br />\n"
- . "<table style=\"margin-left: auto;margin-right: auto;text-align: left;\" cellpadding=\"20\" cellspacing=\"0\" border=\"0\">\n"
- . "<tr style=\"background: " . $bgcolor1 . ";\"><td style=\"border: 1px dashed " . $bgcolor3 . ";\">"
- . "<a href=\"" . $url . "\" class=\"thickbox\" title=\"" . $titre . "\">"
- . img_size($url, $img_width, _CLICTOSCREEN, $image_resize) . "</a></td></tr></table><br />\n"
- . "<table style=\"margin-left: auto;margin-right: auto;text-align: left;\" width=\"90%\" cellpadding=\"3\" cellspacing=\"0\">\n"
- . "<tr><td align=\"left\">" . $prev . "</td><td align=\"right\">" . $next . "</td></tr></table>\n"
- . "<table style=\"margin-left: auto;margin-right: auto;text-align: left;background: " . $bgcolor2 . ";\" width=\"90%\" cellpadding=\"3\" cellspacing=\"3\" border=\"0\">\n"
- . "<tr style=\"background: " . $bgcolor2 . ";\"><td style=\"border: 1px solid " . $bgcolor3 . ";\" align=\"center\"><big><b>" . $titre . "</b></big></td></tr>\n";
- if ($description != "")
- {
- $description = BBcode($description);
- $description = icon($description);
- echo "<tr style=\"background: " . $bgcolor1 . ";\"><td style=\"border: 1px dashed " . $bgcolor3 . ";\">" . $description . "</td></tr>\n"
- . "<tr style=\"background: " . $bgcolor2 . ";\"><td> </td></tr>";
- }
- echo "<tr style=\"background: " . $bgcolor1 . ";\"><td style=\"border: 1px dashed " . $bgcolor3 . ";\"><b>" . _CAT . " :</b> " . $category . "</td></tr>\n";
- if ($autor != "")
- {
- echo "<tr style=\"background: " . $bgcolor1 . ";\"><td style=\"border: 1px dashed " . $bgcolor3 . ";\"><b>" . _AUTHOR . " :</b> " . $autor . "</td></tr>\n";
- }
- echo "<tr style=\"background: " . $bgcolor1 . ";\"><td style=\"border: 1px dashed " . $bgcolor3 . ";\"><b>" . _ADDTHE . " :</b> " . $date . "</td></tr>\n"
- . "<tr style=\"background: " . $bgcolor1 . ";\"><td style=\"border: 1px dashed " . $bgcolor3 . ";\"><b>" . _FILENAME . " :</b> " . $name . "</td></tr>\n"
- . "<tr style=\"background: " . $bgcolor1 . ";\"><td style=\"border: 1px dashed " . $bgcolor3 . ";\"><b>" . _SEEN . " :</b> " . $count . " " . _TIMES . "</td></tr>\n"
- . "<tr style=\"background: " . $bgcolor1 . ";\"><td style=\"border: 1px dashed " . $bgcolor3 . ";\">";
- include ("modules/Comment/index.php");
- com_index("Divers_Gallery", $sid);
- echo "</td></tr><tr style=\"background: " . $bgcolor1 . ";\"><td style=\"border: 1px dashed " . $bgcolor3 . ";\">";
- include ("modules/Vote/index.php");
- vote_index("Divers_Gallery", $sid);
- echo "</td></tr></table>" . $button;
- closetable();
- }
- function index()
- {
- global $nuked, $bgcolor1, $bgcolor2, $bgcolor3, $nb_subcat, $orderby, $p;
- if ($nuked['divers_gallery_title'] != "")
- {
- $title = $nuked['divers_gallery_title'];
- }
- else
- {
- $title = _divers_gallery;
- }
- opentable();
- echo "<br /><div style=\"text-align: center;\"><big><b>" . $title . "</b></big></div>\n"
- . "<div style=\"text-align: center;\"><br />\n"
- . "[ " . _INDEX_DIVERS_GALLERY . " | "
- . "<a href=\"index.php?file=Divers_Gallery&op=classe&orderby=news\" style=\"text-decoration: underline\">" . _NEWSIMG . "</a> | "
- . "<a href=\"index.php?file=Divers_Gallery&op=classe&orderby=count\" style=\"text-decoration: underline\">" . _TOPIMG . "</a> | "
- . "<a href=\"index.php?file=Suggest&module=Divers_Gallery\" style=\"text-decoration: underline\">" . _SUGGESTIMG . "</a> ]</div><br />\n";
- $sql_nbimages = mysql_query("SELECT sid FROM " . DIVERS_GALLERY_TABLE . "");
- $nb_images = mysql_num_rows($sql_nbimages);
- $sql_nbcat = mysql_query("SELECT cid FROM " . DIVERS_GALLERY_CAT_TABLE . "");
- $nb_cat = mysql_num_rows($sql_nbcat);
- if ($nb_cat > 0)
- {
- echo "<table width=\"100%\" cellspacing=\"0\" cellpadding=\"0\" border=\"0\"><tr><td>";
- $sql_cat = mysql_query("SELECT cid, titre, description FROM " . DIVERS_GALLERY_CAT_TABLE . " WHERE parentid = '0' ORDER BY position, titre");
- while (list($cid, $titre, $description) = mysql_fetch_array($sql_cat))
- {
- $titre = stripslashes($titre);
- $description = stripslashes($description);
- $titre = htmlentities($titre);
- $description = htmlentities($description);
- $description = BBcode($description);
- $description = icon($description);
- $sql_img = mysql_query("SELECT sid, date FROM " . DIVERS_GALLERY_TABLE . " WHERE cat = '" . $cid . "' ORDER BY sid DESC LIMIT 0, 1");
- $nb_imgcat = mysql_num_rows($sql_img);
- list($sid, $date) = mysql_fetch_row($sql_img);
- $sql_img_tt = mysql_query("SELECT sid FROM " . DIVERS_GALLERY_TABLE . ", " . DIVERS_GALLERY_CAT_TABLE . " WHERE cat = cid AND (parentid = '" . $cid . "' OR cid = '" . $cid . "')");
- $nb_imgcat_tt = mysql_num_rows($sql_img_tt);
- $sql_nbcat = mysql_query("SELECT cid FROM " . DIVERS_GALLERY_CAT_TABLE . " WHERE parentid = '" . $cid . "'");
- $nb_nbcat = mysql_num_rows($sql_nbcat);
- if ($date != "")
- {
- $date = strftime("%x", $date);
- $last_date = "" . _LASTADD . " $date";
- }
- else
- {
- $last_date = "";
- }
- echo "<table width=\"100%\" cellspacing=\"0\" cellpadding=\"0\" border=\"0\" style=\"border: 1px solid " . $bgcolor3 . ";\"><tr><td>\n"
- . "<table style=\"background: " . $bgcolor2 . ";\" width=\"100%\" cellspacing=\"1\" cellpadding=\"5\" border=\"0\">\n"
- . "<tr><td style=\"width: 80%;background: " . $bgcolor1 . ";\"><a href=\"index.php?file=Divers_Gallery&op=categorie&cat=" . $cid . "\"><big><b>" . $titre . "</b></big></a></td>\n"
- . "<td style=\"width: 10%;background: " . $bgcolor1 . ";\">" . $nb_imgcat_tt . " " . _SCREENINDB . "</td>\n";
- if ($nb_nbcat)
- {
- echo "<td style=\"width: 10%;background: " . $bgcolor1 . ";\">" . $nb_nbcat . " " . _NBCAT . "</td>";
- }
- echo "</tr></table></td></tr><tr><td>";
- if ($nb_nbcat == 0)
- {
- echo "<table width=\"100%\"><tr><td> </td></tr><tr><td align=\"center\">" . $description . "</td></tr><tr><td> </td></tr></table>\n";
- }
- else
- {
- cat($cid);
- }
- echo "</td></tr></table><br />\n";
- }
- echo "</td></tr></table>\n";
- }
- else
- {
- echo "<br />";
- }
- classe("0");
- if ($nb_cat > 0 || $nb_images > 0) echo "<br /><div style=\"text-align: center;\"><small>( <i>" . _THEREIS . " " . $nb_images . " " . _SCREENINDB . " & " . $nb_cat . " " . _NBCAT . " " . _INDATABASE . "</i> )</small></div><br /><br />\n";
- else echo "<div style=\"text-align: center;\">" . _NOSCREENINDB . "</div><br /><br />\n";
- closetable();
- }
- function classe($cat)
- {
- global $nuked, $p, $bgcolor1, $bgcolor2, $bgcolor3, $op, $orderby, $img_screen1, $img_screen2, $img_screen3, $image_resize;
- $nb_img_guest = $nuked['max_img'];
- $nb_img_line = $nuked['max_img_line'];
- if ($cat > 0)
- {
- $sql = mysql_query("SELECT cid FROM " . DIVERS_GALLERY_CAT_TABLE . " WHERE parentid = '" . $cat . "'");
- $nb_subcat = mysql_num_rows($sql);
- }
- else
- {
- $nb_subcat = 0;
- }
- if ($op == "classe")
- {
- if ($nuked['divers_gallery_title'] != "")
- {
- $title = $nuked['divers_gallery_title'];
- }
- else
- {
- $title = _divers_gallery;
- }
- echo "<br /><div style=\"text-align: center;\"><big><b>" . $title . "</b></big></div>\n"
- . "<div style=\"text-align: center;\"><br />\n"
- . "[ <a href=\"index.php?file=Divers_Gallery\" style=\"text-decoration: underline\">" . _INDEX_Divers_Gallery . "</a> | ";
- if ($orderby == "news")
- {
- echo _NEWSIMG . " | ";
- }
- else
- {
- echo "<a href=\"index.php?file=Divers_Gallery&op=classe&orderby=news\" style=\"text-decoration: underline\">" . _NEWSIMG . "</a> | ";
- }
- if ($orderby == "count")
- {
- echo _TOPIMG . " | ";
- }
- else
- {
- echo "<a href=\"index.php?file=Divers_Gallery&op=classe&orderby=count\" style=\"text-decoration: underline\">" . _TOPIMG . "</a> | ";
- }
- echo "<a href=\"index.php?file=Suggest&module=Divers_Gallery\" style=\"text-decoration: underline\">" . _SUGGESTIMG . "</a> ]</div><br />\n";
- }
- if ($cat != "") $where = "WHERE L.cat = '" . $cat . "'";
- else $where = "";
- if ($orderby == "name")
- {
- $order = "ORDER BY L.titre";
- }
- else if ($orderby == "count")
- {
- $order = "ORDER BY L.count DESC";
- }
- else if ($orderby == "note")
- {
- $order = "ORDER BY note DESC";
- }
- else
- {
- $orderby = "news";
- $order = "ORDER BY L.sid DESC";
- }
- $sql = mysql_query("SELECT L.sid, L.titre, L.url, L.url2, L.date, AVG(V.vote) AS note FROM " . DIVERS_GALLERY_TABLE . " AS L LEFT JOIN " . VOTE_TABLE . " AS V ON L.sid = V.vid AND V.module = 'Divers_Gallery' " . $where . " GROUP BY L.sid " . $order);
- $count = mysql_num_rows($sql);
- if ($count > 1 && $cat != "")
- {
- echo "<table style=\"margin-left: auto;margin-right: auto;text-align: left;\" width=\"90%\">\n"
- . "<tr><td align=\"right\"><small>" . _ORDERBY . " : ";
- if ($orderby == "news")
- {
- echo "<b>" . _DATE . "</b> | ";
- }
- else
- {
- echo "<a href=\"index.php?file=Divers_Gallery&op=" . $op . "&orderby=news&cat=" . $cat . "\">" . _DATE . "</a> | ";
- }
- if ($orderby == "name")
- {
- echo "<b>" . _NAME . "</b> | ";
- }
- else
- {
- echo "<a href=\"index.php?file=Divers_Gallery&op=" . $op . "&orderby=name&cat=" . $cat . "\">" . _NAME . "</a> | ";
- }
- if ($orderby == "count")
- {
- echo "<b>" . _TOPFILE . "</b> | ";
- }
- else
- {
- echo "<a href=\"index.php?file=Divers_Gallery&op=" . $op . "&orderby=count&cat=" . $cat . "\">" . _TOPFILE . "</a> | ";
- }
- if ($orderby == "note")
- {
- echo "<b>" . _NOTE . "</b> ";
- }
- else
- {
- echo "<a href=\"index.php?file=Divers_Gallery&op=" . $op . "&orderby=note&cat=" . $cat . "\">" . _NOTE . "</a> ";
- }
- echo "</small></td></tr></table>\n";
- }
- if ($count > 0)
- {
- if (!$p) $p = 1;
- $start = $p * $nb_img_guest - $nb_img_guest;
- echo "<table style=\"margin-left: auto;margin-right: auto;text-align: left;\" width=\"90%\" cellspacing=\"5\" cellpadding=\"10\" border=\"0\">\n"
- . "<tr><td style=\"background: " . $bgcolor1 . ";border: 1px solid " . $bgcolor3 . ";\" colspan=\"" . $nb_img_line . "\">";
- if ($count > $nb_img_guest)
- {
- $url_page = "index.php?file=Divers_Gallery&op=" . $op . "&cat=" . $cat . "&orderby=" . $orderby;
- number($count, $nb_img_guest, $url_page);
- }
- else
- {
- echo " ";
- }
- echo "</td></tr>\n";
- $l = 0;
- $pourcent = 100 / $nb_img_line;
- $seek = mysql_data_seek($sql, $start);
- for($i = 0;$i < $nb_img_guest;$i++)
- {
- if (list($sid, $titre, $url, $url2, $date) = mysql_fetch_row($sql))
- {
- if ($url2 != "" && $url2 != "http://")
- {
- $img = $url2;
- }
- else
- {
- $img = $url;
- }
- if ($nb_img_line > 4)
- {
- $img_w = $img_screen3;
- }
- else if ($nb_img_line > 3)
- {
- $img_w = $img_screen2;
- }
- else
- {
- $img_w = $img_screen1;
- }
- $name = strrchr($img, '/');
- $name = substr($name, 1);
- $name_enc = rawurlencode($name);
- $img = str_replace($name, $name_enc, $img);
- $titre = stripslashes($titre);
- $titre = htmlentities($titre);
- if ($date != "") $alt = _ADDTHE . " " . strftime("%x %H:%M", $date);
- else $alt = $titre;
- if ($sid != $last_sid)
- {
- $l++;
- if ($l == 1)
- {
- echo "<tr>";
- }
- echo "<td style=\"width: " . $pourcent . "%;background: " . $bgcolor1 . ";border: 1px solid $bgcolor3;\" align=\"center\">"
- . "<a href=\"index.php?file=Divers_Gallery&op=description&sid=" . $sid . "&orderby=" . $orderby . "\">" . img_size($img, $img_w, $alt, $image_resize) . "</a><br />\n"
- . "<a href=\"index.php?file=Divers_Gallery&op=description&sid=" . $sid . "&orderby=" . $orderby . "\"><b>" . $titre . "</b></a></td>\n";
- if ($l == $nb_img_line)
- {
- $l = 0;
- echo "</tr>";
- }
- $last_sid = $sid;
- }
- }
- }
- if ($l > 0)
- {
- for ($j = $l;$j < $nb_img_line;$j++)
- {
- echo "<td style=\"width: " . $pourcent . "%;background: " . $bgcolor1 . ";border: 1px solid $bgcolor3;\"> </td>\n";
- }
- echo "</tr>\n";
- }
- if ($nb_subcat == 0 && $count == 0) echo "<tr><td align=\"center\" colspan=\"$nb_img_line\">" . _NOSCREEN . "</td></tr>\n";
- echo "<tr><td style=\"background: " . $bgcolor1 . ";border: 1px solid $bgcolor3;\" colspan=\"$nb_img_line\">";
- if ($count > $nb_img_guest)
- {
- $url_page = "index.php?file=Divers_Gallery&op=" . $op . "&cat=" . $cat . "&orderby=" . $orderby;
- number($count, $nb_img_guest, $url_page);
- }
- else
- {
- echo " ";
- }
- echo "</td></tr></table><br />\n";
- }
- else
- {
- if ($nb_subcat == 0 && $cat > 0) echo "<div style=\"text-align: center;\"><br />" . _NOSCREEN . "</div><br /><br />\n";
- if ($op == "classe") echo "<div style=\"text-align: center;\"><br />" . _NOSCREENINDB . "</div><br /><br />\n";
- }
- }
- function img_size($image, $largeur, $title, $image_resize)
- {
- if ($image_resize == "off") $test = 0;
- else if (eregi("http://", $image) && $image_resize == "local") $test = 0;
- else $test = 1;
- if ($test == 1) $style = "style=\"border: 1px solid #000000; overflow: auto; max-width: " . $largeur . "px; width: expression(this.scrollWidth >= " . $largeur . "? '" . $largeur . "px' : 'auto');\"";
- else $style = "style=\"border: 1px solid #000000;\"";
- $image_resize = "<img " . $style . " src=\"" . checkimg($image) . "\" alt=\"\" title=\"" . $title . "\" />";
- return($image_resize);
- }
- switch ($op)
- {
- case "view_screen":
- view_screen($sid);
- break;
- case "description":
- description($sid);
- break;
- case "categorie":
- categorie($cat);
- break;
- case "classe":
- opentable();
- classe($cat);
- closetable();
- break;
- default:
- index();
- break;
- }
- }
- else if ($level_access == -1)
- {
- opentable();
- echo "<br /><br /><div style=\"text-align: center;\">" . _MODULEOFF . "<br /><br /><a href=\"javascript:history.back()\"><b>" . _BACK . "</b></a><br /><br /></div>";
- closetable();
- }
- else if ($level_access == 1 && $visiteur == 0)
- {
- opentable();
- echo "<br /><br /><div style=\"text-align: center;\">" . _USERENTRANCE . "<br /><br /><b><a href=\"index.php?file=User&op=login_screen\">" . _LOGINUSER . "</a> | <a href=\"index.php?file=User&op=reg_screen\">" . _REGISTERUSER . "</a></b><br /><br /></div>";
- closetable();
- }
- else
- {
- opentable();
- echo "<br /><br /><div style=\"text-align: center;\">" . _NOENTRANCE . "<br /><br /><a href=\"javascript:history.back()\"><b>" . _BACK . "</b></a><br /><br /></div>";
- closetable();
- }
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement