Permalink
Browse files

major bugfixes; updated to mysql 2.0.0a

  • Loading branch information...
1 parent f8da610 commit 9947b7e48b4521af80c88ff67e055aecd3790e1e @zackster committed Jun 11, 2012
Showing 616 changed files with 859 additions and 88,219 deletions.
@@ -3,23 +3,15 @@
var hashlib = require('hashlib2'),
createHash = require("../utils").createHash,
mysql = require('mysql'),
+ vB_dao = require('../vBDao'),
config = require("../config");
function Server() {
this.logged_in_users = createHash();
}
- Server.prototype.getMySQLClient = function() {
- var client = mysql.createClient({
- user: config.vBulletin.username,
- password: config.vBulletin.password
- });
- client.query('USE '+config.vBulletin.database);
- return client;
- };
-
Server.prototype.userInfo = function(id, callback) {
- var client = this.getMySQLClient();
+ var client = vB_dao.getMySQLClient();
client.query("SELECT * FROM user WHERE userid = ? LIMIT 1", [id], function (err, results, fields) {
if(err) {
throw err;
@@ -30,7 +22,7 @@
};
Server.prototype.getEmailAddressFromUsername = function(username, callback) {
- var client = this.getMySQLClient();
+ var client = vB_dao.getMySQLClient();
client.query("SELECT email FROM user WHERE username = ? LIMIT 1", [username], function (err, results, fields) {
if(err) {
throw err;
@@ -44,7 +36,7 @@
var self = this;
this.userInfo(user, function(uinfo) {
- var client = self.getMySQLClient();
+ var client = vB_dao.getMySQLClient();
var epoch_in_seconds = Date.now() / 1000; // vBulletin stores epoch in seconds, Date.now() returns a value in ms
client.query("UPDATE user SET lastactivity = ? WHERE userid = ? LIMIT 1", [epoch_in_seconds, user], function (err, results, fields) {
if(err) {
@@ -90,7 +82,7 @@
Server.prototype.getCookie = function(id, pass, callback) {
var self = this;
- var client = this.getMySQLClient();
+ var client = vB_dao.getMySQLClient();
client.query("SELECT * FROM user WHERE userid = ? LIMIT 1", [id], function (err, results, fields) {
if(err) {
@@ -132,7 +124,7 @@
var ip = ip_address.split('.').slice(0, 3).join('.');
var newidhash = hashlib.md5(user_agent + ip);
- var client = this.getMySQLClient();
+ var client = vB_dao.getMySQLClient();
client.query("SELECT * FROM session WHERE sessionhash = ? LIMIT 1", [hash], function (err, results, fields) {
if(err) {
@@ -163,8 +155,7 @@
};
Server.prototype.login = function (id, username, password, callback) {
- var client = this.getMySQLClient();
- client.query('USE '+config.vBulletin.database);
+ var client = vB_dao.getMySQLClient();
var self = this;
client.query(
'SELECT username, password, salt FROM user WHERE username=?', [username], function (err, results, fields) {
@@ -193,4 +184,4 @@
return new Server();
};
-}());
+}());
@@ -1,4 +1,16 @@
+0.7.0 / 2012-05-04
+==================
+
+ * Added .component to package.json
+ * Added debug.component.js build
+
+0.6.0 / 2012-03-16
+==================
+
+ * Added support for "-" prefix in DEBUG [Vinay Pulim]
+ * Added `.enabled` flag to the node version [TooTallNate]
+
0.5.0 / 2012-02-02
==================
@@ -1,5 +1,4 @@
-test:
- @echo "populate me"
+debug.component.js: head.js debug.js tail.js
+ cat $^ > $@
-.PHONY: test
@@ -85,6 +85,8 @@ setInterval(function(){
The "*" character may be used as a wildcard. Suppose for example your library has debuggers named "connect:bodyParser", "connect:compress", "connect:session", instead of listing all three with `DEBUG=connect:bodyParser,connect.compress,connect:session`, you may simply do `DEBUG=connect:*`, or to run everything using this module simply use `DEBUG=*`.
+ You can also exclude specific debuggers by prefixing them with a "-" character. For example, `DEBUG=* -connect:*` would include all debuggers except those starting with "connect:".
+
## Browser support
Debug works in the browser as well, currently persisted by `localStorage`. For example if you have `worker:a` and `worker:b` as shown below, and wish to debug both type `debug.enable('worker:*')` in the console and refresh the page, this will remain until you disable with `debug.disable()`.
@@ -1,10 +1,4 @@
-/*!
- * debug
- * Copyright(c) 2012 TJ Holowaychuk <tj@vision-media.ca>
- * MIT Licensed
- */
-
/**
* Create a debugger with the given `name`.
*
@@ -39,6 +33,7 @@ function debug(name) {
*/
debug.names = [];
+debug.skips = [];
/**
* Enables a debug mode by name. This can include modes
@@ -56,7 +51,12 @@ debug.enable = function(name) {
for (var i = 0; i < len; i++) {
name = split[i].replace('*', '.*?');
- debug.names.push(new RegExp('^' + name + '$'));
+ if (name[0] === '-') {
+ debug.skips.push(new RegExp('^' + name.substr(1) + '$'));
+ }
+ else {
+ debug.names.push(new RegExp('^' + name + '$'));
+ }
}
};
@@ -98,6 +98,11 @@ debug.humanize = function(ms) {
*/
debug.enabled = function(name) {
+ for (var i = 0, len = debug.skips.length; i < len; i++) {
+ if (debug.skips[i].test(name)) {
+ return false;
+ }
+ }
for (var i = 0, len = debug.names.length; i < len; i++) {
if (debug.names[i].test(name)) {
return true;
@@ -1,10 +1,4 @@
-/*!
- * debug
- * Copyright(c) 2012 TJ Holowaychuk <tj@vision-media.ca>
- * MIT Licensed
- */
-
/**
* Module dependencies.
*/
@@ -18,20 +12,21 @@ var tty = require('tty');
module.exports = debug;
/**
- * Library version.
- */
-
-exports.version = '0.5.0';
-
-/**
* Enabled debuggers.
*/
-var names = (process.env.DEBUG || '')
+var names = []
+ , skips = [];
+
+(process.env.DEBUG || '')
.split(/[\s,]+/)
- .map(function(name){
+ .forEach(function(name){
name = name.replace('*', '.*?');
- return new RegExp('^' + name + '$');
+ if (name[0] === '-') {
+ skips.push(new RegExp('^' + name.substr(1) + '$'));
+ } else {
+ names.push(new RegExp('^' + name + '$'));
+ }
});
/**
@@ -97,11 +92,20 @@ function humanize(ms) {
*/
function debug(name) {
- var match = names.some(function(re){
+ function disabled(){}
+ disabled.enabled = false;
+
+ var match = skips.some(function(re){
+ return re.test(name);
+ });
+
+ if (match) return disabled;
+
+ match = names.some(function(re){
return re.test(name);
});
- if (!match) return function(){};
+ if (!match) return disabled;
var c = color();
function colored(fmt) {
@@ -123,6 +127,8 @@ function debug(name) {
console.error.apply(this, arguments);
}
+ colored.enabled = plain.enabled = true;
+
return isatty
? colored
: plain;
@@ -1,11 +1,16 @@
{
"name": "debug"
- , "version": "0.5.0"
+ , "version": "0.7.0"
, "description": "small debugging utility"
, "keywords": ["debug", "log", "debugger"]
, "author": "TJ Holowaychuk <tj@vision-media.ca>"
, "dependencies": {}
, "devDependencies": { "mocha": "*" }
, "main": "index"
, "engines": { "node": "*" }
+ , "component": {
+ "scripts": {
+ "debug": "debug.component.js"
+ }
+ }
}
@@ -26,7 +26,7 @@ exports = module.exports = createServer;
* Framework version.
*/
-exports.version = '1.8.5';
+exports.version = '1.8.7';
/**
* Initialize a new `connect.HTTPServer` with the middleware
@@ -12,7 +12,8 @@
var http = require('http')
, parse = require('url').parse
- , assert = require('assert');
+ , assert = require('assert')
+ , utils = require('./utils');
// environment
@@ -169,7 +170,7 @@ Server.prototype.handle = function(req, res, out) {
res.statusCode = 404;
res.setHeader('Content-Type', 'text/plain');
if ('HEAD' == req.method) return res.end();
- res.end('Cannot ' + req.method + ' ' + req.url);
+ res.end('Cannot ' + req.method + ' ' + utils.escape(req.originalUrl));
}
return;
}
@@ -17,8 +17,6 @@
* connect.limit('5.5mb')
* ).listen(3000);
*
- * TODO: pause EV_READ
- *
* @param {Number|String} bytes
* @return {Function}
* @api public
@@ -50,8 +50,7 @@ var warning = 'Warning: connection.session() MemoryStore is not\n'
*/
function defaultFingerprint(req) {
- var ua = req.headers['user-agent'] || '';
- return ua.replace(/;?\schromeframe\/[\d\.]+/, '');
+ return '';
};
/**
@@ -1,6 +1,6 @@
{
"name": "connect",
- "version": "1.8.5",
+ "version": "1.8.7",
"description": "High performance middleware framework",
"keywords": ["framework", "web", "middleware", "connect", "rack"],
"repository": "git://github.com/senchalabs/connect.git",
@@ -20,6 +20,7 @@
"ejs": "0.4.3",
"should": "0.3.2"
},
+ "publishConfig": { "tag": "1.8" },
"main": "index",
"engines": { "node": ">= 0.4.1 < 0.7.0" }
}
@@ -1,52 +0,0 @@
-
-var connect = require('./')
- , http = require('http')
- , RedisStore = require('connect-redis')(connect);
-
-var app = connect();
-app.use(connect.cookieParser('fucj'));
-app.use(connect.session({store:new RedisStore}));
-app.use(function(req, res, next){
- req.session.views = (req.session.views || 0) + 1;
- res.writeHead(200, {"Content-Type": "text/plain"});
- res.end("You've viewed this page "+req.session.views+" times.");
-})
-
-http.createServer(app).listen(3000);
-
-
-// var set = RedisStore.prototype.set;
-//
-// function slow(sid){
-// console.log('%s saving', sid);
-// var args = arguments;
-// setTimeout(function(self){
-// console.log('%s saved', sid);
-// set.apply(self, args);
-// }, 2000, this);
-// };
-//
-// http.createServer(connect()
-// .use(connect.logger('dev'))
-// .use(connect.cookieParser('keyboard cat'))
-// .use(connect.session({ store: new RedisStore }))
-// .use(function(req, res, next){
-// var sess = req.session;
-// switch (req.url) {
-// case '/foo.js':
-// console.log('%s foo.js sid', sess.id);
-// RedisStore.prototype.set = set;
-// res.end('data');
-// break;
-// default:
-// console.log('%s html sid', sess.id);
-// RedisStore.prototype.set = slow;
-// res.setHeader('Content-Type', 'html');
-// res.write('<html><head><script src="/foo.js"></script></head><body>');
-// setTimeout(function(){
-// res.end('</body></html>');
-// }, 1000);
-// }
-// })).listen(3000);
-//
-// console.log('port 3000');
Oops, something went wrong.

0 comments on commit 9947b7e

Please sign in to comment.