示例#1
0
if (version_compare(JVERSION, '1.6', '>=')) {
    //ACL
    if (!JFactory::getUser()->authorise('core.manage', 'com_adsmanager')) {
        return JError::raiseWarning(404, JText::_('JERROR_ALERTNOAUTHOR'));
    }
}
// Make sure the user is authorized to view this page
$user = JFactory::getUser();
/*if (!$user->authorize( 'com_adsmanager', 'manage' )) {
    $app = JFactory::getApplication();
	$app->redirect('index.php', JText::_('ALERTNOTAUTH'),'message');
}*/
// Component Helper
jimport('joomla.application.component.helper');
require_once JPATH_ROOT . "/components/com_adsmanager/lib/core.php";
JuloaLib::loadJqueryUI();
$controllerName = JRequest::getCmd('c', 'configuration');
require_once JPATH_COMPONENT . "/controllers/{$controllerName}.php";
$controllerName = 'AdsmanagerController' . $controllerName;
$lang = JFactory::getLanguage();
$lang->load("com_adsmanager", JPATH_ROOT);
// Create the controller
$controller = new $controllerName();
if (version_compare(JVERSION, '1.6.0', '>=')) {
    JHtml::_('behavior.framework');
    JSubMenuHelper::addEntry(JText::_('COM_ADSMANAGER_CONFIGURATION'), 'index.php?option=com_adsmanager&c=configuration');
    JSubMenuHelper::addEntry(JText::_('COM_ADSMANAGER_FIELDS'), 'index.php?option=com_adsmanager&c=fields');
    JSubMenuHelper::addEntry(JText::_('COM_ADSMANAGER_CONTENT_FORM'), 'index.php?option=com_adsmanager&c=contentform');
    JSubMenuHelper::addEntry(JText::_('COM_ADSMANAGER_COLUMNS'), 'index.php?option=com_adsmanager&c=columns');
    JSubMenuHelper::addEntry(JText::_('COM_ADSMANAGER_AD_DISPLAY'), 'index.php?option=com_adsmanager&c=positions');
    JSubMenuHelper::addEntry(JText::_('COM_ADSMANAGER_CATEGORIES'), 'index.php?option=com_adsmanager&c=categories');
示例#2
0
 function write($duplicate = false)
 {
     $app = JFactory::getApplication();
     $document = JFactory::getDocument();
     // Set the default view name from the Request
     $type = "html";
     $uri = JFactory::getURI();
     $baseurl = JURI::base();
     // Push a model into the view
     $this->addModelPath(JPATH_ADMINISTRATOR . DS . 'components' . DS . 'com_adsmanager' . DS . 'models');
     $configurationmodel = $this->getModel("configuration");
     $catmodel = $this->getModel("category");
     $contentmodel = $this->getModel("content");
     $positionmodel = $this->getModel("position");
     $fieldmodel = $this->getModel("field");
     $usermodel = $this->getModel("user");
     $user = JFactory::getUser();
     $conf = $configurationmodel->getConfiguration();
     loadAdsManagerCss();
     JuloaLib::loadJqueryUI();
     /* submission_type = 1 -> Account needed */
     if ($conf->submission_type == 1 && $user->id == "0") {
         TTools::redirectToLogin("index.php?option=com_adsmanager&task=write");
         return;
     } else {
         $contentid = JRequest::getInt('id', 0);
         $nbcontents = $contentmodel->getNbContentsOfUser($user->id);
         if ($contentid == 0 && $user->id != "0" && $conf->nb_ads_by_user != -1 && $nbcontents >= $conf->nb_ads_by_user) {
             //REDIRECT
             $redirect_text = sprintf(JText::_('ADSMANAGER_MAX_NUM_ADS_REACHED'), $conf->nb_ads_by_user);
             $app->redirect(TRoute::_('index.php?option=com_adsmanager&view=list'), $redirect_text, 'message');
         } else {
             $view = $this->getView("edit", 'html');
             $view->setModel($contentmodel, true);
             $view->setModel($catmodel);
             $view->setModel($configurationmodel);
             $view->setModel($fieldmodel);
             $view->setModel($usermodel);
             $view->setModel($positionmodel);
             $uri = JFactory::getURI();
             $baseurl = JURI::base();
             $view->assign("baseurl", $baseurl);
             if ($duplicate == true) {
                 $isDuplicated = 1;
                 $view->assign("isDuplicated", 1);
             }
             $view->display();
         }
     }
     $path = JPATH_ADMINISTRATOR . '/../libraries/joomla/database/table';
     JTable::addIncludePath($path);
 }