function selectCategories($id, $level, $children, &$catid, $root_allowed, $link, $current_cat_only = 0) { if (@$children[$id]) { foreach ($children[$id] as $row) { if ($root_allowed == 1 || !@$children[$row->id]) { if ($current_cat_only == 0) { ?> <option value="<?php echo TRoute::_("{$link}&catid=" . $row->id); ?> " <?php if ($row->id == $catid) { echo "selected='selected'"; } ?> > <?php echo $level . $row->name; ?> </option> <?php } else { if ($row->id == $catid) { echo $level . $row->name; } } } $this->selectCategories($row->id, $level . $row->name . " >> ", $children, $catid, $root_allowed, $link, $current_cat_only); } } }
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(); $contentid = JRequest::getInt( 'id', 0 ); if ($user->id == 0) { TTools::redirectToLogin("index.php?option=com_adsmanager&view=expiration&id=$contentid"); } $contentmodel =$this->getModel( "content" ); $configurationmodel =$this->getModel( "configuration" ); $conf = $configurationmodel->getConfiguration(); $content = $contentmodel->getContent($contentid,false); if (($content == null)||($content->userid != $user->id)) $app->redirect( TRoute::_('index.php?option=com_adsmanager') ); $this->assignRef('content',$content); $document->setTitle( JText::_('ADSMANAGER_PAGE_EXPIRATION')); parent::display($tpl); }
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 } }
/** * Create and return the pagination data object * * @access public * @return object Pagination data object * @since 1.5 */ function _buildDataObject() { // Initialize variables $data = new stdClass(); $data->all = new JPaginationObject(JText::_('View All')); if (!@$this->_viewall) { $data->all->base = '0'; $data->all->link = TRoute::_("{$this->url}&limitstart="); } // Set the start and previous data objects $data->start = new JPaginationObject(JText::_('Start')); $data->previous = new JPaginationObject(JText::_('Prev')); if ($this->get('pages.current') > 1) { $page = ($this->get('pages.current') -2) * $this->limit; $page = $page == 0 ? '' : $page; //set the empty for removal from route $data->start->base = '0'; $data->start->link = TRoute::_("{$this->url}&limitstart="); $data->previous->base = $page; $data->previous->link = TRoute::_("{$this->url}&limitstart=".$page); } // Set the next and end data objects $data->next = new JPaginationObject(JText::_('Next')); $data->end = new JPaginationObject(JText::_('End')); if ($this->get('pages.current') < $this->get('pages.total')) { $next = $this->get('pages.current') * $this->limit; $end = ($this->get('pages.total') -1) * $this->limit; $data->next->base = $next; $data->next->link = TRoute::_("{$this->url}&limitstart=".$next); $data->end->base = $end; $data->end->link = TRoute::_("{$this->url}&limitstart=".$end); } $data->pages = array(); $stop = $this->get('pages.stop'); for ($i = $this->get('pages.start'); $i <= $stop; $i ++) { $offset = ($i -1) * $this->limit; $offset = $offset == 0 ? '' : $offset; //set the empty for removal from route $data->pages[$i] = new JPaginationObject($i); if ($i != $this->get('pages.current') || @$this->_viewall) { $data->pages[$i]->base = $offset; $data->pages[$i]->link = TRoute::_("{$this->url}&limitstart=".$offset); } } return $data; }
static function getUserAdsLink($userid) { if (COMMUNITY_BUILDER_ADSTAB == 1) return JRoute::_("index.php?option=com_comprofiler&tab=adsmanagerTab&user="******"index.php?option=com_adsmanager&view=list&user=".$userid); }
function displayContents($contents, $nbimages) { $configurationmodel = $this->getModel("configuration"); $conf = $configurationmodel->getConfiguration(); ?> <h1 class="contentheading"><?php echo JText::_('ADSMANAGER_LAST_ADS'); ?> </h1> <div class='adsmanager_box_module' align="center"> <table class='adsmanager_inner_box' width="100%"> <?php $nb_cols = $conf->nb_last_cols; $col = 0; foreach ($contents as $row) { if ($col == 0) { echo '<tr align="center">'; } $col++; ?> <td> <?php $linkTarget = TRoute::_("index.php?option=com_adsmanager&view=details&id=" . $row->id . "&catid=" . $row->catid); if (isset($row->images[0])) { echo "<div align='center'><a href='" . $linkTarget . "'><img src='" . $this->get('baseurl') . "/images/com_adsmanager/ads/" . $row->images[0]->thumbnail . "' alt='" . htmlspecialchars($row->ad_headline) . "' border='0' /></a>"; } else { if ($conf->nb_images > 0) { echo "<div align='center'><a href='" . $linkTarget . "'><img src='" . ADSMANAGER_NOPIC_IMG . "' alt='nopic' border='0' /></a>"; } } echo "<br /><a href='{$linkTarget}'>" . $row->ad_headline . "</a>"; echo "<br /><span class=\"adsmanager_cat\">(" . htmlspecialchars($row->parent) . " / " . htmlspecialchars($row->cat) . ")</span>"; echo "<br />" . $this->reorderDate($row->date_created); echo "</div>"; ?> </td> <?php if ($col == $nb_cols) { echo "</tr>"; $col = 0; } } if ($col != 0) { echo "</tr>"; } ?> </table> </div> <br /> <?php }
/** * This function will redirect the current page to the joomla login page * @param URL $returnurl, after login redirect to this url */ static function redirectToLogin($returnurl="") { $app = JFactory::getApplication(); $returnurl = base64_encode(TRoute::_($returnurl,false)); if (COMMUNITY_BUILDER == 1) { $app->redirect(JRoute::_("index.php?option=com_comprofiler&task=registers")); } else { if(version_compare(JVERSION,'1.6.0','>=')){ //joomla 1.6 format $app->redirect( JRoute::_("index.php?option=com_users&view=login&return=$returnurl",false)); } else { //joomla 1.5 format $app->redirect( JRoute::_("index.php?option=com_user&view=login&return=$returnurl",false)); } } }
function displayMenuCats($id, $level, &$children, $current_list, $displaynumads, $rootid) { global $cur_template; $catid = JRequest::getInt('catid', -1); if (@$children[$id]) { foreach ($children[$id] as $row) { if ($row->id == $catid) { $class = "current active"; } else { if (@$current_list[count($current_list) - 1 - $level] == $row->id) { $class = "deeper parent active"; } else { $class = ""; } } ?> <li class="<?php echo $class; ?> "> <?php if ($rootid != 0) { $link = TRoute::_("index.php?option=com_adsmanager&view=list&rootid={$rootid}&catid=" . $row->id); } else { $link = TRoute::_("index.php?option=com_adsmanager&view=list&catid=" . $row->id); } if ($displaynumads == 1) { echo '<a href="' . $link . '" ><span>' . $row->name . ' (' . $row->num_ads . ')</span></a>'; } else { echo '<a href="' . $link . '" ><span>' . $row->name . '</span></a>'; } if (@$current_list[count($current_list) - 1 - $level] == $row->id) { echo "<ul>"; displayMenuCats($row->id, $level + 1, $children, $current_list, $displaynumads, $rootid); echo "</ul>"; } ?> </li> <?php } } }
/** * Prepare Mail Content, parse tags,etc.. * @param string $subject mail subject * @param string $body mail body * @param object $user Ad owner object * @param object $content Content Object * @param object $conf Adsmanager Configuration * @param string $usertype "admin" or "user" * @param string $type expiration|recall|new|update|validation|waiting_validation|option_expiration */ function prepareMail(&$subject, &$body, $user, $content, $conf, $usertype, $type) { $config = JFactory::getConfig(); $from = JOOMLA_J3 ? $config->get('mailfrom') : $config->getValue('config.mailfrom'); $fromname = JOOMLA_J3 ? $config->get('fromname') : $config->getValue('config.fromname'); $sitename = JOOMLA_J3 ? $config->get('sitename') : $config->getValue('config.sitename'); $dispatcher = JDispatcher::getInstance(); JPluginHelper::importPlugin('adsmanagercontent'); $results = $dispatcher->trigger('ADSonMailPrepare', array(&$subject, &$body, $user, $content, $conf, $usertype, $type)); $fieldmodel = new AdsmanagerModelField(); $fields = $fieldmodel->getFields(); $field_values = $fieldmodel->getFieldValues(); $plugins = $fieldmodel->getPlugins(); $baseurl = JURI::base(); $field = new JHTMLAdsmanagerField($conf, $field_values, 1, $plugins, '', $baseurl, null); foreach ($fields as $f) { $fvalue = ""; if (strpos($subject, "{" . $f->name . "}") !== false) { $fvalue = str_replace(array("<br/>", "<br />", "<br>"), "", $field->showFieldValue($content, $f)); $subject = str_replace("{" . $f->name . "}", $fvalue, $subject); } if (strpos($body, "{" . $f->name . "}") !== false) { if ($fvalue == "") { $fvalue = str_replace(array("<br/>", "<br />", "<br>"), "", $field->showFieldValue($content, $f)); } $body = str_replace("{" . $f->name . "}", $fvalue, $body); } } $subject = str_replace("{id}", $content->id, $subject); $body = str_replace("{id}", $content->id, $body); $subject = str_replace("{username}", $user->username, $subject); $body = str_replace("{username}", $user->username, $body); $subject = str_replace("{name}", $user->name, $subject); $body = str_replace("{name}", $user->name, $body); $subject = str_replace("{sitename}", $sitename, $subject); $body = str_replace("{sitename}", $sitename, $body); $uri = JURI::getInstance(); $root = $uri->toString(array('scheme', 'host', 'port')); if (!version_compare(JVERSION, '1.6.0', 'ge')) { $root = $root . '/'; } $link = $root . TRoute::_("index.php?option=com_adsmanager&view=details&catid=" . $content->catid . "&id=" . $content->id, false); $link = str_replace("administrator/", "", $link); $body = str_replace('{link}', $link, $body); $subject = str_replace("{expiration_date}", strftime(JText::_('ADSMANAGER_DATE_FORMAT_LC'), strtotime($content->expiration_date)), $subject); $body = str_replace("{expiration_date}", strftime(JText::_('ADSMANAGER_DATE_FORMAT_LC'), strtotime($content->expiration_date)), $body); }
/** * Wrapper to JRoute to handle itemid * We need to try and capture the correct itemid for different view */ static function _($url, $xhtml = true, $ssl = null) { static $itemid = array(); parse_str(JString::str_ireplace('index.php?', '', $url)); if (isset($option) && $option != 'com_adsmanager' && $option != 'com_paidsystem') { return JRoute::_($url, $xhtml, $ssl); } if (!isset($option)) { return JRoute::_($url, $xhtml, $ssl); } $urloption = $option; if ($urloption == 'com_adsmanager' && empty($view)) { $view = 'front'; } if ($urloption == 'com_paidsystem' && empty($view)) { $view = 'form'; } if (!empty($task) && ($task = 'write')) { $view = 'edit'; } if ($view == "expiration") { $view = "myads"; } if ($view == "details") { $view = "details" . $catid; $originalview = "details"; } else { $originalview = $view; } if (empty($itemid[$view])) { $currentItemid = JRequest::getInt('Itemid', 0); $isValid = false; $currentView = JRequest::getVar('view', 'front'); $currentOption = JRequest::getVar('option'); // If the current Itemid match the expected Itemid based on view // we'll just use it $db = JFactory::getDBO(); if ($originalview == "details") { $viewId = TRoute::_getDetailsItemid($catid, $urloption); } else { if ($originalview == "result") { $viewId = TRoute::_getResultViewItemid($view, $urloption); } else { $viewId = TRoute::_getViewItemid($view, $urloption); } } // if current itemid if ($viewId == 0 && $currentOption == $urloption && $currentView == $view && $currentItemid != 0) { $itemid[$view] = $currentItemid; $isValid = true; } else { if ($viewId === $currentItemid && !is_null($currentItemid) && $currentItemid != 0) { $itemid[$view] = $currentItemid; $isValid = true; } else { if ($viewId !== 0 && !is_null($viewId)) { $itemid[$view] = $viewId; $isValid = true; } } } if (!$isValid) { $id = TRoute::_getDefaultItemid($urloption); if ($id !== 0 && !is_null($id)) { $itemid[$view] = $id; } $isValid = true; } // Search the mainmenu for the 1st itemid of adsmanager we can find if (!$isValid) { $db = JFactory::getDBO(); $query = 'SELECT id FROM #__menu WHERE ' . 'link LIKE ' . $db->Quote('%' . $urloption . '%') . 'AND published =' . $db->Quote(1) . ' ' . 'AND menutype !=' . $db->Quote($config->get('toolbar_menutype')) . ' ' . 'AND type =' . $db->Quote('component'); $db->setQuery($query); $isValid = $db->loadResult(); if (!empty($isValid)) { $itemid[$view] = $isValid; } } // If not in mainmenu, seach in any menu if (!$isValid) { $query = 'SELECT id FROM #__menu WHERE ' . ' link LIKE ' . $db->Quote('%' . $urloption . '%') . ' AND published =' . $db->Quote(1) . ' ' . ' AND menutype !=' . $db->Quote($config->get('toolbar_menutype')) . ' ' . ' AND type =' . $db->Quote('component'); $db->setQuery($query); $isValid = $db->loadResult(); if (!empty($isValid)) { $itemid[$view] = $isValid; } } } $pos = strpos($url, '#'); if ($pos === false) { if (isset($itemid[$view])) { if (strpos($url, 'Itemid=') === false && strpos($url, $urloption) !== false) { $url .= '&Itemid=' . $itemid[$view]; } } } else { if (isset($itemid[$view])) { $url = str_ireplace('#', '&Itemid=' . $itemid[$view] . '#', $url); } } if (strpos($url, "rootid") === false) { $rootid = JRequest::getInt('rootid', 0); if ($rootid != 0) { $pos = strpos($url, '#'); if ($pos === false) { $url .= '&rootid=' . $rootid; } else { $url = str_ireplace('#', '&rootid=' . $rootid . '#', $url); } } } $data = JRoute::_($url, $xhtml, $ssl); return $data; }
function display($tpl = null) { $app = JFactory::getApplication(); $user = JFactory::getUser(); $pathway = $app->getPathway(); $document = JFactory::getDocument(); $contentmodel =$this->getModel( "content" ); $catmodel =$this->getModel( "category" ); $positionmodel =$this->getModel( "position" ); $fieldmodel =$this->getModel( "field" ); $configurationmodel =$this->getModel( "configuration" ); // Get the parameters of the active menu item $menus = $app->getMenu(); $menu = $menus->getActive(); $conf = $configurationmodel->getConfiguration(); $catid = JRequest::getInt( 'catid', 0 ); if ($catid != "0") { $category = $catmodel->getCategory($catid); $category->img = TTools::getCatImageUrl($catid,true); } else { $category = new stdClass(); $category->name = JText::_("ADSMANAGER_ALL_ADS"); $category->description = ""; $category->img = ""; } $rootid = JRequest::getInt('rootid',0); $pathlist = $catmodel->getPathList($catid,'read',$rootid); $this->assignRef('pathlist',$pathlist); $positions = $positionmodel->getPositions(); $fDisplay = $fieldmodel->getFieldsbyPositions(); $field_values = $fieldmodel->getFieldValues(); $contentid = JRequest::getInt( 'id', 0 ); $content = $contentmodel->getContent($contentid,false); if (($content->published == false)&&($content->userid != $user->id)) { if (ADSMANAGER_SPECIAL == 'sale') { require_once(JPATH_ROOT.'/administrator/components/com_sale/models/configuration.php'); $model = new SaleModelConfiguration(); $saleconf = $model->getConfiguration(); if ($content->userid != $saleconf->userid) { $app->redirect( TRoute::_('index.php?option=com_adsmanager&view=list&catid='.$catid)); } //Display Ad } else if (ADSMANAGER_SPECIAL == 'barter') { } else { //JError::raiseError(404, JText::_("Page Not Found")); $app->redirect( TRoute::_('index.php?option=com_adsmanager&view=list&catid='.$catid)); } } if ($content == null) $app->redirect( JRoute::_('index.php?option=com_adsmanager&view=front&status=error'), JText::_('ADSMANAGER_ADS_NO_RIGHT'),'message' ); if($user->guest == false){ $favorites = $contentmodel->getFavorites($user->id); } else { $favorites = array(); } $this->assignRef('favorites',$favorites); $showContact = TPermissions::checkRightContact(); $this->assignRef('showContact',$showContact); $this->assignRef('list_name',$category->name); $this->assignRef('list_img',$category->img); $this->assignRef('list_description',$category->description); $this->assignRef('positions',$positions); $this->assignRef('fDisplay',$fDisplay); $this->assignRef('conf',$conf); $this->assignRef('userid',$user->id); $fields = $fieldmodel->getFields(); $this->assignRef('fields',$fields); $document->setTitle( JText::_('ADSMANAGER_PAGE_TITLE')." ".JText::_($category->name)." - ".$content->ad_headline); //set breadcrumbs $pathlist = $catmodel->getPathList($catid,'read',$rootid); $nb = count($pathlist); for ($i = $nb - 1 ; $i >=0;$i--) { $pathway->addItem($pathlist[$i]->text, $pathlist[$i]->link); } // need to be before getMultiLangText $plugins = $fieldmodel->getPlugins(); if (ADSMANAGER_SPECIAL == "abrivac") { $pathway->addItem(getMultiLangText($content->ad_headline), "#"); } else { $pathway->addItem($content->ad_headline, "#"); } $field = new JHTMLAdsmanagerField($conf,$field_values,'1',$plugins); $this->assignRef('field',$field); $general = new JHTMLAdsmanagerGeneral($catid,$conf,$user); $this->assignRef('general',$general); // // Process the content plugins. // $dispatcher = JDispatcher::getInstance(); JPluginHelper::importPlugin('adsmanagercontent'); $results = $dispatcher->trigger('ADSonContentPrepare', array ($content)); $event = new stdClass(); $results = $dispatcher->trigger('ADSonContentAfterTitle', array ($content)); $event->onContentAfterTitle = trim(implode("\n", $results)); $results = $dispatcher->trigger('ADSonContentBeforeDisplay', array ($content)); $event->onContentBeforeDisplay = trim(implode("\n", $results)); $results = $dispatcher->trigger('ADSonContentAfterDisplay', array ($content)); $event->onContentAfterDisplay = trim(implode("\n", $results)); $content->event = $event; $this->assignRef('content',$content); if ($conf->metadata_mode == 'automatic') { if (ADSMANAGER_SPECIAL == "abrivac") { $content->metadata_description = getMultiLangText($content->ad_description); $content->metadata_keywords = str_replace(" ",",",getMultiLangText($content->ad_headline)); } else { $content->metadata_description = $content->ad_text; $content->metadata_keywords = str_replace(" ",",",$content->ad_headline); } } if($conf->image_display == 'jssor') { $tpl = 'jssor'; } parent::display($tpl); }
<?php /** * @package AdsManager * @copyright Copyright (C) 2010-2014 Juloa.com. All rights reserved. * @license GNU/GPL */ // Check to ensure this file is within the rest of the framework defined('JPATH_BASE') or die; ?> <div class="juloawrapper"> <?php echo sprintf(JText::_('ADSMANAGER_RENEW_AD_QUESTION'), $this->content->ad_headline, $this->content->expiration_date); $target = TRoute::_("index.php?option=com_adsmanager&task=renew&id=" . $this->content->id); ?> <div class="container-fluid"> <form action="<?php echo $target; ?> " method="post" class="form-horizontal" name="adminForm" enctype="multipart/form-data"> <?php if (function_exists("showPaidDuration")) { showPaidDuration($this->content); } else { ?> <div class="row-fluid"> <div class="span12"> <input type='submit' value='<?php echo JText::_('ADSMANAGER_RENEW_AD'); ?> ' />
} ?> ><?php echo JText::_('ADSMANAGER_MENU_ALL_ADS'); ?> </option> <?php $link = "index.php?option=com_adsmanager&view=search"; $this->selectCategories(0, "", $this->cats, $this->catid, 1, $link, 0); ?> </select> </td> </tr> </table> <?php $link = TRoute::_("index.php?option=com_adsmanager&view=result&catid=" . $this->catid); ?> <form action="<?php echo $link; ?> " method="post" id="adminForm"> <table> <?php foreach ($this->searchfields as $fsearch) { $title = $this->field->showFieldTitle($this->catid, $fsearch); echo "<tr id='tr_" . $fsearch->name . "'><td>" . htmlspecialchars($title) . "</td><td>"; $this->field->showFieldSearch($fsearch, $this->catid, null); echo "</td></tr>"; } ?>
$target = TLink::getUserAdsLink($content->userid); if ($conf->display_fullname == 1) echo "<a href='".$target."'>".$content->fullname."</a><br/>"; else echo "<a href='".$target."'>".$content->user."</a><br/>"; } ?> <?php echo sprintf(JText::_('ADSMANAGER_VIEWS'),$content->views); ?><br/> </td> <td class="tdcenter hidden-phone"> <?php $target = TRoute::_( "index.php?option=com_adsmanager&view=details&id=".$content->id."&catid=".$content->catid); echo "<a href='".$target."'>".JText::_('ADSMANAGER_CONTENT_OPEN_AD')."</a>"; echo "<br/>"; $target = TRoute::_("index.php?option=com_adsmanager&task=deletefavorite&catid=".$content->catid."&id=$content->id"); echo "<a onclick='return confirm(\"".htmlspecialchars(JText::_('ADSMANAGER_CONFIRM_DELETE_FAVORITE'),ENT_QUOTES)."\")' href='".$target."'>".JText::_('ADSMANAGER_CONTENT_DELETE_FAVORITE')."</a>"; ?> </td> </tr> <?php } ?> </table> </div> <div class="row-fluid"> <div class="span12"> <?php echo $this->pagination->getPagesLinks(); ?> </div> </div> <div class="row-fluid">
<?php /** * @package AdsManager * @copyright Copyright (C) 2010-2014 Juloa.com. All rights reserved. * @license GNU/GPL */ // Check to ensure this file is included in Joomla! defined('_JEXEC') or die('Restricted access'); ?> <div class="juloawrapper"> <div class="container-fluid"> <?php $link = TRoute::_("index.php?option=com_adsmanager&view=result"); ?> <form action="<?php echo $link; ?> " class="form-horizontal" id="advancedsearch-form" method="post"> <fieldset> <legend> <?php echo JText::_('ADSMANAGER_ADVANCED_SEARCH'); ?> </legend> <div class="row-fluid"> <?php if ($this->search_by_cat == 1) { ?> <div class="control-group"> <label class="control-label" for="catid"></label>
echo "<br/>"; $target = TRoute::_("index.php?option=com_adsmanager&task=duplicate&catid=" . $content->catid . "&id={$content->id}"); echo "<a href='" . $target . "'>" . JText::_('ADSMANAGER_CONTENT_DUPLICATE') . "</a>"; } if ($this->conf->expiration == 1) { if ($content->expiration_date != null) { $expiration_time = strtotime($content->expiration_date); $current_time = time(); if ($expiration_time - $current_time <= $conf->recall_time * 3600 * 24) { $target = TRoute::_("index.php?option=com_adsmanager&view=expiration&id={$content->id}"); echo "<br/><a href='" . $target . "'>" . JText::_('ADSMANAGER_RENEW_CONTENT') . "</a>"; } } } if (isset($this->topoption)) { $target = TRoute::_('index.php?option=com_paidsystem&task=bringtotop&id=' . $content->id); echo "<br/><a href='" . $target . "'>" . JText::_('PAIDSYSTEM_TOP_ONE_SHOT') . "</a>"; } ?> </td> </tr> <?php } ?> </table> <div class="pagelinks"><?php echo $this->pagination->getPagesLinks(); ?> </div> </form> <?php
function showFieldValue($content,$field) { $return = ""; if ((strpos($field->catsid, ",".$content->catid.",") !== false)||(strpos($field->catsid, ",-1,") !== false)) { if ($field->title) $name = $field->name; $options = $field->options; $values = array(); if ((!isset($options))|| (!isset($options->select_values_storage_type))|| ($options->select_values_storage_type == "internal")) { if (@$this->field_values[$field->fieldid]) { foreach ($this->field_values[$field->fieldid] as $k => $v) { //clone to avoid htmlspecial then htmlspecialchars again $values[$k] = clone $v; } } } else if ($options->select_values_storage_type == "db") { $dbname = $options->select_db_storage_db_name; $name = $options->select_db_storage_column_name; $value = $options->select_db_storage_column_value; //$parent = $options->select_db_storage_column_parent_value; $sql = "SELECT `$name` as fieldtitle,`$value` as fieldvalue FROM $dbname"; $this->_db->setQuery($sql); $values = $this->_db->loadObjectList(); } foreach($values as $key => $val) { $values[$key]->fieldtitle = htmlspecialchars(TText::_($val->fieldtitle)); } $fieldname = $field->name; $value = @TText::_($content->$fieldname); switch($field->type) { case 'checkbox': if (ADSMANAGER_SPECIAL == "abrivac") { if ($value == 1) { $return .= TText::_($field->title).""; } } else { if (($this->modetitle == 0) || (($field->type != 'checkbox')&&($field->display_title & $this->modetitle) == $this->modetitle)) { $return .= TText::_($field->title); if ($value == 1) $return .= ": ".TText::_('ADSMANAGER_YES').""; else $return .= ": ".TText::_('ADSMANAGER_NO').""; } else if ($value == 1) { $return .= TText::_($field->title).""; } } break; case 'multicheckbox': case 'multicheckboximage': $found = 0; for($i=0,$nb=count($values);$i < $nb ;$i++) { $fieldvalue = @$values[$i]->fieldvalue; $fieldtitle = @$values[$i]->fieldtitle; if (strpos($value, ",".$fieldvalue.",") !== false) { $return .= "<div class='multicheckboxfield'>"; if ($field->type == 'multicheckbox') $return .= TText::_($fieldtitle); else $return .= "<img src='".$this->baseurl."images/com_adsmanager/fields/".$fieldtitle."' alt='$fieldtitle' />"; $return .= "</div>"; } } break; case 'url': if ((isset($field->link_text))&&($field->link_text != "")) $linkObj = $field->link_text; else if ((isset($field->link_image))&&(file_exists(JPATH_BASE."/images/com_adsmanager/fields/".$field->link_image))) $linkObj = "<img src='".$this->baseurl."images/com_adsmanager/fields/".$field->link_image."' />"; else { $linkObj = $value; } if($options->nofollow){ $nofollow = " rel='nofollow'"; } else { $nofollow = ""; } if ($value != "") { $link = 'http://'.$value; $link = str_replace('http://http://', 'http://', $link); $link = str_replace('http://https://', 'https://', $link); $return .= "<a href='$link' target='_blank'$nofollow>$linkObj</a>"; } break; case 'date': $return .= $value; break; case 'select': foreach($values as $v) { if ($value == $v->fieldvalue) { $return .= TText::_($v->fieldtitle); } } break; case 'multiselect': $found = 0; foreach($values as $v) { if (strpos($value, ",".$v->fieldvalue.",") === false) { } else { if ($found == 1) $return .= "<br/>"; $return .= TText::_($v->fieldtitle); $found = 1; } } break; case 'emailaddress': if ($value != "") { switch($this->conf->email_display) { case 2: $emailForm = TRoute::_("index.php?option=com_adsmanager&view=message&contentid=".$content->id."&catid=".$content->catid."&fname=".$fieldname); $return .= '<a href="'.$emailForm.'">'.TText::_('ADSMANAGER_EMAIL_FORM').'</a>'; break; case 1: $return .= $this->Txt2Png($value); break; default: $return .= TText::_('ADSMANAGER_FORM_EMAIL').": <a href='mailto:".$value."'>".$value."</a>"; break; } } break; case 'textarea': $return .= str_replace(array("\r\n", "\n", "\r"), "<br />", $value); break; case 'editor': case 'number': case 'text': $return .= $value; break; case 'price': if (($value !== "")&&($value !== null)) { if($options == null || !isset($options->currency_symbol) || $options->currency_symbol == '') $price = sprintf(TText::_('ADSMANAGER_CURRENCY'),number_format(floatval($value), 2, '.', ' ')); else $price = $this->formatPrice($value, $options); //for Right to Left language $return .= str_replace(" "," ",$price); } break; case 'radio': case 'radioimage': for($i=0,$nb=count($values);$i < $nb ;$i++) { $fieldvalue = @$values[$i]->fieldvalue; $fieldtitle = @$values[$i]->fieldtitle; if ($value == $fieldvalue) { if ($field->type == 'radio') $return .= $fieldtitle; else $return .= "<img src='".$this->baseurl."images/com_adsmanager/fields/".$fieldtitle."' alt='$fieldtitle' />"; } } break; case 'file': if ($value != "") { $return .= "<a href='{$this->baseurl}images/com_adsmanager/files/$value'>".TText::_('ADSMANAGER_DOWNLOAD_FILE')."</a>"; } break; default: if (isset($this->plugins[$field->type])) { if ($this->mode == 0) $plug = $this->plugins[$field->type]->getListDisplay($content,$field ); else $plug = $this->plugins[$field->type]->getDetailsDisplay($content,$field ); $return .= $plug; } break; } } return $return; }
<th class="hidden-phone" width="15%"><?php echo JText::_('ADSMANAGER_DATE'); ?> <?php } ?> <?php /*<a href="<?php echo TRoute::_("index.php?option=com_adsmanager&view=list".$urloptions."&order=orderdir=ASC");?>"><img src="<?php echo $this->baseurl ?>administrator/images/sort_asc.png" alt="+" /></a> <a href="<?php echo TRoute::_("index.php?option=com_adsmanager&view=list".$urloptions."&order=orderdir=DESC");?>"><img src="<?php echo $this->baseurl ?>administrator/images/sort_desc.png" alt="-" /></a> */ ?> </th> </tr> <?php foreach ($this->contents as $content) { $linkTarget = TRoute::_("index.php?option=com_adsmanager&view=details&id=" . $content->id . "&catid=" . $content->catid); if (function_exists('getContentClass')) { $classcontent = getContentClass($content, "list"); } else { $classcontent = ""; } ?> <tr class="adsmanager_table_description <?php echo $classcontent; ?> trcategory_<?php echo $content->catid; ?> "> <td>
echo "$c<br/>"; } } }?> </div> </div> <div class="row-fluid"> <div class="span12"> <?php if (!empty($this->fDisplay[6])) { $strtitle = @JText::_($this->positions[5]->title); if ($strtitle != "") echo "<h2 class='section-header'>".@$strtitle."</h2>"; foreach($this->fDisplay[6] as $field) { $c = $this->field->showFieldValue($this->content,$field); if (($c !== "")&&($c !== null)) { $title = $this->field->showFieldTitle(@$this->content->catid,$field); if ($title != "") echo "<b>".htmlspecialchars($title)."</b>: "; echo "$c<br/>"; } } } ?> </div> </div> </div> <?php echo $this->content->event->onContentAfterDisplay; ?> <div align='center'> <a class="btn" href="<?php echo TRoute::_("index.php?option=com_adsmanager&task=write&pending=1&catid=".$this->content->catid."&id=".$this->content->id); ?>"><?php echo JText::_('ADSMANAGER_FORM_EDIT_TEXT'); ?></a> <a class="btn btn-primary" href="<?php echo TRoute::_("index.php?option=com_adsmanager&task=valid&id=".$this->content->id); ?>"><?php echo JText::_('ADSMANAGER_FORM_VALID_TEXT'); ?></a> </div>
/** * Generate content * @param object The article object. Note $article->text is also available * @param object The article params * @return string Returns html code or empty string. */ private function getContent($content) { $doc = JFactory::getDocument(); $currentView = JRequest::getWord("view"); if (version_compare(JVERSION, '1.6.0', '>=')) { $doc->addStyleSheet(JURI::base() . "plugins/adsmanagercontent/social/social/style.css"); } else { $doc->addStyleSheet(JURI::base() . "plugins/adsmanagercontent/social/style.css"); } $uri = JURI::getInstance(); $root = $uri->toString(array('scheme', 'host', 'port')); $url = $root . TRoute::_('index.php?option=com_adsmanager&view=details&id=' . $content->id . '&catid=' . $content->catid, false); $title = htmlentities($content->ad_headline, ENT_QUOTES, "UTF-8"); $head = "<meta property='og:title' content=\"" . htmlspecialchars($content->ad_headline) . "\" />\n"; $head .= "<meta property='og:url' content='{$url}' />\n"; $lang = JFactory::getLanguage(); $locales = $lang->getLocale(); if (count($locales) > 0) { $locale = str_replace('.utf8', '', $locales[0]); $head .= "<meta property='og:locale' content='" . $locale . "' />\n"; } $head .= "<meta property='og:description' content=\"" . htmlspecialchars($content->ad_text) . "\" />\n"; $config = TConf::getConfig(); if (count($content->images)) { $imageSize = $this->params->get("imageSize", "large"); switch ($imageSize) { case "thumbnail": $head .= "<meta property='og:image:width' content='" . $config->max_width_t . "'/>\n"; $head .= "<meta property='og:image:height' content='" . $config->max_height_t . "'/>\n"; break; case "medium": $head .= "<meta property='og:image:width' content='" . $config->max_width_m . "'/>\n"; $head .= "<meta property='og:image:height' content='" . $config->max_height_m . "'/>\n"; break; case "thumbnail": default: $head .= "<meta property='og:image:width' content='" . $config->max_width . "'/>\n"; $head .= "<meta property='og:image:height' content='" . $config->max_height . "'/>\n"; break; } } foreach ($content->images as $img) { $imageSize = $this->params->get("imageSize", "large"); switch ($imageSize) { case "thumbnail": $head .= "<meta property='og:image' content='" . JURI_IMAGES_FOLDER . "/" . $img->thumbnail . "'/>\n"; break; case "medium": $head .= "<meta property='og:image' content='" . JURI_IMAGES_FOLDER . "/" . $img->medium . "'/>\n"; break; case "thumbnail": default: $head .= "<meta property='og:image' content='" . JURI_IMAGES_FOLDER . "/" . $img->image . "'/>\n"; break; } } $doc->addCustomTag($head); // Start buttons box $html = ' <div class="itp-share">'; $html .= $this->getFacebookLike($this->params, $url, $title); $html .= $this->getTwitter($this->params, $url, $title); $html .= $this->getDigg($this->params, $url, $title); $html .= $this->getStumbpleUpon($this->params, $url, $title); $html .= $this->getBuzz($this->params, $url, $title); $html .= $this->getLinkedIn($this->params, $url, $title); $html .= $this->getGooglePlusOne($this->params, $url, $title); $html .= $this->getReTweetMeMe($this->params, $url, $title); $html .= $this->getYahooBuzz($this->params, $url, $title); $html .= $this->getFacebookShareMe($this->params, $url, $title); // Gets extra buttons $html .= $this->getExtraButtons($this->params, $url, $title); // End buttons box $html .= ' </div> <div style="clear:both;"></div> '; return $html; }
{ echo "<td></td>"; } ?> </tr> </table> </div> <?php } else { ?> <ul class="mostread<?php echo $moduleclass_sfx; ?>"> <?php if (isset($contents[0])) { foreach($contents as $row) { ?> <li class="mostread"> <?php $linkTarget = TRoute::_("index.php?option=com_adsmanager&view=details$urlparamroot&id=".$row->id."&catid=".$row->catid); echo "<div class='text-center'><a href='$linkTarget'>".$row->ad_headline."</a></div>"; if ($displaycategory == 1) echo "<div class='text-center'><span class=\"adsmanager-cat\">(".$row->parent." / ".$row->cat.")</span></div>"; if ($displaydate == 1) echo "<div class='text-center'>".reorderDate($row->date_created)."</div>"; ?> </li> <?php } } ?> </ul> <?php }
$target = TRoute::_("index.php?option=com_adsmanager&task=delete&catid=" . $content->catid . "&id={$content->id}"); echo "<a onclick='return confirm(\"" . htmlspecialchars(JText::_('ADSMANAGER_CONFIRM_DELETE'), ENT_QUOTES) . "\")' href='" . $target . "'>" . JText::_('ADSMANAGER_CONTENT_DELETE') . "</a>"; if (ADSMANAGER_SPECIAL == "duplicate") { echo "<br/>"; $target = TRoute::_("index.php?option=com_adsmanager&task=duplicate&catid=" . $content->catid . "&id={$content->id}"); echo "<a href='" . $target . "'>" . JText::_('ADSMANAGER_CONTENT_DUPLICATE') . "</a>"; } if ($this->conf->expiration == 1) { if ($content->expiration_date != null) { $expiration_time = strtotime($content->expiration_date); $current_time = time(); if ($expiration_time - $current_time <= $conf->recall_time * 3600 * 24) { if (function_exists('countRenewDurations') && countRenewDurations() > 1) { $target = TRoute::_("index.php?option=com_adsmanager&view=expiration&id={$content->id}"); } else { $target = TRoute::_("index.php?option=com_adsmanager&task=renew&id={$content->id}"); } echo "<br/><a href='" . $target . "'>" . JText::_('ADSMANAGER_RENEW_CONTENT') . "</a>"; } } } /*if (isset($this->topoption)) { $target = TRoute::_('index.php?option=com_paidsystem&task=bringtotop&id='.$content->id); echo "<br/><a href='".$target."'>".JText::_('PAIDSYSTEM_TOP_ONE_SHOT')."</a>"; }*/ ?> </td> </tr> <?php } ?>
} } ?> </div> </div> <div class="span4"> <?php echo '<div class="text-right">'; if ($this->content->userid != 0 && $this->userid == $this->content->userid) { ?> <div> <?php $target = TRoute::_("index.php?option=com_adsmanager&task=write&catid=" . $this->content->category . "&id=" . $this->content->id); echo "<a href='" . $target . "'>" . JText::_('ADSMANAGER_CONTENT_EDIT') . "</a>"; echo " "; $target = TRoute::_("index.php?option=com_adsmanager&task=delete&catid=" . $this->content->category . "&id=" . $this->content->id); echo "<a onclick='return confirm(\"" . htmlspecialchars(JText::_('ADSMANAGER_CONFIRM_DELETE'), ENT_QUOTES) . "\")' href='" . $target . "'>" . JText::_('ADSMANAGER_CONTENT_DELETE') . "</a>"; ?> </div> <?php } if (isset($this->conf->favorite_enabled) && $this->conf->favorite_enabled == 1 && ($this->conf->favorite_display == 'all' || $this->conf->favorite_display == 'details')) { echo '<div class="row-fluid adsmanager-favorite"> <div class="span12">'; $favoriteClass = ''; $favoriteLabel = JText::_('ADSMANAGER_CONTENT_FAVORITE'); if (array_search($this->content->id, $this->favorites) !== false) { $favoriteClass = ' like_active'; $favoriteLabel = JText::_('ADSMANAGER_CONTENT_FAVORITE_DELETEMSG'); } echo '<button id="like_' . $this->content->id . '" class="btn favorite_ads like_ad' . $favoriteClass . '">' . $favoriteLabel . '</button>';
<div class="controls"> <label class="checkbox"> <input type="checkbox" id="acceptrules" name="acceptrules" required value="1" /> <a href="<?php echo TRoute::_('index.php?option=com_adsmanager&view=rules')?>" target="_blank" > <?php echo htmlspecialchars(JText::_('ADSMANAGER_ACCEPT_RULES_CHECKBOX'))?> </a> </label> </div> </div> </div> </div> <?php } ?> <div class="row-fluid"><div class="span12"><hr/></div></div> <div class="row-fluid"> <div class="span12"> <input type="button" class="btn" onclick='window.location="<?php echo TRoute::_("index.php?option=com_adsmanager&view=list"); ?>"' value="<?php echo JText::_('ADSMANAGER_FORM_CANCEL_TEXT'); ?>" /> <?php if(isset($this->conf->preview_ads) && $this->conf->preview_ads != 0): ?> <input type="button" class="btn" onclick='submitpreview(adminForm);' value="<?php echo JText::_('ADSMANAGER_FORM_PREVIEW_TEXT'); ?>" /> <?php endif; ?> <input type="submit" class="btn btn-primary" value="<?php echo JText::_('ADSMANAGER_FORM_SUBMIT_TEXT'); ?>" /> </div> </div> <!-- buttons --> <?php } ?> <?php echo JHTML::_( 'form.token' ); ?> <!-- form --> <?php if (isset($this->content->date_created))
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'); }
?> <div class="span12"> <input name="tsearch" id="tsearch" placeholder="<?php echo JText::_('ADSMANAGER_LIST_SEARCH'); ?> " maxlength="20" alt="search" type="text" size="20" value="<?php echo $this->tsearch; ?> " onblur="if(this.value=='') this.value='';" onfocus="if(this.value=='<?php echo $this->tsearch; ?> ') this.value='';" /> </div> <div class="span12"> <a href="<?php echo TRoute::_("index.php?option=com_adsmanager&view=search&catid=" . $this->catid); ?> "><?php echo JText::_('ADSMANAGER_ADVANCED_SEARCH'); ?> </a> </div> </form> </div> <?php } ?> <?php if ($conf->display_list_sort == 1) { ?> <?php
</div> <?php if ($advanced_search == 1) { ?> <div class="<?php echo $class; ?> "> <div class="control-group"> <label class="control-label"><?php echo $searchLabel; ?> </label> <div class="controls"> <a href="<?php echo TRoute::_("index.php?option=com_adsmanager&view=search&catid={$catid}"); ?> "><?php echo JText::_('ADSMANAGER_ADVANCED_SEARCH'); ?> </a> </div> </div> </div> <?php } ?> </div> </form> <script type="text/javascript"> function updateModFields() {
function getPathList($catid, $mode = 'admin', $rootid = 0) { if ($catid == 0 && $rootid != 0) { $catid = $rootid; } $cats = $this->getCategories(true, $mode, $rootid); $orderlist = array(); $list = array(); if (isset($cats)) { foreach ($cats as $c) { $orderlist[$c->id] = $c; } if ($catid != -1 && $catid != $rootid) { $i = 0; $list[$i] = new stdClass(); if (ADSMANAGER_SPECIAL == "abrivac") { $list[$i]->text = sprintf(JText::_('ADSMANAGER_BREADCRUMBS'), $orderlist[$catid]->name); } else { $list[$i]->text = $orderlist[$catid]->name; } $list[$i]->link = TRoute::_('index.php?option=com_adsmanager&view=list&catid=' . $catid); $i++; $current = $catid; while ($orderlist[$current]->parent != $rootid && $orderlist[$current]->parent != 0) { $current = $orderlist[$current]->parent; $list[$i] = new stdClass(); if (ADSMANAGER_SPECIAL == "abrivac") { $list[$i]->text = sprintf(JText::_('ADSMANAGER_BREADCRUMBS'), $orderlist[$current]->name); } else { $list[$i]->text = JText::_($orderlist[$current]->name); } $list[$i]->link = TRoute::_('index.php?option=com_adsmanager&view=list&catid=' . $orderlist[$current]->id); $i++; } } } $nb = count($list); if (ADSMANAGER_SPECIAL != "abrivac") { $list[$nb] = new stdClass(); if ($catid == 0) { $list[$nb]->link = TRoute::_('index.php?option=com_adsmanager&view=front'); } else { $list[$nb]->link = TRoute::_('index.php?option=com_adsmanager&view=list'); } $list[$nb]->text = JText::_('ADSMANAGER_ROOT_TITLE'); } return $list; }
} ?> <?php if (ADSMANAGER_SPECIAL == "thiago") { ?> <td> <?php echo $content->ad_ip; ?> </td> <?php } ?> <td> <?php $target = TRoute::_($this->baseurl . "index.php?option=com_adsmanager&view=list&user="******"<a target='_blank' href='{$target}'>" . $content->user . "</a>"; ?> </td> <td><?php echo '<a href="index.php?option=com_adsmanager&c=contents&catid=' . $content->catid . '">' . $content->cat . '</a>'; ?> </td> <td><?php echo $content->date_created; ?> </td> <td><?php