public function main()
 {
     $key = Lib::hash(Config::$adminkey);
     $cookie = Lib::cookie();
     $identifier = $cookie->get($key);
     $admin = Lib::table('admin');
     $logged = !empty($identifier) && $admin->load(array('identifier' => $identifier));
     $type = Req::get('type');
     $ref = Req::get('ref');
     if (!empty($ref)) {
         if ($logged) {
             $segments = explode('/', base64_decode($ref));
             $base = array_shift($segments);
             $type = array_shift($segments);
             $subtype = array_shift($segments);
             $options = array();
             if (!empty($type)) {
                 $options['type'] = $type;
             }
             if (!empty($subtype)) {
                 $options['subtype'] = $subtype;
             }
             Lib::redirect($base, $options);
             return;
         }
         return $this->form();
     }
     if (!$logged) {
         if (empty($type)) {
             return $this->form();
         }
         $options = array('view' => 'admin');
         if (!empty($type)) {
             $options['type'] = $type;
         }
         $subtype = Req::get('subtype');
         if (!empty($subtype)) {
             $options['subtype'] = $subtype;
         }
         $ref = Lib::url('admin', $options);
         return Lib::redirect('admin', array('view' => 'admin', 'ref' => base64_encode($ref)));
     }
     if (empty($type)) {
         $type = 'index';
     }
     if (!is_callable(array($this, $type))) {
         return Lib::redirect('error');
     }
     return $this->{$type}();
 }
Exemple #2
0
foreach (Lib::view('page')->getPages() as $pageslug => $page) {
    ?>
		<li class="menu-item"><a class="menu-item-link <?php 
    if ($viewname === 'page' && $pageslug === $slug) {
        ?>
active<?php 
    }
    ?>
" href="<?php 
    echo Lib::url('page', array('slug' => $pageslug));
    ?>
"><?php 
    echo $page->title;
    ?>
</a></li>
		<?php 
}
?>
		<li class="menu-item menu-item-about"><a class="menu-item-link <?php 
if ($viewname === 'about') {
    ?>
active<?php 
}
?>
" href="<?php 
echo Lib::url('about');
?>
">About</a></li>
	</ul>
</div>
Exemple #3
0
<?php

!defined('SERVER_EXEC') && die('No access.');
?>
<div id="<?php 
echo $pageslug;
?>
" class="post">
	<div class="container">
		<h3><a href="<?php 
echo Lib::url('page', array('slug' => $pageslug));
?>
"><?php 
echo $post->date;
?>
</a></h3>
		<h2><a href="<?php 
echo Lib::url('page', array('slug' => $pageslug));
?>
"><?php 
echo $post->title;
?>
</a></h2>
		<div class="content">
			<?php 
echo $pageview->loadTemplate($pageslug . '/content');
?>
		</div>
	</div>
</div>
Exemple #4
0
 public static function redirect($target, $options = array(), $absolute = false)
 {
     $url = $absolute ? $target : Lib::url($target, $options, true);
     header('Location: ' . $url);
     die;
 }
<?php

!defined('SERVER_EXEC') && die('No access.');
?>
<div class="section section-login-form">
	<form class="login-form" role="form" method="post" action="<?php 
echo Lib::url('admin', array('type' => 'system', 'subtype' => 'login'));
?>
">
		<h2>Admin</h2>
		<div class="form-group">
			<label class="form-label" for="username">Username</label>
			<input class="form-input" type="text" name="username" />
		</div>

		<div class="form-group">
			<label class="form-label" for="username">Password</label>
			<input class="form-input" type="password" name="password" />
		</div>

		<input type="hidden" name="ref" value="<?php 
echo $ref;
?>
" />

		<div class="form-actions">
			<button class="form-button" type="submit">Login</button>
		</div>
	</form>
</div>
 public function getLink()
 {
     return Lib::url('report', array('view' => 'report', 'id' => $this->id), true);
 }
<?php

!defined('SERVER_EXEC') && die('No access.');
?>
<div class="page">
	<div class="section-login-form">
		<form class="login-form" role="form" method="post" action="<?php 
echo Lib::url('admin', array('view' => 'admin', 'type' => 'system', 'subtype' => 'create'));
?>
">
			<?php 
if (isset($errorMessage)) {
    ?>
			<div class="alert alert-danger">There was an error.</div>
			<?php 
}
?>

			<div class="alert alert-warning">There are no admins created yet.<br />Create one now.</div>

			<div class="form-group">
				<label class="form-label" for="username">Username</label>
				<input class="form-input" type="text" name="username" />
			</div>

			<div class="form-group">
				<label class="form-label" for="username">Password</label>
				<input class="form-input" type="password" name="password" />
			</div>

			<input type="hidden" name="ref" value="<?php 
<?php

!defined('SERVER_EXEC') && die('No access.');
if ($isLoggedIn) {
    ?>
<div id="report-frame">
	<a class="report-item-back icon-feather-rewind" href="<?php 
    echo Lib::url('index');
    ?>
">Back</a>
	<div class="report-project">
		<div class="project-name-title">Project</div>
		<div class="project-name"><?php 
    echo $project->name;
    ?>
</div>
	</div>
	<ul id="report-item-list">
		<?php 
    echo Lib::output('embed/report-item', array('report' => $report, 'user' => $user, 'assignees' => $assignees, 'commentsLoaded' => true));
    ?>
	</ul>
</div>
<?php 
    echo Lib::output('embed/screenshot-preview');
} else {
    echo Lib::output('embed/before-login');
}
?>

<script type="text/html" id="report-item-assignee">
<?php

!defined('SERVER_EXEC') && die('No access.');
?>
<div class="new-project">
	<form class="new-project-content" method="post" action="<?php 
echo Lib::url('controller', array('controller' => 'project', 'action' => 'saveProjectTitle'));
?>
">
		<h1>Hi there.</h1>
		<p>Let's name this project:</p>

		<div class="form-group">
			<input type="text" class="form-input" name="project-title" placeholder="Project Name" />
		</div>

		<div class="form-actions">
			<button class="icon-feather-check">OK</button>
		</div>

		<input type="hidden" name="project-name" value="<?php 
echo $name;
?>
" />
	</form>
</div>