Fixed some game-stopping issues; corrected guest login.

Fixed: ajaxim.php would return an error if no DB_ENGINE was set. Now checks if DB_ENGINE has length before trying to import and create the Database class.
Fixed: server.js would crash on a Memcache "get username/someone" request if "someone" didn't exist.
Fixed: im.js tried to set document.domain with a period at the beginning for requests to subdomains.
Fixed: Actions that involve requesting to a subdomain now use JSONP instead of POST requests, since same-domain policies are a pain in my ass.
Fixed: Guest login in im.load.js fixed to use im.js "noSession" and "sessionNotResumed" hooks (ensures reconnect regardless of circumstance).
Esse commit está contido em:
Joshua Gross
2010-02-15 11:15:20 -06:00
commit 18b44b6312
5 arquivos alterados com 33 adições e 24 exclusões
+14 -12
Ver Arquivo
@@ -27,22 +27,24 @@ require_once('libraries/db/base.php');
require_once('libraries/server/base.php');
# import the database library
require_once('libraries/db/' . DB_ENGINE . '.php');
$db_class = DB_ENGINE . '_Database';
if(strlen(DB_ENGINE)) {
require_once('libraries/db/' . DB_ENGINE . '.php');
$db_class = DB_ENGINE . '_Database';
if (!function_exists('class_alias')) {
// Allows us to alias Database library classes to standardized names
function class_alias($original, $alias) {
eval('class ' . $alias . ' extends ' . $original . ' {}');
if (!function_exists('class_alias')) {
// Allows us to alias Database library classes to standardized names
function class_alias($original, $alias) {
eval('class ' . $alias . ' extends ' . $original . ' {}');
}
}
class_alias(DB_ENGINE . '_Database', 'Database');
class_alias(DB_ENGINE . '_User', 'User');
class_alias(DB_ENGINE . '_Status', 'Status');
class_alias(DB_ENGINE . '_Message', 'Message');
class_alias(DB_ENGINE . '_Friend', 'Friend');
}
class_alias(DB_ENGINE . '_Database', 'Database');
class_alias(DB_ENGINE . '_User', 'User');
class_alias(DB_ENGINE . '_Status', 'Status');
class_alias(DB_ENGINE . '_Message', 'Message');
class_alias(DB_ENGINE . '_Friend', 'Friend');
// Fix problems with magic_quotes_gpc/sybase
if(function_exists('get_magic_quotes_gpc') && get_magic_quotes_gpc()) {
$syb = strtolower(ini_get('magic_quotes_sybase'));
+1 -2
Ver Arquivo
@@ -54,8 +54,7 @@
h1 {
text-indent: -10000px;
/*background: url(http://ajaxim.com/images/logo.png?install);*/
background: url(site/demo/images/logo.png);
background: url(http://ajaxim.com/images/logo.png);
width: 146px;
height: 44px;
margin: 0 0.5em 0 0;
+1 -1
Ver Arquivo
Diff do arquivo suprimido porque uma ou mais linhas são muito longas
+4 -1
Ver Arquivo
@@ -71,7 +71,10 @@ var AjaxIM, AjaxIMLoadedFunction;
status: 'http://' + nodehost + '/status',
resume: 'http://' + nodehost + '/resume'
});
AjaxIM.client.login();
function tmplogin() { AjaxIM.client.login(); }
$(AjaxIM.client)
.bind('noSession', tmplogin)
.bind('sessionNotResumed', tmplogin);
}
AjaxIM.loaded();
+13 -8
Ver Arquivo
@@ -30,9 +30,10 @@
var sys = require('sys'),
http = require('http'),
tcp = require('tcp'),
url = require('url'),
config = require('./config');
try { url = require('url'); } catch(e) {}
var AjaxIM = function(config) {
var self = this;
@@ -482,13 +483,17 @@ var AjaxIM = function(config) {
// ==== Parameters ====
// * {{{username}}} is the name of the user to retrieve.
this.apiGetUser = function(username) {
var user = this.users[username];
return {
username: user.username,
user_id: user.user_id,
status: user.status,
session_id: user.session_id
};
if(username in this.users) {
var user = this.users[username];
return {
username: user.username,
user_id: user.user_id,
status: user.status,
session_id: user.session_id
};
} else {
return false;
}
};
// === {{{ AjaxIM.apiGetSession(session_id) }}} ===