]> git.mjollnir.org Git - moodle.git/commitdiff
Take out more notices in restore process. Undefined variables, mainly.
authorstronk7 <stronk7>
Tue, 14 Oct 2003 17:26:37 +0000 (17:26 +0000)
committerstronk7 <stronk7>
Tue, 14 Oct 2003 17:26:37 +0000 (17:26 +0000)
backup/backup_check.html
backup/backup_form.html
backup/restore_check.html
backup/restore_form.html

index c286c8ce4150b8317c84e8c5923163b82c01d6b6..472df23de44ffadc0594e57d66b35346ff6077fe 100644 (file)
             $modbackup = $modname."_backup_mods";
             //If exists the lib & function
             $var = "exists_".$modname;
-            if ($$var) {
+            if (isset($$var) && $$var) {
                 //Add hidden fields
                 $var = "backup_".$modname;
                 echo "<input type=\"hidden\" name=\"".$var."\" value=\"".$$var."\">";
index ccbde307919400dd595febfb3200b51ac757dfd6..379b5bf49a5c3784c469dd3105ce3b8661fb00dd 100644 (file)
@@ -83,7 +83,7 @@
             $modbackup = $modname."_backup_mods";
             //If exists the lib & function
             $var = "exists_".$modname;
-            if ($$var) {
+            if (isset($$var) && $$var) {
                 //Print the full tr
                 echo "<tr>";
                 echo "<td align=\"right\"><P><B>";
index 54989538c484fc44376921a6c832a002a405c8ea..48c9c5c605fd2cbd3332850ff7af18a89255a767 100644 (file)
@@ -16,7 +16,7 @@
 
     //If restore session info exists, but we are posting parameters
     //manually, this has prioriry
-    if ($restore and isset($restore_restoreto)) {
+    if (isset($restore) and isset($restore_restoreto)) {
         unset($restore);
     }
 
index 5d9efea0a4a416792accfa2d79fb283ba4f543b2..e89acc6f6ae0d81a75d2cbdf92c5dc6e4957d5b4 100644 (file)
             $exist = "exists_".$modname;
             $restore_var = "restore_".$modname;
             $user_info_var = "restore_user_info_".$modname;
-            if ($$exist) {
-                //Now check that we have that module info in the backup file
-                if ($info->mods[$modname]->backup == "true") {
-                    //Print the full tr
-                    echo "<tr>";
-                    echo "<td align=\"right\"><P><B>";
-                    echo get_string("include")." ". get_string("modulenameplural",$modname).":";
-                    echo "</td><td>";
-                    $restore_options[0] = get_string("no"); 
-                    $restore_options[1] = get_string("yes");
-                    choose_from_menu($restore_options, $restore_var, $$restore_var, "");
-                    //If backup contains user data, then show menu, else fix it to
-                    //without user data
-                    if ($info->mods[$modname]->userinfo == "true") {
-                        $restore_user_options[0] = get_string("withoutuserdata"); 
-                        $restore_user_options[1] = get_string("withuserdata");
-                        choose_from_menu($restore_user_options, $user_info_var, $$user_info_var, "");
+            if (isset($$exist)) {
+                if ($$exist) {
+                    //Now check that we have that module info in the backup file
+                    if (isset($info->mods[$modname]) && $info->mods[$modname]->backup == "true") {
+                        //Print the full tr
+                        echo "<tr>";
+                        echo "<td align=\"right\"><P><B>";
+                        echo get_string("include")." ". get_string("modulenameplural",$modname).":";
+                        echo "</td><td>";
+                        $restore_options[0] = get_string("no"); 
+                        $restore_options[1] = get_string("yes");
+                        choose_from_menu($restore_options, $restore_var, $$restore_var, "");
+                        //If backup contains user data, then show menu, else fix it to
+                        //without user data
+                        if ($info->mods[$modname]->userinfo == "true") {
+                            $restore_user_options[0] = get_string("withoutuserdata"); 
+                            $restore_user_options[1] = get_string("withuserdata");
+                            choose_from_menu($restore_user_options, $user_info_var, $$user_info_var, "");
+                        } else {
+                            //Module haven't userdata
+                            echo get_string("withoutuserdata");
+                            echo "<input type=\"hidden\" name=\"$user_info_var\" value=\"0\">";
+                        }
+                        echo "</td></tr>";
                     } else {
-                        //Module haven't userdata
-                        echo get_string("withoutuserdata");
+                        //Module isn't restorable
+                        echo "<input type=\"hidden\" name=\"$restore_var\" value=\"0\">";
                         echo "<input type=\"hidden\" name=\"$user_info_var\" value=\"0\">";
                     }
-                    echo "</td></tr>";
                 } else {
                     //Module isn't restorable
                     echo "<input type=\"hidden\" name=\"$restore_var\" value=\"0\">";