Skip to content

Commit 4ad8c94

Browse files
committed
up
1 parent 49ef746 commit 4ad8c94

File tree

2,837 files changed

+1845882
-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.

2,837 files changed

+1845882
-0
lines changed

.htaccess

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
RewriteEngine On
2+
#RewriteBase /uchi/
3+
RewriteCond %{REQUEST_FILENAME} !-f
4+
RewriteCond %{REQUEST_FILENAME} !-d
5+
RewriteRule (.*) index.php/$1

Anuncios.php

+228
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,228 @@
1+
<?php
2+
header("Access-Control-Allow-Origin: *");
3+
defined('BASEPATH') OR exit('No direct script access allowed');
4+
5+
class Anuncios extends CI_Controller {
6+
7+
public function __construct() {
8+
parent::__construct();
9+
$this->load->model('Anuncios_model', 'anunciosModel');
10+
$this->load->model('Usuarios_model', 'usuariosModel');
11+
}
12+
13+
private function login() {
14+
if ($this->input->post('userLogin') && $this->input->post('senha')) {
15+
$userLogin = $this->input->post('userLogin');
16+
$senha = $this->input->post('senha');
17+
$loginData = $this->usuariosModel->login($userLogin, $senha);
18+
return $loginData;
19+
} else {
20+
return false;
21+
}
22+
}
23+
24+
public function upload() {
25+
// $allowedExt = array('png', 'jpeg', 'jpg', 'bmp', 'gif');
26+
// $dir = 'uploads/';
27+
// $ext = pathinfo($_FILES['imagem']['name'], PATHINFO_EXTENSION);
28+
// if (in_array($ext, $allowedExt)) {
29+
// $fname = time() . "_" . rand(10000, 99999) . rand(10000, 99999) . "." . $ext;
30+
// $target = $dir . $fname;
31+
// if (move_uploaded_file($_FILES['imagem']['tmp_name'], $target)) {
32+
// $result['filename'] = $fname;
33+
// $result['status'] = true;
34+
// echo json_encode($result);
35+
// } else {
36+
// $result['error'] = 'Falha no upload!';
37+
// $result['status'] = false;
38+
// echo json_encode($result);
39+
// }
40+
// } else {
41+
// $result['error'] = 'Extensão incorreta!';
42+
// $result['status'] = false;
43+
// echo json_encode($result);
44+
// }
45+
$uploads_dir = 'app/uploads';
46+
$ext = pathinfo($_FILES['imagem']['name'], PATHINFO_EXTENSION);
47+
$name = basename("IMG_" . $ext);
48+
if (move_uploaded_file($_FILES['imagem']['tmp_name'], "$uploads_dir/$name")) {
49+
echo "true";
50+
}
51+
}
52+
53+
public function criar() {
54+
if (isset($_SERVER['HTTP_ORIGIN'])) {
55+
header("Access-Control-Allow-Origin: {$_SERVER['HTTP_ORIGIN']}");
56+
header('Access-Control-Allow-Credentials: true');
57+
header('Access-Control-Max-Age: 86400'); // cache for 1 day
58+
}
59+
60+
// Access-Control headers are received during OPTIONS requests
61+
if ($_SERVER['REQUEST_METHOD'] == 'OPTIONS') {
62+
63+
if (isset($_SERVER['HTTP_ACCESS_CONTROL_REQUEST_METHOD']))
64+
header("Access-Control-Allow-Methods: GET, POST, OPTIONS");
65+
66+
if (isset($_SERVER['HTTP_ACCESS_CONTROL_REQUEST_HEADERS']))
67+
header("Access-Control-Allow-Headers: {$_SERVER['HTTP_ACCESS_CONTROL_REQUEST_HEADERS']}");
68+
69+
exit(0);
70+
}
71+
$postdata = file_get_contents("php://input");
72+
if (isset($postdata)) {
73+
$pdata = json_decode($postdata);
74+
} else {
75+
$result = json_encode('false ii');
76+
}
77+
// $loginData = $this->login();
78+
// if (!$loginData || $loginData['status'] == false) {
79+
// echo json_encode($loginData);
80+
// return false;
81+
// }
82+
if ($pdata->imagem && $pdata->texto && $pdata->lat && $pdata->long) {
83+
$usuario = $pdata->usuario;
84+
$titulo = "teste";
85+
$valor = "0.00";
86+
$texto = $pdata->texto;
87+
$lat = $pdata->lat;
88+
$lng = $pdata->long;
89+
$fname = $pdata->imagem;
90+
$bairro = $pdata->bairro;
91+
$cidade = $pdata->cidade;
92+
$local = $pdata->local;
93+
$estado = $pdata->estado;
94+
$pais = $pdata->pais;
95+
$tipo = $pdata->tipo;
96+
}
97+
echo json_encode($this->anunciosModel->criar($usuario, $titulo, $valor, $texto, $fname, $lat, $lng, $bairro, $cidade, $estado, $pais, $tipo, $local));
98+
}
99+
100+
public function puxarTodos() {
101+
if (isset($_SERVER['HTTP_ORIGIN'])) {
102+
header("Access-Control-Allow-Origin: {$_SERVER['HTTP_ORIGIN']}");
103+
header('Access-Control-Allow-Credentials: true');
104+
header('Access-Control-Max-Age: 86400'); // cache for 1 day
105+
}
106+
107+
// Access-Control headers are received during OPTIONS requests
108+
if ($_SERVER['REQUEST_METHOD'] == 'OPTIONS') {
109+
110+
if (isset($_SERVER['HTTP_ACCESS_CONTROL_REQUEST_METHOD']))
111+
header("Access-Control-Allow-Methods: GET, POST, OPTIONS");
112+
113+
if (isset($_SERVER['HTTP_ACCESS_CONTROL_REQUEST_HEADERS']))
114+
header("Access-Control-Allow-Headers: {$_SERVER['HTTP_ACCESS_CONTROL_REQUEST_HEADERS']}");
115+
116+
exit(0);
117+
}
118+
$postdata = file_get_contents("php://input");
119+
if (isset($postdata)) {
120+
$pdata = json_decode($postdata);
121+
} else {
122+
$result = json_encode('false ii');
123+
}
124+
if ($pdata->lat && $pdata->long) {
125+
$lat = $pdata->lat;
126+
$lng = $pdata->long;
127+
} else {
128+
$lat = false;
129+
$lng = false;
130+
}
131+
if ($pdata->publico !== false && $pdata->publico == 1) {
132+
if (isset($pdata->userId)) {
133+
$result = json_encode($this->anunciosModel->puxarTodos($pdata->userId, $pdata->index, $pdata->local, $pdata->l_tipo, $pdata->tipo, false, $lat, $lng));
134+
echo $result;
135+
} else {
136+
$result = json_encode($this->anunciosModel->puxarTodos(0, $pdata->index, $pdata->local, $pdata->l_tipo, $pdata->tipo, false, $lat, $lng));
137+
echo $result;
138+
}
139+
return false;
140+
}
141+
// $loginData = $this->login();
142+
// if (!$loginData || $loginData['status'] == false) {
143+
// echo json_encode($loginData);
144+
// return false;
145+
// }
146+
// if ($pdata->index !== false) {
147+
// $meus = false;
148+
// if ($pdata->meus && $pdata->meus == 1) {
149+
// $meus = true;
150+
// }
151+
// echo json_encode($this->anunciosModel->puxarTodos($loginData['id'], $pdata->index, $meus, $lat, $lng));
152+
// } else {
153+
// $result['status'] = false;
154+
// $result['error'] = "Post index não informado";
155+
// echo json_encode($result);
156+
// }
157+
}
158+
159+
public function puxarTodasFotos() {
160+
if (isset($_SERVER['HTTP_ORIGIN'])) {
161+
header("Access-Control-Allow-Origin: {$_SERVER['HTTP_ORIGIN']}");
162+
header('Access-Control-Allow-Credentials: true');
163+
header('Access-Control-Max-Age: 86400'); // cache for 1 day
164+
}
165+
166+
// Access-Control headers are received during OPTIONS requests
167+
if ($_SERVER['REQUEST_METHOD'] == 'OPTIONS') {
168+
169+
if (isset($_SERVER['HTTP_ACCESS_CONTROL_REQUEST_METHOD']))
170+
header("Access-Control-Allow-Methods: GET, POST, OPTIONS");
171+
172+
if (isset($_SERVER['HTTP_ACCESS_CONTROL_REQUEST_HEADERS']))
173+
header("Access-Control-Allow-Headers: {$_SERVER['HTTP_ACCESS_CONTROL_REQUEST_HEADERS']}");
174+
175+
exit(0);
176+
}
177+
$postdata = file_get_contents("php://input");
178+
if (isset($postdata)) {
179+
$pdata = json_decode($postdata);
180+
} else {
181+
$result = json_encode('false ii');
182+
}
183+
if ($pdata->lat && $pdata->long) {
184+
$lat = $pdata->lat;
185+
$lng = $pdata->long;
186+
} else {
187+
$lat = false;
188+
$lng = false;
189+
}
190+
if ($pdata->publico !== false && $pdata->publico == 1) {
191+
$result = json_encode($this->anunciosModel->puxarTodasFotos(0, $pdata->index, false, $lat, $lng));
192+
echo $result;
193+
return false;
194+
}
195+
// $loginData = $this->login();
196+
// if (!$loginData || $loginData['status'] == false) {
197+
// echo json_encode($loginData);
198+
// return false;
199+
// }
200+
// if ($pdata->index !== false) {
201+
// $meus = false;
202+
// if ($pdata->meus && $pdata->meus == 1) {
203+
// $meus = true;
204+
// }
205+
// echo json_encode($this->anunciosModel->puxarTodos($loginData['id'], $pdata->index, $meus, $lat, $lng));
206+
// } else {
207+
// $result['status'] = false;
208+
// $result['error'] = "Post index não informado";
209+
// echo json_encode($result);
210+
// }
211+
}
212+
213+
public function mudarStatus() {
214+
$loginData = $this->login();
215+
if (!$loginData || $loginData['status'] == false) {
216+
echo json_encode($loginData);
217+
return false;
218+
}
219+
if ($this->input->post('anuncio') !== false) {
220+
echo json_encode($this->anunciosModel->mudarStatus($loginData['id'], $this->input->post('anuncio')));
221+
} else {
222+
$result['status'] = false;
223+
$result['error'] = "Anúncio não informado";
224+
echo json_encode($result);
225+
}
226+
}
227+
228+
}
Binary file not shown.

RedeUCHI.rar

6.88 MB
Binary file not shown.
Binary file not shown.

RedeUCHI/logo.png

20.3 KB
Loading

RedeUCHI/site/css/bootstrap-slider.min.css

+41
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)