+++ /dev/null
-{"tags":{"photo":2,"water":1,"writing":1,"quote":2,"india":1}}
\ No newline at end of file
+++ /dev/null
-{"tags":{"prism":1,"painting":2,"mask":1}}
\ No newline at end of file
+++ /dev/null
-{"tags":{"photo":2,"water":1,"writing":1,"quote":2,"india":1,"prism":1,"painting":2,"mask":1}}
\ No newline at end of file
$request = get_request();
-$m = new Model ($request);
+$m = new Model($request);
$v = new View();
+[development]
+dev = true
+
[settings]
; general settings
site_title = plog
file_ignores[] = .DS_Store
-[development]
-dev = true
; define ('SITE_TITLE', 'quilime');
$tags = array_count_values($tags);
-
if ($create_datafile) {
if (!is_dir($data_path)) {
if (!mkdir($data_path, 0777, true)) {
if (!file_exists( $data_file )) {
throw new Exception('Error creating tags json in get_tags(). Permissions?');
}
- }
-
-
- // $fp = fopen( $data_file, 'w');
- // fwrite($fp, json_encode(array( 'tags' => $tags )));
- // fclose($fp);
- // if (!file_exists( $data_file)) {
- // throw new Exception('Error creating tags.json. Permissions?');
- // }
+ }
}
-
+
$json = json_decode(file_get_contents($data_file));
return (array) $json->tags;
}
--- /dev/null
+<?php
+
+if (!DEV)
+ break;
+
+array_shift($dirs);
+$newurl = implode($dirs, '/');
+$content_req = LOCAL_ROOT . CONTENT_DIR . DIRECTORY_SEPARATOR . $newurl;
+$page_req = LOCAL_ROOT . PAGE_DIR . DIRECTORY_SEPARATOR . $newurl;
+
+// TODO: Sercurity risk?
+if ($_SERVER['REQUEST_METHOD'] == 'POST' &&
+ isset($_POST['edited_file_contents']) &&
+ isset($_POST['edited_file'])) {
+ try {
+ $fp = fopen( $_POST['edited_file'], 'w');
+ if ($fp) {
+ fwrite($fp, $_POST['edited_file_contents']);
+ fclose($fp);
+ }
+ if (!file_exists( $_POST['edited_file'] )) {
+ throw new Exception('Error creating tags.json. Permissions?');
+ }
+ } catch (Exception $e) {
+ echo 'Caught exception: ', $e->getMessage(), "\n";
+ }
+ $edit = false;
+} else {
+ $edit = true;
+}
function parse_request( $request )
{
- # if entries (dir in CONTENT dir)
+
+/*
+ $dirs = explode('/', $request['path']);
+ switch($dirs[0]) {
+ # EDITING
+ case 'edit' :
+ include 'edit.php';
+ break;
+ # TAG
+ case 'tag' :
+ echo 'tag time.';
+ exit;
+ break;
+ }
+
+
+ # edit
+ if (DEV && isset($edit) && $edit) {
+ $this->template = 'edit.html.tpl';
+ }
+
+*/
+
+ # if multiple (multiple files in CONTENT dir)
if ($this->is_multiple()) {
# check if config file exists in dir
if ($this->has_config()) {
<div id="content">
<ul class="archive">
- <? foreach($entries as $entry): ?>
+ <? foreach($entries as $entry): ?>
<li>
— <a class="more" href="<?= $entry['url']; ?>"><?= $entry['title']; ?></a>
</li>
- <? endforeach; ?>
+ <? endforeach; ?>
</ul>
-
+
</div>
- <? $this->include_template('footer.html.tpl') ?>
+ <? $this->include_template('footer.html.tpl') ?>
<? $this->include_template('nav.html.tpl') ?>
</body>
--- /dev/null
+<html>
+<head>
+
+ <? $this->include_template('head-inc.html.tpl') ?>
+
+ <title><?=SITE_TITLE?><?=TITLE_DELIMITER?><?=$entry->title?></title>
+
+</head>
+<body>
+
+ <? $this->include_template('nav.html.tpl') ?>
+
+<div id="content" class="edit">
+
+ <? if ($entry): ?>
+ <? $fileContents = file_get_contents($entry->fileInfo); ?>
+
+ <form action="" method="POST">
+ <textarea name="edited_file_contents"><?=$fileContents?></textarea>
+ <input type="hidden" name="edited_file" value="<?=$entry->fileInfo->getPath().DIRECTORY_SEPARATOR.$entry->fileInfo->getFilename();?>">
+ <input type="button" onClick="window.location = '<?=$entry->url?>'"value="cancel">
+ <input type="submit" value="save">
+ </form>
+
+ <? endif; ?>
+
+</div>
+
+ <? $this->include_template('footer.html.tpl') ?>
+
+</body>
+</html>
+++ /dev/null
-<html>
-<head>
-
- <? $this->include_template('head-inc.html.tpl') ?>
-
- <title><?=SITE_TITLE?><?=$this->page_title(TITLE_DELIMITER);?></title>
-
-</head>
-<body>
-
-
-<div id="content">
-
- <ul class="archive">
- <? foreach($entries as $entry): ?>
- <li>
- <a class="more" href="#<?= $entry['url']; ?>"><?= $entry['title']; ?></a>
- </li>
- <? endforeach; ?>
- </ul>
-
- <br />
- <br />
- <br />
- <br />
-
-
- <div class="inline">
- <? foreach($entries as $entry): ?>
- <?
- if (isset($entry['content_short']))
- $entry['content'] = $entry['content_short'] . '<br /><a class="more" href="'.$entry['url'].'">more →</a><br /><br />';
-
- ?>
- <a name="<?= $entry['url'] ?>">
- <?
-
- $this->include_template('entry.html.tpl', array('entry' => $entry));
- ?>
- <? endforeach; ?>
- </div>
-
-</div>
-
- <? $this->include_template('footer.html.tpl') ?>
- <? $this->include_template('nav.html.tpl') ?>
-
-</body>
-</html>
+++ /dev/null
-<html>
-<head>
-
- <?php $this->include_template('head-inc.html.tpl'); ?>
-
- <title><?=SITE_TITLE?>: photo</title>
- <style>
- ul, li {
- list-style-type:none;
-
- }
- ul {
- margin:0;
- padding:0;
- }
- </style>
-</head>
-<body>
-
- <? $this->include_template('nav.html.tpl') ?>
-
-<div id="content">
-
-
-
-<? /*
- <td valign="top" class="column">
- <?php $tube = get_rss_feed('http://gdata.youtube.com/feeds/base/users/quilime/favorites?alt=rss&v=2&orderby=published&client=ytapi-youtube-profile'); ?>
- <h2><a href="http://www.youtube.com/profile?user=kabr&view=favorites">video </a></h2>
- <ul class="video">
- <?php
- $count = 11;
- foreach($tube->channel->item as $tube) :
- if ($count-- == 0) break;
- ?>
- <li title="<?php echo str_replace('"', '\'', $tube->title); ?>">
- <?
- $url = $tube->link;
- $pattern = '/v=(.+?)&/';
- preg_match($pattern, $url, $matches);
- $id = $matches[1];
- ?>
- <a href="<?php echo $tube->link; ?>">
-
- <img src="http://i3.ytimg.com/vi/<?=$id?>/default.jpg" />
- </a>
- </li>
- <? endforeach; ?>
- </ul>
- <p>
- <a class="more" href="http://www.youtube.com/profile?user=quilime&view=favorites" title="via youtube">more →</a>
- </p>
- </td>
-*/ ?>
-
- <!-- quilime:flickr -->
- <ul>
- <? $count = 16; $img = get_rss_feed('http://api.flickr.com/services/feeds/photos_public.gne?id=28394478@N00&lang=en-us&format=rss_200'); ?>
- <?php foreach($img->channel->item as $item) : if (!$count--) break; ?>
- <li style="float:left; height:280px;margin-right:20px;">
- <?
- $subject = $item->description;
- $pattern = '/<a href="http:\/\/www\.flickr\.com\/photos\/quilime\/(.*) \/><\/a><\/p>/';
- preg_match($pattern, substr($subject, 3), $matches, PREG_OFFSET_CAPTURE);
- echo $matches[0][0];
- ?>
- </li>
-<?endforeach;?>
- </ul>
- <p style="clear:both;">
-
- </p>
- <p>
- <a class="more" href="http://flickr.com/photos/quilime/" title="via flickr">more →</a>
- </p>
-
-
-
-
-
-
-
-
-
-
-
-
- </div>
-
- <? $this->include_template('footer.html.tpl'); ?>
-
-</body>
-</html>
-