Ajout d'un export json pour la liste des medias

modified:   autoblog-0.3.php
	modified:   config.php
This commit is contained in:
Oros 2013-02-06 22:42:45 +01:00
parent 907f4e4f64
commit ed6eb9fe09
2 changed files with 19 additions and 1 deletions

View file

@ -590,6 +590,19 @@ 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 +804,8 @@ echo '
<div class="footer">
<p>Powered by VroumVroumBlog '.$vvbversion.' - <a href="?feed">'.__('RSS Feed').'</a></p>
<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>';
if ($vvb->mustUpdate())

View file

@ -40,6 +40,10 @@ function __($str)
case 'configuration':
case 'articles':
return $str;
case 'Media export':
return 'Export fichiers media';
default:
return $str;
}
}