Update functions.php
							parent
							
								
									0fbacf2608
								
							
						
					
					
						commit
						fa00fd422e
					
				| 
						 | 
					@ -419,8 +419,11 @@ function time_format($ISO)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
function getConfig($str)
 | 
					function getConfig($str)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    $envs = json_decode(file_get_contents('config.json'));
 | 
					    $s = file_get_contents('config.json');
 | 
				
			||||||
 | 
					    if ($s!='') {
 | 
				
			||||||
 | 
					        $envs = json_decode($s, true);
 | 
				
			||||||
        return $envs[$str];
 | 
					        return $envs[$str];
 | 
				
			||||||
 | 
					    } else return '';
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
function array_value_isnot_null($arr)
 | 
					function array_value_isnot_null($arr)
 | 
				
			||||||
| 
						 | 
					@ -438,3 +441,18 @@ function setConfig($arr)
 | 
				
			||||||
    ksort($envs);
 | 
					    ksort($envs);
 | 
				
			||||||
    return file_put_contents('config.json', json_encode($envs, JSON_PRETTY_PRINT));
 | 
					    return file_put_contents('config.json', json_encode($envs, JSON_PRETTY_PRINT));
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					function get_thumbnails_url($path = '/')
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
					    $path1 = path_format($path);
 | 
				
			||||||
 | 
					    $path = path_format($_SERVER['list_path'] . path_format($path));
 | 
				
			||||||
 | 
					    $url = $_SERVER['api_url'];
 | 
				
			||||||
 | 
					    if ($path !== '/') {
 | 
				
			||||||
 | 
					        $url .= ':' . $path;
 | 
				
			||||||
 | 
					        if (substr($url,-1)=='/') $url=substr($url,0,-1);
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					    $url .= ':/thumbnails/0/medium';
 | 
				
			||||||
 | 
					    $files = json_decode(curl_request($url, false, ['Authorization' => 'Bearer ' . $_SERVER['access_token']]), true);
 | 
				
			||||||
 | 
					    if (isset($files['url'])) return output($files['url']);
 | 
				
			||||||
 | 
					    return output('', 404);
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in New Issue