$opt "; } // save any changed state if (isset($_REQUEST['paintings_form']) ) $_SESSION['paintings_form'] = $_REQUEST['paintings_form']; if (isset($_REQUEST['exhibition_form']) ) $_SESSION['exhibition_form'] = $_REQUEST['exhibition_form']; $arr=array('edit','read','hide'); foreach ($arr as $v) { $p_opts .= param_opt('paintings_form',$v); } $arr=array('read','hide'); foreach ($arr as $v) { $e_opts .= param_opt('exhibition_form',$v); } } // ---- apply painting details edit if (IsAdmin()) { if (!empty($_POST['Submit'])) { include 'process_paintings_form.inc'; $paintings_edit_result .= '
' . process_paintings_form(); } else if (!empty($_POST['Cancel'])) { $paintings_edit_result .= '
(edit cancelled)'; } } // ------ get painting rec (by either sn or filename) $query="select sn, title, height, width, filename, ifnull(m.text, p.media), ifnull(b.text, p.base), status, price_override, web_text, pl.name, pl.city, pl.state, pl.url, p.published from paintings p left join media_type m on p.media=m.id left join base_type b on p.base=b.id left join places pl on p.status=pl.id where (sn='$fn' or filename='$fn')"; global $conn_id; $result=mysqli_query($conn_id, $query); if (mysqli_num_rows($result) != 1) { $page->header(); if ($debug) { echo "
fn=[$fn]
"; echo "
given_fn=[$given_fn]
"; echo "
gal=[$gal]
"; echo '
';
			print_r ($_REQUEST);
		echo '
'; } ?>
Error looking up painting, sorry!

Back to index

footer(); exit; } list ( $sn, $title, $height, $width, $filename, $media, $base, $status, $price_override, $web_text, $place_name, $city, $state, $place_url, $published) = mysqli_fetch_row($result); if ($e) { include_once 'print_info.inc'; $print_row = lookup_print($sn, $e, $p); if ($print_row) { $disp_text = format_print_info ($print_row); } else { $page->header(); ?>
Error looking up print, sorry!

Back to index

footer(); exit; } } else { $disp_text = FormatText ($arg1, $sn, $e, $p, $title, $height, $width, $media, $base, $status, $price_override, $web_text, $place_name, $city, $state, $place_url); } if (IsAdmin()) { $exhibit_text = "
[exhibition rec: $e_opts]"; switch ($_SESSION['exhibition_form']) { case 'read': include 'exhibition_list.inc'; $exhibit_text .= '
' . exhibition_list($sn, $e, $p); break; default: break; } $paint_text .= "
[painting details: $p_opts]"; switch ($_SESSION['paintings_form']) { case 'edit': if ($e) { //include 'show_prints_form.inc'; //$paint_text .= show_prints_form($sn); } else { include 'show_paintings_form.inc'; $paint_text .= show_paintings_form($sn); } break; case 'read': include 'paintings_read.inc'; $paint_text .= dump_paintings($sn, $e, $p); break; default: break; } } $jpgfn = '/i/paintings/sc/' . $filename . $detail . '.jpg'; $fullfn = ROOT . $jpgfn; @ list($w, $h, , $attr) = getimagesize($fullfn); $disp_w = $w; $disp_h = $h; # scale the image down if it's too wide, and give a link to see fullsize $max_width = 600; $scale_to = 500; if ($w <= $max_width) { $resize_tag = ''; } else { if (! $showing_large) { $disp_w = $scale_to; $disp_h = round( ($h/$w) * $scale_to) ; $attr = 'width="' . $disp_w . '" height="' . $disp_h . '"'; $resize_tag = '
' . FmtURL('display larger', "$urlroot/$galurl${fn}${detail}-large.html") .'
'; } else { $resize_tag = '
' . FmtURL('display smaller', "$urlroot/$galurl$fn.html") . '
'; } } $text_block = $disp_text . FormatDetails($fn) . $exhibit_text . $paintings_edit_result . $paint_text; $text_block .= tags_text($sn); // --- setup contact form if ($contact_arg=='step1') { include 'contact.inc'; $text_block .= contact_form($title); } else { $text_block .= setup_ajax_contact_form($sn, $title); } // ------- start display $page->SetTitle( htmlentities("\"$title\"", ENT_QUOTES) . ' ' . $height . 'x' . $width . ' in. ' . $media . ' on ' . $base . ' - Landscape Paintings by Joe Kazimierczyk'); # for Open Graph image meta tag points to the whole image thumb (no detail) # 29-Apr-12 change to use larger image instead of small thumb. (OG spec changed?) if ($filename != '') { # Note: some pages are a work in progress and don't have an image yet $thumbfn = '/i/paintings/sc/' . $filename . '.jpg'; $page->Set('HEADER_IMAGE', $thumbfn); # AddThis Pinterest button will use the og:image meta which must be a small # thumbnail. But I want Pinterest to use the larger image, so set this so # that it's included in the AddThis button: $bigfn = '/i/paintings/sc/' . $filename . '.jpg'; $page->Set('PINTEREST_BIG_IMAGE', $bigfn); } # for Open Graph, and for Google, give a canonical url stripped of any # gallery or tag name, and any -detail or -large, so that the # same page is counted once no matter what gallery it appears under. # NOTE: our .htaccess insures server_host is #www.joekaz.net and consistent in our canonical urls: $page->Set('CANONICAL_URL', "/galleries/$fn.html"); $page->header(); echo NavBar ($gal, $gal_display, $type, $sep_fn); echo "\n", '', "\n"; echo '
'; echo ''; if (! $showing_large) { #then we have a left column echo ""; echo '\n"; echo '"; echo ""; echo "
', $text_block; echo "'; } if ($filename) { if (file_exists($fullfn)) { # echo '
'; echo '
'; echo '', $title,''; $page->Show_AddThis(''); echo '
'; echo $resize_tag; if ($showing_large) echo '
', $text_block, '
'; } else { echo '
not found:
', $fullfn, '
'; } } else { echo '
Sorry, no image available.
'; } echo "
\n"; echo '
'; #end image_page echo '', "\n"; echo NavBar ($gal, $gal_display, $type, $sep_fn); mysqli_close($conn_id); $page->footer(); // ========================== done mainline =========================== // function FormatText ($arg1, $sn, $e, $p, $ttl, $h, $w, $media, $support, $status, $price_override, $web_text, $place_name, $city, $state, $place_url) { $disp_size = FmtHW ($h, $w); $current = DBCurrentVenue($sn, $e, $p); $venue_txt = FmtCurrentVenue($current); list($price, $formula_price, $DBstatus) = DBCurrentPrice($sn, $e, $p, $current); if ( $web_text ) { $web_text = '
' . $web_text; } return '

' . ucwords($ttl) . "

" . "$media on $support
" . $disp_size .'
' . FmtPrice ($status, $price, $formula_price, $venue_txt) . prints_blurb($sn) . $web_text . awards_text($sn); } function FmtPrice ($status, $price, $formula_price, $venue_txt) { switch (strtolower($status)) { case 's': $purchase_txt = 'SOLD' . 'sold'; break; case 'n': $purchase_txt = 'Not for sale'; break; default: $purchase_txt = '$' . $price . '' . ' (U.S. dollars) ' . FmtURL('currency conversion','http://www.xe.com/ucc/',TRUE) . ''; break; } if ($venue_txt) $purchase_txt .= '
' . $venue_txt; if (IsAdmin()) { if ($price != $formula_price) { $purchase_txt .= '
(formula = $' . $formula_price . ')'; } } return $purchase_txt; } function FmtHW ($h, $w) { if ( is_numeric($h) and is_numeric($w) ) { return sprintf('%s x %s inches (%s x %s cm)', cutzero($h), cutzero($w), cutzero(round($h * 2.54, 1)), cutzero(round($w * 2.54, 1)) ); } } function cutzero($value) { return preg_replace("/(.\d+?)0+$/", "$1", $value)*1; } #---------------------------------------------------------------------- # build mini-gallery if any detail images are found function FormatDetails ($fn) { $th_path = '/i/paintings/th'; $details = glob (ROOT . "$th_path/$fn-detail*.jpg"); if (! $details) return; # no details found $ret = '
Select a different view:
'; $ret .= FormatDetailsURL($fn); foreach ($details as $f) { $ret .= FormatDetailsURL( basename($f,'.jpg') ); } return $ret; } #---------------------------------------------------------------------- function FormatDetailsURL ($fn) { global $urlroot, $galurl, $gal, $title, $showing_large; $th_path = '/i/paintings/th'; $current_page = basename($_SERVER['REQUEST_URI'], '.html'); $html = '' . $title . ''; $lg = $showing_large ? '-large' : ''; if ($current_page != $fn) $html = FmtURL ($html, "$urlroot/$galurl$fn$lg.html"); #the CR seem important for letting images wrap to the screen width available return "$html\n"; } #---------------------------------------------------------------------- # build the 'prev index next' link bar function NavBar ($gal, $gal_display, $type, $fn) { global $urlroot, $galurl; if (!$gal) return; #just a solo painting sans gallery //------ build the prev and next links include_once 'read_index.inc'; $index = get_thumb_list ($gal,$type); $this_pos = array_search ($fn, $index); $prev = $index[$this_pos - 1]; $next = $index[$this_pos + 1]; if ($prev) $prev_link=FmtURL('<< Prev',"$urlroot/$galurl$prev.html"); if ($next) $next_link=FmtURL('Next >>', "$urlroot/$galurl$next.html"); return '
' . $prev_link . ' ' . FmtURL('Index of '.$gal_display, "$urlroot/$galurl") . ' '. $next_link. '
'; } function FmtCurrentVenue($current) { if ($current['place']) { return 'Currently on display at: ' . FmtURL ($current['place'], $current['url'], true) . ', ' . $current['city'] . ', ' . $current['state'] ; } } #---------------------------------------------------------------------- function prints_blurb ($sn) { $n = prints_available($sn); if ($n) return '
(giclee prints of this painting are available)'; return ''; } # return the number of prints currently available function prints_available($sn) { $sql = "select print from prints where sn='$sn' and status !='s'"; global $conn_id; $result=mysqli_query($conn_id, $sql); return mysqli_num_rows($result); } #---------------------------------------------------------------------- function tags_text($sn) { if (IsAdmin()) { return get_edit_tag_text($sn); } else { $txt = get_display_tag_text($sn); if ($txt) return '
tags: ' . $txt . '
'; } } function get_display_tag_text($sn) { $q = "select t.name, t.normal_name from tag_targets tt left join tags t on t.id=tt.id where tt.sn='$sn' and not t.hidden order by t.name"; global $conn_id; $result = mysqli_query($conn_id, $q); $text = ''; for ($i=0; $i' . $row['name'] . ''; } return $text; } function get_edit_tag_text($sn) { global $published; # get current tags for this sn $q = "select t.name from tag_targets tt left join tags t on t.id=tt.id where tt.sn='$sn' order by t.name"; global $conn_id; $res = mysqli_query($conn_id, $q); while ($row = mysqli_fetch_array($res)) { $curr_tags[] = $row['name']; } if ($curr_tags) $curr_taglist = implode(', ', $curr_tags); # get all available tags: $q = "select name from tags order by name"; $res = mysqli_query($conn_id, $q); while ($row = mysqli_fetch_array($res)) { $tags[] = '' . $row['name'] . ''; } $taglist = implode(' ', $tags); $txt = <<
pub=[$published]
$taglist
TAGBOX; return $txt; } #---------------------------------------------------------------------- function awards_text ($sn) { # was: case l.awarded_by when '' then p.name else l.awarded_by end awarded_by $q = "select award, date_format(i.start,'%Y') start, case i.html_name when '' then i.name else i.html_name end show_name, l.awarded_by from show_list l left join show_info i on i.id=l.show_id left join places p on p.id=i.venue where l.sn= '$sn' and l.award != '' order by i.start desc"; global $conn_id; $result = mysqli_query($conn_id, $q); $text = ''; for ($i=0; $i') . /* handles multiple awards */ $text . '' . $row['award'] . ' - ' . $row['start'] . ($row['awarded_by'] ? '
'.$row['awarded_by'] : '') . '
' . '
' . $row['show_name']; } if ($text!='') { $text = "
Awarded: $text
"; } return $text; } #---------------------------------------------------------------------- function setup_ajax_contact_form($sn, $title) { return << JS1; } #---------------------------------------------------------------------- ?>