예제 #1
0
$input = '<input type="text" name="target" id="target" size="30" maxlength="128" value="' . encode_field($target) . '" />' . "\n" . ' ' . Skin::build_submit_button(i18n::s('Go'));
$hint = i18n::s('The name or the IP address of the yacs server');
$fields[] = array($label, $input, $hint);
$label = i18n::s('Message');
$input = '<input type="text" name="message" size="30" maxlength="128" value="' . encode_field($message) . '" />';
$fields[] = array($label, $input);
$context['text'] .= Skin::build_form($fields);
$context['text'] .= '</div></form>';
// set the focus at the first field
Page::insert_script('$("#target").focus();');
// process provided parameters
if (isset($_SERVER['REQUEST_METHOD']) && $_SERVER['REQUEST_METHOD'] == 'POST') {
    // call json back-end
    $url = 'http://' . $_REQUEST['target'] . '/services/json_rpc.php';
    // echo
    $context['text'] .= Skin::build_block('echo', 'title');
    $parameters = array('message' => $message);
    include_once 'call.php';
    $status = $data = NULL;
    if ($result = Call::invoke($url, 'echo', $parameters, 'JSON-RPC')) {
        $status = $result[0];
        $data = $result[1];
    }
    // bad call processing
    if (!$status) {
        $context['text'] .= 'status: ' . $data;
    } elseif (!empty($data['error'])) {
        if (is_array($data['error'])) {
            $context['text'] .= '<p>error:</p><ul class="compact">';
            foreach ($data['error'] as $name => $value) {
                if ($value) {
예제 #2
0
파일: check.php 프로젝트: rair/yacs
load_skin('comments');
// the path to this page
$context['path_bar'] = array('comments/' => i18n::s('Comments'));
// 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('comments/' => i18n::s('Threads'));
    $context['text'] .= Skin::build_list($menu, 'menu_bar');
    // look for orphans
} elseif (isset($_REQUEST['action']) && $_REQUEST['action'] == 'orphans') {
    // scan comments
    $context['text'] .= Skin::build_block(sprintf(i18n::s('Analyzing table %s...'), SQL::table_name('comments')), 'title');
    // scan up to 20000 items
    $count = 0;
    $query = "SELECT id, anchor FROM " . SQL::table_name('comments') . " ORDER BY anchor LIMIT 0, 100000";
    if (!($result = SQL::query($query))) {
        return;
    } else {
        // fetch one anchor and the linked member
        $errors_count = 0;
        while ($row = SQL::fetch($result)) {
            // animate user screen and take care of time
            $count++;
            if (!($count % 500)) {
                $context['text'] .= sprintf(i18n::s('%d records have been processed'), $count) . BR . "\n";
                // ensure enough execution time
                Safe::set_time_limit(30);
예제 #3
0
파일: delete.php 프로젝트: rair/yacs
 // commands
 $menu = array();
 $menu[] = Skin::build_submit_button(i18n::s('Yes, I want to delete this table'), NULL, NULL, 'confirmed');
 if (is_object($anchor)) {
     $menu[] = Skin::build_link($anchor->get_url(), i18n::s('Cancel'), 'span');
 }
 // the submit button
 $context['text'] .= '<form method="post" action="' . $context['script_url'] . '" id="main_form"><p>' . "\n" . Skin::finalize_list($menu, 'menu_bar') . '<input type="hidden" name="id" value="' . $item['id'] . '" />' . "\n" . '<input type="hidden" name="confirm" value="yes" />' . "\n" . '</p></form>' . "\n";
 // set the focus
 Page::insert_script('$("#confirmed").focus();');
 // the title of the table
 if (isset($item['title'])) {
     $context['text'] .= Skin::build_block($item['title'], 'title');
 }
 // display the full text
 $context['text'] .= Skin::build_block($item['description'], 'description');
 // execute the query string to build the table
 if (isset($item['query']) && $item['query']) {
     $context['text'] .= Tables::build($item['id'], 'sortable');
 }
 // display the query string, if any
 if (isset($item['query']) && $item['query']) {
     $context['text'] .= BR . '<pre>' . $item['query'] . '</pre>' . BR . "\n";
 }
 // details
 $details = array();
 // information on uploader
 if (Surfer::is_member() && $item['edit_name']) {
     $details[] = sprintf(i18n::s('edited by %s %s'), Users::get_link($item['edit_name'], $item['edit_address'], $item['edit_id']), Skin::build_date($item['edit_date']));
 }
 // all details
예제 #4
0
파일: delete.php 프로젝트: rair/yacs
    Safe::header('Status: 401 Unauthorized', TRUE, 401);
    Logger::error(i18n::s('The action has not been confirmed.'));
    // ask for confirmation
} else {
    // commands
    $menu = array();
    $menu[] = Skin::build_submit_button(i18n::s('Yes, I want to delete this location'), NULL, NULL, 'confirmed');
    if (is_object($anchor)) {
        $menu[] = Skin::build_link($anchor->get_url(), i18n::s('Cancel'), 'span');
    }
    // the submit button
    $context['text'] .= '<form method="post" action="' . $context['script_url'] . '" id="main_form"><p>' . "\n" . Skin::finalize_list($menu, 'menu_bar') . '<input type="hidden" name="id" value="' . $item['id'] . '" />' . "\n" . '<input type="hidden" name="confirm" value="yes" />' . "\n" . '</p></form>' . "\n";
    // set the focus
    Page::insert_script('$("#confirmed").focus();');
    // the geo_place_name of the location
    $context['text'] .= Skin::build_block($item['geo_place_name'], 'title');
    // display the full text
    $context['text'] .= '<div style="margin: 1em 0;">' . Codes::beautify($item['description']) . '</div>' . "\n";
    // more details
    $details = array();
    // information on uploader
    if (Surfer::is_member() && $item['edit_name']) {
        $details[] = sprintf(i18n::s('edited by %s %s'), Users::get_link($item['edit_name'], $item['edit_address'], $item['edit_id']), Skin::build_date($item['edit_date']));
    }
    // the complete details
    if ($details) {
        $context['text'] .= '<p class="details">' . ucfirst(implode(', ', $details)) . "</p>\n";
    }
}
// render the skin
render_skin();
예제 #5
0
파일: stage.php 프로젝트: rair/yacs
            }
            // 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('scripts/stage.php?id=' . urlencode($archive), sprintf(i18n::s('Install release %s'), $archive), 'basic') . '</li>';
        }
        $context['text'] .= '</ul>';
        // this may take several minutes
        $context['text'] .= '<p>' . i18n::s('Click to explode the selected archive. You may have to wait for some time before getting a response displayed.') . '</p>';
    }
    // option #3 - out-of-band staging
    $context['text'] .= Skin::build_block(i18n::s('Direct staging'), 'title');
    // upload an archive
    $context['text'] .= '<p>' . sprintf(i18n::s('Ultimately, you can populate the directory %s by yourself. On completion you can start the %s.'), '<code>scripts/staging</code>', Skin::build_link('scripts/update.php', i18n::s('update process'))) . '</p>';
}
// render the skin
render_skin();
예제 #6
0
파일: delete.php 프로젝트: rair/yacs
} else {
    // commands
    $menu = array();
    $menu[] = Skin::build_submit_button(i18n::s('Yes, I want to delete this link'), NULL, NULL, 'confirmed');
    if (is_object($anchor)) {
        $menu[] = Skin::build_link($anchor->get_url(), i18n::s('Cancel'), 'span');
    }
    // the submit button
    $context['text'] .= '<form method="post" action="' . $context['script_url'] . '" id="main_form"><p>' . "\n" . Skin::finalize_list($menu, 'menu_bar') . '<input type="hidden" name="id" value="' . $item['id'] . '" />' . "\n" . '<input type="hidden" name="confirm" value="yes" />' . "\n" . '</p></form>' . "\n";
    // set the focus
    Page::insert_script('$("#confirmed").focus();');
    // the title of the link
    if ($item['title']) {
        $context['text'] .= Skin::build_block($item['title'], 'title');
    } else {
        $context['text'] .= Skin::build_block($item['link_url'], 'title');
    }
    // the link url, if it has not already been used as title
    if ($item['title']) {
        $context['text'] .= '<p>' . $item['link_url'] . "</p>\n";
    }
    // display the full text
    $context['text'] .= '<div style="margin: 1em 0;">' . Codes::beautify($item['description']) . '</div>' . "\n";
    // details
    $details = array();
    // information on uploader
    if (Surfer::is_member() && $item['edit_name']) {
        $details[] = sprintf(i18n::s('edited by %s %s'), Users::get_link($item['edit_name'], $item['edit_address'], $item['edit_id']), Skin::build_date($item['edit_date']));
    }
    // hits
    if ($item['hits'] > 1) {
예제 #7
0
파일: index.php 프로젝트: rair/yacs
$context['text'] .= Skin::build_block(i18n::s('Ping interface'), 'title', 'ping');
$context['text'] .= '<p>' . i18n::s('To spread updates') . '</p>';
$rows = array();
$rows[] = array(i18n::s('URL:'), '<b>' . $context['url_to_home'] . $context['url_to_root'] . 'services/ping.php</b>');
$rows[] = array(i18n::s('Documentation:'), Skin::build_link('services/ping.php', NULL, 'script'));
$rows[] = array(i18n::s('Specifications:'), Skin::build_link('http://www.hixie.ch/specs/pingback/pingback', 'Pingback specification', 'external') . ', ' . Skin::build_link('http://www.xmlrpc.com/spec', 'XML-RPC Specification', 'external'));
$context['text'] .= Skin::table(NULL, $rows);
// search.php
$context['text'] .= Skin::build_block(i18n::s('Search'), 'title', 'search');
$context['text'] .= '<p>' . i18n::s('Build a customised RSS feed based on any keyword') . '</p>';
$rows = array();
$rows[] = array(i18n::s('URL:'), '<b>' . $context['url_to_home'] . $context['url_to_root'] . 'services/search.php</b>');
$rows[] = array(i18n::s('Documentation:'), Skin::build_link('services/search.php', NULL, 'script'));
$rows[] = array(i18n::s('Specifications:'), Skin::build_link('http://blogs.law.harvard.edu/tech/rss', 'RSS 2.0 Specification', 'external'));
$context['text'] .= Skin::table(NULL, $rows);
// xml_rpc.php
$context['text'] .= Skin::build_block(i18n::s('Generic XML-RPC interface'), 'title', 'xml-rpc');
$context['text'] .= '<p>' . i18n::s('Bound to hooked back-end scripts') . '</p>';
$rows = array();
$rows[] = array(i18n::s('URL:'), '<b>' . $context['url_to_home'] . $context['url_to_root'] . 'services/xml_rpc.php</b>');
$rows[] = array(i18n::s('Documentation:'), Skin::build_link('services/xml_rpc.php', NULL, 'script'));
$rows[] = array(i18n::s('Specification:'), Skin::build_link('http://www.xmlrpc.com/spec', 'XML-RPC Specification', 'external'));
$context['text'] .= Skin::table(NULL, $rows);
// page tools
if (Surfer::is_associate()) {
    $context['page_tools'][] = Skin::build_link('services/configure.php', i18n::s('Configure'), 'basic');
}
// referrals, if any
$context['components']['referrals'] = Skin::build_referrals('services/index.php');
// render the skin
render_skin();
예제 #8
0
 /**
  * list articles as topics in a forum
  *
  * @param resource the SQL result
  * @return string the rendered text
  **/
 function layout($result)
 {
     global $context;
     // we return some text
     $text = '';
     // empty list
     if (!SQL::count($result)) {
         return $text;
     }
     // start a table
     $text .= Skin::table_prefix('jive');
     // headers
     $text .= Skin::table_row(array(i18n::s('Topic'), i18n::s('Content')), 'header');
     // build a list of articles
     $odd = FALSE;
     include_once $context['path_to_root'] . 'comments/comments.php';
     include_once $context['path_to_root'] . 'links/links.php';
     while ($item = SQL::fetch($result)) {
         // 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);
         // 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']);
         }
         // one row per article
         $text .= '<tr class="' . ($odd ? 'odd' : 'even') . '"><td>';
         $odd = !$odd;
         // signal articles to be published
         if (!isset($item['publish_date']) || $item['publish_date'] <= NULL_DATE || $item['publish_date'] > gmstrftime('%Y-%m-%d %H:%M:%S')) {
             $text .= DRAFT_FLAG;
         }
         // signal restricted and private articles
         if ($item['active'] == 'N') {
             $text .= PRIVATE_FLAG;
         } elseif ($item['active'] == 'R') {
             $text .= RESTRICTED_FLAG;
         }
         // use the title as a link to the page
         $text .= Skin::build_link($url, '<strong>' . $title . '</strong>', 'basic');
         // signal locked articles
         if (isset($item['locked']) && $item['locked'] == 'Y' && Articles::is_owned($item, $anchor)) {
             $text .= ' ' . LOCKED_FLAG;
         }
         // flag articles updated recently
         if ($item['expiry_date'] > NULL_DATE && $item['expiry_date'] <= $context['now']) {
             $text .= ' ' . EXPIRED_FLAG;
         } elseif ($item['create_date'] >= $context['fresh']) {
             $text .= ' ' . NEW_FLAG;
         } elseif ($item['edit_date'] >= $context['fresh']) {
             $text .= ' ' . UPDATED_FLAG;
         }
         // add details, if any
         $details = array();
         // poster name
         if (isset($context['with_author_information']) && $context['with_author_information'] == 'Y') {
             if ($item['create_name']) {
                 $details[] = sprintf(i18n::s('posted by %s %s'), Users::get_link($item['create_name'], $item['create_address'], $item['create_id']), Skin::build_date($item['create_date']));
             }
         }
         // last update
         $details[] = sprintf(i18n::s('Updated %s'), Skin::build_date($item['edit_date']));
         // add details to the title
         if (count($details)) {
             $text .= '<p class="details" style="margin: 3px 0">' . join(', ', $details) . '</p>';
         }
         // display all tags
         if ($item['tags']) {
             $text .= '<p class="tags">' . Skin::build_tags($item['tags'], 'article:' . $item['id']) . '</p>';
         }
         // next cell for the content
         $text .= '</td><td width="70%">';
         // the content to be displayed
         $content = '';
         // rating
         if ($item['rating_count'] && !(is_object($anchor) && $anchor->has_option('without_rating'))) {
             $content .= Skin::build_link(Articles::get_url($item['id'], 'like'), Skin::build_rating_img((int) round($item['rating_sum'] / $item['rating_count'])), 'basic');
         }
         // the introductory text
         if (is_object($overlay)) {
             $content .= Codes::beautify_introduction($overlay->get_text('introduction', $item));
         } else {
             $content .= Codes::beautify_introduction($item['introduction']);
         }
         // insert overlay data, if any
         if (is_object($overlay)) {
             $content .= $overlay->get_text('list', $item);
         }
         // the description
         $content .= Skin::build_block($item['description'], 'description', '', $item['options']);
         // attachment details
         $details = array();
         // info on related files
         if ($count = Files::count_for_anchor('article:' . $item['id'])) {
             Skin::define_img('FILES_LIST_IMG', 'files/list.gif');
             $details[] = Skin::build_link($url . '#_attachments', FILES_LIST_IMG . sprintf(i18n::ns('%d file', '%d files', $count), $count), 'span');
         }
         // info on related links
         if ($count = Links::count_for_anchor('article:' . $item['id'], TRUE)) {
             Skin::define_img('LINKS_LIST_IMG', 'links/list.gif');
             $details[] = LINKS_LIST_IMG . sprintf(i18n::ns('%d link', '%d links', $count), $count);
         }
         // count replies
         if ($count = Comments::count_for_anchor('article:' . $item['id'])) {
             $details[] = Skin::build_link($url . '#_discussion', sprintf(i18n::ns('%d comment', '%d comments', $count), $count), 'span');
         }
         // the command to reply
         if (Comments::allow_creation($item, $anchor)) {
             Skin::define_img('COMMENTS_ADD_IMG', 'comments/add.gif');
             $details[] = Skin::build_link(Comments::get_url('article:' . $item['id'], 'comment'), COMMENTS_ADD_IMG . i18n::s('Post a comment'), 'span');
         }
         // describe attachments
         $content .= Skin::finalize_list($details, 'menu_bar');
         // end the row
         $text .= $content . '</td></tr>';
     }
     // end of processing
     SQL::free($result);
     // return the table
     $text .= Skin::table_suffix();
     return $text;
 }
예제 #9
0
파일: review.php 프로젝트: rair/yacs
        } else {
            $context['text'] .= $rows;
        }
    }
    // biggest files
    if (Surfer::is_associate() && ($rows = Files::list_by_size(0, 25, 'full'))) {
        $context['text'] .= Skin::build_block(i18n::s('Biggest files'), 'title');
        if (is_array($rows)) {
            $context['text'] .= Skin::build_list($rows, 'decorated');
        } else {
            $context['text'] .= $rows;
        }
    }
    // list files with very few hits
    if (Surfer::is_associate() && ($rows = Files::list_unused(0, 25))) {
        $context['text'] .= Skin::build_block(i18n::s('Less downloaded files'), 'title');
        if (is_array($rows)) {
            $context['text'] .= Skin::build_list($rows, 'decorated');
        } else {
            $context['text'] .= $rows;
        }
    }
    // size of noise words
    if (Surfer::is_associate() && is_readable($context['path_to_root'] . 'files/noise_words.php')) {
        include_once $context['path_to_root'] . 'files/noise_words.php';
        if (@count($noise_words)) {
            $context['text'] .= '<p>' . sprintf(i18n::s('%d items in the list of noise words'), count($noise_words)) . '</p>';
        }
    }
}
// render the skin
예제 #10
0
파일: view.php 프로젝트: rair/yacs
     $digg = '';
     if (isset($_COOKIE['rating_' . $item['id']])) {
         Cache::poison();
     } else {
         $digg = '<div class="rate">' . Skin::build_link(Articles::get_url($item['id'], 'like'), i18n::s('Rate it'), 'basic') . '</div>';
     }
     // rendering
     $context['rating'] = '<div class="digg"><div class="votes">' . $rating_label . '</div>' . $digg . '</div>';
     // signal DIGG
     define('DIGG', TRUE);
 }
 // the introduction text, if any
 if (is_object($overlay)) {
     $canvas['introduction'] = Skin::build_block($overlay->get_text('introduction', $item), 'introduction');
 } else {
     $canvas['introduction'] = Skin::build_block($item['introduction'], 'introduction');
 }
 // get text related to the overlay, if any
 if (is_object($overlay)) {
     $canvas['overlay_text'] = $overlay->get_text('view', $item);
 }
 // the main part of the page
 $canvas['description'] = $context['page_description'];
 //
 // comments attached to this article
 //
 $discussion = '';
 // the list of related comments, if not at another follow-up page
 if (!$render_overlaid && !$zoom_type || $zoom_type == 'comments') {
     // title label
     $title_label = '';
예제 #11
0
파일: sections.php 프로젝트: rair/yacs
 /**
  * build a notification related to a section
  *
  * This function builds a mail message that displays:
  * - an image of the contributor (if possible)
  * - a headline mentioning the contribution
  * - the full content of the section
  * - a button linked to the section
  * - a link to the containing section, if any
  *
  * Note: this function returns legacy HTML, not modern XHTML, because this is what most
  * e-mail client software can afford.
  *
  * @param string either 'apply', 'create' or 'update'
  * @param array attributes of the item
  * @param object overlay of the item, if any
  * @return string text to be send by e-mail
  */
 public static function build_notification($action, $item, $overlay = NULL)
 {
     global $context;
     // get the main anchor
     $anchor = Anchors::get($item['anchor']);
     // compute page title
     if (is_object($overlay)) {
         $title = Codes::beautify_title($overlay->get_text('title', $item));
     } else {
         $title = Codes::beautify_title($item['title']);
     }
     // headline template
     switch ($action) {
         case 'apply':
             $template = i18n::c('%s is requesting access to %s');
             break;
         case 'create':
             $template = i18n::c('%s has created section %s');
             break;
         case 'update':
             $template = i18n::c('%s has updated section %s');
             break;
     }
     // headline
     $headline = sprintf($template, Surfer::get_link(), '<a href="' . Sections::get_permalink($item) . '">' . $title . '</a>');
     // panel content
     $content = '';
     // signal restricted and private articles
     if ($item['active'] == 'N') {
         $title = PRIVATE_FLAG . $title;
     } elseif ($item['active'] == 'R') {
         $title = RESTRICTED_FLAG . $title;
     }
     // insert page title
     $content .= '<h3><span>' . $title . '</span></h3>';
     // insert anchor prefix
     if (is_object($anchor)) {
         $content .= $anchor->get_prefix();
     }
     // the introduction text, if any
     if (is_object($overlay)) {
         $content .= Skin::build_block($overlay->get_text('introduction', $item), 'introduction');
     } elseif (isset($item['introduction']) && trim($item['introduction'])) {
         $content .= Skin::build_block($item['introduction'], 'introduction');
     }
     // get text related to the overlay, if any
     if (is_object($overlay)) {
         $content .= $overlay->get_text('view', $item);
     }
     // filter description, if necessary
     if (is_object($overlay)) {
         $description = $overlay->get_text('description', $item);
     } else {
         $description = $item['description'];
     }
     // the beautified description, which is the actual page body
     if ($description) {
         // use adequate label
         if (is_object($overlay) && ($label = $overlay->get_label('description'))) {
             $content .= Skin::build_block($label, 'title');
         }
         // beautify the target page
         $content .= Skin::build_block($description, 'description', '', $item['options']);
     }
     // attachment details
     $details = array();
     // info on related sections
     if ($count = Sections::count_for_anchor('section:' . $item['id'])) {
         $details[] = sprintf(i18n::nc('%d section', '%d sections', $count), $count);
     }
     // info on related articles
     if ($count = Articles::count_for_anchor('section:' . $item['id'])) {
         $details[] = sprintf(i18n::nc('%d page', '%d pages', $count), $count);
     }
     // info on related files
     if ($count = Files::count_for_anchor('section:' . $item['id'], TRUE)) {
         // the actual list of files attached to this section
         if (preg_match('/\\bfiles_by_title\\b/i', $item['options'])) {
             $items = Files::list_by_title_for_anchor('section:' . $item['id'], 0, 300, 'compact');
         } else {
             $items = Files::list_by_date_for_anchor('section:' . $item['id'], 0, 300, 'compact');
         }
         // wrap it with some header
         if (is_array($items)) {
             $items = Skin::build_list($items);
         }
         if ($items) {
             $content .= '<h3><span>' . i18n::s('Files') . '</span></h3>' . $items;
         }
         // details to be displayed at page bottom
         $details[] = sprintf(i18n::nc('%d file', '%d files', $count), $count);
     }
     // info on related links
     include_once $context['path_to_root'] . 'links/links.php';
     if ($count = Links::count_for_anchor('section:' . $item['id'], TRUE)) {
         $details[] = sprintf(i18n::nc('%d link', '%d links', $count), $count);
     }
     // comments
     include_once $context['path_to_root'] . 'comments/comments.php';
     if ($count = Comments::count_for_anchor('section:' . $item['id'], TRUE)) {
         $details[] = sprintf(i18n::nc('%d comment', '%d comments', $count), $count);
     }
     // describe attachments
     if (count($details)) {
         $content .= '<hr align="left" size=1" width="150">' . '<p style="margin: 3px 0;">' . sprintf(i18n::c('This section has %s'), join(', ', $details)) . '</p>';
     }
     // assemble main content of this message
     $text = Skin::build_mail_content($headline, $content);
     // a set of links
     $menu = array();
     // request access to the item
     if ($action == 'apply') {
         // call for action
         $link = $context['url_to_home'] . $context['url_to_root'] . Sections::get_url($item['id'], 'invite', Surfer::get_id());
         $label = sprintf(i18n::c('Invite %s to participate'), Surfer::get_name());
         $menu[] = Skin::build_mail_button($link, $label, TRUE);
         // link to user profile
         $link = Surfer::get_permalink();
         $label = sprintf(i18n::c('View the profile of %s'), Surfer::get_name());
         $menu[] = Skin::build_mail_button($link, $label, FALSE);
         // invite to visit the item
     } else {
         // call for action
         $link = Sections::get_permalink($item);
         if (!is_object($overlay) || !($label = $overlay->get_label('permalink_command', 'sections', FALSE))) {
             $label = i18n::c('View the section');
         }
         $menu[] = Skin::build_mail_button($link, $label, TRUE);
         // link to the container
         if (is_object($anchor)) {
             $link = $context['url_to_home'] . $context['url_to_root'] . $anchor->get_url();
             $menu[] = Skin::build_mail_button($link, $anchor->get_title(), FALSE);
         }
     }
     // finalize links
     $text .= Skin::build_mail_menu($menu);
     // the full message
     return $text;
 }
예제 #12
0
파일: edit.php 프로젝트: rair/yacs
 if (is_object($overlay)) {
     $fields = array_merge($fields, $overlay->get_fields($item));
 }
 // history of changes
 if (!is_object($overlay) || ($label = $overlay->get_label('description')) === null) {
     $label = i18n::s('History');
 }
 if (!is_object($overlay) || ($hint = $overlay->get_label('description_hint')) === null) {
     $hint = i18n::s('What is new in this file?');
 }
 if ($hint) {
     $hint .= BR;
 }
 $input = '<span class="details">' . $hint . '</span>' . Surfer::get_editor('version', '', TRUE, 5, FALSE);
 if (isset($item['description'])) {
     $input .= Skin::build_box(i18n::s('More information'), Skin::build_block($item['description'], 'description'), 'folded');
 }
 $fields[] = array($label, $input);
 // 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'])) {
예제 #13
0
파일: index.php 프로젝트: rair/yacs
 */
// include the global declarations
include_once '../shared/global.php';
include_once 'scripts.php';
// address of the reference server, if any
Safe::load('parameters/scripts.include.php');
// load localized strings
i18n::bind('scripts');
// load the skin
load_skin('scripts');
// the title of the page
$context['page_title'] = i18n::s('Server software');
// associates may trigger incremental upgrades, but not at reference servers
if (Surfer::is_associate() && !file_exists('reference/footprints.php')) {
    // upgrade
    $context['text'] .= Skin::build_block(i18n::s('Incremental upgrades'), 'title');
    // the status message
    Safe::load('footprints.php');
    if (isset($generation['date']) && $generation['date']) {
        $context['text'] .= '<p>' . sprintf(i18n::s('Last update took place on %s'), $generation['date']) . '</p>' . "\n";
    }
    unset($generation);
    // ensure we have a reference server
    if (!isset($context['reference_server']) || !$context['reference_server']) {
        $context['reference_server'] = i18n::s('www.yacs.fr');
    }
    // offer to upgrade
    $context['text'] .= '<p>' . Skin::build_link('scripts/stage.php', i18n::s('Update the software')) . "</p>\n";
}
// get the page from the php documentation, if any
include_once 'phpdoc.php';
예제 #14
0
 /**
  * list articles as topics in a forum
  *
  * @param resource the SQL result
  * @return string the rendered text
  **/
 function layout($result)
 {
     global $context;
     // we return some text
     $text = '';
     // empty list
     if (!SQL::count($result)) {
         return $text;
     }
     // allow for complete styling
     $text = '<div class="last_articles">';
     // build a list of articles
     include_once $context['path_to_root'] . 'comments/comments.php';
     include_once $context['path_to_root'] . 'links/links.php';
     while ($item = SQL::fetch($result)) {
         // get the related overlay
         $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);
         // build a title
         if (is_object($overlay)) {
             $title = Codes::beautify_title($overlay->get_text('title', $item));
         } else {
             $title = Codes::beautify_title($item['title']);
         }
         // reset everything
         $prefix = $label = $suffix = $icon = '';
         // signal articles to be published
         if (!isset($item['publish_date']) || $item['publish_date'] <= NULL_DATE || $item['publish_date'] > gmstrftime('%Y-%m-%d %H:%M:%S')) {
             $prefix .= DRAFT_FLAG;
         }
         // signal restricted and private articles
         if ($item['active'] == 'N') {
             $prefix .= PRIVATE_FLAG;
         } elseif ($item['active'] == 'R') {
             $prefix .= RESTRICTED_FLAG;
         }
         // flag expired articles
         if ($item['expiry_date'] > NULL_DATE && $item['expiry_date'] <= $context['now']) {
             $prefix .= EXPIRED_FLAG . ' ';
         } elseif ($item['create_date'] >= $context['fresh']) {
             $suffix .= NEW_FLAG;
         } elseif ($item['edit_date'] >= $context['fresh']) {
             $suffix .= UPDATED_FLAG;
         }
         // signal locked articles
         if (isset($item['locked']) && $item['locked'] == 'Y' && Articles::is_owned($item, $anchor)) {
             $suffix .= ' ' . LOCKED_FLAG;
         }
         // rating
         if ($item['rating_count'] && !(is_object($anchor) && $anchor->has_option('without_rating'))) {
             $suffix .= ' ' . Skin::build_link(Articles::get_url($item['id'], 'like'), Skin::build_rating_img((int) round($item['rating_sum'] / $item['rating_count'])), 'basic');
         }
         // indicate the id in the hovering popup
         $hover = i18n::s('View the page');
         if (Surfer::is_member()) {
             $hover .= ' [article=' . $item['id'] . ']';
         }
         // one box per update
         $text .= '<div class="last_article" >';
         // use the title as a link to the page
         $text .= Skin::build_block($prefix . ucfirst($title) . $suffix, 'header1');
         // some details about this page
         $details = array();
         // page starter and date
         if ($item['create_name']) {
             $details[] = sprintf(i18n::s('Started by %s'), Users::get_link($item['create_name'], $item['create_address'], $item['create_id'])) . ' ' . Skin::build_date($item['create_date']);
         }
         // page last modification
         if ($item['edit_date'] && $item['edit_action'] == 'article:update' && $item['edit_name']) {
             $details[] = Anchors::get_action_label($item['edit_action']) . ' ' . sprintf(i18n::s('by %s'), Users::get_link($item['edit_name'], $item['edit_address'], $item['edit_id'])) . ' ' . Skin::build_date($item['edit_date']);
         }
         // friends
         if ($friends =& Members::list_users_by_posts_for_anchor('article:' . $item['id'], 0, USERS_LIST_SIZE, 'comma5', $item['create_id'])) {
             $details[] = sprintf(i18n::s('with %s'), $friends);
         }
         // people details
         if ($details) {
             $text .= '<p class="details">' . join(', ', $details) . "</p>\n";
         }
         // the introductory text
         $introduction = '';
         if (is_object($overlay)) {
             $introduction = $overlay->get_text('introduction', $item);
         } elseif ($item['introduction']) {
             $introduction = $item['introduction'];
         }
         if ($introduction) {
             $text .= '<div style="margin: 1em 0;">' . Codes::beautify_introduction($introduction) . '</div>';
         }
         // insert overlay data, if any
         if (is_object($overlay)) {
             $text .= $overlay->get_text('list', $item);
         }
         // info on related comments
         if (($count = Comments::count_for_anchor('article:' . $item['id'])) > 1) {
             $text .= '<div style="margin-top: 1em;"><p class="details">' . sprintf(i18n::s('%d contributions, including:'), $count) . '</p></div>';
         }
         // avoid first file if mentioned in last contribution
         $file_offset = 0;
         // get last contribution for this page
         if ($comment = Comments::get_newest_for_anchor('article:' . $item['id'])) {
             if (preg_match('/\\[(download|file)=/', $comment['description'])) {
                 $file_offset++;
             }
             // bars around the last contribution
             $bottom_menu = array();
             // last contributor
             $contributor = Users::get_link($comment['create_name'], $comment['create_address'], $comment['create_id']);
             $flag = '';
             if ($comment['create_date'] >= $context['fresh']) {
                 $flag = NEW_FLAG;
             } elseif ($comment['edit_date'] >= $context['fresh']) {
                 $flag = UPDATED_FLAG;
             }
             $bottom_menu[] = sprintf(i18n::s('By %s'), $contributor) . ' ' . Skin::build_date($comment['create_date']) . $flag;
             // offer to reply
             if (Comments::allow_creation($item, $anchor)) {
                 $link = Comments::get_url($comment['id'], 'reply');
                 $bottom_menu[] = Skin::build_link($link, i18n::s('Reply'), 'basic');
             }
             // gather pieces
             $pieces = array();
             // last contribution, and user signature
             $pieces[] = ucfirst(trim($comment['description'])) . Users::get_signature($comment['create_id']);
             // bottom
             if ($bottom_menu) {
                 $pieces[] = '<div style="margin-top: 1em;">' . ucfirst(trim(Skin::finalize_list($bottom_menu, 'menu'))) . '</div>';
             }
             // put all pieces together
             $text .= '<div class="last_comment">' . "\n" . join("\n", $pieces) . '</div>' . "\n";
         }
         // list more recent files
         if ($items = Files::list_by_date_for_anchor('article:' . $item['id'], $file_offset, 3, 'dates')) {
             // more files than listed
             $more = '';
             if (($count = Files::count_for_anchor('article:' . $item['id'])) > 3) {
                 $more = '<span class="details">' . sprintf(i18n::s('%d files, including:'), $count) . '</span>';
             }
             if (is_array($items)) {
                 $items = Skin::build_list($items, 'compact');
             }
             $text .= '<div style="margin: 1em 0;">' . $more . $items . '</div>';
         }
         // display all tags
         if ($item['tags']) {
             $text .= ' <p class="tags">' . Skin::build_tags($item['tags'], 'article:' . $item['id']) . '</p>';
         }
         // navigation links
         $menu = array();
         // permalink
         $menu[] = Skin::build_link($url, i18n::s('View the page'), 'span');
         // info on related links
         if ($count = Links::count_for_anchor('article:' . $item['id'], TRUE)) {
             $menu[] = sprintf(i18n::ns('%d link', '%d links', $count), $count);
         }
         // the main anchor link
         if (is_object($anchor) && (!isset($this->focus) || $item['anchor'] != $this->focus)) {
             $menu[] = Skin::build_link($anchor->get_url(), sprintf(i18n::s('in %s'), ucfirst($anchor->get_title())), 'span', i18n::s('View the section'));
         }
         // actually insert details
         $text .= Skin::finalize_list($menu, 'menu_bar');
         // bottom of the box
         $text .= '</div>';
     }
     // close the list of articles
     $text .= '</div>';
     // beautify everything at once
     $text = Codes::beautify($text);
     // end of processing
     SQL::free($result);
     // done
     return $text;
 }
예제 #15
0
파일: fetch.php 프로젝트: rair/yacs
    $context['page_title'] = sprintf(i18n::s('%s: %s'), i18n::s('Reserve'), $context['page_title']);
    // assign the file to this surfer
    $user = array('nick_name' => Surfer::get_name(), 'id' => Surfer::get_id(), 'email' => Surfer::get_email_address());
    if (Files::assign($item['id'], $user)) {
        // inform surfer
        $context['text'] .= '<p>' . sprintf(i18n::s('You have reserved this file, and you are encouraged to %s as soon as possible, or to %s.'), Skin::build_link(Files::get_url($item['id'], 'edit'), i18n::s('upload an updated version'), 'basic'), Skin::build_link(Files::get_url($item['id'], 'fetch', 'release'), i18n::s('release reservation'), 'basic')) . '</p>';
        // help the surfer
    } else {
        Logger::error(i18n::s('Operation has failed.'));
    }
    // follow-up commands
    $context['text'] .= Skin::build_block(Skin::build_link($anchor->get_url('files'), i18n::s('Done'), 'button'), 'bottom');
    // file has been reserved, and surfer is not owner
} elseif ($action != 'confirm' && isset($item['assign_id']) && $item['assign_id'] && !Surfer::is($item['assign_id'])) {
    // inform surfer
    $context['text'] .= Skin::build_block(sprintf(i18n::s('This file has been assigned to %s %s, and it is likely that an updated version will be made available soon.'), Users::get_link($item['assign_name'], $item['assign_address'], $item['assign_id']), Skin::build_date($item['assign_date'])), 'caution');
    // commands
    $menu = array();
    $menu[] = Skin::build_submit_button(i18n::s('Download this file'), NULL, NULL, 'confirmed', 'no_spin_on_click');
    $menu[] = Skin::build_link($anchor->get_url('files'), i18n::s('Cancel'), 'span');
    // to get the actual file
    $target_href = $context['url_to_home'] . $context['url_to_root'] . Files::get_url($item['id'], 'fetch', $item['file_name']);
    // render commands
    $context['text'] .= '<form method="post" action="' . $context['script_url'] . '" id="main_form"><div>' . "\n" . Skin::finalize_list($menu, 'assistant_bar') . '<input type="hidden" name="id" value="' . $item['id'] . '" />' . "\n" . '<input type="hidden" name="action" value="confirm" />' . "\n" . '</div></form>' . "\n";
    // set the focus
    Page::insert_script('$("#confirmed").focus();');
    //actual transfer
} elseif ($item['id'] && $item['anchor']) {
    // increment the count of downloads
    if (!Surfer::is_crawler()) {
        Files::increment_hits($item['id']);
예제 #16
0
파일: page.php 프로젝트: rair/yacs
 /**
  * echo page title
  *
  * You can override this function into your skin
  */
 public static function echo_title()
 {
     global $context;
     // main page title has already been given
     if (defined('without_page_title')) {
         return;
     }
     // from $context
     if (isset($context['page_title']) && $context['page_title']) {
         echo Skin::build_block($context['page_title'], 'page_title');
     }
 }
예제 #17
0
파일: review.php 프로젝트: rair/yacs
    $context['text'] .= Skin::build_block(i18n::s('Most recent members'), 'title');
    if (is_array($rows)) {
        $context['text'] .= Skin::build_list($rows, 'decorated');
    } else {
        $context['text'] .= $rows;
    }
}
// oldest posts, but only to associates
if (Surfer::is_associate() && ($rows = Users::list_by_post_date())) {
    $context['text'] .= Skin::build_block(i18n::s('Oldest posts'), 'title');
    $context['text'] .= '<p>' . i18n::s('Users who have never contributed are not listed at all.') . '</p>' . "\n";
    if (is_array($rows)) {
        $context['text'] .= Skin::build_list($rows, 'decorated');
    } else {
        $context['text'] .= $rows;
    }
}
// oldest logins, but only to associates
if (Surfer::is_associate() && ($rows = Users::list_by_login_date())) {
    $context['text'] .= Skin::build_block(i18n::s('Oldest logins'), 'title');
    $context['text'] .= '<p>' . i18n::s('Users who have never been authenticated are not listed at all.') . '</p>' . "\n";
    if (is_array($rows)) {
        $context['text'] .= Skin::build_list($rows, 'decorated');
    } else {
        $context['text'] .= $rows;
    }
}
// the menu bar for this page
$context['page_tools'][] = Skin::build_link('users/', i18n::s('People'));
// render the skin
render_skin();
예제 #18
0
파일: leave.php 프로젝트: rair/yacs
    } else {
        $context['text'] .= '<p>' . sprintf(i18n::s('You have been assigned as an editor of %s, and this allows you to contribute to this page, and to be notified of changes.'), Skin::build_link($anchor->get_url(), $anchor->get_title())) . '</p>';
    }
    // cautioon on private areas
    if ($anchor->get_active() == 'N') {
        if ($type == 'section') {
            $context['text'] .= '<p>' . i18n::s('Access to this section is restricted. If you continue, it will become invisible to you, and you will not be able to even browse its content anymore.') . '</p>';
        } else {
            $context['text'] .= '<p>' . i18n::s('Access to this page is restricted. If you continue, it will become invisible to you, and you will not be able to even browse its content anymore.') . '</p>';
        }
    }
    // ask for confirmation
    if ($type == 'section') {
        $context['text'] .= '<p>' . i18n::s('You are about to suppress all your editing rights on this section.') . '</p>';
    } else {
        $context['text'] .= '<p>' . i18n::s('You are about to suppress all your editing rights on this page.') . '</p>';
    }
    $bottom = '<p>' . i18n::s('Are you sure?') . '</p>';
    // commands
    $menu = array();
    $menu[] = Skin::build_submit_button(i18n::s('Yes'), NULL, NULL, 'confirmed');
    $menu[] = Skin::build_link($anchor->get_url(), i18n::s('No'), 'span');
    // render commands
    $bottom .= '<form method="post" action="' . $context['script_url'] . '" id="main_form"><p>' . "\n" . Skin::finalize_list($menu, 'menu_bar') . '<input type="hidden" name="id" value="' . $anchor->get_reference() . '" />' . "\n" . '<input type="hidden" name="action" value="leave" />' . "\n" . '</p></form>' . "\n";
    //
    $context['text'] .= Skin::build_block($bottom, 'bottom');
    // set the focus
    Page::insert_script('$("confirmed").focus();');
}
// render the skin
render_skin();
예제 #19
0
파일: blog_test.php 프로젝트: rair/yacs
<p>jhdjh qlsdh lqhjsdq et les a&#231;&#231;&#233;nts, &#231;a passe comment ? et l\'&#8364; aussi ?<br/>
</p>

<p>sdsd qd qsd qds</p>

<p>al non ? Vivement les plug-ins, qu\'on <FONT size="6" face="Verdana" color="#808000">puisse</FONT> ajouter d\'autres effets.

</p>

<p>qsd qsd qds qjhgkjg k j<br/>
</p>

<a title="" href="http://127.0.0.1/yacs/articles/view.php/4920"><img src="http://127.0.0.1/yacs/files/section/2739/Nnuphars_thumb.jpg" alt="" /></a><!-- technorati tags begin --><p style="font-size:10px;text-align:right;">technorati tags:<a href="http://technorati.com/tag/un" rel="tag">un</a>, <a href="http://technorati.com/tag/tag" rel="tag">tag</a>, <a href="http://technorati.com/tag/xml" rel="tag">xml</a>, <a href="http://technorati.com/tag/rpc" rel="tag">rpc</a></p><!-- technorati tags end -->';
    // metaWeblog.newPost -- the Flock way
    $context['text'] .= Skin::build_block('metaWeblog.newPost', 'title');
    $parameters = array($blogid, $user_name, $user_password, array('title' => $codec->encode('a post from Flock', 'string'), 'description' => $codec->encode($sample_message, 'string'), 'mt_convert_breaks' => '', 'mt_tb_ping_urls' => array('http://www.technorati.com')), TRUE);
    $result = Call::invoke($url, 'metaWeblog.newPost', $parameters, 'XML-RPC');
    $status = @$result[0];
    $data = @$result[1];
    // display call result
    if (!$status) {
        $context['text'] .= 'status: ' . $data;
    } elseif (is_array($data) && isset($data['faultString']) && $data['faultString']) {
        $context['text'] .= $data['faultString'];
    } elseif (is_array($data)) {
        $context['text'] .= '?? ';
        foreach ($data as $item) {
            $context['text'] .= "<p>" . $item . "</p>\n";
        }
    } else {
예제 #20
0
파일: code_bb.php 프로젝트: rair/yacs
 public function render($matches)
 {
     $text = '';
     $mode = $matches[0];
     // detect horiz ruler
     if (preg_match('/(---|___)/', $mode)) {
         $mode = 'hrule';
     }
     switch ($mode) {
         case 'image':
         case 'img':
             if (count($matches) === 3) {
                 $alt = $matches[1];
                 $src = $matches[2];
             } else {
                 $alt = 'image';
                 $src = $matches[1];
             }
             $text = '<div class="external_image"><img src="' . encode_link($src) . '" alt="' . encode_link($alt) . '" /></div>' . "\n";
             break;
         case 'decorated':
             $text = Skin::build_block(Codes::fix_tags($matches[1]), 'decorated');
             break;
         case 'style':
             $text = Skin::build_block(Codes::fix_tags($matches[2]), $matches[1]);
             break;
         case 'abbr':
             $text = '<abbr title="' . $matches[1] . '">' . $matches[2] . '</abbr>';
             break;
         case 'color':
             $text = '<span style="color:' . $matches[1] . '">' . $matches[2] . '</span>';
             break;
         case 'tiny':
         case 'small':
         case 'big':
         case 'huge':
             $text = Skin::build_block(Codes::fix_tags($matches[1]), $mode);
             break;
         case 'sub':
         case 'sup':
         case 'ins':
         case 'del':
         case 'li':
             $text = '<' . $mode . '>' . $matches[1] . '</' . $mode . '>';
             break;
         case 'hrule':
             $text = HORIZONTAL_RULER;
             break;
         case '--':
             $text = '<del>' . $matches[1] . '</del>';
             break;
         case '++':
             $text = '<ins>' . $matches[1] . '</ins>';
             break;
         case '**':
         case 'b':
             $text = '<strong>' . $matches[1] . '</strong>';
             break;
         case '//':
         case 'i':
             $text = '<em>' . $matches[1] . '</em>';
             break;
         case '__':
         case 'u':
             $text = '<span style="text-decoration:underline;">' . $matches[1] . '</span>';
             break;
         case 'list':
             if (count($matches) === 3) {
                 $variant = $matches[1];
                 $content = $matches[2];
             } else {
                 $variant = '';
                 $content = $matches[1];
             }
             $text = self::render_list(Codes::fix_tags($content), $variant);
             break;
         case '*':
             $text = BR . BULLET_IMG . '&nbsp;';
             break;
         default:
             break;
     }
     return $text;
 }
예제 #21
0
파일: print.php 프로젝트: rair/yacs
    //
    // title
    $section = Skin::build_block(i18n::s('Files'), 'title');
    // list files by date (default) or by title (option :files_by_title:)
    if (preg_match('/\\bfiles_by_title\\b/i', $item['options'])) {
        $items = Files::list_by_title_for_anchor('category:' . $item['id'], 0, 300, 'category:' . $item['id']);
    } else {
        $items = Files::list_by_date_for_anchor('category:' . $item['id'], 0, 300, 'category:' . $item['id']);
    }
    // actually render the html for the section
    if ($items) {
        $context['text'] .= $section . Skin::build_list($items, 'decorated');
    }
    //
    // the links section
    //
    // title
    $section = Skin::build_block(i18n::s('See also'), 'title');
    // list links by date (default) or by title (option :links_by_title:)
    if (preg_match('/\\blinks_by_title\\b/i', $item['options'])) {
        $items = Links::list_by_title_for_anchor('category:' . $item['id'], 0, 50);
    } else {
        $items = Links::list_by_date_for_anchor('category:' . $item['id'], 0, 50);
    }
    // actually render the html
    if ($items) {
        $context['text'] .= $section . Skin::build_list($items, 'decorated');
    }
}
// render the skin
render_skin();
예제 #22
0
파일: fat_index.php 프로젝트: rair/yacs
                $context['text'] .= '<li>' . $link . '</li>';
            }
            $context['text'] .= "</ul>\n";
        }
    }
    // get script parameters
    $context['text'] .= Skin::build_block(i18n::s('Computation parameters'), 'title');
    // the form to catch the input
    $context['text'] .= '<form method="post" action="fat_index.php" id="main_form"><div>' . "\n";
    // an external reference to parse
    $context['text'] .= '<p>' . sprintf(i18n::s('Web Reference: %s'), '<input type="text" name="reference" size="60" value="' . htmlspecialchars($reference) . '" />') . "\n";
    // with an optional cookie
    $context['text'] .= '<br />' . sprintf(i18n::s('Optional cookie string: %s'), '<input type="text" name="cookie" size="60" value="' . htmlspecialchars($cookie) . '" />') . '</p>' . "\n";
    // or
    $context['text'] .= '<p><i>' . i18n::s('or') . '</i></p>' . "\n";
    // raw input
    $context['text'] .= sprintf(i18n::s('Raw Input: %s'), '<br /><textarea name="input" rows="10" cols="80">' . htmlspecialchars($input) . '</textarea>') . "\n";
    // the submit button
    $context['text'] .= '<p>' . Skin::build_submit_button(i18n::s('Submit'), NULL, NULL, 'action') . '</p>' . "\n" . '</div></form>' . "\n";
    // the filtered text, for visual control
    if (isset($filtered) && $filtered) {
        // section title
        $context['text'] .= Skin::build_block(i18n::s('Visual control of filtered data'), 'title');
        // transcode html entities
        $context['text'] .= '<p>' . htmlentities($filtered) . '</p>' . "\n";
    }
}
// render the skin
// if the current skin has been set to 'foo', YACS includes skins/foo/template.php
// basically, this script uses content of $context[] (e.g., $context['title']) to render the page
render_skin();
예제 #23
0
파일: view.php 프로젝트: rair/yacs
 $details = array();
 if (Surfer::is_member() && $item['edit_name']) {
     $details[] = sprintf(i18n::s('edited by %s %s'), Users::get_link($item['edit_name'], $item['edit_address'], $item['edit_id']), Skin::build_date($item['edit_date']));
 }
 // page details
 if (is_array($details)) {
     $context['text'] .= '<p class="details">' . ucfirst(implode(', ', $details)) . "</p>\n";
 }
 // insert anchor suffix
 if (is_object($anchor)) {
     $context['text'] .= $anchor->get_suffix();
 }
 // back to the anchor page
 if (is_object($anchor) && $anchor->is_viewable()) {
     $menu = array(Skin::build_link($anchor->get_url(), i18n::s('Back to main page'), 'button'));
     $context['text'] .= Skin::build_block(Skin::finalize_list($menu, 'menu_bar'), 'bottom');
 }
 //
 // populate the extra panel
 //
 // commands for associates and editors
 if (Surfer::is_associate() || is_object($anchor) && $anchor->is_assigned()) {
     $context['page_tools'][] = Skin::build_link(Locations::get_url($id, 'edit'), i18n::s('Edit'));
     $context['page_tools'][] = Skin::build_link(Locations::get_url($id, 'delete'), i18n::s('Delete'));
     // commands for the author
 } elseif (Surfer::is($item['edit_id'])) {
     $context['page_tools'][] = Skin::build_link(Locations::get_url($item['id'], 'edit'), i18n::s('Edit'));
 }
 // referrals, if any, in a sidebar
 //
 $context['components']['referrals'] =& Skin::build_referrals(Locations::get_url($item['id']));
예제 #24
0
파일: search.php 프로젝트: rair/yacs
    $text .= '<li>' . Skin::build_link($link, i18n::s('Yahoo!'), 'external') . '</li>';
    // Ask Jeeves
    $link = 'http://web.ask.com/web?q=' . $search;
    $text .= '<li>' . Skin::build_link($link, i18n::s('Ask Jeeves'), 'external') . '</li>';
    // in a separate panel
    $panels[] = array('extension', i18n::s('Extended search'), 'extensions_panel', $text);
}
// assemble all tabs
if (count($panels)) {
    $context['text'] .= Skin::build_tabs($panels);
}
// search at peering sites, but only on unconstrained request and on first page
include_once $context['path_to_root'] . 'servers/servers.php';
if (!$section_id && ($servers = Servers::list_for_search(0, 3, 'search'))) {
    // everything in a separate section
    $context['text'] .= Skin::build_block(i18n::s('At partner sites'), 'title');
    // query each server
    foreach ($servers as $server_url => $attributes) {
        list($server_search, $server_label) = $attributes;
        // a REST API that returns a RSS list
        $result = Call::list_resources($server_search, array('search' => $search));
        // error message
        if (!$result[0]) {
            $context['text'] .= $result[1];
        } else {
            $items = array();
            foreach ($result[1] as $item) {
                $suffix = '';
                if ($item['description']) {
                    $suffix .= ' - ' . $item['description'];
                }
예제 #25
0
파일: run_once.php 프로젝트: rair/yacs
/**
 * dynamically generate the page
 *
 * @see skins/index.php
 */
function send_body()
{
    global $context, $local;
    // $local is required to localize included scripts
    // include every script that has to be run once
    global $scripts, $scripts_count;
    if (@count($scripts)) {
        // the alphabetical order may be used to control script execution order
        sort($scripts);
        reset($scripts);
        // process each script one by one
        foreach ($scripts as $item) {
            // do not execute on first installation
            if (file_exists('../parameters/switch.on') || file_exists('../parameters/switch.off')) {
                // ensure we have a valid database resource
                if (!$context['connection']) {
                    break;
                }
                // remember this as an event
                Logger::remember('scripts/run_once.php: ' . sprintf(i18n::c('script %s has been executed'), $item));
                // where scripts actually are
                $actual_item = str_replace('//', '/', $context['path_to_root'] . 'scripts/run_once/' . $item);
                // include the script to execute it
                $scripts_count++;
                echo Skin::build_block($item, 'subtitle');
                include $actual_item;
                echo "\n";
            }
            // ensure enough overall execution time
            Safe::set_time_limit(30);
            // stamp the file to remember execution time
            Safe::touch($actual_item);
            // rename the script to avoid further execution
            Safe::unlink($actual_item . '.done');
            Safe::rename($actual_item, $actual_item . '.done');
        }
        // refresh javascript libraries
        Cache::purge('js');
    }
    // report on actual execution
    if ($scripts_count) {
        echo '<p>&nbsp;</p><p>' . sprintf(i18n::ns('%d script has been executed', '%d scripts have been executed', $scripts_count), $scripts_count) . "</p>\n";
    } else {
        echo '<p>' . i18n::s('No script has been executed') . "</p>\n";
    }
    // display the total execution time
    $time = round(get_micro_time() - $context['start_time'], 2);
    if ($time > 30) {
        echo '<p>' . sprintf(i18n::s('Script terminated in %.2f seconds.'), $time) . '</p>';
    }
    // if the server has been switched off, go back to the control panel
    if (file_exists('../parameters/switch.off')) {
        echo '<form method="get" action="' . $context['url_to_root'] . 'control/">' . "\n" . '<p class="assistant_bar">' . Skin::build_submit_button(i18n::s('Control Panel')) . '</p>' . "\n" . '</form>' . "\n";
        // else back to the control panel as well, but without a button
    } else {
        $menu = array('control/' => i18n::s('Control Panel'));
        echo Skin::build_list($menu, 'menu_bar');
    }
    // purge the cache, since it is likely that we have modified some data
    Cache::clear();
}
예제 #26
0
파일: view_as_tabs.php 프로젝트: rair/yacs
 // the beautified description, which is the actual page body
 if ($description) {
     // use adequate label
     if (is_object($overlay) && ($label = $overlay->get_label('description'))) {
         $text .= Skin::build_block($label, 'title');
     }
     // provide only the requested page
     $pages = preg_split('/\\s*\\[page\\]\\s*/is', $description);
     $page = max(min($page, count($pages)), 1);
     $description = $pages[$page - 1];
     // if there are several pages, remove toc and toq codes
     if (count($pages) > 1) {
         $description = preg_replace('/\\s*\\[(toc|toq)\\]\\s*/is', '', $description);
     }
     // beautify the target page
     $text .= Skin::build_block($description, 'description', '', $item['options']);
     // if there are several pages, add navigation commands to browse them
     if (count($pages) > 1) {
         $page_menu = array('_' => i18n::s('Pages'));
         $home = Sections::get_permalink($item);
         $prefix = Sections::get_url($item['id'], 'navigate', 'pages');
         $page_menu = array_merge($page_menu, Skin::navigate($home, $prefix, count($pages), 1, $page));
         $text .= Skin::build_list($page_menu, 'menu_bar');
     }
 }
 // the list of related articles if not at another follow-up page
 if (!$zoom_type || $zoom_type == 'articles') {
     // delegate rendering to the overlay, where applicable
     if (is_object($content_overlay) && ($overlaid = $content_overlay->render('articles', 'section:' . $item['id'], $zoom_index))) {
         $text .= $overlaid;
         // regular rendering
예제 #27
0
파일: index.php 프로젝트: rair/yacs
 * check apache options
 *
 * @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
i18n::bind('control');
// load the skin
load_skin('control');
// page title
$context['page_title'] = sprintf(i18n::s('%s: %s'), i18n::s('Configure'), i18n::s('Apache .htaccess'));
if (is_callable('apache_get_modules')) {
    if (in_array('mod_deflate', apache_get_modules())) {
        $context['text'] .= '<p>' . i18n::s('Compression of dynamic pages is available.') . '</p>';
    } else {
        $context['text'] .= '<p>' . sprintf(i18n::s('Activate the following Apache module to allow dynamic compression: %s'), 'mod_deflate') . '</p>';
    }
}
// follow-up commands
$follow_up = Skin::build_link('control/htaccess/', i18n::s('Done'), 'button');
$context['text'] .= Skin::build_block($follow_up, 'bottom');
// remember capability in session context
if (!isset($_SESSION['htaccess'])) {
    $_SESSION['htaccess'] = array();
}
$_SESSION['htaccess']['basic'] = TRUE;
// render the page according to the loaded skin
render_skin();
예제 #28
0
파일: review.php 프로젝트: rair/yacs
$context['page_menu'] = array('articles/' => i18n::s('All pages'));
// list queries
if (Surfer::is_associate()) {
    $anchor = Sections::lookup('queries');
    if ($anchor && ($rows =& Articles::list_for_anchor_by('publication', $anchor, 0, 5))) {
        if (is_array($rows)) {
            $rows = Skin::build_list($rows, 'decorated');
        }
        $context['text'] .= Skin::build_box(i18n::s('Submitted queries'), $rows, 'header1', 'queries');
    }
}
// list draft articles
if ($rows =& Articles::list_by('draft')) {
    // set a title to the section only if we have other sections
    if (Surfer::is_associate()) {
        $context['text'] .= Skin::build_block(i18n::s('Submitted articles'), 'title', 'submitted');
    }
    if (is_array($rows)) {
        $context['text'] .= Skin::build_list($rows, 'decorated');
    } else {
        $context['text'] .= $rows;
    }
}
// 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
예제 #29
0
파일: view.php 프로젝트: rair/yacs
     $label = i18n::s('This server is not allowed to submit search requests.');
 }
 $text .= '<p>' . $label . "</p>\n";
 // monitoring
 if ($item['process_monitor'] == 'Y') {
     $label = sprintf(i18n::s('This server is allowed to submit monitoring requests (<code>monitor.ping</code>) at %s'), Skin::build_link('services/index.php#xml-rpc', i18n::s('the XML-RPC interface'), 'shortcut'));
 } else {
     $label = i18n::s('This server is not allowed to submit monitoring requests.');
 }
 $text .= '<p>' . $label . "</p>\n";
 // a section for the description
 if ($item['description']) {
     // display the full text
     $text .= Skin::build_block(i18n::s('Server description'), 'subtitle');
     // show the description
     $text .= Skin::build_block($item['description'], 'description');
 }
 $context['text'] .= $text;
 // insert anchor suffix
 if (is_object($anchor)) {
     $context['text'] .= $anchor->get_suffix();
 }
 // test links
 if ($item['submit_feed'] == 'Y') {
     $context['page_tools'][] = Skin::build_link(Servers::get_url($id, 'test'), i18n::s('Test feed'));
 }
 // commands for associates
 if (Surfer::is_associate()) {
     $context['page_tools'][] = Skin::build_link(Servers::get_url($id, 'edit'), i18n::s('Edit'));
     $context['page_tools'][] = Skin::build_link(Servers::get_url($id, 'delete'), i18n::s('Delete'));
 }
예제 #30
0
파일: scan.php 프로젝트: rair/yacs
            } else {
                $context['text'] .= i18n::s('Hooks have been listed in parameters/hooks.xml') . BR . "\n";
            }
        }
    }
    // display the execution time
    $time = round(get_micro_time() - $context['start_time'], 2);
    $context['text'] .= '<p>' . sprintf(i18n::s('Script terminated in %.2f seconds.'), $time) . '</p>';
    // if the server has been switched off, update the database schema
    if (file_exists('../parameters/switch.off')) {
        $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();');