function google_cars() { echo '<rss version ="2.0" xmlns:g="http://base.google.com/ns/1.0"> <channel> <title>' . osc_page_title() . '</title> <description>' . osc_page_description() . '</description> <link>' . osc_base_url() . '</link>'; if (osc_count_items()) { while (osc_has_items()) { $item = feed_get_car_data(osc_item()); $date = date('d/m/Y'); $time = date('H:i'); if (preg_match('|([0-9]{4})-([0-9]{2})-([0-9]{2})|', osc_item_pub_date(), $tmp)) { $date = $tmp[3] . "/" . $tmp[2] . "/" . $tmp[1]; } echo '<item> <title>' . osc_item_title() . '</title> <description>' . osc_item_description() . '</description> <g:id>' . osc_item_id() . '</g:id> <link>' . osc_item_url() . '</link> <g:location>' . (osc_item_address() != '' ? osc_item_address() : '') . ', ' . (osc_item_city() != '' ? osc_item_city() : '') . ', ' . (osc_item_region() != '' ? osc_item_region() : '') . ', ' . (osc_item_zip() != '' ? osc_item_zip() : '') . ' ' . (osc_item_country() != '' ? osc_item_country() : '') . '</g:location> <g:publish_date>' . $date . '</g:publish_date> <g:color>' . (isset($item['s_color']) ? $item['s_color'] : '') . '</g:color> <g:condition>' . (isset($item['b_new']) && $item['b_new'] == 1 ? 'new' : 'used') . '</g:condition>'; if (osc_count_item_resources() > 0) { while (osc_has_item_resources()) { if (strpos(osc_resource_type(), 'image') !== FALSE) { echo '<g:image_link>' . osc_resource_path() . '</g:image_link>'; } } } echo '<g:make>' . (isset($item['s_make']) ? $item['s_make'] : '') . '</g:make> <g:mileage>' . (isset($item['i_mileage']) ? $item['i_mileage'] : '') . '</g:mileage> <g:model>' . (isset($item['s_model']) ? $item['s_model'] : '') . '</g:model> <g:price>' . (osc_item_price() != '' ? osc_item_price() : '') . '</g:price> <g:vehicle_type>' . (isset($item['s_name']) ? $item['s_name'] : '') . '</g:vehicle_type> <g:year>' . (isset($item['i_year']) ? $item['i_year'] : '') . '</g:year> </item>'; } } echo '</channel> </rss>'; }
function oodle_realstate() { echo '<?xml version="1.0" encoding="utf-8"?><listings>'; if (osc_count_items()) { while (osc_has_items()) { $item = feed_get_house_data(osc_item()); $time = explode(" ", osc_item_pub_date()); if (isset($item['s_square_meters'])) { $lot_size = $item['s_square_meters'] * 10.7639104; } else { $lot_size = 0; } $amenities = array(); if (isset($item['b_heating']) && $item['b_heating']) { $amenities[] = __('Heating', 'extra_feeds'); } if (isset($item['b_air_condition']) && $item['b_air_condition']) { $amenities[] = __('Air condition', 'extra_feeds'); } if (isset($item['b_elevator']) && $item['b_elevator']) { $amenities[] = __('Elevator', 'extra_feeds'); } if (isset($item['b_terrace']) && $item['b_terrace']) { $amenities[] = __('Terrace', 'extra_feeds'); } if (isset($item['b_parking']) && $item['b_parking']) { $amenities[] = __('Parking', 'extra_feeds'); } echo '<listing> <category>' . osc_item_category() . '</category> <description><![CDATA[' . osc_item_description() . ']]></description> <id>' . osc_item_id() . '</id> <title><![CDATA[' . osc_item_title() . ']]></title> <url>' . osc_item_url() . '</url> <address>' . osc_item_address() . '</address> <city>' . osc_item_city() . '</city> <country>' . osc_item_country_code() . '</country> <neighborhood>' . osc_item_city_area() . '</neighborhood> <state>' . osc_item_region() . '</state> <zip_code>' . osc_item_zip() . '</zip_code> <longitude>' . osc_item_longitude() . '</longitude> <latitude>' . osc_item_latitude() . '</latitude> <amenities>' . implode(", ", $amenities) . '</amenities> <bathrooms>' . @$item['i_num_bathrooms'] . '</bathrooms> <bedrooms>' . @$item['i_num_rooms'] . '</bedrooms> <condition>' . @$item['e_status'] . '</condition> <create_time>' . $time[0] . '</create_time> <currency>' . osc_item_currency() . '</currency> <furnished>' . (@$item['b_furnished'] ? 'Furnished' : '') . '</furnished>'; if (osc_count_item_resources() > 0) { if (strpos(osc_resource_type(), 'image') !== FALSE) { echo '<image_url><![CDATA[' . osc_resource_path() . ']]></image_url>'; } } echo '<lot_size>' . $lot_size . '</lot_size> <lot_size_units>square feet</lot_size_units> <price>' . osc_item_price() . '</price> <seller_email>' . osc_item_contact_email() . '</seller_email> <seller_name><![CDATA[' . osc_item_contact_name() . ']]></seller_name> <year>' . @$item['i_year'] . '</year> </listing>'; } } echo '</listings>'; }
function logbee_header() { $location = Rewrite::newInstance()->get_location(); $section = Rewrite::newInstance()->get_section(); if ($location == 'item' && $section == '') { echo ' <style type="text/css"> .logbee ul { margin: 10px 0; list-style: none; } .logbee ul li { float: left; } .logbee .clear { clear:both; } </style>'; // meta-tags $address_array = array(); if (osc_item_address() != "") { $address_array[] = osc_item_address(); } if (osc_item_city_area() != "") { $address_array[] = osc_item_city_area(); } if (osc_item_zip() != "") { $address_array[] = osc_item_zip(); } if (osc_item_city() != "") { $address_array[] = osc_item_city(); } if (osc_item_region() != "") { $address_array[] = osc_item_region(); } if (osc_item_country() != "") { $address_array[] = osc_item_country(); } $address = implode(", ", $address_array); $price = ''; if (osc_item_formated_price() != "") { $price = osc_item_formated_price(); } $email = ''; if (osc_item_show_email()) { $email = osc_item_contact_email(); } echo ' <meta property="logbee:title" content="' . osc_esc_html(osc_item_title()) . '"/> <meta property="logbee:url" content="' . osc_esc_html(osc_item_url()) . '"/> <meta property="logbee:desc" content="' . osc_esc_html(osc_item_description()) . '"/> <meta property="logbee:addr" content="' . osc_esc_html($address) . '"/> <meta property="logbee:email" content="' . osc_esc_html($email) . '"/> <meta property="logbee:price" content="' . osc_esc_html($price) . '"/>'; // do we have the cars_plugin enabled? if (osc_plugin_is_enabled('cars_attributes/index.php')) { require_once osc_plugin_path('') . '/cars_attributes/ModelCars.php'; if (osc_is_this_category('cars_plugin', osc_item_category_id())) { $detail = ModelCars::newInstance()->getCarAttr(osc_item_id()); echo ' <meta property="logbee:type" content="car"/> <meta property="logbee:mileage" content="' . osc_esc_html(@$detail['i_mileage']) . '"/> <meta property="logbee:firstreg" content="' . osc_esc_html(@$detail['i_year']) . '"/>'; } } // do we have the realestate_plugin enabled? if (osc_plugin_is_enabled('realestate_attributes/index.php')) { require_once osc_plugin_path('') . '/realestate_attributes/ModelRealEstate.php'; if (osc_is_this_category('realestate_plugin', osc_item_category_id())) { $detail = ModelRealEstate::newInstance()->getAttributes(osc_item_id()); echo ' <meta property="logbee:type" content="realty"/> <meta property="logbee:rooms" content="' . osc_esc_html(@$detail['i_num_rooms']) . '"/> <meta property="logbee:size" content="' . osc_esc_html(@$detail['s_square_meters']) . ' sqm"/>'; } } // images osc_reset_resources(); $images_array = array(); for ($i = 0; osc_has_item_resources(); $i++) { $images_array[] = osc_esc_html(osc_resource_url()); } $images = implode("|", $images_array); echo ' <meta property="logbee:imgurl" content="' . $images . '"/> '; osc_reset_resources(); echo "\n"; } }
function trovit_cars() { echo '<?xml version="1.0" encoding="utf-8"?> <trovit>'; if (osc_count_items()) { while (osc_has_items()) { $item = feed_get_car_data(osc_item()); $date = date('d/m/Y'); $time = date('H:i'); if (preg_match('|([0-9]{4})-([0-9]{2})-([0-9]{2}) ([0-9]{2}):([0-9]{2})|', osc_item_pub_date(), $tmp)) { $date = $tmp[3] . "/" . $tmp[2] . "/" . $tmp[1]; $time = $tmp[4] . ":" . $tmp[5]; } echo '<ad> <id><![CDATA[' . osc_item_id() . ']]></id> <url><![CDATA[' . osc_item_url() . ']]></url> <title><![CDATA[' . osc_item_title() . ']]></title> <content><![CDATA[' . osc_item_description() . ']]></content> <price><![CDATA[' . osc_item_price() . ']]></price> <make><![CDATA[' . (isset($item['s_make']) ? $item['s_make'] : '') . ']]></make> <model><![CDATA[' . (isset($item['s_model']) ? $item['s_model'] : '') . ']]></model> <color><![CDATA[' . (isset($item['s_color']) ? $item['s_color'] : '') . ']]></color> <mileage><![CDATA[' . (isset($item['i_mileage']) ? $item['i_mileage'] : '') . ']]></mileage> <doors><![CDATA[' . (isset($item['i_doors']) ? $item['i_doors'] : '') . ']]></doors> <fuel><![CDATA[' . (isset($item['e_fuel']) ? $item['e_fuel'] : '') . ']]></fuel> <transmission><![CDATA[' . (isset($item['e_transmission']) ? $item['e_transmission'] : '') . ']]></transmission> <engine_size><![CDATA[' . (isset($item['i_engine_size']) ? $item['i_engine_size'] : '') . ']]></engine_size> <cylinders><![CDATA[' . (isset($item['i_cylinders']) ? $item['i_cylinders'] : '') . ']]></cylinders> <power unit="' . (isset($item['e_power_unit']) ? $item['e_power_unit'] : '') . '"><![CDATA[' . (isset($item['i_power']) ? $item['i_power'] : '') . ']]></power> <seats><![CDATA[' . (isset($item['i_seats']) ? $item['i_seats'] : '') . ']]></seats> <gears><![CDATA[' . (isset($item['i_gears']) ? $item['i_gears'] : '') . ']]></gears> <address><![CDATA[' . (osc_item_address() != '' ? osc_item_address() : '') . ']]></address> <city><![CDATA[' . (osc_item_city() != '' ? osc_item_city() : '') . ']]></city> <city_area><![CDATA[' . (osc_item_city_area() != '' ? osc_item_city_area() : '') . ']]></city_area> <postcode><![CDATA[' . (osc_item_zip() != '' ? osc_item_zip() : '') . ']]></postcode> <region><![CDATA[' . (osc_item_region() != '' ? osc_item_region() : '') . ']]></region> <latitude><![CDATA[' . (osc_item_latitude() != '' ? osc_item_latitude() : '') . ']]></latitude> <longitude><![CDATA[' . (osc_item_longitude() != '' ? osc_item_longitude() : '') . ']]></longitude>'; $res_string = ''; if (osc_count_item_resources() > 0) { while (osc_has_item_resources()) { if (strpos(osc_resource_type(), 'image') !== FALSE) { $res_string .= '<picture> <picture_url><![CDATA[' . osc_resource_path() . ']]></picture_url> <picture_title><![CDATA[' . osc_resource_name() . ']]></picture_title> </picture>'; } } } if ($res_string != '') { echo '<pictures>' . $res_string . '</pictures>'; } echo ' <date><![CDATA[' . $date . ']]></date> <time><![CDATA[' . $time . ']]></time> </ad>'; } } echo '</trovit>'; }
function indeed() { echo '<?xml version="1.0" encoding="utf-8"?> <source> <publisher>' . osc_page_title() . '</publisher> <publisherurl>' . osc_base_url() . '</publisherurl> <lastBuildDate>' . date("D, j M Y G:i:s T") . '</lastBuildDate>'; if (osc_count_items()) { while (osc_has_items()) { $item = feed_get_job_data(osc_item()); $salary = ""; if (isset($item['i_salary_min']) && $item['i_salary_min'] != '') { $salary = $item['i_salary_min']; } if (isset($item['i_salary_max']) && $item['i_salary_max'] != '') { if ($salary != "") { $salary .= ' - '; } $salary .= $item['i_salary_max']; } if (isset($item['e_salary_period']) && $item['e_slary_period'] != '') { if ($salary != "") { $salary .= ' '; $salary .= $item['e_salary_period']; } } $locale = current($item['locale']); if (isset($locale['s_desired_exp']) && $locale['s_desired_exp'] != '') { $experience = $locale['s_desired_exp']; } else { $experience = ''; } if (isset($locale['s_studies']) && $locale['s_studies'] != '') { $education = $locale['s_studies']; } else { $education = ''; } echo '<job> <title><![CDATA[' . osc_item_title() . ']]></title> <date><![CDATA[' . osc_item_pub_date() . ']]></date> <referencenumber><![CDATA[' . osc_item_id() . ']]></referencenumber> <url><![CDATA[' . osc_item_url() . ']]></url> <company><![CDATA[' . (isset($item['s_company_name']) && $item['s_company_name'] != NULL ? $item['s_company_name'] : '') . ']]></company> <city><![CDATA[' . (osc_item_city() != NULL ? osc_item_city() : '') . ']]></city> <state><![CDATA[' . (osc_item_region() != NULL ? osc_item_region() : '') . ']]></state> <country><![CDATA[' . (osc_item_country() != NULL ? osc_item_country() : '') . ']]></country> <postalcode><![CDATA[' . (osc_item_zip() != NULL ? osc_item_zip() : '') . ']]></postalcode> <description><![CDATA[' . (osc_item_description() != NULL ? osc_item_description() : '') . ']]></description> <salary><![CDATA[' . $salary . ']]></salary> <education><![CDATA[' . $education . ']]></education> <jobtype><![CDATA[' . (isset($item['e_position_type']) && $item['e_position_type'] != NULL ? $item['e_position_type'] : '') . ']]></jobtype> <category><![CDATA[]]></category> <experience><![CDATA[' . $experience . ']]></experience> </job>'; } } echo '</source>'; }
function fn_email_admin_new_item($item) { View::newInstance()->_exportVariableToView('item', $item); $title = osc_item_title(); $contactEmail = $item['s_contact_email']; $contactName = $item['s_contact_name']; $mPages = new Page(); $locale = osc_current_user_locale(); $aPage = $mPages->findByInternalName('email_admin_new_item'); $content = array(); if (isset($aPage['locale'][$locale]['s_title'])) { $content = $aPage['locale'][$locale]; } else { $content = current($aPage['locale']); } $item_url = osc_item_url(); $item_url = '<a href="' . $item_url . '" >' . $item_url . '</a>'; $all = ''; if (isset($item['locale'])) { foreach ($item['locale'] as $locale => $data) { $locale_name = OSCLocale::newInstance()->listWhere("pk_c_code = '" . $locale . "'"); $all .= '<br/>'; if (isset($locale_name[0]) && isset($locale_name[0]['s_name'])) { $all .= __('Language') . ': ' . $locale_name[0]['s_name'] . '<br/>'; } else { $all .= __('Language') . ': ' . $locale . '<br/>'; } $all .= __('Title') . ': ' . $data['s_title'] . '<br/>'; $all .= __('Description') . ': ' . $data['s_description'] . '<br/>'; $all .= '<br/>'; } } else { $all .= __('Title') . ': ' . $item['s_title'] . '<br/>'; $all .= __('Description') . ': ' . $item['s_description'] . '<br/>'; } // Format activation URL $validation_url = osc_item_activate_url($item['s_secret'], $item['pk_i_id']); // Format admin edit URL $admin_edit_url = osc_item_admin_edit_url($item['pk_i_id']); $words = array(); $words[] = array('{EDIT_LINK}', '{EDIT_URL}', '{ITEM_DESCRIPTION_ALL_LANGUAGES}', '{ITEM_DESCRIPTION}', '{ITEM_COUNTRY}', '{ITEM_PRICE}', '{ITEM_REGION}', '{ITEM_CITY}', '{ITEM_ID}', '{USER_NAME}', '{USER_EMAIL}', '{WEB_URL}', '{ITEM_TITLE}', '{ITEM_URL}', '{WEB_TITLE}', '{VALIDATION_LINK}', '{VALIDATION_URL}'); $words[] = array('<a href="' . $admin_edit_url . '" >' . $admin_edit_url . '</a>', $admin_edit_url, $all, $item['s_description'], $item['s_country'], osc_prepare_price($item['s_price']), $item['s_region'], $item['s_city'], $item['pk_i_id'], $item['s_contact_name'], $item['s_contact_email'], '<a href="' . osc_base_url() . '" >' . osc_base_url() . '</a>', $item['s_title'], $item_url, osc_page_title(), '<a href="' . $validation_url . '" >' . $validation_url . '</a>', $validation_url); $title = osc_mailBeauty(osc_apply_filter('email_title', osc_apply_filter('email_admin_new_item_title', $content['s_title'])), $words); $body = osc_mailBeauty(osc_apply_filter('email_description', osc_apply_filter('email_admin_new_item_description', $content['s_text'])), $words); $emailParams = array('subject' => $title, 'to' => osc_contact_email(), 'to_name' => 'admin', 'body' => $body, 'alt_body' => $body); osc_sendMail($emailParams); }
function doModel() { osc_run_hook('before_search'); if (osc_rewrite_enabled()) { // IF rewrite is not enabled, skip this part, preg_match is always time&resources consuming task $p_sParams = "/" . Params::getParam('sParams', false, false); if (preg_match_all('|\\/([^,]+),([^\\/]*)|', $p_sParams, $m)) { $l = count($m[0]); for ($k = 0; $k < $l; $k++) { switch ($m[1][$k]) { case osc_get_preference('rewrite_search_country'): $m[1][$k] = 'sCountry'; break; case osc_get_preference('rewrite_search_region'): $m[1][$k] = 'sRegion'; break; case osc_get_preference('rewrite_search_city'): $m[1][$k] = 'sCity'; break; case osc_get_preference('rewrite_search_city_area'): $m[1][$k] = 'sCityArea'; break; case osc_get_preference('rewrite_search_category'): $m[1][$k] = 'sCategory'; break; case osc_get_preference('rewrite_search_user'): $m[1][$k] = 'sUser'; break; case osc_get_preference('rewrite_search_pattern'): $m[1][$k] = 'sPattern'; break; default: // custom fields if (preg_match("/meta(\\d+)-?(.*)?/", $m[1][$k], $results)) { $meta_key = $m[1][$k]; $meta_value = $m[2][$k]; $array_r = array(); if (Params::existParam('meta')) { $array_r = Params::getParam('meta'); } if ($results[2] == '') { // meta[meta_id] = meta_value $meta_key = $results[1]; $array_r[$meta_key] = $meta_value; } else { // meta[meta_id][meta_key] = meta_value $meta_key = $results[1]; $meta_key2 = $results[2]; $array_r[$meta_key][$meta_key2] = $meta_value; } $m[1][$k] = 'meta'; $m[2][$k] = $array_r; } break; } Params::setParam($m[1][$k], $m[2][$k]); } Params::unsetParam('sParams'); } } $uriParams = Params::getParamsAsArray(); $searchUri = osc_search_url($uriParams); if ($this->uri != 'feed') { if (str_replace("%20", '+', $searchUri) != str_replace("%20", '+', WEB_PATH . $this->uri)) { $this->redirectTo($searchUri, 301); } } //////////////////////////////// //GETTING AND FIXING SENT DATA// //////////////////////////////// $p_sCategory = Params::getParam('sCategory'); if (!is_array($p_sCategory)) { if ($p_sCategory == '') { $p_sCategory = array(); } else { $p_sCategory = explode(",", $p_sCategory); } } $p_sCityArea = Params::getParam('sCityArea'); if (!is_array($p_sCityArea)) { if ($p_sCityArea == '') { $p_sCityArea = array(); } else { $p_sCityArea = explode(",", $p_sCityArea); } } $p_sCity = Params::getParam('sCity'); if (!is_array($p_sCity)) { if ($p_sCity == '') { $p_sCity = array(); } else { $p_sCity = explode(",", $p_sCity); } } $p_sRegion = Params::getParam('sRegion'); if (!is_array($p_sRegion)) { if ($p_sRegion == '') { $p_sRegion = array(); } else { $p_sRegion = explode(",", $p_sRegion); } } $p_sCountry = Params::getParam('sCountry'); if (!is_array($p_sCountry)) { if ($p_sCountry == '') { $p_sCountry = array(); } else { $p_sCountry = explode(",", $p_sCountry); } } $p_sUser = Params::getParam('sUser'); if (!is_array($p_sUser)) { if ($p_sUser == '') { $p_sUser = ''; } else { $p_sUser = explode(",", $p_sUser); } } $p_sLocale = Params::getParam('sLocale'); if (!is_array($p_sLocale)) { if ($p_sLocale == '') { $p_sLocale = ''; } else { $p_sLocale = explode(",", $p_sLocale); } } $p_sPattern = trim(strip_tags(Params::getParam('sPattern'))); // ADD TO THE LIST OF LAST SEARCHES if (osc_save_latest_searches() && (!Params::existParam('iPage') || Params::getParam('iPage') == 1)) { $savePattern = osc_apply_filter('save_latest_searches_pattern', $p_sPattern); if ($savePattern != '') { LatestSearches::newInstance()->insert(array('s_search' => $savePattern, 'd_date' => date('Y-m-d H:i:s'))); } } $p_bPic = Params::getParam('bPic'); $p_bPic = $p_bPic == 1 ? 1 : 0; $p_bPremium = Params::getParam('bPremium'); $p_bPremium = $p_bPremium == 1 ? 1 : 0; $p_sPriceMin = Params::getParam('sPriceMin'); $p_sPriceMax = Params::getParam('sPriceMax'); //WE CAN ONLY USE THE FIELDS RETURNED BY Search::getAllowedColumnsForSorting() $p_sOrder = Params::getParam('sOrder'); if (!in_array($p_sOrder, Search::getAllowedColumnsForSorting())) { $p_sOrder = osc_default_order_field_at_search(); } $old_order = $p_sOrder; //ONLY 0 ( => 'asc' ), 1 ( => 'desc' ) AS ALLOWED VALUES $p_iOrderType = Params::getParam('iOrderType'); $allowedTypesForSorting = Search::getAllowedTypesForSorting(); $orderType = osc_default_order_type_at_search(); foreach ($allowedTypesForSorting as $k => $v) { if ($p_iOrderType == $v) { $orderType = $k; break; } } $p_iOrderType = $orderType; $p_sFeed = Params::getParam('sFeed'); $p_iPage = 0; if (is_numeric(Params::getParam('iPage')) && Params::getParam('iPage') > 0) { $p_iPage = intval(Params::getParam('iPage')) - 1; } if ($p_sFeed != '') { $p_sPageSize = 1000; } $p_sShowAs = Params::getParam('sShowAs'); $aValidShowAsValues = array('list', 'gallery'); if (!in_array($p_sShowAs, $aValidShowAsValues)) { $p_sShowAs = osc_default_show_as_at_search(); } // search results: it's blocked with the maxResultsPerPage@search defined in t_preferences $p_iPageSize = intval(Params::getParam('iPagesize')); if ($p_iPageSize > 0) { if ($p_iPageSize > osc_max_results_per_page_at_search()) { $p_iPageSize = osc_max_results_per_page_at_search(); } } else { $p_iPageSize = osc_default_results_per_page_at_search(); } //FILTERING CATEGORY $bAllCategoriesChecked = false; $successCat = false; if (count($p_sCategory) > 0) { foreach ($p_sCategory as $category) { $successCat = $this->mSearch->addCategory($category) || $successCat; } } else { $bAllCategoriesChecked = true; } //FILTERING CITY_AREA foreach ($p_sCityArea as $city_area) { $this->mSearch->addCityArea($city_area); } $p_sCityArea = implode(", ", $p_sCityArea); //FILTERING CITY foreach ($p_sCity as $city) { $this->mSearch->addCity($city); } $p_sCity = implode(", ", $p_sCity); //FILTERING REGION foreach ($p_sRegion as $region) { $this->mSearch->addRegion($region); } $p_sRegion = implode(", ", $p_sRegion); //FILTERING COUNTRY foreach ($p_sCountry as $country) { $this->mSearch->addCountry($country); } $p_sCountry = implode(", ", $p_sCountry); // FILTERING PATTERN if ($p_sPattern != '') { $this->mSearch->addPattern($p_sPattern); $osc_request['sPattern'] = $p_sPattern; } else { // hardcoded - if there isn't a search pattern, order by dt_pub_date desc if ($p_sOrder == 'relevance') { $p_sOrder = 'dt_pub_date'; foreach ($allowedTypesForSorting as $k => $v) { if ($p_iOrderType == 'desc') { $orderType = $k; break; } } $p_iOrderType = $orderType; } } // FILTERING USER if ($p_sUser != '') { $this->mSearch->fromUser($p_sUser); } // FILTERING LOCALE $this->mSearch->addLocale($p_sLocale); // FILTERING IF WE ONLY WANT ITEMS WITH PICS if ($p_bPic) { $this->mSearch->withPicture(true); } // FILTERING IF WE ONLY WANT PREMIUM ITEMS if ($p_bPremium) { $this->mSearch->onlyPremium(true); } //FILTERING BY RANGE PRICE $this->mSearch->priceRange($p_sPriceMin, $p_sPriceMax); //ORDERING THE SEARCH RESULTS $this->mSearch->order($p_sOrder, $allowedTypesForSorting[$p_iOrderType]); //SET PAGE if ($p_sFeed == 'rss') { // If param sFeed=rss, just output last 'osc_num_rss_items()' $this->mSearch->page(0, osc_num_rss_items()); } else { $this->mSearch->page($p_iPage, $p_iPageSize); } // CUSTOM FIELDS $custom_fields = Params::getParam('meta'); $fields = Field::newInstance()->findIDSearchableByCategories($p_sCategory); $table = DB_TABLE_PREFIX . 't_item_meta'; if (is_array($custom_fields)) { foreach ($custom_fields as $key => $aux) { if (in_array($key, $fields)) { $field = Field::newInstance()->findByPrimaryKey($key); switch ($field['e_type']) { case 'TEXTAREA': case 'TEXT': case 'URL': if ($aux != '') { $aux = "%{$aux}%"; $sql = "SELECT fk_i_item_id FROM {$table} WHERE "; $str_escaped = Search::newInstance()->dao->escape($aux); $sql .= $table . '.fk_i_field_id = ' . $key . ' AND '; $sql .= $table . ".s_value LIKE " . $str_escaped; $this->mSearch->addConditions(DB_TABLE_PREFIX . 't_item.pk_i_id IN (' . $sql . ')'); } break; case 'DROPDOWN': case 'RADIO': if ($aux != '') { $sql = "SELECT fk_i_item_id FROM {$table} WHERE "; $str_escaped = Search::newInstance()->dao->escape($aux); $sql .= $table . '.fk_i_field_id = ' . $key . ' AND '; $sql .= $table . ".s_value = " . $str_escaped; $this->mSearch->addConditions(DB_TABLE_PREFIX . 't_item.pk_i_id IN (' . $sql . ')'); } break; case 'CHECKBOX': if ($aux != '') { $sql = "SELECT fk_i_item_id FROM {$table} WHERE "; $sql .= $table . '.fk_i_field_id = ' . $key . ' AND '; $sql .= $table . ".s_value = 1"; $this->mSearch->addConditions(DB_TABLE_PREFIX . 't_item.pk_i_id IN (' . $sql . ')'); } break; case 'DATE': if ($aux != '') { $y = (int) date('Y', $aux); $m = (int) date('n', $aux); $d = (int) date('j', $aux); $start = mktime('0', '0', '0', $m, $d, $y); $end = mktime('23', '59', '59', $m, $d, $y); $sql = "SELECT fk_i_item_id FROM {$table} WHERE "; $sql .= $table . '.fk_i_field_id = ' . $key . ' AND '; $sql .= $table . ".s_value >= " . $start . " AND "; $sql .= $table . ".s_value <= " . $end; $this->mSearch->addConditions(DB_TABLE_PREFIX . 't_item.pk_i_id IN (' . $sql . ')'); } break; case 'DATEINTERVAL': if (is_array($aux) && (!empty($aux['from']) && !empty($aux['to']))) { $from = $aux['from']; $to = $aux['to']; $start = $from; $end = $to; $sql = "SELECT fk_i_item_id FROM {$table} WHERE "; $sql .= $table . '.fk_i_field_id = ' . $key . ' AND '; $sql .= $start . " >= " . $table . ".s_value AND s_multi = 'from'"; $sql1 = "SELECT fk_i_item_id FROM {$table} WHERE "; $sql1 .= $table . ".fk_i_field_id = " . $key . " AND "; $sql1 .= $end . " <= " . $table . ".s_value AND s_multi = 'to'"; $sql_interval = "select a.fk_i_item_id from (" . $sql . ") a where a.fk_i_item_id IN (" . $sql1 . ")"; $this->mSearch->addConditions(DB_TABLE_PREFIX . 't_item.pk_i_id IN (' . $sql_interval . ')'); } break; default: break; } } } } osc_run_hook('search_conditions', Params::getParamsAsArray()); // RETRIEVE ITEMS AND TOTAL $key = md5(osc_base_url() . $this->mSearch->toJson()); $found = null; $cache = osc_cache_get($key, $found); $aItems = null; $iTotalItems = null; if ($cache) { $aItems = $cache['aItems']; $iTotalItems = $cache['iTotalItems']; } else { $aItems = $this->mSearch->doSearch(); $iTotalItems = $this->mSearch->count(); $_cache['aItems'] = $aItems; $_cache['iTotalItems'] = $iTotalItems; osc_cache_set($key, $_cache, OSC_CACHE_TTL); } $iStart = $p_iPage * $p_iPageSize; $iEnd = min(($p_iPage + 1) * $p_iPageSize, $iTotalItems); $iNumPages = ceil($iTotalItems / $p_iPageSize); // works with cache enabled ? osc_run_hook('search', $this->mSearch); //preparing variables... $countryName = $p_sCountry; if (strlen($p_sCountry) == 2) { $c = Country::newInstance()->findByCode($p_sCountry); if ($c) { $countryName = $c['s_name']; } } $regionName = $p_sRegion; if (is_numeric($p_sRegion)) { $r = Region::newInstance()->findByPrimaryKey($p_sRegion); if ($r) { $regionName = $r['s_name']; } } $cityName = $p_sCity; if (is_numeric($p_sCity)) { $c = City::newInstance()->findByPrimaryKey($p_sCity); if ($c) { $cityName = $c['s_name']; } } $this->_exportVariableToView('search_start', $iStart); $this->_exportVariableToView('search_end', $iEnd); $this->_exportVariableToView('search_category', $p_sCategory); // hardcoded - non pattern and order by relevance $p_sOrder = $old_order; $this->_exportVariableToView('search_order_type', $p_iOrderType); $this->_exportVariableToView('search_order', $p_sOrder); $this->_exportVariableToView('search_pattern', $p_sPattern); $this->_exportVariableToView('search_from_user', $p_sUser); $this->_exportVariableToView('search_total_pages', $iNumPages); $this->_exportVariableToView('search_page', $p_iPage); $this->_exportVariableToView('search_has_pic', $p_bPic); $this->_exportVariableToView('search_only_premium', $p_bPremium); $this->_exportVariableToView('search_country', $countryName); $this->_exportVariableToView('search_region', $regionName); $this->_exportVariableToView('search_city', $cityName); $this->_exportVariableToView('search_price_min', $p_sPriceMin); $this->_exportVariableToView('search_price_max', $p_sPriceMax); $this->_exportVariableToView('search_total_items', $iTotalItems); $this->_exportVariableToView('items', $aItems); $this->_exportVariableToView('search_show_as', $p_sShowAs); $this->_exportVariableToView('search', $this->mSearch); // json $json = $this->mSearch->toJson(); $encoded_alert = base64_encode(osc_encrypt_alert($json)); // Create the HMAC signature and convert the resulting hex hash into base64 $stringToSign = osc_get_alert_public_key() . $encoded_alert; $signature = hex2b64(hmacsha1(osc_get_alert_private_key(), $stringToSign)); $server_signature = Session::newInstance()->_set('alert_signature', $signature); $this->_exportVariableToView('search_alert', $encoded_alert); // calling the view... if (count($aItems) === 0) { header('HTTP/1.1 404 Not Found'); } osc_run_hook("after_search"); if (!Params::existParam('sFeed')) { $this->doView('search.php'); } else { if ($p_sFeed == '' || $p_sFeed == 'rss') { // FEED REQUESTED! header('Content-type: text/xml; charset=utf-8'); $feed = new RSSFeed(); $feed->setTitle(__('Latest listings added') . ' - ' . osc_page_title()); $feed->setLink(osc_base_url()); $feed->setDescription(__('Latest listings added in') . ' ' . osc_page_title()); if (osc_count_items() > 0) { while (osc_has_items()) { if (osc_count_item_resources() > 0) { osc_has_item_resources(); $feed->addItem(array('title' => osc_item_title(), 'link' => htmlentities(osc_item_url(), ENT_COMPAT, "UTF-8"), 'description' => osc_item_description(), 'country' => osc_item_country(), 'region' => osc_item_region(), 'city' => osc_item_city(), 'city_area' => osc_item_city_area(), 'category' => osc_item_category(), 'dt_pub_date' => osc_item_pub_date(), 'image' => array('url' => htmlentities(osc_resource_thumbnail_url(), ENT_COMPAT, "UTF-8"), 'title' => osc_item_title(), 'link' => htmlentities(osc_item_url(), ENT_COMPAT, "UTF-8")))); } else { $feed->addItem(array('title' => osc_item_title(), 'link' => htmlentities(osc_item_url(), ENT_COMPAT, "UTF-8"), 'description' => osc_item_description(), 'country' => osc_item_country(), 'region' => osc_item_region(), 'city' => osc_item_city(), 'city_area' => osc_item_city_area(), 'category' => osc_item_category(), 'dt_pub_date' => osc_item_pub_date())); } } } osc_run_hook('feed', $feed); $feed->dumpXML(); } else { osc_run_hook('feed_' . $p_sFeed, $aItems); } } }
function meta_title() { $location = Rewrite::newInstance()->get_location(); $section = Rewrite::newInstance()->get_section(); $text = ''; switch ($location) { case 'item': switch ($section) { case 'item_add': $text = __('Publish a listing'); break; case 'item_edit': $text = __('Edit your listing'); break; case 'send_friend': $text = __('Send to a friend') . ' - ' . osc_item_title(); break; case 'contact': $text = __('Contact seller') . ' - ' . osc_item_title(); break; default: $text = osc_item_title() . ' ' . osc_item_city(); break; } break; case 'page': $text = osc_static_page_title(); break; case 'error': $text = __('Error'); break; case 'search': $region = osc_search_region(); $city = osc_search_city(); $pattern = osc_search_pattern(); $category = osc_search_category_id(); $s_page = ''; $i_page = Params::getParam('iPage'); if ($i_page != '' && $i_page > 1) { $s_page = ' - ' . __('page') . ' ' . $i_page; } $b_show_all = $region == '' && $city == '' && $pattern == '' && empty($category); $b_category = !empty($category); $b_pattern = $pattern != ''; $b_city = $city != ''; $b_region = $region != ''; if ($b_show_all) { $text = __('Show all listings') . ' - ' . $s_page . osc_page_title(); } $result = ''; if ($b_pattern) { $result .= $pattern . ' » '; } if ($b_category && is_array($category) && count($category) > 0) { $cat = Category::newInstance()->findByPrimaryKey($category[0]); if ($cat) { $result .= $cat['s_name'] . ' '; } } if ($b_city) { $result .= $city . ' » '; } else { if ($b_region) { $result .= $region . ' » '; } } $result = preg_replace('|\\s?»\\s$|', '', $result); if ($result == '') { $result = __('Search results'); } $text = ''; if (osc_get_preference('seo_title_keyword') != '') { $text .= osc_get_preference('seo_title_keyword') . ' '; } $text .= $result . $s_page; break; case 'login': switch ($section) { case 'recover': $text = __('Recover your password'); default: $text = __('Login'); } break; case 'register': $text = __('Create a new account'); break; case 'user': switch ($section) { case 'dashboard': $text = __('Dashboard'); break; case 'items': $text = __('Manage my listings'); break; case 'alerts': $text = __('Manage my alerts'); break; case 'profile': $text = __('Update my profile'); break; case 'pub_profile': $text = __('Public profile') . ' - ' . osc_user_name(); break; case 'change_email': $text = __('Change my email'); break; case 'change_username': $text = __('Change my username'); break; case 'change_password': $text = __('Change my password'); break; case 'forgot': $text = __('Recover my password'); break; } break; case 'contact': $text = __('Contact'); break; default: $text = osc_page_title(); break; } if (!osc_is_home_page()) { if ($text != '') { $text .= ' - ' . osc_page_title(); } else { $text = osc_page_title(); } } return osc_apply_filter('meta_title_filter', $text); }
function allSeo_title_filter($text) { $location = Rewrite::newInstance()->get_location(); $section = Rewrite::newInstance()->get_section(); switch ($location) { // Listing page and page related to listings case 'item': switch ($section) { case 'item_add': $text = __('Publish a listing', 'all_in_one'); break; case 'item_edit': $text = __('Edit your listing', 'all_in_one'); break; case 'send_friend': $text = __('Send to a friend', 'all_in_one') . Delimiter() . osc_item_title(); break; case 'contact': $text = __('Contact seller', 'all_in_one') . Delimiter() . osc_item_title(); break; default: $text = SeoGenerateTitleListing(); break; } break; // Static page // Static page case 'page': if (GetPageTitle() == '') { $text = osc_static_page_title(); } else { $text = GetPageTitle(); } break; // Error page // Error page case 'error': $text = __('Page not found', 'all_in_one'); break; // Search & Category page // Search & Category page case 'search': $region = osc_search_region(); $city = osc_search_city(); $pattern = osc_search_pattern(); $category = osc_search_category_id(); $s_page = ''; $i_page = Params::getParam('iPage'); if ($i_page != '' && $i_page > 1) { $s_page = Delimiter() . __('page', 'all_in_one') . ' ' . $i_page; } $result = SeoGenerateTitleCategory(); if ($result == '') { $result = __('Search result', 'all_in_one'); } $text = $result . $s_page; break; // Login page // Login page case 'login': switch ($section) { case 'recover': $text = __('Recover your password', 'all_in_one'); default: $text = __('Login into your account', 'all_in_one'); } break; // Registration page // Registration page case 'register': $text = __('Create a new account', 'all_in_one'); break; // User page and pages related to user // User page and pages related to user case 'user': switch ($section) { case 'dashboard': $text = __('Dashboard', 'all_in_one'); break; case 'items': $text = __('Manage my listings', 'all_in_one'); break; case 'alerts': $text = __('Manage my alerts', 'all_in_one'); break; case 'profile': $text = __('Update my profile', 'all_in_one'); break; case 'pub_profile': $text = __('Public profile of', 'all_in_one') . ' ' . ucfirst(osc_user_name()); break; case 'change_email': $text = __('Change my email', 'all_in_one'); break; case 'change_password': $text = __('Change my password', 'all_in_one'); break; case 'forgot': $text = __('Recover my password', 'all_in_one'); break; } break; // Contact page // Contact page case 'contact': $text = __('Contact', 'all_in_one'); break; default: $text = osc_page_title(); break; } // Now add page title to first or last position for other pages if (!osc_is_home_page() and !osc_is_ad_page() and !osc_is_search_page()) { $title = osc_get_preference('allSeo_other_page_title', 'plugin-all_in_one') != '' ? osc_get_preference('allSeo_other_page_title', 'plugin-all_in_one') : osc_page_title(); if (osc_get_preference('allSeo_title_first', 'plugin-all_in_one') == 1) { $text = $title . Delimiter() . $text; } else { $text .= Delimiter() . $title; } } return $text; }
private function toArrayFormat() { $this->result['iTotalRecords'] = $this->total_filtered; $this->result['iTotalDisplayRecords'] = $this->total; $this->result['iDisplayLength'] = $this->_get['iDisplayLength']; $this->result['aaData'] = array(); $this->result['aaObject'] = array(); if (count($this->comments) == 0) { return; } $this->result['aaObject'] = $this->comments; $count = 0; foreach ($this->comments as $comment) { $row = array(); $options = array(); $options_more = array(); View::newInstance()->_exportVariableToView('item', Item::newInstance()->findByPrimaryKey($comment['fk_i_item_id'])); if ($comment['b_active']) { $options_more[] = '<a href="' . osc_admin_base_url(true) . '?page=comments&action=status&id=' . $comment['pk_i_id'] . '&value=INACTIVE">' . __('Deactivate') . '</a>'; } else { $options_more[] = '<a href="' . osc_admin_base_url(true) . '?page=comments&action=status&id=' . $comment['pk_i_id'] . '&value=ACTIVE">' . __('Activate') . '</a>'; } if ($comment['b_enabled']) { $options_more[] = '<a href="' . osc_admin_base_url(true) . '?page=comments&action=status&id=' . $comment['pk_i_id'] . '&value=DISABLE">' . __('Block') . '</a>'; } else { $options_more[] = '<a href="' . osc_admin_base_url(true) . '?page=comments&action=status&id=' . $comment['pk_i_id'] . '&value=ENABLE">' . __('Unblock') . '</a>'; } $options[] = '<a href="' . osc_admin_base_url(true) . '?page=comments&action=comment_edit&id=' . $comment['pk_i_id'] . '" id="dt_link_edit">' . __('Edit') . '</a>'; $options[] = '<a onclick="return delete_dialog(\'' . $comment['pk_i_id'] . '\');" href="' . osc_admin_base_url(true) . '?page=comments&action=delete&id=' . $comment['pk_i_id'] . '" id="dt_link_delete">' . __('Delete') . '</a>'; // more actions $moreOptions = '<li class="show-more">' . PHP_EOL . '<a href="#" class="show-more-trigger">' . __('Show more') . '...</a>' . PHP_EOL . '<ul>' . PHP_EOL; foreach ($options_more as $actual) { $moreOptions .= '<li>' . $actual . "</li>" . PHP_EOL; } $moreOptions .= '</ul>' . PHP_EOL . '</li>' . PHP_EOL; // create list of actions $auxOptions = '<ul>' . PHP_EOL; foreach ($options as $actual) { $auxOptions .= '<li>' . $actual . '</li>' . PHP_EOL; } $auxOptions .= $moreOptions; $auxOptions .= '</ul>' . PHP_EOL; $actions = '<div class="actions">' . $auxOptions . '</div>' . PHP_EOL; $row[] = '<input type="checkbox" name="id[]" value="' . $comment['pk_i_id'] . '" />'; if (empty($comment['s_author_name'])) { $user = User::newInstance()->findByPrimaryKey($comment['fk_i_user_id']); $comment['s_author_name'] = $user['s_email']; } $row[] = $comment['s_author_name'] . ' (<a target="_blank" href="' . osc_item_url() . '">' . osc_item_title() . '</a>)' . $actions; $row[] = $comment['s_body']; $row[] = $comment['dt_pub_date']; $count++; $this->result['aaData'][] = $row; } }
function osclasswizards_item_title() { $title = osc_item_title(); foreach (osc_get_locales() as $locale) { if (Session::newInstance()->_getForm('title') != "") { $title_ = Session::newInstance()->_getForm('title'); if (@$title_[$locale['pk_c_code']] != "") { $title = $title_[$locale['pk_c_code']]; } } } return $title; }
function breadcrumbs($separator = '/') { $text = ''; $location = Rewrite::newInstance()->get_location(); $section = Rewrite::newInstance()->get_section(); $separator = ' ' . trim($separator) . ' '; $page_title = '<a href="' . osc_base_url() . '"><span class="bc_root">' . osc_page_title() . '</span></a>'; switch ($location) { case 'item': switch ($section) { case 'item_add': break; default: $aCategories = Category::newInstance()->toRootTree((string) osc_item_category_id()); $category = ''; if (count($aCategories) == 0) { break; } $deep = 1; foreach ($aCategories as $aCategory) { $list[] = '<a href="' . breadcrumbs_category_url($aCategory['pk_i_id']) . '"><span class="bc_level_' . $deep . '">' . $aCategory['s_name'] . '</span></a>'; $deep++; } $category = implode($separator, $list) . $separator; $category = preg_replace('|' . trim($separator) . '\\s*$|', '', $category); break; } switch ($section) { case 'item_add': $text = $page_title . $separator . '<span class="bc_last">' . __('Publish an item', 'breadcrumbs'); break; case 'item_edit': $text = $page_title . $separator . $category . $separator . '<a href="' . osc_item_url() . '"><span class="bc_item">' . osc_item_title() . '</span></a>' . $separator . '<span class="bc_last">' . __('Edit your item', 'breadcrumbs') . '</span>'; break; case 'send_friend': $text = $page_title . $separator . $category . $separator . '<a href="' . osc_item_url() . '"><span class="bc_item">' . osc_item_title() . '</span></a>' . $separator . '<span class="bc_last">' . __('Send to a friend', 'breadcrumbs') . '</span>'; break; case 'contact': $text = $page_title . $separator . $category . $separator . '<a href="' . osc_item_url() . '"><span class="bc_item">' . osc_item_title() . '</span></a>' . $separator . '<span class="bc_last">' . __('Contact seller', 'breadcrumbs') . '</span>'; break; default: $text = $page_title . $separator . $category . $separator . '<span class="bc_last">' . osc_item_title() . '</span>'; break; } break; case 'page': $text = $page_title . $separator . '<span class="bc_last">' . osc_static_page_title() . '</span>'; break; case 'search': $region = osc_search_region(); $city = osc_search_city(); $pattern = osc_search_pattern(); $category = osc_search_category_id(); $category = count($category) == 1 ? $category[0] : ''; $b_show_all = $pattern == '' && $category == '' && $region == '' && $city == ''; $b_category = $category != ''; $b_pattern = $pattern != ''; $b_region = $region != ''; $b_city = $city != ''; $b_location = $b_region || $b_city; if ($b_show_all) { $text = $page_title . $separator . '<span class="bc_last">' . __('Search', 'breadcrumbs') . '</span>'; break; } // init $result = $page_title . $separator; if ($b_category) { $list = array(); $aCategories = Category::newInstance()->toRootTree($category); if (count($aCategories) > 0) { $deep = 1; foreach ($aCategories as $single) { $list[] = '<a href="' . breadcrumbs_category_url($single['pk_i_id']) . '"><span class="bc_level_' . $deep . '">' . $single['s_name'] . '</span></a>'; $deep++; } // remove last link if (!$b_pattern && !$b_location) { $list[count($list) - 1] = preg_replace('|<a href.*?>(.*?)</a>|', '$01', $list[count($list) - 1]); } $result .= implode($separator, $list) . $separator; } } if ($b_location) { $list = array(); $params = array(); if ($b_category) { $params['sCategory'] = $category; } if ($b_city) { $aCity = City::newInstance()->findByName($city); if (count($aCity) == 0) { $params['sCity'] = $city; $list[] = '<a href="' . osc_search_url($params) . '"><span class="bc_city">' . $city . '</span></a>'; } else { $aRegion = Region::newInstance()->findByPrimaryKey($aCity['fk_i_region_id']); $params['sRegion'] = $aRegion['s_name']; $list[] = '<a href="' . osc_search_url($params) . '"><span class="bc_region">' . $aRegion['s_name'] . '</span></a>'; $params['sCity'] = $aCity['s_name']; $list[] = '<a href="' . osc_search_url($params) . '"><span class="bc_city">' . $aCity['s_name'] . '</span></a>'; } if (!$b_pattern) { $list[count($list) - 1] = preg_replace('|<a href.*?>(.*?)</a>|', '$01', $list[count($list) - 1]); } $result .= implode($separator, $list) . $separator; } else { if ($b_region) { $params['sRegion'] = $region; $list[] = '<a href="' . osc_search_url($params) . '"><span class="bc_region">' . $region . '</span></a>'; if (!$b_pattern) { $list[count($list) - 1] = preg_replace('|<a href.*?>(.*?)</a>|', '$01', $list[count($list) - 1]); } $result .= implode($separator, $list) . $separator; } } } if ($b_pattern) { $result .= '<span class="bc_last">' . __('Search Results', 'breadcrumbs') . ': ' . $pattern . '</span>' . $separator; } // remove last separator $result = preg_replace('|' . trim($separator) . '\\s*$|', '', $result); $text = $result; break; case 'login': switch ($section) { case 'recover': $text = $page_title . $separator . '<span class="bc_last">' . __('Recover your password', 'breadcrumbs') . '</span>'; default: $text = $page_title . $separator . '<span class="bc_last">' . __('Login', 'breadcrumbs') . '</span>'; } break; case 'register': $text = $page_title . $separator . '<span class="bc_last">' . __('Create a new account', 'breadcrumbs') . '</span>'; break; case 'user': $user_dashboard = '<a href="' . osc_user_dashboard_url() . '"><span class="bc_user">' . __('My account', 'breadcrumbs') . '</span></a>'; switch ($section) { case 'dashboard': $text = $page_title . $separator . $user_dashboard . $separator . '<span class="bc_last">' . __('Dashboard', 'breadcrumbs') . '</span>'; break; case 'items': $text = $page_title . $separator . $user_dashboard . $separator . '<span class="bc_last">' . __('Manage my items', 'breadcrumbs') . '</span>'; break; case 'alerts': $text = $page_title . $separator . $user_dashboard . $separator . '<span class="bc_last">' . __('Manage my alerts', 'breadcrumbs') . '</span>'; break; case 'profile': $text = $page_title . $separator . $user_dashboard . $separator . '<span class="bc_last">' . __('Update my profile', 'breadcrumbs') . '</span>'; break; case 'change_email': $text = $page_title . $separator . $user_dashboard . $separator . '<span class="bc_last">' . __('Change my email', 'breadcrumbs') . '</span>'; break; case 'change_password': $text = $page_title . $separator . $user_dashboard . $separator . '<span class="bc_last">' . __('Change my password', 'breadcrumbs') . '</span>'; break; case 'forgot': $text = $page_title . $separator . $user_dashboard . $separator . '<span class="bc_last">' . __('Recover my password', 'breadcrumbs') . '</span>'; break; } break; case 'contact': $text = $page_title . $separator . '<span class="bc_last">' . __('Contact', 'breadcrumbs') . '</span>'; break; default: break; } echo $text; return true; }
function item_success_share_buttons($url, $id) { ?> <style> #share-nav .share-buttons.v2 { float: none; padding-bottom: 0px !important; margin-bottom: 0px !important; padding-top: 0px !important; font-size: 14px; } #share-nav .share-buttons { display: inline-block; } .primary-shares { display: inline-block; width: 760px; } .share-buttons div, .share-buttons a { vertical-align: middle; text-decoration: none; } #share-nav .facebook, #share-nav .twitter, #share-nav .google_plus { margin-right: 8px !important; line-height: 34px; margin-top: 5px; height: 34px; width: 48px; color: #fff; } .share-buttons.v2 .facebook { background: #2d609b; color: transparent; } .share-buttons.v2 .facebook, .share-buttons.v2 .twitter, .share-buttons.v2 .google_plus { font-size: 14px; text-rendering: optimizeLegibility; margin-right: 2px; line-height: 41px; font-family: "ProximaNovaRegular"; font-weight: 500; width: 30px; } .share-buttons.v2 .facebook, .share-buttons.v2 .twitter, .share-buttons.v2 .google_plus { border-radius: 2px; margin-right: 4px; background: #c5c5c5; position: relative; display: inline-block; cursor: pointer; height: 41px; width: 41px; color: #fff; } #share-nav .share-buttons.v2 .expanded-text, #share-nav .share-buttons.v2 .primary-text { display: inline; font-weight: bold; } .share-buttons.v2 span { vertical-align: top; } #share-nav .share-buttons.v2 .facebook { color: #fff; } #share-nav .facebook, #share-nav .google_plus, #share-nav .twitter { line-height: 34px; color: #fff; } .share-buttons.v2 .facebook, .share-buttons.v2 .twitter , .share-buttons.v2 .google_plus { font-size: 14px; line-height: 41px; font-family: "ProximaNovaRegular"; font-weight: 500; } #share-nav .share-buttons.v2 .twitter { width: 168px; color: #fff; } #share-nav .share-buttons.v2 .google_plus { width: 180px; color: #fff; } #share-nav .share-buttons.v2 .facebook { width: 183px; color: #fff; } .share-buttons.v2 .twitter { background: #00c3f3; } .share-buttons.v2 .facebook { background: #2d609b; } .share-buttons.v2 .google_plus { background: #eb4026; } .fa { font-size: 24px; line-height: 34px; } </style> <script> function shareTw() { var popUp = window.open("https://twitter.com/share?url=<?php echo urlencode($url) . '&text=' . urlencode(osc_item_title()); ?> ", 'popupwindow', 'scrollbars=yes,width=800,height=400'); popUp.focus(); return false; } function shareFb() { var popUp = window.open("https://www.facebook.com/sharer.php?u=<?php echo urlencode($url); ?> &t=<?php echo urlencode(osc_item_title()); ?> ", 'popupwindow', 'scrollbars=yes,width=800,height=400'); popUp.focus(); return false; } function shareGp() { var popUp = window.open("https://plus.google.com/share?url=<?php echo urlencode($url); ?> ", 'popupwindow', 'scrollbars=yes,width=800,height=400'); popUp.focus(); return false; } </script> <div id="share-nav"> <div class="share-buttons v2"> <div class="primary-shares"> <a class="social-share facebook" target="_blank" onclick="shareFb(); return false;" href="#"> <i class="fa fa-facebook-square"></i> <span class="primary-text"><?php _e('Share on Facebook', 'item_success'); ?> </span> </a> <a class="social-share twitter" onclick="shareTw(); return false;" href="#"> <i class="fa fa-twitter"></i> <span class="primary-text"><?php _e('Share on Twitter', 'item_success'); ?> </span> </a> <a class="social-share google_plus" onclick="shareGp(); return false;" href="#"> <i class="fa fa-google-plus"></i> <span class="primary-text"><?php _e('Share on Google+', 'item_success'); ?> </span> </a> </div> </div> </div> <?php }
function doModel() { $mCategories = new Category(); $aCategories = $mCategories->findRootCategories(); $mCategoryStats = new CategoryStats(); //////////////////////////////// //GETTING AND FIXING SENT DATA// //////////////////////////////// $p_sCategory = Params::getParam('sCategory'); if (!is_array($p_sCategory)) { if ($p_sCategory == '') { $p_sCategory = array(); } else { $p_sCategory = explode(",", $p_sCategory); } } $p_sCity = Params::getParam('sCity'); if (!is_array($p_sCity)) { if ($p_sCity == '') { $p_sCity = array(); } else { $p_sCity = explode(",", $p_sCity); } } $p_sRegion = Params::getParam('sRegion'); if (!is_array($p_sRegion)) { if ($p_sRegion == '') { $p_sRegion = array(); } else { $p_sRegion = explode(",", $p_sRegion); } } $p_sCountry = Params::getParam('sCountry'); if (!is_array($p_sCountry)) { if ($p_sCountry == '') { $p_sCountry = array(); } else { $p_sCountry = explode(",", $p_sCountry); } } $p_sPattern = strip_tags(Params::getParam('sPattern')); $p_bPic = Params::getParam('bPic'); $p_bPic == 1 ? $p_bPic = 1 : ($p_bPic = 0); $p_sPriceMin = Params::getParam('sPriceMin'); $p_sPriceMax = Params::getParam('sPriceMax'); //WE CAN ONLY USE THE FIELDS RETURNED BY Search::getAllowedColumnsForSorting() $p_sOrder = Params::getParam('sOrder'); if (!in_array($p_sOrder, Search::getAllowedColumnsForSorting())) { $p_sOrder = osc_default_order_field_at_search(); } //ONLY 0 ( => 'asc' ), 1 ( => 'desc' ) AS ALLOWED VALUES $p_iOrderType = Params::getParam('iOrderType'); $allowedTypesForSorting = Search::getAllowedTypesForSorting(); $orderType = osc_default_order_type_at_search(); foreach ($allowedTypesForSorting as $k => $v) { if ($p_iOrderType == $v) { $orderType = $k; break; } } $p_iOrderType = $orderType; $p_sFeed = Params::getParam('sFeed'); $p_iPage = intval(Params::getParam('iPage')); if ($p_sFeed != '') { $p_sPageSize = 1000; } $p_sShowAs = Params::getParam('sShowAs'); $aValidShowAsValues = array('list', 'gallery'); if (!in_array($p_sShowAs, $aValidShowAsValues)) { $p_sShowAs = osc_default_show_as_at_search(); } // search results: it's blocked with the maxResultsPerPage@search defined in t_preferences $p_iPageSize = intval(Params::getParam('iPagesize')); if ($p_iPageSize > 0) { if ($p_iPageSize > osc_max_results_per_page_at_search()) { $p_iPageSize = osc_max_results_per_page_at_search(); } } else { $p_iPageSize = osc_default_results_per_page_at_search(); } //FILTERING CATEGORY $bAllCategoriesChecked = false; if (count($p_sCategory) > 0) { foreach ($p_sCategory as $category) { $this->mSearch->addCategory($category); } } else { $bAllCategoriesChecked = true; } //FILTERING CITY foreach ($p_sCity as $city) { $this->mSearch->addCity($city); } $p_sCity = implode(", ", $p_sCity); //FILTERING REGION foreach ($p_sRegion as $region) { $this->mSearch->addRegion($region); } $p_sRegion = implode(", ", $p_sRegion); //FILTERING COUNTRY foreach ($p_sCountry as $country) { $this->mSearch->addCountry($country); } $p_sCountry = implode(", ", $p_sCountry); // FILTERING PATTERN if ($p_sPattern != '') { $this->mSearch->addConditions(sprintf("(d.s_title LIKE '%%%s%%' OR d.s_description LIKE '%%%s%%')", $p_sPattern, $p_sPattern)); $osc_request['sPattern'] = $p_sPattern; } // FILTERING IF WE ONLY WANT ITEMS WITH PICS if ($p_bPic) { $this->mSearch->withPicture(true); } //FILTERING BY RANGE PRICE $this->mSearch->priceRange($p_sPriceMin, $p_sPriceMax); //ORDERING THE SEARCH RESULTS $this->mSearch->order($p_sOrder, $allowedTypesForSorting[$p_iOrderType]); //SET PAGE $this->mSearch->page($p_iPage, $p_iPageSize); osc_run_hook('search_conditions', Params::getParamsAsArray()); $this->mSearch->addConditions(sprintf("%st_item.e_status = 'ACTIVE' ", DB_TABLE_PREFIX)); // RETRIEVE ITEMS AND TOTAL $iTotalItems = $this->mSearch->count(); $aItems = $this->mSearch->doSearch(); if (!Params::existParam('sFeed')) { $iStart = $p_iPage * $p_iPageSize; $iEnd = min(($p_iPage + 1) * $p_iPageSize, $iTotalItems); //Static data, which is the point? /*$aOrders = array( __('Newly listed') => array('sOrder' => 'dt_pub_date', 'iOrderType' => 'desc') ,__('Lower price first') => array('sOrder' => 'f_price', 'iOrderType' => 'asc') ,__('Higher price first') => array('sOrder' => 'f_price', 'iOrderType' => 'desc') );*/ $iNumPages = ceil($iTotalItems / $p_iPageSize); //Categories for select at view "search.php" $mCategories = new Category(); $aCategories = $mCategories->findRootCategories(); $mCategoryStats = new CategoryStats(); $aCategories = $mCategories->toTree(); foreach ($aCategories as $k => $v) { $iCategoryNumItems = CategoryStats::newInstance()->getNumItems($v); if ($iCategoryNumItems > 0) { $aCategories[$k]['total'] = $iCategoryNumItems; } else { unset($aCategories[$k]); } } osc_run_hook('search', $this->mSearch); //preparing variables... $this->_exportVariableToView('categories', $aCategories); $this->_exportVariableToView('search_start', $iStart); $this->_exportVariableToView('search_end', $iEnd); $this->_exportVariableToView('search_category', $p_sCategory); $this->_exportVariableToView('search_order_type', $p_iOrderType); $this->_exportVariableToView('search_order', $p_sOrder); $this->_exportVariableToView('search_pattern', $p_sPattern); $this->_exportVariableToView('search_total_pages', $iNumPages); $this->_exportVariableToView('search_page', $p_iPage); $this->_exportVariableToView('search_has_pic', $p_bPic); $this->_exportVariableToView('search_city', $p_sCity); $this->_exportVariableToView('search_price_min', $p_sPriceMin); $this->_exportVariableToView('search_price_max', $p_sPriceMax); $this->_exportVariableToView('search_total_items', $iTotalItems); $this->_exportVariableToView('items', $aItems); $this->_exportVariableToView('search_show_as', $p_sShowAs); $this->_exportVariableToView('search', $this->mSearch); //calling the view... $this->doView('search.php'); } else { $this->_exportVariableToView('items', $aItems); if ($p_sFeed == '' || $p_sFeed == 'rss') { // FEED REQUESTED! header('Content-type: text/xml; charset=utf-8'); $feed = new RSSFeed(); $feed->setTitle(__('Latest items added') . ' - ' . osc_page_title()); $feed->setLink(osc_base_url()); $feed->setDescription(__('Latest items added in') . ' ' . osc_page_title()); if (osc_count_items() > 0) { while (osc_has_items()) { $feed->addItem(array('title' => osc_item_title(), 'link' => htmlentities(osc_item_url()), 'description' => osc_item_description())); } } osc_run_hook('feed', $feed); $feed->dumpXML(); } else { osc_run_hook('feed_' . $p_sFeed, $aItems); } } }
function twitter_breadcrumb($separator = '/') { $breadcrumb = array(); $text = ''; $location = Rewrite::newInstance()->get_location(); $section = Rewrite::newInstance()->get_section(); $separator = '<span class="divider">' . trim($separator) . '</span>'; $page_title = '<li><a href="' . osc_base_url() . '">' . osc_page_title() . '</a>' . $separator . '</li>'; switch ($location) { case 'item': switch ($section) { case 'item_add': break; default: $aCategories = Category::newInstance()->toRootTree((string) osc_item_category_id()); $category = ''; if (count($aCategories) == 0) { break; } foreach ($aCategories as $aCategory) { $list[] = '<li><a href="' . osc_item_category_url($aCategory['pk_i_id']) . '">' . $aCategory['s_name'] . '</a>' . $separator . '</li>'; } $category = implode('', $list); break; } switch ($section) { case 'item_add': $text = $page_title . '<li>' . __('Publish an item', 'twitter') . '</li>'; break; case 'item_edit': $text = $page_title . '<li><a href="' . osc_item_url() . '">' . osc_item_title() . '</a>' . $separator . '</li><li>' . __('Edit your item', 'twitter') . '</li>'; break; case 'send_friend': $text = $page_title . $category . '<li><a href="' . osc_item_url() . '">' . osc_item_title() . '</a>' . $separator . '</li><li>' . __('Send to a friend', 'twitter') . '</li>'; break; case 'contact': $text = $page_title . $category . '<li><a href="' . osc_item_url() . '">' . osc_item_title() . '</a>' . $separator . '<li><li>' . __('Contact seller', 'twitter') . '</li>'; break; default: $text = $page_title . $category . '<li>' . osc_item_title() . '</li>'; break; } break; case 'page': $text = $page_title . '<li>' . osc_static_page_title() . '</li>'; break; case 'search': $region = Params::getParam('sRegion'); $city = Params::getParam('sCity'); $pattern = Params::getParam('sPattern'); $category = osc_search_category_id(); $category = count($category) == 1 ? $category[0] : ''; $b_show_all = $pattern == '' && $category == '' && $region == '' && $city == ''; $b_category = $category != ''; $b_pattern = $pattern != ''; $b_region = $region != ''; $b_city = $city != ''; $b_location = $b_region || $b_city; if ($b_show_all) { $text = $page_title . '<li>' . __('Search', 'twitter') . '</li>'; break; } // init $result = $page_title; if ($b_category) { $list = array(); $aCategories = Category::newInstance()->toRootTree($category); if (count($aCategories) > 0) { $deep = 1; foreach ($aCategories as $single) { $list[] = '<li><a href="' . osc_item_category_url($single['pk_i_id']) . '">' . $single['s_name'] . '</a>' . $separator . '</li>'; $deep++; } // remove last link if (!$b_pattern && !$b_location) { $list[count($list) - 1] = preg_replace('|<li><a href.*?>(.*?)</a>.*?</li>|', '$01', $list[count($list) - 1]); } $result .= implode('', $list); } } if ($b_location) { $list = array(); $params = array(); if ($b_category) { $params['sCategory'] = $category; } if ($b_city) { $aCity = City::newInstance()->findByName($city); if (count($aCity) == 0) { $params['sCity'] = $city; $list[] = '<li><a href="' . osc_search_url($params) . '">' . $city . '</a>' . $separator . '</li>'; } else { $aRegion = Region::newInstance()->findByPrimaryKey($aCity['fk_i_region_id']); $params['sRegion'] = $aRegion['s_name']; $list[] = '<li><a href="' . osc_search_url($params) . '">' . $aRegion['s_name'] . '</a>' . $separator . '</li>'; $params['sCity'] = $aCity['s_name']; $list[] = '<li><a href="' . osc_search_url($params) . '">' . $aCity['s_name'] . '</a>' . $separator . '</li>'; } if (!$b_pattern) { $list[count($list) - 1] = preg_replace('|<li><a href.*?>(.*?)</a>.*?</li>|', '$01', $list[count($list) - 1]); } $result .= implode('', $list); } else { if ($b_region) { $params['sRegion'] = $region; $list[] = '<li><a href="' . osc_search_url($params) . '">' . $region . '</a>' . $separator . '</li>'; if (!$b_pattern) { $list[count($list) - 1] = preg_replace('|<li><a href.*?>(.*?)</a>.*?</li>|', '$01', $list[count($list) - 1]); } $result .= implode('', $list); } } } if ($b_pattern) { $result .= '<li>' . __('Search Results', 'twitter') . ': ' . $pattern . '</li>'; } // remove last separator $result = preg_replace('|' . trim($separator) . '\\s*$|', '', $result); $text = $result; break; case 'login': switch ($section) { case 'recover': $text = $page_title . '<li>' . __('Recover your password', 'twitter') . '</li>'; break; default: $text = $page_title . '<li>' . __('Login', 'twitter') . '</li>'; } break; case 'register': $text = $page_title . '<li>' . __('Create a new account', 'twitter') . '</li>'; break; case 'contact': $text = $page_title . '<li>' . __('Contact', 'twitter') . '</li>'; break; default: break; } return '<ul class="breadcrumb">' . $text . '</ul>'; }
public function init() { if (in_array($this->getLocation(), array('item', 'page', 'search', 'login', 'register', 'user', 'contact'))) { $l = array('url' => osc_base_url(), 'title' => osc_page_title()); $this->addLevel($l); } switch ($this->getLocation()) { case 'item': if ($this->getSection() == 'item_add') { $l = array('title' => $this->title['item_add']); $this->addLevel($l); break; } $aCategory = osc_get_category('id', osc_item_category_id()); // remove View::newInstance()->_erase('categories'); View::newInstance()->_erase('subcategories'); View::newInstance()->_exportVariableToView('category', $aCategory); $l = array('url' => osc_search_category_url(), 'title' => osc_category_name()); $this->addLevel($l); switch ($this->getSection()) { case 'item_edit': $l = array('url' => osc_item_url(), 'title' => osc_item_title()); $this->addLevel($l); $l = array('title' => $this->title['item_edit']); $this->addLevel($l); break; case 'send_friend': $l = array('url' => osc_item_url(), 'title' => osc_item_title()); $this->addLevel($l); $l = array('title' => $this->title['item_send_friend']); $this->addLevel($l); break; case 'contact': $l = array('url' => osc_item_url(), 'title' => osc_item_title()); $this->addLevel($l); $l = array('title' => $this->title['item_contact']); $this->addLevel($l); break; case '': $l = array('title' => osc_item_title()); $this->addLevel($l); break; } break; case 'search': $region = osc_search_region(); $city = osc_search_city(); $pattern = osc_search_pattern(); $category = osc_search_category_id(); $category = count($category) == 1 ? $category[0] : ''; $b_show_all = $pattern == '' && $category == '' && $region == '' && $city == ''; $b_category = $category != ''; $b_pattern = $pattern != ''; $b_region = $region != ''; $b_city = $city != ''; $b_location = $b_region || $b_city; // show all if ($b_show_all) { $l = array('title' => $this->title['search']); $this->addLevel($l); break; } // category if ($b_category) { $aCategories = Category::newInstance()->toRootTree($category); foreach ($aCategories as $c) { View::newInstance()->_erase('categories'); View::newInstance()->_erase('subcategories'); View::newInstance()->_exportVariableToView('category', $c); $l = array('url' => osc_search_category_url(), 'title' => osc_category_name()); $this->addLevel($l); } } // location if ($b_location) { $params = array(); if ($b_category) { $params['sCategory'] = $category; } if ($b_city) { //print_r("~~~~~~~~~~~~~~~~~~~".$city."~~~~~~~~~~~~~~~~~~~~"); $aCity = City::newInstance()->findByName($city); if (count($aCity) == 0) { $params['sCity'] = $city; $l = array('url' => osc_search_url($params), 'title' => $city); $this->addLevel($l); } else { $aRegion = Region::newInstance()->findByPrimaryKey($aCity['fk_i_region_id']); $params['sRegion'] = $aRegion['s_name']; $l = array('url' => osc_search_url($params), 'title' => $aRegion['s_name']); $this->addLevel($l); $params['sCity'] = $aCity['s_name']; $l = array('url' => osc_search_url($params), 'title' => $aCity['s_name']); $this->addLevel($l); } } else { if ($b_region) { $params['sRegion'] = $region; $l = array('url' => osc_search_url($params), 'title' => $region); $this->addLevel($l); } } } // pattern if ($b_pattern) { $l = array('title' => sprintf($this->title['search_pattern'], $pattern)); $this->addLevel($l); } // remove url from the last node $nodes = $this->getaLevel(); if ($nodes > 0) { if (array_key_exists('url', $nodes[count($nodes) - 1])) { unset($nodes[count($nodes) - 1]['url']); } } $this->setaLevel($nodes); break; case 'user': // use dashboard without url if you're in the dashboards if ($this->getSection() == 'dashboard') { $l = array('title' => $this->title['user_dashboard']); $this->addLevel($l); break; } // use dashboard without url if you're in the dashboards if ($this->getSection() == 'pub_profile') { $l = array('title' => sprintf($this->title['user_dashboard_profile'], osc_user_name())); $this->addLevel($l); break; } $l = array('url' => osc_user_dashboard_url(), 'title' => $this->title['user_account']); $this->addLevel($l); switch ($this->getSection()) { case 'items': $l = array('title' => $this->title['user_items']); $this->addLevel($l); break; case 'alerts': $l = array('title' => $this->title['user_alerts']); $this->addLevel($l); break; case 'profile': $l = array('title' => $this->title['user_profile']); $this->addLevel($l); break; case 'change_email': $l = array('title' => $this->title['user_change_email']); $this->addLevel($l); break; case 'change_password': $l = array('title' => $this->title['user_change_password']); $this->addLevel($l); break; case 'change_username': $l = array('title' => $this->title['user_change_username']); $this->addLevel($l); break; } break; case 'login': switch ($this->getSection()) { case 'recover': $l = array('title' => $this->title['login_recover']); $this->addLevel($l); break; case 'forgot': $l = array('title' => $this->title['login_forgot']); $this->addLevel($l); break; case '': $l = array('title' => $this->title['login']); $this->addLevel($l); break; } break; case 'register': $l = array('title' => $this->title['register']); $this->addLevel($l); break; case 'page': $l = array('title' => osc_static_page_title()); $this->addLevel($l); break; case 'contact': $l = array('title' => $this->title['contact']); $this->addLevel($l); break; } }
private function processData($comments) { if (!empty($comments)) { $csrf_token_url = osc_csrf_token_url(); foreach ($comments as $aRow) { $row = array(); $options = array(); $options_more = array(); View::newInstance()->_exportVariableToView('item', Item::newInstance()->findByPrimaryKey($aRow['fk_i_item_id'])); if ($aRow['b_active']) { $options_more[] = '<a href="' . osc_admin_base_url(true) . '?page=comments&action=status&id=' . $aRow['pk_i_id'] . '&' . $csrf_token_url . '&value=INACTIVE">' . __('Deactivate') . '</a>'; } else { $options_more[] = '<a href="' . osc_admin_base_url(true) . '?page=comments&action=status&id=' . $aRow['pk_i_id'] . '&' . $csrf_token_url . '&value=ACTIVE">' . __('Activate') . '</a>'; } if ($aRow['b_enabled']) { $options_more[] = '<a href="' . osc_admin_base_url(true) . '?page=comments&action=status&id=' . $aRow['pk_i_id'] . '&' . $csrf_token_url . '&value=DISABLE">' . __('Block') . '</a>'; } else { $options_more[] = '<a href="' . osc_admin_base_url(true) . '?page=comments&action=status&id=' . $aRow['pk_i_id'] . '&' . $csrf_token_url . '&value=ENABLE">' . __('Unblock') . '</a>'; } $options[] = '<a href="' . osc_admin_base_url(true) . '?page=comments&action=comment_edit&id=' . $aRow['pk_i_id'] . '" id="dt_link_edit">' . __('Edit') . '</a>'; $options[] = '<a onclick="return delete_dialog(\'' . $aRow['pk_i_id'] . '\');" href="' . osc_admin_base_url(true) . '?page=comments&action=delete&id=' . $aRow['pk_i_id'] . '" id="dt_link_delete">' . __('Delete') . '</a>'; // more actions $moreOptions = '<li class="show-more">' . PHP_EOL . '<a href="#" class="show-more-trigger">' . __('Show more') . '...</a>' . PHP_EOL . '<ul>' . PHP_EOL; foreach ($options_more as $actual) { $moreOptions .= '<li>' . $actual . "</li>" . PHP_EOL; } $moreOptions .= '</ul>' . PHP_EOL . '</li>' . PHP_EOL; // create list of actions $auxOptions = '<ul>' . PHP_EOL; foreach ($options as $actual) { $auxOptions .= '<li>' . $actual . '</li>' . PHP_EOL; } $auxOptions .= $moreOptions; $auxOptions .= '</ul>' . PHP_EOL; $actions = '<div class="actions">' . $auxOptions . '</div>' . PHP_EOL; $row['bulkactions'] = '<input type="checkbox" name="id[]" value="' . $aRow['pk_i_id'] . '" />'; if (empty($aRow['s_author_name'])) { $user = User::newInstance()->findByPrimaryKey($aRow['fk_i_user_id']); $aRow['s_author_name'] = $user['s_email']; } $row['author'] = $aRow['s_author_name'] . ' (<a target="_blank" href="' . osc_item_url() . '">' . osc_item_title() . '</a>)' . $actions; $row['comment'] = $aRow['s_body']; $row['date'] = $aRow['dt_pub_date']; $row = osc_apply_filter('comments_processing_row', $row, $aRow); $this->addRow($row); $this->rawRows[] = $aRow; } } }
/** * Create automatically the url of the item details page * * @return string */ function osc_item_url($locale = '') { if (osc_rewrite_enabled()) { $sanitized_title = osc_sanitizeString(osc_item_title()); $sanitized_category = ''; $cat = Category::newInstance()->hierarchy(osc_item_category_id()); for ($i = count($cat); $i > 0; $i--) { $sanitized_category .= $cat[$i - 1]['s_slug'] . '/'; } if ($locale != '') { $path = osc_base_url() . sprintf('%s_%s%s_%d', $locale, $sanitized_category, $sanitized_title, osc_item_id()); } else { $path = osc_base_url() . sprintf('%s%s_%d', $sanitized_category, $sanitized_title, osc_item_id()); } } else { //$path = osc_base_url(true) . sprintf('?page=item&id=%d', osc_item_id()) ; $path = osc_item_url_ns(osc_item_id(), $locale); } return $path; }
function pop_email_share_url() { if (osc_is_public_profile()) { $subject = sprintf(__("Check out this profile with interesting products at %s.", 'pop'), osc_page_title()); $body = sprintf(__('Take a look at %1$s\'s profile on %2$s', 'pop'), osc_user_public_profile_url(), osc_page_title()); } if (osc_is_ad_page()) { $subject = sprintf(__("Check out what I just found < %s >", 'pop'), osc_item_title()); $body = sprintf(__('Take a look at %s', 'pop'), osc_item_url()); } return 'mailto:?body=' . $body . '&subject=' . $subject; }
function doModel() { osc_run_hook('before_search'); $mCategories = Category::newInstance(); if (osc_rewrite_enabled()) { // IF rewrite is not enabled, skip this part, preg_match is always time&resources consuming task $p_sParams = "/" . Params::getParam('sParams', false, false); if (preg_match_all('|\\/([^,]+),([^\\/]*)|', $p_sParams, $m)) { $l = count($m[0]); for ($k = 0; $k < $l; $k++) { switch ($m[1][$k]) { case osc_get_preference('rewrite_search_country'): $m[1][$k] = 'sCountry'; break; case osc_get_preference('rewrite_search_region'): $m[1][$k] = 'sRegion'; break; case osc_get_preference('rewrite_search_city'): $m[1][$k] = 'sCity'; break; case osc_get_preference('rewrite_search_city_area'): $m[1][$k] = 'sCityArea'; break; case osc_get_preference('rewrite_search_category'): $m[1][$k] = 'sCategory'; break; case osc_get_preference('rewrite_search_user'): $m[1][$k] = 'sUser'; break; case osc_get_preference('rewrite_search_pattern'): $m[1][$k] = 'sPattern'; break; default: break; } $_REQUEST[$m[1][$k]] = $m[2][$k]; $_GET[$m[1][$k]] = $m[2][$k]; unset($_REQUEST['sParams']); unset($_GET['sParams']); unset($_POST['sParams']); } } } //////////////////////////////// //GETTING AND FIXING SENT DATA// //////////////////////////////// $p_sCategory = Params::getParam('sCategory'); if (!is_array($p_sCategory)) { if ($p_sCategory == '') { $p_sCategory = array(); } else { $p_sCategory = explode(",", $p_sCategory); } } $p_sCityArea = Params::getParam('sCityArea'); if (!is_array($p_sCityArea)) { if ($p_sCityArea == '') { $p_sCityArea = array(); } else { $p_sCityArea = explode(",", $p_sCityArea); } } $p_sCity = Params::getParam('sCity'); if (!is_array($p_sCity)) { if ($p_sCity == '') { $p_sCity = array(); } else { $p_sCity = explode(",", $p_sCity); } } $p_sRegion = Params::getParam('sRegion'); if (!is_array($p_sRegion)) { if ($p_sRegion == '') { $p_sRegion = array(); } else { $p_sRegion = explode(",", $p_sRegion); } } $p_sCountry = Params::getParam('sCountry'); if (!is_array($p_sCountry)) { if ($p_sCountry == '') { $p_sCountry = array(); } else { $p_sCountry = explode(",", $p_sCountry); } } $p_sUser = Params::getParam('sUser'); if (!is_array($p_sUser)) { if ($p_sUser == '') { $p_sUser = ''; } else { $p_sUser = explode(",", $p_sUser); } } $p_sPattern = strip_tags(Params::getParam('sPattern')); // ADD TO THE LIST OF LAST SEARCHES if (osc_save_latest_searches()) { if (trim($p_sPattern) != '') { LatestSearches::newInstance()->insert(array('s_search' => trim($p_sPattern), 'd_date' => date('Y-m-d H:i:s'))); } } $p_bPic = Params::getParam('bPic'); $p_bPic == 1 ? $p_bPic = 1 : ($p_bPic = 0); $p_sPriceMin = Params::getParam('sPriceMin'); $p_sPriceMax = Params::getParam('sPriceMax'); //WE CAN ONLY USE THE FIELDS RETURNED BY Search::getAllowedColumnsForSorting() $p_sOrder = Params::getParam('sOrder'); if (!in_array($p_sOrder, Search::getAllowedColumnsForSorting())) { $p_sOrder = osc_default_order_field_at_search(); } $old_order = $p_sOrder; //ONLY 0 ( => 'asc' ), 1 ( => 'desc' ) AS ALLOWED VALUES $p_iOrderType = Params::getParam('iOrderType'); $allowedTypesForSorting = Search::getAllowedTypesForSorting(); $orderType = osc_default_order_type_at_search(); foreach ($allowedTypesForSorting as $k => $v) { if ($p_iOrderType == $v) { $orderType = $k; break; } } $p_iOrderType = $orderType; $p_sFeed = Params::getParam('sFeed'); $p_iPage = 0; if (is_numeric(Params::getParam('iPage')) && Params::getParam('iPage') > 0) { $p_iPage = intval(Params::getParam('iPage')) - 1; } if ($p_sFeed != '') { $p_sPageSize = 1000; } $p_sShowAs = Params::getParam('sShowAs'); $aValidShowAsValues = array('list', 'gallery'); if (!in_array($p_sShowAs, $aValidShowAsValues)) { $p_sShowAs = osc_default_show_as_at_search(); } // search results: it's blocked with the maxResultsPerPage@search defined in t_preferences $p_iPageSize = intval(Params::getParam('iPagesize')); if ($p_iPageSize > 0) { if ($p_iPageSize > osc_max_results_per_page_at_search()) { $p_iPageSize = osc_max_results_per_page_at_search(); } } else { $p_iPageSize = osc_default_results_per_page_at_search(); } //FILTERING CATEGORY $bAllCategoriesChecked = false; if (count($p_sCategory) > 0) { foreach ($p_sCategory as $category) { $this->mSearch->addCategory($category); } } else { $bAllCategoriesChecked = true; } //FILTERING CITY_AREA foreach ($p_sCityArea as $city_area) { $this->mSearch->addCityArea($city_area); } $p_sCityArea = implode(", ", $p_sCityArea); //FILTERING CITY foreach ($p_sCity as $city) { $this->mSearch->addCity($city); } $p_sCity = implode(", ", $p_sCity); //FILTERING REGION foreach ($p_sRegion as $region) { $this->mSearch->addRegion($region); } $p_sRegion = implode(", ", $p_sRegion); //FILTERING COUNTRY foreach ($p_sCountry as $country) { $this->mSearch->addCountry($country); } $p_sCountry = implode(", ", $p_sCountry); // FILTERING PATTERN if ($p_sPattern != '') { $this->mSearch->addPattern($p_sPattern); $osc_request['sPattern'] = $p_sPattern; } else { // hardcoded - if there isn't a search pattern, order by dt_pub_date desc if ($p_sOrder == 'relevance') { $p_sOrder = 'dt_pub_date'; foreach ($allowedTypesForSorting as $k => $v) { if ($p_iOrderType == 'desc') { $orderType = $k; break; } } $p_iOrderType = $orderType; } } // FILTERING USER if ($p_sUser != '') { $this->mSearch->fromUser($p_sUser); } // FILTERING IF WE ONLY WANT ITEMS WITH PICS if ($p_bPic) { $this->mSearch->withPicture(true); } //FILTERING BY RANGE PRICE $this->mSearch->priceRange($p_sPriceMin, $p_sPriceMax); //ORDERING THE SEARCH RESULTS $this->mSearch->order($p_sOrder, $allowedTypesForSorting[$p_iOrderType]); //SET PAGE $this->mSearch->page($p_iPage, $p_iPageSize); osc_run_hook('search_conditions', Params::getParamsAsArray()); if (!Params::existParam('sFeed')) { // RETRIEVE ITEMS AND TOTAL $aItems = $this->mSearch->doSearch(); $iTotalItems = $this->mSearch->count(); $iStart = $p_iPage * $p_iPageSize; $iEnd = min(($p_iPage + 1) * $p_iPageSize, $iTotalItems); $iNumPages = ceil($iTotalItems / $p_iPageSize); osc_run_hook('search', $this->mSearch); //preparing variables... $regionName = $p_sRegion; if (is_numeric($p_sRegion)) { $r = Region::newInstance()->findByPrimaryKey($p_sRegion); if ($r) { $regionName = $r['s_name']; } } $cityName = $p_sCity; if (is_numeric($p_sCity)) { $c = City::newInstance()->findByPrimaryKey($p_sCity); if ($c) { $cityName = $c['s_name']; } } //$this->_exportVariableToView('non_empty_categories', $aCategories) ; $this->_exportVariableToView('search_start', $iStart); $this->_exportVariableToView('search_end', $iEnd); $this->_exportVariableToView('search_category', $p_sCategory); // hardcoded - non pattern and order by relevance $p_sOrder = $old_order; $this->_exportVariableToView('search_order_type', $p_iOrderType); $this->_exportVariableToView('search_order', $p_sOrder); $this->_exportVariableToView('search_pattern', $p_sPattern); $this->_exportVariableToView('search_from_user', $p_sUser); $this->_exportVariableToView('search_total_pages', $iNumPages); $this->_exportVariableToView('search_page', $p_iPage); $this->_exportVariableToView('search_has_pic', $p_bPic); $this->_exportVariableToView('search_region', $regionName); $this->_exportVariableToView('search_city', $cityName); $this->_exportVariableToView('search_price_min', $p_sPriceMin); $this->_exportVariableToView('search_price_max', $p_sPriceMax); $this->_exportVariableToView('search_total_items', $iTotalItems); $this->_exportVariableToView('items', $aItems); $this->_exportVariableToView('search_show_as', $p_sShowAs); $this->_exportVariableToView('search', $this->mSearch); // json $json = $this->mSearch->toJson(); $this->_exportVariableToView('search_alert', base64_encode($json)); //calling the view... $this->doView('search.php'); } else { $this->mSearch->page(0, osc_num_rss_items()); // RETRIEVE ITEMS AND TOTAL $iTotalItems = $this->mSearch->count(); $aItems = $this->mSearch->doSearch(); $this->_exportVariableToView('items', $aItems); if ($p_sFeed == '' || $p_sFeed == 'rss') { // FEED REQUESTED! header('Content-type: text/xml; charset=utf-8'); $feed = new RSSFeed(); $feed->setTitle(__('Latest listings added') . ' - ' . osc_page_title()); $feed->setLink(osc_base_url()); $feed->setDescription(__('Latest listings added in') . ' ' . osc_page_title()); if (osc_count_items() > 0) { while (osc_has_items()) { if (osc_count_item_resources() > 0) { osc_has_item_resources(); $feed->addItem(array('title' => osc_item_title(), 'link' => htmlentities(osc_item_url(), ENT_COMPAT, "UTF-8"), 'description' => osc_item_description(), 'dt_pub_date' => osc_item_pub_date(), 'image' => array('url' => htmlentities(osc_resource_thumbnail_url(), ENT_COMPAT, "UTF-8"), 'title' => osc_item_title(), 'link' => htmlentities(osc_item_url(), ENT_COMPAT, "UTF-8")))); } else { $feed->addItem(array('title' => osc_item_title(), 'link' => htmlentities(osc_item_url(), ENT_COMPAT, "UTF-8"), 'description' => osc_item_description(), 'dt_pub_date' => osc_item_pub_date())); } } } osc_run_hook('feed', $feed); $feed->dumpXML(); } else { osc_run_hook('feed_' . $p_sFeed, $aItems); } } }
function doModel() { osc_run_hook('before_search'); $mCategories = new Category(); //////////////////////////////// //GETTING AND FIXING SENT DATA// //////////////////////////////// $p_sCategory = Params::getParam('sCategory'); if (!is_array($p_sCategory)) { if ($p_sCategory == '') { $p_sCategory = array(); } else { $p_sCategory = explode(",", $p_sCategory); } } $p_sCityArea = Params::getParam('sCityArea'); if (!is_array($p_sCityArea)) { if ($p_sCityArea == '') { $p_sCityArea = array(); } else { $p_sCityArea = explode(",", $p_sCityArea); } } $p_sCity = Params::getParam('sCity'); if (!is_array($p_sCity)) { if ($p_sCity == '') { $p_sCity = array(); } else { $p_sCity = explode(",", $p_sCity); } } $p_sRegion = Params::getParam('sRegion'); if (!is_array($p_sRegion)) { if ($p_sRegion == '') { $p_sRegion = array(); } else { $p_sRegion = explode(",", $p_sRegion); } } $p_sCountry = Params::getParam('sCountry'); if (!is_array($p_sCountry)) { if ($p_sCountry == '') { $p_sCountry = array(); } else { $p_sCountry = explode(",", $p_sCountry); } } $p_sPattern = strip_tags(Params::getParam('sPattern')); $p_sUser = strip_tags(Params::getParam('sUser')); // ADD TO THE LIST OF LAST SEARCHES if (osc_save_latest_searches()) { if (trim($p_sPattern) != '') { LatestSearches::newInstance()->insert(array('s_search' => trim($p_sPattern), 'd_date' => date('Y-m-d H:i:s'))); } } $p_bPic = Params::getParam('bPic'); $p_bPic == 1 ? $p_bPic = 1 : ($p_bPic = 0); $p_sPriceMin = Params::getParam('sPriceMin'); $p_sPriceMax = Params::getParam('sPriceMax'); //WE CAN ONLY USE THE FIELDS RETURNED BY Search::getAllowedColumnsForSorting() $p_sOrder = Params::getParam('sOrder'); if (!in_array($p_sOrder, Search::getAllowedColumnsForSorting())) { $p_sOrder = osc_default_order_field_at_search(); } //ONLY 0 ( => 'asc' ), 1 ( => 'desc' ) AS ALLOWED VALUES $p_iOrderType = Params::getParam('iOrderType'); $allowedTypesForSorting = Search::getAllowedTypesForSorting(); $orderType = osc_default_order_type_at_search(); foreach ($allowedTypesForSorting as $k => $v) { if ($p_iOrderType == $v) { $orderType = $k; break; } } $p_iOrderType = $orderType; $p_sFeed = Params::getParam('sFeed'); $p_iPage = intval(Params::getParam('iPage')); if ($p_sFeed != '') { $p_sPageSize = 1000; } $p_sShowAs = Params::getParam('sShowAs'); $aValidShowAsValues = array('list', 'gallery'); if (!in_array($p_sShowAs, $aValidShowAsValues)) { $p_sShowAs = osc_default_show_as_at_search(); } // search results: it's blocked with the maxResultsPerPage@search defined in t_preferences $p_iPageSize = intval(Params::getParam('iPagesize')); if ($p_iPageSize > 0) { if ($p_iPageSize > osc_max_results_per_page_at_search()) { $p_iPageSize = osc_max_results_per_page_at_search(); } } else { $p_iPageSize = osc_default_results_per_page_at_search(); } //FILTERING CATEGORY $bAllCategoriesChecked = false; if (count($p_sCategory) > 0) { foreach ($p_sCategory as $category) { $this->mSearch->addCategory($category); } } else { $bAllCategoriesChecked = true; } //FILTERING CITY_AREA foreach ($p_sCityArea as $city_area) { $this->mSearch->addCityArea($city_area); } $p_sCityArea = implode(", ", $p_sCityArea); //FILTERING CITY foreach ($p_sCity as $city) { $this->mSearch->addCity($city); } $p_sCity = implode(", ", $p_sCity); //FILTERING REGION foreach ($p_sRegion as $region) { $this->mSearch->addRegion($region); } $p_sRegion = implode(", ", $p_sRegion); //FILTERING COUNTRY foreach ($p_sCountry as $country) { $this->mSearch->addCountry($country); } $p_sCountry = implode(", ", $p_sCountry); // FILTERING PATTERN if ($p_sPattern != '') { $this->mSearch->addConditions(sprintf("MATCH(d.s_title, d.s_description) AGAINST('%s' IN BOOLEAN MODE)", $p_sPattern)); $osc_request['sPattern'] = $p_sPattern; } // FILTERING USER if ($p_sUser != '') { $this->mSearch->fromUser(explode(",", $p_sUser)); } // FILTERING IF WE ONLY WANT ITEMS WITH PICS if ($p_bPic) { $this->mSearch->withPicture(true); } //FILTERING BY RANGE PRICE $this->mSearch->priceRange($p_sPriceMin, $p_sPriceMax); //ORDERING THE SEARCH RESULTS $this->mSearch->order($p_sOrder, $allowedTypesForSorting[$p_iOrderType]); //SET PAGE $this->mSearch->page($p_iPage, $p_iPageSize); osc_run_hook('search_conditions', Params::getParamsAsArray()); if (!Params::existParam('sFeed')) { // RETRIEVE ITEMS AND TOTAL $aItems = $this->mSearch->doSearch(); $iTotalItems = $this->mSearch->count(); $iStart = $p_iPage * $p_iPageSize; $iEnd = min(($p_iPage + 1) * $p_iPageSize, $iTotalItems); $iNumPages = ceil($iTotalItems / $p_iPageSize); osc_run_hook('search', $this->mSearch); //preparing variables... //$this->_exportVariableToView('non_empty_categories', $aCategories) ; $this->_exportVariableToView('search_start', $iStart); $this->_exportVariableToView('search_end', $iEnd); $this->_exportVariableToView('search_category', $p_sCategory); $this->_exportVariableToView('search_order_type', $p_iOrderType); $this->_exportVariableToView('search_order', $p_sOrder); $this->_exportVariableToView('search_pattern', $p_sPattern); $this->_exportVariableToView('search_from_user', $p_sUser); $this->_exportVariableToView('search_total_pages', $iNumPages); $this->_exportVariableToView('search_page', $p_iPage); $this->_exportVariableToView('search_has_pic', $p_bPic); $this->_exportVariableToView('search_region', $p_sRegion); $this->_exportVariableToView('search_city', $p_sCity); $this->_exportVariableToView('search_price_min', $p_sPriceMin); $this->_exportVariableToView('search_price_max', $p_sPriceMax); $this->_exportVariableToView('search_total_items', $iTotalItems); $this->_exportVariableToView('items', $aItems); $this->_exportVariableToView('search_show_as', $p_sShowAs); $this->_exportVariableToView('search', $this->mSearch); $this->_exportVariableToView('search_alert', base64_encode(serialize($this->mSearch))); //calling the view... $this->doView('search.php'); } else { $this->mSearch->page(0, osc_num_rss_items()); // RETRIEVE ITEMS AND TOTAL $iTotalItems = $this->mSearch->count(); $aItems = $this->mSearch->doSearch(); $this->_exportVariableToView('items', $aItems); if ($p_sFeed == '' || $p_sFeed == 'rss') { // FEED REQUESTED! header('Content-type: text/xml; charset=utf-8'); $feed = new RSSFeed(); $feed->setTitle(__('Latest items added') . ' - ' . osc_page_title()); $feed->setLink(osc_base_url()); $feed->setDescription(__('Latest items added in') . ' ' . osc_page_title()); if (osc_count_items() > 0) { while (osc_has_items()) { if (osc_count_item_resources() > 0) { osc_has_item_resources(); $feed->addItem(array('title' => osc_item_title(), 'link' => htmlentities(osc_item_url()), 'description' => osc_item_description(), 'dt_pub_date' => osc_item_pub_date(), 'image' => array('url' => htmlentities(osc_resource_thumbnail_url()), 'title' => osc_item_title(), 'link' => htmlentities(osc_item_url())))); } else { $feed->addItem(array('title' => osc_item_title(), 'link' => htmlentities(osc_item_url()), 'description' => osc_item_description(), 'dt_pub_date' => osc_item_pub_date())); } } } osc_run_hook('feed', $feed); $feed->dumpXML(); } else { osc_run_hook('feed_' . $p_sFeed, $aItems); } } }
function meta_title() { $location = Rewrite::newInstance()->get_location(); $section = Rewrite::newInstance()->get_section(); switch ($location) { case 'item': switch ($section) { case 'send_friend': $text = __('Send to a friend', 'seeker') . ' - ' . osc_item_title() . ' - ' . osc_page_title(); break; case 'contact': $text = __('Apply for thhis job', 'seeker') . ' - ' . osc_item_title() . ' - ' . osc_page_title(); break; default: $text = osc_item_title() . ' - ' . osc_page_title(); break; } break; case 'page': $text = osc_static_page_title() . ' - ' . osc_page_title(); break; case 'error': $text = __('Error', 'seeker') . ' - ' . osc_page_title(); break; case 'search': $region = Params::getParam('sRegion'); $city = Params::getParam('sCity'); $pattern = Params::getParam('sPattern'); $category = osc_search_category_id(); $category = count($category) == 1 ? $category[0] : ''; $s_page = ''; $i_page = Params::getParam('iPage'); if ($i_page != '' && $i_page > 0) { $s_page = __('page', 'seeker') . ' ' . ($i_page + 1) . ' - '; } $b_show_all = $region == '' && $city == '' & $pattern == '' && $category == ''; $b_category = $category != ''; $b_pattern = $pattern != ''; $b_city = $city != ''; $b_region = $region != ''; if ($b_show_all) { $text = __('Show all items', 'seeker') . ' - ' . $s_page . osc_page_title(); } $result = ''; if ($b_pattern) { $result .= $pattern . ' » '; } if ($b_category) { $list = array(); $aCategories = Category::newInstance()->toRootTree($category); if (count($aCategories) > 0) { foreach ($aCategories as $single) { $list[] = $single['s_name']; } $result .= implode(' » ', $list) . ' » '; } } if ($b_city) { $result .= $city . ' » '; } if ($b_region) { $result .= $region . ' » '; } $result = preg_replace('|\\s?»\\s$|', '', $result); if ($result == '') { $result = __('Search', 'seeker'); } $text = $result . ' - ' . $s_page . osc_page_title(); break; case 'contact': $text = __('Upload your CV', 'seeker') . ' - ' . osc_page_title(); break; default: $text = osc_page_title(); break; } $text = str_replace("\n", '', $text); $text = trim($text); $text = osc_esc_html($text); return $text; }
function meta_title() { $location = Rewrite::newInstance()->get_location(); $section = Rewrite::newInstance()->get_section(); switch ($location) { case 'item': switch ($section) { case 'item_add': $text = __('Publish an item', 'modern') . ' - ' . osc_page_title(); break; case 'item_edit': $text = __('Edit your item', 'modern') . ' - ' . osc_page_title(); break; case 'send_friend': $text = __('Send to a friend', 'modern') . ' - ' . osc_item_title() . ' - ' . osc_page_title(); break; case 'contact': $text = __('Contact seller', 'modern') . ' - ' . osc_item_title() . ' - ' . osc_page_title(); break; default: $text = osc_item_title() . ' - ' . osc_page_title(); break; } break; case 'page': $text = osc_static_page_title() . ' - ' . osc_page_title(); break; case 'error': $text = __('Error', 'modern') . ' - ' . osc_page_title(); break; case 'search': $region = Params::getParam('sRegion'); $city = Params::getParam('sCity'); $pattern = Params::getParam('sPattern'); $category = osc_search_category_id(); $category = count($category) == 1 ? $category[0] : ''; $s_page = ''; $i_page = Params::getParam('iPage'); if ($i_page != '' && $i_page > 0) { $s_page = __('page', 'modern') . ' ' . ($i_page + 1) . ' - '; } $b_show_all = $region == '' && $city == '' & $pattern == '' && $category == ''; $b_category = $category != ''; $b_pattern = $pattern != ''; $b_city = $city != ''; $b_region = $region != ''; if ($b_show_all) { $text = __('Show all items', 'modern') . ' - ' . $s_page . osc_page_title(); } $result = ''; if ($b_pattern) { $result .= $pattern . ' » '; } if ($b_category) { $list = array(); $aCategories = Category::newInstance()->toRootTree($category); if (count($aCategories) > 0) { foreach ($aCategories as $single) { $list[] = $single['s_name']; } $result .= implode(' » ', $list) . ' » '; } } if ($b_city) { $result .= $city . ' » '; } if ($b_region) { $result .= $region . ' » '; } $result = preg_replace('|\\s?»\\s$|', '', $result); if ($result == '') { $result = __('Search', 'modern'); } $text = $result . ' - ' . $s_page . osc_page_title(); break; case 'login': switch ($section) { case 'recover': $text = __('Recover your password', 'modern') . ' - ' . osc_page_title(); default: $text = __('Login', 'modern') . ' - ' . osc_page_title(); } break; case 'register': $text = __('Create a new account', 'modern') . ' - ' . osc_page_title(); break; case 'user': switch ($section) { case 'dashboard': $text = __('Dashboard', 'modern') . ' - ' . osc_page_title(); break; case 'items': $text = __('Manage my items', 'modern') . ' - ' . osc_page_title(); break; case 'alerts': $text = __('Manage my alerts', 'modern') . ' - ' . osc_page_title(); break; case 'profile': $text = __('Update my profile', 'modern') . ' - ' . osc_page_title(); break; case 'change_email': $text = __('Change my email', 'modern') . ' - ' . osc_page_title(); break; case 'change_password': $text = __('Change my password', 'modern') . ' - ' . osc_page_title(); break; case 'forgot': $text = __('Recover my password', 'modern') . ' - ' . osc_page_title(); break; default: $text = osc_page_title(); break; } break; case 'contact': $text = __('Contact', 'modern') . ' - ' . osc_page_title(); break; default: $text = osc_page_title(); break; } $text = str_replace('"', "'", $text); return $text; }
?> " /> <figcaption class="orbit-caption show-for-sr"><?php _e('Image', 'osclassclsx'); ?> <?php echo $i + 1; ?> / <?php echo osc_count_item_resources(); ?> </figcaption> </li> <?php // Save the thumbnails $orbit_bullets .= sprintf($bullet_format, $i == 0 ? 'is-active' : '', $i, _('Image', 'osclassclsx') . ' / ' . osc_count_item_resources(), _('Image', 'osclassclsx') . ' / ' . osc_count_item_resources(), osc_resource_thumbnail_url(), osc_item_title(), osc_item_title()); ?> <?php } ?> </ul> <nav class="orbit-bullets"> <?php echo $orbit_bullets; ?> </nav> </div> </div> <?php } ?>
?> " title="" alt="" /> <?php } ?> </td> <?php } ?> <td class="text"> <h3> <a href="<?php echo osc_item_url(); ?> "><?php echo osc_highlight(strip_tags(osc_item_title())); ?> </a> </h3> <p> <strong><?php if (osc_price_enabled_at_items()) { echo osc_item_formated_price(); ?> - <?php } echo osc_item_city(); ?> (<?php echo osc_item_region(); ?>
$img_source = osc_current_web_theme_url('images/no-items.png'); $total_listing = get_total_listing_by_parent($sa['cat_id']); $total_item_views = get_total_item_views($sa['cat_id']); if ($total_item_views == null || empty($total_item_view)) { $total_item_views = '0'; } else { $total_item_views = $total_item_views[0]['TotalViews']; } } else { $no_item = true; $primary_id = (int) $top_item[0]['fk_i_item_id']; $item = Item::newInstance()->findByPrimaryKey($primary_id); View::newInstance()->_exportVariableToView('item', $item); $resource = Item::newInstance()->findResourcesByID($primary_id); $item_url = osc_item_url(); $img_title = osc_item_title(); if (!empty($resource) || $resource != "") { $resource_path = osc_apply_filter('resource_path', osc_base_url() . $resource[0]['s_path']); $img_source = (string) $resource_path . $resource[0]['pk_i_id'] . "." . $resource[0]['s_extension']; } else { $img_source = osc_current_web_theme_url('images/no-image-available.png'); } $total_listing = get_total_listing_by_parent($sa['cat_id']); $total_item_views = get_total_item_views($sa['cat_id']); if ($total_item_views == null || empty($total_item_views)) { $total_item_views = '0'; } else { $total_item_views = $total_item_views[0]['TotalViews']; } $category_name = get_parent_category_name(osc_item_category_id()); }
?> " class="img-responsive"></a> <?php } ?> </div> </div> <?php } ?> <div class="caption"> <h3><a href="<?php echo osc_item_url(); ?> "><?php echo osc_item_title(); ?> </a></h3> <p class="user"><?php _e('by', 'flatter'); ?> <?php if (osc_item_user_id() != null) { ?> <a href="<?php echo osc_user_public_profile_url(osc_item_user_id()); ?> " ><?php echo osc_item_contact_name(); ?> </a><?php
/** * Create automatically the url of the item details page * * @param string $locale * @return string */ function osc_item_url($locale = '') { if (osc_rewrite_enabled()) { $sanitized_categories = array(); $cat = Category::newInstance()->hierarchy(osc_item_category_id()); for ($i = count($cat); $i > 0; $i--) { $sanitized_categories[] = $cat[$i - 1]['s_slug']; } $url = str_replace('{CATEGORIES}', implode("/", $sanitized_categories), str_replace('{ITEM_ID}', osc_item_id(), str_replace('{ITEM_TITLE}', osc_sanitizeString(osc_item_title()), osc_get_preference('rewrite_item_url')))); if ($locale != '') { $path = osc_base_url() . $locale . "/" . $url; } else { $path = osc_base_url() . $url; } } else { $path = osc_item_url_ns(osc_item_id(), $locale); } return $path; }