summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 3a84b47)
raw | patch | inline | side by side (parent: 3a84b47)
author | Franklin S Cooper Jr <fcooper@ti.com> | |
Fri, 27 Jan 2012 02:43:34 +0000 (18:43 -0800) | ||
committer | Franklin 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>
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 | patch | blob | history | |
coming_soon.php | patch | blob | history | |
generate.php | patch | blob | history | |
helper_functions.php | patch | blob | history | |
run_script.php | patch | blob | history | |
submenu.php | patch | blob | history |
diff --git a/app_description.php b/app_description.php
index b58929b4ec091e1a29aabab213720cb8f45399e7..fe23c7c0cbd4bb7ade2453c32f915820dc1c8d09 100755 (executable)
--- a/app_description.php
+++ b/app_description.php
$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" ;
diff --git a/coming_soon.php b/coming_soon.php
index d671594dd458d31fa4247837b4e78be2f75b294c..68f3b1a5670b1d3e80c991d097a20ea2bf39f3c7 100755 (executable)
--- a/coming_soon.php
+++ b/coming_soon.php
$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";
diff --git a/generate.php b/generate.php
index b6bb9fe66209fc16d617b0986b72125018c39f55..5bd0ad42495513bf46fd7e58eabfa74c24f550ef 100644 (file)
--- a/generate.php
+++ b/generate.php
$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++)
diff --git a/helper_functions.php b/helper_functions.php
index ad3e34e39a26ff836ac51d462a2a34a1165a2fdd..e4790809b6aa59eb4b5f521da42a6099bbd86d32 100644 (file)
--- a/helper_functions.php
+++ b/helper_functions.php
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;
}
?>
diff --git a/run_script.php b/run_script.php
index bd223a7b000a9d63dc3ef7ebec0b6e92f2f39dfb..4d790c04b8b2843cb9d5b80a712c5cbe9277cfea 100644 (file)
--- a/run_script.php
+++ b/run_script.php
$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" ;
diff --git a/submenu.php b/submenu.php
index c4eec4c527a5012fb05ba13555a02d64ee18cec0..3a7256131a7efebbebaa443ecdb13b23160514a8 100755 (executable)
--- a/submenu.php
+++ b/submenu.php
$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");