Merge lp:~edb/quam-plures/plugins_list_available into lp:quam-plures

Proposed by EdB
Status: Merged
Merged at revision: 7638
Proposed branch: lp:~edb/quam-plures/plugins_list_available
Merge into: lp:quam-plures
Diff against target: 222 lines (+76/-105)
1 file modified
qp_inc/plugins/views/_plugin_list_available.view.php (+76/-105)
To merge this branch: bzr merge lp:~edb/quam-plures/plugins_list_available
Reviewer Review Type Date Requested Status
Tilman Blumenbach (community) Approve
EdB Needs Resubmitting
Review via email: mp+73260@code.launchpad.net

Description of the change

http://forums.quamplures.net/viewtopic.php?f=6&t=900

4) On the "add a plugin" page it says "Plugins available for installation" then lists ALL plugins even if they can not have another installation. I think we should make that page do what it says, and list only the plugins that can be installed.

There is a cosmetic issue due to I did not remove creating table sections for sub-groups, which I did not do because sub-groups are going away in another branch.

To post a comment you must log in.
Revision history for this message
Tilman Blumenbach (tblue) wrote :

- In diff line 51, you removed the $current_sub_group assignment. This causes empty sub-group headers to appear.
- In diff line 105, you accidentally commented out a call to $Table->display_col_end(), not closing the Description column (the browser works around this and renders the table correctly, but it's ugly code).
- Looks like you broke the code which _can_ display the available events of a plugin (diff lines 101-104), but that code is commented out anyway, so that's not a real issue.
- It should be possible to remove the second call to $admin_Plugins->count_regs() in diff line 135 as that method is already being called in diff line 39 now.
- You removed the note explaining where to upload new plugins (diff ll. 221). I'm not sure this is a good idea...

review: Needs Fixing
Revision history for this message
EdB (edb) wrote :

going through emails, thought I'd pause at this one for a quick answer. The last bit - the "where to get new plugins" is completely inaccurate. It might be a nice idea, but until there is an actual place with actual plugins it makes no sense to create a link there.

I'll go back to reading stuff though, and trying to get the truck to run, and then get into all the nice feedback you're providing!

7620. By EdB

core to 7620

Revision history for this message
EdB (edb) wrote :

This one is next but I'm very tired. Anyway lemme see... The "no subgroup" branch will cure the issue of phantom subgroups. I commented on that as a cosmetic issue and don't see any reason to fix something that will cure itself.

Not closing a table is bad so needs fixing for sure.

I thought about removing the bit that doesn't display the available events but figured it didn't hurt to have it in there, so I'll make that be right even though it is commented out.

I'll have to look at the count_regs() thing. I know it is duplicated but I'm pretty sure I had a fairly good reason. Like an issue during development that made me use the same code to reach the same conclusion, but since it is needs fixing it doesn't matter that much.

No interest in the dead end link. I guess I could restore it and comment it out so one day it is easily restored, but it goes to nothing so why bother?

review: Needs Fixing
Revision history for this message
Tilman Blumenbach (tblue) wrote :

> I commented on that as a cosmetic issue and don't see any reason to fix something that will cure itself.

Point taken! :)

> I'll have to look at the count_regs() thing. I know it is duplicated but I'm pretty sure I had a fairly good reason.

Okay, I didn't actually try to remove it, I just saw that it was duplicated.

> No interest in the dead end link.

Yes, the link may be wrong and should be removed, but isn't the "drop plugins into that directory" bit still helpful? I guess we could remove it and explain plugin installation in the to-be-written documentation, though.

7621. By EdB

fixed broken table issue, fixed broken and commented out code

7622. By EdB

core to 7624

Revision history for this message
EdB (edb) wrote :

I am adding core updates AND retesting everything I have in merge just to be sure, but it is taking a long time due to many conflicts this time around. Will send another comment when I got them back up to speed.

7623. By EdB

core to 7628

7624. By EdB

got rid of second "something->count( something else )" line that tblue pointed out wasn't needed

Revision history for this message
EdB (edb) wrote :

Okay cool. I can copy/paste many times, and I got rid of the second whatever it was line that didn't need to be there. Also made sure it didn't break the new "multiple instances" feature we got in there.

good to go :)

OT: I think it is Lee's turn to do a bunch of core merging.

Revision history for this message
EdB (edb) wrote :

oops

review: Needs Resubmitting
Revision history for this message
Tilman Blumenbach (tblue) wrote :

Looks better now, BUT:

- The "[Install]" link now looks like this: "[ Install]" (note the added space at the beginning). This is because in diff line 146, there now is a newline after the opening <a> tag and before the <?php bit. If you make it look like this:

  [<a href="<?php echo $dispatcher ?>?ctrl=plugins&amp;action=install&amp;plugin=<?php echo rawurlencode($loop_Plugin->classname) ?>"><?php

then the Install link should look good again. :-)

- I just noticed that because we now check the user's perms and whether a plugin can be installed at the beginning of the big while loop, the old check on diff ll. 141 is redundant and could be removed.

review: Needs Fixing
Revision history for this message
EdB (edb) wrote :

Fixed, but not the way you think. It seems silly to exit PHP just to go back into it 3 times in the next line. So now we don't drop out of PHP just to do a few characters :) Unfortunately there are many cases where we do that. One less now, but only one less.

7625. By EdB

fix stray space between [ and the word Install

Revision history for this message
Tilman Blumenbach (tblue) wrote :

Okay, looks fine. :)

Could you look into removing the second check I mentioned above? It doesn't hurt, but it's just not necessary. Removing it is easy as well.

review: Approve
7626. By EdB

removing redundant permissions check

Revision history for this message
EdB (edb) wrote :

done

Revision history for this message
Tilman Blumenbach (tblue) wrote :

Well, all good then!

review: Approve
Revision history for this message
Tilman Blumenbach (tblue) wrote :

...nope.

Parse error: syntax error, unexpected T_BOOLEAN_OR, expecting ',' or ')' in /home/tilman/public_html/quamplures/trunk/qp_inc/plugins/views/_plugin_list_available.view.php on line 171

It's a incorrectly placed brace.

review: Needs Fixing
Revision history for this message
Tilman Blumenbach (tblue) wrote :

By the way, you can just remove the whole if statement. Everything that it checks is already being checked above, just after the while loop begins.

7627. By EdB

fixed flawed code by removing redundant check, removed commented out code because it has no value

Revision history for this message
EdB (edb) wrote :

HOPEFULLY this is the last time it gets fixed

review: Needs Resubmitting
Revision history for this message
Tilman Blumenbach (tblue) wrote :

Okay, I'm SO sorry it's still broken. And it's not just me saying that because there's some code I don't like, it's because I'm getting a Red Page of Death when trying to install a plugin (with a SQL error).

Diff line 195:

  echo '[<a href='.$dispatcher.'?ctrl=plugins&amp;action=install&amp;plugin='.rawurlencode($loop_Plugin->classname).'">'.

There's a missing double quote right after href= (which should be href="), causing the browser to think I want to install a plugin with the classname <whatever>" (with a trailing double quote).

Actually, this shows that we have a big fat SQL injection vulnerability in Plugins_admin::install() because the double quote should be escaped and not cause an SQL error! Anyway, not in the scope of this branch. Just fix the missing double quote and in the meanwhile, I will report a new bug.

Once you have fixed the missing quote, everything should FINALLY be okay. Sigh.

review: Needs Fixing
7628. By EdB

fuckit

Revision history for this message
EdB (edb) wrote :

I'm tired of this. Either you're happy or I'm gonna undo all the bullshit until it is where it was when I knew it was 100% fully operational and did not cause any errors.

Removing "extra" checks is fucking bullshit coming from someone willing to bloat a style sheet with useless comments.

Fuckit.

review: Needs Resubmitting
Revision history for this message
Tilman Blumenbach (tblue) wrote :

All good now.

review: Approve
Revision history for this message
Tilman Blumenbach (tblue) wrote :

Does somebody else want to review this one? I usually merge branches after they have been approved by at least two reviewers.

7629. By EdB

matches core 7632 after conflict resolution

Revision history for this message
Lee Turner (leeturner) wrote :

This one is next on my list

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'qp_inc/plugins/views/_plugin_list_available.view.php'
2--- qp_inc/plugins/views/_plugin_list_available.view.php 2011-09-04 22:27:27 +0000
3+++ qp_inc/plugins/views/_plugin_list_available.view.php 2011-09-13 21:46:49 +0000
4@@ -40,27 +40,19 @@
5 * @var Plugins
6 */
7 global $admin_Plugins;
8-
9 global $dispatcher;
10
11 $Table = new Table();
12-
13 $Table->title = T_('Plugins available for installation');
14-
15 $Table->global_icon( T_('Cancel install!'), 'close', regenerate_url(), T_('Cancel'), 3, 4 );
16-
17 $Table->cols = array(
18- array( 'th' => T_('Plugin') ),
19- array( 'th' => T_('Description') ),
20- array( 'th' => T_('Version') ),
21- array( 'th' => T_('Help'),
22- 'td_class' => 'nowrap' ),
23- array( 'th' => T_('Actions'),
24- 'td_class' => 'nowrap' ),
25- );
26-
27+ array( 'th' => T_('Plugin') ),
28+ array( 'th' => T_('Description') ),
29+ array( 'th' => T_('Version') ),
30+ array( 'th' => T_('Help'), 'td_class' => 'nowrap' ),
31+ array( 'th' => T_('Actions'), 'td_class' => 'nowrap' ),
32+);
33 $Table->display_init();
34-
35 $Table->display_list_start();
36
37 // TITLE / COLUMN HEADERS:
38@@ -85,91 +77,85 @@
39
40 while( $loop_Plugin = & $AvailablePlugins->get_next() )
41 {
42+ // first thing is to exclude any plugin that has reached it's $number_of_installs limit
43+ list( $registrations, $seq_number ) = $admin_Plugins->count_regs( $loop_Plugin->classname, true );
44+ if( ! ( $current_User->check_perm( 'options', 'edit', false )
45+ && ( ! isset( $loop_Plugin->number_of_installs )
46+ || $registrations < $loop_Plugin->number_of_installs ) ) )
47+ { // plugin not available for installation by this user
48+ continue;
49+ }
50
51+ // create a plugin group heading
52 if( $loop_Plugin->group !== $current_group && $number_of_groups )
53 { // Reason why $current_group is false
54 $current_group = $loop_Plugin->group;
55 ?>
56- <tr class="group">
57- <td colspan="5" class="first"><?php
58- if( $current_group == '' || $current_group == 'Un-Grouped' )
59- {
60- echo T_('Un-Classified');
61- }
62- else
63- {
64- echo $current_group;
65- }
66- ?></td>
67- </tr>
68+ <tr class="group"><td colspan="5" class="first">
69+ <?php
70+ if( $current_group == '' || $current_group == 'Un-Grouped' )
71+ {
72+ echo T_('Un-Classified');
73+ }
74+ else
75+ {
76+ echo $current_group;
77+ }
78+ ?>
79+ </td></tr>
80 <?php
81 }
82
83 $Table->display_line_start();
84
85- $Table->display_col_start();
86- ?>
87- <strong><a title="<?php echo T_('Display info') ?>" href="<?php echo regenerate_url( 'action,plugin_class', 'action=info&amp;plugin_class='.$loop_Plugin->classname) ?>">
88- <?php echo format_to_output($loop_Plugin->name); ?></a></strong>
89- <?php
90- $Table->display_col_end();
91-
92- $Table->display_col_start();
93- echo format_to_output($loop_Plugin->short_desc);
94- /*
95- // Available events:
96- $registered_events = implode( ', ', $AvailablePlugins->get_registered_events( $loop_Plugin ) );
97- if( empty($registered_events) )
98- {
99- $registered_events = '-';
100- }
101- echo '<span class="advanced_info notes"><br />'.T_('Registered events:').' '.$registered_events.'</span>';
102- */
103- $Table->display_col_end();
104-
105- $Table->display_col_start();
106- $clean_version = preg_replace( array('~^(CVS\s+)?\$'.'Revision:\s*~i', '~\s*\$$~'), '', $loop_Plugin->version );
107-
108- echo format_to_output($clean_version);
109- $Table->display_col_end();
110-
111- // HELP COL:
112- $Table->display_col_start();
113- echo action_icon( T_('Display info'), 'info', regenerate_url( 'action,plugin_class', 'action=info&amp;plugin_class='.$loop_Plugin->classname ) );
114- // Help icons, if available:
115- $help_icons = array();
116- if( $help_external = $loop_Plugin->get_help_link() )
117- {
118- $help_icons[] = $help_external;
119- }
120- if( $help_internal = $loop_Plugin->get_help_link('$readme') )
121- {
122- $help_icons[] = $help_internal;
123- }
124- if( ! empty($help_icons) )
125- {
126- echo ' '.implode( ' ', $help_icons );
127- }
128- $Table->display_col_end();
129-
130- $Table->display_col_start();
131- list( $registrations, $seq_number ) = $admin_Plugins->count_regs( $loop_Plugin->classname, true );
132-
133- if( $current_User->check_perm( 'options', 'edit', false )
134- && ( ! isset( $loop_Plugin->number_of_installs )
135- || $registrations < $loop_Plugin->number_of_installs ) )
136- { // number of installations are not limited or not reached yet and user has "edit options" perms
137- ?>
138- [<a href="<?php echo $dispatcher ?>?ctrl=plugins&amp;action=install&amp;plugin=<?php echo rawurlencode($loop_Plugin->classname) ?>"><?php
139- echo T_('Install');
140- if( $seq_number > 1 )
141- { // This plugin is already installed
142- echo ' #', $seq_number;
143- }
144- ?></a>]
145- <?php
146- }
147- $Table->display_col_end();
148+ // the "Plugin" column
149+ $Table->display_col_start();
150+ ?>
151+ <strong><a title="<?php echo T_('Display info') ?>" href="<?php echo regenerate_url( 'action,plugin_class', 'action=info&amp;plugin_class='.$loop_Plugin->classname) ?>">
152+ <?php echo format_to_output($loop_Plugin->name); ?></a></strong>
153+ <?php
154+ $Table->display_col_end();
155+
156+ // the "Description" column
157+ $Table->display_col_start();
158+ echo format_to_output($loop_Plugin->short_desc);
159+ $Table->display_col_end();
160+
161+ // the "Version" column
162+ $Table->display_col_start();
163+ $clean_version = preg_replace( array('~^(CVS\s+)?\$'.'Revision:\s*~i', '~\s*\$$~'), '', $loop_Plugin->version );
164+ echo format_to_output($clean_version);
165+ $Table->display_col_end();
166+
167+ // the "Help" column
168+ $Table->display_col_start();
169+ echo action_icon( T_('Display info'), 'info', regenerate_url( 'action,plugin_class', 'action=info&amp;plugin_class='.$loop_Plugin->classname ) );
170+ // Help icons, if available:
171+ $help_icons = array();
172+ if( $help_external = $loop_Plugin->get_help_link() )
173+ {
174+ $help_icons[] = $help_external;
175+ }
176+ if( $help_internal = $loop_Plugin->get_help_link('$readme') )
177+ {
178+ $help_icons[] = $help_internal;
179+ }
180+ if( ! empty($help_icons) )
181+ {
182+ echo ' '.implode( ' ', $help_icons );
183+ }
184+ $Table->display_col_end();
185+
186+ // the "Actions" column
187+ $Table->display_col_start();
188+ echo '[<a href="'.$dispatcher.'?ctrl=plugins&amp;action=install&amp;plugin='.rawurlencode($loop_Plugin->classname).'">'.
189+ T_('Install');
190+ if( $seq_number > 1 )
191+ { // This plugin is already installed
192+ echo ' #'.$seq_number;
193+ }
194+ echo '</a>]';
195+ $Table->display_col_end();
196
197 $Table->display_line_end();
198
199@@ -181,21 +167,6 @@
200 // BODY END:
201 $Table->display_body_end();
202
203-
204 $Table->display_list_end();
205
206-
207-// Note about how to make plugins available for installation.
208-// It should make clear that the above list are not all available plugins (e.g. through an online channel)!
209-global $plugins_path, $app_homepage;
210-echo '<p>';
211-echo T_('The above plugins are those already installed into your "plugins" directory.');
212-echo "</p>\n<p>";
213-printf( T_('You can find more plugins online at %s or other channels.'), '<a href="'.$app_homepage.'">'.$app_homepage.'</a>');
214-echo "</p>\n<p>";
215-printf( T_('To make a plugin available for installation, extract it into the "%s" directory on the server.'),
216- rel_path_to_base($plugins_path) );
217-echo '</p>';
218-
219-
220-?>
221\ No newline at end of file
222+?>

Subscribers

People subscribed via source and target branches