Browse code

fix for PHP notices during install process

Jimmi08 authored on 2021/06/11 08:24:44
Showing 3 changed files
... ...
@@ -49,7 +49,7 @@ function updatePanelOrder( ) {
49 49
 	}
50 50
 }
51 51
 
52
-if($action == "settings") {
52
+if(isset($action) && $action == "settings") {
53 53
 $output .= "<h1>"._SETTINGS."</h1><div style='text-align: center;'>
54 54
 	<a href='admin.php?action=settings&amp;sect=main'>"._MAINSETTINGS."</a> |
55 55
 	<a href='admin.php?action=settings&amp;sect=submissions'>"._SUBMISSIONSETTINGS."</a> |
... ...
@@ -182,7 +182,7 @@ if(isset($_POST['submit'])) {
182 182
 		$$var = stripslashes($val);
183 183
 	}
184 184
 
185
-	$output .= "<form method='POST' class='tblborder' style='' enctype='multipart/form-data' action='".($action == "settings" ? "admin.php?action=settings" : $_SERVER['PHP_SELF']."?step=".$_GET['step'])."&amp;sect=$sect'>";
185
+	$output .= "<form method='POST' class='tblborder' style='' enctype='multipart/form-data' action='".(isset($action) &&  $action == "settings" ? "admin.php?action=settings" : $_SERVER['PHP_SELF']."?step=".$_GET['step'])."&amp;sect=$sect'>";
186 186
 	if($sect == "main") {
187 187
 		$output .= "<h2>"._SITEINFO."</h2>
188 188
 		<table class='acp'>
... ...
@@ -60,20 +60,21 @@ header ("Pragma: no-cache");
60 60
 header ("Expires: 0"); 
61 61
 
62 62
 $output = "";
63
+$language = "en";
63 64
 
64 65
 include ("../includes/class.TemplatePower.inc.php");
65 66
 
66
-if(!isset($_GET['step']) || $_GET['step'] == 2) {
67
+if(!isset($_GET['step']) || $_GET['step'] == 2) {   
67 68
 	include ("../languages/en.php");
68 69
 	include ("../languages/en_admin.php");
69 70
 	include ("languages/en.php");
70 71
 }
71 72
 else if(isset($_REQUEST['language'])) {
72 73
 	$language = $_REQUEST['language'];
73
-	if(file_exists("../languages/".$language.".php")) include ("../languages/".$language.".php");
74
-	else include ("../languages/en.php");
75
-	if(file_exists("../languages/".$language."_admin.php")) include("../languages/".$language."_admin.php");
76
-	else include ("../languages/en_admin.php");
74
+ 	if(file_exists("../languages/".$language.".php")) include ("../languages/".$language.".php");
75
+ 	else include ("../languages/en.php");
76
+ 	if(file_exists("../languages/".$language."_admin.php")) include("../languages/".$language."_admin.php");
77
+ 	else include ("../languages/en_admin.php");
77 78
 	if(file_exists("languages/".$language.".php")) include("languages/".$language.".php");
78 79
 	else include ("languages/en.php");
79 80
 }
... ...
@@ -146,14 +147,15 @@ $tpl->newBlock("footer");
146 147
 $tpl->assign( "footer", "eFiction $version &copy; 2007. <a href='http://efiction.org/'>http://efiction.org/</a>");
147 148
 $tpl->gotoBlock( "_ROOT" );
148 149
 
149
-switch($_GET['step']) {
150
+$step = isset($_GET["step"]) ? $_GET["step"] : "";
151
+switch($step) {
150 152
 	case "9":
151 153
 		if(isset($_POST['submit'])) {
152 154
 			$penname = descript($_POST['newpenname']);
153 155
 			if((!$_POST['email']) && !isADMIN) $fail .= "<div style='text-align: center;'>"._EMAILREQUIRED." "._TRYAGAIN."</div>";
154 156
 			if($penname && !preg_match("!^[a-z0-9_ ]{3,30}$!i", $penname)) $fail = "<div style='text-align: center;'>"._BADUSERNAME." "._TRYAGAIN."</div>";
155
-			if(!preg_match("/^[a-zA-Z0-9_.+-]+@[a-zA-Z0-9-]+\.[a-zA-Z0-9.-]+$/", $_POST[email])) $fail = "<div style='text-align: center;'>"._INVALIDEMAIL." "._TRYAGAIN."</div>";
156
-			if($_POST['password'] == $_POST['password2']) $encryptpassword = md5($_POST[password]);
157
+			if(!preg_match("/^[a-zA-Z0-9_.+-]+@[a-zA-Z0-9-]+\.[a-zA-Z0-9.-]+$/", $_POST['email'])) $fail = "<div style='text-align: center;'>"._INVALIDEMAIL." "._TRYAGAIN."</div>";
158
+			if($_POST['password'] == $_POST['password2']) $encryptpassword = md5($_POST['password']);
157 159
 			else $fail =  write_message(_PASSWORDTWICE);
158 160
 			if(!isset($fail)) {
159 161
 				$result = dbquery("INSERT INTO ".$tableprefix."fanfiction_authors(`penname`, `email`, `password`, `date`) VALUES('$penname', '".$_POST['email']."', '$encryptpassword', now( ))");
... ...
@@ -161,11 +163,13 @@ switch($_GET['step']) {
161 163
 				$skinquery = dbquery("SELECT skin FROM ".$settingsprefix."fanfiction_settings WHERE sitekey = '".SITEKEY."'");
162 164
 				list($skin) = dbrow($skinquery);
163 165
 				$result2 = dbquery("INSERT INTO ".$tableprefix."fanfiction_authorprefs(`uid`, `userskin`, `level`) VALUES('".USERUID."', '$skin', '1')");
164
-				if($result && $result2) $output .= write_message(_ACTIONSUCCESSFUL."<br /><br />Installation complete!  <a href='../user.php?action=login'>Log in</a> to your site and go to the Admin area to configure your archive. <strong>Note:</strong> Please delete the install/ folder!");
166
+				if($result && $result2) $output .= write_message(_ACTIONSUCCESSFUL."<br /><br />Installation complete!  <a href='../member.php?action=login'>Log in</a> to your site and go to the Admin area to configure your archive. <strong>Note:</strong> Please delete the install/ folder!");
165 167
 			}
166 168
 			else $output .= $fail;
167 169
 		}
168 170
 		else {
171
+            if(!isset($user['penname'])) $user['penname'] = '';
172
+            if(!isset($user['email'])) $user['email'] = '';
169 173
 			$output .= "<div id='pagetitle'>"._ADMINACCT."</div><form method=\"POST\" class='tblborder' style='margin: 1em auto; width: 400px;' enctype=\"multipart/form-data\" action=\"install.php?step=9\">
170 174
 			<div class='row'><label for='newpenname'>"._PENNAME.":</label> <INPUT name=\"newpenname\" type=\"text\" class=\"textbox\" maxlength=\"200\" value=\"$user[penname]\"></div>
171 175
 		 	<div class='row'><label for='email'>"._EMAIL.":</label> <INPUT  type=\"text\" class=\"textbox=\" name=\"email\" value=\"$user[email]\" maxlength=\"200\"></div>
... ...
@@ -784,7 +788,7 @@ $output .= write_message(_TABLEFAILED."<br /><br /><a href='install.php?step=4'>
784 788
 				$settingsresults = dbquery("SELECT * FROM ".$settingsprefix."fanfiction_settings WHERE sitekey = '".SITEKEY."'");
785 789
 			}
786 790
 			$settings = dbassoc($settingsresults);
787
-			define("_BASEDIR", "../");
791
+            if (!defined("_BASEDIR")) define('constant', define("_BASEDIR", "../"));
788 792
 			foreach($settings as $var => $val) {
789 793
 				$$var = $val;
790 794
 			}
... ...
@@ -814,7 +818,7 @@ $output .= write_message(_TABLEFAILED."<br /><br /><a href='install.php?step=4'>
814 818
 			else include("../admin/settings.php");
815 819
 		}
816 820
 		else {
817
-			if($_GET['install']) {
821
+			if(isset($_GET['install'])) {
818 822
 				if($_GET['install'] == "automatic") {
819 823
 			
820 824
 								$settings = dbquery("CREATE TABLE IF NOT EXISTS `".$settingsprefix."fanfiction_settings` (
... ...
@@ -8,6 +8,19 @@ define('_OTHER', 'Other');
8 8
 $alphabet = array('A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z', _OTHER);
9 9
 
10 10
 // General...used in many pages.
11
+if(!isset($allowed_tags)) $allowed_tags = '';
12
+if(!isset($recentdays)) $recentdays = '7';
13
+if(!isset($sitename )) $sitename  = '';
14
+if(!isset($url )) $url  = '';
15
+if(!isset($multiplecats )) $multiplecats  = '';
16
+if(!isset($minwords )) $minwords  = '';
17
+if(!isset($maxwords )) $maxwords  = '';
18
+if(!isset($action )) $action  = '';
19
+if(!isset($pwdsetting )) $pwdsetting  = '';
20
+if(!isset($imagewidth )) $imagewidth  = '';
21
+if(!isset($imageheight )) $imageheight = '';
22
+if(!isset($version)) $version  = '';
23
+
11 24
 
12 25
 define('_ACTIONSUCCESSFUL', 'The action was successful.');
13 26
 define('_ACTIONCANCELLED', 'The requested action was cancelled.');