} // --------------------------------------------------------------------------- // 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']; } $log->write($_SESSION['users_id'], "sux0r::photos::describe() photos_id: {$clean['id']}", 1); // Private } catch (Exception $e) { echo $e->getMessage(); } // --------------------------------------------------------------------------- // Clear template caches // --------------------------------------------------------------------------- $tpl = new suxTemplate('photos'); $tpl->clearCache(null, $_SESSION['nickname']); // clear all user caches
// 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;
// --------------------------------------------------------------------------- // Get all the bayes_documents linked to this message where user is trainer // Also get associated vectors $link_table = $suxLink->buildTableName($link, 'bayes_documents'); $innerjoin = "\nINNER JOIN {$link_table} ON {$link_table}.bayes_documents_id = bayes_documents.id\nINNER JOIN {$link} ON {$link_table}.{$link}_id = {$link}.id\nINNER JOIN bayes_categories ON bayes_categories.id = bayes_documents.bayes_categories_id\nINNER JOIN bayes_auth ON bayes_categories.bayes_vectors_id = bayes_auth.bayes_vectors_id\n"; $query = "\nSELECT bayes_documents.id, bayes_auth.bayes_vectors_id FROM bayes_documents\n{$innerjoin}\nWHERE {$link}.id = ?\nAND bayes_auth.users_id = ? AND (bayes_auth.owner = true OR bayes_auth.trainer = true)\n"; // Note: bayes_auth WHERE condition equivilant to nb->isCategoryTrainer() $db = suxDB::get(); $st = $db->prepare($query); $st->execute(array($id, $_SESSION['users_id'])); $tmp = $st->fetchAll(PDO::FETCH_ASSOC); // Since we are only training one category/vector at a time, we need to make // sure we don't untrain other unrelated vectors here. $vec_id = $nb->getVectorByCategory($cat_id); foreach ($tmp as $val) { if (isset($vec_id[$val['bayes_vectors_id']])) { $nb->untrainDocument($val['id']); } } // Recategorize $doc_id = $nb->trainDocument($body, $cat_id); $suxLink->saveLink($link_table, 'bayes_documents', $doc_id, $link, $id); // Log $log->write($_SESSION['users_id'], "sux0r::bayes::train() doc_id: {$doc_id}, cat_id: {$cat_id}", 1); // Private // --------------------------------------------------------------------------- // Clear template caches // --------------------------------------------------------------------------- $tpl = new suxTemplate($module); $tpl->clearCache(null, "{$_SESSION['nickname']}"); // clear all caches with "nickname" as the first cache_id group
$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;
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) { $message = $e->getMessage(); $message .= "File: " . $e->getFile() . "\n"; $message .= "Line: " . $e->getLine() . "\n\n"; failure($message); } echo trim($image); exit;