mirror of
https://github.com/DanielnetoDotCom/YouPHPTube
synced 2025-10-03 17:59:55 +02:00
make file_get_contents less
This commit is contained in:
parent
dd67509f2e
commit
78147c1ada
18 changed files with 22 additions and 21 deletions
|
@ -1,6 +1,7 @@
|
||||||
<?php
|
<?php
|
||||||
$vars = array();
|
$vars = array();
|
||||||
require_once '../videos/configuration.php';
|
require_once '../videos/configuration.php';
|
||||||
|
require_once '../objects/functions.php';
|
||||||
ini_set('max_execution_time', 300);
|
ini_set('max_execution_time', 300);
|
||||||
function listAll($dir) {
|
function listAll($dir) {
|
||||||
global $vars;
|
global $vars;
|
||||||
|
@ -14,7 +15,7 @@ function listAll($dir) {
|
||||||
if (is_dir($filename)) {
|
if (is_dir($filename)) {
|
||||||
listAll($filename);
|
listAll($filename);
|
||||||
} else if (preg_match("/\.php$/", $entry)) {
|
} else if (preg_match("/\.php$/", $entry)) {
|
||||||
$data = file_get_contents($filename);
|
$data = url_get_contents($filename);
|
||||||
$regex = '/__\(["\']{1}(.*)["\']{1}\)/U';
|
$regex = '/__\(["\']{1}(.*)["\']{1}\)/U';
|
||||||
preg_match_all(
|
preg_match_all(
|
||||||
$regex, $data, $matches
|
$regex, $data, $matches
|
||||||
|
|
|
@ -223,7 +223,7 @@ abstract class ObjectYPT implements ObjectInterface {
|
||||||
$lifetime = intval($_GET['lifetime']);
|
$lifetime = intval($_GET['lifetime']);
|
||||||
}
|
}
|
||||||
if (file_exists($cachefile) && time() - $lifetime <= filemtime($cachefile)) {
|
if (file_exists($cachefile) && time() - $lifetime <= filemtime($cachefile)) {
|
||||||
$c = @file_get_contents($cachefile);
|
$c = @url_get_contents($cachefile);
|
||||||
return json_decode($c);
|
return json_decode($c);
|
||||||
} else if (file_exists($cachefile)) {
|
} else if (file_exists($cachefile)) {
|
||||||
unlink($cachefile);
|
unlink($cachefile);
|
||||||
|
|
|
@ -2377,7 +2377,7 @@ class PHPMailer
|
||||||
}
|
}
|
||||||
if ($sign) {
|
if ($sign) {
|
||||||
@unlink($file);
|
@unlink($file);
|
||||||
$body = file_get_contents($signed);
|
$body = url_get_contents($signed);
|
||||||
@unlink($signed);
|
@unlink($signed);
|
||||||
//The message returned by openssl contains both headers and body, so need to split them up
|
//The message returned by openssl contains both headers and body, so need to split them up
|
||||||
$parts = explode("\n\n", $body, 2);
|
$parts = explode("\n\n", $body, 2);
|
||||||
|
@ -2700,7 +2700,7 @@ class PHPMailer
|
||||||
ini_set('magic_quotes_runtime', false);
|
ini_set('magic_quotes_runtime', false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
$file_buffer = file_get_contents($path);
|
$file_buffer = url_get_contents($path);
|
||||||
$file_buffer = $this->encodeString($file_buffer, $encoding);
|
$file_buffer = $this->encodeString($file_buffer, $encoding);
|
||||||
if ($magic_quotes) {
|
if ($magic_quotes) {
|
||||||
if (version_compare(PHP_VERSION, '5.3.0', '<')) {
|
if (version_compare(PHP_VERSION, '5.3.0', '<')) {
|
||||||
|
@ -3782,7 +3782,7 @@ class PHPMailer
|
||||||
}
|
}
|
||||||
return '';
|
return '';
|
||||||
}
|
}
|
||||||
$privKeyStr = !empty($this->DKIM_private_string) ? $this->DKIM_private_string : file_get_contents($this->DKIM_private);
|
$privKeyStr = !empty($this->DKIM_private_string) ? $this->DKIM_private_string : url_get_contents($this->DKIM_private);
|
||||||
if ('' != $this->DKIM_passphrase) {
|
if ('' != $this->DKIM_passphrase) {
|
||||||
$privKey = openssl_pkey_get_private($privKeyStr, $this->DKIM_passphrase);
|
$privKey = openssl_pkey_get_private($privKeyStr, $this->DKIM_passphrase);
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -48,7 +48,7 @@ class getid3_cue extends getid3_handler
|
||||||
|
|
||||||
public function readCueSheetFilename($filename)
|
public function readCueSheetFilename($filename)
|
||||||
{
|
{
|
||||||
$filedata = file_get_contents($filename);
|
$filedata = url_get_contents($filename);
|
||||||
return $this->readCueSheet($filedata);
|
return $this->readCueSheet($filedata);
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -196,7 +196,7 @@ class Twitter extends OAuth1
|
||||||
}
|
}
|
||||||
if (isset($status['picture'])) {
|
if (isset($status['picture'])) {
|
||||||
$media = $this->apiRequest('https://upload.twitter.com/1.1/media/upload.json', 'POST', [
|
$media = $this->apiRequest('https://upload.twitter.com/1.1/media/upload.json', 'POST', [
|
||||||
'media' => base64_encode(file_get_contents($status['picture'])),
|
'media' => base64_encode(url_get_contents($status['picture'])),
|
||||||
]);
|
]);
|
||||||
$params['media_ids'] = $media->media_id;
|
$params['media_ids'] = $media->media_id;
|
||||||
}
|
}
|
||||||
|
|
|
@ -49,7 +49,7 @@ class OAuthRequest
|
||||||
// It's a POST request of the proper content-type, so parse POST
|
// It's a POST request of the proper content-type, so parse POST
|
||||||
// parameters and add those overriding any duplicates from GET
|
// parameters and add those overriding any duplicates from GET
|
||||||
if ($http_method == "POST" && isset($request_headers['Content-Type']) && strstr($request_headers['Content-Type'], 'application/x-www-form-urlencoded')) {
|
if ($http_method == "POST" && isset($request_headers['Content-Type']) && strstr($request_headers['Content-Type'], 'application/x-www-form-urlencoded')) {
|
||||||
$post_data = OAuthUtil::parse_parameters(file_get_contents(self::$POST_INPUT));
|
$post_data = OAuthUtil::parse_parameters(url_get_contents(self::$POST_INPUT));
|
||||||
$parameters = array_merge($parameters, $post_data);
|
$parameters = array_merge($parameters, $post_data);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -484,7 +484,7 @@ class LightOpenID
|
||||||
}
|
}
|
||||||
|
|
||||||
$context = stream_context_create($opts);
|
$context = stream_context_create($opts);
|
||||||
$data = file_get_contents($url, false, $context);
|
$data = url_get_contents($url, false, $context);
|
||||||
# This is a hack for providers who don't support HEAD requests.
|
# This is a hack for providers who don't support HEAD requests.
|
||||||
# It just creates the headers array for the last request in $this->headers.
|
# It just creates the headers array for the last request in $this->headers.
|
||||||
if (isset($http_response_header)) {
|
if (isset($http_response_header)) {
|
||||||
|
|
|
@ -9,7 +9,7 @@ require_once $global['systemRootPath'] . 'videos/configuration.php';
|
||||||
require_once $global['systemRootPath'] . 'objects/user.php';
|
require_once $global['systemRootPath'] . 'objects/user.php';
|
||||||
|
|
||||||
// gettig the mobile submited value
|
// gettig the mobile submited value
|
||||||
$inputJSON = file_get_contents('php://input');
|
$inputJSON = url_get_contents('php://input');
|
||||||
$input = json_decode($inputJSON, TRUE); //convert JSON into array
|
$input = json_decode($inputJSON, TRUE); //convert JSON into array
|
||||||
if(!empty($input) && empty($_POST)){
|
if(!empty($input) && empty($_POST)){
|
||||||
foreach ($input as $key => $value) {
|
foreach ($input as $key => $value) {
|
||||||
|
@ -24,7 +24,7 @@ if(!empty($_POST['user']) && !empty($_POST['pass'])){
|
||||||
|
|
||||||
$obj = new stdClass();
|
$obj = new stdClass();
|
||||||
if(YouPHPTubePlugin::loadPluginIfEnabled("Live")){
|
if(YouPHPTubePlugin::loadPluginIfEnabled("Live")){
|
||||||
$liveStats = file_get_contents("{$global['webSiteRootURL']}plugin/Live/stats.json.php");
|
$liveStats = url_get_contents("{$global['webSiteRootURL']}plugin/Live/stats.json.php");
|
||||||
$obj->live = json_decode($liveStats);
|
$obj->live = json_decode($liveStats);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -11,7 +11,7 @@ require_once 'comment.php';
|
||||||
require_once 'subscribe.php';
|
require_once 'subscribe.php';
|
||||||
|
|
||||||
// gettig the mobile submited value
|
// gettig the mobile submited value
|
||||||
$inputJSON = file_get_contents('php://input');
|
$inputJSON = url_get_contents('php://input');
|
||||||
$input = json_decode($inputJSON, TRUE); //convert JSON into array
|
$input = json_decode($inputJSON, TRUE); //convert JSON into array
|
||||||
if(!empty($input) && empty($_POST)){
|
if(!empty($input) && empty($_POST)){
|
||||||
foreach ($input as $key => $value) {
|
foreach ($input as $key => $value) {
|
||||||
|
|
|
@ -150,7 +150,7 @@ class Plugin extends ObjectYPT {
|
||||||
if(!$filename){
|
if(!$filename){
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
return file_get_contents($filename);
|
return url_get_contents($filename);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -764,7 +764,7 @@ class Video {
|
||||||
|
|
||||||
foreach (self::$types as $value) {
|
foreach (self::$types as $value) {
|
||||||
$progressFilename = "{$global['systemRootPath']}videos/{$filename}_progress_{$value}.txt";
|
$progressFilename = "{$global['systemRootPath']}videos/{$filename}_progress_{$value}.txt";
|
||||||
$content = @file_get_contents($progressFilename);
|
$content = @url_get_contents($progressFilename);
|
||||||
$object->$value = new stdClass();
|
$object->$value = new stdClass();
|
||||||
if (!empty($content)) {
|
if (!empty($content)) {
|
||||||
$object->$value = self::parseProgress($content);
|
$object->$value = self::parseProgress($content);
|
||||||
|
|
|
@ -25,7 +25,7 @@ $obj->setClean_Title($_POST['clean_title']);
|
||||||
if(!empty($_POST['videoLink'])){
|
if(!empty($_POST['videoLink'])){
|
||||||
//var_dump($config->getEncoderURL()."getLinkInfo/". base64_encode($_POST['videoLink']));exit;
|
//var_dump($config->getEncoderURL()."getLinkInfo/". base64_encode($_POST['videoLink']));exit;
|
||||||
if(empty($_POST['id'])){
|
if(empty($_POST['id'])){
|
||||||
$info = file_get_contents($config->getEncoderURL()."getLinkInfo/". base64_encode($_POST['videoLink']));
|
$info = url_get_contents($config->getEncoderURL()."getLinkInfo/". base64_encode($_POST['videoLink']));
|
||||||
$infoObj = json_decode($info);
|
$infoObj = json_decode($info);
|
||||||
$filename = uniqid("_YPTuniqid_", true);
|
$filename = uniqid("_YPTuniqid_", true);
|
||||||
$obj->setFilename($filename);
|
$obj->setFilename($filename);
|
||||||
|
|
|
@ -53,7 +53,7 @@ class Cache extends PluginAbstract {
|
||||||
$lifetime = intval($_GET['lifetime']);
|
$lifetime = intval($_GET['lifetime']);
|
||||||
}
|
}
|
||||||
if (file_exists($cachefile) && time() - $lifetime <= filemtime($cachefile)) {
|
if (file_exists($cachefile) && time() - $lifetime <= filemtime($cachefile)) {
|
||||||
$c = @file_get_contents($cachefile);
|
$c = @url_get_contents($cachefile);
|
||||||
echo $c;
|
echo $c;
|
||||||
if ($obj->logPageLoadTime) {
|
if ($obj->logPageLoadTime) {
|
||||||
$this->end("Cache");
|
$this->end("Cache");
|
||||||
|
|
|
@ -17,7 +17,7 @@ if($lt->userCanSeeTransmition()){
|
||||||
$url = $config->getEncoderURL()."getImage/". base64_encode($video)."/{$_GET['format']}";
|
$url = $config->getEncoderURL()."getImage/". base64_encode($video)."/{$_GET['format']}";
|
||||||
if(empty($_SESSION[$url]['expire']) || $_SESSION[$url]['expire'] < time()){
|
if(empty($_SESSION[$url]['expire']) || $_SESSION[$url]['expire'] < time()){
|
||||||
session_write_close();
|
session_write_close();
|
||||||
$content = file_get_contents($url);
|
$content = url_get_contents($url);
|
||||||
session_start();
|
session_start();
|
||||||
$_SESSION[$url] = array('content'=>$content, 'expire' => time("+2 min") );
|
$_SESSION[$url] = array('content'=>$content, 'expire' => time("+2 min") );
|
||||||
}
|
}
|
||||||
|
|
|
@ -51,7 +51,7 @@ The blog system creates an emitter instance and loads the plugins:
|
||||||
```php
|
```php
|
||||||
$emitter = new EventEmitter();
|
$emitter = new EventEmitter();
|
||||||
|
|
||||||
$pluginClasses = json_decode(file_get_contents('plugins.json'), true);
|
$pluginClasses = json_decode(url_get_contents('plugins.json'), true);
|
||||||
foreach ($pluginClasses as $pluginClass) {
|
foreach ($pluginClasses as $pluginClass) {
|
||||||
$plugin = new $pluginClass();
|
$plugin = new $pluginClass();
|
||||||
$pluginClass->attachEvents($emitter);
|
$pluginClass->attachEvents($emitter);
|
||||||
|
|
|
@ -5,7 +5,7 @@ require_once './objects/PluginBuy.php';
|
||||||
// STEP 1: read POST data
|
// STEP 1: read POST data
|
||||||
// Reading POSTed data directly from $_POST causes serialization issues with array data in the POST.
|
// Reading POSTed data directly from $_POST causes serialization issues with array data in the POST.
|
||||||
// Instead, read raw POST data from the input stream.
|
// Instead, read raw POST data from the input stream.
|
||||||
$raw_post_data = file_get_contents('php://input');
|
$raw_post_data = url_get_contents('php://input');
|
||||||
$raw_post_array = explode('&', $raw_post_data);
|
$raw_post_array = explode('&', $raw_post_data);
|
||||||
$myPost = array();
|
$myPost = array();
|
||||||
foreach ($raw_post_array as $keyval) {
|
foreach ($raw_post_array as $keyval) {
|
||||||
|
|
|
@ -28,7 +28,7 @@ abstract class AuthorizationCache
|
||||||
$cachePath = self::cachePath($config);
|
$cachePath = self::cachePath($config);
|
||||||
if (file_exists($cachePath)) {
|
if (file_exists($cachePath)) {
|
||||||
// Read from the file
|
// Read from the file
|
||||||
$cachedToken = file_get_contents($cachePath);
|
$cachedToken = url_get_contents($cachePath);
|
||||||
if ($cachedToken && JsonValidator::validate($cachedToken, true)) {
|
if ($cachedToken && JsonValidator::validate($cachedToken, true)) {
|
||||||
$tokens = json_decode($cachedToken, true);
|
$tokens = json_decode($cachedToken, true);
|
||||||
if ($clientId && is_array($tokens) && array_key_exists($clientId, $tokens)) {
|
if ($clientId && is_array($tokens) && array_key_exists($clientId, $tokens)) {
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
require_once '../videos/configuration.php';
|
require_once '../videos/configuration.php';
|
||||||
require_once $global['systemRootPath'] . 'objects/user.php';
|
require_once $global['systemRootPath'] . 'objects/user.php';
|
||||||
|
|
||||||
$json_file = file_get_contents("{$global['webSiteRootURL']}plugin/CustomizeAdvanced/advancedCustom.json.php");
|
$json_file = url_get_contents("{$global['webSiteRootURL']}plugin/CustomizeAdvanced/advancedCustom.json.php");
|
||||||
// convert the string to a json object
|
// convert the string to a json object
|
||||||
$advancedCustom = json_decode($json_file);
|
$advancedCustom = json_decode($json_file);
|
||||||
if(!empty($advancedCustom->disableNativeSignUp)){
|
if(!empty($advancedCustom->disableNativeSignUp)){
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue