Skip to content

Commit 62ce5fe

Browse files
committed
First Commit
0 parents  commit 62ce5fe

File tree

1,665 files changed

+228170
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

1,665 files changed

+228170
-0
lines changed

Admin/ajax.php

+136
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,136 @@
1+
<?php
2+
session_start();
3+
include('inc/db.php');
4+
5+
include('inc/cls/Rs_Users.php');
6+
include('inc/chat/load.php');
7+
8+
$user = new Rs_Users($_SESSION['user']['id']);
9+
/*$conversation = new Conversation();
10+
11+
$list = $conversation->GetUserConversationList("9","parent");
12+
var_dump($list->fetch_all());*/
13+
14+
/*$user = new Rs_Users("12");
15+
echo $_SESSION['user']['id'] .$_SESSION['user']['name']. " <hr> ";
16+
var_dump($user->GetChildrens());*/
17+
//$message->send('10','20','testMessage');
18+
//$message->save();
19+
//$message->delte();
20+
21+
if(isset($_POST['load_messanger'])){
22+
ob_start();
23+
$msgObj = new Message();
24+
$messageList = $msgObj->GetConversationMessages($_POST['conversation_id']);
25+
$isNeedEditor = false;
26+
if(isset($_POST['need_editor']) && $_POST['need_editor'] == "yes")
27+
$isNeedEditor = true;
28+
29+
// Mark This message as Read
30+
$conversation = new Conversation();
31+
$conversationId = $_POST['conversation_id'];
32+
$conversation->MarkAsRead($conversationId,$user->id);
33+
?>
34+
<?php if($isNeedEditor): ?>
35+
<ul id="rs_listMessage">
36+
<?php endif; ?>
37+
<?php
38+
39+
while ($message = $messageList->fetch_assoc()) {
40+
$text = $message['message'];
41+
$tempUser = new Rs_Users($message['sender']);
42+
$userImage = (!empty( $tempUser->picture) ? $tempUser->picture:'images/blank_user.png' );
43+
$fullName =$tempUser->f_name.' ' .$tempUser->l_name;
44+
$itemClass = "";
45+
if($user->id == $tempUser->id){
46+
$itemClass = "reverse";
47+
}
48+
?>
49+
<li class="<?php echo $itemClass; ?>">
50+
<div class="single_message_item">
51+
<img class="thumbnail" src="<?php echo $userImage; ?>" alt="<?php echo $fullName; ?>">
52+
<h3 class="sender_name"><?php echo $fullName; ?></h3>
53+
<div class="message_text">
54+
<?php
55+
if($message['type'] == "file"){
56+
if($msgObj->isImageFile($message['file'])){
57+
?>
58+
<img class="rs_chat_img" src="<?php echo $message['message']; ?>" alt="">
59+
<?php
60+
}else{
61+
?>
62+
<a href="<?php echo $message['message']; ?>" target="blank" class="rs_chat_file"><i class="fa fa-file-download"></i> Download File</a>
63+
<?php
64+
}
65+
}else{
66+
echo $text;
67+
}
68+
?>
69+
</div>
70+
71+
</div>
72+
</li>
73+
<?php
74+
}
75+
?>
76+
<?php if($isNeedEditor): ?>
77+
</ul>
78+
<div class="rs_message_editor" id="rs_message_editor">
79+
<div class="rs_loading_box"><i class="fa fa-spinner fa-pulse fa-3x fa-fw"></i></div>
80+
<div class="message_box_group">
81+
<input type="text" class="form-control" id="message_input">
82+
<span id="rs_upload_file"><i class="fa fa-images"></i></span>
83+
</div>
84+
<button class="btn btn-default">Send</button>
85+
</div>
86+
<?php endif; ?>
87+
<?php
88+
echo ob_get_clean();
89+
}
90+
/*file Upload*/
91+
if(isset($_POST['rs_ctfileupload']) && $_POST['rs_ctfileupload'] =="yes"){
92+
$conversationId = $_POST['conversation'];
93+
$msgObj = new Message();
94+
$conversation = new Conversation();
95+
96+
$fileInfo = $msgObj->FileUpload($_FILES['file']);
97+
$message =$fileInfo['url'];
98+
$fileUri =$fileInfo['uri'];
99+
$msgType = "file";
100+
$result = array('type' => "error",'message' => "you don't have access");
101+
//$result['file'] = $fileInfo;
102+
if($conversation->CanAccess($user->id,$conversationId)){
103+
if($msgObj->Send($conversationId,$user->id,$message,$fileUri,$msgType)){
104+
$result['type'] = 'success';
105+
$result['message'] = 'Message Sent';
106+
}
107+
}
108+
echo json_encode( $result);
109+
}
110+
111+
if(isset($_POST['send_to'])){
112+
$message = $_POST['message'];
113+
$conversationId = $_POST['conversation'];
114+
$msgObj = new Message();
115+
$conversation = new Conversation();
116+
$result = array('type' => "error",'message' => "you don't have access");
117+
if($conversation->CanAccess($user->id,$conversationId)){
118+
if($msgObj->Send($conversationId,$user->id,$message)){
119+
$result['type'] = 'success';
120+
$result['message'] = 'Message Sent';
121+
}
122+
}
123+
echo json_encode( $result );
124+
}
125+
126+
/*Display Top Message Notificatoins*/
127+
if(isset($_POST['top_header_notificatoin']) && $_POST['top_header_notificatoin'] == "yes"){
128+
$conversation = new Conversation();
129+
echo $conversation->CountUnreadConversation($user->id)->fetch_assoc()['total'];
130+
}
131+
/*Mark User Message As Read*/
132+
if(isset($_POST['mark_as_read']) && $_POST['mark_as_read'] == "yes"){
133+
$conversation = new Conversation();
134+
$conversationId = $_POST['conversation'];
135+
$conversation->MarkAsRead($conversationId,$user->id);
136+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
<!DOCTYPE html>
2+
<html>
3+
<head>
4+
<title>403 Forbidden</title>
5+
</head>
6+
<body>
7+
8+
<p>Directory access is forbidden.</p>
9+
10+
</body>
11+
</html>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
<?php
2+
defined('BASEPATH') OR exit('No direct script access allowed');
3+
4+
class Login extends CI_Controller {
5+
private $header;
6+
private $footer;
7+
private $body;
8+
public function __construct(){
9+
parent::__construct();
10+
$this->header = array();
11+
$this->footer = array();
12+
$this->body = array();
13+
}
14+
public function index($id= null)
15+
{
16+
$this->load->view('header');
17+
//$this->load->view('login',$this->body);
18+
$this->load->view('footer');
19+
20+
}
21+
22+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
<?php
2+
defined('BASEPATH') OR exit('No direct script access allowed');
3+
4+
class News extends CI_Controller {
5+
private $header;
6+
private $footer;
7+
private $body;
8+
public function __construct(){
9+
parent::__construct();
10+
$this->header = array(
11+
'menu' => 'page',
12+
'submenu' => 'all'
13+
);
14+
$this->footer = array();
15+
$this->body = array();
16+
}
17+
public function index($slug= null)
18+
{
19+
if(!is_null($slug)){
20+
$this->single($slug);
21+
}
22+
23+
}
24+
public function single($slug = null)
25+
{
26+
$this->load->model(array('Rs_Global'));
27+
$this->Rs_Global->set_table('news');
28+
$this->body['news'] = $this->Rs_Global->get(array('slug'=>$slug));
29+
if(empty($this->body['news'])){
30+
$this->body['heading'] = "404!";
31+
$this->body['message'] = "News Not Found";
32+
$this->load->view('errors/html/error_404',$this->body);
33+
}else{
34+
$this->load->view('header');
35+
$this->load->view('template/single_news',$this->body);
36+
$this->load->view('footer');
37+
}
38+
}
39+
40+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
<?php
2+
defined('BASEPATH') OR exit('No direct script access allowed');
3+
4+
class Plant extends CI_Controller {
5+
private $header;
6+
private $footer;
7+
private $body;
8+
public function __construct(){
9+
parent::__construct();
10+
$this->header = array();
11+
$this->footer = array();
12+
$this->body = array();
13+
}
14+
public function index($id= null)
15+
{
16+
if(!is_null($id)){
17+
$this->single($id);
18+
}
19+
20+
}
21+
public function single($id = null)
22+
{
23+
$this->load->model(array('Rs_Global'));
24+
$this->Rs_Global->set_table('plant');
25+
$this->body['plant'] = $this->Rs_Global->get(array('id'=>$id));
26+
if(empty($this->body['plant'])){
27+
$this->body['heading'] = "404!";
28+
$this->body['message'] = "News Not Found";
29+
$this->load->view('errors/html/error_404',$this->body);
30+
}else{
31+
$this->load->view('header');
32+
$this->load->view('template/single_plant',$this->body);
33+
$this->load->view('footer');
34+
}
35+
}
36+
37+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
<?php
2+
defined('BASEPATH') OR exit('No direct script access allowed');
3+
4+
class Plant extends CI_Controller {
5+
private $header;
6+
private $footer;
7+
private $body;
8+
public function __construct(){
9+
parent::__construct();
10+
$this->header = array();
11+
$this->footer = array();
12+
$this->body = array();
13+
}
14+
public function index($id= null)
15+
{
16+
if(!is_null($id)){
17+
$this->single($id);
18+
}
19+
20+
}
21+
public function single($id = null)
22+
{
23+
$this->load->model(array('Rs_Global'));
24+
$this->Rs_Global->set_table('plant');
25+
$this->body['plant'] = $this->Rs_Global->get(array('id'=>$id));
26+
if(empty($this->body['plant'])){
27+
$this->body['heading'] = "404!";
28+
$this->body['message'] = "News Not Found";
29+
$this->load->view('errors/html/error_404',$this->body);
30+
}else{
31+
$this->load->view('header');
32+
$this->load->view('template/single_plant',$this->body);
33+
$this->load->view('footer');
34+
}
35+
}
36+
37+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
<?php
2+
defined('BASEPATH') OR exit('No direct script access allowed');
3+
4+
class Upload extends CI_Controller {
5+
public function __construct(){
6+
parent::__construct();
7+
}
8+
public function index()
9+
{
10+
return;
11+
}
12+
public function get_files($page = 1){
13+
$this->load->model('Rs_Global');
14+
$this->Rs_Global->set_table('media');
15+
echo json_encode($this->Rs_Global->get(null,array('page'=>$page,'limit'=>20)));
16+
}
17+
public function do_upload(){
18+
$response = array();
19+
$response['status'] = 'success';
20+
$allowed = array('png', 'jpg','pdf');
21+
if(isset($_FILES['upl']) && $_FILES['upl']['error'] == 0){
22+
$fileNewDir = 'uploads/'.date('Y').'/'.date('m');
23+
if (!is_dir($fileNewDir)) {
24+
mkdir($fileNewDir, 0777, TRUE);
25+
$content = ":(";
26+
$fp = fopen($fileNewDir . "/index.html","wb");
27+
fwrite($fp,$content);
28+
fclose($fp);
29+
}
30+
$extension = pathinfo($_FILES['upl']['name'], PATHINFO_EXTENSION);
31+
32+
if(!in_array(strtolower($extension), $allowed)){
33+
$response['status'] = 'error';
34+
$response['message'] = 'File type is not allow';
35+
}
36+
$temp = explode(".", $_FILES["upl"]["name"]);
37+
$fileNewPath = $fileNewDir.'/'.uniqid('rs_').'.'.end($temp);
38+
39+
if($response['status'] !='error' and move_uploaded_file($_FILES['upl']['tmp_name'], $fileNewPath)){
40+
$response['url'] = base_url($fileNewPath);
41+
$this->load->model('Rs_Global');
42+
$this->Rs_Global->set_table('media');
43+
$dbNewData = array(
44+
'url' => $response['url'],
45+
'file' => $fileNewPath,
46+
'title' => $_FILES["upl"]["name"]
47+
);
48+
$response['id'] = $this->Rs_Global->add($dbNewData);
49+
$response['status'] = 'success';
50+
/*Thumbnail Make*/
51+
$config['image_library'] = 'gd2';
52+
$config['source_image'] = $fileNewPath;
53+
$config['create_thumb'] = true;
54+
$config['maintain_ratio'] = true;
55+
$config['width'] = 400;
56+
$this->load->library('image_lib', $config);
57+
$this->image_lib->resize();
58+
}
59+
}
60+
echo json_encode($response);
61+
}
62+
}
Binary file not shown.

0 commit comments

Comments
 (0)