Your IP : 216.73.217.79


Current Path : /var/www/cesa.co.za/cpdadmin/
Upload File :
Current File : /var/www/cesa.co.za/cpdadmin/CPDProviderDocs_DocFile_bv.php

<?php

session_start(); // Initialize Session data
ob_start(); // Turn on output buffering
?>
<?php include "ewcfg7.php" ?>
<?php include "ewmysql7.php" ?>
<?php include "phpfn7.php" ?>
<?php include "CPDProviderDocsinfo.php" ?>
<?php include "CPDServiceProviderinfo.php" ?>
<?php include "CPDAdminUsersinfo.php" ?>
<?php include "userfn7.php" ?>
<?php

header("Expires: Mon, 26 Jul 1997 05:00:00 GMT"); // Date in the past
header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT"); // Always modified
header("Cache-Control: private, no-store, no-cache, must-revalidate"); // HTTP/1.1
header("Cache-Control: post-check=0, pre-check=0", false);
header("Pragma: no-cache"); // HTTP/1.0
?>
<?php

// Create page object
$CPDProviderDocs_DocFile_blobview = new cCPDProviderDocs_DocFile_blobview();
$Page = & $CPDProviderDocs_DocFile_blobview;

// Page init
$CPDProviderDocs_DocFile_blobview->Page_Init();

// Page main
$CPDProviderDocs_DocFile_blobview->Page_Main();
?>
<?php

$CPDProviderDocs_DocFile_blobview->Page_Terminate();
?>
<?php

//
// Page class
//
class cCPDProviderDocs_DocFile_blobview {

    // Page ID
    var $PageID = 'blobview';
    // Page object name
    var $PageObjName = 'CPDProviderDocs_DocFile_blobview';

    // Page name
    function PageName() {
        return ew_CurrentPage();
    }

    // Page URL
    function PageUrl() {
        $PageUrl = ew_CurrentPage() . "?";
        return $PageUrl;
    }

    // Page URLs
    var $AddUrl;
    var $EditUrl;
    var $CopyUrl;
    var $DeleteUrl;
    var $ViewUrl;
    var $ListUrl;
    // Export URLs
    var $ExportPrintUrl;
    var $ExportHtmlUrl;
    var $ExportExcelUrl;
    var $ExportWordUrl;
    var $ExportXmlUrl;
    var $ExportCsvUrl;
    // Update URLs
    var $InlineAddUrl;
    var $InlineCopyUrl;
    var $InlineEditUrl;
    var $GridAddUrl;
    var $GridEditUrl;
    var $MultiDeleteUrl;
    var $MultiUpdateUrl;

    // Message
    function getMessage() {
        return @$_SESSION[EW_SESSION_MESSAGE];
    }

    function setMessage($v) {
        if (@$_SESSION[EW_SESSION_MESSAGE] <> "") { // Append
            $_SESSION[EW_SESSION_MESSAGE] .= "<br>" . $v;
        } else {
            $_SESSION[EW_SESSION_MESSAGE] = $v;
        }
    }

    // Show message
    function ShowMessage() {
        $sMessage = $this->getMessage();
        $this->Message_Showing($sMessage);
        if ($sMessage <> "") { // Message in Session, display
            echo "<p><span class=\"ewMessage\">" . $sMessage . "</span></p>";
            $_SESSION[EW_SESSION_MESSAGE] = ""; // Clear message in Session
        }
    }

    // Validate page request
    function IsPageRequest() {
        return TRUE;
    }

    //
    // Page class constructor
    //
    function __construct() {
        global $conn, $Language;

        // Language object
        $Language = new cLanguage();

        // Table object (CPDProviderDocs)
        $GLOBALS["CPDProviderDocs"] = new cCPDProviderDocs();

        // Table object (CPDServiceProvider)
        $GLOBALS['CPDServiceProvider'] = new cCPDServiceProvider();

        // Table object (CPDAdminUsers)
        $GLOBALS['CPDAdminUsers'] = new cCPDAdminUsers();

        // Page ID
        if (!defined("EW_PAGE_ID"))
            define("EW_PAGE_ID", 'blobview', TRUE);

        // Table name (for backward compatibility)
        if (!defined("EW_TABLE_NAME"))
            define("EW_TABLE_NAME", 'CPDProviderDocs', TRUE);

        // Start timer
        $GLOBALS["gsTimer"] = new cTimer();

        // Open connection
        $conn = ew_Connect();
    }

    //
    //  Page_Init
    //
    function Page_Init() {
        global $gsExport, $gsExportFile, $UserProfile, $Language, $Security, $objForm;
        global $CPDProviderDocs;

        // User profile
        $UserProfile = new cUserProfile();
        $UserProfile->LoadProfile(@$_SESSION[EW_SESSION_USER_PROFILE]);

        // Security
        $Security = new cAdvancedSecurity();
        if (IsPasswordExpired())
            $this->Page_Terminate("changepwd.php");
        if (!$Security->IsLoggedIn())
            $Security->AutoLogin();
        if (!$Security->IsLoggedIn()) {
            $Security->SaveLastUrl();
            $this->Page_Terminate("login.php");
        }

        // Page Load event
        $this->Page_Load();
    }

    //
    // Page_Terminate
    //
    function Page_Terminate($url = "") {
        global $conn;

        // Page Unload event
        $this->Page_Unload();

        // Close connection
        $conn->Close();

        // Go to URL if specified
        $this->Page_Redirecting($url);
        if ($url <> "") {
            if (!EW_DEBUG_ENABLED && ob_get_length())
                ob_end_clean();
            header("Location: " . $url);
        }
        exit();
    }

    //
    // Page main
    //
    function Page_Main() {
        global $conn, $CPDProviderDocs;

        // Get key
        if (@$_GET["CPDProviderDocID"] <> "") {
            $CPDProviderDocs->CPDProviderDocID->setQueryStringValue($_GET["CPDProviderDocID"]);
        } else {
            $this->Page_Terminate(); // Exit
            exit();
        }
        $objBinary = new cUpload('CPDProviderDocs', 'x_DocFile');

        // Show thumbnail
        $bShowThumbnail = (@$_GET["showthumbnail"] == "1");
        if (@$_GET["thumbnailwidth"] == "" && @$_GET["thumbnailheight"] == "") {
            $iThumbnailWidth = EW_THUMBNAIL_DEFAULT_WIDTH; // Set default width
            $iThumbnailHeight = EW_THUMBNAIL_DEFAULT_HEIGHT; // Set default height
        } else {
            if (@$_GET["thumbnailwidth"] <> "") {
                $iThumbnailWidth = $_GET["thumbnailwidth"];
                if (!is_numeric($iThumbnailWidth) || $iThumbnailWidth < 0)
                    $iThumbnailWidth = 0;
            }
            if (@$_GET["thumbnailheight"] <> "") {
                $iThumbnailHeight = $_GET["thumbnailheight"];
                if (!is_numeric($iThumbnailHeight) || $iThumbnailHeight < 0)
                    $iThumbnailHeight = 0;
            }
        }
        if (@$_GET["quality"] <> "") {
            $quality = $_GET["quality"];
            if (!is_numeric($quality))
                $quality = 75; // Set Default
        } else {
            $quality = 75;
        }
        $sFilter = $CPDProviderDocs->KeyFilter();

        // Set up filter (SQL WHERE clause) and get return SQL
        // SQL constructor in CPDProviderDocs class, CPDProviderDocsinfo.php

        $CPDProviderDocs->CurrentFilter = $sFilter;
        $sSql = $CPDProviderDocs->SQL();
        if ($rs = $conn->Execute($sSql)) {
            if (!$rs->EOF) {
                if (!EW_DEBUG_ENABLED && ob_get_length())
                    ob_end_clean();
                if (strpos(ew_ServerVar("HTTP_USER_AGENT"), "MSIE") === FALSE)
                    header("Content-type: images");
                if (trim(strval($rs->fields('DocFile'))) <> "") {
                    header("Content-Disposition: attachment; filename=" . $rs->fields('DocFile'));
                }
                $objBinary->Value = $rs->fields('DocFile');
                $objBinary->Value = $objBinary->Value;
                if ($bShowThumbnail) {
                    ew_ResizeBinary($objBinary->Value, $iThumbnailWidth, $iThumbnailHeight, $quality);
                }
                $data = $objBinary->Value;
                if (substr($data, 0, 2) == "PK" && strpos($data, "[Content_Types].xml") > 0 &&
                        strpos($data, "_rels") > 0 && strpos($data, "docProps") > 0) { // Fix Office 2007 documents
                    if (substr($data, -4) <> "\0\0\0\0")
                        $data .= "\0\0\0\0";
                }
                echo $data;
            }
            $rs->Close();
        }
    }

    // Page Load event
    function Page_Load() {

        //echo "Page Load";
    }

    // Page Unload event
    function Page_Unload() {

        //echo "Page Unload";
    }

    // Page Redirecting event
    function Page_Redirecting(&$url) {

        // Example:
        //$url = "your URL";
    }

    // Message Showing event
    function Message_Showing(&$msg) {

        // Example:
        //$msg = "your new message";
    }

}

?>