Пример #1
0
<?php

date_default_timezone_set('UTC');
$data_path = '../../../server_data/coevolution/';
$temp_path = 'downloads/';
if (isset($_REQUEST['download'])) {
    include "zip.php";
    $zip = new recurseZip();
    $filename = $zip->compress($data_path . $_REQUEST['download'], $temp_path);
    header("Location: {$filename}");
}
$results = array();
if ($handle = opendir($data_path)) {
    while (false !== ($entry = readdir($handle))) {
        if ($entry != '.' && $entry != '..') {
            $last_modified = filemtime($data_path . $entry);
            $results[$last_modified] = $entry;
        }
    }
    closedir($handle);
    krsort($results);
}
?>
<!DOCTYPE HTML>
<head>
<meta http-equiv='Content-Type' content='text/html; charset=UTF-8' />
<title>CoEvolution Results</title>
</head>
<body>
<table>
  <tr>
Пример #2
0
                 $zip->close();
                 @unlink($dst);
                 $status = 'error';
                 $message = 'Error: File not found';
             }
             $this->recurse_zip($src, $zip, $path);
         }
         $zip->close();
         return $dst;
     }
 }
 //Source file or directory to be compressed.
 $src = 'admin/backup';
 //Destination folder where we create Zip file.
 $dst = 'modules/dropbox_backup/backup';
 $z = new recurseZip();
 $fullpath = $z->compress($src, $dst);
 $source = basename($fullpath);
 if ($status != 'error') {
     $status = 'success';
     $message = 'The file has been sent to your Dropbox account.';
 }
 // Send to Dropbox
 $dropbox_email = escapeshellcmd(get_misc_data('dropbox_backup_email'));
 // Dropbox email address
 //$dropbox_pass=escapeshellcmd(get_misc_data('dropbox_backup_pass'));   	// Dropbox password
 //$dropbox_pass_save=escapeshellcmd(get_misc_data('dropbox_backup_save'));// Save password?
 $dropbox_dir = escapeshellcmd(get_misc_data('dropbox_backup_dir'));
 // DropBox directory (optional) - Folder on the Dropbox
 include 'DropboxUploader.php';
 $uploader = new DropboxUploader($dropbox_email, $dropbox_pass);
Пример #3
0
 public function actionBuilder()
 {
     $this->_assertPostOnly();
     $addOnId = $this->_input->filterSingle('addon_id', XenForo_Input::STRING);
     $addOn = $this->_getAddOnOrError($addOnId);
     $archiveName = trim($this->_input->filterSingle('archive_name', XenForo_Input::STRING));
     $addOnModel = $this->_getAddOnModel();
     $input = $this->_input->filter(array('version_increment_check' => XenForo_Input::UINT, 'increment_method' => XenForo_Input::STRING, 'increment_custom_version' => XenForo_Input::UINT, 'library_check' => XenForo_Input::UINT, 'js_check' => XenForo_Input::UINT, 'styles_check' => XenForo_Input::UINT, 'extra_check' => XenForo_Input::UINT, 'build_location' => XenForo_Input::STRING, 'library_dir' => XenForo_Input::STRING, 'js_dir' => XenForo_Input::STRING, 'styles_dir' => XenForo_Input::STRING, 'extra_dirs' => XenForo_Input::STRING, 'install_xml' => XenForo_Input::UINT, 'zip_check' => XenForo_Input::UINT));
     if ($input['library_check']) {
         $source = 'library/' . $input['library_dir'];
         $destination = $input['build_location'] . $addOnId . '/upload/library/' . $input['library_dir'];
         $copyFiles = $addOnModel->addOnBuilderCopyFiles($source, $destination);
         if (!$copyFiles) {
             return $this->responseError(new XenForo_Phrase('could_not_copy_files_did_you_specify_correct_dir'));
         }
     }
     if ($input['js_check']) {
         $source = 'js/' . $input['js_dir'];
         $destination = $input['build_location'] . $addOnId . '/upload/js/' . $input['js_dir'];
         $copyFiles = $addOnModel->addOnBuilderCopyFiles($source, $destination);
         if (!$copyFiles) {
             return $this->responseError(new XenForo_Phrase('could_not_copy_files_did_you_specify_correct_dir'));
         }
     }
     if ($input['styles_check']) {
         $source = 'styles/' . $input['styles_dir'];
         $destination = $input['build_location'] . $addOnId . '/upload/styles/' . $input['styles_dir'];
         $copyFiles = $addOnModel->addOnBuilderCopyFiles($source, $destination);
         if (!$copyFiles) {
             return $this->responseError(new XenForo_Phrase('could_not_copy_files_did_you_specify_correct_dir'));
         }
     }
     if ($input['extra_check']) {
         $extraDirs = preg_split("/\r\n|\n|\r/", $input['extra_dirs']);
         foreach ($extraDirs as $key => $dir) {
             $destination = $input['build_location'] . $addOnId . '/upload/' . $dir;
             $copyFiles = $addOnModel->xcopy($dir, $destination);
             if (!$copyFiles) {
                 return $this->responseError(new XenForo_Phrase('could_not_copy_files_did_you_specify_correct_dir'));
             }
         }
     }
     $destXml = $input['build_location'] . $addOnId . '/addon-' . $addOnId . '.xml';
     $xmlObject = $this->_getAddOnModel()->getAddOnXml($addOn);
     $xmlObject->save($destXml);
     if ($input['install_xml']) {
         $destination = $input['build_location'] . $addOnId . '/upload/install/data';
         $addOnModel->createDir($destination);
         $destXml = $destination . '/addon-' . $addOnId . '.xml';
         $xmlObject->save($destXml);
     }
     if ($input['zip_check']) {
         require_once 'library/XDT/Helper/RecurseZip.php';
         $zip = new recurseZip();
         $source = $input['build_location'] . $addOnId . '/upload';
         $destination = $input['build_location'] . $addOnId;
         $zip->compress($source, $destination, $input['build_location'], $archiveName . '-' . $addOn['version_string']);
     }
     if ($input['version_increment_check']) {
         switch ($input['increment_method']) {
             case 'custom':
                 $addOnDw = XenForo_DataWriter::create('XenForo_DataWriter_AddOn');
                 $addOnDw->setExistingData($addOn);
                 $addOnDw->set('version_id', $input['increment_custom_version']);
                 $addOnDw->save();
                 break;
             case 'auto':
             default:
                 $addOnDw = XenForo_DataWriter::create('XenForo_DataWriter_AddOn');
                 $addOnDw->setExistingData($addOn);
                 $addOnDw->set('version_id', $addOn['version_id'] + 1);
                 $addOnDw->save();
         }
     }
     return $this->responseRedirect(XenForo_ControllerResponse_Redirect::SUCCESS, XenForo_Link::buildAdminLink('add-ons') . $this->getLastHash($addOnId), new XenForo_Phrase('xdt_your_addon_has_been_built_successfully'));
 }
Пример #4
0
if (is_dir('zbackupsoftwarefiles')) {
    //code to use if directory
    //echo 'Dir Found.';
    //echo 'No Action Taken';
} else {
    //echo 'Dir Not Found';
    mkdir("zbackupsoftwarefiles");
    //echo 'Dir Created';
}
//To call database backupcode to include DB backup process.
include "backupdatabasecode1.php";
//include "recurseZip.php";
include "backupsoftwarecodeinclude1.php";
//Source file or directory to be compressed.
//$src='source/foldername';
$src = '../' . $appfoldername;
//Destination folder where we create Zip file.
$dst = 'zbackupsoftwarefiles';
$z = new recurseZip();
//echo $z->compress($src,$dst);
$z->compress($src, $dst);
$backuptime = date('YMd_His');
$backupsoftwarefiletime = date('Y-m-d H:i:s');
$username = $_SESSION["username"];
$ipaddress = $_SERVER["REMOTE_ADDR"];
$backupsoftwarefilename = 'SW_Backup_' . $backuptime . '.zip';
$backupsoftwarefiletime = $backupsoftwarefiletime;
$query1db = "insert into master_backupsoftware (backupfilename, backupfiledate, username, ipaddress) \nvalues ('{$backupsoftwarefilename}', '{$backupsoftwarefiletime}', '{$username}', '{$ipaddress}')";
$exec1db = mysql_query($query1db) or die("Error in Query1db" . mysql_error());
//To rename the created zipped file.
rename('zbackupsoftwarefiles/' . $appfoldername . '.zip', 'zbackupsoftwarefiles/' . $backupsoftwarefilename);