Skip to content

Commit 7454764

Browse files
committed
Use more obvious name for the tag filter
1 parent a54740c commit 7454764

File tree

1 file changed

+9
-9
lines changed

1 file changed

+9
-9
lines changed

public/index.php

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
$per_page = 25;
33
$show_ua = @preg_replace('/[^10]/', '', $_GET['ua']) ?: '0';
44
$search = @preg_replace('/[^-a-zA-Z0-9 ]/', '', $_GET['search']);
5-
$filter = @preg_replace('/[^-a-zA-Z0-9_]/', '', $_GET['filter']);
5+
$filter_tag = strtolower(@preg_replace('/[^-a-zA-Z0-9_]/', '', $_GET['filter_tag']));
66
if(isset($_GET['p'])){
77
$page = @preg_replace('/[^0-9]/', '', $_GET['p']);
88
}else{
@@ -48,7 +48,7 @@
4848
if($cog['rx_category'] == 'unapproved' && $show_ua !== "1"){ continue; }
4949
if(count($cog['author']) == 0){ continue; } # ghost entries
5050
foreach($cog['tags'] as $index => $this_tag){$cog['tags'][$index] = strtolower($this_tag);}
51-
if($filter && !in_array(strtolower($filter), $cog['tags'])){ continue; }
51+
if($filter_tag && !in_array($filter_tag, $cog['tags'])){ continue; }
5252
if($search){
5353
$matched = FALSE;
5454
if(stripos(strtolower($cog['id']), strtolower($search)) !== false){ $matched = TRUE; } else
@@ -95,9 +95,9 @@ function byName($a,$b){ return ($a['id'] <= $b['id']) ? -1 : 1;}
9595
<svg class="icon" viewBox="0 0 20 20">
9696
<path d="M12.323,2.398c-0.741-0.312-1.523-0.472-2.319-0.472c-2.394,0-4.544,1.423-5.476,3.625C3.907,7.013,3.896,8.629,4.49,10.102c0.528,1.304,1.494,2.333,2.72,2.99L5.467,17.33c-0.113,0.273,0.018,0.59,0.292,0.703c0.068,0.027,0.137,0.041,0.206,0.041c0.211,0,0.412-0.127,0.498-0.334l1.74-4.23c0.583,0.186,1.18,0.309,1.795,0.309c2.394,0,4.544-1.424,5.478-3.629C16.755,7.173,15.342,3.68,12.323,2.398z M14.488,9.77c-0.769,1.807-2.529,2.975-4.49,2.975c-0.651,0-1.291-0.131-1.897-0.387c-0.002-0.004-0.002-0.004-0.002-0.004c-0.003,0-0.003,0-0.003,0s0,0,0,0c-1.195-0.508-2.121-1.452-2.607-2.656c-0.489-1.205-0.477-2.53,0.03-3.727c0.764-1.805,2.525-2.969,4.487-2.969c0.651,0,1.292,0.129,1.898,0.386C14.374,4.438,15.533,7.3,14.488,9.77z"></path>
9797
</svg>
98-
<input type="text" name="search" placeholder="Search <?php print(count($cogs)); if($filter){print(' ' . $filter);}?> cogs..." value="<?php print($search);?>" />
98+
<input type="text" name="search" placeholder="Search <?php print(count($cogs)); if($filter_tag){print(' ' . $filter_tag);}?> cogs..." value="<?php print($search);?>" />
9999
<input type="hidden" name="ua" value="<?php print($show_ua); ?>" />
100-
<input type="hidden" name="filter" value="<?php print($filter); ?>" />
100+
<input type="hidden" name="filter_tag" value="<?php print($filter_tag); ?>" />
101101
<button class="submit">
102102
<svg class="icon" viewBox="0 0 20 20">
103103
<path d="M14.989,9.491L6.071,0.537C5.78,0.246,5.308,0.244,5.017,0.535c-0.294,0.29-0.294,0.763-0.003,1.054l8.394,8.428L5.014,18.41c-0.291,0.291-0.291,0.763,0,1.054c0.146,0.146,0.335,0.218,0.527,0.218c0.19,0,0.382-0.073,0.527-0.218l8.918-8.919C15.277,10.254,15.277,9.784,14.989,9.491z"></path>
@@ -109,7 +109,7 @@ function byName($a,$b){ return ($a['id'] <= $b['id']) ? -1 : 1;}
109109
<div class="ua-warning">The content of unapproved repositories has not been vetted by QA<br>Safety is not guaranteed. Use at your own risk</div>
110110
<?php } ?>
111111
<div class="filters">
112-
<box <?php if($show_ua === '1'){?>href="?filter=<?php print($filter);?>&search=<?php print($search); ?>&ua=0"<?php }else{?>show-model="uadisclaim"<?php } ?>><svg class="icon" viewBox="0 0 20 20">
112+
<box <?php if($show_ua === '1'){?>href="?filter_tag=<?php print($filter_tag);?>&search=<?php print($search); ?>&ua=0"<?php }else{?>show-model="uadisclaim"<?php } ?>><svg class="icon" viewBox="0 0 20 20">
113113
<?php if($show_ua === '1'){ ?>
114114
<path fill-rule="evenodd" d="M2 0a2 2 0 0 0-2 2v12a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V2a2 2 0 0 0-2-2H2zm10.03 4.97a.75.75 0 0 0-1.08.022L7.477 9.417 5.384 7.323a.75.75 0 0 0-1.06 1.06L6.97 11.03a.75.75 0 0 0 1.079-.02l3.992-4.99a.75.75 0 0 0-.01-1.05z"></path>
115115
<?php }else{ ?>
@@ -122,7 +122,7 @@ function byName($a,$b){ return ($a['id'] <= $b['id']) ? -1 : 1;}
122122
<h><svg class="icon" viewBox="0 0 20 23">
123123
<path d="M18.344,16.174l-7.98-12.856c-0.172-0.288-0.586-0.288-0.758,0L1.627,16.217c0.339-0.543-0.603,0.668,0.384,0.682h15.991C18.893,16.891,18.167,15.961,18.344,16.174 M2.789,16.008l7.196-11.6l7.224,11.6H2.789z M10.455,7.552v3.561c0,0.244-0.199,0.445-0.443,0.445s-0.443-0.201-0.443-0.445V7.552c0-0.245,0.199-0.445,0.443-0.445S10.455,7.307,10.455,7.552M10.012,12.439c-0.733,0-1.33,0.6-1.33,1.336s0.597,1.336,1.33,1.336c0.734,0,1.33-0.6,1.33-1.336S10.746,12.439,10.012,12.439M10.012,14.221c-0.244,0-0.443-0.199-0.443-0.445c0-0.244,0.199-0.445,0.443-0.445s0.443,0.201,0.443,0.445C10.455,14.021,10.256,14.221,10.012,14.221"></path></svg>Warning: Use at your own risk!</h>
124124
<t>Unapproved repositories are provided by the community and have not yet been inspected for security or tested for stability. The Cog-Creators organization and Red's contributors are not responsible for any damage caused by 3rd party cogs.</t>
125-
<f><button hide-model="true">Nevermind</button><button class="right red" href="?filter=<?php print($filter);?>&search=<?php print($search); ?>&ua=1">I understand and accept the risks</button></f>
125+
<f><button hide-model="true">Nevermind</button><button class="right red" href="?filter_tag=<?php print($filter_tag);?>&search=<?php print($search); ?>&ua=1">I understand and accept the risks</button></f>
126126
</div>
127127
<?php if(!isset($cog_chunks[$page - 1])){ ?>
128128
<div>
@@ -148,12 +148,12 @@ function byName($a,$b){ return ($a['id'] <= $b['id']) ? -1 : 1;}
148148
<t><svg class="icon" viewBox="0 0 16 19">
149149
<path fill-rule="evenodd" d="M0 6a2 2 0 0 1 2-2h12a2 2 0 0 1 2 2v5a2 2 0 0 1-2 2H2a2 2 0 0 1-2-2V6zm13 .25a.25.25 0 0 1 .25-.25h.5a.25.25 0 0 1 .25.25v.5a.25.25 0 0 1-.25.25h-.5a.25.25 0 0 1-.25-.25v-.5zM2.25 8a.25.25 0 0 0-.25.25v.5c0 .138.112.25.25.25h.5A.25.25 0 0 0 3 8.75v-.5A.25.25 0 0 0 2.75 8h-.5zM4 8.25A.25.25 0 0 1 4.25 8h.5a.25.25 0 0 1 .25.25v.5a.25.25 0 0 1-.25.25h-.5A.25.25 0 0 1 4 8.75v-.5zM6.25 8a.25.25 0 0 0-.25.25v.5c0 .138.112.25.25.25h.5A.25.25 0 0 0 7 8.75v-.5A.25.25 0 0 0 6.75 8h-.5zM8 8.25A.25.25 0 0 1 8.25 8h.5a.25.25 0 0 1 .25.25v.5a.25.25 0 0 1-.25.25h-.5A.25.25 0 0 1 8 8.75v-.5zM13.25 8a.25.25 0 0 0-.25.25v.5c0 .138.112.25.25.25h.5a.25.25 0 0 0 .25-.25v-.5a.25.25 0 0 0-.25-.25h-.5zm0 2a.25.25 0 0 0-.25.25v.5c0 .138.112.25.25.25h.5a.25.25 0 0 0 .25-.25v-.5a.25.25 0 0 0-.25-.25h-.5zm-3-2a.25.25 0 0 0-.25.25v.5c0 .138.112.25.25.25h1.5a.25.25 0 0 0 .25-.25v-.5a.25.25 0 0 0-.25-.25h-1.5zm.75 2.25a.25.25 0 0 1 .25-.25h.5a.25.25 0 0 1 .25.25v.5a.25.25 0 0 1-.25.25h-.5a.25.25 0 0 1-.25-.25v-.5zM11.25 6a.25.25 0 0 0-.25.25v.5c0 .138.112.25.25.25h.5a.25.25 0 0 0 .25-.25v-.5a.25.25 0 0 0-.25-.25h-.5zM9 6.25A.25.25 0 0 1 9.25 6h.5a.25.25 0 0 1 .25.25v.5a.25.25 0 0 1-.25.25h-.5A.25.25 0 0 1 9 6.75v-.5zM7.25 6a.25.25 0 0 0-.25.25v.5c0 .138.112.25.25.25h.5A.25.25 0 0 0 8 6.75v-.5A.25.25 0 0 0 7.75 6h-.5zM5 6.25A.25.25 0 0 1 5.25 6h.5a.25.25 0 0 1 .25.25v.5a.25.25 0 0 1-.25.25h-.5A.25.25 0 0 1 5 6.75v-.5zM2.25 6a.25.25 0 0 0-.25.25v.5c0 .138.112.25.25.25h1.5A.25.25 0 0 0 4 6.75v-.5A.25.25 0 0 0 3.75 6h-1.5zM2 10.25a.25.25 0 0 1 .25-.25h.5a.25.25 0 0 1 .25.25v.5a.25.25 0 0 1-.25.25h-.5a.25.25 0 0 1-.25-.25v-.5zM4.25 10a.25.25 0 0 0-.25.25v.5c0 .138.112.25.25.25h5.5a.25.25 0 0 0 .25-.25v-.5a.25.25 0 0 0-.25-.25h-5.5z"></path>
150150
</svg><b>Installation commands</b><l>repo add <?php print(strtolower($cog['source_name'])); ?> <?php print($cog['source']);?> <?php print($cog['rx_branch']);?></l><l>cog install <?php print(strtolower($cog['source_name'])); ?> <?php print($cog['id']); ?></l></t>
151-
<f><?php sort($cog['tags']);foreach($cog['tags'] as $tag){?><tag href="?filter=<?php print($tag); ?>&search=<?php print($search); ?>&ua=<?php print($show_ua); ?>"><?php print($tag); ?></tag><?php }?><a class="src-link" href="<?php print($cog['source']);?>">View Repository</a></f>
151+
<f><?php sort($cog['tags']);foreach($cog['tags'] as $tag){?><tag href="?filter_tag=<?php print($tag); ?>&search=<?php print($search); ?>&ua=<?php print($show_ua); ?>"><?php print($tag); ?></tag><?php }?><a class="src-link" href="<?php print($cog['source']);?>">View Repository</a></f>
152152
</div>
153153
<?php }} ?>
154154
</div>
155155
<div class="nav bottom">
156-
<a class="left <?php if($page <= 1){?>hidden<?php }?>" href="?p=<?php print($page - 1);?>&filter=<?php print($filter);?>&search=<?php print($search); ?>&ua=<?php print($show_ua);?>">
156+
<a class="left <?php if($page <= 1){?>hidden<?php }?>" href="?p=<?php print($page - 1);?>&filter_tag=<?php print($filter_tag);?>&search=<?php print($search); ?>&ua=<?php print($show_ua);?>">
157157
<svg class="icon" viewBox="0 0 20 20">
158158
<path d="M18.271,9.212H3.615l4.184-4.184c0.306-0.306,0.306-0.801,0-1.107c-0.306-0.306-0.801-0.306-1.107,0
159159
L1.21,9.403C1.194,9.417,1.174,9.421,1.158,9.437c-0.181,0.181-0.242,0.425-0.209,0.66c0.005,0.038,0.012,0.071,0.022,0.109
@@ -167,7 +167,7 @@ function byName($a,$b){ return ($a['id'] <= $b['id']) ? -1 : 1;}
167167
<page>Page <?php print($page);?> of <?php print(count($cog_chunks)); ?></page>
168168
<?php } ?>
169169

170-
<a class="right <?php if(count($cog_chunks) <= $page){?>hidden<?php }?>" href="?p=<?php print($page + 1);?>&filter=<?php print($filter);?>&search=<?php print($search); ?>&ua=<?php print($show_ua);?>">
170+
<a class="right <?php if(count($cog_chunks) <= $page){?>hidden<?php }?>" href="?p=<?php print($page + 1);?>&filter_tag=<?php print($filter_tag);?>&search=<?php print($search); ?>&ua=<?php print($show_ua);?>">
171171
Next
172172
<svg class="icon" viewBox="0 0 20 20">
173173
<path d="M1.729,9.212h14.656l-4.184-4.184c-0.307-0.306-0.307-0.801,0-1.107c0.305-0.306,0.801-0.306,1.106,0

0 commit comments

Comments
 (0)