Пример #1
0
<?php

global $wpdb, $signature;
$prefix = $wpdb->base_prefix;
$error = array();
$id = $_REQUEST['id'];
$pack = templegallery('', " and id='{$id}'");
$temple_id = $pack[0]->temple_id;
$title = $pack[0]->title;
$image = $pack[0]->image;
$link = '&ho=listgallery&temple_id=' . $temple_id;
if (isset($_POST['registration'])) {
    $title = $_POST['title'];
    if (count($error) <= 0) {
        $sql = "UPDATE `" . $prefix . "temple_gallery_images` set title='{$title}' where id='{$id}'";
        $result = $wpdb->query($sql);
        $file = 'image';
        if (isset($_FILES[$file]['name'])) {
            if (!is_dir('../wp-content/uploads/temples/')) {
                mkdir('../wp-content/uploads/temples');
            }
            if (!is_dir('../wp-content/uploads/temples/gallery')) {
                mkdir('../wp-content/uploads/temples/gallery');
            }
            if (!is_dir('../wp-content/uploads/temples/gallery/thumb')) {
                mkdir('../wp-content/uploads/temples/gallery/thumb');
            }
            if ($_FILES[$file]['name'] != '') {
                if (strtolower($_FILES[$file]["type"]) == "image/gif" || strtolower($_FILES[$file]["type"]) == "image/jpeg" || strtolower($_FILES[$file]["type"]) == "image/jpg" || strtolower($_FILES[$file]["type"]) == "image/png" || strtolower($_FILES[$file]["type"]) == "image/pjpeg") {
                    if ($_FILES[$file]["error"] > 0) {
                        echo "Error: " . $_FILES[$file]["error"] . "<br />";
$temple_id = $temple->id;
$image = $temple->image;
$thumimage = $image;
$accomodation = $temple->accomodation;
$accomodats = unserialize($accomodation);
$urchavar = Templeoption($temple_id, 'urchavar');
$mother = Templeoption($temple_id, 'mother');
$sacredtree = Templeoption($temple_id, 'sacredtree');
$tirtha = Templeoption($temple_id, 'tirtha');
$ecclesiasticus_pooja = Templeoption($temple_id, 'ecclesiasticus_pooja');
$creepy = Templeoption($temple_id, 'creepy');
$legendary_name = Templeoption($temple_id, 'legendary_name');
$trail = Templeoption($temple_id, 'trail');
$states = Statedetail($temple->state_id);
$cities = Citydetail($temple->city_id);
$templegalleries = templegallery($temple_id);
$radius = 100;
$cond = " and id!='{$temple_id}'";
$nearbytemples = nearbytemples($temple->latitude, $temple->longitude, $radius, $cond, 0, 20);
$showimage = '';
if (trim($image) != '' && file_exists('wp-content/uploads/temples/' . $image)) {
    list($imgwidth) = getimagesize('wp-content/uploads/temples/' . $image);
    /*if($imgwidth>781){
    	$imagepath=get_option('home').'/wp-content/plugins/temple/imagecrope.php?width=781&amp;maxw=781&amp;height=330&amp;maxh=330&amp;file='.get_option('home').'/wp-content/uploads/temples/'.$image;
    	}
    	else
    	{*/
    $imagepath = get_option('home') . '/wp-content/uploads/temples/' . $image;
    //}
    $showimage = '<div class="detail_img"><img src="' . $imagepath . '" alt="' . $temple->name . '" width="781" /></div>';
}