Great Minds Do Not Think Alike

Monitor Resolution

Forum Index Members Search Usergroups
Ranks Staff Statistics Forum FAQ
Board Rules Edit your profile Login, Check Messages Log in

Search for at

Search found 3 matches
Forum Index
Author Message
 Topic: Force Downloads by setting the correct mime type.
Admin

Replies: 0
Views: 2641
PostForum: PHP Uploading & Downloading Posted: Mon Jul 29, 2019 6:19 am Subject: Force Downloads by setting the correct mime type.
force-download.php

PHP:  [ Select all ]

/**
 * Force Download
 *
 * Generates headers that force a download to happen
 * Example usage:
 * force_download( 'screenshot.png', './images/screenshot.png' );
 *
 * @access public
 * @param string $filename
 * @param string $data
 * @return void
 */
function force_download$filename ''$data '' )
{
 
   if$filename == '' || $data == '' )
 
   {
 
       return false;
 
   }
 
   
    if
( !file_exists$data ) )
 
   {
 
       return false;
 
   }

 
   // Try to determine if the filename includes a file extension.
 
   // We need it in order to set the MIME type
 
   iffalse === strpos$filename'.' ) )
 
   {
 
       return false;
 
   }

 
   // Grab the file extension
 
   $extension strtolowerpathinfobasename$filename ), PATHINFO_EXTENSION ) );

 
   // our list of mime types
 
   $mime_types = array(

 
       'txt' => 'text/plain',
 
       'htm' => 'text/html',
 
       'html' => 'text/html',
 
       'php' => 'text/html',
 
       'css' => 'text/css',
 
       'js' => 'application/javascript',
 
       'json' => 'application/json',
 
       'xml' => 'application/xml',
 
       'swf' => 'application/x-shockwave-flash',
 
       'flv' => 'video/x-flv',

 
       // images
 
       'png' => 'image/png',
 
       'jpe' => 'image/jpeg',
 
       'jpeg' => 'image/jpeg',
 
       'jpg' => 'image/jpeg',
 
       'gif' => 'image/gif',
 
       'bmp' => 'image/bmp',
 
       'ico' => 'image/vnd.microsoft.icon',
 
       'tiff' => 'image/tiff',
 
       'tif' => 'image/tiff',
 
       'svg' => 'image/svg+xml',
 
       'svgz' => 'image/svg+xml',

 
       // archives
 
       'zip' => 'application/zip',
 
       'rar' => 'application/x-rar-compressed',
 
       'exe' => 'application/x-msdownload',
 
       'msi' => 'application/x-msdownload',
 
       'cab' => 'application/vnd.ms-cab-compressed',

 
       // audio/video
 
       'mp3' => 'audio/mpeg',
 
       'qt' => 'video/quicktime',
 
       'mov' => 'video/quicktime',

 
       // adobe
 
       'pdf' => 'application/pdf',
 
       'psd' => 'image/vnd.adobe.photoshop',
 
       'ai' => 'application/postscript',
 
       'eps' => 'application/postscript',
 
       'ps' => 'application/postscript',

 
       // ms office
 
       'doc' => 'application/msword',
 
       'rtf' => 'application/rtf',
 
       'xls' => 'application/vnd.ms-excel',
 
       'ppt' => 'application/vnd.ms-powerpoint',

 
       // open office
 
       'odt' => 'application/vnd.oasis.opendocument.text',
 
       'ods' => 'application/vnd.oasis.opendocument.spreadsheet',
 
   );

 
   // Set a default mime if we can't find it
 
   if( !isset( $mime_types[$extension] ) )
 
   {
 
       $mime 'application/octet-stream';
 
   }
 
   else
    
{
 
       $mime = ( is_array$mime_types[$extension] ) ) ? $mime_types[$extension][0] : $mime_types[$extension];
 
   }
 
       
    
// Generate the server headers
 
   ifstrstr$_SERVER['HTTP_USER_AGENT'], "MSIE" ) )
 
   {
 
       header'Content-Type: "'.$mime.'"' );
 
       header'Content-Disposition: attachment; filename="'.$filename.'"' );
 
       header'Expires: 0' );
 
       header'Cache-Control: must-revalidate, post-check=0, pre-check=0' );
 
       header"Content-Transfer-Encoding: binary" );
 
       header'Pragma: public' );
 
       header"Content-Length: ".filesize$data ) );
 
   }
 
   else
    
{
 
       header"Pragma: public" );
 
       header"Expires: 0" );
 
       header"Cache-Control: must-revalidate, post-check=0, pre-check=0" );
 
       header"Cache-Control: private"false );
 
       header"Content-Type: ".$mimetrue200 );
 
       header'Content-Length: '.filesize$data ) );
 
       header'Content-Disposition: attachment; filename='.$filename);
 
       header"Content-Transfer-Encoding: binary" );
 
   }
 
   readfile$data );
 
   exit;

//End force_download 


Please login to see this link
Get registered or Log in
 Topic: Facebook SDK for PHP (v5)
Admin

Replies: 0
Views: 683
PostForum: facebook/php-graph-sdk v5 Posted: Mon Jul 22, 2019 9:46 pm Subject: Facebook SDK for PHP (v5)
This repository contains the open-source PHP SDK that allows you to access the Facebook Platform from your PHP app.

Installation
The Facebook PHP SDK can be installed with Composer. Run this command:

composer require facebook/graph-sdk
Please be aware, that there are issues when using the Facebook SDK together with Guzzle 6.x. php-graph-sdk v5.x only works with Guzzle 5.x out of the box. However, there is a workaround to make it work with Guzzle 6.x.

Upgrading to v5.x
Upgrading from v4.x? Facebook PHP SDK v5.x introduced breaking changes. Please read the upgrade guide before upgrading.

Usage

Note: This version of the Facebook SDK for PHP requires PHP 5.4 or greater.

Simple GET example of a user's profile.


PHP:  [ Select all ]

require_once __DIR__ '/vendor/autoload.php'// change path as needed

$fb = new \Facebook\Facebook([
 
 'app_id' => '{app-id}',
 
 'app_secret' => '{app-secret}',
 
 'default_graph_version' => 'v2.10',
 
 //'default_access_token' => '{access-token}', // optional
]);

// Use one of the helper classes to get a Facebook\Authentication\AccessToken entity.
//   $helper = $fb->getRedirectLoginHelper();
//   $helper = $fb->getJavaScriptHelper();
//   $helper = $fb->getCanvasHelper();
//   $helper = $fb->getPageTabHelper();

try {
 
 // Get the \Facebook\GraphNodes\GraphUser object for the current user.
 
 // If you provided a 'default_access_token', the '{access-token}' is optional.
 
 $response $fb->get('/me''{access-token}');
} catch(\
Facebook\Exceptions\FacebookResponseException $e) {
 
 // When Graph returns an error
 
 echo 'Graph returned an error: ' $e->getMessage();
 
 exit;
} catch(\
Facebook\Exceptions\FacebookSDKException $e) {
 
 // When validation fails or other local issues
 
 echo 'Facebook SDK returned an error: ' $e->getMessage();
 
 exit;
}

$me $response->getGraphUser();
echo 
'Logged in as ' $me->getName(); 


Complete documentation, installation instructions, and examples are available here.

Tests
Please login to see this link
Get registered or Log in


Please login to see this link
Get registered or Log in
is a prerequisite for running the tests. Install composer globally, then run composer install to install required files.
Create a test app on
Please login to see this link
Get registered or Log in
, then create tests/FacebookTestCredentials.php from tests/FacebookTestCredentials.php.dist and edit it to add your credentials.
The tests can be executed by running this command from the root directory:
$ ./vendor/bin/phpunit
By default the tests will send live HTTP requests to the Graph API. If you are without an internet connection you can skip these tests by excluding the integration group.

$ ./vendor/bin/phpunit --exclude-group integration
Contributing
For us to accept contributions you will have to first have signed the Contributor License Agreement. Please see CONTRIBUTING for details.

REPOSITORY LINK
Please login to see this link
Get registered or Log in
 Topic: Welcome to PHP-Nuke Titanium v3.0.0!
Admin

Replies: 0
Views: 948
PostForum: Current Version Posted: Tue Jul 14, 2009 12:22 am Subject: Welcome to PHP-Nuke Titanium v3.0.0!
Thanks for installing PHP-Nuke Titanium. The Evo Xtreme Team has put a lot of hard work into this release to make it the fastest, most functional and most secure version of PHP-Nuke ever. We encourage you to read through all of the included documentation so you fully understand the power within PHP-Nuke Titanium v3.0.0.

Inside the original archive, you will find several folders containing helpful information.

The first is the "Install" folder which we hope you are all ready familiar with. This folder contains three documents which help you properly install and configure your new PHP-Nuke Evolution portal. If you haven't fully gone through these already please do it now!

The second is the "Help" folder. Inside the "HELP" folder, you will find some very helpful documents that the original Evo team put together to explain some of the features inside. You will also find some documents that will help resolve a few errors you may run in to due to browser settings or improperly setup software.

The third is the "Theme Edits" folder. If you would like to convert a PHP-Nuke theme to work with PHP-Nuke Evolution you must follow the provided instructions within this folder.

We trust that PHP-Nuke Titanium will be the best content management system you have ever run. Enjoy and be sure to stop by cvs.86it.us for support, updates or just to say hello!

- The PHP-Nuke Titanium Team
- The Nuke-Evolution Xtreme Team
 
Page 1 of 1
All times are UTC + 10 Hours
Jump to:  

Powered by phpBB © 2001, 2019 phpBB Group
CarbinFiber Red Flames Designed By: TheGhost © 2019 The 86it Developers Network