Another year is about to end... So we have to update these damn copyright information :P
[PHP-P10.git] / Bots / PHPGod.class.php
index e0ffd726c1d373721886083c8ed77a04f268f762..355eb39f22f0204495c5042b172468cfa20b2dec 100644 (file)
@@ -1,6 +1,6 @@
 <?php
 /******************************* PHP-P10 v2 *****************************
- * Copyright (C) 2011  Philipp Kreil (pk910)                            *
+ * Copyright (C) 2011-2012  Philipp Kreil (pk910)                       *
  *                                                                      *
  * This program is free software: you can redistribute it and/or modify *
  * it under the terms of the GNU General Public License as published by *
@@ -40,6 +40,7 @@ class {$_NAME} extends Bot {
                        if(is_a($this->php, "P10_User")) {
                                $this->uplink->join($this->php, "#php", (P10_Channel::USERPRIV_OPED | P10_Channel::USERPRIV_VOICE));
                                $this->uplink->join($this->php, "#dev", P10_Channel::USERPRIV_VOICE);
+                $this->uplink->join($this->php, "#CoderCom", P10_Channel::USERPRIV_VOICE);
                        }
                } else {
                        $this->php = $old;
@@ -95,7 +96,19 @@ class {$_NAME} extends Bot {
                                        return;
                                }
                                $entry['time'] = time();
-                               fwrite($entry['pipes'][0], "<"."?php ".$exp[1]." ?".">");
+                if(preg_match("#pastebin\.com/([a-zA-Z0-9]*)$#i", $exp[1])) {
+                    $pasteid = explode("/", $exp[1]);
+                    $pasteid = $pasteid[count($pasteid)-1];
+                    $codecontent = file_get_contents("http://pastebin.com/download.php?i=".$pasteid);
+                    if(preg_match("#Unknown Paste ID!#i", $codecontent)) {
+                        $this->uplink->notice($this->bot, $user, "Unknown Paste ID!");
+                        return;
+                    }
+                    $code = $codecontent;
+                } else {
+                    $code = "<"."?php " . $exp[1] . " ?".">";
+                };
+                               fwrite($entry['pipes'][0], $code);
                                fclose($entry['pipes'][0]);
                                $this->phpcache[] = $entry;
                                break;