get_slider_options = function(err, result) { if (err) { console.log('No results'); return next(err); } $options = {}; result.forEach(function(item, i) { $options[item.option_id] = new Buffer(item.option_value, 'binary') .toString(); }); var tmp = us.unserialize($options['feature_list_items']); $options['feature_list_items'] = []; for (var i in tmp['image']) { if (tmp['image'][i].trim().length && tmp['label'][i].trim().length && tmp['link'][i].trim().length) { $options['feature_list_items'].push({ image: tmp['image'][i], label: tmp['label'][i], link: tmp['link'][i] }); } } data.feature_list = $options; mysql.open(config.mysql) .query( "SELECT option_id, option_value from EWRporta_options \ where option_id like 'recentfeatures_%'", [], get_slider ).end(); },
get_feature_list = function(err, result) { if (err) { return next(err); } result = result[0]; data.forum = us.unserialize(new Buffer(result.option_value, 'binary') .toString()).join(','); mysql.open(config.mysql) .query( 'SELECT * from xf_option where option_id in ("feature_list_header",' + ' "feature_list_items", "feature_list_active")', [], get_slider_options ).end(); },