} if (!$user->isLoggedIn()) { Session::flash('error', 'It seems you are not logged in!'); Redirect::to('/'); } $db = DB::getInstance(); $q = $db->get('post', array('id', '=', escape($post_id)))->first(); if (Input::exists()) { if (Input::get('Submit')) { if (Token::check(Input::get('token'))) { $val = new Validation(); $validate = $val->check($_POST, array('title' => array('required' => true), 'content' => array('required' => true))); if ($validate->passed()) { try { $forums->createReply(array('title' => escape(Input::get('title')), 'post_id' => escape($post_id), 'content' => Input::get('content'), 'date' => date('Y-m-d- H:i:s'), 'user_id' => $user->data()->id)); Notifaction::createMessage($user->data()->username . ' posted a reply on your page', $forums->getPost2($post_id)->post_user); session::flash('complete', 'You posted your reply!'); Redirect::to('/forums/view/' . $cat . '/' . $post_id); } catch (Exception $e) { die($e->getMessage()); } } else { echo 'val not passed'; } } else { die('token failed'); } } else { die('submit'); } }
ID </td> <td> Message </td> <td> Mark as Read </td> <td> Delete Message </td> </tr> </thead> <tbody> <?php foreach (Notifaction::get($user->data()->id) as $message) { echo '<tr>'; echo '<td>'; echo $message->id; echo '</td>'; echo '<td>'; echo $message->message; echo '</td>'; echo '<td>'; if ($message->read == 0) { echo "<a href='?page=notification&id={$message->id}&a=read&val=1'>Mark as read</a>"; } else { if ($message->read == 1) { echo "<a href='?page=notification&id={$message->id}&a=read&val=0'>Mark as un-read</a>"; } }
<?php if (Input::exists()) { if (token::check(Input::get('token'))) { $val = new Validation(); $validation = $val->check($_POST, array('message' => array('required' => true))); if ($validation->passed()) { foreach ($db->get('users', array('1', '=', '1'))->results() as $userAcc) { try { Notifaction::createMessage(Input::get('message'), $userAcc->id); Session::flash('complete', 'You sent a mass message!'); Redirect::to('?page=notification'); } catch (Exception $e) { } } } } } ?> <!DOCTYPE html> <html lang="en"> <head> <?php include 'inc/templates/head.php'; ?> </head> <body> <div class="col-md-3"><?php include 'inc/templates/nav.php'; ?> </div>
if (Input::exists()) { if (Token::check(Input::get('token'))) { $val = new Validation(); $val->check($_POST, array('name' => array('required' => true), 'username' => array('required' => true, 'min' => 2, 'max' => 50, 'unique' => 'users'), 'email' => array('required' => true, 'unique' => 'users'), 'password' => array('required' => true, 'min' => 8), 'password_conf' => array('required' => true, 'matches' => 'password'))); if (!$val->passed()) { } else { $user = new User(); $salt = hash::salt(32); $password = hash::make(escape(Input::get('password')), $salt); try { $user->create(array('username' => escape(Input::get('username')), 'password' => Hash::make(escape(Input::get('password')), $salt), 'salt' => $salt, 'name' => escape(Input::get('name')), 'joined' => date('Y-m-d- H:i:s'), 'group' => 1, 'email' => escape(Input::get('email')))); } catch (Exception $e) { die($e->getMessage()); } if ($user->login(escape(Input::get('username')), escape(Input::get('password')), false)) { Notifaction::createMessage('Welcome to the forums ' . $user->data()->name, $user->data()->id); session::flash('complete', 'You completely register and you just got logged in.'); Redirect::to('/'); } } } } ?> <html> <head> <?php include 'inc/templates/head.php'; ?> </head> <body> <?php
} ?> </ul> <ul class="nav navbar-nav navbar-right"> <!-- Make mail --> <?php if ($user->isLoggedIn()) { ?> <li><a href="<?php echo path; ?> pages/user/?page=notification"><span class="glyphicon glyphicon-inbox"></span><?php if (Notifaction::getUnreadCount($user->data()->id) > 0) { ?> <span class="badge"><?php echo Notifaction::getUnreadCount($user->data()->id); ?> </span><?php } ?> </a></li><?php } ?> <!-- <li class="dropdown"> <a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false"><span class="glyphicon glyphicon-inbox"><span class="badge">999</span></span></a> <ul class="dropdown-menu"> <li><a href="#">Action</a></li> <li><a href="#">Another action</a></li> <li><a href="#">Something else here</a></li> <li role="separator" class="divider"></li> <li><a href="#">Separated link</a></li>
if (Session::exists('complete')) { echo "<div class='alert alert-success'>" . Session::flash('complete') . "</div>"; } ?> <?php if (Session::exists('error')) { echo "<div class='alert alert-danger'>" . Session::flash('error') . "</div>"; } ?> <div class="col-md-3"> <div class="well"> <a href="?page=">UserCP Home</a><br/> <a href="?page=change_password">Change password</a><br/> <a href="?page=update">Update Infomation</a><br/> <a href="?page=notification">Notifications<?php $not_cont = Notifaction::getUnreadCount($user->data()->id); if ($not_cont > 0) { ?> <span class="badge"><?php echo $not_cont; ?> </span><?php } ?> </a><br/> </div> </div> <div class="col-md-9"> <?php switch (Input::get('page')) { default:
public function acceptFriendRequest($user, $response = 0) { if ($this->hasFriendRequest($user)) { $id = $this->_db->query("SELECT id WHERE friend_id={$user}")->results(); if ($response == 1) { Notifaction::createMessage("{$this->_data}->username has accepted your friend request!", $user); } $this->_db->update('friends', $id, ['accepted' => $response]); } }
} elseif ($step === 5) { if (Input::exists()) { if (Token::check(Input::get('token'))) { $val = new Validation(); $validate = $val->check($_POST, ['name' => ['required' => true], 'username' => ['required' => true, 'min' => 2, 'max' => 50, 'unique' => 'users', 'spaces' => false], 'email' => ['required' => true, 'unique' => 'users'], 'password' => ['required' => true, 'min' => 8], 'password_conf' => ['required' => true, 'matches' => 'password']]); if ($validate->passed()) { $user = new User(); $salt = Hash::salt(32); $password = Hash::make(escape(Input::get('password')), $salt); try { $user->create(array('username' => escape(Input::get('username')), 'password' => $password, 'salt' => $salt, 'name' => escape(Input::get('name')), 'joined' => date('Y-m-d- H:i:s'), 'group' => 2, 'email' => escape(Input::get('email')))); } catch (Exception $e) { die($e->getMessage()); } if ($user->login(escape(Input::get('username')), escape(Input::get('password')), false)) { Notifaction::createMessage('Welcome to the Social-Media ' . $user->data()->name, $user->data()->id); Session::flash('complete', '<div class="alert alert-info">You need to delete install-disable.php! Hacker could use this to their advantage!</div>'); Redirect::to('?step=6'); } } } } ?> <div class="col-xs-12 col-sm-8 col-md-6 col-sm-offset-2 col-md-offset-3"> <h1>Register</h1> <form action="" method="post" autocomplete="off"> <div class="form-group"> <input name="name" value="<?php echo Input::get('name'); ?> " placeholder="Name" type="text" class="form-control input-lg">