". php_file_date() . html5_validator_link();
mysql_close($dhn);
?>
function ucoz_exists_check($row) # I think now redundant 'ubigx'=2 is no longer used
{
global $_g;
if ($_g['glrw']['ucoz']!=1 || $row['ubigx']<2) return;
$rsadd= str_replace('_ph','photo',$_g['glrw']['base']);
$rsadd=substr($rsadd,0,strlen($rsadd)-1) .'-0-'. $row['uid'];
$res=http_get($rsadd);
// or could try and read the big image! Would need a mod to http_get to just fetch a few bytes
if (strlen($res)<100) return;
$qs= 'update `'. $_g['glrw']['table'] .'` set `ubigx` = '.
( strpos($res,'in real size')>0 ? '"1"' : 'NULL' ).
' where `frameno` = "'. $row['frameno'] .'" limit 1';
do_query($qs);
}
// ------------------- links, title, howview, etc.
function specialframe($key)
{
global $_g;
$sres= do_query("select * from `{$_g['glrw']['table']}` ".
"where `frameno`='{$_g['glrw']['code']}$key'");
$row = mysql_fetch_assoc($sres);
mysql_free_result($sres);
return $row;
}
function dolinks()
{
$row=specialframe('links');
echo wikilinks($row['descr1']). "
\n";
}
// -----------------
/* The first function in this section was in photinc.php but since these functions are
currently only used from here and from galled.php, I have left them here.
In fact rwhgal3.php uses galled.php but rwhgal3.php is currently useless because fotopic is dead */
function get_image($row,$hei,$clasmap="")
{
global $_g, $basedir, $annotd, $mapno;
$fcore= ($_g['glrw']['ucoz']==1 ? $row['ufrano'] : $row['frameno']) .'.jpg';
if (isset($_COOKIE['pathome']) && strlen($_g['glrw']['pathome'])) {
if ($_REQUEST['pathopt']=='u')
{ $f640= "http://localhost/homp/RH.net/1local/cc2rh.php".
"?sd={$_COOKIE['pathome']}{$_g['glrw']['pathome']}&f=$fcore&dd=".
($_g['glrw']['ucoz'] ? "" : $basedir) .
"{$_g['glrw']['pathbig']}&u={$_g['glrw']['ucoz']}"; }
else { $f640=$_COOKIE['pathome'] . $_g['glrw']['pathome'] . $fcore; }
} else $f640= $_g['glrw']['path640'] . $fcore;
$fbig=$_g['glrw']['pathbig'] . $fcore;
switch ($_g['glrw']['ucoz']) {
case 1: $bigx= ($row['ubigx']==1); break; # ucoz galleries using ucozim table
case 3: $bigx= isset($_g['glrw']['ubigx'][$fcore]);
break; # ucoz directories with local remoim.txt
case 4: $bigx= false; break; # slides archive on flickr - slarc table
case 5: $bigx= true; break; # ucoz directories with full set of bigs
default: $bigx= ($row['width']*$row['height']>600000);# image directory is local - no longer
$f640=$fbig; break; # separate 640 and bigs
}
if (strlen($row['filnam'])>0) {
$bigx |= 2;
$fbig='http://upload.wikimedia.org/wikipedia/commons'.
rwfImageDir(str_replace(' ','_',$row['filnam'])) .
wfUrlencode(str_replace(' ','_',$row['filnam']));
}
if ($bigx) $hei -= 4;
$wid= floor($hei*$row['width']/$row['height']); #try truncate rather than round to match phpthumb
$bwid=$wid; if ($bigx) $bwid += 4;
if($_g['glrw']['ucoz']==4) {
$imadroo="http://farm{$row['farm']}.staticflickr.com/{$row['server']}/{$row['flickr_id']}_";
$fbig = $f640="$imadroo{$row['originalsecret']}_o.{$row['originalformat']}";
$imsrc= "$imadroo{$row['secret']}_m.jpg";
} else {
$imsrc= $_g['glrw']['pathumb'] .
($_g['glrw']['ucoz']==1 ? "{$row['frameno']}.jpg" : "$fcore&h=$hei");
# using w=$wid creates images which are 1px too short in height
}
$_g['altext']="{$row['takenon']} Fr:{$row['frameno']} Sq:{$row['seqno']}";
$ds3= $annotd && strlen($row['descr3'])>0;
if (!strlen($clasmap) && ($bigx || $ds3)) {
$clasmap=' class="'. ($bigx ? (($bigx & 2)!=0 ? 'wlnk ' : 'xlnk ') : '') .
($ds3 ? 'imwcap' : '') .'"';
}
if (($bigx & 2)!=0) {
$mapno++; $clasmap .= ' usemap="#map'. $mapno .'"';
$res= "
";
$_g['imaddr']=($bigx ? $fbig : $f640);
if (($bigx & 2)!=0) {
$res .= $imbit;
} else {
$res= "
";
}
return array( $bigx, $bwid, $res );
}
function default_d3_bwid($row)
{
global $_g;
# $bwid=round($_g['glrw']['theight']*1.33333);
$bwid=round(105*strlen($row['descr3'])/$_g['glrw']['theight']); if ($bwid<80) $bwid=80;
return $bwid;
}
function do1img($row,$debug=false)
{
global $_g, $annotd;
if ($row['d3_bwid']>=0) echo "
\n";
if ($row['width']>0) {
$ar=$row['width']/$row['height'];
if ($ar>1.333333) $hei=$_g['glrw']['theight'];
elseif ($ar>1.142857) $hei=round($_g['glrw']['theight']*1.333333/$ar);
# if > 8/7 aspect ratio - constant width
else $hei=$_g['glrw']['box_height'];
list( $bigx, $bwid, $a_img ) = get_image($row,$hei);
echo "
$a_img
\n";
}
if ($annotd && strlen($row['descr3'])) {
$bwid= round( ($row['d3_bwid'] ? $row['d3_bwid'] : default_d3_bwid($row))
* $_COOKIE['d3w_scale'] / $_COOKIE['em2px'] , 1);
echo ($bwid>0 ? "
" :
"
" : ">") ).
wikilinks($row['descr3']) ."
\n";
}
if ($row['d3_bwid']>=0) echo "
\n";
}
// -----------------
function edlink($row)
{
global $_g, $edok, $mthbt;
if ($edok) {
return "
".
"{$_g['lkpref']}j{$mthbt}obcurr=s&seqfrom={$row['seqno']}\">edit
\n";
}
}
function get_rowb1($rbck)
{
global $_g;
while (TRUE) {
$qs= "{$_g['qs_pref']} and omit=0 and seqno >= '{$_REQUEST['from']}' order by seqno limit ";
$sres= do_query($qs.'1'); $_g['fst_row'] = mysql_fetch_assoc($sres);
# 'from' param may not be an actual seqno so we normalise it
# $_g['fst_row'] is for change format and "prev" options
# Curious quirk: "" as descr1 of first of a gallery is OK.
# But NULL will cause a spurious 'back to ...' link!
# echo "\$_g['fst_row']['seqno'] = {$_g['fst_row']['seqno']}
\n";
$sres= do_query("{$_g['qs_pref']}and seqno <= '{$_g['fst_row']['seqno']}' and descr1 > '' ".
"order by seqno desc limit 1");
$_g['rowb1'] = mysql_fetch_assoc($sres);
# $_g['rowb1'] gives us a descr1 even if we have not started on a descr1 break but ...
# echo "roll back for descr1 = {$_g['rowb1']['seqno']}
\n";
$sres= do_query("{$_g['qs_pref']}and seqno <= '{$_g['fst_row']['seqno']}' and descr1 = '".
mysql_real_escape_string($_g['rowb1']['descr1']) ."' order by seqno asc limit 1");
$_g['rowb1'] = mysql_fetch_assoc($sres); # ... we must allow for multiple descr1's
# echo "roll fwd for descr1 = {$_g['rowb1']['seqno']}
\n";
if (!$rbck) break;
$rbck=FALSE; $_REQUEST['from']=$_g['rowb1']['seqno'];
}
return $qs;
}
function userlist($rbck=FALSE) // user format listing
{
global $_g, $annotd, $img_count, $minth, $mthbt;
$annotd=($_REQUEST['fmt'] !== 'u');
if ($_REQUEST['minth']<5) $_REQUEST['minth']=47;
if ($minth==0) $minth=$_REQUEST['minth'];
$mthbt= "&minth={$_REQUEST['minth']}&";
$nofo= '" rel="nofollow';
$nofon= "' rel='nofollow";
if ($img_count<=$minth) unset($_REQUEST['from']);
$qs=get_rowb1($rbck);
if (strcmp($_g['fst_row']['frameno'],$_g['rowb1']['frameno'])!=0) {
$rblink=$_g['lkpref'] . $_REQUEST['fmt'] . $mthbt .'from='.
$_g['rowb1']['seqno'] . $nofo .'">back to start of section';
echo "
$rblink
";
}
$sres= do_query($qs.($minth+100));
$row = mysql_fetch_assoc($sres); $picsout=0;
while ($row!=FALSE && $picsout<$minth) {
if ($annotd && $picsout>0) echo '
';
echo '
'.
wikilinks($_g['rowb1']['descr1']) .''. edlink($_g['rowb1']) ."
\n";
do {
$rowb2=$row;
if ($annotd && strlen($row['descr2'])>0)
{ echo '
'.
wikilinks($row['descr2']) .''. edlink($row) ."
\n"; }
do {
do {
do1img($row);
$picsout++; $row = mysql_fetch_assoc($sres);
} while ($row!=FALSE && strlen($row['descr1'])==0 && strlen($row['descr2'])==0);
$d1b = (strcmp($row['descr1'],$_g['rowb1']['descr1'])!=0 && strlen($row['descr1'])>0);
// descr1 break
$d2b = (strcmp($row['descr2'],$rowb2['descr2'])!=0 && strlen($row['descr2'])>0);
} while ($row!=FALSE && !$d1b && !$d2b);
// any descr2 break end action
} while ($row!=FALSE && !$d1b);
$_g['rowb1']=$row;
echo "\n";
}
mysql_free_result($sres);
echo "
Navigation\n";
if ($rblink!=FALSE) {
echo " |
$rblink\n";
}
if ($img_count>$_REQUEST['minth']) {
echo " |
".
"{$_g['lkpren']}p{$mthbt}to={$fst_row['seqno']}$nofon'>previous ".
" | ". ($annotd ?
($_g['lkpref'] .'u'. $mthbt .'from='. $_g['fst_row']['seqno'] . $nofo .
'">un-annotated') : 'like this') .''.
" | {$_g['lkpren']}u{$mthbt}from={$row['seqno']}$nofon'>next".
"\n".
' |
'. $_g['lkpref'] .'q'. $mthbt .'to='. $_g['fst_row']['seqno'] . $nofo .
'">previous'.
' | '. (!$annotd ?
("{$_g['lkpref']}v{$mthbt}from={$_g['fst_row']['seqno']}$nofo\">".
"with all the chat") : 'like this') ."\n".
" | {$_g['lkpren']}v{$mthbt}from={$row['seqno']}'>next\n".
"\n";
} else {
echo ' |
'.
' | '. ($annotd ?
($_g['lkpref'] .'u'. $mthbt .'from='. $_g['fst_row']['seqno'] . $nofo .
'">un-annotated') : 'like this') .' | '.
"\n |
".
' | '. (!$annotd ?
("{$_g['lkpref']}v{$mthbt}from={$_g['fst_row']['seqno']}$nofo\">".
"with all the chat") : 'like this') .' | '. // see below
"\n";
// validator objects to | but allows an un-closed | !
}
$max_minth=2*$_REQUEST['minth'];
if ($max_minth>$img_count) $max_minth=$img_count;
echo ' |
redisplay with: ';
foreach (array( 0.25, 0.3536, 0.5, 0.7071, 1 ) as $fac) {
$mth=round($fac*$max_minth);
if ($fac!=0.5 || $mth!=$_REQUEST['minth']) {
echo "{$_g['lkpref']}{$_REQUEST['fmt']}&minth=$mth".
"&from={$_g['fst_row']['seqno']}$nofo\">$mth\n";
}
}
echo "items".
"\n |
".
"{$_g['lkpren']}a&from={$_g['fst_row']['seqno']}$nofon'>".
"full screen ";
if ($img_count<100) echo "{$_g['lkpren']}w{$mthbt}manual{$nofon}'>slideshow ";
# arbitrary limit on gallery size
echo "{$_g['lkpren']}s$mthbt$nofon'>search ".
"{$_g['lkpref']}e$mthbt$nofo\">index";
echo "\n";
// if (function_exists(xtranav)) xtranav();
// with an @ in front and the function not defined, just seemed to silently exit
$row=specialframe('xnav');
echo wikilinks($row['descr1']). " |
\n";
$cooch="{$_g['lkpren']}v{$mthbt}from={$_REQUEST['from']}&em2px=";
echo "
".
# \$_COOKIE['d3w_scale']={$_COOKIE['d3w_scale']}, ".
"\$_COOKIE['vpt_dims']={$_g['vpt_dims'][0]}×{$_g['vpt_dims'][1]}, ".
"\$_COOKIE['pathome']={$_COOKIE['pathome']}, ".
"\$_COOKIE['em2px']={$_COOKIE['em2px']} - ".
"$cooch". round(0.92*$_COOKIE['em2px'],1) ."'>more / ".
"$cooch". round(1.09*$_COOKIE['em2px'],1) ."'>less space for descriptions".
"
\n";
// ++++ ? contact me link
}
function ul_prev() // user format "previous" listing
{
global $_g;
$sres= do_query($_g['qs_pref'] .'and seqno < "'. $_REQUEST['to'] .
'" order by seqno desc limit '. ($_REQUEST['minth']-1) .',1');
$row = mysql_fetch_assoc($sres);
$_REQUEST['from']=$row['seqno'];
$_REQUEST['fmt']=chr(ord($_REQUEST['fmt'])+5); // q=>v
userlist();
}
function ul_fram() // user format listing starting from frame number
// g - go to frame - for use from postcard, etc. where we know the sequence
// and can do any "roll-back" we want
// h - go to first of descr1 break - for use from uploads, where all we have
// is a frameno
// f - same as g but unannotated (don't bother about unannoted h option)
{
global $_g, $minth;
$sres= do_query("{$_g['qs_pref']}and `{$_g['glrw']['table']}`.frameno>='". $_REQUEST['from'] .
"' order by `{$_g['glrw']['table']}`.frameno asc limit 1");
$row = mysql_fetch_assoc($sres);
$_REQUEST['from']=$row['seqno'];
if (($rbck=($_REQUEST['fmt']=='h'))!=FALSE) $_REQUEST['fmt']='g';
$_REQUEST['fmt']=chr(ord($_REQUEST['fmt'])+15); // f=>u
$minth=8;
userlist($rbck);
}
// -----------------
function index_link()
{
global $_g;
echo "
{$_g['lkpref']}e&minth={$_REQUEST['minth']}\" ".
"rel='nofollow'>Index
\n";
}
function asksrch() // crude, heavy text search
{
echo "
\n";
index_link();
}
function dosrch() // crude, heavy text search
{
global $_g, $edok;
$sres= do_query($_g['qs_pref'] .'order by seqno');
echo '
| Search for: '. $_REQUEST['qs'] .''.
" |
| listing link\n";
while (($row = mysql_fetch_assoc($sres))!=FALSE) {
$hit=FALSE; for ($j=1; $j<=3; $j++) {
$hit |= (stripos($row['descr'. $j],$_REQUEST['qs'])!==FALSE);
}
$hit |= (stripos($row['frameno'],$_REQUEST['qs'])!==FALSE);
if ($hit) {
echo ' |
';
do1img($row);
echo "".
" | {$_g['lkpref']}v&minth={$_REQUEST['minth']}&from={$row['seqno']}\">".
str_replace(' ',' ',$row['takenon']) .''. (!$edok ? "" :
" {$_g['lkpref']}j&obcurr=s&seqfrom={$row['seqno']}\">".
"edit") .'';
for ($j=1; $j<=3; $j++) { echo ' | '. wikilinks($row['descr'. $j]) .''; }
echo "\n";
}
}
echo " |
\n";
mysql_free_result($sres);
asksrch();
}
// -----------------
function edcont() // listing of counts within descr1 breaks to assist editing
{
global $_g;
$sres= do_query("{$_g['qs_pref']}order by seqno");
$jxa=0; $row = mysql_fetch_assoc($sres);
$des1=$row['descr1']; # unconditionally first time
while ($row!=FALSE) {
$newdes1=TRUE; $j2=0;
do {
$rowb1=$row; $desb1=$des1; $has_dup=false; $j1=0;
do {
ucoz_exists_check($row);
$j1++; $row = mysql_fetch_assoc($sres);
if ($prevseq==$row['seqno']) $has_dup=true;
$prevseq=$row['seqno'];
if (strlen($row['descr1'])) $des1=$row['descr1'];
$d1b = ($row==FALSE) || (strcmp($des1,$desb1)!=0); # descr1 break
} while ($j1<25 && !$d1b);
$j2+=$j1;
$xa[$jxa]['n']=$newdes1;
$xa[$jxa]['t']=
"
". ($has_dup ? "dup" : "") ."".
" | ". ($d1b ? $j2 : '') ."\n".
" | $j1 | ". ($j1>25 ? '**' : '') ."\n".
" | {$_g['lkpref']}j&obcurr=s&seqfrom={$rowb1['seqno']}\">e\n".
" | ".
"{$_g['lkpref']}v&minth={$_REQUEST['minth']}&from={$rowb1['seqno']}\">".
($newdes1 ? wikilinks($desb1,true) : 'ditto') ."\n";
$newdes1=FALSE; $dup_seen |= $has_dup; $jxa++;
} while (!$d1b);
}
echo "\n";
$jxz= $jxm= $jxa;
if ($jxz>20)
{ $jxm=(int)($jxz/2); while (!$xa[$jxm]['n'] && $jxm<$jxz) $jxm++; }
# mid point on newdes1 break
for ($jxa=0; $jxa<$jxz; $jxa++) {
if ($jxa==$jxm) echo " |
\n | \n";
if ($jxa==$jxm || !$jxa)
echo "\n | e | - link to edit page\n";
if ($xa[$jxa]['n']) echo " | \n";
echo $xa[$jxa]['t'];
}
echo " | \n\n".
" | | | \n".
(!$dup_seen ? "" :
" | dup = duplicate sequence number/s seen\n".
" | | | \n") .
"\n".
"{$_g['lkpref']}x&minth={$_REQUEST['minth']}\">Stitchable images ";
if ($_g['glrw']['ucoz']==1) {
echo " check ".
"source of this script for auto ubigx setting";
} else {
echo " missing/redundant 640px images ";
if (!$_g['glrw']['ucoz']) {
echo "redundant big images\n";
} elseif (isset($_COOKIE['pathome'])) {
echo "big image directory (possibility of developing redundancy check)\n";
} else {
echo "pathome cookie not set\n";
}
}
echo "\n";
mysql_free_result($sres);
}
?>
| |