Esempio n. 1
0
     echo json_encode($jsonResponse);
     break;
 case 'rss':
     header('Content-Type: text/xml; charset=utf-8');
     $events = getEvents();
     if (!file_exists(CACHE_RSS) || time() - filemtime(CACHE_RSS) > REFRESH_RSS_TIME) {
         $rss = new Rss(APPLICATION_TITLE, $_SERVER['REMOTE_ADDR']);
         foreach ($events as $event) {
             switch ($event->type) {
                 case 'UPDATE_FILE':
                     $title = $event->user . ' a modifié la page ' . $event->page . ' le ' . $event->date;
                     break;
             }
             $rss->add($title, $event->date, $event->link, $title);
         }
         file_put_contents(CACHE_RSS, $rss->publish());
     }
     echo file_get_contents(CACHE_RSS);
     break;
 case 'files':
     $keyword = strtolower(isset($_['keyword']) ? $_['keyword'] : '');
     $files = glob(UPLOAD_FOLDER . '/*/*/*' . $keyword . '*');
     foreach ($files as $file) {
         if (is_file($file)) {
             $onclick = '';
             $dotpos = strrpos($file, '.');
             $extension = $dotpos !== false ? strtoupper(substr($file, $dotpos + 1)) : '';
             switch ($extension) {
                 case 'JPG':
                 case 'JPEG':
                 case 'PNG':