function processEvent(&$event) { //perform actions $topic_id = $event['event_param']; $db =& $this->_getDB(); require 'conf/' . $_SERVER['HTTP_HOST'] . '.conf.php'; $topic = $db->GetRow("select topic_title,forum_id,topic_time from geobb_topics where topic_id='{$topic_id}' and forum_id = {$CONF['forum_gridsquare']}"); //get title of topic $title = strtoupper(trim($topic['topic_title'])); //see if title matches a grid reference $gridsquare = new GridSquare(); if ($gridsquare->setGridRef($title)) { $gridsquare_id = $gridsquare->gridsquare_id; //set up mapping if ($gridsquare_id > 0) { $this->processor->trace("Mapping {$gridsquare_id} to topic {$topic_id} ({$title})"); $db->Execute("replace into gridsquare_topic(gridsquare_id,topic_id,forum_id,last_post) " . "values ({$gridsquare_id}, {$topic_id}, {$topic['forum_id']}, '{$topic['topic_time']}')"); //delete any smarty caches for this square $images = $db->getCol("select gridimage_id from gridimage where gridsquare_id = {$gridsquare_id}"); $smarty = new GeographPage(); foreach ($images as $gridimage_id) { //clear any caches involving this photo $ab = floor($gridimage_id / 10000); $smarty->clear_cache(null, "img{$ab}|{$gridimage_id}"); } } } //return true to signal completed processing //return false to have another attempt later return true; }
* GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ require_once 'geograph/global.inc.php'; require_once 'geograph/gridimage.class.php'; require_once 'geograph/gridsquare.class.php'; require_once 'geograph/map.class.php'; require_once 'geograph/mapmosaic.class.php'; require_once 'geograph/image.inc.php'; init_session(); $smarty = new GeographPage(); $db = NewADOConnection($GLOBALS['DSN']); if (isset($_POST['inv'])) { $square = new GridSquare(); $grid_ok = $square->setGridRef($_POST['gridref']); if ($grid_ok) { $x = $square->x; $y = $square->y; require_once 'geograph/mapmosaic.class.php'; $mosaic = new GeographMapMosaic(); $mosaic->expirePosition($x, $y); $smarty->assign('gridref', $_POST['gridref']); } else { $smarty->assign('errormsg', $square->errormsg); } } $smarty->assign('invalid_maps', $db->GetOne("select count(*) from mapcache where age > 0 and type_or_user >= 0")); $smarty->display('recreatemaps.tpl');
} $loads = explode(" ", $buffer); $load = (double) $loads[0]; if ($load > $threshold) { $CONF['disable_discuss_thumbs'] = true; } } if (!empty($CONF['disable_discuss_thumbs'])) { $gridThumbs = "<h4 style=\"color:red\">During times of heavy load we limit the display of thumbnails in the posts.<br/>Sorry for the loss of this feature.</h4>"; } else { if ($gridref || $forum == $CONF['forum_gridsquare'] && ($gridref = $topicName)) { require_once 'geograph/gridimage.class.php'; require_once 'geograph/gridsquare.class.php'; $smarty = new GeographPage(); $square = new GridSquare(); $grid_ok = $square->setGridRef($gridref); if ($grid_ok) { //find a possible place within 25km $smarty->assign('place', $square->findNearestPlace(75000)); if ($square->imagecount) { //todo use smarty caching //what style should we use? $style = $USER->getStyle(); $smarty->assign('maincontentclass', 'content_photo' . $style); $smarty->assign('backgroundcolor', $style); $images = $square->getImages(); $smarty->assign_by_ref('images', $images); } $smarty->assign('gridref', $gridref); $gridThumbs = $smarty->fetch("_discuss_gridref_cell.tpl"); }
} $sql = "SELECT *\nFROM `geobb_topics`\nINNER JOIN geobb_posts ON ({$sql_join})\n{$sql_where}\nORDER BY {$sql_order}\nLIMIT 30"; $recordSet =& $db->Execute($sql); while (!$recordSet->EOF) { $item = new FeedItem(); $item->title = $recordSet->fields['topic_title']; //htmlspecialchars is called on link so dont use & $item->link = "http://{$_SERVER['HTTP_HOST']}/discuss/?action=vthread&topic={$recordSet->fields['topic_id']}"; $description = preg_replace('/^<i>[^<]+<\\/i>([\\n\\r]*<br>)?([\\n\\r]*<br>)?([\\n\\r]*<br>)?/', '', $recordSet->fields['post_text']); if (strlen($description) > 160) { $description = substr($description, 0, 157) . "..."; } $item->description = GeographLinks($description); $item->date = strtotime($recordSet->fields['post_time']); //$item->source = "http://{$_SERVER['HTTP_HOST']}/discuss/"; $item->author = $recordSet->fields['poster_name']; if ($format == 'KML' || $format == 'GeoRSS' || $format == 'GPX') { $gridsquare = new GridSquare(); $grid_ok = $gridsquare->setGridRef($recordSet->fields['topic_title']); if ($grid_ok) { list($item->lat, $item->long) = $conv->gridsquare_to_wgs84($gridsquare); } } $rss->addItem($item); $recordSet->MoveNext(); } } customExpiresHeader(3600, true); //we cache it for an hour anyway! header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT"); $rss->saveFeed($format, $rssfile);