]> git.immae.eu Git - github/wallabag/wallabag.git/commitdiff
Merge pull request #67 from inthepoche/dev
authorNicolas Lœuillet <nicolas@loeuillet.org>
Sun, 21 Apr 2013 17:53:22 +0000 (10:53 -0700)
committerNicolas Lœuillet <nicolas@loeuillet.org>
Sun, 21 Apr 2013 17:53:22 +0000 (10:53 -0700)
tag 0.2

40 files changed:
css/style-dark.css [new file with mode: 0644]
css/style-light.css [new file with mode: 0644]
css/style.css
img/dark/checkmark-off.png [new file with mode: 0644]
img/dark/checkmark-on.png [new file with mode: 0644]
img/dark/down.png [new file with mode: 0644]
img/dark/logo.png [new file with mode: 0644]
img/dark/remove.png [new file with mode: 0644]
img/dark/star-off.png [new file with mode: 0644]
img/dark/star-on.png [new file with mode: 0644]
img/dark/up.png [new file with mode: 0644]
img/light/checkmark-off.png [moved from img/checkmark-off.png with 100% similarity]
img/light/checkmark-on.png [moved from img/checkmark-on.png with 100% similarity]
img/light/remove.png [moved from img/remove.png with 100% similarity]
img/light/star-off.png [moved from img/star-off.png with 100% similarity]
img/light/star-on.png [moved from img/star-on.png with 100% similarity]
img/messages/close.png [new file with mode: 0755]
img/messages/cross.png [new file with mode: 0755]
img/messages/help.png [new file with mode: 0755]
img/messages/tick.png [new file with mode: 0755]
img/messages/warning.png [new file with mode: 0755]
inc/MyTool.class.php
inc/class.messages.php [new file with mode: 0644]
inc/config.php
inc/db.php [deleted file]
inc/functions.php
inc/store/file.class.php [new file with mode: 0644]
inc/store/sqlite.class.php [new file with mode: 0644]
inc/store/store.class.php [new file with mode: 0644]
index.php
js/poche.js
tpl/config.html [new file with mode: 0644]
tpl/entries.html
tpl/export.html [new file with mode: 0644]
tpl/footer.html
tpl/head.html
tpl/home.html
tpl/login.html
tpl/messages.html [new file with mode: 0644]
tpl/view.html

diff --git a/css/style-dark.css b/css/style-dark.css
new file mode 100644 (file)
index 0000000..813c291
--- /dev/null
@@ -0,0 +1,90 @@
+/*** GENERAL ***/
+body {
+    color: #fff;
+    background-color: #0d0d0d;
+}
+
+a, a:hover, a:visited {
+    color: #fff;
+}
+
+#main ul#links li a.current {
+    background-color: #000;
+    color: #fff;
+}
+
+#links a:hover, .backhome a:hover{
+    background-color: #fff;
+    color: #000;
+}
+
+input[type=submit].delete {
+    background : url('../img/dark/remove.png') no-repeat center center;
+    color : transparent;
+}
+
+#main .entrie {
+    color: #fff;
+    background-color: #000;
+    border: 1px solid #fff;
+}
+
+#main .entrie h2 a:hover {
+    color: #29B1E3;
+}
+
+a.fav span {
+    background: url('../img/dark/star-on.png') no-repeat;
+}
+
+a.fav span:hover {
+    background: url('../img/dark/star-off.png') no-repeat;
+}
+
+a.fav-off span {
+    background: url('../img/dark/star-off.png') no-repeat;
+}
+
+a.fav-off span:hover {
+    background: url('../img/dark/star-on.png') no-repeat;
+}
+
+a.archive span {
+    background: url('../img/dark/checkmark-on.png') no-repeat;
+}
+
+a.archive span:hover {
+    background: url('../img/dark/checkmark-off.png') no-repeat;
+}
+
+a.archive-off span {
+    background: url('../img/dark/checkmark-off.png') no-repeat;
+}
+
+a.archive-off span:hover {
+    background: url('../img/dark/checkmark-on.png') no-repeat;
+}
+
+/*** ***/
+/*** ARTICLE PAGE ***/
+
+body.article {
+       color: #fff;
+    background-color: #0d0d0d;
+}
+
+#article header {
+    border-bottom: 1px solid #222222;
+}
+
+#article article {
+    border-bottom: 1px solid #222222;
+}
+
+.vieworiginal a {
+    color: #888888;
+}
+
+.entrie {
+    background-color: #fff;
+}
diff --git a/css/style-light.css b/css/style-light.css
new file mode 100644 (file)
index 0000000..5b9c6c1
--- /dev/null
@@ -0,0 +1,90 @@
+/*** GENERAL ***/
+body {
+    color: #222222;
+    background-color: #F1F1F1;
+}
+
+a, a:hover, a:visited {
+    color: #000;
+}
+
+#main ul#links li a.current {
+    background-color: #000;
+    color: #fff;
+}
+
+#links a:hover, .backhome a:hover{
+    background-color: #040707;
+    color: #F1F1F1;
+}
+
+input[type=submit].delete {
+    background : url('../img/light/remove.png') no-repeat center center;
+    color : transparent;
+}
+
+#main .entrie {
+    color: #2e2e2e;
+    background-color: #ffffff;
+    border: 1px solid #000;
+}
+
+#main .entrie h2 a:hover {
+    color: #F5BE00;
+}
+
+a.fav span {
+    background: url('../img/light/star-on.png') no-repeat;
+}
+
+a.fav span:hover {
+    background: url('../img/light/star-off.png') no-repeat;
+}
+
+a.fav-off span {
+    background: url('../img/light/star-off.png') no-repeat;
+}
+
+a.fav-off span:hover {
+    background: url('../img/light/star-on.png') no-repeat;
+}
+
+a.archive span {
+    background: url('../img/light/checkmark-on.png') no-repeat;
+}
+
+a.archive span:hover {
+    background: url('../img/light/checkmark-off.png') no-repeat;
+}
+
+a.archive-off span {
+    background: url('../img/light/checkmark-off.png') no-repeat;
+}
+
+a.archive-off span:hover {
+    background: url('../img/light/checkmark-on.png') no-repeat;
+}
+
+/*** ***/
+/*** ARTICLE PAGE ***/
+
+body.article {
+       color: #222222;
+    background-color: #F1F1F1;
+}
+
+#article header {
+    border-bottom: 1px solid #222222;
+}
+
+#article article {
+    border-bottom: 1px solid #222222;
+}
+
+.vieworiginal a {
+    color: #888888;
+}
+
+.entrie {
+    background-color: #fff;
+}
index 29dca289a25cae99fb21820652f8ce70cd76b5bf..36ebf85d2191ee4ef554ccaaaa39bba4ee68d780 100644 (file)
@@ -1,16 +1,10 @@
 /*** GENERAL ***/
 body {
-    color: #222222;
     font: 20px/1.3em Palatino,Georgia,serif;
-    background-color: #F1F1F1;
     margin: 10px;
 }
 
 
-a, a:hover, a:visited {
-    color: #000;
-}
-
 header {
     text-align: center;
 }
@@ -28,8 +22,6 @@ header {
 #main ul#links li a.current {
     -webkit-border-radius: 2px;
     border-radius: 2px;
-    background-color: #040707;
-    color: #F1F1F1;
 }
 
 #main ul#sort {
@@ -58,8 +50,6 @@ header {
 #links a:hover, .backhome a:hover{
     -webkit-border-radius: 2px;
     border-radius: 2px;
-    background-color: #040707;
-    color: #F1F1F1;
 }
 
 footer {
@@ -80,11 +70,9 @@ ul#login li {
 }
 
 input[type=submit].delete {
-    background : url('../img/remove.png') no-repeat center center;
     width : 16px;
     height :16px;
     border : none;
-    color : transparent;
     cursor: pointer;
     font-size : 0;
 }
@@ -94,8 +82,6 @@ input[type=submit].delete {
 }
 
 #main .entrie {
-    color: rgb(46, 46, 46);
-    background-color: #ffffff;
     padding: 15px;
     min-height: 8em;
     border: 1px solid;
@@ -105,10 +91,6 @@ input[type=submit].delete {
     text-decoration: none;
 }
 
-#main .entrie h2 a:hover {
-    color: #F5BE00;
-}
-
 .tools {
     text-align: right;
 }
@@ -145,62 +127,23 @@ input[type=submit].delete {
     height: 16px;
 }
 
-a.fav span {
-    background: url('../img/star-on.png') no-repeat;
-}
-
-a.fav span:hover {
-    background: url('../img/star-off.png') no-repeat;
-}
-
-a.fav-off span {
-    background: url('../img/star-off.png') no-repeat;
-}
-
-a.fav-off span:hover {
-    background: url('../img/star-on.png') no-repeat;
-}
-
-a.archive span {
-    background: url('../img/checkmark-on.png') no-repeat;
-}
-
-a.archive span:hover {
-    background: url('../img/checkmark-off.png') no-repeat;
-}
-
-a.archive-off span {
-    background: url('../img/checkmark-off.png') no-repeat;
-}
-
-a.archive-off span:hover {
-    background: url('../img/checkmark-on.png') no-repeat;
-}
 
 /*** ***/
 /*** ARTICLE PAGE ***/
 
 body.article {
-    color: #222222;
     font: 20px/1.3em Palatino,Georgia,serif;
-    background-color: #F1F1F1;
 }
 
 #article header {
     text-align: left;
-    border-bottom: 1px solid #222222;
 }
 
 #article header a {
     text-decoration: none;
 }
 
-#article article {
-    border-bottom: 1px solid #222222;
-}
-
 .vieworiginal a {
-    color: #888888;
     text-decoration: none;
 }
 
@@ -256,4 +199,19 @@ body.article {
     }
 }
 
-
+/*** ***/
+/*** MESSAGES ***/
+
+.messages { width: 100%; -moz-border-radius: 4px; border-radius: 4px; display: block; padding: 10px 0; margin: 10px auto 10px; clear: both; }
+.messages a.closeMessage { margin: -14px -8px 0 0; display:none; width: 16px; height: 16px; float: right; background: url(../img/messages/close.png) no-repeat; }
+/*.messages:hover a.closeMessage { visibility:visible; }*/
+.messages p { margin: 3px 0 3px 10px !important; padding: 0 10px 0 23px !important; font-size: 14px; line-height: 16px; }
+.messages.error { border: 1px solid #C42608; color: #c00 !important; background: #FFF0EF; }
+.messages.error p { background: url(../img/messages/cross.png ) no-repeat 0px 50%; color:#c00 !important; }
+.messages.success {background: #E0FBCC; border: 1px solid #6DC70C; } 
+.messages.success p { background: url(../img/messages/tick.png) no-repeat 0px 50%; color: #2B6301 !important; }
+.messages.warning { background: #FFFCD3; border: 1px solid #EBCD41; color: #000; }
+.messages.warning p { background: url(../img/messages/warning.png ) no-repeat 0px 50%; color: #5F4E01; }
+.messages.information, .messages.info { background: #DFEBFB; border: 1px solid #82AEE7; }
+.messages.information p, .messages.info p { background: url(../img/messages/help.png ) no-repeat 0px 50%; color: #064393; }
+.messages.information a { text-decoration: underline; }
\ No newline at end of file
diff --git a/img/dark/checkmark-off.png b/img/dark/checkmark-off.png
new file mode 100644 (file)
index 0000000..efc3439
Binary files /dev/null and b/img/dark/checkmark-off.png differ
diff --git a/img/dark/checkmark-on.png b/img/dark/checkmark-on.png
new file mode 100644 (file)
index 0000000..24391c2
Binary files /dev/null and b/img/dark/checkmark-on.png differ
diff --git a/img/dark/down.png b/img/dark/down.png
new file mode 100644 (file)
index 0000000..41ea960
Binary files /dev/null and b/img/dark/down.png differ
diff --git a/img/dark/logo.png b/img/dark/logo.png
new file mode 100644 (file)
index 0000000..9fba064
Binary files /dev/null and b/img/dark/logo.png differ
diff --git a/img/dark/remove.png b/img/dark/remove.png
new file mode 100644 (file)
index 0000000..41786fd
Binary files /dev/null and b/img/dark/remove.png differ
diff --git a/img/dark/star-off.png b/img/dark/star-off.png
new file mode 100644 (file)
index 0000000..90651b5
Binary files /dev/null and b/img/dark/star-off.png differ
diff --git a/img/dark/star-on.png b/img/dark/star-on.png
new file mode 100644 (file)
index 0000000..7fc1447
Binary files /dev/null and b/img/dark/star-on.png differ
diff --git a/img/dark/up.png b/img/dark/up.png
new file mode 100644 (file)
index 0000000..1679e18
Binary files /dev/null and b/img/dark/up.png differ
similarity index 100%
rename from img/remove.png
rename to img/light/remove.png
similarity index 100%
rename from img/star-off.png
rename to img/light/star-off.png
similarity index 100%
rename from img/star-on.png
rename to img/light/star-on.png
diff --git a/img/messages/close.png b/img/messages/close.png
new file mode 100755 (executable)
index 0000000..731aa01
Binary files /dev/null and b/img/messages/close.png differ
diff --git a/img/messages/cross.png b/img/messages/cross.png
new file mode 100755 (executable)
index 0000000..1514d51
Binary files /dev/null and b/img/messages/cross.png differ
diff --git a/img/messages/help.png b/img/messages/help.png
new file mode 100755 (executable)
index 0000000..5c87017
Binary files /dev/null and b/img/messages/help.png differ
diff --git a/img/messages/tick.png b/img/messages/tick.png
new file mode 100755 (executable)
index 0000000..a9925a0
Binary files /dev/null and b/img/messages/tick.png differ
diff --git a/img/messages/warning.png b/img/messages/warning.png
new file mode 100755 (executable)
index 0000000..628cf2d
Binary files /dev/null and b/img/messages/warning.png differ
index 8206f3f7fa233028a6094e5edcc92b962f81d774..1f5051a43c165cc19f32ec4bbb2c5e99ac92a133 100644 (file)
@@ -1,4 +1,13 @@
 <?php
+/**
+ * poche, a read it later open source system
+ *
+ * @category   poche
+ * @author     Nicolas Lœuillet <support@inthepoche.com>
+ * @copyright  2013
+ * @license    http://www.wtfpl.net/ see COPYING file
+ */
 class MyTool
 {
     public static function initPhp()
diff --git a/inc/class.messages.php b/inc/class.messages.php
new file mode 100644 (file)
index 0000000..6d515bf
--- /dev/null
@@ -0,0 +1,231 @@
+<?php
+//--------------------------------------------------------------------------------------------------
+// Session-Based Flash Messages v1.0
+// Copyright 2012 Mike Everhart (http://mikeeverhart.net)
+//
+//   Licensed under the Apache License, Version 2.0 (the "License");
+//   you may not use this file except in compliance with the License.
+//   You may obtain a copy of the License at
+//
+//     http://www.apache.org/licenses/LICENSE-2.0
+//
+//   Unless required by applicable law or agreed to in writing, software
+//   distributed under the License is distributed on an "AS IS" BASIS,
+//   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+//   See the License for the specific language governing permissions and
+//      limitations under the License.
+//      
+//------------------------------------------------------------------------------
+// Description:
+//------------------------------------------------------------------------------
+//
+//     Stores messages in Session data to be easily retrieved later on.
+//     This class includes four different types of messages:
+//  - Success
+//  - Error
+//  - Warning
+//  - Information
+// 
+//  See README for basic usage instructions, or see samples/index.php for more advanced samples
+//
+//--------------------------------------------------------------------------------------------------
+// Changelog
+//--------------------------------------------------------------------------------------------------
+// 
+//     2011-05-15 - v1.0 - Initial Version
+//
+//--------------------------------------------------------------------------------------------------
+
+class Messages {
+       
+       //-----------------------------------------------------------------------------------------------
+       // Class Variables
+       //-----------------------------------------------------------------------------------------------       
+       var $msgId;
+       var $msgTypes = array( 'help', 'info', 'warning', 'success', 'error' );
+       var $msgClass = 'messages';
+       var $msgWrapper = "<div class='%s %s'><a href='#' class='closeMessage'></a>\n%s</div>\n";
+       var $msgBefore = '<p>';
+       var $msgAfter = "</p>\n";
+
+       
+       /**
+        * Constructor
+        * @author Mike Everhart
+        */
+       public function __construct() {
+       
+               // Generate a unique ID for this user and session
+               $this->msgId = md5(uniqid());
+               
+               // Create the session array if it doesnt already exist
+               if( !array_key_exists('flash_messages', $_SESSION) ) $_SESSION['flash_messages'] = array();
+               
+       }
+       
+       /**
+        * Add a message to the queue
+        * 
+        * @author Mike Everhart
+        * 
+        * @param  string   $type               The type of message to add
+        * @param  string   $message            The message
+        * @param  string   $redirect_to        (optional) If set, the user will be redirected to this URL
+        * @return  bool 
+        * 
+        */
+       public function add($type, $message, $redirect_to=null) {
+               
+               if( !isset($_SESSION['flash_messages']) ) return false;
+               
+               if( !isset($type) || !isset($message[0]) ) return false;
+
+               // Replace any shorthand codes with their full version
+               if( strlen(trim($type)) == 1 ) {
+                       $type = str_replace( array('h', 'i', 'w', 'e', 's'), array('help', 'info', 'warning', 'error', 'success'), $type );
+               
+               // Backwards compatibility...
+               } elseif( $type == 'information' ) {
+                       $type = 'info'; 
+               }
+               
+               // Make sure it's a valid message type
+               if( !in_array($type, $this->msgTypes) ) die('"' . strip_tags($type) . '" is not a valid message type!' );
+               
+               // If the session array doesn't exist, create it
+               if( !array_key_exists( $type, $_SESSION['flash_messages'] ) ) $_SESSION['flash_messages'][$type] = array();
+               
+               $_SESSION['flash_messages'][$type][] = $message;
+
+               if( !is_null($redirect_to) ) {
+                       header("Location: $redirect_to");
+                       exit();
+               }
+               
+               return true;
+               
+       }
+       
+       //-----------------------------------------------------------------------------------------------
+       // display()
+       // print queued messages to the screen
+       //-----------------------------------------------------------------------------------------------
+       /**
+        * Display the queued messages
+        * 
+        * @author Mike Everhart
+        * 
+        * @param  string   $type     Which messages to display
+        * @param  bool         $print    True  = print the messages on the screen
+        * @return mixed              
+        * 
+        */
+       public function display($type='all', $print=true) {
+               $messages = '';
+               $data = '';
+               
+               if( !isset($_SESSION['flash_messages']) ) return false;
+               
+               if( $type == 'g' || $type == 'growl' ) {
+                       $this->displayGrowlMessages();
+                       return true;
+               }
+               
+               // Print a certain type of message?
+               if( in_array($type, $this->msgTypes) ) {
+                       foreach( $_SESSION['flash_messages'][$type] as $msg ) {
+                               $messages .= $this->msgBefore . $msg . $this->msgAfter;
+                       }
+
+                       $data .= sprintf($this->msgWrapper, $this->msgClass, $type, $messages);
+                       
+                       // Clear the viewed messages
+                       $this->clear($type);
+               
+               // Print ALL queued messages
+               } elseif( $type == 'all' ) {
+                       foreach( $_SESSION['flash_messages'] as $type => $msgArray ) {
+                               $messages = '';
+                               foreach( $msgArray as $msg ) {
+                                       $messages .= $this->msgBefore . $msg . $this->msgAfter; 
+                               }
+                               $data .= sprintf($this->msgWrapper, $this->msgClass, $type, $messages);
+                       }
+                       
+                       // Clear ALL of the messages
+                       $this->clear();
+               
+               // Invalid Message Type?
+               } else { 
+                       return false;
+               }
+               
+               // Print everything to the screen or return the data
+               if( $print ) { 
+                       echo $data; 
+               } else { 
+                       return $data; 
+               }
+       }
+       
+       
+       /**
+        * Check to  see if there are any queued error messages
+        * 
+        * @author Mike Everhart
+        * 
+        * @return bool  true  = There ARE error messages
+        *               false = There are NOT any error messages
+        * 
+        */
+       public function hasErrors() { 
+               return empty($_SESSION['flash_messages']['error']) ? false : true;      
+       }
+       
+       /**
+        * Check to see if there are any ($type) messages queued
+        * 
+        * @author Mike Everhart
+        * 
+        * @param  string   $type     The type of messages to check for
+        * @return bool                   
+        * 
+        */
+       public function hasMessages($type=null) {
+               if( !is_null($type) ) {
+                       if( !empty($_SESSION['flash_messages'][$type]) ) return $_SESSION['flash_messages'][$type];     
+               } else {
+                       foreach( $this->msgTypes as $type ) {
+                               if( !empty($_SESSION['flash_messages']) ) return true;  
+                       }
+               }
+               return false;
+       }
+       
+       /**
+        * Clear messages from the session data
+        * 
+        * @author Mike Everhart
+        * 
+        * @param  string   $type     The type of messages to clear
+        * @return bool 
+        * 
+        */
+       public function clear($type='all') { 
+               if( $type == 'all' ) {
+                       unset($_SESSION['flash_messages']); 
+               } else {
+                       unset($_SESSION['flash_messages'][$type]);
+               }
+               return true;
+       }
+       
+       public function __toString() { return $this->hasMessages();     }
+
+       public function __destruct() {
+               //$this->clear();
+       }
+
+
+} // end class
+?>
\ No newline at end of file
index c63b07b950c7b84a80a4e96f796639627c3467b1..9d4b7fae260cb9478650346f35a8a48840d90b3e 100644 (file)
@@ -8,26 +8,32 @@
  * @license    http://www.wtfpl.net/ see COPYING file
  */
 
-define ('POCHE_VERSION', '0.11');
+define ('POCHE_VERSION', '0.2');
 
 if (!is_dir('db/')) {
     @mkdir('db/',0705);
 }
 
-define ('DB_PATH', 'sqlite:./db/poche.sqlite');
 define ('ABS_PATH', 'assets/');
 define ('CONVERT_LINKS_FOOTNOTES', TRUE);
 define ('DOWNLOAD_PICTURES', TRUE);
+$storage_type = 'sqlite'; # sqlite or file
 
-include 'db.php';
 include 'functions.php';
 require_once 'Readability.php';
 require_once 'Encoding.php';
 require_once 'rain.tpl.class.php';
 require_once 'MyTool.class.php';
 require_once 'Session.class.php';
+require_once 'store/store.class.php';
+require_once 'store/sqlite.class.php';
+require_once 'store/file.class.php';
+require_once 'class.messages.php';
 
-$db = new db(DB_PATH);
+Session::init();
+
+$store         = new $storage_type();
+$msg   = new Messages();
 
 # initialisation de RainTPL
 raintpl::$tpl_dir   = './tpl/';
@@ -35,4 +41,5 @@ raintpl::$cache_dir = './cache/';
 raintpl::$base_url  = get_poche_url();
 raintpl::configure('path_replace', false);
 raintpl::configure('debug', false);
-$tpl = new raintpl();
\ No newline at end of file
+$tpl = new raintpl();
+$tpl->assign('msg', $msg);
\ No newline at end of file
diff --git a/inc/db.php b/inc/db.php
deleted file mode 100644 (file)
index 60d7c10..0000000
+++ /dev/null
@@ -1,22 +0,0 @@
-<?php
-/**
- * poche, a read it later open source system
- *
- * @category   poche
- * @author     Nicolas Lœuillet <nicolas@loeuillet.org>
- * @copyright  2013
- * @license    http://www.wtfpl.net/ see COPYING file
- */
-
-class db {
-    var $handle;
-    function __construct($path) {
-        $this->handle = new PDO($path);
-        $this->handle->exec('CREATE TABLE IF NOT EXISTS "entries" ("id" INTEGER PRIMARY KEY  AUTOINCREMENT  NOT NULL  UNIQUE , "title" VARCHAR, "url" VARCHAR UNIQUE , "is_read" INTEGER DEFAULT 0, "is_fav" INTEGER DEFAULT 0, "content" BLOB)');
-        $this->handle->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
-    }
-
-    public function getHandle() {
-        return $this->handle;
-    }
-}
\ No newline at end of file
index ef1fc0e28a934812df50d1468d2874d2395aa60e..205f3968130dd51da4809679ca5ae2cb758479dc 100644 (file)
@@ -1,4 +1,12 @@
 <?php
+/**
+ * poche, a read it later open source system
+ *
+ * @category   poche
+ * @author     Nicolas Lœuillet <support@inthepoche.com>
+ * @copyright  2013
+ * @license    http://www.wtfpl.net/ see COPYING file
+ */
 
 /**
  * Permet de générer l'URL de poche pour le bookmarklet
@@ -117,6 +125,7 @@ function prepare_url($url)
         }
     }
 
+    $msg->add('e', 'error during url preparation');
     logm('error during url preparation');
     return FALSE;
 }
@@ -228,20 +237,35 @@ function remove_directory($directory)
 
 function display_view($view, $id = 0, $full_head = 'yes')
 {
-    global $tpl;
+    global $tpl, $store, $msg;
 
     switch ($view)
     {
+        case 'export':
+            $entries = $store->retrieveAll();
+            $tpl->assign('export', myTool::renderJson($entries));
+            $tpl->draw('export');
+            logm('export view');
+            break;
+        case 'config':
+            $tpl->assign('load_all_js', 0);
+            $tpl->draw('head');
+            $tpl->draw('home');
+            $tpl->draw('config');
+            $tpl->draw('js');
+            $tpl->draw('footer');
+            logm('config view');
+            break;
         case 'view':
-            $entry = get_article($id);
+            $entry = $store->retrieveOneById($id);
 
             if ($entry != NULL) {
-                $tpl->assign('id', $entry[0]['id']);
-                $tpl->assign('url', $entry[0]['url']);
-                $tpl->assign('title', $entry[0]['title']);
-                $tpl->assign('content', $entry[0]['content']);
-                $tpl->assign('is_fav', $entry[0]['is_fav']);
-                $tpl->assign('is_read', $entry[0]['is_read']);
+                $tpl->assign('id', $entry['id']);
+                $tpl->assign('url', $entry['url']);
+                $tpl->assign('title', $entry['title']);
+                $tpl->assign('content', $entry['content']);
+                $tpl->assign('is_fav', $entry['is_fav']);
+                $tpl->assign('is_read', $entry['is_read']);
                 $tpl->assign('load_all_js', 0);
                 $tpl->draw('view');
             }
@@ -252,7 +276,7 @@ function display_view($view, $id = 0, $full_head = 'yes')
             logm('view link #' . $id);
             break;
         default: # home view
-            $entries = get_entries($view);
+            $entries = $store->getEntriesByView($view);
 
             $tpl->assign('entries', $entries);
 
@@ -277,7 +301,7 @@ function display_view($view, $id = 0, $full_head = 'yes')
  */
 function action_to_do($action, $url, $id = 0)
 {
-    global $db;
+    global $store, $msg;
 
     switch ($action)
     {
@@ -285,140 +309,42 @@ function action_to_do($action, $url, $id = 0)
             if ($url == '')
                 continue;
 
-            if($parametres_url = prepare_url($url)) {
-                $sql_action     = 'INSERT INTO entries ( url, title, content ) VALUES (?, ?, ?)';
-                $params_action  = array($url, $parametres_url['title'], $parametres_url['content']);
+            if (MyTool::isUrl($url)) {
+                if($parametres_url = prepare_url($url)) {
+                    $store->add($url, $parametres_url['title'], $parametres_url['content']);
+                    $last_id = $store->getLastId();
+                    if (DOWNLOAD_PICTURES) {
+                        $content = filtre_picture($parametres_url['content'], $url, $last_id);
+                    }
+                    $msg->add('s', 'the link has been added successfully');
+                }
+            }
+            else {
+                $msg->add('e', 'the link has been added successfully');
+                logm($url . ' is not a valid url');
             }
 
             logm('add link ' . $url);
             break;
         case 'delete':
             remove_directory(ABS_PATH . $id);
-            $sql_action     = "DELETE FROM entries WHERE id=?";
-            $params_action  = array($id);
+            $store->deleteById($id);
+            $msg->add('s', 'the link has been deleted successfully');
             logm('delete link #' . $id);
             break;
         case 'toggle_fav' :
-            $sql_action     = "UPDATE entries SET is_fav=~is_fav WHERE id=?";
-            $params_action  = array($id);
+            $store->favoriteById($id);
+            $msg->add('s', 'the favorite toggle has been done successfully');
             logm('mark as favorite link #' . $id);
             break;
         case 'toggle_archive' :
-            $sql_action     = "UPDATE entries SET is_read=~is_read WHERE id=?";
-            $params_action  = array($id);
+            $store->archiveById($id);
+            $msg->add('s', 'the archive toggle has been done successfully');
             logm('archive link #' . $id);
             break;
         default:
             break;
     }
-
-    try
-    {
-        # action query
-        if (isset($sql_action))
-        {
-            $query = $db->getHandle()->prepare($sql_action);
-            $query->execute($params_action);
-            # if we add a link, we have to download pictures
-            if ($action == 'add') {
-                $last_id = $db->getHandle()->lastInsertId();
-                if (DOWNLOAD_PICTURES) {
-                    $content        = filtre_picture($parametres_url['content'], $url, $last_id);
-                    $sql_update     = "UPDATE entries SET content=? WHERE id=?";
-                    $params_update  = array($content, $last_id);
-                    $query_update   = $db->getHandle()->prepare($sql_update);
-                    $query_update->execute($params_update);
-                }
-            }
-        }
-    }
-    catch (Exception $e)
-    {
-        logm('action query error : '.$e->getMessage());
-    }
-}
-
-/**
- * Détermine quels liens afficher : home, fav ou archives
- */
-function get_entries($view)
-{
-    global $db;
-
-    switch ($_SESSION['sort'])
-    {
-        case 'ia':
-            $order = 'ORDER BY id';
-            break;
-        case 'id':
-            $order = 'ORDER BY id DESC';
-            break;
-        case 'ta':
-            $order = 'ORDER BY lower(title)';
-            break;
-        case 'td':
-            $order = 'ORDER BY lower(title) DESC';
-            break;
-        default:
-            $order = 'ORDER BY id';
-            break;
-    }
-
-    switch ($view)
-    {
-        case 'archive':
-            $sql    = "SELECT * FROM entries WHERE is_read=? " . $order;
-            $params = array(-1);
-            break;
-        case 'fav' :
-            $sql    = "SELECT * FROM entries WHERE is_fav=? " . $order;
-            $params = array(-1);
-            break;
-        default:
-            $sql    = "SELECT * FROM entries WHERE is_read=? " . $order;
-            $params = array(0);
-            break;
-    }
-
-    # view query
-    try
-    {
-        $query  = $db->getHandle()->prepare($sql);
-        $query->execute($params);
-        $entries = $query->fetchAll();
-    }
-    catch (Exception $e)
-    {
-        logm('view query error : '.$e->getMessage());
-    }
-
-    return $entries;
-}
-
-/**
- * Récupère un article en fonction d'un ID
- */
-function get_article($id)
-{
-    global $db;
-
-    $entry  = NULL;
-    $sql    = "SELECT * FROM entries WHERE id=?";
-    $params = array(intval($id));
-
-    # view article query
-    try
-    {
-        $query  = $db->getHandle()->prepare($sql);
-        $query->execute($params);
-        $entry = $query->fetchAll();
-    }
-    catch (Exception $e)
-    {
-        logm('get article query error : '.$e->getMessage());
-    }
-
-    return $entry;
 }
 
 function logm($message)
diff --git a/inc/store/file.class.php b/inc/store/file.class.php
new file mode 100644 (file)
index 0000000..ad20937
--- /dev/null
@@ -0,0 +1,51 @@
+<?php
+/**
+ * poche, a read it later open source system
+ *
+ * @category   poche
+ * @author     Nicolas Lœuillet <support@inthepoche.com>
+ * @copyright  2013
+ * @license    http://www.wtfpl.net/ see COPYING file
+ */
+
+class File extends Store {
+    function __construct() {
+
+    }
+
+    public function add() {
+
+    }
+
+    public function retrieveOneById($id) {
+
+    }
+
+    public function retrieveOneByURL($url) {
+
+    }
+
+    public function deleteById($id) {
+
+    }
+
+    public function favoriteById($id) {
+
+    }
+
+    public function archiveById($id) {
+
+    }
+
+    public function getEntriesByView($view) {
+
+    }
+
+    public function getLastId() {
+
+    }
+
+    public function updateContentById($id) {
+
+    }
+}
diff --git a/inc/store/sqlite.class.php b/inc/store/sqlite.class.php
new file mode 100644 (file)
index 0000000..d5208a2
--- /dev/null
@@ -0,0 +1,144 @@
+<?php
+/**
+ * poche, a read it later open source system
+ *
+ * @category   poche
+ * @author     Nicolas Lœuillet <support@inthepoche.com>
+ * @copyright  2013
+ * @license    http://www.wtfpl.net/ see COPYING file
+ */
+
+class Sqlite extends Store {
+
+    public static $db_path = 'sqlite:./db/poche.sqlite';
+    var $handle;
+
+    function __construct() {
+        parent::__construct();
+
+        $this->handle = new PDO(self::$db_path);
+        $this->handle->exec('CREATE TABLE IF NOT EXISTS "entries" ("id" INTEGER PRIMARY KEY  AUTOINCREMENT  NOT NULL  UNIQUE , "title" VARCHAR, "url" VARCHAR UNIQUE , "is_read" INTEGER DEFAULT 0, "is_fav" INTEGER DEFAULT 0, "content" BLOB)');
+        $this->handle->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
+    }
+
+    private function getHandle() {
+        return $this->handle;
+    }
+
+    private function executeQuery($sql, $params) {
+        try
+        {
+            $query = $this->getHandle()->prepare($sql);
+            $query->execute($params);
+            return $query;
+        }
+        catch (Exception $e)
+        {
+            logm('execute query error : '.$e->getMessage());
+        }
+    }
+
+    public function retrieveAll() {
+        $sql        = "SELECT * FROM entries ORDER BY id";
+        $query      = $this->executeQuery($sql, array());
+        $entries    = $query->fetchAll();
+
+        return $entries;
+    }
+
+    public function retrieveOneById($id) {
+        parent::__construct();
+
+        $entry  = NULL;
+        $sql    = "SELECT * FROM entries WHERE id=?";
+        $params = array(intval($id));
+        $query  = $this->executeQuery($sql, $params);
+        $entry  = $query->fetchAll();
+
+        return $entry[0];
+    }
+
+    public function getEntriesByView($view) {
+        parent::__construct();
+
+        switch ($_SESSION['sort'])
+        {
+            case 'ia':
+                $order = 'ORDER BY id';
+                break;
+            case 'id':
+                $order = 'ORDER BY id DESC';
+                break;
+            case 'ta':
+                $order = 'ORDER BY lower(title)';
+                break;
+            case 'td':
+                $order = 'ORDER BY lower(title) DESC';
+                break;
+            default:
+                $order = 'ORDER BY id';
+                break;
+        }
+
+        switch ($view)
+        {
+            case 'archive':
+                $sql    = "SELECT * FROM entries WHERE is_read=? " . $order;
+                $params = array(-1);
+                break;
+            case 'fav' :
+                $sql    = "SELECT * FROM entries WHERE is_fav=? " . $order;
+                $params = array(-1);
+                break;
+            default:
+                $sql    = "SELECT * FROM entries WHERE is_read=? " . $order;
+                $params = array(0);
+                break;
+        }
+
+        $query      = $this->executeQuery($sql, $params);
+        $entries    = $query->fetchAll();
+
+        return $entries;
+    }
+
+    public function add($url, $title, $content) {
+        parent::__construct();
+        $sql_action     = 'INSERT INTO entries ( url, title, content ) VALUES (?, ?, ?)';
+        $params_action  = array($url, $title, $content);
+        $query          = $this->executeQuery($sql_action, $params_action);
+    }
+
+    public function deleteById($id) {
+        parent::__construct();
+        $sql_action     = "DELETE FROM entries WHERE id=?";
+        $params_action  = array($id);
+        $query          = $this->executeQuery($sql_action, $params_action);
+    }
+
+    public function favoriteById($id) {
+        parent::__construct();
+        $sql_action     = "UPDATE entries SET is_fav=~is_fav WHERE id=?";
+        $params_action  = array($id);
+        $query          = $this->executeQuery($sql_action, $params_action);
+    }
+
+    public function archiveById($id) {
+        parent::__construct();
+        $sql_action     = "UPDATE entries SET is_read=~is_read WHERE id=?";
+        $params_action  = array($id);
+        $query          = $this->executeQuery($sql_action, $params_action);
+    }
+
+    public function getLastId() {
+        parent::__construct();
+        return $this->getHandle()->lastInsertId();
+    }
+
+    public function updateContentById($id) {
+        parent::__construct();
+        $sql_update     = "UPDATE entries SET content=? WHERE id=?";
+        $params_update  = array($content, $id);
+        $query          = $this->executeQuery($sql_update, $params_update);
+    }
+}
diff --git a/inc/store/store.class.php b/inc/store/store.class.php
new file mode 100644 (file)
index 0000000..360ff7c
--- /dev/null
@@ -0,0 +1,55 @@
+<?php
+/**
+ * poche, a read it later open source system
+ *
+ * @category   poche
+ * @author     Nicolas Lœuillet <support@inthepoche.com>
+ * @copyright  2013
+ * @license    http://www.wtfpl.net/ see COPYING file
+ */
+
+class Store {
+    function __construct() {
+
+    }
+
+    public function add() {
+
+    }
+
+    public function retrieveAll() {
+        
+    }
+
+    public function retrieveOneById($id) {
+
+    }
+
+    public function retrieveOneByURL($url) {
+
+    }
+
+    public function deleteById($id) {
+
+    }
+
+    public function favoriteById($id) {
+
+    }
+
+    public function archiveById($id) {
+
+    }
+
+    public function getEntriesByView($view) {
+
+    }
+
+    public function getLastId() {
+
+    }
+
+    public function updateContentById($id) {
+
+    }
+}
index 9a81a74104f2f739fa5e059c4915bacdf923a687..6eefd277e808647b331e42ca4c184cb03a0a38c4 100644 (file)
--- a/index.php
+++ b/index.php
@@ -10,8 +10,8 @@
 
 include dirname(__FILE__).'/inc/config.php';
 
-# initialize session
-Session::init();
+myTool::initPhp();
+
 # XSRF protection with token
 if (!empty($_POST)) {
     if (!Session::isToken($_POST['token'])) {
@@ -20,6 +20,8 @@ if (!empty($_POST)) {
     unset($_SESSION['tokens']);
 }
 
+$ref = empty($_SERVER['HTTP_REFERER']) ? '' : $_SERVER['HTTP_REFERER'];
+
 if (isset($_GET['login'])) {
     // Login
     if (!empty($_POST['login']) && !empty($_POST['password'])) {
@@ -34,7 +36,7 @@ if (isset($_GET['login'])) {
             }
             session_regenerate_id(true);
 
-            MyTool::redirect();
+            MyTool::redirect($ref);
         }
         logm('login failed');
         die("Login failed !");
@@ -55,12 +57,11 @@ $action             = (isset ($_REQUEST['action'])) ? htmlentities($_REQUEST['ac
 $_SESSION['sort']   = (isset ($_REQUEST['sort'])) ? htmlentities($_REQUEST['sort']) : 'id';
 $id                 = (isset ($_REQUEST['id'])) ? htmlspecialchars($_REQUEST['id']) : '';
 $url                = (isset ($_GET['url'])) ? $_GET['url'] : '';
-$ref                = empty($_SERVER['HTTP_REFERER']) ? '' : $_SERVER['HTTP_REFERER'];
 
 $tpl->assign('isLogged', Session::isLogged());
 $tpl->assign('referer', $ref);
 $tpl->assign('view', $view);
-$tpl->assign('poche_url', get_poche_url());
+$tpl->assign('poche_url', myTool::getUrl());
 $tpl->assign('title', 'poche, a read it later open source system');
 
 if (Session::isLogged()) {
@@ -69,4 +70,4 @@ if (Session::isLogged()) {
 }
 else {
     $tpl->draw('login');
-}
\ No newline at end of file
+}
index 6bc3c188aa6a0857daa841ad7bd0f1483d435bc7..97d9911dccbe3fff59ddccf8aed2a8dfb125c815 100644 (file)
@@ -23,8 +23,35 @@ function toggle_archive(element, id, view_article) {
 }
 
 function sort_links(view, sort) {
-    //$('#content').load('index.php', { view: view, sort: sort, full_head: 'no' } );
     $.get('index.php', { view: view, sort: sort, full_head: 'no' }, function(data) {
       $('#content').html(data);
     });
-}
\ No newline at end of file
+}
+
+
+// ---------- Swith light or dark view
+function setActiveStyleSheet(title) {
+       var i, a, main;
+       for(i=0; (a = document.getElementsByTagName("link")[i]); i++) {
+               if(a.getAttribute("rel").indexOf("style") != -1 && a.getAttribute("title")) {
+                       a.disabled = true;
+                       if(a.getAttribute("title") == title) a.disabled = false;
+               }
+       }
+}
+$('#themeswitch').click(function() {
+       // we want the dark
+       if ($('body').hasClass('light-style')) {
+               setActiveStyleSheet('dark-style');
+               $('body').addClass('dark-style');
+               $('body').removeClass('light-style');
+               $('#themeswitch').text('light');
+       // we want the light
+       } else if ($('body').hasClass('dark-style')) {
+               setActiveStyleSheet('light-style');
+               $('body').addClass('light-style');
+               $('body').removeClass('dark-style');
+               $('#themeswitch').text('dark');
+       }
+       return false;
+});
diff --git a/tpl/config.html b/tpl/config.html
new file mode 100644 (file)
index 0000000..7d1c6af
--- /dev/null
@@ -0,0 +1,8 @@
+            <div id="content">
+               <h2>Bookmarklet</h2>
+               <p>Thanks to the bookmarklet, you will be able to easily add a link to your poche. If you don't know how use a bookmarklet, <a href="http://support.mozilla.org/en-US/kb/bookmarklets-perform-common-web-page-tasks">have a look here</a>.</p>
+               <p>Drag & drop this link to your bookmarks bar and have fun with poche.</p>
+                <p><a style="cursor: move; border: 1px dashed grey; background: white;" title="i am a bookmarklet, use me !" href="javascript:(function(){var%20url%20=%20location.href%20||%20url;window.open('{$poche_url}?action=add&url='%20+%20encodeURIComponent(url),'_self');})();">poche it !</a></p>
+                <h2>Export</h2>
+                <p><a href="?view=export" target="_blank">Click here</a> to export your poche datas.</p>
+            </div>
\ No newline at end of file
index 648e1ce9d85098a8dadfbf9754fd61807745de63..8526a3c9dfa9769507c671b19147956acf9f58f2 100644 (file)
@@ -1,3 +1,4 @@
+            <div id="content">
                 {loop="entries"}
                     <div id="entry-{$value.id}" class="entrie mb2">
                         <span class="content">
@@ -13,4 +14,5 @@
                             </div>
                         </span>
                     </div>
-                {/loop}
\ No newline at end of file
+                {/loop}
+            </div>
\ No newline at end of file
diff --git a/tpl/export.html b/tpl/export.html
new file mode 100644 (file)
index 0000000..d22d05f
--- /dev/null
@@ -0,0 +1 @@
+export {$export}
\ No newline at end of file
index 04bedabcbe42e12852c337be6ca81a14efdb4778..b8bd755c8e5a8a68afaaad60319cbc4ad2fb2c01 100644 (file)
@@ -1,6 +1,4 @@
-            </div>
-        </div>
-
+               </div>
         <footer class="mr2 mt3 smaller">
             <p>powered by <a href="http://inthepoche.com">poche</a><br />follow us on <a href="https://twitter.com/getpoche" title="follow us on twitter">twitter</a></p>
         </footer>
index 6fcf9741967e19ba20b5e060312d6fbbac67526b..e95f61001c11bdc8fbc3747755b5da0ab48aa7e0 100644 (file)
@@ -15,9 +15,8 @@
         <link rel="apple-touch-icon-precomposed" href="./img/apple-touch-icon-precomposed.png">
         <link rel="stylesheet" href="./css/knacss.css" media="all">
         <link rel="stylesheet" href="./css/style.css" media="all">
-    </head>
-    <body>
-        <header>
-            <h1><img src="./img/logo.png" alt="logo poche" />poche</h1>
-        </header>
-        <div id="main">
\ No newline at end of file
+        <!-- Light Theme -->
+        <link rel="stylesheet" href="./css/style-light.css" media="all" title="light-style">
+        <!-- Dark Theme -->
+        <link rel="alternate stylesheet" href="./css/style-dark.css" media="all" title="dark-style">
+    </head>
\ No newline at end of file
index 6fb9444cd3bb1e7e00020888f67d011904ae7d8a..ad8819977ca863f3498dfe8708e2aca82c672f1d 100644 (file)
@@ -1,12 +1,19 @@
+    <body class="light-style">
+        <header>
+            <h1><img src="./img/logo.png" alt="logo poche" />poche</h1>
+        </header>
+        <div id="main">
             <ul id="links">
                 <li><a href="index.php" {if="$view == 'index'"}class="current"{/if}>home</a></li>
                 <li><a href="?view=fav" {if="$view == 'fav'"}class="current"{/if}>favorites</a></li>
                 <li><a href="?view=archive" {if="$view == 'archive'"}class="current"{/if}>archive</a></li>
-                <li><a style="cursor: move" title="i am a bookmarklet, use me !" href="javascript:(function(){var%20url%20=%20location.href%20||%20url;window.open('{$poche_url}?action=add&url='%20+%20encodeURIComponent(url),'_self');})();">poche it !</a></li>
+                <li><a href="?view=config" {if="$view == 'config'"}class="current"{/if}>config</a></li>
                 <li><a href="?logout" title="Logout">logout</a></li>
             </ul>
+            {if condition="isset($entries)"} 
             <ul id="sort">
                 <li><img src="img/up.png" onclick="sort_links('{$view}', 'ia');" title="by date asc" /> by date <img src="img/down.png" onclick="sort_links('{$view}', 'id');" title="by date desc" /></li>
                 <li><img src="img/up.png" onclick="sort_links('{$view}', 'ta');" title="by title asc" /> by title <img src="img/down.png" onclick="sort_links('{$view}', 'td');" title="by title desc" /></li>
             </ul>
-            <div id="content">
\ No newline at end of file
+            {/if}
+            {include="messages"}
\ No newline at end of file
index d3139ab36ec779e7e930da23bfcc6047256200e0..12927692eabaa24ccf998ec3aaafcad77f379249 100644 (file)
@@ -1,4 +1,9 @@
 {include="head"}
+    <body class="light-style">
+        <header>
+            <h1><img src="./img/logo.png" alt="logo poche" />poche</h1>
+        </header>
+        <div id="main">
             <form method="post" action="?login" name="loginform">
                 <fieldset>
                     <h2>login to your poche</h2>
@@ -20,4 +25,7 @@
                 <input type="hidden" name="returnurl" value="<?php echo htmlspecialchars($referer);?>">
                 <input type="hidden" name="token" value="<?php echo Session::getToken(); ?>">
             </form>
-{include="footer"}
\ No newline at end of file
+            <script type="text/javascript">
+            window.onload = document.loginform.login.focus();
+            </script>
+{include="footer"}
diff --git a/tpl/messages.html b/tpl/messages.html
new file mode 100644 (file)
index 0000000..87af259
--- /dev/null
@@ -0,0 +1 @@
+<div id="messages"><?php echo $msg->display(); ?></div>
\ No newline at end of file
index 4b8ce60fbba104c25362dc0ccd758dc8a346f607..4384631b41925e1b327c3ee5668e23d79711feab 100644 (file)
         <link rel="apple-touch-icon-precomposed" href="./img/apple-touch-icon-precomposed.png">
         <link rel="stylesheet" href="./css/knacss.css" media="all">
         <link rel="stylesheet" href="./css/style.css" media="all">
+        <!-- Light Theme -->
+        <link rel="stylesheet" href="./css/style-light.css" media="all" title="light-style">
+        <!-- Dark Theme -->
+        <link rel="alternate stylesheet" href="./css/style-dark.css" media="all" title="dark-style">
     </head>
-    <body class="article">
+    <body class="article light-style">
         <div id="article" class="w600p">
                <div class="backhome">
                        <a href="index.php" title="back to home">&larr;</a>
@@ -24,6 +28,7 @@
             <div class="tools">
                 <ul>
                     <li><a title="toggle mark as read" class="tool archive {if="$is_read == '0'"}archive-off{/if}" onclick="toggle_archive(this, {$id})"><span></span></a></li>
+                    <li><a href="#" id="themeswitch">dark</a></li>
                     <li><a title="toggle favorite" class="tool fav {if="$is_fav == '0'"}fav-off{/if}" onclick="toggle_favorite(this, {$id})"><span></span></a></li>
                     <li><form method="post" onsubmit="return confirm('Are you sure?')" style="display: inline;" action="index.php"><input type="hidden" name="token" id="token" value="<?php echo Session::getToken(); ?>" /><input type="hidden" id="view" name="view" value="index" /><input type="hidden" id="action" name="action" value="delete" /><input type="hidden" id="id" name="id" value="{$id}" /><input type="submit" class="delete" title="toggle delete" /></form></li>
                     <li><a href="?logout" title="Logout">logout</a></li>
             <div class="backhome">
                 <a href="index.php" title="back to home">&larr;</a>
             </div>
-        </div>
 
         {include="js"}
-
-        <footer class="mr2 mt3 smaller">
-            <p>powered by <a href="http://inthepoche.com">poche</a><br />follow us on <a href="https://twitter.com/getpoche" title="follow us on twitter">twitter</a></p>
-        </footer>
-
-    </body>
-</html>
\ No newline at end of file
+        {include="footer"}
\ No newline at end of file