Location: PHPKode > scripts > Facebook 2011 For PhpBB > Facebook_2011/root/includes/acp/acp_fb2011.php
<?php
/*
	COPYRIGHT 2009 Michael J Goonawardena
		
	This file is part of ConSof Alternate Login.

    ConSof Alternate Login is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation, either version 3 of the License, or
    (at your option) any later version.

    ConSof Alternate Login is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.

    You should have received a copy of the GNU General Public License
    along with ConSof Alternate Login.  If not, see <http://www.gnu.org/licenses/>.*/

if (!defined('IN_PHPBB'))
{
	exit;
}


class acp_fb2011
{
	var $u_action;
	var $p_master;

	function acp_users(&$p_master)
	{
		$this->p_master = &$p_master;
	}

	function main($id, $mode)
	{
		global $config, $db, $user, $auth, $template, $cache;
		global $phpbb_root_path, $phpbb_admin_path, $phpEx, $table_prefix, $file_uploads;

		// Add the additional language file.
		$user->add_lang('mods/fb2011');
		
		// Set the template details.
		$this->tpl_name = 'acp_fb2011';
		$this->page_title = 'ACP_FB2011';
		
		// Include the Alternate Login functions file.
		include_once($phpbb_root_path . 'includes/functions_fb2011.' . $phpEx);

		// Retrieve the action and submit values.
		$action		= request_var('action', '');

		// Set the form name and add the form key.
		$form_name = 'acp_fb2011';
		add_form_key($form_name);
		
		// Get the global Alternate Login settings and convert them to a binary on/off array.
		$fb2011_settings = get_fb2011_settings($config['fb2011_settings']);
	

		// Process the submit action.
		if(isset($_POST['submit']))
		{
      switch($mode)
			{
        case 'facebook':
          $facebook_login = request_var('facebook_login', '');
          $facebook_profile = request_var('facebook_profile', '');      
          if($facebook_login == 1)
          {
            $fb2011_settings[FB2011_FACEBOOK_LOGIN] = 1;
          }
          else
          {
            $fb2011_settings[FB2011_FACEBOOK_LOGIN] = 0;
          }
          
          if($facebook_profile == 1)
          {
            $fb2011_settings[FB2011_FACEBOOK_PROFILE] = 1;
          }
          else
          {
            $fb2011_settings[FB2011_FACEBOOK_PROFILE] = 0;
          }        
					$facebook_app_id = request_var('facebook_app_id', '');
					set_config('fb2011_appid', $facebook_app_id, true);
					
					$facebook_secret = request_var('facebook_secret', '');
					set_config('fb2011_secret', $facebook_secret, true);
					
					$facebook_locale = request_var('lang', '');
					set_config('fb2011_lang', $facebook_locale, true);
					
					$facebook_admins = request_var('facebook_admins', '');
					set_config('fb2011_admins', $facebook_admins, true);
					
					$facebook_like_enable = request_var('facebook_like_enable', '');
					set_config('fb2011_like_enable', $facebook_like_enable, true);																
					
					$facebook_like_layout = request_var('facebook_like_layout', '');
					set_config('fb2011_like_layout', $facebook_like_layout, true);
					
					$facebook_like_action = request_var('facebook_like_action', '');
					set_config('fb2011_like_action', $facebook_like_action, true);
					
					$facebook_like_faces = request_var('facebook_like_faces', '');
					set_config('fb2011_like_faces', $facebook_like_faces, true);
					
					$facebook_like_width = request_var('facebook_like_width', '');
					set_config('fb2011_like_width', $facebook_like_width, true);
					
					$facebook_like_font = request_var('facebook_like_font', '');
					set_config('fb2011_like_font', $facebook_like_font, true);
					
					$facebook_like_color = request_var('facebook_like_color', '');
					set_config('fb2011_like_color', $facebook_like_color, true);
					
					$facebook_comment_enable = request_var('facebook_comment_enable', '');
					set_config('fb2011_comment_enable', $facebook_comment_enable, true);        
					
					$facebook_comment_width = request_var('facebook_comment_width', '');
					set_config('fb2011_comment_width', $facebook_comment_width, true);
					
					$facebook_comment_posts = request_var('facebook_comment_posts', '');
					set_config('fb2011_comment_posts', $facebook_comment_posts, true);
					
					$fb2011_fb_show_bday = request_var('fb2011_fb_show_bday', '');
					set_config('fb2011_fb_show_bday', $fb2011_fb_show_bday, true);

					$fb2011_fb_show_gender = request_var('fb2011_fb_show_gender', '');
					set_config('fb2011_fb_show_gender', $fb2011_fb_show_gender, true);

					$fb2011_fb_show_loaction = request_var('fb2011_fb_show_loaction', '');
					set_config('fb2011_fb_show_loaction', $fb2011_fb_show_loaction, true);															
          
          $config_value = set_fb2011_settings($fb2011_settings);
          set_config('fb2011_settings', $config_value, true);				
          
          trigger_error($user->lang['ACP_FB2011_SETTINGS_UPDATED'] . adm_back_link($this->u_action));
        break;    
      }
    }
    else
    {
      switch($mode)
			{
        case 'facebook': 
           
        $selected = ' selected="selected" ';
        $checked = ' checked="checked" ';
					if($fb2011_settings[FB2011_FACEBOOK_LOGIN] == 1)
					{
						$facebook_login_yes = $checked;
						$facebook_login_no = '';
					}
					else
					{
						$facebook_login_no = $checked ;
						$facebook_login_yes = '';
					}
								
					if($fb2011_settings[FB2011_FACEBOOK_PROFILE] == 1)
					{
						$facebook_profile_yes = $checked ;
						$facebook_profile_no = '';
					}
					else
					{
						$facebook_profile_no = $checked ;
						$facebook_profile_yes = '';
					}
        $selectedstandard = ($config['fb2011_like_layout'] === 'standard' ? $selected : '');
        $selectedbutton_count = ($config['fb2011_like_layout'] === 'button_count' ? $selected : '');
        $selectedbox_count = ($config['fb2011_like_layout'] === 'box_count' ? $selected : '');
        $selectedlikeenabled = ($config['fb2011_like_enable'] === 'yes' ? $checked : '');
        $selectedlikedisabled = ($config['fb2011_like_enable'] === 'no' ? $checked : '');      			
        $selectedlight = ($config['fb2011_like_color'] === 'light' ? $selected : '');
        $selecteddark = ($config['fb2011_like_color'] === 'dark' ? $selected : '');
        $selectedlike = ($config['fb2011_like_action'] === 'like' ? $selected : '');
        $selectedrec = ($config['fb2011_like_action'] === 'recommend' ? $selected : '');
        $selectedfacestrue = ($config['fb2011_like_faces'] === 'true' ? $selected : '');
        $selectedfacesfalse = ($config['fb2011_like_faces'] === 'false' ? $selected : '');
        $selectedfontarial = ($config['fb2011_like_font'] === 'arial' ? $selected : '');
        $selectedfontlucida = ($config['fb2011_like_font'] === 'lucida grande' ? $selected : '');	
        $selectedfontsegoe = ($config['fb2011_like_font'] === 'segoe ui' ? $selected : '');
        $selectedfonttahoma = ($config['fb2011_like_font'] === 'tahoma' ? $selected : '');	
        $selectedfonttrebuchet = ($config['fb2011_like_font'] === 'trebuchet ms' ? $selected : '');
        $selectedfontverdana = ($config['fb2011_like_font'] === 'verdana' ? $selected : '');
        $selectedfacestrue = ($config['fb2011_like_faces'] === 'true' ? $selected : '');
        $selectedfacesfalse = ($config['fb2011_like_faces'] === 'false' ? $selected : '');				
        $selectedcommentenabled = ($config['fb2011_comment_enable'] === 'yes' ? $checked : '');
        $selectedcommentdisabled = ($config['fb2011_comment_enable'] === 'no' ? $checked : '');                         
        $selectedbdayenabled = ($config['fb2011_fb_show_bday'] === 'yes' ? $checked : '');
        $selectedbdaydisabled = ($config['fb2011_fb_show_bday'] === 'no' ? $checked : '');
        $selectedlocationenabled = ($config['fb2011_fb_show_location'] === 'yes' ? $checked : '');
        $selectedlocationdisabled = ($config['fb2011_fb_show_location'] === 'no' ? $checked : '');
        $selectedgenderenabled = ($config['fb2011_fb_show_gender'] === 'yes' ? $checked : '');
        $selectedgenderdisabled = ($config['fb2011_fb_show_gender'] === 'no' ? $checked : '');
        $template->assign_vars(array(
          'S_FACEBOOK_LANG'  => (!isset($config['fb2011_lang']) ? fb_language_select('en_US') : fb_language_select($config['fb2011_lang'])),
          'FACEBOOK_LOGIN_YES'		=> $facebook_login_yes,
          'FACEBOOK_LOGIN_NO'			=> $facebook_login_no,
          'FACEBOOK_PROFILE_YES'		=> $facebook_profile_yes,
          'FACEBOOK_PROFILE_NO'		=> $facebook_profile_no,				
          'FACEBOOK_APP_ID'			=> $config['fb2011_appid'],
          'FACEBOOK_SECRET'			=> $config['fb2011_secret'],
          'FACEBOOK_ADMINS'     => $config['fb2011_admins'],
          'FACEBOOK_LIKE_ENABLED_YES'  => $selectedlikeenabled,
          'FACEBOOK_LIKE_ENABLED_NO'  => $selectedlikedisabled,        			
          'FACEBOOK_LIKE_LAYOUT_STANDARD'			=> $selectedstandard,
          'FACEBOOK_LIKE_LAYOUT_BUTTON_COUNT'			=> $selectedbutton_count,
          'FACEBOOK_LIKE_LAYOUT_BOX_COUNT'			=> $selectedbox_count,
          'FACEBOOK_LIKE_ACTION_LIKE'			=> $selectedlike,
          'FACEBOOK_LIKE_ACTION_RECOMMEND'			=> $selectedrec,
          'FACEBOOK_LIKE_FACES_TRUE'			=> $selectedfacestrue,
          'FACEBOOK_LIKE_FACES_FALSE'			=> $selectedfacesfalse,
          'FACEBOOK_LIKE_WIDTH'			  => $config['fb2011_like_width'],
          'FACEBOOK_LIKE_FONT_ARIAL'			=> $selectedfontarial,
          'FACEBOOK_LIKE_FONT_LUCIDA'			=> $selectedfontlucida,
          'FACEBOOK_LIKE_FONT_SEGOE'			=> $selectedfontsegoe,
          'FACEBOOK_LIKE_FONT_TAHOMA'			=> $selectedfonttahoma,
          'FACEBOOK_LIKE_FONT_TREBUCHET'			=> $selectedfonttrebuchet,
          'FACEBOOK_LIKE_FONT_VERDANA'			=> $selectedfontverdana,
          'FACEBOOK_LIKE_COLOR_LIGHT'			=> $selectedlight,
          'FACEBOOK_LIKE_COLOR_DARK'			=> $selecteddark,
          'FACEBOOK_COMMENT_ENABLE_YES'  => $selectedcommentenabled,
          'FACEBOOK_COMMENT_ENABLE_NO'  => $selectedcommentdisabled,        			        
          'FACEBOOK_COMMENT_WIDTH'			=> $config['fb2011_comment_width'],
          'FACEBOOK_COMMENT_POSTS'			=> $config['fb2011_comment_posts'],
          'FACEBOOK_REGO_BDAY_YES'			=> $selectedbdayenabled,
          'FACEBOOK_REGO_BDAY_NO'			=> $selectedbdaydisabled,
          'FACEBOOK_REGO_LOCATION_YES'			=> $selectedlocationenabled,
          'FACEBOOK_REGO_LOCATION_NO'			=> $selectedlocationdisabled,
          'FACEBOOK_REGO_GENDER_YES'			=> $selectedgenderenabled,
          'FACEBOOK_REGO_GENDER_NO'			=> $selectedgenderdisabled, 
          'S_MODE_FACEBOOK'   => true,
          'U_ACTION'					=> $this->u_action,
        ));
        
        break;
      }
    }
	}	
}

?>
Return current item: Facebook 2011 For PhpBB