Beispiel #1
0
function uploadContentFile()
{
    $StatusMessage = "";
    $ActualFileName = "";
    $FileObject = $_FILES["upload_file"];
    // find data on the file
    $DestPath = sys_get_temp_dir();
    $aux = '';
    $cadena = str_replace("\r\n", "", file_get_contents(htmlentities($FileObject['tmp_name'])));
    updateEditorContent(trim($cadena));
    closeWindow();
}
Beispiel #2
0
function uploadContentFile()
{
    G::LoadSystem('inputfilter');
    $filter = new InputFilter();
    $_FILES["upload_file"] = $filter->xssFilterHard($_FILES["upload_file"]);
    $StatusMessage = "";
    $ActualFileName = "";
    $DestPath = sys_get_temp_dir();
    $aux = '';
    $chain = preg_replace("/\r\n+|\r+|\n+|\t+/i", " ", file_get_contents($_FILES["upload_file"]["tmp_name"]));
    $chain = preg_replace('#<head(.*?)>(.*?)</head>#is', ' ', $chain);
    $chain = strip_tags($chain, '<address><label><canvas><option><ol><u><textarea><em><h1><h2><h3><h4><h5><h6><section><tbody><tr><th><td><hr><center><br><b><img><p><a><table><caption><thead><div><ul><li><form><input><strong><span><small><button><figure>');
    $chain = str_replace('"', "'", $chain);
    updateEditorContent(trim($chain));
    closeWindow();
}
Beispiel #3
0
 public function connect_ftp($id)
 {
     //cp_check_perm('module_install');
     if (is_really_writable(APPPATH . 'modules/')) {
         $use_dir = TRUE;
     } else {
         $use_dir = FALSE;
     }
     if (!function_exists('ftp_connect') and $use_dir == FALSE) {
         showMessage(lang("FTP_connect function is not available", "admin"), false, 'r');
         exit;
     }
     if ($use_dir == FALSE) {
         $this->load->library('ftp');
         $config['hostname'] = $_POST['host'];
         $config['username'] = $_POST['login'];
         $config['password'] = $_POST['password'];
         $config['port'] = $_POST['port'];
         $config['passive'] = FALSE;
         $config['debug'] = FALSE;
         if ($this->ftp->connect($config) == FALSE) {
             showMessage(lang("Server connection error:Check username and password"));
         }
     }
     $this->load->helper('string');
     $this->load->helper('file');
     $root = '/' . trim_slashes($_POST['root_folder']) . '/';
     if ($root == '//') {
         $root = '/';
     }
     // Try to find self.
     if ($use_dir == FALSE) {
         $list = $this->ftp->list_files($root . 'application/modules/admin');
         $error = TRUE;
         foreach ($list as $k => $v) {
             if ($v == 'mod_search.php') {
                 $error = FALSE;
             }
         }
         if ($error == TRUE) {
             showMessage(lang("Wrong path to the root directory", "admin"), false, 'r');
             exit;
         } else {
             // Store connection settings in cookie or db;
         }
     }
     //Download module zip file to tmp folder
     $request = $this->curl_post(array('action' => 'get_module', 'id' => (int) $id));
     $module_data = $request['result']['module_data'];
     if (($fh = fopen($module_data['file'], 'r')) == FALSE) {
         showMessage(lang("File downloading error", "admin"), false, 'r');
     } else {
         $name = end(explode('/', $module_data['file']));
         $name = explode('.', $name);
         $name = $name[0];
         $tmp_folder = './system/cache/';
         // Delete temp dir
         @delete_files($tmp_folder . $name . '/', TRUE);
         @rmdir($tmp_folder . $name . '/');
         // Download file
         $contents = stream_get_contents($fh);
         // Save file
         write_file($tmp_folder . $name . '.zip', $contents);
         // Create temp folder
         if ($use_dir == FALE) {
             if (!mkdir($tmp_folder . $name . '/')) {
                 showMessage(lang("Creation of temporary directory has been failed", "admin"), false, 'r');
                 fclose($fh);
                 if ($use_dir == FALSE) {
                     $this->ftp->close();
                 }
                 exit;
             }
         }
         // Uzip module files
         $zip_file = $tmp_folder . $name . '.zip';
         $this->load->library('pclzip', $zip_file);
         if ($use_dir == TRUE) {
             if (!file_exists(APPPATH . 'modules/' . $name)) {
                 mkdir(APPPATH . 'modules/' . $name);
                 chmod(APPPATH . 'modules/' . $name, 0777);
             } else {
                 showMessage(lang("Delete the directory to continue", "admin") . APPPATH . 'modules/' . $name, lang("Attention or Caution", "admin"), 'r');
                 exit;
             }
             if (($zip_result = $this->pclzip->extract(PCLZIP_OPT_PATH, APPPATH . 'modules/' . $name . '/')) == 0) {
                 showMessage(lang("Exploding error", "admin"), false, 'r');
                 exit;
             }
             $this->chmod_r(APPPATH . 'modules/' . $name);
             // Make install
             $this->load->module('admin/components');
             if (!$this->components->install($name)) {
                 showMessage(lang("Module installation error", "admin"), false, 'r');
             }
             // Delete temp dir
             @delete_files($tmp_folder . $name . '/', TRUE);
             @rmdir($tmp_folder . $name . '/');
             // Delete temp .zip file
             @unlink($tmp_folder . $name . '.zip');
             showMessage(lang("Modul has been installed", "admin"), false, 'g');
             // Close install window
             closeWindow('mod_install_w');
             exit;
         }
         if (($zip_result = $this->pclzip->extract(PCLZIP_OPT_PATH, $tmp_folder . $name . '/')) == 0) {
             showMessage(lang("Exploding error", "admin"), false, 'r');
         } else {
             // Files extracted
             // Create module folder
             $dest_folder = $root . 'application/modules/' . $name . '/';
             if ($use_dir == FALSE) {
                 $this->ftp->mkdir($dest_folder);
             }
             // Copy file to modules folder
             if ($use_dir == FALSE) {
                 if (!$this->ftp->mirror($tmp_folder . $name . '/', $dest_folder)) {
                     showMessage(lang("Creation of temporary directory has been failed", "admin"), false, 'r');
                 }
             }
             // Make install
             $this->load->module('admin/components');
             if (!$this->components->install($name)) {
                 showMessage(lang("Module installation module", "admin"), false, 'r');
             }
             // Delete temp dir
             @delete_files($tmp_folder . $name . '/', TRUE);
             @rmdir($tmp_folder . $name . '/');
             // Delete temp .zip file
             @unlink($tmp_folder . $name . '.zip');
             showMessage(lang("Modul has been installed", "admin"), false, 'g');
             // Close install window
             closeWindow('mod_install_w');
         }
         fclose($fh);
     }
     if ($use_dir == FALSE) {
         $this->ftp->close();
     }
 }
Beispiel #4
0
// @amats Define que o e-mail será enviado como HTML
$mail->CharSet = 'UTF-8';
// @amats Charset da mensagem (opcional)
// @amats Define a mensagem (Texto e Assunto)
// =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
$mail->Subject = "Mensagem de Erro SGO";
// @amats Assunto da mensagem
$mail->Body = '<hmtl>
								<b>Página: </b><br />' . $_GET['pag'] . '<br /><br />
								<b>Descrição: </b><br />' . $_GET['descricao'] . '<br /><br /><b>Data/Hora registro: </b>' . Date('d/m/Y h:m:s') . '</html>';
$mail->AltBody = $_POST['descricao'];
// @amats Define os anexos (opcional)
// =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
//$mail->AddAttachment("c:/temp/documento.pdf", "novo_nome.pdf");  // @amats Insere um anexo
// @amats Envia o e-mail
$enviado = $mail->Send();
// @amats Limpa os destinatários e os anexos
$mail->ClearAllRecipients();
$mail->ClearAttachments();
// @amats Exibe uma mensagem de resultado
if ($enviado) {
    // @amats Chama a função que exibe a mensagem e fecha a janela
    closeWindow();
} else {
    echo "Não foi possível enviar o e-mail.";
    echo "<b>Informações do erro:</b> " . $mail->ErrorInfo;
}
?>
	</body>

</html>
Beispiel #5
0
function uploadVariablePicker()
{
    $StatusMessage = "";
    $ActualFileName = "";
    $FileObject = $_REQUEST["upload_variable"];
    // find data on the file
    updateEditorContent(trim($FileObject));
    closeWindow();
}