Exemplo n.º 1
0
 /**
  * display content below main panel
  *
  * Everything is in a separate panel
  *
  * @param array the hosting record, if any
  * @return some HTML to be inserted into the resulting page
  */
 function &get_trailer_text($host = NULL)
 {
     $text = '';
     // display the following only if at least one comment has been attached to this page
     if (is_object($this->anchor) && !Comments::count_for_anchor($this->anchor->get_reference())) {
         return $text;
     }
     // ask the surfer if he has not answered yet, and if the page has not been locked
     $ask = TRUE;
     if (isset($_COOKIE['rating_' . $host['id']])) {
         $ask = FALSE;
     } elseif (isset($host['locked']) && $host['locked'] == 'Y') {
         $ask = FALSE;
     }
     // ask the surfer
     if ($ask) {
         $text = '<p style="line-height: 2.5em;">' . i18n::s('Has this page been useful to you?') . ' ' . Skin::build_link(Articles::get_url($host['id'], 'like'), i18n::s('Yes'), 'button') . ' ' . Skin::build_link(Articles::get_url($host['id'], 'dislike'), i18n::s('No'), 'button') . '</p>';
         // or report on results
     } elseif ($host['rating_count']) {
         $text = '<p>' . Skin::build_rating_img((int) round($host['rating_sum'] / $host['rating_count'])) . ' ' . sprintf(i18n::ns('%d rating', '%d ratings', $host['rating_count']), $host['rating_count']) . '</p>';
     }
     // add a title
     if ($text) {
         $text = Skin::build_box(i18n::s('Feed-back'), $text);
     }
     // done
     return $text;
 }
Exemplo n.º 2
0
 /**
  * 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;
     }
     // clear flows
     $text .= '<br style="clear: left" />';
     // process all items in the list
     while ($item = SQL::fetch($result)) {
         // get the related overlay
         $overlay = Overlay::load($item, 'article:' . $item['id']);
         // the url to view this item
         $url = Articles::get_permalink($item);
         // use the title to label the link
         if (is_object($overlay)) {
             $title = Codes::beautify_title($overlay->get_text('title', $item));
         } else {
             $title = Codes::beautify_title($item['title']);
         }
         // the hovering title
         if ($item['introduction'] && $context['skins_with_details'] == 'Y') {
             $hover = strip_tags(Codes::beautify_introduction($item['introduction']));
         } else {
             $hover = i18n::s('View the page');
         }
         // title is a link to the target article
         $title =& Skin::build_link($url, $title, 'basic', $hover);
         // use the thumbnail for this article
         if ($icon = trim($item['thumbnail_url'])) {
             // fix relative path
             if (!preg_match('/^(\\/|http:|https:|ftp:)/', $icon)) {
                 $icon = $context['url_to_root'] . $icon;
             }
             // use parameter of the control panel for this one
             $options = '';
             if (isset($context['classes_for_thumbnail_images'])) {
                 $options = 'class="' . $context['classes_for_thumbnail_images'] . '" ';
             }
             // build the complete HTML element
             $icon = '<img src="' . $icon . '" alt="" title="' . encode_field($hover) . '" ' . $options . ' />';
             // use default icon if nothing to display
         } else {
             $icon = MAP_IMG;
         }
         // use the image as a link to the target page
         $icon =& Skin::build_link($url, $icon, 'basic', $hover);
         // add a floating box
         $text .= Skin::build_box($title, $icon, 'floating');
     }
     // clear flows
     $text .= '<br style="clear: left" />';
     // end of processing
     SQL::free($result);
     return $text;
 }
Exemplo n.º 3
0
 /**
  * retrieve endpoints of last calls
  *
  * This is useful to list all servers notified after a publication.
  *
  * @param string title of the folded box generated
  * @return mixed text to be integrated into the page, or array with one item per recipient, or ''
  */
 public static function build_endpoints($title = NULL)
 {
     global $context;
     // nothing to show
     if (!Surfer::get_id() || !isset($context['servers_endpoints']) || !$context['servers_endpoints']) {
         return '';
     }
     // return the bare list
     if (!$title) {
         return $context['servers_endpoints'];
     }
     // build a nice list
     $list = array();
     foreach ($context['servers_endpoints'] as $recipient) {
         $list[] = htmlspecialchars($recipient);
     }
     return Skin::build_box($title, Skin::finalize_list($list, 'compact'), 'folded');
 }
Exemplo n.º 4
0
        $home = Sections::get_permalink($item);
        $prefix = Sections::get_url($item['id'], 'navigate', 'links');
        $box['bar'] = array_merge($box['bar'], Skin::navigate($home, $prefix, $count, LINKS_PER_PAGE, $zoom_index));
    }
    // new links are allowed -- check option 'with_links'
    if (Links::allow_creation($item, $anchor, 'section')) {
        Skin::define_img('LINKS_ADD_IMG', 'links/add.gif');
        $box['bar'] += array('links/edit.php?anchor=' . urlencode('section:' . $item['id']) => LINKS_ADD_IMG . i18n::s('Add a link'));
    }
    // integrate commands
    if (count($box['bar'])) {
        $box['text'] = Skin::build_list($box['bar'], 'menu_bar') . $box['text'];
    }
    // there is some box content
    if (trim($box['text'])) {
        $attachments .= Skin::build_box(i18n::s('Links'), $box['text'], 'header1', 'links');
    }
}
// display in a separate panel
if (trim($attachments)) {
    $label = i18n::s('Attachments');
    if ($attachments_count) {
        $label .= ' (' . $attachments_count . ')';
    }
    $panels[] = array('attachments', $label, 'attachments_panel', $attachments);
}
//
// users
//
$users = '';
$users_count = 0;
Exemplo n.º 5
0
Arquivo: review.php Projeto: rair/yacs
}
// list future articles
if (Surfer::is_associate() && ($rows =& Articles::list_by('future', 0, 5))) {
    if (is_array($rows)) {
        $rows = Skin::build_list($rows, 'decorated');
    }
    $context['text'] .= Skin::build_box(i18n::s('Future articles'), $rows, 'header1', 'future');
}
// list dead articles
if (Surfer::is_associate() && ($rows =& Articles::list_by('expiry', 0, 10, 'hits'))) {
    if (is_array($rows)) {
        $rows = Skin::build_list($rows, 'decorated');
    }
    $context['text'] .= Skin::build_box(i18n::s('Dead articles'), $rows, 'header1', 'expired');
}
// list the oldest published articles, that have to be validated again
if (Surfer::is_associate() && ($rows =& Articles::list_by('review', 0, 10, 'review'))) {
    if (is_array($rows)) {
        $rows = Skin::build_list($rows, 'decorated');
    }
    $context['text'] .= Skin::build_box(i18n::s('Oldest articles'), $rows, 'header1', 'oldest');
}
// list articles with very few hits
if (Surfer::is_associate() && ($rows =& Articles::list_by('unread', 0, 10, 'hits'))) {
    if (is_array($rows)) {
        $rows = Skin::build_list($rows, 'decorated');
    }
    $context['text'] .= Skin::build_box(i18n::s('Less read articles'), $rows, 'header1', 'unread');
}
// render the skin
render_skin();
Exemplo n.º 6
0
Arquivo: scan.php Projeto: rair/yacs
        $context['text'] .= Skin::build_block('<form method="post" action="setup.php"><p class="assistant_bar">' . "\n" . Skin::build_submit_button(i18n::s('Database maintenance')) . "\n" . '<input type="hidden" name="action" value="build" />' . "\n" . '</p></form>', 'bottom');
        // this may take several minutes
        $context['text'] .= '<p>' . i18n::s('When you will click on the button the server will be immediately requested to proceed. However, because of the so many things to do on the back-end, you may have to wait for minutes before getting a response displayed. Thank you for your patience.') . '</p>';
        // create the database on first installation
    } elseif (!file_exists('../parameters/switch.on')) {
        $context['text'] .= Skin::build_block('<form method="post" action="setup.php"><p class="assistant_bar">' . "\n" . Skin::build_submit_button(i18n::s('Create tables in the database')) . "\n" . '<input type="hidden" name="action" value="build" />' . "\n" . '</p></form>', 'bottom');
        // this may take several minutes
        $context['text'] .= '<p>' . i18n::s('When you will click on the button the server will be immediately requested to proceed. However, because of the so many things to do on the back-end, you may have to wait for minutes before getting a response displayed. Thank you for your patience.') . '</p>';
        // or back to the control panel
    } else {
        $menu = array('control/' => i18n::s('Control Panel'), 'control/setup.php' => i18n::s('Database maintenance'));
        $context['text'] .= Skin::build_list($menu, 'menu_bar');
    }
    // display current hooks
} else {
    // the splash message
    $context['text'] .= i18n::s('This script will scan your php scripts to install software hooks.');
    // the submit button
    $context['text'] .= '<form method="post" action="' . $context['script_url'] . '" id="main_form"><p>' . Skin::build_submit_button(i18n::s('Scan scripts for software extensions'), NULL, NULL, 'confirmed') . '<input type="hidden" name="action" value="check" />' . '</p></form>';
    // the script used for form handling at the browser
    Page::insert_script('$("#confirmed").focus();');
    // this may take several minutes
    $context['text'] .= '<p>' . i18n::s('When you will click on the button the server will be immediately requested to proceed. However, because of the so many things to do on the back-end, you may have to wait for minutes before getting a response displayed. Thank you for your patience.') . '</p>';
    // display the existing hooks configuration file, if any
    $content = Safe::file_get_contents('../parameters/hooks.include.php');
    if (strlen($content)) {
        $context['text'] .= Skin::build_box(sprintf(i18n::s('Current content of %s'), 'parameters/hooks.include.php'), Safe::highlight_string($content), 'folded');
    }
}
// render the skin
render_skin();
Exemplo n.º 7
0
 if ($items) {
     $context['text'] .= Skin::build_box(i18n::s('Comments'), utf8::to_unicode($items));
 }
 //
 // related links
 //
 // list links by date (default) or by title (option :links_by_title:)
 $items = array();
 if (Articles::has_option('links_by_title', $anchor, $item)) {
     $items = Links::list_by_title_for_anchor('article:' . $item['id'], 0, 50, 'compact');
 } else {
     $items = Links::list_by_date_for_anchor('article:' . $item['id'], 0, 50, 'compact');
 }
 // actually list items
 if (count($items)) {
     $context['text'] .= Skin::build_box(i18n::s('See also'), utf8::to_unicode(Skin::build_list($items, 'compact')));
 }
 //
 // page suffix
 //
 // link to the original page
 $context['text'] .= '<p>' . sprintf(i18n::s('The original page is located at %s'), Skin::build_link(Articles::get_permalink($item), Articles::get_permalink($item))) . "</p>\n";
 // insert anchor suffix
 if (is_object($anchor)) {
     $context['text'] .= $anchor->get_suffix();
 }
 //
 // special rendering if everything is ok
 //
 $text = '<html><body>' . "\n";
 // display the title
Exemplo n.º 8
0
 /**
  * list articles as digg do
  *
  * @param resource the SQL result
  * @return string the rendered text
  *
  * @see layouts/layout.php
  **/
 function layout($result)
 {
     global $context;
     // empty list
     if (!SQL::count($result)) {
         $label = i18n::s('No page to display.');
         if (Surfer::is_associate()) {
             $label .= ' ' . sprintf(i18n::s('Use the %s to populate this server.'), Skin::build_link('help/populate.php', i18n::s('Content Assistant'), 'shortcut'));
         }
         $output = '<p>' . $label . '</p>';
         return $output;
     }
     // build a list of articles
     $text = '';
     $item_count = 0;
     include_once $context['path_to_root'] . 'comments/comments.php';
     include_once $context['path_to_root'] . 'links/links.php';
     while ($item = SQL::fetch($result)) {
         // permalink
         $url = Articles::get_permalink($item);
         // get the anchor
         $anchor = Anchors::get($item['anchor']);
         // get the related overlay, if any
         $overlay = Overlay::load($item, 'article:' . $item['id']);
         // next item
         $item_count += 1;
         // section opening
         if ($item_count == 1) {
             $text .= '<div class="newest">' . "\n";
         }
         // reset everything
         $content = $prefix = $label = $suffix = $icon = '';
         // the icon to put aside
         if ($item['thumbnail_url']) {
             $icon = $item['thumbnail_url'];
         } elseif (is_callable(array($anchor, 'get_bullet_url'))) {
             $icon = $anchor->get_bullet_url();
         }
         if ($icon) {
             $icon = '<a href="' . $context['url_to_root'] . $url . '"><img src="' . $icon . '" class="right_image" alt="' . encode_field(i18n::s('View the page')) . '" title="' . encode_field(i18n::s('View the page')) . '" /></a>';
         }
         // signal restricted and private articles
         if ($item['active'] == 'N') {
             $prefix .= PRIVATE_FLAG;
         } elseif ($item['active'] == 'R') {
             $prefix .= RESTRICTED_FLAG;
         }
         // flag articles updated recently
         if ($item['create_date'] >= $context['fresh']) {
             $suffix .= ' ' . NEW_FLAG;
         } elseif ($item['edit_date'] >= $context['fresh']) {
             $suffix .= ' ' . UPDATED_FLAG;
         }
         // add details
         $details = array();
         // the author
         if (isset($context['with_author_information']) && $context['with_author_information'] == 'Y') {
             if ($item['edit_name'] == $item['create_name']) {
                 $details[] = sprintf(i18n::s('by %s'), ucfirst($item['create_name']));
             } else {
                 $details[] = sprintf(i18n::s('by %s, %s'), ucfirst($item['create_name']), ucfirst($item['edit_name']));
             }
         }
         // the publish date
         $details[] = Skin::build_date($item['publish_date']);
         // rating
         $rating_label = '';
         if ($item['rating_count']) {
             $rating_label = Skin::build_rating_img((int) round($item['rating_sum'] / $item['rating_count'])) . ' ' . sprintf(i18n::ns('%d rating', '%d ratings', $item['rating_count']), $item['rating_count']) . ' ';
         }
         // add a link to let surfer rate this item
         if (is_object($anchor) && !$anchor->has_option('without_rating')) {
             if (!$item['rating_count']) {
                 $rating_label .= i18n::s('Rate this page');
             }
             $rating_label = Skin::build_link(Articles::get_url($item['id'], 'like'), $rating_label, 'basic', i18n::s('Rate this page'));
         }
         // display current rating, and allow for rating
         $details[] = $rating_label;
         // details
         if (count($details)) {
             $content .= '<p class="details">' . ucfirst(implode(', ', $details)) . '</p>';
         }
         // the full introductory text
         if ($item['introduction']) {
             $content .= Codes::beautify($item['introduction'], $item['options']);
         } elseif (!is_object($overlay)) {
             include_once $context['path_to_root'] . 'articles/article.php';
             $article = new Article();
             $article->load_by_content($item);
             $content .= $article->get_teaser('teaser');
         }
         // insert overlay data, if any
         if (is_object($overlay)) {
             $content .= $overlay->get_text('list', $item);
         }
         // an array of links
         $menu = array();
         // rate the article
         $menu = array_merge($menu, array(Articles::get_url($item['id'], 'like') => i18n::s('Rate this page')));
         // read the article
         $menu = array_merge($menu, array($url => i18n::s('Read more')));
         // info on related files
         if ($count = Files::count_for_anchor('article:' . $item['id'], TRUE)) {
             $details[] = Skin::build_link($url . '#_attachments', sprintf(i18n::ns('%d file', '%d files', $count), $count), 'basic');
         }
         // info on related comments
         if ($count = Comments::count_for_anchor('article:' . $item['id'], TRUE)) {
             $link = Comments::get_url('article:' . $item['id'], 'list');
             $menu = array_merge($menu, array($link => sprintf(i18n::ns('%d comment', '%d comments', $count), $count)));
         }
         // discuss
         if (Comments::allow_creation($item, $anchor)) {
             $menu = array_merge($menu, array(Comments::get_url('article:' . $item['id'], 'comment') => i18n::s('Discuss')));
         }
         // info on related links
         if ($count = Links::count_for_anchor('article:' . $item['id'], TRUE)) {
             $menu = array_merge($menu, array($url . '#_attachments' => sprintf(i18n::ns('%d link', '%d links', $count), $count)));
         }
         // trackback
         if (Links::allow_trackback()) {
             $menu = array_merge($menu, array('links/trackback.php?anchor=' . urlencode('article:' . $item['id']) => i18n::s('Reference this page')));
         }
         // link to the anchor page
         if (is_object($anchor)) {
             $menu = array_merge($menu, array($anchor->get_url() => $anchor->get_title()));
         }
         // list up to three categories by title, if any
         if ($items = Members::list_categories_by_title_for_member('article:' . $item['id'], 0, 3, 'raw')) {
             foreach ($items as $id => $attributes) {
                 $menu = array_merge($menu, array(Categories::get_permalink($attributes) => $attributes['title']));
             }
         }
         // append a menu
         $content .= Skin::build_list($menu, 'menu_bar');
         // insert a complete box
         $text .= Skin::build_box($icon . $prefix . Codes::beautify_title($item['title']) . $suffix, $content, 'header1', 'article_' . $item['id']);
         // section closing
         if ($item_count == 1) {
             $text .= '</div>' . "\n";
         }
     }
     // end of processing
     SQL::free($result);
     // add links to archives
     $anchor = Categories::get(i18n::c('monthly'));
     if (isset($anchor['id']) && ($items = Categories::list_by_date_for_anchor('category:' . $anchor['id'], 0, COMPACT_LIST_SIZE, 'compact'))) {
         $text .= Skin::build_box(i18n::s('Previous pages'), Skin::build_list($items, 'menu_bar'));
     }
     return $text;
 }
Exemplo n.º 9
0
Arquivo: cloud.php Projeto: rair/yacs
if (!($text = Cache::get($cache_id))) {
    // query the database and layout that stuff
    if (!($text =& Members::list_categories_by_count_for_anchor(NULL, 0, 200, 'cloud'))) {
        $text = '<p>' . i18n::s('No item has been found.') . '</p>';
    }
    // we have an array to format
    if (is_array($text)) {
        $text =& Skin::build_list($text, '2-columns');
    }
    // make a box
    if ($text) {
        $text =& Skin::build_box('', $text, 'header1', 'categories');
    }
    // cache this to speed subsequent queries
    Cache::put($cache_id, $text, 'categories');
}
$context['text'] .= $text;
// display extra information
$cache_id = 'categories/cloud.php#extra';
if (!($text = Cache::get($cache_id))) {
    // add an extra box with helpful links
    $links = array('sections/' => i18n::s('Site map'), 'search.php' => i18n::s('Search'), 'help/' => i18n::s('Help index'), 'query.php' => i18n::s('Contact'));
    $text .= Skin::build_box(i18n::s('See also'), Skin::build_list($links, 'compact'), 'boxes') . "\n";
    // save for later use
    Cache::put($cache_id, $text, 'articles');
}
$context['components']['boxes'] = $text;
// referrals, if any
$context['components']['referrals'] =& Skin::build_referrals('categories/cloud.php');
// render the skin
render_skin();
Exemplo n.º 10
0
Arquivo: view.php Projeto: rair/yacs
         // list categories by title
         $offset = ($zoom_index - 1) * CATEGORIES_PER_PAGE;
         $items =& Members::list_categories_by_title_for_member('article:' . $item['id'], $offset, CATEGORIES_PER_PAGE, 'sidebar');
         // the command to change categories assignments
         if (Categories::allow_assign($item, $anchor)) {
             $items = array_merge($items, array(Categories::get_url('article:' . $item['id'], 'select') => i18n::s('Assign categories')));
         }
         // actually render the html for the section
         if (is_array($box['bar'])) {
             $box['text'] .= Skin::build_list($box['bar'], 'menu_bar');
         }
         if (is_array($items)) {
             $box['text'] .= Skin::build_list($items, 'compact');
         }
         if ($box['text']) {
             $context['components']['categories'] = Skin::build_box(i18n::s('See also'), $box['text'], 'categories', 'categories');
         }
     }
     // referrals, if any
     $context['components']['referrals'] =& Skin::build_referrals(Articles::get_permalink($item));
 }
 //
 // the main part of the page
 //
 $context['page_description'] = '';
 // filter description, if necessary
 if (is_object($overlay)) {
     $description = $overlay->get_text('description', $item);
 } else {
     $description = $item['description'];
 }
Exemplo n.º 11
0
                 $selected = '';
                 if ($overlay_name == $overlay_type) {
                     $selected = ' selected="selected"';
                 }
                 $input .= '<option value="' . $overlay_name . '"' . $selected . '>' . $overlay_name . "</option>\n";
             }
         }
     }
     $input .= '</select>';
     $fields[] = array($label, $input, $hint);
     // remember overlay type
 } elseif (is_object($overlay)) {
     $text .= '<input type="hidden" name="overlay_type" value="' . encode_field($overlay->get_type()) . '" />';
 }
 // add a folded box
 $text .= Skin::build_box(i18n::s('More options'), Skin::build_form($fields), 'folded');
 $fields = array();
 // display in a separate panel
 if ($text) {
     $panels[] = array('options', i18n::s('Options'), 'options_panel', $text);
 }
 // preserve attributes coming from template duplication
 if (!isset($item['id'])) {
     $hidden = array('behaviors', 'extra', 'icon_url', 'index_map', 'prefix', 'suffix', 'trailer');
     foreach ($hidden as $name) {
         if (isset($item[$name])) {
             $context['text'] .= '<input type="hidden" name="' . $name . '" value="' . $item[$name] . '" />';
         }
     }
 }
 // or preserve attributes not managed interactively
Exemplo n.º 12
0
Arquivo: edit.php Projeto: rair/yacs
 // build the form
 $text .= Skin::build_form($fields);
 $fields = array();
 // display in a separate panel
 if ($text) {
     $panels[] = array('information', i18n::s('Information'), 'information_panel', $text);
 }
 //
 // resources tab
 //
 $text = '';
 // splash message for new items
 if (!isset($item['id'])) {
     $text .= '<p>' . i18n::s('Submit the new item, and you will be able to add resources afterwards.') . '</p>';
 } elseif ($items = Images::list_by_date_for_anchor('file:' . $item['id'])) {
     $text .= Skin::build_box(i18n::s('Images'), Skin::build_list($items, 'decorated'), 'unfolded', 'edit_images');
 }
 // display in a separate panel
 if ($text) {
     $panels[] = array('resources', i18n::s('Resources'), 'resources_panel', $text);
 }
 //
 // options tab
 //
 $text = '';
 // associates may change the active flag: Yes/public, Restricted/logged, No/associates
 if (Surfer::is_member()) {
     $label = i18n::s('Access');
     $input = Skin::build_active_set_input($item);
     $hint = Skin::build_active_set_hint($anchor);
     $fields[] = array($label, $input, $hint);
Exemplo n.º 13
0
Arquivo: view.php Projeto: rair/yacs
    }
    $context['text'] .= Skin::finalize_list($links, 'assistant_bar');
    // page help
    $help = '';
    // information to members
    if (Surfer::is_member()) {
        $help .= '<p>' . sprintf(i18n::s('This has been posted by %s %s.'), Users::get_link($item['edit_name'], $item['edit_address'], $item['edit_id']), Skin::build_date($item['edit_date'])) . "</p>\n";
    }
    $help .= '<p><ins>' . i18n::s('Text inserted since that version.') . '</ins></p>' . '<p><del>' . i18n::s('Text suppressed from this version.') . '</del></p>' . '<p>' . i18n::s('Caution: restoration can not be reversed!') . '</p>';
    $context['components']['boxes'] = Skin::build_box(i18n::s('Help'), $help, 'boxes', 'help');
    //
    // the navigation sidebar
    //
    $text = '';
    // buttons to display previous and next pages, if any
    if (is_object($anchor)) {
        $neighbours = $anchor->get_neighbours('version', $item);
        $text .= Skin::neighbours($neighbours, 'sidebar');
    }
    // build a nice sidebar box
    if ($text) {
        $text =& Skin::build_box(i18n::s('Navigation'), $text, 'neighbours', 'neighbours');
    }
    $context['components']['neighbours'] = $text;
    //
    // referrals, if any, in a sidebar
    //
    $context['components']['referrals'] =& Skin::build_referrals(Versions::get_url($item['id']));
}
// render the skin
render_skin();
Exemplo n.º 14
0
Arquivo: index.php Projeto: rair/yacs
    $context['page_tools'][] = Skin::build_link(Scripts::get_url('licenses'), i18n::s('Licenses'), 'basic');
    // splash message
    $text = '<p>' . i18n::s('Click on any link below to access the documentation extracted from each script (phpDoc).') . "</p>\n";
    // tree of links to documentation pages
    $text .= Codes::beautify($item['content']);
    // link to some other server
} else {
    $text = '<p>' . i18n::s('The complete documentation is available at the following server:') . '</p>';
    // link to the existing reference server, or to the original server
    if (!isset($context['reference_server']) || !$context['reference_server']) {
        $context['reference_server'] = i18n::s('www.yacs.fr');
    }
    $text .= '<p>' . Skin::build_link('http://' . $context['reference_server'] . '/', $context['reference_server'], 'external') . "</p>\n";
}
// documentation box
$context['text'] .= Skin::build_box(i18n::s('On-line Documentation'), $text);
// page tools
if (Surfer::is_associate()) {
    // patch the server
    $context['page_tools'][] = Skin::build_link('scripts/upload.php', i18n::s('Apply a patch'), 'basic');
    // signal scripts to run once, if any
    if (Safe::glob($context['path_to_root'] . 'scripts/run_once/*.php') !== FALSE) {
        $context['page_tools'][] = Skin::build_link('scripts/run_once.php', i18n::s('Run once'), 'basic');
    }
    // stage from reference server
    $context['page_tools'][] = Skin::build_link('scripts/stage.php', i18n::s('Update the software'), 'basic');
    // set the reference server
    $context['page_tools'][] = Skin::build_link('scripts/configure.php', i18n::s('Configure'), 'basic');
    // check script signatures
    $context['page_tools'][] = Skin::build_link('scripts/check.php', i18n::s('Check software integrity'), 'basic');
    // validate scripts
Exemplo n.º 15
0
Arquivo: mail.php Projeto: rair/yacs
        // back to the category page
        $menu = array();
        $menu[] = Skin::build_link(Categories::get_permalink($item), i18n::s('Done'), 'button');
        $context['text'] .= Skin::finalize_list($menu, 'assistant_bar');
    }
    Mailer::close();
    // no recipient has been found
} elseif (!($recipients =& Members::list_users_by_posts_for_anchor('category:' . $item['id'], 0, 200, 'mail')) || !count($recipients)) {
    Logger::error(i18n::s('No recipient has been found.'));
    // display the form
} else {
    // the form to send a message
    $context['text'] .= '<form method="post" action="' . $context['script_url'] . '" onsubmit="return validateDocumentPost(this)" id="main_form"><div>';
    // build a nice list of recipients
    $label = i18n::s('Message recipients');
    $input = Skin::build_box(i18n::s('Select recipients'), $recipients, 'folded');
    $fields[] = array($label, $input);
    // the subject
    $label = i18n::s('Message title');
    $input = '<input type="text" name="subject" id="subject" size="70" value="' . encode_field($item['title']) . '" />';
    $fields[] = array($label, $input);
    // the message
    $label = i18n::s('Message content');
    $input = Surfer::get_editor('message', '<p>' . $item['title'] . BR . Categories::get_permalink($item) . '</p>');
    $fields[] = array($label, $input);
    // build the form
    $context['text'] .= Skin::build_form($fields);
    //
    // bottom commands
    //
    $menu = array();
Exemplo n.º 16
0
 /**
  * list categories
  *
  * @param resource the SQL result
  * @return string the rendered text
  *
  * @see layouts/layout.php
  **/
 function layout($result)
 {
     global $context;
     // empty list
     if (!SQL::count($result)) {
         $output = array();
         return $output;
     }
     // we return plain text
     $text = '';
     // process all items in the list
     while ($item = SQL::fetch($result)) {
         // one box per category
         $box['title'] = '';
         $box['text'] = '';
         // use the title to label the link
         $box['title'] = Skin::strip($item['title'], 50);
         // list related categories, if any
         if ($items = Categories::list_by_date_for_anchor('category:' . $item['id'], 0, COMPACT_LIST_SIZE, 'compact')) {
             foreach ($items as $url => $label) {
                 if (is_array($label)) {
                     $label = $label[1];
                 }
                 $box['text'] .= '<li>' . Skin::build_link($url, $label, 'category') . '</li>' . "\n";
             }
         }
         // info on related sections
         $items =& Members::list_sections_by_title_for_anchor('category:' . $item['id'], 0, COMPACT_LIST_SIZE);
         if ($items) {
             foreach ($items as $url => $label) {
                 if (is_array($label)) {
                     $label = $label[1];
                 }
                 $box['text'] .= '<li>' . Skin::build_link($url, $label, 'section') . '</li>' . "\n";
             }
         }
         // info on related articles
         if (isset($item['options']) && preg_match('/\\barticles_by_title\\b/i', $item['options'])) {
             $items =& Members::list_articles_by_title_for_anchor('category:' . $item['id'], 0, COMPACT_LIST_SIZE);
         } else {
             $items =& Members::list_articles_by_date_for_anchor('category:' . $item['id'], 0, COMPACT_LIST_SIZE);
         }
         if ($items) {
             foreach ($items as $url => $label) {
                 if (is_array($label)) {
                     $label = $label[1];
                 }
                 $box['text'] .= '<li>' . Skin::build_link($url, $label, 'article') . '</li>' . "\n";
             }
         }
         // info on related files
         if (isset($item['options']) && preg_match('/\\bfiles_by_title\\b/i', $item['options'])) {
             $items = Files::list_by_title_for_anchor('category:' . $item['id'], 0, COMPACT_LIST_SIZE, 'category:' . $item['id']);
         } else {
             $items = Files::list_by_date_for_anchor('category:' . $item['id'], 0, COMPACT_LIST_SIZE, 'category:' . $item['id']);
         }
         if ($items) {
             foreach ($items as $url => $label) {
                 if (is_array($label)) {
                     $label = $label[1];
                 }
                 $box['text'] .= '<li>' . Skin::build_link($url, $label, 'file') . '</li>' . "\n";
             }
         }
         // info on related comments
         include_once $context['path_to_root'] . 'comments/comments.php';
         if ($items = Comments::list_by_date_for_anchor('category:' . $item['id'], 0, COMPACT_LIST_SIZE, 'compact')) {
             foreach ($items as $url => $label) {
                 if (is_array($label)) {
                     $label = $label[1];
                 }
                 $box['text'] .= '<li>' . Skin::build_link($url, $label, 'comment') . '</li>' . "\n";
             }
         }
         // info on related links
         include_once $context['path_to_root'] . 'links/links.php';
         if (isset($item['options']) && preg_match('/\\blinks_by_title\\b/i', $item['options'])) {
             $items = Links::list_by_title_for_anchor('category:' . $item['id'], 0, COMPACT_LIST_SIZE);
         } else {
             $items = Links::list_by_date_for_anchor('category:' . $item['id'], 0, COMPACT_LIST_SIZE);
         }
         if ($items) {
             foreach ($items as $url => $label) {
                 if (is_array($label)) {
                     $label = $label[1];
                 }
                 $box['text'] .= '<li>' . Skin::build_link($url, $label) . '</li>' . "\n";
             }
         }
         // add a direct link to the category
         if (Surfer::is_associate()) {
             $box['title'] .= '&nbsp;' . Skin::build_link(Categories::get_permalink($item), MORE_IMG, 'basic');
         }
         // make a full list
         if ($box['text']) {
             $box['text'] = '<ul>' . $box['text'] . '</ul>' . "\n";
         }
         // always make a box, to let associates visit the category
         $text .= Skin::build_box($box['title'], $box['text']);
     }
     // end of processing
     SQL::free($result);
     return $text;
 }
Exemplo n.º 17
0
Arquivo: index.php Projeto: rair/yacs
        Cache::put($cache_id, $text, 'categories');
    }
    $context['text'] .= $text;
}
// page tools
if (Surfer::is_associate()) {
    $context['page_tools'][] = Skin::build_link('categories/edit.php', i18n::s('Add a category'));
    $context['page_tools'][] = Skin::build_link('help/populate.php', i18n::s('Content Assistant'));
    $context['page_tools'][] = Skin::build_link('categories/check.php', i18n::s('Maintenance'));
}
// display extra information
$cache_id = 'categories/index.php#extra';
if (!($text = Cache::get($cache_id))) {
    // see also
    $links = array('categories/cloud.php' => i18n::s('Cloud of tags'), 'sections/' => i18n::s('Site map'), 'search.php' => i18n::s('Search'), 'help/' => i18n::s('Help index'), 'query.php' => i18n::s('Contact'));
    $text .= Skin::build_box(i18n::s('See also'), Skin::build_list($links, 'compact'), 'boxes');
    // side bar with the list of most popular articles, if this server is well populated
    if ($stats['count'] > CATEGORIES_PER_PAGE) {
        if ($items = Categories::list_by_hits(0, COMPACT_LIST_SIZE, 'compact')) {
            $title = i18n::s('Popular');
            $text .= Skin::build_box($title, Skin::build_list($items, 'compact'), 'boxes');
        }
    }
    // cache, whatever change, for 5 minutes
    Cache::put($cache_id, $text, 'stable', 300);
}
$context['components']['boxes'] = $text;
// referrals, if any
$context['components']['referrals'] = Skin::build_referrals('categories/index.php');
// render the skin
render_skin();
Exemplo n.º 18
0
Arquivo: index.php Projeto: rair/yacs
                if (Surfer::is_associate()) {
                    $links[] = Skin::build_link('locations/', 'locations', 'shortcut');
                }
                if (Surfer::is_associate()) {
                    $links[] = Skin::build_link('overlays/', 'overlays', 'shortcut');
                }
                $links[] = Skin::build_link('scripts/', 'scripts', 'shortcut');
                $links[] = Skin::build_link('sections/', 'sections', 'shortcut');
                $links[] = Skin::build_link('servers/', 'servers', 'shortcut');
                $links[] = Skin::build_link('services/', 'services', 'shortcut');
                $links[] = Skin::build_link('skins/', 'skins', 'shortcut');
                $links[] = Skin::build_link('smileys/', 'smileys', 'shortcut');
                if (Surfer::is_associate()) {
                    $links[] = Skin::build_link('tables/', 'tables', 'shortcut');
                }
                if (Surfer::is_associate()) {
                    $links[] = Skin::build_link('tools/', 'tools', 'shortcut');
                }
                $links[] = Skin::build_link('users/', 'users', 'shortcut');
                // the hook for more modules
                if (is_callable(array('Hooks', 'link_scripts')) && ($more_links = Hooks::link_scripts('control/index.php#modules', 'array'))) {
                    $links = array_merge($links, $more_links);
                }
                // list modules in an extra box
                $context['components']['boxes'] .= Skin::build_box(i18n::s('Modules'), Skin::finalize_list($links, 'compact'), 'boxes');
            }
        }
    }
}
// render the skin
render_skin();
Exemplo n.º 19
0
Arquivo: index.php Projeto: rair/yacs
    // save in cache, whatever change, for 5 minutes
    Cache::put($cache_id, $text, 'stable', 300);
}
// news
$context['components']['news'] = $text;
// list extra boxes
$text = '';
if ($anchor = Sections::lookup('extra_boxes')) {
    // the maximum number of boxes is a global parameter
    if (!isset($context['site_extra_maximum']) || !$context['site_extra_maximum']) {
        $context['site_extra_maximum'] = 7;
    }
    // articles to be displayed as extra boxes
    if ($items =& Articles::list_for_anchor_by('publication', $anchor, 0, $context['site_extra_maximum'], 'boxes')) {
        foreach ($items as $title => $attributes) {
            $text .= Skin::build_box($title, $attributes['content'], 'boxes', $attributes['id']) . "\n";
        }
    }
}
// boxes
$context['components']['boxes'] = $text;
// referrals, if any
if (Surfer::is_associate() || isset($context['with_referrals']) && $context['with_referrals'] == 'Y') {
    $context['components']['referrals'] =& Skin::build_referrals('index.php');
}
//
// compute navigation information -- $context['navigation']
//
// a meta link to a feeding page
$context['page_header'] .= "\n" . '<link rel="alternate" href="' . $context['url_to_root'] . Feeds::get_url('rss') . '" title="RSS" type="application/rss+xml" />';
// a meta link to our blogging interface
Exemplo n.º 20
0
Arquivo: page.php Projeto: rair/yacs
 /**
  * echo the list of visited pages
  *
  * You can override this function into your skin
  */
 public static function echo_visited()
 {
     global $context;
     // visited pages are listed in session space
     if (isset($_SESSION['visited']) && count($_SESSION['visited']) && is_callable(array('i18n', 's'))) {
         echo Skin::build_box(i18n::s('Visited'), Skin::build_list($_SESSION['visited'], 'compact'), 'extra', 'visited_pages');
     }
 }
Exemplo n.º 21
0
 /**
  * display available recording, if any
  *
  * This function retrieves the list of available recordings from the BBB server,
  * and displays it to the surfer.
  */
 function get_view_text_extension()
 {
     global $context;
     // parameters to list recordings
     $parameters = array();
     $parameters[] = 'meetingID=' . urlencode($this->attributes['id']);
     // link to list recordings
     $url = $this->build_link('getRecordings', $parameters);
     // query the BBB back-end
     if (($response = http::proceed_natively($url)) && ($xml = simplexml_load_string($response)) && $xml->returncode == 'SUCCESS') {
         // ok, we have some recording available
         if ($recordings = $xml->recordings->children()) {
             // enumerate recordings, but use only the first one
             foreach ($recordings as $name => $node) {
                 // sanity checks
                 if ($name != 'recording') {
                     continue;
                 }
                 if (!isset($node->playback)) {
                     continue;
                 }
                 if (!isset($node->playback->format)) {
                     continue;
                 }
                 if (!isset($node->playback->format->url)) {
                     continue;
                 }
                 // a button to start the replay in a separate window
                 $menu = array();
                 $menu[] = Skin::build_link((string) $node->playback->format->url, 'Play the presentation', 'tee');
                 return Skin::build_box('Presentation', Skin::finalize_list($menu, 'menu_bar'));
             }
         }
     }
 }
Exemplo n.º 22
0
Arquivo: index.php Projeto: rair/yacs
    // see also
    $lines = array();
    $lines[] = Skin::build_link('categories/', i18n::s('Categories'));
    $lines[] = Skin::build_link('search.php', i18n::s('Search'));
    $lines[] = Skin::build_link('help/', i18n::s('Help index'));
    $lines[] = Skin::build_link('query.php', i18n::s('Contact'));
    $text .= Skin::build_box(i18n::s('See also'), Skin::finalize_list($lines, 'compact'), 'boxes');
    // list monthly publications in an extra box
    $anchor = Categories::get(i18n::c('monthly'));
    if (isset($anchor['id']) && ($items = Categories::list_by_date_for_anchor('category:' . $anchor['id'], 0, COMPACT_LIST_SIZE, 'compact'))) {
        $text .= Skin::build_box($anchor['title'], Skin::build_list($items, 'compact'), 'boxes') . "\n";
    }
    // side boxes for related categories, if any
    if ($categories = Categories::list_by_date_for_display('section:index', 0, 7, 'raw')) {
        foreach ($categories as $id => $attributes) {
            // link to the category page from the box title
            $label =& Skin::build_box_title(Skin::strip($attributes['title']), Categories::get_permalink($attributes), i18n::s('View the category'));
            // box content
            if ($items =& Members::list_articles_by_date_for_anchor('category:' . $id, 0, COMPACT_LIST_SIZE, 'compact')) {
                $text .= Skin::build_box($label, Skin::build_list($items, 'compact'), 'boxes') . "\n";
            }
        }
    }
    // save, whatever change, for 5 minutes
    Cache::put($cache_id, $text, 'stable', 300);
}
$context['components']['boxes'] = $text;
// referrals, if any
$context['components']['referrals'] = Skin::build_referrals('sections/index.php');
// render the skin
render_skin();
Exemplo n.º 23
0
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';
// back to skin index
$context['page_menu'] += array('skins/' => i18n::s('Themes'));
// $context['page_publisher'] - the publisher
$context['page_publisher'] = 'webmaestro again, still through some PHP script';
// $context['path_bar'] - back to other sections
$context['path_bar'] = array('skins/' => i18n::s('Themes'));
// $context['text'] - some text
$context['text'] .= '<p>' . DUMMY_TEXT . '</p>' . '<p>' . DUMMY_TEXT . '</p>' . '<p>' . DUMMY_TEXT . '</p>';
// do the transformation
$data = xml::load_array($context);
$text = xml::transform($data, 'transform.xsl');
// actual transmission except on a HEAD request
if (isset($_SERVER['REQUEST_METHOD']) && $_SERVER['REQUEST_METHOD'] != 'HEAD') {
Exemplo n.º 24
0
Arquivo: switch.php Projeto: rair/yacs
 $content = '<?php' . "\n" . '// This file has been created by the configuration script control/switch.php' . "\n" . '// on ' . gmdate("F j, Y, g:i a") . ' GMT, for ' . Surfer::get_name() . '. Please do not modify it manually.' . "\n" . 'global $context;' . "\n";
 if (isset($_REQUEST['switch_target'])) {
     $content .= '$context[\'switch_target\']=\'' . addcslashes($_REQUEST['switch_target'], "\\'") . "';\n";
 }
 if (isset($_REQUEST['switch_contact'])) {
     $content .= '$context[\'switch_contact\']=\'' . addcslashes($_REQUEST['switch_contact'], "\\'") . "';\n";
 }
 $content .= '?>' . "\n";
 // save switch parameters, if any
 if (!Safe::file_put_contents('parameters/switch.include.php', $content)) {
     // not enough rights to write the file
     Logger::error(sprintf(i18n::s('Impossible to write to %s.'), 'parameters/switch.include.php.'));
     // allow for a manual update
     $context['text'] .= '<p style="text-decoration: blink;">' . sprintf(i18n::s('To actually change the configuration, please copy and paste following lines by yourself in file %s.'), 'parameters/switch.include.php') . "</p>\n";
     // display updated parameters
     $context['text'] .= Skin::build_box(i18n::s('Configuration'), Safe::highlight_string($content), 'folded');
 }
 // rename the switch file
 if (Safe::rename($context['path_to_root'] . 'parameters/switch.on', $context['path_to_root'] . 'parameters/switch.off')) {
     Logger::error(i18n::s('The server has been switched OFF. Switch it back on as soon as possible.'));
     // remember the change
     $label = i18n::c('The server has been switched off.');
     Logger::remember('control/switch.php: ' . $label);
     // if the server is currently switched off
 } elseif (file_exists($context['path_to_root'] . 'parameters/switch.off')) {
     Logger::error(i18n::s('The server is currently switched off. All users are redirected to the closed page.'));
 } else {
     Logger::error(i18n::s('Impossible to rename the file parameters/switch.on to parameters/switch.off. Do it yourself manually if you like.'));
 }
 // follow-up commands
 $menu = array();
Exemplo n.º 25
0
Arquivo: upload.php Projeto: rair/yacs
            // skip special files
            if ($file[0] == '.' || $file[0] == '~') {
                continue;
            }
            // skip non-archive files
            if (!preg_match('/(\\.bz2|\\.tar|\\.tar.gz|\\.tgz|\\.zip)/i', $file)) {
                continue;
            }
            // this is an archive to consider
            $archives[] = $file;
        }
        Safe::closedir($dir);
        // alphabetical order
        if (@count($archives)) {
            natsort($archives);
        }
    }
    // list available archives
    if (count($archives)) {
        $context['text'] .= '<ul>';
        foreach ($archives as $archive) {
            $context['text'] .= '<li>' . Skin::build_link('skins/upload.php?id=' . urlencode($archive), sprintf(i18n::s('Install skin %s'), $archive), 'basic') . '</li>';
        }
        $context['text'] .= '</ul>';
    }
    // general help on this form
    $help = '<p>' . sprintf(i18n::s('For more information on skins, visit %s'), Skin::build_link(i18n::s('http://www.yacs.fr/'), 'the YACS web site', 'external')) . '</p>';
    $context['components']['boxes'] = Skin::build_box(i18n::s('Help'), $help, 'boxes', 'help');
}
// render the skin
render_skin();
 /**
  * layout the newest articles
  *
  * caution: this function also updates page title directly, and this makes its call non-cacheable
  *
  * @param array the article
  * @return string the rendered text
  **/
 function layout_newest($item)
 {
     global $context;
     // get the related overlay, if any
     $overlay = Overlay::load($item, 'article:' . $item['id']);
     // get the anchor
     $anchor = Anchors::get($item['anchor']);
     // the url to view this item
     $url = Articles::get_permalink($item);
     // reset the rendering engine between items
     Codes::initialize($url);
     // build a title
     if (is_object($overlay)) {
         $title = Codes::beautify_title($overlay->get_text('title', $item));
     } else {
         $title = Codes::beautify_title($item['title']);
     }
     // title prefix & suffix
     $text = $prefix = $suffix = '';
     // flag articles updated recently
     if ($context['site_revisit_after'] < 1) {
         $context['site_revisit_after'] = 2;
     }
     $context['fresh'] = gmstrftime('%Y-%m-%d %H:%M:%S', mktime(0, 0, 0, date("m"), date("d") - $context['site_revisit_after'], date("Y")));
     // link to permalink
     if (Surfer::is_empowered()) {
         $title = Skin::build_box_title($title, $url, i18n::s('Permalink'));
     }
     // signal articles to be published
     if ($item['publish_date'] <= NULL_DATE) {
         $prefix .= DRAFT_FLAG;
     } else {
         if ($item['publish_date'] > NULL_DATE && $item['publish_date'] > $context['now']) {
             $prefix .= DRAFT_FLAG;
         }
     }
     // signal restricted and private articles
     if ($item['active'] == 'N') {
         $prefix .= PRIVATE_FLAG . ' ';
     } elseif ($item['active'] == 'R') {
         $prefix .= RESTRICTED_FLAG . ' ';
     }
     // signal locked articles
     if (isset($item['locked']) && $item['locked'] == 'Y' && Articles::is_owned($item, $anchor)) {
         $suffix .= LOCKED_FLAG;
     }
     // flag expired article
     if ($item['expiry_date'] > NULL_DATE && $item['expiry_date'] <= $context['now']) {
         $suffix .= EXPIRED_FLAG;
     }
     // update page title directly
     $text .= Skin::build_block($prefix . $title . $suffix, 'title');
     // if this article has a specific icon, use it
     if ($item['icon_url']) {
         $icon = $item['icon_url'];
     } elseif ($item['anchor'] && ($anchor = Anchors::get($item['anchor']))) {
         $icon = $anchor->get_icon_url();
     }
     // if we have a valid image
     if (preg_match('/(.gif|.jpg|.jpeg|.png)$/i', $icon)) {
         // fix relative path
         if (!preg_match('/^(\\/|http:|https:|ftp:)/', $icon)) {
             $icon = $context['url_to_root'] . $icon;
         }
         // flush the image on the right
         $text .= '<img src="' . $icon . '" class="right_image" alt="" />';
     }
     // article rating, if the anchor allows for it
     if (!is_object($anchor) || !$anchor->has_option('without_rating')) {
         // report on current rating
         $label = '';
         if ($item['rating_count']) {
             $label = Skin::build_rating_img((int) round($item['rating_sum'] / $item['rating_count'])) . ' ';
         }
         $label .= i18n::s('Rate this page');
         // allow for rating
         $text .= Skin::build_link(Articles::get_url($item['id'], 'like'), $label, 'basic');
     }
     // the introduction text, if any
     if (is_object($overlay)) {
         $text .= Skin::build_block($overlay->get_text('introduction', $item), 'introduction');
     } else {
         $text .= Skin::build_block($item['introduction'], 'introduction');
     }
     // insert overlay data, if any
     if (is_object($overlay)) {
         $text .= $overlay->get_text('view', $item);
     }
     // the beautified description, which is the actual page body
     if ($item['description']) {
         // use adequate label
         if (is_object($overlay) && ($label = $overlay->get_label('description'))) {
             $text .= Skin::build_block($label, 'title');
         }
         $text .= Skin::build_block($item['description'], 'description', '', $item['options']);
     }
     //
     // list related files
     //
     // if this surfer is an editor of this article, show hidden files as well
     if (Articles::is_assigned($item['id']) || is_object($anchor) && $anchor->is_assigned()) {
         Surfer::empower();
     }
     // build a complete box
     $box['bar'] = array();
     $box['text'] = '';
     // count the number of files in this article
     if ($count = Files::count_for_anchor('article:' . $item['id'])) {
         if ($count > 20) {
             $box['bar'] += array('_count' => sprintf(i18n::ns('%d file', '%d files', $count), $count));
         }
         // list files by date (default) or by title (option files_by_title)
         if (Articles::has_option('files_by', $anchor, $item) == 'title') {
             $items = Files::list_by_title_for_anchor('article:' . $item['id'], 0, FILES_PER_PAGE, 'article:' . $item['id']);
         } else {
             $items = Files::list_by_date_for_anchor('article:' . $item['id'], 0, FILES_PER_PAGE, 'article:' . $item['id']);
         }
         if (is_array($items)) {
             $box['text'] .= Skin::build_list($items, 'decorated');
         }
         // navigation commands for files
         $prefix = Articles::get_url($item['id'], 'navigate', 'files');
         $box['bar'] += Skin::navigate($url, $prefix, $count, FILES_PER_PAGE, 0);
         // the command to post a new file, if allowed
         if (Files::allow_creation($item, $anchor, 'article')) {
             $link = 'files/edit.php?anchor=' . urlencode('article:' . $item['id']);
             $box['bar'] += array($link => i18n::s('Add a file'));
         }
         if (is_array($box['bar'])) {
             $box['text'] .= Skin::build_list($box['bar'], 'menu_bar');
         }
     }
     // actually render the html for this box
     if ($box['text']) {
         $text .= Skin::build_box(i18n::s('Files'), $box['text'], 'header1', 'files');
     }
     //
     // bottom page menu
     //
     // discuss this page, if the index page can be commented, and comments are accepted at the article level
     if (Comments::allow_creation($item, $anchor)) {
         $this->menu[] = Skin::build_link(Comments::get_url('article:' . $item['id'], 'comment'), i18n::s('Post a comment'), 'span');
     }
     // info on related comments
     if ($count = Comments::count_for_anchor('article:' . $item['id'])) {
         $this->menu[] = Skin::build_link(Comments::get_url('article:' . $item['id'], 'list'), sprintf(i18n::ns('%d comment', '%d comments', $count), $count), 'span');
     }
     // new links are accepted at the index page and at the article level
     if (Links::allow_trackback()) {
         $this->menu[] = Skin::build_link('links/trackback.php?anchor=' . urlencode('article:' . $item['id']), i18n::s('Reference this page'), 'span');
     }
     // info on related links
     if ($count = Links::count_for_anchor('article:' . $item['id'])) {
         $this->menu[] = Skin::build_link($url . '#_attachments', sprintf(i18n::ns('%d link', '%d links', $count), $count), 'span');
     }
     // new files are accepted at the index page and at the article level
     if (is_object($anchor) && $anchor->has_option('with_files') && !($anchor->has_option('no_files') || preg_match('/\\bno_files\\b/i', $item['options']))) {
         // add a file
         if (Files::allow_creation($item, $anchor, 'article')) {
             if ($context['with_friendly_urls'] == 'Y') {
                 $link = 'files/edit.php/article/' . $item['id'];
             } else {
                 $link = 'files/edit.php?anchor=' . urlencode('article:' . $item['id']);
             }
             $this->menu[] = Skin::build_link($link, i18n::s('Add a file'), 'span');
         }
     }
     // modify this page
     if (Surfer::is_empowered()) {
         $this->menu[] = Skin::build_link(Articles::get_url($item['id'], 'edit'), i18n::s('Edit'), 'span');
     }
     // view permalink
     if (Surfer::is_empowered()) {
         $this->menu[] = Skin::build_link($url, i18n::s('Permalink'), 'span');
     }
     // insert overlay data, if any
     if (is_object($overlay)) {
         $text .= $overlay->get_text('trailer', $item);
     }
     // add trailer information from this item, if any
     if (isset($item['trailer']) && trim($item['trailer'])) {
         $text .= Codes::beautify($item['trailer']);
     }
     // returned the formatted content
     return $text;
 }
Exemplo n.º 27
0
Arquivo: index.php Projeto: rair/yacs
        // query the database and layout that stuff
        if (!($text = Comments::list_threads_by_date($offset, THREADS_PER_PAGE, $layout))) {
            $context['text'] .= '<p>' . i18n::s('No comment has been transmitted.') . '</p>';
        }
        // we have an array to format
        if (is_array($text)) {
            $text =& Skin::build_list($text, 'rows');
        }
        // cache, whatever changes, for 1 minute
        Cache::put($cache_id, $text, 'stable', 60);
    }
    $context['text'] .= $text;
}
// page tools
if (Surfer::is_associate()) {
    $context['page_tools'][] = Skin::build_link('comments/check.php', i18n::s('Maintenance'), 'basic');
}
// page extra information
$cache_id = 'comments/index.php#extra';
if (!($text = Cache::get($cache_id))) {
    // side bar with the list of most recent pages
    if ($items =& Articles::list_by('publication', 0, COMPACT_LIST_SIZE, 'compact')) {
        $text =& Skin::build_box(i18n::s('Recent pages'), Skin::build_list($items, 'compact'), 'boxes');
    }
    Cache::put($cache_id, $text, 'articles');
}
$context['components']['boxes'] = $text;
// referrals, if any
$context['components']['referrals'] = Skin::build_referrals('comments/index.php');
// render the skin
render_skin();
Exemplo n.º 28
0
Arquivo: select.php Projeto: rair/yacs
                // gather information on this user
                $prefix = $suffix = $type = $icon = '';
                if (isset($user['full_name']) && $user['full_name']) {
                    $label = $user['full_name'] . ' (' . $user['nick_name'] . ')';
                } else {
                    $label = $user['nick_name'];
                }
                // surfer cannot be deselected
                if ($parent->is_owned($id, FALSE)) {
                    $suffix .= ' - <span class="details">' . i18n::s('owner') . '</span>';
                }
                // format the item
                $items[$url] = array($prefix, $label, $suffix, $type, $icon);
            }
            // display attached users with unlink buttons
            $inherited .= Skin::build_box(sprintf(i18n::s('Persons assigned to %s'), $parent->get_title()), Skin::build_list($items, 'compact'), 'folded');
        }
    }
    if ($inherited) {
        $context['text'] .= '<div style="margin-top: 2em;">' . i18n::s('Following editors inherit from assignments at parent containers') . '</div>' . $inherited;
    }
    // back to the anchor page
    $links = array();
    $url = $anchor->get_url();
    if (!strncmp($anchor->get_reference(), 'user:'******'#_followers';
    }
    $links[] = Skin::build_link($url, i18n::s('Done'), 'button');
    $context['text'] .= Skin::finalize_list($links, 'assistant_bar');
}
// render the skin
Exemplo n.º 29
0
 /**
  * list articles as newspaper do
  *
  * @param resource the SQL result
  * @return string the rendered text
  *
  * @see layouts/layout.php
  **/
 function layout($result)
 {
     global $context;
     $text = '';
     // empty list
     if (!SQL::count($result)) {
         return $text;
     }
     // build a list of articles
     $others = array();
     $item_count = 0;
     include_once $context['path_to_root'] . 'comments/comments.php';
     while ($item = SQL::fetch($result)) {
         // permalink
         $url = Articles::get_permalink($item);
         // next item
         $item_count += 1;
         // section opening
         if ($item_count == 1) {
             $text .= '<div class="newest">' . "\n";
         } elseif ($item_count == 2) {
             $text .= '<div class="recent">' . "\n";
         }
         // layout first article
         if ($item_count == 1) {
             $text .= $this->layout_first($item);
             // layout newest articles
         } elseif ($item_count <= 4) {
             // the style to apply
             switch ($item_count) {
                 case 2:
                     $text .= '<div class="west">';
                     break;
                 case 3:
                     $text .= '<div class="center">';
                     break;
                 case 4:
                     $text .= '<div class="east">';
                     break;
             }
             $text .= $this->layout_newest($item) . '</div>';
             // layout recent articles
         } else {
             $others[$url] = $this->layout_recent($item);
         }
         // close newest
         if ($item_count == 1) {
             $text .= '<br style="clear: left;" /></div>' . "\n";
         } elseif ($item_count == 4) {
             $text .= '<br style="clear: left;" /></div>' . "\n";
         }
     }
     // not enough items in the database to fill the south; close it here
     if ($item_count == 2 || $item_count == 3) {
         $text .= '</div>' . "\n";
     }
     // build the list of other articles
     if (count($others)) {
         // make box
         $text .= Skin::build_box(i18n::s('Previous pages'), Skin::build_list($others, 'decorated'));
     }
     // end of processing
     SQL::free($result);
     return $text;
 }
Exemplo n.º 30
0
    // create sample server profiles
    $context['text'] .= '<p><input type="radio" name="action" value="servers" /> ' . i18n::s('Add sample server profiles -- ping well-known news aggregator and become famous') . '</p>' . "\n";
    // create basic records
    $context['text'] .= '<p><input type="radio" name="action" value="build" /> ' . i18n::s('Add basic items -- in case you would need to replay some steps of the setup process') . '</p>' . "\n";
    // create a test environment
    if (file_exists($context['path_to_root'] . 'tools/populate.php')) {
        $context['text'] .= '<p><input type="radio" name="action" value="test" /> ' . i18n::s('Add sample items -- for test purpose') . '</p>' . "\n";
    }
    // the submit button
    $context['text'] .= '<p class="assistant_bar">' . Skin::build_submit_button(i18n::s('Next step'), i18n::s('Press [s] to submit data'), 's') . '</p>' . "\n";
    // end of the form
    $context['text'] .= '</form>' . "\n";
    // the help panel
    $help = '<p>' . i18n::s('Turn any regular section to a photo album by adding images to posted pages.') . '</p>' . '<p>' . i18n::s('YACS creates weekly and monthly archives automatically. No specific action is required to create these.') . '</p>';
    $context['components']['boxes'] = Skin::build_box(i18n::s('Help'), $help, 'boxes', 'help');
    // contribution shortcuts
    if (Surfer::is_member()) {
        $label = '<p>' . i18n::s('Of course, you may also use regular editors to create simple items:') . "</p>\n";
        $label .= '<ul>' . "\n";
        if (Surfer::is_associate()) {
            $label .= '<li>' . Skin::build_link('sections/edit.php', i18n::s('Add a section'), 'shortcut') . '</li>' . "\n" . '<li>' . Skin::build_link('categories/edit.php', i18n::s('Add a category'), 'shortcut') . '</li>' . "\n";
        }
        $label .= '<li> ' . Skin::build_link('articles/edit.php', i18n::s('Add a page'), 'shorcut') . '</li>' . "\n";
        $label .= '</ul>' . "\n";
        $context['components']['boxes'] .= Skin::build_box(i18n::s('Shortcuts'), $label, 'boxes');
    }
}
// flush the cache
Cache::clear();
// render the skin
render_skin();