|
|
@ -19,8 +19,8 @@ class MainController extends Controller |
|
|
|
|
|
|
|
private function loadDependencies() // zależności (sesje itp)
|
|
|
|
{ |
|
|
|
$this->loadModel('SessionModel'); //aktywacja sesji
|
|
|
|
$this->loadModel('ConfigModel'); //konfiguracja ogólna skryptu
|
|
|
|
$this->loadModel('SessionModel'); //initalizing session
|
|
|
|
$this->loadModel('ConfigModel'); //overall forum configuration
|
|
|
|
$this->loadView('MainView'); |
|
|
|
$this->getView('MainView')->putExistingModel('SessionModel', $this->getModel('SessionModel')); |
|
|
|
$this->getView('MainView')->putExistingModel('ConfigModel', $this->getModel('ConfigModel')); |
|
|
@ -94,7 +94,6 @@ class MainController extends Controller |
|
|
|
$_POST['sort_desc'] = (isset($_POST['sort_desc'])) ? 'DESC' : 'ASC'; |
|
|
|
|
|
|
|
$this->getView('MainView')->userlist(); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
public function viewtopic() |
|
|
@ -423,14 +422,14 @@ class MainController extends Controller |
|
|
|
break; |
|
|
|
} |
|
|
|
|
|
|
|
//przesłanie formularza --------------------------------------------------------------------------------
|
|
|
|
//posting a HTML form --------------------------------------------------------------------------------
|
|
|
|
if (isset($_POST['post']) && !isset($_POST['preview']) && !isset($lockv)) |
|
|
|
{ |
|
|
|
$_POST['post'] = trim(htmlspecialchars($this->db->real_escape_string($_POST['post']))); |
|
|
|
|
|
|
|
if ($type == POSTING_NEWTOPIC || $type == POSTING_EDITTOPIC) //walidacja tytułu tematu (add, edit)
|
|
|
|
{ |
|
|
|
$_POST['topic'] = trim(strip_tags($this->db->real_escape_string($_POST['topic']))); |
|
|
|
$_POST['topic'] = trim(htmlspecialchars($this->db->real_escape_string($_POST['topic']))); |
|
|
|
|
|
|
|
if (strlen($_POST['topic']) < 3) |
|
|
|
$msg .= 'Topic title is too short (min 3 characters)<br>'; |
|
|
@ -482,24 +481,23 @@ class MainController extends Controller |
|
|
|
{ |
|
|
|
case POSTING_NEWTOPIC: |
|
|
|
case POSTING_REPLY: |
|
|
|
$_POST['post'] = (isset($_POST['post'])) ? $_POST['post'] : ''; |
|
|
|
$_POST['post'] = (isset($_POST['post'])) ? stripslashes($_POST['post']) : ''; |
|
|
|
break; |
|
|
|
case POSTING_EDITTOPIC: |
|
|
|
$_POST['post'] = (isset($_POST['post'])) ? $_POST['post'] : $p['content']; |
|
|
|
$_POST['topic'] = (isset($_POST['topic'])) ? $_POST['topic'] : $t['topic_title']; |
|
|
|
$_POST['post'] = (isset($_POST['post'])) ? stripslashes($_POST['post']) : $p['content']; |
|
|
|
$_POST['topic'] = (isset($_POST['topic'])) ? stripslashes($_POST['topic']) : $t['topic_title']; |
|
|
|
break; |
|
|
|
case POSTING_EDIT: |
|
|
|
$_POST['post'] = (isset($_POST['post'])) ? $_POST['post'] : $p['content']; |
|
|
|
$_POST['post'] = (isset($_POST['post'])) ? stripslashes($_POST['post']) : $p['content']; |
|
|
|
break; |
|
|
|
|
|
|
|
case POSTING_QUOTE: |
|
|
|
$quote = ($qp['nick'] != null) ? '='.$qp['nick'] : ''; |
|
|
|
$_POST['post'] = (isset($_POST['post'])) ? $_POST['post'] : '[quote'.$quote.']'.$qp['content'].'[/quote]'; |
|
|
|
break; |
|
|
|
|
|
|
|
$_POST['post'] = (isset($_POST['post'])) ? stripslashes($_POST['post']) : '[quote'.$quote.']'.$qp['content'].'[/quote]'; |
|
|
|
break; |
|
|
|
} |
|
|
|
if ($type == POSTING_NEWTOPIC) |
|
|
|
$_POST['topic'] = (isset($_POST['topic'])) ? $_POST['topic'] : ''; //tylko edycja/tworzenie tematu
|
|
|
|
$_POST['topic'] = (isset($_POST['topic'])) ? stripslashes($_POST['topic']) : ''; |
|
|
|
|
|
|
|
$this->getView('MainView')->putExistingModel('PostsModel', $this->getModel('PostsModel')); |
|
|
|
$this->getView('MainView')->putExistingModel('ForumsModel', $this->getModel('ForumsModel')); |
|
|
@ -550,13 +548,13 @@ class MainController extends Controller |
|
|
|
if (isset($_POST['nick'], $_POST['passwd'], $_POST['passwd_confirm'], $_POST['email'])) |
|
|
|
{ |
|
|
|
//secure pools
|
|
|
|
$_POST['nick'] = trim(strip_tags($this->db->real_escape_string($_POST['nick']))); |
|
|
|
$_POST['passwd_old'] = trim(strip_tags($_POST['passwd_old'])); |
|
|
|
$_POST['passwd'] = trim(strip_tags($_POST['passwd'])); |
|
|
|
$_POST['passwd_confirm'] = trim(strip_tags($_POST['passwd_confirm'])); |
|
|
|
$_POST['nick'] = trim(htmlspecialchars($this->db->real_escape_string($_POST['nick']))); |
|
|
|
$_POST['passwd_old'] = trim($_POST['passwd_old']); |
|
|
|
$_POST['passwd'] = trim($_POST['passwd']); |
|
|
|
$_POST['passwd_confirm'] = trim($_POST['passwd_confirm']); |
|
|
|
$_POST['email'] = trim(strip_tags($this->db->real_escape_string($_POST['email']))); |
|
|
|
$_POST['location'] = trim(strip_tags($this->db->real_escape_string($_POST['location']))); |
|
|
|
$_POST['signature'] = trim(strip_tags($this->db->real_escape_string($_POST['signature']))); |
|
|
|
$_POST['location'] = trim(htmlspecialchars($this->db->real_escape_string($_POST['location']))); |
|
|
|
$_POST['signature'] = trim(htmlspecialchars($this->db->real_escape_string($_POST['signature']))); |
|
|
|
|
|
|
|
if ($_POST['email'] != $user_info['email'] || $_POST['passwd'] != '') |
|
|
|
{ |
|
|
@ -621,10 +619,10 @@ class MainController extends Controller |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
$_POST['nick'] = (isset($_POST['nick'])) ? $_POST['nick'] : $user_info['nick']; |
|
|
|
$_POST['email'] = (isset($_POST['email'])) ? $_POST['email'] : $user_info['email']; |
|
|
|
$_POST['location'] = (isset($_POST['location'])) ? $_POST['location'] : $user_info['location']; |
|
|
|
$_POST['signature'] = (isset($_POST['signature'])) ? $_POST['signature'] : $user_info['signature']; |
|
|
|
$_POST['nick'] = (isset($_POST['nick'])) ? stripslashes($_POST['nick']) : $user_info['nick']; |
|
|
|
$_POST['email'] = (isset($_POST['email'])) ? stripslashes($_POST['email']) : $user_info['email']; |
|
|
|
$_POST['location'] = (isset($_POST['location'])) ? stripslashes($_POST['location']) : $user_info['location']; |
|
|
|
$_POST['signature'] = (isset($_POST['signature'])) ? stripslashes($_POST['signature']) : $user_info['signature']; |
|
|
|
|
|
|
|
$this->getView('MainView')->putExistingModel('UsersModel', $this->getModel('UsersModel')); |
|
|
|
|
|
|
@ -659,7 +657,7 @@ class MainController extends Controller |
|
|
|
{ |
|
|
|
//secure pools
|
|
|
|
$_POST['nick'] = trim(strip_tags($this->db->real_escape_string($_POST['nick']))); |
|
|
|
$_POST['passwd'] = $this->getModel('UsersModel')->generatePasswordHash($_POST['nick'], trim(strip_tags($this->db->real_escape_string($_POST['passwd'])))); |
|
|
|
$_POST['passwd'] = $this->getModel('UsersModel')->generatePasswordHash($_POST['nick'], trim($this->db->real_escape_string($_POST['passwd']))); |
|
|
|
|
|
|
|
$userinfo = $this->getModel('SessionModel')->tryGetUser($_POST['nick'], $_POST['passwd']); |
|
|
|
|
|
|
@ -684,7 +682,7 @@ class MainController extends Controller |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
$_POST['nick'] = (isset($_POST['nick'])) ? $_POST['nick'] : ''; |
|
|
|
$_POST['nick'] = (isset($_POST['nick'])) ? stripslashes($_POST['nick']) : ''; |
|
|
|
if (!isset($lockv)) |
|
|
|
$this->getView('MainView')->login_form($msg); |
|
|
|
} |
|
|
@ -702,8 +700,8 @@ class MainController extends Controller |
|
|
|
{ |
|
|
|
//secure pools
|
|
|
|
$_POST['nick'] = trim(strip_tags($this->db->real_escape_string($_POST['nick']))); |
|
|
|
$_POST['passwd'] = trim(strip_tags($_POST['passwd'])); |
|
|
|
$_POST['passwd_confirm'] = trim(strip_tags($_POST['passwd_confirm'])); |
|
|
|
$_POST['passwd'] = trim($_POST['passwd']); |
|
|
|
$_POST['passwd_confirm'] = trim($_POST['passwd_confirm']); |
|
|
|
$_POST['email'] = trim(strip_tags($this->db->real_escape_string($_POST['email']))); |
|
|
|
|
|
|
|
if (strlen($_POST['nick']) < 3) |
|
|
@ -729,8 +727,8 @@ class MainController extends Controller |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
$_POST['nick'] = (isset($_POST['nick'])) ? $_POST['nick'] : ''; |
|
|
|
$_POST['email'] = (isset($_POST['email'])) ? $_POST['email'] : ''; |
|
|
|
$_POST['nick'] = (isset($_POST['nick'])) ? stripslashes($_POST['nick']) : ''; |
|
|
|
$_POST['email'] = (isset($_POST['email'])) ? stripslashes($_POST['email']) : ''; |
|
|
|
|
|
|
|
if (!isset($lockv)) |
|
|
|
$this->getView('MainView')->register_form($msg); |
|
|
@ -750,5 +748,4 @@ class MainController extends Controller |
|
|
|
echo 'false'; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
?>
|