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 digitalgoods_item_detail() { if (osc_is_this_category('digitalgoods', osc_item_category_id())) { $dg_files = DGModel::newInstance()->getFilesFromItem(osc_item_id()); require_once 'item_detail.php'; } }
function show_qrcode() { $filename = osc_item_id() . "_" . md5(osc_item_url()) . "_" . osc_get_preference("code_size", "qrcode") . ".png"; if (!file_exists(osc_get_preference('upload_path', 'qrcode') . $filename)) { qrcode_generateqr(osc_item_url(), osc_item_id()); } echo '<img src="' . osc_get_preference('upload_url', 'qrcode') . $filename . '" alt="QR CODE" id="qrcode_' . osc_item_id() . '" class="qrcode" />'; }
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 watchlist() { if (osc_is_web_user_logged_in()) { $id = osc_item_id(); $class = ''; $title = ''; if (watchlist_exists($id)) { $class = 'full'; $title = __('Remove from watchlist', 'watchlist'); } else { $class = 'empty'; $title = __('Add to watchlist', 'watchlist'); } echo '<a class="watchlist ' . $class . '" id="' . $id . '"><span title="' . $title . '"></span>'; if ($class == 'empty') { echo __('Add to watchlist', 'watchlist'); } else { echo __('Remove from watchlist', 'watchlist'); } echo '</a>'; } else { echo '<a class="watchlist empty" onclick="swal(' ' . __('You must login to save favorites', 'pop') . ' ')"><span title="' . $title . '"></span>' . __('Add to watchlist', 'watchlist') . '</a>'; } }
if (can_vote($itemId, $userId, $hash)) { ModelVoting::newInstance()->insertItemVote($itemId, $userId, $iVote, $hash); } } else { if ($user == 1 && is_null($hash)) { if (can_vote($itemId, $userId, $hash)) { ModelVoting::newInstance()->insertItemVote($itemId, $userId, $iVote, $hash); } } } } // return updated voting $item = Item::newInstance()->findByPrimaryKey($itemId); View::newInstance()->_exportVariableToView('item', $item); if (osc_is_this_category('voting', osc_item_category_id())) { $aux_vote = ModelVoting::newInstance()->getItemAvgRating(osc_item_id()); $aux_count = ModelVoting::newInstance()->getItemNumberOfVotes(osc_item_id()); $vote['vote'] = $aux_vote['vote']; $vote['total'] = $aux_count['total']; $vote['can_vote'] = true; if (osc_get_preference('user', 'voting') == 1) { if (!osc_is_web_user_logged_in()) { $vote['can_vote'] = false; } } if (!can_vote(osc_item_id(), osc_logged_user_id(), $hash)) { $vote['can_vote'] = false; } require 'view_votes.php'; } }
/** * Gets url of send a friend (current item) * * @return string */ function osc_item_send_friend_url() { if (osc_rewrite_enabled()) { return osc_base_url() . osc_get_preference('rewrite_item_send_friend') . '/' . osc_item_id(); } else { return osc_base_url(true) . "?page=item&action=send_friend&id=" . osc_item_id(); } }
function seo_meta_keywords_filter() { $text = ''; //home page if (osc_is_home_page()) { if (osc_get_preference('seo_metakeywords_home', 'seo_plugin')) { $text = osc_get_preference('seo_metakeywords_home', 'seo_plugin'); } } // static page if (osc_is_static_page()) { if (osc_get_preference('seo_metakeywords_page_' . osc_static_page_id(), 'seo_plugin')) { $text = osc_get_preference('seo_metakeywords_page_' . osc_static_page_id(), 'seo_plugin'); } } //contact page if (osc_is_contact_page()) { if (osc_get_preference('seo_metakeywords_page_contact', 'seo_plugin')) { $text = osc_get_preference('seo_metakeywords_page_contact', 'seo_plugin'); } } // search if (osc_is_search_page()) { if (osc_has_items()) { $keywords = array(); $keywords[] = osc_item_category(); if (osc_item_city() != '') { $keywords[] = osc_item_city(); $keywords[] = sprintf('%s %s', osc_item_category(), osc_item_city()); } if (osc_item_region() != '') { $keywords[] = osc_item_region(); $keywords[] = sprintf('%s %s', osc_item_category(), osc_item_region()); } if (osc_item_city() != '' && osc_item_region() != '') { $keywords[] = sprintf('%s %s %s', osc_item_category(), osc_item_region(), osc_item_city()); $keywords[] = sprintf('%s %s', osc_item_region(), osc_item_city()); } $text = implode(', ', $keywords); } osc_reset_items(); } // listing if (osc_is_ad_page()) { $detail = seo_get_row(osc_item_id()); if (empty($detail['seo_item_meta_keywords'])) { $keywords = array(); $keywords[] = osc_item_category(); if (osc_item_city() != '') { $keywords[] = osc_item_city(); $keywords[] = sprintf('%s %s', osc_item_category(), osc_item_city()); } if (osc_item_region() != '') { $keywords[] = osc_item_region(); $keywords[] = sprintf('%s %s', osc_item_category(), osc_item_region()); } if (osc_item_city() != '' && osc_item_region() != '') { $keywords[] = sprintf('%s %s %s', osc_item_category(), osc_item_region(), osc_item_city()); $keywords[] = sprintf('%s %s', osc_item_region(), osc_item_city()); } $text = implode(', ', $keywords); } else { $text = $detail['seo_item_meta_keywords']; } } return $text; }
<div class="header"> <h1><?php _e('Send to a friend', 'bender'); ?> </h1> </div> <div class="resp-wrapper"> <ul id="error_list"></ul> <form name="sendfriend" action="<?php echo osc_base_url(true); ?> " method="post" > <input type="hidden" name="action" value="send_friend_post" /> <input type="hidden" name="page" value="item" /> <input type="hidden" name="id" value="<?php echo osc_item_id(); ?> " /> <?php if (osc_is_web_user_logged_in()) { ?> <input type="hidden" name="yourName" value="<?php echo osc_esc_html(osc_logged_user_name()); ?> " /> <input type="hidden" name="yourEmail" value="<?php echo osc_logged_user_email(); ?> " /> <?php } else {
_e('Attachment', 'bender'); ?> :</label> <div class="controls"><?php ContactForm::your_attachment(); ?> </div> </div> <?php } ?> <div class="control-group"> <div class="controls"> <?php osc_run_hook('item_contact_form', osc_item_id()); ?> <?php if (osc_recaptcha_public_key()) { ?> <script type="text/javascript"> var RecaptchaOptions = { theme : 'custom', custom_theme_widget: 'recaptcha_widget' }; </script> <style type="text/css"> div#recaptcha_widget, div#recaptcha_image > img { width:240px; margin-top: 5px; } div#recaptcha_image { margin-bottom: 15px; } </style> <div id="recaptcha_widget">
/** * Gets item meta fields * * @return array */ function osc_get_item_meta() { if (!View::newInstance()->_exists('metafields')) { View::newInstance()->_exportVariableToView('metafields', Item::newInstance()->metaFields(osc_item_id())); } return View::newInstance()->_get('metafields'); }
?> ">Edit</a></span></td> <td> <td> <?php if (osc_item_is_premium()) { ?> <h5>Premium Item</h5> <?php } else { ?> <?php if (nc_osc_premium_fee_enabled()) { ?> <h5><a style="text-decoration:underline;" href="<?php echo osc_route_url('payment-publish', array('itemId' => osc_item_id())); ?> ">Mark Premium</a></h5> <?php } ?> <?php } ?> </td> </tr> <?php } ?> <?php }
?> <div class="hook-item-detail"> <?php osc_run_hook('item_detail', osc_item()); ?> </div> <span><i class="ico-location_pin"></i><?php echo osc_item_city(); ?> </span> </div> <div class="item-location"> <img src="<?php echo pop_get_listing_map_image(osc_item_id()); ?> "/> </div> <div class="share-links"> <span><?php _e('Share it!', 'pop'); ?> </span> <p> <a href="<?php echo osc_esc_html(pop_facebook_share_url()); ?> " class="share-icon-bg facebook-icon"></a> <a href="<?php echo osc_esc_html(pop_twitter_share_url());
if (osc_count_custom_items() >= 2) { ?> <div class="widget"> <h3><?php echo osc_item_contact_name(); ?> <?php _e('Listings', 'flatter'); ?> </h3> <div class="wblock sellerlisting"> <?php while (osc_has_custom_items()) { ?> <div class="item <?php if ($ltd == osc_item_id()) { echo "current"; } ?> clearfix"> <div class="row"> <?php if (osc_images_enabled_at_items()) { ?> <div class="col-md-4 col-sm-4 col-xs-4 picture"> <?php if (osc_count_item_resources() >= 1) { ?> <a href="<?php echo osc_item_url();
" ><?php _e('Delete', 'bender'); ?> </a> <?php if (osc_item_is_inactive()) { ?> <span>|</span> <a href="<?php echo osc_item_activate_url(); ?> " ><?php _e('Activate', 'bender'); ?> </a> <?php } ?> <?php if (function_exists("republish_pro_link")) { republish_pro_link(osc_item_id()); } ?> </span> <?php } ?> </div> </div> </div> </li>
public static function primary_input_hidden() { parent::generic_input_hidden("id", osc_item_id()); return true; }
function osc_item_send_friend_url() { if (osc_rewrite_enabled()) { return osc_base_url() . 'item/send-friend/' . osc_item_id(); } else { return osc_base_url(true) . "?page=item&action=send_friend&id=" . osc_item_id(); } }
?> <?php if (osc_get_preference("allow_premium", "payment") == "1") { ?> <?php if (ModelPayment::newInstance()->premiumFeeIsPaid(osc_item_id())) { ?> <strong><?php _e('Already premium!', 'payment'); ?> </strong> <?php } else { ?> <strong><a href="<?php echo osc_route_url('payment-premium', array('itemId' => osc_item_id())); ?> "><?php _e('Make premium', 'payment'); ?> </a></strong> <?php } ?> <?php } ?> </p> <br /> </div> <?php
" title="<?php echo osc_esc_html(osc_item_title()); ?> "><?php echo osc_item_title(); ?> </a></h4> <?php if (is_voting_enabled()) { ?> <div class="rate_me rate_me_star"> <?php osclasswizards_item_star_rating(osc_item_id()); ?> <span><?php echo osclasswizards_item_avg_rating(osc_item_id()); ?> </span> </div> <?php } ?> <div class="attribute_list"> <span class="category"><i class="fa fa-<?php echo osclasswizards_category_icon(osc_item_category_id()); ?> "></i><?php echo osc_item_category(); ?> </span> <span class="location"><i class="fa fa-map-marker"></i> <?php echo osc_item_city(); ?> <?php
function allSeo_description_filter($text) { // CLEAN EXISTING DESCRIPTION $text = ''; // HOME PAGE if (osc_is_home_page()) { $text = osc_page_description(); } // STATIC PAGE if (osc_is_static_page()) { if (GetPageDesc() == '') { $text = osc_highlight(osc_static_page_text(), 140, '', ''); } else { $text = GetPageDesc(); } } // SEARCH & CATEGORY PAGE if (osc_is_search_page()) { $cat = osc_search_category_id(); $cat_id = $cat[0]; $cat_field = Category::newInstance()->findByPrimaryKey($cat_id); $country = GetCtrDesc(osc_search_country()) ? GetCtrDesc(osc_search_country()) : osc_search_country(); $region = GetRegDesc(osc_search_region()) ? GetRegDesc(osc_search_region()) : osc_search_region(); $city = osc_search_city(); if (GetCatDesc($cat_id) != '') { $desc = GetCatDesc($cat_id); } else { $desc = $cat_field['s_name']; } $text = $desc; // ADD LOCATION DESCRIPTION if ($country != '') { $text .= ($text != '' ? ' - ' : '') . $country; } if ($region != '') { $text .= ($text != '' ? ' - ' : '') . $region; } if ($city != '') { $text .= ($text != '' ? ' - ' : '') . $city; } // Improve search/category title adding part of listings in this category/search if (osc_get_preference('allSeo_search_improve_desc', 'plugin-all_in_one') == 1) { osc_reset_custom_items(); osc_query_item(array("category" => $cat_id, "country_name" => $country, "region_name" => $region, "city_name" => $city)); while (osc_has_custom_items()) { $item = Item::newInstance()->findByPrimaryKey(osc_item_id()); $con = strip_tags($item['s_description']); if (osc_item_city() != '') { $text .= ' - ' . osc_item_city(); } if ($con != '') { $text .= ', ' . osc_highlight($con, 100); } } } $text = osc_highlight($text, 500); osc_reset_items(); } // Listing page if (osc_is_ad_page()) { if (GetItemDesc() == '') { if (GetCatDesc(osc_item_category_id()) != '') { $desc = GetCatDesc(osc_item_category_id()); } else { $desc = osc_item_category(); } $item = Item::newInstance()->findByPrimaryKey(osc_item_id()); $text = $desc . ' - ' . osc_highlight($item['s_description'], 120) . ', ' . SeoLocationShow(); } else { $text = GetItemDesc(); } } return $text; }
function osc_has_item_comments() { if (!View::newInstance()->_exists('comments')) { View::newInstance()->_exportVariableToView('comments', Item::newInstance()->listLatest(osc_item_id())); } return View::newInstance()->_next('comments'); }
function nc_osc_check_watchlist() { return WatchList::newInstance()->checkItemAdded(osc_logged_user_id(), osc_item_id()); }
function youtube_item_detail() { $conn = getConnection(); $detail = $conn->osc_dbFetchResult("SELECT * FROM %st_item_youtube WHERE fk_i_item_id = %d", DB_TABLE_PREFIX, osc_item_id()); require_once YOUTUBE_PATH . 'item_detail.php'; }
function related_listings() { View::newInstance()->_exportVariableToView('items', array()); $mSearch = new Search(); $mSearch->addCategory(osc_item_category_id()); $mSearch->addRegion(osc_item_region()); $mSearch->addItemConditions(sprintf("%st_item.pk_i_id < %s ", DB_TABLE_PREFIX, osc_item_id())); $mSearch->limit('0', '3'); $aItems = $mSearch->doSearch(); $iTotalItems = count($aItems); if ($iTotalItems == 3) { View::newInstance()->_exportVariableToView('items', $aItems); return $iTotalItems; } unset($mSearch); $mSearch = new Search(); $mSearch->addCategory(osc_item_category_id()); $mSearch->addItemConditions(sprintf("%st_item.pk_i_id != %s ", DB_TABLE_PREFIX, osc_item_id())); $mSearch->limit('0', '3'); $aItems = $mSearch->doSearch(); $iTotalItems = count($aItems); if ($iTotalItems > 0) { View::newInstance()->_exportVariableToView('items', $aItems); return $iTotalItems; } unset($mSearch); return 0; }
function republish_url() { $conn = getConnection(); $pCats = $conn->osc_dbFetchResult("SELECT * FROM %st_plugin_category WHERE s_plugin_name = '%s' AND fk_i_category_id = '%d'", DB_TABLE_PREFIX, 'adManage', osc_item_category_id()); $pCatCount = count($pCats); $adManage_url = ''; $rSecret = $conn->osc_dbFetchResult("SELECT * FROM %st_item_adManage_limit WHERE fk_i_item_id = '%d'", DB_TABLE_PREFIX, osc_item_id()); if (($rSecret['r_times'] < osc_adManage_repubTimes() || osc_adManage_repubTimes() == 0) && $pCatCount != 0) { if (osc_item_is_expired()) { $adManage_url = osc_base_url() . 'oc-content/plugins/advanced_ad_management/item_republish.php?repub=republish&id=' . osc_item_id() . '&rSecret=' . $rSecret['r_secret']; } } return $adManage_url; }
public static function plugin_edit_item() { ItemForm::plugin_post_item('edit&itemId=' . osc_item_id()); }
public static function ajax_photos($resources = null) { if ($resources == null) { $resources = osc_get_item_resources(); } $aImages = array(); if (Session::newInstance()->_getForm('photos') != '') { $aImages = Session::newInstance()->_getForm('photos'); $aImages = $aImages['name']; Session::newInstance()->_drop('photos'); Session::newInstance()->_dropKeepForm('photos'); } ?> <div id="restricted-fine-uploader"></div> <div style="clear:both;"></div> <?php if (count($aImages) > 0 || $resources != null && is_array($resources) && count($resources) > 0) { ?> <h3><?php _e('Images already uploaded'); ?> </h3> <ul class="qq-upload-list"> <?php foreach ($resources as $_r) { $img = $_r['pk_i_id'] . '.' . $_r['s_extension']; ?> <li class=" qq-upload-success"> <span class="qq-upload-file"><?php echo $img; ?> </span> <a class="qq-upload-delete" href="#" photoid="<?php echo $_r['pk_i_id']; ?> " itemid="<?php echo $_r['fk_i_item_id']; ?> " photoname="<?php echo $_r['s_name']; ?> " photosecret="<?php echo Params::getParam('secret'); ?> " style="display: inline; cursor:pointer;"><?php _e('Delete'); ?> </a> <div class="ajax_preview_img"><img src="<?php echo osc_apply_filter('resource_path', osc_base_url() . $_r['s_path']) . $_r['pk_i_id'] . '_thumbnail.' . $_r['s_extension']; ?> " alt="<?php echo osc_esc_html($img); ?> "></div> </li> <?php } ?> <?php foreach ($aImages as $img) { ?> <li class=" qq-upload-success"> <span class="qq-upload-file"><?php echo $img; $img = osc_esc_html($img); ?> </span> <a class="qq-upload-delete" href="#" ajaxfile="<?php echo $img; ?> " style="display: inline; cursor:pointer;"><?php _e('Delete'); ?> </a> <div class="ajax_preview_img"><img src="<?php echo osc_base_url(); ?> oc-content/uploads/temp/<?php echo $img; ?> " alt="<?php echo $img; ?> "></div> <input type="hidden" name="ajax_photos[]" value="<?php echo $img; ?> "> </li> <?php } ?> </ul> <?php } ?> <div style="clear:both;"></div> <?php $aExt = explode(',', osc_allowed_extension()); foreach ($aExt as $key => $value) { $aExt[$key] = "'" . $value . "'"; } $allowedExtensions = join(',', $aExt); $maxSize = (int) osc_max_size_kb() * 1024; $maxImages = (int) osc_max_images_per_item(); ?> <script> $(document).ready(function() { $('.qq-upload-delete').on('click', function(evt) { evt.preventDefault(); var parent = $(this).parent() var result = confirm('<?php echo osc_esc_js(__("This action can't be undone. Are you sure you want to continue?")); ?> '); var urlrequest = ''; if($(this).attr('ajaxfile')!=undefined) { urlrequest = 'ajax_photo='+$(this).attr('ajaxfile'); } else { urlrequest = 'id='+$(this).attr('photoid')+'&item='+$(this).attr('itemid')+'&code='+$(this).attr('photoname')+'&secret='+$(this).attr('photosecret'); } if(result) { $.ajax({ type: "POST", url: '<?php echo osc_base_url(true); ?> ?page=ajax&action=delete_image&'+urlrequest, dataType: 'json', success: function(data){ parent.remove(); } }); } }); $('#restricted-fine-uploader').on('click','.primary_image', function(event){ if(parseInt($("div.primary_image").index(this))>0){ var a_src = $(this).parent().find('.ajax_preview_img img').attr('src'); var a_title = $(this).parent().find('.ajax_preview_img img').attr('alt'); var a_input = $(this).parent().find('input').attr('value'); // info var a1 = $(this).parent().find('span.qq-upload-file').text(); var a2 = $(this).parent().find('span.qq-upload-size').text(); var li_first = $('ul.qq-upload-list li').get(0); var b_src = $(li_first).find('.ajax_preview_img img').attr('src'); var b_title = $(li_first).find('.ajax_preview_img img').attr('alt'); var b_input = $(li_first).find('input').attr('value'); var b1 = $(li_first).find('span.qq-upload-file').text(); var b2 = $(li_first).find('span.qq-upload-size').text(); $(li_first).find('.ajax_preview_img img').attr('src', a_src); $(li_first).find('.ajax_preview_img img').attr('alt', a_title); $(li_first).find('input').attr('value', a_input); $(li_first).find('span.qq-upload-file').text(a1); $(li_first).find('span.qq-upload-size').text(a2); $(this).parent().find('.ajax_preview_img img').attr('src', b_src); $(this).parent().find('.ajax_preview_img img').attr('alt', b_title); $(this).parent().find('input').attr('value', b_input); $(this).parent().find('span.qq-upload-file').text(b1); $(this).parent().find('span.qq-upload-file').text(b2); } }); $('#restricted-fine-uploader').on('click','.primary_image', function(event){ $(this).addClass('over primary'); }); $('#restricted-fine-uploader').on('mouseenter mouseleave','.primary_image', function(event){ if(event.type=='mouseenter') { if(!$(this).hasClass('primary')) { $(this).addClass('primary'); } } else { if(parseInt($("div.primary_image").index(this))>0){ $(this).removeClass('primary'); } } }); $('#restricted-fine-uploader').on('mouseenter mouseleave','li.qq-upload-success', function(event){ if(parseInt($("li.qq-upload-success").index(this))>0){ if(event.type=='mouseenter') { $(this).find('div.primary_image').addClass('over'); } else { $(this).find('div.primary_image').removeClass('over'); } } }); window.removed_images = 0; $('#restricted-fine-uploader').on('click', 'a.qq-upload-delete', function(event) { window.removed_images = window.removed_images+1; $('#restricted-fine-uploader .flashmessage-error').remove(); }); $('#restricted-fine-uploader').fineUploader({ request: { endpoint: '<?php echo osc_base_url(true) . "?page=ajax&action=ajax_upload"; ?> ' }, multiple: true, validation: { allowedExtensions: [<?php echo $allowedExtensions; ?> ], sizeLimit: <?php echo $maxSize; ?> , itemLimit: <?php echo $maxImages; ?> }, messages: { tooManyItemsError: '<?php echo osc_esc_js(__('Too many items ({netItems}) would be uploaded. Item limit is {itemLimit}.')); ?> ', onLeave: '<?php echo osc_esc_js(__('The files are being uploaded, if you leave now the upload will be cancelled.')); ?> ', typeError: '<?php echo osc_esc_js(__('{file} has an invalid extension. Valid extension(s): {extensions}.')); ?> ', sizeError: '<?php echo osc_esc_js(__('{file} is too large, maximum file size is {sizeLimit}.')); ?> ', emptyError: '<?php echo osc_esc_js(__('{file} is empty, please select files again without it.')); ?> ' }, deleteFile: { enabled: true, method: "POST", forceConfirm: false, endpoint: '<?php echo osc_base_url(true) . "?page=ajax&action=delete_ajax_upload"; ?> ' }, retry: { showAutoRetryNote : true, showButton: true }, text: { uploadButton: '<?php echo osc_esc_js(__('Click or Drop for upload images')); ?> ', waitingForResponse: '<?php echo osc_esc_js(__('Processing...')); ?> ', retryButton: '<?php echo osc_esc_js(__('Retry')); ?> ', cancelButton: '<?php echo osc_esc_js(__('Cancel')); ?> ', failUpload: '<?php echo osc_esc_js(__('Upload failed')); ?> ', deleteButton: '<?php echo osc_esc_js(__('Delete')); ?> ', deletingStatusText: '<?php echo osc_esc_js(__('Deleting...')); ?> ', formatProgress: '<?php echo osc_esc_js(__('{percent}% of {total_size}')); ?> ' } }).on('error', function (event, id, name, errorReason, xhrOrXdr) { $('#restricted-fine-uploader .flashmessage-error').remove(); $('#restricted-fine-uploader').append('<div class="flashmessage flashmessage-error">' + errorReason + '<a class="close" onclick="javascript:$(\'.flashmessage-error\').remove();" >X</a></div>'); }).on('statusChange', function(event, id, old_status, new_status) { $(".alert.alert-error").remove(); }).on('complete', function(event, id, fileName, responseJSON) { if (responseJSON.success) { var new_id = id - removed_images; var li = $('.qq-upload-list li')[new_id]; <?php if (Params::getParam('action') == 'item_add') { ?> if(parseInt(new_id)==0) { $(li).append('<div class="primary_image primary"></div>'); } else { $(li).append('<div class="primary_image"><a title="<?php echo osc_esc_js(osc_esc_html(__('Make primary image'))); ?> "></a></div>'); } <?php } // @TOFIX @FIXME escape $responseJSON_uploadName below // need a js function similar to osc_esc_js(osc_esc_html()) ?> $(li).append('<div class="ajax_preview_img"><img src="<?php echo osc_base_url(); ?> oc-content/uploads/temp/'+responseJSON.uploadName+'" alt="' + responseJSON.uploadName + '"></div>'); $(li).append('<input type="hidden" name="ajax_photos[]" value="'+responseJSON.uploadName+'"></input>'); } <?php if (Params::getParam('action') == 'item_edit') { ?> }).on('validateBatch', function(event, fileOrBlobDataArray) { // clear alert messages if($('#restricted-fine-uploader .alert-error').size()>0) { $('#restricted-fine-uploader .alert-error').remove(); } var len = fileOrBlobDataArray.length; var result = canContinue(len); return result.success; }); function canContinue(numUpload) { // strUrl is whatever URL you need to call var strUrl = "<?php echo osc_base_url(true) . "?page=ajax&action=ajax_validate&id=" . osc_item_id() . "&secret=" . osc_item_secret(); ?> "; var strReturn = {}; jQuery.ajax({ url: strUrl, success: function(html) { strReturn = html; }, async:false }); var json = JSON.parse(strReturn); var total = parseInt(json.count) + $("#restricted-fine-uploader input[name='ajax_photos[]']").size() + (numUpload); <?php if ($maxImages > 0) { ?> if(total<=<?php echo $maxImages; ?> ) { json.success = true; } else { json.success = false; $('#restricted-fine-uploader .qq-uploader').after($('<div class="alert alert-error"><?php echo osc_esc_js(sprintf(__('Too many items were uploaded. Item limit is %d.'), $maxImages)); ?> </div>')); } <?php } else { ?> json.success = true; <?php } ?> return json; } <?php } else { ?> }); <?php } ?> }); </script> <?php }
/** * Show form to vote an item. (itemDetail) */ function voting_item_detail() { if (osc_is_this_category('voting', osc_item_category_id()) && osc_get_preference('item_voting', 'voting') == '1') { $aux_vote = ModelVoting::newInstance()->getItemAvgRating(osc_item_id()); $aux_count = ModelVoting::newInstance()->getItemNumberOfVotes(osc_item_id()); $vote['vote'] = $aux_vote['vote']; $vote['total'] = $aux_count['total']; $hash = ''; if (osc_logged_user_id() == 0) { $hash = $_SERVER['HTTP_USER_AGENT'] . $_SERVER['REMOTE_ADDR']; $hash = sha1($hash); } else { $hash = null; } $vote['can_vote'] = true; if (osc_get_preference('user', 'voting') == 1) { if (!osc_is_web_user_logged_in()) { $vote['can_vote'] = false; } } if (!can_vote(osc_item_id(), osc_logged_user_id(), $hash)) { $vote['can_vote'] = false; } require 'item_detail.php'; } }
function osclass_pm_link($class = '') { if (osc_is_ad_page() && osc_is_web_user_logged_in() && osc_item_user_id() != '') { $user = User::newInstance()->findByPrimaryKey(osc_item_user_id()); echo '<a class="' . $class . '" href="' . osc_base_url(true) . '?page=custom&file=osclass_pm/user-send.php&userId=' . osc_item_user_id() . '&itemId=' . osc_item_id() . '&mType=new">Postavi pitanje prodavcu </a>'; } elseif (osc_is_ad_page() && !osc_is_web_user_logged_in()) { $user = User::newInstance()->findByPrimaryKey(osc_item_user_id()); echo '<a class="' . $class . '" href="' . osc_user_login_url() . '&http_referer=' . osc_base_url(true) . '?page=custom&file=osclass_pm/user-send.php&userId=' . osc_item_user_id() . '&itemId=' . osc_item_id() . '&mType=new">' . __('Login to contact seller.', 'osclass_pm') . '</a>'; } }