| 1 | <?
|
|---|
| 2 |
|
|---|
| 3 | /***************************************************************************
|
|---|
| 4 | * Dolphin Smart Community Builder
|
|---|
| 5 | * -------------------
|
|---|
| 6 | * begin : Mon Mar 23 2006
|
|---|
| 7 | * copyright : (C) 2007 BoonEx Group
|
|---|
| 8 | * website : http://www.boonex.com
|
|---|
| 9 | * This file is part of Dolphin - Smart Community Builder
|
|---|
| 10 | *
|
|---|
| 11 | * Dolphin is free software; you can redistribute it and/or modify it under
|
|---|
| 12 | * the terms of the GNU General Public License as published by the
|
|---|
| 13 | * Free Software Foundation; either version 2 of the
|
|---|
| 14 | * License, or any later version.
|
|---|
| 15 | *
|
|---|
| 16 | * Dolphin is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
|
|---|
| 17 | * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
|---|
| 18 | * See the GNU General Public License for more details.
|
|---|
| 19 | * You should have received a copy of the GNU General Public License along with Dolphin,
|
|---|
| 20 | * see license.txt file; if not, write to marketing@boonex.com
|
|---|
| 21 | ***************************************************************************/
|
|---|
| 22 |
|
|---|
| 23 | require_once( 'inc/header.inc.php' );
|
|---|
| 24 | require_once( BX_DIRECTORY_PATH_INC . 'design.inc.php' );
|
|---|
| 25 | require_once( BX_DIRECTORY_PATH_INC . 'admin.inc.php' );
|
|---|
| 26 | require_once( BX_DIRECTORY_PATH_CLASSES . 'BxDolClassifieds.php' );
|
|---|
| 27 |
|
|---|
| 28 | // --------------- page variables and login
|
|---|
| 29 | $_page['name_index'] = 151;
|
|---|
| 30 | $_page['css_name'] = 'classifieds_view.css';
|
|---|
| 31 | $_page['extra_js'] = $oTemplConfig -> sTinyMceEditorJS;
|
|---|
| 32 |
|
|---|
| 33 | check_logged();
|
|---|
| 34 |
|
|---|
| 35 | $oClassifieds = new BxDolClassifieds();
|
|---|
| 36 | $oClassifieds -> sCurrBrowsedFile = $_SERVER['PHP_SELF'];
|
|---|
| 37 | $_page['header'] = $oClassifieds -> GetHeaderString();//_t( "_CLASSIFIEDS_VIEW_H" );
|
|---|
| 38 | $_page['header_text'] = $oClassifieds -> GetHeaderString();
|
|---|
| 39 |
|
|---|
| 40 | $_ni = $_page['name_index'];
|
|---|
| 41 | $_page_cont[$_ni]['page_main_code'] = PageCompPageMainCode();
|
|---|
| 42 |
|
|---|
| 43 | PageCode();
|
|---|
| 44 |
|
|---|
| 45 | /** |
|---|
| 46 | * Generating Main page code |
|---|
| 47 | * |
|---|
| 48 | * @return ALL presentation of data |
|---|
| 49 | */
|
|---|
| 50 | function PageCompPageMainCode() {
|
|---|
| 51 | $sRetHtml = '';
|
|---|
| 52 | global $oClassifieds;
|
|---|
| 53 | //$oClassifieds -> sCurrBrowsedFile = $_SERVER['PHP_SELF'];
|
|---|
| 54 | $sRetHtml .= $oClassifieds -> PrintCommandForms();
|
|---|
| 55 |
|
|---|
| 56 | if ($_REQUEST) {
|
|---|
| 57 | if (isset($_GET['PostAd'])) {
|
|---|
| 58 | if (((int)$_GET['PostAd']) == 1) {
|
|---|
| 59 | $sRetHtml .= $oClassifieds -> PrintPostAdForm();
|
|---|
| 60 | }
|
|---|
| 61 | }
|
|---|
| 62 | elseif (isset($_GET['MyAds'])) {
|
|---|
| 63 | if (((int)$_GET['MyAds']) == 1) {
|
|---|
| 64 | $oClassifieds -> UseDefaultCF();
|
|---|
| 65 | $sRetHtml .= $oClassifieds -> PrintMyAds();
|
|---|
| 66 | }
|
|---|
| 67 | }
|
|---|
| 68 | elseif (isset($_POST['PostAdMessage'])) {
|
|---|
| 69 | if ($_POST['PostAdMessage'] == 'Send') {
|
|---|
| 70 | $arrPostAdv = $oClassifieds -> FillPostAdvertismentArrByPostValues();//validating
|
|---|
| 71 | $arrErr = $oClassifieds -> checkGroupErrors( $arrPostAdv );
|
|---|
| 72 | if( empty( $arrErr ) ) {
|
|---|
| 73 | $oClassifieds -> UseDefaultCF();
|
|---|
| 74 | $sRetHtml .= $oClassifieds -> ActionPostAdMessage();
|
|---|
| 75 | }
|
|---|
| 76 | else {
|
|---|
| 77 | $sRetHtml .= $oClassifieds -> PrintPostAdForm($arrErr);
|
|---|
| 78 | }
|
|---|
| 79 | }
|
|---|
| 80 | }
|
|---|
| 81 | elseif (isset($_POST['EditAdvertisementID'])) {
|
|---|
| 82 | if (((int)$_POST['EditAdvertisementID']) > 0) {
|
|---|
| 83 | $sRetHtml .= $oClassifieds -> PrintEditForm((int)$_POST['EditAdvertisementID']);
|
|---|
| 84 | //$oClassifieds -> UseDefaultCF();
|
|---|
| 85 | //$sRetHtml .= $oClassifieds -> PrintBackLink2Adv((int)$_POST['EditAdvertisementID']);
|
|---|
| 86 | }
|
|---|
| 87 | }
|
|---|
| 88 | elseif (isset($_POST['UpdatedAdvertisementID'])) {
|
|---|
| 89 | $id = (int)$_POST['UpdatedAdvertisementID'];
|
|---|
| 90 | if ($id > 0) {
|
|---|
| 91 | if (isset($_REQUEST['DeletedPictureID']) && (int)$_REQUEST['DeletedPictureID']>0) {
|
|---|
| 92 | //delete a pic
|
|---|
| 93 | $sRetHtml .= $oClassifieds->ActionDeletePicture();
|
|---|
| 94 | $sRetHtml .= $oClassifieds -> PrintEditForm($id, $arrErr);
|
|---|
| 95 | //break;
|
|---|
| 96 | } else {
|
|---|
| 97 | $arrPostAdv = $oClassifieds -> FillPostAdvertismentArrByPostValues();//validating
|
|---|
| 98 | $arrErr = $oClassifieds -> checkGroupErrors( $arrPostAdv, TRUE );
|
|---|
| 99 |
|
|---|
| 100 | if( empty( $arrErr ) ) {
|
|---|
| 101 | $sRetHtml .= $oClassifieds -> ActionUpdateAdvertisementID($id);
|
|---|
| 102 | }
|
|---|
| 103 | else {
|
|---|
| 104 | $sRetHtml .= $oClassifieds -> PrintEditForm($id, $arrErr);
|
|---|
| 105 | $oClassifieds -> UseDefaultCF();
|
|---|
| 106 | $sRetHtml .= $oClassifieds -> PrintBackLink2Adv($id);
|
|---|
| 107 | }
|
|---|
| 108 | }
|
|---|
| 109 | }
|
|---|
| 110 | }
|
|---|
| 111 | elseif (isset($_POST['DeleteAdvertisementID'])) {
|
|---|
| 112 | $id = (int)$_POST['DeleteAdvertisementID'];
|
|---|
| 113 | if ($id > 0) {
|
|---|
| 114 | $sRetHtml .= $oClassifieds -> ActionDeleteAdvertisement($id);
|
|---|
| 115 | }
|
|---|
| 116 | }
|
|---|
| 117 | }
|
|---|
| 118 | else {
|
|---|
| 119 | $sRetHtml .= _t("_WARNING");
|
|---|
| 120 | }
|
|---|
| 121 |
|
|---|
| 122 | return $sRetHtml;
|
|---|
| 123 | }
|
|---|
| 124 | ?> |
|---|