Fork me on GitHub

Rapport de message :*
 

Re: probleme de permission tinyeditor/smartsection

Titre du sujet : Re: probleme de permission tinyeditor/smartsection
par Anonyme sur 17/05/2007 15:40:52

Hi,

I found a solution for this problem. The problem this in archive XOOPS_ROOT_PATH/modules/tinyeditor/include/initcode.php and occurs in the hour to define the group of the user to show the buttons of the editor.

If the user to belong to the Webmaster group this problem does not occur, but if the user to belong to the Users group and other new groups, the code always defines the Users group as the group of the user.

To solve this problem I created a routine to detect optimum group for the user case it was part of more than 1 group.

Understands as better group for the user the group that has the biggest amount of allowed and active buttons and plugins.

Ok, let's go to the solution of the problem.

Open the cited file above in a text editor and change this:

if (is_object($xoopsUser)) {
        
$uid $xoopsUser->getVar('uid');
        
$thegroupid array_shift(getCurrentUsersGroups($uid));
    } else {
        
$thegroupid 3;
    }


to this:

$thegroupid $ctbuttons $oldctbtn 0;
    if (
is_object($xoopsUser)) {
      
$uid $xoopsUser->getVar('uid');
      
$groups $xoopsUser->getGroups($uid);
      if (
count($groups) > 1){
        if (
in_array(1,$groups)){
          
$thegroupid 1;
        }else{
          foreach (
$groups as $i=>$group){
              
$oldctbtn $ctbuttons;
            
$resultgetbuts $xoopsDB->query("SELECT tinyed_row1, tinyed_row2, tinyed_row3, activeplugs FROM ".$xoopsDB->prefix('tinyeditor_toolset')." WHERE tinyed_gid = ".intval($group)."");
            list(
$tinyed_row1$tinyed_row2$tinyed_row3$activeplugs) = $xoopsDB->fetchRow($resultgetbuts);
            
$ctbuttons strlen($tinyed_row1)+strlen($tinyed_row2)+strlen($tinyed_row3)+strlen($activeplugs);
            if (
$oldctbtn $ctbuttons){
              
$maior $i-1;
            }elseif (
$oldctbtn $ctbuttons){
              
$maior $i;
            }
          }
          
$thegroupid $groups[$maior];
        }
      }else{
        
$thegroupid $groups[0];
      }
    }else{
      
$thegroupid 3;
    }


With this alteration the editor detects the optimum group for the user and now enough to define the permissions desired for the groups that the buttons will go to appear.


I don't know to say if this is the best solution for the problem, probably not but... If somebody find a better solution please sends me the code, lol

Cheers

TheRplima
Propulsé avec XOOPS | Graphisme adapté par Tatane, Grosdunord, Montuy337513

14 Personne(s) en ligne (7 Personne(s) connectée(s) sur Forum) | Utilisateur(s): 0 | Invité(s): 14 | Plus ...