Esempio n. 1
0
        }
    }
    $output = preg_replace($pattern, $replacement, $output);
    $output = str_replace('¬', '[', $output);
    if (count($m[0])) {
        $smarty->assign("copyright", '<div class="copyright">Great Britain 1:50 000 Scale Colour Raster Mapping Extracts &copy; Crown copyright Ordnance Survey. All Rights Reserved. Educational licence 100045616.</div>');
    }
    if (count($imageCredits)) {
        arsort($imageCredits);
        $imageCreditsStr = implode(', ', array_keys($imageCredits));
        $imageCreditsStr = preg_replace('/, ([^,]+)$/', ' and $1', $imageCreditsStr);
        $smarty->assign("imageCredits", $imageCreditsStr);
    }
    return $output;
}
$smarty->register_modifier("articletext", "smarty_function_articletext");
$db = NewADOConnection($GLOBALS['DSN']);
$page = $db->getRow("\r\nselect article.*,realname,gs.grid_reference,category_name\r\nfrom article \r\n\tleft join user using (user_id)\r\n\tleft join article_cat c on (article.article_cat_id = c.article_cat_id)\r\n\tleft join gridsquare gs on (article.gridsquare_id = gs.gridsquare_id)\r\nwhere ( (licence != 'none' and approved > 0) \r\n\tor user.user_id = {$USER->user_id}\r\n\tor {$isadmin} )\r\n\tand url = " . $db->Quote($_GET['page']) . '
limit 1');
if (count($page)) {
    if ($page['user_id'] == $USER->user_id) {
        $cacheid .= '|' . $USER->user_id;
    }
    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 {
Esempio n. 2
0
                    }
                    print "</p>";
                } else {
                    print "<p>{$original}</p>";
                }
            } else {
                print "<i>empty</i>";
            }
            print "</blockquote><hr/>";
        }
        print "</form>";
        print "<i>Powered by the <b>Google Toolbar</b> spell checker - language is set to English</i>";
        exit;
    }
    //what style should we use?
    $style = $USER->getStyle();
    if (!$smarty->is_cached($template, $cacheid)) {
        function smarty_function_hidekeywords($input)
        {
            return preg_replace('/(^|[\\n\\r\\s]+)(Keywords?[\\s:][^\\n\\r>]+)$/', '<span class="keywords">$2</span>', $input);
        }
        $smarty->register_modifier("hidekeywords", "smarty_function_hidekeywords");
        $smarty->assign('maincontentclass', 'content_photo' . $style);
        $image->assignToSmarty($smarty);
    }
} else {
    header("HTTP/1.0 404 Not Found");
    header("Status: 404 Not Found");
    $template = 'static_404.tpl';
}
$smarty->display($template, $cacheid);
Esempio n. 3
0
    // 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;
    if ($input) {
        $hex = str_pad(dechex(255 - $input / $maximages * 255), 2, '0', STR_PAD_LEFT);
        return "ffff{$hex}";
    }
    return 'ffffff';
}
$smarty->register_modifier("colerize", "smarty_modifier_colerize");
if (!$smarty->is_cached($template, $cacheid)) {
    $db = NewADOConnection($GLOBALS['DSN']);
    if (!$db) {
        die('Database connection failed');
    }
    $title = "Hectad Coverages";
    $ADODB_FETCH_MODE = ADODB_FETCH_ASSOC;
    if ($u) {
        $columns = '0 as geograph_count,0 as percentage,';
    } else {
        $columns = "sum(has_geographs) as geograph_count,\r\n\t\t\tround(sum(has_geographs) * 100 / sum(percent_land >0),1) as percentage,";
    }
    $hectads = $db->CacheGetAll(3600 * 24, "select \r\n\t\tconcat(substring(grid_reference,1,length(grid_reference)-3),substring(grid_reference,length(grid_reference)-1,1)) as tenk_square,\r\n\t\t{$columns}\r\n\t\tsum(percent_land >0) as land_count,min(x) as x,min(y) as y\r\n\t\tfrom gridsquare \r\n\t\tgroup by tenk_square \r\n\t\thaving land_count > 0\r\n\t\torder by null");
    $lookup = $grid = array();
    $x1 = 9999999;
Esempio n. 4
0
            $source_dialects = explode(',', $row['source_dialect']);
            $text = '';
            foreach ($tran_words as $i => $tran_word) {
                if ($text) {
                    $text .= "\n-------------------------------\n";
                }
                $text .= "Meaning: {$tran_word} ({$tran_langs[$i]} {$tran_dialects[$i]})\n{$tran_definitions[$i]}\n Source: {$source_langs[$i]} {$source_dialects[$i]}";
            }
        } else {
            $text = "Meaning: {$row['tran_word']} ({$row['tran_lang']} {$row['tran_dialect']})\n{$row['tran_definition']}\n Source: {$row['source_lang']} {$row['source_dialect']}";
        }
        $input = preg_replace('/' . $wordregex . '/i', "\$1<acronym title=\"{$text}\">\$2</acronym>\$3", $input);
    }
    return $input;
}
$smarty->register_modifier("glossary", "smarty_modifier_glossary");
if (!$smarty->is_cached($template, $cacheid)) {
    if (!$db) {
        $db = NewADOConnection($GLOBALS['DSN']);
        if (!$db) {
            die('Database connection failed');
        }
        #$db->debug = true;
    }
    if (isset($_GET['add']) && $USER->hasPerm("basic")) {
    } elseif (!isset($_GET['test'])) {
        $ADODB_FETCH_MODE = ADODB_FETCH_ASSOC;
        $sql = "SELECT \n\t\tCONCAT('<b>',`source_word`,'</b>') as 'Word'\n\t\t,`source_lang` as 'Word Language'\n\t\t,`source_dialect` as 'Word Dialect'\n\t\t,CONCAT('<b>',`tran_word`,'</b>') as 'General Meaning'\n\t\t,`tran_lang` as 'Language'\n\t\t,`tran_dialect` as 'Dialect'\n\t\t,CONCAT('<small>',`tran_definition`,'</small>') as 'Definition'\n\t\tFROM glossary \n\t\tORDER BY source_word";
        $table = $db->getAll($sql);
        $smarty->assign_by_ref('table', $table);
        $smarty->assign("h2title", "Regional Glossary");