本文整理汇总了PHP中DJClassifiedsSEO类的典型用法代码示例。如果您正苦于以下问题:PHP DJClassifiedsSEO类的具体用法?PHP DJClassifiedsSEO怎么用?PHP DJClassifiedsSEO使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了DJClassifiedsSEO类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getObjectInfo
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;
}
示例2: display
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);
}
}
示例3: paymentReturn
function paymentReturn()
{
$app = JFactory::getApplication();
$id = JRequest::getInt("id", "");
$cid = JRequest::getInt("cid", "");
$itemid = JRequest::getInt("Itemid", "");
$r = JRequest::getVar("r", "");
if ($r == 'ok') {
//$redirect= 'index.php?option=com_djclassifieds&view=item&id='.$id.'&cid='.$cid.'&Itemid='.$itemid;
$message = JTExt::_('COM_DJCLASSIFIEDS_THANKS_FOR_PAYMENT_WAIT_FOR_CONFIRMATION');
} else {
$message = JTExt::_('COM_DJCLASSIFIEDS_PAYMENT_CANCELED');
}
//$redirect= 'index.php?option=com_djclassifieds&view=items&cid=0&Itemid='.$itemid;
$redirect = DJClassifiedsSEO::getCategoryRoute('0:all');
$redirect = JRoute::_($redirect);
$app->redirect($redirect, $message);
}
示例4: getItem
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;
}
示例5: parseMessageBody
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;
}
示例6: save
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))];
}
}
/*
//.........这里部分代码省略.........
示例7: notifyNewAdvertUser
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;
}
示例8: display
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');
$item = $model->getItem();
$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);
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);
}
}
}
$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;
}
}
}
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);
}
if ($item->metakey != '') {
$document->setMetaData('keywords', $item->metakey);
//.........这里部分代码省略.........
示例9: foreach
<?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>';
}
?>
示例10:
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>';
}
示例11: payPoints
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);
//.........这里部分代码省略.........
示例12: regenerateAliases
function regenerateAliases()
{
$app = JFactory::getApplication();
$par = JComponentHelper::getParams('com_djclassifieds');
$db = JFactory::getDBO();
$query = "SELECT * FROM #__djcf_categories";
$db->setQuery($query);
$cats = $db->loadObjectList();
foreach ($cats as $c) {
$alias = DJClassifiedsSEO::getAliasName($c->name);
$query = "UPDATE #__djcf_categories SET alias='" . $alias . "' WHERE id=" . $c->id;
$db->setQuery($query);
$db->query();
}
$redirect = 'index.php?option=com_djclassifieds&view=categories';
$app->redirect($redirect, JText::_('COM_DJCLASSIFIEDS_ALIASES_RECREATED'));
}
示例13: str_ireplace
} 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"> </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');
示例14: getCategoriesSortParent
public static function getCategoriesSortParent($p = '0', $ord = 'ord')
{
if (!self::$_categories_sparent) {
self::$_categories_sparent = array();
}
if (isset(self::$_categories_sparent[$p . '_' . $ord])) {
return self::$_categories_sparent[$p . '_' . $ord];
}
if ($p) {
$pub = 'WHERE c.published=1 ';
} else {
$pub = '';
}
if ($ord == 'name') {
$order = 'c.name';
} else {
$order = 'c.ordering';
}
$db = JFactory::getDBO();
$query = "SELECT c.*, cc.name as parent_name,IFNULL(i.items_count,0) items_count FROM #__djcf_categories c " . "LEFT JOIN #__djcf_categories cc ON c.parent_id=cc.id " . "LEFT JOIN (SELECT i.cat_id, count(i.id) as items_count " . "FROM #__djcf_items i WHERE i.published=1 AND i.date_exp > NOW() GROUP BY i.cat_id) i ON i.cat_id=c.id " . $pub . "ORDER BY c.parent_id, " . $order;
$db->setQuery($query);
$allcategories = $db->loadObjectList();
$categories = array();
foreach ($allcategories as $cat) {
if (!$cat->alias) {
$cat->alias = DJClassifiedsSEO::getAliasName($cat->name);
}
if (!isset($categories[$cat->parent_id])) {
$categories[$cat->parent_id] = array();
}
$categories[$cat->parent_id][] = $cat;
}
//echo '<pre>';print_r($db);print_r($allcategories);die();
self::$_categories_sparent[$p . '_' . $ord] = $categories;
return self::$_categories_sparent[$p . '_' . $ord];
}
示例15: save
function save()
{
$app = JFactory::getApplication();
JTable::addIncludePath(JPATH_COMPONENT_ADMINISTRATOR . DS . 'tables');
jimport('joomla.database.table');
$row = JTable::getInstance('Items', 'DJClassifiedsTable');
$par = JComponentHelper::getParams('com_djclassifieds');
$user = JFactory::getUser();
$db = JFactory::getDBO();
$id = JRequest::getVar('id', 0, '', 'int');
$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') {
//$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'));
}
if ($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();
$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');
}
$row->load($id);
$row->exp_days = JRequest::getVar('exp_days', $par->get('exp_days'), '', 'int');
$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);
}
}
if (strstr($row->promotions, 'p_first')) {
$row->special = 1;
} else {
$row->special = 0;
}
$row->payed = 1;
$row->pay_type = '';
//echo '<pre>';print_r($row);die();echo '</pre>';
if (!$row->store()) {
//echo $row->getError();exit ();
}
$redirect = "index.php?option=com_djclassifieds&view=item&task=renew&id=" . $row->id . "&Itemid=" . JRequest::getVar('Itemid', '0');
$redirect = JRoute::_($redirect, false);
$app->redirect($redirect, $message);
}