/** * Display a form to reply directly to another comment * * @access private */ private function display_reply() { Html::reply(VGet::comment_id(), VGet::comment_name(), VGet::id(), VGet::type()); }
/** * Delete medias from database and on hard drive * * @access private */ private function delete() { if ($this->_user['delete_content'] && VPost::delete(false) && VPost::media_id()) { $results = array(); $global_result = true; foreach (VPost::media_id() as $id) { try { $media = new Media(); $media->_id = $id; $media->read('_permalink'); $path = $media->_permalink; $media->delete(); unset($media); HandleMedia::delete(PATH . $path); $this->_db->query('DELETE FROM `' . DB_PREFIX . 'comment` WHERE comment_rel_id = ' . $id . ' AND comment_rel_type = "media"'); if (VPost::type() == 'alien') { $to_update['table'] = 'media'; $to_update['columns'] = array(':attach' => 'media_attachment'); $to_update['condition_columns'] = array(':ca' => 'media_attachment'); $to_update['column_values'] = array(':attach' => null, ':ca' => $id); $to_update['value_types'] = array(':attach' => 'null', ':ca' => 'int'); $this->_db->update($to_update); } array_push($results, true); } catch (Exception $e) { array_push($results, false); } } foreach ($results as $result) { if ($result !== true) { $global_result = false; } } Session::monitor_activity('deleted ' . count(VPost::media_id()) . ' file(s)'); $this->_action_msg = ActionMessages::deleted($global_result); } elseif ($this->_user['delete_content'] && VGet::action() == 'delete' && VGet::id()) { try { $media = new Media(); $media->_id = VGet::id(); $media->read('_permalink'); $path = $media->_permalink; $media->delete(); unset($media); HandleMedia::delete(PATH . $path); $this->_db->query('DELETE FROM `' . DB_PREFIX . 'comment` WHERE comment_rel_id = ' . VGet::id() . ' AND comment_rel_type = "media"'); if (VGet::type() == 'alien') { $to_update['table'] = 'media'; $to_update['columns'] = array(':attach' => 'media_attachment'); $to_update['condition_columns'] = array(':ca' => 'media_attachment'); $to_update['column_values'] = array(':attach' => null, ':ca' => VGet::id()); $to_update['value_types'] = array(':attach' => 'null', ':ca' => 'int'); $this->_db->update($to_update); } Session::monitor_activity('deleted a file'); $result = true; } catch (Exception $e) { error_log($e->getMessage(), 0); $result = false; } $this->_action_msg = ActionMessages::deleted($result); } elseif (!$this->_user['delete_content'] && (VPost::delete(false) || VGet::action() == 'delete')) { $this->_action_msg = ActionMessages::action_no_perm(); } }