lange Ladezeiten im Kategorienbaum für User != sysadmin

Gesperrt
franky
Beiträge: 68
Registriert: Mi 31. Aug 2005, 08:55
Kontaktdaten:

lange Ladezeiten im Kategorienbaum für User != sysadmin

Beitrag von franky »

Ich habe folgendes Verhalten von Contenido schon in der alten Version festgestellt und jetzt gerade auf die neue Testweise geupdatet um zu schauen, ob der Bug jetzt weg ist:
Ich betreue ein großes Webprojekt mit ca. 400-500 Unterkategorien, welche jeweils mit Inhalt (Artikeln) gefüllt sind. Die ganze Administration läuft für den sysadmin akzeptabel schnell, jedoch bei anderen Usern für die Rechte vergeben wurden dauert der Aufbau des Kategorienbaumes statt ca. 5-6 Sek. leider eine knappe halbe Minute. Das ist super langsam und kann leider so nicht an den Kunden übergeben werden. Das "ausklappen" und "einklappen" von Kategorien (was auch Neuladen des Baumes bedeutet) dauert genau so lange :(.
Ich erkläre mir dieses Phänomen daher, dass für den Unteruser alle Rechte abgefragt werden müssen, welches beim sysadmin entfällt. Habe da ich ein Linux Server-System verwende schon die GetText-Funktion in der il8n.php deaktiviert, was auch eine Zeitverbesserung von ca. 20 Sekunden hervorgerufen hat (jetzt sind es aber immer noch 40 Sekunden)..
Kennt einer "Tuning-Maßnahmen" um dieses Rechte abfragen zu deaktivieren oder andere Maßnahmen zum Beschleunigen des Kategoriennaumes?
Im FrontEnd läuft alles nebenbei auch noch ganz gut. Nur ebend bei den Kundenaccounts (User) nicht.. Bräuchte dringend Hile :roll: :roll:
Vielen Dank schon im vorraus
emergence
Beiträge: 10653
Registriert: Mo 28. Jul 2003, 12:49
Wohnort: Austria
Kontaktdaten:

Re: lange Ladezeiten im Kategorienbaum für User != sysadmin

Beitrag von emergence »

franky hat geschrieben:Kennt einer "Tuning-Maßnahmen" um dieses Rechte abfragen zu deaktivieren oder andere Maßnahmen zum Beschleunigen des Kategoriennaumes?
ähm nicht wirklich...

ist aber ein intressanter fall den du hast...

du kannst dir ja mal die
conlib/perms.inc
function load_permissions_for_user
ansehen...

ich wüsste nicht wie man das noch beschleunigen sollte...
soweit ich weiss werden nach dem login diese berchtigungen für den user in der session gespeichert und nur dann erneuert wenn
$perm->load_permissions(true);
aufgerufen wird...
*** make your own tools (wishlist :: thx)
franky
Beiträge: 68
Registriert: Mi 31. Aug 2005, 08:55
Kontaktdaten:

Tuning Maßnahmen

Beitrag von franky »

also habe die Berechtigungen für den Tree herausgenommen, da diese den Seitenaufbau dermaßen verlangsamen (wenigstens bei meiner Kategorienanzahl). Hier mal der Source dazu, einfach den kompletten Inhalt der con_str_overview.php löschen und den hineinkopieren.. Beschleunigt um ca. 15-20 Sekunden.. mfg franky

Code: Alles auswählen

<?php

/******************************************
* File      :   includes.con_str_overview.php
* Project   :   Contenido
* Descr     :   Displays the structure in
*               the left frame.
*
* Author    :   Jan Lengowski
* Created   :   26.01.2003
* Modified  :   24.04.2003
*
* © four for business AG
*****************************************/

cInclude("classes","class.htmlelements.php");
cInclude("classes","class.ui.php");
cInclude("includes","functions.str.php");
cInclude("includes","functions.tpl.php");
cInclude('includes', 'functions.lang.php');

$db2 = new DB_Contenido;

$markscript = 'onmouseover="con.over(this)" onmouseout="con.out(this)" onclick="con.click(this)"';
function getExpandCollapseButton ($item)
{
	global $sess, $PHP_SELF, $frame, $area;
	$selflink = "main.php";
	
	$img = new cHTMLImage;
	
	if (count($item->subitems) > 0)
	{
		if ($item->collapsed == true)
		{
			$expandlink = $sess->url($selflink . "?area=$area&frame=$frame&expand=". $item->id);
			
			$img->setSrc($item->collapsed_icon);
			$img->setAlt("Open category");
			return(
				'<a href="'.$expandlink.'">'.$img->render().'</a>');
		} else {
			$collapselink = $sess->url($selflink . "?area=$area&frame=$frame&collapse=". $item->id);
			$img->setSrc($item->expanded_icon);
			$img->setAlt("Close category");			
			return(
				'<a href="'.$collapselink.'">'.$img->render().'</a>');
		}
	} else {
		return '<img src="images/spacer.gif" width="11" height="11">';
	}
}

if ($action == "con_synccat")
{
	strSyncCategory($syncidcat, $syncfromlang, $lang);
	$remakeStrTable = true;
}
	
if ( !is_object($db2) ) $db2 = new DB_Contenido;

if (!isset($remakeStrTable))
{
	$remakeStrTable = false;
}

if (!isset($remakeCatTable))
{
	$remakeCatTable = false;
}

$sess->register("remakeCatTable");
$sess->register("CatTableClient");
$sess->register("CatTableLang");
$sess->register("remakeStrTable");

if (isset($syncoptions))
{
	$syncfrom = $syncoptions;
	$remakeCatTable = true;
}

if (!isset($syncfrom))
{
	$syncfrom = 0;	
}

$sess->register("syncfrom");

$syncoptions = $syncfrom;

if (!isset($CatTableClient))
{
	$CatTableClient = 0;
}

if ($CatTableClient != $client)
{
	$remakeCatTable = true;
}

if (!isset($CatTableLang))
{
	$CatTableLang = 0;
}

if ($CatTableLang != $lang)
{
	$remakeCatTable = true;
}

$CatTableClient = $client;
$CatTableLang = $lang;

if ($syncoptions == -1)
{
    $sql = "SELECT
    			a.preid AS preid,
    			a.postid AS postid,
    			a.parentid AS parentid,
                c.idcat AS idcat,
                c.level AS level,
                b.name AS name,
                b.public AS public,
                b.visible AS online,
                d.idtpl AS idtpl,
				b.idlang AS idlang
            FROM
                ".$cfg["tab"]["cat"]." AS a,
                ".$cfg["tab"]["cat_lang"]." AS b,
                ".$cfg["tab"]["cat_tree"]." AS c
            LEFT JOIN
                ".$cfg["tab"]["tpl_conf"]." AS d
                ON d.idtplcfg = b.idtplcfg
            WHERE
                a.idclient  = '".$client."' AND
                b.idlang    = '".$lang."' AND
                c.idcat     = b.idcat AND
                b.idcat     = a.idcat
            ORDER BY
                c.idtree ASC";
} else {
    $sql = "SELECT
    			a.preid AS preid,
    			a.postid AS postid,
    			a.parentid AS parentid,
                c.idcat AS idcat,
                c.level AS level,
                b.name AS name,
                b.public AS public,
                b.visible AS online,
                d.idtpl AS idtpl,
				b.idlang AS idlang
            FROM
                ".$cfg["tab"]["cat"]." AS a,
                ".$cfg["tab"]["cat_lang"]." AS b,
                ".$cfg["tab"]["cat_tree"]." AS c
            LEFT JOIN
                ".$cfg["tab"]["tpl_conf"]." AS d
                ON d.idtplcfg = b.idtplcfg
            WHERE
                a.idclient  = '".$client."' AND
                (b.idlang    = '".$lang."' OR
				 b.idlang	 = '".$syncoptions."') AND
                c.idcat     = b.idcat AND
                b.idcat     = a.idcat
            ORDER BY
                c.idtree ASC";	
	
}

$db->query($sql);

if (isset($syncoptions))
{
	$remakeCatTable = true;
}

if (isset($online))
{
	$remakeCatTable = true;
}

if (isset($public))
{
	$remakeCatTable = true;
}

if (isset($idtpl))
{
	$remakeCatTable = true;
}

if (isset($force))
{
	$remakeCatTable = true;
}

function buildTree (&$rootItem, &$items)
{
	global $nextItem, $perm;
	
	while ($item_list = each($items))
	{
		
		list($key, $item) = $item_list;
		
		unset($newItem);
		$newItem = new TreeItem($item['name'], $item['idcat'],true);
	
		$newItem->custom['visible'] = $item['visible'];
		$newItem->custom['online'] = $item['visible'];
		$newItem->custom['idtpl'] = $item['idtpl'];
		$newItem->custom['public'] = $item['public'];
		$newItem->custom['level'] = $item['level'];
		$newItem->custom['parentid'] = $item['parentid'];
		$newItem->custom['public'] = $item['public'];
		$newItem->custom['preid'] = $item['preid'];
		
		if (array_key_exists("articles", $item))
		{
			$newItem->custom['articles'] = $item['articles'];
		} else {
			$newItem->custom['articles'] = array();
		}
		
		$newItem->custom['postid'] = $item['postid'];
		$newItem->custom['idlang'] = $item['idlang'];
		
		//if ($perm->have_perm_item("con", $item['idcat']))
		//{
			$newItem->custom['forcedisplay'] = 1;
		//}
		
		if (array_key_exists($key+1, $items))
		{
			$nextItem = $items[$key+1];
		}
		
		if (array_key_exists($key-1, $items))
		{
			$lastItem = $items[$key-1];
		}
		
		
		$rootItem->addItem($newItem);
	

		if ($nextItem['level'] > $item['level'])
		{
			$oldRoot = $rootItem;
			buildTree($newItem, $items);
			$rootItem = $oldRoot;
		}
		
		if ($nextItem['level'] < $item['level'])
		{
			return;
		}
		
	}
	
}	

$items = array();
$addedcats = array();
$count = 0;
while ($db->next_record())
{
	$entry = array();
	
	$entry['articles'] = false;

	if ($db->f("idlang") == $lang)
	{
    	$sql = "SELECT a.idart, idlang FROM ".$cfg["tab"]["art_lang"]." AS a,
    								  ".$cfg["tab"]["cat_art"]." AS b
    			WHERE b.idcat = '".$db->f("idcat")."' AND (a.idlang = '".$syncoptions."' OR a.idlang = '".$lang."') 
                AND b.idart = a.idart";
        $db2->query($sql);
        $arts = Array();
        
      	while ($db2->next_record())
      	{
      		$arts[$db2->f("idart")][$db2->f("idlang")] = 1;
      	}
      	
      	foreach ($arts as $idart => $entry)
      	{
      		if (is_array($entry))
      		{
          		if (!array_key_exists($lang,$entry))
          		{
          			$entry['articles'] = true;	
          			break;
          		}
      		}
      	}
        
	} 
		
	$entry['idcat'] = $db->f("idcat");
	$entry['level'] = $db->f("level");
	$entry['name'] = htmldecode($db->f("name"));
	$entry['public'] = $db->f("public");
	$entry['online'] = $db->f("online");
	$entry['idtpl'] = $db->f("idtpl");
	$entry['visible'] = $db->f("online");
	$entry['preid'] = $db->f("preid");
	$entry['postid'] = $db->f("postid");
	$entry['idlang'] = $db->f("idlang");
	$entry['parentid'] = $db->f("parentid");
	
	if (array_key_exists($db->f("idcat"),$addedcats))
	{
		if ($db->f("idlang") == $lang)
		{
			$items[$addedcats[$db->f("idcat")]] = $entry;	
		}
	} else {
		$count++;
		$addedcats[$db->f("idcat")] = $count;
		$items[$count] = $entry;
	}
}


$rootCatItem = new TreeItem("root",-1);
buildTree($rootCatItem, $items);

// slow account debug:
//print_r($items);
//flush();
//exit;

// Müssen erhalten bleiben!

$conexpandedList = unserialize($currentuser->getUserProperty("system","con_cat_expandstate"));
	
if (is_array($conexpandedList))
{
	$rootCatItem->markExpanded($conexpandedList);	
}	

if (isset($collapse) && is_numeric($collapse))
{
	$rootCatItem->markCollapsed($collapse);
}

if (isset($expand) && is_numeric($expand))
{
	$rootCatItem->markExpanded($expand);
}	

if (isset($expand) && $expand == "all")
{
	$rootCatItem->expandAll(-1);
}

if (isset($collapse) && $collapse == "all")
{
	$rootCatItem->collapseAll(-1);
}

// slow account debug:
//print_r($items);
//flush();
//exit;

	
$objects = array();

$rootCatItem->traverse($objects);

$conexpandedList = Array();
$rootCatItem->getExpandedList($conexpandedList); 

$currentuser->setUserProperty("system","con_cat_expandstate", serialize($conexpandedList));

$tpl->reset();

# create javascript multilink

if($auth->auth["uname"]=="sysadmin"){			# nachträglich hinzugefügt!

	$tmp_mstr = '<a href="javascript://" onclick="javascript:conMultiLink(\'%s\', \'%s\', \'%s\', \'%s\')">%s</a>';
	
	$mstr = sprintf($tmp_mstr, 'right_bottom',
	                           $sess->url("main.php?area=$area&frame=4&idcat=0"),
	                           'right_top',
	                           $sess->url("main.php?area=$area&frame=3&idcat=0"),
	                           'Lost and Found');
	
	$img_folder = '<img src="images/folder_on_error.gif">';
	
	$tpl->set('d', 'IMAGE',     $img_folder);
	$tpl->set('d', 'CFGDATA',   "");
	$tpl->set('d', 'BGCOLOR',   "");
	$tpl->set('d', 'INDENT',    0);
	$tpl->set('d', 'CAT',       $mstr);
	$tpl->set('d', 'COLLAPSE', '<img src="images/spacer.gif" width="11" height="11">');
	$tpl->set('d', 'MARK', 		$markscript);
	$tpl->set('d', 'DIRECTION', 'dir="' . langGetTextDirection($lang) . '"');
	$tpl->next();

}




$_cecIterator = $_cecRegistry->getIterator("Contenido.ArticleCategoryList.ListItems");

if ($_cecIterator->count() > 0)
{
	while ($chainEntry = $_cecIterator->next())
	{
	    $listItem = $chainEntry->execute();
	    
	    if (is_array($listItem))
	    {
		    if (!array_key_exists("expandcollapseimage", $listItem) || $listItem["expandcollapseimage"] == "")
		    {
				$collapseImage = '<img src="images/spacer.gif" width="11" height="11">';	    		
		    } else {
		    	$collapseImage = $listItem["expandcollapseimage"];	
		    }
		    
		    if (!array_key_exists("image", $listItem) || $listItem["image"] == "")
		    {
				$image = '<img src="images/spacer.gif" width="15" height="15">';	    		
		    } else {
		    	$image = $listItem["image"];	
		    }		
		    
		    if (!array_key_exists("id", $listItem) || $listItem["id"] == "")
		    {
				$id = rand();	    		
		    } else {
		    	$id = $listItem["id"];	
		    }	
		    
			if (array_key_exists("markable", $listItem))
		    {
				if ($listItem["markable"] == true)
				{
					$mmark = $markscript;	
				} else {
					$mmark = "";	
				}
		    } else {
		    	$mmark = "";
		    }	
		    	    		        
		    
			$tpl->set('d', 'IMAGE',     $image);
			$tpl->set('d', 'CAT',       $listItem["title"]);
			$tpl->set('d', 'COLLAPSE',  $collapseImage);
			$tpl->set('d', 'BGCOLOR',   $listItem["bgcolor"]);
			$tpl->set('d', 'CFGDATA',   $id);
			$tpl->set('d', 'INDENT',    $listItem["padding"]);
			$tpl->set('d', 'MARK',	$mmark);
			$tpl->set('d', 'DIRECTION', 'dir="' . langGetTextDirection($lang) . '"');
		    
			$tpl->next();
	    }	    
			    
	}
}


$tpl->set('d', 'COLLAPSE', '');
$tpl->set('d', 'CFGDATA',   "");
$tpl->set('d', 'IMAGE', '');
$tpl->set('d', 'CAT', '&nbsp;');
$tpl->set('d', 'MARK', '');
$tpl->set('d', 'DIRECTION', 'dir="' . langGetTextDirection($lang) . '"');
$tpl->set('d', 'BGCOLOR',   '#ffffff');
$tpl->set('d', 'INDENT',    0);
$tpl->next();


$languages = getLanguageNamesByClient($client);

if ((count($languages) > 1) && ($auth->auth["uname"] == "sysadmin"))
{
    $tpl->set('d', 'COLLAPSE', '');
    $tpl->set('d', 'IMAGE', '');
    $tpl->set('d', 'CFGDATA',   "");
    $tpl->set('d', 'MARK',		'');
    $tpl->set('d', 'INDENT',    0);
    $tpl->set('d', 'BGCOLOR',   '#ffffff');
    $tpl->set('d', 'CAT', "Syncronize from".":");
    $tpl->set('d', 'DIRECTION', 'dir="' . langGetTextDirection($lang) . '"');
    $tpl->next();
    $selectbox = new cHTMLSelectElement("syncoptions");
    
    
    
    $option = new cHTMLOptionElement("--- None ---", -1);
    $selectbox->addOptionElement(-1, $option);
    
    
    foreach ($languages as $languageid => $languagename)
    {
    	if ($lang != $languageid)
    	{
    		$option = new cHTMLOptionElement($languagename . " (".$languageid.")",$languageid);
    		$selectbox->addOptionElement($languageid, $option);
    	}
    }
    
    $selectbox->setDefault($syncoptions);
    $form = new UI_Form("syncfrom");
    $form->setVar("area",$area);
    $form->setVar("frame", $frame);
    $form->add("sel", '<td>'.$selectbox->render().'</td>');
    $form->add("submit", '<td>'.'<input type="image" value="submit" src="'.$cfg["path"]["contenido_fullhtml"].$cfg['path']['images'].'submit.gif">'.'</td>');

    $tpl->set('d', 'CAT', '<table border="0"><tr>'.$form->render().'</tr></table>');
    $tpl->set('d', 'COLLAPSE', '');
    $tpl->set('d', 'MARK',		'');
    $tpl->set('d', 'IMAGE', '');
    $tpl->set('d', 'INDENT',    0);
    $tpl->set('d', 'BGCOLOR',   '#ffffff');
    $tpl->set('d', 'CFGDATA',   '');
    $tpl->set('d', 'DIRECTION', 'dir="' . langGetTextDirection($lang) . '"');
    $tpl->next();

    $tpl->set('d', 'COLLAPSE', '');
    $tpl->set('d', 'IMAGE', '');
    $tpl->set('d', 'CAT', '&nbsp;');
    $tpl->set('d', 'CFGDATA',   "");
    $tpl->set('d', 'INDENT',    0);
    $tpl->set('d', 'MARK',		'');
    $tpl->set('d', 'BGCOLOR',   '#ffffff');
    $tpl->set('d', 'DIRECTION', 'dir="' . langGetTextDirection($lang) . '"');
    $tpl->next();
}


$selflink = "main.php";
$expandlink = $sess->url($selflink . "?area=$area&frame=$frame&expand=all&syncoptions=$syncoptions");
$collapselink = $sess->url($selflink . "?area=$area&frame=$frame&collapse=all&syncoptions=$syncoptions");
$collapseimg = '<a href="'.$collapselink.'" alt="Close all categories" title="Close all categories"><img src="images/but_minus.gif" border="0"></a>';
$expandimg = '<a href="'.$expandlink.'" alt=Open all categories" title="Open all categories"><img src="images/but_plus.gif" border="0"></a>';
$allLinks = $expandimg .'<img src="images/spacer.gif" width="3">'.$collapseimg;

$tpl->set('d', 'IMAGE',     '');
$tpl->set('d', 'DIRECTION', 'dir="' . langGetTextDirection($lang) . '"');
$tpl->set('d', 'CFGDATA',   '');
$tpl->set('d', 'BGCOLOR',   '#ffffff');
$tpl->set('d', 'INDENT',    0);
$tpl->set('d', 'CAT',       '&nbsp;');
$tpl->set('d', 'MARK',		'');
$tpl->set('d', 'COLLAPSE', $allLinks);
$tpl->next();





unset($objects[0]);
foreach ($objects as $key=>$value) {

//    if (
         
    	 /*$perm->have_perm_area_action("con", "con_makestart") ||
         $perm->have_perm_area_action("con", "con_makeonline") ||
         $perm->have_perm_area_action("con", "con_deleteart") ||
         $perm->have_perm_area_action("con", "con_tplcfg_edit") ||
         $perm->have_perm_area_action("con", "con_makecatonline") ||
         $perm->have_perm_area_action("con", "con_changetemplate") ||
         $perm->have_perm_area_action("con_editcontent", "con_editart") ||
         $perm->have_perm_area_action("con_editart", "con_edit") ||
         $perm->have_perm_area_action("con_editart", "con_newart") ||
         $perm->have_perm_area_action("con_editart", "con_saveart") ||
         $perm->have_perm_area_action_item("con", "con_makestart",$value->id) ||
         $perm->have_perm_area_action_item("con", "con_makeonline",$value->id) ||
         $perm->have_perm_area_action_item("con", "con_deleteart",$value->id) ||
         $perm->have_perm_area_action_item("con", "con_tplcfg_edit",$value->id) ||
         $perm->have_perm_area_action_item("con", "con_makecatonline",$value->id) ||
         $perm->have_perm_area_action_item("con", "con_changetemplate",$value->id) ||
         $perm->have_perm_area_action_item("con_editcontent", "con_editart",$value->id) ||
         $perm->have_perm_area_action_item("con_editart", "con_edit",$value->id) ||
         $perm->have_perm_area_action_item("con_editart", "con_newart",$value->id) ||
         $perm->have_perm_area_action_item("con_editart", "con_saveart",$value->id) ||*/
//       $value->isCustomAttributeSet("forcedisplay")) {

		if ($value->custom['parentid'] == 0)
		{			
            #$tpl->set('d', 'COLLAPSE', '');
			#$tpl->set('d', 'IMAGE', '');
			#$tpl->set('d', 'CAT', '&nbsp;');
			#$tpl->next();
		}
		
        $idcat = $value->id;
        $level = $value->level - 1;
        $name = $value->name;

        # Indent for every level
        $cnt = $value->level - 1;
        $indent = 0;

		$tpl->set('d', 'COLLAPSE', getExpandCollapseButton($value));
        for ($i = 0; $i < $cnt; $i ++) {
            # 12 px for every level
            $indent += 12;
        }

        # create javascript multilink
        $tmp_mstr = '<a href="javascript://" title="idcat'.': '.$idcat.'" onclick="javascript:conMultiLink(\'%s\', \'%s\', \'%s\', \'%s\')">%s</a>';

		$idtpl = ( $value->custom['idtpl'] != '' ) ? $value->custom['idtpl'] : 0;
		
        $mstr = sprintf($tmp_mstr, 'right_top',
                                   $sess->url("main.php?area=$area&frame=3&idcat=$idcat&idtpl=$idtpl"),
                                   'right_bottom',
                                   $sess->url("main.php?area=$area&frame=4&idcat=$idcat&idtpl=$idtpl"),
                                   $name);

		if (($value->custom["idlang"] != $lang) || ($value->custom['articles'] == true))
		{
	        $bgcolor = ( is_int($tpl->dyn_cnt / 2) ) ? $cfg["color"]["table_light_active"] : $cfg["color"]["table_dark_active"];
		} else {
			$bgcolor = ( is_int($tpl->dyn_cnt / 2) ) ? $cfg["color"]["table_light"] : $cfg["color"]["table_dark"];
		}


        //if ($perm->have_perm_area_action_item("con", "con_changetemplate",$value->id) ||
        //	$perm->have_perm_area_action("con", "con_changetemplate")) {
      		
            $changetemplate = 1;
            
      	//} else {
      	//	$changetemplate = 0;
      	//	
      	//}
      	
      	
      	//if ($perm->have_perm_area_action_item("con", "con_makecatonline",$value->id) ||
        //		    $perm->have_perm_area_action("con", "con_makecatonline"))
       	//{
       		$onoffline = 1;
       	//} else {
       	//	$onoffline = 0;
       	//}
       	
       	//if ($perm->have_perm_area_action_item("con", "con_makepublic",$value->id) ||
        //		    $perm->have_perm_area_action("con", "con_makepublic"))
		//{
			$makepublic = 1;
		//} else {
		//	$makepublic = 0;
		//}
       	
       	if ($value->custom["idlang"] == $lang)
       	{
           	/* Build cfgdata string */
            $cfgdata = $idcat."-".$idtpl."-".$value->custom['online']."-".$value->custom['public']."-".
            		   $changetemplate ."-".
            	       $onoffline ."-".
            	       $makepublic;
       	} else {
       		$cfgdata = "";
       	}       	

        # Select the appropriate folder-
        # image depending on the structure
        # properties
		if ($syncoptions == -1)
		{
			if ($cfg["is_start_compatible"] == true)
			{
                $sql2 = "SELECT
                            c.is_start AS is_start,
                            a.online AS online,
    						a.idlang AS idlang
                        FROM
                            ".$cfg["tab"]["art_lang"]." AS a,
                            ".$cfg["tab"]["art"]." AS b,
                            ".$cfg["tab"]["cat_art"]." AS c
                        WHERE
                            a.idlang = ".$lang." AND
                            a.idart = b.idart AND
                            b.idclient = '".$client."' AND
                            b.idart = c.idart AND
                            c.idcat = '".$idcat."'";
			} else {
                $sql2 = "SELECT
                            a.online AS online,
    						a.idlang AS idlang,
							a.idartlang AS idartlang
                        FROM
                            ".$cfg["tab"]["art_lang"]." AS a,
                            ".$cfg["tab"]["art"]." AS b,
                            ".$cfg["tab"]["cat_art"]." AS c
                        WHERE
                            a.idlang = ".$lang." AND
                            a.idart = b.idart AND
                            b.idclient = '".$client."' AND
                            b.idart = c.idart AND
                            c.idcat = '".$idcat."'";				
				
			}
		} else {
			if ($cfg["is_start_compatible"] == true)
			{
                $sql2 = "SELECT
                            c.is_start AS is_start,
                            a.online AS online,
    						a.idlang AS idlang
                        FROM
                            ".$cfg["tab"]["art_lang"]." AS a,
                            ".$cfg["tab"]["art"]." AS b,
                            ".$cfg["tab"]["cat_art"]." AS c
                        WHERE
                            a.idart = b.idart AND
                            b.idclient = '".$client."' AND
                            b.idart = c.idart AND
                            c.idcat = '".$idcat."'";
			} else {
                $sql2 = "SELECT
							a.idartlang AS idartlang,
                            a.online AS online,
    						a.idlang AS idlang
                        FROM
                            ".$cfg["tab"]["art_lang"]." AS a,
                            ".$cfg["tab"]["art"]." AS b,
                            ".$cfg["tab"]["cat_art"]." AS c
                        WHERE
                            a.idart = b.idart AND
                            b.idclient = '".$client."' AND
                            b.idart = c.idart AND
                            c.idcat = '".$idcat."'";				
			}
		}			
			
			

        $db2->query($sql2);

        $no_start   = true;
        $no_online  = true;

        while ( $db2->next_record() ) {

			if ($cfg["is_start_compatible"] == true)
			{
                if ( $db2->f("is_start") == 1 )
                {
                    $no_start = false;
                }
			} else {
				$no_start = isStartArticle($db->f("idartlang"), $idcat, $lang);
			}

            if ( $db2->f("online") == 1 ) {
                $no_online = false;
            }
        }

        if ( $value->custom['online'] == 1 ) {
            # Category is online

            if ( $value->custom['public'] == 0 ) {
                # Category is locked
                if ( $no_start || $no_online ) {
                    # Error found
                    $tmp_img = "folder_on_error_locked.gif";

                } else {
                    # No error found
                    $tmp_img = "folder_on_locked.gif";

                }

            } else {
                # Category is public
                if ( $no_start || $no_online ) {
                    # Error found
                    $tmp_img = "folder_on_error.gif";

                } else {
                    # No error found
                    $tmp_img = "folder_on.gif";

                }
            }

        } else {
            # Category is offline

            if ( $value->custom['public'] == 0 ) {
                # Category is locked
                if ( $no_start || $no_online ) {
                    # Error found
                    $tmp_img = "folder_off_error_locked.gif";

                } else {
                    # No error found
                    $tmp_img = "folder_off_locked.gif";

                }

            } else {
                # Category is public
                if ( $no_start || $no_online ) {
                    # Error found
                    $tmp_img = "folder_off_error.gif";

                } else {
                    # No error found
                    $tmp_img = "folder_off.gif";

                }
            }
        }

        $img_folder = sprintf('<img src="images/%s" width="15" height="13" alt="">', $tmp_img);
        
		if ($value->custom["idlang"] != $lang)
       	{
       		/* Fetch parent id and check if it is syncronized */
       		$sql = "SELECT parentid FROM %s WHERE idcat = '%s'";
       		$db->query(sprintf($sql, $cfg["tab"]["cat"], $idcat));
       		if ($db->next_record())
       		{
       			if ($db->f("parentid") != 0)
       			{
       				$parentid = $db->f("parentid");
       				$sql = "SELECT idcatlang FROM %s WHERE idcat = '%s' AND idlang = '%s'";
       				$db->query(sprintf($sql, $cfg["tab"]["cat_lang"], $parentid, $lang));
       				
       				if ($db->next_record())
       				{
						$img_folder .= sprintf('<a href="%s"><img src="images/%s" alt="%s" title="%s"></a>', $sess->url("main.php?area=$area&frame=$frame&action=con_synccat&syncfromlang=$syncoptions&syncidcat=$idcat"), "pfeil_links.gif", "Copy to current language","Copy to current language");       					
       				}
       				
       			} else {
       				$img_folder .= sprintf('<a href="%s"><img src="images/%s" alt="%s" title="%s"></a>', $sess->url("main.php?area=$area&frame=$frame&action=con_synccat&syncfromlang=$syncoptions&syncidcat=$idcat"), "pfeil_links.gif", "Copy to current language", "Copy to current language");	
       			}
       		}
       		
       		
       		
       	}

        $tpl->set('d', 'IMAGE',     $img_folder);
        $tpl->set('d', 'CFGDATA',   $cfgdata);
        $tpl->set('d', 'BGCOLOR',   $bgcolor);
        $tpl->set('d', 'INDENT',    $indent);
        $tpl->set('d', 'CAT',       $mstr);
        $tpl->set('d', 'MARK',		$markscript);
        
        // DIRECTION
		$tpl->set('d', 'DIRECTION', 'dir="' . langGetTextDirection($lang) . '"');
        
        $tpl->next();

//    } // end if have_perm

} // end while

$tpl->generate($cfg['path']['templates'] . $cfg['templates']['con_str_overview']);

?>

emergence
Beiträge: 10653
Registriert: Mo 28. Jul 2003, 12:49
Wohnort: Austria
Kontaktdaten:

Beitrag von emergence »

ich hab mir das ganze jetzt noch mal durchgelesen...

ähm welche contenido version war das nochmal ?
in deiner signatur steht 4.5.4 , das kannst aber nicht sein, wenn der thread sich in misc 4.6.x befindet...

zu deiner lösung, das ist leider nur ein workaround, der die symptome behebt, aber nicht das eigentliche problem...

das eigentliche problem ist ja -> warum ist das so langsam...

wenn es eine 4.6.x version ist, tippe ich auf das hier -> http://contenido.org/forum/viewtopic.php?t=10188
*** make your own tools (wishlist :: thx)
Gesperrt