Esempio n. 1
0
 public function getBoards()
 {
     $ide = new IDE();
     $access = $ide->isLogged() ? $_SESSION['access'] : 0;
     $logged = $ide->isLogged() ? "" : "AND `requireLogin` != '1'";
     $this->load->database();
     return $this->db->query("SELECT `b`.`id`, `b`.`name`, `b`.`description`, `b`.`closed`, `b`.`moderators`, `u`.`name` AS `author`, `p`.`thread_id`, `t`.`name` AS `thread_title`, `p`.`time` FROM `forums` AS `b` LEFT JOIN (SELECT `time`, `thread_id`, `board_id`, `author` FROM `posts` ORDER BY `time` DESC) AS `p` ON `p`.`board_id` = `b`.`id` LEFT JOIN `players` AS `u` ON `u`.`id` = `p`.`author` LEFT JOIN `threads` AS `t` ON `t`.`id` = `p`.`thread_id` WHERE `b`.`access` <= '" . $access . "' " . $logged . " GROUP BY `b`.`id` ORDER BY `b`.`order` ASC;")->result_array();
 }
Esempio n. 2
0
 public function thread($id = null)
 {
     require "config.php";
     $ide = new IDE();
     if (empty($id)) {
         $ide->CriticalRedirect(WEBSITE . "/index.php/forum");
     }
     $this->load->model("forum_model");
     $data = array();
     $data['thread'] = $this->forum_model->getThreadInfo($id);
     $data['board'] = $this->forum_model->getBoardInfo($data['thread'][0]['board_id']);
     $this->load->library('pagination');
     $config['base_url'] = WEBSITE . '/index.php/forum/thread/' . $id . '/';
     $config['total_rows'] = $this->forum_model->getPostsAmount($id);
     $config['per_page'] = $config['postsLimit'];
     $config['uri_segment'] = 4;
     $this->pagination->initialize($config);
     $data['id'] = $id;
     $data['pages'] = $this->pagination->create_links();
     $data['posts'] = $this->forum_model->getPosts($id);
     if ($ide->isLogged()) {
         $data['characters'] = $this->forum_model->getCharacters();
         $data['isModerator'] = $this->forum_model->isModerator($data['board'][0]['moderators'], $data['characters']);
     }
     $this->load->view("forum_view_thread", $data);
 }
Esempio n. 3
0
 function create()
 {
     $ide = new IDE();
     if ($ide->isLogged()) {
         $ide->redirect('../account');
     }
     $this->load->helper('form');
     if ($_POST) {
         $this->load->library('form_validation');
         $this->form_validation->set_rules('name', 'Account Name', 'required|min_length[4]|max_length[32]|callback__account_exists|alpha');
         $this->form_validation->set_rules('password', 'Password', 'required|matches[repeat]|min_length[4]|max_length[255]');
         $this->form_validation->set_rules('email', 'Email', 'required|valid_email');
         if ($this->form_validation->run() == TRUE) {
             require APPPATH . 'config/ide_default.php';
             $ots = POT::getInstance();
             $ots->connect(POT::DB_MYSQL, connection());
             $account = new OTS_Account();
             $name = $account->createNamed($_POST['name']);
             $account->setPassword($_POST['password']);
             $account->setEmail($_POST['email']);
             $account->setCustomField('premdays', PREMDAYS);
             try {
                 $account->save();
                 $_SESSION['logged'] = 1;
                 $_SESSION['name'] = $_POST['name'];
                 $ide->redirect('../account');
             } catch (Exception $e) {
                 error($e->getMessage());
             }
         }
     }
     #Load view of creating account
     $this->load->view('create');
 }
Esempio n. 4
0
<?php

$ide = new IDE();
try {
    $ide->loadInjections("view_news");
} catch (Exception $e) {
    error($e->getMessage());
}
echo "<div class='news'>";
echo "<div class='newsTitle'>" . $news[0]['title'] . "</div>";
echo "<div class='newsBody'>" . $news[0]['body'] . "</div>";
echo "<div class='newsFooter'>Posted on: " . UNIX_TimeStamp($news[0]['time']) . " </div>";
echo "</div>";
echo "<h1>Comments</h1>";
if (!$ide->isLogged()) {
    alert("You need to be logged in to write comments.");
} else {
    if (count($characters) == 0) {
        error("You need to have a character on the server to comment on the news.");
    } else {
        echo error(validation_errors());
        echo form_open(WEBSITE . "/index.php/home/view/" . $id);
        echo "<br /><label>Character</label><select name='character'>";
        foreach ($characters as $character) {
            echo "<option value='" . $character['name'] . "'>" . $character['name'] . "</option>";
        }
        echo "</select><br /><br />";
        echo "<textarea style='width: 99%;' name='body'>" . @$_POST['body'] . "</textarea>";
        echo "<input type='submit' value='Comment'>";
        echo "</form>";
    }