PDO::ERRMODE_EXCEPTION, PDO::MYSQL_ATTR_INIT_COMMAND => "SET NAMES utf8mb4", ] ); // newest completed CA entry (via view) $sql = " SELECT model_year, model, ADM_StateOrProvince, ADM_Country, condition_value, opinion_value_today FROM h305_ca77_entries ORDER BY submitdate DESC, id DESC LIMIT 1 "; $row = $pdo->query($sql)->fetch(PDO::FETCH_ASSOC); // casing helpers (same pattern as CB / CL) $keepCaps = static function (string $w): bool { return (bool)preg_match('/[A-Z]{2,}/', $w) || (bool)preg_match('/\d/', $w); }; $word = static function (?string $w) use ($keepCaps): string { if ($w === null || $w === '') return ''; if (strpos($w, '-') !== false) { $parts = explode('-', $w); foreach ($parts as &$x) { $x = $keepCaps($x) ? $x : ucfirst(strtolower($x)); } return implode('-', $parts); } if ($keepCaps($w)) return $w; $dot = substr($w, -1) === '.'; $base = $dot ? substr($w, 0, -1) : $w; $done = ucfirst(strtolower($base)); return $dot ? ($done . '.') : $done; }; $title = static function (?string $s) use ($word): string { if ($s === null) return ''; $s = trim($s); if ($s === '') return ''; $t = preg_split('/\s+/', $s) ?: []; foreach ($t as &$x) $x = $word($x); return trim(implode(' ', $t), ", "); }; if (!$row) { $line = 'Latest Registry Entry: No completed entries found.'; } else { // location like "WA, Australia" $region = $title($row['ADM_StateOrProvince'] ?? ''); $country = $title($row['ADM_Country'] ?? ''); $loc = trim( implode(', ', array_filter([$region, $country], fn($v) => $v !== '')), ', ' ); // normalize opinion_value_today using the same rules as CL: // - >=1000 => use as-is ($12500 => $12,500) // - 100..999 => treat as dollars ($750 => $750) // - 1..99 => treat as thousands (6 => $6,000) // - otherwise => "Not Entered" $valFinal = 'Not Entered'; if (isset($row['opinion_value_today']) && $row['opinion_value_today'] !== '') { $n = (float)$row['opinion_value_today']; if ($n >= 1000) { $valFinal = '$' . number_format($n, 0); } elseif ($n >= 100) { $valFinal = '$' . number_format($n, 0); } elseif ($n > 0) { $valFinal = '$' . number_format($n * 1000, 0); } } // condition code translation — same dictionary as CL plus "Rat" $condRaw = $row['condition_value'] ?? ''; $condMap = [ 'E' => 'Excellent', 'Exc' => 'Excellent', 'G' => 'Good', 'Goo' => 'Good', 'F' => 'Fair', 'P' => 'Poor', 'Par' => 'Parts Bike', 'R' => 'Restored', 'Res' => 'Restored', 'Rat' => 'Rat', ]; $condNice = $condMap[$condRaw] ?? ($condRaw !== '' ? $condRaw : 'Not Entered'); $line = 'Latest Registry Entry: ' . ($row['model_year'] ?? '') . ' Honda ' . ($row['model'] ?? '') . ' — ' . $loc . ' — Condition: ' . $condNice . ' — Value: ' . $valFinal; } // stamp + UTF-8 $built = (new DateTime('now'))->format('Y-m-d H:i:s T'); $stamp = ""; $charset = ''; $html = $charset . "\n" . $stamp . "\n" . $line . "\n"; // write to shared include $jobDir = __DIR__; $includeDir = '/home/mstoic3/public_html/shared/include'; $includeTmp = $includeDir . '/latest_ca77.tmp'; $includeDst = $includeDir . '/latest_ca77.html'; $jsonPath = $jobDir . '/latest_ca77.json'; $logPath = $jobDir . '/logs/latest_ca77.log'; // future optional if (!is_dir($includeDir)) { if (!mkdir($includeDir, 0755, true) && !is_dir($includeDir)) { throw new RuntimeException("Failed to create include dir: $includeDir"); } } if (file_put_contents($includeTmp, $html, LOCK_EX) === false) { throw new RuntimeException('Failed to write temp include file'); } if (!rename($includeTmp, $includeDst)) { @unlink($includeTmp); throw new RuntimeException('Failed to move include into place'); } @file_put_contents($jsonPath, json_encode([ 'line' => $line, 'stamp' => $built, 'ts' => date('c'), ], JSON_UNESCAPED_UNICODE)); echo "OK\n"; } catch (Throwable $e) { error_log("[generate_latest_ca77.php] " . $e->getMessage()); if (function_exists('http_response_code')) { @http_response_code(500); } echo "ERROR\n"; exit(1); }

Search found 9 matches

by tippinwa
Sat Oct 31, 2009 10:07 am
Forum: Restoration Projects
Topic: I have a blinker problem...
Replies: 21
Views: 13585

My blinker problem

I'm not going to jump. Well, not untill I push this bike off first. Thanks for the suggestion, I'll do that next. Yesterday, thinking there could be a problem with the wires connecting into the key-switch. So, I removed the switch and one-at-a-time I removed the wires on each post and cleaned them w...
by tippinwa
Fri Oct 30, 2009 5:40 pm
Forum: Restoration Projects
Topic: I have a blinker problem...
Replies: 21
Views: 13585

My blinker problem

That motercycle is really not cooperating. I have made some progress I guess, but the problem is not nearly resolved. I removed each turn indicator housing and cleaned the base to ensure a good ground and then I tested the ground with a meter. All tested good. Next as suggested, I ran a jumper from ...
by tippinwa
Wed Oct 28, 2009 2:47 pm
Forum: Restoration Projects
Topic: I have a blinker problem...
Replies: 21
Views: 13585

My blinker problem

Thanks, I will do that. As soon as I connect the wires and get a result, I'll post it. I really appreciate your advice. I was drawing a total blank, and so its good to at least have a direction. More tomorrow (I hope)...
by tippinwa
Wed Oct 28, 2009 9:51 am
Forum: Restoration Projects
Topic: I have a blinker problem...
Replies: 21
Views: 13585

My blinker problem

Everything on the bike is original, including the handlebar indicator switch. However, the wires have different colors than any schematic I have found. The problem is that Honda made two CL's, one domestic, and one for export. Like the idiot that I am, I flew to Japan in 1967 from Anchorage and whil...
by tippinwa
Tue Oct 27, 2009 4:18 pm
Forum: Restoration Projects
Topic: I have a blinker problem...
Replies: 21
Views: 13585

My blinker problem

OK, I took two steps forward, and one back. I employed the suggestion of jumping from the battery positive directly to the turn indicator light. The RR came on bright and steady, but none of the others would as I tested them individually. I determined the problem was "no ground" on the RF, LF, and L...
by tippinwa
Tue Oct 27, 2009 10:08 am
Forum: Restoration Projects
Topic: I have a blinker problem...
Replies: 21
Views: 13585

My blinker problem

I haven't forgotton, it's just that something came up yesterday that took me away from my workshop. Today it's raining, so that makes it a good day to trace that wiring problem, starting with putting the wire from the battery positive to each indicator wire to see what happens. More this afternoon....
by tippinwa
Sun Oct 25, 2009 9:17 pm
Forum: Restoration Projects
Topic: I have a blinker problem...
Replies: 21
Views: 13585

Thanks, those are good suggestions. Tomorrow I will run a direct jumper to the positive of each turn indicator from the battery positive to see if they work. I really appreciate all the help - this is a mystery. There is no logical reason why three of the indicators do not work, even if I run a jump...

Go to advanced search