$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 . '>'; $sCode .= '<div class="browseCheckbox"><input type="checkbox" name="Check[]" value="' . $aData['medID'] . '"></div>';
function panelSection($header, $content, $padding = 10) { ob_start(); ContentBlockHead("{$header}"); echo $content; ContentBlockFoot(); $ret = ob_get_contents(); ob_end_clean(); return $ret; }
/** * Generating Main page code * * @return ALL presentation of data */ function Main() { $oClassifieds = new BxDolClassifieds(); $oClassifieds->sCurrBrowsedFile = 'manage_classifieds.php'; $oClassifieds->bAdminMode = TRUE; print $oClassifieds->PrintCommandForms(); if ($_REQUEST) { if (isset($_REQUEST['action'])) { if ((int) $_REQUEST['action'] == 3) { print $oClassifieds->PrintFilterForm(); print $oClassifieds->PrintFilteredAllAdvertisements(); ContentBlockFoot(); BottomCode(); return; } elseif ((int) $_REQUEST['action'] == 2) { $iClassifiedSubID = (int) $_REQUEST['FilterSubCat']; print $oClassifieds->PrintSubRecords($iClassifiedSubID, TRUE); ContentBlockFoot(); BottomCode(); return; } elseif ((int) $_REQUEST['action'] == 1) { $iClassifiedID = (int) $_REQUEST['FilterCat']; print $oClassifieds->PrintAllSubRecords($iClassifiedID); ContentBlockFoot(); BottomCode(); return; } } elseif (isset($_GET['bClassifiedID'])) { $iClassifiedID = (int) $_GET['bClassifiedID']; if ($iClassifiedID > 0) { print $oClassifieds->PrintAllSubRecords($iClassifiedID); print $oClassifieds->PrintBackLink(); ContentBlockFoot(); BottomCode(); return; } } elseif (isset($_GET['bSubClassifiedID'])) { $iSubClassifiedID = (int) $_GET['bSubClassifiedID']; if ($iSubClassifiedID > 0) { print $oClassifieds->PrintSubRecords($iSubClassifiedID, TRUE); print $oClassifieds->PrintBackLink(); ContentBlockFoot(); BottomCode(); return; } } elseif (isset($_REQUEST['iAction'])) { $sAddMainCatSuccC = MsgBox(_t('_AddMainCategory successfully added')); $sAddMainCatFailC = MsgBox(_t('_Failed to Insert AddMainCategory')); $sAddSubCatSuccC = MsgBox(_t('_AddSubCategory successfully added')); $sAddSubCatFailC = MsgBox(_t('_Failed to Insert AddSubCategory')); $sDelMainCatSuccC = MsgBox(_t('_DeleteMainCategory was successfully')); $sDelMainCatFailC = MsgBox(_t('_Failed to DeleteMainCategory')); $sDelSubCatSuccC = MsgBox(_t('_DeleteSubCategory was successfully')); $sDelSubCatFailC = MsgBox(_t('_Failed to DeleteSubCategory')); switch ($_REQUEST['iAction']) { case 'AddMainCategory': $sName = process_db_input($_REQUEST['name1']); $sDescription = process_db_input($_REQUEST['description1']); $sCustomName1 = process_db_input($_REQUEST['CustomName1']); $sCustomName2 = process_db_input($_REQUEST['CustomName2']); $sCustomAction1 = process_db_input($_REQUEST['CustomAction1']); $sCustomAction2 = process_db_input($_REQUEST['CustomAction2']); if ($sName == '') { print $sAddMainCatFailC; break; } $sqlRes = InsertC($sName, $sDescription, $sCustomName1, $sCustomName2, $sCustomAction1, $sCustomAction2); print mysql_affected_rows() != 0 ? $sAddMainCatSuccC : $sAddMainCatFailC; break; case 'AddSubCategory': if ($_REQUEST['FilterCat'] and isset($_REQUEST['name2'])) { $sName = process_db_input($_REQUEST['name2']); $sDescription = process_db_input($_REQUEST['description2']); $sCategoryID = process_db_input($_REQUEST['FilterCat']); if ((int) $sCategoryID < 1) { print $sAddSubCatFailC; break; } $sqlRes = InsertCS($sCategoryID, $sName, $sDescription); print mysql_affected_rows() != 0 ? $sAddSubCatSuccC : $sAddSubCatFailC; } break; case 'DeleteMainCategory': if ($_REQUEST['FilterCat']) { $sCategoryID = process_db_input($_REQUEST['FilterCat']); $query = "DELETE FROM `Classifieds` WHERE `ID` = '{$sCategoryID}'"; $sqlRes = db_res($query); print mysql_affected_rows() != 0 ? $sDelMainCatSuccC : $sDelMainCatFailC; } break; case 'DeleteSubCategory': if ($_REQUEST['SubClassified']) { $sCategoryID = process_db_input($_REQUEST['SubClassified']); $query = "DELETE FROM `ClassifiedsSubs` WHERE `ClassifiedsSubs`.`ID` = {$sCategoryID}"; $sqlRes = db_res($query); print mysql_affected_rows() != 0 ? $sDelSubCatSuccC : $sDelSubCatFailC; } break; } } elseif (isset($_REQUEST['DeleteAdvertisementID'])) { $id = (int) $_REQUEST['DeleteAdvertisementID']; if ($id > 0) { print ActionDeleteAdvertisement($id); } } elseif (isset($_REQUEST['ActivateAdvertisementID'])) { $id = (int) $_REQUEST['ActivateAdvertisementID']; if ($id > 0) { print ActionActivateAdvertisement($id); } } elseif (isset($_REQUEST['ActivateAdvWholesale'])) { print UpdateAllNewAdvIntoActive(); } elseif (isset($_REQUEST['DeleteSelected'])) { print DeleteSelectedAdv(); } elseif (isset($_REQUEST['ApproveSelected'])) { print ApproveSelectedAdv(); } if (isset($_REQUEST['UpdatedAdvertisementID'])) { $id = (int) $_REQUEST['UpdatedAdvertisementID']; if ($id > 0) { if (isset($_REQUEST['DeletedPictureID']) && (int) $_REQUEST['DeletedPictureID'] > 0) { //delete a pic print $oClassifieds->ActionDeletePicture(); print $oClassifieds->PrintEditForm($id); } else { print $oClassifieds->ActionUpdateAdvertisementID($id); } } return; } elseif (isset($_REQUEST['EditAdvertisementID'])) { if ((int) $_REQUEST['EditAdvertisementID'] > 0) { print $oClassifieds->PrintEditForm((int) $_REQUEST['EditAdvertisementID']); print $oClassifieds->PrintBackLink(); ContentBlockFoot(); BottomCode(); return; } } elseif (isset($_REQUEST['ShowAdvertisementID'])) { if ($_REQUEST['ShowAdvertisementID'] > 0) { print $oClassifieds->ActionPrintAdvertisement($_REQUEST['ShowAdvertisementID']); print $oClassifieds->PrintBackLink(); ContentBlockFoot(); BottomCode(); return; } } elseif (isset($_REQUEST['BuyNow'])) { $advId = (int) $_REQUEST['IDAdv']; if ($advId > 0) { print $oClassifieds->ActionBuyAdvertisement($advId); ContentBlockFoot(); BottomCode(); return; } } elseif (isset($_REQUEST['BuySendNow'])) { $advId = (int) $_REQUEST['IDAdv']; if ($advId > 0) { print $oClassifieds->ActionBuySendMailAdvertisement($advId); ContentBlockFoot(); BottomCode(); return; } } elseif (isset($_REQUEST['UsersOtherListing'])) { $iProfileID = (int) $_REQUEST['IDProfile']; if ($iProfileID > -1) { print $oClassifieds->PrintMyAds($iProfileID); ContentBlockFoot(); BottomCode(); return; } } /*elseif (isset($_REQUEST['EditCommentID'])) { $iCommId = (int)$_REQUEST['EditCommentID']; if ($iCommId > 0) { print $oClassifieds->ActionEditComment(); print $oClassifieds->ActionPrintAdvertisement($_REQUEST['EAdvID']); return; } } elseif (isset($_REQUEST['DeleteCommentID'])) { $iCommId = (int)$_REQUEST['DeleteCommentID']; if ($iCommId > 0) { print $oClassifieds->ActionDeleteComment(); print $oClassifieds->ActionPrintAdvertisement($_REQUEST['DAdvID']); return; } }*/ } print $oClassifieds->PrintManageClassifiedsForm(); $sCap1C = _t("_TREE_C_BRW"); $sCap2C = _t("_MODERATING"); print "<h2>{$sCap1C}</h2>"; print $oClassifieds->PrintTreeClassifiedsBrowse(); $sAct = _t("_Activate"); $sWhol = _t("_wholesale"); $sActivateAdvWholesale = "<a href=\"{$_SERVER['PHP_SELF']}?ActivateAdvWholesale=1\">{$sAct} {$sWhol}</a>"; print "<h2>{$sCap2C} ({$sActivateAdvWholesale})</h2>"; print $oClassifieds->PrintModeratingTable(); print '<div style="clear: both;"></div>'; return; }
function PreviewMessage() { global $site; $body_html = process_pass_data($_POST['body_html']); ContentBlockHead("Preview"); ?> <center> <iframe id="IFramePreview" name="IFramePreview" frameborder="1" scrolling="yes" height="200" width="500" src="<?php echo $site['url_admin']; ?> notify_preview.php"> </iframe> </center> <form name="form_preview" action="<?php echo $site['url_admin']; ?> notify_preview.php" method="POST" target="IFramePreview"> <input type="hidden" name="post_data" value="<?php echo htmlspecialchars($body_html); ?> "> </form> <script language="JavaScript"> <!-- document.forms['form_preview'].submit(); --> </script> <?php ContentBlockFoot(); }
function membershipActions($membershipID) { global $IDNonMember; global $site; $membershipID = (int) $membershipID; if ($membershipID <= 0) { return ''; } ob_start(); ContentBlockHead("Membership Actions"); ?> <!-- <div class="sectionHeader">Membership Actions</div> <div class="sectionBody"><div style="padding: 10px"> --> <?php $resActions = db_res("SELECT ID, Name FROM MemActions ORDER BY Name"); $arrActions = array(); while (list($ID, $desc) = mysql_fetch_row($resActions)) { $arrActions[(int) $ID] = $desc; } ?> <div align="left"> <?php echo $_POST['add_action'] ? addMembershipAction($membershipID, $_POST['add_action_id']) : ''; ?> <?php echo $_POST['update_action'] ? updateMembershipAction($membershipID, $_POST['update_action_id'], $_POST['allowedCnt'], $_POST['period'], $_POST['dateStart'], $_POST['dateEnd'], $_POST['additionalParamValue']) : ''; ?> <?php echo $_POST['delete_action'] ? deleteMembershipAction($membershipID, $_POST['delete_action_id']) : ''; ?> </div> <?php $resLevelActions = db_res("\r\n\t\tSELECT\tIDAction,\r\n\t\t\t\tAllowedCount,\r\n\t\t\t\tAllowedPeriodLen,\r\n\t\t\t\tAllowedPeriodStart,\r\n\t\t\t\tAllowedPeriodEnd,\r\n\t\t\t\tAdditionalParamName,\r\n\t\t\t\tAdditionalParamValue\r\n\t\tFROM\tMemLevelActions\r\n\t\t\t\tINNER JOIN MemActions\r\n\t\t\t\tON MemLevelActions.IDAction = MemActions.ID\r\n\t\tWHERE MemLevelActions.IDLevel = {$membershipID}\r\n\t\tORDER BY MemActions.Name"); $arrLevelActions = array(); while ($arr = mysql_fetch_assoc($resLevelActions)) { $ID = $arr['IDAction']; unset($arr['IDAction']); $arrLevelActions[(int) $ID] = $arr; } $optionsText = ""; foreach ($arrActions as $ID => $desc) { if (!$arrLevelActions[$ID]) { $optionsText .= "\n<option value=\"{$ID}\">{$desc}</option>"; } } if (strlen($optionsText)) { ?> <div align="right"> <form action="<?php echo $_SERVER['SCRIPT_NAME']; ?> ?edit=actions&edit_level=<?php echo $membershipID; ?> " method="POST"> <input type="hidden" name="add_action" value="yes" /> <select name="add_action_id"> <?php echo $optionsText; ?> </select> <input type="submit" value="Add action" /> </form> </div> <?php } foreach ($arrLevelActions as $ID => $arrAction) { ?> <div class="actionRowHeader"> <table width="100%" style="height: 100%" cellpadding="0" cellspacing="0"> <tr> <td valign="middle" align="left" width="100%"><b><?php echo $arrActions[$ID]; ?> </b></td> <td valign="middle" align="right" style="padding-right: 5px;"> <a id="showHide<?php echo $ID; ?> " href="" onclick="showHide('showHide<?php echo $ID; ?> ', 'actionRow<?php echo $ID; ?> '); return false;">Show</a> </td> <td> <form action="<?php echo $_SERVER['SCRIPT_NAME']; ?> ?edit=actions&edit_level=<?php echo $membershipID; ?> " method="POST" style="padding:0; margin:0;"> <input type="hidden" name="delete_action" value="yes" /> <input type="hidden" name="delete_action_id" value="<?php echo $ID; ?> " /> <input style="width: 57px" type="submit" value="Delete" /> </form> </td> </tr> </table> </div> <div class="actionRow" id="actionRow<?php echo $ID; ?> "> <form id="updateActionForm<?php echo $ID; ?> " action="<?php echo $_SERVER['SCRIPT_NAME']; ?> ?edit=actions&edit_level=<?php echo $membershipID; ?> " method="POST" style="padding:0; margin:0"> <input type="hidden" name="update_action" value="yes" /> <input type="hidden" name="update_action_id" value="<?php echo $ID; ?> " /> <table class="actionForm"> <tr> <td class="caption">Number of allowed actions:</td> <td class="allowedCnt"> <input id="allowedCnt<?php echo $ID; ?> " name="allowedCnt" value="<?php echo $arrAction['AllowedCount'] ? $arrAction['AllowedCount'] : 'no limit'; ?> " onfocus="clearUnlimited('allowedCnt<?php echo $ID; ?> ')" onblur="fillUnlimited('allowedCnt<?php echo $ID; ?> ')" <?php echo $membershipID == $IDNonMember ? 'disabled' : ''; ?> /> </td> </tr> <tr> <td class="caption">Number of actions is reset every:</td> <td class="period"> <input id="period<?php echo $ID; ?> " name="period" value="<?php echo $arrAction['AllowedPeriodLen'] ? $arrAction['AllowedPeriodLen'] : 'no limit'; ?> " onfocus="clearUnlimited('period<?php echo $ID; ?> ')" onblur="fillUnlimited('period<?php echo $ID; ?> ')" <?php echo $membershipID == $IDNonMember ? 'disabled' : ''; ?> /> hours </td> </tr> <tr> <td class="caption">This action is available since:</td> <td class="dateStart"> <table cellpadding="0" cellspacing="0" border="0"> <tr> <td> <input style="width: 130px" id="dateStart<?php echo $ID; ?> " name="dateStart" value="<?php echo $arrAction['AllowedPeriodStart'] ? $arrAction['AllowedPeriodStart'] : 'no limit'; ?> " onfocus="clearUnlimited('dateStart<?php echo $ID; ?> ')" onblur="fillUnlimited('dateStart<?php echo $ID; ?> ')" /> </td> <td> <input style="width: 70px" type="button" id="dateStart<?php echo $ID; ?> trigger" value="Choose"/> </td> <td> <input style="width: 70px" type="button" onclick="document.getElementById('dateStart<?php echo $ID; ?> ').value = 'no limit'" value="Clear"/> </td> </tr> </table> </td> </tr> <tr> <td class="caption">This action is available until:</td> <td class="dateEnd"> <table cellpadding="0" cellspacing="0" border="0"> <tr> <td> <input style="width: 130px" id="dateEnd<?php echo $ID; ?> " name="dateEnd" value="<?php echo $arrAction['AllowedPeriodEnd'] ? $arrAction['AllowedPeriodEnd'] : 'no limit'; ?> " onfocus="clearUnlimited('dateEnd<?php echo $ID; ?> ')" onblur="fillUnlimited('dateEnd<?php echo $ID; ?> ')" /> </td> <td> <input style="width: 70px" type="button" id="dateEnd<?php echo $ID; ?> trigger" value="Choose"/> </td> <td> <input style="width: 70px" type="button" onclick="document.getElementById('dateEnd<?php echo $ID; ?> ').value = 'no limit'" value="Clear"/> </td> </tr> </table> </td> </tr> <?php if (!is_null($arrAction['AdditionalParamName'])) { ?> <tr> <td class="caption"><?php echo htmlspecialchars($arrAction['AdditionalParamName']); ?> </td> <td class="additionalParam"> <input style="width: 130px" type="text" name="additionalParamValue" value="<?php echo htmlspecialchars($arrAction['AdditionalParamValue']); ?> " /> </td> </tr> <?php } ?> <tr> <td colspan="2" align="center"> <input style="width: 160px" type="submit" value="Save action settings" onclick="clearFormUnlimited('updateActionForm<?php echo $ID; ?> ')"/> </td> </tr> </table> </div> <script type="text/javascript"> //<![CDATA[ Zapatec.Calendar.setup({ firstDay : 1, weekNumbers : true, showOthers : true, showsTime : true, timeFormat : "24", step : 2, range : [1900.01, 2999.12], electric : false, singleClick : true, inputField : "dateStart<?php echo $ID; ?> ", button : "dateStart<?php echo $ID; ?> trigger", ifFormat : "%Y-%m-%d %H:%M:%S", daFormat : "%Y/%m/%d", align : "Br" }); Zapatec.Calendar.setup({ firstDay : 1, weekNumbers : true, showOthers : true, showsTime : true, timeFormat : "24", step : 2, range : [1900.01, 2999.12], electric : false, singleClick : true, inputField : "dateEnd<?php echo $ID; ?> ", button : "dateEnd<?php echo $ID; ?> trigger", ifFormat : "%Y-%m-%d %H:%M:%S", daFormat : "%Y/%m/%d", align : "Br" }); //]]> </script> </form> <?php } if (!count($arrLevelActions)) { ?> <div align="center">No actions allowed for this membership</div> <?php } ?> <!-- </div></div> <div style="padding: 0"><img src="images/foot_block_green.gif" height="6" width="602"></div> --> <?php ContentBlockFoot(); $contents = ob_get_contents(); ob_end_clean(); return $contents; }
/** * print list of the table date */ function PrintData() { global $fields_types; global $fields_titles; global $fields_sizes; global $fields_align; global $class_titles; global $class_data; global $class_error; global $table_width; global $use_table; global $allow_delete; global $allow_edit; $query = "SELECT * FROM {$use_table}"; $res = db_res($query); if (!mysql_num_rows($res)) { echo "<div align=center class=\"err\">No data available</div>"; return; } echo "<table cellspacing=2 cellpadding=1 class=\"text\" width=\"{$table_width}\" align=\"center\">\n\n"; // print titles echo "<tr class=\"{$class_titles}\">\n"; if ($allow_delete) { echo "<form name=\"rows_form\" method=\"POST\" action=\"quotes.php\">"; echo "<td> </td>\n"; } foreach ($fields_titles as $k => $v) { echo "\t<td width=\"{$fields_sizes[$k]}\" align=\"{$fields_align[$k]}\">{$v}</td>\n"; } if ($allow_edit) { echo "<td> </td>\n"; } echo "</tr>\n\n"; // print data while ($row = mysql_fetch_array($res)) { if ($row[get_index_fieldname()] == $_GET['index_field'] || $row[get_index_fieldname()] == $_POST['index_field']) { echo "<tr class=\"{$class_error}\">\n"; } else { echo "<tr class=\"{$class_data}\">\n"; } // checkboxes if ($allow_delete) { echo "<td align=center><input type=checkbox name=\"" . $row[get_index_fieldname()] . "\"></td>\n"; } // data foreach ($fields_sizes as $k => $v) { echo "\t<td width=\"{$v}\" align=\"{$fields_align[$k]}\">" . process_text_output($row[$k]) . "</td>\n"; } // edit button if ($allow_edit) { echo "<td align=center><a href=\"?action=edit&index_field=" . $row[get_index_fieldname()] . "\">Edit</a></td>\n"; } echo "</tr>\n\n"; } echo "</table>\n\n"; if ($allow_delete) { echo get_checkbox_menu() . "</form>"; } ContentBlockFoot(); }