当前位置: 首页>>代码示例>>PHP>>正文


PHP Comments::get_url方法代码示例

本文整理汇总了PHP中Comments::get_url方法的典型用法代码示例。如果您正苦于以下问题:PHP Comments::get_url方法的具体用法?PHP Comments::get_url怎么用?PHP Comments::get_url使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Comments的用法示例。


在下文中一共展示了Comments::get_url方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: layout

 /**
  * list comments
  *
  * @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
     include_once $context['path_to_root'] . 'comments/comments.php';
     while ($item = SQL::fetch($result)) {
         // url to view the comment
         $url = Comments::get_url($item['id']);
         // initialize variables
         $prefix = $label = $suffix = $icon = '';
         // the title as the label
         if ($item['create_name']) {
             $label .= ucfirst($item['create_name']) . ' ';
         }
         // time of creation
         $label .= Skin::build_date($item['create_date']);
         // text beginning
         if ($text = Skin::strip($item['description'], 10, NULL, NULL)) {
             $suffix = ' - ' . $text;
         }
         // list all components for this item
         $items[$url] = array($prefix, $label, $suffix, 'comment', $icon);
     }
     // end of processing
     SQL::free($result);
     return $items;
 }
开发者ID:rair,项目名称:yacs,代码行数:42,代码来源:layout_comments_as_compact.php

示例2: get_comment_notification

 public function get_comment_notification($item)
 {
     global $context;
     // build a tease notification for simple members
     // sanity check
     if (!isset($item['anchor']) || !($anchor = Anchors::get($item['anchor']))) {
         throw new Exception('no anchor for this comment');
     }
     // headline
     $headline = sprintf(i18n::c('%s has replied'), Surfer::get_link());
     $content = BR;
     // shape these
     $tease = Skin::build_mail_content($headline, $content);
     // a set of links
     $menu = array();
     // call for action
     $link = $context['url_to_home'] . $context['url_to_root'] . Comments::get_url($item['id'], 'view');
     $menu[] = Skin::build_mail_button($link, i18n::c('View the reply'), TRUE);
     // link to the container
     $menu[] = Skin::build_mail_button($anchor->get_url(), $anchor->get_title(), FALSE);
     // finalize links
     $tease .= Skin::build_mail_menu($menu);
     // assemble all parts of the mail
     $mail = array();
     $mail['subject'] = sprintf(i18n::c('%s: %s'), i18n::c('Reply in the discussion'), strip_tags($anchor->get_title()));
     $mail['notification'] = Comments::build_notification($item);
     // full notification
     $mail['tease'] = Mailer::build_notification($tease, 1);
     return $mail;
 }
开发者ID:rair,项目名称:yacs,代码行数:30,代码来源:thread.php

示例3: layout

 /**
  * list comments as successive notes in a thread
  *
  * @param resource the SQL result
  * @return string the rendered text
  **/
 function layout($result)
 {
     global $context;
     // we return formatted text
     $text = '';
     // empty list
     if (!SQL::count($result)) {
         return $text;
     }
     // build a list of comments
     while ($item = SQL::fetch($result)) {
         // automatic notification
         if ($item['type'] == 'notification') {
             $text = '<dd class="thread_other" style="font-style: italic;">' . ucfirst(trim($item['description'])) . '</dd>' . $text;
         } else {
             // link to user profile -- open links in separate window to enable side browsing of participant profiles
             if ($item['create_id']) {
                 if ($user = Users::get($item['create_id']) && $user['full_name']) {
                     $hover = $user['full_name'];
                 } else {
                     $hover = NULL;
                 }
                 $author = Users::get_link($item['create_name'], $item['create_address'], $item['create_id'], TRUE, $hover);
             } else {
                 $author = Users::get_link($item['edit_name'], $item['edit_address'], $item['edit_id'], TRUE);
             }
             // differentiate my posts from others
             if (Surfer::get_id() && $item['create_id'] == Surfer::get_id()) {
                 $style = ' class="thread_me"';
             } else {
                 $style = ' class="thread_other"';
             }
             // a clickable label
             $stamp = '#';
             // flag old items on same day
             if (!strncmp($item['edit_date'], gmstrftime('%Y-%m-%d %H:%M:%S', time()), 10)) {
                 $stamp = Skin::build_time($item['edit_date']);
             } else {
                 $stamp = Skin::build_date($item['edit_date']);
             }
             // append this at the end of the comment
             $stamp = ' <div style="float: right; font-size: x-small">' . Skin::build_link(Comments::get_url($item['id']), $stamp, 'basic', i18n::s('Edit')) . '</div>';
             // package everything --change order to get oldest first
             $text = '<dt' . $style . '>' . $author . '</dt><dd' . $style . '>' . $stamp . ucfirst(trim($item['description'])) . '</dd>' . $text;
         }
     }
     // end of processing
     SQL::free($result);
     // finalize the returned definition list
     if ($text) {
         $text = '<dl>' . $text . '</dl>';
     }
     // process yacs codes
     $text = Codes::beautify($text);
     return $text;
 }
开发者ID:rair,项目名称:yacs,代码行数:62,代码来源:layout_comments_as_thread.php

示例4: layout_newest

 /**
  * layout the newest articles
  *
  * caution: this function also updates page title directly, and this makes its call non-cacheable
  *
  * @param array the article
  * @return string the rendered text
  **/
 function layout_newest($item)
 {
     global $context;
     // get the related overlay, if any
     $overlay = Overlay::load($item, 'article:' . $item['id']);
     // get the anchor
     $anchor = Anchors::get($item['anchor']);
     // the url to view this item
     $url = Articles::get_permalink($item);
     // reset the rendering engine between items
     Codes::initialize($url);
     // build a title
     if (is_object($overlay)) {
         $title = Codes::beautify_title($overlay->get_text('title', $item));
     } else {
         $title = Codes::beautify_title($item['title']);
     }
     // title prefix & suffix
     $text = $prefix = $suffix = '';
     // flag articles updated recently
     if ($context['site_revisit_after'] < 1) {
         $context['site_revisit_after'] = 2;
     }
     $context['fresh'] = gmstrftime('%Y-%m-%d %H:%M:%S', mktime(0, 0, 0, date("m"), date("d") - $context['site_revisit_after'], date("Y")));
     // link to permalink
     if (Surfer::is_empowered()) {
         $title = Skin::build_box_title($title, $url, i18n::s('Permalink'));
     }
     // signal articles to be published
     if ($item['publish_date'] <= NULL_DATE) {
         $prefix .= DRAFT_FLAG;
     } else {
         if ($item['publish_date'] > NULL_DATE && $item['publish_date'] > $context['now']) {
             $prefix .= DRAFT_FLAG;
         }
     }
     // signal restricted and private articles
     if ($item['active'] == 'N') {
         $prefix .= PRIVATE_FLAG . ' ';
     } elseif ($item['active'] == 'R') {
         $prefix .= RESTRICTED_FLAG . ' ';
     }
     // signal locked articles
     if (isset($item['locked']) && $item['locked'] == 'Y' && Articles::is_owned($item, $anchor)) {
         $suffix .= LOCKED_FLAG;
     }
     // flag expired article
     if ($item['expiry_date'] > NULL_DATE && $item['expiry_date'] <= $context['now']) {
         $suffix .= EXPIRED_FLAG;
     }
     // update page title directly
     $text .= Skin::build_block($prefix . $title . $suffix, 'title');
     // if this article has a specific icon, use it
     if ($item['icon_url']) {
         $icon = $item['icon_url'];
     } elseif ($item['anchor'] && ($anchor = Anchors::get($item['anchor']))) {
         $icon = $anchor->get_icon_url();
     }
     // if we have a valid image
     if (preg_match('/(.gif|.jpg|.jpeg|.png)$/i', $icon)) {
         // fix relative path
         if (!preg_match('/^(\\/|http:|https:|ftp:)/', $icon)) {
             $icon = $context['url_to_root'] . $icon;
         }
         // flush the image on the right
         $text .= '<img src="' . $icon . '" class="right_image" alt="" />';
     }
     // article rating, if the anchor allows for it
     if (!is_object($anchor) || !$anchor->has_option('without_rating')) {
         // report on current rating
         $label = '';
         if ($item['rating_count']) {
             $label = Skin::build_rating_img((int) round($item['rating_sum'] / $item['rating_count'])) . ' ';
         }
         $label .= i18n::s('Rate this page');
         // allow for rating
         $text .= Skin::build_link(Articles::get_url($item['id'], 'like'), $label, 'basic');
     }
     // the introduction text, if any
     if (is_object($overlay)) {
         $text .= Skin::build_block($overlay->get_text('introduction', $item), 'introduction');
     } else {
         $text .= Skin::build_block($item['introduction'], 'introduction');
     }
     // insert overlay data, if any
     if (is_object($overlay)) {
         $text .= $overlay->get_text('view', $item);
     }
     // the beautified description, which is the actual page body
     if ($item['description']) {
         // use adequate label
         if (is_object($overlay) && ($label = $overlay->get_label('description'))) {
//.........这里部分代码省略.........
开发者ID:rair,项目名称:yacs,代码行数:101,代码来源:layout_home_articles_as_alistapart.php

示例5: 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)) {
//.........这里部分代码省略.........
开发者ID:rair,项目名称:yacs,代码行数:101,代码来源:layout_articles_as_last.php

示例6: 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'] . 'articles/article.php';
     include_once $context['path_to_root'] . 'comments/comments.php';
     include_once $context['path_to_root'] . 'locations/locations.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']);
         // provide an absolute link
         $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']);
         }
         // time of last update
         $time = SQL::strtotime($item['edit_date']);
         // the section
         $section = '';
         if ($item['anchor'] && ($anchor = Anchors::get($item['anchor']))) {
             $section = ucfirst(trim(strip_tags(Codes::beautify_title($anchor->get_title()))));
         }
         // the icon to use
         $icon = '';
         if ($item['thumbnail_url']) {
             $icon = $item['thumbnail_url'];
         } elseif ($item['anchor'] && ($anchor = Anchors::get($item['anchor'])) && is_callable($anchor, 'get_bullet_url')) {
             $icon = $anchor->get_bullet_url();
         }
         if ($icon) {
             $icon = $context['url_to_home'] . $context['url_to_root'] . $icon;
         }
         // the author(s) is an e-mail address, according to rss 2.0 spec
         $author = '';
         if (isset($item['create_address'])) {
             $author .= $item['create_address'];
         }
         if (isset($item['create_name']) && trim($item['create_name'])) {
             $author .= ' (' . $item['create_name'] . ')';
         }
         if (isset($item['edit_address']) && trim($item['edit_address']) && $item['create_address'] != $item['edit_address']) {
             if ($author) {
                 $author .= ', ';
             }
             $author .= $item['edit_address'];
             if (isset($item['edit_name']) && trim($item['edit_name'])) {
                 $author .= ' (' . $item['edit_name'] . ')';
             }
         }
         // some introductory text for this article
         $article = new Article();
         $article->load_by_content($item);
         $introduction = $article->get_teaser('teaser');
         // warns on restricted access
         if (isset($item['active']) && $item['active'] != 'Y') {
             $introduction = '[' . i18n::c('Restricted to members') . '] ' . $introduction;
         }
         // fix references
         $introduction = preg_replace('/"\\//', '"' . $context['url_to_home'] . '/', $introduction);
         // the article content
         $description = '';
         // other rss fields
         $extensions = array();
         // the geolocation for this page, if any
         if ($location = Locations::locate_anchor('article:' . $item['id'])) {
             $extensions[] = '<georss:point>' . str_replace(',', ' ', $location) . '</georss:point>';
         }
         // url for comments
         if (is_object($anchor)) {
             $extensions[] = '<comments>' . encode_link($context['url_to_home'] . $context['url_to_root'] . $anchor->get_url('comments')) . '</comments>';
         }
         // count comments
         $comment_count = Comments::count_for_anchor('article:' . $item['id']);
         $extensions[] = '<slash:comments>' . $comment_count . "</slash:comments>";
         // the comment post url
         $extensions[] = '<wfw:comment>' . encode_link($context['url_to_home'] . $context['url_to_root'] . Comments::get_url('article:' . $item['id'], 'service.comment')) . "</wfw:comment>";
         // the comment Rss url
         $extensions[] = '<wfw:commentRss>' . encode_link($context['url_to_home'] . $context['url_to_root'] . Comments::get_url('article:' . $item['id'], 'feed')) . "</wfw:commentRss>";
         // the trackback url
         $extensions[] = '<trackback:ping>' . encode_link($context['url_to_home'] . $context['url_to_root'] . 'links/trackback.php?anchor=' . urlencode('article:' . $item['id'])) . "</trackback:ping>";
         // no trackback:about;
//.........这里部分代码省略.........
开发者ID:rair,项目名称:yacs,代码行数:101,代码来源:layout_articles_as_feed.php

示例7: array_merge

         $label = i18n::s('Edit the comment');
     }
     if (Surfer::is_logged()) {
         $menu = array_merge($menu, array(Comments::get_url($_REQUEST['id'], 'edit') => $label));
     }
     $follow_up .= Skin::build_list($menu, 'menu_bar');
     $context['text'] .= Skin::build_block($follow_up, 'bottom');
     // comment author
     if ($author = Surfer::get_name()) {
         $author = sprintf(i18n::c('Comment by %s'), $author);
     } else {
         $author = i18n::c('Anonymous comment');
     }
     // log the submission of a new comment
     $label = sprintf(i18n::c('%s: %s'), $author, strip_tags($anchor->get_title()));
     $link = $context['url_to_home'] . $context['url_to_root'] . Comments::get_url($_REQUEST['id']);
     $description = '<a href="' . $link . '">' . $link . '</a>';
     // notify sysops
     Logger::notify('comments/edit.php: ' . $label, $description);
     // forward to the updated thread
     if (!isset($_REQUEST['follow_up'])) {
         // redirect
         Safe::redirect($anchor->get_url('comments'));
     } elseif ($_REQUEST['follow_up'] === 'json') {
         // provide a json version of the new comment.
         Comments::render_json($_REQUEST['id'], $anchor);
     }
     // update of an existing comment
 } else {
     // remember the previous version
     if ($item['id']) {
开发者ID:rair,项目名称:yacs,代码行数:31,代码来源:edit.php

示例8: layout

 /**
  * list articles as rows in a table
  *
  * @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;
     }
     // build a list of articles
     $rows = array();
     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);
         // reset everything
         $id = $summary = $owner = $type = $status = $update = $progress = '';
         // link to the page
         $id = Skin::build_link($url, $item['id'], 'basic');
         // 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')) {
             $summary .= DRAFT_FLAG;
         }
         // signal restricted and private articles
         if ($item['active'] == 'N') {
             $summary .= PRIVATE_FLAG;
         } elseif ($item['active'] == 'R') {
             $summary .= RESTRICTED_FLAG;
         }
         // indicate the id in the hovering popup
         $hover = i18n::s('View the page');
         if (Surfer::is_member()) {
             $hover .= ' [article=' . $item['id'] . ']';
         }
         // use the title to label the link
         if (is_object($overlay)) {
             $label = Codes::beautify_title($overlay->get_text('title', $item));
         } else {
             $label = Codes::beautify_title($item['title']);
         }
         // use the title as a link to the page
         $summary .= Skin::build_link($url, $label, 'basic', $hover);
         // signal locked articles
         if (isset($item['locked']) && $item['locked'] == 'Y' && Articles::is_owned($item, $anchor)) {
             $summary .= ' ' . LOCKED_FLAG;
         }
         // flag articles updated recently
         if ($item['expiry_date'] > NULL_DATE && $item['expiry_date'] <= $context['now']) {
             $summary .= ' ' . EXPIRED_FLAG;
         } elseif ($item['create_date'] >= $context['fresh']) {
             $summary .= ' ' . NEW_FLAG;
         } elseif ($item['edit_date'] >= $context['fresh']) {
             $summary .= ' ' . UPDATED_FLAG;
         }
         // 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[] = FILES_LIST_IMG . sprintf(i18n::ns('%d file', '%d files', $count), $count);
         }
         // 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);
         }
         // comments
         if ($count = Comments::count_for_anchor('article:' . $item['id'], TRUE)) {
             Skin::define_img('COMMENTS_LIST_IMG', 'comments/list.gif');
             $details[] = Skin::build_link(Comments::get_url('article:' . $item['id'], 'list'), COMMENTS_LIST_IMG . sprintf(i18n::ns('%d comment', '%d comments', $count), $count));
         }
         // combine in-line details
         if (count($details)) {
             $summary .= ' <span class="details">' . trim(implode(' ', $details)) . '</span>';
         }
         // dates
         $summary .= BR . '<span class="details">' . join(BR, Articles::build_dates($anchor, $item)) . '</span>';
         // display all tags
         if ($item['tags']) {
             $summary .= BR . '<span class="tags">' . Skin::build_tags($item['tags'], 'article:' . $item['id']) . '</span>';
         }
         // page owner
         if (isset($item['owner_id']) && ($owner = Users::get($item['owner_id']))) {
             $owner = Users::get_link($owner['full_name'], $owner['email'], $owner['id']);
         }
         // type is provided by the overlay
         if (is_object($overlay)) {
             $type = $overlay->get_value('type', '');
         }
//.........这里部分代码省略.........
开发者ID:rair,项目名称:yacs,代码行数:101,代码来源:layout_articles_as_spray.php

示例9: while

    ?>
		</div>
<?php 
}
?>
	</div>
	<div class="linkbox">
		<?php 
echo $Pages;
?>
	</div>
<?php 
if ($Count > 0) {
    $DB->set_query_id($Comments);
    while (list($AuthorID, $Page, $PageID, $Name, $PostID, $Body, $AddedTime, $EditedTime, $EditedUserID) = $DB->next_record()) {
        $Link = Comments::get_url($Page, $PageID, $PostID);
        switch ($Page) {
            case 'artist':
                $Header = " on <a href=\"artist.php?id={$PageID}\">{$Name}</a>";
                break;
            case 'collages':
                $Header = " on <a href=\"collages.php?id={$PageID}\">{$Name}</a>";
                break;
            case 'requests':
                $Header = ' on ' . Artists::display_artists($Artists[$PageID]) . " <a href=\"requests.php?action=view&id={$PageID}\">{$Name}</a>";
                break;
            case 'torrents':
                $Header = ' on ' . Artists::display_artists($Artists[$PageID]) . " <a href=\"torrents.php?id={$PageID}\">{$Name}</a>";
                break;
        }
        CommentsView::render_comment($AuthorID, $PostID, $Body, $AddedTime, $EditedUserID, $EditedTime, $Link, false, $Header, false);
开发者ID:Kufirc,项目名称:Gazelle,代码行数:31,代码来源:comments.php

示例10: layout


//.........这里部分代码省略.........
         // 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']);
         }
         // signal restricted and private sections
         if ($item['active'] == 'N') {
             $prefix .= PRIVATE_FLAG;
         } elseif ($item['active'] == 'R') {
             $prefix .= RESTRICTED_FLAG;
         }
         // this is another row of the output
         $text .= '<tr class="' . $class_title . '"><th>' . $prefix . Skin::build_link($url, $title, 'basic', i18n::s('View the section')) . $suffix . '</th></tr>' . "\n";
         // document most recent page here
         $content = $prefix = $title = $suffix = $icon = '';
         $menu = array();
         // branches of this tree
         $anchors = Sections::get_branch_at_anchor('section:' . $item['id']);
         // get last post
         $article =& Articles::get_newest_for_anchor($anchors, TRUE);
         if ($article['id']) {
             // permalink
             $url = Articles::get_permalink($article);
             // get the anchor
             $anchor = Anchors::get($article['anchor']);
             // get the related overlay, if any
             $overlay = Overlay::load($item, 'section:' . $item['id']);
             // use the title to label the link
             if (is_object($overlay)) {
                 $title = Codes::beautify_title($overlay->get_text('title', $article));
             } else {
                 $title = Codes::beautify_title($article['title']);
             }
             // signal restricted and private articles
             if ($article['active'] == 'N') {
                 $prefix .= PRIVATE_FLAG;
             } elseif ($article['active'] == 'R') {
                 $prefix .= RESTRICTED_FLAG;
             }
             // the icon to put aside
             if ($article['thumbnail_url']) {
                 $icon = $article['thumbnail_url'];
             }
             // the icon to put aside
             if (!$icon && is_callable(array($anchor, 'get_bullet_url'))) {
                 $icon = $anchor->get_bullet_url();
             }
             if ($icon) {
                 $icon = '<a href="' . $context['url_to_root'] . $url . '"><img src="' . $icon . '" class="right_image" alt="" title="' . encode_field(i18n::s('View the page')) . '" /></a>';
             }
             // the introductory text
             if ($article['introduction']) {
                 $content .= Codes::beautify_introduction($article['introduction']);
             } elseif (!is_object($overlay)) {
                 $handle = new Article();
                 $handle->load_by_content($article);
                 $content .= $handle->get_teaser('teaser');
             }
             // insert overlay data, if any
             if (is_object($overlay)) {
                 $content .= $overlay->get_text('list', $article);
             }
             // link to description, if any
             if (trim($article['description'])) {
                 $menu[] = Skin::build_link($url, i18n::s('Read more') . MORE_IMG, 'span', i18n::s('View the page'));
             }
             // info on related files
             if ($count = Files::count_for_anchor('article:' . $article['id'])) {
                 $menu[] = sprintf(i18n::ns('%d file', '%d files', $count), $count);
             }
             // info on related comments
             if ($count = Comments::count_for_anchor('article:' . $article['id'])) {
                 $menu[] = sprintf(i18n::ns('%d comment', '%d comments', $count), $count);
             }
             // discuss
             if (Comments::allow_creation($article, $anchor)) {
                 $menu[] = Skin::build_link(Comments::get_url('article:' . $article['id'], 'comment'), i18n::s('Discuss'), 'span');
             }
             // the main anchor link
             if (is_object($anchor) && (!isset($this->focus) || $article['anchor'] != $this->focus)) {
                 $menu[] = Skin::build_link($anchor->get_url(), ucfirst($anchor->get_title()), 'span', i18n::s('View the section'));
             }
             // list up to three categories by title, if any
             if ($items =& Members::list_categories_by_title_for_member('article:' . $article['id'], 0, 3, 'raw')) {
                 foreach ($items as $id => $attributes) {
                     $menu[] = Skin::build_link(Categories::get_permalink($attributes), $attributes['title'], 'span');
                 }
             }
             // append a menu
             $content .= '<p>' . Skin::finalize_list($menu, 'menu') . '</p>';
             // this is another row of the output
             $text .= '<tr class="' . $class_detail . '"><td>' . '<h3 class="top"><span>' . Skin::build_link($url, $prefix . $title . $suffix, 'basic', i18n::s('View the page')) . '</span></h3>' . '<div class="content">' . $icon . $content . '</div>' . '</td></tr>' . "\n";
         }
     }
     // end of processing
     SQL::free($result);
     $text .= Skin::table_suffix();
     return $text;
 }
开发者ID:rair,项目名称:yacs,代码行数:101,代码来源:layout_sections_as_slashdot.php

示例11: elseif

    // deletion has to be confirmed
} elseif (isset($_SERVER['REQUEST_METHOD']) && $_SERVER['REQUEST_METHOD'] == 'POST') {
    Logger::error(i18n::s('The action has not been confirmed.'));
} else {
    // commands
    $menu = array();
    $delete_label = '';
    if (is_object($overlay)) {
        $delete_label = $overlay->get_label('delete_confirmation', 'comments');
    }
    if (!$delete_label) {
        $delete_label = i18n::s('Yes, I want to delete this comment');
    }
    $menu[] = Skin::build_submit_button($delete_label, NULL, NULL, 'confirmed', $render_overlaid ? 'button submit-overlaid' : 'button');
    if (isset($item['id']) && !$render_overlaid) {
        $menu[] = Skin::build_link(Comments::get_url($item['id']), i18n::s('Cancel'), 'span');
    } elseif ($render_overlaid) {
        $menu[] = '<a href="javascript:;" onclick="Yacs.closeModalBox()">' . i18n::s('Cancel') . '</a>' . "\n";
    }
    // the submit button
    $context['text'] .= '<form method="post" action="' . $context['script_url'] . '" id="main_form">' . "\n" . Skin::finalize_list($menu, 'menu_bar') . '<input type="hidden" name="id" value="' . $item['id'] . '" />' . "\n" . '<input type="hidden" name="confirm" value="yes" />' . "\n" . (isset($_REQUEST['follow_up']) ? '<input type="hidden" name="follow_up" value="' . $_REQUEST['follow_up'] . '" />' . "\n" : '') . '</form>' . "\n";
    // set the focus
    Page::insert_script('$("#confirmed").focus();');
    // display the full comment
    $context['text'] .= '<div style="padding: 1em; background-color:#CCC;">' . Codes::beautify($item['description']) . '</div>' . "\n";
    // details
    $details = array();
    // the poster of this comment
    $details[] = sprintf(i18n::s('by %s %s'), Users::get_link($item['create_name'], $item['create_address'], $item['create_id']), Skin::build_date($item['create_date']));
    // the last edition of this comment
    if ($item['create_name'] != $item['edit_name']) {
开发者ID:rair,项目名称:yacs,代码行数:31,代码来源:delete.php

示例12: authorize

<?php

authorize();
if (!isset($_REQUEST['page']) || !in_array($_REQUEST['page'], array('artist', 'collages', 'requests', 'torrents')) || !isset($_POST['pageid']) || !is_number($_POST['pageid']) || !isset($_POST['body']) || trim($_POST['body']) === '') {
    error(0);
}
if ($LoggedUser['DisablePosting']) {
    error('Your posting privileges have been removed.');
}
$Page = $_REQUEST['page'];
$PageID = (int) $_POST['pageid'];
if (!$PageID) {
    error(404);
}
if (isset($_POST['subscribe']) && Subscriptions::has_subscribed_comments($Page, $PageID) === false) {
    Subscriptions::subscribe_comments($Page, $PageID);
}
$PostID = Comments::post($Page, $PageID, $_POST['body']);
header("Location: " . Comments::get_url($Page, $PageID, $PostID));
die;
开发者ID:Kufirc,项目名称:Gazelle,代码行数:20,代码来源:take_post.php

示例13: layout

 /**
  * list articles as a daily weblog do
  *
  * @param resource the SQL result
  * @return string the rendered text
  *
  * @see layouts/layout.php
  **/
 function layout($result)
 {
     global $context;
     // we return some text
     $text = '';
     // empty list
     if (!SQL::count($result)) {
         if (Surfer::is_associate()) {
             $text .= '<p>' . sprintf(i18n::s('Use the %s to populate this server.'), Skin::build_link('help/populate.php', i18n::s('Content Assistant'), 'shortcut')) . '</p>';
         }
         return $text;
     }
     // 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)) {
         // three components per box
         $box = array();
         $box['date'] = '';
         $box['title'] = '';
         $box['content'] = '';
         // get the related overlay, if any
         $overlay = Overlay::load($item, 'article:' . $item['id']);
         // get the anchor
         $anchor = Anchors::get($item['anchor']);
         // permalink
         $url = Articles::get_permalink($item);
         // make a live title
         if (is_object($overlay)) {
             $box['title'] .= Codes::beautify_title($overlay->get_text('title', $item));
         } else {
             $box['title'] .= Codes::beautify_title($item['title']);
         }
         // make a clickable title
         $box['title'] = Skin::build_link($url, $box['title'], 'basic');
         // signal restricted and private articles
         if ($item['active'] == 'N') {
             $box['title'] = PRIVATE_FLAG . $box['title'];
         } elseif ($item['active'] == 'R') {
             $box['title'] = RESTRICTED_FLAG . $box['title'];
         }
         // flag articles updated recently
         if ($item['expiry_date'] > NULL_DATE && $item['expiry_date'] <= $context['now']) {
             $box['title'] .= EXPIRED_FLAG;
         } elseif ($item['create_date'] >= $context['fresh']) {
             $box['title'] .= NEW_FLAG;
         } elseif ($item['edit_date'] >= $context['fresh']) {
             $box['title'] .= UPDATED_FLAG;
         }
         // what's the date of publication?
         if (isset($item['publish_date']) && $item['publish_date'] > NULL_DATE) {
             $box['date'] .= Skin::build_date($item['publish_date'], 'publishing');
         }
         // the icon to put aside - never use anchor images
         if ($item['icon_url']) {
             $box['content'] .= '<a href="' . $context['url_to_root'] . $url . '"><img src="' . $item['icon_url'] . '" class="left_image" alt="" /></a>';
         }
         // details
         $details = array();
         // rating
         if ($item['rating_count'] && !(is_object($anchor) && $anchor->has_option('without_rating'))) {
             $details[] = Skin::build_link(Articles::get_url($item['id'], 'like'), Skin::build_rating_img((int) round($item['rating_sum'] / $item['rating_count'])), 'basic');
         }
         // show details
         if (count($details)) {
             $box['content'] .= '<p class="details">' . implode(' ~ ', $details) . '</p>' . "\n";
         }
         // list categories by title, if any
         if ($items = Members::list_categories_by_title_for_member('article:' . $item['id'], 0, 7, 'raw')) {
             $tags = array();
             foreach ($items as $id => $attributes) {
                 // add background color to distinguish this category against others
                 if (isset($attributes['background_color']) && $attributes['background_color']) {
                     $attributes['title'] = '<span style="background-color: ' . $attributes['background_color'] . '; padding: 0 3px 0 3px;">' . $attributes['title'] . '</span>';
                 }
                 $tags[] = Skin::build_link(Categories::get_permalink($attributes), $attributes['title'], 'basic');
             }
             $box['content'] .= '<p class="tags">' . implode(' ', $tags) . '</p>';
         }
         // the introduction text, if any
         if (is_object($overlay)) {
             $box['content'] .= Skin::build_block($overlay->get_text('introduction', $item), 'introduction');
         } else {
             $box['content'] .= Skin::build_block($item['introduction'], 'introduction');
         }
         // insert overlay data, if any
         if (is_object($overlay)) {
             $box['content'] .= $overlay->get_text('list', $item);
         }
         // the description
         $box['content'] .= Skin::build_block($item['description'], 'description', '', $item['options']);
         // a compact list of attached files
//.........这里部分代码省略.........
开发者ID:rair,项目名称:yacs,代码行数:101,代码来源:layout_home_articles_as_daily.php

示例14: function

                Skin::define_img('FILES_UPLOAD_IMG', 'files/upload.gif');
                $menu[] = '<a href="#" onclick="$(\'#comment_upload\').slideDown(600);$(\'body\').delegate(\'#upload\', \'change\', function(event){if(/\\.zip$/i.test($(\'#upload\').val())){$(\'#upload_option\').slideDown();}else{$(\'#upload_option\').slideUp();}});return false;"><span>' . FILES_UPLOAD_IMG . i18n::s('Add a file') . '</span></a>';
            }
            // the submit button
            $menu[] = Skin::build_submit_button(i18n::s('Submit'), i18n::s('Press [s] to submit data'), 's', 'submit');
            // go to smileys
            //		$menu[] = Skin::build_link('smileys/', i18n::s('Smileys'), 'open');
            // display all commands
            $context['text'] .= Skin::finalize_list($menu, 'menu_bar');
            // end the form
            $context['text'] .= '</form>' . "\n";
        }
        // end of the wrapper
        $context['text'] .= '</div>' . "\n";
        // the AJAX part
        $js_script = 'var Comments = {' . "\n" . "\n" . '	url: "' . $context['url_to_home'] . $context['url_to_root'] . Comments::get_url($item['id'], 'thread') . '",' . "\n" . '	timestamp: 0,' . "\n" . "\n" . '	initialize: function() { },' . "\n" . "\n" . '	contribute: function() {' . "\n" . '		Yacs.startWorking();' . "\n" . '		$("#upload_frame").load(Comments.contributed);' . "\n" . '		return true;' . "\n" . '	},' . "\n" . "\n" . '	contributed: function() {' . "\n" . '		$("#upload_frame").unbind("load");' . "\n" . '		$("#comment_upload").slideUp(600);' . "\n" . '		$("#upload_option").slideUp();' . "\n" . '		$("#upload").replaceWith(\'<input type="file" id="upload" name="upload" size="30" />\');' . "\n" . '		$("#description").val("").trigger("change").focus();' . "\n" . '		setTimeout(function() {Comments.subscribe(); Yacs.stopWorking();}, 500);' . "\n" . '		if((typeof OpenTok == "object") && OpenTok.session)' . "\n" . '			OpenTok.signal();' . "\n" . '	},' . "\n" . "\n" . '	keypress: function(event) {' . "\n" . '		if(event.which == 13) {' . "\n" . '			$("#submit").trigger("click");' . "\n" . '			return false;' . "\n" . '		}' . "\n" . '	},' . "\n" . "\n" . '	showMore: function() {' . "\n" . '		var options = {};' . "\n" . '		var newHeight = $("#thread_text_panel").clientHeight + 200;' . "\n" . '		options.height =  newHeight + "px";' . "\n" . '		options.maxHeight =  newHeight + "px";' . "\n" . '		$("#thread_text_panel").css(options);' . "\n" . '	},' . "\n" . "\n" . '	subscribe: function() {' . "\n" . '		$.ajax(Comments.url, {' . "\n" . '			type: "get",' . "\n" . '			dataType: "json",' . "\n" . '			data: { "timestamp" : Comments.timestamp },' . "\n" . '			success: Comments.updateOnSuccess' . "\n" . '		});' . "\n" . "\n" . '	},' . "\n" . "\n" . '	subscribeToExtraUpdates: function() {' . "\n" . '		$.ajax("' . $context['url_to_home'] . $context['url_to_root'] . Users::get_url($item['id'], 'visit') . '", {' . "\n" . '			type: "get",' . "\n" . '			dataType: "html",' . "\n" . '			success: function(data) { $("#thread_roster_panel").html(data); }' . "\n" . '		});' . "\n" . "\n" . '		$.ajax("' . $context['url_to_home'] . $context['url_to_root'] . Files::get_url($item['id'], 'thread') . '", {' . "\n" . '			type: "get",' . "\n" . '			dataType: "html",' . "\n" . '			success: function(data) { $("#thread_files_panel").html(data); }' . "\n" . '		});' . "\n" . "\n" . '	},' . "\n" . "\n" . '	updateOnSuccess: function(response) {' . "\n" . '		if(!response) return;' . "\n" . '		if(response["status"] != "started")' . "\n" . '			window.location.reload(true);' . "\n" . '		$("#thread_text_panel").html("<div>" + response["items"] + "</div>");' . "\n" . '		var div = $("#thread_text_panel")[0];' . "\n" . '		var scrollHeight = Math.max(div.scrollHeight, div.clientHeight);' . "\n" . '		div.scrollTop = scrollHeight - div.clientHeight;' . "\n" . '		if(typeof Comments.windowOriginalTitle != "string")' . "\n" . '			Comments.windowOriginalTitle = document.title;' . "\n" . '		document.title = "[" + response["name"] + "] " + Comments.windowOriginalTitle;' . "\n" . '		Comments.timestamp = response["timestamp"];' . "\n" . '	}' . "\n" . "\n" . '}' . "\n" . "\n" . '// wait for new comments and for other updates' . "\n" . 'Comments.subscribeTimer = setInterval("Comments.subscribe()", 5000);' . "\n" . 'Comments.subscribeTimer = setInterval("Comments.subscribeToExtraUpdates()", 59999);' . "\n" . "\n" . '// load past contributions asynchronously' . "\n" . '$(function() {' . 'Comments.subscribe();' . 'location.hash="#thread_text_panel";' . '$("#description").tipsy({gravity: "s", fade: true, title: function () {return "' . i18n::s('Contribute here') . '";}, trigger: "manual"});' . '$("#description").tipsy("show");' . 'setTimeout("$(\'#description\').tipsy(\'hide\');", 10000);' . '$("textarea#description").autogrow();' . '});' . "\n";
        // only authenticated surfers can contribute
        if (Surfer::is_logged() && Comments::allow_creation($item, $anchor)) {
            $js_script .= '$(function() {' . '$("#description").focus();' . '});' . "\n" . '$(\'#description\').keypress( Comments.keypress );' . "\n";
        }
        break;
        Page::insert_script($js_script);
    case 'excluded':
        // surfer is not
        $context['text'] .= Skin::build_block(i18n::s('You have not been enrolled into this interactive chat.'), 'caution');
        break;
}
//
// trailer information
//
// add trailer information from the overlay, if any --opentok videos come from here
开发者ID:rair,项目名称:yacs,代码行数:31,代码来源:view_as_chat.php

示例15: elseif

         $box['text'] .= Skin::build_list($items, 'rows');
     } elseif (is_string($items)) {
         $box['text'] .= $items;
     }
 }
 // the command to post a new comment, if this is allowed
 if (Comments::allow_creation($anchor)) {
     Skin::define_img('COMMENTS_ADD_IMG', 'comments/add.gif');
     $label = '';
     if (is_object($anchor->overlay)) {
         $label = $anchor->overlay->get_label('new_command', 'comments');
     }
     if (!$label) {
         $label = i18n::s('Add a comment');
     }
     $box['bar'] = array_merge($box['bar'], array(Comments::get_url($anchor->get_reference(), 'comment') => COMMENTS_ADD_IMG . $label));
 }
 // show commands
 if (@count($box['bar'])) {
     // append the menu bar at the end
     if (strlen($box['text']) > 10 && $count) {
         $box['text'] .= Skin::build_list($box['bar'], 'menu_bar');
     }
     // shortcut to last comment in page
     if (is_object($layout) && $count > 3) {
         $box['bar'] += array('#last_comment' => i18n::s('Page bottom'));
         $box['text'] .= '<span id="last_comment" />';
     }
     // insert the menu bar at the beginning
     $box['text'] = Skin::build_list($box['bar'], 'menu_bar') . $box['text'];
 }
开发者ID:rair,项目名称:yacs,代码行数:31,代码来源:list.php


注:本文中的Comments::get_url方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。