]> Gitweb @ Texas Instruments - Open Source Git Repositories - git.TI.com/gitweb - matrix-gui-v2/matrix-gui-v2.git/commitdiff
matrix-gui-v2: Bug fixes generation-fix cloned/generation-fix origin/generation-fix
authorFranklin S Cooper Jr <fcooper@ti.com>
Fri, 27 Jan 2012 02:43:34 +0000 (18:43 -0800)
committerFranklin S Cooper Jr <fcooper@ti.com>
Fri, 27 Jan 2012 02:43:34 +0000 (18:43 -0800)
*Fixes an issue that causes PHP errors if generate.php runs
and no .desktop file is found
*Also fixes a possible issue where the Json.txt file isn't found or
is empty.

Signed-off-by: Franklin S Cooper Jr <fcooper@ti.com>
app_description.php
coming_soon.php
generate.php
helper_functions.php
run_script.php
submenu.php

index b58929b4ec091e1a29aabab213720cb8f45399e7..fe23c7c0cbd4bb7ade2453c32f915820dc1c8d09 100755 (executable)
@@ -40,6 +40,12 @@ start_caching();
 
 $var = read_desktop_file();
 
+if($var==null)
+{
+       echo "Json.txt file is empty or doesn't exist.";
+       return;
+}
+
 //Some parts of the code doesn't set the submenu variable when the user is at the Main Menu which is relected in the "top" variable
 $submenu = isset($_GET["submenu"]) == true ? $_GET["submenu"] : "main_menu" ;
 
index d671594dd458d31fa4247837b4e78be2f75b294c..68f3b1a5670b1d3e80c991d097a20ea2bf39f3c7 100755 (executable)
@@ -42,7 +42,15 @@ $enable_main_menu_link = true;
 
 $submenu = $_GET["submenu"];
 
-$submenu_entry = get_submenu(read_desktop_file(),$submenu);
+$var = read_desktop_file();
+
+if($var==null)
+{
+       echo "Json.txt file is empty or doesn't exist.";
+       return;
+}
+
+$submenu_entry = get_submenu($var,$submenu);
 
 $menu_title = "Coming Soon";
 
index b6bb9fe66209fc16d617b0986b72125018c39f55..5bd0ad42495513bf46fd7e58eabfa74c24f550ef 100644 (file)
@@ -55,6 +55,13 @@ $handle = fopen("catdesktop.txt", "rb");
 $contents = fread($handle,filesize("catdesktop.txt"));
 fclose($handle);
 unlink('catdesktop.txt');
+
+if(strlen($contents)==0)
+{
+       echo "No .desktop files found";
+       return;
+}
+
 $contents = explode("\n",$contents);
 
 for($x = 0;$x<count($contents)&&strlen($contents[$x])>0;$x++)
index ad3e34e39a26ff836ac51d462a2a34a1165a2fdd..e4790809b6aa59eb4b5f521da42a6099bbd86d32 100644 (file)
@@ -68,11 +68,19 @@ function get_submenu($dot_desktop_array,$submenu_name)
 
 function read_desktop_file()
 {
-       $handle = fopen("json.txt", "rb");
-       $contents = fread($handle,filesize("json.txt"));
-       fclose($handle);
+       if(file_exists("json.txt") == true)
+       {
+               $handle = fopen("json.txt", "rb");
+               $contents = fread($handle,filesize("json.txt"));
+               fclose($handle);
 
-       return json_decode($contents,true);
+               if(strlen($contents)==0)
+                       return null;
+               else
+                       return json_decode($contents,true);
+       }
+       else
+               return null;
 }
 
 ?>
index bd223a7b000a9d63dc3ef7ebec0b6e92f2f39dfb..4d790c04b8b2843cb9d5b80a712c5cbe9277cfea 100644 (file)
@@ -41,6 +41,12 @@ $currently_locked = false;
 
 $var = read_desktop_file();
 
+if($var==null)
+{
+       echo "Json.txt file is empty or doesn't exist.";
+       return;
+}
+
 $submenu = isset($_GET["submenu"]) == true ? $_GET["submenu"] : "main_menu" ;
 
 
index c4eec4c527a5012fb05ba13555a02d64ee18cec0..3a7256131a7efebbebaa443ecdb13b23160514a8 100755 (executable)
@@ -39,6 +39,12 @@ start_caching();
 
 $var = read_desktop_file();
 
+if($var==null)
+{
+       echo "Json.txt file is empty or doesn't exist.";
+       return;
+}
+
 //Load Matrix configuration file
 $ini_array = parse_ini_file("matrix_config.ini");