Check your Administration --> Panel Settings --> Github username and branch settings. These settings should have no value (be blank) unless you\'re a developer and know how to use these settings!');
}
}
if( file_exists(RSS_LOCAL_PATH) )
{
try {
$feedXml = new SimpleXMLElement(file_get_contents(RSS_LOCAL_PATH), LIBXML_NOCDATA);
$seed = basename( (string) $feedXml->entry[0]->link['href'] );
unlink(RSS_LOCAL_PATH);
} catch (Exception $e) {
print_failure('Unable to update: '.$e->getMessage());
return;
}
}
else
{
print_failure('Unable to read : ' . RSS_LOCAL_PATH);
return;
}
if(isset($seed))
{
/// Checking for changes in the main update files:
$main_update_files = array(
'includes/functions.php' => 'https://raw.githubusercontent.com/' . $gitHubOrganization . '/'.REPONAME.'/'.$seed.'/includes/functions.php',
'includes/helpers.php' => 'https://raw.githubusercontent.com/' . $gitHubOrganization . '/'.REPONAME.'/'.$seed.'/includes/helpers.php',
'modules/update/update.php' => 'https://raw.githubusercontent.com/' . $gitHubOrganization . '/'.REPONAME.'/'.$seed.'/modules/update/update.php',
'modules/update/updating.php' => 'https://raw.githubusercontent.com/' . $gitHubOrganization . '/'.REPONAME.'/'.$seed.'/modules/update/updating.php',
'modules/update/unzip.php' => 'https://raw.githubusercontent.com/' . $gitHubOrganization . '/'.REPONAME.'/'.$seed.'/modules/update/unzip.php'
);
$refresh = False;
foreach($main_update_files as $local_path => $remote_url)
{
$result = check_file($local_path, $remote_url);
if ($result === 'nochange')
{
continue;
}
elseif($result)
{
$refresh = True;
}
else
{
return;
}
}
if($refresh)
{
header("Refresh:0");
return;
}
echo "
".get_lang('update')."
";
$pversion = $settings['ogp_version'];
echo ''.get_lang('blacklist_files')." ".get_lang('blacklist_files_info')."";
echo get_lang('panel_version').": ".$pversion."";
echo get_lang('latest_version').": $seed";
if ( $seed != $pversion )
{
$dwl = $gitHubURL . REPONAME . '/archive/'.$seed.'.zip';
$dwlHeaders = get_headers($dwl);
if($dwlHeaders[0] != 'HTTP/1.1 302 Found')
print_failure('The generated URL for the download returned a bad response code: ' . $dwlHeaders[0]);
else
echo "
\n";
if(function_exists('curl_version')){
echo "Latest Changes
";
$commitsStart = 0;
$commitsToShow = 5;
$gitHubUpdateName = (!empty($settings['custom_github_update_username']) && $gitHubURL != OGP_GITHUB_MAIN_URL ? $settings['custom_github_update_username'] : 'OpenGamePanel');
if($gitHubBranchName != "master"){
$commitsUrl = 'https://api.github.com/repos/'.$gitHubUpdateName.'/'.REPONAME.'/commits/' . $gitHubBranchName;
}else{
$commitsUrl = 'https://api.github.com/repos/'.$gitHubUpdateName.'/'.REPONAME.'/commits';
}
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $commitsUrl);
curl_setopt($ch, CURLOPT_USERAGENT, 'Mozilla/5.0 (Windows NT 10.0; WOW64; rv:51.0) Gecko/20100101 Firefox/51.0');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
$data = curl_exec($ch);
if ($data) {
$json = json_decode($data, true);
if(array_key_exists("0", $json)){
if (!empty($json[0]['commit'])) {
echo '';
foreach ($json as $k=>$v) {
if ($commitsStart >= $commitsToShow) {
break;
}
echo '- '.substr($v['commit']['author']['date'],0,10).' - '.$v['commit']['author']['name'] .' committed '.substr($v['sha'],0,7).'...
';
echo ''.str_replace("*", "
", $v['commit']['message']) .'
';
++$commitsStart;
}
echo '
View more commits...';
}
}else{
if (!empty($json['commit'])) {
echo '';
$v = $json;
echo '- '.substr($v['commit']['author']['date'],0,10).' - '.$v['commit']['author']['name'] .' committed '.substr($v['sha'],0,7).'...
';
echo ''.str_replace("*", "
", $v['commit']['message']) .'
';
echo '
';
}
}
}
}
}
else
{
print_success(get_lang('the_panel_is_up_to_date'));
}
}
}
?>