aboutsummaryrefslogtreecommitdiff
path: root/www
diff options
context:
space:
mode:
authorChristian Weiske <cweiske@cweiske.de>2012-03-28 16:59:54 +0200
committerChristian Weiske <cweiske@cweiske.de>2012-03-28 16:59:54 +0200
commitec66a5c7d17cb1e67ee066f2e9bdaf5bbc9ab614 (patch)
tree23506c7e35ff3a646837e638494f6e023ec706c3 /www
parent3f18e7e8ce995bb209f8409cd8d00d8267dfa04f (diff)
downloadphorkie-ec66a5c7d17cb1e67ee066f2e9bdaf5bbc9ab614.tar.gz
phorkie-ec66a5c7d17cb1e67ee066f2e9bdaf5bbc9ab614.zip
preparation for file editing
Diffstat (limited to 'www')
-rw-r--r--www/.htaccess4
-rw-r--r--www/edit.php17
-rw-r--r--www/index.php12
3 files changed, 24 insertions, 9 deletions
diff --git a/www/.htaccess b/www/.htaccess
index d053ca7..c5353dd 100644
--- a/www/.htaccess
+++ b/www/.htaccess
@@ -3,7 +3,9 @@ RewriteBase /
#RewriteCond %{REQUEST_FILENAME} -f
RewriteRule ^([0-9]+)$ /display.php?id=$1
-RewriteRule ^([0-9]+)/raw/(.+)$ /raw.php?id=$1&file=$2
+RewriteRule ^([0-9]+)/edit$ /edit.php?id=$1
RewriteRule ^([0-9]+)/fork$ /fork.php?id=$1
+RewriteRule ^([0-9]+)/raw/(.+)$ /raw.php?id=$1&file=$2
+
RewriteRule ^list$ /list.php
RewriteRule ^list/([0-9])+$ /list.php?page=$1
diff --git a/www/edit.php b/www/edit.php
new file mode 100644
index 0000000..d86df41
--- /dev/null
+++ b/www/edit.php
@@ -0,0 +1,17 @@
+<?php
+namespace Phorkie;
+/**
+ * Edit paste contents
+ */
+require_once 'www-header.php';
+
+$repo = new Repository();
+$repo->loadFromRequest();
+
+render(
+ 'edit',
+ array(
+ 'repo' => $repo,
+ )
+);
+?>
diff --git a/www/index.php b/www/index.php
index 044ac35..f821c84 100644
--- a/www/index.php
+++ b/www/index.php
@@ -12,7 +12,7 @@ namespace Phorkie;
*/
require_once 'www-header.php';
-if (isset($_POST['file'])) {
+if (isset($_POST['files'])) {
//save
$rs = new Repositories();
$repo = $rs->createNew();
@@ -23,7 +23,7 @@ if (isset($_POST['file'])) {
}
file_put_contents($repo->repoDir . '.git/description', $_POST['description']);
- foreach ($_POST['file'] as $num => $arFile) {
+ foreach ($_POST['files'] as $num => $arFile) {
if ($arFile['name'] != '') {
$fname = $arFile['name'];
} else {
@@ -45,11 +45,7 @@ if (isset($_POST['file'])) {
}
$phork = array(
- '1' => array(
- 'filename' => '',
- 'content' => '',
- 'type' => ''
- )
+ '1' => new File(null, null)
);
-render('index', array('file' => $phork, 'description' => ''));
+render('index', array('files' => $phork, 'description' => ''));
?> \ No newline at end of file