=====Source: show.php===== last updated: 5 Aug 2007 author: KlenWell note: the code has not yet been tested (I need to upgrade to the latest version before I'll be able to test it) %%(php) GetUserName(); $is_owner = $obj->UserIsOwner(); $prev_level = null; $threaded = 0; if ($_SESSION['show_comments'][$tag] == COMMENT_ORDER_THREADED) { $threaded = 1; } ?>
tags to effect nesting if (isset($prev_level) && ($comment['level'] <= $prev_level)) { for ($i=0; $i<$prev_level-$comment['level']+1; ++$i) { echo '
'."\n"; } } # Alternate light/dark comment styles per level $comment_class = ''; if ($comment['level'] % 2 == 1) { $comment_class = "comment-layout-1"; } else { $comment_class = "comment-layout-2"; } if ($comment['status'] == 'deleted') { ?>
FormatUser($comment['user']); //$comment_author = $obj->LoadUser($comment['user'])? $obj->Format($comment['user']) : $comment['user']; $comment_ts = sprintf(COMMENT_TIME_CAPTION,$comment['time']); ?>
HasAccess('comment_post')) { echo '
'; echo $obj->FormOpen("processcomment"); ?> GetUser(); if (isset($user)) { $name = $user['name']; } if ($is_owner || $name == $comment['user'] || ($obj->config['anony_delete_own_comments'] && $current_user == $comment['user'])) { ?> FormClose(); echo "
"; } } $prev_level = $comment['level']; } for ($i=0; $i<$prev_level+1; ++$i) { print '
'."\n"; } ?>
HasAccess('read')) { $_SHOW['no_access'] = 1; } // Page Exists if ( !$this->page ) { $_SHOW['not_exists'] = 1; } else { $_SHOW['page_body'] = 1; } // As Revision if ($this->page['latest'] == 'N') { $_SHOW['revision_info'] = 1; } // Revision w/ write access if ( ($this->page['latest'] == 'N' && $this->HasAccess('write')) && ($latest = $this->LoadPage($this->tag)) ) { $_SHOW['revision_edit_form'] = 1; } // Show Comment Form if ( $this->GetConfigValue('hide_comments') != 1 ) { // get page tag $tag = $this->GetPageTag(); // session settings? if ( !isset($_SESSION['show_comments'][$tag]) && $this->UserWantsComments($tag) !== FALSE ) { $_SESSION['show_comments'][$tag] = $this->UserWantsComments($tag); } // GET setting takes precedence if ( isset($_GET['show_comments']) ) #312 { switch($_GET['show_comments']) { case COMMENT_NO_DISPLAY: $_SESSION['show_comments'][$tag] = COMMENT_NO_DISPLAY; break; case COMMENT_ORDER_DATE_ASC: $_SESSION['show_comments'][$tag] = COMMENT_ORDER_DATE_ASC; break; case COMMENT_ORDER_DATE_DESC: $_SESSION['show_comments'][$tag] = COMMENT_ORDER_DATE_DESC; break; case COMMENT_ORDER_THREADED: $_SESSION['show_comments'][$tag] = COMMENT_ORDER_THREADED; break; } } if ( isset($_SESSION['show_comments'][$tag]) && ($_SESSION['show_comments'][$tag] != COMMENT_NO_DISPLAY) ) { $_SHOW['comment_form'] = 1; } else { $_SHOW['hidden_comments'] = 1; } } // Show Comments? $comments = $this->LoadComments($this->tag); if ( $_SESSION['show_comments'][$tag] && $comments ) { $_SHOW['comments'] = 1; } // Comment Post? if ( $this->HasAccess('comment_post') ) { $_SHOW['comment_post'] = 1; } // *** Viewer Blocks // Page Start if ( $_SHOW['page_start'] ) { $_js = ( ($user = $this->GetUser()) && ($user['doubleclickedit'] == 'N') || !$this->HasAccess('write') ) ? '' : 'ondblclick="document.location=\''.$this->Href('edit').'\';" '; $_HTML['page_start'] = <<
HTML; } // Generic if ( $_SHOW['no_access'] ) { $inner = '

'.WIKKA_ERROR_ACL_READ.'

'; $_HTML['no_access'] = << HTML; } // Page does not exist yet if ( $_SHOW['not_exists'] ) { $createlink = ''.WIKKA_PAGE_CREATE_LINK_DESC.''; $inner = '

'.sprintf(SHOW_ASK_CREATE_PAGE_CAPTION,$createlink).'

'; $_HTML['not_exists'] = << HTML; } // Revision Info if ( $_SHOW['revision_info'] ) { $pagelink = ''.$this->tag.''; $inner = '
'.sprintf(SHOW_OLD_REVISION_CAPTION,$pagelink,$this->Link($this->tag, 'revisions', $this->page['time'])); $_HTML['revision_info'] = << HTML; } // Page Body if ( $_SHOW['page_body'] ) { $_HTML['page_body'] = $this->Format($this->page['body'], 'wakka', 'page'); $_HTML['page_close_div'] = "\n".'
'."\n\n"; } // Revision Edit Form if ( $_SHOW['revision_edit_form'] ) { $form_start = $this->FormOpen('edit'); $lid = $latest['id']; $hvalue = $this->htmlspecialchars_ent($this->page['body']); $svalue = SHOW_RE_EDIT_BUTTON; $form_close = $this->FormClose(); $_HTML['revision_edit_form'] = << $form_start $form_close HTML; } // Comments Header and Form if ( $_SHOW['comment_form'] ) { $href = $this->Href('', '', 'show_comments=0'); $_HTML['comments_header'] = <<  Comments [Hide comments/form]
HTML; $form_start = $this->FormOpen('addcomment'); $form_close = $this->FormClose(); $_HTML['comment_form'] = << $form_start $form_close HTML; } // comments themselves if ( $_SHOW['comments'] ) { $comment_stack = ''; $current_user = $this->GetUserName(); $display_mode = $_SESSION['show_comments'][$tag]; // icons $sort_desc_icon_url = StaticHref('images/icons/sort_desc.gif'); $sort_ascc_icon_url = StaticHref('images/icons/sort_asc.gif'); $sort_comment_icon_url = StaticHref('images/icons/comment.gif'); // comments header $inner = 'flat'; $inner .= 'flat'; $inner .= 'threaded'; $inner2 = COMMENTS_CAPTION; $inner3 = '[' . HIDE_COMMENTS_LINK_DESC . ']'; // comment post if ( $_SHOW['comment_post'] ) { $form1 = $this->FormOpen('processcomment'); $svalue = COMMENT_NEW_BUTTON; $form2 = $this->FormClose(); $_HTML['comment_post'] = << $form2 HTML; } $_HTML['comments_header'] = <<
$inner
$inner2 $inner3 {$_HTML['comment_post']}
HTML; // a very ugly hack if ( $comments ) { ob_start(); displayComments($this, $comments, $tag); $_HTML['comments'] = ob_get_flush(); #echo "
{$_HTML['comments']}
"; # debug } } // hidden comments if ( $_SHOW['hidden_comments'] ) { $showcomments_text = ''; $commentCount = $this->CountComments($this->tag); switch ( $commentCount ) { case 0: $comments_message = STATUS_NO_COMMENTS.' '; if ($this->HasAccess('comment_post')) { $showcomments_text = $this->FormOpen("processcomment"); $showcomments_text .= ''; $showcomments_text .= $this->FormClose(); } break; case 1: $comments_message = STATUS_ONE_COMMENT.' '; $showcomments_text = '['.DISPLAY_COMMENT_LINK_DESC.']'; break; default: $comments_message = sprintf(STATUS_SOME_COMMENTS, $commentCount).' '; $comment_ordering = NULL; if (isset($user['default_comment_display'])) { $comment_ordering = $user['default_comment_display']; } elseif (NULL !== $this->GetConfigValue('default_comment_display')) { $comment_ordering = $this->GetConfigValue('default_comment_display'); } else { $comment_ordering = COMMENT_ORDER_DATE_ASC; } $showcomments_text = '['.DISPLAY_COMMENTS_LABEL.']'; } $_HTML['hidden_comments'] = <<
$comments_message $showcomments_text
HTML; } // Page Close if ( $_SHOW['page_close'] ) { $_HTML['page_close'] = << HTML; } // End Viewer Blocks // *** TEMPLATE: stitch it all together require_once('show.tpl.php'); echo $_HTML['page']; ?> %% ===source: show.tpl.php=== %%(php) {$_HTML['comments_header']} {$_HTML['comments']} {$_HTML['comment_form']} {$_HTML['hidden_comments']} {$_HTML['page_close_div']} {$_HTML['page_close']} HTML; ?> %%