El Buscador De PWG

uipágina

file; $addte = $row->text; $addti = $row->title; $addkeys = $row->keywords; $addcat = $row->categories; $addcustom = $row->custom; $addid = $row->id; $adddate = $row->date; $res = mysql_query("INSERT INTO $table_images (file, date, text, keywords, categories, title, custom) VALUES ('$addf', '$adddate', '$addte','$addkeys', '$addcat', '$addti', '$addcustom')"); $res = mysql_query("DELETE FROM $table_addlater WHERE id='$addid'"); $changed = 1; } if ($display_mode && !$galleryid) { $result = mysql_query("SELECT * FROM $table_images WHERE id = $id"); $galleries = explode("#",@mysql_result($result,0,"categories")); $galleryid = $galleries[1]; } if (!$display_mode) { $querystring = "($table_images.visible='t') $template_prefix = "templates/blog_ } else { $querystring = "categories LIKE '%#$galleryid#%' $gallerystr = "&galleryid=$galleryid $template_prefix = "templates/gallery_ } $result = mysql_query("SELECT * FROM $table_images WHERE $querystring order by id DESC"); $visible = mysql_num_rows($result); if (!$display_mode) { if ($visible == 0) exit("No images to display"); if (!$id && !$page) { $id = mysql_result($result,0,"id"); } } $scriptpath = "http://".$_SERVER[HTTP_HOST].$_SERVER[PHP_SELF]; $t = new MiniTemplator(); $t->subtemplateBasePath = "templates $result = mysql_query("SELECT * FROM $table_images WHERE ($table_images.id = $id) AND $querystring"); $index = readtemplate($template_prefix."index.tpl"); if ($page == "all" || ($display_mode && $galleryid && !$id)) { $index = str_replace('${main}',readtemplate($template_prefix."all.tpl"),$index); } elseif ($page == "mailinglist") { $index = str_replace('${main}',readtemplate($template_prefix."mailinglist.tpl"),$index); } elseif ($page == "search") { $index = str_replace('${main}',readtemplate($template_prefix."search.tpl"),$index); } elseif($page){ ob_start(); if (file_exists("$contentdir/$page")) { include("$contentdir/$page"); } $content = ob_get_contents(); ob_end_clean(); $index = str_replace('${main}',$content,$index); } elseif($display_mode && !$galleryid && !$id){ $index = str_replace('${main}',readtemplate($template_prefix."overview.tpl"),$index); } elseif(($image = mysql_fetch_assoc($result))){ $index = str_replace('${main}',readtemplate($template_prefix."main.tpl"),$index); } else { $index = str_replace('${main}',"No valid image id",$index); $t->setTemplateString($index); $t->generateOutput(); exit(); } $index = str_replace('${custom1}',readtemplate($template_prefix."custom1.tpl"),$index); $index = str_replace('${custom2}',readtemplate($template_prefix."custom2.tpl"),$index); preg_match('/${previous(d+)}/', $index, $matches); $previous = $matches[1]; $index = str_replace($matches[0],readtemplate($template_prefix."previous.tpl"),$index); preg_match('/${next(d+)}/', $index, $matches); $next = $matches[1]; $index = str_replace($matches[0],readtemplate($template_prefix."next.tpl"),$index); preg_match('/${recent(d+)}/', $index, $matches); $recent = $matches[1]; $index = str_replace($matches[0],readtemplate($template_prefix."recent.tpl"),$index); $t->setTemplateString($index); if ($display_mode && !$id && !$galleryid) { $result = mysql_query("SELECT * FROM $table_topcat ORDER BY ID ASC"); while ($row = mysql_fetch_assoc($result)){ $query = "SELECT name,file,description, $table_category.id FROM $table_category LEFT JOIN $table_images ON $table_category.foto_id = $table_images.id WHERE top_category = $row[id] ORDER BY $table_category.id DESC $result2 = mysql_query($query); if (mysql_num_rows($result2) == 0) continue; $t->setVariable("top_name",$row[name]); while ($row2 = mysql_fetch_assoc($result2)){ $cattest = mysql_fetch_assoc(mysql_query("SELECT id,file FROM $table_images WHERE categories LIKE '%#".$row2[id]."#%' LIMIT 1;")); if (!$cattest){ continue; } if (!$row2[file]) { $row2[file] = $cattest[file]; } $t->setVariable("image","$imagedir/$thumbdir/$row2[file]"); $t->setVariable("name",$row2[name] ); $t->setVariable("description",getstring(nl2br($row2[description])) ); $t->setVariable("url","$scriptpath?galleryid=$row2[id]"); $t->addBlock("category"); } $t->addBlock("top_category"); } } if($display_mode && $galleryid){ $result = mysql_query("SELECT * FROM $table_category WHERE id = $galleryid"); $row = mysql_fetch_assoc($result); $t->setVariable("gallery_name",$row[name]); $t->setVariable("gallery_link","$scriptpath?galleryid=$galleryid"); } if ($id) { $result = mysql_query("SELECT * FROM $table_images WHERE ($table_images.id < $id) AND $querystring ORDER BY id DESC LIMIT 1"); if ($row = mysql_fetch_assoc($result)) { $t->setVariable("back_url","$scriptpath?id=$row[id]$gallerystr"); $t->setVariable("back_image","$imagedir/$thumbdir/$row[file]"); $url = ' $t->setVariable("back",$url); $t->addBlock("back"); } $result = mysql_query("SELECT * FROM $table_images $joinstr WHERE ($table_images.id > $id) AND $querystring ORDER BY id ASC LIMIT 1"); if ($row = mysql_fetch_assoc($result)) { $t->setVariable("next_url","$scriptpath?id=$row[id]$gallerystr"); $t->setVariable("next_image","$imagedir/$thumbdir/$row[file]"); $url = ' $t->setVariable("next",$url); $t->addBlock("next"); } $t->setVariable("file","$image[file]" ); $t->setVariable("image","$imagedir/$image[file]" ); if (!$dateformat) $dateformat = "Y-m-d $t->setVariable("date", date($dateformat,$image[date])); $t->setVariable("title",getstring($image[title]) ); $t->setVariable("custom",getstring(nl2br($image[custom])) ); $size = getimagesize("$imagedir/$image[file]"); $t->setVariable("width",$size[0]); $t->setVariable("height",$size[1]); $t->setVariable("this","$imagedir/$thumbdir/$image[file]"); $t->setVariable("this_thumbnail",''); if ($image[text]) { $t->setVariable("text",getstring(nl2br($image[text])) ); $t->addBlock("text"); } if($enable_comments){ $result = mysql_query("SELECT * FROM $table_comments WHERE $table_comments.img_id = $id"); $t->setVariable("comment_count",mysql_num_rows($result)); if ($commentsplace == "popup") { // popup $t->setVariable("comment_link","javascript:commentswindow(400,500)"); } elseif ($comments == 0 && $showcomments == 0) { $t->setVariable("comment_link","$scriptpath?id=$id&comments=1"); } else { $t->setVariable("comment_link","$scriptpath?id=$id&comments=0"); } if (($showcomments == 1 || $_POST[comments] == 1) && $commentsplace == "page") { include("comments.php"); $t->setVariable("comments",$comments); } $t->addBlock("comments"); } load_exif($image["file"], 0); } $result = mysql_query("SELECT * FROM $table_images ORDER BY rand() LIMIT 1"); if ($row = mysql_fetch_assoc($result)) { $t->setVariable("random_url","$scriptpath?id=$row[id]$gallerystr"); $t->setVariable("random_image","$imagedir/$thumbdir/$row[file]"); $url = ' $t->setVariable("random",$url); } $java = ' $t->setVariable("java",$java); $t->setVariable("visible",$visible); if ($page == "all" || ($page == "search" && $_REQUEST[term]) || ($galleryid && !$id)){ if(!$display_mode) $numimages = $images_per_blog_page; else $numimages = $images_per_gallery_page; if ($page == "search"){ $terms = explode(" ",$_REQUEST[term] ); if(!$display_mode){ $searchstr = "AND visible = 't' } foreach($terms AS $term){ $searchstr .= " AND (keywords LIKE '%$term%') } $query = "SELECT * FROM $table_images WHERE true $searchstr ORDER BY id DESC $total = mysql_num_rows(mysql_query($query)); $query = "SELECT * FROM $table_images WHERE true $searchstr ORDER BY id DESC LIMIT $from, $numimages } else { $query = "SELECT * FROM $table_images WHERE $querystring ORDER BY id DESC LIMIT $from, $numimages $total = $visible; } $result = mysql_query($query); for ($i=0; $i<$total; $i+=$numimages) { if ($i < $from || $i >= $from+$numimages ) { if ($_REQUEST[term]) { $term = "&term=$_REQUEST[term] } $t->setVariable("page_url","$scriptpath?page=$page&from=$i$gallerystr$term"); $t->setVariable("page_number",(ceil($i/$numimages) + 1)); $t->addBlock("page_link"); $t->addBlock("page"); } else { $t->setVariable("page_number",(ceil($i/$numimages) + 1)); $t->addBlock("page_active"); $t->addBlock("page"); } } if (!$from) $from = 0; while($row=mysql_fetch_assoc($result)){ $t->setVariable("image","$imagedir/$thumbdir/$row[file]"); $t->setVariable("url","$scriptpath?id=$row[id]$gallerystr"); $t->setVariable("title",htmlspecialchars($row["title"])); $t->setVariable("text",htmlspecialchars($row["text"])); $t->setVariable("image_full","$imagedir/$row[file]"); $t->addBlock("image"); } if ($page == "search") { $t->setVariable("term", $_REQUEST[term]); if (!$total) { $t->addBlock("notfound"); } else { $t->addBlock("found"); } } } if ($_POST[add]) { $result = mysql_query("INSERT INTO $table_mailing (email, name) VALUES ('$_POST[mail]', '$_POST[name]')"); $t->addBlock("thankyou"); } if ($_POST[delete]) { $result = mysql_query("DELETE FROM `$table_mailing` WHERE `email` = '$_POST[mail]'"); $t->addBlock("maildelete"); } if ($page == "search"){ if (!$_REQUEST[term]){ $t->addBlock("searchform"); } } preg_match_all('/thumb(d+)/', $index, $matches); foreach($matches[0] AS $k => $v){ $thumbid = $matches[1][$k]; $result = mysql_query("SELECT * from $table_images where id = $thumbid"); if ($row = mysql_fetch_assoc($result)) { $t->setVariable($v."_url","$scriptpath?id=$row[id]$gallerystr"); $t->setVariable($v."_image","$imagedir/$thumbdir/$row[file]"); $url = ' $t->setVariable($v,$url); } } if ($recent) { $result = mysql_query("SELECT * FROM $table_images WHERE $querystring ORDER BY id DESC LIMIT $recent"); while($row = mysql_fetch_assoc($result)){ $t->setVariable("recent_url","$scriptpath?id=$row[id]$gallerystr"); $t->setVariable("recent_image","$imagedir/$thumbdir/$row[file]"); $t->addBlock("recent"); } } if ($next) { $result = mysql_query("SELECT * FROM $table_images WHERE id > $id AND $querystring ORDER BY id ASC LIMIT $next"); $nextleft = $next - mysql_num_rows($result); } if ($previous) { $result = mysql_query("SELECT * FROM $table_images WHERE id < $id AND $querystring ORDER BY id ASC LIMIT $previous"); $previousleft = $previous - mysql_num_rows($result); } if ($next) { $result = mysql_query("SELECT * FROM $table_images WHERE id > $id AND $querystring ORDER BY id ASC LIMIT ".($next + $previousleft).""); while($row = mysql_fetch_assoc($result)){ $t->setVariable("nextX_url","$scriptpath?id=$row[id]$gallerystr"); $t->setVariable("nextX_image","$imagedir/$thumbdir/$row[file]"); $t->addBlock("nextX"); } } if($previous){ $result = mysql_query("SELECT * FROM $table_images WHERE id < $id AND $querystring ORDER BY id ASC LIMIT ".($previous + $nextleft).""); while($row = mysql_fetch_assoc($result)){ $t->setVariable("previousX_url","$scriptpath?id=$row[id]$gallerystr"); $t->setVariable("previousX_image","$imagedir/$thumbdir/$row[file]"); $t->addBlock("previousX"); } } if ($_COOKIE['sylverblog_admin'] && $id) {
Edit
} $t->generateOutput(); @mysql_free_result($result); ?>
»Buscador
Este sitio web fue creado de forma gratuita con PaginaWebGratis.es. ¿Quieres también tu sitio web propio?
Registrarse gratis