function call_GitHub($method, $url, $data = false) { $curl = curl_init(); $auth = get_authentication("usrpass"); switch ($method) { case "POST": curl_setopt($curl, CURLOPT_POST, 1); if ($data) { curl_setopt($curl, CURLOPT_POSTFIELDS, $data); } break; case "PUT": curl_setopt($curl, CURLOPT_PUT, 1); break; default: $url = sprintf("%s?%s", $url, http_build_query($data)); } curl_setopt($curl, CURLOPT_USERAGENT, 'OompahLoompah/DigitalRhomb.us'); //Authentication curl_setopt($curl, "CURLOPTHTTPAUTH", CURLAUTH_BASIC); curl_setopt($curl, CURLOPT_USERPWD, $auth["username"] . ":" . $auth["password"]); curl_setopt($curl, CURLOPT_URL, $url); curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1); $result = curl_exec($curl); curl_close($curl); return $result; }
/** * {@inheritdoc} */ public function submitForm(array &$form, FormStateInterface $form_state) { module_load_include('inc', 'sociallogin'); $data = get_authentication($form_state->getValue('api_key'), $form_state->getValue('api_secret')); if (isset($data['status']) && $data['status'] != 'status') { drupal_set_message($data['message'], $data['status']); return FALSE; } parent::SubmitForm($form, $form_state); $this->config('sociallogin.settings')->set('sso_site_name', $form_state->getValue('sso_site_name'))->set('api_key', $form_state->getValue('api_key'))->set('api_secret', $form_state->getValue('api_secret'))->set('username_option', $form_state->getValue('username_option'))->set('login_redirection', $form_state->getValue('login_redirection'))->set('register_redirection', $form_state->getValue('register_redirection'))->set('custom_login_url', $form_state->getValue('custom_login_url'))->set('custom_register_url', $form_state->getValue('custom_register_url'))->set('enable_linking', $form_state->getValue('enable_linking'))->set('linking_text', $form_state->getValue('linking_text'))->save(); if (count(\Drupal::moduleHandler()->getImplementations('add_extra_sociallogin_config_settings')) > 0) { // Call all modules that implement the hook, and let them make changes to $variables. $config_data = \Drupal::moduleHandler()->invokeAll('add_extra_sociallogin_config_settings'); } if (isset($config_data) && is_array($config_data)) { foreach ($config_data as $key => $value) { $this->config('sociallogin.settings')->set($value, $form_state->getValue($value))->save(); } } drupal_set_message(t('Social Login settings have been saved.'), 'status'); //Clear page cache foreach (Cache::getBins() as $service_id => $cache_backend) { if ($service_id == 'dynamic_page_cache') { $cache_backend->deleteAll(); } } }
/** * {@inheritdoc} */ public function submitForm(array &$form, FormStateInterface $form_state) { $sl_config = \Drupal::config('sociallogin.settings'); $apiKey = $sl_config->get('api_key'); $apiSecret = $sl_config->get('api_secret'); if ($apiKey == '') { $apiKey = ''; $apiSecret = ''; } module_load_include('inc', 'sociallogin'); $data = get_authentication($apiKey, $apiSecret); if (isset($data['status']) && $data['status'] != 'status') { drupal_set_message($data['message'], $data['status']); return FALSE; } parent::SubmitForm($form, $form_state); $this->config('sso.settings')->set('sso_enable', $form_state->getValue('sso_enable'))->save(); }
/** * {@inheritdoc} */ public function submitForm(array &$form, FormStateInterface $form_state) { $sl_config = \Drupal::config('sociallogin.settings'); $apiKey = $sl_config->get('api_key'); $apiSecret = $sl_config->get('api_secret'); if ($apiKey == '') { $apiKey = ''; $apiSecret = ''; } module_load_include('inc', 'sociallogin'); $data = get_authentication($apiKey, $apiSecret); if (isset($data['status']) && $data['status'] != 'status') { drupal_set_message($data['message'], $data['status']); return FALSE; } parent::SubmitForm($form, $form_state); $this->config('socialprofiledata.settings')->set('profile_selection', $form_state->getValue('profile_selection'))->set('show_profile', $form_state->getValue('show_profile'))->save(); $socialprofiledata_profile_selection = explode(',', implode(',', $form_state->getValue('profile_selection', ''))); module_load_include('inc', 'socialprofiledata', 'socialprofiledata.sql'); if (in_array('basic_profile_data', $socialprofiledata_profile_selection)) { $this->socialprofiledata_check_table_exists_and_create('loginradius_basic_profile_data'); $this->socialprofiledata_check_table_exists_and_create('loginradius_emails'); } if (in_array('extended_profile_data', $socialprofiledata_profile_selection)) { $extended_profile_data_array = array('loginradius_extended_profile_data', 'loginradius_positions', 'loginradius_companies', 'loginradius_education', 'loginradius_phone_numbers', 'loginradius_IMaccounts', 'loginradius_addresses', 'loginradius_sports', 'loginradius_inspirational_people', 'loginradius_skills', 'loginradius_current_status', 'loginradius_certifications', 'loginradius_courses', 'loginradius_volunteer', 'loginradius_recommendations_received', 'loginradius_languages', 'loginradius_patents', 'loginradius_favorites', 'loginradius_books', 'loginradius_games', 'loginradius_television_show', 'loginradius_movies'); if (is_array($extended_profile_data_array)) { foreach ($extended_profile_data_array as $table_name) { $this->socialprofiledata_check_table_exists_and_create($table_name); } } } $create_table = array('extended_location_data' => 'loginradius_extended_location_data', 'followed_companies_on' => 'loginradius_linkedin_companies', 'facebook_profile_likes' => 'loginradius_facebook_likes', 'facebook_profile_events' => 'loginradius_facebook_events', 'status_message' => 'loginradius_status', 'facebook_posts' => 'loginradius_facebook_posts', 'twitter_mentions' => 'loginradius_twitter_mentions', 'lr_groups' => 'loginradius_groups', 'lr_contacts' => 'loginradius_contacts'); foreach ($create_table as $table_key => $table_name) { $this->socialprofiledata_check_table_selected_in_database($table_key, $table_name, $socialprofiledata_profile_selection); } drupal_set_message(t('Social Profile data settings have been saved.'), 'status'); //Clear page cache foreach (Cache::getBins() as $service_id => $cache_backend) { if ($service_id == 'dynamic_page_cache') { $cache_backend->deleteAll(); } } }
function ws_logingo($window_name, $form = '') { global $conf, $self, $onadb, $baseURL; global $font_family, $color, $style, $images; $html = $js = ''; $form = parse_options_string($form); $type = 'Desktop'; if ($form['standalone']) { $type = 'Standalone'; } printmsg("INFO => [{$type}] Attempting login as " . $form['onausername'], 4); list($status, $js) = get_authentication($form['onausername'], $form['onapassword']); if ($status == 0) { get_perms($form['onausername']); if ($form['standalone'] == 'standalone') { $js .= "window.location='{$http}{$baseURL}/';"; } $js .= "el('loggedin_user').innerHTML = '{$_SESSION['ona']['auth']['user']['username']}';"; printmsg("INFO => [{$type}] {$_SESSION['ona']['auth']['user']['username']} has logged in via authtype: {$conf['authtype']}", 0); } $response = new xajaxResponse(); $response->addScript($js); return $response->getXML(); }
/** * {@inheritdoc} */ public function submitForm(array &$form, FormStateInterface $form_state) { $sl_config = \Drupal::config('sociallogin.settings'); $apiKey = $sl_config->get('api_key'); $apiSecret = $sl_config->get('api_secret'); if ($apiKey == '') { $apiKey = ''; $apiSecret = ''; } module_load_include('inc', 'sociallogin'); $data = get_authentication($apiKey, $apiSecret); if (isset($data['status']) && $data['status'] != 'status') { drupal_set_message($data['message'], $data['status']); return FALSE; } // parent::SubmitForm($form, $form_state); $values = $form_state->getValues(); $inputs = $form_state->getUserInput(); $sharerearrange = default_sharing_networks('share_rearrange_providers'); $verticalshareproviders = default_sharing_networks('share_rearrange_providers'); $sharing_rearrange = array(); $vertical_share_rearrange = array(); $this->config('socialshare.settings')->set('enable_horizontal', $values['enable_horizontal'])->set('enable_vertical', $values['enable_vertical'])->set('label', $values['label'])->set('horizontal_images', $values['horizontal_images'])->set('vertical_images', $values['vertical_images'])->set('counter_providers', $values['counter_providers'])->set('counter_rearrange', $values['counter_providers'])->set('share_providers', isset($inputs['share_rearrange']) ? $inputs['share_rearrange'] : $sharerearrange)->set('share_rearrange', isset($inputs['share_rearrange']) ? $inputs['share_rearrange'] : $sharerearrange)->set('vertical_counter_rearrange', $values['vertical_counter_providers'])->set('vertical_counter_providers', $values['vertical_counter_providers'])->set('vertical_share_providers', isset($inputs['vertical_share_rearrange']) ? $inputs['vertical_share_rearrange'] : $verticalshareproviders)->set('vertical_share_rearrange', isset($inputs['vertical_share_rearrange']) ? $inputs['vertical_share_rearrange'] : $verticalshareproviders)->set('vertical_position', $values['vertical_position'])->set('position_top', $values['position_top'])->set('position_bottom', $values['position_bottom'])->set('show_pages', $values['show_pages'])->set('show_exceptpages', $values['show_exceptpages'])->set('vertical_show_pages', $values['vertical_show_pages'])->set('vertical_show_exceptpages', $values['vertical_show_exceptpages'])->set('opensocialshare_email_message', $values['opensocialshare_email_message'])->set('opensocialshare_email_subject', $values['opensocialshare_email_subject'])->set('opensocialshare_is_email_content_read_only', $values['opensocialshare_is_email_content_read_only'])->set('opensocialshare_is_shorten_url', $values['opensocialshare_is_shorten_url'])->set('opensocialshare_facebook_app_id', $values['opensocialshare_facebook_app_id'])->set('opensocialshare_is_total_share', $values['opensocialshare_is_total_share'])->set('opensocialshare_is_open_single_window', $values['opensocialshare_is_open_single_window'])->set('opensocialshare_popup_window', $values['opensocialshare_popup_window'])->set('opensocialshare_popup_window_size_height', $values['opensocialshare_popup_window_size_height'])->set('opensocialshare_popup_window_size_width', $values['opensocialshare_popup_window_size_width'])->set('opensocialshare_twitter_mention', $values['opensocialshare_twitter_mention'])->set('opensocialshare_twitter_hash_tags', $values['opensocialshare_twitter_hash_tags'])->set('opensocialshare_is_mobile_friendly', $values['opensocialshare_is_mobile_friendly'])->set('opensocialshare_custom_options', $values['opensocialshare_custom_options'])->save(); drupal_set_message(t('Social Share settings have been saved.'), 'status'); //Clear page cache foreach (Cache::getBins() as $service_id => $cache_backend) { if ($service_id == 'dynamic_page_cache') { $cache_backend->deleteAll(); } } }
// If no user name is passed in then use dcm.pl as the login name // be careful as this currently does not require a password. // FIXME: this needs to go away as it is a backdoor. allow it to be configurable at least? // Start out the session as a guest with level 0 access. This is for view only mode. // You can enable or disable this by setting the "disable_guest" sysconfig option if ($_SERVER['PHP_AUTH_USER'] == '' and !$conf['disable_guest']) { $_SESSION['ona']['auth']['user']['username'] = '******'; // create new local authentication class directly $auth = load_auth_class('local'); get_perms('dcm.pl'); printmsg("INFO => [{$type}] {$_SESSION['ona']['auth']['user']['username']} has logged in", 3); } else { // Set the cli user as the login user $DCMUSER = $_SESSION['ona']['auth']['user']['username'] = $_SERVER['PHP_AUTH_USER']; printmsg("INFO => [{$type}] Attempting login as " . $DCMUSER, 4); list($status, $js) = get_authentication($DCMUSER, $_SERVER['PHP_AUTH_PW']); $errmsg = substr($js, 27); if ($status == 0) { $PERMSTAT = get_perms($DCMUSER); printmsg("INFO => [{$type}] {$_SESSION['ona']['auth']['user']['username']} has logged in", 3); } else { printmsg("ERROR => DCM: Unknown user {$DCMUSER}", 4); print "ERROR => [{$DCMUSER}]: {$errmsg}\nSee -l and -p options within dcm.pl.\n"; // clear the session // FIXME: should I do a sess_destroy or sess_close instead? to clear crap from the DB unset($_SESSION['ona']['auth']); exit; } } // Display the current debug level if it's above 1 printmsg("DEBUG => debug level: {$conf['debug']}", 1);
} $include = $base . '/include'; if (!is_dir($include)) { print "ERROR => Couldn't find include folder!\n"; exit; } require_once $base . '/config/config.inc.php'; /* --------------------------------------------------------- */ // MP: Since we know ONA will generate a ton of notice level errors, lets turn them off here // I dont believe this will be impactful to anyone. keep an eye out for it however. error_reporting(E_ALL ^ E_NOTICE); // Start out the session as a guest with level 0 access. This is for view only mode. // You can enable or disable this by setting the "disable_guest" sysconfig option if (!$_SESSION['ona']['auth']['user']['username'] and !$conf['disable_guest']) { $_SESSION['ona']['auth']['user']['username'] = '******'; list($status, $js) = get_authentication('guest', 'guest'); get_perms('guest'); } // force https if required if ($_SERVER['SERVER_PORT'] != 443 and $conf['force_https'] == 1) { echo <<<EOL <html><body> Redirecting you to: <a href="{$https}{$baseURL}">{$https}{$baseURL}</a> <script type="text/javascript"><!-- setTimeout("window.location = \\"{$https}{$baseURL}\\";", 10); --></script> </body></html> EOL; exit; } // // Redirect them to login page if they're not already logged in
/** * {@inheritdoc} */ public function submitForm(array &$form, FormStateInterface $form_state) { $sl_config = \Drupal::config('sociallogin.settings'); $apiKey = $sl_config->get('api_key'); $apiSecret = $sl_config->get('api_secret'); if ($apiKey == '') { $apiKey = ''; $apiSecret = ''; } module_load_include('inc', 'sociallogin'); $data = get_authentication($apiKey, $apiSecret); if (isset($data['status']) && $data['status'] != 'status') { drupal_set_message($data['message'], $data['status']); return FALSE; } // parent::SubmitForm($form, $form_state); \Drupal\Core\Database\Database::getConnection()->delete('config')->condition('name', 'sociallogin.settings')->execute(); $this->config('sociallogin.settings')->set('interface_label', $form_state->getValue('interface_label'))->set('interface_size', $form_state->getValue('interface_size'))->set('interface_columns', $form_state->getValue('interface_columns'))->set('interface_bgcolor', $form_state->getValue('interface_bgcolor'))->set('login_form', $form_state->getValue('login_form'))->set('register_form', $form_state->getValue('register_form'))->set('commenting_form', $form_state->getValue('commenting_form'))->set('widget_location', $form_state->getValue('widget_location'))->set('admin_login', $form_state->getValue('admin_login'))->set('force_registration', $form_state->getValue('force_registration'))->set('email_required', $form_state->getValue('email_required'))->set('popup_title', $form_state->getValue('popup_title'))->set('popup_status', $form_state->getValue('popup_status'))->set('popup_error', $form_state->getValue('popup_error'))->set('welcome_email', $form_state->getValue('welcome_email'))->set('welcome_email_message', $form_state->getValue('welcome_email_message'))->set('update_user_profile', $form_state->getValue('update_user_profile'))->set('skip_email_verification', $form_state->getValue('skip_email_verification'))->set('user_fields', $form_state->getValue('user_fields'))->set('sociallogin_debug_mode', $form_state->getValue('sociallogin_debug_mode'))->save(); if (count(\Drupal::moduleHandler()->getImplementations('add_extra_config_settings')) > 0) { // Call all modules that implement the hook, and let them make changes to $variables. $data = \Drupal::moduleHandler()->invokeAll('add_extra_config_settings'); } if (isset($data) && is_array($data)) { foreach ($data as $key => $value) { $this->config('sociallogin.settings')->set($value, $form_state->getValue($value))->save(); } } drupal_set_message(t('Settings have been saved.'), 'status'); //Clear page cache foreach (Cache::getBins() as $service_id => $cache_backend) { if ($service_id == 'dynamic_page_cache') { $cache_backend->deleteAll(); } } }