예제 #1
0
파일: database.php 프로젝트: Alambos/bot
 static function init($numer, $modul)
 {
     if (ctype_digit($numer)) {
         $user = '******' . $numer . '@gadu-gadu.pl';
     } else {
         $user = '******' . strtr($numer, array('@' => '\\@')) . '@userkey.imified.com';
     }
     $data = new BotSession($user);
     $data->setClass($modul);
     return $data;
 }
예제 #2
0
 static function getBotSessionCurrentUser($botChannel, $channel)
 {
     if (!isLoggedIn()) {
         return NULL;
     }
     return BotSession::getBotSession($botChannel, $channel, $_SESSION['channel']);
 }
예제 #3
0
 /**
  * @depends testManualExample
  */
 function testManualExample2()
 {
     $session = new BotSession('test://user1@test', self::$dataFolder, self::$legacyFolder);
     $session->setClass('test');
     $array = array('zmienna' => 'To jest test2', 'zmienna2' => new DateTime('2012-01-10'), 'zmienna3' => '333');
     $this->assertEquals($array, $session->pull());
     $session->setClass('test2');
     $this->assertEquals(array(), $session->pull());
 }
예제 #4
0
     $botSession->doPart();
     $botSession->finalize();
     die("success");
 } else {
     if ($action == "setCommand") {
         $channel = getChannelWithAuthOrDie($USER_ACCESS_LEVEL_MOD);
         $name = getParamOrDie('name');
         $oldName = getParam('oldName');
         $response = getParamOrDie('response');
         $restriction = getParamOrDie('restriction');
         if ($restriction != "everyone" && $restriction != "regular" && $restriction != "mod" && $restriction != "owner") {
             respondMessage("invalid parameter (restriction)");
         }
         $channelCoebotData = dbGetChannel($channel);
         $bot = $channelCoebotData['botChannel'];
         $botSession = BotSession::getBotSessionCurrentUser($bot, $channel);
         if ($oldName != NULL && $oldName != "" && $oldName != $name) {
             $botSession->doCommandRename($oldName, $name);
         }
         $botSession->doCommandAdd($name, $response);
         $botSession->doCommandRestrict($name, $restriction);
         $botSession->finalize();
         die("success");
     } else {
         if ($action == "delReqsong") {
             $channel = getChannelWithAuthOrDie($USER_ACCESS_LEVEL_OWNER);
             $id = getParamOrDie('id');
             if (!is_numeric($id)) {
                 respondMessage("invalid parameter (id)");
             }
             if (!dbDeleteReqsong($channel, $id)) {