Файл: index.php
Строк: 679
<?php
error_reporting(0);
include ("foto/config.inc.php");
include("foto/css.inc.php");
include("foto/leng.inc.php");
include ("foto/$yaz");
$ftalb=$ftalb+0;
$data_arrai = file("foto/data/album.dat");
                foreach($data_arrai as $i=>$string)
                        {
                        list($albom[],$alname[])= explode("::","$string");
                        }
?>
<script language=JavaScript>
<!--
function winop(file,win,width,height)
{
    window.open(file,win,"width="+width+",height="+height+",top=0,left=0,titlebar=no,toolbar=no,location=no,status=no,menubar=no,scrollbars=yes,resizable=no");
}
//-->
</script>
<script language="JavaScript">
<!--
function win(file,win,width,height)
{
    window.open(file,"win","width=400,height=250,top=0,left=0,titlebar=no,toolbar=no,location=no,status=no,menubar=no,scrollbars=yes,resizable=no");
}
//-->
</script>
<SCRIPT LANGUAGE="JavaScript">
<!-- Begin
function fullScreen(theURL) {
window.open(theURL, '', 'fullscreen=yes, scrollbars=auto');
}
//  End -->
</script>
<body bgcolor="<?=$BACKGROUND?>" topmargin="5" leftmargin="0" marginwidth="0" marginheight="0" >
<div align="center">
<table width="<?=$size_fotoalbum;?>" border="0" cellspacing="0" cellpadding="3">
     <tr>
        <td valign="top" align="center">
           <table width="100%" border="0" cellspacing="1" cellpadding="3" bgcolor="<?=$BORDER?>"><tr><td align="center" class="p1" bgcolor="<?=$DARK?>">
           <font style="color:#6060B0;font-size:11px;font-family:Tahoma"><b><?=$title?> - <?=$alname[$ftalb];?></b></font></td></tr></table>
        </td>
     </tr>
<?php
$data_array = file("foto/data/$albom[$ftalb]/photo.dat");
if (count($data_arrai) == 0 && $QUERY_STRING != "add" || count($data_array) == 0 && $QUERY_STRING != "add"):
if (count($data_array) == 0)
{
?><title><?=$pusto?></title>
     <tr>
        <td valign="top" align="center">
           <table width="100%" border="0" cellspacing="1" cellpadding="3" bgcolor="<?=$BORDER?>"><tr><td align="center" class="p" bgcolor="<?=$LIGHT?>"><br><br><?=$pusto?> <a href="?add" class=cilka><?=$addfoto?></a><br><br><br></td></tr></table>
        </td>
     </tr>
<?php
}
else
{
?><title><?=$pusto_album;?></title>
     <tr>
        <td valign="top" align="center">
           <table width="100%" border="0" cellspacing="1" cellpadding="3" bgcolor="<?=$BORDER?>"><tr><td align="center" class="p" bgcolor="<?=$LIGHT?>"><br><br><?=$pusto_album?> <a href="foto/admin.php" class=cilka target=_blank><?=$addfoto_album?></a><br><br><br></td></tr></table>
        </td>
     </tr>
<?php
}
else:
if ($QUERY_STRING == "" || ereg("^photo",$QUERY_STRING)|| ereg("^ftalb",$QUERY_STRING)):
?>
           <tr>
           <td align="center">
              <table width="100%" border="0" cellspacing="1" cellpadding="3" bgcolor="<?=$BORDER?>">
                 <tr>
                    <?php
                if (file_exists("foto/data/$albom[$ftalb]/photo.dat")):
                        $data_array = file("foto/data/$albom[$ftalb]/photo.dat");
                else:
                        $error[] = $err[0];
                endif;
                $cnt = count($data_array)-1;
                if(!isset($photo)) $photo=0;
                if (isset($data_array)):
                foreach($data_array as $i=>$string)
                        {
                        list($name[],$comment[])= explode("::","$string");
                        $j=$i+1;
                        if ($photo < $i && $photo >= ($i-5)):
                                echo "";
                                if ($photo == ($i-5)): echo ""; endif;
                        elseif ($photo == $i):
                                echo "";
                        elseif ($photo > $i && $photo <= ($i+5)):
                                if ($photo == ($i+5)): echo ""; endif;
                                echo "";
                        endif;
                        }
                endif;
                     echo "<td align=center class=p bgcolor=$LIGHT>";
                     echo "<table border="0" width=100%><tr><td width=10% align=left>";
                if ($img==0)
                   {
                    if ($photo <= 0):
                              echo "<font color="$BORDER"><< $bgup</font>";
                    else:
                       if ($photo>$cnt) {echo "<a href="?ftalb=$ftalb&photo=$cnt" class=cilka><< $bgup</a> ";}
                          else {
                              $prev = $photo-1;
                              echo "<a href="?ftalb=$ftalb&photo=$prev" class=cilka><< $bgup</a> "; }
                    endif;
                    }
                else
                   {
                    if ($photo <= 0):
                              echo " ";
                    else:
                       if ($photo>$cnt) {echo "<a href="?ftalb=$ftalb&photo=$cnt" class=cilka><img src=$imgl border=0></a> ";}
                          else {
                              $prev = $photo-1;
                              echo "<a href="?ftalb=$ftalb&photo=$prev" class=cilka><img src=$imgl border=0></a> "; }
                    endif;
                   }
                    echo "</td><td width=80% align="center">";
                    if (isset($comment)):
                    foreach($comment as $i=>$value)
                            {
                            if ($photo == $i) echo "<title>$title - $alname[$ftalb] - $comment[$i]</title>$comment[$i]";
                            }
                    endif;
                    echo"</td><td align="right">";
                if ($img==0)
                {
                    if ($photo < $cnt):
                       if ($photo < 0 ){
                              echo "<a href="?ftalb=$ftalb&photo=0" class=cilka>$nxup >></a> ";}
                       else {
                              $next = $photo+1;
                              echo "<a href="?ftalb=$ftalb&photo=$next" class=cilka>$nxup >></a> "; }
                    elseif ($photo >= $cnt):
                              echo "<font color="$BORDER">$nxup >></font>";
                    endif;
                }
                else
                {
                    if ($photo < $cnt):
                       if ($photo < 0 ){
                              echo "<a href="?ftalb=$ftalb&photo=0" class=cilka><img src=$imgr border=0></a> ";}
                       else {
                              $next = $photo+1;
                              echo "<a href="?ftalb=$ftalb&photo=$next" class=cilka><img src=$imgr border=0></a> "; }
                    elseif ($photo >= $cnt):
                              echo " ";
                    endif;
                }
?></td></tr></table>
                    </td>
                 </tr>
              </table>
           </td>
        </tr>
     <tr>
        <td valign="top" align="center">
           <table width="100%" border="0" cellspacing="1" cellpadding="3" bgcolor="<?=$BORDER?>">
               <tr>
                  <?php
                  if (isset($name)):
                  foreach($name as $i=>$value)
                          {
                          if ($photo == $i)
                          {
                          $wh = getimagesize("foto/data/$albom[$ftalb]/$name[$i]");
                          $wkl = $wh[0];
                          $hkl = $wh[1];
                          $wl=$wh[0]+40;
                          $hl=$wh[1]+40;
                          if ($wkl>760)
                          {
                          $wk=760;
                          $hk=($hkl/$wkl)*$wk;
                          $ahrefif="style="CURSOR: url('foto/zoom.cur')" onclick="javascript:winop('foto/show.php?ftalbom=$albom[$ftalb]&ftname=$name[$i]&ftcomment=$comment[$i]','win$i',$wl,$hl);" onmouseover="this.style.backgroundColor='#E8E8FF';" onmouseout="this.style.backgroundColor='#FFFFFF';"";
                          }
                          else
                          {
                          $wk=$wkl;
                          $hk=$hkl;
                          }
                          echo "<td align="center" class="p" bgcolor="$LIGHT" $ahrefif>";
                          echo "<img id="imgsmall" src=""  alt="$comment[$i]" border=0 />";
                          ?>
                          <div id="loadDiv" style="display:none">
<img id="imgbig" onload="document.getElementById('imgsmall').src=this.src; document.getElementById('imgbig').width=<?=$wk;?>; document.getElementById('imgbig').height=<?=$hk;?>">
</div>
<script type="text/javascript">
document.getElementById('imgsmall').src='foto/img/loading.gif';
document.getElementById('imgbig').src='foto/data/<?=$albom[$ftalb];?>/<?=$name[$i];?>';
</script>
                         <?php
                          $ftnmdoc=$name[$i];
                          }
                          }
                  endif;
                  ?>
                  </td>
                </tr>
             </table>
           </td>
        </tr>
        <tr>
           <td align="center">
              <table width="100%" border="0" cellspacing="1" cellpadding="3" bgcolor="<?=$BORDER?>">
                 <tr>
                    <td align="center" class="p" bgcolor="<?=$LIGHT?>">
                    <table border="0" width="100%"><tr><td width="40%" align="center"><?=$falbum?>
                    <SELECT size="1" NAME="album" ONCHANGE="top.location.href = this.options[this.selectedIndex].value">
                      <?php
                  for ($hhh=0;$hhh<count($albom);$hhh++)
                  { if ($hhh==$ftalb)
                    {
                      echo "<option value="?ftalb=$hhh" selected> $alname[$hhh]  </option>";
                      }
                      else
                      {
                      echo "<option value="?ftalb=$hhh"> $alname[$hhh]  </option>";
                      }
                  }
                      ?></select>
                      </td><td width="30%" align="center">
                      <?php
                      if ($slideshow_onoff=="1")
                      {
                      ?><?=$slideshow_title;?>: 
                      <a href="javascript:void(0);" onClick="fullScreen('foto/slideshow.php?ftalb=<?=$ftalb;?>');"><img src="foto/img/fullscreen.gif" alt="<?=$show;?>" width="12" height="12" hspace="2" border="0" align="absmiddle"> </a>
                      <?php
                      }
                      else
                      {
                      echo " ";
                      }
                      ?>
                      </td><td align="right" class="p">
<?php
if ($stats_of_photo_onoff=="1")
{
$data_arrao = file("foto/data/$albom[$ftalb]/make.dat");
                foreach($data_arrao as $i=>$string)
                        {
                        list($foto_dll[],$all_maksl[],$maks1l[],$maks2l[],$maks3l[],$maks4l[],$maks5l[],$ip_maksl[])= explode("::","$string");
                        }
$foto_dl=$foto_dll[$photo];
$all_maks=$all_maksl[$photo];
$maks1=$maks1l[$photo];
$maks2=$maks2l[$photo];
$maks3=$maks3l[$photo];
$maks4=$maks4l[$photo];
$maks5=$maks5l[$photo];
$ip_maks=$ip_maksl[$photo];
                if ($ftnmdoc==$foto_dl)
                {
                $all_maks=$all_maks+0;
                $maks1=$maks1+0;
                $maks2=$maks2+0;
                $maks3=$maks3+0;
                $maks4=$maks4+0;
                $maks5=$maks5+0;
                if ($all_maks!=0)
                {
                $sred_maks=($maks5*5+$maks4*4+$maks3*3+$maks2*2+$maks1)/$all_maks;
                $sred_maks_1=sprintf("%.1f", $sred_maks);
                $sred_maks=sprintf("%.0f", $sred_maks);
                }
                }
if ($sred_maks == 5)
{
$img_make1=$imgzvon;
$img_make2=$imgzvon;
$img_make3=$imgzvon;
$img_make4=$imgzvon;
$img_make5=$imgzvon;
}
elseif ($sred_maks == 4)
{
$img_make1=$imgzvon;
$img_make2=$imgzvon;
$img_make3=$imgzvon;
$img_make4=$imgzvon;
$img_make5=$imgzvoff;
}
elseif ($sred_maks == 3)
{
$img_make1=$imgzvon;
$img_make2=$imgzvon;
$img_make3=$imgzvon;
$img_make4=$imgzvoff;
$img_make5=$imgzvoff;
}
elseif ($sred_maks == 2)
{
$img_make1=$imgzvon;
$img_make2=$imgzvon;
$img_make3=$imgzvoff;
$img_make4=$imgzvoff;
$img_make5=$imgzvoff;
}
elseif ($sred_maks == 1)
{
$img_make1=$imgzvon;
$img_make2=$imgzvoff;
$img_make3=$imgzvoff;
$img_make4=$imgzvoff;
$img_make5=$imgzvoff;
}
else
{
$img_make1=$imgzvoff;
$img_make2=$imgzvoff;
$img_make3=$imgzvoff;
$img_make4=$imgzvoff;
$img_make5=$imgzvoff;
}
$sred_maks=$sred_maks+0;
$sred_maks_1=$sred_maks_1+0;
echo "$fasroc <b>$sred_maks_1</b>  ";
?><script type="text/javascript">
if(document.images){
//preload
var zvz1Off = new Image; zvz1Off.src = "<?=$img_make1;?>";
var zvz1Over = new Image; zvz1Over.src = "foto/img/zvezdaon.gif";
var zvz2Off = new Image; zvz2Off.src = "<?=$img_make2;?>";
var zvz2Over = new Image; zvz2Over.src = "foto/img/zvezdaon.gif";
var zvz3Off = new Image; zvz3Off.src = "<?=$img_make3;?>";
var zvz3Over = new Image; zvz3Over.src = "foto/img/zvezdaon.gif";
var zvz4Off = new Image; zvz4Off.src = "<?=$img_make4;?>";
var zvz4Over = new Image; zvz4Over.src = "foto/img/zvezdaon.gif";
var zvz5Off = new Image; zvz5Off.src = "<?=$img_make5;?>";
var zvz5Over = new Image; zvz5Over.src = "foto/img/zvezdaon.gif";
}
function chgImg(origImg,newImg)
{
    if (document.images){
    document[origImg].src = eval(newImg + ".src")
    }
}
</script>
<a href="javascript:win('foto/make.php?ftalb=<?=$ftalb;?>&photo=<?=$photo;?>&make=1');" target=_top onmouseover="chgImg('zvz1','zvz1Over')" onmouseout="chgImg('zvz1','zvz1Off')" return true;>
<img title="<?=$make_name_1;?>" src="<?=$img_make1;?>" width=11 height=11 border=0 name="zvz1"></a>
<a href="javascript:win('foto/make.php?ftalb=<?=$ftalb;?>&photo=<?=$photo;?>&make=2');" target=_top onmouseover="chgImg('zvz2','zvz2Over'); chgImg('zvz1','zvz1Over')" onmouseout="chgImg('zvz2','zvz2Off'); chgImg('zvz1','zvz1Off')" return true;>
<img title="<?=$make_name_2;?>" src="<?=$img_make2;?>" width=11 height=11 border=0 name="zvz2"></a>
<a href="javascript:win('foto/make.php?ftalb=<?=$ftalb;?>&photo=<?=$photo;?>&make=3');" target=_top onmouseover="chgImg('zvz3','zvz3Over'); chgImg('zvz2','zvz2Over'); chgImg('zvz1','zvz1Over')"
onmouseout="chgImg('zvz3','zvz3Off'); chgImg('zvz2','zvz2Off'); chgImg('zvz1','zvz1Off')" return true;>
<img title="<?=$make_name_3;?>" src="<?=$img_make3;?>" width=11 height=11 border=0 name="zvz3"></a>
<a href="javascript:win('foto/make.php?ftalb=<?=$ftalb;?>&photo=<?=$photo;?>&make=4');" target=_top onmouseover="chgImg('zvz4','zvz4Over'); chgImg('zvz3','zvz3Over'); chgImg('zvz2','zvz2Over'); chgImg('zvz1','zvz1Over')"
onmouseout="chgImg('zvz4','zvz4Off'); chgImg('zvz3','zvz3Off'); chgImg('zvz2','zvz2Off'); chgImg('zvz1','zvz1Off')" return true;>
<img title="<?=$make_name_4;?>" src="<?=$img_make4;?>" width=11 height=11 border=0 name="zvz4"></a>
<a href="javascript:win('foto/make.php?ftalb=<?=$ftalb;?>&photo=<?=$photo;?>&make=5');" target=_top onmouseover="chgImg('zvz5','zvz5Over'); chgImg('zvz4','zvz4Over'); chgImg('zvz3','zvz3Over'); chgImg('zvz2','zvz2Over'); chgImg('zvz1','zvz1Over')"
onmouseout="chgImg('zvz5','zvz5Off'); chgImg('zvz4','zvz4Off'); chgImg('zvz3','zvz3Off'); chgImg('zvz2','zvz2Off'); chgImg('zvz1','zvz1Off')" return true;>
<img title="<?=$make_name_5;?>" src="<?=$img_make5;?>" width=11 height=11 border=0 name="zvz5"></a>
<?php
}
else
{
echo " ";
}
?>
</td></tr></table>
                    </td>
                 </tr>
              </table>
           </td>
        </tr>
<?php
if (count($name)>3 && $reflection_and_poster==1)
{
?>
 <tr>
        <td align="center">
           <table width="100%" border="0" cellspacing="1" cellpadding="3" bgcolor="<?=$BORDER?>"><tr><td width="60%" align="center" class="p" bgcolor="<?=$LIGHT?>">
           <br><?php include ("foto/editor/script.php"); ?><br>
           </table>
        </td>
 </tr>
<?php
}
?>
             <tr>
        <td align="center">
           <table width="100%" border="0" cellspacing="1" cellpadding="3" bgcolor="<?=$BORDER?>"><tr><td width="60%" align="center" class="p" bgcolor="<?=$LIGHT?>">
               <?=$fot?>
                <?php
                if (isset($data_array)):
                foreach($data_array as $i=>$string)
                        {
                        list($name[],$comment[])= explode("::","$string");
                        $j=$i+1;
                        if ($photo < $i && $photo >= ($i-5)):
                                echo "<a href="?ftalb=$ftalb&photo=$i" title="$comment[$i]" class=cilka>$j</a> ";
                                if ($photo == ($i-5)): echo "<a href="?ftalb=$ftalb&photo=$cnt" title=" $pbg " class=cilka>>></a> "; endif;
                        elseif ($photo == $i):
                                echo "<b>$j</b> ";
                        elseif ($photo > $i && $photo <= ($i+5)):
                                if ($photo == ($i+5)): echo "<a href="?ftalb=$ftalb&photo=0" title=" $pnx " class=cilka><<</a> "; endif;
                                echo "<a href="?ftalb=$ftalb&photo=$i" title="$comment[$i]" class=cilka>$j</a> ";
                        endif;
                        }
                endif;
                ?>
           </td>
           <td width="20%" align="center" class="p" bgcolor="<?=$LIGHT?>"><?=$allf?> <?php echo $cnt+1; ?>
           </td>
           <td width="20%" align="center" class="p" bgcolor="<?=$LIGHT?>"><a href="?add" class=cilka><?=$adf?></a>
           </td>
           </tr></table>
        </td>
     </tr>
<?php
if ($module_comment==1)
{
?>
     <tr>
        <td align="center">
<?php include ("comment/index.php"); ?>
        </td>
     </tr>
<?php
}
endif;
endif;
if ($QUERY_STRING == "add" && count($data_arrai) != 0):
?><title><?=$title;?> - <?=$addfototitle;?></title>
     <tr>
        <td align=center>
           <table width="100%" border="0" cellspacing="1" cellpadding="3" bgcolor="<?=$BORDER?>"><tr><td width="70%" align="center" class="p" bgcolor="<?=$LIGHT?>">
           </td>
           <td width="30%" align="center" class="p" bgcolor="<?=$LIGHT?>"><a href="<?=$index_page;?>" class=cilka><?=$vgal?></a>
           </td>
           </tr></table>
        </td>
     </tr>
<?php
        $ok = 0;
        $one = 0;
        $two = 0;
        $three = 0;
        $five = 0;
        $six = 0;
        $path = "foto/data";
                                $upload_photo_name = str_replace(" ","_",$upload_photo_name);
                                $upload_photo_name = str_replace("/","",$upload_photo_name);
                                $upload_photo_name = str_replace("<","",$upload_photo_name);
                                $upload_photo_name = str_replace(">","",$upload_photo_name);
                                $upload_photo_name = str_replace('\"',"",$upload_photo_name);
                                $upload_photo_name = str_replace("\'","",$upload_photo_name);
                                $upload_photo_name = str_replace(":","",$upload_photo_name);
                                $upload_photo_name = str_replace("r","",$upload_photo_name);
                                $upload_photo_name = str_replace("n","",$upload_photo_name);
                                $upload_photo_name = str_replace("%","",$upload_photo_name);
                                $upload_photo_name = str_replace("^ +","",$upload_photo_name);
                                $upload_photo_name = str_replace(" +$","",$upload_photo_name);
                                $upload_photo_name = str_replace(" +","",$upload_photo_name);
        if (!preg_match("/^([A-z,0-9])/", $upload_photo_name))
        {
                                $upload_photo_name = str_replace("А","a",$upload_photo_name);
                                $upload_photo_name = str_replace("а","a",$upload_photo_name);
                                $upload_photo_name = str_replace("Б","b",$upload_photo_name);
                                $upload_photo_name = str_replace("б","b",$upload_photo_name);
                                $upload_photo_name = str_replace("В","v",$upload_photo_name);
                                $upload_photo_name = str_replace("в","v",$upload_photo_name);
                                $upload_photo_name = str_replace("Г","g",$upload_photo_name);
                                $upload_photo_name = str_replace("г","g",$upload_photo_name);
                                $upload_photo_name = str_replace("Д","d",$upload_photo_name);
                                $upload_photo_name = str_replace("д","d",$upload_photo_name);
                                $upload_photo_name = str_replace("Е","e",$upload_photo_name);
                                $upload_photo_name = str_replace("е","e",$upload_photo_name);
                                $upload_photo_name = str_replace("Ё","e",$upload_photo_name);
                                $upload_photo_name = str_replace("ё","e",$upload_photo_name);
                                $upload_photo_name = str_replace("Ж","j",$upload_photo_name);
                                $upload_photo_name = str_replace("ж","j",$upload_photo_name);
                                $upload_photo_name = str_replace("З","z",$upload_photo_name);
                                $upload_photo_name = str_replace("з","z",$upload_photo_name);
                                $upload_photo_name = str_replace("И","i",$upload_photo_name);
                                $upload_photo_name = str_replace("и","i",$upload_photo_name);
                                $upload_photo_name = str_replace("Й","i",$upload_photo_name);
                                $upload_photo_name = str_replace("й","i",$upload_photo_name);
                                $upload_photo_name = str_replace("К","k",$upload_photo_name);
                                $upload_photo_name = str_replace("к","k",$upload_photo_name);
                                $upload_photo_name = str_replace("Л","l",$upload_photo_name);
                                $upload_photo_name = str_replace("л","l",$upload_photo_name);
                                $upload_photo_name = str_replace("М","m",$upload_photo_name);
                                $upload_photo_name = str_replace("м","m",$upload_photo_name);
                                $upload_photo_name = str_replace("Н","n",$upload_photo_name);
                                $upload_photo_name = str_replace("н","n",$upload_photo_name);
                                $upload_photo_name = str_replace("О","o",$upload_photo_name);
                                $upload_photo_name = str_replace("о","o",$upload_photo_name);
                                $upload_photo_name = str_replace("П","p",$upload_photo_name);
                                $upload_photo_name = str_replace("п","p",$upload_photo_name);
                                $upload_photo_name = str_replace("Р","r",$upload_photo_name);
                                $upload_photo_name = str_replace("р","r",$upload_photo_name);
                                $upload_photo_name = str_replace("С","s",$upload_photo_name);
                                $upload_photo_name = str_replace("с","s",$upload_photo_name);
                                $upload_photo_name = str_replace("Т","t",$upload_photo_name);
                                $upload_photo_name = str_replace("т","t",$upload_photo_name);
                                $upload_photo_name = str_replace("У","u",$upload_photo_name);
                                $upload_photo_name = str_replace("у","u",$upload_photo_name);
                                $upload_photo_name = str_replace("Ф","f",$upload_photo_name);
                                $upload_photo_name = str_replace("ф","f",$upload_photo_name);
                                $upload_photo_name = str_replace("Х","h",$upload_photo_name);
                                $upload_photo_name = str_replace("х","h",$upload_photo_name);
                                $upload_photo_name = str_replace("Ц","c",$upload_photo_name);
                                $upload_photo_name = str_replace("ц","c",$upload_photo_name);
                                $upload_photo_name = str_replace("Ч","ch",$upload_photo_name);
                                $upload_photo_name = str_replace("ч","ch",$upload_photo_name);
                                $upload_photo_name = str_replace("Ш","sh",$upload_photo_name);
                                $upload_photo_name = str_replace("ш","sh",$upload_photo_name);
                                $upload_photo_name = str_replace("Щ","sh",$upload_photo_name);
                                $upload_photo_name = str_replace("щ","sh",$upload_photo_name);
                                $upload_photo_name = str_replace("Ъ","",$upload_photo_name);
                                $upload_photo_name = str_replace("ъ","",$upload_photo_name);
                                $upload_photo_name = str_replace("Ы","i",$upload_photo_name);
                                $upload_photo_name = str_replace("ы","i",$upload_photo_name);
                                $upload_photo_name = str_replace("Ь","",$upload_photo_name);
                                $upload_photo_name = str_replace("ь","",$upload_photo_name);
                                $upload_photo_name = str_replace("Э","e",$upload_photo_name);
                                $upload_photo_name = str_replace("э","e",$upload_photo_name);
                                $upload_photo_name = str_replace("Ю","u",$upload_photo_name);
                                $upload_photo_name = str_replace("ю","u",$upload_photo_name);
                                $upload_photo_name = str_replace("Я","ya",$upload_photo_name);
                                $upload_photo_name = str_replace("я","ya",$upload_photo_name);
        }
        if (isset($upload_photo)):
                        session_start();
                        $f_antispam = (int)$_POST["protect_kod"];
                        $antispam = $_SESSION["antispam"];
                        if ($f_antispam!=$antispam && $add_foto_protect=="1"):
                                $error[] = $err_add_kod_protected;
                        else:
                                $six = 1;
                        endif;
                if ($upload_photo_name == ""):
                        $error[] = $err[1];
                else:
                if (!preg_match("/^([A-z,0-9])/", $upload_photo_name)):
                        $error[] = $err[2];
                else:
                if ($upload_photo_type == "image/jpeg"||$upload_photo_type == "image/pjpeg"||$upload_photo_type == "image/gif"):
                        $check = "$path/$album/$upload_photo_name";
                        $check2 = "$path/$upload_photo_name";
                        if (file_exists($check) || file_exists($check2)):
                                $error[] = $err[3];
                        else:
                                $one = 1;
                        endif;
                        if ($upload_photo_size > $max_size ):
                                $error[] = $err[4];
                        else:
                                $two = 1;
                        endif;
                        $wh = getimagesize($upload_photo);
                        if ($wh[0] > $max_width ):
                                $error[] = $err[5];
                        else:
                                $three = 1;
                        endif;
                        if ($wh[1] > $max_height ):
                                $error[] = $err[6];
                        else:
                                $four = 1;
                        endif;
                        if ($new_comment == ""):
                                $error[] = $err[7];
                        else:
                                $five = 1;
                        endif;
                        if ($one == 1 && $two == 1 && $three == 1 && $four == 1 && $five == 1 && $six == 1):
                        copy ($upload_photo, "$path/$upload_photo_name");
                        if ($module_add_text==1)
                        { echo "<img border=0 width=0 hight=0 src="foto/editor/addtext.php?fn_add_text=../data/$upload_photo_name">"; }
                                $new_comment = str_replace("<","<",$new_comment);
                                $new_comment = str_replace(">",">",$new_comment);
                                $new_comment = str_replace('\"',""",$new_comment);
                                $new_comment = str_replace("\'",""",$new_comment);
                                $new_comment = str_replace(":",":",$new_comment);
                                $new_comment = str_replace("r","",$new_comment);
                                $new_comment = str_replace("n","<br>",$new_comment);
                                $new_comment = str_replace("%","%",$new_comment);
                                $new_comment = str_replace("^ +","",$new_comment);
                                $new_comment = str_replace(" +$","",$new_comment);
                                $new_comment = str_replace(" +"," ",$new_comment);
                                $f = fopen ("foto/data/new.dat","a");
                                fputs ($f,"$upload_photo_name::$new_comment::$album::rn");
                                fclose ($f);
                                $ok = 1;
                        endif;
                else:
                        $error[] = $err[8];
                endif;
                endif;
                endif;
        endif;
        if ($ok == 1):
?>
     <tr>
        <td align="center">
          <table width="100%" border="0" cellspacing="1" cellpadding="3" bgcolor="<?=$BORDER?>">
            <tr>
              <td align="center" class="p" bgcolor="<?=$LIGHT?>">
                 <table width=100% border=0><tr><td align="center" class="p" width=30%>
                              <br><img src="foto/data/miniphoto.php?fn=<?=$upload_photo_name;?>&w=200"><br>
                              <b><?=$add_name_size;?></b> <?=$upload_photo_name;?><br>
                              <b><?=$add_size_name;?></b> <? if ($upload_photo_size<1024)
                              { echo "$upload_photo_size $optconf[20]"; }
                              elseif ($upload_photo_size>=1024 && $upload_photo_size<1048576)
                              { $phototmpsize=round($upload_photo_size/1024,1);
                                echo "$phototmpsize $optconf[21]$optconf[20]"; }
                              elseif ($upload_photo_size>=1024 && $upload_photo_size<1048576)
                              { $phototmpsize=round($upload_photo_size/1048576);
                                echo "$phototmpsize $optconf[22]$optconf[20]"; } ?><br> 
                 </td>
                 <td align="center" class="p">
                            <?=$sps?>
                 </td></tr></table>
              </td>
            </tr>
          </table>
        </td>
     </tr>
<?php
        endif;
?>
      <tr>
        <td align="center">
          <table width="100%" border="0" cellspacing="1" cellpadding="3" bgcolor="<?=$BORDER?>">
             <tr>
                <td bgcolor="<?=$LIGHT?>">
                  <table width="590" border="0" cellspacing="0" cellpadding="3" bgcolor="<?=$LIGHT?>">
                    <form enctype="multipart/form-data" action="?add" method="POST">
                    <tr>
                      <td align="right" class="p"><?=$ffott?></td>
                      <td><input style="p" type="file" name="upload_photo" style="width:490px"></td></tr>
                    <tr>
                      <td align="right" class="p"><?=$falbum?></td>
                      <td>
                      <select size="1" name="album">
                      <?php
                  for ($hhh=0;$hhh<count($albom);$hhh++)
                  {echo "<option value="$albom[$hhh]">$alname[$hhh]</option>";}
                      ?></select></td></tr>
                      <tr><td align="right" valign="top" class="p"><?=$komm?></td>
                      <td><textarea style="p" name="new_comment" style="width:490px" rows="5"></textarea></td></tr>
                      <?php if($add_foto_protect==1)
                      {
                      ?>
                      <tr><td align="right" class="p"><?=$add_protect_title;?><br>
                      <img border=0 src="foto/editor/protect.php"></td>
                      <td valign="top" class="p"><input name="protect_kod" type="text" value=""></td></tr>
                      <?php
                      }
                      ?>
                      <tr><td colspan="2" align="center" class="p"><input type="submit" value="<?=$ssendd?>" style="width:100px">
                      </td>
                    </tr>
                    </form>
                  </table>
                </td>
             </tr>
          </table>
        </td>
     </tr>
<?php
endif;
if ($QUERY_STRING == "add" && count($data_arrai) == 0):
?>
<title><?=$pusto_album;?></title>
     <tr>
        <td valign="top" align="center">
           <table width="100%" border="0" cellspacing="1" cellpadding="3" bgcolor="<?=$BORDER?>"><tr><td align="center" class="p" bgcolor="<?=$LIGHT?>"><br><br><?=$pusto_album?> <a href="foto/admin.php" class=cilka target=_blank><?=$addfoto_album?></a><br><br><br></td></tr></table>
        </td>
     </tr>
<?php
endif;
if (isset($error)):
        echo "<tr><td align=center><table width="100%" border="0" cellspacing="1" cellpadding="3" bgcolor="$BORDER">";
        echo "<tr><td align="center" class="error" bgcolor="#FF0000"><b>$errar</b></td></tr>";
        echo "<tr><td align="left" class="p" bgcolor="$LIGHT">";
        foreach ($error as $value)
                {
                echo "<li>$value<br>";
                }
        echo "</td></tr>";
        echo "</table></td></tr>";
endif;
if ($end == 1):
   echo "<tr><td align=center><table width="100%" border="0" cellspacing="1" cellpadding="3" bgcolor="$BORDER">";
   echo "<tr><td align="center" class="p1" bgcolor="$DARK"><a href="$endsrc" target="_blank">$endnm</a></td></tr></table></td></tr>";
endif;
?>
</table>
</div>