function processEvent(&$event) { $db =& $this->_getDB(); list($gridimage_id, $updatemaps) = explode(',', $event['event_param']); //invalidate any cached maps (on anything except rejecting a pending image) if ($updatemaps) { require_once 'geograph/mapmosaic.class.php'; $mosaic = new GeographMapMosaic(); list($x, $y, $user_id) = $db->getRow("select x,y,user_id from gridimage inner join gridsquare using (gridsquare_id) where gridimage_id = {$gridimage_id}"); $mosaic->expirePosition($x, $y, $user_id); } //update placename cached column //we can disable this for now as placename_id is unused //to reable, will need to load up a gridsquare _with_ nateastings (a square created by gridimage) #todo $this->updatePlaceNameId($newsq); //return true to signal completed processing //return false to have another attempt later return true; }
$ri = $second['reference_index']; $letterlength = $CONF['gridpreflen'][$ri]; $smarty->assign('ofe', $letterlength + 1); $smarty->assign('ofn', $letterlength + 3); //assign all the other useful stuff $gr = $map->getGridRef(-1, -1); $smarty->assign('gridref', $gr); if ($map->pixels_per_km == 4) { $starte = substr($gr, $letterlength, 2); $starte = intval($starte) - 50; if ($starte < 0) { $starte += 100; } $startn = substr($gr, $letterlength + 2, 2); $startn = intval($startn) + 50; if ($startn > 100) { $startn -= 100; } $smarty->assign('starte', $starte); $smarty->assign('startn', $startn - 1); } else { $mosaic = new GeographMapMosaic(); $mosaic->setToken($_GET['t'], true); $smarty->assign('mosaic_token', $mosaic->getToken()); $smarty->assign('token_north', $map->getPanToken(0, 1)); $smarty->assign('token_south', $map->getPanToken(0, -1)); $smarty->assign('token_west', $map->getPanToken(-1, 0)); $smarty->assign('token_east', $map->getPanToken(1, 0)); } } $smarty->display($template, $cacheid);
if (isset($_GET['reject']) && empty($_GET['reject'])) { $statuses = array('pending', 'accepted', 'geograph'); } else { $statuses = ''; //all } } else { $statuses = array('accepted', 'geograph'); } $images->getImagesByUser($uid, $statuses, 'gridimage_id desc', $limit, true); $images->assignSmarty($smarty, 'userimages'); if (count($images->images) == $limit) { $smarty->assign('limit', $limit); } if (count($images->images)) { $overview = new GeographMapMosaic('overview'); $overview->type_or_user = $uid; $overview->assignToSmarty($smarty, 'overview'); } $profile->md5_email = md5(strtolower($profile->email)); } else { $profile = new GeographUser(); $profile->user_id = $uid; if ($uid == $USER->user_id) { if (empty($_SESSION['last_ticket_time']) || $USER->last_ticket_time > $_SESSION['last_ticket_time']) { $profile->tickets = $USER->tickets; } } $smarty->assign_by_ref('profile', $profile); } }
* 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');
preg_match('/^([A-Z]{1,3})(\\d\\d)(\\d\\d)$/', $gridref, $matches); $gridsquare = $matches[1]; $eastings = $matches[2]; $northings = $matches[3]; $sql = "select * from gridprefix where prefix='{$gridsquare}'"; $prefix = $db->GetRow($sql); if (count($prefix)) { $x = $prefix['origin_x'] + $eastings; $y = $prefix['origin_y'] + $northings; $sql = "insert into gridsquare(x,y,percent_land,grid_reference,reference_index,point_xy) \n\t\t\t\t\t\tvalues({$x},{$y},-1,'{$gridref}',{$prefix['reference_index']},GeomFromText('POINT({$x} {$y})') )"; $db->Execute($sql); $gridsquare_id = $db->Insert_ID(); $smarty->assign('status', "New gridsquare {$gridref} created with new land percentage of {$percent} %"); $db->Execute("REPLACE INTO mapfix_log SET user_id = {$USER->user_id}, gridsquare_id = {$gridsquare_id}, new_percent_land='{$percent}', old_percent_land='{$sq['percent_land']}',created=now(),comment=" . $db->Quote($_GET['comment'])); require_once 'geograph/mapmosaic.class.php'; $mosaic = new GeographMapMosaic(); $mosaic->expirePosition($x, $y, 0, true); } } $smarty->assign('percent_land', $percent); } } else { $smarty->assign_by_ref('gridref', strip_tags($_GET['gridref'])); $smarty->assign('gridref_error', "Bad grid reference"); } $smarty->assign('gridref_ok', $ok ? 1 : 0); } if ($_GET['save'] == 'quick') { //return nice simple result $status = $smarty->get_template_vars('status'); echo "Status: {$status}";
require_once 'geograph/gridsquare.class.php'; require_once 'geograph/imagelist.class.php'; require_once 'geograph/map.class.php'; require_once 'geograph/mapmosaic.class.php'; switch ($CONF['template']) { case 'charcoal': $preset = 'overview_charcoal'; break; case 'ireland': $preset = 'overview_ireland'; break; default: $preset = 'overview_large'; break; } $overview = new GeographMapMosaic($preset); $overview->type_or_user = 0; if ($preset == 'overview_large') { $overview->assignToSmarty($smarty, 'overview2'); } else { $overview->assignToSmarty($smarty, 'overview'); } require_once 'geograph/pictureoftheday.class.php'; $potd = new PictureOfTheDay(); if (isset($_GET['potd'])) { $potd->assignToSmarty($smarty, intval($_GET['potd'])); } else { $potd->assignToSmarty($smarty); } //lets find some recent photos if ($CONF['template'] == 'ireland') {
if (!empty($CONF['forums'])) { $square->assignDiscussionToSmarty($smarty); } //look for images from here... $sphinx = new sphinxwrapper(); if ($viewpoint_count = $sphinx->countImagesViewpoint($square->getNatEastings(), $square->getNatNorthings(), $square->reference_index, $square->grid_reference)) { $smarty->assign('viewpoint_count', $viewpoint_count); $smarty->assign('viewpoint_query', $sphinx->q); } if ($square->natspecified && $square->natgrlen >= 6) { $conv = new Conversions(''); list($gr6, $len) = $conv->national_to_gridref($square->getNatEastings(), $square->getNatNorthings(), 6, $square->reference_index, false); $smarty->assign('gridref6', $gr6); } //lets add an overview map too $overview = new GeographMapMosaic('largeoverview'); $overview->setCentre($square->x, $square->y); //does call setAlignedOrigin $smarty->assign('marker', $overview->getSquarePoint($square)); //lets add an rastermap too $rastermap = new RasterMap($square, false, $square->natspecified); $rastermap->addLatLong($lat, $long); $smarty->assign_by_ref('rastermap', $rastermap); $overview->assignToSmarty($smarty, 'overview'); if (!empty($_GET['taken'])) { $smarty->assign('image_taken', $_GET['taken']); } if (!empty($_GET['title'])) { $smarty->assign('title', $_GET['title']); } if (!empty($_GET['id'])) {
$smarty->caching = 2; // lifetime is per cache $smarty->cache_lifetime = 3600 * 24; //24hr cache } if (isset($_GET['refresh']) && $USER->hasPerm('admin')) { $smarty->clear_cache($template, $cacheid); } $smarty->assign_by_ref('references_real', $CONF['references']); if (!$smarty->is_cached($template, $cacheid)) { $db = NewADOConnection($GLOBALS['DSN']); if (!$db) { die('Database connection failed'); } #$db->debug = true; $mosaic = new GeographMapMosaic(); $mosaic->setScale(40); $mosaic->setMosaicFactor(2); $mostarray = array(); foreach ($CONF['references'] as $ri => $rname) { $letterlength = $CONF['gridpreflen'][$ri]; $most = $db->GetAll("select \n\t\tgrid_reference,x,y,\n\t\tconcat(substring(grid_reference,1," . ($letterlength + 1) . "),substring(grid_reference," . ($letterlength + 3) . ",1)) as tenk_square,\n\t\tsum(has_geographs) as geograph_count,\n\t\tsum(percent_land >0) as land_count\n\t\tfrom gridsquare \n\t\twhere reference_index = {$ri} \n\t\tgroup by tenk_square \n\t\thaving geograph_count = 0 and land_count > 0\n\t\torder by tenk_square"); $i = 1; $lastgeographs = -1; foreach ($most as $id => $entry) { $most[$id]['x'] = intval(($most[$id]['x'] - $CONF['origins'][$ri][0]) / 10) * 10 + $CONF['origins'][$ri][0]; $most[$id]['y'] = intval(($most[$id]['y'] - $CONF['origins'][$ri][1]) / 10) * 10 + $CONF['origins'][$ri][1]; //get a token to show a suroudding geograph map $mosaic->setOrigin($most[$id]['x'], $most[$id]['y']); $most[$id]['map_token'] = $mosaic->getToken(); }
$db = NewADOConnection($GLOBALS['DSN']); $start_time = time(); $end_time = $start_time + 60 * $param['timeout']; $prefixes = $db->GetAll("select * from gridprefix order by rand();"); foreach ($prefixes as $idx => $prefix) { //sleep until calm if we've specified a load average if ($param['load'] < 100) { while (get_loadavg() > $param['load']) { sleep($param['sleep']); if (time() > $end_time) { exit; } } } //mysql might of closed the connection in the meantime if we reuse the same object $mosaic = new GeographMapMosaic(); print "Starting {$prefix['prefix']}...\n"; flush(); $minx = $prefix['origin_x']; $maxx = $prefix['origin_x'] + $prefix['width'] - 1; $miny = $prefix['origin_y']; $maxy = $prefix['origin_y'] + $prefix['height'] - 1; $crit = "map_x between {$minx} and {$maxx} and " . "map_y between {$miny} and {$maxy} and " . "pixels_per_km >= 40 and " . "((map_x-{$prefix['origin_x']}) mod 5) != 0 and " . "((map_y-{$prefix['origin_y']}) mod 5) != 0"; $count = $mosaic->deleteBySql($crit, $param['dryrun'], $param['base']); print "Deleted {$count}\n"; $total += $count; if (time() > $end_time) { //well come to the end of the scripts useful life exit; } }
$template = 'myriad.tpl'; $myriad = isset($_GET['myriad']) && ctype_upper($_GET['myriad']) ? $_GET['myriad'] : ''; if (empty($myriad)) { $db = NewADOConnection($GLOBALS['DSN']); $myriad = $db->getOne("select prefix from gridprefix where landcount > 0 order by rand()"); } $cacheid = $myriad; //regenerate? if (!$smarty->is_cached($template, $cacheid)) { require_once 'geograph/map.class.php'; require_once 'geograph/mapmosaic.class.php'; if (!$db) { $db = NewADOConnection($GLOBALS['DSN']); } $prefix = $db->getRow("select * from gridprefix where prefix= '{$myriad}'"); $mosaic = new GeographMapMosaic(); //start with same params $mosaic->setScale(4); $mosaic->setMosaicFactor(2); $mosaic->setOrigin($prefix['origin_x'], $prefix['origin_y']); $mosaic->type_or_user = -1; $smarty->assign('token', $mosaic->getToken()); $left = $prefix['origin_x']; $right = $prefix['origin_x'] + $prefix['width'] - 1; $top = $prefix['origin_y'] + $prefix['height'] - 1; $bottom = $prefix['origin_y']; $rectangle = "'POLYGON(({$left} {$bottom},{$right} {$bottom},{$right} {$top},{$left} {$top},{$left} {$bottom}))'"; $sql_where .= "CONTAINS(GeomFromText({$rectangle}),point_xy)"; $sql_where .= ' and gs.reference_index = ' . $prefix['reference_index'] . ' '; $gridsquare = $db->getRow("select * from gridsquare gs where {$sql_where} and imagecount > 3 and imagecount < 20 order by rand() limit 1"); $smarty->assign_by_ref('gridsquare', $gridsquare);
$miny = $prefix['origin_y']; $maxy = $prefix['origin_y'] + $prefix['height'] - 1; $crit = "map_x between {$minx} and {$maxx} and " . "map_y between {$miny} and {$maxy} and " . "pixels_per_km >= 40 and " . "((map_x-{$prefix['origin_x']}) mod 5) != 0 and " . "((map_y-{$prefix['origin_y']}) mod 5) != 0"; $count = $mosaic->deleteBySql($crit, $dummy, $basemap); print "Deleted {$count}<br>"; flush(); $total += $count; list($usec, $sec) = explode(' ', microtime()); $GLOBALS['STARTTIME'] = (double) $usec + (double) $sec; } print "<h2>Total: {$total}</h2>"; exit; } elseif (isset($_POST['inv'])) { $square = new GridSquare(); require_once 'geograph/mapmosaic.class.php'; $mosaic = new GeographMapMosaic(); $smarty->display('_std_begin.tpl'); echo "<h3><a href=\"recreatemaps.php\"><<</a> Invalidating Maps...</h3>"; flush(); $squares = explode(",", $_POST['gridref']); $user_id = intval($_POST['user_id']); if ($user_id > 0) { $and_crit = " and (type_or_user = {$user_id} or type_or_user = 0)"; } else { $and_crit = " and type_or_user = 0"; } $ADODB_FETCH_MODE = ADODB_FETCH_ASSOC; $basemap = isset($_POST['base']); foreach ($squares as $gridref) { $grid_ok = $square->setGridRef($gridref); if (!$grid_ok) {
$profile = new GeographUser($u); $smarty->assign_by_ref('profile', $profile); $smarty->assign_by_ref('u', $u); } if (!$smarty->is_cached($template, $cacheid)) { $db = NewADOConnection($GLOBALS['DSN']); if (!$db) { die('Database connection failed'); } #$db->debug = true; require_once 'geograph/gridsquare.class.php'; $smarty->assign('users_submitted', $db->GetOne("select count(*)-1 from user_stat")); $smarty->assign('users_thisweek', $db->GetOne("select count(*) from user where rights>0 and (unix_timestamp(now())-unix_timestamp(signup_date))<604800")); $smarty->assign("images_ftf", $db->GetOne("select points from user_stat where user_id = 0")); //lets add an overview map too $overview = new GeographMapMosaic('overview'); $overview->assignToSmarty($smarty, 'overview'); $stats = array(); foreach ($CONF['references_all'] as $ri => $rname) { $stats[$ri] = array(); } foreach ($CONF['references'] as $ri => $rname) { $letterlength = $CONF['gridpreflen'][$ri]; $newstats = $db->CacheGetRow(3 * 3600, "select \n\t\t\tcount(*) as squares_total,\n\t\t\tsum(imagecount) as images_total,\n\t\t\tsum(imagecount > 0) as squares_submitted,\n\t\t\tcount(distinct concat(substring(grid_reference,1," . ($letterlength + 1) . "),substring(grid_reference," . ($letterlength + 3) . ",1))) as tenk_total\n\t\tfrom gridsquare \n\t\twhere reference_index = {$ri} and percent_land > 0"); $stats[$ri] = array_merge($stats[$ri], $newstats); $newstats = $db->CacheGetRow(3 * 3600, "select \n\t\t\tcount(*) as geographs_submitted,\n\t\t\tcount(distinct substring(grid_reference,1,{$letterlength})) as grid_submitted,\n\t\t\tcount(distinct concat(substring(grid_reference,1," . ($letterlength + 1) . "),substring(grid_reference," . ($letterlength + 3) . ",1))) as tenk_submitted,\n\t\t\tavg( x ) as x,\n\t\t\tavg( y ) as y\n\t\tfrom gridsquare \n\t\twhere reference_index = {$ri} and percent_land > 0 and has_geographs > 0"); $stats[$ri] = array_merge($stats[$ri], $newstats); $stats[$ri] += array('images_thisweek' => $db->CacheGetOne(3 * 3600, "select count(*) from gridimage_search where reference_index = {$ri} and (unix_timestamp(now())-unix_timestamp(submitted))<604800")); $stats[$ri] += array("grid_total" => $db->CacheGetOne(24 * 3600, "select count(*) from gridprefix where reference_index = {$ri} and landcount > 0")); $censquare = new GridSquare(); $ok = $censquare->loadFromPosition(intval($stats[$ri]['x']), intval($stats[$ri]['y']));
//render and return a map with token $_GET['map']; $map = new GeographMap(); if (isset($_GET['refresh']) && $_GET['refresh'] == 2 && (init_session() || true) && $USER->hasPerm('admin')) { $map->caching = false; } $map->setToken($_GET['map']); $map->returnImage(); exit; } init_session(); $template = 'mapbrowse.tpl'; $smarty = new GeographPage(); customGZipHandlerStart(); //initialise mosaic $mosaic = new GeographMapMosaic(); $overview = new GeographMapMosaic('overview'); if (isset($_GET['o'])) { $overview->setToken($_GET['o']); } if (isset($_GET['t'])) { $mosaic->setToken($_GET['t']); } else { if ($overview->type_or_user) { $mosaic->type_or_user = $overview->type_or_user; } } if (preg_match('/\\?([0-9]+),([0-9]+)$/', $_SERVER['QUERY_STRING'], $matchs)) { $_GET['x'] = $matchs[1]; $_GET['y'] = $matchs[2]; } if (isset($_GET['mine']) && $USER->hasPerm("basic")) {
} } } $smarty->assign_by_ref('data', $data); $smarty->assign_by_ref('searchdesc', $searchdesc); //geotag the page require_once 'geograph/conversions.class.php'; $conv = new Conversions(); list($lat, $long) = $conv->gridsquare_to_wgs84($square); $smarty->assign('lat', $lat); $smarty->assign('long', $long); $smarty->assign_by_ref('square', $square); //get a token to show a suroudding geograph map $mosaic = new GeographMapMosaic(); $smarty->assign('map_token', $mosaic->getGridSquareToken($square)); //lets add an overview map too $overview = new GeographMapMosaic('largeoverview'); $overview->setCentre($square->x, $square->y); //does call setAlignedOrigin #$smarty->assign('marker', $overview->getSquarePoint($square)); //actully lets make it the approximate size! $mosaic = new GeographMapMosaic('overview'); $mosaic->setMosaicSize($d * 2, $d * 2); $mosaic->setScale($overview->pixels_per_km); #$mosaic->setCentre($square->x,$square->y); //does call setAlignedOrigin which we dont want! $mosaic->setOrigin($square->x - $d, $square->y - $d); $smarty->assign('marker', $overview->getBoundingBox($mosaic)); $overview->assignToSmarty($smarty, 'overview'); } } $smarty->display($template, $cacheid);
} } if (isset($en) && count($en)) { list($gridref, $len) = $conv->national_to_gridref($en[0], $en[1], 0, $reference_index); $square = new GridSquare(); if ($square->setByFullGridRef($gridref)) { //find a possible place $smarty->assign('place', $square->findNearestPlace(135000)); //lets add an overview map too $overview = new GeographMapMosaic('largeoverview'); $overview->setCentre($square->x, $square->y); //does call setAlignedOrigin $overview->assignToSmarty($smarty, 'overview'); $smarty->assign('marker', $overview->getSquarePoint($square)); //get a token to show a suroudding geograph map $mosaic = new GeographMapMosaic(); $smarty->assign('map_token', $mosaic->getGridSquareToken($square)); } $smarty->assign('gridref', $gridref); list($gridref, $len) = $conv->national_to_gridref($en[0], $en[1], 4, $reference_index); $smarty->assign('gridref4', $gridref); $smarty->assign('e', $en[0]); $smarty->assign('n', $en[1]); } else { $smarty->assign('errormgs', $MESSAGES['latlong']['outside_area']); } $smarty->assign('lat', $_GET['lat']); $smarty->assign('long', $_GET['long']); $conv->wgs84_to_friendly_smarty_parts($_GET['lat'], $_GET['long'], $smarty); } $smarty->assign('datum', $_GET['datum']);
$smarty->caching = 2; // lifetime is per cache $smarty->cache_lifetime = 3600 * 6; //6hr cache } $smarty->assign_by_ref('references_real', $CONF['references']); if (!$smarty->is_cached($template, $cacheid)) { $db = NewADOConnection($GLOBALS['DSN']); if (!$db) { die('Database connection failed'); } #$db->debug = true; $mosaic = new GeographMapMosaic(); $mosaic->setScale(40); $mosaic->setMosaicFactor(2); $largemosaic = new GeographMapMosaic(); $largemosaic->setScale(80); $largemosaic->setMosaicFactor(2); $largemosaic->setMosaicSize(800, 800); $censquare = new GridSquare(); function cmp($a, $b) { if ($a['sort'] == $b['dateraw']) { return 0; } return $a['dateraw'] > $b['dateraw'] ? -1 : 1; } $db->Execute("TRUNCATE hectad_complete"); $mostarray = array(); foreach ($CONF['references'] as $ri => $rname) { $letterlength = $CONF['gridpreflen'][$ri];
/** * get a url that will zoom us out one level from this gridsquare * @access public */ function getGridSquareToken($gridsquare) { if (is_numeric($gridsquare)) { $id = $gridsquare; $gridsquare = new GridSquare(); $gridsquare->loadFromId($id); } $out = new GeographMapMosaic(); //start with same params $out->setScale(40); $out->setMosaicFactor(2); $out->setCentre($gridsquare->x, $gridsquare->y, true); //true to align to 10x10 map return $out->getToken(); }
* 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/gridsquare.class.php'; require_once 'geograph/gridimage.class.php'; require_once 'geograph/map.class.php'; require_once 'geograph/mapmosaic.class.php'; init_session(); $template = 'maplarge.tpl'; $smarty = new GeographPage(); $smarty->caching = 2; // lifetime is per cache //initialise mosaic $mosaic = new GeographMapMosaic(); $overview = new GeographMapMosaic('overview'); if (isset($_GET['o'])) { $overview->setToken($_GET['o']); } if (isset($_GET['t'])) { $ok = $mosaic->setToken($_GET['t']); if (!$ok) { die("Invalid Token"); } } else { die("Missing Token"); } if ($mosaic->pixels_per_km == 80) { $smarty->cache_lifetime = 3600 * 24 * 7; //7 day cache } elseif ($mosaic->mosaic_factor == 4) {
* as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * 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/mapmosaic.class.php'; init_session(); $mosaic = new GeographMapMosaic(); $mosaic->pixels_per_km = 40; if (isset($_GET['random'])) { $db = NewADOConnection($GLOBALS['DSN']); $count = $db->cacheGetOne(86400, "SELECT COUNT(*) FROM gridsquare WHERE reference_index=1 AND percent_land = 100"); $offset = rand(0, $count); $str = $db->getOne("SELECT AsText(point_xy) FROM gridsquare WHERE reference_index=1 AND percent_land = 100 AND gridsquare_id > {$offset}"); //limit 1 is added automaticallu preg_match('/\\((\\d+) (\\d+)\\)/', $str, $m); if ($str && $m[1]) { $mapw = $mosaic->image_w / $mosaic->pixels_per_km / 2; $mosaic->setOrigin($m[1] - $mapw, $m[2] - $mapw); } $token = $mosaic->getToken(); $cacheid = 'mapper|' . $token; } elseif (isset($_GET['t'])) {
function assignToSmarty($smarty) { global $CONF; $taken = $this->getFormattedTakenDate(); //get the grid references $this->getSubjectGridref(true); $this->getPhotographerGridref(true); //remove grid reference from title $this->bigtitle = trim(preg_replace("/^{$this->grid_reference}/", '', $this->title)); $this->bigtitle = preg_replace('/(?<![\\.])\\.$/', '', $this->bigtitle); $rid = $this->grid_square->reference_index; $gridrefpref = $CONF['gridrefname'][$rid]; $smarty->assign('page_title', $this->bigtitle . ":: {$gridrefpref}{$this->grid_reference}"); $smarty->assign('image_taken', $taken); $smarty->assign('ismoderator', $ismoderator); $smarty->assign_by_ref('image', $this); //get a token to show a suroudding geograph map $mosaic = new GeographMapMosaic(); $smarty->assign('map_token', $mosaic->getGridSquareToken($this->grid_square)); //find a possible place within 25km $place = $this->grid_square->findNearestPlace(75000); $smarty->assign_by_ref('place', $place); if (empty($this->comment)) { $smarty->assign('meta_description', "{$this->grid_reference} :: {$this->bigtitle}, " . strip_tags(smarty_function_place(array('place' => $place)))); } else { $smarty->assign('meta_description', $this->comment); } if (!empty($CONF['forums'])) { //let's find posts in the gridref discussion forum $this->grid_square->assignDiscussionToSmarty($smarty); } //count the number of photos in this square $smarty->assign('square_count', $this->grid_square->imagecount); //lets add an overview map too $overview = new GeographMapMosaic('largeoverview'); $overview->setCentre($this->grid_square->x, $this->grid_square->y); //does call setAlignedOrigin $overview->assignToSmarty($smarty, 'overview'); $smarty->assign('marker', $overview->getSquarePoint($this->grid_square)); require_once 'geograph/conversions.class.php'; $conv = new Conversions(); list($lat, $long) = $conv->gridsquare_to_wgs84($this->grid_square); $smarty->assign('lat', $lat); $smarty->assign('long', $long); list($latdm, $longdm) = $conv->wgs84_to_friendly($lat, $long); $smarty->assign('latdm', $latdm); $smarty->assign('longdm', $longdm); //lets add an rastermap too $rastermap = new RasterMap($this->grid_square, false); $rastermap->addLatLong($lat, $long); if (!empty($this->viewpoint_northings)) { $rastermap->addViewpoint($this->viewpoint_refindex, $this->viewpoint_eastings, $this->viewpoint_northings, $this->viewpoint_grlen, $this->view_direction); } elseif (isset($this->view_direction) && strlen($this->view_direction) && $this->view_direction != -1) { $rastermap->addViewDirection($this->view_direction); } $smarty->assign_by_ref('rastermap', $rastermap); $smarty->assign('x', $this->grid_square->x); $smarty->assign('y', $this->grid_square->y); if ($this->view_direction > -1) { $smarty->assign('view_direction', $this->view_direction % 90 == 0 ? strtoupper(heading_string($this->view_direction)) : ucwords(heading_string($this->view_direction))); } $level = $this->grid_square->imagecount > 1 ? 6 : 5; $smarty->assign('sitemap', getSitemapFilepath($level, $this->grid_square)); }