示例#1
0
 /**
  * Show edit form
  * 
  * @return void
  */
 protected function edit()
 {
     if (!$this->marker->canEdit() and !\IPS\Request::i()->form_submitted) {
         \IPS\Output::i()->error('edit_no_perm_err', '2MM1/2', 403, '');
     }
     $form = $this->marker->buildEditForm();
     if ($values = $form->values()) {
         if ($this->marker->canEdit()) {
             $this->marker->processForm($values);
             /* Old custom markers did not store the author ID, update them now to the current member */
             if ($this->marker->member_id == 0) {
                 $this->marker->member_id = \IPS\Member::loggedIn()->member_id;
             }
             $this->marker->updated = time();
             $this->marker->save();
             $this->marker->processAfterEdit($values);
             \IPS\Output::i()->redirect($this->marker->url());
         } else {
             $form->error = \IPS\Member::loggedIn()->language()->addToStack('edit_no_perm_err');
         }
     }
     /* Display */
     \IPS\Output::i()->title = \IPS\Member::loggedIn()->language()->addToStack('membermap_edit_a_marker');
     \IPS\Output::i()->sidebar['enabled'] = FALSE;
     \IPS\Output::i()->breadcrumb[] = array(NULL, \IPS\Member::loggedIn()->language()->addToStack('membermap_edit_a_marker'));
     \IPS\Output::i()->output = \IPS\Theme::i()->getTemplate('submit')->submitPage($form->customTemplate(array(call_user_func_array(array(\IPS\Theme::i(), 'getTemplate'), array('submit', 'membermap')), 'submitForm')));
 }
示例#2
0
 /**
  * Show the pages tree
  *
  * @return	string
  */
 protected function manage()
 {
     /* Javascript & CSS */
     \IPS\Output::i()->jsFiles = array_merge(\IPS\Output::i()->jsFiles, \IPS\Output::i()->js('admin_membermap.js', 'membermap', 'admin'));
     \IPS\Output::i()->cssFiles = array_merge(\IPS\Output::i()->cssFiles, \IPS\Theme::i()->css('membermap.css', 'membermap'));
     return parent::manage();
 }
示例#3
0
 /**
  * Show marker group index
  * 
  * @return void
  */
 protected function _index()
 {
     /* Online User Location */
     \IPS\Session::i()->setLocation(\IPS\Http\Url::internal('app=membermap&module=markers&controller=groups', 'front', 'markers'), array(), 'loc_membermap_browsing_groups');
     \IPS\Output::i()->title = \IPS\Member::loggedIn()->language()->addToStack('membermap_marker_groups');
     \IPS\Output::i()->output = \IPS\Theme::i()->getTemplate('markers')->index();
 }
示例#4
0
 /**
  * ...
  *
  * @return	void
  */
 protected function manage()
 {
     $defaultMaps = \IPS\membermap\Application::getEnabledMaps();
     \IPS\Output::i()->jsVars['membermap_defaultMaps'] = $defaultMaps;
     \IPS\Output::i()->sidebar['actions']['preview'] = array('icon' => 'eye', 'link' => \IPS\Http\Url::external('https://leaflet-extras.github.io/leaflet-providers/preview/index.html'), 'title' => 'membermap_mapmanager_preview', 'target' => '_blank');
     \IPS\Output::i()->title = \IPS\Member::loggedIn()->language()->addToStack('menu__membermap_membermap_mapmanager');
     \IPS\Output::i()->output .= \IPS\Theme::i()->getTemplate('mapmanager')->wrapper();
 }
示例#5
0
 /**
  * Process Form
  *
  * @param	\IPS\Helpers\Form		$form	The form
  * @param	\IPS\Member\Group		$group	Existing Group
  * @return	void
  */
 public function process(&$form, $group)
 {
     $bgColour = $group->g_membermap_markerColour ? $group->g_membermap_markerColour : 'darkblue';
     /* Selected a valid colour? */
     $bgColour = in_array($bgColour, $this->colours) ? $bgColour : 'darkblue';
     foreach ($this->colours as $c) {
         $radioOpt[$c] = \IPS\Theme::i()->resource("awesome-marker-icon-{$c}.png", "membermap", 'admin');
     }
     $form->add(new \IPS\Helpers\Form\Radio('g_membermap_markerColour', $bgColour, TRUE, array('options' => $radioOpt, 'parse' => 'image', 'descriptions' => array('white' => \IPS\Member::loggedIn()->language()->addToStack('group_pin_bg_colour_white')))));
 }
示例#6
0
 /**
  * Get Form
  *
  * @param	\IPS\Http\Url	$url	The URL for the login page
  * @return	string
  */
 public function loginForm($url, $ucp = FALSE)
 {
     if ($ucp) {
         $state = "ucp-" . \IPS\Session::i()->csrfKey;
     } else {
         $state = \IPS\Dispatcher::i()->controllerLocation . "-" . \IPS\Session::i()->csrfKey;
     }
     $url = \IPS\Http\Url::internal('applications/core/interface/vk/auth.php', 'none');
     $scope = 'offline,email';
     // if ( \IPS\Settings::i()->profile_comments )
     // {
     // $scope .= ',status';
     // }
     return \IPS\Theme::i()->getTemplate('plugins', 'core', 'global')->sodvk("https://oauth.vk.com/authorize?client_id={$this->settings['app_id']}&scope={$scope}&redirect_uri=" . urlencode($url) . "&state={$state}");
 }
示例#7
0
 /**
  * ...
  *
  * @return	void
  */
 protected function manage()
 {
     \IPS\Output::i()->title = \IPS\Member::loggedIn()->language()->addToStack('menu__membermap_membermap_settings');
     \IPS\Output::i()->jsFiles = array_merge(\IPS\Output::i()->jsFiles, \IPS\Output::i()->js('jquery/jquery-ui.js', 'membermap', 'interface'));
     \IPS\Output::i()->jsFiles = array_merge(\IPS\Output::i()->jsFiles, \IPS\Output::i()->js('admin_membermap.js', 'membermap', 'admin'));
     \IPS\Output::i()->cssFiles = array_merge(\IPS\Output::i()->cssFiles, \IPS\Theme::i()->css('jquery-ui.css', 'membermap', 'global'));
     \IPS\Output::i()->jsVars['membermap_mapquestAPI'] = \IPS\membermap\Application::getApiKeys('mapquest');
     $form = new \IPS\Helpers\Form();
     $form->addHeader('api_settings');
     $form->add(new \IPS\Helpers\Form\Text('membermap_mapQuestAPI', \IPS\Settings::i()->membermap_mapQuestAPI, TRUE, array(), NULL, NULL, NULL, 'membermap_mapQuestAPI'));
     if (!empty(\IPS\Settings::i()->membermap_mapQuestAPI)) {
         $form->attributes['data-controller'] = 'membermap.admin.membermap.settings';
         $form->attributes['id'] = 'membermap_form_settings';
         $form->addHeader('map_settings');
         $form->add(new \IPS\Helpers\Form\YesNo('membermap_groupByMemberGroup', \IPS\Settings::i()->membermap_groupByMemberGroup));
         $form->add(new \IPS\Helpers\Form\YesNo('membermap_enable_clustering', \IPS\Settings::i()->membermap_enable_clustering));
         $form->add(new \IPS\Helpers\Form\Text('membermap_bbox_location', \IPS\Settings::i()->membermap_bbox_location, FALSE, array(), NULL, NULL, NULL, 'membermap_bbox_location'));
         $form->add(new \IPS\Helpers\Form\Number('membermap_bbox_zoom', intval(\IPS\Settings::i()->membermap_bbox_zoom), FALSE, array('min' => 1, 'max' => 18)));
         $form->hiddenValues['membermap_bbox'] = \IPS\Settings::i()->membermap_bbox;
         $form->addHeader('membermap_autoUpdate');
         $profileFields = array('' => ' -- ' . \IPS\Member::loggedIn()->language()->addToStack('membermap_profileLocationField') . ' -- ');
         foreach (\IPS\core\ProfileFields\Field::fields(array(), \IPS\core\ProfileFields\Field::PROFILE) as $group => $fields) {
             foreach ($fields as $id => $field) {
                 $profileFields['core_pfieldgroups_' . $group][$id] = $field->name;
             }
         }
         $form->add(new \IPS\Helpers\Form\YesNo('membermap_monitorLocationField', \IPS\Settings::i()->membermap_monitorLocationField, FALSE, array('togglesOn' => array('membermap_profileLocationField', 'membermap_monitorLocationField_groupPerm', 'membermap_syncLocationField'))));
         $form->add(new \IPS\Helpers\Form\Select('membermap_profileLocationField', \IPS\Settings::i()->membermap_profileLocationField ? intval(\IPS\Settings::i()->membermap_profileLocationField) : NULL, FALSE, array('options' => $profileFields), NULL, NULL, NULL, 'membermap_profileLocationField'));
         $form->add(new \IPS\Helpers\Form\Select('membermap_monitorLocationField_groupPerm', \IPS\Settings::i()->membermap_monitorLocationField_groupPerm != '' ? \IPS\Settings::i()->membermap_monitorLocationField_groupPerm === '*' ? '*' : explode(",", \IPS\Settings::i()->membermap_monitorLocationField_groupPerm) : '*', FALSE, array('options' => \IPS\Member\Group::groups(), 'multiple' => TRUE, 'parse' => 'normal', 'unlimited' => '*', 'unlimitedLang' => 'all'), NULL, NULL, NULL, 'membermap_monitorLocationField_groupPerm'));
         $form->add(new \IPS\Helpers\Form\YesNo('membermap_syncLocationField', \IPS\Settings::i()->membermap_syncLocationField, FALSE, array(), NULL, NULL, NULL, 'membermap_syncLocationField'));
     }
     if ($values = $form->values(TRUE)) {
         $values['membermap_bbox'] = \IPS\Request::i()->membermap_bbox;
         if (empty($values['membermap_bbox_location'])) {
             $values['membermap_bbox'] = "";
         }
         \IPS\DB::i()->update('core_tasks', array('enabled' => isset($values['membermap_syncLocationField']) and $values['membermap_syncLocationField'] ? 1 : 0), array('`key`=?', 'locationSync'));
         $form->saveAsSettings($values);
         \IPS\Session::i()->log('acplogs__membermap_settings');
         \IPS\Output::i()->redirect(\IPS\Http\Url::internal("app=membermap&module=membermap&controller=settings"), 'saved');
     }
     \IPS\Output::i()->output = $form;
 }
示例#8
0
 /**
  * Submit Event
  *
  * @return	void
  */
 protected function manage()
 {
     $group = NULL;
     if (isset(\IPS\Request::i()->group)) {
         try {
             $group = \IPS\membermap\Markers\Groups::loadAndCheckPerms(\IPS\Request::i()->group);
             \IPS\Output::i()->breadcrumb[] = array(\IPS\Http\Url::internal('app=membermap&module=groups&controller=groups&id=' . $group->_id, 'front', 'markers_group', $group->name_seo), $group->_title);
         } catch (\OutOfRangeException $e) {
         }
     }
     $form = \IPS\membermap\Markers\Markers::create($group);
     if (\IPS\membermap\Markers\Markers::moderateNewItems(\IPS\Member::loggedIn())) {
         $form = \IPS\Theme::i()->getTemplate('forms', 'core')->modQueueMessage(\IPS\Member::loggedIn()->warnings(5, NULL, 'mq'), \IPS\Member::loggedIn()->mod_posts) . $form;
     }
     /* Display */
     \IPS\Output::i()->title = \IPS\Member::loggedIn()->language()->addToStack('membermap_submit_a_marker');
     \IPS\Output::i()->sidebar['enabled'] = FALSE;
     \IPS\Output::i()->breadcrumb[] = array(NULL, \IPS\Member::loggedIn()->language()->addToStack('membermap_submit_a_marker'));
     \IPS\Output::i()->output = \IPS\Theme::i()->getTemplate('submit')->submitPage($form->customTemplate(array(call_user_func_array(array(\IPS\Theme::i(), 'getTemplate'), array('submit', 'membermap')), 'submitForm')));
 }
 /**
  * Get Form
  *
  * @param    string $url The URL for the login page
  * @param    bool   $ucp Is UCP? (as opposed to login form)
  *
  * @return    string
  */
 public function loginForm($url, $ucp = false)
 {
     return \IPS\Theme::i()->getTemplate('plugins', 'core', 'global')->steam((string) \IPS\Http\Url::external('https://steamcommunity.com/openid/login')->setQueryString(array('openid.ns' => 'http://specs.openid.net/auth/2.0', 'openid.mode' => 'checkid_setup', 'openid.return_to' => (string) \IPS\Http\Url::internal('applications/core/interface/steam/auth.php', 'none'), 'openid.realm' => (string) \IPS\Http\Url::internal('', 'none'), 'openid.identity' => 'http://specs.openid.net/auth/2.0/identifier_select', 'openid.claimed_id' => 'http://specs.openid.net/auth/2.0/identifier_select', 'openid.assoc_handle' => $ucp ? 'ucp' : \IPS\Dispatcher::i()->controllerLocation)));
 }
示例#10
0
 /**
  * Do formatation to the array of markers
  * 
  * @param 		array 	Markers
  * @return		array	Markers
  */
 public function formatCustomMarkers(array $markers)
 {
     $markersToKeep = array();
     $validColours = array('red', 'darkred', 'lightred', 'orange', 'beige', 'green', 'darkgreen', 'lightgreen', 'blue', 'darkblue', 'lightblue', 'purple', 'darkpurple', 'pink', 'cadetblue', 'gray', 'lightgray', 'black', 'white');
     if (is_array($markers) and count($markers)) {
         foreach ($markers as $marker) {
             $popup = \IPS\Theme::i()->getTemplate('map', 'membermap', 'front')->customMarkerPopup($marker);
             \IPS\Output::i()->parseFileObjectUrls($popup);
             $markersToKeep[] = array('type' => "custom", 'lat' => round((double) $marker['marker_lat'], 5), 'lon' => round((double) $marker['marker_lon'], 5), 'popup' => $popup, 'icon' => $marker['group_pin_icon'], 'colour' => $marker['group_pin_colour'], 'bgColour' => in_array($marker['group_pin_bg_colour'], $validColours) ? $marker['group_pin_bg_colour'] : 'red', 'parent_id' => $marker['marker_parent_id']);
         }
     }
     return $markersToKeep;
 }
示例#11
0
 /**
  * Embed map. Used in users profile
  * 
  * @return void
  */
 protected function embed()
 {
     $this->manage();
     \IPS\Output::i()->title = NULL;
     \IPS\Output::i()->sidebar['enabled'] = FALSE;
     \IPS\Output::i()->sendOutput(\IPS\Theme::i()->getTemplate('global', 'core')->blankTemplate(\IPS\Output::i()->output), 200, 'text/html', \IPS\Output::i()->httpHeaders);
 }
 /**
  * Get the queries rows for a version
  *
  * @param   int     $long   Version ID
  * @return  array
  */
 public function _getQueriesRows($long)
 {
     $enabled = \IPS\Settings::i()->querybox_enable_versions_query_execute;
     if (!is_null($enabled) and !$enabled) {
         return call_user_func_array('parent::_getQueriesRows', func_get_args());
     }
     $queries = $this->_getQueries($long);
     $order = 1;
     $rows = array();
     foreach ($queries as $qid => $data) {
         $params = array();
         if (isset($data['params']) and is_array($data['params'])) {
             foreach ($data['params'] as $v) {
                 $params[] = var_export($v, TRUE);
             }
         }
         $rows["{$long}.{$qid}"] = \IPS\Theme::i()->getTemplate('trees', 'core')->row($this->url, "{$long}.{$qid}", str_replace('&lt;?php', '', highlight_string("<?php \\IPS\\Db::i()->{$data['method']}( " . implode(', ', $params) . " )", TRUE)), FALSE, array('execute' => array('icon' => 'play-circle', 'title' => 'versions_query_execute', 'link' => \IPS\Http\Url::internal("app=core&module=applications&controller=developer&appKey={$this->application->directory}&do=executeVersionQuery&version={$long}&query={$qid}"), 'data' => array('confirm' => '')), 'delete' => array('icon' => 'times-circle', 'title' => 'delete', 'link' => \IPS\Http\Url::internal("app=core&module=applications&controller=developer&appKey={$this->application->directory}&do=deleteVersionQuery&version={$long}&query={$qid}"), 'data' => array('delete' => ''))), NULL, NULL, $order, FALSE, NULL, NULL, NULL, TRUE);
         $order++;
     }
     return $rows;
 }
示例#13
0
 public static function create($item, $comment, $first = FALSE, $guestName = NULL, $incrementPostCount = NULL, $member = NULL, \IPS\DateTime $time = NULL)
 {
     $topic = $item;
     if ($member === NULL) {
         $member = \IPS\Member::loggedIn();
     }
     if (isset($_POST['topic_title'])) {
         $comment = $_POST['topic_title'] . "\n" . $comment;
     }
     $access_key = \IPS\Settings::i()->access_key;
     if (isset($member) && !$member->isAdmin() && $member->member_posts <= 10 && \IPS\Settings::i()->moderate_new == 1) {
         require_once dirname($_SERVER['SCRIPT_FILENAME']) . "/uploads/cleantalk.class.php";
         require_once dirname($_SERVER['SCRIPT_FILENAME']) . "/uploads/JSON.php";
         session_name('cleantalksession');
         if (!isset($_SESSION)) {
             session_start();
         }
         if (array_key_exists('formtime', $_SESSION)) {
             $submit_time = time() - (int) $_SESSION['formtime'];
         } else {
             $submit_time = NULL;
         }
         $_SESSION['formtime'] = time();
         $post_info = '';
         $lang = \IPS\Lang::getEnabledLanguages();
         $locale = $lang[\IPS\Lang::defaultLanguage()]->short;
         if (function_exists('json_encode')) {
             $arr = array('cms_lang' => $locale, 'REFFERRER' => $_SERVER['HTTP_REFERER'], 'USER_AGENT' => $_SERVER['HTTP_USER_AGENT']);
             $post_info = json_encode($arr);
         }
         if ($post_info === FALSE) {
             $post_info = '';
         }
         $ct_url = 'http://moderate.cleantalk.ru';
         $config_work_url = $ct_url;
         $config_ttl = 43200;
         $config_changed = 1349162987;
         $config_key = $access_key;
         $ct = new \Cleantalk();
         $ct->work_url = $config_work_url;
         $ct->server_url = $ct_url;
         $ct->server_ttl = $config_ttl;
         $ct->server_changed = $config_changed;
         $sender_email = filter_var($member->email, FILTER_SANITIZE_EMAIL);
         $sender_ip = $ct->ct_session_ip($_SERVER['REMOTE_ADDR']);
         $ct_request = new \CleantalkRequest();
         $ct_request->auth_key = $config_key;
         if (isset($_POST['guest_name'])) {
             $ct_request->sender_nickname = $_POST['guest_name'];
         } else {
             $ct_request->sender_nickname = $member->name;
         }
         $ct_request->sender_ip = $sender_ip;
         $ct_request->sender_email = $sender_email;
         $ct_request->sender_info = $post_info;
         $ct_request->agent = 'ipboard4-18';
         $js_keys = array();
         for ($i = -5; $i <= 1; $i++) {
             $js_keys[] = md5(\IPS\Settings::i()->access_key . '+' . \IPS\Settings::i()->email_in . date("Ymd", time() + 86400 * $i));
         }
         $ct_request->js_on = in_array($_COOKIE['ct_checkjs'], $js_keys) ? 1 : 0;
         $ct_request->submit_time = $submit_time;
         $ct_request->message = $comment;
         $ct_result = $ct->isAllowMessage($ct_request);
         if (isset($ct_result->errno) && $ct_result->errno > 0) {
             //sendErrorMessage("CleanTalk has some problems, errno is ".$ct_result->errno.", errstr is '".$ct_result->errstr."'")
         }
         if ($ct_result->allow == 1) {
             // Not spammer.
             //call_user_func_array( 'parent::save', func_get_args() );
             return call_user_func_array('parent::create', func_get_args());
         } else {
             if (isset($_POST['topic_title'])) {
                 $topic->delete();
             }
             if (\IPS\Request::i()->isAjax()) {
                 $result = array("type" => "error", "message" => $ct_result->comment);
                 $result = json_encode($result);
                 \IPS\Output::i()->sendOutput($result, 200, "application/json");
             } else {
                 \IPS\Output::i()->sidebar['enabled'] = FALSE;
                 \IPS\Output::i()->sendOutput(\IPS\Theme::i()->getTemplate('global', 'core')->globalTemplate("Forbidden", \IPS\Theme::i()->getTemplate('global', 'core')->error("Forbidden", $ct_result->comment, 1, ""), array('app' => \IPS\Dispatcher::i()->application ? \IPS\Dispatcher::i()->application->directory : NULL, 'module' => \IPS\Dispatcher::i()->module ? \IPS\Dispatcher::i()->module->key : NULL, 'controller' => \IPS\Dispatcher::i()->controller)), 200, 'text/html', array(), FALSE, FALSE);
             }
             die;
             return call_user_func_array('parent::create', func_get_args());
         }
     }
     return call_user_func_array('parent::create', func_get_args());
 }
示例#14
0
 /**
  * All assets required for the marker form(s)
  * @return void
  */
 public static function getJsForMarkerForm()
 {
     /* Get enabled maps */
     $defaultMaps = static::getEnabledMaps();
     /* Load JS and CSS */
     \IPS\Output::i()->jsFiles = array_merge(\IPS\Output::i()->jsFiles, \IPS\Output::i()->js('leaflet/leaflet-src.js', 'membermap', 'interface'));
     \IPS\Output::i()->jsFiles = array_merge(\IPS\Output::i()->jsFiles, \IPS\Output::i()->js('jquery/jquery-ui.js', 'membermap', 'interface'));
     \IPS\Output::i()->jsFiles = array_merge(\IPS\Output::i()->jsFiles, \IPS\Output::i()->js('leaflet/plugins/leaflet-providers.js', 'membermap', 'interface'));
     \IPS\Output::i()->jsFiles = array_merge(\IPS\Output::i()->jsFiles, \IPS\Output::i()->js('leaflet/plugins/leaflet.awesome-markers.js', 'membermap', 'interface'));
     \IPS\Output::i()->cssFiles = array_merge(\IPS\Output::i()->cssFiles, \IPS\Theme::i()->css('leaflet.css', 'membermap', 'global'));
     \IPS\Output::i()->cssFiles = array_merge(\IPS\Output::i()->cssFiles, \IPS\Theme::i()->css('jquery-ui.css', 'membermap', 'global'));
     \IPS\Output::i()->cssFiles = array_merge(\IPS\Output::i()->cssFiles, \IPS\Theme::i()->css('membermap.css', 'membermap'));
     \IPS\Output::i()->cssFiles = array_merge(\IPS\Output::i()->cssFiles, \IPS\Theme::i()->css('plugins.combined.css', 'membermap'));
     \IPS\Output::i()->jsFiles = array_merge(\IPS\Output::i()->jsFiles, \IPS\Output::i()->js('front_markers.js', 'membermap', 'front'));
     \IPS\Output::i()->jsVars['membermap_defaultMaps'] = $defaultMaps;
     \IPS\Output::i()->jsVars['membermap_mapquestAPI'] = static::getApiKeys('mapquest');
 }
示例#15
0
 /**
  * [Node] Add/Edit Form
  *
  * @param	\IPS\Helpers\Form	$form	The form
  * @return	void
  */
 public function form(&$form)
 {
     $form->attributes['data-controller'] = 'membermap.admin.membermap.groupform';
     /* Build form */
     $form->add(new \IPS\Helpers\Form\Translatable('group_name', NULL, TRUE, array('app' => 'membermap', 'key' => $this->id ? "membermap_marker_group_{$this->id}" : NULL)));
     $form->add(new \IPS\Helpers\Form\YesNo('group_moderate', $this->id ? $this->moderate : FALSE, FALSE));
     if ($this->type == 'custom') {
         $radioOpt = array();
         $colours = array('red', 'darkred', 'lightred', 'orange', 'beige', 'green', 'darkgreen', 'lightgreen', 'blue', 'darkblue', 'lightblue', 'purple', 'darkpurple', 'pink', 'cadetblue', 'gray', 'lightgray', 'black', 'white');
         $icon = $this->id ? $this->pin_icon : 'fa-globe';
         $iconColour = $this->id ? $this->pin_colour : '#FFFFFF';
         $bgColour = $this->id ? $this->pin_bg_colour : 'red';
         /* Selected a valid colour? */
         $bgColour = in_array($bgColour, $colours) ? $bgColour : 'red';
         foreach ($colours as $c) {
             $radioOpt[$c] = \IPS\Theme::i()->resource("awesome-marker-icon-{$c}.png", "membermap", 'admin');
         }
         $form->add(new \IPS\Helpers\Form\Text('group_pin_icon', $icon, TRUE));
         $form->add(new \IPS\Helpers\Form\Color('group_pin_colour', $iconColour, TRUE));
         $form->add(new \IPS\Helpers\Form\Radio('group_pin_bg_colour', $bgColour, TRUE, array('options' => $radioOpt, 'parse' => 'image', 'descriptions' => array('white' => \IPS\Member::loggedIn()->language()->addToStack('group_pin_bg_colour_white')))));
         $form->addDummy('group_marker_example', "<span class='awesome-marker awesome-marker-icon-{$bgColour}' id='markerExample'><i class='fa fa-fw {$icon}' style='color: {$iconColour}'></i></span>");
     }
 }
示例#16
0
 /**
  * Get template for content tables
  *
  * @return	callable
  */
 public static function contentTableTemplate()
 {
     return array(\IPS\Theme::i()->getTemplate('markers', 'membermap'), 'rows');
 }
示例#17
0
 /**
  * [ActiveRecord] Save Changed Columns
  *
  * @return	void
  * @note	We have to be careful when upgrading in case we are coming from an older version
  */
 public function save()
 {
     $new = $this->_new;
     $enabled = \IPS\Settings::i()->plugin_enabled;
     $access_key = \IPS\Settings::i()->access_key;
     if ($enabled == 1 && $new) {
         require_once dirname($_SERVER['SCRIPT_FILENAME']) . "/uploads/cleantalk.class.php";
         require_once dirname($_SERVER['SCRIPT_FILENAME']) . "/uploads/JSON.php";
         session_name('cleantalksession');
         if (!isset($_SESSION)) {
             session_start();
         }
         if (array_key_exists('formtime', $_SESSION)) {
             $submit_time = time() - (int) $_SESSION['formtime'];
         } else {
             $submit_time = NULL;
         }
         $_SESSION['formtime'] = time();
         $post_info = '';
         $lang = \IPS\Lang::getEnabledLanguages();
         $locale = $lang[\IPS\Lang::defaultLanguage()]->short;
         if (function_exists('json_encode')) {
             $arr = array('cms_lang' => $locale, 'REFFERRER' => $_SERVER['HTTP_REFERER'], 'USER_AGENT' => $_SERVER['HTTP_USER_AGENT']);
             $post_info = json_encode($arr);
         }
         if ($post_info === FALSE) {
             $post_info = '';
         }
         $ct_url = 'http://moderate.cleantalk.ru';
         $config_work_url = $ct_url;
         $config_ttl = 43200;
         $config_changed = 1349162987;
         $config_key = $access_key;
         $ct = new \Cleantalk();
         $ct->work_url = $config_work_url;
         $ct->server_url = $ct_url;
         $ct->server_ttl = $config_ttl;
         $ct->server_changed = $config_changed;
         $sender_email = filter_var($_POST['email_address'], FILTER_SANITIZE_EMAIL);
         $sender_ip = $ct->ct_session_ip($_SERVER['REMOTE_ADDR']);
         $ct_request = new \CleantalkRequest();
         $ct_request->auth_key = $config_key;
         $ct_request->sender_nickname = $_POST['username'];
         $ct_request->sender_ip = $sender_ip;
         $ct_request->sender_email = $sender_email;
         $ct_request->sender_info = $post_info;
         $ct_request->agent = 'ipboard4-18';
         //$ct_request->js_on = $_COOKIE['ct_checkjs'] == md5(\IPS\Settings::i()->access_key . '+' . \IPS\Settings::i()->email_in) ? 1 : 0;
         $ct_request->js_on = in_array($_COOKIE['ct_checkjs'], self::getCheckJSArray()) ? 1 : 0;
         $ct_request->submit_time = $submit_time;
         $ct_result = $ct->isAllowUser($ct_request);
         if (isset($ct_result->errno) && $ct_result->errno > 0) {
             //sendErrorMessage("CleanTalk has some problems, errno is ".$ct_result->errno.", errstr is '".$ct_result->errstr."'")
         }
         if ($ct_result->allow == 1) {
             // Not spammer.
             call_user_func_array('parent::save', func_get_args());
         } else {
             // Spammer - display message and exit.
             if (\IPS\Request::i()->isAjax()) {
                 $err_str = '<span style="color:#ab1f39;">' . $ct_result->comment . '</span><script>setTimeout("history.back()", 5000);</script>';
                 print $err_str;
             } else {
                 \IPS\Output::i()->sidebar['enabled'] = FALSE;
                 \IPS\Output::i()->sendOutput(\IPS\Theme::i()->getTemplate('global', 'core')->globalTemplate("Forbidden", \IPS\Theme::i()->getTemplate('global', 'core')->error("Forbidden", $ct_result->comment, 1, ""), array('app' => \IPS\Dispatcher::i()->application ? \IPS\Dispatcher::i()->application->directory : NULL, 'module' => \IPS\Dispatcher::i()->module ? \IPS\Dispatcher::i()->module->key : NULL, 'controller' => \IPS\Dispatcher::i()->controller)), 200, 'text/html', array(), FALSE, FALSE);
             }
             die;
         }
     }
     return call_user_func_array('parent::save', func_get_args());
 }