/** * getFromId function. * * @access public * @param mixed $_id * @return void */ public function getFromId($_id) { try { $db = new DB(); $_id = (int) $_id; $item = $db->query("SELECT * FROM " . $this->table . " WHERE id = '{$_id}'"); $result = $item->fetchAll(); if ($result) { $this->setItem($result[0]); $obj_user = new User(); $this->_author = $obj_user->getFromId($this->user); $this->getReplies(); } return $this; } catch (PDOException $e) { print "Error!: " . $e->getMessage() . "<br/>"; die; } }
public function getUserVotes() { $return = NULL; $_id = NULL; try { $db = new DB(); $return = array(); $_id = $this->id; $hUser = new User(); #Helper $items = $db->query("SELECT DISTINCT u.id\n FROM " . $hUser->table . " u\n JOIN " . $this->table_points . " p ON ( p.user = u.id ) \n WHERE p.project = '{$_id}'\n ORDER BY u.id"); if ($items) { foreach ($items->fetchAll() as $item) { $obj_u = new User(); $return[] = $obj_u->getFromId($item['id']); } } } catch (PDOException $e) { print "Error!: " . $e->getMessage() . "<br/>"; die; } return $return; }
} elseif (!$Opauth->validate(sha1(print_r($response['auth'], true)), $response['timestamp'], $response['signature'], $reason)) { echo '<strong style="color: red;">Invalid auth response: </strong>' . $reason . ".<br>\n"; } else { // REF $goTo = '/'; if (!empty($_GET['ref'])) { $goTo = strip_tags(addslashes($_GET['ref'])); } elseif (!empty($_SERVER['HTTP_REFERER'])) { $goTo = strip_tags(addslashes($_SERVER['HTTP_REFERER'])); } switch ($response['auth']['provider']) { case 'Twitter': $user = new User(); $_idU = $user->isRegistered($response['auth']['uid']); if ($_idU) { $user->getFromId($_idU); if ($user->isActive()) { $item['name'] = $response['auth']['info']['name']; $item['active'] = 1; $item['last_login'] = time(); // Login data $item['uid'] = $response['auth']['uid']; $item['token'] = $response['auth']['credentials']['token']; $item['secret'] = $response['auth']['credentials']['secret']; $item['signature'] = $response['signature']; //Profile data $item['account'] = $response['auth']['info']['nickname']; if (isset($response['auth']['info']['description'])) { $item['biography'] = $response['auth']['info']['description']; } if (isset($response['auth']['info']['location'])) {