/** * Destructor */ function __destruct() { if (self::$destroyed == true) { return; } // Avoid cleaning the cache multiple times if (!empty($_SESSION['users_id'])) { parent::__destruct(); } self::$destroyed = true; }
<?php // Ajax // Echo the owners of a vector if (isset($_POST['id']) && filter_var($_POST['id'], FILTER_VALIDATE_INT)) { require_once dirname(__FILE__) . '/../../config.php'; require_once dirname(__FILE__) . '/../../initialize.php'; $user = new suxUser(); $nb = new suxUserNaiveBayesian(); $vectors = $nb->getVectorShares($_POST['id']); $users = null; foreach ($vectors as $val) { $u = $user->getByID($val['users_id']); $users .= $u['nickname'] . ', '; } $users = rtrim($users, ', '); echo $users; }
} if (!isset($_POST['id']) || !filter_var($_POST['id'], FILTER_VALIDATE_INT) || $_POST['id'] < 1) { 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. // ---------------------------------------------------------------------------