errorName() public method

--------------------------------------------------------------------------------
public errorName ( $p_with_code = false )
Exemplo n.º 1
0
 function checkZip()
 {
     include_once SERVER_ROOT . "core/inc/lib/pclzip.php";
     $zip = new PclZip(SERVER_ROOT . "cache/update.zip");
     $zip->listContent();
     if ($zip->errorName() != "PCLZIP_ERR_NO_ERROR") {
         return false;
     }
     return true;
 }
Exemplo n.º 2
0
 /**
  * Extracts the package archive file
  * @return boolean True on success, False on error
  */
 function extractArchive()
 {
     global $mosConfig_absolute_path;
     $base_Dir = mosPathName($mosConfig_absolute_path . '/media');
     $archivename = $base_Dir . $this->installArchive();
     $tmpdir = uniqid('install_');
     $extractdir = mosPathName($base_Dir . $tmpdir);
     $archivename = mosPathName($archivename, false);
     $this->unpackDir($extractdir);
     if (eregi('.zip$', $archivename)) {
         // Extract functions
         require_once $mosConfig_absolute_path . '/administrator/includes/pcl/pclzip.lib.php';
         require_once $mosConfig_absolute_path . '/administrator/includes/pcl/pclerror.lib.php';
         //require_once( $mosConfig_absolute_path . '/administrator/includes/pcl/pcltrace.lib.php' );
         //require_once( $mosConfig_absolute_path . '/administrator/includes/pcl/pcltar.lib.php' );
         $zipfile = new PclZip($archivename);
         if ($this->isWindows()) {
             define('OS_WINDOWS', 1);
         } else {
             define('OS_WINDOWS', 0);
         }
         $ret = $zipfile->extract(PCLZIP_OPT_PATH, $extractdir);
         if ($ret == 0) {
             $this->setError(1, 'Unrecoverable error "' . $zipfile->errorName(true) . '"');
             return false;
         }
     } else {
         require_once $mosConfig_absolute_path . '/includes/Archive/Tar.php';
         $archive = new Archive_Tar($archivename);
         $archive->setErrorHandling(PEAR_ERROR_PRINT);
         if (!$archive->extractModify($extractdir, '')) {
             $this->setError(1, 'Extract Error');
             return false;
         }
     }
     $this->installDir($extractdir);
     // Try to find the correct install dir. in case that the package have subdirs
     // Save the install dir for later cleanup
     $filesindir = mosReadDirectory($this->installDir(), '');
     if (count($filesindir) == 1) {
         if (is_dir($extractdir . $filesindir[0])) {
             $this->installDir(mosPathName($extractdir . $filesindir[0]));
         }
     }
     return true;
 }
Exemplo n.º 3
0
<?php

include BigTree::path("inc/lib/pclzip.php");
$zip = new PclZip(SERVER_ROOT . "cache/update.zip");
$zip->listContent();
if ($zip->errorName() != "PCLZIP_ERR_NO_ERROR") {
    ?>
<div class="container">
	<summary><h2>Upgrade BigTree</h2></summary>
	<section>
		<p>An error occurred extracting the zip file. You can hit back to try the download again or click the ignore button below to try the auto upgrade again in a week.</p>
	</section>
	<footer>
		<a class="button blue" href="<?php 
    echo DEVELOPER_ROOT;
    ?>
upgrade/init/?type=<?php 
    echo htmlspecialchars($_GET["type"]);
    ?>
">Try Again</a>
		<a class="button" href="<?php 
    echo DEVELOPER_ROOT;
    ?>
upgrade/remind/">Remind Me Later</a>
	</footer>
</div>
<?php 
} else {
    // See if we can write to the root directory
    if (is_writable(SERVER_ROOT) && is_writable(SERVER_ROOT . "core/")) {
        $writable = true;
 /**
  * Extracts the package archive file
  * @return boolean True on success, False on error
  */
 function extractArchive()
 {
     $base_Dir = DOCMAN_Compat::mosPathName(JPATH_ROOT . '/media');
     $archivename = $base_Dir . $this->installArchive();
     $tmpdir = uniqid('install_');
     $extractdir = DOCMAN_Compat::mosPathName($base_Dir . $tmpdir);
     $archivename = DOCMAN_Compat::mosPathName($archivename, false);
     $this->unpackDir($extractdir);
     if (preg_match('/.zip$/i', $archivename)) {
         // Extract functions
         require_once JPATH_ADMINISTRATOR . DS . 'includes' . DS . 'pcl' . DS . 'pclzip.lib.php';
         require_once JPATH_ADMINISTRATOR . DS . 'includes' . DS . 'pcl' . DS . 'pclerror.lib.php';
         $zipfile = new PclZip($archivename);
         if ($this->isWindows()) {
             define('OS_WINDOWS', 1);
         } else {
             define('OS_WINDOWS', 0);
         }
         $ret = $zipfile->extract(PCLZIP_OPT_PATH, $extractdir);
         if ($ret == 0) {
             $this->setError(1, 'Unrecoverable error "' . $zipfile->errorName(true) . '"');
             return false;
         }
     } else {
         require_once JPATH_ROOT . DS . 'includes' . DS . 'Archive' . DS . 'Tar.php';
         $archive = new Archive_Tar($archivename);
         $archive->setErrorHandling(PEAR_ERROR_PRINT);
         if (!$archive->extractModify($extractdir, '')) {
             $this->setError(1, 'Extract Error');
             return false;
         }
     }
     $this->installDir($extractdir);
     // Try to find the correct install dir. in case that the package have subdirs
     // Save the install dir for later cleanup
     $filesindir = DOCMAN_Compat::mosReadDirectory($this->installDir(), '');
     if (count($filesindir) == 1) {
         if (is_dir($extractdir . $filesindir[0])) {
             $this->installDir(DOCMAN_Compat::mosPathName($extractdir . $filesindir[0]));
         }
     }
     return true;
 }
Exemplo n.º 5
0
 /**
  * Extracts the package archive file
  * @return boolean True on success, False on error
  */
 public function extractArchive()
 {
     $base_Dir = JPath::clean(JPATH_BASE . '/media');
     $archivename = $base_Dir . $this->_realname;
     $tmpdir = uniqid('install_');
     $extractdir = JPath::clean($base_Dir . $tmpdir);
     $archivename = JPath::clean($archivename, false);
     $this->_unpackdir = $extractdir;
     if (preg_match('/.zip$/', $archivename)) {
         // Extract functions
         require_once JPATH_ADMINISTRATOR . '/includes/pcl/pclzip.lib.php';
         require_once JPATH_ADMINISTRATOR . '/includes/pcl/pclerror.lib.php';
         $zipfile = new PclZip($this->_uploadfile);
         if ($this->_iswin) {
             define('OS_WINDOWS', 1);
         } else {
             define('OS_WINDOWS', 0);
         }
         $ret = $zipfile->extract(PCLZIP_OPT_PATH, $extractdir);
         if ($ret == 0) {
             $this->errno = 1;
             $this->error = 'Unrecoverable error "' . $zipfile->errorName(true) . '"';
             return false;
         }
     } else {
         require_once JPATH_SITE . '/includes/Archive/Tar.php';
         $archive = new Archive_Tar($this->_uploadfile);
         $archive->setErrorHandling(PEAR_ERROR_PRINT);
         if (!$archive->extractModify($extractdir, '')) {
             $this->setError(1, 'Extract Error');
             return false;
         }
     }
     // Try to find the correct install dir. in case that the package have subdirs
     // Save the install dir for later cleanup
     jimport('joomla.filesystem.folder');
     $this->_uploadfile = JFolder::files($extractdir, '');
     if (count($this->_uploadfile) == 1) {
         if (is_dir($extractdir . $this->_uploadfile[0])) {
             $this->_unpackdir = JPath::clean($extractdir . $this->_uploadfile[0]);
             $this->_uploadfile = JFolder::files($extractdir, '');
         }
     }
     return true;
 }
Exemplo n.º 6
0
 /**
  * Upload a theme into my site
  *
  * @license    GPL 2 (http://www.gnu.org/licenses/gpl.html)
  * @author     Samuele Tognini <*****@*****.**>
  */
 function upload($theme, $info)
 {
     $return = true;
     $host = 'samuele.netsons.org';
     $path = '/dokuwiki/lib/plugins/indexmenu/upload/index.php';
     //TODO: merge zip creation with that in ajax.php (create a class?)
     if (!($absdir = $this->checktmpsubdir())) {
         return false;
     }
     $tmp = $absdir . "/tmp";
     $zipfile = "{$theme}.zip";
     $filelist = "{$absdir}/{$theme}";
     //create info
     if (!empty($info)) {
         io_savefile("{$tmp}/{$theme}/info.txt", $info);
         $filelist .= ",{$tmp}/{$theme}";
     }
     //create zip
     $zip = new PclZip("{$tmp}/{$zipfile}");
     $status = $zip->create($filelist, PCLZIP_OPT_REMOVE_ALL_PATH);
     if ($status == 0) {
         //error
         msg($this->getLang('zip_err') . ": " . $zip->errorName(true), -1);
         $return = false;
     } else {
         //prepare POST headers.
         $boundary = "---------------------------" . uniqid("");
         $data = join("", file("{$tmp}/{$zipfile}"));
         $header = "POST {$path} HTTP/1.0\r\n";
         $header .= "Host: {$host}\r\n";
         $header .= "User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.8.1) Gecko/20061024 Iceweasel/2.0 (Debian-2.0+dfsg-1)\r\n";
         $header .= "Content-type: multipart/form-data, boundary={$boundary}\r\n";
         $body = "--" . $boundary . "\r\n";
         $body .= "Content-Disposition: form-data; name=\"userfile\"; filename=\"{$zipfile}\"\r\n";
         $body .= "Content-Type: application/x-zip-compressed\r\n\r\n";
         $body .= $data . "\r\n";
         $body .= "--" . $boundary . "\r\n";
         $body .= "Content-Disposition: form-data; name=\"upload\"\r\n\r\n";
         $body .= "Upload\r\n";
         $body .= "--" . $boundary . "--\r\n";
         $header .= "Content-Length: " . strlen($body) . "\r\n\r\n";
         //connect and send zip
         if ($fp = fsockopen($host, 80)) {
             fwrite($fp, $header . $body);
             //reply
             $buf = "";
             while (!feof($fp)) {
                 $buf .= fgets($fp, 3200);
             }
             fclose($fp);
             //parse resply
             if (preg_match("/<!--indexmenu-->(.*)<!--\\/indexmenu-->/s", $buf, $match)) {
                 $str = substr($match[1], 4, 7);
                 switch ($str) {
                     case "ERROR  ":
                         $mesg_type = -1;
                         break;
                     case "SUCCESS":
                         $mesg_type = 1;
                         break;
                     default:
                         $mesg_type = 2;
                 }
                 msg($match[1], $mesg_type);
             } else {
                 $return = false;
             }
         } else {
             $return = false;
         }
     }
     $this->_rm_dir($tmp);
     return $return;
 }
Exemplo n.º 7
0
 function _compressFiles($name)
 {
     require_once MAX_PATH . '/lib/pclzip/pclzip.lib.php';
     define('OS_WINDOWS', substr(PHP_OS, 0, 3) == 'WIN' ? 1 : 0);
     $target = $this->outputDir . $name . '.zip';
     $oZip = new PclZip($target);
     $result = $oZip->create($this->aFileList, PCLZIP_OPT_REMOVE_PATH, $this->basePath);
     if ($oZip->errorCode()) {
         $this->aErrors[] = 'compression error: ' . $oZip->errorName(true);
         return false;
     }
     if (!$result || !count($result)) {
         $this->aErrors[] = 'no files were compressed';
         return false;
     }
     //$aContents = $oZip->listContent();
     $error = !file_exists($target);
     if (!$error) {
         foreach ($result as $i => $aInfo) {
             if ($aInfo['status'] != 'ok') {
                 switch ($aInfo['status']) {
                     case 'filename_too_long':
                     case 'write_error':
                     case 'read_error':
                     case 'invalid_header':
                         $this->aErrors[] = 'Error: ' . $aInfo['status'] . ' : ' . $aInfo['filename'];
                         $error = true;
                         break;
                     case 'filtered':
                     case 'skipped':
                     default:
                         break;
                 }
             }
         }
     }
     return $error ? false : $target;
 }
Exemplo n.º 8
0
 function &getPatchContents($updatepackage)
 {
     global $vmLogger, $mosConfig_absolute_path, $VM_LANG;
     $extractdir = vmUpdate::getPackageDir($updatepackage);
     $update_manifest = $extractdir . '/update.xml';
     $result = true;
     if (!file_exists($update_manifest)) {
         if (vmIsJoomla('1.5', '>=')) {
             jimport('joomla.filesystem.archive');
             if (!JArchive::extract($updatepackage, $extractdir)) {
                 $vmLogger->err($VM_LANG->_('VM_UPDATE_ERR_EXTRACT_FAILED') . " " . $extractdir);
                 $result = false;
                 return $result;
             }
         } else {
             $file_info = pathinfo($updatepackage);
             switch ($file_info['extension']) {
                 case 'gz':
                     require_once ADMINPATH . 'Tar.php';
                     $package_archive = new Archive_Tar($updatepackage, "gz");
                     $result = $package_archive->extract($extractdir . '/');
                     if (!$result) {
                         $vmLogger->err($VM_LANG->_('VM_UPDATE_ERR_EXTRACT_FAILED') . " " . $extractdir);
                         $result = false;
                         return $result;
                     }
                     break;
                 case 'zip':
                     // Extract functions
                     require_once $mosConfig_absolute_path . '/administrator/includes/pcl/pclzip.lib.php';
                     require_once $mosConfig_absolute_path . '/administrator/includes/pcl/pclerror.lib.php';
                     $zipfile = new PclZip($updatepackage);
                     $ret = $zipfile->extract(PCLZIP_OPT_PATH, $extractdir);
                     if ($ret == 0) {
                         $vmLogger->err($VM_LANG->_('VM_UPDATE_ERR_EXTRACT_FAILED') . " " . $extractdir . ' (' . $zipfile->errorName(true) . ')');
                         return false;
                     }
                     break;
                 default:
                     $vmLogger->err('An invalid patch package extension was detected. Allowed Types: tar.gz and zip');
                     return false;
             }
         }
     }
     $fileArr = array();
     $queryArr = array();
     $result = true;
     // Can we use the PHP5 SimpleXML Extension ?
     if (function_exists('simplexml_load_file')) {
         $xml = @simplexml_load_file($update_manifest);
         if ($xml === false) {
             $vmLogger->err($VM_LANG->_('VM_UPDATE_ERR_PARSE_FAILED'));
             return false;
         }
         $toversion = (string) $xml->toversion;
         $forversion = (string) $xml->forversion;
         $description = (string) $xml->description;
         $releasedate = (string) $xml->releasedate;
         foreach ($xml->files->file as $file) {
             if (file_exists($extractdir . '/' . $file)) {
                 $fileArr[] = array('filename' => (string) $file, 'copy_policy' => (string) @$file['copy']);
             } else {
                 $vmLogger->err(sprintf($VM_LANG->_('VM_UPDATE_ERR_FILE_MISSING'), $file));
                 $result = false;
             }
         }
         if ($result === false) {
             return $result;
         }
         if (!empty($xml->queries->query)) {
             foreach ($xml->queries->query as $query) {
                 $queryArr[] = (string) $query;
             }
         }
         // RickG - Look for an install file
         $installfile = (string) $xml->vminstallfile;
         if ($installfile) {
             if (file_exists($extractdir . DS . $installfile)) {
                 $returnArr['installfile'] = $extractdir . DS . $installfile;
             } else {
                 $returnArr['installfile'] = '';
             }
         }
     } else {
         // Use the SimpleXML Equivalent
         require_once CLASSPATH . 'simplexml.php';
         $xml = new vmSimpleXML();
         $result = $xml->loadFile($update_manifest);
         if ($result === false) {
             $vmLogger->err($VM_LANG->_('VM_UPDATE_ERR_PARSE_FAILED'));
             return false;
         }
         $result = true;
         $xml = $xml->document;
         $toversion = $xml->toversion[0]->data();
         $forversion = $xml->forversion[0]->data();
         $description = $xml->description[0]->data();
         $releasedate = $xml->releasedate[0]->data();
         foreach ($xml->files[0]->file as $file) {
             if (file_exists($extractdir . '/' . $file->data())) {
                 $fileArr[] = array('filename' => $file->data(), 'copy_policy' => $file->attributes('copy'));
             } else {
                 $vmLogger->err(sprintf($VM_LANG->_('VM_UPDATE_ERR_FILE_MISSING'), $file));
                 $result = false;
             }
         }
         if ($result === false) {
             return $result;
         }
         if (!empty($xml->queries[0]->query) && is_object($xml->queries[0]->query)) {
             foreach ($xml->queries[0]->query as $query) {
                 $queryArr[] = $query->data();
             }
         }
         // RickG - Look for an install file
         $installfile = (string) $xml->vminstallfile;
         if ($installfile) {
             if (file_exists($extractdir . DS . $installfile)) {
                 $returnArr['installfile'] = $extractdir . DS . $installfile;
             } else {
                 $returnArr['installfile'] = '';
             }
         }
     }
     $returnArr['toversion'] = $toversion;
     $returnArr['forversion'] = $forversion;
     $returnArr['description'] = $description;
     $returnArr['releasedate'] = $releasedate;
     $returnArr['fileArr'] =& $fileArr;
     $returnArr['queryArr'] =& $queryArr;
     return $returnArr;
 }
Exemplo n.º 9
0
function chargeur_charger_zip($quoi = array())
{
	if (!$quoi) {
		return true;
	}
	if (is_scalar($quoi)) {
		$quoi = array('zip' => $quoi);
	}
	if (isset($quoi['depot']) || isset($quoi['nom'])) {
		$quoi['zip'] = $quoi['depot'] . $quoi['nom'] . '.zip';
	}
	foreach (array(	'remove' => 'spip',
					'arg' => 'lib',
					'plugin' => null,
					'cache_cache' => null,
					'rename' => array(),
					'edit' => array(),
					'root_extract' => false, # extraire a la racine de dest ?
					'tmp' => sous_repertoire(_DIR_CACHE, 'chargeur')
				)
				as $opt=>$def) {
		isset($quoi[$opt]) || ($quoi[$opt] = $def);
	}


	# destination finale des fichiers
	switch($quoi['arg']) {
		case 'lib':
			$quoi['dest'] = _DIR_RACINE.'lib/';
			break;
		case 'plugins':
			$quoi['dest'] = _DIR_PLUGINS_AUTO;
			break;
		default:
			$quoi['dest'] = '';
			break;
	}


	if (!@file_exists($fichier = $quoi['fichier']))
		return 0;

	include_spip('inc/pclzip');
	$zip = new PclZip($fichier);
	$list = $zip->listContent();

	// on cherche la plus longue racine commune a tous les fichiers
	$max_n = 999999;
	foreach($list as $n) {
		$p = array();
		foreach(explode('/', $n['filename']) as $n => $x) {
			if ($n>$max_n)
				continue;
			$sofar = join('/',$p);
			$paths[$n][$sofar]++;
			$p[] = $x;
		}
		$max_n = min($n,$max_n);
	}

	$total = $paths[0][''];
	$i = 0;
	while (isset($paths[$i])
	AND count($paths[$i]) <= 1
	AND array_values($paths[$i]) == array($total))
		$i++;

	$racine = '';
	if ($i){
		$racine = array_keys($paths[$i-1]);
		$racine = array_pop($racine).'/';
	}

	$quoi['remove'] = $racine;

	if (!strlen($nom = basename($racine)))
		$nom = basename($fichier, '.zip');

	$dir_export = $quoi['root_extract']
		? $quoi['dest']
		: $quoi['dest'] . $nom.'/';

	$tmpname = $quoi['tmp'].$nom.'/';

	// On extrait, mais dans tmp/ si on ne veut pas vraiment le faire
	$ok = $zip->extract(
		PCLZIP_OPT_PATH,
			$quoi['extract']
				? $dir_export
				: $tmpname
		,
		PCLZIP_OPT_SET_CHMOD, _SPIP_CHMOD,
		PCLZIP_OPT_REPLACE_NEWER,
		PCLZIP_OPT_REMOVE_PATH, $quoi['remove']
	);
	if ($zip->error_code < 0) {
		spip_log('charger_decompresser erreur zip ' . $zip->error_code .
			' pour paquet: ' . $quoi['zip']);
		return //$zip->error_code
			$zip->errorName(true);
	}

/*
 * desactive pour l'instant
 *
 *
		if (!$quoi['cache_cache']) {
			chargeur_montre_tout($quoi);
		}
		if ($quoi['rename']) {
			chargeur_rename($quoi);
		}
		if ($quoi['edit']) {
			chargeur_edit($dir_export, $quoi['edit']);
		}

		if ($quoi['plugin']) {
			chargeur_activer_plugin($quoi['plugin']);
		}
*/

	spip_log('charger_decompresser OK pour paquet: ' . $quoi['zip']);



	$size = $compressed_size = 0;
	$removex = ',^'.preg_quote($quoi['remove'], ',').',';
	foreach ($list as $a => $f) {
		$size += $f['size'];
		$compressed_size += $f['compressed_size'];
		$list[$a] = preg_replace($removex,'',$f['filename']);
	}

	// Indiquer par un fichier install.log
	// a la racine que c'est chargeur qui a installe ce plugin
	ecrire_fichier($tmpname.'/install.log',
		"installation: charger_plugin\n"
		."date: ".gmdate('Y-m-d\TH:i:s\Z', time())."\n"
		."source: ".$quoi['zip']."\n"
	);



	return array(
		'files' => $list,
		'size' => $size,
		'compressed_size' => $compressed_size,
		'dirname' => $dir_export,
		'tmpname' => $tmpname
	);
}
Exemplo n.º 10
0
 /**
  * Extracts the package archive file
  * @return boolean True on success, False on error
  */
 function extractArchive($filename)
 {
     $mosConfig_absolute_path = mamboCore::get('mosConfig_absolute_path');
     $base_Dir = mosPathName($mosConfig_absolute_path . '/media');
     $this->archiveName = $base_Dir . $filename;
     $tmpdir = uniqid('install_');
     $this->extractDir = $this->cleanDir = mosPathName($base_Dir . uniqid('install_'));
     if (eregi('.zip$', $filename)) {
         // Extract functions
         require_once $mosConfig_absolute_path . '/administrator/includes/pcl/pclzip.lib.php';
         require_once $mosConfig_absolute_path . '/administrator/includes/pcl/pclerror.lib.php';
         //require_once( $mosConfig_absolute_path . '/administrator/includes/pcl/pcltrace.lib.php' );
         //require_once( $mosConfig_absolute_path . '/administrator/includes/pcl/pcltar.lib.php' );
         $zipfile = new PclZip($this->archiveName);
         $ret = $zipfile->extract(PCLZIP_OPT_PATH, $this->extractDir);
         if ($ret == 0) {
             $this->errors->addErrorDetails(sprintf(T_('Installer unrecoverable ZIP error %s in %s'), $zipfile->errorName(true), $this->archiveName), _MOS_ERROR_FATAL);
             return false;
         }
     } else {
         require_once $mosConfig_absolute_path . '/includes/Archive/Tar.php';
         $archive =& new Archive_Tar($this->archiveName);
         $archive->setErrorHandling(PEAR_ERROR_PRINT);
         if (!$archive->extractModify($this->extractDir, '')) {
             $this->errors->addErrorDetails(sprintf(T_('Installer unrecoverable TAR error in %s'), $this->archiveName), _MOS_ERROR_FATAL);
             return false;
         }
     }
     // Try to find the correct install dir. in case that the package have subdirs
     // Save the install dir for later cleanup
     $dir =& new mosDirectory($this->extractDir);
     $singledir = $dir->soleDir();
     if ($singledir) {
         $this->extractDir = mosPathName($this->extractDir . $singledir);
     }
     return true;
 }
Exemplo n.º 11
0
/**
 * Charger un zip à partir d'un tableau d'options descriptives
 *
 * @uses  http_deballe_recherche_racine()
 *
 * @param array $quoi
 *     Tableau d'options
 * @return array|bool|int|string
 *     En cas de réussite, Tableau décrivant le zip, avec les index suivant :
 *     - files : la liste des fichiers présents dans le zip,
 *     - size : la taille décompressée
 *     - compressed_size : la taille compressée
 *     - dirname : répertoire où les fichiers devront être décompréssés
 *     - tmpname : répertoire temporaire où les fichiers sont décompressés
 *     - target : cible sur laquelle décompresser les fichiers...
 */
function teleporter_http_charger_zip($quoi = array())
{
    if (!$quoi) {
        return false;
    }
    foreach (array('remove' => 'spip', 'rename' => array(), 'edit' => array(), 'root_extract' => false, 'tmp' => sous_repertoire(_DIR_CACHE, 'chargeur')) as $opt => $def) {
        isset($quoi[$opt]) || ($quoi[$opt] = $def);
    }
    if (!@file_exists($fichier = $quoi['fichier'])) {
        return 0;
    }
    include_spip('inc/pclzip');
    $zip = new PclZip($fichier);
    $list = $zip->listContent();
    $racine = http_deballe_recherche_racine($list);
    $quoi['remove'] = $racine;
    // si pas de racine commune, reprendre le nom du fichier zip
    // en lui enlevant la racine h+md5 qui le prefixe eventuellement
    // cf action/charger_plugin L74
    if (!strlen($nom = basename($racine))) {
        $nom = preg_replace(",^h[0-9a-f]{8}-,i", "", basename($fichier, '.zip'));
    }
    $dir_export = $quoi['root_extract'] ? $quoi['dest'] : $quoi['dest'] . $nom;
    $dir_export = rtrim($dir_export, '/') . '/';
    $tmpname = $quoi['tmp'] . $nom . '/';
    // choisir la cible selon si on veut vraiment extraire ou pas
    $target = $quoi['extract'] ? $dir_export : $tmpname;
    // ici, il faut vider le rep cible si il existe deja, non ?
    if (is_dir($target)) {
        supprimer_repertoire($target);
    }
    // et enfin on extrait
    $ok = $zip->extract(PCLZIP_OPT_PATH, $target, PCLZIP_OPT_SET_CHMOD, _SPIP_CHMOD, PCLZIP_OPT_REPLACE_NEWER, PCLZIP_OPT_REMOVE_PATH, $quoi['remove']);
    if ($zip->error_code < 0) {
        spip_log('charger_decompresser erreur zip ' . $zip->error_code . ' pour paquet: ' . $quoi['archive'], "teleport" . _LOG_ERREUR);
        return $zip->errorName(true);
    }
    spip_log('charger_decompresser OK pour paquet: ' . $quoi['archive'], "teleport");
    $size = $compressed_size = 0;
    $removex = ',^' . preg_quote($quoi['remove'], ',') . ',';
    foreach ($list as $a => $f) {
        $size += $f['size'];
        $compressed_size += $f['compressed_size'];
        $list[$a] = preg_replace($removex, '', $f['filename']);
    }
    // Indiquer par un fichier install.log
    // a la racine que c'est chargeur qui a installe ce plugin
    ecrire_fichier($target . 'install.log', "installation: charger_plugin\n" . "date: " . gmdate('Y-m-d\\TH:i:s\\Z', time()) . "\n" . "source: " . $quoi['archive'] . "\n");
    return array('files' => $list, 'size' => $size, 'compressed_size' => $compressed_size, 'dirname' => $dir_export, 'tmpname' => $tmpname, 'target' => $target);
}
Exemplo n.º 12
0
 function upload_save($redirect = true)
 {
     global $my, $mainframe, $database, $option, $priTask, $subTask;
     global $WBG_CONFIG, $wbGalleryDB_cat, $wbGallery_common, $wbGallery_eng;
     // Prepare Runtime
     $tempDir = null;
     $known_images = array('image/pjpeg', 'image/jpeg', 'image/jpg', 'image/png', 'image/gif');
     $time = time();
     // Importing
     $importFolder = mosGetParam($_REQUEST, 'folder', '');
     if ($importFolder && !file_exists($importFolder)) {
         echo "<script> alert('Import Folder Does Not Exist'); document.location.href='index2.php?option=" . $option . "&task=image.upload'; </script>\n";
         exit;
     }
     // Default Values
     $defRow = new wbGalleryDB_img($database);
     $defRow->bind($_POST);
     // Debug
     echo "Image Processing Start: " . $time . '<br/>';
     // ==============================v========================================
     // Single File Upload
     if (!empty($_FILES['img']['tmp_name'])) {
         // Debug
         echo "Single File Detected <br/>";
         if (!in_array($_FILES['img']['type'], $known_images)) {
             echo "<script> alert('Image type: " . $_FILES['img']['type'] . " is an unknown type'); document.location.href='index2.php?option=" . $option . "&task=image.upload'; </script>\n";
             exit;
         }
         $wbGallery_eng->add($_FILES['img']['tmp_name'], $_FILES['img']['name'], $_FILES['img']['type'], $defRow);
         if ($redirect) {
             mosRedirect('index2.php?option=' . $option . '&task=image.upload', 'Image Saved');
         }
     }
     // ==============================v========================================
     // Zip File Upload
     if (!empty($_FILES['zip']['tmp_name'])) {
         //zip file upload
         // Debug
         echo "Compressed File Uploaded <br/>";
         // Create / Define Temporary Folder for Unzipped Files
         if (!mkdir($mainframe->getCfg('absolute_path') . '/media/' . $time)) {
             if (!mkdir('/tmp/' . $time)) {
                 echo "<script> alert('Unable to Create Temp Directory'); history.back(); </script>\n";
                 exit;
             } else {
                 $tempDir = '/tmp/' . $time;
             }
         } else {
             $tempDir = $mainframe->getCfg('absolute_path') . '/media/' . $time;
         }
         // Uncompress ZIP or TAR.GZ
         if (preg_match('/zip$/i', $_FILES['zip']['name'])) {
             // Load ZIP functions
             require_once $mainframe->getCfg('absolute_path') . '/administrator/includes/pcl/pclzip.lib.php';
             require_once $mainframe->getCfg('absolute_path') . '/administrator/includes/pcl/pclerror.lib.php';
             $zipfile = new PclZip($_FILES['zip']['tmp_name']);
             if (substr(PHP_OS, 0, 3) == 'WIN') {
                 define('OS_WINDOWS', 1);
             } else {
                 define('OS_WINDOWS', 0);
             }
             $ret = $zipfile->extract(PCLZIP_OPT_PATH, $tempDir);
             if ($ret == 0) {
                 $wbGallery_common->remove_dir($tempDir);
                 echo "<script> alert('ZIP Extraction Error: " . $zipfile->errorName(true) . "'); history.back(); </script>\n";
                 exit;
             }
         } elseif (preg_match('/tar.gz$/i', $_FILES['zip']['name'])) {
             // Load TAR functions
             require_once $mainframe->getCfg('absolute_path') . '/includes/Archive/Tar.php';
             $archive = new Archive_Tar($_FILES['zip']['tmp_name']);
             $archive->setErrorHandling(PEAR_ERROR_PRINT);
             if (!$archive->extractModify($tempDir, '')) {
                 $wbGallery_common->remove_dir($tempDir);
                 echo "<script> alert('TAR Extraction Error'); history.back(); </script>\n";
                 exit;
             }
         } else {
             // Unknown File...
             $wbGallery_common->remove_dir($tempDir);
             echo "<script> alert('Unknown File Format - Must be .ZIP or .TAR.GZ'); history.back(); </script>\n";
             exit;
         }
     }
     // Zip File Upload
     // ==============================v========================================
     // Process Files from Folder
     if ($tempDir || $importFolder) {
         $processDirs = array();
         $files_added = 0;
         $files_skipped = 0;
         if ($tempDir) {
             $processDirs[] = array('path' => $tempDir, 'remove' => 1);
         }
         if ($importFolder) {
             $processDirs[] = array('path' => $importFolder, 'remove' => 0);
         }
         if (count($processDirs)) {
             foreach ($processDirs as $procDir) {
                 // Read Files from Temp Folder
                 $regImg = array();
                 foreach ($known_images as $k) {
                     $regImg[] = preg_replace('/^.*\\//', '', $k) . '$';
                 }
                 $regStr = '/' . join('|', $regImg) . '/';
                 $files = $wbGallery_common->find_files($procDir['path'], $regStr);
                 unset($regImg);
                 unset($regStr);
                 // Debug
                 echo "Unzipped " . count($files) . " for processing <br/>";
                 if (count($files)) {
                     foreach ($files as $file) {
                         $filePath = $file['path'] . '/' . $file['name'];
                         $res = getimagesize($filePath);
                         $fileType = $res['mime'];
                         if (in_array($fileType, $known_images)) {
                             if ($wbGallery_eng->add($filePath, $file['name'], $fileType, $defRow)) {
                                 $files_added++;
                             } else {
                                 $files_skipped++;
                             }
                         } else {
                             $files_skipped++;
                         }
                     }
                 }
                 if ($procDir['remove']) {
                     $wbGallery_common->remove_dir($procDir['path']);
                 }
             }
             // foreach processDirs
         }
         // if processDirs
         if ($redirect) {
             if (!$files_added && !$files_skipped) {
                 mosRedirect('index2.php?option=' . $option . '&task=image.upload', 'Error: No Files were Processed or Error Finding Files');
             } else {
                 mosRedirect('index2.php?option=' . $option . '&task=image.upload', $files_added . ' images added - ' . $files_skipped . ' files skipped');
             }
         } else {
             if (!$files_added && !$files_skipped) {
                 return false;
             } else {
                 return true;
             }
         }
     }
     mosRedirect('index2.php?option=' . $option . '&task=image.upload', 'Please Specify Images for Processing');
     return false;
 }
Exemplo n.º 13
0
 function themeUpload()
 {
     if (!$_POST['ac'] == md5(ADMINPWCHANGE)) {
         exit;
     }
     $mes = e107::getMessage();
     $ns = e107::getRender();
     extract($_FILES);
     if (!is_writable(e_THEME)) {
         //	$ns->tablerender(TPVLAN_16, TPVLAN_20);
         $mes->add(TPVLAN_20, E_MESSAGE_INFO);
         return FALSE;
     } else {
         require_once e_HANDLER . "upload_handler.php";
         $fileName = $file_userfile['name'][0];
         $fileSize = $file_userfile['size'][0];
         $fileType = $file_userfile['type'][0];
         if (strstr($file_userfile['type'][0], "gzip")) {
             $fileType = "tar";
         } else {
             if (strstr($file_userfile['type'][0], "zip")) {
                 $fileType = "zip";
             } else {
                 $mes->add(TPVLAN_17, E_MESSAGE_ERROR);
                 //	$ns->tablerender(TPVLAN_16, TPVLAN_17);
                 //	require_once("footer.php");
                 return FALSE;
             }
         }
         if ($fileSize) {
             $uploaded = file_upload(e_THEME);
             $archiveName = $uploaded[0]['name'];
             if ($fileType == "zip") {
                 require_once e_HANDLER . "pclzip.lib.php";
                 $archive = new PclZip(e_THEME . $archiveName);
                 $unarc = $fileList = $archive->extract(PCLZIP_OPT_PATH, e_THEME, PCLZIP_OPT_SET_CHMOD, 0666);
             } else {
                 require_once e_HANDLER . "pcltar.lib.php";
                 $unarc = $fileList = PclTarExtract($archiveName, e_THEME);
             }
             if (!$unarc) {
                 if ($fileType == "zip") {
                     $error = TPVLAN_46 . " '" . $archive->errorName(TRUE) . "'";
                 } else {
                     $error = TPVLAN_47 . PclErrorString() . ", " . TPVLAN_48 . intval(PclErrorCode());
                 }
                 $mes->add(TPVLAN_18 . " " . $archiveName . " " . $error, E_MESSAGE_ERROR);
                 //	$ns->tablerender(TPVLAN_16, TPVLAN_18." ".$archiveName." ".$error);
                 return FALSE;
             }
             $folderName = substr($fileList[0]['stored_filename'], 0, strpos($fileList[0]['stored_filename'], "/"));
             $mes->add(TPVLAN_19, E_MESSAGE_SUCCESS);
             if (varset($_POST['setUploadTheme'])) {
                 $themeArray = $this->getThemes();
                 $this->id = $themeArray[$folderName]['id'];
                 $this->setTheme();
             }
             //		$ns->tablerender(TPVLAN_16, "<div class='center'>".TPVLAN_19."</div>");
             @unlink(e_THEME . $archiveName);
         }
     }
 }
 /**
  * Extracts the package archive file
  * @return boolean True on success, False on error
  */
 function extractArchive()
 {
     global $_CB_framework;
     $base_Dir = _cbPathName($_CB_framework->getCfg('tmp_path'));
     $archivename = $this->installArchive();
     $tmpdir = uniqid('install_');
     $extractdir = _cbPathName($base_Dir . $tmpdir);
     $archivename = _cbPathName($archivename, false);
     $this->unpackDir($extractdir);
     if (preg_match("/\\.zip\$/i", $archivename)) {
         // Extract functions
         cbimport('pcl.pclziplib');
         $zipfile = new PclZip($archivename);
         if ($this->isWindows()) {
             define('OS_WINDOWS', 1);
         } else {
             define('OS_WINDOWS', 0);
         }
         $ret = $zipfile->extract(PCLZIP_OPT_PATH, $extractdir);
         if ($ret == 0) {
             $this->setError(1, 'Unrecoverable error "' . $zipfile->errorName(true) . '"');
             return false;
         }
     } else {
         cbimport('pcl.tar');
         // includes/Archive/Tar.php' );
         $archive = new Archive_Tar($archivename);
         $archive->setErrorHandling(PEAR_ERROR_PRINT);
         if (!$archive->extractModify($extractdir, '')) {
             $this->setError(1, 'Extract Error');
             return false;
         }
     }
     $this->installDir($extractdir);
     // Try to find the correct install dir. in case that the package have subdirs
     // Save the install dir for later cleanup
     $filesindir = cbReadDirectory($this->installDir(), '');
     if (count($filesindir) == 1) {
         if (is_dir($extractdir . $filesindir[0])) {
             $this->installDir(_cbPathName($extractdir . $filesindir[0]));
         }
     }
     return true;
 }
Exemplo n.º 15
0
function action_odt2spip_importe() {
    global $visiteur_session;
    
    $id_auteur = $visiteur_session['id_auteur'];
    $arg = _request('arg');
    $args = explode(":",$arg);
	
    // le 1er element de _request('arg') est id_rubrique=XXX
    $Targs = explode("=", $args[0]);
    $id_rubrique = $Targs[1];
    $hash = _request('hash');
    
    $redirect = _request('redirect');
	  if ($redirect==NULL) $redirect="";
    
    include_spip("inc/securiser_action");
    
    if (!autoriser('creerarticledans', 'rubrique', $id_rubrique)) die(_T('avis_non_acces_page'));

	// ss-rep temporaire specifique de l'auteur en cours: tmp/odt2spip/id_auteur/ => le creer si il n'existe pas
    $base_dezip = _DIR_TMP."odt2spip/";   // avec / final
    if (!is_dir($base_dezip)) if (!sous_repertoire(_DIR_TMP,'odt2spip')) die (_T('odtspip:err_repertoire_tmp'));  
    $rep_dezip = $base_dezip.$id_auteur.'/';
    if (!is_dir($rep_dezip)) if (!sous_repertoire($base_dezip,$id_auteur)) die (_T('odtspip:err_repertoire_tmp'));
    
	// traitement d'un fichier odt envoye par $_POST 
    $fichier_zip = addslashes($_FILES['fichier_odt']['name']);
    if ($_FILES['fichier_odt']['name'] == '' 
        OR $_FILES['fichier_odt']['error'] != 0
        OR !move_uploaded_file($_FILES['fichier_odt']['tmp_name'], $rep_dezip.$fichier_zip)
       )  die(_T('odtspip:err_telechargement_fichier'));

  // dezipper le fichier odt a la mode SPIP
    include_spip("inc/pclzip");
    $zip = new PclZip($rep_dezip.$fichier_zip);
	  $ok = $zip->extract(
		    PCLZIP_OPT_PATH, $rep_dezip,
		    PCLZIP_OPT_SET_CHMOD, _SPIP_CHMOD,
		    PCLZIP_OPT_REPLACE_NEWER
	  );
	  if ($zip->error_code < 0) {
		    spip_log('charger_decompresser erreur zip ' . $zip->error_code .' pour fichier ' . $rep_dezip.$fichier_zip);
		    die($zip->errorName(true));  //$zip->error_code
	  }
    
	// Creation du fichier necessaire a snippets
	  $odt2spip_generer_sortie = charger_fonction('odt2spip_generer_sortie','inc');
	  list($fichier_sortie,$xml_sortie) = $odt2spip_generer_sortie($id_auteur,$rep_dezip);

	// generer l'article a partir du fichier xml de sortie (code pompe sur plugins/snippets/action/snippet_importe.php)
    include_spip('inc/snippets');
		$table = $id = 'articles';
		$contexte = $args[0];
		$source = $fichier_sortie;
    if (!$f = snippets_fonction_importer($table)) die(_T('odtspip:err_import_snippet'));
    include_spip('inc/xml');
    $arbre = spip_xml_load($source, false);
    $translations = $f($id,$arbre,$contexte);
    snippets_translate_raccourcis_modeles($translations);
    $id_article = $translations[0][2];

	// si on est en 2.0 passer le statut de l'article en prepa
    sql_updateq('spip_articles', array('statut' => 'prop'), 'id_article='.$id_article);
    
	// si necessaire attacher le fichier odt original a l'article et lui mettre un titre signifiant
    if (_request('attacher_odt') == '1') {
		// recuperer le titre
        preg_match('/<titre>(.*?)<\/titre>/', $xml_sortie, $match);
        $titre = $match[1];
        if (!isset($ajouter_documents)) 
        	$ajouter_documents = charger_fonction('ajouter_documents','inc');
        
        // la y'a un bogue super-bizarre avec la fonction spip_abstract_insert() qui est donnee comme absente lors de l'appel de ajouter_document()
        if (!function_exists('spip_abstract_insert')) include_spip('base/abstract_sql');
        $id_doc_odt = $ajouter_documents($rep_dezip.$fichier_zip, $fichier_zip, "article", $id_article, 'document', 0, $toto='');

        $c = array(
        	'titre' => $titre,
        	'descriptif' => _T('odtspip:cet_article_version_odt')
        );
        include_spip('inc/modifier');
        revision_document($id_doc_odt,$c);
    }
    
    if (!function_exists('effacer_repertoire_temporaire')) include_spip('inc/getdocument');
	// vider le contenu du rep de dezippage
    effacer_repertoire_temporaire($rep_dezip);
    
	// aller sur la page de l'article qui vient d'etre cree
    redirige_par_entete(parametre_url(str_replace("&amp;","&",urldecode($redirect)),'id_article',$id_article,'&'));
}
Exemplo n.º 16
0
 /**
  * use the pclZip lib to decompress the file
  *
  * the following files can be acquired and used to trace errors if necessary
  * require_once( MAX_PATH . '/lib/pclzip/pclerror.lib.php' );
  * require_once( MAX_PATH . '/lib/pclzip/pcltrace.lib.php' );
  * require_once( MAX_PATH . '/lib/pclzip/pcltar.lib.php' );
  *
  *
  * @param string $file
  * @param string $relPath
  * @return array | boolean false on error
  */
 function _decompressFile($source, $target, $overwrite = false)
 {
     require_once MAX_PATH . '/lib/pclzip/pclzip.lib.php';
     define('OS_WINDOWS', substr(PHP_OS, 0, 3) == 'WIN' ? 1 : 0);
     $oZip = new PclZip($source);
     if (!$overwrite) {
         $result = $oZip->extract(PCLZIP_OPT_PATH, $target, PCLZIP_OPT_SET_CHMOD, OX_PLUGIN_DIR_WRITE_MODE);
     } else {
         $result = $oZip->extract(PCLZIP_OPT_REPLACE_NEWER, PCLZIP_OPT_PATH, $target, PCLZIP_OPT_SET_CHMOD, OX_PLUGIN_DIR_WRITE_MODE);
     }
     if ($result == 0) {
         $this->_logError('Unrecoverable decompression error: ' . $oZip->errorName(true));
         return false;
     }
     foreach ($result as $i => &$aInfo) {
         if ($aInfo['status'] != 'ok') {
             switch ($aInfo['status']) {
                 case 'path_creation_fail':
                 case 'write_error':
                 case 'read_error':
                 case 'invalid_header':
                     $this->_logError('Error: ' . $aInfo['status'] . ' : ' . $aInfo['filename']);
                     $error = true;
                     break;
                 case 'newer_exist':
                     $this->_logError('Error: ' . $aInfo['status'] . ' : ' . $aInfo['filename']);
                     if (!$aInfo['folder'] && ($time = @filectime($aInfo['filename']))) {
                         $this->_logError('Existing file\'s timestamp is ' . date('d/m/Y h:i:s', $time) . ' ... Replacement file\'s timestamp is ' . date('d/m/Y h:i:s', $aInfo['mtime']));
                     } else {
                         $this->_logError('Unable to determine newer file\'s timestamp ... Replacement file\'s timestamp is ' . date('d/m/Y h:i:s', $aInfo['mtime']));
                     }
                     $error = true;
                     break;
                 case 'already_a_directory':
                 case 'filtered':
                 default:
                     break;
             }
         }
     }
     return $error ? false : $result;
 }
Exemplo n.º 17
0
function doRestore($file, $uploadedFile, $local_backup_path)
{
    global $database, $option, $task, $mosConfig_absolute_path;
    if (!is_null($uploadedFile) && is_array($uploadedFile) && $uploadedFile["name"] != "") {
        $base_Dir = $mosConfig_absolute_path . "/uploadfiles/";
        if (!move_uploaded_file($uploadedFile['tmp_name'], $base_Dir . $uploadedFile['name'])) {
            HTML_dbadmin::showDbAdminMessage(T_('Error! could not move uploaded file.</p>'), T_('DB Admin - Restore'), $option, $task);
            return false;
        }
    }
    if (!$file && !$uploadedFile['name']) {
        HTML_dbadmin::showDbAdminMessage(T_('Error! No restore file specified.</p>'), T_('DB Admin - Restore'), $option, $task);
        return;
    }
    if ($file) {
        if (isset($local_backup_path)) {
            $infile = $local_backup_path . "/" . $file;
            $upfileFull = $file;
            $destfile = $mosConfig_absolute_path . "/uploadfiles/{$file}";
            // If it's a zip file, we copy it so we can extract it
            if (eregi(".\\.zip\$", $upfileFull)) {
                copy($infile, $destfile);
            }
        } else {
            HTML_dbadmin::showDbAdminMessage(T_('Error! Backup path in your configuration file has not been configured.</p>'), T_('DB Admin - Restore'), $option, $task);
            return;
        }
    } else {
        $upfileFull = $uploadedFile['name'];
        $infile = $base_Dir . $uploadedFile['name'];
    }
    if (!eregi(".\\.sql\$", $upfileFull) && !eregi(".\\.bz2\$", $upfileFull) && !eregi(".\\.gz\$", $upfileFull) && !eregi(".\\.zip\$", $upfileFull)) {
        HTML_dbadmin::showDbAdminMessage(sprintf(T_('Error! Invalid file extension in input file (%s).<br />Only *.sql, *.bz2, or *.gz files may be uploaded.</p>'), $upfileFull), T_('DB Admin - Restore'), $option, $task);
        return;
    }
    if (substr($upfileFull, -3) == ".gz") {
        if (function_exists('gzinflate')) {
            $fp = fopen("{$infile}", "rb");
            if (!$fp || filesize("{$infile}") == 0) {
                HTML_dbadmin::showDbAdminMessage(sprintf(T_('Error! Unable to open input file (%s) for reading or file contains no records.</p>'), $infile), T_('DB Admin - Restore'), $option, $task);
                return;
            } else {
                $content = fread($fp, filesize("{$infile}"));
                fclose($fp);
                $content = gzinflate(substr($content, 10));
            }
        } else {
            HTML_dbadmin::showDbAdminMessage(T_('Error! Unable to process gzip file as gzinflate function is unavailable.</p>'), T_('DB Admin - Restore'), $option, $task);
            return;
        }
    } elseif (substr($upfileFull, -4) == ".bz2") {
        if (function_exists('bzdecompress')) {
            $fp = fopen("{$infile}", "rb");
            if (!$fp || filesize("{$infile}") == 0) {
                HTML_dbadmin::showDbAdminMessage(sprintf(T_('Error! Unable to open input file (%s) for reading or file contains no records.</p>'), $infile), T_('DB Admin - Restore'), $option, $task);
                return;
            } else {
                $content = fread($fp, filesize("{$infile}"));
                fclose($fp);
                $content = bzdecompress($content);
            }
        } else {
            HTML_dbadmin::showDbAdminMessage(T_('Error! Unable to process bzip file as bzdecompress function is unavailable.</p>'), T_('DB Admin - Restore'), $option, $task);
            return;
        }
    } elseif (substr($upfileFull, -4) == ".sql") {
        echo T_('trying to access') . ' ' . $infile;
        $fp = fopen("{$infile}", "r");
        if (!$fp || filesize("{$infile}") == 0) {
            HTML_dbadmin::showDbAdminMessage(sprintf(T_('Error! Unable to open input file (%s) for reading or file contains no records.</p>'), $infile), T_('DB Admin - Restore'), $option, $task);
            return;
        } else {
            $content = fread($fp, filesize("{$infile}"));
            fclose($fp);
        }
    } elseif (substr($upfileFull, -4) == ".zip") {
        // unzip the file
        $base_Dir = $mosConfig_absolute_path . "/uploadfiles/";
        $archivename = $base_Dir . $upfileFull;
        $tmpdir = uniqid("dbrestore_");
        $isWindows = substr(PHP_OS, 0, 3) == 'WIN' && stristr($_SERVER["SERVER_SOFTWARE"], "microsoft");
        if ($isWindows) {
            $extractdir = str_replace('/', '\\', $base_Dir . "{$tmpdir}/");
            $archivename = str_replace('/', '\\', $archivename);
        } else {
            $extractdir = str_replace('\\', '/', $base_Dir . "{$tmpdir}/");
            $archivename = str_replace('\\', '/', $archivename);
        }
        $zipfile = new PclZip($archivename);
        if ($isWindows) {
            define('OS_WINDOWS', 1);
        }
        $ret = $zipfile->extract(PCLZIP_OPT_PATH, $extractdir);
        if ($ret == 0) {
            HTML_dbadmin::showDbAdminMessage(sprintf(T_('Unrecoverable error \'%s\''), $zipfile->errorName(true)), T - 'DB Admin - Restore', $option, $task);
            return false;
        }
        $filesinzip = $zipfile->listContent();
        if (is_array($filesinzip) && count($filesinzip) > 0) {
            $fp = fopen($extractdir . $filesinzip[0]["filename"], "r");
            $content = fread($fp, filesize($extractdir . $filesinzip[0]["filename"]));
            fclose($fp);
            // Cleanup temp extract dir
            deldir($extractdir);
            //unlink($mosConfig_absolute_path . "uploadfiles/$file");
        } else {
            HTML_dbadmin::showDbAdminMessage(sprintf(T_('No SQL file found in %s'), $upfileFull), T_('DB Admin - Restore'), $option, $task);
            return;
        }
    } else {
        HTML_dbadmin::showDbAdminMessage(sprintf(T_('Error! Unrecognized input file type. (%s : %s)</p>'), $infile, $upfileFull), T_('DB Admin - Restore'), $option, $task);
        return;
    }
    $decodedIn = explode(chr(10), $content);
    $decodedOut = "";
    $queries = 0;
    foreach ($decodedIn as $rawdata) {
        $rawdata = trim($rawdata);
        if ($rawdata != "" && $rawdata[0] != "#") {
            $decodedOut .= $rawdata;
            if (substr($rawdata, -1) == ";") {
                if (substr($rawdata, -2) == ");" || strtoupper(substr($decodedOut, 0, 6)) != "INSERT") {
                    if (eregi('^(DROP|CREATE)[[:space:]]+(IF EXISTS[[:space:]]+)?(DATABASE)[[:space:]]+(.+)', $decodedOut)) {
                        HTML_dbadmin::showDbAdminMessage(T_('Error! Your input file contains a DROP or CREATE DATABASE statement. Please delete these statements before trying to restore the file.</p>'), T_('DB Admin - Restore'), $option, $task);
                        return;
                    }
                    $database->setQuery($decodedOut);
                    $database->query();
                    $decodedOut = "";
                    $queries++;
                }
            }
        }
    }
    HTML_dbadmin::showDbAdminMessage(sprintf(T_('Success! Database has been restored to the backup you requested (%d SQL queries processed).</p>'), $queries), T_('DB Admin - Restore'), $option, $task);
    return;
}
Exemplo n.º 18
0
 function pluginProcessUpload()
 {
     if (!$_POST['ac'] == md5(ADMINPWCHANGE)) {
         exit;
     }
     extract($_FILES);
     /* check if e_PLUGIN dir is writable ... */
     if (!is_writable(e_PLUGIN)) {
         /* still not writable - spawn error message */
         e107::getRender()->tablerender(EPL_ADLAN_40, EPL_ADLAN_39);
     } else {
         /* e_PLUGIN is writable - continue */
         require_once e_HANDLER . "upload_handler.php";
         $fileName = $file_userfile['name'][0];
         $fileSize = $file_userfile['size'][0];
         $fileType = $file_userfile['type'][0];
         if (strstr($file_userfile['type'][0], "gzip")) {
             $fileType = "tar";
         } else {
             if (strstr($file_userfile['type'][0], "zip")) {
                 $fileType = "zip";
             } else {
                 /* not zip or tar - spawn error message */
                 e107::getRender()->tablerender(EPL_ADLAN_40, EPL_ADLAN_41);
                 require_once "footer.php";
                 exit;
             }
         }
         if ($fileSize) {
             $uploaded = file_upload(e_PLUGIN);
             $archiveName = $uploaded[0]['name'];
             /* attempt to unarchive ... */
             if ($fileType == "zip") {
                 require_once e_HANDLER . "pclzip.lib.php";
                 $archive = new PclZip(e_PLUGIN . $archiveName);
                 $unarc = $fileList = $archive->extract(PCLZIP_OPT_PATH, e_PLUGIN, PCLZIP_OPT_SET_CHMOD, 0666);
             } else {
                 require_once e_HANDLER . "pcltar.lib.php";
                 $unarc = $fileList = PclTarExtract($archiveName, e_PLUGIN);
             }
             if (!$unarc) {
                 /* unarc failed ... */
                 if ($fileType == "zip") {
                     $error = EPL_ADLAN_46 . " '" . $archive->errorName(TRUE) . "'";
                 } else {
                     $error = EPL_ADLAN_47 . PclErrorString() . ", " . EPL_ADLAN_48 . intval(PclErrorCode());
                 }
                 e107::getRender()->tablerender(EPL_ADLAN_40, EPL_ADLAN_42 . " " . $archiveName . " " . $error);
                 require_once "footer.php";
                 exit;
             }
             /* ok it looks like the unarc succeeded - continue */
             /* get folder name ...  */
             $folderName = substr($fileList[0]['stored_filename'], 0, strpos($fileList[0]['stored_filename'], "/"));
             if (file_exists(e_PLUGIN . $folderName . "/plugin.php") || file_exists(e_PLUGIN . $folderName . "/plugin.xml")) {
                 /* upload is a plugin */
                 e107::getRender()->tablerender(EPL_ADLAN_40, EPL_ADLAN_43);
             } elseif (file_exists(e_PLUGIN . $folderName . "/theme.php") || file_exists(e_PLUGIN . $folderName . "/theme.xml")) {
                 /* upload is a menu */
                 e107::getRender()->tablerender(EPL_ADLAN_40, EPL_ADLAN_45);
             } else {
                 /* upload is unlocatable */
                 e107::getRender()->tablerender(EPL_ADLAN_40, 'Unknown file: ' . $fileList[0]['stored_filename']);
             }
             /* attempt to delete uploaded archive */
             @unlink(e_PLUGIN . $archiveName);
         }
     }
 }
Exemplo n.º 19
0
 function unpack_cip($ext = 'zip')
 {
     global $message;
     //        unset($output);
     switch ($ext) {
         case 'zip':
             require_once DIR_FS_ADMIN_CLASSES . 'pclzip.lib.php';
             $zipfile = new PclZip($this->full_path_to_zip());
             if ($this->is_Windows()) {
                 define('OS_WINDOWS', 1);
             } else {
                 define('OS_WINDOWS', 0);
             }
             $ret = $zipfile->extract(PCLZIP_OPT_PATH, DIR_FS_CIP);
             if ($ret == 0) {
                 $message->add('Unrecoverable error "' . $zipfile->errorName(true) . '"');
                 return false;
             }
             break;
         case 'tbz':
         case 'tbz2':
         case 'bz2':
         case 'bz':
             if (CI_ARCHIVER_BZIP2) {
                 @exec(CI_ARCHIVER_BZIP2 . ' ' . $this->full_path_to_zip() . ' -d > ' . DIR_FS_CIP . '/' . $this->cip_name, $output);
             }
             break;
         case 'gz':
             //escapeshellarg()
             if (CI_ARCHIVER_GUNZIP) {
                 @exec(CI_ARCHIVER_GUNZIP . ' ' . $this->full_path_to_zip() . ' -c > ' . DIR_FS_CIP . '/' . $this->cip_name, $output);
             }
             break;
     }
     //$this->untar_cip($filename);
     //$output - array that contain an output.
 }
Exemplo n.º 20
0
    }
    echo '9';
    exit;
}
/* extract the entire archive into AT_COURSE_CONTENT . import/$course using the call back function to filter out php files */
error_reporting(0);
//echo $_FILES['file']['tmp_name'];
//echo $_FILES['file']['name'];
$archive = new PclZip($_FILES['file']['tmp_name']);
//echo $archive;
if ($archive->extract(PCLZIP_OPT_PATH, $import_path, PCLZIP_CB_PRE_EXTRACT, 'preImportCallBack') == 0) {
    echo 'here1' . "<br/>";
    //exit;
    $msg->addError('IMPORT_FAILED');
    echo 'Error : ' . $archive->errorInfo(true) . "<br/>";
    echo 'Error : ' . $archive->errorName() . "<br/>";
    clr_dir($import_path);
    //header('Location: index_instructor.php');
    echo '10';
    exit;
}
error_reporting(AT_ERROR_REPORTING);
/* get the course's max_quota */
$sql = "SELECT max_quota FROM " . TABLE_PREFIX . "courses WHERE course_id={$_SESSION['course_id']}";
$result = mysql_query($sql, $db);
$q_row = mysql_fetch_assoc($result);
if ($q_row['max_quota'] != AT_COURSESIZE_UNLIMITED) {
    if ($q_row['max_quota'] == AT_COURSESIZE_DEFAULT) {
        $q_row['max_quota'] = $MaxCourseSize;
    }
    $totalBytes = dirsize($import_path);
Exemplo n.º 21
0
 /**
  * Extracts the package archive file
  * @return boolean True on success, False on error
  */
 function extractArchive()
 {
     global $mosConfig_absolute_path;
     // Common functions for the installer(s)
     // Extract functions
     require_once $mosConfig_absolute_path . '/administrator/includes/pcl/pclzip.lib.php';
     require_once $mosConfig_absolute_path . '/administrator/includes/pcl/pclerror.lib.php';
     require_once $mosConfig_absolute_path . '/administrator/includes/pcl/pcltrace.lib.php';
     require_once $mosConfig_absolute_path . '/administrator/includes/pcl/pcltar.lib.php';
     $base_Dir = mosPathName($mosConfig_absolute_path . '/media');
     $archivename = $base_Dir . $this->installArchive();
     $tmpdir = uniqid('install_');
     $extractdir = mosPathName($base_Dir . $tmpdir);
     $archivename = mosPathName($archivename, false);
     $this->unpackDir($extractdir);
     // Find the extension of the file
     $fileext = substr(strrchr(basename($this->installArchive()), '.'), 1);
     if ($fileext == 'gz' || $fileext == 'tar') {
         $result = PclTarExtract($archivename, $extractdir);
         if (!$result) {
             $this->setError(1, 'Tar Extract Error "' . PclErrorString() . '" Code ' . intval(PclErrorCode()));
             return false;
         }
         $this->installDir($extractdir);
     } else {
         $zipfile = new PclZip($archivename);
         if ($this->isWindows()) {
             define('OS_WINDOWS', 1);
         } else {
             define('OS_WINDOWS', 0);
         }
         $ret = $zipfile->extract(PCLZIP_OPT_PATH, $extractdir);
         if ($ret == 0) {
             $this->setError(1, 'Unrecoverable error "' . $zipfile->errorName(true) . '"');
             return false;
         }
         $this->installDir($extractdir);
     }
     // Try to find the correct install dir. in case that the package have subdirs
     // Save the install dir for later cleanup
     $filesindir = mosReadDirectory($this->installDir(), '');
     if (count($filesindir) == 1) {
         if (is_dir($extractdir . $filesindir[0])) {
             $this->installDir(mosPathName($extractdir . $filesindir[0]));
         }
     }
     return true;
 }
Exemplo n.º 22
0
function uploadFile($absolute_path, $file, $extdir)
{
    $noMatch = 0;
    if ($file["archzip"]["size"] > 0) {
        $allowable = array('zip');
        $ext = explode(".", basename($file["archzip"]["name"]));
        foreach ($allowable as $val) {
            if (strcasecmp($ext[count($ext) - 1], $val) == 0) {
                $noMatch = 1;
            }
        }
        if ($noMatch) {
            $dir_location = $absolute_path . $extdir;
            require_once $absolute_path . "modules/zip_install/lib/pclerror.lib.php";
            require_once $absolute_path . "modules/zip_install/lib/pclzip.lib.php";
            $upload_file = $dir_location . "/" . basename($file["archzip"]["name"]);
            if (move_uploaded_file($file["archzip"]["tmp_name"], $upload_file)) {
                $files_dir = $dir_location . "/" . basename($upload_file);
                $files_place = substr($files_dir, 0, strlen($files_dir) - 4);
                if (!is_dir($files_place)) {
                    if (mkdir($files_place, 0777)) {
                        $zip = new PclZip($upload_file);
                        $return = $zip->extract(PCLZIP_OPT_PATH, $files_place);
                        if ($return == 0) {
                            echo "<script> alert('";
                            echo "Unrecoverable error " . $zip->errorName(true);
                            echo "'); window.history.go(-1); </script>\n";
                            exit;
                        } else {
                            if (@unlink($upload_file)) {
                                return 1;
                            }
                        }
                    } else {
                        echo "<script> alert('";
                        echo "Can't to create folder. Permission denied.";
                        echo "'); window.history.go(-1); </script>\n";
                        exit;
                    }
                } else {
                    @unlink($upload_file);
                    echo "<script> alert('";
                    echo "Module directory already exists.";
                    echo "'); window.history.go(-1); </script>\n";
                    exit;
                }
            } else {
                echo "<script> alert('";
                echo "Upload Error";
                echo "'); window.history.go(-1); </script>\n";
                exit;
            }
        } else {
            echo "<script> alert('";
            echo "Upload Error.";
            echo "'); window.history.go(-1); </script>\n";
            exit;
        }
    }
    return 0;
}
 function extractArchive()
 {
     global $mosConfig_absolute_path;
     $base_Dir = $this->pathName($mosConfig_absolute_path . "/media/");
     $archivename = $base_Dir . $this->installArchive();
     $tmpdir = uniqid("install_");
     if ($this->isWindows()) {
         $extractdir = str_replace('/', '\\', $this->pathName($base_Dir . "{$tmpdir}"));
         $archivename = str_replace('/', '\\', $archivename);
     } else {
         $extractdir = str_replace('\\', '/', $this->pathName($base_Dir . "{$tmpdir}"));
         $archivename = str_replace('\\', '/', $archivename);
     }
     $this->unpackDir($extractdir);
     // Find the extension of the file
     $fileext = substr(strrchr(basename($this->installArchive()), '.'), 1);
     if ($fileext == "gz" || $fileext == "tar") {
         PclTarExtract($archivename, $extractdir);
         if (PclErrorCode() != 1) {
             echo "<font color=\"red\">" . PclErrorString() . "<br />Updater -  error</font>";
             TrDisplay();
             exit;
         }
         $this->installDir($extractdir);
     } else {
         $zipfile = new PclZip($archivename);
         if ($this->isWindows()) {
             define('OS_WINDOWS', 1);
         } else {
             define('OS_WINDOWS', 0);
         }
         $ret = $zipfile->extract(PCLZIP_OPT_PATH, $extractdir);
         if ($ret == 0) {
             $this->setError(1, "Unrecoverable error '" . $zipfile->errorName(true) . "'", "Updater -  error");
             return false;
         }
         $this->installDir($extractdir);
     }
     // Try to find the correct install dir. in case that the package have subdirs
     // Save the install dir for later cleanup
     $filesindir = $this->readDirectory($this->installDir(), "");
     if (count($filesindir) == 1) {
         if (is_dir($extractdir . $filesindir[0])) {
             $this->installDir($extractdir . $filesindir[0]);
         }
     }
     return true;
 }
Exemplo n.º 24
0
 function pluginProcessUpload()
 {
     if (!$_POST['ac'] == md5(ADMINPWCHANGE)) {
         exit;
     }
     $fl = e107::getFile();
     $data = $fl->getUploaded(e_TEMP);
     $mes = e107::getMessage();
     if (empty($data[0]['error'])) {
         if ($fl->unzipArchive($data[0]['name'], 'plugin')) {
             $mes->addSuccess(EPL_ADLAN_43);
         } else {
             $mes->addError(EPL_ADLAN_97);
         }
     }
     //	$data = process_uploaded_files(e_TEMP);
     //	print_a($data);
     echo $mes->render();
     return;
     // ----------------- Everything below is unused.
     extract($_FILES);
     /* check if e_PLUGIN dir is writable ... */
     if (!is_writable(e_PLUGIN)) {
         // still not writable - spawn error message
         e107::getRender()->tablerender(EPL_ADLAN_40, EPL_ADLAN_39);
     } else {
         // e_PLUGIN is writable
         require_once e_HANDLER . "upload_handler.php";
         $fileName = $file_userfile['name'][0];
         $fileSize = $file_userfile['size'][0];
         $fileType = $file_userfile['type'][0];
         if (strstr($file_userfile['type'][0], "gzip")) {
             $fileType = "tar";
         } else {
             if (strstr($file_userfile['type'][0], "zip")) {
                 $fileType = "zip";
             } else {
                 // not zip or tar - spawn error message
                 e107::getRender()->tablerender(EPL_ADLAN_40, EPL_ADLAN_41);
                 return false;
             }
         }
         if ($fileSize) {
             $uploaded = file_upload(e_PLUGIN);
             $archiveName = $uploaded[0]['name'];
             // attempt to unarchive
             if ($fileType == "zip") {
                 require_once e_HANDLER . "pclzip.lib.php";
                 $archive = new PclZip(e_PLUGIN . $archiveName);
                 $unarc = $fileList = $archive->extract(PCLZIP_OPT_PATH, e_PLUGIN, PCLZIP_OPT_SET_CHMOD, 0666);
             } else {
                 require_once e_HANDLER . "pcltar.lib.php";
                 $unarc = $fileList = PclTarExtract($archiveName, e_PLUGIN);
             }
             if (!$unarc) {
                 // unarc failed ...
                 if ($fileType == "zip") {
                     $error = EPL_ADLAN_46 . " '" . $archive->errorName(TRUE) . "'";
                 } else {
                     $error = EPL_ADLAN_47 . PclErrorString() . ", " . EPL_ADLAN_48 . intval(PclErrorCode());
                 }
                 e107::getRender()->tablerender(EPL_ADLAN_40, EPL_ADLAN_42 . " " . $archiveName . " " . $error);
                 require_once "footer.php";
                 exit;
             }
             // ok it looks like the unarc succeeded - continue */
             // get folder name ...
             $folderName = substr($fileList[0]['stored_filename'], 0, strpos($fileList[0]['stored_filename'], "/"));
             if (file_exists(e_PLUGIN . $folderName . "/plugin.php") || file_exists(e_PLUGIN . $folderName . "/plugin.xml")) {
                 /* upload is a plugin */
                 e107::getRender()->tablerender(EPL_ADLAN_40, EPL_ADLAN_43);
             } elseif (file_exists(e_PLUGIN . $folderName . "/theme.php") || file_exists(e_PLUGIN . $folderName . "/theme.xml")) {
                 /* upload is a menu */
                 e107::getRender()->tablerender(EPL_ADLAN_40, EPL_ADLAN_45);
             } else {
                 /* upload is unlocatable */
                 e107::getRender()->tablerender(EPL_ADLAN_40, EPL_ADLAN_98 . ' ' . $fileList[0]['stored_filename']);
             }
             /* attempt to delete uploaded archive */
             @unlink(e_PLUGIN . $archiveName);
         }
     }
 }
Exemplo n.º 25
0
function action_tispipskelet_conf_importe() {
	global $visiteur_session;
	    
	$id_auteur = $visiteur_session['id_auteur'];
	$arg = _request('arg');
	$args = explode(":",$arg);
		
	// le 1er element de _request('arg') est id_rubrique=XXX
	$Targs = explode("=", $args[0]);
	$id_rubrique = $Targs[1];
	$hash = _request('hash');
    
	$redirect = _request('redirect');
	if ($redirect==NULL) $redirect="";
    
	include_spip("inc/securiser_action");
//	if (!autoriser('creerarticledans', 'rubrique', $id_rubrique)) die(_T('avis_non_acces_page'));

   $file= addslashes($_FILES['tispip_zip']['name']);
   // on verifie l'extension zip
	$elementsChemin = pathinfo($file);
	$extensionFichier = $elementsChemin['extension'];
	if ($extensionFichier!='zip')  die (_T('Le fichier n&rsquo;est pas un fichier .zip'));

	$pat[0]="/.zip/";$pat[1]="/tispip_/";
	$nom_file= preg_replace($pat, "", $file);
	$mess_ok='';
	// ss-rep temporaire specifique de l'auteur en cours: tmp/tispip/id_auteur/ => le creer si il n'existe pas
    $base_dezip = _DIR_TMP."tispip_".$nom_file."/";   // avec / final
    if (!is_dir($base_dezip)) if (!sous_repertoire(_DIR_TMP,'tispip_'.$nom_file)) die (_T('tispip:err_repertoire_tmp'));  
    $rep_dezip = $base_dezip.$id_auteur.'/';
    if (!is_dir($rep_dezip)) if (!sous_repertoire($base_dezip,$id_auteur)) die (_T('tispip:err_repertoire_tmp'));
    
	// traitement d'un fichier zip envoye par $_POST 
    $fichier_zip = addslashes($_FILES['tispip_zip']['name']);
//echo $fichier_zip;
    if ($_FILES['tispip_zip']['name'] == '' 
        OR $_FILES['tispip_zip']['error'] != 0
        OR !move_uploaded_file($_FILES['tispip_zip']['tmp_name'], $rep_dezip.$fichier_zip)
       )  die(_T('odtspip:err_telechargement_fichier'));

  // dezipper le fichier odt a la mode SPIP
	include_spip("inc/pclzip");
	$zip = new PclZip($rep_dezip.$fichier_zip);
	$ok = $zip->extract(
		PCLZIP_OPT_PATH, $rep_dezip,
		PCLZIP_OPT_SET_CHMOD, _SPIP_CHMOD,
		PCLZIP_OPT_REPLACE_NEWER
	);
	  if ($zip->error_code < 0) {
		    spip_log('charger_decompresser erreur zip ' . $zip->error_code .' pour fichier ' . $rep_dezip.$fichier_zip);
		    die($zip->errorName(true));  //$zip->error_code
	  }

		$tispip_rep=preg_replace("/.zip/", "", $file)."/";
		$tispip_rep= _DIR_TMP.$tispip_rep."/IMG/config/";
		
		// on sauve les images de la conf en place => A FAIRE

	// et on copie les images de la nouvelle conf dans ./IMG/config/
	  $cpimg="cp -r -b "._DIR_TMP."tispip_".$nom_file."/".$id_auteur."/".$nom_file."/config/tispip_* "._DIR_IMG."config";
	  exec($cpimg);

	// on recupere le contenu du xml
	if(file_exists($filename=_DIR_TMP."tispip_".$nom_file."/".$id_auteur."/".$nom_file."/config/tispip_".$nom_file.".xml")){
		$nom_restor=$nom_file;
		$xml = simplexml_load_file($filename);
		$mess_valeurs='';
		
		$nb_params=$p_cnt = count($xml->param);
		for($i = 0; $i < $p_cnt; $i++) {
			foreach($xml->param[$i]->attributes() as $a => $b) {
				$a=='nom' ? $nom=$b : $valeur=$b;
			}
			ecrire_config('tispipskelet_conf/'.$nom, "$valeur");
			$nom=='Nom' ? $nom_import=$valeur : '';
			$tn=lire_config('tispipskelet_conf/'.$nom);
			$mess_valeurs.= $nom." : enregistr&eacute; | Valeur =>".$tn."<br />";
		}
		foreach($xml ->children() as $casiers => $casier) {
			// on ne recupere que les couleurs, la conf generale, les background et l'entete
			$casiers_recup=array('entete','couleurs','upload','css');
			if ($casiers !='param'){
				$p_cnt = count($xml->$casiers->param);
				$nb_params =$nb_params+$p_cnt;
				$mess_valeurs.= "<strong style=\"clear:both;\">".$casiers." : </strong> | ".$p_cnt."<br />";

				for($i = 0; $i < $p_cnt; $i++) {
					foreach($xml->$casiers->param[$i]->attributes() as $a => $b) {
						$a=='nom' ? $nom=$b : $valeur=$b;
					}
						$mess_valeurs.= $nom." | ".$valeur."<br />";
					ecrire_config('tispipskelet_conf/'.$casiers.'/'.$nom, "$valeur");
				}
//						$mess_ok.= " <br />";

			}
		}

		$mess_ok.="La configuration <strong>".$nom_import."</strong> est restaurée. (<i>".$nb_params." param&egrave;tres enregistr&eacute;s</i>).<br /> N&rsquo;oubliez pas de <strong>vider le cache</strong> ou de <strong>recalculer la page</strong> pour visualiser la nouvelle configuration graphique.";
		
//		$mess_ok.=$mess_valeurs;
		
	}else{
		$mess_ok.= "Pfeuuuu.... Y a po de fichier xml dans "._DIR_TMP."tispip_".$nom_file."/".$id_auteur."/".$nom_file."/config/tispip_".$nom_file.".xml";
		$mess_ok.= "il devrait etre la ->/tmp/tispip_raspoutine/1/raspoutine/config";
		
	}
	
    if (!function_exists('effacer_repertoire_temporaire')) include_spip('inc/getdocument');
	// vider le contenu du rep de dezippage
 //   effacer_repertoire_temporaire($rep_dezip);
    
	// aller sur la page de l'article qui vient d'etre cree
    redirige_par_entete(parametre_url(str_replace("&amp;","&",urldecode($redirect)),'message',$mess_ok,'&'));
}