我正在使用带有 Codeigniter 的 Facebook 并且工作正常但突然停止工作,Facebook 是否改变了任何东西
脸书功能
public function takofacebook($page = TRUE, $name = TRUE) {
if (isset($page) and (($page != TRUE) or ($page != 1)) and isset($name)) {
$data['page'] = $page;
$data['name'] = $name;
}
$this -> load -> library('fb');
if (!$this -> fb -> is_connected()) {
redirect($this -> fb -> login_url(current_url()));
}
$fb_user = $this -> fb -> client -> api('/me');
if (empty($fb_user)) {
$error = "FACEBOOK LOGIN FAILED - USER US EMPTY. FILE: " . __FILE__ . " LINE: " . __LINE__;
$this -> session -> set_flashdata('register_error', $error);
} else {
$this -> user -> set_facebook_id($fb_user['id']);
$user = $this -> user -> get_by_facebook();
if (!empty($user) && !empty($user -> id) && is_numeric($user -> id)) {
//TODO: Make things a bit more secure here
//Login & Redirect home
$this -> _login($user -> id, 'facebook');
$this -> load -> view('users/redirect_home2', $data);
return;
}
}
//Go to the registeration page
$this -> load -> view('users/redirect2', array('method' => 'facebook'));
}
/**
* Logs user in with facebook
*/
//tako facebook
public function zangafacebook() {
$this -> load -> library('fb');
if (!$this -> fb -> is_connected()) {
redirect($this -> fb -> login_url(current_url()));
}
$fb_user = $this -> fb -> client -> api('/me');
if (empty($fb_user)) {
$error = "FACEBOOK LOGIN FAILED - USER US EMPTY. FILE: " . __FILE__ . " LINE: " . __LINE__;
$this -> session -> set_flashdata('register_error', $error);
} else {
$this -> user -> set_facebook_id($fb_user['id']);
$user = $this -> user -> get_by_facebook();
if (!empty($user) && !empty($user -> id) && is_numeric($user -> id)) {
//TODO: Make things a bit more secure here
//Login & Redirect home
$this -> _login($user -> id, 'facebook');
$this -> load -> view('users/redirect_home3');
return;
}
}
//Go to the registeration page
$this -> load -> view('users/redirect3', array('method' => 'facebook'));
}