function doUpload() { //informações para o template $data = array('tipo' => $this->input->post('tipo'), 'logged' => $this->auth->logged(), 'page_title' => 'Upload', 'titulo' => 'UPLOAD DE FOTO E VÍDEO', 'description' => 'Efetuar cadastro', 'youtubclass' => 'youtub'); //só avalia o upload se for uma imagem // Redifine as preferências baseado na decisão do usuário $categoria = $this->config->item($this->input->post('imgcat')); $this->upload->set_max_width($categoria['max_width']); $this->upload->set_max_height($categoria['max_height']); $upload_path = 'uploads/' . $this->input->post('imgcat') . '/' . $this->user->userID() . '/'; $this->upload->set_upload_path($upload_path); verifyPath($upload_path); if ($this->validation->run()) { if ($data['tipo'] == 1 and !$this->upload->do_upload()) { $this->messages->add($this->upload->display_errors('', '')); } else { $data += array('upload_data' => $this->upload->data()); if ($data['tipo'] == 1) { $this->_createThumbnail($data['upload_data']['file_name']); } $id = $this->user->getUserIdByEmail($this->auth->userMail()); $media = $data['tipo'] == 1 ? $data['upload_data']['file_name'] : $this->input->post('userfile'); $dados_img = array('id_usuario' => $id, 'media_url' => $media, 'nome_img' => $this->input->post('nome'), 'local_img' => $this->input->post('local'), 'media_type' => $data['tipo'], 'media_category' => $this->input->post('imgcat'), 'dtcadastro' => date('Y-m-d H:i:s')); $result = $this->user->gravaImg($dados_img); if ($result) { $this->messages->add("Dados inseridos com sucesso!", 'success'); } } $this->auth->clearCache(); redirect('profile', 'refresh'); } else { $this->load->view('upload', $data); } $this->auth->clearCache(); }
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses/>. Contact: Lyubomir Arsov, liubo (at) web-lobby.com */ include '../system.inc.php'; include 'functions.inc.php'; verifyAction('MOVEDIR'); checkAccess('MOVEDIR'); $path = trim(empty($_GET['d']) ? '' : $_GET['d']); $newPath = trim(empty($_GET['n']) ? '' : $_GET['n']); verifyPath($path); verifyPath($newPath); if (is_dir(fixPath($path))) { if (mb_strpos($newPath, $path) === 0) { echo getErrorRes(t('E_CannotMoveDirToChild')); } elseif (file_exists(fixPath($newPath) . '/' . basename($path))) { echo getErrorRes(t('E_DirAlreadyExists')); } elseif (rename(fixPath($path), fixPath($newPath) . '/' . basename($path))) { echo getSuccessRes(); } else { echo getErrorRes(t('E_MoveDir') . ' ' . basename($path)); } } else { echo getErrorRes(t('E_MoveDirInvalisPath')); }
function enviaArquivo() { $upload_path = $this->config->item('upload_path') . 'arquivo/'; $this->upload->set_upload_path($upload_path); $this->upload->set_max_width(0); $this->upload->set_max_height(0); $this->upload->set_max_filesize(0); $this->upload->set_allowed_types($this->allowed); $path = verifyPath($upload_path); // Define o nome simplificado do arquivo if (isset($_FILES['arquivo']['name'])) { $_FILES['arquivo']['name'] = simplificaString($_FILES['arquivo']['name'], '_'); } if (!$this->upload->do_upload('arquivo')) { $this->messages->add($this->upload->display_errors()); return array(); } else { $this->auth->clearCache(); return $this->upload->data(); } }
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses/>. Contact: Lyubomir Arsov, liubo (at) web-lobby.com */ include '../system.inc.php'; include 'functions.inc.php'; verifyAction('UPLOAD'); checkAccess('UPLOAD'); $path = trim(empty($_POST['d']) ? getFilesPath() : $_POST['d']); verifyPath($path); $res = ''; if (is_dir(fixPath($path))) { if (!empty($_FILES['files']) && is_array($_FILES['files']['tmp_name'])) { $errors = $errorsExt = array(); foreach ($_FILES['files']['tmp_name'] as $k => $v) { $filename = $_FILES['files']['name'][$k]; $filename = RoxyFile::MakeUniqueFilename(fixPath($path), $filename); $filePath = fixPath($path) . '/' . $filename; if (!RoxyFile::CanUploadFile($filename)) { $errorsExt[] = $filename; } elseif (!move_uploaded_file($v, $filePath)) { $errors[] = $filename; } if (is_file($filePath)) { @chmod($filePath, octdec(FILEPERMISSIONS));
function make_xls() { $ids = $this->input->post('edit'); $reminders = getReminders("lembrete_id in (" . implode(',', $ids) . ")"); $content = ''; foreach ($reminders as $item) { // $status = $item['status']==0?'Não enviado':'Enviado'; // $content .= sprintf("<tr><td>%s</td><td>%s</td></tr>",$item['email'], $status); $content .= sprintf("<tr><td>%s</td></tr>", $item['email']); atualizaStatusLembrete($item['lembrete_id']); } $remindersHtml = "\n <table style='width:100%' summary='Lista de emails'>\n <thead>\n <tr>\n <th>Email</th>\n </tr>\n </thead>\n <tbody>\n {$content}\n </tbody>\n </table>"; $xlsUrl = $this->config->item('xls_path'); verifyPath($xlsUrl, 0777); $xlsUrl .= 'lista_de_emails.xls'; //date("d-m-Y", time()).".xls"; file_put_contents($xlsUrl, utf8_decode($remindersHtml)); redirect('admin'); die; }