本文整理汇总了PHP中Users::get_url方法的典型用法代码示例。如果您正苦于以下问题:PHP Users::get_url方法的具体用法?PHP Users::get_url怎么用?PHP Users::get_url使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Users
的用法示例。
在下文中一共展示了Users::get_url方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: elseif
if (Surfer::get_id() && !$zoom_type) {
$link = Users::get_url('section:' . $item['id'], 'track');
if ($in_watch_list == 'Y') {
$label = i18n::s('Stop notifications');
} elseif ($in_watch_list == 'N') {
$label = i18n::s('Watch this section');
}
if ($in_watch_list != 'P') {
Skin::define_img('TOOLS_WATCH_IMG', 'tools/watch.gif');
$lines[] = Skin::build_link($link, TOOLS_WATCH_IMG . $label, 'basic', i18n::s('Manage your watch list'));
}
}
// allow to leave the section
if ($cur_section->is_assigned() && !$cur_section->is_owned(null, false)) {
Skin::define_img('SECTIONS_ASSIGN_IMG', 'sections/assign.gif');
$lines[] = Skin::build_link(Users::get_url('section:' . $item['id'], 'leave'), SECTIONS_ASSIGN_IMG . i18n::s('Leave this section'));
}
// get news from rss
if (isset($item['id']) && (!isset($context['skins_general_without_feed']) || $context['skins_general_without_feed'] != 'Y')) {
$lines[] = Skin::build_link($context['url_to_home'] . $context['url_to_root'] . Sections::get_url($item['id'], 'feed'), i18n::s('Recent pages'), 'xml');
$lines[] = Skin::build_link($context['url_to_home'] . $context['url_to_root'] . Files::get_url('section:' . $item['id'], 'feed'), i18n::s('Recent files'), 'xml');
// comments are allowed
if ($cur_section->allows('creation', 'comment')) {
$lines[] = Skin::build_link($context['url_to_home'] . $context['url_to_root'] . Comments::get_url('section:' . $item['id'], 'feed'), i18n::s('Recent comments'), 'xml');
}
}
// in a side box
if (count($lines)) {
$context['components']['channels'] = Skin::build_box(i18n::s('Monitor'), join(BR, $lines), 'channels', 'feeds');
}
// twin pages
示例2: array
// the path to this page
$context['path_bar'] = array('users/' => i18n::s('People'));
// the title of the page
if ($item['full_name']) {
$context['page_title'] = $item['full_name'];
} elseif ($item['nick_name']) {
$context['page_title'] = $item['nick_name'];
}
// not found
if (!isset($item['id'])) {
include '../error.php';
// permission denied
} elseif (!$permitted) {
// anonymous users are invited to log in or to register
if (!Surfer::is_logged()) {
Safe::redirect($context['url_to_home'] . $context['url_to_root'] . 'users/login.php?url=' . urlencode(Users::get_url($item['id'], 'fetch_vcard')));
}
// permission denied to authenticated user
Safe::header('Status: 401 Unauthorized', TRUE, 401);
Logger::error(i18n::s('You are not allowed to perform this operation.'));
// display the user profile
} else {
// format name components
$names = $item['full_name'];
if (preg_match('/^(.+)\\s(.+?)$/', $names, $matches)) {
$names = $matches[2] . ';' . $matches[1];
}
// build the vCard
$text = 'BEGIN:VCARD' . CRLF . 'VERSION:2.1' . CRLF . 'FN:' . $item['full_name'] . CRLF . 'N:' . $names . CRLF . 'NICKNAME:' . $item['nick_name'] . CRLF;
// organization, if any
if (isset($item['vcard_organization']) && $item['vcard_organization']) {
示例3: build_profile
//.........这里部分代码省略.........
// from where
if (isset($user['from_where']) && $user['from_where']) {
$details[] = sprintf(i18n::s('from %s'), Codes::beautify($user['from_where']));
}
// display details
if (count($details)) {
$text .= '<span class="details">' . implode(', ', $details) . '</span>' . BR;
}
// use the introduction field, if any
if (isset($user['introduction']) && $user['introduction']) {
$text .= Codes::beautify($user['introduction']);
}
// suffix after the full name
if ($text) {
$text = ' -- ' . $text;
}
$text = '<div class="top">' . $avatar . Skin::build_link($url, $label, 'user') . $text . '</div><br style="clear: left;" />';
break;
// at the end of the page
// at the end of the page
case 'suffix':
// avatar
$avatar = '';
if (isset($user['avatar_url']) && $user['avatar_url']) {
$thumb = '';
if ($position = strrpos($user['avatar_url'], '/')) {
$thumb = substr($user['avatar_url'], 0, $position) . '/thumbs' . substr($user['avatar_url'], $position);
}
if (is_readable($context['path_to_root'] . str_replace($context['url_to_root'], '', $thumb))) {
$avatar =& Skin::build_link($url, '<img src="' . $thumb . '" alt="" title="avatar" class="avatar left_image" />', 'basic');
} else {
$avatar =& Skin::build_link($url, '<img src="' . $user['avatar_url'] . '" alt="" title="avatar" class="avatar left_image' . $more_styles . '" />', 'basic');
}
}
// date of post
if ($more) {
$text .= $more . ' ';
}
// from where
if (isset($user['from_where']) && $user['from_where']) {
$text .= sprintf(i18n::s('from %s'), Codes::beautify($user['from_where']));
}
// display details
if ($text) {
$text = '<span class="details">' . $text . '</span>' . BR;
}
// use the introduction field, if any
if (isset($user['introduction']) && $user['introduction']) {
$text .= Codes::beautify($user['introduction']);
}
// suffix after the full name
if ($text) {
$text = ' -- ' . $text;
}
$text = '<address>' . $avatar . Skin::build_link($url, $label, 'user') . $text . '</address><br style="clear: left;" />';
break;
// in a sidebox
// in a sidebox
case 'extra':
// details attributes
$details = array();
// avatar
if (isset($user['avatar_url']) && $user['avatar_url']) {
$details[] =& Skin::build_link($url, '<img src="' . $user['avatar_url'] . '" alt="" title="avatar" class="avatar' . $more_styles . '" />', 'basic');
} else {
if (Surfer::is_empowered()) {
Skin::define_img('IMAGES_ADD_IMG', 'images/add.gif');
$details[] =& Skin::build_link(Users::get_url($user['id'], 'select_avatar'), IMAGES_ADD_IMG . i18n::s('Add picture'), 'basic');
}
}
// date of post
if ($more) {
$details[] = $more;
}
// from where
if (isset($user['from_where']) && $user['from_where']) {
$details[] = sprintf(i18n::s('from %s'), Codes::beautify($user['from_where']));
}
// details first
if (count($details)) {
$text .= '<p class="details">' . join(BR, $details) . '</p>';
}
// do not use description because of codes such as location, etc
if (isset($user['introduction']) && $user['introduction']) {
$text .= Codes::beautify($user['introduction']);
}
// show contact information
if (Surfer::may_contact()) {
$contacts = Users::build_presence($user);
if ($contacts) {
$text .= BR . $contacts;
}
}
// everything in an extra box
$text = Skin::build_box($label, $text, 'profile');
break;
}
// return by reference
return $text;
}
示例4: list_selected
/**
* list selected activities
*
* @param resource result of database query
* @param string 'compact', etc or object, i.e., an instance of Layout_Interface
* @return NULL on error, else an ordered array with $url => array ($prefix, $label, $suffix, $type, $icon)
*/
public static function list_selected($result, $variant = 'raw')
{
global $context;
// no result
if (!$result) {
$output = NULL;
return $output;
}
// special layouts
if (is_object($variant)) {
$output = $variant->layout($result);
return $output;
}
// one of regular layouts
switch ($variant) {
case 'comma':
$text = '';
while ($item = SQL::fetch($result)) {
if ($text) {
$text .= ', ';
}
$text .= Skin::build_link(Users::get_url($item['edit_id'], 'view', $item['edit_name']), $item['edit_name'], 'user');
}
return $text;
case 'raw':
default:
$items = array();
while ($item = SQL::fetch($result)) {
$items[] = $item;
}
return $items;
}
}
示例5: implode
if (count($details)) {
$context['text'] .= '<p class="details">' . implode(BR . "\n", $details) . '</p>';
}
// the full name
if ($item['full_name']) {
$context['text'] .= '<p>' . sprintf(i18n::s('%s: %s'), i18n::s('Full name'), $item['full_name']) . "</p>\n";
}
// web address, if any
if (isset($item['web_address']) && $item['web_address']) {
$context['text'] .= '<p>' . sprintf(i18n::s('%s: %s'), i18n::s('Web address'), Skin::build_link($item['web_address'], $item['web_address'], 'external')) . "</p>\n";
}
// email address - not showed to anonymous surfers for spam protection
if (isset($item['email']) && $item['email'] && Surfer::may_mail()) {
$label = i18n::s('E-mail address: %s %s');
if (isset($context['with_email']) && $context['with_email'] == 'Y') {
$url = Users::get_url($id, 'mail');
} else {
$url = 'mailto:' . $item['email'];
}
if (isset($item['with_newsletters']) && $item['with_newsletters'] == 'Y') {
$suffix = '';
} else {
$suffix = i18n::s('(do not wish to receive newsletters)');
}
$context['text'] .= '<p>' . sprintf($label, Skin::build_link($url, $item['email'], 'email'), $suffix) . "</p>\n";
}
// the introduction text
$context['text'] .= Skin::build_block($item['introduction'], 'introduction');
// the beautified description, which is the actual page body
$context['text'] .= Skin::build_block($item['description'], 'description');
//
示例6: array
$lines = array();
// watch command is provided to logged surfers
if (Surfer::get_id()) {
$link = Users::get_url('article:' . $item['id'], 'track');
if ($in_watch_list) {
$label = i18n::s('Stop notifications');
} else {
$label = i18n::s('Watch this page');
}
Skin::define_img('TOOLS_WATCH_IMG', 'tools/watch.gif');
$lines[] = Skin::build_link($link, TOOLS_WATCH_IMG . $label, 'basic', i18n::s('Manage your watch list'));
}
// allow to leave the page
if ($cur_article->is_assigned() && !$cur_article->is_owned(null, false)) {
Skin::define_img('ARTICLES_ASSIGN_IMG', 'articles/assign.gif');
$lines[] = Skin::build_link(Users::get_url('article:' . $item['id'], 'leave'), ARTICLES_ASSIGN_IMG . i18n::s('Leave this page'));
}
// get news from rss
if (isset($item['id']) && (!isset($context['skins_general_without_feed']) || $context['skins_general_without_feed'] != 'Y')) {
// list of attached files
$lines[] = Skin::build_link($context['url_to_home'] . $context['url_to_root'] . Files::get_url('article:' . $item['id'], 'feed'), i18n::s('Recent files'), 'xml');
// comments are allowed
if ($cur_article->allows('creation', 'comment')) {
$lines[] = Skin::build_link($context['url_to_home'] . $context['url_to_root'] . Comments::get_url('article:' . $item['id'], 'feed'), i18n::s('Recent comments'), 'xml');
}
}
// in a side box
if (count($lines)) {
$context['components']['channels'] = Skin::build_box(i18n::s('Monitor'), join(BR, $lines), 'channels', 'feeds');
}
// twin pages
示例7: array
$input .= '/> ' . i18n::s('Community - Access is granted to any identified surfer') . ' ' . BR . '<input type="radio" name="active" value="N"';
if (isset($item['active']) && $item['active'] == 'N') {
$input .= ' checked="checked"';
}
$input .= '/> ' . i18n::s('Private - Access is restricted to selected persons');
$fields[] = array($label, $input);
// actually build the form
$context['text'] .= Skin::build_form($fields);
$fields = array();
//
// bottom commands
//
$menu = array();
// the submit button
$menu[] = Skin::build_submit_button(i18n::s('Submit'), i18n::s('Press [s] to submit data'), 's');
// cancel button
if (Surfer::get_id()) {
$menu[] = Skin::build_link(Users::get_url(Surfer::get_id()), i18n::s('Back to my profile'), 'span');
}
// insert the menu in the page
$context['text'] .= Skin::finalize_list($menu, 'assistant_bar');
// end of the form
$context['text'] .= '</div></form>';
// append the script used for data checking on the browser
Page::insert_script('func' . 'tion validateDocumentPost(container) {' . "\n" . ' if(!container.title.value) {' . "\n" . ' alert("' . i18n::s('Please provide a meaningful title.') . '");' . "\n" . ' Yacs.stopWorking();' . "\n" . ' return false;' . "\n" . ' }' . "\n" . ' return true;' . "\n" . '}' . "\n" . 'func' . 'tion detectChanges() {' . "\n" . ' $("form#main_form input").each(function () {' . "\n" . ' $(this).change(function() { $("#preferred_editor").attr("disabled", true); });' . "\n" . ' });' . "\n" . "\n" . ' $("form#main_form textarea").each(function () {;' . "\n" . ' $(this).change(function() { $("#preferred_editor").attr("disabled", true); });' . "\n" . ' });' . "\n" . "\n" . ' $("form#main_form select").each(function () {;' . "\n" . ' $(this).change(function() { $("#preferred_editor").attr("disabled", true); });' . "\n" . ' });' . "\n" . '}' . "\n" . "\n" . '$(document).ready( detectChanges);' . "\n" . "\n" . '$("#title").focus();' . "\n");
// general help on this form
$help = '<p>' . sprintf(i18n::s('%s and %s are available to enhance text rendering.'), Skin::build_link('codes/', 'YACS codes', 'open'), Skin::build_link('smileys/', 'smileys', 'open')) . '</p>';
$context['components']['boxes'] = Skin::build_box(i18n::s('Help'), $help, 'boxes', 'help');
}
// render the skin
render_skin();
示例8: layout
/**
* list users
*
* @param resource the SQL result
* @return string the rendered text
*
* @see layouts/layout.php
**/
function layout($result)
{
global $context;
// empty list
if (!SQL::count($result)) {
$output = array();
return $output;
}
// we return an array of ($url => $attributes)
$items = array();
// process all items in the list
while ($item = SQL::fetch($result)) {
// initialize variables
$prefix = $suffix = $icon = '';
// the url to view this item
$url = Users::get_permalink($item);
// flag profiles updated recently
if ($item['create_date'] >= $context['fresh']) {
$suffix .= NEW_FLAG;
} elseif ($item['edit_date'] >= $context['fresh']) {
$suffix .= UPDATED_FLAG;
}
// signal restricted and private profiles
if ($item['active'] == 'N') {
$prefix .= PRIVATE_FLAG;
} elseif ($item['active'] == 'R') {
$prefix .= RESTRICTED_FLAG;
}
// signal locked profiles
if ($item['capability'] == '?') {
$prefix .= EXPIRED_FLAG;
}
// item title
if ($item['full_name']) {
$label = ucfirst(Skin::strip($item['full_name'], 10)) . ' [' . $item['nick_name'] . ']';
} else {
$label = ucfirst(Skin::strip($item['nick_name'], 10));
}
// the introduction
if ($item['introduction']) {
if (is_callable(array('codes', 'beautify'))) {
$suffix .= ' - ' . Codes::beautify($item['introduction']);
} else {
$suffix .= ' - ' . $item['introduction'];
}
}
// details
$details = array();
// creation date
if ($item['create_date']) {
$details[] = sprintf(i18n::s('registered %s'), Skin::build_date($item['create_date']));
}
// last login
if (isset($item['login_date']) && $item['login_date'] > NULL_DATE) {
$details[] = sprintf(i18n::s('last login %s'), Skin::build_date($item['login_date']));
} else {
$details[] = i18n::s('no login');
}
// last post
if (isset($item['post_date']) && $item['post_date'] > NULL_DATE) {
$details[] = sprintf(i18n::s('last post %s'), Skin::build_date($item['post_date']));
}
// posts
if (intval($item['posts']) > 1) {
$details[] = sprintf(i18n::s('%d posts'), intval($item['posts']));
}
if (count($details)) {
$suffix .= ' <span class="details">(' . implode(', ', $details) . ')</span>';
}
// the command to ask for a new password
$suffix .= '<p style="padding: 0.5em 0 0.5em 0">' . Skin::build_link(Users::get_url($item['id'], 'password', $item['nick_name']), i18n::s('Authenticate with this profile'), 'button') . '</p>';
// use the avatar, if any
if (isset($item['avatar_url'])) {
$icon = $item['avatar_url'];
}
// list all components for this item
$items[$url] = array($prefix, $label, $suffix, 'user', $icon);
}
// end of processing
SQL::free($result);
return $items;
}
示例9: join
if (count($lines)) {
$context['components']['channels'] = Skin::build_box(i18n::s('Monitor'), join(BR, $lines), 'channels', 'feed');
}
// categories attached to this item, if not at another follow-up page
if (!$zoom_type || $zoom_type == 'categories') {
// build a complete box
$box = array();
$box['bar'] = array();
$box['text'] = '';
// list categories by title
$items =& Members::list_categories_by_title_for_member('user:' . $item['id'], 0, COMPACT_LIST_SIZE, 'sidebar');
// the command to change categories assignments
if (Categories::allow_assign($item)) {
$items = array_merge($items, array(Categories::get_url('user:' . $item['id'], 'select') => i18n::s('Assign categories')));
}
// actually render the html for the section
if (is_array($box['bar'])) {
$box['text'] .= Skin::build_list($box['bar'], 'menu_bar');
}
if (is_array($items)) {
$box['text'] .= Skin::build_list($items, 'compact');
}
if ($box['text']) {
$context['components']['categories'] = Skin::build_box(i18n::s('See also'), $box['text'], 'categories', 'categories');
}
}
// referrals, if any
$context['components']['referrals'] =& Skin::build_referrals(Users::get_url($item['id']));
}
// render the skin -- do not provide Last-Modified header
render_skin(FALSE);
示例10: foreach
// one feed per section
if ($items = Sections::list_by_title_for_anchor(NULL, 0, COMPACT_LIST_SIZE, 'raw')) {
foreach ($items as $id => $attributes) {
$text .= ' <outline type="rss" text="' . encode_field(strip_tags($attributes['title']) . $suffix) . '" xmlUrl="' . $context['url_to_home'] . $context['url_to_root'] . Sections::get_url($id, 'feed') . '"' . " />\n";
}
}
// one feed per category
if ($items = Categories::list_by_date(0, COMPACT_LIST_SIZE, 'raw')) {
foreach ($items as $id => $attributes) {
$text .= ' <outline type="rss" text="' . encode_field(strip_tags($attributes['title']) . $suffix) . '" xmlUrl="' . $context['url_to_home'] . $context['url_to_root'] . Categories::get_url($id, 'feed') . '"' . " />\n";
}
}
// one feed per user
if ($items = Users::list_by_posts(0, COMPACT_LIST_SIZE, 'raw')) {
foreach ($items as $id => $attributes) {
$text .= ' <outline type="rss" text="' . encode_field(strip_tags($attributes['nick_name']) . $suffix) . '" xmlUrl="' . $context['url_to_home'] . $context['url_to_root'] . Users::get_url($id, 'feed') . '"' . " />\n";
}
}
// the postamble
$text .= '</body>' . "\n" . '</opml>' . "\n";
// put in cache
Safe::file_put_contents($cache_id, $text);
}
//
// transfer to the user agent
//
// handle the output correctly
render_raw('text/xml; charset=' . $context['charset']);
// suggest a name on download
if (!headers_sent()) {
$file_name = utf8::to_ascii($context['site_name'] . '.opml.xml');
示例11: encode_field
// the information panel
//
$text = '';
// the avatar url
if (isset($item['id'])) {
$label = i18n::s('Picture URL');
// show the current avatar
if (isset($item['avatar_url']) && $item['avatar_url']) {
$input = '<img src="' . $item['avatar_url'] . '" alt="" />' . BR;
}
$value = '';
if (isset($item['avatar_url']) && $item['avatar_url']) {
$value = $item['avatar_url'];
}
$input .= '<input type="text" name="avatar_url" size="55" value="' . encode_field($value) . '" maxlength="255" />';
$input .= ' <span class="details">' . Skin::build_link(Users::get_url($item['id'], 'select_avatar'), i18n::s('Change picture'), 'button') . '</span>';
$fields[] = array($label, $input);
}
// from where
$label = i18n::s('From');
$input = '<input type="text" name="from_where" size="50" value="' . encode_field(isset($item['from_where']) ? $item['from_where'] : '') . '" maxlength="255" />';
$hint = i18n::s('Some hint on your location (eg, \'Paris\', \'home\', \'the toys-for-sick-persons department\')');
$fields[] = array($label, $input, $hint);
// the introduction
$label = i18n::s('Introduction');
$input = '<textarea name="introduction" rows="5" cols="50">' . encode_field(isset($item['introduction']) ? $item['introduction'] : '') . '</textarea>';
$hint = i18n::s('Displayed aside your pages');
$fields[] = array($label, $input, $hint);
// include overlay fields, if any
if (is_object($overlay)) {
$fields = array_merge($fields, $overlay->get_fields($item));
示例12: array
Skin::define_img('ARTICLES_INVITE_IMG', 'articles/invite.gif');
$box['bar'] += array(Articles::get_url($item['id'], 'invite') => ARTICLES_INVITE_IMG . i18n::s('Invite participants'));
}
// notify participants
if ($count > 1 && Articles::allow_message($item, $anchor) && isset($context['with_email']) && $context['with_email'] == 'Y') {
Skin::define_img('ARTICLES_EMAIL_IMG', 'articles/email.gif');
$box['bar'] += array(Articles::get_url($item['id'], 'mail') => ARTICLES_EMAIL_IMG . i18n::s('Notify participants'));
}
// manage editors, for owners
if (Articles::is_owned($item, $anchor, TRUE) || Surfer::is_associate()) {
Skin::define_img('ARTICLES_ASSIGN_IMG', 'articles/assign.gif');
$box['bar'] += array(Users::get_url('article:' . $item['id'], 'select') => ARTICLES_ASSIGN_IMG . i18n::s('Manage participants'));
// leave this page, for editors
} elseif (Articles::is_assigned($item['id'])) {
Skin::define_img('ARTICLES_ASSIGN_IMG', 'sections/assign.gif');
$box['bar'] += array(Users::get_url('article:' . $item['id'], 'leave') => ARTICLES_ASSIGN_IMG . i18n::s('Leave this page'));
}
// headers
$headers = array(i18n::s('Person'), i18n::s('Watcher'), i18n::s('Editor'), i18n::s('Owner'));
// layout columns
if ($rows) {
$box['text'] .= Skin::table($headers, $rows, 'grid');
}
// actually render the html
$users .= Skin::build_content(NULL, NULL, $box['text'], $box['bar']);
}
// display in a separate panel
if ($users) {
$label = i18n::s('Persons');
if ($users_count) {
$label .= ' (' . $users_count . ')';
示例13: post
//.........这里部分代码省略.........
if (!isset($fields['interface']) || $fields['interface'] != 'C') {
$fields['interface'] = 'I';
}
$query[] = "interface='" . SQL::escape($fields['interface']) . "'";
$query[] = "introduction='" . SQL::escape(isset($fields['introduction']) ? $fields['introduction'] : '') . "'";
$query[] = "irc_address='" . SQL::escape(isset($fields['irc_address']) ? $fields['irc_address'] : '') . "'";
$query[] = "jabber_address='" . SQL::escape(isset($fields['jabber_address']) ? $fields['jabber_address'] : '') . "'";
$query[] = "language='" . SQL::escape(isset($fields['language']) ? $fields['language'] : 'none') . "'";
$query[] = "msn_address='" . SQL::escape(isset($fields['msn_address']) ? $fields['msn_address'] : '') . "'";
$query[] = "nick_name='" . SQL::escape($fields['nick_name']) . "'";
$query[] = "options='" . SQL::escape(isset($fields['options']) ? $fields['options'] : '') . "'";
$query[] = "overlay='" . SQL::escape(isset($fields['overlay']) ? $fields['overlay'] : '') . "'";
$query[] = "overlay_id='" . SQL::escape(isset($fields['overlay_id']) ? $fields['overlay_id'] : '') . "'";
$query[] = "password='" . SQL::escape(isset($fields['password']) ? $fields['password'] : '') . "'";
$query[] = "pgp_key='" . SQL::escape(isset($fields['pgp_key']) ? $fields['pgp_key'] : '') . "'";
$query[] = "phone_number='" . SQL::escape(isset($fields['phone_number']) ? $fields['phone_number'] : '') . "'";
if (!isset($fields['post_date']) || $fields['post_date'] <= NULL_DATE) {
$fields['post_date'] = $fields['edit_date'];
}
$query[] = "post_date='" . SQL::escape($fields['post_date']) . "'";
$query[] = "posts=" . SQL::escape(isset($fields['posts']) ? $fields['posts'] : '0');
$query[] = "signature='" . SQL::escape(isset($fields['signature']) ? $fields['signature'] : '') . "'";
$query[] = "skype_address='" . SQL::escape(isset($fields['skype_address']) ? $fields['skype_address'] : '') . "'";
// clean provided tags
if (isset($fields['tags'])) {
$fields['tags'] = trim($fields['tags'], " \t.:,!?");
}
$query[] = "tags='" . SQL::escape(isset($fields['tags']) ? $fields['tags'] : '') . "'";
$query[] = "twitter_address='" . SQL::escape(isset($fields['twitter_address']) ? $fields['twitter_address'] : '') . "'";
$query[] = "vcard_agent='" . SQL::escape(isset($fields['vcard_agent']) ? $fields['vcard_agent'] : '') . "'";
$query[] = "vcard_label='" . SQL::escape(isset($fields['vcard_label']) ? $fields['vcard_label'] : '') . "'";
$query[] = "vcard_organization='" . SQL::escape(isset($fields['vcard_organization']) ? $fields['vcard_organization'] : '') . "'";
$query[] = "vcard_title='" . SQL::escape(isset($fields['vcard_title']) ? $fields['vcard_title'] : '') . "'";
$query[] = "web_address='" . SQL::escape(isset($fields['web_address']) ? $fields['web_address'] : '') . "'";
if (!isset($fields['with_newsletters']) || $fields['with_newsletters'] != 'N') {
$fields['with_newsletters'] = 'Y';
}
$query[] = "with_newsletters='" . $fields['with_newsletters'] . "'";
if (!isset($fields['without_alerts']) || $fields['without_alerts'] != 'Y') {
$fields['without_alerts'] = 'N';
}
$query[] = "without_alerts='" . $fields['without_alerts'] . "'";
if (!isset($fields['without_confirmations']) || $fields['without_confirmations'] != 'Y') {
$fields['without_confirmations'] = 'N';
}
$query[] = "without_confirmations='" . $fields['without_confirmations'] . "'";
if (!isset($fields['without_messages']) || $fields['without_messages'] != 'Y') {
$fields['without_messages'] = 'N';
}
$query[] = "without_messages='" . $fields['without_messages'] . "'";
$query[] = "yahoo_address='" . SQL::escape(isset($fields['yahoo_address']) ? $fields['yahoo_address'] : '') . "'";
// insert statement
$query = "INSERT INTO " . SQL::table_name('users') . " SET " . implode(', ', $query);
// actual insert
if (SQL::query($query, FALSE, $context['users_connection']) === FALSE) {
return FALSE;
}
// remember the id of the new item
if (!($fields['id'] = SQL::get_last_id($context['users_connection']))) {
logger::remember('users/users.php: unable to retrieve id of new record');
return FALSE;
}
// list the user in categories
Categories::remember('user:' . $fields['id'], NULL_DATE, isset($fields['tags']) ? $fields['tags'] : '');
// clear the cache for users
Users::clear($fields);
// send a confirmation message
if (isset($fields['email']) && trim($fields['email']) && isset($context['with_email']) && $context['with_email'] == 'Y') {
// message title
$subject = sprintf(i18n::s('Your account at %s'), strip_tags($context['site_name']));
// top of the message
$message = '<p>' . i18n::s('Welcome!') . '</p>' . '<p>' . sprintf(i18n::s('This message relates to your account at %s.'), '<a href="' . $context['url_to_home'] . $context['url_to_root'] . '">' . strip_tags($context['site_name']) . '</a>') . '</p>';
// mention nick name
$message .= '<p>' . sprintf(i18n::s('Your nick name is %s'), $fields['nick_name']) . '</p>';
// direct link to login page --see users/login.php
$link = $context['url_to_home'] . $context['url_to_root'] . Users::get_login_url('login', $fields['id'], rand(1000, 9999), $fields['handle']);
$message .= '<p>' . i18n::s('Record this message and use the following link to authenticate to the site at any time:') . '</p>' . '<p><a href="' . $link . '">' . $link . '</a></p>';
// caution note
$message .= '<p>' . i18n::s('Caution: This hyperlink contains your login credentials encrypted. Please be aware anyone who uses this link will have full access to your account.') . '</p>';
// confirmation link
if (isset($context['users_with_email_validation']) && $context['users_with_email_validation'] == 'Y') {
$message .= '<p>' . i18n::s('Click on the link below to activate your new account.') . '</p>';
// use the secret handle
$link = $context['url_to_home'] . $context['url_to_root'] . Users::get_url($fields['handle'], 'validate');
$message .= '<p><a href="' . $link . '">' . $link . '</a></p>';
}
// bottom of the message
$message .= '<p>' . sprintf(i18n::s('On-line help is available at %s'), '<a href="' . $context['url_to_home'] . $context['url_to_root'] . 'help/' . '">' . $context['url_to_home'] . $context['url_to_root'] . 'help/' . '</a>') . '</p>' . '<p>' . sprintf(i18n::s('Thank you for your interest into %s.'), '<a href="' . $context['url_to_home'] . $context['url_to_root'] . '">' . strip_tags($context['site_name']) . '</a>') . '</p>';
// enable threading
$headers = Mailer::set_thread('user:' . $fields['id']);
// post the confirmation message
Mailer::notify(NULL, $fields['email'], $subject, $message, $headers);
}
// automatic login
if (!Surfer::get_id() && is_callable(array('Surfer', 'set'))) {
Surfer::set($fields, TRUE);
}
// return the id of the new item
return $fields['id'];
}
示例14: urlencode
$context['page_tools'][] = Skin::build_link(Comments::get_url('category:' . $item['id'], 'comment'), COMMENTS_ADD_IMG . i18n::s('Post a comment'), 'basic', i18n::s('Express yourself, and say what you think.'));
}
// add a link
if (Links::allow_creation($item, $anchor, 'category')) {
Skin::define_img('LINKS_ADD_IMG', 'links/add.gif');
$context['page_tools'][] = Skin::build_link('links/edit.php?anchor=' . urlencode('category:' . $item['id']), LINKS_ADD_IMG . i18n::s('Add a link'), 'basic', i18n::s('Contribute to the web and link to relevant pages.'));
}
// modify this item
Skin::define_img('CATEGORIES_EDIT_IMG', 'categories/edit.gif');
$context['page_tools'][] = Skin::build_link(Categories::get_url($item['id'], 'edit'), CATEGORIES_EDIT_IMG . i18n::s('Edit this category'), 'basic', i18n::s('Press [e] to edit'), FALSE, 'e');
// delete this item
Skin::define_img('CATEGORIES_DELETE_IMG', 'categories/delete.gif');
$context['page_tools'][] = Skin::build_link(Categories::get_url($item['id'], 'delete'), CATEGORIES_DELETE_IMG . i18n::s('Delete this category'));
// manage persons assigned to this category
Skin::define_img('CATEGORIES_ASSIGN_IMG', 'categories/assign.gif');
$context['page_tools'][] = Skin::build_link(Users::get_url('category:' . $item['id'], 'select'), CATEGORIES_ASSIGN_IMG . i18n::s('Manage members'));
}
// add extra information from the overlay, if any
if (is_object($overlay)) {
$context['components']['overlay'] = $overlay->get_text('extra', $item);
}
// add extra information from this item, if any
if (isset($item['extra']) && $item['extra']) {
$context['components']['boxes'] = Codes::beautify_extra($item['extra']);
}
// 'Share' box
//
$lines = array();
// the command to track back
if (Links::allow_trackback()) {
Skin::define_img('TOOLS_TRACKBACK_IMG', 'tools/trackback.gif');
示例15: sprintf
if ($items = Members::list_watchers_by_name_for_anchor('user:' . $item['id'], 0, 1000, 'compact')) {
if (is_array($items)) {
$items = Skin::build_list($items, 'compact');
}
if (Surfer::get_id() == $item['id']) {
$followers .= '<p>' . i18n::s('Persons who follow you:') . '</p>' . $items;
} else {
$followers .= '<p>' . sprintf(i18n::s('Persons who follow %s:'), $item['full_name']) . '</p>' . $items;
}
}
// connect to people
if (Surfer::get_id() && Surfer::get_id() != $item['id']) {
// suggest a new connection
if (!Members::check('user:' . $item['id'], 'user:' . Surfer::get_id())) {
Skin::define_img('USERS_WATCH_IMG', 'users/watch.gif');
$link = Users::get_url('user:' . $item['id'], 'track');
$followers .= '<p style="margin: 1em 0;">' . Skin::build_link($link, USERS_WATCH_IMG . sprintf(i18n::s('Follow %s'), $item['full_name']), 'basic', i18n::s('Be notified of additions from this person')) . '</p>';
}
}
// put followers in a sidebar
if ($followers) {
$output .= Skin::layout_horizontally($watched, Skin::build_block($followers, 'sidecolumn'));
} else {
$output .= $watched;
}
// actual transmission except on a HEAD request
if (isset($_SERVER['REQUEST_METHOD']) && $_SERVER['REQUEST_METHOD'] != 'HEAD') {
echo $output;
}
// the post-processing hook, then exit
finalize_page(TRUE);