/** * Execute * * @return void */ public function execute() { /* Make sure we have permission to be here */ list($ext) = $this->extData(); $acpPermission = property_exists($ext, 'acpRestriction') ? $ext::$acpRestriction : 'faker_generate'; \IPS\Dispatcher::i()->checkAcpPermission($acpPermission); parent::execute(); }
/** * Execute * * @return void */ public function execute() { \IPS\Dispatcher::i()->checkAcpPermission('mapmanager_manage'); \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('leaflet/plugins/leaflet-providers.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('system/menumanager.css', 'core', 'admin')); parent::execute(); }
/** * 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}"); }
/** * Get API keys * Currently it only serves MapQuest, but others may be added in the future * * @param string $service Name of the service, will return all keys if param is empty * @return mixed Single API key, or all in an array */ public static function getApiKeys($service) { if (!isset(static::$apiKeys['mapquest'])) { if (\IPS\Settings::i()->membermap_mapQuestAPI) { static::$apiKeys['mapquest'] = \IPS\Settings::i()->membermap_mapQuestAPI; } } if (\IPS\Dispatcher::i()->controllerLocation == 'front' and (!isset(static::$apiKeys['mapquest']) or empty(static::$apiKeys['mapquest']))) { if (\IPS\Member::loggedIn()->isAdmin()) { \IPS\Output::i()->error('membermap_noAPI_admin', '4MM5/1', 401); } else { \IPS\Output::i()->error('401_error_title', '4MM5/2', 401); } } try { if ($service) { return static::$apiKeys[$service]; } } catch (\Exception $e) { } return static::$apiKeys; }
/** * Execute * * @return void */ public function execute() { \IPS\Dispatcher::i()->checkAcpPermission('settings_manage'); parent::execute(); }
/** * Is Active? * * @return bool */ public function active() { return \IPS\Dispatcher::i()->application->directory === 'membermap'; }
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()); }
/** * 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))); }
/** * [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()); }
/** * Execute * * @return void */ public function execute() { \IPS\Dispatcher::i()->checkAcpPermission('watched_channels_manage'); parent::execute(); }
/** * Execute * * @return void */ public function execute() { \IPS\Dispatcher::i()->checkAcpPermission('faker_tools_purge'); \IPS\Output::i()->title = \IPS\Member::loggedIn()->language()->addToStack('faker_title_purge'); parent::execute(); }