示例#1
0
function f_getfromARow(&$aFields, $fieldSearched, $fieldSearchedValue, $getField = null, $mode = "")
{
    $nfield = 0;
    if (strpos($mode, "-friendly-") !== false) {
        $fieldSearchedValue = url_slug($fieldSearchedValue);
    }
    if (is_null($aFields)) {
        echo "<br>null aFields :";
        echo parse_backtrace(debug_backtrace());
        return "";
    }
    $existcol = get_param($mode, "existcol");
    foreach ($aFields as $key => $aField) {
        if (strpos($mode, "-debug-") !== false) {
            var_dump($aField);
        }
        $found = false;
        //echo parse_backtrace(debug_backtrace());
        if (array_key_exists($fieldSearched, $aField)) {
            $fieldValue = strpos($mode, "-friendly-") !== false ? url_slug($aField[$fieldSearched]) : $aField[$fieldSearched];
            if (strpos($mode, "-debug-") !== false) {
                echo "<br>{$nfield})  fieldValue:" . $fieldValue . " &nbsp;&nbsp;&nbsp;recup: " . $aField[$getField] . " ppp:" . $aField[0] . "<br>";
            }
            if (strpos($mode, "-trim-") !== false) {
                if ($fieldSearchedValue == $fieldValue) {
                    $found = true;
                }
            } else {
                if (trim($fieldSearchedValue) == trim($fieldValue)) {
                    $found = true;
                }
            }
        }
        if ($found && $existcol != "" && !array_key_exists($existcol, $aField)) {
            $found = false;
        }
        if ($found) {
            if (strpos($mode, "-debug-") !== false) {
                echo " ***encontrado.";
            }
            if ($getField === null) {
                return $aField;
            } elseif ($getField == -1) {
                return $key;
                //$nfield; // devuelva la fila donde está
            } else {
                if (array_key_exists($getField, $aField)) {
                    return $aField[$getField];
                } else {
                    return "";
                }
            }
        }
        $nfield++;
    }
    return "";
}
示例#2
0
function exceptions()
{
    global $call_trace;
    $r = Util::$restler;
    $source = $r->_exceptions;
    if (count($source)) {
        $source = end($source);
        $traces = array();
        do {
            $traces += $source->getTrace();
        } while ($source = $source->getPrevious());
        $traces += debug_backtrace();
        $call_trace = parse_backtrace($traces, 0);
    } else {
        $call_trace = parse_backtrace(debug_backtrace());
    }
}
function runner_error_handler($errno, $errstr, $errfile, $errline)
{
    global $strLastSQL;
    if ($errno == 2048) {
        return 0;
    }
    if ($errno == 8192) {
        if ($errstr == "Assigning the return value of new by reference is deprecated") {
            return 0;
        }
        if (strpos($errstr, "set_magic_quotes_runtime")) {
            return 0;
        }
    }
    if ($errno == 2 && strpos($errstr, "has been disabled for security reasons")) {
        return 0;
    }
    if ($errno == 2 && strpos($errstr, "Data is not in a recognized format")) {
        return 0;
    }
    if ($errno == 8 && !strncmp($errstr, "Undefined index", 15)) {
        return 0;
    }
    if (strpos($errstr, "It is not safe to rely on the system's timezone settings.")) {
        return 0;
    }
    if (strpos($errstr, "fopen(") === 0) {
        return 0;
    }
    // show error htm
    if (!class_exists("Xtempl")) {
        require_once getabspath("include/xtempl.php");
    }
    $xt = new Xtempl();
    $xt->assign('errno', $errno);
    $xt->assign('errstr', $errstr);
    $url = $_SERVER["SERVER_NAME"] . $_SERVER["SCRIPT_NAME"];
    if (array_key_exists("QUERY_STRING", $_SERVER)) {
        $url .= "?" . htmlspecialchars($_SERVER["QUERY_STRING"]);
    }
    $xt->assign('url', $url);
    $xt->assign('errfile', $errfile);
    $xt->assign('errline', $errline);
    $sqlStr = isset($strLastSQL) ? htmlspecialchars(substr($strLastSQL, 0, 1024)) : '';
    $xt->assign('sqlStr', $sqlStr);
    $debugInfoArr = parse_backtrace($errfile, $errline);
    $xt->assign_loopsection('debugRow', $debugInfoArr);
    $xt->display('error.htm');
    exit(0);
}
示例#4
0
文件: __vital.php 项目: vlad88sv/BCA
function DEPURAR($s, $f = 0)
{
    if ($f || isset($_GET['depurar'])) {
        echo '<pre>' . $s . '</pre><br /><pre>' . parse_backtrace() . '</pre><br />';
    }
}