$request = new SnacktoolsRequest('get_users_for_admin'); $request->addParam('query', $sapp); $response = $request->request(); $responseQuery = $response->data['query']; $append .= " AND `user_id` IN " . $responseQuery; } } $orderAlbums = isset($_SESSION['admin_filters_feedback']['order']) ? $_SESSION['admin_filters_feedback']['order'] : null; if (isset($orderAlbums->orderBy)) { $append .= ' ORDER BY `' . $orderAlbums->orderBy . '` ' . $orderAlbums->orderType . ' '; } else { $append .= ' ORDER BY `id` DESC '; } $recordsPerPage = isset($filters['records']) ? intval($filters['records']) : 10; if ($recordsPerPage < 10 || $recordsPerPage > 500) { $recordsPerPage = 10; } $feedback = new UserFeedback(); $count = $feedback->getCount($append); $paginator = new Paginator($count); $paginator->setRecordsPerPage($recordsPerPage); $append .= " LIMIT " . $paginator->getLimit(); $filters['order'] = $orderAlbums; $smarty->assign('paginatorHtml', $paginator->getHtml()); $smarty->assign('paginator', $paginator); $smarty->assign('feeds', $feedback->getQuery($append)); $smarty->assign('filters', $filters); if (!isset($arr)) { $arr[] = ''; } $smarty->assign($_SESSION['admin_filters_feedback']['filters'], $_SESSION['admin_filters_feedback']['filters']);
<?php Ajax::requireLoggedIn(); $message = isset($_GET['message']) ? $_GET['message'] : ''; if (!isset($message) || empty($message)) { Ajax::outputError("Empty message!"); } $hash = isset($_GET['hash']) ? $_GET['hash'] : ''; if (!isset($hash) || empty($hash)) { Ajax::outputError("Empty hash!"); } $user = User::getLogged(); $notification = Notify::getByHash($hash); $feedback = new UserFeedback(); $feedback->user_id = $user->id; $feedback->message = $message; $feedback->date_added = getDateMysql(); $feedback->ip = $_SERVER['REMOTE_ADDR']; $feedback->notification_id = $notification->id; $feedback->save(); $message = '<p>' . nl2br(str_replace(' ', ' ', $message)) . '</p><hr/>'; $message .= '<br/><h4>User info</h4>'; $message .= '<span>Screen name: ' . $user->screenname . '</span>'; $message .= '<br/><span>User email: ' . $user->email . '</span>'; $message .= '<br/><span>Account id: ' . $user->id . '</span>'; $message .= '<br/><span>Notification ID: ' . $notification->id . '</span>'; $message .= '<br/><span>Notification hash: ' . $notification->hash . '</span>'; $message .= '<br/><span>Notification name: ' . $notification->name . '</span>'; $message .= '<br/><span>Notification parent hash: ' . $notification->parent_hash . '</span>'; $mail = new PHPMailer(); $mail->CharSet = "UTF-8";
/** * feedback * * @return mixed */ public function feedbackAction() { if ($this->request->isPost()) { $content = $this->request->get('content'); if ($content) { $feedback = new UserFeedback(); $feedback->user_id = $this->current_user->id; $feedback->content = $content; $feedback->create(); } } if ($this->request->hasServer('HTTP_REFERER')) { $referer = $this->request->getServer('HTTP_REFERER'); } else { $referer = 'workflow/lists'; } return $this->response->redirect($referer); }
/** * @access protected * @return boolean */ public function delete($id) { $this->allow("admin"); $feedback = new UserFeedback(); $obj = $feedback->findById($id); if ($obj) { if ($feedback->delete($id)) { redirect("/feedback"); } } Notification::set(Feedback::DANGER, "Something went wrong. Please try again."); redirect("/feedback"); }