function getObjectInfo($id, $language = null)
 {
     $info = new JCommentsObjectInfo();
     $routerHelper = JPATH_ROOT . '/administrator/components/com_djclassifieds/lib/djseo.php';
     if (is_file($routerHelper)) {
         require_once $routerHelper;
         $db = JFactory::getDBO();
         $query = $db->getQuery(true);
         $query->select('a.id, a.alias, a.name, a.user_id');
         $query->from('#__djcf_items AS a');
         $query->select('c.id AS category_id, c.alias AS category_alias');
         $query->join('LEFT', '#__djcf_categories AS c ON c.id = a.cat_id');
         $query->where('a.id = ' . (int) $id);
         $db->setQuery($query);
         $row = $db->loadObject();
         if (!empty($row)) {
             $slug = $row->alias ? $row->id . ':' . $row->alias : $row->id;
             $catslug = $row->category_alias ? $row->category_id . ':' . $row->category_alias : $row->category_id;
             $info->title = $row->name;
             $info->category_id = $row->category_id;
             $info->userid = $row->user_id;
             $info->link = JRoute::_(DJClassifiedsSEO::getItemRoute($slug, $catslug));
         }
     }
     return $info;
 }
 function display($tpl = null)
 {
     $app = JFactory::getApplication();
     $document = JFactory::getDocument();
     $Itemid = JRequest::getVar('Itemid', 0, 'int');
     //$document->link = JRoute::_(WeblinksHelperRoute::getCategoryRoute(JRequest::getVar('id', null, '', 'int')));
     JRequest::setVar('limit', $app->getCfg('feed_limit'));
     $siteEmail = $app->getCfg('mailfrom');
     $fromName = $app->getCfg('fromname');
     $document->editor = $fromName;
     $document->editorEmail = $siteEmail;
     // Get some data from the model
     $model = $this->getModel();
     $cat_id = JRequest::getVar('cid', 0, '', 'int');
     $catlist = '';
     $maincat = '';
     if ($cat_id > 0) {
         $main_cat = $model->getMainCat($cat_id);
         $document->title = $main_cat->name;
         $cats = DJClassifiedsCategory::getSubCatIemsCount($cat_id, 1);
         $catlist = $cat_id;
         foreach ($cats as $c) {
             $catlist .= ',' . $c->id;
         }
     }
     $items = $model->getItems($catlist);
     foreach ($items as $item) {
         // strip html from feed item title
         $title = $this->escape($item->name);
         $title = html_entity_decode($title, ENT_COMPAT, 'UTF-8');
         // url link to article
         //$link = JRoute::_('index.php?option=com_djclassifieds&view=item&cid='.$item->cat_id.'&id='.$item->id.'&Itemid='.$Itemid);
         if (!$item->alias) {
             $item->alias = DJClassifiedsSEO::getAliasName($item->name);
         }
         if (!$item->c_alias) {
             $item->c_alias = DJClassifiedsSEO::getAliasName($item->c_name);
         }
         $link = JRoute::_(DJClassifiedsSEO::getItemRoute($item->id . ':' . $item->alias, $item->cat_id . ':' . $item->c_alias));
         //echo $link;die();
         // strip html from feed item description text
         $description = $item->intro_desc;
         $date = $item->date_start ? date('r', strtotime($item->date_start)) : '';
         if ($item->image_url != '') {
             $images = explode(';', $item->image_url);
             $description .= '<img align="right" src="' . JURI::base() . '/components/com_djclassifieds/images/' . $images[0] . '.ths.jpg" />';
         }
         // load individual item creator class
         $feeditem = new JFeedItem();
         $feeditem->title = $title;
         $feeditem->link = $link;
         $feeditem->description = $description;
         $feeditem->date = $date;
         $feeditem->category = $item->c_name;
         // loads item info into rss array
         $document->addItem($feeditem);
     }
 }
Beispiel #3
0
 function getItem($id)
 {
     $db = JFactory::getDBO();
     $app = JFactory::getApplication();
     $date_now = date("Y-m-d H:i:s");
     $quantity = JRequest::getInt('quantity', 0);
     $query = "SELECT i.*, c.name as c_name, c.alias as c_alias FROM #__djcf_items i " . "LEFT JOIN #__djcf_categories c ON c.id=i.cat_id " . "WHERE i.id=" . $id . " AND i.published=1 AND c.published=1 AND i.date_start <= '" . $date_now . "' AND i.date_exp >= '" . $date_now . "' LIMIT 1";
     $db->setQuery($query);
     $item = $db->loadObject();
     if (!$item) {
         $redirect = DJClassifiedsSEO::getCategoryRoute('0:all');
         $message = JText::_("COM_DJCLASSIFIEDS_ITEM_NOT_AVAILABLE");
         $redirect = JRoute::_($redirect);
         $app->redirect($redirect, $message);
     } else {
         if ($quantity > $item->quantity) {
             $redirect = DJClassifiedsSEO::getItemRoute($item->id . ':' . $item->alias, $item->cat_id . ':' . $item->c_alias);
             $message = JText::_("COM_DJCLASSIFIEDS_NUMBER_OF_PRODUCTS_IS_LESS_THEN_SELECTED");
             $redirect = JRoute::_($redirect);
             $app->redirect($redirect, $message);
         }
     }
     return $item;
 }
Beispiel #4
0
    if ($order->i_name) {
        echo '<div class="item_col icon first"  style="width:' . $icon_col_w . 'px"  >';
        echo '<a href="' . DJClassifiedsSEO::getItemRoute($order->item_id . ':' . $order->i_alias, $order->cat_id . ':' . $order->c_alias) . '">';
        if (count($order->images)) {
            echo '<img src="' . JURI::base() . $order->images[0]->thumb_s . '"';
            echo ' alt ="' . str_ireplace('"', "'", $order->images[0]->caption) . '" ';
            echo '/>';
        } else {
            echo '<img src="' . JURI::base() . '/components/com_djclassifieds/assets/images/no-image.png" ';
            echo ' alt ="' . str_ireplace('"', "'", $order->i_name) . '" ';
            echo '/>';
        }
        echo '</a>';
        echo '</div>';
        echo '<div class="item_col name">';
        echo '<h3><a class="title" href="' . DJClassifiedsSEO::getItemRoute($order->item_id . ':' . $order->i_alias, $order->cat_id . ':' . $order->c_alias) . '" >' . $order->i_name . '</a></h3>';
        echo '</div>';
    } else {
        echo '<div class="item_col icon first"  style="width:' . $icon_col_w . 'px"  >';
        echo '<img src="' . JURI::base() . '/components/com_djclassifieds/assets/images/no-image.png" ';
        echo ' alt ="' . str_ireplace('"', "'", $order->item_name) . '" ';
        echo '/>';
        echo '</div>';
        echo '<div class="item_col name">';
        echo '<h3>' . $order->item_name . '</a></h3>';
        echo '</div>';
    }
    ?>
				<div class="item_col"> 
					<div class="djcf_prow_desc_row djcf_prow_price">
						<span class="djcf_prow_desc_label" ><?php 
Beispiel #5
0
			<?php 
$modules_djcf =& JModuleHelper::getModules('djcf-delete-top');
if (count($modules_djcf) > 0) {
    echo '<div class="djcf-war-top clearfix">';
    foreach (array_keys($modules_djcf) as $m) {
        echo JModuleHelper::renderModule($modules_djcf[$m], $mod_attribs);
    }
    echo '</div>';
}
?>
			<div class="djcf_war_content">
				<?php 
echo JText::_('COM_DJCLASSIFIEDS_DELETE_CONFIRM');
?>
				<?php 
echo ' "<a class="" href="' . DJClassifiedsSEO::getItemRoute($this->item->id . ':' . $this->item->alias, $this->item->cat_id . ':' . $this->item->c_alias) . '">';
echo $this->item->name;
echo '</a>"';
?>
			</div>                	
			<?php 
$modules_djcf =& JModuleHelper::getModules('djcf-delete-center');
if (count($modules_djcf) > 0) {
    echo '<div class="djcf-war-center clearfix">';
    foreach (array_keys($modules_djcf) as $m) {
        echo JModuleHelper::renderModule($modules_djcf[$m], $mod_attribs);
    }
    echo '</div>';
}
?>
						
Beispiel #6
0
 if ($icon_new) {
     echo ' <span class="new_icon">' . JText::_('COM_DJCLASSIFIEDS_NEW') . '</span>';
 }
 if (strstr($i->promotions, 'p_special')) {
     //echo ' <img src="'.JURI::base().'/components/com_djclassifieds/themes/'.$this->theme.'/images/promo_star.png" class="prom_ico" alt="special" />';
     echo '<span class="prom_ico" ></span>';
 }
 if ($i->auction) {
     echo '<span class="auction_icon" ></span>';
 }
 echo '</div>';
 if ($par->get('column_category', '1')) {
     echo '<div class="item_col cat_name"><a href="' . DJClassifiedsSEO::getCategoryRoute($i->cat_id . ':' . $i->c_alias) . '" >' . $i->c_name . '</a></div>';
 }
 if ($par->get('column_desc', '1')) {
     echo '<div class="item_col description"><a class="title" href="' . DJClassifiedsSEO::getItemRoute($i->id . ':' . $i->alias, $i->cat_id . ':' . $i->c_alias) . $anch . '">';
     echo mb_substr(strip_tags($i->intro_desc), 0, $par->get('introdesc_char_limit', '120'), 'UTF-8');
     echo '</a></div>';
 }
 if ($par->get('column_loc', '1') && $par->get('show_regions', '1')) {
     echo '<div class="item_col region"><a href="index.php?option=com_djclassifieds&view=items&se=1&se_regs[]=' . $i->region_id . '&Itemid=' . $Itemid . '">' . $i->r_name . '</a></div>';
 }
 if ($par->get('column_price', '1') && $par->get('show_price', '1')) {
     echo '<div class="item_col price">';
     if ($i->price) {
         echo DJClassifiedsTheme::priceFormat($i->price, $i->currency);
     } else {
         echo '---';
     }
     echo '</div>';
 }
Beispiel #7
0
 public static function parseMessageBody($message, $message_id, $item, $reciver = '', $bidder = '', $bid = '', $bcontact_message = '', $bowner = '', $contact_message = '', $contact_author = '', $abuse_message = '', $abuse_author = '', $buyer = '', $quantity = '', $contact_fields_message = '', $payment_info = array())
 {
     $dispatcher = JDispatcher::getInstance();
     $dispatcher->trigger('onAdminBeforeParseEmailBody', array(&$message, $message_id, &$item, &$reciver, &$bidder, &$bid, &$bcontact_message, &$bowner, $contact_message, &$contact_author, &$abuse_message, &$abuse_author, &$buyer, &$quantity, &$contact_fields_message));
     $u = JURI::getInstance(JURI::root());
     if ($item) {
         if ($u->getScheme()) {
             $link = $u->getScheme() . '://';
         } else {
             $link = 'http://';
         }
         $link .= $u->getHost() . JRoute::_(DJClassifiedsSEO::getItemRoute($item->id . ':' . $item->alias, $item->cat_id . ':' . $item->c_alias));
         $link = str_ireplace('administrator/', '', $link);
         $message = str_ireplace('[[advert_id]]', $item->id, $message);
         $message = str_ireplace('[[advert_link]]', '<a href="' . $link . '">' . $link . '</a>', $message);
         $message = str_ireplace('[[advert_title]]', $item->name, $message);
         $message = str_ireplace('[[advert_title_link]]', '<a href="' . $link . '">' . $item->name . '</a>', $message);
         $message = str_ireplace('[[advert_category]]', $item->c_name, $message);
         $message = str_ireplace('[[advert_intro_desc]]', $item->intro_desc, $message);
         $message = str_ireplace('[[advert_desc]]', $item->description, $message);
         if ($item->user_id) {
             $message = str_ireplace('[[advert_author_name]]', $item->u_name, $message);
             $message = str_ireplace('[[advert_author_email]]', $item->u_email, $message);
         } else {
             $message = str_ireplace('[[advert_author_name]]', JText::_('COM_DJCLASSIFIEDS_GUEST'), $message);
             $message = str_ireplace('[[advert_author_email]]', $item->email, $message);
         }
         if ($item->published) {
             $message = str_ireplace('[[advert_status]]', JText::_('COM_DJCLASSIFIEDS_PUBLISHED'), $message);
         } else {
             $message = str_ireplace('[[advert_status]]', JText::_('COM_DJCLASSIFIEDS_WAITING_FOR_PUBLISH'), $message);
         }
     }
     if ($reciver) {
         $message = str_ireplace('[[user_id]]', $reciver->id, $message);
         $message = str_ireplace('[[user_name]]', $reciver->name, $message);
         $message = str_ireplace('[[user_username]]', $reciver->username, $message);
         $message = str_ireplace('[[user_email]]', $reciver->email, $message);
     }
     if ($bid) {
         $message = str_ireplace('[[bid_value]]', $bid, $message);
     }
     if ($bidder) {
         $message = str_ireplace('[[bidder_id]]', $bidder->id, $message);
         $message = str_ireplace('[[bidder_name]]', $bidder->name, $message);
         $message = str_ireplace('[[bidder_username]]', $bidder->username, $message);
         $message = str_ireplace('[[bidder_email]]', $bidder->email, $message);
     }
     if ($bcontact_message) {
         $message = str_ireplace('[[bcontact_message]]', $bcontact_message, $message);
     }
     if ($bowner) {
         $message = str_ireplace('[[bcontact_author_name]]', $bowner->name, $message);
     }
     if ($contact_fields_message) {
         $message = str_ireplace('[[contact_custom_fields_message]]', $contact_fields_message, $message);
     }
     if ($contact_message) {
         $message = str_ireplace('[[contact_message]]', $contact_message, $message);
     }
     if ($contact_author) {
         $message = str_ireplace('[[contact_author_name]]', $contact_author['name'], $message);
         $message = str_ireplace('[[contact_author_email]]', $contact_author['email'], $message);
     }
     if ($abuse_message) {
         $message = str_ireplace('[[abuse_message]]', $abuse_message, $message);
     }
     if ($abuse_author) {
         $message = str_ireplace('[[abuse_author_name]]', $abuse_author->name, $message);
     }
     if ($buyer) {
         $message = str_ireplace('[[buyer_name]]', $buyer->name, $message);
         $message = str_ireplace('[[buyer_email]]', $buyer->email, $message);
     }
     if ($quantity) {
         $message = str_ireplace('[[buynow_quantity]]', $quantity, $message);
         $message = str_ireplace('[[buynow_price]]', $item->price, $message);
         $dispatcher->trigger('onAdminPriceParseEmailBody', array(&$message, $message_id, $item, $buyer, &$price_total));
         $price_total = $quantity * $item->price;
         $message = str_ireplace('[[buynow_price_total]]', $price_total, $message);
     }
     if (count($payment_info)) {
         $message = str_ireplace('[[payment_item_name]]', $payment_info['itemname'], $message);
         $message = str_ireplace('[[payment_price]]', $payment_info['amount'], $message);
         $message = str_ireplace('[[payment_info]]', $payment_info['info'], $message);
         $message = str_ireplace('[[payment_id]]', $payment_info['id'], $message);
     }
     $dispatcher->trigger('onAdminParseEmailBody', array(&$message, $message_id, $item, $buyer));
     return $message;
 }
Beispiel #8
0
        }
        if ($params->get('show_price') == 1 && $i->price) {
            echo '<span class="price">';
            echo DJClassifiedsTheme::priceFormat($i->price, $i->currency);
            echo '</span>';
        }
        echo '</div>';
    }
    echo '</div>';
    if ($params->get('show_description') == 1) {
        echo '<div class="desc">';
        if ($params->get('desc_source', '0') == 1) {
            echo $i->description;
        } else {
            if ($params->get('desc_link') == 1) {
                echo '<a href="' . JRoute::_(DJClassifiedsSEO::getItemRoute($i->id . ':' . $i->alias, $i->cat_id . ':' . $i->c_alias)) . '">';
            }
            $desc_c = $params->get('char_desc_nr');
            if ($desc_c != 0 && $i->intro_desc != '' && strlen($i->intro_desc) > $desc_c) {
                echo mb_substr($i->intro_desc, 0, $desc_c, 'utf-8') . ' ...';
            } else {
                echo $i->intro_desc;
            }
            if ($params->get('desc_link') == 1) {
                echo '</a>';
            }
        }
        echo '</div>';
    }
    echo '</div>';
}
Beispiel #9
0
 function activateMoveToTopPromotion($id)
 {
     $app = JFactory::getApplication();
     $par = JComponentHelper::getParams('com_djclassifieds');
     $user = JFactory::getUser();
     $db = JFactory::getDBO();
     $id = JRequest::getInt('id', 0);
     $query = "SELECT i.*, c.points as c_points, c.autopublish as c_autopublish, c.alias as c_alias FROM #__djcf_items i " . "LEFT JOIN #__djcf_categories c ON c.id=i.cat_id " . "WHERE i.id=" . $id . " LIMIT 1";
     $db->setQuery($query);
     $item = $db->loadObject();
     $redirect_a = 0;
     if (!$item) {
         $redirect_a = 1;
         $message = JText::_('COM_DJCLASSIFIEDS_WRONG_AD');
     }
     if ($item->user_id != $user->id) {
         $redirect_a = 1;
         $message = JText::_('COM_DJCLASSIFIEDS_WRONG_AD');
     }
     if ($user->id == 0) {
         $redirect_a = 1;
         $message = JText::_('COM_DJCLASSIFIEDS_PLEASE_LOGIN');
     }
     if ($redirect_a) {
         $redirect = "index.php?option=com_djclassifieds&view=items&cid=0";
         $redirect = JRoute::_($redirect, false);
         $app->redirect($redirect, $message);
     }
     $query = "SELECT SUM(p.points)FROM #__djcf_users_points p " . "WHERE p.user_id='" . $user->id . "' ";
     $db->setQuery($query);
     $message = JText::_('COM_DJCLASSIFIEDS_POINTS_PAYMENT_CONFIRMED_PROMOTION_MOVE_TO_TOP_ACTIVATED');
     $redirect = DJClassifiedsSEO::getItemRoute($item->id . ':' . $item->alias, $item->cat_id . ':' . $item->c_alias);
     $date_sort = date("Y-m-d H:i:s");
     $query = "UPDATE #__djcf_items SET date_sort='" . $date_sort . "' " . "WHERE id=" . $item->id . " ";
     $db->setQuery($query);
     $db->query();
     $redirect = JRoute::_($redirect, false);
     $app->redirect($redirect, $message);
 }
Beispiel #10
0
                        } else {
                            if (strstr($field, 'http://') || strstr($field, 'https://')) {
                                echo '<a ' . $this->custom_fields[$f_id]->params . ' href="' . $field . '">' . str_ireplace(array("http://", "https://"), array('', ''), $field) . '</a>';
                            } else {
                                echo '<a ' . $this->custom_fields[$f_id]->params . ' href="http://' . $field . '">' . $field . '</a>';
                            }
                        }
                    } else {
                        echo $field;
                    }
                }
                echo '</div>';
            }
        }
        if ($par->get('blog_readmore', '1')) {
            echo '<div class="see_details_box"><a class="see_details" href="' . DJClassifiedsSEO::getItemRoute($i->id . ':' . $i->alias, $i->cat_id . ':' . $i->c_alias) . $anch . '" >' . JText::_('COM_DJCLASSIFIEDS_SEE_DETAILS') . '</a></div>';
        }
        echo '</div>';
        if (strstr($i->promotions, 'p_special')) {
            echo '<span class="p_special_img">&nbsp;</span>';
        }
        echo '</div></div></div></div></div>';
    }
    ?>
	
		<?php 
    echo '<div style="clear:both" ></div>';
    if (count($this->items) == 0) {
        echo '<div class="no_results" style="padding-left:30px;">';
        if ($se > 0) {
            echo JText::_('COM_DJCLASSIFIEDS_NO_RESULTS');
Beispiel #11
0
												<?php 
            $class = '';
            if ($par->get('column_desc', '1') == '2') {
                $class .= ' hide_mobile';
            } else {
                if ($par->get('column_desc', '1') == '3') {
                    $class .= ' hide_tablet hide_mobile';
                }
            }
            ?>
												<div class="item_desc<?php 
            echo $class;
            ?>
">
													<a href="<?php 
            echo DJClassifiedsSEO::getItemRoute($i->id . ':' . $i->alias, $i->cat_id . ':' . $i->c_alias) . $anch;
            ?>
" >
														<?php 
            echo mb_substr(strip_tags($i->intro_desc), 0, $par->get('introdesc_char_limit', '120'), 'UTF-8');
            ?>
													</a>
												</div>
											<?php 
        }
        ?>
											<?php 
        if ($i->event->afterDJClassifiedsDisplayContent) {
            ?>
												<div class="djcf_after_content">
													<?php 
Beispiel #12
0
 function process($id)
 {
     $db = JFactory::getDBO();
     $app = JFactory::getApplication();
     $Itemid = JRequest::getInt("Itemid", '0');
     $par = JComponentHelper::getParams('com_djclassifieds');
     $user = JFactory::getUser();
     $config = JFactory::getConfig();
     $ptype = JRequest::getVar('ptype');
     $type = JRequest::getVar('type', '');
     $row = JTable::getInstance('Payments', 'DJClassifiedsTable');
     if ($type == 'prom_top') {
         $query = "SELECT i.* FROM #__djcf_items i " . "WHERE i.id=" . $id . " LIMIT 1";
         $db->setQuery($query);
         $item = $db->loadObject();
         if (!isset($item)) {
             $message = JText::_('COM_DJCLASSIFIEDS_WRONG_AD');
             $redirect = "index.php?option=com_djclassifieds&view=items&cid=0";
         }
         $row->item_id = $id;
         $row->user_id = $user->id;
         $row->method = $ptype;
         $row->status = 'Start';
         $row->ip_address = $_SERVER['REMOTE_ADDR'];
         $row->price = $par->get('promotion_move_top_price', 0);
         $row->type = 2;
         $row->store();
         $amount = $par->get('promotion_move_top_price', 0);
         $itemname = $item->name;
         $item_id = $row->id;
         $item_cid = '&cid=' . $item->cat_id;
     } else {
         if ($type == 'points') {
             $query = "SELECT p.* FROM #__djcf_points p " . "WHERE p.id=" . $id . " LIMIT 1";
             $db->setQuery($query);
             $points = $db->loadObject();
             if (!isset($item)) {
                 $message = JText::_('COM_DJCLASSIFIEDS_WRONG_POINTS_PACKAGE');
                 $redirect = "index.php?option=com_djclassifieds&view=items&cid=0";
             }
             $row->item_id = $id;
             $row->user_id = $user->id;
             $row->method = $ptype;
             $row->status = 'Start';
             $row->ip_address = $_SERVER['REMOTE_ADDR'];
             $row->price = $points->price;
             $row->type = 1;
             $row->store();
             $amount = $points->price;
             $itemname = $points->name;
             $item_id = $row->id;
             $item_cid = '';
         } else {
             $query = "SELECT i.*, c.price as c_price, c.alias as c_alias FROM #__djcf_items i " . "LEFT JOIN #__djcf_categories c ON c.id=i.cat_id " . "WHERE i.id=" . $id . " LIMIT 1";
             $db->setQuery($query);
             $item = $db->loadObject();
             if (!isset($item)) {
                 $message = JText::_('COM_DJCLASSIFIEDS_WRONG_AD');
                 $redirect = "index.php?option=com_djclassifieds&view=items&cid=0";
             }
             $amount = 0;
             if (strstr($item->pay_type, 'cat')) {
                 $amount += $item->c_price / 100;
             }
             if (strstr($item->pay_type, 'duration_renew')) {
                 $query = "SELECT d.price_renew FROM #__djcf_days d " . "WHERE d.days=" . $item->exp_days;
                 $db->setQuery($query);
                 $amount += $db->loadResult();
             } else {
                 if (strstr($item->pay_type, 'duration')) {
                     $query = "SELECT d.price FROM #__djcf_days d " . "WHERE d.days=" . $item->exp_days;
                     $db->setQuery($query);
                     $amount += $db->loadResult();
                 }
             }
             $query = "SELECT p.* FROM #__djcf_promotions p " . "WHERE p.published=1 ORDER BY p.id ";
             $db->setQuery($query);
             $promotions = $db->loadObjectList();
             foreach ($promotions as $prom) {
                 if (strstr($item->pay_type, $prom->name)) {
                     $amount += $prom->price;
                 }
             }
             /*$query = 'DELETE FROM #__djcf_payments WHERE item_id= "'.$id.'" ';
             		$db->setQuery($query);
             		$db->query();
             		
             		
             		$query = 'INSERT INTO #__djcf_payments ( item_id,user_id,method,  status)' .
             				' VALUES ( "'.$id.'" ,"'.$user->id.'","'.$ptype.'" ,"Start" )'
             				;
             		$db->setQuery($query);
             		$db->query();*/
             $row->item_id = $id;
             $row->user_id = $user->id;
             $row->method = $ptype;
             $row->status = 'Start';
             $row->ip_address = $_SERVER['REMOTE_ADDR'];
             $row->price = $amount;
             $row->type = 0;
             $row->store();
             $itemname = $item->name;
             $item_id = $row->id;
             $item_cid = '&cid=' . $item->cat_id;
             $item_slug = $item->id . ':' . $item->alias;
             $cat_slug = $item->cat_id . ':' . $item->c_alias;
         }
     }
     /*
     		$query ="SELECT i.*, c.price as c_price, c.alias as c_alias FROM #__djcf_items i "
        ."LEFT JOIN #__djcf_categories c ON c.id=i.cat_id "
        ."WHERE i.id=".$id." LIMIT 1";
     		$db->setQuery($query);
     		$item = $db->loadObject();
     		if(!isset($item)){
     $message = JText::_('COM_DJCLASSIFIEDS_WRONG_AD');
     $redirect="index.php?option=com_djclassifieds&view=items&cid=0";
     		}
     		
     $query = 'DELETE FROM #__djcf_payments WHERE item_id= "'.$id.'" ';
     $db->setQuery($query);
     $db->query();
     
     
     $query = 'INSERT INTO #__djcf_payments ( item_id,user_id,method,  status)' .
     		' VALUES ( "'.$id.'" ,"'.$user->id.'","'.$ptype.'" ,"Start" )'
     		;
     $db->setQuery($query);
     $db->query();
     
     		
     		$amount = 0;
     
     if(strstr($item->pay_type, 'cat')){			
     	$amount += $item->c_price/100; 
     }
     if(strstr($item->pay_type, 'duration_renew')){			
     	$query = "SELECT d.price_renew FROM #__djcf_days d "
     	."WHERE d.days=".$item->exp_days;
     	$db->setQuery($query);
     	$amount += $db->loadResult();
     }else if(strstr($item->pay_type, 'duration')){			
     	$query = "SELECT d.price FROM #__djcf_days d "
     	."WHERE d.days=".$item->exp_days;
     	$db->setQuery($query);
     	$amount += $db->loadResult();
     }
     
     $query = "SELECT p.* FROM #__djcf_promotions p "
     	."WHERE p.published=1 ORDER BY p.id ";
     $db->setQuery($query);
     $promotions=$db->loadObjectList();
     foreach($promotions as $prom){
     	if(strstr($item->pay_type, $prom->name)){	
     		$amount += $prom->price; 
     	}	
     }	
     */
     if ($user->id) {
         $mailto = $user->email;
         $mailfrom = $app->getCfg('mailfrom');
         $fromname = $config->get('config.sitename') . ' - ' . str_ireplace('administrator/', '', JURI::base());
         $subject = JText::_('PLG_DJCFBANKTRANSFER_PAYMENT_INFRORMATIONS') . ' ' . $config->get('config.sitename');
         $m_message = JText::_('PLG_DJCFBANKTRANSFER_PAYMENT_INFRORMATIONS') . ' ' . $config->get('config.sitename') . "<br /><br />";
         if ($type == 'points') {
             $m_message .= JText::_('PLG_DJCFBANKTRANSFER_POINTS_PACKAGE') . ': ' . $itemname . "<br /><br />";
         } else {
             $m_message .= JText::_('PLG_DJCFBANKTRANSFER_PAYMENT_AD_NAME') . ': ' . $itemname . "<br /><br />";
         }
         $m_message .= JText::_('PLG_DJCFBANKTRANSFER_PAYMENT_PRICE_TO_PAY') . ': ' . $amount . ' ' . $par->get('unit_price', '') . "<br /><br />";
         $m_message .= JText::_('PLG_DJCFBANKTRANSFER_PAYMENT_PAY_INFORMATION') . ': <br /><br />' . JHTML::_('content.prepare', nl2br($this->params["pay_info"])) . "<br /><br />";
         if ($type == '') {
             $u = JURI::getInstance(JURI::base());
             $link = $u->getHost() . JRoute::_(DJClassifiedsSEO::getItemRoute($item_slug, $cat_slug));
             $m_message .= JText::_('PLG_DJCFBANKTRANSFER_PAYMENT_AD_LINK') . ': <a href="' . $link . '">' . $link . '</a><br /><br />';
             $m_message .= JText::_('PLG_DJCFBANKTRANSFER_PAYMENT_AD_ID') . ': ' . $id . '<br /><br />';
         }
         $m_message .= JText::_('PLG_DJCFBANKTRANSFER_PAYMENT_ID') . ': ' . $item_id;
         $mailer = JFactory::getMailer();
         $mailer->sendMail($mailfrom, $fromname, $mailto, $subject, $m_message, $mode = 1);
     }
     echo '<div id="dj-classifieds" class="clearfix">';
     echo '<table width="98%" cellspacing="0" cellpadding="0" border="0" class="paymentdetails first">';
     echo '<tr><td class="td_title"><h2>' . $this->params["payment_method"] . '</h2></td></tr>';
     echo '<tr><td class="td_pdetails">';
     echo '<div class="pd_row">';
     if ($type == 'points') {
         echo '<span class="djcfpay_label">' . JText::_('PLG_DJCFBANKTRANSFER_POINTS_PACKAGE') . ':</span>';
     } else {
         echo '<span class="djcfpay_label">' . JText::_('PLG_DJCFBANKTRANSFER_PAYMENT_AD_NAME') . ':</span>';
     }
     echo '<span class="djcfpay_value">' . $itemname . '</span>';
     echo '</div>';
     echo '<div class="pd_row">';
     echo '<span class="djcfpay_label">' . JText::_('PLG_DJCFBANKTRANSFER_PAYMENT_PRICE_TO_PAY') . ':</span>';
     echo '<span class="djcfpay_value">' . $amount . ' ' . $par->get('unit_price', '') . '</span>';
     echo '</div>';
     echo '<div class="pd_row">';
     if ($type == 'points') {
         echo '<span class="djcfpay_label">' . JText::_('PLG_DJCFBANKTRANSFER_PAYMENT_POINTS_ID') . ':</span>';
     } else {
         echo '<span class="djcfpay_label">' . JText::_('PLG_DJCFBANKTRANSFER_PAYMENT_AD_ID') . ':</span>';
     }
     echo '<span class="djcfpay_value">' . $item_id . '</span>';
     echo '</div>';
     echo '<div class="pd_row">';
     echo '<span class="djcfpay_label">' . JText::_('PLG_DJCFBANKTRANSFER_PAYMENT_PAY_INFORMATION') . ': </span><br /><br />';
     echo '<span class="djcfpay_value">' . JHTML::_('content.prepare', nl2br($this->params["pay_info"])) . '</span>';
     echo '</div>';
     echo '</td></tr>';
     echo '</table>';
     echo '</div>';
 }
 function removeFavourite()
 {
     $app = JFactory::getApplication();
     $id = JRequest::getInt('id', 0);
     $cid = JRequest::getVar('cid', 0, '', 'int');
     $db = JFactory::getDBO();
     $user = JFactory::getUser();
     $itemid = JRequest::getVar('Itemid');
     $par = JComponentHelper::getParams('com_djclassifieds');
     $query = "SELECT i.id, i.name, i.alias,i.cat_id,c.name as c_name, c.alias as c_alias FROM #__djcf_items i " . "LEFT JOIN #__djcf_categories c ON c.id=i.cat_id " . "WHERE i.id = " . $id;
     $db->setQuery($query);
     $item = $db->loadObject();
     if (!$item->alias) {
         $item->alias = DJClassifiedsSEO::getAliasName($item->name);
     }
     if (!$item->c_alias) {
         $item->c_alias = DJClassifiedsSEO::getAliasName($item->c_name);
     }
     $link = DJClassifiedsSEO::getItemRoute($item->id . ':' . $item->alias, $item->cat_id . ':' . $item->c_alias);
     $m_type = '';
     if ($par->get('favourite', '1')) {
         if ($user->id > 0) {
             $query = "DELETE FROM #__djcf_favourites WHERE item_id=" . $id . " AND user_id=" . $user->id . " ";
             $db->setQuery($query);
             $db->query();
             $msg = JText::_('COM_DJCLASSIFIEDS_AD_REMOVED_FROM_FAVOURITES');
         } else {
             $msg = JText::_('COM_DJCLASSIFIEDS_PLEASE_LOGIN');
             $m_type = 'error';
         }
     } else {
         $msg = JText::_('COM_DJCLASSIFIEDS_FUNCTION_NOT_AVAILABLE');
         $m_type = 'error';
     }
     //$link = 'index.php?option=com_djclassifieds&view=item&cid='.$cid.'&id='.$id.'&Itemid='.$itemid;
     $link = JRoute::_($link);
     $app->redirect($link, $msg, $m_type);
 }
Beispiel #14
0
 function display($tpl = null)
 {
     $model = $this->getModel();
     $par = JComponentHelper::getParams('com_djclassifieds');
     $document = JFactory::getDocument();
     $app = JFactory::getApplication();
     $dispatcher = JDispatcher::getInstance();
     $theme = $par->get('theme', 'default');
     $user = JFactory::getUser();
     $item = $model->getItem();
     if ($item->user_id != $user->id) {
         $groups_acl = ',' . implode(',', $user->getAuthorisedViewLevels()) . ',';
         if (!strstr($groups_acl, ',' . $item->c_access_view . ',') || !$item) {
             DJClassifiedsTheme::djAccessRestriction('category');
         } else {
             if ($item->access_view == 0) {
                 if (!strstr($groups_acl, ',' . $item->c_access_item_view . ',')) {
                     DJClassifiedsTheme::djAccessRestriction();
                 }
             } else {
                 if (!strstr($groups_acl, ',' . $item->access_view . ',')) {
                     DJClassifiedsTheme::djAccessRestriction();
                 }
             }
         }
     }
     $item_images = DJClassifiedsImage::getAdsImages($item->id);
     $category = $model->getCategory($item->cat_id);
     $fields = $model->getFields($item->cat_id);
     $fields_contact = $model->geContactFields();
     $item_payments = $model->getItemPayment($item->id);
     $item_options = $model->getItemOptions($item->id);
     $bids = $model->getBids($item->id, $par->get('bids_displayed', 5));
     if ($item->user_id != 0) {
         $user_items_c = $model->getUserItemsCount($item->user_id);
         $this->assignRef('user_items_c', $user_items_c);
     }
     $menus = $app->getMenu('site');
     $m_active = $menus->getActive();
     $cat_menu_path = array();
     $cid_menu = 0;
     if ($m_active) {
         if (strstr($m_active->link, 'com_djclassifieds') && strstr($m_active->link, 'items')) {
             $cid_menu = $m_active->query['cid'];
             if ($cid_menu > 0) {
                 $cat_menu_path = DJClassifiedsCategory::getParentPath(1, $cid_menu);
             }
         }
     }
     $warning18 = '';
     $main_cat_id = $item->cat_id;
     $pathway = $app->getPathway();
     $cat_path = array();
     $cat_theme = '';
     if ($category->id != 0) {
         $cat_path = DJClassifiedsCategory::getParentPath(1, $category->id);
         $main_cat_id = $cat_path[count($cat_path) - 1]->id;
         for ($c = count($cat_path); $c > 0; $c--) {
             $to_b = 1;
             if (count($cat_menu_path)) {
                 foreach ($cat_menu_path as $cm) {
                     if ($cm->id == $cat_path[$c - 1]->id) {
                         $to_b = 0;
                         break;
                     }
                 }
             }
             if ($to_b) {
                 $pathway->addItem($cat_path[$c - 1]->name, DJClassifiedsSEO::getCategoryRoute($cat_path[$c - 1]->id . ':' . $cat_path[$c - 1]->alias));
             }
         }
         foreach ($cat_path as $cp) {
             if ($cp->theme) {
                 $cat_theme = $cp->theme;
             }
             if ($cp->restriction_18) {
                 $warning18 = 1;
             }
         }
     }
     DJClassifiedsTheme::includeCSSfiles($cat_theme);
     if ($cat_theme) {
         $this->_addPath('template', JPATH_COMPONENT . '/themes/' . $cat_theme . '/views/item');
         $theme = $cat_theme;
     }
     $regions = $model->getRegions();
     $country = '';
     $city = '';
     $region_name = '';
     if ($item->region_id != 0 && $par->get('show_regions', '1')) {
         $address = '';
         $rid = $item->region_id;
         if ($rid != 0) {
             while ($rid != 0) {
                 foreach ($regions as $li) {
                     if ($li->id == $rid) {
                         $rid = $li->parent_id;
                         $address .= $li->name . ', ';
                         if ($li->country) {
                             $country = $li->name;
                         }
                         if ($li->city) {
                             $city = $li->name;
                         }
                         if (!$region_name) {
                             $region_name = $li->name;
                         }
                         break;
                     }
                 }
                 if ($rid == $item->region_id) {
                     break;
                 }
             }
         }
         $address = substr($address, 0, -2);
     }
     $profile = '';
     if ($item->user_id) {
         $profile = $model->getProfile($item->user_id);
     }
     $custom_ask_seller = $model->getCustomAskSellerFields();
     if ($item->metakey != '') {
         $document->setMetaData('keywords', $item->metakey);
     } else {
         if ($category->metakey != '') {
             $document->setMetaData('keywords', $category->metakey);
         } else {
             if ($m_active) {
                 if ($m_active->params->get('menu-meta_description')) {
                     $document->setMetaData('keywords', $m_active->params->get('menu-meta_description'));
                 }
             }
         }
     }
     if ($item->metadesc != '') {
         $document->setDescription($item->metadesc);
     } else {
         if ($par->get('seo_item_metadesc', '0') == 0) {
             $document->setDescription($item->intro_desc);
         } else {
             if ($category->metadesc != '') {
                 $document->setDescription($category->metadesc);
             } else {
                 if ($m_active) {
                     if ($m_active->params->get('menu-meta_keywords')) {
                         $document->setDescription($m_active->params->get('menu-meta_keywords'));
                     }
                 }
             }
         }
     }
     $c_title = $document->getTitle();
     $cat_name = $category->name;
     $item_name = $item->name;
     $seo_cat_path = '';
     $seo_title_separator = $par->get('seo_title_separator', ' - ');
     foreach ($cat_path as $cp) {
         if ($seo_cat_path) {
             $seo_cat_path .= $seo_title_separator;
         }
         $seo_cat_path .= $cp->name;
     }
     $seo_title_from = array('|', '<default_title>', '<category_name>', '<category_path>', '<item_name>', '<region_name>');
     $seo_title_to = array($seo_title_separator, $c_title, $cat_name, $seo_cat_path, $item_name, $region_name);
     $seo_title = str_ireplace($seo_title_from, $seo_title_to, $par->get('seo_title_item', '<item_name>|<category_name>|<default_title>'));
     $document->setTitle($seo_title);
     $document->setMetaData('og:title', $item->name);
     $document->setMetaData('og:description', $item->intro_desc);
     if ($item_images) {
         $document->setMetaData('og:image', JURI::base() . $item_images[0]->thumb_b);
     }
     if ($par->get('comments', '0') == 1 && $par->get('fb_comments_admin', '') != '') {
         $document->addCustomTag('<meta property="fb:admins" content="' . $par->get('fb_comments_admin', '') . '" />');
     }
     $anch = $par->get('showitem_jump', 0) ? '#dj-classifieds' : '';
     $correct_link = JRoute::_(DJClassifiedsSEO::getItemRoute($item->id . ':' . $item->alias, $item->cat_id . ':' . $item->c_alias)) . $anch;
     $document->setMetaData('canonical', $correct_link);
     /* plugins */
     if ($category) {
         $item->c_alias = $category->alias;
     }
     $results = $dispatcher->trigger('onPrepareItemDescription', array(&$item, &$par, 'item'));
     $item->event = new stdClass();
     $resultsAfterTitle = $dispatcher->trigger('onAfterDJClassifiedsDisplayTitle', array(&$item, &$par, 'item'));
     $item->event->afterDJClassifiedsDisplayTitle = trim(implode("\n", $resultsAfterTitle));
     $resultsBeforeContent = $dispatcher->trigger('onBeforeDJClassifiedsDisplayContent', array(&$item, &$par, 'item'));
     $item->event->beforeDJClassifiedsDisplayContent = trim(implode("\n", $resultsBeforeContent));
     $resultsAfterContent = $dispatcher->trigger('onAfterDJClassifiedsDisplayContent', array(&$item, &$par, 'item'));
     $item->event->afterDJClassifiedsDisplayContent = trim(implode("\n", $resultsAfterContent));
     $resultsAfterAuthorProfile = $dispatcher->trigger('onAfterDJClassifiedsDisplayAdvertAuthor', array(&$item, &$par, 'item'));
     $item->event->onAfterDJClassifiedsDisplayAdvertAuthor = trim(implode("\n", $resultsAfterAuthorProfile));
     $pathway->addItem($item->name);
     $this->assignRef('item', $item);
     $this->assignRef('item_images', $item_images);
     $this->assignRef('item_options', $item_options);
     $this->assignRef('fields', $fields);
     $this->assignRef('fields_contact', $fields_contact);
     $this->assignRef('country', $country);
     $this->assignRef('city', $city);
     $this->assignRef('address', $address);
     $this->assignRef('main_cat_id', $main_cat_id);
     $this->assignRef('item_payments', $item_payments);
     $this->assignRef('category', $category);
     $this->assignRef('profile', $profile);
     $this->assignRef('theme', $theme);
     $this->assignRef('bids', $bids);
     $this->assignRef('custom_ask_seller', $custom_ask_seller);
     if ($warning18 && !isset($_COOKIE["djcf_warning18"])) {
         $warning18_link = '';
         if ($par->get('restriction_18_art_id', 0)) {
             require_once JPATH_SITE . '/components/com_content/helpers/route.php';
             $terms_article = $model->getTermsLink($par->get('restriction_18_art_id', 0));
             if ($terms_article) {
                 $slug = $terms_article->id . ':' . $terms_article->alias;
                 $cslug = $terms_article->catid . ':' . $terms_article->c_alias;
                 $warning18_link = ContentHelperRoute::getArticleRoute($slug, $cslug);
                 if ($par->get('restriction_18_art', 0) == 2) {
                     $warning18_link .= '&tmpl=component';
                 }
                 $warning18_link = JRoute::_($warning18_link);
             }
         }
         $this->assignRef('terms_link', $warning18_link);
         parent::display('terms');
     } else {
         parent::display($tpl);
     }
 }
Beispiel #15
0
 function delBid()
 {
     header("Content-type: text/html; charset=utf-8");
     $app = JFactory::getApplication();
     $id = JRequest::getInt('id', 0);
     $cid = JRequest::getInt('cid', 0);
     $bid = JRequest::getFloat('bid', 0);
     $db = JFactory::getDBO();
     $user = JFactory::getUser();
     $itemid = JRequest::getVar('Itemid');
     $par = JComponentHelper::getParams('com_djclassifieds');
     $m_type = '';
     $query = "SELECT i.*, c.name as c_name, c.alias as c_alias FROM #__djcf_items i " . "LEFT JOIN #__djcf_categories c ON c.id=i.cat_id " . "WHERE i.id = " . $id . " ";
     $db->setQuery($query);
     $item = $db->loadObject();
     if (!$item->alias) {
         $item->alias = DJClassifiedsSEO::getAliasName($item->name);
     }
     if (!$item->c_alias) {
         $item->c_alias = DJClassifiedsSEO::getAliasName($item->c_name);
     }
     $link = DJClassifiedsSEO::getItemRoute($item->id . ':' . $item->alias, $item->cat_id . ':' . $item->c_alias);
     if ($user->id > 0) {
         if ($item) {
             if ($item->user_id == $user->id && $item->user_id > 0) {
                 $query = "DELETE FROM #__djcf_auctions WHERE item_id = " . $item->id . " AND id=" . $bid;
                 $db->setQuery($query);
                 $db->query();
                 $price_start = $item->price_start;
                 $query = "SELECT a.* FROM #__djcf_auctions a " . " WHERE a.item_id=" . $item->id . " ORDER BY a.date DESC LIMIT 1";
                 $db->setQuery($query);
                 $last_bid = $db->loadObject();
                 if ($last_bid) {
                     $price_start = $last_bid->price;
                 }
                 $query = "UPDATE #__djcf_items SET price='" . $price_start . "' " . " WHERE id=" . $item->id;
                 $db->setQuery($query);
                 $db->query();
                 $msg = JText::_('COM_DJCLASSIFIEDS_BID_DELETED');
             } else {
                 $msg = JText::_('COM_DJCLASSIFIEDS_WRONG_AD');
                 $m_type = 'error';
             }
         } else {
             $msg = JText::_('COM_DJCLASSIFIEDS_WRONG_AD');
             $m_type = 'error';
         }
     } else {
         $msg = JText::_('COM_DJCLASSIFIEDS_PLEASE_LOGIN');
         $m_type = 'error';
     }
     $link = JRoute::_($link);
     $app->redirect($link, $msg, $m_type);
     die('aaaa');
 }
Beispiel #16
0
 public function getContentPermalink()
 {
     $link = DJClassifiedsSEO::getItemRoute($this->_item->id . ':' . urlencode($this->_item->alias), $this->_item->cat_id . ':' . urlencode($this->_item->category_alias));
     if (JFactory::getApplication()->isSite()) {
         $link = urldecode(JRoute::_($link));
     }
     $link = $this->prepareLink($link);
     return $link;
 }
Beispiel #17
0
 function save()
 {
     $app = JFactory::getApplication();
     JTable::addIncludePath(JPATH_COMPONENT_ADMINISTRATOR . DS . 'tables');
     jimport('joomla.database.table');
     JPluginHelper::importPlugin('djclassifieds');
     $row = JTable::getInstance('Items', 'DJClassifiedsTable');
     $par = JComponentHelper::getParams('com_djclassifieds');
     $user = JFactory::getUser();
     $lang = JFactory::getLanguage();
     $dispatcher = JDispatcher::getInstance();
     $db = JFactory::getDBO();
     $id = JRequest::getVar('id', 0, '', 'int');
     $token = JRequest::getCMD('token', '');
     $redirect = '';
     $menus = $app->getMenu('site');
     $menu_item = $menus->getItems('link', 'index.php?option=com_djclassifieds&view=items&cid=0', 1);
     $menu_item_blog = $menus->getItems('link', 'index.php?option=com_djclassifieds&view=items&layout=blog&cid=0', 1);
     $itemid = '';
     if ($menu_item) {
         $itemid = '&Itemid=' . $menu_item->id;
     } else {
         if ($menu_item_blog) {
             $itemid = '&Itemid=' . $menu_item_blog->id;
         }
     }
     $menu_newad_itemid = $menus->getItems('link', 'index.php?option=com_djclassifieds&view=additem', 1);
     $new_ad_link = 'index.php?option=com_djclassifieds&view=additem';
     if ($menu_newad_itemid) {
         $new_ad_link .= '&Itemid=' . $menu_newad_itemid->id;
     }
     $new_ad_link = JRoute::_($new_ad_link);
     if ($user->id == 0 && $id > 0) {
         $message = JText::_('COM_DJCLASSIFIEDS_WRONG_AD');
         //$redirect="index.php?option=com_djclassifieds&view=items&cid=0".$itemid;
         $redirect = DJClassifiedsSEO::getCategoryRoute('0:all');
         $redirect = JRoute::_($redirect);
         $app->redirect($redirect, $message, 'error');
     }
     $db = JFactory::getDBO();
     if ($id > 0) {
         $query = "SELECT user_id FROM #__djcf_items WHERE id='" . $id . "' LIMIT 1";
         $db->setQuery($query);
         $item_user_id = $db->loadResult();
         if ($item_user_id != $user->id) {
             $message = JText::_('COM_DJCLASSIFIEDS_WRONG_AD');
             $redirect = DJClassifiedsSEO::getCategoryRoute('0:all');
             $redirect = JRoute::_($redirect);
             $app->redirect($redirect, $message, 'error');
         }
     }
     if ($par->get('user_type') == 1 && $user->id == '0') {
         //$uri = "index.php?option=com_djclassifieds&view=items&cid=0".$itemid;
         $uri = DJClassifiedsSEO::getCategoryRoute('0:all');
         $app->redirect('index.php?option=com_users&view=login&return=' . base64_encode($uri), JText::_('COM_DJCLASSIFIEDS_PLEASE_LOGIN'));
     }
     $row->bind(JRequest::get('post'));
     if ($token && !$user->id && !$id) {
         $query = "SELECT i.id FROM #__djcf_items i " . "WHERE i.user_id=0 AND i.token=" . $db->Quote($db->escape($token));
         $db->setQuery($query);
         $ad_id = $db->loadResult();
         if ($ad_id) {
             $row->id = $ad_id;
         } else {
             $uri = DJClassifiedsSEO::getCategoryRoute('0:all');
             $app->redirect('index.php?option=com_users&view=login&return=' . base64_encode($uri), JText::_('COM_DJCLASSIFIEDS_WRONG_TOKEN'));
         }
     }
     $dispatcher->trigger('onAfterInitialiseDJClassifiedsSaveAdvert', array(&$row, &$par));
     if ($par->get('title_char_limit', '0') > 0) {
         $row->name = mb_substr($row->name, 0, $par->get('title_char_limit', '100'), "UTF-8");
     }
     if ((int) $par->get('allow_htmltags', '0')) {
         $row->description = JRequest::getVar('description', '', 'post', 'string', JREQUEST_ALLOWRAW);
         $allowed_tags = explode(';', $par->get('allowed_htmltags', ''));
         $a_tags = '';
         for ($a = 0; $a < count($allowed_tags); $a++) {
             $a_tags .= '<' . $allowed_tags[$a] . '>';
         }
         $row->description = strip_tags($row->description, $a_tags);
     } else {
         $row->description = nl2br(JRequest::getVar('description', '', 'post', 'string'));
     }
     $row->intro_desc = mb_substr(strip_tags(nl2br($row->intro_desc)), 0, $par->get('introdesc_char_limit', '120'), "UTF-8");
     if (!$row->intro_desc) {
         $row->intro_desc = mb_substr(strip_tags($row->description), 0, $par->get('introdesc_char_limit', '120'), "UTF-8");
     }
     $row->contact = nl2br(JRequest::getVar('contact', '', 'post', 'string'));
     $row->price_negotiable = JRequest::getInt('price_negotiable', '0');
     $row->bid_min = str_ireplace(',', '.', JRequest::getVar('bid_min', '', 'post', 'string'));
     $row->bid_max = str_ireplace(',', '.', JRequest::getVar('bid_max', '', 'post', 'string'));
     $row->price_reserve = str_ireplace(',', '.', JRequest::getVar('price_reserve', '', 'post', 'string'));
     if (!$id && !$token && !$user->id && $par->get('guest_can_edit', 0)) {
         $characters = '1234567890ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz';
         $row->token = '';
         for ($p = 0; $p < 20; $p++) {
             $row->token .= $characters[mt_rand(0, strlen($characters))];
         }
     }
     /*
     	//removing images from folder and from database
     	$path = JPATH_BASE."/components/com_djclassifieds/images/";
     $images = $row->image_url;
     		if(isset($_POST['del_img'])){			
     			$del_image = $_POST['del_img'];	
     		}else{
     			$del_image = array();
     		}    
     
     
     for ($i = 0; $i < count($del_image); $i++){
     
         $images = str_replace($del_image[$i].';', '', $images);
         //deleting the main image
         if (JFile::exists($path.$del_image[$i])){
             JFile::delete($path.$del_image[$i]);
         }
         //deleting thumbnail of image
     		if (JFile::exists($path.$del_image[$i].'.thb.jpg')){
             JFile::delete($path.$del_image[$i].'.thb.jpg');
         }
         if (JFile::exists($path.$del_image[$i].'.th.jpg')){
             JFile::delete($path.$del_image[$i].'.th.jpg');
         }
     		if (JFile::exists($path.$del_image[$i].'.thm.jpg')){
             JFile::delete($path.$del_image[$i].'.thm.jpg');
         }
         if (JFile::exists($path.$del_image[$i].'.ths.jpg')){
             JFile::delete($path.$del_image[$i].'.ths.jpg');
         }
     }
     
      
     //add images
     $new_files = $_FILES['image'];
     if(count($new_files['name'])>0 && $row->id==0){			
     		$query = "SELECT id FROM #__djcf_items ORDER BY id DESC LIMIT 1";
     		$db->setQuery($query);
     		$last_id =$db->loadResult();
     		$last_id++;
     	}else{
     		$last_id= $row->id;
     	}
     	
     	$nw = (int)$par->get('th_width',-1);
     $nh = (int)$par->get('th_height',-1);
     	$nws = $par->get('smallth_width',-1);
     $nhs = $par->get('smallth_height',-1);
     	$nwm = $par->get('middleth_width',-1);
     $nhm = $par->get('middleth_height',-1);			
     	$nwb = $par->get('bigth_width',-1);
     $nhb = $par->get('bigth_height',-1);		
     	$img_maxsize = $par->get('img_maxsize',0);		
     		if($img_maxsize>0){
     			$img_maxsize = $img_maxsize*1024*1024;
     		}
     	
     	$lang = JFactory::getLanguage();
     for ($i = 0; $i < count($new_files['name']); $i++)
     {
         if (substr($new_files['type'][$i], 0, 5) == "image")
         {
        			if($img_maxsize>0 && $new_files['size'][$i]>$img_maxsize){
        				$app->enqueueMessage(JText::_('COM_DJCLASSIFIEDS_TO_BIG_IMAGE').' : \''.$new_files['name'][$i].'\'','error');
     				continue;
     			}
     			if(!getimagesize($new_files['tmp_name'][$i])){
     				$app->enqueueMessage(JText::_('COM_DJCLASSIFIEDS_WRONG_IMAGE_TYPE').' : \''.$new_files['name'][$i].'\'','error');
     				continue;
     			}				
     			$n_name = $last_id.'_'.$new_files['name'][$i];    				
     			$n_name = $lang->transliterate($n_name);
     			$n_name = strtolower($n_name);
     			$n_name = JFile::makeSafe($n_name);
     			        	
         	$new_path = JPATH_BASE."/components/com_djclassifieds/images/".$n_name;
     			$nimg= 0;			
     			while(JFile::exists($new_path)){
     				$nimg++;
     			$n_name = $last_id.'_'.$nimg.'_'.$new_files['name'][$i];
     					$n_name = $lang->transliterate($n_name);
     					$n_name = strtolower($n_name);
     					$n_name = JFile::makeSafe($n_name);            	
         		$new_path = JPATH_BASE."/components/com_djclassifieds/images/".$n_name;
     			}
     			$images .= $n_name.';';
         	move_uploaded_file($new_files['tmp_name'][$i], $new_path);
     			//DJClassifiedsImage::makeThumb($new_path, $nw, $nh, 'th');
     			 	DJClassifiedsImage::makeThumb($new_path, $nws, $nhs, 'ths');
     				DJClassifiedsImage::makeThumb($new_path, $nwm, $nhm, 'thm');
     				DJClassifiedsImage::makeThumb($new_path, $nwb, $nhb, 'thb');
         }else if($new_files['name'][$i]){
     			$app->enqueueMessage(JText::_('COM_DJCLASSIFIEDS_WRONG_IMAGE_TYPE').' : \''.$new_files['name'][$i].'\'','error');	        	
         }
     }
     	
     $row->image_url = $images;
     */
     $row->image_url = '';
     $duration_price = 0;
     if ($row->id == 0) {
         if ($par->get('durations_list', '')) {
             $exp_days = JRequest::getVar('exp_days', $par->get('exp_days'), '', 'int');
             $query = "SELECT * FROM #__djcf_days WHERE days = " . $exp_days;
             $db->setQuery($query);
             $duration = $db->loadObject();
             if ($duration) {
                 $duration_price = $duration->price;
             } else {
                 //$exp_days = $par->get('exp_days','7');
                 $message = JText::_('COM_DJCLASSIFIEDS_WRONG_DURATION_LIMIT');
                 $app->redirect($new_ad_link, $message, 'error');
             }
         } else {
             $exp_days = $par->get('exp_days', '7');
         }
         if ($exp_days == 0) {
             $row->date_exp = "2038-01-01 00:00:00";
         } else {
             $row->date_exp = date("Y-m-d G:i:s", mktime(date("G"), date("i"), date("s"), date("m"), date("d") + $exp_days, date("Y")));
         }
         if ($row->date_exp == '1970-01-01 1:00:00') {
             $row->date_exp = '2038-01-19 00:00:00';
         }
         $row->exp_days = $exp_days;
         $row->date_start = date("Y-m-d H:i:s");
     }
     $row->cat_id = end($_POST['cats']);
     if (!$row->cat_id) {
         $row->cat_id = $_POST['cats'][count($_POST['cats']) - 2];
     }
     $row->cat_id = str_ireplace('p', '', $row->cat_id);
     /*if($par->get('region_add_type','1')){
     			$g_area = JRequest::getVar('g_area','');
     			$g_locality = JRequest::getVar('g_locality','');
     			$g_country = JRequest::getVar('g_country','');			
     			$latlong = str_ireplace(array('(',')'), array('',''), JRequest::getVar('latlong',''));
     			
     				$query = "SELECT id FROM #__djcf_regions WHERE name = '".$g_area."'";	
     				$db->setQuery($query);
     				$parent_r_id = $db->loadResult();
     				
     				if($parent_r_id){					
     					$query = "SELECT id FROM #__djcf_regions WHERE name = '".$g_locality."' AND parent_id=".$parent_r_id;	
     					$db->setQuery($query);
     					$region_id = $db->loadResult();
     					
     					if($region_id){
     						$row->region_id=$region_id;
     					}else{					
     						$region_row = &JTable::getInstance('Regions', 'DJClassifiedsTable');
     							$region_row->country=0;
     							$region_row->city=1;
     							$region_row->name=$g_locality;
     							$region_row->parent_id=$parent_r_id;
     													
     							//$ll = explode(',', $latlong);
     							//$region_row->latitude=$ll[0];
     							//$region_row->longitude=$ll[0];	
     							$region_row->published=1;
     							//echo '<pre>';print_r($region_row);die();							
     							if (!$region_row->store()){
     				        		exit ();	
     				    		}
     						$row->region_id=$region_row->id;	
     					}
     				}else{
     					$query = "SELECT id FROM #__djcf_regions WHERE name = '".$g_country."' ";	
     					$db->setQuery($query);
     					$country_id = $db->loadResult();
     					
     					if(!$country_id){$country_id=0;}
     					
     					$area_row = &JTable::getInstance('Regions', 'DJClassifiedsTable');
     						$area_row->country=0;
     						$area_row->city=0;
     						$area_row->name=$g_area;
     						$area_row->parent_id=$country_id;
     						$area_row->published=1;
     						//echo '<pre>';print_r($region_row);die();							
     						if (!$area_row->store()){
     			        		exit ();	
     			    		}
     					
     					$region_row = &JTable::getInstance('Regions', 'DJClassifiedsTable');
     						$region_row->country=0;
     						$region_row->city=1;
     						$region_row->name=$g_locality;
     						$region_row->parent_id=$area_row->id;
     												
     						//$ll = explode(',', $latlong);
     						//$region_row->latitude=$ll[0];
     						//$region_row->longitude=$ll[0];
     						$region_row->published=1;		
     						//echo '<pre>';print_r($region_row);die();							
     						if (!$region_row->store()){
     			        		exit ();	
     			    		}
     					$row->region_id=$region_row->id;	
     					
     				} 						
     		}else{*/
     $row->region_id = end($_POST['regions']);
     if (!$row->region_id) {
         $row->region_id = $_POST['regions'][count($_POST['regions']) - 2];
     }
     //}
     if (($row->region_id || $row->address) && ($row->latitude == '0.000000000000000' && $row->longitude == '0.000000000000000' || !$row->latitude && !$row->longitude)) {
         $address = '';
         if ($row->region_id) {
             $reg_path = DJClassifiedsRegion::getParentPath($row->region_id);
             for ($r = count($reg_path) - 1; $r >= 0; $r--) {
                 if ($reg_path[$r]->country) {
                     $address = $reg_path[$r]->name;
                 }
                 if ($reg_path[$r]->city) {
                     if ($address) {
                         $address .= ', ';
                     }
                     $address .= $reg_path[$r]->name;
                 }
             }
         }
         if ($address) {
             $address .= ', ';
         }
         $address .= $row->address;
         if ($row->post_code) {
             $address .= ', ' . $row->post_code;
         }
         $loc_coord = DJClassifiedsGeocode::getLocation($address);
         if (is_array($loc_coord)) {
             $row->latitude = $loc_coord['lat'];
             $row->longitude = $loc_coord['lng'];
         }
     }
     //echo '<pre>';print_r($row);die();
     $row->user_id = $user->id;
     $row->ip_address = $_SERVER['REMOTE_ADDR'];
     $row->promotions = '';
     if ($par->get('promotion', '1') == '1') {
         $query = "SELECT p.* FROM #__djcf_promotions p WHERE p.published=1 ORDER BY p.id ";
         $db->setQuery($query);
         $promotions = $db->loadObjectList();
         foreach ($promotions as $prom) {
             if (JRequest::getVar($prom->name, '0')) {
                 $row->promotions .= $prom->name . ',';
             }
         }
         if ($row->promotions) {
             $row->promotions = substr($row->promotions, 0, -1);
         }
     } else {
         if ($row->id > 0) {
             $row->promotions = $old_row->promotions;
         }
     }
     if (strstr($row->promotions, 'p_first')) {
         $row->special = 1;
     } else {
         $row->special = 0;
     }
     $cat = '';
     if ($row->cat_id) {
         $query = "SELECT name,alias,price,autopublish FROM #__djcf_categories WHERE id = " . $row->cat_id;
         $db->setQuery($query);
         $cat = $db->loadObject();
         if (!$cat->alias) {
             $cat->alias = DJClassifiedsSEO::getAliasName($cat->name);
         }
     }
     $is_new = 1;
     if ($row->id > 0) {
         $query = "SELECT * FROM #__djcf_items WHERE id = " . $row->id;
         $db->setQuery($query);
         $old_row = $db->loadObject();
         $query = "DELETE FROM #__djcf_fields_values WHERE item_id= " . $row->id . " ";
         $db->setQuery($query);
         $db->query();
         $query = "DELETE FROM #__djcf_fields_values_sale WHERE item_id= " . $row->id . " ";
         $db->setQuery($query);
         $db->query();
         $row->payed = $old_row->payed;
         $row->pay_type = $old_row->pay_type;
         $row->exp_days = $old_row->exp_days;
         $row->alias = $old_row->alias;
         $row->published = $old_row->published;
         $is_new = 0;
     }
     if (!$row->alias) {
         $row->alias = DJClassifiedsSEO::getAliasName($row->name);
     }
     $dispatcher->trigger('onBeforePaymentsDJClassifiedsSaveAdvert', array(&$row, $is_new, &$cat, &$promotions));
     if ($cat->autopublish == '0') {
         if ($par->get('autopublish') == '1') {
             $row->published = 1;
             if ($row->id) {
                 $message = JText::_('COM_DJCLASSIFIEDS_AD_SAVED_SUCCESSFULLY');
             } else {
                 $message = JText::_('COM_DJCLASSIFIEDS_AD_ADDED_SUCCESSFULLY');
             }
         } else {
             $row->published = 0;
             if ($row->id) {
                 $message = JText::_('COM_DJCLASSIFIEDS_AD_SAVED_SUCCESSFULLY_WAITING_FOR_PUBLISH');
             } else {
                 $message = JText::_('COM_DJCLASSIFIEDS_AD_ADDED_SUCCESSFULLY_WAITING_FOR_PUBLISH');
             }
             //$redirect="index.php?option=com_djclassifieds&view=items&cid=0".$itemid;
             $redirect = DJClassifiedsSEO::getItemRoute($row->id . ':' . $row->alias, $row->cat_id . ':' . $i->c_alias);
         }
     } elseif ($cat->autopublish == '1') {
         $row->published = 1;
         if ($row->id) {
             $message = JText::_('COM_DJCLASSIFIEDS_AD_SAVED_SUCCESSFULLY');
         } else {
             $message = JText::_('COM_DJCLASSIFIEDS_AD_ADDED_SUCCESSFULLY');
         }
     } elseif ($cat->autopublish == '2') {
         $row->published = 0;
         if ($row->id) {
             $message = JText::_('COM_DJCLASSIFIEDS_AD_SAVED_SUCCESSFULLY_WAITING_FOR_PUBLISH');
         } else {
             $message = JText::_('COM_DJCLASSIFIEDS_AD_ADDED_SUCCESSFULLY_WAITING_FOR_PUBLISH');
         }
         $redirect = DJClassifiedsSEO::getCategoryRoute('0:all');
     }
     $pay_redirect = 0;
     $row->pay_type = '';
     $row->payed = 1;
     //echo '<pre>';print_r($old_row);print_r($row);die();
     if (isset($old_row)) {
         if ($cat->price == 0 && $row->promotions == '' && !strstr($old_row->pay_type, 'duration')) {
             $row->payed = 1;
             $row->pay_type = '';
         } else {
             if ($old_row->cat_id != $row->cat_id && $cat->price > 0 || $old_row->promotions != $row->promotions || strstr($old_row->pay_type, 'duration') || $old_row->pay_type) {
                 $row->pay_type = '';
                 if ($old_row->cat_id != $row->cat_id && $cat->price > 0) {
                     $row->pay_type = 'cat,';
                 } else {
                     if ($old_row->cat_id == $row->cat_id && $cat->price > 0 && strstr($old_row->pay_type, 'cat')) {
                         $row->pay_type = 'cat,';
                     }
                 }
                 //if($old_row->promotions!=$row->promotions){
                 $prom_new = explode(',', $row->promotions);
                 for ($pn = 0; $pn < count($prom_new); $pn++) {
                     if (!strstr($old_row->promotions, $prom_new[$pn]) || strstr($old_row->pay_type, $prom_new[$pn])) {
                         $row->pay_type .= $prom_new[$pn] . ',';
                     }
                 }
                 //}
                 if (strstr($old_row->pay_type, 'duration')) {
                     $row->pay_type .= 'duration,';
                 }
                 if ($row->pay_type) {
                     $row->published = 0;
                     $row->payed = 0;
                     $pay_redirect = 1;
                 }
                 //echo $row->pay_type;print_r($old_row);
                 //print_r($row);echo $pay_redirect;die();
             } else {
                 if ($row->payed == 0 && ($cat->price > 0 || $row->promotions != '')) {
                     $row->payed = 0;
                     $row->published = 0;
                     $pay_redirect = 1;
                 }
             }
         }
     } else {
         if ($cat->price > 0 || $row->promotions != '' || $duration_price > 0) {
             if ($cat->price > 0) {
                 $row->pay_type .= 'cat,';
             }
             if ($duration_price > 0) {
                 $row->pay_type .= 'duration,';
             }
             if ($row->promotions != '') {
                 $row->pay_type .= $row->promotions;
             }
             $row->published = 0;
             $row->payed = 0;
             $pay_redirect = 1;
         } else {
             $row->payed = 1;
             $row->pay_type = '';
         }
     }
     //check for free promotions
     if (!strstr($row->pay_type, 'cat') && !strstr($row->pay_type, 'duration') && strstr($row->pay_type, 'p_')) {
         $prom_to_pay = explode(',', $row->pay_type);
         $prom_price = 0;
         for ($pp = 0; $pp < count($prom_to_pay); $pp++) {
             foreach ($promotions as $prom) {
                 if ($prom->name == $prom_to_pay[$pp]) {
                     $prom_price += $prom->price;
                 }
             }
         }
         if ($prom_price == 0) {
             $row->pay_type = '';
             $redirect = '';
             $pay_redirect = 0;
             if ($cat->autopublish == '0' && $par->get('autopublish') == '1' || $cat->autopublish == '1') {
                 $row->published = 1;
             }
         }
     }
     //echo '<pre>';print_r($row);die();echo '</pre>';
     $dispatcher->trigger('onBeforeDJClassifiedsSaveAdvert', array(&$row, $is_new));
     if (!$row->store()) {
         //echo $row->getError();exit ();
     }
     if ($is_new) {
         $query = "UPDATE #__djcf_items SET date_sort=date_start WHERE id=" . $row->id . " ";
         $db->setQuery($query);
         $db->query();
     }
     $item_images = '';
     $images_c = 0;
     if (!$is_new) {
         $query = "SELECT * FROM #__djcf_images WHERE item_id=" . $row->id . " AND type='item' ";
         $db->setQuery($query);
         $item_images = $db->loadObjectList('id');
         $images_c = count($item_images);
     }
     $img_ids = JRequest::getVar('img_id', array(), 'post', 'array');
     $img_captions = JRequest::getVar('img_caption', array(), 'post', 'array');
     $img_images = JRequest::getVar('img_image', array(), 'post', 'array');
     $img_id_to_del = '';
     if ($item_images) {
         foreach ($item_images as $item_img) {
             $img_to_del = 1;
             foreach ($img_ids as $img_id) {
                 if ($item_img->id == $img_id) {
                     $img_to_del = 0;
                     break;
                 }
             }
             if ($img_to_del) {
                 $images_c--;
                 $path_to_delete = JPATH_ROOT . $item_img->path . $item_img->name;
                 if (JFile::exists($path_to_delete . '.' . $item_img->ext)) {
                     JFile::delete($path_to_delete . '.' . $item_img->ext);
                 }
                 if (JFile::exists($path_to_delete . '_ths.' . $item_img->ext)) {
                     JFile::delete($path_to_delete . '_ths.' . $item_img->ext);
                 }
                 if (JFile::exists($path_to_delete . '_thm.' . $item_img->ext)) {
                     JFile::delete($path_to_delete . '_thm.' . $item_img->ext);
                 }
                 if (JFile::exists($path_to_delete . '_thb.' . $item_img->ext)) {
                     JFile::delete($path_to_delete . '_thb.' . $item_img->ext);
                 }
                 $img_id_to_del .= $item_img->id . ',';
             }
         }
         if ($img_id_to_del) {
             $query = "DELETE FROM #__djcf_images WHERE item_id=" . $row->id . " AND type='item' AND ID IN (" . substr($img_id_to_del, 0, -1) . ") ";
             $db->setQuery($query);
             $db->query();
         }
     }
     $last_id = $row->id;
     $imglimit = $par->get('img_limit', '3');
     $nw = (int) $par->get('th_width', -1);
     $nh = (int) $par->get('th_height', -1);
     $nws = (int) $par->get('smallth_width', -1);
     $nhs = (int) $par->get('smallth_height', -1);
     $nwm = (int) $par->get('middleth_width', -1);
     $nhm = (int) $par->get('middleth_height', -1);
     $nwb = (int) $par->get('bigth_width', -1);
     $nhb = (int) $par->get('bigth_height', -1);
     $img_ord = 1;
     $img_to_insert = 0;
     $query_img = "INSERT INTO #__djcf_images(`item_id`,`type`,`name`,`ext`,`path`,`caption`,`ordering`) VALUES ";
     $new_img_path = JPATH_SITE . "/components/com_djclassifieds/images/item/";
     for ($im = 0; $im < count($img_ids); $im++) {
         if ($img_ids[$im]) {
             if ($item_images[$img_ids[$im]]->ordering != $img_ord || $item_images[$img_ids[$im]]->caption != $img_captions[$im]) {
                 $query = "UPDATE #__djcf_images SET ordering='" . $img_ord . "', caption='" . $db->escape($img_captions[$im]) . "' WHERE item_id=" . $row->id . " AND type='item' AND id=" . $img_ids[$im] . " ";
                 $db->setQuery($query);
                 $db->query();
             }
         } else {
             if ($images_c >= $imglimit) {
                 break;
             }
             $new_img_name = explode(';', $img_images[$im]);
             if (is_array($new_img_name)) {
                 $new_img_name_u = JPATH_ROOT . '/tmp/djupload/' . $new_img_name[0];
                 if (JFile::exists($new_img_name_u)) {
                     if (getimagesize($new_img_name_u)) {
                         $new_img_n = $last_id . '_' . str_ireplace(' ', '_', $new_img_name[1]);
                         $new_img_n = $lang->transliterate($new_img_n);
                         $new_img_n = strtolower($new_img_n);
                         $new_img_n = JFile::makeSafe($new_img_n);
                         $nimg = 0;
                         $name_parts = pathinfo($new_img_n);
                         $img_name = $name_parts['filename'];
                         $img_ext = $name_parts['extension'];
                         $new_path_check = $new_img_path . $new_img_n;
                         $new_path_check = str_ireplace('.' . $img_ext, '_thm.' . $img_ext, $new_path_check);
                         while (JFile::exists($new_path_check)) {
                             $nimg++;
                             $new_img_n = $last_id . '_' . $nimg . '_' . str_ireplace(' ', '_', $new_img_name[1]);
                             $new_img_n = $lang->transliterate($new_img_n);
                             $new_img_n = strtolower($new_img_n);
                             $new_img_n = JFile::makeSafe($new_img_n);
                             $new_path_check = $new_img_path . $new_img_n;
                             $new_path_check = str_ireplace('.' . $img_ext, '_thm.' . $img_ext, $new_path_check);
                         }
                         rename($new_img_name_u, $new_img_path . $new_img_n);
                         $name_parts = pathinfo($new_img_n);
                         $img_name = $name_parts['filename'];
                         $img_ext = $name_parts['extension'];
                         DJClassifiedsImage::makeThumb($new_img_path . $new_img_n, $new_img_path . $img_name . '_ths.' . $img_ext, $nws, $nhs);
                         DJClassifiedsImage::makeThumb($new_img_path . $new_img_n, $new_img_path . $img_name . '_thm.' . $img_ext, $nwm, $nhm);
                         DJClassifiedsImage::makeThumb($new_img_path . $new_img_n, $new_img_path . $img_name . '_thb.' . $img_ext, $nwb, $nhb);
                         $query_img .= "('" . $row->id . "','item','" . $img_name . "','" . $img_ext . "','/components/com_djclassifieds/images/item/','" . $db->escape($img_captions[$im]) . "','" . $img_ord . "'), ";
                         $img_to_insert++;
                         if ($par->get('store_org_img', '1') == 0) {
                             JFile::delete($new_img_path . $new_img_n);
                         }
                     }
                 }
             }
             $images_c++;
         }
         $img_ord++;
     }
     if ($img_to_insert) {
         $query_img = substr($query_img, 0, -2) . ';';
         $db->setQuery($query_img);
         $db->query();
     }
     $imgfreelimit = $par->get('img_free_limit', '-1');
     if ($imgfreelimit > -1 && $images_c > $imgfreelimit) {
         $extra_images = $images_c - $imgfreelimit;
         $images_to_pay = $extra_images;
         if (!$is_new) {
             if ($old_row->extra_images >= $images_to_pay) {
                 $images_to_pay = 0;
             } else {
                 $images_to_pay = $images_to_pay - $old_row->extra_images;
             }
         }
         $images_to_pay = $images_to_pay + $old_row->extra_images_to_pay;
         if ($images_to_pay > 0) {
             $row->extra_images = $extra_images;
             $row->extra_images_to_pay = $images_to_pay;
             $row->pay_type .= 'extra_img,';
             $row->published = 0;
             $row->payed = 0;
             $pay_redirect = 1;
             $row->store();
         }
     }
     $desc_chars_limit = $par->get('pay_desc_chars_free_limit', 0);
     $desc_c = strlen($row->description);
     if ($par->get('pay_desc_chars', 0) && $desc_c > $desc_chars_limit) {
         $extra_chars = $desc_c - $desc_chars_limit;
         $chars_to_pay = $extra_chars;
         if (!$is_new) {
             if ($old_row->extra_chars >= $chars_to_pay) {
                 $chars_to_pay = 0;
             } else {
                 $chars_to_pay = $chars_to_pay - $old_row->extra_chars;
             }
         }
         $chars_to_pay = $chars_to_pay + $old_row->extra_chars_to_pay;
         if ($chars_to_pay > 0) {
             $row->extra_chars = $extra_chars;
             $row->extra_chars_to_pay = $chars_to_pay;
             $row->pay_type .= 'extra_chars,';
             $row->published = 0;
             $row->payed = 0;
             $pay_redirect = 1;
             $row->store();
         }
     }
     $query = "SELECT f.* FROM #__djcf_fields f " . "LEFT JOIN #__djcf_fields_xref fx ON f.id=fx.field_id " . " WHERE fx.cat_id  = " . $row->cat_id . " OR f.source=1 ";
     $db->setQuery($query);
     $fields_list = $db->loadObjectList();
     //echo '<pre>'; print_r($db);print_r($fields_list);die();
     $a_tags_cf = '';
     if ((int) $par->get('allow_htmltags_cf', '0')) {
         $allowed_tags_cf = explode(';', $par->get('allowed_htmltags_cf', ''));
         for ($a = 0; $a < count($allowed_tags_cf); $a++) {
             $a_tags_cf .= '<' . $allowed_tags_cf[$a] . '>';
         }
     }
     $ins = 0;
     if (count($fields_list) > 0) {
         $query = "INSERT INTO #__djcf_fields_values(`field_id`,`item_id`,`value`,`value_date`) VALUES ";
         foreach ($fields_list as $fl) {
             if ($fl->type == 'checkbox') {
                 if (isset($_POST[$fl->name])) {
                     $field_v = $_POST[$fl->name];
                     $f_value = ';';
                     for ($fv = 0; $fv < count($field_v); $fv++) {
                         $f_value .= $field_v[$fv] . ';';
                     }
                     $query .= "('" . $fl->id . "','" . $row->id . "','" . $db->escape($f_value) . "',''), ";
                     $ins++;
                 }
             } else {
                 if ($fl->type == 'date') {
                     if (isset($_POST[$fl->name])) {
                         $f_var = JRequest::getVar($fl->name, '', '', 'string');
                         $query .= "('" . $fl->id . "','" . $row->id . "','','" . $db->escape($f_var) . "'), ";
                         $ins++;
                     }
                 } else {
                     if (isset($_POST[$fl->name])) {
                         if ($a_tags_cf) {
                             $f_var = JRequest::getVar($fl->name, '', '', 'string', JREQUEST_ALLOWRAW);
                             $f_var = strip_tags($f_var, $a_tags_cf);
                         } else {
                             $f_var = JRequest::getVar($fl->name, '', '', 'string');
                         }
                         $query .= "('" . $fl->id . "','" . $row->id . "','" . $db->escape($f_var) . "',''), ";
                         $ins++;
                     }
                 }
             }
         }
     }
     //print_r($query);die();
     if ($ins > 0) {
         $query = substr($query, 0, -2) . ';';
         $db->setQuery($query);
         $db->query();
     }
     $query = "SELECT f.* FROM #__djcf_fields f " . "LEFT JOIN #__djcf_fields_xref fx ON f.id=fx.field_id " . "WHERE fx.cat_id  = " . $row->cat_id . " AND f.in_buynow=1 ";
     $db->setQuery($query);
     $fields_list = $db->loadObjectList();
     //echo '<pre>'; print_r($_POST);print_r($fields_list);die();
     $ins = 0;
     if (count($fields_list) > 0) {
         $query = "INSERT INTO #__djcf_fields_values_sale(`item_id`,`quantity`,`options`) VALUES ";
         $bn_quantity = JRequest::getVar('bn-quantity', array());
         $quantity_total = 0;
         foreach ($fields_list as &$fl) {
             $fl->bn_values = JRequest::getVar('bn-' . $fl->name, array());
         }
         $bn_options = array();
         for ($q = 0; $q < count($bn_quantity); $q++) {
             if ($bn_quantity[$q] == '' || $bn_quantity[$q] == 0) {
                 continue;
             }
             $bn_option = array();
             $bn_option['quantity'] = $bn_quantity[$q];
             $bn_option['options'] = array();
             $quantity_total = $quantity_total + $bn_quantity[$q];
             foreach ($fields_list as &$fl) {
                 if ($fl->bn_values[$q]) {
                     $bn_opt = array();
                     $bn_opt['id'] = $fl->id;
                     $bn_opt['name'] = $fl->name;
                     $bn_opt['label'] = $fl->label;
                     $bn_opt['value'] = $fl->bn_values[$q];
                     $bn_option['options'][] = $bn_opt;
                 }
             }
             if (count($bn_option['options'])) {
                 $bn_options[] = $bn_option;
             }
         }
         if (count($bn_options)) {
             foreach ($bn_options as $opt) {
                 $query .= "('" . $row->id . "','" . $opt['quantity'] . "','" . $db->escape(json_encode($opt['options'])) . "'), ";
                 $ins++;
             }
             if ($ins) {
                 $query = substr($query, 0, -2) . ';';
                 $db->setQuery($query);
                 $db->query();
                 $query = "UPDATE #__djcf_items SET quantity=" . $quantity_total . " WHERE id=" . $row->id . " ";
                 $db->setQuery($query);
                 $db->query();
             }
         }
     }
     if ($par->get('notify_admin', '0')) {
         if ($id > 0) {
             $new_ad = 0;
         } else {
             $new_ad = 1;
         }
         if ($par->get('notify_admin', '0') == 1) {
             DJClassifiedsNotify::notifyAdmin($row, $cat, $new_ad);
         } else {
             if ($par->get('notify_admin', '0') == 2 && $id == 0) {
                 DJClassifiedsNotify::notifyAdmin($row, $cat, $new_ad);
             }
         }
     }
     if ($id == 0 && $par->get('user_new_ad_email', '0') && ($user->id > 0 || $par->get('email_for_guest', '0') && $row->email)) {
         DJClassifiedsNotify::notifyNewAdvertUser($row, $cat);
     }
     $dispatcher->trigger('onAfterDJClassifiedsSaveAdvert', array(&$row, $is_new));
     if ($pay_redirect == 1) {
         $menu_uads_itemid = $menus->getItems('link', 'index.php?option=com_djclassifieds&view=useritems', 1);
         $redirect = 'index.php?option=com_djclassifieds&view=payment&id=' . $row->id;
         if ($menu_uads_itemid) {
             $redirect .= '&Itemid=' . $menu_uads_itemid->id;
         }
         //$redirect= 'index.php?option=com_djclassifieds&view=payment&id='.$row->id.$itemid;
         if ($row->id) {
             $message = JTExt::_('COM_DJCLASSIFIEDS_AD_SAVED_SUCCESSFULLY_CHOOSE_PAYMENT');
         } else {
             $message = JTExt::_('COM_DJCLASSIFIEDS_AD_ADDED_SUCCESSFULLY_CHOOSE_PAYMENT');
         }
     }
     if (!$redirect) {
         //$redirect= 'index.php?option=com_djclassifieds&view=item&cid='.$row->cat_id.'&id='.$row->id.$itemid;
         $redirect = DJClassifiedsSEO::getItemRoute($row->id . ':' . $row->alias, $row->cat_id . ':' . $cat->alias);
     }
     $redirect = JRoute::_($redirect, false);
     $app->redirect($redirect, $message);
 }
Beispiel #18
0
 function payPoints()
 {
     $app = JFactory::getApplication();
     $par = JComponentHelper::getParams('com_djclassifieds');
     $user = JFactory::getUser();
     $db = JFactory::getDBO();
     $id = JRequest::getInt('id', 0);
     $type = JRequest::getVar('type', '');
     $menus = $app->getMenu('site');
     $query = "SELECT i.*, c.points as c_points, c.autopublish as c_autopublish, c.alias as c_alias FROM #__djcf_items i " . "LEFT JOIN #__djcf_categories c ON c.id=i.cat_id " . "WHERE i.id=" . $id . " LIMIT 1";
     $db->setQuery($query);
     $item = $db->loadObject();
     $redirect_a = 0;
     if (!$item && $type != 'plan') {
         $redirect_a = 1;
         $message = JText::_('COM_DJCLASSIFIEDS_WRONG_AD');
     }
     if ($item->user_id != $user->id && $type != 'plan') {
         $redirect_a = 1;
         $message = JText::_('COM_DJCLASSIFIEDS_WRONG_AD');
     }
     if ($user->id == 0) {
         $redirect_a = 1;
         $message = JText::_('COM_DJCLASSIFIEDS_PLEASE_LOGIN');
     }
     if ($redirect_a) {
         $redirect = "index.php?option=com_djclassifieds&view=items&cid=0";
         $redirect = JRoute::_($redirect, false);
         $app->redirect($redirect, $message);
     }
     $query = "SELECT SUM(p.points)FROM #__djcf_users_points p " . "WHERE p.user_id='" . $user->id . "' ";
     $db->setQuery($query);
     $points_count = $db->loadResult();
     $p_amount = 0;
     if ($type == 'plan') {
         $query = "SELECT p.*  FROM #__djcf_plans p WHERE p.id='" . $id . "' ";
         $db->setQuery($query);
         $plan = $db->loadObject();
         if ($plan) {
             $p_amount = $plan->points;
             if ($points_count >= $p_amount) {
                 $registry = new JRegistry();
                 $registry->loadString($plan->params);
                 $plan_params = $registry->toObject();
                 //echo '<pre>';print_r($plan_params);die();
                 $date_start = date("Y-m-d H:i:s");
                 $date_exp = '';
                 if ($plan_params->days_limit) {
                     $date_exp_time = time() + $plan_params->days_limit * 24 * 60 * 60;
                     $date_exp = date("Y-m-d H:i:s", $date_exp_time);
                 }
                 $query = "INSERT INTO #__djcf_plans_subscr (`user_id`,`plan_id`,`adverts_limit`,`adverts_available`,`date_start`,`date_exp`,`plan_params`) " . "VALUES ('" . $user->id . "','" . $plan->id . "','" . $plan_params->ad_limit . "','" . $plan_params->ad_limit . "','" . $date_start . "','" . $date_exp . "','" . addslashes($plan->params) . "')";
                 $db->setQuery($query);
                 $db->query();
                 $up_description = JText::_('COM_DJCLASSIFIEDS_PAYMENT_FOR_SUBSCRIPTION_PLAN') . '<br />' . JText::_('COM_DJCLASSIFIEDS_PLAN_ID') . ": " . $plan->id . '<br />' . JText::_('COM_DJCLASSIFIEDS_PLAN') . ": " . $plan->name;
                 $query = "INSERT INTO #__djcf_users_points (`user_id`,`points`,`description`) " . "VALUES ('" . $user->id . "','-" . $p_amount . "','" . addslashes($up_description) . "')";
                 $db->setQuery($query);
                 $db->query();
                 $message = JText::_('COM_DJCLASSIFIEDS_SUBSCRIPTION_PLAN_ACTIVATED');
                 $menu_userplans_itemid = $menus->getItems('link', 'index.php?option=com_djclassifieds&view=userplans', 1);
                 $userplans_link = 'index.php?option=com_djclassifieds&view=userplans';
                 if ($menu_userplans_itemid) {
                     $userplans_link .= '&Itemid=' . $menu_userplans_itemid->id;
                 }
                 $redirect = JRoute::_($userplans_link, false);
                 $app->redirect($redirect, $message);
             } else {
                 $message = JText::_('COM_DJCLASSIFIEDS_NOT_ENOUGHT_POINTS');
                 $redirect = "index.php?option=com_djclassifieds&view=items&cid=0";
                 $redirect = JRoute::_($redirect, false);
                 $app->redirect($redirect, $message);
             }
         } else {
             $message = JText::_('COM_DJCLASSIFIEDS_WRONG_SUBSCRIPTION_PLAN');
             $redirect = "index.php?option=com_djclassifieds&view=items&cid=0";
             $redirect = JRoute::_($redirect, false);
             $app->redirect($redirect, $message);
         }
     } else {
         if ($type == 'prom_top') {
             $p_amount = $par->get('promotion_move_top_points', 0);
             if ($points_count >= $p_amount) {
                 $up_description = JText::_('COM_DJCLASSIFIEDS_PAYMENT_FOR_PROMOTION_MOVE_TO_TOP') . '<br />' . JText::_('COM_DJCLASSIFIEDS_ADVERT_ID') . ": " . $item->id . '<br />' . JText::_('COM_DJCLASSIFIEDS_TITLE') . ": " . $item->name;
                 $query = "INSERT INTO #__djcf_users_points (`user_id`,`points`,`description`) " . "VALUES ('" . $user->id . "','-" . $p_amount . "','" . addslashes($up_description) . "')";
                 $db->setQuery($query);
                 $db->query();
                 $message = JText::_('COM_DJCLASSIFIEDS_POINTS_PAYMENT_CONFIRMED_PROMOTION_MOVE_TO_TOP_ACTIVATED');
                 $redirect = DJClassifiedsSEO::getItemRoute($item->id . ':' . $item->alias, $item->cat_id . ':' . $item->c_alias);
                 $date_sort = date("Y-m-d H:i:s");
                 $query = "UPDATE #__djcf_items SET date_sort='" . $date_sort . "' " . "WHERE id=" . $item->id . " ";
                 $db->setQuery($query);
                 $db->query();
                 $redirect = JRoute::_($redirect, false);
                 $app->redirect($redirect, $message);
             } else {
                 $message = JText::_('COM_DJCLASSIFIEDS_NOT_ENOUGHT_POINTS');
                 $redirect = "index.php?option=com_djclassifieds&view=items&cid=0";
                 $redirect = JRoute::_($redirect, false);
                 $app->redirect($redirect, $message);
             }
         } else {
             if (strstr($item->pay_type, 'cat')) {
                 $p_amount += $item->c_points;
             }
             /*if(strstr($item->pay_type, 'duration_renew')){			
             			$query = "SELECT d.points_renew FROM #__djcf_days d "
             			."WHERE d.days=".$item->exp_days;
             			$db->setQuery($query);
             			$p_amount += $db->loadResult()*$item->extra_images_to_pay;
             		}else if(strstr($item->pay_type, 'duration')){			
             			$query = "SELECT d.points FROM #__djcf_days d "
             			."WHERE d.days=".$item->exp_days;
             			$db->setQuery($query);
             			$p_amount += $db->loadResult()*$item->extra_images_to_pay;
             		}
             		
             		if(strstr($item->pay_type, 'extra_img_renew')){
             			$query = "SELECT d.img_points_renew FROM #__djcf_days d "
             					."WHERE d.days=".$item->exp_days;
             			$db->setQuery($query);
             			$p_amount += $db->loadResult();
             		}else if(strstr($item->pay_type, 'extra_img')){
             			$query = "SELECT d.img_points FROM #__djcf_days d "
             					."WHERE d.days=".$item->exp_days;
             			$db->setQuery($query);
             			$p_amount += $db->loadResult();
             		}
             		
             		if(strstr($item->pay_type, 'extra_chars_renew')){
             			$query = "SELECT d.char_points_renew FROM #__djcf_days d "
             					."WHERE d.days=".$item->exp_days;
             			$db->setQuery($query);
             			$p_amount += $db->loadResult();
             		}else if(strstr($item->pay_type, 'extra_chars')){
             			$query = "SELECT d.char_points FROM #__djcf_days d "
             					."WHERE d.days=".$item->exp_days;
             			$db->setQuery($query);
             			$p_amount += $db->loadResult();
             		}*/
             $query = "SELECT * FROM #__djcf_days d " . "WHERE d.days=" . $item->exp_days . " LIMIT 1";
             $db->setQuery($query);
             $day = $db->loadObject();
             if (strstr($item->pay_type, 'duration_renew')) {
                 $p_amount += $day->points_renew;
             } else {
                 if (strstr($item->pay_type, 'duration')) {
                     $p_amount += $day->points;
                 }
             }
             if (strstr($item->pay_type, 'extra_img_renew')) {
                 if ($day->img_price_default) {
                     $p_amount += $par->get('img_price_renew_points', '0') * $item->extra_images_to_pay;
                 } else {
                     $p_amount += $day->img_points_renew * $item->extra_images_to_pay;
                 }
             } else {
                 if (strstr($item->pay_type, 'extra_img')) {
                     if ($day->img_price_default) {
                         $p_amount += $par->get('img_price_points', '0') * $item->extra_images_to_pay;
                     } else {
                         $p_amount += $day->img_points * $item->extra_images_to_pay;
                     }
                 }
             }
             if (strstr($item->pay_type, 'extra_chars_renew')) {
                 if ($day->char_price_default) {
                     $p_amount += $par->get('desc_char_price_renew_points', '0') * $item->extra_chars_to_pay;
                 } else {
                     $p_amount += $day->char_points_renew * $item->extra_chars_to_pay;
                 }
             } else {
                 if (strstr($item->pay_type, 'extra_chars')) {
                     if ($day->char_price_default) {
                         $p_amount += $par->get('desc_char_price_points', '0') * $item->extra_chars_to_pay;
                     } else {
                         $p_amount += $day->char_points * $item->extra_chars_to_pay;
                     }
                 }
             }
             $query = "SELECT p.* FROM #__djcf_promotions p " . "WHERE p.published=1 ORDER BY p.id ";
             $db->setQuery($query);
             $promotions = $db->loadObjectList();
             foreach ($promotions as $prom) {
                 if (strstr($item->pay_type, $prom->name)) {
                     $p_amount += $prom->points;
                 }
             }
             if ($points_count >= $p_amount) {
                 $up_description = JText::_('COM_DJCLASSIFIEDS_PAYMENT_FOR_ADVERT') . '<br />' . JText::_('COM_DJCLASSIFIEDS_ADVERT_ID') . ": " . $item->id . '<br />' . JText::_('COM_DJCLASSIFIEDS_TITLE') . ": " . $item->name;
                 $query = "INSERT INTO #__djcf_users_points (`user_id`,`points`,`description`) " . "VALUES ('" . $user->id . "','-" . $p_amount . "','" . addslashes($up_description) . "')";
                 $db->setQuery($query);
                 $db->query();
                 $pub = 0;
                 if ($item->c_autopublish == '1' || $item->c_autopublish == '0' && $par->get('autopublish') == '1') {
                     $pub = 1;
                     $message = JText::_('COM_DJCLASSIFIEDS_POINTS_PAYMENT_CONFIRMED_ADVERT_PUBLISHED');
                 } else {
                     $message = JText::_('COM_DJCLASSIFIEDS_POINTS_PAYMENT_CONFIRMED_ADVERT_WAITING_FOR_PUBLISH');
                 }
                 $redirect = DJClassifiedsSEO::getItemRoute($item->id . ':' . $item->alias, $item->cat_id . ':' . $item->c_alias);
                 $query = "UPDATE #__djcf_items SET payed=1, pay_type='',extra_images_to_pay='0',extra_chars_to_pay='0', published='" . $pub . "' " . "WHERE id=" . $item->id . " ";
                 $db->setQuery($query);
                 $db->query();
                 $redirect = JRoute::_($redirect, false);
                 $app->redirect($redirect, $message);
             } else {
                 $message = JText::_('COM_DJCLASSIFIEDS_NOT_ENOUGHT_POINTS');
                 $redirect = "index.php?option=com_djclassifieds&view=items&cid=0";
                 $redirect = JRoute::_($redirect, false);
                 $app->redirect($redirect, $message);
             }
         }
     }
 }
Beispiel #19
0
 function payPoints()
 {
     $app = JFactory::getApplication();
     $par = JComponentHelper::getParams('com_djclassifieds');
     $user = JFactory::getUser();
     $db = JFactory::getDBO();
     $id = JRequest::getInt('id', 0);
     $type = JRequest::getVar('type', '');
     $query = "SELECT i.*, c.points as c_points, c.autopublish as c_autopublish, c.alias as c_alias FROM #__djcf_items i " . "LEFT JOIN #__djcf_categories c ON c.id=i.cat_id " . "WHERE i.id=" . $id . " LIMIT 1";
     $db->setQuery($query);
     $item = $db->loadObject();
     $redirect_a = 0;
     if (!$item) {
         $redirect_a = 1;
         $message = JText::_('COM_DJCLASSIFIEDS_WRONG_AD');
     }
     if ($item->user_id != $user->id) {
         $redirect_a = 1;
         $message = JText::_('COM_DJCLASSIFIEDS_WRONG_AD');
     }
     if ($user->id == 0) {
         $redirect_a = 1;
         $message = JText::_('COM_DJCLASSIFIEDS_PLEASE_LOGIN');
     }
     if ($redirect_a) {
         $redirect = "index.php?option=com_djclassifieds&view=items&cid=0";
         $redirect = JRoute::_($redirect, false);
         $app->redirect($redirect, $message);
     }
     $query = "SELECT SUM(p.points)FROM #__djcf_users_points p " . "WHERE p.user_id='" . $user->id . "' ";
     $db->setQuery($query);
     $points_count = $db->loadResult();
     $p_amount = 0;
     if ($type == 'prom_top') {
         $p_amount = $par->get('promotion_move_top_points', 0);
         if ($points_count >= $p_amount) {
             $up_description = JText::_('COM_DJCLASSIFIEDS_PAYMENT_FOR_PROMOTION_MOVE_TO_TOP') . '<br />' . JText::_('COM_DJCLASSIFIEDS_ADVERT_ID') . ": " . $item->id . '<br />' . JText::_('COM_DJCLASSIFIEDS_TITLE') . ": " . $item->name;
             $query = "INSERT INTO #__djcf_users_points (`user_id`,`points`,`description`) " . "VALUES ('" . $user->id . "','-" . $p_amount . "','" . addslashes($up_description) . "')";
             $db->setQuery($query);
             $db->query();
             $message = JText::_('COM_DJCLASSIFIEDS_POINTS_PAYMENT_CONFIRMED_PROMOTION_MOVE_TO_TOP_ACTIVATED');
             $redirect = DJClassifiedsSEO::getItemRoute($item->id . ':' . $item->alias, $item->cat_id . ':' . $item->c_alias);
             $date_sort = date("Y-m-d H:i:s");
             $query = "UPDATE #__djcf_items SET date_sort='" . $date_sort . "' " . "WHERE id=" . $item->id . " ";
             $db->setQuery($query);
             $db->query();
             $redirect = JRoute::_($redirect, false);
             $app->redirect($redirect, $message);
         } else {
             $message = JText::_('COM_DJCLASSIFIEDS_NOT_ENOUGHT_POINTS');
             $redirect = "index.php?option=com_djclassifieds&view=items&cid=0";
             $redirect = JRoute::_($redirect, false);
             $app->redirect($redirect, $message);
         }
     } else {
         if (strstr($item->pay_type, 'cat')) {
             $p_amount += $item->c_points;
         }
         if (strstr($item->pay_type, 'duration_renew')) {
             $query = "SELECT d.points_renew FROM #__djcf_days d " . "WHERE d.days=" . $item->exp_days;
             $db->setQuery($query);
             $p_amount += $db->loadResult();
         } else {
             if (strstr($item->pay_type, 'duration')) {
                 $query = "SELECT d.points FROM #__djcf_days d " . "WHERE d.days=" . $item->exp_days;
                 $db->setQuery($query);
                 $p_amount += $db->loadResult();
             }
         }
         $query = "SELECT p.* FROM #__djcf_promotions p " . "WHERE p.published=1 ORDER BY p.id ";
         $db->setQuery($query);
         $promotions = $db->loadObjectList();
         foreach ($promotions as $prom) {
             if (strstr($item->pay_type, $prom->name)) {
                 $p_amount += $prom->points;
             }
         }
         if ($points_count >= $p_amount) {
             $up_description = JText::_('COM_DJCLASSIFIEDS_PAYMENT_FOR_ADVERT') . '<br />' . JText::_('COM_DJCLASSIFIEDS_ADVERT_ID') . ": " . $item->id . '<br />' . JText::_('COM_DJCLASSIFIEDS_TITLE') . ": " . $item->name;
             $query = "INSERT INTO #__djcf_users_points (`user_id`,`points`,`description`) " . "VALUES ('" . $user->id . "','-" . $p_amount . "','" . addslashes($up_description) . "')";
             $db->setQuery($query);
             $db->query();
             $pub = 0;
             if ($item->c_autopublish == '1' || $item->c_autopublish == '0' && $par->get('autopublish') == '1') {
                 $pub = 1;
                 $message = JText::_('COM_DJCLASSIFIEDS_POINTS_PAYMENT_CONFIRMED_ADVERT_PUBLISHED');
             } else {
                 $message = JText::_('COM_DJCLASSIFIEDS_POINTS_PAYMENT_CONFIRMED_ADVERT_WAITING_FOR_PUBLISH');
             }
             $redirect = DJClassifiedsSEO::getItemRoute($item->id . ':' . $item->alias, $item->cat_id . ':' . $item->c_alias);
             $query = "UPDATE #__djcf_items SET payed=1, pay_type='', published='" . $pub . "' " . "WHERE id=" . $item->id . " ";
             $db->setQuery($query);
             $db->query();
             $redirect = JRoute::_($redirect, false);
             $app->redirect($redirect, $message);
         } else {
             $message = JText::_('COM_DJCLASSIFIEDS_NOT_ENOUGHT_POINTS');
             $redirect = "index.php?option=com_djclassifieds&view=items&cid=0";
             $redirect = JRoute::_($redirect, false);
             $app->redirect($redirect, $message);
         }
     }
 }
Beispiel #20
0
 function onContentSearch($text, $phrase = '', $ordering = '', $areas = null)
 {
     $app = JFactory::getApplication();
     $db = JFactory::getDBO();
     $searchText = $text;
     if (is_array($areas)) {
         if (!array_intersect($areas, array_keys($this->onContentSearchAreas()))) {
             return array();
         }
     }
     // load plugin params info
     $plugin = JPluginHelper::getPlugin('search', 'djclassifieds');
     $pluginParams = $this->params;
     $limit = $pluginParams->def('search_limit', 50);
     $text = trim($text);
     if ($text == '') {
         return array();
     }
     $wheres = array();
     $where = '';
     switch ($phrase) {
         case 'exact':
             $text = $db->Quote('%' . $db->getEscaped($text, true) . '%', false);
             $wheres2 = array();
             $wheres2[] = 'i.name LIKE ' . $text;
             $wheres2[] = 'i.intro_desc LIKE ' . $text;
             $wheres2[] = 'i.description LIKE ' . $text;
             $where = '(' . implode(') OR (', $wheres2) . ')';
             break;
         case 'all':
         case 'any':
         default:
             $words = explode(' ', $text);
             $wheres = array();
             foreach ($words as $word) {
                 $word = $db->Quote('%' . $db->getEscaped($word, true) . '%', false);
                 $wheres2 = array();
                 $wheres2[] = 'i.name LIKE ' . $word;
                 $wheres2[] = 'i.intro_desc LIKE ' . $word;
                 $wheres2[] = 'i.description LIKE ' . $word;
                 $wheres[] = implode(' OR ', $wheres2);
             }
             $where = '(' . implode($phrase == 'all' ? ') AND (' : ') OR (', $wheres) . ')';
             break;
     }
     switch ($ordering) {
         case 'alpha':
             $order = 'i.name ASC';
             break;
         case 'category':
         case 'popular':
         case 'newest':
         case 'oldest':
         default:
             $order = 'i.name DESC';
     }
     $date_time = JFactory::getDate();
     $date_exp = $date_time->toSQL();
     $text = $db->Quote('%' . $db->getEscaped($text, true) . '%', false);
     $query = ' SELECT i.id AS id, i.name AS title, i.alias as alias, i.intro_desc AS intro, i.date_start as created, c.id AS cat_id, c.name AS category, c.alias as c_alias, i.description as text,i.metakey, i.metadesc ' . ' FROM #__djcf_items AS i ' . ' LEFT JOIN #__djcf_categories AS c ON c.id = i.cat_id ' . ' WHERE i.date_exp > \'' . $date_exp . '\' AND (' . $where . ')' . ' AND i.published = 1 AND c.published = 1' . ' GROUP BY id' . ' ORDER BY ' . $order;
     $db->setQuery($query, 0, $limit);
     $rows = $db->loadObjectList();
     //echo '<pre>';print_r($rows);die();
     $count = count($rows);
     for ($i = 0; $i < $count; $i++) {
         $rows[$i]->href = JRoute::_(DJClassifiedsSEO::getItemRoute($rows[$i]->id . ':' . $rows[$i]->alias, $rows[$i]->cat_id . ':' . $rows[$i]->c_alias));
         $rows[$i]->section = JText::_('PLG_SEARCH_DJCLASSIFIEDS_DJCLASSIFIEDSITEMS') . ': ' . $rows[$i]->category;
         $rows[$i]->browsernav = 2;
     }
     $return = array();
     foreach ($rows as $key => $section) {
         if (searchHelper::checkNoHTML($section, $searchText, array('title', 'text', 'intro', 'metadesc', 'metakey'))) {
             $return[] = $section;
         }
     }
     //echo '<pre>';print_r($return);die();
     return $return;
 }
Beispiel #21
0
        } else {
            if ($params->get('desc_link') == 1) {
                echo '<a href="' . JRoute::_(DJClassifiedsSEO::getItemRoute($i->id . ':' . $i->alias, $i->cat_id . ':' . $i->c_alias)) . '">';
            }
            $desc_c = $params->get('char_desc_nr');
            if ($desc_c != 0 && $i->intro_desc != '' && strlen($i->intro_desc) > $desc_c) {
                echo mb_substr($i->intro_desc, 0, $desc_c, 'utf-8') . ' ...';
            } else {
                echo $i->intro_desc;
            }
            if ($params->get('desc_link') == 1) {
                echo '</a>';
            }
        }
        echo '</div>';
    }
    echo '<div class="border_seperator"></div>';
    echo '<div class="blog_adress_before"></div><div class="blog_adress">' . $i->address . '</div>';
    echo '<div class="blog_item_views">Baxış sayı: ' . $i->display . '</div>';
    echo '<div class="item_box_hover"><div class="item_box_show">';
    echo '<div class="before_title_in"></div><h2><a href="' . DJClassifiedsSEO::getItemRoute($i->id . ':' . $i->alias, $i->cat_id . ':' . $i->c_alias) . $anch . '" >' . $i->name . '</a></h2>';
    echo '<div class="before_city_in"></div><div class="region"><span class="label_title"></span>' . $i->r_name . '</div>';
    echo '<div class="adress_in_before"></div><div class="adress_in">' . $i->address . '</div>';
    echo '</div></div>';
    echo '</div>';
}
?>
		<div style="clear:both"></div>
		</div></div>
	</div>
</div>
Beispiel #22
0
							 </div>	
							 <?php 
    if (count($plan->items)) {
        ?>
							 	<h4 class="djcf_prow_details_title"><?php 
        echo JText::_('COM_DJCLASSIFIEDS_ADS');
        ?>
<span></span></h4>
								<div class="djcf_prow_details_content">
									<?php 
        foreach ($plan->items as $item) {
            ?>
								 		<div class="djcf_prow_desc_row">
								 			<?php 
            if ($item->i_name) {
                echo '<a href="' . DJClassifiedsSEO::getItemRoute($item->id . ':' . $item->i_alias, $item->cat_id . ':' . $item->c_alias) . '">' . $item->i_name . ' (' . JText::_('COM_DJCLASSIFIEDS_AD_ID') . ': ' . $item->id . ')' . '</a>';
            } else {
                echo $item->item_name . ' (' . JText::_('COM_DJCLASSIFIEDS_AD_ID') . ': ' . $item->id . ')';
            }
            ?>
								 		</div>
									<?php 
        }
        ?>
								</div>								
							 <?php 
    }
    ?>
							 
							 
							 										
Beispiel #23
0
 public static function notifyNewAdvertUser($item, $cat)
 {
     $app = JFactory::getApplication();
     $config = JFactory::getConfig();
     $par = JComponentHelper::getParams('com_djclassifieds');
     $user = JFactory::getUser();
     if ($user->id) {
         $mailto = $user->email;
     } else {
         $mailto = $item->email;
     }
     $mailfrom = $app->getCfg('mailfrom');
     $fromname = $config->get('sitename') . ' - ' . str_ireplace('administrator/', '', JURI::base());
     $subject = JText::_('COM_DJCLASSIFIEDS_NAU_EMAIL_TITLE') . ' ' . $config->get('sitename');
     $m_message = JText::_('COM_DJCLASSIFIEDS_NAU_EMAIL_TITLE') . ' ' . $config->get('sitename') . "<br /><br />";
     $m_message .= JText::_('COM_DJCLASSIFIEDS_TITLE') . ': ' . $item->name . "<br /><br />";
     $m_message .= JText::_('COM_DJCLASSIFIEDS_STATUS') . ': ';
     if ($item->published) {
         $m_message .= JText::_('COM_DJCLASSIFIEDS_PUBLISHED') . "<br /><br />";
     } else {
         $m_message .= JText::_('COM_DJCLASSIFIEDS_WAITING_FOR_PUBLISH') . "<br /><br />";
     }
     $m_message .= JText::_('COM_DJCLASSIFIEDS_INTRO_DESCRIPTION') . ': ' . $item->intro_desc . "<br /><br />";
     $u = JURI::getInstance(JURI::base());
     if ($u->getScheme()) {
         $link = $u->getScheme() . '://';
     } else {
         $link = 'http://';
     }
     $edit_link = $link;
     $link .= $u->getHost() . JRoute::_(DJClassifiedsSEO::getItemRoute($item->id . ':' . $item->alias, $item->cat_id . ':' . $cat->alias));
     $m_message .= JText::_('COM_DJCLASSIFIEDS_ADVERT_LINK') . ': <a href="' . $link . '">' . $link . '</a><br /><br />';
     if (!$user->id && $item->email && $par->get('guest_can_edit', 0)) {
         $edit_link .= $u->getHost() . JRoute::_(DJClassifiedsSEO::getNewAdLink() . '&token=' . $item->token);
         $m_message .= JText::_('COM_DJCLASSIFIEDS_EDITION_LINK') . ': <a href="' . $edit_link . '">' . $edit_link . '</a><br /><br />';
     }
     $mailer = JFactory::getMailer();
     $mailer->sendMail($mailfrom, $fromname, $mailto, $subject, $m_message, $mode = 1);
     return null;
 }
Beispiel #24
0
         if ($par->get('column_category', '1') == '3') {
             $class = ' hide_tablet hide_mobile';
         }
     }
     echo '<td class="cat_name' . $class . '"><a href="' . DJClassifiedsSEO::getCategoryRoute($i->cat_id . ':' . $i->c_alias) . '" >' . $i->c_name . '</a></td>';
 }
 if ($par->get('column_desc', '1')) {
     $class = '';
     if ($par->get('column_desc', '1') == '2') {
         $class = ' hide_mobile';
     } else {
         if ($par->get('column_desc', '1') == '3') {
             $class = ' hide_tablet hide_mobile';
         }
     }
     echo '<td class="description' . $class . '"><a class="title" href="' . DJClassifiedsSEO::getItemRoute($i->id . ':' . $i->alias, $i->cat_id . ':' . $i->c_alias) . $anch . '">';
     echo mb_substr(strip_tags($i->intro_desc), 0, $par->get('introdesc_char_limit', '120'), 'UTF-8');
     echo '</a></td>';
 }
 if ($par->get('column_loc', '1') && $par->get('show_regions', '1')) {
     $class = '';
     if ($par->get('column_loc', '1') == '2') {
         $class = ' hide_mobile';
     } else {
         if ($par->get('column_loc', '1') == '3') {
             $class = ' hide_tablet hide_mobile';
         }
     }
     echo '<td class="region' . $class . '"><a href="' . $this->se_results_link . $i->region_id . '">' . $i->r_name . '</a></td>';
 }
 if ($par->get('column_price', '1') && $par->get('show_price', '1')) {
Beispiel #25
0
 /**
  * Plugin that returns the object list for DJ-Mediatools album
  * 
  * Each object must contain following properties (mandatory): title, description, image
  * Optional properties: link, target (_blank or _self), alt (alt attribute for image)
  * 
  * @param	object	The album params
  */
 public function onAlbumPrepare(&$source, &$params)
 {
     // Lets check the requirements
     $check = $this->onCheckRequirements($source);
     if (is_null($check) || is_string($check)) {
         return null;
     }
     $app = JFactory::getApplication();
     $default_image = $params->get('plg_classifieds_image');
     require_once JPATH_BASE . '/modules/mod_djclassifieds_items/helper.php';
     require_once JPATH_BASE . DS . 'administrator' . DS . 'components' . DS . 'com_djclassifieds' . DS . 'lib' . DS . 'djtheme.php';
     require_once JPATH_BASE . DS . 'administrator' . DS . 'components' . DS . 'com_djclassifieds' . DS . 'lib' . DS . 'djseo.php';
     $mparams = new JRegistry();
     foreach ($params->toArray() as $key => $value) {
         if (strpos($key, 'plg_classifieds_') !== FALSE) {
             $nkey = substr($key, 16);
             switch ($nkey) {
                 case 'catid':
                     $mparams->set('cat_id', $value);
                     break;
                 case 'follow_category':
                     $mparams->set('fallow_category', $value);
                     break;
                 case 'follow_region':
                     $mparams->set('fallow_region', $value);
                     break;
                 case 'only_promoted':
                     foreach ($value as $promo) {
                         $mparams->set('only_' . $promo, 1);
                     }
                     break;
                 default:
                     $mparams->set($nkey, $value);
                     break;
             }
         }
     }
     // override number of items
     $mparams->set('items_nr', $params->get('max_images'));
     // we need ads only with images
     if (empty($default_image)) {
         $mparams->set('only_with_img', 1);
     }
     //$this->debug($mparams);
     $items = modDjClassifiedsItems::getItems($mparams);
     $types = modDjClassifiedsItems::getTypes();
     $slides = array();
     if ($items) {
         foreach ($items as $i) {
             $slide = (object) array();
             if (!empty($i->img_path) && !empty($i->img_name) && !empty($i->img_ext)) {
                 // DJ-Classifieds 3.2+
                 $slide->image = $i->img_path . $i->img_name . '_thb.' . $i->img_ext;
             } else {
                 if (!empty($i->image_url)) {
                     // DJ-Classifieds version < 3.2
                     $images = explode(';', $i->image_url);
                     $slide->image = 'components/com_djclassifieds/images/' . $images[0];
                 } else {
                     if (!empty($default_image)) {
                         $slide->image = $default_image;
                     } else {
                         continue;
                     }
                 }
             }
             // we got image now take extra information
             $slide->extra = '';
             if ($mparams->get('show_date') == 1) {
                 $slide->extra .= '<div class="date">';
                 if (method_exists('DJClassifiedsTheme', 'formatDate')) {
                     $slide->extra .= DJClassifiedsTheme::formatDate(strtotime($i->date_start));
                 } else {
                     $slide->extra .= DJClassifiedsTheme::dateFormatFromTo(strtotime($i->date_start));
                 }
                 $slide->extra .= '</div>';
             }
             if ($mparams->get('show_cat') == 1) {
                 $slide->extra .= '<div class="category">';
                 if ($mparams->get('cat_link') == 1) {
                     $slide->extra .= '<a class="title_cat" href="' . JRoute::_(DJClassifiedsSEO::getCategoryRoute($i->cat_id . ':' . $i->c_alias)) . '">' . $i->c_name . '</a>';
                 } else {
                     $slide->extra .= $i->c_name;
                 }
                 $slide->extra .= '</div>';
             }
             if ($mparams->get('show_type') && $i->type_id > 0) {
                 if (isset($types[$i->type_id])) {
                     $slide->extra .= '<div class="type">';
                     $type = $types[$i->type_id];
                     if ($type->params->bt_class) {
                         $bt_class = ' ' . $type->params->bt_class;
                     } else {
                         $bt_class = '';
                     }
                     if ($type->params->bt_use_styles) {
                         if ($mparams->get('show_type') == 2) {
                             $style = 'style="display:inline-block;' . 'border:' . (int) $type->params->bt_border_size . 'px solid ' . $type->params->bt_border_color . ';' . 'background:' . $type->params->bt_bg . ';' . 'color:' . $type->params->bt_color . ';' . $type->params->bt_style . '"';
                             $slide->extra .= '<div class="type_button' . $bt_class . '" ' . $style . ' >' . $type->name . '</div>';
                         } else {
                             $slide->extra .= '<div class="type_label' . $bt_class . '" >' . $type->name . '</div>';
                         }
                     } else {
                         $slide->extra .= '<div class="type_label' . $bt_class . '" >' . $type->name . '</div>';
                     }
                     $slide->extra .= '</div>';
                 }
             }
             if ($mparams->get('show_region') == 1) {
                 $slide->extra .= '<div class="region">';
                 $slide->extra .= $i->r_name;
                 $slide->extra .= '</div>';
             }
             if ($mparams->get('show_price') == 1 && $i->price) {
                 $slide->extra .= '<div class="price">';
                 $slide->extra .= DJClassifiedsTheme::priceFormat($i->price, $i->currency);
                 $slide->extra .= '</div>';
             }
             // finish getting extra information
             $slide->title = $i->name;
             $slide->description = $i->intro_desc;
             if (empty($slide->description)) {
                 $slide->description = $i->description;
             }
             $slide->full_desc = $i->description;
             $slide->link = JRoute::_(DJClassifiedsSEO::getItemRoute($i->id . ':' . $i->alias, $i->cat_id . ':' . $i->c_alias));
             $slides[] = $slide;
         }
     }
     return $slides;
 }
Beispiel #26
0
    }
    ?>
						
						items_address[<?php 
    echo $ia;
    ?>
]='<?php 
    echo $item->country . ", " . $item->city;
    if ($item->address != '') {
        echo ", " . $item->address;
    }
    ?>
';
							<?php 
    $marker_txt = '<div style="width:200px;margin-bottom:0px"><div style="margin-bottom:5px;">';
    $marker_txt .= '<a href="' . JRoute::_(DJClassifiedsSEO::getItemRoute($item->id . ':' . $item->alias, $item->cat_id . ':' . $item->c_alias)) . ' "><strong>' . addslashes($item->name) . '</strong></a></div>';
    $marker_txt .= addslashes(str_replace(array("\n", "\r"), '', $item->intro_desc)) . '<br />';
    $marker_txt .= '<div style="margin-top:10px;">';
    if ($item->image_url != '') {
        $images = explode(';', substr($item->image_url, 0, -1));
        $path = JURI::base() . '/components/com_djclassifieds/images/';
        for ($ii = 0; $ii < count($images); $ii++) {
            $marker_txt .= '<img width="60px" src="' . $path . $images[$ii] . '.ths.jpg" /> ';
            if ($ii == 3) {
                break;
            }
        }
    }
    $marker_txt .= '</div></div>';
    ?>
				    		items_desc[<?php 
Beispiel #27
0
 /**
  * Should return everything - Full rating, list of reviews and add review form
  *
  * @param object $row DJ-Catalog2 Object
  * @param JRegistry $params
  * @param int $page
  * @return boolean|Ambigous <boolean, string>
  */
 public function onAfterDJClassifiedsDisplayContent(&$item, $params, $view)
 {
     $app = JFactory::getApplication();
     if ($view != 'item') {
         return false;
     }
     $group_id = $this->params->get('rating_group', false);
     if (!$group_id) {
         return false;
     }
     $excluded_categories = $this->params->get('exclude_categories', array());
     if (in_array($item->cat_id, $excluded_categories)) {
         return false;
     }
     $excluded_products = explode(',', $this->params->get('exclude_items', ''));
     if (in_array($item->id, $excluded_products)) {
         return false;
     }
     require_once JPath::clean(JPATH_ROOT . '/components/com_djreviews/lib/api.php');
     require_once JPath::clean(JPATH_ROOT . '/administrator/components/com_djclassifieds/lib/djseo.php');
     $name = $item->name ? $item->name : $item->id . ':' . $item->alias;
     $review = DJReviewsAPI::getInstance(array('group' => $group_id, 'type' => 'com_djclassifieds.item', 'name' => $name, 'link' => DJClassifiedsSEO::getItemRoute($item->id . ':' . $item->alias, $item->cat_id . ':' . $item->c_alias), 'id' => $item->id));
     return $review->getFullReview();
 }
         echo ' class="Tips1" title="' . $tip_title . '" rel="' . $tip_cont . '"';
     }
     echo ' alt ="' . str_ireplace('"', "'", $i->images[0]->caption) . '" ';
     echo '/>';
 } else {
     echo '<img src="' . JURI::base() . '/components/com_djclassifieds/assets/images/no-image.png" ';
     if ((int) $par->get('tooltip_img', '1')) {
         echo 'class="Tips1" title="' . $tip_title . '" rel="' . $tip_cont . '"';
     }
     echo '/>';
 }
 echo '</a>';
 if ((int) $par->get('tooltip_title', '1')) {
     echo '<a class="title Tips1" href="' . DJClassifiedsSEO::getItemRoute($i->id . ':' . $i->alias, $i->cat_id . ':' . $i->c_alias) . $anch . '" title="' . $tip_title . '" rel="' . $tip_cont . '" >' . $i->name . '</a>';
 } else {
     echo '<a class="title" href="' . DJClassifiedsSEO::getItemRoute($i->id . ':' . $i->alias, $i->cat_id . ':' . $i->c_alias) . $anch . '" >' . $i->name . '</a>';
 }
 echo '<span class="c_name">' . $i->c_name . '</span>';
 echo '</div></div>';
 echo '<div class="col_ua public_status"><div class="col_ua_in">';
 echo '<div class="col_ua_row">' . JText::_('COM_DJCLASSIFIEDS_DATE_ADDED') . ' : <span>' . DJClassifiedsTheme::formatDate(strtotime($i->date_start)) . '</span></div>';
 echo '<div class="col_ua_row">' . JText::_('COM_DJCLASSIFIEDS_DATE_EXPIRATION') . ' : ';
 if ($i->s_active) {
     echo '<span title="' . $i->date_start . ' - ' . $i->date_exp . '" style="color:#559D01;font-weight:bold;" >' . DJClassifiedsTheme::formatDate(strtotime($i->date_exp)) . '</span>';
 } else {
     echo '<span title="' . $i->date_start . ' - ' . $i->date_exp . '" style="color:#C23C00;font-weight:bold;" >' . DJClassifiedsTheme::formatDate(strtotime($i->date_exp)) . '</span>';
 }
 echo '</div>';
 echo '<div class="col_ua_row">' . JText::_('COM_DJCLASSIFIEDS_PUBLISHED') . ' : ';
 if ($i->published) {
     echo '<img src="' . JURI::base() . 'components/com_djclassifieds/assets/images/tick.png" alt="' . JText::_('JYES') . '" />';
		             		var icon = new google.maps.MarkerImage("<?php 
            echo $gm_icon_default;
            ?>
", size, start_point, anchor_point);
						<?php 
        } else {
            ?>
							var icon = '';
						<?php 
        }
    }
    ?>
																													
							<?php 
    $marker_txt = '<div style="width:200px;margin-bottom:0px"><div style="margin-bottom:5px;">';
    $marker_txt .= '<a style="text-decoration:none !important;" href="' . JRoute::_(DJClassifiedsSEO::getItemRoute($item->id . ':' . $item->alias, $item->cat_id . ':' . $item->c_alias)) . ' ">';
    if ($item->img_path && $item->img_name && $item->img_ext) {
        $item_img = JURI::base() . $item->img_path . $item->img_name . '_ths.' . $item->img_ext;
        $marker_txt .= '<img style="float:left;margin:5px 10px 0 0;"  width="60px" src="' . $item_img . '" /> ';
    }
    $marker_txt .= '<strong>' . addslashes($item->name) . '</strong><br />';
    $marker_txt .= '<span style="color:#333333">' . addslashes(str_replace(array("\n", "\r", "\r\n"), '', $item->intro_desc)) . '</span>';
    $marker_txt .= '</a></div></div>';
    if ($item->latitude != '0.000000000000000' && $item->longitude != '0.000000000000000') {
        ?>
										var adLatlng = new google.maps.LatLng(<?php 
        echo $item->latitude . ',' . $item->longitude;
        ?>
);
										djmarkers<?php 
        echo $module->id;
Beispiel #30
0
                        if ($f_id == '47') {
                            echo '<div class="vladelec_in_before"></div><div class="vladelec_in">' . $field . '</div>';
                        }
                        if ($f_id == '44') {
                            echo '<div class="doc_in_before"></div><div class="doc_in">' . $field . '</div>';
                        }
                        if ($f_id == '37') {
                            echo '<div class="metro_in">' . $field . '</div>';
                        }
                    }
                }
                echo '</div>';
            }
        }
        if ($par->get('blog_readmore', '1')) {
            echo '<div class="see_details_box"><a class="see_details" href="' . DJClassifiedsSEO::getItemRoute($i->id . ':' . $i->alias, $i->cat_id . ':' . $i->c_alias) . $anch . '" >' . JText::_('Ətraflı') . '</a></div>';
        }
        echo '</div></div></div></div></div></div>';
    }
    ?>
	
		<?php 
    echo '<div style="clear:both" ></div>';
    if (count($this->items) == 0) {
        echo '<div class="no_results" style="padding-left:30px;">';
        if ($se > 0) {
            echo JText::_('COM_DJCLASSIFIEDS_NO_RESULTS');
        } else {
            if ($main_id) {
                echo JText::_('COM_DJCLASSIFIEDS_NO_CATEGORY_RESULTS');
            }