Created
July 14, 2011 15:08
-
-
Save sofadesign/1082633 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 | |
function before($route) | |
{ | |
$uri = request_uri(); | |
$is_admin = preg_match('%^/admin(/.+)?$%', $uri); | |
# Authentication if required | |
$auth_required = $is_admin && $uri != "/admin/login" && $uri != "/admin/logout"; | |
if($auth_required) authentication_is_required(); | |
# other ui options | |
if($is_admin) | |
{ | |
# Set view dir | |
option('views_dir', option('root_dir').'/views/admin/'); | |
# execute more things if necessary | |
before_admin(); | |
} | |
else | |
{ | |
# something else if you want | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment