// via the /index/sitelinks-rss-action box, however they simply won't be // linked to automatically for you. appconf_set('rss_links', true); // Set this to whatever you want your RSS <title> field to contain. appconf_set('rss_title', site_domain() . ' ' . intl_get('Forum')); // Set this to whatever you want your RSS <description> field to // contain. appconf_set('rss_description', intl_get('Postings from') . ' ' . site_domain()); // Set this to the template you wish to use to display the app, otherwise // the default is used. appconf_set('template', 'wide'); // Set this to the page ID of the page you would like to be the parent of // your forum. This affects the web site navigation while within the // forum itself, and the breadcrumb trail as well. appconf_set('page_below', false); // Set this to the ID of the page which is an alias of the forum. appconf_set('page_alias', false); // Set this to the number of posts to display per screen. appconf_set('limit', 10); if ($context == 'action') { page_add_link('alternate', 'application/rss+xml', site_url() . '/index/siteforum-rss-action'); if (appconf('page_below')) { page_below(appconf('page_below')); } if (appconf('page_alias')) { page_id(appconf('page_alias')); } if (appconf('template')) { page_template(appconf('template')); } }
* app itself, and the breadcrumb trail as well. */ appconf_set('page_below', false); /** * Set this to the ID of the page which is an alias of the app. */ appconf_set('page_alias', false); /** * This loads the settings.ini.php file now so the defaults there can affect * subsequent function calls like page_add_style() below in this file. */ appconf_default_settings(); if ($context == 'action') { if (appconf('page_below')) { page_below(appconf('page_below')); } if (appconf('page_alias')) { page_id(appconf('page_alias')); } if (appconf('template')) { page_template(appconf('template')); } global $cgi; $url = 'http://' . site_domain() . site_prefix() . '/index/news-rss-action/nomenu.1'; if ($cgi->section) { $url .= '?section=' . $cgi->section; } elseif ($cgi->author) { $url .= '?author=' . $cgi->author; } page_add_link('alternate', 'application/rss+xml', $url); }
<?php // This is where app-level variables can be centrally stored. This file is // automatically included when the first call to your app is made. Use the // appconf_set ('name', 'value'); function to add values here. $conf = ini_parse('inc/app/sitewiki/conf/settings.php', false); foreach ($conf as $k => $v) { if ($k == 'template' && $context == 'action') { page_template($v); } else { appconf_set($k, $v); } } appconf_set('default_page', 'HomePage'); appconf_set('date_format', 'F j, Y g:i A'); appconf_set('levels', array('0' => intl_get('Anyone'), '1' => intl_get('Registered Users Only'), '2' => intl_get('Admin-Level Users Only'), '3' => intl_get('Owner Only'))); appconf_set('yesno', array('0' => intl_get('No'), '1' => intl_get('Yes'))); //page_template ('full'); page_add_link('alternate', 'application/rss+xml', site_url() . '/index/sitewiki-feeds-short-action'); page_add_link('alternate', 'application/rss+xml', site_url() . '/index/sitewiki-feeds-full-action');
appconf_set('short_date', '%B %e'); // This loads the settings.ini.php file now so the defaults there can affect // subsequent function calls like page_add_style() below in this file. appconf_default_settings(); formdata_set('hours', array('00:00:00' => '- SELECT -', '08:00:00' => ' 8:00 AM', '08:30:00' => ' 8:30 AM', '09:00:00' => ' 9:00 AM', '09:30:00' => ' 9:30 AM', '10:00:00' => '10:00 AM', '10:30:00' => '10:30 AM', '11:00:00' => '11:00 AM', '11:30:00' => '11:30 AM', '12:00:00' => '12:00 PM', '12:30:00' => '12:30 PM', '13:00:00' => ' 1:00 PM', '13:30:00' => ' 1:30 PM', '14:00:00' => ' 2:00 PM', '14:30:00' => ' 2:30 PM', '15:00:00' => ' 3:00 PM', '15:30:00' => ' 3:30 PM', '16:00:00' => ' 4:00 PM', '16:30:00' => ' 4:30 PM', '17:00:00' => ' 5:00 PM', '17:30:00' => ' 5:30 PM', '18:00:00' => ' 6:00 PM', '18:30:00' => ' 6:30 PM', '19:00:00' => ' 7:00 PM', '19:30:00' => ' 7:30 PM', '20:00:00' => ' 8:00 PM', '20:30:00' => ' 8:30 PM', '21:00:00' => ' 9:00 PM', '21:30:00' => ' 9:30 PM', '22:00:00' => '10:00 PM', '22:30:00' => '10:30 PM', '23:00:00' => '11:00 PM', '23:30:00' => '11:30 PM')); formdata_set('recurring', array('no' => '- ' . intl_get('SELECT') . ' -', 'daily' => intl_get('Daily'), 'weekly' => intl_get('Weekly'), 'monthly' => intl_get('Monthly'), 'yearly' => intl_get('Yearly'))); if ($context == 'action') { if (appconf('page_below')) { page_below(appconf('page_below')); } if (appconf('page_alias')) { page_id(appconf('page_alias')); } if (appconf('template')) { page_template(appconf('template')); } global $cgi; $url = 'http://' . site_domain() . site_prefix() . '/index/siteevent-rss-action'; $url2 = 'http://' . site_domain() . site_prefix() . '/index/siteevent-ical-action'; if ($cgi->category) { $url .= '?category=' . $cgi->category; $url2 .= '?category=' . $cgi->category; } elseif ($cgi->user) { $url .= '?user='******'?user='******'alternate', 'application/rss+xml', $url); page_add_link('alternate', 'text/calendar', $url2); page_add_style(appconf('css_location')); } loader_import('siteevent.Filters');
<?php /* * RSS Example * * This example shows how easy it is to create syndicated content for use in * another web site or portal. */ // construct an rss data structure // this would be from a database or other resource in reality $rss = array('title' => 'My RSS Feed', 'link' => site_url(), 'description' => 'A demonstration of an RSS news feed.', 'items' => array(array('title' => 'Test Item 1', 'link' => site_url() . site_prefix() . '/index/item1'), array('title' => 'Test Item 2', 'link' => site_url() . site_prefix() . '/index/item2'), array('title' => 'Test Item 3', 'link' => site_url() . site_prefix() . '/index/item3'))); // in the conf/properties.php file of your app, you would also want to add // the following code to add the rss feed to the page's head, so rss-aware // browsers will see it. in this context, since we exit without outputting // the global template, this code does nothing. page_add_link('alternate', 'application/rss+xml', 'http://' . site_domain() . site_prefix() . '/index/example-rss-action'); // output the rss feed by setting the content type, displaying the rss // template, and exiting so Sitellite doesn't render the output within // the page body header('Content-Type: text/xml'); echo template_simple('rss.spt', $rss); exit;
/** * Determines which template to use to render the document for output * to the visitor. The template is chosen based on the following * conditions: * * - Templates all live in inc/html in individual template set directories * (ie. themes). The template set can be specified with page_template_set(), * or via the default_template_set configuration option. * - The $cgi->mode value, which defaults to "html" if unspecified * - The $template property of this object is appended to the mode like * this: html.index.tpl where html is the mode and index is the $template * value. The template can be specified with the page_template() function, * or via the default_template configuration option. * - If that document is not found, we then check for such a document * based on the names of parent documents in the hierarchy, but only * those that are designated as section roots. Each of these is then * used as a replacement for the $template property. * - If none is found, then the default html.{default_template}.tpl is used, * where html is the mode. * * Note that the templates are always in XT format. For info on the XT template * language, see the class documentation under XML/XT at sitellite.org/docs * * @return string */ function useTemplate() { global $tpl, $cgi, $menu, $conf; if ($this->template_set) { $set = $this->template_set; } else { $set = $conf['Server']['default_template_set']; } $old_path = $tpl->path; $tpl->path = $tpl->path . '/' . $set; if (@file_exists($tpl->path . '/modes.php')) { $modes = ini_parse($tpl->path . '/modes.php'); if (isset($modes[$cgi->mode]['content_type'])) { global $intl; if (!empty($intl->charset)) { header('Content-Type: ' . $modes[$cgi->mode]['content_type'] . '; charset=' . $intl->charset); } else { header('Content-Type: ' . $modes[$cgi->mode]['content_type']); } } if (is_array($modes[$cgi->mode])) { foreach ($modes[$cgi->mode] as $k => $v) { if (strpos($k, 'filter ') === 0) { list($field, $filter) = preg_split('/: ?/', $v); if ($field == 'final') { $final = false; if (strstr($filter, '.')) { // it's a package, needs inclusion first $filter_name = strtolower(str_replace('.', '_', $filter)) . '_content_filter'; if (loader_import($filter)) { if (function_exists($filter_name)) { $final = $filter_name; } } } else { // it's an ordinary function $final = $filter; } } else { if (strstr($filter, '.')) { // it's a package, needs inclusion first $filter_name = strtolower(str_replace('.', '_', $filter)) . '_content_filter'; if (loader_import($filter)) { if (function_exists($filter_name)) { $this->{$field} = $filter_name($this->{$field}); } } } else { // it's an ordinary function $this->{$field} = $filter($this->{$field}); } } } } } } else { $modes = array('html' => array('content_type' => 'text/html')); } if ($cgi->mode == 'html') { foreach ($modes as $k => $m) { if ($k != 'html') { $alt_url = $_SERVER['REQUEST_URI']; if (strpos($alt_url, '?') !== false) { $alt_url = str_replace('?', '/mode.' . $k . '?', $alt_url); } else { $alt_url .= '/mode.' . $k; } page_add_link('alternate', $m['content_type'], $alt_url); } } } if (!empty($this->template) && @file_exists(getcwd() . '/' . $tpl->path . '/' . $cgi->mode . '.' . $this->template . '.tpl')) { $response = $tpl->fill($cgi->mode . '.' . $this->template . '.tpl', $this); $_t = $cgi->mode . '.' . $this->template . '.tpl'; } elseif (!empty($this->below_page)) { // inherit section template loader_box('sitellite/nav/init'); $useTemplate = false; $parent = $this->below_page; while (true) { // is_object ($menu->{'items_' . $parent})) { if ($menu->{'items_' . $parent}->is_section && $menu->{'items_' . $parent}->template && @file_exists(getcwd() . '/' . $tpl->path . '/' . $cgi->mode . '.' . $menu->{'items_' . $parent}->template . '.tpl')) { $useTemplate = $menu->{'items_' . $parent}->template; break; } elseif (is_object($menu->{'items_' . $parent}->parent)) { $parent = $menu->{'items_' . $parent}->parent->id; } else { break; } } if ($useTemplate) { $response = $tpl->fill($cgi->mode . '.' . $useTemplate . '.tpl', $this); $_t = $cgi->mode . '_' . $useTemplate . '.tpl'; } elseif (!empty($conf['Server']['default_template']) && @file_exists(getcwd() . '/' . $tpl->path . '/' . $cgi->mode . '.' . $conf['Server']['default_template'] . '.tpl')) { $response = $tpl->fill($cgi->mode . '.' . $conf['Server']['default_template'] . '.tpl', $this); $_t = $cgi->mode . '.' . $conf['Server']['default_template'] . '.tpl'; } else { $response = $tpl->fill($cgi->mode . '.default.tpl', $this); $_t = $cgi->mode . '.default.tpl'; } } elseif (!empty($conf['Server']['default_template']) && @file_exists(getcwd() . '/' . $tpl->path . '/' . $cgi->mode . '.' . $conf['Server']['default_template'] . '.tpl')) { $response = $tpl->fill($cgi->mode . '.' . $conf['Server']['default_template'] . '.tpl', $this); $_t = $cgi->mode . '.' . $conf['Server']['default_template'] . '.tpl'; } else { $response = $tpl->fill($cgi->mode . '.default.tpl', $this); $_t = $cgi->mode . '.default.tpl'; } if ($response === false) { $response = '<p>' . $tpl->error . ' (Template: ' . $_t . ', Line ' . $tpl->err_line . ', Column ' . $tpl->err_colnum . ')</p>'; } if ($final) { $response = $final($response); } $tpl->path = $old_path; return $response; }
} if (!empty($parameters['path'])) { $parameters['path'] .= '/'; } foreach (array_keys($res) as $k) { if (empty($res[$k]->name)) { // skip dot-files (empty files will only have extensions unset($res[$k]); continue; } if (empty($res[$k]->display_title)) { $res[$k]->display_title = $res[$k]->name; } } // show an auto-discovery rss link to this directory listing as well page_add_link('alternate', 'application/rss+xml', 'http://' . site_domain() . site_prefix() . '/index/cms-filesystem-rss-action?path=' . urlencode(trim($parameters['path'], '/'))); echo template_simple('filesystem_list.spt', array('path' => $parameters['path'], 'list' => $res, 'show' => $show)); return; } if (strpos($parameters['file'], '/') === 0) { $parameters['file'] = substr($parameters['file'], 1); } $parameters['file'] = strtolower($parameters['file']); $info = pathinfo($parameters['file']); if ($info['dirname'] == '.') { $info['dirname'] = ''; } if (!$info['extension']) { $info['extension'] = ''; } $info['basename'] = preg_replace('/\\.' . preg_quote($info['extension'], '/') . '$/', '', $info['basename']);