commit 12cd5888c5329224185c02a0b2bec271fca1e05c Author: PioDer Date: Sat Feb 14 12:01:53 2015 +0100 initial commit with snapshot 20140213 diff --git a/config.php b/config.php new file mode 100644 index 0000000..d738c18 --- /dev/null +++ b/config.php @@ -0,0 +1,17 @@ + diff --git a/images/avatars/11.jpg b/images/avatars/11.jpg new file mode 100644 index 0000000..9e12b74 Binary files /dev/null and b/images/avatars/11.jpg differ diff --git a/images/avatars/6.jpg b/images/avatars/6.jpg new file mode 100644 index 0000000..9e12b74 Binary files /dev/null and b/images/avatars/6.jpg differ diff --git a/images/smiles/big_smile.gif b/images/smiles/big_smile.gif new file mode 100644 index 0000000..ad04031 Binary files /dev/null and b/images/smiles/big_smile.gif differ diff --git a/images/smiles/cool.gif b/images/smiles/cool.gif new file mode 100644 index 0000000..9db001f Binary files /dev/null and b/images/smiles/cool.gif differ diff --git a/images/smiles/cry.png b/images/smiles/cry.png new file mode 100644 index 0000000..c0f8ee6 Binary files /dev/null and b/images/smiles/cry.png differ diff --git a/images/smiles/curve.gif b/images/smiles/curve.gif new file mode 100644 index 0000000..294aac2 Binary files /dev/null and b/images/smiles/curve.gif differ diff --git a/images/smiles/evil.gif b/images/smiles/evil.gif new file mode 100644 index 0000000..bd42ed2 Binary files /dev/null and b/images/smiles/evil.gif differ diff --git a/images/smiles/exclaim.gif b/images/smiles/exclaim.gif new file mode 100644 index 0000000..6e95b7d Binary files /dev/null and b/images/smiles/exclaim.gif differ diff --git a/images/smiles/lol.gif b/images/smiles/lol.gif new file mode 100644 index 0000000..04e8695 Binary files /dev/null and b/images/smiles/lol.gif differ diff --git a/images/smiles/mad.gif b/images/smiles/mad.gif new file mode 100644 index 0000000..e68c5c5 Binary files /dev/null and b/images/smiles/mad.gif differ diff --git a/images/smiles/neutral.gif b/images/smiles/neutral.gif new file mode 100644 index 0000000..99a4a0f Binary files /dev/null and b/images/smiles/neutral.gif differ diff --git a/images/smiles/redface.gif b/images/smiles/redface.gif new file mode 100644 index 0000000..7b213d2 Binary files /dev/null and b/images/smiles/redface.gif differ diff --git a/images/smiles/roll.gif b/images/smiles/roll.gif new file mode 100644 index 0000000..def8a49 Binary files /dev/null and b/images/smiles/roll.gif differ diff --git a/images/smiles/sad.gif b/images/smiles/sad.gif new file mode 100644 index 0000000..6aca310 Binary files /dev/null and b/images/smiles/sad.gif differ diff --git a/images/smiles/smile.gif b/images/smiles/smile.gif new file mode 100644 index 0000000..6dbb1e5 Binary files /dev/null and b/images/smiles/smile.gif differ diff --git a/images/smiles/tongue.gif b/images/smiles/tongue.gif new file mode 100644 index 0000000..fe77df2 Binary files /dev/null and b/images/smiles/tongue.gif differ diff --git a/images/smiles/wink.gif b/images/smiles/wink.gif new file mode 100644 index 0000000..9cb7810 Binary files /dev/null and b/images/smiles/wink.gif differ diff --git a/images/smiles/yikes.gif b/images/smiles/yikes.gif new file mode 100644 index 0000000..1bb07ba Binary files /dev/null and b/images/smiles/yikes.gif differ diff --git a/inc/askModel.class.php b/inc/askModel.class.php new file mode 100644 index 0000000..00e6e11 --- /dev/null +++ b/inc/askModel.class.php @@ -0,0 +1,34 @@ +models)) //realizowany singleton + { + require_once('./inc/models/'.$model.'.class.php'); + $this->models[$model] = new $model($this->db); + } + else + { + throw new Exception('Could not load selected model: '.$model); + } + } + + function getModel($model) + { + if (array_key_exists($model, $this->models)) + return $this->models[$model]; + else + throw new Exception('Could not get selected model: '.$model); + } + + function putExistingModel($model, &$model_ptr) + { + $this->models[$model] = $model_ptr; + } +} + +?> \ No newline at end of file diff --git a/inc/bbcode.php b/inc/bbcode.php new file mode 100644 index 0000000..7e6a4c0 --- /dev/null +++ b/inc/bbcode.php @@ -0,0 +1,111 @@ +', # :) + ':|', # :| + ':(', # :( + ':(', # ;( + ':D', # :D + ':o', # :o + ';)', # ;) + ':p', # :p + ':/', # :curve: + ':!:', # :!: + ':lol:', # :lol: + ':evil:', # :evil: + ':mad:', # :mad: + ':roll:', # :roll: + ':cool:', # :cool: + ':redface:', # :redface: + '\1', # [b] + '\1', # [i] + '\1', # [u] + '\1', # [s] + '

\1

', # [center] + '\3', # [url=] + '\1', # [url] + '\2', # [color] (hex) + '\2', # [color] (text) + '', # [list] + '
  • \1
  • ', # [*] + '
    Quote:
    \1
    ', # [quote] + '
    \1 wrote:
    \2
    ', # [quote=] + '
    Code:
    \1
    ', # [code] + '
    ', # \n + '', # \r + '\\1\\2', + ); + + 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); +} +?> \ No newline at end of file diff --git a/inc/constants.php b/inc/constants.php new file mode 100644 index 0000000..dac2914 --- /dev/null +++ b/inc/constants.php @@ -0,0 +1,35 @@ + \ No newline at end of file diff --git a/inc/controller.class.php b/inc/controller.class.php new file mode 100644 index 0000000..0d872ee --- /dev/null +++ b/inc/controller.class.php @@ -0,0 +1,53 @@ +$m($arg); + else + $this->forward('index.php'); + } + + public function __construct(&$db) + { + $this->db = $db; + } + + public function forward($address) + { + header('Location: ' . $address); + } + + + public function loadView($view) + { + if (file_exists('./inc/views/'.$view.'.class.php') && !array_key_exists($view, $this->views)) + { + require_once('./inc/views/'.$view.'.class.php'); + $this->views[$view] = new $view($this->db); + } + else + { + throw new Exception('Could not load selected view: '.$view); + } + } + + public function getView($view) + { + if (array_key_exists($view, $this->views)) + return $this->views[$view]; + else + throw new Exception('Could not get selected view: '.$widok); + } +} + +?> \ No newline at end of file diff --git a/inc/controllers/AdminController.class.php b/inc/controllers/AdminController.class.php new file mode 100644 index 0000000..4a1821b --- /dev/null +++ b/inc/controllers/AdminController.class.php @@ -0,0 +1,605 @@ +main(); + } + + private function loadDependencies() // zależności (sesje itp) + { + $this->loadModel('SessionModel'); //aktywacja sesji + $this->loadModel('ConfigModel'); //konfiguracja ogólna skryptu + $this->loadView('MainView'); + $this->getView('MainView')->putExistingModel('SessionModel', $this->getModel('SessionModel')); + $this->getView('MainView')->putExistingModel('ConfigModel', $this->getModel('ConfigModel')); + + if ($_SERVER['REQUEST_SCHEME'] == 'http') + $this->forward('https://'.$_SERVER['SERVER_NAME'].$_SERVER['REQUEST_URI']); + + if (!$this->getModel('SessionModel')->isLogged()) + { + $this->getView('MainView')->forum_message('You are not logged.', 'index.php?mode=login', true); + $lockv = true; + } + + if ($this->getModel('SessionModel')->getRank() == RANK_USER && !isset($lockv)) + { + $this->getView('MainView')->forum_message('You are not admin', 'index.php'); + $lockv = true; + } + + if (!isset($lockv)) + return true; + else + return false; + } + + public function main() + { + if ($this->loadDependencies()) + { + $this->getView('MainView')->admin_main(); + } + } + + public function eduser() + { + if ($this->loadDependencies()) + { + $this->loadModel('UsersModel'); + $user_info = $this->getModel('UsersModel')->getUserInformation($_GET['id'], true); + + if ($user_info == null) + { + $this->getView('MainView')->forum_message('User does not exist!', 'index.php?mode=admin&submode=users'); + $lockv = true; + } + else + { + $msg = ''; + 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'] = trim(strip_tags($_POST['passwd'])); + $_POST['passwd_confirm'] = trim(strip_tags($_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['user_rank'] = trim(strip_tags($this->db->real_escape_string($_POST['user_rank']))); + + if ($_POST['passwd'] != '') + { + if (strlen($_POST['passwd']) < 8) + $msg .= 'Password is too short (min 8 characters)
    '; + + if ($_POST['passwd'] != $_POST['passwd_confirm']) + $msg .= 'Password do not match!
    '; + } + + if ($_GET['id'] == $this->getModel('SessionModel')->getID() && $_POST['user_rank'] != RANK_ADMIN) + { + $msg .= 'You cannot set rank for your profile
    '; + $_POST['user_rank'] = RANK_ADMIN; + } + + if ($this->getModel('UsersModel')->nickExists($_POST['nick']) == true && $_POST['nick'] != $user_info['nick']) + $msg .= 'Nick is in use. Type another one.
    '; + + if (strlen($_POST['nick']) < 3) + $msg .= 'Nick is too short (min 3 characters)
    '; + + if ($_POST['user_rank'] > RANK_ADMIN || $_POST['user_rank'] < RANK_USER) + $msg .= 'Rank is not valid!
    '; + + //check if avatar is uploaded + if ($_FILES['avatar']['tmp_name'] != null) + { + global $allowed_avatars; + $image_size = @getimagesize($_FILES['avatar']['tmp_name']); + + if ($image_size == null) + $msg .= 'Type of uploaded file are not allowed.
    '; + else + if (!in_array($image_size['mime'], $allowed_avatars)) + $msg .= 'Type of uploaded avatar is not supported.
    '; + else + if ($image_size[0] > 120 || $image_size[1] > 150) + $msg .= 'Uploaded avatar is too big (maximum 120x150 px).
    '; + } + + if (!filter_var($_POST['email'], FILTER_VALIDATE_EMAIL)) + $msg .= 'Email is incorrect
    '; + + if ($msg == '') + { + if ($_FILES['avatar']['tmp_name'] != null && !isset($_POST['delete_avatar'])) //change an avatar + { + if ($user_info['avatar'] != '') + unlink('./'.$user_info['avatar']); + + $ext = pathinfo($_FILES['avatar']['name'], PATHINFO_EXTENSION); + $av = 'images/avatars/'.$this->getModel('SessionModel')->getID().'.'.$ext; + move_uploaded_file($_FILES['avatar']['tmp_name'], './'.$av); + } + else + if (isset($_POST['delete_avatar'])) + { + unlink('./'.$user_info['avatar']); + $av = ''; + } + else + $av = $user_info['avatar']; //if new avatar is not set + + if ($_POST['passwd'] != '') + $this->getModel('UsersModel')->changeUserPassword($_GET['id'], sha1($_POST['passwd'])); + + $this->getModel('UsersModel')->changeUserRank($_GET['id'], $_POST['user_rank']); + $this->getModel('UsersModel')->updateUserProfile($_GET['id'], $_POST['nick'], $_POST['email'], $_POST['location'], $_POST['signature'], $av); + $this->getView('MainView')->forum_message('User profile has changed.', 'index.php?mode=admin&submode=users'); + $lockv = true; + + } + } + + $_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['user_rank'] = (isset($_POST['user_rank'])) ? $_POST['user_rank'] : $user_info['rank']; + + $this->getView('MainView')->putExistingModel('UsersModel', $this->getModel('UsersModel')); + + if (!isset($lockv)) + $this->getView('MainView')->edprofile_form($msg, true); + } + } + } + + public function users() + { + if ($this->loadDependencies()) + { + if (isset($_GET['rank'])) + { + switch ($_GET['rank']) + { + case 'admin': + $_GET['rank'] = RANK_ADMIN; + break; + case 'mod': + $_GET['rank'] = RANK_MOD; + break; + case 'user': + $_GET['rank'] = RANK_USER; + break; + default: + $_GET['rank'] = ''; + break; + } + } + else + $_GET['rank'] = ''; + + $_POST['sort_type'] = (isset($_POST['sort_type'])) ? $this->db->real_escape_string($_POST['sort_type']) : 'regdate'; + $allowed_sorting = array('regdate', 'lastvisit', 'nick', 'post_count'); + if (!in_array($_POST['sort_type'], $allowed_sorting)) + $_POST['sort_type'] = ''; + $_POST['sort_desc'] = (isset($_POST['sort_desc'])) ? 'DESC' : 'ASC'; + + $this->getView('MainView')->admin_userlist(); + } + + } + + public function deluser() + { + if ($this->loadDependencies()) + { + $this->loadModel('UsersModel'); + $this->getView('MainView')->putExistingModel('UsersModel', $this->getModel('UsersModel')); + + $_GET['id'] = (isset($_GET['id'])) ? trim(strip_tags($this->db->real_escape_string($_GET['id']))) : 0; + + $user_info = $this->getModel('UsersModel')->getUserInformation($_GET['id']); + if ($user_info == null) + { + $this->getView('MainView')->forum_message('User does not exist!', 'index.php?mode=admin&submode=users'); + $lockv = true; + } + else + { + if ($_GET['id'] == $this->getModel('SessionModel')->getID()) + { + $this->getView('MainView')->forum_message('You cannot delete own profile!', 'index.php?mode=admin&submode=users'); + $lockv = true; + } + } + + + if (isset($_POST['confirmed']) && !isset($lockv)) + { + if (!isset($_POST['rejected'])) + { + $this->getModel('UsersModel')->deleteUser($_GET['id']); + $this->getView('MainView')->forum_message('Profile deleted. Redirecting to users list...', 'index.php?mode=admin&submode=users'); + $lockv = true; + } + else + { + $this->forward('index.php?mode=admin&submode=users'); + } + } + + if (!isset($lockv)) + $this->getView('MainView')->confirm_action('Do you want delete user '.$user_info['nick'].'? This operation cannot undone.'); + } + } + + public function config() + { + if ($this->loadDependencies()) + { + $msg = ''; + + if (isset($_POST['forum_name'], $_POST['forum_desc'])) + { + $_POST['forum_name'] = trim(htmlspecialchars($this->db->real_escape_string($_POST['forum_name']))); + $_POST['forum_desc'] = trim(htmlspecialchars($_POST['forum_desc'])); + + if (strlen($_POST['forum_name']) < 3) + { + $msg .= 'Forum name is too short (min 3 characters)!
    '; + } + + if (strlen($_POST['forum_name']) > 30) + { + $msg .= 'Forum name is too long (max 30 characters)!
    '; + } + + if (strlen($_POST['forum_desc']) > 50) + { + $msg .= 'Forum description is too long (max 50 characters)!
    '; + } + + if ($msg == '') + { + $what = ''; + if ($_POST['forum_name'] != $this->getModel('ConfigModel')->getConf('forum_name')) + $this->getModel('ConfigModel')->updateConf('forum_name', $_POST['forum_name']); + + if ($_POST['forum_desc'] != $this->getModel('ConfigModel')->getConf('forum_desc')) + $this->getModel('ConfigModel')->updateConf('forum_desc', $_POST['forum_desc']); + + $this->getView('MainView')->forum_message('Forum configuration updated. Redirecting...', 'index.php?mode=admin&submode=config'); + $lockv = true; + } + } + + $_POST['forum_name'] = (isset($_POST['forum_name'])) ? $_POST['forum_name'] : $this->getModel('ConfigModel')->getConf('forum_name'); + $_POST['forum_desc'] = (isset($_POST['forum_desc'])) ? $_POST['forum_desc'] : $this->getModel('ConfigModel')->getConf('forum_desc'); + if (!isset($lockv)) + { + $this->getView('MainView')->admin_config($msg); + } + } + } + + public function forums() + { + if ($this->loadDependencies()) + { + $this->getView('MainView')->admin_forums(); + } + } + + public function addcat() + { + if ($this->loadDependencies()) + { + $this->modify_cat('add'); + } + } + + public function edcat() + { + if ($this->loadDependencies()) + { + $this->modify_cat('edit'); + } + } + + public function addforum() + { + if ($this->loadDependencies()) + { + $this->modify_forum('add'); + } + } + + public function edforum() + { + if ($this->loadDependencies()) + { + $this->modify_forum('edit'); + } + } + + public function delforum() + { + if ($this->loadDependencies()) + { + $this->loadModel('ForumsModel'); + $_GET['id'] = (isset($_GET['id'])) ? trim(strip_tags($this->db->real_escape_string($_GET['id']))) : 0; + $forum_info = $this->getModel('ForumsModel')->getForum($_GET['id']); + + if ($forum_info == null) + { + $this->getView('MainView')->forum_message('Forum does not exist!', 'index.php?mode=admin&submode=forums'); + $lockv = true; + } + + if (isset($_POST['confirmed']) && !isset($lockv)) + { + if (!isset($_POST['rejected'])) + { + $this->getModel('ForumsModel')->deleteForum($_GET['id']); + $this->getView('MainView')->forum_message('Forum deleted. Redirecting...', 'index.php?mode=admin&submode=forums'); + $lockv = true; + } + else + $this->forward('index.php?mode=admin&submode=forums'); + } + + if (!isset($lockv)) + $this->getView('MainView')->confirm_action('Do you REALLY want delete forum '.$forum_info['name'].' with ALL CONTENT? This operation cannot undone!'); + } + + } + + public function delcat() + { + if ($this->loadDependencies()) + { + $this->loadModel('ForumsModel'); + $_GET['id'] = (isset($_GET['id'])) ? trim(strip_tags($this->db->real_escape_string($_GET['id']))) : 0; + $cat_info = $this->getModel('ForumsModel')->getCat($_GET['id']); + + if ($cat_info == null) + { + $this->getView('MainView')->forum_message('Category does not exist!', 'index.php?mode=admin&submode=forums'); + $lockv = true; + } + + if (isset($_POST['confirmed']) && !isset($lockv)) + { + if (!isset($_POST['rejected'])) + { + $this->getModel('ForumsModel')->deleteCat($_GET['id']); + $this->getView('MainView')->forum_message('Category deleted. Redirecting...', 'index.php?mode=admin&submode=forums'); + $lockv = true; + } + else + $this->forward('index.php?mode=admin&submode=forums'); + } + + if (!isset($lockv)) + $this->getView('MainView')->confirm_action('Do you REALLY want delete category '.$cat_info['name'].' with ALL FORUMS AND CONTENT? This operation cannot undone!'); + } + + } + + private function modify_cat($m) + { + $msg = ''; + + $this->loadModel('ForumsModel'); + + if ($m == 'edit') + { + $_GET['id'] = (isset($_GET['id'])) ? trim(strip_tags($this->db->real_escape_string($_GET['id']))) : 0; + $cat_info = $this->getModel('ForumsModel')->getCat($_GET['id']); + + if ($cat_info == null) + { + $this->getView('MainView')->forum_message('Category does not exist!', 'index.php?mode=admin&submode=forums'); + $lockv = true; + } + } + + + if (isset($_POST['name']) && !isset($lockv)) + { + $_POST['name'] = trim(htmlspecialchars($this->db->real_escape_string($_POST['name']))); + if (strlen($_POST['name']) < 3) + $msg .= 'Category name is too short (min 3 characters)!
    '; + + if ($msg == '') + { + if ($m == 'add') + { + $this->getModel('ForumsModel')->addCat($_POST['name']); + $this->getView('MainView')->forum_message('Category added. Redirecting...', 'index.php?mode=admin&submode=forums'); + $lockv = true; + } + else + { + $this->getModel('ForumsModel')->changeCat($_GET['id'], $_POST['name']); + $this->getView('MainView')->forum_message('Category updated. Redirecting...', 'index.php?mode=admin&submode=forums'); + $lockv = true; + } + } + } + + if (!isset($lockv)) + { + if ($m == 'add') + $_POST['name'] = (isset($_POST['name'])) ? $_POST['name'] : ''; + else + $_POST['name'] = (isset($_POST['name'])) ? $_POST['name'] : $cat_info['name']; + + $this->getView('MainView')->putExistingModel('ForumsModel', $this->getModel('ForumsModel')); + $this->getView('MainView')->admin_cat_form($msg, $m); + } + } + + private function modify_forum($m) + { + $msg = ''; + + $this->loadModel('ForumsModel'); + + if ($m == 'edit') + { + $_GET['id'] = (isset($_GET['id'])) ? trim(strip_tags($this->db->real_escape_string($_GET['id']))) : 0; + $forum_info = $this->getModel('ForumsModel')->getForum($_GET['id']); + + if ($forum_info == null) + { + $this->getView('MainView')->forum_message('Forum does not exist!', 'index.php?mode=admin&submode=forums'); + $lockv = true; + } + } + + + if (isset($_POST['name']) && !isset($lockv)) + { + $_POST['name'] = trim(htmlspecialchars($this->db->real_escape_string($_POST['name']))); + $_POST['desc'] = trim(htmlspecialchars($this->db->real_escape_string($_POST['desc']))); + $_POST['category_id'] = trim(strip_tags($this->db->real_escape_string($_POST['category_id']))); + $_POST['locked'] = trim(strip_tags($this->db->real_escape_string($_POST['locked']))); + $_POST['locked'] = ($_POST['locked'] == true) ? true : false; + + if (strlen($_POST['name']) < 3) + $msg .= 'Forum name is too short (min 3 characters)!
    '; + + $c = $this->getModel('ForumsModel')->getCat($_POST['category_id']); + + if ($c == null) + $msg .= 'Category does not exist!
    '; + + if ($msg == '') + { + if ($m == 'add') + { + $this->getModel('ForumsModel')->addForum($_POST['name'], $_POST['desc'], $_POST['category_id'], $_POST['locked']); + $this->getView('MainView')->forum_message('Forum added. Redirecting...', 'index.php?mode=admin&submode=forums'); + $lockv = true; + } + else + { + $this->getModel('ForumsModel')->changeForum($_GET['id'], $_POST['name'], $_POST['desc'], $_POST['category_id'], $_POST['locked']); + $this->getView('MainView')->forum_message('Forum updated. Redirecting...', 'index.php?mode=admin&submode=forums'); + $lockv = true; + } + } + } + + if (!isset($lockv)) + { + if ($m == 'add') + { + $_POST['name'] = (isset($_POST['name'])) ? $_POST['name'] : ''; + $_POST['desc'] = (isset($_POST['desc'])) ? $_POST['desc'] : ''; + $_POST['category_id'] = (isset($_POST['category_id'])) ? $_POST['category_id'] : ''; + $_POST['locked'] = (isset($_POST['locked'])) ? $_POST['locked'] : ''; + } + else + { + $_POST['name'] = (isset($_POST['name'])) ? $_POST['name'] : $forum_info['name']; + $_POST['desc'] = (isset($_POST['desc'])) ? $_POST['desc'] : $forum_info['desc']; + $_POST['category_id'] = (isset($_POST['category_id'])) ? $_POST['category_id'] : $forum_info['category_id']; + $_POST['locked'] = (isset($_POST['locked'])) ? $_POST['locked'] : $forum_info['locked']; + } + + $this->getView('MainView')->putExistingModel('ForumsModel', $this->getModel('ForumsModel')); + $this->getView('MainView')->admin_forum_form($msg, $m); + } + } + + public function banlist() + { + if ($this->loadDependencies()) + $this->getView('MainView')->admin_banlist(); + } + + public function delban() + { + if ($this->loadDependencies()) + { + $this->loadModel('BansModel'); + $_GET['id'] = (isset($_GET['id'])) ? trim(strip_tags($this->db->real_escape_string($_GET['id']))) : 0; + $ban_info = $this->getModel('BansModel')->getBan($_GET['id']); + + if ($ban_info == null) + { + $this->getView('MainView')->forum_message('Ban does not exist!', 'index.php?mode=admin&submode=banlist'); + $lockv = true; + } + + if (isset($_POST['confirmed']) && !isset($lockv)) + { + if (!isset($_POST['rejected'])) + { + $this->getModel('BansModel')->deleteBan($_GET['id']); + $this->getView('MainView')->forum_message('Ban deleted. Redirecting...', 'index.php?mode=admin&submode=banlist'); + $lockv = true; + } + else + $this->forward('index.php?mode=admin&submode=banlist'); + } + + if (!isset($lockv)) + $this->getView('MainView')->confirm_action('Do you want delete ban for user '.$ban_info['nick'].'?'); + } + + } + + public function addban() + { + if ($this->loadDependencies()) + { + $msg = ''; + + $this->loadModel('BansModel'); + $this->loadModel('UsersModel'); + + if (isset($_POST['user_id'], $_POST['reason'])) + { + $_POST['user_id'] = trim(strip_tags($this->db->real_escape_string($_POST['user_id']))); + $_POST['reason'] = trim(strip_tags($this->db->real_escape_string($_POST['reason']))); + + if ($_POST['user_id'] == $this->getModel('SessionModel')->getID()) + $msg .= 'You cannot ban your profile!
    '; + + if ($this->getModel('BansModel')->getUserBan($_POST['user_id']) != null) + $msg .= 'This user has already been banned!
    '; + + if ($this->getModel('UsersModel')->getUserInformation($_POST['user_id']) == null) + $msg .= 'User does not exist!
    '; + + if ($msg == '') + { + $this->getModel('BansModel')->addBan($_POST['user_id'], $_POST['reason']); + $this->getView('MainView')->forum_message('Ban added. Redirecting...', 'index.php?mode=admin&submode=banlist'); + $lockv = true; + } + } + + if (!isset($lockv)) + { + $_POST['user_id'] = (isset($_POST['user_id'])) ? $_POST['user_id'] : ''; + $_POST['reason'] = (isset($_POST['reason'])) ? $_POST['reason'] : ''; + + $this->getView('MainView')->admin_ban_form($msg); + } + } + } +} + +?> \ No newline at end of file diff --git a/inc/controllers/MainController.class.php b/inc/controllers/MainController.class.php new file mode 100644 index 0000000..386bfbb --- /dev/null +++ b/inc/controllers/MainController.class.php @@ -0,0 +1,724 @@ +main(); + } + + private function loadDependencies() // zależności (sesje itp) + { + $this->loadModel('SessionModel'); //aktywacja sesji + $this->loadModel('ConfigModel'); //konfiguracja ogólna skryptu + $this->loadView('MainView'); + $this->getView('MainView')->putExistingModel('SessionModel', $this->getModel('SessionModel')); + $this->getView('MainView')->putExistingModel('ConfigModel', $this->getModel('ConfigModel')); + } + + public function main() + { + $this->loadDependencies(); + + $this->getView('MainView')->main(); + } + + public function viewforum() + { + $this->loadDependencies(); + + $this->loadModel('ForumsModel'); + + $_GET['id'] = (isset($_GET['id'])) ? trim(strip_tags($this->db->real_escape_string($_GET['id']))) : 0; + + $f = $this->getModel('ForumsModel')->getForum($_GET['id']); + + if ($f == null) + $this->getView('MainView')->forum_message('Forum does not exist!', 'index.php'); + else + { + $this->getView('MainView')->putExistingModel('ForumsModel', $this->getModel('ForumsModel')); + $this->getView('MainView')->viewforum(); + } + } + + public function userlist() + { + $this->loadDependencies(); + + if (isset($_GET['rank'])) + { + switch ($_GET['rank']) + { + case 'admin': + $_GET['rank'] = RANK_ADMIN; + break; + case 'mod': + $_GET['rank'] = RANK_MOD; + break; + case 'user': + $_GET['rank'] = RANK_USER; + break; + default: + $_GET['rank'] = ''; + break; + } + } + else + $_GET['rank'] = ''; + + $_POST['sort_type'] = (isset($_POST['sort_type'])) ? $this->db->real_escape_string($_POST['sort_type']) : 'regdate'; + $allowed_sorting = array('regdate', 'lastvisit', 'nick', 'post_count'); + if (!in_array($_POST['sort_type'], $allowed_sorting)) + $_POST['sort_type'] = ''; + $_POST['sort_desc'] = (isset($_POST['sort_desc'])) ? 'DESC' : 'ASC'; + + $this->getView('MainView')->userlist(); + + } + + public function viewtopic() + { + $this->loadDependencies(); + + $this->loadModel('PostsModel'); + + $_GET['id'] = (isset($_GET['id'])) ? trim(strip_tags($this->db->real_escape_string($_GET['id']))) : 0; + + $t = $this->getModel('PostsModel')->getTopic($_GET['id']); + + if ($t == null) + $this->getView('MainView')->forum_message('Topic does not exist!', 'index.php'); + else + { + $this->getView('MainView')->putExistingModel('PostsModel', $this->getModel('PostsModel')); + $this->getView('MainView')->viewtopic(); + } + } + + public function newtopic() + { + $this->posting(POSTING_NEWTOPIC); + } + + public function reply() + { + $this->posting(POSTING_REPLY); + } + + public function editpost() + { + $this->posting(POSTING_EDIT); + } + + public function quote() + { + $this->posting(POSTING_QUOTE); + } + + public function moderate() + { + $this->loadDependencies(); + $this->loadModel('PostsModel'); + $this->loadModel('ForumsModel'); + + $_GET['id'] = (isset($_GET['id'])) ? trim(strip_tags($this->db->real_escape_string($_GET['id']))) : 0; + $_GET['submode'] = (isset($_GET['submode'])) ? trim(strip_tags($this->db->real_escape_string($_GET['submode']))) : 0; + + if (!$this->getModel('SessionModel')->isLogged()) + { + $this->getView('MainView')->forum_message('You are not logged.', 'index.php?mode=login'); + $lockv = true; + } + + if ($this->getModel('SessionModel')->getRank() == RANK_USER && !isset($lockv)) + { + $this->getView('MainView')->forum_message('Only mods have access to this menu', 'index.php'); + $lockv = true; + } + + //sprawdź czy wątek/post istnieje + + if (!isset($lockv)) + switch($_GET['submode']) + { + case 'deletetopic': + case 'locktopic': + case 'movetopic': + $t = $this->getModel('PostsModel')->getTopic($_GET['id']); + + if ($t == null) + { + $this->getView('MainView')->forum_message('Topic does not exist!', 'index.php'); + $lockv = true; + } + break; + + case 'deletepost': + $p = $this->getModel('PostsModel')->getPost($_GET['id']); + if ($p == null) + { + $this->getView('MainView')->forum_message('Post does not exist!', 'index.php'); + $lockv = true; + } + else + { + $t = $this->getModel('PostsModel')->getTopic($p['topic_id']); + + if ($t['post_count'] == 1) + { + $this->getView('MainView')->forum_message('If topic has only one post, use delete topic option.', 'index.php?mode=viewtopic&id='.$p['topic_id'], 3); + $lockv = true; + } + } + + break; + + default: + $this->getView('MainView')->forum_message('Invalid mode', 'index.php'); + $lockv = true; + break; + } + + //wysyłanie formularza + if (isset($_POST['confirmed']) && !isset($lockv)) + { + if (!isset($_POST['rejected'])) + { + switch($_GET['submode']) + { + case 'deletepost': + $this->getModel('PostsModel')->deletePost($_GET['id']); + $this->getView('MainView')->forum_message('Post deleted. Redirecting...', 'index.php?mode=viewtopic&id='.$p['topic_id']); + $lockv = true; + break; + + case 'deletetopic': + $this->getModel('PostsModel')->deleteTopic($_GET['id']); + $this->getView('MainView')->forum_message('Topic deleted. Redirecting...', 'index.php?mode=viewforum&id='.$t['forum_id']); + $lockv = true; + break; + + case 'locktopic': + if ($t['topic_locked'] == false) + { + $this->getModel('PostsModel')->lockTopic($_GET['id']); + $this->getView('MainView')->forum_message('Topic locked. Redirecting...', 'index.php?mode=viewtopic&id='.$_GET['id']); + } + else + { + $this->getModel('PostsModel')->lockTopic($_GET['id'], false); + $this->getView('MainView')->forum_message('Topic unlocked. Redirecting...', 'index.php?mode=viewtopic&id='.$_GET['id']); + } + $lockv = true; + break; + case 'movetopic': + 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']); + else + { + $this->getModel('PostsModel')->moveTopic($_GET['id'], $_POST['forum_id']); + $this->getView('MainView')->forum_message('Topic moved. Redirecting...', 'index.php?mode=viewtopic&id='.$_GET['id']); + } + $lockv = true; + break; + + } + } + else + { + switch ($_GET['submode']) + { + case 'deletetopic': + case 'locktopic': + case 'movetopic': + $this->forward('index.php?mode=viewtopic&id='.$_GET['id']); + break; + case 'deletepost': + $this->forward('index.php?mode=viewtopic&id='.$p['topic_id']); + } + } + } + + if (!isset($lockv)) + switch($_GET['submode']) + { + case 'deletepost': + $this->getView('MainView')->confirm_action('Do you really want delete post #'.$_GET['id'].'?'); + break; + case 'deletetopic': + $this->getView('MainView')->confirm_action('Do you really want delete topic #'.$_GET['id'].' with all posts? This operation cannot undone.'); + break; + + case 'locktopic': + if ($t['topic_locked'] == false) + $this->getView('MainView')->confirm_action('Do you want lock topic #'.$_GET['id'].'?'); + else + $this->getView('MainView')->confirm_action('Do you want unlock topic #'.$_GET['id'].'?'); + break; + case 'movetopic': + $this->getView('MainView')->putExistingModel('PostsModel', $this->getModel('PostsModel')); + $this->getView('MainView')->move_topic(); + break; + } + } + + + public function posting($type) + { + $this->loadDependencies(); + $msg = ''; + + $this->loadModel('PostsModel'); + $this->loadModel('ForumsModel'); + + $_GET['id'] = (isset($_GET['id'])) ? trim(strip_tags($this->db->real_escape_string($_GET['id']))) : 0; + + if (!$this->getModel('SessionModel')->isLogged()) + { + $this->getView('MainView')->forum_message('You are not logged.', 'index.php?mode=login'); + $lockv = true; + } + + //SPRAWDZANIE CZY TEMAT/FORUM ISTNIEJE I CZY NIE ZABLOKOWANE + if (!isset($lockv)) + switch($type) + { + case POSTING_NEWTOPIC: //sprawdzenie czy forum istnieje i czy nie zablokowane + $f = $this->getModel('ForumsModel')->getForum($_GET['id']); + + if ($f == null) + { + $this->getView('MainView')->forum_message('Forum does not exist!', 'index.php'); + $lockv = true; + } + else + if ($f['locked'] == true) + { + $this->getView('MainView')->forum_message('Forum is locked', 'index.php?mode=viewforum&id='.$_GET['id']); + $lockv = true; + } + break; + + case POSTING_REPLY: //sprawdzenie czy temat istnieje + case POSTING_QUOTE: + $t = $this->getModel('PostsModel')->getTopic($_GET['id']); + + if ($t == null) + { + $this->getView('MainView')->forum_message('Topic does not exist!', 'index.php'); + $lockv = true; + } + else + { + 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']); + $lockv = true; + } + + 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']); + $lockv = true; + } + + if ($type == POSTING_QUOTE) + { + $_GET['q'] = (isset($_GET['q'])) ? trim(strip_tags($this->db->real_escape_string($_GET['q']))) : 0; + $qp = $this->getModel('PostsModel')->getPost($_GET['q']); + + if ($qp == null) + { + $this->getView('MainView')->forum_message('Invalid quoted post', 'index.php?mode=viewtopic&id='.$t['topic_id']); + $lockv = true; + } + else + { + if ($qp['topic_id'] != $_GET['id']) + { + $this->getView('MainView')->forum_message('Invalid quoted post', 'index.php?mode=viewtopic&id='.$t['topic_id']); + $lockv = true; + } + } + } + } + break; + + case POSTING_EDIT: + $p = $this->getModel('PostsModel')->getPost($_GET['id']); + + if ($p == null) + { + $this->getView('MainView')->forum_message('Post does not exist!', 'index.php'); + $lockv = true; + } + else + { + $t = $this->getModel('PostsModel')->getTopic($p['topic_id']); + 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']); + $lockv = true; + } + 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']); + $lockv = true; + } + + //sprawdzić czy edycja tematu + // i ustawić opdowiednie parametry $type = POSTING_EDITTOPIC + $first = $this->getModel('PostsModel')->getFirstPost($t['topic_id']); + + if ($first['post_id'] == $_GET['id']) + $type = POSTING_EDITTOPIC; + + 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']); + $lockv = true; + } + } + + break; + } + + //przesłanie formularza -------------------------------------------------------------------------------- + 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']))); + + if (strlen($_POST['topic']) < 3) + $msg .= 'Topic title is too short (min 3 characters)
    '; + } + + if (strlen($_POST['post']) < 3) + $msg .= 'Post content is too short (min 3 characters)
    '; + + if ($msg == null) + { + switch ($type) + { + case POSTING_NEWTOPIC: //akcje dodania nowego tematu + + $topic_id = $this->getModel('PostsModel')->addTopic($_POST['topic'], $_POST['post'], $_GET['id'], $this->getModel('SessionModel')->getID()); + if ($topic_id != null) + { + $this->getView('MainView')->forum_message('Topic created, Redirecting...', 'index.php?mode=viewtopic&id='.$topic_id); + $lockv = true; + } + else + $msg .= 'Something went wrong, try again.'; + break; + case POSTING_EDITTOPIC: + case POSTING_EDIT: + $this->getModel('PostsModel')->changePost($_GET['id'], $_POST['post']); + + if ($type == POSTING_EDITTOPIC) + $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']); + $lockv = true; + break; + + case POSTING_QUOTE: + case POSTING_REPLY: + $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']); + $lockv = true; + break; + } + } + } + + if (!isset($lockv)) + { + switch ($type) + { + case POSTING_NEWTOPIC: + case POSTING_REPLY: + $_POST['post'] = (isset($_POST['post'])) ? $_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']; + break; + case POSTING_EDIT: + $_POST['post'] = (isset($_POST['post'])) ? $_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; + + } + if ($type == POSTING_NEWTOPIC) + $_POST['topic'] = (isset($_POST['topic'])) ? $_POST['topic'] : ''; //tylko edycja/tworzenie tematu + + $this->getView('MainView')->putExistingModel('PostsModel', $this->getModel('PostsModel')); + $this->getView('MainView')->putExistingModel('ForumsModel', $this->getModel('ForumsModel')); + + $this->getView('MainView')->posting_form($type, $msg); + } + } + + public function myprofile() + { + $this->loadDependencies(); + if (!$this->getModel('SessionModel')->isLogged()) + $this->forward('index.php'); + else + $this->forward('index.php?mode=viewprofile&id='.$this->getModel('SessionModel')->getID()); + } + + public function viewprofile() + { + $this->loadDependencies(); + + $this->loadModel('UsersModel'); + $this->getView('MainView')->putExistingModel('UsersModel', $this->getModel('UsersModel')); + + $_GET['id'] = (isset($_GET['id'])) ? trim(strip_tags($this->db->real_escape_string($_GET['id']))) : 0; + + if ($this->getModel('UsersModel')->getUserInformation($_GET['id']) == null) + $this->getView('MainView')->forum_message('User does not exist!', 'index.php'); + else + { + //$this->getView('MainView')->putExistingModel('PostsModel', $this->getModel('PostsModel')); + $this->getView('MainView')->viewprofile(); + } + } + + public function editprofile() + { + $this->loadDependencies(); + $this->loadModel('UsersModel'); + $user_info = $this->getModel('UsersModel')->getUserInformation($this->getModel('SessionModel')->getID(), true); + + if (!$this->getModel('SessionModel')->isLogged()) + { + $this->getView('MainView')->forum_message('You are not logged.', 'index.php?mode=login'); + } + else + { + $msg = ''; + 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['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']))); + + if ($_POST['email'] != $user_info['email'] || $_POST['passwd'] != '') + { + if (sha1($_POST['passwd_old']) != $user_info['password']) + $msg .= 'Old password is incorrect!
    '; + } + if ($_POST['passwd'] != '') + { + if (strlen($_POST['passwd']) < 8) + $msg .= 'Password is too short (min 8 characters)
    '; + + if ($_POST['passwd'] != $_POST['passwd_confirm']) + $msg .= 'Password do not match!
    '; + } + + //check if avatar is uploaded + if ($_FILES['avatar']['tmp_name'] != null) + { + global $allowed_avatars; + $image_size = @getimagesize($_FILES['avatar']['tmp_name']); + + if ($image_size == null) + $msg .= 'Type of uploaded file are not allowed.
    '; + else + if (!in_array($image_size['mime'], $allowed_avatars)) + $msg .= 'Type of uploaded avatar is not supported.
    '; + else + if ($image_size[0] > 120 || $image_size[1] > 150) + $msg .= 'Uploaded avatar is too big (maximum 120x150 px).
    '; + } + + if (!filter_var($_POST['email'], FILTER_VALIDATE_EMAIL)) + $msg .= 'Email is incorrect
    '; + + if ($msg == '') + { + if ($_FILES['avatar']['tmp_name'] != null && !isset($_POST['delete_avatar'])) //change an avatar + { + if ($user_info['avatar'] != '') + unlink('./'.$user_info['avatar']); + + $ext = pathinfo($_FILES['avatar']['name'], PATHINFO_EXTENSION); + $av = 'images/avatars/'.$this->getModel('SessionModel')->getID().'.'.$ext; + move_uploaded_file($_FILES['avatar']['tmp_name'], './'.$av); + } + else + if (isset($_POST['delete_avatar'])) + { + unlink('./'.$user_info['avatar']); + $av = ''; + } + else + $av = $user_info['avatar']; //if new avatar is not set + + if ($_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->getView('MainView')->forum_message('Your profile has changed.', 'index.php?mode=viewprofile&id='.$this->getModel('SessionModel')->getID()); + $lockv = true; + + } + } + + $_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']; + + $this->getView('MainView')->putExistingModel('UsersModel', $this->getModel('UsersModel')); + + if (!isset($lockv)) + $this->getView('MainView')->edprofile_form($msg); + } + } + + public function logout() + { + $this->loadDependencies(); + + if (!$this->getModel('SessionModel')->isLogged()) + $this->forward('index.php'); + + $this->getModel('SessionModel')->deleteSession(); + + $this->getView('MainView')->forum_message('You are logged out.', 'index.php'); + } + + public function login() + { + $this->loadDependencies(); + $this->loadModel('BansModel'); + + if ($_SERVER['REQUEST_SCHEME'] == 'http') + $this->forward('https://'.$_SERVER['SERVER_NAME'].$_SERVER['REQUEST_URI']); + + if ($this->getModel('SessionModel')->isLogged()) + $this->forward('index.php'); + + $msg = ''; + if (isset($_POST['nick'], $_POST['passwd'])) + { + //secure pools + $_POST['nick'] = trim(strip_tags($this->db->real_escape_string($_POST['nick']))); + $_POST['passwd'] = sha1(trim(strip_tags($this->db->real_escape_string($_POST['passwd'])))); + + $userinfo = $this->getModel('SessionModel')->tryGetUser($_POST['nick'], $_POST['passwd']); + + if (count($userinfo) == 0) + $msg = 'Invalid username or password.'; + + if ($msg == '') + { + $ban_info = $this->getModel('BansModel')->getUserBan($userinfo['user_id']); + + if ($ban_info == null) + { + $this->getModel('SessionModel')->registerNewSession($userinfo['user_id']); + $this->getView('MainView')->forum_message('You are logged as: '.$userinfo['nick'].'', 'index.php'); + } + else + { + $reason = ($ban_info['reason'] != '') ? '
    Reason: '.$ban_info['reason'].'' : ''; + $this->getView('MainView')->forum_message('You are banned!'.$reason); + } + $lockv = true; + } + } + + $_POST['nick'] = (isset($_POST['nick'])) ? $_POST['nick'] : ''; + if (!isset($lockv)) + $this->getView('MainView')->login_form($msg); + } + + public function register() + { + $this->loadDependencies(); + $this->loadModel('UsersModel'); + + if ($this->getModel('SessionModel')->isLogged()) + $this->forward('index.php'); + + if ($_SERVER['REQUEST_SCHEME'] == 'http') + $this->forward('https://'.$_SERVER['SERVER_NAME'].$_SERVER['REQUEST_URI']); + + $msg = ''; + 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'] = trim(strip_tags($_POST['passwd'])); + $_POST['passwd_confirm'] = trim(strip_tags($_POST['passwd_confirm'])); + $_POST['email'] = trim(strip_tags($this->db->real_escape_string($_POST['email']))); + + if (strlen($_POST['nick']) < 3) + $msg .= 'Nick is too short (min 3 characters)
    '; + + if (strlen($_POST['passwd']) < 8) + $msg .= 'Password is too short (min 8 characters)
    '; + + if (!filter_var($_POST['email'], FILTER_VALIDATE_EMAIL)) + $msg .= 'Email is incorrect
    '; + + if ($this->getModel('UsersModel')->nickExists($_POST['nick']) == true) + $msg .= 'Nick is in use. Type another one.
    '; + + if ($_POST['passwd'] != $_POST['passwd_confirm']) + $msg .= 'Password do not match'; + + if ($msg == '') + { + $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'); + $lockv = true; + } + } + + $_POST['nick'] = (isset($_POST['nick'])) ? $_POST['nick'] : ''; + $_POST['email'] = (isset($_POST['email'])) ? $_POST['email'] : ''; + + if (!isset($lockv)) + $this->getView('MainView')->register_form($msg); + } + + public function checknick() + { + $this->loadModel('UsersModel'); + if (!isset($_GET['nick'])) + $_GET['nick'] = ''; + + $_GET['nick'] = trim($this->db->real_escape_string(strip_tags($_GET['nick']))); + + if ($this->getModel('UsersModel')->nickExists($_GET['nick']) == true) + echo 'true'; + else + echo 'false'; + } +} + +?> \ No newline at end of file diff --git a/inc/database_connection.php b/inc/database_connection.php new file mode 100644 index 0000000..37f246e --- /dev/null +++ b/inc/database_connection.php @@ -0,0 +1,6 @@ +query("SET NAMES `utf8`"); +?> \ No newline at end of file diff --git a/inc/misc_functions.php b/inc/misc_functions.php new file mode 100644 index 0000000..ba2e1f6 --- /dev/null +++ b/inc/misc_functions.php @@ -0,0 +1,5 @@ + \ No newline at end of file diff --git a/inc/model.class.php b/inc/model.class.php new file mode 100644 index 0000000..121a6f0 --- /dev/null +++ b/inc/model.class.php @@ -0,0 +1,56 @@ +db = $db; + } + + public function select($table, $what='*', $where = '', $sorting = '', $limit = '') + { + $sql="SELECT $what FROM $table"; + + if ($where != '') + $sql .= " WHERE $where"; + + if($sorting != '') + $sql .= " ORDER BY $sorting"; + + if($limit != '') + $sql .= " LIMIT $limit"; + + $result = $this->db->query($sql); + + $out = array(); + if ($result->num_rows > 0) + { + while ($row = $result->fetch_assoc()) + { + $out[]=$row; + } + } + + return $out; + } + + public function select_query($sql) + { + $result = $this->db->query($sql); + + $out = array(); + if ($result->num_rows > 0) + { + while ($row = $result->fetch_assoc()) + { + $out[]=$row; + } + } + + return $out; + } +} \ No newline at end of file diff --git a/inc/models/BansModel.class.php b/inc/models/BansModel.class.php new file mode 100644 index 0000000..7ec7414 --- /dev/null +++ b/inc/models/BansModel.class.php @@ -0,0 +1,64 @@ +select_query($query); + } + + public function getBan($ban_id) + { + if ($this->ban_info == null) + { + $query = 'SELECT b.ban_id as ban_id, b.user_id as user_id, u.nick as nick, b.reason as reason + FROM '.BANLIST_TABLE.' b + LEFT JOIN '.USERS_TABLE.' u ON u.user_id = b.user_id + WHERE `ban_id`=\''.$ban_id.'\''; + + $out = $this->select_query($query); + + if (count($out) > 0) + $this->ban_info = $out[0]; + } + + return $this->ban_info; + } + + public function getUserBan($user_id) + { + $out = $this->select(BANLIST_TABLE, '*', 'user_id=\''.$user_id.'\''); + + if (count($out) > 0) + return $out[0]; + else + return null; + } + + public function addBan($user_id, $reason) + { + $query = 'INSERT INTO '.BANLIST_TABLE.' + (`ban_id`, `user_id`, `reason`) + VALUES (NULL, \''.$user_id.'\', \''.$reason.'\')'; + + $this->db->query($query); + + $query = 'DELETE FROM '.SESSIONS_TABLE.' WHERE `user_id`=\''.$user_id.'\''; + $this->db->query($query); + } + + public function deleteBan($ban_id) + { + $query = 'DELETE FROM '.BANLIST_TABLE.' WHERE `ban_id`=\''.$ban_id.'\''; + + $this->db->query($query); + } +} +?> \ No newline at end of file diff --git a/inc/models/ConfigModel.class.php b/inc/models/ConfigModel.class.php new file mode 100644 index 0000000..1a8e7fa --- /dev/null +++ b/inc/models/ConfigModel.class.php @@ -0,0 +1,38 @@ +db = $db; + + $result = $this->select (CONFIG_TABLE); + + for ($i=0; $iconfList[$result[$i]['name']] = $result[$i]['value']; + + } + + public function getConf($name) + { + if (isset($this->confList[$name])) + return $this->confList[$name]; + else + return null; + } + + public function updateConf($name, $value) + { + $query = 'UPDATE '.CONFIG_TABLE.' + SET `value`=\''.$value.'\' + WHERE `name`=\''.$name.'\''; + + $this->db->query($query); + } +} + +?> \ No newline at end of file diff --git a/inc/models/ForumsModel.class.php b/inc/models/ForumsModel.class.php new file mode 100644 index 0000000..bfaa554 --- /dev/null +++ b/inc/models/ForumsModel.class.php @@ -0,0 +1,119 @@ +select (FORUMS_VIEW); + } + + public function getCats() + { + return $this->select (CATS_TABLE); + } + + public function getForumsNames() + { + $out = $this->select (FORUMS_TABLE, 'forum_id, name', '', 'forum_id ASC'); + if (count($out) > 0) + return $out; + else + return array(); + } + + public function getForum($forum_id) + { + if ($this->forum_info == null) + { + $out = $this->select(FORUMS_TABLE, '*', 'forum_id=\''.$forum_id.'\''); + + if (count($out) > 0) + $this->forum_info = $out[0]; + } + + return $this->forum_info; + } + + public function getTopics($forum_id) + { + $out = $this->select(TOPICS_VIEW, '*', 'forum_id=\''.$forum_id.'\'', 'lastpost_post_id DESC'); + if (count($out) > 0) + return $out; + else + return array(); + } + + public function getCat($cat_id) + { + if ($this->cat_info == null) + { + $out = $this->select(CATS_TABLE, '*', 'category_id=\''.$cat_id.'\''); + + if (count($out) > 0) + $this->cat_info = $out[0]; + } + + return $this->cat_info; + } + + public function changeCat($cat_id, $cat_name) + { + $query = 'UPDATE '.CATS_TABLE.' + SET `name`=\''.$cat_name.'\' + WHERE `category_id`=\''.$cat_id.'\''; + + $this->db->query($query); + } + + public function addCat($cat_name) + { + $query = 'INSERT INTO '.CATS_TABLE.' + (category_id, name) + VALUES (NULL, \''.$cat_name.'\')'; + + $this->db->query($query); + } + + public function deleteCat($cat_id) + { + $query = 'DELETE FROM '.CATS_TABLE.' + WHERE `category_id`=\''.$cat_id.'\''; + + $this->db->query($query); + } + + public function changeForum($forum_id, $forum_name, $forum_desc, $forum_category_id, $forum_locked) + { + $query = 'UPDATE '.FORUMS_TABLE.' + SET `name`=\''.$forum_name.'\', + `desc`=\''.$forum_desc.'\', + `category_id`=\''.$forum_category_id.'\', + `locked`=\''.$forum_locked.'\' + WHERE `forum_id`=\''.$forum_id.'\''; + + $this->db->query($query); + } + + public function addForum($forum_name, $forum_desc, $forum_category_id, $forum_locked) + { + $query = 'INSERT INTO '.FORUMS_TABLE.' + (`forum_id`, `name`, `desc`, `category_id`, `locked`) + VALUES (NULL, \''.$forum_name.'\', \''.$forum_desc.'\', \''.$forum_category_id.'\', \''.$forum_locked.'\')'; + + $this->db->query($query); + } + + public function deleteForum($forum_id) + { + $query = 'DELETE FROM '.FORUMS_TABLE.' + WHERE `forum_id`=\''.$forum_id.'\''; + + $this->db->query($query); + } +} + +?> \ No newline at end of file diff --git a/inc/models/NavigationModel.class.php b/inc/models/NavigationModel.class.php new file mode 100644 index 0000000..81e454c --- /dev/null +++ b/inc/models/NavigationModel.class.php @@ -0,0 +1,43 @@ +addLink('Forum '.$fn, 'index.php'); + $this->title = $fn. ' • '; + } + public function addLink($name, $url = '') + { + if ($url == null) + $url = $_SERVER['REQUEST_URI']; + $l = array( + 'name' => $name, + 'url' => $url + ); + + array_push($this->linksList, $l); + } + + public function setSubTitle($t) + { + $this->title .= $t; + } + + public function getTitle() + { + return $this->title; + } + + public function getNav() + { + return $this->linksList; + } +} + +?> \ No newline at end of file diff --git a/inc/models/PostsModel.class.php b/inc/models/PostsModel.class.php new file mode 100644 index 0000000..4c7b09f --- /dev/null +++ b/inc/models/PostsModel.class.php @@ -0,0 +1,126 @@ +topic_info == null) + { + $query = ' + SELECT + t.topic_id as topic_id, t.title as topic_title, t.locked as topic_locked, t.forum_id as forum_id, f.name as forum_name, f.locked as forum_locked, pc.post_count as post_count + FROM '.TOPICS_TABLE.' t + LEFT JOIN '.FORUMS_TABLE.' f ON f.forum_id = t.forum_id + LEFT JOIN '.TOPICS_PC_VIEW.' pc ON pc.topic_id = t.topic_id + WHERE t.topic_id=\''.$topic_id.'\''; + $out = $this->select_query($query); + if (count($out) > 0) + $this->topic_info = $out[0]; + } + + return $this->topic_info; + } + + public function getPosts($topic_id) + { + $out = $this->select (POSTS_VIEW, '*', 'topic_id=\''.$topic_id.'\'', 'post_id ASC'); + + if ($out != null) + return $out; + else + return null; + } + + public function getPost($post_id) + { + $out = $this->select (POSTS_VIEW, '*', 'post_id=\''.$post_id.'\''); + + if (count($out) > 0) + return $out[0]; + else + return null; + } + + public function getFirstPost($topic_id) + { + $out = $this->select (POSTS_VIEW, 'post_id', 'topic_id=\''.$topic_id.'\'', 'post_id ASC', 1); + + if (count($out) > 0) + return $out[0]; + else + return null; + } + + //mod options + public function deletePost($post_id) + { + $query = 'DELETE FROM '.POSTS_TABLE.' WHERE post_id=\''.$post_id.'\';'; + + $this->db->query($query); + } + + public function deleteTopic($topic_id) + { + $query = 'call delete_topic(\''.$topic_id.'\');'; + $this->db->query($query); + } + + public function lockTopic($topic_id, $locked = true) + { + $query = 'UPDATE '.TOPICS_TABLE.' SET locked=\''.$locked.'\' WHERE topic_id=\''.$topic_id.'\';'; + + $this->db->query($query); + } + + public function moveTopic($topic_id, $forum_id) + { + $query = 'UPDATE '.TOPICS_TABLE.' SET forum_id=\''.$forum_id.'\' WHERE topic_id=\''.$topic_id.'\';'; + + $this->db->query($query); + } + + public function addTopic($title, $content, $forum_id, $user_id) + { + $query = 'call add_topic(\''.$title.'\', + \''.$content.'\', + \''.$forum_id.'\', + \''.$user_id.'\', + \''.$_SERVER['HTTP_USER_AGENT'].'\', + @out);'; + $this->db->query($query); + $result = $this->db->query('select @out as topic_id'); + + if ($result != null) + return $result->fetch_assoc()['topic_id']; + else + return null; + } + + public function changePost($post_id, $content) + { + $query = 'UPDATE '.POSTS_TABLE.' SET `content`=\''.$content.'\' WHERE `post_id`=\''.$post_id.'\''; + $this->db->query($query); + } + + public function changeTopic($topic_id, $title) + { + $query = 'UPDATE '.TOPICS_TABLE.' SET `title`=\''.$title.'\' WHERE `topic_id`=\''.$topic_id.'\''; + $this->db->query($query); + } + + public function addPost($topic_id, $user_id, $content) + { + $query = 'INSERT INTO '.POSTS_TABLE.' + (post_id, topic_id, user_id, content, date, user_agent) + VALUES + (NULL, \''.$topic_id.'\', \''.$user_id.'\', \''.$content.'\', NOW(), \''.$_SERVER['HTTP_USER_AGENT'].'\')'; + $this->db->query($query); + } +} + +?> \ No newline at end of file diff --git a/inc/models/SessionModel.class.php b/inc/models/SessionModel.class.php new file mode 100644 index 0000000..6d6e0a9 --- /dev/null +++ b/inc/models/SessionModel.class.php @@ -0,0 +1,125 @@ +db = $db; + + if (isset($_COOKIE[COOKIE_NAME])) + { + $result = $this->select(SESSIONS_TABLE, '*', 'session_id=\''.$_COOKIE[COOKIE_NAME].'\' AND expiry_time>=NOW()'); + if (count($result) > 0) + { + //update session expiry time in database and in cookie + if ($result[0]['IP'] != $_SERVER['REMOTE_ADDR']) + { + $this->deleteSession(); + } + else + { + $this->updateSession(); + $uid = $result[0]['user_id']; + + $result = $this->select(USERS_TABLE, 'user_id, nick, rank', 'user_id=\''.$uid.'\''); + $this->userdata = $result[0]; + } + } + else + { + $this->deleteSession(); + } + } + } + + public function updateSession() + { + /*$this->db->query('UPDATE '.SESSIONS_TABLE.' SET expiry_time=(NOW() + INTERVAL 120 MINUTE) WHERE session_id=\''.$_COOKIE[COOKIE_NAME].'\''); + setcookie(COOKIE_NAME, $_COOKIE[COOKIE_NAME], $_SERVER['REQUEST_TIME']+7200, COOKIE_PATH, COOKIE_DOMAIN, false, true); */ + $newid = $this->generateSessionID(); + $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() + { + 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].'\''); + } + + private function generateSessionID() + { + $out = $_SERVER['HTTP_USER_AGENT'].$_SERVER['REQUEST_TIME_FLOAT'].$_SERVER['REMOTE_ADDR'].rand(1, 50000); + return md5($out); + } + + public function registerNewSession($user_id) + { + $newID = $this->generateSessionID(); + $query = 'UPDATE '.USERS_INFO_TABLE.' + SET lastvisit=NOW() + WHERE user_id=\''.$user_id.'\''; + + $this->db->query($query); + + $query = + 'INSERT INTO + '.SESSIONS_TABLE.' + (session_id, user_id, IP, expiry_time) + VALUES + (\''.$newID.'\', \''.$user_id.'\', \''.$_SERVER['REMOTE_ADDR'].'\', (NOW() + INTERVAL 120 MINUTE) );'; + + $this->db->query($query); + + setcookie(COOKIE_NAME, $newID, $_SERVER['REQUEST_TIME']+7200, COOKIE_PATH, COOKIE_DOMAIN, false, true); + } + + public function tryGetUser($nick, $passwd) + { + $result = $this->select(USERS_TABLE, 'user_id, nick', 'nick=\''.$nick.'\' AND password=\''.$passwd.'\'', '', 1); + + if (count($result) > 0 ) + return $result[0]; + else + return array(); + } + + public function isLogged() + { + if (count($this->userdata) > 0) + return true; + else + return false; + } + + public function getNick() + { + if ($this->isLogged()) + return $this->userdata['nick']; + else + return null; + } + + public function getRank() + { + if ($this->isLogged()) + return $this->userdata['rank']; + else + return null; + } + + public function getID() + { + if ($this->isLogged()) + return $this->userdata['user_id']; + else + return null; + } +} + +?> \ No newline at end of file diff --git a/inc/models/StatisticsModel.class.php b/inc/models/StatisticsModel.class.php new file mode 100644 index 0000000..e46ff3c --- /dev/null +++ b/inc/models/StatisticsModel.class.php @@ -0,0 +1,56 @@ +select(POSTS_TABLE, 'count(post_id) AS posts_count'); + return $out[0]['posts_count']; + } + + public function getTopicsCount() + { + $out = $this->select(TOPICS_TABLE, 'count(topic_id) AS topics_count'); + return $out[0]['topics_count']; + } + + public function getUsersCount() + { + $out = $this->select(USERS_TABLE, 'count(user_id) AS users_count'); + return $out[0]['users_count']; + } + + public function getLastRegisteredUser() + { + $out = $this->select(USERS_TABLE, 'user_id, nick, rank', '', 'user_id DESC', '1'); + return $out[0]; + } + + private function retrieveLoggedUsers() + { + if ($this->logged_users == null) + { + $this->logged_users = $this->select(LOGGED_USERS_VIEW); + } + } + + public function getLoggedUsersCount() + { + $this->retrieveLoggedUsers(); + + return count($this->logged_users); + } + + public function getLoggedUsers() + { + $this->retrieveLoggedUsers(); + + return $this->logged_users; + } +} + +?> \ No newline at end of file diff --git a/inc/models/UsersModel.class.php b/inc/models/UsersModel.class.php new file mode 100644 index 0000000..6b5f535 --- /dev/null +++ b/inc/models/UsersModel.class.php @@ -0,0 +1,128 @@ +select(USERS_TABLE, 'nick', '`nick`=\''.$nick.'\'', '', 1); + if (count($out) > 0) + return true; + else + return false; + } + + public function createNewUser($nick, $passwd, $email) + { + $this->db->query('call add_user(\''.$nick.'\', \''.$passwd.'\', \''.$email.'\');'); + } + + public function getUsersNicks() + { + $out = $this->select (USERS_TABLE, 'user_id, nick', '', 'user_id ASC'); + if (count($out) > 0) + return $out; + else + return array(); + } + + public function getUserInformation($user_id, $passwd = false) + { + if ($this->user_info == null) + { + $query = ' + SELECT + u.nick as nick, u.email as email, u.rank as rank, u.active as active, + ui.regdate as regdate, ui.lastvisit as lastvisit, ui.avatar as avatar, ui.location as location, ui.signature as signature, pc.post_count as post_count, lu.IP as user_IP '; + if ($passwd) + $query .= ',u.password as password '; + $query .= ' + FROM '.USERS_TABLE.' u + LEFT JOIN '.USERS_INFO_TABLE.' ui on ui.user_id = u.user_id + LEFT JOIN '.USERS_PC_VIEW.' pc on pc.user_id = u.user_id + LEFT JOIN '.LOGGED_USERS_VIEW.' lu on lu.user_id = u.user_id + WHERE u.user_id = \''.$user_id.'\''; + + $out = $this->select_query($query); + if (count($out) > 0) + $this->user_info = $out[0]; + } + + return $this->user_info; + } + + public function changeUserPassword($user_id, $passwd) + { + $query = + 'UPDATE .'.USERS_TABLE.' + SET `password`=\''.$passwd.'\' + WHERE `user_id` = \''.$user_id.'\''; + + $this->db->query($query); + } + + public function changeUserRank($user_id, $rank) + { + $query = + 'UPDATE .'.USERS_TABLE.' + SET `rank`=\''.$rank.'\' + WHERE `user_id` = \''.$user_id.'\''; + + $this->db->query($query); + } + + public function updateUserProfile($user_id, $nick, $email, $location, $signature, $avatar) + { + $query = + 'UPDATE .'.USERS_TABLE.' + SET '; + if ($nick != null) + $query .= '`nick`=\''.$nick.'\','; + $query .= '`email`=\''.$email.'\' + WHERE `user_id` = \''.$user_id.'\''; + + $this->db->query($query); + + //profile informations + $query = + 'UPDATE .'.USERS_INFO_TABLE.' + SET + `avatar`=\''.$avatar.'\', + `location`=\''.$location.'\', + `signature`=\''.$signature.'\' + WHERE `user_id` = \''.$user_id.'\''; + + $this->db->query($query); + } + + public function getUsers($stype, $sorder, $rank) + { + $query = ' + SELECT + u.user_id as user_id, u.nick as nick, u.rank as rank, ui.regdate as regdate, ui.lastvisit as lastvisit, pc.post_count as post_count + FROM '.USERS_TABLE.' u + LEFT JOIN '.USERS_INFO_TABLE.' ui on ui.user_id = u.user_id + LEFT JOIN '.USERS_PC_VIEW.' pc on pc.user_id = u.user_id '; + if ($rank !== '') + $query .= 'WHERE rank=\''.$rank.'\''; + $query .= ' + ORDER BY '.$stype.' '.$sorder; + + $out = $this->select_query($query); + + return $out; + } + + public function deleteUser($user_id) + { + $query = + 'DELETE FROM .'.USERS_TABLE.' + WHERE `user_id` = \''.$user_id.'\''; + $this->db->query($query); + } +} + +?> \ No newline at end of file diff --git a/inc/view.class.php b/inc/view.class.php new file mode 100644 index 0000000..9330ed0 --- /dev/null +++ b/inc/view.class.php @@ -0,0 +1,29 @@ +TPL[$n] = $v; + } + + function __construct(&$db) + { + $this->db = $db; + } +} + +?> \ No newline at end of file diff --git a/inc/views/MainView.class.php b/inc/views/MainView.class.php new file mode 100644 index 0000000..313a61a --- /dev/null +++ b/inc/views/MainView.class.php @@ -0,0 +1,536 @@ +assign('is_logged', $this->getModel('SessionModel')->isLogged()); + $this->assign('my_nick', $this->getModel('SessionModel')->getNick()); + $this->assign('my_id', $this->getModel('SessionModel')->getID()); + $this->assign('my_rank', $this->getModel('SessionModel')->getRank()); + $this->assign('actual_time', date('Y-m-d G:i', $_SERVER['REQUEST_TIME'])); + + //forum prefs + $this->assign('forum_name', $this->getModel('ConfigModel')->getConf('forum_name')); + $this->assign('forum_desc', $this->getModel('ConfigModel')->getConf('forum_desc')); + + //navigation + $this->loadModel('NavigationModel'); + $this->getModel('NavigationModel')->setForumName($this->getModel('ConfigModel')->getConf('forum_name')); + if ($admin) + $this->getModel('NavigationModel')->addLink('ACP Admin', 'index.php?mode=admin'); + } + + //widok strony głównej + public function main() + { + $this->setDefaults(); + + // get categories, forums, forums statistics + $this->loadModel('ForumsModel'); + $this->assign('forums_list', $this->getModel('ForumsModel')->getForums()); + + //get data for bottom statistics + $this->loadModel('StatisticsModel'); + $this->assign('posts_count', $this->getModel('StatisticsModel')->getPostsCount()); + $this->assign('users_count', $this->getModel('StatisticsModel')->getUsersCount()); + $this->assign('last_user', $this->getModel('StatisticsModel')->getLastRegisteredUser()); + $this->assign('logged_users_count', $this->getModel('StatisticsModel')->getLoggedUsersCount()); + $this->assign('logged_users', $this->getModel('StatisticsModel')->getLoggedUsers()); + + //nawigacja po witrynie + $this->getModel('NavigationModel')->setSubTitle('Main Page'); + $this->getModel('NavigationModel')->addLink('Main Page', 'index.php'); + + // końcowe rzeczy + $this->assign('nav', $this->getModel('NavigationModel')->getNav()); + $this->assign('meta_title', $this->getModel('NavigationModel')->getTitle()); + $this->show('main'); + } + + public function viewforum() + { + $this->setDefaults(); + + // get forum info + $f_info = $this->getModel('ForumsModel')->getForum($_GET['id']); + + $this->assign('f_name', $f_info['name']); + $this->assign('forum_info', $f_info); + $this->assign('topics_list', $this->getModel('ForumsModel')->getTopics($_GET['id'])); + //nawigacja po witrynie + $this->getModel('NavigationModel')->setSubTitle('View forum: '.$f_info['name']); + $this->getModel('NavigationModel')->addLink($f_info['name'], 'index.php?mode=viewforum&id='.$_GET['id']); + + // końcowe rzeczy + $this->assign('nav', $this->getModel('NavigationModel')->getNav()); + $this->assign('meta_title', $this->getModel('NavigationModel')->getTitle()); + $this->show('viewforum'); + } + + public function userlist() + { + $this->setDefaults(); + + $this->loadModel('UsersModel'); + $this->assign('users_list', $this->getModel('UsersModel')->getUsers($_POST['sort_type'], $_POST['sort_desc'], $_GET['rank'])); + + $this->assign('regdate_selected', ($_POST['sort_type'] == 'regdate') ? 'selected="selected"' : ''); + $this->assign('lastvisit_selected', ($_POST['sort_type'] == 'lastvisit') ? 'selected="selected"' : ''); + $this->assign('username_selected', ($_POST['sort_type'] == 'nick') ? 'selected="selected"' : ''); + $this->assign('posts_selected', ($_POST['sort_type'] == 'post_count') ? 'selected="selected"' : ''); + $this->assign('desc_checked', ($_POST['sort_desc'] == 'DESC') ? 'checked="checked"' : ''); + + //nawigacja po witrynie + $this->getModel('NavigationModel')->setSubTitle('Users list'); + $this->getModel('NavigationModel')->addLink('Users list', 'index.php?mode=userlist'); + + // końcowe rzeczy + $this->assign('nav', $this->getModel('NavigationModel')->getNav()); + $this->assign('meta_title', $this->getModel('NavigationModel')->getTitle()); + $this->show('userlist'); + } + + public function viewtopic() + { + $this->setDefaults(); + + // get forum info + $t_info = $this->getModel('PostsModel')->getTopic($_GET['id']); + + $this->assign('topic_info', $t_info); + $this->assign('posts_list', $this->getModel('PostsModel')->getPosts($_GET['id'])); + //nawigacja po witrynie + $this->getModel('NavigationModel')->setSubTitle('View topic: '.$t_info['topic_title']); + $this->getModel('NavigationModel')->addLink($t_info['forum_name'], 'index.php?mode=viewforum&id='.$t_info['forum_id']); + $this->getModel('NavigationModel')->addLink($t_info['topic_title'], 'index.php?mode=viewtopic&id='.$_GET['id']); + + // końcowe rzeczy + $this->assign('nav', $this->getModel('NavigationModel')->getNav()); + $this->assign('meta_title', $this->getModel('NavigationModel')->getTitle()); + $this->show('viewtopic'); + } + + public function login_form($msg) + { + $this->setDefaults(); + + $this->assign('nick', $_POST['nick']); + $this->assign('error_msg', $msg); + + //nawigacja po witrynie + $this->getModel('NavigationModel')->setSubTitle('Log in'); + $this->getModel('NavigationModel')->addLink('Log in', 'index.php?mode=login'); + + // końcowe rzeczy + $this->assign('nav', $this->getModel('NavigationModel')->getNav()); + $this->assign('meta_title', $this->getModel('NavigationModel')->getTitle()); + $this->show('login_form'); + } + + public function register_form($msg) + { + $this->setDefaults(); + + $this->assign('nick', $_POST['nick']); + $this->assign('email', $_POST['email']); + $this->assign('error_msg', $msg); + + //nawigacja po witrynie + $this->getModel('NavigationModel')->setSubTitle('Register'); + $this->getModel('NavigationModel')->addLink('Register', 'index.php?mode=register'); + + // końcowe rzeczy + $this->assign('nav', $this->getModel('NavigationModel')->getNav()); + $this->assign('meta_title', $this->getModel('NavigationModel')->getTitle()); + $this->show('register_form'); + } + + public function viewprofile() + { + $this->setDefaults(); + $this->loadModel('StatisticsModel'); + + $user_info = $this->getModel('UsersModel')->getUserInformation($_GET['id']); + + $this->assign('user_info', $user_info); + $total_posts = $this->getModel('StatisticsModel')->getPostsCount(); + $posts_ration = ($total_posts > 0) ? round(100*$user_info['post_count']/$total_posts, 2) : 0; + $this->assign('post_ratio', $total_posts); + $this->assign('logged_id', $this->getModel('SessionModel')->getID()); + + //nawigacja po witrynie + $this->getModel('NavigationModel')->addLink('Users list', 'index.php?mode=userlist'); + $this->getModel('NavigationModel')->setSubTitle('View profile: '.$user_info['nick']); + $this->getModel('NavigationModel')->addLink('Profile: '.$user_info['nick'], 'index.php?mode=viewprofile&id='.$_GET['id']); + + // końcowe rzeczy + $this->assign('nav', $this->getModel('NavigationModel')->getNav()); + $this->assign('meta_title', $this->getModel('NavigationModel')->getTitle()); + $this->show('viewprofile'); + } + + public function edprofile_form($msg, $admin = false) + { + $this->setDefaults($admin); + + if ($admin) + $user_info = $this->getModel('UsersModel')->getUserInformation($_GET['id']); + else + $user_info = $this->getModel('UsersModel')->getUserInformation($this->getModel('SessionModel')->getID()); + $this->assign('nick', $_POST['nick']); + $this->assign('is_admin', $admin); + $this->assign('email', $_POST['email']); + $this->assign('location', $_POST['location']); + $this->assign('signature', $_POST['signature']); + $this->assign('avatar', $user_info['avatar']); + $this->assign('error_msg', $msg); + + if ($admin) + { + $this->assign('user_selected', ($_POST['user_rank'] == RANK_USER) ? 'checked="checked"' : ''); + $this->assign('mod_selected', ($_POST['user_rank'] == RANK_MOD) ? 'checked="checked"' : ''); + $this->assign('admin_selected', ($_POST['user_rank'] == RANK_ADMIN) ? 'checked="checked"' : ''); + } + + //nawigacja po witrynie + if ($admin) + { + $this->getModel('NavigationModel')->setSubTitle('ACP • Edit profile'); + $this->getModel('NavigationModel')->addLink('Users list', 'index.php?mode=admin&submode=users'); + $this->getModel('NavigationModel')->addLink('Edit user: '.$user_info['nick']); + } + else + { + $this->getModel('NavigationModel')->setSubTitle('Edit profile'); + $this->getModel('NavigationModel')->addLink('Edit profile', 'index.php?mode=editprofile'); + } + + // końcowe rzeczy + $this->assign('nav', $this->getModel('NavigationModel')->getNav()); + $this->assign('meta_title', $this->getModel('NavigationModel')->getTitle()); + $this->show('edprofile'); + } + + public function posting_form($type, $msg='') + { + $this->setDefaults(); + $this->assign('error_msg', $msg); + + //nawigacja po witrynie + switch ($type) + { + case POSTING_NEWTOPIC: + $forum_info = $this->getModel('ForumsModel')->getForum($_GET['id']); + $this->getModel('NavigationModel')->setSubTitle('New topic'); + $this->getModel('NavigationModel')->addLink($forum_info['name'], 'index.php?mode=viewforum&id='.$forum_info['forum_id']); + $this->getModel('NavigationModel')->addLink('New topic', $_SERVER['REQUEST_URI']); + break; + case POSTING_REPLY: + case POSTING_QUOTE: + $topic_info = $this->getModel('PostsModel')->getTopic($_GET['id']); + + $this->getModel('NavigationModel')->setSubTitle('Reply'); + $this->getModel('NavigationModel')->addLink($topic_info['forum_name'], 'index.php?mode=viewforum&id='.$topic_info['forum_id']); + $this->getModel('NavigationModel')->addLink($topic_info['topic_title'], 'index.php?mode=viewtopic&id='.$topic_info['topic_id']); + $this->getModel('NavigationModel')->addLink('Write a reply', $_SERVER['REQUEST_URI']); + break; + + case POSTING_EDIT: + $topic_info = $this->getModel('PostsModel')->getTopic($_GET['id']); + + $this->getModel('NavigationModel')->setSubTitle('Edit post'); + $this->getModel('NavigationModel')->addLink($topic_info['forum_name'], 'index.php?mode=viewforum&id='.$topic_info['forum_id']); + $this->getModel('NavigationModel')->addLink($topic_info['topic_title'], 'index.php?mode=viewtopic&id='.$topic_info['topic_id']); + $this->getModel('NavigationModel')->addLink('Edit post', $_SERVER['REQUEST_URI']); + break; + + case POSTING_EDITTOPIC: + $topic_info = $this->getModel('PostsModel')->getTopic($_GET['id']); + + $this->getModel('NavigationModel')->setSubTitle('Edit topic'); + $this->getModel('NavigationModel')->addLink($topic_info['forum_name'], 'index.php?mode=viewforum&id='.$topic_info['forum_id']); + $this->getModel('NavigationModel')->addLink($topic_info['topic_title'], 'index.php?mode=viewtopic&id='.$topic_info['topic_id']); + $this->getModel('NavigationModel')->addLink('Edit topic', $_SERVER['REQUEST_URI']); + break; + } + + $this->assign('post', $_POST['post']); + if (isset($_POST['preview'])) + $this->assign('preview', addslashes(htmlspecialchars($_POST['post']))); + + if ($type == POSTING_NEWTOPIC || $type == POSTING_EDITTOPIC) + $this->assign('topic', $_POST['topic']); + + // końcowe rzeczy + $this->assign('nav', $this->getModel('NavigationModel')->getNav()); + $this->assign('meta_title', $this->getModel('NavigationModel')->getTitle()); + $this->show('posting'); + } + + public function move_topic() + { + $this->setDefaults(); + $this->loadModel('ForumsModel'); + + //nawigacja po witrynie + $this->getModel('NavigationModel')->setSubTitle('Move topic'); + $this->getModel('NavigationModel')->addLink('Move topic', $_SERVER['REQUEST_URI']); + + $this->assign('topic_info', $this->getModel('PostsModel')->getTopic($_GET['id'])); + $this->assign('forums_list', $this->getModel('ForumsModel')->getForumsNames()); + + // końcowe rzeczy + $this->assign('nav', $this->getModel('NavigationModel')->getNav()); + $this->assign('meta_title', $this->getModel('NavigationModel')->getTitle()); + $this->show('move_topic'); + } + + public function forum_message($msg, $url = '', $timeout = 2) + { + $this->setDefaults(); + + $this->assign('message', $msg); + $this->assign('url', $url); + $this->assign('timeout', $timeout); + + //nawigacja po witrynie + $this->getModel('NavigationModel')->setSubTitle('Forum message'); + $this->getModel('NavigationModel')->addLink('Forum message', 'index.php'); + + // końcowe rzeczy + $this->assign('nav', $this->getModel('NavigationModel')->getNav()); + $this->assign('meta_title', $this->getModel('NavigationModel')->getTitle()); + $this->show('forum_message'); + } + + public function confirm_action($msg) + { + $this->setDefaults(); + + $this->assign('message', $msg); + + //nawigacja po witrynie + $this->getModel('NavigationModel')->setSubTitle('Confirm action'); + $this->getModel('NavigationModel')->addLink('Confirm action', $_SERVER['REQUEST_URI']); + + // końcowe rzeczy + $this->assign('nav', $this->getModel('NavigationModel')->getNav()); + $this->assign('meta_title', $this->getModel('NavigationModel')->getTitle()); + $this->show('confirm_action'); + } + + public function colorRank($username, $rank) + { + if ($rank == RANK_ADMIN) + return ''.$username.''; + + if ($rank == RANK_MOD) + return ''.$username.''; + + return $username; + } + + public function getRankLevel($rank) + { + if ($rank == RANK_ADMIN) + return $this->colorRank('Admin', $rank); + if ($rank == RANK_MOD) + return $this->colorRank('Mod', $rank); + + return 'User'; + } + + // ADMIN PANEL ----------------------------------------------------------------- + public function admin_main() + { + $this->setDefaults(true); + $this->loadModel('StatisticsModel'); + + //nawigacja po witrynie + $this->getModel('NavigationModel')->setSubTitle('Main Page'); + $this->assign('installation_date', $this->getModel('ConfigModel')->getConf('installation_date')); + $this->assign('topics_total', $this->getModel('StatisticsModel')->getTopicsCount()); + $this->assign('posts_total', $this->getModel('StatisticsModel')->getPostsCount()); + $this->assign('users_total', $this->getModel('StatisticsModel')->getUsersCount()); + $this->assign('script_version', VERSION); + $this->assign('logged_users', $this->getModel('StatisticsModel')->getLoggedUsers()); + $this->assign('logged_users_total', $this->getModel('StatisticsModel')->getLoggedUsersCount()); + + // końcowe rzeczy + $this->assign('nav', $this->getModel('NavigationModel')->getNav()); + $this->assign('meta_title', $this->getModel('NavigationModel')->getTitle()); + $this->show('admin/main'); + } + + public function admin_userlist() + { + $this->setDefaults(true); + + $this->loadModel('UsersModel'); + $this->assign('users_list', $this->getModel('UsersModel')->getUsers($_POST['sort_type'], $_POST['sort_desc'], $_GET['rank'])); + + $this->assign('regdate_selected', ($_POST['sort_type'] == 'regdate') ? 'selected="selected"' : ''); + $this->assign('lastvisit_selected', ($_POST['sort_type'] == 'lastvisit') ? 'selected="selected"' : ''); + $this->assign('username_selected', ($_POST['sort_type'] == 'nick') ? 'selected="selected"' : ''); + $this->assign('posts_selected', ($_POST['sort_type'] == 'post_count') ? 'selected="selected"' : ''); + $this->assign('desc_checked', ($_POST['sort_desc'] == 'DESC') ? 'checked="checked"' : ''); + + //nawigacja po witrynie + $this->getModel('NavigationModel')->setSubTitle('ACP • Users list'); + $this->getModel('NavigationModel')->addLink('Users list'); + + // końcowe rzeczy + $this->assign('nav', $this->getModel('NavigationModel')->getNav()); + $this->assign('meta_title', $this->getModel('NavigationModel')->getTitle()); + $this->show('admin/userlist'); + } + + public function admin_config($msg) + { + $this->setDefaults(true); + + $this->loadModel('UsersModel'); + + + $this->assign('forum_name', $_POST['forum_name']); + $this->assign('forum_desc', $_POST['forum_desc']); + $this->assign('error_msg', $msg); + + //nawigacja po witrynie + $this->getModel('NavigationModel')->setSubTitle('ACP • Admin config'); + $this->getModel('NavigationModel')->addLink('Forum configuration'); + + // końcowe rzeczy + $this->assign('nav', $this->getModel('NavigationModel')->getNav()); + $this->assign('meta_title', $this->getModel('NavigationModel')->getTitle()); + $this->show('admin/config'); + } + + //widok strony głównej + public function admin_forums() + { + $this->setDefaults(true); + + // get categories, forums, forums statistics + $this->loadModel('ForumsModel'); + $this->assign('forums_list', $this->getModel('ForumsModel')->getForums()); + + //nawigacja po witrynie + $this->getModel('NavigationModel')->setSubTitle('ACP • Forums list'); + $this->getModel('NavigationModel')->addLink('Forums list'); + + // końcowe rzeczy + $this->assign('nav', $this->getModel('NavigationModel')->getNav()); + $this->assign('meta_title', $this->getModel('NavigationModel')->getTitle()); + $this->show('admin/forums'); + } + + public function admin_cat_form($msg, $m) + { + $this->setDefaults(true); + + $this->assign('name', $_POST['name']); + $this->assign('error_msg', $msg); + + //nawigacja po witrynie + $this->getModel('NavigationModel')->addLink('Forums list', 'index.php?mode=admin&submode=forums'); + if ($m == 'add') + { + $this->getModel('NavigationModel')->setSubTitle('ACP • Add category'); + $this->getModel('NavigationModel')->addLink('Add category'); + $this->assign('cat_form_name', 'Add new category'); + } + else + { + $cat_info = $this->getModel('ForumsModel')->getCat($_GET['id']); + $this->getModel('NavigationModel')->setSubTitle('ACP • Edit category'); + $this->getModel('NavigationModel')->addLink('Edit category: '.$cat_info['name']); + $this->assign('cat_form_name', 'Edit category'); + } + + // końcowe rzeczy + $this->assign('nav', $this->getModel('NavigationModel')->getNav()); + $this->assign('meta_title', $this->getModel('NavigationModel')->getTitle()); + $this->show('admin/cat_form'); + } + + public function admin_forum_form($msg, $m) + { + $this->setDefaults(true); + + $this->assign('name', $_POST['name']); + $this->assign('desc', $_POST['desc']); + $this->assign('category_id', $_POST['category_id']); + $this->assign('lock_selected', ($_POST['locked']) ? 'checked="checked"' : ''); + $this->assign('unlock_selected', (!$_POST['locked']) ? 'checked="checked"' : ''); + $this->assign('error_msg', $msg); + $this->assign('cats_list', $this->getModel('ForumsModel')->getCats()); + + //nawigacja po witrynie + $this->getModel('NavigationModel')->addLink('Forums list', 'index.php?mode=admin&submode=forums'); + if ($m == 'add') + { + $this->getModel('NavigationModel')->setSubTitle('ACP • Add forum'); + $this->getModel('NavigationModel')->addLink('Add forum'); + $this->assign('forum_form_name', 'Add new forum'); + } + else + { + $forum_info = $this->getModel('ForumsModel')->getForum($_GET['id']); + $this->getModel('NavigationModel')->setSubTitle('ACP • Edit forum'); + $this->getModel('NavigationModel')->addLink('Edit forum'.$forum_info['name']); + $this->assign('forum_form_name', 'Edit forum'); + } + + // końcowe rzeczy + $this->assign('nav', $this->getModel('NavigationModel')->getNav()); + $this->assign('meta_title', $this->getModel('NavigationModel')->getTitle()); + $this->show('admin/forum_form'); + } + + public function admin_banlist() + { + $this->setDefaults(true); + + $this->loadModel('BansModel'); + $this->assign('bans_list', $this->getModel('BansModel')->getBans()); + + //nawigacja po witrynie + $this->getModel('NavigationModel')->setSubTitle('ACP • Banlist'); + $this->getModel('NavigationModel')->addLink('Banlist'); + + // końcowe rzeczy + $this->assign('nav', $this->getModel('NavigationModel')->getNav()); + $this->assign('meta_title', $this->getModel('NavigationModel')->getTitle()); + $this->show('admin/banlist'); + } + + public function admin_ban_form($msg) + { + $this->setDefaults(true); + + $this->assign('user_id', $_POST['user_id']); + $this->assign('reason', $_POST['reason']); + + $this->loadModel('UsersModel'); + $this->assign('error_msg', $msg); + $this->assign('users_list', $this->getModel('UsersModel')->getUsersNicks()); + + //nawigacja po witrynie + $this->getModel('NavigationModel')->addLink('Banlist', 'index.php?mode=admin&submode=banlist'); + + $this->getModel('NavigationModel')->setSubTitle('ACP • Add ban'); + $this->getModel('NavigationModel')->addLink('Add ban'); + $this->assign('forum_form_name', 'Add ban'); + + // końcowe rzeczy + $this->assign('nav', $this->getModel('NavigationModel')->getNav()); + $this->assign('meta_title', $this->getModel('NavigationModel')->getTitle()); + $this->show('admin/ban_form'); + } +} +?> \ No newline at end of file diff --git a/index.php b/index.php new file mode 100644 index 0000000..e4f3b86 --- /dev/null +++ b/index.php @@ -0,0 +1,43 @@ +$_GET['mode'](); + else + $ob->loadDefault(); + break; + case 'admin': + require_once('./inc/controllers/AdminController.class.php'); + $ob = new AdminController($DB); + if ($_GET['submode'] != null) + $ob->$_GET['submode'](); + else + $ob->loadDefault(); + break; + } +} +catch (Exception $e) +{ + echo + 'Unexpected error occured:
    + '.$e->getMessage().'
    +
    + File: '.$e->getFile().'
    + Line: '.$e->getLine().'
    + Trace: '.$e->getTraceAsString().'
    '; + exit; +} +?> \ No newline at end of file diff --git a/templates/admin/admin.css b/templates/admin/admin.css new file mode 100644 index 0000000..1bb834c --- /dev/null +++ b/templates/admin/admin.css @@ -0,0 +1,81 @@ +#container { + background-color: lightgray; + border: 2px solid #551c1c; +} + +a:hover { + color: #551c1c; +} + +#container #top { + background-color: lightgray; + height: 70px; +} + +#container #top h1 { + top: 0%; + color: #551c1c; +} + +#container #footer { + background-color: #551c1c; +} + +#container #menu { + background-image: url('images/button_beam.gif'); +} + +.navigation { + color: #551c1c; +} + +.row:last-child .tc1, .row:last-child .tc2, .row:last-child .tc3, .row:last-child .tc4 { + border-bottom: 1px solid #551c1c; +} + +.rcol { + border: 1px solid #551c1c; +} + +.tc1 { + border-left: 1px solid #551c1c; +} + +.tc4 { + border-right: 1px solid #551c1c; +} + +.hc1, .hc2, .hc3, .hc4 { + background-image: url('images/category_beam.gif'); + border-top: 1px solid #551c1c; +} + +.hc1 { + border-left: 1px solid #551c1c; +} + +.hc4 { + border-right: 1px solid #551c1c; +} + +.tab_desc { + color: #551c1c; +} + + input[type="button"], input[type="reset"], input[type="submit"] { + background-color: #f8e3e3; + border: 1px solid #f8d6d6; + color: #A30000; +} + +input[type="button"]:hover, input[type="reset"]:hover, input[type="submit"]:hover { + background-color: #f8f1f1; +} + +.btn { + background-image: url('images/button_beam.gif'); +} + +.btn_small { + background-image: url('images/button_beam.gif'); +} \ No newline at end of file diff --git a/templates/admin/ban_form.tpl.php b/templates/admin/ban_form.tpl.php new file mode 100755 index 0000000..d059211 --- /dev/null +++ b/templates/admin/ban_form.tpl.php @@ -0,0 +1,56 @@ + + +
    + TPL['error_msg'] != '') { ?> +
    + TPL['error_msg']; ?> +
    + +
    +
    +
    +
    TPL['forum_form_name']; ?>
    +
     
    +
    +
    +
    + User: +
    +
    + +
    +
    +
    +
    + Reason: +
    +
    + +
    +
    +
    +
    +   +
    +
    + +
    +
    +
    +
    +
    + + \ No newline at end of file diff --git a/templates/admin/banlist.tpl.php b/templates/admin/banlist.tpl.php new file mode 100755 index 0000000..4ca9f89 --- /dev/null +++ b/templates/admin/banlist.tpl.php @@ -0,0 +1,36 @@ + +
    + Add ban +
    +
    +
    +
    Banlist
    +
     
    +
     
    +
    +
    +
    Username
    +
    Reason
    +
    +
    + TPL['bans_list']); $i++) + { + echo '
    '."\n"; + echo "\t\t\t".'
    '.$this->TPL['bans_list'][$i]['nick'].'
    '."\n"; + echo "\t\t\t".'
    '.$this->TPL['bans_list'][$i]['reason'].'
    '."\n"; + echo "\t\t\t".'
    + Delete +
    '; + echo "\t\t".'
    '."\n"; + } + if (count($this->TPL['bans_list']) == 0) + { + echo '
    Banlist is empty.
    '; + } + ?> +
    +
    +
    + + \ No newline at end of file diff --git a/templates/admin/cat_form.tpl.php b/templates/admin/cat_form.tpl.php new file mode 100755 index 0000000..f18b28a --- /dev/null +++ b/templates/admin/cat_form.tpl.php @@ -0,0 +1,41 @@ + + +
    + TPL['error_msg'] != '') { ?> +
    + TPL['error_msg']; ?> +
    + +
    +
    +
    +
    TPL['cat_form_name']; ?>
    +
     
    +
    + +
    +
    + Category name: +
    +
    + +
    +
    +
    +
    +   +
    +
    + +
    +
    +
    +
    +
    + + \ No newline at end of file diff --git a/templates/admin/config.tpl.php b/templates/admin/config.tpl.php new file mode 100755 index 0000000..19e66de --- /dev/null +++ b/templates/admin/config.tpl.php @@ -0,0 +1,49 @@ + + +
    + TPL['error_msg'] != '') { ?> +
    + TPL['error_msg']; ?> +
    + +
    +
    +
    +
    Overall configuration
    +
     
    +
    + +
    +
    + Forum name: +
    +
    + +
    +
    +
    +
    + Forum description: +
    +
    + +
    +
    +
    +
    +   +
    +
    + +
    +
    +
    +
    +
    + + \ No newline at end of file diff --git a/templates/admin/forum_form.tpl.php b/templates/admin/forum_form.tpl.php new file mode 100755 index 0000000..2e3aeb6 --- /dev/null +++ b/templates/admin/forum_form.tpl.php @@ -0,0 +1,76 @@ + + +
    + TPL['error_msg'] != '') { ?> +
    + TPL['error_msg']; ?> +
    + +
    +
    +
    +
    TPL['forum_form_name']; ?>
    +
     
    +
    + +
    +
    + Forum name: +
    +
    + +
    +
    +
    +
    + Forum description: +
    +
    + +
    +
    +
    +
    + Category: +
    +
    + +
    +
    +
    +
    + Forum locked: +
    +
    + TPL['lock_selected']; ?>> + Yes   + TPL['unlock_selected']; ?>> + No +
    +
    +
    +
    +   +
    +
    + +
    +
    +
    +
    +
    + + \ No newline at end of file diff --git a/templates/admin/forums.tpl.php b/templates/admin/forums.tpl.php new file mode 100755 index 0000000..1606d00 --- /dev/null +++ b/templates/admin/forums.tpl.php @@ -0,0 +1,69 @@ + +
    +
    + New Category + New Forum +
     
    + TPL['forums_list']); $i++) + { + if ($i > 0) + { + if ($this->TPL['forums_list'][$i-1]['category_id'] != $this->TPL['forums_list'][$i]['category_id']) + echo '

    +
    +
    '.$this->TPL['forums_list'][$i]['category_name'].'
    + + +
    '; + } + else + { + echo '
    +
    +
    '.$this->TPL['forums_list'][$i]['category_name'].'
    + + +
    '; + } + if ($this->TPL['forums_list'][$i]['forum_id'] != null) + { + echo '
    '."\n"; + echo "\t\t\t".'
    + '.$this->TPL['forums_list'][$i]['forum_name'].'
    + '.$this->TPL['forums_list'][$i]['forum_desc'].'
    '."\n"; + echo "\t\t\t".'
    + Edit +
    '."\n"; + echo "\t\t\t".'
    + Delete +
    '."\n"; + echo "\t\t".'
    '."\n"; + } + else + { + echo '
    No forums in this category.
    '; + } + } + ?> + TPL['forums_list']) > 0) echo '
    '; ?> +
    +
    + + \ No newline at end of file diff --git a/templates/admin/images/button_beam.gif b/templates/admin/images/button_beam.gif new file mode 100644 index 0000000..8e1af53 Binary files /dev/null and b/templates/admin/images/button_beam.gif differ diff --git a/templates/admin/images/category_beam.gif b/templates/admin/images/category_beam.gif new file mode 100644 index 0000000..da61063 Binary files /dev/null and b/templates/admin/images/category_beam.gif differ diff --git a/templates/admin/images/delete.gif b/templates/admin/images/delete.gif new file mode 100644 index 0000000..3ffd86a Binary files /dev/null and b/templates/admin/images/delete.gif differ diff --git a/templates/admin/images/lock.gif b/templates/admin/images/lock.gif new file mode 100644 index 0000000..6bd5ef0 Binary files /dev/null and b/templates/admin/images/lock.gif differ diff --git a/templates/admin/images/move.gif b/templates/admin/images/move.gif new file mode 100644 index 0000000..9fffc7d Binary files /dev/null and b/templates/admin/images/move.gif differ diff --git a/templates/admin/images/no_av.gif b/templates/admin/images/no_av.gif new file mode 100644 index 0000000..93a098c Binary files /dev/null and b/templates/admin/images/no_av.gif differ diff --git a/templates/admin/images/offline.gif b/templates/admin/images/offline.gif new file mode 100644 index 0000000..3a95107 Binary files /dev/null and b/templates/admin/images/offline.gif differ diff --git a/templates/admin/images/online.gif b/templates/admin/images/online.gif new file mode 100644 index 0000000..9ecac56 Binary files /dev/null and b/templates/admin/images/online.gif differ diff --git a/templates/admin/images/td_beam_top.gif b/templates/admin/images/td_beam_top.gif new file mode 100644 index 0000000..b322b1f Binary files /dev/null and b/templates/admin/images/td_beam_top.gif differ diff --git a/templates/admin/images/uf_logo.svg b/templates/admin/images/uf_logo.svg new file mode 100644 index 0000000..6802b6c --- /dev/null +++ b/templates/admin/images/uf_logo.svg @@ -0,0 +1,289 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + µForum + + + + diff --git a/templates/admin/images/unlock.gif b/templates/admin/images/unlock.gif new file mode 100644 index 0000000..54ff515 Binary files /dev/null and b/templates/admin/images/unlock.gif differ diff --git a/templates/admin/kopia admin.css b/templates/admin/kopia admin.css new file mode 100644 index 0000000..3080bcc --- /dev/null +++ b/templates/admin/kopia admin.css @@ -0,0 +1,489 @@ +body { + font-family: Helvetica; + font-size: 11pt; + background-color: #E5E7E9; +} + +#container { + width: 900px; + background-color: lightgray; + margin: 0 auto; + text-align: center; + border: 2px solid #551c1c; + border-collapse: collapse; + border-radius: 10px; +} + +a, a:visited { + text-decoration: none; +} + +img { +border: 0px; +} +a:hover { + color: #551c1c; + text-decoration: underline; +} + +a { + color: #000000; +} + +#container #top { + width: 100%; + background-color: lightgray; + height: 70px; + vertical-align: middle; + padding-top: 20px; + border-bottom: 1px solid #777777; + border-top-left-radius: 10px; + border-top-right-radius: 10px; +} + +#container #userpanel { + text-align: right; + font-size: 0.8em; + width: 100%; +} + +#container #navi_bar +{ + padding-left: 10px; + text-align: left; + width: 100%; +} + +#container #top h1 +{ + margin: 0px; + position: relative; + top: 0%; + color: #551c1c; + font-size: 36pt; + font-weight: bold; +} + +#container #top h2 +{ + color: #005AE5; + font-size: 20px; + text-decoration: none; + font-weight: bold; +} + +#container #footer +{ + width: 100%; + background-color: #551c1c; + font-size: 8pt; + color: #FFFFFF; + height: 18px; + line-height: 18px; + border-bottom-left-radius: 5px; + border-bottom-right-radius: 5px; + box-shadow: 0 8px 6px -6px black; +} + +#container #footer a +{ + color: #FFFFFF; +} + +#contanier #footer a:visited +{ + color: #FFFFFF; +} + +#container #content { + text-align: left; + min-height: 200px; + padding: 10px; +} + +#container #content h3 { + margin-left: 20px; + color: gray; + font-size: 1.5em; +} +#container #content table { + border: 1px solid; + border-collapse: collapse; +} +#container #content table td { + border: 1px solid; + border-color: orange; + border-collapse: collapse; + font-size: 10pt; + background-color: #ffffbd; + text-align: center; +} + +#container #content table .heading { + background-color: orange; + color: #FFFFFF; + font-weight: bold; +} +#container #menu { + text-align: center; + margin: 0 auto; + width: 100%; + height: 50px; + background-color: #99CCFF; + background-image: url('images/button_beam.gif'); +} +#container #menu ul { + list-style-type: none; + margin: 0px; + padding: 0px; +} + +#container #menu li { + display: inline-block; + border-right: 1px #9A9A9A solid; + height: 37px; + width: 120px; + padding-top: 13px; + margin: auto -4px auto auto; + +} +#container #menu li:hover { +} + +#container #menu li a { + color: #FFFFFF; + font-weight: bold; + font-family: Verdana; + font-size: 14px; + font-weight: bold; +} + +#container #menu li:last-child { + border: 0px; +} +.sect +{ + color: #434354; + font-family: Verdana; + font-size: 10pt; + font-weight: bold; + text-decoration: none; +} + + +.navigation { + color: #551c1c; + text-decoration: none; + font-size: 12px; + font-weight: bold; +} + +.forum_table { + display: table; + width: 100%; + border-collapse: separate; + box-shadow: 0 8px 6px -6px black; +} + +.fsmall +{ + color: #434354; + font-size: 8pt; + text-decoration: none; +} + +.row { + display: table-row; + width: 100%; +} + + + + + +.row:last-child .tc1, .row:last-child .tc2, .row:last-child .tc3, .row:last-child .tc4 +{ + border-bottom: 1px solid #551c1c; + +} + +.rcol +{ + display: table-caption; + border: 1px solid #551c1c; + border-collapse: collapse; + background-color: #e1f0ff; + padding: 3px; + vertical-align: middle; + border-top: 0px; + caption-side: bottom; + text-align: center; + font-style: italic; +} + +.tc1, .tc2, .tc3, .tc4 +{ + display: table-cell; + background-color: #F0F8FF; + padding: 3px; + vertical-align: middle; + word-wrap: break-word; +} + +.tc1 +{ + border-left: 1px solid #551c1c; +} + +.tc2, .tc3 +{ + vertical-align: middle; + text-align: center; +} + +.tc4 { + text-align: center; + vertical-align: middle; + width: 150px; + border-right: 1px solid #551c1c; +} + +.hc1, .hc2, .hc3, .hc4 +{ + color: #FFFFFF; + font-weight: bold; + background-color: yellow; + vertical-align: middle; + display: table-cell; + padding-left: 15px; + background-image: url('images/category_beam.gif'); + height: 30px; + border-top: 1px solid #551c1c; + word-wrap: break-word; +} + +.hc1 { + border-top-left-radius: 10px; + border-left: 1px solid #551c1c; +} + +.hc4 { + border-top-right-radius: 10px; + border-right: 1px solid #551c1c; + width: 150px; +} + + +.tab_desc { + text-align: center; + font-weight: bold; + color: #551c1c; + background-image: url('images/td_beam_top.gif'); + height: 19px; + +} + +.lc { + width: 30%; + text-align: right; + margin-right: 10px; + +} + +.rc { + width: 70%; + text-align: left; + margin-left: 10px; +} +.rc input[type="text"], input[type="password"], input[type="email"] { + width: 200px; +} + + input[type="button"], input[type="reset"], input[type="submit"] { + border-radius: 5px; + background-color: #f8e3e3; + padding: 5px; + border: 1px solid #f8d6d6; + min-width: 30px; + font-size: 12px; + color: #A30000; + cursor: pointer; +} + +input[type="button"]:hover, input[type="reset"]:hover, input[type="submit"]:hover +{ + background-color: #f8f1f1; +} + +#signature { + width: 490px; + height: 60px; + resize: vertical; +} + +#post { + width: 490px; + height: 180px; + resize: vertical; + +} + +#signature, #post, input[type="text"], input[type="password"], input[type="email"], select +{ + border-radius: 5px; + border: 1px solid #C7E2FB; + min-height: 20px; + font-size: 12px; + background-color: #FFFFE8; +} + +.error_form +{ + margin: 0 auto; + text-align: center; + width: 90%; + border: 1px solid #FF0000; + background-color: #FFCC99; + padding: 10px; + color: #FF0000; + border-radius: 10px; + font-weight: bold; +} + +.fadmin, .fmod +{ + font-weight: bold; +} +.fmod +{ + color: darkgreen; +} + +.fadmin +{ + color: orange; +} + +.btn +{ + width: 90px; + height: 30px; + color: #FFFFFF; + font-weight: bold; + text-align: center; + font-size: 1em; + background-image: url('images/button_beam.gif'); + border-radius: 10px; + line-height: 30px; + box-shadow: 0 8px 6px -6px black; +} + +.btn_small +{ + width: 60px; + height: 20px; + color: #FFFFFF; + font-weight: bold; + text-align: center; + font-size: 0.8em; + background-image: url('images/button_beam.gif'); + border-radius: 10px; + margin: 0 auto; + line-height: 20px; + margin-top: 3px; + box-shadow: 0 8px 6px -6px black; +} + +.ut +{ + padding: 0px; + border-left: 0px; +} + +.tc1 .forum_table .tc1, .tc1 .forum_table .tc2, .tc1 .forum_table .tc3 { + border: 0px; + border-top: 1px solid lightgray; +} + +.mod_pool +{ + margin: 0 auto; + width: 90%; + background-color: #FFFF99; + text-align: center; + padding: 5px; + border: 1px solid orange; + border-radius: 10px; +} + +hr { + border: 0; + border-bottom: 1px dashed #ccc; + background: #999; + width: 50%; + margin: 0; + margin-top: 5px; +} + +.hcpost +{ + height: 10px; +} + +.f_hc4 +{ + text-align: right; + padding-right: 10px; +} + +.post_3c +{ + width: 120px; +} +.f_tc2 +{ + width: 120px; + vertical-align: top; + height: 150px; + text-align: center; +} + +.topic_mod +{ + width: 80px; + float: right; +} +.p_uinfo +{ + width: 38%; +} + +.post_content +{ + vertical-align: top; + position: relative; + text-align: left; + max-width: 500px; +} + +.row .hcpost a { + color: #FFFFFF; +} + +.qpost +{ + background-color: #DDDAC5; + width: 95%; + font-style: italic; + box-shadow: 7px 8px 6px -3px gray; + padding: 5px; +} + +.cpost +{ + background-color: #C5DDCC; + width: 95%; + font-family: Courier New; + box-shadow: 7px 8px 6px -3px gray; + padding: 5px; +} \ No newline at end of file diff --git a/templates/admin/main.tpl.php b/templates/admin/main.tpl.php new file mode 100755 index 0000000..cc34b50 --- /dev/null +++ b/templates/admin/main.tpl.php @@ -0,0 +1,112 @@ + + +
    + + Welcome in µForum Admin Control Panel!
    + Choose option from menu to manage forum.
    +

    +
    +
    +
    Forum statistics
    +
     
    +
    +
    +
    + Installation date: +
    +
    + TPL['installation_date']; ?> +
    +
    +
    +
    + Topics total: +
    +
    + TPL['topics_total']; ?> +
    +
    + +
    +
    + Posts total: +
    +
    + TPL['posts_total']; ?> +
    +
    + +
    +
    + Users total: +
    +
    + TPL['users_total']; ?> +
    +
    + +
    +
    + Logged users total (last 5 min): +
    +
    + TPL['logged_users_total']; ?> +
    +
    + +
    +
    + Script version: +
    +
    + TPL['script_version']; ?> +
    +
    + +
    +
    + Updates: +
    +
    + in future... +
    +
    +
    +
    +
    +
    +
    Logged users (last 5 min)
    +
     
    +
     
    +
    +
    +
    Username
    +
    Rank
    +
    IP
    +
    + TPL['logged_users']); $i++) + { + echo ' +
    +
    '.$this->TPL['logged_users'][$i]['nick'].'
    +
    '.$this->getRankLevel($this->TPL['logged_users'][$i]['rank']).'
    +
    '.$this->TPL['logged_users'][$i]['IP'].'
    +
    '; + } + + if (count($this->TPL['logged_users']) == 0) + echo '
    No logged users.
    '; + ?> +
    +
    + + \ No newline at end of file diff --git a/templates/admin/overall_header.tpl.php b/templates/admin/overall_header.tpl.php new file mode 100644 index 0000000..652f2c0 --- /dev/null +++ b/templates/admin/overall_header.tpl.php @@ -0,0 +1,46 @@ + + + +<?= $this->TPL['meta_title']; ?> + + + + + + + +
    +
    +

    µForum ACP

    +
    + +
    +
    + TPL['is_logged']) { ?> + You are logged as: TPL['my_nick'] ?> + + Welcome Guest! You are not logged. +
    + Actual time: TPL['actual_time']; ?>
    +
    +
    + \ No newline at end of file diff --git a/templates/admin/userlist.tpl.php b/templates/admin/userlist.tpl.php new file mode 100755 index 0000000..e3029d9 --- /dev/null +++ b/templates/admin/userlist.tpl.php @@ -0,0 +1,73 @@ + +
    +
    +
    +
    +
    Users list
    +
     
    +
     
    +
     
    +
     
    +
     
    +
    +
    +
    Username
    +
    Joined
    +
    Last visit
    +
    Posts
    +
    +
    +
    + TPL['users_list']); $i++) + { + echo '
    '."\n"; + echo "\t\t\t".''."\n"; + echo "\t\t\t".'
    '.$this->TPL['users_list'][$i]['regdate'].'
    '."\n"; + echo "\t\t\t".'
    '.(($this->TPL['users_list'][$i]['lastvisit']!= null) ? $this->TPL['users_list'][$i]['lastvisit'] : 'Never').'
    '."\n"; + echo "\t\t\t".'
    '.$this->TPL['users_list'][$i]['post_count'].'
    '."\n"; + echo "\t\t\t".'
    + Edit
    '."\n"; + echo "\t\t\t".' '."\n"; + echo "\t\t".'
    '."\n"; + } + ?> + + +
    +
    +
    +
    +
    Options
    +
    +
    +
    +
    + Sort users by: + +     + TPL['desc_checked']; ?> />Descending +        +
    +
    +
    + +
    +
    + + \ No newline at end of file diff --git a/templates/confirm_action.tpl.php b/templates/confirm_action.tpl.php new file mode 100755 index 0000000..bdad268 --- /dev/null +++ b/templates/confirm_action.tpl.php @@ -0,0 +1,34 @@ + + +
    +
    +
    +
    +
    +
    Confirm your action
    +
    + +
    +
    + TPL['message']; ?> +
    + +
    +
    +
    + + + +
    + +
    +
    +
    +
    + + \ No newline at end of file diff --git a/templates/edprofile.tpl.php b/templates/edprofile.tpl.php new file mode 100755 index 0000000..8b38c2a --- /dev/null +++ b/templates/edprofile.tpl.php @@ -0,0 +1,175 @@ + + + +
    + TPL['error_msg'] != '') { ?> +
    + TPL['error_msg']; ?> +
    + +
    +
    +
    +
    Basic informations
    +
     
    +
    + +
    +
    + Nick: +
    +
    + TPL['is_admin']) {?> + + + TPL['nick']; ?> + + +
    +
    + TPL['is_admin']) {?> +
    +
    + Old password: +
    +
    + (type only if you want to change password or email.) +
    +
    + +
    +
    + New password: +
    +
    + (type only if you want to change it.) +
    +
    +
    +
    + Confirm password: +
    +
    + +
    +
    +
    +
    + Email address: +
    +
    + +
    +
    +
    +
    +   +
    +
    + +
    +
    +
    +
    +
    +
    +
    Profile informations
    +
     
    +
    + +
    +
    + Location: +
    +
    + +
    +
    +
    +
    + Signature: +
    +
    + +
    +
    +
    +
    + Avatar: +
    +
    + Current avatar:
    + user avatar
    + TPL['avatar'] != null) { ?> Delete avatar
    + + +
    +
    +
    +
    +   +
    +
    + +
    +
    +
    + TPL['is_admin']) {?> +
    +
    +
    +
    Admin options
    +
     
    +
    +
    +
    + User rank: +
    +
    + TPL['user_selected']; ?> > + User   + TPL['mod_selected']; ?>> + Mod   + TPL['admin_selected']; ?>> + Admin +
    +
    +
    +
    +   +
    +
    + +
    +
    +
    + + +
    +
    + + \ No newline at end of file diff --git a/templates/forum_message.tpl.php b/templates/forum_message.tpl.php new file mode 100755 index 0000000..f13fb24 --- /dev/null +++ b/templates/forum_message.tpl.php @@ -0,0 +1,28 @@ + + +TPL['url'] != '') { ?> + + + +
    +
    +
    +
    +
    Forum message
    +
    + +
    +
    + TPL['message']; ?> +
    + +
    +
    +
    + + \ No newline at end of file diff --git a/templates/images/button_beam.gif b/templates/images/button_beam.gif new file mode 100644 index 0000000..d909d5b Binary files /dev/null and b/templates/images/button_beam.gif differ diff --git a/templates/images/category_beam.gif b/templates/images/category_beam.gif new file mode 100644 index 0000000..c86276d Binary files /dev/null and b/templates/images/category_beam.gif differ diff --git a/templates/images/delete.gif b/templates/images/delete.gif new file mode 100644 index 0000000..3ffd86a Binary files /dev/null and b/templates/images/delete.gif differ diff --git a/templates/images/lock.gif b/templates/images/lock.gif new file mode 100644 index 0000000..6bd5ef0 Binary files /dev/null and b/templates/images/lock.gif differ diff --git a/templates/images/move.gif b/templates/images/move.gif new file mode 100644 index 0000000..9fffc7d Binary files /dev/null and b/templates/images/move.gif differ diff --git a/templates/images/no_av.gif b/templates/images/no_av.gif new file mode 100644 index 0000000..93a098c Binary files /dev/null and b/templates/images/no_av.gif differ diff --git a/templates/images/offline.gif b/templates/images/offline.gif new file mode 100644 index 0000000..3a95107 Binary files /dev/null and b/templates/images/offline.gif differ diff --git a/templates/images/online.gif b/templates/images/online.gif new file mode 100644 index 0000000..9ecac56 Binary files /dev/null and b/templates/images/online.gif differ diff --git a/templates/images/td_beam_top.gif b/templates/images/td_beam_top.gif new file mode 100644 index 0000000..b322b1f Binary files /dev/null and b/templates/images/td_beam_top.gif differ diff --git a/templates/images/uf_logo.svg b/templates/images/uf_logo.svg new file mode 100644 index 0000000..6802b6c --- /dev/null +++ b/templates/images/uf_logo.svg @@ -0,0 +1,289 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + µForum + + + + diff --git a/templates/images/unlock.gif b/templates/images/unlock.gif new file mode 100644 index 0000000..54ff515 Binary files /dev/null and b/templates/images/unlock.gif differ diff --git a/templates/kopia main.css b/templates/kopia main.css new file mode 100644 index 0000000..9bd7967 --- /dev/null +++ b/templates/kopia main.css @@ -0,0 +1,489 @@ +body { + font-family: Helvetica; + font-size: 11pt; + background-color: #E5E7E9; +} + +#container { + width: 900px; + background-color: #CEE3F6; + margin: 0 auto; + text-align: center; + border: 2px solid navy; + border-collapse: collapse; + border-radius: 10px; +} + +a, a:visited { + text-decoration: none; +} + +img { +border: 0px; +} +a:hover { + color: navy; + text-decoration: underline; +} + +a { + color: #000000; +} + +#container #top { + width: 100%; + background-color: #CEE3F6; + height: 140px; + vertical-align: middle; + padding-top: 20px; + border-bottom: 1px solid #777777; + border-top-left-radius: 10px; + border-top-right-radius: 10px; +} + +#container #userpanel { + text-align: right; + font-size: 0.8em; + width: 100%; +} + +#container #navi_bar +{ + padding-left: 10px; + text-align: left; + width: 100%; +} + +#container #top h1 +{ + margin: 0px; + position: relative; + top: 30%; + color: navy; + font-size: 36pt; + font-weight: bold; +} + +#container #top h2 +{ + color: #005AE5; + font-size: 20px; + text-decoration: none; + font-weight: bold; +} + +#container #footer +{ + width: 100%; + background-color: navy; + font-size: 8pt; + color: #FFFFFF; + height: 18px; + line-height: 18px; + border-bottom-left-radius: 5px; + border-bottom-right-radius: 5px; + box-shadow: 0 8px 6px -6px black; +} + +#container #footer a +{ + color: #FFFFFF; +} + +#contanier #footer a:visited +{ + color: #FFFFFF; +} + +#container #content { + text-align: left; + min-height: 200px; + padding: 10px; +} + +#container #content h3 { + margin-left: 20px; + color: gray; + font-size: 1.5em; +} +#container #content table { + border: 1px solid; + border-collapse: collapse; +} +#container #content table td { + border: 1px solid; + border-color: orange; + border-collapse: collapse; + font-size: 10pt; + background-color: #ffffbd; + text-align: center; +} + +#container #content table .heading { + background-color: orange; + color: #FFFFFF; + font-weight: bold; +} +#container #menu { + text-align: center; + margin: 0 auto; + width: 100%; + height: 50px; + background-color: #99CCFF; + background-image: url('images/button_beam.gif'); +} +#container #menu ul { + list-style-type: none; + margin: 0px; + padding: 0px; +} + +#container #menu li { + display: inline-block; + border-right: 1px #9A9A9A solid; + height: 37px; + width: 120px; + padding-top: 13px; + margin: auto -4px auto auto; + +} +#container #menu li:hover { +} + +#container #menu li a { + color: #FFFFFF; + font-weight: bold; + font-family: Verdana; + font-size: 14px; + font-weight: bold; +} + +#container #menu li:last-child { + border: 0px; +} +.sect +{ + color: #434354; + font-family: Verdana; + font-size: 10pt; + font-weight: bold; + text-decoration: none; +} + + +.navigation { + color: navy; + text-decoration: none; + font-size: 12px; + font-weight: bold; +} + +.forum_table { + display: table; + width: 100%; + border-collapse: separate; + box-shadow: 0 8px 6px -6px black; +} + +.fsmall +{ + color: #434354; + font-size: 8pt; + text-decoration: none; +} + +.row { + display: table-row; + width: 100%; +} + + + + + +.row:last-child .tc1, .row:last-child .tc2, .row:last-child .tc3, .row:last-child .tc4 +{ + border-bottom: 1px solid #040074; + +} + +.rcol +{ + display: table-caption; + border: 1px solid #040074; + border-collapse: collapse; + background-color: #e1f0ff; + padding: 3px; + vertical-align: middle; + border-top: 0px; + caption-side: bottom; + text-align: center; + font-style: italic; +} + +.tc1, .tc2, .tc3, .tc4 +{ + display: table-cell; + background-color: #F0F8FF; + padding: 3px; + vertical-align: middle; + word-wrap: break-word; +} + +.tc1 +{ + border-left: 1px solid #040074; +} + +.tc2, .tc3 +{ + vertical-align: middle; + text-align: center; +} + +.tc4 { + text-align: center; + vertical-align: middle; + width: 150px; + border-right: 1px solid #040074; +} + +.hc1, .hc2, .hc3, .hc4 +{ + color: #FFFFFF; + font-weight: bold; + background-color: yellow; + vertical-align: middle; + display: table-cell; + padding-left: 15px; + background-image: url('images/category_beam.gif'); + height: 30px; + border-top: 1px solid #040074; + word-wrap: break-word; +} + +.hc1 { + border-top-left-radius: 10px; + border-left: 1px solid #040074; +} + +.hc4 { + border-top-right-radius: 10px; + border-right: 1px solid #040074; + width: 150px; +} + + +.tab_desc { + text-align: center; + font-weight: bold; + color: blue; + background-image: url('images/td_beam_top.gif'); + height: 19px; + +} + +.lc { + width: 30%; + text-align: right; + margin-right: 10px; + +} + +.rc { + width: 70%; + text-align: left; + margin-left: 10px; +} +.rc input[type="text"], input[type="password"], input[type="email"] { + width: 200px; +} + + input[type="button"], input[type="reset"], input[type="submit"] { + border-radius: 5px; + background-color: #C7E2FB; + padding: 5px; + border: 1px solid #AACAE8; + min-width: 30px; + font-size: 12px; + color: #204E7A; + cursor: pointer; +} + +input[type="button"]:hover, input[type="reset"]:hover, input[type="submit"]:hover +{ + background-color: #e3effb; +} + +#signature { + width: 490px; + height: 60px; + resize: vertical; +} + +#post { + width: 490px; + height: 180px; + resize: vertical; + +} + +#signature, #post, input[type="text"], input[type="password"], input[type="email"], select +{ + border-radius: 5px; + border: 1px solid #C7E2FB; + min-height: 20px; + font-size: 12px; + background-color: #FFFFE8; +} + +.error_form +{ + margin: 0 auto; + text-align: center; + width: 90%; + border: 1px solid #FF0000; + background-color: #FFCC99; + padding: 10px; + color: #FF0000; + border-radius: 10px; + font-weight: bold; +} + +.fadmin, .fmod +{ + font-weight: bold; +} +.fmod +{ + color: darkgreen; +} + +.fadmin +{ + color: orange; +} + +.btn +{ + width: 90px; + height: 30px; + color: #FFFFFF; + font-weight: bold; + text-align: center; + font-size: 1em; + background-image: url('images/button_beam.gif'); + border-radius: 10px; + line-height: 30px; + box-shadow: 0 8px 6px -6px black; +} + +.btn_small +{ + width: 60px; + height: 20px; + color: #FFFFFF; + font-weight: bold; + text-align: center; + font-size: 0.8em; + background-image: url('images/button_beam.gif'); + border-radius: 10px; + margin: 0 auto; + line-height: 20px; + margin-top: 3px; + box-shadow: 0 8px 6px -6px black; +} + +.ut +{ + padding: 0px; + border-left: 0px; +} + +.tc1 .forum_table .tc1, .tc1 .forum_table .tc2, .tc1 .forum_table .tc3 { + border: 0px; + border-top: 1px solid lightgray; +} + +.mod_pool +{ + margin: 0 auto; + width: 90%; + background-color: #FFFF99; + text-align: center; + padding: 5px; + border: 1px solid orange; + border-radius: 10px; +} + +hr { + border: 0; + border-bottom: 1px dashed #ccc; + background: #999; + width: 50%; + margin: 0; + margin-top: 5px; +} + +.hcpost +{ + height: 10px; +} + +.f_hc4 +{ + text-align: right; + padding-right: 10px; +} + +.post_3c +{ + width: 120px; +} +.f_tc2 +{ + width: 120px; + vertical-align: top; + height: 150px; + text-align: center; +} + +.topic_mod +{ + width: 80px; + float: right; +} +.p_uinfo +{ + width: 38%; +} + +.post_content +{ + vertical-align: top; + position: relative; + text-align: left; + max-width: 500px; +} + +.row .hcpost a { + color: #FFFFFF; +} + +.qpost +{ + background-color: #DDDAC5; + width: 95%; + font-style: italic; + box-shadow: 7px 8px 6px -3px gray; + padding: 5px; +} + +.cpost +{ + background-color: #C5DDCC; + width: 95%; + font-family: Courier New; + box-shadow: 7px 8px 6px -3px gray; + padding: 5px; +} \ No newline at end of file diff --git a/templates/kopia viewtopic.tpl.php b/templates/kopia viewtopic.tpl.php new file mode 100755 index 0000000..085956c --- /dev/null +++ b/templates/kopia viewtopic.tpl.php @@ -0,0 +1,146 @@ + +
    + TPL['topic_info']['forum_locked'] == false && $this->TPL['topic_info']['topic_locked'] == false) { ?> + +
    + Reply +
    +
    + +
    + Locked +
    + +
    + +TPL['posts_list']); $i++) + { + echo ' +
    +
    +
     
    +
     
    +
    Post #'.($i+1).'
    +
    +
    +
    '; + if ($this->TPL['posts_list'][$i]['nick'] != null) + echo ''.$this->colorRank($this->TPL['posts_list'][$i]['nick'], $this->TPL['posts_list'][$i]['user_rank']).''; + else + echo 'Anonymous'; + echo '
    '; + + if ($this->TPL['posts_list'][$i]['avatar'] != null) + echo 'user avatar'; + else + echo 'user avatar'; + echo ' +
    +
    '; + + echo BBCode($this->TPL['posts_list'][$i]['content']); + + if ($this->TPL['posts_list'][$i]['signature'] != null) + echo ' +

    +
    + '.BBCode($this->TPL['posts_list'][$i]['signature']).'

    '; + echo ' +
    +
    + Posted: '.$this->TPL['posts_list'][$i]['date'].'
    + +
    + Quote +
    +
    '; + if ($this->TPL['my_id'] == $this->TPL['posts_list'][$i]['user_id']) + echo ' + +
    + Edit +
    +
    '; + + echo '
    '; + + if ($this->TPL['my_rank'] >= RANK_MOD) + echo ' +
    + Mod options
    + +
    + Edit +
    +
    + +
    + X +
    +
    +
    '; + echo ' +
    +
    + +
    +
    + Status: user status +
    +
    +
    +
    + Posts: '.$this->TPL['posts_list'][$i]['user_post_count'].' +
    +
    + Joined: '.$this->TPL['posts_list'][$i]['regdate'].' +
    +
    + Last visit: '.(($this->TPL['posts_list'][$i]['lastvisit']!= null) ? $this->TPL['posts_list'][$i]['lastvisit'] : 'Never').' +
    +
    +
    +
    Rank: '.$this->getRankLevel($this->TPL['posts_list'][$i]['user_rank']).'
    +
    +
    +
    '; + } + ?> + + TPL['topic_info']['forum_locked'] == false && $this->TPL['topic_info']['topic_locked'] == false) { ?> + +
    + Reply +
    +
    + +
    + Locked +
    + + + TPL['my_rank'] >= RANK_MOD) { ?> +
    +
    +
    Actions
    +
    +
    + +
    +
    + +
     
    +
    + + \ No newline at end of file diff --git a/templates/login_form.tpl.php b/templates/login_form.tpl.php new file mode 100755 index 0000000..d386f32 --- /dev/null +++ b/templates/login_form.tpl.php @@ -0,0 +1,54 @@ + +
    + + +

    You must enable cookies if you want log in

    + TPL['error_msg'] != '') { ?> +
    + TPL['error_msg']; ?> +
    + +
    +
    +
    +
    Log in
    +
     
    +
    + +
    +
    + Nick: +
    +
    + +
    +
    +
    +
    + Password: +
    +
    + +
    +
    +
    +
    +   +
    +
    + +
    +
    +
    +
    + + \ No newline at end of file diff --git a/templates/main.css b/templates/main.css new file mode 100644 index 0000000..719f561 --- /dev/null +++ b/templates/main.css @@ -0,0 +1,81 @@ +#container { + background-color: #CEE3F6; + border: 2px solid navy; +} + +a:hover { + color: navy; +} + +#container #top { + background-color: #CEE3F6; + height: 140px; +} + +#container #top h1 { + top: 30%; + color: navy; +} + +#container #footer { + background-color: navy; +} + +#container #menu { + background-image: url('images/button_beam.gif'); +} + +.navigation { + color: navy; +} + +.row:last-child .tc1, .row:last-child .tc2, .row:last-child .tc3, .row:last-child .tc4 { + border-bottom: 1px solid #040074; +} + +.rcol { + border: 1px solid #040074; +} + +.tc1 { + border-left: 1px solid #040074; +} + +.tc4 { + border-right: 1px solid #040074; +} + +.hc1, .hc2, .hc3, .hc4 { + background-image: url('images/category_beam.gif'); + border-top: 1px solid #040074; +} + +.hc1 { + border-left: 1px solid #040074; +} + +.hc4 { + border-right: 1px solid #040074; +} + +.tab_desc { + color: blue; +} + +input[type="button"], input[type="reset"], input[type="submit"] { + background-color: #C7E2FB; + border: 1px solid #AACAE8; + color: #204E7A; +} + +input[type="button"]:hover, input[type="reset"]:hover, input[type="submit"]:hover { + background-color: #e3effb; +} + +.btn { + background-image: url('images/button_beam.gif'); +} + +.btn_small { + background-image: url('images/button_beam.gif'); +} \ No newline at end of file diff --git a/templates/main.tpl.php b/templates/main.tpl.php new file mode 100755 index 0000000..0ff4744 --- /dev/null +++ b/templates/main.tpl.php @@ -0,0 +1,123 @@ + + +
    + + TPL['forums_list']); $i++) + { + if ($this->TPL['forums_list'][$i]['forum_id'] != null) + { + if ($i > 0) + { + if ($this->TPL['forums_list'][$i-1]['category_id'] != $this->TPL['forums_list'][$i]['category_id']) + echo '

    +
    +
    '.$this->TPL['forums_list'][$i]['category_name'].'
    +
     
    +
     
    +
     
    +
    +
    +
    Forum name
    +
    Topics
    +
    Posts
    +
    Last Post
    +
    '; + } + else + { + echo '
    +
    +
    '.$this->TPL['forums_list'][$i]['category_name'].'
    +
     
    +
     
    +
     
    +
    +
    +
    Forum name
    +
    Topics
    +
    Posts
    +
    Last Post
    +
    '; + } + echo '
    '."\n"; + echo "\t\t\t".'
    '.$this->TPL['forums_list'][$i]['forum_name'].'
    '.$this->TPL['forums_list'][$i]['forum_desc'].'
    '."\n"; + echo "\t\t\t".'
    '.$this->TPL['forums_list'][$i]['topic_count'].'
    '."\n"; + echo "\t\t\t".'
    '.$this->TPL['forums_list'][$i]['post_count'].'
    '."\n"; + + if ($this->TPL['forums_list'][$i]['lastpost_post_id'] != null) + { + $lastpost = ''.$this->TPL['forums_list'][$i]['lastpost_date'].'
    Topic #'.$this->TPL['forums_list'][$i]['lastpost_topic_id'].': '; + if ($this->TPL['forums_list'][$i]['lastpost_user_id'] != null) + $lastpost .= ''.$this->colorRank($this->TPL['forums_list'][$i]['lastpost_nick'], $this->TPL['forums_list'][$i]['lastpost_user_rank']).''; + else + $lastpost .= 'Anonymous'; + $lastpost .= '
    '; + } + else + { + $lastpost = 'No posts'; + } + + echo "\t\t\t".'
    '.$lastpost.'
    '."\n"; + echo "\t\t".'
    '."\n"; + + $items++; + } + } + + if ($items > 0) + echo '
    '; + else + { + echo '
    +
    +
    Forum message
    +
    +
    +
    No forums
    +
    +
    '; + } + ?> + +
    +
    +
    +
    Statistics
    +
    +
    +
    + Our users have written TPL['posts_count']; ?> posts.
    + We have TPL['users_count']; ?> unique users.
    + Last registered user: TPL['last_user']['nick']; ?>
    + Users ranks: AdminMod • User
    + This forum is browsing by TPL['logged_users_count']; ?> logged users(list):
    + TPL['logged_users_count'] == 0) echo 'none.'; + else + for ($i=0; $iTPL['logged_users']); $i++) + { + echo ''.$this->colorRank($this->TPL['logged_users'][$i]['nick'], $this->TPL['logged_users'][$i]['rank']).''; + + if ($iTPL['logged_users'])-1) + echo ', '; + } + + + ?> +
    +
    +
    +
    + + \ No newline at end of file diff --git a/templates/move_topic.tpl.php b/templates/move_topic.tpl.php new file mode 100755 index 0000000..f3dca35 --- /dev/null +++ b/templates/move_topic.tpl.php @@ -0,0 +1,67 @@ + + +
    +
    +
    +
    +
    +
    Move topic to another forum
    +
     
    +
    + +
    +
    + Topic title: +
    +
    + TPL['topic_info']['topic_title']; ?> +
    + + +
    + +
    +
    + Topic is in forum: +
    +
    + TPL['topic_info']['forum_name']; ?> +
    + + +
    + +
    +
    + Select a new forum: +
    +
    + +
    + + +
    +
    +
    +   +
    +
    + + + +
    + +
    +
    +
    +
    + + \ No newline at end of file diff --git a/templates/overall_footer.tpl.php b/templates/overall_footer.tpl.php new file mode 100644 index 0000000..f48035a --- /dev/null +++ b/templates/overall_footer.tpl.php @@ -0,0 +1,6 @@ + +
    + + \ No newline at end of file diff --git a/templates/overall_header.tpl.php b/templates/overall_header.tpl.php new file mode 100644 index 0000000..dc704bf --- /dev/null +++ b/templates/overall_header.tpl.php @@ -0,0 +1,56 @@ + + + +<?= $this->TPL['meta_title']; ?> + + + + + + + +
    +
    +
    µF logo
    +
    +

    TPL['forum_name']; ?>

    +

    TPL['forum_desc']; ?>

    +
    +
    + +
    +
    + TPL['is_logged']) { ?> + You are logged as: TPL['my_nick'] ?> + + Welcome Guest! You are not logged. +
    + Actual time: TPL['actual_time']; ?>
    + TPL['my_rank'] == RANK_ADMIN ) { ?> + Go to ACP » + +
    +
    + \ No newline at end of file diff --git a/templates/posting.tpl.php b/templates/posting.tpl.php new file mode 100755 index 0000000..bb6130a --- /dev/null +++ b/templates/posting.tpl.php @@ -0,0 +1,126 @@ + + +
    + TPL['error_msg'] != '') { ?> +
    + TPL['error_msg']; ?> +
    + + + TPL['preview'])) { ?> +
    +
    +
    Post preview
    +
    + +
    +
    + TPL['preview']); ?> +
    +
    +
    +
    + + + +
    + TPL['topic'])) { ?> +
    +
    +
    Topic information
    +
     
    +
    + +
    +
    + Title: +
    +
    + +
    +
    +
    +
    + + +
    +
    +
    Post information
    +
     
    +
    + +
    +
    + Emoticons: +
    +
    +

    + Turn on JavaScript to enable BBCode and emoticons buttons. +

    + +
    +
    +
    +
    + +
    +
    + +
    +
    +
    +
    +   +
    +
    + + + +
    +
    +
    + +
    +
    + + \ No newline at end of file diff --git a/templates/register_form.tpl.php b/templates/register_form.tpl.php new file mode 100755 index 0000000..b42d338 --- /dev/null +++ b/templates/register_form.tpl.php @@ -0,0 +1,83 @@ + + + + +
    + TPL['error_msg'] != '') { ?> +
    + TPL['error_msg']; ?> +
    + +
    +
    +
    +
    Register
    +
     
    +
    + +
    +
    + Nick: +
    +
    + + + +
    +
    +
    +
    + Password: +
    +
    + +
    +
    +
    +
    + Confirm password: +
    +
    + +
    +
    +
    +
    + Email address: +
    +
    + +
    +
    + +
    +
    +   +
    +
    + +
    +
    +
    +
    + + \ No newline at end of file diff --git a/templates/scripts/chkcookie.js b/templates/scripts/chkcookie.js new file mode 100644 index 0000000..73d588a --- /dev/null +++ b/templates/scripts/chkcookie.js @@ -0,0 +1,33 @@ +function create_cookie(name, value, days) +{ + if (days) + { + var date = new Date(); + date.setTime(date.getTime()+(days*24*3600*1000)); + + var expires ="; expires="+date.toGMTString(); + } + else + var expires = ""; + + document.cookie += name+"="+value+expires+"; path=/"; +} + +function read_cookie(name) +{ + var nameEQ = name + "="; + var ca = document.cookie.split(';'); + for (var i=0; i< ca.length; i++) + { + var c = ca[i]; + while (c.charAt(0) == ' ') c = c.substring(1, c.length); + if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length, c.length); + } + + return null; +} + +function erase_cookie(name) +{ + create_cookie(name, "", -1); +} \ No newline at end of file diff --git a/templates/scripts/nick.js b/templates/scripts/nick.js new file mode 100644 index 0000000..2263afd --- /dev/null +++ b/templates/scripts/nick.js @@ -0,0 +1,62 @@ +var ajax; + +function init() { + initAjax(); +} + +function initAjax() { + try + { + ajax = new XMLHttpRequest(); + } + catch(e) // IE <= 6 + { + var XmlHttpVersions = [ + 'MSXML2.XMLHTTP.6.0', + 'MSXML2.XMLHTTP.5.0', + 'MSXML2.XMLHTTP.4.0', + 'MSXML2.XMLHTTP.3.0', + 'MSXML2.XMLHTTP', + 'Microsoft.XMLHTTP' + ]; + for (var i=0; i < XmlHttpVersions.length && null === ajax; i++) + { + try + { + ajax = new ActiveXObject(XmlHttpVersions[i]); + } catch (e) {} + } + + if (null === ajax) + { + throw new Error('AJAX Error'); + } + } + + return true; +} + +function response() { + if (ajax.readyState != 4 || ajax.status != 200) + return; + if (ajax.responseText == 'true') + { + document.getElementById('nick-inuse').style.display = 'inline'; + document.getElementById('nick-free').style.display = 'none'; + } + else + { + document.getElementById('nick-inuse').style.display = 'none'; + document.getElementById('nick-free').style.display = 'inline'; + } +} + +function checkNick() { + if (ajax == null) + init(); + if (document.getElementById('nick').value == '') return 0; + ajax.onreadystatechange = response; + ajax.open('GET', 'index.php?mode=checknick&nick=' + document.getElementById('nick').value); + + ajax.send(null); +} \ No newline at end of file diff --git a/templates/scripts/posting.js b/templates/scripts/posting.js new file mode 100644 index 0000000..be3b26b --- /dev/null +++ b/templates/scripts/posting.js @@ -0,0 +1,70 @@ +var bbcode = ['[b]', '[/b]', '[i]', '[/i]', '[u]', '[/u]', '[s]', '[/s]', '[url]', '[/url]', '[center]', '[/center]', '[quote]', '[/quote]', '[code]', '[/code]']; + +function insertTag(first, second) +{ + postArea = document.getElementById('post'); + if (document.selection) // IE + { + postArea.focus(); + sel = document.selection.createRange(); + sel.text = first + sel.text + second; + } + else if (postArea.selectionStart || postArea.selectionStart == '0') + { + var startPos = postArea.selectionStart; + var endPos = postArea.selectionEnd; + if (startPos == endPos) + { + if (first == bbcode[8]) + { + var link = prompt('Type hyperlink address', 'http://'); + if (startPos != 0) + { + postArea.value = postArea.value.substring(0, startPos) + '[url=' + link + '] ' + postArea.value.substring(startPos, endPos) + second + postArea.value.substring(endPos, postArea.value.length); + } + else + { + postArea.value += '[url=' + link + '][/url]'; + } + } + else + { + postArea.value += ' ' + first + second; + } + } + else + { + postArea.value = postArea.value.substring(0, startPos) + first + postArea.value.substring(startPos, endPos) + second + postArea.value.substring(endPos, postArea.value.length); + } + } + else + { + postArea.value += ' ' + first + second; + } +} + +function bbTag(item) +{ + if(item < bbcode.length -1) + { + insertTag(bbcode[item], bbcode[item+1]); + } + else + { + switch(item) + { + case 16: + var firstItem = prompt('Type first item list'); + document.getElementById('post').value += "[list]\n[*]"+firstItem+"\n[/list]"; + break; + case 18: + var color = document.getElementById('text_color').value;//prompt('Type font color', 'black'); + insertTag('[color='+color+']', '[/color]'); + } + } +} + +function insertSmile(smile) +{ + document.getElementById('post').value += ' ' + smile; +} \ No newline at end of file diff --git a/templates/styles.css b/templates/styles.css new file mode 100644 index 0000000..4b82569 --- /dev/null +++ b/templates/styles.css @@ -0,0 +1,415 @@ +body { + font-family: Helvetica; + font-size: 11pt; + background-color: #E5E7E9; +} + +#container { + width: 900px; + margin: 0 auto; + text-align: center; + border-collapse: collapse; + border-radius: 10px; +} + +a, a:visited { + text-decoration: none; +} + +img { + border: 0px; +} + +a:hover { + text-decoration: underline; +} + +a { + color: #000000; +} + +#container #top { + width: 100%; + vertical-align: middle; + padding-top: 20px; + border-bottom: 1px solid #777777; + border-top-left-radius: 10px; + border-top-right-radius: 10px; +} + +#container #userpanel { + text-align: right; + font-size: 0.8em; + width: 100%; +} + +#container #navi_bar { + padding-left: 10px; + text-align: left; + width: 98%; + word-wrap: break-word; + max-width: 98%; +} + +#container #top h1 { + margin: 0px; + position: relative; + font-size: 36pt; + font-weight: bold; +} + +#container #top h2 { + color: #005AE5; + font-size: 20px; + text-decoration: none; + font-weight: bold; +} + +#container #footer { + width: 100%; + font-size: 8pt; + color: #FFFFFF; + height: 18px; + line-height: 18px; + border-bottom-left-radius: 5px; + border-bottom-right-radius: 5px; + box-shadow: 0 8px 6px -6px black; +} + +#container #footer a { + color: #FFFFFF; +} + +#contanier #footer a:visited { + color: #FFFFFF; +} + +#container #content { + text-align: left; + min-height: 200px; + padding: 10px; +} + +#container #content h3 { + margin-left: 20px; + color: gray; + font-size: 1.5em; +} + +#container #menu { + text-align: center; + margin: 0 auto; + width: 100%; + height: 50px; + background-color: #99CCFF; +} + +#container #menu ul { + list-style-type: none; + margin: 0px; + padding: 0px; +} + +#container #menu li { + display: inline-block; + border-right: 1px #9A9A9A solid; + height: 37px; + width: 120px; + padding-top: 13px; + margin: auto -4px auto auto; + +} + +#container #menu li a { + color: #FFFFFF; + font-weight: bold; + font-family: Verdana; + font-size: 14px; + font-weight: bold; +} + +#container #menu li:last-child { + border: 0px; +} + +.sect { + color: #434354; + font-family: Verdana; + font-size: 10pt; + font-weight: bold; + text-decoration: none; +} + +.navigation { + text-decoration: none; + font-size: 12px; + font-weight: bold; +} + +.forum_table { + display: table; + width: 100%; + border-collapse: separate; + box-shadow: 0 8px 6px -6px black; +} + +.fsmall { + color: #434354; + font-size: 8pt; + text-decoration: none; +} + +.row { + display: table-row; + width: 100%; +} + +.rcol { + display: table-caption; + border-collapse: collapse; + background-color: #e1f0ff; + padding: 3px; + vertical-align: middle; + border-top: 0px; + caption-side: bottom; + text-align: center; + font-style: italic; +} + +.tc1, .tc2, .tc3, .tc4 { + display: table-cell; + background-color: #F0F8FF; + padding: 3px; + vertical-align: middle; + word-wrap: break-word; +} + +.tc1 { + max-width: 150px; +} + +.tc2, .tc3 { + vertical-align: middle; + text-align: center; + max-width: 150px; +} + +.tc4 { + text-align: center; + vertical-align: middle; + width: 150px; + max-width: 150px; +} + +.hc1, .hc2, .hc3, .hc4 { + color: #FFFFFF; + font-weight: bold; + background-color: yellow; + vertical-align: middle; + display: table-cell; + padding-left: 15px; + height: 30px; + word-wrap: break-word; +} + +.hc1 { + border-top-left-radius: 10px; + max-width: 150px; +} + +.hc4 { + border-top-right-radius: 10px; + width: 150px; +} + +.tab_desc { + text-align: center; + font-weight: bold; + background-image: url('images/td_beam_top.gif'); + height: 19px; + +} + +.lc { + width: 30%; + text-align: right; + margin-right: 10px; + +} + +.rc { + width: 70%; + text-align: left; + margin-left: 10px; +} + +.rc input[type="text"], input[type="password"], input[type="email"] { + width: 200px; +} + +input[type="button"], input[type="reset"], input[type="submit"] { + border-radius: 5px; + padding: 5px; + min-width: 30px; + font-size: 12px; + cursor: pointer; +} + +#signature { + width: 490px; + height: 60px; + resize: vertical; +} + +#post { + width: 490px; + height: 180px; + resize: vertical; +} + +#signature, #post, input[type="text"], input[type="password"], input[type="email"], select { + border-radius: 5px; + border: 1px solid #C7E2FB; + min-height: 20px; + font-size: 12px; + background-color: #FFFFE8; +} + +.error_form { + margin: 0 auto; + text-align: center; + width: 90%; + border: 1px solid #FF0000; + background-color: #FFCC99; + padding: 10px; + color: #FF0000; + border-radius: 10px; + font-weight: bold; +} + +.fadmin, .fmod { + font-weight: bold; +} +.fmod { + color: darkgreen; +} + +.fadmin { + color: orange; +} + +.btn { + display: block; + width: 90px; + height: 30px; + color: #FFFFFF; + font-weight: bold; + text-align: center; + font-size: 1em; + border-radius: 10px; + line-height: 30px; + box-shadow: 0 8px 6px -6px black; +} + +.btn:hover, .btn_small:hover { + color: #FFFFFF; +} +.btn_small { + display: block; + width: 60px; + height: 20px; + color: #FFFFFF; + font-weight: bold; + text-align: center; + font-size: 0.8em; + border-radius: 10px; + margin: 0 auto; + line-height: 20px; + margin-bottom: 5px; + box-shadow: 0 8px 6px -6px black; +} + +.ut { + padding: 0px; + border-left: 0px; +} + +.tc2 .forum_table .tc1, .tc2 .forum_table .tc2, .tc2 .forum_table .tc3 { + border-bottom: 0px !important; + border-top: 1px solid lightgray; + +} + +.mod_pool { + margin: 0 auto; + width: 90%; + background-color: #FFFF99; + text-align: center; + padding: 5px; + border: 1px solid orange; + border-radius: 10px; +} + +hr { + border: 0; + border-bottom: 1px dashed #ccc; + background: #999; + width: 50%; + margin: 0; + margin-top: 5px; +} + +.hcpost { + height: 10px; +} + +.f_hc4 { + text-align: right; + padding-right: 10px; +} + +.post_3c { + width: 120px; +} + +.f_tc2 { + width: 120px; + vertical-align: top; + height: 150px; + text-align: center; +} + +.topic_mod { + width: 80px; + float: right; +} +.p_uinfo { + width: 38%; +} + +.post_content { + vertical-align: top; + position: relative; + text-align: left; + max-width: 500px; +} + +.row .hcpost a { + color: #FFFFFF; +} + +.qpost { + background-color: #DDDAC5; + width: 95%; + font-style: italic; + box-shadow: 7px 8px 6px -3px gray; + padding: 5px; +} + +.cpost { + background-color: #C5DDCC; + width: 95%; + font-family: Courier New; + box-shadow: 7px 8px 6px -3px gray; + padding: 5px; +} \ No newline at end of file diff --git a/templates/userlist.tpl.php b/templates/userlist.tpl.php new file mode 100755 index 0000000..3edefd5 --- /dev/null +++ b/templates/userlist.tpl.php @@ -0,0 +1,65 @@ + +
    +
    +
    +
    +
    Users list
    +
     
    +
     
    +
     
    +
    +
    +
    Username
    +
    Joined
    +
    Last visit
    +
    Posts
    +
    + TPL['users_list']); $i++) + { + echo '
    '."\n"; + echo "\t\t\t".''."\n"; + echo "\t\t\t".'
    '.$this->TPL['users_list'][$i]['regdate'].'
    '."\n"; + echo "\t\t\t".'
    '.(($this->TPL['users_list'][$i]['lastvisit']!= null) ? $this->TPL['users_list'][$i]['lastvisit'] : 'Never').'
    '."\n"; + echo "\t\t\t".'
    '.$this->TPL['users_list'][$i]['post_count'].'
    '."\n"; + echo "\t\t".'
    '."\n"; + } + ?> + + +
    +
    +
    +
    +
    Options
    +
    +
    +
    +
    + Sort users by: + +     + TPL['desc_checked']; ?> />Descending +        +
    +
    +
    + +
    +
    + + \ No newline at end of file diff --git a/templates/viewforum.tpl.php b/templates/viewforum.tpl.php new file mode 100755 index 0000000..99a136d --- /dev/null +++ b/templates/viewforum.tpl.php @@ -0,0 +1,74 @@ + +
    + TPL['forum_info']['locked'] == false) { ?> + New Topic + +
    + Locked +
    + +
    +
    +
    +
    TPL['f_name']; ?>
    +
     
    +
     
    +
     
    +
    +
    +
    Topic name
    +
    Author
    +
    Replies
    +
    Last Post
    +
    + TPL['topics_list']); $i++) + { + echo '
    '."\n"; + echo "\t\t\t".''."\n"; + echo "\t\t\t".'
    '; + if ($this->TPL['topics_list'][$i]['user_id'] != null) + echo ''.$this->colorRank($this->TPL['topics_list'][$i]['user_nick'], $this->TPL['topics_list'][$i]['user_rank']).''; + else + echo 'Anonymous'; + echo '
    '."\n"; + echo "\t\t\t".'
    '.($this->TPL['topics_list'][$i]['post_count']-1).'
    '."\n"; + + if ($this->TPL['topics_list'][$i]['lastpost_post_id'] != null) + { + $lastpost = ' '.$this->TPL['topics_list'][$i]['lastpost_date'].'
    Post #'.$this->TPL['topics_list'][$i]['lastpost_post_id'].': '; + if ($this->TPL['topics_list'][$i]['lastpost_user_id'] != null) + $lastpost .= ''.$this->colorRank($this->TPL['topics_list'][$i]['lastpost_user_nick'], $this->TPL['topics_list'][$i]['lastpost_user_rank']).''; + else + $lastpost .= 'Anonymous'; + $lastpost .= '
    '; + } + else + { + $lastpost = 'No posts.'; + } + + echo "\t\t\t".'
    '.$lastpost.'
    '."\n"; + echo "\t\t".'
    '."\n"; + } + ?> + + + TPL['topics_list']) == 0) + { + echo '
    No topics in this forum.
    '; + } + ?> +
    +
    + TPL['forum_info']['locked'] == false) { ?> + New Topic + +
    + Locked +
    + +
    + + \ No newline at end of file diff --git a/templates/viewprofile.tpl.php b/templates/viewprofile.tpl.php new file mode 100755 index 0000000..f182b6b --- /dev/null +++ b/templates/viewprofile.tpl.php @@ -0,0 +1,65 @@ + + +
    +
    +
    +
    +
    TPL['user_info']['nick']; ?>
    +
    + TPL['logged_id']) {?> + Edit my profile » +   +
    +
    + +
    +
    + TPL['user_info']['avatar'] != null) + echo 'user avatar'; + else + echo 'user avatar'; + ?> +
    +
    + +Joined: TPL['user_info']['regdate']; ?>
    +Last visit: TPL['user_info']['lastvisit']!= null) ? $this->TPL['user_info']['lastvisit'] : 'Never') ?>
    +Posts: TPL['user_info']['post_count']; ?>; TPL['post_ratio']; ?>% of total.
    +Location: TPL['user_info']['location']; ?>
    +
    +
    +
    +
    + Email +
    +
    + Status: user status
    + Rank: getRankLevel($this->TPL['user_info']['rank']); ?> +
    +
    + + + +
    +
    + TPL['user_info']['signature'] != null) { ?> +
    +
    +
    TPL['user_info']['nick']; ?>'s signature
    +
    + +
    +
    + TPL['user_info']['signature']); ?> +
    +
    +
    + + + + + +
    + + \ No newline at end of file diff --git a/templates/viewtopic.tpl.php b/templates/viewtopic.tpl.php new file mode 100755 index 0000000..80cc530 --- /dev/null +++ b/templates/viewtopic.tpl.php @@ -0,0 +1,127 @@ + +
    + TPL['topic_info']['forum_locked'] == false && $this->TPL['topic_info']['topic_locked'] == false) { ?> + Reply + +
    + Locked +
    + +
    + +TPL['posts_list']); $i++) + { + echo ' +
    +
    +
     
    +
     
    +
    Post #'.($i+1).'
    +
    + +
    +
    '; + if ($this->TPL['posts_list'][$i]['nick'] != null) + echo ''.$this->colorRank($this->TPL['posts_list'][$i]['nick'], $this->TPL['posts_list'][$i]['user_rank']).''; + else + echo 'Anonymous'; + echo '
    '; + + if ($this->TPL['posts_list'][$i]['avatar'] != null) + echo 'user avatar'; + else + echo 'user avatar'; + echo ' +
    +
    '; + echo BBCode($this->TPL['posts_list'][$i]['content']); + + if ($this->TPL['posts_list'][$i]['signature'] != null) + echo ' +

    +
    + '.BBCode($this->TPL['posts_list'][$i]['signature']).'

    '; + + echo ' +
    +
    + Posted: '.$this->TPL['posts_list'][$i]['date'].'
    + Quote'; + if ($this->TPL['my_id'] == $this->TPL['posts_list'][$i]['user_id'] && $this->TPL['posts_list'][$i]['user_id'] != null) + echo ' + Edit'; + + echo '
    '; + + if ($this->TPL['my_rank'] >= RANK_MOD) + { + echo ' +
    + Mod options

    + Edit'; + if ($this->TPL['topic_info']['post_count'] > 1) + echo ' + X'; + echo '
    '; + } + echo ' +
    +
    + +
    +
    + Status: user status +
    +
    +
    +
    + Posts: '.(($this->TPL['posts_list'][$i]['user_post_count']!== null) ? $this->TPL['posts_list'][$i]['user_post_count'] : '0').' +
    +
    + Joined: '.(($this->TPL['posts_list'][$i]['regdate']!= null) ? $this->TPL['posts_list'][$i]['regdate'] : 'Never').' +
    +
    + Last visit: '.(($this->TPL['posts_list'][$i]['lastvisit']!= null) ? $this->TPL['posts_list'][$i]['lastvisit'] : 'Never').' +
    +
    +
    +
    Rank: '.$this->getRankLevel($this->TPL['posts_list'][$i]['user_rank']).'
    +
    +
    +
    '; + } + ?> + + TPL['topic_info']['forum_locked'] == false && $this->TPL['topic_info']['topic_locked'] == false) { ?> + Reply + +
    + Locked +
    + + + TPL['my_rank'] >= RANK_MOD) { ?> +
    +
    +
    Actions
    +
    +
    + +
    +
    + +
     
    +
    + + \ No newline at end of file