Common subdirectories: radioactivity_old/css and radioactivity/css Common subdirectories: radioactivity_old/images and radioactivity/images Common subdirectories: radioactivity_old/includes and radioactivity/includes Common subdirectories: radioactivity_old/js and radioactivity/js Common subdirectories: radioactivity_old/plugins and radioactivity/plugins diff radioactivity_old/radioactivity.field.inc radioactivity/radioactivity.field.inc 262,269c262,317 < module_load_include("inc", "radioactivity", "radioactivity-bootstrap"); < < $path = base_path() . drupal_get_path('module', 'radioactivity') . '/emit.php'; < < $fp = array( < 'enabled' => variable_get('radioactivity_flood_protection', FALSE), < 'timeout' => variable_get('radioactivity_flood_timeout', 15), < ); --- > > switch ( variable_get('radioactivity_emit_method', RADIOACTIVITY_EMIT_METHOD_DEFAULT ) ) { > case RADIOACTIVITY_EMIT_METHOD_INLINE: > > /** USE INLINE METHOD INSTEAD OF AJAX **/ > if (is_array($register)) { > foreach ($register as $storage => $entity_types) { > $class = "Radioactivity" . ucfirst($storage) . "IncidentStorage"; > require_once __DIR__."/includes/" . $class . ".inc"; > if (!class_exists($class)) { > // FIXME: throw an error? > continue; > } > $storage = new $class(); > if ($storage->requiresBootstrap()) { > // verify boostrapping > _radioactivity_require_bootstrapping(); > } > foreach ($entity_types as $entity_type => $entities) { > foreach ($entities as $bundle => $fields) { > foreach ($fields as $field_name => $languages) { > foreach ($languages as $language => $ids) { > foreach ($ids as $entity_id => $energy) { > $incident = new RadioactivityIncident( > $entity_type, > $bundle, > $field_name, > $language, > $entity_id, > $energy, > time() > ); > $storage->addIncident($incident); > } > } > } > } > } > } > } > break; > > /** AJAX METHODS - the only difference between these two is the path so I put them together **/ > case RADIOACTIVITY_EMIT_METHOD_AJAXEMIT: > $path = base_path() . drupal_get_path('module', 'radioactivity') . '/emit.php'; > case RADIOACTIVITY_EMIT_METHOD_AJAXMENU: > $path = isset( $path ) ? $path : base_path() . 'radioactivitiy/ajax/emit'; > > // required for prepare_payload > module_load_include("inc", "radioactivity", "radioactivity-bootstrap"); > > // init flood protection parameters from config > $fp = array( > 'enabled' => variable_get('radioactivity_flood_protection', FALSE), > 'timeout' => variable_get('radioactivity_flood_timeout', 15), > ); 271,277c319,327 < if (count($register) > 0) { < $register = serialize($register); < $translated[$path] = _radioactivity_prepare_payload($register); < drupal_add_library('system', 'jquery.cookie'); < drupal_add_js(drupal_get_path('module', 'radioactivity') . '/js/radioactivity.js'); < drupal_add_js(array('radioactivity' => array('emitters' => $translated)), 'setting'); < drupal_add_js(array('radioactivity' => array('flood_protection' => $fp)), 'setting'); --- > if (count($register) > 0) { > $register = serialize($register); > $translated = array( $path => _radioactivity_prepare_payload($register) ); > drupal_add_library('system', 'jquery.cookie'); > drupal_add_js(drupal_get_path('module', 'radioactivity') . '/js/radioactivity.js'); > drupal_add_js(array('radioactivity' => array('emitters' => $translated)), 'setting'); > drupal_add_js(array('radioactivity' => array('flood_protection' => $fp)), 'setting'); > } > diff radioactivity_old/radioactivity.module radioactivity/radioactivity.module 14a15,19 > define("RADIOACTIVITY_EMIT_METHOD_INLINE", 0); > define("RADIOACTIVITY_EMIT_METHOD_AJAXMENU", 1); > define("RADIOACTIVITY_EMIT_METHOD_AJAXEMIT", 2); > define("RADIOACTIVITY_EMIT_METHOD_DEFAULT", RADIOACTIVITY_EMIT_METHOD_AJAXEMIT); > 90a96,102 > $items['radioactivitiy/ajax/emit'] = array( > 'title' => 'Emit radioactivity by AJAX', > 'page callback' => 'radioactivity_ajax_emit', > 'access arguments' => array('access content'), > 'type' => MENU_CALLBACK, > ); > 94a107,166 > * Call back handler for AJAX based emit > **/ > function radioactivity_ajax_emit( ) { > > include "radioactivity-bootstrap.inc"; > > $payload = _radioactivity_validate_payload($_POST); > > if (!$payload) { > header('HTTP/1.1 400 Bad Request'); > print ("Invalid post data - check configuration."); > return; > } > > $data = $payload['data']; > $data = unserialize($data); > > require_once "includes/RadioactivityIncident.inc"; > require_once "includes/RadioactivityIncidentStorage.inc"; > > if (is_array($data)) { > foreach ($data as $storage => $entity_types) { > $class = "Radioactivity" . ucfirst($storage) . "IncidentStorage"; > require_once drupal_get_path('module', 'radioactivity') . "/includes/" . $class . ".inc"; > if (!class_exists($class)) { > // FIXME: throw an error? > continue; > } > $storage = new $class(); > foreach ($entity_types as $entity_type => $entities) { > foreach ($entities as $bundle => $fields) { > foreach ($fields as $field_name => $languages) { > foreach ($languages as $language => $ids) { > foreach ($ids as $entity_id => $energy) { > $incident = new RadioactivityIncident( > $entity_type, > $bundle, > $field_name, > $language, > $entity_id, > $energy, > time() > ); > $storage->addIncident($incident); > } > } > } > } > } > } > } > > // Clear field cache to reflect changes > db_delete("cache_field")->execute(); > > // #die now to prevent page rendering and additional processing > die("emit complete"); > } > > /**