예제 #1
0
	static function getConfig() {
		if (!self::$_conf) {		
			include_once(JPATH_ROOT.'/administrator/components/com_adsmanager/models/configuration.php');
			$model = new AdsmanagerModelConfiguration();
			self::$_conf = $model->getConfiguration();
		}
		return self::$_conf;
	}
예제 #2
0
	function display($tpl = null)
	{
		jimport( 'joomla.session.session' );	
        $currentSession = JSession::getInstance('none',array());
        $defaultvalues = $currentSession->get("search_fields",array());

        $catid = $currentSession->get("searchfieldscatid",JRequest::getInt('catid', 0 ));
		$app = JFactory::getApplication();
        $text_search = $currentSession->get("tsearch",$app->getUserStateFromRequest('com_adsmanager.front_content.tsearch','tsearch',""));

        $type = "table";
		
        $fieldmodel  = new AdsmanagerModelField();
        $searchmodel  = new AdsmanagerModelSearchmodule();
        $field_values = array();
        $searchconfig = $searchmodel->getSearchModuleConfiguration();
        $simple_fields = $searchmodel->getSearchFields("simple");
        $advanced_fields = $searchmodel->getSearchFields("advanced");
        $field_values = $fieldmodel->getFieldValues();
		
        foreach($simple_fields as $field)
        {
            if ($field->cbfieldvalues != "-1")
            {
                /*get CB value fields */
                $cbfieldvalues = $fieldmodel->getCBFieldValues($field->cbfieldvalues);
                $field_values[$field->fieldid] = $cbfieldvalues;
            }
        }
        foreach($advanced_fields as $field)
        {
            if ($field->cbfieldvalues != "-1")
            {
                /*get CB value fields */
                $cbfieldvalues = $fieldmodel->getCBFieldValues($field->cbfieldvalues);
                $field_values[$field->fieldid] = $cbfieldvalues;
            }
        }

		
        $confmodel = new AdsmanagerModelConfiguration();
        $conf = $confmodel->getConfiguration();
		
        $categorymodel = new AdsmanagerModelCategory();
	
        $moduleclass_sfx = '';
		
        $search_by_cat = 1;
        $search_by_text = 0;
		
		
        $rootid = 0 ;
		
        switch($conf->single_category_selection_type) {
            default:
            case 'normal':
            case 'color':
            case 'combobox':
                $cats = $categorymodel->getFlatTree(true, false, $nbcontents, 'read',$rootid);
                break;
            case 'cascade':
                $cats = $categorymodel->getCategoriesPerLevel(true, false, $nbcontents, 'read',$rootid);
                break;
        }

        $baseurl = JURI::base();

        $field = new JHTMLAdsmanagerField($conf,$field_values,"2",$fieldmodel->getPlugins());//0 =>list

        $url = "index.php";
        $this->assignRef('search_by_cat',$search_by_cat);
        $this->assignRef('search_by_text',$search_by_text);
        $this->assignRef('text_search',$text_search);
        $this->assignRef('conf',$conf);
        $this->assignRef('cats',$cats);
        $this->assignRef('catid',$catid);
        $this->assignRef('simple_fields',$simple_fields);
        $this->assignRef('advanced_fields',$advanced_fields);
		$this->assignRef('field',$field);
        $this->assignRef('defaultvalues',$defaultvalues);
        $this->assignRef('rootid',$rootid);
		
		parent::display($tpl);
	}
예제 #3
0
 function createImageAndThumb($src_file, $image_name, $thumb_name, $max_width, $max_height, $max_width_t, $max_height_t, $tag, $path, $orig_name, $max_width_m = null, $max_height_m = null, $medium_name = null)
 {
     if (intval(ini_get('memory_limit')) < 64) {
         ini_set('memory_limit', '64M');
     }
     $configModel = new AdsmanagerModelConfiguration();
     $conf = $configModel->getConfiguration();
     $src_file = urldecode($src_file);
     $orig_name = strtolower($orig_name);
     $ext = strtolower(JFile::getExt($orig_name));
     switch ($ext) {
         case "jpg":
         case "jpeg":
             $type = "jpeg";
             break;
         case "png":
             $type = "png";
             break;
         case "gif":
             $type = "gif";
             break;
         default:
             return;
     }
     $dst_ext = strtolower(JFile::getExt($image_name));
     switch ($dst_ext) {
         case "jpg":
         case "jpeg":
             $dst_ext = "jpeg";
             break;
         case "png":
             $dst_ext = "png";
             break;
         case "gif":
             $dst_ext = "gif";
             break;
     }
     $max_h = $max_height;
     $max_w = $max_width;
     $max_thumb_h = $max_height_t;
     $max_thumb_w = $max_width_t;
     if (is_file("{$path}/{$image_name}")) {
         JFile::delete("{$path}/{$image_name}");
     }
     if (is_file("{$path}/{$thumb_name}")) {
         JFile::delete("{$path}/{$thumb_name}");
     }
     $read = 'imagecreatefrom' . $type;
     $write = 'image' . $type;
     $src_img = $read($src_file);
     // height/width
     $imginfo = getimagesize($src_file);
     $src_w = $imginfo[0];
     $src_h = $imginfo[1];
     //----------------------------------------------
     $zoom_h = $max_h / $src_h;
     $zoom_w = $max_w / $src_w;
     $zoom = min($zoom_h, $zoom_w);
     $dst_h = $zoom < 1 ? round($src_h * $zoom) : $src_h;
     $dst_w = $zoom < 1 ? round($src_w * $zoom) : $src_w;
     list($x, $y, $new_width, $new_height) = $this->getArea($src_w, $src_h, $max_width, $max_height);
     if (isset($conf->large_image_scaling) && $conf->large_image_scaling == 1) {
         $dst_img = imagecreatetruecolor($max_width, $max_height);
     } else {
         $dst_img = imagecreatetruecolor($dst_w, $dst_h);
     }
     if ($dst_ext == "jpeg") {
         $white = imagecolorallocate($dst_img, 255, 255, 255);
         imagefill($dst_img, 0, 0, $white);
     } else {
         imagealphablending($dst_img, false);
         imagesavealpha($dst_img, true);
     }
     if (isset($conf->large_image_scaling) && $conf->large_image_scaling == 1) {
         imagecopyresampled($dst_img, $src_img, 0, 0, $x, $y, $max_width, $max_height, $new_width, $new_height);
     } else {
         imagecopyresampled($dst_img, $src_img, 0, 0, 0, 0, $dst_w, $dst_h, $src_w, $src_h);
     }
     if (ADSMANAGER_SPECIAL == "thiago" && $tag != null) {
         $tag_file = JPATH_ROOT . "/images/toto.png";
         $tag_ext = strtolower(JFile::getExt($tag_file));
         switch ($tag_ext) {
             case "jpg":
             case "jpeg":
                 $tag_ext = "jpeg";
                 break;
             case "bmp":
                 $tag_ext = "wbmp";
                 break;
         }
         $cmd = 'imagecreatefrom' . $tag_ext;
         $load_image = $cmd($tag_file);
         $loadsize = getimagesize($tag_file);
         imagealphablending($load_image, false);
         imagesavealpha($load_image, true);
         $imageTag_w = $loadsize[0];
         $imageTag_h = $loadsize[1];
         $tagPosX = -5;
         $tagPosY = -5;
         if ($tagPosX < 0) {
             $tagPosX = $dst_w + $tagPosX - $imageTag_w;
         }
         if ($tagPosY < 0) {
             $tagPosY = $dst_h + $tagPosY - $imageTag_h;
         }
         imagecopy($dst_img, $load_image, $tagPosX, $tagPosY, 0, 0, $imageTag_w, $imageTag_h);
         imagedestroy($load_image);
     } else {
         if ($tag != null) {
             $textcolor = imagecolorallocate($dst_img, 255, 255, 255);
             $fontfile = JPATH_ROOT . "/components/com_adsmanager/font/verdana.ttf";
             if ($dst_ext != "jpeg") {
                 imagealphablending($dst_img, true);
                 imagettftext($dst_img, 10, 0, 5, 20, $textcolor, $fontfile, $tag);
                 imagealphablending($dst_img, false);
             } else {
                 imagettftext($dst_img, 10, 0, 5, 20, $textcolor, $fontfile, $tag);
             }
         }
     }
     if ($type == 'jpeg') {
         $desc_img = $this->createimage($write, $dst_img, "{$path}/{$image_name}", 100);
     } else {
         $desc_img = $this->createimage($write, $dst_img, "{$path}/{$image_name}", 0);
     }
     imagedestroy($dst_img);
     //-------------------------------------------
     $zoom_h = $max_thumb_h / $src_h;
     $zoom_w = $max_thumb_w / $src_w;
     $zoom = min($zoom_h, $zoom_w);
     $dst_thumb_h = $zoom < 1 ? round($src_h * $zoom) : $src_h;
     $dst_thumb_w = $zoom < 1 ? round($src_w * $zoom) : $src_w;
     //HACK
     //The getArea function me select a good range to cut the original images
     list($x, $y, $new_width, $new_height) = $this->getArea($src_w, $src_h, $max_width_t, $max_height_t);
     if (isset($conf->image_scaling) && $conf->image_scaling == 1) {
         $dst_t_img = imagecreatetruecolor($max_width_t, $max_height_t);
     } else {
         $dst_t_img = imagecreatetruecolor($dst_thumb_w, $dst_thumb_h);
     }
     if ($dst_ext == "jpeg") {
         $white = imagecolorallocate($dst_t_img, 255, 255, 255);
         imagefill($dst_t_img, 0, 0, $white);
     } else {
         imagealphablending($dst_t_img, false);
         imagesavealpha($dst_t_img, true);
     }
     if (isset($conf->image_scaling) && $conf->image_scaling == 1) {
         imagecopyresampled($dst_t_img, $src_img, 0, 0, $x, $y, $max_width_t, $max_height_t, $new_width, $new_height);
     } else {
         imagecopyresampled($dst_t_img, $src_img, 0, 0, 0, 0, $dst_thumb_w, $dst_thumb_h, $src_w, $src_h);
     }
     if (ADSMANAGER_SPECIAL == "thiago" && $tag != null) {
         $tag_file = JPATH_ROOT . "/images/toto.png";
         $tag_ext = strtolower(JFile::getExt($tag_file));
         switch ($tag_ext) {
             case "jpg":
             case "jpeg":
                 $tag_ext = "jpeg";
                 break;
             case "bmp":
                 $tag_ext = "wbmp";
                 break;
         }
         $cmd = 'imagecreatefrom' . $tag_ext;
         $load_image = $cmd($tag_file);
         $loadsize = getimagesize($tag_file);
         imagealphablending($load_image, false);
         imagesavealpha($load_image, true);
         $imageTag_w = $loadsize[0];
         $imageTag_h = $loadsize[1];
         $tagPosX = -5;
         $tagPosY = -5;
         if ($tagPosX < 0) {
             $tagPosX = $dst_thumb_w + $tagPosX - $imageTag_w;
         }
         if ($tagPosY < 0) {
             $tagPosY = $dst_thumb_h + $tagPosY - $imageTag_h;
         }
         imagecopy($dst_t_img, $load_image, $tagPosX, $tagPosY, 0, 0, $imageTag_w, $imageTag_h);
         imagedestroy($load_image);
     } else {
         if ($tag != null) {
             $textcolor = imagecolorallocate($dst_t_img, 255, 255, 255);
             $fontfile = JPATH_ROOT . "/components/com_adsmanager/font/verdana.ttf";
             if ($dst_ext != "jpeg") {
                 imagealphablending($dst_t_img, true);
                 imagettftext($dst_t_img, 7, 0, 5, 12, $textcolor, $fontfile, $tag);
                 imagealphablending($dst_t_img, false);
             } else {
                 imagettftext($dst_t_img, 7, 0, 5, 12, $textcolor, $fontfile, $tag);
             }
         }
     }
     if ($type == 'jpeg') {
         $desc_img = $this->createimage($write, $dst_t_img, "{$path}/{$thumb_name}", 100);
     } else {
         $desc_img = $this->createimage($write, $dst_t_img, "{$path}/{$thumb_name}", 0);
     }
     imagedestroy($dst_t_img);
     //-------------------------------------------
     if ($max_width_m != null) {
         $zoom_h = $max_height_m / $src_h;
         $zoom_w = $max_width_m / $src_w;
         $zoom = min($zoom_h, $zoom_w);
         $dst_medium_h = $zoom < 1 ? round($src_h * $zoom) : $src_h;
         $dst_medium_w = $zoom < 1 ? round($src_w * $zoom) : $src_w;
         list($x, $y, $new_width, $new_height) = $this->getArea($src_w, $src_h, $max_width_m, $max_height_m);
         if (isset($conf->medium_image_scaling) && $conf->medium_image_scaling == 1) {
             $dst_m_img = imagecreatetruecolor($max_width_m, $max_height_m);
         } else {
             $dst_m_img = imagecreatetruecolor($dst_medium_w, $dst_medium_h);
         }
         if ($dst_ext == "jpeg") {
             $white = imagecolorallocate($dst_m_img, 255, 255, 255);
             imagefill($dst_m_img, 0, 0, $white);
         } else {
             imagealphablending($dst_m_img, false);
             imagesavealpha($dst_m_img, true);
         }
         if (isset($conf->medium_image_scaling) && $conf->medium_image_scaling == 1) {
             imagecopyresampled($dst_m_img, $src_img, 0, 0, $x, $y, $max_width_m, $max_height_m, $new_width, $new_height);
         } else {
             imagecopyresampled($dst_m_img, $src_img, 0, 0, 0, 0, $dst_medium_w, $dst_medium_h, $src_w, $src_h);
         }
         if (ADSMANAGER_SPECIAL == "thiago" && $tag != null) {
             $tag_file = JPATH_ROOT . "/images/toto.png";
             $tag_ext = strtolower(JFile::getExt($tag_file));
             switch ($tag_ext) {
                 case "jpg":
                 case "jpeg":
                     $tag_ext = "jpeg";
                     break;
                 case "bmp":
                     $tag_ext = "wbmp";
                     break;
             }
             $cmd = 'imagecreatefrom' . $tag_ext;
             $load_image = $cmd($tag_file);
             $loadsize = getimagesize($tag_file);
             imagealphablending($load_image, false);
             imagesavealpha($load_image, true);
             $imageTag_w = $loadsize[0];
             $imageTag_h = $loadsize[1];
             $tagPosX = -5;
             $tagPosY = -5;
             if ($tagPosX < 0) {
                 $tagPosX = $dst_medium_w + $tagPosX - $imageTag_w;
             }
             if ($tagPosY < 0) {
                 $tagPosY = $dst_medium_h + $tagPosY - $imageTag_h;
             }
             imagecopy($dst_m_img, $load_image, $tagPosX, $tagPosY, 0, 0, $imageTag_w, $imageTag_h);
             imagedestroy($load_image);
         } else {
             if ($tag != null) {
                 $textcolor = imagecolorallocate($dst_m_img, 255, 255, 255);
                 $fontfile = JPATH_ROOT . "/components/com_adsmanager/font/verdana.ttf";
                 if ($dst_ext != "jpeg") {
                     imagealphablending($dst_m_img, true);
                     imagettftext($dst_m_img, 7, 0, 5, 12, $textcolor, $fontfile, $tag);
                     imagealphablending($dst_m_img, false);
                 } else {
                     imagettftext($dst_m_img, 7, 0, 5, 12, $textcolor, $fontfile, $tag);
                 }
             }
         }
         if ($type == 'jpeg') {
             $desc_img = $this->createimage($write, $dst_m_img, "{$path}/{$medium_name}", 100);
         } else {
             $desc_img = $this->createimage($write, $dst_m_img, "{$path}/{$medium_name}", 0);
         }
         imagedestroy($dst_m_img);
     }
     //exit();
 }
예제 #4
0
 function getDisplayTab($tab, $user, $ui)
 {
     require_once JPATH_ROOT . "/components/com_adsmanager/lib/core.php";
     $app = JFactory::getApplication();
     require_once JPATH_ROOT . '/administrator/components/com_adsmanager/models/adsmanager.php';
     require_once JPATH_ROOT . '/administrator/components/com_adsmanager/models/column.php';
     require_once JPATH_ROOT . '/administrator/components/com_adsmanager/models/category.php';
     require_once JPATH_ROOT . '/administrator/components/com_adsmanager/models/configuration.php';
     require_once JPATH_ROOT . '/administrator/components/com_adsmanager/models/content.php';
     require_once JPATH_ROOT . '/administrator/components/com_adsmanager/models/field.php';
     require_once JPATH_ROOT . '/administrator/components/com_adsmanager/models/position.php';
     require_once JPATH_ROOT . '/administrator/components/com_adsmanager/models/user.php';
     $juser = JFactory::getUser();
     if ($user->id == $juser->id) {
         $myads = true;
     } else {
         $myads = false;
     }
     if ($myads == true) {
         require_once JPATH_ROOT . '/components/com_adsmanager/views/myads/view.html.php';
     } else {
         require_once JPATH_ROOT . '/components/com_adsmanager/views/list/view.html.php';
     }
     if (file_exists(JPATH_ROOT . "/components/com_paidsystem/api.paidsystem.php")) {
         require_once JPATH_ROOT . "/components/com_paidsystem/api.paidsystem.php";
     }
     $uri = JFactory::getURI();
     $baseurl = JURI::base();
     $document = JFactory::getDocument();
     $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');
     }
     $contentmodel = new AdsmanagerModelContent();
     $catmodel = new AdsmanagerModelCategory();
     $positionmodel = new AdsmanagerModelPosition();
     $columnmodel = new AdsmanagerModelColumn();
     $fieldmodel = new AdsmanagerModelField();
     $usermodel = new AdsmanagerModelUser();
     $adsmanagermodel = new AdsmanagerModelAdsmanager();
     $configurationmodel = new AdsmanagerModelConfiguration();
     $catid = 0;
     $config = array();
     $config = array();
     $templateDir = JPATH_ROOT . '/templates/' . $app->getTemplate();
     if ($myads == true) {
         if (is_file($templateDir . '/html/com_adsmanager/myads/default.php')) {
             $config['template_path'] = JPATH_BASE . '/templates/' . $app->getTemplate() . '/html/com_adsmanager/myads';
         } else {
             $config['template_path'] = JPATH_BASE . '/components/com_adsmanager/views/myads/tmpl';
         }
         $view = new AdsmanagerViewMyads($config);
     } else {
         if (is_file($templateDir . '/html/com_adsmanager/list/default.php')) {
             $config['template_path'] = JPATH_BASE . '/templates/' . $app->getTemplate() . '/html/com_adsmanager/list';
         } else {
             $config['template_path'] = JPATH_BASE . '/components/com_adsmanager/views/list/tmpl';
         }
         $view = new AdsmanagerViewList($config);
     }
     $uri = JFactory::getURI();
     $requestURL = $uri->toString();
     $conf = $configurationmodel->getConfiguration();
     $filters = array();
     if ($myads == false) {
         $filters['publish'] = 1;
     }
     $filters['user'] = $user->id;
     $tsearch = JRequest::getVar('tsearch', '');
     if ($tsearch != "") {
         $filters['search'] = $tsearch;
     }
     $view->assignRef('tsearch', $tsearch);
     $showContact = TPermissions::checkRightContact();
     $view->assignRef('showContact', $showContact);
     $category = new stdClass();
     if ($conf->display_fullname) {
         $category->name = JText::_('ADSMANAGER_LIST_USER_TEXT') . " " . $user->name;
     } else {
         $category->name = JText::_('ADSMANAGER_LIST_USER_TEXT') . " " . $user->username;
     }
     $subcats = array();
     $pathlist = array();
     $orderfields = $fieldmodel->getOrderFields(0);
     $uri = JFactory::getURI();
     $baseurl = JURI::base();
     $view->assign("baseurl", $baseurl);
     $view->assignRef("baseurl", $baseurl);
     $view->assignRef('catid', $catid);
     $view->assignRef('listuser', $user->id);
     $modeuser = 1;
     $view->assignRef('modeuser', $modeuser);
     $tsearch = "";
     $view->assignRef('tsearch', $tsearch);
     $view->assignRef('orders', $orderfields);
     $view->assignRef('subcats', $subcats);
     $view->assignRef('pathlist', $pathlist);
     if (file_exists(JPATH_ROOT . '/components/com_sh404sef')) {
         $limit = $conf->ads_per_page;
     } else {
         $limit = $app->getUserStateFromRequest('com_adsmanager.front_ads_per_page', 'limit', $conf->ads_per_page, 'int');
     }
     $limitstart = JRequest::getInt("limitstart", 0);
     $order = $app->getUserStateFromRequest('com_adsmanager.front_content.order', 'order', 0, 'int');
     $orderdir = $app->getUserStateFromRequest('com_adsmanager.front_content.orderdir', 'orderdir', 'DESC');
     $orderdir = strtoupper($orderdir);
     if ($orderdir != "DESC" && $orderdir != "ASC") {
         $orderdir = "DESC";
     }
     $filter_order = $contentmodel->getFilterOrder($order);
     $filter_order_dir = $orderdir;
     $view->assignRef('order', $order);
     $view->assignRef('orderdir', $orderdir);
     $view->assignRef('lists', $lists);
     $total = $contentmodel->getNbContents($filters);
     $contents = $contentmodel->getContents($filters, $limitstart, $limit, $filter_order, $filter_order_dir, 1);
     if ($juser->guest == false) {
         $favorites = $contentmodel->getFavorites($juser->id);
     } else {
         $favorites = array();
     }
     $view->assignRef('favorites', $favorites);
     $userId = JRequest::getInt("user", 0);
     if ($userId != 0) {
         $userId = '&user='******'';
     }
     $pagination = new JPagination2($total, $limitstart, $limit, "index.php?option=com_comprofiler&tab=AdsmanagerTab&limit={$limit}" . $userId);
     $view->assignRef('pagination', $pagination);
     $view->assignRef('list_name', $category->name);
     $view->assignRef('list_img', $category->img);
     $view->assignRef('list_description', $category->description);
     $view->assignRef('contents', $contents);
     $mode = $app->getUserStateFromRequest('com_adsmanager.front_content.mode', 'mode', $conf->display_expand);
     if ($mode == 2) {
         $mode = 0;
     }
     $view->assignRef('mode', $mode);
     if ($mode == 0) {
         $columns = $columnmodel->getColumns($catid);
         $fcolumns = $fieldmodel->getFieldsbyColumns();
         $view->assignRef('columns', $columns);
         $view->assignRef('fColumns', $fcolumns);
     } else {
         $positions = $positionmodel->getPositions('details');
         $fDisplay = $fieldmodel->getFieldsbyPositions();
         $view->assignRef('positions', $positions);
         $view->assignRef('fDisplay', $fDisplay);
     }
     $fields = $fieldmodel->getFields();
     $view->assignRef('fields', $fields);
     //Unactive Map Display on User List because the loadModule function is not working on CB page (I don't know why)
     $conf->display_map_list = 0;
     $view->assignRef('conf', $conf);
     $my = JFactory::getUser();
     $view->assignRef('userid', $my->id);
     $view->assignRef('requestURL', $requestURL);
     $field_values = $fieldmodel->getFieldValues();
     $plugins = $fieldmodel->getPlugins();
     $field = new JHTMLAdsmanagerField($conf, $field_values, $mode, $plugins, null);
     $view->assignRef('field', $field);
     $general = new JHTMLAdsmanagerGeneral($catid, $conf, $user);
     $view->assignRef('general', $general);
     $return = $view->loadTemplate(null);
     $path = JPATH_ADMINISTRATOR . '/../libraries/joomla/database/table';
     JTable::addIncludePath($path);
     return $return;
 }
예제 #5
0
    }
}
$fieldmodel = new AdsmanagerModelField();
$field_values = array();
if ($listfields != "") {
    $searchfields = $fieldmodel->getFieldsByName($listfields);
    $field_values = $fieldmodel->getFieldValues();
    foreach ($searchfields as $field) {
        if ($field->cbfieldvalues != "-1") {
            /*get CB value fields */
            $cbfieldvalues = $fieldmodel->getCBFieldValues($field->cbfieldvalues);
            $field_values[$field->fieldid] = $cbfieldvalues;
        }
    }
}
$confmodel = new AdsmanagerModelConfiguration();
$conf = $confmodel->getConfiguration();
$categorymodel = new AdsmanagerModelCategory();
$rootid = (int) $params->def('rootid', 0);
$moduleclass_sfx = htmlspecialchars($params->get('moduleclass_sfx'));
$moduleId = $module->id;
switch (@$conf->single_category_selection_type) {
    default:
    case 'normal':
    case 'color':
    case 'combobox':
        $cats = $categorymodel->getFlatTree(true, false, $nbcontents, 'read', $rootid);
        break;
    case 'cascade':
        $cats = $categorymodel->getCategoriesPerLevel(true, false, $nbcontents, 'read', $rootid);
        break;