public function tapaViesti($id) { if (self::check_logged_in()) { $row = Viesti::getRow($id); $lanka = $row['thread']; $viesti = new Viesti(array('id' => $row['id'], 'author' => $row['author'])); if ($viesti->author == self::get_user_logged_in()->id || self::get_user_logged_in()->moderator == 1) { $viesti->delete(); Redirect::to('/langat/' . $lanka, array('message' => 'Viesti poistettu onnistuneesti!')); } else { Redirect::to('/', array('message' => 'Ei valtuuksia toimintoon!')); } } else { Redirect::to('/login', array('message' => 'Kirjaudu sisään tilillesi!')); } }