Exemple #1
0
 public function disagree($id = 0, $cid = 0)
 {
     $myID = getUserID();
     $cid = (int) $cid;
     $query = $this->mdb->get_feed_info($id);
     $errMsg = '';
     if ($query->num_rows() == 0) {
         generate_json(array('status' => 0, 'message' => 'Post not found.'));
     } else {
         $row = $query->row();
         if (!validate_access('valid_member', array('project_id' => $row->project_id, 'user_id' => $myID))) {
             generate_json(array('status' => 0, 'message' => 'You are not authorized to do this.'));
         } else {
             $do = $this->mdb->disagree($row->id, $cid, $myID);
             $result = $this->mdb->get_adc_counts($row->id, $cid);
             if ($do > 0) {
                 if ($cid > 0) {
                     //notify commentor
                     $qComment = $this->mdb->get_comment_details($row->id, $cid);
                     if ($qComment->num_rows()) {
                         $commentRow = $qComment->row();
                         notify('comment_disagree', $commentRow->user_id, array('project_id' => $row->project_id, 'post_id' => $row->id, 'task_id' => $row->task_id, 'comment_id' => $cid));
                     }
                 } else {
                     //notify poster
                     notify('post_disagree', $row->poster_id, array('project_id' => $row->project_id, 'post_id' => $row->id, 'task_id' => $row->task_id));
                 }
             }
             generate_json(array('status' => 1, 'response' => $result->row()));
         }
     }
 }
Exemple #2
0
 public function index()
 {
     updateLastActive();
     $myID = getUserID();
     $filepath = 'uploads/files/' . $myID . '/';
     $pid = (int) $this->input->get('pid');
     $tid = (int) $this->input->get('tid');
     if (!file_exists($filepath)) {
         mkdir($filepath, 0777, true);
     }
     if (!validate_access('valid_member', array('project_id' => $pid, 'user_id' => $myID))) {
         $this->output->set_status_header('400');
         echo 'You dont have enough permission to do this.';
     } else {
         $config['upload_path'] = $filepath;
         $config['allowed_types'] = 'jpg|gif|jpeg|bmp|ico|png|zip|rar|gz|mp3|mp4|mkv|avi|txt|apk|ipa|tar|exe|doc|docx|xls|xlsx|ppt|pptx|pdf';
         $config['max_size'] = 30000;
         $config['encrypt_name'] = true;
         $config['max_filename'] = 200;
         $config['remove_spaces'] = false;
         $this->load->library('upload', $config);
         if ($this->upload->do_upload('file')) {
             $data = $this->upload->data();
             $newID = $this->mdb->add_attachment(array('attachment_type' => 'file', 'uploader' => $myID, 'project_id' => $pid, 'task_id' => $tid, 'post_id' => 0, 'filename' => $data['orig_name'], 'filepath' => $data['file_name'], 'filesize' => $data['file_size'] * 1024, 'extension' => $data['file_ext'], 'date_added' => today(), 'date_deleted' => null, 'deleted_by' => 0, 'parent_folder' => 0));
             $imgTypes = array('.gif', '.jpg', '.jpeg', '.png');
             if (in_array(strtolower($data['file_ext']), $imgTypes)) {
                 $this->load->library('image_lib');
                 $thumbpath = $filepath . 'thumbs/';
                 if (!file_exists($thumbpath)) {
                     mkdir($thumbpath, 0777, true);
                 }
                 $config = array('image_library' => 'gd2', 'source_image' => $filepath . $data['file_name'], 'new_image' => $thumbpath . $data['file_name'], 'maintain_ratio' => true, 'height' => 300, 'width' => 300);
                 $this->image_lib->initialize($config);
                 $this->image_lib->resize();
                 $this->image_lib->clear();
             }
             echo $newID;
         } else {
             $errors = $this->upload->display_errors('', '|');
             $errorsArr = explode("|", $errors);
             $this->output->set_status_header('401');
             echo isset($errorsArr[0]) ? $errorsArr[0] : '';
         }
     }
 }
Exemple #3
0
 public function generate($pid = 0)
 {
     requirelogin();
     updateLastActive();
     $type = jsonInput('type');
     $member = (int) jsonInput('member');
     $dateFrom = jsonInput('date_from');
     $dateTo = jsonInput('date_to');
     $myID = getUserID();
     if (!validate_access('valid_member', array('project_id' => $pid, 'user_id' => $myID))) {
         generate_json(array('status' => 0, 'message' => 'You dont have enough permission to do this.'));
     } else {
         switch ($type) {
             case 'project':
                 $this->session->set_userdata('project_report', array('project_id' => $pid, 'type' => $type));
                 generate_json(array('status' => 1));
                 break;
             case 'member':
                 $this->session->set_userdata('project_report', array('project_id' => $pid, 'type' => $type, 'date_from' => $dateFrom, 'date_to' => $dateTo));
                 generate_json(array('status' => 1));
                 break;
             case 'task':
                 $statuses = array('active', 'completed', 'pending', 'active_complete');
                 $taskStat = trim(jsonInput('task_status'));
                 $taskStat = in_array($taskStat, $statuses) ? $taskStat : "";
                 $this->session->set_userdata('project_report', array('project_id' => $pid, 'type' => $type, 'status' => $taskStat, 'date_from' => $dateFrom, 'date_to' => $dateTo));
                 generate_json(array('status' => 1));
                 break;
             case 'personel':
                 if ($member > 0) {
                     if (validate_access('valid_member', array('project_id' => $pid, 'user_id' => $member))) {
                         $this->session->set_userdata('project_report', array('member' => $member, 'project_id' => $pid, 'type' => $type));
                         generate_json(array('status' => 1));
                     } else {
                         generate_json(array('status' => 0, 'message' => 'This user is not a member of this project.'));
                     }
                 } else {
                     generate_json(array('status' => 0, 'message' => 'Please select a member.'));
                 }
                 break;
             default:
                 generate_json(array('status' => 0, 'message' => 'Unknown report type.'));
         }
     }
 }
Exemple #4
0
 public function go($id = 0)
 {
     $myID = getUserID();
     $query = $this->mdb->get_comment_projID($id);
     if ($query->num_rows()) {
         $row = $query->row();
         $projectID = $row->project_id;
         $is_moderator = validate_access('is_moderator', array('project_id' => $projectID, 'user_id' => $myID));
         if ($row->poster_id == $myID || $is_moderator) {
             $this->mdb->delete_comment($id);
             generate_json(array('status' => 1));
         } else {
             generate_json(array('status' => 0, 'message' => 'You are not authorized to do this.'));
         }
     } else {
         generate_json(array('status' => 0, 'message' => 'Post not found.'));
     }
 }
Exemple #5
0
 public function file($id = 0)
 {
     $myID = getUserID();
     $query = $this->mdb->get_attachment($id);
     if ($query->num_rows()) {
         $row = $query->row();
         if (validate_access('valid_member', array('project_id' => $row->project_id, 'user_id' => $myID)) || $row->uploader == $myID) {
             $filepath = 'uploads/files/' . $row->uploader . '/' . $row->filepath;
             if (is_file($filepath)) {
                 download_file($filepath, $row->filename);
             } else {
                 echo 'File does not exists in server.';
             }
         } else {
             echo 'You are not allowed to download this file.';
         }
     } else {
         echo 'file does not exists.';
     }
 }
Exemple #6
0
 public function image($id = 0, $type = 'thumb')
 {
     $checkLogin = requirelogin('return');
     $this->load->library('image');
     $noPreview = 'static/img/no-preview.png';
     if (isset($checkLogin['status']) && $checkLogin['status'] == 0) {
         $this->image->view($noPreview);
     } else {
         $myID = getUserID();
         $query = $this->mdb->get_attachment($id);
         if ($query->num_rows()) {
             $row = $query->row();
             $defaultPath = 'uploads/files/' . $row->uploader . '/';
             if (validate_access('valid_member', array('project_id' => $row->project_id, 'user_id' => $myID)) || $myID == $row->uploader) {
                 switch ($type) {
                     case 'full':
                         if (is_file($defaultPath . $row->filepath)) {
                             $this->image->view($defaultPath . $row->filepath);
                         } else {
                             $this->image->view($noPreview);
                         }
                         break;
                     default:
                         $thumbPath = $defaultPath . 'thumbs/';
                         if (is_file($thumbPath . $row->filepath)) {
                             $this->image->view($thumbPath . $row->filepath);
                         } else {
                             $this->image->view($noPreview);
                         }
                 }
             } else {
                 $this->image->view($noPreview);
             }
         } else {
             $this->image->view($noPreview);
         }
     }
 }
Exemple #7
0
 public function kick_member()
 {
     requirelogin();
     updateLastActive();
     $myID = getUserID();
     $id = (int) $this->input->get('id');
     $mID = (int) $this->input->get('userid');
     $query = $this->mdb->project_get($id);
     if ($query->num_rows()) {
         $row = $query->row();
         $isModerator = validate_access('is_moderator', array('project_id' => $row->id, 'user_id' => $mID));
         if ($isModerator || $row->creator_id == $myID) {
             $this->mdb->project_member_remove($id, $mID);
             $sql = $this->model->getUserInfo(array('id' => $mID));
             $data = $sql->row();
             projectLogs_add('member_remove', $id, array('user_id' => $mID, 'user_name' => $data->display_name));
             generate_json(array('status' => 1));
         } else {
             generate_json(array('status' => 0, 'message' => 'You are not allowed to do this.'));
         }
     } else {
         generate_json(array('status' => 0, 'message' => 'Project does not exists.'));
     }
 }
Exemple #8
0
 public function get_data($id = 0)
 {
     requirelogin();
     updateLastActive();
     $id = (int) $id;
     $cp = (int) $this->input->get('p');
     $type = strtolower($this->input->get('type'));
     $itemsPerPage = 5;
     $myID = getUserID();
     if (!validate_access('valid_member', array('project_id' => $id, 'user_id' => $myID))) {
         generate_json(array('status' => 0, 'message' => 'You dont have enough permission to do this.'));
     } else {
         $priorities = $this->config->item('priorities');
         $priorityColors = array('bg-light', 'bg-warning dker', 'bg-danger');
         $page = $cp > 1 ? $cp : 1;
         $pageOrig = $page > 1 ? $page - 1 : 0;
         $sqStart = $pageOrig * $itemsPerPage;
         $qPendingItems = $this->mdb->tasks_get_pending($id, 0, 0);
         switch ($type) {
             case 'upcoming':
                 $query = $this->mdb->tasks_get_upcoming($id, $sqStart, $itemsPerPage);
                 $qAllItems = $this->mdb->tasks_get_upcoming($id, 0, 0);
                 break;
             case 'completed':
                 $query = $this->mdb->tasks_get_completed($id, $sqStart, $itemsPerPage);
                 $qAllItems = $this->mdb->tasks_get_completed($id, 0, 0);
                 break;
             case 'pending':
                 $query = $this->mdb->tasks_get_pending($id, $sqStart, $itemsPerPage);
                 $qAllItems = $qPendingItems;
                 break;
             default:
                 $query = $this->mdb->tasks_get_current($id, $sqStart, $itemsPerPage);
                 $qAllItems = $this->mdb->tasks_get_current($id, 0, 0);
         }
         $items = array();
         foreach ($query->result() as $row) {
             $qMembers = $this->mdb->task_members_get($row->id, 3);
             $members = array();
             foreach ($qMembers->result() as $member) {
                 $members[] = array('id' => $member->user_id, 'display_name' => $member->display_name);
             }
             $items[] = array('id' => $row->id, 'title' => $row->title, 'description' => empty($row->description) ? "<no description>" : $row->description, 'priority_id' => $row->priority, 'priority' => isset($priorities[$row->priority]) ? $priorities[$row->priority] : '', 'priority_class' => isset($priorityColors[$row->priority]) ? $priorityColors[$row->priority] : $priorityColors[0], 'creator_id' => $row->creator_id, 'creator_name' => $row->creator_name, 'date_created' => date("m/d/Y", strtotime($row->date_created)), 'date_start' => $row->date_start ? date("m/d/Y", strtotime($row->date_start)) : 'TBA', 'date_end' => $row->date_end ? date("m/d/Y", strtotime($row->date_end)) : 'TBA', 'date_completed' => $row->date_completed ? date("m/d/Y", strtotime($row->date_completed)) : 'n/a', 'remarks' => empty($row->remarks) ? "No remarks." : $row->remarks, 'random_members' => $members);
         }
         $allItems = $qAllItems->num_rows();
         $pendingTasks = $qPendingItems->num_rows();
         $total_page = $allItems > 0 ? ceil($allItems / $itemsPerPage) : 1;
         generate_json(array('status' => 1, 'items' => $items, 'total_page' => number_format($total_page), 'current_page' => $page, 'previous_page' => $page > 1 ? $page - 1 : '', 'next_page' => $page < $total_page ? $page + 1 : '', 'total_items' => number_format($allItems), 'pending' => $pendingTasks > 0 ? $pendingTasks : '', 'type' => ucfirst($type)));
     }
 }
Exemple #9
0
 public function add($pid = 0)
 {
     $myID = getUserID();
     $members = jsonInput('members');
     if (!validate_access('valid_member', array('project_id' => $pid, 'user_id' => $myID))) {
         generate_json(array('status' => 0, 'message' => 'You dont have enough permission to do this.'));
     } else {
         if (is_array($members) && count($members) > 0) {
             $errMsg = array();
             $message = '';
             foreach ($members as $member) {
                 $query = $this->mmdb->get_member($pid, $member);
                 if ($query->num_rows()) {
                     $row = $query->row();
                     if ($row->is_accepted == 1) {
                         $errMsg[] = "{$member} is already a member.";
                     } else {
                         if ($row->joined_by > 0) {
                             $errMsg[] = "{$member} is already invited.";
                         } else {
                             $this->mmdb->update_member(array('project_id' => $pid, 'email_address' => $member), array('is_accepted' => 1));
                         }
                     }
                 } else {
                     $qChkUser = $this->model->getUserInfo(array('email_address' => $member));
                     if ($qChkUser->num_rows()) {
                         $pmRow = $qChkUser->row();
                         $this->mmdb->project_member_add(array('project_id' => $pid, 'user_id' => $pmRow->id, 'email_address' => $pmRow->email_address, 'joined_by' => $myID, 'date_joined' => today(), 'last_visit' => NULL, 'is_accepted' => 0, 'project_role' => $this->siteinfo->config('project_roles_default')));
                         //Notify
                         notify('project_invite', $pmRow->id, array('project_id' => $pid));
                         $qProj = $this->db->get_where('projects', array('id' => $pid));
                         if ($qProj->num_rows()) {
                             $qProjRow = $qProj->row();
                             $myName = $this->session->userdata('display_name');
                             $redirectLink = base_url('#/app/projects/' . $pid);
                             do_sendmail($pmRow->id, $qProjRow->project_name, "{$myName} invited you to join <a href='{$redirectLink}'>" . $qProjRow->project_name . "</a>");
                         }
                     } else {
                         $this->mmdb->project_member_add(array('project_id' => $pid, 'user_id' => 0, 'email_address' => $member, 'joined_by' => $myID, 'date_joined' => today(), 'last_visit' => NULL, 'is_accepted' => 0, 'project_role' => $this->siteinfo->config('project_roles_default')));
                     }
                 }
             }
             if (count($errMsg)) {
                 $message = $errMsg[0];
             } else {
                 $message = 'Member(s) were successfully invited to this project. It will notify once they accepted it.';
             }
             generate_json(array('status' => count($errMsg) ? 0 : 1, 'message' => $message));
         } else {
             generate_json(array('status' => 0, 'message' => 'Please type a member username / email.'));
         }
     }
 }
Exemple #10
0
 private function loopComments($postID, $query)
 {
     $myID = getUserID();
     $items = array();
     $is_moderator = false;
     //Get project id
     $qp = $this->db->query("select project_id from posts where id = ?", array($postID));
     if ($qp->num_rows()) {
         $qpRow = $qp->row();
         if (is_numeric($qpRow->project_id)) {
             $is_moderator = validate_access('is_moderator', array('project_id' => $qpRow->project_id, 'user_id' => $myID));
         }
     }
     foreach ($query->result() as $cRow) {
         //reply snippet
         $replyItems = array();
         if ($cRow->comments) {
             $rQuery = $this->mdb->get_comment_snippet($postID, $cRow->id, 1);
             foreach ($rQuery->result() as $rRow) {
                 $dateCommented = convert_datetime($rRow->date_posted);
                 $replyItems[] = array('id' => $rRow->id, 'actor_id' => $rRow->user_id, 'actor_name' => $rRow->actor_name, 'replies' => $rRow->comments, 'agrees' => $rRow->agrees, 'disagrees' => $rRow->disagrees, 'is_agree' => $rRow->is_agree, 'is_disagree' => $rRow->is_disagree, 'date_commented' => relativedate(strtotime($dateCommented), false), 'comment' => $rRow->comment, 'update_buttons' => $rRow->user_id == $myID || $is_moderator ? 1 : 0);
             }
         }
         $rQuery = $this->mdb->get_comment_snippet($postID, $cRow->id, 2);
         $dateCommented = convert_datetime($cRow->date_posted);
         $items[] = array('id' => $cRow->id, 'actor_id' => $cRow->user_id, 'actor_name' => $cRow->actor_name, 'replies' => $cRow->comments, 'reply_snippet' => $replyItems, 'shownextcommentslink' => $rQuery->num_rows() > 1 ? 1 : 0, 'agrees' => $cRow->agrees, 'disagrees' => $cRow->disagrees, 'is_agree' => $cRow->is_agree, 'is_disagree' => $cRow->is_disagree, 'date_commented' => relativedate(strtotime($dateCommented), false), 'comment' => $cRow->comment, 'update_buttons' => $cRow->user_id == $myID || $is_moderator ? 1 : 0);
     }
     return $items;
 }
Exemple #11
0
 public function add_member()
 {
     requirelogin();
     updateLastActive();
     $id = (int) jsonInput('id');
     $members = jsonInput('members');
     $myID = getUserID();
     $query = $this->mdb->task_get($id);
     if ($query->num_rows()) {
         $row = $query->row();
         $isModerator = validate_access('is_moderator', array('project_id' => $row->project_id, 'user_id' => $myID));
         $qMember = $this->mdb->taskMembers_get(array('task_id' => $row->id, 'user_id' => $myID, 'is_accepted' => 1));
         if ($isModerator || $qMember->num_rows() || $myID == $row->creator_id) {
             if (is_array($members) && count($members)) {
                 foreach ($members as $member) {
                     $qChkUser = $this->model->getUserInfo(array('email_address' => $member));
                     if ($qChkUser->num_rows()) {
                         $memberRow = $qChkUser->row();
                         $qChkIfMember = $this->mdb->taskMembers_get(array('task_id' => $row->id, 'user_id' => $memberRow->id));
                         if ($qChkIfMember->num_rows()) {
                             generate_json(array('status' => 0, 'message' => $member . ' is already assigned to this task.'));
                             exit;
                         } else {
                             if (!validate_access('valid_member', array('project_id' => $row->project_id, 'user_id' => $memberRow->id))) {
                                 generate_json(array('status' => 0, 'message' => $member . ' is not a member of this project.'));
                                 exit;
                             }
                         }
                     } else {
                         generate_json(array('status' => 0, 'message' => $member . ' does not exists.'));
                         exit;
                     }
                 }
                 foreach ($members as $member) {
                     $qChkUser = $this->model->getUserInfo(array('email_address' => $member));
                     if ($qChkUser->num_rows()) {
                         $memberRow = $qChkUser->row();
                         $this->mdb->taskMembers_add(array('task_id' => $row->id, 'user_id' => $memberRow->id, 'assigned_by' => $myID, 'is_accepted' => $memberRow->id == $myID ? 1 : 0, 'date_joined' => today()));
                         //notification
                         notify('task_invite', $memberRow->id, array('project_id' => $row->project_id, 'task_id' => $row->id));
                         $qProj = $this->db->get_where('projects', array('id' => $row->project_id));
                         if ($qProj->num_rows()) {
                             $qProjRow = $qProj->row();
                             $myName = $this->session->userdata('display_name');
                             $redirectLink = base_url('#/app/projects/' . $row->project_id . '/task/' . $row->id);
                             do_sendmail($memberRow->id, $qProjRow->project_name, "{$myName} assigned a task for you in <a href='{$redirectLink}'>" . $qProjRow->project_name . "</a>");
                         }
                     }
                 }
                 generate_json(array('status' => 1, 'message' => 'Member(s) was invited to this task.'));
             } else {
                 generate_json(array('status' => 0, 'message' => 'No people(s) to add.'));
             }
         } else {
             generate_json(array('status' => 0, 'message' => 'You are not allowed to do this.'));
         }
     } else {
         generate_json(array('status' => 0, 'message' => 'Task does not exists.'));
     }
 }
Exemple #12
0
 private function processFeedData($data)
 {
     $items = array();
     $myID = getUserID();
     $temp_item = end($data);
     $is_moderator = false;
     if (isset($temp_item->project_id) && is_numeric($temp_item->project_id)) {
         $is_moderator = validate_access('is_moderator', array('project_id' => $temp_item->project_id, 'user_id' => $myID));
     }
     foreach ($data as $row) {
         //comment snippet
         $commentItems = array();
         if ($row->comments) {
             $query = $this->mdb->get_comment_snippet($row->id, 0, 2);
             foreach ($query->result() as $cRow) {
                 //reply snippet
                 $replyItems = array();
                 if ($cRow->comments) {
                     $rQuery = $this->mdb->get_comment_snippet($row->id, $cRow->id, 1);
                     foreach ($rQuery->result() as $rRow) {
                         $dateCommented = convert_datetime($rRow->date_posted);
                         $replyItems[] = array('id' => $rRow->id, 'actor_id' => $rRow->user_id, 'actor_name' => $rRow->actor_name, 'replies' => $rRow->comments, 'agrees' => $rRow->agrees, 'disagrees' => $rRow->disagrees, 'is_agree' => $rRow->is_agree, 'is_disagree' => $rRow->is_disagree, 'date_commented' => relativedate(strtotime($dateCommented), false), 'comment' => $rRow->comment, 'update_buttons' => $rRow->user_id == $myID || $is_moderator ? 1 : 0);
                     }
                 }
                 $rQuery = $this->mdb->get_comment_snippet($row->id, $cRow->id, 2);
                 $dateCommented = convert_datetime($cRow->date_posted);
                 $commentItems[] = array('id' => $cRow->id, 'actor_id' => $cRow->user_id, 'actor_name' => $cRow->actor_name, 'replies' => $cRow->comments, 'reply_snippet' => $replyItems, 'shownextcommentslink' => $rQuery->num_rows() > 1 ? 1 : 0, 'agrees' => $cRow->agrees, 'disagrees' => $cRow->disagrees, 'is_agree' => $cRow->is_agree, 'is_disagree' => $cRow->is_disagree, 'date_commented' => relativedate(strtotime($dateCommented), false), 'comment' => $cRow->comment, 'update_buttons' => $cRow->user_id == $myID || $is_moderator ? 1 : 0);
             }
         }
         $query = $this->mdb->get_comment_snippet($row->id, 0, 3);
         $datePosted = convert_datetime($row->date_posted);
         /* Attachments Start */
         $attachments = array();
         $aQuery = $this->mdb->get_attachments($temp_item->project_id, $row->id);
         $hx = 0;
         foreach ($aQuery->result() as $aRow) {
             $imgs = array('.gif', '.jpg', '.jpeg', '.png');
             if (in_array(strtolower($aRow->extension), $imgs) && $aRow->deleted_by == 0) {
                 $hx++;
                 $imgW = '';
                 $imgH = '';
                 $fullpath = 'uploads/files/' . $aRow->uploader . '/thumbs/' . $aRow->filepath;
                 if (is_file($fullpath)) {
                     $imgSize = getimagesize($fullpath);
                     $imgW = $imgSize[0];
                     $imgH = $imgSize[1];
                 }
                 $attachments['images'][] = array('id' => $aRow->id, 'filename' => $aRow->filename, 'filesize' => format_filesize($aRow->filesize), 'width' => $imgW, 'height' => $imgH, 'hidden' => $hx > 3 ? 1 : 0);
             } else {
                 $attachments['files'][] = array('id' => $aRow->id, 'filename' => $aRow->filename, 'filesize' => format_filesize($aRow->filesize), 'deleted_by' => $aRow->deleted_by);
             }
         }
         /* Attachments End */
         /* Params */
         $qParam = unserialize($row->params);
         $params = array();
         if ($qParam && is_array($qParam)) {
             foreach ($qParam as $param) {
                 $paramNameQuery = $this->db->get_where("users", array('id' => $param));
                 if ($paramNameQuery->num_rows()) {
                     $paramRow = $paramNameQuery->row();
                     $params[] = array('id' => $paramRow->id, 'name' => $paramRow->display_name);
                 }
             }
         }
         /* Params End */
         $items[] = array('id' => $row->id, 'poster_id' => $row->poster_id, 'poster_picture' => 'pictures/avatar/' . $row->id . '/thumb', 'poster_name' => $row->poster_name, 'post' => sprintf(htmlentities($row->post_message), $row->params), 'agrees' => $row->agrees, 'disagrees' => $row->disagrees, 'comments' => $row->comments, 'comment_snippet' => $commentItems, 'shownextcommentslink' => $query->num_rows() > 2 ? 1 : 0, 'is_agree' => $row->is_agree, 'is_disagree' => $row->is_disagree, 'date_posted' => relativedate(strtotime($datePosted), false), 'timestamp' => strtotime($row->date_modified), 'update_buttons' => $row->poster_id == $myID || $is_moderator ? 1 : 0, 'edit_button' => $row->poster_id == $myID ? 1 : 0, 'attachments' => $attachments, 'params' => $params, 'post_type' => $row->post_type);
     }
     return $items;
 }