sql_query($sql) or $obj_error->return_error(CRITICAL_ERROR, $obj_db->sql_error($sql)); while ($row = $obj_db->sql_fetchrow($result)) { $$row['variable'] = $row['value']; } define('NAME_SITE', $NAME_SITE); define('MAIN_EMAIL', $MAIN_EMAIL); define('CONTACTS_MAIN', $CONTACTS_MAIN); ////////////////////////////////////END настройки $template_file = 'image.html'; $MAIN_HTTP_PATH = MAIN_HTTP_PATH; $NAME_SITE = NAME_SITE; $from = eregi_replace("[^a-z,_,0-9,.,:,/,\-]","",getenv("HTTP_REFERER")); $from = eregi_replace($MAIN_HTTP_PATH,"",$from); $from = eregi_replace("\/","",$from); $from = eregi_replace(".html","",$from); $image_name = str_replace($MAIN_HTTP_PATH,"",$image); $image_name = str_replace("/uploads","uploads",$image_name); //echo $MAIN_HTTP_PATH.' - '.$image_name; //echo $from; /* $size = getimagesize($image_name); $size_bigimg[0] = $size[0]; $size_bigimg[1] = $size[1]; $imagetoshow = << $imagetext EOD; $PHOTO_OUT = $imagetoshow; $widthdivblock = $size_bigimg[0]-60; $winheight = $size_bigimg[1]+50; $winwidth = $size_bigimg[0]; $PHOTO_OUT .=<< window.scrollbars.visible='false'; window.resizeTo('{$winwidth}','{$winheight}'); EOD; $TITLE = "Изображение"; */ if ((ereg("uploads/catalog",$image_name))||(eregi('catalog',$image_name))) { $image_id = eregi_replace("_([0-9]+)_","",$image); $image_id = eregi_replace("[^0-9]","",$image_id); //echo $image_id; if (!eregi('catalog',$image_name)){ $size = getimagesize("uploads/catalog/".$image_name); $size_bigimg[0] = $size[0]; $size_bigimg[1] = $size[1]; $height_div = $size_bigimg[1]-40; $image_name = 'uploads/catalog/'.$image_name; } else { $size = getimagesize($image_name); $size_bigimg[0] = $size[0]; $size_bigimg[1] = $size[1]; $height_div = $size_bigimg[1]-40; $image_name = $image_name; } $query2 = "SELECT * FROM `$catalog` WHERE `id`='$image_id'"; $result2 = mysql_query ($query2) or die ("ошибка запроса1"); while ($row2 = mysql_fetch_array ($result2)) { $id_photo = $row2['id']; $name_image = $row2['name']; /* $imagetext .= <<

{$name_image}

EOD;*/ $alt_image = $name_image; //echo $image_name; } } elseif ((eregi('uploads/news',$image_name))) { $image_id = eregi_replace("_([0-9]+)_","",$image); $image_id = eregi_replace("[^0-9]","",$image_id); //echo 'sdfsdfsdf'.$image_id; $size = getimagesize($image_name); $query2 = "SELECT * FROM `$news` WHERE `id`='$image_id'"; $result2 = mysql_query ($query2) or die ("ошибка запроса1"); while ($row2 = mysql_fetch_array ($result2)) { $id_photo = $row2['id']; $name_image = $row2['stext']; /*$imagetext .= <<

{$name_image}

EOD;*/ $alt_image = $name_image; //echo $image_name; } } else { //echo $from; $size = @getimagesize($image_name); } $size_bigimg[0] = $size[0]; $size_bigimg[1] = $size[1]; $alt_image = htmlspecialchars($alt_image); if (empty($alt_image)) $alt_image = 'Изображение.'; $imagetoshow = << EOD; $PHOTO_OUT = $imagetoshow; $widthdivblock = $size_bigimg[0]-60; $winheight = $size_bigimg[1]+50; $winwidth = $size_bigimg[0]; /* $PHOTO_OUT .=<< window.scrollbars.visible='false'; window.resizeTo('{$winwidth}','{$winheight}'); EOD; */ $TITLE = "{$alt_image}"; $template_file = 'image.html'; if (file_exists("templates/".$template_file)) $page = read_template("templates/".$template_file); $page = str_replace("{TITLE}", $TITLE, $page); $page = str_replace("{PHOTO_OUT}", $PHOTO_OUT, $page); $page = str_replace("{NAME_SITE}", $NAME_SITE, $page); $page = str_replace("{MAIN_HTTP_PATH}", $MAIN_HTTP_PATH, $page); $page = str_replace('href="/', 'href="'.$MAIN_HTTP_PATH.'/', $page); $page = str_replace('action="/', 'action="'.$MAIN_HTTP_PATH.'/', $page); $page = str_replace("/img/", $MAIN_HTTP_PATH.'/img/', $page); $page = str_replace("/swf/", $MAIN_HTTP_PATH.'/swf/', $page); $page = str_replace("/js/", $MAIN_HTTP_PATH.'/js/', $page); $page = str_replace("/uploads", 'uploads', $page); $page = str_replace("uploads/", $MAIN_HTTP_PATH.'/uploads/', $page); echo $page; ?>