-class GeolocView implements PlView
-{
- private $set;
- private $type;
- private $params;
-
- public function __construct(PlSet &$set, $data, array $params)
- {
- $this->params = $params;
- $this->set =& $set;
- $this->type = $data;
- }
-
- private function use_map()
- {
- return is_file(dirname(__FILE__) . '/../modules/geoloc/dynamap.swf') &&
- is_file(dirname(__FILE__) . '/../modules/geoloc/icon.swf');
- }
-
- public function args()
- {
- $args = $this->set->args();
- unset($args['initfile']);
- unset($args['mapid']);
- return $args;
- }
-
- public function apply(PlPage &$page)
- {
- require_once 'geoloc.inc.php';
- require_once '../modules/search/search.inc.php';
-
- switch ($this->type) {
- case 'icon.swf':
- header("Content-type: application/x-shockwave-flash");
- header("Pragma:");
- readfile(dirname(__FILE__).'/../modules/geoloc/icon.swf');
- exit;
-
- case 'dynamap.swf':
- header("Content-type: application/x-shockwave-flash");
- header("Pragma:");
- readfile(dirname(__FILE__).'/../modules/geoloc/dynamap.swf');
- exit;
-
- case 'init':
- $page->changeTpl('geoloc/init.tpl', NO_SKIN);
- header('Content-Type: text/xml');
- header('Pragma:');
- if (!empty($GLOBALS['IS_XNET_SITE'])) {
- $page->assign('background', 0xF2E9D0);
- }
- break;
-
- case 'city':
- $page->changeTpl('geoloc/city.tpl', NO_SKIN);
- header('Content-Type: text/xml');
- header('Pragma:');
- $only_current = Env::v('only_current', false)? ' AND FIND_IN_SET(\'active\', adrf.statut)' : '';
- $it =& $this->set->get('u.user_id AS id, u.prenom, u.nom, u.promo, al.alias',
- "INNER JOIN adresses AS adrf ON (adrf.uid = u.user_id $only_current)
- LEFT JOIN aliases AS al ON (u.user_id = al.id
- AND FIND_IN_SET('bestalias', al.flags))
- INNER JOIN adresses AS avg ON (" . getadr_join('avg') . ")",
- 'adrf.cityid = ' . Env::i('cityid'), null, null, 11);
- $page->assign('users', $it);
- break;
-
- case 'country':
- if (Env::has('debug')) {
- $page->changeTpl('geoloc/country.tpl', SIMPLE);
- } else {
- $page->changeTpl('geoloc/country.tpl', NO_SKIN);
- header('Content-Type: text/xml');
- header('Pragma:');
- }
- $mapid = Env::has('mapid') ? Env::i('mapid', -2) : false;
- list($countries, $cities) = geoloc_getData_subcountries($mapid, $this->set, 10);
- $page->assign('countries', $countries);
- $page->assign('cities', $cities);
- break;
-
- default:
- global $globals;
- if (!$this->use_map()) {
- $page->assign('request_geodesix', true);
- }
- $page->assign('annu', @$this->params['with_annu']);
- $page->assign('protocole', @$_SERVER['HTTPS'] ? 'https' : 'http');
- $this->set->get('u.user_id', null, "u.perms != 'pending' AND u.deces = 0", "u.user_id", null);
- return 'include/plview.geoloc.tpl';
- }
- }
-}
-