本文整理汇总了PHP中GeographPage::assign方法的典型用法代码示例。如果您正苦于以下问题:PHP GeographPage::assign方法的具体用法?PHP GeographPage::assign怎么用?PHP GeographPage::assign使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类GeographPage
的用法示例。
在下文中一共展示了GeographPage::assign方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: die
die("Missing Token");
}
if ($map->pixels_per_km != 40 && $map->pixels_per_km != 4) {
die("Invalid Parameter");
}
if (isset($_GET['mine']) && $USER->hasPerm("basic")) {
$map->type_or_user = $USER->user_id;
} elseif (isset($_GET['u'])) {
if (!empty($_GET['u'])) {
$map->type_or_user = max(0, intval($_GET['u']));
} else {
$map->type_or_user = 0;
}
} elseif (isset($_GET['depth'])) {
if ($_GET['depth']) {
$smarty->assign('depth', 1);
$map->type_or_user = -1;
} else {
$map->type_or_user = 0;
}
}
$template = $map->pixels_per_km == 4 ? $map->type_or_user == -1 ? 'mapsheet100kdepth.tpl' : 'mapsheet100k.tpl' : 'mapsheet.tpl';
//get token, we'll use it as a cache id
$token = $map->getToken();
//regenerate html?
$cacheid = 'mapsheet|' . $token;
if ($map->pixels_per_km == 4) {
$smarty->cache_lifetime = 3600 * 24;
}
//24hr cache
if (isset($_GET['gridref_from']) && preg_match('/^[a-zA-Z]{1,3}\\d{4}$/', $_GET['gridref_from'])) {
示例2: die
}
if (strlen($msg) == 0) {
$ok = false;
$errors['msg'] = "Please enter a message to send";
}
if (isSpam($msg)) {
$ok = false;
$errors['msg'] = "Sorry, this looks like spam";
}
if (!$ok) {
die("ERROR: " . implode('. ', $errors));
}
$smarty->assign_by_ref('msg', $msg);
$smarty->assign_by_ref('contactmail', $CONF['abuse_email']);
$enc_from_name = mb_encode_mimeheader($from_name, $CONF['mail_charset'], $CONF['mail_transferencoding']);
$smarty->assign('http_host', "{$_SERVER['HTTP_HOST']} on behalf of {$domain}");
$body = $smarty->fetch('email_usermsg.tpl');
$subject = "{$from_name} contacting you via {$domain}";
$encsubject = mb_encode_mimeheader($CONF['mail_subjectprefix'] . $subject, $CONF['mail_charset'], $CONF['mail_transferencoding']);
$ip = getRemoteIP();
$hostname = trim(`hostname -f`);
$received = "Received: from [{$ip}]" . " by {$hostname} " . "with HTTP;" . strftime("%d %b %Y %H:%M:%S -0000", time()) . "\n";
if (!empty($_REQUEST['client_ip']) && preg_match("/^[\\w\\.]+\$/", $_REQUEST['client_ip'])) {
$received .= "Received: from [{$_REQUEST['client_ip']}]" . " by [{$id}] " . "with HTTP;" . strftime("%d %b %Y %H:%M:%S -0000", empty($_REQUEST['timestamp']) ? time() : intval($_REQUEST['timestamp'])) . "\n";
}
$mime = "MIME-Version: 1.0\n" . "Content-Type: text/plain; charset={$CONF['mail_charset']}\n" . "Content-Disposition: inline\n" . "Content-Transfer-Encoding: 8bit";
$from = "From: {$enc_from_name} <{$from_email}>\n";
$geofrom = "From: Geograph <{$CONF['mail_from']}>\n";
$envfrom = is_null($CONF['mail_envelopefrom']) ? null : "-f {$CONF['mail_envelopefrom']}";
if (preg_match('/(DORMANT|geograph\\.org\\.uk|geograph\\.co\\.uk|dev\\.null|deleted|localhost|127\\.0\\.0\\.1)/', $recipient->email)) {
$email = $CONF['contact_email'];
示例3: strtotime
}
if (!isset($_GET['dontcount']) && @strpos($_SERVER['HTTP_REFERER'], $page['url']) === FALSE) {
$db->Execute("UPDATE LOW_PRIORITY article_stat SET views=views+1 WHERE article_id = " . $page['article_id']);
}
//when this page was modified
$mtime = strtotime($page['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);
} else {
$template = 'static_404.tpl';
}
if (!$smarty->is_cached($template, $cacheid)) {
if (count($page)) {
$CONF['global_thumb_limit'] *= 2;
$CONF['post_thumb_limit'] *= 2;
$smarty->assign($page);
if (!empty($page['extract'])) {
$smarty->assign('meta_description', "User contributed article about, " . $page['extract']);
}
if (!empty($page['gridsquare_id'])) {
$square = new GridSquare();
$square->loadFromId($page['gridsquare_id']);
$smarty->assign('grid_reference', $square->grid_reference);
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);
}
if (preg_match('/\\bgeograph\\b/i', $page['category_name'])) {
$db->Execute("set @last=0");
示例4: NewADOConnection
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])) {
$type = 'points';
}
$isfloat = false;
if (isset($sql_qtable[$type]['isfloat'])) {
$isfloat = $sql_qtable[$type]['isfloat'];
}
$smarty->assign('heading', $MESSAGES['moversboard']['headings'][$type]);
$smarty->assign('desc', $MESSAGES['moversboard']['descriptions'][$type]);
$smarty->assign('type', $type);
$smarty->assign('isfloat', $isfloat);
$sql_column = '';
$sql_orderby = '';
$sql_table = " gridimage as i ";
$sql_where = '';
if ($sql_qtable[$type]['column'] === '') {
if ($type == 'geosquares') {
$sql_where = " and i.moderation_status='geograph'";
}
// else { // $type == 'squares'
//}
//squares has to use a count(distinct ...) meaning cant have pending in same query... possibly could do with a funky subquery but probably would lower performance...
$sql = "select i.user_id,u.realname,\n\t\tcount(distinct grid_reference) as geographs\n\t\tfrom gridimage_search as i \n\t\tinner join user as u using(user_id) \n\t\twhere i.submitted > date_sub(now(), interval 7 day) {$sql_where}\n\t\tgroup by i.user_id \n\t\torder by geographs desc";
示例5: GeographPage
*
* 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 {
if (isset($_SESSION['verCount']) && $_SESSION['verCount'] > 3) {
$smarty->assign('error', "Too many failures please try again later");
} else {
$smarty->assign('verification', $verification);
$smarty->assign('error', "Please Try again");
}
$ok = false;
$_SESSION['verCount'] = isset($_SESSION['verCount']) ? $_SESSION['verCount'] + 1 : 1;
示例6: header
}
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 = '&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']));
}
}
示例7: min
$_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');
}
if ($u) {
$where = "where submitted > date_sub(now(),interval {$_GET['days']} day) and user_id = {$u}";
$having = isset($_GET['full']) ? '' : 'having cnt>5';
$table = 'gridimage';
$smarty->assign('varname', 'catListUser');
$arr = $db->getCol("select imageclass,count(*) as cnt from {$table} {$where} group by imageclass {$having}");
} else {
$where = isset($_GET['full']) ? '' : 'where c>5';
$table = 'category_stat';
$smarty->assign('varname', 'catList');
$arr = $db->getCol("select imageclass,c as cnt from {$table} {$where}");
}
$smarty->assign_by_ref('classes', $arr);
}
if ($u) {
customExpiresHeader(300, false);
} else {
customExpiresHeader(3600 * 3, true);
}
header("Content-type: text/javascript");
示例8: isset
$ri = isset($_GET['ri']) && is_numeric($_GET['ri']) ? intval($_GET['ri']) : 0;
$u = isset($_GET['u']) && is_numeric($_GET['u']) ? intval($_GET['u']) : 0;
$cacheid = 'statistics|forum_image_breakdown' . $ri . '.' . $u;
if (!$smarty->is_cached($template, $cacheid)) {
require_once 'geograph/gridimage.class.php';
require_once 'geograph/gridsquare.class.php';
require_once 'geograph/imagelist.class.php';
$db = NewADOConnection($GLOBALS['DSN']);
if (!$db) {
die('Database connection failed');
}
$title = "Breakdown of Images";
$where = array();
if (!empty($u)) {
$where[] = "user_id=" . $u;
$smarty->assign('u', $u);
$profile = new GeographUser($u);
$smarty->assign_by_ref('profile', $profile);
$title .= " by " . $profile->realname;
$having_sql = '';
$columns_sql = '';
} else {
$having_sql = "HAVING `Seperate Images` > 4";
$columns_sql = ', count( DISTINCT user_id ) AS `Photographers`';
}
if ($ri) {
$where[] = "reference_index = {$ri}";
$smarty->assign('ri', $ri);
$title .= " in " . $CONF['references_all'][$ri];
}
$where_sql = '';
示例9: mail
$enc_from_name = mb_encode_mimeheader($from_name, $CONF['mail_charset'], $CONF['mail_transferencoding']);
$from = "From: {$enc_from_name} <{$from_email}>\n";
$mime = "MIME-Version: 1.0\n" . "Content-Type: text/plain; charset={$CONF['mail_charset']}\n" . "Content-Disposition: inline\n" . "Content-Transfer-Encoding: 8bit";
$mods = $db->GetCol("select email from user where FIND_IN_SET('admin',rights)>0;");
$url = 'http://' . $_SERVER['HTTP_HOST'] . '/admin/moderator_admin.php?stats=' . $USER->user_id;
mail(implode(',', $mods), "[Geograph] Moderator Application ({$USER->user_id})", "Dear Admin, \n\nI have just completed verification,\nclick the following link to review the application:\t\n\n{$url}\n\nRegards, \n\n{$USER->realname}" . ($USER->nickname ? " (aka {$USER->nickname})" : ''), $from . $mime, $envfrom);
header("Location: /profile.php");
exit;
}
$count = $db->getRow("select count(*) as total,sum(created > date_sub(now(),interval 60 day)) as recent from moderation_log WHERE user_id = {$USER->user_id} AND type = 'dummy'");
if ($count['total'] > 0) {
$limit = 10;
}
//make sure they only do verifications
$_GET['remoderate'] = 1;
$smarty->assign('apply', 1);
} elseif (isset($_GET['moderator'])) {
$USER->mustHavePerm('admin');
} else {
$USER->mustHavePerm('moderator');
}
#############################
//lock the table so nothing can happen in between! (leave others as READ so they dont get totally locked)
$db->Execute("LOCK TABLES \ngridsquare_moderation_lock WRITE, \ngridsquare_moderation_lock l WRITE,\nmoderation_log WRITE,\ngridsquare READ,\ngridsquare gs READ,\ngridimage gi READ,\nuser READ,\ngridprefix READ,\nuser v READ,\nuser m READ");
#############################
# find the list of squares with self pending images, and exclude them...
$sql = "select distinct gridsquare_id \nfrom \n\tgridimage as gi\nwhere\n\t(moderation_status = 2) and\n\tgi.user_id = {$USER->user_id}\norder by null";
$recordSet =& $db->Execute($sql);
while (!$recordSet->EOF) {
$db->Execute("REPLACE INTO gridsquare_moderation_lock SET user_id = {$USER->user_id}, gridsquare_id = {$recordSet->fields['gridsquare_id']},lock_type = 'cantmod'");
$recordSet->MoveNext();
示例10: GeographPage
* 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
**/
require_once 'geograph/global.inc.php';
init_session();
require_once "3rdparty/xmlHandler.class.php";
$smarty = new GeographPage();
//you must be logged in to request changes
$USER->mustHavePerm("basic");
$template = 'puploader.tpl';
$cacheid = '';
if (isset($_REQUEST['submit2'])) {
$cacheid .= 'submit2';
$smarty->assign('submit2', 1);
if (isset($_REQUEST['upload_id'])) {
$smarty->assign('upload_id', $_REQUEST['upload_id']);
}
}
if (isset($_GET['success'])) {
$token = new Token();
if ($token->parse($_GET['t'])) {
$template = 'puploader_success.tpl';
$smarty->assign('status', unserialize($token->getValueBinary("s")));
$smarty->assign('filenames', unserialize($token->getValueBinary("f")));
}
} elseif (isset($_POST['selected'])) {
//we dont get the button :(
$status = array();
$filenames = array();
示例11: flush
//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\"><<</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();
} else {
echo "<li>skipping {$oldfile} (not found)</li>";
}
$recordSet->MoveNext();
}
$recordSet->Close();
$smarty->display('_std_end.tpl');
exit;
}
$smarty->assign('from', $from);
$smarty->assign('to', $to);
$smarty->display('hashchanger.tpl');
示例12: isset
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'])) {
$smarty->assign('upload_id', $uploadmanager->upload_id);
$smarty->assign('transfer_id', $uploadmanager->upload_id);
$smarty->assign('preview_url', "/submit.php?preview=" . $uploadmanager->upload_id);
$smarty->assign('preview_width', $uploadmanager->upload_width);
$smarty->assign('preview_height', $uploadmanager->upload_height);
$exif = $uploadmanager->rawExifData;
if (!empty($exif['GPS'])) {
$conv = new Conversions();
if (is_array($exif['GPS']['GPSLatitude'])) {
$deg = FractionToDecimal($exif['GPS']['GPSLatitude'][0]);
$min = FractionToDecimal($exif['GPS']['GPSLatitude'][1]);
$sec = FractionToDecimal($exif['GPS']['GPSLatitude'][2]);
$lat = ExifConvertDegMinSecToDD($deg, $min, $sec);
} else {
示例13: round
}
$jump = 360 / 16;
$jump2 = 360 / 32;
$q = round($angle / $jump) * $jump;
$s = $q % 90 == 0 ? strtoupper(heading_string($q)) : ucwords(heading_string($q));
$direction = sprintf('%s : %03d deg (%03d > %03d)', str_pad($s, 16, '�'), $q, $q == 0 ? $q + 360 - $jump2 : $q - $jump2, $q + $jump2);
$angle = sprintf('%.1f', $angle);
if (!$dist) {
$line['Direction'] = "<small style=\"color:gray\">Same Location</small>";
$q = '-';
} elseif ($dist >= 1000) {
$line['Direction'] = "<b>{$s}</b> <nobr>[{$angle}]</nobr>";
#"Wide:".$angle."<br>".
$q = floor($q);
} elseif ($promore4 && $submore4) {
$line['Direction'] = "<b>{$s}</b> <nobr>[{$angle}]</nobr>";
#"Detailed:".$angle."<br>".
$q = floor($q);
} else {
$line['Direction'] = "<small style=\"color:gray\">" . ($submore4 ? 'Photographer' : 'Subject') . ' Location Not Accurate Enough</small>';
$q = '-';
}
$line['Result'] = $q;
$line['Manually Specified'] = $image->view_direction > -1 ? $image->view_direction : '-';
$table[] = $line;
}
$smarty->assign_by_ref('table', $table);
$smarty->assign("h2title", 'Listing images with Photographer position specified (and different to Subject)');
$smarty->assign("total", count($table));
}
$smarty->display($template, $cacheid);
示例14: flush
$smarty->display('_std_begin.tpl');
echo "<h3><a href=\"recreatemaps.php\"><<</a> Comparing tables...</h3>";
flush();
$sql = "SELECT mapcache2.* FROM mapcache2 NATURAL LEFT JOIN mapcache WHERE mapcache.map_x IS NULL";
$recordSet =& $db->Execute("{$sql}");
while (!$recordSet->EOF) {
$values = array();
foreach ($recordSet->fields as $name => $value) {
if (!is_numeric($name)) {
$values[] = $value;
}
}
$values[6] = 17;
//we always want to invalidate this tile! Overkill but probably need to update this tile anyway...
$sql = "INSERT DELAYED IGNORE INTO mapcache VALUES(" . join(',', $values) . ")";
$db->Execute($sql);
$recordSet->MoveNext();
}
$recordSet->Close();
#$db->Execute("TRUNCATE mapcache2");
print "<h3>Done</h3>";
$smarty->display('_std_end.tpl');
exit;
} elseif (isset($_GET['setup'])) {
$db->Execute("CREATE TABLE `mapcache2` (\n\t\t\t `map_x` smallint(6) NOT NULL default '0',\n\t\t\t `map_y` smallint(6) NOT NULL default '0',\n\t\t\t `image_w` smallint(6) unsigned NOT NULL default '0',\n\t\t\t `image_h` smallint(6) unsigned NOT NULL default '0',\n\t\t\t `pixels_per_km` float NOT NULL default '0',\n\t\t\t `type_or_user` smallint(6) NOT NULL default '0',\n\t\t\t `age` smallint(5) unsigned NOT NULL default '0',\n\t\t\t PRIMARY KEY (`map_x`,`map_y`,`image_w`,`image_h`,`pixels_per_km`,`type_or_user`)\n\t\t\t ) TYPE=MyISAM ");
} elseif (isset($_GET['remove'])) {
$db->Execute("DROP TABLE `mapcache2`");
} else {
$smarty->assign('invalid_maps', $db->GetOne("select count(*) from mapcache where age > 0"));
}
$smarty->display('admin_recreatemaps.tpl');
示例15: NewADOConnection
$db = NewADOConnection($GLOBALS['DSN']);
if (!$db) {
die('Database connection failed');
}
}
$andwhere = '';
if ($when) {
if (strlen($when) == 7) {
$andwhere = " and submitted < DATE_ADD('{$when}-01',interval 1 month)";
} elseif (strlen($when) == 4) {
$andwhere = " and submitted < DATE_ADD('{$when}-01-01',interval 1 year)";
} else {
$andwhere = " and submitted < '{$when}'";
}
$smarty->assign_by_ref('when', $when);
$smarty->assign('whenname', getFormattedDate($when));
}
if ($where) {
$andwhere .= " and grid_reference like '{$where}%'";
$smarty->assign_by_ref('where', $where);
}
$ADODB_FETCH_MODE = ADODB_FETCH_ASSOC;
if (isset($_GET['cloud'])) {
if ($andwhere) {
$users = $db->CacheGetAssoc(3600 * 6, "select\r\n\t\t\t\tnickname,user.user_id,user.realname,user.user_id,count(*) as images\r\n\t\t\t\tfrom user\r\n\t\t\t\t\tinner join gridimage_search gi using (user_id)\r\n\t\t\t\twhere nickname != '' and rights IS NOT NULL {$andwhere}\r\n\t\t\t\tgroup by gi.user_id\r\n\t\t\t\torder by images desc");
$smarty->assign('what', 'Contributors');
} else {
$users = $db->CacheGetAssoc(3600 * 6, "select\r\n\t\t\t\tnickname,user.user_id,user.realname,user.user_id,`us`.images\r\n\t\t\t\tfrom user\r\n\t\t\t\t\tinner join user_stat `us` using (user_id)\r\n\t\t\t\twhere nickname != '' and rights IS NOT NULL \r\n\t\t\t\torder by images desc");
$smarty->assign('what', 'Contributors');
}
$size = $startsize = 30;