commit | author | age
|
8bd4d9
|
1 |
<?php |
JK |
2 |
class database { |
|
3 |
static function init($numer, $modul) { |
|
4 |
if(ctype_digit($numer)) { |
|
5 |
$user = 'Gadu-Gadu://'.$numer.'@gadu-gadu.pl'; |
|
6 |
} |
|
7 |
else |
|
8 |
{ |
|
9 |
$user = 'IMified://'.strtr($numer, array('@' => '\\@')).'@userkey.imified.com'; |
|
10 |
} |
|
11 |
|
|
12 |
$data = new BotSession($user); |
9b67b8
|
13 |
$data->setClass($modul); |
8bd4d9
|
14 |
return $data; |
JK |
15 |
} |
|
16 |
|
|
17 |
static function add($numer, $modul, $name, $value) { |
|
18 |
$data = self::init($numer, $modul); |
|
19 |
|
|
20 |
return $data->__set($name, $value); |
|
21 |
} |
|
22 |
|
|
23 |
static function del($numer, $modul, $name) { |
|
24 |
$data = self::init($numer, $modul); |
|
25 |
|
|
26 |
return $data->__unset($name); |
|
27 |
} |
|
28 |
|
|
29 |
static function delAll($numer, $modul) { |
|
30 |
$data = self::init($numer, $modul); |
|
31 |
|
|
32 |
return $data->truncate($name, $value); |
|
33 |
} |
|
34 |
|
|
35 |
static function addArray($numer, $modul, $name_value) { |
|
36 |
$data = self::init($numer, $modul); |
|
37 |
|
|
38 |
return $data->push($name_value); |
|
39 |
} |
|
40 |
|
|
41 |
static function get($numer, $modul, $name) { |
|
42 |
$data = self::init($numer, $modul); |
|
43 |
|
|
44 |
return $data->__get($name); |
|
45 |
} |
|
46 |
|
|
47 |
static function getArray($numer, $modul) { |
|
48 |
$data = self::init($numer, $modul); |
|
49 |
|
|
50 |
return $data->pull(); |
|
51 |
} |
|
52 |
} |
|
53 |
?> |