function showGeneralLink() { if ($this->conf->display_general_menu == 1) { ?> <div id="adsmanager_innermenu"> <?php if ($this->catid == 0) { $link_write_ad = TRoute::_("index.php?option=com_adsmanager&task=write"); } else { $link_write_ad = TRoute::_("index.php?option=com_adsmanager&task=write&catid={$this->catid}"); } $link_show_profile = TLink::getProfileLink(); $link_show_user = TLink::getMyAdsLink(); $link_show_rules = TRoute::_("index.php?option=com_adsmanager&view=rules"); $link_show_all = TRoute::_("index.php?option=com_adsmanager&view=list"); echo '<a href="' . $link_write_ad . '">' . JText::_('ADSMANAGER_MENU_WRITE') . '</a> | '; echo '<a href="' . $link_show_all . '">' . JText::_('ADSMANAGER_MENU_ALL_ADS') . '</a> | '; echo '<a href="' . $link_show_profile . '">' . JText::_('ADSMANAGER_MENU_PROFILE') . '</a> | '; echo '<a href="' . $link_show_user . '">' . JText::_('ADSMANAGER_MENU_USER_ADS') . '</a>'; if ($this->conf->rules_text != "") { echo ' | <a href="' . $link_show_rules . '">' . JText::_('ADSMANAGER_MENU_RULES') . '</a>'; } ?> </div> <br/> <?php } }
function showGeneralLink() { if ($this->conf->display_general_menu == 1) { ?> <div id="adsmanager_innermenu" class="row-fluid"> <div class="span12 text-center"> <?php if ($this->catid == 0) $link_write_ad = TRoute::_("index.php?option=com_adsmanager&task=write"); else $link_write_ad = TRoute::_("index.php?option=com_adsmanager&task=write&catid={$this->catid}"); $link_show_profile = TLink::getProfileLink(); $link_show_user = TLink::getMyAdsLink(); $link_show_rules = TRoute::_("index.php?option=com_adsmanager&view=rules"); $link_show_all = TRoute::_("index.php?option=com_adsmanager&view=list"); $link_favorites = TLink::getMyFavoritesLink(); echo '<a href="'.$link_write_ad.'">'.JText::_('ADSMANAGER_MENU_WRITE').'</a> | '; echo '<a href="'.$link_show_all.'">'.JText::_('ADSMANAGER_MENU_ALL_ADS').'</a> | '; echo '<a href="'.$link_show_profile.'">'.JText::_('ADSMANAGER_MENU_PROFILE').'</a> | '; echo '<a href="'.$link_show_user.'">'.JText::_('ADSMANAGER_MENU_USER_ADS').'</a>'; if(isset($this->conf->favorite_enabled) && $this->conf->favorite_enabled == 1){ echo ' | <a href="'.$link_favorites.'">'.JText::_('ADSMANAGER_MENU_FAVORITES').'</a>'; } if ($this->conf->rules_text != "") { echo ' | <a href="'.$link_show_rules.'">'.JText::_('ADSMANAGER_MENU_RULES').'</a>'; } ?> </div> </div> <?php } }
function display($tpl = null) { $app = JFactory::getApplication(); $user = JFactory::getUser(); $pathway = $app->getPathway(); $document = JFactory::getDocument(); $usermodel =$this->getModel( "user" ); $configurationmodel =$this->getModel( "configuration" ); $fieldmodel =$this->getModel( "field" ); $userid = $user->id; if ($userid == 0) { TTools::redirectToLogin(TLink::getProfileLink()); } else { $conf = $configurationmodel->getConfiguration(); if ((COMMUNITY_BUILDER == 1)||(JOMSOCIAL == 1)) { $app->redirect( TLink::getProfileLink() ); } else { $fields = $usermodel->getProfileFields(); $plugins = $fieldmodel->getPlugins(); $field_values = $fieldmodel->getFieldValues(); foreach($fields as $field) { if ($field->cbfieldvalues != "-1") { /*get CB value fields */ $cbfieldvalues = $fieldmodel->getCBFieldValues($field->cbfieldvalues); $field_values[$field->fieldid] = $cbfieldvalues; } } $field = new JHTMLAdsmanagerField($conf,$field_values,"1",$plugins); $user = $usermodel->getProfile($userid); $this->assignRef('field',$field); $this->assignRef('fields',$fields); $this->assignRef('user',$user); } } $dispatcher = JDispatcher::getInstance(); JPluginHelper::importPlugin('adsmanagercontent'); $event = new stdClass(); $results = $dispatcher->trigger('ADSonUserAfterForm', array ($user)); $event->onUserAfterForm = trim(implode("\n", $results)); $this->assignRef('event',$event); $document->setTitle( JText::_('ADSMANAGER_PAGE_TITLE')); parent::display($tpl); }
<div class="span12"> <?php if ($conf->display_list_search == 1) { ?> <div class="span6"> <?php if ($this->catid != 0) { ?> <form action="<?php echo TRoute::_('index.php?option=com_adsmanager&view=list&catid=' . $this->catid); ?> " method="post"> <?php } else { if ($this->modeuser == 1) { $userurl = TLink::getUserAdsLink($this->listuser); ?> <form action="<?php echo $userurl; ?> " method="post"> <?php } else { ?> <form action="<?php echo TRoute::_('index.php?option=com_adsmanager&view=list'); ?> " method="post"> <?php } }
} echo "<img alt='hot' src='" . getImagePath('hot.gif') . "' />"; $iconflag = true; } if ($iconflag == true) { echo "</div>"; } if (!isset($this->conf->display_column_date_date) || $this->conf->display_column_date_date == 1) { echo $this->reorderDate($content->date_created); } ?> <br /> <?php if ($content->userid != 0 && (!isset($this->conf->display_column_date_user) || $this->conf->display_column_date_user == 1)) { echo JText::_('ADSMANAGER_FROM') . " "; $target = TLink::getUserAdsLink($content->userid); if ($this->conf->display_fullname == 1) { echo "<a href='" . $target . "'>" . $content->fullname . "</a><br/>"; } else { echo "<a href='" . $target . "'>" . $content->user . "</a><br/>"; } } ?> <?php if (!isset($this->conf->display_column_date_view) || $this->conf->display_column_date_view == 1) { echo sprintf(JText::_('ADSMANAGER_VIEWS'), $content->views); } ?> <?php if (isset($this->conf->favorite_enabled) && $this->conf->favorite_enabled == 1 && ($this->conf->favorite_display == 'all' || $this->conf->favorite_display == 'list')) { ?>
if (isset($this->fDisplay[5])) { foreach ($this->fDisplay[5] as $field) { $c = $this->field->showFieldValue($this->content, $field); if ($c !== "" && $c !== null) { $title = $this->field->showFieldTitle(@$this->content->catid, $field); echo "<span class='f" . $field->name . "'>"; if ($title != "") { echo "<b>" . htmlspecialchars($title) . "</b>: "; } echo "{$c}<br/>"; echo "</span>"; } } } if ($this->content->userid != 0 && $conf->allow_contact_by_pms == 1) { echo TLink::getPMSLink($this->content); } } else { echo JText::_('ADSMANAGER_CONTACT_NO_RIGHT'); } } ?> </div> </div> </div> <div class="span4 adsmanager-images text-center"> <?php $this->loadScriptImage($this->conf->image_display); if (count($this->content->images) == 0) { $image_found = 0; } else {
function display($tpl = null) { $app = JFactory::getApplication(); $user = JFactory::getUser(); $pathway = $app->getPathway(); $document = JFactory::getDocument(); if ($user->id == 0) { TTools::redirectToLogin(TLink::getMyFavoritesLink()); return; } $contentmodel =$this->getModel( "content" ); $catmodel =$this->getModel( "category" ); $positionmodel =$this->getModel( "position" ); $columnmodel =$this->getModel( "column" ); $fieldmodel =$this->getModel( "field" ); $usermodel =$this->getModel( "user" ); $configurationmodel =$this->getModel( "configuration" ); $uri = JFactory::getURI(); $this->requestURL = $uri->toString(); // Get the parameters of the active menu item $menus = $app->getMenu(); $menu = $menus->getActive(); $conf = $configurationmodel->getConfiguration(); jimport( 'joomla.session.session' ); $currentSession = JSession::getInstance('none',array()); $currentSession->set("search_fields",""); $currentSession->set("searchfieldscatid",0); $currentSession->set("searchfieldssql"," 1 "); $currentSession->set("tsearch",""); $filters = array(); $tsearch = JRequest::getVar( 'tsearch', ''); if ($tsearch != "") { $filters['search'] = $tsearch; } $this->assignRef('tsearch',$tsearch); $username = $usermodel->getUser($user->id); $orderfields = $fieldmodel->getOrderFields(0); $this->assignRef('orders',$orderfields); $limitstart = JRequest::getInt("limitstart",0); $limit = $app->getUserStateFromRequest('com_adsmanager.front_ads_per_page','limit',$conf->ads_per_page, 'int'); $order = $app->getUserStateFromRequest('com_adsmanager.front_content.order','order',0,'int'); $orderdir = $app->getUserStateFromRequest('com_adsmanager.front_content.orderid','orderdir','DESC'); $orderdir = strtoupper($orderdir); if (($orderdir != "DESC") && ($orderdir != "ASC")) { $orderdir = "DESC"; } $filter_order = $contentmodel->getFilterOrder($order); $filter_order_dir = $orderdir; $this->assignRef('order',$order); $this->assignRef('orderdir',$orderdir); $total = $contentmodel->getNbContents($filters,0,$user->id); $contents = $contentmodel->getContents($filters,$limitstart, $limit,$filter_order,$filter_order_dir,0,$user->id); jimport('joomla.html.pagination'); $pagination = new JPagination($total, $limitstart, $limit); $this->assignRef('pagination',$pagination); $this->assignRef('list_name',$name); $this->assignRef('contents',$contents); $fields = $fieldmodel->getFields(); $this->assignRef('fields',$fields); $this->assignRef('conf',$conf); $this->assignRef('userid',$user->id); $document->setTitle( JText::_('ADSMANAGER_PAGE_FAVORITES')); $field_values = $fieldmodel->getFieldValues(); $plugins = $fieldmodel->getPlugins(); $field = new JHTMLAdsmanagerField($conf,$field_values,'1',$plugins); $this->assignRef('field',$field); $general = new JHTMLAdsmanagerGeneral(0,$conf,$user); $this->assignRef('general',$general); parent::display($tpl); }
function renew() { $app = JFactory::getApplication(); $contentid = JRequest::getInt('id', 0); $this->addModelPath(JPATH_ADMINISTRATOR . DS . 'components' . DS . 'com_adsmanager' . DS . 'models'); $contentmodel = $this->getModel("content"); $confmodel = $this->getModel("configuration"); $conf = $confmodel->getConfiguration(); $c = $contentmodel->getContent($contentid, false); if ($c == null) { exit; } if ($c->expiration_date == null) { exit; } $expiration_time = strtotime($c->expiration_date); $current_time = time(); if (function_exists("renewPaidAd")) { renewPaidAd($contentid); } else { if ($current_time < $expiration_time - $conf->recall_time * 3600 * 24) { $app->redirect(TRoute::_("index.php?option=com_adsmanager"), JText::_('ADSMANAGER_CONTENT_CANNOT_RESUBMIT'), 'message'); } $contentmodel->renewContent($contentid, $conf->ad_duration); } $cache = JFactory::getCache('com_adsmanager'); $cache->clean(); $app->redirect(TLink::getMyAdsLink(), JText::_('ADSMANAGER_CONTENT_RESUBMIT'), 'message'); }
echo "<h3>" . @$strtitle . "</h3>"; if ($this->showContact) { if (isset($this->fDisplay[5])) { foreach ($this->fDisplay[5] as $field) { $c = $this->field->showFieldValue($content, $field); if ($c !== "" && $c !== null) { $title = $this->field->showFieldTitle(@$content->catid, $field); echo "<span class='f" . $field->name . "'>"; if ($title != "") { echo "<b>" . htmlspecialchars($title) . "</b>: "; } echo "{$c}<br/>"; echo "</span>"; } } } if ($content->userid != 0 && $this->conf->allow_contact_by_pms == 1) { echo TLink::getPMSLink($content); } } else { echo JText::_('ADSMANAGER_CONTACT_NO_RIGHT'); } ?> </div> </div> <div class="adsmanager_spacer"></div> </div> </div> <hr/> <?php }
$orderlist = array(); // first pass - collect children foreach ($cc as $v) { $orderlist[$v->id] = $v; } $current_list[] = $catid; if ($catid != -1) { $current = $catid; while (isset($orderlist[$current]) && $orderlist[$current]->parent != 0) { $current_list[] = $orderlist[$current]->parent; $current = $orderlist[$current]->parent; } } } $link_show_profile = TLink::getProfileLink(); $link_show_user = TLink::getMyAdsLink(); $user = JFactory::getUser(); if ($rootid != 0) { $urlparamroot = "&rootid={$rootid}"; } else { $urlparamroot = ""; } $link_front = TRoute::_("index.php?option=com_adsmanager&view=front{$urlparamroot}"); $link_write_ad = TRoute::_("index.php?option=com_adsmanager&task=write{$urlparamroot}"); $link_show_rules = TRoute::_("index.php?option=com_adsmanager&view=rules{$urlparamroot}"); $link_show_all = TRoute::_("index.php?option=com_adsmanager&view=list{$urlparamroot}"); $link_favorites = TLink::getMyFavoritesLink(); require JModuleHelper::getLayoutPath('mod_adsmanager_menu', $params->get('layout', 'default')); $content = ""; $path = JPATH_ADMINISTRATOR . '/../libraries/joomla/database/table'; JTable::addIncludePath($path);
function display($tpl = null) { $app = JFactory::getApplication(); $user = JFactory::getUser(); $app = JFactory::getApplication(); $pathway = $app->getPathway(); $document = JFactory::getDocument(); $configurationmodel = $this->getModel("configuration"); $fieldmodel = $this->getModel("field"); $contentmodel = $this->getModel("content"); $catmodel = $this->getModel("category"); $usermodel = $this->getModel("user"); // Get the parameters of the active menu item $menus = $app->getMenu(); $menu = $menus->getActive(); $conf = $configurationmodel->getConfiguration(); if(!isset($conf->single_category_selection_type)) $conf->single_category_selection_type = 'normal'; $this->assignRef('conf',$conf); $fields = $fieldmodel->getFields(true,null,null,"fieldid","ASC",true,'write'); $this->assignRef('fields',$fields); $field_values = $fieldmodel->getFieldValues(); foreach($fields as $field) { if ($field->cbfieldvalues != "-1") { /*get CB value fields */ $cbfieldvalues = $fieldmodel->getCBFieldValues($field->cbfieldvalues); $field_values[$field->fieldid] = $cbfieldvalues; } } $this->assignRef('field_values',$field_values); $plugins = $fieldmodel->getPlugins(); $field = new JHTMLAdsmanagerField($conf,$field_values,"1",$plugins); $this->assignRef('field',$field); $errorMsg = JRequest::getString( 'errorMsg', "" ); $this->assignRef('errorMsg',$errorMsg); /* No need to user query, if errorMsg */ if ($errorMsg == "") { if ($conf->comprofiler == 0) { $profile = $usermodel->getProfile($user->id); } else if (COMMUNITY_BUILDER == 1) { $profile = $usermodel->getCBProfile($user->id); } else { $profile = new stdClass(); } $this->assignRef('default',$profile); } $contentid = JRequest::getInt( 'id', 0 ); // Update Ad ? if ($contentid > 0) { // edit ad $content = $contentmodel->getContent($contentid,false,1); //$content->ad_text = str_replace ('<br/>',"\r\n",$content->ad_text); if(!isset($this->isDuplicated)) $this->isDuplicated = 0; if ($user->id == 0) { $app->redirect( TRoute::_('index.php?option=com_adsmanager') ); } else if ($content->userid == $user->id) { if($this->isDuplicated == 1){ foreach($content->images as $image){ $src = 'images/com_adsmanager/ads/'.$image->image; $dest = 'images/com_adsmanager/ads/uploaded/'.$image->image; copy($src, $dest); } $content->id = 0; $isUpdateMode = 0; } else { $isUpdateMode = 1; } } else { $app->redirect(TLink::getMyAdsLink()); } } else { // insert $isUpdateMode = 0; } $this->assignRef('content',$content); if(isset($content->pendingdata->new_ad) && $content->pendingdata->new_ad == true) { $isUpdateMode = 0; } $this->assignRef('isUpdateMode',$isUpdateMode); $catid = JRequest::getInt('catid',0); // If Root cat is not allowed we must check that catid is correct $submit_allow = 1; if (($catid != 0)&&($conf->root_allowed == 0)) { $submit_allow = !$catmodel->isRootCategory($catid); } $this->assignRef('submit_allow',$submit_allow); if ($catid != 0) { if ($catmodel->isPublishedCategory($catid) == false) { $app->redirect( JRoute::_('index.php?option=com_adsmanager'),"Invalid Category selection","message"); return; } } if (($catid == 0)&&($isUpdateMode == 1)) { $catid = $content->cats[0]->catid; } $rootid = JRequest::getInt('rootid',0); $this->assignRef('rootid',$rootid); if ($catid != "0") { $category = $catmodel->getCategory($catid); $category->img = TTools::getCatImageUrl($catid,true); } else { $category = new stdClass(); $category->name = JText::_(""); $category->description = ""; $category->img = ""; } $this->assignRef('category',$category); $this->assignRef('catid',$catid); if (isset($content)) $extra = " - ".$content->ad_headline; else $extra = ""; $document->setTitle( JText::_('ADSMANAGER_PAGE_TITLE')." ".JText::_($category->name).$extra); $nbcats = $conf->nbcats; if (function_exists("getMaxCats")) { $nbcats = getMaxCats($conf->nbcats); } $this->assignRef('nbcats',$nbcats); if ($nbcats > 1) { $cats = $catmodel->getFlatTree(true, false, $nbContents, 'write',$rootid); } else { $rootid = JRequest::getInt('rootid',0); switch(@$conf->single_category_selection_type) { default: case 'normal': case 'color': case 'combobox': $cats = $catmodel->getFlatTree(true, false, $nbContents, 'write',$rootid); break; case 'cascade': $cats = $catmodel->getCategoriesPerLevel(true, false, $nbContents, 'write',$rootid); break; } } if(empty($cats)){ $app->redirect( JRoute::_('index.php?option=com_adsmanager&view=front&status=error'), JText::_('ADSMANAGER_NO_WRITE_RIGHT'),'message' ); } $this->assignRef('cats',$cats); if ($errorMsg != "") { //$post = (object) $_POST; $post = JRequest::get( 'post' ); $this->assignRef('default',$post); } if (($conf->submission_type == 2)&&($user->id == "0")) { $txt = JText::_('ADSMANAGER_WARNING_NEW_AD_NO_ACCOUNT'); $this->assignRef('warning_text',$txt); } switch($errorMsg) { case "bad_password": $txt = JText::_('ADSMANAGER_BAD_PASSWORD'); $this->assignRef('error_text',$txt); break; case "email_already_used": $txt = JText::_('ADSMANAGER_EMAIL_ALREADY_USED'); $this->assignRef('error_text',$txt); break; case "file_too_big": $txt = JText::_('ADSMANAGER_FILE_TOO_BIG'); $this->assignRef('error_text',$txt); break; default: if ($errorMsg != "") { $txt = $errorMsg; $this->assignRef('error_text',$txt); } } if (($conf->submission_type == 0)&&($user->id == 0)) { $account_creation = 1; } else $account_creation = 0; $this->assignRef('account_creation',$account_creation); $dispatcher = JDispatcher::getInstance(); JPluginHelper::importPlugin('adsmanagercontent'); $event = new stdClass(); $results = $dispatcher->trigger('ADSonContentAfterForm', array ($content)); $event->onContentAfterForm = trim(implode("\n", $results)); $this->assignRef('event',$event); if (PAIDSYSTEM) { if(isset($content->id)) { $db = JFactory::getDbo(); $db->setQuery( "SELECT * FROM #__paidsystem_ads WHERE id=".(int)$content->id ); $adext = $db->loadObject(); } else { $adext = new stdClass(); $adext->images = 0; } } else { $adext = new stdClass(); $adext->images = 0; } $this->assignRef('adext',$adext); parent::display($tpl); }
function deletefavorite() { $app = JFactory::getApplication(); $user = JFactory::getUser(); $mode = JRequest::getVar('mode', 0, 'integer'); //If mode is set to 1, it means if ($mode == 0) { if ($user->guest) { $app->redirect(Tlink::getMyFavoritesLink(), JText::_('ADSMANAGER_CONTENT_CANNOT_DELETE_FAVORITE'), 'error'); } $adId = JRequest::getInt('id', 0); if ($adId == 0) { echo 'error: Ad not selected'; exit; } } else { if ($user->guest) { echo 2; exit; } $adId = JRequest::getInt('adId', 0); if ($adId == 0) { echo 3; exit; } } $content = JTable::getInstance('contents', 'AdsmanagerTable'); $content->load($adId); $content->deleteFavorite($user->id, $mode); $app->redirect(TLink::getMyFavoritesLink(), JText::_('ADSMANAGER_CONTENT_DELETE_FAVORITE_SUCCESS'), 'message'); }