Exemplo n.º 1
0
function nuRunQuery($s, $a = array(), $isInsert = false)
{
    global $DBHost;
    global $DBName;
    global $DBUser;
    global $DBPassword;
    global $nuDB;
    if ($s == '') {
        $a = array();
        $a[0] = $DBHost;
        $a[1] = $DBName;
        $a[2] = $DBUser;
        $a[3] = $DBPassword;
        return $a;
    }
    $object = $nuDB->prepare($s);
    try {
        $object->execute($a);
    } catch (PDOException $ex) {
        $user = nuV('nu_user_name');
        $message = $ex->getMessage();
        $array = debug_backtrace();
        $trace = '';
        for ($i = 0; $i < count($array); $i++) {
            $trace .= $array[$i]['file'] . ' - line ' . $array[$i]['line'] . ' (' . $array[$i]['function'] . ")\n\n";
        }
        $debug = "\n===USER==========\n\n{$user}\n\n===PDO MESSAGE=== \n\n{$message}\n\n===SQL=========== \n\n{$s}\n\n===BACK TRACE====\n\n{$trace}\n\n";
        nuDebug($debug);
        $id = $nuDB->lastInsertId();
        if (nuV('nu_user_name') == 'globeadmin') {
            $GLOBALS['ERRORS'][] = $debug;
        } else {
            $GLOBALS['ERRORS'][] = "There has been an error on this page.\n Please contact your system administrator and quote the following number: {$id} ";
        }
        return -1;
    }
    if ($isInsert) {
        return $nuDB->lastInsertId();
    } else {
        return $object;
    }
}
Exemplo n.º 2
0
function nuGetSafePHP($field, $id, $value)
{
    $check = $id . '_' . $field;
    // check if site is using nuBuilderProSafeMode
    if ($_SESSION['SafeMode'] === true) {
        // don't bother looking for file if the 'id' is not in Safe List Array
        if (in_array($check, $_SESSION['SafePHP'])) {
            // construct full file and path
            $file = $id . '_' . $field;
            $full_file_and_path = dirname(__FILE__) . '/nusafephp/' . $file;
            // get file contents
            $contents = @file_get_contents($full_file_and_path);
            // check if file contents is false, normally means file does not exist or file permission issues
            if ($contents === false) {
                nuDebug("error accessing file data in {$full_file_and_path}");
                $contents = '';
            }
        } else {
            $contents = '';
        }
    } else {
        // return default value if not in safe mode
        $contents = $value;
    }
    return $contents;
}
Exemplo n.º 3
0
function nuHomeBug()
{
    $a = print_r($_SESSION['nu_form_access'], 1);
    $user = nuV('nu_user_name') . ' ( ' . nuV('call_type') . ' )';
    $array = debug_backtrace();
    $trace = '';
    for ($i = 0; $i < count($array); $i++) {
        $trace .= $array[$i]['file'] . ' - line ' . $array[$i]['line'] . ' (' . $array[$i]['function'] . ")\n\n";
    }
    $debug = "\n\n** HOME BUG\t**\n===USER==========\n\n{$user}\n\n===BACK TRACE====\n\n{$trace}\n\n===VARIABLE====\n\n{$a}\n\n\t";
    nuDebug($debug);
}