User:Cakemix/Scripts/PHP/CommandRenderOld

<?php

$i = 0; $fi = 0; $ai = 0; $cakefile = file("C:\PHP5\data\system\settings.ini");

$aliases = array; foreach ($cakefile as $value) { if (substr($value, 0, 8) == "aliases.") { $y = preg_split("/=/", substr($value, 8)); $aliases[trim($y[1])] = trim($y[0]); $ai++; } } foreach ($cakefile as $value) { if (substr($value, 0, 14) == "plugins.loaded") { $fi+=1; $p = array(trim(substr($value, strpos($value, "=") + 1)), "plug" . trim(substr($value, strpos($value, "=") + 1)) . ".php"); $file = file_get_contents("C:/PHP5/plugins/" . $p[1]); if (preg_match_all("/onCommand(\w*)/i", $file, $m)) { foreach ($m[0] as $z) { $i +=1; $s = substr($file, strpos($file, $z)); $e = substr($s, 0, strpos($s, "{")); //took some time to figure out "0," because I'm too stupid to remember it -.- $u = substr($e, strlen($z) + 1); $rName = ucfirst(strtolower(substr($z, 9))); $auth = strpos($u, "\$auth"); $args = strpos($u, "\$args"); $alias = ucfirst($aliases[strtolower($rName)]); if ($auth) { $o = substr($u, $auth + 5); $x = substr($o, strpos($o, "_") + 1); $rAuth = "AUTH_". strtoupper(str_replace(array("'", '"', " "), null, substr($x, 0, strpos($x, ","))));               } else {                    $rAuth = ("None");                }                if ($args) {                    $o = substr($u, $args + 5);                    $x = substr($o, strpos($o, "array(") + 6);                    $rArgs = str_replace(",", " to", substr($x, 0, strpos($x, ")")));                } else {                    $rArgs = ("0");                }                if (!$alias) {                    $alias = "None";                }                $data .= "\n";                $rArgs = null;                $rAuth = null;                $rName = null;            }        }    } }

file_put_contents("C:\PHP5\data\system\commands.txt", $data); $a = file("C:\PHP5\data\system\commands.txt"); sort($a); $data = "''' ". date(DATE_COOKIE). "'''\n{|class=\"wikitable sortable\" !Command  !Auth  !class=\"unsortable\" | Arguments  !File  !Alias  |-\n"; foreach ($a as $item) { if ($lastitem != $item) { // because I have some commands commented out and I'm too lazy to fix it <.< $data .= $item; $lastitem = $item; } }

$data .= "|}\nFound $i commands and $ai aliases of $fi files (Not all commands are loaded.). ";

file_put_contents("C:\PHP5\data\system\commands.txt", $data);