Ajout d'un export json pour la liste des medias
modified: autoblog-0.3.php modified: config.php
This commit is contained in:
parent
cecde7f204
commit
34140b8761
3 changed files with 30 additions and 6 deletions
|
@ -225,7 +225,6 @@ class VroumVroum_Blog
|
||||||
$create_articles_db = file_exists(ARTICLES_DB_FILE) ? false : true;
|
$create_articles_db = file_exists(ARTICLES_DB_FILE) ? false : true;
|
||||||
|
|
||||||
$this->articles = new SQLite3(ARTICLES_DB_FILE);
|
$this->articles = new SQLite3(ARTICLES_DB_FILE);
|
||||||
|
|
||||||
if ($create_articles_db)
|
if ($create_articles_db)
|
||||||
{
|
{
|
||||||
$this->articles->exec('
|
$this->articles->exec('
|
||||||
|
@ -323,7 +322,13 @@ class VroumVroum_Blog
|
||||||
if (isset($_GET['update']))
|
if (isset($_GET['update']))
|
||||||
return true;
|
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))
|
if (!empty($last_update) && (int) $last_update > (time() - $this->config->update_interval))
|
||||||
return false;
|
return false;
|
||||||
|
@ -590,6 +595,20 @@ if (isset($_GET['feed'])) // FEED
|
||||||
exit;
|
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']))
|
if (isset($_GET['update']))
|
||||||
{
|
{
|
||||||
$_SERVER['QUERY_STRING'] = '';
|
$_SERVER['QUERY_STRING'] = '';
|
||||||
|
@ -791,7 +810,8 @@ echo '
|
||||||
<div class="footer">
|
<div class="footer">
|
||||||
<p>Powered by VroumVroumBlog '.$vvbversion.' - <a href="?feed">'.__('RSS Feed').'</a></p>
|
<p>Powered by VroumVroumBlog '.$vvbversion.' - <a href="?feed">'.__('RSS Feed').'</a></p>
|
||||||
<p>'.__('Download:').' <a href="'.LOCAL_URL.basename(CONFIG_FILE).'">'.__('configuration').'</a>
|
<p>'.__('Download:').' <a href="'.LOCAL_URL.basename(CONFIG_FILE).'">'.__('configuration').'</a>
|
||||||
- <a href="'.LOCAL_URL.basename(ARTICLES_DB_FILE).'">'.__('articles').'</a></p>
|
- <a href="'.LOCAL_URL.basename(ARTICLES_DB_FILE).'">'.__('articles').'</a><p/>
|
||||||
|
<p><a href="'.LOCAL_URL.'?media">'.__('Media export').' <sup> JSON</sup></a></p>
|
||||||
</div>';
|
</div>';
|
||||||
|
|
||||||
if ($vvb->mustUpdate())
|
if ($vvb->mustUpdate())
|
||||||
|
|
|
@ -40,6 +40,10 @@ function __($str)
|
||||||
case 'configuration':
|
case 'configuration':
|
||||||
case 'articles':
|
case 'articles':
|
||||||
return $str;
|
return $str;
|
||||||
|
case 'Media export':
|
||||||
|
return 'Export fichiers media';
|
||||||
|
default:
|
||||||
|
return $str;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,9 +1,9 @@
|
||||||
[VroumVroumBlogConfig]
|
[VroumVroumBlogConfig]
|
||||||
SITE_TYPE="microblog"
|
SITE_TYPE="generic"
|
||||||
SITE_TITLE="identica-gatitac"
|
SITE_TITLE="identica-gatitac"
|
||||||
SITE_DESCRIPTION="Automicroblog de @gatitac"
|
SITE_DESCRIPTION="Automicroblog de @gatitac"
|
||||||
SITE_URL="http://identi.ca/gatitac"
|
SITE_URL="http://korben.info/"
|
||||||
FEED_URL="http://identi.ca/api/statuses/user_timeline/gatitac.rss"
|
FEED_URL="http://korben.info/feed"
|
||||||
ARTICLES_PER_PAGE=10
|
ARTICLES_PER_PAGE=10
|
||||||
UPDATE_INTERVAL=3600
|
UPDATE_INTERVAL=3600
|
||||||
UPDATE_TIMEOUT=30
|
UPDATE_TIMEOUT=30
|
||||||
|
|
Loading…
Reference in a new issue