本文整理汇总了PHP中Surfer::is_member方法的典型用法代码示例。如果您正苦于以下问题:PHP Surfer::is_member方法的具体用法?PHP Surfer::is_member怎么用?PHP Surfer::is_member使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Surfer
的用法示例。
在下文中一共展示了Surfer::is_member方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: stat_for_anchor
/**
* get some statistics for one anchor
*
* Only articles matching following criteria are returned:
* - article is visible (active='Y')
* - article is restricted (active='R'), but the surfer is an authenticated member,
* or YACS is allowed to show restricted teasers
* - article is protected (active='N'), but surfer is an associate, and we are not feeding someone
* - surfer is anonymous or the variant is 'boxes', and article has been officially published
* - logged surfers are restricted to their own articles, plus published articles
* - an expiry date has not been defined, or is not yet passed
*
* @param the selected anchor (e.g., 'section:12')
* @param boolean FALSE to include sticky pages, TRUE otherwise
* @return the resulting ($count, $min_date, $max_date) array
*
* @see sections/view.php
*/
public static function stat_for_anchor($anchor, $without_sticky = FALSE)
{
global $context;
// sanity check
if (!$anchor) {
return NULL;
}
// restrict the query to addressable content
$where = Articles::get_sql_where();
// avoid sticky articles
if ($without_sticky) {
$where .= " AND (articles.rank >= 10000)";
}
// anonymous surfers and subscribers will see only published articles
if (!Surfer::is_member()) {
$where .= " AND NOT ((articles.publish_date is NULL) OR (articles.publish_date <= '0000-00-00'))" . " AND (articles.publish_date < '" . $context['now'] . "')";
// logged surfers that are non-associates are restricted to their own articles, plus published articles
} elseif (!Surfer::is_empowered()) {
$where .= " AND ((articles.create_id=" . Surfer::get_id() . ") OR (NOT ((articles.publish_date is NULL) OR (articles.publish_date <= '0000-00-00'))" . " AND (articles.publish_date < '" . $context['now'] . "')))";
}
// only consider live articles
$where .= " AND ((articles.expiry_date is NULL) " . "OR (articles.expiry_date <= '" . NULL_DATE . "') OR (articles.expiry_date > '" . $context['now'] . "'))";
// select among available items
$query = "SELECT COUNT(*) as count, MIN(edit_date) as oldest_date, MAX(edit_date) as newest_date" . " FROM " . SQL::table_name('articles') . " AS articles" . " WHERE (articles.anchor LIKE '" . SQL::escape($anchor) . "') AND (" . $where . ")";
$output = SQL::query_first($query);
return $output;
}
示例2: layout
//.........这里部分代码省略.........
$title = Codes::beautify_title($overlay->get_text('title', $item));
} else {
$title = Codes::beautify_title($item['title']);
}
// initialize variables
$prefix = $suffix = $icon = '';
// flag articles that are dead, or created or updated very recently
if ($item['expiry_date'] > NULL_DATE && $item['expiry_date'] <= $context['now']) {
$prefix .= EXPIRED_FLAG;
}
// signal articles to be published
if ($item['publish_date'] <= NULL_DATE || $item['publish_date'] > $context['now']) {
$prefix .= DRAFT_FLAG;
}
// signal restricted and private articles
if ($item['active'] == 'N') {
$prefix .= PRIVATE_FLAG;
} elseif ($item['active'] == 'R') {
$prefix .= RESTRICTED_FLAG;
}
// some details
$details = array();
// info on related files --optional
if ($count = Files::count_for_anchor('article:' . $item['id'], TRUE)) {
$details[] = sprintf(i18n::ns('%d file', '%d files', $count), $count);
}
// info on related comments --mandatory
if ($count = Comments::count_for_anchor('article:' . $item['id'], FALSE)) {
$details[] = sprintf(i18n::ns('%d comment', '%d comments', $count), $count);
}
// info on related links --optional
if ($count = Links::count_for_anchor('article:' . $item['id'], TRUE)) {
$details[] = sprintf(i18n::ns('%d link', '%d links', $count), $count);
}
// details
if (count($details)) {
$suffix .= ' <span class="details">(' . ucfirst(implode(', ', $details)) . ')</span>';
}
// flag popular pages
if ($item['hits'] > 300) {
$suffix .= POPULAR_FLAG;
}
// last contribution
if ($item['edit_action']) {
$action = Anchors::get_action_label($item['edit_action']) . ' ';
} else {
$action = i18n::s('edited');
}
if ($item['edit_name']) {
$suffix .= '<br /><span class="details">' . sprintf(i18n::s('%s by %s %s'), $action, Users::get_link($item['edit_name'], $item['edit_address'], $item['edit_id']), Skin::build_date($item['edit_date'])) . '</span>';
} else {
$suffix .= '<br /><span class="details">' . $action . ' ' . Skin::build_date($item['edit_date']) . '</span>';
}
// flag articles updated recently
if ($item['create_date'] >= $context['fresh']) {
$suffix .= NEW_FLAG;
} elseif ($item['edit_date'] >= $context['fresh']) {
$suffix .= UPDATED_FLAG;
}
// insert overlay data, if any
if (is_object($overlay)) {
$suffix .= $overlay->get_text('list', $item, $this->focus);
}
// the hovering title
if ($item['introduction'] && $context['skins_with_details'] == 'Y') {
$hover = strip_tags(Codes::beautify_introduction($item['introduction']));
} else {
$hover = i18n::s('View the page');
}
// help members to reference this page
if (Surfer::is_member()) {
$hover .= ' [article=' . $item['id'] . ']';
}
// add an image if available
if ($item['thumbnail_url']) {
$icon = $item['thumbnail_url'];
} elseif (is_callable(array($anchor, 'get_bullet_url'))) {
$icon = $anchor->get_bullet_url();
}
// format the image
if ($icon) {
$icon = Skin::build_link($url, '<img src="' . $icon . '" />', 'basic', $hover);
}
// list all components for this item
if ($odd = !$odd) {
$class = ' class="odd"';
} else {
$class = ' class="even"';
}
// use a table to layout the image properly
if ($icon) {
$text .= '<div' . $class . '><table class="decorated"><tr><td class="image" style="text-align: center">' . $icon . '</td><td class="content">' . $prefix . Skin::build_link($url, Skin::strip($title, 30), 'basic', $hover) . $suffix . '</td></tr></table></div>';
} else {
$text .= '<div' . $class . '>' . $prefix . Skin::build_link($url, Skin::strip($title, 30), 'basic', $hover) . $suffix . '</div>';
}
}
// end of processing
SQL::free($result);
return $text;
}
示例3: strip_tags
$id = $context['arguments'][0];
}
$id = strip_tags($id);
// get the item from the database
$item = Servers::get($id);
// get the related anchor, if any
$anchor = NULL;
if (isset($item['anchor']) && $item['anchor']) {
$anchor = Anchors::get($item['anchor']);
}
// associates can do what they want
if (Surfer::is_associate()) {
$permitted = TRUE;
} elseif (is_object($anchor) && !$anchor->is_viewable()) {
$permitted = FALSE;
} elseif ($item['active'] == 'R' && Surfer::is_member()) {
$permitted = TRUE;
} elseif ($item['active'] == 'Y') {
$permitted = TRUE;
} else {
$permitted = FALSE;
}
// load the skin
load_skin('servers');
// current item
if (isset($item['id'])) {
$context['current_item'] = 'server:' . $item['id'];
}
// the path to this page
$context['path_bar'] = array('servers/' => i18n::s('Servers'));
// the title of the page
示例4: layout
/**
* list sections
*
* @param resource the SQL result
* @return string the rendered text
*
* @see layouts/layout.php
**/
function layout($result)
{
global $context;
// we return some text
$text = '';
// empty list
if (!($delta = SQL::count($result))) {
return $text;
}
// process all items in the list
$count = 0;
$items = array();
while ($item = SQL::fetch($result)) {
// the url to view this item
$url = Sections::get_permalink($item);
// initialize variables
$prefix = $label = $suffix = '';
// flag sections that are draft or dead
if ($item['activation_date'] >= $context['now']) {
$prefix .= DRAFT_FLAG;
} elseif ($item['expiry_date'] > NULL_DATE && $item['expiry_date'] <= $context['now']) {
$prefix .= EXPIRED_FLAG;
}
// signal restricted and private sections
if ($item['active'] == 'N') {
$prefix .= PRIVATE_FLAG;
} elseif ($item['active'] == 'R') {
$prefix .= RESTRICTED_FLAG;
}
// flag items updated recently
if ($item['create_date'] >= $context['fresh']) {
$suffix .= NEW_FLAG;
} elseif ($item['edit_date'] >= $context['fresh']) {
$suffix .= UPDATED_FLAG;
}
// // start the label with family, if any
// if($item['family'])
// $label = ucfirst(Skin::strip($item['family'], 30)).' - ';
// use the title to label the link
$label .= ucfirst(Skin::strip($item['title'], 30));
// the hovering title
if ($item['introduction'] && $context['skins_with_details'] == 'Y') {
$hover = strip_tags(Codes::beautify_introduction($item['introduction']));
} else {
$hover = i18n::s('View the section');
}
// help members to reference this page
if (Surfer::is_member()) {
$hover .= ' [section=' . $item['id'] . ']';
}
// list all components for this item
$items[$url] = array($prefix, $label, $suffix, 'basic', NULL, $hover);
// limit to one page of results
if (++$count >= COMPACT_LIST_SIZE - 1) {
break;
}
}
// end of processing
SQL::free($result);
// turn this to some text
$text .= Skin::build_list($items, 'comma');
// some indications on the number of connections
if (($delta -= $count) > 0) {
$text .= ', ...';
}
return $text;
}
示例5: layout
/**
* list sections as topics in a forum
*
* @param resource the SQL result
* @return string the rendered text
**/
function layout($result)
{
global $context;
// empty list
if (!SQL::count($result)) {
$output = array();
return $output;
}
// layout in a table
$text = Skin::table_prefix('wide');
// 'even' is used for title rows, 'odd' for detail rows
$class_title = 'odd';
$class_detail = 'even';
// build a list of sections
$family = '';
include_once $context['path_to_root'] . 'comments/comments.php';
include_once $context['path_to_root'] . 'links/links.php';
while ($item = SQL::fetch($result)) {
// change the family
if ($item['family'] != $family) {
$family = $item['family'];
// show the family
$text .= Skin::table_suffix() . '<h2><span>' . $family . ' </span></h2>' . "\n" . Skin::table_prefix('wide');
}
// get the related overlay, if any
$overlay = Overlay::load($item, 'section:' . $item['id']);
// get the main anchor
$anchor = Anchors::get($item['anchor']);
// reset everything
$prefix = $label = $suffix = $icon = '';
// signal restricted and private sections
if ($item['active'] == 'N') {
$prefix .= PRIVATE_FLAG;
} elseif ($item['active'] == 'R') {
$prefix .= RESTRICTED_FLAG;
}
// indicate the id in the hovering popup
$hover = i18n::s('View the section');
if (Surfer::is_member()) {
$hover .= ' [section=' . $item['id'] . ']';
}
// the url to view this item
$url = Sections::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']);
}
// use the title as a link to the page
$title =& Skin::build_link($url, $title, 'basic', $hover);
// flag sections updated recently
if ($item['expiry_date'] > NULL_DATE && $item['expiry_date'] <= $context['now']) {
$suffix = EXPIRED_FLAG . ' ';
} elseif ($item['create_date'] >= $context['fresh']) {
$suffix = NEW_FLAG . ' ';
} elseif ($item['edit_date'] >= $context['fresh']) {
$suffix = UPDATED_FLAG . ' ';
}
// this is another row of the output
$text .= '<tr class="' . $class_title . '"><th>' . $prefix . $title . $suffix . '</th><th>' . i18n::s('Poster') . '</th><th>' . i18n::s('Messages') . '</th><th>' . i18n::s('Last active') . '</th></tr>' . "\n";
$count = 1;
// get last posts for this board --avoid sticky pages
if (preg_match('/\\barticles_by_([a-z_]+)\\b/i', $item['options'], $matches)) {
$order = $matches[1];
} else {
$order = 'edition';
}
if ($articles =& Articles::list_for_anchor_by($order, 'section:' . $item['id'], 0, 5, 'raw', TRUE)) {
foreach ($articles as $id => $article) {
// get the related overlay, if any
$article_overlay = Overlay::load($article, 'article:' . $id);
// flag articles updated recently
if ($article['expiry_date'] > NULL_DATE && $article['expiry_date'] <= $context['now']) {
$flag = EXPIRED_FLAG . ' ';
} elseif ($article['create_date'] >= $context['fresh']) {
$flag = NEW_FLAG . ' ';
} elseif ($article['edit_date'] >= $context['fresh']) {
$flag = UPDATED_FLAG . ' ';
} else {
$flag = '';
}
// use the title to label the link
if (is_object($article_overlay)) {
$title = Codes::beautify_title($article_overlay->get_text('title', $article));
} else {
$title = Codes::beautify_title($article['title']);
}
// title
$title = Skin::build_link(Articles::get_permalink($article), $title, 'article');
// poster
$poster = Users::get_link($article['create_name'], $article['create_address'], $article['create_id']);
// comments
$comments = Comments::count_for_anchor('article:' . $article['id']);
//.........这里部分代码省略.........
示例6: stat
/**
* get some statistics
*
* @return the resulting ($count, $min_date, $max_date) array
*/
public static function stat()
{
global $context;
// select among active and restricted items
$where = "servers.active='Y'";
if (Surfer::is_member()) {
$where .= " OR servers.active='R'";
}
if (Surfer::is_associate()) {
$where .= " OR servers.active='N'";
}
// select among available items
$query = "SELECT COUNT(*) as count, MIN(edit_date) as oldest_date, MAX(edit_date) as newest_date" . ' FROM ' . SQL::table_name('servers') . ' AS servers' . ' WHERE (' . $where . ')';
$output = SQL::query_first($query);
return $output;
}
示例7: encode_field
// the rank
if ($cur_article->is_owned() || Surfer::is_associate()) {
// the default value
if (!isset($item['rank'])) {
$item['rank'] = 10000;
}
$label = i18n::s('Rank');
$input = '<input type="text" name="rank" id="rank" size="10" value="' . encode_field($item['rank']) . '" maxlength="255" />';
$hint = sprintf(i18n::s('For %s pages; regular pages are ranked at %s.'), '<a href="#" onclick="$(\'#rank\').value=10; return false;">' . i18n::s('sticky') . '</a>', '<a href="#" onclick="$(\'#rank\').value=10000; return false;">' . i18n::s('10000') . '</a>');
$fields[] = array($label, $input, $hint);
}
// the publication date
$label = i18n::s('Publication date');
if (isset($item['publish_date']) && $item['publish_date'] > NULL_DATE) {
$input = Surfer::from_GMT($item['publish_date']);
} elseif (isset($item['id']) && (Surfer::is_associate() || Surfer::is_member() && is_object($anchor) && $anchor->is_assigned())) {
Skin::define_img('ARTICLES_PUBLISH_IMG', 'articles/publish.gif');
$input = Skin::build_link(Articles::get_url($item['id'], 'publish'), ARTICLES_PUBLISH_IMG . i18n::s('Publish'), 'basic');
} else {
Skin::define_img('ARTICLES_UNPUBLISH_IMG', 'articles/unpublish.gif');
$input = ARTICLES_UNPUBLISH_IMG . i18n::s('not published');
}
$fields[] = array($label, $input);
// the expiry date
$label = i18n::s('Expiry date');
if (isset($item['expiry_date']) && $item['expiry_date'] > NULL_DATE) {
$input = Surfer::from_GMT($item['expiry_date']);
} else {
$input = i18n::s('never');
}
$fields[] = array($label, $input);
示例8:
if ($text =& Articles::list_by('publication', $offset, $items_per_page)) {
// we have an array to format
if (is_array($text)) {
$text =& Skin::build_list($text, 'decorated');
}
}
// cache this to speed subsequent queries
Cache::put($cache_id, $text, 'articles');
}
$context['text'] .= $text;
}
//
// extra content
//
// add a page
if (Surfer::is_associate() || Surfer::is_member() && (!isset($context['users_without_submission']) || $context['users_without_submission'] != 'Y')) {
$context['page_tools'][] = Skin::build_link('articles/edit.php', i18n::s('Add a page'), 'basic');
}
// other commands
if (Surfer::is_associate()) {
$context['page_tools'][] = Skin::build_link('articles/review.php', i18n::s('Review queue'), 'basic');
$context['page_tools'][] = Skin::build_link('help/populate.php', i18n::s('Content Assistant'));
$context['page_tools'][] = Skin::build_link('articles/import.php', i18n::s('Import articles'), 'basic');
$context['page_tools'][] = Skin::build_link('articles/check.php', i18n::s('Maintenance'), 'basic');
}
// side bar with a rss feed, if this server is well populated
if ($stats['count'] > $items_per_page) {
$context['components']['channels'] = Skin::build_box(i18n::s('Information channels'), Skin::build_link(Feeds::get_url('rss'), i18n::s('Recent pages'), 'xml') . BR . Skin::build_link(Feeds::get_url('articles'), i18n::s('Full content'), 'xml'), 'channels');
}
// page extra information
$cache_id = 'articles/index.php#extra';
示例9: layout
/**
* list sections
*
* @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)) {
// get the related overlay, if any
$overlay = Overlay::load($item, 'section:' . $item['id']);
// the url to view this item
$url = Sections::get_permalink($item);
// initialize variables
$prefix = $label = $suffix = '';
// flag sections that are draft or dead
if ($item['activation_date'] >= $context['now']) {
$prefix .= DRAFT_FLAG;
} elseif ($item['expiry_date'] > NULL_DATE && $item['expiry_date'] <= $context['now']) {
$prefix .= EXPIRED_FLAG;
}
// signal restricted and private sections
if ($item['active'] == 'N') {
$prefix .= PRIVATE_FLAG;
} elseif ($item['active'] == 'R') {
$prefix .= RESTRICTED_FLAG;
}
// flag items updated recently
if ($item['create_date'] >= $context['fresh']) {
$suffix .= NEW_FLAG;
} elseif ($item['edit_date'] >= $context['fresh']) {
$suffix .= UPDATED_FLAG;
}
// // start the label with family, if any
// if($item['family'])
// $label = ucfirst(Skin::strip($item['family'], 30)).' - ';
// use the title to label the link
if (is_object($overlay)) {
$label = ucfirst(Codes::beautify_title($overlay->get_text('title', $item)));
} else {
$label .= ucfirst(Skin::strip($item['index_title'], 30));
}
// the hovering title
if ($item['introduction'] && $context['skins_with_details'] == 'Y') {
$hover = strip_tags(Codes::beautify_introduction($item['introduction']));
} else {
$hover = i18n::s('View the section');
}
// help members to reference this page
if (Surfer::is_member()) {
$hover .= ' [section=' . $item['id'] . ']';
}
// list all components for this item
$items[$url] = array($prefix, $label, $suffix, 'basic', NULL, $hover);
}
// end of processing
SQL::free($result);
return $items;
}
示例10: may_mail
/**
* can this surfer mail other users?
*
* @return TRUE if alowed, FALSE otherwise
*/
public static function may_mail()
{
global $context;
// email has to be activated
if (!isset($context['with_email'])) {
return FALSE;
}
if ($context['with_email'] != 'Y') {
return FALSE;
}
// only members can send e-mail
if (!Surfer::is_member()) {
return FALSE;
}
return Surfer::may_contact();
}
示例11: layout
/**
* list articles
*
* @param resource the SQL result
* @return array
*
* @see layouts/layout.php
**/
function layout($result)
{
global $context;
// we return an array of ($url => $attributes)
$items = array();
// empty list
if (!SQL::count($result)) {
return $items;
}
// process all items in the list
include_once $context['path_to_root'] . 'comments/comments.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']);
}
// initialize variables
$prefix = $suffix = '';
// flag articles that are dead, or created or updated very recently
if ($item['expiry_date'] > NULL_DATE && $item['expiry_date'] <= $context['now']) {
$prefix .= EXPIRED_FLAG;
}
// signal articles to be published
if ($item['publish_date'] <= NULL_DATE || $item['publish_date'] > $context['now']) {
$prefix .= DRAFT_FLAG;
}
// signal restricted and private articles
if ($item['active'] == 'N') {
$prefix .= PRIVATE_FLAG;
} elseif ($item['active'] == 'R') {
$prefix .= RESTRICTED_FLAG;
}
// count related comments, if any
if ($count = Comments::count_for_anchor('article:' . $item['id'], TRUE)) {
$suffix .= ' (' . $count . ')';
}
// flag articles updated recently
if ($item['create_date'] >= $context['fresh']) {
$suffix .= NEW_FLAG;
} elseif ($item['edit_date'] >= $context['fresh']) {
$suffix .= UPDATED_FLAG;
}
// the hovering title
if ($item['introduction'] && $context['skins_with_details'] == 'Y') {
$hover = strip_tags(Codes::beautify_introduction($item['introduction']));
} else {
$hover = i18n::s('View the page');
}
// help members to reference this page
if (Surfer::is_member()) {
$hover .= ' [article=' . $item['id'] . ']';
}
// list all components for this item
$items[$url] = array($prefix, Skin::strip($title, 30), $suffix, 'basic', NULL, $hover);
}
// end of processing
SQL::free($result);
return $items;
}
示例12: post
/**
* post a new file or an updated file
*
* This function populates the error context, where applicable.
*
* @param array an array of fields
* @param string to support editors -- see files/edit.php
* @return the id of the new file, or FALSE on error
*
* @see agents/messages.php
* @see files/author.php
* @see files/edit.php
**/
public static function post(&$fields)
{
global $context;
// no anchor reference
if (!isset($fields['anchor']) || !$fields['anchor'] || !($anchor = Anchors::get($fields['anchor']))) {
Logger::error(i18n::s('No anchor has been found.'));
return FALSE;
}
// protect from hackers
if (isset($fields['icon_url'])) {
$fields['icon_url'] = encode_link($fields['icon_url']);
}
if (isset($fields['thumbnail_url'])) {
$fields['thumbnail_url'] = encode_link($fields['thumbnail_url']);
}
// protect access from anonymous users
if (!isset($fields['active_set'])) {
$fields['active_set'] = 'Y';
}
// cascade anchor access rights
$fields['active'] = $anchor->ceil_rights($fields['active_set']);
// set default values for this editor
Surfer::check_default_editor($fields);
// reinforce date formats
if (!isset($fields['create_date']) || $fields['create_date'] <= NULL_DATE) {
$fields['create_date'] = $fields['edit_date'];
}
// make the file name searchable on initial post
if (!isset($fields['id']) && !isset($fields['keywords']) && isset($fields['file_name']) && $fields['file_name'] != 'none') {
$fields['keywords'] = ' ' . str_replace(array('%20', '_', '.', '-'), ' ', $fields['file_name']);
}
// columns updated
$query = array();
// update an existing record
if (isset($fields['id'])) {
// id cannot be empty
if (!isset($fields['id']) || !is_numeric($fields['id'])) {
Logger::error(i18n::s('No item has the provided id.'));
return FALSE;
}
// an actual upload has taken place --change modification date and reset detach data
if (isset($fields['file_name']) && $fields['file_name'] != 'none') {
$query[] = "assign_address=''";
$query[] = "assign_date=''";
$query[] = "assign_id=''";
$query[] = "assign_name=''";
$query[] = "create_address='" . SQL::escape($fields['edit_address']) . "'";
$query[] = "create_date='" . SQL::escape($fields['edit_date']) . "'";
$query[] = "create_id=" . SQL::escape($fields['edit_id']);
$query[] = "create_name='" . SQL::escape($fields['edit_name']) . "'";
$query[] = "edit_address='" . SQL::escape($fields['edit_address']) . "'";
$query[] = "edit_action='file:update'";
$query[] = "edit_date='" . SQL::escape($fields['edit_date']) . "'";
$query[] = "edit_id=" . SQL::escape($fields['edit_id']);
$query[] = "edit_name='" . SQL::escape($fields['edit_name']) . "'";
$query[] = "file_name='" . SQL::escape($fields['file_name']) . "'";
$query[] = "file_size='" . SQL::escape($fields['file_size']) . "'";
}
// fields that are visible only to people allowed to update a file
if (Surfer::is_member()) {
$query[] = "active='" . SQL::escape($fields['active']) . "'";
$query[] = "active_set='" . SQL::escape($fields['active_set']) . "'";
$query[] = "icon_url='" . SQL::escape(isset($fields['icon_url']) ? $fields['icon_url'] : '') . "'";
$query[] = "thumbnail_url='" . SQL::escape(isset($fields['thumbnail_url']) ? $fields['thumbnail_url'] : '') . "'";
}
// regular fields
$query[] = "alternate_href='" . SQL::escape(isset($fields['alternate_href']) ? $fields['alternate_href'] : '') . "'";
$query[] = "behaviors='" . SQL::escape(isset($fields['behaviors']) ? $fields['behaviors'] : '') . "'";
if (isset($fields['description'])) {
$query[] = "description='" . SQL::escape($fields['description']) . "'";
}
$query[] = "overlay='" . SQL::escape(isset($fields['overlay']) ? $fields['overlay'] : '') . "'";
$query[] = "overlay_id='" . SQL::escape(isset($fields['overlay_id']) ? $fields['overlay_id'] : '') . "'";
$query[] = "file_href='" . SQL::escape(isset($fields['file_href']) ? $fields['file_href'] : '') . "'";
$query[] = "keywords='" . SQL::escape(isset($fields['keywords']) ? $fields['keywords'] : '') . "'";
$query[] = "rank='" . SQL::escape(isset($fields['rank']) ? $fields['rank'] : '10000') . "'";
$query[] = "source='" . SQL::escape(isset($fields['source']) ? $fields['source'] : '') . "'";
$query[] = "title='" . SQL::escape(isset($fields['title']) ? $fields['title'] : '') . "'";
// build the full query
$query = "UPDATE " . SQL::table_name('files') . " SET " . join(', ', $query) . " WHERE id = " . SQL::escape($fields['id']);
// actual insert
if (SQL::query($query) === FALSE) {
return FALSE;
}
// insert a new record
} elseif (isset($fields['file_name']) && $fields['file_name'] && isset($fields['file_size']) && $fields['file_size']) {
$query[] = "active='" . SQL::escape($fields['active']) . "'";
//.........这里部分代码省略.........
示例13: elseif
$anchor = Anchors::get($item['anchor']);
}
// the anchor has to be viewable by this surfer
if (!is_object($anchor) || $anchor->is_viewable()) {
$permitted = TRUE;
} else {
$permitted = FALSE;
}
// nothing to change
if (!isset($item['id'])) {
$editable = FALSE;
} elseif (Surfer::is_associate() || is_object($anchor) && $anchor->is_assigned()) {
$editable = TRUE;
} elseif (Surfer::is($item['edit_id'])) {
$editable = TRUE;
} elseif (Surfer::is_member() && (!isset($context['users_without_file_overloads']) || $context['users_without_file_overloads'] != 'Y')) {
$editable = TRUE;
} else {
$editable = FALSE;
}
// load the skin, maybe with a variant
load_skin('images', $anchor);
// clear the tab we are in, if any
if (is_object($anchor)) {
$context['current_focus'] = $anchor->get_focus();
}
// current item
if (isset($item['id'])) {
$context['current_item'] = 'image:' . $item['id'];
}
// the path to this page
示例14: explode
/**
* build linked tags
*
* @param string the full list of tags
* @return string HTML tags to be put in the resulting page
*/
public static function &build_tags($tags)
{
global $context;
$text = '';
// list existing tags
$tags = explode(',', $tags);
foreach ($tags as $tag) {
if (!($tag = trim($tag))) {
continue;
}
if ($category = Categories::get_by_keyword($tag)) {
// get category visibility and check surfer rights
$active = $category['active'];
if ($active == 'Y' || $active == 'R' && Surfer::is_member() || $active == 'N' && Surfer::is_associate()) {
// add background color to distinguish this category against others
if (isset($category['background_color']) && $category['background_color']) {
$tag = '<span style="background-color: ' . $category['background_color'] . '; padding: 0 3px 0 3px;">' . $tag . '</span>';
}
$text .= Skin::build_link(Categories::get_permalink($category), $tag, 'basic') . ' ';
} else {
// do not show the tag for this category
$text .= '';
}
} else {
$text .= $tag . ' ';
}
}
$text = rtrim($text, ' ');
// a link to add a tag
return $text;
}
示例15: strip_tags
}
$id = strip_tags($id);
// get the item from the database
$item = Categories::get($id);
// get the related anchor, if any
$anchor = NULL;
if (isset($item['anchor']) && $item['anchor']) {
$anchor = Anchors::get($item['anchor']);
}
// get the related overlay, if any
$overlay = NULL;
if (isset($item['overlay'])) {
$overlay = Overlay::load($item, 'category:' . $item['id']);
}
// associates and authenticated editors can do what they want
if (Surfer::is_associate() || Surfer::is_member() && is_object($anchor) && $anchor->is_assigned()) {
$permitted = TRUE;
} else {
$permitted = FALSE;
}
// load the skin
load_skin('categories');
// the path to this page
if (is_object($anchor) && $anchor->is_viewable()) {
$context['path_bar'] = $anchor->get_path_bar();
} else {
$context['path_bar'] = array('categories/' => i18n::s('Categories'));
}
if (isset($item['id'])) {
$context['path_bar'] = array_merge($context['path_bar'], array(Categories::get_permalink($item) => $item['title']));
}