Project

General

Profile

Feature #447 » interfaces_ppp_edit.php.patch.txt

Marcus Brown, 03/24/2010 08:16 AM

 
1
--- backup-stock-image-20100320/www/interfaces_ppp_edit.php	2010-03-23 13:43:07.000000000 +0700
2
+++ interfaces_ppp_edit.php.new	2010-03-24 11:06:27.000000000 +0700
3
@@ -56,7 +56,8 @@
4
 
5
 if (isset($id) && $a_ppps[$id]) {
6
 	$pconfig['port'] = $a_ppps[$id]['port'];
7
-	$pconfig['ap'] = $a_ppps[$id]['ap'];
8
+	$pconfig['apn'] = $a_ppps[$id]['apn'];
9
+	$pconfig['apnum'] = $a_ppps[$id]['apnum'];
10
 	$pconfig['initstr'] = $a_ppps[$id]['initstr'];
11
 	$pconfig['username'] = $a_ppps[$id]['username'];
12
 	$pconfig['password'] = $a_ppps[$id]['password'];
13
@@ -65,9 +66,9 @@
14
 	if (isset($a_ppps[$id]['defaultgw']))
15
 		$pconfig['defaultgw'] = true;
16
 	$pconfig['phone'] = $a_ppps[$id]['phone'];
17
-	$pconfig['dialcmd'] = base64_decode($a_ppps[$id]['dialcmd']);
18
-	$pconfig['connect-max-attempts'] = $a_ppps[$id]['connect-max-attempts'];
19
-	$pconfig['linespeed'] = $a_ppps[$id]['linespeed'];
20
+	//$pconfig['dialcmd'] = base64_decode($a_ppps[$id]['dialcmd']);
21
+	//$pconfig['connect-max-attempts'] = $a_ppps[$id]['connect-max-attempts'];
22
+	//$pconfig['linespeed'] = $a_ppps[$id]['linespeed'];
23
 	$pconfig['descr'] = $a_ppps[$id]['descr'];
24
 }
25
 
26
@@ -94,11 +95,21 @@
27
 
28
 	if (!$input_errors) {
29
 		$ppp = array();
30
+		if (isset($id)) {
31
+			$ppp['pppid'] = $id;
32
+		} else
33
+			$ppp['pppid'] = count($a_ppps);
34
 		$ppp['port'] = $_POST['port'];
35
 		$ppp['initstr'] = $_POST['initstr'];
36
-		$ppp['ap'] = $_POST['ap'];
37
+		$ppp['apn'] = $_POST['apn'];
38
+		if ($_POST['apn'] <> ""){
39
+			if ($_POST['apnum'] <> ""){
40
+				$ppp['apnum'] = $_POST['apnum'];
41
+			} else
42
+				$ppp['apnum'] = "1";
43
+		}
44
 		$ppp['phone'] = $_POST['phone'];
45
-		$ppp['dialcmd'] = base64_encode($_POST['dialcmd']);
46
+		//$ppp['dialcmd'] = base64_encode($_POST['dialcmd']);
47
 		$ppp['username'] = $_POST['username'];
48
 		$ppp['password'] = $_POST['password'];
49
 		$ppp['localip'] = $_POST['localip'];
50
@@ -107,8 +118,8 @@
51
 			$ppp['defaultgw'] = true;
52
 		else
53
 			unset($ppp['defaultgw']);
54
-		$ppp['linespeed'] = $_POST['linespeed'];
55
-		$ppp['connect-max-attempts'] = $_POST['connect-max-attempts'];
56
+		//$ppp['linespeed'] = $_POST['linespeed'];
57
+		//$ppp['connect-max-attempts'] = $_POST['connect-max-attempts'];
58
 		$ppp['descr'] = $_POST['descr'];
59
 
60
 
61
@@ -119,7 +130,7 @@
62
 
63
 		write_config();
64
 
65
-		interfaces_ppp_configure();
66
+		interface_ppp_configure(-1,true);
67
 
68
 		header("Location: interfaces_ppp.php");
69
 		exit;
70
@@ -139,25 +150,27 @@
71
 	</script>
72
 	<script type="text/javascript">
73
 	function prefill_att() {
74
-		$('dialcmd').value = '"ABORT BUSY ABORT NO\\\\sCARRIER TIMEOUT 5 \\"\\" AT OK-AT-OK ATQ0V1E1S0=0&C1&D2+FCLASS=0 OK \AT+CGDCONT=1,\\\\\\"IP\\\\\\",\\\\\\"ISP.CINGULAR\\\\\\" OK \\\\dATDT\\\\T \TIMEOUT 40 CONNECT"';
75
+		//$('dialcmd').value = '"ABORT BUSY ABORT NO\\\\sCARRIER TIMEOUT 5 \\"\\" AT OK-AT-OK ATQ0V1E1S0=0&C1&D2+FCLASS=0 OK \AT+CGDCONT=1,\\\\\\"IP\\\\\\",\\\\\\"ISP.CINGULAR\\\\\\" OK \\\\dATDT\\\\T \TIMEOUT 40 CONNECT"';
76
+		$('apn').value = "ISP.CINGULAR";
77
+		$('apnum').value = "1";
78
 		$('phone').value = "*99#";
79
 		$('username').value = "att";
80
 		$('password').value = "att";
81
-		$('linespeed').value = "921600";
82
+		//$('linespeed').value = "921600";
83
 	}
84
 	function prefill_sprint() {
85
-		$('dialcmd').value = '"ABORT BUSY ABORT NO\\\\sCARRIER TIMEOUT 5 \\"\\" AT OK-AT-OK ATE1Q0 OK \\\\dATDT\\\\T TIMEOUT 40 CONNECT"';
86
+		//$('dialcmd').value = '"ABORT BUSY ABORT NO\\\\sCARRIER TIMEOUT 5 \\"\\" AT OK-AT-OK ATE1Q0 OK \\\\dATDT\\\\T TIMEOUT 40 CONNECT"';
87
 		$('phone').value = "#777";
88
 		$('username').value = "sprint";
89
 		$('password').value = "sprint";
90
-		$('linespeed').value = "921600";
91
+		//$('linespeed').value = "921600";
92
 	}
93
 	function prefill_vzw() {
94
-		$('dialcmd').value = '"ABORT BUSY ABORT NO\\\\sCARRIER TIMEOUT 5 \\"\\" AT OK-AT-OK ATE1Q0s7=60 OK \\\\dATDT\\\\T TIMEOUT 40 CONNECT"';
95
+		//$('dialcmd').value = '"ABORT BUSY ABORT NO\\\\sCARRIER TIMEOUT 5 \\"\\" AT OK-AT-OK ATE1Q0s7=60 OK \\\\dATDT\\\\T TIMEOUT 40 CONNECT"';
96
 		$('phone').value = "#777";
97
 		$('username').value = "123@vzw3g.com";
98
 		$('password').value = "vzw";
99
-		$('linespeed').value = "921600";
100
+		//$('linespeed').value = "921600";
101
 	}
102
 	</script>
103
 	<table width="100%" border="0" cellpadding="6" cellspacing="0">
104
@@ -199,25 +212,27 @@
105
 			<td width="22%" valign="top" class="vncell">Init String</td>
106
 			<td width="78%" class="vtable">
107
 				<textarea id="initstr" name="initstr"><?=htmlspecialchars($pconfig['initstr']);?></textarea>
108
-				<br><span class="vexpl">Enter the modem initialization string here</span>
109
+				<br><span class="vexpl">Note: Enter the modem initialization string here. Typically left blank.</span>
110
 			</td>
111
 		</tr>
112
  		<tr>
113
- 		  <td width="22%" valign="top" class="vncell">AP Hostname</td>
114
+ 		  <td width="22%" valign="top" class="vncell">Access Point Name (APN)</td>
115
  		  <td width="78%" class="vtable">
116
- 		    <input name="ap" type="text" class="formfld unknown" id="ap" size="40" value="<?=htmlspecialchars($pconfig['ap']);?>">
117
+ 		    <input name="apn" type="text" class="formfld unknown" id="apn" size="40" value="<?=htmlspecialchars($pconfig['apn']);?>">
118
  		</td>
119
  		</tr>
120
  		<tr>
121
- 		  <td width="22%" valign="top" class="vncell">Dial command</td>
122
+ 		  <td width="22%" valign="top" class="vncell">APN number (optional)</td>
123
  		  <td width="78%" class="vtable">
124
-			<textarea rows="4" cols="65" name="dialcmd" id="dialcmd"><?=htmlspecialchars($pconfig['dialcmd']);?></textarea>
125
- 		  </td>
126
+ 		    <input name="apnum" type="text" class="formfld unknown" id="apnum" size="5" value="<?=htmlspecialchars($pconfig['apnum']);?>">
127
+ 		    <br><span class="vexpl">Note: Defaults to 1 if you set APN above. Ignored if you set no APN above.</span>
128
+ 		</td>
129
  		</tr>
130
  		<tr>
131
  		  <td width="22%" valign="top" class="vncell">Phone Number</td>
132
  		  <td width="78%" class="vtable">
133
  		    <input name="phone" type="text" class="formfld unknown" id="phone" size="40" value="<?=htmlspecialchars($pconfig['phone']);?>">
134
+ 		    <br><span class="vexpl">Note: Typically (*99# or *99***# or *99***1#) for GSM networks and *777 for CDMA networks</span>
135
  		  </td>
136
  		</tr>
137
 		<tr>
138
@@ -240,22 +255,10 @@
139
  		  </td>
140
 		</tr>
141
 		<tr>
142
-			<td width="22%" valign="top" class="vncell">Remote IP</td>
143
+			<td width="22%" valign="top" class="vncell">Remote IP (Gateway)</td>
144
 			<td width="78%" class="vtable">
145
 				<input name="gateway" type="text" class="formfld unknown" id="gateway" size="40" value="<?=htmlspecialchars($pconfig['gateway']);?>">
146
-				<span><p>Note: Enter the remote IP here if not automatically assigned. This is where the packets will be routed, equivalent to the gateway.</span>
147
-			</td>
148
-		</tr>
149
-		<tr>
150
-			<td width="22%" valign="top" class="vncell">Line Speed</td>
151
-			<td width="78%" class="vtable">
152
-				<input name="linespeed" type="text" class="formfld unknown" id="linespeed" size="40" value="<?=htmlspecialchars($pconfig['linespeed']);?>">
153
-			</td>
154
-		</tr>
155
-		<tr>
156
-			<td width="22%" valign="top" class="vncell">Maximum connection retry</td>
157
-			<td width="78%" class="vtable">
158
-				<input name="connect-max-attempts" type="text" class="formfld unknown" id="connect-max-attempts" size="2" value="<?=htmlspecialchars($pconfig['connect-max-attempts']);?>">
159
+				<span><p>Note: Enter the remote IP here if not automatically assigned. This is where the packets will be routed.</span>
160
 			</td>
161
 		</tr>
162
 		<tr>
(5-5/10)