Keys →
Functions ↓
function abend ( $msg='', $twit = 4, $str='' ) {#-k VOTD debug#- VOTD abend routine#- here to send twitter msg to tell me votd is dead# $twit = 0 - no Twitter, no DB update - failed at start# 1 - send twitter, can't update DB 'coz problem# 2 - send twitter, update DB# 3 - no Twitter, update DB (no action - good completion)# 4 - debug - no Twitter, no DB# $str if present, list any line that has this string on it global $sq, $Rid, $Did, $acnt, $rcnt, $vcnt, $twu, $twp; $l = ''; if (strlen($str)) { # if this param active, dump the lines that have this string $file = substr ($_SERVER["SCRIPT_NAME"],1); $line = file ( $file ); foreach ( $line as $i => $lin ) { if (strpos ( ' '. $lin, $str, 1 ) ) { $l .= ', ' . ($i+1); } } if (strlen($l)) { $l = substr($l,2); if (strpos($l,',')) { $l = ' @ lines ' . $l; } else { $l = ' @ line ' . $l; } } } if (($twit == 2) or ($twit == 3)) { updateFails (); } if (isset($sq['e']) && $sq['e']) prt ( $sq['e'] . ' [' . $sq['f'] . '] ' . $sq['err'] ); switch ($twit) { case '0': # do nothing $msg1 = "\n ...Abend..." . stackPlace () . " =============<br>\n ...Abend...[" . $twit . $l . ']: ' . $msg . '<br>'; break; case '1': # Twitter only $msg1 = ' =============<br>[Abend: ' . $twit . $l . ']: ' . $msg . '<br>'; postToTwitterDirect ( $twu[0], $twp, $msg, 'swggy' ); prt ( stackTrace () ); break; case '2': # DB & Twitter $msg1 = ' =============<br>[Abend: ' . $twit . $l . ']: ' . $msg . '<br>'; updateLastPos ( date ( "Y-m-d H:i:s" ) ); if ($sq['e']) prt ( $sq['e'] . ' [' . $sq['f'] . '] ' . $sq['err'] ); postToTwitterDirect ( $twu[0], $twp, $msg, 'swggy' ); prt ( stackTrace () ); break; case '3': # DB only; clean finish $msg1 = ' =============<br>' . $msg . '<br>'; updateLastPos ( date ( "Y-m-d H:i:s" ) ); if ($sq['e']) prt ( $sq['e'] . ' [' . $sq['f'] . '] ' . $sq['err'] ); break; case '4': # debug default: $msg1 = '=============<br>[Abend: ' . $l . ']: ' . $msg . '<br>'; prt ( stackTrace () ); break; } prt ( $msg1 ); die (); }?>