private static function initWebRenderer($options) { $renderer = new WebRenderer($options); $renderer->provide('pageURL', function ($path, $params = array()) { return Page::getURL($path, $params)->build(); }); $renderer->provide('theUser', Authorization::user()); $renderer->provide('theNonce', Authorization::getNonce()); return $renderer; }
<h4 class="modal-title">Delete link</h4> </div> <div class="modal-body"> <p>Do you really want to delete this link?</p> <p><code><?php echo $r->escapeHtml($l->path); ?> </code> redirecting to <code><?php echo $r->escapeHtml($l->target); ?> </code></p> </div> <div class="modal-footer"> <button type="button" class="btn btn-default" data-dismiss="modal">Cancel</button> <a href="<?php $params = array('link' => $l->id, 'delete' => true, 'nonce' => \tniessen\tinyIt\Security\Authorization::getNonce()); $url = $pageURL('links/details', $params); echo $r->escapeAttr($url); ?> " class="btn btn-danger">Delete</a> </div> </div> </div> </div> <?php } else { ?> <div class="page-header"> <h1>Link details</h1> </div> <div class="alert alert-danger">
<li><a href="<?php echo $r->escapeAttr($pageURL('settings/own/account')); ?> ">Account settings</a></li> <li class="divider"></li> <?php if ($ru = \tniessen\tinyIt\Security\Authorization::realUser()) { ?> <li><a href="<?php $url = $pageURL('switch-user', array('revert' => true, 'nonce' => $theNonce)); echo $r->escapeAttr($url); ?> ">Switch back to <?php echo $r->escapeHtml($ru->display_name); ?> </a></li> <?php } ?> <li><a href="<?php $nonce = \tniessen\tinyIt\Security\Authorization::getNonce(); $url = $pageURL('logout', array('nonce' => $nonce)); echo $r->escapeAttr($url); ?> ">Logout</a></li> </ul> </li> </ul> </div><!-- .navbar-collapse --> </div><!-- .container-fluid --> </div><!-- .navbar -->
if ($theUser->id === $u->id) { ?> <a href="<?php echo $r->escapeAttr($pageURL('settings/own/account')); ?> " class="btn btn-default"> <span class="glyphicon glyphicon-pencil"></span> Edit </a> <?php } ?> <?php if ($r->opt('canSwitchUser')) { ?> <a href="<?php $params = array('user' => $u->id, 'nonce' => \tniessen\tinyIt\Security\Authorization::getNonce()); $url = $pageURL('switch-user', $params); echo $r->escapeAttr($url); ?> " class="btn btn-default"> <span class="glyphicon glyphicon-arrow-right"></span> Switch </a> <?php } ?> <?php if ($page::hasPermission('user.set_group')) { ?> <button type="button" class="btn btn-default" data-toggle="modal" data-target=".select-group-modal"> Set group </button>