コード例 #1
0
ファイル: p_updates.php プロジェクト: brocococonut/yGallery
				<?php 
}
include_once INCLUDES . "comments.php";
?>
			<div class="notsowide">
				<?php 
reset($updComments);
foreach ($updComments as $key => $data) {
    $id = "id_cmt" . $key;
    $allIds[] = $id;
    $result = sql_query("SELECT * FROM `comments` " . "WHERE `comid` = '" . $data["updObj"] . "' LIMIT 1");
    if (!($comData = mysql_fetch_assoc($result))) {
        continue;
    }
    // The comment no longer exists
    getCommentParent($comData, $parentURL, $parentType, $title, true);
    switch ($comData["comRootObjType"]) {
        case "obj":
            $icon = "submission.png";
            break;
        case "ext":
            $icon = "star4.png";
            break;
        case "com":
            $icon = "comment.png";
            break;
        case "clu":
            $icon = "club2.png";
            break;
        case "jou":
            $icon = "journal.png";
コード例 #2
0
ファイル: comments.php プロジェクト: brocococonut/yGallery
function showComment($comData, $level, $showParent = false, $markAsReadId = '', $commentCountId = '', $markAsReadId2 = '')
{
    global $_config, $_signatureCache, $_auth, $_cmd, $_currentPageURL;
    // _HACKFIX - facsimilnym 2011-09-05
    // Workaround for the "blank" useDateFormat that ~140,000 users have.
    // Setting it up here, since there's like 5 code paths.
    if (!isset($_auth["useDateFormat"]) || $_auth["useDateFormat"] == "") {
        $_auth["useDateFormat"] = "Y-m-d \\@ g:i A";
    }
    if (isset($comData["pmsid"])) {
        $comData["comid"] = $comData["pmsid"];
        $comData["comCreator"] = $comData["pmsCreator"];
        $comData["comNoEmoticons"] = $comData["pmsNoEmoticons"];
        $comData["comNoSig"] = $comData["pmsNoSig"];
        $comData["comNoBBCode"] = $comData["pmsNoBBCode"];
        $comData["comSubject"] = $comData["pmsTitle"];
        $comData["comSubjectDateHide"] = true;
        $comData["comComment"] = $comData["pmsComment"];
        $comData["comObj"] = $comData["pmsObj"];
        $comData["comObjType"] = "pms";
        $comData["comSubmitDate"] = $comData["pmsSubmitDate"];
        $comData["comSubmitIp"] = $comData["pmsSubmitIp"];
        $comData["comLastEdit"] = $comData["pmsLastEdit"];
        $comData["comEditIp"] = $comData["pmsEditIp"];
        $comData["comTotalEdits"] = $comData["pmsTotalEdits"];
        $comData["comPmUser"] = $comData["pmsPmUser"];
    }
    if (isTwit($comData["comCreator"])) {
        return;
    }
    if (!isLoggedIn()) {
        $result = sql_query("SELECT `useGuestAccess` FROM `useExtData`" . dbWhere(array("useEid" => $comData["comCreator"])));
        if (!mysql_result($result, 0)) {
            return;
        }
    }
    $commentID = "yg-cmt" . $comData["comid"];
    $instantReplyOuterId = $commentID . "InstantReplyOuter";
    $instantReplyId = $commentID . "InstantReplyId";
    if (!isset($comData["comNoEmoticons"])) {
        $comData["comNoEmoticons"] = false;
    }
    if (!isset($comData["comNoSig"])) {
        $comData["comNoSig"] = false;
    }
    if (!isset($comData["comNoBBCode"])) {
        $comData["comNoBBCode"] = false;
    }
    if (isset($comData["pmsid"])) {
        if ($comData["comCreator"] != $_auth["useid"] && $comData["comPmUser"] != $_auth["useid"]) {
            echo '<div class="container2">' . _PM_NO_ACCESS . '</div>';
            return;
        }
    }
    $levellim = $level < 8 ? $level : 8;
    for ($i = 0; $i <= $levellim; $i++) {
        ?>
		<div class="<?php 
        echo $i == $levellim ? "pad_top" : "";
        echo $level > 0 && $i < $levellim ? "cmt_border_left" : "";
        ?>
">
		<?php 
    }
    //	if($_cmd[0] != "comment")
    echo '<a name="comment' . $comData["comid"] . '"></a>';
    //	echo '<div'.($markAsReadId != "" ? ' id="'.$markAsReadId.'"' : "" ).'>'; // Comment outer
    //	echo '<div'.($markAsReadId != "" ? ' id="'.$markAsReadId.'_"' : "" ).' class="container2">'; // Comment body
    echo '<div class="container2">';
    // Comment body
    iefixStart();
    // display parent comment
    if ($showParent && isset($comData["comObjType"]) && $comData["comObjType"] == "com") {
        $result = sql_query("SELECT * FROM `comments` WHERE `comid` = '" . $comData["comObj"] . "' LIMIT 1");
        if ($parData = mysql_fetch_assoc($result)) {
            ?>
			<div class="caption reminder_cap">
				<?php 
            echo sprintf(_WROTE, getUserLink($parData["comCreator"]));
            ?>
:
			</div>
			<div class="reminder">
				<?php 
            echo formatText($parData["comComment"], $parData["comNoEmoticons"], $parData["comNoBBCode"]);
            ?>
			</div>
			<?php 
        }
    } elseif ($showParent && isset($comData["pmsid"])) {
        $result = sql_query("SELECT * FROM `pms` WHERE `pmsid` = '" . $comData["comObj"] . "' LIMIT 1");
        if ($parData = mysql_fetch_assoc($result)) {
            if ($parData["pmsCreator"] == $_auth["useid"] || $parData["pmsPmUser"] == $_auth["useid"]) {
                ?>
				<div class="caption reminder_cap">
					<?php 
                echo sprintf(_WROTE, getUserLink($parData["pmsCreator"]));
                ?>
:
				</div>
				<div class="reminder">
					<?php 
                echo formatText($parData["pmsComment"], $parData["pmsNoEmoticons"], $parData["pmsNoBBCode"]);
                ?>
				</div>
				<?php 
            }
        }
    }
    if ($comData["comCreator"] != 0) {
        ?>
		<div class="f_right mar_left a_center" style="position: relative; top: -3px; left: 3px">
			<?php 
        echo getUserAvatar("", $comData["comCreator"], true);
        ?>
		</div>
		<?php 
    }
    if (isset($comData["comSubject"])) {
        if (!isset($comData["comSubjectDateHide"])) {
            ?>
<div class="smalltext mar_bottom"><?php 
            // Show IPs to moderators+ (as an acronym).
            if (atLeastModerator() && isset($comData["comSubmitIp"]) && isset($comData["comEditIp"])) {
                ?>
				<acronym style="cursor: help" title="Submitted from <?php 
                echo getDotDecIp($comData["comSubmitIp"]);
                ?>
, last edited from <?php 
                echo getDotDecIp($comData["comEditIp"]);
                ?>
">
				<?php 
            }
            printf(_COMMENT_POSTED_ON, gmdate($_auth["useDateFormat"], applyTimezone(strtotime($comData["comSubmitDate"]))));
            // Close the acronym opened above.
            if (atLeastModerator() && isset($comData["comSubmitIp"]) && isset($comData["comEditIp"])) {
                ?>
				</acronym>
				<?php 
            }
            ?>
</div><?php 
        }
        ?>
		<div class="largetext mar_bottom"><b><?php 
        echo formatText($comData["comSubject"], false, true);
        ?>
</b></div>
		<?php 
    }
    ?>
	<div class="commentData">
		<?php 
    $allowImages = isset($comData["comAllowImages"]) && $comData["comAllowImages"];
    echo formatText($comData["comComment"], $comData["comNoEmoticons"], $comData["comNoBBCode"], $allowImages);
    ?>
	</div>
	<?php 
    if (!$comData["comNoSig"] && $_cmd[0] != "updates") {
        if (!isset($_signatureCache[$comData["comCreator"]])) {
            $result = sql_query("SELECT `useSignature` FROM `useExtData` WHERE `useEid` = '" . $comData["comCreator"] . "' LIMIT 1");
            if (mysql_num_rows($result)) {
                $_signatureCache[$comData["comCreator"]] = mysql_result($result, 0);
            } else {
                $_signatureCache[$comData["comCreator"]] = "";
            }
        }
        if ($_signatureCache[$comData["comCreator"]] != "") {
            ?>
			<div class="hline" style="margin-right: 60px;">&nbsp;</div>
			<div class="smalltext">
			<?php 
            echo formatText($_signatureCache[$comData["comCreator"]]);
            ?>
			</div>
			<?php 
        }
    }
    ?>
	<div class="clear">&nbsp;</div>
	<?php 
    if (isset($comData["newid"])) {
        // News page.
        $result = sql_query("SELECT COUNT(*) FROM `comments` " . "WHERE `comObjType` = 'new' AND `comObj` = '" . $comData["newid"] . "'");
        $newsCount = mysql_result($result, 0);
        $newsURL = url("news/" . $comData["newid"]);
        ?>
		<div class="sep">
			<a href="<?php 
        echo $newsURL;
        ?>
">
			<span class="button smalltext" style="float: right"
				onclick="document.location='<?php 
        echo $newsURL;
        ?>
';"><?php 
        echo _COMMENTS;
        ?>
				<?php 
        if (!$_auth["useStatsHide"]) {
            echo "(" . fuzzy_number($newsCount) . ")";
        }
        ?>
			</span></a>
		</div>
		<?php 
    }
    if ($comData["comid"]) {
        ?>
		<div class="sep commentActions">
			<?php 
        getCommentParent($comData, $parentURL, $parentType, $parentTitle, false);
        getCommentParent($comData, $rootURL, $rootType, $rootTitle, true);
        $replyURL = url("comment/" . $comData["comid"] . ($_config["checkSubmitDate"] ? "/" . preg_replace('/[^0-9]/', "", $comData["comSubmitDate"]) : ''));
        $replyCommentId = $commentID . "ReplyCommentId";
        $replyButtonId = $commentID . "ReplyButtonId";
        $replyScript = "var elin = get_by_id( '" . $instantReplyId . "' );" . "var elb = get_by_id( '" . $replyButtonId . "' );" . "if( !elb ) return false;" . "if( elb.innerHTML == '" . _CANCEL . "' ) {" . "  reset_focus(); " . "  collapseAnim( '{$instantReplyOuterId}', -30, 0, '' ); " . "  elb.innerHTML = '" . _REPLY . "';" . "  return false;" . "}" . "_IR = { " . "commentId: '" . $replyCommentId . "'," . "commentName: 'comment'," . "commentDefault: ''," . "commentWide: true," . "commentRows: 7," . "commentNoBBCode: " . (isLoggedIn() && $_auth["useNoBBCode"] ? "true" : "false") . "," . "commentNoEmoticons: " . (isLoggedIn() && $_auth["useNoEmoticons"] ? "true" : "false") . "," . "commentNoOptions: false," . "commentNoSig: " . (isLoggedIn() && $_auth["useNoSig"] ? "true" : "false") . "," . "emoticonPopupURL: '" . url("emoticons", array("popup" => "yes", "comment" => $replyCommentId)) . "'," . "previewURL: '" . url("preview", array("popup" => "yes")) . "'" . "};" . "var ht = showReplyForm( '" . $replyURL . "', '" . $_currentPageURL . "' );" . "elin.innerHTML = ht;" . "collapseAnim( '{$instantReplyOuterId}', 30, 0, 'set_focus( \\'' + _IR.commentId + '\\' );' ); " . "elb.innerHTML = '" . _CANCEL . "';" . "return false;";
        if (!isset($comData["pmsid"]) && $replyURL != url(".") && $_cmd[0] != "editcomment") {
            ?>
				<span class="button smalltext" style="float: right"
					id="<?php 
            echo $replyButtonId;
            ?>
" onclick="<?php 
            echo $replyScript;
            ?>
">
					<?php 
            echo _REPLY;
            ?>
				</span>
				<?php 
        }
        if ($_cmd[0] == "comment" && $rootURL != url(".") && $level == 0) {
            ?>
				<a href="<?php 
            echo $rootURL;
            ?>
" title="<?php 
            echo htmlspecialchars($rootTitle);
            ?>
">
				<span class="button smalltext" style="float: right"
					onclick="document.location='<?php 
            echo $rootURL;
            ?>
';">
					<?php 
            echo _ROOT;
            ?>
 (<?php 
            echo $rootType;
            ?>
)
				</span></a>
				<?php 
        }
        if ($_cmd[0] == "comment" && $parentURL != url(".") && $level == 0 && $parentURL != $rootURL) {
            ?>
				<a href="<?php 
            echo $parentURL;
            ?>
" title="<?php 
            echo htmlspecialchars($parentTitle);
            ?>
">
				<span class="button smalltext" style="float: right"
					onclick="document.location='<?php 
            echo $parentURL;
            ?>
';">
					<?php 
            echo _PARENT;
            ?>
 (<?php 
            echo $parentType;
            ?>
)
				</span></a>
				<?php 
        }
        if ($_cmd[0] == "updates") {
            $comid = $comData["comid"];
            $script = "add_operation( 'm{$comid}' );\n" . "\$('{$markAsReadId}').hide(); " . ($markAsReadId2 != "" ? "if() \$('{$markAsReadId2}').hide(); " : "") . "var elb = \$( '{$replyButtonId}' );" . "if( !elb ) return false;" . "if( elb.innerHTML == '" . _CANCEL . "' ) {" . "  reset_focus(); " . "  collapseAnim( '{$instantReplyOuterId}', -30, 0, '' ); " . "  elb.innerHTML = '" . _REPLY . "';" . "  return false;" . "}" . "comment_count--; " . "\$('_updCmtCnt').innerHTML = fuzzy_number( comment_count ); " . "\$('_globCmtCnt').innerHTML = fuzzy_number( comment_count );";
            ?>
				<div id="<?php 
            echo $id1 = $commentID . "Updates1";
            ?>
" class="button smalltext" style="display: none; float: right"
					onclick="<?php 
            echo $script;
            ?>
"><?php 
            echo _MARK_AS_READ;
            ?>
: <span class="error"><?php 
            echo _CLICK_TO_CONFIRM;
            ?>
</span></div>
				<div id="<?php 
            echo $id2 = $commentID . "Updates2";
            ?>
" class="button smalltext" style="float: right"
					onclick="$('<?php 
            echo $id1;
            ?>
').show(); $('<?php 
            echo $id2;
            ?>
').hide();"><?php 
            echo _MARK_AS_READ;
            ?>
</div>
				<?php 
        }
        if ((atLeastSModerator() || $comData["comCreator"] == $_auth["useid"]) && $_cmd[0] != "editcomment" && $_cmd[0] != "updates") {
            $editURL = isset($comData["pmsid"]) ? url("editpm/" . $comData["pmsid"]) : url("editcomment/" . $comData["comid"]);
            ?>
				<a href="<?php 
            echo $editURL;
            ?>
">
				<span class="button smalltext" style="float: right"
					onclick="document.location='<?php 
            echo $editURL;
            ?>
';">
					<?php 
            echo _EDIT;
            ?>
				</span></a>
				<?php 
        }
        ?>
			<div class="f_left mar_top smalltext">
				<?php 
        // Show IPs to moderators+ (as an acronym).
        if (atLeastModerator()) {
            ?>
					<acronym style="cursor: help" title="Submitted from <?php 
            echo getDotDecIp($comData["comSubmitIp"]);
            ?>
, last edited from <?php 
            echo getDotDecIp($comData["comEditIp"]);
            ?>
">
					<?php 
        }
        if (!isset($comData["pmsid"])) {
            ?>
					<a class="originalUrl" href="<?php 
            echo $replyURL;
            ?>
">#</a>
					<?php 
        }
        printf(_COMMENT_POSTED_ON, gmdate($_auth["useDateFormat"], applyTimezone(strtotime($comData["comSubmitDate"]))));
        if (isset($comData["comTotalEdits"]) && $comData["comTotalEdits"] > 0) {
            echo "<br />" . sprintf(_COMMENT_EDITED, $comData["comTotalEdits"], gmdate($_auth["useDateFormat"], applyTimezone(strtotime($comData["comLastEdit"]))));
        }
        // Close the acronym opened above.
        if (atLeastModerator()) {
            ?>
					</acronym>
					<?php 
        }
        ?>
			</div>
		</div>
		<?php 
    }
    ?>
	<div class="clear">&nbsp;</div>
	<?php 
    iefixEnd();
    echo '</div>';
    // Comment body
    //echo '</div>'; // Comment outer
    ?>
	<table cellspacing="0" cellpadding="0" width="100%"><tr><td>
	<div id="<?php 
    echo $instantReplyOuterId;
    ?>
" style="display: none">
		<div class="cmt_border_left" style="padding: 4px; padding-right: 0;" id="<?php 
    echo $instantReplyOuterId;
    ?>
_">
			<div class="caption smalltext"><?php 
    echo _REPLY;
    ?>
:</div>
			<div style="padding: 1px; padding-bottom: 5px" id="<?php 
    echo $instantReplyId;
    ?>
"><br /></div>
		</div>
	</div>
	</td></tr></table>
	<?php 
    for ($i = 0; $i <= $levellim; $i++) {
        echo "</div>";
    }
}