Esempio n. 1
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();
 }
Esempio n. 2
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')));
 }
Esempio n. 3
0
 /**
  * Bulk process generations
  *
  * @param   array|null  $values Form submission values
  * @return  \IPS\Helpers\MultipleRedirect
  */
 public function generateBulk($values = NULL)
 {
     $self = $this;
     $vCookie = static::$app . '_faker_' . static::$_controller . '_generator_values';
     /* If this is a form submission, store our values now */
     if ($values) {
         $values['total'] = mt_rand($values['record_range']['start'], $values['record_range']['end']);
         unset(\IPS\Request::i()->cookie[$vCookie]);
         \IPS\Request::i()->setCookie($vCookie, json_encode($values));
     }
     $values = $values ?: json_decode(\IPS\Request::i()->cookie[$vCookie], true);
     $perGo = isset($values['per_go']) ? (int) $values['per_go'] : 25;
     /* Generate the MultipleRedirect page */
     $reflect = new \ReflectionClass($this);
     $extension = $reflect->getShortName();
     $processUrl = \IPS\Http\Url::internal("app=faker&module=generator&controller={$self::$_controller}&extApp={$self::$app}&extension={$extension}&do=process");
     return new \IPS\Helpers\MultipleRedirect($processUrl, function ($doneSoFar) use($self, $perGo, $values, $vCookie) {
         /* Have we processed everything? */
         if ($doneSoFar >= $values['total']) {
             return NULL;
         }
         $count = 0;
         $generated = array();
         while ($count < $values['total'] and count($generated) < $perGo) {
             ++$count;
             $generated[] = $self->generateSingle($values);
         }
         $doneSoFar += $perGo;
         /* Update our session cookies and proceed to the next chunk */
         \IPS\Request::i()->setCookie($vCookie, json_encode($values));
         return array($doneSoFar, end($generated), 100 * $doneSoFar / $values['total']);
     }, function () use($self, $extension) {
         \IPS\Output::i()->redirect(\IPS\Http\Url::internal("app=faker&module=generator&controller={$self::$_controller}&extApp={$self::$app}&extension={$extension}"), 'completed');
     });
 }
Esempio n. 4
0
 /**
  * Authorize
  *
  * @param	\IPS\nexus\Transaction					$transaction	Transaction
  * @param	array|\IPS\nexus\Customer\CreditCard	$values			Values from form OR a stored card object if this gateway supports them
  * @param	\IPS\nexus\Fraud\MaxMind\Request|NULL	$maxMind		*If* MaxMind is enabled, the request object will be passed here so gateway can additional data before request is made	
  * @return	\IPS\DateTime|NULL		Auth is valid until or NULL to indicate auth is good forever
  * @throws	\LogicException			Message will be displayed to user
  */
 public function auth(\IPS\nexus\Transaction $transaction, $values, \IPS\nexus\Fraud\MaxMind\Request $maxMind = NULL)
 {
     $transaction->save();
     $data = array('amount' => $transaction->amount->amount, 'redirect' => urlencode((string) \IPS\Settings::i()->base_url . 'applications/nexus/interface/gateways/payline.php?nexusTransactionId=' . $transaction->id));
     $result = $this->api($data);
     if ($result > 0) {
         \IPS\Output::i()->redirect(\IPS\Http\Url::external("http://payline.ir/payment/gateway-{$result}"));
     }
     throw new \RuntimeException();
 }
Esempio n. 5
0
 /**
  * Authorize
  *
  * @param	\IPS\nexus\Transaction					$transaction	Transaction
  * @param	array|\IPS\nexus\Customer\CreditCard	$values			Values from form OR a stored card object if this gateway supports them
  * @param	\IPS\nexus\Fraud\MaxMind\Request|NULL	$maxMind		*If* MaxMind is enabled, the request object will be passed here so gateway can additional data before request is made	
  * @return	\IPS\DateTime|NULL		Auth is valid until or NULL to indicate auth is good forever
  * @throws	\LogicException			Message will be displayed to user
  */
 public function auth(\IPS\nexus\Transaction $transaction, $values, \IPS\nexus\Fraud\MaxMind\Request $maxMind = NULL)
 {
     $transaction->save();
     $data = array('amount' => $transaction->amount->amount / 10, 'msg' => urlencode($transaction->invoice->title), 'orderId' => $transaction->id, 'callbackUrl' => (string) \IPS\Settings::i()->base_url . 'applications/nexus/interface/gateways/jahanpay.php');
     $res = $this->api($data);
     if (!empty($res)) {
         \IPS\Output::i()->redirect(\IPS\Http\Url::external('http://www.jahanpay.com/pay_invoice/' . $res));
     }
     throw new \RuntimeException();
 }
Esempio n. 6
0
 /**
  * Authorize
  *
  * @param	\IPS\nexus\Transaction					$transaction	Transaction
  * @param	array|\IPS\nexus\Customer\CreditCard	$values			Values from form OR a stored card object if this gateway supports them
  * @param	\IPS\nexus\Fraud\MaxMind\Request|NULL	$maxMind		*If* MaxMind is enabled, the request object will be passed here so gateway can additional data before request is made	
  * @return	\IPS\DateTime|NULL		Auth is valid until or NULL to indicate auth is good forever
  * @throws	\LogicException			Message will be displayed to user
  */
 public function auth(\IPS\nexus\Transaction $transaction, $values, \IPS\nexus\Fraud\MaxMind\Request $maxMind = NULL)
 {
     $transaction->save();
     $data = array('Amount' => $transaction->amount->amount / 10, 'Description' => $transaction->invoice->title, 'Email' => $transaction->member->email, 'Mobile' => $transaction->member->cm_phone, 'CallbackURL' => (string) \IPS\Settings::i()->base_url . 'applications/nexus/interface/gateways/zarinpal.php?nexusTransactionId=' . $transaction->id);
     $res = $this->api($data);
     if ($res['Status'] == 100) {
         $settings = json_decode($this->settings, TRUE);
         \IPS\Output::i()->redirect(\IPS\Http\Url::external('https://www.zarinpal.com/pg/StartPay/' . $res['Authority'] . '' . ($settings['zarin_gate'] ? '/ZarinGate' : '')));
     }
     throw new \RuntimeException();
 }
Esempio n. 7
0
 /**
  * Display the content generation form
  *
  * @return	void
  */
 protected function manage()
 {
     $form = new \IPS\faker\Decorators\Form('form', 'faker_purge');
     $form->langPrefix = 'faker_purge';
     $form->add(new \IPS\Helpers\Form\CheckboxSet('content_types', 0, true, array('options' => $this->getContentTypes())));
     if ($values = $form->values()) {
         $this->_purgeContent($values);
         \IPS\Output::i()->redirect(\IPS\Http\Url::internal('app=faker&module=tools&controller=purge'), 'faker_purge_success');
         return;
     }
     \IPS\Output::i()->output = $form;
     return;
 }
Esempio n. 8
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;
 }
Esempio n. 9
0
 /**
  * Update default maps
  * @return void
  */
 public function update()
 {
     $maps = \IPS\Request::i()->maps;
     if (!isset($maps['basemaps'])) {
         /* You can't have a map with no basemap. Defaulting to OpenStreetMap.France */
         $maps['basemaps'] = array('OpenStreetMap.France');
     }
     if (!isset($maps['overlays'])) {
         $maps['overlays'] = array();
     }
     \IPS\Settings::i()->membermap_activemaps = json_encode($maps);
     \IPS\Db::i()->update('core_sys_conf_settings', array('conf_value' => \IPS\Settings::i()->membermap_activemaps), array('conf_key=?', 'membermap_activemaps'));
     unset(\IPS\Data\Store::i()->settings);
     if (\IPS\Request::i()->isAjax()) {
         \IPS\Output::i()->output = 1;
         return;
     }
     \IPS\Output::i()->redirect(\IPS\Http\Url::internal("app=membermap&module=membermap&controller=mapmanager"), 'saved');
 }
Esempio n. 10
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')));
 }
Esempio n. 11
0
/**
 * @brief		Payline Gateway
 * @author		<a href='http://skinod.com.com'>Skinod</a>
 * @copyright	(c) 2015 Skinod.com
 */
require_once '../../../../init.php';
\IPS\Session\Front::i();
try {
    $transaction = \IPS\nexus\Transaction::load(\IPS\Request::i()->nexusTransactionId);
    if ($transaction->status !== \IPS\nexus\Transaction::STATUS_PENDING) {
        throw new \OutofRangeException();
    }
} catch (\OutOfRangeException $e) {
    \IPS\Output::i()->redirect(\IPS\Http\Url::internal("app=nexus&module=payments&controller=checkout&do=transaction&id=&t=" . \IPS\Request::i()->nexusTransactionId, 'front', 'nexus_checkout', \IPS\Settings::i()->nexus_https));
}
try {
    $result = $transaction->method->api(array('trans_id' => \IPS\Request::i()->trans_id, 'id_get' => \IPS\Request::i()->id_get), TRUE);
    if ($result === 1) {
        $transaction->gw_id = \IPS\Request::i()->trans_id . '_' . \IPS\Request::i()->id_get;
        $transaction->save();
        $transaction->checkFraudRulesAndCapture(NULL);
        $transaction->sendNotification();
        \IPS\Session::i()->setMember($transaction->invoice->member);
        // This is in case the checkout was a guest, meaning checkFraudRulesAndCapture() may have just created an account. There is no security issue as we have just verified they were just bounced back from Payline
        \IPS\Output::i()->redirect($transaction->url());
    }
    throw new \OutofRangeException();
} catch (\Exception $e) {
    \IPS\Output::i()->redirect($transaction->invoice->checkoutUrl()->setQueryString(array('_step' => 'checkout_pay', 'err' => $transaction->member->language()->get('gateway_err'))));
}
 /**
  * Add version query
  * We have to completely override this method, since there's no way for us to hook into the form directly.
  *
  * @return  void
  */
 protected final function addVersionQuery()
 {
     $enabled = \IPS\Settings::i()->querybox_enable_versions_query_templates;
     if (!is_null($enabled) and !$enabled) {
         return call_user_func_array('parent::addVersionQuery', func_get_args());
     }
     $latestVersion = $this->_getLatestVersion();
     /**
      * Build our form and query type options
      */
     $form = new \IPS\Helpers\Form('add_version_query');
     $form->add(new \IPS\Helpers\Form\Select('versions_query_type', 'raw', FALSE, array('options' => array('raw' => 'versions_query_type_raw', 'group_setting' => 'versions_query_type_group_setting', 'add_column' => 'versions_query_type_add_column', 'drop_column' => 'versions_query_type_drop_column'), 'toggles' => array('raw' => array('add_version_query_versions_query_code'), 'group_setting' => array('add_version_query_versions_query_group_setting_name', 'add_version_query_versions_query_group_setting_column_type', 'add_version_query_versions_query_group_setting_default', 'add_version_query_group_setting_column_type', 'add_version_query_group_setting_column_length', 'add_version_query_group_setting_column_decimals', 'add_version_query_group_setting_column_values', 'add_version_query_group_setting_column_comment', 'add_version_query_group_setting_column_unsigned', 'add_version_query_group_setting_column_zerofill', 'add_version_query_group_setting_column_auto_increment', 'add_version_query_group_setting_column_binary'), 'add_column' => array('add_version_query_versions_query_add_column_table_name', 'add_version_query_versions_query_add_column_column_name', 'add_version_query_versions_query_add_column_column_type', 'add_version_query_versions_query_add_column_default', 'add_version_query_add_column_column_type', 'add_version_query_add_column_column_length', 'add_version_query_add_column_column_decimals', 'add_version_query_add_column_column_values', 'add_version_query_add_column_column_allow_null', 'add_version_query_add_column_column_default', 'add_version_query_add_column_column_comment', 'add_version_query_add_column_column_unsigned', 'add_version_query_add_column_column_zerofill', 'add_version_query_add_column_column_auto_increment', 'add_version_query_add_column_column_binary'), 'drop_column' => array('add_version_query_versions_query_drop_column_table_name', 'add_version_query_versions_query_drop_column_column_name')))));
     /**
      * Group Setting
      */
     $form->add(new \IPS\Helpers\Form\Text('versions_query_group_setting_name', NULL, FALSE, array(), NULL, 'g_'));
     $form->add(new \IPS\Helpers\Form\YesNo('versions_query_group_setting_default', FALSE, TRUE, array('togglesOn' => array("group_setting_column_default"))));
     $this->_buildQueryBoxSchema($form, 'group_setting_', array('column_default'), array('column_allow_null'), array('column_default' => '', 'column_type' => 'TINYINT', 'column_length' => '1'));
     /**
      * Add Column
      */
     $form->add(new \IPS\Helpers\Form\Text('versions_query_add_column_table_name'));
     $form->add(new \IPS\Helpers\Form\Text('versions_query_add_column_column_name'));
     $this->_buildQueryBoxSchema($form, 'add_column_');
     /**
      * Drop Column
      */
     $form->add(new \IPS\Helpers\Form\Text('versions_query_drop_column_table_name'));
     $form->add(new \IPS\Helpers\Form\Text('versions_query_drop_column_column_name'));
     /**
      * Standard raw query input
      */
     $form->add(new \IPS\Helpers\Form\Text('versions_query_code', '\\IPS\\Db::i()->', TRUE, array('size' => 45), function ($val) use($latestVersion) {
         /* Make sure this was actually a raw query submission */
         if (\IPS\Request::i()->versions_query_type != 'raw') {
             return;
         }
         /* Check it starts with \IPS\Db::i()-> */
         $val = trim($val);
         if (mb_substr($val, 0, 14) !== '\\IPS\\Db::i()->') {
             throw new \DomainException('versions_query_start');
         }
         /* Check there's only one query */
         if (mb_substr($val, -1) !== ';') {
             $val .= ';';
         }
         if (mb_substr_count($val, ';') > 1) {
             throw new \DomainException('versions_query_one');
         }
         /* Check our Regex will be okay with it */
         preg_match('/^\\\\IPS\\\\Db::i\\(\\)->(.+?)\\(\\s*[\'"](.+?)[\'"]\\s*,\\s*(.+?)\\)\\s*;$/', $val, $matches);
         if (empty($matches)) {
             throw new \DomainException('versions_query_format');
         }
         /* Run it, but only if we are editing the latest version */
         if (\IPS\Request::i()->id == $latestVersion) {
             try {
                 if (@eval($val) === FALSE) {
                     throw new \DomainException('versions_query_phperror');
                 }
             } catch (\IPS\Db\Exception $e) {
                 throw new \DomainException($e->getMessage());
             }
         }
     }));
     /**
      * Process form submission
      */
     if ($values = $form->values()) {
         /* Get our file */
         $version = \IPS\Request::i()->id;
         $json = $this->_getQueries($version);
         switch ($values['versions_query_type']) {
             case 'raw':
                 $this->_processRawQuery($values, $json);
                 break;
             case 'group_setting':
                 $this->processGroupSetting($values, $json);
                 break;
             case 'add_column':
                 $this->_processAddColumn($values, $json);
                 break;
             case 'drop_column':
                 $this->_processDropColumn($values, $json);
                 break;
         }
         /* Write it */
         $this->_writeQueries($version, $json);
         /* Redirect us */
         \IPS\Output::i()->redirect(\IPS\Http\Url::internal("app=core&module=applications&controller=developer&appKey={$this->application->directory}&tab=versions&root={$version}"));
     } else {
         \IPS\Output::i()->output .= \IPS\Theme::i()->getTemplate('global')->block('versions_query', $form, FALSE);
     }
 }
Esempio n. 13
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);
 }
Esempio n. 14
0
 /**
 * ACP Settings Form
 *
 * @param    string $url URL to redirect user to after successful submission
 *
 * @return    array    List of settings to save - settings will be stored to core_login_handlers.login_settings DB
 *                     field
 * @code
     return array( 'savekey'    => new \IPS\Helpers\Form\[Type]( ... ), ... );
 * @endcode
 */
 public function acpForm()
 {
     \IPS\Output::i()->sidebar['actions'] = array('help' => array('title' => 'help', 'icon' => 'question-circle', 'link' => \IPS\Http\Url::external('http://forums.vatsim.net/viewtopic.php?f=134&t=65133'), 'target' => '_blank', 'class' => ''));
     return array('sso_base' => new \IPS\Helpers\Form\Text('login_vatsim_sso_base', isset($this->settings['sso_base']) ? $this->settings['sso_base'] : '', TRUE), 'sso_key' => new \IPS\Helpers\Form\Text('login_vatsim_sso_key', isset($this->settings['sso_key']) ? $this->settings['sso_key'] : '', TRUE), 'sso_secret' => new \IPS\Helpers\Form\Password('login_vatsim_sso_secret', isset($this->settings['sso_secret']) ? $this->settings['sso_secret'] : '', TRUE), 'sso_rsa_key' => new \IPS\Helpers\Form\TextArea('login_vatsim_sso_rsa_key', isset($this->settings['sso_rsa_key']) ? $this->settings['sso_rsa_key'] : '', TRUE));
 }
Esempio n. 15
0
<?php
/**
 * @brief		VK Login Handler Redirect URI Handler
 * @author		<a href='http://www.skinod.com'>Skinod</a>
 * @copyright	(c) 2015 skinod.com
 */

require_once str_replace( 'applications/core/interface/vk/auth.php', '', str_replace( '\\', '/', __FILE__ ) ) . 'init.php';
$state = explode( '-', \IPS\Request::i()->state );
if ( $state[0] == 'ucp' )
{
	\IPS\Output::i()->redirect( \IPS\Http\Url::internal( "app=core&module=system&controller=settings&area=profilesync&service=VK&loginProcess=VK&state={$state[1]}&code=" . urlencode( \IPS\Request::i()->code ), 'front', 'settings_VK' ) );
}
else
{
	\IPS\Output::i()->redirect( \IPS\Http\Url::internal( "app=core&module=system&controller=login&loginProcess=VK&state={$state[1]}&code=" . urlencode( \IPS\Request::i()->code ), $state[0] ) );
}
Esempio n. 16
0
<?php

/**
 * @author 		Sijad aka Mr.Wosi
 * @link		<a href='http://skinod.com'>Skinod.com</a>
 * @copyright	2015 <a href='http://skinod.com'>Skinod.com</a>
 */
/**
 * Path to your IP.Board directory with a trailing /
 */
$_SERVER['SCRIPT_FILENAME'] = __FILE__;
$path = '';
require_once $path . 'init.php';
\IPS\Session\Front::i();
if (\IPS\Member::loggedIn()->member_id) {
    \IPS\Member::loggedIn()->skin = (int) \IPS\Request::i()->id;
    \IPS\Member::loggedIn()->save();
} else {
    \IPS\Request::i()->setCookie('theme', (int) \IPS\Request::i()->id);
}
/* Make sure VSE cookie is killed */
if (isset(\IPS\Request::i()->cookie['vseThemeId'])) {
    \IPS\Request::i()->setCookie('vseThemeId', 0);
}
\IPS\Output::i()->redirect(\IPS\Http\Url::internal(''));
Esempio n. 17
0
$key = md5(md5(\IPS\Settings::i()->sql_user . \IPS\Settings::i()->sql_pass) . \IPS\Settings::i()->board_start);
$login_type = 'email';
/* Alowed IP addresses, uncomment for more security  */
// $ip_address = array('x.x.x.x'); // EDIT THIS LINE!!
/* -~-~-~-~-~-~ Stop Editing -~-~-~-~-~-~ */
if (isset($ip_address) and in_array($_SERVER['REMOTE_ADDR'], $ip_address) !== TRUE) {
    \IPS\Output::i()->json(array('status' => 'FAILD', 'msg' => 'BAD_IP_ADDR'));
}
if (!\IPS\Request::i()->do || !\IPS\Request::i()->id || !\IPS\Request::i()->key || !\IPS\Login::compareHashes(\IPS\Request::i()->key, md5($key . \IPS\Request::i()->id))) {
    \IPS\Output::i()->json(array('status' => 'FAILD', 'msg' => 'BAD_KEY'));
}
$member = \IPS\Member::load(\IPS\Request::i()->id, $login_type);
if (!$member->member_id) {
    \IPS\Output::i()->json(array('status' => 'FAILD', 'msg' => 'ACCOUNT_NOT_FOUND'));
}
switch (\IPS\Request::i()->do) {
    case 'get_salt':
        \IPS\Output::i()->json(array('status' => 'SUCCESS', 'pass_salt' => $member->members_pass_salt));
        break;
    case 'login':
        if (\IPS\Login::compareHashes($member->members_pass_hash, \IPS\Request::i()->password) === TRUE) {
            \IPS\Output::i()->json(array('status' => 'SUCCESS', 'connect_status' => $member->members_bitoptions['validating'] ? 'VALIDATING' : 'SUCCESS', 'email' => $member->email, 'name' => $member->name, 'connect_id' => $member->member_id));
        }
        break;
    case 'field':
        $fields = $member->profileFields();
        if (isset($fields['core_pfieldgroups_' . \IPS\Request::i()->fgroup]) and isset($fields['core_pfieldgroups_' . \IPS\Request::i()->fgroup]['core_pfield_' . \IPS\Request::i()->fid])) {
            \IPS\Output::i()->json(array('status' => 'SUCCESS', 'field_value' => $fields['core_pfieldgroups_' . \IPS\Request::i()->fgroup]['core_pfield_' . \IPS\Request::i()->fid]));
        }
        break;
}
Esempio n. 18
0
 /**
  * Process a generation request
  *
  * @return  void
  */
 public function process()
 {
     list($ext) = $this->extData();
     \IPS\Output::i()->output = (string) $ext->generateBulk();
 }
Esempio n. 19
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');
 }
Esempio n. 20
0
 public function import()
 {
     $id = isset(\IPS\Request::i()->id) ? intval(\IPS\Request::i()->id) : 0;
     /* Build form */
     $form = new \IPS\Helpers\Form(NULL, 'import');
     if (isset(\IPS\Request::i()->id)) {
         $group = \IPS\membermap\Markers\Groups::load(intval(\IPS\Request::i()->id));
         if ($group->type == 'member') {
             \IPS\Output::i()->error('generic_error', '1MM4/1', 403, '');
         }
     }
     $form->add(new \IPS\Helpers\Form\Upload('import_upload', NULL, TRUE, array('allowedFileTypes' => array('kml'), 'temporary' => TRUE)));
     $form->add(new \IPS\Helpers\Form\YesNo('import_creategroups', FALSE, FALSE, array('togglesOff' => array('import_group'))));
     $form->add(new \IPS\Helpers\Form\Node('import_group', $id ?: 0, FALSE, array('class' => '\\IPS\\membermap\\Markers\\Groups', 'permissionCheck' => 'add', 'subnodes' => false, 'where' => array('group_type != ?', 'member')), NULL, NULL, NULL, 'import_group'));
     if ($values = $form->values()) {
         try {
             $xml = \IPS\Xml\SimpleXML::loadFile($values['import_upload']);
         } catch (\InvalidArgumentException $e) {
             $form->error = \IPS\Member::loggedIn()->language()->addToStack('xml_upload_invalid');
             \IPS\Output::i()->output = $form;
             return;
         }
         /* No group selected, and don't create groups?! */
         if ($values['import_creategroups'] == FALSE and !$values['import_group']) {
             $form->error = \IPS\Member::loggedIn()->language()->addToStack('membermap_error_no_id_no_create');
             \IPS\Output::i()->output = $form;
             return;
         }
         $markers = array();
         $groupOrder = NULL;
         $imported = 0;
         foreach ($xml->Document->Folder as $folder) {
             if (!isset($folder->Placemark)) {
                 continue;
             }
             $folderName = (string) $folder->name;
             foreach ($folder->Placemark as $placemark) {
                 if (!isset($placemark->Point->coordinates)) {
                     continue;
                 }
                 list($lon, $lat, $elev) = explode(',', $placemark->Point->coordinates);
                 $markers[] = array('marker_name' => (string) $placemark->name, 'marker_name_seo' => \IPS\Http\Url::seoTitle((string) $placemark->name), 'marker_description' => (string) $placemark->description, 'marker_lat' => $lat, 'marker_lon' => $lon, 'marker_member_id' => \IPS\Member::loggedIn()->member_id, 'marker_added' => time(), 'marker_open' => 1, 'marker_parent_id' => isset($values['import_group']) ? $values['import_group']->id : NULL);
             }
             /* Create a new group per "folder" */
             if ($values['import_creategroups'] == TRUE and count($markers) > 0) {
                 if ($groupOrder === NULL) {
                     $groupOrder = \IPS\Db::i()->select(array("MAX( `group_position` ) as position"), 'membermap_markers_groups')->first();
                 }
                 $groupOrder = $groupOrder + 1;
                 $group = new \IPS\membermap\Markers\Groups();
                 $group->name = $folderName;
                 $group->name_seo = \IPS\Http\Url::seoTitle($folderName);
                 $group->type = 'custom';
                 $group->pin_colour = '#FFFFFF';
                 $group->pin_bg_colour = 'red';
                 $group->pin_icon = 'fa-globe';
                 $group->position = $groupOrder;
                 $group->save();
                 \IPS\Lang::saveCustom('membermap', "membermap_marker_group_{$group->id}", trim($folderName));
                 \IPS\Lang::saveCustom('membermap', "membermap_marker_group_{$group->id}_JS", trim($folderName), 1);
                 // Add group id to all elements of the array
                 array_walk($markers, function (&$v, $k) use($group) {
                     $v['marker_parent_id'] = $group->id;
                 });
                 // Insert
                 \IPS\Db::i()->insert('membermap_markers', $markers);
                 $group->setLastComment();
                 $group->save();
                 // Set default permissions
                 $perms = $group->permissions();
                 \IPS\Db::i()->update('core_permission_index', array('perm_view' => '*', 'perm_2' => '*', 'perm_3' => \IPS\Settings::i()->admin_group, 'perm_4' => \IPS\Settings::i()->admin_group), array('perm_id=?', $perms['perm_id']));
                 // Reset
                 $imported += count($markers);
                 $markers = array();
             }
         }
         /* If we still got markers here, it's all pushed to one group, probably */
         if (is_array($markers) and count($markers) > 0) {
             \IPS\Db::i()->insert('membermap_markers', $markers);
             $group = $values['import_group'];
             $group->setLastComment();
             $group->save();
             $imported += count($markers);
         }
         \IPS\membermap\Map::i()->invalidateJsonCache();
         $message = \IPS\Member::loggedIn()->language()->addToStack('membermap_import_thumbup', FALSE, array('sprintf' => array($imported)));
         \IPS\Output::i()->redirect(\IPS\Http\Url::internal("app=membermap&module=membermap&controller=markers"), $message);
     }
     /* Display */
     \IPS\Output::i()->output = $form;
 }
Esempio n. 21
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());
 }
Esempio n. 22
0
 /**
  * Bulk process generations
  *
  * @param   array|null  $values Form submission values
  * @return  \IPS\Helpers\MultipleRedirect
  */
 public function generateBulk($values = NULL)
 {
     $self = $this;
     $vCookie = static::$app . '_faker_' . static::$_controller . '_generator_values';
     /* If this is a form submission, store our values now */
     if ($values) {
         /* If we have a custom author defined, we need to save the ID manually for json encoding */
         if (!empty($values['author']) and $values['author'] instanceof \IPS\Member) {
             $values['author'] = $values['author']->member_id;
         }
         $values['total'] = mt_rand($values['comment_range']['start'], $values['comment_range']['end']);
         unset(\IPS\Request::i()->cookie[$vCookie]);
         \IPS\Request::i()->setCookie($vCookie, json_encode($values));
     }
     $values = $values ?: json_decode(\IPS\Request::i()->cookie[$vCookie], true);
     /* <sarcasm>Serialization is fun</sarcasm> @TODO: Clean this up */
     if (!empty($values['author']) and is_int($values['author'])) {
         $values['author'] = \IPS\Member::load($values['author']);
     }
     if (!empty($values['item_url']) and is_array($values['item_url'])) {
         $values['item_url'] = \IPS\Http\Url::createFromArray($values['item_url']['data']);
     }
     /* Generate the MultipleRedirect page */
     $perGo = isset($values['per_go']) ? (int) $values['per_go'] : 25;
     $reflect = new \ReflectionClass($this);
     $extension = $reflect->getShortName();
     $processUrl = \IPS\Http\Url::internal("app=faker&module=generator&controller={$self::$_controller}&extApp={$self::$app}&extension={$extension}&do=process");
     return new \IPS\Helpers\MultipleRedirect($processUrl, function ($doneSoFar) use($self, $perGo, $values, $vCookie) {
         /* Have we processed everything? */
         if ($doneSoFar >= $values['total']) {
             return NULL;
         }
         /* Load our content item container */
         $itemClass = $self::$itemClass;
         $item = $itemClass::loadFromUrl($values['item_url']);
         $count = 0;
         $limit = $values['total'] - $doneSoFar;
         $generated = array();
         while ($count < $limit and count($generated) < $perGo) {
             ++$count;
             $generated[] = $self->generateSingle($item, $values);
         }
         $doneSoFar += $perGo;
         /* Update our session cookies and proceed to the next chunk */
         \IPS\Request::i()->setCookie($vCookie, json_encode($values));
         return array($doneSoFar, end($generated), 100 * $doneSoFar / $values['total']);
     }, function () use($self, $values, $extension) {
         \IPS\Output::i()->redirect(\IPS\Http\Url::internal("app=faker&module=generator&controller={$self::$_controller}&extApp={$self::$app}&extension={$extension}"), 'completed');
     });
 }
Esempio n. 23
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;
 }
Esempio n. 24
0
 /**
  * Bulk process generations
  *
  * @param   array|null  $values Form submission values
  * @return  \IPS\Helpers\MultipleRedirect
  */
 public function generateBulk($values = NULL)
 {
     $self = $this;
     $vCookie = static::$app . '_faker_' . static::$_controller . '_generator_values';
     $mCookie = static::$app . '_faker_' . static::$_controller . '_generator_map';
     /* If this is a form submission, store our values now */
     if ($values) {
         unset(\IPS\Request::i()->cookie[$vCookie]);
         unset(\IPS\Request::i()->cookie[$mCookie]);
         \IPS\Request::i()->setCookie($vCookie, json_encode($values));
     }
     $values = $values ?: json_decode(\IPS\Request::i()->cookie[$vCookie], true);
     $perGo = isset($values['per_go']) ? (int) $values['per_go'] : 25;
     /**
      * How many items should we generate for each node?
      * We calculate this information beforehand so we can track our progress in MultipleRedirect
      */
     $nodeMap = isset(\IPS\Request::i()->cookie[$mCookie]) ? json_decode(\IPS\Request::i()->cookie[$mCookie], true) : NULL;
     if (!$nodeMap) {
         $nodeMap = array('total' => 0, 'nodes' => array());
         foreach ($values['nodes'] as $id => $node) {
             $nodeMap['nodes'][$id] = mt_rand($values['item_range']['start'], $values['item_range']['end']);
         }
         $nodeMap['total'] = array_sum($nodeMap['nodes']);
         \IPS\Request::i()->setCookie($mCookie, json_encode($nodeMap));
     }
     $total = $nodeMap['total'];
     /* Generate the MultipleRedirect page */
     $reflect = new \ReflectionClass($this);
     $extension = $reflect->getShortName();
     $processUrl = \IPS\Http\Url::internal("app=faker&module=generator&controller={$self::$_controller}&extApp={$self::$app}&extension={$extension}&do=process");
     return new \IPS\Helpers\MultipleRedirect($processUrl, function ($doneSoFar) use($self, $perGo, $values, $total, $nodeMap, $vCookie, $mCookie) {
         /* Have we processed everything? */
         if (!array_sum($nodeMap['nodes'])) {
             return NULL;
         }
         /* Process our nodes */
         $generated = array();
         foreach ($nodeMap['nodes'] as $node => &$limit) {
             /* Have we reached our per go limit? */
             if (count($generated) >= $perGo) {
                 break;
             }
             /* Load our node container */
             $nodeClass = $self::$nodeClass;
             $_node = $nodeClass::load($node);
             /* Process up to $perGo items from this node */
             $count = 0;
             $_limit = $limit;
             while ($count < $_limit and count($generated) < $perGo) {
                 ++$count;
                 --$limit;
                 $generated[] = $self->generateSingle($_node, $values);
             }
             /* If we've cleared out this node, remove it from our map and proceed to the next one */
             if (!$nodeMap['nodes'][$node]) {
                 unset($nodeMap['nodes'][$node]);
             }
         }
         $doneSoFar += $perGo;
         /* Update our session cookies and proceed to the next chunk */
         \IPS\Request::i()->setCookie($vCookie, json_encode($values));
         \IPS\Request::i()->setCookie($mCookie, json_encode($nodeMap));
         return array($doneSoFar, end($generated), 100 * $doneSoFar / $total);
     }, function () use($self, $extension) {
         \IPS\Output::i()->redirect(\IPS\Http\Url::internal("app=faker&module=generator&controller={$self::$_controller}&extApp={$self::$app}&extension={$extension}"), 'completed');
     });
 }
Esempio n. 25
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());
 }
<?php

require_once str_replace('applications/core/interface/steam/auth.php', '', str_replace('\\', '/', __FILE__)) . 'init.php';
$openidParams = array();
foreach (array_keys($_GET) as $key) {
    if (strpos($key, 'openid_') === 0) {
        $openidParams[$key] = $_GET[$key];
    }
}
$params = http_build_query($openidParams);
if (\IPS\Request::i()->openid_invalidate_handle == 'ucp') {
    \IPS\Output::i()->redirect(\IPS\Http\Url::internal("app=core&module=system&controller=settings&area=profilesync&service=Steam&loginProcess=steam&" . $params, 'front', 'settings_Steam'));
} else {
    \IPS\Output::i()->redirect(\IPS\Http\Url::internal("app=core&module=system&controller=login&loginProcess=steam&" . $params, \IPS\Request::i()->openid_invalidate_handle));
}