function getBlockCode_Classifieds() { if ($this->iMember > 0) { $sqlQuery = "\r\n\t\t\t\tSELECT DISTINCT\r\n\t\t\t\tCOUNT(`ClassifiedsAdvertisements`.`ID`)\r\n\t\t\t\tFROM `ClassifiedsAdvertisements`\r\n\t\t\t\tWHERE\r\n\t\t\t\t`ClassifiedsAdvertisements`.`IDProfile` = '{$this->iMember}' AND `ClassifiedsAdvertisements`.`Status` = 'active'\r\n\t\t\t\tGROUP BY `ClassifiedsAdvertisements`.`ID`\r\n\t\t\t"; $iBlogs = db_value($sqlQuery); if ($iBlogs > 0) { $oClassifieds = new BxDolClassifieds(); $sBlocks = $oClassifieds->GenAnyBlockContent('last', $this->iMember); $ret = <<<EOF <div id="container_classifieds"> \t{$sBlocks} </div> EOF; $show_hide = $this->genShowHideItem('container_classifieds'); $sShowHide = $show_hide; return $ret; } else { return ''; } } else { return MsgBox(_t('_im_textNoCurrUser')); } }
* Dolphin is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * See the GNU General Public License for more details. * You should have received a copy of the GNU General Public License along with Dolphin, * see license.txt file; if not, write to marketing@boonex.com ***************************************************************************/ require_once 'inc/header.inc.php'; require_once BX_DIRECTORY_PATH_INC . 'design.inc.php'; require_once BX_DIRECTORY_PATH_INC . 'admin.inc.php'; require_once BX_DIRECTORY_PATH_CLASSES . 'BxDolClassifieds.php'; // --------------- page variables and login $_page['name_index'] = 151; $_page['css_name'] = 'classifieds_view.css'; $_page['extra_js'] = $oTemplConfig->sTinyMceEditorJS; check_logged(); $oClassifieds = new BxDolClassifieds(); $_page['header'] = $oClassifieds->GetHeaderString(); //_t( "_CLASSIFIEDS_VIEW_H" ); $_page['header_text'] = $oClassifieds->GetHeaderString(); $_ni = $_page['name_index']; $_page_cont[$_ni]['page_main_code'] = PageCompPageMainCode(); PageCode(); /** * Generating Main page code * * @return ALL presentation of data */ function PageCompPageMainCode() { $sRetHtml = ''; global $oClassifieds;
/** * 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 showBlockClassifieds($sCaption, $bNoDB = false) { global $site; $ID = $this->_iProfileID; if ($ID > 0) { $sQuery = "\r\n\t\t\t\tSELECT DISTINCT\r\n\t\t\t\tCOUNT(*)\r\n\t\t\t\tFROM `ClassifiedsAdvertisements`\r\n\t\t\t\tWHERE\r\n\t\t\t\t`ClassifiedsAdvertisements`.`IDProfile` = '{$ID}' AND `ClassifiedsAdvertisements`.`Status` = 'active'\r\n\t\t\t\tGROUP BY `ClassifiedsAdvertisements`.`ID`\r\n\t\t\t"; $iBlogs = db_value($sQuery); if ($iBlogs > 0) { $oClassifieds = new BxDolClassifieds(); $sBlocks = $oClassifieds->GenAnyBlockContent('last', $ID); $ret = <<<EOF <div id="container_classifieds"> \t{$sBlocks} </div> EOF; $show_hide = $this->genShowHideItem('container_classifieds'); if ($bNoDB) { return $ret; } else { echo DesignBoxContent(_t($sCaption), $ret, 1, $show_hide); } } else { return; } } else { if ($bNoDB) { return MsgBox(_t('_im_textNoCurrUser')); } else { echo MsgBox(_t('_im_textNoCurrUser')); } } }
function PageCompClassifieds($sCaption, &$sShowHide) { global $site; global $short_date_format; global $p_arr; $php_date_format = getParam('php_date_format'); //$iBlogLimitChars = (int)getParam("max_classified_preview"); $iBlogLimitChars = (int) getParam("max_blog_preview"); $ID = $p_arr['ID']; if ($ID > 0) { $sQuery = "\r\n\t\t\t\tSELECT DISTINCT\r\n\t\t\t\t`ClassifiedsAdvertisements`.`ID`,\r\n\t\t\t\t`ClassifiedsAdvertisements`.`Subject`,\r\n\t\t\t\t`ClassifiedsAdvertisements`.`Media`,\r\n\t\t\t\t`Profiles`.`NickName`,\r\n\t\t\t\tUNIX_TIMESTAMP( `ClassifiedsAdvertisements`.`DateTime` ) as `DateTime_f`,\r\n\t\t\t\t`ClassifiedsAdvertisements`.`DateTime`,\r\n\t\t\t\t`Classifieds`.`Name`, `Classifieds`.`ID` AS `CatID`,\r\n\t\t\t\t`ClassifiedsSubs`.`NameSub`, `ClassifiedsSubs`.`ID` AS `SubCatID`,\r\n\t\t\t\t`ClassifiedsAdvertisements`.`Message`,\r\n\t\t\t\tCOUNT(`ClsAdvComments`.`ID`) AS 'CommCount'\r\n\t\t\t\tFROM `ClassifiedsAdvertisements`\r\n\t\t\t\tLEFT JOIN `ClassifiedsSubs`\r\n\t\t\t\tON `ClassifiedsSubs`.`ID`=`ClassifiedsAdvertisements`.`IDClassifiedsSubs`\r\n\t\t\t\tLEFT JOIN `Classifieds`\r\n\t\t\t\tON `Classifieds`.`ID`=`ClassifiedsSubs`.`IDClassified`\r\n\t\t\t\tLEFT JOIN `Profiles` ON `Profiles`.`ID`=`ClassifiedsAdvertisements`.`IDProfile`\r\n\t\t\t\tLEFT JOIN `ClsAdvComments` ON `ClsAdvComments`.`IDAdv`=`ClassifiedsAdvertisements`.`ID`\r\n\t\t\t\tWHERE\r\n\t\t\t\t`ClassifiedsAdvertisements`.`IDProfile` = '{$ID}' AND\r\n\t\t\t\t`ClassifiedsAdvertisements`.`Status` = 'active'\r\n\t\t\t\tGROUP BY `ClassifiedsAdvertisements`.`ID`\r\n\t\t\t\tORDER BY `DateTime` DESC\r\n\t\t\t\tLIMIT 5\r\n\t\t\t"; $rBlogs = db_res($sQuery); if (!mysql_num_rows($rBlogs)) { return ''; } ob_start(); ?> <div id="container_classifieds"> <?php $oClassifieds = new BxDolClassifieds(); while ($aBlog = mysql_fetch_assoc($rBlogs)) { $sPic = $oClassifieds->getImageCode($aBlog['Media'], TRUE); $sLinkMore = ''; if (strlen($aBlog['Message']) > $iBlogLimitChars) { //$sLinkMore = "... <a href=\"".$site['url']."blog.php?owner=".$ID."&show=blog&blogID=".$aBlog['PostID']."\">"._t('_Read more')."</a>"; $sLinkMore = "... <a href=\"" . $site['url'] . "classifieds.php?ShowAdvertisementID=" . $aBlog['ID'] . "\">" . _t('_Read more') . "</a>"; } $sBlogSnippet = substr(strip_tags($aBlog['Message']), 0, $iBlogLimitChars) . $sLinkMore; ?> <div class="icon_block"> <div class="thumbnail_block" style="float:left;"> <?php echo '<a href="' . $site['url'] . 'classifieds.php?ShowAdvertisementID=' . $aBlog['ID'] . '" class="bottom_text">'; ?> <?php echo $sPic; ?> </a> </div> </div> <div class="blog_wrapper_n"> <div class="blog_subject_n"> <?php echo '<a href="' . $site['url'] . 'classifieds.php?ShowAdvertisementID=' . $aBlog['ID'] . '" class="bottom_text">'; ?> <?php echo $aBlog['Subject']; ?> </a> </div> <div class="blogInfo"> <span><img src="<?php echo getTemplateIcon('clock.gif'); ?> " /><?php echo date($php_date_format, $aBlog['DateTime_f']) . ' '; ?> </span> <span><?php echo _t('_in Category', getTemplateIcon('ad_category.gif'), 'classifieds.php?bClassifiedID=' . $aBlog['CatID'], process_line_output($aBlog['Name'])) . ' / ' . '<a href="classifieds.php?bSubClassifiedID=' . $aBlog['SubCatID'] . '">' . process_line_output($aBlog['NameSub']) . '</a>'; ?> </span> <span><?php echo _t('_comments N', getTemplateIcon('add_comment.gif'), $aBlog['CommCount']); ?> </span> </div> <div class="blogSnippet"> <?php echo $sBlogSnippet; ?> </div> </div> <div class="clear_both"></div> <?php } ?> </div> <?php $ret = ob_get_clean(); $show_hide = genShowHideItem('container_classifieds'); $sShowHide = $show_hide; return $ret; } else { return MsgBox(_t('_im_textNoCurrUser')); } //return DesignBoxContent( _t( $sCaption ), $ret, 1, $show_hide ); }
function profile_delete($ID) { global $MySQL; global $dir; global $site; global $logged; $ID = (int) $ID; if (!$ID) { return false; } if (!getProfileInfo($ID)) { return false; } modules_del($ID); db_res("DELETE FROM `VKisses` WHERE `ID` = '{$ID}' OR `Member` = '{$ID}'"); db_res("DELETE FROM `Profiles` WHERE `ID` = '{$ID}'"); if (!mysql_affected_rows()) { return false; } db_res("DELETE FROM `BlockList` WHERE `ID` = '{$ID}' OR `Profile` = '{$ID}';"); db_res("DELETE FROM `ProfilesTrack` WHERE `Member` = '{$ID}' OR `Profile` = '{$ID}'"); db_res("DELETE FROM `Messages` WHERE Recipient = {$ID} "); db_res("DELETE FROM `Guestbook` WHERE Recipient = {$ID} "); db_res("DELETE FROM `aff_members` WHERE idProfile = {$ID}"); db_res("DELETE FROM `HotList` WHERE ID = {$ID} OR Profile = {$ID}"); db_res("DELETE FROM `FriendList` WHERE ID = {$ID} OR Profile = {$ID}"); db_res("DELETE FROM `BlockList` WHERE ID = {$ID} OR Profile = {$ID}"); db_res("DELETE FROM `BoughtContacts` WHERE `IDBuyer` = {$ID} OR `IDContact` = {$ID}"); db_res("DELETE FROM `ProfileMemLevels` WHERE `IDMember` = {$ID}"); db_res("DELETE FROM `ProfilesComments` WHERE `Sender` = {$ID} OR `Recipient` = {$ID}"); db_res("DELETE FROM `ProfilesPolls` WHERE `id_profile` = {$ID}"); db_res("DELETE FROM `Tags` WHERE `ID` = {$ID} AND `Type` = 'profile'"); db_res("DELETE FROM `GroupsMembers` WHERE `memberID` = {$ID}"); // delete profile votings require_once BX_DIRECTORY_PATH_CLASSES . 'BxDolVoting.php'; $oVotingProfile = new BxDolVoting('profile', 0, 0); $oVotingProfile->deleteVotings($ID); // delete profile comments require_once BX_DIRECTORY_PATH_CLASSES . 'BxDolCmts.php'; $oCmts = new BxDolCmts('profile', $ID); $oCmts->onObjectDelete(); // delete all comments in all comments' systems, this user posted $oCmts->onAuthorDelete($ID); // Clean gallery $albumsRes = db_res("SELECT `ID` FROM `GalleryAlbums` WHERE `IDMember` = {$ID}"); while ($albumArr = mysql_fetch_assoc($albumsRes)) { $albumID = $albumArr['ID']; $objectsRes = db_res("SELECT `Filename`, `ThumbFilename` FROM `GalleryObjects` WHERE `IDAlbum` = {$albumID}"); while ($objectArr = mysql_fetch_assoc($objectsRes)) { @unlink("{$dir['gallery']}{$objectArr['Filename']}"); if (strlen($objectArr['ThumbFilename']) && file_exists("{$dir['gallery']}{$objectArr['ThumbFilename']}")) { @unlink("{$dir['gallery']}{$objectArr['ThumbFilename']}"); } } db_res("DELETE FROM `GalleryObjects` WHERE `IDAlbum` = {$albumID}"); } db_res("DELETE FROM `GalleryAlbums` WHERE `IDMember` = {$ID}"); // Clean customizations $customArr = db_arr("SELECT `BackgroundFilename` FROM `ProfilesSettings` WHERE `IDMember` = {$ID}"); if (strlen($customArr['BackgroundFilename']) && file_exists($dir['profileImage'] . $customArr['BackgroundFilename']) && is_file($dir['profileImage'] . $customArr['BackgroundFilename'])) { unlink($dir['profileImage'] . $customArr['BackgroundFilename']); } db_res("DELETE FROM `ProfilesSettings` WHERE `IDMember` = {$ID}"); // delete media $rMedia = db_res("SELECT `med_id`, `med_file`, `med_type` FROM `media` WHERE `med_prof_id` = {$ID}"); $oVotingMedia = new BxDolVoting('media', 0, 0); while ($aMedia = mysql_fetch_assoc($rMedia)) { switch ($aMedia['med_type']) { case 'photo': $medDir = $dir['profileImage'] . $ID . "/"; @unlink($medDir . 'icon_' . $aMedia['med_file']); @unlink($medDir . 'photo_' . $aMedia['med_file']); @unlink($medDir . 'thumb_' . $aMedia['med_file']); break; case 'audio': $medDir = $dir['profileSound'] . $ID . "/"; @unlink($medDir . $aMedia['med_file']); break; case 'video': $medDir = $dir['profileVideo'] . $ID . "/"; @unlink($medDir . $aMedia['med_file']); break; } // delete media voting $oVotingMedia->deleteVotings($aMedia['med_id']); } $aMem = array(); $aMedia = array('photo', 'music', 'video'); foreach ($aMedia as $sVal) { $oMedia = new BxDolSharedMedia($sVal, $site, $dir, $aMem); $oMedia->deleteUserGallery($ID, $logged); } db_res("DELETE FROM `media` WHERE `med_prof_id` = {$ID}"); @rmdir($dir['profileImage'] . $ID); @rmdir($dir['profileVideo'] . $ID); @rmdir($dir['profileSound'] . $ID); //Clean blogs $aBlog = db_arr("SELECT `ID` FROM `Blogs` WHERE `OwnerID` = {$ID}"); $iBlogID = $aBlog['ID']; if ($iBlogID > 0) { //Clean blogs $oBlogs = new BxDolBlogs(TRUE); $oBlogs->bAdminMode = TRUE; (int) ($_REQUEST['DeleteBlogID'] = $iBlogID); $oBlogs->ActionDeleteBlogSQL(); } //delete user classifieds $oClassifieds = new BxDolClassifieds(); $oClassifieds->bAdminMode = TRUE; $oClassifieds->DeleteProfileAdvertisement($ID); //delete user events $oEvents = new BxDolEvents(); $oEvents->bAdminMode = TRUE; $oEvents->DeleteProfileEvents($ID); //delete cache file $sCacheFile = $dir['cache'] . 'user' . $ID . '.php'; @unlink($sCacheFile); reparseObjTags('profile', $ID); }
function getBlockCode_Classifieds() { global $site; $mode = $_REQUEST['classifieds_mode']; if ($mode != 'rand' and $mode != 'latest' and $mode != 'top') { $mode = 'latest'; } $aDBTopMenu = array(); //$menu = '<div class="dbTopMenu">'; foreach (array('latest', 'top', 'rand') as $myMode) { switch ($myMode) { case 'top': $sTabTitle = _t('_Top'); break; case 'latest': $sTabTitle = _t('_Latest'); break; case 'rand': $sTabTitle = _t('_Random'); break; } $aDBTopMenu[$sTabTitle] = array('href' => "{$_SERVER['PHP_SELF']}?classifieds_mode={$myMode}", 'dynamic' => true, 'active' => $myMode == $mode); /*if( $mode == $myMode ) { $menu .= "<div class=\"active\">$sTabTitle</div>"; } else { $menu .= " <div class=\"notActive\"> <a href=\"{$_SERVER['PHP_SELF']}?classifieds_mode=$myMode\" class=\"top_members_menu\" onclick=\"getHtmlData( 'show_classifieds', this.href+'&show_only=classifieds'); return false;\">$sTabTitle</a> </div>"; }*/ } /*$menu .= ' <div class="clear_both"></div> </div>';*/ $iTotalNum = db_value("SELECT COUNT(*) FROM `ClassifiedsAdvertisements`\r\n\t\t\t\tWHERE DATE_ADD( `ClassifiedsAdvertisements`.`DateTime` , INTERVAL `ClassifiedsAdvertisements`.`LifeTime` DAY ) > NOW( )\r\n\t\t\t\tAND `ClassifiedsAdvertisements`.`Status` = 'active'\r\n\t\t\t"); $oClassifieds = new BxDolClassifieds(); $oClassifieds->UseDefaultCF(); if ($iTotalNum) { $iResPerPage = (int) getParam("max_blogs_on_home"); $iTotalPages = ceil($iTotalNum / $iResPerPage); $page = (int) $_REQUEST['classifieds_page']; if ($page < 1 or $mode == 'rand') { $page = 1; } if ($page > $iTotalPages) { $page = $iTotalPages; } $sqlLimitFrom = ($page - 1) * $iResPerPage; $sBlocks = $oClassifieds->GenAnyBlockContent($mode, 0, "LIMIT {$sqlLimitFrom}, {$iResPerPage}"); $ret = $sBlocks; } else { $ret .= '<div class="no_result"><div>' . _t("_No classifieds available") . '</div></div>'; } $aDBBottomMenu = array(); if ($iTotalPages > 1) { //$ret .= '<div class="dbBottomMenu">'; if ($page > 1) { $prevPage = $page - 1; $aDBBottomMenu[_t('_Back')] = array('href' => "{$_SERVER['PHP_SELF']}?classifieds_mode={$mode}&classifieds_page={$prevPage}", 'dynamic' => true, 'class' => 'backMembers'); //$sBackC = _t('_Back'); /*$retR .= <<<EOF <a href="{$_SERVER['PHP_SELF']}?classifieds_mode={$mode}&classifieds_page={$prevPage}" class="backMembers" onclick="getHtmlData( 'show_classifieds', this.href+'&show_only=classifieds'); return false;"> {$sBackC} </a> EOF;*/ } if ($page < $iTotalPages) { $nextPage = $page + 1; $aDBBottomMenu[_t('_Next')] = array('href' => "{$_SERVER['PHP_SELF']}?classifieds_mode={$mode}&classifieds_page={$nextPage}", 'dynamic' => true, 'class' => 'moreMembers'); /*$sNextC = _t('_Next'); $retR .= <<<EOF <a href="{$_SERVER['PHP_SELF']}?classifieds_mode={$mode}&classifieds_page={$nextPage}" class="moreMembers" onclick="getHtmlData( 'show_classifieds', this.href+'&show_only=classifieds'); return false;"> {$sNextC} </a> EOF;*/ } $sBMViewAllLink = $oClassifieds->bUseFriendlyLinks ? "{$site['url']}ads/" : "{$site['url']}classifieds.php?Browse=1"; $aDBBottomMenu[_t('_View All')] = array('href' => $sBMViewAllLink, 'dynamic' => false, 'class' => 'viewAllMembers'); //$ret .= '<div class="clear_both"></div></div>'; } //return $ret; return array($ret, $aDBTopMenu, $aDBBottomMenu); }
function PageCompClassifiedsContent($sCaption) { global $site; global $date_format; $php_date_format = getParam('php_date_format'); $mode = $_REQUEST['classifieds_mode']; if ($mode != 'rand' and $mode != 'latest' and $mode != 'top') { $mode = 'latest'; } $menu = '<div class="dbTopMenu">'; foreach (array('latest', 'top', 'rand') as $myMode) { switch ($myMode) { case 'top': $OrderBy = '`CommCount` DESC'; $sTabTitle = _t('_Top'); break; case 'latest': $OrderBy = '`DateTime` DESC'; $sTabTitle = _t('_Latest'); break; case 'rand': $OrderBy = 'RAND()'; $sTabTitle = _t('_Random'); break; } if ($mode == $myMode) { $sqlOrderBy = $OrderBy; $menu .= "\r\n\t\t\t<div class=\"active\">{$sTabTitle}</div>"; } else { $menu .= "\r\n\t\t\t<div class=\"notActive\">\r\n\t\t\t\t<a href=\"{$_SERVER['PHP_SELF']}?classifieds_mode={$myMode}\" class=\"top_members_menu\" onclick=\"getHtmlData( 'show_classifieds', this.href+'&show_only=classifieds'); return false;\">{$sTabTitle}</a>\r\n\t\t\t</div>"; } } $menu .= ' <div class="clear_both"></div> </div>'; $aTotalNum = db_arr("\r\n\t\tSELECT\r\n\t\t\tCOUNT(*) FROM `ClassifiedsAdvertisements`\r\n\t\tWHERE\r\n\t\t\t`Status` = 'active'\r\n\t\t"); $iTotalNum = $aTotalNum[0]; if ($iTotalNum) { //$iResPerPage = (int)getParam("max_classifieds_on_home"); $iResPerPage = (int) getParam("max_blogs_on_home"); //$iResPerPage = 3; $iTotalPages = ceil($iTotalNum / $iResPerPage); $page = (int) $_REQUEST['classifieds_page']; if ($page < 1 or $mode == 'rand') { $page = 1; } if ($page > $iTotalPages) { $page = $iTotalPages; } $sqlLimitFrom = ($page - 1) * $iResPerPage; //$iBlogLimitChars = (int)getParam("max_classified_preview"); $iBlogLimitChars = (int) getParam("max_blog_preview"); //$iBlogLimitChars = 50; $sBlogQuery = "\r\n\t\t\tSELECT DISTINCT\r\n\t\t\t`ClassifiedsAdvertisements`.`ID`,\r\n\t\t\t`ClassifiedsAdvertisements`.`Subject`,\r\n\t\t\t`ClassifiedsAdvertisements`.`Media`,\r\n\t\t\t`Profiles`.`NickName`,\r\n\t\t\tUNIX_TIMESTAMP( `ClassifiedsAdvertisements`.`DateTime` ) as `DateTime_f`,\r\n\t\t\t`ClassifiedsAdvertisements`.`DateTime`,\r\n\t\t\t`Classifieds`.`Name`, `Classifieds`.`ID` AS `CatID`,\r\n\t\t\t`ClassifiedsSubs`.`NameSub`, `ClassifiedsSubs`.`ID` AS `SubCatID`,\r\n\t\t\tLEFT(`ClassifiedsAdvertisements`.`Message`, {$iBlogLimitChars}) as 'Message', \r\n\t\t\tCOUNT(`ClsAdvComments`.`ID`) AS 'CommCount'\r\n\t\t\tFROM `ClassifiedsAdvertisements`\r\n\t\t\tLEFT JOIN `ClassifiedsSubs`\r\n\t\t\tON `ClassifiedsSubs`.`ID`=`ClassifiedsAdvertisements`.`IDClassifiedsSubs`\r\n\t\t\tLEFT JOIN `Classifieds`\r\n\t\t\tON `Classifieds`.`ID`=`ClassifiedsSubs`.`IDClassified`\r\n\t\t\tLEFT JOIN `Profiles` ON `Profiles`.`ID`=`ClassifiedsAdvertisements`.`IDProfile`\r\n\t\t\tLEFT JOIN `ClsAdvComments` ON `ClsAdvComments`.`IDAdv`=`ClassifiedsAdvertisements`.`ID`\r\n\t\t\tGROUP BY `ClassifiedsAdvertisements`.`ID`\r\n\t\t\tORDER BY {$sqlOrderBy}\r\n\t\t\tLIMIT {$sqlLimitFrom}, {$iResPerPage}\r\n\t\t"; $rBlog = db_res($sBlogQuery); $ret = ''; $oClassifieds = new BxDolClassifieds(); $ret .= '<div class="clear_both"></div>'; while ($arr = mysql_fetch_array($rBlog)) { if ($mode == 'top' && $arr['CommCount'] == 0) { continue; } $sPic = $oClassifieds->getImageCode($arr['Media'], TRUE); $sLinkMore = ''; if (strlen($arr['Message']) == $iBlogLimitChars) { $sLinkMore = "... <a href=\"" . $site['url'] . "classifieds.php?ShowAdvertisementID=" . $arr['ID'] . "\">" . _t('_Read more') . "</a>"; } $ret .= ' <div class="icon_block"> <div class="thumbnail_block" style="float:left;"> <a href="' . $site['url'] . 'classifieds.php?ShowAdvertisementID=' . $arr['ID'] . '" class="bottom_text"> ' . $sPic . ' </a> </div> </div> <div class="blog_wrapper_n"> <div class="blog_subject_n"> <a href="' . $site['url'] . 'classifieds.php?ShowAdvertisementID=' . $arr['ID'] . '" class="bottom_text">' . process_line_output($arr['Subject']) . '</a> </div> <div class="blog_author_n">' . '<span>' . _t('_By Author', $arr['NickName'], $arr['NickName']) . '</span>' . '<span><img src="' . getTemplateIcon('clock.gif') . '" />' . date($php_date_format, $arr['DateTime_f']) . '</span>' . '<span>' . _t('_in Category', getTemplateIcon('folder_small.png'), 'classifieds.php?bClassifiedID=' . $arr['CatID'], process_line_output($arr['Name'])) . ' / <a href="' . 'classifieds.php?bSubClassifiedID=' . $arr['SubCatID'] . '">' . process_line_output($arr['NameSub']) . '</a></span>' . '<span>' . _t('_comments N', getTemplateIcon('add_comment.gif'), (int) $arr['CommCount']) . '</span>' . '</div> <div class="blog_text_n">' . strip_tags(process_html_output($arr['Message'])) . $sLinkMore . '</div> </div>'; } $ret .= '<div class="clear_both"></div>'; } else { $ret .= '<div class="no_result"><div>' . _t("_No classifieds available") . '</div></div>'; } if ($iTotalPages > 1) { $ret .= ' <div class="dbBottomMenu">'; if ($page > 1) { $prevPage = $page - 1; $ret .= "\r\n\t\t\t\t<a href=\"{$_SERVER['PHP_SELF']}?classifieds_mode={$mode}&classifieds_page={$prevPage}\"\r\n\t\t\t\t class=\"backMembers\"\r\n\t\t\t\t onclick=\"getHtmlData( 'show_classifieds', this.href+'&show_only=classifieds'); return false;\">" . _t('_Back') . "</a>\r\n\t\t\t"; } if ($page < $iTotalPages) { $nextPage = $page + 1; $ret .= "\r\n\t\t\t\t<a href=\"{$_SERVER['PHP_SELF']}?classifieds_mode={$mode}&classifieds_page={$nextPage}\"\r\n\t\t\t\t class=\"moreMembers\"\r\n\t\t\t\t onclick=\"getHtmlData( 'show_classifieds', this.href+'&show_only=classifieds'); return false;\">" . _t('_Next') . "</a>\r\n\t\t\t"; } $ret .= ' <div class="clear_both"></div> </div>'; } return DesignBoxContent(_t($sCaption), $ret, 1, $menu); }