コード例 #1
0
function makedownloadbar($o)
{
    global $site, $section, $page, $uploaddir, $uploadurl;
    if ($o->getField("type") != 'file') {
        return;
    }
    $b = db_get_line("media INNER JOIN slot ON media.FK_site=slot.FK_site", "media_id='" . addslashes($o->getField("longertext")) . "'");
    ob_start();
    print "\n";
    print "\n<div class='downloadbar' style='margin-bottom: 10px'>";
    //	print "\n\t<table width='100%' cellpadding='0' cellspacing='0'>\n\t<tr>\n\t\t<td>";
    if ($o->getField("title")) {
        print "\n<div style='float: left; '><strong><a href='index.php?{$sid}&amp;action=site&amp;site={$site}&amp;section={$section}&amp;page={$page}&amp;story=" . $o->id . "&amp;detail=" . $o->id . "'>";
        print "" . spchars($o->getField("title")) . "</a></strong>\n\t\t\t</div>";
    }
    print printDownloadLink($b);
    print printMediaPlayer($b);
    print "\n\t\t\t\t\t<div style='clear: left; font-size: smaller; margin-bottom: 10px; '>";
    print printCitation($b);
    print "\n\t\t\t\t\t</div>";
    if ($o->getField("shorttext")) {
        print "" . stripslashes($o->getField("shorttext"));
    }
    print "\n\t<div style='clear: both;'> </div>";
    print "</div>\n";
    return ob_get_clean();
}
コード例 #2
0
 function _output($cr, $o)
 {
     global $sid, $error, $showallauthors, $showposts, $uploadurl, $site_owner, $_full_uri;
     $siteOwnerId = db_get_value("user", "user_id", "user_uname='" . addslashes($site_owner) . "'");
     $parentAuthorId = db_get_value("discussion", "FK_author", "discussion_id='" . addslashes($this->parentid) . "'");
     //print $siteOwnerId;
     //printc("author=".$parentAuthorId);
     $siteObj =& $this->storyObj->owningSiteObj;
     $siteLevelEditors = $siteObj->getSiteLevelEditors();
     $isSiteEditor = in_array($_SESSION[auser], $siteLevelEditors);
     if ($showposts == 1 || ($_SESSION[auser] == $this->authoruname || $o == 1 || $isSiteEditor || $site_owner == $this->authoruname && $_SESSION[aid] == $parentAuthorId && $_SESSION[auser] || in_array($this->authoruname, $siteLevelEditors) && $_SESSION[aid] == $parentAuthorId && $_SESSION[auser])) {
         // check to see if we have any info to commit
         $this->_commithttpdata();
         if ($_REQUEST['discuss'] == 'edit' && $_REQUEST['id'] == $this->id) {
             $this->_outputform('edit');
             return true;
         }
         if ($_REQUEST['discuss'] == 'del' && $_REQUEST['id'] == $this->id) {
             $this->_del();
             return true;
         }
         if ($_REQUEST['discuss'] == 'rate' && $_REQUEST['id'] == $this->id) {
             $this->_outputform('rate');
             return true;
         }
         //$script = $_SERVER['SCRIPT_NAME'];
         /******************************************************************************
          * 	Outputs html for displaying posts
          * outputs discussion post info
          ******************************************************************************/
         if (!$this->id) {
             return false;
         }
         printc("\n<tr>");
         $s = "<a href='" . $_full_uri . "/index.php?{$sid}&amp;action=site&amp;" . $this->getinfo . "&amp;expand=" . $this->id . "' name='" . $this->id . "'>" . $this->subject . "</a>\n";
         //	printc ("</form>");
         //		$s = $this->subject;
         //printpre($_SESSION);
         $a = "";
         if ($showallauthors == 1 || $_SESSION[auser] && ($o || $_SESSION[auser] == $this->authoruname || $site_owner == $this->authoruname && $_SESSION[aid] == $parentAuthorId)) {
             if ($this->opt("showauthor")) {
                 $a .= "by <span class='subject'>" . $this->authorfname . "</span>\n";
             }
             if ($this->opt("showauthor") && $this->opt("showtstamp")) {
                 $a .= " on ";
             }
         } else {
             $a .= "posted on ";
         }
         if ($this->opt("showtstamp")) {
             $a .= timestamp2usdate($this->tstamp);
         }
         // Wiki-markup example
         global $storyObj;
         $a .= WikiResolver::getMarkupExample($storyObj->getField("title"), $this->id);
         /******************************************************************************
          * 	 collect possible actions to current post (rely | del | edit | rate)
          ******************************************************************************/
         $b = array();
         if ($cfg['disable_discussion'] != TRUE && ($cfg['disable_discussion'] != TRUE && $_SESSION['ltype'] == 'admin')) {
             if ($cr) {
                 $b[] = "<a href='" . $_full_uri . "/index.php?{$sid}" . $this->getinfo . "&amp;replyto=" . $this->id . "&amp;action=site&amp;discuss=reply#reply'>reply</a>\n";
             }
             if ($o || $_SESSION[auser] == $this->authoruname && !$this->dbcount()) {
                 $b[] = "| <a href='" . $_full_uri . "/index.php?{$sid}" . $this->getinfo . "&amp;action=site&amp;discuss=del&amp;id=" . $this->id . "'>delete</a>\n";
             }
             if ($_SESSION[auser] == $this->authoruname && !$this->dbcount()) {
                 $b[] = " | <a href='" . $_full_uri . "/index.php?{$sid}" . $this->getinfo . "&amp;id=" . $this->id . "&amp;action=site&amp;discuss=edit#" . $this->id . "'>edit</a>\n";
             }
             if ($o) {
                 $ratelink = "<a href='" . $_full_uri . "/index.php?{$sid}" . $this->getinfo . "&amp;id=" . $this->id . "&amp;action=site&amp;discuss=rate#" . $this->id . "'>rate</a>\n";
             }
         }
         /******************************************************************************
          * if there are dicussion actions (reply | del | edit | rate) then print 
          ******************************************************************************/
         if ($a != "" || count($b)) {
             $c = '';
             if (count($b)) {
                 $c .= implode(" ", $b);
             }
             /******************************************************************************
              * discussion post header info (subject=$s, author and timestamp=$a, options=$c)
              ******************************************************************************/
             //printc ("<table width='100%' cellspacing='0px'>\n");
             printc("\n<td class='dheader3'>\n");
             printc("<table width='100%' cellspacing='0px'>\n");
             printc("<tr><td align='left'>\n");
             printc("<span class='subject'>\n");
             // subject
             printc($s);
             // rating
             if ($this->rating !== NULL) {
                 printc(" (Rating: " . $this->rating . ")");
             }
             printc("</span></td>\n");
             // link for rating
             printc("<td align='right'>{$ratelink}</td>\n");
             printc("</tr><tr>\n");
             printc("<td>{$a}\n");
             printc("</td>\n");
             printc("<td align='right' valign='bottom'>{$c}</td>");
             printc("</tr>\n</table>\n");
             /******************************************************************************
              * if there are no dicussion actions (rely | del | edit | rate) then 
              * print subject only
              ******************************************************************************/
         } else {
             printc($s);
         }
         printc("</td></tr>");
         /******************************************************************************
          * 	print discussion post content
          ******************************************************************************/
         if ($this->opt("showcontent")) {
             printc("<tr><td class='dtext'>");
             if ($this->media_tag) {
                 $media_link = "<a href='" . $uploadurl . "/" . $_REQUEST[site] . "/" . $this->media_tag . "' target='media'>" . $this->media_tag . "</a>\n";
                 $mediaRow[media_tag] = $this->media_tag;
                 $mediaRow[slot_name] = $_REQUEST[site];
                 $mediaRow[media_size] = $this->media_size;
                 $audioplayer = printMediaPlayer($mediaRow);
                 $downloadlink = printDownloadLink($mediaRow);
                 //					$citation = printCitation($mediaRow);
                 // if attached file is an .mp3 print out audio player
                 if ($audioplayer) {
                     printc("<table width='100%' cellpadding='2' border='0'>");
                     printc("<tr><td>");
                     printc($downloadlink . "\n");
                     printc($audioplayer . "\n");
                     //						printc ("<div style='clear: left; font-size: smaller; margin-bottom: 10px; '>");
                     //						printc ($citation."\n");
                     //						printc ("</div>");
                     printc("</td></tr>");
                     printc("</table>");
                     // if attached file not .mp3 print out download link only
                 } else {
                     printc("<table width='100%' cellpadding='2' border='0'>");
                     printc("<tr><td>");
                     printc("<div style='clear: left; float: left; '>{$media_link}</div>\n");
                     printc($downloadlink . "\n");
                     printc("</td></tr>");
                     printc("</table>");
                 }
             }
             $content = convertTagsToInteralLinks($_REQUEST[site], stripslashes($this->content));
             $wikiResolver =& WikiResolver::instance();
             $content = $wikiResolver->parseText($content, $_REQUEST[site], $_REQUEST[section], $_REQUEST[page]);
             printc("<div style='clear: both;'>\n");
             printc($content);
             printc("</div>\n");
             //printc ("- [ $c]</td></tr>\n");
             //printc ("<tr><td align='right'>$c</td></tr>\n");
         }
         // done
         // now check if we're replying to this post
         if ($_REQUEST['discuss'] == 'reply' && $_REQUEST['replyto'] == $this->id) {
             $this->_outputform('reply');
         }
         //if ($_REQUEST['discuss'] == 'rate' && $_REQUEST['replyto'] == $this->id) $this->_outputform('rate');
         printc("</td></tr>");
     }
 }