Exemple #1
0
 function Plugin()
 {
     if (!empty($this->defaultConfig)) {
         global $config;
         $filename = sanitizeFileName($this->id);
         if (!file_exists("config/{$filename}.php")) {
             writeConfigFile("config/{$filename}.php", '$config["' . escapeDoubleQuotes($this->id) . '"]', $this->defaultConfig);
         }
         include "config/{$filename}.php";
     }
 }
Exemple #2
0
function fix($string)
{
    $string = escapeDoubleQuotes($string);
    $string = removeSpecials($string);
    return $string;
}
Exemple #3
0
function variableToText($variable, $indent = "")
{
    $text = "";
    if (is_array($variable)) {
        $text .= "array(\n";
        foreach ($variable as $k => $v) {
            $text .= $indent . (is_string($k) ? "\"" . escapeDoubleQuotes($k) . "\"" : $k);
            $text .= " => " . variableToText($v, "{$indent}\t") . ",\n";
        }
        $text = rtrim($text, ",\n") . "\n" . substr($indent, 1) . ")";
    } elseif (is_string($variable)) {
        $text .= "\"" . escapeDoubleQuotes($variable) . "\"";
    } elseif (is_bool($variable)) {
        $text .= $variable ? "true" : "false";
    } elseif (is_null($variable)) {
        $text .= "null";
    } elseif (!is_object($variable) and !is_resource($variable)) {
        $text .= $variable;
    }
    return $text;
}
 function getMessages()
 {
     global $messages;
     $html = "<div id='messages'>";
     foreach ($_SESSION["messages"] as $m) {
         $html .= $this->htmlMessage($m["message"], $m["arguments"]) . "\n";
     }
     $html .= "</div>\n<script type='text/javascript'>\nMessages.init();";
     foreach ($_SESSION["messages"] as $m) {
         if (!empty($m["arguments"])) {
             $text = is_array($m["arguments"]) ? vsprintf($messages[$m["message"]]["message"], $m["arguments"]) : sprintf($messages[$m["message"]]["message"], $m["arguments"]);
         } else {
             $text = $messages[$m["message"]]["message"];
         }
         $html .= "Messages.showMessage(\"{$m["message"]}\", \"{$messages[$m["message"]]["class"]}\", \"" . escapeDoubleQuotes($text) . "\", " . ($m["disappear"] ? "true" : "false") . ");\n";
     }
     $html .= "</script>";
     return $html;
 }