public function __construct($user_id = false, $connection_id = false) { $this->settings_type = 'com.twitter'; $this->user_id = $user_id; $this->primeCache(); if ($user_id && !$connection_id) { $connection = new CASHConnection($user_id); $result = $connection->getConnectionsByType($this->settings_type); if (is_array($result)) { $connection_id = $result[0]['id']; } } $this->connection_id = $connection_id; if ($user_id && $connection_id) { $this->connectDB(); if ($this->getCASHConnection()) { $token = $this->settings->getSetting('token'); $this->oauth_token = $token['oauth_token']; $this->oauth_token_secret = $token['oauth_token_secret']; if (!$this->oauth_token && !$this->oauth_token_secret) { $this->error_message = 'no API key found'; } else { require_once CASH_PLATFORM_ROOT . '/lib/twitter/OAuth.php'; require_once CASH_PLATFORM_ROOT . '/lib/twitter/twitteroauth.php'; $connections = CASHSystem::getSystemSettings('system_connections'); $this->client_id = $connections['com.twitter']['client_id']; $this->client_secret = $connections['com.twitter']['client_secret']; $this->twitter = new TwitterOAuth($this->client_id, $this->client_secret, $this->oauth_token, $this->oauth_token_secret); } } else { $this->error_message = 'could not get connection'; } } }
} else { $current_currency = 'USD'; } $cash_admin->page_data['currency_options'] = AdminHelper::echoCurrencyOptions($current_currency); // current paypal $settings_response = $cash_admin->requestAndStore(array('cash_request_type' => 'system', 'cash_action' => 'getsettings', 'type' => 'payment_defaults', 'user_id' => $cash_admin->effective_user_id)); if (is_array($settings_response['payload'])) { $pp_default = $settings_response['payload']['pp_default']; $pp_micro = $settings_response['payload']['pp_micro']; } else { $pp_default = 0; $pp_micro = 0; } $cash_admin->page_data['currency_options'] = AdminHelper::echoCurrencyOptions($current_currency); $pp = array(); foreach ($page_data_object->getConnectionsByType('com.paypal') as $ppq) { $pp[$ppq['id']] = $ppq['name']; } $cash_admin->page_data['paypal_default_options'] = AdminHelper::echoFormOptions($pp, $pp_default, false, true); $cash_admin->page_data['paypal_micro_options'] = AdminHelper::echoFormOptions($pp, $pp_micro, false, true); // handle regions if (isset($_POST['region1'])) { $regions = array('region1' => $_POST['region1'], 'region2' => $_POST['region2']); $settings_response = $cash_admin->requestAndStore(array('cash_request_type' => 'system', 'cash_action' => 'setsettings', 'type' => 'regions', 'value' => $regions, 'user_id' => $cash_admin->effective_user_id)); if ($settings_response['payload']) { AdminHelper::formSuccess('Success.', '/commerce/'); } } // now get the current setting $settings_response = $cash_admin->requestAndStore(array('cash_request_type' => 'system', 'cash_action' => 'getsettings', 'type' => 'regions', 'user_id' => $cash_admin->effective_user_id)); if ($settings_response['payload']) {