function cpgVersioncheckConnectRepository($displayOption_array = '') { if ($displayOption_array = '') { global $displayOption_array; } // Perform the repository lookup and xml creation --- start //$displayOption_array['do_not_connect_to_online_repository'] = 1; $majorVersion = 'cpg' . str_replace('.' . ltrim(substr(COPPERMINE_VERSION, strrpos(COPPERMINE_VERSION, '.')), '.'), '', COPPERMINE_VERSION) . '.x'; $remoteURL = 'http://coppermine-gallery.net/' . str_replace('.', '', $majorVersion) . '.files.xml'; $localFile = 'include/' . str_replace('.', '', $majorVersion) . '.files.xml'; $remoteConnectionFailed = ''; if ($displayOption_array['do_not_connect_to_online_repository'] == 0) { // connect to the online repository --- start $result = cpgGetRemoteFileByURL($remoteURL, 'GET', '', '200'); if (strlen($result['body']) < 200) { $remoteConnectionFailed = 1; $error = $result['error']; //print_r($error); //print '<hr />'; } } // connect to the online repository --- end if ($displayOption_array['do_not_connect_to_online_repository'] == 1 || $remoteConnectionFailed == 1) { $result = cpgGetRemoteFileByURL($localFile, 'GET', '', '200'); } unset($result['headers']); // we should take a look the header data and error messages before dropping them. Well, later maybe ;-) unset($result['error']); $result = array_shift($result); include_once 'include/lib.xml.php'; $xml = new Xml(); $file_data_array = $xml->parse($result); $file_data_array = array_shift($file_data_array); // Perform the repository lookup and xml creation --- end return $file_data_array; }
function cpgVersioncheckConnectRepository() { global $displayOption_array, $majorVersion; // Perform the repository lookup and xml creation --- start //$displayOption_array['do_not_connect_to_online_repository'] = 1; $remoteURL = 'http://coppermine-gallery.net/' . str_replace('.', '', $majorVersion) . '.files.xml'; $localFile = 'include/' . str_replace('.', '', $majorVersion) . '.files.xml'; $remoteConnectionFailed = ''; if ($displayOption_array['do_not_connect_to_online_repository'] == 0) { // connect to the online repository --- start $result = cpgGetRemoteFileByURL($remoteURL, 'GET', '', '200'); if (strlen($result['body']) < 2000) { $remoteConnectionFailed = 1; $error = $result['error']; } } // connect to the online repository --- end if ($displayOption_array['do_not_connect_to_online_repository'] == 1 || $remoteConnectionFailed == 1) { $result = array('body' => file_get_contents($localFile)); } unset($result['headers']); // we should take a look the header data and error messages before dropping them. Well, later maybe ;-) unset($result['error']); $result = array_shift($result); if (function_exists('simplexml_load_string')) { $xml = simplexml_load_string($result); unset($result); $file_data_array = array(); foreach ($xml as $file) { $file_data_array[] = (array) $file; } } else { include_once 'include/lib.xml.php'; $xml = new Xml(); $file_data_array = $xml->parse($result); $file_data_array = array_shift($file_data_array); } // Perform the repository lookup and xml creation --- end return $file_data_array; }
/** * cpg_alert_dev_version() * * @return **/ function cpg_alert_dev_version() { global $lang_version_alert, $lang_common, $CONFIG, $REFERER; $return = ''; if (COPPERMINE_VERSION_STATUS != 'stable') { ob_start(); starttable('100%', $lang_version_alert['version_alert']); print '<tr><td class="tableb">'; print sprintf($lang_version_alert['no_stable_version'], COPPERMINE_VERSION, COPPERMINE_VERSION_STATUS); print '</td></tr>'; endtable(); print '<br />'; $return = ob_get_contents(); ob_end_clean(); } // check if gallery is offline if ($CONFIG['offline'] == 1 && GALLERY_ADMIN_MODE) { ob_start(); starttable('100%', $lang_common['information']); print '<tr><td class="tableb">'; print '<span style="color:red;font-weight:bold">' . $lang_version_alert['gallery_offline'] . '</span>'; print '</td></tr>'; endtable(); print '<br />'; $return .= ob_get_contents(); ob_end_clean(); } // display news from coppermine-gallery.net if ($CONFIG['display_coppermine_news'] == 1 && GALLERY_ADMIN_MODE) { $help_news = ' ' . cpg_display_help('f=configuration.htm&as=admin_general_coppermine_news&ae=admin_general_coppermine_news_end&top=1', '600', '300'); ob_start(); starttable('100%'); print <<<EOT <tr> <td> <table border="0" cellspacing="0" cellpadding="0" width="100%"> <tr> <td class="tableh1"> {$lang_version_alert['coppermine_news']}{$help_news} </td> <td class="tableh1" align="right"> <a href="mode.php?what=news&referer={$REFERER}" class="admin_menu">{$lang_version_alert['hide']}</a> </td> </tr> <tr> <td class="tableb" colspan="2"> EOT; // Try to retrieve the news directly $result = cpgGetRemoteFileByURL('http://coppermine-gallery.net/cpg15x_news.htm', 'GET', '', '200'); if (strlen($result['body']) < 200) { // retrieving the file failed - let's display it in an iframe then print <<<EOT <iframe src="http://coppermine-gallery.net/cpg15x_news.htm" align="left" frameborder="0" scrolling="auto" marginheight="0" marginwidth="0" width="100%" height="100" name="coppermine_news" id="coppermine_news" class="textinput"> {$lang_version_alert['no_iframe']} </iframe> EOT; } else { // we have been able to retrieve the remote URL, let's chop the unneeded data and then display it unset($result['headers']); unset($result['error']); // drop everything before the starting body-tag //$result['body'] = substr($result['body'], strpos($result['body'], '<body>')); $result['body'] = strstr($result['body'], '<body>'); // drop the starting body tag itself $result['body'] = str_replace('<body>', '', $result['body']); // drop the ending body tag and everything after it $result['body'] = str_replace(strstr($result['body'], '</body>'), '', $result['body']); // The result should now contain everything between the body tags - let's print it print $result['body']; } print <<<EOT </td> </tr> </table> </td> </tr> EOT; endtable(); print '<br />'; $return .= ob_get_contents(); ob_end_clean(); } return $return; }