mirror of
https://github.com/e107inc/e107.git
synced 2025-07-31 03:40:37 +02:00
Added ability to sort category list page by number of requests
Added ability to sort mirror sites randomly (as now) by ID or by name Fixed alignment bug in admin options page
This commit is contained in:
@@ -11,8 +11,8 @@
|
||||
| GNU General Public License (http://gnu.org).
|
||||
|
|
||||
| $Source: /cvs_backup/e107_0.8/e107_plugins/download/download.php,v $
|
||||
| $Revision: 1.3 $
|
||||
| $Date: 2009-01-13 08:05:08 $
|
||||
| $Revision: 1.4 $
|
||||
| $Date: 2009-01-14 22:53:38 $
|
||||
| $Author: bugrain $
|
||||
|
|
||||
+----------------------------------------------------------------------------+
|
||||
@@ -57,7 +57,7 @@ $template_load_core = '
|
||||
}
|
||||
';
|
||||
|
||||
$order_options = array('download_id','download_datestamp','download_requested','download_name','download_author');
|
||||
$order_options = array('download_id','download_datestamp','download_requested','download_name','download_author','download_requested');
|
||||
$sort_options = array('ASC', 'DESC');
|
||||
|
||||
|
||||
@@ -567,15 +567,26 @@ if($action == "mirror")
|
||||
|
||||
extract($row);
|
||||
$array = explode(chr(1), $download_mirror);
|
||||
|
||||
// Shuffle the mirror list into a random order
|
||||
$c = count($array) -1; // Will always be an empty entry at the end
|
||||
for ($i=1; $i<$c; $i++)
|
||||
{
|
||||
$d = mt_rand(0, $i);
|
||||
$tmp = $array[$i];
|
||||
$array[$i] = $array[$d];
|
||||
$array[$d] = $tmp;
|
||||
if (2 == varset($pref['mirror_order']))
|
||||
{
|
||||
// Order by name, sort array manually
|
||||
usort($array, "sort_download_mirror_order");
|
||||
}
|
||||
//elseif (1 == varset($pref['mirror_order']))
|
||||
//{
|
||||
// // Order by ID - do nothing order is as stored in DB
|
||||
//}
|
||||
elseif (0 == varset($pref['mirror_order'], 0))
|
||||
{
|
||||
// Shuffle the mirror list into a random order
|
||||
$c = count($array);
|
||||
for ($i=1; $i<$c; $i++)
|
||||
{
|
||||
$d = mt_rand(0, $i);
|
||||
$tmp = $array[$i];
|
||||
$array[$i] = $array[$d];
|
||||
$array[$d] = $tmp;
|
||||
}
|
||||
}
|
||||
|
||||
$download_mirror = "";
|
||||
@@ -608,6 +619,16 @@ if($action == "mirror")
|
||||
}
|
||||
}
|
||||
|
||||
function sort_download_mirror_order($a, $b)
|
||||
{
|
||||
$a = explode(",", $a);
|
||||
$b = explode(",", $b);
|
||||
if ($a[1] == $b[1]) {
|
||||
return 0;
|
||||
}
|
||||
return ($a[1] < $b[1]) ? -1 : 1;
|
||||
}
|
||||
|
||||
function parse_download_mirror_table($row, $mirrorstring, $mirrorList)
|
||||
{
|
||||
|
||||
|
@@ -11,8 +11,8 @@
|
||||
| GNU General Public License (http://gnu.org).
|
||||
|
|
||||
| $Source: /cvs_backup/e107_0.8/e107_plugins/download/download_admin.php,v $
|
||||
| $Revision: 1.2 $
|
||||
| $Date: 2009-01-13 00:43:54 $
|
||||
| $Revision: 1.3 $
|
||||
| $Date: 2009-01-14 22:53:38 $
|
||||
| $Author: bugrain $
|
||||
+----------------------------------------------------------------------------+
|
||||
*/
|
||||
@@ -167,6 +167,7 @@ if (isset($_POST['updateoptions']))
|
||||
$temp['download_view'] = $_POST['download_view'];
|
||||
$temp['download_sort'] = $_POST['download_sort'];
|
||||
$temp['download_order'] = $_POST['download_order'];
|
||||
$temp['mirror_order'] = $_POST['mirror_order'];
|
||||
$temp['agree_flag'] = $_POST['agree_flag'];
|
||||
$temp['download_email'] = $_POST['download_email'];
|
||||
$temp['agree_text'] = $tp->toDB($_POST['agree_text']);
|
||||
@@ -389,12 +390,23 @@ if ($action == "opt")
|
||||
<tr><td class='forumheader3'>
|
||||
".LAN_ORDER."
|
||||
</td>
|
||||
<td class='forumheader3' text-align:left'>
|
||||
<td class='forumheader3' style='text-align:left'>
|
||||
<select name='download_sort' class='tbox'>". ($pref['download_sort'] == "ASC" ? "<option value='ASC' selected='selected'>".DOWLAN_62."</option>" : "<option value='ASC'>".DOWLAN_62."</option>"). ($pref['download_sort'] == "DESC" ? "<option value='DESC' selected='selected'>".DOWLAN_63."</option>" : "<option value='DESC'>".DOWLAN_63."</option>")."
|
||||
</select>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td class='forumheader3'>".DOWLAN_160."</td>
|
||||
<td class='forumheader3' style='text-align:left'>
|
||||
<select name='mirror_order' class='tbox'>".
|
||||
($pref['mirror_order'] == "0" ? "<option value='0' selected='selected'>".DOWLAN_161."</option>" : "<option value='0'>".DOWLAN_161."</option>").
|
||||
($pref['mirror_order'] == "1" ? "<option value='1' selected='selected'>".DOWLAN_162."</option>" : "<option value='1'>".DOWLAN_162."</option>").
|
||||
($pref['mirror_order'] == "2" ? "<option value='2' selected='selected'>".DOWLAN_163."</option>" : "<option value='2'>".DOWLAN_163."</option>")."
|
||||
</select>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td class='forumheader3'>".DOWLAN_151."</td>
|
||||
<td class='forumheader3' style='text-align:left'>". r_userclass("download_reportbroken", $pref['download_reportbroken'])."</td>
|
||||
|
@@ -4,8 +4,8 @@
|
||||
| e107 website system - Language File.
|
||||
|
|
||||
| $Source: /cvs_backup/e107_0.8/e107_plugins/download/languages/English/lan_download_admin.php,v $
|
||||
| $Revision: 1.2 $
|
||||
| $Date: 2009-01-13 00:46:23 $
|
||||
| $Revision: 1.3 $
|
||||
| $Date: 2009-01-14 22:53:38 $
|
||||
| $Author: bugrain $
|
||||
+----------------------------------------------------------------------------+
|
||||
*/
|
||||
@@ -146,4 +146,9 @@ define("DOWLAN_157", "use random mirror - no user choice");
|
||||
define("DOWLAN_158", "Show sub-sub-categories on main download page");
|
||||
define("DOWLAN_159", "Include sub-sub-category counts in subcategory counts");
|
||||
|
||||
define("DOWLAN_160", "Mirror list order");
|
||||
define("DOWLAN_161", "Random");
|
||||
define("DOWLAN_162", "ID");
|
||||
define("DOWLAN_163", "Name");
|
||||
|
||||
?>
|
@@ -1,5 +1,5 @@
|
||||
<?xml version="1.0" encoding="iso-8859-1"?>
|
||||
<!-- $Id: plugin.xml,v 1.2 2009-01-13 00:37:25 bugrain Exp $ -->
|
||||
<!-- $Id: plugin.xml,v 1.3 2009-01-14 22:53:38 bugrain Exp $ -->
|
||||
<e107Plugin name="Download" version="1.0" compatibility="0.8" installRequired="true">
|
||||
<author name="e107dev" url="http://e107.org"/>
|
||||
<description>This plugin is a fully featured Download system</description>
|
||||
@@ -26,6 +26,7 @@
|
||||
<pref name="download_order" value="" />
|
||||
<pref name="download_sort" value="" />
|
||||
<pref name="download_reportbroken" value="0" />
|
||||
<pref name="mirror_order" value="" />
|
||||
<pref name="download_email" value="" />
|
||||
<pref name="agree_flag" value="" /> <!-- needs download prefix? -->
|
||||
<pref name="agree_text" value="" />
|
||||
|
Reference in New Issue
Block a user