本文整理汇总了PHP中Skin::build_block方法的典型用法代码示例。如果您正苦于以下问题:PHP Skin::build_block方法的具体用法?PHP Skin::build_block怎么用?PHP Skin::build_block使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Skin
的用法示例。
在下文中一共展示了Skin::build_block方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: encode_field
$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: load_skin
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: array
// 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: natsort
}
// 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();
示例5: array
$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();
示例6: layout
//.........这里部分代码省略.........
} 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;
}
示例7: sprintf
} 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
示例8: define
$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 = '';
示例9: build_notification
/**
* 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');
}
//.........这里部分代码省略.........
示例10: array_merge
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'])) {
示例11: load_skin
*/
// 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';
示例12: layout
/**
* 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)) {
//.........这里部分代码省略.........
示例13: sprintf
$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']);
示例14: echo_title
/**
* 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');
}
}
示例15:
$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();