Example #1
0
    die;
}
$user->username = $_REQUEST['user'];
if (!$user->read()) {
    echo 'KO: ' . _('no se pudo leer al usuario');
    die;
}
if ($user->level == 'disabled') {
    echo 'KO: ' . _('usuario deshabilitado');
    die;
}
if (!($user->karma > 6) && $user->level == 'normal') {
    echo 'KO: ' . _('el karma es muy bajo, necesitas más de 6');
    die;
}
if ($user->get_api_key() != $_REQUEST['key']) {
    echo 'KO: ' . _('clave del API incorrecta');
    die;
}
$post = new Post();
if (!empty($_REQUEST['charset']) && !preg_match('/utf-*8/i', $_REQUEST['charset'])) {
    $_REQUEST['text'] = @iconv($_REQUEST['charset'], 'UTF-8//IGNORE', $_REQUEST['text']);
}
$text = clean_text($_REQUEST['text'], 0, false, $globals['posts_len']);
if (mb_strlen($text) < 5) {
    echo 'KO: ' . _('texto muy corto') . $text;
    die;
}
// Testinf mode print message an die
if (isset($_REQUEST['test'])) {
    echo 'OK: ' . $text;
Example #2
0
<?php

// The source code packaged with this file is Free Software, Copyright (C) 2005 by
// Ricardo Galli <gallir at uib dot es> and
// Beldar <beldar.cat at gmail dot com>
// It's licensed under the AFFERO GENERAL PUBLIC LICENSE unless stated otherwise.
// You can get copies of the licenses here:
// 		http://www.affero.org/oagpl.html
// AFFERO GENERAL PUBLIC LICENSE is also included in the file called "COPYING".
// The code below was made by Beldar <beldar at gmail dot com>
include_once '../config.php';
header('Content-Type: text/html; charset=utf-8');
stats_increment('ajax');
include_once mnminclude . 'user.php';
include_once mnminclude . 'post.php';
if (empty($_GET['id'])) {
    echo _('¿usuario?');
    die;
}
$id = intval($_GET['id']);
if ($id != $current_user->user_id && $current_user->user_level != 'god') {
    echo _('no tiene privilegios para leer esta información');
    die;
}
$user = new User();
$user->id = $id;
if (!$user->read()) {
    die;
}
echo $user->get_api_key();