Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Merge pull request #15 from ddn/master

Regex change for CSS gene naming, made browscap optional and off by default
  • Loading branch information...
commit 89c739a44b474a6924ed21c9bdce9b5e82ce9937 2 parents e9099f5 + b30ab27
@gregdingle authored
Showing with 20 additions and 15 deletions.
  1. +2 −0  genetify/CONFIG.php
  2. +1 −1  genetify/genetify.js
  3. +17 −14 genetify/recorder.php
View
2  genetify/CONFIG.php
@@ -5,6 +5,8 @@
$DB['password'] = '';
$DB['database'] = 'genetify';
+$CONFIG['browscap'] = false; // browscap is defunct, turn off by default if & until a replacement is installed
+
// change as desired for debugging
error_reporting(E_ALL);
View
2  genetify/genetify.js
@@ -231,7 +231,7 @@ var genetify = {
// so then you could create your compound rules
// .myclass could modify the behavior of .myclass2.vA
- var geneNamePattern = '(.*)';
+ var geneNamePattern = '([A-Z0-9_$][a-zA-Z0-9_$\-]*)';
var markerPatternDict = {
'additiveCSSRules': '[a-zA-Z0-9_$]?\\.v',
'CSSRules': '_v',
View
31 genetify/recorder.php
@@ -377,25 +377,28 @@ function insert_new_visitor($ip_address)
{
global $mysqli;
+
$visitor = array('ip_address' => $ip_address);
+ // TODO: best delimiter?
+ $visitor['hash'] = md5(implode('', $visitor));
- //TODO: make optional
- require_once('Browscap/Browscap.php');
- $bc = new Browscap('cache');
- //TODO: make this configurable
- $bc->doAutoUpdate = 0;
- foreach ($bc->getBrowser() as $key => $value) {
+ if ($CONFIG['browscap']) {
+
+ //TODO: make optional
+ require_once('Browscap/Browscap.php');
+ $bc = new Browscap('cache');
+ //TODO: make this configurable
+ $bc->doAutoUpdate = 0;
+ foreach ($bc->getBrowser() as $key => $value) {
// filter out raw fields
- if (!strstr($key, 'browser_name')) {
- $visitor[$key] = $value;
+ if (!strstr($key, 'browser_name')) {
+ $visitor[$key] = $value;
+ }
}
- }
- //TODO: convert database column names
- // $visitor = _camel_to_underscore($visitor);
-
- // TODO: best delimiter?
- $visitor['hash'] = md5(implode('', $visitor));
+ //TODO: convert database column names
+ // $visitor = _camel_to_underscore($visitor);
+ }
$sql = "SELECT * FROM visitor WHERE visitor.hash = '" . $visitor['hash'] . "'";
$id = _get_unique_row_id('visitor', $sql);
Please sign in to comment.
Something went wrong with that request. Please try again.