function query($query, $link = "") { global $SCRIPT_FILENAME; $oid = mysql_query($query); if (!$oid) { $code = returnCode(error, generic, __FILE__, __LINE__); } do { $data = mysql_fetch_assoc($oid); if ($data) { $content[] = $data; } } while ($data); $script = basename($SCRIPT_FILENAME); if ($link != "" and count($content) == 0) { if (getType($link) == "integer") { Header("Location: {$script}?page={$link}&code={$code}"); } else { Header("Location: {$link}&code={$code}"); } } else { return $content; } }
function getAuthCode($user, $pword, $service = 'cl') { $buf = sslToHost('www.google.com', 'post', '/accounts/ClientLogin', '', 'Email=' . $user . '&Passwd=' . $pword . '&service=' . $service . '&source=phord-gcal.php-1&accountType=HOSTED_OR_GOOGLE'); $code = returnCode($buf); if ($code === 200) { $lines = explode("\n", $buf); foreach ($lines as $line) { if (preg_match("/^Auth=(\\S+)/i", $line, $matches)) { return $matches[1]; } } } else { debugg("Error ({$code}) retrieving auth code"); } }