Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Basic controller logic

  • Loading branch information...
commit 1054438aff695b23d39c3d333abfa40e4bec6dd7 1 parent f1455ff
@jenssegers jenssegers authored
View
8 .htaccess
@@ -159,15 +159,11 @@ AddType text/vtt vtt
# Turning on the rewrite engine is necessary for the following rules and features.
# FollowSymLinks must be enabled for this to work.
-<IfModule mod_rewrite.c>
- Options +FollowSymlinks
- RewriteEngine On
-# RewriteBase /
-</IfModule>
<IfModule mod_rewrite.c>
+ Options +FollowSymlinks
RewriteEngine On
- RewriteBase /
+ #RewriteBase /
#Removes access to the system folder by users.
#Additionally this will allow you to create a System.php controller,
View
2  application/config/autoload.php
@@ -64,7 +64,7 @@
| $autoload['helper'] = array('url', 'file');
*/
-$autoload['helper'] = array();
+$autoload['helper'] = array('url');
/*
View
54 application/controllers/oauth2.php
@@ -1,13 +1,49 @@
<?php
class oauth2 extends CI_Controller {
-
- function authenticate() {
-
- }
-
- function access_token() {
-
- }
-
+
+ function index() {
+ echo 'hello world';
+ }
+
+ function authorize() {
+ /* pre-checks:
+ * - user logged in yet?
+ * - token for this user?
+ * - ...
+ */
+
+ // identify client
+ $client_id = $this->input->get('client_id');
+ $response_type = $this->input->get('response_type');
+ $callback = $this->input->get('redirect_uri');
+ $state = $this->input->get('state');
+
+ // allow button clicked
+ if ($this->input->post('allows')) {
+ // generate code
+ $code = md5(time() . uniqid());
+
+ // save code to database
+
+ // generate callback url
+ $callback = $callback . '?' . http_build_query(array('code' => $code, 'state' => $state));
+
+ // redirect back to user website
+ redirect($callback);
+ } else {
+ // show access screen
+ $this->load->view('authenticate', $data);
+ }
+ }
+
+ function access_token() {
+ /* pre-checks:
+ * -
+ * - ...
+ */
+
+ $grant_type = $this->input->get('grant_type');
+ }
+
}
View
15 application/views/authenticate.php
@@ -0,0 +1,15 @@
+<?php include('header.tpl'); ?>
+
+<div class="container">
+
+ <div class="hero-unit">
+ <h1><?php echo $client; ?> requests access</h1>
+ <p>Connecting this app will allow it to do certain things like create new check-ins on your behalf and access personal information such as your profile information, check-in history, friends list, tips and to-dos.</p>
+ <p><a href="<?php echo $callback; ?>" class="btn btn-primary btn-large">Allow</a></p>
+ </div>
+
+</div>
+
+<?php
+include ('footer.tpl');
+?>
View
2  application/views/footer.tpl
@@ -0,0 +1,2 @@
+</body>
+</html>
View
29 application/views/header.tpl
@@ -0,0 +1,29 @@
+<!DOCTYPE html>
+<html>
+<head>
+ <meta charset="utf-8">
+
+ <title></title>
+
+ <meta name="description" content="">
+ <meta name="viewport" content="width=device-width">
+
+ <link rel="stylesheet" href="<?php echo base_url('css/bootstrap.css'); ?>">
+ <link rel="stylesheet" href="<?php echo base_url('css/style.css'); ?>">
+
+</head>
+<body>
+
+<div class="navbar navbar-fixed-top">
+ <div class="navbar-inner">
+ <div class="container">
+
+ <a class="brand" href="#">Solomidem</a>
+
+ <div class="pull-right">
+ <button class="btn btn-small" onclick="history.go(-1)">back</button>
+ </div>
+
+ </div>
+ </div>
+</div>
View
4,263 css/bootstrap.css
4,263 additions, 0 deletions not shown
View
4 css/style.css
@@ -0,0 +1,4 @@
+body {
+ padding-bottom: 40px;
+ padding-top: 60px;
+}
View
BIN  fonts/PTS55F_W.woff
Binary file not shown
View
BIN  fonts/PTS56F_W.woff
Binary file not shown
View
BIN  fonts/PTS75F_W.woff
Binary file not shown
View
BIN  fonts/PTS76F.woff
Binary file not shown
View
BIN  img/glyphicons-halflings-white.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
BIN  img/glyphicons-halflings.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
BIN  img/logo_white.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Please sign in to comment.
Something went wrong with that request. Please try again.