Exemple #1
0
function xml_firstauth($p)
{
    // just sends back a string
    $login = $p->getParam(0);
    $login = $login->scalarval();
    $password = $p->getParam(1);
    $password = $password->scalarval();
    $bot = bot_get_bylogin($login, $password);
    if (!$bot) {
        return new xmlrpcresp(new xmlrpcval("Oo"));
    }
    $authstring = md5(time() . $bot['botid'] . rand(1, 100) . "kibocenter botmanagement");
    bot_firstauth($bot['botid'], $authstring);
    return new xmlrpcresp(new xmlrpcval($authstring));
}
Exemple #2
0
 /**
  \brief IRC bot bearbeiten
 
  Ändert die Daten von einem IRC Bot
 */
 function Bot_edit()
 {
     if (!$this->userdata['rights']['bots']) {
         #no permission
         $this->_header("", "no permission");
     }
     $id = param_num("id");
     if (!$id) {
         $this->_header();
     }
     $bot = bot_get($id);
     if (!$bot) {
         $this->_header();
     }
     $data = $_SESSION['steps'];
     #information message, step 2
     if ($data['editbot']) {
         #save step
         unset($data['editbot']);
         $_SESSION['steps'] = $data;
         $this->forms['information']['url'] = $this->backtracking->backlink();
         $this->forms['information']['title'] = "IRC Bot bearbeiten";
         $this->forms['information']['message'] = "Bot '<b>" . $bot['name'] . "</b>' bearbeitet";
         $this->forms['information']['style'] = "green";
         $this->show('message_information', "IRC Bot bearbeiten");
     }
     if ($_REQUEST['send']) {
         $name = param_str("name", true);
         $login = param_str("login", true);
         $password = param_str("password", true);
         $soapurl = param_str("soapurl", true);
         $host = param_str("host", true);
         $errors = false;
         #check if empty
         if (!$name) {
             $errors[] = "Name darf nicht leer sein!";
             $items['name']['class'] = '_error';
         }
         if (!$login) {
             $errors[] = "Login darf nicht leer sein!";
             $items['login']['class'] = '_error';
         }
         if (!$password) {
             $errors[] = "Passwort darf nicht leer sein!";
             $items['password']['class'] = '_error';
         }
         if (!$soapurl) {
             $errors[] = "Es muss eine Adresse für den SOAP Server angegeben werden!";
             $items['soapurl']['class'] = '_error';
         }
         if (!$host) {
             $items['host']['class'] = '_optional';
         }
         if (!$errors && ($login != $bot['login'] || $password != $bot['password']) && bot_get_bylogin($login, $password)) {
             $errors[] = "Diese Login - Passwort Paarung ist bereits vergeben!";
             $items['login']['class'] = '_error';
             $items['password']['class'] = '_error';
         }
         if (!$errors) {
             #save step
             $data['editbot'] = 1;
             $_SESSION['steps'] = $data;
             bot_update($id, $name, $login, $password, $soapurl, $host);
             addToLogfile("IRC Bot <b>" . $bot['name'] . "</b> bearbeitet", "Bots", $this->userdata['uid']);
             $this->_header("admin.php?action=editbot&id={$id}&send");
         } else {
             $items['login']['value'] = $login;
             $items['password']['value'] = $password;
             $items['name']['value'] = $name;
             $items['host']['value'] = $host;
             $items['soapurl']['value'] = $soapurl;
             $this->template->assign("errors", $errors);
         }
     } else {
         $items['login']['value'] = $bot['login'];
         $items['password']['value'] = $bot['password'];
         $items['name']['value'] = $bot['name'];
         $items['host']['value'] = $bot['host'];
         $items['soapurl']['value'] = $bot['soapurl'];
         if (!$bot['host']) {
             $items['host']['class'] = '_optional';
         }
     }
     $this->template->assign("id", $id);
     $this->template->assign("items", $items);
     $this->show('bot_edit', "IRC Bot bearbeiten");
 }