$string = " " . $string; $ini = strpos($string, $start); if ($ini == 0) { return ""; } $ini += strlen($start); $len = strpos($string, $end, $ini) - $ini; return substr($string, $ini, $len); } ?> <?php /*if ($submitted): ?> <span class="submitted"><?php print $submitted; //print format_date($node->created, 'custom', "d.m.Y"); ?></span> <?php endif;*/ /*MARK NODE FOR INDEXING */ apachesolr_mark_node($node->nid); ?> <div class="add-this-options"> <?php if (empty($_GET['embed']) && empty($_GET['print'])) { ?> <div class="anchor-links fLeft"> <div class="fLeft"><a href="#tabs-block" rel="discuss" title="Discuss this dataset">Discuss this dataset</a></div> <div class="fLeft"><a href="#tabs-block" rel="contactOwner" title="Write to Data Controller">Write to Data Controller</a></div> <div class="fLeft"><a href="#tabs-block" rel="ratings" title="Rate this dataset">Rate this dataset</a></div> <div class="fLeft"><a href="#tabs-block" rel="embed" title="Embed this dataset">Embed this dataset</a></div> </div> <?php } ?> <div style="float:right">
/** * void cleanup_UnpublishPastEvents() * * Events which have ending dates that have pased shall be unpublished. */ function cleanup_UnpublishPastEvents() { $toReturn = array(); error_log(basename(__FILE__) . '::' . __FUNCTION__ . ' has startted.'); // Find nodes in the database which are Events, Published, and with a past ending date $results = db_query("\n SELECT nid, field_event_date_value2\n FROM node n \n LEFT JOIN field_data_field_event_date ed ON (ed.entity_id = n.nid)\n WHERE \n n.type='event' \n AND n.status=1\n AND ed.field_event_date_value2 IS NOT NULL \n AND DateDiff(ed.field_event_date_value2, NOW()) < 0\n "); // Unpublish these Events foreach ($results as $result) { if (intval($result->nid) > 0) { set_time_limit(900); // Keep resetting the PHP's-death-timer so this script dosnt time out db_query("UPDATE node n SET n.status=0 WHERE n.nid=" . intval($result->nid)); $toReturn[] = $result->nid; apachesolr_mark_node($result->nid); // Mark this node as needing to be indexed into Solr } } // Return the array of Node-IDs updated error_log(basename(__FILE__) . '::' . __FUNCTION__ . ' has finnished, ' . count($toReturn) . ' event nodes have been unpublished.'); return $toReturn; }