⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 commands.php

📁 flashget43的源代码 一个比较常用的下载程序
💻 PHP
📖 第 1 页 / 共 3 页
字号:
<?php
				if($irc_cmd == '/showignores') {

					$this->sendToUser(null, new Message($type, $this->userid, $GLOBALS['fc_config']['liveSupportMode']?$this->roomid:null, $txt, $this->color));

					$ignore_list = 'Ignored by you:';
					$stmt = new Statement("SELECT * FROM {$GLOBALS['fc_config']['db']['pref']}ignors WHERE userid=?");
					if($rs = $stmt->process($this->userid)) {
						if(!$rs->hasNext()) $ignore_list .= ' ---';
						while($rec = $rs->next()) {
							$user = ChatServer::getUser($rec['ignoreduserid']);
							$ignore_list .= ' ' . $user['login'];
						}
						$this->sendToUser(null, new Message($type, $this->userid, $GLOBALS['fc_config']['liveSupportMode']?$this->roomid:null, $ignore_list, $this->color));
					}
					$ignore_list = 'Ignores you:';
					$stmt = new Statement("SELECT * FROM {$GLOBALS['fc_config']['db']['pref']}ignors WHERE ignoreduserid=?");
					if($rs = $stmt->process($this->userid)) {
						if(!$rs->hasNext()) $ignore_list .= ' ---';
						while($rec = $rs->next()) {
							$user = ChatServer::getUser($rec['userid']);
							$ignore_list .= ' ' . $user['login'];
						}
						$this->sendToUser(null, new Message($type, $this->userid, $GLOBALS['fc_config']['liveSupportMode']?$this->roomid:null, $ignore_list, $this->color));
					}
					return 'ok';
				}

				if($irc_cmd == '/showbans' && $role_admin) {

					$this->sendToUser(null, new Message($type, $this->userid, $GLOBALS['fc_config']['liveSupportMode']?$this->roomid:null, $txt, $this->color));

					$stmt = new Statement("SELECT * FROM {$GLOBALS['fc_config']['db']['pref']}bans");
					if($rs = $stmt->process()) {
						if($rs->hasNext()) {
							while($rec = $rs->next()) {
								if($rec['userid']) {
									$user = ChatServer::getUser($rec['userid']);
									$ban_list = 'Ban by ' . $user['login'];
								}
								if($rec['banneduserid']) {
									$user = ChatServer::getUser($rec['banneduserid']);
									$ban_list .= ': user ' . $user['login'];
								}
								if($rec['roomid']) {
									$stmt = new Statement("SELECT * FROM {$GLOBALS['fc_config']['db']['pref']}rooms WHERE id=?");
									if($rs2 = $stmt->process($rec['roomid'])) {
										$room = $rs2->next();
										$ban_list .= ' banned from room ' . $room['name'];
									}
								} else {
									if(!$rec['ip']) $ban_list .= ' banned from chat';
								}

								if($rec['ip']) {$ban_list .= ' banned by ip ' . $rec['ip'];}
								$ban_list .= ' created at ' . substr($rec['created'], 8, 2) . ':' . substr($rec['created'], 10, 2);
								$ban_list .= ' date ' . substr($rec['created'], 4, 2) . '-' . substr($rec['created'], 6, 2);
								$deltatime = time() - mktime(substr($rec['created'], 8, 2), substr($rec['created'], 10, 2), substr($rec['created'], 12, 2), substr($rec['created'], 4, 2), substr($rec['created'], 6, 2), substr($rec['created'], 0, 4));
								$deltatime = number_format(($GLOBALS['fc_config']['autounbanAfter'] - $deltatime) / 3600, 1);
								$ban_list .= ' expires in ' . $deltatime . ' hours';

								$this->sendToUser(null, new Message($type, $this->userid, $GLOBALS['fc_config']['liveSupportMode']?$this->roomid:null, $ban_list, $this->color));

								if($rec['ip']) {
									$ban_list = 'ip=' . $rec['ip'] . ' host=' . gethostbyaddr($rec['ip']); 
									$this->sendToUser(null, new Message($type, $this->userid, $GLOBALS['fc_config']['liveSupportMode']?$this->roomid:null, $ban_list, $this->color));
								}
							}
							return 'ok';
						}
						$txt = 'No bans found';
						$this->sendToUser(null, new Message($type, $this->userid, $GLOBALS['fc_config']['liveSupportMode']?$this->roomid:null, $txt, $this->color));
						return 'ok';
					}
					return 'ok';
				}

				if($irc_cmd == '/rooms' && $role_admin) {

					$this->sendToUser(null, new Message($type, $this->userid, $GLOBALS['fc_config']['liveSupportMode']?$this->roomid:null, $txt, $this->color));

					$stmt = new Statement("SELECT * FROM {$GLOBALS['fc_config']['db']['pref']}rooms");
					$rs = $stmt->process();
					while($rec = $rs->next()) {
						$rooms = $rec['name'] . ' is';
						if($rec['ispublic']) $rooms .= ' public'; else $rooms .= ' private';
						if(!$rec['ispermanent']) $rooms .= ' and temporary';
						$rooms .= ' room';
						$this->sendToUser(null, new Message($type, $this->userid, $GLOBALS['fc_config']['liveSupportMode']?$this->roomid:null, $rooms, $this->color));
					}
					return 'ok';
				}


				if($irc_cmd == '/welcome' || $irc_cmd == '/topic') {
					$this->sendToUser(null, new Message($type, $this->userid, $GLOBALS['fc_config']['liveSupportMode']?$this->roomid:null, $txt, $this->color));
					include_once(INC_DIR . 'classes/doRoomEntryInfo.php');
					return 'ok';
				}

				if($irc_cmd == '/status' && $role_admin) {
					$this->sendToUser(null, new Message($type, $this->userid, $GLOBALS['fc_config']['liveSupportMode']?$this->roomid:null, $txt, $this->color));

					$stmt = new Statement("SELECT count(*) as msgnumb FROM {$GLOBALS['fc_config']['db']['pref']}messages WHERE command='msg' AND (userid IS NOT NULL OR roomid IS NOT NULL)");
					$rs = $stmt->process();
					$rec = $rs->next();
					$txt = 'Total messages: ' . $rec['msgnumb'];
					$this->sendToUser(null, new Message($type, $this->userid, $GLOBALS['fc_config']['liveSupportMode']?$this->roomid:null, $txt, $this->color));

					$stmt = new Statement("SELECT count(*) as msgnumb FROM {$GLOBALS['fc_config']['db']['pref']}messages WHERE command='msg' AND touserid IS NOT NULL");
					$rs = $stmt->process();
					$rec = $rs->next();
					$txt = 'Private messages: ' . $rec['msgnumb'];
					$this->sendToUser(null, new Message($type, $this->userid, $GLOBALS['fc_config']['liveSupportMode']?$this->roomid:null, $txt, $this->color));

					$stmt = new Statement("SELECT count(*) as msgnumb FROM {$GLOBALS['fc_config']['db']['pref']}bans");
					$rs = $stmt->process();
					$rec = $rs->next();
					$txt = 'Bans: ' . $rec['msgnumb'];
					$this->sendToUser(null, new Message($type, $this->userid, $GLOBALS['fc_config']['liveSupportMode']?$this->roomid:null, $txt, $this->color));

					$stmt = new Statement("SELECT count(*) as msgnumb FROM {$GLOBALS['fc_config']['db']['pref']}ignors");
					$rs = $stmt->process();
					$rec = $rs->next();
					$txt = 'Ignores: ' . $rec['msgnumb'];
					$this->sendToUser(null, new Message($type, $this->userid, $GLOBALS['fc_config']['liveSupportMode']?$this->roomid:null, $txt, $this->color));

					$stmt = new Statement("SELECT count(*) as msgnumb FROM {$GLOBALS['fc_config']['db']['pref']}connections WHERE userid IS NOT NULL");
					$rs = $stmt->process();
					$rec = $rs->next();
					$txt = 'Logged in users: ' . $rec['msgnumb'];
					$this->sendToUser(null, new Message($type, $this->userid, $GLOBALS['fc_config']['liveSupportMode']?$this->roomid:null, $txt, $this->color));

					$stmt = new Statement("SELECT count(*) as msgnumb FROM {$GLOBALS['fc_config']['db']['pref']}rooms");
					$rs = $stmt->process();
					$rec = $rs->next();
					$txt = 'Total Rooms: ' . $rec['msgnumb'];
					$this->sendToUser(null, new Message($type, $this->userid, $GLOBALS['fc_config']['liveSupportMode']?$this->roomid:null, $txt, $this->color));

					$stmt = new Statement("SELECT count(*) as msgnumb FROM {$GLOBALS['fc_config']['db']['pref']}rooms WHERE ispublic IS NULL");
					$rs = $stmt->process();
					$rec = $rs->next();
					$txt = 'Private Rooms: ' . $rec['msgnumb'];
					$this->sendToUser(null, new Message($type, $this->userid, $GLOBALS['fc_config']['liveSupportMode']?$this->roomid:null, $txt, $this->color));

					return 'ok';
				}

				if($irc_cmd == '/names') {
					$this->sendToUser(null, new Message($type, $this->userid, $GLOBALS['fc_config']['liveSupportMode']?$this->roomid:null, $txt, $this->color));

					$stmt = new Statement("SELECT * FROM {$GLOBALS['fc_config']['db']['pref']}rooms ORDER BY id");
					$rs = $stmt->process();

					$stmt = new Statement("SELECT * FROM {$GLOBALS['fc_config']['db']['pref']}connections WHERE userid IS NOT NULL ORDER BY roomid");
					$rs2 = $stmt->process();
 
					$rec = $rs2->next();
					while($room = $rs->next()) {

						$userlist = $room['name'];
						if(!$room['ispublic']) $userlist .= ' (P)';
						$userlist .= ':';
						while($rec['roomid'] == $room['id']) {

							$user = ChatServer::getUser($rec['userid']);
							$spy  = ChatServer::userInRole($rec['userid'], ROLE_SPY);
							if($user && !$spy) $userlist .= ' "' . $user['login'] . '"';
							$rec = $rs2->next();
						}
						if($role_admin || $room['ispublic'] || $room['id'] == $this->roomid) $this->sendToUser(null, new Message($type, $this->userid, $GLOBALS['fc_config']['liveSupportMode']?$this->roomid:null, $userlist, $this->color));
					}
					return 'ok';
				}

				if($irc_cmd == '/sos') {
					$this->sendToUser(null, new Message($type, $this->userid, $GLOBALS['fc_config']['liveSupportMode']?$this->roomid:null, $txt, $this->color));

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -