Merge lp:~nurlan0000/psiphon/sprint3-610188 into lp:psiphon

Proposed by Nurlan Turdaliev
Status: Merged
Approved by: Adam Kruger
Approved revision: 121
Merged at revision: 136
Proposed branch: lp:~nurlan0000/psiphon/sprint3-610188
Merge into: lp:psiphon
Diff against target: 212 lines (+91/-18)
6 files modified
trunk/sql/upgrade-2.6.sql (+1/-0)
trunk/tools/psiphon_install.sh (+1/-1)
trunk/www/create_account.php (+5/-0)
trunk/www/includes/lang.php (+26/-0)
trunk/www/invite-m.php (+29/-9)
trunk/www/invite.php (+29/-8)
To merge this branch: bzr merge lp:~nurlan0000/psiphon/sprint3-610188
Reviewer Review Type Date Requested Status
Samat Jukeshov (community) Needs Resubmitting
e.fryntov code read Needs Fixing
Review via email: mp+34380@code.launchpad.net
To post a comment you must log in.
Revision history for this message
e.fryntov (e-fryntov) wrote :

The code looks OK and works as it supposed to.

review: Approve (code read and test install)
Revision history for this message
e.fryntov (e-fryntov) wrote :

I overlooked the fact that related tests were missing. Please add tests to this branch.

review: Needs Fixing (code read)
Revision history for this message
Samat Jukeshov (jukeshov) wrote :

we commit autotest for this ticket on full package of tests with #28 at https://spreadsheets.google.com/pub?key=0AmM0LQffI9KjdERDTFhycnE5RE4taEJTaVdZbXpWcUE&hl=en&output=html

review: Needs Resubmitting

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== added file 'trunk/sql/upgrade-2.6.sql'
2--- trunk/sql/upgrade-2.6.sql 1970-01-01 00:00:00 +0000
3+++ trunk/sql/upgrade-2.6.sql 2010-09-02 04:22:39 +0000
4@@ -0,0 +1,1 @@
5+ALTER TABLE `invitation` ADD COLUMN `homepage` CHAR(255);
6\ No newline at end of file
7
8=== modified file 'trunk/tools/psiphon_install.sh'
9--- trunk/tools/psiphon_install.sh 2010-06-01 17:50:42 +0000
10+++ trunk/tools/psiphon_install.sh 2010-09-02 04:22:39 +0000
11@@ -271,7 +271,7 @@
12 echo "Enter current password for mysql root (enter for none)"
13
14 cat sql/create_db.sql sql/grant.new.sql sql/structure.2.3.sql sql/init.sql \
15-sql/upgrade-2.4.sql sql/upgrade-2.5.sql sql/jsf.sql sql/youtube.sql | mysql -uroot -p
16+sql/upgrade-2.4.sql sql/upgrade-2.5.sql sql/upgrade-2.6.sql sql/jsf.sql sql/youtube.sql | mysql -uroot -p
17
18 rm sql/grant.new.sql
19
20
21=== modified file 'trunk/www/create_account.php'
22--- trunk/www/create_account.php 2010-07-16 17:53:05 +0000
23+++ trunk/www/create_account.php 2010-09-02 04:22:39 +0000
24@@ -426,6 +426,11 @@
25 break;
26 }
27
28+ // Set default homepage
29+ $default_homepage_url = $invitation_record['homepage'];
30+ if ( is_url($default_homepage_url))
31+ $home_page = $default_homepage_url;
32+
33 $query = "INSERT INTO user (".
34 "email,".
35 "pass,".
36
37=== modified file 'trunk/www/includes/lang.php'
38--- trunk/www/includes/lang.php 2010-08-09 18:56:53 +0000
39+++ trunk/www/includes/lang.php 2010-09-02 04:22:39 +0000
40@@ -3055,6 +3055,19 @@
41 'es' => "La URL ya existe",
42 ),
43
44+ 'bad_url' => array(
45+ 'en' => "Bad URL",
46+ 'fa' => "Bad URL",
47+ 'ru' => "Bad URL",
48+ 'uz' => "Bad URL",
49+ 'tk' => "Bad URL",
50+ 'cn' => "Bad URL",
51+ 'ar' => "Bad URL",
52+ 'vt' => "Bad URL",
53+ 'fr' => "Bad URL",
54+ 'es' => "Bad URL",
55+ ),
56+
57 'bookmark_added' => array(
58 'en' => "Link saved",
59 'fa' => " این لینک ذخیره شد",
60@@ -4538,6 +4551,19 @@
61 'es' => "Verify",
62 ),
63
64+ 'default_homepage' => array(
65+ 'en' => "Default Homepage",
66+ 'fa' => "Default Homepage",
67+ 'ru' => "Default Homepage",
68+ 'uz' => "Default Homepage",
69+ 'tk' => "Default Homepage",
70+ 'cn' => "Default Homepage",
71+ 'ar' => "Default Homepage",
72+ 'vt' => "Default Homepage",
73+ 'fr' => "Default Homepage",
74+ 'es' => "Default Homepage",
75+ ),
76+
77 'login_with_other_account' => array(
78 'en' => "Log in with other account",
79 'fa' => " با حساب دیگر وارده سا یفون شوید",
80
81=== modified file 'trunk/www/invite-m.php'
82--- trunk/www/invite-m.php 2010-07-14 18:35:25 +0000
83+++ trunk/www/invite-m.php 2010-09-02 04:22:39 +0000
84@@ -80,6 +80,20 @@
85 break;
86 }
87
88+ // Validate default homepage url
89+ $default_homepage_url = $_POST['default_homepage'];
90+ if ( ! $default_homepage_url ) {
91+ $processing_errors[] = msg('url_empty');
92+ break;
93+ }
94+
95+ if ( ! is_url($default_homepage_url) )
96+ {
97+ $default_homepage_url = '';
98+ $processing_errors[] = msg("bad_url");
99+ break;
100+ }
101+
102 // Validate the invitation count.
103
104 if ((count($addr_list) <= 0) || (count($addr_list) > $max_invite_count))
105@@ -139,19 +153,21 @@
106 // Insert a record into the invitation table.
107
108 $query=
109- "INSERT INTO invitation (date, proxy, pass, user, email, status, url, lang, grp) ".
110- "VALUES (UNIX_TIMESTAMP(), :proxy, :pass, :user, :email, -1, :url, :lang, :grp)";
111+ "INSERT INTO invitation (date, proxy, pass, user, email, status, url, lang, grp, homepage) ".
112+ "VALUES (UNIX_TIMESTAMP(), :proxy, :pass, :user, :email, -1, :url, :lang, :grp, :homepage)";
113 db_query_execute(
114 $config,
115 $query,
116 convert_null_array(array(
117- ":proxy" => $proxy,
118- ":pass" => $invite_code,
119- ":user" => $record_user['id'],
120- ":email" => $addr,
121- ":url" => $url,
122- ":lang" => $record_user['last_lang'],
123- ":grp" => $_POST['user_class'])));
124+ ":proxy" => $proxy,
125+ ":pass" => $invite_code,
126+ ":user" => $record_user['id'],
127+ ":email" => $addr,
128+ ":url" => $url,
129+ ":lang" => $record_user['last_lang'],
130+ ":grp" => $_POST['user_class'],
131+ ':homepage' => $default_homepage_url
132+ )));
133
134 // Get the id of the invitation table entry we just created.
135 $invitation_id = db_get_last_insert_id($config);
136@@ -264,6 +280,10 @@
137 <tr valign="top">
138 <th align="right"><?=sprintf(msg("emails"), $max_invite_count)?></th>
139 <td><textarea name="addr_list" cols="30" rows="20"><?=htmlentities($_POST['addr_list'], ENT_QUOTES, charset())?></textarea></td>
140+ </tr
141+ <tr valign="top">
142+ <th align="right"><?php echo msg("default_homepage"); ?></th>
143+ <td><input type="text" name="default_homepage" value="<?php echo htmlentities($default_homepage_url, ENT_QUOTES, charset())?>" /></td>
144 </tr>
145
146 <tr>
147
148=== modified file 'trunk/www/invite.php'
149--- trunk/www/invite.php 2010-07-16 19:31:33 +0000
150+++ trunk/www/invite.php 2010-09-02 04:22:39 +0000
151@@ -80,6 +80,20 @@
152 break;
153 }
154
155+ // Validate default homepage url
156+ $default_homepage_url = $_POST['default_homepage'];
157+ if ( ! $default_homepage_url ) {
158+ $processing_errors[] = msg('url_empty');
159+ break;
160+ }
161+
162+ if ( ! is_url($default_homepage_url) )
163+ {
164+ $default_homepage_url = '';
165+ $processing_errors[] = msg("bad_url");
166+ break;
167+ }
168+
169 // Create the invitations and put them into the DB.
170
171 $invite_codes = "";
172@@ -110,18 +124,20 @@
173 // Put the invitation into the DB.
174
175 $query=
176- "INSERT INTO invitation (date, proxy, pass, user, status, url, lang, grp) ".
177- "VALUES (UNIX_TIMESTAMP(), :proxy, :pass, :user, -1, :url, :lang, :grp)";
178+ "INSERT INTO invitation (date, proxy, pass, user, status, url, lang, grp, homepage) ".
179+ "VALUES (UNIX_TIMESTAMP(), :proxy, :pass, :user, -1, :url, :lang, :grp, :homepage)";
180 db_query_execute(
181 $config,
182 $query,
183 convert_null_array(array(
184- ":proxy" => $_POST['proxy'],
185- ":pass" => $invite_code,
186- ":user" => $record_user['id'],
187- ":url" => $invite_link,
188- ":lang" => $record_user['last_lang'],
189- ":grp" => $_POST['user_class'])));
190+ ":proxy" => $_POST['proxy'],
191+ ":pass" => $invite_code,
192+ ":user" => $record_user['id'],
193+ ":url" => $invite_link,
194+ ":lang" => $record_user['last_lang'],
195+ ":grp" => $_POST['user_class'],
196+ ':homepage' => $default_homepage_url
197+ )));
198
199 $invites_created++;
200 }
201@@ -205,6 +221,11 @@
202 </tr>
203
204 <tr>
205+ <th align="right"><?php echo msg("default_homepage"); ?></th>
206+ <td><input type="text" name="default_homepage" value="<?php echo htmlentities($default_homepage_url, ENT_QUOTES, charset())?>" /></td>
207+ </tr>
208+
209+ <tr>
210 <td><input type="hidden" name="invite" value="1"/></td>
211 <td><input type="submit" <?=($record_user['invite_token_count'] == "0" ? "disabled=true" : "")?> value="<?=msg("invite")?>"/></td>
212 </tr>

Subscribers

People subscribed via source and target branches