<?php
define('IN_MYBB', 1);
require_once './global.php';
require_once MYBB_ROOT."inc/class_parser.php";
$lang->load("mygal");
$id99=$db->escape_string($_GET['cat']);
$Cat=$db->fetch_array($db->simple_select("gallery_cats","*","id='$id99'"));
$name=$mybb->settings['mygal_name'];
add_breadcrumb("$name", 'mygal.php');
$enable=$mybb->settings['enablemygal'];
$restrict=$mybb->settings['mygal_restrict'];
$admin=$mybb->settings['mygal_admin'];
$w=$mybb->settings['mygal_w'];
$h=$mybb->settings['mygal_h'];
$a=$mybb->settings['mygal_a'];
$l=$mybb->settings['mygal_l'];
$order=$mybb->settings['mygal_order'];
$order2=$mybb->settings['mygal_order2'];
$order3=$mybb->settings['mygal_order3'];
$order4=$mybb->settings['mygal_order4'];
$order5=$mybb->settings['mygal_order5'];
$users=$mybb->settings['mygal_pics'];
$id=$db->escape_string($_GET['pic']);
$Pic=$db->fetch_array($db->simple_select("gallery_photos","*","id='$id'"));
$id2=$db->escape_string($_GET['cat']);
$Cat=$db->fetch_array($db->simple_select("gallery_cats","*","id='$Pic[cat]'"));
$pic=$db->query("SELECT * FROM ".TABLE_PREFIX."gallery_photos WHERE cat='$Cat[id]'");
$pic2=$db->query("SELECT * FROM ".TABLE_PREFIX."gallery_photos WHERE cat='$Pic[cat]'");
$pic98=$db->query("SELECT * FROM ".TABLE_PREFIX."gallery_photos WHERE cat='$id2'");
$user=$mybb->user['username'];
$uid=$mybb->user['uid'];
$pic3 = $db->fetch_array($pic);
$pic99 = $db->fetch_array($pic98);
$com=$db->query("SELECT * FROM ".TABLE_PREFIX."gallery_comments WHERE pic='$Pic[id]' ORDER BY id $order5");
$com2 = $db->fetch_array($com);
$num=$db->num_rows($com);
$Name=$db->escape_string($_POST['name']);
$desc=$db->escape_string($_POST['description']);
$author=$db->fetch_array($db->simple_select("users","*","uid='$com2[uid]'"));
$author2=$db->fetch_array($db->simple_select("users","*","uid='$pic99[uid]'"));
$author3=$db->fetch_array($db->simple_select("users","*","uid='$Pic[uid]'"));
$message=$db->escape_string($_POST['message']);
$select=$db->escape_string($_POST['select']);
$already=$db->query("SELECT * FROM ".TABLE_PREFIX."gallery_ratings WHERE uid='$uid' AND pic='$Pic[id]'");
$already2=$db->fetch_array($already);
$pic4=$db->fetch_array($db->simple_select("gallery_photos","*","id='".$db->escape_string($_POST['id'])."'"));
$total=$db->fetch_array($db->simple_select("gallery_photos","*","id='".$db->escape_string($_POST['pic'])."'"));
$ratte=$db->simple_select("gallery_ratings","*","pic='$id'");
$num1=$db->num_rows($ratte);
$permission=substr(sprintf('%o', fileperms('pictures/')), -4);
$file_name = $HTTP_POST_FILES['ufile']['name'];
$random_digit=rand(0000,9999);
$new_file_name=$random_digit.$file_name;
$path= "pictures/".$new_file_name;
$size=$mybb->settings['mygal_size']*1024;
$size3=$HTTP_POST_FILES['ufile']['size']/1024;
$size2=round($size3);
$cat=$db->fetch_array($db->simple_select("gallery_cats","*"));
$url_computer=$mybb->settings['mygal_upload'];
$mygal_parse=$mybb->settings['mygal_mycode'];
$parse = new postParser;
$parse_options = array(
"allow_html" => 0,
"allow_mycode" => $mygal_parse,
"allow_smilies" => $mygal_parse,
"allow_imgcode" => 0,
"filter_badwords" => $mygal_parse);
$page1=$mybb->settings['mygal_page_pic'];
$page2=$mybb->settings['mygal_page_cat'];
$page3=$mybb->settings['mygal_page_comment'];
$guests=$mybb->settings['mygal_guests'];
$post_comment=$mybb->settings['mygal_post'];
$classic=$mybb->settings['mygal_classic'];
$title=$mybb->settings['mygal_title'];
$desc3=$mybb->settings['mygal_desc'];
$admin2=explode(",", $admin);
if($url_computer == "/pictures/")
{
$form="<form action='mygal.php?a=add' method=\"post\">";
}
else {
$form="<form action='mygal.php?a=add_computer' method=\"post\" enctype=\"multipart/form-data\" name=\"form1\" id=\"form1\">";
}
if($url_computer == "http://tusvacacioneschile.net78.net/pictures/")
{
$Upload="$lang->picture $lang->url<font size='1' color='#FF0033'>*</font>: <td class=\"trow1\" colspan=\"$cells\"><input type=\"text\" name=\"url\" value=\"pictures\">";
}
else {
$Upload="{$lang->file}<font size='1' color='#FF0033'>*</font>: <td class=\"trow1\" colspan=\"$cells\"><input name=\"ufile\" type=\"file\" id=\"ufile\" size=\"20\">";
}
if($Pic['id'] != '') {
$rate="";
}
if($Pic['total_ratings'] == '' || $Pic['total_ratings'] == "0") {
$rate="<img src=\"pictures/default/0stars.gif\" title=\"$lang->no$lang->ratings\">";
}
else{
$rate=$Pic['total_ratings']/$num1;
if($rate == 0) {
$rate="<img src=\"pictures/default/0stars.gif\" title=\"$lang->no$lang->ratings\">";
}
elseif ($rate <= 1.4) {
$rate="<img src=\"pictures/default/1stars.gif\" title=\"$lang->rating: $rate\">";
}
elseif ($rate <= 2.4) {
$rate="<img src=\"pictures/default/2stars.gif\" title=\"$lang->rating: $rate\">";
}
elseif ($rate <= 3.4) {
$rate="<img src=\"pictures/default/3stars.gif\" title=\"$lang->rating: $rate\">";
}
elseif ($rate <= 4.4) {
$rate="<img src=\"pictures/default/4stars.gif\" title=\"$lang->rating: $rate\">";
}
elseif ($rate >= 4.5) {
$rate="<img src=\"pictures/default/5stars.gif\" title=\"$lang->rating: $rate\">";
}
}
if ($mybb->user['usergroup'] == $restrict)
{
error_no_permission();
}
if ($enable == '0' && !in_array($mybb->user['usergroup'], $admin2))
{
error($lang->gallery_closed);
}
if ($enable != '0' && $permission != "0777")
{
error($lang->permission);
}
if($mybb->user['uid'] == '0' && $guests == '1')
{
if ($mybb->user['usergroup'] != $restrict && $_GET['action'] != 'cat' && $_GET['pic'] == '' && $_GET['cat'] == '' && $enable != '0')
{
$max=$page2;
$pagenum=$_GET['page'];
if ($pagenum == '')
{
$pagenum=1;
}
$start=($pagenum-1)*$max;
$total=$db->num_rows($db->simple_select("gallery_cats","*"));
$totalpages=ceil($total/$max);
$i=1;
if ($totalpages > 1)
{
$pages.="<table border=\"0\" cellspacing='0'><tr><td class='trow1'>{$lang->page}</td>";
while ($i <= $totalpages)
{
if ($i == $pagenum)
{
$pages.="<td class='trow1'> $i</td>";
}
else
{
$pages.="<td class='trow1'> <a href='mygal.php?page=$i#categories'>$i</a></td>";
}
$i++;
}
$pages.="</table>";
}
$cat=$db->query("SELECT * FROM ".TABLE_PREFIX."gallery_cats ORDER BY ".$order3." $order4 LIMIT $start,$max");
$html.="<head>
<title>{$mybb->settings['bbname']} - {$name}</title>
{$headerinclude}
<style type=\"text/css\">
a:hover {
text-decoration: none;
}
</style>
</head>
<body>
{$header}
{$pages}
<a name=\"categories\"><table border=\"0\" cellspacing=\"{$theme['borderwidth']}\" cellpadding=\"{$theme['tablespace']}\" class=\"tborder\" width=\"100%\"><td class=\"thead\" colspan=\"$cells\"><center><b>$lang->categories</b></td><td class=\"thead\" colspan=\"$cells\"><center><b>$lang->description</b></td></center>
";
while($cat2 = $db->fetch_array($cat))
{
$cat3="$cat2[name]";
$parser2=$parse->parse_message($cat2['description'], $parse_options);
$html.="<tr><td class=\"trow1\" colspan=\"$cells\"><center><a href='mygal.php?cat=$cat2[id]'>{$cat3}</a></center><td class=\"trow2\" colspan=\"$cells\"><center>{$parser2}</center></a>";
}
$html.="</td></td></tr></tr>";
$html.="</table>
{$footer}
</body>
</html>";
}
if ($mybb->user['usergroup'] != $restrict && $mybb->input['cat'] != '' && !in_array($mybb->user['usergroup'], $admin2) && $enable != '0')
{
$id=$db->escape_string($_GET['cat']);
$max=$page1;
$pagenum=$_GET['page'];
if ($pagenum == '')
{
$pagenum=1;
}
$start=($pagenum-1)*$max;
$total=$db->num_rows($db->simple_select("gallery_photos","*","cat='".$db->escape_string($_GET['cat'])."'"));
$totalpages=ceil($total/$max);
$i=1;
if ($totalpages > 1)
{
$pages.="<table border=\"0\" cellspacing='0'><tr><td class='trow1'>{$lang->page}</td>";
while ($i <= $totalpages)
{
if ($i == $pagenum)
{
$pages.="<td class='trow1'> $i</td>";
}
else
{
$pages.="<td class='trow1'> <a href='mygal.php?cat=$id&page=$i#pictures'>$i</a></td>";
}
$i++;
}
$pages.="</table>";
}
$Cat=$db->fetch_array($db->simple_select("gallery_cats","*","id='$id'"));
$pic=$db->query("SELECT * FROM ".TABLE_PREFIX."gallery_photos WHERE cat='$Cat[id]' ORDER BY ".$order." $order2 LIMIT $start,$max");
$html="<head>
<title>{$mybb->settings['bbname']} - {$Cat[name]}</title>
{$headerinclude}
<style type=\"text/css\">
div.img
{
margin: 2px;
border: 1px solid gray;
height: auto;
width: auto;
float: left;
text-align: center;
}
div.img img
{
display: inline;
margin: 3px;
}
div.desc
{
text-align: center;
font-weight: normal;
width: 120px;
margin: 2px;
}
</style>
<style type=\"text/css\">
a:hover {
text-decoration: none;
}
</style>
</head>
<body>
{$header}
<a name=\"pictures\">{$pages}
<table border=\"0\" cellspacing=\"{$theme['borderwidth']}\" cellpadding=\"{$theme['tablespace']}\" class=\"tborder\" width=\"100%\">
<tr>";
if($classic == 1)
{
$html.="<td class=\"thead\" colspan=\"$cells\"><center><b>$lang->name</b></center></td>
<td class=\"thead\" colspan=\"$cells\"><center><b>$lang->description</b></center></td>
<td class=\"thead\" colspan=\"$cells\"><center><b>$lang->picture</b></center></td>
<td class=\"thead\" colspan=\"$cells\"><center><b>$lang->author</b></center></td>";
}
else{
$html.="
<td class=\"trow1\">
";
}
add_breadcrumb("$Cat[name]", "mygal.php?cat=$Cat[id]");
while($pic2 = $db->fetch_array($pic))
{
$pic3="$pic2[name]<br>";
$author4=$db->fetch_array($db->simple_select("users","*","uid='$pic2[uid]'"));
$profile=build_profile_link($author4['username'], $pic2['uid']);
$parser3=$parse->parse_message($pic2['description'], $parse_options);
if(strlen($pic2['name']) > $title)
{
$title2=substr($pic2['name'], 0, $title);
$title1="$title2...";
}
else {
$title1=$pic2['name'];
}
if(strlen($pic2['description']) > $desc3)
{
$desc2=substr($pic2['description'], 0, $desc);
$desc1="$desc2...";
}
else {
$desc1=$pic2['description'];
}
if($classic == 1)
{
$html.="<tr><td class=\"trow1\" colspan=\"$cells\"><center><a href='mygal.php?pic=$pic2[id]'>{$title1}<br /></a></center><td class=\"trow2\" colspan=\"$cells\"><center>{$parser3}</center><td class=\"trow1\" colspan=\"$cells\"><center><a href='mygal.php?pic=$pic2[id]'><img src='$pic2[url]' height=\"$h\" weight=\"$w\"></a></center><td class=\"trow2\" colspan=\"$cells\"><center>{$profile}</a></center></a>";
}
else{
$html.="
<div class=\"img\">
<a href=\"mygal.php?pic=$pic2[id]\"><img src=\"$pic2[url]\" alt=\"$pic2[name]\" width=\"$w\" height=\"$h\" /></a>
<div class=\"desc\">$title1</div>
</div>";
}
}
$html.="</td></tr></table></center>
{$footer}
</body>
</html>";
}
if ($mybb->user['usergroup'] != $restrict && $mybb->input['hola'] != '' && !in_array($mybb->user['usergroup'], $admin2) && $enable != '0')
{
$id=$db->escape_string($_GET['hola']);
$max=$page1;
$pagenum=$_GET['page'];
if ($pagenum == '')
{
$pagenum=1;
}
$start=($pagenum-1)*$max;
$total=$db->num_rows($db->simple_select("gallery_photos","*","cat='".$db->escape_string($_GET['cat'])."'"));
$totalpages=ceil($total/$max);
$i=1;
if ($totalpages > 1)
{
$pages.="<table border=\"0\" cellspacing='0'><tr><td class='trow1'>{$lang->page}</td>";
while ($i <= $totalpages)
{
if ($i == $pagenum)
{
$pages.="<td class='trow1'> $i</td>";
}
else
{
$pages.="<td class='trow1'> <a href='mygal.php?cat=$id&page=$i#pictures'>$i</a></td>";
}
$i++;
}
$pages.="</table>";
}
$Cat=$db->fetch_array($db->simple_select("gallery_cats","*","id='$id'"));
$pic=$db->query("SELECT * FROM ".TABLE_PREFIX."gallery_photos WHERE cat='$Cat[id]' ORDER BY ".$order." $order2 LIMIT $start,$max");
$html="<head>
<title>{$mybb->settings['bbname']} - {$Cat[name]}</title>
{$headerinclude}
<style type=\"text/css\">
div.img
{
margin: 3px;
border: 1px solid #dfdfdf;
height: auto;
width: auto;
float: left;
text-align: center;
}
div.img img
{
display: inline;
margin: 3px;
}
div.desc
{
text-align: center;
font-weight: normal;
width: 120px;
margin: 2px;
}
</style>
<style type=\"text/css\">
a:hover {
text-decoration: none;
}
</style>
<base target=\"_parent\" />
</head>
<body>
<a name=\"pictures\">{$pages}
<div style=\"width:480px;\"><table>
<tr>";
if($classic == 1)
{
$html.="<td class=\"thead\" colspan=\"$cells\"><center><b>$lang->name</b></center></td>
<td class=\"thead\" colspan=\"$cells\"><center><b>$lang->description</b></center></td>
<td class=\"thead\" colspan=\"$cells\"><center><b>$lang->picture</b></center></td>
<td class=\"thead\" colspan=\"$cells\"><center><b>$lang->author</b></center></td>";
}
else{
$html.="
<td class=\"trow1\">
";
}
add_breadcrumb("$Cat[name]", "mygal.php?cat=$Cat[id]");
while($pic2 = $db->fetch_array($pic))
{
$pic3="$pic2[name]<br>";
$author4=$db->fetch_array($db->simple_select("users","*","uid='$pic2[uid]'"));
$profile=build_profile_link($author4['username'], $pic2['uid']);
$parser3=$parse->parse_message($pic2['description'], $parse_options);
if(strlen($pic2['name']) > $title)
{
$title2=substr($pic2['name'], 0, $title);
$title1="$title2...";
}
else {
$title1=$pic2['name'];
}
if(strlen($pic2['description']) > $desc3)
{
$desc2=substr($pic2['description'], 0, $desc);
$desc1="$desc2...";
}
else {
$desc1=$pic2['description'];
}
if($classic == 1)
{
$html.="<tr><td class=\"trow1\" colspan=\"$cells\"><center><a href='mygal.php?pic=$pic2[id]'>{$title1}<br /></a></center><td class=\"trow2\" colspan=\"$cells\"><center>{$parser3}</center><td class=\"trow1\" colspan=\"$cells\"><center><a href='mygal.php?pic=$pic2[id]'><img src='$pic2[url]' height=\"$h\" weight=\"$w\"></a></center><td class=\"trow2\" colspan=\"$cells\"><center>{$profile}</a></center></a>";
}
else{
$html.="
<div class=\"img\">
<a href=\"mygal.php?pic=$pic2[id]\"><img src=\"$pic2[url]\" alt=\"$pic2[name]\" width=\"$w\" height=\"$h\" /></a>
<div class=\"desc\">$title1</div>
</div>";
}
}
$html.="</td></tr></table></div>
</body>
</html>";
}
}
if ($mybb->user['usergroup'] != $restrict && $mybb->input['pic'] != '')
{
$id=$db->escape_string($_GET['pic']);
$max=$page3;
$pagenum=$_GET['page'];
if ($pagenum == '')
{
$pagenum=1;
}
$start=($pagenum-1)*$max;
$total=$db->num_rows($db->simple_select("gallery_comments","*","pic='$id'"));
$totalpages=ceil($total/$max);
$i=1;
if ($totalpages > 1)
{
$pages.="<table border=\"0\" cellspacing='0'><tr><td class='trow1'>{$lang->page}</td>";
while ($i <= $totalpages)
{
if ($i == $pagenum)
{
$pages.="<td class='trow1'> $i</td>";
}
else
{
$pages.="<td class='trow1'> <a href='mygal.php?pic=$id&page=$i#comments'>$i</a></td>";
}
$i++;
}
$pages.="</table>";
}
$Pic=$db->fetch_array($db->simple_select("gallery_photos","*","id='$id'"));
$pic=$db->query("SELECT * FROM ".TABLE_PREFIX."gallery_photos WHERE id='$Pic[id]' ORDER BY ".$order." $order2");
$id2=$db->escape_string($_GET['cat']);
$Cat=$db->fetch_array($db->simple_select("gallery_cats","*","id='$Pic[cat]'"));
$com=$db->query("SELECT * FROM ".TABLE_PREFIX."gallery_comments WHERE pic='$Pic[id]' ORDER BY id $order5 LIMIT $start,$max");
add_breadcrumb("$Cat[name]", "mygal.php?cat=$Cat[id]");
add_breadcrumb($Pic['name'], "mygal.php?pic=$Pic[id]");
$html="<head>
<title>{$mybb->settings['bbname']} - {$Pic[name]}</title>
{$headerinclude}
<style type=\"text/css\">
a:hover {
text-decoration: none;
}
</style>
</head>
<body>
{$header}
<table border=\"0\" cellspacing=\"{$theme['borderwidth']}\" cellpadding=\"{$theme['tablespace']}\" class=\"tborder\" width=\"100%\">
<tr>
<td class=\"thead\" colspan=\"$cells\"><b>Nombre de la Imagen: {$Pic[name]}</b></td>";
while($pic2 = $db->fetch_array($pic))
{
$pic3="$pic2[name]<br>";
$parser3=$parse->parse_message($pic2['description'], $parse_options);
$html.="<tr><td class=\"trow1\" colspan=\"$cells\"><center><a href=\"$pic2[url]\"><img src='$pic2[url]' height=\"$l\" weight=\"$a\" style=\"max-width:970px;\"></a></center></td></tr><tr><td class=\"trow1\" colspan=\"$cells\"><center>{$rate}</center></td></tr><tr><td class=\"trow1\" colspan=\"$cells\"><center>{$parser3}</center></td></tr></table><br /><table border=\"0\" cellspacing=\"{$theme['borderwidth']}\" cellpadding=\"{$theme['tablespace']}\" class=\"tborder\" width=\"100%\">
<td class=\"thead\" colspan=\"$cells\"><b>$lang->add_com</b></td><tr><td class=\"trow1\" colspan=\"$cells\"><form action='mygal.php?a=com' method=\"post\"><b>$lang->message:</b><br /><br /> <textarea name=\"message\" cols=100 rows=3></textarea><input type=\"hidden\" name=\"cat\" value=\"$Cat[id]\">
<input type=\"hidden\" name=\"pic\" value=\"$Pic[id]\">
<input type=\"hidden\" name=\"uid\" value=\"$uid\"><br /><br />
<input type=\"submit\" value=\"$lang->post_com\"></form></td></tr></table><br /><br /><a name=\"comments\">{$pages}<table border=\"0\" cellspacing=\"{$theme['borderwidth']}\" cellpadding=\"{$theme['tablespace']}\" class=\"tborder\" width=\"100%\"><td class=\"thead\" colspan=\"$cells\"><b>{$num} $lang->comments | {$num1} $lang->ratings</b></td></tr>";
while($com2 = $db->fetch_array($com)){
$author4=$db->fetch_array($db->simple_select("users","*","uid='$com2[uid]'"));
$profile=build_profile_link($author4['username'], $com2['uid']);
$parser=$parse->parse_message($com2['message'], $parse_options);
$html.="<td class=\"tcat\" colspan=\"$cells\"><b>{$profile}</b></td></tr><tr><td class=\"trow1\" colspan=\"$cells\">{$parser}</td></tr>";
}
}
$html.="</td></td></td></tr></table></a></center>
{$footer}
</body>
</html>";
}
if($mybb->user['uid'] == '0' && $guests != '1')
{
error_no_permission();
}
if($mybb->user['uid'] == '0' && $guests == '1' && $post_comment != '0')
{
if ($mybb->user['usergroup'] != $restrict && $mybb->input['pic'] != '' && !in_array($mybb->user['usergroup'], $admin2))
{
$id=$db->escape_string($_GET['pic']);
$max=$page3;
$pagenum=$_GET['page'];
if ($pagenum == '')
{
$pagenum=1;
}
$start=($pagenum-1)*$max;
$total=$db->num_rows($db->simple_select("gallery_comments","*","pic='$id'"));
$totalpages=ceil($total/$max);
$i=1;
if ($totalpages > 1)
{
$pages.="<table border=\"0\" cellspacing='0'><tr><td class='trow1'>{$lang->page}</td>";
while ($i <= $totalpages)
{
if ($i == $pagenum)
{
$pages.="<td class='trow1'> $i</td>";
}
else
{
$pages.="<td class='trow1'> <a href='mygal.php?pic=$id&page=$i#comments'>$i</a></td>";
}
$i++;
}
$pages.="</table>";
}
$Pic=$db->fetch_array($db->simple_select("gallery_photos","*","id='$id'"));
$pic=$db->query("SELECT * FROM ".TABLE_PREFIX."gallery_photos WHERE id='$Pic[id]' ORDER BY ".$order." $order2");
$id2=$db->escape_string($_GET['cat']);
$Cat=$db->fetch_array($db->simple_select("gallery_cats","*","id='$Pic[cat]'"));
$com=$db->query("SELECT * FROM ".TABLE_PREFIX."gallery_comments WHERE pic='$Pic[id]' ORDER BY id $order5 LIMIT $start,$max");
add_breadcrumb("$Cat[name]", "mygal.php?cat=$Cat[id]");
add_breadcrumb($Pic['name'], "mygal.php?pic=$Pic[id]");
$html="<head>
<title>{$mybb->settings['bbname']} - {$Pic[name]}</title>
{$headerinclude}
<style type=\"text/css\">
a:hover {
text-decoration: none;
}
</style>
</head>
<body>
{$header}
<table border=\"0\" cellspacing=\"{$theme['borderwidth']}\" cellpadding=\"{$theme['tablespace']}\" class=\"tborder\" width=\"100%\">
<tr>
<td class=\"thead\" colspan=\"$cells\"><b>Nombre de la Imagen: {$Pic[name]}</b></td>";
while($pic2 = $db->fetch_array($pic))
{
$pic3="$pic2[name]<br>";
$parser3=$parse->parse_message($pic2['description'], $parse_options);
$html.="<tr><td class=\"trow1\" colspan=\"$cells\"><center><a href=\"$pic2[url]\"><img src='$pic2[url]' height=\"$l\" weight=\"$a\" style=\"max-width:970px;\"></a></center></td></tr><tr><td class=\"trow1\" colspan=\"$cells\"><center>{$rate}</center></td></tr><tr><td class=\"trow1\" colspan=\"$cells\"><center>{$parser3}</center></td></tr><tr></table><br /><br /><a name=\"comments\">{$pages}<table border=\"0\" cellspacing=\"{$theme['borderwidth']}\" cellpadding=\"{$theme['tablespace']}\" class=\"tborder\" width=\"100%\"><td class=\"thead\" colspan=\"$cells\"><b>{$num} $lang->comments | {$num1} $lang->ratings</b></td></tr>";
while($com2 = $db->fetch_array($com)){
$author4=$db->fetch_array($db->simple_select("users","*","uid='$com2[uid]'"));
$profile=build_profile_link($author4['username'], $com2['uid']);
$parser=$parse->parse_message($com2['message'], $parse_options);
$html.="<td class=\"tcat\" colspan=\"$cells\"><b>{$profile}</b></td></tr><tr><td class=\"trow1\" colspan=\"$cells\">{$parser}</td></tr>";
}
} $html.="</table></a></center>
{$footer}
</body>
</html>";
}
}
if ($mybb->user['usergroup'] != $restrict && $_GET['action'] != 'cat' && $_GET['pic'] == '' && $_GET['cat'] == '' && !in_array($mybb->user['usergroup'], $admin2) && $enable != '0' && $users == '0' && $mybb->user['uid'] != '0')
{
$max=$page2;
$pagenum=$_GET['page'];
if ($pagenum == '')
{
$pagenum=1;
}
$start=($pagenum-1)*$max;
$total=$db->num_rows($db->simple_select("gallery_cats","*"));
$totalpages=ceil($total/$max);
$i=1;
if ($totalpages > 1)
{
$pages.="<table border=\"0\" cellspacing='0'><tr><td class='trow1'>{$lang->page}</td>";
while ($i <= $totalpages)
{
if ($i == $pagenum)
{
$pages.="<td class='trow1'> $i</td>";
}
else
{
$pages.="<td class='trow1'> <a href='mygal.php?page=$i#categories'>$i</a></td>";
}
$i++;
}
$pages.="</table>";
}
$cat=$db->query("SELECT * FROM ".TABLE_PREFIX."gallery_cats ORDER BY ".$order3." $order4 LIMIT $start,$max");
$html.="<head>
<title>{$mybb->settings['bbname']} - {$name}</title>
{$headerinclude}
<style type=\"text/css\">
a:hover {
text-decoration: none;
}
</style>
</head>
<body>
{$header}
{$pages}
<a name=\"categories\"><table border=\"0\" cellspacing=\"{$theme['borderwidth']}\" cellpadding=\"{$theme['tablespace']}\" class=\"tborder\" width=\"100%\"><td class=\"thead\" colspan=\"$cells\"><center><b>$lang->categories</b></td><td class=\"thead\" colspan=\"$cells\"><center><b>$lang->description</b></td></center>
";
while($cat2 = $db->fetch_array($cat))
{
$cat3="$cat2[name]";
$parser2=$parse->parse_message($cat2['description'], $parse_options);
$html.="<tr><td class=\"trow1\" colspan=\"$cells\"><center><a href='mygal.php?cat=$cat2[id]'>{$cat3}</a></center><td class=\"trow2\" colspan=\"$cells\"><center>{$parser2}</center></a>";
}
$html.="</td></td></tr></tr></table><br /><table border=\"0\" cellspacing=\"{$theme['borderwidth']}\" cellpadding=\"{$theme['tablespace']}\" class=\"tborder\" width=\"100%\">";
$html.="</table>
{$footer}
</body>
</html>";
}
if ($mybb->user['usergroup'] != $restrict && $_GET['action'] != 'cat' && $_GET['pic'] == '' && $_GET['cat'] == '' && !in_array($mybb->user['usergroup'], $admin2) && $enable != '0' && $users != '0' && $mybb->user['uid'] != '0')
{
$max=$page2;
$pagenum=$_GET['page'];
if ($pagenum == '')
{
$pagenum=1;
}
$start=($pagenum-1)*$max;
$total=$db->num_rows($db->simple_select("gallery_cats","*"));
$totalpages=ceil($total/$max);
$i=1;
if ($totalpages > 1)
{
$pages.="<table border=\"0\" cellspacing='0'><tr><td class='trow1'>{$lang->page}</td>";
while ($i <= $totalpages)
{
if ($i == $pagenum)
{
$pages.="<td class='trow1'> $i</td>";
}
else
{
$pages.="<td class='trow1'> <a href='mygal.php?page=$i#categories'>$i</a></td>";
}
$i++;
}
$pages.="</table>";
}
$cat=$db->query("SELECT * FROM ".TABLE_PREFIX."gallery_cats ORDER BY ".$order3." $order4 LIMIT $start,$max");
$html.="<head>
<title>{$mybb->settings['bbname']} - {$name}</title>
{$headerinclude}
<style type=\"text/css\">
a:hover {
text-decoration: none;
}
</style>
</head>
<body>
{$header}
{$pages}
<a name=\"categories\"><table border=\"0\" cellspacing=\"{$theme['borderwidth']}\" cellpadding=\"{$theme['tablespace']}\" class=\"tborder\" width=\"100%\"><td class=\"thead\" colspan=\"$cells\"><center><b>$lang->categories</b></td><td class=\"thead\" colspan=\"$cells\"><center><b>$lang->description</b></td></center>
";
while($cat2 = $db->fetch_array($cat))
{
$cat3="$cat2[name]";
$parser2=$parse->parse_message($cat2['description'], $parse_options);
$html.="<tr><td class=\"trow1\" colspan=\"$cells\"><center><a href='mygal.php?cat=$cat2[id]'>{$cat3}</a></center><td class=\"trow2\" colspan=\"$cells\"><center>{$parser2}</center></a>";
}
$html.="</td></td></td></tr></tr></table><br /><table border=\"0\" cellspacing=\"{$theme['borderwidth']}\" cellpadding=\"{$theme['tablespace']}\" class=\"tborder\" width=\"100%\"><td class=\"thead\" colspan=\"$cells\"><center><b>$lang->add_pic</b></td><td class=\"thead\" colspan=\"$cells\"></td><tr><td class=\"trow1\" colspan=\"$cells\">{$form}$lang->picture $lang->name<font size='1' color='#FF0033'>*</font>: <td class=\"trow1\" colspan=\"$cells\"><input type=\"text\" name=\"name\"></td></tr><br />
<tr><td class=\"trow1\" colspan=\"$cells\">{$Upload}</td></tr><br />
<input type=\"hidden\" name=\"uid\" value=\"$uid\">
<tr><td class=\"trow1\" colspan=\"$cells\">$lang->description: <td class=\"trow1\" colspan=\"$cells\"><textarea name=\"description\" rows=2 cols=25></textarea></td></tr><br />
<tr><td class=\"trow1\" colspan=\"$cells\">$lang->category<font size='1' color='#FF0033'>*</font>: <td class=\"trow1\" colspan=\"$cells\"><select name=\"select\">";
$cat=$db->simple_select("gallery_cats","*");
while($cat2 = $db->fetch_array($cat))
{
$html.="<option name=\"cat\" value=\"$cat2[id]\">{$cat2[name]}</option>";
}
$html.="</select></td></tr><td class=\"trow1\" colspan=\"$cells\"><input type=\"submit\" value=\"$lang->submit $lang->picture\"></td></form><td class=\"trow1\" colspan=\"$cells\"><font size='1' color='#FF0033'>*</font>$lang->required</td></td></tr></tr></table>
{$footer}
</body>
</html>";
}
$pic100=$db->fetch_array($db->simple_select("gallery_photos","*","id='".$db->escape_string($_POST['id3'])."'"));
$author4=$db->fetch_array($db->simple_select("users","*","uid='$pic100[uid]'"));
if ($mybb->user['usergroup'] != $restrict && $mybb->input['edit'] != '' && !in_array($mybb->user['usergroup'], $admin2) && $enable != '0' && $mybb->user['uid'] != '0' && $author4['username'] == $user)
{
$id=$db->escape_string($_GET['edit']);
$Cat=$db->fetch_array($db->simple_select("gallery_photos","*","id='$id'"));
$Cat2=$db->fetch_array($db->simple_select("gallery_cats","*","id='$Cat[cat]'"));
$pic=$db->query("SELECT * FROM ".TABLE_PREFIX."gallery_photos WHERE id='$Cat[id]' ORDER BY ".$order." $order2");
$pic2 = $db->fetch_array($pic);
$cat=$db->simple_select("gallery_cats","*","id='$pic2[cat]'");
add_breadcrumb("$Cat2[name]", "mygal.php?cat=$Cat2[id]");
add_breadcrumb($pic2['name'], "mygal.php?pic=$pic2[id]");
add_breadcrumb("$lang->edit$lang->edit_pic", "mygal.php?edit=$pic2[id]");
$html="<head>
<title>{$mybb->settings['bbname']} - {$Cat[name]} › $lang->edit $lang->picture</title>
{$headerinclude}
<style type=\"text/css\">
a:hover {
text-decoration: none;
}
</style>
</head>
<body>
{$header}
<table border=\"0\" cellspacing=\"{$theme['borderwidth']}\" cellpadding=\"{$theme['tablespace']}\" class=\"tborder\" width=\"100%\">
<tr>
<td class=\"thead\" colspan=\"$cells\"><b>$lang->edit$lang->edit_pic</b></td><td class=\"thead\" colspan=\"$cells\"></td><tr><td class=\"trow1\" colspan=\"$cells\"><form action='mygal.php?e=item' method=\"post\" enctype=\"multipart/form-data\" name=\"form1\" id=\"form1\">$lang->picture $lang->name<font size='1' color='#FF0033'>*</font>: <td class=\"trow1\" colspan=\"$cells\"><input type=\"text\" name=\"name\" value=\"$pic2[name]\"></td></tr><br />
<input type=\"hidden\" name=\"id3\" value=\"$pic2[id]\">
<tr><td class=\"trow1\" colspan=\"$cells\">{$Upload}</td></tr>
<tr><td class=\"trow1\" colspan=\"$cells\">$lang->description: <td class=\"trow1\" colspan=\"$cells\"><textarea name=\"description\" rows=2 cols=25>$pic2[description]</textarea></td></tr><br />
<tr><td class=\"trow1\" colspan=\"$cells\">$lang->category<font size='1' color='#FF0033'>*</font>: <td class=\"trow1\" colspan=\"$cells\"><select name=\"select\">";
while($cat2 = $db->fetch_array($cat))
{
$html.="<option name=\"cat\" value=\"$pic2[cat]\">{$cat2[name]}</option>";
}
$html.="</select></td></tr></tr><br />
<td class=\"trow1\" colspan=\"$cells\"><input type=\"submit\" value=\" $lang->edit \"></form></td><td class=\"trow1\" colspan=\"$cells\"><font size='1' color='#FF0033'>*</font>$lang->required</td></tr><tr><td class=\"trow1\" colspan=\"$cells\"><form action=\"mygal.php?d=p\" method=\"post\"><input type=\"hidden\" name=\"id\" value=\"$pic2[id]\"><input type=\"hidden\" name=\"id3\" value=\"$id\"><input type=\"hidden\" name=\"id3\" value=\"$Cat2[id]\"><input type=\"submit\" value=\"$lang->delete\"></form></td><td class=\"trow1\" colspan=\"$cells\"></td></td></tr></tr></table>";
{
$pic3="$pic2[name]<br>";
$html.="";
}
$html.="</td></td></td></td></tr></table></center>
{$footer}
</body>
</html>";
}
if ($mybb->user['usergroup'] != $restrict && $mybb->input['cat'] != '' && !in_array($mybb->user['usergroup'], $admin2) && $enable != '0' && $mybb->user['uid'] != '0')
{
$id=$db->escape_string($_GET['cat']);
$max=$page1;
$pagenum=$_GET['page'];
if ($pagenum == '')
{
$pagenum=1;
}
$start=($pagenum-1)*$max;
$total=$db->num_rows($db->simple_select("gallery_photos","*","cat='$_GET[cat]'"));
$totalpages=ceil($total/$max);
$i=1;
if ($totalpages > 1)
{
$pages.="<table border=\"0\" cellspacing='0'><tr><td class='trow1'>{$lang->page}</td>";
while ($i <= $totalpages)
{
if ($i == $pagenum)
{
$pages.="<td class='trow1'> $i</td>";
}
else
{
$pages.="<td class='trow1'> <a href='mygal.php?cat=$id&page=$i#pictures'>$i</a></td>";
}
$i++;
}
$pages.="</table>";
}
$Cat=$db->fetch_array($db->simple_select("gallery_cats","*","id='$id'"));
$pic=$db->query("SELECT * FROM ".TABLE_PREFIX."gallery_photos WHERE cat='$Cat[id]' ORDER BY ".$order." $order2 LIMIT $start,$max");
$html="<head>
<title>{$mybb->settings['bbname']} - {$Cat[name]}</title>
{$headerinclude}
<style type=\"text/css\">
div.img
{
margin: 2px;
border: 1px solid gray;
height: auto;
width: auto;
float: left;
text-align: center;
}
div.img img
{
display: inline;
margin: 3px;
}
div.desc
{
text-align: center;
font-weight: normal;
width: 120px;
margin: 2px;
}
</style>
<style type=\"text/css\">
a:hover {
text-decoration: none;
}
</style>
</head>
<body>
{$header}
<a name=\"pictures\">{$pages}
<table border=\"0\" cellspacing=\"{$theme['borderwidth']}\" cellpadding=\"{$theme['tablespace']}\" class=\"tborder\" width=\"100%\">
<tr>";
if($classic == 1)
{
$html.="<td class=\"thead\" colspan=\"$cells\"><center><b>$lang->name</b></center></td>
<td class=\"thead\" colspan=\"$cells\"><center><b>$lang->description</b></center></td>
<td class=\"thead\" colspan=\"$cells\"><center><b>$lang->picture</b></center></td>
<td class=\"thead\" colspan=\"$cells\"><center><b>$lang->author</b></center></td>";
}
else{
$html.="
<td class=\"trow1\">
";
}
add_breadcrumb("$Cat[name]", "mygal.php?cat=$Cat[id]");
while($pic2 = $db->fetch_array($pic))
{
$pic3="$pic2[name]<br>";
$author4=$db->fetch_array($db->simple_select("users","*","uid='$pic2[uid]'"));
$profile=build_profile_link($author4['username'], $pic2['uid']);
$parser3=$parse->parse_message($pic2['description'], $parse_options);
if(strlen($pic2['name']) > $title)
{
$title2=substr($pic2['name'], 0, $title);
$title1="$title2...";
}
else {
$title1=$pic2['name'];
}
if(strlen($pic2['description']) > $desc3)
{
$desc2=substr($pic2['description'], 0, $desc);
$desc1="$desc2...";
}
else {
$desc1=$pic2['description'];
}
if($classic == 1)
{
$html.="<tr><td class=\"trow1\" colspan=\"$cells\"><center><a href='mygal.php?pic=$pic2[id]'>{$title1}<br /></a></center><td class=\"trow2\" colspan=\"$cells\"><center>{$parser3}</center><td class=\"trow1\" colspan=\"$cells\"><center><a href='mygal.php?pic=$pic2[id]'><img src='$pic2[url]' height=\"$h\" weight=\"$w\"></a></center><td class=\"trow2\" colspan=\"$cells\"><center>{$profile}</a></center></a>";
}
else{
$html.="
<div class=\"img\">
<a href=\"mygal.php?pic=$pic2[id]\"><img src=\"$pic2[url]\" alt=\"$pic2[name]\" width=\"$w\" height=\"$h\" /></a>
<div class=\"desc\">$title1</div>
</div>";
}
}
$html.="</td></tr></table></center>
{$footer}
</body>
</html>";
}
if ($mybb->user['usergroup'] != $restrict && $mybb->input['hola'] != '' && !in_array($mybb->user['usergroup'], $admin2) && $enable != '0' && $mybb->user['uid'] != '0')
{
$id=$db->escape_string($_GET['hola']);
$max=$page1;
$pagenum=$_GET['page'];
if ($pagenum == '')
{
$pagenum=1;
}
$start=($pagenum-1)*$max;
$total=$db->num_rows($db->simple_select("gallery_photos","*","cat='$_GET[cat]'"));
$totalpages=ceil($total/$max);
$i=1;
if ($totalpages > 1)
{
$pages.="<table border=\"0\" cellspacing='0'><tr><td class='trow1'>{$lang->page}</td>";
while ($i <= $totalpages)
{
if ($i == $pagenum)
{
$pages.="<td class='trow1'> $i</td>";
}
else
{
$pages.="<td class='trow1'> <a href='mygal.php?cat=$id&page=$i#pictures'>$i</a></td>";
}
$i++;
}
$pages.="</table>";
}
$Cat=$db->fetch_array($db->simple_select("gallery_cats","*","id='$id'"));
$pic=$db->query("SELECT * FROM ".TABLE_PREFIX."gallery_photos WHERE cat='$Cat[id]' ORDER BY ".$order." $order2 LIMIT $start,$max");
$html="<head>
<title>{$mybb->settings['bbname']} - {$Cat[name]}</title>
{$headerinclude}
<style type=\"text/css\">
div.img
{
margin: 3px;
border: 1px solid #dfdfdf;
height: auto;
width: auto;
float: left;
text-align: center;
}
div.img img
{
display: inline;
margin: 3px;
}
div.desc
{
text-align: center;
font-weight: normal;
width: 120px;
margin: 2px;
}
</style>
<style type=\"text/css\">
a:hover {
text-decoration: none;
}
</style>
<base target=\"_parent\" />
</head>
<body>
<a name=\"pictures\">{$pages}
<div style=\"width:480px;\"><table>
<tr>";
if($classic == 1)
{
$html.="<td class=\"thead\" colspan=\"$cells\"><center><b>$lang->name</b></center></td>
<td class=\"thead\" colspan=\"$cells\"><center><b>$lang->description</b></center></td>
<td class=\"thead\" colspan=\"$cells\"><center><b>$lang->picture</b></center></td>
<td class=\"thead\" colspan=\"$cells\"><center><b>$lang->author</b></center></td>";
}
else{
$html.="
<td class=\"trow1\">
";
}
add_breadcrumb("$Cat[name]", "mygal.php?cat=$Cat[id]");
while($pic2 = $db->fetch_array($pic))
{
$pic3="$pic2[name]<br>";
$author4=$db->fetch_array($db->simple_select("users","*","uid='$pic2[uid]'"));
$profile=build_profile_link($author4['username'], $pic2['uid']);
$parser3=$parse->parse_message($pic2['description'], $parse_options);
if(strlen($pic2['name']) > $title)
{
$title2=substr($pic2['name'], 0, $title);
$title1="$title2...";
}
else {
$title1=$pic2['name'];
}
if(strlen($pic2['description']) > $desc3)
{
$desc2=substr($pic2['description'], 0, $desc);
$desc1="$desc2...";
}
else {
$desc1=$pic2['description'];
}
if($classic == 1)
{
$html.="<tr><td class=\"trow1\" colspan=\"$cells\"><center><a href='mygal.php?pic=$pic2[id]'>{$title1}<br /></a></center><td class=\"trow2\" colspan=\"$cells\"><center>{$parser3}</center><td class=\"trow1\" colspan=\"$cells\"><center><a href='mygal.php?pic=$pic2[id]'><img src='$pic2[url]' height=\"$h\" weight=\"$w\"></a></center><td class=\"trow2\" colspan=\"$cells\"><center>{$profile}</a></center></a>";
}
else{
$html.="
<div class=\"img\">
<a href=\"mygal.php?pic=$pic2[id]\"><img src=\"$pic2[url]\" alt=\"$pic2[name]\" width=\"$w\" height=\"$h\" /></a>
<div class=\"desc\">$title1</div>
</div>";
}
}
$html.="</td></tr></table></div>
</body>
</html>";
}
if ($mybb->user['usergroup'] != $restrict && $mybb->input['pic'] != '' && !in_array($mybb->user['usergroup'], $admin2) && $enable != '0' && $mybb->user['uid'] != '0' && $already2['rating'] == '')
{
$id=$db->escape_string($_GET['pic']);
$max=$page3;
$pagenum=$_GET['page'];
if ($pagenum == '')
{
$pagenum=1;
}
$start=($pagenum-1)*$max;
$total=$db->num_rows($db->simple_select("gallery_comments","*","pic='$id'"));
$totalpages=ceil($total/$max);
$i=1;
if ($totalpages > 1)
{
$pages.="<table border=\"0\" cellspacing='0'><tr><td class='trow1'>{$lang->page}</td>";
while ($i <= $totalpages)
{
if ($i == $pagenum)
{
$pages.="<td class='trow1'> $i</td>";
}
else
{
$pages.="<td class='trow1'> <a href='mygal.php?pic=$id&page=$i#comments'>$i</a></td>";
}
$i++;
}
$pages.="</table>";
}
$Pic=$db->fetch_array($db->simple_select("gallery_photos","*","id='$id'"));
$pic=$db->query("SELECT * FROM ".TABLE_PREFIX."gallery_photos WHERE id='$Pic[id]' ORDER BY ".$order." $order2");
$id2=$db->escape_string($_GET['cat']);
$Cat=$db->fetch_array($db->simple_select("gallery_cats","*","id='$Pic[cat]'"));
$com=$db->query("SELECT * FROM ".TABLE_PREFIX."gallery_comments WHERE pic='$Pic[id]' ORDER BY id $order5 LIMIT $start,$max");
$html="<head>
<title>{$mybb->settings['bbname']} - {$Pic[name]}</title>
{$headerinclude}
<style type=\"text/css\">
a:hover {
text-decoration: none;
}
</style>
</head>
<body>
{$header}
<table border=\"0\" cellspacing=\"{$theme['borderwidth']}\" cellpadding=\"{$theme['tablespace']}\" class=\"tborder\" width=\"100%\">
<tr>
<td class=\"thead\" colspan=\"$cells\"><b>Nombre de la Imagen: {$Pic[name]}</b></td>";
while($pic2 = $db->fetch_array($pic))
{
$pic3="$pic2[name]<br>";
$parser3=$parse->parse_message($pic2['description'], $parse_options);
$html.="<tr><td class=\"trow1\" colspan=\"$cells\"><center><a href=\"$pic2[url]\"><img src='$pic2[url]' height=\"$l\" weight=\"$a\" style=\"max-width:970px;\"></a></center></td></tr><tr><td class=\"trow1\" colspan=\"$cells\"><center>{$rate}</center></td></tr><tr><td class=\"trow1\" colspan=\"$cells\"><center>{$parser3}</center></td></tr></table><br /><table border=\"0\" cellspacing=\"{$theme['borderwidth']}\" cellpadding=\"{$theme['tablespace']}\" class=\"tborder\" width=\"100%\">
<td class=\"thead\" colspan=\"$cells\"><b>$lang->add_com</b></td><tr><td class=\"trow1\" colspan=\"$cells\"><form action='mygal.php?a=com' method=\"post\"><b>$lang->message:</b><br /><br /> <textarea name=\"message\" cols=100 rows=3></textarea><input type=\"hidden\" name=\"cat\" value=\"$Cat[id]\">
<input type=\"hidden\" name=\"pic\" value=\"$Pic[id]\">
<input type=\"hidden\" name=\"uid\" value=\"$uid\"><br /><br />
<input type=\"submit\" value=\"$lang->post_com\"></form></td></tr></table><table border=\"0\" cellspacing=\"{$theme['borderwidth']}\" cellpadding=\"{$theme['tablespace']}\" class=\"tborder\" width=\"100%\"><td class=\"thead\" colspan=\"$cells\"><b>$lang->add_rat</b></td><tr><td class=\"trow1\" colspan=\"$cells\"><form action='mygal.php?a=rating' method=\"post\"><b>$lang->rating: </b><select name=\"rating\"><option name=\"1\">1</option><option name=\"2\">2</option><option name=\"3\">3</option><option name=\"4\">4</option><option name=\"5\" selected>5</option></select><input type=\"hidden\" name=\"pic\" value=\"$Pic[id]\"><br /><br /><input type=\"submit\" value=\"$lang->post$lang->rating\"></form></td></tr></table><br /><br /><a name=\"comments\">{$pages}<table border=\"0\" cellspacing=\"{$theme['borderwidth']}\" cellpadding=\"{$theme['tablespace']}\" class=\"tborder\" width=\"100%\"><td class=\"thead\" colspan=\"$cells\"><b>{$num} $lang->comments | {$num1} $lang->ratings</b></td></tr>";
while($com2 = $db->fetch_array($com)){
$author4=$db->fetch_array($db->simple_select("users","*","uid='$com2[uid]'"));
$profile=build_profile_link($author4['username'], $com2['uid']);
$parser=$parse->parse_message($com2['message'], $parse_options);
$html.="<td class=\"tcat\" colspan=\"$cells\"><b>{$profile}</b></td></tr><tr><td class=\"trow1\" colspan=\"$cells\">{$parser}</td></tr>";
}
}
$html.="</td></td></td></tr></table></a></center>
{$footer}
</body>
</html>";
}
if ($mybb->user['usergroup'] != $restrict && $mybb->input['pic'] != '' && !in_array($mybb->user['usergroup'], $admin2) && $enable != '0' && $mybb->user['uid'] != '0' && $already2['rating'] != '')
{
$id=$db->escape_string($_GET['pic']);
$max=$page3;
$pagenum=$_GET['page'];
if ($pagenum == '')
{
$pagenum=1;
}
$start=($pagenum-1)*$max;
$total=$db->num_rows($db->simple_select("gallery_comments","*","pic=$id"));
$totalpages=ceil($total/$max);
$i=1;
if ($totalpages > 1)
{
$pages.="<table border=\"0\" cellspacing='0'><tr><td class='trow1'>{$lang->page}</td>";
while ($i <= $totalpages)
{
if ($i == $pagenum)
{
$pages.="<td class='trow1'> $i</td>";
}
else
{
$pages.="<td class='trow1'> <a href='mygal.php?pic=$id&page=$i#comments'>$i</a></td>";
}
$i++;
}
$pages.="</table>";
}
$Pic=$db->fetch_array($db->simple_select("gallery_photos","*","id='$id'"));
$pic=$db->query("SELECT * FROM ".TABLE_PREFIX."gallery_photos WHERE id='$Pic[id]' ORDER BY ".$order." $order2");
$id2=$db->escape_string($_GET['cat']);
$Cat=$db->fetch_array($db->simple_select("gallery_cats","*","id='$Pic[cat]'"));
$com=$db->query("SELECT * FROM ".TABLE_PREFIX."gallery_comments WHERE pic='$Pic[id]' ORDER BY id $order5 LIMIT $start,$max");
$html="<head>
<title>{$mybb->settings['bbname']} - {$Pic[name]}</title>
{$headerinclude}
<style type=\"text/css\">
a:hover {
text-decoration: none;
}
</style>
</head>
<body>
{$header}
<table border=\"0\" cellspacing=\"{$theme['borderwidth']}\" cellpadding=\"{$theme['tablespace']}\" class=\"tborder\" width=\"100%\">
<tr>
<td class=\"thead\" colspan=\"$cells\"><b>Nombre de la Imagen: {$Pic[name]}</b></td>";
while($pic2 = $db->fetch_array($pic))
{
$pic3="$pic2[name]<br>";
$parser3=$parse->parse_message($pic2['description'], $parse_options);
$html.="<tr><td class=\"trow1\" colspan=\"$cells\"><center><a href=\"$pic2[url]\"><img src='$pic2[url]' height=\"$l\" weight=\"$a\" style=\"max-width:970px;\"></a></center></td></tr><tr><td class=\"trow1\" colspan=\"$cells\"><center>{$rate}</center></td></tr><tr><td class=\"trow1\" colspan=\"$cells\"><center>{$parser3}</center></td></tr></table><br /><table border=\"0\" cellspacing=\"{$theme['borderwidth']}\" cellpadding=\"{$theme['tablespace']}\" class=\"tborder\" width=\"100%\">
<td class=\"thead\" colspan=\"$cells\"><b>$lang->add_com</b></td><tr><td class=\"trow1\" colspan=\"$cells\"><form action='mygal.php?a=com' method=\"post\"><b>$lang->message:</b><br /><br /> <textarea name=\"message\" cols=100 rows=3></textarea><br /><br /><input type=\"hidden\" name=\"rating\" value=\"---\"><input type=\"hidden\" name=\"cat\" value=\"$Cat[id]\">
<input type=\"hidden\" name=\"pic\" value=\"$Pic[id]\">
<input type=\"hidden\" name=\"uid\" value=\"$uid\">
<br /><br />
<input type=\"submit\" value=\"$lang->post_com\"></form></td></tr></table><br /><br /><a name=\"comments\">{$pages}<table border=\"0\" cellspacing=\"{$theme['borderwidth']}\" cellpadding=\"{$theme['tablespace']}\" class=\"tborder\" width=\"100%\"><td class=\"thead\" colspan=\"$cells\"><b>{$num} $lang->comments | {$num1} $lang->ratings</b></td></tr>";
while($com2 = $db->fetch_array($com)){
$author4=$db->fetch_array($db->simple_select("users","*","uid='$com2[uid]'"));
$profile=build_profile_link($author4['username'], $com2['uid']);
$parser=$parse->parse_message($com2['message'], $parse_options);
$html.="<td class=\"tcat\" colspan=\"$cells\"><b>{$profile}</b></td></tr><tr><td class=\"trow1\" colspan=\"$cells\">{$parser}</td></tr>";
}
}
$html.="</td></td></td></tr></table></a></center>
{$footer}
</body>
</html>";
}
if ($mybb->user['usergroup'] != $restrict && $mybb->input['pic'] != '' && !in_array($mybb->user['usergroup'], $admin2) && $enable != '0' && $mybb->user['uid'] != '0' && $author3['username'] == $user)
{
$id=$db->escape_string($_GET['pic']);
$Pic=$db->fetch_array($db->simple_select("gallery_photos","*","id='$id'"));
$pic=$db->query("SELECT * FROM ".TABLE_PREFIX."gallery_photos WHERE id='$Pic[id]' ORDER BY ".$order." $order2");
$id2=$db->escape_string($_GET['cat']);
$Cat=$db->fetch_array($db->simple_select("gallery_cats","*","id='$Pic[cat]'"));
$com=$db->query("SELECT * FROM ".TABLE_PREFIX."gallery_comments WHERE pic='$Pic[id]' ORDER BY id $order5 LIMIT $start,$max");
$html="<head>
<title>{$mybb->settings['bbname']} - {$Pic[name]}</title>
{$headerinclude}
<style type=\"text/css\">
a:hover {
text-decoration: none;
}
</style>
</head>
<body>
{$header}
<table border=\"0\" cellspacing=\"{$theme['borderwidth']}\" cellpadding=\"{$theme['tablespace']}\" class=\"tborder\" width=\"100%\">
<tr>
<td class=\"thead\" colspan=\"$cells\"><b>Nombre de la Imagen: {$Pic[name]}</b></td>";
while($pic2 = $db->fetch_array($pic))
{
$pic3="$pic2[name]<br>";
$parser3=$parse->parse_message($pic2['description'], $parse_options);
$html.="<tr><td class=\"trow1\" colspan=\"$cells\"><center><a href=\"$pic2[url]\"><img src='$pic2[url]' height=\"$l\" weight=\"$a\" style=\"max-width:970px;\"></a></center></td></tr><tr><td class=\"trow1\" colspan=\"$cells\"><center>{$rate}</center></td></tr><tr><td class=\"trow1\" colspan=\"$cells\"><center>{$parser3}</center></td></tr><tr><td class=\"trow2\" colspan=\"$cells\"><center><form action=\"mygal.php?d=p\" method=\"post\"><input type=\"hidden\" name=\"id\" value=\"$pic2[id]\"><input type=\"hidden\" name=\"id3\" value=\"$Cat[id]\"><input type=\"submit\" value=\"$lang->delete\"></form> <form action='mygal.php?edit=$pic2[id]' method=\"post\"><input type=\"hidden\" name=\"id3\" value=\"$Pic[id]\"><input type=\"submit\" value=\" $lang->edit \"></form></center></td></tr></table><br /><table border=\"0\" cellspacing=\"{$theme['borderwidth']}\" cellpadding=\"{$theme['tablespace']}\" class=\"tborder\" width=\"100%\">
<td class=\"thead\" colspan=\"$cells\"><b>$lang->add_com</b></td><tr><td class=\"trow1\" colspan=\"$cells\"><form action='mygal.php?a=com' method=\"post\"><b>$lang->message:</b><br /><br /> <textarea name=\"message\" cols=100 rows=3></textarea><br /><br /><input type=\"hidden\" name=\"rating\" value=\"---\"><input type=\"hidden\" name=\"cat\" value=\"$Cat[id]\">
<input type=\"hidden\" name=\"pic\" value=\"$Pic[id]\">
<input type=\"hidden\" name=\"uid\" value=\"$uid\">
<br /><br />
<input type=\"submit\" value=\"$lang->post_com\"></form></td></tr></table><br /><br /><a name=\"comments\">{$pages}<table border=\"0\" cellspacing=\"{$theme['borderwidth']}\" cellpadding=\"{$theme['tablespace']}\" class=\"tborder\" width=\"100%\"><td class=\"thead\" colspan=\"$cells\"><b>{$num} $lang->comments | {$num1} $lang->ratings</b></td></tr>";
while($com2 = $db->fetch_array($com)){
$author4=$db->fetch_array($db->simple_select("users","*","uid='$com2[uid]'"));
$profile=build_profile_link($author4['username'], $com2['uid']);
$parser=$parse->parse_message($com2['message'], $parse_options);
$html.="<td class=\"tcat\" colspan=\"$cells\"><b>{$profile}</b></td></tr><tr><td class=\"trow1\" colspan=\"$cells\">{$parser}</td></tr>";
}
}
$html.="</table></a></center>
{$footer}
</body>
</html>";
}
if($mybb->user['usergroup'] != $restrict && $mybb->user['uid'] != '0' && $_GET['a'] == "add" && !in_array($mybb->user['usergroup'], $admin2) && $select != '' && $Name != '' && $_POST['url'] != '' && $enable != '0')
{
$Cat=$db->fetch_array($db->simple_select("gallery_cats","*","id='$select'"));
$db->query("INSERT INTO ".TABLE_PREFIX."gallery_photos (cat, name, uid, url, description) VALUES ('$select', '$Name', '".$db->escape_string($_POST['uid'])."', '".$db->escape_string($_POST['url'])."', '$desc')");
redirect("mygal.php?cat=$Cat[id]", $lang->posted, $lang->success);
}
if($mybb->user['usergroup'] != $restrict && $mybb->user['uid'] != '0' && $_GET['a'] == "add_computer" && !in_array($mybb->user['usergroup'], $admin2) && $enable != '0')
{
$file_name = $HTTP_POST_FILES['ufile']['name'];
$random_digit=rand(0000,9999);
$new_file_name=$random_digit.$file_name;
$path= "pictures/".$new_file_name;
$type1 = strlen($path) - 3;
$type=substr($path, $type1);
if($ufile !=none && $type == "png" || $type == "gif" || $type == "bmp" || $type == "jpg" || $type == "PNg" || $type == "GIf" || $type == "BMp" || $type == "JPg" || $type == "PNG" || $type == "GIF" || $type == "BMP" || $type == "JPG" || $type == "Png" || $type == "Gif" || $type == "Bmp" || $type == "Jpg" || $type == "pNg" || $type == "gIf" || $type == "bMp" || $type == "jPg" || $type == "pnG" || $type == "giF" || $type == "bmP" || $type == "jpG" || $type == "PnG" || $type == "GiF" || $type == "BmP" || $type == "JpG")
{
if($select != '' && $Name != '' && $HTTP_POST_FILES['ufile']['name'] != '' && $HTTP_POST_FILES['ufile']['size'] <= $size && copy($HTTP_POST_FILES['ufile']['tmp_name'], $path))
{
$Cat=$db->fetch_array($db->simple_select("gallery_cats","*","id='$select'"));
$db->query("INSERT INTO ".TABLE_PREFIX."gallery_photos (cat, name, uid, url, description) VALUES ('$select', '$Name', '".$db->escape_string($_POST['uid'])."', '$path', '$desc')");
redirect("mygal.php?cat=$Cat[id]", $lang->posted, $lang->success);
}
else {
redirect("mygal.php?cat=$Cat[id]", $lang->i_not_posted, $lang->error);
}
}
}
$rat=$db->escape_string($_POST['rating']);
$total2=$total['total_ratings']+$rat;
if($mybb->user['usergroup'] != $restrict && $_GET['a'] == "com" && !in_array($mybb->user['usergroup'], $admin2) && $message != '')
{
$Pic=$db->fetch_array($db->simple_select("gallery_photos","*","id='".$db->escape_string($_POST['pic'])."'"));
$db->query("INSERT INTO ".TABLE_PREFIX."gallery_comments (cat, pic, uid, message) VALUES ('".$db->escape_string($_POST['cat'])."', '".$db->escape_string($_POST['pic'])."', '".$db->escape_string($_POST['uid'])."', '$message')");
redirect("mygal.php?pic=$Pic[id]", $lang->com_posted, $lang->success);
}
if($mybb->user['usergroup'] != $restrict && $mybb->user['uid'] != '0' && $_GET['a'] == "com" && in_array($mybb->user['usergroup'], $admin2) && $message != '')
{
$Pic=$db->fetch_array($db->simple_select("gallery_photos","*","id='".$db->escape_string($_POST['pic'])."'"));
$db->query("INSERT INTO ".TABLE_PREFIX."gallery_comments (cat, pic, uid, message) VALUES ('".$db->escape_string($_POST['cat'])."', '".$db->escape_string($_POST['pic'])."', '".$db->escape_string($_POST['uid'])."', '$message')");
redirect("mygal.php?pic=$Pic[id]", $lang->com_posted, $lang->success);
}
if($mybb->user['usergroup'] != $restrict && $mybb->user['uid'] != '0' && $_GET['e'] == "item" && !in_array($mybb->user['usergroup'], $admin2) && $enable != '0' && $author3['username'] == $user && $HTTP_POST_FILES['ufile']['name'] != '')
{
$file_name = $HTTP_POST_FILES['ufile']['name'];
$random_digit=rand(0000,9999);
$new_file_name=$random_digit.$file_name;
$path= "pictures/".$new_file_name;
$type1 = strlen($path) - 3;
$type=substr($path, $type1);
if($ufile !=none && $type == "png" || $type == "gif" || $type == "bmp" || $type == "jpg" || $type == "PNg" || $type == "GIf" || $type == "BMp" || $type == "JPg" || $type == "PNG" || $type == "GIF" || $type == "BMP" || $type == "JPG" || $type == "Png" || $type == "Gif" || $type == "Bmp" || $type == "Jpg" || $type == "pNg" || $type == "gIf" || $type == "bMp" || $type == "jPg" || $type == "pnG" || $type == "giF" || $type == "bmP" || $type == "jpG" || $type == "PnG" || $type == "GiF" || $type == "BmP" || $type == "JpG")
{
if($select != '' && $Name != '' && $HTTP_POST_FILES['ufile']['name'] != '' && $HTTP_POST_FILES['ufile']['size'] <= $size && copy($HTTP_POST_FILES['ufile']['tmp_name'], $path))
{
$Pic=$db->fetch_array($db->simple_select("gallery_photos","*","id='".$db->escape_string($_POST['id3'])."'"));
$db->query("UPDATE ".TABLE_PREFIX."gallery_photos SET name='$Name' WHERE id='$Pic[id]'");
$db->query("UPDATE ".TABLE_PREFIX."gallery_photos SET url='$path' WHERE id='$Pic[id]'");
$db->query("UPDATE ".TABLE_PREFIX."gallery_photos SET description='$desc' WHERE id='$Pic[id]'");
$db->query("UPDATE ".TABLE_PREFIX."gallery_photos SET cat='$select' WHERE id='$Pic[id]'");
redirect("mygal.php?pic=$Pic[id]", $lang->edited, $lang->success);
}
else {
redirect("mygal.php?edit=$Pic[id]", $lang->i_not_posted, $lang->error);
}
}
}
if($mybb->user['usergroup'] != $restrict && $mybb->user['uid'] != '0' && $_GET['e'] == "item" && !in_array($mybb->user['usergroup'], $admin2) && $author3['username'] == $user && $enable != '0' && $HTTP_POST_FILES['ufile']['name'] == '')
{
if($Name != '' && $select != ''){
$Pic=$db->fetch_array($db->simple_select("gallery_photos","*","id='".$db->escape_string($_POST['id3'])."'"));
$db->query("UPDATE ".TABLE_PREFIX."gallery_photos SET name='$Name' WHERE id='$Pic[id]'");
$db->query("UPDATE ".TABLE_PREFIX."gallery_photos SET description='$desc' WHERE id='$Pic[id]'");
$db->query("UPDATE ".TABLE_PREFIX."gallery_photos SET cat='$select' WHERE id='$Pic[id]'");
redirect("mygal.php?pic=$Pic[id]", $lang->edited, $lang->success);
}
else {
redirect("mygal.php?edit=$Pic[id]", $lang->i_not_posted, $lang->error);
}
}
if($mybb->user['usergroup'] != $restrict && $mybb->user['uid'] != '0' && $_GET['e'] == "item" && in_array($mybb->user['usergroup'], $admin2) && $HTTP_POST_FILES['ufile']['name'] != '')
{
$file_name = $HTTP_POST_FILES['ufile']['name'];
$random_digit=rand(0000,9999);
$new_file_name=$random_digit.$file_name;
$path= "pictures/".$new_file_name;
$type1 = strlen($path) - 3;
$type=substr($path, $type1);
if($ufile !=none && $type == "png" || $type == "gif" || $type == "bmp" || $type == "jpg" || $type == "PNg" || $type == "GIf" || $type == "BMp" || $type == "JPg" || $type == "PNG" || $type == "GIF" || $type == "BMP" || $type == "JPG" || $type == "Png" || $type == "Gif" || $type == "Bmp" || $type == "Jpg" || $type == "pNg" || $type == "gIf" || $type == "bMp" || $type == "jPg" || $type == "pnG" || $type == "giF" || $type == "bmP" || $type == "jpG" || $type == "PnG" || $type == "GiF" || $type == "BmP" || $type == "JpG")
{
if($select != '' && $Name != '' && $HTTP_POST_FILES['ufile']['name'] != '' && $HTTP_POST_FILES['ufile']['size'] <= $size && copy($HTTP_POST_FILES['ufile']['tmp_name'], $path))
{
$Pic=$db->fetch_array($db->simple_select("gallery_photos","*","id='".$db->escape_string($_POST['id3'])."'"));
$db->query("UPDATE ".TABLE_PREFIX."gallery_photos SET name='$Name' WHERE id='$Pic[id]'");
$db->query("UPDATE ".TABLE_PREFIX."gallery_photos SET url='$path' WHERE id='$Pic[id]'");
$db->query("UPDATE ".TABLE_PREFIX."gallery_photos SET description='$desc' WHERE id='$Pic[id]'");
$db->query("UPDATE ".TABLE_PREFIX."gallery_photos SET cat='$select' WHERE id='$Pic[id]'");
redirect("mygal.php?pic=$Pic[id]", $lang->edited, $lang->success);
}
else {
redirect("mygal.php?edit=$Pic[id]", $lang->i_not_posted, $lang->error);
}
}
}
if($mybb->user['usergroup'] != $restrict && $mybb->user['uid'] != '0' && $_GET['e'] == "item" && in_array($mybb->user['usergroup'], $admin2) && $HTTP_POST_FILES['ufile']['name'] == '')
{
if($Name != '' && $select != ''){
$Pic=$db->fetch_array($db->simple_select("gallery_photos","*","id='".$db->escape_string($_POST['id3'])."'"));
$db->query("UPDATE ".TABLE_PREFIX."gallery_photos SET name='$Name' WHERE id='$Pic[id]'");
$db->query("UPDATE ".TABLE_PREFIX."gallery_photos SET description='$desc' WHERE id='$Pic[id]'");
$db->query("UPDATE ".TABLE_PREFIX."gallery_photos SET cat='$select' WHERE id='$Pic[id]'");
redirect("mygal.php?pic=$Pic[id]", $lang->edited, $lang->success);
}
else {
redirect("mygal.php?edit=$Pic[id]", $lang->i_not_posted, $lang->error);
}
}
if($mybb->user['usergroup'] != $restrict && $mybb->user['uid'] != '0' && $_GET['e'] == "comment" && in_array($mybb->user['usergroup'], $admin2))
{
if($message != '') {
$Pic=$db->fetch_array($db->simple_select("gallery_photos","*","id='".$db->escape_string($_POST['id3'])."'"));
$com=$db->fetch_array($db->simple_select("gallery_comments","*","id='".$db->escape_string($_POST['id4'])."'"));
$db->query("UPDATE ".TABLE_PREFIX."gallery_comments SET message='$message' WHERE id='$com[id]'");
redirect("mygal.php?pic=$Pic[id]", $lang->edited_com, $lang->success);
}
else {
redirect("mygal.php?edit=$Pic[id]", $lang->not_posted, $lang->error);
}
}
if($mybb->user['usergroup'] != $restrict && $mybb->user['uid'] != '0' && $_GET['a'] == "rating" && !in_array($mybb->user['usergroup'], $admin2))
{
$Pic=$db->fetch_array($db->simple_select("gallery_photos","*","id='".$db->escape_string($_POST['pic'])."'"));
$db->query("INSERT INTO ".TABLE_PREFIX."gallery_ratings (pic, uid, rating) VALUES ('".$db->escape_string($_POST['pic'])."', '$uid', '".$db->escape_string($_POST['rating'])."')");
$db->query("UPDATE ".TABLE_PREFIX."gallery_photos SET total_ratings='$total2' WHERE id='".$db->escape_string($_POST['pic'])."'");
redirect("mygal.php?pic=$Pic[id]", $lang->rat_posted, $lang->success);
}
if($mybb->user['usergroup'] != $restrict && $mybb->user['uid'] != '0' && $_GET['a'] == "rating" && in_array($mybb->user['usergroup'], $admin2))
{
$Pic=$db->fetch_array($db->simple_select("gallery_photos","*","id='".$db->escape_string($_POST['pic'])."'"));
$db->query("INSERT INTO ".TABLE_PREFIX."gallery_ratings (pic, uid, rating) VALUES ('".$db->escape_string($_POST['pic'])."', '$uid', '".$db->escape_string($_POST['rating'])."')");
$db->query("UPDATE ".TABLE_PREFIX."gallery_photos SET total_ratings='$total2' WHERE id='".$db->escape_string($_POST['pic'])."'");
redirect("mygal.php?pic=$Pic[id]", $lang->rat_posted, $lang->success);
}
if($mybb->user['usergroup'] != $restrict && $mybb->user['uid'] != '0' && $_GET['a'] == "add" && in_array($mybb->user['usergroup'], $admin2) && $select != '' && $Name != '' && $_POST['url'] != '' && $enable != '0')
{
$Cat=$db->fetch_array($db->simple_select("gallery_cats","*","id='$select'"));
$db->query("INSERT INTO ".TABLE_PREFIX."gallery_photos (cat, name, uid, url, description) VALUES ('$select', '$Name', '".$db->escape_string($_POST['uid'])."', '".$db->escape_string($_POST['url'])."', '$desc')");
redirect("mygal.php?cat=$Cat[id]", $lang->posted, $lang->success);
}
if($mybb->user['usergroup'] != $restrict && $mybb->user['uid'] != '0' && $_GET['a'] == "add_computer" && in_array($mybb->user['usergroup'], $admin2))
{
$file_name = $HTTP_POST_FILES['ufile']['name'];
$random_digit=rand(0000,9999);
$new_file_name=$random_digit.$file_name;
$path= "pictures/".$new_file_name;
$type1 = strlen($path) - 3;
$type=substr($path, $type1);
if($ufile !=none && $type == "png" || $type == "gif" || $type == "bmp" || $type == "jpg" || $type == "PNg" || $type == "GIf" || $type == "BMp" || $type == "JPg" || $type == "PNG" || $type == "GIF" || $type == "BMP" || $type == "JPG" || $type == "Png" || $type == "Gif" || $type == "Bmp" || $type == "Jpg" || $type == "pNg" || $type == "gIf" || $type == "bMp" || $type == "jPg" || $type == "pnG" || $type == "giF" || $type == "bmP" || $type == "jpG" || $type == "PnG" || $type == "GiF" || $type == "BmP" || $type == "JpG")
{
if($select != '' && $Name != '' && $HTTP_POST_FILES['ufile']['name'] != '' && $HTTP_POST_FILES['ufile']['size'] <= $size && copy($HTTP_POST_FILES['ufile']['tmp_name'], $path))
{
$Cat=$db->fetch_array($db->simple_select("gallery_cats","*","id='$select'"));
$db->query("INSERT INTO ".TABLE_PREFIX."gallery_photos (cat, name, uid, url, description) VALUES ('$select', '$Name', '".$db->escape_string($_POST['uid'])."', '$path', '$desc')");
redirect("mygal.php?cat=$Cat[id]", $lang->posted, $lang->success);
}
else {
redirect("mygal.php?cat=$Cat[id]", $lang->i_not_posted, $lang->error);
}
}
}
if($mybb->user['usergroup'] != $restrict && in_array($mybb->user['usergroup'], $admin2) && $_GET['d'] == "p" && $mybb->user['uid'] != '0')
{
$Cat=$db->fetch_array($db->simple_select("gallery_cats","*","id='".$db->escape_string($_POST['id3'])."'"));
$Pic=$db->fetch_array($db->simple_select("gallery_photos","*","id='".$db->escape_string($_POST['id'])."'"));
$db->query("DELETE FROM ".TABLE_PREFIX."gallery_photos WHERE id ='".$db->escape_string($_POST['id'])."'");
$db->query("DELETE FROM ".TABLE_PREFIX."gallery_comments WHERE pic ='".$db->escape_string($_POST['id'])."'");
$url=$Pic['url'];
@unlink($url);
redirect("mygal.php?cat=$Cat[id]", $lang->pic_d, $lang->success);
}
if($mybb->user['usergroup'] != $restrict && in_array($mybb->user['usergroup'], $admin2) && $_GET['d'] == "com" && $mybb->user['uid'] != '0')
{
$Pic=$db->fetch_array($db->simple_select("gallery_photos","*","id='".$db->escape_string($_POST['id3'])."'"));
$db->query("DELETE FROM ".TABLE_PREFIX."gallery_comments WHERE id ='".$db->escape_string($_POST['id'])."'");
redirect("mygal.php?pic=$Pic[id]", $lang->com_d, $lang->success);
}
if($mybb->user['usergroup'] != $restrict && $pic4['author'] == $user && $_GET['d'] == "p" && $mybb->user['uid'] != '0')
{
$Cat=$db->fetch_array($db->simple_select("gallery_cats","*","id='".$db->escape_string($_POST['id3'])."'"));
$Pic=$db->fetch_array($db->simple_select("gallery_photos","*","id='".$db->escape_string($_POST['id'])."'"));
$db->query("DELETE FROM ".TABLE_PREFIX."gallery_photos WHERE id ='".$db->escape_string($_POST['id'])."'");
$db->query("DELETE FROM ".TABLE_PREFIX."gallery_comments WHERE pic ='".$db->escape_string($_POST['id'])."'");
$url=$Pic['url'];
@unlink($url);
redirect("mygal.php?cat=$Cat[id]", $lang->pic_d, $lang->success);
}
if($mybb->user['usergroup'] != $restrict && in_array($mybb->user['usergroup'], $admin2) && $_GET['d'] == "c" && $mybb->user['uid'] != '0')
{
$Pic=$db->simple_select("gallery_photos","*","cat='".$db->escape_string($_POST['id2'])."'");
$Pic3=$db->fetch_array($Pic);
$db->query("DELETE FROM ".TABLE_PREFIX."gallery_photos WHERE cat ='$Pic3[cat]'");
$db->query("DELETE FROM ".TABLE_PREFIX."gallery_cats WHERE id ='".$db->escape_string($_POST['id2'])."'");
@unlink($Pic3['url']);
redirect("mygal.php", $lang->cat_d, $lang->success);
}
if($mybb->user['usergroup'] != $restrict && in_array($mybb->user['usergroup'], $admin2) && $_GET['a'] == "cattt" && $Name != '' && $desc != '' && $mybb->user['uid'] != '0')
{
$db->query("INSERT INTO ".TABLE_PREFIX."gallery_cats (name, description) VALUES ('$Name', '$desc')");
redirect("mygal.php", $lang->cat_posted, $lang->success);
}
if($mybb->user['usergroup'] != $restrict && in_array($mybb->user['usergroup'], $admin2) && $_GET['e'] == "cattt" && $mybb->user['uid'] != '0')
{
if($Name != '' && $desc != '')
{
$db->query("UPDATE ".TABLE_PREFIX."gallery_cats SET name='$Name' WHERE id='$_POST[id]'");
$db->query("UPDATE ".TABLE_PREFIX."gallery_cats SET description='$desc' WHERE id='$_POST[id]'");
redirect("mygal.php", $lang->edited_cat, $lang->success);
}
else {
redirect("mygal.php?editcat=$_POST[id]", $lang->not_posted, $lang->error);
}
}
if ($mybb->user['usergroup'] != $restrict && $_GET['action'] != 'cat' && $_GET['pic'] == '' && $_GET['cat'] == '' && in_array($mybb->user['usergroup'], $admin2) && $mybb->user['uid'] != '0')
{
$max=$page2;
$pagenum=$_GET['page'];
if ($pagenum == '')
{
$pagenum=1;
}
$start=($pagenum-1)*$max;
$total=$db->num_rows($db->simple_select("gallery_cats","*"));
$totalpages=ceil($total/$max);
$i=1;
if ($totalpages > 1)
{
$pages.="<table border=\"0\" cellspacing='0'><tr><td class='trow1'>{$lang->page}</td>";
while ($i <= $totalpages)
{
if ($i == $pagenum)
{
$pages.="<td class='trow1'> $i</td>";
}
else
{
$pages.="<td class='trow1'> <a href='mygal.php?page=$i#categories'>$i</a></td>";
}
$i++;
}
$pages.="</table>";
}
$cat=$db->query("SELECT * FROM ".TABLE_PREFIX."gallery_cats ORDER BY ".$order3." $order4 LIMIT $start,$max");
$html.="<head>
<title>{$mybb->settings['bbname']} - {$name}</title>