function __updIcon($count, $hint, $icon) { global $_auth; if ($count > 0) { return getIMG(url() . "images/emoticons/" . $icon, 'alt="' . substr($hint, 0, 1) . '" title="' . $hint . '"') . ($_auth["useFuzzyNumbers"] ? " " : "") . ($hint == _COMMENTS ? '<span id="_globCmtCnt">' : "") . ($hint == _JOURNALS ? '<span id="_globJouCnt">' : "") . fuzzy_number($count) . ($hint == _COMMENTS || $hint == _JOURNALS ? '</span>' : "") . ($_auth["useFuzzyNumbers"] ? "<br />" : " "); } else { return ""; } }
function showPollOptions($options, $alreadyVoted, $totalVoted, $polid) { if ($alreadyVoted) { $maxVoted = $totalVoted; foreach ($options as $optData) { $maxVoted = $optData["polOVotes"]; break; } foreach ($options as $optData) { ?> <table cellspacing="0" cellpadding="0" border="0"><tr> <td class="wide"> <?php echo formatText($optData["polOOption"]); ?> </td> <td class="smalltext disable_wrapping" style="vertical-align: bottom"> (<?php echo fuzzy_number($optData["polOVotes"]); ?> ) </td> </tr></table> <?php showPollBar($optData["polOVotes"], $maxVoted, $totalVoted); } } else { $options = array(); $result2 = sql_query("SELECT * FROM `pollOptions` " . "WHERE `polOPoll` = '" . $polid . "' ORDER BY `polOid` LIMIT 20"); while ($optData = mysql_fetch_assoc($result2)) { $options[$optData["polOid"]] = $optData; } foreach ($options as $optData) { ?> <div> <input class="checkbox" type="checkbox" id="<?php echo $chkid = generateId(); ?> " name="option<?php echo $optData["polOid"]; ?> " /> <label for="<?php echo $chkid; ?> "> <?php echo formatText($optData["polOOption"]); ?> </label> </div> <?php } } }
value="0"><?php echo fuzzy_number(12); ?> </option> <option <?php echo isset($_GET["limit"]) && $_GET["limit"] == 2 ? 'selected="selected"' : ""; ?> value="2"><?php echo fuzzy_number(24); ?> </option> <option <?php echo isset($_GET["limit"]) && $_GET["limit"] == 3 ? 'selected="selected"' : ""; ?> value="3"><?php echo fuzzy_number(48); ?> </option> </select> <input class="submit" type="submit" value="<?php echo _UPDATE; ?> " style="vertical-align: middle" /> </form> </div> <?php $membersNavs = ob_get_contents(); ob_end_flush(); ?> <div class="hline"> </div> <?php
function __showUpdatesTab($id, $icon, $title, $count, $insertCmtId = false, $insertJouId = false) { ?> <div id="bar_<?php echo $id; ?> " class="tab" onclick="open_tab( this, 'tabs', 'tab_<?php echo $id; ?> ' )"> <?php echo getIMG(url() . "images/emoticons/" . $icon) . " " . $title; if ($count > 0) { echo " (" . ($insertCmtId ? '<span id="_updCmtCnt">' : '') . ($insertJouId ? '<span id="_updJouCnt">' : '') . fuzzy_number($count) . ($insertCmtId | $insertJouId ? '</span>' : '') . ")"; } ?> </div> <?php }
<div class="sep"> <div class="f_left mar_left"> <form action="<?php echo url("."); ?> " method="get"> <select class="smalltext" name="filterOut" onchange="this.form.submit()"> <option>*</option> <?php $result = sql_query("SELECT `useUsername`, COUNT(*) AS `count` FROM `pms`,`users` " . dbWhere(array("pmsPmUser*" => "useid", "pmsCreatorDelete" => '0', "pmsCreator" => $_auth["useid"])) . getTwitWhere("pmsPmUser") . "GROUP BY `pmsPmUser` ORDER BY `useUsername`"); while ($rowData = sql_next($result)) { echo '<option '; if (isset($_GET["filterOut"]) && $_GET["filterOut"] == $rowData["useUsername"]) { echo 'selected="selected" '; } echo 'value="' . $rowData["useUsername"] . '">' . $rowData["useUsername"] . " (" . fuzzy_number($rowData["count"]) . ")</option>"; } sql_free($result); ?> </select> </form> </div> <?php navControls($sentOffset, $_pm_per_page, $totalCount, "", "", "", "", "sentOffset"); ?> </div> <br /><br /> <div class="header">Delete Messages</div> <br /> <div class="container2"> <form action="<?php
?> : <?php echo fuzzy_number($objData["objViewed"]); ?> </div> <?php if (!$isExtras) { ?> <div> <?php echo _FAVOURITES; ?> : <?php echo fuzzy_number($objData["objFavs"]); ?> (<a href="javascript:popup('<?php echo url("favs/" . $objData['objid'] . "", array("popup" => "yes")); ?> ','tos',900,600)">Who?</a>) </div> <?php } } // Show submission date ?> <div class="a_right smalltext"> <?php
<?php $_documentTitle = _WHOSONLINE; $minTime = date("Y-m-d H:i:s", time() - 600); $minTime2 = date("Y-m-d H:i:s", time() - 800); $result = sql_query("SELECT COUNT(*) FROM `users` WHERE `useLastAction` > '{$minTime}'"); $onlineUsers = mysql_result($result, 0); ?> <div class="header"> <div class="header_title"> <?php echo _WHOSONLINE; ?> <div class="subheader"><?php echo _ONLINE_USERS . ": " . fuzzy_number($onlineUsers); ?> </div> <?php echo date("Y-m-d H:i:s"); ?> </div> <?php $active = 4; include INCLUDES . "mod_browsemenu.php"; ?> </div> <?php if (!$_auth["useid"]) { echo '<div class="container">';
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;"> </div> <div class="smalltext"> <?php echo formatText($_signatureCache[$comData["comCreator"]]); ?> </div> <?php } } ?> <div class="clear"> </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"> </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>"; } }
function showThumbnails($params) { global $_config, $_cmd, $_auth; if (!isset($params["quickSearch"])) { $params["quickSearch"] = false; } if (!isset($params["isFavorites"])) { $params["isFavorites"] = false; } if (!isset($params["showDeleted"])) { $params["showDeleted"] = false; } if (!isset($params["countDisabled"])) { $params["countDisabled"] = false; } if (!isset($params["select"])) { $params["select"] = "SELECT * FROM `objects`"; } if (!isset($params["where"])) { $params["where"] = "1"; } if (!isset($params["having"])) { $params["having"] = ""; } if (!isset($params["maxcols"])) { $params["maxcols"] = 4; } if (!isset($params["isExtras"])) { $params["isExtras"] = false; } if (!isset($params["disableFiltering"])) { $params["disableFiltering"] = false; } if (!isset($params["onDisplayFiltering"])) { $params["onDisplayFiltering"] = false; } if (!isset($params["sortById"])) { $params["sortById"] = ""; } //if( !isset( $params[ "noMostFaved" ])) $params["noMostFaved"] = false; if (!isLoggedIn()) { if ($params["where"] == "1") { $params["where"] = "`objGuestAccess` = '1'"; } else { $params["where"] = "(" . $params["where"] . ") AND `objGuestAccess` = '1'"; } } // Define the sorting method. There are 5 sorting methods: // // 0 - newest first // 1 - oldest first // 2 - most viewed // 3 - most faved // 4 - random // 5 - relevant if (isset($params["order"])) { $order = $params["order"]; } else { if ($_cmd[0] == "search") { $order = isset($_GET["order"]) ? intval($_GET["order"]) : (isset($_COOKIE["yGalOrder"]) ? intval($_COOKIE["yGalOrder"]) : 0); } else { $order = isset($_GET["order"]) ? intval($_GET["order"]) : (isset($_COOKIE["yGalOrderSearch"]) ? intval($_COOKIE["yGalOrderSearch"]) : 0); } } if ($params["noMostFaved"] && ($order == 2 || $order == 3)) { $order = 0; } if ($params["isExtras"] && $order == 2) { $order = 0; } // Disable sorting by favs and views for the searching engine because it's too slow :( if ($_cmd[0] == "search" && $order != 0 && $order != 1) { $order = 0; } $order1 = $order; // Disable sorting by popularity for favourites because it's too slow :( if ($_cmd[0] == "favourites" && $order1 != 0 && $order1 != 1) { $order1 = 0; } switch ($order1) { case 1: if ($params["sortById"]) { $orderString = "ORDER BY " . $params["sortById"]; } else { $orderString = $params["isFavorites"] ? "ORDER BY `favSubmitDate`" : "ORDER BY `objSubmitDate`"; } break; case 2: $orderString = "ORDER BY `objPopularity` DESC"; /* $params[ "select" ] = str_replace( "FROM `objects`", "FROM `objects` USE INDEX(`objPopularity`)", $params[ "select" ]); */ break; default: if ($params["sortById"]) { $orderString = "ORDER BY " . $params["sortById"] . " DESC"; } else { $orderString = $params["isFavorites"] ? "ORDER BY `favSubmitDate` DESC" : "ORDER BY `objSubmitDate` DESC"; } } // Define the amount of thumbnails to show. The default value is 12. if (isset($params["limit"])) { $limit = $params["limit"]; } else { $limit = isset($_GET["limit"]) ? intval($_GET["limit"]) : (isset($_COOKIE["yGalLimit"]) ? intval($_COOKIE["yGalLimit"]) : 12); if ($limit != 8 && $limit != 12 && $limit != 24 && $limit != 48) { $limit = 12; } } // All pages except the front page "remember" the new // sorting/limiting settings. if ($_cmd[0] != "") { if (!$params["noMostFaved"]) { if ($_cmd[0] == "search") { setcookie("yGalOrder", $order, strtotime("+9 years"), "/", "." . $_config["galRoot"]); } else { setcookie("yGalOrderSearch", $order, strtotime("+9 years"), "/", "." . $_config["galRoot"]); } } setcookie("yGalLimit", $limit, strtotime("+1 month"), "/", "." . $_config["galRoot"]); } // Define the current offset. $offset = isset($_GET["offset"]) ? intval($_GET["offset"]) : 0; if ($offset < 0) { $offset = 0; } if (!$params["disableFiltering"]) { // If the user isn't mature, hide mature submissions. applyObjFilters($params["where"]); if (isset($params["folderWhere"])) { applyObjFilters($params["folderWhere"]); } if (isset($params["folderCalcWhere"])) { applyObjFilters($params["folderCalcWhere"]); } if (!$params["showDeleted"]) { $params["where"] = "(" . $params["where"] . ") " . "AND `objDeleted` = '0' AND `objPending` = '0'"; if (isset($params["folderWhere"])) { $params["folderWhere"] = "(" . $params["folderWhere"] . ") " . "AND `objDeleted` = '0' AND `objPending` = '0'"; } if (isset($params["folderCalcWhere"])) { $params["folderCalcWhere"] = "(" . $params["folderCalcWhere"] . ") " . "AND `objDeleted` = '0' AND `objPending` = '0'"; } } } $totalFolders = 0; $gallery = array(); if (isset($params["folderParent"])) { $gallery[-1] = -1; $limit--; } if (isset($params["folderSelect"])) { $query = $params["folderSelect"] . " WHERE " . $params["folderWhere"] . " GROUP BY `folid` ORDER BY `folName` LIMIT {$offset}, {$limit}"; $result = sql_query($query); while ($folData = mysql_fetch_assoc($result)) { $gallery[-$folData["folid"]] = $folData; } $query = $params["folderSelect"] . " WHERE " . $params["folderWhere"] . " GROUP BY `folid`"; $result = sql_query($query); $totalFolders = mysql_num_rows($result); $offset -= $totalFolders; } // Query all the currently visible thumbnails and store the data in the // $gallery array. if ($params["countDisabled"]) { $selectCmd = $params["select"]; } else { $selectCmd = preg_replace('/^SELECT/', "SELECT SQL_CALC_FOUND_ROWS", $params["select"]); } $tmpOffset = $offset < 0 ? 0 : $offset; $tmpLimit = $offset < 0 ? $limit + $offset : $limit; $limit1 = $limit; if ($params["countDisabled"]) { $limit1++; } $query = "{$selectCmd} WHERE " . $params["where"] . " " . $params["having"] . " {$orderString} LIMIT {$tmpOffset}, {$limit1}"; /* if( $_auth[ "useid" ] == 7 ) { echo $query; } */ $result = sql_query($query); while ($objData = mysql_fetch_assoc($result)) { $gallery[$objData["objid"]] = $objData; } // Calculate the total amount of submissions that's possible to browse // through with the current options. if ($params["countDisabled"]) { $totalCount = $offset + $limit; if (count($gallery) > $limit) { $totalCount++; } } else { $result = sql_query("SELECT FOUND_ROWS()"); $totalCount = $totalFolders + mysql_result($result, 0); } // Generate the navigation bar. if ($_cmd[0] == "") { $galleryNavs = ""; } else { iefixStart(); ob_start(); $tmpOffset = isset($_GET["offset"]) ? intval($_GET["offset"]) : 0; navControls($tmpOffset, $limit, $totalCount); ?> <div class="a_center"> <?php if ($params["quickSearch"]) { ?> <form action="<?php echo url("search"); ?> " method="get"> <?php foreach ($_GET as $key => $value) { if ($key != "keywordList" && $key != "offset") { echo '<input name="' . htmlspecialchars($key) . '" type="hidden" value="' . htmlspecialchars($value) . '" />'; } } ?> <select name="keywordList" onchange="this.form.submit();"> <option value=""></option> <option value=""><?php echo _SEARCH; ?> </option> <?php // By default, select the first root keyword group. $result = sql_query("SELECT `keyid` FROM `keywords` " . "WHERE `keySubcat` = '0' ORDER BY `keyWord` LIMIT 1"); if (mysql_num_rows($result)) { $mainSubcat = mysql_result($result, 0); } else { $mainSubcat = 0; } if (isset($_GET["keywordList"])) { // If it's already a search request then see what keyword groups are // involved in the search and allow selection of siblings inside // those groups. $list = preg_split('/\\s/', $_GET["keywordList"], -1, PREG_SPLIT_NO_EMPTY); } else { $list = array($mainSubcat); } $first1 = true; $where1 = "`keyid` IN("; foreach ($list as $keyid) { $keyid = intval($keyid); if ($keyid == 0) { continue; } $result = sql_query("SELECT `keySubcat` FROM `keywords` " . "WHERE `keyid` = '{$keyid}' LIMIT 1"); if (mysql_num_rows($result) > 0) { $keySubcat = mysql_result($result, 0); $where1 .= ($first1 ? "" : ",") . "'{$keySubcat}'"; $first1 = false; } } if ($mainSubcat > 0) { $where1 .= ($first1 ? "" : ",") . "'{$mainSubcat}'"; } $where1 .= ")"; $limit1 = 5; $result = sql_query("SELECT `keyid`,`keyWord` FROM `keywords` " . "WHERE {$where1} ORDER BY `keyWord` LIMIT {$limit1}"); while ($keyData = mysql_fetch_assoc($result)) { $keyData["keyWord"] = trim(preg_replace('/^.*\\|/', "", $keyData["keyWord"])); if (preg_match('/\\@$/', $keyData["keyWord"])) { continue; } ?> <optgroup label="<?php echo $keyData["keyWord"]; ?> "> <?php $result2 = sql_query("SELECT * FROM `keywords` " . "WHERE `keySubcat` = '" . $keyData["keyid"] . "' ORDER BY `keyWord`"); while ($rowData = mysql_fetch_assoc($result2)) { $rowData["keyWord"] = trim(preg_replace('/^.*\\|/', "", $rowData["keyWord"])); if (preg_match('/\\@$/', $rowData["keyWord"])) { continue; } ?> <option <?php echo isset($_GET["keywordList"]) && $_GET["keywordList"] == $rowData["keyid"] ? 'selected="selected"' : ""; ?> value="<?php echo $rowData["keyid"]; ?> "><?php echo htmlspecialchars($rowData["keyWord"]); ?> </option> <?php } ?> </optgroup> <?php } ?> </select> </form> <?php } ?> <form action="<?php echo url("."); ?> " method="get"> <?php foreach ($_GET as $key => $value) { if ($key != "order" && $key != "limit" && $key != "offset") { echo '<input name="' . htmlspecialchars($key) . '" type="hidden" value="' . htmlspecialchars($value) . '" />'; } } ?> <select name="order"> <option <?php echo $order == 0 ? 'selected="selected"' : ""; ?> value="0"><?php echo _NEWEST_FIRST; ?> </option> <option <?php echo $order == 1 ? 'selected="selected"' : ""; ?> value="1"><?php echo _OLDEST_FIRST; ?> </option> <?php if ($_cmd[0] != "search" && $_cmd[0] != "favourites") { if (!$params["noMostFaved"]) { if (!$params["isExtras"]) { ?> <option <?php echo $order == 2 ? 'selected="selected"' : ""; ?> value="2"><?php echo _CLUB_POPULAR; ?> </option> <?php } /* ?> <option <?= $order == 3 ? 'selected="selected"' : "" ?> value="3"><?=_MOST_VIEWED ?></option> <? */ } /* ?> <!--<option <?= $order == 4 ? 'selected="selected"' : "" ?> value="4"><?=_RANDOM ?></option>--> <? if( $_cmd[ 0 ] == "search" ) { ?> <option <?= $order == 5 ? 'selected="selected"' : "" ?> value="5"><?=_SEARCH_RELEVANT ?></option> <? } */ } ?> </select> <?php $tmpLimit = $limit; if (isset($params["folderParent"])) { $tmpLimit++; } ?> <select name="limit"> <option <?php echo $tmpLimit == 8 ? 'selected="selected"' : ""; ?> value="8"><?php echo fuzzy_number(8); ?> </option> <option <?php echo $tmpLimit == 12 ? 'selected="selected"' : ""; ?> value="12"><?php echo fuzzy_number(12); ?> </option> <option <?php echo $tmpLimit == 24 ? 'selected="selected"' : ""; ?> value="24"><?php echo fuzzy_number(24); ?> </option> <option <?php echo $tmpLimit == 48 ? 'selected="selected"' : ""; ?> value="48"><?php echo fuzzy_number(48); ?> </option> </select> <input class="submit" type="submit" value="<?php echo _UPDATE; ?> " style="vertical-align: middle" /> </form> </div> <?php $galleryNavs = ob_get_contents(); ob_end_flush(); ?> <div class="hline"> </div> <?php iefixEnd(); } $cols = 0; $imagesToGo = $limit; if (isset($params["folderParent"])) { $imagesToGo++; } $useids = array(); foreach ($gallery as $objData) { if (isset($objData["objCreator"])) { $useids[] = $objData["objCreator"]; } } prefetchUserData(array_unique($useids)); if ($params["onDisplayFiltering"]) { // Prepare user filters array (used below). $useFilters = preg_split('/[^0-9]/', $_auth["useObjFilters"], 63, PREG_SPLIT_NO_EMPTY); } foreach ($gallery as $objid => $objData) { if ($objid < 0) { // Show a folder icon. ?> <div class="gallery_col"> <div class="a_center padded mar_bottom<?php echo $cols < 3 ? " mar_right" : ""; ?> "> <?php if (isset($params["folderParent"])) { $url = url(($params["isExtras"] ? "extras" : "gallery") . "/" . strtolower($params["folderParent"]["useUsername"])); ?> <div style="padding-top: 35px;"> <a href="<?php echo $url; ?> "> <?php echo getIMG(urlf() . "images/folder_up.png"); ?> <br /> <b><?php echo _SET_FOLDER_BACK; ?> </b> </a> </div> <?php } else { $url = url(($params["isExtras"] ? "extras" : "gallery") . "/" . strtolower($params["folderCreator"]["useUsername"]) . "/" . $objData["folIdent"]); ?> <div style="background: url(<?php echo urlf() . "images/folder.png"; ?> ) center top no-repeat; height: 140px;"> <div style="padding-top: 35px"> <a href="<?php echo $url; ?> "><?php echo getFolderIcon($objData["folid"]); ?> </a> </div> </div> <div> <b><a href="<?php echo $url; ?> "><?php echo formatText($objData["folName"], false, true); ?> </a></b> </div> <?php if (isset($params["folderCalcWhere"])) { $query = $params["folderCalc"] . " WHERE " . $params["folderCalcWhere"] . " AND `objFolder` = '" . $objData["folid"] . "'"; $result = sql_query($query); echo "( " . fuzzy_number(mysql_result($result, 0)) . " )"; } } ?> </div> </div> <?php } else { // Show a thumbnail. if ($params["onDisplayFiltering"]) { // Check objDeleted, objPending, objMature manually. if ($objData["objDeleted"] || $objData["objPending"]) { continue; // Don't show deleted/pending } if (count($useFilters) > 0) { $objFilters = preg_split('/[^0-9]/', $objData["objMature"], 63, PREG_SPLIT_NO_EMPTY); $isFiltered = false; foreach ($objFilters as $filter) { if (in_array($filter, $useFilters)) { $isFiltered = true; break; } } if ($isFiltered) { continue; // Don't show filtered objects } } } $anchor = url("view/" . ($params["isExtras"] ? "e" : "") . $objData["objid"]); if ($params["isExtras"]) { $src = $objData["objThumbURL"]; } elseif ($objData["objThumbDefault"]) { $src = urlf() . "images/litthumb.png"; } else { $src = urlf() . applyIdToPath("files/thumbs/", $objData["objid"]) . "-" . preg_replace('/[^0-9]/', "", $objData["objLastEdit"]) . ".jpg"; } $objTitle = formatText($objData["objTitle"]); // Do not display "by <artist_name>" in /gallery and /galleryclubs. if ($_cmd[0] != "gallery" && $_cmd[0] != "galleryclubs" && $_cmd[0] != "extras") { $objTitle .= "<br /> "; if ($objData["objCollab"] > 0) { $objTitle .= sprintf(_BY_AND, getUserLink($objData["objCreator"]), getUserLink($objData["objCollab"])); } else { $objTitle .= sprintf(_BY, getUserLink($objData["objCreator"])); } } else { if ($objData["objCollab"] > 0) { $objTitle .= " <br />" . sprintf(_BY_COLLAB_WITH, getUserLink($objData["objCollab"])); } } if ($objData["objForUser"] > 0 && $_cmd[0] != "gifts") { $objTitle .= " <br />" . sprintf(_FOR, getUserLink($objData["objForUser"])); } // Display "in <club_name>" in /gallery and /galleryclubs if the // work is submitted to a club. if ($_cmd[0] == "galleryclubs" || $_cmd[0] == "gallery" && $objData["objForClub"] > 0) { $result = sql_query("SELECT `cluName` FROM `clubs` " . "WHERE `cluid` = '" . $objData["objForClub"] . "'"); if (mysql_num_rows($result) > 0) { $club = '<a href="' . url("club/" . $objData["objForClub"]) . '">' . mysql_result($result, 0) . '</a>'; $objTitle .= '<br /> ' . sprintf(_IN, $club); } } ?> <div class="gallery_col"> <div class="a_center padded mar_bottom<?php echo $cols < 3 ? " mar_right" : ""; ?> "> <a href="<?php echo $anchor; ?> "> <?php echo getIMG($src, 'alt="' . strip_tags($objTitle) . '" class="thumb' . ($objData["objMature"] && isLoggedIn() ? " mature" : "") . ($objData["objPending"] ? " pending" : "") . ($objData["objDeleted"] ? " deleted" : "") . '" width="' . $objData["objThumbWidth"] . '" height="' . $objData["objThumbHeight"] . '" title="' . strip_tags($objTitle) . '"'); ?> </a> <div><?php echo $objTitle; ?> </div> </div> </div> <?php } $cols++; if ($cols >= $params["maxcols"]) { $cols = 0; ?> <div class="clear"> </div> <?php } $imagesToGo--; if ($imagesToGo <= 0) { break; } } if (count($gallery) == 0) { ?> <div><?php echo _NO_SUBMISSIONS; ?> </div> <?php } if ($_cmd[0] != "" || $params["limit"] == 12) { ?> <div class="hline"> </div> <?php } // On the front page also show the "More >" link which leads to the // global gallery browsing. if ($_cmd[0] == "" && $params["limit"] == 12) { ?> <div class="a_right mar_bottom mar_right"> <a class="disable_wrapping smalltext" href="<?php echo url("browse"); ?> "> <?php echo _MORE; ?> <?php echo getIMG(url() . "images/emoticons/nav-next.png"); ?> </a> </div> <?php } echo $galleryNavs; ?> <div class="clear"> </div> <?php }
function __updIcon($count, $hint, $icon, $insertCmtId = false) { global $_auth, $_commentCountId; if ($count > 0) { return getIMG(url() . "images/emoticons/" . $icon, 'alt="' . substr($hint, 0, 1) . '" title="' . $hint . '"') . ($_auth["useFuzzyNumbers"] ? " " : "") . '<span' . ($insertCmtId ? ' id="' . $_commentCountId . '"' : '') . ' class="v_middle">' . fuzzy_number($count) . '</span>' . ($_auth["useFuzzyNumbers"] ? "<br />" : " "); } else { return ""; } }
if ($totalfavs > 0) { ?> <div> <?php echo getIMG(url() . "images/emoticons/heart2.png"); ?> <b><?php echo _TOTAL_FAVS; ?> </b>: <?php echo fuzzy_number($totalfavs); ?> </div> <?php } ?> <div> <?php echo getIMG(url() . "images/emoticons/comment.png"); ?> <b><?php echo _COMMENTS; ?> </b>: <?php echo fuzzy_number($totalComments); ?> </div> <div class="clear"> </div> </div> </div>