1
0
Fork 0
mirror of https://github.com/DanielnetoDotCom/YouPHPTube synced 2025-10-03 09:49:28 +02:00

make file_get_contents less

This commit is contained in:
Vinzenz Hersche 2018-04-18 03:44:59 +02:00
parent dd67509f2e
commit 78147c1ada
18 changed files with 22 additions and 21 deletions

View file

@ -1,6 +1,7 @@
<?php
$vars = array();
require_once '../videos/configuration.php';
require_once '../objects/functions.php';
ini_set('max_execution_time', 300);
function listAll($dir) {
global $vars;
@ -14,7 +15,7 @@ function listAll($dir) {
if (is_dir($filename)) {
listAll($filename);
} else if (preg_match("/\.php$/", $entry)) {
$data = file_get_contents($filename);
$data = url_get_contents($filename);
$regex = '/__\(["\']{1}(.*)["\']{1}\)/U';
preg_match_all(
$regex, $data, $matches

View file

@ -223,7 +223,7 @@ abstract class ObjectYPT implements ObjectInterface {
$lifetime = intval($_GET['lifetime']);
}
if (file_exists($cachefile) && time() - $lifetime <= filemtime($cachefile)) {
$c = @file_get_contents($cachefile);
$c = @url_get_contents($cachefile);
return json_decode($c);
} else if (file_exists($cachefile)) {
unlink($cachefile);

View file

@ -2377,7 +2377,7 @@ class PHPMailer
}
if ($sign) {
@unlink($file);
$body = file_get_contents($signed);
$body = url_get_contents($signed);
@unlink($signed);
//The message returned by openssl contains both headers and body, so need to split them up
$parts = explode("\n\n", $body, 2);
@ -2700,7 +2700,7 @@ class PHPMailer
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);
if ($magic_quotes) {
if (version_compare(PHP_VERSION, '5.3.0', '<')) {
@ -3782,7 +3782,7 @@ class PHPMailer
}
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) {
$privKey = openssl_pkey_get_private($privKeyStr, $this->DKIM_passphrase);
} else {

View file

@ -48,7 +48,7 @@ class getid3_cue extends getid3_handler
public function readCueSheetFilename($filename)
{
$filedata = file_get_contents($filename);
$filedata = url_get_contents($filename);
return $this->readCueSheet($filedata);
}
/**

View file

@ -196,7 +196,7 @@ class Twitter extends OAuth1
}
if (isset($status['picture'])) {
$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;
}

View file

@ -49,7 +49,7 @@ class OAuthRequest
// It's a POST request of the proper content-type, so parse POST
// 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')) {
$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);
}

View file

@ -484,7 +484,7 @@ class LightOpenID
}
$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.
# It just creates the headers array for the last request in $this->headers.
if (isset($http_response_header)) {

View file

@ -9,7 +9,7 @@ require_once $global['systemRootPath'] . 'videos/configuration.php';
require_once $global['systemRootPath'] . 'objects/user.php';
// 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
if(!empty($input) && empty($_POST)){
foreach ($input as $key => $value) {
@ -24,7 +24,7 @@ if(!empty($_POST['user']) && !empty($_POST['pass'])){
$obj = new stdClass();
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);
}

View file

@ -11,7 +11,7 @@ require_once 'comment.php';
require_once 'subscribe.php';
// 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
if(!empty($input) && empty($_POST)){
foreach ($input as $key => $value) {

View file

@ -150,7 +150,7 @@ class Plugin extends ObjectYPT {
if(!$filename){
return false;
}
return file_get_contents($filename);
return url_get_contents($filename);
}

View file

@ -764,7 +764,7 @@ class Video {
foreach (self::$types as $value) {
$progressFilename = "{$global['systemRootPath']}videos/{$filename}_progress_{$value}.txt";
$content = @file_get_contents($progressFilename);
$content = @url_get_contents($progressFilename);
$object->$value = new stdClass();
if (!empty($content)) {
$object->$value = self::parseProgress($content);

View file

@ -25,7 +25,7 @@ $obj->setClean_Title($_POST['clean_title']);
if(!empty($_POST['videoLink'])){
//var_dump($config->getEncoderURL()."getLinkInfo/". base64_encode($_POST['videoLink']));exit;
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);
$filename = uniqid("_YPTuniqid_", true);
$obj->setFilename($filename);

View file

@ -53,7 +53,7 @@ class Cache extends PluginAbstract {
$lifetime = intval($_GET['lifetime']);
}
if (file_exists($cachefile) && time() - $lifetime <= filemtime($cachefile)) {
$c = @file_get_contents($cachefile);
$c = @url_get_contents($cachefile);
echo $c;
if ($obj->logPageLoadTime) {
$this->end("Cache");

View file

@ -17,7 +17,7 @@ if($lt->userCanSeeTransmition()){
$url = $config->getEncoderURL()."getImage/". base64_encode($video)."/{$_GET['format']}";
if(empty($_SESSION[$url]['expire']) || $_SESSION[$url]['expire'] < time()){
session_write_close();
$content = file_get_contents($url);
$content = url_get_contents($url);
session_start();
$_SESSION[$url] = array('content'=>$content, 'expire' => time("+2 min") );
}

View file

@ -51,7 +51,7 @@ The blog system creates an emitter instance and loads the plugins:
```php
$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) {
$plugin = new $pluginClass();
$pluginClass->attachEvents($emitter);

View file

@ -5,7 +5,7 @@ require_once './objects/PluginBuy.php';
// STEP 1: read POST data
// Reading POSTed data directly from $_POST causes serialization issues with array data in the POST.
// 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);
$myPost = array();
foreach ($raw_post_array as $keyval) {

View file

@ -28,7 +28,7 @@ abstract class AuthorizationCache
$cachePath = self::cachePath($config);
if (file_exists($cachePath)) {
// Read from the file
$cachedToken = file_get_contents($cachePath);
$cachedToken = url_get_contents($cachePath);
if ($cachedToken && JsonValidator::validate($cachedToken, true)) {
$tokens = json_decode($cachedToken, true);
if ($clientId && is_array($tokens) && array_key_exists($clientId, $tokens)) {

View file

@ -2,7 +2,7 @@
require_once '../videos/configuration.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
$advancedCustom = json_decode($json_file);
if(!empty($advancedCustom->disableNativeSignUp)){