コード例 #1
0
function validatePDF_callback($file_data, $valid, $magic, $fileID)
{
    $file_size = strlen($file_data);
    global $DEBUG;
    if ($DEBUG) {
        informAdmin("DEBUG validatePDF_callback.php: called validatePDF_callback( <binary>, {$valid}, {$magic}, {$fileID} )");
    }
    // sanitize all parameters
    $fileID = intval($fileID);
    $magic = intval($magic);
    if ($valid) {
        $valid = 1;
    } else {
        $valid = 0;
    }
    // put result into database
    $err_message = "validatePDF_callback(): ";
    $db = adodb_connect();
    // FIXME: fix declaration of adodb_connect() to include the reference (&) symbol!
    if ($db) {
        $file_data = $db->qstr($file_data);
        // escape binary
        $sql = "UPDATE " . $GLOBALS["DB_PREFIX"] . "File_report SET File={$file_data}, FileSize={$file_size}, DateTime=NOW(), Valid={$valid} WHERE FileID = {$fileID} AND Magic = {$magic}";
        if (!$db->Execute($sql)) {
            informAdmin("{$err_message} executing SQL query:\n" . $db->MetaErrorMsg($db->MetaError()));
        }
    } else {
        informAdmin("{$err_message} \$db is invalid\n" . $db->MetaErrorMsg($db->MetaError()));
    }
}
コード例 #2
0
ファイル: validatePDF.php プロジェクト: alexzita/alex_blog
function userErrorHandler($errno, $errmsg, $filename, $linenum, $vars)
{
    $errortype = array(E_ERROR => 'Error', E_WARNING => 'Warning', E_PARSE => 'Parsing Error', E_NOTICE => 'Notice', E_CORE_ERROR => 'Core Error', E_CORE_WARNING => 'Core Warning', E_COMPILE_ERROR => 'Compile Error', E_COMPILE_WARNING => 'Compile Warning', E_USER_ERROR => 'User Error', E_USER_WARNING => 'User Warning', E_USER_NOTICE => 'User Notice', E_STRICT => 'Runtime Notice', E_RECOVERABLE_ERROR => 'Catchable Fatal Error');
    $user_errors = array(E_USER_ERROR, E_USER_WARNING, E_USER_NOTICE);
    $err = "userErrorHandler() called.\n\n";
    $err .= "<errorentry>\n";
    $err .= "\t<datetime>" . date("Y-m-d H:i:s (T)") . "</datetime>\n";
    $err .= "\t<errornum>" . $errno . "</errornum>\n";
    $err .= "\t<errortype>" . $errortype[$errno] . "</errortype>\n";
    $err .= "\t<errormsg>" . $errmsg . "</errormsg>\n";
    $err .= "\t<scriptname>" . $filename . "</scriptname>\n";
    $err .= "\t<scriptlinenum>" . $linenum . "</scriptlinenum>\n";
    if (in_array($errno, $user_errors)) {
        $err .= "\t<vartrace>" . wddx_serialize_value($vars, "Variables") . "</vartrace>\n";
    }
    $err .= "</errorentry>\n\n";
    if ($errno != E_WARNING && $errno != E_NOTICE && $errno != E_STRICT) {
        informAdmin($err);
    }
}