@@ -163,7 +163,23 @@ class installer_dist extends installer_base {
if(!is_group($cf['vmail_groupname']))caselog($command.' &> /dev/null',__FILE__,__LINE__,"EXECUTED: $command","Failed to execute the command $command");
$used_assigned[]=$assigned_id;// for comparison with database
}else{
$new_tpl[]=$tpl_id;
}
}
if($old_style==true){
// we have to take care of this in an other way
$in_db=$app->db->queryAllRecords('SELECT `assigned_template_id`, `client_template_id` FROM `client_template_assigned` WHERE `client_id` = '.$clientId);
// add new template to client (includes those from old-style without assigned_template_id)
for($i=$count;$i>0;$i--){
$app->db->query('INSERT INTO `client_template_assigned` (`client_id`, `client_template_id`) VALUES ('.$clientId.', '.$tpl_id.')');
}
}elseif($count<0){
// remove old ones
for($i=$count;$i<0;$i++){
$app->db->query('DELETE FROM `client_template_assigned` WHERE client_id = '.$clientId.' AND client_template_id = '.$tpl_id.' LIMIT 1');
}
}
}
}else{
// we have to take care of this in an other way
$in_db=$app->db->queryAllRecords('SELECT `assigned_template_id`, `client_template_id` FROM `client_template_assigned` WHERE `client_id` = '.$clientId);
if(is_array($in_db)&&count($in_db)>0){
// check which templates were removed from this client
$app->log('Template processing key '.$k.' for client '.$clientId,LOGLEVEL_DEBUG);
$addTpls=$app->db->queryAllRecords('SELECT `client_template_id` FROM `client_template_assigned` WHERE `client_id` = '.$app->functions->intval($clientId));
foreach($addTplsas$addTpl){
$item=$addTpl['client_template_id'];
$sql="SELECT * FROM client_template WHERE template_id = ".$app->functions->intval($item);
$addLimits=$app->db->queryOneRecord($sql);
$app->log('Template processing subtemplate '.$item.' for client '.$clientId,LOGLEVEL_DEBUG);
/* maybe the template is deleted in the meantime */
if(is_array($addLimits)){
foreach($addLimitsas$k=>$v){
/* we can remove this condition, but it is easier to debug with it (don't add ids and other non-limit values) */