USE AT OWN RISK
Generated: Tue Jul 31 15:22:12 2007 from phpinc.php 2005/08/07 14.1 KB bytes.
<?php // phpinc.php ... function, variable, include file, for img?????.php series // created: 7 August, 2005 - grm // set the TABLE items ... if (($m_row_wrap == 3) || ($m_row_wrap == 5)) { $m_td_wid = ' <td width="160">'; $m_img_wid = ' width="160" height="120"'; $m_table = '<table border="2" cellpadding="2" cellspacing="2" width="480">'; } else { $m_td_wid = ' <td width="120">'; $m_img_wid = ' width="120" height="90"'; $m_table = '<table border="2" cellpadding="2" cellspacing="2" width="720">'; } // function isMyFile( $file, $cls ) // file name of form 'temp' + single-letter [a,b,c...] + number 0000 form + '.jpg' // ******************************************************************************* function isMyFile( $file, $cls ) { $ln = strlen($file); if($ln >= (4+1+4+1+3)) { $pos = strrpos($file,"."); $exten = substr($file,($pos+1)); if( ( substr($file,-4,4) == '.jpg' ) && ( substr($file,0,4) == 'temp' ) ) { if( $cls == '?' ) { // return all 'temp?????.jpg' files return 1; } elseif( $cls == substr($file,4,1) ) { // get 'a', 'b', 'c', ... , 's' (sunset 60) // got our TYPE return 1; } // got class, day, set } // got 'temp' part } // get length return 0; } function isMyDSC ( $file ) { $ln = strlen($file); if($ln >= (3+4+1+3)) { $pos = strrpos($file,"."); $exten = substr($file,($pos+1)); if( ( strtolower(substr($file,-4,4)) == '.jpg' ) && ( strtolower(substr($file,0,3)) == 'dsc' ) ) { // got our TYPE return 1; } // got 'DSC' and '.JPG' parts } // get length return 0; } // function outOrderList ( $imx, $got_ord, $m_mostarr, $row_wrap, $max_out ) { function outOrderList ( $imx, $got_ord, $m_mostarr ) { global $m_row_wrap, $m_max_out; global $m_td_wid, $m_img_wid, $m_table; // like = ' width="160" height="120"'; $imx2 = $imx; // copy count $td_wid = $m_td_wid; // ' <td width="160">'; $img_wid = $m_img_wid; // ' width="160" height="120"'; $row_wrap = $m_row_wrap; $max_out = $m_max_out; if( $got_ord ) { $mx_ord = $max_out; if( $mx_ord == -1 ) { $mx_ord = $imx; } $got_ord = 0; print "<div align=\"center\">\r\n"; print "<center>\r\n"; // print "<table border=\"2\" cellpadding=\"2\" cellspacing=\"2\" width=\"480\">\r\n"; print "$m_table\r\n"; while($imx2) { for($i = 0; $i < $imx; $i++) { $arr = $m_mostarr[$i]; // extract array if( $arr[3] == $imx2 ) { // found current order $date = date("F d Y H:i:s.", $arr[1]); $a_msg = ''; $a_msg .= $arr[0] . ' '; $a_msg .= $date . ' '; // = date("F d Y H:i:s.", $arr[1]) . ' '; $a_msg .= " $arr[2]"; $a_msg .= " $arr[3]"; $m_msg = ''; if(($got_ord % $row_wrap) == 0) { $m_msg .= " <tr>"; } $m_msg .= $td_wid; // $m_msg .= "<font size=\"-2\">"; $m_msg .= "<img src=\"$arr[4]\" alt=\"$a_msg\""; $m_msg .= $img_wid; // like = " width=\"160\" height=\"120\"" $m_msg .= ">"; $m_msg .= "<font size=\"-2\">"; $m_msg .= "<br>"; // $m_msg .= "<font size=\"-2\">"; $m_msg .= $arr[0]; // like, temp?nnnn.jpg $m_msg .= ' ' . date("H:i:s", $arr[1]); //$m_msg .= " $date"; //$m_msg .= $a_msg; $m_msg .= "</font>"; $m_msg .= " </td>"; $got_ord++; if(($got_ord % $row_wrap) == 0) { $m_msg .= " </tr>"; } print "$m_msg\r\n"; break; } } $imx2--; if($got_ord >= $mx_ord) { break; } } // fill in any missing SET-OF-????? while( $got_ord % $row_wrap ) { $m_msg = $td_wid; // = say ' <td width="160">'; $m_msg .= 'no image'; $m_msg .= ' </td>'; $got_ord++; if(($got_ord % $row_wrap) == 0) { $m_msg .= " </tr>"; } print "$m_msg\r\n"; } print "</table>\n"; print "</center>\r\n"; print "</div>\r\n"; } } function getDirList2 ($dirName, $mostrec, $mostnam, $mostcnt, $mostarr, $typ ) { $d = dir($dirName); // note, with '/.' added // build up a LIST of directories, and files, in this folder while($entry = $d->read()) { //$locpath = $dirName."/".$entry; $locpath = substr($dirName,0,(strlen($dirName)-1)).$entry; if ($entry != "." && $entry != "..") { if (is_dir($locpath)) { $dirlist[] = $entry; } else { $fillist[] = $entry; } } } $d->close(); if (isset($fillist)) { asort($fillist); foreach ($fillist as $fil) { // $locpath = $dirName."/".$fil; // note: dir name ends with '/.', guaranteed!!! $locpath = substr($dirName,0,(strlen($dirName)-1)).$fil; $size = filesize($locpath); $filtm = filemtime($locpath); if( isMyFile( $fil, $typ ) ) { $arr = array(); $arr[] = $fil; // 'temp' + class + number[1-9999] + '.jpg' $arr[] = $filtm; // keep the file time $arr[] = $size; // keep file size $arr[] = 0; // sort order ... done later ... on $filtm value $arr[] = $locpath; // keep WHOLE (relative) name // ================================================== $mostarr[] = $arr; // keep the files that MATCH class $mostcnt++; // bump COUNT if( $filtm > $mostrec ) { $mostrec = $filtm; $mostnam = $fil; } } } } } // end func getDirList2 ($dir, $rec, $nam, $cnt, $arr, $typ ) function outOrderListDSC ( $imx, $got_ord, $m_mostarr ) { global $m_row_wrap, $m_max_out; global $m_td_wid, $m_img_wid, $m_table; // like = ' width="160" height="120"'; $imx2 = $imx; // copy count $td_wid = $m_td_wid; // ' <td width="160">'; $img_wid = $m_img_wid; // ' width="160" height="120"'; $row_wrap = $m_row_wrap; $max_out = $m_max_out; if( $got_ord ) { $mx_ord = $max_out; if( $mx_ord == -1 ) { $mx_ord = $imx; } $got_ord = 0; print "<div align=\"center\">\r\n"; print "<center>\r\n"; // print "<table border=\"2\" cellpadding=\"2\" cellspacing=\"2\" width=\"480\">\r\n"; print '<table border="2" cellpadding="2" cellspacing="2" width="720">'; // print "$m_table\r\n"; while($imx2) { for($i = 0; $i < $imx; $i++) { $arr = $m_mostarr[$i]; // extract array if( $arr[3] == $imx2 ) { // found current order $date = date("F d Y H:i:s.", $arr[1]); $a_msg = ''; $a_msg .= $arr[0] . ' '; $a_msg .= $date . ' '; // = date("F d Y H:i:s.", $arr[1]) . ' '; $a_msg .= " $arr[2]"; $a_msg .= " $arr[3]"; $m_msg = ''; if(($got_ord % $row_wrap) == 0) { $m_msg .= " <tr>"; } $m_msg .= $td_wid; // $m_msg .= "<font size=\"-2\">"; $m_msg .= '<center>'; $m_msg .= "<img src=\"$arr[4]\" alt=\"$a_msg\""; // or NONE actual image size $m_msg .= $img_wid; // like = " width=\"160\" height=\"120\"" $m_msg .= ">"; $m_msg .= "<font size=\"-2\">"; $m_msg .= "<br>"; // $m_msg .= "<font size=\"-2\">"; $m_msg .= $arr[0]; // like, temp?nnnn.jpg $m_msg .= ' ' . date("H:i:s", $arr[1]); //$m_msg .= " $date"; //$m_msg .= $a_msg; $m_msg .= "</font>"; $m_msg .= '</center>'; $m_msg .= " </td>"; $got_ord++; if(($got_ord % $row_wrap) == 0) { $m_msg .= " </tr>"; } print "$m_msg\r\n"; break; } } $imx2--; if($got_ord >= $mx_ord) { break; } } // fill in any missing SET-OF-????? while( $got_ord % $row_wrap ) { $m_msg = $td_wid; // = say ' <td width="160">'; $m_msg .= 'no image'; $m_msg .= ' </td>'; $got_ord++; if(($got_ord % $row_wrap) == 0) { $m_msg .= " </tr>"; } print "$m_msg\r\n"; } print "</table>\n"; print "</center>\r\n"; print "</div>\r\n"; } } function getDirListDSC ($dirName, $mostrec, $mostnam, $mostcnt, $mostarr, $typ ) { $path = substr($dirName,0,(strlen($dirName)-1)); $d = dir($dirName); // note, with '/.' added // build up a LIST of directories, in this folder ... while($entry = $d->read()) { //$locpath = $dirName."/".$entry; $locpath = $path.$entry; if ($entry != "." && $entry != "..") { if (is_dir($locpath)) { $ln = strlen( $entry ); if ($ln > 4 ) { if ( strtolower(substr($entry,0,4)) == 'page' ) { $dirlist[] = $entry; } } //else { // $fillist[] = $entry; //} } } } $d->close(); if (isset($dirlist)) { asort($dirlist); // we have some 'page'???? directories, folders foreach ($dirlist as $dir) { $locpath = $path . $dir . '/.'; $d = dir($locpath); while ($entry = $d->read()) { if ($entry != "." && $entry != "..") { $locpath = $path . $dir . '/' . $entry; if (is_file ($locpath)) { if (isMyDSC( $entry )) { $fillist[] = $entry; $size = filesize($locpath); $filtm = filemtime($locpath); $arr = array(); $arr[] = $entry; // 'DSC' + number[1-99999] + '.JPG' $arr[] = $filtm; // keep the file time $arr[] = $size; // keep file size $arr[] = 0; // sort order ... done later ... on $filtm value $arr[] = $locpath; // keep WHOLE (relative) name // ================================================== $mostarr[] = $arr; // keep the files that MATCH class $mostcnt++; // bump COUNT if( $filtm > $mostrec ) { $mostrec = $filtm; $mostnam = $entry; } } } } } $d->close(); // close this sub-directory } // end for each 'page' folder } // got some 'page'???? folders } // end func getDirListDSC ($dir, $rec, $nam, $cnt, $arr, $typ ) // ***************************************************************************************** function ordDirListDSC () { global $m_mostrec, $m_mostarr, $m_mostcnt, $m_folder, $m_mostnam, $m_max_out, $m_type; // did we collect the files we need ... if( $m_mostrec > 0 ) { $imx = count( $m_mostarr ); // get COUNT of FOUND ITEMS - full list of arrays $imx2 = $imx; // copy count $got_ord = 1; // SORT the array of files, per their FILETIME // interate, finding the most recent, non-ordered, each time while($imx2) { // set order to N, N-1, N-2, ..., 1 ... note 1 is last $ft = 0; // start with zero time $idx = $imx; for($i = 0; $i < $imx; $i++) { $arr = $m_mostarr[$i]; // extract array if( $arr[3] == 0 ) { if( $arr[1] > $ft ) { // if later $ft = $arr[1]; // get it, $idx = $i; // keeping the index to it } } } if( $idx < $imx ) { // found highest, latest $arr = $m_mostarr[$idx]; // extract array, of file things $arr[3] = $imx2; // set ORDER $m_mostarr[$idx] = $arr; // replace array, with value update // print "<p>Set order $arr[3]!</p>\r\n"; } else { print "<p>No order! Internal error, or filetime is ZERO!</p>\r\n"; $got_ord = 0; } $imx2--; } // outOrderList ( $imx, $got_ord, $m_mostarr, 3, 9 ); // outOrderList ( $imx, $got_ord, $m_mostarr, 6, $imx ); outOrderListDSC ( $imx, $got_ord, $m_mostarr ); $m_msg = "<p>Found $imx ($m_mostcnt) files, temp series "; $m_msg .= ($m_type == '?') ? 'ALL' : $m_type; $m_msg .= " jpg in $m_folder ... "; $m_msg .= "Most recent: $m_mostnam "; $m_msg .= date("F d Y H:i:s.", $m_mostrec); $m_msg .= " ($m_mostrec) max_out="; $m_msg .= ($m_max_out == -1) ? 'ALL' : $m_max_out; $m_msg .= "...</p>"; print "$m_msg\r\n"; } else { $m_msg = "<p>No most recent found using $m_folder ...</p>"; print "$m_msg\r\n"; } } // end ordDirListDSC() // ***************************************************************************************** function ordDirList2 () { global $m_mostrec, $m_mostarr, $m_mostcnt, $m_folder, $m_mostnam, $m_max_out, $m_type; // did we collect the files we need ... if( $m_mostrec > 0 ) { $imx = count( $m_mostarr ); // get COUNT of FOUND ITEMS - full list of arrays $imx2 = $imx; // copy count $got_ord = 1; // SORT the array of files, per their FILETIME // interate, finding the most recent, non-ordered, each time while($imx2) { // set order to N, N-1, N-2, ..., 1 ... note 1 is last $ft = 0; // start with zero time $idx = $imx; for($i = 0; $i < $imx; $i++) { $arr = $m_mostarr[$i]; // extract array if( $arr[3] == 0 ) { if( $arr[1] > $ft ) { // if later $ft = $arr[1]; // get it, $idx = $i; // keeping the index to it } } } if( $idx < $imx ) { // found highest, latest $arr = $m_mostarr[$idx]; // extract array, of file things $arr[3] = $imx2; // set ORDER $m_mostarr[$idx] = $arr; // replace array, with value update // print "<p>Set order $arr[3]!</p>\r\n"; } else { print "<p>No order! Internal error, or filetime is ZERO!</p>\r\n"; $got_ord = 0; } $imx2--; } // outOrderList ( $imx, $got_ord, $m_mostarr, 3, 9 ); // outOrderList ( $imx, $got_ord, $m_mostarr, 6, $imx ); outOrderList ( $imx, $got_ord, $m_mostarr ); $m_msg = "<p>Found $imx ($m_mostcnt) files, temp series "; $m_msg .= ($m_type == '?') ? 'ALL' : $m_type; $m_msg .= " jpg in $m_folder ... "; $m_msg .= "Most recent: $m_mostnam "; $m_msg .= date("F d Y H:i:s.", $m_mostrec); $m_msg .= " ($m_mostrec) max_out="; $m_msg .= ($m_max_out == -1) ? 'ALL' : $m_max_out; $m_msg .= "...</p>"; print "$m_msg\r\n"; } else { $m_msg = "<p>No most recent found using $m_folder ...</p>"; print "$m_msg\r\n"; } } // end ordDirList2() function out_the_menu2 () { $eol = "\r\n"; print '<p align="center">'.$eol; print '<span style="background-color: #FFFFFF">'.$eol; print '|* <a href="index.html">'.$eol; print 'index</a> *|* <a href="imagea9.php">'.$eol; print 'Friday(a)</a> *|* <a href="imageb9.php">'.$eol; print 'Saturday(b)</a> *|* <a href="imagec9.php">'.$eol; print 'Sunday(c)</a> *|* <a href="imaged9.php">'.$eol; print 'Other(d)</a> *|* <a href="images9.php">'.$eol; print 'Special(s)</a> *|* <a href="imgall.php">'.$eol; print 'All</a> *|* <a href="imgall9.php">'.$eol; print 'All-9</a> *|* <a href="imgall15.php">'.$eol; print 'All-15</a> *|* <a href="imgall21.php">'.$eol; print 'All-21</a> *|* <a href="imgall28.php">'.$eol; print 'All-28</a> *|* <a href="famall.php">'.$eol; print 'Family</a> *|'.$eol; print '</span>'.$eol; print '</p>'.$eol; } // end out_menu() ?>