function indexAction() { if (POST) { $users = $this->gchart->Users(); print_r($users); die; $nemo = array(); foreach ($users as $id => $row) { $nemo[] = array(array("v" => encode($id), "f" => $row['username']), $id == $this->session->user["id"] ? "" : encode($row['rid']), ""); } jencode($nemo); } }
function getAction() { if (!$this->getRequest()->getParam('html')) { $uTw = array(); $tweet = $this->tweet->Get($_REQUEST['limit'], $this->getRequest()->getParam('of') ? decode($this->getRequest()->getParam('of')) : NULL, $_REQUEST['limit'] == 1 ? 'DESC' : 'ASC'); if ($tweet) { foreach ($tweet as $uT) { $uT["timestamps"] = timeDiff(strtotime($uT["timestamps"])); $uT["id"] = encode($uT["id"]); $uT["uid"] = encode($uT["uid"]); $uTw[] = $uT; } } jencode($uTw); die; } }
function getAction() { if (!$this->getRequest()->getParam('html')) { $uTw = array(); $pics = $this->pics->Get($_REQUEST['limit'], $this->getRequest()->getParam('of') ? decode($this->getRequest()->getParam('of')) : NULL, $_REQUEST['limit'] == 1 ? 'DESC' : 'ASC'); if ($pics) { foreach ($pics as $uT) { $uT["timestamps"] = timeDiff(strtotime($uT["timestamps"])); $uT["W"] = $uT["width"]; unset($uT["width"]); $uT["H"] = $uT["height"]; unset($uT["height"]); $uT["id"] = encode($uT["id"]); $uT["uid"] = encode($uT["uid"]); $uTw[] = $uT; } } jencode($uTw); die; } }
function getAction() { $scrap = $this->scrap->Get(); $uTw = array(); if ($scrap) { $recivedBy = $this->scrap->uid; foreach ($scrap as $uT) { $uT["timestamps"] = timeDiff(strtotime($uT["timestamps"])); $postedBy = $uT["uid"]; $uT["id"] = encode($uT["id"]); $uT["uid"] = encode($uT["uid"]); $uT["scrap"] = str($uT["scrap"]); $uT["r"] = $recivedBy == $this->session->user['id']; $uT["d"] = $postedBy == $this->session->user['id'] || $recivedBy == $this->session->user['id']; if ($uT["d"] || $uT["privacy"] == 'N') { $uTw[] = $uT; } } jencode($uTw); } die; }
function friendsAction() { HackCheck(); if ($_REQUEST['json'] == 'y') { if ($_REQUEST['act']) { $act = explode("-", $_REQUEST['act']); if ($act[0] == "r") { $this->user->RemoveFriend(decode($act[1])); $r = array("af frnd", "Add as friend", "a-" . $act[1]); } if ($act[0] == "a") { $this->user->AddFan(decode($act[1])); $user = new UsersModel(decode($act[1])); $user = $user->Info(); $invitee = $this->view->user; $msg = "<strong>Hi " . $user['fname'] . " " . $user['lname'] . "</strong><br /><br />\r\n\t\t\t\t\t\t\t<a href=\"" . WWW_ROOT . "user/" . encode($invitee["id"]) . "/\">" . $invitee['fname'] . " " . $invitee['lname'] . "</a> wants to be your friend on pepool.com.<br />\r\n\t\t\t\t\t\t\tTo accept his request and view user profile go to the link below:<br />\r\n\t\t\t\t\t\t\t<a href=\"" . WWW_ROOT . "user/" . encode($invitee["id"]) . "/\">" . WWW_ROOT . "user/" . encode($invitee["id"]) . "</a>\r\n\t\t\t\t\t\t\t<br /><br />Thanks<br />Pepool.com"; sendmail($invitee["fname"] . " " . $invitee["lname"] . " wants to be your friend ", $msg, $user["email"], $user['fname'] . " " . $user['lname']); $r = array("wf frnd", "Friend request pending", ""); } if ($act[0] == "c") { $this->user->ConfirmFriend(decode($act[1])); $r = array("rf frnd", "Remove friend", "r-" . $act[1]); } } jencode($r); } $of = $this->getRequest()->getParam('of') ? decode($this->getRequest()->getParam('of')) : $this->session->user['id']; $user = new UsersModel($of); $userFriends = $user->GetFriends(); $user = $user->Info(); $prefix = $this->session->user['id'] == $of ? 'My' : ($user['gender'] == 'M' ? 'His' : 'Her'); if (count($userFriends["recivedRequest"]) > 0 && $of && $prefix == 'My') { $rU["recived-friend"]["title"] = "You have new friend request"; foreach ($userFriends["recivedRequest"] as $id => $v) { $rU["recived-friend"]["data"][] = array("uid" => encode($id), "username" => $v["username"], "image" => $v["image"], "addr" => timeDiff(strtotime($v["birthDay"]), array('parts' => 1, 'precision' => 'year', 'separator' => '', 'next' => '')) . ", " . ($v["gender"] == "M" ? "Male" : "Female") . "<br />" . ($v["address"] ? $v["address"] . ", " : "") . ($v["city"] ? $v["city"] . ", " : "") . $v["state"]); } } if (count($userFriends["friends"]) > 0) { $rU["real-friend"]["title"] = $prefix . " real friends"; foreach ($userFriends["friends"] as $id => $v) { $rU["real-friend"]["data"][] = array("uid" => encode($id), "username" => $v["username"], "image" => $v["image"], "addr" => timeDiff(strtotime($v["birthDay"]), array('parts' => 1, 'precision' => 'year', 'separator' => '', 'next' => '')) . ", " . ($v["gender"] == "M" ? "Male" : "Female") . "<br />" . ($v["address"] ? $v["address"] . ", " : "") . ($v["city"] ? $v["city"] . ", " : "") . $v["state"]); } } else { $rU["real-friend"]["title"] = "So sad, " . $prefix . " account of friends are empty"; } if (count($userFriends["sentRequest"]) > 0 && $of && $prefix == 'My') { $rU["sent-friend"]["title"] = "Pending friend request you send"; foreach ($userFriends["sentRequest"] as $id => $v) { $rU["sent-friend"]["data"][] = array("uid" => encode($id), "username" => $v["username"], "image" => $v["image"], "addr" => timeDiff(strtotime($v["birthDay"]), array('parts' => 1, 'precision' => 'year', 'separator' => '', 'next' => '')) . ", " . ($v["gender"] == "M" ? "Male" : "Female") . "<br />" . ($v["address"] ? $v["address"] . ", " : "") . ($v["city"] ? $v["city"] . ", " : "") . $v["state"]); } } jencode($rU); die; }
function grabAction() { $return = array(); $ref[0] = decode($this->getRequest()->getParam('ref')); $ref[1] = $this->getRequest()->getParam('of') ? decode($this->getRequest()->getParam('of')) : $this->session->user["id"]; if ($this->getRequest()->getParam('for') == 'recived') { $uidFrom = $ref[0]; if ($uidFrom == $this->session->user["id"]) { $from = "Me"; } else { $from = new UsersModel($uidFrom); $from = $from->Info(); $from = $from["fname"] . " " . $from["lname"]; } $uidTo = $ref[1]; if ($uidTo == $this->session->user["id"]) { $to = "Me"; } else { $to = new UsersModel($uidTo); $to = $to->Info(); $to = $to["fname"] . " " . $to["lname"]; } } elseif ($this->getRequest()->getParam('for') == 'sent') { $uidFrom = $ref[1]; if ($uidFrom == $this->session->user["id"]) { $from = "Me"; } else { $from = new UsersModel($uidFrom); $from = $from->Info(); $from = $from["fname"] . " " . $from["lname"]; } $uidTo = $ref[0]; if ($uidTo == $this->session->user["id"]) { $to = "Me"; } else { $to = new UsersModel($uidTo); $to = $to->Info(); $to = $to["fname"] . " " . $to["lname"]; } } $grabbed = $this->slam->Grab($uidFrom, $uidTo); if (count($grabbed) > 0) { if ($this->session->user['id'] == $uidFrom || $this->session->user['id'] == $uidTo) { $erase = "<a href='javascript:;' class='rub'>[erase]</a>"; } // $pubPvt = "<a href='javascript:;' class='pvt'>[make private]</a>"; $return["HTML"] = "<h3 style='margin:10px 0'>Slambook filled by {$from} for {$to} {$erase} {$pubPvt}</h3>"; foreach ($grabbed as $k => $v) { $return["data"][] = array(encode($k), $v["que"], str($v["ans"])); } } jencode($return); }