* - [style=fantasy]...[/style] - guess what will appear * - [style=my_style]...[/style] - translated to <span class="my_style">...</span> * * @see codes/index.php * * @author Bernard Paques * @author GnapZ * @reference * @license http://www.gnu.org/copyleft/lesser.txt GNU Lesser General Public License */ // common definitions and initial processing include_once '../shared/global.php'; // load localized strings i18n::bind('codes'); // load the skin load_skin('codes'); // the path to this page $context['path_bar'] = array('help/' => i18n::s('Help index'), 'codes/' => i18n::s('Formatting Codes')); // the title of the page $context['page_title'] = i18n::s('In-line formatting codes'); // the date of last modification if (Surfer::is_associate()) { $context['page_details'] .= '<p class="details">' . sprintf(i18n::s('Edited %s'), Skin::build_date(getlastmod())) . '</p>'; } // page header $context['text'] .= '<p>' . i18n::s('On this page we are introducing some formatting codes and live examples of utilization.') . '</p>'; // add a toc $context['text'] .= "\n" . '[toc]' . "\n"; // **...** $context['text'] .= '[title]' . i18n::s('Wiki bold') . ' [escape]**...**[/escape][/title]' . Skin::table_prefix('wide') . Skin::table_row(array(i18n::s('Example'), i18n::s('Rendering')), 'header') . '<tr><td class="sample">[escape]' . i18n::s('This is very **important**, isn\'t it?') . '[/escape]</td>' . '<td>' . i18n::s('This is very **important**, isn\'t it?') . '</td></tr>' . Skin::table_suffix(); // [b]...[/b]
$id = NULL; if (isset($_REQUEST['id'])) { $id = $_REQUEST['id']; } elseif (isset($context['arguments'][0])) { $id = $context['arguments'][0]; } $id = strip_tags($id); // get the related anchor, if any $anchor = NULL; if (isset($id)) { $anchor = Anchors::get($id); } // load localized strings i18n::bind('behaviors'); // load the skin, maybe with a variant load_skin('agreements', $anchor); // no subject if (!is_object($anchor)) { Logger::error(i18n::s('No item has the provided id.')); } else { // initialize the list of agreements if (!isset($_SESSION['agreements']) || !is_array($_SESSION['agreements'])) { $_SESSION['agreements'] = array(); } // append the new agreement $_SESSION['agreements'][] = $anchor->get_reference(); // revisit referer if (isset($_SERVER['HTTP_REFERER'])) { Safe::redirect($_SERVER['HTTP_REFERER']); } }
<?php /** * add intelligence to yacs * * @author Bernard Paques * @author GnapZ * @reference * @license http://www.gnu.org/copyleft/lesser.txt GNU Lesser General Public License * */ include_once '../shared/global.php'; // load localized strings i18n::bind('behaviors'); // load the skin load_skin('behaviors'); // set page title $context['page_title'] = i18n::s('Behaviors'); // splash message if (Surfer::is_associate()) { $context['text'] .= '<p>' . i18n::s('Behaviors listed below can be used to customise articles attached to some sections.') . '</p>'; } // list behaviors available on this system $context['text'] .= '<ul>'; if ($dir = Safe::opendir($context['path_to_root'] . 'behaviors')) { // every php script is a behavior, except index.php, behavior.php and behaviors.php while (($file = Safe::readdir($dir)) !== FALSE) { if ($file[0] == '.' || is_dir($context['path_to_root'] . 'behaviors/' . $file)) { continue; } if ($file == 'index.php') {
if (isset($_REQUEST['search'])) { $search = $_REQUEST['search']; } elseif (isset($context['arguments'][0])) { $search = $context['arguments'][0]; } $search = strip_tags($search); // search type $type = ''; if (isset($_REQUEST['type'])) { $type = $_REQUEST['type']; } $type = strip_tags($type); // load localized strings i18n::bind('services'); // load a skin engine load_skin('services'); // loads feeding parameters Safe::load('parameters/feeds.include.php'); // set default values if (!$context['channel_title']) { $context['channel_title'] = $context['site_name']; } if (!$context['channel_description']) { $context['channel_description'] = $context['site_description']; } // channel attributes $values = array(); $values['channel'] = array(); // set channel information if ($search) { $values['channel']['title'] = sprintf(i18n::s('%s at %s'), $search, $context['channel_title']);
$anchor = Anchors::get($item['anchor']); } // associates can do what they want if (Surfer::is_associate()) { $permitted = TRUE; } elseif (is_object($anchor) && !$anchor->is_viewable()) { $permitted = FALSE; } elseif ($item['active'] == 'R' && Surfer::is_member()) { $permitted = TRUE; } elseif ($item['active'] == 'Y') { $permitted = TRUE; } else { $permitted = FALSE; } // load the skin load_skin('servers'); // current item if (isset($item['id'])) { $context['current_item'] = 'server:' . $item['id']; } // the path to this page $context['path_bar'] = array('servers/' => i18n::s('Servers')); // the title of the page if ($item['title']) { $context['page_title'] = $item['title']; } // not found if (!$item['id']) { include '../error.php'; // permission denied } elseif (!$permitted) {
$id = strip_tags($id); // get the item from the database $item = Tables::get($id); // get the related anchor, if any $anchor = NULL; if (isset($item['anchor']) && $item['anchor']) { $anchor = Anchors::get($item['anchor']); } // only associates can proceed if (Surfer::is_associate()) { $permitted = TRUE; } else { $permitted = FALSE; } // load the skin, maybe with a variant load_skin('tables', $anchor); // clear the tab we are in, if any if (is_object($anchor)) { $context['current_focus'] = $anchor->get_focus(); } // the path to this page if (is_object($anchor) && $anchor->is_viewable()) { $context['path_bar'] = $anchor->get_path_bar(); } else { $context['path_bar'] = array('tables/' => i18n::s('Tables')); } // the title of the page $context['page_title'] = i18n::s('Delete a table'); // not found if (!isset($item['id'])) { include '../error.php';
* @author GnapZ * @tester Agnes * @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 '../comments/comments.php'; include_once '../links/links.php'; // find the target anchor in path args (e.g., http:.../sections/select.php?anchor=article:15) $anchor = NULL; if (isset($_REQUEST['anchor'])) { $anchor = Anchors::get($_REQUEST['anchor']); } // load the skin, maybe with a variant load_skin('sections', $anchor); // the path to this page if (is_object($anchor) && $anchor->is_viewable()) { $context['path_bar'] = $anchor->get_path_bar(); } else { $context['path_bar'] = array('sections/' => i18n::s('Site map')); } // the title of the page if (is_object($anchor) && $anchor->is_viewable()) { $context['page_title'] = sprintf(i18n::s('Sections of %s'), $anchor->get_title()); } // stop crawlers if (Surfer::is_crawler()) { Safe::header('Status: 401 Unauthorized', TRUE, 401); Logger::error(i18n::s('You are not allowed to perform this operation.')); // an anchor is mandatory
$anchor = Anchors::get($item['anchor']); } // associates and editors can do what they want if (Surfer::is_associate() || is_object($anchor) && $anchor->is_assigned()) { $permitted = TRUE; } elseif (is_object($anchor) && !$anchor->is_viewable()) { $permitted = FALSE; } elseif ($item['active'] == 'R' && Surfer::is_member()) { $permitted = TRUE; } elseif ($item['active'] == 'Y') { $permitted = TRUE; } else { $permitted = FALSE; } // load the skin load_skin('print'); // the path to this page if (is_object($anchor) && $anchor->is_viewable()) { $context['path_bar'] = $anchor->get_path_bar(); } else { $context['path_bar'] = array('categories/' => i18n::s('Categories')); } // the title of the page if (isset($item['title'])) { $context['page_title'] = $item['title']; } // stop crawlers if (Surfer::is_crawler()) { Safe::header('Status: 401 Unauthorized', TRUE, 401); Logger::error(i18n::s('You are not allowed to perform this operation.')); // not found
$id = strip_tags($id); // get the item from the database $item = Locations::get($id); // get the related anchor, if any $anchor = NULL; if (isset($item['anchor']) && $item['anchor']) { $anchor = Anchors::get($item['anchor']); } // the anchor has to be viewable by this surfer if (!is_object($anchor) || $anchor->is_viewable()) { $permitted = TRUE; } else { $permitted = FALSE; } // load the skin, maybe with a variant load_skin('locations', $anchor); // current item if (isset($item['id'])) { $context['current_item'] = 'location:' . $item['id']; } // the path to this page if (is_object($anchor)) { $context['path_bar'] = $anchor->get_path_bar(); } else { $context['path_bar'] = array('locations/' => i18n::s('Locations')); } // the title of the page if ($item['geo_place_name']) { $context['page_title'] = $item['geo_place_name']; } // not found -- help web crawlers
* the active configuration before the last change. * * If the file [code]parameters/demo.flag[/code] exists, the script assumes that this instance * of YACS runs in demonstration mode. * In this mode the edit form is displayed, but parameters are not saved in the configuration file. * * @author Bernard Paques * @author GnapZ * @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 'files.php'; // load the skin load_skin('files'); // the path to this page $context['path_bar'] = array('control/' => i18n::s('Control Panel')); // the title of the page $context['page_title'] = sprintf(i18n::s('%s: %s'), i18n::s('Configure'), i18n::s('Files')); // anonymous users are invited to log in or to register if (!Surfer::is_logged()) { Safe::redirect($context['url_to_home'] . $context['url_to_root'] . 'users/login.php?url=' . urlencode('files/configure.php')); } elseif (!Surfer::is_associate()) { Safe::header('Status: 401 Unauthorized', TRUE, 401); Logger::error(i18n::s('You are not allowed to perform this operation.')); // display the input form } elseif (isset($_SERVER['REQUEST_METHOD']) && $_SERVER['REQUEST_METHOD'] != 'POST') { // load current parameters, if any Safe::load('parameters/files.include.php'); // the form
$id = NULL; if (isset($_REQUEST['id'])) { $id = $_REQUEST['id']; } elseif (isset($context['arguments'][0])) { $id = $context['arguments'][0]; } $id = strip_tags($id); // get the item from the database $item = Articles::get($id); // get the related anchor $anchor = NULL; if (isset($item['anchor']) && $item['anchor']) { $anchor = Anchors::get($item['anchor']); } // load the skin, maybe with a variant load_skin('articles', $anchor, isset($item['options']) ? $item['options'] : ''); // clear the tab we are in, if any if (is_object($anchor)) { $context['current_focus'] = $anchor->get_focus(); } // the title of the page if (isset($item['title'])) { $context['page_title'] = $item['title']; } // not found if (!isset($item['id'])) { include '../error.php'; // permission denied } elseif (!Articles::allow_access($item, $anchor)) { // give anonymous surfers a chance for HTTP authentication if (!Surfer::is_logged()) {
$anchor = Anchors::get($item['anchor']); } // associates and authenticated editors can do what they want if (Surfer::is_associate() || Surfer::is_member() && is_object($anchor) && $anchor->is_assigned()) { $permitted = TRUE; } elseif (is_object($anchor) && !$anchor->is_viewable()) { $permitted = FALSE; } elseif (Surfer::is_member() && !strcmp($item['anchor'], 'user:'******'edit_id']) && Surfer::is($item['edit_id'])) { $permitted = TRUE; } else { $permitted = FALSE; } // load the skin, maybe with a variant load_skin('links', $anchor); // clear the tab we are in, if any if (is_object($anchor)) { $context['current_focus'] = $anchor->get_focus(); } // the path to this page if (is_object($anchor) && $anchor->is_viewable()) { $context['path_bar'] = $anchor->get_path_bar(); } else { $context['path_bar'] = array('links/' => i18n::s('Links')); } // the title of the page $context['page_title'] = i18n::s('Delete a link'); // not found if (!isset($item['id'])) { include '../error.php';
* * YACS attempts to stop robots by generating a random string and by asking user to type it. * * @author Bernard Paques * @tester fw_crocodile * @reference * @license http://www.gnu.org/copyleft/lesser.txt GNU Lesser General Public License */ // common definitions and initial processing include_once 'shared/global.php'; // do not always show the edition form $with_form = FALSE; // load localized strings i18n::bind('root'); // load the skin load_skin('query'); // the title of the page $context['page_title'] = i18n::s('Help'); // get a section for queries if (!($anchor = Anchors::get('section:queries'))) { $fields = array(); $fields['nick_name'] = 'queries'; $fields['title'] =& i18n::c('Queries'); $fields['introduction'] =& i18n::c('Submitted to the webmaster by any surfers'); $fields['description'] =& i18n::c('<p>This section has been created automatically on query submission. It\'s aiming to capture feedback directly from surfers. It is highly recommended to delete pages below after their processing. Of course you can edit submitted queries to assign them to other sections if necessary.</p>'); $fields['locked'] = 'Y'; // no direct contributions $fields['active_set'] = 'N'; // for associates only $fields['index_map'] = 'N'; // listed only to associates
} elseif (is_readable('yacs/shared/global.php')) { include_once 'yacs/shared/global.php'; } else { exit('The file shared/global.php has not been found. Please reinstall or mention home directory in file yacs.home or configure the YACS_HOME environment variable.'); } // load libraries used in this script include_once $context['path_to_root'] . 'feeds/feeds.php'; // some links to newsfeeds include_once $context['path_to_root'] . 'links/links.php'; // load localized strings i18n::bind('root'); // load the skin, and flag topmost page against regular front page if ($context['script_url'] == '/index.php' && $context['url_to_root'] != '/') { load_skin('slash'); } else { load_skin('home'); } // the menu bar may be made of sections if (isset($context['root_sections_at_home']) && $context['root_sections_at_home'] != 'none' && isset($context['root_sections_layout']) && $context['root_sections_layout'] == 'menu') { // default number of sections to list if (!isset($context['root_sections_count_at_home']) || $context['root_sections_count_at_home'] < 1) { $context['root_sections_count_at_home'] = 5; } if ($items = Sections::list_by_title_for_anchor(NULL, 0, $context['root_sections_count_at_home'], 'menu')) { $context['page_menu'] = $items; } } // load the cover page if ((!isset($context['root_cover_at_home']) || $context['root_cover_at_home'] != 'none') && $context['master_host'] == $context['main_host']) { // look for a named page if ($cover_page = Articles::get('cover')) {
* * Only associates can use this script. * * This script relies on an external library to handle archive files. * * @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'; // the target file $id = NULL; $name = NULL; // load the skin load_skin('skins'); // the path to this page $context['path_bar'] = array('skins/' => i18n::s('Themes')); // the title of the page $context['page_title'] = i18n::s('Upload a theme'); // stop crawlers if (Surfer::is_crawler()) { Safe::header('Status: 401 Unauthorized', TRUE, 401); Logger::error(i18n::s('You are not allowed to perform this operation.')); // anonymous users are invited to log in or to register } elseif (!Surfer::is_logged()) { Safe::redirect($context['url_to_home'] . $context['url_to_root'] . 'users/login.php?url=' . urlencode('skins/upload.php')); } elseif (!Surfer::is_associate()) { Safe::header('Status: 401 Unauthorized', TRUE, 401); Logger::error(i18n::s('You are not allowed to perform this operation.')); // process uploaded data
* @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 'tables.php'; // which page should be displayed if (isset($_REQUEST['page'])) { $page = $_REQUEST['page']; } elseif (isset($context['arguments'][0])) { $page = $context['arguments'][0]; } else { $page = 1; } $page = max(1, intval($page)); // load the skin load_skin('tables'); // the maximum number of tables per page if (!defined('TABLES_PER_PAGE')) { define('TABLES_PER_PAGE', 50); } // the title of the page $context['page_title'] = i18n::s('Tables'); // this page is really only for associates if (!Surfer::is_associate()) { Safe::header('Status: 401 Unauthorized', TRUE, 401); Logger::error(i18n::s('You are not allowed to perform this operation.')); // display the index } else { // count tables in the database $stats = Tables::stat(); if ($stats['count']) {
include_once '../shared/global.php'; // which page should be displayed if (isset($_REQUEST['page'])) { $page = $_REQUEST['page']; } elseif (isset($context['arguments'][0])) { $page = $context['arguments'][0]; } else { $page = 1; } $page = max(1, intval($page)); // sanity check if ($page < 1) { $page = 1; } // load the skin load_skin('site_map'); // page size $items_per_page = 50; // the title of the page $context['page_title'] = i18n::s('Site map'); // count public root sections in the database $count = Sections::count_for_anchor(NULL); // a meta link to our blogging interface $context['page_header'] .= "\n" . '<link rel="EditURI" href="' . $context['url_to_home'] . $context['url_to_root'] . 'services/describe.php" title="RSD" type="application/rsd+xml" />'; // the prefix hook for the site map page if (is_callable(array('Hooks', 'include_scripts'))) { $context['text'] .= Hooks::include_scripts('sections/index.php#prefix'); } // stop hackers if ($page > 10) { Safe::header('Status: 401 Unauthorized', TRUE, 401);
} elseif (isset($context['arguments'][1])) { $id = $context['arguments'][0] . ':' . $context['arguments'][1]; } elseif (isset($context['arguments'][0])) { $id = $context['arguments'][0]; } $id = strip_tags($id); // get the related anchor, if any $anchor = Anchors::get($id); // the anchor has to be viewable by this surfer if (is_object($anchor) && !$anchor->is_viewable()) { $permitted = FALSE; } else { $permitted = TRUE; } // load the skin load_skin('locations'); // the path to this page if (is_object($anchor)) { $context['path_bar'] = $anchor->get_path_bar(); } else { $context['path_bar'] = array('locations/' => i18n::s('Locations')); } // the title of the page if (is_object($anchor)) { $context['page_title'] = sprintf(i18n::s('Locations related to %s'), $anchor->get_title()); } elseif ($id == 'users') { $context['page_title'] = i18n::s('Locations related to community members'); } // not found if (!is_object($anchor) && $id != 'all' && $id != 'users') { Logger::error(i18n::s('Reference a valid anchor, or all users.'));
include_once '../shared/global.php'; include_once '../shared/values.php'; // letters.digest.stamp // what to do $action = ''; if (isset($_REQUEST['action'])) { $action = $_REQUEST['action']; } if (!$action && isset($context['arguments'][0])) { $action = $context['arguments'][0]; } $action = strip_tags($action); // load localized strings i18n::bind('letters'); // load the skin load_skin('letters'); // maximum number of recipients if (!defined('MAXIMUM_RECIPIENTS')) { define('MAXIMUM_RECIPIENTS', 5000); } // wrapping threshold if (!defined('WRAPPING_LENGTH')) { define('WRAPPING_LENGTH', 70); } // the path to this page $context['path_bar'] = array('letters/' => i18n::s('Newsletters')); // the title of the page $context['page_title'] = i18n::s('Post a letter'); // load parameters for letters Safe::load('parameters/letters.include.php'); // default values if no configuration file is available
$id = $context['arguments'][0]; } $id = strip_tags($id); // get the item from the database $item = Sections::get($id); // get the related anchor, if any $anchor = NULL; if (isset($item['anchor']) && $item['anchor']) { $anchor = Anchors::get($item['anchor']); } // editors have associate-like capabilities if (isset($item['id']) && Sections::is_assigned($item['id']) || is_object($anchor) && $anchor->is_assigned()) { Surfer::empower(); } // load the skin, maybe with a variant load_skin('sections', $anchor, isset($item['options']) ? $item['options'] : ''); // stop crawlers if (Surfer::is_crawler()) { Safe::header('Status: 401 Unauthorized', TRUE, 401); die(i18n::s('You are not allowed to perform this operation.')); } // page title if (isset($item['title'])) { $context['page_title'] = $item['title']; } // not found if (!$item['id']) { include '../error.php'; // access denied } elseif (!Sections::allow_access($item, $anchor)) { // give anonymous surfers a chance for HTTP authentication
// associates and editors can do what they want if (Surfer::is_associate() || Articles::is_assigned($id) || is_object($anchor) && $anchor->is_assigned()) { $permitted = TRUE; } elseif (Surfer::get_id() && isset($item['create_id']) && $item['create_id'] == Surfer::get_id()) { $permitted = TRUE; } elseif (is_object($anchor) && !$anchor->is_viewable()) { $permitted = FALSE; } elseif (isset($item['active']) && $item['active'] == 'R' && Surfer::is_member()) { $permitted = TRUE; } elseif (isset($item['active']) && $item['active'] == 'Y') { $permitted = TRUE; } else { $permitted = FALSE; } // load the skin, maybe with a variant load_skin('polls', $anchor); // the path to this page $context['path_bar'] = Surfer::get_path_bar($anchor); // the title of the page if (isset($item['title']) && $item['title']) { $context['page_title'] = $item['title']; } else { $context['page_title'] = i18n::s('Vote for a poll'); } // no subject if (!isset($item['id'])) { include '../../error.php'; // no overlay } elseif (!is_object($overlay)) { Logger::error(i18n::s('This page has no overlay')); // not a valid poll
/** * check the integrity of the database for dates * * This page is used to check and update the database. Its usage is restricted to associates. * * @author Bernard Paques * @author GnapZ * @reference * @license http://www.gnu.org/copyleft/lesser.txt GNU Lesser General Public License */ // include libraries include_once '../shared/global.php'; include_once 'dates.php'; // load the skin load_skin('dates'); // the path to this page $context['path_bar'] = array('dates/' => i18n::s('Dates')); // the title of the page $context['page_title'] = i18n::s('Maintenance'); // the user has to be an associate if (!Surfer::is_associate()) { Safe::header('Status: 401 Unauthorized', TRUE, 401); Logger::error(i18n::s('You are not allowed to perform this operation.')); // forward to the index page $menu = array('dates/' => i18n::s('Dates')); $context['text'] .= Skin::build_list($menu, 'menu_bar'); // look for unused dates } elseif (isset($_REQUEST['action']) && $_REQUEST['action'] == 'unused') { // scan dates $context['text'] .= Skin::build_block(sprintf(i18n::s('Analyzing table %s...'), SQL::table_name('dates')), 'subtitle');
} $id = strip_tags($id); // get the item from the database $item = Users::get($id); // associates can do what they want if (Surfer::is_associate()) { $permitted = TRUE; } elseif ($item['active'] == 'R' && Surfer::is_member()) { $permitted = TRUE; } elseif ($item['active'] == 'Y') { $permitted = TRUE; } else { $permitted = FALSE; } // load the skin load_skin('users'); // path to this page $context['path_bar'] = array('users/' => i18n::s('People')); // page title $context['page_title'] = i18n::s('RSS feed'); // not found if (!isset($item['id'])) { include '../error.php'; // permission denied } elseif (!$permitted) { Safe::header('Status: 401 Unauthorized', TRUE, 401); Logger::error(i18n::s('You are not allowed to perform this operation.')); // send the list of recent contributions by this user } else { // get the list from the cache, if possible $cache_id = 'users/feed.php?id=' . $item['id'] . '#channel';
/** * demonstrate YACS capability to build dynamic pages from XSLT * * A minimum script based on the YACS framework. * * @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'; // load localized strings -- see i18n/i18n.php for more information on internationalization and localization in YACS i18n::bind('tools'); // load the skin load_skin('tools'); if (!defined('DUMMY_TEXT')) { define('DUMMY_TEXT', 'Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.' . ' Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.' . ' Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur.' . ' Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.'); } // the path to this page $context['path_bar'] = array('tools/' => i18n::s('Tools')); // populate page attributes -- attributes used by YACS are described in skins/test.php $context['page_title'] = i18n::s('Hello world'); // $context['navigation'] - navigation boxes $context['navigation'] .= Skin::build_box(i18n::s('navigation') . ' 1', DUMMY_TEXT, 'navigation'); $context['navigation'] .= Skin::build_box(i18n::s('navigation') . ' 2', DUMMY_TEXT, 'navigation'); // $context['extra'] - extra boxes $context['extra'] .= Skin::build_box(i18n::s('extra') . ' 1', DUMMY_TEXT, 'extra'); $context['extra'] .= Skin::build_box(i18n::s('extra') . ' 2', DUMMY_TEXT, 'extra'); // $context['page_author'] - the author $context['page_author'] = 'webmaestro, through some PHP script';
* @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 'comments.php'; // which page should be displayed if (isset($_REQUEST['page'])) { $page = $_REQUEST['page']; } elseif (isset($context['arguments'][0])) { $page = $context['arguments'][0]; } else { $page = 1; } $page = max(1, intval($page)); // load the skin load_skin('comments'); // the title of the page $context['page_title'] = i18n::s('Threads'); // count comments in the database $stats = Comments::stat_threads(); if ($stats['count']) { $context['page_menu'] += array('_count' => sprintf(i18n::ns('%d thread', '%d threads', $stats['count']), $stats['count'])); } // stop hackers if ($page > 1 && ($page - 1) * THREADS_PER_PAGE > $stats['count']) { Safe::header('Status: 401 Unauthorized', TRUE, 401); Logger::error(i18n::s('You are not allowed to perform this operation.')); } else { // navigation commands for comments, if necessary if ($stats['count'] > THREADS_PER_PAGE) { $home = 'comments/';
} elseif (isset($context['arguments'][0]) && isset($context['arguments'][1])) { $id = $context['arguments'][0] . ':' . $context['arguments'][1]; } $id = strip_tags($id); // get the anchor $anchor = Anchors::get($id); // get the related overlay, if any $overlay = NULL; if (is_object($anchor)) { $fields = array(); $fields['id'] = $anchor->get_value('id'); $fields['overlay'] = $anchor->get_value('overlay'); $overlay = Overlay::load($fields, $anchor->get_reference()); } // load the skin, maybe with a variant load_skin('articles', $anchor); // stop crawlers if (Surfer::is_crawler()) { Safe::header('Status: 401 Unauthorized', TRUE, 401); Logger::error(i18n::s('You are not allowed to perform this operation.')); // not found } elseif (!is_object($anchor)) { include '../../error.php'; // permission denied } elseif (!$anchor->is_owned()) { Safe::header('Status: 401 Unauthorized', TRUE, 401); Logger::error(i18n::s('You are not allowed to perform this operation.')); // no overlay } elseif (!is_object($overlay) || !is_callable(array($overlay, 'get_start_url'))) { Logger::error(i18n::s('You are not allowed to perform this operation.')); } elseif (count($context['error'])) {
* @see control/closed.php * * When switching on, the script reset localized strings, in case they would have changed * while the server was off. * * @author Bernard Paques * @author GnapZ * @reference * @license http://www.gnu.org/copyleft/lesser.txt GNU Lesser General Public License */ // include the global declarations include_once '../shared/global.php'; // load localized strings i18n::bind('control'); // load the skin load_skin('control'); // the path to this page $context['path_bar'] = array('control/' => i18n::s('Control Panel')); // the title of the page $context['page_title'] = i18n::s('Main Switch'); // only associates can used the switch if (!Surfer::is_associate()) { // prevent access to this script Safe::header('Status: 401 Unauthorized', TRUE, 401); Logger::error(i18n::s('You are not allowed to perform this operation.')); // back to the control panel $menu = array('control/' => i18n::s('Control Panel')); $context['text'] .= Skin::build_list($menu, 'menu_bar'); // switch on } elseif (isset($_REQUEST['action']) && $_REQUEST['action'] == 'on') { // delete switch parameters, if any
* The YACS archive that contains reference scripts is used jointly on first installation and on upgrades. * However, scripts to be ran once are useful only for upgrades. * Therefore, on first installation (i.e., when the switch file is absent), the extension '.done' is appended to * every script in the directory scripts/run_once without actual execution of them. * * @author Bernard Paques * @author GnapZ * @reference * @license http://www.gnu.org/copyleft/lesser.txt GNU Lesser General Public License */ // include global declarations include_once '../shared/global.php'; // load localized strings i18n::bind('scripts'); // load the skin load_skin('scripts'); // the path to this page $context['path_bar'] = array('control/' => i18n::s('Control Panel')); // the title of the page $context['page_title'] = i18n::s('Run one-time scripts'); // the list of script to take into account global $scripts; $scripts = array(); // if the user table exists, check that the user is an admin $query = "SELECT count(*) FROM " . SQL::table_name('users'); if (SQL::query($query) !== FALSE && !Surfer::is_associate()) { Safe::header('Status: 401 Unauthorized', TRUE, 401); Logger::error(i18n::s('You are not allowed to perform this operation.')); // open the directory } elseif (!($dir = Safe::opendir($context['path_to_root'] . 'scripts/run_once'))) { Logger::error(sprintf(i18n::s('Impossible to read %s.'), $context['path_to_run_once_scripts']));
$member = $_REQUEST['anchor']; } $member = strip_tags($member); // get the member object, which is supposed to be a container $anchor = NULL; if ($member) { $anchor = Anchors::get($member); } // do we have the permission to add new categories? if (Categories::allow_assign(NULL, $anchor)) { $permitted = TRUE; } else { $permitted = FALSE; } // load the skin load_skin('categories'); // the path to this page if (is_object($anchor) && $anchor->is_viewable()) { $context['path_bar'] = $anchor->get_path_bar(); } else { $context['path_bar'] = array('categories/' => i18n::s('Categories')); } // the title of the page if (is_object($anchor)) { $context['page_title'] = sprintf(i18n::s('Categories for: %s'), $anchor->get_title()); } else { $context['page_title'] = i18n::s('Select categories for this page'); } // stop crawlers if (Surfer::is_crawler()) { Safe::header('Status: 401 Unauthorized', TRUE, 401);
* * If the file [code]parameters/demo.flag[/code] exists, the script assumes that this instance * of YACS runs in demonstration mode. * In this mode the edit form is displayed, but parameters are not saved in the configuration file. * * @author Bernard Paques * @author Christophe Battarel [email]christophe.battarel@altairis.fr[/email] * @reference * @license http://www.gnu.org/copyleft/lesser.txt GNU Lesser General Public License */ // common definitions and initial processing include_once 'shared/global.php'; // load localized strings i18n::bind('root'); // load the skin load_skin('root'); // the path to this page $context['path_bar'] = array('control/' => i18n::s('Control Panel')); // the title of the page $context['page_title'] = sprintf(i18n::s('%s: %s'), i18n::s('Configure'), i18n::s('Front page')); // anonymous users are invited to log in or to register if (!Surfer::is_logged()) { Safe::redirect($context['url_to_home'] . $context['url_to_root'] . 'users/login.php?url=' . urlencode('configure.php')); } elseif (!Surfer::is_associate()) { Safe::header('Status: 401 Unauthorized', TRUE, 401); Logger::error(i18n::s('You are not allowed to perform this operation.')); // display the input form } elseif (isset($_SERVER['REQUEST_METHOD']) && $_SERVER['REQUEST_METHOD'] != 'POST') { // first installation if (!file_exists('parameters/switch.on') && !file_exists('parameters/switch.off')) { $context['text'] .= '<p>' . i18n::s('You can use default values and change these later on. Hit the button at the bottom of the page to move forward.') . "</p>\n";