fix
This commit is contained in:
@@ -15,9 +15,9 @@ system:
|
||||
database:
|
||||
{
|
||||
host = "127.0.0.1";
|
||||
name = "savvy";
|
||||
user = "savvy";
|
||||
pass = "savvy001!";
|
||||
name = "jubabox";
|
||||
user = "jubabox";
|
||||
pass = "jubabox001";
|
||||
port = 5432;
|
||||
};
|
||||
|
||||
@@ -28,18 +28,9 @@ mailsend:
|
||||
domain = "chiefsoft.com";
|
||||
user = "savvy@chiefsoft.com";
|
||||
pass = "may12002!";
|
||||
name = "Savvy Demo";
|
||||
name = "Jubabox Beta";
|
||||
};
|
||||
|
||||
mailsendOLD:
|
||||
{
|
||||
from = "support@wrenchboard.com";
|
||||
server = "smtp.gmail.com";
|
||||
domain = "kleenapp.com";
|
||||
user = "support@wrenchboard.com";
|
||||
pass = "may12002!";
|
||||
name = "Kleen Demo Support";
|
||||
};
|
||||
|
||||
stripe:
|
||||
{
|
||||
|
||||
@@ -39,10 +39,21 @@ enum {
|
||||
#define INVOICE_PREVIEW 100
|
||||
#define INVOICE_FINAL 200
|
||||
|
||||
#define USER_START 100000
|
||||
|
||||
|
||||
#define USER_LOGIN 100011
|
||||
|
||||
#define USER_END 199999
|
||||
|
||||
|
||||
|
||||
#define TRNASPORTER 1
|
||||
#define TRANSLATOR 2
|
||||
|
||||
|
||||
|
||||
|
||||
#define MODE_CONFIRM_ASSIGNMENT 100
|
||||
#define MODE_REJECT_ASSIGNMENT 200
|
||||
#define MODE_CANCEL_ASSIGNMENT 210
|
||||
|
||||
@@ -15,6 +15,7 @@ main entry point for API calls Chiefsoft July 2017 */
|
||||
#include "medTEmails.h"
|
||||
#include "medTUpload.h"
|
||||
#include "mobile.h"
|
||||
#include "members.h"
|
||||
|
||||
long jubabox_api_main(CVars in, CVars &out) {
|
||||
logfmt(logINFO, "long jubabox_api_main(CVars in, CVars &out)");
|
||||
@@ -22,14 +23,12 @@ long jubabox_api_main(CVars in, CVars &out) {
|
||||
long action = REQ_LONG(in, "action", 0, -1);
|
||||
REQ_LONG(in, "pid", 0, -1); // global implementation - who is calling
|
||||
try {
|
||||
if (action == MEDTRANS_UPLOADS) {
|
||||
return medtrans_upload(in, out);
|
||||
}
|
||||
if (action == MEDTRANS_DOWNLOAD) {
|
||||
return medtrans_download(in, out);
|
||||
}
|
||||
|
||||
|
||||
if (action >= USER_START && action <= USER_END) {
|
||||
return members_calls(in, out);
|
||||
}
|
||||
|
||||
if (action >= MEDTRANS_BKO_START && action <= MEDTRANS_BKO_END) {
|
||||
return backoffice_calls(in, out);
|
||||
}
|
||||
|
||||
@@ -12,16 +12,25 @@
|
||||
|
||||
/* -- */
|
||||
#include "members.h"
|
||||
#include "function_members.h"
|
||||
|
||||
|
||||
long members_calls(CVars in, CVars &out) {
|
||||
long ret = PHP_API_BAD_PARAM;
|
||||
try {
|
||||
|
||||
REQ_LONG(in, "action", 0, -1);
|
||||
long action = REQ_LONG(in, "action", 0, -1);
|
||||
|
||||
switch (action) {
|
||||
case USER_LOGIN:
|
||||
ret = medTMemberLogin(in, out);
|
||||
break;
|
||||
}
|
||||
|
||||
} catch (bad_parameter) {
|
||||
logfmt(logINFO, "ERROR CALL long members_calls(CVars in, CVars &out)");
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
+5
-7
@@ -1,22 +1,21 @@
|
||||
<IfModule mod_rewrite.c>
|
||||
|
||||
RewriteEngine On
|
||||
# RewriteBase /home/oameye/jubaboxweb/wwwjuba/
|
||||
RewriteBase /
|
||||
|
||||
#Removes access to the system folder by users.
|
||||
#Additionally this will allow you to create a System.php controller,
|
||||
#previously this would not have been possible.
|
||||
#'system' can be replaced if you have renamed your system folder.
|
||||
#RewriteCond %{REQUEST_URI} ^system.*
|
||||
#RewriteRule ^(.*)$ /index.php?/$1 [L]
|
||||
RewriteCond %{REQUEST_URI} ^system.*
|
||||
RewriteRule ^(.*)$ /index.php?/$1 [L]
|
||||
|
||||
#When your application folder isn't in the system folder
|
||||
#This snippet prevents user access to the application folder
|
||||
#Submitted by: Fabdrol
|
||||
#Rename 'application' to your applications folder name.
|
||||
|
||||
#RewriteCond %{REQUEST_URI} ^application.*
|
||||
#RewriteRule ^(.*)$ /index.php?/$1 [L]
|
||||
RewriteCond %{REQUEST_URI} ^application.*
|
||||
RewriteRule ^(.*)$ /index.php?/$1 [L]
|
||||
|
||||
#Checks to
|
||||
RewriteCond %{REQUEST_FILENAME} !-f
|
||||
@@ -33,4 +32,3 @@ RewriteRule ^(.*)$ index.php?/$1 [L]
|
||||
ErrorDocument 404 /index.php
|
||||
|
||||
</IfModule>
|
||||
|
||||
|
||||
@@ -0,0 +1,37 @@
|
||||
<IfModule mod_rewrite.c>
|
||||
|
||||
RewriteEngine On
|
||||
# RewriteBase /home/oameye/jubaboxweb/wwwjuba/
|
||||
RewriteBase /
|
||||
|
||||
#Removes access to the system folder by users.
|
||||
#Additionally this will allow you to create a System.php controller,
|
||||
#previously this would not have been possible.
|
||||
#'system' can be replaced if you have renamed your system folder.
|
||||
RewriteCond %{REQUEST_URI} ^system.*
|
||||
RewriteRule ^(.*)$ /index.php?/$1 [L]
|
||||
|
||||
#When your application folder isn't in the system folder
|
||||
#This snippet prevents user access to the application folder
|
||||
#Submitted by: Fabdrol
|
||||
#Rename 'application' to your applications folder name.
|
||||
|
||||
RewriteCond %{REQUEST_URI} ^application.*
|
||||
RewriteRule ^(.*)$ /index.php?/$1 [L]
|
||||
|
||||
#Checks to
|
||||
RewriteCond %{REQUEST_FILENAME} !-f
|
||||
RewriteCond %{REQUEST_FILENAME} !-d
|
||||
RewriteRule ^(.*)$ index.php?/$1 [L]
|
||||
|
||||
</IfModule>
|
||||
|
||||
<IfModule !mod_rewrite.c>
|
||||
# If we don't have mod_rewrite installed, all 404's
|
||||
# can be sent to index.php, and everything works as normal.
|
||||
# Submitted by: ElliotHaughin
|
||||
|
||||
ErrorDocument 404 /index.php
|
||||
|
||||
</IfModule>
|
||||
|
||||
@@ -59,8 +59,8 @@ $autoload['packages'] = array();
|
||||
|
|
||||
| $autoload['libraries'] = array('user_agent' => 'ua');
|
||||
*/
|
||||
$autoload['libraries'] = array();
|
||||
|
||||
//$autoload['libraries'] = array();
|
||||
$autoload['libraries'] = array('session','form_validation');
|
||||
/*
|
||||
| -------------------------------------------------------------------
|
||||
| Auto-load Drivers
|
||||
@@ -90,8 +90,7 @@ $autoload['drivers'] = array();
|
||||
|
|
||||
| $autoload['helper'] = array('url', 'file');
|
||||
*/
|
||||
$autoload['helper'] = array('url', 'file');
|
||||
|
||||
$autoload['helper'] = array('form','url', 'file');
|
||||
/*
|
||||
| -------------------------------------------------------------------
|
||||
| Auto-load Config files
|
||||
|
||||
@@ -126,7 +126,7 @@ $config['enable_hooks'] = FALSE;
|
||||
| https://codeigniter.com/user_guide/general/creating_libraries.html
|
||||
|
|
||||
*/
|
||||
$config['subclass_prefix'] = 'MY_';
|
||||
$config['subclass_prefix'] = 'JUB_';
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
@@ -235,7 +235,7 @@ $config['allow_get_array'] = TRUE;
|
||||
| your log files will fill up very fast.
|
||||
|
|
||||
*/
|
||||
$config['log_threshold'] = 0;
|
||||
$config['log_threshold'] = 4;
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
|
||||
@@ -83,3 +83,16 @@ defined('EXIT_USER_INPUT') OR define('EXIT_USER_INPUT', 7); // invalid user
|
||||
defined('EXIT_DATABASE') OR define('EXIT_DATABASE', 8); // database error
|
||||
defined('EXIT__AUTO_MIN') OR define('EXIT__AUTO_MIN', 9); // lowest automatically-assigned error code
|
||||
defined('EXIT__AUTO_MAX') OR define('EXIT__AUTO_MAX', 125); // highest automatically-assigned error code
|
||||
|
||||
define('SITE_NAME','JubaBox');
|
||||
define('SITE_EMAIL','support@jubabox.com');
|
||||
define('SITE_PHONE','+1 911 9110');
|
||||
define('SITE_FAX','+1 9FX 9110');
|
||||
|
||||
define('PHP_API_OK', 0);
|
||||
define('MAX_ADMIN_SESSION',1200);
|
||||
|
||||
|
||||
|
||||
|
||||
define('USER_LOGIN', 100011);
|
||||
|
||||
@@ -0,0 +1,29 @@
|
||||
<?php
|
||||
defined('BASEPATH') OR exit('No direct script access allowed');
|
||||
/*
|
||||
| -------------------------------------------------------------------
|
||||
| Facebook App details
|
||||
| -------------------------------------------------------------------
|
||||
|
|
||||
| To get an facebook app details you have to be a registered developer
|
||||
| at http://developer.facebook.com and create an app for your project.
|
||||
|
|
||||
| facebook_app_id string Your facebook app ID.
|
||||
| facebook_app_secret string Your facebook app secret.
|
||||
| facebook_login_type string Set login type. (web, js, canvas)
|
||||
| facebook_login_redirect_url string URL tor redirect back to after login. Do not include domain.
|
||||
| facebook_logout_redirect_url string URL tor redirect back to after login. Do not include domain.
|
||||
| facebook_permissions array The permissions you need.
|
||||
| facebook_graph_version string Set Facebook Graph version to be used. Eg v2.6
|
||||
| facebook_auth_on_load boolean Set to TRUE to have the library to check for valid access token on every page load.
|
||||
*/
|
||||
$config['facebook_app_id'] = '390204307987009';
|
||||
$config['facebook_app_secret'] = '19f778e312f2ab96d147bacb612910c2';
|
||||
$config['facebook_default_scope'] = 'email,public_profile';
|
||||
$config['facebook_login_type'] = 'web';
|
||||
$config['facebook_login_redirect_url'] = 'login';
|
||||
$config['facebook_logout_redirect_url'] = 'login/logout';
|
||||
$config['facebook_permissions'] = array('public_profile', 'email');
|
||||
$config['facebook_graph_version'] = 'v2.2';
|
||||
$config['facebook_auth_on_load'] = TRUE;
|
||||
|
||||
@@ -1,38 +1,64 @@
|
||||
<?php
|
||||
|
||||
defined('BASEPATH') OR exit('No direct script access allowed');
|
||||
|
||||
class Auth extends CI_Controller {
|
||||
class Auth extends Start_Controller {
|
||||
|
||||
|
||||
public function index() {
|
||||
|
||||
|
||||
$data = array();
|
||||
$username='';
|
||||
$password='';
|
||||
$error_message='';
|
||||
$valid_entry=false;
|
||||
$valid_login=false;
|
||||
$this->testLoginInput($username, $password, $error_message, $valid_entry);
|
||||
|
||||
if ( true == $valid_entry )
|
||||
{
|
||||
if ($username!='' && $password !=''){
|
||||
|
||||
$data["page_title"] = "";
|
||||
$data["username"] = $username; //"auxsupport";
|
||||
$data["password"] = "may12002";
|
||||
$this->jubabox_webapi(USER_LOGIN, $data, $out);
|
||||
//print_r( $data );
|
||||
//print_r( $out );
|
||||
if ( count($out) > 0 && isset($out[0]) ){
|
||||
$this->getSessionData($out[0], $session_data); // just for testing
|
||||
|
||||
$this->buildUserSession(PHP_API_OK,$session_data);
|
||||
$valid_login = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
$error_message ="Invalid Username/Password";
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
$this->load->view('home/view_login');
|
||||
}
|
||||
|
||||
public function forgotpass() {
|
||||
$this->index();
|
||||
}
|
||||
|
||||
public function register() {
|
||||
$this->index();
|
||||
}
|
||||
|
||||
public function logout() {
|
||||
$this->index();
|
||||
}
|
||||
|
||||
public function login() {
|
||||
$this->index();
|
||||
}
|
||||
|
||||
/**
|
||||
* Index Page for this controller.
|
||||
*
|
||||
* Maps to the following URL
|
||||
* http://example.com/index.php/welcome
|
||||
* - or -
|
||||
* http://example.com/index.php/welcome/index
|
||||
* - or -
|
||||
* Since this controller is set as the default controller in
|
||||
* config/routes.php, it's displayed at http://example.com/
|
||||
*
|
||||
* So any other public methods not prefixed with an underscore will
|
||||
* map to /index.php/welcome/<method_name>
|
||||
* @see https://codeigniter.com/user_guide/general/urls.html
|
||||
*/
|
||||
public function index()
|
||||
{
|
||||
$this->load->view('home/view_login');
|
||||
}
|
||||
|
||||
public function forgotpass(){
|
||||
$this->index();
|
||||
}
|
||||
public function register(){
|
||||
$this->index();
|
||||
}
|
||||
public function logout(){
|
||||
$this->index();
|
||||
}
|
||||
public function login(){
|
||||
$this->index();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,23 +1,9 @@
|
||||
<?php
|
||||
defined('BASEPATH') OR exit('No direct script access allowed');
|
||||
|
||||
class Page extends CI_Controller {
|
||||
class Page extends Member_Controller {
|
||||
|
||||
|
||||
/**
|
||||
* Index Page for this controller.
|
||||
*
|
||||
* Maps to the following URL
|
||||
* http://example.com/index.php/welcome
|
||||
* - or -
|
||||
* http://example.com/index.php/welcome/index
|
||||
* - or -
|
||||
* Since this controller is set as the default controller in
|
||||
* config/routes.php, it's displayed at http://example.com/
|
||||
*
|
||||
* So any other public methods not prefixed with an underscore will
|
||||
* map to /index.php/welcome/<method_name>
|
||||
* @see https://codeigniter.com/user_guide/general/urls.html
|
||||
*/
|
||||
public function index()
|
||||
{
|
||||
$this->load->view('members/view_page');
|
||||
|
||||
@@ -1,11 +1,44 @@
|
||||
<?php
|
||||
|
||||
defined('BASEPATH') OR exit('No direct script access allowed');
|
||||
|
||||
|
||||
class Startwww extends CI_Controller {
|
||||
|
||||
/**
|
||||
* Index Page for this controller.
|
||||
*
|
||||
* Maps to the following URL
|
||||
* http://example.com/index.php/welcome
|
||||
* - or -
|
||||
* http://example.com/index.php/welcome/index
|
||||
* - or -
|
||||
* Since this controller is set as the default controller in
|
||||
* config/routes.php, it's displayed at http://example.com/
|
||||
*
|
||||
* So any other public methods not prefixed with an underscore will
|
||||
* map to /index.php/welcome/<method_name>
|
||||
* @see https://codeigniter.com/user_guide/general/urls.html
|
||||
*/
|
||||
public function index() {
|
||||
// echo "lslslsls";
|
||||
$this->load->view('home/view_home');
|
||||
}
|
||||
|
||||
public function forgotpass() {
|
||||
$this->index();
|
||||
}
|
||||
|
||||
public function register() {
|
||||
$this->index();
|
||||
}
|
||||
|
||||
public function logout() {
|
||||
$this->index();
|
||||
}
|
||||
|
||||
public function login() {
|
||||
$this->index();
|
||||
}
|
||||
|
||||
public function index()
|
||||
{
|
||||
$this->load->view('home/view_login');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -27,6 +27,7 @@ class JUB_Controller extends CI_Controller {
|
||||
|
||||
function __construct() {
|
||||
parent::__construct();
|
||||
$this->load->library(array('session'));
|
||||
}
|
||||
|
||||
protected function smart_htmlspecialchars($str) {
|
||||
@@ -49,14 +50,10 @@ class JUB_Controller extends CI_Controller {
|
||||
}
|
||||
|
||||
protected function jubabox_webapi($action, $in, &$out) {
|
||||
global $savvyext;
|
||||
$ret = -1;
|
||||
$in['pid'] = 115;
|
||||
|
||||
error_log("ret = $ret");
|
||||
error_log(json_encode($out));
|
||||
|
||||
return $ret;
|
||||
$this->load->model('backend_model');
|
||||
$in["action"] = $action;
|
||||
$in["pid"] = 100;
|
||||
return $this->backend_model->jubabox_api($in, $out);
|
||||
}
|
||||
|
||||
function formatedMesage($msgType, $theMessage) {
|
||||
|
||||
@@ -0,0 +1,217 @@
|
||||
<?php if (! defined('BASEPATH')) exit('No direct script access allowed');
|
||||
/**
|
||||
* Name: Facebook Login Library
|
||||
*
|
||||
* Author: appleboy
|
||||
*
|
||||
*/
|
||||
require 'vendor/autoload.php';
|
||||
//require_once 'vendor/facebook/php-sdk-v4/src/Facebook/autoload.php';
|
||||
use Facebook\Facebook;
|
||||
use Facebook\FacebookRequestException;
|
||||
use Facebook\FacebookRedirectLoginHelper;
|
||||
class Lib_login
|
||||
{
|
||||
/**
|
||||
* CodeIgniter global
|
||||
*
|
||||
* @var string
|
||||
**/
|
||||
protected $ci;
|
||||
/**
|
||||
* @var FB
|
||||
*/
|
||||
private $fb;
|
||||
|
||||
private $helper;
|
||||
private $facebook_default_scope;
|
||||
private $facebook_login_url;
|
||||
private $facebook_logout_url;
|
||||
|
||||
/**
|
||||
* __construct
|
||||
*
|
||||
* @return void
|
||||
* @author Ben
|
||||
**/
|
||||
public function __construct()
|
||||
{
|
||||
if (!session_id()) {
|
||||
session_start();
|
||||
}
|
||||
$this->ci =& get_instance();
|
||||
$this->ci->load->library('session');
|
||||
$this->ci->config->load('facebook');
|
||||
$this->ci->load->helper('url');
|
||||
if (! isset($_SESSION)) {
|
||||
session_start();
|
||||
}
|
||||
$this->facebook_default_scope = explode(',', $this->ci->config->item("facebook_default_scope"));
|
||||
$facebook_app_id = $this->ci->config->item("facebook_app_id");
|
||||
$facebook_app_secret = $this->ci->config->item("facebook_app_secret");
|
||||
$this->facebook_login_url = base_url() . $this->ci->config->item("facebook_login_redirect_url").'/';
|
||||
$this->facebook_logout_url = base_url() . $this->ci->config->item("facebook_logout_redirect_url").'/';
|
||||
// init app with app id and secret
|
||||
$this->fb = new Facebook([
|
||||
'app_id' => $facebook_app_id, // Replace {app-id} with your app id
|
||||
'app_secret' => $facebook_app_secret,
|
||||
'default_graph_version' => 'v2.2',
|
||||
]);
|
||||
$this->helper = $this->fb->getRedirectLoginHelper();
|
||||
}
|
||||
|
||||
/**
|
||||
* @return FB
|
||||
*/
|
||||
public function object()
|
||||
{
|
||||
return $this->fb;
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if user are logged in by checking if we have a Facebook
|
||||
* session active.
|
||||
*
|
||||
* @return mixed|boolean
|
||||
*/
|
||||
public function is_authenticated()
|
||||
{
|
||||
$access_token = $this->authenticate();
|
||||
if (isset($access_token))
|
||||
{
|
||||
return $access_token;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Destroy our local Facebook session
|
||||
*/
|
||||
public function destroy_session()
|
||||
{
|
||||
$this->session->unset_userdata('fb_access_token');
|
||||
}
|
||||
|
||||
public function getLoginUrl() {
|
||||
return $this->helper->getLoginUrl($this->facebook_login_url, $this->facebook_default_scope);
|
||||
}
|
||||
|
||||
public function getLogoutUrl() {
|
||||
return $this->helper->getLogoutUrl($this->get_access_token(), $this->facebook_logout_url);
|
||||
}
|
||||
|
||||
public function get_access_token() {
|
||||
return $this->session->userdata('fb_access_token');
|
||||
}
|
||||
|
||||
/**
|
||||
* @return mixed
|
||||
*/
|
||||
private function get_expire_time()
|
||||
{
|
||||
return $this->session->userdata('fb_expire');
|
||||
}
|
||||
/**
|
||||
* @param DateTime $time
|
||||
*/
|
||||
private function set_expire_time(DateTime $time = null)
|
||||
{
|
||||
if ($time) {
|
||||
$this->session->set_userdata('fb_expire', $time->getTimestamp());
|
||||
}
|
||||
}
|
||||
|
||||
public function authenticate()
|
||||
{
|
||||
$accessToken = $this->get_access_token();
|
||||
if ($accessToken && $this->get_expire_time() > (time() + 30) || $accessToken && !$this->get_expire_time())
|
||||
{
|
||||
$this->fb->setDefaultAccessToken($accessToken);
|
||||
return $accessToken;
|
||||
}
|
||||
// If we did not have a stored access token or if it has expired, try get a new access token
|
||||
try {
|
||||
$accessToken = $this->helper->getAccessToken($this->facebook_login_url);
|
||||
} catch(Facebook\Exceptions\FacebookResponseException $e) {
|
||||
// When Graph returns an error
|
||||
return $this->constructResult(NULL, 'Graph returned an error: ' . $e->getMessage());
|
||||
} catch(Facebook\Exceptions\FacebookSDKException $e) {
|
||||
// When validation fails or other local issues
|
||||
return $this->constructResult(NULL, 'Facebook SDK returned an error: ' . $e->getMessage());
|
||||
}
|
||||
|
||||
if (! isset($accessToken)) {
|
||||
if ($this->helper->getError()) {
|
||||
/*header('HTTP/1.0 401 Unauthorized');
|
||||
echo "Error: " . $helper->getError() . "\n";
|
||||
echo "Error Code: " . $helper->getErrorCode() . "\n";
|
||||
echo "Error Reason: " . $helper->getErrorReason() . "\n";
|
||||
echo "Error Description: " . $helper->getErrorDescription() . "\n";
|
||||
*/
|
||||
return $this->constructResult(NULL, 'Unauthorized: '.$this->helper->getErrorDescription());
|
||||
} else {
|
||||
return $this->constructResult(NULL, 'Bad request');
|
||||
}
|
||||
}
|
||||
// The OAuth 2.0 client handler helps us manage access tokens
|
||||
$oAuth2Client = $this->fb->getOAuth2Client();
|
||||
// Get the access token metadata from /debug_token
|
||||
///$tokenMetadata = $oAuth2Client->debugToken($accessToken);
|
||||
|
||||
if (! $accessToken->isLongLived()) {
|
||||
// Exchanges a short-lived access token for a long-lived one
|
||||
try {
|
||||
$accessToken = $oAuth2Client->getLongLivedAccessToken($accessToken);
|
||||
$this->set_expire_time($accessToken->getExpiresAt());
|
||||
$this->set_access_token($accessToken);
|
||||
$this->fb->setDefaultAccessToken($accessToken);
|
||||
} catch (Facebook\Exceptions\FacebookSDKException $e) {
|
||||
return $this->constructResult(NULL, "<p>Error getting long-lived access token: " . $this->helper->getMessage() . "</p>\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;
|
||||
}
|
||||
}
|
||||
@@ -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();
|
||||
|
||||
|
||||
@@ -0,0 +1,39 @@
|
||||
<?php
|
||||
|
||||
class Backend_model extends CI_Model {
|
||||
|
||||
var $thisUser = 'oameye';
|
||||
var $USER = '';
|
||||
var $jubabox;
|
||||
|
||||
function __construct() {
|
||||
|
||||
$this->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();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,147 @@
|
||||
<!DOCTYPE html>
|
||||
<html class="loading" lang="en" data-textdirection="ltr">
|
||||
<!-- BEGIN: Head-->
|
||||
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=0, minimal-ui">
|
||||
<meta name="description" content="JubabBox connects users with interest, connect your interest.">
|
||||
<meta name="keywords" content="social, news, my page, share">
|
||||
<meta name="author" content="Fluxtra">
|
||||
<title>JubaBox</title>
|
||||
<link rel="apple-touch-icon" href="/app-assets/images/ico/apple-icon-120.png">
|
||||
<link rel="shortcut icon" type="image/x-icon" href="/app-assets/images/ico/favicon.ico">
|
||||
<link href="https://fonts.googleapis.com/css?family=Montserrat:300,400,500,600" rel="stylesheet">
|
||||
|
||||
<!-- BEGIN: Vendor CSS-->
|
||||
<link rel="stylesheet" type="text/css" href="/app-assets/vendors/css/vendors.min.css">
|
||||
<!-- END: Vendor CSS-->
|
||||
|
||||
<!-- BEGIN: Theme CSS-->
|
||||
<link rel="stylesheet" type="text/css" href="/app-assets/css/bootstrap.css">
|
||||
<link rel="stylesheet" type="text/css" href="/app-assets/css/bootstrap-extended.css">
|
||||
<link rel="stylesheet" type="text/css" href="/app-assets/css/colors.css">
|
||||
<link rel="stylesheet" type="text/css" href="/app-assets/css/components.css">
|
||||
<link rel="stylesheet" type="text/css" href="/app-assets/css/themes/dark-layout.css">
|
||||
<link rel="stylesheet" type="text/css" href="/app-assets/css/themes/semi-dark-layout.css">
|
||||
|
||||
<!-- BEGIN: Page CSS-->
|
||||
<link rel="stylesheet" type="text/css" href="/app-assets/css/core/menu/menu-types/vertical-menu.css">
|
||||
<link rel="stylesheet" type="text/css" href="/app-assets/css/core/colors/palette-gradient.css">
|
||||
<link rel="stylesheet" type="text/css" href="/app-assets/css/pages/authentication.css">
|
||||
<!-- END: Page CSS-->
|
||||
|
||||
<!-- BEGIN: Custom CSS-->
|
||||
<link rel="stylesheet" type="text/css" href="/assets/css/style.css">
|
||||
<!-- END: Custom CSS-->
|
||||
|
||||
</head>
|
||||
<!-- END: Head-->
|
||||
|
||||
<!-- BEGIN: Body-->
|
||||
|
||||
<body class="vertical-layout vertical-menu-modern dark-layout 1-column navbar-floating footer-static bg-full-screen-image blank-page blank-page" data-open="click" data-menu="vertical-menu-modern" data-col="1-column" data-layout="dark-layout">
|
||||
<!-- BEGIN: Content-->
|
||||
<div class="app-content content">
|
||||
<div class="content-wrapper">
|
||||
<div class="content-header row">
|
||||
</div>
|
||||
<div class="content-body">
|
||||
<section class="row flexbox-container">
|
||||
<div class="col-xl-8 col-11 d-flex justify-content-center">
|
||||
<div class="card bg-authentication rounded-0 mb-0">
|
||||
<div class="row m-0">
|
||||
<div class="col-lg-6 d-lg-block d-none text-center align-self-center px-1 py-0">
|
||||
<img src="/app-assets/images/pages/login.png" alt="branding logo">
|
||||
</div>
|
||||
<div class="col-lg-6 col-12 p-0">
|
||||
<div class="card rounded-0 mb-0 px-2">
|
||||
<div class="card-header pb-1">
|
||||
<div class="card-title">
|
||||
<h4 class="mb-0">Login</h4>
|
||||
</div>
|
||||
</div>
|
||||
<p class="px-2">Welcome back, please login to your account.</p>
|
||||
<div class="card-content">
|
||||
<div class="card-body pt-1">
|
||||
<form action="/auth/login">
|
||||
<fieldset class="form-label-group form-group position-relative has-icon-left">
|
||||
<input type="text" class="form-control" id="user-name" placeholder="Username" required>
|
||||
<div class="form-control-position">
|
||||
<i class="feather icon-user"></i>
|
||||
</div>
|
||||
<label for="user-name">Username</label>
|
||||
</fieldset>
|
||||
|
||||
<fieldset class="form-label-group position-relative has-icon-left">
|
||||
<input type="password" class="form-control" id="user-password" placeholder="Password" required>
|
||||
<div class="form-control-position">
|
||||
<i class="feather icon-lock"></i>
|
||||
</div>
|
||||
<label for="user-password">Password</label>
|
||||
</fieldset>
|
||||
<div class="form-group d-flex justify-content-between align-items-center">
|
||||
<div class="text-left">
|
||||
<fieldset class="checkbox">
|
||||
<div class="vs-checkbox-con vs-checkbox-primary">
|
||||
<input type="checkbox">
|
||||
<span class="vs-checkbox">
|
||||
<span class="vs-checkbox--check">
|
||||
<i class="vs-icon feather icon-check"></i>
|
||||
</span>
|
||||
</span>
|
||||
<span class="">Remember me</span>
|
||||
</div>
|
||||
</fieldset>
|
||||
</div>
|
||||
<div class="text-right"><a href="/auth/forgotpass" class="card-link">Forgot Password?</a></div>
|
||||
</div>
|
||||
<a href="/auth" class="btn btn-outline-primary float-left btn-inline">Login</a>
|
||||
<button type="submit" class="btn btn-primary float-right">Login</button>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
<div class="login-footer">
|
||||
<div class="divider">
|
||||
<div class="divider-text">OR</div>
|
||||
</div>
|
||||
<div class="footer-btn d-inline">
|
||||
<a href="#" class="btn btn-facebook"><span class="fa fa-facebook"></span></a>
|
||||
<a href="#" class="btn btn-twitter white"><span class="fa fa-twitter"></span></a>
|
||||
<a href="#" class="btn btn-google"><span class="fa fa-google"></span></a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<!-- END: Content-->
|
||||
|
||||
|
||||
<!-- BEGIN: Vendor JS-->
|
||||
<script src="/app-assets/vendors/js/vendors.min.js"></script>
|
||||
<!-- BEGIN Vendor JS-->
|
||||
|
||||
<!-- BEGIN: Page Vendor JS-->
|
||||
<!-- END: Page Vendor JS-->
|
||||
|
||||
<!-- BEGIN: Theme JS-->
|
||||
<script src="/app-assets/js/core/app-menu.js"></script>
|
||||
<script src="/app-assets/js/core/app.js"></script>
|
||||
<script src="/app-assets/js/scripts/components.js"></script>
|
||||
<!-- END: Theme JS-->
|
||||
|
||||
<!-- BEGIN: Page JS-->
|
||||
<!-- END: Page JS-->
|
||||
|
||||
</body>
|
||||
<!-- END: Body-->
|
||||
|
||||
</html>
|
||||
@@ -65,9 +65,9 @@
|
||||
<p class="px-2">Welcome back, please login to your account.</p>
|
||||
<div class="card-content">
|
||||
<div class="card-body pt-1">
|
||||
<form action="/auth/login">
|
||||
<form action="/auth/login" method="POST">
|
||||
<fieldset class="form-label-group form-group position-relative has-icon-left">
|
||||
<input type="text" class="form-control" id="user-name" placeholder="Username" required>
|
||||
<input type="text" class="form-control" id="user-name" placeholder="Username" name="username" required>
|
||||
<div class="form-control-position">
|
||||
<i class="feather icon-user"></i>
|
||||
</div>
|
||||
@@ -75,7 +75,7 @@
|
||||
</fieldset>
|
||||
|
||||
<fieldset class="form-label-group position-relative has-icon-left">
|
||||
<input type="password" class="form-control" id="user-password" placeholder="Password" required>
|
||||
<input type="password" name="password" class="form-control" id="user-password" placeholder="Password" required>
|
||||
<div class="form-control-position">
|
||||
<i class="feather icon-lock"></i>
|
||||
</div>
|
||||
@@ -99,6 +99,7 @@
|
||||
</div>
|
||||
<a href="/auth/register" class="btn btn-outline-primary float-left btn-inline">Register</a>
|
||||
<button type="submit" class="btn btn-primary float-right btn-inline">Login</button>
|
||||
<?=isset($error_message)?$error_message : ''?>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -0,0 +1,11 @@
|
||||
<?
|
||||
if (!array_key_exists('jubabox', $GLOBALS)) {
|
||||
$USER = $_SERVER['SCRIPT_FILENAME'];
|
||||
$USER = str_replace('/home', '', $USER);
|
||||
$USER = strtok($USER, '/');
|
||||
if ($USER=='opt') $USER = 'root';
|
||||
// Load API class
|
||||
$jubabox_class = 'jubabox_api_' . $USER . '\\jubabox';
|
||||
$jubabox = new $jubabox_class();
|
||||
}
|
||||
?>
|
||||
Reference in New Issue
Block a user