$iTotalPages = ceil($iTotalNum / $iPerPage); $iCurPage = (int) $_GET['page']; if ($iCurPage > $iTotalPages) { $iCurPage = $iTotalPages; } if ($iCurPage < 1) { $iCurPage = 1; } $sLimitFrom = ($iCurPage - 1) * $iPerPage; $sqlOrder = " ORDER BY `medDate` DESC "; $sqlLimit = "LIMIT {$sLimitFrom}, {$iPerPage}"; $sQuery = "\r\n\tSELECT\r\n\t\t`a`.`ID` as `medID`,\r\n\t\t`a`.`Owner` as `medProfId`,\r\n\t\t`a`.`Title` as `medTitle`,\r\n\t\t`a`.`Date` as `medDate`,\r\n\t\t`a`.`Listens` as `medListens`,\r\n\t\t`a`.`Approved`,\r\n\t\t`b`.`NickName`\r\n\tFROM `Ray" . $sType . "Files` as `a`\r\n\tLEFT JOIN `Profiles` as `b` ON\r\n\t\t`b`.`ID` = `a`.`Owner`\r\n\t{$sqlWhere}\r\n\t{$sqlOrder}\r\n\t{$sqlLimit}\r\n\t"; $rData = db_res($sQuery); TopCodeAdmin(); ContentBlockHead("List of music files"); echo browseCode(); ContentBlockFoot(); BottomCode(); function browseCode() { global $site; global $rData; global $iTotalPages; global $iCurPage; $sCode = '<div id = "browseMain">'; $sCode .= '<form method="post" action="' . $_SERVER['PHP_SELF'] . '">'; if (mysql_num_rows($rData)) { while ($aData = mysql_fetch_array($rData)) { $sStyle = $aData['Approved'] == 'true' ? ' style="border: 2px solid #00CC00;"' : ' style="border: 2px solid #CC0000;"'; $sProf = '<a href="' . $site['url'] . 'profile_edit.php?ID=' . $aData['medProfId'] . '">' . $aData['NickName'] . '</a>'; $sCode .= '<div class="browseUnit"' . $sStyle . '>';
$iTotalPages = ceil($iTotalNum / $iPerPage); $iCurPage = (int) $_GET['page']; if ($iCurPage > $iTotalPages) { $iCurPage = $iTotalPages; } if ($iCurPage < 1) { $iCurPage = 1; } $sLimitFrom = ($iCurPage - 1) * $iPerPage; $aSqlQuery['sqlLimit'] = "LIMIT {$sLimitFrom}, {$iPerPage}"; $aSqlQuery['sqlOrder'] = "ORDER BY `{$oNew->aTableFields['medDate']}` DESC"; $aManage = array('medID', 'medProfId', 'medTitle', 'medUri', 'medDate', 'medViews', 'medExt', 'Approved'); if ($iTotalNum > 0) { $aCount = array('total' => $iTotalPages, 'current' => $iCurPage, 'per_page' => $iPerPage); $rData = $oNew->getFilesList($aSqlQuery, $aManage); $sCode = browseCode($oNew, $rData, $aCount); } TopCodeAdmin(); ContentBlockHead("List of {$sBigType} files"); echo $sCode; ContentBlockFoot(); BottomCode(); function browseCode($oNew, $rData, $aCount) { $sCode = '<div id="browseMain"><form method="post" action="">'; $iCount = mysql_num_rows($rData); $sCheckAll = $iCount > 1 ? '<input type="checkbox" name=\\"ch_all" onclick="checkAll( \'Check[]\', this.checked )" />Check all' : ''; if ($iCount) { while ($aData = mysql_fetch_array($rData)) { $sCode .= $oNew->showBrowseUnit($aData, true); }