Пример #1
0
    /**
     * Draws listings in category
     * 		@param $category_id
     * 		@param $draw
     */
    public function DrawListings($category_id, $draw = true)
    {
        global $objLogin, $objSettings;
        $lang = Application::Get('lang');
        $nl = "\n";
        if (empty($lang)) {
            $lang = Languages::GetDefaultLang();
        }
        $listings_locations = isset($_REQUEST['listings_locations']) ? prepare_input($_REQUEST['listings_locations']) : '';
        $listings_sub_locations = isset($_REQUEST['listings_sub_locations']) ? prepare_input($_REQUEST['listings_sub_locations']) : '';
        $listings_sort_by = isset($_REQUEST['listings_sort_by']) && $_REQUEST['listings_sort_by'] != '' ? prepare_input($_REQUEST['listings_sort_by']) : 'rating';
        $listings_order_by = isset($_REQUEST['listings_order_by']) && $_REQUEST['listings_order_by'] != '' ? prepare_input($_REQUEST['listings_order_by']) : 'ASC';
        $sort_by = '';
        $order_by = '';
        $output = '';
        if ($listings_sort_by == 'name') {
            $sort_by = 'ld.business_name';
            $order_by = $listings_order_by;
        } else {
            if ($listings_sort_by == 'date') {
                $sort_by = 'l.date_published';
                $order_by = $listings_order_by;
            } else {
                if ($listings_sort_by == 'rating') {
                    // rating according to advertising plans high rate = high advertising plan
                    $sort_by = 'l.advertise_plan_id';
                    $order_by = ($listings_order_by == 'ASC' ? 'DESC' : 'ASC') . ', RAND()';
                } else {
                    $sort_by = 'l.priority_order';
                    $order_by = $listings_order_by;
                }
            }
        }
        if (!Application::Get('js_included', 'lytebox')) {
            $output .= '<!-- LyteBox v3.22 Author: Markus F. Hay Website: http://www.dolem.com/lytebox -->' . $nl;
            $output .= '<link rel="stylesheet" href="modules/lytebox/css/lytebox.css" type="text/css" media="screen" />' . $nl;
            $output .= '<script type="text/javascript" src="modules/lytebox/js/lytebox.js"></script>' . $nl;
        }
        // draw category description
        $category_info = Categories::GetCategoryInfo($category_id);
        if ($category_info['description'] != '') {
            $output .= draw_message($category_info['description'], false);
        }
        // draw result
        $sql_from = TABLE_LISTINGS . ' l 
					INNER JOIN ' . TABLE_LISTINGS_DESCRIPTION . ' ld ON l.id = ld.listing_id
					INNER JOIN ' . TABLE_LISTINGS_LOCATIONS . ' ll ON l.listing_location_id = ll.id
				WHERE
					' . (!empty($listings_locations) ? 'l.listing_location_id = \'' . $listings_locations . '\' AND ' : '') . '
					' . (!empty($listings_sub_locations) ? 'l.listing_sub_location_id = \'' . $listings_sub_locations . '\' AND ' : '') . '
					' . (!$objLogin->IsLoggedIn() ? 'l.access_level=\'public\' AND ' : '') . '
					l.is_published = 1 AND
					' . ($this->show_expired_listings != 'yes' ? ' ((l.finish_publishing = \'0000-00-00 00:00:00\') OR (l.finish_publishing > \'' . date('Y-m-d H:i:s') . '\')) AND ' : '') . '
					ld.language_id = \'' . $lang . '\'
					' . ($category_id != '' ? ' AND l.id IN (SELECT listing_id FROM ' . TABLE_LISTINGS_CATEGORIES . ' lc WHERE category_id = ' . (int) $category_id . ')' : '') . '
				ORDER BY ' . $sort_by . ' ' . $order_by;
        // pagination prepare
        $page_size = ModulesSettings::Get('listings', 'listings_per_page');
        $start_row = '0';
        $total_pages = '1';
        pagination_prepare($page_size, $sql_from, $start_row, $total_pages);
        $sql = 'SELECT l.id,
					l.image_file,
					l.image_file_thumb,
					l.priority_order,
					l.date_published,
					l.website_url,
					l.business_email,
					l.advertise_plan_id,
					ll.name as listing_location_name,
					ld.language_id,					
					ld.business_name,
					ld.business_address,
					ld.business_description
				FROM ' . $sql_from . '
				LIMIT ' . $start_row . ', ' . $page_size;
        $result = database_query($sql, DATA_AND_ROWS, ALL_ROWS);
        if ($result[1] > 0 || !empty($listings_locations)) {
            $output .= '<form id="frmCategoryView" action="index.php?page=category&cid=' . $category_id . '" method="post">';
            $output .= draw_token_field(false);
            $output .= draw_hidden_field('p', '1', false);
            $output .= '<table width="98%" border="0" align="center">';
            $output .= '<tr><th colspan="3" nowrap="nowrap" height="5px"></th></tr>';
            $output .= '<tr><th colspan="2" align="' . Application::Get('defined_left') . '" valign="middle">';
            $output .= '&nbsp;' . _FILTER_BY . ': ';
            $output .= ListingsLocations::DrawAllLocations(array('tag_name' => 'listings_locations', 'selected_value' => $listings_locations, 'javascript_event' => 'onchange="jQuery(\'#frmCategoryView\').submit();"'), false) . ' &nbsp;';
            $output .= ListingsSubLocations::DrawAllSubLocations($listings_locations, array('tag_name' => 'listings_sub_locations', 'selected_value' => $listings_sub_locations, 'javascript_event' => 'onchange="jQuery(\'#frmCategoryView\').submit();"'), false);
            $output .= '</th>';
            $output .= '<th colspan="2" align="' . Application::Get('defined_right') . '" valign="middle">';
            $output .= _SORT_BY . ': 
					<select name="listings_sort_by" onchange="jQuery(\'#frmCategoryView\').submit();">
						<option value="rating" ' . ($listings_sort_by == 'rating' ? ' selected="selected"' : '') . '>' . _RATING . '</option>
						<option value="name" ' . ($listings_sort_by == 'name' ? ' selected="selected"' : '') . '>' . _NAME . '</option>
						<option value="date" ' . ($listings_sort_by == 'date' ? ' selected="selected"' : '') . '>' . _DATE_PUBLISHED . '</option>
					</select>&nbsp;
					<select name="listings_order_by" onchange="jQuery(\'#frmCategoryView\').submit();">
						<option value="ASC" ' . ($listings_order_by == 'ASC' ? ' selected="selected"' : '') . '>' . _ASCENDING . '</option>
						<option value="DESC" ' . ($listings_order_by == 'DESC' ? ' selected="selected"' : '') . '>' . _DESCENDING . '</option>
					</select>
					</th>
				</tr>
			</table>
			</form>';
        }
        if ($result[1] > 0) {
            $output .= '<table width="99%" border="0" align="center">';
            $output .= '<tr><th colspan="2" nowrap="nowrap" height="5px"></th></tr>
				<tr>
					<th align="' . Application::Get('defined_left') . '">&nbsp; ' . _LISTINGS . ' &nbsp;</th>
					<th align="center">' . _IMAGE . '</th>
				</tr>';
            for ($i = 0; $i < $result[1]; $i++) {
                $image_file = $result[0][$i]['image_file'] != '' ? $result[0][$i]['image_file'] : 'no_image.png';
                ///$result[0][$i]['advertise_plan_id'] > 1 &&
                $image_file_thumb = $result[0][$i]['image_file_thumb'] != '' ? $result[0][$i]['image_file_thumb'] : 'no_image.png';
                $output .= '<tr><td colspan="2" style="padding:7px;">' . draw_line('no_margin_line', IMAGE_DIRECTORY, false) . '</td></tr>
					<tr valign="top">
						<td>';
                $link_1 = prepare_link('listing', 'lid', $result[0][$i]['id'], '', $result[0][$i]['business_name'], '', _CLICK_TO_SEE_DESCR);
                $link_2 = prepare_link('listing', 'lid', $result[0][$i]['id'], '', _MORE_INFO, '', _CLICK_TO_SEE_DESCR);
                $output .= '<div class="listing_info">';
                $output .= '<div class="header">' . $link_1 . '</div>';
                $output .= '<div class="address">' . substr_by_word(strip_tags($result[0][$i]['business_address']), 300, true, Application::Get('lang')) . ' ' . $result[0][$i]['listing_location_name'] . '</div>';
                $output .= '<div class="description">' . substr_by_word(strip_tags($result[0][$i]['business_description']), 180, true, Application::Get('lang')) . '</div>';
                $output .= '<div class="links">
											' . $link_2 . '
											' . ($result[0][$i]['website_url'] != '' ? ' : <a href="' . $result[0][$i]['website_url'] . '" target="_new">' . _WEBSITE_URL . '</a>' : '') . '
											' . ($result[0][$i]['business_email'] != '' ? ' : <a href="mailto:' . $result[0][$i]['business_email'] . '">' . _EMAIL . '</a>' : '') . '
											' . ($result[0][$i]['date_published'] != '0000-00-00 00:00:00' ? '<div class="published">' . _PUBLISHED . ': ' . format_datetime($result[0][$i]['date_published'], get_datetime_format(false), _UNKNOWN) . '<div>' : '') . '
										</div>';
                $output .= '</div>';
                $output .= '
						</td>
						<td width="130px" align="center">
							<div class="listing_icon">';
                if ($image_file != 'no_image.png') {
                    $output .= '<a href="images/listings/' . $image_file . '" rel="lyteshow_' . $result[0][$i]['id'] . '">';
                }
                $output .= '<img class="listings_image' . ($image_file == 'no_image.png' ? ' no_hover' : '') . '" src="images/listings/' . $image_file_thumb . '" width="120px" height="90px" title="' . ($image_file != 'no_image.png' ? _CLICK_TO_INCREASE : '') . '" alt="" />';
                if ($image_file != 'no_image.png') {
                    $output .= '</a>';
                }
                $output .= '
							</div>
						</td>
					</tr>';
            }
            // draw pagination links
            if ($total_pages > 1) {
                $output .= '<tr><td colspan="2" style="padding:7px;">' . draw_line('no_margin_line', IMAGE_DIRECTORY, false) . '</td></tr>';
            }
            $output .= '<tr><td colspan="2">';
            $output .= pagination_get_links($total_pages, '');
            $output .= '</td></tr>';
            $output .= '<tr><td colspan="2">&nbsp;</td></tr>';
            $output .= '</table>';
        } else {
            // draw message only if this is a last-level empty category
            $categories = Categories::GetAllActive('c.parent_id = ' . (int) $category_id);
            if (!$categories[1]) {
                $output .= draw_message(_NO_LISTINGS_FOUND, false, true);
            }
        }
        if ($draw) {
            echo $output;
        } else {
            return $output;
        }
    }
Пример #2
0
 public static function Init()
 {
     global $objLogin, $objSettings, $objSiteDescription;
     self::$params['page'] = isset($_GET['page']) ? prepare_input($_GET['page']) : 'home';
     self::$params['page_id'] = isset($_REQUEST['pid']) ? prepare_input_alphanumeric($_REQUEST['pid']) : 'home';
     self::$params['system_page'] = isset($_GET['system_page']) ? prepare_input($_GET['system_page']) : '';
     self::$params['type'] = isset($_GET['type']) ? prepare_input($_GET['type']) : '';
     self::$params['admin'] = isset($_GET['admin']) ? prepare_input($_GET['admin']) : '';
     self::$params['user'] = isset($_GET['user']) ? prepare_input($_GET['user']) : '';
     self::$params['customer'] = isset($_GET['customer']) ? prepare_input($_GET['customer']) : '';
     self::$params['patient'] = isset($_GET['patient']) ? prepare_input($_GET['patient']) : '';
     self::$params['doctor'] = isset($_GET['doctor']) ? prepare_input($_GET['doctor']) : '';
     self::$params['news_id'] = isset($_GET['nid']) ? (int) $_GET['nid'] : '';
     self::$params['album_code'] = isset($_GET['acode']) ? strip_tags(prepare_input($_GET['acode'])) : '';
     self::$params['search_in'] = isset($_POST['search_in']) ? prepare_input($_POST['search_in']) : '';
     if (self::$params['search_in'] == '') {
         if (self::$PROJECT == 'BusinessDirectory') {
             self::$params['search_in'] = 'listings';
         } else {
             if (self::$PROJECT == 'ShoppingCart') {
                 self::$params['search_in'] = 'products';
             } else {
                 if (self::$PROJECT == 'HotelSite') {
                     self::$params['search_in'] = 'rooms';
                 }
             }
         }
     }
     self::$params['lang'] = isset($_GET['lang']) ? prepare_input($_GET['lang']) : '';
     self::$params['currency'] = isset($_GET['currency']) ? prepare_input($_GET['currency']) : '';
     self::$params['token'] = isset($_GET['token']) ? prepare_input($_GET['token']) : '';
     self::$params['listing_id'] = isset($_GET['lid']) ? (int) $_GET['lid'] : '';
     self::$params['category_id'] = isset($_GET['cid']) ? (int) $_GET['cid'] : '';
     self::$params['manufacturer_id'] = isset($_GET['mid']) ? (int) $_GET['mid'] : '';
     self::$params['product_id'] = isset($_REQUEST['prodid']) ? (int) $_REQUEST['prodid'] : '';
     $req_preview = isset($_GET['preview']) ? prepare_input($_GET['preview']) : '';
     //------------------------------------------------------------------------------
     // check and set token
     $token = md5(uniqid(rand(), true));
     self::$params['token'] = $token;
     Session::Set('token', $token);
     //------------------------------------------------------------------------------
     // save last visited page
     if (self::$params['allow_last_visited'] && !$objLogin->IsLoggedIn()) {
         $condition = !empty(self::$params['page']) && self::$params['page'] != 'home';
         if (self::$PROJECT == 'HotelSite') {
             $condition = self::$params['page'] == 'booking' || self::$params['page'] == 'booking_details';
         } else {
             if (self::$PROJECT == 'ShoppingCart') {
                 $condition = self::$params['page'] == 'shopping_cart' || self::$params['page'] == 'checkout';
             } else {
                 if (self::$PROJECT == 'MedicalAppointment') {
                     $condition = self::$params['page'] == 'checkout_signin';
                 }
             }
         }
         if ($condition) {
             Session::Set('last_visited', 'index.php?page=' . self::$params['page']);
             if (self::$params['page'] == 'pages' && !empty(self::$params['page_id']) && self::$params['page_id'] != 'home') {
                 Session::Set('last_visited', Session::Get('last_visited') . '&pid=' . self::$params['page_id']);
             } else {
                 if (self::$params['page'] == 'news' && !empty(self::$params['news_id'])) {
                     Session::Set('last_visited', Session::Get('last_visited') . '&nid=' . self::$params['news_id']);
                 } else {
                     if (self::$params['page'] == 'listing' && !empty(self::$params['listing_id'])) {
                         Session::Set('last_visited', Session::Get('last_visited') . '&lid=' . self::$params['listing_id']);
                     } else {
                         if (self::$params['page'] == 'category' && !empty(self::$params['category_id'])) {
                             Session::Set('last_visited', Session::Get('last_visited') . '&cid=' . self::$params['category_id']);
                         } else {
                             if (self::$params['page'] == 'manufacturer' && !empty(self::$params['manufacturer_id'])) {
                                 Session::Set('last_visited', Session::Get('last_visited') . '&mid=' . self::$params['product_id']);
                             } else {
                                 if (self::$params['page'] == 'product' && !empty(self::$params['product_id'])) {
                                     Session::Set('last_visited', Session::Get('last_visited') . '&prodid=' . self::$params['product_id']);
                                 }
                             }
                         }
                     }
                 }
             }
         }
     }
     //------------------------------------------------------------------------------
     // set language
     if ($objLogin->IsLoggedInAsAdmin()) {
         $pref_lang = $objLogin->GetPreferredLang();
         self::$params['lang'] = Languages::LanguageExists($pref_lang, false) ? $pref_lang : Languages::GetDefaultLang();
         $language_info = Languages::GetLanguageInfo(self::$params['lang']);
         self::$params['lang_dir'] = $language_info['lang_dir'];
         self::$params['lang_name'] = $language_info['lang_name'];
         self::$params['lang_name_en'] = $language_info['lang_name_en'];
         self::$params['lc_time_name'] = $language_info['lc_time_name'];
     } else {
         if (!$objLogin->IsLoggedIn() && (self::$params['admin'] == 'login' || self::$params['admin'] == 'password_forgotten')) {
             self::$params['lang'] = Languages::GetDefaultLang();
             $language_info = Languages::GetLanguageInfo(self::$params['lang']);
             self::$params['lang_dir'] = $language_info['lang_dir'];
             self::$params['lang_name'] = $language_info['lang_name'];
             self::$params['lang_name_en'] = $language_info['lang_name_en'];
             self::$params['lc_time_name'] = $language_info['lc_time_name'];
         } else {
             if (!empty(self::$params['lang']) && Languages::LanguageExists(self::$params['lang'])) {
                 //self::$params['lang']         = self::$params['lang'];
                 $language_info = Languages::GetLanguageInfo(self::$params['lang']);
                 Session::Set('lang', self::$params['lang']);
                 Session::Set('lang_dir', self::$params['lang_dir'] = $language_info['lang_dir']);
                 Session::Set('lang_name', self::$params['lang_name'] = $language_info['lang_name']);
                 Session::Set('lang_name_en', self::$params['lang_name_en'] = $language_info['lang_name_en']);
                 Session::Set('lc_time_name', self::$params['lc_time_name'] = $language_info['lc_time_name']);
             } else {
                 if (Session::Get('lang') != '' && Session::Get('lang_dir') != '' && Session::Get('lang_name') != '' && Session::Get('lang_name_en') != '') {
                     self::$params['lang'] = Session::Get('lang');
                     self::$params['lang_dir'] = Session::Get('lang_dir');
                     self::$params['lang_name'] = Session::Get('lang_name');
                     self::$params['lang_name_en'] = Session::Get('lang_name_en');
                     self::$params['lc_time_name'] = Session::Get('lc_time_name');
                 } else {
                     self::$params['lang'] = Languages::GetDefaultLang();
                     $language_info = Languages::GetLanguageInfo(self::$params['lang']);
                     self::$params['lang_dir'] = isset($language_info['lang_dir']) ? $language_info['lang_dir'] : '';
                     self::$params['lang_name'] = isset($language_info['lang_name']) ? $language_info['lang_name'] : '';
                     self::$params['lang_name_en'] = isset($language_info['lang_name_en']) ? $language_info['lang_name_en'] : '';
                     self::$params['lc_time_name'] = isset($language_info['lc_time_name']) ? $language_info['lc_time_name'] : '';
                 }
             }
         }
     }
     //------------------------------------------------------------------------------
     // set currency
     if (self::$PROJECT == 'ShoppingCart' || self::$PROJECT == 'HotelSite' || self::$PROJECT == 'BusinessDirectory' || self::$PROJECT == 'MedicalAppointment') {
         if (!empty(self::$params['currency']) && Currencies::CurrencyExists(self::$params['currency'])) {
             self::$params['currency_code'] = self::$params['currency'];
             $currency_info = Currencies::GetCurrencyInfo(self::$params['currency_code']);
             self::$params['currency_symbol'] = $currency_info['symbol'];
             self::$params['currency_rate'] = $currency_info['rate'];
             self::$params['currency_decimals'] = $currency_info['decimals'];
             self::$params['currency_symbol_place'] = $currency_info['symbol_placement'];
             Session::Set('currency_code', self::$params['currency']);
             Session::Set('currency_symbol', $currency_info['symbol']);
             Session::Set('currency_rate', $currency_info['rate']);
             Session::Set('currency_decimals', $currency_info['decimals']);
             Session::Set('symbol_placement', $currency_info['symbol_placement']);
         } else {
             if (Session::Get('currency_code') != '' && Session::Get('currency_symbol') != '' && Session::Get('currency_rate') != '' && Session::Get('currency_decimals') != '' && Session::Get('symbol_placement') != '' && Currencies::CurrencyExists(Session::Get('currency_code'))) {
                 self::$params['currency_code'] = Session::Get('currency_code');
                 self::$params['currency_symbol'] = Session::Get('currency_symbol');
                 self::$params['currency_rate'] = Session::Get('currency_rate');
                 self::$params['currency_decimals'] = Session::Get('currency_decimals');
                 self::$params['currency_symbol_place'] = Session::Get('symbol_placement');
             } else {
                 $currency_info = Currencies::GetDefaultCurrencyInfo();
                 self::$params['currency_code'] = $currency_info['code'];
                 self::$params['currency_symbol'] = $currency_info['symbol'];
                 self::$params['currency_rate'] = $currency_info['rate'];
                 self::$params['currency_decimals'] = $currency_info['decimals'];
                 self::$params['currency_symbol_place'] = $currency_info['symbol_placement'];
             }
         }
     }
     // preview allowed only for admins
     // -----------------------------------------------------------------------------
     if ($objLogin->IsLoggedInAsAdmin()) {
         if ($req_preview == 'yes' || $req_preview == 'no') {
             self::$params['preview'] = $req_preview;
             Session::Set('preview', self::$params['preview']);
         } else {
             if (self::$params['admin'] == '' && (Session::Get('preview') == 'yes' || Session::Get('preview') == 'no')) {
                 self::$params['preview'] = Session::Get('preview');
             } else {
                 self::$params['preview'] = 'no';
                 Session::Set('preview', self::$params['preview']);
             }
         }
     }
     // *** get site description
     // -----------------------------------------------------------------------------
     $objSiteDescription->LoadData(self::$params['lang']);
     // *** draw offline message
     // -----------------------------------------------------------------------------
     if ($objSettings->GetParameter('is_offline')) {
         if (!$objLogin->IsLoggedIn() && self::$params['admin'] != 'login') {
             $offline_content = @file_get_contents('html/site_offline.html');
             if (!empty($offline_content)) {
                 $offline_content = str_ireplace(array('{HEADER_TEXT}', '{SLOGAN_TEXT}', '{OFFLINE_MESSAGE}', '{FOOTER}'), array($objSiteDescription->GetParameter('header_text'), $objSiteDescription->GetParameter('slogan_text'), $objSettings->GetParameter('offline_message'), $objSiteDescription->DrawFooter(false)), $offline_content);
             } else {
                 $offline_content = $objSettings->GetParameter('offline_message');
             }
             echo $offline_content;
             exit;
         }
     }
     // *** draw offline message
     // -----------------------------------------------------------------------------
     if ($objSettings->GetParameter('is_offline')) {
         if (!$objLogin->IsLoggedIn() && self::$params['admin'] != 'login') {
             echo '<html>';
             echo '<head><meta http-equiv="Content-Type" content="text/html; charset=utf-8" /></head>';
             echo '<body>' . $objSettings->GetParameter('offline_message') . '</body>';
             echo '</html>';
             exit;
         }
     }
     // *** run cron jobs file
     // -----------------------------------------------------------------------------
     if ($objSettings->GetParameter('cron_type') == 'non-batch') {
         include_once 'cron.php';
     }
     // *** default user page
     // -----------------------------------------------------------------------------
     if (self::$PROJECT == 'MicroCMS') {
         if ($objLogin->IsLoggedInAsUser()) {
             if (self::$params['user'] == '' && self::$params['page'] == '') {
                 self::$params['user'] = '******';
             }
         }
     } else {
         if (self::$PROJECT == 'BusinessDirectory') {
             if ($objLogin->IsLoggedInAsCustomer()) {
                 if (self::$params['customer'] == '' && self::$params['page'] == '') {
                     self::$params['customer'] = 'home';
                 }
             }
         } else {
             if (self::$PROJECT == 'ShoppingCart') {
                 if ($objLogin->IsLoggedInAsCustomer()) {
                     if (self::$params['customer'] == '' && self::$params['page'] == '') {
                         self::$params['customer'] = 'home';
                     }
                 }
             } else {
                 if (self::$PROJECT == 'HotelSite') {
                     if ($objLogin->IsLoggedInAsCustomer()) {
                         if (self::$params['customer'] == '' && self::$params['page'] == '') {
                             self::$params['customer'] = 'home';
                         }
                     }
                 } else {
                     if (self::$PROJECT == 'MedicalAppointment') {
                         if ($objLogin->IsLoggedInAsPatient()) {
                             if (self::$params['patient'] == '' && self::$params['page'] == '') {
                                 self::$params['patient'] = 'home';
                             }
                         }
                         if ($objLogin->IsLoggedInAsDoctor()) {
                             if (self::$params['doctor'] == '' && self::$params['page'] == '') {
                                 self::$params['doctor'] = 'home';
                             }
                         }
                     }
                 }
             }
         }
     }
     // *** get site template
     // -----------------------------------------------------------------------------
     self::$params['template'] = $objSettings->GetTemplate() != '' ? $objSettings->GetTemplate() : DEFAULT_TEMPLATE;
     if ($objLogin->IsLoggedInAsAdmin() && (self::$params['preview'] != 'yes' || self::$params['admin'] != '')) {
         self::$params['template'] = 'admin';
     } else {
         if (!$objLogin->IsLoggedIn() && (self::$params['admin'] == 'login' || self::$params['admin'] == 'password_forgotten')) {
             self::$params['template'] = 'admin';
         }
     }
     // *** use direction of selected language
     // -----------------------------------------------------------------------------
     self::$params['defined_left'] = self::$params['lang_dir'] == 'ltr' ? 'left' : 'right';
     self::$params['defined_right'] = self::$params['lang_dir'] == 'ltr' ? 'right' : 'left';
     self::$params['defined_alignment'] = self::$params['lang_dir'] == 'ltr' ? 'left' : 'right';
     // *** prepare META tags
     // -----------------------------------------------------------------------------
     if (self::$params['page'] == 'news' && self::$params['news_id'] != '') {
         $news_info = News::GetNewsInfo(self::$params['news_id'], self::$params['lang']);
         self::$params['tag_title'] = isset($news_info['header_text']) ? $news_info['header_text'] : $objSiteDescription->GetParameter('tag_title');
         self::$params['tag_keywords'] = isset($news_info['header_text']) ? str_replace(' ', ',', $news_info['header_text']) : $objSiteDescription->GetParameter('tag_keywords');
         self::$params['tag_description'] = isset($news_info['header_text']) ? $news_info['header_text'] : $objSiteDescription->GetParameter('tag_description');
     } else {
         if (self::$params['system_page'] != '') {
             $objPage = new Pages(self::$params['system_page'], true);
         } else {
             $objPage = new Pages(self::$params['page_id'], true);
         }
         self::$params['tag_title'] = $objPage->GetParameter('tag_title') != '' ? $objPage->GetParameter('tag_title') : $objSiteDescription->GetParameter('tag_title');
         self::$params['tag_keywords'] = $objPage->GetParameter('tag_keywords') != '' ? $objPage->GetParameter('tag_keywords') : $objSiteDescription->GetParameter('tag_keywords');
         self::$params['tag_description'] = $objPage->GetParameter('tag_description') != '' ? $objPage->GetParameter('tag_description') : $objSiteDescription->GetParameter('tag_description');
         if (self::$PROJECT == 'BusinessDirectory') {
             if (self::$params['page'] == 'category') {
                 $category_info = Categories::GetCategoryInfo(self::$params['category_id']);
                 self::$params['tag_title'] = isset($category_info['name']) ? strip_tags($category_info['name']) : '';
                 self::$params['tag_keywords'] = isset($category_info['name']) ? strip_tags($category_info['name']) : '';
                 self::$params['tag_description'] = isset($category_info['description']) ? strip_tags($category_info['description']) : '';
             } else {
                 if (self::$params['page'] == 'listing') {
                     $listing_info = Listings::GetListingInfo(self::$params['listing_id']);
                     self::$params['tag_title'] = isset($listing_info['business_name']) ? strip_tags($listing_info['business_name']) : '';
                     self::$params['tag_keywords'] = isset($listing_info['business_name']) ? trim(strip_tags($listing_info['business_name'])) : '';
                     self::$params['tag_description'] = isset($listing_info['business_address']) ? trim(strip_tags($listing_info['business_address'])) : self::$params['tag_title'];
                 }
             }
         }
     }
     // *** included js libraries
     // -----------------------------------------------------------------------------
     self::$params['js_included'] = array();
 }
Пример #3
0
    <script type="text/javascript" src="<?php 
    echo $host;
    ?>
js/jquery-1.6.3.min.js"></script>
    <base href="<?php 
    echo $host;
    ?>
" />
    <style>
        body { text-align:left; }
</style>
</head>    
<body>
    <?php 
    $inquiry_category = isset($params['inquiry_category']) ? prepare_input($params['inquiry_category']) : '';
    $category_info = Categories::GetCategoryInfo($inquiry_category);
    $category_name = isset($category_info['name']) ? _SEND_INQUIRY_TO . ' ' . $category_info['name'] : _SEND_INQUIRY;
    $business_name = isset($params['business_name']) ? $params['business_name'] : '';
    $params['widget'] = true;
    $params['widget_host'] = $host_not_decoded;
    $params['widget_key'] = $key_not_decoded;
    if (!empty($msg)) {
        echo $msg;
    } else {
        draw_title_bar(_SEND_INQUIRY);
    }
    Inquiries::DrawInquiryForm($params);
    ?>
    
</body>
</html>