/q_client.php
PHP | 1510 lines | 1468 code | 0 blank | 42 comment | 225 complexity | 033b93b2a26f9b0fbf67055f5d3e8c1d MD5 | raw file
Large files files are truncated, but you can click here to view the full file
- <?php
- /*
- Classe du robot, uniquement
- */
- class QClient {
- private static $_instance;
- private static $data;
- public static function getInstance(){
- if(!isset(self::$_instance)){ self::$_instance = new self; }
- return self::$_instance;
- }
- function __construct(){echo __CLASS__,": crיation de l'instance\n";}
- function __destruct(){echo __CLASS__,": destruction de l'instance\n";}
- function __clone(){trigger_error("Le clפnage n'est pas autorisי.",E_USER_ERROR);}
- private static function callback_dropkeys($array,$drop=array()){
- $return = array();
- foreach($array AS $key => $value){
- if(!in_array($key,$drop)) $return[]=$value;
- else echo "Clef ignorיe: $key ($value)\n";
- }
- return $return;
- }
- public static function handle($array){
- echo "##### ",__CLASS__," #####\n";
- $cmd=$array[2]=strtoupper(substr($array[2],1));
- self::$data = $array;
- # self::callback_dropkeys($array,array(2));
- echo "Commande: $cmd\n";
- print_r(self::$data);
- echo count(self::$data);
- switch($cmd){
- case 'HELP':self::help();break;# Commandes de niveau 0
- case 'AUTH':self::auth();break;
- case 'HELLO':self::hello();break;
- case 'VALIDATE':self::validate();break;
- case 'WHOAMI':self::whoami();break;# Commandes de niveau 1 et plus
- case 'VOICE':self::voice();break;
- case 'OP':self::op();break;
- case 'DEOPALL':self::deopall();break;
- case 'DEVOICEALL':self::devoiceall();break;
- case 'WELCOME':self::welcome();break;
- case 'SETTOPIC':self::settopic();break;
- case 'CHANMODE':self::chanmode();break;
- case 'CHANFLAGS':self::chanflags();break;
- case 'CHANLEV':self::chanlev();break;
- case 'WHOIS':self::whois();break;# Commandes de niveau 900
- case 'CHANWHO':self::chanwho();break;
- case 'KILL':self::kill();break;
- case 'GLOBALE':self::desynch();break;
- case 'ADDUSER':self::adduser();break;# Commandes de niveau 1000
- case 'DELUSER':self::deluser();break;
- case 'SETUSER':self::setuser();break;
- case 'GETUSER':self::getuser();break;
- case 'ADDCHAN':self::addchan();break;
- case 'DELCHAN':self::delchan();break;
- case 'CHANSET':self::chanset();break;
- case 'SET':self::set();break;
- case 'GET':self::get();break;
- /*case 'CRAW':self::craw();break;
- case 'SRAW':self::sraw();break;
- case 'DNSBL':self::dnsbl();break;
- case 'LOCATE':self::locate();break;
- case 'CLVENC':self::clvenc();break;# Commandes de deboguage
- case 'CLVDEC':self::clvdec();break;
- case 'CHMENC':self::chmenc();break;
- case 'CHMDEC':self::chmdec();break;*/
- case 'SAVE':self::save();break;
- case 'RESTART':self::restart();break;
- case 'DIE':self::shutdown();break;
- case 'STATUS':self::status();break;
- case 'VERSION':self::version();break;
- default:self::error();break;
- }
- }
- public static function handlec($parray){
- self::$data = array($parray[0],$parray[1],ltrim(strtoupper(substr($parray[2],1)),":"));
- if(count($parray)>3){
- $rest = array_slice($parray,3);
- foreach($rest AS $piece) self::$data[]=$piece;
- }
- echo "Donnיes publiques: ".implode(' ',$parray)." (".count($parray).")\n";
- switch(self::$data[2]){
- case "ACTION":self::p_action();break;
- case "PREG":self::p_preg();break;
- //case "LOCATE":self::p_locate();break;
- case "DNSBL":self::p_dnsbl();break;
- }
- }
-
- private static function success(){$cm=QCommands::getInstance();$cm->notice(self::$data[0],"Effectuי.");}
- private static function error(){
- $cm = QCommands::getInstance();
- $cm->notice(self::$data[0],"La commande ".self::$data[2]." n'existe pas ou votre niveau d'accטs est insuffisant.");
- }
- ###########################
- #### Commandes privיes ####
- ###########################
- private static function help(){
- echo "Demande d'aide\n";
- $cm = QCommands::getInstance();
- $db = QDatabase::getInstance();
- $r = QRegister::getInstance();
- if(count(self::$data)==4){
- list($client,,,$command) = self::$data;
- echo "Commande d'aide: $command\n";
- switch(strtoupper($command)){
- case "HELLO":
- $cm->notice($client,array(
- "Syntaxe: HELLO <votre@email.com> <votre@email.com>",
- "La commande HELLO vous permet de crיer un compte utilisateur en utilisant votre pseudonyme actuel.",
- "Exemple si votre pseudo est \"banane\" et que vous tapez: /MSG Q HELLO banane@frou.fr banane@frou.fr",
- "Ceci crיera le compte \"banane\" aprטs votre rיponse א l'email envoyי א banane@frou.fr"
- ));
- break;
- case "VALIDATE":
- $cm->notice($client,array(
- "Syntaxe: VALIDATE <clef>",
- "La commande VALIDATE vous permet de terminer l'enregistrement du compte utilisateur,",
- "le paramטtre <clef> reprיsente la clef qui a יtי envoyיe par email lors de la commande HELLO."
- ));
- break;
- case "AUTH":
- $cm->notice($client,array(
- "Syntaxe: AUTH <mot-de-passe>",
- "La commande AUTH vous permet d'utiliser votre compte utilisateur prיcיdement crיי avec la commande HELLO ( cf HELP HELLO )",
- "Ceci vous permet d'utiliser vos niveaux d'accטs salons et les commandes du service Q"
- ));
- break;
- }
- if($db->isAuthed($client)){
- if($r->getaccount($r->getClientaccount($client),"level")!==false){
- $level = $r->getaccount($r->getClientaccount($client),"level");
- echo __CLASS__.": le client $client est de niveau $level\n";
- }
- if(isset($level)&&$level>=1){
- switch(strtoupper($command)){
- case 'CHANFLAGS':
- $cm->notice($client,array(
- 'Syntaxe: CHANFLAGS <#canal> [<+/-attributs>]',
- 'Cette commande vous permet de paramטtrer votre canal, ou plus prיcisיment le comportement du service sur ce dernier.',
- '-',
- '+w WELCOME - Affiche le message de bienvenue aux utilisateurs rejoignants le canal, pour ךtre dispensי voir le CHANLEV +w',
- '-',
- 'Attributs d\'Automatisme',
- 'Les paramטtres suivants s\'appliquent lors de l\'entrיe d\'un utilisateur sur le canal.',
- '+a AUTOOP - Donne automatiquement le status d\'opיrateur aux utilisateurs ayant un Accטs Opיrateurs (CHANLEV +o) sur le canal.',
- '+g AUTOVOICE - Donne automatiquement le status de modיrateur aux utilisateurs ayant un Accטs Modיrateur (CHANLEV +v) sur le canal.',
- '+o AUTOOPALL - Donne automatiquement le status d\'Opיrateur (+o)',
- '+v AUTOVOICEALL - Donne automatiquement le status de Modיrateur. (+v)',
- '+c AUTOLIMIT - Limite automatiquement le canal afin d\'יviter un engorgement par des attaques de clones/proxys (peut causer du tord aux vrais utilisateurs), pour le rיglage de l\'intervale voir la commande: AUTOLIMIT',
- '-',
- 'Attributs d\'Action',
- 'Les paramטtres suivants s\'appliquent lors d\'actions venant des utilisateurs (changement du sujet, des modes, ...)',
- '+b BITCHMODE* - Le service applique strictement les attributs utilisateurs (+o,+v) et interdit toute modification.',
- '+f TOPICLOCK* - Le service autorise la modification du sujet uniquement par la commande SETTOPIC.',
- '+m MODELOCK* - Le service autorise la modification des modes uniquement par la commande CHANMODE.',
- '+e ENFORCEBANS* - Le service expulse automatiquement les utilisateurs ciblיs par les exclusions.',
- '+p PROTECT - Le service interdit la modification des status utilisateurs par ceux n\'ayant pas d\'accטs',
- 'NOTER QUE: le non-respect rיpיtי des chanflags ci-dessus engendre un retrait de status immיdiat. (protection contre le vol de canal)',
- '* = N\'affecte pas les Superviseurs (CHANLEV +x).',
- '-',
- 'Paramטtres Restritifs',
- '+d DEOPCHAN* - Le service interdit le status d\'Opיrateur (+o) א tous les utilisateurs.',
- '+q NOVOICES* - Le service interdit le status de Modיrateur (+v) א tous les utilisateurs.',
- '+i INVITEONLY* - Le service restreint le canal (+i) aux utilisateurs ayant utilisיs la commande INVITE.',
- '+r REGONLY - Seuls les utilisateurs enregistrיs sont autorisיs א rejoindre le canal.',
- '* = N\'affecte pas les Superviseurs (CHANLEV +x) et le service.',
- '-',
- 'Paramטtres Staff',
- '+t TOPICBURST - Le service renvoie automatiquement le sujet enregistrי depuis la commande SETTOPIC.',
- '+s SUSPEND - Le service n\'est plus actif sur le canal. (les paramטtres sont sauvegardיs)',
- //'+h HELPCHAN - Le service aide les opיrateurs du canal א modיrer les utilisateurs.',
- '-',
- 'MEMO CHANLEV: Fondateur (+f), Superviseur (+x), propriיtaire (+n), maמtre (+m), opיrateur (+o) et modיrateur (+v)',
- 'HELP CHANLEV pour plus de dיtails.'
- ));
- break;
- case 'CHANLEV':
- $cm->notice($client,array(
- 'Syntaxe: CHANLEV <canal> [<compte>] [+/-<attributs>]',
- 'Cette commande permet d\'attribuer/rיtribuer des droits utilisateurs sur le canal.',
- 'Here we go.',
- 'Attributs des Niveaux d\'Accטs',
- '+f FOUNDER - Le Fondateur peut ajouter/retirer des Propriיtaires, Jokers, Maמtres, Opיrateurs et Modיrateurs.',
- 'NOTER QUE: Cet attribut est rattachי au compte, invisible aux utilisateurs et ne peut pas ךtre cedי.',
- '+x SUPERVISOR - Le Superviseur peut outre-passer toutes les restrictions du service.',
- 'Rפle: peut utiliser les commandes si le canal est DEOPCHAN, NOVOICES et est immunisי aux rטgles: BITCHMODE, TOPICLOCK, MODELOCK, ENFORCEBANS',
- '+n OWNER - Le Propriיtaire peut ajouter/retirer des Maמtres, Opיrateurs et Modיrateurs.',
- 'Il peut utiliser les commandes: CHANMODES, CHANFLAGS',
- '+m MASTER - Le Maמtre peut ajouter/retirer des Opיrateurs et Modיrateurs, modifier le sujet du canal (cf HELP SETTOPIC) et exclure des utilisateurs. (cf HELP BAN)',
- '+o OP - L\'Opיrateur peut ajouter/retirer des Modיrateurs.',
- '+v VOICE - Le Modיrateur peut s\'exprimer quand le canal est [CHAN]MODE +m',
- '-',
- 'Attributs d\'Automatismes',
- '+a AUTOOP - Si l\'utilisateur est attribuי +o (Opיrateur) le status d\'Opיrateur (@) lui sera automatiquement dispensי.',
- '+g AUTOVOICE - Si l\'utilisateur est attribuי +v (Modיrateur) le status de Modיrateur (+) lui sera automatiquement dispensי.',
- '+j AUTOINVITE - L\'utilisateur est automatiquement invitי lors de son identification (AUTH). N\'a rien en rapport avec le CHANFLAG +i qui est appliquי autrement.',
- '+s SECRET - Le Fondateur n\'est pas affichי dans les Accטs du canal. (mis par dיfaut)',
- 'Attributs Restrictifs',
- '+d DEOP - L\'utilisateur n\'est pas autorisי א recevoir le status d\'Opיrateur (@) sur le canal.',
- '+q QUIET - L\'utilisateur n\'est pas autorisי א recevoir le status de Modיrateur (+) sur le canal.'
- ));
- break;
- case 'DEOPALL':
- $cm->notice($client,array(
- 'Syntaxe: DEOPALL <#canal>',
- 'Retire le status d\'Opיrateur (@) א tous les opיrateurs du canal.',
- ));
- break;
- case 'DEVOICEALL':
- $cm->notice($client,array(
- 'Syntaxe: DEVOICEALL <#canal>',
- 'Retire le status de Modיrateur (+) א tous les modיrateurs du canal.',
- ));
- break;
- }
- }
- if(isset($level)&&$level>=900){
- switch(strtoupper($command)){
- case 'SUSPEND':
- $cm->notice($client,array(
- 'Syntaxe: SUSPEND <#canal>',
- 'Le service se retire du canal et n\'autorise pas son utilisation sur ce dernier.',
- 'L\'Attribut +s sera ajoutי au canal.',
- 'Niveau requis: Opיrateur (Niv. 900)'
- ));
- break;
- case 'UNSUSPEND':
- $cm->notice($client,array(
- 'Syntaxe: UNSUSPEND <#canal>',
- 'Le service retourne sur le canal et autorise son utilisation sur ce dernier.',
- 'Application: Attribut de canal Dי-Suspendu ( CHANFLAG +s )',
- 'Niveau requis: Opיrateur (Niv. 900)'
- ));
- break;
- }
- }
- if(isset($level)&&$level==1000){
- switch(strtoupper($command)){
- case "WHOAMI":
- $cm->notice($client,array(
- "Syntaxe: WHOAMI",
- "La commande WHOAMI vous permet d'afficher vos champs de connexion ( pseudo, adresse internet, nom rיel, numיrique, ... )",
- "Elle permet (optionnellement) d'afficher vos information de compte"
- ));
- break;
- case "WHOIS":
- $cm->notice($client,array(
- "Syntaxe: WHOIS <pseudo>",
- "WHOIS permet d'afficher les champs utilisateur bruts d'un pseudo donnי.",
- "En fonction de votre niveau, les informations peuvent ךtre masquיes/affichיes.",
- ));
- break;
- case "ADDUSER":
- $cm->notice($client,array(
- "Syntaxe: ADDUSER <compte> <email@isp.com>",
- "ADDUSER permet de crיer manuellement un compte utilisateur,",
- "par dיfaut, le compte est de niveau 1 et le mot de passe n'est pas rיglי. ( compte dיsactivי )"
- ));
- break;
- case "DELUSER":
- $cm->notice($client,array(
- "Syntaxe: DELUSER <compte>",
- "DELUSER permet de supprimer manuellement un compte utilisateur, cette commande est irrיversible et tous",
- "les accטs salon sont rיcursivement dיtruits.",
- ));
- break;
- case "SETUSER":
- $cm->notice($client,array(
- "Syntaxe: SETUSER <compte> <champ> <valeur>",
- "SETUSER permet de gטrer les champs d'un compte utilisateur.",
- "Les champs disponibles sont: LEVEL, EMAIL, PASSWORD, NOEXPIRES, VHOST",
- "Les champs GREETING sont des champs optionnels et ne sont pas configurables",
- "par les admins, ces champs peuvent ךtre consultיs via la commande GETUSER."
- ));
- break;
- case "GETUSER":
- $cm->notice($client,array(
- "Syntaxe: GETUSER [<champ>]",
- "GETUSER permet d'afficher les champs d'un utilisateur,",
- "si aucun paramטtre n'est fourni, tous les champs seront affichיs."
- ));
- break;
- case "USERINFO":
- $cm->notice($client,array(
- "Syntaxe: USERINFO <compte>",
- "USERINFO permet d'afficher les donnיes d'un compte dans leur intיgralitי,",
- "seuls les administrateurs rיseaux sont abilitיs א utiliser cette commande."
- ));
- break;
- case "ADDCHAN":
- $cm->notice($client,array(
- "Syntaxe: ADDCHAN <#canal> <fondateur>",
- "ADDCHAN permet d'ajouter un canal enregistrי, ce dernier est statique et ne peut ךtre retirי",
- "que par un administrateur rיseau/service ou aprטs expiration de la derniטre date d'utilisation."
- ));
- break;
- case "DELCHAN":
- $cm->notice($client,array(
- "Syntaxe: DELCHAN <#canal>",
- "DELCHAN permet de supprimer un canal enregistrי, supprimant tous les enregistrements ( chanlev, chanflags et chanmode )"
- ));
- break;
- case "CHANSET":
- $cm->notice($client,array(
- "Syntaxe: CHANINFO <#canal> [<champ>]",
- "CHANINFO permet d'afficher les donnיes d'un canal enregistrי. ( chanmode, chanflags, fondateur, crיateur )",
- "Les champs disponibles sont: CHANMODE, CHANFLAGS, FOUNDER, CREATOR"
- ));
- break;
- }
- }
- }
- }elseif(count(self::$data)==3){
- list($client,,) = self::$data;
- $cm->notice($client,array(
- "Commandes sans niveau d'accטs",
- "HELP [<commande>] - Affiche l'aide complטte ou sur la commande spיcifiיe",
- "HELLO <courrier@electronique.com> <courrier@electronique.com> - Demander l'enregistrement de votre compte utilisateur, les adresses de courrier doivent ךtre identiques.",
- "VALIDATE <clef> - Terminer l'enregistrement de votre compte utilisateur, la clef est fournie dans l'email de demande de compte ( voir HELLO )",
- "AUTH <mot-de-passe> - Vous identifier sous votre compte utilisateur"
- ));
- if($r->getaccount($r->getClientaccount($client),'level')!==false){
- $level = $r->getaccount($r->getClientaccount($client),'level');
- echo __CLASS__.": le client $client est de niveau $level\n";
- if($db->isAuthed(self::$data[0])){
- if(isset($level)&&$level>=1){
- $cm->notice(self::$data[0],array(
- "-",
- "Utilisateur Enregistrי ( Niveau 1 )",
- "WHOAMI - Affiche vos champs utilisateur (pseudo, numיrique, status...)",
- "CHANLEV <#canal> - Affiche les accטs utilisateur du canal",
- "CHANFLAGS <#canal> [+/-<chanflags>] - Rטgle les attributs du canal",
- "CHANMODE <#canal> [+/-<chanmode>] - Rטgle les modes du canal",
- ));
- }
- if(isset($level)&&$level>=900){
- $cm->notice(self::$data[0], array(
- "-",
- "Opיrateurs IRC (Niveau 900)",
- "WHOIS <utilisateur> - Affiche les informations sur l'utilisateur",
- "CHANWHO <#canal> - Affiche les informations relatives au canal",
- "CLEARMODE <#canal> [modes a nettoyer] - Retire tous les modes du canal ciblי",
- "KILL <pseudo> [<motif>] - Dיconnecte un utilisateur du rיseau avec ou sans le motif",
- "GLINE <#canal|utilisateur@adresse> [<durיe>] [<motif>] - Exclure un utilisateur/canal du rיseau",
- "SERVERS - Affiche la liste des serveurs connectיs"
- ));
- }
- if(isset($level)&&$level==1000){
- $cm->notice(self::$data[0], array(
- "-",
- "Administrateurs IRC ( Niveau 1000 )",
- "ADDUSER <compte> <email> [<niveau>] - Crיי un compte utilisateur",
- "DELUSER <compte> - Supprime un compte utilisateur",
- "SETUSER <compte> <champ> <valeur> - Modifier les champs d'un compte",
- "ADDCHAN <#canal> <fondateur> [<type de salon>] [<attr salon>]",
- "DELCHAN <#canal> - Supprime un canal",
- "CHANSET <#canal> [<option>] [<arguments>] - Sans option, affiche toutes les informations du canal sinon affiche la valeur de l'option, les arguments modifient la valeur de l'option.",
- "SRAW <token> <paramטtres> - Execute une commande serveur brute ( attention, ceci peut crasher le serveur si mal utilisי )",
- "CRAW <token> <paramטtres> - Execute une commande client brute ( idem )",
- "GLOBALE <message> - Envoie un message par le serveur א tous les opיrateurs connectיs",
- "SHUTDOWN - Stoppe le service ( יteint le processus )",
- "RECONNECT - Redיmarre la connexion au serveur"
- ));
- }
- }
- }
- }
- }
- private static function p_preg(){
- $cm = QCommands::getInstance();
- # PREG <MASQUE> <PHRASE>
- if(preg_match("/^(?<patern>\/[^ ]+[\/ei])\s(?<text>.*+)/",implode(' ', array_slice(self::$data,3)),$cases)){
- $cm->message(self::$data[1],"Requete de PREG avec patron \"".$cases['patern']."\" et le texte ".preg_quote($cases['text'],'/'));
- $result=preg_match($cases['patern'], preg_quote($cases['text'],'/'), $matches);
- if($result>0){
- $cm->message(self::$data[1],"Rיsultat: ".$result);
- foreach($matches AS $key => $match){ $cm->message(self::$data[1], "$key: $match"); }
- }elseif($result==0){
- $cm->message(self::$data[1],"Aucun rיsultat");
- }else{
- switch(preg_last_error()){
- case PREG_BACKTRACK_LIMIT_ERROR:
- $cm->message(self::$data[1],"Erreur: La limite de backslashes est dיpassיe");
- break;
- case PREG_INTERNAL_ERROR:
- $cm->message(self::$data[1],"Erreur interne");
- break;
- case PREG_NO_ERROR:
- $cm->message(self::$data[1],"Aucune erreur");
- break;
- default:
- $cm->message(self::$data[1],"Erreur non prise en charge, veuillez vous rיfיrer א la documentation pcre");
- break;
- }
- }
- }
- }
- private static function p_action(){
- # <SSCCC> <#canal> <:[SOH]ACTION slaps blah with bleh[SOH]>
- if(count(self::$data)>3){
- $db = QDatabase::getInstance();
- $str = implode(' ',array_slice(self::$data,2));
- if(preg_match("/".CL_NICKNAME."/i", $str)){
- $retstring = preg_replace("/".CL_NICKNAME."/i", $db->num2nick(self::$data[0]), $str);
- QCommands::getInstance()->message(self::$data[1],$retstring);
- }
- }
- }
- ###############################################
- # Commandes de niveau 0 (sans enregistrement) #
- ###############################################
- private static function hello(){
- # <SSCCC> <Q_NUM> HELLO <email> <email>
- $cm = QCommands::getInstance();
- if(count(self::$data)==3){QCommands::getInstance()->notice(self::$data[0],array("Syntaxe: HELLO <email> <email>","Pour d'avantage d'informations veuillez utiliser: HELP HELLO"));}
- if(count(self::$data)==5){
- list($client,,,$email1,$email2) = self::$data;
- $db = QDatabase::getInstance();
- $r = QRegister::getInstance();
- $account = $db->num2nick($client);# On rיcupטre le pseudo du client
- if(!$r->isaccount($account)){
- if($email1 === $email2){
- if(filter_var($email1,FILTER_VALIDATE_EMAIL) && !$r->isqueued($account)){
- if(self::mail_verify($email1)){
- $cm->notice($client,"Prיparation du courrier en cours, veuillez patienter");
- $r->addqueued($account,$email1);
- $key = $r->getqueued($account,"key");
- $for = sprintf('%s <%s>',$account,$email1);
- $subject = "Confirmation d'enregistrement de votre compte utilisateur";
- $headers = array(
- "From: \"MadGamerZ IRC\" <QBot@irc.madgamerz.fr>",
- "Reply-To: noreply@irc.madgamerz.fr",
- "Content-Type: text/plain",
- "X-Mailer: PHP-".phpversion()
- );
- $message = array(
- "Cher nouvel utilisateur,",
- "vous avez rיcemment demandי la crיation d'un compte pour l'utilisateur ".$account.".",
- "Afin d'achever la procיdure veuillez effectuer cette commande sur IRC :",
- "/MSG Q VALIDATE ".$key,
- "ATTENTION: ne copiez/collez pas la commande, retappez la entiטrement sur IRC !",
- " ",
- "Merci d'utiliser MadGamerZ IRC"
- );
- $mailed = mail($for,$subject,implode("\r\n",$message),implode("\n",$headers));
- if($mailed==true){
- $cm->notice($client,array(
- "Un courrier יlectronique vous a יtי envoyי afin d'achever la procיdure d'enregistrement,",
- "comme le message est rיdigי en HTML, il est possible que ce dernier arrive dans le dossier SPAM de votre boמte mail."
- ));
- } else { $cm->notice($client,"Une erreur est survenue lors de l'envoi du courrier, veuillez retenter l'opיration."); $r->delqueued($account); }
- } else { $cm->notice($client,"Etes vous sur que ce serveur de messagerie existe ? Erreur MX"); }
- } else { $cm->notice($client,"L'adresse fournie est incorrecte."); }
- } else { $cm->notice($client,"Les deux adresses de courrier יlectronique doivent ךtre identiques."); }
- } else { $cm->notice($client,"Syntaxe: /MSG Q HELLO <adresse@electronique.com> <adresse@electronique.com>"); }
- } else { $cm->notice(self::$data[0],"Ce compte existe dיjא, vous ne pouvez pas l'enregistrer א nouveau."); }
- }
- private static function validate(){
- # Fonction pour achever l'enregistrement du nom utilisateur.
- # <SSCCC> <Q_NUM> VALIDATE <KEYCODE>
- $cm = QCommands::getInstance();
- if(count(self::$data)==3) $cm->notice(self::$data[0],array("Syntaxe: /MSG Q validate <clef>","La clef vous est fournie dans le courriel d'enregistrement."));
- if(count(self::$data)==4){
- list($client,$clef) = self::$data;
- $db = QDatabase::getInstance();
- $r = QRegister::getInstance();
- $account = $db->num2nick($client);
- if($r->isqueued($account)){
- if($clef===$r->getqueued($account,"key")){
- $r->addaccount($account,$r->getqueued($account,"email"),1);
- $r->updateaccount($account,"password",$clef);
- $r->delqueued($account);
- $cm->notice($client,array(
- "L'enregistrement de votre compte est terminי!",
- "Pour l'utiliser veuillez taper: /MSG Q AUTH ".$clef,
- "ATTENTION: le staff de MadGamerZ ne vous demandera jamais votre mot-de-passe ( nous les connaissons )",
- "si quelqu'un vous le demande, veuillez contacter un opיrateur/administrateur au plus vite afin de signaler l'abus.",
- " ",
- "L'יquipe de MadGamerZ IRC vous souhaite un agrיable chat !",
- "Pour de l'aide sur l'utilisation du service, veuillez vous rendre sur #help"
- ));
- }else{
- $try = (int)$r->getqueued($account,"try");
- if($try > 0){
- $cm->notice($client,"La clef fournie est invalide, ".$try." tentatives restantes.");
- $r->setqueued($account,"try",--$try);
- }else{$cm->skill($client,"Tentative d'usurpation d'identitי.");$r->delqueued($account);}
- }
- }else{$cm->notice($client,"Votre compte n'est pas en instance de validation.");}
- }
- }
- private static function auth(){
- $cm = QCommands::getInstance();
- if(count(self::$data)==3) $cm->notice(self::$data[0],"Syntaxe: AUTH <mot-de-passe>");
- if(count(self::$data)==4){
- list($client,,,$passwd) = self::$data;
- $db = QDatabase::getInstance();
- $account = $db->num2nick($client);
- if(!$db->isAuthed($client)){
- $r = QRegister::getInstance();
- if($r->isaccount($account)){
- if($r->getaccount($account,'password')!==false && $passwd===$r->getaccount($account,'password')){
- $db = QDatabase::getInstance();
- $r->addAccountclient($account,$client);
- $cm->account($client,$account,$r->getaccount($account,"id"),$r->getaccount($account,"created"),$r->getaccount($account,"level"));
- $db->parsemodes($client,array('+r',$account));
- $cm->notice($client,"Vous ךtes maintenant connectי avec le compte $account");
- $db->updateclient($client,'account',$account);
- if($r->getaccount($account,"vhost")!==false){
- if(($db->getclient($client,"virtualhost")===false) or $db->getclient($client,"virtualhost")!=$r->getaccount($account,"vhost")){
- list($user,$host) = explode("@",$r->getaccount($account,"vhost"));
- $cm->sethost($client,$user,$host);
- $db->parsemodes($client,array('+h',$user.'@'.$host));
- }
- }
- if($db->getclient($client,'channels')!==false&&$db->getclient($client,'channels')!=null){
- $names = $db->getclient($client,'channels');
- print_r($names);
- foreach($names AS $name){
- if($r->isreg($name)&&$r->isChanlev($name,$account)){
- if($r->getChanlev($name,$account,'a')&&!in_array('o',$db->getchanmember($name,$client))){
- $cm->mode($name,'+o',$client);
- }
- if($r->getChanlev($name,$account,'g')&&!in_array('v',$db->getchanmember($name,$client))){
- $cm->mode($name,'+v',$client);
- }
- }
- }
- }else{echo __FUNCTION__,": Le client $client n'a pas de salon.\n";}
- }else{$cm->notice($client,"Le mot-de-passe fourni n'est pas valide ou le mot-de-passe pour ce compte n'existe pas.");}
- }else{$cm->notice($client,"Le compte liי א votre pseudo n'existe pas");}
- }else{$cm->notice($client,"Vous utilisez actuellement un compte utilisateur, veuillez vous reconnecter.");}
- }
- }
- ##
- # Fonctions nickserv
- ##
- private static function requestnick(){
- $cm=QCommands::getInstance();
- if(count(self::$data)==3) $cm->notice(self::$data[0],"Syntaxe: REQUESTNICK <pseudo> <mot-de-passe>");
- if(count(self::$data)==4){
- list($client,,$account,$password)=self::$data;
- $r = QRegister::getInstance();
- if($r->isaccount($account)){
-
- }
- }
- }
- ##
- # Commandes de niveau 1 (utilisateur enregistrי)
- ##
- private static function whoami(){
- $cm = QCommands::getInstance();
- $db = QDatabase::getInstance();
- if($db->isAuthed(self::$data[0])){
- if(count(self::$data)==1){
- list($client,) = self::$data;
- if($db->isAuthed($client)){
- $account = $db->getclient($client,'account');
- $r = QRegister::getInstance();
- $chars = QChars::getInstance();
- $cm->notice($client,array(
- "Identitי: ".$db->getclient($client,'nickname')." ".$db->getclient($client,'hostname')."@".$db->getclient($client,'username'),
- "Nom rיel: ".$db->getclient($client,'realname'),
- "Numיrique: ".$db->getclient($client,'numeric'),
- "Ip 64bits: ".$db->getclient($client,'b64ip'),
- "Modes: ".$db->getclient($client,'usermode')." (hex: ".$chars->usermode_encode(substr($db->getclient($client,'usermode'),1)).")")
- );
- if($db->isAdmin($client)){ $cm->notice($client,'Administrateur IRC'); }
- elseif($db->isOper($client)){ $cm->notice($client,'Opיrateur IRC'); }
- else { $cm->notice($client,"Utilisateur IRC"); }
- if($db->getclient($client,'opername')!==false){ $cm->notice($client, "Nom d\'opיrateur: ".$db->getclient($client,'opername')); }
- if($db->getclient($client,'virtualhost')!==false){ $cm->notice($client, "Hפte virtuel: ".$db->getclient($client,'virtualhost')); }
- $cm->notice($client,array(
- "Dיtails de votre compte utilisateur",
- "Id utilisateur: ".$r->getaccount($account,'id'),
- "Niveau du compte: ".$r->getaccount($account,'level'),
- "Date et heure de crיation: ".strftime('%c',$r->getaccount($account,'created'))
- )
- );
- }
- } else { $cm->notice(self::$data[0],'Syntaxe: WHOAMI'); }
- }
- }
- private static function settopic(){
- $cm = QCommands::getInstance();
- $db = QDatabase::getInstance();
- if($db->isAuthed(self::$data[0])){
- $r = QRegister::getInstance();
- $account = $db->getclient(self::$data[0],'account');
- if(count(self::$data)==3) $cm->notice(self::$data[0],"Syntaxe: SETTOPIC <#canal> [<nouveau sujet>]");
- if(count(self::$data)==4){# Consultation
- list($client,,,$name) = self::$data;
- if($r->isreg($name)){
- if($r->isChanlev($name,$account)){
- if($r->getChanlev($name,$account,'t')||$r->getChanlev($name,$account,'m')||$r->getChanlev($name,$account,'n')){
- if($r->getreg($name,"topic")!==false){ $cm->notice($client,"Le sujet du canal $name est: ".$r->getreg($name,"topic")); }
- else { $cm->notice($client,"Aucun sujet n'a יtי choisi pour ce canal."); }
- } else { $cm->notice($client,"Votre niveau d'accטs sur $name ne vous permet pas d'utiliser SETTOPIC."); }
- } else { $cm->notice($client,"Vous n'avez pas d'accטs sur $name"); }
- } else { $cm->notice($client,"Le canal $name semble ne pas ךtre enregistrי."); }
- }
- if(count(self::$data)>4){# Rיglage
- list($client,,,$name) = self::$data;
- if($r->isreg($name)){
- if($r->isChanlev($name,$account)){
- if($r->getChanlev($name,$account,'t')||$r->getChanlev($name,$account,'m')||$r->getChanlev($name,$account,'n')){
- $str=implode(' ',array_slice(self::$data,4));
- $cm->topic($name,$str);
- $db->updatechan($name,'topic',$str);
- $r->updatereg($name,"topic",$str);$cm->notice($client,"Effectuי");
- } else { $cm->notice($client,"Votre niveau d'accטs sur $name ne vous permet pas d'utiliser SETTOPIC."); }
- } else { $cm->notice($client,"Vous n'avez pas d'accטs sur $name"); }
- } else { $cm->notice($client,"Le canal $name semble ne pas ךtre enregistrי."); }
- }
- } else { $cm->notice(self::$data[0],"Vous devez ךtre identifiי pour utiliser cette commande."); }
- }
- private static function welcome(){
- $cm = QCommands::getInstance();
- $db = QDatabase::getInstance();
- if($db->isAuthed(self::$data[0])){
- $account = $db->getclient(self::$data[0],'account');
- $r = QRegister::getInstance();
- if(count(self::$data)==3) $cm->notice(self::$data[0],"Syntaxe: WELCOME <#canal> [message de bienvenue]");
- if(count(self::$data)==4){ // Consultation
- list($client,,,$name) = self::$data;
- if($r->isreg($name)){
- if($r->isChanlev($name,$account)){
- if($r->getChanlev($name,$account,'m')||$r->getChanlev($name,$account,'n')){
- if($r->getreg($name,"welcome")!==false && $r->getreg($name,"welcome")!=null){ $cm->notice($client,"Le message d'accueil du canal $name est: ".$r->getreg($name,"welcome")); }
- else{$cm->notice($client,"$name: aucun message d'accueil n'a יtי dיfini."); }
- }else{$cm->notice($client,"Votre niveau d'accטs sur $name ne vous permet pas d'utiliser WELCOME."); }
- } else {$cm->notice($client,"Vous devez possיder un accטs sur $name pour utiliser cette commande."); }
- } else { $cm->notice($client,"Le canal $name semble ne pas ךtre enregistrי."); }
- }elseif(count(self::$data)>4){ // Rיglage
- list($client,,,$name,) = self::$data;
- if($r->isreg($name)){
- if($r->isChanlev($name,$account)){
- if($r->getChanlev($name,$account,'m')||$r->getChanlev($name,$account,'n')){
- $str = implode(' ',array_slice(self::$data,4));
- $r->updatereg($name,"welcome",$str);
- $cm->notice($client,"Effectuי");
- } else { $cm->notice($client,"Votre niveau d'accטs sur $name ne vous permet pas d'utiliser WELCOME."); }
- } else { $cm->notice($client,"Vous devez possיder un accטs sur $name pour utiliser cette commande."); }
- } else { $cm->notice($client,"Le canal $name semble ne pas ךtre enregistrי."); }
- }
- } else { $cm->notice(self::$data[0],"Vous devez ךtre identifiי pour utiliser cette commande."); }
- }
- private static function chanlev(){
- $cm = QCommands::getInstance();
- $db = QDatabase::getInstance();
- if($db->isAuthed(self::$data[0])){
- print_r(self::$data);
- $account = $db->getclient(self::$data[0],'account');
- $r = QRegister::getInstance();
- if(count(self::$data)==3){$cm->notice(self::$data[0],'Syntaxe: CHANLEV <#canal> [<compte>] [<+/-droits>]');}
- if(count(self::$data)==4){# Consultation globale
- list($client,,,$name)=self::$data;
- if($r->isreg($name)){
- if($r->isChanlev($name,$account)){
- $cm->notice($client,array(
- "Information sur le canal ".$name,
- "Fondateur: ".$r->getreg($name,'founder'),
- "Ajoutי par l'administrateur ".$r->getreg($name,'adder').", le ".strftime("%A %d %B %Y א %X",$r->getreg($name,'created')),
- " ",
- "Compte - Accטs"
- ));
- $chars = QChars::getInstance();
- $levs = $r->getreg($name,"chanlev");# Attention, renvoie un tableau
- foreach($levs AS $acc => $lev) $cm->notice($client,$acc." - ".$chars->chanlev_decode($lev));
- }else $cm->notice($client,"Vous devez possיder un accטs sur $name pour utiliser cette commande.");
- }else $cm->notice($client,"Le canal $name semble ne pas ךtre enregistrי.");
- }
- if(count(self::$data)==5){# Consultation individuelle
- list($client,,,$name,$uaccount) = self::$data;
- if($r->isreg($name)){
- if($r->isChanlev($name,$account)){
- if($r->isChanlev($name,$uaccount)){$cm->notice($client,"Chanlev de $uaccount sur $name: ".$r->getRegaccount($name,$uaccount));}
- else{$cm->notice($client,"Il semble que le compte utilisateur $uaccount n'ai pas d'accטs sur $name.");}
- }
- }else{$cm->notice($client,"Le canal $name semble ne pas ךtre enregistrי");}
- }
- if(count(self::$data)==6){# Modification
- list($client,,,$name,$uaccount,$flags) = self::$data;
- if($r->isreg($name)){
- if($r->isChanlev($name,$account)){
- if($r->isChanlev($name,$uaccount)){
- if(preg_match('#^[\-\+]([abdgmnoqstvw]+)#',$flags,$changes)){
- $attribs = str_split($changes[1]);
- if(in_array(array('n','m','o','v','t'),$attribs)){
- if(in_array('n',$attribs)){
- if($r->getChanlev($name,$account,'f')){$r->parseChanlev($name,$uaccount,$flags);$cm->notice($client,'Effectuי');}
- else{$cm->notice($client,"Vous n'avez pas les droits nיcessaires sur $name pour modifier ce CHANLEV");}
- }
- if(in_array('m',$attribs)){
- if($r->getChanlev($name,$account,'f')||$r->getChanlev($name,$account,'n')){
- $r->parseChanlev($name,$uaccount,$flags);$cm->notice($client,'Effectuי');
- }else{$cm->notice($client,"Vous n'avez pas les droits nיcessaires sur $name pour modifier ce CHANLEV");}
- }
- if(in_array(array('a','o','g','v','t'),$attribs)){
- if($r->getChanlev($name,$account,'f')||$r->getChanlev($name,$account,'n')||$r->getChanlev($name,$account,'m')){
- $r->parseChanlev($name,$uaccount,$flags);$cm->notice($client,'Effectuי');
- }else{$cm->notice($client,"Vous n'avez pas les droits nיcessaires sur $name pour modifier ce CHANLEV");}
- }
- }else{$r->parseChanlev($name,$uaccount,$flags);}
- //$r->parseChanlev($name,$account,$flags);// Routine externe
- $cm->notice($client,"Chanlev de $uaccount sur $name: ".$r->getRegaccount($name,$uaccount));
- }else $cm->notice($client,"L'un des attributs semble incorrect.");
- }else $cm->notice($client,"Il semble que le compte utilisateur $account n'ai pas d'accטs sur $name.");
- }else $cm->notice($client,"Vous n'avez pas d'accטs sur $name.");
- }else $cm->notice($client,"Le canal $name semble ne pas ךtre enregistrי");
- }
- }else{$cm->notice(self::$data[0],"Vous devez ךtre identifiי pour utiliser cette commande.");}
- }
- private static function chanflags(){
- print_r(self::$data);
- $cm = QCommands::getInstance();
- $db = QDatabase::getInstance();
- if($db->isAuthed(self::$data[0])){
- $account = $db->getclient(self::$data[0],'account');
- $r = QRegister::getInstance();
- if(count(self::$data)==3){$cm->notice(self::$data[0],'Syntaxe: CHANFLAGS <#canal> [<+/-attributs>]');}
- if(count(self::$data)==4){
- list($client,,,$name) = self::$data;
- if($r->isreg($name)){
- if($r->isChanlev($name,$account)){
- $chars = QChars::getInstance();
- $chanflags = $chars->chanflags_decode($r->getreg($name,"chanflags"));
- $cm->notice($client,"Le chanflag du canal ".$name." est: +".$chanflags);
- } else { $cm->notice($client,"Vous devez possיder un accטs sur $name pour utiliser cette commande."); }
- } else { $cm->notice($client,"Le canal $name semble ne pas ךtre enregistrי"); }
- }
- if(count(self::$data)==5){
- list($client,,$name,$flags) = self::$data;
- if($r->isreg($name)){
- if($r->isChanlev($name,$account)){
- if($r->getChanlev($name,$account,'n')||$r->getChanlev($name,$account,'m')){
- $r->parseChanflags($name,$flags);
- $chars = QChars::getInstance();
- $cm->notice($client,"Les modes du canal $name sont actuellement: +".$chars->chanflags_decode($r->getreg($name,"chanflags")));
- }else{$cm->notice($client,"Vous n'avez pas le niveau d'accטs requis pour modifier les CHANFLAGS de $name");}
- }else{$cm->notice($client,"Vous devez possיder un accטs sur $name pour utiliser cette commande.");}
- }else{$cm->notice($client,"Le canal $name semble ne pas ךtre enregistrי");}
- }
- }else{$cm->notice(self::$data[0],"Vous devez ךtre identifiי pour utiliser cette commande.");}
- }
- # CHANMODE <#canal> [<changements>]
- private static function chanmode(){
- $cm = QCommands::getInstance();
- $db = QDatabase::getInstance();
- if($db->isAuthed(self::$data[0])){
- $account = $db->getclient(self::$data[0],'account');
- $r = QRegister::getInstance();
- if(count(self::$data)==3) $cm->notice(self::$data[0],'Syntaxe: CHANMODE <#canal> [<+/-modes>]');
- if(count(self::$data)==4){ // Consultation
- list($client,,$name)=self::$data;
- $r = QRegister::getInstance();
- if($r->isreg($name)){
- if($r->isChanlev($name,$account)){
- if($r->getaccount($account,'level')>=900||$r->getChanlev($name,$account,'n')||$r->getChanlev($name,$account,'m')){
- $chars = QChars::getInstance();
- $chanmode = $chars->chanmode_decode($r->getreg($name,'chanmode'));
- $cm->notice($client,"Les modes du canal ".$name." sont actuellement: +".$chanmode);
- }else{$cm->notice($client,"Vous n'avez pas le niveau d'accטs requis pour consulter le CHANMODE de ce canal");}
- }else{$cm->notice($client,"Vous devez possיder un accטs sur ".$name." pour utiliser cette commande.");}
- }else{$cm->notice($client,"Le canal ".$name." semble ne pas ךtre enregistrי");}
- }elseif(count(self::$data)==5){ // Rיglage
- list($client,,$name,$modes)=self::$data;
- $r = QRegister::getInstance();
- if($r->isreg($name)){
- if($r->isChanlev($name,$account)){
- if($r->getaccount($account,'level')>=900||$r->getChanlev($name,$account,'n')||$r->getChanlev($name,$account,'m')){
- $r->parseChmodes($name,$modes);
- $chars = QChars::getInstance();
- if($r->ischanflag($name,'m')){# Si ModeLock actif, les modes sont modifiיs directement par le service
- $cm->mode($name,'-imnpstrDdRucCNMT+'.$chars->chanmode_decode($r->getreg($name,'chanmode')),null);
- $cm->snotice($client,"modelock: les modes de $name ont יtיs modifiיs sans prיavis.");
- }
- $cm->notice($client,"Les modes du canal $name sont maintenant: +".$chars->chanmode_decode($r->getreg($name,'chanmode')));
- }else{$cm->notice($client,"Vous n'avez pas le niveau d'accטs nיcessaire sur $name pour modifier le CHANMODE");}
- }else{$cm->notice($client,"Vous devez possיder un accטs sur $name pour utiliser cette commande.");}
- }else{$cm->notice($client,"Le canal $name semble ne pas ךtre enregistrי");}
- }
- }else{$cm->notice(self::$data[0],"Vous devez ךtre identifiי pour utiliser cette commande.");}
- }
- # DEOPALL <#canal>
- private static function deopall(){
- $cm = QCommands::getInstance();
- $db = QDatabase::getInstance();
- if($db->isAuthed(self::$data[0])){
- $account = $db->getclient(self::$data[0],'account');
- $r = QRegister::getInstance();
- if(count(self::$data)==2) $cm->notice(self::$data[0],"Syntaxe: DEOPALL <#canal>");
- if(count(self::$data)==3){
- list($client,,$name)=self::$data;
- if($r->isreg($name)){
- if($r->isChanlev($name,$account)){
- if($r->getaccount($account,'level')>=900||$r->getChanlev($name,$account,'n')||$r->getChanlev($name,$account,'m')){
- $clients = $db->getchanmembers($name);
- if($clients!==false){
- foreach($clients AS $client => $modes){if(strpos($modes,'o')!==false){$queue[]=$client;$db->updatechanmember($name,$client,array('-'=>'o'));}}
- $i=count($queue);$deop=array();
- while($i){
- $deop[]=$queue[$i-1];
- if(count($deop)==6){$cm->mode($name,'-oooooo',implode(' ',$deop));$deop=array();}
- $i--;
- }
- if(count($deop)>0){$cm->mode($name,'-'.str_repeat('o',count($deop)),implode(' ',$deop));}
- }
- }else{$cm->notice($client,"Vous n'avez pas le niveau d'accטs nיcessaire sur $name pour utiliser DEOPALL");}
- }else{$cm->notice($client,"Vous devez possיder un accטs sur $name pour utiliser cette commande.");}
- }else{$cm->notice(self::$data[0],"Le canal $name semble ne pas ךtre enregistrי");}
- }
- }else{$cm->notice(self::$data[0],"Vous devez ךtre identifiי pour utiliser cette commande.");}
- }
- private static function opall(){
- $db=QDatabase::getInstance();
- if($db->isAuthed(self::$data[0])){# L'utilisateur est identifiי ?
- $acc = $db->getclient(self::$data[0],'account');# Nous rיcupיrons le compte utilisateur.
- if(count(self::$data)==2) QCommands::getInstance()->notice(self::$data[0],array("Syntaxe: DEOPALL <#canal>","Vous devez ךtre maמtre (+m) au minimum."));
- if(count(self::$data)==3){
- list($client,,$name)=self::$data;
- $r = QRegister::getInstance();
- if($r->isreg($name)&&$r->ischanlev($name,$acc)){# Le canal est enregistrי et l'utilisateur y a accטs ?
- QCommands::getInstance()->notice($client,"Veuillez patienter...");
- if(($r->getchanlev($name,$acc,'m')||$r->getchanlev($name,$acc,'n'))||($db->isoper($client)||$db->isadmin($client))){
- foreach($db->getchanmembers($name) AS $client => $modes){
- if(strpos($modes,'o')===false){$queue[]=$client;$db->updatechanmember($name,$client,array('+'=>'o'));}
- }
- }
- } else { QCommands::getInstance()->notice(self::$data[0],"Soit le canal ".$name." n'est pas enregistrי, soit vous n'avez pas d'accטs sur ce dernier."); }# Protection pour יviter de vיrifier l'enregistrement d'un canal via la commande.
- }
- } else { QCommands::getInstance()->notice(self::$data[0],"Vous devez ךtre identifiי pour utiliser cette commande."); }
- }
- private static function voice(){
- $cm = QCommands::getInstance();
- $db = QDatabase::getInstance();
- if($db->isAuthed(self::$data[0])){
- $r = QRegister::getInstance();
- $account = $db->getclient(self::$data[0],'account');
- if(count(self::$data)==2) $cm->notice(self::$data[0],'Syntaxe: VOICE <#canal>');
- if(count(self::$data)==3){
- list($client,,$name)=self::$data;
- if($r->isreg($name)){
- list($client,,$name) = self::$data;
- if($r->isChanlev($name,$account)){
- if($r->getChanlev($name,$account,'v')){
- $db->updatechanmember($name,$client,array('+'=>'v'));
- $cm->mode($name,"+v",$client);
- $cm->notice($client,"Effectuי");
- }
- } else { $cm->notice($client,"Vous devez possיder un accטs sur $name pour utiliser cette commande."); }
- } else { $cm->notice($client,"Le canal $name semble ne pas ךtre enregistrי"); }
- }
- } else { $cm->notice(self::$data[0],"Vous devez ךtre identifiי pour utiliser cette commande."); }
- }
- private static function op(){
- return;
- }
- ##
- # Commandes de niveau 9 (opיrateur irc)
- ##
- private static function whois(){
- # 0 1 2
- # <src> WHOIS <cible>
- $cm = QCommands::getInstance();
- $db = QDatabase::getInstance();
- if($db->isAuthed(self::$data[0])){
- $r = QRegister::getInstance();
- if($r->getaccount($db->getclient(self::$data[0],'account'),'level')>=900){
- if(count(self::$data)==3) $cm->notice(self::$data[0],'Syntaxe: WHOIS <pseudo>');
- if(count(self::$data)==4){
- list($client,,,$target)=self::$data;
- if(preg_match('/^\#([^ ]+)/',$target,$match)){
- if($r->isaccount($match[1])){
- $cm->notice($client,array(
- "Compte ".$match[1],
- "Identifiant: ".$r->getaccount($match[1],'id'),
- "Niveau: ".$r->getaccount($match[1],'level'),
- "Date de crיation: ".strftime("%A %d %B %Y א %X",$r->getaccount($match[1],'created'))
- ));
- }
- } else {
- if($db->nick2num($target)!==false){
- $target = $db->nick2num($target);
- $cm->notice($client,array(
- $db->getclient($target,"nickname")." (".$db->getclient($target,'username')."@".$db->getclient($target,'hostname').") * ".$db->getclient($target,'realname'),
- "modes: ".$db->getclient($target,'usermode'),
- "numיrique: ".$db->getclient($target,'numeric'),
- "ip 64bits (ircu): ".$db->getclient($target,'b64ip'),
- "s'est connectי le ".strftime("%A %d %B %Y א %X",$db->getclient($target,'connts'))
- ));
- if($db->getclient($target,"account")!==false) $cm->notice($client,"Compte: ".$db->getclient($target,'account'));
- if($db->getclient($target,"virtualhost")!==false) $cm->notice($client,"Adresse virtuelle: ".$db->getclient($target,'virtualhost'));
- } else { $cm->notice($client,"Cet utilisateur n'existe pas sur le rיseau."); }
- }
- }
- } else { $cm->notice(self::$data[0],"Votre niveau d'accטs n'est pas suffisant pour utiliser cette commande."); }
- } else { $cm->notice(self::$data[0],"Vous devez ךtre identifiי pour utiliser cette commande."); }
- }
- private static function chanwho(){
- $cm = QCommands::getInstance();
- if(count(self::$data)==3) $cm->notice(self::$data[0],"Syntaxe: CHANWHO <#canal>");
- if(count(self::$data)==4){
- list($client,,$name) = self::$data;
- $db = QDatabase::getInstance();
- if($db->ischan($name)){
- $cm->notice($client,array(
- "Nom: ".$name,
- "Date de crיation: ".strftime("%c",$db->getchan($name,"created")),
- "Modes: ".$db->getchan($name,"modes"),
- "Sujet: ".$db->getchan($name,"topic")
- ));
- if($db->getchanmembers($name)!==false){
- $cm->notice($client,"Utilisateurs prיsents sur le salon:");
- $users = $db->getchanmembers($name);
- foreach($users AS $numeric => $mode){
- $cm->notice($client,$db->num2nick($numeric).(!empty($mode) ? " [".$mode."]" : null));
- }
- } else { $cm->notice($client,"Ce salon ne compte actuellement aucun membre."); }
- }
- }
- }
- private static function desynch(){
- $cm = QCommands::getInstance();
- if(isset(self::$data[2])){ $cm->desynch(implode(" ",array_slice(self::$data,2))); }
- }
- private static function join(){
- $c = QConfig::getInstance();
- $db = QDatabase::getInstance();
- $cm = QCommands::getInstance();
- echo count(self::$data);
- if(count(self::$data)==3){
- list($client,,$name) = self::$data;
- if($db->isOper($client)){
- if(!$db->ischan($name)){
- $db->addchan($name, null, null, null, null);
- $cm->join($name);
- $cm->smode($name,"+o",SV_NUMERIC.CL_NUMERIC);
- } else { $cm->notice($client,"Ce salon existe dיjא, je ne peux le rejoindre"); }
- } else { $cm->notice($client,"Cette commande est rיservיe aux opיrateurs IRC"); }
- } else { $cm->notice($client,array("utilisation: JOIN <#salon>","Noter que cette commande fait simplement joindre le salon au bot.","Le salon ne sera pas conservי en mיmoire.")); }
- }
- private static function part(){
- $db = QDatabase::getInstance();
- $cm = QCommands::getInstance();
- if(count(self::$data)==3){
- list($client,,$name) = self::$data;
- if($db->isOper($client)){
- if($db->ischan($name)){
- $db->delchan($name);
- $cm->part($name);
- $cm->notice($client,"Effectuי");
- }
- } else { $cm->notice($client,"Cette commande est rיservיe aux opיrateurs IRC"); }
- } else { $cm->notice($client,array("utilisation: PART <#salon>","Cette commande fait partir le bot d'un salon temporaire.")); }
- }
- private static function kill(){
- $db = QDa…
Large files files are truncated, but you can click here to view the full file