Свойства класса:
Методы класса:
Объекты класса:
$command=$params['command'];
$short_command='';
$dt=recognizeTime($command,$short_command);
$objects=getObjectsByClass("voice_command");
foreach($objects as $obj){
if (preg_match('/'.mb_strtolower($obj['TITLE'],'utf-8').'(.*)/is',mb_strtolower($command,'utf-8'),$m)) {
if ($dt>0) {
addScheduledJob("command".$dt,"processCommand('".$short_command."');",$dt);
say('Задача принята');
return;
}
callMethod($obj['TITLE'].".action",array("command"=>$m[1]));
return;
}
}
// если голосовых команд не найдено - отправим в чат
callMethod("Chat_request.action",array("command"=>$command));say("Отключено питание");Свойства класса:
Методы класса:
$this->setProperty('status',$params['status']);
$this->setProperty('updatedTimestamp',time());
$this->setProperty("alive",1);
$ot=$this->object_title;
$alive_timeout=(int)$this->getProperty("aliveTimeOut");
if (!$alive_timeout) {
$alive_timeout=12*60*60;
}
clearTimeOut($ot."_alive");
setTimeOut($ot."_alive","sg('".$ot.".alive',0);",$alive_timeout);Объекты класса:
if ((int)$params['status']==0) {
say("Внимание! Открывается въезд в гараж.",5);
} else {
say("Гараж закрыт.",5);
}
if ($params['status']) {
$this->setProperty('statusText','закрыт');
} else {
$this->setProperty('statusText','открыт');
}Свойства класса:
Методы класса:
$this->setProperty('status',$params['status']);
$this->setProperty('updatedTimestamp',time());
$this->setProperty('alive',1);
$ot=$this->object_title;
$alive_timeout=(int)$this->getProperty("aliveTimeOut");
if (!$alive_timeout) {
$alive_timeout=24*60*60;
}
clearTimeOut($ot."_alive");
setTimeOut($ot."_alive","sg('".$ot.".alive',0);",$alive_timeout);
if ($params['status']) {
$this->setProperty('motionDetected',1);
clearTimeOut($this->object_title.'_detected');
setTimeOut($this->object_title.'_detected',"setGlobal('".$this->object_title.".motionDetected',0);",30);
$linked_room=$this->getProperty('LinkedRoom');
if ($linked_room!='') {
callMethod($linked_room.'.onActivity');
}
if (getGlobal('somebodyHome')!=1) {
setGlobal('somebodyHome',1);
}
$last_register=registeredEventTime('inhouseMovement');
registerEvent('inhouseMovement',$this->name,2);
if (!$last_register || ((time()-$last_register)>2*60*60)) {
if (timeBetween('06:00', '12:00')) {
runScript('morningGreeting');
}
if (timeBetween('16:00', '01:00')) {
runScript('eveningGreeting');
}
}
}Свойства класса:
Методы класса:
$allcont = $this->getProperty("allcontent");
$balance = substr($allcont,strripos($allcont, "Balance")+9,-1);
$balance = substr($balance,0,strpos($balance, "."));
$this->setProperty("balance",$balance);
$freemin = substr($allcont,strripos($allcont, "Min")+5,-1);
$freemin = substr($freemin,0,strpos($freemin, "<"));
$this->setProperty("freemin",$freemin);
$offday = substr($allcont,strripos($allcont, "CalcTurnOff")+13,-1);
$offday = substr($offday,0,strpos($offday, "<"));
$this->setProperty("offday",$offday);Объекты класса:
Свойства класса:
Методы класса:
$this->setProperty("updated",time());
$this->setProperty("updatedTime",date('H:i'));
if ($this->getProperty('status')) {
say("Mode ".$this->getProperty('title')." activated.");
} else {
say("Mode ".$this->getProperty('title')." deactivated.");
}$this->setProperty('active',1);$this->setProperty('active',0);Объекты класса:
Свойства класса:
Методы класса:
Объекты класса:
$city_id=28440;
//$data_file="http://export.yandex.ru/weather-ng/forecasts/$city_id.xml?".rand(); // адрес xml файла
$data_file="http://export.yandex.ru/weather-ng/forecasts/28440.xml?".rand(); // адрес xml файла
$xml = simplexml_load_file($data_file); // раскладываем xml на массив
$temp=$xml->fact->temperature;
// Если значение температуры положительно, для наглядности добавляем "+"
if ($temp>0) {$temp='+'.$temp;}
sg("Chisinau.Temp",$temp);
sg("Chisinau.Pressure",$xml->fact->pressure);
sg("Chisinau.Humidity",$xml->fact->humidity);
sg("Chisinau.Uptime",$xml->fact->uptime);
sg("Chisinau.weather",$xml->fact->weather_type);
sg("Chisinau.Image",$xml->fact->image);
sg("Chisinau.Image2",$xml->fact->image-v3);
$dir = $xml->fact->wind_direction;
switch ($dir){
case 's':
$dir="южный";
break;
case 'n':
$dir="северный";
break;
case 'w':
$dir="западный";
break;
case 'e':
$dir="восточный";
break;
case 'sw':
$dir="юго-западный";
break;
case 'se':
$dir="юго-восточный";
break;
case 'nw':
$dir="северо-западный";
break;
case 'ne':
$dir="северо-восточный";
break;
case 'calm':
$dir="штиль";
break;
}
sg("Chisinau.wind_direction",$dir);
sg("Chisinau.wind_speed",$xml->fact->wind_speed);
$dir = $xml->day[0]->moon_phase;
switch ($dir){
case '0':
$dir="Полнолуние";
break;
case '1':
$dir="Убывающая";
break;
case '2':
$dir="Убывающая";
break;
case '3':
$dir="Убывающая";
break;
case '4':
$dir="Убывающая";
break;
case '5':
$dir="Убывающая";
break;
case '6':
$dir="Убывающая";
break;
case '7':
$dir="Убывающая";
break;
case '8':
$dir="Новолуние";
break;
case '9':
$dir="Растущая";
break;
case '10':
$dir="Растущая";
break;
case '11':
$dir="Растущая";
break;
case '12':
$dir="Растущая";
break;
case '13':
$dir="Растущая";
break;
case '14':
$dir="Растущая";
break;
case '15':
$dir="Растущая";
break;
}
sg("Chisinau.moon_img",$dir);
//sg("Chisinau.SunRise",$xml->day[0]->sunrise);// сегодня восход солнца
//sg("Chisinau.SunSet",$xml->day[0]->sunset);// сегодня заход солнца
//sg("Chisinau.moonrise",$xml->day[0]->moonrise);// сегодня восход луны
//sg("Chisinau.moonset",$xml->day[0]->moonset);// сегодня заход луны
//sg("Chisinau.moon_phase",$xml->day[0]->moon_phase);// фаза луны
//$DayStart = explode(":",gg("Chisinau.SunRise"));
//$DayEnd = explode(":",gg("Chisinau.SunSet"));
//$transit = explode(":",gg("Chisinau.transit"));
//$civil_twilight_begin = explode(":",gg("Chisinau.civil_twilight_begin"));
//$h_start = (int)$DayStart[0];
//$m_start = (int)$DayStart[1];
//$h_end = (int)$DayEnd[0];
//$m_end = (int)$DayEnd[1];
//$dh = $h_end - $h_start;
//$dm = $m_end - $m_start;
//if ($dm<0){
//$dh=$dh-1;
//$dm=$dm+60;
//}
//sg("Chisinau.LongTag","$dh:$dm");
$status="";
/* $status.='Сейчас на улице' .getGlobal('Chisinau.weather').",";
// ветер
$WSped=(float)gg('Chisinau.WindSpeed');
if ($WSped<1) {
$status.='ветра нет, ';
} elseif ($WSpedd<3) {
$status.='ветер слабый, ';
} elseif ($WSped<8) {
$status.='ветер умеренный, ';
} elseif ($WSped<13) {
$status.='ветер сильный, ';
} elseif ($WSped<20) {
$status.='ветер очень сильный, ';
} elseif ($WSped<28) {
$status.='ветер штормовой, ';
}
else {
$status.='ветер очень очень сильный, УРАГАН, ';
}
$status.='температура '.getGlobal('Chisinau.Temp')."°C,";
$tm=(float)getGlobal('Chisinau.Temp');
if ($tm<-40) {
$status.=' Сибирь морозов не боится!';
} elseif ($tm<-20) {
$status.=' очень холодно, оденьтесь теплее.';
} elseif ($tm<-10) {
$status.=' холодновато.';
} elseif ($tm<-3) {
$status.=' не особо холодно.';
} elseif ($tm<3) {
$status.=' значит возможно гололёд.';
} elseif ($tm<10) {
$status.=' тепловато.';
} elseif ($tm<25) {
$status.=' очень тепло.';
} elseif ($tm<45) {
$status.=' жарко.';
}
*/
$status.="На улице ".gg("Chisinau.weather").".";
// say($status,1);
// $status="";
// ветер
$WindSpeed=(float)gg("Chisinau.wind_speed");
if ($WindSpeed<1) {
$status.=' Ветра нет.';
} elseif ($WindSpeed<3) {
$status.=' Ветер '.getGlobal('Chisinau.wind_direction').' слабый.';
} elseif ($WindSpeed<6) {
$status.=' Ветер '.getGlobal('Chisinau.wind_direction').' сильный.';
} elseif ($WindSpeed<9) {
$status.=' Ветер '.getGlobal('Chisinau.wind_direction').' очень сильный.';
} else {
$status.=' Ветер '.getGlobal('Chisinau.wind_direction').' очень! Очень сильный.';
}
$//status.=' Направление '.getGlobal('Chisinau.wind_direction').'.';
// say($status,1);
// Температура
//$status="";
$w=round(strip_tags(gg("Chisinau.Temp")));
$tempw=$w;
if($w < "0"){
$tempw=abs($w);
}
if($w > "0"){
$templus=" плюс ";
}
if($tempw >= 11 and $tempw <= 14){
$tempcels=" градусов ";
}
else{
while ($tempw > 9){
$tempw=$tempw-10;
}
if($tempw == 0 or $tempw >= 5 and $tempw <= 9){
$tempcels= градусов ; }
if($tempw == 1){
$tempcels= градус ; }
if($tempw >= 2 and $tempw <= 4){
$tempcels= градуса ; }
}
/*
$tNew = abs((float)getGlobal('Chisinau.Temp'));
if ($tNew==1){
$tGradus = 'градус';
}elseif($tNew==2 || $tNew==3 || $tNew==4){
$tGradus = 'градуса';
}else{
$tGradus = 'градусов';
}
*/
$status.=' Температура '.getGlobal('Chisinau.Temp')." ".$tempcels. '.';
// say($status,1);
// $status="";
// Сравнение со вчерашним днем
$SQLText = " SELECT ph.value as val";
$SQLText.= " FROM pvalues pv, objects o, properties p, phistory ph ";
$SQLText.= " WHERE pv.object_id = o.id ";
$SQLText.= " AND p.id = pv.property_id ";
$SQLText.= " AND o.title = 'Chisinau' ";
$SQLText.= " AND p.title = 'Temp' ";
$SQLText.= " AND ph.value_id = pv.id ";
$SQLText.= " AND UNIX_TIMESTAMP( pv.updated ) - UNIX_TIMESTAMP( ph.added ) <24 *60 *60 +30 *60 ";
$SQLText.= " ORDER BY ph.added ";
$SQLText.= " LIMIT 1 ";
$tempYesterday = SQLSelectOne($SQLText);
sg("Chisinau.tempYesterday ",$tempYesterday['val'] );
$tNew = (float)getGlobal('Chisinau.Temp');
$tOld = (float)getGlobal('YandexSamara.tempYesterday');
$tDelta = abs($tNew - $tOld);
if ($tDelta==1){
$tGradus = 'градус';
}elseif($tDelta==2 || $tDelta==3 || $tDelta==4){
$tGradus = 'градуса';
}else{
$tGradus = 'градусов';
}
if ($tNew>$tOld){
$status.=' Сегодня теплее, чем вчера на '.$tDelta." ".$tGradus.".";
// say("Сегодня теплее, чем вчера на ".$tDelta." ".$tGradus.".",1);
}elseif($tNew<$tOld){
$status.=' Сегодня холоднее, чем вчера на '.$tDelta." ".$tGradus.".";
//say("Сегодня холоднее, чем вчера на ".$tDelta." ".$tGradus.".",1);
}elseif($tNew==$tOld){
$status.=' Температура сегодня такая же как вчера.';
//say("Температура сегодня такая же как вчера.",1);
}
$status.=' Восход солнца в '.getGlobal('Chisinau.SunRise').'.';
$status.=' Закат в '.getGlobal('Chisinau.SunSet').'.';
$status.=' Долгота дня '.getGlobal('Chisinau.LongTag').'.';
sg('Chisinau.WeatherDnes',$status);
$w3days="Сегодня днём ожидается температура не выше ";
$temp=$xml->day[0]->day_part[1]->temperature_to;
if ($temp>0) {$temp='+'.$temp;}
$w3days.=$temp;
$w3days.="°С, ";
$w3days.=$xml->day[0]->day_part[1]->weather_type;
$w3days.=", давление ";
$w3days.=$xml->fact->pressure;
$w3days.="мм.рт.ст, влажность ";
$w3days.=$xml->fact->humidity;
$w3days.="%, ветер ";
$dir = $xml->fact->wind_direction;
switch ($dir){
case 's':
$dir="южный";
break;
case 'n':
$dir="северный";
break;
case 'w':
$dir="западный";
break;
case 'e':
$dir="восточный";
break;
case 'sw':
$dir="юго-западный";
break;
case 'se':
$dir="юго-восточный";
break;
case 'nw':
$dir="северо-западный";
break;
case 'ne':
$dir="северо-восточный";
break;
case 'calm':
$dir="штиль";
break;
}
$w3days.=$dir;
$w3days.=" - ";
$w3days.=$xml->fact->wind_speed;
$w3days.="м/c, а ночью будет ";
$temp=$xml->day[0]->day_part[3]->temperature_from;
if ($temp>0) {$temp='+'.$temp;}
$w3days.=$temp;
$w3days.="°С. ";
sg("Chisinau.Weather1day",$w3days);
$w3days.='';
$w3days.="Завтра днём будет ";
$w3days.=$xml->day[1]->day_part[1]->weather_type;
$w3days.=", воздух прогреется до ";
$temp=$xml->day[1]->day_part[1]->temperature_to;
if ($temp>0) {$temp='+'.$temp;}
$w3days.=$temp;
$w3days.="°С, ";
$w3days.="а ночью температура опустится до ";
$temp=$xml->day[1]->day_part[3]->temperature_from;
if ($temp>0) {$temp='+'.$temp;}
$w3days.=$temp;
$w3days.="°С. ";
$w3days.='';
$w3days.="Послезавтра прогреется днём до ";
$temp=$xml->day[2]->day_part[1]->temperature_to;
if ($temp>0) {$temp='+'.$temp;}
$w3days.=$temp;
$w3days.="°С, ";
$w3days.="на небе будет ";
$w3days.=$xml->day[2]->day_part[1]->weather_type;
$w3days.=", а к вечеру температура упадет до ";
$temp=$xml->day[2]->day_part[3]->temperature_from;
if ($temp>0) {$temp='+'.$temp;}
$w3days.=$temp;
$w3days.="°С. ";
sg("Chisinau.Weather3days",$w3days);
$sun_info = date_sun_info(time(), 46.984, 28.8358);
foreach ($sun_info as $key => $val) {
if ($key == 'sunrise') {
$sunrise = $val;
//echo 'Восход: '.date("H:i:s", $sunrise).'';
setGlobal('Chisinau.SunRise',date("H:i", $sunrise));
}
if ($key == 'sunset') {
$sunset = $val;
$day_length = $sunset - $sunrise;
echo 'Заход: '.date("H:i", $sunset).'
';
echo 'Долгота дня: '.gmdate("H:i", $day_length).'
';
setGlobal('Chisinau.SunSet',date("H:i", $sunset));
setGlobal('Chisinau.LongTag',gmdate("H:i", $day_length));
}
if ($key == 'transit') {
$transit = $val;
echo 'В зените: '.date("H:i:s", $transit).'
';
setGlobal('Chisinau.Transit',date("H:i:s", $transit));
}
if ($key == 'civil_twilight_begin') {
$civil_twilight_begin = $val;
echo 'Начало утренних сумерек: '.date("H:i:s", $civil_twilight_begin).'
';
setGlobal('Chisinau.civil_begin',date("H:i:s", $civil_twilight_begin));
}
if ($key == 'civil_twilight_end') {
$civil_twilight_end = $val;
echo 'Конец вечерних сумерек: '.date("H:i:s", $civil_twilight_end).'
';
setGlobal('Chisinau.civil_end',date("H:i:s", $civil_twilight_end));
$noy_length = $civil_twilight_end - $civil_twilight_begin;
setGlobal('Chisinau.nayt',gmdate("H:i:s", $noy_length));
echo 'Долгота ночи: '.gmdate("H:i", $noy_length).'
';
}
}Свойства класса:
Методы класса:
$status=$this->getProperty("status");
if ($status) {
$this->callMethod('turnOn');
} else {
$this->callMethod('turnOff');
}$status=$this->getProperty("status");
if ($status) {
$this->callMethod('turnOff');
} else {
$this->callMethod('turnOn');
}$this->setProperty("status",0);$this->setProperty("status",1);Объекты класса:
Свойства класса:
Методы класса:
$latestActivity=$this->getProperty('LatestActivity');
$this->setProperty('LatestActivity',time());
$this->setProperty('LatestActivityTime',date('H:i'));
$this->setProperty('SomebodyHere',1);
$ot=$this->object_title;
$activity_timeout=10*60;
clearTimeOut($ot."_activity_timeout");
setTimeOut($ot."_activity_timeout","callMethod('".$ot.".onIdle');",$activity_timeout);
$this->setProperty('SomebodyHere',0);Объекты класса:
Методы класса:
Объекты класса:
echo "status received: ".$params['status'];
global $voicemode; $voicemode='off'; processCommand($params['message']);
Свойства класса:
Методы класса:
Объекты класса:
$details=array();
$red_state=0;
$yellow_state=0;
if ($red_state) {
$state='red';
$state_title='Red';
} elseif ($yellow_state) {
$state='yellow';
$state_title='Yellow';
} else {
$state='green';
$state_title='Green';
}
$new_details=implode(". ",$details);
if ($this->getProperty("stateDetails")!=$new_details) {
$this->setProperty('stateDetails',$new_details);
}
if ($this->getProperty('stateColor')!=$state) {
$this->setProperty('stateColor',$state);
$this->setProperty('stateTitle',$state_title);
if ($state!='green') {
say("System state changed to ".$state_title.".");
say(implode(". ",$details));
} else {
say("System state restored to ".$state_title);
}
$this->callMethod('stateChanged');
}$details=array();
$red_state=0;
$yellow_state=0;
$cycles=array('states'=>'states cycle','main'=>'main cycle','execs'=>'exec cycle','scheduler'=>'scheduler cycle');
foreach($cycles as $k=>$v) {
$tm=getGlobal('ThisComputer.cycle_'.$k.'Run');
if (time()-$tm>5*60) {
$red_state=1;
$details[]=$v." stopped.";
}
}
$cycles=array('ping'=>'ping cycle','webvars'=>'webvars cycle','watchfolders'=>'watch folders cycle','rss'=>'RSS cycle');
foreach($cycles as $k=>$v) {
$tm=getGlobal('ThisComputer.cycle_'.$k.'Run');
if (time()-$tm>10*60) {
$yellow_state=1;
$details[]=$v." stopped.";
}
}
if ($red_state) {
$state='red';
$state_title='Red';
} elseif ($yellow_state) {
$state='yellow';
$state_title='Yellow';
} else {
$state='green';
$state_title='Green';
}
$new_details=implode(". ",$details);
if ($this->getProperty("stateDetails")!=$new_details) {
$this->setProperty('stateDetails',$new_details);
}
if ($this->getProperty('stateColor')!=$state) {
$this->setProperty('stateColor',$state);
$this->setProperty('stateTitle',$state_title);
if ($state!='green') {
say("System state changed to ".$state_title.".");
say(implode(". ",$details));
} else {
say("System state restored to ".$state_title);
}
$this->callMethod('stateChanged');
}$details=array();
$red_state=0;
$yellow_state=0;
if ($red_state) {
$state='red';
$state_title='Red';
} elseif ($yellow_state) {
$state='yellow';
$state_title='Yellow';
} else {
$state='green';
$state_title='Green';
}
$new_details=implode(". ",$details);
if ($this->getProperty("stateDetails")!=$new_details) {
$this->setProperty('stateDetails',$new_details);
}
if ($this->getProperty('stateColor')!=$state) {
$this->setProperty('stateColor',$state);
$this->setProperty('stateTitle',$state_title);
if ($state!='green') {
say("System state changed to ".$state_title.".");
say(implode(". ",$details));
} else {
say("System state restored to ".$state_title);
}
$this->callMethod('stateChanged');
}Свойства класса:
Методы класса:
//$params['t']
$this->setProperty("updated",time());
$this->setProperty("updatedTime",date("H:i",time()));
$this->setProperty("alive",1);
$ot=$this->object_title;
$alive_timeout=(int)$this->getProperty("aliveTimeOut");
if (!$alive_timeout) {
$alive_timeout=30*60;
}
clearTimeOut($ot."_alive");
setTimeOut($ot."_alive","sg('".$ot.".alive',0);",$alive_timeout);
if (!isset($params['t'])) {
return;
}
$old_temp=$this->getProperty('temp');
$t=round($params['t'],1);
if ($t>110) return;
$this->setProperty('temp',$t);
if ($params['uptime']) {
$this->setProperty('uptime',$params['uptime']);
}
if ($t>$old_temp) {
$d=1;
} elseif ($t<$old_temp) {
$d=-1;
} else {
$d=0;
}
$this->setProperty('direction',$d);
$linked_room=$this->getProperty("LinkedRoom");
if ($linked_room) {
setGlobal($linked_room.'.Temperature',$t);
}Объекты класса:
Свойства класса:
Методы класса:
Объекты класса:
$h=(int)date('G',time());
$m=date('i',time());
if (isWeekDay()) {
if (gg("AlarmSt")) {
if (timeIs(gg("AlarmT"))) {
runScript("AlarmMorning");
}
}
}
if (($h>=8)) {
if ($m=="00") {
say(timeNow());
}
}//callMethod("john.balanceChanged");
//callMethod("kate.balanceChanged");
callMethod("Chisinau.update");Методы класса:
Объекты класса:
if ($params['serial']=='' && $params['devname']!='') {
$params['serial']=$params['devname'];
}
$device=SQLSelectOne("SELECT * FROM usbdevices WHERE SERIAL LIKE '".$params['serial']."'");
if (!$device['ID']) {
// new device connected
//say("Подключено новое устройство",1);
$device=array();
$device['SERIAL']=$params['serial'];
$device['TITLE']='устройство '.$params['devname'];
$device['FIRST_FOUND']=date('Y-m-d H:i:s');
$device['LAST_FOUND']=date('Y-m-d H:i:s');
$device['LOG'].=$device['FIRST_FOUND'].' подключено (впервые)'."\n";
$device['ID']=SQLInsert('usbdevices',$device);
} else {
// device already in our database
//say("Подключено ".$device['TITLE'],1);
if ($device['USER_ID']) {
$user=SQLSelectOne("SELECT * FROM users WHERE ID='".$device['USER_ID']."'");
if ($user['ID']) {
//$user['NAME']; // теперь мы знаем имя пользователя, связанного с этим устройством
}
}
$device['LAST_FOUND']=date('Y-m-d H:i:s');
$device['LOG']=$device['LAST_FOUND'].' подключено'."\n".$device['LOG'];
SQLUpdate('usbdevices',$device);
if ($device['SCRIPT_ID']!='') {
runScript($device['SCRIPT_ID'],$params);
} elseif ($device['SCRIPT']!='') {
eval($device['SCRIPT']);
}
}Свойства класса:
Методы класса:
Объекты класса:
say("Закрываю");
sleep(2);
getURL('http://192.168.1.11/$f',0);say("Закрываю");
sleep(2);
getURL('http://192.168.1.11/$d',0);say("Открываю");
sleep(2);
getURL('http://192.168.1.11/$e',0);say("Открываю");
sleep(2);
getURL('http://192.168.1.11/$c',0);class ModIiiRu
{
// IiiID можно взять из ссылки на бота из рейтинга
const IiiID = '3aecd642-3f4c-431d-8124-123906a34882';
// выдери ответ нужного ифа и подставь в нижнюю строку
// const IiiID = '6d739a70-bc74-46f6-8a95-79730c2e6ed0';
public function cmd($cmd)
{
$data = json_encode(array(self::IiiID, $cmd));
$data = self::xorKey($data, false);
$data = self::sendMessage($data);
$data = json_decode($data);
$text = $data->result->text->value;
return $text;
}
private static function sendMessage($send){
$url='http://iii.ru/api/2.0/json/Chat.request';
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_FAILONERROR, 1);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_TIMEOUT, 3);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $send);
$res = curl_exec($ch);
if (!$res)
return false;
curl_close($ch);
return self::xorKey($res, true);
}
public static function xorKey($res, $decode)
{
$key = "some very-very long string without any non-latin characters due to different string representations inside of variable programming languages";
$keylen = strlen($key);
$res = $decode ? base64_decode($res) : base64_encode($res);
$strlen = strlen($res);
$i = 0;
$result = '';
while ($i<$strlen)
{
$buf = $res[$i] ^ $key[$i % $keylen];
$result .= $buf;
$i++;
}
$result= $decode ? base64_decode($result) : base64_encode($result);
return $result;
}
}
$command=$params['command'];
$mod = new ModIiiRu();
say($mod->cmd($command));
//say("111111111111111");
//$data1 ="JBYkV3oyBgg2ejNWPzoRBTYUBBA/ICNbNA15AyYzLVo7JxBSIS1DFCIpYBU7IDMCeicpCD4iLyULSzRhVDkPcQcbY1VZPy8MKjRTSQ:";
//$data1 = $mod->xorKey($data1, true);
//say($data1);say("Закрываю");
sleep(2);
getURL('http://192.168.1.11/$z',0);say("Открываю");
sleep(2);
getURL('http://192.168.1.11/$o',0);Свойства класса:
Объекты класса:
, Россия
Веб-сайт:
http://vk.com/sportbiker
© 2026 SJLab | Реквизиты: Курицын С. С. ИНН 762001394609 | Контакты | Публичный договор
SmartLiving