/** * embed an interactive object * * The id designates the target file. * It can also include width and height of the target canvas, as in: '12, 100%, 250px' * * @param string id of the target file * @return string the rendered string **/ public static function render_embed($id) { global $context; // split parameters $attributes = preg_split("/\\s*,\\s*/", $id, 4); $id = $attributes[0]; // get the file if (!($item = Files::get($id))) { $output = '[embed=' . $id . ']'; return $output; } // stream in a separate page if (isset($attributes[1]) && preg_match('/window/i', $attributes[1])) { if (!isset($attributes[2])) { $attributes[2] = i18n::s('Play in a separate window'); } $output = '<a href="' . $context['url_to_home'] . $context['url_to_root'] . Files::get_url($item['id'], 'stream', $item['file_name']) . '" onclick="window.open(this.href); return false;" class="button"><span>' . $attributes[2] . '</span></a>'; return $output; } // file extension $extension = strtolower(substr($item['file_name'], -3)); // set a default size if (!isset($attributes[1])) { if (!strcmp($extension, 'gan')) { $attributes[1] = '98%'; } elseif (!strcmp($extension, 'mm') && isset($context['skins_freemind_canvas_width'])) { $attributes[1] = $context['skins_freemind_canvas_width']; } else { $attributes[1] = 480; } } if (!isset($attributes[2])) { if (!strcmp($extension, 'gan')) { $attributes[2] = '300px'; } elseif (!strcmp($extension, 'mm') && isset($context['skins_freemind_canvas_height'])) { $attributes[2] = $context['skins_freemind_canvas_height']; } else { $attributes[2] = 360; } } // object attributes $width = $attributes[1]; $height = $attributes[2]; $flashvars = ''; if (isset($attributes[3])) { $flashvars = $attributes[3]; } // rendering depends on file extension switch ($extension) { // stream a video case '3gp': case 'flv': case 'm4v': case 'mov': case 'mp4': // a flash player to stream a flash video $flvplayer_url = $context['url_to_home'] . $context['url_to_root'] . 'included/browser/player_flv_maxi.swf'; // file is elsewhere if (isset($item['file_href']) && $item['file_href']) { $url = $item['file_href']; } else { $url = $context['url_to_home'] . $context['url_to_root'] . Files::get_url($item['id'], 'fetch', $item['file_name']); } // pass parameters to the player if ($flashvars) { $flashvars = str_replace('autostart=true', 'autoplay=1', $flashvars) . '&'; } $flashvars .= 'width=' . $width . '&height=' . $height; // if there is a static image for this video, use it if (isset($item['icon_url']) && $item['icon_url']) { $flashvars .= '&startimage=' . urlencode($item['icon_url']); } // if there is a subtitle file for this video, use it if (isset($item['file_name']) && ($srt = 'files/' . str_replace(':', '/', $item['anchor']) . '/' . str_replace('.' . $extension, '.srt', $item['file_name'])) && file_exists($context['path_to_root'] . $srt)) { $flashvars .= '&srt=1&srturl=' . urlencode($context['url_to_home'] . $context['url_to_root'] . $srt); } // if there is a logo file in the skin, use it Skin::define_img_href('FLV_IMG_HREF', 'codes/flvplayer_logo.png', ''); if (FLV_IMG_HREF) { $flashvars .= '&top1=' . urlencode(FLV_IMG_HREF . '|10|10'); } // rely on Flash if (Surfer::has_flash()) { // the full object is built in Javascript --see parameters at http://flv-player.net/players/maxi/documentation/ $output = '<div id="flv_' . $item['id'] . '" class="no_print">Flash plugin or Javascript are turned off. Activate both and reload to view the object</div>' . "\n"; Page::insert_script('var flashvars = { flv:"' . $url . '", ' . str_replace(array('&', '='), array('", ', ':"'), $flashvars) . '", autoload:0, margin:1, showiconplay:1, playeralpha:50, iconplaybgalpha:30, showfullscreen:1, showloading:"always", ondoubleclick:"fullscreen" }' . "\n" . 'var params = { allowfullscreen: "true", allowscriptaccess: "always" }' . "\n" . 'var attributes = { id: "file_' . $item['id'] . '", name: "file_' . $item['id'] . '"}' . "\n" . 'swfobject.embedSWF("' . $flvplayer_url . '", "flv_' . $item['id'] . '", "' . $width . '", "' . $height . '", "9", "' . $context['url_to_home'] . $context['url_to_root'] . 'included/browser/expressinstall.swf", flashvars, params);' . "\n"); // native support } else { // <video> is HTML5, <object> is legacy $output = '<video width="' . $width . '" height="' . $height . '" autoplay="" controls="" src="' . $url . '" >' . "\n" . ' <object width="' . $width . '" height="' . $height . '" data="' . $url . '" type="' . Files::get_mime_type($item['file_name']) . '">' . "\n" . ' <param value="' . $url . '" name="movie" />' . "\n" . ' <param value="true" name="allowFullScreen" />' . "\n" . ' <param value="always" name="allowscriptaccess" />' . "\n" . ' <a href="' . $url . '">No video playback capabilities, please download the file</a>' . "\n" . ' </object>' . "\n" . '</video>' . "\n"; } // job done return $output; // a ganttproject timeline // a ganttproject timeline case 'gan': // where the file is $path = Files::get_path($item['anchor']) . '/' . rawurlencode($item['file_name']); // we actually use a transformed version of the file $cache_id = Cache::hash($path) . '.xml'; // apply the transformation if (!file_exists($context['path_to_root'] . $cache_id) || filemtime($context['path_to_root'] . $cache_id) < filemtime($context['path_to_root'] . $path) || !($text = Safe::file_get_contents($context['path_to_root'] . $cache_id))) { // transform from GanttProject to SIMILE Timeline $text = Files::transform_gan_to_simile($path); // put in cache Safe::file_put_contents($cache_id, $text); } // load the SIMILE Timeline javascript library in shared/global.php $context['javascript']['timeline'] = TRUE; // cache would kill the loading of the library cache::poison(); // 1 week ago $now = gmdate('M d Y H:i:s', time() - 7 * 24 * 60 * 60); // load the right file $output = '<div id="gantt" style="height: ' . $height . '; width: ' . $width . '; border: 1px solid #aaa; font-family: Trebuchet MS, Helvetica, Arial, sans serif; font-size: 8pt"></div>' . "\n"; Page::insert_script('var simile_handle;' . "\n" . 'function onLoad() {' . "\n" . ' var eventSource = new Timeline.DefaultEventSource();' . "\n" . ' var theme = Timeline.ClassicTheme.create();' . "\n" . ' theme.event.bubble.width = 350;' . "\n" . ' theme.event.bubble.height = 300;' . "\n" . ' var bandInfos = [' . "\n" . ' Timeline.createBandInfo({' . "\n" . ' eventSource: eventSource,' . "\n" . ' date: "' . $now . '",' . "\n" . ' width: "80%",' . "\n" . ' intervalUnit: Timeline.DateTime.WEEK,' . "\n" . ' intervalPixels: 200,' . "\n" . ' theme: theme,' . "\n" . ' layout: "original" // original, overview, detailed' . "\n" . ' }),' . "\n" . ' Timeline.createBandInfo({' . "\n" . ' showEventText: false,' . "\n" . ' trackHeight: 0.5,' . "\n" . ' trackGap: 0.2,' . "\n" . ' eventSource: eventSource,' . "\n" . ' date: "' . $now . '",' . "\n" . ' width: "20%",' . "\n" . ' intervalUnit: Timeline.DateTime.MONTH,' . "\n" . ' intervalPixels: 50' . "\n" . ' })' . "\n" . ' ];' . "\n" . ' bandInfos[1].syncWith = 0;' . "\n" . ' bandInfos[1].highlight = true;' . "\n" . ' bandInfos[1].eventPainter.setLayout(bandInfos[0].eventPainter.getLayout());' . "\n" . ' simile_handle = Timeline.create(document.getElementById("gantt"), bandInfos, Timeline.HORIZONTAL);' . "\n" . ' simile_handle.showLoadingMessage();' . "\n" . ' Timeline.loadXML("' . $context['url_to_home'] . $context['url_to_root'] . $cache_id . '", function(xml, url) { eventSource.loadXML(xml, url); });' . "\n" . ' simile_handle.hideLoadingMessage();' . "\n" . '}' . "\n" . "\n" . 'var resizeTimerID = null;' . "\n" . 'function onResize() {' . "\n" . ' if (resizeTimerID == null) {' . "\n" . ' resizeTimerID = window.setTimeout(function() {' . "\n" . ' resizeTimerID = null;' . "\n" . ' simile_handle.layout();' . "\n" . ' }, 500);' . "\n" . ' }' . "\n" . '}' . "\n" . "\n" . '// observe page major events' . "\n" . '$(document).ready( onLoad);' . "\n" . '$(window).resize(onResize);' . "\n"); // job done return $output; // a Freemind map // a Freemind map case 'mm': // if we have an external reference, use it if (isset($item['file_href']) && $item['file_href']) { $target_href = $item['file_href']; // else redirect to ourself } else { // ensure a valid file name $file_name = utf8::to_ascii($item['file_name']); // where the file is $path = Files::get_path($item['anchor']) . '/' . rawurlencode($item['file_name']); // map the file on the regular web space $url_prefix = $context['url_to_home'] . $context['url_to_root']; // redirect to the actual file $target_href = $url_prefix . $path; } // allow several viewers to co-exist in the same page static $freemind_viewer_index; if (!isset($freemind_viewer_index)) { $freemind_viewer_index = 1; } else { $freemind_viewer_index++; } // load flash player $url = $context['url_to_home'] . $context['url_to_root'] . 'included/browser/visorFreemind.swf'; // variables $flashvars = 'initLoadFile=' . $target_href . '&openUrl=_self'; $output = '<div id="freemind_viewer_' . $freemind_viewer_index . '">Flash plugin or Javascript are turned off. Activate both and reload to view the object</div>' . "\n"; Page::insert_script('var params = {};' . "\n" . 'params.base = "' . dirname($url) . '/";' . "\n" . 'params.quality = "high";' . "\n" . 'params.wmode = "transparent";' . "\n" . 'params.menu = "false";' . "\n" . 'params.flashvars = "' . $flashvars . '";' . "\n" . 'swfobject.embedSWF("' . $url . '", "freemind_viewer_' . $freemind_viewer_index . '", "' . $width . '", "' . $height . '", "6", "' . $context['url_to_home'] . $context['url_to_root'] . 'included/browser/expressinstall.swf", false, params);' . "\n"); // offer to download a copy of the map $menu = array($target_href => i18n::s('Browse this map with Freemind')); // display menu commands below the viewer $output .= Skin::build_list($menu, 'menu_bar'); // job done return $output; // native flash // native flash case 'swf': // where to get the file if (isset($item['file_href']) && $item['file_href']) { $url = $item['file_href']; } else { $url = $context['url_to_home'] . $context['url_to_root'] . 'files/' . str_replace(':', '/', $item['anchor']) . '/' . rawurlencode($item['file_name']); } $output = '<div id="swf_' . $item['id'] . '" class="no_print">Flash plugin or Javascript are turned off. Activate both and reload to view the object</div>' . "\n"; Page::insert_script('var params = {};' . "\n" . 'params.base = "' . dirname($url) . '/";' . "\n" . 'params.quality = "high";' . "\n" . 'params.wmode = "transparent";' . "\n" . 'params.allowfullscreen = "true";' . "\n" . 'params.allowscriptaccess = "always";' . "\n" . 'params.flashvars = "' . $flashvars . '";' . "\n" . 'swfobject.embedSWF("' . $url . '", "swf_' . $item['id'] . '", "' . $width . '", "' . $height . '", "6", "' . $context['url_to_home'] . $context['url_to_root'] . 'included/browser/expressinstall.swf", false, params);' . "\n"); return $output; // link to file page // link to file page default: // link label $text = Skin::strip($item['title'] ? $item['title'] : str_replace('_', ' ', $item['file_name'])); // make a link to the target page $url = Files::get_permalink($item); // return a complete anchor $output =& Skin::build_link($url, $text); return $output; } }
if (!$permitted) { // give anonymous surfers a chance for HTTP authentication if (!Surfer::is_logged()) { Safe::header('WWW-Authenticate: Basic realm="' . utf8::to_iso8859($context['site_name']) . '"'); Safe::header('Status: 401 Unauthorized', TRUE, 401); } // permission denied to authenticated user Safe::header('Status: 401 Unauthorized', TRUE, 401); Logger::error(i18n::s('You are not allowed to perform this operation.')); // display feed content } else { // get the list from the cache, if possible if (is_object($anchor)) { $cache_id = Cache::hash('comments/feed/' . $anchor->get_reference) . '.xml'; } else { $cache_id = Cache::hash('comments/feed') . '.xml'; } // save for 5 minutes if (!file_exists($context['path_to_root'] . $cache_id) || filemtime($context['path_to_root'] . $cache_id) + 300 < time() || !($text = Safe::file_get_contents($context['path_to_root'] . $cache_id))) { $text = ''; // loads feeding parameters Safe::load('parameters/feeds.include.php'); // set channel information $values = array(); $values['channel'] = array(); if (is_object($anchor)) { $values['channel']['title'] = sprintf(i18n::s('Comments for: %s'), $anchor->get_title()); $values['channel']['link'] = $context['url_to_home'] . $context['url_to_root'] . $anchor->get_url(); $values['channel']['description'] = $anchor->get_teaser('quote'); } else { $values['channel']['title'] = sprintf(i18n::s('Recent comments at %s'), $context['site_name']);
/** * list articles * * @param resource the SQL result * @return string the rendered text * * @see layouts/layout.php **/ function layout($result) { global $context; // we return some text $text = ''; // empty list if (!SQL::count($result)) { return $text; } // sanity check if (!isset($this->focus)) { $this->focus = 'map'; } // put in cache $cache_id = Cache::hash('articles/layout_articles_as_carrousel:' . $this->focus) . '.xml'; // save for one minute if (!file_exists($context['path_to_root'] . $cache_id) || filemtime($context['path_to_root'] . $cache_id) + 60 < time()) { // content of the slideshow $content = '<?xml version="1.0" encoding="utf-8"?><!-- fhShow Carousel 2.0 configuration file Please visit http://www.flshow.net/ -->' . "\n" . '<slide_show>' . "\n" . ' <options>' . "\n" . ' <debug>false</debug> <!-- true, false -->' . "\n" . ' <background>transparent</background> <!-- #RRGGBB, transparent -->' . "\n" . ' <friction>5</friction> <!-- [1,100] -->' . "\n" . ' <fullscreen>false</fullscreen> <!-- true, false -->' . "\n" . ' <margins>' . "\n" . ' <top>0</top> <!-- [-1000,1000] pixels -->' . "\n" . ' <left>0</left> <!-- [-1000,1000] pixels -->' . "\n" . ' <bottom>0</bottom> <!-- [-1000,1000] pixels -->' . "\n" . ' <right>0</right> <!-- [-1000,1000] pixels -->' . "\n" . ' <horizontal_ratio>20%</horizontal_ratio> <!-- [1,50] a photo may occupy at most horizontalRatio percent of the Carousel width -->' . "\n" . ' <vertical_ratio>90%</vertical_ratio> <!-- [1,100] a photo may occupy at most verticalRatio percent of the Carousel height -->' . "\n" . ' </margins>' . "\n" . ' <interaction>' . "\n" . ' <rotation>mouse</rotation> <!-- auto, mouse, keyboard -->' . "\n" . ' <view_point>none</view_point> <!-- none, mouse, keyboard -->' . "\n" . ' <speed>15</speed> <!-- [-360,360] degrees per second -->' . "\n" . ' <default_speed>15</default_speed> <!-- [-360,360] degrees per second -->' . "\n" . ' <default_view_point>20%</default_view_point> <!-- [0,100] percentage -->' . "\n" . ' <reset_delay>20</reset_delay> <!-- [0,600] seconds, 0 means never reset -->' . "\n" . ' </interaction>' . "\n" . ' <far_photos>' . "\n" . ' <size>50%</size> <!-- [0,100] percentage -->' . "\n" . ' <amount>50%</amount> <!-- [0,100] percentage -->' . "\n" . ' <blur>10</blur> <!-- [0,100] amount -->' . "\n" . ' <blur_quality>3</blur_quality> <!-- [1,3] 1=low - 3=high -->' . "\n" . ' </far_photos>' . "\n" . ' <reflection>' . "\n" . ' <amount>25</amount> <!-- [0,1000] pixels -->' . "\n" . ' <blur>2</blur> <!-- [0,100] blur amount -->' . "\n" . ' <distance>0</distance> <!-- [-1000,1000] pixels -->' . "\n" . ' <alpha>40%</alpha> <!-- [0,100] percentage -->' . "\n" . ' </reflection>' . "\n" . ' <titles>' . "\n" . ' <style>font-size: 14px; font-family: Verdana, _serif; color: #000000;</style>' . "\n" . ' <position>above center</position> <!-- [above, below] [left,center,right]-->' . "\n" . ' <background>' . $context['url_to_home'] . $context['url_to_root'] . 'skins/_reference/layouts/carrousel_bubble.png</background> <!-- image url -->' . "\n" . ' <scale9>35 35 35 35</scale9> <!-- [0,1000] pixels -->' . "\n" . ' <padding>8 15 10 15</padding> <!-- [-1000,1000] pixels -->' . "\n" . ' </titles>' . "\n" . ' </options>' . "\n"; // get a default image if (Safe::GetImageSize($context['path_to_root'] . $context['skin'] . '/layouts/map.gif')) { $default_href = $context['url_to_root'] . $context['skin'] . '/layouts/map.gif'; } elseif ($size = Safe::GetImageSize($context['path_to_root'] . 'skins/_reference/layouts/map.gif')) { $default_href = $context['url_to_root'] . 'skins/_reference/layouts/map.gif'; } else { $default_href = NULL; } // process all items in the list while ($item = SQL::fetch($result)) { // get the related overlay $overlay = Overlay::load($item, 'article:' . $item['id']); // get the anchor $anchor = Anchors::get($item['anchor']); // this is visual if (isset($item['icon_url']) && $item['icon_url']) { $image = $item['icon_url']; } elseif (isset($item['thumbnail_url']) && $item['thumbnail_url']) { $image = $item['thumbnail_url']; } elseif (is_callable(array($anchor, 'get_bullet_url')) && ($image = $anchor->get_bullet_url())) { } elseif ($default_href) { $image = $default_href; } else { continue; } // fix relative path if (!preg_match('/^(\\/|http:|https:|ftp:)/', $image)) { $image = $context['url_to_home'] . $context['url_to_root'] . $image; } // build a title if (is_object($overlay)) { $title = Codes::beautify_title($overlay->get_text('title', $item)); } else { $title = Codes::beautify_title($item['title']); } // the url to view this item $url = Articles::get_permalink($item); // add to the list $content .= ' <photo>' . "\n" . ' <title>' . $title . '</title>' . "\n" . ' <src>' . $image . '</src>' . "\n" . ' <href>' . $url . '</href>' . "\n" . ' <target>_self</target>' . "\n" . ' </photo>' . "\n"; } // finalize slideshow content $content .= '</slide_show>'; // put in cache Safe::file_put_contents($cache_id, $content); } // allow multiple instances static $count; if (!isset($count)) { $count = 1; } else { $count++; } // load the right file $text = '<div id="articles_as_carrousel_' . $count . '"></div>' . "\n"; Page::insert_script('swfobject.embedSWF("' . $context['url_to_home'] . $context['url_to_root'] . 'included/browser/carrousel.swf",' . "\n" . '"articles_as_carrousel_' . $count . '",' . "\n" . '"100%",' . "\n" . '"150",' . "\n" . '"9.0.0",' . "\n" . 'false,' . "\n" . '{xmlfile:"' . $context['url_to_home'] . $context['url_to_root'] . $cache_id . '", loaderColor:"0x666666"},' . "\n" . '{wmode: "transparent"},' . "\n" . '{});' . "\n"); // end of processing SQL::free($result); return $text; }
if (!$permitted) { // give anonymous surfers a chance for HTTP authentication if (!Surfer::is_logged()) { Safe::header('WWW-Authenticate: Basic realm="' . utf8::to_iso8859($context['site_name']) . '"'); Safe::header('Status: 401 Unauthorized', TRUE, 401); } // permission denied to authenticated user Safe::header('Status: 401 Unauthorized', TRUE, 401); Logger::error(i18n::s('You are not allowed to perform this operation.')); // display feed content } else { // get the list from the cache, if possible if (is_object($anchor)) { $cache_id = Cache::hash('files/feed/' . $anchor->get_reference()) . '.xml'; } else { $cache_id = Cache::hash('files/feed') . '.xml'; } // save for 5 minutes if (!file_exists($context['path_to_root'] . $cache_id) || filemtime($context['path_to_root'] . $cache_id) + 300 < time() || !($text = Safe::file_get_contents($context['path_to_root'] . $cache_id))) { $text = ''; // loads feeding parameters Safe::load('parameters/feeds.include.php'); // set channel information $values = array(); $values['channel'] = array(); $values['channel']['title'] = sprintf(i18n::c('Files at %s'), $context['site_name']); $values['channel']['link'] = $context['url_to_home'] . $context['url_to_root'] . 'files/'; $values['channel']['description'] = i18n::c('Most recent public files'); // the image for this channel if (isset($context['powered_by_image']) && $context['powered_by_image']) { $values['channel']['image'] = $context['url_to_home'] . $context['url_to_root'] . $context['powered_by_image'];
* @link https://www.google.com/webmasters/sitemaps/docs/en/protocol.html Sitemap Protocol Contents * * @author Bernard Paques * @reference * @license http://www.gnu.org/copyleft/lesser.txt GNU Lesser General Public License */ // common definitions and initial processing include_once 'shared/global.php'; // required by Google $context['charset'] = 'utf-8'; // load localized strings i18n::bind('root'); // load a skin engine load_skin('sitemap'); // get the list from the cache, if possible $cache_id = Cache::hash('sitemap') . '.xml'; // save for 5 minutes if (!file_exists($context['path_to_root'] . $cache_id) || filemtime($context['path_to_root'] . $cache_id) + 300 < time() || !($text = Safe::file_get_contents($context['path_to_root'] . $cache_id))) { $text = ''; // the preamble $text = '<?xml version="1.0" encoding="' . $context['charset'] . '"?>' . "\n" . '<urlset xmlns="http://www.google.com/schemas/sitemap/0.84">' . "\n"; // the front page $text .= ' <url>' . "\n" . ' <loc>' . $context['url_to_home'] . $context['url_to_root'] . '</loc>' . "\n" . ' <changefreq>weekly</changefreq>' . "\n" . ' <priority>1.0</priority>' . "\n" . ' </url>' . "\n\n"; // the site map $text .= ' <url>' . "\n" . ' <loc>' . $context['url_to_home'] . $context['url_to_root'] . 'sections/</loc>' . "\n" . ' <changefreq>weekly</changefreq>' . "\n" . ' <priority>1.0</priority>' . "\n" . ' </url>' . "\n\n"; // main sections if ($items = Sections::list_by_title_for_anchor(NULL, 0, 25, 'raw')) { foreach ($items as $id => $item) { $text .= ' <url>' . "\n" . ' <loc>' . encode_link(Sections::get_permalink($item)) . '</loc>' . "\n" . ' <changefreq>weekly</changefreq>' . "\n" . ' </url>' . "\n\n"; } }
* it is included into the feed as well. * * @link http://www.w3.org/2003/01/geo/ RDFIG Geo vocab workspace * * @author Bernard Paques * @reference * @license http://www.gnu.org/copyleft/lesser.txt GNU Lesser General Public License */ // common definitions and initial processing include_once '../shared/global.php'; // ensure we only provide public content through newsfeeds $context['users_without_teasers'] = 'Y'; // load the rendering skin load_skin('feeds'); // get the list from the cache, if possible $cache_id = Cache::hash('feeds/rdf') . '.xml'; // save for 5 minutes if (!file_exists($context['path_to_root'] . $cache_id) || filemtime($context['path_to_root'] . $cache_id) + 300 < time() || !($text = Safe::file_get_contents($context['path_to_root'] . $cache_id))) { $text = ''; // loads feeding parameters Safe::load('parameters/feeds.include.php'); // set default values if (!isset($context['channel_title']) || $context['channel_title']) { $context['channel_title'] = $context['site_name']; } if (!isset($context['channel_description']) || !$context['channel_description']) { $context['channel_description'] = $context['site_description']; } if (!isset($context['webmaster_address']) || !$context['webmaster_address']) { $context['webmaster_address'] = $context['site_email']; }
/** * list articles * * @param resource the SQL result * @return string the rendered text * * @see layouts/layout.php **/ function layout($result) { global $context; // we return some text $text = ''; // empty list if (!SQL::count($result)) { return $text; } // load the SIMILE Timeline javascript library in shared/global.php $context['javascript']['timeline'] = TRUE; // sanity check if (!isset($this->focus)) { $this->focus = 'default'; } // put in cache $cache_id = Cache::hash('articles/layout_articles_as_simile:' . $this->focus) . '.xml'; // save for one minute if (!file_exists($context['path_to_root'] . $cache_id) || filemtime($context['path_to_root'] . $cache_id) + 60 < time()) { // content of the slideshow $content = '<?xml version="1.0" encoding="utf-8"?>' . "\n" . '<data>' . "\n"; // get a default image if (Safe::GetImageSize($context['path_to_root'] . $context['skin'] . '/layouts/map.gif')) { $default_href = $context['url_to_root'] . $context['skin'] . '/layouts/map.gif'; } elseif ($size = Safe::GetImageSize($context['path_to_root'] . 'skins/_reference/layouts/map.gif')) { $default_href = $context['url_to_root'] . 'skins/_reference/layouts/map.gif'; } else { $default_href = NULL; } // process all items in the list while ($item = SQL::fetch($result)) { // get the related overlay $overlay = Overlay::load($item, 'article:' . $item['id']); // get the anchor $anchor = Anchors::get($item['anchor']); // start if ($item['publish_date'] > $item['create_date']) { $first = Skin::build_date($item['publish_date'], 'plain'); } else { $first = Skin::build_date($item['create_date'], 'plain'); } // end $last = Skin::build_date($item['edit_date'], 'plain'); if ($last != $first) { $last = ' end="' . $last . '"'; } else { $last = ''; } // build a title if (is_object($overlay)) { $title = Codes::beautify_title($overlay->get_text('title', $item)); } else { $title = Codes::beautify_title($item['title']); } // the url to view this item $url = str_replace('&', '&', Articles::get_permalink($item)); // this is visual if (isset($item['icon_url']) && $item['icon_url']) { $image = $item['icon_url']; } elseif (isset($item['thumbnail_url']) && $item['thumbnail_url']) { $image = $item['thumbnail_url']; } else { $image = ''; } // fix relative path if ($image && !preg_match('/^(\\/|http:|https:|ftp:)/', $image)) { $image = $context['url_to_root'] . $image; } if ($image) { $image = ' image="' . $image . '"'; } // introduction $introduction = ''; if (is_object($overlay)) { $introduction = $overlay->get_text('introduction', $item); } else { $introduction = $item['introduction']; } // insert overlay data, if any if (is_object($overlay) && ($data = $overlay->get_text('list', $item))) { if ($introduction) { $introduction .= BR; } $introduction .= $data; } // ampersands kill SIMILE Timeline if ($introduction) { $introduction = encode_field(str_replace(array(' ', '&'), ' ', Codes::beautify($introduction))); } // details $details = array(); // info on related comments if ($count = Comments::count_for_anchor('article:' . $item['id'], TRUE)) { $details[] = sprintf(i18n::ns('%d comment', '%d comments', $count), $count); } // info on related files if ($count = Files::count_for_anchor('article:' . $item['id'], TRUE)) { $details[] = sprintf(i18n::ns('%d file', '%d files', $count), $count); } // info on related links if ($count = Links::count_for_anchor('article:' . $item['id'], TRUE)) { $details[] = sprintf(i18n::ns('%d link', '%d links', $count), $count); } // combine in-line details if (count($details)) { if ($introduction) { $introduction .= BR; } $introduction .= '<span class="details">' . trim(implode(', ', $details)) . '</span>'; } // escape the introduction, if any if ($introduction) { $introduction = str_replace(array('<', '&'), array('<', '&'), $introduction); } // add to the list $content .= ' <event start="' . $first . '"' . $last . ' title="' . encode_field(str_replace(array(" ", '"'), ' ', $title)) . '" link="' . $url . '"' . $image . '>' . "\n" . ' ' . $introduction . "\n" . ' </event>' . "\n"; } // finalize slideshow content $content .= '</data>'; // put in cache Safe::file_put_contents($cache_id, $content); } // allow multiple instances static $count; if (!isset($count)) { $count = 1; } else { $count++; } // 1 week ago $now = gmdate('M d Y H:i:s', time() - 7 * 24 * 60 * 60); // load the right file $text = '<div id="articles_as_simile_' . $count . '" style="height: 300px; border: 1px solid #aaa; font-size: 10px"></div>' . "\n"; Page::insert_script('var simile_handle_' . $count . ';' . "\n" . 'function onLoad' . $count . '() {' . "\n" . ' var eventSource = new Timeline.DefaultEventSource();' . "\n" . ' var bandInfos = [' . "\n" . ' Timeline.createBandInfo({' . "\n" . ' eventSource: eventSource,' . "\n" . ' date: "' . $now . '",' . "\n" . ' width: "80%",' . "\n" . ' intervalUnit: Timeline.DateTime.WEEK,' . "\n" . ' intervalPixels: 200' . "\n" . ' }),' . "\n" . ' Timeline.createBandInfo({' . "\n" . ' showEventText: false,' . "\n" . ' trackHeight: 0.5,' . "\n" . ' trackGap: 0.2,' . "\n" . ' eventSource: eventSource,' . "\n" . ' date: "' . $now . '",' . "\n" . ' width: "20%",' . "\n" . ' intervalUnit: Timeline.DateTime.MONTH,' . "\n" . ' intervalPixels: 50' . "\n" . ' })' . "\n" . ' ];' . "\n" . ' bandInfos[1].syncWith = 0;' . "\n" . ' bandInfos[1].highlight = true;' . "\n" . ' bandInfos[1].eventPainter.setLayout(bandInfos[0].eventPainter.getLayout());' . "\n" . ' simile_handle_' . $count . ' = Timeline.create(document.getElementById("articles_as_simile_' . $count . '"), bandInfos);' . "\n" . ' Timeline.loadXML("' . $context['url_to_home'] . $context['url_to_root'] . $cache_id . '", function(xml, url) { eventSource.loadXML(xml, url); });' . "\n" . '}' . "\n" . "\n" . 'var resizeTimerID' . $count . ' = null;' . "\n" . 'function onResize' . $count . '() {' . "\n" . ' if (resizeTimerID' . $count . ' == null) {' . "\n" . ' resizeTimerID' . $count . ' = window.setTimeout(function() {' . "\n" . ' resizeTimerID' . $count . ' = null;' . "\n" . ' simile_handle_' . $count . '.layout();' . "\n" . ' }, 500);' . "\n" . ' }' . "\n" . '}' . "\n" . "\n" . '// observe page major events' . "\n" . '$(document).ready( onLoad' . $count . ');' . "\n" . '$(window).resize(onResize' . $count . ');' . "\n"); // end of processing SQL::free($result); return $text; }
* @reference * @license http://www.gnu.org/copyleft/lesser.txt GNU Lesser General Public License */ // common definitions and initial processing include_once '../shared/global.php'; include_once 'feeds.php'; // ensure we only provide public content through newsfeeds $context['users_without_teasers'] = 'Y'; // check network credentials, if any if ($user = Users::authenticate()) { Surfer::empower($user['capability']); } // load a skin engine load_skin('feeds'); // get the list from the cache, if possible $cache_id = Cache::hash('feeds/describe') . '.xml'; // save for 5 minutes if (!file_exists($context['path_to_root'] . $cache_id) || filemtime($context['path_to_root'] . $cache_id) + 300 < time() || !($text = Safe::file_get_contents($context['path_to_root'] . $cache_id))) { $text = ''; // loads feeding parameters Safe::load('parameters/feeds.include.php'); // set default values if (!isset($context['channel_title']) || $context['channel_title']) { $context['channel_title'] = $context['site_name']; } if (!isset($context['channel_description']) || !$context['channel_description']) { $context['channel_description'] = $context['site_description']; } if (!isset($context['webmaster_address']) || !$context['webmaster_address']) { $context['webmaster_address'] = $context['site_email']; }
/** * provide news in the atom format * * @author Bernard Paques * @reference * @license http://www.gnu.org/copyleft/lesser.txt GNU Lesser General Public License */ // common definitions and initial processing include_once '../shared/global.php'; // ensure we only provide public content through newsfeeds $context['users_without_teasers'] = 'Y'; // load the rendering skin load_skin('feeds'); // get the list from the cache, if possible $cache_id = Cache::hash('feeds/atom') . '.xml'; // save for 5 minutes if (!file_exists($context['path_to_root'] . $cache_id) || filemtime($context['path_to_root'] . $cache_id) + 300 < time() || !($text = Safe::file_get_contents($context['path_to_root'] . $cache_id))) { $text = ''; // loads feeding parameters Safe::load('parameters/feeds.include.php'); // set default values if (!isset($context['channel_title']) || $context['channel_title']) { $context['channel_title'] = $context['site_name']; } if (!isset($context['channel_description']) || !$context['channel_description']) { $context['channel_description'] = $context['site_description']; } if (!isset($context['webmaster_address']) || !$context['webmaster_address']) { $context['webmaster_address'] = $context['site_email']; }
* @author Bernard Paques * @reference * @license http://www.gnu.org/copyleft/lesser.txt GNU Lesser General Public License */ // common definitions and initial processing include_once '../shared/global.php'; // ensure we only provide public content through newsfeeds $context['users_without_teasers'] = 'Y'; // check network credentials, if any if ($user = Users::authenticate()) { Surfer::empower($user['capability']); } // load a skin engine load_skin('articles'); // get the list from the cache, if possible $cache_id = Cache::hash('articles/feed') . '.xml'; // save for 5 minutes if (!file_exists($context['path_to_root'] . $cache_id) || filemtime($context['path_to_root'] . $cache_id) + 300 < time() || !($text = Safe::file_get_contents($context['path_to_root'] . $cache_id))) { $text = ''; // load feeding parameters Safe::load('parameters/feeds.include.php'); // set default values if (!isset($context['channel_title']) || !$context['channel_title']) { $context['channel_title'] = $context['site_name']; } if (!isset($context['channel_description']) || !$context['channel_description']) { $context['channel_description'] = $context['site_description']; } if (!isset($context['webmaster_address']) || !$context['webmaster_address']) { $context['webmaster_address'] = $context['site_email']; }