From 34140b87613e680d55753c3f8c205e32d62637c2 Mon Sep 17 00:00:00 2001 From: Oros Date: Wed, 6 Feb 2013 22:14:38 +0100 Subject: [PATCH] Ajout d'un export json pour la liste des medias modified: autoblog-0.3.php modified: config.php --- _experimental/autoblog-0.3.php | 26 +++++++++++++++++++++++--- _experimental/config.php | 4 ++++ _experimental/vvb.ini | 6 +++--- 3 files changed, 30 insertions(+), 6 deletions(-) diff --git a/_experimental/autoblog-0.3.php b/_experimental/autoblog-0.3.php index 666e72d..9a486db 100755 --- a/_experimental/autoblog-0.3.php +++ b/_experimental/autoblog-0.3.php @@ -225,7 +225,6 @@ class VroumVroum_Blog $create_articles_db = file_exists(ARTICLES_DB_FILE) ? false : true; $this->articles = new SQLite3(ARTICLES_DB_FILE); - if ($create_articles_db) { $this->articles->exec(' @@ -323,7 +322,13 @@ class VroumVroum_Blog if (isset($_GET['update'])) return true; - $last_update = $this->articles->querySingle('SELECT date FROM update_log ORDER BY date DESC LIMIT 1;'); + if($this->articles->busyTimeout(2000)){ + $last_update = $this->articles->querySingle('SELECT date FROM update_log ORDER BY date DESC LIMIT 1;'); + }else{ + return false; + } + + $this->articles->busyTimeout(0); if (!empty($last_update) && (int) $last_update > (time() - $this->config->update_interval)) return false; @@ -590,6 +595,20 @@ if (isset($_GET['feed'])) // FEED exit; } + +if (isset($_GET['media'])) // MEDIA +{ + header('Content-Type: application/json'); + if(is_dir(MEDIA_DIR)) + { + $files = scandir(MEDIA_DIR); + unset($files[0]); // . + unset($files[1]); // .. + echo json_encode(array("url"=> LOCAL_URL.substr(MEDIA_DIR, strlen(ROOT_DIR)+1).'/', "files" => $files)); + } + exit; +} + if (isset($_GET['update'])) { $_SERVER['QUERY_STRING'] = ''; @@ -791,7 +810,8 @@ echo ' '; if ($vvb->mustUpdate()) diff --git a/_experimental/config.php b/_experimental/config.php index 1c3ec6a..de7d943 100755 --- a/_experimental/config.php +++ b/_experimental/config.php @@ -40,6 +40,10 @@ function __($str) case 'configuration': case 'articles': return $str; + case 'Media export': + return 'Export fichiers media'; + default: + return $str; } } diff --git a/_experimental/vvb.ini b/_experimental/vvb.ini index e7cdee8..18bf39e 100644 --- a/_experimental/vvb.ini +++ b/_experimental/vvb.ini @@ -1,9 +1,9 @@ [VroumVroumBlogConfig] -SITE_TYPE="microblog" +SITE_TYPE="generic" SITE_TITLE="identica-gatitac" SITE_DESCRIPTION="Automicroblog de @gatitac" -SITE_URL="http://identi.ca/gatitac" -FEED_URL="http://identi.ca/api/statuses/user_timeline/gatitac.rss" +SITE_URL="http://korben.info/" +FEED_URL="http://korben.info/feed" ARTICLES_PER_PAGE=10 UPDATE_INTERVAL=3600 UPDATE_TIMEOUT=30