Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

Configurable index page #6

Merged
merged 1 commit into from

2 participants

@jnovack

crosses fingers I hope I got it right this time!

@cweiske cweiske merged commit 0c2d838 into from
@cweiske
Owner

All was fine now.

@cweiske cweiske referenced this pull request from a commit
@cweiske Part of #6: atom feed for new pastes 200ad8c
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Sep 14, 2012
  1. @jnovack

    Configurable index page

    jnovack authored
This page is out of date. Refresh to see the latest.
View
6 README.rst
@@ -169,7 +169,7 @@ URLs
====
``/``
- Index page. Shows form for new paste
+ Index page.
``/[0-9]+``
Display page for paste
``/[0-9]/edit``
@@ -188,7 +188,8 @@ URLs
Search for term, with optional page
``/list(/[0-9])?``
List all pastes, with optional page
-
+``/new``
+ Shows form for new paste
Internal directory layout
=========================
@@ -220,6 +221,7 @@ If you use nginx, place the following lines into your ``server`` block:
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 ^/new$ /new.php;
rewrite ^/list$ /list.php;
rewrite ^/list/([0-9]+)$ /list.php?page=$1;
View
3  data/config.default.php
@@ -9,7 +9,8 @@
'topbar' => '',
'setupcheck' => true,
'elasticsearch' => null,
- 'geshi' => 'MediaWiki/geshi/geshi/geshi.php'
+ 'geshi' => 'MediaWiki/geshi/geshi/geshi.php',
+ 'index' => 'new'
);
$GLOBALS['phorkie']['tools'] = array(
'\\phorkie\\Tool_Xmllint' => true,
View
2  data/templates/base.htm
@@ -20,7 +20,7 @@
</a>
<ul class="nav">
<li>
- <a href="/">New paste</a>
+ <a href="/new">New paste</a>
</li>
<li>
<a href="/list">List all</a>
View
2  data/templates/index.htm → data/templates/new.htm
@@ -2,7 +2,7 @@
{% block title %}New paste{% endblock %}
{% block content %}
-<form method="post" action="/" enctype="multipart/form-data">
+<form method="post" action="/new" enctype="multipart/form-data">
<div class="control-group well pastedata">
<label for="description">Description</label>
<input type="text" name="description" id="description" value="{{description}}"/>
View
2  www/.htaccess
@@ -12,6 +12,8 @@ RewriteRule ^([0-9]+)/rev/(.+)$ /revision.php?id=$1&rev=$2
RewriteRule ^([0-9]+)/rev-raw/(.+)/(.+)$ /raw.php?id=$1&rev=$2&file=$3
RewriteRule ^([0-9]+)/tool/([^/]+)/(.+)$ /tool.php?id=$1&tool=$2&file=$3
+RewriteRule ^new$ /new.php
+
RewriteRule ^list$ /list.php
RewriteRule ^list/([0-9]+)$ /list.php?page=$1
View
31 www/index.php
@@ -1,34 +1,5 @@
<?php
namespace phorkie;
-/**
- * Show paste creation form
- *
- * Elements:
- * - description
- * - file name (default: default.php)
- * - content
- *
- * Creates and redirects to display page
- */
require_once 'www-header.php';
-
-$repopo = new Repository_Post();
-if ($repopo->process($_POST)) {
- redirect($repopo->repo->getLink('display'));
-}
-
-$phork = array(
- '1' => new File(null, null)
-);
-$db = new Database();
-render(
- 'index',
- array(
- 'files' => $phork,
- 'description' => '',
- 'htmlhelper' => new HtmlHelper(),
- 'recents' => $db->getSearch()->listAll(0, 5, 'crdate', 'desc'),
- 'dh' => new \Date_HumanDiff(),
- )
-);
+require_once $GLOBALS['phorkie']['cfg']['index'].".php";
?>
View
34 www/new.php
@@ -0,0 +1,34 @@
+<?php
+namespace phorkie;
+/**
+ * Show paste creation form
+ *
+ * Elements:
+ * - description
+ * - file name (default: default.php)
+ * - content
+ *
+ * Creates and redirects to display page
+ */
+require_once 'www-header.php';
+
+$repopo = new Repository_Post();
+if ($repopo->process($_POST)) {
+ redirect($repopo->repo->getLink('display'));
+}
+
+$phork = array(
+ '1' => new File(null, null)
+);
+$db = new Database();
+render(
+ 'new',
+ array(
+ 'files' => $phork,
+ 'description' => '',
+ 'htmlhelper' => new HtmlHelper(),
+ 'recents' => $db->getSearch()->listAll(0, 5, 'crdate', 'desc'),
+ 'dh' => new \Date_HumanDiff(),
+ )
+);
+?>
Something went wrong with that request. Please try again.