Teya Salat
load_lng('gallery'); $textl = $lng['gallery']; require('../incfiles/head.php'); // Ограничиваем доступ к Галерее $error = ''; if (!$set['mod_gal'] && $rights < 7) $error = $lng_gal['gallery_closed']; elseif ($set['mod_gal'] == 1 && !$user_id) $error = $lng['access_guest_forbidden']; if ($error) { require_once('../incfiles/head.php'); echo '

' . $error . '

'; require_once('../incfiles/end.php'); exit; } $array = array ( 'new', 'edf', 'delf', 'edit', 'del', 'load', 'upl', 'cral', 'razd' ); if (in_array($act, $array) && file_exists($act . '.php')) { require_once($act . '.php'); } else { if (!$set['mod_gal']) echo '

' . $lng_gal['gallery_closed'] . '

'; if ($id) { $type = mysql_query("SELECT * FROM `gallery` WHERE `id` = '$id' LIMIT 1"); $ms = mysql_fetch_assoc($type); switch ($ms['type']) { case 'rz': /* ----------------------------------------------------------------- Просмотр раздела ----------------------------------------------------------------- */ echo '
' . $lng['gallery'] . ' | ' . $ms['text'] . '
'; $total = mysql_result(mysql_query("SELECT COUNT(*) FROM `gallery` WHERE `type` = 'al' AND `refid` = '$id'"), 0); if ($total) { $req = mysql_query("SELECT * FROM `gallery` WHERE `type` = 'al' AND `refid` = '$id' ORDER BY `time` DESC LIMIT $start, $kmess"); while ($res = mysql_fetch_assoc($req)) { echo $i % 2 ? '
' : '
'; $total_f = mysql_result(mysql_query("SELECT COUNT(*) FROM `gallery` WHERE `type` = 'ft' AND `refid` = '" . $res['id'] . "'"), 0); echo '' . $res['text'] . ' (' . $total_f . ')
'; ++$i; } } else { echo ''; } echo '
' . $lng['total'] . ': ' . $total . '

'; if ($total > $kmess) { echo '

' . functions::display_pagination('index.php?id=' . $id . '&', $start, $total, $kmess) . '

' . '

' . '' . '' . '

'; } if ($rights >= 6) { echo "" . $lng_gal['create_album'] . "
"; echo "" . $lng_gal['delete_section'] . "
"; echo "" . $lng_gal['edit_section'] . "
"; } echo "В галерею

"; break; case 'al': /* ----------------------------------------------------------------- Просмотр альбома ----------------------------------------------------------------- */ $delimag = opendir("temp"); while ($imd = readdir($delimag)) { if ($imd != "." && $imd != ".." && $imd != "index.php") { $im[] = $imd; } } closedir($delimag); $totalim = count($im); for ($imi = 0; $imi < $totalim; $imi++) { $filtime[$imi] = filemtime("temp/$im[$imi]"); $tim = time(); $ftime1 = $tim - 10; if ($filtime[$imi] < $ftime1) { } } $rz = mysql_query("select * from `gallery` where type='rz' and id='" . $ms['refid'] . "';"); $rz1 = mysql_fetch_array($rz); echo '
' . $lng['gallery'] . ' | ' . $rz1['text'] . ' | ' . $ms['text'] . '
'; $total = mysql_result(mysql_query("SELECT COUNT(*) FROM `gallery` WHERE `type` = 'ft' AND `refid` = '$id'"), 0); $req = mysql_query("SELECT * FROM `gallery` WHERE `type` = 'ft' AND `refid` = '$id' ORDER BY `time` DESC LIMIT $start, $kmess"); while ($fot1 = mysql_fetch_array($req)) { echo $i % 2 ? '
' : '
'; if(file_exists('foto/' . $fot1['name'])){ echo ''; $infile = "foto/$fot1[name]"; if (!empty($_SESSION['frazm'])) { $razm = $_SESSION['frazm']; } else { $razm = 50; } $sizs = GetImageSize($infile); $width = $sizs[0]; $height = $sizs[1]; $quality = 80; $x_ratio = $razm / $width; $y_ratio = $razm / $height; if (($width <= $razm) && ($height <= $razm)) { $tn_width = $width; $tn_height = $height; } else if (($x_ratio * $height) < $razm) { $tn_height = ceil($x_ratio * $height); $tn_width = $razm; } else { $tn_width = ceil($y_ratio * $width); $tn_height = $razm; } $format = functions::format($infile); switch ($format) { case "gif": $im = ImageCreateFromGIF($infile); break; case "jpg": $im = ImageCreateFromJPEG($infile); break; case "jpeg": $im = ImageCreateFromJPEG($infile); break; case "png": $im = ImageCreateFromPNG($infile); break; } $im1 = imagecreatetruecolor($tn_width, $tn_height); $namefile = "$fot1[name]"; imagecopyresized($im1, $im, 0, 0, 0, 0, $tn_width, $tn_height, $width, $height); switch ($format) { case "gif": $imagnam = "temp/$namefile.temp.gif"; ImageGif($im1, $imagnam, $quality); echo "
"; break; case "jpg": $imagnam = "temp/$namefile.temp.jpg"; imageJpeg($im1, $imagnam, $quality); echo "
"; break; case "jpeg": $imagnam = "temp/$namefile.temp.jpg"; imageJpeg($im1, $imagnam, $quality); echo "
"; break; case "png": $imagnam = "temp/$namefile.temp.png"; imagePng($im1, $imagnam, $quality); echo "
"; break; } imagedestroy($im); imagedestroy($im1); $fotsz = filesize("foto/$ms[name]"); $vrf = $fot1['time'] + $set_user['sdvig'] * 3600; $vrf1 = date("d.m.y / H:i", $vrf); echo '
'; if (!empty($fot1['text'])) echo "$fot1[text]
"; if ($rights >= 6) { echo "" . $lng['edit'] . " | " . $lng['delete'] . "
"; } } else { echo $lng_gal['image_missing'] . '
' . $lng['delete'] . ''; } echo "
"; ++$i; } echo '
' . $lng['total'] . ': ' . $total . '

'; if ($total > $kmess) { echo '

' . functions::display_pagination('index.php?id=' . $id . '&', $start, $total, $kmess) . '

' . '

' . '' . '' . '

'; } if (($user_id && $rz1['user'] == 1 && $ms['text'] == $login && !$ban['1'] && !$ban['14']) || $rights >= 6) { echo '' . $lng_gal['upload_photo'] . '
'; } if ($rights >= 6) { echo "" . $lng_gal['delete_album'] . "
"; echo "" . $lng_gal['edit_album'] . "
"; } echo "" . $lng_gal['to_gallery'] . "

"; break; case 'ft': /* ----------------------------------------------------------------- Просмотр фото ----------------------------------------------------------------- */ echo "
 "; $infile = "foto/$ms[name]"; if (!empty($_SESSION['frazm'])) { $razm = $_SESSION['frazm']; } else { $razm = 50; } $sizs = GetImageSize($infile); $width = $sizs[0]; $height = $sizs[1]; $quality = 85; $format = functions::format($infile); switch ($format) { case "gif": $im = ImageCreateFromGIF($infile); break; case "jpg": $im = ImageCreateFromJPEG($infile); break; case "jpeg": $im = ImageCreateFromJPEG($infile); break; case "png": $im = ImageCreateFromPNG($infile); break; } $im1 = imagecreatetruecolor($width, $height); $namefile = "$ms[name]"; imagecopy($im1, $im, 0, 0, 0, 0, $width, $height); switch ($format) { case "gif": $imagnam = "temp/$namefile.gif"; ImageGif($im1, $imagnam, $quality); echo "
"; break; case "jpg": $imagnam = "temp/$namefile.jpg"; imageJpeg($im1, $imagnam, $quality); echo "
"; break; case "jpeg": $imagnam = "temp/$namefile.jpg"; imageJpeg($im1, $imagnam, $quality); echo "
"; break; case "png": $imagnam = "temp/$namefile.png"; imagePng($im1, $imagnam, $quality); echo "
"; break; } imagedestroy($im); imagedestroy($im1); $fotsz = filesize("foto/$ms[name]"); $fotsz = round($fotsz / 1024, 2); $sizs = GetImageSize("foto/$ms[name]"); $fwidth = $sizs[0]; $fheight = $sizs[1]; $vrf = $ms[time] + $set_user['sdvig'] * 3600; $vrf1 = date("d.m.y / H:i", $vrf); echo "

" . $lng['description'] . ": $ms[text]
"; echo $lng_gal['dimensions'] . ": $fwidth*$fheight пкс.
"; echo $lng_gal['weight'] . ": $fotsz кб.
"; echo $lng['date'] . ": $vrf1
"; echo $lng_gal['posted_by'] . ": $ms[avtor]
"; echo "" . $lng['download'] . "

"; echo "" . $lng['back'] . "
"; echo "" . $lng_gal['to_gallery'] . "

"; break; default : header("location: index.php"); break; } } else { /* ----------------------------------------------------------------- Главная страница Галлереи ----------------------------------------------------------------- */ echo '

' . $lng_gal['new_photo'] . ' (' . functions::stat_gallery(1) . ')

'; echo '
' . $lng['gallery'] . '
'; $req = mysql_query("SELECT * FROM `gallery` WHERE `type` = 'rz'"); $total = mysql_num_rows($req); while ($res = mysql_fetch_assoc($req)) { echo $i % 2 ? '
' : '
'; $al = mysql_query("select * from `gallery` where type='al' and refid='" . $res['id'] . "'"); $countal = mysql_num_rows($al); echo '' . $res['text'] . ' (' . $countal . ')
'; ++$i; } echo '
' . $lng['total'] . ': ' . $total . '

'; if ($rights >= 6) { echo "" . $lng_gal['create_section'] . "
"; } echo "

"; } } require('../incfiles/end.php'); ?>