public function execute() { GWF_Website::plaintext(); GWF3::setConfig('store_last_url', false); $lat = $this->module->lat(); $lon = $this->module->lon(); $descr = trim(Common::getGetString('pp_descr')); $descr = $descr === '' ? null : $descr; $id = Common::getGetInt('pp_id', 0); $user = GWF_User::getStaticOrGuest(); $uid = $user->getID(); if (!GWF_ProfilePOI::changeAllowed($id, $uid)) { $this->module->ajaxError('Permission error!'); } $count = $id === 0 ? GWF_ProfilePOI::getPOICount($uid) : 0; $max_pois = $this->module->cfgAllowedPOIs(); if ($count >= $max_pois) { $this->module->ajaxErr('err_poi_exceed'); } $poi = new GWF_ProfilePOI(array('pp_id' => $id, 'pp_uid' => $uid, 'pp_lat' => $lat, 'pp_lon' => $lon, 'pp_descr' => $descr)); $poi->replace(); $data = $poi->getGDOData(); $data['user_name'] = $user->getVar('user_name'); die(json_encode($data)); }
public function execute() { GWF_Website::plaintext(); GWF3::setConfig('store_last_url', false); $id = Common::getGetInt('pp_id'); if (!GWF_ProfilePOI::changeAllowed($id, GWF_Session::getUserID())) { $this->module->ajaxError('Permission error!'); } GDO::table('GWF_ProfilePOI')->deleteWhere("pp_id = {$id}"); die("{$id}"); }
private function templatePlaces() { GWF_Website::addJavascript($this->googleMapsPath()); GWF_Website::addJavascript(GWF_WEB_ROOT_NO_LANG . 'js/module/Profile/profile.js?v=57'); // GWF_Website::addJavascript(GWF_WEB_ROOT_NO_LANG.'js/3p/fancybox/jquery.fancybox.pack.js'); // GWF_Website::addCSS(GWF_WEB_ROOT_NO_LANG.'js/3p/fancybox/jquery.fancybox.css'); // GWF_Website::addCSS(GWF_WEB_ROOT_NO_LANG.'css/profile_poi.css'); $user = GWF_User::getStaticOrGuest(); $userid = $user->getID(); $table = GDO::table('GWF_ProfilePOI'); $tVars = array('user_id' => $userid, 'is_admin' => $user->isAdmin() ? 'true' : 'false', 'total' => $table->countRows(), 'visible' => $table->countRows(GWF_ProfilePOI::wherePermissions(), array('users', 'profiles', 'whitelist')), 'js_trans' => $this->jsTrans(), 'form_delete' => $this->formDelete(), 'pois' => GWF_ProfilePOI::getPOICount($userid), 'maxp' => $this->module->cfgAllowedPOIs(), 'api_key' => $this->module->cfgMapsApiKey(), 'protocol' => Common::getProtocol(), 'init_lat' => 0, 'init_lon' => 0); return $this->module->templatePHP('places.php', $tVars); }
public function execute() { GWF_Website::plaintext(); GWF3::setConfig('store_last_url', false); if (!$this->module->canReadPOIs()) { return $this->module->ajaxErr('err_poi_read_perm'); } $minlat = $this->module->lat('minlat'); $maxlat = $this->module->lat('maxlat'); $minlon = $this->module->lon('minlon'); $maxlon = $this->module->lon('maxlon'); $where_perms = GWF_ProfilePOI::wherePermissions(); $where_place = GWF_ProfilePOI::whereLocations($minlat, $maxlat, $minlon, $maxlon); $where = "({$where_perms}) AND ({$where_place})"; $joins = array('users', 'profiles', 'whitelist'); $result = GDO::table('GWF_ProfilePOI')->selectAll('pp_id, pp_uid, user_name, pp_lat, pp_lon, pp_descr', $where, '', $joins); die(json_encode($result)); }
<h1><?php echo $tLang->lang('ph_places'); ?> </h1> <?php $userid = GWF_Session::getUserID(); $can = $tVars['module']->cfgAllowedPOIs(); $have = GWF_ProfilePOI::getPOICount($userid); $left = $can - $have; $href_settings = GWF_WEB_ROOT . 'profile_settings'; $href_whitelist = GWF_WEB_ROOT . 'index.php?mo=Profile&me=POISWhitelist'; echo GWF_Box::box($tLang->lang('poi_info', array($left, $can, $href_settings, $href_whitelist))); echo GWF_Box::box($tLang->lang('poi_privacy'), $tLang->lang('poi_privacy_t')); echo GWF_Box::box($tLang->lang('poi_stats', array($tVars['total'], $tVars['visible'])), $tLang->lang('poi_stats_t')); $usage = '<ul><li>' . implode('</li><li>', $tLang->lang('poi_usage_data')) . '</li></ul>' . PHP_EOL; echo GWF_Box::box($usage, $tLang->lang('poi_usage')); $helper = '<div id="poi_init">'; $helper .= sprintf('<button onclick="window.gwf.profile.init(false)" >%s</button>', $tLang->lang('btn_poi_init')); $helper .= sprintf('<button onclick="window.gwf.profile.init(true)" >%s</button>', $tLang->lang('btn_poi_init_sensor')); $helper .= '</div>'; $helper .= sprintf('<div><input id="jump_address" type="text" placeholder="%s" /></div>', $tLang->lang('ph_poi_jump')); echo '<div id="poi_helper">' . GWF_Box::box($helper, $tLang->lang('poi_helper')) . '</div>' . PHP_EOL; ?> <div id="profile_map"></div> <script type="text/javascript"> window.gwf.profile = new window.gwf.Profile('profile_map', <?php echo $tVars['user_id']; ?> , <?php