• Forum
  • Doc
  • Screenshots
  • Download
  • Donate
  • Contributors
  • Contact
  • Follow @phpfreechat
  • DEMO
  • Board index ‹ Version 1.x branch ‹ General Support (v1.x)
  • Change font size
  • FAQ
  • Register
  • Login

Remove the ability to \"remove\" the OP statut ?

Moderators: OldWolf, re*s.t.a.r.s.*2

Post a reply
6 posts • Page 1 of 1

Postby aquila » Fri Oct 07, 2011 4:45 pm

To continue with my last post, I have another (and I hope last) question about the administration : I saw in the how-to section the positibility to "remove the ability of other OP's to /kick or /ban you".
In the same way, I tried in the source code to remove the possibily for another OP to remove the "OP" statut of an nickname (administrator)

The section :

Code: Select all
  if ($nick == 'insert your user name here')
    {
      //not a good move
      $cmdp = $p;
      $cmdp["param"] = _pfc(" You know that is not going to happen, right? ");
      $cmd =& pfcCommand::Factory("error");
      $cmd->run($xml_reponse, $cmdp);
      return;
    }

... doesn't work, because there is no $nick variable... and I confess don't know how to reference it...

If you have an idea, thanks in advance, once again :D
aquila
New member
 
Posts: 5
Joined: Thu Oct 06, 2011 8:36 pm
Top

Postby re*s.t.a.r.s.*2 » Fri Oct 07, 2011 5:12 pm

hi,

What you only do is hardcode your admin nick,
Code: Select all
if ($nick == 'insert your user name here')

like so:

Code: Select all
if ($nick == 'aquila')

The $nick reference is set somewhere on top of the php document, if the variable has a string like your nick then , another admin is trying to take the admin flag off you...

Hope this is what you are looking for.

If doesn't work , post the whole op code here..

regards.
Free Singles Chat Rooms No Registration Required
Text and Chat Singles no need to register or app required
Sala De Bate Papo Online Grátis E Sem Cadastro
re*s.t.a.r.s.*2
Support Team
 
Posts: 612
Joined: Wed Sep 24, 2008 4:04 pm
Location: los angeles CA
  • Website
Top

Postby aquila » Fri Oct 07, 2011 5:50 pm

Hi :)

The problem is, in the deop.class.php file (It's the good file, right ?), the $nick variable is mentionned nowhere, and so, not initialized :

Code: Select all
<?php

require_once(dirname(__FILE__)."/../pfccommand.class.php");
class pfcCommand_deop extends pfcCommand
{
  var $usage = "/deop {nickname}";
 
  function run(&$xml_reponse, $p)
  {
    $c  =& pfcGlobalConfig::Instance();
    $u  =& pfcUserConfig::Instance();
    $ct =& pfcContainer::Instance();

    if (trim($p["param"]) == "")
    {
      // error
      $cmdp = $p;
      $cmdp["param"] = _pfc("Missing parameter");
      $cmdp["param"] .= " (".$this->usage.")";
      $cmd =& pfcCommand::Factory("error");
      $cmd->run($xml_reponse, $cmdp);
      return;
    }
    ça
    // just change the "isadmin" meta flag
    $nicktodeop   = trim($p["param"]);
    $nicktodeopid = $ct->getNickId($nicktodeop);
    $ct->setUserMeta($nicktodeopid, 'isadmin', false);

    $this->forceWhoisReload($nicktodeopid);
  }
}

?>

So, I don't see how I can define " if ($nick == 'bla bla bla') "

For exemple, in the kick.class.php, we have :

Code: Select all
    $nick   = isset($params[0]) ? $params[0] : '';

... and I don't know what to write here...

;)
aquila
New member
 
Posts: 5
Joined: Thu Oct 06, 2011 8:36 pm
Top

Postby re*s.t.a.r.s.*2 » Fri Oct 07, 2011 7:38 pm

OK,

I checked the command, is been long since I checked it..
See if this works for you!!.

Code: Select all
<?php

require_once(dirname(__FILE__)."/../pfccommand.class.php");

class pfcCommand_deop extends pfcCommand
{
  var $usage = "/deop {nickname}";
 
  function run(&$xml_reponse, $p)
  {
    $c  =& pfcGlobalConfig::Instance();
    $u  =& pfcUserConfig::Instance();
    $ct =& pfcContainer::Instance();

    $nickName = trim($p["param"]);

    if ($nickName == "")
    {
      // error
      $cmdp = $p;
      $cmdp["param"] = _pfc("Missing parameter");
      $cmdp["param"] .= " (".$this->usage.")";
      $cmd =& pfcCommand::Factory("error");
      $cmd->run($xml_reponse, $cmdp);
      return;
    }

  if ($nickName == "aquila")
    {
      // error
      $cmdp = $p;
      $cmdp["param"] = _pfc("You cant  ban %s is a protected admin..", $nickName);
      $cmd =& pfcCommand::Factory("error");
      $cmd->run($xml_reponse, $cmdp);
      return;
    }

    // just change the "isadmin" meta flag
    $nicktodeop   = trim($p["param"]);
    $nicktodeopid = $ct->getNickId($nicktodeop);
    $ct->setUserMeta($nicktodeopid, 'isadmin', false);

    $this->forceWhoisReload($nicktodeopid);
  }
}

?>

I just made that, didn't test please let me know if works...
Also there could be done as array parameter and create an array with nicks that arent allowed to be ban or kicked.. But let see if I do that in a contribution..

regards.
Free Singles Chat Rooms No Registration Required
Text and Chat Singles no need to register or app required
Sala De Bate Papo Online Grátis E Sem Cadastro
re*s.t.a.r.s.*2
Support Team
 
Posts: 612
Joined: Wed Sep 24, 2008 4:04 pm
Location: los angeles CA
  • Website
Top

Postby aquila » Fri Oct 07, 2011 8:24 pm

Your code is perfect, it works perfectly :D

Should I post something in the how-to section ?

Thanks again :D
aquila
New member
 
Posts: 5
Joined: Thu Oct 06, 2011 8:36 pm
Top

Postby re*s.t.a.r.s.*2 » Fri Oct 07, 2011 8:27 pm

Ok,

Thanks, If you want go ahead I am thinking of make it as parameter but I am not sure right now..

I am at work..

regards.
Free Singles Chat Rooms No Registration Required
Text and Chat Singles no need to register or app required
Sala De Bate Papo Online Grátis E Sem Cadastro
re*s.t.a.r.s.*2
Support Team
 
Posts: 612
Joined: Wed Sep 24, 2008 4:04 pm
Location: los angeles CA
  • Website
Top


Post a reply
6 posts • Page 1 of 1

Return to General Support (v1.x)

Who is online

Users browsing this forum: No registered users and 23 guests

  • Board index
  • The team • Delete all board cookies • All times are UTC + 1 hour
Powered by phpBB® Forum Software © phpBB Group
cron
Sign in
Wrong credentials
Sign up I forgot my password
.
jeu-gratuit.net | more partners
Fork me on GitHub