Search for term, with optional page
``/list(/[0-9])?``
List all pastes, with optional page
+``/fork-remote``
+ Fork a remote URL
+``/help``
+ Show help page
``/new``
Shows form for new paste
``/login``
rewrite ^/([0-9]+)/rev-raw/(.+)$ /raw.php?id=$1&rev=$2&file=$3;
rewrite ^/([0-9]+)/tool/([^/]+)/(.+)$ /tool.php?id=$1&tool=$2&file=$3;
+ rewrite ^/fork-remote$ /fork-remote.php;
+ rewrite ^/help$ /help.php;
rewrite ^/new$ /new.php;
rewrite ^/feed/new$ /feed-new.php;
rewrite ^/feed/updated$ /feed-updated.php;
</div>
<div class="span2 pull-right">
<form method="post" action="{{repo.getLink('fork')}}">
- <button type="submit" class="btn pull-right"><i class="icon-share"></i> fork</button>
+ <div class="btn-group pull-right">
+ <button type="submit" class="btn"><i class="icon-share"></i> fork</button>
+ <button class="btn dropdown-toggle" data-toggle="dropdown">
+ <span class="caret"></span>
+ </button>
+ <ul class="dropdown-menu">
+ <li><a href="{{repo.getLink('remotefork')}}"><i class="icon-share"></i> Fork to remote system</a></li>
+ <li class="divider"></li>
+ <li><a href="help#remote-forking"><i class="icon-question-sign"></i> Help on remote forking</a></li>
+ </ul>
+ </div>
</form>
</div>
</div>
--- /dev/null
+{% extends "base.htm" %}
+{% block title %}phorkie help{% endblock %}
+
+{% block content %}
+<h1>Help on phorkie</h1>
+
+<h2 id="remote-forking">Remote forking</h2>
+<script type="text/javascript">
+function registerHandler() {
+ navigator.registerProtocolHandler(
+ "web+fork",
+ "{{htmlhelper.fullUrl('fork-remote?remote_url=%s')}}",
+ "phorkie@"
+ + "{{htmlhelper.fullUrl()}}"
+ .replace(/https?:\/\//, '')
+ .replace(/\/$/, '')
+ );
+}
+</script>
+
+<div class="row-fluid">
+ <div class="span8">
+ <p>
+ Phorkie allows cloning/forking of pastes on other servers
+ - other phorkie instances, github gists or simply any remote
+ git repository.
+ </p>
+ <p>
+ You can go to <a href="fork-remote">fork-remote</a> and enter the
+ URL of the paste on the other server.
+ </p>
+ <p>
+ It's way easier to simply click a "fork" button that automatically
+ takes you to this phorkie's remote paste page, prefilled with
+ the correct git URL.
+ </p>
+ <p>
+ To make this work, click the register button on the right.
+ It will register a "protocol handler" for "web+fork:"-URLs,
+ making phorkie chime in whenever a <tt>web+fork</tt> URL is clicked.
+ </p>
+ </div>
+ <div class="span4">
+ <a href="#" onclick="registerHandler(); return false;" class="btn">
+ register web+fork protocol handler
+ </a>
+ </div>
+</div>
+{% endblock %}
}
return $html;
}
+
+ public function fullUrl($path = '')
+ {
+ return Tools::fullUrl($path);
+ }
}
?>
$link = $this->id . '/delete';
} else if ($type == 'delete-confirm') {
$link = $this->id . '/delete/confirm';
+ } else if ($type == 'remotefork') {
+ return 'web+fork:' . $this->getLink('display', null, true);
} else if ($type == 'revision') {
$link = $this->id . '/rev/' . $option;
} else if ($type == 'linkback') {
RewriteRule ^([0-9]+)/tool/([^/]+)/(.+)$ tool.php?id=$1&tool=$2&file=$3
RewriteRule ^fork-remote$ fork-remote.php
+RewriteRule ^help$ help.php
RewriteRule ^new$ new.php
RewriteRule ^feed/new$ feed-new.php
$error = null;
$urls = null;
-if (isset($_POST['remote_url'])) {
- $fr = new ForkRemote($_POST['remote_url']);
+if (isset($_REQUEST['remote_url'])) {
+ if (substr($_REQUEST['remote_url'], 0, 9) == 'web+fork:') {
+ $_REQUEST['remote_url'] = substr($_REQUEST['remote_url'], 9);
+ }
+
+ $fr = new ForkRemote($_REQUEST['remote_url']);
if (false === $fr->parse()) {
//no url found
$error = $fr->error;
render(
'fork-remote',
array(
- 'remote_url' => isset($_POST['remote_url']) ? $_POST['remote_url'] : '',
+ 'remote_url' => isset($_REQUEST['remote_url']) ? $_REQUEST['remote_url'] : '',
'error' => $error,
'urls' => $urls,
'urlselsize' => $selsize,
--- /dev/null
+<?php
+namespace phorkie;
+/**
+ * Show help
+ */
+$reqWritePermissions = false;
+require_once 'www-header.php';
+
+render(
+ 'help',
+ array(
+ 'htmlhelper' => new HtmlHelper(),
+ )
+);
+?>