Пример #1
0
function obsafe_print_r($var, $return = false, $html = false, $level = 0)
{
    $spaces = "";
    $space = $html ? " " : " ";
    $newline = $html ? "<br />" : "\n";
    for ($i = 1; $i <= 6; $i++) {
        $spaces .= $space;
    }
    $tabs = $spaces;
    for ($i = 1; $i <= $level; $i++) {
        $tabs .= $spaces;
    }
    if (is_array($var)) {
        $title = "Array";
    } elseif (is_object($var)) {
        $title = get_class($var) . " Object";
    }
    $output = $title . $newline . $newline;
    foreach ($var as $key => $value) {
        if (is_array($value) || is_object($value)) {
            $level++;
            $value = obsafe_print_r($value, true, $html, $level);
            $level--;
        }
        $output .= $tabs . "[" . $key . "] => " . $value . $newline;
    }
    if ($return) {
        return $output;
    } else {
        echo $output;
    }
}
Пример #2
0
 public function Action()
 {
     if (empty($_POST['query'])) {
         return null;
     }
     $db = JFactory::getDBO();
     $query = trim(aecGetParam('query', 0));
     if (strpos($query, 'supercommand:') !== false) {
         $supercommand = new aecSuperCommand();
         if ($supercommand->parseString($query)) {
             if (strpos($query, '!') === 0) {
                 $armed = true;
             } else {
                 $armed = false;
             }
             $return = $supercommand->query($armed);
             if ($return > 1) {
                 $multiple = true;
             } else {
                 $multiple = false;
             }
             if ($return != false && !$armed) {
                 $r = '<p>This supercommand would affect ' . $return . " user" . ($multiple ? "s" : "") . ". Add a ! in front of supercommand to carry out the command.</p>";
             } elseif ($return != false) {
                 $r = '<p>If you\'re so clever, you tell us what <strong>colour</strong> it should be!? (Everything went fine. Really! It affected ' . $return . " user" . ($multiple ? "s" : "") . ")</p>";
             } else {
                 $r = '<p>Something went wrong. No users found.</p>';
             }
             return $r;
         }
         return "I think you ought to know I'm feeling very depressed. (Something was wrong with your query.)";
     }
     if (strpos($query, 'jsonserialencode') === 0) {
         $s = trim(substr($query, 16));
         if (!empty($s)) {
             $return = base64_encode(serialize(jsoonHandler::decode($s)));
             return '<p>' . $return . '</p>';
         }
     }
     if (strpos($query, 'serialdecodejson') === 0) {
         $s = trim(substr($query, 16));
         if (!empty($s)) {
             $return = jsoonHandler::encode(unserialize(base64_decode($s)));
             return '<p>' . $return . '</p>';
         }
     }
     if (strpos($query, 'serialdecode') === 0) {
         $s = trim(substr($query, 12));
         if (!empty($s)) {
             $return = unserialize(base64_decode($s));
             return '<p>' . obsafe_print_r($return, true, true) . '</p>';
         }
     }
     if (strpos($query, 'unserialize') === 0) {
         $s = trim(substr($query, 11));
         if (!empty($s)) {
             $return = unserialize($s);
             return '<p>' . obsafe_print_r($return, true, true) . '</p>';
         }
     }
     $maybe = array('?', '??', '???', '????', 'what to do', 'need strategy', 'help', 'help me', 'huh?', 'AAAAH!');
     if (in_array($query, $maybe)) {
         include_once JPATH_SITE . '/components/com_acctexp/lib/eucalib/eucalib.add.php';
         $ed = rand(1, 4);
         $edf = ${'edition_0' . $ed};
         $maxed = count(${'edition_0' . $ed});
         return $edf['quote_' . str_pad(rand(1, $maxed + 1), 2, '0')];
     }
     if (strpos($query, 'logthis:') === 0) {
         $eventlog = new eventLog();
         $eventlog->issue('debug', 'debug', 'debug entry: ' . str_replace('logthis:', '', $query), 128);
         return 'alright, logged.';
     }
 }