Created
November 30, 2010 16:23
-
-
Save lukemorton/721913 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
require_once('srv.php'); | |
/** | |
* Set root URL | |
*/ | |
Srv::config(array('root' => '/myfreeola-control-panel/e-mail/')); | |
/** | |
* GET /myfreeola-control-panel/e-mail/ | |
*/ | |
Srv::root(function () | |
{ | |
require('index.php'); | |
}); | |
/** | |
* GET /myfreeola-control-panel/e-mail/[email protected] | |
* GET /myfreeola-control-panel/e-mail/[email protected]/security | |
* POST /myfreeola-control-panel/e-mail/[email protected] | |
* POST /myfreeola-control-panel/e-mail/[email protected]/security | |
*/ | |
Srv::route(':email(/:action)', array('email' => 'emailregex', 'action' => '(security|forwarding|protocol)')) | |
->methods(array('GET', 'POST')) | |
->response(function ($req) | |
{ | |
// Set e-mail object | |
$email = MyFreeola::instance()->email($req->param('email')); | |
// Action | |
$action = $req->param('action'); | |
// Manage or process | |
if ($req->method() === 'POST') | |
{ | |
$file = 'process'; | |
} | |
else | |
{ | |
$file = 'manage'; | |
} | |
// If action set, load it's own manage|process page | |
if ($action !== NULL) | |
{ | |
require($action.'/'.$file.'.php'); | |
} | |
// Default include manage|process page | |
else | |
{ | |
require($file.'.php'); | |
} | |
}); | |
// Serve it | |
Srv::serve(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment