implemented buildURL() function (and fixed redirecting on https page)
added comments block (file description) in each PHP file
This commit is contained in:
@@ -12,6 +12,9 @@ define('DB_PREFIX','uf_');
|
|||||||
define('VERSION','2.0.0');
|
define('VERSION','2.0.0');
|
||||||
define('UF_INSTALLED',true);
|
define('UF_INSTALLED',true);
|
||||||
|
|
||||||
define('COOKIE_DOMAIN', '');
|
define('FORUM_DOMAIN', 'localhost');
|
||||||
define('COOKIE_PATH', '/uf2');
|
define('FORUM_PATH', '/uf2');
|
||||||
|
define('HTTP_PORT', 81);
|
||||||
|
define('HTTPS_PORT', 443);
|
||||||
|
define('USE_HTTPS', true);
|
||||||
?>
|
?>
|
||||||
|
|||||||
@@ -1,4 +1,13 @@
|
|||||||
<?php
|
<?php
|
||||||
|
/**
|
||||||
|
* @package uForum2
|
||||||
|
* @file inc/askModel.class.php
|
||||||
|
* @copyright 2007-2015 (c) PioDer <piotrek@pioder.pl>
|
||||||
|
* @link http://www.pioder.pl/
|
||||||
|
* @license see LICENSE.txt
|
||||||
|
**/
|
||||||
|
|
||||||
|
require_once('./inc/model.class.php');
|
||||||
|
|
||||||
abstract class AskModel
|
abstract class AskModel
|
||||||
{
|
{
|
||||||
@@ -6,7 +15,7 @@ abstract class AskModel
|
|||||||
|
|
||||||
function loadModel($model)
|
function loadModel($model)
|
||||||
{
|
{
|
||||||
if (file_exists('./inc/models/'.$model.'.class.php') && !array_key_exists($model, $this->models)) //realizowany singleton
|
if (file_exists('./inc/models/'.$model.'.class.php') && !array_key_exists($model, $this->models)) //singleton
|
||||||
{
|
{
|
||||||
require_once('./inc/models/'.$model.'.class.php');
|
require_once('./inc/models/'.$model.'.class.php');
|
||||||
$this->models[$model] = new $model($this->db);
|
$this->models[$model] = new $model($this->db);
|
||||||
@@ -30,5 +39,4 @@ abstract class AskModel
|
|||||||
$this->models[$model] = $model_ptr;
|
$this->models[$model] = $model_ptr;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
?>
|
?>
|
||||||
@@ -1,4 +1,11 @@
|
|||||||
<?php
|
<?php
|
||||||
|
/**
|
||||||
|
* @package uForum2
|
||||||
|
* @file inc/bbcode.php
|
||||||
|
* @copyright 2007-2015 (c) PioDer <piotrek@pioder.pl>
|
||||||
|
* @link http://www.pioder.pl/
|
||||||
|
* @license see LICENSE.txt
|
||||||
|
**/
|
||||||
|
|
||||||
function BBCode($content)
|
function BBCode($content)
|
||||||
{
|
{
|
||||||
@@ -35,8 +42,7 @@ function BBCode($content)
|
|||||||
'/\[code\](.*?)\[\/code\]/is', # [code]
|
'/\[code\](.*?)\[\/code\]/is', # [code]
|
||||||
'/\\n/', # \n
|
'/\\n/', # \n
|
||||||
'/\\r/', # \r
|
'/\\r/', # \r
|
||||||
'/(^|[^"])((http:\/\/)[-a-zA-Z0-9@:%_\+.~#?&\/\/=]+)/i',
|
'/(^|[^"])((http:\/\/)[-a-zA-Z0-9@:%_\+.~#?&\/\/=]+)/i',
|
||||||
|
|
||||||
);
|
);
|
||||||
|
|
||||||
$replace = array(
|
$replace = array(
|
||||||
@@ -77,35 +83,4 @@ function BBCode($content)
|
|||||||
|
|
||||||
return preg_replace($pattern, $replace, $content);
|
return preg_replace($pattern, $replace, $content);
|
||||||
}
|
}
|
||||||
|
|
||||||
function StripBBCode($content)
|
|
||||||
{
|
|
||||||
$pattern = array(
|
|
||||||
'/\\n/', # \n
|
|
||||||
'/\\r/', # \r
|
|
||||||
'/\[b\](.*?)\[\/b\]/is', # [b]
|
|
||||||
'/\[i\](.*?)\[\/i\]/is', # [i]
|
|
||||||
'/\[u\](.*?)\[\/u\]/is', # [u]
|
|
||||||
'/\[s\](.*?)\[\/s\]/is', # [s]
|
|
||||||
'/\[url=(.*?)\](.*?)\[\/url\]/is', # [url=]
|
|
||||||
'/\[url](.*?)\[\/url\]/is', # [url]
|
|
||||||
'/\[img](.*?)\[\/img\]/is', # [img]
|
|
||||||
'/\[color=(.*?)\](.*?)\[\/color\]/is', # [color]
|
|
||||||
);
|
|
||||||
|
|
||||||
$replace = array(
|
|
||||||
'', # \n
|
|
||||||
'', # \r
|
|
||||||
'\1', # [b]
|
|
||||||
'\1', # [i]
|
|
||||||
'\1', # [u]
|
|
||||||
'\1', # [s]
|
|
||||||
'\2', # [url=]
|
|
||||||
'\1', # [url]
|
|
||||||
'', # [img]
|
|
||||||
'\2', # [color]
|
|
||||||
);
|
|
||||||
|
|
||||||
return preg_replace($pattern, $replace, $content);
|
|
||||||
}
|
|
||||||
?>
|
?>
|
||||||
@@ -1,4 +1,11 @@
|
|||||||
<?php
|
<?php
|
||||||
|
/**
|
||||||
|
* @package uForum2
|
||||||
|
* @file inc/constants.php
|
||||||
|
* @copyright 2007-2015 (c) PioDer <piotrek@pioder.pl>
|
||||||
|
* @link http://www.pioder.pl/
|
||||||
|
* @license see LICENSE.txt
|
||||||
|
**/
|
||||||
|
|
||||||
//tables
|
//tables
|
||||||
define('BANLIST_TABLE',DB_PREFIX.'banlist');
|
define('BANLIST_TABLE',DB_PREFIX.'banlist');
|
||||||
@@ -18,6 +25,7 @@ define('POSTS_VIEW', DB_PREFIX.'view_posts');
|
|||||||
define('LOGGED_USERS_VIEW', DB_PREFIX.'view_logged_users');
|
define('LOGGED_USERS_VIEW', DB_PREFIX.'view_logged_users');
|
||||||
define('USERS_PC_VIEW', DB_PREFIX.'view_users_post_count');
|
define('USERS_PC_VIEW', DB_PREFIX.'view_users_post_count');
|
||||||
define('TOPICS_PC_VIEW', DB_PREFIX.'view_topics_post_count');
|
define('TOPICS_PC_VIEW', DB_PREFIX.'view_topics_post_count');
|
||||||
|
|
||||||
define('COOKIE_NAME', 'uf2_auth');
|
define('COOKIE_NAME', 'uf2_auth');
|
||||||
|
|
||||||
define('RANK_USER', 0);
|
define('RANK_USER', 0);
|
||||||
|
|||||||
@@ -1,6 +1,14 @@
|
|||||||
<?php
|
<?php
|
||||||
|
/**
|
||||||
|
* @package uForum2
|
||||||
|
* @file inc/controller.class.php
|
||||||
|
* @copyright 2007-2015 (c) PioDer <piotrek@pioder.pl>
|
||||||
|
* @link http://www.pioder.pl/
|
||||||
|
* @license see LICENSE.txt
|
||||||
|
**/
|
||||||
|
|
||||||
require_once('./inc/askModel.class.php');
|
require_once('./inc/askModel.class.php');
|
||||||
|
require_once('./inc/view.class.php');
|
||||||
|
|
||||||
abstract class Controller extends AskModel {
|
abstract class Controller extends AskModel {
|
||||||
|
|
||||||
@@ -27,11 +35,10 @@ abstract class Controller extends AskModel {
|
|||||||
header('Location: ' . $address);
|
header('Location: ' . $address);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public function loadView($view)
|
public function loadView($view)
|
||||||
{
|
{
|
||||||
if (file_exists('./inc/views/'.$view.'.class.php') && !array_key_exists($view, $this->views))
|
if (file_exists('./inc/views/'.$view.'.class.php') && !array_key_exists($view, $this->views))
|
||||||
{
|
{
|
||||||
require_once('./inc/views/'.$view.'.class.php');
|
require_once('./inc/views/'.$view.'.class.php');
|
||||||
$this->views[$view] = new $view($this->db);
|
$this->views[$view] = new $view($this->db);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,4 +1,11 @@
|
|||||||
<?php
|
<?php
|
||||||
|
/**
|
||||||
|
* @package uForum2
|
||||||
|
* @file inc/controllers/AdminController.class.php
|
||||||
|
* @copyright 2007-2015 (c) PioDer <piotrek@pioder.pl>
|
||||||
|
* @link http://www.pioder.pl/
|
||||||
|
* @license see LICENSE.txt
|
||||||
|
**/
|
||||||
|
|
||||||
require ('./inc/controller.class.php');
|
require ('./inc/controller.class.php');
|
||||||
|
|
||||||
|
|||||||
@@ -1,4 +1,11 @@
|
|||||||
<?php
|
<?php
|
||||||
|
/**
|
||||||
|
* @package uForum2
|
||||||
|
* @file inc/controllers/MainController.class.php
|
||||||
|
* @copyright 2007-2015 (c) PioDer <piotrek@pioder.pl>
|
||||||
|
* @link http://www.pioder.pl/
|
||||||
|
* @license see LICENSE.txt
|
||||||
|
**/
|
||||||
|
|
||||||
require ('./inc/controller.class.php');
|
require ('./inc/controller.class.php');
|
||||||
|
|
||||||
@@ -17,12 +24,21 @@ class MainController extends Controller
|
|||||||
$this->loadView('MainView');
|
$this->loadView('MainView');
|
||||||
$this->getView('MainView')->putExistingModel('SessionModel', $this->getModel('SessionModel'));
|
$this->getView('MainView')->putExistingModel('SessionModel', $this->getModel('SessionModel'));
|
||||||
$this->getView('MainView')->putExistingModel('ConfigModel', $this->getModel('ConfigModel'));
|
$this->getView('MainView')->putExistingModel('ConfigModel', $this->getModel('ConfigModel'));
|
||||||
|
|
||||||
|
//przekierowanie!
|
||||||
|
if ($_GET['mode'] == 'editprofile' || $_GET['mode'] == 'register' || $_GET['mode'] == 'login')
|
||||||
|
{
|
||||||
|
if ($_SERVER['REQUEST_SCHEME'] != 'https' && USE_HTTPS)
|
||||||
|
$this->forward(buildURL($_SERVER['REQUEST_URI'], true));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
if ($_SERVER['REQUEST_SCHEME'] != 'http')
|
||||||
|
$this->forward(buildURL($_SERVER['REQUEST_URI']));
|
||||||
}
|
}
|
||||||
|
|
||||||
public function main()
|
public function main()
|
||||||
{
|
{
|
||||||
$this->loadDependencies();
|
$this->loadDependencies();
|
||||||
|
|
||||||
$this->getView('MainView')->main();
|
$this->getView('MainView')->main();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -37,7 +53,7 @@ class MainController extends Controller
|
|||||||
$f = $this->getModel('ForumsModel')->getForum($_GET['id']);
|
$f = $this->getModel('ForumsModel')->getForum($_GET['id']);
|
||||||
|
|
||||||
if ($f == null)
|
if ($f == null)
|
||||||
$this->getView('MainView')->forum_message('Forum does not exist!', 'index.php');
|
$this->getView('MainView')->forum_message('Forum does not exist!', buildURL('index.php'));
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$this->getView('MainView')->putExistingModel('ForumsModel', $this->getModel('ForumsModel'));
|
$this->getView('MainView')->putExistingModel('ForumsModel', $this->getModel('ForumsModel'));
|
||||||
@@ -91,7 +107,7 @@ class MainController extends Controller
|
|||||||
$t = $this->getModel('PostsModel')->getTopic($_GET['id']);
|
$t = $this->getModel('PostsModel')->getTopic($_GET['id']);
|
||||||
|
|
||||||
if ($t == null)
|
if ($t == null)
|
||||||
$this->getView('MainView')->forum_message('Topic does not exist!', 'index.php');
|
$this->getView('MainView')->forum_message('Topic does not exist!', buildURL('index.php'));
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$this->getView('MainView')->putExistingModel('PostsModel', $this->getModel('PostsModel'));
|
$this->getView('MainView')->putExistingModel('PostsModel', $this->getModel('PostsModel'));
|
||||||
@@ -130,13 +146,13 @@ class MainController extends Controller
|
|||||||
|
|
||||||
if (!$this->getModel('SessionModel')->isLogged())
|
if (!$this->getModel('SessionModel')->isLogged())
|
||||||
{
|
{
|
||||||
$this->getView('MainView')->forum_message('You are not logged.', 'index.php?mode=login');
|
$this->getView('MainView')->forum_message('You are not logged.', buildURL('index.php?mode=login', true));
|
||||||
$lockv = true;
|
$lockv = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($this->getModel('SessionModel')->getRank() == RANK_USER && !isset($lockv))
|
if ($this->getModel('SessionModel')->getRank() == RANK_USER && !isset($lockv))
|
||||||
{
|
{
|
||||||
$this->getView('MainView')->forum_message('Only mods have access to this menu', 'index.php');
|
$this->getView('MainView')->forum_message('Only mods have access to this menu', buildURL('index.php'));
|
||||||
$lockv = true;
|
$lockv = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -152,7 +168,7 @@ class MainController extends Controller
|
|||||||
|
|
||||||
if ($t == null)
|
if ($t == null)
|
||||||
{
|
{
|
||||||
$this->getView('MainView')->forum_message('Topic does not exist!', 'index.php');
|
$this->getView('MainView')->forum_message('Topic does not exist!', buildURL('index.php'));
|
||||||
$lockv = true;
|
$lockv = true;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@@ -161,7 +177,7 @@ class MainController extends Controller
|
|||||||
$p = $this->getModel('PostsModel')->getPost($_GET['id']);
|
$p = $this->getModel('PostsModel')->getPost($_GET['id']);
|
||||||
if ($p == null)
|
if ($p == null)
|
||||||
{
|
{
|
||||||
$this->getView('MainView')->forum_message('Post does not exist!', 'index.php');
|
$this->getView('MainView')->forum_message('Post does not exist!', buildURL('index.php'));
|
||||||
$lockv = true;
|
$lockv = true;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@@ -170,7 +186,7 @@ class MainController extends Controller
|
|||||||
|
|
||||||
if ($t['post_count'] == 1)
|
if ($t['post_count'] == 1)
|
||||||
{
|
{
|
||||||
$this->getView('MainView')->forum_message('If topic has only one post, use <span style="font-weight: bold">delete topic</span> option.', 'index.php?mode=viewtopic&id='.$p['topic_id'], 3);
|
$this->getView('MainView')->forum_message('If topic has only one post, use <span style="font-weight: bold">delete topic</span> option.', buildURL('index.php?mode=viewtopic&id='.$p['topic_id']), 3);
|
||||||
$lockv = true;
|
$lockv = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -178,7 +194,7 @@ class MainController extends Controller
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
$this->getView('MainView')->forum_message('Invalid mode', 'index.php');
|
$this->getView('MainView')->forum_message('Invalid mode', buildURL('index.php'));
|
||||||
$lockv = true;
|
$lockv = true;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@@ -192,13 +208,13 @@ class MainController extends Controller
|
|||||||
{
|
{
|
||||||
case 'deletepost':
|
case 'deletepost':
|
||||||
$this->getModel('PostsModel')->deletePost($_GET['id']);
|
$this->getModel('PostsModel')->deletePost($_GET['id']);
|
||||||
$this->getView('MainView')->forum_message('Post deleted. Redirecting...', 'index.php?mode=viewtopic&id='.$p['topic_id']);
|
$this->getView('MainView')->forum_message('Post deleted. Redirecting...', buildURL('index.php?mode=viewtopic&id='.$p['topic_id']));
|
||||||
$lockv = true;
|
$lockv = true;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'deletetopic':
|
case 'deletetopic':
|
||||||
$this->getModel('PostsModel')->deleteTopic($_GET['id']);
|
$this->getModel('PostsModel')->deleteTopic($_GET['id']);
|
||||||
$this->getView('MainView')->forum_message('Topic deleted. Redirecting...', 'index.php?mode=viewforum&id='.$t['forum_id']);
|
$this->getView('MainView')->forum_message('Topic deleted. Redirecting...', buildURL('index.php?mode=viewforum&id='.$t['forum_id']));
|
||||||
$lockv = true;
|
$lockv = true;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
@@ -206,22 +222,22 @@ class MainController extends Controller
|
|||||||
if ($t['topic_locked'] == false)
|
if ($t['topic_locked'] == false)
|
||||||
{
|
{
|
||||||
$this->getModel('PostsModel')->lockTopic($_GET['id']);
|
$this->getModel('PostsModel')->lockTopic($_GET['id']);
|
||||||
$this->getView('MainView')->forum_message('Topic locked. Redirecting...', 'index.php?mode=viewtopic&id='.$_GET['id']);
|
$this->getView('MainView')->forum_message('Topic locked. Redirecting...', buildURL('index.php?mode=viewtopic&id='.$_GET['id']));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$this->getModel('PostsModel')->lockTopic($_GET['id'], false);
|
$this->getModel('PostsModel')->lockTopic($_GET['id'], false);
|
||||||
$this->getView('MainView')->forum_message('Topic unlocked. Redirecting...', 'index.php?mode=viewtopic&id='.$_GET['id']);
|
$this->getView('MainView')->forum_message('Topic unlocked. Redirecting...', buildURL('index.php?mode=viewtopic&id='.$_GET['id']));
|
||||||
}
|
}
|
||||||
$lockv = true;
|
$lockv = true;
|
||||||
break;
|
break;
|
||||||
case 'movetopic':
|
case 'movetopic':
|
||||||
if ($this->getModel('ForumsModel')->getForum($_POST['forum_id']) == null)
|
if ($this->getModel('ForumsModel')->getForum($_POST['forum_id']) == null)
|
||||||
$this->getView('MainView')->forum_message('Forum does not exist!', 'index.php?mode=viewtopic&id='.$_GET['id']);
|
$this->getView('MainView')->forum_message('Forum does not exist!', buildURL('index.php?mode=viewtopic&id='.$_GET['id']));
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$this->getModel('PostsModel')->moveTopic($_GET['id'], $_POST['forum_id']);
|
$this->getModel('PostsModel')->moveTopic($_GET['id'], $_POST['forum_id']);
|
||||||
$this->getView('MainView')->forum_message('Topic moved. Redirecting...', 'index.php?mode=viewtopic&id='.$_GET['id']);
|
$this->getView('MainView')->forum_message('Topic moved. Redirecting...', buildURL('index.php?mode=viewtopic&id='.$_GET['id']));
|
||||||
}
|
}
|
||||||
$lockv = true;
|
$lockv = true;
|
||||||
break;
|
break;
|
||||||
@@ -235,10 +251,10 @@ class MainController extends Controller
|
|||||||
case 'deletetopic':
|
case 'deletetopic':
|
||||||
case 'locktopic':
|
case 'locktopic':
|
||||||
case 'movetopic':
|
case 'movetopic':
|
||||||
$this->forward('index.php?mode=viewtopic&id='.$_GET['id']);
|
$this->forward(buildURL('index.php?mode=viewtopic&id='.$_GET['id']));
|
||||||
break;
|
break;
|
||||||
case 'deletepost':
|
case 'deletepost':
|
||||||
$this->forward('index.php?mode=viewtopic&id='.$p['topic_id']);
|
$this->forward(buildURL('index.php?mode=viewtopic&id='.$p['topic_id']));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -279,50 +295,50 @@ class MainController extends Controller
|
|||||||
|
|
||||||
if (!$this->getModel('SessionModel')->isLogged())
|
if (!$this->getModel('SessionModel')->isLogged())
|
||||||
{
|
{
|
||||||
$this->getView('MainView')->forum_message('You are not logged.', 'index.php?mode=login');
|
$this->getView('MainView')->forum_message('You are not logged.', buildURL('index.php?mode=login', true));
|
||||||
$lockv = true;
|
$lockv = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
//SPRAWDZANIE CZY TEMAT/FORUM ISTNIEJE I CZY NIE ZABLOKOWANE
|
//CHECKING IF TOPIC/FORUM EXISTS AND IS NOT LOCKED
|
||||||
if (!isset($lockv))
|
if (!isset($lockv))
|
||||||
switch($type)
|
switch($type)
|
||||||
{
|
{
|
||||||
case POSTING_NEWTOPIC: //sprawdzenie czy forum istnieje i czy nie zablokowane
|
case POSTING_NEWTOPIC: //checking if forum exists and is not locked
|
||||||
$f = $this->getModel('ForumsModel')->getForum($_GET['id']);
|
$f = $this->getModel('ForumsModel')->getForum($_GET['id']);
|
||||||
|
|
||||||
if ($f == null)
|
if ($f == null)
|
||||||
{
|
{
|
||||||
$this->getView('MainView')->forum_message('Forum does not exist!', 'index.php');
|
$this->getView('MainView')->forum_message('Forum does not exist!', buildURL('index.php'));
|
||||||
$lockv = true;
|
$lockv = true;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
if ($f['locked'] == true)
|
if ($f['locked'] == true)
|
||||||
{
|
{
|
||||||
$this->getView('MainView')->forum_message('Forum is locked', 'index.php?mode=viewforum&id='.$_GET['id']);
|
$this->getView('MainView')->forum_message('Forum is locked', buildURL('index.php?mode=viewforum&id='.$_GET['id']));
|
||||||
$lockv = true;
|
$lockv = true;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case POSTING_REPLY: //sprawdzenie czy temat istnieje
|
case POSTING_REPLY: //checking if topic exists
|
||||||
case POSTING_QUOTE:
|
case POSTING_QUOTE:
|
||||||
$t = $this->getModel('PostsModel')->getTopic($_GET['id']);
|
$t = $this->getModel('PostsModel')->getTopic($_GET['id']);
|
||||||
|
|
||||||
if ($t == null)
|
if ($t == null)
|
||||||
{
|
{
|
||||||
$this->getView('MainView')->forum_message('Topic does not exist!', 'index.php');
|
$this->getView('MainView')->forum_message('Topic does not exist!', buildURL('index.php'));
|
||||||
$lockv = true;
|
$lockv = true;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if ($t['forum_locked'] == true && $this->getModel('SessionModel')->getRank() < RANK_MOD)
|
if ($t['forum_locked'] == true && $this->getModel('SessionModel')->getRank() < RANK_MOD)
|
||||||
{
|
{
|
||||||
$this->getView('MainView')->forum_message('Forum is locked', 'index.php?mode=viewtopic&id='.$t['topic_id']);
|
$this->getView('MainView')->forum_message('Forum is locked', buildURL('index.php?mode=viewtopic&id='.$t['topic_id']));
|
||||||
$lockv = true;
|
$lockv = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($t['topic_locked'] == true && $this->getModel('SessionModel')->getRank() < RANK_MOD)
|
if ($t['topic_locked'] == true && $this->getModel('SessionModel')->getRank() < RANK_MOD)
|
||||||
{
|
{
|
||||||
$this->getView('MainView')->forum_message('Topic is locked', 'index.php?mode=viewtopic&id='.$t['topic_id']);
|
$this->getView('MainView')->forum_message('Topic is locked', buildURL('index.php?mode=viewtopic&id='.$t['topic_id']));
|
||||||
$lockv = true;
|
$lockv = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -333,14 +349,14 @@ class MainController extends Controller
|
|||||||
|
|
||||||
if ($qp == null)
|
if ($qp == null)
|
||||||
{
|
{
|
||||||
$this->getView('MainView')->forum_message('Invalid quoted post', 'index.php?mode=viewtopic&id='.$t['topic_id']);
|
$this->getView('MainView')->forum_message('Invalid quoted post', buildURL('index.php?mode=viewtopic&id='.$t['topic_id']));
|
||||||
$lockv = true;
|
$lockv = true;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if ($qp['topic_id'] != $_GET['id'])
|
if ($qp['topic_id'] != $_GET['id'])
|
||||||
{
|
{
|
||||||
$this->getView('MainView')->forum_message('Invalid quoted post', 'index.php?mode=viewtopic&id='.$t['topic_id']);
|
$this->getView('MainView')->forum_message('Invalid quoted post', buildURL('index.php?mode=viewtopic&id='.$t['topic_id']));
|
||||||
$lockv = true;
|
$lockv = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -353,7 +369,7 @@ class MainController extends Controller
|
|||||||
|
|
||||||
if ($p == null)
|
if ($p == null)
|
||||||
{
|
{
|
||||||
$this->getView('MainView')->forum_message('Post does not exist!', 'index.php');
|
$this->getView('MainView')->forum_message('Post does not exist!', buildURL('index.php'));
|
||||||
$lockv = true;
|
$lockv = true;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@@ -361,17 +377,15 @@ class MainController extends Controller
|
|||||||
$t = $this->getModel('PostsModel')->getTopic($p['topic_id']);
|
$t = $this->getModel('PostsModel')->getTopic($p['topic_id']);
|
||||||
if ($t['forum_locked'] == true && $this->getModel('SessionModel')->getRank() < RANK_MOD)
|
if ($t['forum_locked'] == true && $this->getModel('SessionModel')->getRank() < RANK_MOD)
|
||||||
{
|
{
|
||||||
$this->getView('MainView')->forum_message('Forum is locked', 'index.php?mode=viewtopic&id='.$t['topic_id']);
|
$this->getView('MainView')->forum_message('Forum is locked', buildURL('index.php?mode=viewtopic&id='.$t['topic_id']));
|
||||||
$lockv = true;
|
$lockv = true;
|
||||||
}
|
}
|
||||||
if ($t['topic_locked'] == true && $this->getModel('SessionModel')->getRank() < RANK_MOD)
|
if ($t['topic_locked'] == true && $this->getModel('SessionModel')->getRank() < RANK_MOD)
|
||||||
{
|
{
|
||||||
$this->getView('MainView')->forum_message('Topic is locked', 'index.php?mode=viewtopic&id='.$t['topic_id']);
|
$this->getView('MainView')->forum_message('Topic is locked', buildURL('index.php?mode=viewtopic&id='.$t['topic_id']));
|
||||||
$lockv = true;
|
$lockv = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
//sprawdzić czy edycja tematu
|
|
||||||
// i ustawić opdowiednie parametry $type = POSTING_EDITTOPIC
|
|
||||||
$first = $this->getModel('PostsModel')->getFirstPost($t['topic_id']);
|
$first = $this->getModel('PostsModel')->getFirstPost($t['topic_id']);
|
||||||
|
|
||||||
if ($first['post_id'] == $_GET['id'])
|
if ($first['post_id'] == $_GET['id'])
|
||||||
@@ -379,7 +393,7 @@ class MainController extends Controller
|
|||||||
|
|
||||||
if ($p['user_id'] != $this->getModel('SessionModel')->getID() && $this->getModel('SessionModel')->getRank() < RANK_MOD)
|
if ($p['user_id'] != $this->getModel('SessionModel')->getID() && $this->getModel('SessionModel')->getRank() < RANK_MOD)
|
||||||
{
|
{
|
||||||
$this->getView('MainView')->forum_message('You can edit only own posts', 'index.php?mode=viewtopic&id='.$t['topic_id']);
|
$this->getView('MainView')->forum_message('You can edit only own posts', buildURL('index.php?mode=viewtopic&id='.$t['topic_id']));
|
||||||
$lockv = true;
|
$lockv = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -412,7 +426,7 @@ class MainController extends Controller
|
|||||||
$topic_id = $this->getModel('PostsModel')->addTopic($_POST['topic'], $_POST['post'], $_GET['id'], $this->getModel('SessionModel')->getID());
|
$topic_id = $this->getModel('PostsModel')->addTopic($_POST['topic'], $_POST['post'], $_GET['id'], $this->getModel('SessionModel')->getID());
|
||||||
if ($topic_id != null)
|
if ($topic_id != null)
|
||||||
{
|
{
|
||||||
$this->getView('MainView')->forum_message('Topic created, Redirecting...', 'index.php?mode=viewtopic&id='.$topic_id);
|
$this->getView('MainView')->forum_message('Topic created, Redirecting...', buildURL('index.php?mode=viewtopic&id='.$topic_id));
|
||||||
$lockv = true;
|
$lockv = true;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@@ -425,7 +439,7 @@ class MainController extends Controller
|
|||||||
if ($type == POSTING_EDITTOPIC)
|
if ($type == POSTING_EDITTOPIC)
|
||||||
$this->getModel('PostsModel')->changeTopic($t['topic_id'], $_POST['topic']);
|
$this->getModel('PostsModel')->changeTopic($t['topic_id'], $_POST['topic']);
|
||||||
|
|
||||||
$this->getView('MainView')->forum_message('Post edited. Redirecting to topic...', 'index.php?mode=viewtopic&id='.$t['topic_id']);
|
$this->getView('MainView')->forum_message('Post edited. Redirecting to topic...', buildURL('index.php?mode=viewtopic&id='.$t['topic_id']));
|
||||||
$lockv = true;
|
$lockv = true;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
@@ -433,7 +447,7 @@ class MainController extends Controller
|
|||||||
case POSTING_REPLY:
|
case POSTING_REPLY:
|
||||||
$this->getModel('PostsModel')->addPost($_GET['id'], $this->getModel('SessionModel')->getID(), $_POST['post']);
|
$this->getModel('PostsModel')->addPost($_GET['id'], $this->getModel('SessionModel')->getID(), $_POST['post']);
|
||||||
|
|
||||||
$this->getView('MainView')->forum_message('Reply saved. Redirecting to topic...', 'index.php?mode=viewtopic&id='.$_GET['id']);
|
$this->getView('MainView')->forum_message('Reply saved. Redirecting to topic...', buildURL('index.php?mode=viewtopic&id='.$_GET['id']));
|
||||||
$lockv = true;
|
$lockv = true;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@@ -478,7 +492,7 @@ class MainController extends Controller
|
|||||||
if (!$this->getModel('SessionModel')->isLogged())
|
if (!$this->getModel('SessionModel')->isLogged())
|
||||||
$this->forward('index.php');
|
$this->forward('index.php');
|
||||||
else
|
else
|
||||||
$this->forward('index.php?mode=viewprofile&id='.$this->getModel('SessionModel')->getID());
|
$this->forward(buildURL('index.php?mode=viewprofile&id='.$this->getModel('SessionModel')->getID()));
|
||||||
}
|
}
|
||||||
|
|
||||||
public function viewprofile()
|
public function viewprofile()
|
||||||
@@ -491,10 +505,9 @@ class MainController extends Controller
|
|||||||
$_GET['id'] = (isset($_GET['id'])) ? trim(strip_tags($this->db->real_escape_string($_GET['id']))) : 0;
|
$_GET['id'] = (isset($_GET['id'])) ? trim(strip_tags($this->db->real_escape_string($_GET['id']))) : 0;
|
||||||
|
|
||||||
if ($this->getModel('UsersModel')->getUserInformation($_GET['id']) == null)
|
if ($this->getModel('UsersModel')->getUserInformation($_GET['id']) == null)
|
||||||
$this->getView('MainView')->forum_message('User does not exist!', 'index.php');
|
$this->getView('MainView')->forum_message('User does not exist!', buildURL('index.php'));
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
//$this->getView('MainView')->putExistingModel('PostsModel', $this->getModel('PostsModel'));
|
|
||||||
$this->getView('MainView')->viewprofile();
|
$this->getView('MainView')->viewprofile();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -507,7 +520,7 @@ class MainController extends Controller
|
|||||||
|
|
||||||
if (!$this->getModel('SessionModel')->isLogged())
|
if (!$this->getModel('SessionModel')->isLogged())
|
||||||
{
|
{
|
||||||
$this->getView('MainView')->forum_message('You are not logged.', 'index.php?mode=login');
|
$this->getView('MainView')->forum_message('You are not logged.', buildURL('index.php?mode=login', true));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -580,7 +593,7 @@ class MainController extends Controller
|
|||||||
$this->getModel('UsersModel')->changeUserPassword($this->getModel('SessionModel')->getID(), sha1($_POST['passwd']));
|
$this->getModel('UsersModel')->changeUserPassword($this->getModel('SessionModel')->getID(), sha1($_POST['passwd']));
|
||||||
|
|
||||||
$this->getModel('UsersModel')->updateUserProfile($this->getModel('SessionModel')->getID(), '', $_POST['email'], $_POST['location'], $_POST['signature'], $av);
|
$this->getModel('UsersModel')->updateUserProfile($this->getModel('SessionModel')->getID(), '', $_POST['email'], $_POST['location'], $_POST['signature'], $av);
|
||||||
$this->getView('MainView')->forum_message('Your profile has changed.', 'index.php?mode=viewprofile&id='.$this->getModel('SessionModel')->getID());
|
$this->getView('MainView')->forum_message('Your profile has changed.', buildURL('index.php?mode=viewprofile&id='.$this->getModel('SessionModel')->getID()));
|
||||||
$lockv = true;
|
$lockv = true;
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -607,7 +620,7 @@ class MainController extends Controller
|
|||||||
|
|
||||||
$this->getModel('SessionModel')->deleteSession();
|
$this->getModel('SessionModel')->deleteSession();
|
||||||
|
|
||||||
$this->getView('MainView')->forum_message('You are logged out.', 'index.php');
|
$this->getView('MainView')->forum_message('You are logged out.', buildURL('index.php'));
|
||||||
}
|
}
|
||||||
|
|
||||||
public function login()
|
public function login()
|
||||||
@@ -615,11 +628,8 @@ class MainController extends Controller
|
|||||||
$this->loadDependencies();
|
$this->loadDependencies();
|
||||||
$this->loadModel('BansModel');
|
$this->loadModel('BansModel');
|
||||||
|
|
||||||
if ($_SERVER['REQUEST_SCHEME'] == 'http')
|
|
||||||
$this->forward('https://'.$_SERVER['SERVER_NAME'].$_SERVER['REQUEST_URI']);
|
|
||||||
|
|
||||||
if ($this->getModel('SessionModel')->isLogged())
|
if ($this->getModel('SessionModel')->isLogged())
|
||||||
$this->forward('index.php');
|
$this->forward(buildURL('index.php'));
|
||||||
|
|
||||||
$msg = '';
|
$msg = '';
|
||||||
if (isset($_POST['nick'], $_POST['passwd']))
|
if (isset($_POST['nick'], $_POST['passwd']))
|
||||||
@@ -640,7 +650,7 @@ class MainController extends Controller
|
|||||||
if ($ban_info == null)
|
if ($ban_info == null)
|
||||||
{
|
{
|
||||||
$this->getModel('SessionModel')->registerNewSession($userinfo['user_id']);
|
$this->getModel('SessionModel')->registerNewSession($userinfo['user_id']);
|
||||||
$this->getView('MainView')->forum_message('You are logged as: <span style="font-weight: bold">'.$userinfo['nick'].'</span>', 'index.php');
|
$this->getView('MainView')->forum_message('You are logged as: <span style="font-weight: bold">'.$userinfo['nick'].'</span>', buildURL('index.php'));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -663,9 +673,6 @@ class MainController extends Controller
|
|||||||
|
|
||||||
if ($this->getModel('SessionModel')->isLogged())
|
if ($this->getModel('SessionModel')->isLogged())
|
||||||
$this->forward('index.php');
|
$this->forward('index.php');
|
||||||
|
|
||||||
if ($_SERVER['REQUEST_SCHEME'] == 'http')
|
|
||||||
$this->forward('https://'.$_SERVER['SERVER_NAME'].$_SERVER['REQUEST_URI']);
|
|
||||||
|
|
||||||
$msg = '';
|
$msg = '';
|
||||||
if (isset($_POST['nick'], $_POST['passwd'], $_POST['passwd_confirm'], $_POST['email']))
|
if (isset($_POST['nick'], $_POST['passwd'], $_POST['passwd_confirm'], $_POST['email']))
|
||||||
@@ -694,7 +701,7 @@ class MainController extends Controller
|
|||||||
if ($msg == '')
|
if ($msg == '')
|
||||||
{
|
{
|
||||||
$this->getModel('UsersModel')->createNewUser($_POST['nick'], sha1($_POST['passwd']), $_POST['email']);
|
$this->getModel('UsersModel')->createNewUser($_POST['nick'], sha1($_POST['passwd']), $_POST['email']);
|
||||||
$this->getView('MainView')->forum_message('Your account has created. Log in to write new posts.', 'index.php');
|
$this->getView('MainView')->forum_message('Your account has created. Log in to write new posts.', buildURL('index.php'), 3);
|
||||||
$lockv = true;
|
$lockv = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,4 +1,12 @@
|
|||||||
<?php
|
<?php
|
||||||
|
/**
|
||||||
|
* @package uForum2
|
||||||
|
* @file inc/database_connection.php
|
||||||
|
* @copyright 2007-2015 (c) PioDer <piotrek@pioder.pl>
|
||||||
|
* @link http://www.pioder.pl/
|
||||||
|
* @license see LICENSE.txt
|
||||||
|
**/
|
||||||
|
|
||||||
|
|
||||||
$DB = new MySQLi(DB_HOST, DB_USER, DB_PASSWD, DB_NAME);
|
$DB = new MySQLi(DB_HOST, DB_USER, DB_PASSWD, DB_NAME);
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,23 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
|
function buildURL($URI, $https = false)
|
||||||
|
{
|
||||||
|
$url = 'http';
|
||||||
|
if ($https && USE_HTTPS)
|
||||||
|
$url .= 's';
|
||||||
|
|
||||||
|
$url .= '://'.FORUM_DOMAIN;
|
||||||
|
if ($https && USE_HTTPS && HTTPS_PORT != 443)
|
||||||
|
$url .= ':'.HTTPS_PORT;
|
||||||
|
|
||||||
|
if ((!$https || !USE_HTTPS) && HTTP_PORT != 80)
|
||||||
|
$url .= ':'.HTTP_PORT;
|
||||||
|
|
||||||
|
if (strpos($URI, FORUM_PATH) === 0)
|
||||||
|
$url .= $URI;
|
||||||
|
else
|
||||||
|
$url .= FORUM_PATH.'/'.$URI;
|
||||||
|
|
||||||
|
return $url;
|
||||||
|
}
|
||||||
?>
|
?>
|
||||||
@@ -1,6 +1,11 @@
|
|||||||
<?php
|
<?php
|
||||||
|
/**
|
||||||
require_once('./inc/askModel.class.php');
|
* @package uForum2
|
||||||
|
* @file inc/model.class.php
|
||||||
|
* @copyright 2007-2015 (c) PioDer <piotrek@pioder.pl>
|
||||||
|
* @link http://www.pioder.pl/
|
||||||
|
* @license see LICENSE.txt
|
||||||
|
**/
|
||||||
|
|
||||||
abstract class Model extends AskModel
|
abstract class Model extends AskModel
|
||||||
{
|
{
|
||||||
@@ -53,4 +58,5 @@ abstract class Model extends AskModel
|
|||||||
|
|
||||||
return $out;
|
return $out;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
?>
|
||||||
@@ -1,6 +1,11 @@
|
|||||||
<?php
|
<?php
|
||||||
|
/**
|
||||||
require_once('./inc/model.class.php');
|
* @package uForum2
|
||||||
|
* @file inc/models/BansModel.php
|
||||||
|
* @copyright 2007-2015 (c) PioDer <piotrek@pioder.pl>
|
||||||
|
* @link http://www.pioder.pl/
|
||||||
|
* @license see LICENSE.txt
|
||||||
|
**/
|
||||||
|
|
||||||
class BansModel extends Model
|
class BansModel extends Model
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1,6 +1,11 @@
|
|||||||
<?php
|
<?php
|
||||||
|
/**
|
||||||
require_once('./inc/model.class.php');
|
* @package uForum2
|
||||||
|
* @file inc/models/ConfigModel.php
|
||||||
|
* @copyright 2007-2015 (c) PioDer <piotrek@pioder.pl>
|
||||||
|
* @link http://www.pioder.pl/
|
||||||
|
* @license see LICENSE.txt
|
||||||
|
**/
|
||||||
|
|
||||||
class ConfigModel extends Model
|
class ConfigModel extends Model
|
||||||
{
|
{
|
||||||
@@ -34,5 +39,4 @@ class ConfigModel extends Model
|
|||||||
$this->db->query($query);
|
$this->db->query($query);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
?>
|
?>
|
||||||
@@ -1,6 +1,11 @@
|
|||||||
<?php
|
<?php
|
||||||
|
/**
|
||||||
require_once('./inc/model.class.php');
|
* @package uForum2
|
||||||
|
* @file inc/models/ForumsModel.php
|
||||||
|
* @copyright 2007-2015 (c) PioDer <piotrek@pioder.pl>
|
||||||
|
* @link http://www.pioder.pl/
|
||||||
|
* @license see LICENSE.txt
|
||||||
|
**/
|
||||||
|
|
||||||
class ForumsModel extends Model
|
class ForumsModel extends Model
|
||||||
{
|
{
|
||||||
@@ -115,5 +120,4 @@ class ForumsModel extends Model
|
|||||||
$this->db->query($query);
|
$this->db->query($query);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
?>
|
?>
|
||||||
@@ -1,6 +1,11 @@
|
|||||||
<?php
|
<?php
|
||||||
|
/**
|
||||||
require_once('./inc/model.class.php');
|
* @package uForum2
|
||||||
|
* @file inc/models/NavigationModel.php
|
||||||
|
* @copyright 2007-2015 (c) PioDer <piotrek@pioder.pl>
|
||||||
|
* @link http://www.pioder.pl/
|
||||||
|
* @license see LICENSE.txt
|
||||||
|
**/
|
||||||
|
|
||||||
class NavigationModel extends Model
|
class NavigationModel extends Model
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1,6 +1,11 @@
|
|||||||
<?php
|
<?php
|
||||||
|
/**
|
||||||
require_once('./inc/model.class.php');
|
* @package uForum2
|
||||||
|
* @file inc/models/PostsModel.php
|
||||||
|
* @copyright 2007-2015 (c) PioDer <piotrek@pioder.pl>
|
||||||
|
* @link http://www.pioder.pl/
|
||||||
|
* @license see LICENSE.txt
|
||||||
|
**/
|
||||||
|
|
||||||
class PostsModel extends Model
|
class PostsModel extends Model
|
||||||
{
|
{
|
||||||
@@ -122,5 +127,4 @@ class PostsModel extends Model
|
|||||||
$this->db->query($query);
|
$this->db->query($query);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
?>
|
?>
|
||||||
@@ -1,6 +1,11 @@
|
|||||||
<?php
|
<?php
|
||||||
|
/**
|
||||||
require_once('./inc/model.class.php');
|
* @package uForum2
|
||||||
|
* @file inc/models/SessionModel.php
|
||||||
|
* @copyright 2007-2015 (c) PioDer <piotrek@pioder.pl>
|
||||||
|
* @link http://www.pioder.pl/
|
||||||
|
* @license see LICENSE.txt
|
||||||
|
**/
|
||||||
|
|
||||||
class SessionModel extends Model
|
class SessionModel extends Model
|
||||||
{
|
{
|
||||||
@@ -38,18 +43,15 @@ class SessionModel extends Model
|
|||||||
|
|
||||||
public function updateSession()
|
public function updateSession()
|
||||||
{
|
{
|
||||||
/*$this->db->query('UPDATE '.SESSIONS_TABLE.' SET expiry_time=(NOW() + INTERVAL 120 MINUTE) WHERE session_id=\''.$_COOKIE[COOKIE_NAME].'\'');
|
$newID = $this->generateSessionID();
|
||||||
setcookie(COOKIE_NAME, $_COOKIE[COOKIE_NAME], $_SERVER['REQUEST_TIME']+7200, COOKIE_PATH, COOKIE_DOMAIN, false, true); */
|
$this->db->query('UPDATE '.SESSIONS_TABLE.' SET expiry_time=(NOW() + INTERVAL 120 MINUTE), session_id=\''.$newID.'\' WHERE session_id=\''.$_COOKIE[COOKIE_NAME].'\'');
|
||||||
$newid = $this->generateSessionID();
|
$this->registerSessionCookie($newID, $_SERVER['REQUEST_TIME']+7200);
|
||||||
$this->db->query('UPDATE '.SESSIONS_TABLE.' SET expiry_time=(NOW() + INTERVAL 120 MINUTE), session_id=\''.$newid.'\' WHERE session_id=\''.$_COOKIE[COOKIE_NAME].'\'');
|
|
||||||
setcookie(COOKIE_NAME, $newid, $_SERVER['REQUEST_TIME']+7200, COOKIE_PATH, COOKIE_DOMAIN, false, true);
|
|
||||||
$_COOKIE[COOKIE_NAME] = $newid;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function deleteSession()
|
public function deleteSession()
|
||||||
{
|
{
|
||||||
setcookie(COOKIE_NAME, '', $_SERVER['REQUEST_TIME']-3600, COOKIE_PATH, COOKIE_DOMAIN, false, true);
|
|
||||||
$this->db->query('DELETE FROM '.SESSIONS_TABLE.' WHERE session_id=\''.$_COOKIE[COOKIE_NAME].'\'');
|
$this->db->query('DELETE FROM '.SESSIONS_TABLE.' WHERE session_id=\''.$_COOKIE[COOKIE_NAME].'\'');
|
||||||
|
$this->registerSessionCookie('', $_SERVER['REQUEST_TIME']-3600);
|
||||||
}
|
}
|
||||||
|
|
||||||
private function generateSessionID()
|
private function generateSessionID()
|
||||||
@@ -76,7 +78,7 @@ class SessionModel extends Model
|
|||||||
|
|
||||||
$this->db->query($query);
|
$this->db->query($query);
|
||||||
|
|
||||||
setcookie(COOKIE_NAME, $newID, $_SERVER['REQUEST_TIME']+7200, COOKIE_PATH, COOKIE_DOMAIN, false, true);
|
$this->registerSessionCookie($newID, $_SERVER['REQUEST_TIME']+7200);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function tryGetUser($nick, $passwd)
|
public function tryGetUser($nick, $passwd)
|
||||||
@@ -120,6 +122,12 @@ class SessionModel extends Model
|
|||||||
else
|
else
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private function registerSessionCookie($session_id, $expiry_time)
|
||||||
|
{
|
||||||
|
$domain = (FORUM_DOMAIN == 'localhost') ? '' : FORUM_DOMAIN;
|
||||||
|
setcookie(COOKIE_NAME, $session_id, $expiry_time, FORUM_PATH, $domain, false, true);
|
||||||
|
$_COOKIE[COOKIE_NAME] = $session_id;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
?>
|
?>
|
||||||
@@ -1,6 +1,11 @@
|
|||||||
<?php
|
<?php
|
||||||
|
/**
|
||||||
require_once('./inc/model.class.php');
|
* @package uForum2
|
||||||
|
* @file inc/models/StatisticsModel.php
|
||||||
|
* @copyright 2007-2015 (c) PioDer <piotrek@pioder.pl>
|
||||||
|
* @link http://www.pioder.pl/
|
||||||
|
* @license see LICENSE.txt
|
||||||
|
**/
|
||||||
|
|
||||||
class StatisticsModel extends Model
|
class StatisticsModel extends Model
|
||||||
{
|
{
|
||||||
@@ -52,5 +57,4 @@ class StatisticsModel extends Model
|
|||||||
return $this->logged_users;
|
return $this->logged_users;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
?>
|
?>
|
||||||
@@ -1,6 +1,11 @@
|
|||||||
<?php
|
<?php
|
||||||
|
/**
|
||||||
require_once('./inc/model.class.php');
|
* @package uForum2
|
||||||
|
* @file inc/models/UsersModel.php
|
||||||
|
* @copyright 2007-2015 (c) PioDer <piotrek@pioder.pl>
|
||||||
|
* @link http://www.pioder.pl/
|
||||||
|
* @license see LICENSE.txt
|
||||||
|
**/
|
||||||
|
|
||||||
class UsersModel extends Model
|
class UsersModel extends Model
|
||||||
{
|
{
|
||||||
@@ -124,5 +129,4 @@ class UsersModel extends Model
|
|||||||
$this->db->query($query);
|
$this->db->query($query);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
?>
|
?>
|
||||||
@@ -1,6 +1,11 @@
|
|||||||
<?php
|
<?php
|
||||||
|
/**
|
||||||
require_once('./inc/askModel.class.php');
|
* @package uForum2
|
||||||
|
* @file inc/view.class.php
|
||||||
|
* @copyright 2007-2015 (c) PioDer <piotrek@pioder.pl>
|
||||||
|
* @link http://www.pioder.pl/
|
||||||
|
* @license see LICENSE.txt
|
||||||
|
**/
|
||||||
|
|
||||||
abstract class View extends AskModel
|
abstract class View extends AskModel
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1,6 +1,11 @@
|
|||||||
<?php
|
<?php
|
||||||
|
/**
|
||||||
require_once('./inc/view.class.php');
|
* @package uForum2
|
||||||
|
* @file inc/views/MainView.class.php
|
||||||
|
* @copyright 2007-2015 (c) PioDer <piotrek@pioder.pl>
|
||||||
|
* @link http://www.pioder.pl/
|
||||||
|
* @license see LICENSE.txt
|
||||||
|
**/
|
||||||
|
|
||||||
class MainView extends View
|
class MainView extends View
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1,4 +1,12 @@
|
|||||||
<?php
|
<?php
|
||||||
|
/**
|
||||||
|
* @package uForum2
|
||||||
|
* @file index.php
|
||||||
|
* @copyright 2007-2015 (c) PioDer <piotrek@pioder.pl>
|
||||||
|
* @link http://www.pioder.pl/
|
||||||
|
* @license see LICENSE.txt
|
||||||
|
**/
|
||||||
|
|
||||||
|
|
||||||
$_GET['mode'] = (isset($_GET['mode'])) ? trim(strip_tags($_GET['mode'])) : '';
|
$_GET['mode'] = (isset($_GET['mode'])) ? trim(strip_tags($_GET['mode'])) : '';
|
||||||
$_GET['submode'] = (isset($_GET['submode'])) ? trim(strip_tags($_GET['submode'])) : '';
|
$_GET['submode'] = (isset($_GET['submode'])) ? trim(strip_tags($_GET['submode'])) : '';
|
||||||
@@ -7,6 +15,7 @@ require_once('./config.php');
|
|||||||
require_once('./inc/constants.php');
|
require_once('./inc/constants.php');
|
||||||
require_once('./inc/database_connection.php');
|
require_once('./inc/database_connection.php');
|
||||||
require_once('./inc/bbcode.php');
|
require_once('./inc/bbcode.php');
|
||||||
|
require_once('./inc/misc_functions.php');
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
switch ($_GET['mode'])
|
switch ($_GET['mode'])
|
||||||
|
|||||||
Reference in New Issue
Block a user