3 function match_entrytitle( $line1 )
5 preg_match_all( "{^\s*<b>(.*)</b>\s*$}m", $line1, $matches );
6 return join('; ', $matches[1]);
9 function get_entrytitle( $when, $day )
11 $file = file( "$when/$day" );
12 return match_entrytitle( join('', $file) );
15 function do_entrycontent( $when, $day )
22 $entrylines = array( "<!-- start of entry $when/$day -->\n" );
24 $file = file( "$when/$day" );
25 // if ( match_entrytitle( $file[0] ) ) $file[0] = "";
27 foreach( $file as $line ) {
28 if( substr( $line, 0, 6 ) === 'image ' ) {
29 $num = substr( $line, 6, 4 );
30 $caption = substr( $line, 10 );
31 $httpdir = "../$topdir/$when";
33 $lg = "img_$num"."_lg.jpg";
34 $sm = "img_$num"."_sm.jpg";
35 if( !file_exists( "$when/$lg" ) )
36 $lg = "img_$num"."_800.jpg";
37 if( !file_exists( "$when/$sm" ) )
38 $sm = "img_$num"."_400.jpg";
40 if( file_exists( "$when/$sm" ) ) {
41 $big = file_exists( "$when/$lg" );
42 $link1 = $big ?
"<a href=\"$httpdir/$lg\">" : "";
43 $link2 = $big ?
"</a>" : "";
44 array_push( $entrylines,
45 "<center><table border=0>" .
46 "<tr><td align=center>$link1<img " .
47 "border=0 src=\"$httpdir/$sm\" " .
48 "alt=\"[image]\">$link2<br>\n" .
49 "<i>$caption</i></td></tr></table></center>\n" );
53 } elseif( substr( $line, 0, 9 ) === 'pngimage ' ) {
54 $num = substr( $line, 9, 4 );
55 $caption = substr( $line, 13 );
56 $httpdir = "../$topdir/$when";
58 $lg = "img_$num"."_lg.png";
59 $sm = "img_$num"."_sm.png";
60 if( !file_exists( "$when/$lg" ) )
61 $lg = "img_$num"."_800.png";
62 if( !file_exists( "$when/$sm" ) )
63 $sm = "img_$num"."_400.png";
65 if( file_exists( "$when/$sm" ) ) {
66 $big = file_exists( "$when/$lg" );
67 $link1 = $big ?
"<a href=\"$httpdir/$lg\">" : "";
68 $link2 = $big ?
"</a>" : "";
69 array_push( $entrylines,
70 "<center><table border=0>" .
71 "<tr><td align=center>$link1<img " .
72 "border=0 src=\"$httpdir/$sm\" " .
73 "alt=\"[image]\">$link2<br>\n" .
74 "<i>$caption</i></td></tr></table></center>\n" );
78 } elseif( substr( $line, 0, 8 ) === 'imglink ' ) {
79 $num = substr( $line, 8, 4 );
80 $caption = substr( $line, 12 );
81 $httpdir = "../$topdir/$when";
83 $sm = "img_$num"."_sm.jpg";
84 $lg = "img_$num"."_lg.jpg";
86 if( !file_exists( "$when/$sm" ) )
87 $sm = "img_$num"."_800.jpg";
89 $havehuge = file_exists( "$when/$hg" );
90 $havebig = file_exists( "$when/$lg" );
91 $havesmall = file_exists( "$when/$sm" );
96 $tmp .= "<a href=\"$httpdir/img_$num.jpg\">huge</a>";
102 $tmp .= "<a href=\"$httpdir/$lg\">big</a>";
108 $tmp .= "<a href=\"$httpdir/$sm\">small</a>";
111 array_push( $entrylines, "$tmp—$caption<br>\n" );
114 } elseif( substr( $line, 0, 6 ) === 'thumb ' ) {
115 $num = substr( $line, 6, 4 );
116 $httpdir = "../$topdir/$when";
118 $th = "img_$num"."_th.jpg";
119 if( file_exists( "$when/$th" ) ) {
121 $sizebit = "&size=$size";
123 array_push( $entrylines,
124 "<a name=\"$num\">" .
125 "<a href=\"img.php?num=$num&when=$when&day=$day" .
127 "<img border=0 src=\"$httpdir/$th\"></a>\n" );
131 } elseif( substr( $line, 0, 2 ) === '- ' ) {
133 if( $inlist == false ) {
138 if( $needbr == true ) {
142 array_push( $entrylines,
143 "$tmp<li>" . substr( $line, 2 ) . "</li>\n" );
146 } else if( strlen( $line ) <= 1 ) {
150 array_push( $entrylines, "<p>\n" );
154 if( $inlist == true ) {
155 array_push( $entrylines, "</ul>\n" );
160 array_push( $entrylines, $line );
163 array_push( $entrylines, "<!-- end of entry $when/$day -->\n" );
165 return( $entrylines );