Skip to content

Commit

Permalink
Fixed issue #8252: The temporary path for PCLZIP is not properly set
Browse files Browse the repository at this point in the history
  • Loading branch information
c-schmitz committed Feb 13, 2014
1 parent 5b05a17 commit 39e7fb5
Show file tree
Hide file tree
Showing 14 changed files with 6,652 additions and 13,822 deletions.
8 changes: 4 additions & 4 deletions application/controllers/admin/export.php
Expand Up @@ -70,7 +70,7 @@ public function surveyarchives()
{
$aZIPFileName=$this->config->item("tempdir") . DIRECTORY_SEPARATOR . randomChars(30);

$this->load->library("admin/pclzip/pclzip", array('p_zipname' => $aZIPFileName));
$this->load->library("admin/pclzip", array('p_zipname' => $aZIPFileName));

$zip = new PclZip($aZIPFileName);
foreach ($aExportedFiles as $iSurveyID=>$sFileName)
Expand Down Expand Up @@ -806,7 +806,7 @@ public function showquexmlsurvey()
file_put_contents($f3, $quexml);
file_put_contents($f4, $clang->gT('This archive contains a PDF file of the survey, the queXML file of the survey and a queXF banding XML file which can be used with queXF: http://quexf.sourceforge.net/ for processing scanned surveys.'));

Yii::app()->loadLibrary('admin.pclzip.pclzip');
Yii::app()->loadLibrary('admin.pclzip');
$zipfile="$tempdir/quexmlpdf_{$qid}_{$surveyprintlang}.zip";
$z = new PclZip($zipfile);
$z->create($zipdir, PCLZIP_OPT_REMOVE_PATH, $zipdir);
Expand Down Expand Up @@ -847,7 +847,7 @@ public function resources()
$resourcesdir = Yii::app()->getConfig('uploaddir') . "/{$resourcesdir}/";
$tmpdir = Yii::app()->getConfig('tempdir') . '/';
$zipfilepath = $tmpdir . $zipfilename;
Yii::app()->loadLibrary('admin.pclzip.pclzip');
Yii::app()->loadLibrary('admin.pclzip');
$zip = new PclZip($zipfilepath);
$zipdirs = array();
foreach (array('files', 'flash', 'images') as $zipdir)
Expand Down Expand Up @@ -935,7 +935,7 @@ private function _exportarchive($iSurveyID, $bSendToBrowser=TRUE)
$sLSTFileName = $sTempDir . DIRECTORY_SEPARATOR . randomChars(30);
$sLSIFileName = $sTempDir . DIRECTORY_SEPARATOR . randomChars(30);

Yii::import('application.libraries.admin.pclzip.pclzip', TRUE);
Yii::import('application.libraries.admin.pclzip', TRUE);
$zip = new PclZip($aZIPFileName);

file_put_contents($sLSSFileName, surveyGetXMLData($iSurveyID));
Expand Down
2 changes: 1 addition & 1 deletion application/controllers/admin/labels.php
Expand Up @@ -61,7 +61,7 @@ public function importlabelresources()
$basedestdir = Yii::app()->getConfig('uploaddir') . "/labels";
$destdir = $basedestdir . "/$lid/";

Yii::app()->loadLibrary('admin.pclzip.pclzip');
Yii::app()->loadLibrary('admin.pclzip');
$zip = new PclZip($zipfilename);

if (!is_writeable($basedestdir))
Expand Down
2 changes: 1 addition & 1 deletion application/controllers/admin/responses.php
Expand Up @@ -835,7 +835,7 @@ private function _deleteFiles($iSurveyID, $responseIds,$language)
private function _zipFiles($iSurveyID, $responseIds, $zipfilename,$language)
{

Yii::app()->loadLibrary('admin/pclzip/pclzip');
Yii::app()->loadLibrary('admin/pclzip');

$tmpdir = Yii::app()->getConfig('uploaddir') . DIRECTORY_SEPARATOR."surveys". DIRECTORY_SEPARATOR . $iSurveyID . DIRECTORY_SEPARATOR."files".DIRECTORY_SEPARATOR;

Expand Down
2 changes: 1 addition & 1 deletion application/controllers/admin/surveyadmin.php
Expand Up @@ -216,7 +216,7 @@ function importsurveyresources()
$basedestdir = Yii::app()->getConfig('uploaddir') . "/surveys";
$destdir = $basedestdir . "/$iSurveyID/";

Yii::app()->loadLibrary('admin.pclzip.pclzip');
Yii::app()->loadLibrary('admin.pclzip');
$zip = new PclZip($zipfilename);

if (!is_writeable($basedestdir))
Expand Down
4 changes: 2 additions & 2 deletions application/controllers/admin/templates.php
Expand Up @@ -38,7 +38,7 @@ public function templatezip($templatename)
$tempdir = Yii::app()->getConfig('tempdir');

$zipfile = "$tempdir/$templatename.zip";
Yii::app()->loadLibrary('admin.pclzip.pclzip');
Yii::app()->loadLibrary('admin.pclzip');
$zip = new PclZip($zipfile);
$zip->create($templatedir, PCLZIP_OPT_REMOVE_PATH, getTemplatePath($templatename));

Expand Down Expand Up @@ -90,7 +90,7 @@ public function upload()
if (Yii::app()->getConfig('demoMode'))
$this->getController()->error($clang->gT("Demo mode: Uploading templates is disabled."));

Yii::app()->loadLibrary('admin.pclzip.pclzip');
Yii::app()->loadLibrary('admin.pclzip');

$zip = new PclZip($_FILES['the_file']['tmp_name']);

Expand Down
6 changes: 3 additions & 3 deletions application/controllers/admin/update.php
Expand Up @@ -254,7 +254,7 @@ function step3()
}
}

Yii::app()->loadLibrary("admin/pclzip/pclzip");
Yii::app()->loadLibrary("admin/pclzip");
$archive = new PclZip($tempdir.DIRECTORY_SEPARATOR.'LimeSurvey_files_backup_'.$basefilename.'.zip');

$v_list = $archive->add($filestozip, PCLZIP_OPT_REMOVE_PATH, $publicdir);
Expand Down Expand Up @@ -395,7 +395,7 @@ function step4()
//Now unzip the new files over the existing ones.
$new_files = false;
if (file_exists($tempdir.'/update.zip')){
Yii::app()->loadLibrary("admin/pclzip/pclzip");
Yii::app()->loadLibrary("admin/pclzip");
$archive = new PclZip($tempdir.'/update.zip');
if ($archive->extract(PCLZIP_OPT_PATH, $rootdir.'/', PCLZIP_OPT_REPLACE_NEWER)== 0) {
die("Error : ".$archive->errorInfo(true));
Expand Down Expand Up @@ -532,7 +532,7 @@ private function _RunUpdaterUpdate()

//Now unzip the new updater over the existing ones.
if (file_exists($tempdir.'/updater.zip')){
Yii::app()->loadLibrary("admin/pclzip/pclzip",array('p_zipname' => $tempdir.'/updater.zip'));
Yii::app()->loadLibrary("admin/pclzip",array('p_zipname' => $tempdir.'/updater.zip'));
$archive = new PclZip(array('p_zipname' => $tempdir.'/updater.zip'));
if ($archive->extract(PCLZIP_OPT_PATH, APPPATH.'/controllers/admin/', PCLZIP_OPT_REPLACE_NEWER)== 0) {
die("Error : ".$archive->errorInfo(true));
Expand Down
21 changes: 21 additions & 0 deletions application/libraries/admin/pclzip.php
@@ -0,0 +1,21 @@
<?php
/*
* LimeSurvey
* Copyright (C) 2007-2014 The LimeSurvey Project Team / Carsten Schmitz
* All rights reserved.
* License: GNU/GPL License v2 or later, see LICENSE.php
* LimeSurvey is free software. This version may have been modified pursuant
* to the GNU General Public License, and as distributed it includes or
* is derivative of works licensed under the GNU General Public License or
* other free or open source software licenses.
* See COPYRIGHT.php for copyright notices and details.
*
*/

// Set the correct temp path for PclZip
if (!defined('PCLZIP_TEMPORARY_DIR')) {
define( 'PCLZIP_TEMPORARY_DIR', '' );
}

# include PclZip class
require_once(APPPATH.'/third_party/pclzip/pclzip.lib.php');
132 changes: 0 additions & 132 deletions application/libraries/admin/pclzip/pclerror.lib.php

This file was deleted.

0 comments on commit 39e7fb5

Please sign in to comment.