function processEvent(&$event)
 {
     $db =& $this->_getDB();
     //very easy  -trash any mappings to this topic
     $post_id = $event['event_param'];
     $post = $db->GetRow("select topic_id,post_time from geobb_posts where post_id='{$post_id}'");
     if ($post) {
         //update timestamp of last post
         $db->Execute("update gridsquare_topic set last_post='{$post['post_time']}' where topic_id = '{$post['topic_id']}'");
         //delete any smarty caches for this square
         $gridsquare_id = $db->getOne("select gridsquare_id from gridsquare_topic where topic_id = {$post['topic_id']}");
         if ($gridsquare_id) {
             $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;
 }
 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;
 }
 function processEvent(&$event)
 {
     $db =& $this->_getDB();
     list($gridimage_id, $updatemaps) = explode(',', $event['event_param']);
     $smarty = new GeographPage();
     $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;
 }
 function processEvent(&$event)
 {
     $db =& $this->_getDB();
     $topic_id = $event['event_param'];
     //delete any smarty caches for this square
     $gridsquare_id = $db->getOne("select gridsquare_id from gridsquare_topic where topic_id = {$topic_id}");
     if ($gridsquare_id) {
         $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}");
         }
         // -trash any mappings to this topic
         $db->Execute("delete from gridsquare_topic where topic_id = {$topic_id}");
     }
     //return true to signal completed processing
     //return false to have another attempt later
     return true;
 }
 * 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();
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 {
 * 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';
$smarty = new GeographPage();
$db = NewADOConnection($GLOBALS['DSN']);
if (empty($_REQUEST['key']) || preg_match("/[^\\w\\.]/", $_REQUEST['key'])) {
    die("ERROR: no api key");
}
$sql = "SELECT * FROM `apikeys` WHERE `apikey` = " . $db->Quote($_REQUEST['key']) . " AND (`ip` = INET_ATON('{$_SERVER['REMOTE_ADDR']}') OR `ip` = 0) AND `enabled` = 'Y'";
$profile = $db->GetRow($sql);
if (empty($profile['apikey'])) {
    die("ERROR: invalid api key. please contact us");
}
if (empty($_REQUEST['to'])) {
    if (!empty($_REQUEST['image'])) {
        //initialise message
        require_once 'geograph/gridsquare.class.php';
        require_once 'geograph/gridimage.class.php';
        $image = new GridImage();
 * 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();
$u = isset($_GET['u']) && is_numeric($_GET['u']) ? intval($_GET['u']) : 0;
$w = isset($_GET['w']) && is_numeric($_GET['w']) ? intval($_GET['w']) : 1;
$template = 'hectadmap.tpl';
$cacheid = "{$u}.{$w}";
if ($smarty->caching) {
    $smarty->caching = 2;
    // lifetime is per cache
    $smarty->cache_lifetime = 3600 * 24;
    //24hour cache
}
$maximages = 100;
//percentage AND number of images in a hectad
function smarty_modifier_colerize($input)
{
    global $maximages;
 * 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("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>";
 * 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/wordnet.inc.php';
init_session();
$USER->mustHavePerm("admin");
$smarty = new GeographPage();
$db = NewADOConnection($GLOBALS['DSN']);
//this takes a long time, so we output a header first of all
$smarty->display('_std_begin.tpl');
echo "<h3> ReBuilding Wordnet...</h3>";
flush();
set_time_limit(3600 * 24);
$tim = time();
$recordSet =& $db->Execute("select gridimage_id,title,title2 from gridimage where moderation_status != 'rejected'");
$db->Execute("truncate wordnet1");
$db->Execute("truncate wordnet2");
$db->Execute("truncate wordnet3");
$db->Execute("LOCK TABLES wordnet1 WRITE,wordnet2 WRITE,wordnet3 WRITE");
$db->Execute("ALTER TABLE wordnet1 DISABLE KEYS");
$db->Execute("ALTER TABLE wordnet2 DISABLE KEYS");
$db->Execute("ALTER TABLE wordnet3 DISABLE KEYS");
 * 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';
include_messages('moversboard');
init_session();
$type = isset($_GET['type']) && preg_match('/^\\w+$/', $_GET['type']) ? $_GET['type'] : 'images';
$smarty = new GeographPage();
$template = 'statistics_moversboard.tpl';
$cacheid = $type;
if (!$smarty->is_cached($template, $cacheid)) {
    /////////////
    // in the following code 'geographs' is used a column for legacy reasons, but dont always represent actual geographs....
    require_once 'geograph/gridimage.class.php';
    require_once 'geograph/gridsquare.class.php';
    require_once 'geograph/imagelist.class.php';
    $ADODB_FETCH_MODE = ADODB_FETCH_ASSOC;
    $db = NewADOConnection($GLOBALS['DSN']);
    if (!$db) {
        die('Database connection failed');
    }
    $sql_qtable = array('squares' => array('column' => ''), 'geosquares' => array('column' => ''), 'geographs' => array('column' => "sum(i.moderation_status='geograph')"), 'additional' => array('column' => "sum(i.moderation_status='geograph' and ftf = 0)"), 'supps' => array('column' => "sum(i.moderation_status='accepted')"), 'images' => array('orderby' => ",points desc", 'column' => "sum(i.ftf=1 and i.moderation_status='geograph') as points, sum(i.moderation_status in ('geograph','accepted'))"), 'test_points' => array('column' => "sum((i.moderation_status = 'geograph') + ftf + 1)", 'table' => " gridimage_search i "), 'depth' => array('column' => "count(*)/count(distinct grid_reference)", 'table' => " gridimage_search i ", 'isfloat' => true), 'myriads' => array('column' => "count(distinct substring(grid_reference,1,length(grid_reference)-4))", 'table' => " gridimage_search i "), 'hectads' => array('column' => "count(distinct concat(substring(grid_reference,1,length(grid_reference)-3),substring(grid_reference,length(grid_reference)-1,1)) )", 'table' => " gridimage_search i "), 'days' => array('column' => "count(distinct imagetaken)", 'table' => " gridimage_search i "), 'antispread' => array('column' => "count(*)/count(distinct concat(substring(grid_reference,1,length(grid_reference)-3),substring(grid_reference,length(grid_reference)-1,1)) )", 'table' => " gridimage_search i ", 'isfloat' => true), 'spread' => array('column' => "count(distinct concat(substring(grid_reference,1,length(grid_reference)-3),substring(grid_reference,length(grid_reference)-1,1)) )/count(*)", 'table' => " gridimage_search i ", 'isfloat' => true), 'classes' => array('column' => "count(distinct imageclass)", 'table' => " gridimage_search i "), 'clen' => array('column' => "avg(length(comment))", 'table' => " gridimage_search i ", 'isfloat' => true), 'tlen' => array('column' => "avg(length(title))", 'table' => " gridimage_search i ", 'isfloat' => true), 'category_depth' => array('column' => "count(*)/count(distinct imageclass)", 'table' => " gridimage_search i ", 'isfloat' => true), 'centi' => array('column' => "COUNT(DISTINCT nateastings div 100, natnorthings div 100)", 'where' => "and i.moderation_status='geograph' and nateastings div 1000 > 0"), 'points' => array('column' => "sum(i.ftf=1 and i.moderation_status='geograph')"));
    if (!isset($sql_qtable[$type])) {
Exemple #11
0
 * 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';
include_messages('ecard');
init_session();
$smarty = new GeographPage();
$template = 'ecard.tpl';
//you must be logged in to send e-cards
$USER->mustHavePerm("basic");
//gather what we need
$from_name = isset($_POST['from_name']) ? stripslashes($_POST['from_name']) : $USER->realname;
$from_email = isset($_POST['from_email']) ? stripslashes($_POST['from_email']) : $USER->email;
$to_name = isset($_POST['to_name']) ? stripslashes($_POST['to_name']) : '';
$to_email = isset($_POST['to_email']) ? stripslashes($_POST['to_email']) : '';
$smarty->assign_by_ref('from_name', $from_name);
$smarty->assign_by_ref('from_email', $from_email);
$smarty->assign_by_ref('to_name', $to_name);
$smarty->assign_by_ref('to_email', $to_email);
$db = NewADOConnection($GLOBALS['DSN']);
if (empty($db)) {
    die('Database connection failed');
 * 
 * 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.
 */
if (isset($_SERVER['REDIRECT_SCRIPT_URL']) && preg_match('/120_(ie|ff).gif$/', $_SERVER['REDIRECT_SCRIPT_URL'])) {
    //you can just go away - Gmaps seem to lookup these urls via GGeoXML for somereason...
    header('Content-Length: 0');
    exit;
}
require_once 'geograph/global.inc.php';
init_session();
//get page from request
$page = isset($_GET['page']) ? $_GET['page'] : '404';
//do we trust it? like hell we do! alphanumerics only please!
if (!preg_match('/^[a-z0-9_]+$/', $page)) {
    $page = '404';
}
//next, we want to be sure you can only view pages intended for static viewing
$template = 'static_' . $page . '.tpl';
//lets be sure it exists...
$smarty = new GeographPage();
if (!$smarty->templateExists($template)) {
    $template = 'static_404.tpl';
}
$smarty->display($template);
 * 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->caching = 2;
// lifetime is per cache
$smarty->cache_lifetime = 3600 * 24;
//24hr cache
if (isset($_GET['output']) && $_GET['output'] == 'csv') {
    $template = 'statistics_table_csv.tpl';
    # let the browser know what's coming
    header("Content-type: application/octet-stream");
    header("Content-Disposition: attachment; filename=\"" . basename($_SERVER['SCRIPT_NAME'], '.php') . ".csv\"");
} else {
    $template = 'statistics_table.tpl';
}
$ri = isset($_GET['ri']) && is_numeric($_GET['ri']) ? intval($_GET['ri']) : 0;
$u = isset($_GET['u']) && is_numeric($_GET['u']) ? intval($_GET['u']) : 0;
$date = isset($_GET['date']) && preg_match('/^\\d{4}(-\\d{2}|)(-\\d{2}|)$/', $_GET['date']) ? $_GET['date'] : '2005-12';
Exemple #14
0
 * 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();
if (empty($_GET['url']) || preg_match('/[^\\w]/', $_GET['url'])) {
    $smarty->display('static_404.tpl');
    exit;
}
$pg = empty($_GET['page']) ? 1 : intval($_GET['page']);
$pgsize = 10;
$template = 'gallery_gallery.tpl';
preg_match('/_(\\d+)$/', $_GET['url'], $m);
$topic_id = intval($m[1]);
$cacheid = "{$topic_id}.{$pg}";
$db = NewADOConnection($GLOBALS['DSN']);
$page = $db->getRow("\r\nselect t.topic_id,topic_title,topic_poster,topic_poster_name,topic_time,post_time,posts_count\r\n\tfrom geobb_topics t\r\n\tinner join geobb_posts on (post_id = topic_last_post_id)\r\n\twhere t.topic_id = {$topic_id} and t.forum_id = {$CONF['forum_gallery']}");
if (count($page)) {
    //when this page was modified
    $mtime = strtotime($page['post_time']);
Exemple #15
0
 * 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();
$smarty = new GeographPage();
$template = 'admin_team.tpl';
$cacheid = '';
if (!$smarty->is_cached($template, $cacheid)) {
    $db = NewADOConnection($GLOBALS['DSN']);
    if (!$db) {
        die('Database connection failed');
    }
    $team = $db->GetAssoc("\r\n\tselect \r\n\t\tuser.user_id,user.realname,user.nickname,user.rights,role\r\n\tfrom user\r\n\twhere length(rights) > 0 AND (rights LIKE '%admin%' OR rights LIKE '%moderator%' OR role != '')\r\n\tgroup by user.user_id\r\n\torder by user.user_id");
    $smarty->assign_by_ref('team', $team);
}
$smarty->display($template, $cacheid);
 * 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';
#this seems to break some sessions, and is NOT needed anyway
#init_session();
$smarty = new GeographPage();
$u = isset($_GET['u']) && is_numeric($_GET['u']) ? intval($_GET['u']) : 0;
$template = 'js_categories.tpl';
$cacheid = "cat|{$u}." . isset($_GET['full']);
if (isset($_GET['days'])) {
    $_GET['days'] = $_SESSION['days'] = min(max(intval($_GET['days']), 1), 30);
} elseif (isset($_SESSION['days'])) {
    $_GET['days'] = min(max(intval($_SESSION['days']), 1), 30);
} else {
    $_GET['days'] = 10;
}
if (!$smarty->is_cached($template, $cacheid)) {
    $db = NewADOConnection($GLOBALS['DSN']);
    if (empty($db)) {
        die('Database connection failed');
    }
Exemple #17
0
 * 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();
$template = 'finder_places.tpl';
if (!empty($_GET['q'])) {
    $q = trim($_GET['q']);
    $fuzzy = !empty($_GET['f']);
    $sphinx = new sphinxwrapper($q);
    //gets a cleaned up verion of the query (suitable for filename etc)
    $cacheid = $sphinx->q . '.' . $fuzzy;
    $sphinx->pageSize = $pgsize = 15;
    $pg = !empty($_GET['page']) ? intval(str_replace('/', '', $_GET['page'])) : 0;
    if (empty($pg) || $pg < 1) {
        $pg = 1;
    }
    $cacheid .= "." . $pg;
    if (!$smarty->is_cached($template, $cacheid)) {
        $offset = ($pg - 1) * $sphinx->pageSize + 1;
 * 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();
if (isset($_GET['output']) && $_GET['output'] == 'csv') {
    $table = isset($_GET['table']) && is_numeric($_GET['table']) ? intval($_GET['table']) : 0;
    $smarty->assign('whichtable', $table);
    $template = 'statistics_tables_csv.tpl';
    # let the browser know what's coming
    header("Content-type: application/octet-stream");
    header("Content-Disposition: attachment; filename=\"" . basename($_SERVER['SCRIPT_NAME'], '.php') . ".{$table}.csv\"");
    $cacheid = 'statistics|coverage_by_country.' . $table;
} else {
    $template = 'statistics_tables.tpl';
    $cacheid = 'statistics|coverage_by_country';
}
$smarty->caching = 2;
// lifetime is per cache
$smarty->cache_lifetime = 3600 * 24;
 * 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();
$smarty = new GeographPage();
$template = 'statistics_not_geographed.tpl';
$cacheid = 'statistics|not_geographed';
if ($smarty->caching) {
    $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) {
Exemple #20
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');
Exemple #21
0
 * 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();
$USER->mustHavePerm('basic');
$isadmin = $USER->hasPerm('moderator') ? 1 : 0;
if (empty($_REQUEST['id'])) {
    $smarty->display('static_404.tpl');
    exit;
}
$template = 'events_edit.tpl';
$cacheid = '';
$db = NewADOConnection($GLOBALS['DSN']);
if ($_REQUEST['id'] == 'new') {
    $smarty->assign('id', "new");
    $smarty->assign('title', "New Event");
    $smarty->assign('realname', $USER->realname);
    $smarty->assign('user_id', $USER->user_id);
    $page = array();
Exemple #22
0
 * 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';
include_messages('usermsg');
init_session();
$smarty = new GeographPage();
$template = 'usermsg.tpl';
//gather what we need
$recipient = new GeographUser($_REQUEST['to']);
$from_name = isset($_POST['from_name']) ? stripslashes($_POST['from_name']) : $USER->realname;
$from_email = isset($_POST['from_email']) ? stripslashes($_POST['from_email']) : $USER->email;
$sendcopy = isset($_POST['sendcopy']) ? stripslashes($_POST['sendcopy']) : false;
$smarty->assign_by_ref('recipient', $recipient);
$smarty->assign_by_ref('from_name', $from_name);
$smarty->assign_by_ref('from_email', $from_email);
$smarty->assign_by_ref('sendcopy', $sendcopy);
$db = NewADOConnection($GLOBALS['DSN']);
if (empty($db)) {
    die('Database connection failed');
}
$ip = getRemoteIP();
Exemple #23
0
 * 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();
$USER->mustHavePerm("basic");
$template = 'mapper_captcha.tpl';
$cacheid = 'mapper';
$ok = true;
$verification = md5($CONF['register_confirmation_secret'] . $USER->user_id);
if (!isset($_POST['verify']) || empty($_POST['verification']) || $_POST['verification'] != $verification || empty($_SESSION['verification']) || $_SESSION['verification'] != $verification) {
    $ok = false;
    $smarty->assign('verification', $verification);
} else {
    define('CHECK_CAPTCHA', true);
    require "../stuff/captcha.jpg.php";
    $ok = $ok && CAPTCHA_RESULT;
    if ($ok) {
        $_SESSION['verCount'] = isset($_SESSION['verCount']) ? $_SESSION['verCount'] - 2 : -2;
    } else {
Exemple #24
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();
if (!empty($_GET['i'])) {
    header("Location: /statistics/breakdown.php?by=user&i=" . intval($_GET['i']));
    exit;
}
$smarty = new GeographPage();
if (isset($_GET['cloud'])) {
    $template = 'user.tpl';
} else {
    $template = 'userlist.tpl';
}
$when = isset($_GET['when']) && preg_match('/^\\d{4}(-\\d{2}|)(-\\d{2}|)$/', $_GET['when']) ? $_GET['when'] : '';
$where = isset($_GET['where']) && preg_match('/^[\\w]{1,}$/', $_GET['where']) ? $_GET['where'] : '';
customGZipHandlerStart();
$cacheid = $when . '|' . $where;
//regenerate?
if (!$smarty->is_cached($template, $cacheid)) {
    if (!$db) {
        $db = NewADOConnection($GLOBALS['DSN']);
        if (!$db) {
            die('Database connection failed');
Exemple #25
0
 * 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->caching = 0;
//dont cache!
$cacheid = 0;
$template = 'gallery.tpl';
$db = NewADOConnection($GLOBALS['DSN']);
$data = $db->getRow("show table status like 'content'");
//we use content as it should only update when galleries update
//when this table was modified
$mtime = strtotime($data['Update_time']);
//can't use IF_MODIFIED_SINCE for logged in users as has no concept as uniqueness
customCacheControl($mtime, $cacheid, $USER->user_id == 0);
if (!$smarty->is_cached($template, $cacheid)) {
    $prev_fetch_mode = $ADODB_FETCH_MODE;
    $ADODB_FETCH_MODE = ADODB_FETCH_ASSOC;
    $list = $db->getAll("\r\n\tselect topic_id,topic_title,topic_poster,topic_poster_name,topic_time,topic_views,posts_count,count(*) as images_count\r\n\tfrom geobb_topics\r\n\tleft join gridimage_post using (topic_id)\r\n\twhere forum_id = {$CONF['forum_gallery']}\r\n\tgroup by topic_id\r\n\torder by topic_last_post_id desc");
 * 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->assign('google_maps_api_key', $CONF['google_maps_api_key']);
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'])) {
 * 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->caching = 2;
// lifetime is per cache
$smarty->cache_lifetime = 3600 * 24;
//24hr cache
if (isset($_GET['output']) && $_GET['output'] == 'csv') {
    $template = 'statistics_table_csv.tpl';
    # let the browser know what's coming
    header("Content-type: application/octet-stream");
    header("Content-Disposition: attachment; filename=\"" . basename($_SERVER['SCRIPT_NAME'], '.php') . ".csv\"");
} else {
    $template = 'statistics_table.tpl';
}
$u = isset($_GET['u']) && is_numeric($_GET['u']) ? intval($_GET['u']) : 0;
$cacheid = 'statistics|busyday_forum' . isset($_GET['users']) . $u . '.' . isset($_GET['threads']);
if (!$smarty->is_cached($template, $cacheid)) {
Exemple #28
0
 * 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();
$len = isset($_GET['len']) && is_numeric($_GET['len']) ? max(0, min(3, intval($_GET['len']))) : 2;
$words = isset($_GET['words']) && preg_match('/^[\\w ]+$/', $_GET['words']) ? $_GET['words'] : '';
$u = isset($_GET['u']) && is_numeric($_GET['u']) ? intval($_GET['u']) : 0;
//bare minimum for the dynamic section
if ($u) {
    if ($u == -1) {
        if ($USER->registered) {
            $u = $USER->user_id;
        } else {
            $u = 0;
        }
    }
    if ($u) {
        $profile = new GeographUser($u);
        $smarty->assign_by_ref('profile', $profile);
Exemple #29
0
 * 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("ticketmod");
$smarty = new GeographPage();
$db = NewADOConnection($GLOBALS['DSN']);
if (!empty($_GET['relinqush'])) {
    $db->Execute("UPDATE user SET rights = REPLACE(rights,'ticketmod','') WHERE user_id = {$USER->user_id}");
    //reload the user object
    $_SESSION['user'] = new GeographUser($USER->user_id);
    header("Location: /profile.php?edit=1");
}
if (isset($_GET['gridimage_ticket_id'])) {
    require_once 'geograph/gridimage.class.php';
    require_once 'geograph/gridsquare.class.php';
    require_once 'geograph/gridimagetroubleticket.class.php';
    //user may have an expired session, or playing silly buggers,
    //either way, we want to check for admin status on the session
    $gridimage_ticket_id = intval($_GET['gridimage_ticket_id']);
    $hours = isset($_GET['hours']) && is_numeric($_GET['hours']) ? intval($_GET['hours']) : 24;
 * 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->caching = 2;
// lifetime is per cache
$smarty->cache_lifetime = 3600 * 24;
//24hr cache
if (isset($_GET['output']) && $_GET['output'] == 'csv') {
    $template = 'statistics_table_csv.tpl';
    # let the browser know what's coming
    header("Content-type: application/octet-stream");
    header("Content-Disposition: attachment; filename=\"" . basename($_SERVER['SCRIPT_NAME'], '.php') . ".csv\"");
} else {
    $template = 'statistics_table.tpl';
}
$cacheid = 'statistics|overtimelogin' . isset($_GET['month']) . isset($_GET['week']);
if (!$smarty->is_cached($template, $cacheid)) {
    require_once 'geograph/gridimage.class.php';