public function downbak()
 {
     function DownloadFile($fileName)
     {
         ob_end_clean();
         header("Cache-Control: must-revalidate, post-check=0, pre-check=0");
         header('Content-Description: File Transfer');
         header('Content-Type: application/octet-stream');
         header('Content-Length: ' . filesize($fileName));
         header('Content-Disposition: attachment; filename=' . basename($fileName));
         readfile($fileName);
     }
     DownloadFile("Data/" . $_GET['file']);
     exit;
 }
Exemplo n.º 2
0
require_once 'func_archive_download.php';
// begin display logic
if (isset($_GET["fh"])) {
    DisplayFileHistory();
    $gBitSystem->display('bitpackage:cvsview/view_history.tpl', tra('Annotation history for: '), array('display_mode' => 'display'));
} else {
    if (isset($_GET["fa"])) {
        DisplayFileAnnotation($env['mod_path'], $_GET["fa"]);
        $gBitSystem->display('bitpackage:cvsview/view_annotation.tpl', tra('Annotation history for: '), array('display_mode' => 'display'));
    } else {
        if (isset($_GET["fv"])) {
            DisplayFileContents($env['mod_path'], $_GET["dt"]);
            $gBitSystem->display('bitpackage:cvsview/view_contents.tpl', tra('Revision history for: '), array('display_mode' => 'display'));
        } else {
            if (isset($_GET["fd"])) {
                DownloadFile($env['mod_path'], $_GET["dt"]);
                $gBitSystem->display('bitpackage:cvsview/download.tpl', tra('download: '), array('display_mode' => 'display'));
            } else {
                if (isset($_GET["df"])) {
                    DisplayFileDiff($_GET["r1"], $_GET["r2"]);
                    $gBitSystem->display('bitpackage:cvsview/view_diff.tpl', tra('Revision Diff for: '), array('display_mode' => 'display'));
                } else {
                    if (isset($_GET["dp"])) {
                        DownloadArchive();
                    } else {
                        DisplayDirListing();
                        $gBitSystem->display('bitpackage:cvsview/list_dir.tpl', tra('CVS Archive: '), array('display_mode' => 'display'));
                    }
                }
            }
        }
Exemplo n.º 3
0
	FusionPBX
	Version: MPL 1.1

	The contents of this file are subject to the Mozilla Public License Version
	1.1 (the "License"); you may not use this file except in compliance with
	the License. You may obtain a copy of the License at
	http://www.mozilla.org/MPL/

	Software distributed under the License is distributed on an "AS IS" basis,
	WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
	for the specific language governing rights and limitations under the
	License.

	The Original Code is FusionPBX

	The Initial Developer of the Original Code is
	Mark J Crane <*****@*****.**>
	Portions created by the Initial Developer are Copyright (C) 2008-2012
	the Initial Developer. All Rights Reserved.

	Contributor(s):
	Mark J Crane <*****@*****.**>
*/
include "root.php";
require_once "resources/require.php";
//require_once "resources/check_auth.php";
$file = $_GET["f"];
require_once "resources/secure_download.php";
//echo $file;
DownloadFile($file_dir . $file);
Exemplo n.º 4
0
 private function RunExport()
 {
     try {
         // check for a selected template
         if (!isset($_POST["template"]) || !$_POST["template"]) {
             throw new Exception(GetLang("NoTemplateSelected"));
         }
         if (!isset($_POST['format'])) {
             throw new Exception(GetLang("NoMethodSelected"));
         }
         $templateid = $_POST["template"];
         // check template exists
         $template = $this->templates->GetTemplate($templateid);
         // check the file type is available for this template
         if (!in_array($this->type, explode(",", $template['usedtypes']))) {
             throw new Exception(sprintf(GetLang("TypeNotAvailable"), $this->type));
         }
         $where = "";
         // get the custom search fields
         if (isset($_POST['ids'])) {
             $ids = explode(',', $_POST['ids']);
             $ids = implode(', ', array_map(array($GLOBALS['ISC_CLASS_DB'], "Quote"), $ids));
             $details = $this->filetype->GetTypeDetails();
             $where = $details['idfield'] . " IN (" . $_POST["ids"] . ")";
         } elseif (isset($_POST['searchId'])) {
             // get the where statement for this search
             $ret = $this->filetype->GetWhereFromSearch($_POST['searchId']);
             $where = $ret['where'];
         } elseif (isset($_POST['params'])) {
             $params = $this->GetParams($_POST['params']);
             $where = $this->filetype->GetWhereFromParams($params);
         }
         //$_SESSION['mywhere'] = $where; // this variable used in the function  ExportRows() by blessen
         // get the export method the user has chosen
         $method = ISC_ADMIN_EXPORTMETHOD_FACTORY::GetExportMethod($_POST['format']);
         // Initialise the export
         $method->Init($this->filetype, $templateid, $where, $this->vendorid);
         $details = $this->filetype->GetTypeDetails();
         if ($_POST['format'] == "CSV" && $details['name'] == "customers" && $method->settings['AltCustomers']) {
             // hackery to use alternate customers class
             $this->filetype = ISC_ADMIN_EXPORTFILETYPE_FACTORY::GetExportFileType("customersalt");
             // reinitialise the method with alternate file type
             $method->Init($this->filetype, $templateid, $where, $this->vendorid);
         }
         // run the export
         $file = $method->Export();
         $method_details = $method->GetMethodDetails();
         // log the export
         $GLOBALS['ISC_CLASS_LOG']->LogAdminAction($this->type_title, $template['exporttemplatename'], $method_details['name']);
         // send the file to the user
         DownloadFile($file, $this->type . "-" . isc_date("Y-m-d") . "." . $method_details['extension']);
         exit;
     } catch (Exception $ex) {
         FlashMessage($ex->getMessage(), MSG_ERROR);
         $this->StartExport();
     }
 }
Exemplo n.º 5
0
 if ($_SESSION['privilege'] == 1) {
     $btnN1 = "";
 }
 //	Niv 1
 //******************************************************
 //*******************************************************************
 //*****************************************************************
 //******************************************************
 // Actions des Boutons
 //******************************************************
 if (isset($_POST['cmd'])) {
     echo $_POST['cmd'] . '<br />';
     if ($_POST['cmd'] == "Telecharger") {
         //	echo $_POST['name_sim'];
         //	echo $_POST['name_file'];
         $a = DownloadFile(INI_Conf_Moteur($_SESSION['opensim_select'], "address") . $_POST['name_file']);
     }
     if ($_POST['cmd'] == "Supprimer") {
         //	echo $_POST['name_sim'];
         //	echo $_POST['name_file'];
         $commande = $cmd_SYS_Delete_file . $_POST['name_file'] . ";rm " . $_POST['name_file'];
     }
     if ($_POST['cmd'] == 'Sauvegarde fichiers opensim') {
         echo $_POST['name_sim'] . '<br>';
         extract($_POST);
         $fp = fopen("files/liste_fichiersOS.txt", "w+");
         fputs("\n");
         echo "trouvé : " . count($matrice) . '<br>';
         for ($i = 0; $i < count($_POST["matrice"]); $i++) {
             echo $_POST["matrice"][$i] . '<br />';
             fputs($fp, INI_Conf_Moteur($_SESSION['opensim_select'], "address") . $_POST["matrice"][$i] . "\n");
        fclose($fp_dest);
        return $filename;
    }
    return false;
}
global $mf_domain;
if (isset($_SERVER['HTTPS']) && 'on' == strtolower($_SERVER['HTTPS']) && empty($_COOKIE[SECURE_AUTH_COOKIE]) && !empty($_REQUEST['auth_cookie'])) {
    $_COOKIE[SECURE_AUTH_COOKIE] = $_REQUEST['auth_cookie'];
} elseif (empty($_COOKIE[AUTH_COOKIE]) && !empty($_REQUEST['auth_cookie'])) {
    $_COOKIE[AUTH_COOKIE] = $_REQUEST['auth_cookie'];
}
unset($current_user);
if (!(is_user_logged_in() && current_user_can('edit_posts'))) {
    die(__('Athentication failed!', $mf_domain));
}
if (!empty($_POST['upload_url'])) {
    // file was send from browser
    $_POST['upload_url'] = clean_url($_POST['upload_url']);
    $filename = DownloadFile();
    if ($filename == false) {
        $result_msg = "<font color='red'><b>" . __("Upload Unsuccessful", $mf_domain) . "!</b></font>";
    } else {
        $result_msg = "<font color='green'><b>" . __("Successful upload", $mf_domain) . "!</b></font>";
        $operationSuccess = "true";
    }
    if ($filename) {
        echo $result_msg . "*" . $filename;
    } else {
        echo $result_msg . "*" . "None";
    }
}
Exemplo n.º 7
0
/* ************************* Actions ************************* */
if ($action == 'listdirectory') {
    $directory = base64_decode($_GET['directory']);
    $data = ListDirectory($directory);
    $data = SortFiles($data);
    echo json_encode($data);
}
if ($action == 'path') {
    $directory = base64_decode($_GET['directory']);
    $base = base64_decode($_GET['base']);
    $data = GetPath($base, $directory);
    echo json_encode($data);
}
if ($action == 'download') {
    $file = base64_decode($_GET['file']);
    DownloadFile($file);
}
if ($action == 'delete') {
    $file = base64_decode($_GET['file']);
    echo DeleteFile($file);
}
if ($action == 'newdir') {
    $curdir = base64_decode($_GET['curdir']);
    $name = base64_decode($_GET['name']);
    echo NewDir($curdir, $name);
}
if ($action == 'rename') {
    $oldname = base64_decode($_GET['old']);
    $newname = base64_decode($_GET['new']);
    echo RenameFile($oldname, $newname);
}
Exemplo n.º 8
0
include '/var/www/inc/player_lib.php';
//$db = 'sqlite:/var/www/db/player.db';
playerSession('open', $db, '', '');
if (isset($_POST['syscmd'])) {
    switch ($_POST['syscmd']) {
        case 'jpgexist':
            $filename = $_POST['filename'];
            if (file_exists("/var/lib/mpd/music/{$filename}")) {
                echo "yes";
            } else {
                echo "no";
            }
            break;
        case 'jpg':
            $filename = $_POST['filename'];
            DownloadFile("/var/lib/mpd/music/{$filename}");
            break;
        case 'add':
            $filename = $_POST['filename'];
            $radiolink = $_POST['radiolink'];
            $radioname = $_POST['radioname'];
            $my_file = "/var/lib/mpd/music/WEBRADIO/{$filename}";
            $handle = fopen($my_file, 'w') or die('Cannot open file:  ' . $my_file);
            //implicitly creates file
            $data = "[playlist]\r\nnumberofentries=1\r\nFile1={$radiolink}\r\nTitle1={$radioname}";
            fwrite($handle, $data);
            fclose($handle);
            break;
        case 'addfolder':
            $foldername = $_POST['foldername'];
            $my_folder = "/var/lib/mpd/music/WEBRADIO/{$foldername}";
    // download fails, the call throws a fault.
    for ($i = 0; $i < 10; $i++) {
        sleep($waitTime);
        // GetUploadRequestStatus helper method calls the corresponding Bing Ads service operation
        // to get the upload status.
        $uploadRequestStatus = GetUploadRequestStatus($proxy, $uploadRequestId);
        if ($uploadRequestStatus != null && ($uploadRequestStatus == "Completed" || $uploadRequestStatus == "CompletedWithErrors")) {
            $uploadSuccess = true;
            break;
        }
    }
    if ($uploadSuccess) {
        // GetUploadResultFileUrl helper method calls the corresponding Bing Ads service operation
        // to get the upload result file Url.
        $uploadResultFileUrl = GetUploadResultFileUrl($proxy, $uploadRequestId);
        DownloadFile($uploadResultFileUrl, $UploadResultFilePath);
        printf("The upload result file was written to %s.\n", $UploadResultFilePath);
    } else {
        printf("The request is taking longer than expected.\n" + "Save the upload ID (%s) and try again later.", $uploadRequestId);
    }
} catch (SoapFault $e) {
    // Output the last request/response.
    print "\nLast SOAP request/response:\n";
    print $proxy->GetWsdl() . "\n";
    print $proxy->GetService()->__getLastRequest() . "\n";
    print $proxy->GetService()->__getLastResponse() . "\n";
    // Bulk service operations can throw AdApiFaultDetail.
    if (isset($e->detail->AdApiFaultDetail)) {
        // Log this fault.
        print "The operation failed with the following faults:\n";
        $errors = is_array($e->detail->AdApiFaultDetail->Errors->AdApiError) ? $e->detail->AdApiFaultDetail->Errors->AdApiError : array('AdApiError' => $e->detail->AdApiFaultDetail->Errors->AdApiError);
    // To support windows and the C: root you need to add the
    // following 2 lines, should be ignored on linux
    if (substr($v_remove, 1, 1) == ':' && strlen($v_remove) <= 3) {
        // ex: c:\
        $v_remove = substr($v_remove, 2);
    }
    // make filepath the current directory
    chdir($filepath);
    // create zip file
    $archive = new PclZip($filename);
    $ret = $archive->create($filepath, PCLZIP_OPT_REMOVE_PATH, $v_remove);
    if ($ret == 0) {
        die("Error : " . $archive->errorInfo(true));
    }
    // Download to user and delete the evidence.
    DownloadFile($filename);
    unlink($filename);
} else {
    /**
     *	Filename to use
     */
    $filename = $_SERVER['HTTP_HOST'] . '-backup-' . gmdate('Y-m-d', time() + TIMEZONE) . '.sql';
    $output = "" . "#\n" . "# Website Baker " . WB_VERSION . " Database Backup\n" . "# " . WB_URL . "\n" . "# " . gmdate(DATE_FORMAT, time() + TIMEZONE) . ", " . gmdate(TIME_FORMAT, time() + TIMEZONE) . "\n" . "# modul version: " . $module_version . "\n" . "# " . "\n";
    /**
     *	Get table names
     *	Use this one for ALL tables in DB
     *
     */
    $query = "SHOW TABLES";
    if ($_POST['tables'] == 'WB') {
        /**
Exemplo n.º 11
0
 /**
  * \brief This function is called when user output is
  * requested.  This function is responsible for content.
  */
 function Output()
 {
     if ($this->State != PLUGIN_STATE_READY) {
         return;
     }
     global $Plugins;
     global $PG_CONN;
     if (!$PG_CONN) {
         DBconnect();
         if (!$PG_CONN) {
             $text = _("Missing database connection.");
             echo "<h2>{$text}</h2>";
             return;
         }
     }
     $Item = GetParm("item", PARM_INTEGER);
     $text = _("Invalid item parameter");
     if (empty($Item)) {
         echo "<h2>{$text}</h2>";
         return;
     }
     $Filename = RepPathItem($Item);
     if (empty($Filename)) {
         echo "<h2>{$text}: {$Filename}</h2>";
         return;
     }
     $Fin = @fopen(RepPathItem($Item), "rb");
     /* note that CheckRestore() does not return. */
     if (empty($Fin)) {
         $this->CheckRestore($Item, $Filename);
     }
     $sql = "SELECT ufile_name, upload_fk FROM uploadtree WHERE uploadtree_pk = {$Item} LIMIT 1;";
     $result = pg_query($PG_CONN, $sql);
     DBCheckResult($result, $sql, __FILE__, __LINE__);
     $row = pg_fetch_assoc($result);
     if (pg_num_rows($result) != 1) {
         $text = _("Missing item");
         echo "<h2>{$text}: {$Item}</h2>";
         pg_free_result($result);
         return;
     }
     $Upload = $row['upload_fk'];
     $UploadPerm = GetUploadPerm($Upload);
     if ($UploadPerm < PERM_WRITE) {
         $text = _("No Permission");
         echo "<h2>{$text}: {$Item}</h2>";
         return;
     }
     $Name = $row['ufile_name'];
     pg_free_result($result);
     if (($rv = DownloadFile($Filename, $Name)) !== True) {
         $text = _("Download failed");
         echo "<h2>{$text}</h2>{$Filename}<br>{$rv}";
     }
 }
Exemplo n.º 12
0
 private function DownloadFroogleExport()
 {
     $exportFile = '';
     if (isset($_SESSION['FroogleFile']) && basename($_SESSION['FroogleFile']) == $_SESSION['FroogleFile'] && file_exists(APP_ROOT . "/../cache/" . $_SESSION['FroogleFile'])) {
         $exportFile = $_SESSION['FroogleFile'];
     }
     if (!$exportFile) {
         echo "<script type='text/javascript'>self.parent.FroogleExportError('" . GetLang('FroogleExportInvalidFile') . "');</script>";
         exit;
     }
     unset($_SESSION['FroogleFile']);
     $file = APP_ROOT . "/../cache/" . $exportFile;
     DownloadFile($file);
 }