Esempio n. 1
0
 static function set($controller, $action, $params = false)
 {
     if (!$params) {
         $params = array();
     }
     if (isset(SCRoutes::$routeTable[$controller]) && isset(SCRoutes::$routeTable[$controller][$action]) && isset(SCRoutes::$routeTable[$controller][$action]["route"])) {
         $route = SCRoutes::$routeTable[$controller][$action]["route"];
         $route_parts = explode("/", $route);
         for ($i = 0; $i < sizeof($route_parts); $i++) {
             if (strpos($route_parts[$i], ":") === 0) {
                 $key = ltrim($route_parts[$i], ":");
                 $route_parts[$i] = $params[$key];
                 unset($params[$key]);
             }
         }
         $url = implode("/", $route_parts);
         if (sizeof($params)) {
             $url .= "?" . http_build_query($params);
         }
         return str_replace("//", "/", SC::root() . $url);
     } else {
         return SC::root();
     }
 }
 public function destroy()
 {
     if (SC::getCookie("sc_auth")) {
         $expire = time() - 3600;
         setcookie("sc_auth", "", $expire, SC::root());
     }
     unset($_SESSION["sc_user"]);
     return true;
 }
Esempio n. 3
0
<div id="header">
	<a href="<?php 
echo SC::root();
?>
" id="header_home">Switchcomb</a>
  <?php 
if ($current_user) {
    ?>
    <div id="loggedin" class="clearfix">
        <div id="auth_container">
          <span id="loggedinuser"><?php 
    echo $current_user->displayname;
    ?>
</span>
          <a href="<?php 
    echo SCRoutes::set("usersessions", "delete");
    ?>
">Logout</a>
        </div>
      <ul id="links" class="clearfix">
        <li><a href="<?php 
    echo SCRoutes::set("users", "memberships_index", array("userid" => $current_user->userid));
    ?>
" class="header_link logged_in" id="header_boards">My Boards</a></li>
        <li><a href="<?php 
    echo SCRoutes::set("boards", "_new");
    ?>
" class="header_link logged_in" id="header_create">Create a Board</a></li>
        <li><a href="<?php 
    echo SCRoutes::set("boards", "unjoined");
Esempio n. 4
0
 static function jsPath($js)
 {
     return SC::root() . "js/{$js}.js";
 }