array(
'controller' => 'facebook_main_ui',
'path' => null,
'ui' => 'facebook_admin_form_ui',
'uipath' => null
)
);
protected $adminMenu = array(
'main/prefs' => array('caption'=> LAN_PREFS, 'perm' => '0'),
'main/custom' => array('caption'=> 'Instructions', 'perm' => '0'),
'main/list' => array('caption'=> 'Facebook Users', 'perm' => '0')
);
protected $menuTitle = 'Facebook';
}
class facebook_main_ui extends e_admin_ui
{
protected $pluginTitle = 'Facebook Connect';
protected $pluginName = 'facebook';
protected $table = "facebook";
protected $pid = "facebook_id";
protected $fields; //coming soon.
protected $prefs = array(
'Facebook_App-Bundle' => array('title'=> 'Facebook Application ID', 'type'=>'text'),
'Facebook_Api-Key' => array('title'=> 'Facebook API Key', 'type'=>'text'),
'Facebook_Secret-Key' => array('title'=> 'Facebook Secret Key', 'type'=>'text')
);
function init()
{
$this->fields = array();
// echo $this->readSQLFile();
}
function readSQLFile()
{
$convert = array('varchar'=>'text','int'=>'int','text'=>'textarea');
$text = "
";
$text .= "\$fields = array(\n";
$text .= "\t'checkboxes' => array('title'=> '', 'type' => null),\n";
$tmp = file_get_contents(e_PLUGIN.$this->pluginName."/".$this->pluginName."_sql.php");
$lines = explode("\n",$tmp);
foreach($lines as $line)
{
$line = trim($line);
$line = str_replace(" "," ",$line);
list($field,$tmp2,$other) = explode(" ",$line,3);
list($type,$dummy) = explode("(",$tmp2);
if($field == 'CREATE' || $field == 'PRIMARY' || $field == 'UNIQUE')
{
continue;
}
$title = str_replace("_"," ",$field);
if($convert[$type])
{
$text .= "\t'".$field."' => array('title'=> '".ucwords($title)."', 'type'=> '".$convert[$type]."' ),\n";
}
}
$text .= "\t'options' => array('title'=> '', 'type' => null)\n);\n";
$text .= "
";
return $text;
}
function customPage()
{
global $ns,$pref;
$text = '
Setting Up Your Application and Getting an API Key
If you don\'t already have a Facebook Platform API key for your site, create an application with the Facebook Developer application.
Note: Even if you have created an application and received an API key, you should review steps 1.4 through 1.7 and make sure your application settings are appropriate.
- 1. Go to http://www.facebook.com/developers/createapp.php to create a new application.
- 2. Enter a name for your application in the Application Name field.
- 3. Accept the Developer Terms of Service, then click Save Changes.
- 4. On the Basic tab, keep all of the defaults.
- 5. Take note of the API Key, you\'ll need this shortly.
- 6. Click the Connect tab. Set Connect URL to the top-level directory of the site where you plan to implement Facebook Connect (this is usually your domain, like http://www.example.com, but could also be a subdirectory).
- 7. You should include a logo that appears on the Facebook Connect dialog. Next to Facebook Connect Logo, click Change your Facebook Connect logo and browse to an image file. The logo can be up to 99 pixels wide by 22 pixels tall, and must be in JPG, GIF, or PNG format.
- 8. If you plan to implement Facebook Connect across a number of subdomains of your site (for example, foo.example.com and bar.example.com), you need to enter a Base Domain (which would be example.com in this case). Specifying a base domain allows you to make calls using the PHP and JavaScript client libraries as well as get and store session information for any subdomain of the base domain. For more information about subdomains, see Supporting Subdomains In Facebook Connect.
- 9. Click Save Changes.
|
';
return $text;
}
}
class facebook_admin_form_ui extends e_admin_form_ui
{
function init()
{
}
}
new facebook_admin();
require_once(e_ADMIN."auth.php");
e107::getAdminUI()->runPage();
require_once(e_ADMIN."footer.php");
exit;
class facebook_aasdadmin
{
var $message;
function save_settings()
{
global $pref;
$pref['Facebook_Api-Key'] = $_POST['Facebook_Api-Key'];
$pref['Facebook_Secret-Key'] = $_POST['Facebook_Secret-Key'];
$pref['Facebook_App-Bundle'] = $_POST['Facebook_App-Bundle'];
save_prefs(); // uses toDB() automatically
}
function pref_form()
{
global $ns,$pref;
$text = ""; // Remove Notice in PHP.
// if (($pref['Facebook_Api-Key'] == '') || ($pref['Facebook_Secret-Key'] == ''))
{
$text .= $this->display_help();
}
$text .= '
';
$ns->tablerender("Facebook Connect :: General Settings", $this->message.$text);
}
}
?>