PageRenderTime 83ms CodeModel.GetById 16ms RepoModel.GetById 1ms app.codeStats 0ms

/pichi-php/pichi_functional.php

http://pichi.googlecode.com/
PHP | 525 lines | 459 code | 65 blank | 1 comment | 64 complexity | 55f1691d9fa2dff7975ec253035eb96c MD5 | raw file
Possible License(s): GPL-2.0
  1. <?php
  2. require_once("command_handler.php");
  3. class Pichi extends CommandHandler
  4. {
  5. public function __construct(&$jabber)
  6. {
  7. parent::__construct($jabber);
  8. }
  9. // Begin commands
  10. protected function command_help()
  11. {
  12. $help = "\n";
  13. $help .= "-------------------------\n";
  14. $help .= " Pichi Bot \n";
  15. $help .= "-------------------------\n";
  16. $help .= "--------------------------------------------\n";
  17. $help .= PichiLang::get('help_syntaxis_info') . "\n";
  18. $help .= "--------------------------------------------\n";
  19. $help .= "===== " . PichiLang::get('help_main_commands') . " =====\n";
  20. $help .= "!set ".PichiLang::get('help_command_usage_variable')."=".PichiLang::get('help_command_usage_value')." - ".PichiLang::get('help_command_description_set')."\n";
  21. $help .= "!gc [".PichiLang::get('help_command_usage_variable')."] - ".PichiLang::get('help_command_description_gc')."\n";
  22. $help .= "!log ".PichiLang::get('help_command_usage_param')." - ".PichiLang::get('help_command_description_log')."\n";
  23. $help .= "!users [".PichiLang::get('help_command_usage_nick')."|".PichiLang::get('help_command_usage_jid')."] - ".PichiLang::get('help_command_description_users')."\n";
  24. $help .= "!msg [".PichiLang::get('help_command_usage_nick')."|".PichiLang::get('help_command_usage_jid')."|".PichiLang::get('help_command_usage_room')."] [type] message - ".PichiLang::get('help_command_description_msg')."\n";
  25. $help .= "!ping [".PichiLang::get('help_command_usage_nick')."|".PichiLang::get('help_command_usage_jid')."] - ".PichiLang::get('help_command_description_ping')."\n";
  26. $help .= "!join ".PichiLang::get('help_command_usage_room')." ".PichiLang::get('help_command_usage_nick')." [".PichiLang::get('help_command_usage_status')."] - ".PichiLang::get('help_command_description_join')."\n";
  27. $help .= "!left ".PichiLang::get('help_command_usage_room')." ".PichiLang::get('help_command_usage_nick')." [".PichiLang::get('help_command_usage_status')."] - ".PichiLang::get('help_command_description_left')."\n";
  28. $help .= "!greet ".PichiLang::get('help_command_usage_jid')." ".PichiLang::get('help_command_usage_room')." ".PichiLang::get('help_command_usage_message')." - ".PichiLang::get('help_command_description_greet')."\n";
  29. $help .= "!farewell ".PichiLang::get('help_command_usage_jid')." ".PichiLang::get('help_command_usage_room')." ".PichiLang::get('help_command_usage_message')." - ".PichiLang::get('help_command_description_farewell')."\n";
  30. $help .= "!idle ".PichiLang::get('help_command_usage_nick')." - ".PichiLang::get('help_command_description_idle')."\n";
  31. $help .= "!on - ".PichiLang::get('help_command_description_on')."\n";
  32. $help .= "!off - ".PichiLang::get('help_command_description_off')."\n";
  33. $help .= "!quit - ".PichiLang::get('help_command_description_quit')."\n";
  34. $help .= "!version - ".PichiLang::get('help_command_description_version')."\n";
  35. $help .= "===== " . PichiLang::get('help_admin_commands') . " =====\n";
  36. $help .= "!topic ".PichiLang::get('help_command_usage_param')." - ".PichiLang::get('help_command_description_topic')."\n";
  37. $help .= "!ban ".PichiLang::get('help_command_usage_jid')."|".PichiLang::get('help_command_usage_nick')." [".PichiLang::get('help_command_usage_time')."] [".PichiLang::get('help_command_usage_reason')."] - ".PichiLang::get('help_command_description_ban')."\n";
  38. $help .= "!unban ".PichiLang::get('help_command_usage_jid')." - ".PichiLang::get('help_command_description_jid')."\n";
  39. $help .= "!banlist - ".PichiLang::get('help_command_description_banlist')."\n";
  40. $help .= "!kick ".PichiLang::get('help_command_usage_nick')."|".PichiLang::get('help_command_usage_jid')." [".PichiLang::get('help_command_usage_time')."] [".PichiLang::get('help_command_usage_reason')."] - ".PichiLang::get('help_command_description_kick')."\n";
  41. $help .= "!unkick ".PichiLang::get('help_command_usage_jid')." - ".PichiLang::get('help_command_description_unkick')."\n";
  42. $help .= "===== " . PichiLang::get('help_plugins') . " =====\n";
  43. $help .= "!plugins - ".PichiLang::get('help_command_description_plugins')."\n";
  44. $help .= "!enable ".PichiLang::get('help_command_usage_param')." - ".PichiLang::get('help_command_description_enable')."\n";
  45. $help .= "!disable ".PichiLang::get('help_command_usage_param')." - ".PichiLang::get('help_command_description_disable')."\n";
  46. $help .= "!reload - ".PichiLang::get('help_command_description_reload')."\n";
  47. $help .= "===== " . PichiLang::get('help_wiki_inline') . " =====\n";
  48. $help .= "!dfn ".PichiLang::get('help_command_usage_param')."=".PichiLang::get('help_command_usage_value')." - ".PichiLang::get('help_command_description_dfn')."\n";
  49. $help .= "!wtf ".PichiLang::get('help_command_usage_param')." - ".PichiLang::get('help_command_description_wtf')."\n";
  50. $help .= "!wtfcount - ".PichiLang::get('help_command_description_wtfcount')."\n";
  51. $help .= "!wtfrand - ".PichiLang::get('help_command_description_wtfrand')."\n";
  52. $help .= "!wtfrev ".PichiLang::get('help_command_usage_param')." - ".PichiLang::get('help_command_description_wtfrev')."\n";
  53. $help .= "!wtfull ".PichiLang::get('help_command_usage_param')." - ".PichiLang::get('help_command_description_wtffull')."\n";
  54. $help .= "!wtfset ".PichiLang::get('help_command_usage_param')." - ".PichiLang::get('help_command_description_wtfset')."\n";
  55. $help .= "===== " . PichiLang::get('help_lexems') . " =====\n";
  56. $help .= "!top - ".PichiLang::get('help_command_description_top')."\n";
  57. $help .= "!count - ".PichiLang::get('help_command_description_count')."\n";
  58. $help .= "!talkers - ".PichiLang::get('help_command_description_talkers')."\n";
  59. $help .= "!nicks ".PichiLang::get('help_command_usage_param')." - ".PichiLang::get('help_command_description_nicks')."\n";
  60. $help .= "===== " . PichiLang::get('help_other_commands') . " =====\n";
  61. ($hook = PichiPlugin::fetch_hook('commands_show_help')) ? eval($hook) : false;
  62. $this->sendAnswer($help);
  63. }
  64. protected function command_version()
  65. {
  66. global $config;
  67. $this->sendAnswer("Pichi Bot v.{$config['pichi_version']}");
  68. ($hook = PichiPlugin::fetch_hook('commands_show_version')) ? eval($hook) : false;
  69. $this->sendAnswer("".PichiLang::get('command_version_plugins').":\n" . PichiPlugin::show_plugin_list());
  70. }
  71. protected function command_enable()
  72. {
  73. if(!$this->isAccess())
  74. return;
  75. $w = $this->seperate($this->last_message);
  76. PichiPlugin::enable((int)$w[1]);
  77. }
  78. protected function command_disable()
  79. {
  80. if(!$this->isAccess())
  81. return;
  82. $w = $this->seperate($this->last_message);
  83. PichiPlugin::disable((int)$w[1]);
  84. }
  85. protected function command_reload()
  86. {
  87. if(!$this->isAccess())
  88. return;
  89. PichiPlugin::reload();
  90. }
  91. protected function command_plugins()
  92. {
  93. $this->sendAnswer("".PichiLang::get('command_version_plugins').":\n" . PichiPlugin::show_plugin_list());
  94. }
  95. protected function command_kick()
  96. {
  97. if(!$this->isAccess())
  98. return;
  99. $w = $this->seperate($this->last_message, 3);
  100. $this->kick($w[1], $w[2], $w[3]);
  101. }
  102. protected function command_unkick()
  103. {
  104. if(!$this->isAccess())
  105. return;
  106. $w = $this->seperate($this->last_message);
  107. $this->unkick($w[1]);
  108. }
  109. protected function command_ban()
  110. {
  111. if(!$this->isAccess())
  112. return;
  113. $w = $this->seperate($this->last_message, 3);
  114. $this->ban($w[1], $w[2], $w[3]);
  115. }
  116. protected function command_unban()
  117. {
  118. if(!$this->isAccess())
  119. return;
  120. $w = $this->seperate($this->last_message, 2);
  121. $this->unban($w[1], $w[2]);
  122. }
  123. protected function command_banlist()
  124. {
  125. $this->db->query("SELECT `jid`,`value` FROM users_data WHERE name = 'ban';");
  126. $banlist = "";
  127. while($bans = $this->db->fetchArray())
  128. {
  129. $banlist .= $bans['jid'] . " " . date("d.m.y \? H:i:s", $bans['value']) . "\n";
  130. }
  131. $this->sendAnswer("".PichiLang::get('command_banlist_lock').":\n" . $banlist);
  132. }
  133. protected function command_log()
  134. {
  135. $this->db->query("SELECT * FROM log ORDER BY time;");
  136. $qu_i = $this->db->numRows(true);
  137. $n = explode(" ", $this->last_message);
  138. $n = ($n[1] != NULL) ? ((int)$n[1]) : 20;
  139. $i = 0;
  140. $log = "\n-----------------------------------------------------------------------\n";
  141. while($data = $this->db->fetchArray())
  142. {
  143. if($i < $n && $i < 50 && $qu_i <= $n)
  144. {
  145. $log .= "[".date("H:i:s",$data['time'])."]<".$this->getName($data['from'])."> $data[message]\n";
  146. $i++;
  147. }
  148. $qu_i--;
  149. }
  150. $log .= "-----------------------------------------------------------------------";
  151. $this->log->log("Request log:\n$log", PichiLog::LEVEL_VERBOSE);
  152. $this->sendAnswer($log);
  153. }
  154. protected function command_wtf()
  155. {
  156. $w = $this->seperate($this->last_message);
  157. $this->db->query("SELECT `value` FROM wiki WHERE name='".$this->db->db->escapeString($w[1])."' ORDER BY revision DESC LIMIT 0,1;");
  158. $answer = $this->db->fetchColumn(0);
  159. $this->sendAnswer($answer);
  160. $this->log->log("User request wiki page \"$w[1]\" = $answer", PichiLog::LEVEL_DEBUG);
  161. }
  162. protected function command_wtfcount()
  163. {
  164. $this->db->query("SELECT name FROM wiki;");
  165. if($this->db->numRows(true) > 0)
  166. {
  167. $tmp_ar = array();
  168. while($tmp = $this->db->fetchArray())
  169. $tmp_ar[] = $tmp['name'];
  170. $tmp_ar = array_unique($tmp_ar);
  171. $wtfnum = count($tmp_ar);
  172. $this->sendAnswer("".PichiLang::get('command_wiki_count').": $wtfnum");
  173. }
  174. else
  175. {
  176. $this->sendAnswer(PichiLang::get('command_wiki_nodef'));
  177. }
  178. }
  179. protected function command_wtfrand()
  180. {
  181. $this->db->query("SELECT name FROM wiki ORDER BY RANDOM() LIMIT 0,1;");
  182. if($this->db->numRows(true) > 0)
  183. {
  184. $this->db->query("SELECT name,value FROM wiki WHERE name = '" . $this->db->db->escapeString($this->db->fetchColumn(0)) . "' ORDER BY revision DESC LIMIT 0,1;");
  185. $wtfword = $this->db->fetchColumn(0);
  186. $wtfdef = $this->db->fetchColumn(1,true);
  187. if($wtfword != NULL && $wtfdef != NULL)
  188. $this->sendAnswer($wtfword . " = " . $wtfdef);
  189. }
  190. else
  191. {
  192. $this->sendAnswer(PichiLang::get('command_wiki_nodef'));
  193. }
  194. }
  195. protected function command_wtfrev()
  196. {
  197. $w = $this->seperate($this->last_message);
  198. $this->db->query("SELECT revision FROM wiki WHERE name = '" . $this->db->db->escapeString($w[1]) . "' ORDER BY revision DESC LIMIT 0,1;");
  199. if($this->db->numRows(true) > 0)
  200. $this->sendAnswer("".PichiLang::get('command_wiki_revision').": " . $this->db->fetchColumn(0));
  201. else
  202. $this->sendAnswer(PichiLang::get('command_wiki_nodef'));
  203. }
  204. protected function command_wtfull()
  205. {
  206. $w = $this->seperate($this->last_message);
  207. $this->db->query("SELECT * FROM wiki WHERE name = '" . $this->db->db->escapeString($w[1]) . "' ORDER BY revision DESC;");
  208. $list_rev = NULL;
  209. while($tmp = $this->db->fetchArray())
  210. $list_rev .= "\n------- ".PichiLang::get('command_wiki_revision')." {$tmp['revision']} ({$tmp['name']}) -------\n{$tmp['value']}\n---------------------";
  211. if($list_rev != NULL)
  212. $this->sendAnswer($list_rev);
  213. else
  214. $this->sendAnswer(PichiLang::get('command_wiki_nodef'));
  215. }
  216. protected function command_wtfset()
  217. {
  218. $w = $this->seperate($this->last_message, 3);
  219. $this->db->query("SELECT name,revision,value FROM wiki WHERE name = '" . $this->db->db->escapeString($w[1]) . "' AND revision='" . $this->db->db->escapeString($w[2]) . "' LIMIT 0,1;");
  220. if($this->db->numRows(true) > 0)
  221. {
  222. $name = $this->db->fetchColumn(0);
  223. $rev = $this->db->fetchColumn(1,true);
  224. $val = $this->db->fetchColumn(2,true);
  225. $this->db->query("SELECT revision FROM wiki WHERE name = '" . $this->db->db->escapeString($name) . "' ORDER BY revision DESC LIMIT 0,1;");
  226. $newrev = ((int)$this->db->fetchColumn(0))+1;
  227. $this->db->query("INSERT INTO wiki (`name`,`revision`,`value`) VALUES ('" . $this->db->db->escapeString($name) . "','" . $this->db->db->escapeString($newrev) . "','".$this->db->db->escapeString($val)."');");
  228. $this->sendAnswer(PichiLang::get('command_wiki_revision_set', array($rev)));
  229. }
  230. else
  231. {
  232. $this->sendAnswer(PichiLang::get('command_wiki_nodef'));
  233. }
  234. }
  235. protected function command_top()
  236. {
  237. $this->db->query("SELECT `lexeme`,`count` FROM lexems ORDER BY count DESC LIMIT 0,10;");
  238. $this->sendAnswer(PichiLang::get('command_top10'));
  239. $ans = "";
  240. $ix = 0;
  241. while($lex = $this->db->fetchArray())
  242. {
  243. $ix++;
  244. $tmp = explode(" ", $lex['lexeme']);
  245. if($tmp[0] == "#beg#")
  246. $tmp[0] = "(".PichiLang::get('command_top10_begin').")";
  247. if($tmp[2] == "#end#")
  248. $tmp[2] = "(".PichiLang::get('command_top10_end').")";
  249. $ans .= $ix . ". " . implode(" ", $tmp) . " [{$lex['count']}]" . "\n";
  250. }
  251. $this->sendAnswer($ans);
  252. }
  253. protected function command_talkers()
  254. {
  255. $query = $this->db->query("SELECT `from`, COUNT(*) AS `counter` FROM log GROUP BY `from` ORDER BY `counter` DESC;");
  256. $this->sendAnswer(PichiLang::get('command_talkers'));
  257. $ans = "";
  258. $tmp = array();
  259. $i = 0;
  260. while(($fr = $this->db->fetchArray($query)) && $i < 10)
  261. {
  262. $from = $this->getJID($this->getName($fr['from']), NULL, TRUE);
  263. if(!$from)
  264. continue;
  265. if($tmp["$from"] == NULL)
  266. {
  267. $tmp["$from"] = 0;
  268. $i++;
  269. }
  270. $tmp["$from"] += (int) $fr['counter'];
  271. }
  272. $i = 0;
  273. foreach($tmp as $key=>$val)
  274. $ans .= PichiLang::get('command_talkers_list', array(++$i, $this->getName($key), $val)) . "\n";
  275. $this->sendAnswer($ans);
  276. }
  277. protected function command_count()
  278. {
  279. $this->db->query("SELECT COUNT(*) FROM lexems;");
  280. $lexnum = (int)$this->db->fetchColumn(0);
  281. $this->sendAnswer(PichiLang::get('command_count', array($lexnum)));
  282. }
  283. protected function command_dfn()
  284. {
  285. $w = $this->seperate($this->last_message);
  286. $this->db->query("SELECT revision FROM wiki WHERE name = '" . $this->db->db->escapeString($w[1]) . "' ORDER BY revision DESC LIMIT 0,1;");
  287. if($this->db->numRows(true) > 0)
  288. {
  289. $rev = (int)$this->db->fetchColumn(0);
  290. $this->db->query("INSERT INTO wiki (`name`,`revision`,`value`) VALUES ('" . $this->db->db->escapeString($w[1]) . "','" . $this->db->db->escapeString($rev+1) . "','".$this->db->db->escapeString($w[2])."');");
  291. }
  292. else
  293. {
  294. $this->db->query("INSERT INTO wiki (`name`,`revision`,`value`) VALUES ('" . $this->db->db->escapeString($w[1]) . "','1','".$this->db->db->escapeString($w[2])."');");
  295. }
  296. $this->log->log("User set wiki page $w[1] = $w[2]", PichiLog::LEVEL_DEBUG);
  297. $this->sendAnswer(PichiLang::get('command_dfn'));
  298. }
  299. protected function command_set()
  300. {
  301. if(!$this->isAccess())
  302. return;
  303. $w = $this->seperate($this->last_message);
  304. if($this->setOption($w[1], $w[2]))
  305. $this->sendAnswer(PichiLang::get('command_set'));
  306. else
  307. $this->sendAnswer(PichiLang::get('command_nosuch'));
  308. }
  309. protected function command_msg()
  310. {
  311. if(!$this->isAccess())
  312. return;
  313. $w = $this->seperate($this->last_message, 3);
  314. $user = $this->getJID($w[1]);
  315. $message = $w[3];
  316. if($w[2] != "chat" && $w[2] != "groupchat")
  317. $w[2] = "chat";
  318. $this->jabber->message($user, $message, $w[2]);
  319. $this->log->log("Send message to $user: $message", PichiLog::LEVEL_DEBUG);
  320. }
  321. protected function command_gc()
  322. {
  323. if(!$this->isAccess())
  324. return;
  325. $w = $this->seperate($this->last_message);
  326. $this->db->query("SELECT * FROM settings" . (($w[1] != NULL) ? " WHERE name='".$this->db->db->escapeString($w[1])."'" : "") . ";");
  327. while($data = $this->db->fetchArray())
  328. {
  329. $this->sendAnswer($data['name'] . " = " . $data['value'] . " //{$data['description']}");
  330. $this->log->log("User request setting: {$data['name']} = {$data['value']}", PichiLog::LEVEL_VERBOSE);
  331. }
  332. }
  333. protected function command_users()
  334. {
  335. $w = $this->seperate($this->last_message);
  336. $this->db->query("SELECT * FROM users;");
  337. if($w[1] == NULL)
  338. {
  339. $this->log->log("Begin creting user list", PichiLog::LEVEL_DEBUG);
  340. $userlist = "".PichiLang::get('command_users_list_seen').":\n";
  341. $online = $offline = "";
  342. $n = $f = 0;
  343. while($data = $this->db->fetchArray())
  344. {
  345. if($data['room'] == NULL)
  346. continue;
  347. $roomname = explode("@", $data['room']);
  348. $roomname = $roomname[0];
  349. if($data['status'] == 'available')
  350. {
  351. $n++;
  352. $online .= PichiLang::get('command_users_online_seen',array($n, $data['nick'], $roomname)) . "\n";
  353. $this->log->log("User $data[nick]: online", PichiLog::LEVEL_VERBOSE);
  354. }
  355. else
  356. {
  357. $f++;
  358. $offline .= PichiLang::get('command_users_offline_seen',array($f, $data['nick'], date("d.m.y \? H:i:s", $data['time']), $roomname)) . "\n";
  359. $this->log->log("User $data[nick]: offline", PichiLog::LEVEL_VERBOSE);
  360. }
  361. }
  362. $userlist .= "".PichiLang::get('command_users_online').":\n" . $online;
  363. $userlist .= "".PichiLang::get('command_users_offline').":\n" . $offline;
  364. $this->sendAnswer($userlist);
  365. }
  366. else
  367. {
  368. while($data = $this->db->fetchArray())
  369. {
  370. if($data['nick'] == $w[1] || $data['jid'] == $w[1])
  371. {
  372. $this->log->log("User {$data['nick']} founded!", PichiLog::LEVEL_VERBOSE);
  373. $this->sendAnswer(PichiLang::get('command_status', array($data['nick'], (($data['status'] == 'available') ? PichiLang::get('command_status_online') : PichiLang::get('command_status_offline')))));
  374. }
  375. }
  376. }
  377. }
  378. protected function command_join()
  379. {
  380. if(!$this->isAccess())
  381. return;
  382. $w = $this->seperate($this->last_message, 3);
  383. $this->joinRoom($w[1], $w[2], $w[3]);
  384. }
  385. protected function command_left()
  386. {
  387. if(!$this->isAccess())
  388. return;
  389. $w = $this->seperate($this->last_message, 3);
  390. $this->leftRoom($w[1], $w[2], $w[3]);
  391. }
  392. protected function command_ping()
  393. {
  394. $w = $this->seperate($this->last_message);
  395. if($this->isOnline($w[1]))
  396. $this->ping($w[1]);
  397. else
  398. $this->sendAnswer(PichiLang::get('command_ping_nouser'));
  399. }
  400. protected function command_topic($room = NULL)
  401. {
  402. if($room == NULL)
  403. $room = $this->room[0];
  404. $w = $this->seperate($this->last_message);
  405. $this->jabber->setTopic($room, $w[1]);
  406. }
  407. protected function command_nicks()
  408. {
  409. $ans = "";
  410. $w = $this->seperate($this->last_message);
  411. $this->db->query("SELECT `nick` FROM users_nick WHERE `jid` = '" . $this->db->db->escapeString($this->getJID($w[1])) . "' GROUP BY `nick`;");
  412. while($data = $this->db->fetchArray())
  413. $ans .= $data['nick'] . "\n";
  414. if($ans == NULL)
  415. return;
  416. $this->sendAnswer(PichiLang::get('command_nicks') . "\n" . $ans);
  417. }
  418. protected function command_idle()
  419. {
  420. $w = $this->seperate($this->last_message);
  421. $this->db->query("SELECT `time` FROM log WHERE `from` = '" . $this->db->db->escapeString($w[1]) . "' OR `from` LIKE '%/" . $this->db->db->escapeString($this->getName($w[1])) . "' ORDER BY time DESC;");
  422. $date = (int)$this->db->fetchColumn(0);
  423. if($date > 0)
  424. $this->sendAnswer(date("d.m.y \? H:i:s", $date));
  425. }
  426. protected function command_greet()
  427. {
  428. $w = $this->seperate($this->last_message, 3);
  429. if(!$this->isAccess())
  430. return;
  431. $action = ($w[0] == "!greet") ? "user_join_room" : "user_left_room";
  432. $this->db->query("SELECT COUNT(*) FROM actions WHERE action = '$action' AND coincidence='room=" . $this->db->db->escapeString($w[2]) . ",jid=" . $this->db->db->escapeString($w[1]) . "';");
  433. if($this->db->fetchColumn() > 0)
  434. $this->db->query("UPDATE actions SET value = '".$this->db->db->escapeString($w[3])."' WHERE action = '$action' AND coincidence='room=" . $this->db->db->escapeString($w[2]) . ",jid=" . $this->db->db->escapeString($w[1]) . "';");
  435. else
  436. $this->db->query("INSERT INTO actions (`action`,`coincidence`,`do`,`option`,`value`) VALUES ('$action', 'room=" . $this->db->db->escapeString($w[2]) . ",jid=" . $this->db->db->escapeString($w[1]) . "', 'send_message', '', '".$this->db->db->escapeString($w[3])."');");
  437. $this->sendAnswer("Updated!");
  438. }
  439. protected function command_quit()
  440. {
  441. if(!$this->isAccess(3))
  442. return;
  443. $this->doExit();
  444. }
  445. protected function command_on()
  446. {
  447. if(!$this->isAccess(3))
  448. return;
  449. $this->enabled = TRUE;
  450. $this->sendAnswer("Updated!");
  451. }
  452. protected function command_off()
  453. {
  454. if(!$this->isAccess(3))
  455. return;
  456. $this->enabled = FALSE;
  457. $this->sendAnswer("Updated!");
  458. }
  459. }
  460. ?>