uid = $uid; $this->myfootprints = $kdb->getAllMyFootprints($uid, $limit, $offset, $sortby); } function getMyFootprints() { $fo = array(); foreach ($this->myfootprints as $fptid) { $fo []= new SharedFootprint($fptid); } return $fo; } public function countAllMyFootprints() { global $kdb; return $kdb->countAllMyFootprints($this->getUID()); } function getUID() { return $this->uid; } function getOffset() { $offset = 0; if (isset($_SESSION['offset'])) $offset = $_SESSION['offset']; return $offset; } function getLimit() { $limit = 8; if (isset($_SESSION['limit'])) $limit = $_SESSION['limit']; return $limit; } function shareMyFootprints($cid) { global $kdb; $q = "UPDATE answers SET "; $q .= " shared=1"; $q .= " WHERE id=".$cid." AND userid=".$this->uid; return $kdb->query($q); } function deShareMyFootprints($cid) { global $kdb; $q = "UPDATE answers SET "; $q .= " shared=0"; $q .= " WHERE id=".$cid." AND userid=".$this->uid; return $kdb->query($q); } function deleteMyFootprints($cid) { global $kdb; $q = "DELETE FROM answers WHERE id=".$cid." AND userid=".$this->uid; return $kdb->query($q); } } $limit = 8; $offset = 0; $sortby = 'created'; if (isset($_GET['limit'])) { $limit = $_GET['limit']; $_SESSION['limit'] = $limit; } if (isset($_GET['offset'])) { $offset = $_GET['offset']; $_SESSION['offset'] = $offset; } if (isset($_GET['sortby'])) { $sortby = $_GET['sortby']; $_SESSION['sortby'] = $sortby; } $uid = $user->getId(); if ($uid!=-1) { $fp = new MyFootprintPage($uid, $limit, $offset, $sortby); if (isset($_GET['footprint']) && is_numeric($_GET['footprint'])) { $_SESSION['page'] = 'footprint'; $_SESSION['cid'] = $_GET['footprint']; header("Location:index.php"); } else if ( isset($_POST['actionShare']) && isset($_POST['myfpts']) ) { $fpts = $_POST['myfpts']; if (!is_array($fpts)) $fpts = array($_POST['myfpts']); foreach ($fpts as $f) { $fp->shareMyFootprints($f); } } else if ( isset($_POST['actionDeShare']) && isset($_POST['myfpts']) ) { $fpts = $_POST['myfpts']; if (!is_array($fpts)) $fpts = array($_POST['myfpts']); foreach ($fpts as $f) { $fp->deShareMyFootprints($f); } } else if ( isset($_POST['actionDelete']) && isset($_POST['myfpts']) ) { $fpts = $_POST['myfpts']; if (!is_array($fpts )) $fpts = array($_POST['myfpts']); foreach ($fpts as $f) { $fp->deleteMyFootprints($f); header("Location:index.php"); } } $kesa->setTemplate("my_widgets.html"); $kesa->setPage($fp); } ?>