Example #1
0
 function queryForEdit($date0, $date9, $where = '', $orderBy = '', $orderDirection = '')
 {
     $this->dbg('queryForEdit', "where={$where}");
     if (eregi('whoiswhere', $this->Database)) {
         return $this->queryForList($date0, $date9, $where, $orderBy, $orderDirection);
     }
     if (!$orderBy) {
         $orderBy = "ORDER BY accounts.full_name,travel.Leave";
     }
     #   if (!$orderBy) $orderBy = "ORDER BY travel.id,travel.Leave";
     if ($orderBy == 'date') {
         $orderBy = "ORDER BY travel.Leave";
     }
     $where = eregi_replace('login', 'accounts.username', $where);
     $this->query("SELECT " . "travel.*, " . "accounts.* " . "FROM travel " . "LEFT JOIN accounts ON accounts.id=travel.Id " . join(' ', array('WHERE', db_timeLimit('Leave', 'Return', $date0, $date9), $where, $orderBy, $orderDirection)));
     if ($recordCounter++ < 3) {
         core_dbgArray($row);
     }
 }
Example #2
0
 function show()
 {
     ksort($GLOBALS[$this->cacheID]);
     ksort($_SESSION[$this->cacheID]);
     if ($this->type == "g") {
         core_dbgArray($GLOBALS[$this->cacheID], $this->ID . "_GLOBALS", True, True);
     } else {
         core_dbgArray($_SESSION[$this->cacheID], $this->ID . "_SESSION", True, True);
     }
 }
Example #3
0
function core_dbgArray($r, $name = '', $forced = 0, $showEmptyValues = False, $showNumIndex = False)
{
    global $prevDbg, $core_tableDbg;
    if (!$r) {
        return;
    }
    if (!$forced && !core_getOption('debug')) {
        return;
    }
    if (!$name) {
        $name = 'dbgArray';
    }
    $prevDbg = '?';
    $core_dbgSV2 = core_getOption('debug');
    core_setOption('debug', $forced, $forced);
    for ($pass = 0; $pass < 2; $pass++) {
        $nlines = 0;
        foreach ($r as $k => $v) {
            if (!$v && !$showEmptyValues) {
                continue;
            }
            if (preg_match("/^[0-9]*\$/i", $k) && !$showNumIndex) {
                continue;
            }
            if (preg_match("/^[0-9]*\$/i", $k)) {
                $k = '[]';
            }
            $nlines++;
            if (True && is_array($v)) {
                core_dbgArray($v, $name);
            } else {
                core_tdbg($name, $k, $v);
            }
        }
        if ($nlines) {
            break;
        }
        $showNumIndex = True;
    }
    if ($core_tableDbg) {
        $core_tableDbg->close('</div>');
    }
    $core_tableDbg = False;
    core_setOption('debug', $core_dbgSV2, True);
}
Example #4
0
 function whoAmI()
 {
     if (False && $this->autoLogout && $_SESSION["auth"]["timestamp"]) {
         core_dbgArray($_SESSION["auth"], "whoAmI", $this->debug || core_getOption("YBhere"));
         $dt = time() - $_SESSION["auth"]["timestamp"];
         if ($dt > $autoLogoutTime) {
             core_dbg("autoLogout", "sleep for {$dt} > {$autoLogoutTime}", "", 1);
             $this->logout();
         }
     }
     $_SESSION["auth"]["timestamp"] = time();
     // Check first the standard Apache authenticator,
     // normally coming from pubcookies
     if ($localAccount = core_getpwnam($_SERVER["REMOTE_USER"])) {
         $this->dbg("whoAmI", "REMOTE_USER", $_SERVER["REMOTE_USER"]);
         $_SESSION["auth"]["username"] = $localAccount["name"];
         $_SESSION["auth"]["gecos"] = $localAccount["gecos"];
         $_SESSION["auth"]["account_id"] = $localAccount["uid"];
     }
     // Accept (if any) the server authentication prompt
     $this->authenticate($_POST["auth_username"], $_POST["auth_password"]);
     if ($_SESSION["auth"]["username"] && $_SESSION["auth"]["gecos"] && $_SESSION["auth"]["account_id"]) {
         $this->localAccount = core_getpwnam($_SESSION["auth"]["username"]);
         if (!$GLOBALS["deja"][get_class($this)][$_SESSION["auth"]["username"]]++) {
             core_dbgArray($_SESSION["auth"], "auth whoAmI");
         }
         $_SERVER["PHP_AUTH_USER"] = $_SESSION["auth"]["username"];
         return array($_SESSION["auth"]["gecos"], $_SESSION["auth"]["username"], $_SESSION["auth"]["account_id"]);
     } else {
         $this->dbg("whoAmI", "not logged in");
         unset($_SESSION["auth"]);
     }
 }