if ($debugging) { "New data merged into {$live_table} successfully.<br />" . $eol; } } else { $alerts_txt .= "Error inserting new data: " . mysql_error(); $log_file .= $alerts_txt . $eol; webadmin_alert($alerts_txt, $log_file); //Write to the log file fwrite($handle_log, $log_file); fclose($handle_log); exit; } } else { $alerts_txt .= "Live data not replaced. No records to import."; $log_file .= $alerts_txt . $eol; webadmin_alert($alerts_txt, $log_file); if ($debugging) { $alerts_txt . "<br />" . $eol; } } } $log_file .= "--------------------------------------------------------------" . $eol; //Write to the log file fwrite($handle_log, $log_file); fclose($handle_log); /* Close Db connection */ mysql_close($dbcnx); if ($debugging) { echo "<p>Debugging info:<br />\n"; echo "login url: {$rets_login_url}<br />\n"; echo "username: {$rets_username}<br />\n";
function photoCheck($abs_photos, $listingID) { //for($i=3;$i>=0;$i--) { if (!photo_exists($abs_photos, $listingID, 0)) { if (!photo_exists($abs_photos, $listingID, 1)) { if (!photo_exists($abs_photos, $listingID, 2)) { if (!photo_exists($abs_photos, $listingID, 3)) { // Download the photo from RETS $rets = connectRETS(); if ($rets == null) { $alerts_txt = "Could not connect to the RETS server."; webadmin_alert($alerts_txt); } else { $photos = $rets->GetObject("Property", "Photo", $listingID); foreach ($photos as $photo) { $number = $photo['Object-ID']; if ($photo['Success'] == true) { file_put_contents($abs_photos . $listingID . "_" . $number . ".jpg", $photo['Data']); } } } $rets->Disconnect(); $rets = null; //return "photo doesn't exist ($abs_photos,$listingID)"; return false; } } } } else { //return "photo exists"; return true; } }
echo "New data merged into {$live_table} successfully.<br />" . $eol; } } catch (PDOException $e) { $alerts_txt .= "Error inserting new data: " . $e->getMessage(); echo "Error inserting new data: " . $e->getMessage(); $log_file .= $alerts_txt . $eol; webadmin_alert($alerts_txt); //Write to the log file fwrite($handle_log, $log_file); fclose($handle_log); exit; } } else { $alerts_txt .= "Live data not replaced. No records to import."; $log_file .= $alerts_txt . $eol; webadmin_alert($alerts_txt); if ($debugging) { $alerts_txt . "<br />" . $eol; } } } $log_file .= "--------------------------------------------------------------" . $eol; //Write to the log file fwrite($handle_log, $log_file); fclose($handle_log); /* Close Db connection */ $dbcnx = null; if ($debugging) { echo "<p>Debugging info:<br />\n"; echo "login url: {$rets_login_url}<br />\n"; echo "username: {$rets_username}<br />\n";