function display($cachable = false, $urlparams = false) { $app = JFactory::getApplication(); $document = JFactory::getDocument(); $user = JFactory::getUser(); if (!JRequest::getCmd('view')) { $default = 'front'; JRequest::setVar('view', $default); } if (version_compare(JVERSION, '3.0', 'ge')) { $viewLayout = $this->input->get('layout', 'default', 'string'); } else { $viewLayout = JRequest::getVar('layout', 'default', 'string'); } //$viewLayout = "ouacheteroutrouver:write"; $viewName = JRequest::getVar('view', 'front', 'default', 'cmd'); $type = JRequest::getVar('format', 'html', 'default', 'cmd'); $view = $this->getView($viewName, $type, '', array('layout' => $viewLayout)); if ($viewName == "edit") { $this->write(); return; } $uri = JFactory::getURI(); $baseurl = JURI::base(); $view->assign("baseurl", $baseurl); $view->assignRef("baseurl", $baseurl); // Push a model into the view $this->addModelPath(JPATH_ADMINISTRATOR . DS . 'components' . DS . 'com_adsmanager' . DS . 'models'); $contentmodel = $this->getModel("content"); $catmodel = $this->getModel("category"); $positionmodel = $this->getModel("position"); $columnmodel = $this->getModel("column"); $fieldmodel = $this->getModel("field"); $usermodel = $this->getModel("user"); $adsmanagermodel = $this->getModel("adsmanager"); $configurationmodel = $this->getModel("configuration"); $conf = $configurationmodel->getConfiguration(); loadAdsManagerCss(); if (!JError::isError($contentmodel)) { $view->setModel($contentmodel, true); } $view->setModel($contentmodel); $view->setModel($catmodel); $view->setModel($positionmodel); $view->setModel($columnmodel); $view->setModel($fieldmodel); $view->setModel($usermodel); $view->setModel($adsmanagermodel); $view->setModel($configurationmodel); if (ADSMANAGER_SPECIAL == "abrivac" && (JRequest::getCmd('view') == 'front' || JRequest::getCmd('view') == 'rules')) { return; } if ($conf->crontype == "onrequest") { $this->cron(); } if ($viewName == "details") { $contentid = JRequest::getInt('id', 0); $content = $contentmodel->getContent($contentid, false); // increment views. views from ad author are not counted to prevent highclicking views of own ad if ($user->id != $content->userid || $content->userid == 0) { $contentmodel->increaseHits($content->id); } } if ($viewName == "list" && $user->get('id') == 0 && JRequest::getInt('user', -1) == 0) { TTools::redirectToLogin("index.php?option=com_adsmanager&view=list&user="******"result") { parent::display(false); } else { if ($viewName == "list") { $cache = JFactory::getCache('com_adsmanager'); $method = array($view, 'display'); $session = JFactory::getSession(); $tsearch = JRequest::getVar('tsearch', $session->get('tsearch', '', 'adsmanager')); $limit = $conf->ads_per_page; $order = $app->getUserStateFromRequest('com_adsmanager.front_content.order', 'order', 0, 'int'); $mode = $app->getUserStateFromRequest('com_adsmanager.front_content.mode', 'mode', $conf->display_expand); $url = $uri->toString(); //Fix needed in case of cache activated otherwise addScript is not added by gmap module $conf = TConf::getConfig(); if (@$conf->display_map_list == 1) { $document = JFactory::getDocument(); $document->addScript(JURI::root() . 'components/com_adsmanager/js/jquery.cookie.js'); } echo $cache->call($method, null, $url, $tsearch, $limit, $order, $mode) . "\n"; } else { parent::display(true); } } } $path = JPATH_ADMINISTRATOR . '/../libraries/joomla/database/table'; JTable::addIncludePath($path); }
function display($cachable = false, $urlparams = false) { $app = JFactory::getApplication(); $document = JFactory::getDocument(); $user = JFactory::getUser(); if (!JRequest::getCmd('view')) { $default = 'front'; JRequest::setVar('view', $default); } $viewName = JRequest::getVar('view', 'front', 'default', 'cmd'); $type = JRequest::getVar('format', 'html', 'default', 'cmd'); $view = $this->getView($viewName, $type); if ($viewName == "edit") { $this->write(); return; } $uri = JFactory::getURI(); $baseurl = JURI::base(); $view->assign("baseurl", $baseurl); $view->assignRef("baseurl", $baseurl); if ($type == "html" && !defined('_ADSMANAGER_CSS')) { /** ensure that functions are declared only once */ define('_ADSMANAGER_CSS', 1); $uri = JFactory::getURI(); $baseurl = JURI::base(); $document = JFactory::getDocument(); $app = JFactory::getApplication(); $templateDir = JPATH_ROOT . '/templates/' . $app->getTemplate(); if (is_file($templateDir . '/html/com_adsmanager/css/adsmanager.css')) { $templateDir = JURI::base() . 'templates/' . $app->getTemplate(); $document->addStyleSheet($templateDir . '/html/com_adsmanager/css/adsmanager.css'); } else { $document->addStyleSheet($baseurl . 'components/com_adsmanager/css/adsmanager.css'); } } // Push a model into the view $this->addModelPath(JPATH_ADMINISTRATOR . DS . 'components' . DS . 'com_adsmanager' . DS . 'models'); $contentmodel = $this->getModel("content"); $catmodel = $this->getModel("category"); $positionmodel = $this->getModel("position"); $columnmodel = $this->getModel("column"); $fieldmodel = $this->getModel("field"); $usermodel = $this->getModel("user"); $adsmanagermodel = $this->getModel("adsmanager"); $configurationmodel = $this->getModel("configuration"); if (!JError::isError($contentmodel)) { $view->setModel($contentmodel, true); } $view->setModel($contentmodel); $view->setModel($catmodel); $view->setModel($positionmodel); $view->setModel($columnmodel); $view->setModel($fieldmodel); $view->setModel($usermodel); $view->setModel($adsmanagermodel); $view->setModel($configurationmodel); $conf = $configurationmodel->getConfiguration(); if (ADSMANAGER_SPECIAL == "abrivac" && (JRequest::getCmd('view') == 'front' || JRequest::getCmd('view') == 'rules')) { return; } if (file_exists(JPATH_BASE . '/components/com_adsmanager/cron.php')) { require_once JPATH_BASE . '/components/com_adsmanager/cron.php'; } if ($last_cron_date != date("Ymd")) { $contentmodel->manage_expiration($fieldmodel->getPlugins(), $conf); } if (function_exists("managePaidOption")) { managePaidOption(); } if ($viewName == "details") { $contentid = JRequest::getInt('id', 0); $content = $contentmodel->getContent($contentid, false); // increment views. views from ad author are not counted to prevent highclicking views of own ad if ($user->id != $content->userid || $content->userid == 0) { $contentmodel->increaseHits($content->id); } } if ($viewName == "list" && $user->get('id') == 0 && JRequest::getInt('user', -1) == 0) { TTools::redirectToLogin("index.php?option=com_adsmanager&view=list&user="******"result") { parent::display(false); } else { if ($viewName == "list") { $cache = JFactory::getCache('com_adsmanager'); $method = array($view, 'display'); $session = JFactory::getSession(); $tsearch = JRequest::getVar('tsearch', $session->get('tsearch', '', 'adsmanager')); $limit = $conf->ads_per_page; $order = $app->getUserStateFromRequest('com_adsmanager.front_content.order', 'order', 0, 'int'); $mode = $app->getUserStateFromRequest('com_adsmanager.front_content.mode', 'mode', $conf->display_expand); $url = $uri->toString(); echo $cache->call($method, null, $url, $tsearch, $limit, $order, $mode) . "\n"; } else { parent::display(true); } } } $path = JPATH_ADMINISTRATOR . '/../libraries/joomla/database/table'; JTable::addIncludePath($path); }
function display($cachable = false, $urlparams = false) { $app = JFactory::getApplication(); $document = JFactory::getDocument(); $user = JFactory::getUser(); if ( ! JRequest::getCmd( 'view' ) ) { $default = 'front'; JRequest::setVar('view', $default ); } if(version_compare(JVERSION, '3.0', 'ge')) { $viewLayout = $this->input->get('layout', 'default', 'string'); } else { $viewLayout = JRequest::getVar('layout', 'default', 'string'); } //$viewLayout = "ouacheteroutrouver:write"; $viewName = JRequest::getVar('view', 'front', 'default', 'cmd'); $type = JRequest::getVar('format', 'html', 'default', 'cmd'); $view = $this->getView($viewName,$type,'',array('layout' => $viewLayout)); if ($viewName == "edit") { $this->write(); return; } $uri = JFactory::getURI(); $baseurl = JURI::base(); $view->assign("baseurl",$baseurl); $view->assignRef("baseurl",$baseurl); // Push a model into the view $this->addModelPath(JPATH_ADMINISTRATOR.DS.'components'.DS.'com_adsmanager'.DS.'models'); $contentmodel =$this->getModel( "content" ); $catmodel =$this->getModel( "category" ); $positionmodel =$this->getModel( "position" ); $columnmodel =$this->getModel( "column" ); $fieldmodel =$this->getModel( "field" ); $usermodel =$this->getModel( "user" ); $adsmanagermodel=$this->getModel( "adsmanager" ); $configurationmodel =$this->getModel( "configuration" ); $conf = $configurationmodel->getConfiguration(); if (($type == "html")&&(!defined( '_ADSMANAGER_CSS' ))) { /** ensure that functions are declared only once */ define( '_ADSMANAGER_CSS', 1 ); $uri = JFactory::getURI(); $baseurl = JURI::base(); $document = JFactory::getDocument(); $app = JFactory::getApplication(); $templateDir = JPATH_ROOT . '/templates/' . $app->getTemplate(); if(!isset($conf->bootstrap_loading) || $conf->bootstrap_loading != 2){ if(@$conf->bootstrap_loading == 1) { $document->addStyleSheet($baseurl.'components/com_adsmanager/css/bootstrap.min.css'); //$document->addStyleSheet($baseurl.'components/com_adsmanager/css/bootstrap-responsive.min.css'); } else { $document->addStyleSheet($baseurl.'components/com_adsmanager/css/basestyle.css'); } } if (is_file($templateDir.'/html/com_adsmanager/css/adsmanager.css')) { $templateDir = JURI::base() . 'templates/' . $app->getTemplate(); $document->addStyleSheet($templateDir.'/html/com_adsmanager/css/adsmanager.css'); } else { $document->addStyleSheet($baseurl.'components/com_adsmanager/css/adsmanager.css'); } } if (!JError::isError( $contentmodel )) { $view->setModel( $contentmodel, true ); } $view->setModel( $contentmodel); $view->setModel( $catmodel); $view->setModel( $positionmodel); $view->setModel( $columnmodel); $view->setModel( $fieldmodel); $view->setModel( $usermodel); $view->setModel( $adsmanagermodel); $view->setModel( $configurationmodel); if ((ADSMANAGER_SPECIAL == "abrivac") && ((JRequest::getCmd( 'view' ) == 'front')||(JRequest::getCmd( 'view' ) == 'rules'))) return; if ($conf->crontype == "onrequest") { $this->cron(); } if ($viewName == "details") { $contentid = JRequest::getInt( 'id', 0 ); $content = $contentmodel->getContent($contentid,false); // increment views. views from ad author are not counted to prevent highclicking views of own ad if ( $user->id <> $content->userid || $content->userid==0) { $contentmodel->increaseHits($content->id); } } if (($viewName == "list")&&($user->get('id')==0)&&(JRequest::getInt( 'user', -1 ) == 0)) { TTools::redirectToLogin("index.php?option=com_adsmanager&view=list&user="******"result") { parent::display(false); } else if ($viewName == "list") { $cache = JFactory::getCache( 'com_adsmanager' ); $method = array( $view, 'display' ); $session = JFactory::getSession(); $tsearch = JRequest::getVar( 'tsearch', $session->get('tsearch','','adsmanager')); $limit = $conf->ads_per_page; $order = $app->getUserStateFromRequest('com_adsmanager.front_content.order','order',0,'int'); $mode = $app->getUserStateFromRequest('com_adsmanager.front_content.mode','mode',$conf->display_expand); $url = $uri->toString(); echo $cache->call( $method, null,$url,$tsearch,$limit,$order,$mode) . "\n"; } else { parent::display(true); } $path = JPATH_ADMINISTRATOR.'/../libraries/joomla/database/table'; JTable::addIncludePath($path); }