function index() { $root = get_app_root(); $view = instance_view('admin/index'); $content = $view -> parse_to_variable(array( )); $this->set_template_paramiters(array( 'path' => $root, 'content' => $content )); }
function make_params() { $remove_path = get_app_root(); $request_url = strtolower($_SERVER["REQUEST_URI"]); // Discard the trailing forward slash if there is one if($request_url[strlen($request_url) - 1] == "/") $request_url = substr($request_url, 0, strlen($request_url) - 1); // remove any leading directory names $remove_path = str_replace("/", "\\/", $remove_path); $request_url = preg_replace("/$remove_path/", "", $request_url, 1); $params = explode('/', $request_url); // descard empty first element array_shift($params); return $params; }
function note() { $path = get_app_root(); $params = $this->params; $note_db = instance_model('notes'); if(!isset($params[2])) { $note_id = $note_db->allocate_note(); redirect_to(make_url('kindlenote', 'note', $note_id)); } $note_id = $params[2]; $note = $note_db->get_note($note_id); $view = instance_view('note_edit'); $view->parse(array( 'path' => $path, 'note_id' => $note_id, 'note' => $note )); }
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> <title>text</title> <script type="text/javascript" src="<?php echo get_app_root(); ?>/src/libs/jquery.js"></script> <script type="text/javascript" src="<?php echo get_app_root(); ?>/app/script.js"></script> <link rel="stylesheet" type="text/css" href="<?php echo get_app_root(); ?>/theme/main.css" /> </head> <body> <div id="container"> <div id="options"> <ul> <?php if(isset($_SESSION['active_user'])): ?> <li><a href="<?php echo make_url('messages'); ?>">Home</a></li> <li><a href="<?php echo make_url('users', 'profile', esc($_SESSION['active_user']['name'])); ?>">Profile</a></li> <li><a href="<?php echo make_url('settings'); ?>">Settings</a></li> <li><a href="<?php echo make_url('users'); ?>">Users</a></li> <li><a href="<?php echo make_url('users', 'logout'); ?>">Sign out</a></li> <?php else: ?> <li><a href="<?php echo make_url('users'); ?>">Users</a></li> <li><a href="<?php echo make_url('users', 'login'); ?>">Sign in</a></li> <?php if(ALLOW_REGISTRATION == true): ?> <li><a href="<?php echo make_url('users', 'register'); ?>">Register</a></li> <?php endif; ?>
function make_ext_url() { $prot = 'http'; if (isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] == 'on') $prot .= 's'; $prot .= "://"; if ($_SERVER['SERVER_PORT'] != '80') $prot .= $_SERVER["SERVER_NAME"]. ':' .$_SERVER["SERVER_PORT"]; else $prot .= $_SERVER["SERVER_NAME"]; $root = get_app_root(); $root = $prot . $root; if(func_num_args() > 0) { for($i = 0; $i < func_num_args(); $i ++) { $root .= '/' . func_get_arg($i); } } return $root; }
function make_ext_url_s() { $prot = 'https'; $prot .= "://"; /* if ($_SERVER['SERVER_PORT'] != '80') $prot .= $_SERVER["SERVER_NAME"]. ':' .$_SERVER["SERVER_PORT"]; else */ $prot .= $_SERVER["SERVER_NAME"]; $root = get_app_root(); $root = $prot . $root; if(func_num_args() > 0) { for($i = 0; $i < func_num_args(); $i ++) { $root .= '/' . func_get_arg($i); } } return $root; }