示例#1
0
 /**
  * Get Country by IP Address
  *
  * Takes an IP address and looks it up against Gaze to return the country.
  */
 public static function getCountryByIp($ip)
 {
     include_once INCLUDESPATH . '../../commonlib/phplib/gaze.php';
     if (defined('OPTION_GAZE_URL') && OPTION_GAZE_URL) {
         return gaze_get_country_from_ip($ip);
     } else {
         return NULL;
     }
 }
示例#2
0
文件: page.php 项目: archoo/twfy
    function page_body_mobile()
    {
        global $this_page;
        // Start the body, put in the page headings.
        ?>
<body>
<div id="container">
<?php 
        twfy_debug("PAGE", "This page: {$this_page}");
        print "\t<a name=\"top\"></a>\n\n";
        if (defined('OPTION_GAZE_URL') && OPTION_GAZE_URL && (gaze_get_country_from_ip($_SERVER["REMOTE_ADDR"]) == 'NZ' || get_http_var('nz'))) {
            print '<p align="center"><strong>New!</strong> You\'re in New Zealand, so check out <a href="http://www.theyworkforyou.co.nz">OpenAustralia.co.nz</a></p>';
        }
        $this->title_bar_mobile();
        //$this->menu_mobile();
    }
示例#3
0
    public function page_body()
    {
        global $this_page;
        $banner = new MySociety\TheyWorkForYou\Model\Banner();
        $banner_text = $banner->get_text();
        // Start the body, put in the page headings.
        ?>
<body>

<?php 
        if ($banner_text) {
            ?>
<div id="surveyPromoBanner" style="clear:both;padding:1em;margin-top:24px;background:#DDD;">
<?php 
            echo $banner_text;
            ?>
</div>
<?php 
        }
        ?>


<div id="fb-root"></div>
<script>
window.fbAsyncInit = function () {
    FB.init({
    appId      : '227648394066332',
    xfbml      : true
    });

    FB.Event.subscribe('edge.create', function (targetUrl) {
        ga('send', 'social', 'facebook', 'like', targetUrl);
    });

    FB.Event.subscribe('edge.remove', function (targetUrl) {
        ga('send', 'social', 'facebook', 'unlike', targetUrl);
    });

};

(function (d, s, id) {
  var js, fjs = d.getElementsByTagName(s)[0];
  if (d.getElementById(id)) return;
  js = d.createElement(s); js.id = id;
  js.src = "//connect.facebook.net/en_GB/all.js";
  fjs.parentNode.insertBefore(js, fjs);
}(document, 'script', 'facebook-jssdk'));
</script>

<div id="container">
<?php 
        twfy_debug("PAGE", "This page: {$this_page}");
        print "\t<a name=\"top\"></a>\n\n";
        if (defined('OPTION_GAZE_URL') && OPTION_GAZE_URL) {
            $country = gaze_get_country_from_ip($_SERVER["REMOTE_ADDR"]);
            if (get_http_var('country')) {
                $country = strtoupper(get_http_var('country'));
            }
            if ($country == 'NZ') {
                print '<p class="informational banner">You&rsquo;re in New Zealand, so check out <a href="http://www.theyworkforyou.co.nz">TheyWorkForYou.co.nz</a></p>';
            } elseif ($country == 'AU') {
                print '<p class="informational banner">You&rsquo;re in Australia, so check out <a href="http://www.openaustralia.org">OpenAustralia</a>, a TheyWorkForYou for down under</p>';
            } elseif ($country == 'IE') {
                print '<p class="informational banner">Check out <a href="http://www.kildarestreet.com/">KildareStreet</a>, a TheyWorkForYou for the Houses of the Oireachtas</p>';
            } elseif ($country == 'CA') {
                print '<p class="informational banner">Check out <a href="http://www.openparliament.ca/">OpenParliament.ca</a></p>';
            } elseif ($this_page != 'overview') {
                #print '<p class="informational banner"><a href="http://election.theyworkforyou.com/">Find out what your candidates said on local and national issues in our quiz</a></p>';
            }
        }
        # # 2009-01 interstitial
        # include INCLUDESPATH . '../docs/foiorder2009/fns.php';
        # echo '<div id="everypage" style="display:none">
        # <p style="float:right"><a href="#top" onclick="$.cookie(\'seen_foi2\', 1, { expires: 7, path: \'/\' }); $(\'#everypage\').hide(\'slow\'); return false;">Close</a></p>
        # <h2>Blimey. It looks like the Internets won &ndash; <small>a message from TheyWorkForYou</small></h2>
        # <p>Sorry to interrupt, but we thought you&rsquo;d like to know that <strong>you won</strong>!';
        # echo $foi2009_message;
        # echo '<p align="right"><a href="#top" onclick="$.cookie(\'seen_foi2\', 1, { expires: 7, path: \'/\' }); $(\'#everypage\').hide(\'slow\'); return false;">Close</a></p>
        # </div>';
        $this->mysociety_bar();
        $this->title_bar();
        $this->menu();
    }
示例#4
0
    function page_body()
    {
        global $this_page;
        // Start the body, put in the page headings.
        ?>
<body>
<div id="container">
<?php 
        twfy_debug("PAGE", "This page: {$this_page}");
        print "\t<a name=\"top\"></a>\n\n";
        if (defined('OPTION_GAZE_URL') && OPTION_GAZE_URL) {
            $country = gaze_get_country_from_ip($_SERVER["REMOTE_ADDR"]);
            if (get_http_var('country')) {
                $country = strtoupper(get_http_var('country'));
            }
            if ($country == 'NZ') {
                print '<p class="informational banner">You&rsquo;re in New Zealand, so check out <a href="http://www.theyworkforyou.co.nz">TheyWorkForYou.co.nz</a></p>';
            } elseif ($country == 'AU') {
                print '<p class="informational banner">You&rsquo;re in Australia, so check out <a href="http://www.openaustralia.org">OpenAustralia</a>, a TheyWorkForYou for down under</p>';
            } elseif ($country == 'IE') {
                print '<p class="informational banner">Check out <a href="http://www.kildarestreet.com/">KildareStreet</a>, a TheyWorkForYou for the Houses of the Oireachtas</p>';
            } elseif ($country == 'CA') {
                print '<p class="informational banner">Check out <a href="http://howdtheyvote.ca/">How&rsquo;d They Vote?</a> and <a href="http://www.openparliament.ca/">OpenParliament.ca</a></p>';
            } else {
                print '<p class="informational banner">You can improve this election: <a href="http://www.democracyclub.org.uk/">TheyWorkForYou needs your help to pin down every candidate</a></p>';
            }
        }
        # # 2009-01 interstitial
        # include INCLUDESPATH . '../docs/foiorder2009/fns.php';
        # echo '<div id="everypage" style="display:none">
        # <p style="float:right"><a href="#top" onclick="$.cookie(\'seen_foi2\', 1, { expires: 7, path: \'/\' }); $(\'#everypage\').hide(\'slow\'); return false;">Close</a></p>
        # <h2>Blimey. It looks like the Internets won &ndash; <small>a message from TheyWorkForYou</small></h2>
        # <p>Sorry to interrupt, but we thought you&rsquo;d like to know that <strong>you won</strong>!';
        # echo $foi2009_message;
        # echo '<p align="right"><a href="#top" onclick="$.cookie(\'seen_foi2\', 1, { expires: 7, path: \'/\' }); $(\'#everypage\').hide(\'slow\'); return false;">Close</a></p>
        # </div>';
        $this->mysociety_bar();
        $this->title_bar();
        $this->menu();
    }
示例#5
0
文件: page.php 项目: palfrey/twfy
    function page_body()
    {
        global $this_page;
        // Start the body, put in the page headings.
        ?>
<body>
<div id="container">
<?php 
        twfy_debug("PAGE", "This page: {$this_page}");
        print "\t<a name=\"top\"></a>\n\n";
        if (defined('OPTION_GAZE_URL') && OPTION_GAZE_URL) {
            $country = gaze_get_country_from_ip($_SERVER["REMOTE_ADDR"]);
            if ($country == 'NZ' || get_http_var('nz')) {
                print '<p id="video_already"><strong>New!</strong> You\'re in New Zealand, so check out <a href="http://www.theyworkforyou.co.nz">TheyWorkForYou.co.nz</a></p>';
            } elseif ($country == 'AU' || get_http_var('au')) {
                print '<p id="video_already"><strong>New!</strong> You\'re in Australia, so check out <a href="http://www.openaustralia.org">OpenAustralia</a>, a TheyWorkForYou for down under</p>';
            } elseif ($country == 'IE' || get_http_var('ie')) {
                print '<p id="video_already"><strong>New!</strong> Check out <a href="http://www.kildarestreet.com/">KildareStreet</a>, a TheyWorkForYou for the Houses of the Oireachtas</p>';
            }
            /* else {
            			print '<p id="video_already"><strong>Mirror readers!</strong> <a href="http://www.writetothem.com/?a=westminstermp">Click here to write to your MP</a></p>';
                       } */
        }
        # # 2009-01 interstitial
        # include INCLUDESPATH . '../docs/foiorder2009/fns.php';
        # echo '<div id="everypage" style="display:none">
        # <p style="float:right"><a href="#top" onclick="$.cookie(\'seen_foi2\', 1, { expires: 7, path: \'/\' }); $(\'#everypage\').hide(\'slow\'); return false;">Close</a></p>
        # <h2>Blimey. It looks like the Internets won &ndash; <small>a message from TheyWorkForYou</small></h2>
        # <p>Sorry to interrupt, but we thought you&rsquo;d like to know that <strong>you won</strong>!';
        # echo $foi2009_message;
        # echo '<p align="right"><a href="#top" onclick="$.cookie(\'seen_foi2\', 1, { expires: 7, path: \'/\' }); $(\'#everypage\').hide(\'slow\'); return false;">Close</a></p>
        # </div>';
        $this->mysociety_bar();
        $this->title_bar();
        $this->menu();
    }