Example #1
0
// ---------------------------------------------------------------------------
// Error checking
// ---------------------------------------------------------------------------
if (!isset($_SESSION['users_id'])) {
    exit;
}
if (!isset($_POST['id']) || !filter_var($_POST['id'], FILTER_VALIDATE_INT)) {
    exit;
}
if (!isset($_POST['description'])) {
    exit;
}
// ---------------------------------------------------------------------------
// Secondary error checking
// ---------------------------------------------------------------------------
$log = new suxLog();
$photo = new suxPhoto();
$text = suxFunct::gtext('photos');
// Verify if user is allowed to edit this photo.
if (!$photo->isPhotoOwner($_POST['id'], $_SESSION['users_id'])) {
    exit;
}
$clean = array('id' => $_POST['id'], 'description' => $_POST['description']);
try {
    $photo->savePhoto($_SESSION['users_id'], $clean);
    $tmp = $photo->getPhotoByID($clean['id']);
    if ($tmp['description']) {
        echo $tmp['description'];
    } else {
        echo $text['clickme'];
    }
Example #2
0
// Ajax
// Lament to the log
require_once dirname(__FILE__) . '/../../config.php';
require_once dirname(__FILE__) . '/../../initialize.php';
// ---------------------------------------------------------------------------
// Error checking
// ---------------------------------------------------------------------------
if (!isset($_SESSION['users_id'])) {
    die;
}
if (empty($_POST['lament'])) {
    die;
}
$lament = strip_tags($_POST['lament']);
$lament = trim($lament);
$lament = substr($lament, 0, 500);
if (!$lament) {
    die;
}
// ---------------------------------------------------------------------------
// Go
// ---------------------------------------------------------------------------
$log = new suxLog();
$log->write($_SESSION['users_id'], $lament);
// ---------------------------------------------------------------------------
// Clear template caches
// ---------------------------------------------------------------------------
$tpl = new suxTemplate('user');
$tpl->clearCache('profile.tpl', "{$_SESSION['nickname']}|{$_SESSION['nickname']}");
echo $lament;
Example #3
0
    failure('Invalid id');
}
if (!isset($_POST['cat_id']) || !filter_var($_POST['cat_id'], FILTER_VALIDATE_INT) || $_POST['cat_id'] < 1) {
    failure('Invalid cat_id');
}
$link = $_POST['link'];
$module = $_POST['module'];
$id = $_POST['id'];
$cat_id = $_POST['cat_id'];
// ---------------------------------------------------------------------------
// Secondary error checking
// ---------------------------------------------------------------------------
$suxLink = new suxLink();
$nb = new suxUserNaiveBayesian();
$user = new suxUser();
$log = new suxLog();
if (!$nb->isCategoryTrainer($cat_id, $_SESSION['users_id'])) {
    failure('User is not authorized to train category.');
}
// Something is wrong, abort
// ---------------------------------------------------------------------------
// Create $body based on $link type
// ---------------------------------------------------------------------------
$body = getBody($link, $id);
if ($body === false) {
    failure('No $body, nothing to train.');
}
// Something is wrong, abort.
// ---------------------------------------------------------------------------
// Go!
// ---------------------------------------------------------------------------
Example #4
0
$tpl->configLoad('my.conf', $module);
$image = $tpl->getConfigVars('imgUnsubscribed');
$db = suxDB::get();
$query = "SELECT COUNT(*) FROM {$link} WHERE {$col}_id = ? AND users_id = ? ";
$st = $db->prepare($query);
$st->execute(array($id, $_SESSION['users_id']));
if ($st->fetchColumn() > 0) {
    // Delete
    $query = "DELETE FROM {$link} WHERE {$col}_id = ? AND users_id = ? ";
    $st = $db->prepare($query);
    $st->execute(array($id, $_SESSION['users_id']));
} else {
    // Insert
    $suxLink = new suxLink();
    $suxLink->saveLink($link, 'users', $_SESSION['users_id'], $col, $id);
    $image = $tpl->getConfigVars('imgSubscribed');
}
// Log
$log = new suxLog();
$log->write($_SESSION['users_id'], "sux0r::feeds::toggle() bookmarks_id: {$id}", 1);
// Private
// ---------------------------------------------------------------------------
// Clear template caches
// ---------------------------------------------------------------------------
$tpl->clearCache(null, "{$_SESSION['nickname']}");
// clear all caches with "nickname" as the first cache_id group
// ---------------------------------------------------------------------------
// Return image string to Ajax request
// ---------------------------------------------------------------------------
echo trim($image);
exit;
Example #5
0
}
// ---------------------------------------------------------------------------
// Error checking
// ---------------------------------------------------------------------------
if (!isset($_SESSION['users_id'])) {
    failure('Invalid user id');
}
if (!isset($_POST['id']) || !filter_var($_POST['id'], FILTER_VALIDATE_INT) || $_POST['id'] < 1) {
    failure('Invalid id');
}
$id = $_POST['id'];
// ---------------------------------------------------------------------------
// Secondary error checking
// ---------------------------------------------------------------------------
$user = new suxUser();
$log = new suxLog();
if (!$user->isRoot()) {
    failure('Not admin');
}
// ---------------------------------------------------------------------------
// Go
// ---------------------------------------------------------------------------
try {
    $image = 'lock2.gif';
    $flag = $log->toggleLogPrivateFlag($id);
    if ($flag) {
        $image = 'lock1.gif';
    }
    // Log, private
    $log->write($_SESSION['users_id'], "sux0r::admin::toggle() users_log_id: {$id}", 1);
} catch (Exception $e) {