Cheetah
ChWmapModule.php
Go to the documentation of this file.
1 <?php
2 
8 ch_import('ChWsbModule');
9 ch_import('ChWsbPaginate');
10 
11 define('CH_WMAP_ZOOM_DEFAULT_ENTRY', 10);
12 define('CH_WMAP_ZOOM_DEFAULT_EDIT', 5);
13 define('CH_WMAP_PRIVACY_DEFAULT', 3);
14 
16 {
18  var $_aParts;
19  var $_sProto = 'http';
20  var $aIconsSizes = array(
21  'group.png' => array('w' => 24, 'h' => 24, 'url' => ''),
22  'default' => array('w' => 24, 'h' => 24, 'url' => ''),
23  );
24 
25  function __construct(&$aModule)
26  {
27  parent::__construct($aModule);
28  $this->_iProfileId = getLoggedId();
29  $this->_aParts = $this->_oDb->getParts();
30  $this->_oDb->_aParts = &$this->_aParts;
31  $this->_sProto = ch_proto();
32  }
33 
34  function actionHome()
35  {
36  $this->_oTemplate->pageStart();
37 
38  ch_import('PageMain', $this->_aModule);
39  $oPage = new ChWmapPageMain ($this);
40  echo $oPage->getCode();
41 
42  $this->_oTemplate->addJs($this->_sProto . '://www.google.com/jsapi?key=' . getParam('ch_wmap_key'));
43  $this->_oTemplate->addJs('ChWmap.js');
44  $this->_oTemplate->addCss('main.css');
45  $this->_oTemplate->pageCode(_t('_ch_wmap_block_title_block_map'), false, false);
46  }
47 
48  function actionEdit($iEntryId, $sPart)
49  {
50  if (!isset($this->_aParts[$sPart])) {
51  $this->_oTemplate->displayPageNotFound();
52 
53  return;
54  }
55 
56  $iEntryId = (int)$iEntryId;
57  $aLocation = $this->_iProfileId ? $this->_oDb->getDirectLocation($iEntryId, $this->_aParts[$sPart]) : false;
58 
59  if (!$aLocation || !$this->isAllowedEditOwnLocation($aLocation)) {
60  $this->_oTemplate->displayAccessDenied();
61 
62  return;
63  }
64 
65  if ('profiles' == $sPart) {
66  $aLocation['title'] = getNickName($aLocation['id']);
67  }
68 
69  $this->_oTemplate->pageStart();
70 
71  ch_import('PageEdit', $this->_aModule);
72  $oPage = new ChWmapPageEdit ($this, $aLocation);
73  echo $oPage->getCode();
74 
75  $this->_oTemplate->addJs($this->_sProto . '://www.google.com/jsapi?key=' . getParam('ch_wmap_key'));
76  $this->_oTemplate->addJs('ChWmap.js');
77  $this->_oTemplate->addCss('main.css');
78  $this->_oTemplate->pageCode(sprintf(_t('_ch_wmap_edit'), $aLocation['title'],
79  _t($this->_aParts[$sPart]['title_singular'])), false, false);
80  }
81 
82  function actionSaveData(
83  $iEntryId,
84  $sPart,
85  $iZoom,
86  $sMapType,
87  $fLat,
88  $fLng,
89  $sMapClassInstanceName,
90  $sAddress,
91  $sCountry
92  ) {
93  $iRet = $this->_saveData($iEntryId, $sPart, $iZoom, $sMapType, $fLat, $fLng, $sMapClassInstanceName, $sAddress,
94  $sCountry);
95 
96  switch ((int)$iRet) {
97  case 404:
98  echo 404;
99  break;
100  case 403:
101  $this->_oTemplate->displayAccessDenied();
102  break;
103  case 1:
104  echo 1;
105  break;
106  }
107  }
108 
109  function actionSaveLocationPartHome($sPart, $iZoom, $sMapType, $fLat, $fLng)
110  {
111  $this->_saveLocationByPrefix('ch_wmap_home_' . $sPart, $iZoom, $sMapType, $fLat, $fLng);
112  }
113 
114  function actionSaveLocationHomepage($iZoom, $sMapType, $fLat, $fLng)
115  {
116  $this->_saveLocationByPrefix('ch_wmap_homepage', $iZoom, $sMapType, $fLat, $fLng);
117  }
118 
119  function actionSaveLocationSeparatePage($iZoom, $sMapType, $fLat, $fLng)
120  {
121  $this->_saveLocationByPrefix('ch_wmap_separate', $iZoom, $sMapType, $fLat, $fLng);
122  }
123 
124  function actionGetDataLocation($iId, $sPart, $sMapClassInstanceName)
125  {
126  if (!isset($this->_aParts[$sPart])) {
127  return;
128  }
129 
130  $iEntryId = (int)$iId;
131  $r = $this->_oDb->getDirectLocation($iEntryId, $this->_aParts[$sPart]);
132  if (!$r || empty($r['lat'])) {
133  return;
134  }
135 
136  if ('profiles' == $sPart) {
137  $r['title'] = getNickName($r['id']);
138  }
139 
140  $oPermalinks = new ChWsbPermalinks();
141  $sIcon = $this->_aParts[$r['part']]['icon_site'];
142  $sIcon = $GLOBALS['oFunctions']->sysImage(false === strpos($sIcon,
143  '.') ? $sIcon : $this->_oTemplate->getIconUrl($sIcon));
144  $aVars = array(
145  'icon' => $sIcon,
146  'title' => $r['title'],
147  'link' => CH_WSB_URL_ROOT . $oPermalinks->permalink($this->_aParts[$r['part']]['permalink'] . $r['uri'])
148  );
149  $sHtml = $this->_oTemplate->parseHtmlByName('popup_location', $aVars);
150 
151  $aIconJSON = $this->_getIconArray($sMapClassInstanceName == 'glChWmapEdit' ? '' : $this->_aParts[$r['part']]['icon']);
152 
153  $aRet = array();
154  $aRet[] = array(
155  'lat' => $r['lat'],
156  'lng' => $r['lng'],
157  'data' => $sHtml,
158  'icon' => $aIconJSON,
159  );
160 
161  echo json_encode($aRet);
162  }
163 
164  function actionGetData(
165  $iZoom,
166  $fLatMin,
167  $fLatMax,
168  $fLngMin,
169  $fLngMax,
170  $sMapClassInstanceName,
171  $sCustomParts = '',
172  $sCustom = ''
173  ) {
174  $fLatMin = (float)$fLatMin;
175  $fLatMax = (float)$fLatMax;
176  $fLngMin = (float)$fLngMin;
177  $fLngMax = (float)$fLngMax;
178  $iZoom = (int)$iZoom;
179 
180  echo $this->_getLocationsData($fLatMin, $fLatMax, $fLngMin, $fLngMax, $sCustomParts, $sCustom);
181  }
182 
183  function _getLocationsData($fLatMin, $fLatMax, $fLngMin, $fLngMax, $sCustomParts = '', $sCustom = '')
184  {
185  ch_import('ChWsbPrivacy');
186 
187  $oPermalinks = new ChWsbPermalinks();
188 
189  $aCustomParts = $this->_validateParts($sCustomParts);
190  $a = $this->_oDb->getLocationsByBounds('', (float)$fLatMin, (float)$fLatMax, (float)$fLngMin,
191  (float)$fLngMax, $aCustomParts, getLoggedId() ? array(CH_WSB_PG_ALL, CH_WSB_PG_MEMBERS) : CH_WSB_PG_ALL);
192 
193  $aa = array();
194  foreach ($a as $r) {
195  if (!$this->_oDb->getDirectLocation($r['id'], $this->_aParts[$r['part']], true))
196  continue;
197 
198  if ('profiles' == $r['part']) {
199  $r['title'] = getNickName($r['id']);
200  }
201 
202  $sKey = $r['lat'] . 'x' . $r['lng'];
203 
204  $sIcon = $this->_aParts[$r['part']]['icon_site'];
205  $sIcon = $GLOBALS['oFunctions']->sysImage(false === strpos($sIcon,
206  '.') ? $sIcon : $this->_oTemplate->getIconUrl($sIcon));
207 
208  $aVars = array(
209  'icon' => $sIcon,
210  'title' => $r['title'],
211  'link' => CH_WSB_URL_ROOT . $oPermalinks->permalink($this->_aParts[$r['part']]['permalink'] . $r['uri'])
212  );
213 
214  $aa[$sKey][] = array(
215  'lat' => $r['lat'],
216  'lng' => $r['lng'],
217  'title' => $r['title'],
218  'icon' => $this->_aParts[$r['part']]['icon'],
219  'html' => $this->_oTemplate->parseHtmlByName('popup_location', $aVars),
220  );
221  }
222 
223  $aRet = array();
224  foreach ($aa as $k => $a) {
225  $sHtml = '';
226  $aTitles = array();
227  $sIcon = '';
228  foreach ($a as $r) {
229  $sHtml .= $r['html'];
230  $aTitles[] = $r['title'];
231  $sIcon = $r['icon'];
232  }
233  $aVars = array('content' => $sHtml);
234  $aRet[] = array(
235  'lat' => $r['lat'],
236  'lng' => $r['lng'],
237  'titles' => $aTitles,
238  'data' => $this->_oTemplate->parseHtmlByName('popup_locations', $aVars),
239  'icon' => $this->_getIconArray((count($a) > 1 ? 'group.png' : $sIcon)),
240  );
241  }
242 
243  return json_encode($aRet);
244  }
245 
246  // ================================== admin actions
247 
248  function actionUpdateLocations($iLimit = 4, $iDelay = 6)
249  {
250  if (!$this->isAdmin()) {
251  $this->_oTemplate->displayAccessDenied();
252 
253  return;
254  }
255 
256  $iLimit = (int)$iLimit;
257  $iDelay = (int)$iDelay;
258 
259  $a = $this->_oDb->getUndefinedLocations($iLimit);
260  if ($a) {
261  foreach ($a as $r) {
262  $this->_updateLocation($iDelay, $r);
263  }
264 
265  $aVars = array(
266  'refresh' => 1,
267  'msg' => 'Entries update is in progress, please wait...',
268  );
269  echo $this->_oTemplate->parseHtmlByName('updating', $aVars);
270  } else {
271  $this->_oTemplate->displayMsg('Entries locations update has been completed');
272  }
273  }
274 
275  function actionAdministrationParts($sPart)
276  {
277  if (!$this->isAdmin()) {
278  $this->_oTemplate->displayAccessDenied();
279 
280  return;
281  }
282 
283  if (!isset($this->_aParts[$sPart])) {
284  $this->_oTemplate->displayPageNotFound();
285 
286  return;
287  }
288 
289  $this->_oTemplate->pageStart();
290 
291  ch_import('ChWsbAdminSettings');
292 
293  $mixedResult = '';
294  if (isset($_POST['save']) && isset($_POST['cat']) && (int)$_POST['cat']) {
295  $oSettings = new ChWsbAdminSettings((int)$_POST['cat']);
296  $mixedResult = $oSettings->saveChanges($_POST);
297  }
298 
299  foreach ($_POST as $k => $v) {
300  unset ($_POST[$k]);
301  }
302 
303  $aCats = array(
304  array(
305  'cat' => 'World Map Home: ' . ucfirst($sPart),
306  'title' => _t('_ch_wmap_admin_settings_part_home', _t($this->_aParts[$sPart]['title'])),
307  'extra' => 'return $this->_saveLocationForm ("PartHome", $this->serviceHomepagePartBlock ("' . $sPart . '"));',
308  ),
309  array(
310  'cat' => 'World Map Entry: ' . ucfirst($sPart),
311  'title' => _t('_ch_wmap_admin_settings_part_entry', _t($this->_aParts[$sPart]['title'])),
312  'extra' => '',
313  ),
314  array(
315  'cat' => 'World Map Edit Location: ' . ucfirst($sPart),
316  'title' => _t('_ch_wmap_admin_settings_edit_location', _t($this->_aParts[$sPart]['title'])),
317  'extra' => '',
318  ),
319  );
320 
321  foreach ($aCats as $a) {
322  $iId = $this->_oDb->getSettingsCategory($a['cat']);
323  $sResult = '';
324  if ($iId) {
326  $sResult = $oSettings->getForm();
327  if ($mixedResult !== true && !empty($mixedResult) && $_POST['cat'] == $iId) {
328  $sResult = $mixedResult . $sResult;
329  }
330  }
331  $sExtra = '';
332  if ($a['extra']) {
333  $aVars = array('content' => eval($a['extra']));
334  $sExtra = $this->_oTemplate->parseHtmlByName('extra_wrapper', $aVars);
335  }
336  $aVars = array('content' => $sResult . $sExtra);
337  echo $this->_oTemplate->adminBlock($this->_oTemplate->parseHtmlByName('default_padding', $aVars),
338  $a['title']);
339  }
340 
341  $this->_oTemplate->addJsAdmin($this->_sProto . '://www.google.com/jsapi?key=' . getParam('ch_wmap_key'));
342  $this->_oTemplate->addJsAdmin('modules/cheetah/world_map/js/|ChWmap.js');
343  $this->_oTemplate->addCssAdmin('main.css');
344  $this->_oTemplate->addCssAdmin('forms_adv.css');
345  $this->_oTemplate->pageCodeAdmin(_t('_ch_wmap_administration') . ' ' . _t($this->_aParts[$sPart]['title']));
346  }
347 
349  {
350  if (!$this->isAdmin()) {
351  $this->_oTemplate->displayAccessDenied();
352 
353  return;
354  }
355 
356  $this->_oTemplate->pageStart();
357 
358  $aPartsForVars = array();
359  foreach ($this->_aParts as $k => $r) {
360  $aPartsForVars[] = array(
361  'part' => $k,
362  'title' => _t($r['title']),
363  'icon' => $GLOBALS['oFunctions']->sysImage(false === strpos($r['icon_site'],
364  '.') ? $r['icon_site'] : $this->_oTemplate->getIconUrl($r['icon_site'])),
365  'link_base' => CH_WSB_URL_ROOT . $this->_oConfig->getBaseUri() . 'administration_parts/',
366  );
367  }
368 
369  $aVars = array(
370  'module_url' => CH_WSB_URL_ROOT . $this->_oConfig->getBaseUri(),
371  'ch_repeat:parts' => $aPartsForVars,
372  );
373  $sContent = $this->_oTemplate->parseHtmlByName('admin_links', $aVars);
374  echo $this->_oTemplate->adminBlock($sContent, _t('_ch_wmap_admin_links'), false, false, 11);
375 
376  ch_import('ChWsbAdminSettings');
377 
378  $mixedResult = '';
379  if (isset($_POST['save']) && isset($_POST['cat']) && (int)$_POST['cat']) {
380  $oSettings = new ChWsbAdminSettings((int)$_POST['cat']);
381  $mixedResult = $oSettings->saveChanges($_POST);
382  }
383 
384  foreach ($_POST as $k => $v) {
385  unset ($_POST[$k]);
386  }
387 
388  $aCats = array(
389  array(
390  'cat' => 'World Map General',
391  'title' => _t('_ch_wmap_admin_settings_general'),
392  'extra' => '',
393  ),
394  array(
395  'cat' => 'World Map Homepage',
396  'title' => _t('_ch_wmap_admin_settings_homepage'),
397  'extra' => 'return $this->_saveLocationForm ("Home", $this->serviceHomepageBlock ());',
398  ),
399  array(
400  'cat' => 'World Map Separate',
401  'title' => _t('_ch_wmap_admin_settings_separate'),
402  'extra' => 'return $this->_saveLocationForm ("Page", $this->serviceSeparatePageBlock ());',
403  ),
404  );
405 
406  foreach ($aCats as $a) {
407  $iId = $this->_oDb->getSettingsCategory($a['cat']);
408  $sResult = '';
409  if ($iId) {
411  $sResult = $oSettings->getForm();
412  if ($mixedResult !== true && !empty($mixedResult) && $_POST['cat'] == $iId) {
413  $sResult = $mixedResult . $sResult;
414  }
415  }
416  $sExtra = '';
417  if ($a['extra']) {
418  $aVars = array('content' => eval($a['extra']));
419  $sExtra = $this->_oTemplate->parseHtmlByName('extra_wrapper', $aVars);
420  }
421  $aVars = array('content' => $sResult . $sExtra);
422  echo $this->_oTemplate->adminBlock($this->_oTemplate->parseHtmlByName('default_padding', $aVars),
423  $a['title']);
424  }
425 
426  $this->_oTemplate->addJsAdmin($this->_sProto . '://www.google.com/jsapi?key=' . getParam('ch_wmap_key'));
427  $this->_oTemplate->addJsAdmin(CH_WSB_URL_MODULES . $this->_aModule['path'] . 'js/ChWmap.js');
428  $this->_oTemplate->addCssAdmin('main.css');
429  $this->_oTemplate->addCssAdmin('forms_adv.css');
430  $this->_oTemplate->pageCodeAdmin(_t('_ch_wmap_administration'));
431  }
432 
433  // ================================== service actions
434 
443  function serviceGetLocation($sPart, $iEntryId, $iViewer = false)
444  {
445  if (false === $iViewer) {
446  $iViewer = getLoggedId();
447  }
448 
449  if ('profiles' == $sPart) {
450  if (!ch_check_profile_visibility($iEntryId, $iViewer, true)) {
451  return -1;
452  }
453  } else {
454  ch_import('ChWsbPrivacy');
455  $oPrivacy = new ChWsbPrivacy($this->_aParts[$sPart]['join_table'], $this->_aParts[$sPart]['join_field_id'],
456  $this->_aParts[$sPart]['join_field_author']);
457  if (!$oPrivacy->check('view', $iEntryId, $iViewer)) {
458  return -1;
459  }
460  }
461 
462  $aLocation = $this->_oDb->getDirectLocation($iEntryId, $this->_aParts[$sPart]);
463  if (!$aLocation || (!$aLocation['lat'] && $aLocation['lng'])) {
464  return false;
465  }
466 
467  if (false === $aLocation['zoom'] || -1 == $aLocation['zoom']) {
468  $aLocation['zoom'] = getParam("ch_wmap_edit_{$sPart}_zoom");
469  }
470 
471  if (!$aLocation['type']) {
472  $aLocation['type'] = getParam("ch_wmap_edit_{$sPart}_map_type");
473  }
474 
475  return $aLocation;
476  }
477 
494  $sPart,
495  $iEntryId,
496  $fLat,
497  $fLng,
498  $iZoom,
499  $sMapType,
500  $sCountry = '',
501  $sState = '',
502  $sCity = '',
503  $sAddress = ''
504  ) {
505  $a = array('fLat', 'fLng', 'iZoom', 'sMapType', 'sCountry', 'sState', 'sCity', 'sAddress');
506  foreach ($a as $sVar) {
507  if ('' === $$sVar || false === $$sVar) {
508  $$sVar = 'null';
509  }
510  }
511 
512  return $this->_saveData($iEntryId, $sPart, $iZoom, $sMapType, $fLat, $fLng, '', $sAddress, $sCountry);
513  }
514 
522  function serviceEditLocation($sPart, $iEntryId)
523  {
524  if (!isset($this->_aParts[$sPart])) {
525  return false;
526  }
527 
528  $iEntryId = (int)$iEntryId;
529  $aLocation = $this->_oDb->getDirectLocation($iEntryId, $this->_aParts[$sPart]);
530  if ('profiles' == $sPart) {
531  $aLocation['title'] = getNickName($aLocation['id']);
532  }
533 
534  if (!$aLocation) {
535  return false;
536  }
537 
538  $fLat = false;
539  $fLng = false;
540  $iZoom = false;
541  $sMapType = false;
542 
543  if ($aLocation && !empty($aLocation['lat'])) {
544  $fLat = $aLocation['lat'];
545  $fLng = $aLocation['lng'];
546  $iZoom = $aLocation['zoom'];
547  $sMapType = $aLocation['type'];
548  }
549 
550  if (false === $fLat || false === $fLng) {
551  $aLocationCountry = $this->_geocode($aLocation['country'], $aLocation['country']);
552  $fLat = isset($aLocationCountry[0]) ? $aLocationCountry[0] : 0;
553  $fLng = isset($aLocationCountry[1]) ? $aLocationCountry[1] : 0;
554  $iZoom = CH_WMAP_ZOOM_DEFAULT_EDIT;
555  }
556 
557  if (false === $iZoom || -1 == $iZoom) {
558  $iZoom = getParam("ch_wmap_edit_{$sPart}_zoom");
559  }
560 
561  if (!$sMapType) {
562  $sMapType = getParam("ch_wmap_edit_{$sPart}_map_type");
563  }
564 
565  $aVars = array(
566  'msg_incorrect_google_key' => trim(_t('_ch_wmap_msg_incorrect_google_key')),
567  'loading' => _t('_loading ...'),
568  'map_control' => getParam("ch_wmap_edit_{$sPart}_control_type"),
569  'map_is_type_control' => getParam("ch_wmap_edit_{$sPart}_is_type_control") == 'on' ? 1 : 0,
570  'map_is_scale_control' => getParam("ch_wmap_edit_{$sPart}_is_scale_control") == 'on' ? 1 : 0,
571  'map_is_overview_control' => getParam("ch_wmap_edit_{$sPart}_is_overview_control") == 'on' ? 1 : 0,
572  'map_is_dragable' => getParam("ch_wmap_edit_{$sPart}_is_map_dragable") == 'on' ? 1 : 0,
573  'map_type' => $sMapType,
574  'map_lat' => $fLat,
575  'map_lng' => $fLng,
576  'map_zoom' => $iZoom,
577  'parts' => $sPart,
578  'custom' => '',
579  'suffix' => 'Edit',
580  'subclass' => 'ch_wmap_edit',
581  'data_url' => CH_WSB_URL_MODULES . "?r=wmap/get_data_location/$iEntryId/{parts}/{instance}/{ts}",
582  'save_data_url' => CH_WSB_URL_MODULES . "?r=wmap/save_data/$iEntryId/{parts}/{zoom}/{map_type}/{lat}/{lng}/{instance}/{address}/{country}/{ts}",
583  'save_location_url' => '',
584  'shadow_url' => '',
585  'key' => getParam('ch_wmap_key'),
586  );
587  $sMap = $this->_oTemplate->parseHtmlByName('map', $aVars);
588 
589  $oPermalinks = new ChWsbPermalinks();
590  $sBackLink = CH_WSB_URL_ROOT . $oPermalinks->permalink($this->_aParts[$aLocation['part']]['permalink'] . $aLocation['uri']);
591  $aVars = array(
592  'info' => sprintf(_t('_ch_wmap_edit'), "<a href=\"{$sBackLink}\">{$aLocation['title']}</a>",
593  _t($this->_aParts[$sPart]['title_singular'])),
594  'map' => $sMap,
595  );
596 
597  return array($this->_oTemplate->parseHtmlByName('map_edit', $aVars));
598  }
599 
606  {
607  $this->_oTemplate->addJs($this->_sProto . '://www.google.com/jsapi?key=' . getParam('ch_wmap_key'));
608  $this->_oTemplate->addJs('ChWmap.js');
609  $this->_oTemplate->addCss('main.css');
610 
611  return $this->serviceSeparatePageBlock(false, false, false, '', '', 'ch_wmap_homepage', 'ch_wmap_homepage',
612  'Home', 'homepage');
613  }
614 
620  function serviceHomepagePartBlock($sPart)
621  {
622  if (!isset($this->_aParts[$sPart])) {
623  return '';
624  }
625  $this->_oTemplate->addJs($this->_sProto . '://www.google.com/jsapi?key=' . getParam('ch_wmap_key'));
626  $this->_oTemplate->addJs('ChWmap.js');
627  $this->_oTemplate->addCss('main.css');
628 
629  return $this->serviceSeparatePageBlock(false, false, false, $sPart, '', 'ch_wmap_homepage_part',
630  'ch_wmap_home_' . $sPart, 'PartHome', 'part_home/' . $sPart, false);
631  }
632 
639  $fLat = false,
640  $fLng = false,
641  $iZoom = false,
642  $sPartsCustom = '',
643  $sCustom = '',
644  $sSubclass = 'ch_wmap_separate',
645  $sParamPrefix = 'ch_wmap_separate',
646  $sSuffix = 'Page',
647  $sSaveLocationSuffix = 'separate_page',
648  $isPartsSelector = true
649  ) {
650  if (false === $fLat) {
651  $fLat = getParam($sParamPrefix . '_lat');
652  }
653  if (false === $fLng) {
654  $fLng = getParam($sParamPrefix . '_lng');
655  }
656  if (false === $iZoom) {
657  $iZoom = getParam($sParamPrefix . '_zoom');
658  }
659 
660  $aVars = array(
661  'msg_incorrect_google_key' => trim(_t('_ch_wmap_msg_incorrect_google_key')),
662  'loading' => _t('_loading ...'),
663  'map_control' => getParam($sParamPrefix . '_control_type'),
664  'map_is_type_control' => getParam($sParamPrefix . '_is_type_control') == 'on' ? 1 : 0,
665  'map_is_scale_control' => getParam($sParamPrefix . '_is_scale_control') == 'on' ? 1 : 0,
666  'map_is_overview_control' => getParam($sParamPrefix . '_is_overview_control') == 'on' ? 1 : 0,
667  'map_is_dragable' => getParam($sParamPrefix . '_is_map_dragable') == 'on' ? 1 : 0,
668  'map_type' => getParam($sParamPrefix . '_map_type'),
669  'map_lat' => $fLat,
670  'map_lng' => $fLng,
671  'map_zoom' => $iZoom,
672  'parts' => $sPartsCustom,
673  'custom' => $sCustom,
674  'suffix' => $sSuffix,
675  'subclass' => $sSubclass,
676  'data_url' => CH_WSB_URL_MODULES . "?r=wmap/get_data/{zoom}/{lat_min}/{lat_max}/{lng_min}/{lng_max}/{instance}/{parts}/{custom}",
677  'save_data_url' => '',
678  'save_location_url' => $this->isAdmin() ? CH_WSB_URL_MODULES . "?r=wmap/save_location_{$sSaveLocationSuffix}/{zoom}/{map_type}/{lat}/{lng}" : '',
679  'shadow_url' => $this->_oTemplate->getIconUrl('flag_icon_shadow.png'),
680  'lang' => ch_lang_name(),
681  'key' => getParam('ch_wmap_key'),
682  );
683  $sMap = $this->_oTemplate->parseHtmlByName('map', $aVars);
684 
685  if (!$isPartsSelector) {
686  return array($sMap);
687  }
688 
689  $aVarsParts = array(
690  'suffix' => $aVars['suffix'],
691  'subclass' => $aVars['subclass'],
692  'ch_repeat:parts' => array(),
693  );
694  $aPartsSelected = $this->_validateParts($sPartsCustom);
695  foreach ($this->_aParts AS $k => $r) {
696  $aVarsParts['ch_repeat:parts'][] = array(
697  'part' => $k,
698  'title' => _t($r['title']),
699  'icon' => $GLOBALS['oFunctions']->sysImage(false === strpos($r['icon_site'],
700  '.') ? $r['icon_site'] : $this->_oTemplate->getIconUrl($r['icon_site'])),
701  'suffix' => $aVars['suffix'],
702  'checked' => isset($aPartsSelected[$k]) ? 'checked' : '',
703  );
704  }
705  $sMapParts = $this->_oTemplate->parseHtmlByName('map_parts', $aVarsParts);
706 
707  return array($sMapParts . $sMap);
708  }
709 
717  function serviceLocationBlock($sPart, $iEntryId)
718  {
719  if (!isset($this->_aParts[$sPart])) {
720  return '';
721  }
722 
723  $sParamPrefix = 'ch_wmap_entry_' . $sPart;
724  $iEntryId = (int)$iEntryId;
725  $r = $this->_oDb->getDirectLocation($iEntryId, $this->_aParts[$sPart]);
726 
727  $sBoxContent = '';
728  if ($r && !empty($r['lat'])) {
729 
730  $aVars = array(
731  'msg_incorrect_google_key' => _t('_ch_wmap_msg_incorrect_google_key'),
732  'loading' => _t('_loading ...'),
733  'map_control' => getParam($sParamPrefix . '_control_type'),
734  'map_is_type_control' => getParam($sParamPrefix . '_is_type_control') == 'on' ? 1 : 0,
735  'map_is_scale_control' => getParam($sParamPrefix . '_is_scale_control') == 'on' ? 1 : 0,
736  'map_is_overview_control' => getParam($sParamPrefix . '_is_overview_control') == 'on' ? 1 : 0,
737  'map_is_dragable' => getParam($sParamPrefix . '_is_map_dragable') == 'on' ? 1 : 0,
738  'map_lat' => $r['lat'],
739  'map_lng' => $r['lng'],
740  'map_zoom' => -1 != $r['zoom'] ? $r['zoom'] : (getParam($sParamPrefix . '_zoom') ? getParam($sParamPrefix . '_zoom') : CH_WMAP_ZOOM_DEFAULT_ENTRY),
741  'map_type' => $r['type'] ? $r['type'] : (getParam($sParamPrefix . '_map_type') ? getParam($sParamPrefix . '_map_type') : 'normal'),
742  'parts' => $sPart,
743  'custom' => '',
744  'suffix' => 'Location',
745  'subclass' => 'ch_wmap_location_box',
746  'data_url' => CH_WSB_URL_MODULES . "' + '?r=wmap/get_data_location/" . $iEntryId . "/" . $sPart . "/{instance}",
747  'save_data_url' => '',
748  'save_location_url' => '',
749  'shadow_url' => '',
750  'lang' => ch_lang_name(),
751  'key' => getParam('ch_wmap_key'),
752  );
753  $this->_oTemplate->addJs($this->_sProto . '://www.google.com/jsapi?key=' . getParam('ch_wmap_key'));
754  $this->_oTemplate->addJs('ChWmap.js');
755  $this->_oTemplate->addCss('main.css');
756 
757  $aVars2 = array(
758  'map' => $this->_oTemplate->parseHtmlByName('map', $aVars),
759  );
760  $sBoxContent = $this->_oTemplate->parseHtmlByName('entry_location', $aVars2);
761  }
762 
763  $sBoxFooter = '';
764  if ($r['author_id'] == $this->_iProfileId || $this->isAdmin()) {
765  $aVars = array(
766  'icon' => $this->_oTemplate->getIconUrl('more.png'),
767  'url' => $this->_oConfig->getBaseUri() . "edit/$iEntryId/$sPart",
768  'title' => _t('_ch_wmap_box_footer_edit'),
769  );
770  $sBoxFooter = $this->_oTemplate->parseHtmlByName('box_footer', $aVars);
771  if (!$sBoxContent) {
772  $sBoxContent = MsgBox(_t('_ch_wmap_msg_locations_is_not_defined'));
773  }
774  }
775 
776  if ($sBoxContent || $sBoxFooter) {
777  return array($sBoxContent, array(), $sBoxFooter);
778  }
779 
780  return '';
781  }
782 
783  function serviceResponseEntryDelete($sPart, $iEntryId)
784  {
785  if (!isset($this->_aParts[$sPart])) {
786  return false;
787  }
788 
789  $aPart = $this->_aParts[$sPart];
790 
791  return $this->_oDb->deleteLocation((int)$iEntryId, $sPart);
792  }
793 
794  function serviceResponseEntryAdd($sPart, $iEntryId)
795  {
796  return $this->serviceResponseEntryChange($sPart, $iEntryId);
797  }
798 
799  function serviceResponseEntryChange($sPart, $iEntryId)
800  {
801  if (!isset($this->_aParts[$sPart])) {
802  return false;
803  }
804 
805  $aPart = $this->_aParts[$sPart];
806 
807  $a = $this->_oDb->getDirectLocation($iEntryId, $aPart);
808  if (!$a) {
809  return false;
810  }
811 
812  if ($a['lat'] && $a['lng'] && $a['type']) {
813  // Don't update location (just update privacy)
814  // if it is already geocoded automatically.
815  // The manual update will not be erased (detected by 'type')
816  $this->_oDb->updateLocationPrivacy((int)$a['id'],
817  !empty($a['privacy']) ? $a['privacy'] : CH_WMAP_PRIVACY_DEFAULT);
818 
819  return true;
820  }
821 
822  return $this->_updateLocation(0, $a);
823  }
824 
825  function servicePartEnable($sPart, $isEnable, $isClearPartLocations = false)
826  {
827  if (!$this->_oDb->enablePart($sPart, (int)$isEnable)) {
828  return false;
829  }
830 
831  if ($isClearPartLocations) {
832  $this->_oDb->clearLocations($sPart, false);
833  }
834 
835  return true;
836  }
837 
838  function servicePartUpdate($sPart, $a)
839  {
840  if (!$this->_oDb->updatePart($sPart, $a))
841  return false;
842 
843  return true;
844  }
845 
846  function servicePartInstall($sPart, $a)
847  {
848  $aDefaults = array(
849  'part' => $sPart,
850  'title' => '',
851  'title_singular' => '',
852  'icon' => '',
853  'icon_site' => '',
854  'join_table' => '',
855  'join_where' => '',
856  'join_field_id' => 'id',
857  'join_field_country' => '',
858  'join_field_city' => '',
859  'join_field_state' => '',
860  'join_field_zip' => '',
861  'join_field_address' => '',
862  'join_field_latitude' => '',
863  'join_field_longitude' => '',
864  'join_field_title' => '',
865  'join_field_uri' => '',
866  'join_field_author' => '',
867  'join_field_privacy' => '',
868  'permalink' => '',
869  'enabled' => 1
870  );
871 
872  $aOptions = array_merge($aDefaults, $a);
873 
874  if (!$this->_oDb->addPart($aOptions)) {
875  return false;
876  }
877 
878  return true;
879  }
880 
881  function servicePartUninstall($sPart)
882  {
883  $this->_oDb->clearLocations($sPart, false);
884 
885  return $this->_oDb->removePart($sPart);
886  }
887 
888  // ================================== events
889 
890  function onEventGeolocateProfile($iProfileId, $aLocation)
891  {
892  ch_import('ChWsbAlerts');
893  $oAlert = new ChWsbAlerts('ch_wmap', 'geolocate_profile', $iProfileId, $this->_iProfileId,
894  array('location' => $aLocation));
895  $oAlert->alert();
896  }
897 
898  function onEventLocationManuallyUpdated($sPart, $iEntryId, $aLocation)
899  {
900  ch_import('ChWsbAlerts');
901  $oAlert = new ChWsbAlerts('ch_wmap', 'location_manually_updated', $iEntryId, $this->_iProfileId,
902  array('location' => $aLocation, 'part' => $sPart));
903  $oAlert->alert();
904  }
905 
906  // ================================== permissions
907 
908  function isAllowedEditOwnLocation(&$aLocation)
909  {
910  if (!$this->_iProfileId) {
911  return false;
912  }
913  if ($this->isAdmin()) {
914  return true;
915  }
916  if ($aLocation && $aLocation['author_id'] == $this->_iProfileId) {
917  return true;
918  }
919 
920  return false;
921  }
922 
923  function isAdmin()
924  {
925  return $GLOBALS['logged']['admin'] || $GLOBALS['logged']['moderator'];
926  }
927 
928  // ================================== other
929 
930  function _geocode($sAddress, $sCountryCode = '')
931  {
932  $sStatus = false;
933 
934  $sAddress = rawurlencode($sAddress);
935 
936  $sUrl = ch_proto() . "://maps.googleapis.com/maps/api/geocode/json";
937 
938  $s = ch_file_get_contents($sUrl, array(
939  'address' => $sAddress,
940  'sensor' => 'false'
941  ));
942 
943  $oData = json_decode($s);
944  if (null == $oData) {
945  return false;
946  }
947 
948  if ('OK' != $oData->status) {
949  return false;
950  }
951 
952  foreach ($oData->results as $oResult) {
953  $sShortNameCountry = '';
954  foreach ($oResult->address_components as $oAddressComponent) {
955  if (in_array('country', $oAddressComponent->types)) {
956  $sShortNameCountry = $oAddressComponent->short_name;
957  }
958  }
959 
960  if (!$sCountryCode || ($sShortNameCountry && $sCountryCode == $sShortNameCountry)) {
961  $oLocation = $oResult->geometry->location;
962 
963  return array($oLocation->lat, $oLocation->lng, $sShortNameCountry);
964  }
965  }
966 
967  return false;
968  }
969 
970  function _updateLocation($iDelay, &$r)
971  {
972  $iDelay = (int)$iDelay;
973 
974  $iId = (int)$r['id'];
975  $a = false;
976 
977  if (isset($r['latitude']) && isset($r['longitude'])) {
978  $r['latitude'] = floatval($r['latitude']);
979  $r['longitude'] = floatval($r['longitude']);
980  if (is_float($r['latitude']) && is_float($r['longitude'])) {
981  if ($iDelay) {
982  sleep($iDelay);
983  }
984  $a = $this->_geocode($r['latitude'] . ', ' . $r['longitude']);
985  }
986  } else {
987  $sState = '';
988  if (isset($r['state']) && trim($r['state'])) {
989  $sState = ' ' . $r['state'];
990  }
991 
992  if (isset($r['address']) && trim($r['address'])) {
993  if ($iDelay) {
994  sleep($iDelay);
995  }
996  $a = $this->_geocode($r['address'] . ' ' . $r['city'] . ' ' . $r['state'] . $r['country'],
997  $r['country']);
998  }
999 
1000  if (!$a && isset($r['zip']) && trim($r['zip'])) {
1001  if ($iDelay) {
1002  sleep($iDelay);
1003  }
1004  $a = $this->_geocode($r['zip'] . ' ' . $r['country'], $r['country']);
1005  }
1006 
1007  if (!$a) {
1008  if ($iDelay) {
1009  sleep($iDelay);
1010  }
1011  $a = $this->_geocode($r['city'] . ' ' . $r['state'] . $r['country'], $r['country']);
1012  }
1013  }
1014 
1016 
1017  $mixedPrivacy = !empty($r['privacy']) ? $r['privacy'] : CH_WMAP_PRIVACY_DEFAULT;
1018 
1019  if ($a) {
1020  $this->_oDb->insertLocation($iId, $r['part'], $sTitle, $r['uri'], $a[0], $a[1], -1, '',
1021  process_db_input($r['city'] . ', ' . $r['country'], CH_TAGS_NO_ACTION, CH_SLASHES_NO_ACTION),
1023  process_db_input($r['country'], CH_TAGS_NO_ACTION, CH_SLASHES_NO_ACTION), $mixedPrivacy, 0);
1024  $bRet = true;
1025  } else {
1026  $this->_oDb->insertLocation($iId, $r['part'], $sTitle, $r['uri'], 0, 0, -1, '', '', '', '', $mixedPrivacy,
1027  1);
1028  $bRet = false;
1029  }
1030 
1031  $this->onEventGeolocateProfile($iId, array(
1032  'lat' => (isset($a[0]) ? $a[0] : false),
1033  'lng' => (isset($a[1]) ? $a[1] : false),
1034  'country' => $sCountryCode
1035  ));
1036 
1037  return $bRet;
1038  }
1039 
1040  function _saveLocationByPrefix($sPrefix, $iZoom, $sMapType, $fLat, $fLng)
1041  {
1042  if (!$this->isAdmin()) {
1043  echo 'Access denied';
1044 
1045  return;
1046  }
1047 
1048  if ($iZoom = (int)$iZoom) {
1049  setParam($sPrefix . '_zoom', $iZoom);
1050  }
1051 
1052  switch ($sMapType) {
1053  case 'normal':
1054  case 'satellite':
1055  case 'hybrid':
1056  setParam($sPrefix . '_map_type', $sMapType);
1057  }
1058 
1059  if ($fLat = (float)$fLat) {
1060  setParam($sPrefix . '_lat', $fLat);
1061  }
1062 
1063  if ($fLng = (float)$fLng) {
1064  setParam($sPrefix . '_lng', $fLng);
1065  }
1066 
1067  echo 'ok';
1068  }
1069 
1070  function _saveLocationForm($sSuffix, $sMap)
1071  {
1072  if (is_array($sMap)) {
1073  $sMap = $sMap[0];
1074  }
1075 
1076  if (!preg_match('/^[A-Za-z0-9]+$/', $sSuffix)) {
1077  return '';
1078  }
1079 
1080  $aCustomForm = array(
1081 
1082  'form_attrs' => array(
1083  'name' => "ch_wmap_save_location_{$sSuffix}",
1084  'onsubmit' => "return glChWmap{$sSuffix}.saveLocation();",
1085  'method' => 'post',
1086  ),
1087 
1088  'inputs' => array(
1089 
1090  'Map' => array(
1091  'type' => 'custom',
1092  'content' => "<div class=\"ch_wmap_form_map\">$sMap</div>",
1093  'name' => 'Map',
1094  'caption' => _t('_ch_wmap_admin_map'),
1095  ),
1096 
1097  'Submit' => array(
1098  'type' => 'submit',
1099  'name' => 'submit_form',
1100  'value' => _t('_ch_wmap_admin_save_location'),
1101  ),
1102  ),
1103  );
1104 
1105  $f = new ChTemplFormView ($aCustomForm);
1106 
1107  return $f->getCode();
1108  }
1109 
1113  function _saveData(
1114  $iEntryId,
1115  $sPart,
1116  $iZoom,
1117  $sMapType,
1118  $fLat,
1119  $fLng,
1120  $sMapClassInstanceName = '',
1121  $sAddress = 'null',
1122  $sCountry = 'null'
1123  ) {
1124  if (!isset($this->_aParts[$sPart])) {
1125  return 404;
1126  }
1127 
1128  $iEntryId = (int)$iEntryId;
1129  $aLocation = $this->_iProfileId ? $this->_oDb->getDirectLocation($iEntryId, $this->_aParts[$sPart]) : false;
1130 
1131  if (!$aLocation || !$this->isAllowedEditOwnLocation($aLocation)) {
1132  return 403;
1133  }
1134 
1135  if (!$aLocation && ('null' == $fLat || 'null' == $fLng)) {
1136  return false;
1137  }
1138 
1139  $fLat = 'null' != $fLat ? (float)$fLat : $aLocation['lat'];
1140  $fLng = 'null' != $fLng ? (float)$fLng : $aLocation['lng'];
1141  $iZoom = 'null' != $iZoom ? (int)$iZoom : ($aLocation ? $aLocation['zoom'] : -1);
1142  $sMapType = $sMapType && 'null' != $sMapType ? $sMapType : ($aLocation ? $aLocation['type'] : '');
1143  $sAddress = $sAddress && 'null' != $sAddress ? process_db_input($sAddress,
1144  CH_TAGS_STRIP) : ($aLocation ? process_db_input($aLocation['address'], CH_TAGS_NO_ACTION,
1145  CH_SLASHES_NO_ACTION) : '');
1147  CH_TAGS_STRIP) : ($aLocation ? process_db_input($aLocation['country'], CH_TAGS_NO_ACTION,
1148  CH_SLASHES_NO_ACTION) : '');
1149 
1150  switch ($sMapType) {
1151  case 'normal':
1152  case 'satellite':
1153  case 'hybrid':
1154  break;
1155  default:
1156  $sMapType = 'normal';
1157  }
1158 
1159  $aLocation['city'] = process_db_input($aLocation['city'], CH_TAGS_NO_ACTION, CH_SLASHES_NO_ACTION);
1160  $aLocation['title'] = process_db_input($aLocation['title'], CH_TAGS_NO_ACTION, CH_SLASHES_NO_ACTION);
1161  $mixedPrivacy = !empty($aLocation['privacy']) ? $aLocation['privacy'] : CH_WMAP_PRIVACY_DEFAULT;
1162 
1163  if (!$this->_oDb->insertLocation($iEntryId, $sPart, $aLocation['title'], $aLocation['uri'], $fLat, $fLng,
1164  $iZoom, $sMapType, $sAddress, $aLocation['city'], $sCountry, $mixedPrivacy)
1165  ) {
1166  return false;
1167  }
1168 
1169  $this->onEventLocationManuallyUpdated($sPart, $iEntryId, array(
1170  'lat' => $fLat,
1171  'lng' => $fLng,
1172  'zoom' => $iZoom,
1173  'map_type' => $sMapType,
1174  'address' => $sAddress,
1175  'country' => $sCountry
1176  ));
1177 
1178  return true;
1179  }
1180 
1181  function _validateParts($sParts)
1182  {
1183  $aPartsRet = array();
1184  $aPartsTmp = explode(',', $sParts);
1185  foreach ($aPartsTmp as $sPart) {
1186  if (isset($this->_aParts[$sPart])) {
1187  $aPartsRet[$sPart] = $sPart;
1188  }
1189  }
1190  if (!$aPartsRet) {
1191  foreach ($this->_aParts as $sPart => $r) {
1192  $aPartsRet[$sPart] = $sPart;
1193  }
1194  }
1195 
1196  return $aPartsRet;
1197  }
1198 
1199  function _getIconArray($sBaseFilename = '', $isCountryFlag = false)
1200  {
1201  if ($isCountryFlag) {
1202  $this->aIconsSizes['country_flag']['url'] = $sBaseFilename;
1203 
1204  return $this->aIconsSizes['country_flag'];
1205  }
1206 
1207  if (!$sBaseFilename) {
1208  return $this->aIconsSizes['default'];
1209  }
1210 
1211  if (empty($this->aIconsSizes[$sBaseFilename])) {
1212  $this->aIconsSizes[$sBaseFilename] = $this->aIconsSizes['default'];
1213  }
1214 
1215  if (empty($this->aIconsSizes[$sBaseFilename]['url'])) {
1216  $this->aIconsSizes[$sBaseFilename]['url'] = $this->_oTemplate->getIconUrl($sBaseFilename);
1217  }
1218 
1219  return $this->aIconsSizes[$sBaseFilename];
1220  }
1221 
1222 }
process_db_input
process_db_input($sText, $iStripTags=0)
Definition: utils.inc.php:256
$oSettings
$oSettings
Definition: advanced_settings.php:20
ChWmapModule\$_sProto
$_sProto
Definition: ChWmapModule.php:19
ChWmapModule\_saveLocationByPrefix
_saveLocationByPrefix($sPrefix, $iZoom, $sMapType, $fLat, $fLng)
Definition: ChWmapModule.php:1040
ChTemplFormView
Definition: ChTemplFormView.php:11
ChWmapModule\_saveData
_saveData( $iEntryId, $sPart, $iZoom, $sMapType, $fLat, $fLng, $sMapClassInstanceName='', $sAddress='null', $sCountry='null')
Definition: ChWmapModule.php:1113
ChWmapModule\serviceResponseEntryDelete
serviceResponseEntryDelete($sPart, $iEntryId)
Definition: ChWmapModule.php:783
MsgBox
MsgBox($sText, $iTimer=0)
Definition: design.inc.php:175
$f
global $f
Definition: callback.php:13
$sBoxContent
$sBoxContent
Definition: db.php:35
$sResult
$sResult
Definition: advanced_settings.php:26
$aModule
$aModule
Definition: classifieds.php:21
ChWmapModule\servicePartUninstall
servicePartUninstall($sPart)
Definition: ChWmapModule.php:881
ch_import
ch_import($sClassName, $aModule=array())
Definition: utils.inc.php:1218
ChWmapModule\serviceGetLocation
serviceGetLocation($sPart, $iEntryId, $iViewer=false)
Definition: ChWmapModule.php:443
$oAlert
$oAlert
Definition: embed.php:15
ChWmapModule\serviceHomepageBlock
serviceHomepageBlock()
Definition: ChWmapModule.php:605
ChWmapModule\_getLocationsData
_getLocationsData($fLatMin, $fLatMax, $fLngMin, $fLngMax, $sCustomParts='', $sCustom='')
Definition: ChWmapModule.php:183
$sUrl
$sUrl
Definition: cart.php:15
php
ChWmapModule\serviceUpdateLocationManually
serviceUpdateLocationManually( $sPart, $iEntryId, $fLat, $fLng, $iZoom, $sMapType, $sCountry='', $sState='', $sCity='', $sAddress='')
Definition: ChWmapModule.php:493
$iId
$iId
Definition: license.php:15
$oPage
$oPage
Definition: search_home.php:83
ChWmapModule\actionSaveData
actionSaveData( $iEntryId, $sPart, $iZoom, $sMapType, $fLat, $fLng, $sMapClassInstanceName, $sAddress, $sCountry)
Definition: ChWmapModule.php:82
ChWmapModule\_geocode
_geocode($sAddress, $sCountryCode='')
Definition: ChWmapModule.php:930
CH_WMAP_ZOOM_DEFAULT_ENTRY
const CH_WMAP_ZOOM_DEFAULT_ENTRY
Definition: ChWmapModule.php:11
CH_SLASHES_NO_ACTION
const CH_SLASHES_NO_ACTION
Definition: utils.inc.php:30
ChWmapModule\__construct
__construct(&$aModule)
Definition: ChWmapModule.php:25
ChWmapPageMain
Definition: ChWmapPageMain.php:11
ChWmapModule\_validateParts
_validateParts($sParts)
Definition: ChWmapModule.php:1181
ch_check_profile_visibility
ch_check_profile_visibility($iViewedId, $iViewerId=0, $bReturn=false)
Definition: profiles.inc.php:605
ChWmapModule\onEventLocationManuallyUpdated
onEventLocationManuallyUpdated($sPart, $iEntryId, $aLocation)
Definition: ChWmapModule.php:898
ChWmapModule
Definition: ChWmapModule.php:16
ChWmapModule\$_aParts
$_aParts
Definition: ChWmapModule.php:18
ChWsbAlerts
Definition: ChWsbAlerts.php:39
ChWmapModule\actionUpdateLocations
actionUpdateLocations($iLimit=4, $iDelay=6)
Definition: ChWmapModule.php:248
getParam
getParam($sParamName, $bUseCache=true)
Definition: db.inc.php:130
ChWmapModule\serviceEditLocation
serviceEditLocation($sPart, $iEntryId)
Definition: ChWmapModule.php:522
ChWmapModule\actionGetDataLocation
actionGetDataLocation($iId, $sPart, $sMapClassInstanceName)
Definition: ChWmapModule.php:124
ChWmapModule\servicePartInstall
servicePartInstall($sPart, $a)
Definition: ChWmapModule.php:846
getLoggedId
getLoggedId()
Definition: profiles.inc.php:32
$sTitle
$sTitle
Definition: actions.inc.php:13
CH_WMAP_ZOOM_DEFAULT_EDIT
const CH_WMAP_ZOOM_DEFAULT_EDIT
Definition: ChWmapModule.php:12
getNickName
getNickName( $ID='')
Definition: profiles.inc.php:461
CH_WMAP_PRIVACY_DEFAULT
const CH_WMAP_PRIVACY_DEFAULT
Definition: ChWmapModule.php:13
ChWmapModule\isAllowedEditOwnLocation
isAllowedEditOwnLocation(&$aLocation)
Definition: ChWmapModule.php:908
ChWmapModule\actionGetData
actionGetData( $iZoom, $fLatMin, $fLatMax, $fLngMin, $fLngMax, $sMapClassInstanceName, $sCustomParts='', $sCustom='')
Definition: ChWmapModule.php:164
CH_TAGS_NO_ACTION
const CH_TAGS_NO_ACTION
Definition: utils.inc.php:21
ch_file_get_contents
ch_file_get_contents($sFileUrl, $aParams=array(), $sMethod='get', $aHeaders=array(), &$sHttpCode=null)
Definition: utils.inc.php:1357
ChWsbModule
Definition: ChWsbModule.php:41
ChWmapModule\actionSaveLocationSeparatePage
actionSaveLocationSeparatePage($iZoom, $sMapType, $fLat, $fLng)
Definition: ChWmapModule.php:119
$sContent
$sContent
Definition: bottom_menu_compose.php:169
_t
_t($key, $arg0="", $arg1="", $arg2="")
Definition: languages.inc.php:509
CH_WSB_PG_ALL
const CH_WSB_PG_ALL
Definition: ChWsbPrivacy.php:12
ChWmapModule\_updateLocation
_updateLocation($iDelay, &$r)
Definition: ChWmapModule.php:970
ch_proto
ch_proto($sUrl=CH_WSB_URL_ROOT)
Definition: utils.inc.php:1848
ChWsbAdminSettings
Definition: ChWsbAdminSettings.php:35
ChWmapModule\onEventGeolocateProfile
onEventGeolocateProfile($iProfileId, $aLocation)
Definition: ChWmapModule.php:890
ChWmapModule\servicePartEnable
servicePartEnable($sPart, $isEnable, $isClearPartLocations=false)
Definition: ChWmapModule.php:825
CH_TAGS_STRIP
const CH_TAGS_STRIP
Definition: utils.inc.php:22
ChWmapModule\$aIconsSizes
$aIconsSizes
Definition: ChWmapModule.php:20
ChWmapModule\isAdmin
isAdmin()
Definition: ChWmapModule.php:923
$aVars
$aVars
Definition: license.php:101
ChWmapModule\servicePartUpdate
servicePartUpdate($sPart, $a)
Definition: ChWmapModule.php:838
ChWmapModule\actionHome
actionHome()
Definition: ChWmapModule.php:34
ChWmapModule\$_iProfileId
$_iProfileId
Definition: ChWmapModule.php:17
$s
$s
Definition: embed.php:13
setParam
setParam($sParamName, $sParamValue)
Definition: db.inc.php:149
ChWmapModule\serviceResponseEntryAdd
serviceResponseEntryAdd($sPart, $iEntryId)
Definition: ChWmapModule.php:794
$sCountry
$sCountry
Definition: browse.php:26
ChWmapModule\actionSaveLocationPartHome
actionSaveLocationPartHome($sPart, $iZoom, $sMapType, $fLat, $fLng)
Definition: ChWmapModule.php:109
ChWmapModule\serviceLocationBlock
serviceLocationBlock($sPart, $iEntryId)
Definition: ChWmapModule.php:717
CH_WSB_PG_MEMBERS
const CH_WSB_PG_MEMBERS
Definition: ChWsbPrivacy.php:13
ChWsbPrivacy
Definition: ChWsbPrivacy.php:60
ch_lang_name
ch_lang_name()
Definition: languages.inc.php:557
ChWmapModule\_saveLocationForm
_saveLocationForm($sSuffix, $sMap)
Definition: ChWmapModule.php:1070
empty
Attr AllowedRel this is empty
Definition: Attr.AllowedRel.txt:7
ChWmapModule\serviceHomepagePartBlock
serviceHomepagePartBlock($sPart)
Definition: ChWmapModule.php:620
ChWmapModule\serviceSeparatePageBlock
serviceSeparatePageBlock( $fLat=false, $fLng=false, $iZoom=false, $sPartsCustom='', $sCustom='', $sSubclass='ch_wmap_separate', $sParamPrefix='ch_wmap_separate', $sSuffix='Page', $sSaveLocationSuffix='separate_page', $isPartsSelector=true)
Definition: ChWmapModule.php:638
ChWmapModule\serviceResponseEntryChange
serviceResponseEntryChange($sPart, $iEntryId)
Definition: ChWmapModule.php:799
as
as
Definition: Filter.ExtractStyleBlocks.Escaping.txt:10
ChWmapModule\actionAdministration
actionAdministration()
Definition: ChWmapModule.php:348
ChWmapModule\actionAdministrationParts
actionAdministrationParts($sPart)
Definition: ChWmapModule.php:275
$sStatus
$sStatus
Definition: actions.inc.php:11
ChWmapModule\_getIconArray
_getIconArray($sBaseFilename='', $isCountryFlag=false)
Definition: ChWmapModule.php:1199
ChWmapPageEdit
Definition: ChWmapPageEdit.php:11
$iProfileId
if( $sMembersList) $iProfileId
Definition: communicator.php:29
$GLOBALS
$GLOBALS['iAdminPage']
Definition: advanced_settings.php:10
ChWmapModule\actionEdit
actionEdit($iEntryId, $sPart)
Definition: ChWmapModule.php:48
ChWmapModule\actionSaveLocationHomepage
actionSaveLocationHomepage($iZoom, $sMapType, $fLat, $fLng)
Definition: ChWmapModule.php:114