Example #1
0
<?php

/**
 * $Project: GeoGraph $
 * $Id$
 * 
 * GeoGraph geographic photo archive project
 * This file copyright (C) 2005 Barry Hunter (geo@barryhunter.co.uk)
 * 
 * This program is free software; you can redistribute it and/or
 * modify it under the terms of the GNU General Public License
 * 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';
init_session();
$USER->mustHavePerm("basic");
$u = isset($_GET['u']) && is_numeric($_GET['u']) ? intval($_GET['u']) : $USER->user_id;
$smarty = new GeographPage();
$smarty->assign('user_id', $u);
$smarty->display('explore_timeline.tpl');
Example #2
0
 * 
 * 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';
init_session();
$USER->mustHavePerm("admin");
$smarty = new GeographPage();
$db = NewADOConnection($GLOBALS['DSN']);
$smarty->display('_std_begin.tpl');
flush();
if (isset($_GET['getExtendedStats'])) {
    $a = $memcache->getExtendedStats();
    $a = array_reverse($a);
    print "<h2>Overview Memcache Statistics</h2>";
    print "<table border=1 cellspacing=0>";
    if (isset($_GET['r'])) {
        print "<tr>";
        print "<th>server</th>";
        foreach ($a as $name => $row) {
            print "<th>{$name}</th>";
        }
        print "</tr>";
        $keys = array_keys($a);
        $keys = array_keys($a[$keys[0]]);
Example #3
0
 * 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';
init_session();
$smarty = new GeographPage();
if (empty($_GET['page']) || preg_match('/[^\\w\\.\\,-]/', $_GET['page'])) {
    $smarty->display('static_404.tpl');
    exit;
}
$isadmin = $USER->hasPerm('moderator') ? 1 : 0;
$template = 'article_article.tpl';
$cacheid = 'articles|' . $_GET['page'];
$cacheid .= '|' . $USER->hasPerm('moderator') ? 1 : 0;
$cacheid .= '-' . (isset($_SESSION['article_urls']) && in_array($_GET['page'], $_SESSION['article_urls']) ? 1 : 0);
if (isset($_SESSION[$_GET['page']])) {
    $cacheid .= '-' . $_SESSION[$_GET['page']];
}
if (!empty($_GET['epoch']) && preg_match('/^[\\w]+$/', $_GET['epoch'])) {
    $cacheid .= "--" . $_GET['epoch'];
} else {
    $_GET['epoch'] = '';
}
 * 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';
init_session();
$USER->mustHavePerm("admin");
$smarty = new GeographPage();
$db = NewADOConnection($GLOBALS['DSN']);
$from = isset($_POST['from']) ? $_POST['from'] : $CONF['photo_hashing_secret'];
$to = isset($_POST['to']) ? $_POST['to'] : $CONF['photo_hashing_secret'];
//do some processing?
if (isset($_POST['go'])) {
    //this takes a long time, so we output a header first of all
    $smarty->display('_std_begin.tpl');
    echo "<h3><a href=\"hashchanger.php\">&lt;&lt;</a> Changing image hashes...</h3>";
    flush();
    set_time_limit(3600 * 24);
    $recordSet =& $db->Execute("select * from gridimage");
    while (!$recordSet->EOF) {
        $image = new GridImage();
        $image->loadFromRecordset($recordSet);
        $CONF['photo_hashing_secret'] = $from;
        $oldfile = $image->_getFullpath();
        if ($oldfile != '/photos/error.jpg' && file_exists($_SERVER['DOCUMENT_ROOT'] . $oldfile)) {
            $CONF['photo_hashing_secret'] = $to;
            $image->storeImage($_SERVER['DOCUMENT_ROOT'] . $oldfile, true);
            $newfile = $image->_getFullpath();
            echo "<li>renamed {$oldfile}<br>to {$newfile}</li>";
            flush();
Example #5
0
if (isset($_REQUEST['inner'])) {
    $cacheid = 'iframe';
    $smarty->assign('inner', 1);
} else {
    $cacheid = '';
}
if (isset($_REQUEST['picasa'])) {
    $cacheid .= 'picasa';
    $smarty->assign('picasa', 1);
} elseif (isset($_REQUEST['submit2'])) {
    $cacheid .= 'submit2';
    $smarty->assign('submit2', 1);
}
if (!empty($_REQUEST['grid_reference'])) {
    $square = new GridSquare();
    $ok = $square->setByFullGridRef($_REQUEST['grid_reference']);
    if ($ok) {
        $smarty->assign('grid_reference', $grid_reference = $_REQUEST['grid_reference']);
        $smarty->assign('success', 1);
    } else {
        $smarty->assign('errormsg', $square->errormsg);
    }
}
$smarty->assign('lat0', $CONF['gmcentre'][0]);
$smarty->assign('lon0', $CONF['gmcentre'][1]);
$smarty->assign('latmin', $CONF['gmlatrange'][0][0]);
$smarty->assign('latmax', $CONF['gmlatrange'][0][1]);
$smarty->assign('lonmin', $CONF['gmlonrange'][0][0]);
$smarty->assign('lonmax', $CONF['gmlonrange'][0][1]);
$smarty->display('submitmap.tpl', $cacheid);
 * 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();
$USER->mustHavePerm("admin");
$smarty = new GeographPage();
$db = NewADOConnection($GLOBALS['DSN']);
if (isset($_GET['check2'])) {
    set_time_limit(3600 * 24);
    //this takes a long time, so we output a header first of all
    $smarty->display('_std_begin.tpl');
    echo "<h3><a href=\"recreatemaps.php\">&lt;&lt;</a> Checking Missing GD images...</h3>";
    flush();
    $base =& $_SERVER['DOCUMENT_ROOT'];
    $size = 40;
    $sql = "select gridsquare_id,grid_reference from gridsquare where imagecount>0";
    $recordSet =& $db->Execute($sql);
    while (!$recordSet->EOF) {
        $sql2 = "select * from gridimage where gridsquare_id={$recordSet->fields['gridsquare_id']} " . "and moderation_status<>'rejected' order by moderation_status+0 desc,seq_no limit 1";
        $recordSet2 =& $db->Execute($sql2);
        if ($recordSet2->fields['gridimage_id']) {
            $image = new GridImage();
            $image->fastInit($recordSet2->fields);
            $yz = sprintf("%02d", floor($this->gridimage_id / 1000000));
            $ab = sprintf("%02d", floor($this->gridimage_id % 1000000 / 10000));
            $cd = sprintf("%02d", floor($image->gridimage_id % 10000 / 100));
Example #7
0
    require_once 'geograph/gridsquare.class.php';
}
require_once 'geograph/uploadmanager.class.php';
init_session();
$uploadmanager = new UploadManager();
//display preview image?
if (isset($_GET['preview'])) {
    $uploadmanager->outputPreviewImage($_GET['preview']);
    exit;
}
list($usec, $sec) = explode(' ', microtime());
$GLOBALS['STARTTIME'] = (double) $usec + (double) $sec;
$square = new GridSquare();
$smarty = new GeographPage();
if (!$USER->hasPerm("basic")) {
    $smarty->display('static_submit_intro.tpl');
    exit;
}
if (isset($_SESSION['tab'])) {
    $selectedtab = $_SESSION['tab'];
} else {
    $selectedtab = 1;
}
$step = isset($_POST['step']) ? intval($_POST['step']) : 1;
if (!empty($_FILES['jpeg_exif']) && $_FILES['jpeg_exif']['error'] != UPLOAD_ERR_NO_FILE) {
    //Submit Step 1a..
    switch ($_FILES['jpeg_exif']['error']) {
        case 0:
            if (!filesize($_FILES['jpeg_exif']['tmp_name'])) {
                $smarty->assign('error', 'Sorry, no file was received - please try again');
            } elseif ($uploadmanager->processUpload($_FILES['jpeg_exif']['tmp_name'])) {
Example #8
0
<?php

/**
 * $Project: GeoGraph $
 * $Id: faq.php 15 2005-02-16 12:23:35Z lordelph $
 * 
 * GeoGraph geographic photo archive project
 * This file copyright (C) 2005 Paul Dixon (paul@elphin.com)
 * 
 * This program is free software; you can redistribute it and/or
 * modify it under the terms of the GNU General Public License
 * 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';
init_session();
$smarty = new GeographPage();
$smarty->display('activities.tpl');
Example #9
0
<?php

/**
 * $Project: GeoGraph $
 * $Id$
 * 
 * GeoGraph geographic photo archive project
 * This file copyright (C) 2005 Paul Dixon (paul@elphin.com)
 * 
 * This program is free software; you can redistribute it and/or
 * modify it under the terms of the GNU General Public License
 * 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';
init_session();
$USER->logout();
$smarty = new GeographPage();
$smarty->display('logout.tpl');
Example #10
0
if (!$smarty->is_cached('explore.tpl')) {
    if (!$db) {
        $db = NewADOConnection($GLOBALS['DSN']);
        if (!$db) {
            die('Database connection failed');
        }
    }
    $countylist = array();
    $recordSet =& $db->Execute("SELECT reference_index,county_id,name FROM loc_counties WHERE n > 0");
    while (!$recordSet->EOF) {
        $countylist[$CONF['references'][$recordSet->fields[0]]][$recordSet->fields[1]] = $recordSet->fields[2];
        $recordSet->MoveNext();
    }
    $recordSet->Close();
    $smarty->assign_by_ref('countylist', $countylist);
    $topicsraw = $db->GetAssoc("select gp.topic_id,concat(topic_title,' [',count(*),']') as title,forum_name from gridimage_post gp\n\t\tinner join geobb_topics using (topic_id)\n\t\tinner join geobb_forums using (forum_id)\n\t\tgroup by gp.topic_id \n\t\thaving count(*) > 4\n\t\torder by geobb_topics.forum_id desc,topic_title");
    $topics = array("1" => "Any Topic");
    $options = array();
    foreach ($topicsraw as $topic_id => $row) {
        if ($last != $row['forum_name'] && $last) {
            $topics[$last] = $options;
            $options = array();
        }
        $last = $row['forum_name'];
        $options[$topic_id] = $row['title'];
    }
    $topics[$last] = $options;
    $smarty->assign_by_ref('topiclist', $topics);
}
$smarty->display('explore.tpl');
Example #11
0
    if ($image2->moderation_status != 'rejected') {
        $rastermap2 = new RasterMap($image2->grid_square);
        if ($image2->view_direction > -1) {
            $smarty->assign('view_direction2', $image2->view_direction % 90 == 0 ? strtoupper(heading_string($image2->view_direction)) : ucwords(heading_string($image2->view_direction)));
        }
        list($lat, $long) = $conv->gridsquare_to_wgs84($image2->grid_square);
        $smarty->assign('lat2', $lat);
        $smarty->assign('long2', $long);
        list($latdm, $longdm) = $conv->wgs84_to_friendly($lat, $long);
        $smarty->assign('latdm2', $latdm);
        $smarty->assign('longdm2', $longdm);
        $smarty->assign_by_ref('image2', $image2);
        $smarty->assign_by_ref('rastermap2', $rastermap2);
    }
    $updates = array();
    $updates['user_id'] = $USER->user_id;
    $updates['compare_pair_id'] = $pair['compare_pair_id'];
    $updates['ua'] = $_SERVER['HTTP_USER_AGENT'];
    $db->Execute('REPLACE INTO compare_done SET `ipaddr` = INET_ATON(\'' . getRemoteIP() . '\'),`' . implode('` = ?,`', array_keys($updates)) . '` = ?', array_values($updates));
} elseif (isset($_GET['again']) && !isset($_GET['t'])) {
    $pair = $db->getRow("\r\n\t\tDELETE FROM compare_done\r\n\t\tWHERE {$where}", $a);
    header("Location: " . $_SERVER['PHP_SELF'] . (isset($_GET['v']) ? '?v' : ''));
    exit;
}
if (isset($_GET['v'])) {
    $tamplate = 'activities_compare_v.tpl';
} else {
    $tamplate = 'activities_compare.tpl';
}
$smarty->display($tamplate);
            //it worked!
            break;
        }
        if (!empty($game->image)) {
            unset($game->image);
        }
        if (!empty($game->rastermap)) {
            unset($game->rastermap);
        }
        $keys = array_keys($game->images);
    }
    $game->points = 5;
    if ($USER->hasPerm("basic") && isset($_REQUEST['rater'])) {
        $smarty->assign('rater', 1);
    }
} else {
    $smarty->assign('message', 'no images left');
    if (!empty($game->image)) {
        unset($game->image);
    }
    if (!empty($game->rastermap)) {
        unset($game->rastermap);
    }
}
$smarty->assign('gameToken', $game->getToken(3600));
if (!empty($_SESSION['thisGamePoints']) && $_SESSION['thisGameImageID'] == $game->image->gridimage_id) {
    $game->points = $_SESSION['thisGamePoints'];
}
$smarty->assign_by_ref('game', $game);
$smarty->display('games_place-memory.tpl');
Example #13
0
                $db->Execute($sql);
                //correct the temp value
                $message .= "<p>Updating '<i>-" . $_POST['new' . $c] . "</i>' to '<b>" . $_POST['new' . $c] . "</b>'.</p>";
                $sql = "UPDATE gridimage SET `imageclass` = " . $db->Quote($_POST['new' . $c]) . " WHERE `imageclass` = '-" . $_POST['new' . $c] . "'";
                $db->Execute($sql);
                $sql = "UPDATE gridimage_search SET `imageclass` = " . $db->Quote($_POST['new' . $c]) . " WHERE `imageclass` = " . $db->Quote("-" . $_POST['new' . $c]);
                $db->Execute($sql);
                //we already have done the swap so dont want it to happen on the next iteration
                $skip[$_POST['new' . $c]]++;
            } else {
                $message .= "<p>Updating '<i>" . $_POST['old' . $c] . "</i>' to '<b>" . $_POST['new' . $c] . "</b>'.</p>";
                $sql = "UPDATE gridimage SET `imageclass` = " . $db->Quote($_POST['new' . $c]) . " WHERE `imageclass` = " . $db->Quote($_POST['old' . $c]);
                $db->Execute($sql);
                $sql = "UPDATE gridimage_search SET `imageclass` = " . $db->Quote($_POST['new' . $c]) . " WHERE `imageclass` = " . $db->Quote($_POST['old' . $c]);
                $db->Execute($sql);
            }
        }
    }
    $message .= "<p>All values updated</p>";
    $smarty->assign('message', $message);
}
$where = '';
if (!empty($_REQUEST['q'])) {
    $a = explode(' ', preg_replace("/[^ \\w'\\(\\)]+/", '', $_REQUEST['q']));
    $where = " AND (imageclass LIKE '%" . implode("%' OR imageclass LIKE '%", $a) . "%' )";
    $smarty->assign('q', implode(" ", $a));
}
$arr = $db->GetAssoc("select imageclass,count(*) from gridimage where moderation_status != 'rejected' {$where} group by imageclass");
$smarty->assign('arr', $arr);
$smarty->display('admin_categories.tpl');
Example #14
0
<?php

/**
 * $Project: GeoGraph $
 * $Id: faq.php 15 2005-02-16 12:23:35Z lordelph $
 * 
 * GeoGraph geographic photo archive project
 * This file copyright (C) 2005 Paul Dixon (paul@elphin.com)
 * 
 * This program is free software; you can redistribute it and/or
 * modify it under the terms of the GNU General Public License
 * 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';
init_session();
$smarty = new GeographPage();
$smarty->display('teachers.tpl');
 * 
 * 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');
Example #16
0
                $eastings = $matches[2];
                $northings = $matches[3];
                $sql = "select * from gridprefix where prefix='{$gridsquare}' limit 1";
                $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) " . "values({$x},{$y},{$percent},'{$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']));
                    if ($isadmin) {
                        require_once 'geograph/mapmosaic.class.php';
                        $mosaic = new GeographMapMosaic();
                        $mosaic->expirePosition($x, $y, 0, true);
                    }
                } else {
                    $smarty->assign('gridref_error', "Error, please try again later");
                }
            }
            $smarty->assign('percent_land', $percent);
        }
    } else {
        $smarty->assign_by_ref('gridref', strip_tags($_GET['gridref']));
        $smarty->assign('gridref_error', "Bad or unknown grid reference");
    }
    $smarty->assign('gridref_ok', $ok ? 1 : 0);
}
$smarty->display('mapfixer.tpl');
Example #17
0
 if (isset($_GET['u']) && preg_match('/^[0-9]+$/', $_GET['u'])) {
     $uid = $_GET['u'];
 } elseif (isset($_GET['id']) && preg_match('/^[0-9]+$/', $_GET['id'])) {
     $uid = $_GET['id'];
 } elseif (isset($_GET['user']) && isValidRealName($_GET['user'])) {
     if ($_GET['user'] == $USER->nickname) {
         $uid = $USER->user_id;
     } else {
         $profile = new GeographUser();
         $profile->loadByNickname($_GET['user']);
         $uid = $profile->user_id;
     }
     if ($uid == 0) {
         header("HTTP/1.0 404 Not Found");
         header("Status: 404 Not Found");
         $smarty->display('static_404.tpl');
         exit;
     }
 }
 if ($uid == 0 || $uid == $USER->user_id) {
     //no uid given, so we'll assume user was trying to access their own
     //profile, in which case, they must login...
     $USER->login();
     //to reach here, user must be logged in...
     $uid = $USER->user_id;
     if (isset($_GET['hide_message'])) {
         #header("HTTP/1.0 200 OK");
         #header("Content-Length: 0");
         $USER->countTickets();
         $_SESSION['last_ticket_time'] = $USER->last_ticket_time;
         print '1';
Example #18
0
 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
 */
require_once 'geograph/global.inc.php';
require_once 'geograph/event.class.php';
init_session();
$smarty = new GeographPage();
$USER->mustHavePerm("admin");
$db = NewADOConnection($GLOBALS['DSN']);
if (!$db) {
    die('Database connection failed');
}
if (isset($_GET['showlogs'])) {
    $event_id = intval($_GET['showlogs']);
    $smarty->assign('logs', $db->GetAll("select * from event_log where event_id={$event_id} order by logtime"));
    $smarty->assign('handlers', $db->GetAll("select * from event_handled_by where event_id={$event_id}"));
    $smarty->display('admin_eventlog.tpl');
    exit;
}
if (isset($_POST['fire'])) {
    Event::fire(stripslashes($_POST['event_name']), stripslashes($_POST['event_param']), stripslashes($_POST['event_priority']));
    $smarty->assign('event_name', stripslashes($_POST['event_name']));
    $smarty->assign('event_param', stripslashes($_POST['event_param']));
    $smarty->assign('event_priority', stripslashes($_POST['event_priority']));
    $smarty->assign('event_fired', 1);
}
//gather some stats
$smarty->assign('count_pending', $db->GetOne("select count(*) from event where status='pending'"));
$smarty->assign('count_inprogress', $db->GetOne("select count(*) from event where status='in_progress'"));
$smarty->assign('count_recent', $db->GetOne("select count(*) from event where status='completed' and (unix_timestamp(now())-unix_timestamp(processed))<3600"));
$smarty->assign('stat_recent', $db->GetOne("select avg(unix_timestamp(processed)-unix_timestamp(posted)) from event where status='completed' and (unix_timestamp(now())-unix_timestamp(processed))<3600"));
//build list of events - gather search parameters
Example #19
0
<?php

/**
 * $Project: GeoGraph $
 * $Id: search.php 2403 2006-08-16 15:55:41Z barry $
 * 
 * GeoGraph geographic photo archive project
 * This file copyright (C) 2005 Barry Hunter (geo@barryhunter.co.uk)
 * 
 * This program is free software; you can redistribute it and/or
 * modify it under the terms of the GNU General Public License
 * 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/gridimage.class.php';
require_once 'geograph/gridsquare.class.php';
require_once 'geograph/searchcriteria.class.php';
init_session();
$smarty = new GeographPage();
$smarty->display('games.tpl');
Example #20
0
list($west, $south, $east, $north) = explode(',', trim(str_replace('e ', 'e+', $_GET['BBOX'])));
$span = min($north - $south, $east - $west);
if ($span > 7 || !$span) {
    $smarty = new GeographPage();
    header("Content-type: application/vnd.google-earth.kml+xml");
    $smarty->display("earth_outsidearea.tpl");
    exit;
}
$long = ($east - $west) / 2 + $west;
$lat = ($north - $south) / 2 + $south;
$ire = $lat > 51.2 && $lat < 55.73 && $long > -12.2 && $long < -4.8;
$uk = $lat > 49 && $lat < 62 && $long > -9.5 && $long < 2.3;
if (!$ire && !$uk) {
    $smarty = new GeographPage();
    header("Content-type: application/vnd.google-earth.kml+xml");
    $smarty->display("earth_outsidearea.tpl");
    exit;
}
require_once 'geograph/feedcreator.class.php';
require_once 'geograph/gridimage.class.php';
require_once 'geograph/gridsquare.class.php';
require_once 'geograph/imagelist.class.php';
$format = 'KML';
$rss = new UniversalFeedCreator();
$rss->title = 'Geograph British Isles';
$rss->link = "http://{$_SERVER['HTTP_HOST']}";
require_once 'geograph/searchcriteria.class.php';
require_once 'geograph/searchengine.class.php';
$pg = $_GET['page'];
if ($pg == '' or $pg < 1) {
    $pg = 1;
 * 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';
require_once 'geograph/event.class.php';
init_session();
$USER->mustHavePerm("admin");
$smarty = new GeographPage();
$db = NewADOConnection($GLOBALS['DSN']);
if (isset($_GET['edit_4_linking_post'])) {
    $smarty->display('_std_begin.tpl');
    echo "<h3><a href=\"events.php\">&lt;&lt;</a> Firing Events...</h3>";
    flush();
    $posts = $db->getCol("select post_id from geobb_posts where post_text LIKE '%[[%'");
    foreach ($posts as $post_id) {
        new Event('topic_edit', $post_id);
    }
    $smarty->display('_std_end.tpl');
    exit;
} elseif (isset($_GET['topic_id'])) {
    $smarty->display('_std_begin.tpl');
    echo "<h3><a href=\"events.php\">&lt;&lt;</a> Firing Events...</h3>";
    flush();
    $posts = $db->getCol("select post_id from geobb_posts where topic_id = " . $_GET['topic_id'] . " order by post_id");
    foreach ($posts as $post_id) {
        new Event('topic_edit', $post_id);
    $sql_where = '';
}
$roles = $db->GetAssoc("select if(role != '',role,if(rights like '%admin%','Developer',if(rights like '%moderator%','Moderator','-none-'))) , if(role != '',role,if(rights like '%admin%','Developer',if(rights like '%moderator%','Moderator','-none-'))) from user group by if(role != '',role,if(rights like '%admin%','Developer',if(rights like '%moderator%','Moderator','-none-')))");
$smarty->assign('roles', array('' => '-any-') + $roles);
if (!empty($_GET['show_role'])) {
    $sql_where .= " and if(role != '',role,if(rights like '%admin%','Developer',if(rights like '%moderator%','Moderator','-none-'))) = " . $db->Quote($_GET['show_role']);
    $smarty->assign('show_role', $_GET['show_role']);
}
if (isset($_GET['stats'])) {
    $user = $db->Quote($_GET['stats']);
    $sql_where .= " and user.user_id = {$user}";
}
$moderators = $db->GetAssoc("\r\nselect \r\n\tuser.user_id,user.realname,user.nickname,user.rights,role,substring(user.signup_date,1,10) as signup_date,\r\n\tcount(distinct moderation_log_id) as log_count,\r\n\tsubstring(max(ml.created),1,10) as last_log,\r\n\tmax(ml.created) as last_log_time\r\nfrom user \r\n\tleft join moderation_log ml on (ml.user_id = user.user_id AND ml.type = 'dummy')\r\nwhere length(rights) > 0 AND (rights != 'basic' OR role != '') {$sql_where}\r\ngroup by user.user_id\r\norder by last_log_time desc,user.user_id");
if (isset($_GET['stats'])) {
    $moderatorstats = $db->GetRow("\r\n\tselect user.user_id,user.realname,user.nickname,user.rights,\r\n\t(select count(*) from gridimage_search gi2 where gi2.user_id = user.user_id) as photo_count,\r\n\t(select count(*) from geobb_posts p where p.poster_id = user.user_id) as post_count,\r\n\t(select count(*) from gridimage gi where gi.moderator_id = user.user_id) as count,\r\n\t(select count(*) from gridimage_ticket t where t.moderator_id = user.user_id) as ticket_count\r\n\tfrom user \r\n\twhere user.user_id = {$user}");
    $found = 0;
    foreach ($moderators as $i => $row) {
        if ($row['user_id'] == $moderatorstats['user_id']) {
            $moderators[$i] = array_merge($row, $moderatorstats);
            $found = 1;
            break;
        }
    }
    if (!$found) {
        $moderators[] = $moderatorstats;
    }
    $smarty->assign('stats', $_GET['stats']);
}
$smarty->assign_by_ref('moderators', $moderators);
$smarty->display('admin_moderator_admin.tpl');
Example #23
0
<?php

/**
 * $Project: GeoGraph $
 * $Id$
 * 
 * GeoGraph geographic photo archive project
 * This file copyright (C) 2005 Paul Dixon (paul@elphin.com)
 * 
 * This program is free software; you can redistribute it and/or
 * modify it under the terms of the GNU General Public License
 * 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';
init_session();
$smarty = new GeographPage();
$smarty->display('faq.tpl');
Example #24
0
 * 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/gridshader.class.php';
init_session();
$USER->mustHavePerm("admin");
$smarty = new GeographPage();
$smarty->debugging = false;
//do some processing?
if (isset($_POST['check'])) {
    //this takes a long time, so we output a header first of all
    $smarty->display('_std_begin.tpl');
    echo "<h2><a title=\"Admin home page\" href=\"/admin/index.php\">Admin</a> :Performing Database Check...</h2>";
    flush();
    set_time_limit(3600 * 24);
    $db = NewADOConnection($GLOBALS['DSN']);
    if (!$db) {
        die('Database connection failed');
    }
    if (isset($_POST['dbtables'])) {
        echo "<h3>Database tables</h3><table class=\"report\">";
        echo "<thead><tr><td>Table</td><td>Status</td></tr></thead><tbody>";
        $tables = $db->MetaTables();
        foreach ($tables as $table) {
            $result = $db->GetRow("check table {$table}");
            echo "<tr><td>{$table}</td><td>{$result[2]}:{$result[3]}</td></tr>\n";
            flush();
Example #25
0
if (!empty($_GET['t'])) {
    $template = 'explore_wordnet_simple.tpl';
    $cacheid = "explore|wordnet_simple{$u}." . $len . "." . str_replace(' ', '.', $words);
} else {
    $template = 'explore_wordnet.tpl';
    $cacheid = "explore|wordnet{$u}." . $len . "." . str_replace(' ', '.', $words);
}
$smarty->caching = 2;
// lifetime is per cache
$smarty->cache_lifetime = 3600 * 24;
//24hr cache
if (!$smarty->is_cached($template, $cacheid)) {
    //lets hobble this!
    header("HTTP/1.1 503 Service Unavailable");
    $smarty->assign('searchq', stripslashes($_GET['q']));
    $smarty->display('function_disabled.tpl');
    exit;
    $db = NewADOConnection($GLOBALS['DSN']);
    if (empty($db)) {
        die('Database connection failed');
    }
    $sql_crit = '';
    $extra_link = '&amp;len=' . $len;
    if (!empty($words)) {
        $ids = $db->cachegetAssoc(3600, "SELECT gid,title FROM `wordnet{$len}` WHERE title > 0 AND words = " . $db->Quote(trim($words)));
        if (count($ids)) {
            $sql_crit = " AND gid IN(" . implode(',', array_keys($ids)) . ")";
            $smarty->assign('words', trim($_GET['words']));
        }
    }
    $smarty->assign_by_ref('len', $len);
Example #26
0
                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}";
} else {
    $ADODB_FETCH_MODE = ADODB_FETCH_ASSOC;
    $unknowns = $db->GetAll("select gridsquare_id,grid_reference,imagecount,\n\t\tgroup_concat(comment order by mapfix_log_id SEPARATOR ' | ') as comments,\n\t\tgroup_concat(concat(old_percent_land,'>',new_percent_land) order by mapfix_log_id SEPARATOR ', ') as percents\t\t\n\tfrom gridsquare \n\t\tleft join mapfix_log using (gridsquare_id)\n\twhere percent_land=-1 \n\tgroup by gridsquare_id\n\torder by reference_index asc,imagecount desc");
    $smarty->assign_by_ref('unknowns', $unknowns);
    $smarty->display('admin_mapfixer.tpl');
}
        $group_sql .= 'geobb_posts.topic_id,';
        $column_sql .= "CONCAT('<a href=\"/discuss/?action=vthread&amp;topic=',geobb_posts.topic_id,'\">',topic_title,'</a>') as Topic,";
        $title .= " by topic";
    }
    if (count($where)) {
        $where_sql = " AND " . join(' AND ', $where);
    }
    $ADODB_FETCH_MODE = ADODB_FETCH_ASSOC;
    $table = $db->GetAll("\n\tselect \n\t{$column_sql}\n\tDATE_FORMAT({$column},'%d/%m/%Y') as Date,\n\tcount(*) as Posts,\n\tcount(distinct poster_id) as Users\n\tfrom geobb_posts {$join_sql}\n\twhere 1 {$where_sql}\n\tgroup by {$group_sql} date({$column}) \n\torder by Posts desc limit 50;");
    $title = count($table) . " {$title}";
    $smarty->assign_by_ref('table', $table);
    $smarty->assign("h2title", $title);
    $smarty->assign("total", count($table));
    $extra = array();
    foreach (array('users', 'threads') as $key) {
        if (isset($_GET[$key])) {
            $extra[$key] = $_GET[$key];
        }
    }
    $smarty->assign_by_ref('extra', $extra);
} else {
    if ($u) {
        $profile = new GeographUser($u);
        $smarty->assign_by_ref('profile', $profile);
        $smarty->assign_by_ref('u', $u);
    }
}
$smarty->assign("filter", 2);
$smarty->assign("nosort", 1);
$smarty->display($template, $cacheid);
Example #28
0
$breakdowns = array('' => '', 'imagetaken' => 'Day Taken', 'imagetaken_month' => 'Month Taken', 'imagetaken_year' => 'Year Taken', 'imagetaken_decade' => 'Decade Taken', 'imageclass' => 'Image Category', 'realname' => 'Contributor Name', 'grid_reference' => 'Grid Reference', 'submitted' => 'Day Submitted', 'submitted_month' => 'Month Submitted', 'submitted_year' => 'Year Submitted');
$displayclasses = array('full' => 'full listing', 'more' => 'full listing + links', 'thumbs' => 'thumbnails only', 'thumbsmore' => 'thumbnails + links', 'gmap' => 'on a map', 'slide' => 'slideshow - fullsize', 'reveal' => 'slideshow - map imagine', 'cooliris' => 'cooliris 3d wall', 'mooflow' => 'cover flow', 'text' => 'text list only', 'spelling' => 'spelling utility');
$smarty->assign_by_ref('displayclasses', $displayclasses);
$smarty->assign('pagesizes', array(5, 10, 15, 20, 30, 50));
$smarty->assign_by_ref('imagestatuses', $imagestatuses);
$smarty->assign_by_ref('sortorders', $sortorders);
$smarty->assign_by_ref('breakdowns', $breakdowns);
$pg = !empty($_GET['page']) ? intval(str_replace('/', '', $_GET['page'])) : 0;
if (empty($pg) || $pg < 1) {
    $pg = 1;
}
$engine = new SearchEngine($i);
if ($engine->criteria && $engine->criteria->searchclass == "Special" && ($USER->user_id == $engine->criteria->user_id || $USER->hasPerm('moderator'))) {
    //you can pass!
} else {
    $smarty->display('no_permission.tpl');
    exit;
}
$smarty->assign('i', $i);
$query = (array) $engine->criteria;
$smarty->assign('searchdesc', $query['searchdesc']);
$smarty->assign('count', $engine->getMarkedCount());
if (!empty($_POST['submit'])) {
    $ok = true;
    $dataarray = $_POST;
    if (empty($db)) {
        $db = NewADOConnection($GLOBALS['DSN']);
        if (!$db) {
            die('Database connection failed');
        }
    }
Example #29
0
##foreach ($newtickets as $i => $row) {
#	#	$db->Execute("REPLACE INTO gridimage_moderation_lock SET user_id = {$USER->user_id}, gridimage_id = {$row['gridimage_id']}");
#	if (empty($row['title2']))
#		$ctitle = $row['title'];
#	elseif (empty($row['title']))
#		$ctitle = $row['title2'];
#	else
#		$ctitle = $row['title'] . ' (' . $row['title2'] . ')';
#	$row['title1'] = $row['title'];
#	$row['title'] = $ctitle;
#}
foreach ($newtickets as $i => $row) {
    #	$db->Execute("REPLACE INTO gridimage_moderation_lock SET user_id = {$USER->user_id}, gridimage_id = {$row['gridimage_id']}");
    $ctitle = combineTexts($row['title'], $row['title2']);
    $newtickets[$i]['title'] = $ctitle;
    $newtickets[$i]['title1'] = $row['title'];
}
$smarty->assign_by_ref('newtickets', $newtickets);
if (empty($_GET['locked'])) {
    #################
    # lock images
    foreach ($newtickets as $i => $row) {
        $db->Execute("REPLACE INTO gridimage_moderation_lock SET user_id = {$USER->user_id}, gridimage_id = {$row['gridimage_id']}");
    }
    #############################
    $db->Execute("UNLOCK TABLES");
}
#############################
$template = !empty($_GET['sidebar']) ? 'admin_tickets_sidebar.tpl' : 'admin_tickets.tpl';
$smarty->display($template);
 * 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';
init_session();
$USER->mustHavePerm("admin");
$smarty = new GeographPage();
$db = NewADOConnection($GLOBALS['DSN']);
$dbUpdate = NewADOConnection($GLOBALS['DSN']);
$from = isset($_POST['from']) ? $_POST['from'] : '';
$to = isset($_POST['to']) ? $_POST['to'] : '';
//do some processing?
if (isset($_POST['go'])) {
    //this takes a long time, so we output a header first of all
    $smarty->display('_std_begin.tpl');
    echo "<h3><a href=\"accountmerge.php\">&lt;&lt;</a> Merging accounts...</h3>";
    flush();
    set_time_limit(3600 * 24);
    $realname = $db->Quote($db->GetOne("select realname from user where user_id='{$to}'"));
    if (!empty($_POST['ids'])) {
        $recordSet =& $db->Execute("select * from gridimage where user_id='{$from}' and gridimage_id IN ({$_POST['ids']})");
    } else {
        $recordSet =& $db->Execute("select * from gridimage where user_id='{$from}'");
    }
    while (!$recordSet->EOF) {
        $image = new GridImage();
        $image->loadFromRecordset($recordSet);
        $oldfile = $image->_getFullpath();
        if (file_exists($_SERVER['DOCUMENT_ROOT'] . $oldfile)) {
            $image->user_id = $to;