+ Login
+Welcome back, please login to your account.
+Error getting long-lived access token: " . $this->helper->getMessage() . "
\n\n"); + } + //var_dump($accessToken->getValue()); + } + $_SESSION['fb_access_token'] = (string) $accessToken; + + return $accessToken; + } + + public function getData($accessToken) { + $user = NULL; + try { + // Returns a `Facebook\FacebookResponse` object + if ($accessToken!="") { + $response = $this->fb->get('/me?fields=id,name,email', $accessToken); + $user = $response->getGraphUser(); + } + } catch(Facebook\Exceptions\FacebookResponseException $e) { + return $this->constructResult(NULL,'Graph returned an error: ' . $e->getMessage()); + } catch(Facebook\Exceptions\FacebookSDKException $e) { + return $this->constructResult(NULL,'Facebook SDK returned an error: ' . $e->getMessage()); + } + return $this->constructResult($user, NULL); + } + + private function constructResult($me,$error) { + $fb_data = array( + 'me' => $me, + 'error' => $error + ); + $this->ci->session->set_userdata('fb_data', $fb_data); + return $fb_data; + } + + /** + * Enables the use of CI super-global without having to define an extra variable. + * I can't remember where I first saw this, so thank you if you are the original author. + * + * Borrowed from the Ion Auth library (http://benedmunds.com/ion_auth/) + * + * @param $var + * + * @return mixed + */ + public function __get($var) + { + return get_instance()->$var; + } +} diff --git a/wwwjuba/application/libraries/Member_Controller.php b/wwwjuba/application/libraries/Member_Controller.php index 5b072da..23127eb 100644 --- a/wwwjuba/application/libraries/Member_Controller.php +++ b/wwwjuba/application/libraries/Member_Controller.php @@ -2,7 +2,7 @@ defined('BASEPATH') OR exit('No direct script access allowed'); -class Practice_Controller extends JUB_Controller { +class Member_Controller extends JUB_Controller { public $data = array(); diff --git a/wwwjuba/application/models/Backend_model.php b/wwwjuba/application/models/Backend_model.php new file mode 100644 index 0000000..bfecb0b --- /dev/null +++ b/wwwjuba/application/models/Backend_model.php @@ -0,0 +1,39 @@ +USER = $_SERVER['SCRIPT_FILENAME']; + $this->USER = str_replace('/home', '', $this->USER); + $this->USER = strtok($this->USER, '/'); + if ($this->USER == 'opt') { + $this->USER = 'root'; + } + $this->thisUser = $this->USER; + } + + public function jubabox_api($in, $out = array()) { + $this->jubabox_load(); + $ret = $this->jubabox->jubabox_api($in, $out); + return $ret; + } + + public function cfgReadChar($str) { + $this->jubabox_load(); + $ret = $this->jubabox->cfgReadChar($str); + return $ret; + } + + private function jubabox_load() { + // $this->$USER = $_SERVER['SCRIPT_FILENAME']; + $jubabox_class = 'jubabox_api_' . $this->USER . '\\jubabox'; + if (!is_object($this->jubabox)) { + $this->jubabox = new $jubabox_class(); + } + } +} diff --git a/wwwjuba/application/views/home/view_home.php b/wwwjuba/application/views/home/view_home.php new file mode 100644 index 0000000..2ffb982 --- /dev/null +++ b/wwwjuba/application/views/home/view_home.php @@ -0,0 +1,147 @@ + + + + + + + + + + + +
+ Welcome back, please login to your account.
+Welcome back, please login to your account.