|
|
@@ -40,20 +40,9 @@ function rmdir_recurse($path) {
|
|
|
|
|
|
function getMyFile($url,$destination)
|
|
|
{
|
|
|
- $ch = curl_init();
|
|
|
- curl_setopt($ch, CURLOPT_URL, $url);
|
|
|
- curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
|
|
|
- curl_setopt($ch, CURLOPT_HEADER, false);
|
|
|
- curl_setopt($ch, CURLOPT_BINARYTRANSFER, true);
|
|
|
- curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
|
|
|
- curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0);
|
|
|
- curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
|
|
|
- $date = new DateTime();
|
|
|
- $expires = gmdate('D, d-M-Y H:i:s \G\M\T', $date->getTimestamp() + 31536000000);
|
|
|
- curl_setopt($ch, CURLOPT_COOKIE, "FreedomCookie=true;path=/;expires=".$expires);
|
|
|
- //Save Page
|
|
|
- $result = curl_exec($ch);
|
|
|
- curl_close($ch);
|
|
|
+ $result = file_get_contents($url);
|
|
|
+ if(!$result)
|
|
|
+ return $result;
|
|
|
return file_put_contents($destination, $result);
|
|
|
}
|
|
|
|
|
|
@@ -67,17 +56,9 @@ function installUpdate($info, $base_dir)
|
|
|
echo get_lang_f('unable_download',$info['title'])."\n";
|
|
|
return;
|
|
|
}
|
|
|
-
|
|
|
- $calcMD5 = md5_file( $temp_dwl );
|
|
|
- if($calcMD5 != $info['md5'])
|
|
|
- {
|
|
|
- echo get_lang_f('md5_failed',$info['title']);
|
|
|
- unlink($temp_dwl);
|
|
|
- return;
|
|
|
- }
|
|
|
-
|
|
|
+
|
|
|
// Set default values for file checkings before installing
|
|
|
- $not_writable = get_lang( 'can_not_update_non_writable_files' )." :\n";
|
|
|
+ $not_writable = can_not_update_non_writable_files ." :\n";
|
|
|
$filename = "";
|
|
|
$overwritten = 0;
|
|
|
$new = 0;
|
|
|
@@ -90,11 +71,11 @@ function installUpdate($info, $base_dir)
|
|
|
if( !file_exists($temp_dir) )
|
|
|
mkdir($temp_dir, 0775);
|
|
|
|
|
|
- $result = extractZip( $temp_dwl, $temp_dir . DIRECTORY_SEPARATOR );
|
|
|
+ $result = extractZip( $temp_dwl, $temp_dir . DIRECTORY_SEPARATOR, $info['remove_path'] );
|
|
|
|
|
|
if ( is_array($result['extracted_files']) and count($result['extracted_files']) > 0 )
|
|
|
{
|
|
|
- $nfo_file = preg_replace("/themes\/themes/","themes",$base_dir.$info['install_path']."/install.nfo");
|
|
|
+ $nfo_file = DATA_PATH . str_replace(' ','_',$info['title']) . ".nfo";
|
|
|
$install_nfo = $info['timestamp']."\n$nfo_file\n";
|
|
|
// Check file by file if already exists, if it matches, compares both files
|
|
|
// looking for changes determining if the file needs to be updated.
|
|
|
@@ -103,8 +84,13 @@ function installUpdate($info, $base_dir)
|
|
|
$i = 0;
|
|
|
foreach( $result['extracted_files'] as $file )
|
|
|
{
|
|
|
- $install_nfo .= $base_dir.$file['filename']."\n";
|
|
|
- $filename = $file['filename'];
|
|
|
+ if( DIRECTORY_SEPARATOR == '\\')
|
|
|
+ $filename = str_replace('/', '\\', $file['filename']);
|
|
|
+ else
|
|
|
+ $filename = $file['filename'];
|
|
|
+
|
|
|
+ $filename = preg_replace( "/".preg_quote($info['remove_path'])."/", "", $filename);
|
|
|
+ $install_nfo .= realpath($base_dir) . $filename . "\n";
|
|
|
$temp_file = $temp_dir . DIRECTORY_SEPARATOR . $filename;
|
|
|
$web_file = $base_dir . $filename;
|
|
|
|
|
|
@@ -166,7 +152,7 @@ function installUpdate($info, $base_dir)
|
|
|
if( $all_writable )
|
|
|
{
|
|
|
// Extract the files that are set in $filelist, to the folder at $base_dir.
|
|
|
- $result = extractZip( $temp_dwl, $base_dir, '', '', $filelist );
|
|
|
+ $result = extractZip( $temp_dwl, $base_dir, $info['remove_path'], '', $filelist );
|
|
|
|
|
|
if( is_array( $result['extracted_files'] ) )
|
|
|
{
|
|
|
@@ -182,7 +168,7 @@ function installUpdate($info, $base_dir)
|
|
|
}
|
|
|
|
|
|
// Add install.nfo file to the module/theme directory so we can remove the installed files later and check the installed files timestamp.
|
|
|
- file_put_contents($info['install_path']."/install.nfo", $install_nfo);
|
|
|
+ file_put_contents($nfo_file, $install_nfo);
|
|
|
// Remove the downloaded package
|
|
|
if( file_exists( $temp_dwl ) )
|
|
|
unlink( $temp_dwl );
|
|
|
@@ -190,7 +176,6 @@ function installUpdate($info, $base_dir)
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
- echo $result;
|
|
|
// Remove the downloaded package
|
|
|
if( file_exists( $temp_dwl ) )
|
|
|
unlink( $temp_dwl );
|
|
|
@@ -206,82 +191,202 @@ function installUpdate($info, $base_dir)
|
|
|
return FALSE;
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
+function rglob($pattern, $flags = 0) {
|
|
|
+ $files = glob($pattern, $flags);
|
|
|
+ foreach (glob(dirname($pattern).'/*', GLOB_ONLYDIR|GLOB_NOSORT) as $dir) {
|
|
|
+ $files = array_merge($files, rglob($dir.'/'.basename($pattern), $flags));
|
|
|
+ }
|
|
|
+ return $files;
|
|
|
+}
|
|
|
+
|
|
|
+function deeperPathFirst($a, $b)
|
|
|
+{
|
|
|
+ $al = count(explode(DIRECTORY_SEPARATOR,$a));
|
|
|
+ $bl = count(explode(DIRECTORY_SEPARATOR,$b));
|
|
|
+ if ($al == $bl) {
|
|
|
+ return strcmp($a,$b);
|
|
|
+ }
|
|
|
+ return ($al > $bl) ? -1 : +1;
|
|
|
+}
|
|
|
|
|
|
function exec_ogp_module()
|
|
|
{
|
|
|
set_time_limit(0);
|
|
|
+ $baseDir = str_replace( "modules" . DIRECTORY_SEPARATOR . $_GET['m'],"",dirname(__FILE__) );
|
|
|
+ define('DATA_PATH', realpath('modules/'.$_GET['m'].'/') . DIRECTORY_SEPARATOR . "data" . DIRECTORY_SEPARATOR);
|
|
|
+
|
|
|
+ if(!file_exists(DATA_PATH))
|
|
|
+ {
|
|
|
+ if(!mkdir(DATA_PATH))
|
|
|
+ {
|
|
|
+ print_failure("Need create folder: " . DATA_PATH . ' <br>But ' . dirname(DATA_PATH) . ' is not writable.<br>The command: <pre>chmod -R ' . dirname(DATA_PATH) . '</pre> would fix it.');
|
|
|
+ return;
|
|
|
+ }
|
|
|
+
|
|
|
+ $back_compatibility = [ 'Util',
|
|
|
+ 'RCON',
|
|
|
+ 'DSi',
|
|
|
+ 'Cron',
|
|
|
+ 'LGSL_with_Img_Mod',
|
|
|
+ 'Simple-billing',
|
|
|
+ 'Support',
|
|
|
+ 'TeamSpeak3',
|
|
|
+ 'DarkNature',
|
|
|
+ 'expand-soft',
|
|
|
+ 'Katiuska',
|
|
|
+ 'mobile',
|
|
|
+ 'Light',
|
|
|
+ 'Silver',
|
|
|
+ 'Soft',
|
|
|
+ 'Uprise' ];
|
|
|
+
|
|
|
+ $installed = rglob('*/*/install.nfo');
|
|
|
+
|
|
|
+ foreach($installed as $nfo)
|
|
|
+ {
|
|
|
+ $nfo_new = preg_replace('#^([m|t]{1})(odule|heme){1}s/([^?/]+)/install.nfo#','\3',$nfo);
|
|
|
+ #echo $nfo_new.'<br>';
|
|
|
+ $matches = preg_grep('#'.preg_quote($nfo_new).'#i',$back_compatibility);
|
|
|
+ sort($matches);
|
|
|
+ if($nfo_new == 'fastdl')
|
|
|
+ $matches[0] = 'Fast_Download';
|
|
|
+ if(isset($matches[0]))
|
|
|
+ {
|
|
|
+ #echo DATA_PATH.$matches[0].'.nfo<br>';
|
|
|
+ file_put_contents(DATA_PATH.$matches[0].'.nfo', file_get_contents($nfo));
|
|
|
+ }
|
|
|
+ unlink($nfo);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ #return;
|
|
|
+ define('REPO_FILE', DATA_PATH . "repos");
|
|
|
+ define('URL', 'https://api.github.com/orgs/OpenGamePanel/repos'); // Returns detailed information of all repositories, and urls for more detailed informations about. Nice API GitHub! :)
|
|
|
+ if(!file_exists(REPO_FILE) or isset($_GET['searchForUpdates']) or isset($_POST['update']))
|
|
|
+ {
|
|
|
+ # Without this $context the file_get_contents function was returning HTTP/1.0 403 Forbidden
|
|
|
+ # Thanks: https://github.com/philsturgeon/codeigniter-oauth2/issues/57#issuecomment-29306192
|
|
|
+ $options = array('http' => array('user_agent'=> $_SERVER['HTTP_USER_AGENT']));
|
|
|
+ $context = stream_context_create($options);
|
|
|
+ $response = file_get_contents(URL, false, $context);
|
|
|
+ file_put_contents(REPO_FILE,$response);
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ $response = file_get_contents(REPO_FILE);
|
|
|
+ }
|
|
|
+
|
|
|
+ # Converting json string to array
|
|
|
+ # http://php.net/manual/es/function.json-decode.php mixed json_decode ( string $json [, bool $assoc = false [, int $depth = 512 [, int $options = 0 ]]] )
|
|
|
+ # *options - Bitmask of JSON decode options. Currently only JSON_BIGINT_AS_STRING is supported (default is to cast large integers as floats)
|
|
|
+ $repos_info_array = json_decode($response, true);
|
|
|
+ # Checking for contents while debbuging
|
|
|
+ /* echo "<xmp>";
|
|
|
+ print_r($repos_info_array);
|
|
|
+ echo "</xmp>"; */
|
|
|
+
|
|
|
if(isset($_POST['remove']))
|
|
|
{
|
|
|
- $themeDirRelPath = $_POST['remove'] . "/" . $_POST['folder'];
|
|
|
- if(file_exists($themeDirRelPath) && is_dir($themeDirRelPath)){
|
|
|
- recursiveDelete($themeDirRelPath);
|
|
|
+ $install_nfo = DATA_PATH . str_replace(' ','_',$_POST['folder']) . ".nfo";
|
|
|
+ if( file_exists($install_nfo) )
|
|
|
+ {
|
|
|
+ $lines = file($install_nfo);
|
|
|
+ unset($lines[0]);// timestamp
|
|
|
+ unset($lines[1]);// nfo file
|
|
|
+ usort($lines, "deeperPathFirst");
|
|
|
+ foreach($lines as $file)
|
|
|
+ {
|
|
|
+ $file = trim($file);
|
|
|
+ if(file_exists($file))
|
|
|
+ {
|
|
|
+ unlink($file);
|
|
|
+ $parent_directory = dirname($file);
|
|
|
+ while(count(scandir($parent_directory)) == 2)
|
|
|
+ {
|
|
|
+ if(realpath($parent_directory) == realpath($baseDir))
|
|
|
+ break;
|
|
|
+ if(is_writable($parent_directory))
|
|
|
+ rmdir($parent_directory);
|
|
|
+ else
|
|
|
+ break;
|
|
|
+ $parent_directory = dirname($parent_directory);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ unlink($install_nfo);
|
|
|
}
|
|
|
return;
|
|
|
}
|
|
|
- $url = 'http://sourceforge.net/projects/ogpextras/rss?limit=200'; // Increased limit from 50 to 200 since SourceForge lists 51 entries in the RSS for alternative snapshots.
|
|
|
- require_once 'rss_php.php';
|
|
|
- $rss = new rss_php;
|
|
|
- $rss->load($url);
|
|
|
- $items = $rss->getItems(); #returns all rss items
|
|
|
-
|
|
|
+
|
|
|
$m = 0;
|
|
|
$modules = array();
|
|
|
$t = 0;
|
|
|
$themes = array();
|
|
|
-
|
|
|
- foreach ($items as $index => $item)
|
|
|
+ foreach($repos_info_array as $key => $repository)
|
|
|
{
|
|
|
- if(preg_match("/(Mods|Alternative-Snapshot)/",$item['title']))continue;
|
|
|
+ if(preg_match('/^(OGP-Website|OGP-Agent-Linux|OGP-Agent-Windows)$/',$repository['name']))
|
|
|
+ continue;
|
|
|
|
|
|
- if(preg_match("/\/Modules\//",$item['title']))
|
|
|
+ $REMOTE_REPO_FILE = 'https://github.com/OpenGamePanel/'.$repository['name'].'/commits/master.atom';
|
|
|
+ $LOCAL_REPO_FILE = DATA_PATH . $repository['name'] . '.atom';
|
|
|
+ if(!file_exists($LOCAL_REPO_FILE) OR (isset($_GET['searchForUpdates']) and $_GET['searchForUpdates'] == $repository['name']) OR isset($_POST['update']))
|
|
|
{
|
|
|
- $pubDate = explode(",",$item['pubDate']);
|
|
|
- $pubDate = $pubDate[1];
|
|
|
- $pubDate = explode(" ",$pubDate);
|
|
|
- array_pop($pubDate);
|
|
|
- $pubDate = implode(" ",$pubDate);
|
|
|
- $item['pubDate'] = $pubDate;
|
|
|
- $module_title = preg_replace("/(\/Modules\/|\.zip)/","",$item['title']);
|
|
|
- $modules[$m]['title'] = $module_title;
|
|
|
- $modules[$m]['file'] = str_replace("/Modules/","",$item['title']);
|
|
|
- $modules[$m]['link'] = (string)$item['link'];
|
|
|
- $modules[$m]['date'] = $item['pubDate'];
|
|
|
- $modules[$m]['timestamp'] = strtotime($item['pubDate']);
|
|
|
- $modules[$m]['md5'] = $item['media:content']['media:hash'];
|
|
|
- $module_fld = strtolower($module_title);
|
|
|
- $module_fld = $module_fld == 'simple-billing' ? 'billing' : $module_fld;
|
|
|
- $module_fld = $module_fld == 'lgsl + img mod' ? 'lgsl' : $module_fld;
|
|
|
- $module_fld = $module_fld == 'fast download' ? 'fastdl' : $module_fld;
|
|
|
- $modules[$m]['install_path'] = MODULES.$module_fld;
|
|
|
- $m++;
|
|
|
+ $used_file = $REMOTE_REPO_FILE;
|
|
|
+ $contents = file_get_contents($used_file);
|
|
|
+ if(file_put_contents($LOCAL_REPO_FILE, $contents))
|
|
|
+ touch($LOCAL_REPO_FILE);
|
|
|
}
|
|
|
- if(preg_match("/\/Themes\//",$item['title']))
|
|
|
+ else
|
|
|
+ {
|
|
|
+ $used_file = $LOCAL_REPO_FILE;
|
|
|
+ $contents = file_get_contents($used_file);
|
|
|
+ }
|
|
|
+
|
|
|
+ if( ! $contents )
|
|
|
{
|
|
|
- $pubDate = explode(",",$item['pubDate']);
|
|
|
- $pubDate = $pubDate[1];
|
|
|
- $pubDate = explode(" ",$pubDate);
|
|
|
- array_pop($pubDate);
|
|
|
- $pubDate = implode(" ",$pubDate);
|
|
|
- $item['pubDate'] = $pubDate;
|
|
|
- $theme_title = preg_replace("/(\/Themes\/|\.zip)/","",$item['title']);
|
|
|
- $themes[$t]['title'] = $theme_title;
|
|
|
- $themes[$t]['file'] = str_replace("/Themes/","",$item['title']);
|
|
|
- $themes[$t]['link'] = (string)$item['link'];
|
|
|
- $themes[$t]['date'] = $item['pubDate'];
|
|
|
- $themes[$t]['timestamp'] = strtotime($item['pubDate']);
|
|
|
- $themes[$t]['md5'] = $item['media:content']['media:hash'];
|
|
|
- $themes[$t]['install_path'] = 'themes/'.$theme_title;
|
|
|
- $t++;
|
|
|
+ print_failure('Unable to get contents from : ' . $used_file);
|
|
|
+ continue;
|
|
|
+ }
|
|
|
+ $feedXml = new SimpleXMLElement($contents, LIBXML_NOCDATA);
|
|
|
+ $seed = basename( (string) $feedXml->entry[0]->link['href'] );
|
|
|
+ /* echo "<xmp>";
|
|
|
+ print_r($feedXml);
|
|
|
+ echo "</xmp>"; */
|
|
|
+ if($seed)
|
|
|
+ {
|
|
|
+ if(preg_match("/^Module-/",$repository['name']))
|
|
|
+ {
|
|
|
+ $module_title = preg_replace(array("/^Module-/i","/_/"),array(""," "),$repository['name']);
|
|
|
+ $modules[$m]['title'] = $module_title;
|
|
|
+ $modules[$m]['reponame'] = $repository['name'];
|
|
|
+ $modules[$m]['file'] = $seed.'.zip';
|
|
|
+ $modules[$m]['link'] = 'https://github.com/OpenGamePanel/'.$repository['name'].'/archive/'.$seed.'.zip';
|
|
|
+ $modules[$m]['date'] = (string) $feedXml->entry[0]->updated;
|
|
|
+ $modules[$m]['timestamp'] = strtotime((string) $feedXml->entry[0]->updated);
|
|
|
+ $modules[$m]['remove_path'] = $repository['name']."-".$seed;
|
|
|
+ $m++;
|
|
|
+ }
|
|
|
+ if(preg_match("/^Theme-/",$repository['name']))
|
|
|
+ {
|
|
|
+ $theme_title = preg_replace("/Theme-/i","",$repository['name']);
|
|
|
+ $themes[$t]['title'] = $theme_title;
|
|
|
+ $themes[$t]['reponame'] = $repository['name'];
|
|
|
+ $themes[$t]['file'] = $seed.'.zip';
|
|
|
+ $themes[$t]['link'] = 'https://github.com/OpenGamePanel/'.$repository['name'].'/archive/'.$seed.'.zip';
|
|
|
+ $themes[$t]['date'] = (string) $feedXml->entry[0]->updated;
|
|
|
+ $themes[$t]['timestamp'] = strtotime((string) $feedXml->entry[0]->updated);
|
|
|
+ $themes[$t]['remove_path'] = $repository['name']."-".$seed;
|
|
|
+ $t++;
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
global $db;
|
|
|
$installed_modules = $db->getInstalledModules();
|
|
|
|
|
|
if(isset($_POST['update']))
|
|
|
{
|
|
|
- $baseDir = str_replace( "modules" . DIRECTORY_SEPARATOR . "extras","",dirname(__FILE__) );
|
|
|
- $temesFolder = $baseDir . "themes" . DIRECTORY_SEPARATOR;
|
|
|
+ $baseDir = str_replace( "modules" . DIRECTORY_SEPARATOR . $_GET['m'],"",dirname(__FILE__) );
|
|
|
$uMF = array();
|
|
|
$tmpdir = get_temp_dir(dirname(__FILE__));
|
|
|
if( !is_writable( $tmpdir ) )
|
|
|
@@ -289,13 +394,6 @@ function exec_ogp_module()
|
|
|
echo get_lang_f('temp_folder_not_writable', $tmpdir);
|
|
|
return;
|
|
|
}
|
|
|
- $use_custom_mirror = false;
|
|
|
- if(isset($_POST['mirror']))
|
|
|
- {
|
|
|
- $mirror = $_POST['mirror'];
|
|
|
- unset($_POST['mirror']);
|
|
|
- $use_custom_mirror = true;
|
|
|
- }
|
|
|
foreach($_POST as $key => $value)
|
|
|
{
|
|
|
if($key == 'update')continue;
|
|
|
@@ -304,22 +402,22 @@ function exec_ogp_module()
|
|
|
{
|
|
|
foreach($value as $m)
|
|
|
{
|
|
|
- $info = $modules[$m];
|
|
|
- if($use_custom_mirror)
|
|
|
- $info['link'] = preg_replace("/(.*)\/\/(.*)projects(.*)\/files(.*)\/download/","$1//$mirror.dl.$2project$3$4",$info['link']);
|
|
|
- if(installUpdate($info, $baseDir))
|
|
|
- $uMF[] = str_replace(MODULES,"",$info['install_path']);
|
|
|
- }
|
|
|
+ if(installUpdate($modules[$m], $baseDir))
|
|
|
+ {
|
|
|
+ $install_nfo = DATA_PATH . str_replace(' ','_',$modules[$m]['title']) . ".nfo";
|
|
|
+ $nfo = file_get_contents($install_nfo);
|
|
|
+ $modules_dir_preg = preg_quote(realpath('modules') . DIRECTORY_SEPARATOR);
|
|
|
+ $modulephp_preg = preg_quote(DIRECTORY_SEPARATOR . 'module.php');
|
|
|
+ $preg = '#'.$modules_dir_preg.'(.*)'.$modulephp_preg.'#';
|
|
|
+ if(preg_match($preg, $nfo, $matches))
|
|
|
+ $uMF[] = $matches[1];
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
if($key == 'theme')
|
|
|
{
|
|
|
foreach($value as $t)
|
|
|
- {
|
|
|
- $info = $themes[$t];
|
|
|
- if($use_custom_mirror)
|
|
|
- $info['link'] = preg_replace("/(.*)\/\/(.*)projects(.*)\/files(.*)\/download/","$1//$mirror.dl.$2project$3$4",$info['link']);
|
|
|
- installUpdate($info, $temesFolder);
|
|
|
- }
|
|
|
+ installUpdate($themes[$t], $baseDir);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
@@ -337,20 +435,14 @@ function exec_ogp_module()
|
|
|
return;
|
|
|
}
|
|
|
|
|
|
- echo "<h2>".get_lang('extras')."</h2>";
|
|
|
+ echo "<h2>".extras."</h2>";
|
|
|
+
|
|
|
echo "<table style=\"width:100%;\">";
|
|
|
|
|
|
- if ( ini_get('open_basedir') or get_true_boolean(ini_get('safe_mode')) )
|
|
|
- {
|
|
|
- echo "<tr><td colspan=2 style='text-align:center;' >";
|
|
|
- $sf_mirrors = file("modules/extras/mirrors.list");
|
|
|
- echo get_lang('select_mirror').": ".create_drop_box_from_array_rsync($sf_mirrors,"mirror");
|
|
|
- echo "</td></tr>";
|
|
|
- }
|
|
|
echo "<tr><td style=\"width:50%;\">";
|
|
|
# MODULES
|
|
|
echo "<div class=\"dragbox bloc rounded\" style=\"margin:1%;\">".
|
|
|
- "<h4>".get_lang('extra_modules')."</h4>".
|
|
|
+ "<h4>".extra_modules."</h4>".
|
|
|
"<div class=\"dragbox-content\" >";
|
|
|
|
|
|
foreach ( $installed_modules as $installed_module )
|
|
|
@@ -361,23 +453,32 @@ function exec_ogp_module()
|
|
|
|
|
|
foreach($modules as $key => $module)
|
|
|
{
|
|
|
- $on_disk = file_exists($module['install_path']."/module.php");
|
|
|
- $folder = str_replace(MODULES,"",$module['install_path']);
|
|
|
+ $local_repo_file = DATA_PATH . $module['reponame'] . '.atom';
|
|
|
+ $install_nfo = DATA_PATH . str_replace(' ','_',$module['title']) . ".nfo";
|
|
|
+ $on_disk = file_exists($install_nfo);
|
|
|
+ $is_old = $on_disk && (strtotime('+1 hour', filemtime($local_repo_file)) <= time());
|
|
|
+ //echo $install_nfo;
|
|
|
+ $folder = str_replace(' ','_',strtolower($module['title']));
|
|
|
$installed = array_key_exists($folder,$installed_modules_by_folder);
|
|
|
|
|
|
$installed_str = $on_disk ? $installed ? "<a class='uninstall' style='color:blue;' data-module-folder='$folder' data-module-id='".
|
|
|
- $installed_modules_by_folder[$folder]."' href='#uninstall_$folder' >".get_lang('uninstall')."</a>" :
|
|
|
- "<a class='install' style='color:blue;' data-module-folder='$folder' href='#install_$folder' >".get_lang('install')."</a> - ".
|
|
|
- "<a class='remove' style='color:red;' data-module-folder='$folder' data-remove-mode='modules' href='#remove_$folder' >".get_lang('remove')."</a>" :
|
|
|
- "<b style='color:red;' >".get_lang('not_installed')."</b>";
|
|
|
+ $installed_modules_by_folder[$folder]."' href='#uninstall_$folder' >".uninstall."</a>" :
|
|
|
+ "<a class='install' style='color:blue;' data-module-folder='$folder' href='#install_$folder' >".install."</a> - ".
|
|
|
+ "<a class='remove' style='color:red;' data-module-folder='$module[title]' data-remove-mode='modules' href='#remove_$folder' >".remove."</a>" :
|
|
|
+ "<b style='color:red;' >".not_installed."</b>";
|
|
|
$uptodate = FALSE;
|
|
|
- if(file_exists($module['install_path']."/install.nfo"))
|
|
|
+ if($on_disk)
|
|
|
{
|
|
|
- $install_nfo = file_get_contents($module['install_path']."/install.nfo");
|
|
|
+ $install_nfo = file_get_contents($install_nfo);
|
|
|
list($timestamp, $files) = explode("\n", $install_nfo);
|
|
|
$uptodate = ($timestamp == $module['timestamp']) ? TRUE : FALSE;
|
|
|
}
|
|
|
- $updated_str = $on_disk ? $uptodate ? " - <b style='color:green;' >".get_lang('uptodate')."</b>" : " - <b style='color:orange;' >".get_lang('update_available')."</b> (".$module['date'].")" : "";
|
|
|
+ $updated_str = $on_disk ?
|
|
|
+ $uptodate ?
|
|
|
+ $is_old ? " - <a class='search' style='color:brown;' href='?m=".$_GET['m']."&searchForUpdates=".$module['reponame']."' >".search_for_updates."</a>" :
|
|
|
+ " - <b style='color:green;' >".uptodate."</b>" :
|
|
|
+ " - <b style='color:orange;' >".update_available."</b> (".$module['date'].")" :
|
|
|
+ "";
|
|
|
$disabled = $uptodate ? "disabled=disabled" : "";
|
|
|
echo '<input type="checkbox" name="module" value="'.$key."\" $disabled>";
|
|
|
echo '<b>'.$module['title']."</b> - $installed_str$updated_str <span id='loading' class='$folder' ></span><br>";
|
|
|
@@ -387,38 +488,46 @@ function exec_ogp_module()
|
|
|
|
|
|
# THEMES
|
|
|
echo "<div class=\"dragbox bloc rounded\" style=\"margin:1%;\">".
|
|
|
- "<h4>".get_lang('extra_themes')."</h4>".
|
|
|
+ "<h4>".extra_themes."</h4>".
|
|
|
"<div class=\"dragbox-content\" >";
|
|
|
-
|
|
|
foreach($themes as $key => $theme)
|
|
|
{
|
|
|
- $installed = file_exists($theme['install_path']);
|
|
|
- $folder = str_replace("themes/","",$theme['install_path']);
|
|
|
- $installed_str = $installed ? "<b style='color:green;' >".get_lang('installed')."</b> - ".
|
|
|
- "<a class='remove' style='color:red;' data-module-folder='$folder' data-remove-mode='themes' href='#remove_$folder' >".get_lang('remove')."</a>":
|
|
|
- "<b style='color:red;' >".get_lang('not_installed')."</b>";
|
|
|
+ $local_repo_file = DATA_PATH . $theme['reponame'] . '.atom';
|
|
|
+ $install_nfo = DATA_PATH . str_replace(' ','_',$theme['title']) . ".nfo";
|
|
|
+ $on_disk = file_exists($install_nfo);
|
|
|
+ $is_old = $on_disk && (strtotime('+1 hour', filemtime($local_repo_file)) <= time());
|
|
|
+ $installed_str = $on_disk ? "<b style='color:green;' >".installed."</b> - ".
|
|
|
+ "<a class='remove' style='color:red;' data-module-folder='$theme[title]' data-remove-mode='themes' href='#remove_$folder' >".remove."</a>":
|
|
|
+ "<b style='color:red;' >".not_installed."</b>";
|
|
|
$uptodate = FALSE;
|
|
|
- if(file_exists($theme['install_path']."/install.nfo"))
|
|
|
+ if($on_disk)
|
|
|
{
|
|
|
- $install_nfo = file_get_contents($theme['install_path']."/install.nfo");
|
|
|
+ $install_nfo = file_get_contents($install_nfo);
|
|
|
list($timestamp, $files) = explode("\n", $install_nfo);
|
|
|
$uptodate = ($timestamp == $theme['timestamp']) ? TRUE : FALSE;
|
|
|
}
|
|
|
- $updated_str = $installed ? $uptodate ? " - <b style='color:green;' >".get_lang('uptodate')."</b>" : " - <b style='color:orange;' >".get_lang('update_available')."</b> (".$theme['date'].")" : "";
|
|
|
+
|
|
|
+
|
|
|
+ $updated_str = $on_disk ?
|
|
|
+ $uptodate ?
|
|
|
+ $is_old ? " - <a class='search' style='color:brown;' href='?m=".$_GET['m']."&searchForUpdates=".$theme['reponame']."' >".search_for_updates."</a>" :
|
|
|
+ " - <b style='color:green;' >".uptodate."</b>" :
|
|
|
+ " - <b style='color:orange;' >".update_available."</b> (".$theme['date'].")" :
|
|
|
+ "";
|
|
|
$disabled = $uptodate ? "disabled=disabled" : "";
|
|
|
echo '<input type="checkbox" name="theme" value="'.$key."\" $disabled>";
|
|
|
echo '<b>'.$theme['title']."</b> - $installed_str$updated_str<br>";
|
|
|
}
|
|
|
|
|
|
echo "</div></div></td></tr>".
|
|
|
- "<tr><td colspan=2 ><span id=updateButton ><button name=update >".get_lang('download_update')."</button></span></td></tr></table><div id=resp ></div>";
|
|
|
+ "<tr><td colspan=2 ><span id=updateButton ><button name=update >".download_update."</button></span></td></tr></table><div id=resp ></div>";
|
|
|
|
|
|
echo "<div id='dialog".
|
|
|
- "' data-uninstalling_module_dataloss='".get_lang('uninstalling_module_dataloss').
|
|
|
- "' data-are_you_sure='".get_lang('are_you_sure').
|
|
|
- "' data-remove_files_for='".get_lang('remove_files_for').
|
|
|
- "' data-confirm='".get_lang('confirm').
|
|
|
- "' data-cancel='".get_lang('cancel').
|
|
|
+ "' data-uninstalling_module_dataloss='".uninstalling_module_dataloss.
|
|
|
+ "' data-are_you_sure='".are_you_sure.
|
|
|
+ "' data-remove_files_for='".remove_files_for.
|
|
|
+ "' data-confirm='".confirm.
|
|
|
+ "' data-cancel='".cancel.
|
|
|
"' ></div>";
|
|
|
}
|
|
|
?>
|