$name = $columns[1];
    $simpleUpper = $columns[12];
    $simpleLower = $columns[13];
    $source = codepointToUtf8(hexdec($codepoint));
    if ($simpleUpper) {
        $wikiUpperChars[$source] = codepointToUtf8(hexdec($simpleUpper));
    }
    if ($simpleLower) {
        $wikiLowerChars[$source] = codepointToUtf8(hexdec($simpleLower));
    }
}
fclose($in);
$out = fopen("Utf8Case.php", "wt");
if ($out) {
    $outUpperChars = escapeArray($wikiUpperChars);
    $outLowerChars = escapeArray($wikiLowerChars);
    $outdata = "<" . "?php\n/**\n * Simple 1:1 upper/lowercase switching arrays for utf-8 text.\n * Won't get context-sensitive things yet.\n *\n * Hack for bugs in ucfirst() and company\n *\n * These are pulled from memcached if possible, as this is faster than filling\n * up a big array manually.\n *\n * @file\n * @ingroup Language\n */\n\n/**\n * Translation array to get upper case character\n */\n\$wikiUpperChars = {$outUpperChars};\n\n/**\n * Translation array to get lower case character\n */\n\$wikiLowerChars = {$outLowerChars};\n";
    fputs($out, $outdata);
    fclose($out);
    print "Wrote out Utf8Case.php\n";
} else {
    print "Can't create file Utf8Case.php\n";
    exit(-1);
}
function escapeArray($arr)
{
    return "array(\n" . implode(",\n", array_map("escapeLine", array_keys($arr), array_values($arr))) . "\n)";
}
function escapeLine($key, $val)
{
    $encKey = escapeSingleString($key);
Beispiel #2
0
        printJson('{"status": "success", "message": " ' . getString('theFile') . ' ' . $originalFileName . ' ' . getString('wasUploaded') . '."}');
    } elseif ($success && $type == "chatImage") {
        setChatImage($newFileId, $uploader);
        printJson('{"status": "success", "message": " ' . getString('theFile') . ' ' . $originalFileName . ' ' . getString('wasUploaded') . '."}');
    } else {
        printJson('{"status": "success", "message": "' . getString('uploadFailed') . '."}');
    }
}
function shareAlreadyUploadedFile($id, $user)
{
    $content = '{username|' . $user . '} {lang|' . "userUploadedFile" . '} {file|' . $id . '}.';
    postMessage($content, 0);
}
//Escape all input
$_GET = escapeArray($_GET);
$_POST = escapeArray($_POST);
//Handle actions
if ($_GET['action'] == 'postMessage') {
    postMessage($_POST['content'], $_SESSION['user']['id']);
} elseif ($_GET['action'] == 'getMessage') {
    getMessage($_POST['id']);
} elseif ($_GET['action'] == 'getMessages') {
    getMessages($_POST['lastReceivedId']);
} elseif ($_GET['action'] == 'getRecentMessages') {
    getRecentMessages();
} elseif ($_GET['action'] == 'getNextMessages') {
    getNextMessages($_POST['lastTimestamp']);
} elseif ($_GET['action'] == 'setStatus') {
    setStatus($_SESSION['user']['id'], $_POST['status']);
} elseif ($_GET['action'] == 'logOn') {
    logOn($_SESSION['user']['id']);
Beispiel #3
0
function escapeArray($array)
{
    $result = array();
    foreach ($array as $key => $val) {
        if (!is_array($val)) {
            if (get_magic_quotes_gpc()) {
                $result[$key] = $val;
            } else {
                $result[$key] = addslashes($val);
            }
        } else {
            $result[$key] = escapeArray($val);
        }
    }
    return $result;
}
function insertRental($rental)
{
    $db = new Database();
    $rental = escapeArray($db, $rental);
    $db->doSQL("INSERT INTO `Rentals` (`rental_id`, `movie_id`, `customer_id`, `loan_date`) VALUES ('" . $rental['rentalID'] . "', '" . $rental['movieID'] . "', '" . $rental['customerID'] . "', '" . $rental['loanDate'] . "')");
    $db->doSQL("INSERT INTO `Invoices` (`rental_id`, `amount`, `due_date`, `payed`) VALUES ('" . $rental['rentalID'] . "', '" . $rental['amount'] . "', '" . $rental['dueDate'] . "', '0')");
    $db->doSQL("INSERT INTO `Reminders` (`rental_id`, `first_reminder`, `second_reminder`) VALUES ('" . $rental['rentalID'] . "', '0', '0')");
    $db->closeConnection();
    return true;
}