aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--inc/poche/Poche.class.php22
-rw-r--r--inc/poche/config.inc.php2
-rw-r--r--tpl/config.twig8
3 files changed, 31 insertions, 1 deletions
diff --git a/inc/poche/Poche.class.php b/inc/poche/Poche.class.php
index 12cb1b42..f9bcf85b 100644
--- a/inc/poche/Poche.class.php
+++ b/inc/poche/Poche.class.php
@@ -130,6 +130,16 @@ class Poche
130 switch ($view) 130 switch ($view)
131 { 131 {
132 case 'config': 132 case 'config':
133 $dev = $this->getPocheVersion('dev');
134 $prod = $this->getPocheVersion('prod');
135 $compare_dev = version_compare(POCHE_VERSION, $dev);
136 $compare_prod = version_compare(POCHE_VERSION, $prod);
137 $tpl_vars = array(
138 'dev' => $dev,
139 'prod' => $prod,
140 'compare_dev' => $compare_dev,
141 'compare_prod' => $compare_prod,
142 );
133 Tools::logm('config view'); 143 Tools::logm('config view');
134 break; 144 break;
135 case 'view': 145 case 'view':
@@ -315,4 +325,16 @@ class Poche
315 )); 325 ));
316 Tools::logm('export view'); 326 Tools::logm('export view');
317 } 327 }
328
329 private function getPocheVersion($which = 'prod')
330 {
331 $cache_file = CACHE . '/' . $which;
332 if (file_exists($cache_file) && (filemtime($cache_file) > (time() - 86400 ))) {
333 $version = file_get_contents($cache_file);
334 } else {
335 $version = file_get_contents('http://www.inthepoche.com/' . $which);
336 file_put_contents($cache_file, $version, LOCK_EX);
337 }
338 return $version;
339 }
318} \ No newline at end of file 340} \ No newline at end of file
diff --git a/inc/poche/config.inc.php b/inc/poche/config.inc.php
index eb0c1bb5..27be1857 100644
--- a/inc/poche/config.inc.php
+++ b/inc/poche/config.inc.php
@@ -36,7 +36,7 @@ require_once './vendor/autoload.php';
36require_once './inc/3rdparty/simple_html_dom.php'; 36require_once './inc/3rdparty/simple_html_dom.php';
37 37
38if (DOWNLOAD_PICTURES) { 38if (DOWNLOAD_PICTURES) {
39 require_once './inc/poche/pochePicture.php'; 39 require_once './inc/poche/pochePictures.php';
40} 40}
41 41
42$poche = new Poche($storage_type); \ No newline at end of file 42$poche = new Poche($storage_type); \ No newline at end of file
diff --git a/tpl/config.twig b/tpl/config.twig
index dc49ee39..a17a4b17 100644
--- a/tpl/config.twig
+++ b/tpl/config.twig
@@ -17,6 +17,14 @@
17 <p>{% trans "Drag & drop this link to your bookmarks bar and have fun with poche." %}</p> 17 <p>{% trans "Drag & drop this link to your bookmarks bar and have fun with poche." %}</p>
18 <p><a ondragend="this.click();" style="cursor: move; border: 1px dashed grey; background: white;" title="i am a bookmarklet, use me !" href="javascript:if(top['bookmarklet-url@inthepoche.com']){top['bookmarklet-url@inthepoche.com'];}else{(function(){var%20url%20=%20location.href%20||%20url;window.open('{{ poche_url }}?action=add&url='%20+%20btoa(url),'_self');})();void(0);}">{% trans "poche it!" %}</a></p> 18 <p><a ondragend="this.click();" style="cursor: move; border: 1px dashed grey; background: white;" title="i am a bookmarklet, use me !" href="javascript:if(top['bookmarklet-url@inthepoche.com']){top['bookmarklet-url@inthepoche.com'];}else{(function(){var%20url%20=%20location.href%20||%20url;window.open('{{ poche_url }}?action=add&url='%20+%20btoa(url),'_self');})();void(0);}">{% trans "poche it!" %}</a></p>
19 19
20 <h2>{% trans "Updating poche" %}</h2>
21 <p><ul>
22 <li>{% trans "your version" %} : <strong>{{ constant('POCHE_VERSION') }}</strong></li>
23 <li>{% trans "latest stable version" %} : {{ prod }}. {% if compare_prod == -1 %}<strong>{% trans "a more recent stable version is available." %}</strong>{% else %}{% trans "you are up to date." %}{% endif %}</li>
24 <li>{% trans "latest dev version" %} : {{ dev }}. {% if compare_dev == -1 %}<strong>{% trans "a more recent development version is available." %}</strong>{% else %}{% trans "you are up to date." %}{% endif %}</li>
25 </ul>
26 </p>
27
20 <h2>{% trans "Change your password" %}</h2> 28 <h2>{% trans "Change your password" %}</h2>
21 <form method="post" action="?config" name="loginform"> 29 <form method="post" action="?config" name="loginform">
22 <fieldset class="w500p"> 30 <fieldset class="w500p">