Never been to TextSnippets before?

Snippets is a public source code repository. Easily build up your personal collection of code snippets, categorize them with tags / keywords, and share them with the world (or not, you can keep them private!)

About this user

Scott

« Newer Snippets
Older Snippets »
3 total  XML / RSS feed 

Wheels of Justice Changes

// description of your code here

In actions.module

Changed
/**
 * Callback function for array_filter in actions_list()
 */
function _actions_isaction($s) {
  return substr($s, 0, 7) == 'action_';
}

include_once('actions.inc');


To:
/**
 * Callback function for array_filter in actions_list()
 */
function _actions_isaction($s) {
  return substr($s, 0, 7) == 'action_';
}

include_once('/var/www/vhosts/somebodypinchme.net/subdomains/wheels/httpdocs/modules/actions/actions.inc');

Gmap Module patch

// How to use Views to display Gmap of nodes of node-type?
// http://drupal.org/node/73420
// http://drupal.org/files/issues/gmap_view.patch

--- gmap.module  2006-07-15 12:23:18.000000000 -0700
+++ gmap.module.new   2006-07-15 12:22:42.000000000 -0700
@@ -1191,20 +1191,21 @@
  */
 function theme_views_view_gmap($view, $nodes) {
   $fields = _views_get_fields();
+       $markers = array();
   foreach ($nodes as $node) {
     $node_data = node_load(array("nid"=>$node->nid));
     $location = $node_data->location;
-    if (strlen($location['lat'])>0 && strlen($location['lon']>0)) {
-      $newmarker['label'] = '';
+    if (($location['lat']) && ($location['lon'])) {
+                       $marker_label = "";
       foreach ($view->field as $field) {
-        $newmarker['label'] .= "

" . views_theme_field('views_handle_field', $field['queryname'], $fields, $field, $node) . "</p>"; + $marker_label .= "<p>" . views_theme_field('views_handle_field', $field['queryname'], $fields, $field, $node) . "p>"; } - $newmarker['point']= $location['lat'] . ',' . $location['lon']; - $newmarker['markername']='drupal_view'; - $thismap['markers'][]= $newmarker; + $markers[] = array('markername'=>'view', + 'label' => $marker_label, + 'point' =>$location['lat'] . ',' . $location['lon']); } } + $thismap = array('id' => 'view_gmap', 'markers' => $markers); $output .= gmap_draw_map($thismap); return $output; } -

"Double logins", caching, and logging in and out

// http://drupal.org/node/70521
// http://drupal.org/files/issues/headers-cvs-4.patch.txt

--- includes/bootstrap.inc
+++ includes/bootstrap.inc
@@ -381,6 +381,15 @@
 
 /**
  * Set HTTP headers in preparation for a page response.
+ * 
+ * The general approach here is that anonymous users can keep a local cache of
+ * the page, but must revalidate it on every request. Then, they are given a
+ * '304 Not Modified' response as long as they stay logged out and the page
+ * has not been modified.
+ * This prevents authenticated users seeing locally cached pages that show them
+ * as logged out.
+ * Authenticated users are always given a 'no-cache' header set, and will fetch
+ * a fresh page on every request.
  *
  * @see page_set_cache
  */
@@ -412,7 +421,10 @@
     // Send appropriate response:
     header("Last-Modified: $date");
     header("ETag: $etag");
-
+    // The following headers force validation of cache
+    header("Expires: Sun, 19 Nov 1978 05:00:00 GMT");
+    header("Cache-Control: must-revalidate");
+      
     // Determine if the browser accepts gzipped data.
     if (@strpos($_SERVER['HTTP_ACCEPT_ENCODING'], 'gzip') === FALSE && function_exists('gzencode')) {
       // Strip the gzip header and run uncompress.
« Newer Snippets
Older Snippets »
3 total  XML / RSS feed